diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Revision history for glean
+
+## 0.1.0.0 -- YYYY-mm-dd
+
+* First version. Released on an unsuspecting world.
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+BSD License
+
+For Glean software
+
+Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+   endorse or promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,91 @@
+[![CI](https://github.com/facebookincubator/Glean/actions/workflows/ci.yml/badge.svg)](https://github.com/facebookincubator/Glean/actions/workflows/ci.yml)
+[![Glean demo Docker image](https://github.com/facebookincubator/Glean/actions/workflows/glean-docker.yml/badge.svg)](https://github.com/facebookincubator/Glean/actions/workflows/glean-docker.yml)
+
+# Glean
+
+[Glean home](https://glean.software) | [Documentation](https://glean.software/docs/introduction)
+
+Glean is a system for working with facts about source code. You can
+use it for:
+
+* Collecting and storing detailed information about code
+  structure. Glean is designed around an efficient storage model that
+  enables storing information about code at scale.
+
+* Querying information about code, to power tools and experiences from
+  online IDE features to offline code analysis.
+
+## Status
+
+Glean is pre-release software. There are many rough edges; there are
+limited language indexers available initially; the build system is not as smooth
+as we would like. However, we want to make it available for you to experiment
+with and contribute to.
+
+We'd love to hear feedback! If you run into problems or have
+suggestions please file an
+[issue](https://github.com/facebookincubator/Glean/issues).
+
+## Language coverage
+
+There is currently full support for:
+
+* [C++ and C](https://glean.software/docs/indexer/cxx)
+* [Hack](https://glean.software/docs/indexer/hack)
+* [Haskell](https://glean.software/docs/indexer/haskell)
+* [JavaScript/Flow](https://glean.software/docs/indexer/flow)
+
+We also support the [SCIP](https://github.com/sourcegraph/scip) or [LSIF](https://lsif.dev) code indexing formats, for:
+
+* [Rust (via rust-analyzer)](https://glean.software/docs/indexer/lsif-rust)
+* [Go](https://glean.software/docs/indexer/lsif-go)
+* [TypeScript](https://glean.software/docs/indexer/lsif-typescript)
+* [Java](https://glean.software/docs/indexer/lsif-java)
+* [Python](https://glean.software/docs/indexer/scip-python)
+* [Dotnet](https://glean.software/docs/indexer/scip-dotnet)
+
+Custom indexers for these languages exist but aren't in the open source release
+yet; we hope to make these available in the future:
+
+* Python
+* Java
+* Kotlin
+* Erlang
+* Thrift
+* Buck and Bazel
+* C#
+
+## License
+
+Glean is licensed under a [BSD LICENSE](LICENSE).
+
+## Contributing
+
+We'd love to have your help developing Glean. Please submit [pull
+requests](https://github.com/facebookincubator/Glean/pulls) on github,
+and note that we need contributors to sign the [Contributor license
+agreement](https://code.facebook.com/cla) before we can accept your
+pull request.
+
+Style guide: for Haskell code, we use `hlint` to check for style issues. Lines
+wrap at 80 columns. Code should be -Wall clean. For C++, code should compile
+with Clang or GCC.
+
+## How to contact the Glean team
+
+- Visit [the project GitHub repo](https://github.com/facebookincubator/Glean) to view the source code, open issues or pull requests.
+- Join the [Glean Discord server](https://discord.com/channels/280033776820813825/505370075402862594/808027763868827659). You can join the server via [this invitation](https://discord.gg/w3s6X6QAHZ).
+## Building
+
+See [Building Glean](https://glean.software/docs/building).
+
+## Docker demo
+
+For demo of the react codebase with hyperlinks powered by glean run
+`docker run -ti -p8888:8888 ghcr.io/facebookincubator/glean/demo`
+
+Try out on your own codebase with a .flowconfig by running
+`docker run -ti -p8888:8888 -v __YOUR_CODE_DIR__:/glean_demo/code ghcr.io/facebookincubator/glean/demo`
+
+Play round using the glean binaries in a shell by running
+`docker run -ti -p8888:8888 ghcr.io/facebookincubator/glean/demo shell`
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,12 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Setup where
+
+import Distribution.Simple
+main = defaultMain
diff --git a/glean.cabal b/glean.cabal
new file mode 100644
--- /dev/null
+++ b/glean.cabal
@@ -0,0 +1,2281 @@
+cabal-version:       3.6
+
+-- Copyright (c) Facebook, Inc. and its affiliates.
+
+-- @generated from glean.cabal.in
+-- DO NO EDIT THIS FILE DIRECTLY
+
+name:                glean
+version:             0.1.0.0
+synopsis: A system for collecting, deriving and working with facts
+          about source code.
+homepage:            https://github.com/facebookincubator/Glean
+bug-reports:         https://github.com/facebookincubator/Glean/issues
+license:             BSD-3-Clause
+license-file:        LICENSE
+author:              Facebook, Inc.
+maintainer:          Glean-team@fb.com
+copyright:           (c) Facebook, All Rights Reserved
+build-type:          Simple
+extra-doc-files:     CHANGELOG.md, README.md
+
+
+data-files:
+    glean/schema/source/**/*.angle
+
+common fb-haskell
+    default-language: Haskell2010
+    default-extensions:
+        BangPatterns
+        BinaryLiterals
+        DataKinds
+        DeriveDataTypeable
+        DeriveGeneric
+        EmptyCase
+        ExistentialQuantification
+        FlexibleContexts
+        FlexibleInstances
+        GADTs
+        GeneralizedNewtypeDeriving
+        LambdaCase
+        MultiParamTypeClasses
+        MultiWayIf
+        NamedFieldPuns
+        NoMonomorphismRestriction
+        OverloadedStrings
+        PatternSynonyms
+        RankNTypes
+        RecordWildCards
+        ScopedTypeVariables
+        StandaloneDeriving
+        TupleSections
+        TypeFamilies
+        TypeSynonymInstances
+        NondecreasingIndentation
+        TypeOperators
+
+    ghc-options: -Wall -Wno-orphans -Wno-name-shadowing
+    if flag(opt)
+       ghc-options: -O2
+
+common fb-cpp
+  cxx-options: -std=c++17 -Wno-nullability-completeness
+  if !flag(clang)
+     cxx-options: -fcoroutines
+  if arch(x86_64)
+     cxx-options: -march=haswell
+  if flag(opt)
+     cxx-options: -O3 -DNDEBUG
+     cxx-options: -O3
+  
+
+common exe
+  ghc-options: -threaded -rtsopts
+
+common haskell-indexer
+  if impl(ghc >= 9.2)
+    buildable: True
+  else
+    buildable: False
+
+flag clang
+     default: False
+
+flag opt
+     default: False
+
+flag benchmarks
+     default: False
+
+-- run tests that require clang
+flag clang-tests
+     default: True
+
+-- run tests that require hhvm, typically Linux/x86_64
+flag hack-tests
+     default: True
+
+-- run tests that require lsif-tsc
+flag typescript-tests
+     default: True
+
+-- run tests that require python-scip
+flag python-tests
+     default: True
+
+-- run tests that require dotnet-scip
+flag dotnet-tests
+     default: True
+
+-- run tests that require lsif-go
+flag go-tests
+     default: False
+
+-- run tests that require rust-analyzer
+flag rust-tests
+     default: True
+
+-- run tests that require lsif-java
+flag java-lsif-tests
+     default: False
+
+-- run tests that require flow
+flag flow-tests
+     default: True
+
+-- use fbthrift as the the server/client transport, or HTTP?
+flag fbthrift
+     default: False
+
+flag use-folly-clib
+     default: False
+
+common folly
+    if flag(use-folly-clib)
+        build-depends: fb-util >= 0.2, folly-clib > 0
+    else
+        build-depends: fb-util < 0.2
+        pkgconfig-depends: libfolly
+
+common deps
+    build-depends:
+        fb-util,
+        thrift-lib,
+        HUnit,
+        safe,
+        safe-exceptions,
+        scientific,
+        text-show,
+        uuid,
+        extra,
+        aeson,
+        data-default,
+        temporary,
+        clock,
+        STMonadTrans,
+        utf8-string,
+        optparse-applicative,
+        ansi-terminal,
+        json,
+        random,
+        regex-base,
+        regex-pcre,
+        base >=4.11.1 && <4.19,
+        array ^>=0.5.2.0,
+        async ^>=2.2.1,
+        attoparsec >=0.13.2.3 && <0.15,
+        attoparsec-aeson >= 2.1 && < 2.3,
+        unordered-containers ^>=0.2.9.0,
+        containers,
+        contravariant ^>=1.5,
+        text >=1.2.3.0 && < 2.2,
+        bytestring >=0.10.8.2 && <0.12,
+        vector >=0.12.0.1 && <0.14,
+        transformers >= 0.5.6 && < 0.7,
+        network-uri ^>=2.6.1.0,
+        stm ^>=2.5.0.0,
+        directory ^>=1.3.1.5,
+        filepath ^>=1.4.2,
+        exceptions ^>=0.10.0,
+        mtl >= 2.2.2 && < 2.4,
+        unix >= 2.7.2.2 && < 2.9,
+        process ^>=1.6.3.0,
+        prettyprinter >=1.2.1 && <1.8,
+        time >=1.8.0.2 && <1.13,
+        binary ^>=0.8.5.1,
+        deepseq ^>=1.4.3.0,
+        hashable >=1.2.7.0 && <1.6,
+        tar ^>=0.5.1.0,
+        ghc-prim >=0.5.2.0 && <0.11,
+        parsec ^>=3.1.13.0,
+        haxl >= 2.1.2.0 && < 2.6,
+        hinotify ^>= 0.4.1
+
+common hsc2hs-cpp
+    hsc2hs-options: --cc=g++ --lflag=-lstdc++ --cflag=-D__HSC2HS__=1 --cflag=-std=c++17
+
+common thrift-server
+    if flag(fbthrift)
+       cpp-options: -DFBTHRIFT
+       build-depends: thrift-server
+    else
+       build-depends: thrift-http
+
+common thrift-client
+    if flag(fbthrift)
+       cpp-options: -DFBTHRIFT
+       build-depends: thrift-cpp-channel
+    else
+       build-depends: thrift-http
+
+library stubs
+    import: fb-haskell, fb-cpp, deps, thrift-server
+    visibility: public
+    hs-source-dirs: glean/github
+    exposed-modules:
+        Facebook.Fb303
+        Facebook.Service
+        Glean.BuildInfo
+        Glean.Datasource.Scribe.Write
+        Glean.Init
+        Glean.Server.PublishShards
+        Glean.Index
+        Glean.Username
+        ServiceData.Types
+        ServiceData.GlobalStats
+        TestRunner
+    build-depends:
+        glean:if-fb303-hs,
+        glean:if-glean-hs,
+        glean:if-index-hs,
+        mangle,
+        template-haskell,
+        tasty,
+        tasty-hunit-adapter
+
+library logger
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/github
+    exposed-modules:
+        Logger.IO
+        Logger.GleanGlass
+        Logger.GleanGlassErrors
+    build-depends:
+        glean:util
+
+library config
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    include-dirs: .
+    hs-source-dirs:
+        glean/config/gen-hs2
+        glean/config/server/gen-hs2
+        glean/config/client/gen-hs2
+    exposed-modules:
+        Glean.Service.Types
+        Glean.ClientConfig.Types
+        Glean.ServerConfig.Types
+
+library defaultconfigs
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/github
+    exposed-modules:
+        Glean.DefaultConfigs
+    build-depends:
+        glean:config,
+        glean:util
+
+library thrift-annotation
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs:
+        thrift/annotation/gen-hs2
+    exposed-modules:
+        Facebook.Thrift.Annotation.Cpp.Cpp.Types
+        Hack.Types
+        Rust.Types
+        Scope.Types
+        Facebook.Thrift.Annotation.Thrift.Thrift.Types
+
+library if-fb303-hs
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs:
+        glean/github/if/gen-hs2
+    exposed-modules:
+        Fb303Core.Types
+        Fb303Core.BaseService.Client
+        Fb303Core.BaseService.Service
+        Fb303.Types
+        Fb303.FacebookService.Client
+        Fb303.FacebookService.Service
+    build-depends:
+        glean:thrift-annotation,
+
+library if-glean-hs
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs:
+        glean/if/gen-hs2
+    exposed-modules:
+        Glean.Types
+        Glean.GleanService.Client
+        Glean.GleanService.Service
+    build-depends:
+        glean:thrift-annotation,
+        glean:config,
+        glean:if-fb303-hs
+
+library if-index-hs
+    import: fb-haskell, deps
+    visibility: public
+    hs-source-dirs:
+        glean/if/index/gen-hs2
+    exposed-modules:
+        Glean.Index.Types
+        Glean.Index.GleanIndexingService.Client
+        Glean.Index.GleanIndexingService.Service
+    build-depends:
+        glean:if-glean-hs
+
+library if-internal-hs
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs:
+        glean/if/internal/gen-hs2
+    exposed-modules:
+        Glean.Internal.Types
+    build-depends:
+        glean:config,
+        glean:if-glean-hs
+
+library rts
+    import: fb-haskell, fb-cpp, deps, folly
+    visibility: public
+    include-dirs: .
+    cxx-sources:
+        glean/rts/binary.cpp
+        glean/rts/benchmarking/factblock.cpp
+        glean/rts/benchmarking/ffi.cpp
+        glean/rts/bytecode/subroutine.cpp
+        glean/rts/cache.cpp
+        glean/rts/define.cpp
+        glean/rts/error.cpp
+        glean/rts/fact.cpp
+        glean/rts/factset.cpp
+        glean/rts/ffi.cpp
+        glean/rts/inventory.cpp
+        glean/rts/json.cpp
+        glean/rts/lookup.cpp
+        glean/rts/nat.cpp
+        glean/rts/ownership.cpp
+        glean/rts/ownership/derived.cpp
+        glean/rts/ownership/setu32.cpp
+        glean/rts/ownership/slice.cpp
+        glean/rts/ownership/uset.cpp
+        glean/rts/prim.cpp
+        glean/rts/query.cpp
+        glean/rts/sanity.cpp
+        glean/rts/set.cpp
+        glean/rts/stats.cpp
+        glean/rts/string.cpp
+        glean/rts/substitution.cpp
+        glean/rts/thrift.cpp
+        glean/rts/timer.cpp
+        glean/rts/validate.cpp
+    cxx-options: -DOSS=1
+    install-includes:
+        glean/bytecode/evaluate.h
+        glean/bytecode/instruction.h
+        glean/rts/benchmarking/factblock.h
+        glean/rts/benchmarking/ffi.h
+        glean/rts/binary.h
+        glean/rts/bytecode/subroutine.h
+        glean/rts/bytecode/syscall.h
+        glean/rts/cache.h
+        glean/rts/define.h
+        glean/rts/densemap.h
+        glean/rts/error.h
+        glean/rts/fact.h
+        glean/rts/factset.h
+        glean/rts/ffi.h
+        glean/rts/id.h
+        glean/rts/inventory.h
+        glean/rts/json.h
+        glean/rts/lookup.h
+        glean/rts/nat.h
+        glean/rts/ondemand.h
+        glean/rts/ownership/derived.h
+        glean/rts/ownership/fallbackavx.h
+        glean/rts/ownership.h
+        glean/rts/ownership/pool.h
+        glean/rts/ownership/setu32.h
+        glean/rts/ownership/slice.h
+        glean/rts/ownership/triearray.h
+        glean/rts/ownership/uset.h
+        glean/rts/prim.h
+        glean/rts/query.h
+        glean/rts/sanity.h
+        glean/rts/serialize.h
+        glean/rts/set.h
+        glean/rts/stacked.h
+        glean/rts/stats.h
+        glean/rts/store.h
+        glean/rts/string.h
+        glean/rts/substitution.h
+        glean/rts/tests/arbitrary.h
+        glean/rts/tests/uniform.h
+        glean/rts/thrift.h
+        glean/rts/timer.h
+        glean/rts/validate.h
+    -- __atomic_is_lock_free missing with clang
+    extra-libraries: atomic
+    pkgconfig-depends: libunwind, libglog, icu-uc, gflags, libxxhash
+
+library rocksdb
+    import: fb-haskell, fb-cpp, deps, folly
+    visibility: private
+    cxx-sources:
+        glean/rocksdb/container-impl.cpp
+        glean/rocksdb/database-impl.cpp
+        glean/rocksdb/ownership.cpp
+        glean/rocksdb/ffi.cpp
+        glean/rocksdb/rocksdb.cpp
+    cxx-options: -fno-rtti -DOSS=1
+    include-dirs: .
+    install-includes:
+        glean/rocksdb/container-impl.h
+        glean/rocksdb/database-impl.h
+        glean/rocksdb/ffi.h
+        glean/rocksdb/rocksdb.h
+        glean/rocksdb/util.h
+    pkgconfig-depends: rocksdb, fmt
+    build-depends:
+        glean:rocksdb-stats,
+        glean:rts,
+
+-- This needs to be separate from rocksdb because it can't be compiled with -fno-rtti
+library rocksdb-stats
+    import: fb-haskell, fb-cpp, deps, folly
+    visibility: private
+    cxx-sources:
+        glean/rocksdb/stats.cpp
+    include-dirs: .
+    install-includes:
+        glean/rocksdb/stats.h
+    build-depends:
+        glean:rts,
+
+library util
+    import: fb-haskell, fb-cpp, deps, thrift-client
+    visibility: public
+    hs-source-dirs: glean/util
+    exposed-modules:
+        Glean.Impl.ThriftService
+        Glean.Impl.ConfigProvider
+        Glean.Impl.TestConfigProvider
+        Glean.Util.Bisect
+        Glean.Util.ConfigProvider
+        Glean.Util.Disk
+        Glean.Util.IO
+        Glean.Util.Metric
+        Glean.Util.Mutex
+        Glean.Util.Observed
+        Glean.Util.Periodic
+        Glean.Util.Process
+        Glean.Util.RetryRecvTimeout
+        Glean.Util.RetryChannelException
+        Glean.Util.Service
+        Glean.Util.ShardManager
+        Glean.Util.Some
+        Glean.Util.ThriftService
+        Glean.Util.ThriftSource
+        Glean.Util.Throttle
+        Glean.Util.TransitiveClosure
+        Glean.Util.Trace
+        Glean.Util.ValueBuffer
+        Glean.Util.Vector
+        Glean.Util.Warden
+    build-depends:
+        glean:stubs,
+        glean:config,
+        glean:if-glean-hs,
+        primitive,
+        network
+
+library core
+    import: fb-haskell, fb-cpp, deps, hsc2hs-cpp
+    visibility: public
+    hs-source-dirs: glean/hs
+    default-extensions: CPP
+    hsc2hs-options: --cflag=-DOSS=1
+
+    exposed-modules:
+        Glean.FFI
+
+        Glean.RTS
+        Glean.RTS.Builder
+        Glean.RTS.Bytecode.Code
+        Glean.RTS.Bytecode.Disassemble
+        Glean.RTS.Bytecode.Supply
+        Glean.RTS.Constants
+        Glean.RTS.Foreign.Benchmarking
+        Glean.RTS.Foreign.Bytecode
+        Glean.RTS.Foreign.Define
+        Glean.RTS.Foreign.FactSet
+        Glean.RTS.Foreign.Inventory
+        Glean.RTS.Foreign.JSON
+        Glean.RTS.Foreign.LookupCache
+        Glean.RTS.Foreign.Lookup
+        Glean.RTS.Foreign.Ownership
+        Glean.RTS.Foreign.Query
+        Glean.RTS.Foreign.Stacked
+        Glean.RTS.Foreign.Stats
+        Glean.RTS.Foreign.Subst
+        Glean.RTS.Foreign.Thrift
+        Glean.RTS.Foreign.Typecheck
+        Glean.RTS.Set
+        Glean.RTS.Term
+        Glean.RTS.Traverse
+        Glean.RTS.Typecheck
+        Glean.RTS.Types
+
+        -- generated by bytecode-gen-hs
+        Glean.RTS.Bytecode.Gen.Instruction
+        Glean.RTS.Bytecode.Gen.Issue
+        Glean.RTS.Bytecode.Gen.Version
+
+        Glean.Typed
+        Glean.Typed.Binary
+        Glean.Typed.Build
+        Glean.Typed.BuildFact
+        Glean.Typed.Fact
+        Glean.Typed.Id
+        Glean.Typed.Predicate
+        Glean.Typed.Prim
+
+        Glean.Query.Thrift
+        Glean.Query.Thrift.Internal
+
+        Glean.Write.Async
+        Glean.Write.Options
+        Glean.Write.SendBatch
+        Glean.Write.SendQueue
+        Glean.Write.SendAndRebaseQueue
+        Glean.Write.Stats
+
+        Glean.Angle.Hash
+        Glean.Angle.Lexer
+        Glean.Angle.Parser
+        Glean.Angle.Types
+        Glean.Display
+        Glean.Query.Angle
+        Glean.Repo.Text
+        Glean.Schema.Resolve
+        Glean.Schema.Evolve
+        Glean.Schema.Types
+        Glean.Schema.Util
+
+        Glean.Backend.Types
+        Glean.Backend.Retry
+
+    build-tool-depends: alex:alex, happy:happy
+    build-depends:
+        glean:bytecode,
+        glean:config,
+        glean:defaultconfigs,
+        glean:util,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:rts,
+        glean:stubs,
+        glean:rocksdb,
+
+library db
+    import: fb-haskell, fb-cpp, deps, hsc2hs-cpp
+    visibility: public
+    hs-source-dirs: glean/db
+    default-extensions: CPP
+    cpp-options: -DOSS=1
+
+    exposed-modules:
+        Glean.Database.Backup
+        Glean.Database.Backup.Backend
+        Glean.Database.Backup.Locator
+        Glean.Database.Backup.Mock
+        Glean.Database.BatchLocation
+        Glean.Database.Catalog.Filter
+        Glean.Database.Catalog
+        Glean.Database.Catalog.Local.Files
+        Glean.Database.Catalog.Local.Memory
+        Glean.Database.Catalog.Store
+        Glean.Database.CompletePredicates
+        Glean.Database.Config
+        Glean.Database.Data
+        Glean.Database.Env
+        Glean.Database.Exception
+        Glean.Database.Open
+        Glean.Database.Close
+        Glean.Database.Restore
+        Glean.Database.Delete
+        Glean.Database.Create
+        Glean.Database.Finish
+        Glean.Database.List
+        Glean.Database.Janitor
+        Glean.Database.Logger
+        Glean.Database.Meta
+        Glean.Database.Ownership
+        Glean.Database.PredicateStats
+        Glean.Database.Repo
+        Glean.Database.Retention
+        Glean.Database.Schema
+        Glean.Database.Schema.ComputeIds
+        Glean.Database.Schema.Types
+        Glean.Database.Storage
+        Glean.Database.Storage.Memory
+        Glean.Database.Storage.RocksDB
+        Glean.Database.Trace
+        Glean.Database.Types
+        Glean.Database.Validate
+        Glean.Database.Writes
+        Glean.Database.Write.Batch
+        Glean.Logger.Database
+        Glean.Logger.Server
+        Glean.Write.JSON
+        Glean.Query.BindOrder
+        Glean.Query.Codegen
+        Glean.Query.Codegen.QueryRegs
+        Glean.Query.Codegen.Types
+        Glean.Query.Transform
+        Glean.Query.Expand
+        Glean.Query.Flatten
+        Glean.Query.Flatten.Types
+        Glean.Query.Opt
+        Glean.Query.Prune
+        Glean.Query.Reorder
+        Glean.Query.Typecheck
+        Glean.Query.Typecheck.Monad
+        Glean.Query.Typecheck.Types
+        Glean.Query.Typecheck.Unify
+        Glean.Query.Vars
+
+        Glean.Query.JSON
+
+        Glean.Query.Derive
+        Glean.Query.UserQuery
+        Glean.Query.Incremental
+
+        Glean.Backend.Local
+        Glean.Backend.Logging
+        Glean.Dump
+        Glean.Logger
+
+    other-modules:
+        Paths_glean
+    autogen-modules:
+        Paths_glean
+
+    build-depends:
+        split,
+        glean:bytecode,
+        glean:config,
+        glean:core,
+        glean:defaultconfigs,
+        glean:haxl-datasource,
+        glean:util,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:rts,
+        glean:stubs,
+        glean:rocksdb,
+
+library client-hs
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs: glean/client/hs
+    cxx-sources:
+        glean/client/hs/cpp/write.cpp
+    exposed-modules:
+          Glean
+          Glean.Angle
+          Glean.Write
+          Glean.Haxl
+          Glean.Remote
+          Glean.Repo
+          Glean.Haxl.Repos
+          Glean.Util.ShellPrint
+    build-depends:
+        pretty,
+        aeson-pretty,
+        mangle,
+        glean:if-glean-hs,
+        glean:util,
+        glean:core,
+        glean:config,
+        glean:defaultconfigs,
+        glean:haxl-datasource,
+        glean:stubs,
+        prettyprinter-ansi-terminal,
+        thrift-haxl,
+        process-extras
+
+library client-hs-local
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs: glean/client/hs/local
+    exposed-modules:
+        Glean.LocalOrRemote
+    build-depends:
+        glean:if-glean-hs,
+        glean:core,
+        glean:client-hs,
+        glean:db,
+        glean:defaultconfigs,
+        glean:util,
+
+-- things needed by glean-clang
+library client-cpp
+    import: fb-haskell, fb-cpp, deps, folly
+    visibility: public
+    cxx-sources:
+        glean/cpp/filewriter.cpp
+        glean/cpp/glean.cpp
+        glean/interprocess/cpp/worklist.cpp
+        glean/interprocess/cpp/counters.cpp
+    cxx-options: -DOSS=1
+    include-dirs: .
+    install-includes:
+        glean/cpp/filewriter.h
+        glean/cpp/sender.h
+        glean/cpp/glean.h
+        glean/interprocess/cpp/counters.h
+        glean/interprocess/cpp/counters_ffi.h
+        glean/interprocess/cpp/worklist.h
+        glean/interprocess/cpp/worklist_ffi.h
+    build-depends:
+        glean:rts
+
+library interprocess
+    import: fb-haskell, deps
+    visibility: public
+    hs-source-dirs: glean/interprocess/hs
+    exposed-modules:
+        Glean.Interprocess.Counters
+        Glean.Interprocess.Worklist
+    build-depends:
+        glean:client-cpp
+
+library schema
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs:
+        glean/schema/hs
+        glean/schema/thrift/gen-hs2
+    exposed-modules:
+        Glean.Schema.Anglelang
+        Glean.Schema.Buck
+        Glean.Schema.Builtin
+        Glean.Schema.Code
+        Glean.Schema.CodeAnglelang
+        Glean.Schema.CodeCsharp
+        Glean.Schema.CodeCxx
+        Glean.Schema.CodeDataswarm
+        Glean.Schema.CodeErlang
+        Glean.Schema.CodeGraphql
+        Glean.Schema.CodeHack
+        Glean.Schema.CodeHs
+        Glean.Schema.CodeJava
+        Glean.Schema.CodeKotlin
+        Glean.Schema.CodeLsif
+        Glean.Schema.Codemarkup
+        Glean.Schema.CodemarkupAnglelang
+        Glean.Schema.CodemarkupBuck
+        Glean.Schema.CodemarkupCsharp
+        Glean.Schema.CodemarkupCxx
+        Glean.Schema.CodemarkupDataswarm
+        Glean.Schema.CodemarkupErlang
+        Glean.Schema.CodemarkupFlow
+        Glean.Schema.CodemarkupGraphql
+        Glean.Schema.CodemarkupHack
+        Glean.Schema.CodemarkupHaskell
+        Glean.Schema.CodemarkupLsif
+        Glean.Schema.CodemarkupPp
+        Glean.Schema.CodemarkupPython
+        Glean.Schema.CodemarkupScip
+        Glean.Schema.CodemarkupSearch
+        Glean.Schema.CodemarkupTypes
+        Glean.Schema.CodePp
+        Glean.Schema.CodePython
+        Glean.Schema.CodeBuck
+        Glean.Schema.Csharp
+        Glean.Schema.Cxx1
+        Glean.Schema.Digest
+        Glean.Schema.Dataswarm
+        Glean.Schema.Glass
+        Glean.Schema.Erlang
+        Glean.Schema.Flow
+        Glean.Schema.GleanTest
+        Glean.Schema.Graphql
+        Glean.Schema.Hack
+        Glean.Schema.Hs
+        Glean.Schema.JavakotlinAlpha
+        Glean.Schema.KotlinAlpha
+        Glean.Schema.Lsif
+        Glean.Schema.Pp1
+        Glean.Schema.Python
+        Glean.Schema.SearchAnglelang
+        Glean.Schema.SearchBuck
+        Glean.Schema.SearchCode
+        Glean.Schema.SearchCxx
+        Glean.Schema.SearchErlang
+        Glean.Schema.SearchHack
+        Glean.Schema.SearchHs
+        Glean.Schema.SearchPp
+        Glean.Schema.Src
+        Glean.Schema.Sys
+        Glean.Schema.Anglelang.Types
+        Glean.Schema.Buck.Types
+        Glean.Schema.Builtin.Types
+        Glean.Schema.CodeAnglelang.Types
+        Glean.Schema.CodeBuck.Types
+        Glean.Schema.CodeCsharp.Types
+        Glean.Schema.CodeCxx.Types
+        Glean.Schema.CodeDataswarm.Types
+        Glean.Schema.CodeErlang.Types
+        Glean.Schema.CodeFlow.Types
+        Glean.Schema.CodeGraphql.Types
+        Glean.Schema.CodeHack.Types
+        Glean.Schema.CodeHs.Types
+        Glean.Schema.CodeJava.Types
+        Glean.Schema.CodeKotlin.Types
+        Glean.Schema.CodeLsif.Types
+        Glean.Schema.CodemarkupAnglelang.Types
+        Glean.Schema.CodemarkupBuck.Types
+        Glean.Schema.CodemarkupCsharp.Types
+        Glean.Schema.CodemarkupCxx.Types
+        Glean.Schema.CodemarkupDataswarm.Types
+        Glean.Schema.CodemarkupErlang.Types
+        Glean.Schema.CodemarkupFlow.Types
+        Glean.Schema.CodemarkupGraphql.Types
+        Glean.Schema.CodemarkupHack.Types
+        Glean.Schema.CodemarkupHaskell.Types
+        Glean.Schema.CodemarkupLsif.Types
+        Glean.Schema.CodemarkupPp.Types
+        Glean.Schema.CodemarkupPython.Types
+        Glean.Schema.CodemarkupScip.Types
+        Glean.Schema.CodemarkupSearch.Types
+        Glean.Schema.Codemarkup.Types
+        Glean.Schema.CodemarkupTypes.Types
+        Glean.Schema.CodePp.Types
+        Glean.Schema.CodePython.Types
+        Glean.Schema.CodeScip.Types
+        Glean.Schema.CodeFbthrift.Types
+        Glean.Schema.Code.Types
+        Glean.Schema.Csharp.Types
+        Glean.Schema.Cxx1.Types
+        Glean.Schema.Dataswarm.Types
+        Glean.Schema.Digest.Types
+        Glean.Schema.Erlang.Types
+        Glean.Schema.Flow.Types
+        Glean.Schema.Glass.Types
+        Glean.Schema.GleanTest.Types
+        Glean.Schema.Graphql.Types
+        Glean.Schema.Hack.Types
+        Glean.Schema.Hs.Types
+        Glean.Schema.JavaAlpha.Types
+        Glean.Schema.JavakotlinAlpha.Types
+        Glean.Schema.KotlinAlpha.Types
+        Glean.Schema.Lsif.Types
+        Glean.Schema.LsifTypes.Types
+        Glean.Schema.Scip.Types
+        Glean.Schema.Pp1.Types
+        Glean.Schema.Python.Types
+        Glean.Schema.SearchAnglelang.Types
+        Glean.Schema.SearchBuck.Types
+        Glean.Schema.SearchCode.Types
+        Glean.Schema.SearchCxx.Types
+        Glean.Schema.SearchErlang.Types
+        Glean.Schema.SearchHack.Types
+        Glean.Schema.SearchHs.Types
+        Glean.Schema.SearchPp.Types
+        Glean.Schema.Src.Types
+        Glean.Schema.SymbolidCxx.Types
+        Glean.Schema.SymbolidJava.Types
+        Glean.Schema.SymbolidKotlin.Types
+        Glean.Schema.Sys.Types
+        Glean.Schema.Fbthrift.Types
+    build-depends:
+        glean:if-glean-hs,
+        glean:config,
+        glean:core,
+        glean:thrift-annotation
+
+-- library clang-test-xref
+--     import: fb-haskell, fb-cpp, deps
+--     visibility: public
+--     hs-source-dirs: lang/clang
+--     exposed-modules:
+--         Glean.Clang.Test.XRef
+
+library haxl-datasource
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/haxl
+    exposed-modules:
+        Haxl.DataSource.Glean
+        Haxl.DataSource.Glean.Common
+    build-depends:
+        glean:config,
+        glean:core,
+        glean:if-glean-hs,
+        glean:util,
+        thrift-haxl
+
+executable gen-schema
+    import: fb-haskell, fb-cpp, deps, exe
+    scope: private
+    main-is: Glean/Schema/Gen/Main.hs
+    hs-source-dirs: glean/schema/gen
+    ghc-options: -main-is Glean.Schema.Gen.Main
+    other-modules:
+        Glean.Schema.Gen.HackJson,
+        Glean.Schema.Gen.Utils,
+        Glean.Schema.Gen.Cpp,
+        Glean.Schema.Gen.Haskell,
+        Glean.Schema.Gen.OCaml,
+        Glean.Schema.Gen.Python,
+        Glean.Schema.Gen.Rust,
+        Glean.Schema.Gen.Thrift
+    build-depends:
+        glean:core,
+        glean:db,
+        glean:config,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        aeson-pretty,
+        fuzzy
+
+library bytecode-instruction
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/bytecode/def
+    exposed-modules:
+        Glean.Bytecode.Generate.Instruction
+    build-depends:
+        glean:bytecode
+
+library bytecode
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/bytecode
+    exposed-modules:
+        Glean.Bytecode.Types
+        Glean.Bytecode.Decode
+        Glean.Bytecode.SysCalls
+
+executable gen-bytecode-cpp
+    import: fb-haskell, fb-cpp, deps, exe
+    scope: private
+    main-is: Glean/Bytecode/Generate/Cpp.hs
+    hs-source-dirs: glean/bytecode/gen
+    ghc-options: -main-is Glean.Bytecode.Generate.Cpp
+    build-depends:
+        glean:bytecode,
+        glean:bytecode-instruction
+
+executable gen-bytecode-hs
+    import: fb-haskell, fb-cpp, deps, exe
+    scope: private
+    main-is: Glean/Bytecode/Generate/Haskell.hs
+    hs-source-dirs: glean/bytecode/gen
+    ghc-options: -main-is Glean.Bytecode.Generate.Haskell
+    build-depends:
+        glean:bytecode,
+        glean:bytecode-instruction
+
+library lib-derive
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs: glean/lib
+    exposed-modules:
+        Glean.Derive
+    build-depends:
+        glean:client-hs,
+        glean:if-glean-hs
+
+library lib
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs: glean/lib
+    exposed-modules:
+        Glean.Util.CxxXRef
+        Glean.Util.Declarations
+        Glean.Util.Range
+        Glean.Util.ToAngle
+        Glean.Util.XRefs
+        Glean.Util.Same
+        Glean.Util.ShowSchemaId
+        Glean.Write.SimpleAsync
+        Glean.Util.PredMap
+        Glean.Util.PredSet
+    build-depends:
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema,
+        glean:util,
+        split
+
+executable disassemble
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/tools/disassemble
+    main-is: Disassemble.hs
+    ghc-options: -main-is Disassemble
+    extra-libraries: stdc++
+    build-depends:
+        glean:bytecode,
+        glean:db,
+        glean:core,
+        glean:if-glean-hs,
+        glean:lib,
+        glean:util,
+
+library test-unit
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/test/unit
+    exposed-modules:
+        Glean.Test.HUnit
+        Glean.Test.Mock
+
+-- Stub for regression tests
+library handler
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/server
+    exposed-modules:
+        Glean.Handler
+    build-depends:
+        glean:client-hs,
+        glean:if-fb303-hs,
+        glean:if-glean-hs,
+        glean:stubs,
+        glean:db,
+        glean:config,
+
+executable glean-server
+    import: fb-haskell, fb-cpp, deps, exe, thrift-server
+    hs-source-dirs: glean/server
+    main-is: Glean/Server.hs
+    ghc-options: -main-is Glean.Server
+    default-extensions: CPP
+    other-modules:
+        Glean.Handler
+        Glean.Server.Config
+        Glean.Server.Sharding
+    extra-libraries: stdc++
+    build-depends:
+        glean:client-hs,
+        glean:if-fb303-hs,
+        glean:if-glean-hs,
+        glean:if-index-hs,
+        glean:stubs,
+        glean:config,
+        glean:core,
+        glean:db,
+        glean:util,
+        haskeline >=0.7.3 && <0.9,
+        json
+
+library shell-lib
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/shell
+    exposed-modules:
+        Glean.Shell
+        Glean.Shell.Error
+        Glean.Shell.Index
+        Glean.Shell.Terminal
+        Glean.Shell.Types
+    default-extensions: CPP
+    extra-libraries: stdc++
+    build-depends:
+        glean:cli-types,
+        glean:if-glean-hs,
+        glean:stubs,
+        glean:config,
+        glean:core,
+        glean:db,
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:indexers,
+        glean:util,
+        glean:lsif,
+        haskeline >=0.7.3 && <0.9,
+        json,
+        monad-control,
+        prettyprinter-ansi-terminal,
+        split
+
+library indexers
+    import: fb-haskell, fb-cpp, deps, thrift-server
+    hs-source-dirs:
+        glean/lang/clang
+        glean/lang/flow
+        glean/lang/go
+        glean/lang/hack
+        glean/lang/haskell
+        glean/lang/java-lsif
+        glean/lang/lsif/indexer
+        glean/lang/scip/indexer
+        glean/lang/swift
+        glean/lang/python-scip
+        glean/lang/dotnet-scip
+        glean/lang/rust-lsif
+        glean/lang/rust-scip
+        glean/lang/typescript
+        glean/index
+        glean/index/list
+    exposed-modules:
+        Glean.Indexer
+        Glean.Indexer.Cpp
+        Glean.Indexer.External
+        Glean.Indexer.Flow
+        Glean.Indexer.Go
+        Glean.Indexer.Hack
+        Glean.Indexer.Haskell
+        Glean.Indexer.JavaLsif
+        Glean.Indexer.LSIF
+        Glean.Indexer.SCIP
+        Glean.Indexer.Swift
+        Glean.Indexer.RustLsif
+        Glean.Indexer.RustScip
+        Glean.Indexer.Typescript
+        Glean.Indexer.PythonScip
+        Glean.Indexer.DotnetScip
+        Glean.Indexer.List
+    build-depends:
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:db,
+        glean:handler,
+        glean:interprocess,
+        glean:lib-derive,
+        glean:lsif,
+        glean:scip,
+        glean:stubs,
+        glean:util
+
+library cli-types
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/tools/gleancli/plugin
+    exposed-modules:
+        GleanCLI.Types
+        GleanCLI.Utils
+    build-depends:
+        glean:client-hs-local,
+        glean:config,
+        glean:db,
+        glean:util,
+
+executable glean
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/tools/gleancli
+    main-is: GleanCLI.hs
+    other-modules:
+        GleanCLI.Backup
+        GleanCLI.Common
+        GleanCLI.Complete
+        GleanCLI.Derive
+        GleanCLI.Finish
+        GleanCLI.Merge
+        GleanCLI.Index
+        GleanCLI.Query
+        GleanCLI.Restore
+        GleanCLI.Write
+    ghc-options: -main-is GleanCLI -with-rtsopts=-I0
+    extra-libraries: stdc++
+    build-depends:
+        glean:cli-types,
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:db,
+        glean:if-glean-hs,
+        glean:indexers,
+        glean:shell-lib,
+        glean:stubs,
+        glean:config,
+        glean:core,
+        glean:lib-derive,
+        glean:util,
+        json,
+        split,
+        Glob,
+
+executable glean-hyperlink
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/demo
+    main-is: Hyperlink.hs
+    ghc-options: -main-is Hyperlink
+    extra-libraries: stdc++
+    build-depends:
+        glean:lib,
+        glean:schema,
+        glean:util,
+        glean:client-hs,
+        http-types,
+        wai,
+        warp
+
+library hack-derive-lib
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/lang/hack
+    exposed-modules:
+        Derive.All
+        Derive.Env
+        Derive.HackDeclarationTarget
+        Derive.Types
+        Glean.Indexer.HackWithDeriver
+    other-modules:
+        Glean.Indexer.Hack
+    build-depends:
+        glean:client-hs,
+        glean:core,
+        glean:if-glean-hs,
+        glean:indexers,
+        glean:lib,
+        glean:lib-derive,
+        glean:schema,
+        glean:util,
+        IntervalMap,
+
+-- external hack deriver
+-- n.b in subdir to avoid recompilation of hack-derive-lib
+executable hack-derive
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/lang/hack/deriver
+    main-is: Derive.hs
+    ghc-options: -main-is Derive
+    build-depends:
+        aeson-pretty,
+        glean:client-hs,
+        glean:hack-derive-lib,
+        glean:schema,
+        glean:stubs,
+        glean:util,
+
+-- Haskell indexer via hie
+executable hie-indexer
+    import: deps, fb-haskell, exe, haskell-indexer
+    hs-source-dirs: glean/lang/haskell
+    main-is: HieIndexer/Main.hs
+    other-modules:
+        HieIndexer.Index
+        HieIndexer.Options
+    ghc-options: -main-is HieIndexer.Main
+    build-depends:
+        ghc,
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:core,
+        glean:lib,
+        glean:schema,
+        glean:stubs,
+        glean:util,
+        hie-compat < 0.3.1.2,
+        hiedb >= 0.6 && < 0.7
+
+-- -----------------------------------------------------------------------------
+-- LSIF support
+
+library lsif
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/lang/lsif
+    exposed-modules:
+        Data.LSIF.Angle
+        Data.LSIF.Env
+        Data.LSIF.Gen
+        Data.LSIF.JSON
+        Data.LSIF.Moniker
+        Data.LSIF.Types
+        Glean.LSIF.Driver
+    build-depends:
+        aeson,
+        split,
+
+library scip
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/lang/scip
+    exposed-modules:
+        Data.SCIP.Angle
+        Glean.SCIP.Driver
+    build-depends:
+        glean:if-proto-scip-hs,
+        glean:lsif,
+        microlens,
+        proto-lens,
+
+-- SCIP support.
+--
+-- Haskell bindings and spec https://github.com/sourcegraph/scip
+--
+library if-proto-scip-hs
+    import: fb-haskell, deps
+    exposed-modules:
+        Proto.Scip,
+        Proto.Scip_Fields
+    hs-source-dirs: glean/lang/scip/proto
+    build-depends: proto-lens-runtime
+
+-- -----------------------------------------------------------------------------
+-- Glass services
+
+-- Glass thrift service definition
+library if-glass-hs
+    import: fb-haskell, fb-cpp, deps
+    visibility: public
+    hs-source-dirs:
+        glean/glass/if/glass/gen-hs2
+    exposed-modules:
+        Glean.Glass.Types
+        Glean.Glass.GlassService.Client
+        Glean.Glass.GlassService.Service
+    build-depends:
+        glean:config,
+        glean:if-fb303-hs,
+        glean:if-index-hs,
+        glean:thrift-annotation,
+
+-- Glass core library
+library glass-lib
+    import: fb-haskell, fb-cpp, deps, thrift-server
+    visibility: public
+    default-extensions: CPP
+    hs-source-dirs: glean/glass
+    exposed-modules:
+        Glean.Glass.Annotations
+        Glean.Glass.Attributes
+        Glean.Glass.Attributes.Class
+        Glean.Glass.Attributes.SymbolKind
+        Glean.Glass.Base
+        Glean.Glass.Comments
+        Glean.Glass.Config
+        Glean.Glass.Describe
+        Glean.Glass.Digest
+        Glean.Glass.Env
+        Glean.Glass.Handler.Symbols
+        Glean.Glass.Handler.Documents
+        Glean.Glass.Handler.Cxx
+        Glean.Glass.Handler.Utils
+        Glean.Glass.Logging
+        Glean.Glass.Main
+        Glean.Glass.NameSearch
+        Glean.Glass.Neighborhood
+        Glean.Glass.Options
+        Glean.Glass.Path
+        Glean.Glass.Pretty.Angle
+        Glean.Glass.Pretty.Cxx
+        Glean.Glass.Pretty.Flow
+        Glean.Glass.Pretty.Fbthrift
+        Glean.Glass.Pretty.Hack
+        Glean.Glass.Pretty.Haskell
+        Glean.Glass.Pretty.Java
+        Glean.Glass.Pretty.LSIF
+        Glean.Glass.Pretty.Python
+        Glean.Glass.Pretty.SCIP
+        Glean.Glass.Query
+        Glean.Glass.Query.Cxx
+        Glean.Glass.Range
+        Glean.Glass.RepoMapping
+        Glean.Glass.Repos
+        Glean.Glass.Search
+        Glean.Glass.Search.Angle
+        Glean.Glass.Search.Buck
+        Glean.Glass.Search.Class
+        Glean.Glass.Search.Cxx
+        Glean.Glass.Search.Erlang
+        Glean.Glass.Search.Flow
+        Glean.Glass.Search.GraphQL
+        Glean.Glass.Search.Hack
+        Glean.Glass.Search.Haskell
+        Glean.Glass.Search.Java
+        Glean.Glass.Search.Kotlin
+        Glean.Glass.Search.LSIF
+        Glean.Glass.Search.Pp
+        Glean.Glass.Search.Python
+        Glean.Glass.SearchRelated
+        Glean.Glass.Search.SCIP
+        Glean.Glass.Search.Thrift
+        Glean.Glass.SnapshotBackend
+        Glean.Glass.SourceControl
+        Glean.Glass.SymbolId
+        Glean.Glass.SymbolId.Angle
+        Glean.Glass.SymbolId.Buck
+        Glean.Glass.SymbolId.Class
+        Glean.Glass.SymbolId.CSharp
+        Glean.Glass.SymbolId.Cxx
+        Glean.Glass.SymbolId.Cxx.Parse
+        Glean.Glass.SymbolId.Erlang
+        Glean.Glass.SymbolId.Flow
+        Glean.Glass.SymbolId.GraphQL
+        Glean.Glass.SymbolId.Hack
+        Glean.Glass.SymbolId.SCIP
+        Glean.Glass.SymbolId.Java
+        Glean.Glass.SymbolId.Hs
+        Glean.Glass.SymbolId.LSIF
+        Glean.Glass.SymbolId.Pp
+        Glean.Glass.SymbolId.Python
+        Glean.Glass.SymbolId.Fbthrift
+        Glean.Glass.SymbolKind
+        Glean.Glass.SymbolMap
+        Glean.Glass.SymbolSig
+        Glean.Glass.Tracer
+        Glean.Glass.Tracing
+        Glean.Glass.Utils
+        Glean.Glass.Visibility
+        Glean.Glass.XRefs
+    build-depends:
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:core,
+        glean:haxl-datasource,
+        glean:if-glass-hs,
+        glean:if-index-hs,
+        glean:lib,
+        glean:logger,
+        glean:schema,
+        glean:stubs,
+        glean:util,
+        uri-encode,
+        SHA,
+        split,
+        ghc
+
+executable glass-server
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/glass/server
+    main-is: Server.hs
+    ghc-options: -main-is Server -threaded
+    extra-libraries: stdc++
+    build-depends:
+        glean:glass-lib,
+
+executable glass-symbol
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/glass/tools/
+    main-is: Glean/Glass/Test/Symbol.hs
+    ghc-options: -main-is Glean.Glass.Test.Symbol
+    extra-libraries: stdc++
+    default-extensions: CPP
+    build-depends:
+        glean:glass-lib,
+        glean:if-glass-hs,
+        glean:stubs,
+
+-- Minimal glass client showing how to wire things up
+executable glass-democlient
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/glass/tools/
+    main-is: Glean/Glass/Test/DemoClient.hs
+    ghc-options: -main-is Glean.Glass.Test.DemoClient
+    extra-libraries: stdc++
+    build-depends:
+        glean:if-glass-hs,
+        glean:stubs,
+        glean:util,
+
+-- -----------------------------------------------------------------------------
+-- Benchmarks
+
+library bench-util
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/bench/lib
+    exposed-modules:
+        Glean.Util.Benchmark
+    build-depends:
+        glean:stubs,
+        criterion < 1.7
+
+executable query-bench
+    import: fb-haskell, fb-cpp, deps, exe
+    if !flag(benchmarks)
+       buildable: False
+    hs-source-dirs: glean/bench
+    main-is: QueryBench.hs
+    other-modules: BenchDB
+    ghc-options: -main-is QueryBench
+    build-depends:
+        glean:bench-util,
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema,
+        glean:test-lib,
+        glean:util,
+        criterion < 1.7
+
+executable rename-bench
+    import: fb-haskell, fb-cpp, deps, exe
+    if !flag(benchmarks)
+       buildable: False
+    hs-source-dirs: glean/bench
+    main-is: RenameBench.hs
+    ghc-options: -main-is RenameBench
+    build-depends:
+        glean:bench-util,
+        glean:core,
+        glean:db,
+        glean:schema,
+        glean:test-lib,
+        glean:util,
+        criterion < 1.7
+
+executable makefact-bench
+    import: fb-haskell, deps, exe
+    if !flag(benchmarks)
+       buildable: False
+    hs-source-dirs: glean/bench
+    main-is: MakeFactBench.hs
+    ghc-options: -main-is MakeFactBench
+    build-depends:
+        glean:bench-util,
+        glean:client-hs,
+        glean:core,
+        glean:schema,
+        glean:test-lib,
+        criterion < 1.7
+
+executable compile-bench
+    import: fb-haskell, fb-cpp, deps, exe
+    if !flag(benchmarks)
+       buildable: False
+    hs-source-dirs: glean/bench
+    main-is: CompileBench.hs
+    ghc-options: -main-is CompileBench
+    build-depends:
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema,
+        glean:test-lib,
+        glean:util,
+        criterion < 1.7,
+        criterion-measurement,
+        statistics,
+        vector-algorithms
+
+executable factset-bench
+    import: fb-haskell, deps, exe
+    if !flag(benchmarks)
+       buildable: False
+    hs-source-dirs: glean/bench
+    main-is: FactSetBench.hs
+    ghc-options: -main-is FactSetBench
+    build-depends:
+        glean:bench-util,
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:core,
+        glean:db,
+        glean:schema,
+        glean:test-lib,
+        glean:util
+
+-- -----------------------------------------------------------------------------
+-- Tests
+
+library test-lib
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/test/lib
+    exposed-modules:
+        TestBatch
+        TestDB
+        TestData
+        Glean.Database.Catalog.Test
+        Glean.Database.Test
+    build-depends:
+        glean:core,
+        glean:db,
+        glean:schema,
+        glean:config,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:stubs,
+        glean:test-unit,
+        glean:util
+
+-- snapshot and other regression tests against glean
+library regression-test-lib
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs:
+        glean/test/regression
+    exposed-modules:
+        Glean.Regression.Config
+        Glean.Regression.Driver.External
+        Glean.Regression.Indexer
+        Glean.Regression.Snapshot
+        Glean.Regression.Snapshot.Driver
+        Glean.Regression.Snapshot.Options
+        Glean.Regression.Snapshot.Query
+        Glean.Regression.Snapshot.Result
+        Glean.Regression.Snapshot.Transform
+        Glean.Regression.Test
+    cpp-options: -DOSS=1
+    build-depends:
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:db,
+        glean:indexers,
+        glean:if-glean-hs,
+        glean:lib,
+        glean:stubs,
+        glean:test-lib,
+        glean:util,
+        split,
+        yaml
+
+library clang-derive-lib
+    import: fb-haskell, fb-cpp, deps
+    hs-source-dirs: glean/lang/clang
+    build-depends:
+        ghc-compact,
+        glean:client-hs,
+        glean:client-hs-local,
+        glean:core,
+        glean:db,
+        glean:lib,
+        glean:lib-derive,
+        glean:schema,
+        glean:util,
+        vector-algorithms
+    exposed-modules:
+        Derive.Common
+        Derive.CxxDeclarationSources
+        Derive.CxxSame
+        Derive.CxxTargetUses
+        Derive.Env
+        Derive.Generic
+        Derive.Lib
+        Derive.Types
+
+test-suite clang-test-regression
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/Regression.hs
+    other-modules: Glean.Regression.Driver.Clang
+                   Glean.Clang.Test
+    ghc-options: -main-is Glean.Clang.Regression
+    build-depends:
+       glean:regression-test-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite clang-test-derivefamilies
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/DeriveFamilies.hs
+    other-modules: Glean.Clang.Test.DerivePass
+                   Glean.Clang.Test
+                   Glean.Regression.Driver.DeriveDeclFamilies
+    ghc-options: -main-is Glean.Clang.DeriveFamilies
+    build-depends:
+       glean:if-glean-hs,
+       glean:client-hs,
+       glean:core,
+       glean:regression-test-lib,
+       glean:clang-derive-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite clang-test-deriveattributes
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/DeriveAttrs.hs
+    other-modules: Glean.Clang.Test.DerivePass
+                   Glean.Clang.Test
+                   Glean.Regression.Driver.DeriveFunctionDeclAttribute
+    ghc-options: -main-is Glean.Clang.DeriveAttrs
+    build-depends:
+       glean:if-glean-hs,
+       glean:client-hs,
+       glean:core,
+       glean:regression-test-lib,
+       glean:clang-derive-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite clang-test-derivefuncalls
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/DeriveFunCalls.hs
+    other-modules: Glean.Clang.Test.DerivePass
+                   Glean.Clang.Test
+                   Glean.Regression.Driver.DeriveFunctionCalls
+    ghc-options: -main-is Glean.Clang.DeriveFunCalls
+    build-depends:
+       glean:if-glean-hs,
+       glean:client-hs,
+       glean:core,
+       glean:regression-test-lib,
+       glean:clang-derive-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite clang-test-deriveobjcinherit
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/DeriveObjCInheritance.hs
+    other-modules: Glean.Clang.Test.DerivePass
+                   Glean.Clang.Test
+                   Glean.Regression.Driver.DeriveObjcInheritance
+    ghc-options: -main-is Glean.Clang.DeriveObjCInheritance
+    build-depends:
+       glean:if-glean-hs,
+       glean:client-hs,
+       glean:core,
+       glean:regression-test-lib,
+       glean:clang-derive-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite clang-test-codemarkup
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs:
+       glean/lang/clang/tests,
+       glean/lang/clang/tests/github
+    type: exitcode-stdio-1.0
+    main-is: Glean/Clang/CodeMarkup.hs
+    other-modules: Glean.Clang.Test.DerivePass
+                   Glean.Clang.Test
+                   Glean.Regression.Driver.DeriveForCodemarkup
+    ghc-options: -main-is Glean.Clang.CodeMarkup
+    build-depends:
+       glean:if-glean-hs,
+       glean:client-hs,
+       glean:core,
+       glean:regression-test-lib,
+       glean:clang-derive-lib,
+       glean:indexers,
+       glean:lib
+    if !flag(clang-tests)
+        buildable: False
+
+test-suite hack-derive-test
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/lang/hack/tests
+    type: exitcode-stdio-1.0
+    main-is: Main.hs
+    ghc-options: -main-is Main
+    other-modules: Driver
+    build-depends:
+       glean:regression-test-lib,
+       glean:hack-derive-lib,
+       glean:indexers,
+    if !flag(hack-tests)
+        buildable: False
+
+library bench-lib
+    import: fb-haskell, fb-cpp, deps
+    visibility: private
+    hs-source-dirs: glean/bench
+    exposed-modules:
+        BenchDB
+    build-depends:
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:schema,
+        glean:test-lib,
+
+-- Skip this one: it depends on the C++ code for the schema, and we
+-- don't want to generate and compile all that just for this one test.
+--
+-- test-suite encoding
+--     import: test
+--     type: exitcode-stdio-1.0
+--     main-is: EncodingTest.hs
+--     ghc-options: -main-is EncodingTest
+--     build-depends:
+--         base16-bytestring,
+--         test-compact,
+--         glean:stubs,
+--         glean:core,
+--         glean:schema
+--
+-- library test-compact
+--     import: fb-haskell, fb-cpp, deps
+--     visibility: private
+--     include-dirs: .
+--     cxx-sources:
+--         glean/test/cpp/compact.cpp
+--     build-depends:
+--         schema-cpp
+--
+-- library schema-cpp
+--     import: fb-haskell, fb-cpp, deps
+--     visibility: private
+--     include-dirs: .
+--     cxx-sources:
+--         glean/schema/gen-cpp2/glean_test_types.cpp
+--         glean/schema/gen-cpp2/glean_test_types_compact.cpp
+--         glean/schema/gen-cpp2/glean_test_types_binary.cpp
+--         glean/schema/gen-cpp2/glean_test_data.cpp
+--         glean/schema/gen-cpp2/builtin_types.cpp
+--         glean/schema/gen-cpp2/builtin_types_compact.cpp
+--         glean/schema/gen-cpp2/builtin_types_binary.cpp
+--         glean/schema/gen-cpp2/builtin_data.cpp
+--         glean/schema/gen-cpp2/sys_types.cpp
+--         glean/schema/gen-cpp2/sys_types_compact.cpp
+--         glean/schema/gen-cpp2/sys_types_binary.cpp
+--         glean/schema/gen-cpp2/sys_data.cpp
+--         ... etc.
+
+common test
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/test/tests
+    build-depends:
+        glean:test-lib,
+        glean:test-unit,
+        HUnit,
+
+common angle-test
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema
+
+test-suite angle-test-angle
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/AngleTest.hs
+    ghc-options: -main-is Angle.AngleTest
+
+test-suite angle-test-error
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/ErrorTest.hs
+    ghc-options: -main-is Angle.ErrorTest
+
+test-suite angle-test-nested
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/NestedTest.hs
+    ghc-options: -main-is Angle.NestedTest
+
+test-suite angle-test-derived
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/DerivedTest.hs
+    ghc-options: -main-is Angle.DerivedTest
+
+test-suite angle-test-set
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/SetTest.hs
+    ghc-options: -main-is Angle.SetTest
+
+test-suite angle-test-stored
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/StoredTest.hs
+    ghc-options: -main-is Angle.StoredTest
+
+test-suite angle-test-array
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/ArrayTest.hs
+    ghc-options: -main-is Angle.ArrayTest
+
+test-suite angle-test-rec-expansion
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/RecExpansionTest.hs
+    ghc-options: -main-is Angle.RecExpansionTest
+
+test-suite angle-test-data
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/DataTest.hs
+    ghc-options: -main-is Angle.DataTest
+
+test-suite angle-test-opt
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/OptTest.hs
+    ghc-options: -main-is Angle.OptTest
+
+test-suite angle-test-misc
+    import: test, angle-test
+    type: exitcode-stdio-1.0
+    main-is: Angle/MiscTest.hs
+    ghc-options: -main-is Angle.MiscTest
+
+test-suite api
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: ApiTest.hs
+    ghc-options: -main-is ApiTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:if-glean-hs,
+        glean:schema
+
+test-suite cppexception
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: CppCatchTest.hs
+    ghc-options: -main-is CppCatchTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema
+
+test-suite timeout
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: TimeoutTest.hs
+    ghc-options: -main-is TimeoutTest
+    build-depends:
+        glean:client-hs,
+        glean:stubs,
+        glean:core,
+        glean:schema,
+        glean:bench-lib
+
+test-suite jsonwrite
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: JSONWriteTest.hs
+    ghc-options: -main-is JSONWriteTest
+    build-depends:
+        glean:client-hs,
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:schema,
+
+test-suite BinaryTest
+    import: fb-haskell, fb-cpp, exe
+    type: exitcode-stdio-1.0
+    main-is: glean/rts/tests/BinaryTest.cpp
+    ghc-options: -no-hs-main
+    cxx-options: -DOSS=1
+    build-depends:
+        glean:rts
+    pkgconfig-depends: gtest_main
+
+test-suite rtstest
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: RTSTest.hs
+    ghc-options: -main-is RTSTest
+    build-depends:
+        glean:client-hs,
+        glean:stubs,
+        glean:core,
+        glean:schema,
+        glean:config,
+        glean:if-glean-hs,
+        QuickCheck,
+        quickcheck-text,
+
+test-suite rts-json
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: RTSJSONTest.hs
+    ghc-options: -main-is RTSJSONTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        QuickCheck,
+        quickcheck-text,
+
+test-suite dbjanitor
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: DatabaseJanitorTest.hs
+    ghc-options: -main-is DatabaseJanitorTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:schema,
+        glean:config,
+        glean:util
+    -- https://github.com/facebookincubator/Glean/issues/224
+    buildable: False
+
+test-suite dbderive
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: DbDeriveTest.hs
+    ghc-options: -main-is DbDeriveTest
+    build-depends:
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:schema,
+        glean:stubs
+
+test-suite backup
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: BackupTest.hs
+    ghc-options: -main-is BackupTest
+    build-depends:
+        glean:config,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:schema,
+        glean:stubs,
+        glean:util
+
+test-suite catalog
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: CatalogTest.hs
+    ghc-options: -main-is CatalogTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        QuickCheck,
+        quickcheck-io,
+        glean:util
+
+test-suite lifecycle
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: LifecycleTest.hs
+    ghc-options: -main-is LifecycleTest
+    build-depends:
+        glean:client-hs,
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:util,
+        QuickCheck,
+        quickcheck-io,
+
+test-suite shard
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: TestShard.hs
+    ghc-options: -main-is TestShard
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:if-glean-hs,
+
+test-suite publish-shards
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: PublishShardsTest.hs
+    hs-source-dirs: glean/server
+    ghc-options: -main-is PublishShardsTest
+    other-modules:
+        DatabaseJanitorTest
+        Glean.Server.Config
+        Glean.Server.Sharding
+    build-depends:
+        glean:config,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:schema,
+        glean:stubs,
+        glean:util
+
+test-suite dbproperties
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: DbPropertiesTest.hs
+    ghc-options: -main-is DbPropertiesTest
+    build-depends:
+        glean:client-hs,
+        glean:stubs,
+        glean:core,
+        glean:if-glean-hs,
+
+test-suite parser
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: ParserTest.hs
+    ghc-options: -main-is ParserTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+
+test-suite schematest
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: Schema/Basic.hs
+    other-modules: Schema.Lib
+    ghc-options: -main-is Schema.Basic
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:config,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:lib-derive,
+        glean:util,
+
+test-suite schemaevolves
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: Schema/Evolves.hs
+    other-modules: Schema.Lib
+    ghc-options: -main-is Schema.Evolves
+    build-depends:
+        glean:stubs,
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:config,
+        glean:if-glean-hs,
+        glean:util,
+
+test-suite schemamulti
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: Schema/Multi.hs
+    other-modules: Schema.Lib
+    ghc-options: -main-is Schema.Multi
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db,
+        glean:config,
+        glean:if-glean-hs,
+        glean:if-internal-hs,
+        glean:util,
+
+test-suite inventory
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: InventoryTest.hs
+    ghc-options: -main-is InventoryTest
+    build-depends:
+        glean:core,
+        glean:db,
+        glean:if-internal-hs,
+        glean:stubs
+
+test-suite continuation
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: ContinuationTest.hs
+    ghc-options: -main-is ContinuationTest
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:if-glean-hs,
+        glean:schema
+
+test-suite lookup
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: LookupTest.hs
+    ghc-options: -main-is LookupTest
+    cxx-sources: glean/rts/tests/LookupInvariants.cpp
+    cxx-options: -DOSS=1
+    build-depends:
+        glean:stubs,
+        glean:core,
+        glean:db
+
+test-suite incremental
+    import: test
+    type: exitcode-stdio-1.0
+    main-is: IncrementalTest.hs
+    ghc-options: -main-is IncrementalTest
+    build-depends:
+        glean:stubs,
+        glean:client-hs,
+        glean:core,
+        glean:db,
+        glean:if-glean-hs,
+        glean:lib-derive,
+        glean:schema
+    if arch(x86_64)
+        buildable: True
+    else
+        buildable: False
+
+test-suite glass-range
+    import: fb-haskell, fb-cpp, deps, exe
+    hs-source-dirs: glean/glass/test
+    default-extensions: CPP
+    type: exitcode-stdio-1.0
+    main-is: Glean/Glass/Test/Range.hs
+    ghc-options: -main-is Glean.Glass.Test.Range
+    build-depends:
+        HUnit,
+        glean:client-hs,
+        glean:glass-lib,
+        glean:if-glass-hs,
+        glean:lib,
+        glean:schema,
+        glean:stubs,
+        glean:test-lib,
+        glean:test-unit,
+
+------------------------------------------------------------------------
+-- Regression tests for schemas, indexers and systems
+--
+-- Glean snapshot regression tests, these require the indexers installed
+--
+test-suite glean-snapshot-flow
+    import: fb-haskell, deps, exe
+    hs-source-dirs: glean/lang/codemarkup/tests/flow
+    type: exitcode-stdio-1.0
+    main-is: Glean/Regression/Flow/Main.hs
+    ghc-options: -main-is Glean.Regression.Flow.Main
+    build-depends:
+        glean:regression-test-lib,
+        glean:indexers
+    if !flag(flow-tests)
+        buildable: False
+
+test-suite glean-snapshot-hack
+    import: fb-haskell, deps, exe
+    hs-source-dirs: glean/lang/codemarkup/tests/hack
+    type: exitcode-stdio-1.0
+    main-is: Glean/Regression/Hack/Main.hs
+    ghc-options: -main-is Glean.Regression.Hack.Main
+    build-depends:
+        glean:regression-test-lib,
+        glean:indexers
+    -- no regular hhvm builds for arm64
+    if !flag(hack-tests)
+        buildable: False
+
+-- The Haskell indexer tests *only* work when run using Cabal with
+-- 
diff --git a/glean/bench/BenchDB.hs b/glean/bench/BenchDB.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/BenchDB.hs
@@ -0,0 +1,70 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module BenchDB (withBenchDB) where
+
+import Control.Monad
+import qualified Data.ByteString.Char8 as BC
+import Data.Default
+import qualified Data.Text as Text
+
+import Glean
+import Glean.Backend.Types (loadPredicates)
+import Glean.Database.Test (withEmptyTestDB, completeTestDB)
+import Glean.Database.Open
+import Glean.Database.Write.Batch
+import qualified Glean.Schema.Sys.Types as Sys
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import qualified Glean.Schema.Sys as Sys
+import qualified Glean.Schema.Cxx1 as Cxx
+import qualified Glean.Schema.GleanTest as Glean.Test
+import Glean.Typed
+
+withBenchDB :: Int -> (forall b . Backend b => b -> Repo -> IO a) -> IO a
+withBenchDB num act = withEmptyTestDB [] $ \env repo -> do
+  withOpenDatabase env repo $ \odb ->
+    void $ return odb
+
+  predicates <- loadPredicates env repo
+    [ Sys.allPredicates
+    , Cxx.allPredicates
+    , Glean.Test.allPredicates
+    ]
+  batch <- buildBatch predicates Nothing $ do
+    blobs <- mapM (makeFact @Sys.Blob)
+      [ "x" <> BC.pack (show n) | n <- [1..num] ]
+
+    names <- mapM (makeFact @Cxx.Name)
+      [ "x" <> Text.pack (show n) | n <- [1..num] ]
+    mapM_ (makeFact @Cxx.FunctionName . Cxx.FunctionName_key_name) names
+
+    mapM_ (makeFact @Glean.Test.Predicate)
+      [ def
+        { Glean.Test.kitchenSink_string_ = "x" <> Text.pack (show n)
+        , Glean.Test.kitchenSink_pred = blob
+        , Glean.Test.kitchenSink_sum_ = Glean.Test.KitchenSink_sum__d blob
+        , Glean.Test.kitchenSink_named_record_ =
+            def { Glean.Test.rec_beta = Glean.Test.Sum_wed True }
+        , Glean.Test.kitchenSink_named_sum_ =
+            Glean.Test.Sum_wed True
+        , Glean.Test.kitchenSink_maybe_ = Nothing
+        , Glean.Test.kitchenSink_array_of_nat = map Nat [1 .. fromIntegral n]
+        }
+
+      | (n,blob) <- zip [(1::Int)..] blobs
+      ]
+
+    ynames <- mapM (makeFact @Cxx.Name)
+      [ "y" <> Text.pack (show n) | n <- [1..1000::Int] ]
+    mapM_ (makeFact @Cxx.FunctionName . Cxx.FunctionName_key_name) ynames
+
+  void $ syncWriteDatabase env repo batch
+  completeTestDB env repo
+  act env repo
diff --git a/glean/bench/CompileBench.hs b/glean/bench/CompileBench.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/CompileBench.hs
@@ -0,0 +1,249 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes, TypeApplications #-}
+
+module CompileBench (main) where
+
+import Control.Monad
+import Criterion.Measurement (secs)
+import Data.Text (Text)
+import qualified Data.Vector.Algorithms.Intro as V
+import qualified Data.Vector.Unboxed as V
+import Statistics.Sample (mean)
+import System.Mem
+import System.IO.Temp
+import System.FilePath ((</>))
+
+import Util.String.Quasi
+
+import Glean
+import Glean.Angle.Types (latestAngleVersion, AngleVersion(..))
+import Glean.Database.Open
+import Glean.Database.Test
+import Glean.Database.Types
+import Glean.Query.Thrift.Internal
+import qualified Glean.Schema.CodeCxx.Types as Code.Cxx
+import qualified Glean.Schema.Codemarkup.Types as Codemarkup
+import Glean.Types
+import Glean.Write.JSON (syncWriteJsonBatch)
+
+data Cfg = Cfg
+  { cfgIters :: Int
+  , cfgStop :: Double
+  }
+
+type Description = String
+
+main :: IO ()
+main = do
+  benchLargeDerivations
+  benchTransformations
+
+benchTransformations :: IO ()
+benchTransformations =
+  withSchemaFile latestAngleVersion schema $ \root file -> do
+  let settings = [setRoot root, setSchemaPath file]
+  repo <- withEmptyTestDB settings $ \env repo -> do
+    void $ syncWriteJsonBatch env repo facts Nothing
+    completeTestDB env repo
+    return repo
+  -- Open db for querying. We need to open the db again because schema
+  -- evolutions and pruning are only triggered when the db is read-only.
+  withTestEnv settings $ \env -> do
+  bench env repo queries
+  where
+    queries =
+      [ ("base predicate - no transformation"
+        , getq $ angleData @Text $
+          [s|
+            S where
+              # bind lhs                    # bind rhs
+              X1 = x.P.2 {_ , _, _, _, _ }; X1 = x.P.2 {S1, _, _, _, _ };
+              X2 = x.P.2 {S1, _, _, _, _ }; X2 = x.P.2 {S2, _, _, _, _ };
+              X3 = x.P.2 {S2, _, _, _, _ }; X3 = x.P.2 {S3, _, _, _, _ };
+              X4 = x.P.2 {S3, _, _, _, _ }; X4 = x.P.2 {S4, _, _, _, _ };
+              X5 = x.P.2 {S4, _, _, _, _ }; X5 = x.P.2 {S5, _, _, _, _ };
+              X6 = x.P.2 {S5, _, _, _, _ }; X6 = x.P.2 {S , _, _, _, _ };
+          |]
+        )
+      , ("base predicate - with transformation"
+        , getq $ angleData @Text $
+          [s|
+            S where
+              # bind lhs          # bind rhs
+              X1 = x.P.1 {_, _ }; X1 = x.P.1 {_, S1};
+              X2 = x.P.1 {_, S1}; X2 = x.P.1 {_, S2};
+              X3 = x.P.1 {_, S2}; X3 = x.P.1 {_, S3};
+              X4 = x.P.1 {_, S3}; X4 = x.P.1 {_, S4};
+              X5 = x.P.1 {_, S4}; X5 = x.P.1 {_, S5};
+              X6 = x.P.1 {_, S5}; X6 = x.P.1 {_, S };
+          |]
+        )
+      , ("derived predicate - no transformation"
+        , getq $ angleData @Text $
+          [s|
+            S where x.Q.2 S =
+              [ x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo"
+              , x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo"
+              , x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo"
+              , x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo", x.Q.2 "foo"
+              ][..];
+          |]
+        )
+      , ("derived predicate - with transformation"
+        , getq $ angleData @Text $
+          [s|
+            S where x.Q.1 S =
+              [ x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo"
+              , x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo"
+              , x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo"
+              , x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo", x.Q.1 "foo"
+              ][..];
+          |]
+        )
+      ]
+    schema =
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+          predicate Q : string
+            S where
+              # bind lhs      # bind rhs
+              X1 = P {_, _ }; X1 = P {_, S1};
+              X2 = P {_, S1}; X2 = P {_, S2};
+              X3 = P {_, S2}; X3 = P {_, S3};
+              X4 = P {_, S3}; X4 = P {_, S4};
+              X5 = P {_, S4}; X5 = P {_, S5};
+              X6 = P {_, S5}; X6 = P {_, S };
+        }
+        schema x.2 : x.1 {
+          predicate P :
+            { y : string
+            , x : nat
+            , a: maybe bool
+            , b: maybe string
+            , c: maybe string
+            }
+
+          predicate Q : string
+            S where
+              # bind lhs                # bind rhs
+              X1 = P {_ , _, _, _, _ }; X1 = P {S1, _, _, _, _ };
+              X2 = P {S1, _, _, _, _ }; X2 = P {S2, _, _, _, _ };
+              X3 = P {S2, _, _, _, _ }; X3 = P {S3, _, _, _, _ };
+              X4 = P {S3, _, _, _, _ }; X4 = P {S4, _, _, _, _ };
+              X5 = P {S4, _, _, _, _ }; X5 = P {S5, _, _, _, _ };
+              X6 = P {S5, _, _, _, _ }; X6 = P {S , _, _, _, _ };
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+
+    facts =
+      [ mkBatch (PredicateRef "x.P" 2)
+        [ [s|{ "key": { "x" : 1, "y": "A", "a": true, "b": "", "c": "" } }|] ]
+      ]
+
+    mkBatch ref facts = JsonFactBatch
+      { jsonFactBatch_predicate = ref
+      , jsonFactBatch_facts = facts
+      , jsonFactBatch_unit = Nothing
+      }
+
+    withSchemaFile :: AngleVersion -> String -> (FilePath -> FilePath -> IO a) -> IO a
+    withSchemaFile (AngleVersion version) str action = do
+      withSystemTempDirectory "glean-dbtest" $ \root -> do
+        let newSchemaFile = root </> "schema"
+        appendFile newSchemaFile $ "version: " <> show version
+        appendFile newSchemaFile str
+        action root newSchemaFile
+
+benchLargeDerivations :: IO ()
+benchLargeDerivations =
+  withEmptyTestDB [] $ \env repo -> do
+  -- NB.Pruning and evolutions do not take place because the
+  -- tests are run on a writable db.
+  withOpenDatabase env repo $ void . return
+  bench env repo queries
+  where
+    queries =
+      [ ("codemarkup.search.earchByScope"
+        , getq $ angleData @Code.Cxx.Entity $
+        "codemarkup.search.SearchByScope { name = \"malloc\", scope = [], searchcase = Sensitive, kind = { just = Function }, entity = E }"
+        )
+      , ("codemarkup.EntityUses"
+        , getq $ angleData @Codemarkup.EntityUses $
+          [s|
+              codemarkup.ResolveLocation {
+              entity = E,
+              location = {
+                  location = { span = { length = 6, start = 1308 } },
+                  file = "foo"
+              }
+              };
+              codemarkup.EntityUses { target = E }
+          |]
+        )
+      , ("FileEntityXRefLocations"
+        , getq $ angleData @Codemarkup.FileEntityXRefLocations $
+          [s|
+            codemarkup.FileEntityXRefLocations { file = "foo" }
+          |]
+        )
+      ]
+
+getq :: Query a -> UserQuery
+getq (Query q) = q
+
+bench :: Env -> Repo -> [(Description, UserQuery)] -> IO ()
+bench env repo queries =
+  forM_ queries $ \(description,q) -> do
+    xs <- measure (query env repo q) Cfg{cfgIters = 10, cfgStop = 1}
+    let (compile, codegen) = V.unzip xs
+    putStrLn $ " + " <> description
+    putStrLn $ line "compile" compile
+    putStrLn $ line "codegen" codegen
+  where
+    measure :: IO (Double,Double) -> Cfg -> IO (V.Vector (Double,Double))
+    measure action = V.unfoldrM $ \Cfg{..} ->
+      if cfgStop <= 0 && cfgIters <= 0
+        then return Nothing
+        else do
+          performMinorGC
+          (compile, codegen) <- action
+          return $ Just ((compile, codegen), Cfg
+            { cfgIters = max 0 $ cfgIters - 1
+            , cfgStop = if compile >= cfgStop then 0 else cfgStop - compile
+            })
+
+    query env repo q = do
+      UserQueryResults
+        { userQueryResults_stats = Just UserQueryStats
+            { userQueryStats_compile_time_ns = Just compile
+            , userQueryStats_codegen_time_ns = Just codegen }
+        } <- userQuery env repo q
+      return (fromNS compile, fromNS codegen)
+      where
+        fromNS n = fromIntegral n / 1000000000
+
+    line :: String -> V.Vector Double -> String
+    line h xs = replicate 6 ' ' ++ h ++ " " ++ display xs
+      where
+
+    display :: V.Vector Double -> String
+    display xs = unwords
+      [field "min" $ secs $ V.head ts
+      ,field "p50" $ secs $ ts V.! (V.length ts `div` 2 + 1)
+      ,field "avg" $ secs $ mean ts
+      ,field "max" $ secs $ V.last ts
+      ,field "its" $ show $ V.length xs
+      ]
+      where
+        ts = V.modify V.sort xs
+        field s t = s ++ ": " ++ t
diff --git a/glean/bench/FactSetBench.hs b/glean/bench/FactSetBench.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/FactSetBench.hs
@@ -0,0 +1,218 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+This file implements a set of benchmarks for FactSets which can use real-world
+data. It copies all facts from a DB (selected as usual via `--db-root` and
+`--db`) and then runs the benchmarks on FactSets initialised with these facts.
+
+For best results, the DB shouldn't be too small but also shouldn't be huge
+(since all facts will be stored in RAM multiple times).
+
+For comparison, it can also run the same benchmarks on the DB it obtained the
+facts from.
+
+Run each benchmark once:
+  factset-bench --db-root=... --db=... --schema=dir
+
+Run only FactSet (but not DB) benchmarks:
+  factset-bench ... --only-factset
+
+Run specific benchmark 6 times:
+  factset-bench ... --repeat=6 redefine
+
+Run specific benchmark forever (useful for `perf` etc.):
+  factset-bench ... --forever redefine
+
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module FactSetBench (main) where
+
+import Control.Monad
+import qualified Data.Vector.Storable as V
+import Options.Applicative
+import System.Exit (die)
+
+import Glean (Repo, parseRepo)
+import qualified Glean.Database.Config as Database (Config, options)
+import Glean.Database.Env (withDatabases)
+import Glean.Database.Open (readDatabase)
+import Glean.Impl.ConfigProvider
+import qualified Glean.RTS.Foreign.Benchmarking as B
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+
+import Glean.Util.ConfigProvider
+import Util.EventBase (withEventBaseDataplane)
+import Util.Timing
+
+data Config = Config
+  { configOptions :: Database.Config
+  , configRepo :: Repo
+  , configBenchmarks :: [[Benchmark]]
+  , configRunner :: Runner
+  , configOnlyFactSet :: Bool
+  }
+
+data Ctx = Ctx
+  { ctxReport :: String -> IO ()
+  , ctxFail :: IO ()
+  , ctxDB :: Lookup.Lookup
+  , ctxFactBlock :: B.FactBlock
+  , ctxFactSet :: FactSet.FactSet
+  , ctxRunner :: Runner
+  }
+
+type Runner = (String -> IO ()) -> IO Double -> IO ()
+
+runOnce :: Runner
+runOnce report action = do
+  t <- action
+  report $ showTime t
+
+runRepeat :: Int -> Runner
+runRepeat n report action = when (n /= 0) $ do
+  ts <- replicateM n action
+  let min_time = minimum ts
+      max_time = maximum ts
+      avg_time = sum ts / fromIntegral n
+  report $ unwords
+    [ "min:", showTime min_time
+    , "avg:", showTime avg_time
+    , "max:", showTime max_time
+    ]
+
+runForever :: Runner
+runForever _ = forever
+
+time :: (Ctx -> IO Bool) -> Ctx -> IO ()
+time action ctx = ctxRunner ctx (ctxReport ctx) $ do
+  (time, _, ok) <- timeIt $ action ctx
+  when (not ok) $ ctxFail ctx
+  return time
+
+data Benchmark = Benchmark
+  { bName :: String
+  , bEnabled :: Config -> Bool
+  , bRun :: Ctx -> IO ()
+  }
+
+bench :: String -> (Ctx -> IO ()) -> [Benchmark]
+bench name f = [Benchmark name (const True) f]
+
+benchBoth
+  :: String
+  -> (forall l. Lookup.CanLookup l => l -> Ctx -> IO ())
+  -> [Benchmark]
+benchBoth name f =
+  [ Benchmark (name ++ "-db") (not . configOnlyFactSet) $ \ctx -> f (ctxDB ctx) ctx
+  , Benchmark name (const True) $ \ctx -> f (ctxFactSet ctx) ctx ]
+
+lookupB
+  :: Lookup.CanLookup l => (l -> B.FactBlock -> IO Bool) -> l -> Ctx -> IO ()
+lookupB f l = time $ f l <$> ctxFactBlock
+
+benchmarks :: [Benchmark]
+benchmarks = concat
+  [ bench "define" $ \ctx@Ctx{..} -> do
+      id <- Lookup.startingId ctxDB
+      time (const $  do
+        factset <- FactSet.new id
+        B.defineEach factset ctxFactBlock) ctx
+
+  , bench "redefine" $ time $ B.defineEach <$> ctxFactSet <*> ctxFactBlock
+
+  , benchBoth "type" $ lookupB B.lookupEachType
+  , benchBoth "byId" $ lookupB B.lookupEachById
+  , benchBoth "byKey" $ lookupB B.lookupEachByKey
+  , benchBoth "seekToEach" $ lookupB B.seekToEach
+  -- The first seekToEach initialised things in the FactSet so lets' measure
+  -- again
+  , benchBoth "seekToEach2" $ lookupB B.seekToEach
+  , benchBoth "seekAll" $ \l ctx@Ctx{..} -> do
+      count <- FactSet.factCount ctxFactSet
+      pids <- V.fromList . map fst <$> FactSet.predicateStats ctxFactSet
+      time (const $ (count == ) <$> B.seekCount l pids) ctx
+  ]
+
+options :: ParserInfo Config
+options = info (parser <**> helper)
+  (fullDesc <> progDesc "Generate a random batch of facts")
+  where
+    parser = do
+      configOptions <- Database.options
+      configRepo <- option (maybeReader Glean.parseRepo)
+        (  long "db"
+        <> metavar "NAME/INSTANCE"
+        <> help "identifies the database"
+        )
+      configBenchmarks <- many $ argument
+        (maybeReader $ \s -> case filter (\b -> bName b == s) benchmarks of
+          [] -> Nothing
+          xs -> Just xs)
+        ( metavar "BENCHMARK"
+        <> help "selects benchmark"
+        )
+      configRunner <-
+        fmap runRepeat (option auto
+          (  long "repeat"
+          <> metavar "N"
+          <> help "repeat each benchmark N times" ))
+        <|> flag' runForever (long "forever")
+        <|> pure runOnce
+      configOnlyFactSet <- switch
+        ( long "only-factset"
+        <> help "skip DB benchmarks"
+        )
+      return Config{..}
+
+main :: IO ()
+main =
+  withConfigOptions options $ \(config@Config{..}, cfg) ->
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider cfg $ \(cfgAPI :: ConfigAPI) ->
+  withDatabases evb configOptions cfgAPI $ \env ->
+  readDatabase env configRepo $ \_ db -> do
+    block <- B.createFactBlock db
+    startingId <- Lookup.startingId db
+    factset <- FactSet.new startingId
+    ok <- B.defineEach factset block
+    when (not ok) $ die "FactSet creation failed"
+
+    block_count <- B.factCount block
+    block_memory <- B.factMemory block
+    putStrLn $ unwords
+      [ "FactBlock facts:", show block_count
+      , "factmem:", showAllocs $ fromIntegral block_memory
+      ]
+    count <- FactSet.factCount factset
+    mem <- FactSet.allocatedMemory factset
+    factmem <- FactSet.factMemory factset
+    putStrLn $ unwords
+      [ "FactSet facts:", show count
+      , "mem:", showAllocs $ fromIntegral mem
+      , "factmem:", showAllocs $ fromIntegral factmem
+      ]
+
+    let bs = case configBenchmarks of
+          [] -> benchmarks
+          _ -> concat configBenchmarks
+
+        width = maximum $ map (length . bName) bs
+
+    forM_ bs $ \Benchmark{..} -> when (bEnabled config) $ bRun Ctx
+      { ctxReport = \s ->
+          putStrLn $ bName ++ replicate (width - length bName + 1) ' ' ++ s
+      , ctxFail = die $ bName ++ " failed"
+      , ctxDB = db
+      , ctxFactBlock = block
+      , ctxFactSet = factset
+      , ctxRunner = configRunner
+      }
diff --git a/glean/bench/MakeFactBench.hs b/glean/bench/MakeFactBench.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/MakeFactBench.hs
@@ -0,0 +1,38 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module MakeFactBench (main) where
+
+import Criterion.Types
+import qualified Data.Text as Text
+
+import Glean
+import Glean.Database.Test (withEmptyTestDB)
+import Glean.Backend.Types as Backend (loadPredicates)
+import qualified Glean.Schema.Cxx1 as Cxx
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.Benchmark
+import Glean.Typed
+
+main :: IO ()
+main = benchmarkMain $ \run -> do
+  withEmptyTestDB [] $ \env repo -> do
+    predicates <- Backend.loadPredicates env repo
+      [ Cxx.allPredicates
+      ]
+    let
+      cxxName =
+        buildBatch predicates Nothing $
+          mapM_ (makeFact @Cxx.Name)
+            [ "x" <> Text.pack (show n) | n <- [1::Int .. 1000] ]
+
+    run
+      [ bgroup "makefact"
+        [ bench "cxx.Name" $ whnfIO cxxName ]
+      ]
diff --git a/glean/bench/QueryBench.hs b/glean/bench/QueryBench.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/QueryBench.hs
@@ -0,0 +1,117 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module QueryBench (main) where
+
+import Control.Concurrent.Async
+import Control.Monad (void)
+import Criterion.Types
+import Data.Default
+
+import Util.String.Quasi
+
+import Glean
+import Glean.Angle as Angle
+import qualified Glean.Schema.CodeCxx.Types as Code.Cxx
+import qualified Glean.Schema.Codemarkup.Types as Codemarkup
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import qualified Glean.Schema.Sys.Types as Sys
+import Glean.Util.Benchmark
+
+import BenchDB
+
+main :: IO ()
+main = benchmarkMain $ \run -> withBenchDB 10000 $ \env repo -> do
+  let
+    nestedAngle :: Query Cxx.FunctionName
+    nestedAngle = angle "cxx1.FunctionName { name = \"x1\" }"
+
+    pageAngle :: Query Cxx.Name
+    pageAngle = limit 1 $ angle "cxx1.Name \"y\".."
+
+    pageNestedAngle :: Query Cxx.FunctionName
+    pageNestedAngle = limit 1 $ angle "cxx1.FunctionName { name = \"y\".. }"
+
+    simpleAngle :: Query Sys.Blob
+    simpleAngle = angle "sys.Blob \"x1\""
+
+    complexQueryAngle :: Query Glean.Test.Predicate
+    complexQueryAngle = Angle.query $ predicate @Glean.Test.Predicate $ rec $
+      field @"string_" (string "x1") end
+
+    -- test compiling a complex derived predicate, should let us
+    -- spot regressions in the compiler pipeline.
+    compile :: Query Code.Cxx.Entity
+    compile = angleData @Code.Cxx.Entity $
+      "E where codemarkup.search.SearchByScope { name = \"malloc\", scope = [], searchcase = Sensitive, kind = { just = Function }, entity = E }"
+
+    compile2 :: Query Codemarkup.EntityUses
+    compile2 = angleData @Codemarkup.EntityUses $
+      [s|
+        codemarkup.ResolveLocation {
+          entity = E,
+          location = {
+            location = { span = { length = 6, start = 1308 } },
+            file = "foo"
+          }
+        };
+        codemarkup.EntityUses { target = E }
+      |]
+
+    compile3 :: Query Codemarkup.FileEntityXRefLocations
+    compile3 = angleData @Codemarkup.FileEntityXRefLocations $
+      [s|
+        codemarkup.FileEntityXRefLocations { file = "foo" }
+      |]
+
+    arrayPrefix :: Query Nat
+    arrayPrefix = angleData @Nat
+      [s| N where
+         glean.test.Predicate { array_of_nat = [N, ..]}
+       |]
+
+  let stacked = Repo "test" "stacked"
+  let
+    dependencies =
+      Dependencies_stacked $ Stacked name hash Nothing
+      where (Repo name hash) = repo
+  void $ kickOffDatabase env def
+    { kickOff_repo = stacked
+    , kickOff_dependencies = Just dependencies
+    }
+  run
+      [ bench "complex-parallel" $ whnfIO
+        $ mapConcurrently (\io -> io >>= \x -> x `seq` return x)
+        $ replicate 1000
+        $ runQuery env repo complexQueryAngle
+      , bench "simple" $ whnfIO $
+          runQuery env repo simpleAngle
+      , bench "nested" $ whnfIO $
+          runQuery env repo nestedAngle
+      , bench "page" $ whnfIO $
+          runQuery_ env repo pageAngle
+      , bench "pagenested" $ whnfIO $
+          runQuery_ env repo pageNestedAngle
+      , bench "compile" $ whnfIO $
+          runQuery_ env repo compile
+      , bench "compile2" $ whnfIO $
+          runQuery_ env repo compile2
+      , bench "compile3" $ whnfIO $
+          runQuery_ env repo compile3
+      , bench "array_prefix" $ whnfIO $
+          runQuery_ env repo arrayPrefix
+      , bgroup "stacked"
+        [ bench "page" $ whnfIO $
+            runQuery_ env repo pageAngle
+        , bench "pagenested" $ whnfIO $
+            runQuery_ env repo pageNestedAngle
+        ]
+      ]
diff --git a/glean/bench/RenameBench.hs b/glean/bench/RenameBench.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/RenameBench.hs
@@ -0,0 +1,42 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module RenameBench (main) where
+
+import Criterion.Types
+import Data.Default
+
+import Glean.Backend.Local (loadDbSchema)
+import Glean.Database.Test
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Lookup (withCanLookup)
+import Glean.RTS.Types (lowestFid)
+import Glean.Database.Schema (DbSchema(..))
+import Glean.Util.Benchmark
+
+import TestBatch
+
+main :: IO ()
+main = benchmarkMain $ \run ->
+  withEmptyTestDB [] $ \env repo -> do
+  schema <- loadDbSchema env repo
+  batch <- testBatch 500000 env repo
+  empty_facts <- FactSet.new lowestFid
+  withCanLookup empty_facts $ \empty_lookup -> do
+
+  let rename = FactSet.renameFacts
+        (schemaInventory schema)
+        empty_lookup
+        lowestFid
+        batch
+        def
+
+  _ <- rename
+
+  run
+    [ bench "renameFacts" $ whnfIO rename ]
diff --git a/glean/bench/lib/Glean/Util/Benchmark.hs b/glean/bench/lib/Glean/Util/Benchmark.hs
new file mode 100644
--- /dev/null
+++ b/glean/bench/lib/Glean/Util/Benchmark.hs
@@ -0,0 +1,23 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Benchmark
+  ( BenchmarkRunner
+  , benchmarkMain
+  ) where
+
+import Criterion.Main
+import Criterion.Main.Options
+
+import Glean.Init
+
+type BenchmarkRunner = [Benchmark] -> IO ()
+
+benchmarkMain :: (BenchmarkRunner -> IO ()) -> IO ()
+benchmarkMain exec = withOptions (describe defaultConfig) $
+  exec . runMode
diff --git a/glean/bytecode/Glean/Bytecode/Decode.hs b/glean/bytecode/Glean/Bytecode/Decode.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/Glean/Bytecode/Decode.hs
@@ -0,0 +1,64 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Bytecode.Decode
+  ( Decode
+  , Decodable(..)
+  , runDecode
+  , decodeAll
+  )
+where
+
+import Control.Monad
+import Control.Monad.State.Strict (State, runState, state)
+import Control.Monad.Trans.Maybe (MaybeT(..))
+import Data.Word (Word64)
+
+import Glean.Bytecode.Types
+
+-- | A decoder which can be applied to a stream of words via 'runDecode'.
+type Decode = MaybeT (State [Word64])
+
+-- | Execute a 'Decode' and return the result and the remaining words.
+runDecode :: Decode a -> [Word64] -> Maybe (a, [Word64])
+runDecode (MaybeT f) xs = case runState f xs of
+  (Just x, ys) -> Just (x, ys)
+  _ -> Nothing
+
+-- | Things that can be decoded.
+class Decodable arg where
+  decode :: Decode arg
+
+instance Decodable Word64 where
+  decode = MaybeT $ state $ \xs -> case xs of
+    y : ys -> (Just y, ys)
+    _ -> (Nothing, xs)
+
+instance Decodable Literal where
+  decode = Literal <$> decode
+
+instance Decodable Label where
+  decode = Label . fromIntegral <$> (decode :: Decode Word64)
+
+instance Decodable [Label] where
+  decode = do
+    n <- decode
+    replicateM (fromIntegral (n :: Word64)) decode
+
+instance Decodable (Register t) where
+  decode = Register <$> decode
+
+-- | Decode as many elements as possible and return the decoded elements and
+-- the rest of the words, starting with the first that can't be decoded.
+decodeAll :: Decodable a => [Word64] -> ([a], [Word64])
+decodeAll = go []
+  where
+    go xs [] = (reverse xs, [])
+    go xs vs = case runDecode decode vs of
+      Just (x, ws) -> go (x:xs) ws
+      Nothing -> (reverse xs, vs)
diff --git a/glean/bytecode/Glean/Bytecode/SysCalls.hs b/glean/bytecode/Glean/Bytecode/SysCalls.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/Glean/Bytecode/SysCalls.hs
@@ -0,0 +1,32 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Bytecode.SysCalls
+  ( userQuerySysCalls
+  , typecheckSysCalls
+  ) where
+
+-- This list has to sync up with the list in CodeGen.hs or
+-- the wrong name will be printed
+userQuerySysCalls :: [String]
+userQuerySysCalls =
+  ["seek","seekWithinSection","currentSeek", "endSeek"
+  ,"next", "lookupKeyValue", "result", "resultWithPid"
+  ,"newDerivedFact", "firstFreeId"
+  ,"newSet", "insertOutputSet", "setToArray", "freeSet"
+  ,"newWordSet", "insertWordSet", "wordSetToArray", "byteSetToArray"
+  ,"freeWordSet"]
+
+-- This list has to sync up with the list in Glean.RTS.Typecheck or
+-- the wrong name will be printed
+typecheckSysCalls :: [String]
+typecheckSysCalls =
+  ["rename", "newSet", "insertOutputSet", "setToArray", "freeSet"
+  ,"newWordSet_", "insertBytesWordSet_", "wordSetToArray_"
+  ,"byteSetToByteArray_", "freeWordSet_"
+  ]
diff --git a/glean/bytecode/Glean/Bytecode/Types.hs b/glean/bytecode/Glean/Bytecode/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/Glean/Bytecode/Types.hs
@@ -0,0 +1,55 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Bytecode.Types
+  ( Ty(..)
+  , Ordered
+  , Addable
+  , Register(..)
+  , Label(..)
+  , Literal(..)
+  , castRegister
+  ) where
+
+import Data.Coerce (coerce)
+import Data.Word (Word64)
+
+-- | Instruction argument types
+data Ty
+  = Word -- ^ 64 bit word
+  | WordPtr -- ^ pointer to 64 bit word
+  | Lit -- ^ index into the (string) literal table
+  | Offset -- ^ jump offset (relative to start of next instruction)
+  | DataPtr -- ^ a void pointer
+  | BinaryOutputPtr -- ^ pointer to binary::Output (temporary, will be removed)
+  | Fun [Ty] -- ^ pointer to syscall (temporary, will be removed)
+  deriving(Eq, Show)
+
+-- | Types which can be compared
+class Ordered (t :: Ty)
+instance Ordered 'Word
+instance Ordered 'DataPtr
+
+-- | Types which can be added
+class Addable (t :: Ty) (u :: Ty)
+instance Addable 'Word 'Word
+instance Addable 'DataPtr 'Word
+
+-- | Typed registers
+newtype Register (ty :: Ty) = Register { fromRegister :: Word64 }
+  deriving(Eq,Ord,Enum,Show)
+
+castRegister :: Register a -> Register b
+castRegister = coerce
+
+-- | Labels
+newtype Label = Label { fromLabel :: Int }
+  deriving(Eq,Ord,Enum,Show)
+
+newtype Literal = Literal { fromLiteral :: Word64 }
+  deriving(Eq,Ord,Show)
diff --git a/glean/bytecode/def/Glean/Bytecode/Generate/Instruction.hs b/glean/bytecode/def/Glean/Bytecode/Generate/Instruction.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/def/Glean/Bytecode/Generate/Instruction.hs
@@ -0,0 +1,409 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Bytecode.Generate.Instruction
+  ( Insn(..)
+  , Effect(..)
+  , Arg(..)
+  , ArgTy(..)
+  , ImmTy(..)
+  , Usage(..)
+  , instructions
+  , version
+  , lowestSupportedVersion
+  ) where
+
+import Data.Text (Text)
+
+import Glean.Bytecode.Types
+
+-- This is an instruction set for a really simple register machine. The
+-- instructions themselves haven't been designed in any sense, we just added
+-- whatever seemed necessary to implement typechecking via bytecode. The
+-- instruction stream is a sequence of 64 bit words, with each instruction
+-- having one word for the opcode and one word per argument. We will revisit
+-- both the instruction set and the representation once this is actually used.
+
+-- | Definition of a bytecode instruction.
+data Insn = Insn
+  { insnName :: Text
+  , insnEffects :: [Effect]
+  , insnContext :: [Text]
+  , insnArgs :: [Arg]
+  }
+
+-- | Effects of an instruction
+data Effect
+  = EndBlock  -- ^ end the current block (typically for jumps)
+  | Return    -- ^ return from the evaluator
+  deriving(Eq, Show)
+
+-- | Instruction argument.
+data Arg = Arg
+  { argName :: Text
+  , argTy :: ArgTy
+  }
+
+-- | Argument type
+data ArgTy
+  = Imm ImmTy -- ^ immediate value in instruction stream
+  | Reg (Maybe Text) Ty Usage -- ^ register argument
+  | Offsets -- ^ array of jump offsets (length + array in the insn stream)
+  | Regs [Ty] -- ^ list of registers (array without length in the insn stream)
+  deriving(Eq)
+
+-- | Type of an immediate value
+data ImmTy
+  = ImmWord
+  | ImmOffset
+  | ImmLit
+  deriving(Eq,Ord,Show)
+
+-- | Register argument of a particular type
+reg :: Ty -> Usage -> ArgTy
+reg = Reg Nothing
+
+-- | Polymorphic register argument - `Text` is the type variable and `Ty` the
+-- type actually stored in the instruction (since we don't really need
+-- existentials there)
+polyReg :: Text -> Ty -> Usage -> ArgTy
+polyReg = Reg . Just
+
+-- | How an register is used
+data Usage
+  = Load -- ^ read-only
+  | Store -- ^ write-only
+  | Update -- ^ read and write
+  deriving(Eq)
+
+-- | Current bytecode version
+--
+-- BUMP THIS WHENEVER YOU CHANGE THE BYTECODE EVEN IF YOU JUST ADD INSTRUCTIONS
+version :: Int
+version = 15
+
+-- | Lowest bytecode version supported by the current engine.
+--
+-- SET THIS TO THE SAME VALUE AS 'version' UNLESS YOU ONLY ADD NEW INSTRUCTIONS
+-- TO THE END OF THE LIST (in which case the new engine can still execute
+-- old bytecode)
+lowestSupportedVersion :: Int
+lowestSupportedVersion = 15
+
+-- | Definitions of all bytecode instructions
+instructions :: [Insn]
+instructions =
+  [
+    -- Decode a Nat from memory into a register.
+    Insn "InputNat" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg Word Store ]
+
+    -- Decode a Byte from memory into a register
+  , Insn "InputByte" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg Word Store ]
+
+    -- Advance begin by size bytes, and bounds-check against end
+  , Insn "InputBytes" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load
+      , Arg "size" $ reg Word Load ]
+
+    -- Validate and skip over an encoded UTF8 string
+  , Insn "InputSkipUntrustedString" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load ]
+
+    -- Check that the input starts with the given literal, and then skip past it
+  , Insn "InputShiftLit" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load
+      , Arg "lit" $ Imm ImmLit
+      , Arg "match" $ reg Word Store ]
+
+    -- Check that the input starts with the given byte sequence, and
+    -- then skip past it
+  , Insn "InputShiftBytes" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load
+      , Arg "ptr" $ reg DataPtr Load
+      , Arg "ptrend" $ reg DataPtr Load
+      , Arg "match" $ reg Word Store ]
+
+    -- Decode a Nat from memory
+  , Insn "InputSkipNat" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load ]
+
+    -- Skip over an encoded UTF8 string in a binary::Input. The string must be
+    -- valid (this is not checked).
+  , Insn "InputSkipTrustedString" [] []
+      [ Arg "begin" $ reg DataPtr Update
+      , Arg "end" $ reg DataPtr Load ]
+
+    -- Reset a binary::Output
+  , Insn "ResetOutput" [] []
+      [ Arg "output" $ reg BinaryOutputPtr Load ]
+
+    -- Encode a Nat in a register and store it in a binary::Output.
+  , Insn "OutputNat" [] []
+      [ Arg "src" $ reg Word Load
+      , Arg "output" $ reg BinaryOutputPtr Load ]
+
+    -- Encode an immediate Nat and store it in a binary::Output.
+  , Insn "OutputNatImm" [] []
+      [ Arg "src" $ Imm ImmWord
+      , Arg "output" $ reg BinaryOutputPtr Load ]
+
+  , Insn "OutputByte" [] []
+    [ Arg "src" $ reg Word Load
+    , Arg "output" $ reg BinaryOutputPtr Load ]
+
+    -- Encode a byte in a binary::Output
+  , Insn "OutputByteImm" [] []
+      [ Arg "src" $ Imm ImmWord
+      , Arg "output" $ reg BinaryOutputPtr Load ]
+
+    -- Write a sequence of bytes to a binary::Output.
+  , Insn "OutputBytes" [] []
+      [ Arg "ptr" $ reg DataPtr Load
+      , Arg "end" $ reg DataPtr Load
+      , Arg "output" $ reg BinaryOutputPtr Load ]
+
+    -- String toLower
+  , Insn "OutputStringToLower" [] []
+      [ Arg "begin" $ reg DataPtr Load
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg BinaryOutputPtr Load ]
+
+    -- converts [RelByteSpan] to [ByteSpan]
+  , Insn "OutputRelToAbsByteSpans" [] []
+      [ Arg "begin" $ reg DataPtr Load
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg BinaryOutputPtr Load ]
+
+    -- converts PackedByteSpans to [ByteSpan]
+  , Insn "OutputUnpackByteSpans" [] []
+      [ Arg "begin" $ reg DataPtr Load
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg BinaryOutputPtr Load ]
+
+  , Insn "OutputStringReverse" [] []
+      [ Arg "begin" $ reg DataPtr Load
+      , Arg "end" $ reg DataPtr Load
+      , Arg "dst" $ reg BinaryOutputPtr Load ]
+
+    -- Get the contents of a binary::Output as a pointer and
+    -- length. Note that these are only valid until the next operation
+    -- on the binary::Output
+  , Insn "GetOutput" [] []
+      [ Arg "output" $ reg BinaryOutputPtr Load
+      , Arg "ptr" $ reg DataPtr Store
+      , Arg "end" $ reg DataPtr Store ]
+
+    -- Get the number of bytes in the output
+  , Insn "GetOutputSize" [] []
+      [ Arg "output" $ reg BinaryOutputPtr Load
+      , Arg "dst" $ reg Word Store ]
+
+    -- Write a constant into a register.
+  , Insn "LoadConst" [] []
+      [ Arg "imm" $ Imm ImmWord
+      , Arg "dst" $ reg Word Store ]
+
+    -- Load the address and size of a literal
+  , Insn "LoadLiteral" [] []
+      [ Arg "lit" $ Imm ImmLit
+      , Arg "ptr" $ reg DataPtr Store
+      , Arg "end" $ reg DataPtr Store ]
+
+    -- Copy a register into another one.
+  , Insn "Move" [] []
+      [ Arg "src" $ polyReg "a" Word Load
+      , Arg "dst" $ polyReg "a" Word Store ]
+
+    -- Subtract a constant from a register.
+  , Insn "SubConst" [] []
+      [ Arg "imm" $ Imm ImmWord
+      , Arg "dst" $ reg Word Update ]
+
+    -- Subtract a register from a register.
+  , Insn "Sub" [] ["Addable a b"]
+      [ Arg "src" $ polyReg "b" Word Load
+      , Arg "dst" $ polyReg "a" Word Update ]
+
+    -- Add a constant to a register.
+  , Insn "AddConst" [] ["Addable a 'Word"]
+      [ Arg "imm" $ Imm ImmWord
+      , Arg "dst" $ polyReg "a" Word Update ]
+
+    -- Add a register to another register
+  , Insn "Add" [] ["Addable a b"]
+      [ Arg "src" $ polyReg "b" Word Load
+      , Arg "dst" $ polyReg "a" Word Update ]
+
+    -- Subtract pointers
+  , Insn "PtrDiff" [] []
+      [ Arg "src1" $ reg DataPtr Load
+      , Arg "src2" $ reg DataPtr Load
+      , Arg "dst" $ reg Word Store ]
+
+  , Insn "LoadLabel" [] []
+      [ Arg "lbl" $ Imm ImmOffset
+      , Arg "dst" $ reg Offset Store ]
+
+    -- Unconditional jump.
+  , Insn "Jump" [EndBlock] []
+      [ Arg "tgt" $ Imm ImmOffset ]
+
+  , Insn "JumpReg" [EndBlock] []
+      [ Arg "tgt" $ reg Offset Load ]
+
+    -- Jump if a register is 0.
+  , Insn "JumpIf0" [] []
+      [ Arg "reg" $ reg Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if a register is not 0.
+  , Insn "JumpIfNot0" [] []
+      [ Arg "reg" $ reg Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if two registers are equal.
+  , Insn "JumpIfEq" [] []
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if two registers are not equal.
+  , Insn "JumpIfNe" [] []
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if a > b.
+  , Insn "JumpIfGt" [] ["Ordered a"]
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if a >= b.
+  , Insn "JumpIfGe" [] ["Ordered a"]
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if a < b.
+  , Insn "JumpIfLt" [] ["Ordered a"]
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Jump if a <= b.
+  , Insn "JumpIfLe" [] ["Ordered a"]
+      [ Arg "reg1" $ polyReg "a" Word Load
+      , Arg "reg2" $ polyReg "a" Word Load
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Decrement the value in a register and jump if it isn't 0.
+  , Insn "DecrAndJumpIfNot0" [] []
+      [ Arg "reg" $ reg Word Update
+      , Arg "tgt" $ Imm ImmOffset ]
+
+    -- Decrement the value in a register and jump if it is 0.
+  , Insn "DecrAndJumpIf0" [] []
+      [ Arg "reg" $ reg Word Update
+      , Arg "tgt" $ Imm ImmOffset ]
+
+  , Insn "CallFun_0_1" [] []
+      [ Arg "fun" $ reg (Fun [WordPtr]) Load
+      , Arg "args" $ Regs [Word] ]
+
+  , Insn "CallFun_0_2" [] []
+      [ Arg "fun" $ reg (Fun [WordPtr, WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word] ]
+
+  , Insn "CallFun_1_1" [] []
+      [ Arg "fun" $ reg (Fun [Word, WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word] ]
+
+  , Insn "CallFun_1_0" [] []
+      [ Arg "fun" $ reg (Fun [Word]) Load
+      , Arg "args" $ Regs [Word] ]
+
+    -- Call an std::function which takes two 64-bit arguments and returns
+    -- one 64-bit result.
+  , Insn "CallFun_2_1" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word,Word] ]
+
+  , Insn "CallFun_2_0" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word]) Load
+      , Arg "args" $ Regs [Word,Word] ]
+
+  , Insn "CallFun_3_0" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,Word]) Load
+      , Arg "args" $ Regs [Word,Word,Word] ]
+
+  , Insn "CallFun_4_0" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,Word,Word]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word] ]
+
+  , Insn "CallFun_3_1" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,Word,WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word] ]
+
+  , Insn "CallFun_5_0" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,Word,Word,Word]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word,Word] ]
+
+  , Insn "CallFun_5_1" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,Word,Word,Word,WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word,Word,Word] ]
+
+  , Insn "CallFun_2_2" [] []
+      [ Arg "fun" $ reg (Fun [Word,Word,WordPtr,WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word] ]
+
+  , Insn "CallFun_2_5" [] []
+      [ Arg "fun"
+          $ reg (Fun [Word,Word,WordPtr,WordPtr,WordPtr,WordPtr,WordPtr]) Load
+      , Arg "args" $ Regs [Word,Word,Word,Word,Word,Word,Word] ]
+
+    -- Indexed jump - the register contains an index into the array of
+    -- offsets. Does nothing if the index is out of range.
+  , Insn "Select" [] []
+      [ Arg "sel" $ reg Word Load
+      , Arg "tgts" Offsets ]
+
+    -- Raise an exception.
+  , Insn "Raise" [EndBlock] []
+      [ Arg "msg" $ Imm ImmLit ]
+
+    -- For debugging
+  , Insn "Trace" [] []
+      [ Arg "msg" $ Imm ImmLit ]
+
+  , Insn "TraceReg" [] []
+      [ Arg "msg" $ Imm ImmLit
+      , Arg "reg" $ reg Word Load ]
+
+    -- Adjust PC to point to 'cont' and suspend execution. The first argument
+    -- is a temporary, unused left-over for backwards compatibility.
+  , Insn "Suspend" [EndBlock, Return] []
+      [ Arg "unused" $ reg Word Load
+      , Arg "cont" $ Imm ImmOffset
+      ]
+
+    -- Return from a subroutine.
+  , Insn "Ret" [EndBlock, Return] [] []
+
+  ]
diff --git a/glean/bytecode/evaluate.h b/glean/bytecode/evaluate.h
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/evaluate.h
@@ -0,0 +1,1587 @@
+// @generated
+
+  FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE evalSwitch() {
+    while (true) {
+      switch (static_cast<Op>(*pc++)) {
+        case Op::InputNat:
+          eval_InputNat();
+          break;
+  
+        case Op::InputByte:
+          eval_InputByte();
+          break;
+  
+        case Op::InputBytes:
+          eval_InputBytes();
+          break;
+  
+        case Op::InputSkipUntrustedString:
+          eval_InputSkipUntrustedString();
+          break;
+  
+        case Op::InputShiftLit:
+          eval_InputShiftLit();
+          break;
+  
+        case Op::InputShiftBytes:
+          eval_InputShiftBytes();
+          break;
+  
+        case Op::InputSkipNat:
+          eval_InputSkipNat();
+          break;
+  
+        case Op::InputSkipTrustedString:
+          eval_InputSkipTrustedString();
+          break;
+  
+        case Op::ResetOutput:
+          eval_ResetOutput();
+          break;
+  
+        case Op::OutputNat:
+          eval_OutputNat();
+          break;
+  
+        case Op::OutputNatImm:
+          eval_OutputNatImm();
+          break;
+  
+        case Op::OutputByte:
+          eval_OutputByte();
+          break;
+  
+        case Op::OutputByteImm:
+          eval_OutputByteImm();
+          break;
+  
+        case Op::OutputBytes:
+          eval_OutputBytes();
+          break;
+  
+        case Op::OutputStringToLower:
+          eval_OutputStringToLower();
+          break;
+  
+        case Op::OutputRelToAbsByteSpans:
+          eval_OutputRelToAbsByteSpans();
+          break;
+  
+        case Op::OutputUnpackByteSpans:
+          eval_OutputUnpackByteSpans();
+          break;
+  
+        case Op::OutputStringReverse:
+          eval_OutputStringReverse();
+          break;
+  
+        case Op::GetOutput:
+          eval_GetOutput();
+          break;
+  
+        case Op::GetOutputSize:
+          eval_GetOutputSize();
+          break;
+  
+        case Op::LoadConst:
+          eval_LoadConst();
+          break;
+  
+        case Op::LoadLiteral:
+          eval_LoadLiteral();
+          break;
+  
+        case Op::Move:
+          eval_Move();
+          break;
+  
+        case Op::SubConst:
+          eval_SubConst();
+          break;
+  
+        case Op::Sub:
+          eval_Sub();
+          break;
+  
+        case Op::AddConst:
+          eval_AddConst();
+          break;
+  
+        case Op::Add:
+          eval_Add();
+          break;
+  
+        case Op::PtrDiff:
+          eval_PtrDiff();
+          break;
+  
+        case Op::LoadLabel:
+          eval_LoadLabel();
+          break;
+  
+        case Op::Jump:
+          eval_Jump();
+          break;
+  
+        case Op::JumpReg:
+          eval_JumpReg();
+          break;
+  
+        case Op::JumpIf0:
+          eval_JumpIf0();
+          break;
+  
+        case Op::JumpIfNot0:
+          eval_JumpIfNot0();
+          break;
+  
+        case Op::JumpIfEq:
+          eval_JumpIfEq();
+          break;
+  
+        case Op::JumpIfNe:
+          eval_JumpIfNe();
+          break;
+  
+        case Op::JumpIfGt:
+          eval_JumpIfGt();
+          break;
+  
+        case Op::JumpIfGe:
+          eval_JumpIfGe();
+          break;
+  
+        case Op::JumpIfLt:
+          eval_JumpIfLt();
+          break;
+  
+        case Op::JumpIfLe:
+          eval_JumpIfLe();
+          break;
+  
+        case Op::DecrAndJumpIfNot0:
+          eval_DecrAndJumpIfNot0();
+          break;
+  
+        case Op::DecrAndJumpIf0:
+          eval_DecrAndJumpIf0();
+          break;
+  
+        case Op::CallFun_0_1:
+          eval_CallFun_0_1();
+          break;
+  
+        case Op::CallFun_0_2:
+          eval_CallFun_0_2();
+          break;
+  
+        case Op::CallFun_1_1:
+          eval_CallFun_1_1();
+          break;
+  
+        case Op::CallFun_1_0:
+          eval_CallFun_1_0();
+          break;
+  
+        case Op::CallFun_2_1:
+          eval_CallFun_2_1();
+          break;
+  
+        case Op::CallFun_2_0:
+          eval_CallFun_2_0();
+          break;
+  
+        case Op::CallFun_3_0:
+          eval_CallFun_3_0();
+          break;
+  
+        case Op::CallFun_4_0:
+          eval_CallFun_4_0();
+          break;
+  
+        case Op::CallFun_3_1:
+          eval_CallFun_3_1();
+          break;
+  
+        case Op::CallFun_5_0:
+          eval_CallFun_5_0();
+          break;
+  
+        case Op::CallFun_5_1:
+          eval_CallFun_5_1();
+          break;
+  
+        case Op::CallFun_2_2:
+          eval_CallFun_2_2();
+          break;
+  
+        case Op::CallFun_2_5:
+          eval_CallFun_2_5();
+          break;
+  
+        case Op::Select:
+          eval_Select();
+          break;
+  
+        case Op::Raise:
+          eval_Raise();
+          break;
+  
+        case Op::Trace:
+          eval_Trace();
+          break;
+  
+        case Op::TraceReg:
+          eval_TraceReg();
+          break;
+  
+        case Op::Suspend:
+          return eval_Suspend();
+  
+        case Op::Ret:
+          return eval_Ret();
+  
+        case Op::Unused60:
+        case Op::Unused61:
+        case Op::Unused62:
+        case Op::Unused63:
+        case Op::Unused64:
+        case Op::Unused65:
+        case Op::Unused66:
+        case Op::Unused67:
+        case Op::Unused68:
+        case Op::Unused69:
+        case Op::Unused70:
+        case Op::Unused71:
+        case Op::Unused72:
+        case Op::Unused73:
+        case Op::Unused74:
+        case Op::Unused75:
+        case Op::Unused76:
+        case Op::Unused77:
+        case Op::Unused78:
+        case Op::Unused79:
+        case Op::Unused80:
+        case Op::Unused81:
+        case Op::Unused82:
+        case Op::Unused83:
+        case Op::Unused84:
+        case Op::Unused85:
+        case Op::Unused86:
+        case Op::Unused87:
+        case Op::Unused88:
+        case Op::Unused89:
+        case Op::Unused90:
+        case Op::Unused91:
+        case Op::Unused92:
+        case Op::Unused93:
+        case Op::Unused94:
+        case Op::Unused95:
+        case Op::Unused96:
+        case Op::Unused97:
+        case Op::Unused98:
+        case Op::Unused99:
+        case Op::Unused100:
+        case Op::Unused101:
+        case Op::Unused102:
+        case Op::Unused103:
+        case Op::Unused104:
+        case Op::Unused105:
+        case Op::Unused106:
+        case Op::Unused107:
+        case Op::Unused108:
+        case Op::Unused109:
+        case Op::Unused110:
+        case Op::Unused111:
+        case Op::Unused112:
+        case Op::Unused113:
+        case Op::Unused114:
+        case Op::Unused115:
+        case Op::Unused116:
+        case Op::Unused117:
+        case Op::Unused118:
+        case Op::Unused119:
+        case Op::Unused120:
+        case Op::Unused121:
+        case Op::Unused122:
+        case Op::Unused123:
+        case Op::Unused124:
+        case Op::Unused125:
+        case Op::Unused126:
+        case Op::Unused127:
+        case Op::Unused128:
+        case Op::Unused129:
+        case Op::Unused130:
+        case Op::Unused131:
+        case Op::Unused132:
+        case Op::Unused133:
+        case Op::Unused134:
+        case Op::Unused135:
+        case Op::Unused136:
+        case Op::Unused137:
+        case Op::Unused138:
+        case Op::Unused139:
+        case Op::Unused140:
+        case Op::Unused141:
+        case Op::Unused142:
+        case Op::Unused143:
+        case Op::Unused144:
+        case Op::Unused145:
+        case Op::Unused146:
+        case Op::Unused147:
+        case Op::Unused148:
+        case Op::Unused149:
+        case Op::Unused150:
+        case Op::Unused151:
+        case Op::Unused152:
+        case Op::Unused153:
+        case Op::Unused154:
+        case Op::Unused155:
+        case Op::Unused156:
+        case Op::Unused157:
+        case Op::Unused158:
+        case Op::Unused159:
+        case Op::Unused160:
+        case Op::Unused161:
+        case Op::Unused162:
+        case Op::Unused163:
+        case Op::Unused164:
+        case Op::Unused165:
+        case Op::Unused166:
+        case Op::Unused167:
+        case Op::Unused168:
+        case Op::Unused169:
+        case Op::Unused170:
+        case Op::Unused171:
+        case Op::Unused172:
+        case Op::Unused173:
+        case Op::Unused174:
+        case Op::Unused175:
+        case Op::Unused176:
+        case Op::Unused177:
+        case Op::Unused178:
+        case Op::Unused179:
+        case Op::Unused180:
+        case Op::Unused181:
+        case Op::Unused182:
+        case Op::Unused183:
+        case Op::Unused184:
+        case Op::Unused185:
+        case Op::Unused186:
+        case Op::Unused187:
+        case Op::Unused188:
+        case Op::Unused189:
+        case Op::Unused190:
+        case Op::Unused191:
+        case Op::Unused192:
+        case Op::Unused193:
+        case Op::Unused194:
+        case Op::Unused195:
+        case Op::Unused196:
+        case Op::Unused197:
+        case Op::Unused198:
+        case Op::Unused199:
+        case Op::Unused200:
+        case Op::Unused201:
+        case Op::Unused202:
+        case Op::Unused203:
+        case Op::Unused204:
+        case Op::Unused205:
+        case Op::Unused206:
+        case Op::Unused207:
+        case Op::Unused208:
+        case Op::Unused209:
+        case Op::Unused210:
+        case Op::Unused211:
+        case Op::Unused212:
+        case Op::Unused213:
+        case Op::Unused214:
+        case Op::Unused215:
+        case Op::Unused216:
+        case Op::Unused217:
+        case Op::Unused218:
+        case Op::Unused219:
+        case Op::Unused220:
+        case Op::Unused221:
+        case Op::Unused222:
+        case Op::Unused223:
+        case Op::Unused224:
+        case Op::Unused225:
+        case Op::Unused226:
+        case Op::Unused227:
+        case Op::Unused228:
+        case Op::Unused229:
+        case Op::Unused230:
+        case Op::Unused231:
+        case Op::Unused232:
+        case Op::Unused233:
+        case Op::Unused234:
+        case Op::Unused235:
+        case Op::Unused236:
+        case Op::Unused237:
+        case Op::Unused238:
+        case Op::Unused239:
+        case Op::Unused240:
+        case Op::Unused241:
+        case Op::Unused242:
+        case Op::Unused243:
+        case Op::Unused244:
+        case Op::Unused245:
+        case Op::Unused246:
+        case Op::Unused247:
+        case Op::Unused248:
+        case Op::Unused249:
+        case Op::Unused250:
+        case Op::Unused251:
+        case Op::Unused252:
+        case Op::Unused253:
+        case Op::Unused254:
+        case Op::Unused255:
+          rts::error("invalid opcode");
+      }
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE evalIndirect() {
+    static const void * const labels[] = {
+      &&label_InputNat,
+      &&label_InputByte,
+      &&label_InputBytes,
+      &&label_InputSkipUntrustedString,
+      &&label_InputShiftLit,
+      &&label_InputShiftBytes,
+      &&label_InputSkipNat,
+      &&label_InputSkipTrustedString,
+      &&label_ResetOutput,
+      &&label_OutputNat,
+      &&label_OutputNatImm,
+      &&label_OutputByte,
+      &&label_OutputByteImm,
+      &&label_OutputBytes,
+      &&label_OutputStringToLower,
+      &&label_OutputRelToAbsByteSpans,
+      &&label_OutputUnpackByteSpans,
+      &&label_OutputStringReverse,
+      &&label_GetOutput,
+      &&label_GetOutputSize,
+      &&label_LoadConst,
+      &&label_LoadLiteral,
+      &&label_Move,
+      &&label_SubConst,
+      &&label_Sub,
+      &&label_AddConst,
+      &&label_Add,
+      &&label_PtrDiff,
+      &&label_LoadLabel,
+      &&label_Jump,
+      &&label_JumpReg,
+      &&label_JumpIf0,
+      &&label_JumpIfNot0,
+      &&label_JumpIfEq,
+      &&label_JumpIfNe,
+      &&label_JumpIfGt,
+      &&label_JumpIfGe,
+      &&label_JumpIfLt,
+      &&label_JumpIfLe,
+      &&label_DecrAndJumpIfNot0,
+      &&label_DecrAndJumpIf0,
+      &&label_CallFun_0_1,
+      &&label_CallFun_0_2,
+      &&label_CallFun_1_1,
+      &&label_CallFun_1_0,
+      &&label_CallFun_2_1,
+      &&label_CallFun_2_0,
+      &&label_CallFun_3_0,
+      &&label_CallFun_4_0,
+      &&label_CallFun_3_1,
+      &&label_CallFun_5_0,
+      &&label_CallFun_5_1,
+      &&label_CallFun_2_2,
+      &&label_CallFun_2_5,
+      &&label_Select,
+      &&label_Raise,
+      &&label_Trace,
+      &&label_TraceReg,
+      &&label_Suspend,
+      &&label_Ret,
+    };
+  
+    goto *labels[*pc++];
+  
+  label_InputNat:
+          eval_InputNat();
+    goto *labels[*pc++];
+  
+  label_InputByte:
+          eval_InputByte();
+    goto *labels[*pc++];
+  
+  label_InputBytes:
+          eval_InputBytes();
+    goto *labels[*pc++];
+  
+  label_InputSkipUntrustedString:
+          eval_InputSkipUntrustedString();
+    goto *labels[*pc++];
+  
+  label_InputShiftLit:
+          eval_InputShiftLit();
+    goto *labels[*pc++];
+  
+  label_InputShiftBytes:
+          eval_InputShiftBytes();
+    goto *labels[*pc++];
+  
+  label_InputSkipNat:
+          eval_InputSkipNat();
+    goto *labels[*pc++];
+  
+  label_InputSkipTrustedString:
+          eval_InputSkipTrustedString();
+    goto *labels[*pc++];
+  
+  label_ResetOutput:
+          eval_ResetOutput();
+    goto *labels[*pc++];
+  
+  label_OutputNat:
+          eval_OutputNat();
+    goto *labels[*pc++];
+  
+  label_OutputNatImm:
+          eval_OutputNatImm();
+    goto *labels[*pc++];
+  
+  label_OutputByte:
+          eval_OutputByte();
+    goto *labels[*pc++];
+  
+  label_OutputByteImm:
+          eval_OutputByteImm();
+    goto *labels[*pc++];
+  
+  label_OutputBytes:
+          eval_OutputBytes();
+    goto *labels[*pc++];
+  
+  label_OutputStringToLower:
+          eval_OutputStringToLower();
+    goto *labels[*pc++];
+  
+  label_OutputRelToAbsByteSpans:
+          eval_OutputRelToAbsByteSpans();
+    goto *labels[*pc++];
+  
+  label_OutputUnpackByteSpans:
+          eval_OutputUnpackByteSpans();
+    goto *labels[*pc++];
+  
+  label_OutputStringReverse:
+          eval_OutputStringReverse();
+    goto *labels[*pc++];
+  
+  label_GetOutput:
+          eval_GetOutput();
+    goto *labels[*pc++];
+  
+  label_GetOutputSize:
+          eval_GetOutputSize();
+    goto *labels[*pc++];
+  
+  label_LoadConst:
+          eval_LoadConst();
+    goto *labels[*pc++];
+  
+  label_LoadLiteral:
+          eval_LoadLiteral();
+    goto *labels[*pc++];
+  
+  label_Move:
+          eval_Move();
+    goto *labels[*pc++];
+  
+  label_SubConst:
+          eval_SubConst();
+    goto *labels[*pc++];
+  
+  label_Sub:
+          eval_Sub();
+    goto *labels[*pc++];
+  
+  label_AddConst:
+          eval_AddConst();
+    goto *labels[*pc++];
+  
+  label_Add:
+          eval_Add();
+    goto *labels[*pc++];
+  
+  label_PtrDiff:
+          eval_PtrDiff();
+    goto *labels[*pc++];
+  
+  label_LoadLabel:
+          eval_LoadLabel();
+    goto *labels[*pc++];
+  
+  label_Jump:
+          eval_Jump();
+    goto *labels[*pc++];
+  
+  label_JumpReg:
+          eval_JumpReg();
+    goto *labels[*pc++];
+  
+  label_JumpIf0:
+          eval_JumpIf0();
+    goto *labels[*pc++];
+  
+  label_JumpIfNot0:
+          eval_JumpIfNot0();
+    goto *labels[*pc++];
+  
+  label_JumpIfEq:
+          eval_JumpIfEq();
+    goto *labels[*pc++];
+  
+  label_JumpIfNe:
+          eval_JumpIfNe();
+    goto *labels[*pc++];
+  
+  label_JumpIfGt:
+          eval_JumpIfGt();
+    goto *labels[*pc++];
+  
+  label_JumpIfGe:
+          eval_JumpIfGe();
+    goto *labels[*pc++];
+  
+  label_JumpIfLt:
+          eval_JumpIfLt();
+    goto *labels[*pc++];
+  
+  label_JumpIfLe:
+          eval_JumpIfLe();
+    goto *labels[*pc++];
+  
+  label_DecrAndJumpIfNot0:
+          eval_DecrAndJumpIfNot0();
+    goto *labels[*pc++];
+  
+  label_DecrAndJumpIf0:
+          eval_DecrAndJumpIf0();
+    goto *labels[*pc++];
+  
+  label_CallFun_0_1:
+          eval_CallFun_0_1();
+    goto *labels[*pc++];
+  
+  label_CallFun_0_2:
+          eval_CallFun_0_2();
+    goto *labels[*pc++];
+  
+  label_CallFun_1_1:
+          eval_CallFun_1_1();
+    goto *labels[*pc++];
+  
+  label_CallFun_1_0:
+          eval_CallFun_1_0();
+    goto *labels[*pc++];
+  
+  label_CallFun_2_1:
+          eval_CallFun_2_1();
+    goto *labels[*pc++];
+  
+  label_CallFun_2_0:
+          eval_CallFun_2_0();
+    goto *labels[*pc++];
+  
+  label_CallFun_3_0:
+          eval_CallFun_3_0();
+    goto *labels[*pc++];
+  
+  label_CallFun_4_0:
+          eval_CallFun_4_0();
+    goto *labels[*pc++];
+  
+  label_CallFun_3_1:
+          eval_CallFun_3_1();
+    goto *labels[*pc++];
+  
+  label_CallFun_5_0:
+          eval_CallFun_5_0();
+    goto *labels[*pc++];
+  
+  label_CallFun_5_1:
+          eval_CallFun_5_1();
+    goto *labels[*pc++];
+  
+  label_CallFun_2_2:
+          eval_CallFun_2_2();
+    goto *labels[*pc++];
+  
+  label_CallFun_2_5:
+          eval_CallFun_2_5();
+    goto *labels[*pc++];
+  
+  label_Select:
+          eval_Select();
+    goto *labels[*pc++];
+  
+  label_Raise:
+          eval_Raise();
+    goto *labels[*pc++];
+  
+  label_Trace:
+          eval_Trace();
+    goto *labels[*pc++];
+  
+  label_TraceReg:
+          eval_TraceReg();
+    goto *labels[*pc++];
+  
+  label_Suspend:
+          return eval_Suspend();
+  
+  label_Ret:
+          return eval_Ret();
+  }
+
+  struct InputNat {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputNat() {
+    InputNat args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "InputNat" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct InputByte {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputByte() {
+    InputByte args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "InputByte" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct InputBytes {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+    uint64_t size;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputBytes() {
+    InputBytes args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.size = Reg<uint64_t>(&frame[*pc++]).get();
+    DVLOG(5) << "InputBytes" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.size;
+    return execute(args);
+  }
+
+  struct InputSkipUntrustedString {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputSkipUntrustedString() {
+    InputSkipUntrustedString args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    DVLOG(5) << "InputSkipUntrustedString" << "  " << "<<ptr>>" << "  " << "<<ptr>>";
+    return execute(args);
+  }
+
+  struct InputShiftLit {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+    const std::string * lit;
+    Reg<uint64_t> match;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputShiftLit() {
+    InputShiftLit args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.lit = &literals[*pc++];
+    args.match = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "InputShiftLit" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.lit << "  " << args.match;
+    return execute(args);
+  }
+
+  struct InputShiftBytes {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+    const unsigned char * ptr;
+    const unsigned char * ptrend;
+    Reg<uint64_t> match;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputShiftBytes() {
+    InputShiftBytes args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.ptr = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.ptrend = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.match = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "InputShiftBytes" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.match;
+    return execute(args);
+  }
+
+  struct InputSkipNat {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputSkipNat() {
+    InputSkipNat args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    DVLOG(5) << "InputSkipNat" << "  " << "<<ptr>>" << "  " << "<<ptr>>";
+    return execute(args);
+  }
+
+  struct InputSkipTrustedString {
+    Reg<const unsigned char *> begin;
+    const unsigned char * end;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_InputSkipTrustedString() {
+    InputSkipTrustedString args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    DVLOG(5) << "InputSkipTrustedString" << "  " << "<<ptr>>" << "  " << "<<ptr>>";
+    return execute(args);
+  }
+
+  struct ResetOutput {
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_ResetOutput() {
+    ResetOutput args;
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "ResetOutput" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputNat {
+    uint64_t src;
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputNat() {
+    OutputNat args;
+    args.src = Reg<uint64_t>(&frame[*pc++]).get();
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputNat" << "  " << args.src << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputNatImm {
+    uint64_t src;
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputNatImm() {
+    OutputNatImm args;
+    args.src = *pc++;
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputNatImm" << "  " << args.src << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputByte {
+    uint64_t src;
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputByte() {
+    OutputByte args;
+    args.src = Reg<uint64_t>(&frame[*pc++]).get();
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputByte" << "  " << args.src << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputByteImm {
+    uint64_t src;
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputByteImm() {
+    OutputByteImm args;
+    args.src = *pc++;
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputByteImm" << "  " << args.src << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputBytes {
+    const unsigned char * ptr;
+    const unsigned char * end;
+    binary::Output * output;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputBytes() {
+    OutputBytes args;
+    args.ptr = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputBytes" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputStringToLower {
+    const unsigned char * begin;
+    const unsigned char * end;
+    binary::Output * dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputStringToLower() {
+    OutputStringToLower args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputStringToLower" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputRelToAbsByteSpans {
+    const unsigned char * begin;
+    const unsigned char * end;
+    binary::Output * dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputRelToAbsByteSpans() {
+    OutputRelToAbsByteSpans args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputRelToAbsByteSpans" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputUnpackByteSpans {
+    const unsigned char * begin;
+    const unsigned char * end;
+    binary::Output * dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputUnpackByteSpans() {
+    OutputUnpackByteSpans args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputUnpackByteSpans" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct OutputStringReverse {
+    const unsigned char * begin;
+    const unsigned char * end;
+    binary::Output * dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_OutputStringReverse() {
+    OutputStringReverse args;
+    args.begin = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.end = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<binary::Output *>(&frame[*pc++]).get();
+    DVLOG(5) << "OutputStringReverse" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << "<<binary::Output>>";
+    return execute(args);
+  }
+
+  struct GetOutput {
+    binary::Output * output;
+    Reg<const unsigned char *> ptr;
+    Reg<const unsigned char *> end;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_GetOutput() {
+    GetOutput args;
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    args.ptr = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]);
+    DVLOG(5) << "GetOutput" << "  " << "<<binary::Output>>" << "  " << "<<ptr>>" << "  " << "<<ptr>>";
+    return execute(args);
+  }
+
+  struct GetOutputSize {
+    binary::Output * output;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_GetOutputSize() {
+    GetOutputSize args;
+    args.output = Reg<binary::Output *>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "GetOutputSize" << "  " << "<<binary::Output>>" << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct LoadConst {
+    uint64_t imm;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_LoadConst() {
+    LoadConst args;
+    args.imm = *pc++;
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "LoadConst" << "  " << args.imm << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct LoadLiteral {
+    const std::string * lit;
+    Reg<const unsigned char *> ptr;
+    Reg<const unsigned char *> end;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_LoadLiteral() {
+    LoadLiteral args;
+    args.lit = &literals[*pc++];
+    args.ptr = Reg<const unsigned char *>(&frame[*pc++]);
+    args.end = Reg<const unsigned char *>(&frame[*pc++]);
+    DVLOG(5) << "LoadLiteral" << "  " << args.lit << "  " << "<<ptr>>" << "  " << "<<ptr>>";
+    return execute(args);
+  }
+
+  struct Move {
+    uint64_t src;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Move() {
+    Move args;
+    args.src = Reg<uint64_t>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "Move" << "  " << args.src << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct SubConst {
+    uint64_t imm;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_SubConst() {
+    SubConst args;
+    args.imm = *pc++;
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "SubConst" << "  " << args.imm << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct Sub {
+    uint64_t src;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Sub() {
+    Sub args;
+    args.src = Reg<uint64_t>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "Sub" << "  " << args.src << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct AddConst {
+    uint64_t imm;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_AddConst() {
+    AddConst args;
+    args.imm = *pc++;
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "AddConst" << "  " << args.imm << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct Add {
+    uint64_t src;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Add() {
+    Add args;
+    args.src = Reg<uint64_t>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "Add" << "  " << args.src << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct PtrDiff {
+    const unsigned char * src1;
+    const unsigned char * src2;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_PtrDiff() {
+    PtrDiff args;
+    args.src1 = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.src2 = Reg<const unsigned char *>(&frame[*pc++]).get();
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "PtrDiff" << "  " << "<<ptr>>" << "  " << "<<ptr>>" << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct LoadLabel {
+    uint64_t lbl;
+    Reg<uint64_t> dst;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_LoadLabel() {
+    LoadLabel args;
+    args.lbl = *pc++;
+    args.dst = Reg<uint64_t>(&frame[*pc++]);
+    DVLOG(5) << "LoadLabel" << "  " << args.lbl << "  " << args.dst;
+    return execute(args);
+  }
+
+  struct Jump {
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Jump() {
+    Jump args;
+    args.tgt = *pc++;
+    DVLOG(5) << "Jump" << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpReg {
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpReg() {
+    JumpReg args;
+    args.tgt = Reg<uint64_t>(&frame[*pc++]).get();
+    DVLOG(5) << "JumpReg" << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIf0 {
+    uint64_t reg;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIf0() {
+    JumpIf0 args;
+    args.reg = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIf0" << "  " << args.reg << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfNot0 {
+    uint64_t reg;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfNot0() {
+    JumpIfNot0 args;
+    args.reg = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfNot0" << "  " << args.reg << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfEq {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfEq() {
+    JumpIfEq args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfEq" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfNe {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfNe() {
+    JumpIfNe args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfNe" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfGt {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfGt() {
+    JumpIfGt args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfGt" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfGe {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfGe() {
+    JumpIfGe args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfGe" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfLt {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfLt() {
+    JumpIfLt args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfLt" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct JumpIfLe {
+    uint64_t reg1;
+    uint64_t reg2;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_JumpIfLe() {
+    JumpIfLe args;
+    args.reg1 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.reg2 = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgt = *pc++;
+    DVLOG(5) << "JumpIfLe" << "  " << args.reg1 << "  " << args.reg2 << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct DecrAndJumpIfNot0 {
+    Reg<uint64_t> reg;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_DecrAndJumpIfNot0() {
+    DecrAndJumpIfNot0 args;
+    args.reg = Reg<uint64_t>(&frame[*pc++]);
+    args.tgt = *pc++;
+    DVLOG(5) << "DecrAndJumpIfNot0" << "  " << args.reg << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct DecrAndJumpIf0 {
+    Reg<uint64_t> reg;
+    uint64_t tgt;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_DecrAndJumpIf0() {
+    DecrAndJumpIf0 args;
+    args.reg = Reg<uint64_t>(&frame[*pc++]);
+    args.tgt = *pc++;
+    DVLOG(5) << "DecrAndJumpIf0" << "  " << args.reg << "  " << args.tgt;
+    return execute(args);
+  }
+
+  struct CallFun_0_1 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 1;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_0_1() {
+    CallFun_0_1 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_0_1" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_0_2 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 2;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_0_2() {
+    CallFun_0_2 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_0_2" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_1_1 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 2;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_1_1() {
+    CallFun_1_1 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_1_1" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_1_0 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 1;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_1_0() {
+    CallFun_1_0 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_1_0" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_2_1 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 3;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_2_1() {
+    CallFun_2_1 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_2_1" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_2_0 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 2;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_2_0() {
+    CallFun_2_0 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_2_0" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_3_0 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 3;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_3_0() {
+    CallFun_3_0 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_3_0" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_4_0 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 4;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_4_0() {
+    CallFun_4_0 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_4_0" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_3_1 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 4;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_3_1() {
+    CallFun_3_1 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_3_1" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_5_0 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 5;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_5_0() {
+    CallFun_5_0 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_5_0" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_5_1 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 6;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_5_1() {
+    CallFun_5_1 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_5_1" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_2_2 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 4;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_2_2() {
+    CallFun_2_2 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_2_2" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct CallFun_2_5 {
+    SysFun fun;
+    static constexpr uint64_t args_arity = 7;
+    const uint64_t *args;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_CallFun_2_5() {
+    CallFun_2_5 args;
+    args.fun = Reg<SysFun>(&frame[*pc++]).get();
+    args.args = pc;
+    pc += args.args_arity;
+    DVLOG(5) << "CallFun_2_5" << "  " << "<<funptr>>" << "  " << "<<reg arguments>>";
+    return execute(args);
+  }
+
+  struct Select {
+    uint64_t sel;
+    uint64_t tgts_size;
+    const uint64_t *tgts;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Select() {
+    Select args;
+    args.sel = Reg<uint64_t>(&frame[*pc++]).get();
+    args.tgts_size = *pc++;
+    args.tgts = pc;
+    pc += args.tgts_size;
+    DVLOG(5) << "Select" << "  " << args.sel << "  " << "<<offsets>>";
+    return execute(args);
+  }
+
+  struct Raise {
+    const std::string * msg;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Raise() {
+    Raise args;
+    args.msg = &literals[*pc++];
+    DVLOG(5) << "Raise" << "  " << args.msg;
+    return execute(args);
+  }
+
+  struct Trace {
+    const std::string * msg;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_Trace() {
+    Trace args;
+    args.msg = &literals[*pc++];
+    DVLOG(5) << "Trace" << "  " << args.msg;
+    return execute(args);
+  }
+
+  struct TraceReg {
+    const std::string * msg;
+    uint64_t reg;
+  };
+  
+  FOLLY_ALWAYS_INLINE void eval_TraceReg() {
+    TraceReg args;
+    args.msg = &literals[*pc++];
+    args.reg = Reg<uint64_t>(&frame[*pc++]).get();
+    DVLOG(5) << "TraceReg" << "  " << args.msg << "  " << args.reg;
+    return execute(args);
+  }
+
+  struct Suspend {
+    uint64_t unused;
+    uint64_t cont;
+  };
+  
+  FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE  eval_Suspend() {
+    Suspend args;
+    args.unused = Reg<uint64_t>(&frame[*pc++]).get();
+    args.cont = *pc++;
+    DVLOG(5) << "Suspend" << "  " << args.unused << "  " << args.cont;
+    return execute(args);
+  }
+
+  struct Ret {
+  };
+  
+  FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE  eval_Ret() {
+    Ret args;
+    DVLOG(5) << "Ret";
+    return execute(args);
+  }
diff --git a/glean/bytecode/gen/Glean/Bytecode/Generate/Cpp.hs b/glean/bytecode/gen/Glean/Bytecode/Generate/Cpp.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/gen/Glean/Bytecode/Generate/Cpp.hs
@@ -0,0 +1,254 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC  -fno-warn-incomplete-patterns #-}
+module Glean.Bytecode.Generate.Cpp (main)
+where
+
+import Data.List (intercalate, stripPrefix)
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import System.Directory
+import System.Environment
+import System.Exit (die)
+import System.FilePath
+
+import Glean.Bytecode.Generate.Instruction
+import Glean.Bytecode.Types
+
+-- We generate 3 files:
+--
+-- instruction.h has the enum with all opcodes
+--
+-- evaluator.h defines functions for decoding instructions and two evaluators -
+-- one based on switch and the other token-threaded. It is intended to be
+-- included as part of the definition of an evaluator class.
+
+indent :: Text -> Text
+indent x = "  " <> x
+
+main :: IO ()
+main = do
+  args <- getArgs
+  dir <- case args of
+    [arg] | Just dir <- stripPrefix "--install_dir=" arg -> return dir
+    _ -> die "invalid arguments"
+  createDirectoryIfMissing True dir
+  genHeader (dir </> "instruction.h")
+    ["#include <cstdint>"]
+    genOpEnum
+  genFile (dir </> "evaluate.h")
+    genEvaluator
+
+-- | Generate a file.
+genFile :: FilePath -> [Text] -> IO ()
+genFile path ls = Text.writeFile path
+  $ Text.unlines
+  $ ("// @" <> "generated") : "" : ls
+
+-- | Generate a header file (with #pragma once and namespaces).
+genHeader :: FilePath -> [Text] -> [Text] -> IO ()
+genHeader path pre ls = genFile path $
+  [ "#pragma once"
+  , "" ]
+  ++ pre ++
+  [ ""
+  , "namespace facebook {"
+  , "namespace glean {"
+  , "namespace rts {"
+  , "" ]
+  ++ ls ++
+  [ ""
+  , "}"
+  , "}"
+  , "}" ]
+
+unusedOps :: [Text]
+unusedOps = ["Unused" <> Text.pack (show n) | n <- [length instructions .. 255]]
+
+-- | Generate the enum with all opcodes.
+genOpEnum :: [Text]
+genOpEnum =
+  "enum class Op : uint8_t {"
+  : [indent $ insnName insn <> "," | insn <- instructions]
+  ++ [indent $ op <> "," | op <- unusedOps]
+  ++ ["};"]
+
+genEvaluator :: [Text]
+genEvaluator =
+  intercalate [""] (map (map indent) $
+    genEvalSwitch : genEvalIndirect : map genInsnEval instructions)
+
+-- | Generate a method which decodes and then executes (via a function which
+-- we expect to be defined) an instruction. For each instruction, we generate
+-- a struct containing its decoded arguments and adjust PC to point to the next
+-- instruction in the stream.
+genInsnEval :: Insn -> [Text]
+genInsnEval Insn{..} =
+  [ "struct " <> insnName <> " {" ]
+  ++ map indent (concatMap declare insnArgs) ++
+  [ "};"
+  , ""
+  , "FOLLY_ALWAYS_INLINE " <> retType <> " eval_" <> insnName <> "() {"
+  , "  " <> insnName <> " args;" ]
+  ++ map indent (concatMap decode insnArgs)
+  ++ [indent ("DVLOG(5) << " <> "\"" <> insnName  <> "\"" <>
+      Text.concat (map ((" << \"  \" << " <>) . logArg) insnArgs) <> ";")] ++
+  [ "  return execute(args);"
+  , "}" ]
+  where
+    retType
+      | Return `elem` insnEffects = "const uint64_t * FOLLY_NULLABLE "
+      | otherwise = "void"
+
+    declare (Arg name (Imm ty)) =
+      [ immType ty <> " " <> name <> ";" ]
+    declare (Arg name (Reg _ ty Load)) =
+      [ cppType ty <> " " <> name <> ";" ]
+    -- just make a pointer to the register for Store and Update for now
+    declare (Arg name (Reg _ ty _)) =
+      [ "Reg<" <> cppType ty <> "> " <> name <> ";" ]
+    declare (Arg name Offsets) =
+      [ "uint64_t " <> name <> "_size;"
+      , "const uint64_t *" <> name <> ";" ]
+    declare (Arg name (Regs tys))  =
+      [ "static constexpr uint64_t " <> name <> "_arity = "
+          <> Text.pack (show (length tys) <> ";")
+      , "const uint64_t *" <> name <> ";" ]
+
+    decode (Arg name (Imm ImmLit)) =
+      [ "args." <> name <> " = &literals[*pc++];" ]
+    decode (Arg name (Imm _)) =
+      [ "args." <> name <> " = *pc++;" ]
+    decode (Arg name (Reg _ ty Load)) =
+      [ "args." <> name <> " = Reg<" <> cppType ty <> ">(&frame[*pc++]).get();" ]
+    decode (Arg name (Reg _ ty _)) =
+      [ "args." <> name <> " = Reg<" <> cppType ty <> ">(&frame[*pc++]);" ]
+    decode (Arg name Offsets) =
+      [ "args." <> name <> "_size = *pc++;"
+      , "args." <> name <> " = pc;"
+      , "pc += args." <> name <> "_size;" ]
+    decode (Arg name (Regs _)) =
+      [ "args." <> name <> " = pc;"
+      , "pc += args." <> name <> "_arity;" ]
+
+    logArg (Arg name (Imm _))
+      = "args." <> name
+    logArg (Arg name (Reg _ regTy _))
+      | regTy == Word || regTy == Lit || regTy == Offset
+      = "args." <> name
+    logArg (Arg _name (Reg _ regTy _))
+      | regTy == DataPtr || regTy == WordPtr
+      = "\"<<ptr>>\""
+    logArg (Arg _name (Reg _ BinaryOutputPtr _))
+      = "\"<<binary::Output>>\""
+    logArg (Arg _name (Reg _ (Fun _) _))
+      = "\"<<funptr>>\""
+    logArg (Arg _name Offsets)
+      = "\"<<offsets>>\""
+    logArg (Arg _name (Regs _))
+      = "\"<<reg arguments>>\""
+
+
+cppType :: Ty -> Text
+cppType DataPtr = "const unsigned char *"
+cppType Lit = "const std::string *"
+cppType WordPtr = "uint64_t *"
+cppType BinaryOutputPtr = "binary::Output *"
+cppType (Fun _) = "SysFun"
+cppType _ = "uint64_t"
+
+immType :: ImmTy -> Text
+immType ImmWord = "uint64_t"
+immType ImmOffset = "uint64_t"
+immType ImmLit = "const std::string *"
+
+-- | Generate a switch-based evaluator.
+--
+-- while(true) {
+--   switch (static_cast<Op>(*pc++)) {
+--     case Op::Name:
+--       eval_Name();
+--       break;
+--      ...
+--
+--     case Op::Unused42:
+--     ...
+--     case Op::Unused255:
+--       rts::error("invalid opcode");
+--    }
+-- }
+--
+-- Note that we generate alternatives for each possible value of the opcode byte
+-- rather than using `default` because this results in better code (jump via
+-- table at end of each alternative rather than bounds check + jump via table in
+-- a common loop).
+--
+genEvalSwitch :: [Text]
+genEvalSwitch =
+  [ "FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE evalSwitch() {"
+  , "  while (true) {"
+  , "    switch (static_cast<Op>(*pc++)) {" ]
+  ++ intercalate [""] (map genAlt instructions)
+  ++
+  [ "" ]
+  ++ map genUnusedAlt unusedOps ++
+  [ "        rts::error(\"invalid opcode\");"
+  , "    }"
+  , "  }"
+  , "}" ]
+  where
+    genAlt insn =
+      "      case Op::" <> insnName insn <> ":"
+      : makeCall insn "        break;"
+
+    genUnusedAlt op =
+      "      case Op::" <> op <> ":"
+
+-- | Generate a token-threaded interpreter (opcode are indices into a table
+-- of labels, dispatch via compute goto). Note dispatch is repeated for each
+-- instruction for (perhaps) better branch prediction.
+--
+-- static const void * const labels[] = { &&label_Name, ... };
+--
+-- goto *labels[*pc++];
+--
+-- label_Name:
+--   eval_Name();
+--   goto *labels[*pc++];
+--
+genEvalIndirect :: [Text]
+genEvalIndirect =
+  [ "FOLLY_ALWAYS_INLINE const uint64_t * FOLLY_NULLABLE evalIndirect() {"
+  , "  static const void * const labels[] = {" ]
+  ++
+  [ "    &&label_" <> insnName insn <> "," | insn <- instructions ]
+  ++
+  [ "  };"
+  , ""
+  , dispatch
+  , "" ]
+  ++ intercalate [""] (map genAlt instructions) ++
+  ["}"]
+  where
+    dispatch = "  goto *labels[*pc++];"
+
+    genAlt insn =
+      "label_" <> insnName insn <> ":"
+      : makeCall insn dispatch
+
+makeCall :: Insn -> Text -> [Text]
+makeCall insn cont
+  | Return `elem` insnEffects insn =
+      [ "        return " <> call ]
+  | otherwise =
+      [ "        " <> call
+      , cont ]
+  where
+    call = "eval_" <> insnName insn <> "();"
diff --git a/glean/bytecode/gen/Glean/Bytecode/Generate/Haskell.hs b/glean/bytecode/gen/Glean/Bytecode/Generate/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/gen/Glean/Bytecode/Generate/Haskell.hs
@@ -0,0 +1,315 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Bytecode.Generate.Haskell (main)
+where
+
+import Data.Char (toLower)
+import Data.List (intercalate, intersperse, stripPrefix)
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import System.Directory
+import System.Environment
+import System.Exit (die)
+import System.FilePath
+
+import Glean.Bytecode.Generate.Instruction
+import Glean.Bytecode.Types
+
+-- We generate two modules:
+--
+-- Instruction: contains the Insn type and some utility functions
+--
+-- Issue: a typed interface for generating instructions based on the MonadInsn
+-- class from Glean.RTS.Bytecode.MonadInsn.
+
+list :: Text -> Text -> [Text] -> [Text]
+list first others (x:xs) = first <> x : map (others <>) xs
+list _ _ [] = []
+
+modPfx :: Text
+modPfx = "Glean.RTS.Bytecode.Gen"
+
+modPath :: FilePath
+modPath = Text.unpack $ Text.replace "." "/" modPfx
+
+main :: IO ()
+main = do
+  args <- getArgs
+  dir <- case args of
+    [arg] | Just dir <- stripPrefix "--install_dir=" arg ->
+      return $ dir </> modPath
+    _ -> die "invalid arguments"
+  createDirectoryIfMissing True dir
+  genModule dir "Instruction"
+    []
+    [ "Insn(..)"
+    , "mapLabels"
+    , "insnLabels"
+    , "insnSize"
+    , "insnWords"
+    , "insnShow" ] $
+    intercalate [""]
+    [ [ "import Data.Word (Word64)"
+      , "import Text.Show (showListWith)"
+      , "import qualified Glean.Bytecode.Decode as D"
+      , "import Glean.Bytecode.Types" ]
+    , genInsnType
+    , genMapLabels
+    , genInsnLabels
+    , genInsnSize
+    , genInsnWords
+    , genDecodable
+    , genInsnShow ]
+
+  genModule dir "Issue" [] (map (varName . insnName) instructions) $
+    [ "import Data.ByteString (ByteString)"
+    , "import Data.Word (Word64)"
+    , "import Glean.RTS.Bytecode.Gen.Instruction (Insn(..))"
+    , "import Glean.RTS.Bytecode.Code"
+    , "import Glean.Bytecode.Types"
+    , "" ]
+    ++ genIssue
+
+  genModule dir "Version" [] ["version", "lowestSupportedVersion"]
+    [ "version :: Int"
+    , "version = " <> Text.pack (show version)
+    , ""
+    , "lowestSupportedVersion :: Int"
+    , "lowestSupportedVersion = " <> Text.pack (show lowestSupportedVersion)
+    ]
+
+genModule :: FilePath -> String -> [Text] -> [Text] -> [Text] -> IO ()
+genModule path name exts es ls =
+  Text.writeFile (path </> name <.> "hs")
+  $ Text.unlines $
+  [ "-- @" <> "generated" ]
+  ++
+  [ "{-# LANGUAGE " <> Text.intercalate ", " exts <> " #-}" | not (null exts)]
+  ++
+  [ "{-# OPTIONS_GHC -Wno-unused-matches #-}"
+  , "module " <> modPfx <> "." <> Text.pack name ]
+  ++ list "  ( " "  , " es ++
+  [ "  ) where"
+  , "" ]
+  ++ ls
+
+-- | Generate the Insn type. We parametrise over the types of registers and
+-- labels.
+genInsnType :: [Text]
+genInsnType = "data Insn where" : map genInsn instructions
+  where
+    genInsn Insn{..} =
+      "  "
+        <> insnName
+        <> " :: "
+        <> Text.concat
+            [ty <> " -> " | arg <- insnArgs, ty <- genArgTy $ argTy arg]
+        <> "Insn"
+
+    genArgTy (Imm ImmOffset) = ["{-# UNPACK #-} !Label"]
+    genArgTy (Imm ImmLit) = ["{-# UNPACK #-} !Literal"]
+    genArgTy (Imm ImmWord) = ["{-# UNPACK #-} !Word64"]
+    genArgTy (Reg var ty _) = ["{-# UNPACK #-} !(" <> showRegTy var ty <> ")"]
+    genArgTy Offsets = ["[Label]"]
+    genArgTy (Regs tys) = ["(Register " <> showTy ty <> ")" | ty <- tys]
+
+showTy :: Ty -> Text
+showTy ty = case ty of
+  Fun args ->
+    "('Fun '[ " <> Text.intercalate "," (map showTy args) <> " ])"
+  _ -> "'" <> Text.pack (show ty)
+
+showRegTy :: Maybe Text -> Ty -> Text
+showRegTy var ty = "Register " <> fromMaybe (showTy ty) var
+
+genMapLabels :: [Text]
+genMapLabels =
+  "mapLabels :: (Label -> Label) -> Insn -> Insn" :
+  [ "mapLabels f ("
+      <> Text.unwords (insnName insn : map argName (insnArgs insn))
+      <> ") = "
+      <> Text.unwords (insnName insn : exprs)
+    | insn <- instructions
+    , let exprs = map mkMap (insnArgs insn)
+    , any (\(expr,arg) -> expr /= argName arg) $ zip exprs $ insnArgs insn ]
+  ++
+  [ "mapLabels _ insn = insn"]
+  where
+    mkMap (Arg name (Imm ImmOffset)) = "(f " <> name <> ")"
+    mkMap (Arg name Offsets) = "(map f " <> name <> ")"
+    mkMap (Arg name _) = name
+
+genInsnLabels :: [Text]
+genInsnLabels =
+  "insnLabels :: Insn -> [Label]" :
+  [ "insnLabels ("
+      <> Text.unwords (insnName insn : map argName (insnArgs insn))
+      <> ") = "
+      <> Text.intercalate " ++ " exprs
+    | insn <- instructions
+    , let exprs = mapMaybe mkList (insnArgs insn)
+    , not $ null exprs ]
+  ++
+  [ "insnLabels _ = []"]
+  where
+    mkList (Arg name (Imm ImmOffset)) = Just $ "[" <> name <> "]"
+    mkList (Arg name Offsets) = Just name
+    mkList Arg{} = Nothing
+
+-- | Generates a function that yields the size of an instruction in words.
+genInsnSize :: [Text]
+genInsnSize =
+  "insnSize :: Insn -> Word64" :
+  [ "insnSize "
+      <> mkPat insnName (concatMap mkArg insnArgs)
+      <> " = "
+      <> showSize (foldr argSize (1::Int,"") insnArgs)
+    | Insn{..} <- instructions ]
+  where
+    mkPat name [] = name
+    mkPat name args
+      | all (=="_") args = name <> "{}"
+      | otherwise = "(" <> Text.unwords (name : args) <> ")"
+
+    mkArg (Arg name Offsets) = [name]
+    mkArg (Arg _ (Regs tys)) = replicate (length tys) "_"
+    mkArg _ = ["_"]
+
+    showSize (c,v) = Text.pack (show c) <> v
+
+    argSize (Arg name Offsets) (c,v) =
+      (c+1, v <> " + fromIntegral (length " <> name <> ")")
+    argSize (Arg _ (Regs tys)) (c,v) = (c + length tys, v)
+    argSize _ (c,v) = (c+1, v)
+
+-- | Generates a function that encodes an instruction as a list of words.
+genInsnWords :: [Text]
+genInsnWords =
+   [ "insnWords"
+   , "  :: (forall ty. Register ty -> Word64) -> (Label -> Word64) -> Insn -> [Word64]" ]
+   ++
+   [ "insnWords fromReg fromLabel ("
+      <> insnPattern id insn
+      <> ") = ["
+      <> Text.pack (show op)
+      <> Text.concat (map argWords (insnArgs insn))
+      <> "]" | (op, insn) <- zip [0 :: Int ..] instructions ]
+    where
+      argWords (Arg name (Imm ImmOffset)) = ", fromLabel " <> name
+      argWords (Arg name (Imm ImmLit)) = ", fromLiteral " <> name
+      argWords (Arg name (Imm ImmWord)) = ", " <> name
+      argWords (Arg name Reg{}) = ", fromReg " <> name
+      argWords (Arg name Offsets) =
+        ", fromIntegral (length " <> name <> ")] ++ map fromLabel " <> name
+          <> " ++ ["
+      argWords (Arg name (Regs tys)) =
+        Text.concat [", fromReg " <> reg | reg <- regNames name tys]
+
+insnPattern :: (Text -> Text) -> Insn -> Text
+insnPattern cname Insn{..} =
+  Text.unwords $ cname insnName : concatMap argNames insnArgs
+  where
+    argNames (Arg name (Regs tys)) = regNames name tys
+    argNames (Arg name _) = [name]
+
+regNames :: Text -> [Ty] -> [Text]
+regNames name tys = [name <> Text.pack (show i) | i <- [1 .. length tys]]
+
+varName :: Text -> Text
+varName name
+  | Just (c,rest) <- Text.uncons name = Text.cons (toLower c) rest
+  | otherwise = name
+
+genIssue :: [Text]
+genIssue = intercalate [""]
+  [ [ varName insnName
+        <> " :: "
+        <> context insnContext
+        <> Text.unwords
+            (intersperse "->"
+              $ concatMap (genArgType . argTy) insnArgs ++ ["Code ()"])
+    , insnPattern varName insn <> " = do"
+    ] ++ map ("  " <>)
+      (mapMaybe literal insnArgs ++
+      [ issue insnEffects
+          <> " $ " <> Text.unwords (insnName : concatMap genArgRef insnArgs) ])
+    | insn@Insn{..} <- instructions ]
+  where
+    context [] = ""
+    context [c] = c <> " => "
+    context cs = "(" <> Text.intercalate ", " cs <> ") => "
+
+    genArgType (Imm ImmLit) = ["ByteString"]
+    genArgType (Imm ImmOffset) = ["Label"]
+    genArgType (Imm ImmWord) = ["Word64"]
+    genArgType (Reg var ty _) = [showRegTy var ty]
+    genArgType Offsets = ["[Label]"]
+    genArgType (Regs tys) = ["Register " <> showTy ty | ty <- tys]
+
+    genArgRef (Arg name (Imm ImmLit)) = [name <> "_i"]
+    genArgRef (Arg name (Regs tys)) = regNames name tys
+    genArgRef (Arg name _) = [name]
+
+    literal (Arg name (Imm ImmLit)) = Just $
+      name <> "_i <- literal " <> name
+    literal _ = Nothing
+
+    issue effects
+      | EndBlock `elem` effects = "issueEndBlock"
+      | otherwise = "issue"
+
+genDecodable :: [Text]
+genDecodable =
+  [ "instance D.Decodable Insn where"
+  , "  decode = do"
+  , "    op <- D.decode"
+  , "    case (op :: Word64) of" ]
+  ++
+  [ Text.concat $ [ "      ", Text.pack (show i), " -> " ] ++
+    case sum (map arity insnArgs) of
+      0 -> ["pure ", insnName]
+      n -> insnName : " <$> D.decode" : replicate (n-1) " <*> D.decode"
+    | (i, Insn{..}) <- zip [0 :: Int ..] instructions ]
+  ++
+  [ "      _ -> fail $ \"invalid opcode \" ++ show op"]
+  where
+    arity (Arg _ (Regs tys)) = length tys
+    arity _ = 1
+
+genInsnShow :: [Text]
+genInsnShow =
+  [ "insnShow"
+  , "  :: [String]"
+  , "  -> (Label -> String)"
+  , "  -> (forall t. Register t -> String)"
+  , "  -> Insn"
+  , "  -> String" ]
+  ++
+  [ "insnShow syscalls showLabel showReg ("
+      <> insnPattern id insn
+      <> ") = concat [" <> name
+      <> Text.intercalate ", \",\""
+          [", \' \' : " <> w | arg <- args, w <- showArg arg]
+      <> "]" | insn@Insn{..} <- instructions
+             , let (name, args) = mkNameArgs insnName insnArgs ]
+    where
+      showArg (Arg name (Imm ImmOffset)) = ["showLabel " <> name]
+      showArg (Arg name (Imm ImmLit)) = ["show (fromLiteral " <> name <> ")"]
+      showArg (Arg name (Imm ImmWord)) = ["show " <> name]
+      showArg (Arg name Reg{}) = ["showReg " <> name]
+      showArg (Arg name Offsets) =
+        ["showListWith (showString . showLabel) " <> name <> " \"\""]
+      showArg (Arg name (Regs tys)) =
+        ["showReg " <> reg | reg <- regNames name tys]
+      mkNameArgs name args
+        | "CallFun" `Text.isPrefixOf` name =
+          ("(syscalls !! fromIntegral (fromRegister fun))", tail args)
+        | otherwise = ("\"" <> name <> "\"", args)
diff --git a/glean/bytecode/instruction.h b/glean/bytecode/instruction.h
new file mode 100644
--- /dev/null
+++ b/glean/bytecode/instruction.h
@@ -0,0 +1,272 @@
+// @generated
+
+#pragma once
+
+#include <cstdint>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+enum class Op : uint8_t {
+  InputNat,
+  InputByte,
+  InputBytes,
+  InputSkipUntrustedString,
+  InputShiftLit,
+  InputShiftBytes,
+  InputSkipNat,
+  InputSkipTrustedString,
+  ResetOutput,
+  OutputNat,
+  OutputNatImm,
+  OutputByte,
+  OutputByteImm,
+  OutputBytes,
+  OutputStringToLower,
+  OutputRelToAbsByteSpans,
+  OutputUnpackByteSpans,
+  OutputStringReverse,
+  GetOutput,
+  GetOutputSize,
+  LoadConst,
+  LoadLiteral,
+  Move,
+  SubConst,
+  Sub,
+  AddConst,
+  Add,
+  PtrDiff,
+  LoadLabel,
+  Jump,
+  JumpReg,
+  JumpIf0,
+  JumpIfNot0,
+  JumpIfEq,
+  JumpIfNe,
+  JumpIfGt,
+  JumpIfGe,
+  JumpIfLt,
+  JumpIfLe,
+  DecrAndJumpIfNot0,
+  DecrAndJumpIf0,
+  CallFun_0_1,
+  CallFun_0_2,
+  CallFun_1_1,
+  CallFun_1_0,
+  CallFun_2_1,
+  CallFun_2_0,
+  CallFun_3_0,
+  CallFun_4_0,
+  CallFun_3_1,
+  CallFun_5_0,
+  CallFun_5_1,
+  CallFun_2_2,
+  CallFun_2_5,
+  Select,
+  Raise,
+  Trace,
+  TraceReg,
+  Suspend,
+  Ret,
+  Unused60,
+  Unused61,
+  Unused62,
+  Unused63,
+  Unused64,
+  Unused65,
+  Unused66,
+  Unused67,
+  Unused68,
+  Unused69,
+  Unused70,
+  Unused71,
+  Unused72,
+  Unused73,
+  Unused74,
+  Unused75,
+  Unused76,
+  Unused77,
+  Unused78,
+  Unused79,
+  Unused80,
+  Unused81,
+  Unused82,
+  Unused83,
+  Unused84,
+  Unused85,
+  Unused86,
+  Unused87,
+  Unused88,
+  Unused89,
+  Unused90,
+  Unused91,
+  Unused92,
+  Unused93,
+  Unused94,
+  Unused95,
+  Unused96,
+  Unused97,
+  Unused98,
+  Unused99,
+  Unused100,
+  Unused101,
+  Unused102,
+  Unused103,
+  Unused104,
+  Unused105,
+  Unused106,
+  Unused107,
+  Unused108,
+  Unused109,
+  Unused110,
+  Unused111,
+  Unused112,
+  Unused113,
+  Unused114,
+  Unused115,
+  Unused116,
+  Unused117,
+  Unused118,
+  Unused119,
+  Unused120,
+  Unused121,
+  Unused122,
+  Unused123,
+  Unused124,
+  Unused125,
+  Unused126,
+  Unused127,
+  Unused128,
+  Unused129,
+  Unused130,
+  Unused131,
+  Unused132,
+  Unused133,
+  Unused134,
+  Unused135,
+  Unused136,
+  Unused137,
+  Unused138,
+  Unused139,
+  Unused140,
+  Unused141,
+  Unused142,
+  Unused143,
+  Unused144,
+  Unused145,
+  Unused146,
+  Unused147,
+  Unused148,
+  Unused149,
+  Unused150,
+  Unused151,
+  Unused152,
+  Unused153,
+  Unused154,
+  Unused155,
+  Unused156,
+  Unused157,
+  Unused158,
+  Unused159,
+  Unused160,
+  Unused161,
+  Unused162,
+  Unused163,
+  Unused164,
+  Unused165,
+  Unused166,
+  Unused167,
+  Unused168,
+  Unused169,
+  Unused170,
+  Unused171,
+  Unused172,
+  Unused173,
+  Unused174,
+  Unused175,
+  Unused176,
+  Unused177,
+  Unused178,
+  Unused179,
+  Unused180,
+  Unused181,
+  Unused182,
+  Unused183,
+  Unused184,
+  Unused185,
+  Unused186,
+  Unused187,
+  Unused188,
+  Unused189,
+  Unused190,
+  Unused191,
+  Unused192,
+  Unused193,
+  Unused194,
+  Unused195,
+  Unused196,
+  Unused197,
+  Unused198,
+  Unused199,
+  Unused200,
+  Unused201,
+  Unused202,
+  Unused203,
+  Unused204,
+  Unused205,
+  Unused206,
+  Unused207,
+  Unused208,
+  Unused209,
+  Unused210,
+  Unused211,
+  Unused212,
+  Unused213,
+  Unused214,
+  Unused215,
+  Unused216,
+  Unused217,
+  Unused218,
+  Unused219,
+  Unused220,
+  Unused221,
+  Unused222,
+  Unused223,
+  Unused224,
+  Unused225,
+  Unused226,
+  Unused227,
+  Unused228,
+  Unused229,
+  Unused230,
+  Unused231,
+  Unused232,
+  Unused233,
+  Unused234,
+  Unused235,
+  Unused236,
+  Unused237,
+  Unused238,
+  Unused239,
+  Unused240,
+  Unused241,
+  Unused242,
+  Unused243,
+  Unused244,
+  Unused245,
+  Unused246,
+  Unused247,
+  Unused248,
+  Unused249,
+  Unused250,
+  Unused251,
+  Unused252,
+  Unused253,
+  Unused254,
+  Unused255,
+};
+
+}
+}
+}
diff --git a/glean/client/hs/Glean.hs b/glean/client/hs/Glean.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean.hs
@@ -0,0 +1,218 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+--
+-- | Interface providing everything that clients of a Glean server should need.
+-- To use a local database store, see "Glean.LocalOrRemote".
+--
+-- Client code should look like:
+--
+-- > import Glean
+-- > import Glean.Remote
+-- > import Glean.Util.ConfigProvider
+-- > import Glean.Impl.ConfigProvider
+-- > import Glean.Schema.Builtin.Types (schema_id)
+-- > import Util.EventBase
+-- >
+-- > main :: IO ()
+-- > main =
+-- >   withConfigOptions options $ \(service, cfgOpts) ->
+-- >   withEventBaseDataplane $ \evb ->
+-- >   withConfigProvider cfgOpts $ \(cfgAPI :: ConfigAPI) ->
+-- >   withRemoteBackend evb cfgAPI service (Just schema_id) $ \backend -> do
+-- >     ...
+--
+module Glean
+  (
+  -- * Clients interact with Glean via a Backend
+    Backend(..)
+  , UseShards(..)
+  , ThriftSource
+  , ClientConfig(..)
+  , ListDatabases(..)
+  , ListDatabasesResult(..)
+  , KickOff(..)
+  , KickOffResponse(..)
+  , Database(..)
+  , DatabaseStatus(..)
+  , GetSchemaInfo(..)
+  , SchemaId(..)
+  , SchemaInfo(..)
+  , UnknownDatabase(..)
+  , Pruned(..)
+  , Stacked(..)
+  , Dependencies(..)
+  , PosixEpochTime(..)
+  , StackedDbOpts(..)
+  , LogDerivationResult
+  , SendJsonBatchOptions(..)
+  , Subst(..)
+  , DatabaseNotIncomplete(..)
+  , FactIdRange(..)
+  , GetDatabaseResult(..)
+  , PredicateStats(..)
+
+  -- * Repositories
+  , Repo(..)
+  , getLatestRepo
+  , NoDatabase(..)
+  , showRepo
+  , showRepoSep
+  , repoToText
+  , repoToTextSep
+  , readRepo
+  , parseRepo
+  , parseRepoText
+  , parseRepoTextSep
+
+  -- * Queries
+  , Query
+
+  -- ** Performing queries
+  , runQuery
+  , runQuery_
+  , runQueryEach
+  , runQueryEachBatch
+  , runQueryMapPages_
+  , BadQuery(..)
+  , allFacts
+
+  -- ** Query using Angle syntax
+  , angle
+  , angleData
+  , encodeTextForAngle
+
+  -- ** Query modifiers
+  , keys
+  , recursive
+  , limit
+  , limitBytes
+  , limitTime
+  , expanding
+  , store
+
+  -- ** Inspecting Query
+  , displayQuery
+
+  -- * Haxl: high-performance query API
+  , Haxl
+  , runHaxl
+  , runHaxlWithWrites
+  , haxlRepo
+  , search
+  , search_
+  , searchWith
+  , QueryResult(..)
+  , count
+  , get
+  , getRec
+  , getKey
+  , getKeyRec
+  , getOfId
+  , getRecOfId
+  , getKeyOfId
+  , getKeyRecOfId
+  , keyOf
+  , getFirstResult
+  -- ** Error handling
+  , trySyncHaxl
+
+  -- * Manipulating predicates and facts
+  , Predicate(..)
+  , Nat(..)
+  , toNat, fromNat
+  , Byte(..)
+  , Id
+  , justId
+  , IdOf(..)
+  , Fid(..)   -- TODO: Fid isn't very useful, might want to tidy up the API here
+  , PredicateRef(..)
+  , predicateRef
+  , SourceRef(..) -- used in Glean.Util.Derive
+  , showRef
+  , parseRef
+
+  -- * Writing
+  , fillDatabase
+  , create
+  , finish
+  , finalize
+  , completePredicates
+  , CompletePredicates(..)
+  , CompleteDerivedPredicate(..)
+  , CompleteAxiomPredicates(..)
+  , basicWriter
+  , SchemaPredicates
+  , FactBuilder
+  , makeFact
+  , makeFact_
+  , makeFactV
+  , makeFactV_
+  , NewFact(..)
+
+  -- ** Lower-level write API
+  , withSender
+  , Sender
+  , SendAndRebaseQueue
+  , sendAndRebaseQueueOptions
+  , SendAndRebaseQueueSettings(..)
+  , sendQueueOptions
+  , SendQueueSettings(..)
+  , SendQueueEvent(..)
+  , withWriter
+  , withWriters
+  , Writer
+  , WriterSettings(..)
+  , WriterEvent(..)
+  , writerOptions
+  , writeFacts
+  , writeSendAndRebaseQueue
+  , withSendAndRebaseQueue
+  , writeSendQueue
+  , writeSendQueueJson
+  , writeSendQueueDescriptor
+  , withSendQueue
+  , SendQueue
+  , withBatchWriter
+
+  -- ** Writing binary
+  , sendBatch
+
+  -- ** Writing JSON
+  , sendJsonBatch
+  , SendJsonBatch(..)
+  , JsonFactBatch(..)
+
+  -- * Misc
+  , showUserQueryStats
+  , databases
+  , localDatabases
+  ) where
+
+import Glean.Backend.Types
+import Glean.Angle.Lexer
+import Glean.Angle.Types
+import Glean.Schema.Util (showRef, parseRef)
+
+import Glean.Impl.ConfigProvider ()
+  -- re-export instance ConfigProvider ConfigAPI, so that clients
+  -- don't have to import this.
+import Glean.Haxl
+import Glean.Query.Thrift
+import Glean.Query.Thrift.Internal
+import Glean.Repo
+import Glean.Repo.Text
+import Glean.Typed
+import Glean.Types
+import Glean.Write.Async
+import Glean.Write.Options
+import Glean.Write.SendBatch
+import Glean.Write.SendAndRebaseQueue
+import Glean.Write.SendQueue
+import Glean.Util.ThriftSource (ThriftSource)
+import Glean.ClientConfig.Types
diff --git a/glean/client/hs/Glean/Angle.hs b/glean/client/hs/Glean/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Angle.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- |
+-- Small domain-specific language for building Angle queries
+-- programmatically.
+--
+module Glean.Angle (module Glean.Query.Angle) where
+
+import Glean.Query.Angle
diff --git a/glean/client/hs/Glean/Haxl.hs b/glean/client/hs/Glean/Haxl.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Haxl.hs
@@ -0,0 +1,113 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, ConstraintKinds #-}
+module Glean.Haxl
+  ( runHaxl
+  , runHaxlWithWrites
+  , initHaxlEnv
+  , Haxl
+  , haxlRepo
+  , get
+  , getRec
+  , getKey
+  , getKeyRec
+  , getOfId
+  , getRecOfId
+  , getKeyOfId
+  , getKeyRecOfId
+  , keyOf
+  , search
+  , search_
+  , searchWith
+  , QueryResult(..)
+  , count
+  , Query
+  , recursive
+  , limit
+  , trySyncHaxl
+  , getFirstResult
+  , HaxlWrite
+    -- * re-export
+  , initGlobalState
+  ) where
+
+import Control.Arrow
+import Control.Exception (SomeException)
+import Data.Maybe (listToMaybe)
+import Data.Typeable
+
+import qualified Haxl.Core as Haxl
+import Haxl.Core.Monad
+import Haxl.DataSource.Glean
+import Util.Control.Exception ( isSyncException )
+
+import Glean.Backend.Types
+import Glean.Query.Thrift
+import Glean.Types
+import Glean.Typed
+
+#ifdef GLEAN_FACEBOOK
+#define MIN_VERSION_haxl(a,b,c) 1
+#endif
+
+#if MIN_VERSION_haxl(2,5,0)
+type HaxlWrite w = WriteTree w
+flatten :: WriteTree w -> [w]
+flatten = flattenWT
+#else
+type HaxlWrite w = w
+flatten :: [w] -> [w]
+flatten = id
+#endif
+
+type Haxl w = GenHaxl Repo (HaxlWrite w)
+
+-- | Initialize for Glean queries
+initHaxlEnv :: Backend b => b -> u -> IO (Haxl.Env u (HaxlWrite w))
+initHaxlEnv backend e = do
+  (state1,state2) <- initGlobalState backend
+  let st = Haxl.stateSet state1 $ Haxl.stateSet state2 Haxl.stateEmpty
+  Haxl.initEnv st e
+
+runHaxl :: Backend b => b -> u -> GenHaxl u (HaxlWrite w) a -> IO a
+runHaxl backend u h = do
+  e <- initHaxlEnv backend u
+  Haxl.runHaxl e h
+
+runHaxlWithWrites
+  :: Backend b
+  => b
+  -> u
+  -> GenHaxl u (HaxlWrite w) a
+  -> IO (a, [w])
+runHaxlWithWrites backend u h = do
+  e <- initHaxlEnv backend u
+  second flatten <$> Haxl.runHaxlWithWrites e h
+
+-- | if the Fact has a key, return it, otherwise fetch it with 'getKey'
+keyOf
+  :: ( Typeable p, Typeable (KeyType p)
+     , Show p, Show (KeyType p)
+     , Predicate p, HasRepo u )
+  => p
+  -> GenHaxl u w (KeyType p)
+keyOf f = case getFactKey f of
+  Nothing -> getKey f
+  Just k -> return k
+
+-- | Catch non-asyncronous exceptions inside Haxl, very good for
+-- thrift calls that throw interesting exceptions.
+trySyncHaxl :: GenHaxl u w b -> GenHaxl u w (Either SomeException b)
+trySyncHaxl act = catchIf isSyncException (Right <$> act) (return . Left)
+
+-- | Search for at most 1 result and return it or Nothing
+getFirstResult
+  :: (Typeable a, Show a, HasRepo u)
+  => Query a -> GenHaxl u w (Maybe a)
+getFirstResult = fmap (listToMaybe . fst) . search . limit 1
diff --git a/glean/client/hs/Glean/Haxl/Repos.hs b/glean/client/hs/Glean/Haxl/Repos.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Haxl/Repos.hs
@@ -0,0 +1,98 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Haxl.Repos
+  ( ReposHaxl
+  , RepoHaxl
+  , MaybeTReposHaxl
+  , MaybeTRepoHaxl
+  , QueryRepos
+  , queryAllRepos
+  , withRepo
+  , queryEachRepo
+  , runHaxlAllRepos
+  , Repos(..)
+  ) where
+
+import Control.Monad.Trans.Maybe (MaybeT (..))
+
+import Haxl.Core hiding (Env, runHaxl)
+import Haxl.Core.Monad (WriteTree)
+import Haxl.DataSource.Glean (HasRepo(..))
+import qualified Haxl.DataSource.Glean
+import Data.List.NonEmpty
+
+import Glean.Backend.Types
+import Glean.Types
+import qualified Glean.Haxl as Glean
+
+
+-- Searching across repos --------
+
+type ReposHaxl u w a = QueryRepos u => GenHaxl u (WriteTree w) a
+type RepoHaxl u w a =
+  Haxl.DataSource.Glean.HasRepo u => GenHaxl u (WriteTree w) a
+type MaybeTReposHaxl u w a = QueryRepos u => MaybeT (GenHaxl u (WriteTree w)) a
+type MaybeTRepoHaxl u w a =
+  Haxl.DataSource.Glean.HasRepo u => MaybeT (GenHaxl u (WriteTree w)) a
+
+-- This type has instances for both HasRepo and HasRepos.
+-- The instance `HasRepo` allows us to use it as the userState
+-- but its not exported so the user doesn't accidently run a query over
+-- only the first repo. Instead the user should just depend on the
+-- QueryRepos constraint
+newtype Repos u = Repos u
+
+class HasRepos us where
+  headRepoFromUserEnv :: us -> Repo
+  tailReposFromUserEnv :: us -> Maybe us
+  singleRepo :: Repo -> us
+
+instance HasRepos (NonEmpty Repo) where
+  headRepoFromUserEnv (x:|_) = x
+  tailReposFromUserEnv (_ :| []) = Nothing
+  tailReposFromUserEnv (_ :| x : xs) = Just $ x :| xs
+  singleRepo repo = repo :| []
+
+instance HasRepos u => HasRepos (Repos u) where
+  headRepoFromUserEnv (Repos xs) = headRepoFromUserEnv xs
+  tailReposFromUserEnv (Repos xs) = Repos <$> tailReposFromUserEnv xs
+  singleRepo repo = Repos $ singleRepo repo
+
+instance HasRepos u => HasRepo (Repos u) where
+  getRepoFromUserEnv (Repos xs) = headRepoFromUserEnv xs
+
+class QueryRepos u where
+  queryEachRepo :: (HasRepo u => GenHaxl u w q) -> GenHaxl u w [q]
+  withRepo :: Repo -> RepoHaxl u w q -> ReposHaxl u w q
+
+instance (HasRepos u) => QueryRepos (Repos u) where
+  queryEachRepo act = do
+    head <- act
+    userEnv <- env userEnv
+    tail <- maybe
+      (return [])
+      (\r -> Haxl.DataSource.Glean.withRepo r $ queryEachRepo act)
+      (tailReposFromUserEnv userEnv)
+    return $ head:tail
+  withRepo repo act = Haxl.DataSource.Glean.withRepo (singleRepo repo) act
+
+queryAllRepos
+  :: RepoHaxl u w [q]
+  -> ReposHaxl u w [q]
+queryAllRepos act = concat <$> queryEachRepo act
+
+runHaxlAllRepos
+  :: (HasRepos u, Backend b)
+  => b
+  -> u
+  -> (forall u'. ReposHaxl u' w a)
+  -> IO a
+runHaxlAllRepos backend u h = Glean.runHaxl backend (Repos u) h
diff --git a/glean/client/hs/Glean/Remote.hs b/glean/client/hs/Glean/Remote.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Remote.hs
@@ -0,0 +1,568 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE PartialTypeSignatures #-}
+module Glean.Remote
+  ( -- * Command-line options
+    options
+  , optionsLong
+
+    -- * Construction
+  , withRemoteBackend
+  , withRemoteBackendSettings
+  , Settings
+  , setService
+  , setNoShards
+  , setTimeout
+  , setBatchSize
+  , thriftServiceWithTimeout
+  , ThriftBackend(..)
+  , defaultClientConfigSource
+
+    -- * Shards
+  , DbShard
+  , dbShard
+  , dbShardWord
+
+    -- * Retries
+  , RetryWritesBackend(..)
+  , backendRetryWrites
+  , RetryReadsBackend(..)
+  , backendRetryReads
+  , RetryPolicy(..)
+  , defaultRetryPolicy
+
+    -- * More operations
+  , clientInfo
+  ) where
+
+import Control.Applicative
+import Control.Exception
+import Control.Monad
+import Data.ByteString (ByteString)
+import Data.Default
+import Data.Foldable(for_)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Int (Int32)
+import Data.List.Extra (chunksOf)
+import qualified Data.Text as Text
+import Data.Typeable
+import qualified Haxl.Core as Haxl
+import Options.Applicative as Options
+import System.Environment (lookupEnv)
+
+import Thrift.Channel
+import Thrift.Api
+import Util.EventBase (EventBaseDataplane)
+import Util.Log
+import Util.STM
+
+import Glean.Backend.Types
+import Glean.Backend.Retry
+import Glean.BuildInfo (buildRule)
+import Glean.ClientConfig.Types (UseShards(..), ClientConfig(..))
+import Glean.DefaultConfigs
+import Glean.GleanService.Client (GleanService)
+import qualified Glean.GleanService.Client as GleanService
+import qualified Glean.Types as Thrift
+import Glean.Query.Thrift
+import Glean.Query.Thrift.Internal
+import Glean.Util.ConfigProvider
+import Glean.Util.RetryChannelException
+import Glean.Util.Service
+import Glean.Username (getUsername)
+import Glean.Util.ThriftSource as ThriftSource
+import Glean.Util.ThriftService
+import Glean.Impl.ThriftService
+import Glean.Types
+
+import Haxl.DataSource.Thrift
+import Haxl.DataSource.Glean.Common
+
+-- | A remote Glean service, supports the operations of 'Backend'.
+data ThriftBackend = ThriftBackend
+  { thriftBackendClientConfig :: ClientConfig
+  , thriftBackendEventBase :: EventBaseDataplane
+  , thriftBackendService :: ThriftService GleanService
+  , thriftBackendClientInfo :: Thrift.UserQueryClientInfo
+  , thriftBackendSchemaId :: Maybe Thrift.SchemaId
+  }
+
+instance Show ThriftBackend where
+  show tb = unwords [ "ThriftBackend {(",
+    "thriftBackendClientConfig: (" <> show (thriftBackendClientConfig tb),
+    "), thriftBackendService: (" <> show (thriftBackendService tb),
+    "), thriftBackendClientInfo: (" <> show (thriftBackendClientInfo tb),
+    "), thriftBackendSchemaId: (" <> show (thriftBackendSchemaId tb),
+    ")}"]
+
+
+type Settings
+  = (ClientConfig,ThriftServiceOptions)
+  -> (ClientConfig,ThriftServiceOptions)
+
+setService :: Service -> Settings
+setService service (conf, opts) = (conf { clientConfig_serv = service }, opts)
+
+setNoShards :: Settings
+setNoShards (conf, opts) = (conf { clientConfig_use_shards = NO_SHARDS }, opts)
+
+-- | Set the processing timeout, overriding any timeout specified by the
+-- service and the host_timeout_ms set in the ClientConfig.
+setTimeout :: Double -> Settings
+setTimeout t (conf, opts) = (conf, opts { processingTimeout = Just t })
+
+-- | Set the query batching size for remote services (size 1 disables batching)
+setBatchSize :: Int32 -> Settings
+setBatchSize batchSize (conf, opts) =
+  (conf{clientConfig_max_batch_size = batchSize}, opts)
+
+-- | Construct a 'Backend' for interacting with a Glean server.
+withRemoteBackend
+  :: ConfigProvider cfg
+  => EventBaseDataplane
+  -> cfg
+  -> ThriftSource ClientConfig
+  -> Maybe Thrift.SchemaId
+  -> (ThriftBackend -> IO a)
+  -> IO a
+withRemoteBackend evb cfg configSource schema inner =
+  withRemoteBackendSettings evb cfg configSource schema id inner
+
+-- | Construct a 'Backend' for interacting with a Glean server, using
+-- the given 'Settings'.
+withRemoteBackendSettings
+  :: ConfigProvider cfg
+  => EventBaseDataplane
+  -> cfg
+  -> ThriftSource ClientConfig
+  -> Maybe Thrift.SchemaId
+  -> Settings
+  -> (ThriftBackend -> IO a)
+  -> IO a
+withRemoteBackendSettings evb configAPI configSource schema settings inner = do
+  config <- ThriftSource.loadDefault configAPI configSource
+  client <- clientInfo
+  let (config', opts) = settings (config, def)
+  inner $ ThriftBackend
+    config
+    evb
+    (thriftServiceWithTimeout config' opts)
+    client
+    schema
+
+thriftServiceWithTimeout
+  :: IsThriftService t
+  => ClientConfig
+  -> ThriftServiceOptions
+  -> t s
+thriftServiceWithTimeout ClientConfig{..} opts =
+  mkThriftService clientConfig_serv opts'
+  where
+    -- add host_timeout_ms if a timeout wasn't already specified and
+    -- we're talking to a specific host.
+    opts' = case clientConfig_serv of
+      HostPort{} ->
+        opts {
+          processingTimeout = processingTimeout opts <|> Just t,
+          queueTimeout = queueTimeout opts <|> Just t
+          }
+        where t = fromIntegral clientConfig_host_timeout_ms / 1000
+      _otherwise -> opts
+
+
+instance Backend ThriftBackend where
+  queryFact t repo id = do
+    fact <- withShard t repo $ GleanService.queryFact repo id
+    case fact of
+      Thrift.Fact 0 _ _ -> return Nothing
+      _ -> return (Just fact)
+  factIdRange t repo = withShard t repo $ GleanService.factIdRange repo
+  getSchemaInfo t Nothing req = withoutShard t $
+    GleanService.getSchemaInfoForSchema req
+  getSchemaInfo t (Just repo) req = withShard t repo $
+    GleanService.getSchemaInfo repo req
+  validateSchema t req = withoutShard t $ GleanService.validateSchema req
+  predicateStats t repo opts = withShard t repo $
+    GleanService.predicateStats repo $
+      Thrift.PredicateStatsOpts{Thrift.predicateStatsOpts_excludeBase=opts==ExcludeBase}
+  listDatabases t l = withoutShard t $ GleanService.listDatabases l
+    { Thrift.listDatabases_client_info = client }
+    where
+      client = Thrift.listDatabases_client_info l
+        <|> Just (thriftBackendClientInfo t)
+  getDatabase t repo = withShard t repo $ GleanService.getDatabase repo
+  userQueryFacts t repo q = withShard t repo $
+    GleanService.userQueryFacts repo q {
+      Thrift.userQueryFacts_client_info = client,
+      Thrift.userQueryFacts_schema_id = schema_id
+    }
+    where
+      client = Thrift.userQueryFacts_client_info q
+        <|> Just (thriftBackendClientInfo t)
+      schema_id = Thrift.userQueryFacts_schema_id q
+        <|> schemaId t
+
+  userQuery t repo q = withShard t repo $
+    GleanService.userQuery repo q {
+      Thrift.userQuery_client_info = client,
+      Thrift.userQuery_schema_id = schema_id
+    }
+    where
+      client = Thrift.userQuery_client_info q
+        <|> Just (thriftBackendClientInfo t)
+      schema_id = Thrift.userQuery_schema_id q
+        <|> schemaId t
+
+  userQueryBatch t repo q = withShard t repo $
+    GleanService.userQueryBatch repo q {
+      Thrift.userQueryBatch_client_info = client,
+      Thrift.userQueryBatch_schema_id = schema_id
+    }
+    where
+      client = Thrift.userQueryBatch_client_info q
+        <|> Just (thriftBackendClientInfo t)
+      schema_id = Thrift.userQueryBatch_schema_id q
+        <|> schemaId t
+
+  deriveStored t _ repo pred = withShard t repo $
+    GleanService.deriveStored repo pred
+      { Thrift.derivePredicateQuery_client_info = client }
+    where
+      client = Thrift.derivePredicateQuery_client_info pred
+        <|> Just (thriftBackendClientInfo t)
+
+  kickOffDatabase t rq = withoutShard t $ GleanService.kickOff rq
+  finishDatabase t repo = withShard t repo $ GleanService.finish repo
+  finalizeDatabase t rq = withoutShard t $ GleanService.finalize rq
+
+  updateProperties t repo set unset =
+    withoutShard t $
+      GleanService.updateProperties repo set unset
+
+  completePredicates_ t repo preds = withShard t repo $
+    GleanService.completePredicates repo preds
+
+  restoreDatabase t loc =
+    withoutShard t $ GleanService.restore loc
+
+  deleteDatabase t repo =
+    withoutShard t $ GleanService.deleteDatabase repo
+
+  enqueueBatch t cbatch =
+    withShard t (Thrift.computedBatch_repo cbatch) $
+      GleanService.sendBatch cbatch
+  enqueueJsonBatch t repo batch =
+    withShard t repo $ GleanService.sendJsonBatch repo batch
+  enqueueBatchDescriptor t repo batch waitPolicy =
+    withShard t repo $ GleanService.enqueueBatch repo batch waitPolicy
+  pollBatch t handle = withoutShard t $ GleanService.finishBatch handle
+
+  displayBackend = show
+
+  hasDatabase ThriftBackend{..} repo = do
+    let serv = thriftServiceWithDbShard thriftBackendService
+          (Just (dbShard repo))
+    hosts <- getSelection thriftBackendEventBase serv 1
+    return (not (null hosts))
+
+  usingShards (ThriftBackend ClientConfig{..} _ _ _ _) =
+    clientConfig_use_shards /= NO_SHARDS
+
+  schemaId ThriftBackend{..} = thriftBackendSchemaId
+
+  initGlobalState = initRemoteGlobalState
+
+
+withShard
+  :: ThriftBackend
+  -> Thrift.Repo
+  -> Thrift GleanService a
+  -> IO a
+withShard (ThriftBackend ClientConfig{..} evb serv _ _) repo act =
+  case clientConfig_use_shards of
+    NO_SHARDS -> unsharded
+    USE_SHARDS -> sharded
+    USE_SHARDS_AND_FALLBACK -> do
+      r <- try sharded
+      case r of
+        Right a -> return a
+        Left e@(ChannelException msg) ->
+          if "SELECTION_NO_HOST_FOR_SHARD" `Text.isInfixOf` msg then do
+            logWarning $ "falling back to unsharded request: " <> show e
+            unsharded
+          else
+            throwIO e
+  where
+    unsharded = runThrift evb serv act
+    shard = dbShard repo
+    sharded = runThrift evb (thriftServiceWithDbShard serv (Just shard)) act
+
+withoutShard
+  :: ThriftBackend
+  -> Thrift GleanService a
+  -> IO a
+withoutShard (ThriftBackend _ evb serv _ _) req = runThrift evb serv req
+
+clientInfo :: IO Thrift.UserQueryClientInfo
+clientInfo = do
+  unixname <- getUsername
+  return def
+    { Thrift.userQueryClientInfo_name = "api-haskell"
+    , Thrift.userQueryClientInfo_unixname = Text.pack <$> unixname
+    , Thrift.userQueryClientInfo_application = buildRule
+    }
+
+
+options :: Parser (ThriftSource ClientConfig)
+options = optionsLong "service"
+
+optionsLong :: String -> Parser (ThriftSource ClientConfig)
+optionsLong self = do
+  config <- option (eitherReader ThriftSource.parse)
+    (  long "client-config"
+    <> metavar "(file:PATH | config:PATH)"
+    <> Options.value defaultClientConfigSource)
+  let updateService svc config = config { clientConfig_serv = svc }
+  service <- fmap updateService <$> optional (strOption
+    (  long self
+    <> metavar "TIER or HOST:PORT"
+    <> help "Glean server to connect to"))
+  let updateSharding sh config = config { clientConfig_use_shards = sh }
+  sharding <- fmap updateSharding <$> optional (option readShard
+    (  long "use-shards"
+    <> metavar "yes|no|fallback"
+    <> help ("Whether to specify a shard when connecting" <>
+         " (default: fallback)")))
+  return
+    $ maybe id fmap service
+    $ maybe id fmap sharding config
+  where
+    readShard = maybeReader $ \str -> case str of
+      "yes" -> Just USE_SHARDS
+      "no" -> Just NO_SHARDS
+      "fallback" -> Just USE_SHARDS_AND_FALLBACK
+      _ -> Nothing
+
+-- -----------------------------------------------------------------------------
+-- Haxl
+
+-- | Maximum number of requests fired concurrently
+defaultMaxConcurrentRequests :: Int
+defaultMaxConcurrentRequests = 1000
+
+-- | Initialize with the default number of maximum concurrent requests.
+initRemoteGlobalState
+  :: ThriftBackend
+  -> IO (Haxl.State GleanGet, Haxl.State GleanQuery)
+initRemoteGlobalState backend =  do
+  maxConcurrency <- maybe defaultMaxConcurrentRequests read <$>
+    lookupEnv "GLEAN_MAX_CONCURRENT_REQUESTS"
+  s <- case maxConcurrency of
+    0 -> pure noSemaphore
+    n -> newSemaphore n
+  initRemoteGlobalStateWithSemaphore s backend
+
+initRemoteGlobalStateWithSemaphore
+  :: Semaphore
+  -> ThriftBackend
+  -> IO (Haxl.State GleanGet, Haxl.State GleanQuery)
+initRemoteGlobalStateWithSemaphore semaphore backend = return
+    ( GleanGetState (remoteFetch backend semaphore)
+    , GleanQueryState (remoteQuery backend semaphore)
+    )
+
+remoteFetch :: ThriftBackend -> Semaphore -> Haxl.PerformFetch GleanGet
+remoteFetch (ThriftBackend config evb ts clientInfo schema) sem =
+  Haxl.BackgroundFetch $ \requests -> do
+  let
+    ts' repo = case clientConfig_use_shards config of
+      NO_SHARDS -> ts
+      USE_SHARDS -> thriftServiceWithDbShard ts (Just (dbShard repo))
+      USE_SHARDS_AND_FALLBACK ->
+        thriftServiceWithDbShard ts (Just (dbShard repo)) -- TODO
+
+  forM_ (HashMap.toList $ requestByRepo requests) $ \(repo, requests) -> do
+    acquireSemaphore sem
+    runThrift evb (ts' repo) $ do
+      let
+        sendCob :: Maybe ChannelException -> IO ()
+        sendCob Nothing = return ()
+        sendCob (Just ex) = putException (toException ex) requests
+
+        recvCob
+          :: (Response -> Either SomeException UserQueryResults)
+          -> RecvCallback
+        recvCob _ (Left ex) = putException (toException ex) requests
+        recvCob deserialize (Right response) =
+          case deserialize response of
+            Left err -> putException err requests
+            Right res -> putResults res requests
+
+      dispatchCommon
+        (\p c ct s r o x ->
+          GleanService.send_userQueryFacts p c ct s r o repo x)
+        (\x -> for_ x (const $ releaseSemaphore sem) >> sendCob x)
+        (\x y -> do
+          releaseSemaphore sem
+          recvCob (GleanService.recv_userQueryFacts x) y)
+        (mkUserQueryFacts (Just clientInfo) schema requests)
+
+putException :: SomeException -> [Haxl.BlockedFetch a] -> IO ()
+putException ex requests =
+  forM_ requests $ \(Haxl.BlockedFetch _ rvar) -> Haxl.putFailure rvar ex
+
+remoteQuery :: ThriftBackend -> Semaphore -> Haxl.PerformFetch GleanQuery
+remoteQuery (ThriftBackend config evb ts clientInfo schema) sem
+  | maxBatchSize > 1
+  = Haxl.BackgroundFetch $ \batch -> do
+    let batches
+          :: HashMap.HashMap
+              (Repo, UserQuery)
+              [(Haxl.BlockedFetch GleanQuery, Bool)]
+        batches = HashMap.fromListWith (++)
+          -- group by repo and query details minus the query itself
+          [( (repo, mkUserQuery (Just clientInfo) schema
+                      q{userQuery_query = mempty})
+           , [(b, stream)]
+           )
+          | b@(Haxl.BlockedFetch (QueryReq (Query q) repo stream) _) <- batch
+          ]
+    mapM_
+      (\((template, repo), batch) -> fetchBatch template repo batch)
+      (HashMap.toList batches)
+  | otherwise
+  = Haxl.BackgroundFetch $ mapM_ fetch
+  where
+  ts' repo = case clientConfig_use_shards config of
+    NO_SHARDS -> ts
+    USE_SHARDS -> thriftServiceWithDbShard ts (Just (dbShard repo))
+    USE_SHARDS_AND_FALLBACK ->
+      thriftServiceWithDbShard ts (Just (dbShard repo)) -- TODO
+
+  maxBatchSize = fromIntegral $ clientConfig_max_batch_size config
+
+  fetch :: Haxl.BlockedFetch GleanQuery -> IO ()
+  fetch (Haxl.BlockedFetch (QueryReq (Query q :: Query q) repo stream) rvar) =
+    runRemoteQuery evb sem repo (Query q' :: Query q) (ts' repo) acc rvar
+    where
+      q' = mkUserQuery (Just clientInfo) schema q
+      acc = if stream then Just mempty else Nothing
+
+  fetchBatch repo predicate reqs =
+    -- avoid overwhelming a single query server with a large batch
+    -- chunking can be removed whenever query servers learn to fuse batches
+    forM_ (chunksOf (max 1 maxBatchSize) reqs) $ \chunk ->
+      runRemoteBatchQuery evb sem repo predicate chunk (ts' repo)
+
+runRemoteBatchQuery
+  :: EventBaseDataplane
+  -> Semaphore
+  -> Repo
+  -> UserQuery
+  -> [(Haxl.BlockedFetch GleanQuery, Bool)]
+  -> ThriftService GleanService
+  -> IO ()
+runRemoteBatchQuery _ _ _ _ [] _ = pure ()
+runRemoteBatchQuery evb sem repo template batch ts = do
+  acquireSemaphore sem
+  let batchRequest :: UserQueryBatch
+      batchRequest = case template of
+        UserQuery{..} ->
+          UserQueryBatch
+            { userQueryBatch_predicate=userQuery_predicate
+            , userQueryBatch_queries=queries
+            , userQueryBatch_predicate_version=userQuery_predicate_version
+            , userQueryBatch_options=userQuery_options
+            , userQueryBatch_encodings=userQuery_encodings
+            , userQueryBatch_client_info=userQuery_client_info
+            , userQueryBatch_schema_id=userQuery_schema_id}
+      queries :: [ByteString]
+      queries = [ userQuery_query uq
+                | (Haxl.BlockedFetch (QueryReq (Query uq) _ _) _, _stream)
+                    <- batch
+                ]
+      sendCob x = forM_ batch $ \(Haxl.BlockedFetch _ rvar, _stream) ->
+                    sendCobSingle rvar x
+      recvCob _ (Left ex) =
+        forM_ batch $ \(Haxl.BlockedFetch _ rvar, _stream) ->
+          Haxl.putFailure rvar (toException ex)
+      recvCob deserialize (Right response) =
+        case deserialize response of
+          Left ex ->
+            forM_ batch $ \(Haxl.BlockedFetch _ rvar, _stream) ->
+              Haxl.putFailure rvar (toException ex)
+          Right ress -> zipWithM_ f batch ress
+      f :: (Haxl.BlockedFetch GleanQuery, Bool)
+        -> UserQueryResultsOrException
+        -> IO ()
+      f (Haxl.BlockedFetch (QueryReq q _ _) rvar, stream) res = do
+        let acc = if stream then Just mempty else Nothing
+        putQueryResultsOrException q res acc rvar $
+          \(q :: Query q) acc -> runRemoteQuery evb sem repo q ts acc rvar
+  runThrift evb ts $
+    dispatchCommon
+      (\p c ct s r o x -> GleanService.send_userQueryBatch p c ct s r o repo x)
+      (\x -> for_ x (const $ releaseSemaphore sem) >> sendCob x)
+      (\x y -> do
+        releaseSemaphore sem
+        recvCob (GleanService.recv_userQueryBatch x) y)
+      batchRequest
+
+runRemoteQuery
+  :: forall q r. (Show q, Typeable q, QueryResult q r)
+  => EventBaseDataplane
+  -> Semaphore
+  -> Repo
+  -> Query q
+  -> ThriftService GleanService
+  -> Maybe r -- results so far
+  -> Haxl.ResultVar (r, Bool)
+  -> IO ()
+runRemoteQuery evb sem repo q@(Query req) ts acc rvar = do
+  acquireSemaphore sem
+  runThrift evb ts $ do
+    let
+      recvCob
+        :: (Response -> Either SomeException UserQueryResults)
+        -> RecvCallback
+      recvCob _ (Left ex) = Haxl.putFailure rvar (toException ex)
+      recvCob deserialize (Right response) =
+        case deserialize response of
+          Left err -> Haxl.putFailure rvar err
+          Right res -> putQueryResults q res acc rvar $
+            \(q :: Query q) acc -> runRemoteQuery evb sem repo q ts acc rvar
+
+    dispatchCommon
+      (\p c ct s r o x -> GleanService.send_userQuery p c ct s r o repo x)
+      (\x -> for_ x (const $ releaseSemaphore sem) >> sendCobSingle rvar x)
+      (\x y -> do
+        releaseSemaphore sem
+        recvCob (GleanService.recv_userQuery x) y)
+      req
+
+--------------------------------------------------------------------------------
+-- A simple STM semaphore used to limit the request concurrency
+
+data Semaphore = Semaphore
+  { acquireSemaphore :: IO ()
+  , releaseSemaphore :: IO ()}
+
+newSemaphore :: Int -> IO Semaphore
+newSemaphore size = do
+  s <- newTVarIO size
+  let acquireSemaphore = atomically $ do
+        v <- readTVar s
+        guard (v > 0)
+        writeTVar s $! v-1
+      releaseSemaphore = atomically $ modifyTVar s succ
+  return Semaphore{..}
+
+noSemaphore :: Semaphore
+noSemaphore = Semaphore (return ()) (return ())
diff --git a/glean/client/hs/Glean/Repo.hs b/glean/client/hs/Glean/Repo.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Repo.hs
@@ -0,0 +1,175 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Repo
+  ( -- * Listing repos
+    getLatestRepo
+  , getLatestRepos
+  , getRepo
+  , getRepos
+  , getSCMrevisions
+  , scmRevisionsOfDatabase
+  , LatestRepos(..)
+  , NoDatabase(..)
+  ) where
+
+import Control.Exception
+import Data.Function
+import Data.List
+import Data.List.Extra (groupSortOn)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as T
+
+import Util.Log
+
+import Glean.Repo.Text
+import Glean.Backend.Types
+import Glean.Types
+
+
+newtype NoDatabase = NoDatabase Text
+  deriving Show
+instance Control.Exception.Exception NoDatabase
+
+-- | Collecting 'getLatestRepo' for every available repo in the backend
+data LatestRepos = LatestRepos{
+  latestRepos :: !(Map Text Repo),  -- ^ Guaranteed available
+  allLatestRepos :: !(Map Text [Database]) -- ^ Possibly unavailable
+  }
+
+-- | Ask the server which databases are available, and return
+-- list of repo.
+getRepos
+  :: Backend be
+  => be
+  -> (Repo -> Bool)  -- ^ Predicate to choose repo
+  -> IO ([Database], [Database])
+getRepos backend pred = do
+  let
+    -- If we're connecting to a tier and using shards, then we can
+    -- assume that DBs in the Restoring state are usable, because
+    -- hopefully some other server will have the DB. The idea is
+    -- to get a consistent view of the available DBs even if we
+    -- happen to contact a server that has recently come up and is
+    -- still downloading DBs.
+
+    ok Database{..} =
+      (database_status == DatabaseStatus_Complete
+        || (usingShards backend &&
+           (database_status == DatabaseStatus_Restoring
+            || database_status == DatabaseStatus_Available))) &&
+      pred database_repo &&
+      isNothing database_expire_time
+  xss <- groupSortOn (repo_name . database_repo) . filter ok <$>
+    localDatabases backend
+  let pickRepo xs = do
+        let
+          sorted = sortBy (flip compare `on` database_created_since_epoch) xs
+        available <- maybeToList <$> checkRestorableAvailable backend sorted
+        return (available, sorted)
+  mconcat <$> mapM pickRepo xss
+
+
+-- | Ask the server which databases are available, and return the first one that
+-- matches the predicate.
+getRepo
+  :: Backend be
+  => be
+  -> (Repo -> Bool)  -- ^ Predicate to choose repo
+  -> IO (Maybe Repo)
+getRepo backend pred =
+  listToMaybe . map database_repo . fst <$> getRepos backend pred
+
+-- | Ask the server which databases are available, and select the
+-- latest complete database for all repo names selected by the predicate.
+getLatestRepos
+  :: Backend be
+  => be
+  -> (Text -> Bool)  -- ^ Predicate to choose repo names to include
+  -> IO LatestRepos
+getLatestRepos backend keepName = do
+  (latest, all) <- getRepos backend (keepName . repo_name)
+  let
+    avail = Map.fromList
+      [ (repo_name r, r) | d <- latest, let r = database_repo d ]
+    alldb = Map.fromListWith (++)
+      [ (repo_name (database_repo d), [d]) | d <- all]
+  return $ LatestRepos avail alldb
+
+-- | Ask the server which databases are available, and select the
+-- latest complete database for the given repo name.
+--
+-- Otherwise throw 'NoDatabase' exception
+getLatestRepo
+  :: Backend be
+  => be
+  -> Text  -- ^ The name of the repo, e.g. "fbsource"
+  -> IO Repo
+getLatestRepo backend name = do
+  lr <- getLatestRepos backend (name ==)
+  case Map.lookup name (latestRepos lr) of
+    Nothing -> throwIO $ NoDatabase $ "no database found for: " <> name
+    Just x -> return x
+
+-- | For each DB that is "restorable" on the host that returned the
+-- listDatabases result, check whether we can route to a host that has
+-- the DB. If not, we'll pick the next available DB in the list. This
+-- logic only kicks in when the service is a Tier and supports shards,
+-- otherwise we ignore restorable DBs when filtering above.
+--
+-- Otherwise return Nothing.
+checkRestorableAvailable
+  :: Backend be
+  => be
+  -> [Database]
+  -> IO (Maybe Database)
+checkRestorableAvailable _ [] = return Nothing
+checkRestorableAvailable backend (db@Database{..}:dbs)
+  | database_status `notElem`
+    [DatabaseStatus_Restoring, DatabaseStatus_Available] =
+    return (Just db)
+  | not (usingShards backend) =
+    checkRestorableAvailable backend dbs
+  | otherwise = do
+    let status = case database_status of
+          DatabaseStatus_Restoring -> "restoring"
+          DatabaseStatus_Available -> "available elsewhere"
+          _ -> error "unreachable"
+    vlog 1 $ "Repo " <> showRepo database_repo <>
+      " is " <> status <> ", checking for shard availability..."
+    avail <- hasDatabase backend database_repo
+    vlog 1 $ "Repo " <> showRepo database_repo <>
+       ": " <> (if avail then "some" else "no") <> " hosts have it"
+    if not avail
+      then checkRestorableAvailable backend dbs
+      else return (Just db)
+
+-- | Returns a mapping (SCM name -> SCM revision)
+--   of the SCM repositories indexed by the DB.
+--   Assumes that the DB includes SCM properties in the conventional format.
+getSCMrevisions :: Backend be => be -> Repo -> IO (HashMap Text Text)
+getSCMrevisions backend repo = do
+  GetDatabaseResult{getDatabaseResult_database = db} <- getDatabase backend repo
+  return $ scmRevisionsOfDatabase db
+
+-- | Extract a mapping (SCM name -> SCM revision) from the DB properties
+scmRevisionsOfDatabase :: Database -> HashMap Text Text
+scmRevisionsOfDatabase Database{..} =
+  HashMap.fromList
+    [ (scm_name, prop_value)
+    | (prop_name, prop_value) <- HashMap.toList database_properties
+    , Just scm_name <- [T.stripPrefix "glean.scm." prop_name]
+    -- Want to filter out values that are not SCM names,
+    -- but lack an exhaustive list of valid SCM names.
+    , scm_name `notElem` ["repo", "revision"]
+    ]
diff --git a/glean/client/hs/Glean/Util/ShellPrint.hs b/glean/client/hs/Glean/Util/ShellPrint.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Util/ShellPrint.hs
@@ -0,0 +1,441 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ConstraintKinds, UndecidableInstances #-}
+
+module Glean.Util.ShellPrint
+  ( DbVerbosity(..)
+  , StatsFormatOpts(..)
+  , ShellFormat(..)
+  , ShellPrint
+  , ShellPrintFormat(..)
+  , PrintOpts(..)
+  , getTerminalWidth
+  , hPutShellPrintLn
+  , putShellPrintLn
+  , shellFormatOpt
+  , shellPrint
+  , withFormatOpts
+  ) where
+
+import Prelude hiding ((<>))
+
+import Control.Monad
+import Data.Aeson
+import qualified Data.Aeson as J
+import qualified Data.Aeson.Encode.Pretty as J
+import qualified Data.ByteString.Lazy.Char8 as BS
+import Data.Char
+import Data.Int
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.HashMap.Strict as HashMap
+import Data.Time.Clock.POSIX
+import Data.List hiding (span)
+import Data.Void
+import Options.Applicative as O
+import Text.Printf hiding (parseFormat)
+import System.Exit
+import System.IO
+import System.Process
+import System.Timeout
+import Compat.Prettyprinter
+import Prettyprinter.Render.Terminal as Pretty
+import Util.Aeson
+import Util.Control.Exception (catchAll)
+import Util.TimeSec
+import Util.Timing
+
+import Glean.Backend.Types (dbShard)
+import qualified Glean.Types as Thrift
+import Glean.Repo.Text (showRepo)
+
+data ShellPrintFormat
+  = TTY
+  | PlainText
+  | Json
+  | CompactJson
+  deriving (Eq,Show)
+
+data Context = Context
+  { ctxFormat :: ShellPrintFormat
+  , ctxNow :: Time
+  }
+
+parseFormat :: String -> Maybe ShellPrintFormat
+parseFormat "tty" = Just TTY
+parseFormat "plain" = Just PlainText
+parseFormat "json" = Just Json
+parseFormat "compact-json" = Just CompactJson
+parseFormat _ = Nothing
+
+shellFormatOpt :: Parser (Maybe ShellPrintFormat)
+shellFormatOpt =
+  O.optional $ O.option (maybeReader parseFormat) $ mconcat
+    [ O.long "format"
+    , O.metavar "(tty|plain|json|compact-json)"
+    , O.help "Output format"
+    ]
+
+data PrintOpts = PrintOpts
+  { poFormat :: ShellPrintFormat
+  , poNow :: Time
+  , poWidth :: Maybe PageWidth
+  }
+
+type ShellPrint a = ShellFormat () a
+  -- we might prefer this to be "forall o . ShellFormat o a" but that
+  -- requires QuantifiedConstraints which isn't available until GHC 8.6.x
+  -- and we're keeping GHC 8.4.x compatibility for now.
+
+putShellPrintLn
+  :: ShellPrint a
+  => Maybe ShellPrintFormat -> a -> IO ()
+putShellPrintLn = hPutShellPrintLn stdout
+
+hPutShellPrintLn
+  :: ShellPrint a
+  => Handle
+  -> Maybe ShellPrintFormat
+  -> a
+  -> IO ()
+hPutShellPrintLn outh opt x = do
+  tty <- hIsTerminalDevice stdout
+  now <- utcTimeToPOSIXSeconds <$> getCurrentTime
+  width <- fromMaybe 80 <$> getTerminalWidth
+  let
+    t0 = Time (round now)
+    format = fromMaybe (if tty then TTY else PlainText) opt
+    opts = PrintOpts
+      { poFormat = format
+      , poNow = t0
+      , poWidth = Just $ AvailablePerLine width 1
+      }
+  shellPrint outh opts x
+
+shellPrint
+  :: forall a. ShellFormat () a
+  => Handle -> PrintOpts -> a -> IO ()
+shellPrint handle PrintOpts{..} x =
+  Pretty.renderIO handle sds
+  where
+    sds =
+      layoutPretty layout $ doc <> hardline
+    doc = case poFormat of
+      CompactJson ->
+        pretty $
+        BS.unpack $
+        J.encode $
+        shellFormatJson context () x
+      Json ->
+        pretty $
+        BS.unpack $
+        J.encodePretty $
+        shellFormatJson context () x
+      TTY ->
+        shellFormatText context () x
+      PlainText ->
+        unAnnotate $ shellFormatText context () x
+    context = Context
+      { ctxFormat = poFormat
+      , ctxNow = poNow
+      }
+    layout = LayoutOptions
+      { layoutPageWidth = fromMaybe Unbounded poWidth
+      }
+
+type Ann = AnsiStyle
+
+-- | Format data of type 'a' with format options of type 'o'
+class ShellFormat o a where
+    shellFormatText
+      :: Context -> o -> a -> Doc Ann
+    shellFormatJson
+      :: Context -> o -> a -> Value
+
+data WithFormatOpts o a = WithFormatOpts a o
+instance ShellFormat o a => ShellFormat d (WithFormatOpts o a) where
+  shellFormatText ctx _ (WithFormatOpts x opts) = shellFormatText ctx opts x
+  shellFormatJson ctx _ (WithFormatOpts x opts) = shellFormatJson ctx opts x
+
+withFormatOpts :: ShellFormat o a => a -> o -> WithFormatOpts o a
+withFormatOpts = WithFormatOpts
+
+instance ShellFormat o Void where
+  shellFormatText _ctx _ v = case v of {}
+  shellFormatJson _ctx _ v = case v of {}
+
+instance ShellFormat o String where
+  shellFormatText _ctx _ s = pretty s
+  shellFormatJson _ctx _ s = J.toJSON s
+
+instance ShellFormat o Thrift.DatabaseProperties where
+  shellFormatText _ctx _ props = vsep
+    [ pretty name <> ":" <+> pretty value
+    | (name,value) <- sortOn fst $
+        HashMap.toList props
+    ]
+  shellFormatJson _ctx _ props = J.toJSON props
+
+instance ShellFormat o Thrift.DatabaseStatus where
+  shellFormatText _ctx _ status =
+    case status of
+      Thrift.DatabaseStatus_Complete -> parens "complete"
+      Thrift.DatabaseStatus_Available -> parens "available elsewhere"
+      Thrift.DatabaseStatus_Finalizing -> parens "finalizing"
+      Thrift.DatabaseStatus_Incomplete -> parens "incomplete"
+      Thrift.DatabaseStatus_Restoring -> parens "restoring"
+      Thrift.DatabaseStatus_Broken -> parens "broken"
+      Thrift.DatabaseStatus_Restorable -> parens "restorable"
+      Thrift.DatabaseStatus_Missing -> parens "missing deps"
+  shellFormatJson _ctx _ status = J.toJSON @String $
+      case status of
+        Thrift.DatabaseStatus_Complete -> "COMPLETE"
+        Thrift.DatabaseStatus_Available-> "AVAILABLE"
+        Thrift.DatabaseStatus_Finalizing -> "FINALIZING"
+        Thrift.DatabaseStatus_Incomplete -> "INCOMPLETE"
+        Thrift.DatabaseStatus_Restoring -> "RESTORING"
+        Thrift.DatabaseStatus_Broken -> "BROKEN"
+        Thrift.DatabaseStatus_Restorable -> "RESTORABLE"
+        Thrift.DatabaseStatus_Missing -> "MISSING"
+
+instance ShellFormat o Thrift.Dependencies where
+  shellFormatText _ctx _ dependency =
+    case dependency of
+      Thrift.Dependencies_stacked Thrift.Stacked{..} ->
+        pretty (showRepo $ Thrift.Repo stacked_name stacked_hash)
+      Thrift.Dependencies_pruned (Thrift.Pruned baseRepo _ _ _)
+        -> pretty (showRepo baseRepo)
+  shellFormatJson _ctx _ dependency =
+    case dependency of
+      Thrift.Dependencies_stacked Thrift.Stacked{..} ->
+        J.toJSON (showRepo $ Thrift.Repo stacked_name stacked_hash)
+      Thrift.Dependencies_pruned (Thrift.Pruned baseRepo _ _ _)
+        -> J.toJSON (showRepo baseRepo)
+
+instance ShellFormat o Thrift.Repo where
+  shellFormatText _ctx _ repo = pretty (showRepo repo)
+  shellFormatJson _ctx _ repo = J.toJSON (showRepo repo)
+
+statusColour :: Thrift.DatabaseStatus -> Color
+statusColour status = case status of
+  Thrift.DatabaseStatus_Complete -> Green
+  Thrift.DatabaseStatus_Available -> Green
+  Thrift.DatabaseStatus_Finalizing -> Green
+  Thrift.DatabaseStatus_Incomplete -> Blue
+  Thrift.DatabaseStatus_Restoring -> Black
+  Thrift.DatabaseStatus_Broken -> Red
+  Thrift.DatabaseStatus_Restorable -> Black
+  Thrift.DatabaseStatus_Missing -> Black
+
+statusStyle :: Thrift.DatabaseStatus -> AnsiStyle
+statusStyle = color . statusColour
+
+data DbVerbosity
+  = DbSummarise
+  | DbDescribe
+  deriving (Eq)
+
+instance ShellFormat DbVerbosity Thrift.Database where
+  shellFormatText ctx opts db =
+    shellFormatText ctx opts (db, []::[(String, Void)])
+  shellFormatJson ctx opts db =
+    shellFormatJson ctx opts (db, []::[(String, Void)])
+
+instance (ShellFormat DbVerbosity v)
+  => ShellFormat DbVerbosity (Thrift.Database, [(String, v)]) where
+    shellFormatText ctx@Context{..} opts (db, extras) = nest 2 $ vsep $
+      [ annotate (statusStyle status) (shellFormatText ctx () repo)
+        <+> shellFormatText ctx () status]
+      ++
+      [ "Source:" <+> showWhen t
+      | Just t <- [Thrift.database_repo_hash_time db]
+      ]
+      ++
+      [ "Created:" <+> showWhen (Thrift.database_created_since_epoch db) ]
+      ++
+      [ "Completed:" <+> showWhen databaseComplete_time
+      | Just Thrift.DatabaseComplete{..} <- [Thrift.database_complete db]
+      ]
+      ++
+      [ "Size:" <+> pretty(showSizeBytes (fromIntegral s))
+      | Just Thrift.DatabaseComplete{..} <- [Thrift.database_complete db]
+      , Just s <- [databaseComplete_bytes]
+      ]
+      ++
+      [ "Broken:"
+          <+> (if Text.null task then emptyDoc else pretty task <> ": ")
+          <> pretty reason
+      | Just (Thrift.DatabaseBroken task reason) <- [Thrift.database_broken db]
+      ]
+      ++
+      [ pretty key <> ":" <+> shellFormatText ctx opts value
+      | (key, value) <- extras]
+      ++
+      [ "Dependencies:" <+> shellFormatText ctx () dependency
+      | Just dependency <- [Thrift.database_dependencies db]
+      ]
+      ++
+      [ "Backup:" <+> pretty loc
+      | verbosity == DbDescribe ||
+        Thrift.database_status db == Thrift.DatabaseStatus_Restorable
+      , Just loc <- [Thrift.database_location db]
+      ]
+      ++
+      [ "Expires in:" <+> pretty (ppTimeSpan timeSpan)
+      | verbosity == DbDescribe
+      , Just expiresEpochTime <-
+          [Thrift.unPosixEpochTime <$> Thrift.database_expire_time db]
+      , let expires = Time $ fromIntegral expiresEpochTime
+      , let timeSpan = expires `timeDiff` ctxNow
+      ]
+      ++
+      [ "Shard:" <+> pretty (dbShard repo)
+      | verbosity == DbDescribe
+      ]
+      ++
+      [ nest 2 $ vsep
+        [ "Properties:"
+        , shellFormatText ctx () (Thrift.database_properties db)
+        ]
+      | verbosity == DbDescribe
+      ]
+      where
+        showWhen (Thrift.PosixEpochTime t) =
+          pretty (show (posixSecondsToUTCTime (fromIntegral t))) <+>
+            parens (pretty (Text.unpack age) <+> "ago")
+          where
+            age = ppTimeSpanWithGranularity Hour $
+              ctxNow `timeDiff` Time (fromIntegral t)
+
+        showSizeBytes :: Double -> String
+        showSizeBytes b
+          | b > 1e9 = printf "%.2f GB" (b / 1e9)
+          | otherwise = printf "%.2f MB" (b / 1e6)
+
+        status = Thrift.database_status db
+        repo = Thrift.database_repo db
+        verbosity = opts
+    shellFormatJson ctx opts (db, extras) = J.object $
+      [ "repo" .= shellFormatJson ctx () repo
+      , "status" .= shellFormatJson ctx () status
+      , "created" .= jsonTime (Thrift.database_created_since_epoch db)
+      , "completed" .= jsonMaybeTime
+          (Thrift.databaseComplete_time <$> Thrift.database_complete db)
+      , "backup" .= maybe J.Null J.toJSON (Thrift.database_location db)
+      , "expires" .= jsonMaybeTime (Thrift.database_expire_time db)
+      , "shard" .= J.toJSON (dbShard $ Thrift.database_repo db)
+      , "source" .= maybe J.Null jsonTime (Thrift.database_repo_hash_time db)
+      , "properties" .= shellFormatJson ctx () (Thrift.database_properties db)
+      , "dependencies" .= maybe J.Null J.toJSON
+        (Thrift.database_dependencies db)
+      , "size" .= maybe J.Null J.toJSON
+          (Thrift.databaseComplete_bytes <$> Thrift.database_complete db)
+      ] ++
+      [ keyFromText (jsonKeyFrom key) .= shellFormatJson ctx opts value
+      | (key, value) <- extras]
+      where
+        status = Thrift.database_status db
+        repo = Thrift.database_repo db
+        jsonMaybeTime = maybe J.Null jsonTime
+        jsonTime (Thrift.PosixEpochTime t) =
+          J.toJSON $ posixSecondsToUTCTime (fromIntegral t)
+        jsonKeyFrom s = Text.pack $ map f s
+          where
+            f ' ' = '_'
+            f c = toLower c
+
+instance ShellFormat DbVerbosity [Thrift.Database] where
+  shellFormatText ctx opts dbs =
+    vsep $ concatMap f $ sortOn Thrift.database_created_since_epoch dbs
+    where f db = [shellFormatText ctx opts db, pretty ("    "::Text)]
+  shellFormatJson ctx v dbs = J.toJSON $ map (shellFormatJson ctx v) dbs
+
+instance (ShellFormat DbVerbosity v)
+  => ShellFormat DbVerbosity [(Thrift.Database, [(String, v)])] where
+    shellFormatText ctx opts dbs = vsep $ concatMap f $
+      sortOn (Thrift.database_created_since_epoch . fst) dbs
+      where f x = [shellFormatText ctx opts x, pretty ("    "::Text)]
+    shellFormatJson ctx v dbs = J.toJSON $ map (shellFormatJson ctx v) dbs
+
+type PredStatsList =
+  [(Either Thrift.Id Thrift.PredicateRef, Thrift.PredicateStats)]
+type PredStatsFilter =
+  Either Thrift.Id Thrift.PredicateRef -> Bool
+
+data StatsFormatOpts = StatsFormatOpts
+  { showTotal :: Bool
+  , sortBySize :: Bool
+  }
+  deriving (Eq)
+
+instance ShellFormat StatsFormatOpts (PredStatsFilter, PredStatsList) where
+    shellFormatText _context opts (filterPred, preds) = vsep $
+        [ nest 2 $ vsep
+            [ case ref of
+                Left id -> pretty id
+                Right pref -> pretty pref
+            , "count:" <+> pretty (Thrift.predicateStats_count stats)
+            , "size: " <+> pretty (getSizeInfo
+                (Thrift.predicateStats_size stats) totalSizeBytes)
+            ]
+        | (ref, stats) <- sort $ filter (filterPred . fst) preds
+        ] ++
+        if showTotal opts then
+          [ ""
+          , "Total: " <> pretty totalFacts
+              <+> "facts" <+> parens (pretty (showAllocs totalSizeBytes))
+          ]
+        else
+          []
+      where
+        predicate_count = Thrift.predicateStats_count . snd
+        predicate_size = Thrift.predicateStats_size . snd
+        totalFacts = foldl' (+) 0 $ map predicate_count preds
+        totalSizeBytes =
+          foldl' (+) 0 $ map predicate_size preds
+        sort = if sortBySize opts then
+          sortOn $ negate . predicate_size
+        else
+          sortOn fst
+
+    shellFormatJson _ _ (filterPred, preds) =
+      J.toJSON $ filter (filterPred . fst) preds
+
+getSizeInfo :: Int64 -> Int64 -> String
+getSizeInfo bytes total =
+  printf "%d (%s) %.4f%%" bytes humanReadableSize percentage_x
+    where
+      percentage_x :: Double
+      percentage_x = 100 * fromIntegral bytes / fromIntegral total
+      humanReadableSize = showAllocs bytes
+
+-- | Get the terminal width
+getTerminalWidth :: IO (Maybe Int)
+getTerminalWidth = fmap join $
+  -- FIXME: This is a terrible way to get the terminal size but we don't
+  -- seem to have any packages which can do this.
+  System.Timeout.timeout 100000
+    (withCreateProcess
+      (proc "stty" ["size"]){std_out = CreatePipe, std_err = CreatePipe}
+      (\_ mouth merrh ph -> do
+          let outh = fromMaybe (error "outh") mouth
+          let errh = fromMaybe (error "errh") merrh
+          out <- hGetContents outh
+          err <- hGetContents errh
+          length out `seq` length err `seq` return ()
+          hClose outh
+          hClose errh
+          ex <- waitForProcess ph
+          return $ case ex of
+            ExitSuccess
+              | [[(_,"")],[(w,"")]] <- map reads $ words out -> Just w
+            _ -> Nothing
+      ))
+  `catchAll` \_ -> return Nothing
diff --git a/glean/client/hs/Glean/Write.hs b/glean/client/hs/Glean/Write.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/Glean/Write.hs
@@ -0,0 +1,123 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TemplateHaskell, QuasiQuotes, DeriveGeneric #-}
+-- | Utilities for writing data to Glean
+module Glean.Write
+  ( fileToBatches
+  , parseRef
+  , parseJsonFactBatches
+  ,schemaIdToOpts) where
+
+import Control.Exception (ErrorCall(ErrorCall), throwIO)
+import Control.Monad.Extra
+import Data.Aeson
+import qualified Data.Aeson.Types as Aeson
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Lazy.Char8 as LB
+import Data.Maybe
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Vector as Vector
+import Foreign(Ptr)
+import Foreign.C(CString, CChar, CLong(..))
+
+import Mangle.TH
+import Foreign.CPP.Dynamic (Dynamic, callJSONParserFFI)
+import Util.String.Quasi
+
+import Glean.Types hiding (Value)
+import Glean.Schema.Util
+import System.FilePath (takeExtension)
+import qualified System.Process.ByteString as BS
+import System.Exit (ExitCode(ExitSuccess))
+import Control.Applicative ((<|>))
+import Data.Either (partitionEithers)
+
+$(mangle
+  [s|
+    folly::dynamic* facebook::glean::cpp::parseJSONFacts(
+        const char*, int64_t, char **)
+  |] [d|
+    foreign import ccall safe c_parseJsonFacts
+      :: CString -> CLong -> Ptr (Ptr CChar) -> IO (Ptr Dynamic)
+  |])
+
+newtype ParseJsonFactBatchForWriteServer = ParseJsonFactBatchForWriteServer
+  {getBatch :: JsonItem}
+instance FromJSON ParseJsonFactBatchForWriteServer where
+  parseJSON =
+    fmap ParseJsonFactBatchForWriteServer <$>
+      parseJsonFactBatchGen (withText "fact" $ return . Text.encodeUtf8)
+
+fileToBatches :: FilePath -> IO ([JsonFactBatch], Maybe SchemaId)
+fileToBatches file = do
+  bs <- if takeExtension file == ".zst" then do
+    (exit, bs, err) <- BS.readProcessWithExitCode "zstd" [file,"-d","-c"] ""
+    when (exit /= ExitSuccess) $
+      throwIO $ ErrorCall $ file ++ ": " ++ show err
+    return bs
+    else B.readFile file
+  r <- Foreign.CPP.Dynamic.callJSONParserFFI c_parseJsonFacts bs
+  case r of
+    Right val -> case Aeson.parse parseJSON val of
+      Aeson.Error str -> throwIO $ ErrorCall $ file ++ ": " ++ str
+      Aeson.Success x -> return $ jsonItemsToPair $ map getBatch x
+    Left err -> throwIO $ ErrorCall $ file ++ ": " ++ Text.unpack err
+
+parsePredicate :: Value -> Aeson.Parser PredicateRef
+parsePredicate = withText "predicate" $ \txt -> do
+  let SourceRef pred mbVersion = parseRef txt
+  return (PredicateRef pred (fromMaybe 1 mbVersion))
+
+parsePredicateRef :: Value -> Aeson.Parser PredicateRef
+parsePredicateRef = withObject "predicate ref" $ \obj ->
+  PredicateRef
+    <$> obj .: "name"
+    <*> obj .: "version"
+
+parseFact :: Value -> Aeson.Parser ByteString
+parseFact = withObject "fact" $ \obj -> return (LB.toStrict (encode obj))
+
+-- | Given a fact parser, returns a 'JsonFactBatch' parser
+parseJsonFactBatchGen
+  :: (Value -> Aeson.Parser Json) -> Value -> Aeson.Parser JsonItem
+parseJsonFactBatchGen parseFact = withObject "JsonFactBatch" $ \v ->
+  fmap JsonItemBatch (JsonFactBatch
+    <$> Aeson.explicitParseField parsePred v "predicate"
+    <*> Aeson.explicitParseField parseFacts v "facts"
+    <*> fmap (fmap Text.encodeUtf8) (v .:? "unit"))
+  <|>
+  (JsonItemSchemaId
+    <$> fmap SchemaId (v .: "schema_id"))
+  where
+    parsePred v = parsePredicate v `mplus` parsePredicateRef v
+    parseFacts = withArray "facts" (mapM parseFact . Vector.toList)
+
+-- | Parser that expects facts to be JSON objects
+parseJsonFactBatches :: Value -> Aeson.Parser ([JsonFactBatch], Maybe SchemaId)
+parseJsonFactBatches = withArray "JsonFactBatch" $ \vec ->
+  jsonItemsToPair <$> mapM (parseJsonFactBatchGen parseFact) (Vector.toList vec)
+
+data JsonItem = JsonItemBatch JsonFactBatch | JsonItemSchemaId SchemaId
+
+jsonItemsToPair :: [JsonItem] -> ([JsonFactBatch], Maybe SchemaId)
+jsonItemsToPair items = (batches, listToMaybe schemas)
+ where
+  (batches, schemas) = partitionEithers (map toEither items)
+  toEither (JsonItemBatch item) = Left item
+  toEither (JsonItemSchemaId schema_id) = Right schema_id
+
+schemaIdToOpts :: Maybe SchemaId -> Maybe SendJsonBatchOptions
+schemaIdToOpts schema_id = case schema_id of
+  Nothing -> Nothing
+  Just s -> Just SendJsonBatchOptions {
+      sendJsonBatchOptions_schema_id = Just s,
+      sendJsonBatchOptions_no_base64_binary = False
+    }
diff --git a/glean/client/hs/cpp/write.cpp b/glean/client/hs/cpp/write.cpp
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/cpp/write.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <folly/json/dynamic.h>
+#include <folly/json/json.h>
+
+namespace facebook::glean::cpp {
+
+folly::dynamic*
+parseJSONFacts(const char* str, int64_t len, char** err) noexcept {
+  folly::json::serialization_opts opts;
+
+  // folly's default recursion limit is 100, which is not enough for us.
+  opts.recursion_limit = 500;
+
+  try {
+    auto parsedJson = parseJson(folly::StringPiece(str, len), opts);
+
+    // The contents is expected to be a list of objects with either "schema_id"
+    // or {"predicate", "facts"}
+    // We render each fact object into a String as expected by the Write server
+    for (auto& obj : parsedJson) {
+      if (obj.find("schema_id") != obj.items().end()) {
+        continue;
+      }
+      for (auto& fact : obj["facts"]) {
+        fact = toJson(fact);
+      }
+    }
+
+    return new folly::dynamic(std::move(parsedJson));
+
+  } catch (const std::exception& e) {
+    *err = strdup(e.what());
+    return nullptr;
+  }
+}
+
+} // namespace facebook::glean::cpp
diff --git a/glean/client/hs/local/Glean/LocalOrRemote.hs b/glean/client/hs/local/Glean/LocalOrRemote.hs
new file mode 100644
--- /dev/null
+++ b/glean/client/hs/local/Glean/LocalOrRemote.hs
@@ -0,0 +1,274 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+--
+-- | Connecting to a Glean server or a local database store.
+--
+-- Client code that wants to be able to use either a remote
+-- Glean server or a local database store should look like:
+--
+-- > import Glean
+-- > import Glean.LocalOrRemote
+-- > import Glean.Util.ConfigProvider
+-- > import Glean.Impl.ConfigProvider
+-- > import Glean.Schema.Builtin.Types (schema_id)
+-- > import Util.EventBase
+-- >
+-- > main :: IO ()
+-- > main =
+-- >   withConfigOptions options $ \(service, cfgOpts) ->
+-- >   withEventBaseDataplane $ \evb ->
+-- >   withConfigProvider cfgOpts $ \(cfgAPI :: ConfigAPI) ->
+-- >   withBackendWithDefaultOptions evb cfgAPI service (Just schema_id)
+-- >       $ \backend -> do
+-- >     ...
+--
+module Glean.LocalOrRemote
+  (
+    -- * Connecting to a remote server or a local database store
+    options
+  , optionsLong
+  , withBackendWithDefaultOptions
+  , withBackend
+  , defaultClientConfigSource
+  , Service(..)
+  , Logging(..)
+  , LocalOrRemote(..)
+  , LoggingBackend(..)
+  , BackendKind(..)
+
+  -- * Misc
+  , validate
+  , Validate(..)
+  , dumpJsonToFile
+  , finalize
+  , sendJsonBatch
+
+    -- * Schemas
+  , loadDbSchema
+  , serializeInventory
+  ) where
+
+import Control.Monad.Extra
+import qualified Data.ByteString.Char8 as BC
+import Data.Default
+import Data.IORef
+import Options.Applicative as O
+import System.IO
+import Text.Printf
+
+import Util.EventBase
+
+import Glean hiding (finalize, sendJsonBatch)
+  -- we will provide versions of finalize and sendJsonBatch that are
+  -- more efficient with local DBs.
+import qualified Glean
+import Glean.Backend.Local hiding (options)
+import qualified Glean.Backend.Local as Local
+import Glean.Backend.Logging
+import Glean.DefaultConfigs
+import Glean.Dump
+import Glean.Database.Validate
+import Glean.Database.Finish (finalizeWait)
+import qualified Glean.Remote as Remote
+import Glean.Util.ConfigProvider
+import Glean.Util.Some
+import qualified Glean.Util.ThriftSource as ThriftSource
+import Glean.Write.JSON (syncWriteJsonBatch)
+
+
+data Logging = EnableLogging | DisableLogging
+  deriving (Eq, Show)
+
+-- | Specifies what kind of 'Backend' to construct.
+data Service
+  = Local Local.Config Logging
+  | Remote (ThriftSource ClientConfig)
+  deriving Show
+
+-- | Use the provided 'Service' to make a 'Backend'.  (note in fact
+-- that it provides a 'LocalOrRemote', which is a 'Backend' that
+-- additionally supports 'backendKind').
+withBackendWithDefaultOptions
+  :: ConfigProvider conf
+  => EventBaseDataplane
+  -> conf
+  -> Service
+  -> Maybe SchemaId
+  -> (forall b. LocalOrRemote b => b -> IO a)
+  -> IO a
+withBackendWithDefaultOptions evb cfgapi service schema =
+  withBackend evb cfgapi service schema id
+
+-- | Use the provided 'Service' to make a 'Backend', applying some
+-- 'Settings' if this is a remote backend. (note in fact that it
+-- provides a 'LocalOrRemote', which is a 'Backend' that additionally
+-- supports 'backendKind').
+withBackend
+  :: ConfigProvider conf
+  => EventBaseDataplane
+  -> conf
+  -> Service
+  -> Maybe SchemaId
+  -> Remote.Settings
+  -> (forall b. LocalOrRemote b => b -> IO a)
+  -> IO a
+withBackend evb cfgapi service schema settings inner = case service of
+  Local cfg logging ->
+    let cfg' = cfg { cfgSchemaId = schema } in
+    withDatabases evb cfg' cfgapi $
+      case logging of
+        EnableLogging -> inner . LoggingBackend
+        DisableLogging -> inner
+  Remote src -> do
+    config <- ThriftSource.loadDefault cfgapi src
+    let (config', opts) = settings (config, def)
+    client <- Remote.clientInfo
+    inner $ Remote.ThriftBackend
+      config'
+      evb
+      (Remote.thriftServiceWithTimeout config' opts)
+      client
+      schema
+
+-- | Command-line options to specify a 'Service' that we can connect to.
+-- The 'Service' is either a remote Glean server (e.g. @--service=<host>:port@)
+-- or a local database store (e.g. @--db-root=<dir>@).
+options :: O.Parser Service
+options = optionsLong "service"
+
+optionsLong :: String -> O.Parser Service
+optionsLong self =
+  Remote <$> Remote.optionsLong self <|>
+  Local <$> Local.options <*> logging
+  where
+    logging = (\b -> if b then EnableLogging else DisableLogging) <$> O.switch
+      (  O.long "enable-logging"
+      <> O.help "Log requests to Scuba/Hive/..."
+      )
+
+-- -----------------------------------------------------------------------------
+-- Backends that might be local or remote
+
+
+data BackendKind
+  = BackendEnv Local.Env
+  | BackendThrift Remote.ThriftBackend
+
+displayBackendKind :: BackendKind -> String
+displayBackendKind BackendEnv{} = "BackendKind BackendEnv {_ :: Local.Env}"
+displayBackendKind (BackendThrift tb) = unwords
+  [ "BackendKind BackendThrift {", show tb, "}" ]
+
+instance Show BackendKind where
+  show = displayBackendKind
+
+-- | Sometimes we need to do something backend-specific, so we need to
+-- get back from the abstract 'Backend' to the concrete underlying
+-- representation.  A 'LocalOrRemote' is a 'Backend' that additionally
+-- supports 'backendKind' to find its 'BackendKind'.
+--
+-- We don't want this to be part of the 'Backend' class, because there
+-- are clients that only want to use a remote 'Backend' but nevertheless
+-- want to use the 'Backend' abstraction, because many of the other
+-- APIs depend on it.  If 'backendKind' were part of 'Backend', then
+-- remote-only clients would depend on support for local DBs too.
+class Backend a => LocalOrRemote a where
+  backendKind :: a -> BackendKind
+
+instance LocalOrRemote LoggingBackend where
+  backendKind (LoggingBackend env) = BackendEnv env
+
+instance LocalOrRemote Local.Env where
+  backendKind env = BackendEnv env
+
+instance LocalOrRemote Remote.ThriftBackend where
+  backendKind t = BackendThrift t
+
+instance Backend (Some LocalOrRemote) where
+  queryFact (Some backend) = queryFact backend
+  factIdRange (Some backend) = factIdRange backend
+  getSchemaInfo (Some backend) = getSchemaInfo backend
+  validateSchema (Some backend) = validateSchema backend
+  predicateStats (Some backend) = predicateStats backend
+  listDatabases (Some backend) = listDatabases backend
+  getDatabase (Some backend) = getDatabase backend
+  userQueryFacts (Some backend) = userQueryFacts backend
+  userQuery (Some backend) = userQuery backend
+  userQueryBatch (Some backend) = userQueryBatch backend
+  deriveStored (Some backend) = deriveStored backend
+
+  kickOffDatabase (Some backend) = kickOffDatabase backend
+  finishDatabase (Some backend) = finishDatabase backend
+  finalizeDatabase (Some backend) = finalizeDatabase backend
+  updateProperties (Some backend) = updateProperties backend
+  completePredicates_ (Some backend) = completePredicates_ backend
+
+  restoreDatabase (Some backend) = restoreDatabase backend
+  deleteDatabase (Some backend) = deleteDatabase backend
+
+  enqueueBatch (Some backend) = enqueueBatch backend
+  enqueueJsonBatch (Some backend) = enqueueJsonBatch backend
+  enqueueBatchDescriptor (Some backend) = enqueueBatchDescriptor backend
+  pollBatch (Some backend) = pollBatch backend
+  displayBackend (Some backend) = displayBackend backend
+  hasDatabase (Some backend) = hasDatabase backend
+  schemaId (Some backend) = schemaId backend
+  usingShards (Some backend) = usingShards backend
+  initGlobalState (Some backend) = initGlobalState backend
+
+instance LocalOrRemote (Some LocalOrRemote) where
+  backendKind (Some b) = backendKind b
+
+
+-- | Write facts to a file in JSON format suitable for parsing using
+-- 'parseJsonFactBatches'.
+--
+dumpJsonToFile
+  :: Backend b
+  => b
+  -> Glean.Repo
+  -> FilePath
+  -> IO ()
+dumpJsonToFile backend repo file =
+  withFile file WriteMode $ \hdl -> do
+    notFirst <- newIORef False
+    hPutStrLn hdl "["
+    dump backend repo (withBatch hdl notFirst)
+    hPutStrLn hdl "]"
+  where
+    withBatch hdl notFirst Glean.JsonFactBatch{..} = do
+      whenM (readIORef notFirst) $ hPutStr hdl ","
+      writeIORef notFirst True
+      let Glean.PredicateRef{..} = jsonFactBatch_predicate
+      hPrintf hdl "{ \"predicate\": \"%s.%d\", \"facts\": [\n"
+        predicateRef_name predicateRef_version
+      BC.hPutStrLn hdl (BC.intercalate ",\n" jsonFactBatch_facts)
+      hPutStrLn hdl "]}"
+
+finalize :: LocalOrRemote backend => backend -> Glean.Repo -> IO ()
+finalize backend repo =
+  case backendKind backend of
+    -- finalizeWait is faster than polling if we have local DBs.
+    BackendEnv env -> finalizeWait env repo
+    _ -> Glean.finalize backend repo
+
+-- | Version of sendJsonBatch that uses a synchronous write rather
+-- than polling when we're using a local backend.
+sendJsonBatch
+  :: LocalOrRemote be
+  => be
+  -> Glean.Repo
+  -> [Glean.JsonFactBatch]
+  -> Maybe Glean.SendJsonBatchOptions
+  -> IO ()
+sendJsonBatch backend repo batches opts = do
+  case backendKind backend of
+    -- syncWriteJsonBatch is faster than polling if we have local DBs.
+    BackendEnv env -> syncWriteJsonBatch env repo batches opts
+    _ -> void $ Glean.sendJsonBatch backend repo batches opts
diff --git a/glean/config/client/gen-hs2/Glean/ClientConfig/Types.hs b/glean/config/client/gen-hs2/Glean/ClientConfig/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/config/client/gen-hs2/Glean/ClientConfig/Types.hs
@@ -0,0 +1,255 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.ClientConfig.Types
+       (UseShards(NO_SHARDS, USE_SHARDS, USE_SHARDS_AND_FALLBACK),
+        ClientConfig(ClientConfig, clientConfig_serv,
+                     clientConfig_use_shards, clientConfig_min_db_age,
+                     clientConfig_host_timeout_ms, clientConfig_max_batch_size))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified GHC.Magic as GHC
+import qualified Glean.Service.Types as Glean.Service
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+data UseShards = NO_SHARDS
+               | USE_SHARDS
+               | USE_SHARDS_AND_FALLBACK
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UseShards where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData UseShards where
+  rnf __UseShards = Prelude.seq __UseShards ()
+
+instance Default.Default UseShards where
+  def = NO_SHARDS
+
+instance Hashable.Hashable UseShards where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum UseShards where
+  toThriftEnum 0 = NO_SHARDS
+  toThriftEnum 1 = USE_SHARDS
+  toThriftEnum 2 = USE_SHARDS_AND_FALLBACK
+  toThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("toThriftEnum: not a valid identifier for enum UseShards: " ++
+              Prelude.show _val))
+  fromThriftEnum NO_SHARDS = 0
+  fromThriftEnum USE_SHARDS = 1
+  fromThriftEnum USE_SHARDS_AND_FALLBACK = 2
+  fromThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("fromThriftEnum: not a valid identifier for enum UseShards: " ++
+              Prelude.show _val))
+  allThriftEnumValues
+    = [NO_SHARDS, USE_SHARDS, USE_SHARDS_AND_FALLBACK]
+  toThriftEnumEither 0 = Prelude.Right NO_SHARDS
+  toThriftEnumEither 1 = Prelude.Right USE_SHARDS
+  toThriftEnumEither 2 = Prelude.Right USE_SHARDS_AND_FALLBACK
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum UseShards: "
+           ++ Prelude.show val)
+
+data ClientConfig = ClientConfig{clientConfig_serv ::
+                                 Glean.Service.Service,
+                                 clientConfig_use_shards :: UseShards,
+                                 clientConfig_min_db_age :: Int.Int32,
+                                 clientConfig_host_timeout_ms :: Int.Int32,
+                                 clientConfig_max_batch_size :: Int.Int32}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClientConfig where
+  toJSON
+    (ClientConfig __field__serv __field__use_shards __field__min_db_age
+       __field__host_timeout_ms __field__max_batch_size)
+    = Aeson.object
+        ("serv" .= __field__serv :
+           "use_shards" .= __field__use_shards :
+             "min_db_age" .= __field__min_db_age :
+               "host_timeout_ms" .= __field__host_timeout_ms :
+                 "max_batch_size" .= __field__max_batch_size : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClientConfig where
+  buildStruct _proxy
+    (ClientConfig __field__serv __field__use_shards __field__min_db_age
+       __field__host_timeout_ms __field__max_batch_size)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "serv" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__serv)
+           :
+           Thrift.genField _proxy "use_shards" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__use_shards)
+             :
+             Thrift.genFieldPrim _proxy "min_db_age" (Thrift.getI32Type _proxy)
+               3
+               2
+               (Thrift.genI32Prim _proxy)
+               __field__min_db_age
+               :
+               Thrift.genFieldPrim _proxy "host_timeout_ms"
+                 (Thrift.getI32Type _proxy)
+                 4
+                 3
+                 (Thrift.genI32Prim _proxy)
+                 __field__host_timeout_ms
+                 :
+                 Thrift.genFieldPrim _proxy "max_batch_size"
+                   (Thrift.getI32Type _proxy)
+                   5
+                   4
+                   (Thrift.genI32Prim _proxy)
+                   __field__max_batch_size
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__serv <- ST.newSTRef
+                               (Glean.Service.Service_tier "glean.query.prod")
+            __field__use_shards <- ST.newSTRef USE_SHARDS_AND_FALLBACK
+            __field__min_db_age <- ST.newSTRef 1800
+            __field__host_timeout_ms <- ST.newSTRef 30000
+            __field__max_batch_size <- ST.newSTRef 1
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__serv
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnumNoUnknown
+                                                                                      _proxy
+                                                                                      "UseShards")
+                                                                        ST.writeSTRef
+                                                                          __field__use_shards
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__min_db_age
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__host_timeout_ms
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_batch_size
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__serv <- ST.readSTRef __field__serv
+                                             !__val__use_shards <- ST.readSTRef __field__use_shards
+                                             !__val__min_db_age <- ST.readSTRef __field__min_db_age
+                                             !__val__host_timeout_ms <- ST.readSTRef
+                                                                          __field__host_timeout_ms
+                                             !__val__max_batch_size <- ST.readSTRef
+                                                                         __field__max_batch_size
+                                             Prelude.pure
+                                               (ClientConfig __val__serv __val__use_shards
+                                                  __val__min_db_age
+                                                  __val__host_timeout_ms
+                                                  __val__max_batch_size)
+              _idMap
+                = HashMap.fromList
+                    [("serv", 1), ("use_shards", 2), ("min_db_age", 3),
+                     ("host_timeout_ms", 4), ("max_batch_size", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData ClientConfig where
+  rnf
+    (ClientConfig __field__serv __field__use_shards __field__min_db_age
+       __field__host_timeout_ms __field__max_batch_size)
+    = DeepSeq.rnf __field__serv `Prelude.seq`
+        DeepSeq.rnf __field__use_shards `Prelude.seq`
+          DeepSeq.rnf __field__min_db_age `Prelude.seq`
+            DeepSeq.rnf __field__host_timeout_ms `Prelude.seq`
+              DeepSeq.rnf __field__max_batch_size `Prelude.seq` ()
+
+instance Default.Default ClientConfig where
+  def
+    = ClientConfig (Glean.Service.Service_tier "glean.query.prod")
+        USE_SHARDS_AND_FALLBACK
+        1800
+        30000
+        1
+
+instance Hashable.Hashable ClientConfig where
+  hashWithSalt __salt
+    (ClientConfig _serv _use_shards _min_db_age _host_timeout_ms
+       _max_batch_size)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _serv)
+                 _use_shards)
+              _min_db_age)
+           _host_timeout_ms)
+        _max_batch_size
diff --git a/glean/config/gen-hs2/Glean/Service/Types.hs b/glean/config/gen-hs2/Glean/Service/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/config/gen-hs2/Glean/Service/Types.hs
@@ -0,0 +1,163 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Service.Types
+       (HostPort(HostPort, hostPort_host, hostPort_port),
+        Service(Service_tier, Service_hostPort))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+data HostPort = HostPort{hostPort_host :: Text.Text,
+                         hostPort_port :: Int.Int32}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HostPort where
+  toJSON (HostPort __field__host __field__port)
+    = Aeson.object
+        ("host" .= __field__host :
+           "port" .= __field__port : Prelude.mempty)
+
+instance Thrift.ThriftStruct HostPort where
+  buildStruct _proxy (HostPort __field__host __field__port)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "host" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__host)
+           :
+           Thrift.genFieldPrim _proxy "port" (Thrift.getI32Type _proxy) 2 1
+             (Thrift.genI32Prim _proxy)
+             __field__port
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__host <- ST.newSTRef ""
+            __field__port <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__host
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__port
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__host <- ST.readSTRef __field__host
+                                             !__val__port <- ST.readSTRef __field__port
+                                             Prelude.pure (HostPort __val__host __val__port)
+              _idMap = HashMap.fromList [("host", 1), ("port", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HostPort where
+  rnf (HostPort __field__host __field__port)
+    = DeepSeq.rnf __field__host `Prelude.seq`
+        DeepSeq.rnf __field__port `Prelude.seq` ()
+
+instance Default.Default HostPort where
+  def = HostPort "" Default.def
+
+instance Hashable.Hashable HostPort where
+  hashWithSalt __salt (HostPort _host _port)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _host) _port
+
+data Service = Service_tier Text.Text
+             | Service_hostPort HostPort
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Service where
+  toJSON (Service_tier __tier) = Aeson.object ["tier" .= __tier]
+  toJSON (Service_hostPort __hostPort)
+    = Aeson.object ["hostPort" .= __hostPort]
+
+instance Thrift.ThriftStruct Service where
+  buildStruct _proxy (Service_tier __tier)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tier" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __tier)]
+  buildStruct _proxy (Service_hostPort __hostPort)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "hostPort" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __hostPort)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Service_tier _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Service_hostPort _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'Service': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'Service' is empty"
+    where
+      _idMap = HashMap.fromList [("tier", 1), ("hostPort", 2)]
+
+instance DeepSeq.NFData Service where
+  rnf (Service_tier __tier) = DeepSeq.rnf __tier
+  rnf (Service_hostPort __hostPort) = DeepSeq.rnf __hostPort
+
+instance Default.Default Service where
+  def = Service_tier ""
+
+instance Hashable.Hashable Service where
+  hashWithSalt __salt (Service_tier _tier)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _tier)
+  hashWithSalt __salt (Service_hostPort _hostPort)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _hostPort)
diff --git a/glean/config/server/gen-hs2/Glean/ServerConfig/Types.hs b/glean/config/server/gen-hs2/Glean/ServerConfig/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/config/server/gen-hs2/Glean/ServerConfig/Types.hs
@@ -0,0 +1,2746 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.ServerConfig.Types
+       (RepoName, Seconds, DBVersion(DBVersion, unDBVersion), Properties,
+        Retention(Retention, retention_delete_if_older,
+                  retention_delete_incomplete_if_older, retention_retain_at_least,
+                  retention_retain_at_most, retention_expire_delay,
+                  retention_required_properties, retention_keep_open,
+                  retention_excluded_properties),
+        DatabaseRetentionPolicy(DatabaseRetentionPolicy,
+                                databaseRetentionPolicy_default_retention,
+                                databaseRetentionPolicy_by_repo, databaseRetentionPolicy_repos),
+        DatabaseRestorePolicy(DatabaseRestorePolicy,
+                              databaseRestorePolicy_enabled, databaseRestorePolicy_override),
+        DatabaseClosePolicy(DatabaseClosePolicy,
+                            databaseClosePolicy_close_after),
+        Backup(Backup, backup_location, backup_delete_after_seconds),
+        DatabaseBackupPolicy(DatabaseBackupPolicy,
+                             databaseBackupPolicy_allowed, databaseBackupPolicy_location,
+                             databaseBackupPolicy_repos),
+        StaticShardsPolicy(StaticShardsPolicy, staticShardsPolicy_shards),
+        NoShardsPolicy(NoShardsPolicy),
+        ShardManagerPolicy(ShardManagerPolicy, shardManagerPolicy_nshards,
+                           shardManagerPolicy_service_name,
+                           shardManagerPolicy_default_domain_id),
+        ShardManagerMostRecentPolicy(ShardManagerMostRecentPolicy,
+                                     shardManagerMostRecentPolicy_shard_manager_policy,
+                                     shardManagerMostRecentPolicy_most_recent_domain_id),
+        ShardingPolicy(ShardingPolicy_EMPTY,
+                       ShardingPolicy_static_assignment, ShardingPolicy_no_shards,
+                       ShardingPolicy_shard_manager,
+                       ShardingPolicy_shard_manager_most_recent),
+        SchemaLocation(SchemaLocation_EMPTY, SchemaLocation_dir,
+                       SchemaLocation_file, SchemaLocation_index, SchemaLocation_config,
+                       SchemaLocation_indexconfig),
+        Config(Config, config_retention, config_restore, config_close,
+               config_backup, config_janitor_period,
+               config_backup_list_sync_period, config_default_max_results,
+               config_default_max_bytes, config_default_max_time_ms,
+               config_query_alloc_limit, config_logging_rate_limit,
+               config_db_writes_keep, config_db_writes_reap,
+               config_db_writer_threads, config_db_write_queue_limit_mb,
+               config_db_ptail_checkpoint_bytes,
+               config_db_ptail_checkpoint_enabled, config_db_rocksdb_cache_mb,
+               config_db_lookup_cache_limit_mb, config_db_create_version,
+               config_disable_predicate_dependency_checks,
+               config_compact_on_completion, config_enable_schema_evolution,
+               config_min_db_age, config_sharding, config_use_schema_id,
+               config_db_rocksdb_cache_index_and_filter_blocks,
+               config_strict_query_schema_id, config_use_manifold_cli,
+               config_max_remote_db_list_age, config_restore_timeout,
+               config_max_set_size_bytes, config_check_write_schema_id,
+               config_schema_location),
+        Set_RepoName_8170)
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Set as Set
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+type RepoName = Text.Text
+
+type Seconds = Int.Int64
+
+newtype DBVersion = DBVersion{unDBVersion :: Int.Int64}
+                    deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable DBVersion where
+  hashWithSalt __salt (DBVersion __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON DBVersion where
+  toJSON (DBVersion __val) = Aeson.toJSON __val
+
+type Properties = HashMap.HashMap Text.Text Text.Text
+
+data Retention = Retention{retention_delete_if_older ::
+                           Prelude.Maybe Seconds,
+                           retention_delete_incomplete_if_older :: Prelude.Maybe Seconds,
+                           retention_retain_at_least :: Prelude.Maybe Int.Int32,
+                           retention_retain_at_most :: Prelude.Maybe Int.Int32,
+                           retention_expire_delay :: Prelude.Maybe Int.Int32,
+                           retention_required_properties :: Properties,
+                           retention_keep_open :: Prelude.Bool,
+                           retention_excluded_properties :: Properties}
+                 deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Retention where
+  toJSON
+    (Retention __field__delete_if_older
+       __field__delete_incomplete_if_older __field__retain_at_least
+       __field__retain_at_most __field__expire_delay
+       __field__required_properties __field__keep_open
+       __field__excluded_properties)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("delete_if_older" .=))
+           __field__delete_if_older
+           (Prelude.maybe Prelude.id ((:) . ("delete_incomplete_if_older" .=))
+              __field__delete_incomplete_if_older
+              (Prelude.maybe Prelude.id ((:) . ("retain_at_least" .=))
+                 __field__retain_at_least
+                 (Prelude.maybe Prelude.id ((:) . ("retain_at_most" .=))
+                    __field__retain_at_most
+                    (Prelude.maybe Prelude.id ((:) . ("expire_delay" .=))
+                       __field__expire_delay
+                       ("required_properties" .= __field__required_properties :
+                          "keep_open" .= __field__keep_open :
+                            "excluded_properties" .= __field__excluded_properties :
+                              Prelude.mempty))))))
+
+instance Thrift.ThriftStruct Retention where
+  buildStruct _proxy
+    (Retention __field__delete_if_older
+       __field__delete_incomplete_if_older __field__retain_at_least
+       __field__retain_at_most __field__expire_delay
+       __field__required_properties __field__keep_open
+       __field__excluded_properties)
+    = Thrift.genStruct _proxy
+        (let (__cereal__delete_if_older, __id__delete_if_older)
+               = case __field__delete_if_older of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "delete_if_older"
+                                              (Thrift.getI64Type _proxy)
+                                              1
+                                              0
+                                              (Thrift.genI64 _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__delete_if_older
+             (let (__cereal__delete_incomplete_if_older,
+                   __id__delete_incomplete_if_older)
+                    = case __field__delete_incomplete_if_older of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genField _proxy "delete_incomplete_if_older"
+                                                   (Thrift.getI64Type _proxy)
+                                                   5
+                                                   __id__delete_if_older
+                                                   (Thrift.genI64 _proxy _val)),
+                                              5)
+                        Prelude.Nothing -> (Prelude.id, __id__delete_if_older)
+                in
+                __cereal__delete_incomplete_if_older
+                  (let (__cereal__retain_at_least, __id__retain_at_least)
+                         = case __field__retain_at_least of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genFieldPrim _proxy "retain_at_least"
+                                                        (Thrift.getI32Type _proxy)
+                                                        2
+                                                        __id__delete_incomplete_if_older
+                                                        (Thrift.genI32Prim _proxy)
+                                                        _val),
+                                                   2)
+                             Prelude.Nothing -> (Prelude.id, __id__delete_incomplete_if_older)
+                     in
+                     __cereal__retain_at_least
+                       (let (__cereal__retain_at_most, __id__retain_at_most)
+                              = case __field__retain_at_most of
+                                  Prelude.Just _val -> ((:)
+                                                          (Thrift.genFieldPrim _proxy
+                                                             "retain_at_most"
+                                                             (Thrift.getI32Type _proxy)
+                                                             3
+                                                             __id__retain_at_least
+                                                             (Thrift.genI32Prim _proxy)
+                                                             _val),
+                                                        3)
+                                  Prelude.Nothing -> (Prelude.id, __id__retain_at_least)
+                          in
+                          __cereal__retain_at_most
+                            (let (__cereal__expire_delay, __id__expire_delay)
+                                   = case __field__expire_delay of
+                                       Prelude.Just _val -> ((:)
+                                                               (Thrift.genFieldPrim _proxy
+                                                                  "expire_delay"
+                                                                  (Thrift.getI32Type _proxy)
+                                                                  4
+                                                                  __id__retain_at_most
+                                                                  (Thrift.genI32Prim _proxy)
+                                                                  _val),
+                                                             4)
+                                       Prelude.Nothing -> (Prelude.id, __id__retain_at_most)
+                               in
+                               __cereal__expire_delay
+                                 (Thrift.genField _proxy "required_properties"
+                                    (Thrift.getMapType _proxy)
+                                    7
+                                    __id__expire_delay
+                                    ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                                        (Thrift.getStringType _proxy)
+                                        Prelude.True
+                                        (Thrift.genText _proxy)
+                                        (Thrift.genText _proxy)
+                                        . HashMap.toList)
+                                       __field__required_properties)
+                                    :
+                                    Thrift.genFieldBool _proxy "keep_open" 8 7 __field__keep_open :
+                                      Thrift.genField _proxy "excluded_properties"
+                                        (Thrift.getMapType _proxy)
+                                        9
+                                        8
+                                        ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                                            (Thrift.getStringType _proxy)
+                                            Prelude.True
+                                            (Thrift.genText _proxy)
+                                            (Thrift.genText _proxy)
+                                            . HashMap.toList)
+                                           __field__excluded_properties)
+                                        : []))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__delete_if_older <- ST.newSTRef Prelude.Nothing
+            __field__delete_incomplete_if_older <- ST.newSTRef Prelude.Nothing
+            __field__retain_at_least <- ST.newSTRef Prelude.Nothing
+            __field__retain_at_most <- ST.newSTRef Prelude.Nothing
+            __field__expire_delay <- ST.newSTRef Prelude.Nothing
+            __field__required_properties <- ST.newSTRef (HashMap.fromList [])
+            __field__keep_open <- ST.newSTRef Prelude.False
+            __field__excluded_properties <- ST.newSTRef (HashMap.fromList [])
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__delete_if_older
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__delete_incomplete_if_older
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__retain_at_least
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__retain_at_most
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__expire_delay
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__required_properties
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__keep_open
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__excluded_properties
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__delete_if_older <- ST.readSTRef
+                                                                          __field__delete_if_older
+                                             !__val__delete_incomplete_if_older <- ST.readSTRef
+                                                                                     __field__delete_incomplete_if_older
+                                             !__val__retain_at_least <- ST.readSTRef
+                                                                          __field__retain_at_least
+                                             !__val__retain_at_most <- ST.readSTRef
+                                                                         __field__retain_at_most
+                                             !__val__expire_delay <- ST.readSTRef
+                                                                       __field__expire_delay
+                                             !__val__required_properties <- ST.readSTRef
+                                                                              __field__required_properties
+                                             !__val__keep_open <- ST.readSTRef __field__keep_open
+                                             !__val__excluded_properties <- ST.readSTRef
+                                                                              __field__excluded_properties
+                                             Prelude.pure
+                                               (Retention __val__delete_if_older
+                                                  __val__delete_incomplete_if_older
+                                                  __val__retain_at_least
+                                                  __val__retain_at_most
+                                                  __val__expire_delay
+                                                  __val__required_properties
+                                                  __val__keep_open
+                                                  __val__excluded_properties)
+              _idMap
+                = HashMap.fromList
+                    [("delete_if_older", 1), ("delete_incomplete_if_older", 5),
+                     ("retain_at_least", 2), ("retain_at_most", 3), ("expire_delay", 4),
+                     ("required_properties", 7), ("keep_open", 8),
+                     ("excluded_properties", 9)]
+            _parse 0)
+
+instance DeepSeq.NFData Retention where
+  rnf
+    (Retention __field__delete_if_older
+       __field__delete_incomplete_if_older __field__retain_at_least
+       __field__retain_at_most __field__expire_delay
+       __field__required_properties __field__keep_open
+       __field__excluded_properties)
+    = DeepSeq.rnf __field__delete_if_older `Prelude.seq`
+        DeepSeq.rnf __field__delete_incomplete_if_older `Prelude.seq`
+          DeepSeq.rnf __field__retain_at_least `Prelude.seq`
+            DeepSeq.rnf __field__retain_at_most `Prelude.seq`
+              DeepSeq.rnf __field__expire_delay `Prelude.seq`
+                DeepSeq.rnf __field__required_properties `Prelude.seq`
+                  DeepSeq.rnf __field__keep_open `Prelude.seq`
+                    DeepSeq.rnf __field__excluded_properties `Prelude.seq` ()
+
+instance Default.Default Retention where
+  def
+    = Retention Prelude.Nothing Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        (HashMap.fromList [])
+        Prelude.False
+        (HashMap.fromList [])
+
+instance Hashable.Hashable Retention where
+  hashWithSalt __salt
+    (Retention _delete_if_older _delete_incomplete_if_older
+       _retain_at_least _retain_at_most _expire_delay _required_properties
+       _keep_open _excluded_properties)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt __salt _delete_if_older)
+                          _delete_incomplete_if_older)
+                       _retain_at_least)
+                    _retain_at_most)
+                 _expire_delay)
+              ((List.sort .
+                  Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                 _required_properties))
+           _keep_open)
+        ((List.sort .
+            Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+           _excluded_properties)
+
+instance Ord.Ord Retention where
+  compare __a __b
+    = case
+        Ord.compare (retention_delete_if_older __a)
+          (retention_delete_if_older __b)
+        of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case
+                    Ord.compare (retention_delete_incomplete_if_older __a)
+                      (retention_delete_incomplete_if_older __b)
+                    of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> case
+                                Ord.compare (retention_retain_at_least __a)
+                                  (retention_retain_at_least __b)
+                                of
+                                Ord.LT -> Ord.LT
+                                Ord.GT -> Ord.GT
+                                Ord.EQ -> case
+                                            Ord.compare (retention_retain_at_most __a)
+                                              (retention_retain_at_most __b)
+                                            of
+                                            Ord.LT -> Ord.LT
+                                            Ord.GT -> Ord.GT
+                                            Ord.EQ -> case
+                                                        Ord.compare (retention_expire_delay __a)
+                                                          (retention_expire_delay __b)
+                                                        of
+                                                        Ord.LT -> Ord.LT
+                                                        Ord.GT -> Ord.GT
+                                                        Ord.EQ -> case
+                                                                    Ord.compare
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (retention_required_properties
+                                                                            __a))
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (retention_required_properties
+                                                                            __b))
+                                                                    of
+                                                                    Ord.LT -> Ord.LT
+                                                                    Ord.GT -> Ord.GT
+                                                                    Ord.EQ -> case
+                                                                                Ord.compare
+                                                                                  (retention_keep_open
+                                                                                     __a)
+                                                                                  (retention_keep_open
+                                                                                     __b)
+                                                                                of
+                                                                                Ord.LT -> Ord.LT
+                                                                                Ord.GT -> Ord.GT
+                                                                                Ord.EQ -> Ord.compare
+                                                                                            ((List.sort
+                                                                                                .
+                                                                                                Prelude.map
+                                                                                                  (\ (_k,
+                                                                                                      _v)
+                                                                                                     ->
+                                                                                                     (_k,
+                                                                                                      _v))
+                                                                                                  .
+                                                                                                  HashMap.toList)
+                                                                                               (retention_excluded_properties
+                                                                                                  __a))
+                                                                                            ((List.sort
+                                                                                                .
+                                                                                                Prelude.map
+                                                                                                  (\ (_k,
+                                                                                                      _v)
+                                                                                                     ->
+                                                                                                     (_k,
+                                                                                                      _v))
+                                                                                                  .
+                                                                                                  HashMap.toList)
+                                                                                               (retention_excluded_properties
+                                                                                                  __b))
+
+data DatabaseRetentionPolicy = DatabaseRetentionPolicy{databaseRetentionPolicy_default_retention
+                                                       :: Retention,
+                                                       databaseRetentionPolicy_by_repo ::
+                                                       Map.Map RepoName [Retention],
+                                                       databaseRetentionPolicy_repos ::
+                                                       Map.Map RepoName Retention}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseRetentionPolicy where
+  toJSON
+    (DatabaseRetentionPolicy __field__default_retention
+       __field__by_repo __field__repos)
+    = Aeson.object
+        ("default_retention" .= __field__default_retention :
+           "by_repo" .= Map.mapKeys Thrift.keyToStr __field__by_repo :
+             "repos" .= Map.mapKeys Thrift.keyToStr __field__repos :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseRetentionPolicy where
+  buildStruct _proxy
+    (DatabaseRetentionPolicy __field__default_retention
+       __field__by_repo __field__repos)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "default_retention"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__default_retention)
+           :
+           Thrift.genField _proxy "by_repo" (Thrift.getMapType _proxy) 3 1
+             ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                 (Thrift.getListType _proxy)
+                 Prelude.True
+                 (Thrift.genText _proxy)
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy))
+                 . Map.toList)
+                __field__by_repo)
+             :
+             Thrift.genField _proxy "repos" (Thrift.getMapType _proxy) 2 3
+               ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                   (Thrift.getStructType _proxy)
+                   Prelude.True
+                   (Thrift.genText _proxy)
+                   (Thrift.buildStruct _proxy)
+                   . Map.toList)
+                  __field__repos)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__default_retention <- ST.newSTRef Default.def
+            __field__by_repo <- ST.newSTRef (Map.fromList [])
+            __field__repos <- ST.newSTRef (Map.fromList [])
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__default_retention
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Prelude.snd
+                                                                                           <$>
+                                                                                           Thrift.parseList
+                                                                                             _proxy
+                                                                                             (Thrift.parseStruct
+                                                                                                _proxy))
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__by_repo
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef __field__repos
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__default_retention <- ST.readSTRef
+                                                                            __field__default_retention
+                                             !__val__by_repo <- ST.readSTRef __field__by_repo
+                                             !__val__repos <- ST.readSTRef __field__repos
+                                             Prelude.pure
+                                               (DatabaseRetentionPolicy __val__default_retention
+                                                  __val__by_repo
+                                                  __val__repos)
+              _idMap
+                = HashMap.fromList
+                    [("default_retention", 1), ("by_repo", 3), ("repos", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseRetentionPolicy where
+  rnf
+    (DatabaseRetentionPolicy __field__default_retention
+       __field__by_repo __field__repos)
+    = DeepSeq.rnf __field__default_retention `Prelude.seq`
+        DeepSeq.rnf __field__by_repo `Prelude.seq`
+          DeepSeq.rnf __field__repos `Prelude.seq` ()
+
+instance Default.Default DatabaseRetentionPolicy where
+  def
+    = DatabaseRetentionPolicy Default.def (Map.fromList [])
+        (Map.fromList [])
+
+instance Hashable.Hashable DatabaseRetentionPolicy where
+  hashWithSalt __salt
+    (DatabaseRetentionPolicy _default_retention _by_repo _repos)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _default_retention)
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _by_repo))
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _repos)
+
+data DatabaseRestorePolicy = DatabaseRestorePolicy{databaseRestorePolicy_enabled
+                                                   :: Prelude.Bool,
+                                                   databaseRestorePolicy_override ::
+                                                   Set.Set RepoName}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseRestorePolicy where
+  toJSON (DatabaseRestorePolicy __field__enabled __field__override)
+    = Aeson.object
+        ("enabled" .= __field__enabled :
+           "override" .= __field__override : Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseRestorePolicy where
+  buildStruct _proxy
+    (DatabaseRestorePolicy __field__enabled __field__override)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "enabled" 1 0 __field__enabled :
+           Thrift.genField _proxy "override" (Thrift.getSetType _proxy) 2 1
+             ((Thrift.genList _proxy (Thrift.getStringType _proxy)
+                 (Thrift.genText _proxy)
+                 . Set.toList)
+                __field__override)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__enabled <- ST.newSTRef Prelude.False
+            __field__override <- ST.newSTRef (Set.fromList [])
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__enabled
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__override
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__enabled <- ST.readSTRef
+                                                                  __field__enabled
+                                             !__val__override <- ST.readSTRef __field__override
+                                             Prelude.pure
+                                               (DatabaseRestorePolicy __val__enabled
+                                                  __val__override)
+              _idMap = HashMap.fromList [("enabled", 1), ("override", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseRestorePolicy where
+  rnf (DatabaseRestorePolicy __field__enabled __field__override)
+    = DeepSeq.rnf __field__enabled `Prelude.seq`
+        DeepSeq.rnf __field__override `Prelude.seq` ()
+
+instance Default.Default DatabaseRestorePolicy where
+  def = DatabaseRestorePolicy Prelude.False (Set.fromList [])
+
+instance Hashable.Hashable DatabaseRestorePolicy where
+  hashWithSalt __salt (DatabaseRestorePolicy _enabled _override)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _enabled)
+        (Set.elems _override)
+
+newtype DatabaseClosePolicy = DatabaseClosePolicy{databaseClosePolicy_close_after
+                                                  :: Seconds}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseClosePolicy where
+  toJSON (DatabaseClosePolicy __field__close_after)
+    = Aeson.object
+        ("close_after" .= __field__close_after : Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseClosePolicy where
+  buildStruct _proxy (DatabaseClosePolicy __field__close_after)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "close_after" (Thrift.getI64Type _proxy) 1
+           0
+           (Thrift.genI64 _proxy __field__close_after)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__close_after <- ST.newSTRef 1800
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__close_after
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__close_after <- ST.readSTRef
+                                                                      __field__close_after
+                                             Prelude.pure (DatabaseClosePolicy __val__close_after)
+              _idMap = HashMap.fromList [("close_after", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseClosePolicy where
+  rnf (DatabaseClosePolicy __field__close_after)
+    = DeepSeq.rnf __field__close_after `Prelude.seq` ()
+
+instance Default.Default DatabaseClosePolicy where
+  def = DatabaseClosePolicy 1800
+
+instance Hashable.Hashable DatabaseClosePolicy where
+  hashWithSalt __salt (DatabaseClosePolicy _close_after)
+    = Hashable.hashWithSalt __salt _close_after
+
+data Backup = Backup{backup_location :: Text.Text,
+                     backup_delete_after_seconds :: Int.Int32}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Backup where
+  toJSON (Backup __field__location __field__delete_after_seconds)
+    = Aeson.object
+        ("location" .= __field__location :
+           "delete_after_seconds" .= __field__delete_after_seconds :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Backup where
+  buildStruct _proxy
+    (Backup __field__location __field__delete_after_seconds)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__location)
+           :
+           Thrift.genFieldPrim _proxy "delete_after_seconds"
+             (Thrift.getI32Type _proxy)
+             2
+             1
+             (Thrift.genI32Prim _proxy)
+             __field__delete_after_seconds
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef
+                                   "manifold-xdb:xdb.glean_catalog,glean_databases/nodes/dev-backup"
+            __field__delete_after_seconds <- ST.newSTRef 2592000
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__delete_after_seconds
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__delete_after_seconds <- ST.readSTRef
+                                                                               __field__delete_after_seconds
+                                             Prelude.pure
+                                               (Backup __val__location __val__delete_after_seconds)
+              _idMap
+                = HashMap.fromList [("location", 1), ("delete_after_seconds", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Backup where
+  rnf (Backup __field__location __field__delete_after_seconds)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__delete_after_seconds `Prelude.seq` ()
+
+instance Default.Default Backup where
+  def
+    = Backup
+        "manifold-xdb:xdb.glean_catalog,glean_databases/nodes/dev-backup"
+        2592000
+
+instance Hashable.Hashable Backup where
+  hashWithSalt __salt (Backup _location _delete_after_seconds)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _delete_after_seconds
+
+data DatabaseBackupPolicy = DatabaseBackupPolicy{databaseBackupPolicy_allowed
+                                                 :: Set_RepoName_8170,
+                                                 databaseBackupPolicy_location :: Text.Text,
+                                                 databaseBackupPolicy_repos ::
+                                                 Map.Map RepoName Backup}
+                            deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON DatabaseBackupPolicy where
+  toJSON
+    (DatabaseBackupPolicy __field__allowed __field__location
+       __field__repos)
+    = Aeson.object
+        ("allowed" .= __field__allowed :
+           "location" .= __field__location :
+             "repos" .= Map.mapKeys Thrift.keyToStr __field__repos :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseBackupPolicy where
+  buildStruct _proxy
+    (DatabaseBackupPolicy __field__allowed __field__location
+       __field__repos)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "allowed" (Thrift.getSetType _proxy) 4 0
+           ((Thrift.genList _proxy (Thrift.getStringType _proxy)
+               (Thrift.genText _proxy)
+               . HashSet.toList)
+              __field__allowed)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStringType _proxy) 3 4
+             (Thrift.genText _proxy __field__location)
+             :
+             Thrift.genField _proxy "repos" (Thrift.getMapType _proxy) 5 3
+               ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                   (Thrift.getStructType _proxy)
+                   Prelude.True
+                   (Thrift.genText _proxy)
+                   (Thrift.buildStruct _proxy)
+                   . Map.toList)
+                  __field__repos)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__allowed <- ST.newSTRef (HashSet.fromList [])
+            __field__location <- ST.newSTRef
+                                   "manifold-xdb:xdb.glean_catalog,glean_databases/nodes/dev-backup"
+            __field__repos <- ST.newSTRef (Map.fromList [])
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 4 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashSet.fromList
+                                                                                      . Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__allowed
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef __field__repos
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__allowed <- ST.readSTRef
+                                                                  __field__allowed
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__repos <- ST.readSTRef __field__repos
+                                             Prelude.pure
+                                               (DatabaseBackupPolicy __val__allowed __val__location
+                                                  __val__repos)
+              _idMap
+                = HashMap.fromList [("allowed", 4), ("location", 3), ("repos", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseBackupPolicy where
+  rnf
+    (DatabaseBackupPolicy __field__allowed __field__location
+       __field__repos)
+    = DeepSeq.rnf __field__allowed `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__repos `Prelude.seq` ()
+
+instance Default.Default DatabaseBackupPolicy where
+  def
+    = DatabaseBackupPolicy (HashSet.fromList [])
+        "manifold-xdb:xdb.glean_catalog,glean_databases/nodes/dev-backup"
+        (Map.fromList [])
+
+instance Hashable.Hashable DatabaseBackupPolicy where
+  hashWithSalt __salt
+    (DatabaseBackupPolicy _allowed _location _repos)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt
+              ((List.sort . HashSet.toList) _allowed))
+           _location)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _repos)
+
+instance Ord.Ord DatabaseBackupPolicy where
+  compare __a __b
+    = case
+        Ord.compare
+          ((List.sort . HashSet.toList) (databaseBackupPolicy_allowed __a))
+          ((List.sort . HashSet.toList) (databaseBackupPolicy_allowed __b))
+        of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case
+                    Ord.compare (databaseBackupPolicy_location __a)
+                      (databaseBackupPolicy_location __b)
+                    of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> Ord.compare (databaseBackupPolicy_repos __a)
+                                (databaseBackupPolicy_repos __b)
+
+newtype StaticShardsPolicy = StaticShardsPolicy{staticShardsPolicy_shards
+                                                :: Set.Set RepoName}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StaticShardsPolicy where
+  toJSON (StaticShardsPolicy __field__shards)
+    = Aeson.object ("shards" .= __field__shards : Prelude.mempty)
+
+instance Thrift.ThriftStruct StaticShardsPolicy where
+  buildStruct _proxy (StaticShardsPolicy __field__shards)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "shards" (Thrift.getSetType _proxy) 1 0
+           ((Thrift.genList _proxy (Thrift.getStringType _proxy)
+               (Thrift.genText _proxy)
+               . Set.toList)
+              __field__shards)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__shards <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__shards
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__shards <- ST.readSTRef
+                                                                 __field__shards
+                                             Prelude.pure (StaticShardsPolicy __val__shards)
+              _idMap = HashMap.fromList [("shards", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData StaticShardsPolicy where
+  rnf (StaticShardsPolicy __field__shards)
+    = DeepSeq.rnf __field__shards `Prelude.seq` ()
+
+instance Default.Default StaticShardsPolicy where
+  def = StaticShardsPolicy Default.def
+
+instance Hashable.Hashable StaticShardsPolicy where
+  hashWithSalt __salt (StaticShardsPolicy _shards)
+    = Hashable.hashWithSalt __salt (Set.elems _shards)
+
+data NoShardsPolicy = NoShardsPolicy{}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NoShardsPolicy where
+  toJSON NoShardsPolicy = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct NoShardsPolicy where
+  buildStruct _proxy NoShardsPolicy = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (NoShardsPolicy)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData NoShardsPolicy where
+  rnf NoShardsPolicy = ()
+
+instance Default.Default NoShardsPolicy where
+  def = NoShardsPolicy
+
+instance Hashable.Hashable NoShardsPolicy where
+  hashWithSalt __salt NoShardsPolicy = __salt
+
+data ShardManagerPolicy = ShardManagerPolicy{shardManagerPolicy_nshards
+                                             :: Int.Int32,
+                                             shardManagerPolicy_service_name :: Text.Text,
+                                             shardManagerPolicy_default_domain_id :: Text.Text}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ShardManagerPolicy where
+  toJSON
+    (ShardManagerPolicy __field__nshards __field__service_name
+       __field__default_domain_id)
+    = Aeson.object
+        ("nshards" .= __field__nshards :
+           "service_name" .= __field__service_name :
+             "default_domain_id" .= __field__default_domain_id : Prelude.mempty)
+
+instance Thrift.ThriftStruct ShardManagerPolicy where
+  buildStruct _proxy
+    (ShardManagerPolicy __field__nshards __field__service_name
+       __field__default_domain_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "nshards" (Thrift.getI32Type _proxy) 1
+           0
+           (Thrift.genI32Prim _proxy)
+           __field__nshards
+           :
+           Thrift.genField _proxy "service_name" (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__service_name)
+             :
+             Thrift.genField _proxy "default_domain_id"
+               (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__default_domain_id)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nshards <- ST.newSTRef Default.def
+            __field__service_name <- ST.newSTRef ""
+            __field__default_domain_id <- ST.newSTRef "default"
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nshards
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__service_name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__default_domain_id
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nshards <- ST.readSTRef
+                                                                  __field__nshards
+                                             !__val__service_name <- ST.readSTRef
+                                                                       __field__service_name
+                                             !__val__default_domain_id <- ST.readSTRef
+                                                                            __field__default_domain_id
+                                             Prelude.pure
+                                               (ShardManagerPolicy __val__nshards
+                                                  __val__service_name
+                                                  __val__default_domain_id)
+              _idMap
+                = HashMap.fromList
+                    [("nshards", 1), ("service_name", 2), ("default_domain_id", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ShardManagerPolicy where
+  rnf
+    (ShardManagerPolicy __field__nshards __field__service_name
+       __field__default_domain_id)
+    = DeepSeq.rnf __field__nshards `Prelude.seq`
+        DeepSeq.rnf __field__service_name `Prelude.seq`
+          DeepSeq.rnf __field__default_domain_id `Prelude.seq` ()
+
+instance Default.Default ShardManagerPolicy where
+  def = ShardManagerPolicy Default.def "" "default"
+
+instance Hashable.Hashable ShardManagerPolicy where
+  hashWithSalt __salt
+    (ShardManagerPolicy _nshards _service_name _default_domain_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _nshards)
+           _service_name)
+        _default_domain_id
+
+data ShardManagerMostRecentPolicy = ShardManagerMostRecentPolicy{shardManagerMostRecentPolicy_shard_manager_policy
+                                                                 :: ShardManagerPolicy,
+                                                                 shardManagerMostRecentPolicy_most_recent_domain_id
+                                                                 :: Text.Text}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ShardManagerMostRecentPolicy where
+  toJSON
+    (ShardManagerMostRecentPolicy __field__shard_manager_policy
+       __field__most_recent_domain_id)
+    = Aeson.object
+        ("shard_manager_policy" .= __field__shard_manager_policy :
+           "most_recent_domain_id" .= __field__most_recent_domain_id :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ShardManagerMostRecentPolicy where
+  buildStruct _proxy
+    (ShardManagerMostRecentPolicy __field__shard_manager_policy
+       __field__most_recent_domain_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "shard_manager_policy"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__shard_manager_policy)
+           :
+           Thrift.genField _proxy "most_recent_domain_id"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__most_recent_domain_id)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__shard_manager_policy <- ST.newSTRef Default.def
+            __field__most_recent_domain_id <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__shard_manager_policy
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__most_recent_domain_id
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__shard_manager_policy <- ST.readSTRef
+                                                                               __field__shard_manager_policy
+                                             !__val__most_recent_domain_id <- ST.readSTRef
+                                                                                __field__most_recent_domain_id
+                                             Prelude.pure
+                                               (ShardManagerMostRecentPolicy
+                                                  __val__shard_manager_policy
+                                                  __val__most_recent_domain_id)
+              _idMap
+                = HashMap.fromList
+                    [("shard_manager_policy", 1), ("most_recent_domain_id", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ShardManagerMostRecentPolicy where
+  rnf
+    (ShardManagerMostRecentPolicy __field__shard_manager_policy
+       __field__most_recent_domain_id)
+    = DeepSeq.rnf __field__shard_manager_policy `Prelude.seq`
+        DeepSeq.rnf __field__most_recent_domain_id `Prelude.seq` ()
+
+instance Default.Default ShardManagerMostRecentPolicy where
+  def = ShardManagerMostRecentPolicy Default.def ""
+
+instance Hashable.Hashable ShardManagerMostRecentPolicy where
+  hashWithSalt __salt
+    (ShardManagerMostRecentPolicy _shard_manager_policy
+       _most_recent_domain_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _shard_manager_policy)
+        _most_recent_domain_id
+
+data ShardingPolicy = ShardingPolicy_static_assignment StaticShardsPolicy
+                    | ShardingPolicy_no_shards NoShardsPolicy
+                    | ShardingPolicy_shard_manager ShardManagerPolicy
+                    | ShardingPolicy_shard_manager_most_recent ShardManagerMostRecentPolicy
+                    | ShardingPolicy_EMPTY
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ShardingPolicy where
+  toJSON (ShardingPolicy_static_assignment __static_assignment)
+    = Aeson.object ["static_assignment" .= __static_assignment]
+  toJSON (ShardingPolicy_no_shards __no_shards)
+    = Aeson.object ["no_shards" .= __no_shards]
+  toJSON (ShardingPolicy_shard_manager __shard_manager)
+    = Aeson.object ["shard_manager" .= __shard_manager]
+  toJSON
+    (ShardingPolicy_shard_manager_most_recent
+       __shard_manager_most_recent)
+    = Aeson.object
+        ["shard_manager_most_recent" .= __shard_manager_most_recent]
+  toJSON ShardingPolicy_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ShardingPolicy where
+  buildStruct _proxy
+    (ShardingPolicy_static_assignment __static_assignment)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "static_assignment"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __static_assignment)]
+  buildStruct _proxy (ShardingPolicy_no_shards __no_shards)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "no_shards" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __no_shards)]
+  buildStruct _proxy (ShardingPolicy_shard_manager __shard_manager)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "shard_manager"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __shard_manager)]
+  buildStruct _proxy
+    (ShardingPolicy_shard_manager_most_recent
+       __shard_manager_most_recent)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "shard_manager_most_recent"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __shard_manager_most_recent)]
+  buildStruct _proxy ShardingPolicy_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShardingPolicy_static_assignment
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShardingPolicy_no_shards _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShardingPolicy_shard_manager _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShardingPolicy_shard_manager_most_recent
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ShardingPolicy_EMPTY
+           Thrift.FieldEnd -> Prelude.return ShardingPolicy_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("static_assignment", 1), ("no_shards", 2), ("shard_manager", 3),
+             ("shard_manager_most_recent", 4)]
+
+instance DeepSeq.NFData ShardingPolicy where
+  rnf (ShardingPolicy_static_assignment __static_assignment)
+    = DeepSeq.rnf __static_assignment
+  rnf (ShardingPolicy_no_shards __no_shards)
+    = DeepSeq.rnf __no_shards
+  rnf (ShardingPolicy_shard_manager __shard_manager)
+    = DeepSeq.rnf __shard_manager
+  rnf
+    (ShardingPolicy_shard_manager_most_recent
+       __shard_manager_most_recent)
+    = DeepSeq.rnf __shard_manager_most_recent
+  rnf ShardingPolicy_EMPTY = ()
+
+instance Default.Default ShardingPolicy where
+  def = ShardingPolicy_EMPTY
+
+instance Hashable.Hashable ShardingPolicy where
+  hashWithSalt __salt
+    (ShardingPolicy_static_assignment _static_assignment)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _static_assignment)
+  hashWithSalt __salt (ShardingPolicy_no_shards _no_shards)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _no_shards)
+  hashWithSalt __salt (ShardingPolicy_shard_manager _shard_manager)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _shard_manager)
+  hashWithSalt __salt
+    (ShardingPolicy_shard_manager_most_recent
+       _shard_manager_most_recent)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _shard_manager_most_recent)
+  hashWithSalt __salt ShardingPolicy_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data SchemaLocation = SchemaLocation_dir Text.Text
+                    | SchemaLocation_file Text.Text
+                    | SchemaLocation_index Text.Text
+                    | SchemaLocation_config Text.Text
+                    | SchemaLocation_indexconfig Text.Text
+                    | SchemaLocation_EMPTY
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaLocation where
+  toJSON (SchemaLocation_dir __dir) = Aeson.object ["dir" .= __dir]
+  toJSON (SchemaLocation_file __file)
+    = Aeson.object ["file" .= __file]
+  toJSON (SchemaLocation_index __index)
+    = Aeson.object ["index" .= __index]
+  toJSON (SchemaLocation_config __config)
+    = Aeson.object ["config" .= __config]
+  toJSON (SchemaLocation_indexconfig __indexconfig)
+    = Aeson.object ["indexconfig" .= __indexconfig]
+  toJSON SchemaLocation_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SchemaLocation where
+  buildStruct _proxy (SchemaLocation_dir __dir)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "dir" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __dir)]
+  buildStruct _proxy (SchemaLocation_file __file)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "file" (Thrift.getStringType _proxy) 2 0
+           (Thrift.genText _proxy __file)]
+  buildStruct _proxy (SchemaLocation_index __index)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "index" (Thrift.getStringType _proxy) 3 0
+           (Thrift.genText _proxy __index)]
+  buildStruct _proxy (SchemaLocation_config __config)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "config" (Thrift.getStringType _proxy) 4 0
+           (Thrift.genText _proxy __config)]
+  buildStruct _proxy (SchemaLocation_indexconfig __indexconfig)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "indexconfig" (Thrift.getStringType _proxy)
+           5
+           0
+           (Thrift.genText _proxy __indexconfig)]
+  buildStruct _proxy SchemaLocation_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SchemaLocation_dir _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SchemaLocation_file _val)
+                                                     3 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SchemaLocation_index _val)
+                                                     4 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SchemaLocation_config _val)
+                                                     5 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SchemaLocation_indexconfig _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SchemaLocation_EMPTY
+           Thrift.FieldEnd -> Prelude.return SchemaLocation_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("dir", 1), ("file", 2), ("index", 3), ("config", 4),
+             ("indexconfig", 5)]
+
+instance DeepSeq.NFData SchemaLocation where
+  rnf (SchemaLocation_dir __dir) = DeepSeq.rnf __dir
+  rnf (SchemaLocation_file __file) = DeepSeq.rnf __file
+  rnf (SchemaLocation_index __index) = DeepSeq.rnf __index
+  rnf (SchemaLocation_config __config) = DeepSeq.rnf __config
+  rnf (SchemaLocation_indexconfig __indexconfig)
+    = DeepSeq.rnf __indexconfig
+  rnf SchemaLocation_EMPTY = ()
+
+instance Default.Default SchemaLocation where
+  def = SchemaLocation_EMPTY
+
+instance Hashable.Hashable SchemaLocation where
+  hashWithSalt __salt (SchemaLocation_dir _dir)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _dir)
+  hashWithSalt __salt (SchemaLocation_file _file)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _file)
+  hashWithSalt __salt (SchemaLocation_index _index)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _index)
+  hashWithSalt __salt (SchemaLocation_config _config)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _config)
+  hashWithSalt __salt (SchemaLocation_indexconfig _indexconfig)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _indexconfig)
+  hashWithSalt __salt SchemaLocation_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Config = Config{config_retention :: DatabaseRetentionPolicy,
+                     config_restore :: DatabaseRestorePolicy,
+                     config_close :: DatabaseClosePolicy,
+                     config_backup :: DatabaseBackupPolicy,
+                     config_janitor_period :: Prelude.Maybe Seconds,
+                     config_backup_list_sync_period :: Seconds,
+                     config_default_max_results :: Prelude.Maybe Int.Int64,
+                     config_default_max_bytes :: Prelude.Maybe Int.Int64,
+                     config_default_max_time_ms :: Prelude.Maybe Int.Int64,
+                     config_query_alloc_limit :: Prelude.Maybe Int.Int64,
+                     config_logging_rate_limit :: Int.Int32,
+                     config_db_writes_keep :: Int.Int32,
+                     config_db_writes_reap :: Int.Int32,
+                     config_db_writer_threads :: Int.Int32,
+                     config_db_write_queue_limit_mb :: Int.Int32,
+                     config_db_ptail_checkpoint_bytes :: Int.Int32,
+                     config_db_ptail_checkpoint_enabled :: Prelude.Bool,
+                     config_db_rocksdb_cache_mb :: Int.Int32,
+                     config_db_lookup_cache_limit_mb :: Int.Int32,
+                     config_db_create_version :: Prelude.Maybe DBVersion,
+                     config_disable_predicate_dependency_checks :: Prelude.Bool,
+                     config_compact_on_completion :: Prelude.Bool,
+                     config_enable_schema_evolution :: Prelude.Bool,
+                     config_min_db_age :: Seconds, config_sharding :: ShardingPolicy,
+                     config_use_schema_id :: Prelude.Bool,
+                     config_db_rocksdb_cache_index_and_filter_blocks :: Prelude.Bool,
+                     config_strict_query_schema_id :: Prelude.Bool,
+                     config_use_manifold_cli :: Prelude.Bool,
+                     config_max_remote_db_list_age :: Seconds,
+                     config_restore_timeout :: Prelude.Maybe Seconds,
+                     config_max_set_size_bytes :: Prelude.Maybe Int.Int64,
+                     config_check_write_schema_id :: Prelude.Bool,
+                     config_schema_location :: Prelude.Maybe SchemaLocation}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Config where
+  toJSON
+    (Config __field__retention __field__restore __field__close
+       __field__backup __field__janitor_period
+       __field__backup_list_sync_period __field__default_max_results
+       __field__default_max_bytes __field__default_max_time_ms
+       __field__query_alloc_limit __field__logging_rate_limit
+       __field__db_writes_keep __field__db_writes_reap
+       __field__db_writer_threads __field__db_write_queue_limit_mb
+       __field__db_ptail_checkpoint_bytes
+       __field__db_ptail_checkpoint_enabled __field__db_rocksdb_cache_mb
+       __field__db_lookup_cache_limit_mb __field__db_create_version
+       __field__disable_predicate_dependency_checks
+       __field__compact_on_completion __field__enable_schema_evolution
+       __field__min_db_age __field__sharding __field__use_schema_id
+       __field__db_rocksdb_cache_index_and_filter_blocks
+       __field__strict_query_schema_id __field__use_manifold_cli
+       __field__max_remote_db_list_age __field__restore_timeout
+       __field__max_set_size_bytes __field__check_write_schema_id
+       __field__schema_location)
+    = Aeson.object
+        ("retention" .= __field__retention :
+           "restore" .= __field__restore :
+             "close" .= __field__close :
+               "backup" .= __field__backup :
+                 Prelude.maybe Prelude.id ((:) . ("janitor_period" .=))
+                   __field__janitor_period
+                   ("backup_list_sync_period" .= __field__backup_list_sync_period :
+                      Prelude.maybe Prelude.id ((:) . ("default_max_results" .=))
+                        __field__default_max_results
+                        (Prelude.maybe Prelude.id ((:) . ("default_max_bytes" .=))
+                           __field__default_max_bytes
+                           (Prelude.maybe Prelude.id ((:) . ("default_max_time_ms" .=))
+                              __field__default_max_time_ms
+                              (Prelude.maybe Prelude.id ((:) . ("query_alloc_limit" .=))
+                                 __field__query_alloc_limit
+                                 ("logging_rate_limit" .= __field__logging_rate_limit :
+                                    "db_writes_keep" .= __field__db_writes_keep :
+                                      "db_writes_reap" .= __field__db_writes_reap :
+                                        "db_writer_threads" .= __field__db_writer_threads :
+                                          "db_write_queue_limit_mb" .=
+                                            __field__db_write_queue_limit_mb
+                                            :
+                                            "db_ptail_checkpoint_bytes" .=
+                                              __field__db_ptail_checkpoint_bytes
+                                              :
+                                              "db_ptail_checkpoint_enabled" .=
+                                                __field__db_ptail_checkpoint_enabled
+                                                :
+                                                "db_rocksdb_cache_mb" .=
+                                                  __field__db_rocksdb_cache_mb
+                                                  :
+                                                  "db_lookup_cache_limit_mb" .=
+                                                    __field__db_lookup_cache_limit_mb
+                                                    :
+                                                    Prelude.maybe Prelude.id
+                                                      ((:) . ("db_create_version" .=))
+                                                      (Prelude.fmap unDBVersion
+                                                         __field__db_create_version)
+                                                      ("disable_predicate_dependency_checks" .=
+                                                         __field__disable_predicate_dependency_checks
+                                                         :
+                                                         "compact_on_completion" .=
+                                                           __field__compact_on_completion
+                                                           :
+                                                           "enable_schema_evolution" .=
+                                                             __field__enable_schema_evolution
+                                                             :
+                                                             "min_db_age" .= __field__min_db_age :
+                                                               "sharding" .= __field__sharding :
+                                                                 "use_schema_id" .=
+                                                                   __field__use_schema_id
+                                                                   :
+                                                                   "db_rocksdb_cache_index_and_filter_blocks"
+                                                                     .=
+                                                                     __field__db_rocksdb_cache_index_and_filter_blocks
+                                                                     :
+                                                                     "strict_query_schema_id" .=
+                                                                       __field__strict_query_schema_id
+                                                                       :
+                                                                       "use_manifold_cli" .=
+                                                                         __field__use_manifold_cli
+                                                                         :
+                                                                         "max_remote_db_list_age" .=
+                                                                           __field__max_remote_db_list_age
+                                                                           :
+                                                                           Prelude.maybe Prelude.id
+                                                                             ((:) .
+                                                                                ("restore_timeout" .=))
+                                                                             __field__restore_timeout
+                                                                             (Prelude.maybe
+                                                                                Prelude.id
+                                                                                ((:) .
+                                                                                   ("max_set_size_bytes" .=))
+                                                                                __field__max_set_size_bytes
+                                                                                ("check_write_schema_id"
+                                                                                   .=
+                                                                                   __field__check_write_schema_id
+                                                                                   :
+                                                                                   Prelude.maybe
+                                                                                     Prelude.id
+                                                                                     ((:) .
+                                                                                        ("schema_location" .=))
+                                                                                     __field__schema_location
+                                                                                     Prelude.mempty)))))))))
+
+instance Thrift.ThriftStruct Config where
+  buildStruct _proxy
+    (Config __field__retention __field__restore __field__close
+       __field__backup __field__janitor_period
+       __field__backup_list_sync_period __field__default_max_results
+       __field__default_max_bytes __field__default_max_time_ms
+       __field__query_alloc_limit __field__logging_rate_limit
+       __field__db_writes_keep __field__db_writes_reap
+       __field__db_writer_threads __field__db_write_queue_limit_mb
+       __field__db_ptail_checkpoint_bytes
+       __field__db_ptail_checkpoint_enabled __field__db_rocksdb_cache_mb
+       __field__db_lookup_cache_limit_mb __field__db_create_version
+       __field__disable_predicate_dependency_checks
+       __field__compact_on_completion __field__enable_schema_evolution
+       __field__min_db_age __field__sharding __field__use_schema_id
+       __field__db_rocksdb_cache_index_and_filter_blocks
+       __field__strict_query_schema_id __field__use_manifold_cli
+       __field__max_remote_db_list_age __field__restore_timeout
+       __field__max_set_size_bytes __field__check_write_schema_id
+       __field__schema_location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "retention" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__retention)
+           :
+           Thrift.genField _proxy "restore" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__restore)
+             :
+             Thrift.genField _proxy "close" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__close)
+               :
+               Thrift.genField _proxy "backup" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__backup)
+                 :
+                 let (__cereal__janitor_period, __id__janitor_period)
+                       = case __field__janitor_period of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "janitor_period"
+                                                      (Thrift.getI64Type _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.genI64 _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__janitor_period
+                     (Thrift.genField _proxy "backup_list_sync_period"
+                        (Thrift.getI64Type _proxy)
+                        21
+                        __id__janitor_period
+                        (Thrift.genI64 _proxy __field__backup_list_sync_period)
+                        :
+                        let (__cereal__default_max_results, __id__default_max_results)
+                              = case __field__default_max_results of
+                                  Prelude.Just _val -> ((:)
+                                                          (Thrift.genFieldPrim _proxy
+                                                             "default_max_results"
+                                                             (Thrift.getI64Type _proxy)
+                                                             6
+                                                             21
+                                                             (Thrift.genI64Prim _proxy)
+                                                             _val),
+                                                        6)
+                                  Prelude.Nothing -> (Prelude.id, 21)
+                          in
+                          __cereal__default_max_results
+                            (let (__cereal__default_max_bytes, __id__default_max_bytes)
+                                   = case __field__default_max_bytes of
+                                       Prelude.Just _val -> ((:)
+                                                               (Thrift.genFieldPrim _proxy
+                                                                  "default_max_bytes"
+                                                                  (Thrift.getI64Type _proxy)
+                                                                  18
+                                                                  __id__default_max_results
+                                                                  (Thrift.genI64Prim _proxy)
+                                                                  _val),
+                                                             18)
+                                       Prelude.Nothing -> (Prelude.id, __id__default_max_results)
+                               in
+                               __cereal__default_max_bytes
+                                 (let (__cereal__default_max_time_ms, __id__default_max_time_ms)
+                                        = case __field__default_max_time_ms of
+                                            Prelude.Just _val -> ((:)
+                                                                    (Thrift.genFieldPrim _proxy
+                                                                       "default_max_time_ms"
+                                                                       (Thrift.getI64Type _proxy)
+                                                                       20
+                                                                       __id__default_max_bytes
+                                                                       (Thrift.genI64Prim _proxy)
+                                                                       _val),
+                                                                  20)
+                                            Prelude.Nothing -> (Prelude.id, __id__default_max_bytes)
+                                    in
+                                    __cereal__default_max_time_ms
+                                      (let (__cereal__query_alloc_limit, __id__query_alloc_limit)
+                                             = case __field__query_alloc_limit of
+                                                 Prelude.Just _val -> ((:)
+                                                                         (Thrift.genFieldPrim _proxy
+                                                                            "query_alloc_limit"
+                                                                            (Thrift.getI64Type
+                                                                               _proxy)
+                                                                            7
+                                                                            __id__default_max_time_ms
+                                                                            (Thrift.genI64Prim
+                                                                               _proxy)
+                                                                            _val),
+                                                                       7)
+                                                 Prelude.Nothing -> (Prelude.id,
+                                                                     __id__default_max_time_ms)
+                                         in
+                                         __cereal__query_alloc_limit
+                                           (Thrift.genFieldPrim _proxy "logging_rate_limit"
+                                              (Thrift.getI32Type _proxy)
+                                              8
+                                              __id__query_alloc_limit
+                                              (Thrift.genI32Prim _proxy)
+                                              __field__logging_rate_limit
+                                              :
+                                              Thrift.genFieldPrim _proxy "db_writes_keep"
+                                                (Thrift.getI32Type _proxy)
+                                                9
+                                                8
+                                                (Thrift.genI32Prim _proxy)
+                                                __field__db_writes_keep
+                                                :
+                                                Thrift.genFieldPrim _proxy "db_writes_reap"
+                                                  (Thrift.getI32Type _proxy)
+                                                  10
+                                                  9
+                                                  (Thrift.genI32Prim _proxy)
+                                                  __field__db_writes_reap
+                                                  :
+                                                  Thrift.genFieldPrim _proxy "db_writer_threads"
+                                                    (Thrift.getI32Type _proxy)
+                                                    11
+                                                    10
+                                                    (Thrift.genI32Prim _proxy)
+                                                    __field__db_writer_threads
+                                                    :
+                                                    Thrift.genFieldPrim _proxy
+                                                      "db_write_queue_limit_mb"
+                                                      (Thrift.getI32Type _proxy)
+                                                      12
+                                                      11
+                                                      (Thrift.genI32Prim _proxy)
+                                                      __field__db_write_queue_limit_mb
+                                                      :
+                                                      Thrift.genFieldPrim _proxy
+                                                        "db_ptail_checkpoint_bytes"
+                                                        (Thrift.getI32Type _proxy)
+                                                        13
+                                                        12
+                                                        (Thrift.genI32Prim _proxy)
+                                                        __field__db_ptail_checkpoint_bytes
+                                                        :
+                                                        Thrift.genFieldBool _proxy
+                                                          "db_ptail_checkpoint_enabled"
+                                                          14
+                                                          13
+                                                          __field__db_ptail_checkpoint_enabled
+                                                          :
+                                                          Thrift.genFieldPrim _proxy
+                                                            "db_rocksdb_cache_mb"
+                                                            (Thrift.getI32Type _proxy)
+                                                            15
+                                                            14
+                                                            (Thrift.genI32Prim _proxy)
+                                                            __field__db_rocksdb_cache_mb
+                                                            :
+                                                            Thrift.genFieldPrim _proxy
+                                                              "db_lookup_cache_limit_mb"
+                                                              (Thrift.getI32Type _proxy)
+                                                              16
+                                                              15
+                                                              (Thrift.genI32Prim _proxy)
+                                                              __field__db_lookup_cache_limit_mb
+                                                              :
+                                                              let (__cereal__db_create_version,
+                                                                   __id__db_create_version)
+                                                                    = case
+                                                                        __field__db_create_version
+                                                                        of
+                                                                        Prelude.Just _val -> ((:)
+                                                                                                (Thrift.genField
+                                                                                                   _proxy
+                                                                                                   "db_create_version"
+                                                                                                   (Thrift.getI64Type
+                                                                                                      _proxy)
+                                                                                                   19
+                                                                                                   16
+                                                                                                   ((Thrift.genI64
+                                                                                                       _proxy
+                                                                                                       .
+                                                                                                       unDBVersion)
+                                                                                                      _val)),
+                                                                                              19)
+                                                                        Prelude.Nothing -> (Prelude.id,
+                                                                                            16)
+                                                                in
+                                                                __cereal__db_create_version
+                                                                  (Thrift.genFieldBool _proxy
+                                                                     "disable_predicate_dependency_checks"
+                                                                     22
+                                                                     __id__db_create_version
+                                                                     __field__disable_predicate_dependency_checks
+                                                                     :
+                                                                     Thrift.genFieldBool _proxy
+                                                                       "compact_on_completion"
+                                                                       23
+                                                                       22
+                                                                       __field__compact_on_completion
+                                                                       :
+                                                                       Thrift.genFieldBool _proxy
+                                                                         "enable_schema_evolution"
+                                                                         24
+                                                                         23
+                                                                         __field__enable_schema_evolution
+                                                                         :
+                                                                         Thrift.genField _proxy
+                                                                           "min_db_age"
+                                                                           (Thrift.getI64Type
+                                                                              _proxy)
+                                                                           25
+                                                                           24
+                                                                           (Thrift.genI64 _proxy
+                                                                              __field__min_db_age)
+                                                                           :
+                                                                           Thrift.genField _proxy
+                                                                             "sharding"
+                                                                             (Thrift.getStructType
+                                                                                _proxy)
+                                                                             26
+                                                                             25
+                                                                             (Thrift.buildStruct
+                                                                                _proxy
+                                                                                __field__sharding)
+                                                                             :
+                                                                             Thrift.genFieldBool
+                                                                               _proxy
+                                                                               "use_schema_id"
+                                                                               27
+                                                                               26
+                                                                               __field__use_schema_id
+                                                                               :
+                                                                               Thrift.genFieldBool
+                                                                                 _proxy
+                                                                                 "db_rocksdb_cache_index_and_filter_blocks"
+                                                                                 28
+                                                                                 27
+                                                                                 __field__db_rocksdb_cache_index_and_filter_blocks
+                                                                                 :
+                                                                                 Thrift.genFieldBool
+                                                                                   _proxy
+                                                                                   "strict_query_schema_id"
+                                                                                   29
+                                                                                   28
+                                                                                   __field__strict_query_schema_id
+                                                                                   :
+                                                                                   Thrift.genFieldBool
+                                                                                     _proxy
+                                                                                     "use_manifold_cli"
+                                                                                     30
+                                                                                     29
+                                                                                     __field__use_manifold_cli
+                                                                                     :
+                                                                                     Thrift.genField
+                                                                                       _proxy
+                                                                                       "max_remote_db_list_age"
+                                                                                       (Thrift.getI64Type
+                                                                                          _proxy)
+                                                                                       31
+                                                                                       30
+                                                                                       (Thrift.genI64
+                                                                                          _proxy
+                                                                                          __field__max_remote_db_list_age)
+                                                                                       :
+                                                                                       let (__cereal__restore_timeout,
+                                                                                            __id__restore_timeout)
+                                                                                             = case
+                                                                                                 __field__restore_timeout
+                                                                                                 of
+                                                                                                 Prelude.Just
+                                                                                                   _val -> ((:)
+                                                                                                              (Thrift.genField
+                                                                                                                 _proxy
+                                                                                                                 "restore_timeout"
+                                                                                                                 (Thrift.getI64Type
+                                                                                                                    _proxy)
+                                                                                                                 33
+                                                                                                                 31
+                                                                                                                 (Thrift.genI64
+                                                                                                                    _proxy
+                                                                                                                    _val)),
+                                                                                                            33)
+                                                                                                 Prelude.Nothing -> (Prelude.id,
+                                                                                                                     31)
+                                                                                         in
+                                                                                         __cereal__restore_timeout
+                                                                                           (let (__cereal__max_set_size_bytes,
+                                                                                                 __id__max_set_size_bytes)
+                                                                                                  = case
+                                                                                                      __field__max_set_size_bytes
+                                                                                                      of
+                                                                                                      Prelude.Just
+                                                                                                        _val -> ((:)
+                                                                                                                   (Thrift.genFieldPrim
+                                                                                                                      _proxy
+                                                                                                                      "max_set_size_bytes"
+                                                                                                                      (Thrift.getI64Type
+                                                                                                                         _proxy)
+                                                                                                                      34
+                                                                                                                      __id__restore_timeout
+                                                                                                                      (Thrift.genI64Prim
+                                                                                                                         _proxy)
+                                                                                                                      _val),
+                                                                                                                 34)
+                                                                                                      Prelude.Nothing -> (Prelude.id,
+                                                                                                                          __id__restore_timeout)
+                                                                                              in
+                                                                                              __cereal__max_set_size_bytes
+                                                                                                (Thrift.genFieldBool
+                                                                                                   _proxy
+                                                                                                   "check_write_schema_id"
+                                                                                                   35
+                                                                                                   __id__max_set_size_bytes
+                                                                                                   __field__check_write_schema_id
+                                                                                                   :
+                                                                                                   case
+                                                                                                     __field__schema_location
+                                                                                                     of
+                                                                                                     Prelude.Just
+                                                                                                       _val -> Thrift.genField
+                                                                                                                 _proxy
+                                                                                                                 "schema_location"
+                                                                                                                 (Thrift.getStructType
+                                                                                                                    _proxy)
+                                                                                                                 36
+                                                                                                                 35
+                                                                                                                 (Thrift.buildStruct
+                                                                                                                    _proxy
+                                                                                                                    _val)
+                                                                                                                 :
+                                                                                                                 []
+                                                                                                     Prelude.Nothing -> [])))))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__retention <- ST.newSTRef Default.def
+            __field__restore <- ST.newSTRef Default.def
+            __field__close <- ST.newSTRef Default.def
+            __field__backup <- ST.newSTRef Default.def
+            __field__janitor_period <- ST.newSTRef Prelude.Nothing
+            __field__backup_list_sync_period <- ST.newSTRef 300
+            __field__default_max_results <- ST.newSTRef Prelude.Nothing
+            __field__default_max_bytes <- ST.newSTRef Prelude.Nothing
+            __field__default_max_time_ms <- ST.newSTRef Prelude.Nothing
+            __field__query_alloc_limit <- ST.newSTRef Prelude.Nothing
+            __field__logging_rate_limit <- ST.newSTRef 50
+            __field__db_writes_keep <- ST.newSTRef 1200
+            __field__db_writes_reap <- ST.newSTRef 300
+            __field__db_writer_threads <- ST.newSTRef 48
+            __field__db_write_queue_limit_mb <- ST.newSTRef 10000
+            __field__db_ptail_checkpoint_bytes <- ST.newSTRef 2000000000
+            __field__db_ptail_checkpoint_enabled <- ST.newSTRef Prelude.True
+            __field__db_rocksdb_cache_mb <- ST.newSTRef 8000
+            __field__db_lookup_cache_limit_mb <- ST.newSTRef 1000
+            __field__db_create_version <- ST.newSTRef Prelude.Nothing
+            __field__disable_predicate_dependency_checks <- ST.newSTRef
+                                                              Prelude.False
+            __field__compact_on_completion <- ST.newSTRef Prelude.False
+            __field__enable_schema_evolution <- ST.newSTRef Prelude.True
+            __field__min_db_age <- ST.newSTRef 0
+            __field__sharding <- ST.newSTRef
+                                   (ShardingPolicy_no_shards (Default.def :: NoShardsPolicy))
+            __field__use_schema_id <- ST.newSTRef Prelude.True
+            __field__db_rocksdb_cache_index_and_filter_blocks <- ST.newSTRef
+                                                                   Prelude.False
+            __field__strict_query_schema_id <- ST.newSTRef Prelude.False
+            __field__use_manifold_cli <- ST.newSTRef Prelude.True
+            __field__max_remote_db_list_age <- ST.newSTRef 600
+            __field__restore_timeout <- ST.newSTRef Prelude.Nothing
+            __field__max_set_size_bytes <- ST.newSTRef Prelude.Nothing
+            __field__check_write_schema_id <- ST.newSTRef Prelude.True
+            __field__schema_location <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__retention
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__restore
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__close
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__backup
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__janitor_period
+                                                                          (Prelude.Just _val)
+                                                                 21 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__backup_list_sync_period
+                                                                           _val
+                                                                 6 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__default_max_results
+                                                                          (Prelude.Just _val)
+                                                                 18 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__default_max_bytes
+                                                                           (Prelude.Just _val)
+                                                                 20 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__default_max_time_ms
+                                                                           (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__query_alloc_limit
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__logging_rate_limit
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__db_writes_keep
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_writes_reap
+                                                                           _val
+                                                                 11 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_writer_threads
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_write_queue_limit_mb
+                                                                           _val
+                                                                 13 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_ptail_checkpoint_bytes
+                                                                           _val
+                                                                 14 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__db_ptail_checkpoint_enabled
+                                                                           _val
+                                                                 15 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_rocksdb_cache_mb
+                                                                           _val
+                                                                 16 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI32
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__db_lookup_cache_limit_mb
+                                                                           _val
+                                                                 19 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.fmap
+                                                                                       DBVersion
+                                                                                       (Thrift.parseI64
+                                                                                          _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__db_create_version
+                                                                           (Prelude.Just _val)
+                                                                 22 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__disable_predicate_dependency_checks
+                                                                           _val
+                                                                 23 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__compact_on_completion
+                                                                           _val
+                                                                 24 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__enable_schema_evolution
+                                                                           _val
+                                                                 25 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__min_db_age
+                                                                           _val
+                                                                 26 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__sharding
+                                                                           _val
+                                                                 27 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__use_schema_id
+                                                                           _val
+                                                                 28 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__db_rocksdb_cache_index_and_filter_blocks
+                                                                           _val
+                                                                 29 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__strict_query_schema_id
+                                                                           _val
+                                                                 30 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__use_manifold_cli
+                                                                           _val
+                                                                 31 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__max_remote_db_list_age
+                                                                           _val
+                                                                 33 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__restore_timeout
+                                                                           (Prelude.Just _val)
+                                                                 34 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__max_set_size_bytes
+                                                                           (Prelude.Just _val)
+                                                                 35 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__check_write_schema_id
+                                                                           _val
+                                                                 36 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__schema_location
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__retention <- ST.readSTRef
+                                                                    __field__retention
+                                             !__val__restore <- ST.readSTRef __field__restore
+                                             !__val__close <- ST.readSTRef __field__close
+                                             !__val__backup <- ST.readSTRef __field__backup
+                                             !__val__janitor_period <- ST.readSTRef
+                                                                         __field__janitor_period
+                                             !__val__backup_list_sync_period <- ST.readSTRef
+                                                                                  __field__backup_list_sync_period
+                                             !__val__default_max_results <- ST.readSTRef
+                                                                              __field__default_max_results
+                                             !__val__default_max_bytes <- ST.readSTRef
+                                                                            __field__default_max_bytes
+                                             !__val__default_max_time_ms <- ST.readSTRef
+                                                                              __field__default_max_time_ms
+                                             !__val__query_alloc_limit <- ST.readSTRef
+                                                                            __field__query_alloc_limit
+                                             !__val__logging_rate_limit <- ST.readSTRef
+                                                                             __field__logging_rate_limit
+                                             !__val__db_writes_keep <- ST.readSTRef
+                                                                         __field__db_writes_keep
+                                             !__val__db_writes_reap <- ST.readSTRef
+                                                                         __field__db_writes_reap
+                                             !__val__db_writer_threads <- ST.readSTRef
+                                                                            __field__db_writer_threads
+                                             !__val__db_write_queue_limit_mb <- ST.readSTRef
+                                                                                  __field__db_write_queue_limit_mb
+                                             !__val__db_ptail_checkpoint_bytes <- ST.readSTRef
+                                                                                    __field__db_ptail_checkpoint_bytes
+                                             !__val__db_ptail_checkpoint_enabled <- ST.readSTRef
+                                                                                      __field__db_ptail_checkpoint_enabled
+                                             !__val__db_rocksdb_cache_mb <- ST.readSTRef
+                                                                              __field__db_rocksdb_cache_mb
+                                             !__val__db_lookup_cache_limit_mb <- ST.readSTRef
+                                                                                   __field__db_lookup_cache_limit_mb
+                                             !__val__db_create_version <- ST.readSTRef
+                                                                            __field__db_create_version
+                                             !__val__disable_predicate_dependency_checks <- ST.readSTRef
+                                                                                              __field__disable_predicate_dependency_checks
+                                             !__val__compact_on_completion <- ST.readSTRef
+                                                                                __field__compact_on_completion
+                                             !__val__enable_schema_evolution <- ST.readSTRef
+                                                                                  __field__enable_schema_evolution
+                                             !__val__min_db_age <- ST.readSTRef __field__min_db_age
+                                             !__val__sharding <- ST.readSTRef __field__sharding
+                                             !__val__use_schema_id <- ST.readSTRef
+                                                                        __field__use_schema_id
+                                             !__val__db_rocksdb_cache_index_and_filter_blocks <- ST.readSTRef
+                                                                                                   __field__db_rocksdb_cache_index_and_filter_blocks
+                                             !__val__strict_query_schema_id <- ST.readSTRef
+                                                                                 __field__strict_query_schema_id
+                                             !__val__use_manifold_cli <- ST.readSTRef
+                                                                           __field__use_manifold_cli
+                                             !__val__max_remote_db_list_age <- ST.readSTRef
+                                                                                 __field__max_remote_db_list_age
+                                             !__val__restore_timeout <- ST.readSTRef
+                                                                          __field__restore_timeout
+                                             !__val__max_set_size_bytes <- ST.readSTRef
+                                                                             __field__max_set_size_bytes
+                                             !__val__check_write_schema_id <- ST.readSTRef
+                                                                                __field__check_write_schema_id
+                                             !__val__schema_location <- ST.readSTRef
+                                                                          __field__schema_location
+                                             Prelude.pure
+                                               (Config __val__retention __val__restore __val__close
+                                                  __val__backup
+                                                  __val__janitor_period
+                                                  __val__backup_list_sync_period
+                                                  __val__default_max_results
+                                                  __val__default_max_bytes
+                                                  __val__default_max_time_ms
+                                                  __val__query_alloc_limit
+                                                  __val__logging_rate_limit
+                                                  __val__db_writes_keep
+                                                  __val__db_writes_reap
+                                                  __val__db_writer_threads
+                                                  __val__db_write_queue_limit_mb
+                                                  __val__db_ptail_checkpoint_bytes
+                                                  __val__db_ptail_checkpoint_enabled
+                                                  __val__db_rocksdb_cache_mb
+                                                  __val__db_lookup_cache_limit_mb
+                                                  __val__db_create_version
+                                                  __val__disable_predicate_dependency_checks
+                                                  __val__compact_on_completion
+                                                  __val__enable_schema_evolution
+                                                  __val__min_db_age
+                                                  __val__sharding
+                                                  __val__use_schema_id
+                                                  __val__db_rocksdb_cache_index_and_filter_blocks
+                                                  __val__strict_query_schema_id
+                                                  __val__use_manifold_cli
+                                                  __val__max_remote_db_list_age
+                                                  __val__restore_timeout
+                                                  __val__max_set_size_bytes
+                                                  __val__check_write_schema_id
+                                                  __val__schema_location)
+              _idMap
+                = HashMap.fromList
+                    [("retention", 1), ("restore", 2), ("close", 3), ("backup", 4),
+                     ("janitor_period", 5), ("backup_list_sync_period", 21),
+                     ("default_max_results", 6), ("default_max_bytes", 18),
+                     ("default_max_time_ms", 20), ("query_alloc_limit", 7),
+                     ("logging_rate_limit", 8), ("db_writes_keep", 9),
+                     ("db_writes_reap", 10), ("db_writer_threads", 11),
+                     ("db_write_queue_limit_mb", 12), ("db_ptail_checkpoint_bytes", 13),
+                     ("db_ptail_checkpoint_enabled", 14), ("db_rocksdb_cache_mb", 15),
+                     ("db_lookup_cache_limit_mb", 16), ("db_create_version", 19),
+                     ("disable_predicate_dependency_checks", 22),
+                     ("compact_on_completion", 23), ("enable_schema_evolution", 24),
+                     ("min_db_age", 25), ("sharding", 26), ("use_schema_id", 27),
+                     ("db_rocksdb_cache_index_and_filter_blocks", 28),
+                     ("strict_query_schema_id", 29), ("use_manifold_cli", 30),
+                     ("max_remote_db_list_age", 31), ("restore_timeout", 33),
+                     ("max_set_size_bytes", 34), ("check_write_schema_id", 35),
+                     ("schema_location", 36)]
+            _parse 0)
+
+instance DeepSeq.NFData Config where
+  rnf
+    (Config __field__retention __field__restore __field__close
+       __field__backup __field__janitor_period
+       __field__backup_list_sync_period __field__default_max_results
+       __field__default_max_bytes __field__default_max_time_ms
+       __field__query_alloc_limit __field__logging_rate_limit
+       __field__db_writes_keep __field__db_writes_reap
+       __field__db_writer_threads __field__db_write_queue_limit_mb
+       __field__db_ptail_checkpoint_bytes
+       __field__db_ptail_checkpoint_enabled __field__db_rocksdb_cache_mb
+       __field__db_lookup_cache_limit_mb __field__db_create_version
+       __field__disable_predicate_dependency_checks
+       __field__compact_on_completion __field__enable_schema_evolution
+       __field__min_db_age __field__sharding __field__use_schema_id
+       __field__db_rocksdb_cache_index_and_filter_blocks
+       __field__strict_query_schema_id __field__use_manifold_cli
+       __field__max_remote_db_list_age __field__restore_timeout
+       __field__max_set_size_bytes __field__check_write_schema_id
+       __field__schema_location)
+    = DeepSeq.rnf __field__retention `Prelude.seq`
+        DeepSeq.rnf __field__restore `Prelude.seq`
+          DeepSeq.rnf __field__close `Prelude.seq`
+            DeepSeq.rnf __field__backup `Prelude.seq`
+              DeepSeq.rnf __field__janitor_period `Prelude.seq`
+                DeepSeq.rnf __field__backup_list_sync_period `Prelude.seq`
+                  DeepSeq.rnf __field__default_max_results `Prelude.seq`
+                    DeepSeq.rnf __field__default_max_bytes `Prelude.seq`
+                      DeepSeq.rnf __field__default_max_time_ms `Prelude.seq`
+                        DeepSeq.rnf __field__query_alloc_limit `Prelude.seq`
+                          DeepSeq.rnf __field__logging_rate_limit `Prelude.seq`
+                            DeepSeq.rnf __field__db_writes_keep `Prelude.seq`
+                              DeepSeq.rnf __field__db_writes_reap `Prelude.seq`
+                                DeepSeq.rnf __field__db_writer_threads `Prelude.seq`
+                                  DeepSeq.rnf __field__db_write_queue_limit_mb `Prelude.seq`
+                                    DeepSeq.rnf __field__db_ptail_checkpoint_bytes `Prelude.seq`
+                                      DeepSeq.rnf __field__db_ptail_checkpoint_enabled `Prelude.seq`
+                                        DeepSeq.rnf __field__db_rocksdb_cache_mb `Prelude.seq`
+                                          DeepSeq.rnf __field__db_lookup_cache_limit_mb
+                                            `Prelude.seq`
+                                            DeepSeq.rnf __field__db_create_version `Prelude.seq`
+                                              DeepSeq.rnf
+                                                __field__disable_predicate_dependency_checks
+                                                `Prelude.seq`
+                                                DeepSeq.rnf __field__compact_on_completion
+                                                  `Prelude.seq`
+                                                  DeepSeq.rnf __field__enable_schema_evolution
+                                                    `Prelude.seq`
+                                                    DeepSeq.rnf __field__min_db_age `Prelude.seq`
+                                                      DeepSeq.rnf __field__sharding `Prelude.seq`
+                                                        DeepSeq.rnf __field__use_schema_id
+                                                          `Prelude.seq`
+                                                          DeepSeq.rnf
+                                                            __field__db_rocksdb_cache_index_and_filter_blocks
+                                                            `Prelude.seq`
+                                                            DeepSeq.rnf
+                                                              __field__strict_query_schema_id
+                                                              `Prelude.seq`
+                                                              DeepSeq.rnf __field__use_manifold_cli
+                                                                `Prelude.seq`
+                                                                DeepSeq.rnf
+                                                                  __field__max_remote_db_list_age
+                                                                  `Prelude.seq`
+                                                                  DeepSeq.rnf
+                                                                    __field__restore_timeout
+                                                                    `Prelude.seq`
+                                                                    DeepSeq.rnf
+                                                                      __field__max_set_size_bytes
+                                                                      `Prelude.seq`
+                                                                      DeepSeq.rnf
+                                                                        __field__check_write_schema_id
+                                                                        `Prelude.seq`
+                                                                        DeepSeq.rnf
+                                                                          __field__schema_location
+                                                                          `Prelude.seq` ()
+
+instance Default.Default Config where
+  def
+    = Config Default.def Default.def Default.def Default.def
+        Prelude.Nothing
+        300
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        50
+        1200
+        300
+        48
+        10000
+        2000000000
+        Prelude.True
+        8000
+        1000
+        Prelude.Nothing
+        Prelude.False
+        Prelude.False
+        Prelude.True
+        0
+        (ShardingPolicy_no_shards (Default.def :: NoShardsPolicy))
+        Prelude.True
+        Prelude.False
+        Prelude.False
+        Prelude.True
+        600
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.True
+        Prelude.Nothing
+
+instance Hashable.Hashable Config where
+  hashWithSalt __salt
+    (Config _retention _restore _close _backup _janitor_period
+       _backup_list_sync_period _default_max_results _default_max_bytes
+       _default_max_time_ms _query_alloc_limit _logging_rate_limit
+       _db_writes_keep _db_writes_reap _db_writer_threads
+       _db_write_queue_limit_mb _db_ptail_checkpoint_bytes
+       _db_ptail_checkpoint_enabled _db_rocksdb_cache_mb
+       _db_lookup_cache_limit_mb _db_create_version
+       _disable_predicate_dependency_checks _compact_on_completion
+       _enable_schema_evolution _min_db_age _sharding _use_schema_id
+       _db_rocksdb_cache_index_and_filter_blocks _strict_query_schema_id
+       _use_manifold_cli _max_remote_db_list_age _restore_timeout
+       _max_set_size_bytes _check_write_schema_id _schema_location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt
+                                   (Hashable.hashWithSalt
+                                      (Hashable.hashWithSalt
+                                         (Hashable.hashWithSalt
+                                            (Hashable.hashWithSalt
+                                               (Hashable.hashWithSalt
+                                                  (Hashable.hashWithSalt
+                                                     (Hashable.hashWithSalt
+                                                        (Hashable.hashWithSalt
+                                                           (Hashable.hashWithSalt
+                                                              (Hashable.hashWithSalt
+                                                                 (Hashable.hashWithSalt
+                                                                    (Hashable.hashWithSalt
+                                                                       (Hashable.hashWithSalt
+                                                                          (Hashable.hashWithSalt
+                                                                             (Hashable.hashWithSalt
+                                                                                (Hashable.hashWithSalt
+                                                                                   (Hashable.hashWithSalt
+                                                                                      (Hashable.hashWithSalt
+                                                                                         (Hashable.hashWithSalt
+                                                                                            (Hashable.hashWithSalt
+                                                                                               (Hashable.hashWithSalt
+                                                                                                  (Hashable.hashWithSalt
+                                                                                                     (Hashable.hashWithSalt
+                                                                                                        (Hashable.hashWithSalt
+                                                                                                           __salt
+                                                                                                           _retention)
+                                                                                                        _restore)
+                                                                                                     _close)
+                                                                                                  _backup)
+                                                                                               _janitor_period)
+                                                                                            _backup_list_sync_period)
+                                                                                         _default_max_results)
+                                                                                      _default_max_bytes)
+                                                                                   _default_max_time_ms)
+                                                                                _query_alloc_limit)
+                                                                             _logging_rate_limit)
+                                                                          _db_writes_keep)
+                                                                       _db_writes_reap)
+                                                                    _db_writer_threads)
+                                                                 _db_write_queue_limit_mb)
+                                                              _db_ptail_checkpoint_bytes)
+                                                           _db_ptail_checkpoint_enabled)
+                                                        _db_rocksdb_cache_mb)
+                                                     _db_lookup_cache_limit_mb)
+                                                  _db_create_version)
+                                               _disable_predicate_dependency_checks)
+                                            _compact_on_completion)
+                                         _enable_schema_evolution)
+                                      _min_db_age)
+                                   _sharding)
+                                _use_schema_id)
+                             _db_rocksdb_cache_index_and_filter_blocks)
+                          _strict_query_schema_id)
+                       _use_manifold_cli)
+                    _max_remote_db_list_age)
+                 _restore_timeout)
+              _max_set_size_bytes)
+           _check_write_schema_id)
+        _schema_location
+
+type Set_RepoName_8170 = HashSet.HashSet RepoName
diff --git a/glean/cpp/filewriter.cpp b/glean/cpp/filewriter.cpp
new file mode 100644
--- /dev/null
+++ b/glean/cpp/filewriter.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/cpp/filewriter.h"
+#include "glean/cpp/glean.h"
+#include "glean/cpp/sender.h"
+#include "glean/rts/serialize.h"
+
+#include <folly/FileUtil.h>
+
+namespace facebook {
+namespace glean {
+
+namespace {
+
+using namespace facebook::glean::cpp;
+using namespace facebook::glean::rts;
+
+class FileWriter : public Sender {
+ public:
+  explicit FileWriter(std::string p) : path(std::move(p)) {}
+
+  void rebaseAndSend(BatchBase&, bool) override {
+    // don't do anything
+    // NOTE: we ignore the 'wait' flag for now
+  }
+
+  void flush(BatchBase& batch) override {
+    auto r = batch.serialize();
+    binary::Output out;
+    // Serialize as facebook::glean::thrift::Batch without using fbthrift. These
+    // field numbers and types must match those in glean.thrift.
+    serialize::thriftcompact::put(
+        out,
+        {
+            {1, r.first.toThrift()},
+            {2, static_cast<int64_t>(r.count)},
+            {3, folly::ByteRange(r.facts.data(), r.facts.size())},
+            {5, batch.serializeOwnership()},
+            {7, batch.getSchemaId()},
+        });
+    folly::writeFile(folly::ByteRange(out.data(), out.size()), path.c_str());
+  }
+
+ private:
+  std::string path;
+};
+
+} // namespace
+
+std::unique_ptr<Sender> fileWriter(std::string path) {
+  return std::make_unique<FileWriter>(std::move(path));
+}
+
+} // namespace glean
+} // namespace facebook
diff --git a/glean/cpp/filewriter.h b/glean/cpp/filewriter.h
new file mode 100644
--- /dev/null
+++ b/glean/cpp/filewriter.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <glean/cpp/sender.h>
+
+namespace facebook {
+namespace glean {
+
+// A Sender which dumps all data into a file. This happens on the final flush,
+// rebaseAndSend is a noop. This is mostly useful for testing.
+std::unique_ptr<Sender> fileWriter(std::string path);
+
+} // namespace glean
+} // namespace facebook
diff --git a/glean/cpp/glean.cpp b/glean/cpp/glean.cpp
new file mode 100644
--- /dev/null
+++ b/glean/cpp/glean.cpp
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/cpp/glean.h"
+#include <folly/gen/Base.h>
+#include <algorithm>
+#include <iterator>
+#include "glean/rts/sanity.h"
+
+namespace facebook {
+namespace glean {
+namespace cpp {
+
+BatchBase::BatchBase(
+    const SchemaInventory* inv,
+    size_t cache_capacity,
+    std::string schemaId)
+    : inventory(inv),
+      stats(std::make_shared<rts::LookupCache::Stats>()),
+      cache(
+          rts::LookupCache::Options{
+              cache_capacity,
+              0 // disable deferred LRU list manipulation
+          },
+          stats),
+      anchor(&rts::EmptyLookup::instance(), &cache),
+      buffer(Id::lowest()),
+      facts(&anchor, &buffer),
+      schemaId(std::move(schemaId)) {}
+
+rts::FactSet::Serialized BatchBase::serialize() const {
+  return buffer.serialize();
+}
+
+std::map<std::string, std::vector<int64_t>> BatchBase::serializeOwnership()
+    const {
+  std::map<std::string, std::vector<int64_t>> ow;
+  for (const auto& p : owned) {
+    std::vector<int64_t> ids;
+    ids.reserve(p.facts.iterative_size() * 2);
+    for (auto ival : p.facts) {
+      ids.push_back(ival.lower().toThrift());
+      ids.push_back(ival.upper().toThrift());
+    }
+    ow.insert({p.unit, std::move(ids)});
+  }
+  // it's possible that ow.size() != owned.size() here. If we indexed
+  // the same file multiple times, then we would have ownership data
+  // for the same unit occurring multiple times in the owned deque.
+  last_serialized_units = owned.size();
+  total_serialized_units += owned.size();
+  return ow;
+}
+
+void BatchBase::clearOwnership() {
+  owned.clear();
+}
+
+void BatchBase::rebase(const rts::Substitution& subst) {
+  GLEAN_SANITY_CHECK(subst.sanityCheck(false));
+  std::unique_ptr<rts::Substitution> usubst;
+  cache.withBulkStore([&](auto& store) {
+    auto r = buffer.rebase(inventory->inventory, subst, store);
+    buffer = std::move(r.first);
+    usubst = std::make_unique<rts::Substitution>(std::move(r.second));
+    facts = rts::Stacked<rts::Define>(&anchor, &buffer);
+  });
+  GLEAN_SANITY_CHECK(buffer.sanityCheck());
+
+  for (auto& p : owned) {
+    p.facts = usubst->substIntervals(p.facts);
+  }
+}
+
+BatchBase::CacheStats BatchBase::cacheStats() {
+  auto values = stats->read();
+  CacheStats res;
+  res.facts = FactStats{
+      values[rts::LookupCache::Stats::factBytes],
+      values[rts::LookupCache::Stats::factCount]};
+  res.hits = values[rts::LookupCache::Stats::idByKey_hits] +
+      values[rts::LookupCache::Stats::typeById_hits] +
+      values[rts::LookupCache::Stats::factById_hits];
+  res.misses = values[rts::LookupCache::Stats::idByKey_misses] +
+      values[rts::LookupCache::Stats::idByKey_failures] +
+      values[rts::LookupCache::Stats::typeById_misses] +
+      values[rts::LookupCache::Stats::typeById_failures] +
+      values[rts::LookupCache::Stats::factById_misses] +
+      values[rts::LookupCache::Stats::factById_failures];
+  return res;
+}
+
+void BatchBase::beginUnit(std::string unit) {
+  owned.push_back({std::move(unit), {}, buffer.firstFreeId(), Id::invalid()});
+  current = &owned.back();
+}
+
+/*
+  Minimizing ownership data
+
+  We start with all the facts produced for a translation unit in a single
+  ownership interval
+
+  [A, B)
+
+  The fact batch goes through a few rounds of de-duplication on its
+  way to the DB. If we end up de-duplicating some of the facts, the ownership
+  data remains, so we end up with
+
+  [a,b) [c,d) [e,f) [A, B)
+
+  large numbers of intervals are expensive to process each time we de-duplicate
+  this batch.
+
+  So what we do is to partition the facts into two: "root" facts that are not
+  reachable from any other fact, and facts that are reachable. As long as the
+  root facts are covered by ownership, we don't need to cover the reachable
+  facts since the ownership will be automatically propagated by the server
+  later. We sort the facts so that the root facts are all together, meaning
+  we still have a single ownership interval for the batch.
+
+  By having fewer facts covered by ownership, we will have fewer
+  ownership intervals to process. This speeds up writing, and also results in
+  less ownership data to process on the server during the propagation phase.
+ */
+std::pair<rts::closed_interval_set<Id>, rts::FactSet> minimalOwnership(
+    const rts::Inventory& inventory,
+    rts::FactSet& facts,
+    rts::LookupCache::Anchor& anchor,
+    Id start,
+    Id end) {
+  rts::closed_interval_set<Id> owned;
+  owned.add({start, end - 1});
+
+  // iterate through the facts in reverse order
+  // remove referenced facts from the interval_set
+  {
+    const auto eachRef = rts::syscall([&owned, start, end](Id id, Pid) {
+      if (id >= start && id < end) {
+        owned.erase(id);
+      }
+    });
+
+    auto it = facts.enumerateBack(end, start);
+    while (auto fact = it->get()) {
+      const auto* predicate = inventory.lookupPredicate(fact.type);
+      assert(predicate);
+      predicate->traverse(eachRef, fact.clause);
+      it->next();
+    }
+  }
+
+  rts::FactSet new_buffer(facts.startingId());
+  rts::Stacked<rts::Define> new_facts(&anchor, &new_buffer);
+  rts::MutableSubstitution subst(facts.startingId(), facts.size());
+
+  auto rename =
+      rts::Predicate::Rename([&](Id id, Pid) { return subst.subst(id); });
+
+  auto addFact = [&](Id id) {
+    facts.factById(id, [&](Pid type, rts::Fact::Clause fact) {
+      if (const auto* predicate = inventory.lookupPredicate(type)) {
+        binary::Output out;
+        uint64_t key_size;
+        predicate->typecheck(rename, fact, out, key_size);
+        const auto clause = rts::Fact::Clause::from(out.bytes(), key_size);
+        auto new_id = new_facts.define(type, clause, Id::invalid());
+        CHECK(new_id != Id::invalid());
+        subst.set(id, new_id);
+      } else {
+        error("invalid predicate id {}", type);
+      }
+    });
+  };
+
+  // first add all the facts that are not owned
+  {
+    Id last = facts.startingId();
+    auto it = owned.begin();
+    if (it != owned.end()) {
+      // up to the first owned fact, we can just copy because the substitution
+      // is the identity
+      for (auto id = last; id < it->lower(); id++) {
+        facts.factById(id, [&](Pid type, rts::Fact::Clause fact) {
+          auto new_id = new_facts.define(type, fact, Id::invalid());
+          CHECK(new_id != Id::invalid());
+          subst.set(id, new_id);
+        });
+      }
+      last = it->upper() + 1;
+
+      it++;
+      for (; it != owned.end(); it++) {
+        for (auto id = last; id < it->lower(); id++) {
+          addFact(id);
+        }
+        last = it->upper() + 1;
+      }
+    }
+    for (auto id = last; id < facts.firstFreeId(); id++) {
+      addFact(id);
+    }
+  }
+
+  // next add all the facts that are owned, so we have one interval
+  auto owned_start = new_facts.firstFreeId();
+  for (auto it = owned.begin(); it != owned.end(); it++) {
+    for (auto id = it->lower(); id <= it->upper(); id++) {
+      addFact(id);
+    }
+  }
+  auto owned_end = new_facts.firstFreeId();
+
+  rts::closed_interval_set<Id> res;
+  res.add({owned_start, owned_end - 1});
+  return std::make_pair(std::move(res), std::move(new_buffer));
+}
+
+void BatchBase::endUnit() {
+  if (current) {
+    current->finish = buffer.firstFreeId();
+    if (current->finish > current->start) {
+      auto p = minimalOwnership(
+          inventory->inventory,
+          buffer,
+          anchor,
+          current->start,
+          current->finish);
+      current->facts = std::move(p.first);
+      buffer = std::move(p.second);
+    }
+    LOG(INFO) << current->unit << ": " << current->facts.size() << " / "
+              << current->facts.iterative_size();
+    current = nullptr;
+    ++seen_units;
+
+  } else {
+    LOG(ERROR) << "mismatched endUnit";
+  }
+}
+
+Id BatchBase::define(Pid ty, rts::Fact::Clause clause) {
+  return facts.define(ty, clause);
+}
+
+void BatchBase::logEnd() const {
+  LOG(INFO) << "saw " << seen_units << " units, serialized "
+            << total_serialized_units;
+}
+
+} // namespace cpp
+} // namespace glean
+} // namespace facebook
diff --git a/glean/cpp/glean.h b/glean/cpp/glean.h
new file mode 100644
--- /dev/null
+++ b/glean/cpp/glean.h
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+/*
+ * A very simple types C++ interface to Glean batches.
+ *
+ */
+
+#pragma once
+
+#include <boost/icl/interval_set.hpp>
+#include <boost/operators.hpp>
+#include <boost/variant.hpp>
+#include <folly/Format.h>
+#include <tuple>
+
+#include "glean/rts/binary.h"
+#include "glean/rts/cache.h"
+#include "glean/rts/id.h"
+#include "glean/rts/inventory.h"
+#include "glean/rts/stacked.h"
+#include "glean/rts/substitution.h"
+
+namespace facebook {
+namespace glean {
+namespace cpp {
+
+using rts::Id;
+using rts::Pid;
+
+// There are two kinds of types:
+//   * Representation types
+//   * Value types
+//
+// Representation Types
+// --------------------
+//
+// These aren't real values, they're just tags which can be filled
+// by different types. For instance, a Tuple<Nat,Nat> might be filled by
+// std::tuple<uint64_t, size_t> and an Array<Byte> might be filled by
+// std::string, fbstring etc.
+//
+// The following types are supported:
+//
+// Byte                 bytes
+//
+// Nat                  packed natural numbers (up to 64 bits)
+//
+// Array<T>             arrays
+//
+//  Tuple<...>           tuples
+//   Unit = Tuple<>
+//
+// Sum<...>             sum types
+//   Maybe<T> = Sum<Unit,T>
+//
+// Enum<N>              enums with range N
+//                      (map to sums underneath)
+//   Bool = Enum<2>
+//
+// Predicates, e.g.:
+//     struct Foo : Predicate<KeyType, ValueType> {
+//       static const char *name() { return "Foo"; }
+//     };
+//     NOTE: KeyType and ValueType are *value* types. This is to
+//     increase type safety when constructing facts: in fact<P>(x),
+//     x must have the right type, not just the right shape.
+//
+//
+// Value Types
+// -----------
+//
+// Value types are inhabited instances of representation types.
+// A value type has a single representation type, however there
+// are multiple possible value types for a given representation.
+// e.g. for the representation Array<Byte>, value types might be
+// std::string or std::vector<uint8_t>.
+//
+// std::vector<T>
+//   value type corresponding to Array<Repr<T>>
+//
+// std::tuple<Xs...>
+//   value type corresponding to Tuple<Repr<Xs>...>
+//
+// facts
+//    Fact<P> is a reference to a fact of predicate P
+//
+// enumerated types
+//    enum class Foo { thing1, thing2 };
+//    template<> struct Repr_<Foo> {
+//      using Type = Enum<2>;
+//    }
+//
+// user-defined         arbitrary types which map to any representation type
+//    struct Foo {
+//      uint64_t x,y;
+//      void outputRepr(Output<Repr<Foo>> output) const {
+//        outputValue(output, std::make_pair(x,y));
+//      }
+//    };
+//    template<> struct Repr_<Foo> {
+//      using Type = Tuple<Nat,Nat>;
+//    }
+//
+//
+// The Repr<T> template
+// --------------------
+//
+// Repr<V> is the representation type corresponding to the
+// value type V.
+//
+// Repr<V> is defined for:
+//   * user-defined structs
+//   * enumerated types
+
+template <typename T>
+struct Repr_;
+
+// Convenience:
+template <typename T>
+using Repr = typename Repr_<T>::Type;
+
+struct Byte;
+
+template <>
+struct Repr_<unsigned char> {
+  using Type = Byte;
+};
+
+struct Nat;
+
+template <>
+struct Repr_<unsigned long> {
+  using Type = Nat;
+};
+template <>
+struct Repr_<unsigned long long> {
+  using Type = Nat;
+};
+
+struct String;
+
+template <>
+struct Repr_<std::string> {
+  using Type = String;
+};
+
+template <typename T>
+struct Array;
+
+template <typename T>
+struct Repr_<std::vector<T>> {
+  using Type = Array<Repr<T>>;
+};
+
+template <typename T>
+struct Set;
+
+template <typename T>
+struct Repr_<std::set<T>> {
+  using Type = Set<Repr<T>>;
+};
+
+template <typename... Ts>
+struct Tuple;
+using Unit = Tuple<>;
+
+template <typename... Ts>
+struct Repr_<std::tuple<Ts...>> {
+  using Type = Tuple<Repr<Ts>...>;
+};
+
+template <typename... Ts>
+struct Sum;
+template <typename T>
+using Maybe = Sum<Unit, T>;
+
+template <size_t i, typename T>
+struct Alt : private boost::operators<Alt<i, T>> {
+  T value;
+  explicit Alt(const T& x) : value(x) {}
+  explicit Alt(T&& x) : value(std::forward<T>(x)) {}
+
+  bool operator==(const Alt& other) const {
+    return value == other.value;
+  }
+
+  bool operator<(const Alt& other) const {
+    return value < other.value;
+  }
+};
+
+template <size_t... is, typename... Ts>
+struct Repr_<boost::variant<Alt<is, Ts>...>> {
+  using Type = Sum<Repr<Ts>...>;
+};
+
+template <size_t i, typename T>
+Alt<i, std::decay_t<T>> alt(T&& x) {
+  return Alt<i, std::decay_t<T>>(std::forward<T>(x));
+}
+
+inline Alt<0, std::tuple<>> nothing() {
+  return alt<0>(std::make_tuple());
+}
+
+template <typename T>
+Alt<1, std::decay_t<T>> just(T&& x) {
+  return alt<1>(std::forward<T>(x));
+}
+
+template <typename T>
+using maybe_type = boost::variant<Alt<0, std::tuple<>>, Alt<1, T>>;
+
+template <typename T>
+maybe_type<T> maybe(const folly::Optional<T>& x) {
+  if (x) {
+    return alt<1>(x.value());
+  } else {
+    return alt<0>(std::make_tuple());
+  }
+}
+
+// Enums - a special case of sums
+//
+// T is the actual value type, N is the range of the enum
+template <size_t N>
+struct Enum {};
+using Bool = Enum<2>;
+template <>
+struct Repr_<bool> {
+  using Type = Bool;
+};
+
+// Predicates
+//
+// Predicates are type tags. Fact<P> (see below) is the corresponding value.
+//
+// A predicate is reflected into C++ as follows:
+//
+// struct Foo : Predicate<Tuple<Nat,Nat>> {
+//   static const char *name() { return "foo"; }
+// };
+//
+// struct Bar : Predicate<Foo,Array<Byte>> {
+//   static const char *name() { return "bar"; }
+// };
+//
+template <typename Key, typename Value = std::tuple<>>
+struct Predicate {
+  using KeyType = Key;
+  using ValueType = Value;
+};
+
+// Facts
+template <typename P>
+struct Fact : private boost::operators<Fact<P>> {
+  Id getId() const {
+    return id;
+  }
+
+  bool operator==(const Fact& other) const {
+    return id == other.id;
+  }
+
+  bool operator<(const Fact& other) const {
+    return id < other.id;
+  }
+
+ private:
+  template <typename Schema>
+  friend class Batch;
+  explicit Fact(Id i) : id(i) {}
+  Id id;
+};
+
+// The representation type of a Fact is its predicate:
+template <typename P>
+struct Repr_<Fact<P>> {
+  using Type = P;
+};
+
+// Typed value output buffers
+template <typename T>
+struct Output {
+  binary::Output& output;
+
+  explicit Output(binary::Output& o) : output(o) {}
+};
+
+template <typename T, typename U>
+Output<T> unsafeAs(Output<U> o) {
+  return Output<T>(o.output);
+}
+
+inline void outputValue(Output<Byte> o, uint8_t x) {
+  o.output.fixed(x);
+}
+
+inline void outputValue(Output<Nat> o, uint64_t x) {
+  o.output.packed(x);
+}
+
+inline void outputValue(Output<String> o, const std::string& s) {
+  // TODO: Validate UTF-8?
+  o.output.mangleString(binary::byteRange(s));
+}
+
+template <typename T, typename U>
+void outputValue(Output<Array<T>> o, std::initializer_list<U> xs) {
+  o.output.packed(xs.size());
+  for (const auto& x : xs) {
+    outputValue(unsafeAs<T>(o), x);
+  }
+}
+
+template <typename T, typename U>
+void outputValue(Output<Array<T>> o, const std::vector<U>& xs) {
+  o.output.packed(xs.size());
+  for (const auto& x : xs) {
+    outputValue(unsafeAs<T>(o), x);
+  }
+}
+
+template <typename T, typename Iter>
+void outputValue(Output<Array<T>> o, const folly::Range<Iter>& range) {
+  o.output.packed(range.size());
+  for (const auto& x : range) {
+    outputValue(unsafeAs<T>(o), x);
+  }
+}
+
+inline void outputValue(Output<Array<Byte>> o, folly::ByteRange r) {
+  o.output.packed(r.size());
+  o.output.put(r);
+}
+
+inline void outputValue(Output<Array<Byte>> o, const std::string& s) {
+  outputValue(o, binary::byteRange(s));
+}
+
+inline void outputValue(Output<Array<Byte>> o, const folly::fbstring& s) {
+  outputValue(o, binary::byteRange(s));
+}
+
+template <typename T, typename U>
+inline void outputValue(Output<Set<T>> o, const std::set<U>& xs) {
+  o.output.packed(xs.size());
+  for (const auto& x : xs) {
+    outputValue(unsafeAs<T>(o), x);
+  }
+}
+
+namespace detail {
+
+template <size_t i, typename U>
+void outputValues(binary::Output&, const U&) {}
+
+template <size_t i, typename U, typename T, typename... Ts>
+void outputValues(binary::Output& output, const U& u) {
+  outputValue(Output<T>(output), std::get<i>(u));
+  outputValues<i + 1, U, Ts...>(output, u);
+}
+
+} // namespace detail
+
+template <
+    typename... Ts,
+    typename... Us,
+    typename = std::enable_if_t<sizeof...(Ts) == sizeof...(Us)>>
+void outputValue(Output<Tuple<Ts...>> o, const std::tuple<Us...>& xs) {
+  detail::outputValues<0, std::tuple<Us...>, Ts...>(o.output, xs);
+}
+
+template <
+    size_t i,
+    typename U,
+    typename... Ts,
+    typename = std::enable_if_t<i<sizeof...(Ts)>> void
+        outputValue(Output<Sum<Ts...>> o, const Alt<i, U>& alt) {
+  o.output.packed(i);
+  outputValue(
+      unsafeAs<typename std::tuple_element<i, std::tuple<Ts...>>::type>(o),
+      alt.value);
+}
+
+namespace {
+
+template <typename... Ts>
+struct OutputAlt : public boost::static_visitor<void> {
+  explicit OutputAlt(Output<Sum<Ts...>> o) : out(o) {}
+
+  template <size_t i, typename U>
+  void operator()(const Alt<i, U>& alt) const {
+    outputValue(out, alt);
+  }
+
+  Output<Sum<Ts...>> out;
+};
+
+} // namespace
+
+template <
+    typename... Ts,
+    typename... Us,
+    typename = std::enable_if_t<sizeof...(Ts) == sizeof...(Us)>>
+void outputValue(Output<Sum<Ts...>> o, const boost::variant<Us...>& v) {
+  boost::apply_visitor(OutputAlt<Ts...>(o), v);
+}
+
+template <typename T, typename U>
+void outputValue(Output<Sum<Unit, T>> o, const folly::Optional<U>& x) {
+  if (x) {
+    o.output.packed(1);
+    outputValue(unsafeAs<T>(o), x.value());
+  } else {
+    o.output.packed(0);
+  }
+}
+
+template <typename T>
+void outputValue(Output<Sum<Unit, T>> o, folly::None) {
+  o.output.packed(0);
+}
+
+template <typename T, size_t N>
+void outputValue(Output<Enum<N>> o, T x) {
+  uint64_t n = static_cast<uint64_t>(x);
+  assert(n < N);
+  outputValue(unsafeAs<Nat>(o), n);
+}
+
+template <typename P>
+void outputValue(Output<P> o, Fact<P> fact) {
+  o.output.packed(fact.getId());
+}
+
+template <typename T>
+void outputValue(Output<Repr<T>> o, const T& x) {
+  x.outputRepr(o);
+}
+
+struct FactStats {
+  size_t memory;
+  size_t count;
+};
+
+struct SchemaInventory {
+  rts::Inventory inventory;
+
+  /// Mapping from the autogenerated Schema::index<P>::value to the Id of P
+  /// in the inventory (if it exists there).
+  std::vector<const rts::Predicate * FOLLY_NULLABLE> predicates;
+};
+
+class BatchBase {
+ public:
+  explicit BatchBase(
+      const SchemaInventory* inventory,
+      size_t cache_capacity,
+      std::string schemaId);
+  BatchBase(const BatchBase&) = delete;
+  BatchBase(BatchBase&&) = delete;
+  BatchBase& operator=(const BatchBase&) = delete;
+  BatchBase& operator=(BatchBase&&) = delete;
+
+  const rts::Predicate* FOLLY_NULLABLE predicate(size_t i) const {
+    return inventory->predicates[i];
+  }
+
+  Id define(Pid ty, rts::Fact::Clause clause);
+
+  void rebase(const rts::Substitution&);
+
+  rts::FactSet::Serialized serialize() const;
+  std::map<std::string, std::vector<int64_t>> serializeOwnership() const;
+  void clearOwnership();
+
+  FactStats bufferStats() const {
+    return FactStats{buffer.factMemory(), buffer.size()};
+  }
+
+  // TODO: This is a temporary hack for backwards compatibility, add proper
+  // stats reporting
+  struct CacheStats {
+    FactStats facts;
+    size_t hits = 0;
+    size_t misses = 0;
+  };
+
+  CacheStats cacheStats();
+
+  Id firstFreeId() const {
+    return facts.firstFreeId();
+  }
+
+  const std::string& getSchemaId() const {
+    return schemaId;
+  }
+
+  void beginUnit(std::string);
+  void endUnit();
+
+  void logEnd() const;
+
+ private:
+  const SchemaInventory* inventory;
+  std::shared_ptr<rts::LookupCache::Stats> stats;
+  rts::LookupCache cache;
+  rts::LookupCache::Anchor anchor;
+  rts::FactSet buffer;
+  rts::Stacked<rts::Define> facts;
+  std::string schemaId;
+
+  struct Owned {
+    std::string unit;
+    rts::closed_interval_set<Id> facts;
+    Id start;
+    Id finish;
+  };
+
+  std::deque<Owned> owned;
+  Owned* current = nullptr;
+  size_t seen_units = 0;
+  mutable size_t last_serialized_units = 0;
+  mutable size_t total_serialized_units = 0;
+  std::set<std::string> unique_units;
+};
+
+/// A typed instantiation of an Inventory for a particular Schema.
+template <typename Schema>
+struct DbSchema {
+  SchemaInventory inventory;
+
+  explicit DbSchema(rts::Inventory inv) : inventory{std::move(inv), {}} {
+    inventory.predicates = getPredicates(inventory.inventory);
+  }
+
+ private:
+  using ref_t = std::pair<std::string, size_t>;
+
+  template <size_t i>
+  using pred_t = typename Schema::template predicate<i>::type;
+
+  template <size_t... I>
+  static std::vector<ref_t> getRefs(std::index_sequence<I...>) {
+    return std::vector<ref_t>{
+        ref_t{pred_t<I>::GLEAN_name(), pred_t<I>::GLEAN_version()}...};
+  }
+
+  using pred_map_t =
+      std::unordered_map<std::pair<std::string, int32_t>, size_t>;
+
+  static std::vector<const rts::Predicate * FOLLY_NULLABLE> getPredicates(
+      const rts::Inventory& inventory) {
+    const auto seq = std::make_index_sequence<Schema::count>();
+    auto refs = getRefs(seq);
+
+    std::unordered_map<ref_t, size_t> indices;
+    for (size_t i = 0; i < refs.size(); ++i) {
+      indices.insert({refs[i], i});
+    }
+
+    const auto inventory_preds = inventory.predicates();
+    std::vector<const rts::Predicate * FOLLY_NULLABLE> preds(
+        refs.size(), nullptr);
+    for (auto p : inventory_preds) {
+      auto i = indices.find({p->name, p->version});
+      if (i != indices.end()) {
+        preds[i->second] = p;
+      }
+    }
+
+    // TODO: verify that predicates have the expected types
+
+    return preds;
+  }
+};
+
+// A Batch encapsulates a set of cached facts which is initially empty and a
+// set of facts local to the Batch. Local facts can reference cached ones but
+// not vice versa. New local facts can be added to the Batch.
+//
+// A Batch can be serialized (typically for sending to the server) and rebased
+// based on a Substitution (typically received from the server). Local facts
+// that are in range of the substitution are moved to the cache; the remaining
+// local facts are assigned new Ids which don't clash which cached ones.
+//
+template <typename Schema>
+class Batch : private BatchBase {
+ public:
+  Batch(const DbSchema<Schema>* schema, size_t cache_capacity)
+      : BatchBase(&(schema->inventory), cache_capacity, Schema::schemaId) {}
+
+  template <typename P>
+  const rts::Predicate* predicate() const {
+    if (auto p = base().predicate(Schema::template index<P>::value)) {
+      return p;
+    } else {
+      throw std::runtime_error(
+          std::string("unknown predicate ") + P::GLEAN_name() + "[" +
+          folly::to<std::string>(P::GLEAN_version()) + "]");
+    }
+  }
+
+  template <
+      typename P,
+      typename = std::enable_if_t<
+          std::is_same<typename P::ValueType, std::tuple<>>::value>>
+  Fact<P> fact(const typename P::KeyType& x) {
+    binary::Output output;
+    outputValue(Output<Repr<typename P::KeyType>>(output), x);
+    auto fact = base().define(
+        predicate<P>()->id, rts::Fact::Clause::fromKey(output.bytes()));
+    assert(fact);
+    return Fact<P>(fact);
+  }
+
+  template <
+      typename P,
+      typename... Ts,
+      typename = std::enable_if_t<1 < sizeof...(Ts)>>
+  Fact<P> fact(Ts&&... xs) {
+    return fact<P>(std::make_tuple(std::forward<Ts>(xs)...));
+  }
+
+  template <typename P>
+  Fact<P> factV(const typename P::KeyType& k, const typename P::ValueType& v) {
+    binary::Output clause;
+    outputValue(Output<Repr<typename P::KeyType>>(clause), k);
+    const auto key_size = clause.size();
+    outputValue(Output<Repr<typename P::ValueType>>(clause), v);
+    auto fact = base().define(
+        predicate<P>()->id, rts::Fact::Clause::from(clause.bytes(), key_size));
+    assert(fact);
+    return Fact<P>(fact);
+  }
+
+  BatchBase& base() {
+    return *this;
+  }
+  const BatchBase& base() const {
+    return *this;
+  }
+
+  using BatchBase::beginUnit;
+  using BatchBase::bufferStats;
+  using BatchBase::CacheStats;
+  using BatchBase::cacheStats;
+  using BatchBase::endUnit;
+  using BatchBase::logEnd;
+  using BatchBase::rebase;
+};
+
+} // namespace cpp
+} // namespace glean
+} // namespace facebook
diff --git a/glean/cpp/sender.h b/glean/cpp/sender.h
new file mode 100644
--- /dev/null
+++ b/glean/cpp/sender.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/cpp/glean.h"
+
+namespace facebook {
+namespace glean {
+
+struct Sender {
+  virtual ~Sender() {}
+
+  // If we called rebaseAndSend previously, check if we have a response from
+  // the server (or wait for it if 'wait' is true) and rebase the batch (i.e.,
+  // adjust fact ids based on the substitution received from the server and
+  // move all facts that the server now has from the write buffer to the cache).
+  // After rebasing or if this is the first call to the function, start sending
+  // all facts that are currently in the write buffer to the server.
+  //
+  // This retries as necessary on exceptions and aborts the program on
+  // unrecoverable errors.
+  //
+  // The intended use pattern is this:
+  //
+  // while (...) {
+  //    produce some facts
+  //    sender->rebaseAndSend
+  // }
+  // sender->flush
+  //
+  virtual void rebaseAndSend(cpp::BatchBase& batch, bool wait = false) = 0;
+
+  // Send all remaining batch data as soon as possible and wait for commit
+  // acknowledgement.
+  virtual void flush(cpp::BatchBase& batch) = 0;
+};
+
+} // namespace glean
+} // namespace facebook
diff --git a/glean/db/Glean/Backend/Local.hs b/glean/db/Glean/Backend/Local.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Backend/Local.hs
@@ -0,0 +1,263 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+--
+-- | An abstraction over the Glean API that can be served by
+-- either a local DB or a remote server.
+--
+module Glean.Backend.Local
+  (
+    Env(..)
+  , Config(..)
+  , options
+  , withDatabases
+
+    -- * Schemas
+  , loadDbSchema
+  , serializeInventory
+  ) where
+
+import Control.Applicative
+import Control.Concurrent (getNumCapabilities)
+import Control.Concurrent.Stream (stream)
+import Control.Exception (catches, Handler (Handler), throwIO)
+import Control.Monad (forM_)
+import Data.ByteString (ByteString)
+import Data.Default
+import Data.IORef.Extra
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Map.Strict as Map
+import Data.Maybe
+import Data.Typeable
+import qualified Haxl.Core as Haxl
+
+import Util.Control.Exception
+import qualified Util.Control.Exception.CallStack as CallStack
+import Util.STM
+
+import Glean.Backend.Types
+import qualified Glean.Database.Catalog as Catalog
+import qualified Glean.Database.CompletePredicates as Database
+import qualified Glean.Database.Create as Database
+import Glean.Database.Config
+import qualified Glean.Database.Delete as Database
+import Glean.Database.Env
+import Glean.Database.Open as Database
+import qualified Glean.Database.List as Database
+import qualified Glean.Database.PredicateStats as Database (predicateStats)
+import qualified Glean.Database.Restore as Database
+import qualified Glean.Database.Schema as Database
+import Glean.Database.Schema hiding (getSchemaInfo, schemaId)
+import qualified Glean.Database.Types as Database
+import Glean.Database.Types (Env(..))
+import qualified Glean.Database.Finish as Database
+import qualified Glean.Database.Writes as Database
+import Glean.Internal.Types
+import qualified Glean.Query.UserQuery as UserQuery
+import qualified Glean.Query.Derive as Derive
+import Glean.Query.Thrift
+import Glean.Query.Thrift.Internal
+import Glean.RTS (Fid(..))
+import qualified Glean.RTS.Foreign.Inventory as Inventory
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+import qualified Glean.Types as Thrift
+import Glean.Util.Observed as Observed
+import Haxl.DataSource.Glean.Common
+
+
+instance Backend Database.Env where
+  queryFact env repo id = readDatabase env repo $ \_ db ->
+    Lookup.lookupFact db (Fid id)
+
+  factIdRange env repo = do
+    (starting, next) <- readDatabase env repo $ \_ db ->
+      (,) <$> Lookup.startingId db <*> Lookup.firstFreeId db
+    return $ Thrift.FactIdRange (fromFid starting) (fromFid next)
+
+  getSchemaInfo env (Just repo) req =
+    withOpenDatabase env repo $ \odb -> do
+      index <- Observed.get (Database.envSchemaSource env)
+      Database.getSchemaInfo (Database.odbSchema odb) index req
+
+  getSchemaInfo env Nothing Thrift.GetSchemaInfo{..} = do
+      index <- Observed.get (Database.envSchemaSource env)
+      sid <- case getSchemaInfo_select of
+          Thrift.SelectSchema_schema_id sid -> return sid
+          other -> throwIO $ userError $ "unsupported: " <> show other
+      Database.getSchemaInfoForSchema index sid (envDebug env)
+
+  validateSchema env (Thrift.ValidateSchema str) = do
+    schema <- Observed.get (Database.envSchemaSource env)
+    conf <- Observed.get (Database.envServerConfig env)
+    validateNewSchema conf str schema (envDebug env)
+
+  predicateStats env repo opts = Database.predicateStats env repo opts
+
+  userQueryFacts env repo q
+    | isNothing (Thrift.userQueryFacts_schema_id q) =
+      UserQuery.userQueryFacts env repo q {
+        Thrift.userQueryFacts_schema_id = schemaId env
+      }
+    | otherwise = UserQuery.userQueryFacts env repo q
+
+  userQuery env repo q
+    | isNothing (Thrift.userQuery_schema_id q) =
+      UserQuery.userQuery env repo q {
+        Thrift.userQuery_schema_id = schemaId env
+      }
+    | otherwise = UserQuery.userQuery env repo q
+
+  userQueryBatch env repo Thrift.UserQueryBatch{..} = do
+      resultsRef <- newIORef mempty
+      numCaps <- getNumCapabilities
+      stream numCaps (forM_ queries) $ \q -> do
+        res <- runOne q
+        atomicModifyIORef'_ resultsRef $ Map.insert q res
+      results <- readIORef resultsRef
+      return $ map (results Map.!) queries
+      where
+        queries =
+          [ Thrift.UserQuery
+            { userQuery_predicate = userQueryBatch_predicate
+            , userQuery_predicate_version = userQueryBatch_predicate_version
+            , userQuery_encodings  = userQueryBatch_encodings
+            , userQuery_client_info = userQueryBatch_client_info
+            , userQuery_schema_id = userQueryBatch_schema_id <|> schemaId env
+            , userQuery_options = userQueryBatch_options
+            , userQuery_query = q
+            }
+          | q <- userQueryBatch_queries
+          ]
+        runOne query =
+          (Thrift.UserQueryResultsOrException_results
+            <$> userQuery env repo query)
+          `catches`
+          [ Handler $ \(Thrift.Retry r) -> return $
+              Thrift.UserQueryResultsOrException_retry $
+                Thrift.RetryException r
+          , Handler $ \(Thrift.BadQuery b) -> return $
+              Thrift.UserQueryResultsOrException_badQuery $
+                Thrift.BadQueryException b
+          ]
+
+
+  deriveStored = Derive.deriveStored
+
+  listDatabases = Database.listDatabases
+  getDatabase env repo =
+    maybe (CallStack.throwIO $ Thrift.UnknownDatabase repo) return
+    =<< atomically (Catalog.getLocalDatabase (Database.envCatalog env) repo)
+
+  kickOffDatabase = Database.kickOffDatabase
+  finishDatabase = Database.finishDatabase
+  finalizeDatabase = Database.finalizeDatabase
+  updateProperties env repo set unset = do
+    Database.updateProperties env repo set unset
+    return def
+
+  completePredicates_ = Database.completePredicates
+
+  restoreDatabase = Database.restoreDatabase
+
+  deleteDatabase env repo = do
+    Database.deleteDatabase env repo
+    return def
+
+  enqueueBatch env cbatch = Database.enqueueBatch env cbatch Nothing
+  enqueueJsonBatch env cbatch = Database.enqueueJsonBatch env cbatch
+  enqueueBatchDescriptor env repo batch waitPolicy =
+    Database.enqueueBatchDescriptor env repo batch waitPolicy
+  pollBatch env handle = Database.pollBatch env handle
+
+  displayBackend _ = "(local backend)"
+
+  hasDatabase env repo = do
+    Thrift.GetDatabaseResult { getDatabaseResult_database = Thrift.Database{..}}
+      <- getDatabase env repo
+    return $ case database_status of
+      Thrift.DatabaseStatus_Restorable -> False
+      _ -> True
+
+  schemaId = Database.envSchemaId
+
+  usingShards _ = False
+
+  initGlobalState backend = do
+    capabilities <- getNumCapabilities
+    let streamMapM_ :: (a -> IO ()) -> [a] -> IO ()
+        streamMapM_ f xx = stream capabilities (forM_ xx) f
+    if capabilities == 1
+      then return
+        ( GleanGetState $ Haxl.SyncFetch $
+            mapM_ (syncGetOne backend) . HashMap.toList . requestByRepo
+        , GleanQueryState $ Haxl.SyncFetch $
+            mapM_ (syncQueryOne backend)
+        )
+      else return
+        ( GleanGetState $ Haxl.BackgroundFetch $
+            streamMapM_ (syncGetOne backend) . HashMap.toList . requestByRepo
+        , GleanQueryState $ Haxl.BackgroundFetch $
+            streamMapM_ (syncQueryOne backend)
+        )
+
+
+-- -----------------------------------------------------------------------------
+-- Haxl
+
+syncGetOne :: Env -> (Thrift.Repo, [Haxl.BlockedFetch GleanGet]) -> IO ()
+syncGetOne env (repo, requests) = do
+  let schema = schemaId env
+  results <- userQueryFacts env repo (mkUserQueryFacts Nothing schema requests)
+  putResults results requests
+
+syncQueryOne :: Env -> Haxl.BlockedFetch GleanQuery -> IO ()
+syncQueryOne env
+    (Haxl.BlockedFetch (QueryReq (Query q :: Query q) repo stream) rvar) =
+  runSyncQuery repo env
+    (Query (mkUserQuery Nothing (schemaId env) q) :: Query q)
+    (if stream then Just mempty else Nothing) rvar
+
+runSyncQuery
+  :: forall q r. (Show q, Typeable q, QueryResult q r)
+  => Thrift.Repo
+  -> Env
+  -> Query q
+  -> Maybe r -- results so far
+  -> Haxl.ResultVar (r, Bool)
+  -> IO ()
+runSyncQuery repo env q@(Query req) acc rvar = do
+  r <- tryAll $ userQuery env repo req
+  case r of
+    Left e -> Haxl.putFailure rvar e
+    Right results ->
+      putQueryResults q results acc rvar $
+        \(q :: Query q) acc -> runSyncQuery repo env q acc rvar
+
+-- -----------------------------------------------------------------------------
+-- DbSchema
+
+loadDbSchema :: Backend a => a -> Thrift.Repo -> IO DbSchema
+loadDbSchema backend repo = do
+  Thrift.SchemaInfo schema pids _ dbSchemaIds _ _ <-
+    getSchemaInfo backend (Just repo) def
+      { Thrift.getSchemaInfo_select = Thrift.SelectSchema_stored def }
+  fromStoredSchema Nothing (StoredSchema schema pids dbSchemaIds)
+    readWriteContent def
+
+-- | Serialize the inventory for the schema used by this repo.
+-- The inventory is some information about the predicates in the schema
+serializeInventory
+  :: Backend backend
+  => backend
+  -> Thrift.Repo
+  -> IO ByteString
+serializeInventory backend repo = do
+  dbSchema <- loadDbSchema backend repo
+  return $ Inventory.serialize $ schemaInventory dbSchema
diff --git a/glean/db/Glean/Backend/Logging.hs b/glean/db/Glean/Backend/Logging.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Backend/Logging.hs
@@ -0,0 +1,351 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Backend.Logging
+  ( LoggingBackend(..)
+  ) where
+
+import Control.Exception
+import qualified Data.ByteString as ByteString
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Monoid (Sum(getSum, Sum))
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Text.Encoding.Error as Text
+import TextShow (showt)
+
+import Util.Logger
+
+import Glean.Schema.Util (showRef)
+import Glean.Backend.Local ()
+import Glean.Logger.Server as Logger
+import qualified Glean.Database.List as Database
+import qualified Glean.Database.Types as Database
+import Glean.Database.Writes (batchOwnedSize, batchDependenciesSize)
+import Glean.Logger
+import qualified Glean.Types as Thrift
+import Util.Time
+
+import Glean.Backend.Types
+
+
+-- | A logging wrapper for Env. We do it this way because some backend
+-- calls invoke other backend calls, and we only want to log the
+-- outermost one. For example, userQuery will call queryFact a *lot*,
+-- and it would be too expensive to log each and every call to
+-- queryFact.
+newtype LoggingBackend = LoggingBackend Database.Env
+
+instance Backend LoggingBackend where
+  queryFact (LoggingBackend env) repo id =
+    loggingAction (runLogRepo "queryFact" env repo) (const mempty) $
+      queryFact env repo id
+  factIdRange (LoggingBackend env) repo =
+    loggingAction (runLogRepo "factIdRange" env repo) (const mempty) $
+      factIdRange env repo
+  getSchemaInfo (LoggingBackend env) (Just repo) req =
+    loggingAction (runLogRepo "getSchemaInfo" env repo) (const mempty) $
+      getSchemaInfo env (Just repo) req
+  getSchemaInfo (LoggingBackend env) Nothing req =
+    loggingAction (runLogCmd "getSchemaInfo" env) (const mempty) $
+      getSchemaInfo env Nothing req
+  validateSchema (LoggingBackend env) req =
+    loggingAction (runLogCmd "validateSchema" env) (const mempty) $
+      validateSchema env req
+  predicateStats (LoggingBackend env) repo opts =
+    loggingAction (runLogRepo "predicateStats" env repo) (const mempty) $
+      predicateStats env repo opts
+  userQueryFacts (LoggingBackend env) repo req =
+    loggingAction (runLogQueryFacts "userQueryFacts" env repo req)
+      logQueryResults $
+        userQueryFacts env repo req
+  userQuery (LoggingBackend env) repo req =
+    loggingAction (runLogQuery "userQuery" env repo req) logQueryResults $
+      userQuery env repo req
+  userQueryBatch (LoggingBackend env) repo reqBatch =
+    loggingAction
+      (runLogQueryBatch "userQueryBatch" env repo reqBatch)
+      logQueryResultsOrException
+      (userQueryBatch env repo reqBatch)
+
+  deriveStored (LoggingBackend env) log repo q =
+    loggingAction
+      (runLogDerivePredicate "deriveStored" env repo q)
+      (const mempty)
+      (deriveStored env (runLogDerivationResult env log repo q) repo q)
+
+  listDatabases (LoggingBackend env) req =
+    loggingAction (runLogCmd "listDatabases" env) (const mempty) $
+      Database.listDatabases env req
+  getDatabase (LoggingBackend env) repo =
+    loggingAction (runLogRepo "getDatabase" env repo) (const mempty) $
+      getDatabase env repo
+
+  kickOffDatabase (LoggingBackend env) rq =
+    loggingAction
+      (runLogKickOff "kickOff" env rq)
+      (const mempty) $
+      kickOffDatabase env rq
+  finishDatabase (LoggingBackend env) repo =
+    loggingAction
+      (runLogRepo "finishDatabase" env repo)
+      (const mempty) $
+      finishDatabase env repo
+  finalizeDatabase (LoggingBackend env) repo =
+    loggingAction
+      (runLogRepo "finalizeDatabase" env repo)
+      (const mempty) $
+      finalizeDatabase env repo
+  updateProperties (LoggingBackend env) repo set unset =
+    loggingAction
+      (runLogRepo "updateProperties" env repo)
+      (const mempty) $
+      updateProperties env repo set unset
+
+  completePredicates_ (LoggingBackend env) repo preds =
+    loggingAction
+       (runLogRepo "completePredicates" env repo)
+       (const mempty) $
+       completePredicates_ env repo preds
+
+  restoreDatabase (LoggingBackend env) loc =
+    loggingAction (runLogCmd "restoreDatabase" env) (const mempty) $
+      restoreDatabase env loc
+  deleteDatabase (LoggingBackend env) repo =
+    loggingAction (runLogRepo "deleteDatabase" env repo) (const mempty) $
+      deleteDatabase env repo
+  enqueueBatch (LoggingBackend env) cbatch =
+    loggingAction
+      (runLogEnqueueBatch "enqueueBatch" env cbatch)
+      (const mempty) $
+        enqueueBatch env cbatch
+  enqueueJsonBatch (LoggingBackend env) repo batch =
+    loggingAction (runLogRepo "enqueueJsonBatch" env repo) (const mempty) $
+      enqueueJsonBatch env repo batch
+  enqueueBatchDescriptor (LoggingBackend env) repo batch waitPolicy =
+    loggingAction
+      (runLogRepo "enqueueBatchDescriptor" env repo)
+      (const mempty) $
+        enqueueBatchDescriptor env repo batch waitPolicy
+  pollBatch (LoggingBackend env) handle =
+    loggingAction (runLogCmd "pollBatch" env) (const mempty) $
+      pollBatch env handle
+  displayBackend (LoggingBackend b) = displayBackend b
+  hasDatabase (LoggingBackend b) repo = hasDatabase b repo
+  schemaId (LoggingBackend b) = schemaId b
+  usingShards (LoggingBackend b) = usingShards b
+  initGlobalState (LoggingBackend b) = initGlobalState b
+
+runLogKickOff
+  :: Text
+  -> Database.Env
+  -> Thrift.KickOff
+  -> GleanServerLog
+  -> IO ()
+runLogKickOff cmd env Thrift.KickOff{..} log =
+  runLogRepo cmd env kickOff_repo $ log <> schemaId
+  where
+  schemaId = maybe mempty Logger.SetSchemaId $
+    HashMap.lookup "glean.schema_id" kickOff_properties
+
+runLogQueryFacts
+  :: Text
+  -> Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQueryFacts
+  -> GleanServerLog -> IO ()
+runLogQueryFacts cmd env repo Thrift.UserQueryFacts{..} log =
+  runLogRepo cmd env repo $ log
+    <> maybe mempty logQueryOptions userQueryFacts_options
+    <> maybe mempty logQueryClientInfo userQueryFacts_client_info
+    <> maybe mempty (Logger.SetSchemaId . Thrift.unSchemaId)
+        userQueryFacts_schema_id
+
+runLogQuery
+  :: Text
+  -> Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQuery
+  -> GleanServerLog
+  -> IO ()
+runLogQuery cmd env repo Thrift.UserQuery{..} log = do
+  runLogRepo cmd env repo $ mconcat
+    [ log
+    , Logger.SetQuery
+        (Text.decodeUtf8With Text.lenientDecode $
+          if ByteString.length userQuery_query > 1024
+            then "[truncated] " <> ByteString.take 1024 userQuery_query
+            else userQuery_query)
+    , Logger.SetPredicate userQuery_predicate
+    , maybe mempty (Logger.SetPredicateVersion . fromIntegral)
+        userQuery_predicate_version
+    , maybe mempty (Logger.SetSchemaId . Thrift.unSchemaId)
+        userQuery_schema_id
+    , maybe mempty logQueryOptions userQuery_options
+    , maybe mempty logQueryClientInfo userQuery_client_info
+    ]
+
+runLogQueryBatch
+  :: Text
+  -> Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQueryBatch
+  -> GleanServerLog
+  -> IO ()
+runLogQueryBatch cmd env repo Thrift.UserQueryBatch{..} log =
+  runLogRepo cmd env repo $ mconcat
+    [ log
+    , Logger.SetQuery $ case userQueryBatch_queries of
+        [] -> "0 batched queries"
+        q:rest -> Text.unlines $
+          Text.decodeUtf8With Text.lenientDecode q :
+          [" + " <> showt n <> " batched queries"
+          | let n = length rest
+          , n > 1
+          ]
+    , Logger.SetPredicate userQueryBatch_predicate
+    , maybe mempty (Logger.SetPredicateVersion . fromIntegral)
+        userQueryBatch_predicate_version
+    , maybe mempty (Logger.SetSchemaId . Thrift.unSchemaId)
+        userQueryBatch_schema_id
+    , maybe mempty logQueryOptions userQueryBatch_options
+    , maybe mempty logQueryClientInfo userQueryBatch_client_info
+    ]
+
+runLogEnqueueBatch
+  :: Text
+  -> Database.Env
+  -> Thrift.ComputedBatch
+  -> GleanServerLog
+  -> IO ()
+runLogEnqueueBatch cmd env Thrift.ComputedBatch{..} log =
+  let !Thrift.Batch{..} = computedBatch_batch in
+  runLogRepo cmd env computedBatch_repo $ mconcat
+    [ log
+    , Logger.SetBatchFactsSize $ ByteString.length batch_facts
+    , Logger.SetBatchFactsCount $ fromIntegral $
+        Thrift.batch_count computedBatch_batch
+    , Logger.SetBatchOwnedSize $ batchOwnedSize batch_owned
+    , Logger.SetBatchDependenciesSize $ batchDependenciesSize batch_dependencies
+    ]
+
+logQueryOptions :: Thrift.UserQueryOptions -> GleanServerLog
+logQueryOptions Thrift.UserQueryOptions{..} = mconcat
+  [ Logger.SetNoBase64Binary userQueryOptions_no_base64_binary
+  , Logger.SetExpandResults userQueryOptions_expand_results
+  , Logger.SetRecursive userQueryOptions_recursive
+  , maybe mempty (Logger.SetMaxResults . fromIntegral)
+      userQueryOptions_max_results
+  , Logger.SetSyntax $ case userQueryOptions_syntax of
+      Thrift.QuerySyntax_JSON -> "JSON"
+      Thrift.QuerySyntax_ANGLE -> "Angle"
+  , maybe mempty
+      ( Logger.SetRequestContinuationSize
+      . ByteString.length
+      . Thrift.userQueryCont_continuation
+      )
+      userQueryOptions_continuation
+  ]
+
+logQueryClientInfo :: Thrift.UserQueryClientInfo -> GleanServerLog
+logQueryClientInfo Thrift.UserQueryClientInfo{..} = mconcat
+  [ maybe mempty Logger.SetClientUnixname userQueryClientInfo_unixname
+  , Logger.SetClientApplication userQueryClientInfo_application
+  , Logger.SetClientName userQueryClientInfo_name
+  ]
+
+logQueryResultsOrException
+  :: [Thrift.UserQueryResultsOrException] -> GleanServerLog
+logQueryResultsOrException results = mconcat
+  [
+    Logger.SetResults $ getSum $ foldMap (Sum . countQueryResults)
+      [ r | Thrift.UserQueryResultsOrException_results r <- results]
+  ]
+
+logQueryResults :: Thrift.UserQueryResults -> GleanServerLog
+logQueryResults it@Thrift.UserQueryResults{..} = mconcat
+  [ Logger.SetResults $ countQueryResults it
+  , Logger.SetTruncated (isJust userQueryResults_continuation)
+  , maybe mempty logQueryStats userQueryResults_stats
+  , maybe mempty Logger.SetType userQueryResults_type
+  , maybe mempty
+      ( Logger.SetResponseContinuationSize
+      . ByteString.length
+      . Thrift.userQueryCont_continuation
+      )
+      userQueryResults_continuation
+  ]
+
+countQueryResults :: Thrift.UserQueryResults -> Int
+countQueryResults Thrift.UserQueryResults{..} =
+  case userQueryResults_results of
+    Thrift.UserQueryEncodedResults_bin bin ->
+      Map.size (Thrift.userQueryResultsBin_facts bin)
+    Thrift.UserQueryEncodedResults_json json ->
+      length (Thrift.userQueryResultsJSON_facts json)
+    Thrift.UserQueryEncodedResults_compact compact ->
+      length (Thrift.userQueryResultsCompact_facts compact)
+    _ ->
+      length userQueryResults_facts
+
+logQueryStats :: Thrift.UserQueryStats -> GleanServerLog
+logQueryStats Thrift.UserQueryStats{..} = mconcat
+  [ Logger.SetResults (fromIntegral userQueryStats_result_count)
+  , Logger.SetFacts (fromIntegral userQueryStats_num_facts)
+  , Logger.SetFullScans (showRef <$> userQueryStats_full_scans)
+  , maybe mempty (Logger.SetBytecodeSize . fromIntegral)
+      userQueryStats_bytecode_size
+  , maybe mempty (Logger.SetCompileTimeUs . fromIntegral . (`quot` 1000))
+      userQueryStats_compile_time_ns
+  , maybe mempty (Logger.SetExecuteTimeUs . fromIntegral . (`quot` 1000))
+      userQueryStats_execute_time_ns
+  , maybe mempty (Logger.SetQueryResultBytes . fromIntegral)
+      userQueryStats_result_bytes
+  ]
+
+runLogDerivePredicate
+  :: Text
+  -> Database.Env
+  -> Thrift.Repo
+  -> Thrift.DerivePredicateQuery
+  -> GleanServerLog
+  -> IO ()
+runLogDerivePredicate cmd env repo Thrift.DerivePredicateQuery {..} log =
+  runLogRepo cmd env repo $ mconcat
+    [ log
+    , Logger.SetPredicate derivePredicateQuery_predicate
+    , maybe mempty (Logger.SetPredicateVersion . fromIntegral)
+        derivePredicateQuery_predicate_version
+    , maybe mempty logQueryClientInfo derivePredicateQuery_client_info
+    ]
+
+runLogDerivationResult
+  :: Database.Env
+  -> LogDerivationResult
+  -> Thrift.Repo
+  -> Thrift.DerivePredicateQuery
+  -> Either (DiffTimePoints, SomeException) Thrift.UserQueryStats
+  -> IO ()
+runLogDerivationResult env log repo Thrift.DerivePredicateQuery{..} res = do
+  log res
+  runLogRepo "deriveStored(completed)" env repo $ mconcat
+    [ Logger.SetPredicate derivePredicateQuery_predicate
+    , maybe mempty (Logger.SetPredicateVersion . fromIntegral)
+        derivePredicateQuery_predicate_version
+    , maybe mempty logQueryClientInfo derivePredicateQuery_client_info
+    , case res of
+        Left (_,err) -> failureLog err
+        Right stats -> successLog <> logQueryStats stats
+    , timeLog $ toDiffSeconds $ case res of
+        Left (duration, _) -> duration
+        Right Thrift.UserQueryStats{..} ->
+          nanoseconds (fromIntegral userQueryStats_elapsed_ns)
+    ]
diff --git a/glean/db/Glean/Database/Backup.hs b/glean/db/Glean/Database/Backup.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Backup.hs
@@ -0,0 +1,473 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveGeneric #-}
+module Glean.Database.Backup
+  ( backuper
+  , Event(..)
+  , backupDatabase
+  -- for testing
+  , newestByRepo
+  , bestRestore
+  ) where
+
+import Control.Applicative
+import Control.Concurrent.Async
+import Control.Exception
+import Control.Monad
+import Control.Trace (traceMsg)
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.Hashable (Hashable)
+import Data.Int
+import Data.List
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Ord
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Typeable (Typeable)
+import GHC.Generics hiding (Meta)
+import System.Directory
+import System.FilePath
+import System.Timeout
+import Text.Printf
+import TextShow
+
+import Util.Control.Exception
+import Util.Graph
+import Util.IO (safeRemovePathForcibly)
+import Util.Log
+import Util.Logger
+import Util.STM
+
+import Glean.Database.Backup.Backend as Backend
+import Glean.Database.Backup.Locator
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter
+import Glean.Database.CompletePredicates
+import qualified Glean.Database.Logger as Logger
+import Glean.Database.Meta
+import Glean.Database.Repo
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Open
+import Glean.Database.Trace
+import Glean.Database.Types
+import Glean.Database.Schema
+import Glean.Logger
+import Glean.RTS.Foreign.Ownership (getOwnershipStats, showOwnershipStats)
+import Glean.ServerConfig.Types (DatabaseBackupPolicy(..))
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Internal.Types as Thrift
+import Glean.Types as Thrift hiding (Exception)
+import Glean.Util.Some
+import Glean.Util.Observed as Observed
+import Glean.Util.Trace
+
+data Event
+  = BackupStarted Repo
+  | BackupFinished Repo
+  | BackupFailed Repo
+  | RestoreStarted Repo
+  | RestoreFinished Repo
+  | RestoreFailed Repo
+  | RestoreAborted Repo
+  | FinalizeStarted Repo
+  | FinalizeFinished Repo
+  | FinalizeFailed Repo
+  | Waiting
+  deriving (Eq, Generic, Show, Typeable)
+
+instance Hashable Event
+
+type Todo = (Repo, IO Bool)
+
+-- | Set of Repos that shouldn't be backed up (because we already tried and
+-- failed). We currently only remove things from here when they get deleted from
+-- our DB list which matches previous behaviour. Eventually, we should retry
+-- with exponential back-off.
+type SinBin = HashSet Repo
+
+-- | In order to download a DB we need twice the space to untar it, plus a bit
+--   more for RocksDB to expand it
+dbSizeDownloadFactor :: Double
+dbSizeDownloadFactor = 2.1
+
+newtype BackupException = BackupException Text
+  deriving (Typeable)
+
+instance Show BackupException where
+  show (BackupException t) = Text.unpack t
+instance Exception BackupException where
+
+-- | Get the next thing to do. Prioritises restores over backups and prefers
+-- newer databases.
+getTodo :: Env -> SinBin -> STM Todo
+getTodo env@Env{..} sinbin = getFinalize <|> getRestore <|> getBackup
+  where
+    getFinalize = do
+      dbs <- Catalog.list envCatalog [Local] $ do
+        statusV .==. DatabaseStatus_Finalizing
+        latest
+      case dbs of
+        [] -> retry
+        Item{..} : _ -> return (itemRepo, doFinalize env itemRepo)
+
+    getRestore = do
+      restoring <- Catalog.list envCatalog [Restoring] $ do
+        repoV `notInF` sinbin
+        newestByRepo
+      when (null restoring) retry
+      avail <-  Catalog.list envCatalog [Local] $ do
+        repoV `notInF` sinbin
+        statusV .==. DatabaseStatus_Complete
+        newestByRepo
+      case bestRestore restoring avail of
+        [] -> retry
+        Item{..} : _ -> return (itemRepo, doRestore env itemRepo itemMeta)
+
+    getBackup = do
+      policy <- ServerConfig.config_backup <$> Observed.get envServerConfig
+      let allowedRepoNames = databaseBackupPolicy_allowed policy
+      dbs <- Catalog.list envCatalog [Local] $ do
+        repoNameV `inF` allowedRepoNames
+        statusV .==. DatabaseStatus_Complete
+        backedUpV .==. False
+        latest
+      case dbs of
+        [] -> retry
+        Item{..} : _ -> do
+          dsite <- getSite env (repo_name itemRepo)
+          case dsite of
+            Just (prefix, Some site) ->
+              return (itemRepo, doBackup env itemRepo prefix site)
+            Nothing ->
+              return (itemRepo, throwIO $ BackupException $
+                "Could not backup " <> repo_name itemRepo <>
+                ". Could not resolve the site")
+
+    latest = do
+      repoV `notInF` sinbin
+      sortF createdV Descending
+      limitF 1
+
+newestByRepo :: Filter ()
+newestByRepo = groupF repoNameV $ do
+  sortF createdV Descending
+  limitF 1
+-- To find the next DB to restore, we
+--   - find the newest DB of each repo that needs restoring
+--   - restore the DB which is currently the most stale; that is
+--     where the newest, complete, local DB of the same repo is the oldest
+bestRestore :: [Item] -> [Item] -> [Item]
+bestRestore restoring avail = depsFirst (sortBy order restoring)
+  where
+    -- stalest first, and then most recent if none are stale
+    order a b =
+        comparing staleness a b <>
+        comparing (metaCreated . itemMeta) b a -- NB. descending
+
+    availMap = HashMap.fromList
+      [ (repo_name (itemRepo item), item) | item <- avail ]
+
+    -- creation time of the local DB if stale, or maxBound
+    staleness backup =
+      case HashMap.lookup (repo_name (itemRepo backup)) availMap of
+        Nothing -> NoLocalDb
+        Just local
+          | tlocal > tbackup -> LocalDbNewer
+          | otherwise -> LocalDbOlder tlocal
+          where
+            tlocal = timestamp local
+            tbackup = timestamp backup
+            repoHashTime = metaRepoHashTime . itemMeta
+            creationTime = metaCreated . itemMeta
+            timestamp item = fromMaybe (creationTime item) (repoHashTime item)
+            -- ^ prefer the exact repoHash time if we have it, otherwise use the
+            -- creationTime as the best guess we have
+
+    -- ensure we're restoring dependencies of a stacked DB first, if
+    -- they need restoring.
+    depsFirst items = postorder items itemRepo itemDeps
+      where
+      itemDeps item = case metaDependencies (itemMeta item) of
+        Nothing -> []
+        Just (Dependencies_stacked Thrift.Stacked{..}) ->
+          [Thrift.Repo stacked_name stacked_hash]
+        Just (Dependencies_pruned Pruned{..}) -> [pruned_base]
+
+data Staleness
+  = NoLocalDb
+  | LocalDbOlder PosixEpochTime
+  | LocalDbNewer
+  deriving (Eq,Ord)
+
+hasExcludeProperty
+  :: Repo
+  -> DatabaseProperties
+  -> ServerConfig.DatabaseRetentionPolicy
+  -> Bool
+hasExcludeProperty repo props policy = do
+  let retentionPolicy = ServerConfig.databaseRetentionPolicy_repos policy
+  case Map.lookup (repo_name repo) retentionPolicy of
+    Just ret -> do
+      let exclude_props = ServerConfig.retention_excluded_properties ret
+      any (hasProperty props) (HashMap.toList exclude_props)
+    Nothing -> False
+  where
+    hasProperty props (name,val) = HashMap.lookup name props == Just val
+
+
+doBackup :: Site site => Env -> Repo -> Text -> site -> IO Bool
+doBackup env@Env{..} repo prefix site =
+  backup `catch` \exc -> do
+    atomically $ notify envListener $ BackupFailed repo
+    say logError $ "failed: " ++ show (exc :: SomeException)
+    rethrowAsync exc
+    return False
+  where
+  say log s = log $ inRepo repo $ "backup: " ++ s
+
+  backup = loggingAction (runLogRepo "backup" env repo) (const mempty) $ do
+    ServerConfig.Config{..} <- Observed.get envServerConfig
+    meta <- atomically $ Catalog.readMeta envCatalog repo
+    let excluded =
+          hasExcludeProperty repo (metaProperties meta) config_retention
+    atomically $ notify envListener $ BackupStarted repo
+    say logInfo "starting"
+    withOpenDatabaseStorage env repo $ \_storage OpenDB{..} -> do
+    say logInfo "packing"
+    stats <- mapMaybe
+      (\(pid,stats) -> (,stats) . predicateRef <$> lookupPid pid odbSchema)
+      <$> Storage.predicateStats odbHandle
+    ownershipStats <- do
+      maybeOwnership <- readTVarIO odbOwnership
+      mapM getOwnershipStats maybeOwnership
+
+    Backend.Data{..} <- withScratchDirectory envStorage repo $ \scratch ->
+      Storage.backup odbHandle scratch $ \path Data{dataSize} -> do
+        say logInfo "uploading"
+        let policy = ServerConfig.databaseBackupPolicy_repos config_backup
+            ttl = case ServerConfig.backup_delete_after_seconds <$>
+              Map.lookup (repo_name repo) policy of
+                Just 0 -> Nothing
+                ttl -> fromIntegral <$> ttl
+            metaWithBytes = meta {
+              metaCompleteness = case metaCompleteness meta of
+                Complete DatabaseComplete{..} ->
+                  Complete DatabaseComplete
+                    {databaseComplete_bytes = Just (fromIntegral dataSize)
+                    ,..}
+                _ -> metaCompleteness meta
+        }
+        Backend.backup site repo metaWithBytes ttl path
+    let locator = toRepoLocator prefix site repo
+    Logger.logDBStatistics
+      env
+      repo
+      stats
+      ownershipStats
+      dataSize
+      locator
+      excluded
+    say logInfo "finished"
+    atomically $ do
+      void $ Catalog.modifyMeta envCatalog repo $ \meta -> return meta
+        { metaBackup = Just locator
+        , metaCompleteness = case metaCompleteness meta of
+          Complete DatabaseComplete{..} ->
+            Complete DatabaseComplete
+              {databaseComplete_bytes = Just (fromIntegral dataSize)
+              ,..}
+          other -> other
+        }
+      notify envListener $ BackupFinished repo
+    return True
+
+backupDatabase :: Env -> Repo -> Text -> IO Bool
+backupDatabase env repo loc
+  | Just (prefix, site) <- fromSiteLocator (envBackupBackends env) loc =
+      doBackup env repo prefix site
+  | otherwise = throwIO $
+      Thrift.InvalidLocator $ "invalid locator '" <> loc <>  "'"
+
+doRestore :: Env -> Repo -> Meta -> IO Bool
+doRestore env@Env{..} repo meta
+  | Just loc <- metaBackup meta
+  , Complete DatabaseComplete{databaseComplete_bytes = size}
+  <- metaCompleteness meta
+  , Just (_, Some site, r_repo) <- fromRepoLocator envBackupBackends loc
+  , r_repo == repo =
+    loggingAction (runLogRepo "restore" env repo) (const mempty) $ do
+      ServerConfig.Config{..} <- Observed.get envServerConfig
+      let maybeTimeout =
+            case config_restore_timeout of
+              Just seconds -> void . timeout (fromIntegral seconds * 1000000)
+              Nothing -> id
+      maybeTimeout $ restore site size `catch` handler
+
+      -- NOTE: No point in adding the repo to the sinbin if there was
+      -- an exception, the handler removed it from the list of known DBs
+      return True
+
+  | otherwise = do
+      atomically $ notify envListener $ RestoreStarted repo
+      say logError $ case (metaCompleteness meta, metaBackup meta) of
+        (Complete{}, Just loc) -> "invalid location " ++ show loc
+        (incomplete, Just{}) -> "database incomplete: " <> show incomplete
+        _ -> "missing location"
+      atomically $ notify envListener $ RestoreFailed repo
+      return False
+  where
+  say log s = log $ inRepo repo $ "restore: " ++ s
+
+  restore :: Site s => s -> Maybe Int64 -> IO ()
+  restore site bytes = traceMsg envTracer (GleanTraceDownload repo) $ do
+    atomically $ notify envListener $ RestoreStarted repo
+    mbFreeBytes <- (Just <$> Storage.getFreeCapacity envStorage)
+                  `catch` \(_ :: IOException) -> return Nothing
+    case (mbFreeBytes, bytes)  of
+      (Just freeBytes, Just size) -> do
+        let neededBytes = ceiling $ dbSizeDownloadFactor * fromIntegral size
+        when (freeBytes < neededBytes) $
+          -- the catch-all exception handler will log and cancel the download
+          throwIO $ ErrorCall $
+            printf "Not enough disk space: %d needed, %d available"
+              neededBytes freeBytes
+      _ -> return ()
+
+    withScratchDirectory envStorage repo $ \scratch -> do
+    say logInfo "starting"
+    say logInfo "downloading"
+    let scratch_restore = scratch </> "restore"
+        scratch_file = scratch </> "file"
+    -- TODO: implement buffered downloads in Manifold client
+    void $ traceMsg envTracer GleanTraceSiteRestore $
+      Backend.restore site repo scratch_file
+    say logInfo "restoring"
+    createDirectoryIfMissing True scratch_restore
+    traceMsg envTracer GleanTraceStorageRestore $
+      Storage.restore envStorage repo scratch_restore scratch_file
+    say logInfo "adding"
+    traceMsg envTracer GleanTraceFinishRestore $
+      Catalog.finishRestoring envCatalog repo
+    atomically $ notify envListener $ RestoreFinished repo
+    say logInfo "finished"
+
+  handler exc = do
+    failed <- atomically $ do
+      failed <- Catalog.exists envCatalog [Restoring] repo
+      when failed $ do
+        Catalog.abortRestoring envCatalog repo
+        notify envListener $ RestoreFailed repo
+      return failed
+    when failed $ do
+      say logError $ "failed: " ++ show exc
+      swallow $ Storage.safeRemoveForcibly envStorage repo
+    rethrowAsync exc
+
+
+doFinalize :: Env -> Repo -> IO Bool
+doFinalize env@Env{..} repo =
+  loggingAction (runLogRepo "finalize" env repo) (const mempty) $ do
+    atomically $ notify envListener $ FinalizeStarted repo
+
+    -- If the client didn't explicitly call completePredicates, we'll
+    -- do that now. Do this *before* optimising/compacting, because
+    -- that deletes all the temporary ownership information consumed
+    -- by this pass.
+    meta <- atomically $ Catalog.readMeta envCatalog repo
+    when (not (metaAxiomComplete meta)) $ syncCompletePredicates env repo
+
+    config <- Observed.get envServerConfig
+    withOpenDatabase env repo $ \OpenDB{..} -> do
+      Storage.prepareFactOwnerCache odbHandle
+      maybeOwnership <- readTVarIO odbOwnership
+      forM_ maybeOwnership $ \ownership -> do
+        stats <- getOwnershipStats ownership
+        logInfo $ "final ownership: " <> Text.unpack (showOwnershipStats stats)
+      let compact = ServerConfig.config_compact_on_completion config
+      say logInfo $ if compact then "optimizing(compacting)" else "optimizing"
+      Storage.optimize odbHandle compact
+      Storage.cacheOwnership odbHandle
+
+    -- update and re-merge our internal representation of the schema
+    schemaUpdated env (Just repo)
+
+    time <- envGetCurrentTime
+    atomically $ do
+      void $ Catalog.modifyMeta envCatalog repo $ \meta -> return meta
+        { metaCompleteness = Complete $ DatabaseComplete
+          (utcTimeToPosixEpochTime time)
+          Nothing -- the size gets updated after a backup
+        }
+      notify envListener $ FinalizeFinished repo
+    say logInfo "finished"
+    return True
+
+  `catch` \exc -> do
+    let
+      interrupted
+        | Just AsyncCancelled{} <- fromException exc = True
+        | otherwise = False
+
+    -- If we were interrupted, then keep the DB in the finalizing state
+    -- and we'll try to finalize it again later.  If there was some other
+    -- exception, we'll mark the DB broken.
+    atomically $ do
+      notify envListener $ FinalizeFailed repo
+      when (not interrupted) $
+        void $ Catalog.modifyMeta envCatalog repo $ \meta -> return meta
+          { metaCompleteness = Broken $ DatabaseBroken "finalize" (showt exc) }
+    say logError $
+      (if interrupted then "interrupted" else "failed") <>
+      ": " <> show (exc :: SomeException)
+    rethrowAsync exc
+    return False
+  where
+    say log s = log $ inRepo repo $ "finalize: " ++ s
+
+-- | Back up databases forever.
+backuper :: Env -> IO ()
+backuper env@Env{..} = loop mempty `catchAll` \exc -> do
+  logError $ "unexpected error in backup thread: " ++ show exc
+  backuper env
+  where
+    loop sinbin = do
+      (repo, action) <- do
+        r <- atomically $ Just <$> getTodo env sinbin <|> return Nothing
+        case r of
+          Just todo -> return todo
+          Nothing -> do
+            atomically $ notify envListener Waiting
+            atomically $ getTodo env sinbin
+      ok <- action `catchAll` \exc -> do
+        -- NOTE: action shouldn't throw so this shouldn't ever run
+        logError $ "unexpected error during backup: " ++ show exc
+        return False
+      sinbin' <- HashSet.fromList . map itemRepo <$> atomically
+        (Catalog.list envCatalog [Local, Restoring] $
+          repoV `inF` if ok then sinbin else HashSet.insert repo sinbin)
+      loop sinbin'
+
+withScratchDirectory
+  :: Storage.Storage s => s -> Repo -> (FilePath -> IO a) -> IO a
+withScratchDirectory storage repo action =
+  Storage.withScratchRoot storage $ \root -> do
+    let scratch = root </> databaseSubdir repo
+    safeRemovePathForcibly scratch
+    bracket_
+      (createDirectoryIfMissing True scratch)
+      (logExceptions id $ safeRemovePathForcibly scratch)
+      (action scratch)
+
+rethrowAsync :: SomeException -> IO ()
+rethrowAsync exc
+  | isAsyncException exc = throwIO exc
+  | otherwise = return ()
diff --git a/glean/db/Glean/Database/Backup/Backend.hs b/glean/db/Glean/Database/Backup/Backend.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Backup/Backend.hs
@@ -0,0 +1,56 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Backup.Backend
+  ( Backend(..)
+  , Site(..)
+  , Data(..)
+  , Backends
+  ) where
+
+import Data.HashMap.Strict (HashMap)
+import Data.Text (Text)
+
+import Glean.Database.Meta
+import Glean.Types (Repo)
+import Glean.Util.Some
+
+newtype Data = Data { dataSize :: Int }
+
+-- | A backup backend
+class Backend a where
+  -- | Parse the textual representation of a 'Site'
+  fromPath :: a -> Text -> Maybe (Some Site)
+
+instance Backend (Some Backend) where
+  fromPath (Some backend) = fromPath backend
+
+-- | A backup site
+class Site a where
+  backup
+    :: a -- ^ site to back up to
+    -> Repo -- ^ repo to back up
+    -> Meta -- ^ DB properties
+    -> Maybe Int -- ^ Backup TTL in seconds (if supported by Site)
+    -> FilePath  -- ^ serialized DB
+    -> IO Data
+  inspect :: a -> Repo -> IO Meta
+  restore :: a -> Repo -> FilePath -> IO Meta
+  delete :: a -> Repo -> IO ()
+  enumerate :: a -> IO [(Repo, Meta)]
+  toPath :: a -> Text
+
+instance Site (Some Site) where
+  backup (Some site) = backup site
+  inspect (Some site) = inspect site
+  restore (Some site) = restore site
+  delete (Some site) = delete site
+  enumerate (Some site) = enumerate site
+  toPath (Some site) = toPath site
+
+type Backends = HashMap Text (Some Backend)
diff --git a/glean/db/Glean/Database/Backup/Locator.hs b/glean/db/Glean/Database/Backup/Locator.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Backup/Locator.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Backup.Locator
+  ( fromSiteLocator
+  , fromRepoLocator
+  , toSiteLocator
+  , toRepoLocator
+  , getSite
+  , getAllSites
+  ) where
+
+import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import Util.List
+import Util.STM
+
+import Glean.Database.Backup.Backend as Backend
+import Glean.Database.Types
+import Glean.Repo.Text
+import Glean.ServerConfig.Types (DatabaseBackupPolicy(..))
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types
+import Glean.Util.Some
+import Glean.Util.Observed as Observed
+
+fromSiteLocator :: Backends -> Text -> Maybe (Text, Some Site)
+fromSiteLocator backends s = do
+  let (prefix,colon_path) = Text.breakOn ":" s
+  Some backend <- HashMap.lookup prefix backends
+  (_,path) <- Text.uncons colon_path
+  site <- fromPath backend path
+  return (prefix, site)
+
+-- A repo locator has the following form:
+--  backend_name:some/path/repo.name.hash
+fromRepoLocator :: Backends -> Text -> Maybe (Text, Some Site, Repo)
+fromRepoLocator backends loc = do
+  let (site_slash, repo_text) = Text.breakOnEnd "/" loc
+  (site_text, _) <- Text.unsnoc site_slash
+  (prefix, site) <- fromSiteLocator backends site_text
+  repo <- parseRepoTextSep "." repo_text
+  return (prefix, site, repo)
+
+toSiteLocator :: Site site => Text -> site -> Text
+toSiteLocator prefix site = prefix <> ":" <> toPath site
+
+toRepoLocator :: Site site => Text -> site -> Repo -> Text
+toRepoLocator prefix site repo =
+  toSiteLocator prefix site <> "/" <> repoToTextSep "." repo
+
+getSite :: Env -> Text -> STM (Maybe (Text, Some Site))
+getSite Env{..} repoName = do
+  policy <- ServerConfig.config_backup <$> Observed.get envServerConfig
+  let locator = Map.findWithDefault
+        (databaseBackupPolicy_location policy)
+        repoName
+        (Map.map ServerConfig.backup_location $
+          databaseBackupPolicy_repos policy)
+  return $ fromSiteLocator envBackupBackends locator
+
+getAllSites :: Env -> STM [(Text, Some Site)]
+getAllSites Env{..} = do
+  policy <- ServerConfig.config_backup <$> Observed.get envServerConfig
+  return $
+    mapMaybe (fromSiteLocator envBackupBackends) $
+    uniq $ -- don't forget to remove duplicates
+      databaseBackupPolicy_location policy :
+      map ServerConfig.backup_location
+        (Map.elems $ databaseBackupPolicy_repos policy)
diff --git a/glean/db/Glean/Database/Backup/Mock.hs b/glean/db/Glean/Database/Backup/Mock.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Backup/Mock.hs
@@ -0,0 +1,84 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+--
+-- | A Glean Backup provider that just copies files to somewhere in
+-- the filesystem, for testing purposes.
+--
+module Glean.Database.Backup.Mock
+  ( mock
+  , mockSite
+  ) where
+
+import Control.Exception
+import Control.Monad
+import qualified Data.ByteString as BS
+import Data.Maybe
+import qualified Data.Text as Text
+import System.Directory
+import System.FilePath
+import qualified System.Posix.Files as Posix
+
+import Glean.Database.Backup.Backend
+import Glean.Repo.Text
+import Glean.Types
+import Glean.Util.Some
+import Thrift.Protocol.JSON
+
+
+data MockBackend = MockBackend
+
+newtype MockSite = MockSite FilePath
+
+mock :: Some Backend
+mock = Some MockBackend
+
+mockSite :: FilePath -> Some Site
+mockSite = Some . MockSite
+
+instance Backend MockBackend where
+  fromPath _ = Just . mockSite . Text.unpack
+
+instance Site MockSite where
+  backup (MockSite path) repo props _ttl file = do
+    let repo_path = repoPath path repo
+    createDirectoryIfMissing True (takeDirectory repo_path)
+    copyFile file repo_path
+    size <- Posix.fileSize <$> Posix.getFileStatus repo_path
+    BS.writeFile (repo_path <.> "props") (serializeJSON props)
+    return Data { dataSize = fromIntegral size }
+
+  inspect (MockSite path) repo = do
+    s <- BS.readFile (repoPath path repo <.> "props")
+    case deserializeJSON s of
+      Left err -> throwIO $ ErrorCall $ "can't parse props: " <> err
+      Right r -> return r
+
+  restore (MockSite path) repo file = do
+    copyFile (repoPath path repo) file
+    inspect (MockSite path) repo
+
+  delete (MockSite path) repo =
+    removeFile $ repoPath path repo
+
+  enumerate (MockSite path) = do
+    fs <- listDirectory path
+    fmap catMaybes $ forM fs $ \f -> do
+      case splitExtension f of
+        (x, ".props") -> case splitExtension x of
+          (name,'.':hash) -> do
+              let repo = Repo (Text.pack name) (Text.pack hash)
+              props <- inspect (MockSite path) repo
+              return (Just (repo, props))
+          _other -> return Nothing
+        _other -> return Nothing
+
+  toPath (MockSite path) = Text.pack path
+
+repoPath :: FilePath -> Repo -> FilePath
+repoPath path repo = path </> showRepoSep "." repo
diff --git a/glean/db/Glean/Database/BatchLocation.hs b/glean/db/Glean/Database/BatchLocation.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/BatchLocation.hs
@@ -0,0 +1,31 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.BatchLocation
+  ( Parser(..)
+  , DefaultParser(..)
+  ) where
+
+import Glean.Types as Thrift
+import Data.Text (Text)
+import Glean.Util.Some
+import Control.Exception
+
+-- | A batch's location parser
+class Parser a where
+  -- | Parse a string returning a location to get the batch from
+  fromString :: a -> Text -> Thrift.BatchFormat -> IO Thrift.Batch
+
+instance Parser (Some Parser) where
+  fromString (Some parser) = fromString parser
+
+data DefaultParser = DefaultParser
+
+instance Parser DefaultParser where
+  fromString _ _ = throw $
+    Thrift.Exception "Batch location's parser is not implemented"
diff --git a/glean/db/Glean/Database/Catalog.hs b/glean/db/Glean/Database/Catalog.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Catalog.hs
@@ -0,0 +1,618 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveTraversable #-}
+{- | A Catalog stores metadata about available databases.
+A thread running Glean.Database.Backup.backuper will continuously read the
+state of the catalog to decide which dbs to restore/backup/finalize
+-}
+
+module Glean.Database.Catalog
+  ( Catalog
+  , Entry
+  , CatalogClosedError(..)
+  , EntryAlreadyExists(..)
+  , open
+  , close
+  , create
+  , delete
+  , list
+  , listMostRecent
+  , exists
+  , readMeta
+  , writeMeta
+  , modifyMeta
+  , readExpiring
+  , setExpiring
+  , unsetExpiring
+  , startRestoring
+  , finishRestoring
+  , abortRestoring
+  , resetElsewhere
+  , getLocalDatabases
+  , getLocalDatabase
+  , dbFailed
+  , resetFailed
+  -- for testing
+  , getEntries
+  , list'
+  , Entries
+  , EntriesF(..)
+  , EntryF(..)
+  , mkEntry
+  ) where
+
+import Control.Concurrent.Async
+import Control.Exception
+    ( Exception,
+      SomeException,
+      bracket,
+      bracket_,
+      try,
+      mask_,
+      uninterruptibleMask_ )
+import Control.Monad
+import Control.Monad.Catch (throwM)
+import Data.Functor.Identity
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.Maybe
+import qualified Data.Text as Text
+import Data.Time
+import Data.Typeable
+import GHC.Stack (HasCallStack)
+import System.IO (fixIO)
+
+import Util.Control.Exception (tryBracket)
+import qualified Util.Control.Exception.CallStack as CallStack
+import Util.Log
+import Util.STM
+
+import Glean.Database.Catalog.Filter
+import Glean.Database.Catalog.Store (Store)
+import qualified Glean.Database.Catalog.Store as Store
+import Glean.Database.Exception
+import Glean.Database.Meta
+import Glean.Database.Repo
+import Glean.Types (Repo(..))
+import qualified Glean.Internal.Types as Thrift
+import qualified Glean.Types as Thrift
+
+-- | Catalog entry
+type Entry = EntryF TVar
+
+-- | Catalog entry, parameterized by the state type;
+--   This extra generality comes handy in tests.
+data EntryF ref = Entry
+  { entryRepo :: Repo
+  , entryStatus :: ref ItemStatus
+      -- ^ This is the combined status of this db and the entryStatus of its
+      -- dependencies. Sent with restorable status as 'Thrift.DatabaseStatus'.
+  , entryMeta :: ref Meta
+  , entryDirty :: ref Bool
+      -- ^ does the metadata need to be written back (Entry must be in
+      -- 'catDirtyQueue' in that case)
+  , entryComitting :: ref Bool
+      -- ^ is the metadata being committed (Entry can't be deleted while this
+      -- is happening)
+  , entryExpiring :: ref (Maybe UTCTime)
+  }
+
+deriving instance Show (EntryF Identity)
+-- deriving instance Eq (EntryF Identity)
+
+-- | All databases known to the 'Catalog'.
+type Entries = EntriesF Entry
+
+-- | The type of all databases in the 'Catalog', parameterized by the entry type
+--   This extra generality comes handy in tests.
+data EntriesF entry = Entries
+  { entriesLiveHere :: HashMap Repo entry
+      -- ^ available databases
+  , entriesLiveElsewhere :: HashMap Repo entry
+      -- ^ available databases in another shard
+      --   ignored for all purposes except by getLocalDatabases
+  , entriesRestoring :: HashMap Repo Meta
+      -- ^ databases that are being restored
+  , entriesEphemeral :: HashSet Repo
+      -- ^ databases that are being created or deleted
+  , entriesFailed :: HashMap Repo SomeException
+      -- ^ databases that failed to open, and their exceptions
+  }
+  deriving (Show, Functor, Foldable, Traversable)
+
+
+-- | Catalog of database entries
+data Catalog = forall local. Store local => Catalog
+  { catLocal :: local
+      -- ^ local metadata storage
+  , catEntries :: TVar (Maybe Entries)
+      -- ^ all known entries ('Nothing' means catalog is closed)
+  , catDirtyQueue :: TQueue Entry
+      -- ^ queue of entries which need to have their metadata committed
+  , catCommitter :: Async ()
+      -- ^ metadata committer thread
+  , catRepoDependents :: TVar (HashMap Repo [Repo])
+      -- ^ keep track of repos that depend on a repo
+  }
+
+data CatalogClosedError = CatalogClosedError
+  deriving(Show,Typeable)
+
+instance Exception CatalogClosedError
+
+newtype EntryAlreadyExists = EntryAlreadyExists Repo
+  deriving(Eq,Show,Typeable)
+
+instance Exception EntryAlreadyExists
+
+mkEntry :: Repo -> Meta -> STM Entry
+mkEntry repo meta = Entry repo
+  <$> newTVar ItemMissing
+  <*> newTVar meta
+  <*> newTVar False
+  <*> newTVar False
+  <*> newTVar Nothing
+
+-- | Updates entryStatus. Needs be called whenever the status of this db or one
+-- of its dependencies changes
+recalculateStatus :: Catalog -> Entry -> STM ()
+recalculateStatus Catalog{..} entry = do
+  meta <- readTVar $ entryMeta entry
+  entries <- readTVar catEntries
+  case entries of
+    Nothing -> return ()
+    Just Entries{..} -> do
+      let
+        repo = entryRepo entry
+
+        missingStatus repo | repo `HashMap.member` entriesRestoring =
+          ItemRestoring
+        missingStatus _ = ItemMissing
+
+        dependencies = case metaDependencies meta of
+          Just (Thrift.Dependencies_stacked Thrift.Stacked{..}) ->
+            [(Repo stacked_name stacked_hash, stacked_guid)]
+          Just (Thrift.Dependencies_pruned up) ->
+            [(Thrift.pruned_base up, Thrift.pruned_guid up)]
+          Nothing -> []
+        live = repo `HashMap.member` entriesLiveHere
+      forM_ dependencies $ \(dep, _) -> if live then
+          modifyTVar' catRepoDependents $
+            HashMap.insertWith (<>) dep [repo]
+        else
+          modifyTVar' catRepoDependents $
+            HashMap.adjust (filter (repo /=)) dep
+
+      let
+        itemStatusFor :: Thrift.Completeness -> ItemStatus
+        itemStatusFor Thrift.Complete{} = ItemComplete
+        itemStatusFor Thrift.Incomplete{} = ItemIncomplete
+        itemStatusFor Thrift.Broken{} = ItemBroken
+        itemStatusFor Thrift.Finalizing{} = ItemFinalizing
+
+      dependencyStatuses <- forM dependencies $ \(dep, guid) -> do
+        let missing = missingStatus dep
+        case HashMap.lookup dep entriesLiveHere of
+          Nothing -> return missing
+          Just entry -> do
+            meta <- readTVar $ entryMeta entry
+            status <- readTVar $ entryStatus entry
+            let properties = Thrift.metaProperties meta
+            if HashMap.lookup "glean.guid" properties == guid then
+              return status
+            else
+              return missing
+
+      meta <- readTVar $ entryMeta entry
+      oldStatus <- readTVar $ entryStatus entry
+      let
+        status
+          | Just{} <- HashMap.lookup repo entriesFailed = ItemBroken
+          | live = itemStatusFor $ metaCompleteness meta
+          | otherwise = missingStatus repo
+        newStatus = mconcat $ status:dependencyStatuses
+
+      when (newStatus /= oldStatus) $ do
+        writeTVar (entryStatus entry) newStatus
+        recalculateDepsStatus Catalog{..} repo
+
+recalculateDepsStatus :: Catalog -> Repo -> STM ()
+recalculateDepsStatus Catalog{..} repo = do
+  repoDependents <- readTVar catRepoDependents
+  entries <- readTVar catEntries
+  forM_ (HashMap.lookupDefault [] repo repoDependents) $
+    \dep -> forM_ (entries >>= HashMap.lookup dep . entriesLiveHere) $
+      \entry -> recalculateStatus Catalog{..} entry
+
+itemDatabaseStatus :: ItemStatus -> Thrift.DatabaseStatus
+itemDatabaseStatus ItemComplete = Thrift.DatabaseStatus_Complete
+itemDatabaseStatus ItemIncomplete = Thrift.DatabaseStatus_Incomplete
+itemDatabaseStatus ItemRestoring = Thrift.DatabaseStatus_Restoring
+itemDatabaseStatus ItemBroken = Thrift.DatabaseStatus_Broken
+itemDatabaseStatus ItemMissing = Thrift.DatabaseStatus_Missing
+itemDatabaseStatus ItemFinalizing = Thrift.DatabaseStatus_Finalizing
+
+dirtyEntry :: Catalog -> Entry -> STM ()
+dirtyEntry cat entry = do
+  dirty <- swapTVar (entryDirty entry) True
+  when (not dirty) $ writeTQueue (catDirtyQueue cat) entry
+
+-- | Metadata committer thread. This thread should *never* be cancelled since it
+-- needs to process outstanding commit requests before shutting down.
+-- Accordingly, it runs in uninterruptibleMask_. Note that crashing in case of
+-- heap/stack overflow is preferable to this thread dying.
+commit :: Catalog -> IO ()
+commit cat@Catalog{..} = uninterruptibleMask_ loop
+  where
+    loop = do
+      continue <- bracket
+        -- get Just the next entry or Nothing if the Catalog has been closed
+        (atomically $
+          do
+            entry <- readTQueue catDirtyQueue
+            writeTVar (entryComitting entry) True
+            return $ Just entry
+          `orElse`
+          do
+            open <- isJust <$> readTVar catEntries
+            when open retry
+            return Nothing)
+        (\r -> forM_ r $ \entry ->
+            atomically $ writeTVar (entryComitting entry) False)
+        $ \r -> case r of
+            Just entry@Entry{..} -> do
+              meta <- atomically $ do
+                writeTVar entryDirty False
+                readTVar entryMeta
+              -- catch *all* exceptions
+              r <- try $ Store.put catLocal entryRepo meta
+              case r of
+                Right ok -> when (not ok) $
+                  -- TODO: What do we do in this case?
+                  logError $ inRepo entryRepo
+                    "couldn't commit meta because entry no longer exists"
+                Left (exc :: SomeException) -> do
+                  -- TODO: this is lame - it's not clear what to do if we can't
+                  -- write the metadata
+                  logError $ inRepo entryRepo $
+                    "couldn't commit meta: " ++ show exc
+                  atomically $ dirtyEntry cat entry
+              return True
+            Nothing -> return False
+      when continue loop
+
+getEntries :: Catalog -> STM Entries
+getEntries cat = do
+  r <- readTVar $ catEntries cat
+  case r of
+    Just entries -> return entries
+    Nothing -> throwSTM CatalogClosedError
+
+lookupEntry :: Catalog -> Repo -> STM (Maybe Entry)
+lookupEntry cat repo = HashMap.lookup repo . entriesLiveHere <$> getEntries cat
+
+getEntry :: HasCallStack => Catalog -> Repo -> STM Entry
+getEntry cat repo = do
+  r <- lookupEntry cat repo
+  case r of
+    Just entry -> return entry
+    Nothing -> CallStack.throwSTM $ Thrift.UnknownDatabase repo
+
+-- | Open a 'Catalog'
+open :: Store local => local -> IO Catalog
+open local = do
+  metas <- Store.list local
+  live <- atomically $ HashMap.traverseWithKey mkEntry metas
+  entries <- newTVarIO $ Just Entries
+    { entriesLiveHere = live
+    , entriesLiveElsewhere = mempty
+    , entriesRestoring = mempty
+    , entriesEphemeral = mempty
+    , entriesFailed = mempty
+    }
+  dependents <- newTVarIO mempty
+  dirty_queue <- newTQueueIO
+  cat <- fixIO $ \cat -> do
+    committer <- mask_ $ async $ commit cat
+    return Catalog
+      { catLocal = local
+      , catEntries = entries
+      , catDirtyQueue = dirty_queue
+      , catCommitter = committer
+      , catRepoDependents = dependents
+      }
+  forM_ (HashMap.elems live) $ \entry ->
+    atomically $ recalculateStatus cat entry
+  return cat
+
+-- | Close a 'Catalog'
+close :: Catalog -> IO ()
+close cat = do
+  atomically $ do
+    Entries{..} <- getEntries cat
+    when (not $ HashSet.null entriesEphemeral) retry
+    writeTVar (catEntries cat) Nothing
+  void $ waitCatch $ catCommitter cat
+
+-- | Create a new entry in a 'Catalog' and execute the supplied action if
+-- creation was successful.
+create :: Catalog -> Repo -> Meta -> STM () -> IO ()
+create cat@Catalog{..} repo meta on_success = tryBracket
+  (atomically $ do
+    Entries{..} <- getEntries cat
+    when
+      (repo `HashMap.member` entriesLiveHere
+        || repo `HashSet.member` entriesEphemeral
+        || repo `HashMap.member` entriesRestoring) $
+      throwSTM $ EntryAlreadyExists repo
+    writeTVar catEntries $ Just Entries
+      { entriesEphemeral = HashSet.insert repo entriesEphemeral, .. })
+  (\_ r -> atomically $ do
+    entry <- mkEntry repo meta
+    modifyTVar' catEntries $ fmap $ \Entries{..} -> Entries
+      { entriesEphemeral = HashSet.delete repo entriesEphemeral
+      , entriesLiveHere = case r of
+          Right _ -> HashMap.insert repo entry entriesLiveHere
+          Left _ -> entriesLiveHere
+      , ..
+      }
+    recalculateStatus cat entry
+    forM_ r $ const on_success)
+  $ const $ do
+    ok <- Store.create catLocal repo meta
+    -- This is *not* an EntryAlreadyExists error
+    when (not ok) $ dbError repo
+      "database already exists in local metadata store"
+
+-- | Permanently delete an entry from a 'Catalog'
+delete :: Catalog -> Repo -> IO ()
+delete cat@Catalog{..} repo = bracket_
+  (atomically $ do
+    entry <- getEntry cat repo
+    committing <- readTVar (entryComitting entry)
+    when committing retry
+    dirty <- readTVar (entryDirty entry)
+    when dirty $ do
+      es <- flushTQueue catDirtyQueue
+      mapM_ (writeTQueue catDirtyQueue)
+        $ filter (\e -> entryRepo e /= repo) es
+    modifyTVar' catEntries $ fmap $ \Entries{..} -> Entries
+      { entriesLiveHere = HashMap.delete repo entriesLiveHere
+      , entriesEphemeral = HashSet.insert repo entriesEphemeral
+      , ..
+      }
+    recalculateStatus cat entry)
+  (atomically $ modifyTVar' catEntries $ fmap $ \Entries{..} -> Entries
+    { entriesEphemeral = HashSet.delete repo entriesEphemeral, .. })
+  -- Ignore if it doesn't exist for now
+  $ void $ Store.delete catLocal repo
+
+-- | List all databases in the given localities that match the given filters
+list :: Catalog -> [Locality] -> Filter () -> STM [Item]
+list cat locs f = getEntries cat >>= list' readTVar locs f
+
+list'
+  :: Monad m
+  => (forall a. f a -> m a)
+  -> [Locality]
+  -> Filter ()
+  -> EntriesF (EntryF f)
+  -> m [Item]
+list' read locs f Entries{..} = do
+  fmap (runFilter f . concat) $ forM locs $ \loc -> do
+    xs <- case loc of
+      Local -> mapM statusAndMeta entriesLiveHere
+      Restoring -> return $ fmap (ItemRestoring,) entriesRestoring
+      Cloud -> mapM statusAndMeta entriesLiveElsewhere
+    return $
+      [ Item repo loc meta status
+      | (repo, (status, meta)) <- HashMap.toList xs]
+  where
+    -- statusAndMeta :: Entry -> f (ItemStatus, Meta)
+    statusAndMeta Entry{..} = do
+      status <- read entryStatus
+      meta <- read entryMeta
+      return (status, meta)
+
+-- | List the most recent instances of all DBs in the Catalog
+listMostRecent :: Catalog -> IO [Item]
+listMostRecent catalog =  atomically $
+  list catalog [Local, Restoring, Cloud] $ groupF repoNameV $ do
+    sortF createdV Descending
+    limitF 1
+
+-- | Check if a database exists in the catalog
+exists :: Catalog -> [Locality] -> Repo -> STM Bool
+exists cat locs repo = do
+  Entries{..} <- getEntries cat
+  let exists_in Local = HashMap.member repo entriesLiveHere
+      exists_in Restoring = HashMap.member repo entriesRestoring
+      exists_in Cloud = False
+  return $ any exists_in locs
+
+-- | Read the metadata of a database
+readMeta :: HasCallStack => Catalog -> Repo -> STM Meta
+readMeta cat repo = do
+  entry <- getEntry cat repo
+  readTVar (entryMeta entry)
+
+-- | Update the metadata of a database
+writeMeta :: Catalog -> Repo -> Meta -> STM ()
+writeMeta cat repo meta = do
+  entry <- getEntry cat repo
+  writeTVar (entryMeta entry) meta
+  recalculateStatus cat entry
+  dirtyEntry cat entry
+
+-- | Modify the metadata of a database and return the new metadata
+modifyMeta :: Catalog -> Repo -> (Meta -> STM Meta) -> STM Meta
+modifyMeta cat repo f = do
+  entry <- getEntry cat repo
+  old_meta <- readTVar (entryMeta entry)
+  new_meta <- f old_meta
+  writeTVar (entryMeta entry) new_meta
+  recalculateStatus cat entry
+  dirtyEntry cat entry
+  return new_meta
+
+dbFailed :: Catalog -> Repo -> SomeException -> STM ()
+dbFailed cat repo exception = do
+  Entries{..} <- getEntries cat
+  writeTVar (catEntries cat) $ Just Entries
+    { entriesFailed = HashMap.insert repo exception entriesFailed
+    , ..
+    }
+  entry <- getEntry cat repo
+  recalculateStatus cat entry
+
+resetFailed :: Catalog -> STM ()
+resetFailed cat = do
+  Entries{..} <- getEntries cat
+  writeTVar (catEntries cat) $ Just Entries
+    { entriesFailed = HashMap.empty
+    , ..
+    }
+
+readExpiring :: Catalog -> Repo -> STM (Maybe UTCTime)
+readExpiring cat repo = do
+  entry <- getEntry cat repo
+  readTVar $ entryExpiring entry
+
+setExpiring :: Catalog -> Repo -> UTCTime -> STM ()
+setExpiring cat repo time = do
+  entry <- getEntry cat repo
+  writeTVar (entryExpiring entry) $ Just time
+
+-- | Unset the expiring bit, to no longer mark the 'Repo' as expiring
+unsetExpiring :: Catalog -> Repo -> STM ()
+unsetExpiring cat repo = do
+  entry <- getEntry cat repo
+  writeTVar (entryExpiring entry) Nothing
+
+-- | Schedule a database for download/restore
+startRestoring :: Catalog -> Repo -> Meta -> STM ()
+startRestoring cat repo meta = do
+  Entries{..} <- getEntries cat
+  when
+    (repo `HashMap.member` entriesLiveHere
+      || repo `HashMap.member` entriesRestoring
+      || repo `HashSet.member` entriesEphemeral)
+    $ throwM DBAlreadyExists
+  writeTVar (catEntries cat) $ Just Entries
+    { entriesRestoring = HashMap.insert repo meta entriesRestoring
+    , ..
+    }
+  recalculateDepsStatus cat repo
+
+-- | Notify the catalog that the database has been restored and is available
+-- locally
+finishRestoring :: Catalog -> Repo -> IO ()
+finishRestoring cat@Catalog{..} repo = tryBracket
+  (atomically $ do
+    Entries{..} <- getEntries cat
+    case HashMap.lookup repo entriesRestoring of
+      Just meta -> do
+        writeTVar catEntries $ Just Entries
+          { entriesRestoring = HashMap.delete repo entriesRestoring
+          , entriesEphemeral = HashSet.insert repo entriesEphemeral
+          , ..
+          }
+        return meta
+      Nothing -> dbError repo "finishRestoring: unknown database")
+  (\meta r -> atomically $ do
+    entry <- mkEntry repo meta
+    modifyTVar' catEntries $ fmap $ \Entries{..} -> Entries
+      { entriesEphemeral = HashSet.delete repo entriesEphemeral
+      , entriesLiveHere = case r of
+          Right _ -> HashMap.insert repo entry entriesLiveHere
+          Left _ -> entriesLiveHere
+      , .. }
+    recalculateStatus cat entry)
+  $ \meta -> do
+    ok <- Store.create catLocal repo meta
+    when (not ok) $ dbError repo
+      "finishRestoring: entry already exists in local metadata store"
+
+-- | Notify the catalog that the database is no longer being restored
+abortRestoring :: Catalog -> Repo -> STM ()
+abortRestoring cat repo = do
+  Entries{..} <- getEntries cat
+  when (not $ repo `HashMap.member` entriesRestoring) $ dbError repo
+    "abortRestoring: unknown database"
+  writeTVar (catEntries cat) $ Just Entries
+    { entriesRestoring = HashMap.delete repo entriesRestoring
+    , .. }
+  recalculateDepsStatus cat repo
+
+-- | Reset the catalog of items available elsewhere to the ones given
+resetElsewhere :: Catalog -> [Item] -> STM ()
+resetElsewhere cat items = do
+  Entries{..} <- getEntries cat
+  entriesElsewhere <- forM items $ \Item{..} -> do
+    e <- mkEntry itemRepo itemMeta
+    return (itemRepo, e)
+  writeTVar (catEntries cat) $ Just Entries
+    { entriesLiveElsewhere =
+        HashMap.fromList entriesElsewhere
+    , ..
+    }
+
+getLocalDatabases :: Catalog -> STM (HashMap Repo Thrift.GetDatabaseResult)
+getLocalDatabases cat = do
+  Entries{..} <- getEntries cat
+  local <- HashMap.traverseWithKey (local_db Nothing) entriesLiveHere
+  elsewhere <- HashMap.traverseWithKey
+    (local_db (Just Thrift.DatabaseStatus_Available))
+    entriesLiveElsewhere
+  return $ mconcat
+    [ elsewhere
+    , updateFailed entriesFailed local
+    , HashMap.mapWithKey restoring_db entriesRestoring
+    ]
+  where
+    updateFailed entriesFailed = HashMap.mapWithKey $
+      \repo r@Thrift.GetDatabaseResult{..} ->
+        if
+          | Just exception <- HashMap.lookup repo entriesFailed ->
+            Thrift.GetDatabaseResult {
+              getDatabaseResult_database = getDatabaseResult_database {
+                Thrift.database_broken = Just $ Thrift.DatabaseBroken
+                  { databaseBroken_task = "open"
+                  , databaseBroken_reason = Text.pack (show exception)
+                  }
+                },
+              ..
+            }
+          | otherwise -> r
+
+    local_db overrideStatus repo entry = do
+      meta <- readTVar $ entryMeta entry
+      exp <- readTVar $ entryExpiring entry
+      status <- readTVar $ entryStatus entry
+      return Thrift.GetDatabaseResult
+        { getDatabaseResult_database = metaToThriftDatabase
+            (fromMaybe (itemDatabaseStatus status) overrideStatus)
+            exp
+            repo
+            meta
+        }
+
+    restoring_db repo meta = Thrift.GetDatabaseResult
+      { getDatabaseResult_database = metaToThriftDatabase
+          Thrift.DatabaseStatus_Restoring
+          Nothing
+          repo
+          meta
+      }
+
+getLocalDatabase :: Catalog -> Repo -> STM (Maybe Thrift.GetDatabaseResult)
+-- TODO: This isn't very efficient
+getLocalDatabase cat repo = HashMap.lookup repo <$> getLocalDatabases cat
diff --git a/glean/db/Glean/Database/Catalog/Filter.hs b/glean/db/Glean/Database/Catalog/Filter.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Catalog/Filter.hs
@@ -0,0 +1,164 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | This module implements a simple query language for Catalog entries. The
+-- main goal is to have something that can be used for in-memory parts and SQL
+-- databases.
+--
+-- This is very much work in progress.
+{-# LANGUAGE DeriveAnyClass, DerivingStrategies #-}
+module Glean.Database.Catalog.Filter
+  ( Locality(..)
+  , ItemStatus(..)
+  , Filter
+  , Item(..)
+  , Value
+  , Order(..)
+  , everythingF
+  , queryableF
+  , incompleteQueryableF
+  , (.==.)
+  , inF
+  , notInF
+  , groupF
+  , sortF
+  , limitF
+  , repoV
+  , localityV
+  , repoNameV
+  , createdV
+  , statusV
+  , backedUpV
+  , runFilter
+  ) where
+
+import qualified Control.Monad.State.Strict as S
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.Hashable (Hashable)
+import Data.List (sortOn)
+import Data.Maybe
+import Data.Ord (Down(..))
+import Data.Text (Text)
+import GHC.Generics hiding (Meta)
+
+import Glean.Database.Meta
+import Glean.Types (Repo(..))
+import qualified Glean.Types as Thrift
+
+-- | How a DB is available, in priority order
+-- (used to resolve conflicts of two dbs with the same name)
+data Locality = Local | Restoring | Cloud
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+-- | The status of a stacked database, ordered by increasing severity.
+-- This is DatabaseStatus minus Restorable.
+data ItemStatus
+  = ItemComplete
+  | ItemFinalizing
+  | ItemIncomplete
+  | ItemBroken
+  | ItemRestoring
+  | ItemMissing
+  deriving (Eq,Ord,Show,Generic,Hashable)
+
+instance Semigroup ItemStatus where
+  (<>) = max
+
+instance Monoid ItemStatus where
+  mempty = ItemComplete
+
+
+data Item = Item
+  { itemRepo :: Repo
+  , itemLocality :: Locality
+  , itemMeta :: Meta
+  , itemStatus :: ItemStatus
+  } deriving(Show)
+
+-- | A field that can be used in queries
+newtype Value a = Value (Item -> a)
+
+repoV :: Value Repo
+repoV = Value itemRepo
+
+repoNameV :: Value Text
+repoNameV = Value (repo_name . itemRepo)
+
+localityV :: Value Locality
+localityV = Value itemLocality
+
+createdV :: Value Thrift.PosixEpochTime
+createdV = Value (metaCreated . itemMeta)
+
+statusV :: Value Thrift.DatabaseStatus
+statusV = Value (completenessStatus . itemMeta)
+
+entryStatusV :: Value ItemStatus
+entryStatusV = Value itemStatus
+
+backedUpV :: Value Bool
+backedUpV = Value (isJust . metaBackup . itemMeta)
+
+newtype Filter a = Filter (S.State [Item] a)
+  deriving newtype (Functor,Applicative,Monad)
+
+runFilter :: Filter () -> [Item] -> [Item]
+runFilter (Filter m) = S.execState m
+
+modify :: ([Item] -> [Item]) -> Filter ()
+modify = Filter . S.modify'
+
+filter_ :: (Item -> Bool) -> Filter ()
+filter_ = modify . filter
+
+everythingF :: Filter ()
+everythingF = return ()
+
+queryableF :: Filter ()
+queryableF =
+  inF entryStatusV $
+    HashSet.fromList [ItemComplete , ItemIncomplete, ItemFinalizing]
+    -- broken DBs may or may not be queryable.
+
+incompleteQueryableF :: Filter ()
+incompleteQueryableF =
+  inF entryStatusV $
+    HashSet.fromList [ItemIncomplete, ItemFinalizing]
+
+-- | Require that a field has a specific value
+(.==.) :: Eq a => Value a -> a -> Filter ()
+Value f .==. x = filter_ $ \q -> f q == x
+
+-- | Require that a field's value is in a set
+inF :: (Eq a, Hashable a) => Value a -> HashSet a -> Filter ()
+inF (Value f) xs = filter_ $ \q -> f q `HashSet.member` xs
+
+-- | Require that a field's value is not in a set
+notInF :: (Eq a, Hashable a) => Value a -> HashSet a -> Filter ()
+notInF (Value f) xs = filter_ $ \q -> not $ f q `HashSet.member` xs
+
+-- | Group the data by a field and apply the clauses to each group separately
+groupF :: (Eq a, Hashable a) => Value a -> Filter () -> Filter ()
+groupF (Value f) (Filter p) = modify $ \qs ->
+  concatMap (S.execState p . reverse)
+  $ HashMap.elems
+  $ HashMap.fromListWith (++) [(f q, [q]) | q <- qs]
+
+data Order = Ascending | Descending
+  deriving(Eq,Ord,Enum,Bounded,Read,Show)
+
+-- | Sort the data by a field
+sortF :: Ord a => Value a -> Order -> Filter ()
+sortF (Value f) Ascending = modify $ sortOn f
+sortF (Value f) Descending = modify $ sortOn $ Down . f
+
+-- | Only keep the first n data items
+limitF :: Int -> Filter ()
+limitF = modify . take
diff --git a/glean/db/Glean/Database/Catalog/Local/Files.hs b/glean/db/Glean/Database/Catalog/Local/Files.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Catalog/Local/Files.hs
@@ -0,0 +1,104 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Catalog.Local.Files
+  ( Files
+  , fileCatalog
+  ) where
+
+import Control.Monad
+import qualified Data.ByteString as BS
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.Maybe
+import qualified Data.Text as Text
+import System.Directory
+import System.FilePath
+
+import qualified Thrift.Protocol.JSON as Thrift
+import Util.Control.Exception (catchAll)
+import Util.IO
+import Util.Log
+
+import Glean.Database.Catalog.Store
+import Glean.Database.Exception
+import Glean.Database.Meta (Meta)
+import Glean.Database.Repo (databasePath)
+import Glean.Types (Repo(..))
+import Glean.Util.IO (readFileContents)
+
+newtype Files = Files { _filesRoot :: FilePath }
+
+metaPath :: FilePath -> Repo -> FilePath
+metaPath root repo = databasePath root repo </> "meta"
+
+fileCatalog :: FilePath -> Files
+fileCatalog = Files
+
+instance Store Files where
+  list (Files root) = do
+    ex <- doesDirectoryExist root
+    if not ex then return mempty else do
+    dirs <- filter (not . isPrefixOf ".") <$> getDirectoryContents root
+    fmap (HashMap.fromList . catMaybes . concat) $ forM dirs $ \subdir -> do
+      let dir = root </> subdir
+          repo_name = Text.pack subdir
+      hashes <- filter (not . isPrefixOf ".") <$> getDirectoryContents dir
+        `catchAll` \exc -> do
+          logError $ concat ["couldn't read directory ", dir, ": ", show exc]
+          return []
+      forM hashes $ \hash ->
+        let path = dir </> hash
+            skip msg = do
+              logError $ concat [path, ": ", msg]
+              return Nothing
+        in
+        do
+          s <- readFileContents $ path </> "meta"
+          case Thrift.deserializeJSON s of
+            Right meta -> do
+              return $ Just (Repo repo_name (Text.pack hash), meta)
+            Left err -> skip err
+        `catchAll` (skip . show)
+
+  create (Files root) repo meta = do
+    -- TODO: make this atomic if necessary (cf. renameat2)
+    new <- not <$> doesFileExist (metaPath root repo)
+    when new $ do
+      createDirectoryIfMissing True $ databasePath root repo
+      writeMeta root repo meta
+    return new
+
+  delete (Files root) repo = do
+    -- TODO: make this atomic if necessary
+    exists <- doesFileExist (metaPath root repo)
+    when exists $ safeRemovePathForcibly $ metaPath root repo
+    return exists
+
+  put (Files root) repo meta = do
+    -- TODO: make this atomic if necessary
+    exists <- doesFileExist (metaPath root repo)
+    when exists $ writeMeta root repo meta
+    return exists
+
+  get (Files root) repo = do
+    let path = metaPath root repo
+    exists <- doesFileExist (metaPath root repo)
+    if exists
+      then do
+        s <- readFileContents $ path </> "meta"
+        case Thrift.deserializeJSON s of
+          Right meta -> return $ Just meta
+          Left err -> dbError repo $  "can't parse '" ++ path ++ "': " ++ err
+      else
+        return Nothing
+
+writeMeta :: FilePath -> Repo -> Meta -> IO ()
+writeMeta root = writeFileAtomically
+  (\h -> BS.hPut h . Thrift.serializeJSON)
+  . metaPath root
diff --git a/glean/db/Glean/Database/Catalog/Local/Memory.hs b/glean/db/Glean/Database/Catalog/Local/Memory.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Catalog/Local/Memory.hs
@@ -0,0 +1,45 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Catalog.Local.Memory
+  ( Memory
+  , memoryCatalog
+  ) where
+
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.IORef
+
+import Glean.Database.Catalog.Store
+import Glean.Database.Meta (Meta)
+import Glean.Types (Repo(..))
+
+newtype Memory = Memory (IORef (HashMap Repo Meta))
+
+memoryCatalog :: IO Memory
+memoryCatalog = Memory <$> newIORef mempty
+
+instance Store Memory where
+  list (Memory v) = readIORef v
+
+  create (Memory v) repo meta = atomicModifyIORef' v $ \xs ->
+    if repo `HashMap.member` xs
+      then (xs, False)
+      else (HashMap.insert repo meta xs, True)
+
+  delete (Memory v) repo = atomicModifyIORef' v $ \xs ->
+    if repo `HashMap.member` xs
+      then (HashMap.delete repo xs, True)
+      else (xs, False)
+
+  put (Memory v) repo meta = atomicModifyIORef' v $ \xs ->
+    if repo `HashMap.member` xs
+      then (HashMap.insert repo meta xs, True)
+      else (xs, False)
+
+  get (Memory v) repo = HashMap.lookup repo <$> readIORef v
diff --git a/glean/db/Glean/Database/Catalog/Store.hs b/glean/db/Glean/Database/Catalog/Store.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Catalog/Store.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Catalog.Store
+  ( Store(..)
+  ) where
+
+import Data.HashMap.Strict
+
+import Glean.Database.Meta (Meta)
+import Glean.Types (Repo)
+
+-- | A metadata store
+class Store a where
+  -- | List all available entries.
+  list :: a -> IO (HashMap Repo Meta)
+
+  -- | Create an entry if it doesn't exist. Return `True` if entry was created
+  -- and `False` if it already existed.
+  create :: a -> Repo -> Meta -> IO Bool
+
+  -- | Delete an entry. Return `True` if entry was deleted and `False` if it
+  -- didn't exist
+  delete :: a -> Repo -> IO Bool
+
+  -- | Update the metadata of an entry. Return `True` if metadata was updated
+  -- and `False` if the entry didn't exist.
+  put :: a -> Repo -> Meta -> IO Bool
+
+  -- | Read the metadata of an entry, returning `Nothing` if the entry didn't
+  -- exist.
+  get :: a -> Repo -> IO (Maybe Meta)
diff --git a/glean/db/Glean/Database/Close.hs b/glean/db/Glean/Database/Close.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Close.hs
@@ -0,0 +1,143 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Close (
+  closeDatabase,
+  closeDatabases,
+  closeIdleDatabase,
+  closeIdleDatabases,
+  closeOpenDB,
+) where
+
+import Control.Exception hiding(handle)
+import Control.Monad.Extra
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import qualified Data.Text.Encoding as Text
+
+import ServiceData.GlobalStats as Stats
+import Util.STM
+
+import Glean.Database.Open
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Types
+import Glean.Database.Writes
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import Glean.Types hiding (Database)
+import qualified Glean.Types as Thrift
+import Glean.Util.Mutex
+import Util.Time
+
+
+closeDatabases :: Env -> IO ()
+closeDatabases env@Env{..} = do
+  dbs <- readTVarIO envActive
+  forM_ (HashMap.keys dbs) $ closeDatabase env
+
+isIdle :: (TimePoint -> Bool) -> DB s -> OpenDB s -> STM Bool
+isIdle long_enough db odb = and <$> sequence
+  [ (== 1) <$> readTVar (dbUsers db)  -- we are the only user
+  , long_enough <$> readTVar (odbIdleSince odb)
+  , case odbWriting odb of
+      Just Writing{..} -> do
+        writeQueueSize <- readTVar (writeQueueSize wrQueue)
+        commit <- readTVar wrCommit
+        return $ writeQueueSize == 0 && isNothing commit
+      Nothing -> return True
+  ]
+
+closeIf
+  :: (forall s . DB s -> DBState s -> STM (Maybe (OpenDB s)))
+  -> Env
+  -> Repo
+  -> IO ()
+closeIf should_close env repo = usingActiveDatabase env repo $ \r ->
+  forM_ r $ \db -> mask_ $ do
+    r <- atomically $ do
+      state <- readTVar $ dbState db
+      o <- should_close db state
+      case o of
+        Just odb -> do
+          idle <- isIdle (const True) db odb
+          when (not idle) retry
+          writeTVar (dbState db) Closing
+          return $ Just (db,odb)
+        Nothing -> return Nothing
+
+    forM_ r $ \(db, odb) ->
+      -- the actual closing of the DB must be uninterruptible
+      uninterruptibleMask_ (closeOpenDB env odb)
+        `finally` atomically (writeTVar (dbState db) Closed)
+
+closeDatabase :: Env -> Repo -> IO ()
+closeDatabase env = closeIf
+  (\_ state -> case state of
+    Opening -> retry
+    Open odb -> do
+      deleteWriteQueues env odb
+      case odbWriting odb of
+        Just Writing{..} -> do
+          r <- readTVar wrCommit
+          when (isJust r) retry
+        Nothing -> return ()
+      return $ Just odb
+    Closing -> retry
+    Closed -> return Nothing)
+  env
+
+-- | Synchronously close a database if it has been idle for more than
+-- `duration`.
+closeIdleDatabase :: Env -> Repo -> DiffTimePoints -> IO ()
+closeIdleDatabase env repo duration = do
+  now <- getTimePoint
+  closeIf
+    (\db state -> case state of
+        Opening -> return Nothing
+        Open odb -> do
+          idle <- isIdle
+            (\last_use -> diffTimePoints last_use now >= duration)
+            db
+            odb
+          return $ if idle then Just odb else Nothing
+        Closing -> return Nothing
+        Closed -> return Nothing)
+    env
+    repo
+
+closeIdleDatabases :: Env -> DiffTimePoints -> [Repo] -> IO ()
+closeIdleDatabases env@Env{..} duration blocklist = do
+  dbs <- readTVarIO envActive
+  let notBlocklisted = filter (not . (`elem` blocklist)) (HashMap.keys dbs)
+  forM_ notBlocklisted $ \repo -> closeIdleDatabase env repo duration
+  exportOpenDBStats env
+
+-- | set a counter glean.db.<repo>.open to the number of currently
+-- open DBs for that particular repo name.
+exportOpenDBStats :: Env -> IO ()
+exportOpenDBStats Env{..} = do
+  opens <- atomically $ do
+    dbs <- readTVar envActive
+    forM (HashMap.toList dbs) $ \(repo, db) -> do
+      state <- readTVar (dbState db)
+      case state of
+        Open{} -> return [(Thrift.repo_name repo, 1)]
+        Opening{} -> return [(Thrift.repo_name repo, 1)]
+        _ -> return []
+  let repoOpenCounts = HashMap.fromListWith (+) (concat opens)
+  forM_ (HashMap.toList repoOpenCounts) $ \(repoNm,count) -> do
+    setCounter ("glean.db." <> Text.encodeUtf8 repoNm <> ".open") count
+
+closeOpenDB :: Storage.Storage s => Env -> OpenDB s -> IO ()
+closeOpenDB env OpenDB{..} = do
+  case odbWriting of
+    Just Writing{..} -> do
+      -- free memory and update counters
+      withMutex wrLock $ const $ LookupCache.clear wrLookupCache
+      updateLookupCacheStats env
+    Nothing -> return ()
+  Storage.close odbHandle
diff --git a/glean/db/Glean/Database/CompletePredicates.hs b/glean/db/Glean/Database/CompletePredicates.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/CompletePredicates.hs
@@ -0,0 +1,238 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.CompletePredicates
+  ( completePredicates
+  , syncCompletePredicates
+  ) where
+
+import Control.Concurrent.Async
+import Control.Exception
+import Control.Monad
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Text as Text
+import System.Timeout
+
+import Util.Control.Exception
+import Util.Defer
+import Util.Log.Text
+import Util.Logger
+import Util.STM
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Open
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+  ( lookupPredicateSourceRef
+  , SchemaSelector(..)
+  )
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Types
+import Glean.Internal.Types as Thrift
+import Glean.Logger
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Types (Pid)
+import Glean.Schema.Util (convertRef)
+import Glean.Types as Thrift
+import qualified Glean.Util.Warden as Warden
+import Glean.Util.Mutex
+
+
+-- | Client API: kick off the completion process for a DB asynchronously
+completePredicates
+  :: Env
+  -> Repo
+  -> Thrift.CompletePredicates
+  -> IO CompletePredicatesResponse
+completePredicates env repo complete =
+  case complete of
+    Thrift.CompletePredicates_axiom _ ->
+      completeAxiomPredicates env repo
+    Thrift.CompletePredicates_derived (Thrift.CompleteDerivedPredicate pred) ->
+      completeDerivedPredicate env repo pred
+
+-- For internal use: actually perform completion for a DB
+syncCompletePredicates :: Env -> Repo -> IO ()
+syncCompletePredicates env repo =
+  -- log this, because the completePredicates request itself is async
+  -- and doesn't record the total time spent.
+  loggingAction
+    (runLogRepo "completePredicates(server)" env repo) (const mempty) $ do
+  maybeBase <- repoParent env repo
+  let withBase repo f =
+        readDatabase env repo $ \_ lookup -> f (Just lookup)
+  maybe ($ Nothing) withBase maybeBase $ \base -> do
+  withOpenDatabase env repo $ \OpenDB{..} -> do
+    own <- Storage.computeOwnership odbHandle base
+      (schemaInventory odbSchema)
+    withWriteLock odbWriting $ \lock ->
+      Storage.storeOwnership odbHandle lock own
+    maybeOwnership <- readTVarIO odbOwnership
+    forM_ maybeOwnership $ \ownership -> do
+      stats <- getOwnershipStats ownership
+      logInfo $ "ownership propagation complete: " <> showOwnershipStats stats
+
+completeAxiomPredicates :: Env -> Repo -> IO CompletePredicatesResponse
+completeAxiomPredicates env@Env{..} repo = do
+  let
+    doCompletion = -- we are masked in here
+      (`finally` deregister) $ do
+      r <- tryAll $ syncCompletePredicates env repo
+      case r of
+        Left (e :: SomeException) -> do
+          setBroken repo envCatalog "completePredicates" e
+          throwIO e
+        Right{} -> setComplete
+
+    deregister =
+      atomically $ modifyTVar envCompleting $ HashMap.delete repo
+
+    setComplete = void $ atomically $
+      Catalog.modifyMeta envCatalog repo $ \meta ->
+        return meta { metaAxiomComplete = True }
+
+    isInProgress = do
+      completing <- now $ readTVar envCompleting
+      return (HashMap.lookup repo completing)
+
+    storeComputation async =
+      modifyTVar envCompleting (HashMap.insert repo async)
+
+  scheduleCompletion
+    env repo SkipIfComplete doCompletion isInProgress storeComputation
+
+-- | Propagate ownership information for an externally derived predicate.
+syncCompleteDerivedPredicate :: Env -> Repo -> Pid -> IO ()
+syncCompleteDerivedPredicate env repo pid =
+  withOpenDatabase env repo $ \OpenDB{..} -> do
+  maybeOwnership <- readTVarIO odbOwnership
+  forM_ maybeOwnership $ \ownership -> do
+    maybeBase <- repoParent env repo
+    let withBase repo f = readDatabase env repo $ \_ lookup -> f (Just lookup)
+    maybe ($ Nothing) withBase maybeBase $ \base ->
+      withWriteLock odbWriting $ \lock -> do
+        computed <- Storage.computeDerivedOwnership
+          odbHandle lock ownership base pid
+        Storage.storeOwnership odbHandle lock computed
+
+withWriteLock
+  :: Maybe Writing
+  -> (forall w . Storage.WriteLock w -> IO b)
+  -> IO b
+withWriteLock Nothing f = f (undefined :: Storage.WriteLock ())
+  -- if there's no write lock, we must be in the finalization
+  -- phase and the DB has already been marked read-only. We have
+  -- exclusive write access at this point so it's safe to
+  -- continue.
+withWriteLock (Just writing) f =
+  withMutexSafe (wrLock writing) f
+
+-- | Kick off completion of externally derived predicate asynchronously
+completeDerivedPredicate
+  :: Env
+  -> Repo
+  -> PredicateRef
+  -> IO CompletePredicatesResponse
+completeDerivedPredicate env@Env{..} repo pred = do
+  details <- withOpenDatabase env repo $ \odb ->
+    predicateDetails (odbSchema odb) pred
+  completing <- readTVarIO envCompletingDerived
+  let
+      doCompletion = do -- we are masked in here
+        r <- tryAll $
+          syncCompleteDerivedPredicate env repo (predicatePid details)
+        case r of
+          Left (e :: SomeException) -> do
+            setBroken repo envCatalog "completeDerivedPredicate" e
+            throwIO e
+          Right{} -> return ()
+
+      derivations = HashMap.lookupDefault mempty repo completing
+
+      predId = predicateId details
+
+      isInProgress = do
+        return (HashMap.lookup predId derivations)
+
+      storeComputation async =
+        modifyTVar envCompletingDerived $
+          HashMap.insert repo $
+          HashMap.insert predId async derivations
+
+  scheduleCompletion
+    env repo FailIfNotComplete doCompletion isInProgress storeComputation
+  where
+  predicateDetails schema pred =
+    case lookupPredicateSourceRef (convertRef pred) LatestSchema schema of
+      Right details -> return details
+      Left err ->
+        throwIO $ Thrift.Exception $ "completeDerivedPredicate: " <> err
+
+data OnAxiomComplete
+  = SkipIfComplete
+  | FailIfNotComplete
+
+scheduleCompletion
+  :: Env
+  -> Repo
+  -> OnAxiomComplete
+  -> IO ()
+  -> Defer IO STM (Maybe (Async ()))
+  -> (Async () -> STM ())
+  -> IO CompletePredicatesResponse
+scheduleCompletion Env{..} repo onAxiomComplete
+  doCompletion isInProgress storeComputation = do
+    mask_ $ do
+    -- speculatively spawn a thread to do the completion, we'll cancel
+    -- this if we don't need it. This is so that we can atomically
+    -- start the job and update the Env state together.
+    tmvar <- newEmptyTMVarIO
+    async <- Warden.spawn envWarden $
+      atomically (takeTMVar tmvar) >> doCompletion
+    join $ immediately $ do
+      meta <- now $ Catalog.readMeta envCatalog repo
+      if
+        | SkipIfComplete <- onAxiomComplete, metaAxiomComplete meta -> do
+          later $ cancel async -- already done
+          return (return CompletePredicatesResponse{})
+        | FailIfNotComplete <- onAxiomComplete, not $ metaAxiomComplete meta ->
+          now $ throwSTM $ Thrift.Exception "DB is not complete."
+        | Broken b <- metaCompleteness meta -> do
+          later $ cancel async
+          now $ throwSTM $ Exception $ databaseBroken_reason b
+        | envReadOnly -> do
+          later $ cancel async
+          now $ throwSTM $ Exception "DB is read-only"
+        | otherwise -> do
+          inProgress <- isInProgress
+          case inProgress of
+            Just existingAsync -> do  -- in progress
+              later $ cancel async
+              return $ waitFor existingAsync CompletePredicatesResponse{}
+            Nothing -> now $ do  -- start async completion
+              void $ tryPutTMVar tmvar ()
+              storeComputation async
+              return $ waitFor async CompletePredicatesResponse{}
+
+-- If a synchronous exception is thrown during completion, this is
+-- not recoverable, so mark the DB as broken. The exception is also
+-- propagated to the caller.
+setBroken :: Repo -> Catalog.Catalog -> Text.Text -> SomeException -> IO ()
+setBroken repo catalog context e = void $ atomically $
+  Catalog.modifyMeta catalog repo $ \meta ->
+    return meta {
+      metaCompleteness = Broken
+        (DatabaseBroken context (Text.pack (show e)))
+      }
+
+waitFor :: Async () -> b -> IO b
+waitFor async result = do
+  r <- timeout 1000000 $ wait async
+  case r of
+    Nothing -> throwIO $ Retry 1
+    Just _ -> return result
diff --git a/glean/db/Glean/Database/Config.hs b/glean/db/Glean/Database/Config.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Config.hs
@@ -0,0 +1,545 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo, CPP #-}
+module Glean.Database.Config (
+  -- * DataStore
+  DataStore(..),
+  fileDataStore,
+  tmpDataStore,
+  memoryDataStore,
+
+  -- * Config, and options parser
+  options,
+  Config(..),
+  DebugFlags(..),
+
+  -- * Finding and parsing the schema
+  ServerConfig.SchemaLocation(..),
+  showSchemaLocation,
+  schemaLocation,
+  schemaLocationOption,
+  processSchema,
+  processSchemaCached,
+  processOneSchema,
+  SchemaIndex(..),
+  schemaForSchemaId,
+  ProcessedSchema(..),
+  catSchemaFiles,
+  schemaLocationToSource,
+  parseSchemaDir,
+  parseSchemaIndex,
+  loadSchemaIndex,
+
+  -- * Testing only
+
+  -- if you're using these somewhere other than a test,
+  -- you should probably be using something from the API above instead.
+  processSchemaForTesting,
+  schemaLocationFiles,
+  schemaSourceDir,
+) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.State as State
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as B
+import qualified Data.ByteString.UTF8 as UTF8
+import Data.Default
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Options.Applicative
+import System.FilePath
+import System.IO.Temp (withSystemTempDirectory)
+
+import Control.Trace (Tracer)
+import Thrift.Protocol.JSON
+import Thrift.Util
+import Util.IO (listDirectoryRecursive)
+import Util.Log (logInfo)
+
+import Glean.Angle.Types
+import qualified Glean.Database.Backup.Backend as Backup -- from glean/util
+import qualified Glean.Database.Backup.Mock as Backup.Mock
+import qualified Glean.Database.BatchLocation as BatchLocation
+import Glean.Database.Catalog (Catalog)
+import qualified Glean.Database.Catalog.Local.Files as Catalog
+import qualified Glean.Database.Catalog.Local.Memory as Catalog
+import qualified Glean.Database.Catalog.Store as Catalog
+import Glean.Database.Schema.ComputeIds
+import Glean.Database.Storage
+import qualified Glean.Database.Storage.Memory as Memory
+import qualified Glean.Database.Storage.RocksDB as RocksDB
+import Glean.Database.Trace
+import qualified Glean.Internal.Types as Internal
+import Glean.DefaultConfigs
+import Glean.Logger.Database
+import Glean.Logger.Server
+import Glean.Schema.Resolve
+import Glean.Schema.Types
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types
+import Glean.Util.ConfigProvider as Config
+import Glean.Util.Observed (Observed)
+import Glean.Util.ShardManager
+import Glean.Util.Some
+import Glean.Util.Trace (Listener)
+import Glean.Util.ThriftSource (ThriftSource)
+import qualified Glean.Util.ThriftSource as ThriftSource
+
+#ifdef OSS
+import Paths_glean
+#endif
+
+data DataStore = DataStore
+  { withDataStore
+      :: forall a. ServerConfig.Config
+      -> (forall c s. (Catalog.Store c, Storage s) => c -> s -> IO a)
+      -> IO a
+  , dataStoreTag :: String
+  }
+
+fileDataStore :: FilePath -> DataStore
+fileDataStore path = DataStore
+  { withDataStore = \scfg f -> do
+      rocksdb <- RocksDB.newStorage path scfg
+      f (Catalog.fileCatalog path) rocksdb
+  , dataStoreTag = "rocksdb:" <> path
+  }
+
+tmpDataStore :: DataStore
+tmpDataStore = DataStore
+  { withDataStore = \scfg f -> withSystemTempDirectory "glean" $ \tmp -> do
+      logInfo $ "Storing temporary DBs in " <> tmp
+      rocksdb <- RocksDB.newStorage tmp scfg
+      f (Catalog.fileCatalog tmp) rocksdb
+  , dataStoreTag = "rocksdb:{TMP}"
+  }
+
+memoryDataStore :: DataStore
+memoryDataStore = DataStore
+  { withDataStore = \_ f -> do
+      cat <- Catalog.memoryCatalog
+      mem <- Memory.newStorage
+      f cat mem
+  , dataStoreTag = "memory"
+  }
+
+data Config = Config
+  { cfgDataStore :: DataStore
+  , cfgSchemaLocation :: Maybe ServerConfig.SchemaLocation
+  , cfgSchemaHook :: ServerConfig.SchemaLocation -> (ThriftSource SchemaIndex, Bool)
+      -- ^ Allows the client to provide the ThriftSource for the schema. This is
+      -- used by the shell to update the schema in response to a user command.
+      -- The Bool is True if the schema for open DBs should be updated
+      -- whenever the global schema changes.
+  , cfgSchemaId :: Maybe SchemaId
+      -- ^ If set, this is the version of the schema that is used to
+      -- interpret a query.
+  , cfgServerConfig :: ThriftSource ServerConfig.Config
+  , cfgReadOnly :: Bool
+  , cfgMockWrites :: Bool
+  , cfgListener :: Listener
+      -- ^ A 'Listener' which might get notified about various events related
+      -- to databases. This is for testing support only.
+  , cfgShardManager
+    :: forall a
+     . Catalog
+     -> Observed ServerConfig.Config
+     -> (SomeShardManager -> IO a)
+     -> IO a
+  , cfgServerLogger :: Some GleanServerLogger
+    -- ^ Logger for server requests and other events
+  , cfgDatabaseLogger :: Some GleanDatabaseLogger
+    -- ^ Logger for recording stats of databases produced
+  , cfgBackupBackends :: HashMap Text (Some Backup.Backend)
+    -- ^ Backup backends
+  , cfgBatchLocationParser :: Some BatchLocation.Parser
+    -- ^ Batch's location parser
+  , cfgEnableRecursion :: Bool
+    -- ^ Enable experimental support for recursion
+  , cfgFilterAvailableDBs :: [Repo] -> IO [Repo]
+    -- ^ Filter out DBs not currently available on some other server
+  , cfgTracer :: Tracer GleanTrace
+  , cfgDebug :: DebugFlags
+  }
+
+data DebugFlags = DebugFlags
+  { tcDebug :: !Bool
+  , queryDebug :: !Bool
+  }
+
+instance Default DebugFlags where
+  def = DebugFlags { tcDebug = False, queryDebug = False }
+
+instance Semigroup DebugFlags where
+  a <> b = DebugFlags
+    { tcDebug = tcDebug a || tcDebug b
+    , queryDebug = queryDebug a || queryDebug b
+    }
+
+instance Monoid DebugFlags where
+  mempty = def
+
+instance Show Config where
+  show c = unwords [ "Config {"
+    , "cfgDataStore: " <> dataStoreTag (cfgDataStore c)
+    , "cfgServerConfig: " <> show (cfgServerConfig c)
+    , "}" ]
+
+instance Default Config where
+  def = Config
+    { cfgDataStore = fileDataStore "."
+    , cfgSchemaLocation = Nothing
+    , cfgSchemaHook = \l -> (schemaLocationToSource l, True)
+    , cfgSchemaId = Nothing
+    , cfgServerConfig = def
+    , cfgReadOnly = False
+    , cfgMockWrites = False
+    , cfgListener = mempty
+    , cfgShardManager = \_ _ k -> k $ SomeShardManager noSharding
+    , cfgServerLogger = Some NullGleanServerLogger
+    , cfgDatabaseLogger = Some NullGleanDatabaseLogger
+    , cfgBackupBackends = HashMap.fromList [("mock", Backup.Mock.mock)]
+    , cfgBatchLocationParser = Some BatchLocation.DefaultParser
+    , cfgEnableRecursion = False
+    , cfgFilterAvailableDBs = const $ return []
+    , cfgTracer = mempty
+    , cfgDebug = def
+    }
+
+data SchemaIndex = SchemaIndex
+  { schemaIndexCurrent :: ProcessedSchema
+  , schemaIndexOlder :: [ProcessedSchema]
+  }
+
+schemaForSchemaId :: SchemaIndex -> SchemaId -> Maybe ProcessedSchema
+schemaForSchemaId SchemaIndex{..} id = find (containsId id) instances
+  where
+    instances = schemaIndexCurrent : schemaIndexOlder
+    containsId id = (== id) . hashedSchemaId . procSchemaHashed
+
+-- | The schema that we've read from the filesystem or the configs. We
+-- need this in three forms:
+--
+-- * SourceSchemas: the parsed source, which we'll store back in DBs
+--   that we create
+--
+-- * ResolvedSchemas: after name resolution, which is needed to
+--   support "evolves". TODO: just keep the bits we need from this
+--
+-- * HashedSchema: after hashing all the names (ComputeIds)
+--
+data ProcessedSchema = ProcessedSchema
+  { procSchemaSource :: SourceSchemas
+  , procSchemaResolved :: ResolvedSchemas
+  , procSchemaHashed :: HashedSchema
+  }
+
+processOneSchema
+  :: Maybe (SchemaId, Version)
+  -> ByteString
+  -> Either String SchemaIndex
+processOneSchema versions str =
+  case processSchema versions str of
+    Left str -> Left str
+    Right schema -> Right (SchemaIndex schema [])
+
+processSchema
+  :: Maybe (SchemaId, Version)
+  -> ByteString
+  -> Either String ProcessedSchema
+processSchema = processSchemaForTesting HashMap.toList
+
+-- | Testing version of 'processSchema' that accepts a custom @HashMap.toList@
+--   function to weed out ordering assumptions
+processSchemaForTesting
+  :: (forall k v . HashMap k v -> [(k,v)])
+  -> Maybe (SchemaId, Version)
+  -> ByteString
+  -> Either String ProcessedSchema
+processSchemaForTesting toList versions str =
+  case parseAndResolveSchema str of
+    Left str -> Left str
+    Right (ss, r) -> Right $
+      ProcessedSchema ss r (computeIds toList (schemasResolved r) versions)
+
+processSchemaCached
+  :: Maybe (SchemaId, Version)
+  -> SchemaParserCache
+  -> ByteString
+  -> Either String (SchemaParserCache, ProcessedSchema)
+processSchemaCached versions cache str =
+  case parseAndResolveSchemaCached cache str of
+    Left str -> Left str
+    Right (ss, r, newcache) ->
+      Right (
+        newcache,
+        ProcessedSchema ss r
+          (computeIds HashMap.toList (schemasResolved r) versions)
+      )
+
+-- | Read the schema files from the source tree
+schemaLocationFiles :: ServerConfig.SchemaLocation
+schemaLocationFiles = ServerConfig.SchemaLocation_dir (Text.pack schemaSourceDir)
+
+-- | Read the schema definition from the ConfigProvider
+schemaSourceConfig :: Text -> ThriftSource SchemaIndex
+schemaSourceConfig loc =
+  ThriftSource.configWithDeserializer loc
+     (processOneSchema Nothing)
+
+-- | Read the schema from a single file
+schemaSourceFile :: FilePath -> ThriftSource SchemaIndex
+schemaSourceFile f = ThriftSource.fileWithDeserializer f
+  (processOneSchema Nothing)
+
+-- | Read a schema index from a file
+schemaSourceIndexFile :: FilePath -> ThriftSource SchemaIndex
+schemaSourceIndexFile = ThriftSource.once . parseSchemaIndex
+
+-- | Read schema files from the given directory
+schemaSourceFilesFromDir :: FilePath -> ThriftSource SchemaIndex
+schemaSourceFilesFromDir = ThriftSource.once . parseSchemaDir
+
+-- | Read a schema index from the ConfigProvider. This will watch for
+-- changes to the index but not any of the instance files, since those
+-- are expected to be immutable.
+schemaSourceIndexConfig :: Text -> ThriftSource SchemaIndex
+schemaSourceIndexConfig key = ThriftSource.genericConfig
+  key
+  deserializeJSON
+  loadInstances
+  Nothing
+  where
+    loadInstances
+      :: ConfigProvider cfg
+      => cfg
+      -> Internal.SchemaIndex
+      -> IO SchemaIndex
+    loadInstances cfg Internal.SchemaIndex{..} = do
+      let proc Internal.SchemaInstance{..} = do
+            let
+              instanceKey = Text.pack $
+                takeDirectory (Text.unpack key) </>
+                Text.unpack schemaInstance_file
+            maybeVersion <- lift $ checkVersions schemaInstance_versions
+            str <- lift $ Config.get cfg instanceKey Right
+            cache <- State.get
+            case processSchemaCached maybeVersion cache str of
+              Left err -> lift $ throwIO $ Exception $
+                "error in schema: " <> Text.pack err <>
+                "\nFile: " <> instanceKey
+              Right (newcache, result) -> do
+                State.put newcache
+                return result
+      flip evalStateT HashMap.empty $ do
+        current <- proc schemaIndex_current
+        older <- mapM proc schemaIndex_older
+        return (SchemaIndex current (reverse older))
+
+checkVersions :: Map Text Version -> IO (Maybe (SchemaId, Version))
+checkVersions versions =
+  case Map.toList versions of
+    [] -> return Nothing
+    [(txtId, ver)] -> return (Just (SchemaId txtId, ver))
+    _multiple -> throwIO $ Exception "versions must contain a single entry"
+
+-- | Read schema files from a directory
+parseSchemaDir :: FilePath -> IO SchemaIndex
+parseSchemaDir dir = do
+  str <- catSchemaFiles =<< listDirectoryRecursive dir
+  case processOneSchema Nothing str of
+    Left err -> throwIO $ ErrorCall err
+    Right schema -> return schema
+
+parseSchemaIndex :: FilePath -> IO SchemaIndex
+parseSchemaIndex file = do
+  Internal.SchemaIndex{..} <- loadJSON file
+  let proc Internal.SchemaInstance{..} = do
+        let dir = takeDirectory file
+        str <- B.readFile (dir </> Text.unpack schemaInstance_file)
+        maybeVersion <- checkVersions schemaInstance_versions
+        either (throwIO . ErrorCall) return $ processSchema maybeVersion str
+  current <- proc schemaIndex_current
+  older <- mapM proc schemaIndex_older
+  return (SchemaIndex current older)
+
+-- | Concatenate the contents of all the .angle files, prepending the
+-- contents of VERSION if that file exists, and adding "#FILE" annotations
+-- so that errors can still be attributed to the right location.
+catSchemaFiles :: [FilePath] -> IO ByteString
+catSchemaFiles files = do
+  let sorted = sort files
+  version <- mapM B.readFile (filter ((=="VERSION") . takeFileName) sorted)
+  strs <- forM (filter ((== ".angle") . takeExtension) sorted) $ \file -> do
+    str <- B.readFile file
+    return ("#FILE " <> UTF8.fromString file <> "\n" <> str)
+  return $ B.concat (version ++ ("# @" <> "generated\n" : strs))
+
+-- | path to the dir of schema files in the source tree
+schemaSourceDir :: FilePath
+schemaSourceDir = "glean/schema/source"
+
+schemaLocationToSource
+  :: ServerConfig.SchemaLocation
+  -> ThriftSource SchemaIndex
+schemaLocationToSource = \case
+  ServerConfig.SchemaLocation_dir d -> schemaSourceFilesFromDir (Text.unpack d)
+  ServerConfig.SchemaLocation_file f -> schemaSourceFile (Text.unpack f)
+  ServerConfig.SchemaLocation_index i -> schemaSourceIndexFile (Text.unpack i)
+  ServerConfig.SchemaLocation_config c -> schemaSourceConfig c
+  ServerConfig.SchemaLocation_indexconfig c -> schemaSourceIndexConfig c
+  ServerConfig.SchemaLocation_EMPTY{} -> error "schemaLocationToSource"
+
+-- | The logic for obtaining the SchemaLocation for the schema, given
+-- the Config and ServerConfig. The location is given by, in order of preference:
+--   - the Config (--schema flag)
+--   - the ServerConfig (schema_location field)
+--   - the default schema location: Glean.DefaultConfigs.defaultSchemaLocation
+--
+-- Also here we replace "$datadir" with the datadir supplied by Cabal, so that
+-- we can install the schema in $datadir when Glean is installed.
+schemaLocation :: Config -> ServerConfig.Config -> IO ServerConfig.SchemaLocation
+schemaLocation cfg server_cfg = do
+#ifdef OSS
+  datadir <- Text.replace "$datadir" . Text.pack <$> getDataDir
+#else
+  datadir <- return id
+#endif
+  let loc = fromMaybe defaultSchemaLocation $
+        cfgSchemaLocation cfg <|>
+        ServerConfig.config_schema_location server_cfg
+  case loc of
+    ServerConfig.SchemaLocation_dir d ->
+      return (ServerConfig.SchemaLocation_dir (datadir d))
+    ServerConfig.SchemaLocation_file f ->
+      return (ServerConfig.SchemaLocation_file (datadir f))
+    ServerConfig.SchemaLocation_index i ->
+      return (ServerConfig.SchemaLocation_index (datadir i))
+    other ->
+      return other
+
+-- | Find and load the SchemaIndex, taking into account command line
+-- flags, the ServerConfig, and the cfgSchemaHook. This is a
+-- convenience function used by the CLI.
+loadSchemaIndex :: ConfigProvider c => Config -> c -> IO SchemaIndex
+loadSchemaIndex cfg cfgAPI = do
+  serverConfig <- ThriftSource.load cfgAPI (cfgServerConfig cfg)
+  loc <- schemaLocation cfg serverConfig
+  let (schemaSource, _) = cfgSchemaHook cfg loc
+  ThriftSource.load cfgAPI schemaSource
+
+showSchemaLocation :: ServerConfig.SchemaLocation -> String
+showSchemaLocation = \case
+  ServerConfig.SchemaLocation_dir d -> "dir:" <> Text.unpack d
+  ServerConfig.SchemaLocation_file d -> "file:" <> Text.unpack d
+  ServerConfig.SchemaLocation_index d -> "index:" <> Text.unpack d
+  ServerConfig.SchemaLocation_config d -> "config:" <> Text.unpack d
+  ServerConfig.SchemaLocation_indexconfig d -> "indexconfig:" <> Text.unpack d
+  _ -> error "showSchemaLocation"
+
+-- | Allow short \"indexconfig\" and \"dir\"  to choose the defaults from
+-- 'schemaSourceConfig' and 'schemaSourceDir' as well as full explicit
+-- \"config:PATH\", \"dir:PATH\", and \"file:PATH\" sources.
+schemaLocationParser
+  :: String
+  -> Either String ServerConfig.SchemaLocation
+schemaLocationParser "indexconfig" =
+  Right (ServerConfig.SchemaLocation_index schemaConfigPath)
+schemaLocationParser "dir" =
+  Right (ServerConfig.SchemaLocation_dir (Text.pack schemaSourceDir))
+schemaLocationParser s = case break (==':') s of
+  ("dir", ':':path) ->
+    Right (ServerConfig.SchemaLocation_dir (Text.pack path))
+  ("index", ':':path) ->
+    Right (ServerConfig.SchemaLocation_index (Text.pack path))
+  ("indexconfig", ':':path) ->
+    Right (ServerConfig.SchemaLocation_indexconfig (Text.pack path))
+  -- default to interpreting the argument as a directory:
+  ("file", ':':path) ->
+    Right (ServerConfig.SchemaLocation_file (Text.pack path))
+  ("config", ':':path) ->
+    Right (ServerConfig.SchemaLocation_config (Text.pack path))
+  (_, "") ->
+    Right (ServerConfig.SchemaLocation_dir (Text.pack s))
+  _otherwise -> -- handles config:PATH and file:PATH
+    Left "invalid schema location"
+
+schemaLocationOption
+  :: Parser ServerConfig.SchemaLocation
+schemaLocationOption = option (eitherReader schemaLocationParser)
+  (  long "schema"
+  <> metavar "(dir | config | indexconfig | file:FILE | dir:DIR | config:PATH | index:FILE | indexconfig:PATH | DIR)"
+  )
+
+options :: Parser Config
+options = do
+  let
+    dbRoot = fileDataStore <$> strOption (
+      long "db-root" <>
+      metavar "DIR" <>
+      help "Directory containing databases")
+    dbTmp = tmpDataStore <$ flag' () (
+      long "db-tmp" <>
+      help "Store databases in a temporary directory (default)")
+    dbMem = memoryDataStore <$ flag' () (
+      long "db-memory" <>
+      help "Store databases in memory")
+  cfgDataStore <- dbRoot <|> dbTmp <|> dbMem <|> pure tmpDataStore
+  cfgSchemaLocation <- optional schemaLocationOption
+  _ignored_for_backwards_compat <- switch (long "db-schema-override")
+
+  cfgServerConfig <-
+    serverConfigThriftSource <|>
+    serverConfigTier <|>
+    pure def  -- default settings if no option given
+  cfgReadOnly <- switch (long "db-read-only")
+  cfgMockWrites <- switch (long "db-mock-writes")
+  cfgEnableRecursion <- switch
+    ( long "experimental-recursion"
+    <> help "Experimental support for recursive predicates. For testing only"
+    <> internal
+    )
+  cfgDebug <- debugParser
+  return Config
+    { cfgListener = mempty
+    , cfgSchemaHook = cfgSchemaHook def
+    , cfgShardManager = cfgShardManager def
+    , cfgServerLogger = cfgServerLogger def
+    , cfgDatabaseLogger = cfgDatabaseLogger def
+    , cfgBackupBackends = cfgBackupBackends def
+    , cfgBatchLocationParser = cfgBatchLocationParser def
+    , cfgFilterAvailableDBs = const $ return []
+    , cfgTracer = mempty
+    , cfgSchemaId = Nothing
+    , .. }
+  where
+    debugParser :: Parser DebugFlags
+    debugParser = do
+      tcDebug <- switch (long "debug-tc")
+      queryDebug <- switch (long "debug-query")
+      return DebugFlags{..}
+
+    serverConfigThriftSource = option (eitherReader ThriftSource.parse)
+      (  long "server-config"
+      <> metavar "(file:PATH | config:PATH)" )
+
+    serverConfigTier =
+      ThriftSource.config . Text.pack . (serverConfigPath </>) <$>
+      strOption
+        (  long "tier"
+        <> metavar "TIER"
+        <> help "specifies the server configuration to load")
diff --git a/glean/db/Glean/Database/Create.hs b/glean/db/Glean/Database/Create.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Create.hs
@@ -0,0 +1,297 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Database.Create (
+  kickOffDatabase,
+  updateProperties,
+) where
+
+import Control.Applicative
+import qualified Control.Concurrent.Async as Async
+import Control.Exception hiding(handle)
+import Control.Monad.Catch (handle)
+import Control.Monad.Extra
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Map as Map
+import Data.Default
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.UUID as Guid ( toText )
+import qualified Data.UUID.V4 as Guid ( nextRandom )
+import Text.Printf
+
+#ifdef GLEAN_FACEBOOK
+import Facebook.Process
+#endif
+import Util.Log
+import Util.STM
+
+import Glean.Backend.Types (StackedDbOpts(..))
+import Glean.BuildInfo
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Config
+import Glean.Database.Exception
+import Glean.Database.Meta
+import Glean.Database.Repo
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Open
+import Glean.Database.PredicateStats
+import Glean.Database.Types
+import Glean.Database.Schema (
+  toStoredSchema, compareSchemaPredicates, renderSchemaSource, toStoredVersions)
+import Glean.Database.Schema.ComputeIds
+import Glean.Database.Schema.Types
+import Glean.Internal.Types hiding (SchemaIndex)
+import Glean.RTS.Foreign.Lookup (firstFreeId)
+import Glean.RTS.Types (lowestFid, fromPid)
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types hiding (Database)
+import qualified Glean.Types as Thrift
+import Glean.Util.Observed as Observed
+
+-- | Kick off a specifc database, scheduling its tasks as necessary.
+kickOffDatabase :: Env -> Thrift.KickOff -> IO Thrift.KickOffResponse
+kickOffDatabase env@Env{..} kickOff@Thrift.KickOff{..}
+  | envReadOnly = dbError kickOff_repo "can't create database in read only mode"
+  | Just err <- validateDbName kickOff_repo = dbError kickOff_repo $
+    "Can't create database: " <> err
+  | otherwise = do
+      let
+        schemaToUse =
+          case HashMap.lookup "glean.schema_id" kickOff_properties of
+            Just id -> Storage.UseSpecificSchema (SchemaId id)
+            Nothing -> Storage.UseDefaultSchema
+
+      (mode, kickOff_dependencies') <- case kickOff_dependencies of
+        Nothing -> return
+          (Storage.Create lowestFid Nothing schemaToUse
+          , kickOff_dependencies)
+        Just (Dependencies_stacked stacked) -> do
+            let Thrift.Stacked{..} = stacked
+                repo = Thrift.Repo stacked_name stacked_hash
+            (mode, guid) <- stackedCreate env repo kickOff schemaToUse
+            return
+              ( mode,
+                Just (Dependencies_stacked
+                  stacked{stacked_guid=stacked_guid <|> guid}))
+        Just (Dependencies_pruned update) -> do
+          (mode, guid) <- stackedCreate env (pruned_base update)
+            kickOff schemaToUse
+          return
+            ( mode,
+              Just (Dependencies_pruned
+                update{pruned_guid=pruned_guid update <|> guid}))
+
+      creationTime <- envGetCurrentTime
+      serverProps <- serverProperties
+      fbServerProps <- facebookServerProperties
+      guidProps <- guidProperties
+      let
+        allProps = mconcat
+          [ kickOff_properties
+          , serverProps
+          , fbServerProps
+          , guidProps
+          ]
+        time = DBTimestamp
+          { timestampCreated = creationTime
+          , timestampRepoHash =
+              posixEpochTimeToUTCTime <$> kickOff_repo_hash_time
+          }
+      version <-
+        fromMaybe Storage.currentVersion . ServerConfig.config_db_create_version
+        <$> Observed.get envServerConfig
+      when (not $ Storage.canOpenVersion Storage.ReadWrite version) $
+        dbError kickOff_repo
+          "can't create databases (unsupported binary version)"
+      db <- atomically $ newDB kickOff_repo
+      handle
+        (\Catalog.EntryAlreadyExists{} ->
+            return $ Thrift.KickOffResponse True) $
+        mask $ \unmask ->
+        -- FIXME: There is a tiny race here where we might fail in a weird way
+        -- if kick off a DB that is being deleted after it got removed from
+        -- the Catalog but before it got removed from the storage. The entire
+        -- concept of deleting DBs will change with the new metadata handling so
+        -- it's not worth fixing at this point, especially since we aren't
+        -- supposed to be kicking off DBs we've previously deleted.
+        bracket_
+          (Catalog.create
+            envCatalog
+            kickOff_repo
+            (newMeta version time (Incomplete def) allProps
+              (lightDeps kickOff_dependencies')) $ do
+                modifyTVar' envActive $ HashMap.insert kickOff_repo db
+                writeTVar (dbState db) Opening
+                acquireDB db)
+          (atomically $ releaseDB envCatalog envActive db) $
+          do
+            -- Open the new db in Create mode which will create the
+            -- physical storage. This might fail - in that case, we
+            -- mark the db as failed. NB. pass the full dependencies
+            -- here, not lightDeps.
+            opener <- asyncOpenDB env envStorage db version mode
+                kickOff_dependencies'
+              (do
+                logInfo $ inRepo kickOff_repo "created")
+              (\exc -> atomically $ void $
+                  -- If opening the db fails for any reason, mark the db as
+                  -- failed.
+                  Catalog.modifyMeta envCatalog kickOff_repo $ \meta ->
+                    return meta
+                      { metaCompleteness = Broken DatabaseBroken
+                        { databaseBroken_task = ""
+                        , databaseBroken_reason =
+                            "couldn't create: " <> Text.pack (show exc)
+                        }
+                      })
+            OpenDB{..} <- unmask $ Async.wait opener
+            addSchemaIdProperty envCatalog kickOff_repo (schemaId odbSchema)
+            return $ Thrift.KickOffResponse False
+  where
+    addSchemaIdProperty :: Catalog.Catalog -> Repo -> SchemaId -> IO ()
+    addSchemaIdProperty catalog repo hash =
+      void $ atomically $ Catalog.modifyMeta catalog repo $ \meta ->
+        return meta { metaProperties =
+          HashMap.insertWith
+            (\_ old -> old)  -- if one was provided already, keep it
+            "glean.schema_id"
+            (unSchemaId hash)
+            (metaProperties meta)
+          }
+
+    guidProperties = do
+      guid <- Guid.toText <$> Guid.nextRandom
+      return $ HashMap.fromList [("glean.guid", guid)]
+
+    -- The dependencies that we keep in the Meta have the units
+    -- removed, because the units can be large and the Meta has a size
+    -- limit. The units are stored separately in the DB; see
+    -- Glean.Database.Data.storeUnits.
+    lightDeps kickOff_deps = case kickOff_deps of
+      Just (Thrift.Dependencies_pruned pruned) ->
+        Just (Thrift.Dependencies_pruned pruned { pruned_units = [] })
+      _other -> _other
+
+-- | Returns Just an error, or Nothing if valid
+validateDbName :: Repo -> Maybe String
+validateDbName Repo {repo_hash}
+  | Just c <- Text.find (`elem` ("\\/. " :: String)) repo_hash
+  = Just $ printf "DB instance contains illegal character '%c'" c
+  | otherwise = Nothing
+
+stackedCreate
+  :: Env
+  -> Repo
+  -> KickOff
+  -> Storage.CreateSchema
+  -> IO (Storage.Mode, Maybe Text {- GUID -})
+stackedCreate env@Env{..} base KickOff{..} schemaToUse =
+  readDatabase env base $ \OpenDB{..} lookup -> do
+    guid <- atomically $ do
+      meta <- Catalog.readMeta envCatalog base
+      case metaCompleteness meta of
+        Complete{} -> return $
+          HashMap.lookup "glean.guid" $ metaProperties meta
+        c -> throwSTM $ InvalidDependency kickOff_repo base $
+          "database is " <> showCompleteness c
+    start <- firstFreeId lookup
+
+    index <- Observed.get envSchemaSource
+    let storedSchema = toStoredSchema odbSchema
+
+    ownership <- readTVarIO odbOwnership
+    if
+      | Storage.UseDefaultSchema <- schemaToUse,
+        not kickOff_update_schema_for_stacked -> do
+        return (
+          Storage.Create start ownership (Storage.UseThisSchema storedSchema),
+          guid
+          )
+
+      | otherwise -> do
+        stats <- predicateStats env base IncludeBase
+
+        -- If update_schema_for_stacked is enabled or the client
+        -- specified glean.schema_id, then we need to check that the
+        -- specified schema agrees with the stored schema in the base
+        -- DB about the definitions of predicates and types. We can do
+        -- a fast check using the hashes, and throw an exception if
+        -- there are any differences.
+        let
+          DbSchema{..} = odbSchema
+
+          proc = case schemaToUse of
+            Storage.UseSpecificSchema id
+              | Just proc <- schemaForSchemaId index id -> proc
+            _otherwise -> schemaIndexCurrent index
+
+          hasFacts pred = case HashMap.lookup pred predicatesById of
+            Just PredicateDetails{..}
+              | Just stat <- Map.lookup (fromPid predicatePid) stats ->
+                predicateStats_count stat > 0
+            _otherwise -> False
+
+          HashedSchema{..} = procSchemaHashed proc
+          errors = compareSchemaPredicates
+            (filter hasFacts (HashMap.keys predicatesById))
+            (HashMap.keys hashedPreds)
+
+        chooseSchema <-
+          if null errors then
+            return $ Storage.UseThisSchema
+              (StoredSchema
+                (renderSchemaSource (procSchemaSource proc))
+                (storedSchema_predicateIds storedSchema)
+                -- Note: we *must* use the Pids from the base DB
+                (toStoredVersions hashedSchemaAllVersion hashedSchemaId))
+          else
+            throwIO $ Thrift.Exception $
+              "update_schema_for_stacked specified, but schemas are " <>
+              "incompatible: " <> Text.intercalate ", " errors
+
+        return (Storage.Create start ownership chooseSchema, guid)
+
+serverProperties :: IO DatabaseProperties
+serverProperties = return (HashMap.fromList rev)
+  where
+  rev
+    | Text.null buildRevision = []
+    | otherwise = [ ("glean.server.build_revision", buildRevision) ]
+
+facebookServerProperties :: IO DatabaseProperties
+facebookServerProperties = do
+#if GLEAN_FACEBOOK
+  twJob <- getTupperwareJob
+  return $ HashMap.fromList
+    (case twJob of
+      Nothing -> []
+      Just job -> [ ("glean.server.tw_job", job) ])
+#else
+  return HashMap.empty
+#endif
+
+updateProperties
+  :: Env
+  -> Repo
+  -> DatabaseProperties
+  -> [Text]
+  -> IO ()
+updateProperties env repo set unset = do
+  when (envReadOnly env) $ throwIO $ Thrift.Exception
+    "updateProperties: server in read-only mode"
+  atomically $ void $ Catalog.modifyMeta (envCatalog env) repo $ \meta ->
+    case metaCompleteness meta of
+      Incomplete{} -> return meta
+        { metaProperties = HashMap.union set
+            $ foldr HashMap.delete (metaProperties meta) unset
+        }
+      c -> throwSTM $ Thrift.Exception $
+        "updateProperties: database is " <> showCompleteness c
diff --git a/glean/db/Glean/Database/Data.hs b/glean/db/Glean/Database/Data.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Data.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Data
+  ( storeSchema
+  , retrieveSchema
+  , storeUnits
+  , retrieveUnits
+  , storeSlices
+  , retrieveSlices
+  ) where
+
+import Data.Binary
+import Data.ByteString (ByteString)
+import Data.ByteString.Lazy (toStrict, fromStrict)
+
+import Thrift.Protocol.Compact
+
+import Glean.Database.Exception
+import Glean.Database.Storage (Storage, Database)
+import qualified Glean.Database.Storage as Storage
+import Glean.RTS.Foreign.Ownership
+import Glean.Types (Repo)
+import Glean.Internal.Types (StoredSchema)
+
+sCHEMA_KEY :: ByteString
+sCHEMA_KEY = "schema"
+
+-- | Stores the units that are excluded (or included) from the base DB
+uNITS_KEY :: ByteString
+uNITS_KEY = "units"
+
+-- | Stores the slices for the base DBs in a stack
+sLICES_KEY :: ByteString
+sLICES_KEY = "slices"
+
+storeSchema :: Storage s => Database s -> StoredSchema -> IO ()
+storeSchema db = Storage.store db sCHEMA_KEY . serializeCompact
+
+retrieveSchema :: Storage s => Repo -> Database s -> IO (Maybe StoredSchema)
+retrieveSchema repo db = do
+  value <- Storage.retrieve db sCHEMA_KEY
+  case deserializeCompact <$> value of
+    Just (Right info) -> return $ Just info
+    Just (Left msg) -> dbError repo $ "invalid schema: " ++ msg
+    Nothing -> return Nothing
+
+storeUnits :: Storage s => Database s -> [ByteString] -> IO ()
+storeUnits db = Storage.store db uNITS_KEY . toStrict . encode
+
+retrieveUnits :: Storage s => Repo -> Database s -> IO (Maybe [ByteString])
+retrieveUnits repo db = do
+  value <- Storage.retrieve db uNITS_KEY
+  case decodeOrFail . fromStrict <$> value of
+    Just (Right (_, _, units)) -> return $ Just units
+    Just (Left (_, _, msg)) -> dbError repo $ "invalid units: " ++ msg
+    Nothing -> return Nothing
+
+-- Slices are each serialized using the RTS Slice::serialize(), and then
+-- the list of serialized slices :: [ByteString] is serialized with
+-- the Haskell Binary encoder.
+storeSlices :: Storage s => Database s -> [Slice] -> IO ()
+storeSlices db slices = do
+  bytestrings <- mapM serializeSlice slices
+  Storage.store db sLICES_KEY $ toStrict $ encode bytestrings
+
+retrieveSlices :: Storage s => Repo -> Database s -> IO (Maybe [Slice])
+retrieveSlices repo db = do
+  value <- Storage.retrieve db sLICES_KEY
+  case decodeOrFail . fromStrict <$> value of
+    Just (Right (_, _, bytestrings)) ->
+      Just <$> mapM deserializeSlice bytestrings
+    Just (Left (_, _, msg)) -> dbError repo $ "invalid slices: " ++ msg
+    Nothing -> return Nothing
diff --git a/glean/db/Glean/Database/Delete.hs b/glean/db/Glean/Database/Delete.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Delete.hs
@@ -0,0 +1,138 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Delete (
+  deleteDatabase,
+  asyncDeleteDatabase,
+  expireDatabase
+) where
+
+import Control.Concurrent.Async (Async)
+import qualified Control.Concurrent.Async as Async
+import Control.Exception hiding(handle)
+import Control.Monad.Extra
+import qualified Data.HashMap.Strict as HashMap
+import Data.Time
+import GHC.Stack (HasCallStack)
+
+import ServiceData.GlobalStats as Stats
+import ServiceData.Types as Stats
+import Util.Control.Exception
+import qualified Util.Control.Exception.CallStack as CallStack
+import Util.Defer
+import Util.Log
+import Util.STM
+import Util.TimeSec
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter
+import Glean.Database.Close
+import Glean.Database.Meta
+import Glean.Database.Repo
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Types
+import Glean.Types hiding (Database)
+import qualified Glean.Util.Warden as Warden
+
+
+-- | Schedule DBs for deletion or expiration.
+--   Throws 'UnknownDatabase' exceptions
+expireDatabase :: HasCallStack => Maybe NominalDiffTime -> Env -> Repo -> IO ()
+expireDatabase delay env@Env{..} repo = do
+  now <- getCurrentTime
+  expired <- immediately $ do
+    exp <- lift $ Catalog.readExpiring envCatalog repo
+    case exp of
+      Just t -> return (now > t)
+      Nothing -> case delay of
+        Just delay | delay > 0 -> do
+          meta <- lift $ Catalog.readMeta envCatalog repo
+          later $ do
+            logInfo $ inRepo repo $ "database is doomed " ++
+              " ("  ++ showNominalDiffTime (dbAge now meta) ++ " old)"
+            logInfo $ inRepo repo $ "expiring in " <> show delay
+          lift $ Catalog.setExpiring envCatalog repo $ delay `addUTCTime` now
+          return False
+        _ -> return True
+  when expired $ void $ asyncDeleteDatabase env repo
+
+-- | Database deletion thread
+removeDatabase
+  :: Storage.Storage s
+  => Env
+  -> Repo
+  -> TMVar (Maybe (DB s))
+  -> IO ()
+removeDatabase env@Env{..} repo todo = uninterruptibleMask_ $
+  -- This runs under uninterruptibleMask_ because there is really nothing
+  -- sensible we can do if we get interrupted.
+  --
+  --   * We need to close the DB even if the program is shutting down.
+  --   * Closing the DB itself should be uninterruptible.
+  --   * Once we start deleting things we shouldn't stop until we've deleted
+  --     them all.
+  --
+  -- So really, the only sensible interruption points is after we've closed the
+  -- DB but before we start deleting which just doesn't seem worth it.
+  do
+    r <- atomically $ readTMVar todo
+    let cleanUp = atomically (modifyTVar' envDeleting $ HashMap.delete repo)
+    forM_ r $ \DB{..} -> flip finally cleanUp $ do
+      logInfo $ inRepo repo "deleting"
+      addStatValueType "glean.db.deleted" 1 Stats.Sum
+      atomically $ do
+        users <- readTVar dbUsers
+        when (users /= 0) retry
+      logExceptions (\s -> inRepo repo $ "while deleting: " ++s) $ do
+        state <- readTVarIO dbState
+        case state of
+          Open odb -> closeOpenDB env odb
+            `finally` atomically (writeTVar dbState Closed)
+          _ -> return ()
+        Storage.delete envStorage repo
+        Catalog.delete envCatalog repo
+        Storage.safeRemoveForcibly envStorage repo
+        atomically $ modifyTVar envDerivations $
+          HashMap.filterWithKey (\(repo',_) _ -> repo' /= repo)
+      logInfo $ inRepo repo "deleted"
+
+-- | Schedule a DB for deletion and return the 'Async' which can be used to
+-- obtain the result.
+asyncDeleteDatabase :: HasCallStack => Env -> Repo -> IO (Async ())
+asyncDeleteDatabase env@Env{..} repo = bracket
+  newEmptyTMVarIO
+  (\todo -> atomically $ tryPutTMVar todo Nothing) $ \todo -> do
+    remover <- Warden.spawnMask envWarden $ \_ -> removeDatabase env repo todo
+    join $ atomically $ do
+      active <- HashMap.lookup repo <$> readTVar envActive
+      let deleteDB db = do
+            modifyTVar' envDeleting $ HashMap.insert repo remover
+            putTMVar todo $ Just db
+            return $ return remover
+      case active of
+        Just db -> do
+          modifyTVar' envActive $ HashMap.delete repo
+          deleteDB db
+        Nothing -> do
+          deleting <- HashMap.lookup repo <$> readTVar envDeleting
+          exists <- Catalog.exists envCatalog [Local] repo
+          case deleting of
+            Nothing
+              | exists -> do
+                db <- DB repo
+                  <$> newTVar Closed
+                  <*> newTVar 0
+                deleteDB db
+            other -> do
+              putTMVar todo Nothing
+              case other of
+                Nothing -> return $ CallStack.throwIO $ UnknownDatabase repo
+                Just remover -> return $ return remover
+
+deleteDatabase :: HasCallStack => Env -> Repo -> IO ()
+deleteDatabase env repo = asyncDeleteDatabase env repo >>= Async.wait
diff --git a/glean/db/Glean/Database/Env.hs b/glean/db/Glean/Database/Env.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Env.hs
@@ -0,0 +1,249 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Database.Env ( withDatabases ) where
+
+#if !MIN_VERSION_base(4,18,0)
+import Control.Applicative (liftA2)
+#endif
+import Control.Concurrent
+import Control.Concurrent.Async (async, waitEither, withAsync)
+import Control.Exception.Safe
+import Control.Monad.Extra
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Data.List.Split
+import Data.Time
+import System.Clock (TimeSpec(..))
+import System.Environment
+import System.Time.Extra (sleep, Seconds, timeout)
+
+import Data.RateLimiterMap
+import ServiceData.GlobalStats
+import Util.EventBase
+import Util.Log
+import Util.STM
+
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import Glean.Database.Backup (backuper)
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Config
+import Glean.Database.Close
+import Glean.Database.Janitor
+import Glean.Database.Open
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Types
+import Glean.Database.Writes
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Util.ConfigProvider
+import Glean.Util.Observed as Observed
+import Glean.Util.Periodic
+import Glean.Util.ShardManager (SomeShardManager)
+import Glean.Util.ThriftSource as ThriftSource
+import Util.Time
+import qualified Glean.Util.Warden as Warden
+import qualified Glean.Write.Stats as Stats
+
+-- | Initialize an Env for working with Glean databases
+withDatabases
+  :: ConfigProvider conf
+  => EventBaseDataplane
+  -> Config
+  -> conf
+  -> (Env -> IO a)
+  -> IO a
+withDatabases evb cfg cfgapi act =
+  ThriftSource.withValue cfgapi (cfgServerConfig cfg) $ \server_config -> do
+  server_cfg <- Observed.get server_config
+  schemaLoc <- schemaLocation cfg server_cfg
+  logInfo $ "Using schema from " <> showSchemaLocation schemaLoc
+  let (schema, updateSchema) = cfgSchemaHook cfg schemaLoc
+  ThriftSource.withValue cfgapi schema $ \schema_source -> do
+  withDataStore (cfgDataStore cfg) server_cfg $ \catalog storage -> do
+    envCatalog <- Catalog.open catalog
+    cfgShardManager cfg envCatalog server_config $ \shardManager ->
+      bracket
+        (initEnv
+          evb
+          storage
+          envCatalog
+          shardManager
+          cfg
+          schema_source
+          updateSchema
+          server_config)
+        closeEnv
+        $ \env -> do
+            spawnThreads env
+            act env
+
+initEnv
+  :: Storage.Storage storage
+  => EventBaseDataplane
+  -> storage
+  -> Catalog.Catalog
+  -> SomeShardManager
+  -> Config
+  -> Observed SchemaIndex
+  -> Bool
+  -> Observed ServerConfig.Config
+  -> IO Env
+initEnv evb envStorage envCatalog shardManager cfg
+  envSchemaSource updateSchema envServerConfig = do
+    ServerConfig.Config{..} <- Observed.get envServerConfig
+
+    envActive <- newTVarIO mempty
+    envDeleting <- newTVarIO mempty
+    envStats <- Stats.new (TimeSpec 10 0)
+    envLookupCacheStats <- LookupCache.newStats
+    envWarden <- Warden.create
+    envDatabaseJanitor <- newTVarIO Nothing
+    envDatabaseJanitorPublishedCounters <- newTVarIO mempty
+    envCachedRestorableDBs <- newTVarIO Nothing
+    envCachedAvailableDBs <- newTVarIO mempty
+
+    envLoggerRateLimit <-
+      newRateLimiterMap (fromIntegral config_logging_rate_limit) 600
+
+    envWrites <- newTVarIO HashMap.empty
+    envDerivations <- newTVarIO HashMap.empty
+    envWriteQueues <- WriteQueues
+      <$> newTQueueIO
+      <*> newTVarIO 0
+
+    envSchemaUpdateSignal <- newEmptyTMVarIO
+
+    envCompleting <- newTVarIO HashMap.empty
+
+    envCompletingDerived <- newTVarIO HashMap.empty
+
+    envDbSchemaCache <- newMVar HashMap.empty
+
+    debug <- getDebugEnv
+
+    return Env
+      { envEventBase = evb
+      , envServerLogger = cfgServerLogger cfg
+      , envDatabaseLogger = cfgDatabaseLogger cfg
+      , envBatchLocationParser = cfgBatchLocationParser cfg
+      , envReadOnly = cfgReadOnly cfg
+      , envMockWrites = cfgMockWrites cfg
+      , envListener = cfgListener cfg
+      , envGetCurrentTime = getCurrentTime
+      , envUpdateSchema = updateSchema
+      , envSchemaId = cfgSchemaId cfg
+      , envShardManager = shardManager
+      , envBackupBackends = cfgBackupBackends cfg
+      , envEnableRecursion =
+          if cfgEnableRecursion cfg
+          then EnableRecursion
+          else DisableRecursion
+      , envFilterAvailableDBs = cfgFilterAvailableDBs cfg
+      , envTracer = cfgTracer cfg
+      , envDebug = cfgDebug cfg <> debug
+      , .. }
+
+getDebugEnv :: IO DebugFlags
+getDebugEnv = do
+  m <- lookupEnv "GLEAN_DEBUG"
+  case m of
+    Just str -> mconcat <$> mapM add (splitOn "," str)
+    Nothing -> return def
+  where
+  add "tc" = return def { tcDebug = True }
+  add "query" = return def { queryDebug = True }
+  add other = do
+    logWarning $ "Unkonwn GLEAN_DEBUG class: " <> other
+    return def
+
+spawnThreads :: Env -> IO ()
+spawnThreads env@Env{..} = do
+  ServerConfig.Config{..} <- Observed.get envServerConfig
+
+  -- on completion, record the time we last ran the janitor. This is
+  -- used by the server to know when to advertise the server as alive.
+  let recordJanitorResult result = do
+        t <- envGetCurrentTime
+        atomically $ writeTVar envDatabaseJanitor $ Just (t, result)
+
+  case config_janitor_period of
+    Just secs -> Warden.spawn_ envWarden
+      $ doPeriodically (seconds (fromIntegral secs))
+        -- a conservative timeout in case the janitor deadlocks for
+        -- some reason.
+      $ do
+          let softTimeout = 1 + fromIntegral secs * 20 * 1000 * 1000
+                                     -- 20 * config_janitor_period
+              hardTimeout = 1 + fromIntegral (secs * 120) -- 6 * soft timeout
+          result <- try $ asyncTimeout hardTimeout
+                        $ timeout softTimeout
+                        $ runDatabaseJanitor env
+          case result of
+            Right (Just (Just ())) ->
+              recordJanitorResult JanitorRunSuccess
+            Right (Just Nothing) -> do
+              logError "janitor timeout"
+              recordJanitorResult JanitorTimeout
+            Right Nothing -> do
+              logError "janitor stuck"
+              recordJanitorResult JanitorStuck
+            Left someException -> do
+              logError $ "janitor failed: " <> show someException
+              if
+                | Just e <- fromException someException
+                -> recordJanitorResult (JanitorRunFailure e)
+                | otherwise
+                -> recordJanitorResult
+                    (JanitorRunFailure $ OtherJanitorException someException)
+    Nothing ->
+      recordJanitorResult JanitorDisabled
+
+  Warden.spawn_ envWarden $ backuper env
+
+  replicateM_ (fromIntegral config_db_writer_threads)
+    $ Warden.spawn_ envWarden
+    $ writerThread env envWriteQueues
+
+  when envUpdateSchema $ do
+    Warden.spawnDaemon envWarden "schema updater" $ do
+      void $ atomically $ takeTMVar envSchemaUpdateSignal
+      schemaUpdated env Nothing
+    doOnUpdate envSchemaSource $
+      atomically $ void $ tryPutTMVar envSchemaUpdateSignal ()
+
+  -- Disk usage counters
+  Warden.spawn_ envWarden $ doPeriodically (seconds 600) $ do
+    diskSize <- Storage.getTotalCapacity envStorage
+    diskUsed <- Storage.getUsedCapacity envStorage
+
+    whenJust diskSize $ \size ->
+        void $ setCounter "glean.db.disk.capacity_bytes" size
+    whenJust diskUsed $ \used ->
+        void $ setCounter "glean.db.disk.used_bytes" used
+    whenJust (liftA2 (,) diskSize diskUsed) $ \(size,used) ->
+        void $
+          setCounter "glean.db.disk.used_percentage" (100 * used `div` size)
+
+-- Todo: this needs a lot more work.
+-- * We shouldn't just cancel the janitor, we should let it finish the
+--   current job if there is one.
+-- * We should wait for in-progress backups or restores (or cancel them safely)
+closeEnv :: Env -> IO ()
+closeEnv env@Env{..} = do
+  closeDatabases env
+  Warden.shutdown envWarden
+  Catalog.close envCatalog
+
+-- | Like 'System.Timeout.timeout' but more resilient against FFI calls.
+--   The IO computation is run in a separate thread, and if it doesn't finish
+--   before the timeout a 'Nothing' is returned. Cancellation is not attempted
+asyncTimeout :: Seconds -> IO a -> IO (Maybe a)
+asyncTimeout seconds action = withAsync (sleep seconds) $ \sleepA -> do
+  actionA <- async action
+  either Just (const Nothing) <$> waitEither actionA sleepA
diff --git a/glean/db/Glean/Database/Exception.hs b/glean/db/Glean/Database/Exception.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Exception.hs
@@ -0,0 +1,52 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Exception
+  ( DBError(..)
+  , DBAlreadyExists(..)
+  , dbException
+  , dbError
+  ) where
+
+import Control.Exception
+import Control.Monad.Catch (MonadThrow(..))
+import Data.Typeable (Typeable, cast)
+
+import Glean.Types hiding (Exception)
+import Glean.Database.Repo
+
+data DBError where
+  DBError :: String -> DBError
+  SomeDBError :: Exception e => e -> DBError
+
+instance Show DBError where
+  show (DBError s) = s
+  show (SomeDBError e) = show e
+
+instance Exception DBError
+
+dbException :: Repo -> String -> DBError
+dbException repo = DBError . inRepo repo
+
+dbError :: MonadThrow m => Repo -> String -> m a
+dbError repo msg = throwM $ dbException repo msg
+
+toDBError :: Exception e => e -> SomeException
+toDBError = toException . SomeDBError
+
+fromDBError :: Typeable b => SomeException -> Maybe b
+fromDBError e = do
+    SomeDBError e <- fromException e
+    cast e
+
+data DBAlreadyExists = DBAlreadyExists
+  deriving Show
+
+instance Exception DBAlreadyExists where
+  fromException = fromDBError
+  toException = toDBError
diff --git a/glean/db/Glean/Database/Finish.hs b/glean/db/Glean/Database/Finish.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Finish.hs
@@ -0,0 +1,120 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Finish
+  ( finishDatabase
+  , unfinishDatabase
+  , finalizeDatabase
+  , finalizeWait
+  ) where
+
+import Control.Monad.Catch
+import Control.Monad
+import Util.STM
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Meta
+import Glean.Types as Thrift
+import Glean.Database.Types
+import Glean.Internal.Types as Thrift
+
+import qualified Data.HashSet as HashSet
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Util.Observed as Observed
+
+-- | Tell the server that the database is complete
+-- starting the finalization process.
+-- Throws an exception if the database is not incomplete
+-- or there are pending writes.
+finishDatabase :: Env -> Repo -> IO Thrift.FinishDatabaseResponse
+finishDatabase Env{..} repo  = do
+  atomically $ do
+    void $ Catalog.modifyMeta envCatalog repo $ \oldmeta ->
+      case completenessStatus oldmeta of
+        DatabaseStatus_Incomplete ->
+          return oldmeta { metaCompleteness = Finalizing def }
+        _ -> throwM $ DatabaseNotIncomplete $ completenessStatus oldmeta
+    makeReadOnly
+    return Thrift.FinishDatabaseResponse{}
+  where
+    -- When a DB is complete, make it read-only to prevent further
+    -- writes. It is an error to call finishDatabase
+    -- if there are outstanding writes in the queue.
+    makeReadOnly = do
+      mdb <- HashMap.lookup repo <$> readTVar envActive
+      forM_ mdb $ \db -> do
+        st <- readTVar (dbState db)
+        case st of
+          Open odb@OpenDB { odbWriting = Just Writing{..} } -> do
+            -- NB. check the active counter as well as the queue,
+            -- because this will tell us if there are writes currently
+            -- in progress.
+            active <- readTVar (writeQueueActive wrQueue)
+            empty <- isEmptyTQueue (writeQueue wrQueue)
+            -- If there are outstanding writes then the client is
+            -- either broken or is intentionally trying to complete
+            -- the DB early. But we can't complete the DB with
+            -- outstanding writes, so we'll ask the client to retry
+            -- the request later.
+            when (active /= 0 || not empty) $
+              throwM $ Exception
+                "finishDatabase called but there are queued writes"
+            writeTVar (dbState db) $ Open odb { odbWriting = Nothing }
+          _ -> return ()
+
+
+-- | Change a database's state from Complete to Incomplete.
+-- WARNING! This is for testing only, and should
+-- never be used on a production database.
+unfinishDatabase :: Env -> Repo -> IO ()
+unfinishDatabase Env{..} repo  = do
+  backupPolicy <- ServerConfig.config_backup <$> Observed.get envServerConfig
+  let isBackupAllowed = repo_name repo `HashSet.member`
+        ServerConfig.databaseBackupPolicy_allowed backupPolicy
+  if isBackupAllowed
+    then do
+      throwM $ Thrift.Exception
+        "The backup is enabled for this Repo so we cannot unfinish it"
+    else atomically $ do
+      void $ Catalog.modifyMeta envCatalog repo $ \oldmeta ->
+        case Thrift.metaCompleteness oldmeta of
+          Thrift.Incomplete{} -> return oldmeta
+          Thrift.Complete{} -> return oldmeta
+            { Thrift.metaCompleteness = Thrift.Incomplete def }
+          Thrift.Finalizing{} -> return oldmeta
+            { Thrift.metaCompleteness = Thrift.Incomplete def }
+          someState -> throwM $ Thrift.Exception
+            (  "Cannot unfinish a database in state: "
+            <> showCompleteness someState)
+
+-- | Poll for finalization of a database
+--   Throws Exception if the database is broken or incomplete.
+finalizeDatabase :: Env -> Repo -> IO FinalizeResponse
+finalizeDatabase env repo = do
+  atomically $ do
+    meta <- Catalog.readMeta (envCatalog env) repo
+    case metaCompleteness meta of
+      Finalizing{} -> throwM $ Retry 1.0
+      Incomplete{} -> throwM $ Exception "incomplete database"
+      Broken b -> throwM $ Exception $ databaseBroken_reason b
+      _ -> return ()
+  return FinalizeResponse{}
+
+-- | Wait for finalization of a database. Use for local DBs only.
+--   Throws Exception if the database is broken or incomplete.
+finalizeWait :: Env -> Repo -> IO ()
+finalizeWait env repo =
+  atomically $ do
+    meta <- Catalog.readMeta (envCatalog env) repo
+    case metaCompleteness meta of
+      Finalizing{} -> retry
+      Incomplete{} -> throwM $ Exception "incomplete database"
+      Broken b -> throwM $ Exception $ databaseBroken_reason b
+      _ -> return ()
diff --git a/glean/db/Glean/Database/Janitor.hs b/glean/db/Glean/Database/Janitor.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Janitor.hs
@@ -0,0 +1,410 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Janitor
+  ( runDatabaseJanitor
+  , runDatabaseJanitorPureish
+  , JanitorSideEffect(..)
+  -- for testing
+  , mergeLocalAndRemote
+  , dbIndex
+  , DbIndex(..)
+  ) where
+
+import Control.Concurrent.Stream (stream)
+import Control.Concurrent (getNumCapabilities)
+import Control.Exception.Safe
+import Control.Monad.Extra
+import Control.Monad.IO.Class (liftIO)
+import Control.Monad.Trans (lift)
+import Control.Monad.Trans.State.Strict (runStateT)
+import qualified Control.Monad.Trans.State.Strict as State
+import Control.Monad.Trans.Writer.CPS
+import Data.ByteString (ByteString)
+import Data.Foldable as Foldable
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import Data.List (sortOn)
+import qualified Data.List.NonEmpty as NonEmpty
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Ord
+import qualified Data.Set as Set
+import qualified Data.Text.Encoding as Text
+import Data.Time
+
+import ServiceData.GlobalStats as Stats
+import Util.Control.Exception
+import Util.List
+import Util.Log
+import Util.Logger
+import Util.STM
+import Util.Time
+import Util.TimeSec
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter
+import Glean.Database.Close
+import Glean.Database.Delete
+import Glean.Database.List
+import Glean.Database.Meta
+import Glean.Database.Repo
+import Glean.Database.Restore
+import Glean.Database.Open
+import Glean.Database.Retention
+import Glean.Database.Types
+import Glean.Internal.Types
+import Glean.Logger
+import Glean.Repo.Text
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types hiding (Database)
+import qualified Glean.Types as Thrift
+import Glean.Util.Observed as Observed
+import Glean.Util.ShardManager
+    ( ShardManager(getAssignedShards, computeShardMapping),
+      SomeShardManager(SomeShardManager), countersForShardSizes, noSharding )
+import Glean.Util.TransitiveClosure
+
+{- |
+The database janitor has the following functions:
+  - ensure the newest db for each repo is open to speed-up queries to it.
+  - close databases that haven't been used in a while.
+  - kick-off downloads of dbs available in remote backups.
+  - delete dbs we don't need any longer.
+  - publish counters of local db states.
+-}
+runDatabaseJanitor :: Env -> IO ()
+runDatabaseJanitor env = do
+  runDatabaseJanitorPureish env >>= executeJanitorSideEffects env
+
+executeJanitorSideEffects :: Env -> [JanitorSideEffect] -> IO ()
+executeJanitorSideEffects env sideEffects =
+  do
+  forM_ sideEffects $ \case
+    PublishCounter n v -> void $ Stats.setCounter n v
+    _ -> pure ()
+  numCaps <- getNumCapabilities
+  stream numCaps (forM_ sideEffects) $ \case
+    PreOpenDB repo ->
+      void $ tryAll $ logExceptions (inRepo repo) $
+        withOpenDatabaseStack env repo (\_ -> return ())
+    _ -> pure ()
+
+  -- Record the published counters and clear stale ones
+  let countersPublished =
+        HashSet.fromList [n | PublishCounter n _ <- sideEffects]
+  lastPublishedCounters <- atomically $ do
+    last <- readTVar (envDatabaseJanitorPublishedCounters env)
+    writeTVar (envDatabaseJanitorPublishedCounters env) countersPublished
+    return last
+  forM_ (HashSet.difference lastPublishedCounters countersPublished)
+    clearCounter
+
+
+data JanitorSideEffect
+  = PublishCounter !ByteString !Int
+  | PreOpenDB !Repo
+  deriving (Eq, Show)
+
+publishCounter :: ByteString -> Int -> WriterT [JanitorSideEffect] IO ()
+publishCounter name value = tell [PublishCounter name value]
+
+preOpenDB :: Monad m => Repo -> WriterT [JanitorSideEffect] m ()
+preOpenDB repo = tell [PreOpenDB repo]
+
+-- WIP making the Janitor more testable by returning the list of side effects
+runDatabaseJanitorPureish :: Env -> IO [JanitorSideEffect]
+runDatabaseJanitorPureish env@Env{envShardManager = SomeShardManager sm} = do
+  maybeShards <- getAssignedShards sm
+  case maybeShards of
+    Just shards ->
+        runWithShards env (Set.fromList shards) sm
+    Nothing -> do
+      Just myShards <- getAssignedShards noSharding
+      runWithShards env (Set.fromList myShards) noSharding
+
+runWithShards
+  :: (Show shard, Ord shard)
+  => Env
+  -> Set.Set shard
+  -> ShardManager shard
+  -> IO [JanitorSideEffect]
+runWithShards env myShards sm = do
+  loggingAction (runLogCmd "janitor" env) (const mempty) $ do
+  logInfo $ "running database janitor with shard assignment "
+    <> show (toList myShards)
+
+  ServerConfig.Config{..} <- Observed.get (envServerConfig env)
+
+  let
+    !ServerConfig.DatabaseRetentionPolicy{} = config_retention
+    !ServerConfig.DatabaseClosePolicy{..} = config_close
+
+  fetchBackupsResult <- fetchBackups env
+
+  now <- envGetCurrentTime env
+
+  backups <- case fetchBackupsResult of
+    ReusedPreviousBackups{reusedBackups = (dbs,_utc)} -> return dbs
+    FetchedNewBackups{newBackups} -> return newBackups
+    FetchFailure{..} -> do
+      logError $ "couldn't list restorable databases: " <> show fetchError
+
+      case previousGoodBackups of
+        Nothing -> throwIO $ JanitorFetchBackupsFailure fetchError
+        Just (dbs, utc) -> do
+          let previousAgeInSeconds = fromIntegral (timeDiffInSeconds now utc)
+              tooOld = previousAgeInSeconds > config_max_remote_db_list_age
+          when tooOld $ throwIO $ JanitorFetchBackupsFailure fetchError
+
+          return dbs
+
+  localAndRestoring <- atomically $
+    Catalog.list (envCatalog env) [Local,Restoring] everythingF
+
+  dbToShard <- computeShardMapping sm
+
+  cachedAvailableDBs <- readTVarIO (envCachedAvailableDBs env)
+  let
+    isAvailable db
+      | HashSet.member db cachedAvailableDBs = return True
+      | otherwise = not . null <$> envFilterAvailableDBs env [db]
+
+    itemAvailable Item{itemRepo} = do
+      st <- State.get
+      case HashMap.lookup itemRepo st of
+        Just isAvailable -> return isAvailable
+        Nothing -> do
+          isAvailable <- lift $ isAvailable itemRepo
+          State.put $! HashMap.insert itemRepo isAvailable st
+          return isAvailable
+
+    allDBsByAge :: [Item]
+    allDBsByAge = mergeLocalAndRemote backups localAndRestoring
+
+    index@DbIndex{..} = dbIndex allDBsByAge
+
+  (RetentionChanges{..}, cachedAvailable) <- (`runStateT` mempty) $
+    retentionChanges
+      config_retention
+      config_restore
+      now
+      index
+      itemAvailable
+      dbToShard
+      myShards
+
+  atomically $ writeTVar
+    (envCachedAvailableDBs env)
+    (HashMap.keysSet $ HashMap.filter id cachedAvailable)
+
+  let
+    checkDependencies dbs msg1 msg2 =
+      unless (null dbs) $
+        logWarning $ msg1 <> ": " <> show dbs <> "\n" <> msg2
+
+  checkDependencies allMissingDependencies
+    "dependencies missing in Catalog"
+    ("This suggests a dependency db has been deleted from the cloud, " <>
+     "or a failure to enumerate the cloud catalog")
+
+  checkDependencies localMissingDependencies
+    "dependencies not downloaded"
+    ("This probably means a bug in the db->shard mapping, " <>
+     "or a failure to enumerate the cloud catalog")
+
+  forM_ retentionLocal $ \(Item{itemRepo, itemLocality}, _) ->
+    when (itemLocality == Local) $
+      atomically $ Catalog.unsetExpiring (envCatalog env) itemRepo
+
+  forM_ retentionDelete $ \Item{itemRepo = repo} -> do
+    let
+      ServerConfig.Retention{..} =
+        NonEmpty.head $ repoRetention config_retention $ Thrift.repo_name repo
+    expireDatabase (fromIntegral <$> retention_expire_delay) env repo
+      `catch` \UnknownDatabase{} ->
+        -- DBs are deleted asynchronously and this code is not transactional,
+        -- so it's possible that the DB is not in the Catalog at this point
+        return ()
+
+  restores <- fmap catMaybes $ forM retentionRestore $ \Item{..} ->
+    ifRestoreRepo env Nothing itemRepo $ do
+      logInfo $ "Restoring: " ++ showRepo itemRepo ++
+        " ("  ++ showNominalDiffTime (dbAge now itemMeta) ++ " old)"
+      return $ Just $ Catalog.startRestoring (envCatalog env) itemRepo itemMeta
+  -- register all the restoring DBs together in a single transaction,
+  -- so that the backup thread can't jump in early and pick one
+  atomically $ sequence_ restores
+
+  atomically $ Catalog.resetElsewhere (envCatalog env) retentionElsewhere
+
+  deleting <- readTVarIO (envDeleting env)
+
+  -- Open the most recent local, complete DB for each repo in order
+  -- to avoid lag spikes. This will be the DB that clients will get
+  -- by default unless they specify a particular DB instance.
+  let
+      toOpen = uniqBy (comparing itemRepo) $
+        [ item
+        | (_, dbsByAge) <- byRepoName
+        , item : _ <- [filter shouldOpen (NonEmpty.toList dbsByAge)]
+        ] <>
+        [ item
+        | (repoNm, dbs) <- byRepoName
+        , ServerConfig.Retention{retention_keep_open = True, ..} <-
+            NonEmpty.toList (repoRetention config_retention repoNm)
+        , item <- NonEmpty.toList dbs
+        , shouldOpen item
+        , hasAllProperties retention_required_properties item
+        ]
+
+      isComplete Complete{} = True
+      isComplete _ = False
+
+      shouldOpen item =
+        isComplete (metaCompleteness (itemMeta item)) &&
+        itemLocality item == Local &&
+        not (HashMap.member (itemRepo item) deleting)
+
+      closeDeps = transitiveClosureBy itemRepo (catMaybes . dependencies)
+
+  -- close any DBs that are idle, avoiding the set of DBs that we will
+  -- be proactively keeping open (and their dependencies).
+  closeIdleDatabases env
+     (seconds $ fromIntegral databaseClosePolicy_close_after)
+     (map itemRepo $ closeDeps toOpen)
+
+  execWriterT $ do
+    forM_ toOpen $ \item ->
+      whenM (liftIO $ atomically $ isDatabaseClosed env $ itemRepo item) $
+        preOpenDB (itemRepo item)
+
+    publishCounter "glean.db.remote.oldness" $ case fetchBackupsResult of
+      ReusedPreviousBackups{reusedBackups = (_,utc)} ->
+        timeDiffInSeconds now utc
+      FetchFailure{previousGoodBackups = Just (_, utc)} ->
+        timeDiffInSeconds now utc
+      FetchFailure{previousGoodBackups = Nothing} -> 0
+      FetchedNewBackups{} -> 0
+
+    forM_ byRepoName $ \(repoNm, dbsByAge) -> do
+      let prefix = "glean.db." <> Text.encodeUtf8 repoNm
+      let repoKeep =
+            [ item
+            | (item,_) <- retentionLocal
+            , repoNm == Thrift.repo_name (itemRepo item) ]
+
+      -- upsert counters
+      publishCounter (prefix <> ".all") $ length repoKeep
+      publishCounter (prefix <> ".available") $ length $ filter
+        (\Item{..} ->
+          itemLocality == Local
+          && completenessStatus itemMeta == Thrift.DatabaseStatus_Complete)
+        repoKeep
+      publishCounter (prefix <> ".restoring") $
+        length restores +
+        length (NonEmpty.filter (\Item{..} -> itemLocality == Restoring)
+          dbsByAge)
+      publishCounter (prefix <> ".indexing") $ length $ NonEmpty.filter
+        (\Item{..} ->
+          itemLocality == Local
+          && completenessStatus itemMeta == Thrift.DatabaseStatus_Incomplete)
+        dbsByAge
+      publishCounter (prefix <> ".backups") $ length $ NonEmpty.filter
+        (\Item{..} -> itemLocality == Cloud)
+        dbsByAge
+
+      -- Report the age of the newest local DB. We only want to report
+      -- the age for DBs that clients can query, hence the locality
+      -- filter. The global DB age will be calculated by taking the
+      -- minimum age reported by all the servers.
+      case [ item | item <- NonEmpty.toList dbsByAge,
+                itemLocality item == Local ] of
+        [] -> return ()
+        db:_ -> do
+          let
+              meta = itemMeta db
+              dbStart = dbTime meta
+              ageFrom t0 = timeSpanInSeconds $
+                fromUTCTime now `timeDiff` posixEpochTimeToTime t0
+          -- .age is the age of the data, .span is the age of the DB
+          publishCounter (prefix <> ".age") (ageFrom dbStart)
+          publishCounter (prefix <> ".span") (ageFrom (metaCreated meta))
+          publishCounter (prefix <> ".newest")
+            (fromIntegral (unPosixEpochTime dbStart))
+
+    -- Report shard stats for dynamic sharding assignment
+    mapM_ (\(n,v) -> publishCounter (Text.encodeUtf8 n) v) $
+      countersForShardSizes sm $
+      Map.fromListWith (+) $
+      [ (shard, bytes)
+      | (item, shard) <- retentionLocal
+      , Complete DatabaseComplete{databaseComplete_bytes = Just bytes} <-
+          [metaCompleteness (itemMeta item)]
+      ] ++
+      [ (shard, 0)
+      | shard <- toList myShards
+      , shard `notElem` Set.fromList (map snd retentionLocal)]
+
+
+mergeLocalAndRemote :: [(Repo, Meta)] -> [Item] -> [Item]
+mergeLocalAndRemote backups localAndRestoring =
+  sortOn (dbTime . itemMeta) $
+      localAndRestoring ++
+        [ Item repo Cloud meta ItemMissing
+          -- DBs we could restore
+        | (repo, meta) <- backups
+        , repo `notElem` map itemRepo localAndRestoring  ]
+
+data FetchBackups
+  = ReusedPreviousBackups {
+    reusedBackups :: ([(Repo, Meta)], UTCTime)
+    }
+  | FetchedNewBackups {
+    newBackups :: [(Repo, Meta)]
+    }
+  | FetchFailure {
+    previousGoodBackups :: Maybe ([(Repo, Meta)], UTCTime),
+    fetchError :: SomeException
+  }
+
+-- Fetches backups only if they haven't been fetched recently
+fetchBackups :: Env -> IO FetchBackups
+fetchBackups env = do
+  ServerConfig.Config{..} <- Observed.get (envServerConfig env)
+  let syncPeriodSeconds = fromIntegral config_backup_list_sync_period
+  maybeLastFetch <- readTVarIO (envCachedRestorableDBs env)
+  now <- envGetCurrentTime env
+  case maybeLastFetch of
+    Nothing -> fetch now Nothing
+    Just (lastFetch, dbs)
+      | now `timeDiffInSeconds` lastFetch > syncPeriodSeconds ->
+        fetch now (Just (dbs, lastFetch))
+      | otherwise ->
+        return $ ReusedPreviousBackups (dbs, lastFetch)
+  where
+    fetch now previousGood = do
+      logInfo "fetching restorable databases list"
+      dbs <- tryAll $
+        loggingAction (runLogCmd "listRestorable" env) (const mempty) $
+          concatMap HashMap.toList <$>
+            forRestoreSitesM env mempty listRestorable
+
+      when (null dbs) $
+        logWarning "found no restorable databases"
+
+      for_ dbs $ \dbs ->
+        atomically $ writeTVar (envCachedRestorableDBs env) (Just (now,dbs))
+
+      return $ case dbs of
+        Right dbs -> FetchedNewBackups dbs
+        Left error -> FetchFailure previousGood error
+
+timeDiffInSeconds :: UTCTime -> UTCTime -> Int
+timeDiffInSeconds t1 t2 =
+  timeSpanInSeconds $ fromUTCTime t1 `timeDiff` fromUTCTime t2
diff --git a/glean/db/Glean/Database/List.hs b/glean/db/Glean/Database/List.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/List.hs
@@ -0,0 +1,69 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.List (
+  listDatabases,
+  listRestorable,
+) where
+
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text ( Text )
+
+import Util.STM
+
+import qualified Glean.Database.Backup.Backend as Backup
+import qualified Glean.Database.Backup.Locator as Backup
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Meta
+import Glean.Database.Types
+import Glean.Types hiding (Database)
+import qualified Glean.Types as Thrift
+
+
+listDatabases :: Env -> Thrift.ListDatabases -> IO Thrift.ListDatabasesResult
+listDatabases env@Env{..} Thrift.ListDatabases{..} = do
+  backups <-
+    if listDatabases_includeBackups
+      then do
+        -- Use the cache of restorable DBs populated by the janitor,
+        -- if one is available.
+        maybeLastFetch <- readTVarIO envCachedRestorableDBs
+        restorables <- case maybeLastFetch of
+          Just (_, dbs) -> return $ HashMap.fromList dbs
+          Nothing -> do
+            sites <- atomically $ Backup.getAllSites env
+            HashMap.unions <$> mapM (uncurry listRestorable) sites
+        return $ reposToResults restorables
+      else
+        return mempty
+  local <- atomically $ Catalog.getLocalDatabases envCatalog
+  let databases =
+        HashMap.elems $
+        fmap Thrift.getDatabaseResult_database $
+        HashMap.union local backups
+  return Thrift.ListDatabasesResult
+    { listDatabasesResult_databases = databases }
+  where
+    reposToResults = HashMap.mapWithKey
+      (\repo meta -> Thrift.GetDatabaseResult
+        { getDatabaseResult_database = metaToThriftDatabase
+            Thrift.DatabaseStatus_Restorable
+            Nothing
+            repo
+            meta
+        })
+
+listRestorable :: Backup.Site site => Text -> site -> IO (HashMap Repo Meta)
+listRestorable prefix site =
+  HashMap.fromList <$> map adjustMeta <$> Backup.enumerate site
+  where
+    adjustMeta (repo, meta) =
+      (repo, meta {
+          metaBackup = Just $ Backup.toRepoLocator prefix site repo
+            })
diff --git a/glean/db/Glean/Database/Logger.hs b/glean/db/Glean/Database/Logger.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Logger.hs
@@ -0,0 +1,95 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- {-# OPTIONS_GHC -Wno-unused-do-bind #-}
+module Glean.Database.Logger (
+  logDBStatistics
+) where
+
+import Data.Text (Text)
+
+import qualified Glean.Database.Types as Database
+import qualified Glean.Types as Thrift
+import Glean.Logger.Database as Logger
+import Glean.RTS.Foreign.Ownership (OwnershipStats(..))
+import Glean.Types
+import Glean.Util.Some
+
+logDBStatistics
+  :: Database.Env -- ^ Environment
+  -> Thrift.Repo  -- ^ Repo of interest
+  -> [(PredicateRef, Thrift.PredicateStats)]
+                  -- ^ Digested stats per query in database
+  -> Maybe OwnershipStats
+  -> Int          -- ^ Number of bytes backed up
+  -> Text         -- ^ Backup locator
+  -> Bool         -- ^ The db has exclude property
+  -> IO ()
+logDBStatistics
+  env
+  Thrift.Repo{..}
+  preds
+  maybeOwnershipStats
+  size
+  locator
+  excluded = do
+  let preamble = mconcat
+        [ Logger.SetRepoName repo_name
+        , Logger.SetRepoHash repo_hash
+        ]
+
+  -- We shoehorn a summary row into the format for query rows
+  let summary  = mconcat
+        [ Logger.SetPredicateSize size            -- # bytes uploaded
+        , Logger.SetPredicateCount factCount      -- # total facts
+        , Logger.SetUploadDestination locator
+        , Logger.SetHasExcludeProperty excluded
+        ]
+      factCount = fromIntegral $ sum [predicateStats_count p| (_, p) <- preds]
+
+  let queries  =
+        [ mconcat
+          [ Logger.SetPredicateName predicateRef_name
+          , Logger.SetPredicateVersion (fromIntegral predicateRef_version)
+          , Logger.SetPredicateCount $ fromIntegral predicateStats_count
+          , Logger.SetPredicateSize $ fromIntegral predicateStats_size
+          ]
+        | (PredicateRef{..}, Thrift.PredicateStats{..}) <- preds
+        ]
+
+  let ownership
+        | Just OwnershipStats{..} <- maybeOwnershipStats =
+          [
+            mconcat
+              [ Logger.SetMetric "ownership_units"
+              , Logger.SetCount $ fromIntegral numUnits
+              , Logger.SetSize $ fromIntegral unitsSize
+              ],
+            mconcat
+              [ Logger.SetMetric "ownership_sets"
+              , Logger.SetCount $ fromIntegral numSets
+              , Logger.SetSize $ fromIntegral setsSize
+              ],
+            mconcat
+              [ Logger.SetMetric "ownership_fact_owners"
+              , Logger.SetCount $ fromIntegral numOwnerEntries
+              , Logger.SetSize $ fromIntegral ownersSize
+              ],
+            mconcat
+              [ Logger.SetMetric "ownership_orphan_facts"
+              , Logger.SetCount $ fromIntegral numOrphanFacts
+              ]
+          ]
+        | otherwise = []
+
+  let logStats log = case Database.envDatabaseLogger env of
+        Some logger -> Logger.runLog logger $ preamble <> log
+
+  -- We want a new row in the log table for the summary, and a new row
+  -- for each query
+  mapM_ logStats (summary:queries <> ownership)
diff --git a/glean/db/Glean/Database/Meta.hs b/glean/db/Glean/Database/Meta.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Meta.hs
@@ -0,0 +1,131 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+module Glean.Database.Meta
+  ( Meta(..)
+  , DBTimestamp(..)
+  , newMeta
+  , showCompleteness
+  , completenessStatus
+  , dbAge
+  , dbTime
+  , metaToThriftDatabase
+  , metaToProps
+  , metaFromProps
+  , utcTimeToPosixEpochTime
+  , posixEpochTimeToUTCTime
+  , posixEpochTimeToTime
+  ) where
+
+import qualified Data.ByteString.Char8 as B
+import Data.Functor
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import Data.Time (UTCTime, NominalDiffTime, diffUTCTime)
+import Data.Time.Clock.POSIX
+
+import Thrift.Protocol.JSON
+import Util.TimeSec
+
+import Glean.ServerConfig.Types (DBVersion(..))
+import Glean.Internal.Types
+import Glean.Types
+
+data DBTimestamp = DBTimestamp
+  { timestampCreated :: UTCTime
+  , timestampRepoHash :: Maybe UTCTime
+  }
+
+-- | Produce DB metadata
+newMeta
+  :: DBVersion -- ^ DB version
+  -> DBTimestamp -- ^ creation time and repo hash time
+  -> Completeness -- ^ write status
+  -> DatabaseProperties -- ^ user properties
+  -> Maybe Dependencies -- ^ stacked
+  -> Meta
+newMeta version timestamp completeness properties deps = Meta
+  { metaVersion = version
+  , metaCreated = utcTimeToPosixEpochTime $ timestampCreated timestamp
+  , metaRepoHashTime = utcTimeToPosixEpochTime <$> timestampRepoHash timestamp
+  , metaCompleteness = completeness
+  , metaProperties = properties
+  , metaBackup = Nothing
+  , metaDependencies = deps
+  , metaCompletePredicates = mempty
+  , metaAxiomComplete = False
+  }
+
+showCompleteness :: Completeness -> Text
+showCompleteness Incomplete{} = "incomplete"
+showCompleteness Complete{} = "complete"
+showCompleteness Broken{} = "broken"
+showCompleteness Finalizing{} = "finalizing"
+
+completenessStatus :: Meta -> DatabaseStatus
+completenessStatus meta = case metaCompleteness meta of
+  Incomplete{} -> DatabaseStatus_Incomplete
+  Complete{} -> DatabaseStatus_Complete
+  Broken{} -> DatabaseStatus_Broken
+  Finalizing{} -> DatabaseStatus_Finalizing
+
+dbAge :: UTCTime -> Meta -> NominalDiffTime
+dbAge now meta = now `diffUTCTime` posixEpochTimeToUTCTime (metaCreated meta)
+
+-- | We sort DBs by metaRepoHashTime if available, or otherwise metaCreated
+dbTime :: Meta -> PosixEpochTime
+dbTime meta = fromMaybe (metaCreated meta) (metaRepoHashTime meta)
+
+metaToThriftDatabase
+  :: DatabaseStatus
+  -> Maybe UTCTime  -- time of expiry, if any
+  -> Repo
+  -> Meta
+  -> Database
+metaToThriftDatabase status expire repo Meta{..} = Database
+  { database_repo = repo
+  , database_status = status
+  , database_location = metaBackup
+  , database_created_since_epoch = metaCreated
+  , database_expire_time = utcTimeToPosixEpochTime <$> expire
+  , database_properties = metaProperties
+  , database_completed = case metaCompleteness of
+      Complete DatabaseComplete{databaseComplete_time=t} -> Just t
+      _ -> Nothing
+  , database_repo_hash_time = metaRepoHashTime
+  , database_dependencies = metaDependencies
+  , database_broken = case metaCompleteness of
+      Broken broken -> Just broken
+      _ -> Nothing
+  , database_complete = case metaCompleteness of
+      Complete complete -> Just complete
+      _ -> Nothing
+  }
+
+metaToProps :: Meta -> Map String String
+metaToProps meta = Map.fromList [("meta", B.unpack (serializeJSON meta))]
+
+metaFromProps :: Text -> Map String String -> Either String Meta
+metaFromProps loc ps = case Map.lookup "meta" ps of
+  Just str ->
+    deserializeJSON (B.pack str) <&> \meta -> meta { metaBackup = Just loc }
+  Nothing -> Left "missing property 'meta'"
+
+-- Time functions
+
+utcTimeToPosixEpochTime :: UTCTime -> PosixEpochTime
+utcTimeToPosixEpochTime = PosixEpochTime . round . utcTimeToPOSIXSeconds
+
+posixEpochTimeToUTCTime :: PosixEpochTime -> UTCTime
+posixEpochTimeToUTCTime = toUTCTime . posixEpochTimeToTime
+
+posixEpochTimeToTime :: PosixEpochTime -> Time
+posixEpochTimeToTime = Time . fromIntegral . unPosixEpochTime
diff --git a/glean/db/Glean/Database/Open.hs b/glean/db/Glean/Database/Open.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Open.hs
@@ -0,0 +1,667 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Open (
+  usingActiveDatabase,
+  withOpenDatabase, withOpenDatabaseStack, withWritableDatabase,
+  withOpenDatabaseStorage,
+  readDatabase, readDatabaseWithBoundaries,
+  asyncOpenDB,
+  newDB, acquireDB, releaseDB,
+  isDatabaseClosed,
+  schemaUpdated,
+  getDbSchemaVersion,
+  updateLookupCacheStats,
+  repoParent,
+  repoParents,
+  depParent
+) where
+
+import Control.Concurrent (modifyMVar_)
+import Control.Concurrent.Async (Async, wait)
+import Control.Exception hiding(try)
+import Control.Monad.Catch (try)
+import Control.Monad.Extra
+import Data.ByteString (ByteString)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.IORef
+import Data.Maybe
+import Data.Set (Set)
+import qualified Data.Text as Text
+import Data.Word
+import qualified Data.Set as Set
+import GHC.Stack (HasCallStack)
+
+import Util.Control.Exception (tryAll)
+import qualified Util.Control.Exception.CallStack as CallStack
+import Util.Log
+import Util.Logger
+import Util.STM
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter (Locality(..))
+import Glean.Database.Data
+import Glean.Database.Exception
+import Glean.Database.Repo
+import Glean.Database.Storage as Storage
+import Glean.Database.Meta (Meta(..))
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.Database.Types
+import Glean.Logger
+import Glean.Query.Codegen (Boundaries, flatBoundaries, stackedBoundaries)
+import Glean.Repo.Text
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+import Glean.RTS.Foreign.Lookup (Lookup)
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import qualified Glean.RTS.Foreign.Ownership as Ownership
+import qualified Glean.RTS.Foreign.Stacked as Stacked
+import Glean.RTS.Types (Pid(..))
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types (Repo)
+import qualified Glean.Internal.Types as Thrift
+import qualified Glean.Types as Thrift
+import Glean.Types (PredicateStats(..))
+import Glean.Util.Mutex
+import qualified Glean.Util.Observed as Observed
+import Util.Time
+import qualified Glean.Util.Warden as Warden
+import qualified Glean.Write.Stats as Stats
+
+withOpenDatabase
+ :: HasCallStack
+ => Env
+ -> Repo
+ -> (forall s . Storage s => OpenDB s -> IO a)
+ -> IO a
+withOpenDatabase env repo act = withOpenDatabaseStorage env repo (const act)
+
+withOpenDatabaseStorage
+  :: HasCallStack
+  => Env
+  -> Repo
+  -> (forall s . Storage s => s -> OpenDB s -> IO a)
+  -> IO a
+withOpenDatabaseStorage env@Env{..} repo action =
+  withActiveDatabase env repo $ \storage db@DB{..} -> do
+    odb <- mask $ \restore -> do
+      r <- atomically $ do
+        state <- readTVar dbState
+        case state of
+          Opening -> retry
+          Open odb -> return $ Left odb
+          Closing -> retry
+          Closed -> do
+            meta <- Catalog.readMeta envCatalog dbRepo
+            let version = Thrift.metaVersion meta
+                mode
+                  | envReadOnly = ReadOnly
+                  | Thrift.Complete{} <- completeness = ReadOnly
+                  | otherwise = ReadWrite
+                    -- Note: Finalizing also needs to be ReadWrite,
+                    -- because compaction modifies the DB.
+                  where completeness = metaCompleteness meta
+            when (not $ canOpenVersion mode version) $ dbError dbRepo
+              $ "can't open database version " ++ show (unDBVersion version)
+            writeTVar dbState Opening
+            return $ Right (version, mode)
+      case r of
+        Left odb -> return odb
+        Right (version, mode) -> do
+          deps <- atomically $ metaDependencies <$>
+            Catalog.readMeta envCatalog dbRepo
+          let
+            onFailure ex = atomically $ Catalog.dbFailed envCatalog dbRepo ex
+          -- opening a DB has long uninterruptible sections so do it on a
+          -- separate thread in case we get cancelled
+          opener <-
+            asyncOpenDB env storage db version mode deps (return ()) onFailure
+          restore $ wait opener
+    action storage odb `finally` do
+      t <- getTimePoint
+      atomically $ writeTVar (odbIdleSince odb) t
+
+-- | Runs the action on each DB in the stack, in top-to-bottom order
+withOpenDatabaseStack
+  :: Env
+  -> Repo
+  -> (forall s . Storage s => OpenDB s -> IO a)
+  -> IO [a]
+withOpenDatabaseStack env repo action = do
+  parents <- repoParents env repo
+  mapM (\repo -> withOpenDatabase env repo action) (repo : parents)
+
+repoParents :: Env -> Repo -> IO [Repo]
+repoParents Env{..} repo = go repo
+  where
+  go repo = do
+    deps <- atomically $ metaDependencies <$> Catalog.readMeta envCatalog repo
+    case deps of
+      Nothing -> return []
+      Just dep -> (parent :) <$> go parent
+        where parent = depParent dep
+
+repoParent :: Env -> Repo -> IO (Maybe Repo)
+repoParent Env{..} repo = do
+  deps <- atomically $ metaDependencies <$> Catalog.readMeta envCatalog repo
+  return (fmap depParent deps)
+
+depParent :: Thrift.Dependencies -> Repo
+depParent deps = case deps of
+  Thrift.Dependencies_pruned Thrift.Pruned{..} -> pruned_base
+  Thrift.Dependencies_stacked Thrift.Stacked{..} -> Thrift.Repo stacked_name stacked_hash
+
+withOpenDBLookup
+  :: Storage s
+  => Env
+  -> Repo
+  -> OpenDB s
+  -> (Boundaries -> Lookup -> IO a)
+  -> IO a
+withOpenDBLookup env repo OpenDB{ odbBaseSlices = baseSlices, .. } f =
+  Lookup.withCanLookup odbHandle $ \lookup -> do
+  parent <- repoParent env repo
+  case parent of
+    Nothing -> do
+      bounds <- flatBoundaries lookup
+      f bounds lookup
+    Just baseRepo ->
+      withOpenDatabase env baseRepo $ \OpenDB{..} -> do
+        -- stacked (sliced base lookup)
+        Lookup.withCanLookup odbHandle $ \baseLookup -> do
+          withOpenDBStack env baseRepo baseLookup $ \base -> do
+            bounds <- stackedBoundaries base lookup
+            let slices = catMaybes baseSlices
+            if null slices
+              then Lookup.withCanLookup (Stacked.stacked base lookup)
+                (f bounds)
+              else
+                Lookup.withCanLookup
+                  (Ownership.slicedStack slices base) $ \sliced ->
+                Lookup.withCanLookup (Stacked.stacked sliced lookup)
+                  (f bounds)
+
+withOpenDBStack
+  :: Env
+  -> Repo  -- Stacked DB
+  -> Lookup  -- Stacked DB
+  -> (Lookup -> IO a)
+  -> IO a
+withOpenDBStack env repo lookup f = do
+  parent <- repoParent env repo
+  case parent of
+    Nothing -> f lookup
+    Just baseRepo ->
+      withOpenDatabase env baseRepo $ \OpenDB{..} ->
+        Lookup.withCanLookup odbHandle $ \baseLookup ->
+        withOpenDBStack env baseRepo baseLookup $ \base -> do
+          Lookup.withCanLookup (Stacked.stacked base lookup) f
+
+withWritableDatabase :: Env -> Repo -> ((WriteQueue, DbSchema) -> IO a) -> IO a
+withWritableDatabase env repo action =
+  withOpenDatabase env repo $ \OpenDB{..} -> case odbWriting of
+    Just Writing{..} -> action (wrQueue, odbSchema)
+    Nothing -> dbError repo "can't write to a read-only database"
+
+readDatabase
+  :: Env
+  -> Repo
+  -> (forall s . Storage s => OpenDB s -> Lookup.Lookup -> IO a)
+  -> IO a
+readDatabase env repo f =
+  readDatabaseWithBoundaries env repo $ \odb _ lookup ->
+  f odb lookup
+
+readDatabaseWithBoundaries
+  :: Env
+  -> Repo
+  -> (forall s. Storage s => OpenDB s -> Boundaries -> Lookup -> IO a)
+  -> IO a
+readDatabaseWithBoundaries env repo f =
+  withOpenDatabase env repo $ \odb ->
+  withOpenDBLookup env repo odb $ \bounds lookup ->
+    f odb bounds lookup
+
+newDB :: Repo -> STM (DB s)
+newDB repo = DB repo
+  <$> newTVar Closed
+  <*> newTVar 0
+
+acquireDB :: DB s -> STM ()
+acquireDB db = modifyTVar' (dbUsers db) (+1)
+
+-- | MUST be paired with 'acquireDB'
+releaseDB
+  :: Catalog.Catalog
+  -> TVar (HashMap Thrift.Repo (DB storage))
+  -> DB s
+  -> STM ()
+releaseDB catalog active DB{..} = do
+  users <- readTVar dbUsers
+  writeTVar dbUsers $! users - 1
+  when (users == 1) $ do
+    state <- readTVar dbState
+    case state of
+      Closed -> do
+        meta <- try $ Catalog.readMeta catalog dbRepo
+        case meta :: Either SomeException Meta of
+          Right Meta{metaCompleteness = Thrift.Incomplete{}} -> return ()
+          _ -> modifyTVar' active $ HashMap.delete dbRepo
+      _ -> return ()
+
+withActiveDatabase
+  :: HasCallStack
+  => Env
+  -> Repo
+  -> (forall s . Storage s => s -> DB s -> IO a)
+  -> IO a
+withActiveDatabase Env{..} repo act = bracket
+  (atomically $ do
+    r <- HashMap.lookup repo <$> readTVar envActive
+    db <- case r of
+      Just db -> return db
+      Nothing -> do
+        exists <- Catalog.exists envCatalog [Local] repo
+        when (not exists) $ CallStack.throwSTM $ Thrift.UnknownDatabase repo
+        deleting <- HashMap.member repo <$> readTVar envDeleting
+        -- TODO: different error?
+        when deleting $ CallStack.throwSTM $ Thrift.UnknownDatabase repo
+        db <- newDB repo
+        modifyTVar' envActive $ HashMap.insert repo db
+        return db
+    acquireDB db
+    return db)
+  (atomically . releaseDB envCatalog envActive)
+  (\db -> act envStorage db)
+
+usingActiveDatabase
+  :: Env
+  -> Repo
+  -> (forall s. Storage s => Maybe (DB s) -> IO a)
+  -> IO a
+usingActiveDatabase Env{..} repo = bracket
+  (atomically $ do
+    r <- HashMap.lookup repo <$> readTVar envActive
+    mapM_ acquireDB r
+    return r)
+  (atomically . mapM_ (releaseDB envCatalog envActive))
+
+withMaybeActiveDatabase
+  :: Env
+  -> Repo
+  -> (forall s . Storage s => Maybe (DB s) -> STM a)
+  -> STM a
+withMaybeActiveDatabase Env{..} repo fn = do
+  active <- readTVar envActive
+  fn (HashMap.lookup repo active)
+
+updateLookupCacheStats :: Env -> IO ()
+updateLookupCacheStats env =
+  Stats.bump (envStats env) Stats.lookupCacheStats
+  =<< LookupCache.readStatsAndResetCounters (envLookupCacheStats env)
+
+setupSchema :: Storage s => Env -> Repo -> Database s -> Mode -> IO DbSchema
+setupSchema Env{..} _ handle (Create _ _ initial) = do
+  schema <- Observed.get envSchemaSource
+  dbSchema <- case initial of
+    UseDefaultSchema ->
+      newDbSchema (Just envDbSchemaCache) schema
+        LatestSchema readWriteContent envDebug
+    UseSpecificSchema schemaId ->
+      newDbSchema (Just envDbSchemaCache) schema
+        (SpecificSchemaId schemaId) readWriteContent envDebug
+    UseThisSchema info ->
+      fromStoredSchema (Just envDbSchemaCache) info readWriteContent envDebug
+  storeSchema handle $ toStoredSchema dbSchema
+  return dbSchema
+setupSchema env@Env{..} repo handle mode = do
+  stored <- retrieveSchema repo handle
+  case stored of
+    Just info
+      | ReadOnly <- mode -> mergeSchema
+      | otherwise ->
+        fromStoredSchema (Just envDbSchemaCache) info readWriteContent envDebug
+          -- while writing, we don't allow new predicates to be added to
+          -- the schema. This is the easiest way to prevent facts being
+          -- added to the DB that aren't in the original stored schema.
+          -- It might be possible to do something safe here, e.g. only
+          -- merge non-stored derived predicates. (TODO)
+      where
+      stackStats :: IO (HashMap Pid PredicateStats)
+      stackStats = do
+        parents <- repoParents env repo
+        statss <- forM parents $ \repo ->
+          withOpenDatabase env repo $ \OpenDB{..} ->
+            Storage.predicateStats odbHandle
+        stats <- Storage.predicateStats handle
+        return $ HashMap.fromListWith (<>) $ concat (stats : statss)
+
+      mergeSchema = do
+        -- merge the schema in the DB with the current schema, so
+        -- that we can query for derived predicates that weren't
+        -- stored in the DB when it was created.
+        schema <- Observed.get envSchemaSource
+        stats <- stackStats
+        newMergedDbSchema (Just envDbSchemaCache) info schema
+          (readOnlyContent stats) envDebug
+    Nothing -> do
+      meta <- atomically $ Catalog.readMeta envCatalog repo
+      let failure = case metaCompleteness meta of
+            Thrift.Broken (Thrift.DatabaseBroken task reason) ->
+              Text.unpack $ Text.unwords $
+                [ "Broken:" ] ++
+                [ task <> ":" | not (Text.null task) ] ++
+                [ reason ]
+            _ -> ""
+      dbError repo $ "DB has no stored schema. " <> failure
+
+-- | Update the schema for all open DBs when the prevailing schema has
+-- changed.
+--
+-- Preconditions:
+--
+--  * when schemaUpdated is invoked, calls to Observed.get on
+--    envSchemaSource are guaranteed to get the updated schema.
+--
+--  * schemaUpdated does not run concurrently with itself.
+--
+schemaUpdated
+  :: Env
+  -> Maybe Repo
+       -- ^ Just repo => only update the schema for this repo,
+       -- otherwise update all of them.
+  -> IO ()
+schemaUpdated env@Env{..} mbRepo = do
+  let
+    just = case mbRepo of
+      Nothing -> HashMap.elems
+      Just repo -> maybeToList . HashMap.lookup repo
+    acquire = atomically $ do
+      active <- just <$> readTVar envActive
+      mapM_ acquireDB active
+      return active
+    release = atomically . mapM_ (releaseDB envCatalog envActive)
+
+  -- Empty the DbSchema cache. We probably have a new SchemaIndex now
+  -- which invalidates all the entries anyway, and also we don't prune
+  -- this cache anywhere else.
+  when (isNothing mbRepo) $ do
+    modifyMVar_ envDbSchemaCache $ \_ -> return HashMap.empty
+    -- previously failed DBs might now open successfully
+    atomically $ Catalog.resetFailed envCatalog
+
+  bracket acquire release $ \active -> do
+    forM_ active $ \DB{..} -> do
+      maybeOpenDB <- atomically $ do
+        state <- readTVar dbState
+        case state of
+          Opening -> retry
+          Open odb -> return $ Just odb
+          Closing -> return Nothing
+          Closed -> return Nothing
+      forM_ maybeOpenDB $ \OpenDB{..} -> do
+        case odbWriting of
+          Just{} -> do
+            logInfo $ "not updating schema for writable DB: " <>
+              showRepo dbRepo
+            return ()
+            -- see setupSchema above, we don't update the schema for
+            -- a writable DB.
+          Nothing -> do
+            logInfo $ "updating schema for: " <> showRepo dbRepo
+            r <- tryAll $
+              loggingAction
+                (runLogRepo "update-schema" env dbRepo) (const mempty) $
+                  setupSchema env dbRepo odbHandle ReadOnly
+            case r of
+              Left err -> logError $ "schema update for " <> showRepo dbRepo <>
+                " failed: " <> show err
+              Right schema -> atomically $ do
+                state <- readTVar dbState
+                case state of
+                  Opening -> return ()
+                   -- if we are Opening now, this must have happened
+                   -- after the transaction above, so it will already
+                   -- pick up the new schema.
+                  Open odb ->
+                    writeTVar dbState $ Open odb { odbSchema = schema }
+                  Closing -> return ()
+                  Closed -> return ()
+  logInfo "done updating schema for open DBs"
+
+
+setupWriting :: Lookup.CanLookup lookup => Env -> lookup -> IO Writing
+setupWriting Env{..} lookup = do
+  scfg <- Observed.get envServerConfig
+  -- Convert to Word64 from Int32 to prevent silent truncation.
+  let cache_limit_mb :: Word64 = fromIntegral $
+        ServerConfig.config_db_lookup_cache_limit_mb scfg
+  lookupCache <- LookupCache.new
+    (fromIntegral$ cache_limit_mb * 1024 * 1024)
+    (fromIntegral $ ServerConfig.config_db_writer_threads scfg)
+    envLookupCacheStats
+  next_id <- newIORef =<< Lookup.firstFreeId lookup
+  mutex <- newMutex (Storage.WriteLock ())
+  queue <- WriteQueue <$> newTQueueIO <*> newTVarIO 0 <*> newTVarIO 0
+    <*> newTVarIO 0 <*> newTVarIO 0
+  anchorName <- newTVarIO Nothing
+  commit <- newTVarIO Nothing
+  return Writing
+    { wrLock = mutex
+    , wrNextId = next_id
+    , wrLookupCache = lookupCache
+    , wrLookupCacheAnchorName = anchorName
+    , wrQueue = queue
+    , wrCommit = commit
+    }
+
+-- | Open a database asynchronously, returning an 'Async' that can be waited on.
+-- This is the only way to open a database since this operation has
+-- uninterruptible chunks which might take a long time.
+--
+-- NOTE: This should be called with 'dbState' set to 'Opening' and async
+-- exceptions masked.
+asyncOpenDB
+  :: Storage s
+  => Env
+  -> s
+  -> DB s
+  -> DBVersion
+  -> Mode
+  -> Maybe Thrift.Dependencies
+  -> IO ()
+      -- ^ Action to run on success before setting the db status to
+      -- 'Open'. If this fails, we will call the failure action.
+  -> (SomeException -> IO ())
+      -- ^ Action to run on any failure.
+  -> IO (Async (OpenDB s))
+asyncOpenDB env@Env{..} storage db@DB{..} version mode deps
+    on_success on_failure =
+  -- Be paranoid about 'spawnMask' itself throwing.
+  handling_failures $ Warden.spawnMask envWarden $ \restore ->
+  loggingAction (runLogRepo "open" env dbRepo) (const mempty) $
+  bracket_
+    (atomically $ acquireDB db)
+    (atomically $ releaseDB envCatalog envActive db) $
+  handling_failures $ do
+    logInfo $ inRepo dbRepo "opening"
+    bracketOnError
+      (Storage.open storage dbRepo mode version)
+      Storage.close
+      $ \handle -> do
+          odb <- restore $ do
+            logInfo $ inRepo dbRepo "opened"
+            dbSchema <- setupSchema env dbRepo handle mode
+            logInfo $ inRepo dbRepo $
+              "schema has " ++ show (schemaSize dbSchema) ++ " predicates"
+            writing <- case mode of
+              ReadOnly -> return Nothing
+              _ -> Just <$> setupWriting env handle
+            maybeSlices <- case mode of
+              Create{} -> do
+                let units = case deps of
+                      Just (Thrift.Dependencies_pruned Thrift.Pruned{..}) ->
+                        pruned_units
+                      _ -> []
+                storeUnits handle units
+                slices <- baseSlices env deps (Just units)
+                storeSlices handle (catMaybes slices)
+                return slices
+              _ -> do
+                m <- retrieveSlices dbRepo handle
+                case m of
+                  Nothing -> do
+                    stored_units <- retrieveUnits dbRepo handle
+                    baseSlices env deps stored_units
+                  Just slices -> return $ map Just slices
+            idle <- newTVarIO =<< getTimePoint
+            ownership <- newTVarIO =<< Storage.getOwnership handle
+            on_success
+            return OpenDB
+              { odbHandle = handle
+              , odbWriting = writing
+              , odbSchema = dbSchema
+              , odbIdleSince = idle
+              , odbBaseSlices = maybeSlices
+              , odbOwnership = ownership
+              }
+          atomically $ writeTVar dbState $ Open odb
+          return odb
+  where
+    handling_failures :: IO a -> IO a
+    handling_failures = handle $ \exc -> do
+      atomically (writeTVar dbState Closed)
+      logError $ inRepo dbRepo "couldn't open: " ++ show (exc :: SomeException)
+      on_failure exc
+      throwIO exc
+
+
+-- | Fetch the glean.schema_id property of a DB, if it has one. This
+-- property is used to resolve queries.
+getDbSchemaVersion
+  :: Env
+  -> Thrift.Repo
+  -> IO (Maybe Thrift.SchemaId)
+getDbSchemaVersion env repo = do
+  props <- atomically $ Thrift.metaProperties <$>
+    Catalog.readMeta (envCatalog env) repo
+  return $ case HashMap.lookup "glean.schema_id" props of
+    Just txt -> Just (Thrift.SchemaId txt)
+    _otherwise -> Nothing
+
+type Unit = ByteString
+  -- why is pruned_units a list<binary> instead of list<UnitName>?
+
+-- | Create the slices for a DB stack.
+--
+-- A stack has a set of units that are pruned, so we need to create a
+-- slice for each DB in the stack that hides those units. As we go
+-- down the stack, we pick up more units to exclude.
+--
+-- For each sub-stack we already have a set of slices for it
+-- (odbBaseSlices in OpenDB), and this will be sufficient for the
+-- current stack if we are excluding a subset of the units already
+-- excluded by the stack.
+--
+-- Complicating this all somewhat is that a stack may specify the
+-- units to *include* rather than *exclude*.
+--
+baseSlices
+  :: Env
+  -> Maybe Thrift.Dependencies
+  -> Maybe [Unit] -- ^ units stored in the DB
+  -> IO [Maybe Ownership.Slice]
+baseSlices env deps stored_units = case deps of
+  Nothing -> return []
+  Just (Thrift.Dependencies_stacked Thrift.Stacked{..}) ->
+    dbSlices (Thrift.Repo stacked_name stacked_hash) Set.empty True
+  Just (Thrift.Dependencies_pruned Thrift.Pruned{..}) -> do
+    let real_units = fromMaybe pruned_units stored_units
+    dbSlices pruned_base (Set.fromList real_units) pruned_exclude
+ where
+  dbSlices
+    :: Repo
+       -- ^ DB (stack) to slice
+    -> Set Unit
+       -- ^ Pruned units
+    -> Bool
+       -- ^ True <=> exclude, False <=> include
+    -> IO [Maybe Ownership.Slice]
+  dbSlices repo units exclude = do
+    withOpenDatabase env repo $ \OpenDB{..} -> do
+      baseDeps <- atomically $ metaDependencies <$>
+        Catalog.readMeta (envCatalog env) repo
+      baseUnits <- retrieveUnits repo odbHandle
+      rest <- depSlices baseDeps baseUnits units exclude odbBaseSlices
+      slice <- if exclude && Set.null units
+        then return Nothing
+        else do
+          let !n = Set.size units
+          vlog 1 $ "computing slice for " <> showRepo repo <> " with " <>
+            show n <>
+            (if exclude then " excluded: " else " included: ") <>
+            show (Set.toList units)
+          unitIds <- fmap catMaybes $
+            forM (Set.toList units) $ \name -> do
+              id <- Storage.getUnitId odbHandle name
+              vlog 2 $ "unit: " <> show name <> " = " <> show id
+              return id
+          maybeOwnership <- readTVarIO odbOwnership
+          r <- forM maybeOwnership $ \ownership ->
+            Ownership.slice ownership (catMaybes rest) unitIds exclude
+          logInfo $ "completed " <> show n <> " slice for " <> showRepo repo
+          return r
+      return (slice : rest)
+
+  -- | Create the slices for a stack of dependencies
+  depSlices
+    :: Maybe Thrift.Dependencies
+    -> Maybe [Unit] -- ^ units stored in the DB
+    -> Set Unit
+    -> Bool
+    -> [Maybe Ownership.Slice]
+       -- ^ slices for this dependency, if we already have them
+    -> IO [Maybe Ownership.Slice]
+  depSlices dep dep_units units exclude slices = do
+    case dep of
+      Nothing -> return []
+      Just (Thrift.Dependencies_stacked Thrift.Stacked{..}) ->
+        dbSlices (Thrift.Repo stacked_name stacked_hash) units exclude
+      Just (Thrift.Dependencies_pruned Thrift.Pruned{..})
+        -- optimisation: check if the slices for the stack will be the
+        -- same as the slices we already have for this repo. TODO:
+        -- could handle more of the exclude/pruned_exclude combos here
+        | exclude && pruned_exclude,
+          units `Set.isSubsetOf` depUnits ->
+          return slices
+        | otherwise ->
+          dbSlices pruned_base newUnits (exclude && pruned_exclude)
+        where
+        depUnits = Set.fromList $ fromMaybe pruned_units dep_units
+          -- prefer the units stored in the DB
+        newUnits
+          | exclude && pruned_exclude =
+            units `Set.union` depUnits
+          | not exclude && pruned_exclude =
+            units `Set.difference` depUnits
+          | exclude && not pruned_exclude =
+            depUnits `Set.difference` units
+          | otherwise {- not exclude && not pruned_exclude -} =
+            units `Set.intersection` depUnits
+
+isDatabaseClosed :: Env -> Repo -> STM Bool
+isDatabaseClosed env repo =
+  withMaybeActiveDatabase env repo $ \r ->
+    case r of
+      Just db -> do
+        st <- readTVar $ dbState db
+        case st of
+          Closed -> return True
+          _ -> return False
+      _ -> return True
diff --git a/glean/db/Glean/Database/Ownership.hs b/glean/db/Glean/Database/Ownership.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Ownership.hs
@@ -0,0 +1,73 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Ownership
+  ( factOwnership
+  , OwnerExpr(..)
+  ) where
+
+import Control.Exception
+import Data.ByteString (ByteString)
+import Data.Coerce
+import Data.Maybe
+import qualified Data.Vector.Storable as Vector
+import Data.Word
+
+import Util.STM
+
+import Glean.Database.Open
+import Glean.Database.Storage as Storage
+import Glean.Database.Types
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Types
+import Glean.Types
+
+data OwnerExpr
+  = Unit ByteString
+  | AndOwners [OwnerExpr]
+  | OrOwners [OwnerExpr]
+  deriving Show
+
+-- | Return the 'OwnerExpr' for a fact, if it has one. This is only for
+-- introspection in the shell, and for tests.
+factOwnership
+  :: Env
+  -> Repo
+  -> Fid
+  -> IO (Maybe OwnerExpr)
+factOwnership env repo fid = do
+  maybeSet <- readDatabase env repo $ \_ lookup -> getFactOwner lookup fid
+  stack <- withOpenDatabaseStack env repo $ \OpenDB{..} -> do
+    ownership <- readTVarIO odbOwnership
+    return (ownership, Storage.getUnit odbHandle)
+  let
+    ownerships = mapMaybe fst stack
+
+    getUnit unitId [] = getUset (coerce unitId) ownerships
+    getUnit unitId (getUnitDB : rest) = do
+      maybeUnit <- getUnitDB unitId
+      case maybeUnit of
+        Just unit -> return (Unit unit)
+        Nothing -> getUnit unitId rest
+
+    getUset usetId [] = throwIO $ ErrorCall $
+      "unknown UsetId: " <> show (coerce usetId :: Word32)
+    getUset usetId (own : owns) = do
+      maybeExpr <- getOwnershipSet own usetId
+      case maybeExpr of
+        Nothing -> getUset usetId owns
+        Just (op, vec) -> do
+          contents <- mapM unpackSet (Vector.toList vec)
+          case op of
+            And -> return (AndOwners contents)
+            Or -> return (OrOwners contents)
+
+    unpackSet :: UsetId -> IO OwnerExpr
+    unpackSet usetId = getUnit (coerce usetId) (map snd stack)
+
+  mapM unpackSet maybeSet
diff --git a/glean/db/Glean/Database/PredicateStats.hs b/glean/db/Glean/Database/PredicateStats.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/PredicateStats.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.PredicateStats
+  ( predicateStats
+  ) where
+
+import qualified Data.Map as Map
+import Data.Map (Map)
+import Data.Coerce (coerce)
+
+import Glean.Database.Open (withOpenDatabaseStack, withOpenDatabase)
+import Glean.RTS.Types (Pid(..))
+import Glean.Database.Types (OpenDB(..), Env)
+import Glean.Types (Repo, PredicateStats(..), Id)
+import Glean.Backend.Types (StackedDbOpts(..))
+import qualified Glean.Database.Storage as Storage
+
+predicateStats
+  :: Env
+  -> Repo
+  -> StackedDbOpts
+  -> IO (Map Id PredicateStats)
+predicateStats env repo opts = case opts of
+  ExcludeBase -> do
+    withOpenDatabase env repo $ \OpenDB{..} ->
+      Map.fromList . coerce <$> Storage.predicateStats odbHandle
+
+  IncludeBase -> do
+    statsList <- withOpenDatabaseStack env repo $ \OpenDB{..} ->
+      Storage.predicateStats odbHandle
+    return $ Map.fromListWith (<>) $ coerce $ concat statsList
diff --git a/glean/db/Glean/Database/Repo.hs b/glean/db/Glean/Database/Repo.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Repo.hs
@@ -0,0 +1,27 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Repo
+  ( databaseSubdir
+  , databasePath
+  , inRepo
+  ) where
+
+import System.FilePath
+
+import Glean.Repo.Text
+import Glean.Types (Repo(..))
+
+databaseSubdir :: Repo -> String
+databaseSubdir = showRepoSep "/"
+
+inRepo :: Repo -> String -> String
+inRepo repo s = databaseSubdir repo ++ ": " ++ s
+
+databasePath :: FilePath -> Repo -> FilePath
+databasePath root repo = root </> databaseSubdir repo
diff --git a/glean/db/Glean/Database/Restore.hs b/glean/db/Glean/Database/Restore.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Restore.hs
@@ -0,0 +1,81 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Restore (
+  restoreDatabase,
+  restoreDatabaseFromSite,
+  forRestoreSitesM, ifRestoreRepo, restorable,
+) where
+
+import Control.Exception hiding(handle)
+import qualified Data.Set as Set
+import Data.Text (Text)
+
+import Util.STM
+
+import qualified Glean.Database.Backup.Backend as Backup
+import qualified Glean.Database.Backup.Locator as Backup
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Types
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types hiding (Database)
+import qualified Glean.Types as Thrift
+import Glean.Util.Observed as Observed
+
+
+forRestoreSitesM
+  :: Env
+  -> a
+  -> (forall site. Backup.Site site => Text -> site -> IO a)
+  -> IO [a]
+forRestoreSitesM env@Env{..} none inner = do
+  ServerConfig.DatabaseRestorePolicy{..} <-
+    ServerConfig.config_restore <$> Observed.get envServerConfig
+  r <- atomically $ Backup.getAllSites env
+  case r of
+    sites@(_:_)
+      | databaseRestorePolicy_enabled
+        || not (Set.null databaseRestorePolicy_override) ->
+      mapM (uncurry inner) sites
+    _ -> return [none]
+
+ifRestoreRepo
+  :: Env
+  -> a
+  -> Repo
+  -> IO a
+  -> IO a
+ifRestoreRepo Env{..} none repo inner = do
+  policy <- ServerConfig.config_restore <$> Observed.get envServerConfig
+  if restorable policy repo
+    then inner
+    else return none
+
+restorable :: ServerConfig.DatabaseRestorePolicy -> Repo -> Bool
+restorable ServerConfig.DatabaseRestorePolicy{..} repo =
+  (repoName `Set.member` databaseRestorePolicy_override)
+     /= databaseRestorePolicy_enabled
+  where repoName = Thrift.repo_name repo
+
+restoreDatabase :: Env -> Text -> IO ()
+restoreDatabase env loc
+  | Just (_, site, repo) <-
+      Backup.fromRepoLocator (envBackupBackends env) loc =
+        atomically =<< restoreDatabaseFromSite env site repo
+  | otherwise = throwIO $
+      Thrift.InvalidLocator $ "invalid locator '" <> loc <>  "'"
+
+restoreDatabaseFromSite
+  :: Backup.Site site
+  => Env
+  -> site
+  -> Repo
+  -> IO (STM ())
+restoreDatabaseFromSite Env{..} site repo = do
+  props <- Backup.inspect site repo
+  return $ Catalog.startRestoring envCatalog repo props
diff --git a/glean/db/Glean/Database/Retention.hs b/glean/db/Glean/Database/Retention.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Retention.hs
@@ -0,0 +1,323 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Retention (
+    dbIndex, DbIndex(..),
+    retentionChanges,
+    RetentionChanges(..),
+    repoRetention,
+    hasAllProperties,
+  ) where
+
+import Control.Monad
+import Control.Monad.Extra
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.List.Extra (nubOrdOn)
+import Data.List.NonEmpty (NonEmpty(..))
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.Maybe
+import Data.Ord
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+import Data.Text (Text)
+import Data.Time
+
+import Util.List
+
+import Glean.Database.Catalog.Filter
+import Glean.Database.Meta
+import Glean.Database.Restore (restorable)
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types
+import Glean.Util.ShardManager
+import Glean.Util.TransitiveClosure
+
+data RetentionChanges shard = RetentionChanges
+  { retentionLocal :: [(Item,shard)]
+  , retentionDelete :: [Item]
+  , retentionRestore :: [Item]
+  , retentionElsewhere :: [Item]
+  , localMissingDependencies :: [Item]
+  , allMissingDependencies :: [Item]
+  }
+
+-- | Compute the changes to the current set of local DBs based on the
+-- set of known DBs (DbIndex), the retention/restore policy, the local
+-- shard, and an oracle to determine whether a DB is available elsewhere.
+
+retentionChanges
+  :: forall m shard . (Monad m, Show shard, Ord shard)
+  => ServerConfig.DatabaseRetentionPolicy
+    -- ^ Retention policy
+  -> ServerConfig.DatabaseRestorePolicy
+    -- ^ Restore policy
+  -> UTCTime
+    -- ^ Current time
+  -> DbIndex
+    -- ^ All DBs
+  -> (Item -> m Bool)
+    -- ^ Is a DB available on another server?
+  -> (BaseOfStack -> Repo -> shard)
+    -- ^ Compute shard for DB
+  -> Set.Set shard
+    -- ^ Shards to retain in this node
+  -> m (RetentionChanges shard)
+
+retentionChanges
+    retentionPolicy restorePolicy
+    now
+    index
+    isAvailable
+    dbToShard myShards = do
+
+  keep <- computeRetentionSet
+    retentionPolicy restorePolicy now isAvailable index
+
+  let
+    itemToShard :: Item -> Maybe shard
+    itemToShard item = do
+      stack <- repoStack index item
+      return $
+        dbToShard (BaseOfStack $ last $ itemRepo item : stack) (itemRepo item)
+
+    keepAnnotatedWithShard =
+      [ (item, guard (shard `Set.member` myShards) >> pure shard)
+      | item <- keep
+      -- We get Nothing when a dependency is missing, which should never happen.
+      -- If it does a 'logWarning' will be emitted by 'checkDependencies' below
+      , Just shard <- [itemToShard item]
+      ]
+
+    keepInThisNode =
+      [ (item, shard)
+      | (item, Just shard) <- keepAnnotatedWithShard ]
+
+    delete =
+      [ item
+      | item@(Item repo Local _ _) <- Map.elems (byRepo index)
+      , repo `notElem` map (itemRepo . fst) keepInThisNode ]
+
+    fetch =
+      [ item
+      | (item@Item{..},_) <- keepInThisNode
+      , itemLocality == Cloud ]
+
+    elsewhere =
+      [ item
+        -- Nothing means it is not in any of the shards assigned to this node
+      | (item, Nothing) <- keepAnnotatedWithShard
+      ]
+
+    missingDeps dbs =
+      nubOrdOn itemRepo [db | db <- dbs, Nothing <- dependencies index db]
+
+  return RetentionChanges {
+    retentionLocal = keepInThisNode,
+    retentionDelete = delete,
+    retentionRestore = fetch,
+    retentionElsewhere = elsewhere,
+    localMissingDependencies = missingDeps (map fst keepInThisNode),
+    allMissingDependencies = missingDeps keep
+  }
+
+repoStack :: DbIndex -> Item -> Maybe [Repo]
+repoStack index@DbIndex{..} Item{..} =
+  case metaDependencies itemMeta of
+    Just (Dependencies_stacked Stacked{..}) -> do
+      let base = Repo stacked_name stacked_hash
+      baseItem <- Map.lookup base byRepo
+      rest <- repoStack index baseItem
+      return (base : rest)
+
+    Just (Dependencies_pruned Pruned{..}) -> do
+      baseItem <- Map.lookup pruned_base byRepo
+      rest <- repoStack index baseItem
+      return (pruned_base : rest)
+    Nothing -> return []
+
+-- | Information about the set of DBs that we have
+data DbIndex = DbIndex
+  { byRepo :: Map.Map Repo Item
+    -- ^ Items indexed by Repo
+  , byRepoName :: [(Text, NonEmpty Item)]
+    -- ^ Items grouped by Repo name
+  , dependencies :: Item -> [Maybe Item]
+    -- ^ DB dependencies, Nothing indicates that there is a dependency
+    -- but it is missing in the catalog.
+  }
+
+dbIndex :: [Item] -> DbIndex
+dbIndex items = DbIndex{..}
+  where
+    byRepo =
+      Map.fromListWith pickFromDuplicates
+        $ [(itemRepo item, item) | item <- items]
+    pickFromDuplicates x y = -- Pick local one in a conflict
+      minimumBy (\x y -> compare (itemLocality x) (itemLocality y)) [x, y]
+
+    byRepoName =
+      HashMap.toList $ HashMap.fromListWith (<>)
+        [ (repo_name $ itemRepo item, item :| []) | item <- items ]
+
+    dependencies = stacked . metaDependencies . itemMeta
+
+    stacked (Just (Dependencies_stacked Stacked{..})) =
+      [ Repo stacked_name stacked_hash `Map.lookup` byRepo ]
+    stacked (Just (Dependencies_pruned update)) =
+      [ pruned_base update `Map.lookup` byRepo ]
+    stacked Nothing = []
+
+-- | The final set of DBs we want usable on disk.
+-- This is the set of 'keepRoots' DBs extended with all the stacked dependencies
+computeRetentionSet
+  :: forall m . Monad m
+  => ServerConfig.DatabaseRetentionPolicy
+  -> ServerConfig.DatabaseRestorePolicy
+  -> UTCTime
+  -> (Item -> m Bool)
+  -> DbIndex
+  -> m [Item]
+computeRetentionSet config_retention config_restore
+    time isAvailableM dbIndex@DbIndex{..} =
+  transitiveClosureBy itemRepo (catMaybes . depsRestored) <$>
+    concatMapM allRetention byRepoName
+  where
+    -- Add transitive dependencies of a DB to the retention set only
+    -- if the DB is local or will be restored.
+    depsRestored :: Item -> [Maybe Item]
+    depsRestored item@Item{..}
+      | itemLocality == Local
+        || restorable config_restore itemRepo = dependencies item
+      | otherwise = []
+
+    allRetention :: (Text, NonEmpty Item) -> m [Item]
+    allRetention (repo, dbs) = do
+      let policies = repoRetention config_retention repo
+      uniqBy (comparing itemRepo) . concat <$>
+        mapM (\pol ->
+          dbRetentionForRepo pol time isAvailableM dbs dbIndex) policies
+
+
+-- | The target set of DBs we want usable on the disk. This is a set of
+-- DBs that satisfies the policy.
+dbRetentionForRepo
+  :: Monad m
+  => ServerConfig.Retention
+  -> UTCTime
+  -> (Item -> m Bool)
+  -> NonEmpty Item
+  -> DbIndex
+  -> m [Item]
+dbRetentionForRepo ServerConfig.Retention{..} t isAvailableM dbs dbIndex = do
+  let
+    -- retention policy parameters
+    retainAtLeast' = fromIntegral $ fromMaybe 0 retention_retain_at_least
+    retainAtMost' = fmap fromIntegral retention_retain_at_most
+    -- enforce invariant: atLeast <= atMost
+    retainAtLeast = min retainAtLeast' (fromMaybe maxBound retainAtMost')
+    retainAtMost  = max retainAtLeast' <$> retainAtMost'
+    deleteIfOlder = fmap fromIntegral retention_delete_if_older
+    deleteIncompleteIfOlder =
+      fmap fromIntegral retention_delete_incomplete_if_older
+
+    f &&& g = \x -> f x && g x
+    f ||| g = \x -> f x || g x
+    f &&&> g = \x -> if not(f x) then return False else g x
+    f |||> g = \x -> if f x then return True else g x
+
+    ifSet (Just a) f = f a
+    ifSet Nothing _ = const False
+
+    -- predicates
+    isLocal Item{..} = itemLocality == Local
+    isComplete Item{..} =
+      completenessStatus itemMeta == DatabaseStatus_Complete
+    isOlderThan secs Item{..} = dbAge t itemMeta >= secs
+    isAvailable = isLocal |||> isAvailableM
+    hasDependencies = not . missingDependencies dbIndex
+
+    -- all DBs with the required/excluded properties, sorted by most recent first
+    sorted =
+      sortOn (Down . dbTime . itemMeta) $
+      filter (hasAllProperties retention_required_properties) $
+      filter (not . hasAnyProperties retention_excluded_properties) $
+      NonEmpty.toList dbs
+
+    -- whether to delete a DB according to the deletion policy
+    delete =
+      ifSet deleteIfOlder isOlderThan |||
+      (ifSet deleteIncompleteIfOlder $ \secs ->
+        (not . isComplete) &&& isOlderThan secs)
+
+    -- implements retain_at_least
+    atLeast =
+      take retainAtLeast $
+      filter (isComplete &&& hasDependencies) sorted
+
+  -- Ensure we have retain_at_least DBs available somewhere.  This
+  -- prevents us deleting an older DB before the newer one has been
+  -- restored. The isAvailable check ensures that we don't keep an old
+  -- DB on this server when the newer one is on another server.
+  atLeastAvailable <- takeFilterM
+    retainAtLeast
+    (isComplete &&& hasDependencies &&&> isAvailable)
+    -- bound the search since isAvailable is expensive
+    -- this matters only for tier bootstraps where all DBs are unavailable
+    (take (retainAtLeast*10) sorted)
+
+    -- delete DBs according to the deletion policy, and keep retain_at_most
+  let atMost = maybe id take retainAtMost (filter (not . delete) sorted)
+
+  return $ uniqBy (comparing itemRepo) $
+    atLeast ++ atLeastAvailable ++ atMost
+
+missingDependencies :: DbIndex -> Item -> Bool
+missingDependencies dbIndex item = any isNothing (dependencies dbIndex item)
+
+hasProperty :: Item -> (Text, Text) -> Bool
+hasProperty Item{..} (name,val) =
+  HashMap.lookup name (metaProperties itemMeta) == Just val
+
+hasAllProperties :: HashMap.HashMap Text Text -> Item -> Bool
+hasAllProperties req item = all (hasProperty item) (HashMap.toList req)
+
+hasAnyProperties :: HashMap.HashMap Text Text -> Item -> Bool
+hasAnyProperties exclude_props item =
+  any (hasProperty item) (HashMap.toList exclude_props)
+
+repoRetention
+  :: ServerConfig.DatabaseRetentionPolicy
+  -> Text
+  -> NonEmpty ServerConfig.Retention
+repoRetention ServerConfig.DatabaseRetentionPolicy{..} repoNm =
+  case NonEmpty.nonEmpty (old_retention <> new_retention) of
+    Nothing -> databaseRetentionPolicy_default_retention :| []
+    Just some -> some
+  where
+  old_retention =
+    maybeToList $
+      Map.lookup
+        repoNm
+        databaseRetentionPolicy_repos
+  new_retention =
+    Map.findWithDefault
+      []
+      repoNm
+      databaseRetentionPolicy_by_repo
+
+-- | Take the first n items that satisfy the predicate
+takeFilterM :: (Monad m) => Int -> (a -> m Bool) -> [a] -> m [a]
+takeFilterM n pred = loop [] n where
+  loop acc _ [] = return (reverse acc)
+  loop acc 0 _ = return (reverse acc)
+  loop acc n (x:xx) = do
+    accept <- pred x
+    if accept
+      then loop (x:acc) (n-1) xx
+      else loop acc n xx
diff --git a/glean/db/Glean/Database/Schema.hs b/glean/db/Glean/Database/Schema.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Schema.hs
@@ -0,0 +1,1256 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Schema
+  ( DbSchema(..)
+  , PredicateDetails(..)
+  , predicateRef
+  , TypeDetails(..)
+  , schemaSize, schemaPredicates
+  , fromStoredSchema, toStoredSchema
+  , newDbSchema
+  , newMergedDbSchema
+  , mkDbSchemaFromSource
+  , lookupPid
+  , compareSchemaPredicates
+  , validateNewSchema
+  , validateNewSchemaInstance
+  , DbContent
+  , readOnlyContent
+  , readWriteContent
+  , getSchemaInfo
+  , getSchemaInfoForSchema
+  , renderSchemaSource
+  , toStoredVersions
+  , derivationEdges
+  -- testing
+  , newDbSchemaForTesting
+  ) where
+
+import Control.Applicative ((<|>))
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import Control.Monad.Except
+import Control.Monad.State as State
+import Data.Bifoldable (bifoldMap)
+import Data.ByteString (ByteString)
+import Data.Foldable
+import Data.Graph
+import Data.Hashable
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashMap.Lazy as Lazy.HashMap
+import qualified Data.HashSet as HashSet
+import Data.HashSet (HashSet)
+import Data.List.Extra (firstJust, nubOrd, sort)
+import qualified Data.IntMap as IntMap
+import Data.IntMap (IntMap)
+import qualified Data.Map as Map
+import Data.Map (Map)
+import Data.Maybe
+import Data.Set (Set)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter
+import Compat.Prettyprinter.Render.Text
+import Data.Tuple (swap)
+import Safe (maximumMay)
+import TextShow
+
+import ServiceData.GlobalStats
+import ServiceData.Types as ODS
+import Util.Log.Text
+
+import Glean.RTS.Foreign.Inventory as Inventory
+import Glean.Database.Config
+import Glean.Database.Schema.Types
+import Glean.Display
+import Glean.Query.Transform
+  ( transformPattern
+  , transformFact
+  )
+import Glean.Internal.Types as Internal (StoredSchema(..))
+import Glean.RTS.Traverse
+import Glean.RTS.Typecheck
+import Glean.RTS.Types as RTS
+import Glean.Angle.Hash
+import Glean.Angle.Types as Schema
+import Glean.Schema.Evolve
+  ( validateEvolutions
+  , directSchemaEvolutions
+  , calcEvolutions
+  , visiblePredicates
+  , VisiblePredicates
+  , visibleDefined
+  , mapVisible
+  , canBeStored )
+import Glean.Schema.Util (showRef, ShowRef)
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Query.Codegen.Types (QueryWithInfo(..))
+import Glean.Query.Typecheck
+
+import Glean.Types as Thrift
+import Glean.Schema.Types
+import Glean.Database.Schema.ComputeIds
+import Glean.Query.Prune (pruneDerivations)
+import Glean.Query.Typecheck.Types (TcQuery)
+
+-- | Used to decide whether to activate 'derive default' definitions and
+-- 'evolves' directives.
+-- 'derive default' takes effect for a read-only DB when there are no
+-- facts of a predicate.
+-- 'evolves' directives take effect for a read-only DB when there are no facts
+-- of any predicate in a schema evolved by another schema.
+data DbContent
+  = DbWritable
+  | DbReadOnly (HashMap Pid PredicateStats)
+
+readOnlyContent :: HashMap Pid PredicateStats -> DbContent
+readOnlyContent = DbReadOnly
+
+readWriteContent :: DbContent
+readWriteContent = DbWritable
+
+
+schemaSize :: DbSchema -> Int
+schemaSize = HashMap.size . predicatesById
+
+schemaPredicates :: DbSchema -> [PredicateDetails]
+schemaPredicates = HashMap.elems . predicatesById
+
+
+fromStoredSchema
+  :: Maybe (MVar DbSchemaCache)
+  -> StoredSchema
+  -> DbContent
+  -> DebugFlags
+  -> IO DbSchema
+fromStoredSchema schemaCache info@StoredSchema{..} dbContent debug =
+  mkDbSchemaFromSource
+    schemaCache
+    (Just (storedSchemaPids info))
+    dbContent
+    debug
+    storedSchema_schema
+
+storedSchemaPids :: StoredSchema -> HashMap PredicateRef Pid
+storedSchemaPids StoredSchema{..} = HashMap.fromList
+  [ (ref, Pid pid) | (pid, ref) <- Map.toList storedSchema_predicateIds ]
+
+toStoredSchema :: DbSchema -> StoredSchema
+toStoredSchema DbSchema{ schemaSource = (source, ver, sourceId), ..} =
+  StoredSchema
+    { storedSchema_schema = renderSchemaSource source
+    , storedSchema_predicateIds = Map.fromList $
+        [ (fromPid $ predicatePid p, predicateRef p)
+        | p <- HashMap.elems predicatesById
+        , predicateInStoredSchema p
+        ]
+        -- Note: only the stored predicates. There can be multiple
+        -- predicates with the same PredicateRef (different Pid and
+        -- PredicateId), but only one of them is from the stored schema
+        -- and corresponds to the Pids of facts stored in the DB.
+    , storedSchema_versions = toStoredVersions ver sourceId
+    }
+
+newMergedDbSchema
+  :: Maybe (MVar DbSchemaCache)
+  -> StoredSchema  -- ^ schema from a DB
+  -> SchemaIndex  -- ^ current schema index
+  -> DbContent
+  -> DebugFlags
+  -> IO DbSchema
+newMergedDbSchema schemaCache storedSchema@StoredSchema{..}
+    index dbContent debug = do
+  let
+    -- If we have an identical schema in the index, then we can use
+    -- the cached ProcessedSchema. This saves a lot of time
+    -- re-processing the schema from the DB when we open it, and
+    -- should be a common case.
+    --
+    -- Schema equality is by comparing the SchemaIds. This is safe
+    -- since the only way a schema can be used is through a SchemaId,
+    -- and the SchemaId captures the content of all the definitions
+    -- that can be referenced by a query (those visible in the NameEnv).
+    identicalSchemas =
+      [ proc
+      | proc <- schemaIndexCurrent index : schemaIndexOlder index
+      , let HashedSchema{..} = procSchemaHashed proc
+      , IntMap.toList (fromStoredVersions storedSchema_versions) ==
+          [(fromIntegral hashedSchemaAllVersion, hashedSchemaId)]
+      ]
+
+    processStoredSchema =
+      case processSchema Nothing storedSchema_schema of
+        Left msg -> throwIO $ ErrorCall msg
+        Right resolved -> return resolved
+
+  fromDB <-
+    if Map.null storedSchema_versions
+      then processStoredSchema
+      else case identicalSchemas of
+        (one : _) -> return one
+        [] -> processStoredSchema
+
+  -- For the "source", we'll use the current schema source. It doesn't
+  -- reflect what's in the DB, but it reflects what you can query for.
+  mkDbSchema HashMap.toList schemaCache (Just (storedSchemaPids storedSchema))
+    dbContent fromDB (Just index) debug
+
+-- | Build a DbSchema from parsed/resolved Schemas. Note that we still need
+-- the original source for the schema for 'toStoredSchema' (otherwise we would
+-- need to pretty-print the resolved Schemas back into source.
+newDbSchema
+  :: Maybe (MVar DbSchemaCache)
+  -> SchemaIndex
+  -> SchemaSelector
+  -> DbContent
+  -> DebugFlags
+  -> IO DbSchema
+newDbSchema = newDbSchemaForTesting HashMap.toList
+
+-- | Testing version of 'newDbSchema' that accepts a custom @HashMap.toList@
+--   function to weed out ordering assumptions
+newDbSchemaForTesting
+  :: (forall k v . HashMap k v -> [(k,v)])
+  -> Maybe (MVar DbSchemaCache)
+  -> SchemaIndex
+  -> SchemaSelector
+  -> DbContent
+  -> DebugFlags
+  -> IO DbSchema
+newDbSchemaForTesting toList schemaCache index selector dbContent debug = do
+  schema <- case selector of
+    SpecificSchemaId id -> case schemaForSchemaId index id of
+      Nothing -> throwIO $ ErrorCall $ "schema " <> show id <> " not found"
+      Just schema -> return schema
+    _otherwise ->
+      return (schemaIndexCurrent index)
+  mkDbSchema toList schemaCache Nothing dbContent schema Nothing debug
+
+inventory :: [PredicateDetails] -> Inventory
+inventory ps = Inventory.new
+  [ Inventory.CompiledPredicate
+      { compiledPid = predicatePid
+      , compiledRef = predicateRef d
+      , compiledTypecheck = predicateTypecheck
+      , compiledTraversal = predicateTraversal
+      }
+    | d@PredicateDetails{..} <- ps ]
+
+-- |
+-- Make a DbSchema for an existing database, using the predicates
+-- stored in the database.  Anything in the 'Schemas' but not
+-- in the database is dropped from the 'DbSchema'
+mkDbSchemaFromSource
+  :: Maybe (MVar DbSchemaCache)
+  -> Maybe (HashMap PredicateRef Pid)
+  -> DbContent
+  -> DebugFlags
+  -> ByteString
+  -> IO DbSchema
+mkDbSchemaFromSource schemaCache knownPids dbContent debug source = do
+  case processSchema Nothing source of
+    Left str -> throwIO $ ErrorCall str
+    Right (ProcessedSchema source resolved hashed) ->
+      mkDbSchema HashMap.toList schemaCache knownPids dbContent
+        (ProcessedSchema source resolved hashed)
+        Nothing debug
+
+dbSchemaKey
+   :: HashMap PredicateRef Pid
+   -> ProcessedSchema
+   -> Maybe SchemaIndex
+   -> DbSchemaCacheKey
+dbSchemaKey pidMap stored maybeIndex = DbSchemaCacheKey $
+  hashBinary
+    ( [ (showRef ref, pid) | (ref, Pid pid) <- HashMap.toList pidMap ]
+    , versions (procSchemaHashed stored)
+    , flip (maybe []) maybeIndex $ \SchemaIndex{..} ->
+        map (versions . procSchemaHashed)
+          (schemaIndexCurrent : schemaIndexOlder)
+    )
+  where
+  versions HashedSchema{..} =
+    (hashedSchemaAllVersion, unSchemaId hashedSchemaId)
+
+{- |
+   Caching DbSchema
+
+   DbSchema is quite expensive to build:
+    - we have to typecheck all the derived predicates
+    - we have to build RTS.Types for types and predicates
+    - we have to compile byte-code for typechecking and traversing facts
+
+   So we'd like to cache these to avoid repeating the work and to
+   share as much as possible between open DBs.
+
+   The DbSchema depends on
+    - the schema in the DB and the Pids we assigned to predicates
+    - the SchemaIndex
+    - the content of the DB (which predicates have facts)
+
+   Schemas don't change all that much, so the first two will often be
+   the same (or at least, there will be a few combinations in use at
+   any given time). For a given schema, the Pids we assign should be
+   deterministic.
+
+   The dependency on the DB contents looks problematic. However, most
+   of the work of building the DbSchema does *not* depend on the
+   contents, only transformations and pruning derived predicates use
+   that. So we can cache the plain DbSchema before DbContent is taken
+   into account, and then apply the DbContent changes for each DB.
+-}
+
+withDbSchemaCache
+  :: Maybe (MVar DbSchemaCache)
+  -> Maybe (HashMap PredicateRef Pid)
+  -> ProcessedSchema
+  -> Maybe SchemaIndex
+  -> IO DbSchema
+  -> IO DbSchema
+withDbSchemaCache maybeCache maybePids stored maybeIndex mk =
+  case (maybeCache, maybePids) of
+    (Just cacheVar, Just pidMap) -> do
+      -- only use the cache when we have stored Pids
+      cache <- readMVar cacheVar
+      let key = dbSchemaKey pidMap stored maybeIndex
+      case HashMap.lookup key cache of
+        Just schema -> do
+          addStatValueType "glean.db.schema.cache.hit" 1 ODS.Sum
+          vlog 2 $ "DbSchema cache hit, stored SchemaId: " <>
+            unSchemaId (hashedSchemaId (procSchemaHashed stored))
+          return schema
+        Nothing -> do
+          addStatValueType "glean.db.schema.cache.miss" 1 ODS.Sum
+          schema <- mk
+          modifyMVar_ cacheVar $ return . HashMap.insert key schema
+          return schema
+    _otherwise -> do
+      addStatValueType "glean.db.schema.cache.fail" 1 ODS.Sum
+      mk
+
+mkDbSchema
+  :: (forall k v . HashMap k v -> [(k,v)])
+  -> Maybe (MVar DbSchemaCache)
+  -> Maybe (HashMap PredicateRef Pid)
+  -> DbContent
+  -> ProcessedSchema
+  -> Maybe SchemaIndex
+  -> DebugFlags
+  -> IO DbSchema
+mkDbSchema toList cacheVar knownPids dbContent
+    procStored@(ProcessedSchema source _ stored) index debug = do
+
+  -- either fetch a cached DbSchema or build a new one
+  schema <-
+    withDbSchemaCache cacheVar knownPids procStored index
+      buildDbSchema
+
+  -- the cached DbSchema cannot depend on the DbContent, so next we add in
+  -- any changes to DbSchema that need to depend on DbContent.
+  transformations <- failOnLeft $ mkTransformations
+    dbContent
+    (predicatesById schema)
+    procStored
+    addedSchemas
+
+  let
+      -- to avoid the need to have different prunings for each schemaId
+      -- we pass the union of all transformations to the 'prune' function
+      -- such that if a predicate can be mapped to something in the db
+      -- for any schemaId, then it is kept in the derivation query.
+     byId =
+       enableSelectiveDerivations dbContent <$>
+         prune dbContent allTrans (predicatesById schema)
+
+     intPid = fromIntegral . fromPid . predicatePid
+     byPid = IntMap.fromList [ (intPid p, p) | p <- HashMap.elems byId ]
+
+     allTrans = fold $ HashMap.elems transformations
+
+  return $ schema {
+    predicatesById = byId,
+    predicatesByPid = byPid,
+    predicatesTransformations =
+      mkQueryTransformations byPid <$> transformations
+  }
+
+  where
+  addedSchemas = case index of
+    Nothing -> []
+    Just SchemaIndex{..} -> schemaIndexCurrent : schemaIndexOlder
+
+  buildDbSchema = do
+    let
+      -- Assign Pids to predicates.
+      --  - predicates in the stored schema get Pids from the StoredSchema
+      --    (unless this is a new DB, in which case we'll assign fresh Pids)
+      --  - predicates in the merged schema get new fresh Pids.
+      --
+      -- Sort the predicates in order to ensure a deterministic result since
+      -- 'toList' does not give us any ordering guarantees
+      storedPids = case knownPids of
+        Nothing ->
+          zip (sort $ fst <$> toList (hashedPreds stored)) [lowestPid..]
+        Just pidMap ->
+          assign first (sort $ fst <$> toList (hashedPreds stored))
+          where
+          first = maybe lowestPid succ $ maximumMay (snd <$> toList pidMap)
+          assign _next [] = []
+          assign next (id : ids) =
+            case HashMap.lookup (predicateIdRef id) pidMap of
+              Nothing -> (id, next) : assign (succ next) ids
+              Just pid -> (id, pid) : assign next ids
+
+      nextPid = maybe lowestPid succ $ maximumMay (map snd storedPids)
+
+      addedPreds =
+        HashMap.unions $ map (hashedPreds . procSchemaHashed) addedSchemas
+
+      addedPids = zip ids [nextPid ..]
+        where
+        ids = filter (not . isStoredPred) (HashMap.keys addedPreds)
+        isStoredPred id = HashMap.member id (hashedPreds stored)
+
+      idToPid = HashMap.fromList (storedPids ++ addedPids)
+
+    let
+      typecheck env (stored, ProcessedSchema _ resolved hashed) =
+        typecheckSchema idToPid stored tcOpts hashed env
+        where
+        tcOpts = defaultTcOpts debug angleVersion
+        angleVersion =  maybe latestAngleVersion resolvedSchemaAngleVersion
+          (listToMaybe (schemasResolved resolved))
+
+    -- typecheck all the schemas, producing PredicateDetails / TypeDetails
+    tcEnv <- foldM typecheck emptyTcEnv
+      ((True, procStored) : map (False,) addedSchemas)
+
+    -- Check the invariant that stored predicates do not make use of
+    -- negation or refer to derived predicates that make use of it.
+    -- See Note [Negation in stored predicates]
+    let
+      usingNegation = usesOfNegation (tcEnvPredicates tcEnv)
+      isStored = \case
+        NoDeriving -> True
+        Derive when _ -> case when of
+          DeriveOnDemand -> False
+          DerivedAndStored -> True
+          DeriveIfEmpty -> True
+      useOfNegation ref = HashMap.lookup ref usingNegation
+
+    forM_ (tcEnvPredicates tcEnv) $ \d@PredicateDetails{..} ->
+      when (isStored predicateDeriving) $
+        case useOfNegation predicateId of
+          Nothing -> return ()
+          Just use ->
+            let feature = case use of
+                  PatternNegation -> "negation"
+                  IfStatement -> "if-statements"
+            in
+            throwIO $ Thrift.Exception
+            $ "use of " <> feature  <> " is not allowed in a stored predicate: "
+            <> showRef (predicateRef d)
+
+    let
+        predicates = snd <$> toList (tcEnvPredicates tcEnv)
+
+        intPid = fromIntegral . fromPid . predicatePid
+
+        byPid = IntMap.fromList [ (intPid deets, deets) | deets <- predicates ]
+
+        maxPid = maybe lowestPid (Pid . fromIntegral . fst)
+          (IntMap.lookupMax byPid)
+
+        schemaEnvMap =
+          Map.fromList
+            [ (hashedSchemaId h, hashedSchemaEnv h)
+            | h <- map procSchemaHashed (procStored : addedSchemas) ]
+
+        latestSchema = procSchemaHashed $
+          case index of
+            Just SchemaIndex{..} -> schemaIndexCurrent
+            Nothing -> procStored
+
+        dbSchemaId = hashedSchemaId stored
+        dbSchemaAllVersion = hashedSchemaAllVersion stored
+
+        predicatesById = tcEnvPredicates tcEnv
+        derivationDepends = HashMap.fromListWith (++)
+          [ (p, pp) | (_, p, pp) <- derivationEdges predicatesById]
+
+    vlog 2 $ "DB schema " <> unSchemaId dbSchemaId <> " has " <>
+      showt (HashMap.size (hashedTypes stored)) <> " types/" <>
+      showt (HashMap.size (hashedPreds stored)) <>
+      " predicates, global schema has " <>
+      showt (sum (map (HashMap.size . hashedTypes . procSchemaHashed)
+        addedSchemas)) <> " types/" <>
+      showt (sum (map (HashMap.size . hashedPreds . procSchemaHashed)
+        addedSchemas)) <>
+      " predicates, final schema has " <>
+      showt (HashMap.size (tcEnvTypes tcEnv)) <> " types/" <>
+      showt (HashMap.size (tcEnvPredicates tcEnv)) <> " predicates."
+
+    vlog 2 $ "all." <> showt (hashedSchemaAllVersion latestSchema)  <>
+      " = " <> unSchemaId (hashedSchemaId latestSchema)
+
+    return $ DbSchema
+      { predicatesById = predicatesById
+      , typesById = tcEnvTypes tcEnv
+      , schemaEnvs = schemaEnvMap
+      , predicatesByPid = byPid
+      , predicatesTransformations = HashMap.empty
+      , schemaInventory = inventory predicates
+      , schemaSource = (source, dbSchemaAllVersion, dbSchemaId)
+      , schemaMaxPid = maxPid
+      , schemaAllVersion = hashedSchemaAllVersion latestSchema
+      , schemaId = hashedSchemaId latestSchema
+      , derivationDepends = derivationDepends
+      }
+
+mkTransformations
+  :: DbContent
+  -> HashMap PredicateId PredicateDetails
+  -> ProcessedSchema   -- ^ stored schema
+  -> [ProcessedSchema] -- ^ other schemas
+  -> Either Text (HashMap SchemaId (IntMap PredicateTransformation))
+mkTransformations content byId stored otherSchemas =
+  case content of
+    DbWritable -> Right $ HashMap.fromList
+      [ (schemaId, mempty)
+      | schema <- processed
+      , schemaId <- versionsOfAll schema
+      ]
+    DbReadOnly stats -> do
+      evolutions :: [HashMap PredicateId PredicateId] <-
+        forM processed $ \schema -> mkEvolutions stats byId [stored, schema]
+
+      let allPredicateTrans :: HashMap (PredicateId, PredicateId) PredicateTransformation
+          allPredicateTrans = HashMap.fromList
+            [ (pair, trans)
+            | pair@(old, new) <- nubOrd $ concatMap HashMap.toList evolutions
+            , Just trans <- [mkPredicateTransformation detailsById old new]
+            ]
+
+          transformations :: [IntMap PredicateTransformation]
+          transformations =
+            [ IntMap.fromList
+                [ (intPid, trans)
+                | pair@(old, _) <- HashMap.toList e
+                , Just trans <- [HashMap.lookup pair allPredicateTrans]
+                , let intPid = fromIntegral
+                        $ fromPid
+                        $ predicatePid
+                        $ detailsById old
+                ]
+            | e <- evolutions
+            ]
+
+      -- Transformations are per ProcessedSchema. Here we find the
+      -- transformations applicable to the union of the stored and a foreign
+      -- ProcessedSchema and then we associate them with all 'all' schemas of
+      -- the foreign ProcessedSchema.
+      return $ HashMap.fromList
+        [ (schemaId, trans)
+        | (schema, trans) <- zip processed transformations
+        , schemaId <- versionsOfAll schema
+        ]
+  where
+  processed :: [ProcessedSchema]
+  processed = stored : otherSchemas
+
+  versionsOfAll :: ProcessedSchema -> [SchemaId]
+  versionsOfAll s = [hashedSchemaId (procSchemaHashed s)]
+
+  detailsById id = HashMap.lookupDefault err id byId
+    where err = error $ "mkEvolutions: " <> show (displayDefault id)
+
+
+-- Calculate predicate evolutions for a set of ProcessedSchema
+mkEvolutions
+  :: HashMap Pid PredicateStats
+  -> HashMap PredicateId PredicateDetails
+  -> [ProcessedSchema]
+  -> Either Text (HashMap PredicateId PredicateId)
+mkEvolutions stats byId schemas = do
+  manual <- calcSchemaEvolutions hasFacts bySchemaRef <$> directEvolutions schemas
+  auto <- calcAutoEvolutions hasFacts byPredRef
+  evolutions <- calcEvolutions predicateIdRef byPredRef bySchemaRef manual auto
+  validateEvolutions (Just hasFacts) types preds evolutions
+  return evolutions
+  where
+  (types, preds) = definitions schemas
+
+  hasFacts id = fromMaybe False $ do
+    details <- HashMap.lookup id byId
+    let pid = predicatePid details
+    pstats <- HashMap.lookup pid stats
+    return $ predicateStats_count pstats > 0
+
+  byPredRef :: Map PredicateRef [PredicateId]
+  byPredRef = predicatesByRef schemas
+
+  bySchemaRef :: Map SchemaRef (VisiblePredicates PredicateId)
+  bySchemaRef = predicatesBySchemaRef schemas
+
+-- | Predicates (which can be evolved) by predicate ref
+predicatesByRef :: [ProcessedSchema] -> Map PredicateRef [PredicateId]
+predicatesByRef schemas =
+  Set.toList <$>
+  Map.fromListWith (<>)
+  [ (predicateIdRef pred, Set.singleton pred)
+  | processed <- schemas
+  , (pred, def) <- HashMap.toList $ hashedPreds $ procSchemaHashed processed
+  , canBeStored (predicateDefDeriving def)
+  ]
+
+predicatesBySchemaRef
+  :: [ProcessedSchema]
+  -> Map SchemaRef (VisiblePredicates PredicateId)
+predicatesBySchemaRef schemas =
+  Map.fromListWith (<>)
+  [ ( schemaRef resolved, visible)
+  | processed <- schemas
+  , let env = predRefToId $ schemaRefToIdEnv $ procSchemaHashed processed
+        refToId ref =
+          HashMap.lookupDefault (error "predicatesBySchemaRef") ref env
+  , resolved <- schemasResolved $ procSchemaResolved processed
+  , let visible = mapVisible refToId (visiblePredicates resolved)
+  ]
+
+-- | Evolves relationships as per source code annotations.
+--
+-- We only consider evolution annotations in the current schema. This is so
+-- that we don't need to wait until schemas are garbage-collected to be able to
+-- remove an evolves relationship.
+directEvolutions :: [ProcessedSchema] -> Either Text (Map SchemaRef SchemaRef)
+directEvolutions schemas = directSchemaEvolutions $
+  concatMap (schemasResolved . procSchemaResolved) schemas
+
+-- | Calculate predicate evolutions caused by version-less schema migrations.
+calcAutoEvolutions
+  :: (PredicateId -> Bool)
+  -> Map PredicateRef [PredicateId] -- ^ all SchemaIndex predicates
+  -> Either Text (Map PredicateRef PredicateId)
+calcAutoEvolutions hasFacts byRef =
+  Map.traverseMaybeWithKey choose byRef
+  where
+  -- from a list of predicates with the same PredicateRef,
+  -- choose the one that has facts in the DB.
+  choose :: PredicateRef -> [PredicateId] -> Either Text (Maybe PredicateId)
+  choose ref xs =
+    case filter hasFacts xs of
+      []  -> Right Nothing
+      [y] -> Right (Just y)
+      ys  -> Left $ Text.unwords
+        [ "db has facts for multiple instances of", showRef ref, ":"
+        , Text.unwords (showRef <$> ys)
+        ]
+
+-- | Calculate which schema should effectively evolve which by taking the DB's
+-- content into account.
+--
+-- If A.3 evolves A.2 which evolves A.1, but we only have facts for predicates
+-- from A.3, then we end-up with both A.1 and A.2 being directly evolved by
+-- A.3.
+calcSchemaEvolutions
+  :: (PredicateId -> Bool)
+  -> Map SchemaRef (VisiblePredicates PredicateId)
+  -> Map SchemaRef SchemaRef
+  -> Map SchemaRef SchemaRef -- ^ value evolves key
+calcSchemaEvolutions hasFacts bySchemaRef direct =
+  Map.fromList
+    [ (ref, target)
+    | ref <- Map.keys bySchemaRef
+    , Just target <- [transformationTarget ref]
+    ]
+  where
+    -- map each schema to the schema its queries should be transformed into
+    transformationTarget :: SchemaRef -> Maybe SchemaRef
+    transformationTarget src
+      | hasFactsInDb src = Nothing
+        -- Pick closest related schema with facts in the db.
+        -- If a schema has only derived facts there is no need to
+        -- transform it since the original version will still work.
+      | otherwise =
+          find hasFactsInDb newerSchemas <|>
+          find hasFactsInDb olderSchemas
+          where
+            -- if we have 'b evolves a' and 'c evolves b'
+            -- given 'a' produces [b, c]
+            newerSchemas = close (`Map.lookup` direct) src
+            -- given 'c' produces [b, a]
+            olderSchemas = close (`Map.lookup` reverseDirect) src
+
+    reverseDirect :: Map SchemaRef SchemaRef
+    reverseDirect =
+      Map.fromList $ map swap $ Map.toList direct
+
+    hasFactsInDb :: SchemaRef -> Bool
+    hasFactsInDb sref = sref `Set.member` withFacts
+
+    withFacts :: Set SchemaRef
+    withFacts = Map.keysSet $
+      Map.filter (any hasFacts . visibleDefined) bySchemaRef
+
+close :: (a -> Maybe a) -> a -> [a]
+close next x = case next x of
+  Just y -> y : close next y
+  Nothing -> []
+
+-- | Optimise derivation queries for fetching facts given the particular db's
+-- content.
+prune
+  :: DbContent
+  -> IntMap PredicateTransformation
+  -> HashMap PredicateId PredicateDetails
+  -> HashMap PredicateId PredicateDetails
+prune DbWritable _ pmap = pmap
+  -- don't change derivations while db is still writable
+prune (DbReadOnly stats) transformations pmap = pruneDerivations hasFacts pmap
+  where
+    -- A predicate has facts in the db if it or the predicate it would be
+    -- transformed into has facts in the db.
+    hasFacts predId = fromMaybe False $ do
+      details <- HashMap.lookup predId pmap
+      let pid = predicatePid details
+          availablePid = fromMaybe pid $ transformationFor pid
+      pstats <- HashMap.lookup availablePid stats
+      return $ predicateStats_count pstats > 0
+
+    transformationFor :: Pid -> Maybe Pid
+    transformationFor pid = do
+      trans <- IntMap.lookup (fromIntegral $ fromPid pid) transformations
+      PidRef pid _ <- return $ tAvailable trans
+      return pid
+
+-- | Compare schemas for compatibility. That is, if schema A defines a
+-- predicate or type P, then schema B must have an identical
+-- definition of P.
+--
+-- This is used to determine whether we can safely use schema B for a
+-- stacked DB when the base DB is using schema A. It's useful to be
+-- able to do this, because we might want to add a new derived
+-- predicate to B for testing purposes, but it's only safe if we
+-- didn't change any predicates defined by A, because those will be
+-- mapped to the same Pids in the stacked DB.
+--
+compareSchemaPredicates :: [PredicateId] -> [PredicateId] -> [Text]
+compareSchemaPredicates predsA predsB = errors
+  where
+  (errors, _) = flip execState ([], HashMap.empty) $
+    forM_ (predsA ++ predsB) $ \id -> do
+      (errs, pids) <- State.get
+      let (err, pids') = compareInsert "predicate" (predicateIdRef id) id pids
+      State.put (err <> errs, pids')
+
+compareInsert
+  :: (Hashable a, Eq a, Eq b, ShowRef a)
+  => Text
+  -> a
+  -> b
+  -> HashMap a b
+  -> ([Text], HashMap a b)
+compareInsert thing ref id tids
+  | Just id' <- HashMap.lookup ref tids =
+    if id == id'
+      then ([], tids)
+      else ([thing <> " " <> showRef ref <> " has changed"], tids)
+  | otherwise = ([], HashMap.insert ref id tids)
+
+mkPredicateTransformation
+  :: Eq id
+  => (id -> PredicateDetails)
+  -> id
+  -> id
+  -> Maybe PredicateTransformation
+mkPredicateTransformation detailsFor requestedId availableId
+  | requestedId == availableId = Nothing
+  | otherwise = Just PredicateTransformation
+    { tRequested = pidRef requested
+    , tAvailable = pidRef available
+    , tTransformFactBack = transformFact available requested
+    , transformKeyPattern   = transformPattern (key requested) (key available)
+    , transformValuePattern = transformPattern (val requested) (val available)
+    }
+  where
+      key = predicateKeyType
+      val = predicateValueType
+      available = detailsFor availableId
+      requested = detailsFor requestedId
+
+{- Note [Negation in stored predicates]
+
+Facts derived based on the absence of other facts could be invalidated when new
+facts are added to an incremental database.
+
+The work required to identify which fact to invalidate is close to that of
+re-deriving those predicates all over again.
+
+To keep the overhead on incremental databases as low as possible, stored
+derived predicates are not allowed to use negation.
+-}
+
+typecheckSchema
+  :: HashMap PredicateId Pid
+  -> Bool -- ^ stored?
+  -> TcOpts
+  -> HashedSchema
+  -> TcEnv
+  -> IO TcEnv
+
+typecheckSchema idToPid stored tcOpts HashedSchema{..} tcEnv = do
+  let
+    -- NOTE: We store Maybe Type rather than filtering out those typedefs
+    -- for which rtsType returns Nothing here because we need to be sufficiently
+    -- lazy to tie the knot in rtsType. We get Nothing for typedefs which refer
+    -- to predicates that are not in the database but do exist in the 'Schemas'
+    -- (cf. 'mkDbSchema') or, more specifically, in `refToPid`, and then also
+    -- for typedefs which refer to those typedefs and so on.
+    --
+    -- Also note we need a lazy HashMap here to avoid forcing the
+    -- elements too early, which would also cause a loop.
+    typedefs :: Lazy.HashMap.HashMap TypeId (Maybe RTS.Type)
+    typedefs = Lazy.HashMap.fromList
+      [ (id, rtsType (Schema.rmLocType $ typeDefType def))
+      | (id, def) <- HashMap.toList hashedTypes ]
+
+    lookupType :: TypeId -> Maybe RTS.Type
+    lookupType ref =
+      case Lazy.HashMap.lookup ref typedefs of
+        Nothing -> Nothing
+        Just r -> r
+
+    rtsType = mkRtsType lookupType (`HashMap.lookup` idToPid)
+
+  let
+    -- If we have already seen this predicate, no need to
+    -- typecheck it again.
+    new = HashMap.difference hashedPreds (tcEnvPredicates tcEnv)
+    new' = HashMap.map rmTypeLocPredDef new
+    mkPredicateDetails (id,def) =
+        case
+          ( HashMap.lookup (predicateDefRef def) idToPid
+          , rtsType $ predicateDefKeyType def
+          , rtsType $ predicateDefValueType def ) of
+        (Just pid, Just keyType, Just valueType) -> do
+          typecheck <- checkSignature keyType valueType
+          traversal <- genTraversal keyType valueType
+          return $ Just PredicateDetails
+                { predicatePid = pid
+                , predicateId = id
+                , predicateSchema = def
+                , predicateKeyType = keyType
+                , predicateValueType = valueType
+                , predicateTraversal = traversal
+                , predicateTypecheck = typecheck
+                , predicateDeriving = NoDeriving
+                , predicateInStoredSchema = stored
+                }
+        _ -> return Nothing
+
+  newDetails <- catMaybes <$> mapM mkPredicateDetails (HashMap.toList new')
+
+  let
+    types = HashMap.fromList
+      [ (id, TypeDetails id ty)
+      | (id, Just ty) <- HashMap.toList typedefs ]
+
+    insertPred details m = HashMap.insert (predicateId details) details m
+
+    -- Build the environment in which we typecheck predicates from
+    -- this schema.
+    env = TcEnv
+      { tcEnvPredicates = foldr insertPred (tcEnvPredicates tcEnv) newDetails
+      , tcEnvTypes = HashMap.union types (tcEnvTypes tcEnv)
+      }
+
+    -- Typecheck the derivation for a predicate
+    tcDeriving details = do
+      drv <- do
+        r <- runExceptT $
+          typecheckDeriving env tcOpts rtsType details
+            (predicateDefDeriving (predicateSchema details))
+        either (throwIO . ErrorCall . Text.unpack) return r
+      return details { predicateDeriving = drv }
+
+  -- typecheck the derivations for newly added predicates
+  finalDetails <- mapM tcDeriving newDetails
+  let finalPreds = foldr insertPred (tcEnvPredicates tcEnv) finalDetails
+
+  -- Check the invariant that stored predicates do not refer to derived
+  -- predicates. We have to defer this check until last, because
+  -- derivations may have been attached to existing predicates now.
+  forM_ finalDetails $ \PredicateDetails{..} -> do
+    let
+      check = do
+        checkStoredType finalPreds types predicateId predicateKeyType
+        checkStoredType finalPreds types predicateId predicateValueType
+    case predicateDeriving of
+      NoDeriving -> return ()
+         -- In principle we should really enforce that predicates without
+         -- a derivation don't refer to non-stored derived predicates.
+         -- However, this can crop up in benign ways with backwards
+         -- compatibility. For example,
+         --
+         -- schema S.2 : S.1 {
+         --   predicate P : T default P.1 ...
+         --   predicate Q : P
+         -- }
+         --
+         -- if we have no facts of P.2 then the derivation would be
+         -- enabled, and Q doesn't make sense. But there won't be any
+         -- facts of Q either, so it doesn't matter.
+      Derive DerivedAndStored _ -> check
+      _ -> return ()
+
+  return env { tcEnvPredicates = finalPreds }
+
+
+-- | Enable or disable a DeriveIfEmpty derivation based on the DB
+-- contents.
+enableSelectiveDerivations :: DbContent -> PredicateDetails -> PredicateDetails
+enableSelectiveDerivations dbContent details =
+  let
+    disable = details { predicateDeriving = NoDeriving }
+  in
+  if
+    | Derive DeriveIfEmpty _ <- predicateDeriving details ->
+      case dbContent of
+        DbWritable -> disable
+        DbReadOnly stats -> do
+          case HashMap.lookup (predicatePid details) stats of
+            Nothing -> details
+            Just stats
+              | predicateStats_count stats == 0 -> details
+              | otherwise -> disable
+    | otherwise -> details
+
+
+usesOfNegation
+  :: HashMap PredicateId PredicateDetails
+  -> HashMap PredicateId UseOfNegation
+usesOfNegation preds =
+  foldl' recordUseOfNegation mempty derivations
+  where
+    recordUseOfNegation usesNegation (mUseOfNeg, ref, deps)
+      | Just use <- mUseOfNeg
+      = HashMap.insert ref use usesNegation
+      | Just use <- firstJust (`HashMap.lookup` usesNegation) deps
+      = HashMap.insert ref use usesNegation
+      | otherwise
+      -- remove from Map in case a derived predicate in this schema that does
+      -- not use negation overrode a derived predicate that used negation.
+      = HashMap.delete ref usesNegation
+
+    -- derivations in dependency order with flag for use of negation
+    derivations :: [(Maybe UseOfNegation, PredicateId, [PredicateId])]
+    derivations = toPred . getNode <$> reverse (topSort graph)
+    (graph, getNode, _) = graphFromEdges $ derivationEdges preds
+    toPred (b, k, ks) = (tcQueryUsesNegation b, k, ks)
+
+derivationEdges
+  :: HashMap PredicateId PredicateDetails
+  -> [(TcQuery, PredicateId, [PredicateId])]
+derivationEdges preds =
+  [ (query, ref, Set.toList (tcQueryDeps query))
+  | (ref, details) <- HashMap.toList preds
+  , Derive _ (QueryWithInfo query _ _ _)  <- [predicateDeriving details]
+  ]
+
+-- | Check that the type of a stored predicate doesn't refer to any
+-- derived predicates.
+checkStoredType
+  :: HashMap PredicateId PredicateDetails
+  -> HashMap TypeId TypeDetails
+  -> PredicateId
+  -> RTS.Type
+  -> IO ()
+checkStoredType preds types def ty = go ty
+  where
+  go (ArrayTy ty) = go ty
+  go (MaybeTy ty) = go ty
+  go (RecordTy fields) = forM_ fields $ \(FieldDef _ ty) -> go ty
+  go (SumTy fields) = forM_ fields $ \(FieldDef _ ty) -> go ty
+  go (PredicateTy _ (PidRef _ ref)) = case HashMap.lookup ref preds of
+    Just PredicateDetails{..} -> case predicateDeriving of
+      Derive DerivedAndStored _ -> return ()
+      Derive _ _ -> throwIO $ ErrorCall $ show $
+         "stored predicate " <> displayDefault def <>
+         " refers to non-stored derived predicate " <> displayDefault ref
+      _ -> return ()
+    Nothing -> error $ "checkStoredType: " <> Text.unpack (showRef ref)
+  go (NamedTy _ (ExpandedType ref _)) = case HashMap.lookup ref types of
+    Just TypeDetails{..} -> go typeType
+    Nothing -> error $ "checkStoredType: " <> Text.unpack (showRef ref)
+  go _ = return ()
+
+
+-- | Check that a new schema can be processed and merged with the
+-- current schema index. This is used to ensure that a running server
+-- will not choke on a new schema before we deploy it.
+validateNewSchema
+  :: ServerConfig.Config
+  -> ByteString
+  -> SchemaIndex
+  -> DebugFlags
+  -> IO ()
+validateNewSchema _config newSrc current debug = do
+  schema <- case processSchema Nothing newSrc of
+    Left msg -> throwIO $ Thrift.Exception $ Text.pack msg
+    Right resolved -> return resolved
+  let
+  curDbSchema <-
+    mkDbSchema HashMap.toList Nothing Nothing readWriteContent schema Nothing
+      debug
+  void $ newMergedDbSchema
+    Nothing
+    (toStoredSchema curDbSchema)
+    current
+    readWriteContent
+    debug
+
+failOnLeft :: Either Text a -> IO a
+failOnLeft = \case
+  Right x -> return x
+  Left err -> throwIO $ ErrorCall $ Text.unpack err
+
+-- | Check that the current schema in the SchemaIndex is compatible
+-- with each of the older schema instances. This is the validity check
+-- when adding a new schema instance.
+validateNewSchemaInstance :: SchemaIndex -> IO ()
+validateNewSchemaInstance (SchemaIndex curr older) = failOnLeft $ do
+  -- Prevent recursive predicates. Because this is a constraint we will remove
+  -- in the future, for now we only check this when a new schema instance is to
+  -- be generated.
+  mapM_ checkRecursiveDefinitions (schemasResolved $ procSchemaResolved curr)
+
+  let auto = Map.mapMaybe listToMaybe $ predicatesByRef [curr]
+
+  direct <- directEvolutions schemas
+  evolutions <- calcEvolutions
+    predicateIdRef
+    (predicatesByRef schemas)
+    (predicatesBySchemaRef schemas)
+    direct
+    auto
+
+  if performExhaustiveCheck
+    then validateEvolutions Nothing types preds (transitive evolutions)
+    else validateEvolutions Nothing types preds evolutions
+  where
+  schemas = curr : older
+  (types, preds) = definitions schemas
+
+  -- I P evolves Q and Q evolves R, we expect that `P evolves R` to work. If Q
+  -- removes a field from R and P adds it again with a different type then `P
+  -- evolves R` will not hold.
+  --
+  -- This flag controls whether we should check for compatibility with all
+  -- transitively evolved predicates. For now we don't have an efficient way to
+  -- perform the check. This is O(n^2), and therefore off by default.
+  performExhaustiveCheck = False
+
+  -- add transitive relations explicitly to the map
+  --    HashMap.fromList [(1,2),(2,3)]
+  -- becomes
+  --    HashMap.fromList [(1,2),(2,3),(1,3)]
+  transitive :: (Hashable a, Eq a) => HashMap a a -> HashMap a a
+  transitive m = HashMap.fromList
+    [ (key, val)
+    | key <- HashMap.keys m
+    , val <- close (`HashMap.lookup` m) key
+    ]
+
+-- | Detect recursion and co-recursion in predicate derivations.
+-- We don't check default derived predicates because whether they will in fact
+-- recurse or not depends on the db's content.
+checkRecursiveDefinitions :: ResolvedSchemaRef -> Either Text ()
+checkRecursiveDefinitions resolved =
+  unless (null recursiveDefinitions) $
+  Left $ Text.unlines $
+    "found cycles in predicate derivations: " :
+    [ Text.intercalate " -> " $ map showRef (x:xs ++ [x])
+    | x:xs <- recursiveDefinitions
+    ]
+  where
+    recursiveDefinitions :: [[PredicateRef]]
+    recursiveDefinitions =
+      cycles (HashMap.keys deps) (\p -> HashMap.lookupDefault [] p deps)
+
+    -- derived predicate to derived predicate dependency map
+    deps :: HashMap PredicateRef [PredicateRef]
+    deps = fmap (filter hasDerivation .  preds) derivationQueries
+
+    hasDerivation :: PredicateRef -> Bool
+    hasDerivation ref = ref `HashMap.member` derivationQueries
+
+    derivationQueries :: HashMap PredicateRef (Query_ PredicateRef TypeRef)
+    derivationQueries = HashMap.mapMaybe
+      (toQuery . derivingDefDeriveInfo ) (resolvedSchemaDeriving resolved)
+      where
+        toQuery = \case
+          NoDeriving -> Nothing
+          Derive when query ->
+            case when of
+              DeriveIfEmpty -> Nothing
+              DeriveOnDemand -> Just query
+              DerivedAndStored -> Just query
+
+    -- predicates referenced in the query
+    preds :: Query_ PredicateRef TypeRef -> [PredicateRef]
+    preds query = HashSet.toList $ bifoldMap HashSet.singleton references query
+
+    cycles :: Ord a => [a] -> (a -> [a]) -> [[a]]
+    cycles roots children = [ cycle | CyclicSCC cycle <- scc]
+      where
+      scc = stronglyConnComp [ (node, node, children node) | node <- roots ]
+
+    -- predicates referenced by type
+    references :: TypeRef -> HashSet PredicateRef
+    references tref = fromMaybe mempty $ do
+      TypeDef _ ty _ <- HashMap.lookup tref (resolvedSchemaTypes resolved)
+      return $ bifoldMap HashSet.singleton references ty
+
+definitions
+  :: [ProcessedSchema]
+  -> (HashMap TypeId TypeDef, HashMap PredicateId PredicateDef)
+definitions schemas = (types, preds)
+  where
+  preds :: HashMap PredicateId PredicateDef
+  preds = HashMap.fromList
+      [ (id, def)
+      | processed <- schemas
+      , (id, def) <- HashMap.toList $ hashedPreds $ procSchemaHashed processed
+      ]
+
+  types  :: HashMap TypeId TypeDef
+  types = HashMap.unions $ hashedTypes . procSchemaHashed <$> schemas
+
+
+-- | Interrogate the schema associated with a DB
+getSchemaInfo :: DbSchema -> SchemaIndex -> GetSchemaInfo -> IO SchemaInfo
+getSchemaInfo dbSchema index@SchemaIndex{..} GetSchemaInfo{..} = do
+  let
+    pids = Map.fromList $
+      [ (fromPid $ predicatePid p, predicateRef p)
+      | p <- HashMap.elems (predicatesById dbSchema)
+      ]
+
+    !(source, sourceVer, sourceId) = schemaSource dbSchema
+    storedSchema = renderSchemaSource source
+
+    schemaIds = toStoredVersions (schemaAllVersion dbSchema) (schemaId dbSchema)
+    dbSchemaIds = toStoredVersions sourceVer sourceId
+    otherSchemaIds =
+      [ toStoredVersions
+          (hashedSchemaAllVersion procSchemaHashed)
+          (hashedSchemaId procSchemaHashed)
+      | ProcessedSchema{..} <- schemaIndexOlder
+      , hashedSchemaId procSchemaHashed /= sourceId
+      ]
+
+    fromPredicateId predId =
+      fromPid $ predicatePid(predicatesById dbSchema HashMap.! predId)
+
+    derivationDependencies = Map.fromList
+      [ (fromPredicateId p, fromPredicateId <$> pp)
+      | (p, pp) <- HashMap.toList (derivationDepends dbSchema)
+      ]
+
+  source <- if getSchemaInfo_omit_source
+    then return ""
+    else case getSchemaInfo_select of
+      SelectSchema_stored{} -> return storedSchema
+      SelectSchema_current{} ->
+        findSchemaSource index dbSchema (schemaId dbSchema)
+      SelectSchema_schema_id sid -> findSchemaSource index dbSchema sid
+      _ -> return storedSchema
+
+  return SchemaInfo
+    { schemaInfo_schema = source
+    , schemaInfo_predicateIds = pids
+    , schemaInfo_schemaIds = schemaIds
+    , schemaInfo_dbSchemaIds = dbSchemaIds
+    , schemaInfo_otherSchemaIds = otherSchemaIds
+    , schemaInfo_derivationDependencies = derivationDependencies
+    }
+
+getSchemaInfoForSchema :: SchemaIndex -> SchemaId -> DebugFlags -> IO SchemaInfo
+getSchemaInfoForSchema index sid debug = do
+  processed <- maybe (throwIO $ userError "schema id not found") return $
+    findSchemaInIndex index sid
+  dbSchema <-
+    mkDbSchema HashMap.toList Nothing Nothing readWriteContent processed Nothing
+      debug
+  let schemaSource = renderSchemaSource (procSchemaSource processed)
+
+  res <- getSchemaInfo
+    dbSchema index (GetSchemaInfo (SelectSchema_schema_id sid) True)
+  return res{schemaInfo_schema = schemaSource}
+
+
+-- The version map in the 'StoredSchema', the 'SchemaIndex' and the
+-- 'SchemaInfo' is a @Map Text Version@ whereas the one we use
+-- internally is the inverse of this: @IntMap SchemaId@. These two
+-- functions convert back and forth.
+--
+-- TODO: maybe they should be the same.
+
+toStoredVersions :: Version -> SchemaId -> Map Text Version
+toStoredVersions ver id = Map.fromList [ (unSchemaId id, fromIntegral ver) ]
+
+fromStoredVersions :: Map Text Version -> IntMap SchemaId
+fromStoredVersions versions = IntMap.fromList
+  [ (fromIntegral ver, SchemaId id) | (id, ver) <- Map.toList versions ]
+
+renderSchemaSource :: SourceSchemas -> ByteString
+renderSchemaSource parsed =
+  Text.encodeUtf8 $ renderStrict $ layoutCompact $ displayDefault parsed
+
+-- Try to find the source for the desired schema. It could be in
+-- our SchemaIndex, or it could be the schema stored in the DB if
+-- we're looking at an old DB.
+findSchemaSource
+  :: Glean.Database.Config.SchemaIndex
+  -> DbSchema
+  -> Thrift.SchemaId
+  -> IO ByteString
+findSchemaSource index dbSchema sid = do
+  let inDB = findSchemaInDB dbSchema sid
+      inIndex = findSchemaInIndex index sid
+  case inDB <|> fmap procSchemaSource inIndex of
+    Just schema -> return $ renderSchemaSource schema
+    Nothing -> throwIO $ Thrift.Exception $
+      "SchemaId not found: " <> Thrift.unSchemaId sid
+
+findSchemaInDB :: DbSchema -> Thrift.SchemaId -> Maybe SourceSchemas
+findSchemaInDB dbSchema sid = listToMaybe matches
+  where
+  matches =
+    [ source
+    | (source, _, sourceId) <- [ schemaSource dbSchema ]
+    , sid == sourceId
+    ]
+
+findSchemaInIndex
+  :: Glean.Database.Config.SchemaIndex
+  -> Thrift.SchemaId
+  -> Maybe ProcessedSchema
+findSchemaInIndex Glean.Database.Config.SchemaIndex{..} sid =
+  listToMaybe matches
+  where
+  matches =
+    [ proc
+    | proc <- schemaIndexCurrent : schemaIndexOlder
+    , sid == hashedSchemaId (procSchemaHashed proc)
+    ]
diff --git a/glean/db/Glean/Database/Schema/ComputeIds.hs b/glean/db/Glean/Database/Schema/ComputeIds.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Schema/ComputeIds.hs
@@ -0,0 +1,342 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Schema.ComputeIds
+  ( computeIds
+  , RefToIdEnv(..)
+  , emptyRefToIdEnv
+  , ResolvedSchemaId
+  , refsToIds
+  , HashedSchema(..)
+  , emptyHashedSchema
+  , RefTargetId
+  ) where
+
+import Control.Monad
+import Control.Monad.State as State
+import Data.Bifunctor
+import Data.Bifoldable
+import Data.Graph
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+import qualified Data.Text as Text
+
+import Glean.Angle.Hash
+import Glean.Angle.Types as Schema
+import Glean.Schema.Util (showRef)
+import Glean.Schema.Types
+import Glean.Types
+
+-- | The schema with all predicate/type references replaced with
+-- PredicateId/TypeId.
+data HashedSchema = HashedSchema
+  { hashedTypes :: HashMap TypeId TypeDef
+  , hashedPreds :: HashMap PredicateId PredicateDef
+  , schemaRefToIdEnv :: RefToIdEnv
+  , hashedSchemaEnv :: NameEnv RefTargetId
+  , hashedSchemaAllVersion :: Version
+  , hashedSchemaId :: SchemaId
+  }
+
+type RefTargetId = RefTarget PredicateId TypeId
+
+emptyHashedSchema :: HashedSchema
+emptyHashedSchema = HashedSchema
+  { hashedTypes = HashMap.empty
+  , hashedPreds =  HashMap.empty
+  , schemaRefToIdEnv = emptyRefToIdEnv
+  , hashedSchemaEnv = HashMap.empty
+  , hashedSchemaAllVersion = 0
+  , hashedSchemaId = SchemaId ""
+  }
+
+type Def_ p t = RefTarget p t
+
+type DefResolved = Def_ ResolvedPredicateDef ResolvedTypeDef
+type Def = Def_ PredicateDef TypeDef
+
+data RefToIdEnv = RefToIdEnv
+  { typeRefToId :: HashMap TypeRef TypeId
+  , predRefToId :: HashMap PredicateRef PredicateId
+  }
+
+emptyRefToIdEnv :: RefToIdEnv
+emptyRefToIdEnv = RefToIdEnv HashMap.empty HashMap.empty
+
+type ResolvedSchemaId = ResolvedSchema PredicateId TypeId
+
+refsToIds
+  :: Bifunctor f
+  => RefToIdEnv
+  -> f PredicateRef TypeRef
+  -> f PredicateId TypeId
+refsToIds (RefToIdEnv tids pids) =
+  bimap (lookupPredicateId pids) (lookupTypeId tids)
+  where
+    lookupPredicateId m p = HashMap.findWithDefault err p m
+      where
+        err = error $ "lookupPredicateId: " <> Text.unpack (showRef p)
+    lookupTypeId m p = HashMap.findWithDefault err p m
+      where
+        err = error $ "lookupTypeId: " <> Text.unpack (showRef p)
+
+attachDerivations
+  :: [ResolvedSchemaRef]
+  -> [HashMap PredicateRef ResolvedPredicateDef]
+attachDerivations schemas =
+  map (HashMap.mapWithKey attach . resolvedSchemaPredicates) schemas
+  where
+  allDerivings = HashMap.unions (map resolvedSchemaDeriving schemas)
+
+  attach ref def = case HashMap.lookup ref allDerivings of
+    Just drv | not (isDefaultDeriving $ derivingDefDeriveInfo drv) ->
+      def { predicateDefDeriving =  derivingDefDeriveInfo drv }
+      -- see Note [overriding default deriving]
+    _ -> def
+
+isDefaultDeriving :: DerivingInfo q -> Bool
+isDefaultDeriving (Derive DeriveIfEmpty _) = True
+isDefaultDeriving _ = False
+
+-- | Compute the PredicateId / TypeId for each definition, and substitute for
+-- PredicateRef/TypeRef with PredicateId/TypeId inside all the definitions
+
+computeIds
+  :: (forall k v . HashMap k v -> [(k,v)])
+  -> [ResolvedSchemaRef]
+  -> Maybe (SchemaId, Version)
+  -> HashedSchema
+computeIds toList schemas versions = flip evalState emptyRefToIdEnv $ do
+  let
+    preds = attachDerivations schemas
+
+    -- first topologically sort the predicates and types, so that we can
+    -- process them in dependency order.
+    edges :: [(DefResolved, RefResolved, [RefResolved])]
+    edges =
+      [ (RefPred def, RefPred (predicateDefRef def), predicateDefRefs def)
+      | m <- preds
+      , (_, def) <- toList m
+      ] ++
+      [ (RefType def, RefType (typeDefRef def), typeDefRefs def)
+      | m <- map resolvedSchemaTypes schemas
+      , (_, def) <- toList m
+      ]
+
+    collectRefs = bifoldMap ((:[]) . RefPred) ((:[]) . RefType)
+
+    predicateDefRefs def =
+      collectRefs (predicateDefKeyType def) <>
+      collectRefs (predicateDefValueType def) <>
+      foldMap collectRefs (predicateDefDeriving def)
+
+    typeDefRefs def = collectRefs (typeDefType def)
+
+  defs <- fmap concat $ forM (stronglyConnComp edges) $ \comp ->
+    case comp of
+      AcyclicSCC def -> do
+        resolved <- resolveDef def
+        let newdef = updateDefWithHash (fingerprintDef resolved) resolved
+        State.modify (extend newdef)
+        return [newdef]
+      CyclicSCC defs -> do
+        -- sort the definitions in the cycle by ref, so that the next
+        -- steps produce deterministic hashes.
+        let sorted = sortOn (bimap predicateDefRef typeDefRef) defs
+        -- first map every ref in the cycle to the Id hash0
+        defs1 <-
+          withState (extends (zip defs (repeat hash0))) $
+            mapM resolveDef sorted
+        -- Compute a hash for each def
+        let hashes = map fingerprintDef defs1
+        -- Next make a hash of the whole cycle.
+        let cycleHash = hashBinary hashes
+        -- Note that it's possible to have two predicates with the
+        -- same name (different versions) in the cycle, and we
+        -- definitely want them to end up with different hashes
+        -- (unless they have identical representations) so the hash of
+        -- each declaration in the cycle is the hash of the
+        -- declaration plus the hash of the whole cycle.
+        let hashes2 =
+              [ (def, hashBinary (hash1, cycleHash))
+              | (def, hash1) <- zip sorted hashes ]
+        State.modify (extends hashes2)
+        -- now resolve the defs again with the correct Ids
+        forM hashes2 $ \(def, hash) ->
+          updateDefWithHash hash <$> resolveDef def
+
+  env <- State.get
+
+  let preds = HashMap.fromList
+        [ (predicateDefRef def, def) | RefPred def <- defs]
+
+      -- see Note [overriding default deriving]
+      attachDefaultDerivings preds = foldr attach preds
+        [ (id, derivingDefDeriveInfo drv)
+        | schema <- schemas
+        , (ref, drv) <- toList (resolvedSchemaDeriving schema)
+        , isDefaultDeriving $ derivingDefDeriveInfo drv
+        , Just id <- [HashMap.lookup ref (predRefToId env)]
+        ]
+        where
+        attach (id,drv) = HashMap.adjust f id
+          where
+          f (PredicateDef id key val _ s) =
+            PredicateDef id key val (fmap (refsToIds env) drv) s
+
+      (allVersion, schemaId, schemaEnv) = makeSchemaEnv schemas versions env
+
+  return HashedSchema {
+      hashedTypes = HashMap.fromList
+        [ (typeDefRef def, def) | RefType def <- defs],
+      hashedPreds = attachDefaultDerivings preds,
+      schemaRefToIdEnv = env,
+      hashedSchemaEnv = schemaEnv,
+      hashedSchemaAllVersion = allVersion,
+      hashedSchemaId = schemaId
+    }
+
+  where
+    updateDefWithHash :: Hash -> Def -> Def
+    updateDefWithHash hash def = case def of
+        RefType (TypeDef (TypeId ref _) ty s) ->
+          RefType (TypeDef (TypeId ref hash) ty s)
+        RefPred (PredicateDef (PredicateId ref _) key val drv s) ->
+          RefPred (PredicateDef (PredicateId ref hash) key val drv s)
+
+    extend :: Def -> RefToIdEnv -> RefToIdEnv
+    extend def (RefToIdEnv tids pids) =
+      case def of
+        RefType (TypeDef id _ _) ->
+          RefToIdEnv (HashMap.insert (typeIdRef id) id tids) pids
+        RefPred (PredicateDef id _ _ _ _) ->
+          RefToIdEnv tids (HashMap.insert (predicateIdRef id) id pids)
+
+    extends :: [(DefResolved, Hash)] -> RefToIdEnv -> RefToIdEnv
+    extends list env = foldr one env list
+      where
+      one (def, hash) (RefToIdEnv tids pids) =
+        case def of
+          RefType (TypeDef ref _ _) ->
+            let id = TypeId ref hash in
+            RefToIdEnv (HashMap.insert ref id tids) pids
+          RefPred (PredicateDef ref _ _ _ _) ->
+            let id = PredicateId ref hash in
+            RefToIdEnv tids (HashMap.insert ref id pids)
+
+    resolveDef :: DefResolved -> State RefToIdEnv Def
+    resolveDef (RefType (TypeDef ref ty s)) = do
+      env <- State.get
+      let
+        newTy = refsToIds env ty
+        newId = TypeId {
+          typeIdRef = ref,
+          typeIdHash = hash0 }
+        def = RefType (TypeDef newId newTy s)
+      return def
+    resolveDef (RefPred (PredicateDef ref key val drv s)) = do
+      env <- State.get
+      let
+        newKey = refsToIds env key
+        newVal = refsToIds env val
+        newDrv = fmap (resolveQuery env) drv
+        newId = PredicateId {
+          predicateIdRef = ref,
+          predicateIdHash = hash0 }
+        def = RefPred (PredicateDef newId newKey newVal newDrv s)
+      return def
+
+resolveQuery
+  :: RefToIdEnv
+  -> Query_ PredicateRef TypeRef
+  -> Query_ PredicateId TypeId
+resolveQuery env (SourceQuery head stmts ord) =
+  SourceQuery (refsToIds env <$> head) (refsToIds env <$> stmts) ord
+
+-- Serialize a definition to produce its hash.  Note that the hash
+-- includes the PredicateRef/TypeRef: two predicates or types are the
+-- same only if they the same name, same version, and same
+-- representation.
+fingerprintDef :: Def -> Hash
+fingerprintDef (RefType (TypeDef id ty _)) =
+  hashBinary (showRef ref, rmLocType ty)
+  where ref = typeIdRef id
+fingerprintDef (RefPred (PredicateDef id keyTy valTy drv _)) =
+  hashBinary (showRef ref,rmLocType keyTy, rmLocType valTy, fmap rmLocQuery drv)
+  where ref = predicateIdRef id
+
+{- Note [overriding default deriving]
+
+If we add a "deriving P default" declaration for a predicate P to the
+schema, after a DB was created with P, we would like this to work: the
+new P should get the same Pid, so queries still work.
+
+But, if the derivation is included in the hash, the new P with the
+deriving decl will get a different hash. It's difficult to resolve
+this later, because we only want the derivation to take effect if the
+two Ps are really the same (they have the same types).
+
+So the hack to solve this for now is to ignore the "derive default"
+derivations when computing hashes, and add them back in
+afterwards. The old and the new Ps will get the same hashes, if they
+really only differ in their derivations.
+
+-}
+
+
+makeSchemaEnv
+  :: [ResolvedSchemaRef]
+  -> Maybe (SchemaId, Version)
+  -> RefToIdEnv
+  -> (Version, SchemaId, NameEnv RefTargetId)
+makeSchemaEnv resolved versions refToIdEnv
+  | Just (schemaId, ver) <- versions,
+    Just schema <- Map.lookup ver resolvedAlls =
+    (ver, schemaId, mkEnv schema)
+  | Just (ver, schema) <- Map.lookupMax resolvedAlls =
+    let
+      env = mkEnv schema
+      schemaId = SchemaId $ Text.pack $ show $ hashNameEnv env
+    in
+    (fromIntegral ver, schemaId, env)
+  | otherwise =
+    error "no \"all\" schema"
+  where
+    mkEnv ResolvedSchema{..} =
+       HashMap.union
+         (mapNameEnv (Just . refsToIds refToIdEnv)
+           resolvedSchemaQualScope)
+         versionedNameEnv
+
+    resolvedAlls = Map.fromList
+      [ (resolvedSchemaVersion schema, schema)
+      | schema <- resolved
+      , resolvedSchemaName schema == "all" ]
+
+    -- In the environment that we use for resolving names in queries
+    -- and derivations later, we need to accept explicitly versioned
+    -- references to predicates and types even for those predicates
+    -- and types that are not visible in the scope of the "all" schema.
+    versionedNameEnv = HashMap.fromList
+      [ (SourceRef name (Just ver), Set.singleton target)
+      | (name, ver, target) <-
+          [ (predicateRef_name r, predicateRef_version r, RefPred t)
+          | (r, t) <- HashMap.toList (predRefToId refToIdEnv) ] ++
+          [ (typeRef_name r, typeRef_version r, RefType t)
+          | (r, t) <- HashMap.toList (typeRefToId refToIdEnv) ]
+      ]
+
+-- | How to take a NameEnv and compute the schema hash from it. This
+-- hash uniquely identifies a particular NameEnv that can be used to
+-- resolve a type or predicate name, or in general a query.
+hashNameEnv :: NameEnv (RefTarget PredicateId TypeId) -> Hash
+hashNameEnv env =
+  hashBinary (sort (HashMap.toList env))
diff --git a/glean/db/Glean/Database/Schema/Types.hs b/glean/db/Glean/Database/Schema/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Schema/Types.hs
@@ -0,0 +1,366 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Schema.Types
+  ( DbSchema(..)
+  , DbSchemaCache
+  , DbSchemaCacheKey(..)
+  , RefTargetId
+  , PredicateDetails(..)
+  , predicateRef
+  , PredicateTransformation(..)
+  , Bytes(..)
+  , IsPointQuery
+  , SchemaSelector(..)
+  , schemaNameEnv
+  , allSchemaVersion
+  , addTmpPredicate
+  , lookupSourceRef
+  , lookupPredicateSourceRef
+  , lookupPredicateId
+  , lookupPid
+  , lookupTransformation
+  , needsTransformation
+  , QueryTransformations
+  , mkQueryTransformations
+  , TypeDetails(..)
+  , lookupTypeId
+  , dbSchemaRtsType
+  , mkRtsType
+  , tempPredicateId
+  , tempPid
+  , pidRef
+  , transitiveDeps
+  ) where
+
+import Data.Bifoldable (bifoldr')
+import Data.Hashable
+import Data.HashMap.Strict (HashMap)
+import qualified Data.Graph as Graph
+import qualified Data.HashMap.Strict as HashMap
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe (fromMaybe, isJust)
+import qualified Data.Set as Set
+import Data.Set (Set)
+import Data.Text (Text)
+import Compat.Prettyprinter hiding ((<>))
+
+import Glean.Angle.Hash
+import Glean.Angle.Types as Schema hiding (Type, FieldDef)
+import qualified Glean.Angle.Types as Schema
+import Glean.Bytecode.Types
+import Glean.Query.Codegen.QueryRegs
+import Glean.Query.Codegen.Types (Match, Output, TransformAndBind)
+import Glean.Database.Schema.ComputeIds
+import Glean.Query.Typecheck.Types
+import Glean.RTS.Foreign.Bytecode (Subroutine)
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Bytecode.Code
+import Glean.RTS.Term (Term)
+import Glean.RTS.Typecheck
+import Glean.RTS.Traverse
+import Glean.RTS.Types (Pid(..), Type, PidRef(..), FieldDef, ExpandedType(..))
+import Glean.Types as Thrift
+import Glean.Schema.Types
+import Glean.Schema.Util
+
+-- | The Schema used by a DB
+data DbSchema = DbSchema
+  { predicatesById :: HashMap PredicateId PredicateDetails
+  , derivationDepends :: HashMap PredicateId [PredicateId]
+  , typesById :: HashMap TypeId TypeDetails
+
+  , schemaEnvs :: Map SchemaId (NameEnv RefTargetId)
+     -- ^ for each SchemaId, the environment of types/predicates
+
+  , predicatesByPid :: IntMap PredicateDetails
+
+  , predicatesTransformations :: HashMap SchemaId QueryTransformations
+    -- ^ Transformations are specific to the union of evolutions in the client
+    -- and server schemas. Indexed by client schema id.
+
+  , schemaInventory :: Inventory
+    -- ^ Information about the predicates in an open DB
+  , schemaMaxPid :: Pid
+
+  -- These two fields relate to the latest available schema. In a
+  -- writable DB this will be the DB schema, but in a readable DB it
+  -- will be the current schema in the schema index.
+  , schemaAllVersion :: Version
+  , schemaId :: SchemaId
+
+  , schemaSource :: (SourceSchemas, Version, SchemaId)
+    -- ^ This is the DB schema, used by toStoredSchema
+  }
+
+-- | Cached DbSchemas, so that we can share them amongst different DBs
+type DbSchemaCache = HashMap DbSchemaCacheKey DbSchema
+
+newtype DbSchemaCacheKey = DbSchemaCacheKey Hash
+  deriving (Eq, Hashable)
+
+-- | Transformations to be applied to a query. Keyed by the requested predicate
+-- (i.e. the one present in the query)
+newtype QueryTransformations = QueryTransformations (IntMap TransDetails)
+
+data TransDetails
+  = HasTransformation PredicateTransformation
+  | DependenciesHaveTransformations -- transitive deps
+
+-- | Data required to transform a predicate that was requested in a query into
+-- one that we have available in the database, and then to transform the facts
+-- found back into the requested predicate.
+data PredicateTransformation = PredicateTransformation
+  { tRequested :: PidRef
+    -- ^ the predicate that was queried for
+  , tAvailable :: PidRef
+    -- ^ the predicate we have in the database
+  , tTransformFactBack :: Thrift.Fact -> Thrift.Fact
+    -- ^ available -> requested
+    -- ^ transform a fact of the available predicate into a fact
+    -- of the requested predicate.
+
+  , transformKeyPattern :: forall a
+    . Maybe ( QueryRegs
+            -> (Type -> Term (Match TransformAndBind Output) -> Code ())
+            -> Term (Match TransformAndBind Output)
+            -> (Term (Match TransformAndBind Output) -> Code a)
+            -> Code a)
+  , transformValuePattern :: forall a
+    . Maybe (  QueryRegs
+            -> (Type -> Term (Match TransformAndBind Output) -> Code ())
+            -> Term (Match TransformAndBind Output)
+            -> (Term (Match TransformAndBind Output) -> Code a)
+            -> Code a)
+    -- ^ requested -> available
+    -- ^ Transform a pattern into one which can be used to build a prefix for
+    -- the available predicate. The resulting pattern cannot be used for
+    -- variable binding.
+  }
+
+-- | Whether a prefix will match a fact from beginning to end and therefore can
+-- only have a single result.
+type IsPointQuery = Bool
+
+-- | bytes in a binary output
+data Bytes = Bytes
+  { b_start :: Register 'DataPtr
+  , b_end :: Register 'DataPtr
+  }
+  deriving (Show)
+
+data TypeDetails = TypeDetails
+  { typeId :: TypeId
+  , typeType :: Type
+  }
+
+data PredicateDetails = PredicateDetails
+  { predicatePid :: Pid
+  , predicateId :: PredicateId
+  , predicateSchema :: PredicateDef' SrcSpan ()
+  , predicateKeyType :: Type
+  , predicateValueType :: Type
+  , predicateTypecheck :: Subroutine CompiledTypecheck
+  , predicateTraversal :: Subroutine CompiledTraversal
+  , predicateDeriving :: DerivingInfo TypecheckedQuery
+  , predicateInStoredSchema :: Bool
+    -- ^ True if this prediate is part of the schema stored in the DB.
+    -- Only predicates in the stored schema can be written.
+  }
+
+predicateRef :: PredicateDetails -> PredicateRef
+predicateRef = predicateIdRef . predicateId
+
+data SchemaSelector
+  = LatestSchema
+  | SpecificSchemaId SchemaId
+
+instance Pretty SchemaSelector where
+  pretty LatestSchema = "latest"
+  pretty (SpecificSchemaId (SchemaId id)) = "schema-id:" <> pretty id
+
+allSchemaVersion :: DbSchema -> SchemaSelector -> Maybe SchemaId
+allSchemaVersion _ (SpecificSchemaId v) = Just v
+allSchemaVersion dbSchema LatestSchema = Just (schemaId dbSchema)
+
+schemaNameEnv :: DbSchema -> SchemaSelector -> Maybe (NameEnv RefTargetId)
+schemaNameEnv dbSchema schemaVer = do
+  hash <- allSchemaVersion dbSchema schemaVer
+  Map.lookup hash (schemaEnvs dbSchema)
+
+addTmpPredicate :: NameEnv RefTargetId -> NameEnv RefTargetId
+addTmpPredicate =
+  HashMap.insert sourceRef (Set.singleton (RefPred tempPredicateId))
+  where
+  PredicateRef name ver = predicateIdRef tempPredicateId
+  sourceRef = SourceRef name (Just ver)
+
+lookupSourceRef
+  :: SourceRef
+  -> SchemaSelector
+     -- ^ schema version to use if predicate version is Nothing
+  -> DbSchema
+  -> LookupResult RefTargetId
+lookupSourceRef ref schemaVer dbSchema =
+  case schemaNameEnv dbSchema schemaVer of
+    Nothing -> OutOfScope
+    Just env -> resolveRef env ref
+
+lookupPredicateSourceRef
+  :: SourceRef
+  -> SchemaSelector
+     -- ^ schema version to use if predicate version is Nothing
+  -> DbSchema
+  -> Either Text PredicateDetails
+lookupPredicateSourceRef ref schemaVer dbSchema =
+  case lookupResultToEither ref $ lookupSourceRef ref schemaVer dbSchema of
+    Right (RefPred pred)
+      | Just details <- lookupPredicateId pred dbSchema -> Right details
+      | otherwise -> Left $
+        "internal error: " <> showRef pred <> " not found"
+    Right (RefType _) ->
+      Left $ showRef ref <> " is a type, not a predicate"
+    Left err -> Left err
+
+lookupPredicateId :: PredicateId -> DbSchema -> Maybe PredicateDetails
+lookupPredicateId ref = HashMap.lookup ref . predicatesById
+
+lookupPid :: Pid -> DbSchema -> Maybe PredicateDetails
+lookupPid (Pid pid) = IntMap.lookup (fromIntegral pid) . predicatesByPid
+
+lookupTypeId :: TypeId -> DbSchema -> Maybe TypeDetails
+lookupTypeId ref  = HashMap.lookup ref . typesById
+
+-- | Either the type or a type transitively referenced by it needs to be
+-- transformed.
+needsTransformation
+  :: QueryTransformations
+  -> Pid
+  -> Bool
+needsTransformation (QueryTransformations tmap) pid =
+  isJust $ IntMap.lookup (fromIntegral $ fromPid pid) tmap
+
+lookupTransformation
+  :: Pid
+  -> QueryTransformations
+  -> Maybe PredicateTransformation
+lookupTransformation pid (QueryTransformations tmap) = do
+  dets <- IntMap.lookup (fromIntegral $ fromPid pid) tmap
+  case dets of
+    HasTransformation trans -> Just trans
+    DependenciesHaveTransformations -> Nothing
+
+transitiveDeps :: (Pid -> PredicateDetails) -> Set Pid -> Pid -> [Pid]
+transitiveDeps detailsFor = transitive (predicateDeps . detailsFor)
+  where
+    transitive :: Ord a => (a -> [a]) -> Set a -> a ->  [a]
+    transitive next initial root = go [root] initial
+      where
+        go [] _ = []
+        go (x:xs) visited
+          | x `Set.member`visited = go xs visited
+          | otherwise = x : go (next x <> xs) (Set.insert x visited)
+
+-- All predicates mentioned in a predicate's type.
+-- Does not include predicates from the derivation query.
+predicateDeps :: PredicateDetails -> [Pid]
+predicateDeps details =
+  typeDeps (predicateKeyType details) $
+    typeDeps (predicateValueType details) []
+  where
+    typeDeps ty r = bifoldr' overPidRef overExpanded r ty
+    overExpanded (ExpandedType _ ty) r = typeDeps ty r
+    overPidRef (PidRef pid _) r = pid : r
+
+tempPid :: DbSchema -> Pid
+tempPid = succ . schemaMaxPid
+
+pidRef :: PredicateDetails -> PidRef
+pidRef details = PidRef (predicatePid details) (predicateId details)
+
+-- | Convert Schema types to RTS types using a DbSchema
+dbSchemaRtsType :: DbSchema -> Schema.Type' s -> Maybe Type
+dbSchemaRtsType dbSchema = mkRtsType lookupType lookupPid
+  where
+  lookupType ref = typeType <$> lookupTypeId ref dbSchema
+  lookupPid ref = case lookupPredicateId ref dbSchema of
+    Just pid -> Just $ predicatePid pid
+    -- detect temporary predicates that might have been serialized
+    -- see Glean.Query.Flatten.captureKey
+    _ | tempPredicateId == ref -> Just $ tempPid dbSchema
+    _ -> Nothing
+
+-- | Convert from Schema Types to RTS Types. This involves
+-- 1. PredicateRef -> PidRef
+-- 2. Expand NamedTypes
+mkRtsType
+  :: (TypeId -> Maybe Type)
+  -> (PredicateId -> Maybe Pid)
+  -> Schema.Type' s -> Maybe Type
+mkRtsType lookupType lookupPid = rtsType
+  where
+    rtsType :: Schema.Type' s -> Maybe Type
+    rtsType Schema.ByteTy = return Schema.ByteTy
+    rtsType Schema.NatTy = return Schema.NatTy
+    rtsType (Schema.ArrayTy elty) = Schema.ArrayTy <$> rtsType elty
+    rtsType (Schema.RecordTy fields) = Schema.RecordTy <$> mapM fieldType fields
+    rtsType (Schema.SumTy fields) = Schema.SumTy <$> mapM fieldType fields
+    rtsType (Schema.SetTy elty) = Schema.SetTy <$> rtsType elty
+    rtsType Schema.StringTy = return Schema.StringTy
+    rtsType (Schema.PredicateTy _ ref) = do
+      pid <- lookupPid ref
+      return (Schema.PredicateTy () (PidRef pid ref))
+    -- TODO: This will loop if we have recursive typedefs but we don't allow
+    -- those at the moment.
+    rtsType (Schema.NamedTy _ ref) = case lookupType ref of
+      Just ty -> Just $ Schema.NamedTy () (ExpandedType ref ty)
+      Nothing -> Nothing
+    rtsType (Schema.MaybeTy eltTy) = Schema.MaybeTy <$> rtsType eltTy
+    rtsType (Schema.EnumeratedTy names) = return (Schema.EnumeratedTy names)
+    rtsType Schema.BooleanTy = return Schema.BooleanTy
+    rtsType Schema.TyVar{} = error "rtsType: TyVar"
+    rtsType Schema.HasTy{} = error "rtsType: HasTy"
+    rtsType Schema.HasKey{} = error "rtsType: HasKey"
+    rtsType Schema.ElementsOf{} = error "rtsType: ElementsOf"
+
+    fieldType :: Schema.FieldDef' s -> Maybe FieldDef
+    fieldType (Schema.FieldDef name ty) = Schema.FieldDef name <$> rtsType ty
+
+mkQueryTransformations
+  :: IntMap PredicateDetails
+  -> IntMap PredicateTransformation
+  -> QueryTransformations
+mkQueryTransformations pmap tmap = QueryTransformations $
+  foldr addSCC mempty (reverse $ Graph.stronglyConnComp edges)
+  where
+    transFor pid =  IntMap.lookup (intPid pid) tmap
+    detailsFor pid = pmap IntMap.! intPid pid
+    intPid (Pid pid) = fromIntegral pid
+    deps = predicateDeps . detailsFor
+
+    addSCC scc depsTrans = foldr add depsTrans scc
+      where
+      add pid acc = fromMaybe acc $ do
+        trans <- case transFor pid of
+          Just trans -> Just $ HasTransformation trans
+          Nothing -> defaultForSCC
+        return $ IntMap.insert (intPid pid) trans acc
+
+      defaultForSCC =
+        if any needsTransformation $ concatMap deps scc
+          then Just DependenciesHaveTransformations
+          else Nothing
+        where needsTransformation pid = intPid pid `IntMap.member` depsTrans
+
+    edges =
+      [ (pid, pid, deps pid)
+      | pid <- Pid . fromIntegral <$> IntMap.keys pmap
+      ]
diff --git a/glean/db/Glean/Database/Storage.hs b/glean/db/Glean/Database/Storage.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Storage.hs
@@ -0,0 +1,205 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Storage
+  ( Mode(..)
+  , CreateSchema(..)
+  , Storage(..)
+  , DBVersion(..)
+  , AxiomOwnership
+  , WriteLock(..)
+  , canOpenVersion
+  , currentVersion
+  , writableVersions
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.Vector.Storable as VS
+
+import Glean.Database.Backup.Backend (Data)
+import Glean.Internal.Types (StoredSchema)
+import Glean.RTS.Foreign.FactSet (FactSet)
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Foreign.Lookup (CanLookup, Lookup)
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Types (Fid, Pid)
+import Glean.ServerConfig.Types (DBVersion(..))
+import Glean.Types (PredicateStats, Repo, SchemaId)
+
+-- | List of binary representation versions we can read
+readableVersions :: [DBVersion]
+readableVersions = [DBVersion 3]
+
+-- | List of binary representation versions we can write
+writableVersions :: [DBVersion]
+writableVersions = [DBVersion 3]
+
+-- | Check whether we can open a particular database version
+canOpenVersion :: Mode -> DBVersion -> Bool
+canOpenVersion mode version = version `elem` versions
+  where
+    versions = case mode of
+      ReadOnly -> readableVersions
+      ReadWrite -> writableVersions
+      Create{} -> writableVersions
+
+-- | Default current binary representation version
+currentVersion :: DBVersion
+currentVersion = maximum writableVersions
+
+-- Choose which schema goes into a newly created DB
+data CreateSchema
+  = UseDefaultSchema
+  | UseSpecificSchema SchemaId
+  | UseThisSchema StoredSchema
+  deriving (Show)
+
+-- | Database opening mode
+data Mode
+  = ReadOnly
+  | ReadWrite
+  | Create
+      Fid  -- starting fact id
+      (Maybe Ownership)  -- base DB ownership
+      CreateSchema
+
+-- | Raw ownership data for axiomatic (non-derived) facts: a mapping
+-- from unit name to ranges of fact IDs.
+type AxiomOwnership = HashMap ByteString (VS.Vector Fid)
+
+-- | Token representing the write lock
+data WriteLock w = WriteLock w
+
+-- | An abstract storage for fact database
+class CanLookup (Database s) => Storage s where
+  -- | A fact database
+  data Database s
+
+  -- | A short, user-readable description of the storage
+  describe :: s -> String
+
+  -- | Open a database
+  open :: s -> Repo -> Mode -> DBVersion -> IO (Database s)
+
+  -- | Close a database
+  close :: Database s -> IO ()
+
+  -- | Delete a database if it exists
+  delete :: s -> Repo -> IO ()
+
+  -- | Unconditionally remove a database or anything that might be stored where
+  -- the database would exist. For disk-based storage, this would remove the
+  -- directory where the database would be stored.
+  safeRemoveForcibly :: s -> Repo -> IO ()
+
+  -- | Obtain the 'PredicateStats' for each predicate
+  predicateStats :: Database s -> IO [(Pid, PredicateStats)]
+
+  -- | Store an arbitrary binary key/value pair in the database. This data is
+  -- completely separate from the facts.
+  --
+  -- NOTE: It is expected that 'store' and 'retrieve' are used sparingly and
+  -- there are no performance guarantees. A typical use case for this is
+  -- storing the serialised schema in the database.
+  store :: Database s -> ByteString -> ByteString -> IO ()
+
+  -- | Retrieve the value of a key previously stored with 'store'.
+  retrieve :: Database s -> ByteString -> IO (Maybe ByteString)
+
+  -- | Commit a set of facts to the database. The facts must have the right ids,
+  -- they are NOT renamed.
+  commit :: Database s -> FactSet -> IO ()
+
+  -- | Add ownership data about a set of (committed) facts.
+  addOwnership :: Database s -> WriteLock w -> AxiomOwnership -> IO ()
+
+  -- | Optimise a database for reading. This is typically done before backup.
+  optimize :: Database s -> Bool {- compact -} -> IO ()
+
+  computeOwnership
+    :: Database s
+    -> Maybe Lookup
+       -- ^ Base DB lookup if this is a stacked DB, because ownership may
+       -- need to propagate ownership through facts in the base DB.
+    -> Inventory
+    -> IO ComputedOwnership
+
+  storeOwnership :: Database s -> WriteLock w -> ComputedOwnership -> IO ()
+
+  -- | Fetch the 'Ownership' interface for this DB. This is used to
+  -- make a 'Slice' (a view of a subset of the facts in the DB).
+  --
+  -- Can return 'Nothing' if this database backend doesn't support
+  -- ownership. (TODO: support ownership in the memory backend and
+  -- remove this 'Maybe').
+  getOwnership :: Database s -> IO (Maybe Ownership)
+
+  getUnitId :: Database s -> ByteString -> IO (Maybe UnitId)
+  getUnit :: Database s -> UnitId -> IO (Maybe ByteString)
+
+  -- | Called once per batch.
+  addDefineOwnership :: Database s -> WriteLock w -> DefineOwnership -> IO ()
+
+  -- | Called once per derived predicate at the end of its derivation.
+  computeDerivedOwnership
+    :: Database s
+    -> WriteLock w
+    -> Ownership
+    -> Maybe Lookup
+       -- ^ Base DB lookup if this is a stacked DB, because we may
+       -- derive facts that already exist in the base DB and the
+       -- ownership of those facts will need to be extended.
+    -> Pid
+    -> IO ComputedOwnership
+
+  -- | After writing has finished, cache ownership data to support
+  -- faster getOwner() operations. Takes time to cache the data and
+  -- memory to retain the cache. Only useful if this DB will be used
+  -- in an incremental stack.
+  cacheOwnership :: Database s -> IO ()
+
+  prepareFactOwnerCache :: Database s -> IO ()
+
+  -- | Determine the total capacity of the storage medium (e.g., disk size).
+  getTotalCapacity :: s -> IO (Maybe Int)
+
+  -- | Determine the used capacity of the storage medium (e.g., how much of the
+  -- disk is in use).
+  getUsedCapacity :: s -> IO (Maybe Int)
+
+  -- | Determine the free capacity of the storage medium (e.g., how much of the
+  -- disk is free).
+  getFreeCapacity :: s -> IO Int
+
+  -- | Execute the action, passing to it a path to a scratch directory which can
+  -- be used, e.g., for downloading databases. This directory is not guaranteed
+  -- to persist beyond the call and is not guaranteed to be empty.
+  withScratchRoot :: s -> (FilePath -> IO a) -> IO a
+
+  -- | Backup a database. The scratch directory which can be used for storing
+  -- intermediate files is guaranteed to be empty and will be deleted after
+  -- the operation completes.
+  backup
+    :: Database s  -- ^ database
+    -> FilePath  -- ^ scratch directory
+    -> (FilePath -> Data -> IO a)
+          -- ^ function which expects the serialised database
+    -> IO a
+
+  -- | Restore a database. The scratch directory which can be used for
+  -- storing intermediate files is guaranteed to be empty and will be
+  -- deleted after the operation completes. The implementation may
+  -- delete the serialized database file after it has been consumed,
+  -- to reduce the number of copies of the DB on disk during a restore.
+  restore
+    :: s   -- ^ storage
+    -> Repo  -- ^ repo
+    -> FilePath  -- ^ scratch directory
+    -> FilePath  -- ^ file containing the serialiased database (produced by 'backup')
+    -> IO ()
diff --git a/glean/db/Glean/Database/Storage/Memory.hs b/glean/db/Glean/Database/Storage/Memory.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Storage/Memory.hs
@@ -0,0 +1,117 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | This is a very incomplete skeleton of an in-memory storage backend.
+-- at the moment it is only usable for tests which don't produce or query
+-- facts.
+
+module Glean.Database.Storage.Memory
+  ( Memory(..)
+  , newStorage
+  , Database(..)
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import System.IO.Temp (withSystemTempDirectory)
+
+import Util.STM
+
+import Glean.Database.Exception
+import Glean.Database.Storage
+import Glean.Repo.Text
+import Glean.RTS.Foreign.FactSet (FactSet)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Lookup
+import Glean.Types (Repo)
+
+newtype Memory = Memory (TVar (HashMap Repo (Database Memory)))
+
+newStorage :: IO Memory
+newStorage = Memory <$> newTVarIO HashMap.empty
+
+-- | An abstract storage for fact database
+instance Storage Memory where
+  data Database Memory = Database
+    { dbRepo :: Repo
+    , dbFacts :: FactSet
+    , dbData :: TVar (HashMap ByteString ByteString)
+    }
+
+  describe = const "memory:"
+
+  open (Memory v) repo (Create start _unit _) _ = do
+    facts <- FactSet.new start
+    atomically $ do
+      dbs <- readTVar v
+      case HashMap.lookup repo dbs of
+        Nothing -> do
+          db <- Database repo facts <$> newTVar mempty
+          writeTVar v $ HashMap.insert repo db dbs
+          return db
+        Just _ -> dbError repo "database already exists"
+  open (Memory v) repo _ _ = do
+    dbs <- readTVarIO v
+    case HashMap.lookup repo dbs of
+      Just db -> return db
+      Nothing -> dbError repo "database doesn't exist"
+
+  -- TODO
+  close _ = return ()
+
+  delete (Memory v) = atomically . modifyTVar' v . HashMap.delete
+
+  safeRemoveForcibly = delete
+
+  predicateStats = FactSet.predicateStats . dbFacts
+
+  store db key value =
+    atomically $ modifyTVar' (dbData db) $ HashMap.insert key value
+  retrieve db key =
+    atomically $ HashMap.lookup key <$> readTVar (dbData db)
+
+  commit db facts = FactSet.append (dbFacts db) facts
+
+  -- TODO: ownership
+  addOwnership _ _ _ = return ()
+
+  optimize _ _ = return ()
+
+  -- TODO: ownership
+  computeOwnership _ _ _ = return (error "unimplemented computeOwnership")
+  getUnitId _ _ = return (error "unimplemented getUnitId")
+  getUnit _ _ = return (error "unimplemented getUnit")
+  storeOwnership _ _ _ = return ()  -- can't fail, otherwise we fail tests
+  getOwnership _ = return Nothing
+  addDefineOwnership _ _ =
+    return (error "unimplemented addDefineOwnership")
+  computeDerivedOwnership _ _ _ =
+    return (error "unimplemented computeDerivedOwnership")
+  cacheOwnership _ = return ()
+  prepareFactOwnerCache _ = return ()
+
+  -- TODO
+  getTotalCapacity _ = return Nothing
+
+  -- TODO
+  getUsedCapacity _ = return Nothing
+
+  -- TODO
+  getFreeCapacity _ = return maxBound
+
+  withScratchRoot _ f = withSystemTempDirectory "glean" f
+
+  -- TODO
+  backup db _ _ = dbError (dbRepo db) "unimplemented 'backup'"
+  -- TODO
+  restore _ repo _ _ = dbError repo "unimplemented 'restore'"
+
+instance CanLookup (Database Memory) where
+  lookupName Database{..} = "memory:" <> repoToText dbRepo
+  withLookup = withLookup . dbFacts
diff --git a/glean/db/Glean/Database/Storage/RocksDB.hs b/glean/db/Glean/Database/Storage/RocksDB.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Storage/RocksDB.hs
@@ -0,0 +1,451 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Storage.RocksDB
+  ( RocksDB(..)
+  , newStorage
+  ) where
+
+import Control.Exception
+import Control.Monad
+import qualified Data.HashMap.Strict as HashMap
+import Data.Int
+import Data.List (unzip4)
+import qualified Data.Vector.Storable as VS
+import Data.Word
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Marshal.Array
+import Foreign.Ptr
+import Foreign.Storable
+import System.Directory
+import System.IO.Temp (withTempDirectory)
+import System.FilePath
+import System.Process (readProcessWithExitCode)
+import System.Exit (ExitCode(ExitSuccess))
+
+import Util.FFI
+import Util.IO (safeRemovePathForcibly)
+
+import Glean.Database.Backup.Backend (Data(Data))
+import Glean.Database.Repo (databasePath)
+import Glean.Database.Storage
+import Glean.FFI
+import Glean.Repo.Text
+import Glean.RTS.Foreign.FactSet (FactSet)
+import Glean.RTS.Foreign.Lookup
+  (CanLookup(..), Lookup(..))
+import Glean.RTS.Foreign.Ownership as Ownership
+import Glean.RTS.Foreign.Stats (marshalPredicateStats)
+import Glean.RTS.Types (Fid(..), invalidFid, Pid(..))
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types (Repo)
+import Glean.Util.Disk
+import System.IO.Extra (withTempFile)
+
+newtype Cache = Cache (ForeignPtr Cache)
+
+instance Object Cache where
+  wrap = Cache
+  unwrap (Cache p) = p
+  destroy = glean_rocksdb_free_cache
+
+newCache :: Int -> IO Cache
+newCache size =
+  construct $ invoke $ glean_rocksdb_new_cache (fromIntegral size)
+
+withCache :: Maybe Cache -> (Ptr Cache -> IO a) -> IO a
+withCache (Just cache) f = with cache f
+withCache Nothing f = f nullPtr
+
+data RocksDB = RocksDB
+  { rocksRoot :: FilePath
+  , rocksCache :: Maybe Cache
+  , rocksCacheIndexAndFilterBlocks :: Bool
+  }
+
+newStorage :: FilePath -> ServerConfig.Config -> IO RocksDB
+newStorage root ServerConfig.Config{..} = do
+  cache <- if config_db_rocksdb_cache_mb > 0
+    then
+      Just <$> newCache (fromIntegral config_db_rocksdb_cache_mb * 1024 * 1024)
+    else return Nothing
+  return RocksDB
+    { rocksRoot = root
+    , rocksCache = cache
+    , rocksCacheIndexAndFilterBlocks =
+        config_db_rocksdb_cache_index_and_filter_blocks
+    }
+
+newtype Container = Container (Ptr Container)
+  deriving(Storable)
+
+instance Static Container where
+  destroyStatic = glean_rocksdb_container_free
+
+instance Storage RocksDB where
+  data Database RocksDB = Database
+    { dbPtr :: ForeignPtr (Database RocksDB)
+    , dbRepo :: Repo
+    }
+
+  describe rocks = "rocksdb:" <> rocksRoot rocks
+
+  open rocks repo mode (DBVersion version) = do
+    (cmode, start, ownership) <- case mode of
+      ReadOnly -> return (0, invalidFid, Nothing)
+      ReadWrite -> return (1, invalidFid, Nothing)
+      Create start ownership _ -> do
+        createDirectoryIfMissing True path
+        return (2, start, ownership)
+    withCString path $ \cpath ->
+      withCache (rocksCache rocks) $ \cache_ptr ->
+      using (invoke $
+          glean_rocksdb_container_open cpath
+            cmode
+            (fromIntegral (fromEnum (rocksCacheIndexAndFilterBlocks rocks)))
+            cache_ptr)
+        $ \container -> do
+      fp <- mask_ $ do
+        first_unit_id <- maybe (return firstUsetId) nextUsetId ownership
+        p <- invoke $
+          glean_rocksdb_container_open_database container start
+            first_unit_id version
+        newForeignPtr glean_rocksdb_database_free p
+      return (Database fp repo)
+    where
+      path = containerPath rocks repo
+
+  close db = withContainer db glean_rocksdb_container_close
+
+  delete rocks = safeRemovePathForcibly . containerPath rocks
+
+  safeRemoveForcibly rocks =
+      safeRemovePathForcibly . databasePath (rocksRoot rocks)
+
+  predicateStats db = unsafeWithForeignPtr (dbPtr db)
+    $ marshalPredicateStats . glean_rocksdb_database_predicateStats
+
+  store db key value =
+    withContainer db $ \s_ptr ->
+    unsafeWithBytes key $ \key_ptr key_size ->
+    unsafeWithBytes value $ \value_ptr value_size ->
+    invoke $ glean_rocksdb_container_write_data
+      s_ptr
+      key_ptr
+      key_size
+      value_ptr
+      value_size
+
+  retrieve db key =
+    withContainer db $ \s_ptr ->
+    unsafeWithBytes key $ \key_ptr key_size -> do
+      (value_ptr, value_size, found)
+        <- invoke $ glean_rocksdb_container_read_data s_ptr key_ptr key_size
+      if found /= 0
+        then Just <$> unsafeMallocedByteString value_ptr value_size
+        else return Nothing
+
+  commit db facts = unsafeWithForeignPtr (dbPtr db) $ \db_ptr -> do
+    with facts $ \facts_ptr -> invoke $ glean_rocksdb_commit db_ptr facts_ptr
+
+  addOwnership db _ owned =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    when (not $ HashMap.null owned) $
+      withMany entry (HashMap.toList owned) $ \xs ->
+      let (unit_ptrs, unit_sizes, facts_ptrs, facts_sizes) = unzip4 xs
+      in
+      withArray unit_ptrs $ \p_unit_ptrs ->
+      withArray unit_sizes $ \p_unit_sizes ->
+      withArray facts_ptrs $ \p_facts_ptrs ->
+      withArray facts_sizes $ \p_facts_sizes ->
+      invoke $ glean_rocksdb_add_ownership
+        db_ptr
+        (fromIntegral $ HashMap.size owned)
+        p_unit_ptrs
+        p_unit_sizes
+        p_facts_ptrs
+        p_facts_sizes
+    where
+      entry (unit, facts) f =
+        unsafeWithBytes unit $ \unit_ptr unit_size ->
+        VS.unsafeWith facts $ \facts_ptr ->
+        f (unit_ptr, unit_size, facts_ptr, fromIntegral $ VS.length facts)
+
+  optimize db compact = withContainer db $ \s_ptr ->
+    invoke $ glean_rocksdb_container_optimize s_ptr
+      (fromIntegral (fromEnum compact))
+
+  computeOwnership db base inv =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    using (invoke $ glean_rocksdb_get_ownership_unit_iterator db_ptr) $
+    Ownership.compute inv db base
+
+  storeOwnership db _ own =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    with own $ \own_ptr ->
+    invoke $ glean_rocksdb_store_ownership db_ptr own_ptr
+
+  getOwnership db = fmap Just $
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    construct $ invoke $ glean_rocksdb_get_ownership db_ptr
+
+  getUnitId db unit =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    unsafeWithBytes unit $ \unit_ptr unit_size -> do
+      w64 <- invoke $ glean_rocksdb_get_unit_id db_ptr unit_ptr unit_size
+      if w64 > 0xffffffff
+        then return Nothing
+        else return (Just (UnitId (fromIntegral w64)))
+
+  getUnit db unit =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr -> do
+      (unit_ptr, unit_size) <- invoke $ glean_rocksdb_get_unit db_ptr unit
+      if unit_size /= 0
+        then Just <$> unsafeMallocedByteString unit_ptr unit_size
+        else return Nothing
+
+  addDefineOwnership db _ define =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    with define $ \define_ptr ->
+      invoke $ glean_rocksdb_add_define_ownership db_ptr define_ptr
+
+  computeDerivedOwnership db _ ownership base (Pid pid) =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+    using
+      (invoke $
+        glean_rocksdb_get_derived_fact_ownership_iterator
+          db_ptr
+          (fromIntegral pid)) $
+      Ownership.computeDerivedOwnership ownership base
+
+  cacheOwnership db =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+      invoke $ glean_rocksdb_cache_ownership db_ptr
+
+  prepareFactOwnerCache db =
+    unsafeWithForeignPtr (dbPtr db) $ \db_ptr ->
+      invoke $ glean_rocksdb_prepare_fact_owner_cache db_ptr
+
+  getTotalCapacity rocksdb = do
+    exists <- doesDirectoryExist (rocksRoot rocksdb)
+    if exists
+      then Just <$> getDiskSize (rocksRoot rocksdb)
+      else return Nothing
+
+  getUsedCapacity rocksdb = do
+    exists <- doesDirectoryExist (rocksRoot rocksdb)
+    if exists
+      then Just <$> getUsedDiskSpace (rocksRoot rocksdb)
+      else return Nothing
+
+  getFreeCapacity = getFreeDiskSpace . rocksRoot
+
+  withScratchRoot rocks f = f $ rocksRoot rocks </> ".scratch"
+
+  backup db scratch process = do
+    createDirectoryIfMissing True path
+    withContainer db $ \s_ptr ->
+      withCString path $ invoke . glean_rocksdb_container_backup s_ptr
+    withTempFile $ \tarFile -> do
+      tar ["-cf", tarFile, "-C", scratch, "backup"]
+      size <- getFileSize tarFile
+      process tarFile (Data $ fromIntegral size)
+    where
+      path = scratch </> "backup"
+
+  restore rocks repo scratch scratch_file =
+    withTempDirectory scratch "restore" $ \scratch_restore -> do
+      unTar scratch_file scratch_restore
+      -- to avoid retaining an extra copy of the DB during restore,
+      -- delete the input file now.
+      removeFile scratch_file
+
+      -- If the tarfile contains "backup/.." then it is a RocksDB backup
+      -- If the tarfile contains "db/.." then it is a plain tarball of the DB
+      let scratch_restore_backup = scratch_restore </> "backup"
+      is_rocksdb_backup <- doesDirectoryExist scratch_restore_backup
+      db <-
+        if is_rocksdb_backup
+          then do
+            let scratch_db = scratch </> "db"
+            createDirectoryIfMissing True scratch_db
+            withCString scratch_db $ \p_target ->
+              withCString (scratch_restore </> "backup") $ \p_source ->
+                invoke $ glean_rocksdb_restore p_target p_source
+            return scratch_db
+          else do
+            let scratch_restore_db = scratch_restore </> "db"
+            is_copy <- doesDirectoryExist scratch_restore_db
+            if is_copy
+              then return scratch_restore_db
+              else throwIO $ userError "unrecognised backup"
+
+      let target = containerPath rocks repo
+      createDirectoryIfMissing True $ takeDirectory target
+      renameDirectory db target
+
+
+unTar :: FilePath -> FilePath -> IO ()
+unTar scratch_file scratch_restore =
+  tar ["-xf", scratch_file, "-C", scratch_restore]
+
+tar :: [String] -> IO ()
+tar args = do
+  tarPath <- findExecutable "tar"
+  case tarPath of
+    Nothing  -> throwIO $ userError "Cannot find tar executable"
+    Just path -> do
+      (ec, _, err) <- readProcessWithExitCode path args ""
+      unless (ec == ExitSuccess) $ throwIO $ userError err
+
+containerPath :: RocksDB -> Repo -> FilePath
+containerPath RocksDB{..} repo = databasePath rocksRoot repo </> "db"
+
+instance CanLookup (Database RocksDB) where
+  lookupName db = "rocksdb:" <> repoToText (dbRepo db)
+  withLookup db f = unsafeWithForeignPtr (dbPtr db) $
+    f . glean_rocksdb_database_lookup
+
+withContainer :: Database RocksDB -> (Container -> IO a) -> IO a
+withContainer db f = unsafeWithForeignPtr (dbPtr db) $
+  f . glean_rocksdb_database_container
+
+foreign import ccall unsafe glean_rocksdb_new_cache
+  :: CSize -> Ptr (Ptr Cache) -> IO CString
+foreign import ccall unsafe "&glean_rocksdb_free_cache"
+  glean_rocksdb_free_cache :: Destroy Cache
+
+
+foreign import ccall safe glean_rocksdb_container_open
+  :: CString
+  -> CInt
+  -> CBool
+  -> Ptr Cache
+  -> Ptr Container
+  -> IO CString
+foreign import ccall safe glean_rocksdb_container_free
+  :: Container -> IO ()
+
+foreign import ccall safe glean_rocksdb_container_close
+  :: Container -> IO ()
+
+foreign import ccall unsafe glean_rocksdb_container_write_data
+  :: Container
+  -> Ptr ()
+  -> CSize
+  -> Ptr ()
+  -> CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_container_read_data
+  :: Container
+  -> Ptr ()
+  -> CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> Ptr CChar
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_container_optimize
+  :: Container -> CBool -> IO CString
+
+foreign import ccall safe glean_rocksdb_container_backup
+  :: Container -> CString -> IO CString
+
+foreign import ccall safe glean_rocksdb_container_open_database
+  :: Container
+  -> Fid
+  -> UsetId
+  -> Int64
+  -> Ptr (Ptr (Database RocksDB))
+  -> IO CString
+foreign import ccall safe "&glean_rocksdb_database_free"
+  glean_rocksdb_database_free :: Destroy (Database RocksDB)
+
+foreign import ccall unsafe glean_rocksdb_database_container
+  :: Ptr (Database RocksDB) -> Container
+
+foreign import ccall unsafe glean_rocksdb_database_lookup
+  :: Ptr (Database RocksDB) -> Ptr Lookup
+
+foreign import ccall safe glean_rocksdb_commit
+  :: Ptr (Database RocksDB)
+  -> Ptr FactSet
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_add_ownership
+  :: Ptr (Database RocksDB)
+  -> CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> Ptr (Ptr Fid)
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_get_ownership_unit_iterator
+  :: Ptr (Database RocksDB)
+  -> Ptr Ownership.UnitIterator
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_database_predicateStats
+  :: Ptr (Database RocksDB)
+  -> Ptr CSize
+  -> Ptr (Ptr Int64)
+  -> Ptr (Ptr Word64)
+  -> Ptr (Ptr Word64)
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_restore
+  :: CString
+  -> CString
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_get_unit_id
+  :: Ptr (Database RocksDB)
+  -> Ptr ()
+  -> CSize
+  -> Ptr Word64
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_get_unit
+  :: Ptr (Database RocksDB)
+  -> UnitId
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_store_ownership
+  :: Ptr (Database RocksDB)
+  -> Ptr ComputedOwnership
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_get_ownership
+  :: Ptr (Database RocksDB)
+  -> Ptr (Ptr Ownership)
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_add_define_ownership
+  :: Ptr (Database RocksDB)
+  -> Ptr DefineOwnership
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_get_derived_fact_ownership_iterator
+  :: Ptr (Database RocksDB)
+  -> Word64
+  -> Ptr Ownership.DerivedFactOwnershipIterator
+  -> IO CString
+
+foreign import ccall unsafe glean_rocksdb_cache_ownership
+  :: Ptr (Database RocksDB)
+  -> IO CString
+
+foreign import ccall safe glean_rocksdb_prepare_fact_owner_cache
+  :: Ptr (Database RocksDB)
+  -> IO CString
diff --git a/glean/db/Glean/Database/Trace.hs b/glean/db/Glean/Database/Trace.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Trace.hs
@@ -0,0 +1,46 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Trace
+  ( GleanTrace(..)
+  , WriteTraceEvent(..)
+  , EnqueueTraceEvent(..)
+  ) where
+
+import Data.Word
+import TextShow
+
+import qualified Glean.Types as Thrift
+
+data GleanTrace
+  = GleanTraceWrite !Thrift.Repo !WriteTraceEvent !Word64
+  | GleanTraceEnqueue !Thrift.Repo EnqueueTraceEvent !Int
+  | GleanTraceDownload !Thrift.Repo
+  | GleanTraceStorageRestore
+  | GleanTraceSiteRestore
+  | GleanTraceFinishRestore
+
+data WriteTraceEvent
+  = WriteTraceInput
+  | WriteTraceRename
+  | WriteTraceCommit
+
+instance TextShow WriteTraceEvent where
+  showb WriteTraceInput = "input"
+  showb WriteTraceRename = "rename"
+  showb WriteTraceCommit = "commit"
+
+data EnqueueTraceEvent
+  = EnqueueBatch
+  | EnqueueJsonBatch
+  | EnqueueBatchDescriptor
+  | EnqueueJsonBatchBS
+  deriving Show
+
+instance TextShow EnqueueTraceEvent where
+  showb = fromString . show
diff --git a/glean/db/Glean/Database/Types.hs b/glean/db/Glean/Database/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Types.hs
@@ -0,0 +1,272 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Types (
+  Writing(..), OpenDB(..), DBState(..),
+  Write(..), WriteContent(..),
+  DB(..),
+  Env(..), WriteQueues(..), WriteQueue(..), WriteJob(..),
+  Derivation(..),
+  EnableRecursion(..),
+  JanitorRunResult(..), JanitorException(..),
+  DebugFlags(..),
+) where
+
+import Control.DeepSeq
+import Control.Concurrent.Async
+import Control.Concurrent.MVar (MVar)
+import Control.Exception
+import Control.Trace (Tracer)
+import Data.ByteString (ByteString)
+import Data.HashMap.Strict (HashMap)
+import Data.HashSet (HashSet)
+import Data.IORef (IORef)
+import Data.Text (Text)
+import Data.Typeable (Typeable)
+import Data.Time
+import System.Clock
+
+import Data.RateLimiterMap
+import Util.EventBase (EventBaseDataplane)
+import Util.STM
+
+import Glean.Angle.Types hiding (describe)
+import qualified Glean.Database.Backup.Backend as Backup
+import qualified Glean.Database.BatchLocation as BatchLocation
+import Glean.Database.Catalog (Catalog)
+import Glean.Database.Config
+import Glean.Database.Meta
+import Glean.Database.Schema.Types
+import Glean.Database.Storage (Database, Storage, describe, WriteLock(..))
+import Glean.Database.Trace
+import Glean.Logger.Server (GleanServerLogger)
+import Glean.Logger.Database (GleanDatabaseLogger)
+import Glean.RTS.Foreign.FactSet (FactSet)
+import Glean.RTS.Foreign.LookupCache (LookupCache)
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import Glean.RTS.Foreign.Ownership (Ownership, Slice, DefineOwnership)
+import Glean.RTS.Foreign.Subst (Subst)
+import Glean.RTS.Types (Fid(..))
+import qualified Glean.ServerConfig.Types as ServerConfig
+import qualified Glean.Types as Thrift
+import Glean.Util.Metric (Point)
+import Glean.Util.Mutex
+import Glean.Util.Observed
+import Glean.Util.ShardManager
+import Glean.Util.Some
+import Util.Time
+import Glean.Util.Trace (Listener)
+import Glean.Util.Warden
+import Glean.Write.Stats (Stats)
+
+-- Write caches
+data Writing = Writing
+  { -- Write lock
+    wrLock :: Mutex (WriteLock ())
+
+    -- First free Id in the write pipeline
+  , wrNextId :: IORef Fid
+
+    -- Write cache
+  , wrLookupCache :: LookupCache
+  , wrLookupCacheAnchorName :: TVar (Maybe Text)
+
+    -- Queue of writes to this DB
+  , wrQueue :: WriteQueue
+
+    -- | If a commit is in progress, this contains the
+    -- value of 'wrNextIdId' from before the commit and
+    -- the 'FactSet' being committed.
+  , wrCommit :: TVar (Maybe (Fid, FactSet))
+  }
+
+-- An open database
+data OpenDB s = OpenDB
+  { -- The database handle
+    odbHandle :: Database s
+
+    -- Write queue, caches etc. Nothing means DB is read only.
+  , odbWriting :: Maybe Writing
+
+    -- Database schema
+  , odbSchema :: DbSchema
+
+    -- When was the database last used
+  , odbIdleSince :: TVar TimePoint
+
+    -- For a stacked DB, keep track of the slices of the base DBs.
+    -- The list starts with this DB's base, then the base's base etc.
+  , odbBaseSlices :: [Maybe Slice]
+
+    -- ownership data from the DB
+  , odbOwnership :: TVar (Maybe Ownership)
+  }
+
+-- State of a databases
+data DBState s
+    -- In the process of being open
+  = Opening
+
+    -- Currently open
+  | Open (OpenDB s)
+
+    -- In the process of being closed
+  | Closing
+
+    -- Currently closed
+  | Closed
+
+-- A known database
+data DB s = DB
+  { -- The repo the database refers to
+    dbRepo :: Thrift.Repo
+
+    -- Database state
+  , dbState :: TVar (DBState s)
+
+    -- Number of users
+  , dbUsers :: TVar Int
+  }
+
+-- | A Write in progress that we can query via pollBatch
+data Write = Write
+  { writeWait :: MVar (Either SomeException Subst)
+  , writeTimeout :: TimePoint
+  }
+
+-- | What we are going to write into the DB
+data WriteContent = WriteContent
+  { writeBatch :: !Thrift.Batch
+  , writeOwnership :: Maybe DefineOwnership
+  }
+
+-- | A Write on the WriteQueue
+data WriteJob
+  = WriteJob
+    { writeSize :: {-# UNPACK #-} !Int
+    , writeContentIO :: IO WriteContent
+    , writeDone :: MVar (Either SomeException Subst)
+    , writeStart :: Point
+    }
+  | WriteCheckpoint
+    { writeCheckpoint :: IO ()
+      -- ^ invoke this action when all the preceding writes on the
+      -- queue have completed, including those that are in progress.
+    }
+
+-- | The queue of WriteJobs and their total size
+data WriteQueue = WriteQueue
+  { writeQueue :: TQueue WriteJob
+  , writeQueueActive :: TVar Int
+     -- the number of active jobs on this write queue, used to
+     -- implement checkpoints.
+  , writeQueueCount :: TVar Int
+    -- The number of 'WriteJob' in queue (excluding WriteCheckpoint)
+  , writeQueueSize :: TVar Int
+  , writeQueueLatency :: TVar TimeSpec
+    -- latency of most recent write to this queue
+  }
+
+-- | So that we can round-robin writes to repos, have a queue of write queues
+data WriteQueues = WriteQueues
+  { writeQueues :: TQueue (Thrift.Repo, WriteQueue)
+  , writeQueuesSize :: TVar Int
+  }
+
+-- | Information about a derived stored predicate being derived
+data Derivation = Derivation
+  { derivationStart :: TimePoint
+  , derivationFinished :: Bool
+  , derivationStats :: Thrift.UserQueryStats
+  , derivationPendingWrites :: [Thrift.Handle]
+  , derivationError :: Maybe (TimePoint, SomeException)
+  , derivationHandle :: Thrift.Handle
+  }
+
+instance NFData Derivation where
+  rnf Derivation{..} =
+    derivationStart
+    `seq` derivationFinished
+    `seq` rnf derivationStats
+    `seq` rnf derivationPendingWrites
+    `seq` maybe () (`seq` ()) derivationError
+    `seq` derivationHandle
+    `seq`()
+
+data EnableRecursion
+  = EnableRecursion
+  | DisableRecursion
+
+data JanitorRunResult
+  = JanitorRunSuccess
+  | JanitorRunFailure JanitorException
+  | JanitorTimeout
+  | JanitorStuck
+  | JanitorDisabled
+  deriving Show
+
+data JanitorException
+  = OtherJanitorException SomeException
+  | JanitorFetchBackupsFailure SomeException
+    -- ^ Raised only when no remote db list available
+  deriving (Typeable, Show)
+
+instance Exception JanitorException
+
+data Env = forall storage. Storage storage => Env
+  { envEventBase :: EventBaseDataplane
+  , envServerLogger :: Some GleanServerLogger
+  , envDatabaseLogger :: Some GleanDatabaseLogger
+  , envBatchLocationParser :: Some BatchLocation.Parser
+  , envLoggerRateLimit :: RateLimiterMap Text
+  , envCatalog :: Catalog
+  , envStorage :: storage
+  , envSchemaSource :: Observed SchemaIndex
+    -- ^ The schema source, and its parsed/resolved form are both cached here.
+  , envDbSchemaCache :: MVar DbSchemaCache
+  , envUpdateSchema :: Bool
+  , envSchemaUpdateSignal :: TMVar ()
+  , envSchemaId :: Maybe Thrift.SchemaId
+    -- ^ Used to store the schema ID for the session when using the local backend
+  , envServerConfig :: Observed ServerConfig.Config
+  , envBackupBackends :: Backup.Backends
+  , envActive :: TVar (HashMap Thrift.Repo (DB storage))
+  , envDeleting :: TVar (HashMap Thrift.Repo (Async ()))
+  , envCompleting :: TVar (HashMap Thrift.Repo (Async ()))
+  , envCompletingDerived ::
+      TVar (HashMap Thrift.Repo (HashMap PredicateId (Async ())))
+  , envReadOnly :: Bool
+  , envMockWrites :: Bool
+  , envStats :: Stats
+  , envLookupCacheStats :: LookupCache.Stats
+  , envWarden :: Warden
+  , envDatabaseJanitor :: TVar (Maybe (UTCTime, JanitorRunResult))
+  , envDatabaseJanitorPublishedCounters :: TVar (HashSet ByteString)
+  , envCachedRestorableDBs :: TVar (Maybe (UTCTime, [(Thrift.Repo, Meta)]))
+  , envCachedAvailableDBs :: TVar (HashSet Thrift.Repo)
+  , envWrites :: TVar (HashMap Text Write)
+  , envDerivations :: TVar (HashMap (Thrift.Repo, PredicateId) Derivation)
+  , envWriteQueues :: WriteQueues
+  , envListener :: Listener
+      -- ^ A 'Listener' which might get notified about various events. This is
+      -- for testing support only.
+  , envGetCurrentTime :: IO UTCTime
+      -- ^ Yield the current time. Is normally getCurrentTime but
+      -- can be changed for testing
+  , envShardManager :: SomeShardManager
+  , envEnableRecursion :: EnableRecursion
+      -- ^ Experimental support for recursive queries. For testing only.
+  , envFilterAvailableDBs :: [Thrift.Repo] -> IO [Thrift.Repo]
+    -- ^ Filter out DBs not currently available in the server tier
+  , envTracer :: Tracer GleanTrace
+  , envDebug :: DebugFlags
+  }
+
+instance Show Env where
+  show Env{..} = unwords [ "Glean.Database.Types.Env {",
+    "envStorage: " <> describe envStorage, "}" ]
diff --git a/glean/db/Glean/Database/Validate.hs b/glean/db/Glean/Database/Validate.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Validate.hs
@@ -0,0 +1,23 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Validate
+  ( Validate(..)
+  , validate
+  ) where
+
+import Glean.Database.Open
+import Glean.Database.Schema
+import Glean.Database.Types
+import Glean.RTS.Foreign.Inventory (Validate(..))
+import qualified Glean.RTS.Foreign.Inventory as Inventory
+import Glean.Types
+
+validate :: Env -> Repo -> Validate -> IO ()
+validate env repo val = readDatabase env repo $ \odb db ->
+  Inventory.validate (schemaInventory (odbSchema odb)) val db
diff --git a/glean/db/Glean/Database/Write/Batch.hs b/glean/db/Glean/Database/Write/Batch.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Write/Batch.hs
@@ -0,0 +1,335 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Write.Batch
+  ( syncWriteDatabase
+  , syncWriteContentDatabase
+  , writeDatabase
+  , writeContentFromBatch
+  ) where
+
+import Control.Exception
+import Control.Monad.Extra
+import Control.Trace (traceMsg)
+import qualified Data.ByteString as BS
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashMap.Strict (HashMap)
+import Data.Default
+import Data.Int (Int64)
+import Data.IORef
+import Data.Maybe
+import Data.Word
+
+import Util.Control.Exception
+import Util.STM
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Open
+import Glean.Database.Exception
+import Glean.Database.Repo
+import qualified Glean.Database.Storage as Storage
+import Glean.Database.Schema
+import Glean.Database.Trace
+import Glean.Database.Types
+import Glean.FFI
+import Glean.Internal.Types as Thrift
+import Glean.RTS.Foreign.Define (trustRefs)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Lookup (Lookup, withCanLookup)
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import Glean.RTS.Foreign.Ownership as Ownership
+import Glean.RTS.Foreign.Stacked (stacked)
+import Glean.RTS.Foreign.Subst (Subst)
+import qualified Glean.RTS.Foreign.Subst as Subst
+import Glean.RTS.Types (Pid(..), Fid(..))
+import Glean.Types (Repo)
+import qualified Glean.Types as Thrift
+import Glean.Util.Metric
+import Glean.Util.Mutex
+import Glean.Util.Vector
+import qualified Glean.Write.Stats as Stats
+
+writeContentFromBatch :: Thrift.Batch -> WriteContent
+writeContentFromBatch writeBatch = WriteContent
+  { writeBatch = writeBatch
+  , writeOwnership = Nothing
+  }
+
+syncWriteDatabase
+  :: Env
+  -> Repo
+  -> Thrift.Batch
+  -> IO Subst
+syncWriteDatabase env repo batch =
+  syncWriteContentDatabase env repo (writeContentFromBatch batch)
+
+syncWriteContentDatabase :: Env -> Repo -> WriteContent -> IO Subst
+syncWriteContentDatabase env repo content = do
+  tick <- beginTick 1
+  writeDatabase env repo content tick
+
+makeDefineOwnership
+  :: Env
+  -> Repo
+  -> Fid
+  -> HashMap Int64 [Thrift.FactDependencies]
+  -> IO (Maybe DefineOwnership)
+makeDefineOwnership env repo nextId deps
+  | HashMap.null deps = return Nothing
+  | otherwise = do
+  readDatabase env repo $ \odb lookup -> do
+  maybeOwnership <- readTVarIO (odbOwnership odb)
+  forM maybeOwnership $ \ownership -> do
+    define <- Ownership.newDefineOwnership ownership nextId
+    forM_ (HashMap.toList deps) $ \(pid, ownerMap) ->
+      Ownership.addDerivedOwners lookup define (Pid pid) ownerMap
+    return define
+
+checkWritable :: Repo -> OpenDB s -> IO Writing
+checkWritable repo OpenDB{..} =
+  case odbWriting of
+    Nothing -> dbError repo "can't write to a read only database"
+    Just writing -> return writing
+
+-- | We can only add fact ownership *before* @glean complete@, otherwise
+-- it won't get propagated. Similarly, we can only add facts with
+-- explicit dependencies *after* @glean complete@.
+checkComplete :: Env -> Repo -> Thrift.Batch -> IO ()
+checkComplete env repo Thrift.Batch{..} = do
+  when (not $ HashMap.null batch_owned) $ do
+    meta <- atomically $ Catalog.readMeta (envCatalog env) repo
+    when (metaAxiomComplete meta) $
+      throwIO $ Thrift.Exception
+        "Attempting to write facts with ownership after 'glean complete'"
+  when (not $ HashMap.null batch_dependencies) $ do
+    -- TODO: enforce that not only the axiom predicates be complete
+    -- but that every predicate depended upon be complete.
+    meta <- atomically $ Catalog.readMeta (envCatalog env) repo
+    when (not (metaAxiomComplete meta)) $
+      throwIO $ Thrift.Exception
+        "Attempting to write facts with dependencies before 'glean complete'"
+
+-- | Write a batch of facts to the database, returning a substitution
+writeDatabase
+  :: Env
+  -> Repo
+  -> WriteContent
+  -> Point
+  -> IO Subst
+writeDatabase env repo WriteContent{..} latency =
+  readDatabase env repo $ \odb lookup -> do
+    writing <- checkWritable repo odb
+    checkComplete env repo writeBatch
+    Stats.bump (envStats env) Stats.mutatorLatency =<< endTick latency
+    let !size = batchSize writeBatch
+
+    tick env repo WriteTraceInput Stats.mutatorInput size $ do
+      -- If nobody is writing to the DB just write the batch directly.
+      --
+      -- TODO: What if someone is already deduplicating another batch? Should we
+      -- not write in that case?
+      r <- tryWithMutexSafe (wrLock writing) $ \lock ->
+        reallyWriteBatch
+          env repo odb lock lookup writing size False writeBatch writeOwnership
+      case r of
+        Just cont -> cont
+        Nothing ->
+          -- Somebody is already writing to the DB - deduplicate the batch
+          deDupBatch env repo odb lookup writing size writeBatch writeOwnership
+
+reallyWriteBatch
+  :: Storage.Storage s
+  => Env
+  -> Repo
+  -> OpenDB s
+  -> Storage.WriteLock w
+  -> Lookup
+  -> Writing
+  -> Word64  -- ^ original size of the batch
+  -> Bool  -- ^ has the batch already been de-duped?
+  -> Thrift.Batch
+  -> Maybe DefineOwnership
+  -> IO (IO Subst)
+reallyWriteBatch env repo OpenDB{..} lock lookup writing original_size deduped
+    batch@Thrift.Batch{..} maybeOwn = do
+  let !real_size = batchSize batch
+  Stats.tick (envStats env) Stats.mutatorThroughput original_size
+    $ Stats.tick (envStats env)
+        (if deduped
+          then Stats.mutatorDedupedThroughput
+          else Stats.mutatorDupThroughput) real_size
+    $ do
+
+    next_id <- readIORef (wrNextId writing)
+
+    (facts, subst) <-
+      logExceptions (\s -> inRepo repo $ "rename error: " ++ s) $
+        tick env repo WriteTraceRename Stats.renameThroughput real_size $ do
+          let withBase f = do
+                r <- readTVarIO (wrCommit writing)
+                case r of
+                  Nothing -> f lookup
+                  Just (_, facts) -> withCanLookup (stacked lookup facts) f
+          withBase $ \base -> do
+            withLookupCache writing base $ \cache -> do
+              FactSet.renameFacts
+                (schemaInventory odbSchema)
+                cache
+                next_id
+                batch
+                def { trustRefs = deduped }
+
+    logExceptions (\s -> inRepo repo $ "commit error: " ++ s) $ do
+      updateLookupCacheStats env
+
+      let
+        commitOwnership = do
+          let apply v = unsafeCoerceVector <$>
+                Subst.unsafeSubstIntervalsAndRelease subst
+                  (unsafeCoerceVector v)
+          owned <- mapM apply batch_owned
+          Storage.addOwnership odbHandle lock owned
+          deps <- mapM (substDependencies subst) batch_dependencies
+          derivedOwners <-
+            if | Just owners <- maybeOwn -> do
+                  Ownership.substDefineOwnership owners subst
+                  return $ Just owners
+               | not $ HashMap.null deps ->
+                  makeDefineOwnership env repo next_id deps
+               | otherwise -> return Nothing
+          forM_ derivedOwners $ \ownBatch ->
+            Storage.addDefineOwnership odbHandle lock ownBatch
+
+        doCommit =
+          tick env repo WriteTraceCommit
+            Stats.commitThroughput real_size $ do
+              Storage.commit odbHandle facts
+
+      -- we're going to perform the actual commit outside the write
+      -- lock, so that the next batch can start renaming while we're
+      -- committing. But the next rename will need the current batch
+      -- to de-duplicate against, so we save it in wrCommit. There can
+      -- only be one commit happening at a time and there's no way to
+      -- queue more than one pending commit currently.
+      commit <-
+        if envMockWrites env
+          then do release facts; return (return ())
+          else do
+            commitOwnership -- must be done under the write lock
+            atomically $ do
+               m <- readTVar (wrCommit writing)
+               case m of
+                 Just{} -> retry
+                 Nothing -> writeTVar (wrCommit writing) (Just (next_id, facts))
+            return $
+              doCommit
+                `finally`
+              do atomically $ writeTVar (wrCommit writing) Nothing
+                 withMutexSafe (wrLock writing) $ const $ release facts
+
+      new_next_id <- Lookup.firstFreeId facts
+      atomicWriteIORef (wrNextId writing) new_next_id
+      return (commit >> return subst)
+        -- commit takes place outside the write lock
+
+deDupBatch
+  :: Storage.Storage s
+  => Env
+  -> Repo
+  -> OpenDB s
+  -> Lookup
+  -> Writing
+  -> Word64
+  -> Thrift.Batch
+  -> Maybe DefineOwnership
+  -> IO Subst
+deDupBatch env repo odb lookup writing original_size
+    batch@Thrift.Batch{..} maybeOwn =
+  logExceptions (\s -> inRepo repo $ "dedup error: " ++ s) $ do
+    next_id <- do
+      r <- readTVarIO (wrCommit writing)
+      -- if there is a commit in progress, we use the ID boundary
+      -- before that commit for the snapshot.
+      case r of
+        Just (commit_id, _) -> return commit_id
+        _otherwise -> readIORef $ wrNextId writing
+    (maybe_deduped_batch, dsubst) <- bracket
+      (
+        withLookupCache writing lookup $ \cache ->
+        -- We need a snapshot here because we don't want lookups to
+        -- return fact ids which conflict with ids in the renamed batch.
+        Lookup.withSnapshot cache next_id $ \snapshot ->
+          FactSet.renameFacts
+            (schemaInventory (odbSchema odb))
+            snapshot
+            next_id
+            batch
+            def
+      )
+      (\(deduped_facts, _) -> release deduped_facts)
+        -- release the FactSet now that we're done with it, don't wait for
+        -- the GC to free it.
+      (\(deduped_facts, dsubst) -> do
+        factCount <- FactSet.factCount deduped_facts
+        if factCount == 0 && isNothing maybeOwn then
+          return (Nothing, dsubst)
+        else do
+          deduped_batch <- FactSet.serialize deduped_facts
+          return (Just deduped_batch, dsubst)
+      )
+
+    case maybe_deduped_batch of
+      Nothing -> return dsubst
+      Just deduped_batch -> do
+        let apply v = unsafeCoerceVector <$>
+              Subst.unsafeSubstIntervalsAndRelease dsubst
+                (unsafeCoerceVector v)
+        is <- mapM apply batch_owned
+        deps <- mapM (substDependencies dsubst) batch_dependencies
+        forM_ maybeOwn $ \ownBatch ->
+          Ownership.substDefineOwnership ownBatch dsubst
+        -- And now write it do the DB, deduplicating again
+        cont <- withMutexSafe (wrLock writing) $ \lock ->
+          reallyWriteBatch env repo odb lock lookup writing original_size True
+            deduped_batch
+              { Thrift.batch_owned = is
+              , Thrift.batch_dependencies = deps
+              }
+            maybeOwn
+        wsubst <- cont
+        return $ dsubst <> wsubst
+
+withLookupCache
+  :: Writing
+  -> Lookup.Lookup
+  -> (Lookup.Lookup -> IO a)
+  -> IO a
+withLookupCache Writing{..} lookup f = do
+  LookupCache.withCache lookup wrLookupCache LookupCache.FIFO f
+
+substDependencies
+ :: Subst
+ -> [Thrift.FactDependencies]
+ -> IO [Thrift.FactDependencies]
+substDependencies subst dmap = mapM substFD dmap
+  where
+  substFD (Thrift.FactDependencies facts deps) = do
+    Thrift.FactDependencies <$> apply facts <*> apply deps
+  apply v =
+    unsafeCoerceVector <$>
+      Subst.substVector subst (unsafeCoerceVector v)
+
+batchSize :: Thrift.Batch -> Word64
+batchSize = fromIntegral . BS.length . Thrift.batch_facts
+
+tick
+  :: Env -> Repo -> WriteTraceEvent -> Stats.Bump Tick -> Word64 -> IO a -> IO a
+tick env repo event ticker value cont =
+  traceMsg (envTracer env) (GleanTraceWrite repo event value)
+  $ Stats.tick (envStats env) ticker value cont
diff --git a/glean/db/Glean/Database/Writes.hs b/glean/db/Glean/Database/Writes.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Database/Writes.hs
@@ -0,0 +1,480 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Server-side write queue implementation.  Currently this is just a
+-- layer that makes every write operation asynchronous with support
+-- for polling the status of a previous write.
+--
+-- Rationale: why are writes async?
+--
+-- The alternative is to put writes into a separate Thrift queue with
+-- a lower priority, to avoid writes from blocking other
+-- requests. This would work, but under heavy write load we would
+-- still have a lot of concurrent open connections to the server,
+-- which is not ideal.
+--
+-- Longer term we might want to completely separate the write queue,
+-- e.g. using Scribe, so making the write API async is a step in the
+-- right direction.
+--
+-- ToDo:
+--   - make it a bounded queue
+--   - add logging for the size of the queue etc.
+--   - decode JSON eagerly but do writes async, so that we can
+--     parallelise the JSON writing. Might run into issues with the
+--     decoded JSON taking more space and adding GC overhead.
+
+module Glean.Database.Writes
+  ( enqueueBatch
+  , enqueueJsonBatch
+  , enqueueBatchDescriptor
+  , enqueueCheckpoint
+  , pollBatch
+  , reapWrites
+  , writerThread
+  , deleteWriteQueues
+  , batchOwnedSize
+  , batchDependenciesSize
+  ) where
+
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import Control.Monad.Extra (whenM)
+import Control.Trace (traceMsg)
+import qualified Data.ByteString as ByteString
+import Data.Default
+import Data.Either
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Map as Map
+import qualified Data.Monoid as Monoid
+import Data.Text as Text (Text)
+import qualified Data.Text.Encoding as Text
+import qualified Data.UUID as UUID
+import qualified Data.UUID.V4 as UUID
+import qualified Data.Vector.Storable as VS
+import Foreign.Storable
+import System.Clock
+import System.Timeout
+import Text.Printf
+
+import ServiceData.GlobalStats
+import ServiceData.Types
+import Util.Control.Exception
+import Util.Defer
+import Util.Log
+import Util.STM
+
+import Glean.Database.BatchLocation as BatchLocation
+import Glean.Database.Exception
+import Glean.Database.Open
+import Glean.Database.Schema.Types
+import Glean.Database.Trace
+import Glean.Database.Write.Batch
+import Glean.Database.Types
+import qualified Glean.RTS.Foreign.Subst as Subst
+import Glean.RTS.Foreign.Ownership (DefineOwnership)
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types as Thrift hiding (Database)
+import Glean.Write.JSON
+import Glean.Util.Metric
+import Glean.Util.Observed as Observed
+import Util.Time
+
+{-
+Write Queue Monitoring
+----------------------
+
+glean.db.write.failed.avg.60
+  Total size of write batches that failed (kB)
+
+glean.db.write.succeeded.avg.60
+  Total size of write batches that succeeded (kB)
+
+glean.db.write.queue.avg.60
+  Total size of write queues (kB)
+
+glean.db.write.queue.<repo>.avg.60
+  Size of write queues for <repo> (kB)
+
+glean.db.write.enqueued.avg.60
+  Total size of write batches enqueued (kB)
+
+glean.db.write.rejected.avg.60
+  Total size of write batches rejected due to queue limit (kB)
+-}
+
+-- | Create threads to process the write queues
+writerThread :: Env -> WriteQueues -> IO ()
+writerThread env WriteQueues{..} = mask $ \restore ->
+  forever $ handler restore $
+    void $ tryBracket
+      dequeue
+      done
+      execute
+ where
+  done (Just (WriteJob{..}, repo, WriteQueue{..})) result = do
+    latency <- do
+      writeEnd <- getTime Monotonic
+      return (writeEnd - pointStart writeStart)
+    if isLeft result then
+      addStatValueType "glean.db.write.failed" (writeSize `div` k) Sum
+    else
+      addStatValueType "glean.db.write.succeeded" (writeSize `div` k) Sum
+    immediately $ do
+      now $ writeTVar writeQueueLatency latency
+      now $ modifyTVar' writeQueueActive (subtract 1)
+      queueCount <- now $ updateTVar writeQueueCount (subtract 1)
+      qSize <- now $ updateTVar writeQueueSize (subtract writeSize)
+      size <- now $ updateTVar writeQueuesSize (subtract writeSize)
+      later $ reportQueueSizes repo queueCount qSize size (Just latency)
+    -- don't put the MVar until we have updated writeQueueActive, otherwise
+    -- there is a race condition with finish database which will fail because
+    -- active /= 0.
+    void $ tryPutMVar writeDone result
+  done _ _ = return ()
+
+  handler restore action = do
+    r <- tryAll (restore action)
+    case r of
+      Left e -> do logError (show e); return ()
+      Right () -> return ()
+
+  dequeue = atomically $ dequeueLoop (pure ())
+
+  -- Round-robin processing of write queues.
+  --  * If we take a job from a queue, and it has other jobs left,
+  --    we put it to the back of writeQueues
+  --  * If we hit a checkpoint that's not ready, we keep looking
+  --    and put the queue with the checkpoint to the back of
+  --    writeQueues
+  --  * But if there are only queues with checkpoints that aren't
+  --    ready, we will block and not busy-wait.
+  --
+  -- This is an O(n) transaction which could be bad, but in
+  -- practice the number of queues with checkpoints will be small.
+  dequeueLoop requeueCheckpoints = do
+    (repo, queue@WriteQueue{..}) <- readTQueue writeQueues
+    maybeJob <- tryReadTQueue writeQueue
+    case maybeJob of
+      Nothing -> do requeueCheckpoints; return Nothing
+      Just job -> do
+        let
+          requeue = do
+            requeueCheckpoints
+            whenM (not <$> isEmptyTQueue writeQueue) $
+              writeTQueue writeQueues (repo, queue)
+        case job of
+          WriteJob{} -> do
+            requeue
+            modifyTVar' writeQueueActive (+1)
+            return (Just (job, repo, queue))
+          WriteCheckpoint{} -> do
+            active <- readTVar writeQueueActive
+            if active == 0  -- we get to execute the action
+              then do requeue; return (Just (job, repo, queue))
+              else do unGetTQueue writeQueue job; dequeueLoop requeue
+
+  execute (Just (WriteJob{..}, repo, _)) = do
+    writeContent <- writeContentIO
+    writeDatabase env repo writeContent writeStart
+  execute (Just (WriteCheckpoint io, _, _)) = do io; return Subst.empty
+  execute _ = return Subst.empty
+
+-- | Check and update the in-memory write queue size
+checkMemoryAvailable
+  :: Env
+  -> ServerConfig.Config
+  -> Int -- ^ requested size
+  -> STM Bool
+checkMemoryAvailable Env{..} ServerConfig.Config{..} size = do
+  let WriteQueues{..} = envWriteQueues
+  pending <- readTVar writeQueuesSize
+  let !newSize = pending + size
+  if roundUp mb newSize <= fromIntegral config_db_write_queue_limit_mb
+    then do
+      writeTVar writeQueuesSize newSize
+      return True
+    else return False
+
+-- | Update stats and throw a Retry exception
+rejectWrite :: Repo -> Int -> Double -> IO retry
+rejectWrite repo size elapsed = do
+  let clamped = min 1000.0 $ max 1.0 elapsed
+      repoB = Text.encodeUtf8 (repo_name repo)
+  addStatValueType "glean.db.write.rejected" (size `div` k) Sum
+  addStatValueType ("glean.db.write.retry_ms." <> repoB)
+    (round (elapsed*1000)) Avg
+  throwIO (Retry clamped)
+
+-- | Add a write job to the queue, or throw 'Retry' if no memory available
+enqueueWrite
+  :: Env
+  -> Repo
+  -> Int
+  -> Maybe SchemaId
+  -> Bool
+  -> IO WriteContent
+  -> IO (MVar (Either SomeException Subst.Subst))
+enqueueWrite env@Env{..} repo size optSchemaId checkQueueSize writeContent = do
+  start <- beginTick 1
+  config <- Observed.get envServerConfig
+  mvar <- newEmptyMVar
+  withWritableDatabase env repo $ \(queue@WriteQueue{..}, odbSchema) -> do
+
+  -- check the schema ID in the batch matches the DB
+  case optSchemaId of
+    Just schemaId | ServerConfig.config_check_write_schema_id config ->
+      when (not (Map.member schemaId (schemaEnvs odbSchema))) $
+        dbError repo $ printf
+          "schema ID in batch (%s) does not match schema ID of DB (%s)"
+          (unSchemaId schemaId)
+          (show (Map.keys (schemaEnvs odbSchema)))
+    _ -> return ()
+
+  let WriteQueues{..} = envWriteQueues
+      enqueueIt = do
+        pending <- now $ readTVar writeQueuesSize
+        let !newSize = pending + size
+        now $ do
+          addToWriteQueue
+            repo
+            queue
+            envWriteQueues
+            WriteJob
+              { writeSize = size
+              , writeContentIO = writeContent
+              , writeDone = mvar
+              , writeStart = start }
+        queueCount <- now $ updateTVar writeQueueCount (+1)
+        queueSize <- now $ updateTVar writeQueueSize (+ size)
+        later $ do
+          addStatValueType "glean.db.write.enqueued" (size `div` k) Sum
+          reportQueueSizes repo queueCount queueSize newSize Nothing
+  immediately $ do
+    check <- if checkQueueSize
+      then now $ checkMemoryAvailable env config size
+      else return True
+    if check then enqueueIt else do
+      latency <- now $ readTVar writeQueueLatency
+      let elapsed = fromIntegral (toNanoSecs latency) / 1000000000.0
+      later $ rejectWrite repo size elapsed
+  return mvar
+
+-- | Add a checkpoint to the write queue, which will be performed when
+-- all previous writes have completed.
+enqueueCheckpoint
+  :: Env
+  -> Repo
+  -> IO ()
+  -> IO ()
+enqueueCheckpoint env repo io = withWritableDatabase env repo $ \(queue, _) ->
+  atomically $ void $
+    addToWriteQueue repo queue (envWriteQueues env) (WriteCheckpoint io)
+
+addToWriteQueue
+  :: Repo
+  -> WriteQueue
+  -> WriteQueues
+  -> WriteJob
+  -> STM ()
+addToWriteQueue repo queue@WriteQueue{..} WriteQueues{..} job = do
+  wasEmpty <- isEmptyTQueue writeQueue
+  writeTQueue writeQueue job
+  -- if this repo previously had no writes, add it to the round-robin
+  when wasEmpty $ writeTQueue writeQueues (repo, queue)
+
+reportQueueSizes :: Repo -> Int -> Int -> Int -> Maybe TimeSpec -> IO ()
+reportQueueSizes repo repoQueueCount repoQueueSize totalQueueSize mLatency = do
+  let repoB = Text.encodeUtf8 (repo_name repo)
+  addStatValueType ("glean.db.write.queue_count." <> repoB) repoQueueCount Avg
+  addStatValueType ("glean.db.write.queue." <> repoB) (repoQueueSize `div` k)
+    Avg
+  addStatValueType "glean.db.write.queue" (totalQueueSize `div` k) Avg
+  forM_ mLatency $ \ latency -> do
+    let elapsedMilliSeconds = fromInteger (toNanoSecs latency `div` 1000000)
+    when (elapsedMilliSeconds > 0) $
+      addStatValueType ("glean.db.write.queue_ms." <> repoB)
+        elapsedMilliSeconds Avg
+
+enqueueBatch :: Env -> ComputedBatch -> Maybe DefineOwnership -> IO SendResponse
+enqueueBatch env ComputedBatch{..} ownership = do
+  let size = ByteString.length (batch_facts computedBatch_batch)
+  traceMsg (envTracer env)
+    (GleanTraceEnqueue computedBatch_repo EnqueueBatch size) $ do
+  -- NOTE: we use UUIDs here rather than, say, consecutive
+  -- numbers because we want to avoid conflicts when the
+  -- server restarts/crashes
+  handle <- UUID.toText <$> UUID.nextRandom
+
+  let size = batchSize computedBatch_batch
+      optSchemaId = batch_schema_id computedBatch_batch
+  r <- try $ enqueueWrite env computedBatch_repo size optSchemaId True $ pure $
+        (writeContentFromBatch computedBatch_batch) {
+          writeOwnership= ownership
+        }
+  case r of
+    -- ToDo: make sendBatch use Retry exceptions instead of results too
+    Left (Retry n) ->
+      return $ Thrift.SendResponse_retry (BatchRetry n)
+    Right write -> do
+     when computedBatch_remember $ rememberWrite env handle write
+     return $ Thrift.SendResponse_handle handle
+
+batchSize :: Thrift.Batch -> Int
+batchSize Thrift.Batch{..} =
+  ByteString.length batch_facts +
+  batchOwnedSize batch_owned +
+  batchDependenciesSize batch_dependencies
+
+batchOwnedSize :: HashMap UnitName ListOfIds -> Int
+batchOwnedSize = Monoid.getSum . foldMap (Monoid.Sum . storableSize)
+
+batchDependenciesSize :: HashMap Id [FactDependencies] -> Int
+batchDependenciesSize deps =
+  Monoid.getSum (foldMap (Monoid.Sum . depsSize) deps)
+  where
+  depsSize deps = sum
+    [ storableSize f + storableSize d
+    | FactDependencies f d <- deps
+    ]
+
+storableSize :: forall a . VS.Storable a => VS.Vector a -> Int
+storableSize = (sizeOf (undefined :: a) *) . snd . VS.unsafeToForeignPtr0
+
+enqueueJsonBatch
+  :: Env
+  -> Repo
+  -> Thrift.SendJsonBatch
+  -> IO Thrift.SendJsonBatchResponse
+enqueueJsonBatch env repo batch = do
+  let
+    jsonFactBatchSize JsonFactBatch{..} =
+      sum (map ByteString.length jsonFactBatch_facts) +
+      maybe 0 ByteString.length jsonFactBatch_unit
+    size = sum (map jsonFactBatchSize (sendJsonBatch_batches batch))
+  traceMsg (envTracer env) (GleanTraceEnqueue repo EnqueueJsonBatch size) $ do
+  handle <- UUID.toText <$> UUID.nextRandom
+  let optSchemaId =
+        sendJsonBatch_options batch >>= sendJsonBatchOptions_schema_id
+  write <- enqueueWrite env repo size optSchemaId True $
+    writeJsonBatch env repo batch
+  when (sendJsonBatch_remember batch) $ rememberWrite env handle write
+  return $ def { sendJsonBatchResponse_handle = handle }
+
+enqueueBatchDescriptor
+  :: Env
+  -> Repo
+  -> EnqueueBatch
+  -> EnqueueBatchWaitPolicy
+  -> IO Thrift.EnqueueBatchResponse
+enqueueBatchDescriptor env repo enqueueBatch waitPolicy = do
+  traceMsg (envTracer env)
+    (GleanTraceEnqueue repo EnqueueBatchDescriptor 0) $ do
+  handle <- UUID.toText <$> UUID.nextRandom
+  descriptor <- case enqueueBatch of
+    Thrift.EnqueueBatch_descriptor descriptor -> return descriptor
+    Thrift.EnqueueBatch_EMPTY -> throwIO $ Thrift.Exception "empty batch"
+  write <- enqueueWrite env repo 0 Nothing False $
+    writeContentFromBatch <$> downloadBatchFromLocation env descriptor
+  when (waitPolicy == Thrift.EnqueueBatchWaitPolicy_Remember)
+    $ rememberWrite env handle write
+  return $ def { enqueueBatchResponse_handle = handle }
+
+pollBatch :: Env -> Handle -> IO FinishResponse
+pollBatch env@Env{..} handle = do
+  r <- HashMap.lookup handle <$> readTVarIO envWrites
+  case r of
+    Just write -> do
+      -- for tiny writes that will complete in a few ms, we would like
+      -- to wait synchronously. Otherwise we'll return a Retry to the
+      -- caller which will wait 1s before polling again. In particular
+      -- all those one-second delays make tests run slowly.
+      s <- timeout 100000 $ readMVar (writeWait write)
+      case s of
+        Just x -> do
+          atomically $ void $ updateTVar envWrites $ HashMap.delete handle
+          case x of
+            Right subst ->
+              return $ Thrift.FinishResponse_subst $ Subst.serialize subst
+            Left exc -> case fromException exc of
+              Just Retry{..} -> return $ Thrift.FinishResponse_retry $
+                Thrift.BatchRetry retry_seconds
+              Nothing -> throwIO exc
+        Nothing -> do
+          timeout <- getWriteTimeout env
+          atomically
+            $ void
+            $ updateTVar envWrites
+            $ HashMap.adjust
+                (\w -> w { writeTimeout = timeout })
+                handle
+          return $ Thrift.FinishResponse_retry $ Thrift.BatchRetry 0
+    Nothing -> throwIO Thrift.UnknownBatchHandle
+
+rememberWrite
+  :: Env
+  -> Thrift.Handle
+  -> MVar (Either SomeException Subst.Subst)
+  -> IO ()
+rememberWrite env@Env{..} handle write = do
+  timeout <- getWriteTimeout env
+  atomically
+    $ modifyTVar' envWrites
+    $ HashMap.insert handle Write
+        { writeWait = write
+        , writeTimeout = timeout
+        }
+
+getWriteTimeout :: Env -> IO TimePoint
+getWriteTimeout Env{..} = do
+  ServerConfig.Config{..} <- Observed.get envServerConfig
+  now <- getTimePoint
+  return $ addToTimePoint now $ seconds $ fromIntegral config_db_writes_keep
+
+-- | Periodically remove write handles that have timed out. NB: The writes
+-- themselves will still be executed but the substitutions they produce can
+-- no longer be queried.
+reapWrites :: Env -> TVar (HashMap Text Write) -> IO ()
+reapWrites Env{..} writes = forever $ do
+  ServerConfig.Config{..} <- Observed.get envServerConfig
+  threadDelay $ fromIntegral config_db_writes_reap * 1000000
+  now <- getTimePoint
+  atomically $ modifyTVar' writes $ HashMap.filter $ \x -> writeTimeout x > now
+
+deleteWriteQueues :: Env -> OpenDB s -> STM ()
+deleteWriteQueues env OpenDB{odbWriting = Just Writing{..}} = do
+  let !WriteQueue{..} = wrQueue
+  size <- readTVar writeQueueSize
+  modifyTVar' (writeQueuesSize (envWriteQueues env)) (subtract size)
+  void $ flushTQueue writeQueue
+  -- This WriteQueue might still be on the writeQueues, but it will
+  -- get removed by the next write thread to encounter it.
+deleteWriteQueues _ _ = return ()
+
+downloadBatchFromLocation
+  :: Env
+  -> Thrift.BatchDescriptor
+  -> IO Thrift.Batch
+downloadBatchFromLocation Env{..} batchDescriptor =
+  let
+    batchFormat = batchDescriptor_format batchDescriptor
+    locationString = batchDescriptor_location batchDescriptor
+  in
+    BatchLocation.fromString envBatchLocationParser locationString batchFormat
+
+
+k :: Int
+k = 1024
+
+mb :: Int
+mb = 1024*1024
+
+roundUp :: Int -> Int -> Int
+roundUp unit x = (x + unit-1) `div` unit
diff --git a/glean/db/Glean/Dump.hs b/glean/db/Glean/Dump.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Dump.hs
@@ -0,0 +1,80 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Dump
+  ( dump
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.Int (Int64)
+import Text.Printf
+
+import Util.Control.Exception (catchAll)
+import Util.Log
+
+import Glean.Backend.Types
+import Glean.Backend.Local
+import Glean.Database.Schema
+import Glean.Query.JSON
+import Glean.RTS.Types
+import Glean.Types
+
+dump :: Backend b => b -> Repo -> (JsonFactBatch -> IO ()) -> IO ()
+dump backend repo withBatch = doDump =<< loadDbSchema backend repo
+  where
+    doDump dbSchema = do
+      FactIdRange{..} <- factIdRange backend repo
+      go iNVALID_ID [] 0 factIdRange_start factIdRange_finish
+      where
+
+      doneBatch :: Id -> [(Id,Fact)] -> IO ()
+      doneBatch _ [] = return ()
+      doneBatch pid facts = do
+        vlog 1 (printf "%d facts for predicate %d\n" (length facts) pid)
+        case lookupPid (Pid pid) dbSchema of
+          Nothing -> throwIO $ ErrorCall $ "unknown predicate Id: " <> show pid
+          Just details@PredicateDetails{} -> do
+            jsonFacts <- forM (reverse facts) $ \(fid, Fact{..}) ->
+                factToJSON
+                  True
+                  mempty
+                  details
+                  (Fid fid)
+                  fact_key
+                  fact_value
+                `catchAll` \exc -> throwIO $ ErrorCall $ show exc
+            withBatch JsonFactBatch
+              { jsonFactBatch_predicate = predicateRef details
+              , jsonFactBatch_facts = jsonFacts
+              , jsonFactBatch_unit = Nothing -- TODO?
+              }
+
+      -- limit the size of batches we give back, so that the writer
+      -- can run in constant space.
+      maxBatchSize :: Id
+      maxBatchSize = 10000
+
+      go :: Id -> [(Id,Fact)] -> Int64 -> Id -> Id ->  IO ()
+      go !currentPid facts !batchSize !nextId !finalId
+        | nextId < finalId = do
+            r <- queryFact backend repo nextId
+            case r of
+              Nothing -> go currentPid facts batchSize (nextId+1) finalId
+              Just fact@Fact{..} ->
+                if fact_type == currentPid && batchSize < maxBatchSize
+                  then go
+                    currentPid
+                    ((nextId,fact):facts)
+                    (batchSize + 1)
+                    (nextId+1)
+                    finalId
+                  else do
+                    doneBatch currentPid facts
+                    go fact_type [(nextId,fact)] 1 (nextId+1) finalId
+        | otherwise = doneBatch currentPid facts
diff --git a/glean/db/Glean/Logger.hs b/glean/db/Glean/Logger.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Logger.hs
@@ -0,0 +1,48 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE UndecidableInstances #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+module Glean.Logger (
+  runLogCmd,
+  runLogRepo,
+) where
+
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import Data.RateLimiterMap
+import Glean.Logger.Server as Logger
+import Util.Logger
+
+import Glean.Database.Types
+import Glean.Types
+import Glean.Util.Some
+
+
+instance ActionLog GleanServerLog where
+  successLog = Logger.SetSuccess True
+  failureLog ex = mconcat
+    [ Logger.SetSuccess False
+    , Logger.SetError (Text.pack (show ex))
+    ]
+  timeLog = Logger.SetTimeElapsed
+  allocLog = Logger.SetAllocatedBytes . fromIntegral
+
+runLogCmd :: Text -> Env -> GleanServerLog -> IO ()
+runLogCmd cmd env log =
+  whenAllowed (envLoggerRateLimit env) cmd $ \weight ->
+    case envServerLogger env of
+      Some logger ->
+        runLog logger $
+          log <> Logger.SetMethod cmd <> Logger.SetWeight weight
+
+runLogRepo :: Text -> Env -> Repo -> GleanServerLog -> IO ()
+runLogRepo cmd env Repo{..} log =
+  runLogCmd cmd env $
+    log <> Logger.SetRepoName repo_name <> Logger.SetRepoHash repo_hash
diff --git a/glean/db/Glean/Logger/Database.hs b/glean/db/Glean/Logger/Database.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Logger/Database.hs
@@ -0,0 +1,44 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Logger.Database (
+    GleanDatabaseLog(..),
+    GleanDatabaseLogger(..),
+    NullGleanDatabaseLogger(..),
+  ) where
+
+import Data.Text (Text)
+
+class GleanDatabaseLogger l where
+  runLog :: l -> GleanDatabaseLog -> IO ()
+
+data GleanDatabaseLog
+  = GleanDatabaseLogEmpty
+  | GleanDatabaseLogAnd GleanDatabaseLog GleanDatabaseLog
+  | SetRepoName Text
+  | SetRepoHash Text
+  | SetPredicateCount Int
+  | SetUploadDestination Text
+  | SetPredicateName Text
+  | SetPredicateVersion Int
+  | SetPredicateSize Int
+  | SetMetric Text
+  | SetCount Int
+  | SetSize Int
+  | SetHasExcludeProperty Bool
+
+instance Semigroup GleanDatabaseLog where
+  a <> b = GleanDatabaseLogAnd a b
+
+instance Monoid GleanDatabaseLog where
+  mempty = GleanDatabaseLogEmpty
+
+data NullGleanDatabaseLogger = NullGleanDatabaseLogger
+
+instance GleanDatabaseLogger NullGleanDatabaseLogger where
+  runLog _ _ = return ()
diff --git a/glean/db/Glean/Logger/Server.hs b/glean/db/Glean/Logger/Server.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Logger/Server.hs
@@ -0,0 +1,69 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Logger.Server (
+    GleanServerLog(..),
+    GleanServerLogger(..),
+    NullGleanServerLogger(..),
+  ) where
+
+import Data.Text (Text)
+
+class GleanServerLogger l where
+  runLog :: l -> GleanServerLog -> IO ()
+
+data GleanServerLog
+  = GleanServerLogEmpty
+  | GleanServerLogAnd GleanServerLog GleanServerLog
+  | SetSuccess Bool
+  | SetError Text
+  | SetTimeElapsed Double
+  | SetAllocatedBytes Int
+  | SetMethod Text
+  | SetWeight Int
+  | SetRepoName Text
+  | SetRepoHash Text
+  | SetQuery Text
+  | SetPredicate Text
+  | SetPredicateVersion Int
+  | SetSchemaVersion Int
+  | SetNoBase64Binary Bool
+  | SetExpandResults Bool
+  | SetRecursive Bool
+  | SetMaxResults Int
+  | SetTruncated Bool
+  | SetResults Int
+  | SetFacts Int
+  | SetFullScans [Text]
+  | SetSyntax Text
+  | SetType Text
+  | SetBytecodeSize Int
+  | SetCompileTimeUs Int
+  | SetExecuteTimeUs Int
+  | SetQueryResultBytes Int
+  | SetClientUnixname Text
+  | SetClientApplication Text
+  | SetClientName Text
+  | SetRequestContinuationSize Int
+  | SetResponseContinuationSize Int
+  | SetSchemaId Text
+  | SetBatchFactsSize Int
+  | SetBatchFactsCount Int
+  | SetBatchOwnedSize Int
+  | SetBatchDependenciesSize Int
+
+instance Semigroup GleanServerLog where
+  a <> b = GleanServerLogAnd a b
+
+instance Monoid GleanServerLog where
+  mempty = GleanServerLogEmpty
+
+data NullGleanServerLogger = NullGleanServerLogger
+
+instance GleanServerLogger NullGleanServerLogger where
+  runLog _ _ = return ()
diff --git a/glean/db/Glean/Query/BindOrder.hs b/glean/db/Glean/Query/BindOrder.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/BindOrder.hs
@@ -0,0 +1,148 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE DerivingStrategies #-}
+module Glean.Query.BindOrder
+  ( Fix
+  , Scope(..)
+  , NoBind(..)
+  , IsPat(..)
+  , runFixBindOrder
+  , FixBindOrder(..)
+  , FixBindOrderError(..)
+  , Variable
+  , isBound
+  , bind
+  ) where
+
+import Control.Monad.Except
+import Control.Monad.State
+import Data.IntSet (IntSet)
+import qualified Data.IntSet as IntSet
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+
+import Glean.Query.Codegen.Types (Match(..), Var(..), Generator_(..), Generator)
+import Glean.Query.Vars (VarSet)
+import Glean.RTS.Term as RTS
+
+-- -----------------------------------------------------------------------------
+-- Fixing up MatchBind vs. MatchVar
+
+-- Substitution can mess up MatchBind and MatchVar - we might end up
+-- with multiple MatchBinds for a variable, or a MatchVar before a
+-- MatchBind. To fix it up all we need to do is traverse the query in
+-- the correct order, keeping track of which variables are in scope,
+-- and change MatchBind<->MatchVar as appropriate.
+--
+-- This is all somewhat suboptimal, because the typechecker has
+-- already figured out MatchBind vs. MatchVar and here we mess it up
+-- by substitution and then fix it again. Which begs the question: why
+-- do we have MatchBind and MatchVar at all, couldn't we leave it
+-- until the last minute just before code generation to figure out
+-- which variables are binding occurrences?  Yes, but it's nice to be
+-- able to give the user out-of-scope error messages from the
+-- typechecker.  Maybe we'll change this in the future.
+
+data Scope = Scope
+  { isScope :: VarSet
+  , bound :: IntMap Var
+  }
+  deriving (Show)
+
+type Variable = Int
+
+isBound :: Scope -> Variable -> Bool
+isBound (Scope _ bound) var = IntMap.member var bound
+
+bind :: Var -> Scope -> Scope
+bind var (Scope scope bound) = Scope scope (IntMap.insert (varId var) var bound)
+
+
+-- | Variables that should not be bound.
+-- Statements in a negated subquery should not bind values that occur later
+-- in a positive statement.
+newtype NoBind = NoBind
+  { unNoBind :: IntSet
+  }
+
+data FixBindOrderError
+  = CannotUseWildcardInExpr
+  | CannotUseNeverInExpr
+  | UnboundVariable Var
+
+type Fix a = StateT (Scope, NoBind) (Except FixBindOrderError) a
+
+runFixBindOrder
+  :: Scope -> NoBind -> Fix a -> Except FixBindOrderError (a, Scope)
+runFixBindOrder scope nobind fx = do
+  (res, (scope', _)) <- runStateT fx (scope, nobind)
+  return (res, scope')
+
+data IsPat = IsPat | IsExpr
+  deriving Eq
+
+class FixBindOrder a where
+  fixBindOrder :: IsPat -> a -> Fix a
+
+instance FixBindOrder Generator where
+  fixBindOrder isPat (TermGenerator p) =
+    TermGenerator <$> fixBindOrder isPat p
+  fixBindOrder _ (ArrayElementGenerator ty p) =
+    ArrayElementGenerator ty <$> fixBindOrder IsExpr p
+  fixBindOrder _ (SetElementGenerator ty p) =
+    SetElementGenerator ty <$> fixBindOrder IsExpr p
+  fixBindOrder isPat (DerivedFactGenerator pid key val) =
+    DerivedFactGenerator pid
+      <$> fixBindOrder isPat key
+      <*> fixBindOrder isPat val
+  fixBindOrder _ (FactGenerator pid kpat vpat range) =
+    FactGenerator pid <$>
+      fixBindOrder IsPat kpat <*>
+      fixBindOrder IsPat vpat <*>
+      pure range
+  fixBindOrder _ (PrimCall op pats ty) =
+    PrimCall op <$> mapM (fixBindOrder IsExpr) pats <*> pure ty
+
+instance FixBindOrder a => FixBindOrder (Term a) where
+  fixBindOrder isPat term = mapM (fixBindOrder isPat) term
+
+instance FixBindOrder () where
+  fixBindOrder _ () = return ()
+
+instance (FixBindOrder a) => FixBindOrder (Match a Var) where
+  fixBindOrder IsExpr MatchWild{} =
+    throwError CannotUseWildcardInExpr
+  fixBindOrder IsExpr MatchNever{} =
+    throwError CannotUseNeverInExpr
+  fixBindOrder isPat (MatchBind var) = fixVar isPat var
+  fixBindOrder isPat (MatchVar var) = fixVar isPat var
+  fixBindOrder isPat (MatchAnd a b) =
+    MatchAnd <$> mapM (fixBindOrder isPat) a <*> mapM (fixBindOrder isPat) b
+  fixBindOrder isPat (MatchPrefix str rest) =
+    MatchPrefix str <$> mapM (fixBindOrder isPat) rest
+  fixBindOrder isPat (MatchArrayPrefix ty pre all) =
+    MatchArrayPrefix ty
+      <$> (mapM.mapM) (fixBindOrder isPat) pre
+      <*> mapM (fixBindOrder isPat) all
+  fixBindOrder isPat (MatchExt ext) = MatchExt <$> fixBindOrder isPat ext
+  fixBindOrder _ other@MatchFid{} = return other
+  fixBindOrder _ other@MatchNever{} = return other
+  fixBindOrder _ other@MatchWild{} = return other
+
+fixVar :: IsPat -> Var -> Fix (Match a Var)
+fixVar isPat var@(Var _ v _) = do
+  (scope, NoBind noBind) <- get
+  if
+    | isBound scope v -> return (MatchVar var)
+    | (IsExpr == isPat) || (v `IntSet.member` noBind)
+      -> throwError $ UnboundVariable var
+    | otherwise -> do
+      put (bind var scope, NoBind noBind)
+      return (MatchBind var)
diff --git a/glean/db/Glean/Query/Codegen.hs b/glean/db/Glean/Query/Codegen.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Codegen.hs
@@ -0,0 +1,1697 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE RecursiveDo #-}
+module Glean.Query.Codegen
+  ( compileQuery
+  , compileQueryFacts
+  , Boundaries
+  , flatBoundaries
+  , stackedBoundaries
+  , skipTrusted
+  , buildTerm
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.Extra (whenJust)
+import Control.Monad.State
+import Data.Bifunctor (bimap)
+import Data.ByteString (ByteString)
+import Data.Coerce
+import Data.IntSet (IntSet)
+import qualified Data.IntSet as IntSet
+import Data.List (find,genericLength)
+import Data.Maybe
+import qualified Data.Text as Text
+import qualified Data.Vector as Vector
+import Data.Vector (Vector, (!), (//))
+import Data.Word
+import Foreign.Ptr hiding (WordPtr)
+import System.IO.Unsafe
+
+import qualified Util.FFI as FFI
+import qualified Util.Log as StringLog
+import qualified Util.Log.Text as TextLog
+import Glean.Query.Transform
+  ( skipTrusted
+  , isWordTy
+  , isByteTy
+  , buildTerm
+  , transformType
+  , transformBytes
+  , defaultValue)
+import Glean.Angle.Types (IsWild(..), tempPredicateId)
+import qualified Glean.Angle.Types as Angle
+import Glean.Bytecode.Types
+import Glean.Display
+import qualified Glean.FFI as FFI
+import Glean.Query.Codegen.QueryRegs
+import Glean.Query.Codegen.Types
+import Glean.Database.Types (EnableRecursion(..))
+import Glean.Database.Schema.Types
+  ( Bytes(..)
+  , PredicateTransformation(..)
+  , QueryTransformations
+  , IsPointQuery
+  , lookupTransformation)
+import Glean.RTS
+import Glean.RTS.Builder
+import Glean.RTS.Bytecode.Code
+import Glean.RTS.Bytecode.Disassemble
+import Glean.RTS.Bytecode.Gen.Issue
+import Glean.RTS.Foreign.Bytecode
+import Glean.RTS.Foreign.Lookup (Lookup)
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+import Glean.RTS.Foreign.Query
+import Glean.RTS.Traverse
+import Glean.RTS.Types
+import Glean.RTS.Term
+import Glean.Typed.Binary (buildRtsValue)
+import Glean.Types hiding (Nat, Byte)
+import Glean.Bytecode.SysCalls (userQuerySysCalls)
+
+{- Debugging the bytecode query backend:
+
+Use glog verbosity levels to enable logging. For example, to enable
+verbosity level 2, you can do
+
+  GLOG_v=2 <program> <args>
+
+(The environment variable GLOG_v is often more reliable than passing
+-v 3 on the command line, since it bypasses the program's own
+command-line parser).
+
+Verbosity levels are as follows:
+
+  2: log the query at different stages (typechecking, expansion, ...)
+  3: disassembles the generated bytecode
+  5: tracing during bytecode execution (see rts/query.cpp)
+-}
+
+{- Note [pausing/resuming queries]
+
+To support paging queries we need to be able to pause and resume a
+query in progress. This is achieved by capturing the state of the
+bytecode evaluator during the query, and serializing it so that it can
+be returned to the user. Later the user sends back the serialized
+query state, and we deserialize it and continue executing it.
+
+Roughly speaking this is achieved as follows:
+
+* The saved state of the evaluator is described by the Thrift type
+  QueryCont in glean/if/internal.thrift.  We use Thrift for
+  serializing and deserializing the state.
+
+* The state includes:
+  - the code, instruction pointer and local registers
+  - the state of any fact iterators generated by 'seek'
+  - the contents of binary::Output registers created by 'output'
+
+* The bytecode instruction Suspend allows the subroutine to be suspended by
+  updating the activation record such that execution can be resumed and then
+  returning an appropriate status from the evaluator.
+
+To make this work we have to obey a rule in the bytecode program:
+
+  Don't keep any pointers in local registers across Suspend
+
+because they won't be valid when we resume. Pointers in input
+registers are fine; the contents of these will be saved and restored
+as necessary (this includes binary::Output registers).
+-}
+
+-- | Find all variables that need to be bound to a binary::Output
+findOutputs :: [CgStatement] -> IntSet
+findOutputs stmts = findOutputsStmts stmts IntSet.empty
+  where
+  findOutputsStmts :: [CgStatement] -> IntSet -> IntSet
+  findOutputsStmts stmts r = foldr findOutputsStmt r stmts
+
+  findOutputsStmt :: CgStatement -> IntSet -> IntSet
+  findOutputsStmt (CgStatement lhs gen) r =
+     findOutputsGen gen (foldr findOutputsMatch r lhs)
+  findOutputsStmt (CgAllStatement (Var _ var _) expr stmts) r =
+     IntSet.insert var $ findOutputsPat expr $ foldr findOutputsStmt r stmts
+  findOutputsStmt (CgNegation stmts) r =
+     foldr findOutputsStmt r stmts
+  findOutputsStmt (CgDisjunction stmtss) r =
+     foldr (flip (foldr findOutputsStmt)) r stmtss
+  findOutputsStmt (CgConditional cond then_ else_) r =
+     foldr (flip (foldr findOutputsStmt)) r [cond, then_, else_]
+
+  findOutputsGen :: Generator -> IntSet -> IntSet
+  findOutputsGen (FactGenerator _ kpat vpat _) r =
+    foldr findOutputsMatch (foldr findOutputsMatch r vpat) kpat
+  findOutputsGen (TermGenerator t) r = findOutputsPat t r
+  findOutputsGen (DerivedFactGenerator _ k v) r =
+    findOutputsPat k (findOutputsPat v r)
+  findOutputsGen (ArrayElementGenerator _ _) r = r
+  findOutputsGen (SetElementGenerator _ _) r = r
+  findOutputsGen (PrimCall _ args _) r = foldr findOutputsPat r args
+
+  findOutputsPat pat r = foldr findOutputsMatch r pat
+
+  findOutputsMatch :: Match () Var -> IntSet -> IntSet
+  findOutputsMatch (MatchPrefix _ rest) r = foldr findOutputsMatch r rest
+  findOutputsMatch (MatchBind (Var ty var _)) r
+    | not (isWordTy ty) = IntSet.insert var r
+  findOutputsMatch (MatchAnd a b) r = findOutputsPat a (findOutputsPat b r)
+  findOutputsMatch (MatchArrayPrefix _ exps all) r =
+    foldr findOutputsPat r (all:exps)
+  findOutputsMatch _ r = r
+
+-- | The database boundaries we are interested in to implement
+-- sectioned 'seek' calls.
+data Boundaries
+  = FlatBoundaries SectionBoundaries
+  | StackedBoundaries SectionBoundaries SectionBoundaries
+
+-- | Limits of a section of a database. Represents the range [start, end).
+data SectionBoundaries = SectionBoundaries
+  { _section_start :: Fid
+  , _section_end :: Fid
+  }
+
+flatBoundaries :: Lookup -> IO Boundaries
+flatBoundaries lookup = FlatBoundaries <$> sectionBounds lookup
+
+stackedBoundaries :: Lookup -> Lookup -> IO Boundaries
+stackedBoundaries base added =
+  StackedBoundaries
+    <$> sectionBounds base
+    <*> sectionBounds added
+
+sectionBounds :: Lookup -> IO SectionBoundaries
+sectionBounds lookup = SectionBoundaries
+  <$> Lookup.startingId lookup
+  <*> Lookup.firstFreeId lookup
+
+compileQuery
+  :: EnableRecursion
+  -> QueryTransformations
+  -> Boundaries
+  -> CodegenQuery
+     -- ^ The query to compile. NB. no type checking or validation is
+     -- done on this; we assume that earlier phases have done this.  A
+     -- malformed query can cause a crash.
+  -> IO CompiledQuery
+
+compileQuery r qtrans bounds (QueryWithInfo query numVars lookup ty) = do
+  StringLog.vlog 2 $ show (displayDefault query)
+
+  (idTerm, resultKey, resultValue, stmts) <- if
+    | Just gen@(FactGenerator _ keyTerm valTerm _) <- lookup,
+      CgQuery idTerm stmts <- query -> do
+        let lookup = CgStatement idTerm gen
+        let
+          unBind (Ref (MatchBind x)) = Ref (MatchVar x)
+          unBind (Ref (MatchWild (Angle.RecordTy []))) = Tuple []
+          unBind _ = error "unBind"
+        return (idTerm, unBind keyTerm, unBind valTerm, stmts <> [lookup])
+    | CgQuery (Tuple [idTerm, resultKey, resultValue]) stmts <- query ->
+        return (idTerm, resultKey, resultValue, stmts)
+    | otherwise ->
+        throwIO $ BadQuery "unsupported query"
+
+  (Meta{..}, sub) <- generateQueryCode $ \ regs@QueryRegs{..} -> do
+
+    let outputVars = IntSet.toList $ findOutputs stmts
+    outputUninitialized $ Many (length outputVars) $ \outputRegs -> do
+    let
+      outputRegAssocs :: [(Int, Register 'BinaryOutputPtr)]
+      outputRegAssocs = zip outputVars outputRegs
+
+    local $ Many (numVars - length outputVars) $ \localRegs -> do
+    let
+      localRegAssocs :: [(Int, Register 'Word)]
+      localRegAssocs = zip (filter (`notElem` outputVars) [0..]) localRegs
+
+    -- vector of variables corresponding to the vars in the original query
+    let vars = Vector.replicate numVars (error "compileQuery")
+                 // (localRegAssocs ++ coerce outputRegAssocs)
+
+    -- resultKeyReg/resultValueReg is where we build up result values
+    outputUninitialized $ \resultKeyOutput resultValueOutput ->
+      let
+        code :: forall a. Code a -> Code a
+        code = compileStatements regs qtrans bounds regs stmts vars
+
+        queryStmts :: forall a. Code a -> Code a
+        queryStmts = case r of
+          EnableRecursion -> recursive regs code code
+          DisableRecursion -> code
+      in
+      queryStmts $ mdo
+        -- If the result term is a variable, avoid unnecessarily
+        -- copying it into resultOutput and just use it directly.
+        resultKeyReg <- case resultKey of
+          Ref (MatchVar (Var ty v _)) | not (isWordTy ty) ->
+            return (castRegister (vars ! v))
+          _other -> do
+            resetOutput resultKeyOutput
+            buildTerm resultKeyOutput vars resultKey
+            return resultKeyOutput
+        resultValReg <- case resultValue of
+          Ref (MatchVar (Var ty v _)) | not (isWordTy ty) ->
+            return (Just (castRegister (vars ! v)))
+          Tuple [] -> return Nothing
+          _other -> do
+            resetOutput resultValueOutput
+            buildTerm resultValueOutput vars resultValue
+            return (Just resultValueOutput)
+        idReg <- case idTerm of
+          Ref (MatchVar (Var ty idVar _)) | isWordTy ty -> return (vars ! idVar)
+          Ref (MatchFid fid) -> constant (fromIntegral (fromFid fid))
+          _ -> error "unsupported result type"
+        local $ \len -> mdo
+          val <- case resultValReg of
+            Nothing -> castRegister <$> constant 0
+            Just reg -> return reg
+          result idReg resultKeyReg val len
+          jumpIf0 len continue
+          decrAndJumpIf0 maxResults pause
+          -- check whether we have exceeded maxBytes. Note that we
+          -- will return more than max_bytes, but this way we don't
+          -- have to backtrack and regenerate the most recent result
+          -- again in the continuation.
+          jumpIfGt len maxBytes pause
+          sub len maxBytes
+          jump continue
+          pause <- label
+          suspend saveState continue -- see Note [pausing/resuming queries]
+          continue <- label
+          return ()
+    ret
+
+  TextLog.vlog 3 $ Text.unlines $ disassemble "Query" userQuerySysCalls sub
+
+  -- Tell the query engine how to traverse results for expanding
+  -- nested facts.
+  (pid, traverse) <- case derefType ty of
+    Angle.RecordTy [ pidfield, key, val ]
+      | Angle.PredicateTy _ (PidRef pid ref) <-
+          derefType (Angle.fieldDefType pidfield) -> do
+        traverse <-
+          if ref == tempPredicateId then
+            Just <$>
+            -- detect temporary predicates, see Glean.Query.Flatten.captureKey
+            -- TODO: matching like this is a bit janky.
+              genTraversal
+                -- If the key and value have been transformed they will have
+                -- the correct shape but the facts they refer to will have the
+                -- types available in the db and not the type requested in the
+                -- query. Therefore we must transform the type of those
+                -- references for the traversal.
+                (transformType qtrans $ Angle.fieldDefType key)
+                (transformType qtrans $ Angle.fieldDefType val)
+          else
+            return Nothing
+        return (Just pid, traverse)
+    _other -> throwIO $ ErrorCall "unrecognised query return type"
+
+  return (CompiledQuery sub pid traverse meta_fullScans)
+
+isEmptyTy :: Type -> Bool
+isEmptyTy ty
+  | TupleRep [] <- repType ty = True
+  | otherwise = False
+
+patIsExactFid
+  :: Vector (Register 'Word)
+  -> Term (Match () Var)
+  -> Maybe (Label -> Code (Register 'Word))
+patIsExactFid vars pat = case pat of
+  Ref (MatchFid fid) -> Just $ \_ -> constant (fromIntegral (fromFid fid))
+  Ref (MatchVar (Var ty v _)) | PredicateRep{} <- repType ty ->
+    Just $ \_ -> return (vars ! v)
+  Nat n -> Just $ \_ -> constant n -- if the typechecker allows it
+  Ref (MatchAnd p q) -> case (patIsExactFid vars p, patIsExactFid vars q) of
+    -- the MatchAnd cases are a bit silly, but who knows what earlier
+    -- transformations might generate.
+    (Just l, Just r) -> Just $ \fail -> do
+      r1 <- l fail
+      r2 <- r fail
+      jumpIfNe r1 r2 fail -- patterns better be equal
+      return r1
+    (Just l, Nothing)
+      | Just cmpR <- cmpWordPat vars q -> Just $ \fail -> do
+        reg <- l fail
+        cmpR reg fail
+        return reg
+    (Nothing, Just r)
+      | Just cmpR <- cmpWordPat vars p -> Just $ \fail -> do
+        reg <- r fail
+        cmpR reg fail
+        return reg
+    _other -> Nothing
+  _other -> Nothing
+
+-- | if the given pattern is represented by a word register, then
+-- return the code to compare a value in the given register against
+-- the pattern.
+--
+-- A @Term (Match Var)@ doesn't have enough information to reconstruct
+-- its 'Type', because in particular we can't reconstruct a 'SumTy'
+-- from an 'Alt' value. But it does have enough information to derive
+-- its representation, so we can tell by looking at a pattern whether
+-- it is represented as a word.
+cmpWordPat
+  :: Vector (Register 'Word)
+  -> Term (Match () Var)
+  -> Maybe (Register 'Word -> Label -> Code ())
+cmpWordPat vars pat = case pat of
+  Byte b -> Just $ \reg fail -> do
+    r <- constant (fromIntegral b)
+    jumpIfNe reg r fail
+  Nat n -> Just $ \reg fail -> do
+    r <- constant n
+    jumpIfNe reg r fail
+  Ref (MatchFid fid) -> Just $ \reg fail -> do
+      r <- constant (fromIntegral (fromFid fid))
+      jumpIfNe reg r fail
+  Ref (MatchWild ty) | isWordTy ty -> Just $ \_ _ ->
+    return ()
+  Ref (MatchNever ty) | isWordTy ty -> Just $ \_ fail -> jump fail
+  Ref (MatchVar (Var ty v _)) | isWordTy ty -> Just $ \reg fail ->
+    jumpIfNe reg (vars ! v) fail
+  Ref (MatchAnd a b) ->
+    case (cmpWordPat vars a, cmpWordPat vars b) of
+      (Nothing, Nothing) -> Nothing
+      (Just f, Nothing) -> Just f
+      (Nothing, Just f) -> Just f
+      (Just f, Just g) -> Just $ \reg fail -> f reg fail >> g reg fail
+  Ref (MatchBind (Var ty v _)) | isWordTy ty -> Just $ \reg _ ->
+    move reg (vars ! v)
+  _otherwise -> Nothing
+
+-- | Compare a value in an output register with a pattern. If the
+-- pattern matches, fall through, otherwise jump to the given label.
+cmpOutputPat
+  :: QueryRegs
+  -> Register 'BinaryOutputPtr          -- ^ register containing the value
+  -> [QueryChunk Output]                -- ^ pattern to match against
+  -> Label                              -- ^ jump here on match failure
+  -> Code ()
+cmpOutputPat syscalls reg pat fail =
+  local $ \ptr begin -> do
+    getOutput reg begin ptr
+    matchPat syscalls (Bytes begin ptr) fail pat
+
+compileTermGen
+  :: Expr
+  -> Vector (Register 'Word)    -- ^ registers for variables
+  -> Maybe (Register 'BinaryOutputPtr)  -- ^ where to put the output
+  -> Code a                     -- ^ @andThen@: code to insert after
+                                -- the result is constructed.
+  -> Code a
+compileTermGen term vars maybeReg andThen = do
+    forM_ maybeReg $ \resultOutput ->
+      case term of
+        Nat n ->
+          loadConst (fromIntegral n) (castRegister resultOutput)
+        Byte n ->
+          loadConst (fromIntegral n) (castRegister resultOutput)
+        Ref (MatchFid f) ->
+          loadConst (fromIntegral (fromFid f)) (castRegister resultOutput)
+        Ref (MatchVar (Var ty v _)) | isWordTy ty ->
+          move (vars ! v) (castRegister resultOutput)
+        _other -> do
+          resetOutput resultOutput
+          buildTerm resultOutput vars term
+    andThen
+
+compileStatements
+  :: forall a
+  .  QueryRegs
+  -> QueryTransformations
+  -> Boundaries
+  -> QueryRegs
+  -> [CgStatement]
+  -> Vector (Register 'Word)    -- ^ registers for variables
+  -> Code a                     -- ^ @andThen@: code to insert after
+                                -- the result is constructed.
+  -> Code a
+compileStatements
+  syscalls
+  qtrans
+  bounds
+  regs@QueryRegs{..}
+  stmts
+  vars
+  andThen =
+    compile stmts
+  where
+      compile [] = andThen
+
+      compile (CgConditional cond then_ else_: rest) =
+        local $ \failed innerRet -> mdo
+          let
+            compileBranch stmts =
+              compileStatements syscalls qtrans bounds regs stmts vars $ mdo
+                site <- callSite
+                loadLabel ret innerRet
+                jump doInner
+                ret <- label
+                return site
+
+          -- if
+          loadConst 1 failed
+          thenSite <- compileStatements syscalls qtrans bounds regs cond vars $
+            do
+          -- then
+              loadConst 0 failed
+              compileBranch then_
+          -- else
+          jumpIf0 failed done
+          elseSite <- compileBranch else_
+          jump done
+
+          doInner <- label
+          a <- calledFrom [thenSite, elseSite] $ compile rest
+          jumpReg innerRet
+
+          done <- label
+          return a
+
+      compile (CgStatement pat gen : rest) =
+        if isExistenceCheck
+        then singleResult (compileStmt pat gen) $ compile rest
+        else compileStmt pat gen $ compile rest
+        where
+          -- An existence check is a statement whose sole purpose is to assert
+          -- whether there is any entry in the database that satisfies it.
+          -- Variables bound by an existencial check are not used by subsequent
+          -- statements.
+          --
+          -- Given the environment is not meaningfully changed, all executions
+          -- of the code after it will be identical. This means we can stop
+          -- after going through the first result.
+          --
+          -- For now instead of checking the use of bound variables we will
+          -- just say that a statement is an existence check if it doesn't bind
+          -- any variables at all.
+          isExistenceCheck = case gen of
+            FactGenerator _ k v _ ->
+              let bindsAnywhere = bindsIn pat || bindsIn k || bindsIn v in
+              not bindsAnywhere
+            _ -> False
+
+          -- does the pattern bind a variable?
+          bindsIn pat = flip any (matches pat) $ \case
+            MatchBind _ -> True
+            MatchWild _ -> False
+            MatchNever _ -> False
+            MatchFid _ -> False
+            MatchVar _ -> False
+            MatchAnd l r -> bindsIn l || bindsIn r
+            MatchPrefix _ exp -> bindsIn exp
+            MatchArrayPrefix _ exps all -> any bindsIn exps || bindsIn all
+            MatchExt _ -> False
+
+          matches :: Term (Match e v) -> [Match e v]
+          matches p = foldMap pure p
+
+      compile (CgAllStatement (Var (Angle.SetTy ty) v _) expr stmts : rest)
+        | isWordTy ty = do
+        local $ \setReg -> do
+          let set = castRegister setReg
+          newWordSet set
+          compileStatements syscalls qtrans bounds regs stmts vars $
+            local $ \reg -> do
+              compileTermGen expr vars (Just reg) $
+                insertWordSet set (castRegister reg)
+          resetOutput (castRegister (vars!v))
+          if isByteTy ty
+            then byteSetToByteArray set (castRegister (vars!v))
+            else wordSetToArray set (castRegister (vars!v))
+          freeWordSet set
+        compile rest
+      compile (CgAllStatement (Var _ v _) expr stmts : rest) = do
+        local $ \setReg -> do
+          let set = castRegister setReg
+          newSet set
+          compileStatements syscalls qtrans bounds regs stmts vars $
+            outputUninitialized $ \out -> do
+              compileTermGen expr vars (Just out) $
+                insertOutputSet set out
+          setToArray set (castRegister (vars!v))
+          freeSet set
+        compile rest
+      compile (CgNegation stmts : rest) = mdo
+        singleResult (compileStatements syscalls qtrans bounds regs stmts vars)
+          (jump fail)
+        a <- compile rest
+        fail <- label
+        return a
+
+      -- an empty list of generators should fall through without
+      -- executing inner, but we have to compile inner because we need
+      -- its result.
+      compile (CgDisjunction [] : rest) = mdo
+        jump fail
+        a <- compile rest
+        fail <- label
+        return a
+
+      compile (CgDisjunction [one] : rest) =
+        compile (one ++ rest)
+
+      -- To compile sequential generators, we simply compile each generator,
+      -- and when it produces a result we "call" the continuation to
+      -- handle the rest of the query.  As each generator completes,
+      -- it falls through to the next one.
+      --
+      -- "calling" the continuation is done by explicitly passing the
+      -- return address, because we don't have a stack (yet). Some
+      -- minor shenanigans are involved to ensure that the "called"
+      -- routine's local registers don't clash with its "call site".
+      compile (CgDisjunction stmtss : rest) =
+        local $ \innerRet -> mdo
+        sites <- forM stmtss $ \stmts -> do
+          compileStatements syscalls qtrans bounds regs stmts vars $ mdo
+            site <- callSite
+            loadLabel ret_ innerRet
+            jump doInner
+            ret_ <- label
+            return site
+        jump done
+
+        doInner <- label
+        a <- calledFrom sites $ compile rest
+        jumpReg innerRet
+
+        done <- label
+        return a
+
+      compileStmt :: forall a. Pat -> Generator -> Code a -> Code a
+      compileStmt pat gen continue = case (pat, gen) of
+        (Ref (MatchWild _), gen) ->
+          compileGen gen Nothing continue
+
+        (Ref (MatchBind (Var _ var _)), gen) ->
+          compileGen gen (Just (vars ! var)) continue
+
+        -- <pat> = <fact gen> is a lookup if <pat> is known
+        (pat, FactGenerator pref@(PidRef pid _) kpat vpat _)
+          | Just load <- patIsExactFid vars pat -> mdo
+          let
+            patOutput
+              :: forall a
+              .  [QueryChunk Output]
+              -> (  Register 'BinaryOutputPtr     -- load bytes here
+                 -> (Label -> Code ())            -- test the loaded bytes
+                 -> Code a)
+              -> Code a
+            patOutput chunks cont
+              | all isWild chunks = do
+                  reg <- constant 0  -- null means "don't copy the key/value"
+                  cont (castRegister reg) (\_ -> return ())
+              | [QueryBind (Typed ty out)] <- chunks
+              , not (isWordTy ty) =
+                  -- bind into the output directly
+                  cont out (\_ -> return ())
+              | otherwise =
+                  outputUninitialized $ \reg ->
+                  cont reg (\fail -> cmpOutputPat syscalls reg chunks fail)
+
+            mtrans :: Maybe PredicateTransformation
+            mtrans = lookupTransformation pid qtrans
+
+            -- The pid we expect to retrieve from the database
+            PidRef expected _ = maybe pref tAvailable mtrans
+            noTrans _ v f = f v
+            transKeyPat = fromMaybe noTrans $
+              (transformKeyPattern =<< mtrans) <*> Just syscalls
+            transValPat = fromMaybe noTrans $
+              (transformValuePattern =<< mtrans) <*> Just syscalls
+          a <-
+            transKeyPat (matchDef syscalls fail) (inlineVars vars kpat) $
+                \kpat' ->
+            transValPat (matchDef syscalls fail) (inlineVars vars vpat) $
+                \vpat' -> do
+              patOutput (preProcessPat kpat') $ \kout kcmp -> do
+              patOutput (preProcessPat vpat') $ \vout vcmp -> do
+                reg <- load fail
+                local $ \pidReg -> mdo
+                  lookupKeyValue reg kout vout pidReg
+                  -- TODO: if this is a trusted fact ID (i.e. not supplied by
+                  -- the user) then we could skip this test.
+                  expectedReg <- constant (fromIntegral (fromPid expected))
+                  jumpIfEq pidReg expectedReg ok
+                  raise "fact has the wrong type"
+                  ok <- label
+                  return ()
+                kcmp fail
+                vcmp fail
+              continue
+          fail <- label
+          return a
+
+        -- ToDO: push the pat into compileGen and match it eagerly, save
+        -- some copying.
+        (pat, gen) ->
+          let outReg
+                | Just{} <- maybeWordFilter = local
+                | otherwise = \f -> outputUninitialized $ \r ->
+                    f $ castRegister (r :: Register 'BinaryOutputPtr)
+
+              maybeWordFilter = cmpWordPat vars pat
+
+              filterPat reg pat fail
+                | Just cmp <- maybeWordFilter = cmp reg fail
+                | otherwise =
+                    cmpOutputPat syscalls (castRegister reg) chunks fail
+                where chunks = preProcessPat $ inlineVars vars pat
+          in
+          outReg $ \reg ->
+            compileGen gen (Just reg) $ mdo
+              filterPat reg pat fail
+              a <- continue
+              fail <- label
+              return a
+
+      -- Helper function for processing numeric primitive operations
+      compileGenNumericPrim
+        :: forall a .
+           Expr
+        -> Expr
+        -> Maybe (Register 'Word)
+        -> Code a
+        -> (Register 'Word -> Register 'Word -> Label -> Code ())
+        -> Code a
+      compileGenNumericPrim p q maybeReg inner failOp =
+        withNatTerm vars p  $ \a ->
+          withNatTerm vars q $ \b -> mdo
+            failOp (castRegister a) (castRegister b) fail
+            whenJust maybeReg (resetOutput . castRegister)
+            r <- inner
+            fail <- label
+            return r
+
+      compileGen
+        :: forall a .
+           Generator
+        -> Maybe (Register 'Word)
+        -> Code a
+        -> Code a
+
+      compileGen (TermGenerator term) maybeReg inner = do
+        compileTermGen term vars (coerce maybeReg) inner
+
+      compileGen (PrimCall PrimOpNeNat [p, q] _) maybeReg inner =
+        compileGenNumericPrim p q maybeReg inner $ \a b fail ->
+          jumpIfEq a b fail
+      compileGen (PrimCall PrimOpGtNat [p, q] _) maybeReg inner =
+        compileGenNumericPrim p q maybeReg inner $ \a b fail ->
+          jumpIfLe a b fail
+      compileGen (PrimCall PrimOpGeNat [p, q] _) maybeReg inner =
+        compileGenNumericPrim p q maybeReg inner $ \a b fail ->
+          jumpIfLt a b fail
+      compileGen (PrimCall PrimOpLtNat [p, q] _) maybeReg inner =
+        compileGenNumericPrim p q maybeReg inner $ \a b fail ->
+          jumpIfGe a b fail
+      compileGen (PrimCall PrimOpLeNat [p, q] _) maybeReg inner =
+        compileGenNumericPrim p q maybeReg inner $ \a b fail ->
+          jumpIfGt a b fail
+
+      compileGen (PrimCall PrimOpNeExpr [p, q] _) maybeReg inner = mdo
+        case cmpWordPat vars p of
+          Just cmp ->
+            local $ \q' ->
+            compileTermGen q vars (Just q') $
+            cmp (castRegister q') ok
+          Nothing ->
+            withTerm vars q $ \q' ->
+            cmpOutputPat syscalls q' (preProcessPat $ inlineVars vars p) ok
+        jump fail
+        ok <- label
+        whenJust maybeReg (resetOutput . castRegister)
+        r <- inner
+        fail <- label
+        return r
+
+      compileGen (PrimCall _prim _args _) Nothing inner = inner
+      compileGen (PrimCall PrimOpAddNat [p, q] _) (Just reg) inner =
+        withNatTerm vars p $ \a ->
+          withNatTerm vars q $ \b -> do
+            move a reg
+            add b reg
+            inner
+      compileGen (PrimCall PrimOpToLower [arg] _) (Just reg) inner =
+        withTerm vars arg $ \str -> do
+          local $ \ptr end -> do
+            getOutput str ptr end
+            resetOutput (castRegister reg)
+            outputStringToLower ptr end (castRegister reg)
+          inner
+      compileGen (PrimCall PrimOpLength [arg] _) (Just reg) inner =
+        withTerm vars arg $ \array -> do
+          local $ \ptr end -> do
+            getOutput array ptr end
+            inputNat ptr end reg
+          inner
+      compileGen (PrimCall PrimOpSize [arg] _) (Just reg) inner =
+        withTerm vars arg $ \set -> do
+          local $ \ptr end -> do
+            getOutput set ptr end
+            inputNat ptr end reg
+          inner
+      compileGen (PrimCall PrimOpZip [arg1,arg2]
+                    (Angle.ArrayTy (Angle.RecordTy fields)))
+                  (Just reg) inner
+          | Just (Angle.FieldDef _ ty1)
+            <- find (("tuplefield0" ==) . Angle.fieldDefName) fields
+          , Just (Angle.FieldDef _ ty2)
+            <- find (("tuplefield1" ==) . Angle.fieldDefName) fields =
+        withTerm vars arg1 $ \array1 ->
+        withTerm vars arg2 $ \array2 -> do
+          local $ \ptr1 ptr2 end1 end2 len1 len2 len -> mdo
+            getOutput array1 ptr1 end1
+            getOutput array2 ptr2 end2
+            inputNat ptr1 end1 len1
+            inputNat ptr2 end2 len2
+            -- Take the mininum of the two lengths
+            jumpIfGe len1 len2 minLabel
+            move len1 len
+            jump cont
+            minLabel <- label
+            move len2 len
+            cont <- label
+            resetOutput (castRegister reg)
+            outputNat len (castRegister reg)
+            jumpIf0 len done
+
+            loop <- label
+
+            local $ \start1 start2 -> do
+              move ptr1 start1
+              skipTrusted ptr1 end1 ty1
+              outputBytes start1 ptr1 (castRegister reg)
+              move ptr2 start2
+              skipTrusted ptr2 end2 ty2
+              outputBytes start2 ptr2 (castRegister reg)
+            jumpIfEq ptr1 end1 done
+            jumpIfEq ptr2 end2 done
+            jump loop
+            done <- label
+            return ()
+          inner
+      compileGen (PrimCall PrimOpConcat [arg1,arg2] (Angle.ArrayTy ty))
+                  (Just reg) inner =
+        withTerm vars arg1 $ \array1 ->
+        withTerm vars arg2 $ \array2 -> do
+          local $ \ptr1 ptr2 end1 end2 -> mdo
+            getOutput array1 ptr1 end1
+            getOutput array2 ptr2 end2
+            local $ \len1 len2 len -> do
+              inputNat ptr1 end1 len1
+              inputNat ptr2 end2 len2
+              move len1 len
+              add len2 len
+              resetOutput (castRegister reg)
+              outputNat len (castRegister reg)
+
+            loop1 <- label
+            concatLoop ptr1 end1 loop1 loop2 (castRegister reg) ty
+
+            loop2 <- label
+            concatLoop ptr2 end2 loop2 done (castRegister reg) ty
+
+            done <- label
+            return ()
+          inner
+        where
+          concatLoop arrPtr arrEnd loopLabel doneLabel out ty = do
+            jumpIfEq arrPtr arrEnd doneLabel
+            local $ \localPtr -> do
+              move arrPtr localPtr
+              skipTrusted arrPtr arrEnd ty
+              outputBytes localPtr arrPtr out
+            jump loopLabel
+      compileGen (PrimCall PrimOpRelToAbsByteSpans [arg] _) (Just reg) inner =
+        withTerm vars arg $ \array -> do
+          local $ \ptr end -> do
+            getOutput array ptr end
+            resetOutput (castRegister reg)
+            outputRelToAbsByteSpans ptr end (castRegister reg)
+          inner
+      compileGen (PrimCall PrimOpReverse [arg] _) (Just reg) inner =
+        withTerm vars arg $ \str -> do
+          local $ \ptr end -> do
+            getOutput str ptr end
+            resetOutput (castRegister reg)
+            outputStringReverse ptr end (castRegister reg)
+          inner
+      compileGen (PrimCall PrimOpUnpackByteSpans [arg] _) (Just reg) inner =
+        withTerm vars arg $ \array -> do
+          local $ \ptr end -> do
+            getOutput array ptr end
+            resetOutput (castRegister reg)
+            outputUnpackByteSpans ptr end (castRegister reg)
+          inner
+      compileGen PrimCall{} _ _ = error "compileGen: unknown PrimCall"
+
+      compileGen (ArrayElementGenerator _ _) Nothing inner = inner
+      compileGen (ArrayElementGenerator eltTy term) (Just reg) inner =
+        withTerm vars term $ \array -> do
+          local $ \len off -> mdo
+            local $ \ptr end -> do
+              getOutput array ptr end
+              ptrDiff ptr end len
+              local $ \start -> do
+                move ptr start
+                -- the number of elements is useless to us, since we need
+                -- to traverse the array linearly. We'll use the length
+                -- to know when we've reached the end.
+                inputSkipNat ptr end
+                ptrDiff start ptr off
+            jumpIfEq off len done
+
+            loop <- label
+            -- Note that ptr/len are not valid here, because we might
+            -- have suspended and resumed during the previous
+            -- iteration of the loop, so we must getOutput again.
+            -- We're maintaining the current offset into the array
+            -- value in the 'off' register.
+            local $ \ptr end -> do
+              getOutput array ptr end
+              ptrDiff ptr end len
+              add off ptr
+              local $ \start size -> do
+                -- really want to just matchPat here
+                move ptr start
+                if
+                  | isByteTy eltTy ->
+                    inputByte ptr end reg
+                  | isWordTy eltTy ->
+                    inputNat ptr end reg
+                  | otherwise -> do
+                    skipTrusted ptr end eltTy
+                    resetOutput (castRegister reg)
+                    outputBytes start ptr (castRegister reg)
+                ptrDiff start ptr size
+                add size off
+            a <- inner
+            jumpIfLt off len loop
+            done <- label
+            return a
+
+      compileGen (SetElementGenerator _ _) Nothing inner = inner
+      compileGen (SetElementGenerator eltTy term) r@(Just _reg) inner =
+        compileGen (ArrayElementGenerator eltTy term) r inner
+
+      -- derived fact where we don't bind the Fid: no need to store it
+      compileGen DerivedFactGenerator{} Nothing inner = inner
+
+      -- derived fact where we bind the Fid: generate the key and
+      -- store the fact in the environment.
+      compileGen (DerivedFactGenerator (PidRef pid _) key val)
+          (Just resultReg) inner = do
+        rpid <- constant (fromIntegral (fromPid pid))
+
+        let
+          isEmpty (Ref (MatchVar (Var ty _ _))) = isEmptyTy ty
+          isEmpty (Tuple []) = True
+          isEmpty _ = False
+
+        local $ \size -> do
+
+        if
+          | isEmpty val ->
+            withTerm vars key $ \out -> do
+              getOutputSize out size
+              newDerivedFact rpid out size resultReg
+          | isEmpty key ->
+            withTerm vars val $ \out -> do
+              getOutputSize out size
+              newDerivedFact rpid out size resultReg
+          | otherwise ->
+            output $ \out -> do
+              buildTerm out vars key
+              getOutputSize out size
+              buildTerm out vars val
+              newDerivedFact rpid out size resultReg
+
+        inner
+
+      compileGen
+        (FactGenerator (PidRef pid _) kpat vpat range) maybeReg inner = do
+        let mtrans = lookupTransformation pid qtrans
+        compileFactGenerator
+          mtrans bounds regs vars pid kpat vpat range maybeReg inner
+
+
+      -- Perform an action but interrupt it and clean-up after the first result.
+      singleResult :: (forall a. Code a -> Code a) -> Code b -> Code b
+      singleResult action continue =
+        local $ \seekLevel -> mdo
+          currentSeek seekLevel
+          action $ mdo
+            endSeek seekLevel
+            jump success
+          jump fail
+          success <- label
+          a <- continue
+          fail <- label
+          return a
+
+-- | Match term against the default value for its type
+matchDef
+  :: QueryRegs
+  -> Label
+  -> Type
+  -> Term (Match TransformAndBind Output)
+  -> Code ()
+matchDef syscalls fail ty pat =
+  output $ \out -> do
+  buildTerm out mempty (defaultValue ty)
+  local $ \start end -> do
+  getOutput out start end
+  matchPat syscalls (Bytes start end) fail (preProcessPat pat)
+
+compileFactGenerator
+  :: forall a
+  . Maybe PredicateTransformation
+  -> Boundaries
+  -> QueryRegs
+  -> Vector (Register 'Word)    -- ^ registers for variables
+  -> Pid
+  -> Pat
+  -> Pat
+  -> SeekSection
+  -> Maybe (Register 'Word)
+  -> Code a
+  -> Code a
+compileFactGenerator mtrans bounds qregs@QueryRegs{..}
+    vars pid kpat vpat section maybeReg inner = mdo
+  let etrans = maybe (Left pid) Right mtrans
+  withPatterns qregs etrans vars kpat vpat $
+    \availablePid isPointQuery prefix matchKey matchValue -> do
+
+  typ <- constant $ fromIntegral $ fromPid availablePid
+  local $ \seekTok -> mdo
+  let Bytes pstart pend = prefix
+  seek' typ pstart pend seekTok
+
+  -- for each fact...
+  loop <- label
+
+  local $ \clause keyend clauseend -> mdo
+      let need_value = isJust matchValue
+      local $ \ignore ok -> do
+        next
+          seekTok
+          need_value
+          ok
+          clause
+          keyend
+          clauseend
+          (fromMaybe ignore maybeReg)
+
+        select ok
+          [ end  -- 0 -> no match
+          , continue  -- 1 -> match
+          ]
+      suspend saveState loop -- 2 -> timeout / interrupted
+      continue <- label
+      return ()
+
+     -- check that the key matches the pattern
+      matchKey (Bytes clause keyend) loop
+
+      -- match the value
+      forM_ matchValue $ \match -> match (Bytes keyend clauseend) loop
+
+  a <- inner
+
+  -- loop to find more facts, unless this is a point query which could
+  -- only have a single result.
+  unless isPointQuery $ jump loop
+
+  end <- label
+  endSeek seekTok
+  return a
+  where
+    seek' typ ptr end tok =
+      case (section, bounds) of
+        (SeekOnAllFacts, _) -> seek typ ptr end tok
+        (SeekOnBase, StackedBoundaries (SectionBoundaries from to) _) ->
+          seekBetween from to
+        (SeekOnStacked, StackedBoundaries _ (SectionBoundaries from to)) ->
+          seekBetween from to
+        _ -> error "unexpected section seek on non-stacked db"
+      where
+        seekBetween from to = do
+          pfrom <- constant $ fromIntegral $ fromFid from
+          pto <- constant $ fromIntegral $ fromFid to
+          seekWithinSection typ ptr end pfrom pto tok
+
+
+-- ^ Extract a prefix to be searched and create code to match on the key and
+-- value of facts searched.
+--
+-- If the transformation determines that the modified pattern will never match
+-- the callback code will be skipped at runtime.
+withPatterns
+  :: QueryRegs
+  -> Either Pid PredicateTransformation
+  -> Vector (Register 'Word)    -- ^ registers for variables
+  -> Pat                        -- ^ key pattern
+  -> Pat                        -- ^ value pattern
+  ->  (  Pid                                -- predicate to search for
+      -> IsPointQuery
+      -> Bytes                              -- prefix
+      -> (Bytes -> Label -> Code ())        -- match key
+      -> Maybe (Bytes -> Label -> Code ())  -- match value
+      -> Code a
+    )
+  -> Code a
+withPatterns syscalls etrans vars kpat vpat act = mdo
+  a <-
+    transKeyPat (matchDef syscalls fail) (inlineVars vars kpat) $ \kpat' -> do
+    transValPat (matchDef syscalls fail) (inlineVars vars vpat) $ \vpat' -> do
+    let kchunks = preProcessPat kpat'
+        vchunks = preProcessPat vpat'
+    when (emptyPrefix kchunks) (fullScan pid)
+    withPrefix kchunks $ \isPointQuery prefix remaining -> do
+    let matchKey bytes fail = matchPat syscalls bytes fail remaining
+        matchVal bytes fail = matchPat syscalls bytes fail vchunks
+        needs_value = not (all isWild vchunks)
+    act pid isPointQuery prefix matchKey
+      (if needs_value then Just matchVal else Nothing)
+  fail <- label
+  return a
+  where
+    (pid, transKeyPat, transValPat) = case etrans of
+      Right PredicateTransformation{..} ->
+        let PidRef pid _ = tAvailable in
+        ( pid
+        , fromMaybe noTrans (transformKeyPattern <*> Just syscalls)
+        , fromMaybe noTrans (transformValuePattern <*> Just syscalls)
+        )
+      Left pid ->
+        ( pid
+        , noTrans
+        , noTrans
+        )
+    noTrans _ bytes f = f bytes
+
+-- Extract a query prefix and a pattern which should match the entire
+-- structure
+withPrefix
+  :: [QueryChunk Output]
+  -> ( IsPointQuery
+      -> Bytes                       -- prefix bytes
+      -> [QueryChunk Output] -- match against results from the beginning
+      -> Code a)
+  -> Code a
+withPrefix chunks fun =
+  case chunks of
+    -- Special case for a QueryBind that covers the whole
+    -- pattern. This is used to capture the key of a fact so
+    -- that we can return it, but we don't want it to interfere
+    -- with prefix lookup.
+    [QueryAnd left right]
+      | emptyPrefix left && not (emptyPrefix right) ->
+        withPrefix [QueryAnd right left] fun
+      | not $ emptyPrefix left ->
+        withPrefix left $ \isPointQuery bytes filters ->
+          fun isPointQuery bytes $
+            if null filters
+               then right
+               else [QueryAnd filters right]
+
+    -- Just a fixed ByteString: use it directly
+    (QueryPrefix bs : rest) | emptyPrefix rest ->
+      local $ \ptr end -> do
+      loadLiteral bs ptr end
+      wildPrefixFor rest (Bytes ptr end) fun
+
+    -- A variable: use it directly
+    (QueryVar (Typed ty out) : rest)
+      | emptyPrefix rest, not (isWordTy ty) ->
+      local $ \ptr end -> do
+        getOutput out ptr end
+        wildPrefixFor rest (Bytes ptr end) fun
+
+      -- Otherwise: build up the prefix in a binary::Output
+      -- (register 'prefixOut')
+    _otherwise ->
+        buildPrefix chunks $ \prefixOut chunks' ->
+        local $ \ptr end -> do
+        getOutput prefixOut ptr end
+        wildPrefixFor chunks' (Bytes ptr end) fun
+  where
+    wildPrefixFor
+      :: [QueryChunk Output]
+      -- ^ non-prefix filters
+      -> Bytes
+      -- ^ prefix bytes
+      -> ( Bool
+          -> Bytes
+          -> [QueryChunk Output]
+          -> Code a)
+      -- ^ send prefix-adjusted filters
+      -> Code a
+    wildPrefixFor chunks prefix@(Bytes ptr end) fun =
+      if null chunks
+      then fun True prefix []
+      else
+        local $ \prefix_size -> do
+        ptrDiff ptr end prefix_size
+        fun False prefix (QueryPrefixWild prefix_size : chunks)
+
+-- ----------------------------------------------------------------------------
+
+-- | A pre-processed pattern, ready for compilation to bytecode
+data QueryChunk var =
+   -- | A literal sequence of bytes to match, corresponding to a
+   -- fragment of the serialized pattern
+   QueryPrefix ByteString
+
+   -- | a sequence of bytes to skip over
+ | QueryPrefixWild (Register 'Word)
+
+   -- | An array prefix of length N
+ | QueryArrayPrefix
+    Word64                -- ^ Length
+    Type                  -- ^ Element type
+    [QueryChunk var]      -- ^ chunks for the prefix
+
+   -- | A wildcard, represented as the type of the fragment to skip over
+ | QueryWild Type
+
+   -- | Never matches
+ | QueryNever
+
+   -- | A binder: like a wildcard, but we capture the fragment and bind
+   -- it to a variable
+ | QueryBind var
+
+  -- | Transform a fragment into a different type and bind it to a variable
+ | QueryTransformAndBind Type var
+
+   -- | A variable: match this fragment against the specified variable
+ | QueryVar var
+
+   -- | Match two patterns simultaneously. This is the preprocessed
+   -- equivalent of 'MatchAnd'.
+ | QueryAnd [QueryChunk var] [QueryChunk var]
+
+   -- | A sum type, with different matchers for each of the alternatives.
+   -- If an alternative is Nothing, then the pattern does not match
+   -- that alternative.
+ | QuerySum [Maybe [QueryChunk var]]
+ deriving Show
+
+type M a = StateT (Builder, Bool, [QueryChunk Output]) IO a
+  -- @Bool@ is whether the builder is empty (True for empty, False for non-empty)
+
+instance IsWild (QueryChunk var) where
+  isWild QueryWild{} = True
+  isWild QueryPrefixWild{} = True
+  isWild _ = False
+
+inlineVars
+  :: Vector (Register 'Word)
+  -> Term (Match () Var)
+  -> Term (Match TransformAndBind Output)
+inlineVars vars term = fmap (bimap (error "inlineVars") toOutput) term
+  where
+    toOutput :: Var -> Output
+    toOutput (Var ty v _) = Typed ty (castRegister (vars ! v))
+
+--
+-- | Process a query into a [QueryChunk], which enables the compiler to
+-- generate efficient code for a pattern match.
+--
+preProcessPat :: Term (Match TransformAndBind Output) -> [QueryChunk Output]
+preProcessPat pat = unsafePerformIO $
+  withBuilder $ \builder -> do
+    (_, (_, _, chunks)) <-
+      flip runStateT (builder, True, []) $
+         build pat >> endOfChunk
+    return (reverse chunks)
+  where
+  builder :: M Builder
+  builder = do
+    (b, empty, chunks) <- get
+    if empty
+      then do
+        put (b, False, chunks)
+        return b
+      else return b
+
+  endOfChunk :: M ()
+  endOfChunk= do
+    (b,empty,chunks) <- get
+    if empty
+      then return ()
+      else do
+        bs <- lift $ finishBuilder b
+        lift $ resetBuilder b
+        put (b, True, QueryPrefix bs : chunks)
+
+  getChunks :: M () -> M [QueryChunk Output]
+  getChunks m = do
+    (b, empty, saveChunks) <- get
+    put (b, empty, [])
+    m
+    endOfChunk
+    (b, empty, chunks) <- get
+    put (b, empty, saveChunks)
+    return (reverse chunks)
+
+  chunk c = do
+    endOfChunk
+    modify $ \(b, empty, chunks) -> (b, empty, c : chunks)
+
+  prefixString s = do
+    b <- builder
+    lift $ FFI.unsafeWithBytes s $ \p n ->
+      FFI.call $ glean_push_value_bytes b (castPtr p) n
+      -- NB. Use glean_push_value_bytes to omit the NUL NUL suffix.
+      -- Thus the remaining input is a valid string, and we can continue
+      -- by matching it as a StringTy with QueryWild or QueryBind.
+
+  build :: Term (Match TransformAndBind Output) -> M ()
+  build pat =
+    case pat of
+      Array terms -> do
+        b <- builder
+        lift $ FFI.call $ glean_push_value_array b $ fromIntegral $ length terms
+        mapM_ build terms
+      Tuple terms -> mapM_ build terms
+      (Alt ix term) -> do
+          b <- builder
+          lift $ FFI.call $ glean_push_value_selector b $ fromIntegral ix
+          build term
+      Ref (MatchVar out) -> chunk $ QueryVar out
+      Ref (MatchBind out) -> chunk $ QueryBind out
+      Ref (MatchWild ty) -> chunk (QueryWild ty)
+      Ref (MatchNever _) -> chunk QueryNever
+      Ref (MatchFid fid) -> do
+        b <- builder
+        lift $ FFI.call $ glean_push_value_fact b fid
+      -- optimise MatchAnd where one side is a wildcard:
+      Ref (MatchAnd (Ref MatchWild{}) b) -> build b
+      Ref (MatchAnd a (Ref MatchWild{})) -> build a
+      Ref (MatchAnd a b) -> do
+        endOfChunk
+        chunk =<< QueryAnd <$> getChunks (build a) <*> getChunks (build b)
+      Ref (MatchPrefix txt rest) -> do
+        prefixString txt
+        build rest
+      Ref (MatchArrayPrefix ty prefix all) -> do
+        endOfChunk
+        let arr = do
+              chunks <- getChunks $ mapM_ build prefix
+              chunk $ QueryArrayPrefix (genericLength chunks) ty chunks
+        chunk =<< QueryAnd <$> getChunks arr <*> getChunks (build all)
+      Ref (MatchExt (TransformAndBind src dst)) ->
+        chunk $ QueryTransformAndBind src dst
+      Byte w -> do
+        b <- builder
+        lift $ FFI.call $ glean_push_value_byte b w
+      Nat w -> do
+        b <- builder
+        lift $ FFI.call $ glean_push_value_nat b w
+      String s -> do
+        b <- builder
+        lift $ FFI.unsafeWithBytes s $ \p n ->
+          FFI.call $ glean_push_value_string b (castPtr p) n
+      ByteArray bs -> do
+        b <- builder
+        lift $ encodeByteArray b bs
+
+-- | True if the prefix of this query is empty
+emptyPrefix :: [QueryChunk var] -> Bool
+emptyPrefix (QueryPrefix{} : _) = False
+emptyPrefix (QueryVar{} : _) = False
+emptyPrefix [QueryAnd [QueryBind{}] x] = emptyPrefix x
+emptyPrefix [QueryAnd [QueryTransformAndBind{}] x] = emptyPrefix x
+emptyPrefix _ = True
+
+-- | Serialize the prefix of a query into an output register, and return
+-- the remaining non-prefix part of the query.
+buildPrefix
+  :: [QueryChunk Output]
+  -> (Register 'BinaryOutputPtr -> [QueryChunk Output] -> Code a)
+  -> Code a
+buildPrefix chunks cont =
+  output $ \out -> do
+    go out cont chunks
+  where
+  go out cont [] = cont out []
+  go out cont (chunk:rest) = case chunk of
+    QueryPrefix bs -> do
+      local $ \ptr end -> do
+        loadLiteral bs ptr end
+        outputBytes ptr end out
+      go out cont rest
+    QueryVar (Typed ty o) | isByteTy ty -> do
+      outputByte (castRegister o) out
+      go out cont rest
+    QueryVar (Typed ty o) | isWordTy ty -> do
+      outputNat (castRegister o) out
+      go out cont rest
+    -- every other type is currently represented as a binary::Output
+    QueryVar (Typed _ o) -> do
+      local $ \ptr end -> do
+        getOutput o ptr end
+        outputBytes ptr end out
+      go out cont rest
+    _ -> cont out (chunk:rest)
+      -- We might want to consider handling QuerySum here: if an
+      -- alt can be serialized to a prefix, it might be better
+      -- to seek to it directly. But then we would possibly have
+      -- to do multiple seeks.
+
+-- | Load a term that is expected to be word-typed into a register.
+withNatTerm
+  :: Vector (Register 'Word)    -- ^ registers for variables
+  -> Expr
+  -> (Register 'Word -> Code a)
+  -> Code a
+withNatTerm vars term andThen = do
+  case term of
+    Nat n ->
+      local $ \r -> do loadConst (fromIntegral n) r; andThen r
+    Byte n ->
+      local $ \r -> do loadConst (fromIntegral n) r; andThen r
+    Ref (MatchFid f) ->
+      local $ \r -> do loadConst (fromIntegral (fromFid f)) r; andThen r
+    Ref (MatchVar (Var ty v _)) | isWordTy ty ->
+      andThen (vars ! v)
+    _other ->
+      error "withNatTerm: shouldn't happen"
+
+-- | Serialize a term into an output register. A copy is avoided if
+-- the term is already represented by an output register.
+withTerm
+  :: Vector (Register 'Word)
+  -> Term (Match () Var)
+  -> (Register 'BinaryOutputPtr -> Code a)
+  -> Code a
+withTerm vars (Ref (MatchVar (Var ty v _))) action
+  | not (isWordTy ty) = action (castRegister (vars ! v))
+withTerm vars term action = do
+  output $ \reg -> do
+    buildTerm reg vars term
+    action reg
+
+-- | Execute a piece of code repeatedly for as long as it keeps producing
+-- new facts.
+--
+-- The first argument is executed once first.
+-- If it defines new facts then the second argument is executed repeatedly
+-- for as long as it keeps adding facts to the Define.
+--
+recursive
+  :: QueryRegs
+  -> (forall a. Code a -> Code a)  -- ^ code for first run
+  -> (forall a. Code a -> Code a)  -- ^ code to evaluate repeatedly
+  -> Code b                        -- ^ code to insert after
+  -> Code b
+recursive QueryRegs{..} before after andThen =
+  local $ \innerRet startId deltaId -> mdo
+
+  firstFreeId startId
+  siteBefore <- before $ mdo
+    site <- callSite
+    loadLabel ret_ innerRet
+    jump doInner
+    ret_ <- label
+    return site
+  firstFreeId deltaId
+
+  -- skip to end if there were no new facts produced
+  local $ \difference -> mdo
+    move deltaId difference
+    sub startId difference
+    jumpIf0 difference done
+
+  recurse <- label
+  move deltaId startId
+  siteAfter <- after $ mdo
+    site <- callSite
+    loadLabel ret_ innerRet
+    jump doInner
+    ret_ <- label
+    return site
+  firstFreeId deltaId
+
+  -- execute 'after' again if there are new facts
+  local $ \difference -> mdo
+    move deltaId difference
+    sub startId difference
+    jumpIfNot0 difference recurse
+    jump done
+
+  doInner <- label
+  a <- calledFrom [siteBefore, siteAfter] andThen
+  jumpReg innerRet
+
+  done <- label
+  return a
+
+-- | check that a value matches a pattern, and bind variables as
+-- necessary. The pattern is assumed to cover the *whole* of the
+-- input.
+matchPat :: QueryRegs -> Bytes -> Label -> [QueryChunk Output] -> Code ()
+matchPat syscalls (Bytes input inputend) fail chunks = match True chunks
+  where
+  match
+    :: Bool -- ^ whether the query chunks match until the end of the input.
+    -> [QueryChunk Output]
+    -> Code ()
+  match _ [] = return ()
+  match tillEnd (x:rest) =
+    let isLastPattern = tillEnd && null rest in
+    case x of
+      QueryPrefix bs -> local $ \ok -> do
+        inputShiftLit input inputend bs ok
+        jumpIf0 ok fail -- chunk didn't match
+        match tillEnd rest
+
+      QueryPrefixWild prefix_size -> do
+        add prefix_size input
+        match tillEnd rest
+
+      QueryWild ty
+        -- skip trailing wildcards
+        | tillEnd && all isWild rest -> return ()
+        | otherwise -> do
+          skipTrusted input inputend ty
+          match tillEnd rest
+
+      QueryNever -> jump fail
+
+      QueryVar (Typed ty out)
+        | isEmptyTy ty -> match tillEnd rest
+        | isWordTy ty -> do
+            local $ \id -> do
+              inputNat input inputend id
+              jumpIfNe id (castRegister out) fail
+            match tillEnd rest
+          -- the empty tuple could be represented by a null pointer, so it's
+          -- not safe to do inputShiftBytes anyway.
+        | otherwise -> do
+          local $ \ptr end ok -> do
+            getOutput out ptr end
+            inputShiftBytes input inputend ptr end ok
+            jumpIf0 ok fail
+          match tillEnd rest
+
+      QueryAnd a b
+        | all isWild a -> match tillEnd (b ++ rest)
+        | otherwise -> do
+        local $ \start -> do
+          move input start
+          match isLastPattern a
+          move start input
+        match isLastPattern b
+        match tillEnd rest
+
+      QuerySum alts -> mdo
+        local $ \sel -> do
+          inputNat input inputend sel
+          -- an unknown alternative always fails to match.
+          let unknown = [fail]
+          select sel (lbls ++ unknown)
+        raise "selector out of range"
+        lbls <- forM alts $ \mb -> do
+          case mb of
+            Nothing -> return fail
+            Just chunks -> do
+              lbl <- label
+              match isLastPattern chunks
+              jump end
+              return lbl
+        end <- label
+        match tillEnd rest
+
+      QueryBind (Typed ty out)
+        | isWordTy ty -> do
+          inputNat input inputend (castRegister out)
+          match tillEnd rest
+        | otherwise -> do
+          let outReg = castRegister out
+          resetOutput outReg
+          if isLastPattern
+            -- we don't need to traverse the data, just copy the bytes.
+            then outputBytes input inputend outReg
+            else local $ \start -> do
+              move input start
+              skipTrusted input inputend ty
+              outputBytes start input outReg
+              match tillEnd rest
+
+      QueryTransformAndBind from (Typed to out) ->
+        case transformBytes syscalls from to of
+          Nothing -> match tillEnd (QueryBind (Typed to out) : rest)
+          Just transform -> do
+            let bytes = Bytes input inputend
+            resetOutput out
+            transform bytes out
+            match tillEnd rest
+
+      QueryArrayPrefix npatterns ty patterns -> do
+        local $ \size patternsLen -> do
+          loadConst npatterns patternsLen
+          inputNat input inputend size
+          jumpIfLt size patternsLen fail
+          match isLastPattern patterns
+          -- skip to the end unless we are done matching this branch, in which
+          -- case we don't need to leave the 'input' pointer in the right
+          -- place.
+          unless isLastPattern $ mdo
+            sub patternsLen size
+            jumpIf0 size done
+            skip <- label
+            skipTrusted input inputend ty
+            decrAndJumpIfNot0 size skip
+
+            done <- label
+            match tillEnd rest
+
+-----------------------------------------------------------------------------
+
+-- | Compile a query for some facts, possibly with recursive expansion.
+compileQueryFacts :: [FactQuery] -> IO CompiledQuery
+compileQueryFacts facts = do
+  input <- withBuilder $ \builder -> do
+    buildRtsValue builder
+      [ (fromIntegral factQuery_id :: Word64,
+          if factQuery_recursive then 1 else 0 :: Word64)
+      | FactQuery{..} <- facts ]
+    finishBuilder builder
+  (Meta{..}, sub) <- generateQueryCode $ \ QueryRegs{..} ->
+    outputUninitialized $ \kout vout -> local $ \fid pid rec_ ptr end -> do
+      loadLiteral input ptr end
+      local $ inputNat ptr end -- ignore the size
+      loop <- label
+      inputNat ptr end fid
+      inputNat ptr end rec_
+      lookupKeyValue fid kout vout pid
+      resultWithPid fid kout vout pid rec_
+      jumpIfLt ptr end loop
+      ret
+  return (CompiledQuery sub Nothing Nothing meta_fullScans)
+
+-- -----------------------------------------------------------------------------
+-- The FFI layer for query bytecode subroutines
+--
+-- IF YOU BREAK BACKWARD COMPATIBILITY HERE, BUMP version IN
+-- Glean.Bytecode.Generate.Instruction
+--
+-- IF YOU ALSO BREAK FORWARD COMPATIBILITY, BUMP latestSupportedVersion AS WELL
+--
+
+generateQueryCode
+  :: (QueryRegs -> Code ())
+  -> IO (Meta, Subroutine CompiledQuery)
+generateQueryCode f = generate Optimised $
+  \ seek_ seekWithinSection_ currentSeek_ endSeek_ next_
+    lookupKey_ result_ resultWithPid_ newDerivedFact_
+    firstFreeId_ newSet_ insertOutputSet_ setToArray_ freeSet_
+    newWordSet_ insertWordSet_ wordSetToArray_ byteSetToByteArray_ freeWordSet_
+    saveState maxResults maxBytes ->
+  let
+    seek typ ptr end tok =
+      callFun_3_1 seek_ typ (castRegister ptr) (castRegister end) tok
+
+    seekWithinSection typ ptr end pfrom pto tok =
+      callFun_5_1 seekWithinSection_
+        typ
+        (castRegister ptr)
+        (castRegister end)
+        (castRegister pfrom)
+        (castRegister pto)
+        tok
+
+    currentSeek tok = callFun_0_1 currentSeek_ tok
+
+    endSeek tok = callFun_1_0 endSeek_ tok
+
+    next tok need_value ok clause keyend clauseend id = do
+      demand <- constant $ if need_value then 1 else 0
+      callFun_2_5 next_
+        tok
+        demand
+        ok
+        (castRegister clause)
+        (castRegister keyend)
+        (castRegister clauseend)
+        id
+
+    lookupKeyValue id kout vout pid =
+      callFun_3_1 lookupKey_ id (castRegister kout) (castRegister vout) pid
+
+    result id key val new =
+      callFun_3_1 result_ id (castRegister key) (castRegister val) new
+
+    resultWithPid id key val pid recexp =
+      callFun_5_0 resultWithPid_ id (castRegister key) (castRegister val)
+        pid recexp
+
+    newDerivedFact ty key val id =
+      callFun_3_1 newDerivedFact_ ty (castRegister key) (castRegister val) id
+
+    firstFreeId fid =
+      callFun_0_1 firstFreeId_ fid
+
+    newSet setToken =
+      callFun_0_1 newSet_ setToken
+
+    insertOutputSet setToken outputPtr =
+      callFun_2_0 insertOutputSet_ setToken (castRegister outputPtr)
+
+    setToArray setToken outputPtr =
+      callFun_2_0 setToArray_ setToken (castRegister outputPtr)
+
+    freeSet setToken =
+      callFun_1_0 freeSet_ setToken
+
+    newWordSet setToken =
+      callFun_0_1 newWordSet_ setToken
+
+    insertWordSet setToken outputPtr =
+      callFun_1_1 insertWordSet_ setToken (castRegister outputPtr)
+
+    wordSetToArray setToken outputPtr =
+      callFun_1_1 wordSetToArray_ setToken (castRegister outputPtr)
+    byteSetToByteArray setToken outputPtr =
+      callFun_1_1 byteSetToByteArray_ setToken (castRegister outputPtr)
+
+    freeWordSet setToken =
+      callFun_1_0 freeWordSet_ setToken
+
+  in
+    f QueryRegs{..}
diff --git a/glean/db/Glean/Query/Codegen/QueryRegs.hs b/glean/db/Glean/Query/Codegen/QueryRegs.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Codegen/QueryRegs.hs
@@ -0,0 +1,142 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Codegen.QueryRegs
+  ( QueryRegs(..)
+  ) where
+
+import Glean.Bytecode.Types
+import Glean.RTS.Bytecode.Code
+
+data QueryRegs = QueryRegs
+  {
+    -- | Start a new traversal of facts beginning with a given prefix
+    seek
+     :: Register 'Word -- predicate id
+     -> Register 'DataPtr -- prefix
+     -> Register 'DataPtr -- prefix end
+     -> Register 'Word -- (output) token
+     -> Code ()
+
+  , seekWithinSection
+     :: Register 'Word -- predicate id
+     -> Register 'DataPtr -- prefix
+     -> Register 'DataPtr -- prefix end
+     -> Register 'Word -- section start
+     -> Register 'Word -- section end
+     -> Register 'Word -- (output) token
+     -> Code ()
+
+    -- | Fetch the current seek token
+  , currentSeek
+     :: Register 'Word
+     -> Code ()
+
+    -- | Release the state associated with an iterator token
+  , endSeek
+     :: Register 'Word
+     -> Code ()
+
+    -- | Grab the next fact in a traversal
+  , next
+     :: Register 'Word     -- token
+     -> Bool               -- do we need the value?
+     -> Register 'Word     -- result
+     -> Register 'DataPtr  -- clause begin
+     -> Register 'DataPtr  -- key end
+     -> Register 'DataPtr  -- clause end
+     -> Register 'Word     -- id
+     -> Code ()
+
+    -- | Fact lookup
+  , lookupKeyValue
+     :: Register 'Word
+     -> Register 'BinaryOutputPtr
+     -> Register 'BinaryOutputPtr
+     -> Register 'Word
+     -> Code ()
+
+    -- | Record a result
+  , result
+     :: Register 'Word
+     -> Register 'BinaryOutputPtr
+     -> Register 'BinaryOutputPtr
+     -> Register 'Word
+     -> Code ()
+
+    -- | Record a result, with a given pid and optional recursive expansion
+  , resultWithPid
+     :: Register 'Word
+     -> Register 'BinaryOutputPtr
+     -> Register 'BinaryOutputPtr
+     -> Register 'Word
+     -> Register 'Word
+     -> Code ()
+
+    -- | Record a new derived fact
+  , newDerivedFact
+     :: Register 'Word
+     -> Register 'BinaryOutputPtr
+     -> Register 'Word
+     -> Register 'Word
+     -> Code ()
+
+  , firstFreeId
+    :: Register 'Word -- first free id
+    -> Code ()
+
+  , newSet
+    :: Register 'Word -- (output) set token
+    -> Code ()
+
+  , insertOutputSet
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr
+    -> Code ()
+
+  , setToArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , freeSet
+    :: Register 'Word -- set token (invalid after this call)
+    -> Code ()
+
+  , newWordSet
+    :: Register 'Word -- (output) set token
+    -> Code ()
+
+  , insertWordSet
+    :: Register 'Word -- set token
+    -> Register 'Word
+    -> Code ()
+
+  , wordSetToArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , byteSetToByteArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , freeWordSet
+    :: Register 'Word -- set token (invalid after this call)
+    -> Code ()
+
+    -- | Unused, temporarily kept for backwards compatibility
+  , saveState :: Register 'Word
+
+    -- | Maximum number of results to return
+  , maxResults :: Register 'Word
+
+    -- | Maximum number of bytes to return
+  , maxBytes :: Register 'Word
+  }
diff --git a/glean/db/Glean/Query/Codegen/Types.hs b/glean/db/Glean/Query/Codegen/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Codegen/Types.hs
@@ -0,0 +1,394 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveTraversable #-}
+module Glean.Query.Codegen.Types
+  ( Match(..)
+  , matchVar
+  , isVar
+  , Var(..)
+  , CodegenQuery
+  , QueryWithInfo(..)
+  , CgQuery(..)
+  , CgStatement_(..)
+  , CgStatement
+  , Generator_(..)
+  , Generator
+  , SeekSection(..)
+  , Pat
+  , Expr
+  , PrimOp(..)
+  , Typed(..)
+  , Output
+  , TransformAndBind(..)
+  ) where
+
+import Data.Bifunctor
+import Data.Bifoldable
+import Data.Bitraversable
+import Data.ByteString (ByteString)
+import Data.Maybe (fromMaybe)
+import Data.Text (Text)
+import Compat.Prettyprinter
+
+import Glean.Angle.Types (IsWild(..), PrimOp(..), SeekSection(..))
+import Glean.Bytecode.Types (Register, Ty(..))
+import Glean.Display
+import Glean.RTS.Term
+import Glean.RTS.Types (Type, Fid, PidRef)
+
+-- | A Query with flat generators, ready for compilation
+type CodegenQuery = QueryWithInfo CgQuery
+
+data QueryWithInfo q = QueryWithInfo
+  { qiQuery :: q
+  , qiNumVars :: Int    -- ^ maximum index of any Var + 1
+  , qiGenerator :: Maybe Generator -- see Note [query result] in Flatten.hs
+  , qiReturnType :: Type
+  }
+
+-- -----------------------------------------------------------------------------
+-- Flattened Query types
+
+-- | A query produces a finite series of terms
+data CgQuery = CgQuery
+  { -- | For each result produced by the query body, build this
+    -- term. It cannot contain 'MatchWild' or 'MatchBind'.
+    flatQueryHead :: Expr
+
+    -- | A sequence of statements, like a list
+    -- comprehension. Variables bound by each statement scope over the
+    -- statements that follow it.
+  , flatQueryBody :: [CgStatement]
+  }
+  deriving Show
+
+-- | A statement is either a single generator:
+--
+-- >  pat = gen
+--
+-- or a disjunction:
+--
+-- > (stmt; ...) | ... | (stmt; ...)
+--
+data CgStatement_ var
+  = CgStatement (Pat_ var) (Generator_ var)
+  | CgAllStatement var (Expr_ var) [CgStatement_ var]
+  | CgNegation [CgStatement_ var]
+  | CgDisjunction [[CgStatement_ var]]
+  -- ^ For rationale, see Note [why do we have sequential composition?]
+  | CgConditional
+    { cond :: [CgStatement_ var]
+    , then_ :: [CgStatement_ var]
+    , else_ :: [CgStatement_ var]
+    }
+  deriving (Show, Functor, Foldable, Traversable)
+
+
+type CgStatement = CgStatement_ Var
+
+{- Note [why do we have sequential composition?]
+
+The issue is that queries for sum types can't necessarily be handled
+by nested generators. Consider
+
+  v = cxx1.FunctionName (name(cxx1.Name "xyz" ) | operator(cxx1.Name "+"))
+
+If we flattened this into nested generators we would get
+
+  x = cxx1.Name "xyz"
+  y = cxx1.Name "+"
+  z = cxx1.FunctionName (name x | operator y)
+
+Now suppose there is no name xyz. This query will match nothing,
+because the generator for cxx1.Name "xyz" would be empty.  (even if
+the generator matched, flattening out the generators like this will
+test too many combinations and do too much work).
+
+With sequential composition of queries we can do it like this:
+
+ n = (name x where x = cxx1.Name "xyz") |
+     (operator x where x = cxx1.Name "+")
+ v = cxx1.FunctionName n
+
+(Note that this query won't work if you write it because we can't
+typecheck the sub-query "name x where ...", but we can generate the
+AST for it in the JSON query compiler.)
+-}
+
+type Generator = Generator_ Var
+
+-- | A generator produces a finite series of terms
+data Generator_ var
+    -- | Enumerate facts of a predicate matching a pattern
+    --
+    -- > v = pred pat
+    -- > ...
+    --
+    -- The left-hand side can be any pattern that matches the fact ID,
+    -- so for example to look up a specific fact we can do
+    --
+    -- > 1234 = pred _
+    --
+  = FactGenerator
+    { -- | Predicate to search
+      generatorPid :: PidRef
+
+      -- | match the fact key
+    , generatorPat :: Pat_ var
+
+      -- | match the fact value
+    , generatorValue :: Pat_ var
+
+      -- | restrict the range of fact ids this generator can produce.
+    , generatorSeekSection :: SeekSection
+    }
+
+    -- | Generate values
+  | TermGenerator (Expr_ var)
+
+    -- | Produces facts of a derived predicate. The values of
+    -- this generator are fact IDs that refer to facts in the
+    -- temporary Environment produced by a query.
+  | DerivedFactGenerator
+    { generatorPid :: PidRef
+    , generatorKey :: Expr_ var
+    , generatorValue :: Expr_ var
+    }
+
+    -- | Produces all elements of an array
+  | ArrayElementGenerator
+    { generatorEltTy :: Type        -- type of the elements
+    , generatorArray :: Expr_ var
+    }
+
+    -- | Produce all elements of a set
+  | SetElementGenerator
+    { generatorEltTy :: Type
+    , generatorSet :: Expr_ var
+    }
+
+  | PrimCall
+    { primOp :: PrimOp
+    , primOpArgs :: [Expr_ var]
+    , primOpRetType :: Type
+    }
+  deriving (Eq, Show, Functor, Foldable, Traversable)
+
+type Pat = Pat_ Var
+type Expr = Expr_ Var
+
+type Pat_ var = Term (Match () var)
+type Expr_ var = Term (Match () var)
+
+type Output = Typed (Register 'BinaryOutputPtr)
+
+isVar :: Pat -> Maybe Var
+isVar (Ref v) = matchVar v
+isVar _ = Nothing
+
+data Var = Var
+  { varType :: Type
+  , varId :: {-# UNPACK #-}!Int
+  , varOrigName :: Maybe Text
+  } deriving Show
+
+instance Eq Var where
+  Var _ x _ == Var _ y _  = x == y
+
+instance Display Var where
+  display _ (Var _ v nm) = pretty (fromMaybe "" nm) <> "_" <> pretty v
+
+instance IsWild (Term (Match ext v)) where
+  isWild (Ref MatchWild{}) = True
+  isWild _ = False
+
+data Match ext var
+    -- | Always matches
+  = MatchWild Type
+
+    -- | Never matches
+  | MatchNever Type
+
+    -- | Match a literal Fact ID
+  | MatchFid Fid
+
+    -- | Match a value and bind it to this variable
+  | MatchBind var
+
+    -- | Match a value bound earlier. Note that this means we can have
+    -- patterns like pred(X,X), where the second X matches the value
+    -- bound by the first X.
+  | MatchVar var
+
+    -- | Match two patterns simultaneously. Fails if either of them
+    -- fails to match, and binds the MatchBinds from both sides if
+    -- both patterns match. Not valid in expressions, only patterns.
+  | MatchAnd (Term (Match ext var)) (Term (Match ext var))
+
+    -- | Match a prefix of a string.
+  | MatchPrefix
+      ByteString  -- the prefix of the string (utf-8 encoded)
+      (Term (Match ext var))  -- the rest of the string
+
+    -- | Match a prefix of an array. Note that this may occur in a
+    -- position that requires us to build the term instead of
+    -- matching, so we have an additional field that matches the whole
+    -- array. Typically this will be either a wildcard, if we never
+    -- need to build a term involving this array, or a variable which
+    -- will be bound to the array when it is matched.
+  | MatchArrayPrefix
+      Type                     -- ^ The type of elements
+      [Term (Match ext var)]   -- ^ The prefix
+      (Term (Match ext var))   -- ^ matches the whole array
+
+    -- | placeholder for extending this type
+  | MatchExt ext
+
+  deriving (Eq, Functor, Foldable, Traversable, Show)
+
+-- | Bind a value of one type into an output of a different type by first
+-- performing a type transformation.
+data TransformAndBind
+  = TransformAndBind Type Output
+  deriving Show
+
+instance Bifunctor Match where
+  bimap f g = \case
+    MatchWild x -> MatchWild x
+    MatchNever x -> MatchNever x
+    MatchFid x -> MatchFid x
+    MatchExt ext -> MatchExt (f ext)
+    MatchVar var -> MatchVar (g var)
+    MatchBind var -> MatchBind (g var)
+    MatchAnd a b -> MatchAnd (fmap (bimap f g) a) (fmap (bimap f g) b)
+    MatchPrefix b term -> MatchPrefix b $ fmap (bimap f g) term
+    MatchArrayPrefix ty prefix all ->
+      MatchArrayPrefix ty ((fmap.fmap) (bimap f g) prefix)
+        (fmap (bimap f g) all)
+
+instance Bifoldable Match where
+  bifoldMap f g = \case
+    MatchWild _ -> mempty
+    MatchNever _ -> mempty
+    MatchFid _ -> mempty
+    MatchExt ext -> f ext
+    MatchVar var -> g var
+    MatchBind var -> g var
+    MatchAnd a b -> foldMap (bifoldMap f g) a <> foldMap (bifoldMap f g) b
+    MatchPrefix _ term -> foldMap (bifoldMap f g) term
+    MatchArrayPrefix _ty pre all ->
+      (foldMap.foldMap) (bifoldMap f g) pre <> foldMap (bifoldMap f g) all
+
+instance Bitraversable Match where
+  bitraverse f g = \case
+    MatchWild x -> pure $ MatchWild x
+    MatchNever x -> pure $ MatchNever x
+    MatchFid x -> pure $ MatchFid x
+    MatchExt ext -> MatchExt <$> f ext
+    MatchVar var -> MatchVar <$> g var
+    MatchBind var -> MatchBind <$> g var
+    MatchAnd a b -> MatchAnd
+      <$> traverse (bitraverse f g) a
+      <*> traverse (bitraverse f g) b
+    MatchPrefix b term -> MatchPrefix b <$> traverse (bitraverse f g) term
+    MatchArrayPrefix ty prefix all ->
+      MatchArrayPrefix ty <$> traverse (traverse (bitraverse f g)) prefix
+        <*> traverse (bitraverse f g) all
+
+matchVar :: Match ext var -> Maybe var
+matchVar (MatchVar v) = Just v
+matchVar (MatchBind v ) = Just v
+matchVar _ = Nothing
+
+data Typed x = Typed Type x
+  deriving (Show, Functor, Traversable, Foldable)
+
+instance Display x => Display (Typed x) where
+  display opts (Typed _ x) = display opts x
+
+-- -----------------------------------------------------------------------------
+-- Pretty-printing
+
+instance Display CgQuery where
+  display opts (CgQuery expr []) = display opts expr
+  display opts (CgQuery expr stmts) =
+    hang 2 $ sep $
+      display opts expr <+>
+        "where" : punctuate ";" (map (display opts) stmts)
+
+instance Display CgStatement where
+  display opts = \case
+    CgStatement pat gen ->
+      hang 2 $ sep [display opts pat <+> "=", display opts gen]
+    CgAllStatement var expr stmts ->
+      hang 2 $ sep [display opts var <+> "="
+                   ,"all ("
+                   ,display opts (CgQuery expr stmts)
+                   ,")"
+                   ]
+    CgNegation stmts -> "!" <> doStmts stmts
+    CgDisjunction stmtss -> sep (punctuate " |" (map doStmts stmtss))
+    CgConditional cond then_ else_ -> sep
+      [ nest 2 $ sep ["if", doStmts cond ]
+      , nest 2 $ sep ["then", doStmts then_]
+      , nest 2 $ sep ["else", doStmts else_]
+      ]
+    where
+      doStmts stmts = hang 2 $
+        sep [sep ("(" : punctuate ";" (map (display opts) stmts)), ")"]
+
+instance Display Generator where
+  display opts (FactGenerator pref kpat vpat section)
+    | isWild vpat || isUnit vpat = hang 2 (sep [pred, display opts kpat])
+    | otherwise =
+      hang 2 (sep [pred, display opts kpat <+> "->", display opts vpat])
+    where
+    pred = display opts pref <> prettySection
+    prettySection = case section of
+      SeekOnAllFacts -> ""
+      SeekOnBase -> "<base>"
+      SeekOnStacked -> "<stacked>"
+    isUnit (Tuple []) = True
+    isUnit _ = False
+  display opts (TermGenerator q) = display opts q
+  display opts (DerivedFactGenerator pid k (Tuple [])) =
+    hang 2 (sep [display opts pid <> "<-", displayAtom opts k ])
+  display opts (DerivedFactGenerator pid k v) =
+    display opts pid <> "<- (" <>
+      displayAtom opts k <> " -> " <> displayAtom opts v <> ")"
+  display opts (ArrayElementGenerator _ arr) = display opts arr <> "[..]"
+  display opts (SetElementGenerator _ set) = "elements" <+> display opts set
+  display opts (PrimCall op args _) =
+    hsep (display opts op : map (displayAtom opts) args)
+
+instance Display ext => Display (Match ext Var) where
+  display opts (MatchAnd l r) = display opts l <+> "@" <+> display opts r
+  display opts (MatchBind v@(Var ty _ _)) =
+    display opts v  <> ":" <> display opts ty
+  display opts (MatchPrefix str rest) =
+    display opts (show str) <> ".." <> display opts rest
+  display opts (MatchExt ext) = display opts ext
+  display opts (MatchArrayPrefix _ty pre all) =
+    case all of
+      Ref MatchWild{} -> arr
+      _ -> arr <+> "@" <+> display opts all
+    where
+    arr = align $ encloseSep "[" "..]" "," $ map (display opts) pre
+  display opts other = displayAtom opts other
+
+  displayAtom _ (MatchWild _) = "_"
+  displayAtom _ (MatchNever _) = "()"
+  displayAtom _ (MatchFid fid) = pretty fid
+  displayAtom opts (MatchVar v) = display opts v
+  displayAtom opts (MatchPrefix str rest) =
+    pretty (show str) <> ".." <> display opts rest
+  displayAtom opts other@MatchAnd{} = parens (display opts other)
+  displayAtom opts other@MatchBind{} = parens (display opts other)
+  displayAtom opts other@MatchArrayPrefix{} = parens (display opts other)
+  displayAtom opts (MatchExt ext) = displayAtom opts ext
diff --git a/glean/db/Glean/Query/Derive.hs b/glean/db/Glean/Query/Derive.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Derive.hs
@@ -0,0 +1,583 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Derive
+  ( deriveStored
+  ) where
+
+import System.Timeout
+import Control.DeepSeq
+import Control.Exception
+import Control.Concurrent
+import Control.Applicative
+import Control.Monad
+import Data.Default
+import Data.Either
+import Data.Foldable
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List ((\\))
+import qualified Data.List as List
+import qualified Data.Map as Map
+import Data.Maybe
+import qualified Data.Text as Text
+import Data.Traversable (for)
+import qualified Data.Text.Encoding as Text
+import qualified Data.UUID as UUID
+import qualified Data.UUID.V4 as UUID
+import TextShow
+
+import Control.Concurrent.Stream (stream)
+import Util.Control.Exception
+import Util.Log
+import Util.STM
+
+import Glean.Angle.Types as A
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Schema.Types
+import Glean.Database.Storage as Storage
+import Glean.Database.Open
+import Glean.Database.Types as Database
+import Glean.Database.Writes
+import Glean.Internal.Types
+import qualified Glean.Query.UserQuery as UserQuery
+import Glean.Query.Typecheck (tcQueryDeps)
+import Glean.Query.Codegen (Boundaries)
+import Glean.Query.Codegen.Types
+import Glean.RTS.Foreign.Lookup (Lookup)
+import Glean.RTS.Types (derefType)
+import Glean.Schema.Types
+import Glean.Schema.Util
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types as Thrift hiding (Byte, Nat, Exception)
+import qualified Glean.Types as Thrift
+import Glean.Util.Observed as Observed
+import Glean.Util.Mutex
+import Util.Time
+import Glean.Util.Warden
+
+type LogResult =
+  Either (DiffTimePoints, SomeException) Thrift.UserQueryStats -> IO ()
+
+deriveStored
+  :: Database.Env
+  -> LogResult
+  -> Thrift.Repo
+  -> Thrift.DerivePredicateQuery
+  -> IO Thrift.DerivationStatus
+deriveStored env log repo query = do
+  d@Derivation{..} <- deriveStoredImpl env log repo query
+  case derivationError of
+    Just (_, err) -> throwIO err
+    Nothing -> return $
+      if isFinished d
+         then Thrift.DerivationStatus_complete def
+            { Thrift.derivationComplete_stats = derivationStats }
+         else Thrift.DerivationStatus_ongoing def
+            { Thrift.derivationOngoing_stats = derivationStats }
+
+logResult :: LogResult -> Derivation -> IO ()
+logResult log Derivation{..} =
+  log $ case derivationError of
+    Nothing -> Right derivationStats
+    Just (errTime, err) ->
+      let duration = diffTimePoints derivationStart errTime in
+      Left (duration, err)
+
+-- | Start predicate derivation or return a completed/ongoing one if it exists
+deriveStoredImpl
+  :: Database.Env
+  -> LogResult
+  -> Thrift.Repo
+  -> Thrift.DerivePredicateQuery
+  -> IO Derivation
+deriveStoredImpl env@Env{..} log repo req@Thrift.DerivePredicateQuery{..} = do
+  readDatabase env repo $ \OpenDB{..} _ -> do
+  let sourceRef = SourceRef
+        derivePredicateQuery_predicate
+        derivePredicateQuery_predicate_version
+  schemaVersion <- getSchemaVersion env repo odbSchema
+  details <- getPredicate odbSchema schemaVersion sourceRef
+  let pred = predicateId details
+      ref = predicateRef details
+  handle <- UUID.toText <$> UUID.nextRandom
+  now <- getTimePoint
+
+  mask $ \unmask -> do
+    join $ unmask $ atomically $ do
+      running <- HashMap.lookup (repo, pred) <$> readTVar envDerivations
+      case running of
+        Just derivation -> return $ return derivation
+        Nothing -> do
+          checkConstraints odbSchema pred
+          let new = newDerivation now handle
+          save env repo ref pred new
+          return $ handleAll (onErr ref pred) $ unmask $ do
+            kickOff ref pred
+            shortWait env pred new
+  where
+    newDerivation now handle = Derivation
+      { derivationStart = now
+      , derivationFinished = False
+      , derivationStats = def
+      , derivationPendingWrites = []
+      , derivationError = Nothing
+      , derivationHandle = handle
+      }
+
+    kickOff :: PredicateRef -> PredicateId -> IO ()
+    kickOff ref pred = do
+      spawn_ envWarden $ handleAll (onErr ref pred) $ do
+        runDerivation env repo ref pred req
+        enqueueCheckpoint env repo $ void $
+          finishDerivation env log repo ref pred
+
+    -- When we kick off a new derivation, wait a short time (1s) for
+    -- it to finish. This enables tests and short indexing runs to
+    -- avoid the 1s wait per derivation that would normally happen
+    -- before we poll for the result.
+    shortWait :: Env -> PredicateId -> Derivation -> IO Derivation
+    shortWait Env{..} pred drv = do
+      r <- timeout 1000000 $ atomically $ do
+        m <- HashMap.lookup (repo, pred) <$> readTVar envDerivations
+        case m of
+          Nothing -> throwSTM $ toException UnknownDerivation
+          Just d -> do
+            when (not (isFinished d)) retry
+            return d
+      return (fromMaybe drv r)
+
+    onErr :: PredicateRef -> PredicateId -> SomeException -> IO a
+    onErr ref pred e = do
+      logError $ "Failed derivation of " <>
+        Text.unpack (showRef ref) <> ": " <> show e
+      now <- getTimePoint
+      void $ overDerivation env repo ref pred
+        (\d -> d { derivationError = Just (now, e) })
+      throwIO e
+
+    checkConstraints :: DbSchema -> PredicateId -> STM ()
+    checkConstraints schema pred = do
+      unless (isDerivedAndStored schema pred) $
+        throwSTM Thrift.NotAStoredPredicate
+
+      ServerConfig.Config{..} <- Observed.get envServerConfig
+      unless config_disable_predicate_dependency_checks $ do
+        completePreds <-
+          metaCompletePredicates <$> Catalog.readMeta envCatalog repo
+        let complete = isCompletePred completePreds schema
+            dependencies = transitive (predicateDeps schema) pred
+            incomplete = filter (not . complete) dependencies
+        unless (null incomplete) $
+          throwSTM $ Thrift.IncompleteDependencies $
+            map (predicateRef . getPredicateDetails schema) incomplete
+
+-- We default to resolving the predicate using the schema
+-- version stored in the glean.schema_id property of the
+-- DB. This is important because the client is often just "glean
+-- derive foo.Predicate" and it doesn't want or need to know
+-- what schema version to use. Letting the DB decide is the
+-- right thing.
+getSchemaVersion :: Env -> Thrift.Repo -> DbSchema -> IO SchemaSelector
+getSchemaVersion env repo schema = do
+  config <- Observed.get (envServerConfig env)
+  schemaId <- getDbSchemaVersion env repo
+  UserQuery.schemaVersionForQuery schema config schemaId
+
+getPredicate
+  :: DbSchema
+  -> SchemaSelector
+  -> SourceRef
+  -> IO PredicateDetails
+getPredicate schema schemaVersion ref = do
+  case lookupSourceRef ref schemaVersion schema of
+    ResolvesTo (RefPred pred)
+      | Just details <- lookupPredicateId pred schema ->
+        return details
+    _ -> throwIO $ Thrift.UnknownPredicate $ Just $ sourceRefName ref
+
+getPredicateOrType
+  :: DbSchema
+  -> SchemaSelector
+  -> SourceRef
+  -> IO (Either PredicateDetails TypeDetails)
+getPredicateOrType schema schemaVersion ref = do
+  case lookupSourceRef ref schemaVersion schema of
+    ResolvesTo (RefPred pred)
+      | Just details <- lookupPredicateId pred schema ->
+        return (Left details)
+    ResolvesTo (RefType ty)
+      | Just details <- lookupTypeId ty schema ->
+        return (Right details)
+    _ -> throwIO $ Thrift.UnknownPredicate $ Just $ sourceRefName ref
+
+overDerivation
+  :: Database.Env
+  -> Repo
+  -> PredicateRef
+  -> PredicateId
+  -> (Derivation -> Derivation)
+  -> IO Derivation
+overDerivation env repo ref pred f = atomically $ do
+  derivation <- f <$> getDerivation env repo pred
+  save env repo ref pred derivation
+  return derivation
+
+save
+  :: Database.Env
+  -> Repo
+  -> PredicateRef
+  -> PredicateId
+  -> Derivation
+  -> STM ()
+save Env{..} repo ref pred derivation@Derivation{..} = do
+  case derivationError of
+    Just e -> markDbBroken e
+    Nothing -> when (isFinished derivation) markPredicateAsComplete
+  modifyTVar' envDerivations $ HashMap.insert (repo, pred) (force derivation)
+  where
+    markPredicateAsComplete = void
+      $ Catalog.modifyMeta envCatalog repo
+      $ \meta -> return meta
+          { metaCompletePredicates =
+            insertUnique ref $ metaCompletePredicates meta
+          }
+
+    insertUnique x xs = x : filter (/= x) xs
+
+    markDbBroken err = void
+      $ Catalog.modifyMeta envCatalog repo
+      $ \meta -> return meta
+          { metaCompleteness = Broken (DatabaseBroken task reason)
+          }
+      where
+        task = "derivation of " <> showRef ref
+        reason = Text.pack (show err)
+
+isCompletePred
+  :: [PredicateRef]
+  -> DbSchema
+  -> PredicateId
+  -> Bool
+isCompletePred completePreds schema pred =
+  case predicateDeriving details of
+    NoDeriving -> True
+    Derive DeriveIfEmpty _ -> False
+    Derive DeriveOnDemand _ -> True
+    Derive DerivedAndStored _ -> predicateRef details `elem` completePreds
+  where
+  details = getPredicateDetails schema pred
+
+isDerivedAndStored :: DbSchema -> PredicateId -> Bool
+isDerivedAndStored schema pred =
+  case predicateDeriving $ getPredicateDetails schema pred of
+    Derive DerivedAndStored _ -> True
+    _ -> False
+
+transitive :: Ord a => (a -> [a]) -> a -> [a]
+transitive next root = Set.elems $ go (next root) mempty
+  where
+    go [] visited = visited
+    go (x:xs) visited
+      | x `Set.member`visited = go xs visited
+      | otherwise = go xs $ go (next x) $ Set.insert x visited
+
+-- | predicates which are queried to derive this predicate
+predicateDeps :: DbSchema -> PredicateId -> [PredicateId]
+predicateDeps schema pred =
+  case predicateDeriving of
+    Derive _ QueryWithInfo{..} -> toList $ tcQueryDeps qiQuery
+    _ -> mempty
+  where
+    PredicateDetails{..} = getPredicateDetails schema pred
+
+getPredicateDetails :: DbSchema -> PredicateId -> PredicateDetails
+getPredicateDetails schema pred =
+  case lookupPredicateId pred schema of
+    Just details -> details
+    Nothing -> throw $
+      Thrift.UnknownPredicate $ Just $ predicateRef_name $ predicateIdRef pred
+
+-- | exhaust a query (until there is no more continuation)
+runDerivation
+  :: Database.Env
+  -> Thrift.Repo
+  -> PredicateRef
+  -> PredicateId
+  -> Thrift.DerivePredicateQuery
+  -> IO ()
+runDerivation env repo ref pred Thrift.DerivePredicateQuery{..} = do
+  readDatabaseWithBoundaries env repo $ \odb bounds lookup ->
+    case derivePredicateQuery_parallel of
+      Nothing -> deriveQuery odb bounds lookup (query (allFacts ref))
+      Just par -> parallelDerivation odb bounds lookup par
+
+  where
+    deriveQuery :: OpenDB s -> Boundaries -> Lookup -> UserQuery -> IO ()
+    deriveQuery odb bounds lookup q = do
+      config <- Observed.get (envServerConfig env)
+      result <- try $
+        UserQuery.userQueryWrites env odb config bounds lookup repo pred q
+      case result of
+        Left Thrift.Retry{..} ->
+          retry retry_seconds (deriveQuery odb bounds lookup q)
+        Right res@(_, mcont, _) -> do
+          addProgress res
+          case mcont of
+            Just cont -> deriveQuery odb bounds lookup $ q `withCont` cont
+            Nothing -> return ()
+
+    parallelDerivation
+      :: OpenDB s
+      -> Boundaries
+      -> Lookup
+      -> ParallelDerivation
+      -> IO ()
+    parallelDerivation odb bounds lookup ParallelDerivation{..} = do
+      schemaVersion <- getSchemaVersion env repo (odbSchema odb)
+      predOrType <- getPredicateOrType (odbSchema odb) schemaVersion
+        (parseRef parallelDerivation_outer_predicate)
+
+      -- find the number of facts of outer_predicate
+      stats <- withOpenDatabaseStack env repo $ \Database.OpenDB{..} ->
+        Storage.predicateStats odbHandle
+      let
+
+      -- figure out what our batch size is going to be
+      numCapabilities <- getNumCapabilities
+      let
+        -- leave some cores free to run writer threads and other requests
+        parallelism = max 1 ((numCapabilities * 4) `quot` 10)
+
+        -- aim for this many jobs, to have a reasonable granularity
+        -- and keep the pipeline full.
+        jobs = parallelism * 10
+
+        -- don't make huge queries
+        maxBatchSize = 5000
+
+      let
+        -- For an enum type, create a separate job for each enum value
+        producerType ty enqueue =
+          case derefType (typeType ty) of
+            EnumeratedTy names ->
+              forM_ names $ \name -> enqueue [ name <> ":" <> typeName ]
+            _other -> throwIO $ ErrorCall $
+              "not an enumerated type: " <> Text.unpack typeName
+          where
+          typeName = showRef (typeIdRef (typeId ty))
+
+        workerType :: [Text] -> IO ()
+        workerType things =
+          deriveQuery odb bounds lookup
+            (query (outer <> parallelDerivation_inner_query))
+          where
+          outer = "X = (" <> Text.intercalate "|" things <> ");"
+
+        -- producer will get batches of outer_predicate facts, worker
+        -- will derive for each batch.
+        producerPred :: PredicateDetails -> ([Id] -> IO ()) -> IO ()
+        producerPred outerPred enqueue =
+          loop (outerQuery batchSize)
+          where
+          loop q = do
+            results <- UserQuery.userQuery env repo q
+            case userQueryResults_results results of
+              UserQueryEncodedResults_bin UserQueryResultsBin{..} ->
+                enqueue (Map.keys userQueryResultsBin_facts)
+              _ -> throwIO $ ErrorCall "outer query failure"
+            case userQueryResults_continuation results of
+              Nothing -> return ()
+              Just cont -> loop (q `withCont` cont)
+
+          outerQuery batchSize = def
+            { userQuery_query = Text.encodeUtf8 $
+                allFacts (predicateRef outerPred)
+            , userQuery_encodings = [UserQueryEncoding_bin def]
+            , userQuery_options = Just def
+              { userQueryOptions_syntax = QuerySyntax_ANGLE
+              , userQueryOptions_max_results = Just batchSize
+              }
+            }
+
+          batchSize =
+            min maxBatchSize $
+            max (fromMaybe 0 parallelDerivation_min_batch_size) $
+            numFacts `quot` fromIntegral jobs
+
+          numFacts = sum $ map (statsFor outerPred) stats
+
+          statsFor pred =
+            maybe 0 predicateStats_count . List.lookup (predicatePid pred)
+
+        workerPred :: [Id] -> IO ()
+        workerPred fids =
+          deriveQuery odb bounds lookup
+            (query (outer <> parallelDerivation_inner_query))
+          where
+          outer =
+            "X = ([" <>
+            Text.intercalate "," (map showFact fids) <>
+            "] : [" <> parallelDerivation_outer_predicate <> "])[..];"
+          showFact i = "$" <> showt i
+
+      case predOrType of
+        Left pred -> stream parallelism (producerPred pred) workerPred
+        Right ty -> stream parallelism (producerType ty) workerType
+
+    allFacts ref = showRef ref <> " _"
+
+    query q = def
+      { userQuery_predicate = derivePredicateQuery_predicate
+      , userQuery_predicate_version = derivePredicateQuery_predicate_version
+      , userQuery_query = Text.encodeUtf8 q
+      , userQuery_options = Just opts
+      , userQuery_encodings = []
+      }
+
+    opts = def
+      { userQueryOptions_expand_results = False
+      , userQueryOptions_syntax = QuerySyntax_ANGLE
+      , userQueryOptions_store_derived_facts = True
+      , userQueryOptions_max_bytes = maxBytes
+      , userQueryOptions_max_results = maxResults
+      , userQueryOptions_max_time_ms = maxTime
+      , userQueryOptions_omit_results = True
+      , userQueryOptions_continuation = Nothing
+      , userQueryOptions_collect_facts_searched = collect
+      }
+
+    maxBytes = derivePredicateQuery_options
+      >>= derivePredicateOptions_max_bytes_per_query
+    maxResults = derivePredicateQuery_options
+      >>= derivePredicateOptions_max_results_per_query
+    maxTime = derivePredicateQuery_options
+      >>= derivePredicateOptions_max_time_ms_per_query
+    collect = maybe False
+      derivePredicateOptions_collect_facts_searched
+      derivePredicateQuery_options
+
+    retry :: Double -> IO a -> IO a
+    retry secs action = do
+      threadDelay $ round $ max secs 1 * 1000000
+      action
+
+    withCont q cont = q
+      { userQuery_options = Just (fromMaybe def $ userQuery_options q)
+        { userQueryOptions_continuation = Just cont }
+      }
+
+    addProgress (stats, _mcont, mWriteHandle) =
+      void $ overDerivation env repo ref pred $ \d@Derivation{..} -> d
+        { derivationStats = derivationStats <> stats
+        , derivationPendingWrites = maybeToList mWriteHandle
+            ++ derivationPendingWrites
+        }
+
+-- | Update envDerivations and the Catalog metadata to reflect the current
+-- derivation status
+finishDerivation
+  :: Database.Env
+  -> LogResult
+  -> Repo
+  -> PredicateRef
+  -> PredicateId
+  -> IO Derivation
+finishDerivation env log repo ref pred = do
+  vlog 1 $ "finishDerivation: " <> show pred
+  derivation <- atomically (getDerivation env repo pred)
+  finished <- finishedWrites derivation
+  when (isNothing (derivationError derivation) && isRight finished)
+    finishOwnership
+  now <- getTimePoint
+  derivation <- overDerivation env repo ref pred $ withProgress now finished
+  logResult log derivation
+  return derivation
+  where
+    finishedWrites :: Derivation -> IO (Either SomeException [Thrift.Handle])
+    finishedWrites deriv = do
+      results <- for (derivationPendingWrites deriv) $ \writeHandle -> do
+        fmap (writeHandle,) <$> isWriteFinished env writeHandle
+      return $ map fst . filter snd <$> sequence results
+
+    withProgress now finished d =
+      let pendingWrites = derivationPendingWrites d \\ fromRight [] finished in
+      d { derivationPendingWrites = pendingWrites
+        , derivationFinished = True
+          -- We can only record this derivation as finished once the
+          -- finishDerivation checkpoint has run, otherwise the DB
+          -- will not close successfully. Also, the next derivation
+          -- depends on finishOwnership having completed.
+        , derivationError =
+            derivationError d
+            <|> case finished of
+                  Left err -> Just (now, err)
+                  Right _ -> Nothing
+            <|> if null pendingWrites
+                then Nothing
+                else Just (now, toException FinishedWithPendingWrites)
+        , derivationStats = (derivationStats d)
+            { userQueryStats_elapsed_ns = fromIntegral
+                $ toDiffNanos
+                $ diffTimePoints (derivationStart d) now
+            }
+        }
+
+    finishOwnership = do
+      withOpenDatabase env repo $ \OpenDB{..} -> do
+        writing <- case odbWriting of
+          Nothing -> throwIO $ Thrift.Exception "finishOwnership: read only"
+          Just writing -> return writing
+        details <- case lookupPredicateId pred odbSchema of
+          Nothing -> throwIO $ Thrift.Exception "finishOwnership: no pid"
+          Just details -> return details
+        maybeOwnership <- readTVarIO odbOwnership
+        -- we need the write lock while computing the final ownership,
+        -- because we might write new ownership sets to the DB. This
+        -- step should hopefully be fast though (TOOD: measure)
+        forM_ maybeOwnership $ \ownership -> do
+          maybeBase <- repoParent env repo
+          let withBase repo f =
+                readDatabase env repo $ \_ lookup -> f (Just lookup)
+          maybe ($ Nothing) withBase maybeBase $ \base -> do
+            withMutexSafe (wrLock writing) $ \lock -> do
+              computed <- Storage.computeDerivedOwnership odbHandle
+                lock ownership base (predicatePid details)
+              Storage.storeOwnership odbHandle lock computed
+
+getDerivation :: Database.Env -> Repo -> PredicateId -> STM Derivation
+getDerivation env repo pred = do
+  ds <- readTVar (envDerivations env)
+  case HashMap.lookup (repo, pred) ds of
+    Nothing -> throwSTM $ toException UnknownDerivation
+    Just d -> return d
+
+data UnknownDerivation = UnknownDerivation deriving (Show)
+instance Exception UnknownDerivation
+
+data DerivationFailed = FinishedWithPendingWrites
+  deriving (Show)
+instance Exception DerivationFailed
+
+isFinished :: Derivation -> Bool
+isFinished Derivation{..} =
+    isJust derivationError || derivationFinished
+
+isWriteFinished
+  :: Database.Env
+  -> Thrift.Handle
+  -> IO (Either SomeException Bool)
+isWriteFinished env writeHandle = do
+  res <- tryAll $ pollBatch env writeHandle
+  return $ case res of
+    Right (Thrift.FinishResponse_subst _) -> Right True
+    Right _ -> Right False
+    Left exc -> case fromException exc of
+      Just Thrift.UnknownBatchHandle -> Right True
+      Nothing -> Left exc
diff --git a/glean/db/Glean/Query/Expand.hs b/glean/db/Glean/Query/Expand.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Expand.hs
@@ -0,0 +1,141 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Expand
+  ( expandDerivedPredicateCall
+  ) where
+
+import Control.Monad.State
+import Data.Bifunctor (first)
+
+import Glean.Query.Codegen.Types
+  (Match(..), Var(..), Pat, QueryWithInfo(..), Typed(..))
+import Glean.Query.Flatten.Types
+import Glean.Query.Typecheck.Types
+import Glean.Query.Vars
+import Glean.RTS.Term as RTS
+import Glean.Database.Schema.Types
+
+
+expandDerivedPredicateCall
+  :: PredicateDetails
+  -> Pat                -- ^ pattern at the call site
+  -> Pat                -- ^ value pattern, if applicable
+  -> TypecheckedQuery   -- ^ query from the derived predicate
+  -> F TcQuery
+expandDerivedPredicateCall PredicateDetails{..} key val QueryWithInfo{..} = do
+  (TcQuery _ keyDef maybeValDef stmts ord) <-
+    instantiateWithFreshVariables qiQuery qiNumVars
+
+  let
+    key' = fmap (first (\_ -> error "MatchExt")) key
+    val' = fmap (first (\_ -> error "MatchExt")) val
+
+  -- we have
+  --    pred P -> Q
+  -- where
+  --    pred : T
+  --       K -> V where S
+  --
+  -- let's turn it into
+  --
+  --   { X, Y } where S; X = K, X = P; Y = V; Y = Q;
+  --
+  -- If the predicate has no value, we can simplify
+  --
+  --   X where S; X = K, X = P
+
+  case maybeValDef of
+    Just valDef -> do
+      x <- fresh predicateKeyType
+      y <- fresh predicateValueType
+      return $
+        TcQuery predicateKeyType (Ref (MatchVar x)) (Just (Ref (MatchVar y)))
+          (stmts ++ [
+            TcStatement predicateKeyType (Ref (MatchBind x)) keyDef,
+            TcStatement predicateKeyType (Ref (MatchVar x)) key',
+            TcStatement predicateValueType (Ref (MatchBind y)) valDef,
+            TcStatement predicateValueType (Ref (MatchVar y)) val' ])
+          ord
+    Nothing -> do
+      x <- fresh predicateKeyType
+      return $
+        TcQuery predicateKeyType (Ref (MatchVar x)) Nothing
+          (stmts ++ [
+            TcStatement predicateKeyType (Ref (MatchBind x)) keyDef,
+            TcStatement predicateKeyType (Ref (MatchVar x)) key' ])
+          ord
+
+-- | Make a fresh instance of a query where none of the variables
+-- clash with existing variables. We know the maximum variable in the
+-- query, so we just reserve this number of variables and add the
+-- current value of exNextVar to each variable in the query.
+instantiateWithFreshVariables :: TcQuery -> Int -> F TcQuery
+instantiateWithFreshVariables query numVars = do
+  state <- get
+  let base = flNextVar state
+  put state { flNextVar = base + numVars }
+  return $ instantiateQuery base query
+  where
+  instantiateQuery base (TcQuery ty head maybeVal stmts ord) =
+    TcQuery ty
+      (instantiatePat base head)
+      (fmap (instantiatePat base) maybeVal)
+      (map (instantiateStmt base) stmts)
+      ord
+
+  instantiateStmt base (TcStatement ty lhs rhs) =
+    TcStatement ty (instantiatePat base lhs) (instantiatePat base rhs)
+
+  instantiateTcTerm base (TcOr a b) =
+    TcOr (instantiatePat base a) (instantiatePat base b)
+  instantiateTcTerm base (TcFactGen pid kpat vpat range) =
+    TcFactGen pid (instantiatePat base kpat) (instantiatePat base vpat) range
+  instantiateTcTerm base (TcElementsOfArray pat) =
+    TcElementsOfArray (instantiatePat base pat)
+  instantiateTcTerm base (TcElementsOfSet pat) =
+    TcElementsOfSet (instantiatePat base pat)
+  instantiateTcTerm base (TcElementsUnresolved ty pat) =
+    TcElementsUnresolved ty (instantiatePat base pat)
+  instantiateTcTerm base (TcQueryGen query) =
+    TcQueryGen (instantiateQuery base query)
+  instantiateTcTerm base (TcAll query) =
+    TcAll (instantiateQuery base query)
+  instantiateTcTerm base (TcNegation stmts) =
+    TcNegation (map (instantiateStmt base) stmts)
+  instantiateTcTerm base (TcPrimCall op args) =
+    TcPrimCall op (map (instantiatePat base) args)
+  instantiateTcTerm base (TcIf (Typed ty cond) then_ else_) =
+    TcIf
+      (Typed ty $ instantiatePat base cond)
+      (instantiatePat base then_)
+      (instantiatePat base else_)
+  instantiateTcTerm base (TcDeref ty pat) =
+    TcDeref ty (instantiatePat base pat)
+  instantiateTcTerm base (TcFieldSelect (Typed ty pat) field) =
+    TcFieldSelect (Typed ty (instantiatePat base pat)) field
+  instantiateTcTerm base (TcAltSelect (Typed ty pat) field) =
+    TcAltSelect (Typed ty (instantiatePat base pat)) field
+  instantiateTcTerm base (TcPromote ty pat) =
+    TcPromote ty (instantiatePat base pat)
+  instantiateTcTerm base (TcDemote ty pat) =
+    TcDemote ty (instantiatePat base pat)
+  instantiateTcTerm base (TcStructPat fs) =
+    TcStructPat [(n, instantiatePat base p) | (n,p) <- fs]
+
+  instantiatePat :: Int -> TcPat -> TcPat
+  instantiatePat base = fmap (instantiateMatch base)
+
+  instantiateMatch base m = case m of
+    MatchVar (Var ty v nm) -> MatchVar (Var ty (v+base) nm)
+    MatchBind (Var ty v nm) -> MatchBind (Var ty (v+base) nm)
+    MatchAnd l r -> MatchAnd (instantiatePat base l) (instantiatePat base r)
+    MatchPrefix s t -> MatchPrefix s (instantiatePat base t)
+    MatchExt (Typed ty ext) -> MatchExt (Typed ty (instantiateTcTerm base ext))
+    MatchArrayPrefix ty pre all -> MatchArrayPrefix ty (instantiatePat base <$> pre) (instantiatePat base all)
+    other -> other
diff --git a/glean/db/Glean/Query/Flatten.hs b/glean/db/Glean/Query/Flatten.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Flatten.hs
@@ -0,0 +1,753 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Flatten
+  ( flatten
+  ) where
+
+import Control.Monad
+import Control.Monad.Except
+import Control.Monad.State
+import Data.List hiding (intersect)
+import Data.List.NonEmpty (NonEmpty(..))
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import qualified Glean.Angle.Types as Angle
+import Glean.Display
+import Glean.Query.Codegen.Types
+  ( Match(..)
+  , Var(..)
+  , Pat
+  , Generator_(..)
+  , Generator
+  , Expr
+  , Typed(..)
+  , SeekSection(..)
+  , QueryWithInfo(..))
+import Glean.Query.Expand
+import Glean.Query.Flatten.Types
+import Glean.Query.Typecheck.Types
+import Glean.Query.Vars
+import Glean.RTS.Types as RTS
+import Glean.RTS.Term as RTS
+import Glean.Database.Schema.Types
+import Glean.Database.Types (EnableRecursion(..))
+import qualified Glean.Angle.Types as Schema
+import Glean.Schema.Util
+
+-- | Turn 'TypecheckedQuery' into 'FlattenedQuery', by lifting out
+-- nested generators into statements.
+flatten
+  :: EnableRecursion
+  -> DbSchema
+  -> Schema.AngleVersion
+  -> Bool -- ^ derive DerivedAndStored predicates
+  -> TypecheckedQuery
+  -> Except Text FlattenedQuery
+flatten rec dbSchema ver deriveStored QueryWithInfo{..} =
+  fmap fst $ flip runStateT state $ do
+    (flattened, maybeLookup, returnType) <- do
+      flat <- flattenQuery qiQuery `catchError` flattenFailure
+      captureKey ver dbSchema flat (case qiQuery of TcQuery ty _ _ _ _ -> ty)
+    nextVar <- gets flNextVar
+    return $ QueryWithInfo flattened nextVar maybeLookup returnType
+  where
+      state = initialFlattenState rec dbSchema qiNumVars deriveStoredPred
+
+      deriveStoredPred =
+        case derefType qiReturnType of
+          Angle.PredicateTy _ (PidRef _ pref) | deriveStored -> Just pref
+          _ -> Nothing
+
+      flattenFailure e = throwError $
+        e <> " in\n" <> Text.pack (show (displayVerbose qiQuery))
+
+flattenQuery :: TcQuery -> F FlatQuery
+flattenQuery query = do
+  (group, head, maybeVal) <- flattenQuery' query
+  return (FlatQuery head maybeVal group)
+
+flattenQuery' :: TcQuery -> F (FlatStatementGroup, Expr, Maybe Expr)
+flattenQuery' (TcQuery ty head Nothing stmts ord) = do
+  (ords, floats) <- mapAndUnzipM flattenStatement stmts
+  pats <- flattenPattern head
+  case pats of
+    [(stmts,head')] -> return $ case ord of
+      Angle.Ordered -> (mkGroup ords (stmts : floats), head', Nothing)
+      Angle.Unordered -> (mkGroup [] (stmts : ords <> floats), head', Nothing)
+    _many -> do -- TODO: ord
+      -- If there are or-patterns on the LHS, then we have
+      --    P1 | P2 | ... where stmts
+      -- so we will generate
+      --    X where stmts; X = P1 | P2 | ...
+      v <- fresh ty
+      let
+        alts =
+          [ asGroup (stmts `thenStmt`
+              FlatStatement ty (Ref (MatchBind v)) (TermGenerator head))
+          | (stmts, head) <- pats ]
+      return
+        ( case ord of
+            Angle.Ordered ->
+              mkGroup ords (oneStmt (FlatDisjunction alts) : floats)
+            Angle.Unordered ->
+              mkStatementGroup
+                (Floating (FlatDisjunction alts) :
+                  flattenStmts (mconcat (ords <> floats)))
+        , Ref (MatchVar v)
+        , Nothing
+        )
+flattenQuery' (TcQuery ty head (Just val) stmts _ord {- TODO -}) = do
+  (ords, floats) <- mapAndUnzipM flattenStatement stmts
+  pats <- flattenPattern head
+  vals <- flattenPattern val
+  case [ (stmtsp <> stmtsv, head, val)
+       | (stmtsp, head) <- pats
+       , (stmtsv, val) <- vals ] of
+    [(stmts, head', val)] ->
+      return (mkGroup ords (stmts : floats), head', Just val)
+    many -> do
+      -- As above, but we must handle the value too
+      k <- fresh ty
+      v <- fresh ty
+      let
+        alts =
+          [ asGroup (stmts `thenStmt`
+              FlatStatement ty lhsPair (TermGenerator (Tuple [head,val])))
+          | (stmts, head, val) <- many ]
+        lhsPair = Tuple [Ref (MatchBind k), Ref (MatchBind v)]
+      return
+        ( mkGroup ords (oneStmt (FlatDisjunction alts) : floats)
+        , Ref (MatchVar k)
+        , Just (Ref (MatchVar v))
+        )
+
+flattenStatement :: TcStatement -> F (Statements, Statements)
+flattenStatement (TcStatement ty lhs rhs) = do
+  rgens <- flattenSeqGenerators rhs
+  lgens <- flattenSeqGenerators lhs
+  mkStmt ty lgens rgens
+
+-- | Here we decide whether an explicit statement is ordered or
+-- unordered with respect to other statements in the group. Implicit
+-- statements (e.g. those resulting from nested patterns) are always
+-- unordered.
+addStmt
+  :: FlatStatement
+  -> (Statements, Statements)
+  -> (Statements, Statements)
+addStmt stmt@(FlatStatement _ _ TermGenerator{}) (here, float) =
+  (here, float `thenStmt` stmt)  -- filters are always unordered
+addStmt stmt (here, float) =
+  (here `thenStmt` stmt, float)
+
+mkStmt
+  :: Type
+  -> [(Statements, Statements, Generator)]
+  -> [(Statements, Statements, Generator)]
+  -> F (Statements, Statements)
+mkStmt ty [(lhshere, lhsfloat, TermGenerator lhs)]
+    [(rhshere, rhsfloat, gen)] = do
+  return $ addStmt (FlatStatement ty lhs gen)
+    (lhshere <> rhshere, lhsfloat <> rhsfloat)
+mkStmt ty [(lhshere, lhsfloat, gen)]
+    [(rhshere, rhsfloat, TermGenerator rhs)] = do
+  return $ addStmt (FlatStatement ty rhs gen)
+    (lhshere <> rhshere, lhsfloat <> rhsfloat)
+mkStmt ty [(lhshere, lhsfloat, lgen)] [(rhshere, rhsfloat, rgen)] = do
+  v <- fresh ty
+  return $
+    addStmt (FlatStatement ty (Ref (MatchBind v)) lgen) $
+    addStmt (FlatStatement ty (Ref (MatchBind v)) rgen)
+      (lhshere <> rhshere, lhsfloat <> rhsfloat)
+mkStmt ty [(lhshere, lhsfloat, gen)] many = do
+  v <- fresh ty
+  return $
+    addStmt (FlatStatement ty (Ref (MatchBind v)) gen)
+      (lhshere
+       `thenStmt` disjunction
+            [ mkGroup
+                [rhshere]
+                [rhsfloat `thenStmt`
+                  FlatStatement ty (Ref (MatchBind v)) rhsgen ]
+            | (rhshere, rhsfloat, rhsgen) <- many
+            ]
+      , lhsfloat
+      )
+mkStmt ty many [one] = mkStmt ty [one] many
+mkStmt ty lhsmany rhsmany = do
+  v <- fresh ty
+  (lhsord, lhsfloat) <- bind v lhsmany
+  (rhsord, rhsfloat) <- bind v rhsmany
+  return (lhsord <> rhsord, lhsfloat <> rhsfloat)
+
+flattenSeqGenerators :: TcPat -> F [(Statements, Statements, Generator)]
+flattenSeqGenerators (Ref (MatchExt (Typed ty match))) = case match of
+  TcOr left right -> do
+    l <- flattenSeqGenerators left
+    r <- flattenSeqGenerators right
+    return (l ++ r)
+  TcFactGen pid kpat vpat range -> do
+    kpats <- flattenPattern kpat
+    vpats <- flattenPattern vpat
+    sequence
+      [ do
+          (stmts, gen) <- flattenFactGen pid range kpat vpat
+          return (stmts, kstmts <> vstmts, gen)
+      | (kstmts, kpat) <- kpats
+      , (vstmts, vpat) <- vpats ]
+  TcElementsOfArray pat -> do
+    r <- flattenPattern pat
+    return [(mempty, stmts, ArrayElementGenerator ty pat') | (stmts,pat') <- r ]
+  TcElementsOfSet pat -> do
+    r <- flattenPattern pat
+    return [(mempty, stmts, SetElementGenerator ty pat') | (stmts,pat') <- r ]
+  TcQueryGen query -> do
+    (group, term, _) <- flattenQuery' query
+    return [(floatGroup group, mempty, TermGenerator term)]
+  TcAll query -> do
+    (group, term, _) <- flattenQuery' query
+    var <- fresh ty
+    return
+      [ (Statements [FlatAllStatement var term group]
+      , mempty
+      , TermGenerator (Ref (MatchVar var)))]
+  TcNegation stmts -> do
+    (ords, floats) <- mapAndUnzipM flattenStatement stmts
+    let neg = FlatNegation (mkGroup ords floats)
+    return [(oneStmt neg, mempty, TermGenerator $ Tuple [])]
+  TcPrimCall op args -> do
+    r <- manyTerms (\args -> PrimCall op args ty) <$> mapM flattenPattern args
+    return [ (mempty, float, gen) | (float, gen) <- r ]
+  TcIf (Typed condTy cond) then_ else_ -> do
+    (condOrd, condFloat) <- bindWild condTy =<< flattenSeqGenerators cond
+    var <- fresh ty
+    (thenOrd, thenFloat) <- bind var =<< flattenSeqGenerators then_
+    (elseOrd, elseFloat) <- bind var =<< flattenSeqGenerators else_
+    let stmt = FlatConditional
+          (asGroup (condOrd <> condFloat))
+          (asGroup (thenOrd <> thenFloat))
+          (asGroup (elseOrd <> elseFloat))
+    return [(mempty `thenStmt` stmt, mempty,
+      TermGenerator $ Ref $ MatchVar var)]
+  _other -> do
+    r <- flattenPattern (Ref (MatchExt (Typed ty match)))
+    return $ [(mempty, stmts, TermGenerator pat) | (stmts, pat) <- r]
+flattenSeqGenerators pat = do
+  r <- flattenPattern pat
+  return $ [(mempty, stmts, TermGenerator pat) | (stmts, pat) <- r]
+
+bindWild
+  :: Type
+  -> [(Statements, Statements, Generator)]
+  -> F (Statements, Statements)
+bindWild ty stmts =
+  mkStmt ty stmts [(mempty, mempty, TermGenerator $ Ref $ MatchWild ty)]
+
+bind
+  :: Var
+  -> [(Statements, Statements, Generator)]
+  -> F (Statements, Statements)
+bind var gens = mkStmt
+  (varType var)
+  [(mempty, mempty, TermGenerator (RTS.Ref (MatchBind var)))]
+  gens
+
+flattenFactGen
+  :: PidRef
+  -> SeekSection
+  -> Pat
+  -> Pat
+  -> F (Statements, Generator)
+flattenFactGen pidRef@(PidRef pid _) rng kpat vpat = do
+  dbSchema <- gets flDbSchema
+  deriveStored <- gets flDeriveStored
+  case lookupPid pid dbSchema of
+    Nothing -> lift $ throwError $
+      "internal error: flatten: " <> Text.pack (show pid)
+    Just details@PredicateDetails{..} -> do
+      let factGen = (mempty, FactGenerator pidRef kpat vpat rng)
+      case predicateDeriving of
+        Schema.NoDeriving ->
+          return factGen
+        Schema.Derive when query
+          | Schema.DerivedAndStored <- when
+          , Just predicateId /= deriveStored ->
+               return factGen
+          | otherwise -> do
+            calling predicateId factGen $ do
+              query' <- expandDerivedPredicateCall details kpat vpat query
+              (group, key, maybeVal) <- flattenQuery' query'
+              let val = fromMaybe (Tuple []) maybeVal
+              return (floatGroup group, DerivedFactGenerator pidRef key val)
+
+calling
+  :: Schema.PredicateId
+  -> a   -- ^ use this value if we already expanded a recursive call.
+  -> F a
+  -> F a
+calling ref seek inner = do
+  stack <- gets flStack
+  recursion <- gets flRecursion
+  if
+    | ref `notElem` stack -> do
+      modify $ \state -> state { flStack = ref : stack }
+      a <- inner
+      modify $ \state -> state { flStack = stack }
+      return a
+    | EnableRecursion <- recursion -> return seek
+    | otherwise ->
+      throwError $ "recursive reference to predicate " <>
+        Text.pack (show (displayDefault ref))
+
+-- | Returns a list of statement*pattern pairs
+--   representing a disjunction @(P1 where S1 | P2 where S2 | ...)@
+--   where none of @Pi@ nor @Si@ contain any nested generators.
+--
+--   Moreover, if @Si@ succeeds, it will bind variables in @Pi@.
+flattenPattern :: TcPat -> F [(Statements, Pat)]
+flattenPattern pat = case pat of
+  Byte n -> singleTerm (Byte n)
+  Nat n -> singleTerm (Nat n)
+  String s -> singleTerm (String s)
+  ByteArray s -> singleTerm (ByteArray s)
+  Array terms -> manyTerms Array <$> mapM flattenPattern terms
+  Tuple terms -> manyTerms Tuple <$> mapM flattenPattern terms
+  Alt s x -> fmap (fmap (Alt s)) <$> flattenPattern x
+  Ref (MatchWild ty) -> singleTerm (Ref (MatchWild ty))
+  Ref (MatchNever ty) -> singleTerm (Ref (MatchNever ty))
+  Ref (MatchFid fid) -> singleTerm (Ref (MatchFid fid))
+  Ref (MatchBind var) -> singleTerm (Ref (MatchBind var))
+  Ref (MatchVar var) -> singleTerm (Ref (MatchVar var))
+  Ref (MatchAnd a b) ->
+    twoTerms (\a b -> Ref (MatchAnd a b))
+      <$> flattenPattern a
+      <*> flattenPattern b
+  Ref (MatchPrefix str t) ->
+    fmap (fmap (Ref . MatchPrefix str)) <$> flattenPattern t
+  Ref (MatchArrayPrefix ty prefix all) -> do
+    twoTerms (\pre all -> Ref (MatchArrayPrefix ty pre all))
+      <$> (manyTerms id <$> mapM flattenPattern prefix)
+      <*> flattenPattern all
+  Ref (MatchExt (Typed _ (TcOr a b))) -> do  -- Note [flattening TcOr]
+    as <- flattenPattern a
+    bs <- flattenPattern b
+    return (as ++ bs)
+
+  --  *(pat : P) ==> X where pat = P X
+  Ref (MatchExt (Typed keyTy (TcDeref ty pat))) -> do
+    r <- flattenPattern pat
+    ref@(PidRef _ pred)  <- case ty of
+      Angle.PredicateTy _ ref -> return ref
+      _other -> throwError "TcDeref: not a predicate"
+    PredicateDetails{..} <- getPredicateDetails pred
+    forM r $ \(stmts, p) -> do
+      v <- Ref . MatchVar <$> fresh keyTy
+      let valPat = Ref (MatchWild predicateValueType)
+          gen = FactGenerator ref v valPat SeekOnAllFacts
+      return (stmts `thenStmt` FlatStatement ty p gen, v)
+
+  -- pat.field ==> X where { field = X } = pat
+  Ref (MatchExt (Typed ty (TcFieldSelect (Typed recTy pat) name))) -> do
+    r <- flattenPattern pat
+    case derefType recTy of
+      Angle.RecordTy fields -> do
+        let sel v =
+              [ if name == n then v else Ref (MatchWild ty)
+              | Angle.FieldDef n ty <- fields
+              ]
+        forM r $ \(stmts, p) -> do
+          v <- Ref . MatchVar <$> fresh ty
+          let stmt = FlatStatement recTy (Tuple (sel v)) (TermGenerator p)
+          return (stmts `thenStmt` stmt, v)
+      _other ->
+        throwError $ "internal: TcFieldSelect: " <>
+          Text.pack (show (displayDefault recTy))
+
+  -- pat.field? ==> X where { field = X } = pat
+  Ref (MatchExt (Typed ty (TcAltSelect (Typed sumTy pat) name))) -> do
+    r <- flattenPattern pat
+    n <- case derefType sumTy of
+      Angle.SumTy fields
+        | (_,n):_ <- lookupField name fields ->
+          return n
+      _ -> error "flatten: SumTy"
+    forM r $ \(stmts, p) -> do
+      v <- Ref . MatchVar <$> fresh ty
+      let stmt = FlatStatement sumTy (Alt n v) (TermGenerator p)
+      return (stmts `thenStmt` stmt, v)
+
+  Ref (MatchExt (Typed _ (TcPromote _ pat))) ->
+    flattenPattern pat
+
+  Ref (MatchExt (Typed ty _)) -> do
+    gens <- flattenSeqGenerators pat
+    v <- fresh ty
+    let gen = TermGenerator (RTS.Ref (MatchBind v))
+    (ord, float) <- mkStmt ty [(mempty, mempty, gen)] gens
+    return [(ord <> float, RTS.Ref (MatchVar v))]
+
+{- Note [flattening TcOr]
+
+To flatten
+
+   p | q
+
+then we have a choice of two plans.
+
+PLAN A
+
+Is just to generate a fresh variable and bind the term. In an expression
+context this would mean
+
+   X where X = p | q
+
+(side note: this might not work in a pattern context, e.g. if p/q
+contain wildcards or unbound variables, in which case we could instead
+do something like
+
+   X where _ = (() where p = X) | (() where q = X)
+
+but the statement must come *after* matching the current pattern,
+which we don't currently support. Also note here that we can't easily
+tell whether p/q contain unbound variables, because the binding order
+at this point is wrong due to substitution and floating, and won't be
+correct until we've run fixMatchBind later.)
+
+PLAN B is to duplicate the enclosing pattern, so if we had
+
+   { "a", p | q }
+
+then we'll get
+
+   { "a", p } | { "a", q }
+
+and so on, all the way up to the nearest enclosing statement, where we
+can generate SeqGenerators.
+
+It turns out that PLAN B is what we want if we have an enclosing fact
+generator, e.g.
+
+   cxx1.Name ("foo".. | "bar"..)
+
+should generate
+
+   (cxx1.Name "foo"..) | (cxx1.Name "bar"..)
+
+because that would be a lot more efficient than
+
+   cxx1.Name X
+   _ = (() where "foo".. = X) | (() where "bar".. = X)
+
+However, PLAN A is good in some other cases because it doesn't
+duplicate anything.
+
+For now we do PLAN B all the time, but someday we might try to do PLAN
+A when it's a good idea.
+
+Note that this only applies to |. The other kinds of things we want
+to lift out can always be bound and floated, because they're always
+valid expressions and lifting out won't affect performance.
+-}
+
+-- | A set of statements. The statements in the set will be reordered
+-- by the Reorder pass later.
+newtype Statements = Statements { _unStatements :: [FlatStatement] }
+
+instance Semigroup Statements where
+  Statements s1 <> Statements s2 = Statements (s2 <> s1)
+
+instance Monoid Statements where
+  mempty = Statements []
+  mconcat = foldl' (<>) mempty  -- override default, we want left-fold
+
+thenStmt :: Statements -> FlatStatement -> Statements
+thenStmt ss s | irrelevant s = ss
+thenStmt (Statements ss) s = Statements (s : ss)
+
+oneStmt :: FlatStatement -> Statements
+oneStmt s = mempty `thenStmt` s
+
+-- | True for statements that cannot make any difference to the query.
+-- That is, statements that can neither fail nor bind any variables.
+irrelevant :: FlatStatement -> Bool
+irrelevant (FlatStatement _ _ (TermGenerator (Ref (MatchWild _)))) = True
+irrelevant (FlatStatement _ (Ref (MatchWild _)) rhs) =
+  case rhs of
+    DerivedFactGenerator{} -> True
+    _ -> False
+    -- it's tempting to include PrimCall and TermGenerator here, but
+    -- note that these may be written by the user and may be
+    -- unresolvable, so elimiating them here may hide an error.
+irrelevant _ = False
+
+-- | Inject an ordered sequence of FlatStatementGroup into a
+-- Statements.  This is used when we need to retain the ordering
+-- between some statements, but allow the whole sequence to be
+-- reordered with respect to other statements around it.
+floatGroup :: FlatStatementGroup -> Statements
+floatGroup g = Statements [grouping g]
+  -- Note: we nest groups by using FlatDisjunction with a single
+  -- alternative. This is so that this set of groups may be reordered with
+  -- respect to other statements/groups at the same level. For this to
+  -- work, we have to retain this grouping until the Reorder phase, so
+  -- the optimiser must not flatten it away.
+
+flattenStmts :: Statements -> [Ordered FlatStatement]
+flattenStmts (Statements s) = map Floating (reverse s)
+
+disjunction :: [FlatStatementGroup] -> FlatStatement
+disjunction [FlatStatementGroup [x]] = unOrdered x
+disjunction groups = FlatDisjunction groups
+
+mkGroup :: [Statements] -> [Statements] -> FlatStatementGroup
+mkGroup ords floats =
+  mkStatementGroup $
+    flattenStmts (mconcat floats) <>
+    map Ordered (orderedGroups ords)
+  where
+  orderedGroups :: [Statements] -> [FlatStatement]
+  orderedGroups = mapMaybe (mkGroup . flattenStmts)
+
+  mkGroup [] = Nothing
+  mkGroup [Floating one] = Just one
+  mkGroup more  = Just (FlatDisjunction [mkStatementGroup more])
+
+asGroup :: Statements -> FlatStatementGroup
+asGroup one = mkStatementGroup (flattenStmts one)
+
+singleTerm :: a -> F [(Statements, a)]
+singleTerm t = return [(mempty, t)]
+
+manyTerms :: ([a] -> b) -> [[(Statements, a)]] -> [(Statements, b)]
+manyTerms constr subterms =
+  [ (mconcat stmts, constr ts)
+  | xs <- sequence subterms  -- all combinations of subterms
+  , let (stmts,ts) = unzip xs
+  ]
+
+twoTerms
+  :: (a -> b -> c)
+  -> [(Statements, a)]
+  -> [(Statements, b)]
+  -> [(Statements, c)]
+twoTerms constr as bs =
+  [ (stmtsa <> stmtsb, constr a b)
+  | (stmtsa, a) <- as
+  , (stmtsb, b) <- bs
+  ]
+
+
+-- | Note [query result]
+--
+-- A bit of trickiness to handle capturing and returning the key and
+-- value. This avoids having to separately look up the fact later, and
+-- also means we can track the size of the output that we're returning
+-- in the compiled query.
+--
+-- For a query like
+--
+-- > predicate ("x",_)
+--
+-- flattening expands this to
+--
+-- > X where X = predicate ("x",_)
+--
+-- and here we expand this to
+--
+-- > { X, K, () } where X = predicate K @ ("x",_)
+--
+-- and the query compiler compiles this to efficient bytecode to
+-- capture the key and return it.
+--
+-- Note that we might not be able to do this transformation if the
+-- query isn't in the right form, so in that case we need an
+-- explicit fact lookup, like
+--
+--   X = predicate K
+--
+-- BUT we have to do this lookup as the very last thing before
+-- returning the result, because the fact might be a derived fact
+-- produced by a DerivedFactGen, so it won't exist until after it has
+-- been produced. Therefore we can't just add this lookup statement to
+-- the query, because there's nothing preventing later phases from
+-- moving it too early.
+--
+-- So instead we defer the generation of this statement until code
+-- generation. The generator is kept in the field qiGenerator in the
+-- QueryWithInfo.
+
+captureKey
+  :: Schema.AngleVersion
+  -> DbSchema
+  -> FlatQuery
+  -> Type
+  -> F (FlatQuery, Maybe Generator, Type)
+captureKey ver dbSchema
+    (FlatQuery pat Nothing (FlatStatementGroup ord)) ty
+  | Angle.PredicateTy _ pidRef@(PidRef pid _) <- ty  = do
+  let
+    captureOrdStmt fidVar keyVar maybeValVar (Ordered s) =
+      (Ordered <$> stmts, pats)
+      where (stmts, pats) = captureStmt fidVar keyVar maybeValVar s
+    captureOrdStmt fidVar keyVar maybeValVar (Floating s) =
+      (Floating <$> stmts, pats)
+      where (stmts, pats) = captureStmt fidVar keyVar maybeValVar s
+
+    -- look for $result = pred pat
+    -- replace it with  $result = pred ($key @ pat)
+    captureStmt
+      :: Int
+      -> Var
+      -> Maybe Var
+      -> FlatStatement
+      -> (NonEmpty FlatStatement, Maybe (Pat, Pat))
+    captureStmt fidVar keyVar maybeValVar
+      (FlatStatement ty lhs (FactGenerator pid kpat vpat range))
+      | Ref (MatchBind (Var _ v' _)) <- lhs
+      , fidVar == v' =
+        let kpat' = Ref (MatchAnd (Ref (MatchBind keyVar)) kpat)
+            vpat' = case maybeValVar of
+              Nothing -> vpat
+              Just valVar -> Ref (MatchAnd (Ref (MatchBind valVar)) vpat)
+            stmt' = FlatStatement ty lhs (FactGenerator pid kpat' vpat' range)
+            keyExpr = Ref (MatchVar keyVar)
+            valExpr = maybe (Tuple []) (Ref . MatchVar) maybeValVar
+        in
+        (stmt' :| [], Just (keyExpr, valExpr))
+
+    captureStmt fidVar keyVar@(Var keyTy _ _) maybeValVar
+      (FlatStatement ty lhs (DerivedFactGenerator pid kexpr vexpr))
+      | Ref (MatchBind (Var _ v' _)) <- lhs
+      , fidVar == v' =
+        let
+          -- optimise away a redundant copy when the key/value is
+          -- already a variable.
+          (keyExpr, bindKey)
+            | Ref MatchVar{} <- kexpr = (kexpr, Nothing)
+            | otherwise =
+              ( Ref (MatchVar keyVar)
+              , Just $
+                  FlatStatement keyTy
+                    (Ref (MatchBind keyVar))
+                    (TermGenerator kexpr)
+              )
+          (valExpr, bindVal)
+            | Ref MatchVar{} <- vexpr = (vexpr, Nothing)
+            | otherwise = case maybeValVar of
+                Nothing -> (Tuple [], Nothing)
+                Just valVar@(Var valTy _ _) ->
+                  ( Ref (MatchVar valVar)
+                  , Just $
+                      FlatStatement valTy
+                        (Ref (MatchBind valVar))
+                        (TermGenerator vexpr)
+                  )
+        in
+        ( NonEmpty.fromList $ catMaybes
+            [ bindKey
+            , bindVal
+            , Just $ FlatStatement ty lhs
+                (DerivedFactGenerator pid keyExpr valExpr)
+            ]
+        , Just (keyExpr, valExpr))
+    captureStmt _ _ _ other =
+        (other :| [], Nothing)
+
+  PredicateDetails{..} <- case lookupPid pid dbSchema of
+    Nothing -> throwError "internal: captureKey"
+    Just details -> return details
+  keyVar <- fresh predicateKeyType
+  maybeValVar <- if eqType ver predicateValueType unit
+    then return Nothing
+    else Just <$> fresh predicateValueType
+  let
+    (ord', capturedOrd) =
+      case pat of
+        Ref (MatchVar (Var _ v _)) ->
+          let k :: [Ordered FlatStatement]
+                -> [(NonEmpty (Ordered FlatStatement), Maybe (Pat, Pat))]
+              k = map (captureOrdStmt v keyVar maybeValVar)
+              (ords, capturedOrd) = unzip (k ord)
+
+              conc :: [NonEmpty (Ordered FlatStatement)] ->
+                [Ordered FlatStatement]
+              conc ((x :| xs) : ys) = x : (xs ++ concatMap NonEmpty.toList ys)
+              conc [] = []
+          in
+          (conc ords, capturedOrd)
+        _other -> (ord, [])
+
+    returnTy = tupleSchema [ty, predicateKeyType, predicateValueType]
+
+  case catMaybes capturedOrd of
+    [(key, val)] ->
+      return (FlatQuery (RTS.Tuple [pat, key, val]) Nothing
+        (mkStatementGroup ord'), Nothing, returnTy)
+    _ -> do
+      -- If we can't find the key/value now, we'll add a statement
+      --   X = pred K V
+      -- at the end right before codeGen. Here we produce the generator
+      -- for the statement.
+      let
+        gen = FactGenerator pidRef
+          (Ref (MatchBind keyVar))
+          (Ref (maybe (MatchWild predicateValueType) MatchBind maybeValVar))
+          SeekOnAllFacts
+      return (FlatQuery pat Nothing (mkStatementGroup ord),
+        Just gen,
+        returnTy)
+
+  | otherwise = do
+  -- We have
+  --
+  --    E where stmts
+  --
+  -- we'll transform it into
+  --
+  --    ($fid, $key) where
+  --    stmts;
+  --    $key = E
+  --    $fid = Pid<- $key
+  --
+  -- where
+  --    Pid is a new Pid for a fictitious derived predicate
+  --    $fid is the fact ID
+  --    $key is the key
+    let
+      pidRef = PidRef (tempPid dbSchema) tempPredicateId
+      pidTy = Angle.PredicateTy () pidRef
+      retTy = tupleSchema [pidTy, ty, unit]
+
+    fidVar <- fresh pidTy
+    keyVar <- fresh ty
+
+    let
+      result = RTS.Tuple
+        [ RTS.Ref (MatchVar fidVar)
+        , RTS.Ref (MatchVar keyVar)
+        , Tuple []
+        ]
+      resultStmt1 =
+        FlatStatement ty (Ref (MatchBind keyVar)) (TermGenerator pat)
+      resultGen =
+        DerivedFactGenerator pidRef (Ref (MatchVar keyVar)) (Tuple [])
+      resultStmt2 =
+        FlatStatement pidTy (Ref (MatchBind fidVar)) resultGen
+
+    return
+      ( FlatQuery result Nothing
+          (mkStatementGroup (Floating resultStmt1 : Floating resultStmt2 : ord))
+      , Nothing
+      , retTy )
+
+captureKey _ _ (FlatQuery _ Just{} _) _ =
+  throwError "queries returning both a key and value are not supported"
diff --git a/glean/db/Glean/Query/Flatten/Types.hs b/glean/db/Glean/Query/Flatten/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Flatten/Types.hs
@@ -0,0 +1,302 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveFunctor, DeriveTraversable #-}
+module Glean.Query.Flatten.Types
+  ( F
+  , initialFlattenState
+  , getPredicateDetails
+  , FlattenState(..)
+  , FlattenedQuery
+  , FlatQuery_(..)
+  , FlatQuery
+  , FlatStatement(..)
+  , falseStmt
+  , FlatStatementGroup(..)
+  , Ordered(..)
+  , unOrdered
+  , grouping
+  , mkStatementGroup
+  , singletonGroup
+  , boundVars
+  , boundVarsOf
+  , boundVarsOfOrdStmt
+  , boundVarsOfGen
+  , freshWildStmt
+  , freshWildGen
+  , freshWildQuery
+  ) where
+
+import Control.Monad.Except
+import Control.Monad.State
+import qualified Data.IntSet as IntSet
+import Data.Text (Text)
+import Compat.Prettyprinter hiding ((<>))
+
+import Glean.Angle.Types ( PredicateId )
+import Glean.Query.Codegen.Types
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.Database.Types (EnableRecursion(..))
+import Glean.Display
+import Glean.RTS.Types as RTS
+import Glean.Query.Vars
+
+
+type FlattenedQuery = QueryWithInfo FlatQuery
+
+data FlatQuery_ p = FlatQuery p (Maybe p) FlatStatementGroup
+  -- Statements are grouped by the flattener:
+
+type FlatQuery = FlatQuery_ Pat
+
+-- | A FlatStatementGroup is a non-empty group of FlatStatement.
+--
+-- A group of statements arise from a single statement in the
+-- un-flattened Angle code.  The statements within each group will be
+-- rearranged by the Reorder pass, but the relative order of the
+-- groups will be retained.  In other words: we don't change the order
+-- of statements you write, but we'll try to optimise the order of
+-- matches in a nested match.
+newtype FlatStatementGroup = FlatStatementGroup [Ordered FlatStatement]
+  deriving Show
+
+data Ordered s
+  = Ordered s
+  | Floating s
+  deriving (Show, Functor, Foldable, Traversable)
+
+unOrdered :: Ordered s -> s
+unOrdered (Ordered s) = s
+unOrdered (Floating s) = s
+
+singletonGroup :: FlatStatement -> FlatStatementGroup
+singletonGroup s = FlatStatementGroup [Floating s]
+
+instance Display pat => Display (FlatQuery_ pat) where
+  display opts (FlatQuery key maybeVal g@(FlatStatementGroup stmts)) =
+    case stmts of
+      [] -> head
+      _ -> hang 2 (sep [head <+> "where", display opts g])
+    where
+    head = display opts key <>
+      maybe mempty (\val -> " -> " <> display opts val) maybeVal
+
+instance Display FlatStatementGroup where
+  display opts (FlatStatementGroup stmts)
+    = sep [hang 2 (sep ["[", p stmts]), "]"]
+    where
+    p stmts = sep (punctuate ";" (map (display opts) stmts))
+
+instance Display (Ordered FlatStatement) where
+  display opts (Ordered s) = display opts s
+  display opts (Floating s) = "~" <+> display opts s
+
+data FlatStatement
+  = FlatStatement Type Pat Generator
+    -- ^ A simple statement: P = gen
+  | FlatAllStatement Var Pat FlatStatementGroup
+    -- ^ An all() statement.
+    -- @FlatAllStatement X P S@ means @X = all (P where S)@
+    -- Like disjunction and negation, Variables occurring in
+    -- @P where S@ are not considered bound.
+  | FlatNegation FlatStatementGroup
+    -- ^ The negation of a series of statements
+  | FlatDisjunction [FlatStatementGroup]
+    -- ^ A disjunction of alternatives: (stmts; ...) | ... | (stmts; ...)
+    -- As a special case, if there is just one alternative this construct
+    -- is used for nesting groups within a FlatStatementGroup. See
+    -- Glean.Query.Flatten.floatGroups.
+  | FlatConditional
+      { cond :: FlatStatementGroup
+      , then_ :: FlatStatementGroup
+      , else_ :: FlatStatementGroup
+      }
+    -- ^ An if-then-else statement.
+    -- If the statements in the condition match, the 'then' statements are
+    -- evaluated, otherwide the 'else' statements are.
+
+  deriving Show
+
+-- | Smart constructor for a subgroup of statements, ensures we don't
+-- create unnecessary nested singleton groups.
+grouping :: FlatStatementGroup -> FlatStatement
+grouping (FlatStatementGroup [one]) = unOrdered one
+grouping group = FlatDisjunction [group]
+
+-- | Smart constructor for a FlatStatementGroup, as with "grouping"
+-- this flattens unnecessary nesting.
+mkStatementGroup :: [Ordered FlatStatement] -> FlatStatementGroup
+mkStatementGroup [Ordered (FlatDisjunction [group])] = group
+mkStatementGroup [Floating (FlatDisjunction [group])] = group
+mkStatementGroup ord = FlatStatementGroup ord
+
+instance VarsOf FlatStatementGroup where
+  varsOf w (FlatStatementGroup stmts) r = foldr (varsOf w) r stmts
+
+instance VarsOf (Ordered FlatStatement) where
+  varsOf w = varsOf w . unOrdered
+
+instance VarsOf FlatStatement where
+  varsOf w s r = case s of
+    FlatStatement _ lhs rhs -> varsOf w lhs $! varsOf w rhs r
+    FlatAllStatement (Var _ v _) pat stmts ->
+      IntSet.insert v $! varsOf w pat $! varsOf w stmts r
+    FlatNegation stmts      -> varsOf w stmts r
+    FlatDisjunction stmtss  -> foldr (varsOf w) r stmtss
+    FlatConditional cond then_ else_ ->
+      foldr (varsOf w) r [cond, then_, else_]
+
+freshWildQuery :: (Monad m, Fresh m) => FlatQuery -> m FlatQuery
+freshWildQuery (FlatQuery p v stmts) =
+  FlatQuery
+    <$> freshWild p
+    <*> mapM freshWild v
+    <*> freshWildGroup stmts
+
+freshWildStmt :: (Monad m, Fresh m) => FlatStatement -> m FlatStatement
+freshWildStmt (FlatStatement ty pat gen) = do
+  pat' <- freshWild pat
+  gen' <- freshWildGen gen
+  return (FlatStatement ty pat' gen')
+freshWildStmt (FlatAllStatement var pat stmts) = do
+  pat' <- freshWild pat
+  stmts' <- freshWildGroup stmts
+  return (FlatAllStatement var pat' stmts')
+freshWildStmt (FlatNegation group) =
+  FlatNegation <$> freshWildGroup group
+freshWildStmt (FlatDisjunction alts) =
+  FlatDisjunction <$> mapM freshWildGroup alts
+freshWildStmt (FlatConditional cond then_ else_) =
+  FlatConditional
+    <$> freshWildGroup cond
+    <*> freshWildGroup then_
+    <*> freshWildGroup else_
+
+freshWildGroup
+  :: (Monad m, Fresh m)
+  => FlatStatementGroup
+  -> m FlatStatementGroup
+freshWildGroup (FlatStatementGroup ord) =
+  FlatStatementGroup <$> mapM (mapM freshWildStmt) ord
+
+freshWildGen :: (Monad m, Fresh m) => Generator -> m Generator
+freshWildGen gen = case gen of
+  FactGenerator pid pat val sect ->
+    FactGenerator pid
+      <$> freshWild pat
+      <*> freshWild val
+      <*> pure sect
+  TermGenerator expr -> TermGenerator <$> freshWild expr
+  DerivedFactGenerator pid key val ->
+    DerivedFactGenerator pid
+      <$> freshWild key
+      <*> freshWild val
+  ArrayElementGenerator ty expr ->
+    ArrayElementGenerator ty <$> freshWild expr
+  SetElementGenerator ty expr ->
+    SetElementGenerator ty <$> freshWild expr
+  PrimCall op args ty ->
+    PrimCall op <$> mapM freshWild args <*> pure ty
+
+-- | Like 'varsOf', but only including variables that can be bound by
+-- this statement.
+boundVars :: FlatStatement -> VarSet
+boundVars stmt = boundVarsOf stmt IntSet.empty
+
+boundVarsOf :: FlatStatement -> VarSet -> VarSet
+boundVarsOf (FlatStatement _ lhs rhs) r =
+  varsOf AllVars lhs (boundVarsOfGen rhs r)
+boundVarsOf (FlatAllStatement (Var _ v _) p stmts) r =
+  IntSet.insert v $! varsOf AllVars p $! boundVarsOfGroup stmts r
+boundVarsOf (FlatNegation _) r = r -- a negated query cannot bind variables
+boundVarsOf (FlatDisjunction []) r = r
+boundVarsOf (FlatDisjunction groups) r = s `IntSet.union` r
+  where
+  s = foldr1 IntSet.intersection $
+    map (\g -> boundVarsOfGroup g IntSet.empty) groups
+boundVarsOf (FlatConditional cond then_ else_) r =
+  varsThen `IntSet.intersection` varsElse
+  where
+    varsThen = boundVarsOfGroup cond $ boundVarsOfGroup then_ r
+    varsElse = boundVarsOfGroup else_ r
+
+boundVarsOfGroup :: FlatStatementGroup -> VarSet -> VarSet
+boundVarsOfGroup (FlatStatementGroup ord) r =
+  foldr boundVarsOfOrdStmt r ord
+
+boundVarsOfOrdStmt :: Ordered FlatStatement -> VarSet -> VarSet
+boundVarsOfOrdStmt s = boundVarsOf (unOrdered s)
+
+boundVarsOfGen :: Generator -> VarSet -> VarSet
+boundVarsOfGen DerivedFactGenerator{} r = r
+boundVarsOfGen ArrayElementGenerator{} r = r
+boundVarsOfGen PrimCall{} r = r
+boundVarsOfGen other r = varsOf AllVars other r
+
+-- | a statement that always fails
+falseStmt :: FlatStatement
+falseStmt = FlatDisjunction []
+
+instance Display FlatStatement where
+  display opts = \case
+    FlatStatement _ lhs rhs ->
+      hang 2 $ sep [display opts lhs <+> "=", display opts rhs ]
+    FlatAllStatement v e stmts ->
+      display opts v <+> "=" <+> "all" <+>
+        sep [hang 2 (display opts stmts), display opts e]
+    FlatNegation group ->
+      "!" <> display opts group
+    FlatDisjunction groupss ->
+      sep (punctuate " |" (map (display opts) groupss))
+    FlatConditional cond then_ else_ -> sep
+      [ nest 2 $ sep ["if", display opts cond ]
+      , nest 2 $ sep ["then", display opts then_]
+      , nest 2 $ sep ["else", display opts else_]
+      ]
+
+data FlattenState = FlattenState
+  { flDbSchema :: DbSchema
+  , flNextVar :: Int
+  , flDeriveStored :: Maybe PredicateId
+    -- ^ we should derive this DerivedAndStored predicate
+  , flStack :: [PredicateId]
+    -- ^ Stack of derived predicates, to prevent recursion. (for now,
+    -- until we have support for recursion).
+  , flRecursion :: EnableRecursion
+  }
+
+getPredicateDetails :: PredicateId -> F PredicateDetails
+getPredicateDetails pred = do
+  dbSchema <- gets flDbSchema
+  case lookupPredicateId pred dbSchema of
+    Nothing -> error $ "predicateKeyTYpe: " <> show (displayDefault pred)
+    Just d -> return d
+
+initialFlattenState
+  :: EnableRecursion
+  -> DbSchema
+  -> Int
+  -> Maybe PredicateId
+  -> FlattenState
+initialFlattenState rec dbSchema nextVar deriveStored = FlattenState
+  { flDbSchema = dbSchema
+  , flNextVar = nextVar
+  , flDeriveStored = deriveStored
+  , flStack = []
+  , flRecursion = rec
+  }
+
+type F a = StateT FlattenState (Except Text) a
+
+instance Fresh (StateT FlattenState (Except Text)) where
+  peek = gets flNextVar
+  alloc = do
+    state@FlattenState{..} <- get
+    put state { flNextVar = flNextVar + 1 }
+    return flNextVar
diff --git a/glean/db/Glean/Query/Incremental.hs b/glean/db/Glean/Query/Incremental.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Incremental.hs
@@ -0,0 +1,246 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveFunctor #-}
+
+module Glean.Query.Incremental
+  ( makeIncremental
+  )
+  where
+
+import Data.Maybe (mapMaybe, catMaybes)
+
+import Glean.Query.Codegen.Types
+import Glean.RTS.Types (Pid, PidRef(..))
+import Glean.RTS.Term
+
+-- | Make a predicate derivation query efficiently derive new facts on an
+-- incremental database.
+-- See Note [Incremental derivation - Strategy]
+makeIncremental
+  :: (SeekSection -> Pid -> Bool)
+  -- ^ whether a predicate has facts in the section or not.
+  -> CodegenQuery
+  -> CodegenQuery
+makeIncremental hasFacts (QueryWithInfo (CgQuery h body) v g t) =
+ QueryWithInfo (CgQuery h (expandGenerators hasFacts body)) v g t
+
+-- | Represents the output from expanding statements such that they will
+-- perform a combination of querying the base and incremental database.
+data Incremental a = Incremental
+  { seekingStacked :: Maybe a
+    -- ^ invariant: contains at least one generator with SeekOnStacked
+  , seekingOnlyBase :: Maybe a
+    -- ^ invariant: contains 0 or more generators and all with SeekOnBase
+  }
+  deriving (Functor)
+
+falseStmt  :: CgStatement
+falseStmt = CgDisjunction []
+
+-- | See Note [Incremental derivation - Implementation]
+expandGenerators
+  :: (SeekSection -> Pid -> Bool)
+  -> [CgStatement]
+  -> [CgStatement]
+expandGenerators hasFacts stmts =
+  case seekingStacked $ expandSequence stmts of
+    Nothing -> [falseStmt]
+    Just xs -> xs
+  where
+  expandSequence :: [CgStatement] -> Incremental [CgStatement]
+  expandSequence [] = Incremental Nothing (Just [])
+  expandSequence (x:xs) = Incremental new old
+    where
+      Incremental mnew mold = expandStatement x
+      Incremental mnews molds = expandSequence xs
+      new = nonnull $ disjunctionToSequence $ catMaybes
+        [ do new <- mnew
+             return (new:xs)
+        , do old <- mold
+             news <- mnews
+             return (old:news)
+        ]
+      old = do
+        old <- mold
+        olds <- molds
+        return (old:olds)
+
+  expandStatement :: CgStatement -> Incremental CgStatement
+  expandStatement stmt = case stmt of
+    CgStatement pat (FactGenerator pref key val SeekOnAllFacts)
+      -- when pat is known, this is a lookup not a seek so we
+      -- don't need to expand it.
+      | not (known pat) ->
+      let PidRef pid _ = pref
+          generator where_ =
+            if hasFacts where_ pid
+            then Just $ CgStatement pat (FactGenerator pref key val where_)
+            else Nothing
+      in
+      Incremental (generator SeekOnStacked) (generator SeekOnBase)
+    CgStatement{} ->
+      Incremental Nothing (Just stmt)
+    CgAllStatement{} -> Incremental Nothing (Just stmt)
+    CgDisjunction stmtss ->
+      CgDisjunction <$> expandDisjunction stmtss
+    CgNegation{} ->
+      error "unexpected negation in stored derived predicate"
+    CgConditional{} ->
+      error "unexpected if statement in stored derived predicate"
+
+  known (Ref MatchFid{}) = True
+  known (Ref MatchVar{}) = True
+  known Nat{} = True
+  known (Ref (MatchAnd p q)) = known p || known q
+  known _ = False
+
+  expandDisjunction :: [[CgStatement]] -> Incremental [[CgStatement]]
+  expandDisjunction branches = Incremental (nonnull news) (nonnull olds)
+    where
+      ts = map expandSequence branches
+      news = mapMaybe seekingStacked ts
+      olds = mapMaybe seekingOnlyBase ts
+
+  disjunctionToSequence ::  [[CgStatement]] -> [CgStatement]
+  disjunctionToSequence = \case
+    [] -> []
+    [x] -> x
+    xs -> [CgDisjunction xs]
+
+  nonnull :: [a] -> Maybe [a]
+  nonnull [] = Nothing
+  nonnull xs = Just xs
+
+{- Note [Incremental derivation - Strategy]
+
+When deriving stored predicates on stacked databases we want to make sure that
+we only derive facts that use the newly available data and that we are not
+re-deriving everything that was derived before.
+
+We can do this by making sure that the derivation query will always look at
+fact combinations involving new facts in the stacked database.
+
+We could require that at least one field of new derived facts come from the
+stacked database, but that would be too restrictive. Consider this case
+
+  predicate Path2 { a: Node, b: Node }
+    { A, B } where
+      Edge { A, K };
+      Edge { K, B }
+
+New edges should entail new `Path2` facts despite `Edge` not being part of
+`Path2`'s key or value.
+
+Instead we require that at least one FactGenerator in every query path
+be restricted only to the stacked db.
+
+-}
+
+{- Note [Incremental derivation - Implementation]
+
+When running derivations in an incremental database we want to enforce that:
+
+ 1. Every derived predicate be generated using some data coming from the new
+    increment fact set.
+
+ 2. We must not repeat the derivation process already performend on the base db.
+
+This can be achieved by querying all possible combinations of seeking on base
+and incremental db for every fact generator. Rule 2 can be enforced by not
+running the case where all generators query the base db. This is key as we
+expect that branch to take much longer than all others.
+
+We may try to transform each fact generator into a disjunction. Given the query:
+
+   P A; Q B; R C;
+
+naively transform it into
+
+   (Pbase A | Pincr A);
+   (Pbase B | Pincr B);
+   (Rbase C | Rincr C);
+
+This is problematic becase we cannot remove the case where all generators query
+the base db (rule 2).
+
+We may try another approach. Generate all possible combinations and drop the
+unwanted case.
+
+   (Pbase A; Qbase B; Rbase C)  -- this one is dropped
+   (Pbase A; Qbase B; Rincr C)
+   (Pbase A; Qincr B; Rbase C)
+   (Pbase A; Qincr B; Rincr C)
+   (Pincr A; Qbase B; Rbase C)
+   (Pincr A; Qincr B; Rbase C)
+   (Pincr A; Qbase B; Rincr C)
+   (Pincr A; Qincr B; Rincr C)
+
+this has two problems: the bytecode size complexity is O(2^n) and it is
+inefficient as we are not doing any sharing between different paths.
+
+Finally, we opt for the approach of making a tree out of it by branching on
+every fact generator.
+
+   ( Pincr A;
+     ( Qbase B;
+         ( Rbase C
+         | Rincr C
+         )
+     ) |
+     ( Qincr B;
+         ( Rbase C
+         | Rincr C
+         )
+     )
+   ) |
+   ( Pbase A;
+     ( Qbase B;
+         ( Rbase C -- we remove this node to have no branch querying only base
+         | Rincr C
+         )
+     ) |
+     ( Qincr B;
+         ( Rbase C
+         | Rincr C
+         )
+     )
+   )
+
+The bytecode size is still O(2^n) but the query is more efficient as we now
+have more sharing.
+We optimise it by realising that (Pincr A | Pbase A) == P A.
+
+   ( Pincr A; Q B; R C ) |
+   ( Pbase A;
+      ( Qincr B; R C) |
+      ( Qbase B; Rincr C)
+   )
+
+This leads fact generator expansion to two cases
+  * Seek on increment db and proceed with the original query
+  * Seek on the base db and process the rest of the query further.
+
+The resulting algorithm is O(n) in time and space, but the output tree will
+generate bytecode that is O(n^2) where n is the number of fact generators in
+the longest query branch.
+
+## Handling disjunctions
+
+To have all possible combinations of seeking base and stacked dbs for
+disjunctions we will need to separate the case where all branches seek
+only on base from the other cases.
+
+  (P A | Q B); R C;
+
+becomes
+
+     ( ( Pincr A | Qincr B ); R C )
+   | ( ( Pbase A | Qbase B ); Rincr C )
+
+-}
diff --git a/glean/db/Glean/Query/JSON.hs b/glean/db/Glean/Query/JSON.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/JSON.hs
@@ -0,0 +1,431 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.JSON
+  ( factToJSON
+  , factToCompact
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.ST (ST, stToIO)
+import Control.Monad.ST.Unsafe (unsafeIOToST)
+import Data.Bits
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.ByteString.Lazy as LBS
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text.Encoding as Text
+import Data.Word (Word8, Word64)
+import Foreign.Marshal.Utils (copyBytes)
+import Safe (atMay)
+
+import Thrift.Protocol.JSON.Base64
+import Util.Buffer (ascii, liftST)
+import qualified Util.Buffer as Buffer
+
+import Glean.RTS as RTS
+import qualified Glean.RTS.Foreign.JSON as RTS hiding (String, Array)
+import qualified Glean.RTS.Foreign.Thrift as Thrift
+import Glean.RTS.Types (Type, ExpandedType(..))
+import Glean.Database.Schema
+import Glean.Angle.Types as Schema hiding (Type)
+
+newtype EncodingError = EncodingError String
+  deriving(Show)
+
+instance Exception EncodingError
+
+encodingError :: String -> ST s a
+encodingError = unsafeIOToST . throwIO . EncodingError
+
+-- | Convert a fact to JSON
+factToJSON
+  :: Bool
+  -> IntMap ByteString
+  -> PredicateDetails
+  -> Fid
+  -> ByteString
+  -> ByteString
+  -> IO ByteString
+factToJSON no_base64 expanded pred fid key value =
+  encodeFact expanded pred fid key value (jsonEncoder no_base64)
+
+-- | Convert a fact to Thrift Compact
+factToCompact
+  :: IntMap ByteString
+  -> PredicateDetails
+  -> Fid
+  -> ByteString
+  -> ByteString
+  -> IO ByteString
+factToCompact expanded pred fid key value =
+  encodeFact expanded pred fid key value compactEncoder
+
+type Enc = forall s . Buffer.Fill s ()
+
+-- | Specifies how facts should be encoded
+data Encoder = Encoder
+  { -- | Bytes
+    encByte :: Word8 -> Enc
+
+    -- | Numbers
+  , encNat :: Word64 -> Enc
+
+    -- | Booleans
+  , encBool :: Bool -> Enc
+
+    -- | Mangled RTS strings
+  , encMangledString :: RTS.MangledStringRef -> Int -> Enc
+
+    -- | Binary
+  , encBinary :: RTS.ByteStringRef -> Enc
+
+    -- | Start an array
+  , encArrayBegin :: Type -> Int -> Enc
+
+    -- | Separate two array elements
+  , encArraySep :: Enc
+
+    -- | Finish an array
+  , encArrayEnd :: Enc
+
+    -- | Start a set
+  , encSetBegin :: Type -> Int -> Enc
+
+    -- | Separate two set elements
+  , encSetSep :: Enc
+
+    -- | Finish a set
+  , encSetEnd :: Enc
+
+    -- | Start an object
+  , encObjectBegin :: Enc
+
+    -- | Separate two object fields
+  , encObjectSep :: Enc
+
+    -- | Object field name/number - Thrift folds boolean values into the field
+    -- header so pass in the 'Decoder' and an action to decode and write the
+    -- value into the stream and let the encoder decide what to do with it.
+  , encObjectField
+      :: forall s.
+      Maybe Int  -- previous field id (if any)
+      -> Int  -- current field id
+      -> Text  -- field name
+      -> Type  -- field type
+      -> Decoder s  -- Thrift folds bool fields into the header so pass in
+      -> Buffer.Fill s ()  -- a Decoder and an action to write the field value
+
+      -> Buffer.Fill s ()
+
+    -- | Finish an object
+  , encObjectEnd :: Enc
+  }
+
+-- | Encode a fact with the given 'Encoder'
+encodeFact
+  :: IntMap ByteString
+  -> PredicateDetails
+  -> Fid
+  -> ByteString
+  -> ByteString
+  -> Encoder
+  -> IO ByteString
+{-# INLINE encodeFact #-}
+encodeFact
+  expanded
+  PredicateDetails{..}
+  fid
+  key
+  value
+  encoder@Encoder{..} = stToIO $
+    RTS.withDecoder key $ \dkey ->
+    RTS.withDecoder value $ \dvalue ->
+    Buffer.fillByteString 8 $ do
+      -- NOTE: We hardcode the field numbers for id, key and value here.
+      encObjectBegin
+      encObjectField Nothing 1 "id" NatTy dkey
+        $ encNat $ fromIntegral $ fromFid fid
+      encObjectSep
+      encObjectField (Just 1) 2 "key" predicateKeyType dkey
+        $ encode expanded encoder dkey predicateKeyType
+      case predicateValueType of
+        Schema.RecordTy [] -> return () -- omit "value" field if value is unit
+        _other -> do
+          encObjectSep
+          encObjectField (Just 2) 3 "value"
+              predicateValueType dvalue
+            $ encode expanded encoder dvalue predicateValueType
+      encObjectEnd
+
+-- | Takes a Glean schema type and a value of that type, and fills a 'Buffer'
+-- with a blob that can be decoded into the appropriate native Client Type
+-- corresponding to the generated Thrift schema. The encoding (currently only
+-- JSON) is specified by the 'Encoder'.
+--
+-- NOTE: This is INLINE because we want a specialised version for each encoding
+-- that we support.
+encode
+  :: IntMap ByteString
+  -> Encoder
+  -> RTS.Decoder s
+  -> Type
+  -> Buffer.Fill s ()
+{-# INLINE encode #-}
+encode expanded Encoder{..} !d = enc
+  where
+    enc typ = case typ of
+      ByteTy -> do
+        x <- liftST $ RTS.dByte d
+        encByte x
+      NatTy{} -> do
+        x <- liftST $ RTS.dNat d
+        encNat x
+      StringTy{} -> do
+        (x,n) <- liftST $ RTS.dTrustedStringRef d
+        encMangledString x $ fromIntegral n
+      ArrayTy elty -> do
+        size <- liftST $ RTS.dArray d
+        case elty of
+          ByteTy{} -> do
+            ref <- liftST $ RTS.dByteStringRef d size
+            encBinary ref
+          _ -> do
+            encArrayBegin elty $ fromIntegral size
+            case size of
+              0 -> return ()
+              1 -> enc elty
+              _ -> do
+                enc elty
+                let go 0 = return ()
+                    go n = do
+                      encArraySep
+                      enc elty
+                      go (n-1)
+                go (size-1)
+            encArrayEnd
+      RecordTy fieldTys -> do
+        encObjectBegin
+        -- We need to carry both the current and previous field numbers as
+        -- Thrift encodes deltas between those.
+        let field prev (i, FieldDef name ety) = case ety of
+              MaybeTy ety -> do
+                sel <- liftST $ RTS.dSelector d
+                if sel == 0
+                  then return prev
+                  else enc_field prev i name ety d
+              ty -> enc_field prev i name ty d
+        foldM_ field Nothing $ zip [1..] fieldTys
+        encObjectEnd
+      SumTy fieldTys -> do
+        sel <- liftST $ RTS.dSelector d
+        encObjectBegin
+        void $ case atMay fieldTys (fromIntegral sel) of
+          Just (FieldDef name ty) -> do
+            enc_field Nothing (fromIntegral sel + 1) name ty d
+          Nothing ->
+            enc_field Nothing (length fieldTys + 1) "UNKNOWN" (RecordTy []) d
+        encObjectEnd
+      SetTy elty -> do
+        size <- liftST $ RTS.dSet d
+        case elty of
+          ByteTy{} -> do
+            ref <- liftST $ RTS.dByteStringRef d size
+            encBinary ref
+          _ -> do
+            encSetBegin elty $ fromIntegral size
+            case size of
+              0 -> return ()
+              1 -> enc elty
+              _ -> do
+                enc elty
+                let go 0 = return ()
+                    go n = do
+                      encSetSep
+                      enc elty
+                      go (n-1)
+                go (size-1)
+            encSetEnd
+      NamedTy _ (ExpandedType _ ty) -> enc ty
+      EnumeratedTy _ -> do
+        x <- liftST $ RTS.dSelector d
+        encNat $ fromIntegral x
+      MaybeTy{} -> liftST $ encodingError "unsupported Maybe"
+      BooleanTy{} -> do
+        x <- liftST $ RTS.dSelector d
+        encBool (x /= 0)
+      PredicateTy{} -> do
+        fid <- liftST $ RTS.dFact d
+        let id = fromIntegral (fromFid fid)
+        case IntMap.lookup id expanded of
+          Just bs ->  Buffer.byteString bs
+          Nothing -> do
+            encObjectBegin
+            encObjectField Nothing 1 "id" NatTy d
+              $ encNat $ fromIntegral id
+            encObjectEnd
+      TyVar{} -> error "JSON.encode: TyVar"
+      HasTy{} -> error "JSON.encode: HasTy"
+      HasKey{} -> error "JSON.encode: HasKey"
+      ElementsOf{} -> error "JSON.encode: ElementsOf"
+
+    {-# INLINE enc_field #-}
+    enc_field prev i name ty d = do
+      when (isJust prev) encObjectSep
+      encObjectField prev i name ty d $ enc ty
+      return $ Just i
+
+jsonEncoder :: Bool -> Encoder
+jsonEncoder no_base64 = Encoder
+  { encByte = number . fromIntegral
+  , encNat = number
+  , encBool = \b -> if b
+      then do
+        ascii 't'
+        ascii 'r'
+        ascii 'u'
+        ascii 'e'
+      else do
+        ascii 'f'
+        ascii 'a'
+        ascii 'l'
+        ascii 's'
+        ascii 'e'
+  , encMangledString = \ref _ -> do
+      n <- liftST $ RTS.getMangledStringEscapedSize ref
+      do
+        ascii '\"'
+        Buffer.alloc n $ \p -> do
+          RTS.escapeMangledString ref p n
+          return n
+        ascii '\"'
+  , encBinary = \ !ref ->
+      if no_base64
+        then do
+          n <- liftST $ RTS.getStringEscapedSize ref
+          do
+            ascii '\"'
+            Buffer.alloc n $ \p -> do
+              RTS.escapeString ref p n
+              return n
+            ascii '\"'
+        else do
+          -- TODO: can be optimised if necessary
+          bytes <- liftST $ unsafeIOToST $ RTS.derefByteString ref
+          ascii '\"'
+          Buffer.byteString
+            $ LBS.toStrict $ Builder.toLazyByteString $ encodeBase64 bytes
+          ascii '\"'
+  , encArrayBegin = \_ _ -> ascii '['
+  , encArraySep = ascii ','
+  , encArrayEnd = ascii ']'
+  -- Sets are encoded as ordered arrays.
+  , encSetBegin = \_ _ -> ascii '['
+  , encSetSep = ascii ','
+  , encSetEnd = ascii ']'
+  , encObjectBegin = ascii '{'
+  , encObjectSep = ascii ','
+  , encObjectField = \_ _ !name _ _ enc -> do
+      ascii '\"'
+      Buffer.byteString (Text.encodeUtf8 name)
+      ascii '\"'
+      ascii ':'
+      enc
+  , encObjectEnd = ascii '}'
+  }
+  where
+    number :: Word64 -> Enc
+    number !n = Buffer.alloc 21 $ RTS.encodeNumber $ fromIntegral n
+      -- max length of 64 bit number is sign + 20 digits
+
+type ThriftType = Word8
+
+-- | Compute the Thrift type for a 'Type'
+-- See https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md#struct-encoding
+thriftType :: Type -> ThriftType
+thriftType ByteTy{} = 3
+thriftType NatTy{} = 6
+thriftType StringTy{} = 8
+thriftType (ArrayTy ByteTy{}) = 8
+thriftType ArrayTy{} = 9
+thriftType (SetTy ByteTy{}) = 8
+thriftType SetTy{} = 9
+thriftType RecordTy{} = 12
+thriftType SumTy{} = 12
+thriftType (NamedTy _ (ExpandedType _ ty)) = thriftType ty
+thriftType EnumeratedTy{} = 5 -- spec says enums are i32
+thriftType BooleanTy{} = 1
+thriftType PredicateTy{} = 12
+thriftType typ =
+  throw $ EncodingError $ "thrifTType: invalid type " ++ show typ
+
+
+compactEncoder :: Encoder
+compactEncoder = Encoder
+  { encByte = Buffer.byte
+  , encNat = Thrift.encodeZigZag . fromIntegral
+  , encBool = Buffer.byte . bool
+  , encMangledString = \ref n -> do
+      -- length
+      Thrift.encodeVarint (fromIntegral n)
+      -- bytes
+      Buffer.alloc (fromIntegral n) $ \p -> do
+        m <- unsafeIOToST (RTS.demangle ref p)
+        assert (m == fromIntegral n) $ return (fromIntegral n)
+  , encBinary = \(RTS.ByteStringRef s n) -> do
+      -- length
+      Thrift.encodeVarint (fromIntegral n)
+      -- bytes
+      Buffer.alloc (fromIntegral n) $ \p -> do
+        -- s might be NULL if the range is empty so check for that
+        when (n /= 0) $ unsafeIOToST $ copyBytes p s $ fromIntegral n
+        return (fromIntegral n)
+  , encArrayBegin = encArray
+  , encArraySep = return ()
+  , encArrayEnd = return ()
+  , encSetBegin = encArray
+  , encSetSep = return ()
+  , encSetEnd = return ()
+  , encObjectBegin = return ()
+  , encObjectSep = return ()
+  , encObjectField = \prev i _ typ d enc -> do
+      -- field types - different from array types
+      !ety <- case thriftType typ of
+        1 -> do
+          -- bool values folded into the header
+          sel <- liftST $ dSelector d
+          return $ bool $ sel /= 0
+        ety -> return ety
+      let delta = i - fromMaybe 0 prev
+      if delta /= 0 && delta <= 15
+        -- small field number deltas folded into the field header
+        then Buffer.byte $ ((fromIntegral delta .&. 0x0F) `shiftL` 4) .|. ety
+        else do
+          -- field number delta 0 indicates that the real field number follows
+          Buffer.byte ety
+          Thrift.encodeZigZag $ fromIntegral i
+      when (ety > 2) enc
+    -- object terminator
+  , encObjectEnd = Buffer.byte 0
+  }
+  where
+    bool True = 1
+    bool False = 2
+    encArray typ n = do
+      -- array types
+      let !ety = thriftType typ
+      if n < 15
+        -- small lengths are folded into the header byte
+        then Buffer.byte $ ((fromIntegral n .&. 0x0F) `shiftL` 4) .|. ety
+        else do
+          Buffer.byte $ 0xF0 .|. ety
+          Thrift.encodeVarint $ fromIntegral n
diff --git a/glean/db/Glean/Query/Opt.hs b/glean/db/Glean/Query/Opt.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Opt.hs
@@ -0,0 +1,753 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Opt
+  ( optimise
+  ) where
+
+import Control.Monad
+import Control.Monad.Except
+import Control.Monad.State.Strict
+import qualified Data.ByteString as B
+import Data.Foldable (toList)
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import qualified Data.IntSet as IntSet
+import Data.Text (Text)
+
+import qualified Glean.Angle.Types as Type
+import Glean.Angle.Types (FieldDef_(..))
+import Glean.Query.Flatten.Types
+import Glean.Query.Codegen.Types
+import Glean.Query.Vars
+import Glean.RTS.Term
+import Glean.RTS.Types
+
+{-
+Note [Query Simplification]
+
+This pass performs obvious optimisations on a query as follows:
+
+- Perform unification on all statements of the form P = Q
+- Apply the substitution resulting from unification
+
+So for example if we have
+
+  P = cxx1.Name S
+  S = "abc"
+
+Unification will produce the substitution [S->"abc"]; applying it will produce
+
+  P = cxx1.Name "abc"
+  "abc" = "abc"
+
+and finally in the Reorder pass we will identify the statement "abc" =
+"abc" as redundant and eliminate it.
+
+
+Optimising Derived Predicates
+-----------------------------
+
+This optimisation is particularly useful when expanding derived
+predicates. For example, given
+
+   predicate RevStringPair : { a : string, b : string }
+     { A, B } where StringPair { B, A }
+
+and a query
+
+   RevStringPair { _, "a" }
+
+after expansion we will have
+
+   X where StringPair { B, A }; X = { A, B }; X = { _, "a" }
+
+the StringPair query is not efficient here; we could do much better if
+we knew that B = "a".
+
+Unification will produce the substitution
+
+  [ X -> { A, B }, B -> "a" ]
+
+and after applying the substitution and simplification we will have
+
+   { A, "a" } where StringPair { "a", A }
+
+which is exactly what we wanted.
+
+
+Dealing with Choice
+-------------------
+
+Choice is the main source of complexity here.
+
+For example, suppose we have
+
+   Y where
+     cxx1.Name X;
+     Y = (1 where X = "a") | (2 where X = "b")
+
+Clearly there must be some "local" unification, because the
+substitution X = "a" only applies inside (1 where X = "a").  But just
+applying the local substitution [X->"a"] inside (1 where X = "a")
+can't be right, because we would get
+
+   Y = (1 where "a" = "a") | ...
+
+The problem is that we bound X during unification and then discarded
+that part of the substitution. We must never discard a substitution
+when it has not been applied to all instances of a variable - and yet
+we cannot let the substitition for X escape from the branch of this
+choice, because it isn't valid outside. This is a contradiction,
+so the solution is not to unify X in the first place. But how do we
+know we shouldn't unify X? Because it is visible *outside* the scope
+of the local substitution.
+
+So the rule for unificaiton of (A | B) is:
+
+- Unification is local to each branch. We have a substitution S
+  arising from the context and two separate substitutions Sa and Sb
+  arising from unification inside A and B respectively. The
+  subsititions we apply to A and B are S+Sa and S+Sb respectively.
+
+- We must *not* unify any variables that are visible outside. In other
+  words, Sa and Sb can only bind variables that are local to A and B
+  respectively.
+
+
+Algorithm
+---------
+
+Unification of a complete query proceeds as follows:
+
+0. Start with the empty substitution S = {}
+1. Unify everywhere except (A | B) subterms, extending S
+2. Apply S everywhere except (A | B) subterms
+3. For each (A | B) subterm, repeat from step 1 for A and B separately,
+   starting with current substitition S
+
+-}
+
+optimise :: FlattenedQuery -> Except Text FlattenedQuery
+optimise query@QueryWithInfo{..} = do
+  let
+    state = OptState
+      { optNextVar = qiNumVars
+      , optSubst = IntMap.empty
+      , optGenerators = IntMap.empty
+      , optCurrentScope = IntSet.empty
+      , optOuterScope = IntSet.empty
+      , optSeen = IntMap.empty
+      }
+  (optimised, state') <- flip runStateT state $
+    optimiseQuery =<< freshWildQuery qiQuery
+    -- unification relies on wildcards being replaced by variables
+    --  1. so that when we substitute an expression in multiple places
+    --     we can unify the wildcards across the different instantiations.
+    --  2. we want to elimiante duplicate "X = generator" statements
+    --     by unifying the generators and then spotting identical
+    --     statements. But those will only end up identical if we
+    --     replace the wildcards with variables before unifying and
+    --     substituting.
+    -- freshWildQuery also replaces MatchBind with MatchVar, so we don't
+    -- have spurious differences between terms that are really identical.
+  return query { qiQuery = optimised, qiNumVars = optNextVar state' }
+
+optimiseQuery :: FlatQuery -> U FlatQuery
+optimiseQuery query@(FlatQuery key maybeVal stmts) = do
+  -- determine variables visible outside of any nested choice:
+  modify $ \s -> s { optCurrentScope = queryScope query }
+  stmts' <- optStmts stmts
+  FlatQuery
+    <$> apply key
+    <*> mapM apply maybeVal
+    <*> pure stmts'
+
+-- | Apply the current substutition
+class Apply t where
+  apply :: t -> U t
+
+instance Apply Generator where
+  apply (FactGenerator pid key val range) =
+    FactGenerator pid <$> apply key <*> apply val <*> pure range
+  apply (TermGenerator x) = TermGenerator <$> apply x
+  apply (DerivedFactGenerator pid key val) =
+    DerivedFactGenerator pid <$> apply key <*> apply val
+  apply (ArrayElementGenerator ty arr) =
+    ArrayElementGenerator ty <$> apply arr
+  apply (SetElementGenerator ty arr) =
+    SetElementGenerator ty <$> apply arr
+  apply (PrimCall op args ty) =
+    PrimCall op <$> mapM apply args <*> pure ty
+
+{- Note [unification failure]
+
+Unification failure can easily arise as a result of choice. For
+example:
+
+(0|X = 0|"abc") | (0|X = 1|"def")
+
+The unification of (0|X) with (1|"def") fails, and we would like to
+exploit that to simplify the whole statement to
+
+(0|X) = (0|"abc")
+
+This works as follows:
+
+* unify returns a Bool to indicate whether unification succeeded
+
+* unifyStmt replaces a statement with falseStmt if unification of the
+  LHS and RHS fails
+
+* In a disjunctions, we filter out any alternatives that are
+  definitely empty, where empty is defined as "any statement is
+  obviously false".
+
+Note: we have to be careful about getting rid of statements entirely,
+even if a statement is provably false, because deleting a statement
+can leave unbound variables behind.  See optStmts and apply below.
+
+-}
+
+instance Apply FlatStatementGroup where
+  apply (FlatStatementGroup stmts) =
+    mkStatementGroup <$> mapM (mapM apply) stmts
+
+instance Apply FlatStatement where
+  apply (FlatStatement ty lhs rhs) = do
+    -- these were already unified by 'unify'
+    FlatStatement ty <$> apply lhs <*> apply rhs
+  apply (FlatAllStatement v e g) = do
+    t <- applyVar v
+    -- it must be a variable, because no other pattern matches a set.
+    v' <- case t of
+      Ref (MatchVar x) -> return x
+      Ref (MatchBind x) -> return x
+      _ -> error "apply: FlatAllStatement"
+    enclose (stmtGroupScope g . termScope e) $ do
+      g' <- optStmts g
+      FlatAllStatement v' <$> apply e <*> pure g'
+  apply (FlatNegation stmts) = do
+    -- assumptions arising inside the negation are not true outside of it.
+    stmts' <- optStmtsEnclosed stmts
+    return (FlatNegation  stmts')
+  apply (FlatDisjunction [stmts]) = do
+    stmts' <- apply stmts
+    return (grouping stmts')
+  apply (FlatDisjunction stmtss) = do
+    stmtss' <- mapM optStmtsEnclosed stmtss
+    -- we can remove alternatives that are known to be false, but if
+    -- ALL alternatives are false, then we must leave behind just one
+    -- alternative so that we don't leave unbound variables.
+    case filter (not . isFalseGroups) stmtss' of
+      [] -> case stmtss' of
+        [] -> return (FlatDisjunction [])
+        (ss : _) -> return (grouping ss)
+      some -> return (FlatDisjunction some)
+  apply (FlatConditional cond then_ else_) = do
+    -- like disjunctions, assumptions arising from the conditional statements
+    -- are not true outside of it. However, those arising from the condition
+    -- are true in the 'then' case.
+    (cond', then') <-
+      enclose (stmtGroupScope cond) $ do
+        cond' <- optStmts cond
+        then' <- optStmtsEnclosed then_
+        return (cond', then')
+    else' <- optStmtsEnclosed else_
+
+    return $ if isFalseGroups cond'
+      then grouping else'
+      else FlatConditional cond' then' else'
+
+optStmtsEnclosed :: FlatStatementGroup -> U FlatStatementGroup
+optStmtsEnclosed stmts = enclose (stmtGroupScope stmts) $ optStmts stmts
+
+-- If a sequence of statements is found to be false, then we place
+-- a falseStmt sentinel at the beginning. We don't actually remove
+-- any statements at this stage, because we have to be careful not to
+-- leave any variables unbound.
+optStmts :: FlatStatementGroup -> U FlatStatementGroup
+optStmts (FlatStatementGroup ord) = do
+  notFalse <- and <$> mapM unifyOrdStmt ord
+  ord' <- concatMap (mapM expandStmt) <$> mapM (mapM apply) ord
+  ord'' <- filterOrdStmts ord'
+  -- unify may fail, but apply may also leave behind a false statement:
+  if notFalse && not (any isFalseOrdStmt ord'')
+    then return (mkStatementGroup ord'')
+    else return (mkStatementGroup (Ordered falseStmt : ord'' ))
+
+-- Look for the sentinel left by optStmts
+isFalseGroups :: FlatStatementGroup -> Bool
+isFalseGroups (FlatStatementGroup (s : _)) = isFalseOrdStmt s
+isFalseGroups (FlatStatementGroup []) = False
+
+isFalseOrdStmt :: Ordered FlatStatement -> Bool
+isFalseOrdStmt = isFalseStmt . unOrdered
+
+isFalseStmt :: FlatStatement -> Bool
+isFalseStmt (FlatNegation (FlatStatementGroup [])) = True
+isFalseStmt (FlatDisjunction []) = True
+isFalseStmt (FlatDisjunction [FlatStatementGroup ord]) =
+  any isFalseOrdStmt ord
+isFalseStmt _ = False
+
+instance Apply Pat where
+  apply (Tuple xs) = Tuple <$> mapM apply xs
+  apply (Array xs) = Array <$> mapM apply xs
+  apply (Alt n x) = Alt n <$> apply x
+  apply (Ref (MatchVar v)) = applyVar v
+  apply (Ref (MatchBind v)) = applyVar v
+  apply (Ref (MatchAnd x y)) = do
+    x' <- apply x
+    y' <- apply y
+    return (Ref (MatchAnd x' y'))
+  apply (Ref (MatchPrefix str x)) = Ref . MatchPrefix str <$> apply x
+  apply (Ref (MatchArrayPrefix ty pre all)) =
+    Ref <$> (MatchArrayPrefix ty <$> mapM apply pre <*> apply all)
+  apply t@Byte{} = return t
+  apply t@ByteArray{} = return t
+  apply t@Nat{} = return t
+  apply t@String{} = return t
+  apply t@(Ref MatchExt{}) = return t
+  apply t@(Ref MatchFid{}) = return t
+  apply t@(Ref MatchNever{}) = return t
+  apply t@(Ref MatchWild{}) = return t
+
+applyVar :: Var -> U Pat
+applyVar var@(Var _ v _) = do
+  subst <- gets optSubst
+  case IntMap.lookup v subst of
+    Just pat -> apply pat
+      -- also apply the substitition to the result, because we don't
+      -- keep the substitution already in ground form. This is
+      -- potentially inefficient and there are better ways to do it
+      -- (typically with mutable variables), but it's probably not
+      -- important enough to fix yet.
+    _otherwise -> return (Ref (MatchVar var))
+
+-- | For running unification on one alternative of nested choice
+-- or a negated query.
+--
+-- Does not add substitutions or new variables to the parent scope.
+enclose :: (VarSet -> VarSet) -> U a -> U a
+enclose innerScope u = do
+  state0 <- get
+  -- set the outer scope to be the current scope
+  let scope = innerScope (optCurrentScope state0)
+  modify $ \s ->
+    s { optCurrentScope = scope, optOuterScope = optCurrentScope state0 }
+  a <- u
+  modify $ \s ->
+    s { optSubst = optSubst state0
+      , optGenerators = optGenerators state0
+      , optCurrentScope = optCurrentScope state0
+      , optOuterScope = optOuterScope state0
+      , optSeen = optSeen state0 }
+  return a
+
+unifyOrdStmt :: Ordered FlatStatement -> U Bool
+unifyOrdStmt = unifyStmt . unOrdered
+
+unifyStmt :: FlatStatement -> U Bool
+unifyStmt (FlatStatement _ lhs rhs)
+  | neverMatches lhs = return False
+  | TermGenerator rhs' <- rhs = unify lhs rhs'
+  | otherwise = do
+    r <- case isVar lhs of
+      Just v -> extend v rhs
+      Nothing -> return True
+    case rhs of
+      FactGenerator _ key val _ ->
+        return $ r && not (neverMatches key || neverMatches val)
+      _ -> return r
+unifyStmt FlatAllStatement{} = return True
+unifyStmt FlatNegation{} = return True
+  -- ignore negations for now. We will recurse into it later
+unifyStmt (FlatDisjunction [FlatStatementGroup ord]) = do
+  as <- mapM unifyOrdStmt ord
+  return $ and as
+  -- singleton FlatDisjunction is used for grouping, we must retain
+  -- it, but not treat it as a disjunction.
+unifyStmt FlatDisjunction{} = return True
+  -- ignore a disjunction for now. We will recurse into it in 'apply'
+unifyStmt FlatConditional{} = return True
+  -- ignore conditions for now. We will recurse into it in 'apply'
+
+neverMatches :: Pat -> Bool
+neverMatches = \case
+  Byte _ -> False
+  Nat _ -> False
+  Array terms -> any neverMatches terms
+  ByteArray _ -> False
+  String _ -> False
+  Tuple terms -> any neverMatches terms
+  Alt _ term -> neverMatches term
+  Ref match -> case match of
+    MatchWild _ -> False
+    MatchNever _ -> True
+    MatchFid _ -> False
+    MatchBind _ -> False
+    MatchVar _ -> False
+    MatchAnd left right -> neverMatches left || neverMatches right
+    MatchPrefix _ term -> neverMatches term
+    MatchArrayPrefix _ty pre all -> any neverMatches pre || neverMatches all
+    MatchExt () -> False
+
+unifyGen :: Generator -> Generator -> U Bool
+unifyGen (TermGenerator a) (TermGenerator b) = a `unify` b
+unifyGen (FactGenerator _ k1 v1 _) (FactGenerator _ k2 v2 _) =
+  (&&) <$> unify k1 k2 <*> unify v1 v2
+unifyGen (DerivedFactGenerator _ k1 v1) (DerivedFactGenerator _ k2 v2) =
+  (&&) <$> unify k1 k2 <*> unify v1 v2
+unifyGen _ _ = return True
+
+-- | Unify two patterns, extending the substitution. Note that this is
+-- not complete unification: we aren't guaranteeing to produce a
+-- unifier. We might refrain from unifying in some cases (see the
+-- comment about or-patterns at the top of the module).
+unify :: Pat -> Pat -> U Bool
+unify (Byte x) (Byte y) = return (x == y)
+unify (Nat x) (Nat y) = return (x == y)
+unify (ByteArray x) (ByteArray y) = return (x == y)
+unify (String x) (String y) = return (x == y)
+unify (Ref (MatchFid x)) (Ref (MatchFid y)) = return (x == y)
+unify (Ref MatchWild{}) _ = return True
+unify _ (Ref MatchWild{}) = return True
+unify (Ref MatchNever{}) _ = return False
+unify _ (Ref MatchNever{}) = return False
+unify (Ref (MatchVar v)) pat = extend v (TermGenerator pat)
+unify pat (Ref (MatchVar v)) = extend v (TermGenerator pat)
+unify (Ref (MatchBind v)) pat = extend v (TermGenerator pat)
+unify pat (Ref (MatchBind v)) = extend v (TermGenerator pat)
+unify (Tuple xs) (Tuple ys) = and <$> zipWithM unify xs ys
+unify (Array xs) (Array ys)
+  | length xs == length ys = and <$> zipWithM unify xs ys
+  | otherwise = return False
+unify (Alt n x) (Alt m y)
+  | n == m = unify x y
+  | otherwise = return False
+unify (Ref (MatchPrefix s x)) (Ref (MatchPrefix t y))
+  | s == t = unify x y
+  | otherwise = return True -- might still match
+unify (Ref (MatchPrefix s x)) (String y)
+  | Just r <- B.stripPrefix s y = unify x (String r)
+unify (String x) (Ref (MatchPrefix s y))
+  | Just r <- B.stripPrefix s x = unify y (String r)
+unify (Ref (MatchAnd x y)) z = (&&) <$> unify x z <*> unify y z
+unify z (Ref (MatchAnd x y)) = (&&) <$> unify z x <*> unify z y
+unify (Ref (MatchArrayPrefix _ pre all)) (Ref (MatchArrayPrefix _ pre' all')) = do
+  b <- unify all all'
+  bs <- zipWithM unify pre pre'
+  return (and (b:bs))
+unify (Ref (MatchArrayPrefix _ pre all)) (Array xs)
+  | length pre <= length xs = do
+    b <- unify all (Array xs)
+    bs <- zipWithM unify pre xs
+    return (and (b:bs))
+unify a@Array{} b@(Ref (MatchArrayPrefix{})) = unify b a
+unify _ _ = return False
+
+extend :: Var -> Generator -> U Bool
+-- These two generators don't tell us anything:
+extend _ ArrayElementGenerator{} = return True
+extend _ SetElementGenerator{} = return True
+extend _ PrimCall{} = return True
+-- TermGenerators get added to the substitution:
+extend var (TermGenerator t) = do
+  state <- get
+  t <- apply t  -- ensure we don't create a recursive substitution
+  let
+    bind v gen = do
+      modify $ \s -> s { optSubst = IntMap.insert (varId v) gen (optSubst s) }
+      return True
+
+    hasSubstitution v = IntMap.lookup (varId v) (optSubst state)
+    comesFromOuterScope v = IntSet.member (varId v) (optOuterScope state)
+
+    -- refuse to bind a variable if it is visible in the outer scope
+    -- (see comment at the top of this module). If this happens, we
+    -- try the unification the other way around instead.
+    check v t _ | Just v' <- isVar t, v == v' = return True
+    check v t orElse
+      | Just t' <- hasSubstitution v = unify t t'
+      | comesFromOuterScope v = orElse
+      | otherwise = bind v t
+
+  check var t $
+    case isVar t of
+      Just y -> check y (Ref (MatchVar var)) (return True)
+      _ -> extendGen var (TermGenerator t)
+-- Other kinds of generators: remember them in optGenerators
+extend var gen = extendGen var gen
+
+extendGen :: Var -> Generator -> U Bool
+extendGen var gen = do
+  state <- get
+  gen <- apply gen
+  pat <- applyVar var
+  case isVar pat of
+    Nothing ->
+      -- it can be a fact ID. What should we do in that case? (TODO)
+      return True
+    Just var' ->
+      case IntMap.lookup (varId var') (optGenerators state) of
+        Just gen' -> unifyGen gen gen'
+        Nothing -> do
+          modify $ \s -> s { optGenerators =
+            IntMap.insert (varId var') gen (optGenerators s) }
+          return True
+
+data OptState = OptState
+  { optNextVar :: !Int
+    -- ^ for making fresh variables
+  , optSubst :: Subst
+    -- ^ current substitution
+  , optGenerators :: IntMap Generator
+    -- ^ knowledge about which variables are bound by generators. Only
+    -- contains FactGenerators and DerivedFactGenerators currently.
+  , optCurrentScope :: VarSet
+    -- ^ all variables visible in the current scope, excluding nested
+    -- (A | B) subterms
+  , optOuterScope :: VarSet
+    -- ^ all variables visible in the enclosing scope, when we are
+    -- unifying inside a nested (A | B) subterm.  These are the
+    -- variables we must not unify (see comment at the top of the
+    -- module).
+  , optSeen :: IntMap Generator
+    -- ^ statements we have seen before. See Note [identical statements]
+  }
+
+instance Monad m => Fresh (StateT OptState m) where
+  peek = gets optNextVar
+  alloc = do
+    state@OptState{..} <- get
+    put state{ optNextVar = optNextVar + 1 }
+    return optNextVar
+
+type U a = StateT OptState (Except Text) a
+
+type Subst = IntMap Pat
+
+-- | Traverse the query, excluding nested (A | B), !A, and "if" subterms,
+-- collecting the visible variables.  These are the variables that we must
+-- not unify *inside* an (A | B), !A, or "if" subterm, because they are
+-- visible outside it. Variables that are local to one of these subterms
+-- may be safely unified.
+queryScope :: FlatQuery -> VarSet
+queryScope (FlatQuery key maybeVal (FlatStatementGroup ord)) =
+  foldr termScope (foldr ordStmtScope s ord) maybeVal
+  where
+    s = termScope key IntSet.empty
+
+stmtGroupScope :: FlatStatementGroup -> VarSet -> VarSet
+stmtGroupScope (FlatStatementGroup g) r = foldr ordStmtScope r g
+
+ordStmtScope :: Ordered FlatStatement -> VarSet -> VarSet
+ordStmtScope = stmtScope . unOrdered
+
+stmtScope :: FlatStatement -> VarSet -> VarSet
+stmtScope (FlatStatement _ lhs rhs) r = termScope lhs (genScope rhs r)
+stmtScope (FlatAllStatement v _ (FlatStatementGroup _)) r =
+  addToCurrentScope v $! r
+stmtScope (FlatNegation _) r = r
+stmtScope (FlatDisjunction [FlatStatementGroup ord]) r =
+  foldr ordStmtScope r ord
+stmtScope FlatDisjunction{} r = r
+  -- contents of or-patterns are not part of the "current scope"
+stmtScope FlatConditional{} r = r
+  -- contents of if-patterns are not part of the "current scope"
+
+genScope :: Generator -> VarSet -> VarSet
+genScope (FactGenerator _ key val _) r = termScope key $! termScope val r
+genScope (TermGenerator pat) r = termScope pat r
+genScope (DerivedFactGenerator _ key val) r = termScope key $! termScope val r
+genScope (ArrayElementGenerator _ exp) r = termScope exp r
+genScope (SetElementGenerator _ exp) r = termScope exp r
+genScope (PrimCall _ args _) r = foldr termScope r args
+
+addToCurrentScope :: Var -> VarSet -> VarSet
+addToCurrentScope (Var _ v _) r = IntSet.insert v r
+
+termScope :: Pat -> VarSet -> VarSet
+termScope pat r = foldr onMatch r pat
+  where
+  onMatch :: Match () Var -> VarSet -> VarSet
+  onMatch m r = case m of
+    MatchPrefix _ rest -> foldr onMatch r rest
+    MatchBind v -> addToCurrentScope v r
+    MatchVar v -> addToCurrentScope v r
+    MatchAnd x y -> foldr onMatch (foldr onMatch r y) x
+    MatchArrayPrefix _ty pre all ->
+      foldr onMatch (foldr onMatch r all) (foldMap toList pre)
+    MatchNever{} -> r
+    MatchWild{} -> r
+    MatchExt{} -> r
+    MatchFid{} -> r
+
+
+-- | For T = U statements, decompose the statement as far as possible.
+-- For example
+--
+-- >    {A,B} = {C,D}
+--
+-- decomposes into
+--
+-- >     A = C
+-- >     B = D
+--
+-- and eliminate any statements that are obviously redundant. That is,
+-- when the lhs obviously matches the rhs, and the statement binds no
+-- variables.
+--
+expandGroup :: FlatStatementGroup -> FlatStatementGroup
+expandGroup (FlatStatementGroup ord) =
+  mkStatementGroup (concatMap (mapM expandStmt) ord)
+
+expandStmt :: FlatStatement -> [FlatStatement]
+expandStmt (FlatStatement stmtTy lhs (TermGenerator rhs)) =
+  [ FlatStatement ty a (TermGenerator b)
+  | (ty,a,b) <- expand stmtTy lhs rhs ]
+  where
+  expand :: Type -> Pat -> Pat -> [(Type,Pat,Pat)]
+  expand ty a b = case (a,b) of
+    (_, Ref MatchWild{}) -> []
+    (Ref MatchWild{}, _) -> []
+    (_, Ref MatchNever{}) -> []
+    (Ref MatchNever{}, _) -> []
+    (Byte a, Byte b) | a == b -> []
+    (Nat a, Nat b) | a == b -> []
+    (String a, String b) | a == b -> []
+    (Array ts, Array us)
+      | Type.ArrayTy eltTy <- derefType ty
+      , length ts == length us -> concat (zipWith (expand eltTy) ts us)
+    (ByteArray b, ByteArray c) | b == c -> []
+    (Tuple ts, Tuple us)
+      | Type.RecordTy fields <- derefType ty ->
+        concat (zipWith3 expand (map fieldDefType fields) ts us)
+    (Alt n x, Alt m y)
+      | n == m, Just fields <- sumLike (derefType ty) ->
+        expand (fieldDefType (fields !! fromIntegral n)) x y
+    (Ref x, Ref y)
+      | Just x' <- matchVar x, Just y' <- matchVar y, x' == y' -> []
+    (Ref (MatchAnd a b), x) -> expand ty a x ++ expand ty b x
+    (x, Ref (MatchAnd a b)) -> expand ty x a ++ expand ty x b
+    (Ref (MatchPrefix s a), String b)
+      | Just r <- B.stripPrefix s b -> expand ty a (String r)
+    (String a, Ref (MatchPrefix s b))
+      | Just r <- B.stripPrefix s a -> expand ty (String r) b
+    (Ref (MatchPrefix s a), Ref (MatchPrefix t b))
+      | t == s -> expand ty a b
+    (Ref (MatchFid x), Ref (MatchFid y)) | x == y -> []
+    (Ref (MatchArrayPrefix eltTy0 ts all), Array us)
+      | length ts <= length us
+      , eltTy <- derefType eltTy0
+      -> concat (expand ty all (Array us) : zipWith (expand eltTy) ts us)
+    (Ref (MatchArrayPrefix eltTy0 ts all), Ref (MatchArrayPrefix _ty us all'))
+      | eltTy <- derefType eltTy0
+      , length ts == length us
+      -> concat (expand ty all all' : zipWith (expand eltTy) ts us)
+    _ -> [(ty,a,b)]
+expandStmt s@(FlatNegation _) = [s]
+  -- the expansion is handled by @apply@ with @optStmts@ because we need to
+  -- constrain the scope of the substitutions arising from inside the negation.
+expandStmt (FlatDisjunction [stmts]) =
+  case expandGroup stmts of
+    FlatStatementGroup [] -> []
+    xs -> [grouping xs]
+  -- non-singleton disjunctions are handled by apply, which will
+  -- expand the stmts via optStmts.
+expandStmt s = [s]
+
+-- -----------------------------------------------------------------------------
+-- Eliminating duplicate statements
+
+{-
+Note [identical statements]
+
+We want to combine multiple generators like
+
+  X = pred { _, A }
+  X = pred { B, "x" }
+
+this works as follows: first we replace all the wildcards with fresh variables
+
+  X = pred { _1, A }
+  X = pred { B, "x" }
+
+Next, when unifying we insert the first statement into the substitution
+
+  { X := pred { _1, A } }
+
+when we see the second statement, we unify its generator with the
+first one (see 'extend'), giving
+
+  { _1 := B, A := "x", X := pred { _1, A } }
+
+in 'apply', we apply the substitution to each statement:
+
+  X = pred { B, "x" }
+  X = pred { B, "x" }
+
+next, we just elimiante literally identical statements, being careful
+that we don't propagate assumptions from disjunctions/negation to the
+outside scope, as with unification.
+
+Note that even after unification and substitution we might still have
+different generators for a given variable, when some of them occur
+inside disjunctions or negation.
+-}
+
+notDuplicateStmt :: FlatStatement -> U Bool
+notDuplicateStmt (FlatStatement _ lhs rhs)
+  | Ref (MatchVar v) <- lhs = dup v rhs
+  | Ref (MatchBind v) <- lhs = dup v rhs
+  where
+  dup (Var _ v _ ) rhs = do
+    history <- gets optSeen
+    case IntMap.lookup v history of
+      Just gen -> return (gen /= rhs)
+      Nothing -> do
+        modify $ \s -> s { optSeen = IntMap.insert v rhs history }
+        return True
+notDuplicateStmt _other = return True
+
+encloseSeen :: U a -> U a
+encloseSeen inner = do
+  state <- get
+  a <- inner
+  modify $ \s -> s { optSeen = optSeen state }
+  return a
+
+filterStmt :: FlatStatement -> U FlatStatement
+filterStmt stmt = case stmt of
+  FlatStatement{} -> return stmt
+  FlatAllStatement v e stmts ->
+    FlatAllStatement v e <$> filterGroupEnclosed stmts
+  FlatNegation stmts -> FlatNegation <$> filterGroupEnclosed stmts
+  FlatDisjunction [stmts] -> grouping <$> filterGroup stmts
+  FlatDisjunction stmtss ->
+    FlatDisjunction <$> mapM filterGroupEnclosed stmtss
+  FlatConditional cond then_ else_ -> do
+    (cond', then') <- encloseSeen $ do
+      cond' <- filterGroup cond
+      then' <- filterGroupEnclosed then_
+      return (cond', then')
+    else' <- filterGroupEnclosed else_
+    return (FlatConditional cond' then' else')
+
+filterGroup :: FlatStatementGroup -> U FlatStatementGroup
+filterGroup (FlatStatementGroup ord) =
+  mkStatementGroup <$> filterOrdStmts ord
+
+filterOrdStmts :: [Ordered FlatStatement] -> U [Ordered FlatStatement]
+filterOrdStmts stmts = do
+  filtered <- filterM (notDuplicateStmt . unOrdered) stmts
+  mapM (mapM filterStmt) filtered
+
+filterGroupEnclosed :: FlatStatementGroup -> U FlatStatementGroup
+filterGroupEnclosed = encloseSeen . filterGroup
diff --git a/glean/db/Glean/Query/Prune.hs b/glean/db/Glean/Query/Prune.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Prune.hs
@@ -0,0 +1,270 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Prune (pruneDerivations) where
+
+import Control.Monad
+import Control.Monad.State (State, runState)
+import qualified Control.Monad.State as State
+import Data.Bitraversable (bitraverse)
+import Data.Foldable (asum)
+import Data.Maybe (fromMaybe)
+import qualified Data.Set as Set
+import qualified Data.Graph as Graph
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.IntMap.Strict as IntMap
+import Data.IntMap.Strict (IntMap)
+
+import Glean.Database.Schema.Types (PredicateDetails(..))
+import Glean.RTS.Types (PidRef(..), Type)
+import Glean.Angle.Types (PredicateId(..), DerivingInfo(..))
+import qualified Glean.Angle.Types as Angle
+import Glean.Query.Codegen.Types
+import Glean.Query.Typecheck (tcQueryDeps)
+import Glean.Query.Typecheck.Types
+  (TcPat, TcTerm(..), TcStatement(..), TcQuery(..), TypecheckedQuery)
+import Glean.RTS.Term (Term(..))
+
+-- | Remove all branches that we know will not succeed given the content of the
+-- database.
+pruneDerivations
+  :: (PredicateId -> Bool)
+  -> HashMap PredicateId PredicateDetails
+  -> HashMap PredicateId PredicateDetails
+pruneDerivations hasStoredFacts details =
+  updateDerivation <$> details
+  where
+    updateDerivation details = fromMaybe details $ do
+      Derive when _ <- return $ predicateDeriving details
+      let newDerivation =
+            case HashMap.lookup (predicateId details) pruned of
+              Nothing -> NoDeriving
+              Just query -> Derive when query
+      return $ details { predicateDeriving = newDerivation }
+
+    pruned :: HashMap PredicateId TypecheckedQuery
+    pruned = pruneQueries hasStoredFacts derivations
+
+    derivations :: HashMap PredicateId TypecheckedQuery
+    derivations = flip HashMap.mapMaybe details $ \PredicateDetails{..} ->
+      case predicateDeriving of
+        NoDeriving -> Nothing
+        Derive _ query -> Just query
+
+pruneQueries
+  :: (PredicateId -> Bool)
+  -> HashMap PredicateId TypecheckedQuery
+  -> HashMap PredicateId TypecheckedQuery
+pruneQueries hasStoredFacts derivations =
+  foldr add mempty $ topologicalSort derivations
+  where
+    add :: (PredicateId, TypecheckedQuery)
+        -> HashMap PredicateId TypecheckedQuery
+        -> HashMap PredicateId TypecheckedQuery
+    add (predId, query) derivedWithFacts =
+       case prune (hasFacts predId derivedWithFacts) query of
+          Nothing -> derivedWithFacts
+          Just pruned -> HashMap.insert predId pruned derivedWithFacts
+
+    hasFacts predId derivedWithFacts child =
+      child == predId
+        || hasStoredFacts child
+        || child `HashMap.member` derivedWithFacts
+
+topologicalSort
+  :: HashMap PredicateId TypecheckedQuery
+  -> [(PredicateId, TypecheckedQuery)]
+topologicalSort derivations =
+  [ entry
+  | vertex <- Graph.topSort graph
+  , let (entry,_,_) = fromVertex vertex
+  ]
+  where
+    (graph, fromVertex, _) = Graph.graphFromEdges edges
+    edges =
+      [ (entry, predId, dependencies)
+      | entry@(predId, query) <- HashMap.toList derivations
+      , let dependencies = Set.toList $ tcQueryDeps $ qiQuery query
+      ]
+
+-- | Remove paths that we know will not yield any result.
+-- This will save us a lot of compilation at query time.
+--
+-- We can determine that a path is doomed to fail if it has a FactGenerator
+-- that will search on a predicate with no facts.
+--
+-- Pruning won't leave us with unbound variables because:
+-- - If a statement in a sequence is set to fail, the entire sequence is removed
+-- - If one sequence is removed from a disjunction, all variables bound by it
+--   should also be bound by the other disjunction alternatives
+prune :: (PredicateId -> Bool) -> TypecheckedQuery -> Maybe TypecheckedQuery
+prune hasFacts (QueryWithInfo q _ gen t) = do
+  renumberVars gen t <$> pruneTcQuery q
+  where
+  pruneTcQuery :: TcQuery -> Maybe TcQuery
+  pruneTcQuery (TcQuery ty keyPat mvalPat stmts ord) =
+    TcQuery ty
+      <$> prunePat keyPat
+      <*> case mvalPat of
+            Nothing -> Just Nothing
+            Just v -> Just <$> prunePat v
+      <*> pruneSequence stmts
+      <*> pure ord
+
+  pruneSequence :: [TcStatement] -> Maybe [TcStatement]
+  pruneSequence = traverse pruneStmt
+
+  pruneStmt :: TcStatement -> Maybe TcStatement
+  pruneStmt (TcStatement ty lhs rhs) =
+    TcStatement ty <$> prunePat lhs <*> prunePat rhs
+
+  prunePat :: TcPat -> Maybe TcPat
+  prunePat pat = case pat of
+    Byte{} -> Just pat
+    Nat{} -> Just pat
+    ByteArray{} -> Just pat
+    String{} -> Just pat
+    Array xs -> Array <$> traverse prunePat xs
+    Tuple xs -> Tuple <$> traverse prunePat xs
+    Alt i x -> Alt i <$> prunePat x
+    Ref m -> case m of
+      MatchWild{} -> Just pat
+      MatchNever{} -> Nothing
+      MatchFid{} -> Just pat
+      MatchBind{} -> Just pat
+      MatchVar{} -> Just pat
+      MatchAnd a b -> Ref <$> (MatchAnd <$> prunePat a <*> prunePat b)
+      MatchPrefix s x -> Ref . MatchPrefix s <$> prunePat x
+      MatchArrayPrefix t xs all ->
+        Ref <$> (MatchArrayPrefix t <$> traverse prunePat xs <*> prunePat all)
+      MatchExt (Typed ty tcterm) -> case tcterm of
+        TcFactGen (PidRef _ predId) _ _ _
+          | not $ hasFacts predId
+          -> Nothing
+        TcFactGen pidref k v range -> Ref . MatchExt . Typed ty
+          <$> (TcFactGen pidref <$> prunePat k <*> prunePat v <*> pure range)
+        TcElementsOfArray x -> Ref . MatchExt . Typed ty . TcElementsOfArray
+          <$> prunePat x
+        TcElementsOfSet x ->
+          Ref . MatchExt . Typed ty . TcElementsOfSet <$> prunePat x
+        TcElementsUnresolved ty' x ->
+          Ref . MatchExt . Typed ty . TcElementsUnresolved ty' <$> prunePat x
+        TcQueryGen q ->
+          Ref . MatchExt . Typed ty . TcQueryGen <$> pruneTcQuery q
+        -- we dont' want to handle negation here because if it tries to match
+        -- against things that are not in the database it should succeed.
+        TcAll query ->
+          Ref . MatchExt . Typed ty . TcAll <$> pruneTcQuery query
+        TcNegation{} -> Just pat
+        TcPrimCall op xs -> Ref . MatchExt . Typed ty . TcPrimCall op
+          <$> traverse prunePat xs
+        TcIf (Typed t' c) t e ->
+          let cond = prunePat c
+              condt = Typed t' <$> cond
+              then_ = prunePat t
+              else_ = prunePat e
+          in
+          asum
+            [ Ref . MatchExt . Typed ty <$> (TcIf <$> condt <*> then_ <*> else_)
+            , Ref <$> (MatchAnd <$> cond <*> then_)
+            , else_ :: Maybe TcPat
+            ]
+        TcOr a b ->
+          let pa = prunePat a
+              pb = prunePat b
+          in
+          asum
+            [ Ref . MatchExt . Typed ty <$> (TcOr <$> pa <*> pb)
+            , pa
+            , pb
+            ]
+        TcDeref ty' p
+          | Angle.PredicateTy _ (PidRef _ predId) <-
+            ty', not $ hasFacts predId -> Nothing
+          | otherwise ->
+            Ref . MatchExt . Typed ty . TcDeref ty' <$> prunePat p
+        TcFieldSelect (Typed ty' p) f -> do
+          p' <- prunePat p
+          return $ Ref $ MatchExt $ Typed ty $ TcFieldSelect (Typed ty' p') f
+        TcAltSelect (Typed ty' p) f -> do
+          p' <- prunePat p
+          return $ Ref $ MatchExt $ Typed ty $ TcAltSelect (Typed ty' p') f
+        TcPromote _ p -> prunePat p
+        TcDemote _ p -> prunePat p
+        TcStructPat{} -> error "prune: TcStructPat"
+
+type R a = State S a
+
+data S = S
+  { nextVar :: Int
+  , mappings :: IntMap Int
+  }
+
+-- | After removing branches from the query we must now update
+-- variable names to ensure we use the smallest numbers possible.
+renumberVars :: Maybe Generator -> Type -> TcQuery -> TypecheckedQuery
+renumberVars gen ty q =
+  let (newQuery, S varCount _) = runState (renameQuery q) (S 0 mempty)
+  in
+  QueryWithInfo newQuery varCount gen ty
+  where
+  renameQuery :: TcQuery -> R TcQuery
+  renameQuery (TcQuery ty key mval stmts ord) =
+    TcQuery ty
+      <$> renamePat key
+      <*> traverse renamePat mval
+      <*> traverse renameStmt stmts
+      <*> pure ord
+
+  renameStmt :: TcStatement -> R TcStatement
+  renameStmt (TcStatement ty lhs rhs) =
+    TcStatement ty <$> renamePat lhs <*> renamePat rhs
+
+  renamePat :: TcPat -> R TcPat
+  renamePat = traverse (bitraverse renameTyped renameVar)
+
+  renameTyped :: Typed TcTerm -> R (Typed TcTerm)
+  renameTyped (Typed ty term) = Typed ty <$> renameTcTerm term
+
+  renameTcTerm :: TcTerm -> R TcTerm
+  renameTcTerm = \case
+    TcOr a b -> TcOr <$> renamePat a <*> renamePat b
+    TcFactGen ref k v range ->
+      TcFactGen ref <$> renamePat k <*> renamePat v <*> pure range
+    TcElementsOfArray x -> TcElementsOfArray <$> renamePat x
+    TcElementsOfSet x -> TcElementsOfSet <$> renamePat x
+    TcElementsUnresolved ty x -> TcElementsUnresolved ty <$> renamePat x
+    TcQueryGen q -> TcQueryGen <$> renameQuery q
+    TcAll query -> TcAll <$> renameQuery query
+    TcNegation xs -> TcNegation <$> traverse renameStmt xs
+    TcPrimCall op xs -> TcPrimCall op <$> traverse renamePat xs
+    TcIf cond then_ else_ ->
+      TcIf <$> traverse renamePat cond <*> renamePat then_ <*> renamePat else_
+    TcDeref ty p -> TcDeref ty <$> renamePat p
+    TcFieldSelect (Typed ty p) f -> do
+      p' <- renamePat p
+      return $ TcFieldSelect (Typed ty p') f
+    TcAltSelect (Typed ty p) f -> do
+      p' <- renamePat p
+      return $ TcAltSelect (Typed ty p') f
+    TcPromote ty p -> TcPromote ty <$> renamePat p
+    TcDemote ty p -> TcDemote ty <$> renamePat p
+    TcStructPat fs -> fmap TcStructPat $ forM fs $ \(n,p) ->
+      (n,) <$> renamePat p
+
+  renameVar :: Var -> R Var
+  renameVar (Var ty old n) = State.state $ \s ->
+    case IntMap.lookup old (mappings s) of
+      Just new -> (Var ty new n, s)
+      Nothing ->
+        let new = nextVar s
+            mappings' = IntMap.insert old new (mappings s)
+            next' = new + 1
+        in
+        (Var ty new n, S next' mappings')
diff --git a/glean/db/Glean/Query/Reorder.hs b/glean/db/Glean/Query/Reorder.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Reorder.hs
@@ -0,0 +1,1037 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DerivingStrategies #-}
+
+module Glean.Query.Reorder
+  ( reorder
+  ) where
+
+import Control.Applicative ((<|>))
+import Control.Monad
+import Control.Monad.Except
+import Control.Monad.State.Strict
+import Data.Foldable (find, toList)
+import Data.Functor.Identity (Identity(..))
+import qualified Data.ByteString as ByteString
+import Data.Either (partitionEithers)
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import qualified Data.IntSet as IntSet
+import Data.List (uncons, partition)
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Compat.Prettyprinter hiding ((<>))
+
+import Glean.Query.BindOrder
+import Glean.Query.Codegen.Types
+import Glean.Display
+import Glean.Query.Flatten.Types
+import Glean.Query.Vars
+import Glean.RTS.Term as RTS
+import Glean.RTS.Types as RTS
+import qualified Glean.Database.Schema.Types as Schema
+
+{-
+Reordering pass
+---------------
+
+INPUT
+
+A FlattenedQuery, in which the statements are grouped:
+
+  P where group; ...; group
+
+a group is a set of statements that may be reordered:
+
+  group ::= [ stmt, ..., stmt ]
+
+and a stmt is
+
+  stmt ::= P = generator
+        |  !( group; ..; group )
+        |  ( ( group; ..; group ) | ... | (group; ..; group) )
+
+generator has the form
+  - a term
+  - a fact generator
+  - an array generator
+  - a call to a primitive
+
+Patterns contain no nested generators at this point, everything has
+been lifted to statements by the flattening pass.
+
+
+OUTPUT
+
+The same, except that the groups have been flattened and we just have
+sequences of statements.
+
+In addition, the output has valid binding. Namely:
+
+  - MatchBind will occur before MatchVar for a given variable, where "before"
+    means "left-to-right top-to-bottom".
+
+  - There are no MatchBind or MatchWild in an expression context. These are:
+    - patterns on the rhs of a statement
+    - the head of the query
+    - the array of an array generator
+    - arguments to a primitive call
+
+
+HOW?
+
+First (reorderStmtGroup): we order the stmts within each group. This
+ordering phase is concerned with *efficiency*: we pick the best
+ordering based on heuristics about which ordering will run the
+fastest. Then, the groups are concatenated into a list.
+
+Second (reorderStmts): attempt to order the statements in this list so
+that variables are bound before they are used. Here we're potentially
+changing the order of the statements that the user wrote (as opposed
+to reorderStmtGroup above, which is picking an order where the user
+didn't specify one, e.g. for nested generators). So we only reorder
+statements when (a) we can be sure that performance will be better or
+(b) there are unbound variables that force a reordering.
+
+This phase might fail if we can't find a way to sequence the
+statements. For example, there's no way to make
+
+   _ = _
+
+valid (although we should have eliminated this via unification
+earlier) .  Similarly, there's no way to make
+
+   X = Y
+
+valid if neither X nor Y is bound by anything. However, if X or Y can
+be bound by a later statement, then it might be possible to reorder
+statements to make this valid.
+
+In general, finding an ordering for the statements could involve
+trying all the possibilities, including trying all the possibilities
+for nested statement sequences, and so on. Since this is exponential
+in complexity, we try to do something more efficient:
+
+1. Try to find a statement that is a filter (an O(1) statement) with
+all its variables bound. We'll do this next, because it's cheap.
+
+2. Try to find the first statement in the list that is definitely
+resolved using a cheap test.
+
+3. Otherwise, just try to resolve the next statement. If this fails,
+put the statement to the back of the queue and try the next one. If we
+get all the way through the list, give up.
+
+-}
+
+
+reorder :: Schema.DbSchema -> FlattenedQuery -> Except Text CodegenQuery
+reorder dbSchema QueryWithInfo{..} =
+  withExcept (\(e, _) -> Text.pack $ show $
+    vcat [pretty e, nest 2 $ vcat [ "in:", displayDefault qiQuery]]) qi
+  where
+    qi = do
+      ((q,gen), ReorderState{..}) <-
+        flip runStateT (initialReorderState qiNumVars dbSchema) $ do
+          go qiQuery
+      return (QueryWithInfo q roNextVar gen qiReturnType)
+
+    -- 1. replace all wildcards with fresh variables
+    -- 2. reorder the statements
+    -- 3. replace any unused variables with wildcards, and
+    --    renumber variables (this leads to more efficient/smaller code)
+    go query0 = do
+      query <- reorderQuery query0
+      let used = varsUsed query <> foldMap vars qiGenerator
+          varMap = IntMap.fromList (zip (IntSet.toList used) [0..])
+      modify $ \s -> s { roNextVar = IntSet.size used }
+      return (reWildQuery varMap query, reWildGenerator varMap <$> qiGenerator)
+
+reorderQuery :: FlatQuery -> R CgQuery
+reorderQuery (FlatQuery pat _ stmts) =
+  withScopeFor (vars pat <> scopeVars stmts) $ do
+    stmts' <- reorderGroup stmts
+    (extra, pat') <- resolved `catchError` \e ->
+      maybeBindUnboundPredicate e resolved
+    return (CgQuery pat' (extra <> stmts'))
+  where
+    resolved = do pat' <- fixVars IsExpr pat; return ([], pat')
+
+
+reorderGroup :: FlatStatementGroup -> R [CgStatement]
+reorderGroup g = do
+  scope <- gets roScope
+  let
+    bound0 = IntMap.keysSet (allBound scope)
+
+    -- we'll call reorderStmtGroup on the (unordered) group before
+    -- reordering any nested groups. There's a chicken/egg problem here:
+    --   - if we reorder the outer group first then we don't have an
+    --     accurate idea of the cost of the inner groups
+    --   - if we reorder the inner group first then we don't have an
+    --     accurate idea of the bound variables
+    -- but overall it seems like doing the outer group first gives
+    -- better results. Perhaps a multi-pass approach would be even better.
+    group bound (FlatStatementGroup ord) = do
+      let reordered = reorderStmtGroup (isScope scope) bound ord
+      (stmts,bound') <- go bound reordered
+      return (FlatStatementGroup stmts, bound')
+
+    go bound [] = return ([], bound)
+    go bound (ord : rest) = do
+      case ord of
+        Ordered s -> inner Ordered s
+        Floating s -> inner Floating s
+      where
+      inner f (FlatDisjunction [g]) = do
+        (g', bound') <- group bound g
+        (stmts'',bound'') <- go bound' rest
+        return (f (FlatDisjunction [g']) : stmts'', bound'')
+      inner f stmt = do
+        (stmts', bound') <- go (IntSet.union (boundVars stmt) bound) rest
+        return (f stmt : stmts', bound')
+
+    squash [] = []
+    squash (stmt : rest) = case stmt of
+      Ordered s -> go s
+      Floating s -> go s
+      where
+      go (FlatDisjunction [FlatStatementGroup stmts]) =
+        squash (stmts <> rest)
+      go stmt = stmt : squash rest
+
+  (FlatStatementGroup stmts, _) <- group bound0 g
+  reorderStmts (squash stmts)
+
+-- | Define a new scope.
+-- Adds all variables local to the statements to the scope at the start and
+-- remove them from the scope in the end.
+withScopeFor :: VarSet -> R a -> R a
+withScopeFor stmtsVars act = do
+  Scope outerScope bound <- gets roScope
+  let locals = IntSet.filter (`IntSet.notMember` outerScope) stmtsVars
+
+  modify $ \s -> s { roScope = Scope (outerScope <> locals) bound }
+  res <- act
+  modify $ \s -> s { roScope = roScope s `without` locals }
+  return res
+  where
+    without (Scope scope bound) x =
+      Scope (IntSet.difference scope x)
+        (IntMap.filterWithKey (\v _ -> v `IntSet.notMember` x) bound)
+
+-- | All variables that appear in the scope these statements are in.
+-- Does not include variables local to sub-scopes such as those that only
+-- appear:
+--  - inside a negated subquery
+--  - in some but not all branches of a disjunction
+--  - in only one of 'else' or (condition + 'then') clauses of an if stmt
+scopeVars :: FlatStatementGroup -> VarSet
+scopeVars (FlatStatementGroup ord) =
+  foldMap (stmtScope . unOrdered) ord
+  where
+    stmtScope = \case
+      FlatNegation{} -> mempty
+      s@FlatStatement{} -> vars s
+      FlatAllStatement{} -> mempty
+      -- only count variables that appear in all branches of the disjunction
+      FlatDisjunction [] -> mempty
+      FlatDisjunction (s:ss) ->
+        foldr (IntSet.intersection . scopeVars) (scopeVars s) ss
+      FlatConditional cond then_ else_ ->
+        IntSet.intersection
+          (scopeVars cond <> scopeVars then_)
+          (scopeVars else_)
+
+{-
+Note [Optimising statement groups]
+
+A nested fact match in Angle compiles to a group of statements. For
+example
+
+   P { _, Q "abc" }
+
+after flattening yields the group of statements
+
+   P { _, X }
+   X = Q "abc"
+
+The purpose of reorderStmtGroup is to find a good ordering for the
+statements in the group.
+
+The algorithm is
+
+  1. first choose lookups (X = pred P, where X is bound)
+  2. repeat step 1, binding more variables until there are no more lookups
+  3. classify all the remaining statements by cost
+  4. choose statements in the following order. If we choose any
+     statements, then go back to 1 to order the remaining statements.
+     a. filters (e.g. X = 1)
+     b. point matches (e.g. X = pred "abc")
+     c. prefix matches (e.g. X = pred { 1, _ })
+     d. full scans (e.g. X = pred _)
+     e. unresolved
+-}
+
+data StmtCost
+  = StmtFilter
+  | StmtLookup
+  | StmtPointMatch
+  | StmtPrefixFactMatch
+  | StmtPrefixMatch
+  | StmtScan
+  | StmtUnresolved
+  deriving (Bounded, Eq, Show, Ord)
+
+reorderStmtGroup
+  :: VarSet
+  -> VarSet
+  -> [Ordered FlatStatement]
+  -> [Ordered FlatStatement]  -- final ordering
+reorderStmtGroup sc initBound stmts =
+  let
+    (ordered, floating) = partitionEithers (map f stmts)
+      where f (Ordered s) = Left s
+            f (Floating s) = Right s
+
+    (lookups, others) = partitionStmts (map summarise floating)
+    ord = map summarise ordered
+    r = layout (IntSet.toList initBound) initBound lookups others ord
+  in
+  trace (show (vcat [
+    "reorderStmtGroup: " <> pretty (show initBound),
+    indent 2 (displayDefault (FlatStatementGroup stmts)),
+    "===>",
+    indent 2 (vcat (map displayDefault r)) ])) r
+  where
+    trace _ x = x
+
+    summarise
+      :: FlatStatement
+      -> (Maybe VarId, VarSet, FlatStatement)
+    summarise stmt = case stmt of
+      FlatStatement _ lhs rhs -> (maybeVar, bound, stmt)
+        where
+        maybeVar = case (lhs,rhs) of
+          (Ref v, FactGenerator{}) | Just (Var _ x _) <- matchVar v -> Just x
+          _otherwise -> Nothing
+      FlatAllStatement (Var _ v _) _ _ -> (Just v, bound, stmt)
+      FlatDisjunction [_one] -> (Nothing, bound, stmt)
+        -- TODO: we could recursively reorder these nested groups as
+        -- with disjunctions below, but it caused various regressions
+        -- when I tried it.
+      FlatDisjunction groups -> (Nothing, bound, stmt')
+        where
+        -- to get a baseline cost for a disjunction, we recursively
+        -- reorder it in the enclosing context, and then use this cost
+        -- as a minimum. This is cheaper and less accurate than
+        -- recursively reordering every time we want to classify it,
+        -- but gives better results than not reordering recursively at
+        -- all.
+        stmt' = FlatDisjunction
+          [ FlatStatementGroup (reorderStmtGroup sc initBound ord)
+          | FlatStatementGroup ord <- groups ]
+      FlatNegation{} ->  (Nothing, bound, stmt)
+      FlatConditional{} ->  (Nothing, bound, stmt)
+      where
+      bound = boundVars stmt
+
+    partitionStmts
+       :: [(Maybe VarId, VarSet, FlatStatement)]
+       -> (
+            IntMap [(VarSet, FlatStatement)],
+            [(VarSet, FlatStatement)]
+          )
+    partitionStmts summaries = (lookups, others)
+      where
+      lookups = IntMap.fromListWith (<>)
+        [ (v, [(bound, stmt)]) | (Just v, bound, stmt) <- summaries ]
+      others = [ (bound, stmt) | (Nothing, bound, stmt) <- summaries ]
+
+    classify :: VarSet -> FlatStatement -> StmtCost
+    classify bound (FlatStatement _ lhs (FactGenerator _ key _ _))
+      | Just (Var _ v _) <- isVar lhs, v `IntSet.member` bound = StmtPointMatch
+      | otherwise =
+      case classifyPattern ((`IntSet.member` bound) . varId) key of
+        PatternMatch _ Point -> StmtPointMatch
+        PatternMatch PrefixFactId Scan -> StmtPrefixFactMatch
+        PatternMatch PrefixFixed Scan -> StmtPrefixMatch
+        PatternMatch _ Scan -> StmtScan
+    classify _ (FlatDisjunction []) = StmtFilter -- False
+    classify bound stmt
+      | isResolvedFilter inScope stmt = StmtFilter
+      | isCurrentlyUnresolved inScope stmt = StmtUnresolved
+      where inScope = mkInScopeForClassify sc bound
+    classify bound (FlatDisjunction alts@(_:tail)) =
+      -- we classify a disjunction as a prefix match even if the
+      -- individual brannches are O(1). In particular this means we
+      -- won't pull a disjunction out of order just because the
+      -- branches are filters, which can make things worse.
+      if not (null tail)
+        then max StmtPrefixFactMatch maxCost
+        else maxCost
+      where maxCost = maximum (map (classifyGroup bound) alts)
+    classify _ (FlatStatement _ _ ArrayElementGenerator{}) = StmtPrefixMatch
+    classify _ (FlatStatement _ _ SetElementGenerator{}) = StmtPrefixMatch
+    classify bound (FlatNegation g) = classifyGroup bound g
+    classify bound (FlatAllStatement _ _ stmts) = classifyGroup bound stmts
+    classify _ _ = StmtScan
+
+    -- Approximate classification of groups. To be more
+    -- accurate we would have to recursively reorder the
+    -- statements in the group. TODO: recursively reorder
+    -- but only if there are no O(1) statements in the group.
+    -- We do attempt to reorder unresolved statements on the fly
+    -- here; this turned out to be necessary in some cases.
+    classifyGroup bound (FlatStatementGroup ord) =
+      go bound (filter <> nonfilter) minBound []
+      where
+      -- put filters first, if they're unresolved they'll get pushed
+      -- to the back anyway.
+      (filter,nonfilter) = partition isFilter ord
+        where isFilter s = case unOrdered s of
+                FlatStatement _ _ TermGenerator{} -> True
+                _ -> False
+      go _ [] cost bad = if null bad then cost else StmtUnresolved
+      go bound (stmt : stmts) cost bad
+        | stmtCost == StmtUnresolved = go bound stmts cost (stmt : bad)
+        | otherwise = go bound' (stmts <> bad) (max cost stmtCost) []
+          where
+          stmtCost = case stmt of
+            Ordered s -> classify bound s
+            Floating s -> classify bound s
+          bound' = boundVarsOfOrdStmt stmt bound
+
+    layout
+      :: [VarId]
+      -> VarSet
+      -> IntMap [(VarSet, FlatStatement)]
+      -> [(VarSet, FlatStatement)] -- floating
+      -> [(Maybe VarId, VarSet, FlatStatement)] -- ordered
+      -> [Ordered FlatStatement]
+    layout [] _ lookups [] [] | IntMap.null lookups = []
+    layout (x:xs) bound lookups others ord =
+      case IntMap.lookup x lookups of
+        Nothing -> layout xs (IntSet.insert x bound) lookups others ord
+        Just some ->
+          map Floating stmts <> layout (new <> xs) bound' lookups' others ord
+          where
+          (varss, stmts) = unzip some
+          allVars = IntSet.unions varss
+          new = filter (`IntSet.notMember` bound) (IntSet.toList allVars)
+          bound' = IntSet.union allVars bound
+          lookups' = IntMap.delete x lookups
+    layout [] bound lookups others ord =
+      let
+        classified =
+          [ (classify bound stmt, (Just var, vars, stmt))
+          | (var, some) <- IntMap.toList lookups, (vars, stmt) <- some ] <>
+          [ (classify bound stmt, (Nothing, vars, stmt))
+          | (vars, stmt) <- others ]
+
+        classifiedOrd =
+          [ (classify bound stmt, (lkp, vars, stmt))
+          | (lkp, vars, stmt) <- ord ]
+
+        partitionByCost wanted stmts = (map snd yes, map snd no)
+          where
+          want (cost, _) = cost == wanted
+          !(yes,no) = partition want stmts
+
+        -- all statements with the desired cost
+        chooseAll wanted orElse
+          | null stmts && null stmtsOrd = orElse
+          | otherwise =
+            chosen wanted (found <> foundOrd) rejected rejectedOrd $
+              map Floating stmts <> map Ordered stmtsOrd <>
+                layout newBound bound lookups others rejectedOrd
+          where
+          !(found, rejected) = partitionByCost wanted classified
+          !(foundOrd, rejectedOrd) = partitionByCost wanted classifiedOrd
+          !(_, varss, stmts) = unzip3 found
+          !(_, varssOrd, stmtsOrd) = unzip3 foundOrd
+          newBound = concatMap IntSet.toList (varss <> varssOrd)
+          !(lookups, others) = partitionStmts rejected
+
+        -- the "best" statement with the desired cost is one that
+        -- won't be made cheaper if we pick another statement
+        chooseBest wanted orElse = go found []
+          where
+          !(found, rejected) = partitionByCost wanted classified
+
+          this vars stmt rest ord =
+            chosen wanted [(wanted,vars,stmt)] (rest <> rejected) ord $
+              chooseOne vars stmt (rest <> rejected) ord
+
+          -- pick a statement that isn't bound by some other statement
+          go [] _ = case findOrd wanted classifiedOrd of
+            Just ((_, vars, stmt), ord') ->
+              this vars (Ordered stmt) found ord'
+            Nothing -> case found of
+              [] -> orElse
+              (_, vars, stmt) : rest -> this vars (Floating stmt) rest ord
+          go ((Nothing, vars, stmt) : rest) other =
+            this vars (Floating stmt) (rest <> other) ord
+          go (info@(Just var, vars, stmt) : rest) other
+            | not (boundBySomething var) =
+              this vars (Floating stmt) (rest <> other) ord
+            | otherwise = go rest (info : other)
+
+          boundBySomething v =
+            any boundBy (found <> rejected) || any boundBy ord
+            where
+            boundBy (Just v', _, _) | v == v' = False
+            boundBy (_, vars, _) = v `IntSet.member` vars
+
+        -- just logging, for debugging
+        chosen wanted found rejected ord =
+          trace (show $ vcat [
+            "picked: " <> pretty (show wanted),
+            indent 2 (dumpStmts found),
+            "rejected:",
+            indent 2 (dumpStmts rejected),
+            "ord:",
+            indent 2 (dumpStmts ord)])
+          where
+          dumpStmts stmts =
+            vcat [ displayDefault stmt | (_,_,stmt) <- stmts ]
+
+        chooseOne vars stmt rest ord =
+          stmt : layout (IntSet.toList vars) bound lookups others ord
+          where
+          (lookups, others) = partitionStmts rest
+
+        chooseNext
+          | (_, vars, stmt) : rest <- map snd classified =
+            chooseOne vars (Floating stmt) rest ord
+          | (_, vars, stmt) : rest <- ord =
+            chooseOne vars (Ordered stmt) [] rest
+          | otherwise =
+            error "chooseNext"
+
+        -- If there was no good floating statement to use, check if
+        -- the next ordered statement is good.
+        findOrd wanted ord = go ord
+          where
+          -- We allow skipping over unresolved statements in the
+          -- ordered list, because those will be reordered by the
+          -- later pass anyway.
+          go [] = Nothing
+          go ((cost, s@(_, _, stmt)) : more)
+            | cost == wanted || wanted == StmtScan && cost == StmtUnresolved =
+              -- StmtUnresolved often turns into a StmtScan later when
+              -- we insert a generator for the unbound variable.
+              trace ("findOrd selecting: " <> show cost <> ": " <>
+                show (displayDefault stmt)) $
+              Just (s, map snd more)
+            | otherwise =
+              trace ("findOrd ignoring: " <> show cost <> ": " <>
+                show (displayDefault stmt))
+              Nothing
+      in
+      chooseAll StmtFilter $
+      chooseAll StmtPointMatch $
+      chooseBest StmtPrefixFactMatch $
+      chooseBest StmtPrefixMatch $
+      chooseBest StmtScan
+      chooseNext
+      -- TODO: only classify Disjunction if there are no O(1) stmts
+
+{- Note [Reordering negations]
+
+A negated subquery doesn't bind values to variables in its enclosing scope.
+
+This means that if a variable is unbound in the evaluation of a negation it
+will behave as a wildcard. This has implications for variables that will be
+bound later as it means that the order of statements can change the meaning
+of the query.
+
+Consider the following query:
+
+  K where !(Q A); P A;
+
+As it stands it will be equivalent to
+
+  K where !(Q _); P A;
+
+Which will fail if there is any Q fact in the database.
+If we invert the order of statements it will only fail if there were
+specifically a `Q A` fact in the database.
+
+  K where P A; !(Q A);
+
+To ensure consistent semantics regardless of the order of statements in the
+source query we always move negated subqueries after the binding of all
+variables from the parent scope that it uses.
+-}
+
+reorderStmts :: [FlatStatement] -> R [CgStatement]
+reorderStmts stmts = iterate stmts []
+  where
+  iterate [] bad = mconcat <$> mapM reorderStmt (reverse bad)
+    -- we already tried the bad list, so the first one should throw
+  iterate stmts bad = do
+    scope <- gets roScope
+    let (desc, (chosen, rest)) = choose scope stmts
+    trace (show (vcat [
+      "choose:",
+      indent 2 (vcat (map displayDefault stmts)),
+      pretty desc <> ": " <> displayDefault chosen])) $ return ()
+    r <- tryError $ reorderStmt chosen
+    case r of
+      Left{} -> trace ("bad: " <> show (displayDefault chosen)) $ iterate rest (chosen : bad)
+      Right cgChosen -> do
+        -- we made some progress, so reset the bad list
+        let next = if null bad then rest else rest <> reverse bad
+        cgRest <- iterate next []
+        return (cgChosen <> cgRest)
+
+  trace _ x = x -- comment out to debug
+
+  tryError m = (Right <$> m) `catchError` (return . Left)
+
+  -- Attempt to cheaply pick a good statement from the list. We try
+  -- not to mess with the original order if we can avoid it, but we
+  -- will pick a different statement if there's an O(1) statement we
+  -- can do next, or if the current statement is definitely
+  -- unresolved. If we don't know whether it's resolved, such as in
+  -- the case of a disjunction, we'll fall back to just trying it.
+  choose
+    :: Scope
+    -> [FlatStatement]
+    -> (Text, (FlatStatement, [FlatStatement]))
+  choose _ [one] = ("only", (one, []))
+  choose scope stmts = fromMaybe (error "choose") $
+    firstResolved <|>
+    firstLookup <|>
+    firstNotUnresolved <|>
+    firstNotUnresolvedLenient <|>
+    fallback
+    where
+      firstResolved = ("resolved",) <$>
+        find (isResolvedFilter (ifBoundOnly scope) . fst) stmts'
+
+      firstLookup = ("lookup",) <$>
+        find (isLookup (ifBoundOnly scope) . fst) stmts'
+
+      -- try to find a statement that's already resolved without
+      -- adding any missing generators, and then try again allowing
+      -- unbound predicates to be resolved.
+      firstNotUnresolved = ("not unresolved",) <$>
+        find (not . isUnresolved (ifBoundOnly scope) . fst) stmts'
+
+      firstNotUnresolvedLenient = ("not unresolved lenient",) <$>
+        find (not . isUnresolved (allowUnboundPredicates scope) . fst) stmts'
+
+      fallback = ("take first",) <$> uncons stmts
+
+      stmts' = go [] stmts
+
+      go :: [a] -> [a] -> [(a,[a])]
+      go _ [] = []
+      go before (x:after) = (x, reverse before <> after) : go (x:before) after
+
+
+-- | True if the statement is O(1) and resolved
+isResolvedFilter :: InScope -> FlatStatement -> Bool
+isResolvedFilter scope stmt = case stmt of
+  FlatStatement _ _ ArrayElementGenerator{} -> False
+  FlatStatement _ _ SetElementGenerator{} -> False
+    -- an ArrayElementGenerator is not O(1)
+  _otherwise -> isReadyFilter scope stmt False
+
+-- | True if the statement is definitely unresolved in the given
+-- scope. False indicates "maybe resolved"; we'll fall back to trying
+-- to resolve the stmt in reorderStmts.
+isUnresolved :: InScope -> FlatStatement -> Bool
+isUnresolved inScope stmt = case stmt of
+  FlatDisjunction{} -> False -- don't know
+  FlatStatement _ _ (ArrayElementGenerator _ arr) ->
+    not (patIsBound inScope arr)
+  FlatStatement _ _ (SetElementGenerator _ arr) ->
+    not (patIsBound inScope arr)
+  _otherwise -> not (isReadyFilter inScope stmt True)
+
+isCurrentlyUnresolved :: InScope -> FlatStatement -> Bool
+isCurrentlyUnresolved scope stmt = case stmt of
+  FlatDisjunction{} -> False -- don't know
+  FlatStatement _ _ (ArrayElementGenerator _ arr) ->
+    not (patIsBound scope arr)
+  FlatStatement _ _ (SetElementGenerator _ arr) ->
+    not (patIsBound scope arr)
+  _otherwise -> not (isReadyFilter scope stmt True)
+
+isReadyFilter :: InScope -> FlatStatement -> Bool -> Bool
+isReadyFilter scope stmt notFilter = case stmt of
+  FlatDisjunction [FlatStatementGroup ord] ->
+    all isReady ord
+    where
+    isReady stmt = isReadyFilter scope (unOrdered stmt) notFilter
+    -- Don't hoist a disjunction with multiple alts, even if they're
+    -- all resolved, because that might duplicate work.
+  FlatStatement _ lhs (TermGenerator rhs) ->
+    patIsBound scope lhs || patIsBound scope rhs
+  FlatStatement _ _ (PrimCall _ args _) ->
+    all (patIsBound scope) args
+  FlatStatement _ _ (DerivedFactGenerator _ key val) ->
+    patIsBound scope key && patIsBound scope val
+  FlatNegation (FlatStatementGroup ord) ->
+    -- See Note [Reordering negations]
+    all isReady ord && hasAllNonLocalsBound
+    where
+      isReady stmt = isReadyFilter scope (unOrdered stmt) notFilter
+      appearInStmts = foldMap vars ord
+      hasAllNonLocalsBound =
+        IntSet.null $
+        IntSet.filter (\var -> isInScope scope var && not (inScopeBound scope var))
+        appearInStmts
+  _ -> notFilter
+
+isLookup :: InScope -> FlatStatement -> Bool
+isLookup scope (FlatStatement _ lhs FactGenerator{})
+  | Just (Var _ v _) <- isVar lhs, inScopeBound scope v = True
+isLookup _ _ = False
+
+data InScope = InScope
+  { unboundPredicates :: Bool
+  , isInScope :: Variable -> Bool
+  , inScopeBound :: Variable -> Bool
+  }
+
+mkInScope :: Bool -> Scope -> InScope
+mkInScope allowPred (Scope scope bound) =
+  InScope
+    { unboundPredicates = allowPred
+    , isInScope = \var -> var `IntSet.member` scope
+    , inScopeBound = \var -> var `IntMap.member` bound
+    }
+
+mkInScopeForClassify :: VarSet -> VarSet -> InScope
+mkInScopeForClassify scope bound =
+  InScope
+    { unboundPredicates = False
+    , isInScope = \var -> var `IntSet.member` scope
+    , inScopeBound = \var -> var `IntSet.member` bound
+    }
+
+allowUnboundPredicates :: Scope -> InScope
+allowUnboundPredicates = mkInScope True
+
+ifBoundOnly :: Scope -> InScope
+ifBoundOnly = mkInScope False
+
+isBoundInScope :: InScope -> Var -> Bool
+isBoundInScope scope (Var ty v _) =
+  inScopeBound scope v || (unboundPredicates scope && isPredicate ty)
+  where
+  isPredicate ty
+    | RTS.PredicateRep{} <- RTS.repType ty = True
+    | otherwise = False
+
+allBound :: Scope -> IntMap Var
+allBound (Scope _ bound) = bound
+
+allVars :: Scope -> VarSet
+allVars (Scope scope _) = scope
+
+patIsBound :: InScope -> Pat -> Bool
+patIsBound inScope pat
+  | PatternMatch _ Point <- classifyPattern (isBoundInScope inScope) pat = True
+  | otherwise = False
+
+data PatternMatch = PatternMatch Prefix Point
+data Point = Point | Scan
+data Prefix
+  = PrefixEmpty
+  | PrefixFixed
+  | PrefixFactId -- ^ prefix contains a fact ID, so it's probably more specific
+
+-- | Classify a pattern according to the cases in 'PatternMatch'
+classifyPattern
+  :: (Var -> Bool) -- ^ variable is bound?
+  -> Term (Match () Var)
+  -> PatternMatch
+classifyPattern bound t = go PrefixEmpty t end
+  where
+  go
+    :: Prefix -- non-empty fixed prefix seen?
+    -> Term (Match () Var)
+    -> (Prefix -> PatternMatch)  -- cont
+    -> PatternMatch
+  go pref t r = case t of
+    Byte{} -> fixed pref r
+    Nat{} -> fixed pref r
+    Array xs -> termSeq pref xs r
+    ByteArray{} -> fixed pref r
+    Tuple xs -> termSeq pref xs r
+    Alt _ t -> fixed pref (\pref -> go pref t r)
+    String{} -> fixed pref r
+    Ref m -> case m of
+      MatchWild{} -> wild pref
+      MatchNever{} -> PatternMatch pref Point
+      MatchFid{} -> fact r
+      MatchBind v -> var v
+      MatchVar v -> var v
+      MatchAnd a b ->
+        case (go pref a end, go pref b end) of
+          (PatternMatch prefix Point, _) -> r prefix
+          (_, PatternMatch prefix Point) -> r prefix
+          (match@(PatternMatch PrefixFactId Scan), _) -> match
+          (_, match@(PatternMatch PrefixFactId Scan)) -> match
+          (match@(PatternMatch PrefixFixed Scan), _) -> match
+          (_, match@(PatternMatch PrefixFixed Scan)) -> match
+          _ -> PatternMatch pref Scan
+      MatchPrefix s t
+        | not (ByteString.null s) -> fixed pref (\pref' -> go pref' t r)
+        | otherwise -> go pref t r
+      -- MatchArrayPrefix doesn't actually look at a prefix because
+      -- arrays encode their length at the front
+      MatchArrayPrefix{} -> wild pref
+      MatchExt{} -> PatternMatch pref Scan
+    where
+    var v
+      | known, PredicateRep{} <- repType (varType v) = fact r
+      | known = fixed pref r
+      | otherwise = wild pref
+      where known = bound v
+
+  -- we've seen a bit of fixed pattern
+  fixed PrefixFactId r = r PrefixFactId
+  fixed _ r = r PrefixFixed
+
+  fact r = r PrefixFactId
+
+  -- we've seen a bit of wild pattern
+  wild prefix = PatternMatch prefix Scan -- stop here
+
+  -- end of the pattern
+  end prefix = PatternMatch prefix Point
+
+  termSeq pref [] r = r pref
+  termSeq pref (x:xs) r = go pref x (\pref -> termSeq pref xs r)
+
+-- | Decide whether to flip a statement or not.
+--
+-- For a statement P = Q we will try both P = Q and Q = P to find a
+-- form that has valid binding (no unbound variables or wildcards in
+-- expressions).
+--
+-- There's a bit of delicacy around which one we try first. Choosing
+-- the right one may lead to better code. For example:
+--
+--    cxx.Name "foo" = X
+--
+-- if X is bound, we can choose whether to flip or not. But if we
+-- don't flip this, the generator on the left will be bound separately
+-- by toCgStatement to give
+--
+--    Y = X
+--    Y = cxx.Name "foo"
+--
+-- it would be better to flip the original statement to give
+--
+--    X = cxx.Name "foo"
+--
+-- More generally, if we have generators on the left but not the
+-- right, we should probably flip.  If we have generators on both
+-- sides, let's conservatively try not flipping first.
+--
+reorderStmt :: FlatStatement -> R [CgStatement]
+reorderStmt stmt
+  | Just flip <- canFlip =
+    noflip `catchError` \e ->
+      flip `catchError` \e' ->
+        attemptBindFromType e noflip `catchError` \_ ->
+          attemptBindFromType e' flip `catchError` \_ ->
+            giveUp e
+  -- If this statement can't be flipped, we may still need to bind
+  -- unbound variables:
+  | otherwise =
+    noflip `catchError` \e ->
+      attemptBindFromType e noflip `catchError` \_ ->
+         giveUp e
+  where
+  noflip = toCgStatement stmt
+  canFlip
+    | FlatStatement ty lhs gen <- stmt, TermGenerator rhs <- gen
+    = Just $ toCgStatement (FlatStatement ty rhs (TermGenerator lhs))
+    | otherwise
+    = Nothing
+
+  attemptBindFromType e rstmt = do
+    (extra, stmts) <- maybeBindUnboundPredicate e (([],) <$> rstmt)
+    return (extra <> stmts)
+
+  giveUp (s, e) =
+    throwError (errMsg s, e)
+  errMsg s = Text.pack $ show $ vcat
+    [ nest 2 $ vcat ["cannot resolve:", displayDefault stmt]
+    , nest 2 $ vcat ["because:", displayDefault s]
+    ]
+
+-- In general if we have X = Y where both X and Y are unbound (or LHS = RHS
+-- containing unbound variables on both sides) then we have no choice
+-- but to return an error message. However in the specific case that we
+-- know the type of X or Y is a predicate then we can add the statement
+-- X = p _ to bind it and retry.
+--
+-- Termination is guaranteed as we strictly decrease the number of unbound
+-- variables each time
+maybeBindUnboundPredicate
+  :: (Text, Maybe FixBindOrderError)
+  -> R ([CgStatement], a)
+  -> R ([CgStatement], a)
+maybeBindUnboundPredicate e f
+  | (_, Just (UnboundVariable var@(Var ty _ _))) <- e
+  , RTS.PredicateRep pid <- RTS.repType ty = tryBindPredicate var pid
+  | otherwise =
+    throwError e
+  where
+  tryBindPredicate var pid = do
+    state <- get
+    details <- case Schema.lookupPid pid $ roDbSchema state of
+        Nothing ->
+          lift $ throwError
+            ( "internal error: bindUnboundPredicates: " <>
+                Text.pack (show pid)
+            , Nothing )
+
+        Just details@Schema.PredicateDetails{} -> do return details
+
+    lhs <- fixVars IsPat (Ref (MatchVar var))
+    (stmts, a) <- f `catchError` \e' -> maybeBindUnboundPredicate e' f
+    let
+      pid = Schema.predicatePid details
+      ref = Schema.predicateId details
+      p = PidRef pid ref
+      tyKey = Schema.predicateKeyType details
+      tyValue = Schema.predicateValueType details
+      pat =
+        FactGenerator p
+          (Ref (MatchWild tyKey))
+          (Ref (MatchWild tyValue))
+          SeekOnAllFacts
+    -- V = p {key=_, value=_}
+    -- LHS = RHS
+    return (CgStatement lhs pat : stmts, a)
+
+toCgStatement :: FlatStatement -> R [CgStatement]
+toCgStatement stmt = case stmt of
+  FlatStatement _ lhs gen -> do
+    gen' <- fixVars IsExpr gen -- NB. do this first!
+    lhs' <- fixVars IsPat lhs
+    return [CgStatement lhs' gen']
+  FlatAllStatement v e g -> do
+    cg <- withScopeFor (scopeVars g <> vars e) $ do
+      stmts <- reorderGroup g
+      e' <- fixVars IsExpr e
+      return [CgAllStatement v e' stmts]
+    _ <- fixVars IsPat (Ref (MatchVar v) :: Pat) -- bind v, if allowed
+    return cg
+  FlatNegation stmts -> do
+    stmts' <-
+      withinNegation $
+      withScopeFor (scopeVars stmts) $
+      reorderGroup stmts
+    return [CgNegation stmts']
+  FlatDisjunction [stmts] ->
+    withScopeFor (scopeVars stmts) $ reorderGroup stmts
+  FlatDisjunction groups -> do
+    cg <- map runIdentity <$> intersectBindings (map Identity groups)
+    return [CgDisjunction cg]
+  FlatConditional cond then_ else_ -> do
+    r <- intersectBindings [[ cond, then_ ], [ else_ ]]
+    case r of
+      [[cond', then'], [else']] -> return [CgConditional cond' then' else']
+      _ -> error "unexpected length returned by intersectBindings"
+  where
+
+  intersectBindings :: (Traversable t, Foldable t) =>
+    [t FlatStatementGroup] -> R [t [CgStatement]]
+  intersectBindings [] = return []
+  intersectBindings groups = do
+    initialScope <- gets roScope
+    results <- forM groups $ \tgroup -> do
+      modify $ \state -> state { roScope = initialScope }
+      tstmts <- withScopeFor (foldMap scopeVars (toList tgroup)) $
+        traverse reorderGroup tgroup
+      newScope <- gets roScope
+      return (tstmts, allBound newScope)
+
+    let boundInAllBranches = foldr1 IntMap.intersection (map snd results)
+    forM_ results $ \(_, boundInThisBranch) -> do
+      let unbound = IntMap.difference boundInThisBranch boundInAllBranches
+      forM_ (IntMap.elems unbound) $ \var -> do
+        let e = UnboundVariable var
+        throwError (errMsg e, Just e)
+
+    let newScope = foldr bind initialScope $ IntMap.elems boundInAllBranches
+    modify $ \state -> state { roScope = newScope }
+    return (map fst results)
+
+-- | Keep track of variables in the scope outside of the negation so that we
+-- can make reordering decisions about variables local to the negation.
+-- See Note [Reordering negations]
+withinNegation :: R a -> R a
+withinNegation act = do
+  before <- get
+  modify $ \s -> s { roNegationEnclosingScope = allVars $ roScope before }
+  res <- act
+  modify $ \s -> s { roNegationEnclosingScope = roNegationEnclosingScope before }
+  return res
+
+fixVars :: FixBindOrder a => IsPat -> a -> R a
+fixVars isPat p = do
+  state <- get
+  let scope = roScope state
+      noBind = NoBind (roNegationEnclosingScope state)
+  (p', scope') <-
+    lift $
+      withExcept (\err -> (errMsg err, Just err)) $
+      runFixBindOrder scope noBind (fixBindOrder isPat p)
+  modify $ \s -> s { roScope = scope' }
+  return p'
+
+errMsg :: FixBindOrderError -> Text
+errMsg err = case err of
+  UnboundVariable v@(Var ty _ _) ->
+    "unbound variable: " <>
+    Text.pack (show (displayDefault v <+> ":" <+> displayDefault ty))
+  CannotUseWildcardInExpr -> "cannot use a wildcard in an expression"
+  CannotUseNeverInExpr -> "cannot use 'never' in an expression"
+
+
+data ReorderState = ReorderState
+  { roNextVar :: !Int
+  , roDbSchema :: Schema.DbSchema
+  , roScope :: Scope
+  , roNegationEnclosingScope :: VarSet
+    -- ^ variables non-local to the current negated subquery
+  }
+
+type R a = StateT ReorderState (Except (Text, Maybe FixBindOrderError)) a
+  -- with the StateT outside, m `catchError` h will restore the state
+  -- prior to m when executing h.  This is what we want for trying
+  -- alternative binding orders.
+
+instance Monad m => Fresh (StateT ReorderState m) where
+  peek = gets roNextVar
+  alloc = do
+    state@ReorderState{..} <- get
+    put state{ roNextVar = roNextVar + 1 }
+    return roNextVar
+
+initialReorderState :: Int -> Schema.DbSchema -> ReorderState
+initialReorderState nextVar dbSchema = ReorderState
+  { roNextVar = nextVar
+  , roScope = Scope mempty mempty
+  , roDbSchema = dbSchema
+  , roNegationEnclosingScope = mempty
+  }
diff --git a/glean/db/Glean/Query/Transform.hs b/glean/db/Glean/Query/Transform.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Transform.hs
@@ -0,0 +1,837 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE RecursiveDo #-}
+{-# LANGUAGE CPP #-}
+module Glean.Query.Transform
+  ( transformationsFor
+  , transformResultsBack
+  , ResultTransformations
+  , transformType
+  , transformBytes
+  , transformPattern
+  , transformFact
+  , skipTrusted
+  , buildTerm
+  , isWordTy
+  , isByteTy
+  , defaultValue
+  ) where
+
+import Control.Monad
+#if MIN_VERSION_mtl(2,3,1)
+import Control.Monad.Cont hiding (label)
+#else
+import Control.Monad.Cont
+#endif
+import Data.Bifoldable
+import Data.Bifunctor (bimap)
+import qualified Data.ByteString as ByteString
+import Data.Coerce (Coercible, coerce)
+import Data.Either (isLeft)
+import Data.Either.Extra (fromEither)
+import Data.Function (fix)
+import qualified Data.Map.Strict as Map
+import Data.Map.Strict (Map)
+import Data.Maybe (fromMaybe, mapMaybe, isJust)
+import qualified Data.IntMap.Strict as IntMap
+import Data.IntMap.Strict (IntMap)
+import Data.Text (Text, unpack)
+import qualified Data.Text as Text
+import Data.Vector (Vector, (!))
+import qualified Data.Set as Set
+import Data.Set (Set)
+import Data.Word (Word64)
+
+import Glean.Angle.Types (Type_(..), FieldDef_(..), Name)
+import Glean.Bytecode.Types (Ty(..))
+import Glean.Schema.Util (lowerEnum, lowerMaybe, showRef)
+import Glean.Query.Codegen.QueryRegs
+import Glean.Query.Codegen.Types
+  ( Match(..)
+  , Var(..)
+  , Typed(..)
+  , Output
+  , TransformAndBind(..) )
+import Glean.Database.Schema.Types
+import qualified Glean.RTS as RTS
+import Glean.RTS.Bytecode.Code
+import Glean.RTS.Bytecode.Gen.Issue
+import Glean.RTS.Foreign.Query (QueryResults(..))
+import Glean.RTS.Types as RTS
+import Glean.RTS.Term (Term(..), Value)
+import qualified Glean.Types as Thrift
+
+-- | Predicate transformations to be applied to a query's result. Keyed by the
+-- predicate to be transformed. i.e. the one available in the database.
+newtype ResultTransformations =
+  ResultTransformations (IntMap PredicateTransformation)
+  deriving newtype (Semigroup, Monoid)
+
+-- | Transformations for a type and all its transitively nested types
+-- It is an error if the type uses multiple versions of the same predicate.
+transformationsFor
+  :: DbSchema
+  -> QueryTransformations
+  -> Type
+  -> Either Text ResultTransformations
+transformationsFor schema qtrans ty =
+  if null repeated
+  then Right transformations
+  else Left $ "multiple versions of evolved predicates: "
+      <> Text.unlines (map showRepeated repeated)
+  where
+    detailsFor pid = case lookupPid pid schema of
+      Nothing -> error $ "unknown predicate " <> show pid
+      Just details -> details
+
+    inType :: [Pid]
+    inType = filter (needsTransformation qtrans) (getPids ty)
+      where getPids = bifoldMap (pure . pid) (getPids . expandType)
+            expandType (ExpandedType _ t) = t
+
+    withDeps :: [Pid]
+    withDeps = Set.toList $ foldr addDeps mempty inType
+      where
+      addDeps :: Pid -> Set Pid -> Set Pid
+      addDeps pid seen = foldr Set.insert seen deps
+        where deps = transitiveDeps detailsFor seen pid
+
+    -- predicates available are mapped to the predicates requested
+    mappings :: Map Pid (Set Pid)
+    mappings =
+      Map.fromListWith (<>)
+        [ (to, Set.singleton from)
+        | from <- withDeps
+        , let to = case lookupTransformation from qtrans of
+                Nothing -> from
+                Just e -> pid $ tAvailable e
+        ]
+
+    repeated :: [(Pid, Set Pid)]
+    repeated = Map.toList $ Map.filter ((> 1) . Set.size) mappings
+
+    transformations :: ResultTransformations
+    transformations = ResultTransformations $ IntMap.fromList
+      [ (to, evolution)
+      | evolution <- mapMaybe (`lookupTransformation` qtrans) withDeps
+      , let to = fromIntegral $ fromPid $ pid  $ tAvailable evolution
+      ]
+
+    showRepeated :: (Pid, Set Pid) -> Text
+    showRepeated (to, froms) =
+      showPid to <> " evolves "
+      <> Text.intercalate " and " (showPid <$> Set.toList froms)
+      where showPid = showRef . predicateRef . detailsFor
+
+pid :: PidRef -> Pid
+pid (PidRef x _) = x
+
+-- ========================
+-- Transform back
+-- ========================
+
+-- | Transform facts back into the type the query originally asked for.
+transformResultsBack :: ResultTransformations -> QueryResults -> QueryResults
+transformResultsBack (ResultTransformations trans) results@QueryResults{..}
+  | IntMap.null trans = results
+  | otherwise = results
+    { queryResultsFacts = overFacts queryResultsFacts
+    , queryResultsNestedFacts = overFacts queryResultsNestedFacts
+    }
+  where
+    overFacts :: Vector (Fid, Thrift.Fact) -> Vector (Fid, Thrift.Fact)
+    overFacts = fmap (fmap overFact)
+
+    overFact :: Thrift.Fact -> Thrift.Fact
+    overFact fact@(Thrift.Fact pid _ _) =
+      case IntMap.lookup (fromIntegral pid) trans of
+        Nothing -> fact
+        Just PredicateTransformation{..} -> tTransformFactBack fact
+
+-- ===========================================================================
+-- Byte code manipulation
+-- ===========================================================================
+
+-- | Generate code to skip over a value of the given type in the input
+--
+skipTrusted
+  :: Register 'DataPtr
+  -> Register 'DataPtr
+  -> Type
+  -> Code ()
+skipTrusted input inputend ty = skip (repType ty)
+  where
+  skip ty = case ty of
+    ByteRep -> do size <- constant 1; inputBytes input inputend size
+    NatRep -> inputSkipNat input inputend
+    ArrayRep eltTy ->
+      local $ \size -> do
+        inputNat input inputend size
+        case eltTy of
+          ByteRep -> inputBytes input inputend size
+          _ -> mdo
+            jumpIf0 size end
+            loop2 <- label
+            skip eltTy
+            decrAndJumpIfNot0 size loop2
+            end <- label
+            return ()
+    TupleRep tys -> mapM_ skip tys
+    SumRep tys
+      | all isEmpty tys -> inputSkipNat input inputend
+      | otherwise -> mdo
+      local $ \sel -> do
+        inputNat input inputend sel
+        let unknown = [end]
+        select sel (alts ++ unknown)
+      raise "selector out of range"
+      alts <- forM tys $ \ty -> do
+        -- TODO: for (Tuple []) we don't need to generate any bytecode
+        alt <- label
+        skip ty
+        jump end
+        return alt
+      end <- label
+      return ()
+    SetRep eltTy ->
+      local $ \size -> do
+        inputNat input inputend size
+        case eltTy of
+          ByteRep -> inputBytes input inputend size
+          _ -> mdo
+            jumpIf0 size end
+            loop2 <- label
+            skip eltTy
+            decrAndJumpIfNot0 size loop2
+            end <- label
+            return ()
+    StringRep -> inputSkipTrustedString input inputend
+    PredicateRep _ -> inputSkipNat input inputend
+
+  -- Empty tuples and empty records do not take any bytes
+  isEmpty = \case
+    TupleRep fields -> all isEmpty fields
+    _ -> False
+
+-- | Serialize a term into the given output register.
+buildTerm
+  :: Register 'BinaryOutputPtr
+  -> Vector (Register 'Word)
+  -> Term (Match () Var)
+  -> Code ()
+buildTerm out vars term = go term
+  where
+  go term = case term of
+    Byte b -> outputByteImm (fromIntegral b) out
+    Nat n -> outputNatImm n out
+    String s ->
+      local $ \ptr end -> do
+        -- NOTE: We assume that the string has been validated during parsing.
+        loadLiteral (RTS.mangleString s) ptr end
+        outputBytes ptr end out
+    Array vs -> do
+      outputNatImm (fromIntegral (length vs)) out
+      mapM_ go vs
+    Tuple fields -> mapM_ go fields
+    Alt n term -> do outputNatImm n out; go term
+    Ref (MatchFid f) -> outputNatImm (fromIntegral (fromFid f)) out
+    Ref (MatchPrefix str rest) -> do
+      local $ \ptr end -> do
+        let
+          mangled = RTS.fromValue (String str)
+          withoutTerminator =
+            ByteString.take (ByteString.length mangled - 2) mangled
+        loadLiteral withoutTerminator ptr end
+        outputBytes ptr end out
+      go rest
+    Ref (MatchVar (Var ty var _))
+      | isByteTy ty -> outputByte (vars ! var) out
+      | isWordTy ty -> outputNat (vars ! var) out
+      | otherwise ->
+        local $ \ptr end -> do
+          getOutput (castRegister (vars ! var)) ptr end
+          outputBytes ptr end out
+    Ref (MatchArrayPrefix _ _ all) -> go all
+    other -> error $ "buildTerm: " <> show other
+
+-- | A 'ResultTerm' is represented in two ways depending on the type
+-- of the value being returned:
+--
+-- * 'PredicateTy' and 'NatTy' results are stored directly in a 'Register Word'
+-- * Other types are built in a 'binary::Output' and are represented by a
+--   'Register BinaryOutputPtr'.
+--
+-- 'isWordTy' returns 'True' for the first kind.
+--
+isWordTy :: Type -> Bool
+isWordTy = isWordRep . repType
+  where
+  isWordRep PredicateRep{} = True
+  isWordRep ByteRep = True
+  isWordRep NatRep = True
+  isWordRep _ = False
+
+isByteTy :: Type -> Bool
+isByteTy = (ByteRep ==) . repType
+
+-- | Transform predicates inside the type but keep its structure.
+transformType :: QueryTransformations -> Type -> Type
+transformType qtrans ty = transform ty
+  where
+    transform ty = bimap overPidRef overExpandedType ty
+
+    overPidRef pref =
+      case lookupTransformation (pid pref) qtrans of
+        Nothing -> pref
+        Just PredicateTransformation{..} -> tAvailable
+
+    overExpandedType (ExpandedType tref ty) =
+      ExpandedType tref (transform ty)
+
+transformFact
+  :: PredicateDetails
+  -> PredicateDetails
+  -> (Thrift.Fact -> Thrift.Fact)
+transformFact from to
+  | Nothing <- mTransformKey
+  , Nothing <- mTransformValue =
+    \(Thrift.Fact _ key value) ->
+      Thrift.Fact (fromPid $ predicatePid to) key value
+  | otherwise =
+    \(Thrift.Fact _ key value) ->
+     Thrift.Fact
+       (fromPid $ predicatePid to)
+       (RTS.fromValue $ overKey $ RTS.toValue keyRep key)
+       (RTS.fromValue $ overValue $ RTS.toValue valueRep value)
+  where
+    overKey = fromMaybe id mTransformKey
+    overValue = fromMaybe id mTransformValue
+    keyRep = repType $ predicateKeyType from
+    valueRep = repType $ predicateValueType from
+    mTransformKey = transformExpression
+      (predicateKeyType from)
+      (predicateKeyType to)
+    mTransformValue = transformExpression
+      (predicateValueType from)
+      (predicateValueType to)
+
+-- | Transform an expression into a another type.
+-- Missing fields are filled with their default value.
+transformExpression :: Type -> Type -> Maybe (Value -> Value)
+transformExpression from to =
+  case transformTerm inner defaultValue from to of
+    Nothing -> Nothing
+    Just f -> Just $ \ta ->
+      f (error "QueryRegs are never used in transformExpression") discard ta id
+  where
+    inner _ _ _ _ _ a f = f a
+    discard _ _ = return ()
+
+type Matcher = Match TransformAndBind Output
+
+-- | Transform a matching pattern into a another type.
+-- All variable bindings are removed.
+-- Missing fields are filled with wildcards.
+transformPattern
+  :: forall a. Type
+  -> Type
+  -> Maybe
+        (  QueryRegs
+        -> (Type -> Term Matcher -> Code ())
+        -> Term Matcher
+        -> (Term Matcher -> Code a)
+        -> Code a
+        )
+transformPattern from to = do
+  f <- transformTerm transformMatch defaultForType from to
+  return $ \qr discard term ->
+    let
+        discard' :: Type -> Term Matcher -> Cont (Code a) ()
+        discard' a b = cont $ \r -> do
+          () <- discard a b
+          r ()
+    in
+    runCont (f qr discard' term)
+  where
+    defaultForType ty = Ref (MatchWild ty)
+
+-- | Transform a Match which matches against a value of 'from' type into one
+-- that matches against a value of 'to' type.
+--
+-- NB. Type compatibility is not checked. Assumes that a transformation is
+-- possible and required.
+transformMatch
+  :: QueryRegs
+  -> (Type -> Matcher -> Cont (Code x) ())  -- ^ handle discarded record fields
+  -> Type
+  -> Type
+  -> (Term Matcher -> Cont (Code x) (Term Matcher))
+  -> Matcher
+  -> Cont (Code x) Matcher
+transformMatch syscalls discard from to overTerm match = case match of
+  MatchWild _ -> return $ MatchWild to
+  MatchNever _ -> return $ MatchNever to
+  MatchFid fid -> return $ MatchFid fid
+  -- Convert value from 'to' type into 'from' before binding.
+  -- If we get to this case it means that this conversion is required,
+  MatchBind out -> return $ MatchExt $ TransformAndBind to out
+  MatchVar (Typed _ var) ->
+    case transformBytes' syscalls discard' from to of
+      Nothing -> return $ MatchVar $ Typed to var
+      Just transform ->
+        cont $ \r ->
+          output $ \result -> do
+          local $ \start end -> do
+            getOutput var start end
+            transform (Bytes start end) result
+          r $ MatchVar $ Typed to result
+  MatchAnd left right -> do
+    left' <- overTerm left
+    right' <- overTerm right
+    return $ MatchAnd left' right'
+  -- both types must be StringTy so this transformation is a no-op
+  MatchPrefix prefix rest -> return $ MatchPrefix prefix rest
+  MatchArrayPrefix _ prefix all -> do
+    all' <- overTerm all
+    res <- overTerm (Array prefix)
+    case res of
+      Array prefix' -> return $ MatchArrayPrefix to prefix' all'
+      _ -> error "array transformation did not yield another array"
+  MatchExt x -> return $ MatchExt x
+  where
+    discard' :: Type -> Bytes -> Code ()
+    discard' ty (Bytes start end) = do
+      output $ \out -> do
+        outputBytes start end out
+        run $ discard ty (MatchVar $ Typed ty out)
+    run :: forall x. Cont (Code x) () -> Code ()
+    run m = void $ runCont m (\() -> return undefined)
+
+type TransformTerm m a b
+  = QueryRegs
+  -> (Type -> Term a -> m ())   -- ^ discard term
+  -> Term a                    -- ^ source term
+  -> m (Term b)
+
+-- | Create a transformation from a term into another term of a compatible type.
+--
+-- This will be used for transforming patterns and expressions. In each of
+-- these two cases we will handle default values and discarded records fields
+-- differently so we take those handling functions as input.
+transformTerm
+  :: forall a b m. (Coercible a b, Show a, Show b, Monad m)
+  => ( QueryRegs
+    -> (Type -> a -> m ())       --  discard inner value
+    -> Type                      --  from type
+    -> Type                      --  to type
+    -> (Term a -> m (Term b))    --  handle inner terms
+    -> a
+    -> m b)
+  -> (Type -> Term b)            -- ^ default value for type
+  -> Type                        -- ^ from type
+  -> Type                        -- ^ to type
+  -> Maybe (TransformTerm m a b)
+transformTerm inner defaultForType src dst = go src dst
+  where
+    -- Types are the same. No transformation is required
+    id' :: Term a -> m (Term b)
+    id' term = return (coerce term)
+
+    names = map fieldDefName
+
+    -- one entry for each common field
+    transformationsFor
+      :: [RTS.FieldDef]
+      -> [RTS.FieldDef]
+      -> Map Text (Maybe (Word64, TransformTerm m a b))
+    transformationsFor from to =
+      Map.intersectionWith trans fromFields toFields
+      where
+        trans :: (Word64, Type)
+              -> (Word64, Type)
+              -> Maybe (Word64, TransformTerm m a b)
+        trans (ixFrom, defFrom) (ixTo, defTo) =
+          case go defFrom defTo of
+            -- fields are identical
+            Nothing | ixTo == ixFrom -> Nothing
+            -- field order changed
+            Nothing -> Just (ixTo, \_ _ -> id')
+            -- field content changed
+            Just f -> Just (ixTo, f)
+
+        fromFields :: Map Text (Word64, Type)
+        fromFields = Map.fromList $ flip map (zip from [0..])
+          $ \(FieldDef name def, ix) -> (name, (ix, def))
+
+        toFields :: Map Text (Word64, Type)
+        toFields = Map.fromList $ flip map (zip to [0..])
+          $ \(FieldDef name def, ix) -> (name, (ix, def))
+
+    go :: Type -> Type -> Maybe (TransformTerm m a b)
+    go from@(NamedTy _ _) to = go (derefType from) to
+    go from to@(NamedTy _ _) = go from (derefType to)
+    go ByteTy ByteTy = Nothing
+    go NatTy NatTy = Nothing
+    go StringTy StringTy = Nothing
+    go BooleanTy BooleanTy = Nothing
+    go (MaybeTy from) (MaybeTy to) = go (lowerMaybe from) (lowerMaybe to)
+    go (PredicateTy _ _) (PredicateTy _ _) = Nothing
+    go (EnumeratedTy from) (EnumeratedTy to) =
+      go (lowerEnum from) (lowerEnum to)
+    go (ArrayTy from) (ArrayTy to) = do
+      f <- go from to
+      return $ fix $ \recurse qr discard term ->
+        case term of
+          Array vs -> Array <$> traverse (f qr discard) vs
+          Ref a -> Ref <$> inner qr
+            (\ty val -> discard ty (Ref val))
+            (ArrayTy from)
+            (ArrayTy to)
+            (recurse qr discard)
+            a
+          _ -> error $ "expected Array, got " <> show term
+    go (SetTy from) (SetTy to) = do
+      f <- go from to
+      return $ fix $ \recurse qr discard term ->
+        case term of
+          Array vs -> Array <$> traverse (f qr discard) vs
+          Ref a -> Ref <$> inner qr
+            (\ty val -> discard ty (Ref val))
+            (SetTy from)
+            (SetTy to)
+            (recurse qr discard)
+            a
+          _ -> error $ "expected Array, got " <> show term
+    go (RecordTy from) (RecordTy to) =
+      let transformations = transformationsFor from to
+          sameFieldCount = length from == length to
+          -- implies same field order as well
+          sameFieldContents = Map.null (Map.filter isJust transformations)
+          noChange = sameFieldCount && sameFieldContents
+      in
+      if noChange
+      then Nothing
+      else Just $ fix $ \recurse qr discard term -> case term of
+        Tuple contents -> do
+          contents' <- sequence
+            [ case Map.lookup name transMap of
+                -- 'to' field doesn't exist in 'from'
+                Nothing -> return $ defaultForType ty
+                Just (content, Nothing) -> id' content
+                Just (content, Just (_, transform)) ->
+                  transform qr discard content
+            | FieldDef name ty <- to
+            ]
+
+          sequence_
+            [ discard tyFrom term
+            | (FieldDef nameFrom tyFrom, term) <- zip from contents
+            , nameFrom `notElem` names to
+            ]
+
+          return (Tuple contents')
+          where
+            transMap = Map.intersectionWith (,) contentsByName transformations
+            contentsByName = Map.fromList $ zip (names from) contents
+        Ref a -> Ref <$> inner qr
+          (\ty val -> discard ty (Ref val))
+          (RecordTy from)
+          (RecordTy to)
+          (recurse qr discard)
+          a
+        _ -> error $ "expected Tuple, got " <> show term
+
+    go (SumTy from) (SumTy to) =
+      let transformations = transformationsFor from to
+          safeAltCount = length from <= length to
+          sameAltContents = Map.null (Map.filter isJust transformations)
+          noChange = safeAltCount && sameAltContents
+          transformationsByIx = Map.fromList
+              [ (ixFrom, trans)
+              | (name, ixFrom) <- zip (names from) [0..]
+              , Just trans <- [Map.lookup name transformations]
+              ]
+          unknown = Alt (fromIntegral $ length to) (Tuple [])
+      in
+      if noChange
+        then Nothing
+        else Just $ fix $ \recurse qr discard term -> case term of
+          Alt n content -> case Map.lookup n transformationsByIx of
+            -- alternative in 'from' doesn't exist in 'to'
+            Nothing -> return unknown
+            Just Nothing -> id' term
+            Just (Just (n', transform)) -> do
+              content' <- transform qr discard content
+              return (Alt n' content')
+          Ref a -> Ref <$> inner qr
+            (\ty -> discard ty . Ref)
+            (SumTy from)
+            (SumTy to)
+            (recurse qr discard)
+            a
+          _ -> error $ "expected Alt, got " <> show term
+    go (ArrayTy from) (SetTy to) = do
+      f <- go from to
+      return $ fix $ \recurse qr discard term ->
+        case term of
+          Array vs -> Array <$> traverse (f qr discard) vs
+          Ref a -> Ref <$> inner qr
+            (\ty val -> discard ty (Ref val))
+            (ArrayTy from)
+            (SetTy to)
+            (recurse qr discard)
+            a
+          _ -> error $ "expected Array, got " <> show term
+    go (SetTy from) (ArrayTy to) = do
+      f <- go from to
+      return $ fix $ \recurse qr discard term ->
+        case term of
+          Array vs -> Array <$> traverse (f qr discard) vs
+          Ref a -> Ref <$> inner qr
+            (\ty val -> discard ty (Ref val))
+            (SetTy from)
+            (ArrayTy to)
+            (recurse qr discard)
+            a
+          _ -> error $ "expected Array, got " <> show term
+
+    go from to =
+      error $ "invalid type conversion: "
+        <> show from <> " to " <> show to
+
+defaultValue :: Type -> Term a
+defaultValue ty = case derefType ty of
+  MaybeTy _ -> Alt 0 (Tuple [])
+  ByteTy -> Byte 0
+  NatTy -> Nat 0
+  BooleanTy -> Alt 0 (Tuple [])
+  StringTy -> String ""
+  ArrayTy _ -> Array []
+  RecordTy fields -> Tuple (map (defaultValue . fieldDefType) fields)
+  EnumeratedTy{} -> Alt 0 (Tuple [])
+  SumTy (first : _) -> Alt 0 (defaultValue (fieldDefType first))
+  _ -> error $ "type doesn't have a default value: " <> show ty
+
+-- | Transform a fact key or value contained in some binary input into another
+-- compatible type.
+--
+-- The transformation function will always leave the start pointer of `Bytes` at
+-- the end of the transformed input.
+transformBytes
+  :: QueryRegs
+  -> Type
+  -> Type
+  -> Maybe (Bytes -> Register 'BinaryOutputPtr -> Code ())
+transformBytes syscalls = transformBytes' syscalls ignoreDiscarded
+  where
+    ignoreDiscarded _ _ = return ()
+
+transformBytes'
+  :: QueryRegs
+  -> (Type -> Bytes -> Code ()) -- handle discarded record fields
+  -> Type
+  -> Type
+  -> Maybe (Bytes -> Register 'BinaryOutputPtr -> Code ())
+transformBytes' QueryRegs{..} discard src dst =
+  case go src dst of
+    Left _ -> Nothing
+    Right transform -> Just $ \bytes out -> transform out bytes
+  where
+  go :: Type
+     -> Type
+     -> Either
+          (Register 'BinaryOutputPtr -> Bytes -> Code ()) -- copy as is
+          (Register 'BinaryOutputPtr -> Bytes -> Code ()) -- transform and copy
+  go from@(NamedTy _ _) to = go (derefType from) to
+  go from to@(NamedTy _ _) = go from (derefType to)
+  go ByteTy ByteTy = Left $ copy ByteTy
+  go NatTy NatTy = Left $ copy NatTy
+  go StringTy StringTy = Left $ copy StringTy
+  go BooleanTy BooleanTy = Left $ copy BooleanTy
+  go (MaybeTy from) to = go (lowerMaybe from) to
+  go from (MaybeTy to) = go from (lowerMaybe to)
+  go (PredicateTy _ _) (PredicateTy pid s) = Left $ copy (PredicateTy pid s)
+  go from (EnumeratedTy to) = go from (lowerEnum to)
+  go (EnumeratedTy from) to = go (lowerEnum from) to
+  go (ArrayTy from) (ArrayTy to) =
+    case go from to of
+      Left _ -> Left $ copy (ArrayTy to)
+      Right trans -> Right $ \out (Bytes start end) ->
+        local $ \size -> mdo
+          inputNat start end size
+          outputNat size out
+          jumpIf0 size finish
+          loop <- label
+          trans out (Bytes start end)
+          decrAndJumpIfNot0 size loop
+          finish <- label
+          return ()
+  go (SetTy from) (SetTy to) =
+    case go from to of
+      Left _ -> Left $ copy (SetTy to)
+      Right trans -> Right $ \out (Bytes start end) ->
+        local $ \size -> do
+        inputNat start end size
+        local $ \set -> mdo
+          jumpIf0 size finish
+          newSet set
+          loop <- label
+          output $ \tempOut -> do
+            trans tempOut (Bytes start end)
+            insertOutputSet set tempOut
+            decrAndJumpIfNot0 size loop
+          finish <- label
+          setToArray set out
+          freeSet set
+        return ()
+  go (SumTy from) (SumTy to)
+    | sameOrder && sameTypes = Left $ copy (SumTy to)
+    | otherwise = Right $ \out (Bytes start end) -> mdo
+        local $ \sel -> mdo
+          inputNat start end sel
+          let unknown = [finish]
+          select sel (lbls ++ unknown)
+          -- TODO: Add tests for this unknown.
+          raise "selector out of range"
+        lbls <- forM alts $ \(ixTo, trans) -> mdo
+          lbl <- label
+          outputNatImm (fromIntegral ixTo) out
+          -- the start pointer was already moved to the beginning
+          -- of the content when the selector was read.
+          fromEither trans out (Bytes start end)
+          jump finish
+          return lbl
+        finish <- label
+        return ()
+      where
+        toAlts :: Map Name (Int, Type)
+        toAlts = Map.fromList
+            [ (name, (ixTo, tyTo))
+            | (ixTo, FieldDef name tyTo) <- zip [0..] to
+            ]
+        alts =
+          [ case Map.lookup name toAlts of
+              -- removed alternative
+              Nothing -> (unknownAltIx, unknownAlt tyFrom)
+              Just (ixTo, tyTo) -> (ixTo, go tyFrom tyTo)
+          | FieldDef name tyFrom <- from
+          ]
+
+        unknownAltIx = length to
+        unknownAlt tyFrom = Right $ \_ (Bytes start end) ->
+          skipTrusted start end tyFrom
+
+        sameIndex (ixFrom, (ixTo, _)) = ixFrom == ixTo
+        sameOrder = all sameIndex (zip [0..] alts)
+        sameTypes = all (isLeft . snd) alts
+  go (RecordTy from) (RecordTy to)
+    | sameFieldCount && sameFieldContents = Left $ copy (RecordTy to)
+    | otherwise = Right walk
+    where
+    sameFieldCount = length from == length to
+    sameFieldContents = all identical (zip from to)
+    identical (FieldDef nameFrom tyFrom, FieldDef nameTo tyTo) =
+      nameFrom == nameTo && isLeft (go tyFrom tyTo)
+
+    fieldsFrom = Set.fromList $ map fieldDefName from
+    fieldsTo = Set.fromList $ map fieldDefName to
+
+    -- walk through the record being copied alongside the record being built.
+    walk out bytes@(Bytes start end) = step mempty from to
+      where
+      step saved from' to' = case to' of
+        [] ->
+          -- nothing more to add, skip origin record
+          skipTrusted start end (RecordTy from')
+        FieldDef nameTo tyTo : restTo
+          | Just (fieldBytes, savedTyFrom) <- Map.lookup nameTo saved -> do
+            -- we've saved that field before, move it over now.
+            fromEither (go savedTyFrom tyTo) out fieldBytes
+            let saved' = Map.delete nameTo saved
+            step saved' from' restTo
+          | not (nameTo `Set.member` fieldsFrom) -> do
+            -- target field is not in origin, use default value
+            buildTerm out mempty (defaultValue tyTo)
+            step saved from' restTo
+          | otherwise ->
+            case from' of
+              [] ->
+                -- if there are no more 'from' fields, all remaining 'to'
+                -- fields should either be missing in 'fieldsFrom or already
+                -- saved for copying.
+                error $ "field unaccounted for: '" <> unpack nameTo <> "'"
+              FieldDef nameFrom tyFrom : restFrom
+                | not (nameFrom `Set.member` fieldsTo) -> do
+                  -- origin field is not in target, discard it
+                  local $ \saved_start -> do
+                    move start saved_start
+                    skipTrusted start end tyFrom
+                    discard tyFrom (Bytes saved_start start)
+                  step saved restFrom to'
+                | nameTo == nameFrom -> do
+                  -- matching field, move it over
+                  fromEither (go tyFrom tyTo) out bytes
+                  step saved restFrom restTo
+                | otherwise ->
+                  -- the field will be required later. Save its location
+                  local $ \fieldStart -> do
+                  move start fieldStart
+                  skipTrusted start end tyFrom
+                  let fieldBytes = Bytes fieldStart end
+                      saved' = Map.insert nameFrom (fieldBytes, tyFrom) saved
+                  step saved' restFrom to'
+  go (ArrayTy from) (SetTy to) =
+    let trans =
+          case go from to of
+            Left copy -> copy
+            Right trans -> trans
+    in Right $ \out (Bytes start end) ->
+      local $ \size -> do
+        inputNat start end size
+        local $ \set -> mdo
+          jumpIf0 size finish
+          newSet set
+          loop <- label
+          output $ \tempOut -> do
+            trans tempOut (Bytes start end)
+            insertOutputSet set tempOut
+            decrAndJumpIfNot0 size loop
+          finish <- label
+          setToArray set out
+          freeSet set
+        return ()
+  go (SetTy from) (ArrayTy to) =
+    let trans =
+          case go from to of
+            Left copy -> copy
+            Right trans -> trans
+    in Right $ \out (Bytes start end) ->
+      local $ \size -> mdo
+        inputNat start end size
+        outputNat size out
+        jumpIf0 size finish
+        loop <- label
+        trans out (Bytes start end)
+        decrAndJumpIfNot0 size loop
+        finish <- label
+        return ()
+  go from to = error $ "invalid type conversion: "
+    <> show from <> " to " <> show to
+
+  -- moves the Bytes start position
+  copy :: Type -> Register 'BinaryOutputPtr -> Bytes -> Code ()
+  copy ty out (Bytes start end)
+    | RecordTy [] <- ty = return ()
+    | otherwise =
+      local $ \saved_start -> do
+        move start saved_start
+        skipTrusted start end ty
+        outputBytes saved_start start out
diff --git a/glean/db/Glean/Query/Typecheck.hs b/glean/db/Glean/Query/Typecheck.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Typecheck.hs
@@ -0,0 +1,1292 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- TODO
+  - implement mutable type variables to speed up type inference
+  - cleanup:
+    - merge inferExpr and typecheckPattern?
+-}
+
+module Glean.Query.Typecheck
+  ( typecheck
+  , typecheckDeriving
+  , ToRtsType
+  , TcEnv(..)
+  , TcOpts(..)
+  , defaultTcOpts
+  , emptyTcEnv
+  , tcQueryDeps
+  , tcQueryUsesNegation
+  , UseOfNegation(..)
+  ) where
+
+import Control.Monad
+import Control.Applicative ((<|>))
+import Control.Monad.Except
+import Control.Monad.State
+import Data.Bifoldable
+import Data.Char
+import Data.Foldable (toList)
+import Data.List.Extra (firstJust)
+import qualified Data.IntMap as IntMap
+import qualified Data.Map as Map
+import Data.Maybe
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import Data.HashSet (HashSet)
+import Data.List
+import Data.List.NonEmpty (NonEmpty((:|)))
+import Data.Text (Text)
+import qualified Data.Set as Set
+import Data.Set (Set)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter hiding ((<>), enclose)
+import System.IO
+import TextShow
+
+import Glean.Angle.Types hiding (Type)
+import qualified Glean.Angle.Types as Schema
+import Glean.Display
+import Glean.Query.Codegen.Types
+  (Match(..), Var(..), QueryWithInfo(..), Typed(..))
+import Glean.Query.Typecheck.Types
+import Glean.Query.Typecheck.Monad
+import Glean.Query.Typecheck.Unify
+import Glean.RTS.Types as RTS
+import Glean.RTS.Term hiding
+  (Tuple, ByteArray, String, Array, Nat)
+import qualified Glean.RTS.Term as RTS
+import Glean.Database.Schema.Types
+import Glean.Schema.Util
+import Glean.Util.Some
+
+type Pat' s st = SourcePat_ s st PredicateId TypeId
+type Statement' s st = SourceStatement_ s st PredicateId TypeId
+type Query' s st = SourceQuery_ s st PredicateId TypeId
+type DerivingInfo' s st = DerivingInfo (Query' s st)
+
+-- | Typecheck a 'SourceQuery' which is in terms of schema types and
+-- turn it into a 'TypecheckedQuery' which is in terms of raw Terms,
+-- ready for compiling to bytecode.
+typecheck
+  :: IsSrcSpan s
+  => DbSchema
+  -> TcOpts
+  -> ToRtsType
+  -> Query' s st
+  -> ExceptT Text IO (TypecheckedQuery, [TcPred])
+typecheck dbSchema opts rtsType query = do
+  let
+    tcEnv = TcEnv
+      { tcEnvPredicates = predicatesById dbSchema
+      , tcEnvTypes = typesById dbSchema
+      }
+  (q@(TcQuery ty _ _ _ _), TypecheckState{..}) <-
+    let state = initialTypecheckState tcEnv opts rtsType TcModeQuery in
+    withExceptT (Text.pack . show) $ flip runStateT state $ do
+      modify $ \s -> s { tcVisible = varsQuery query mempty }
+      q@(TcQuery retTy _ _ _ _) <- inferQuery ContextPat query
+        <* freeVariablesAreErrors <* unboundVariablesAreErrors
+      resolvePromote
+      subst <- gets tcSubst
+      whenDebug $ liftIO $ hPutStrLn stderr $ show $
+        vcat [
+          "subst:", indent 2 (vcat
+            [ pretty n <> " := " <> displayDefault ty
+            | (n,ty) <- IntMap.toList subst
+            ]),
+          "query: " <> displayDefault q
+        ]
+      zonkVars
+      zonkTcQuery q
+        `catchError` \_ -> do
+           (head,_,_) <- needsResult query
+           opts <- gets tcDisplayOpts
+           retTy' <- apply retTy
+           prettyErrorAt (sourcePatSpan head) $ vcat
+             [ "query has ambiguous type",
+               indent 4 $ "type: " <> display opts retTy'
+             ]
+  return (QueryWithInfo q tcNextVar Nothing ty, tcPreds)
+
+-- | Typecheck the query for a derived predicate
+typecheckDeriving
+  :: IsSrcSpan s
+  => TcEnv
+  -> TcOpts
+  -> ToRtsType
+  -> PredicateDetails
+  -> DerivingInfo' s st
+  -> ExceptT Text IO (DerivingInfo TypecheckedQuery)
+typecheckDeriving tcEnv opts rtsType PredicateDetails{..} derivingInfo = do
+  (d, _) <-
+    let state = initialTypecheckState tcEnv opts rtsType TcModePredicate
+    in
+    withExceptT (Text.pack . show) $ flip runStateT state $ do
+    flip catchError
+      (\e -> throwError $ vcat
+        [ "In " <> pretty (predicateIdRef predicateId) <> ":"
+        , indent 2 e ]) $ do
+      case derivingInfo of
+        NoDeriving -> return NoDeriving
+        Derive deriveWhen q -> do
+          modify $ \s -> s { tcVisible = varsQuery q mempty }
+          -- we typecheck the pattern first, because we know its type.
+          (head, stmts, ord) <- needsResult q
+          let
+            (key, maybeVal) = case head of
+              KeyValue _ key val -> (key, Just val)
+                -- Backwards compat, we had a predicate in schema v4 of the form
+                --   X -> prim.toLower X
+                -- but this doesn't parse if -> binds tighter than application.
+              App _ (KeyValue _ key val) xs ->
+                let end
+                      | null xs   = val
+                      | otherwise = last xs
+                    span = spanBetween (sourcePatSpan val) (sourcePatSpan end)
+                in
+                (key, Just (App span val xs))
+              _other -> (head, Nothing)
+          key' <- typecheckPattern ContextPat predicateKeyType key
+          maybeVal' <- case maybeVal of
+            Nothing
+              | eqType (tcOptAngleVersion opts) unit predicateValueType ->
+                return Nothing
+              | otherwise -> prettyErrorIn head $ nest 4 $ vcat
+                [ "a functional predicate must return a value,"
+                , "i.e. the query should have the form 'X -> Y where .." ]
+            Just val -> Just <$>
+              typecheckPattern ContextPat predicateValueType val
+          stmts' <- mapM typecheckStatement stmts
+          freeVariablesAreErrors
+          unboundVariablesAreErrors
+          resolvePromote
+          zonkVars
+          q <- zonkTcQuery (TcQuery predicateKeyType key' maybeVal' stmts' ord)
+          nextVar <- gets tcNextVar
+          return $ Derive deriveWhen $
+            QueryWithInfo q nextVar Nothing predicateKeyType
+  return d
+
+needsResult
+  :: IsSrcSpan s
+  => Query' s st
+  -> T (Pat' s st , [Statement' s st], Ordered)
+needsResult (SourceQuery (Just p) stmts ord) = return (p, stmts, ord)
+needsResult q@(SourceQuery Nothing stmts ord) = case reverse stmts of
+  (SourceStatement (Variable s v) _ : _) ->
+    return (Variable s v, stmts, ord)
+  [SourceStatement Wildcard{} rhs] ->
+    return (rhs, [], ord)
+  (SourceStatement (Wildcard s) rhs : rstmts) -> do
+    tmp <- freshVariable s
+    return (tmp, reverse (SourceStatement rhs tmp : rstmts), ord)
+  (SourceStatement pat _ : _) ->
+    prettyErrorIn pat =<< err
+  _ ->
+    prettyError =<< err
+  where
+    err = do
+      opts <- gets tcDisplayOpts
+      return $ "the last statement should be an expression: " <>
+        display opts q
+
+-- add a unit result if the pattern doesn't have a result.
+ignoreResult :: IsSrcSpan s => Pat' s st -> Pat' s st
+ignoreResult p = case p of
+  OrPattern s a b -> OrPattern s (ignoreResult a) (ignoreResult b)
+  IfPattern s a b c -> IfPattern s a (ignoreResult b) (ignoreResult c)
+  NestedQuery s (SourceQuery Nothing stmts ord) ->
+    NestedQuery s (SourceQuery (Just empty) stmts ord)
+  other ->
+    NestedQuery fullSpan
+      (SourceQuery
+        (Just empty)
+        [SourceStatement (Wildcard fullSpan) other] Unordered)
+  where
+    fullSpan = sourcePatSpan p
+    startPos = mkSpan (startLoc fullSpan) (startLoc fullSpan)
+    empty = TypeSignature startPos (Tuple startPos []) unit
+
+inferQuery :: IsSrcSpan s => Context -> Query' s st -> T TcQuery
+inferQuery ctx q = do
+  (head,stmts,ord) <- needsResult q
+  stmts' <- mapM typecheckStatement stmts
+  (head', ty) <- inferExpr ctx head
+  return (TcQuery ty head' Nothing stmts' ord)
+
+typecheckQuery
+  :: IsSrcSpan s
+  => Context
+  -> Type
+  -> Query' s st
+  -> T TcQuery
+typecheckQuery ctx ty q = do
+  (head,stmts,ord) <- needsResult q
+  head' <- typecheckPattern ctx ty head
+  stmts' <- mapM typecheckStatement stmts
+  return (TcQuery ty head' Nothing stmts' ord)
+
+unexpectedValue :: IsSrcSpan s => Pat' s st -> T b
+unexpectedValue pat = prettyErrorIn pat
+  "a key/value pattern (X -> Y) cannot be used here"
+
+typecheckStatement :: IsSrcSpan s => Statement' s st -> T TcStatement
+typecheckStatement (SourceStatement lhs rhs0) = do
+  let
+    ignoreTopResult (OrPattern s a b) =
+      OrPattern s (ignoreResult a) (ignoreResult b)
+    ignoreTopResult (IfPattern s a b c) =
+      IfPattern s a (ignoreResult b) (ignoreResult c)
+    ignoreTopResult other = other
+    -- We want to allow things like (A; B) | (C; D) at the statement
+    -- level, without enforcing that B and D are expressions or that
+    -- they have the same type.  After the parser this would appear
+    -- as
+    --     _ = ((A; B) | (C; D))
+    --
+    -- so when a statement has a wildcard on the left, we transform
+    -- NestedQuery on the right to replace a missing head with {}.
+    -- This preempts 'needsResult' from doing its transformation and
+    -- failing when the last statement is not an expression.
+    rhs
+      | Wildcard _ <- lhs = ignoreTopResult rhs0
+      | otherwise = rhs0
+  (rhs', ty) <- inferExpr ContextPat rhs
+  lhs' <- typecheckPattern ContextPat ty lhs
+  return $ TcStatement ty lhs' rhs'
+
+-- | The context in which we're typechecking: either an expression or
+-- a pattern.
+data Context = ContextExpr | ContextPat
+
+-- For the term built by a Query, we have no local type information,
+-- so we attempt to infer the type of the expression.  Therefore we
+-- don't allow structs or alts. Variables must be occurrences
+-- (because this is a term, not a pattern), and Wildcards are
+-- disallowed.
+inferExpr :: IsSrcSpan s => Context -> Pat' s st -> T (TcPat, Type)
+inferExpr ctx pat = case pat of
+  Nat _ w ->
+    promote (sourcePatSpan pat) (RTS.Nat w) NatTy
+    -- how would we do ByteTy?
+  String _ s ->
+    promote (sourcePatSpan pat)
+      (RTS.String (Text.encodeUtf8 s)) StringTy
+  StringPrefix _ s ->
+    promote (sourcePatSpan pat)
+      (RTS.Ref (MatchPrefix (Text.encodeUtf8 s) (mkWild StringTy)))
+      StringTy
+  ByteArray _ b ->
+    promote (sourcePatSpan pat) (RTS.ByteArray b) (ArrayTy ByteTy)
+  (App _ (StringPrefix _ s) [pat]) -> do
+    rest <- typecheckPattern ctx StringTy pat
+    promote (sourcePatSpan pat)
+      (RTS.Ref (MatchPrefix (Text.encodeUtf8 s) rest)) StringTy
+  Tuple _ ts -> do
+    (ts,tys) <- unzip <$> mapM (inferExpr ctx) ts
+    promote (sourcePatSpan pat) (RTS.Tuple ts) (tupleSchema tys)
+  Array _ [] -> do
+    x <- freshTyVar
+    promote (sourcePatSpan pat) (RTS.Array []) (ArrayTy x)
+  Array _ (t:ts) -> do
+    (t',ty) <- inferExpr ctx t
+    ts' <- mapM (typecheckPattern ctx ty) ts
+    promote (sourcePatSpan pat) (RTS.Array (t':ts')) (ArrayTy ty)
+  ArrayPrefix _ (t:|ts) -> do
+    (t',ty) <- inferExpr ctx t
+    ts' <- mapM (typecheckPattern ctx ty) ts
+    let
+      aty = ArrayTy ty
+      tcPat = RTS.Ref (MatchArrayPrefix ty (t':ts') (RTS.Ref (MatchWild aty)))
+    promote (sourcePatSpan pat) tcPat aty
+  Variable span name -> inferVar ctx span name
+  Prim span primOp args -> do
+    (primArgTys, retTy) <- primOpType primOp
+    checkPrimOpArgs span args primArgTys
+    args' <- zipWithM (typecheckPattern ContextExpr) primArgTys args
+    return (RTS.Ref (MatchExt (Typed retTy (TcPrimCall primOp args'))),
+      retTy)
+  Clause _ prSpan pred pat range -> tcFactGenerator pred pat range (Just prSpan)
+  OrPattern _ a b -> do
+    ((a', ty), b') <-
+      disjunction
+        (varsPat a mempty) (inferExpr ctx a)
+        (varsPat b mempty) (\(_,ty) -> typecheckPattern ctx ty b)
+    return (Ref (MatchExt (Typed ty (TcOr a' b'))), ty)
+  NestedQuery _ q -> do
+    q@(TcQuery ty _ _ _ _) <- inferQuery ctx q
+    return (Ref (MatchExt (Typed ty (TcQueryGen q))), ty)
+  Negation _ _ ->
+    (,unit) <$> typecheckPattern ctx unit pat
+  IfPattern _ srcCond srcThen srcElse -> do
+    let tcThen = do
+          (cond, condTy) <- inferExpr ctx (ignoreResult srcCond)
+          (then_, thenTy) <- inferExpr ctx srcThen
+          return (Typed condTy cond, then_, thenTy)
+
+    ((cond, then_, ty), else_) <- disjunction
+      (varsPat srcCond $ varsPat srcThen mempty)
+      tcThen
+      (varsPat srcElse mempty)
+      (\(_,_, thenTy) -> typecheckPattern ctx thenTy srcElse)
+
+    return (Ref (MatchExt (Typed ty (TcIf{..}))), ty)
+
+  ElementsOfArray _ e -> do
+    (e', ty) <- inferExpr ContextExpr e
+    elemTy <- freshTyVar
+    containerTy <- freshTyVarInt
+    unify ty (ElementsOf elemTy containerTy)
+    return (Ref (MatchExt (Typed elemTy (TcElementsUnresolved (TyVar containerTy) e')))
+           ,elemTy)
+
+  Elements _ e -> do
+    (e', ty) <- inferExpr ContextExpr e
+    case ty of
+      SetTy elemTy ->
+        return (Ref (MatchExt (Typed elemTy (TcElementsOfSet e'))), elemTy)
+      _other -> do
+        opts <- gets tcDisplayOpts
+        prettyErrorIn pat $
+          nest 4 $ vcat
+            [ "type error in set element generator:"
+            , "expression: " <> display opts e
+            , "does not have a set type"
+            ]
+  All _ e -> do
+    (e',elementTy) <- inferExpr ctx e
+    let
+      q = TcQuery elementTy e' Nothing [] Unordered
+      ty = SetTy elementTy
+    return (Ref (MatchExt (Typed ty (TcAll q))), ty)
+
+  TypeSignature s e ty -> do
+    rtsType <- gets tcRtsType
+    typ <- convertType s rtsType ty
+    (,typ) <$> typecheckPattern ctx typ e
+
+  v@KeyValue{} -> unexpectedValue v
+
+  FieldSelect _ p field sum -> do
+    (p', ty) <- inferExpr ctx p
+    fieldSelect pat ty p' field sum
+
+  Deref _ p -> do
+    (p', predTy) <- inferExpr ctx p
+    ty <- case predTy of
+      PredicateTy _ (PidRef _ ref) -> do
+        PredicateDetails{..} <- getPredicateDetails ref
+        return predicateKeyType
+      _ -> do
+        y <- freshTyVarInt
+        keyTy <- freshTyVar
+        unify predTy (HasKey keyTy y)
+        return keyTy
+    return (Ref (MatchExt (Typed ty (TcDeref predTy p'))), ty)
+
+  Enum _ "true" -> promote (sourcePatSpan pat) trueVal BooleanTy
+  Enum _ "false" -> promote (sourcePatSpan pat) falseVal BooleanTy
+
+  -- we can infer { just = E } as a maybe:
+  -- TODO: this is wrong really, but there is schema code that relies on it
+  Struct _ [ Field "just" e ] -> do
+    (e', ty) <- inferExpr ctx e
+    return (RTS.Alt 1 e', MaybeTy ty)
+
+  Struct _ fields -> do
+    pairs <- forM fields $ \(Field name expr) -> do
+      (expr', ty) <- inferExpr ctx expr
+      return ((name, expr'), (name, ty))
+    let (fields', types) = unzip pairs
+    x <- freshTyVarInt
+    let
+      must_be_rec
+        | length fields > 1 = Just Record
+        | otherwise = Nothing
+      ty = HasTy (Map.fromList types) must_be_rec x
+    promote (sourcePatSpan pat)
+      (Ref (MatchExt (Typed ty (TcStructPat fields')))) ty
+
+  Wildcard{} -> do
+    x <- freshTyVar
+    return (mkWild x, x)
+
+  Enum _ name -> do
+    x <- freshTyVarInt
+    let ty = HasTy (Map.singleton name unit) Nothing x
+    promote (sourcePatSpan pat)
+      (Ref (MatchExt (Typed ty (TcStructPat [(name, RTS.Tuple [])])))) ty
+
+  _ -> do
+    opts <- gets tcDisplayOpts
+    prettyErrorIn pat $ nest 4 $ vcat
+      [ "can't infer the type of: " <> display opts pat
+      , "try adding a type annotation like (" <> display opts pat <> " : T)"
+      ]
+
+fieldSelect
+  :: IsSrcSpan s
+  => Pat' s st
+  -> Type
+  -> TcPat
+  -> FieldName
+  -> RecordOrSum
+  -> T (TcPat, Type)
+fieldSelect src ty pat fieldName recordOrSum = do
+  opts <- gets tcDisplayOpts
+  let err x = do
+        prettyErrorIn src $ nest 4 $ vcat
+          [ x, "type of expression: " <> display opts ty ]
+  ty' <- apply ty
+  case derefType ty' of
+    PredicateTy _ (PidRef _ ref) -> do
+      TcEnv{..} <- gets tcEnv
+      PredicateDetails{..} <- case HashMap.lookup ref tcEnvPredicates of
+        Nothing -> prettyErrorIn src $ "fieldSelect: " <> displayDefault ref
+        Just details -> return details
+      let deref = TcDeref ty pat
+      fieldSelect src predicateKeyType
+        (Ref (MatchExt (Typed predicateKeyType deref)))
+        fieldName recordOrSum
+    RecordTy fields
+      | Record <- recordOrSum -> case lookupField fieldName fields of
+          (fieldTy,_):_ -> do
+            let sel = TcFieldSelect (Typed ty pat) fieldName
+            return (Ref (MatchExt (Typed fieldTy sel)), fieldTy)
+          _ ->
+            err $ "record does not contain the field '" <>
+              display opts fieldName <> "'"
+      | otherwise -> err $
+        "expression is a record, use '." <> pretty fieldName <>
+          "' not '." <> pretty fieldName <> "?'"
+    SumTy fields
+      | Sum <- recordOrSum -> case lookupField fieldName fields of
+          (fieldTy,_):_ -> do
+            let sel = TcAltSelect (Typed ty pat) fieldName
+            return (Ref (MatchExt (Typed fieldTy sel)), fieldTy)
+          _ ->
+            err $ "union type does not contain the alternative '" <>
+              display opts fieldName <> "'"
+      | otherwise -> err $
+        "expression is a union type, use '." <> pretty fieldName <>
+          "?' not '." <> pretty fieldName <> "'"
+    MaybeTy elemTy ->
+      fieldSelect src (lowerMaybe elemTy) pat fieldName recordOrSum
+    TyVar{} -> do
+      x <- freshTyVarInt
+      fieldTy <- freshTyVar
+      let recTy = HasTy (Map.singleton fieldName fieldTy) (Just recordOrSum) x
+      -- allow the lhs to be a predicate:
+      fn <- demoteTo (sourcePatSpan src) ty' recTy
+      let sel = case recordOrSum of
+            Sum -> TcAltSelect (Typed recTy (fn pat)) fieldName
+            Record -> TcFieldSelect (Typed recTy (fn pat)) fieldName
+      return (Ref (MatchExt (Typed fieldTy sel)), fieldTy)
+    _other ->
+      err $ "expression is not a " <> case recordOrSum of
+        Sum -> "union type"
+        Record -> "record"
+
+convertType
+  :: (IsSrcSpan s)=> s -> ToRtsType -> Schema.Type' st -> T Type
+convertType span rtsType ty = do
+  let ty' = rmLocType ty
+  case rtsType ty' of
+    Just typ -> return typ
+    Nothing -> prettyErrorAt span "cannot convert type"
+
+-- | Check that the pattern has the correct type, and generate the
+-- low-level pattern with type-annotated variables.
+typecheckPattern :: IsSrcSpan s => Context -> Type -> Pat' s st -> T TcPat
+typecheckPattern ctx typ pat = case (typ, pat) of
+  (ByteTy, Nat _ w) -> return (RTS.Byte (fromIntegral w))
+  (NatTy, Nat _ w) -> return (RTS.Nat w)
+  (StringTy, String _ s) ->
+    return (RTS.String (Text.encodeUtf8 s))
+  (StringTy, StringPrefix _ s) ->
+    return (RTS.Ref (MatchPrefix (Text.encodeUtf8 s) (mkWild StringTy)))
+  (StringTy, App _ (StringPrefix _ s) [pat]) -> do
+    pat' <- typecheckPattern ctx StringTy pat
+    return (RTS.Ref (MatchPrefix (Text.encodeUtf8 s) pat'))
+  (ArrayTy ByteTy, String _ s) ->
+    return (RTS.ByteArray (Text.encodeUtf8 s))
+  (ArrayTy ByteTy, ByteArray _ s) ->
+    return (RTS.ByteArray s)
+  (ArrayTy elemTy, Array _ pats) ->
+    RTS.Array <$> mapM (typecheckPattern ctx elemTy) pats
+  (ArrayTy elemTy, ArrayPrefix _ pre) -> do
+    pre <- mapM (typecheckPattern ctx elemTy) pre
+    let match = MatchArrayPrefix elemTy (toList pre) (RTS.Ref (MatchWild typ))
+    return (RTS.Ref match)
+  (RecordTy fields, Tuple _ pats) | length fields == length pats ->
+    RTS.Tuple <$>
+      mapM (\(t,p) -> typecheckPattern ctx t p)
+        (zip (map fieldDefType fields) pats)
+  (RecordTy fieldSchema, Struct _ fields)
+    | all (`elem` map fieldDefName fieldSchema) (map fieldName fields) ->
+      RTS.Tuple <$> mapM doField fieldSchema
+    where
+      fieldName (Field name _) = name
+      doField (FieldDef name ty) =
+        case [ pat | Field name' pat <- fields, name == name' ] of
+          (pat:_) -> typecheckPattern ctx ty pat
+          [] -> return (mkWild ty)
+        -- missing field is a wildcard
+
+  (SumTy fields, Struct _ [Field fieldName pat]) ->
+    case lookupField fieldName fields of
+      (ty, n) :_ -> RTS.Alt n <$> typecheckPattern ctx ty pat
+      _ -> patTypeErrorDesc ("unknown alt: " <> fieldName) pat typ
+
+  -- 'field' is shorthand for '{ field = _ }' when matching a sum type
+  (SumTy fields, Enum _ fieldName)
+    | ((ty, n):_)  <- lookupField fieldName fields ->
+      return (RTS.Alt n (mkWild ty))
+
+  (SumTy _, Struct _ _) ->
+    patTypeErrorDesc
+      "matching on a union type should have the form { field = pattern }"
+      pat typ
+  (NamedTy _ (ExpandedType _ ty), term) -> typecheckPattern ctx ty term
+  (ty, Prim span primOp args) -> do
+    (primArgTys, retTy) <- primOpType primOp
+    checkPrimOpArgs span args primArgTys
+    args' <- zipWithM (typecheckPattern ContextExpr) primArgTys args
+    inPat pat $ unify ty retTy
+    return (RTS.Ref (MatchExt (Typed retTy (TcPrimCall primOp args'))))
+  (PredicateTy _ (PidRef _ ref), Clause _ spanPred ref' arg range) ->
+    if ref == ref'
+      then fst <$> tcFactGenerator ref arg range (Just spanPred)
+      else patTypeError pat typ
+      -- Note: we don't automatically fall back to matching against
+      -- the key type here, unlike in other cases where the expected
+      -- type is a predicate type. Arguably it would be more correct,
+      -- but doing so produces more confusing error messages because
+      -- we report a type error with the key type as the expected type
+      -- instead of the original type from the context.
+  (MaybeTy elemTy, pat) ->
+    typecheckPattern ctx (lowerMaybe elemTy) pat
+
+  (EnumeratedTy names, Enum _ name)
+    | Just n <- elemIndex name names ->
+    return (RTS.Alt (fromIntegral n) (RTS.Tuple []))
+
+  (BooleanTy, Enum _ name)
+    | name == "false" -> return falseVal
+    | name == "true" -> return trueVal
+
+  -- TODO: we don't really want to do this, but it's here for legacy
+  -- reasons. Really we should only allow lower-case identifiers as
+  -- enum constants.
+  (EnumeratedTy names, Variable _ name)
+    | Just n <- elemIndex name names ->
+    return (RTS.Alt (fromIntegral n) (RTS.Tuple []))
+
+  (ty, ElementsOfArray _ pat) -> do
+    containerTy <- freshTyVarInt
+    pat' <- typecheckPattern ContextExpr (ElementsOf ty containerTy) pat
+    return (Ref (MatchExt (Typed ty (
+      TcElementsUnresolved (TyVar containerTy) pat'))))
+
+  (ty, Elements _ pat) -> do
+    containerTy <- freshTyVarInt
+    pat' <- typecheckPattern ContextExpr (ElementsOf ty containerTy) pat
+    return (Ref (MatchExt (Typed ty (
+      TcElementsUnresolved (TyVar containerTy) pat'))))
+
+  (ty, OrPattern _ left right) -> do
+    (left',right') <-
+      disjunction
+        (varsPat left mempty) (typecheckPattern ctx ty left)
+        (varsPat right mempty) (\_ -> typecheckPattern ctx ty right)
+    return (Ref (MatchExt (Typed ty (TcOr left' right'))))
+
+  (ty, IfPattern _ srcCond srcThen srcElse) -> do
+    let tcThen = do
+          (cond,condTy) <- inferExpr ctx (ignoreResult srcCond)
+          then_ <- typecheckPattern ctx ty srcThen
+          return (Typed condTy cond, then_)
+
+    ((cond, then_), else_) <- disjunction
+      (varsPat srcCond $ varsPat srcThen mempty) tcThen
+      (varsPat srcElse mempty) (\_ -> typecheckPattern ctx ty srcElse)
+
+    return (Ref (MatchExt (Typed ty (TcIf cond then_ else_))))
+
+  (ty, NestedQuery _ query) ->
+    Ref . MatchExt . Typed ty . TcQueryGen <$> typecheckQuery ctx ty query
+
+  (ty, Negation s pat) | ty == unit -> do
+    let startPos = mkSpan (startLoc s) (startLoc s)
+        empty = Tuple startPos []
+        (stmts, ord) = case pat of
+          NestedQuery _ (SourceQuery Nothing stmts _) -> (stmts, ord)
+          other -> ([SourceStatement (Wildcard s) other], Unordered)
+
+        -- A negated pattern must always have type {}.
+        query = SourceQuery (Just empty) stmts ord
+
+        -- Variables bound within a negated query are
+        -- not considered bound outside of it.
+        enclose tc = do
+          before <- get
+          modify $ \s -> s {
+            tcVisible = varsPat pat (tcVisible before)
+          }
+          res <- tc
+          modify $ \after -> after
+            { tcBindings = tcBindings before
+            , tcUses = tcUses after `HashSet.intersection` tcVisible before
+            , tcScope = tcScope after
+                `HashMap.intersection` HashSet.toMap (tcVisible before)
+            , tcVisible = tcVisible before
+            }
+          return res
+
+    TcQuery _ _ _ stmts _ <- enclose $ typecheckQuery ctx unit query
+    return $ Ref (MatchExt (Typed unit (TcNegation stmts)))
+
+  (PredicateTy _ _, FactId _ Nothing fid) -> do
+    isFactIdAllowed pat
+    return $ Ref (MatchFid (Fid (fromIntegral fid)))
+
+  (ty, TypeSignature s e sigty) -> do
+    rtsType <- gets tcRtsType
+    sigty' <- convertType s rtsType sigty
+    e' <- typecheckPattern ctx sigty' e
+    f <- promoteTo (sourcePatSpan pat) sigty' ty
+    return (f e')
+
+  (ty@(SetTy elemTy), All _ query) -> do
+    arg <- typecheckPattern ctx elemTy query
+    let q = TcQuery elemTy arg Nothing [] Unordered
+    return (Ref (MatchExt (Typed ty (TcAll q))))
+
+  -- A match on a predicate type with a pattern that is not a wildcard,
+  -- variable, field selector or dereference matches the key.
+  (PredicateTy _ (PidRef _ ref), pat) | matchesKey pat ->
+    fst <$> tcFactGenerator ref pat SeekOnAllFacts Nothing
+
+  (ty, Wildcard{}) -> return (mkWild ty)
+  (ty, Never{}) -> return $ Ref (MatchNever ty)
+  (ty, Variable span name) -> varOcc ctx span name ty
+
+  (_, KeyValue{}) -> unexpectedValue pat
+
+  (ty, _) -> do
+    (p', patTy) <- inferExpr ctx pat
+    inPat pat $ unify ty patTy
+    return p'
+
+tcFactGenerator
+  :: IsSrcSpan s
+  => PredicateId
+  -> Pat' s st
+  -> SeekSection
+  -> Maybe s
+  -> T (TcPat, Type)
+tcFactGenerator ref pat range predSpan = do
+  TcEnv{..} <- gets tcEnv
+  PredicateDetails{..} <- case HashMap.lookup ref tcEnvPredicates of
+    Nothing -> prettyErrorIn pat $ "tcFactGenerator: " <> displayDefault ref
+    Just details -> return details
+  (kpat', vpat') <- case pat of
+    KeyValue _ kpat vpat -> do
+      kpat' <- typecheckPattern ContextPat predicateKeyType kpat
+      vpat' <- typecheckPattern ContextPat predicateValueType vpat
+      return (kpat', vpat')
+    _other -> do
+      kpat' <- typecheckPattern ContextPat predicateKeyType pat
+      return (kpat', mkWild predicateValueType)
+  let
+    pidRef = PidRef predicatePid ref
+    ty = PredicateTy () pidRef
+
+  case predSpan of
+    Just span -> do
+      modify $ \s -> s {
+        tcPreds = (pidRef,Some span):tcPreds s
+      }
+    Nothing -> return ()
+  return
+    ( Ref (MatchExt (Typed ty (TcFactGen pidRef kpat' vpat' range)))
+    , ty)
+
+matchesKey :: IsSrcSpan s => Pat' s st-> Bool
+matchesKey Wildcard{} = False
+matchesKey Variable{} = False
+matchesKey FieldSelect{} = False
+matchesKey Deref{} = False
+matchesKey _ = True
+
+-- | Fact Id patterns (#1234 or #pred 1234) are only allowed in
+-- queries, not in derived predicates, because they potentially allow
+-- a type-incorrect fact to be constructed.
+isFactIdAllowed :: IsSrcSpan s => Pat' s st-> T ()
+isFactIdAllowed pat = do
+  mode <- gets tcMode
+  opts <- gets tcDisplayOpts
+  when (mode /= TcModeQuery) $ prettyErrorIn pat $
+    "fact IDs are not allowed in a derived predicate: " <>
+      display opts pat
+
+falseVal, trueVal :: TcPat
+falseVal = RTS.Alt 0 (RTS.Tuple [])
+trueVal = RTS.Alt 1 (RTS.Tuple [])
+
+patTypeError :: (IsSrcSpan s) => Pat' s st-> Type -> T a
+patTypeError = patTypeErrorDesc "type error in pattern"
+
+patTypeErrorDesc :: (IsSrcSpan s) => Text -> Pat' s st-> Type -> T a
+patTypeErrorDesc desc q ty = do
+  opts <- gets tcDisplayOpts
+  prettyErrorIn q $
+    nest 4 $ vcat
+      [ pretty desc
+      , "pattern: " <> display opts q
+      , "expected type: " <> display opts ty
+      ]
+
+bindOrUse :: Context -> Name -> TypecheckState -> TypecheckState
+bindOrUse ContextExpr name state =
+  state { tcUses = HashSet.insert name (tcUses state) }
+bindOrUse ContextPat name state =
+  state { tcBindings = HashSet.insert name (tcBindings state) }
+
+inferVar :: IsSrcSpan span => Context -> span -> Name -> T (TcPat, Type)
+inferVar ctx span name = do
+  checkVarCase span name
+  state@TypecheckState{..} <- get
+  case HashMap.lookup name tcScope of
+    Just v@(Var ty _ _) -> do
+      put $ bindOrUse ctx name $ state { tcFree = HashSet.delete name tcFree }
+      return (Ref (MatchVar v), ty)
+    Nothing -> do
+      x <- freshTyVar
+      p <- varOcc ctx span name x
+      return (p,x)
+
+varOcc :: IsSrcSpan span => Context -> span -> Name -> Type -> T TcPat
+varOcc ctx span name ty = do
+  checkVarCase span name
+  state@TypecheckState{..} <- get
+  case HashMap.lookup name tcScope of
+    Nothing -> do
+      let
+        var = Var ty tcNextVar (Just name)
+        !next = tcNextVar + 1
+      put $ bindOrUse ctx name $ state
+        { tcNextVar = next
+        , tcScope = HashMap.insert name var tcScope
+        , tcFree = HashSet.insert name tcFree
+        , tcVars = IntMap.insert tcNextVar var tcVars
+        }
+      return (RTS.Ref (MatchBind var))
+    Just v@(Var ty' _ _) -> do
+      put $ bindOrUse ctx name $
+        state { tcFree = HashSet.delete name tcFree }
+      addErrSpan span $ unify ty ty'
+      return (Ref (MatchVar v))
+
+freshVariable :: IsSrcSpan s => s -> T (Pat' s st)
+freshVariable s = do
+  state@TypecheckState{..} <- get
+  let !next = tcNextVar + 1
+      name = "Tmp__" <> showt tcNextVar
+  put state {
+    tcNextVar = next,
+    tcVisible = HashSet.insert name tcVisible }
+    -- setting tcVisible here is a bit of a hack, but it should be OK
+    -- as long as the fresh variable is used in the current scope and
+    -- not a nested scope.
+  return (Variable s name)
+
+freeVariablesAreErrors :: T ()
+freeVariablesAreErrors = do
+  free <- gets tcFree
+  when (not (HashSet.null free)) $
+    prettyError $ nest 4 $ vcat
+      [ "One or more variables were mentioned only once: " <>
+          hsep (punctuate "," (map pretty (HashSet.toList free)))
+      , "This is usually a mistake, so it is disallowed in Angle."
+      ]
+
+unboundVariablesAreErrors :: T ()
+unboundVariablesAreErrors = do
+  TypecheckState{..} <- get
+  unboundVariablesAreErrors_ tcUses tcBindings
+
+unboundVariablesAreErrors_ :: VarSet -> VarSet -> T ()
+unboundVariablesAreErrors_ uses binds = do
+  case HashSet.toList (uses `HashSet.difference` binds) of
+    [] -> return ()
+    badGuys -> prettyError $ nest 4 $ vcat
+      [ "One or more variables were not bound anywhere: " <>
+          hsep (punctuate "," (map pretty badGuys))
+      , "All variables must occur at least once in a context that will bind"
+      , "the variable to a value; i.e., *not*"
+      , "  * the argument of a primitive"
+      , "  * the array in an array generator Arr[..]"
+      , "A variable that is bound in just one side of '|'"
+       <+> "cannot be used outside of the '|'"
+      , "A variable that is bound in a negated query '!(...)'"
+       <+> "cannot be used outside of it"
+      ]
+
+checkVarCase :: IsSrcSpan span => span -> Name -> T ()
+checkVarCase span name
+  | Just (h,_) <- Text.uncons name, not (isUpper h) = do
+    prettyErrorAt span $
+      "variable does not begin with an upper-case letter: " <>
+        pretty name
+  | otherwise = return ()
+
+-- | Typechecking A|B
+--
+-- 1. The set of variables that are considered to be *bound* by this
+--    pattern are those that are bound in both branches.
+--
+-- 2. The set of variables that are considered to be *used* by this
+--    pattern are those that are used in either branch.
+--
+disjunction :: VarSet -> T a -> VarSet -> (a -> T b) -> T (a,b)
+disjunction varsA ta varsB tb = do
+  state0 <- get
+  (a, usesA, bindsA) <- oneBranch varsA ta
+  (b, usesB, bindsB) <- oneBranch varsB (tb a)
+  modify  $ \s -> s {
+    tcBindings = tcBindings state0 `HashSet.union` -- Note (1) above
+      (bindsA `HashSet.intersection` bindsB),
+    tcUses = tcUses state0 `HashSet.union` -- Note (2) above
+      (usesA `HashSet.union` usesB) }
+  return (a,b)
+
+-- | Typechecking either A or B in A|B
+--
+-- 1. Variables that are not visible in the enclosing scope are local
+--    to the inner scope, we therefore remove them from tcScope after
+--    typechecking the branch.
+--
+-- 2. Local variables must be bound locally, or we report an error.
+--
+-- 3. To determine what is local to any nested A|B subterms, we update
+--    tcVisible by finding the visible variables of the current pattern.
+--
+oneBranch :: VarSet -> T a -> T (a, VarSet, VarSet)
+oneBranch branchVars ta = do
+  visibleBefore  <- gets tcVisible
+  modify $ \s -> s {
+    tcUses = HashSet.empty,
+    tcBindings = HashSet.empty,
+    tcVisible = visibleBefore `HashSet.union` branchVars }
+      -- See Note (3) above
+  a <- ta
+  after <- get
+  let
+    localUses = HashSet.difference (tcUses after) visibleBefore
+    localBinds = HashSet.difference (tcBindings after) visibleBefore
+  unboundVariablesAreErrors_ localUses localBinds
+  modify $ \s -> s
+    { tcScope = HashMap.intersection
+        (tcScope after)
+        (HashSet.toMap visibleBefore)
+       -- See Note (1) above
+    , tcVisible = visibleBefore }
+  let
+    extUses = HashSet.intersection (tcUses after) visibleBefore
+    extBinds = HashSet.intersection (tcBindings after) visibleBefore
+  return (a, extUses, extBinds)
+
+checkPrimOpArgs :: IsSrcSpan s => s -> [Pat' s st] -> [Type] -> T ()
+checkPrimOpArgs span args tys
+  | length args /= length tys =
+    prettyErrorAt span
+      $ "expected " <> pretty (length tys)
+      <> " arguments, found " <> pretty (length args)
+  | otherwise = return ()
+
+-- Several primops have polymorphic types, e.g.
+--
+--   prim.length : forall a . [a] -> nat
+--
+-- There's no first-class support for polymorphic types in the type
+-- checker, but for primops we can just generate a fresh instantiation
+-- of the primop's type for each call.
+
+primOpType :: PrimOp -> T ([Type], Type)
+primOpType op = case op of
+  PrimOpToLower -> return ([StringTy], StringTy)
+  PrimOpLength -> do
+    x <- freshTyVar
+    return ([ArrayTy x], NatTy)
+  PrimOpZip -> do
+    x <- freshTyVar
+    y <- freshTyVar
+    return ([ArrayTy x, ArrayTy y], ArrayTy (tupleSchema [x,y]))
+  PrimOpConcat -> do
+    x <- freshTyVar
+    return ([ArrayTy x, ArrayTy x], ArrayTy x)
+  PrimOpReverse -> return  ([StringTy], StringTy)
+  PrimOpSize -> do
+    x <- freshTyVar
+    return ([SetTy x], NatTy)
+  PrimOpRelToAbsByteSpans ->
+    -- prim.relToAbsByteSpans takes an array of pairs as input and
+    -- returns an array of pairs as output
+    return (
+      [ArrayTy (tupleSchema [NatTy, NatTy])],
+      ArrayTy (tupleSchema [NatTy, NatTy]))
+  PrimOpUnpackByteSpans ->
+    -- prim.unpackByteSpans takes an array of (nat, [nat]) as input and
+    -- returns an array of pairs as output
+    return (
+      [ArrayTy (tupleSchema [NatTy, ArrayTy NatTy])],
+      ArrayTy (tupleSchema [NatTy, NatTy]))
+  PrimOpGtNat -> binaryNatOp
+  PrimOpGeNat -> binaryNatOp
+  PrimOpLtNat -> binaryNatOp
+  PrimOpLeNat -> binaryNatOp
+  PrimOpNeNat -> binaryNatOp
+  PrimOpAddNat -> return ([NatTy, NatTy], NatTy)
+  PrimOpNeExpr -> do
+    x <- freshTyVar
+    return ([x,x], unit)
+  where
+    binaryNatOp = return ([NatTy, NatTy], unit)
+
+type VarSet = HashSet Name
+
+-- Variables visible in the pattern's enclosing scope.
+--
+-- 1. or-patterns, negations and if statements don't bring variables into a
+--    scope. They can bind variables that are already part of the scope, but if
+--    the same variable appears in all branches but not in the enclosing scope
+--    then each occurrence will be treated as a separate variable.
+varsPat :: IsSrcSpan s => Pat' s st -> VarSet -> VarSet
+varsPat pat r = case pat of
+  Variable _ v -> HashSet.insert v r
+  Array _ ps -> foldr varsPat r ps
+  ArrayPrefix _ ps -> foldr varsPat r ps
+  Tuple _ ps -> foldr varsPat r ps
+  Struct _ fs -> foldr (\(Field _ p) r -> varsPat p r) r fs
+  App _ f ps -> varsPat f $! foldr varsPat r ps
+  KeyValue _ k v -> varsPat k (varsPat v r)
+  ElementsOfArray _ p -> varsPat p r
+  All _ qs -> varsPat qs r
+  Elements _ pat -> varsPat pat r
+  OrPattern{} -> r -- ignore nested or-patterns. Note (1) above
+  IfPattern{} -> r -- ignore nested if-patterns
+  NestedQuery _ q -> varsQuery q r
+  Negation{} -> r -- Note (1) above
+  TypeSignature _ p _ -> varsPat p r
+  Nat{} -> r
+  String{} -> r
+  StringPrefix{} -> r
+  ByteArray{} -> r
+  Wildcard{} -> r
+  FactId{} -> r
+  Never{} -> r
+  Clause _ _ _ p _ -> varsPat p r
+  Prim _ _ ps -> foldr varsPat r ps
+  FieldSelect _ p _ _ -> varsPat p r
+  Deref _ p -> varsPat p r
+  Enum{} -> r
+
+varsQuery :: IsSrcSpan s => Query' s st -> VarSet -> VarSet
+varsQuery (SourceQuery head stmts _) r =
+  foldr varsStmt (foldr varsPat r head) stmts
+  where
+  varsStmt (SourceStatement a b) r = varsPat a $! varsPat b r
+
+-- | Capture all predicates that appear in a query
+tcQueryDeps :: TcQuery -> Set PredicateId
+tcQueryDeps q = Set.fromList $ map getRef (overQuery q)
+  where
+    getRef (PidRef _ ref) = ref
+
+    overQuery :: TcQuery -> [PidRef]
+    overQuery (TcQuery ty key mval stmts _) =
+      overType ty
+        <> overPat key
+        <> maybe [] overPat mval
+        <> foldMap overStatement stmts
+
+    overType :: Type -> [PidRef]
+    overType ty = bifoldMap pure (\(ExpandedType _ ty) -> overType ty) ty
+
+    overStatement :: TcStatement -> [PidRef]
+    overStatement (TcStatement ty lhs rhs) =
+     overType ty <> overPat lhs <> overPat rhs
+
+    overPat :: TcPat -> [PidRef]
+    overPat pat = foldMap (bifoldMap overTyped (const mempty)) pat
+
+    overTyped :: Typed TcTerm -> [PidRef]
+    overTyped (Typed ty tcTerm) = overType ty <> overTerm tcTerm
+
+    overTerm :: TcTerm -> [PidRef]
+    overTerm = \case
+      TcOr x y -> overPat x <> overPat y
+      TcFactGen pref x y _ -> pref : overPat x <> overPat y
+      TcElementsOfArray x -> overPat x
+      TcElementsOfSet x -> overPat x
+      TcElementsUnresolved _ x -> overPat x
+      TcQueryGen q -> overQuery q
+      TcAll q -> overQuery q
+      TcNegation stmts -> foldMap overStatement stmts
+      TcPrimCall _ xs -> foldMap overPat xs
+      TcIf (Typed _ x) y z -> foldMap overPat [x, y, z]
+      TcDeref _ p -> overPat p
+      TcFieldSelect (Typed _ p) _ -> overPat p
+      TcAltSelect (Typed _ p) _ -> overPat p
+      TcPromote _ p -> overPat p
+      TcDemote _ p -> overPat p
+      TcStructPat fs -> foldMap overPat (map snd fs)
+
+data UseOfNegation
+  = PatternNegation
+  | IfStatement
+
+-- | Whether a query uses negation in its definition.
+-- Does not check for transitive uses of negation.
+tcQueryUsesNegation :: TcQuery -> Maybe UseOfNegation
+tcQueryUsesNegation (TcQuery _ _ _ stmts _) =
+  firstJust tcStatementUsesNegation stmts
+
+tcStatementUsesNegation :: TcStatement -> Maybe UseOfNegation
+tcStatementUsesNegation (TcStatement _ lhs rhs) =
+  tcPatUsesNegation lhs <|> tcPatUsesNegation rhs
+
+tcPatUsesNegation :: TcPat -> Maybe UseOfNegation
+tcPatUsesNegation = \case
+  RTS.Byte _ -> Nothing
+  RTS.Nat _ -> Nothing
+  RTS.Array xs -> firstJust tcPatUsesNegation xs
+  RTS.ByteArray _ -> Nothing
+  RTS.Tuple xs -> firstJust tcPatUsesNegation xs
+  RTS.Alt _ t -> tcPatUsesNegation t
+  RTS.String _ -> Nothing
+  RTS.Ref match -> matchUsesNegation match
+
+matchUsesNegation  :: Match (Typed TcTerm) Var -> Maybe UseOfNegation
+matchUsesNegation = \case
+  MatchWild _ -> Nothing
+  MatchNever _ -> Nothing
+  MatchFid _ -> Nothing
+  MatchBind _ -> Nothing
+  MatchVar _ -> Nothing
+  MatchAnd one two -> tcPatUsesNegation one <|> tcPatUsesNegation two
+  MatchPrefix _ x -> tcPatUsesNegation x
+  MatchArrayPrefix _ty prefix all ->
+    firstJust tcPatUsesNegation prefix <|> tcPatUsesNegation all
+  MatchExt (Typed _ tcterm) -> tcTermUsesNegation tcterm
+
+tcTermUsesNegation  :: TcTerm -> Maybe UseOfNegation
+tcTermUsesNegation = \case
+  TcOr x y -> tcPatUsesNegation x <|> tcPatUsesNegation y
+  TcFactGen _ x y _ -> tcPatUsesNegation x <|> tcPatUsesNegation y
+  TcElementsOfArray x -> tcPatUsesNegation x
+  TcElementsOfSet x -> tcPatUsesNegation x
+  TcElementsUnresolved _ p -> tcPatUsesNegation p
+  TcQueryGen q -> tcQueryUsesNegation q
+  TcAll query -> tcQueryUsesNegation query
+  TcNegation _ -> Just PatternNegation
+  TcPrimCall _ xs -> firstJust tcPatUsesNegation xs
+  -- one can replicate negation using if statements
+  TcIf{} -> Just IfStatement
+  TcDeref _ p -> tcPatUsesNegation p
+  TcFieldSelect (Typed _ p) _ -> tcPatUsesNegation p
+  TcAltSelect (Typed _ p) _ -> tcPatUsesNegation p
+  TcPromote _ p -> tcPatUsesNegation p
+  TcDemote _ p -> tcPatUsesNegation p
+  TcStructPat fs -> firstJust tcPatUsesNegation (map snd fs)
+
+{-
+Note [Promotion]
+----------------
+
+When we see an expression like 42 or "abc" we want the expression to
+be able to stand for either
+   1. the literal value
+   2. a fact whose key is the literal value
+
+This is very convenient when writing patterns, e.g. we want to be able
+to write
+
+   X = hack.ClassDeclaration { name = { name = "Glean" } }
+
+and not
+
+   X = hack.ClassDeclaration { name = hack.QName { name = hack.Name "Glean" } }
+
+but we don't always know at the time we're typechecking the expression
+whether we need it to be promoted to the predicate type or not, we may
+only know this later. For example:
+
+   X = { name = { name = "Glean" } }
+   X : hack.ClassDeclaration
+
+when checking the first statement we don't know the desired type of
+the pattern.
+
+So we have to defer the choice about whether to promote types to a
+predicate type or not. This is what `promote` and `promoteTo` below
+do.
+
+Promotion can happen any time we have a concrete expression: string,
+nat, record, enum constant, and so on. For example, when we're
+inferring the type of a string, we invent a new type variable, and
+record the potential promotion in the TypecheckState (tcPromote).
+
+   infer "abc" = (^"abc", X)   (X is a fresh type variable)
+     { promote: string -> X }
+
+(the syntax ^expr means "promoted", represented by the TcPromote
+constructor in TcTerm)
+
+At the end of typechecking we hope that X has been instantiated to
+either string or a predicate type, and we can then resolve the
+TcPromote to either nothing (in the case of string) or a TcFactGen (in
+the case of a predicate type).
+
+Resolving promotions
+--------------------
+
+In general we may have many constraints in tcPromote to resolve. There
+will be a set of constraints like
+
+  From -> To
+
+where From is never a type variable. To can be
+ a. a predicate with key = From
+ b. equal to From
+ c. a type variable
+
+We can deal with (a) and (b) immediately. What about (c)?
+
+We might have a chain, e.g.
+  {a : P} -> {a : X}   (1)
+  {b : nat} -> X       (2)
+
+We should resolve (1) first, because that influences (2).  So we have
+to resolve all the cases where the rhs is known, and then try
+again. This is what resolvePromote does.
+
+Strictly speaking this doesn't handle all cases and it could be
+inefficient. We should build a graph of the constraints and evaluate
+them in dependency order. What if there's a loop? Can that happen? I
+haven't seen this go wrong with any examples yet and the worst that
+can happen is you get a type error and have to add a type signature to
+help the type checker.
+-}
+
+promote :: IsSrcSpan s => s -> TcPat -> Type -> T (TcPat, Type)
+promote s pat t = do
+  y <- freshTyVar
+  addPromote s t y
+  return (Ref $ MatchExt $ Typed y $ TcPromote t pat, y)
+
+promoteTo :: IsSrcSpan s => s -> Type -> Type -> T (TcPat -> TcPat)
+promoteTo _ TyVar{} _ = error "promote: TyVar"
+  -- we never promote an unknown type
+promoteTo s t (TyVar x) = do
+  -- x could be Predicate t, or it could be t
+  subst <- gets tcSubst
+  case IntMap.lookup x subst of
+    Just u -> promoteTo s t u
+    Nothing -> do
+      addPromote s t (TyVar x)
+      return (Ref . MatchExt . Typed (TyVar x) . TcPromote t)
+promoteTo _ (PredicateTy _ (PidRef p _)) (PredicateTy _ (PidRef q _))
+  | p == q = return id
+    -- if not equal, q must be the key of p, so fall through
+    -- (assume we don't have  predicate P : P)
+promoteTo s t u@(PredicateTy _ (PidRef _ ref) ) = do
+  PredicateDetails{..} <- getPredicateDetails ref
+  addErrSpan s $ unify predicateKeyType t
+  return (Ref . MatchExt . Typed u . TcPromote t)
+promoteTo s t u = do
+  -- the target type (u) is not a predicate or a tyvar, so it must be
+  -- the key type and we can unify directly.
+  addErrSpan s $ unify t u
+  return id
+
+-- | dual to promoteTo. The destination type cannot be a TyVar.
+demoteTo :: IsSrcSpan s => s -> Type -> Type -> T (TcPat -> TcPat)
+demoteTo _ _ TyVar{} = error "demote: TyVar"
+demoteTo s t@(TyVar x) u = do
+  subst <- gets tcSubst
+  case IntMap.lookup x subst of
+    Just t -> demoteTo s t u
+    Nothing -> do
+      addPromote s u (TyVar x)
+      return (Ref . MatchExt . Typed u . TcDemote t)
+demoteTo _ (PredicateTy _ (PidRef p _)) (PredicateTy _ (PidRef q _))
+  | p == q = return id
+demoteTo s t@(PredicateTy _ (PidRef _ ref)) u = do
+  PredicateDetails{..} <- getPredicateDetails ref
+  addErrSpan s $ unify predicateKeyType u
+  return (Ref . MatchExt . Typed u . TcDemote t)
+demoteTo s t u = do
+  -- the source type (t) is not a predicate or a tyvar, so it must be
+  -- the key type and we can unify directly.
+  addErrSpan s $ unify t u
+  return id
+
+addPromote :: IsSrcSpan s => s -> Type -> Type -> T ()
+addPromote span from to =
+  modify $ \s ->
+    s { tcPromote = (from, to, Some span) : tcPromote s }
+
+resolvePromote :: T ()
+resolvePromote = do
+  promotes <- gets tcPromote
+  let
+    resolve
+      :: [(Type,Type,Some IsSrcSpan)]
+      -> Bool
+      -> T [(Type,Type,Some IsSrcSpan)]
+    resolve promotes defaultTyVars = fmap catMaybes $
+      forM promotes $ \(from, to, Some span) -> do
+        to' <- apply to
+        -- we know from is not a TyVar
+        case (from,to') of
+          (TyVar{}, _) -> error "resolvePromote: tyvar"
+          (PredicateTy _ (PidRef _ ref), PredicateTy _ (PidRef _ ref'))
+            | ref == ref' -> return Nothing
+          (_other, PredicateTy _ (PidRef _ ref)) -> do
+            PredicateDetails{..} <- getPredicateDetails ref
+            addErrSpan span $ unify predicateKeyType from
+            return Nothing
+          (_other, TyVar{}) | not defaultTyVars ->
+            return (Just (from, to', Some span))
+          _other -> do
+            addErrSpan span $ unify from to'
+            return Nothing
+
+    loop [] = return ()
+    loop promotes = do
+      whenDebug $ liftIO $ hPutStrLn stderr $ show $ vcat
+        [ "promotes: "
+        , vcat
+          [ displayDefault from <> " -> " <> displayDefault to
+          | (from,to,_) <- promotes
+          ]
+        ]
+      resolved <- resolve promotes False
+      if length resolved < length promotes
+        then loop resolved
+        else do
+          -- only default unconstrained promotions when there's
+          -- nothing else we can do.
+          resolved2 <- resolve resolved True
+          loop resolved2
+
+  loop promotes
diff --git a/glean/db/Glean/Query/Typecheck/Monad.hs b/glean/db/Glean/Query/Typecheck/Monad.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Typecheck/Monad.hs
@@ -0,0 +1,187 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Typecheck.Monad (
+    T,
+    ToRtsType,
+    TypecheckState(..),
+    TcOpts(..),
+    TcMode(..),
+    defaultTcOpts,
+    TcEnv(..),
+    emptyTcEnv,
+    initialTypecheckState,
+    whenDebug,
+    freshTyVar,
+    freshTyVarInt,
+    getPredicateDetails,
+    mkWild,
+
+    -- * Errors
+    prettyError,
+    prettyErrorIn,
+    prettyErrorAt,
+    inPat,
+    addErrSpan,
+  ) where
+
+import Control.Monad
+import Control.Monad.Except
+import Control.Monad.State
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashSet as HashSet
+import Data.HashSet (HashSet)
+import qualified Data.IntMap as IntMap
+import Data.IntMap (IntMap)
+import Compat.Prettyprinter hiding ((<>), enclose)
+
+import Glean.Angle.Types hiding (Type)
+import qualified Glean.Angle.Types as Schema
+import qualified Glean.Database.Config as Config
+import Glean.Database.Schema.Types
+import Glean.Display
+import Glean.Query.Typecheck.Types
+import Glean.Query.Codegen.Types
+import qualified Glean.RTS.Term as RTS
+import Glean.RTS.Types as RTS
+import Glean.Util.Some
+
+type T a = StateT TypecheckState (ExceptT (Doc ()) IO) a
+
+type ToRtsType = Schema.Type' () -> Maybe Type
+
+whenDebug :: T () -> T ()
+whenDebug act = do
+  lvl <- gets tcDebug
+  when lvl act
+
+freshTyVarInt :: T Int
+freshTyVarInt = do
+  TypecheckState{tcNextTyVar = n} <- get
+  modify $ \s -> s { tcNextTyVar = n+1 }
+  return n
+
+freshTyVar :: T Type
+freshTyVar = TyVar <$> freshTyVarInt
+
+data TcMode = TcModeQuery | TcModePredicate
+  deriving Eq
+
+data TcEnv = TcEnv
+  { tcEnvTypes :: HashMap TypeId TypeDetails
+  , tcEnvPredicates :: HashMap PredicateId PredicateDetails
+  }
+
+emptyTcEnv :: TcEnv
+emptyTcEnv = TcEnv HashMap.empty HashMap.empty
+
+data TypecheckState = TypecheckState
+  { tcEnv :: TcEnv
+  , tcAngleVersion :: AngleVersion
+  , tcDebug :: !Bool
+  , tcRtsType :: ToRtsType
+  , tcNextVar :: {-# UNPACK #-} !Int
+  , tcNextTyVar :: {-# UNPACK #-} !Int
+  , tcScope :: HashMap Name Var
+    -- ^ Variables that we have types for, and have allocated a Var
+  , tcVisible :: HashSet Name
+    -- ^ Variables that are currently visible
+  , tcFree :: HashSet Name
+    -- ^ Variables that are mentioned only once
+  , tcUses :: HashSet Name
+    -- ^ Accumulates variables that appear in an ContextExpr context
+  , tcBindings :: HashSet Name
+    -- ^ Accumulates variables that appear in an ContextPat context
+  , tcMode :: TcMode
+  , tcDisplayOpts :: DisplayOpts
+    -- ^ Options for pretty-printing
+  , tcVars :: IntMap Var
+  , tcSubst :: IntMap Type
+  , tcPromote :: [(Type, Type, Some IsSrcSpan)]
+  , tcPreds :: [TcPred]
+  -- ^ predicate identifiers in query, used for diagnostics
+  }
+
+data TcOpts = TcOpts
+  { tcOptDebug :: !Config.DebugFlags
+  , tcOptAngleVersion :: !AngleVersion
+  }
+
+defaultTcOpts :: Config.DebugFlags -> AngleVersion -> TcOpts
+defaultTcOpts debug v = TcOpts
+  { tcOptDebug = debug
+  , tcOptAngleVersion = v
+  }
+
+initialTypecheckState
+  :: TcEnv
+  -> TcOpts
+  -> ToRtsType
+  -> TcMode
+  -> TypecheckState
+initialTypecheckState tcEnv TcOpts{..} rtsType mode = TypecheckState
+  { tcEnv = tcEnv
+  , tcAngleVersion = tcOptAngleVersion
+  , tcDebug = Config.tcDebug tcOptDebug
+  , tcRtsType = rtsType
+  , tcNextVar = 0
+  , tcNextTyVar = 0
+  , tcScope = HashMap.empty
+  , tcVisible = HashSet.empty
+  , tcFree = HashSet.empty
+  , tcUses = HashSet.empty
+  , tcBindings = HashSet.empty
+  , tcMode = mode
+  , tcDisplayOpts = defaultDisplayOpts
+      -- might make this configurable with flags later
+  , tcSubst = IntMap.empty
+  , tcVars = IntMap.empty
+  , tcPromote = []
+  , tcPreds = []
+  }
+
+getPredicateDetails :: PredicateId -> T PredicateDetails
+getPredicateDetails pred = do
+  TcEnv{..} <- gets tcEnv
+  case HashMap.lookup pred tcEnvPredicates of
+    Nothing -> error $ "predicateKeyTYpe: " <> show (displayDefault pred)
+    Just d -> return d
+
+-- Smart constructor for wildcard patterns; replaces a wildcard that
+-- matches the unit type with a concrete pattern.  This is necessary
+-- when we have an enum in an expression position: we can't translate
+-- @nothing@ into @{ nothing = _ }@ because the wildcard would be
+-- illegal in an expression.
+mkWild :: Type -> TcPat
+mkWild ty
+  | RecordTy [] <- derefType ty = RTS.Tuple []
+  | otherwise = RTS.Ref (MatchWild ty)
+
+prettyError :: Doc () -> T a
+prettyError = throwError
+
+prettyErrorIn :: IsSrcSpan s => SourcePat_ s st p t -> Doc () -> T a
+prettyErrorIn pat doc = prettyErrorAt (sourcePatSpan pat) doc
+
+prettyErrorAt :: IsSrcSpan span => span -> Doc () -> T a
+prettyErrorAt span doc = prettyError $ vcat
+  [ pretty span
+  , doc
+  ]
+
+inPat :: (IsSrcSpan s) => SourcePat_ s st p t -> T a -> T a
+inPat pat = addErrSpan (sourcePatSpan pat)
+
+addErrSpan :: (IsSrcSpan s) => s -> T a -> T a
+addErrSpan span act = do
+  act `catchError` \errDoc -> do
+    prettyError $ vcat
+      [ pretty span
+      , errDoc
+      ]
diff --git a/glean/db/Glean/Query/Typecheck/Types.hs b/glean/db/Glean/Query/Typecheck/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Typecheck/Types.hs
@@ -0,0 +1,139 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Typecheck.Types
+  ( TypecheckedQuery
+  , TcQuery(..)
+  , TcStatement(..)
+  , TcPat
+  , TcPred
+  , TcTerm(..)
+  , lookupField
+  ) where
+
+import Compat.Prettyprinter hiding ((<>), enclose)
+import Data.Word
+
+import Glean.Query.Codegen.Types
+  (Match(..), Var(..), QueryWithInfo(..), Typed(..))
+import Glean.Angle.Types hiding (Type)
+import Glean.Display
+import Glean.RTS.Types as RTS
+import Glean.RTS.Term as RTS
+import Glean.Util.Some
+
+-- | The typechecking phase turns 'ParsedPat' (source-level terms) into
+-- 'TcPat' (representational terms), but it doesn't flatten nested
+-- generators, so it leaves the query as a 'SourceQuery'.
+data TcQuery = TcQuery Type TcPat (Maybe TcPat) [TcStatement] Ordered
+  deriving Show
+
+instance Display TcQuery where
+  display opts (TcQuery _ key maybeVal stmts _ord) = case stmts of
+    [] -> head
+    _ ->
+      hang 2 $ sep $ head <+>
+        "where" : punctuate ";" (map (display opts) stmts)
+        -- TODO: syntax for ordering
+    where
+   head = display opts key <>
+     maybe mempty (\val -> " -> " <> display opts val) maybeVal
+
+data TcStatement = TcStatement Type TcPat TcPat
+  deriving Show
+
+instance Display TcStatement where
+  display opts (TcStatement _ lhs rhs) = displayStatement opts lhs rhs
+
+type TcPat = Term (Match (Typed TcTerm) Var)
+type TcPred = (PidRef,Some IsSrcSpan)
+
+data TcTerm
+  = TcOr TcPat TcPat
+  | TcFactGen PidRef TcPat TcPat SeekSection
+  | TcElementsOfArray TcPat
+  | TcElementsOfSet TcPat
+  | TcElementsUnresolved Type TcPat
+  | TcQueryGen TcQuery
+  | TcAll TcQuery
+  | TcNegation [TcStatement]
+  | TcPrimCall PrimOp [TcPat]
+  | TcIf { cond :: Typed TcPat, then_ :: TcPat, else_ :: TcPat }
+  | TcDeref Type TcPat
+    -- pat.* : if pat has predicate type, evaluates to the key(s).
+  | TcFieldSelect (Typed TcPat) FieldName
+  | TcAltSelect (Typed TcPat) FieldName
+  | TcPromote Type TcPat
+    -- Typed B (TcPromote A P) ("promote pat P from type A to type B")
+    --   - P : A, and either
+    --     - A == B, or
+    --     - B = P, where P : A for some predicate P
+    -- Turns into either nothing or TcFactGen after typechecking
+  | TcDemote Type TcPat
+  | TcStructPat [(FieldName, TcPat)]
+    -- An unresolved pattern matching a record or sum type.
+  deriving Show
+
+instance Display TcTerm where
+  display opts (TcOr a b) = display opts a <+> "|" <+> display opts b
+  display opts (TcDeref _ pat) = displayAtom opts pat <> ".*"
+  display opts (TcFieldSelect (Typed _ pat) field) =
+    displayAtom opts pat <> "." <> pretty field
+  display opts (TcAltSelect pat field) =
+    displayAtom opts pat <> ".?" <> pretty field
+  display opts (TcIf (Typed _ cond) then_ else_) = sep
+    [ nest 2 $ sep ["if", displayAtom opts cond ]
+    , nest 2 $ sep ["then", displayAtom opts then_]
+    , nest 2 $ sep ["else", displayAtom opts else_]
+    ]
+  display opts (TcFactGen pid kpat vpat _range)
+    | isWild vpat || isUnit vpat =
+      nest 2 $ sep [display opts pid, displayAtom opts kpat]
+    | otherwise =
+      nest 2 $ sep
+        [ display opts pid
+        , displayAtom opts kpat
+        , "->" <+> displayAtom opts vpat ]
+    where
+    isUnit (RTS.Tuple []) = True
+    isUnit _ = False
+  display opts (TcElementsOfArray arr) = displayAtom opts arr <> "[..]"
+  display opts (TcElementsOfSet set) = "elements" <+> parens (display opts set)
+  display opts (TcElementsUnresolved _ pat) = displayAtom opts pat <> "[..]"
+  display opts (TcQueryGen q) = parens (display opts q)
+  display opts (TcAll query)
+    = "all" <+> "(" <> display opts query <> ")"
+  display opts (TcNegation q) =
+    "!" <> parens (sep (punctuate ";" (map (display opts) q)))
+  display opts (TcPrimCall op args) =
+    hsep (display opts op : map (displayAtom opts) args)
+  display opts (TcPromote _ pat) =
+    "^" <> displayAtom opts pat
+  display opts (TcDemote _ pat) =
+    "↓" <> displayAtom opts pat
+  display opts (TcStructPat fs) =
+    cat [ nest 2 $ cat [ "{", fields fs], "}"]
+    where
+    fields = sep . punctuate "," . map field
+    field (name, pat) = pretty name <+> "=" <+> display opts pat
+
+  displayAtom opts pat = case pat of
+    TcOr{} -> parens (display opts pat)
+    TcFactGen{} -> parens (display opts pat)
+    TcPrimCall{} -> parens (display opts pat)
+    TcQueryGen{} -> parens (display opts pat)
+    TcNegation{} -> display opts pat
+    TcIf{} -> parens (display opts pat)
+    _ -> display opts pat
+
+type TypecheckedQuery = QueryWithInfo TcQuery
+
+lookupField :: FieldName -> [RTS.FieldDef] -> [(Type, Word64)]
+lookupField fieldName fields =
+  [ (ty, n) | (FieldDef name ty, n) <- zip fields [0..]
+  , name == fieldName ]
diff --git a/glean/db/Glean/Query/Typecheck/Unify.hs b/glean/db/Glean/Query/Typecheck/Unify.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Typecheck/Unify.hs
@@ -0,0 +1,442 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Typecheck.Unify (
+    unify,
+    apply,
+    zonkTcQuery,
+    zonkVars,
+  ) where
+
+import Control.Monad
+import Control.Monad.State
+import qualified Data.IntMap as IntMap
+import qualified Data.Map as Map
+import qualified Data.Map.Merge.Lazy as Map
+import Data.Maybe
+import qualified Data.Text as Text
+import Compat.Prettyprinter hiding ((<>), enclose)
+
+import Glean.Angle.Types hiding (Type)
+import Glean.Database.Schema.Types
+import Glean.Display
+import Glean.Query.Codegen.Types
+import Glean.Query.Typecheck.Monad
+import Glean.Query.Typecheck.Types
+import Glean.RTS.Term hiding
+  (Tuple, ByteArray, String, Array, Nat)
+import qualified Glean.RTS.Term as RTS
+import Glean.RTS.Types as RTS
+import Glean.Schema.Util
+
+unify :: Type -> Type -> T ()
+unify ByteTy ByteTy = return ()
+unify NatTy NatTy = return ()
+unify StringTy StringTy = return ()
+unify (ArrayTy t) (ArrayTy u) = unify t u
+unify (SetTy t) (SetTy u) = unify t u
+unify a@(RecordTy ts) b@(RecordTy us)
+  | length ts == length us = forM_ (zip ts us) $
+      \(FieldDef f t, FieldDef g u) ->
+        if f == g || compareStructurally
+          then unify t u
+          else unifyError a b
+  where
+  isTuple = all (Text.isInfixOf "tuplefield"  . fieldDefName)
+  compareStructurally = isTuple ts || isTuple us
+     -- structural equality for tuples by ignoring field names.
+unify a@(SumTy ts) b@(SumTy us)
+  | length ts == length us = forM_ (zip ts us) $
+      \(FieldDef f t, FieldDef g u) ->
+        if f /= g then unifyError a b else unify t u
+unify (PredicateTy _ (PidRef p _)) (PredicateTy _ (PidRef q _))
+  | p == q = return ()
+
+unify (NamedTy _ (ExpandedType n _)) (NamedTy _ (ExpandedType m _))
+  | n == m = return ()
+unify (NamedTy _ (ExpandedType _ t)) u = unify t u
+unify t (NamedTy _ (ExpandedType _ u)) = unify t u
+
+unify (MaybeTy t) (MaybeTy u) = unify t u
+unify (MaybeTy t) u@SumTy{} = unify (lowerMaybe t) u
+unify (MaybeTy t) u@HasTy{} = unify (lowerMaybe t) u
+unify t@SumTy{} (MaybeTy u) = unify t (lowerMaybe u)
+unify t@HasTy{} (MaybeTy u) = unify t (lowerMaybe u)
+
+unify (EnumeratedTy ns) (EnumeratedTy ms) | ns == ms = return ()
+unify (EnumeratedTy ns) u@SumTy{} = unify (lowerEnum ns) u
+unify (EnumeratedTy ns) u@HasTy{} = unify (lowerEnum ns) u
+unify t@SumTy{} (EnumeratedTy ns) = unify t (lowerEnum ns)
+unify t@HasTy{} (EnumeratedTy ns) = unify t (lowerEnum ns)
+
+unify BooleanTy BooleanTy = return ()
+
+unify (TyVar x) (TyVar y) | x == y = return ()
+unify (TyVar x) t = extend x t
+unify t (TyVar x) = extend x t
+
+{- Unifying HasTy
+
+   When a (HasTy f r x) is created, the type variable x is unbound.
+   Unification with this HasTy records the new information by binding
+   x; the new information might be another HasTy with more fields (and
+   an unbound type variable), or it might be a RecordTy / SumTy.
+
+   Therefore during typechecking a HasTy turns into a chain of
+   increasingly larger HasTys culminating in a RecordTy / SumTy.
+-}
+unify a@(HasTy fa ra x) b@(HasTy fb rb y)
+  | x == y = return ()
+  | otherwise = do
+  rec <- case (ra,rb) of
+    (Just x, Just y) | x /= y -> unifyError a b
+    (Nothing, _) -> return rb
+    _otherwise -> return ra
+  union <- Map.mergeA
+    Map.preserveMissing
+    Map.preserveMissing
+    (Map.zipWithAMatched $ \_ a b -> do unify a b; return a)
+    fa fb
+  -- if either a or b is the same as the unified type, avoid creating
+  -- a new type variable.
+  let size = Map.size union
+  if size == Map.size fa && ra == rec
+    then extend y a
+    else if size == Map.size fb && rb == rec
+      then extend x b
+      else do
+        z <- freshTyVarInt
+        let all = HasTy union rec z
+        extend x all
+        extend y all
+
+unify a@(HasTy _ (Just Sum) _) b@RecordTy{} =
+  unifyError a b
+unify a@(HasTy m _ x) b@(RecordTy fs) = do
+  forM_ fs $ \(FieldDef f ty) ->
+    case Map.lookup f m of
+      Nothing -> return ()
+      Just ty' -> unify ty ty'
+  when (not (Map.null (foldr (Map.delete . fieldDefName) m fs))) $
+    unifyError a b
+  extend x (RecordTy fs)
+
+unify a@(HasTy _ (Just Record) _) b@SumTy{} =
+  unifyError a b
+unify a@(HasTy m _ x) b@(SumTy fs) = do
+  forM_ fs $ \(FieldDef f ty) ->
+    case Map.lookup f m of
+      Nothing -> return ()
+      Just ty' -> unify ty ty'
+  forM_ (Map.keys m) $ \n ->
+    when (n `notElem` map fieldDefName fs) $
+      unifyError a b
+  extend x (SumTy fs)
+
+unify a@RecordTy{} b@HasTy{} = unify b a
+unify a@SumTy{} b@HasTy{} = unify b a
+
+unify (HasKey keyTy x) predTy@(PredicateTy _ (PidRef _ ref)) = do
+  PredicateDetails{..} <- getPredicateDetails ref
+  unify predicateKeyType keyTy
+  extend x predTy
+unify (HasKey a x) (HasKey b y)
+  | x == y = return ()
+  | otherwise = do
+  unify a b
+  extend x (HasKey a y)
+  extend y (HasKey a x)
+unify a@PredicateTy{} b@HasKey{} = unify b a
+
+unify (ElementsOf elemTy x) setTy@(SetTy ty) = do
+  extend x setTy
+  unify elemTy ty
+unify a@SetTy{} b@ElementsOf{} = unify b a
+unify (ElementsOf elemTy x) arrTy@(ArrayTy ty) = do
+  extend x arrTy
+  unify elemTy ty
+unify a@ArrayTy{} b@ElementsOf{} = unify b a
+unify (ElementsOf elemTyA avar) b@(ElementsOf elemTyB _) = do
+  unify elemTyA elemTyB
+  extend avar b
+
+unify a b = unifyError a b
+
+unifyError :: Type -> Type -> T a
+unifyError a b = do
+  opts <- gets tcDisplayOpts
+  prettyError $ vcat
+    [ "type error:"
+    , indent 2 (display opts a)
+    , "does not match:"
+    , indent 2 (display opts b)
+    ]
+
+extend :: Int -> Type -> T ()
+extend x t = do
+  t' <- apply t  -- avoid creating a cycle in the substitution
+  if
+    | TyVar y <- t, y == x -> return ()
+    | otherwise -> do
+      subst <- gets tcSubst
+      case IntMap.lookup x subst of
+        Just u -> unify t' u
+        Nothing ->
+          modify $ \s -> s{ tcSubst = IntMap.insert x t' (tcSubst s) }
+
+apply :: Type -> T Type
+apply t = do
+  let unbound _ = return Nothing
+      unboundHas _ _ _ = return Nothing
+  apply_ unbound unboundHas t
+
+zonkType :: Type -> T Type
+zonkType t = do
+  opts <- gets tcDisplayOpts
+  let unbound x = prettyError $
+        "ambiguous type: " <> display opts (TyVar x :: Type)
+  apply_ unbound resolveHas t
+
+-- resolve unbound HasTy to a record. Otherwise a query like
+--   { a = 3 }
+-- will be ambiguous.
+resolveHas :: Int -> Map.Map Name Type -> Maybe RecordOrSum -> T (Maybe Type)
+resolveHas _ fieldmap mr = case mr of
+  Nothing -> rec
+  Just Record -> rec
+  Just Sum -> sum
+  where
+  rec = return $ Just $ RecordTy fields
+  sum = return $ Just $ SumTy fields
+  fields = [ FieldDef name ty | (name,ty) <- Map.toList fieldmap ]
+
+apply_
+  :: (Int -> T (Maybe Type))
+     -- ^ unbound regular tyvar
+  -> (Int -> Map.Map Name Type -> Maybe RecordOrSum -> T (Maybe Type))
+     -- ^ unbound HasTy tyvar
+  -> Type
+  -> T Type
+apply_ unbound unboundHas t = do
+  subst <- gets tcSubst
+  go_ subst t
+  where
+  go_ subst t = go t
+    where
+    lookup x = case IntMap.lookup x subst of
+      Nothing -> unbound x
+      Just ty -> return (Just ty)
+
+    lookupHas x f r = case IntMap.lookup x subst of
+      Nothing -> unboundHas x f r
+      Just ty -> return (Just ty)
+
+    go t = case t of
+      ByteTy -> return t
+      NatTy -> return t
+      StringTy -> return t
+      ArrayTy t -> ArrayTy <$> go t
+      RecordTy fs ->
+        fmap RecordTy $ forM fs $ \(FieldDef n t) ->
+          FieldDef n <$> go t
+      SumTy fs ->
+        fmap SumTy $ forM fs $ \(FieldDef n t) ->
+          FieldDef n <$> go t
+      PredicateTy{} -> return t
+      NamedTy{} -> return t
+      MaybeTy t -> MaybeTy <$> go t
+      EnumeratedTy{} -> return t
+      BooleanTy -> return t
+      TyVar x -> do
+        m <- lookup x
+        case m of
+          Nothing -> return t
+          Just u -> go u
+      HasTy f r x -> do
+        m <- lookupHas x f r
+        case m of
+          Nothing -> return t
+          Just u -> go u
+      HasKey _ x -> do
+        m <- lookup x
+        case m of
+          Nothing -> return t
+          Just u -> go u
+      SetTy t -> SetTy <$> go t
+      ElementsOf _ x -> do
+        m <- lookup x
+        case m of
+          Nothing -> return t
+          Just u -> go u
+
+zonkVars :: T ()
+zonkVars = do
+  vars <- gets tcVars
+  zonked <- forM vars $ \Var{..} -> do
+    let
+      unbound _ = prettyError $ vcat
+          [ "variable " <> pretty var <>
+            " has unknown type"
+          , "    try adding a type signature, like: " <> pretty var <> " : T"
+          ]
+          where var = fromMaybe (Text.pack ('_':show varId)) varOrigName
+    t <- apply_ unbound resolveHas varType
+    return (Var { varType = t, ..})
+  modify $ \s -> s { tcVars = zonked }
+
+zonkTcQuery :: TcQuery -> T TcQuery
+zonkTcQuery (TcQuery ty k mv stmts ord) =
+  TcQuery
+    <$> zonkType ty
+    <*> zonkTcPat k
+    <*> mapM zonkTcPat mv
+    <*> mapM zonkTcStatement stmts
+    <*> pure ord
+
+zonkTcPat :: TcPat -> T TcPat
+zonkTcPat p = case p of
+  RTS.Byte{} -> return p
+  RTS.Nat{} -> return p
+  RTS.Array ts -> RTS.Array <$> mapM zonkTcPat ts
+  RTS.ByteArray{} -> return p
+  RTS.Tuple ts -> RTS.Tuple <$> mapM zonkTcPat ts
+  RTS.Alt n t -> RTS.Alt n <$> zonkTcPat t
+  RTS.String{} -> return p
+  Ref (MatchExt (Typed ty (TcPromote inner e))) -> do
+    ty' <- zonkType ty
+    inner' <- zonkType inner
+    e' <- zonkTcPat e
+    case (ty', inner') of
+      (TyVar{}, _) -> error "zonkMatch: tyvar"
+      (_, TyVar{}) -> error "zonkMatch: tyvar"
+      (PredicateTy _ (PidRef _ ref), PredicateTy _ (PidRef _ ref'))
+        | ref == ref' -> return e'
+      (PredicateTy _ pidRef@(PidRef _ ref), _other) -> do
+        PredicateDetails{..} <- getPredicateDetails ref
+        let vpat = Ref (MatchWild predicateValueType)
+        return (Ref (MatchExt (Typed ty'
+          (TcFactGen pidRef e' vpat SeekOnAllFacts))))
+      _ ->
+        return e'
+  Ref (MatchExt (Typed ty (TcDemote inner e))) -> do
+    ty' <- zonkType ty
+    inner' <- zonkType inner
+    e' <- zonkTcPat e
+    case (ty', inner') of
+      (TyVar{}, _) -> error "zonkMatch: tyvar"
+      (_, TyVar{}) -> error "zonkMatch: tyvar"
+      (PredicateTy  _ (PidRef _ ref), PredicateTy _ (PidRef _ ref'))
+        | ref == ref' -> return e'
+      (_other, PredicateTy{}) -> do
+        return (Ref (MatchExt (Typed ty' (TcDeref inner' e'))))
+      _ ->
+        return e'
+  Ref (MatchExt (Typed ty (TcStructPat fs))) -> do
+    ty' <- zonkType ty
+    case ty' of
+      RecordTy fields ->
+        fmap RTS.Tuple $ forM fields $ \(FieldDef f ty) ->
+          case [ p | (g,p) <- fs, f == g ] of
+            [] -> return (mkWild ty)
+            (x:_) -> zonkTcPat x
+      SumTy fields ->
+        case fs of
+          [(name,pat)]
+            | (_, n) :_ <- lookupField name fields -> do
+              pat' <- zonkTcPat pat
+              return (RTS.Alt n pat')
+          _other -> error $ "zonkTcPat: " <> show (displayDefault p)
+      _other -> do
+        opts <- gets tcDisplayOpts
+        prettyError $
+          nest 4 $ vcat
+            [ "type error in pattern"
+            , "pattern: " <> display opts p
+            , "expected type: " <> display opts ty
+            ]
+  Ref (MatchExt (Typed ty (TcElementsUnresolved containerTy p))) -> do
+    ty' <- zonkType ty
+    containerTy' <- zonkType containerTy
+    p' <- zonkTcPat p
+    case containerTy' of
+      SetTy _ ->
+        return (Ref (MatchExt (Typed ty' (TcElementsOfSet p'))))
+      ArrayTy _ ->
+        return  (Ref (MatchExt (Typed ty' (TcElementsOfArray p'))))
+      _other -> do
+        opts <- gets tcDisplayOpts
+        prettyError $
+          nest 4 $ vcat
+            [ "type error in pattern"
+            , "pattern: " <> display opts p
+            , "expected type: " <> display opts ty
+            ]
+
+
+  Ref m -> Ref <$> zonkMatch m
+
+zonkMatch :: Match (Typed TcTerm) Var -> T (Match (Typed TcTerm) Var)
+zonkMatch m = case m of
+  MatchWild ty -> MatchWild <$> zonkType ty
+  MatchNever ty -> MatchNever <$> zonkType ty
+  MatchFid{} -> return m
+  MatchBind v -> MatchBind <$> var v
+  MatchVar v -> MatchVar <$> var v
+  MatchAnd a b -> MatchAnd <$> zonkTcPat a <*> zonkTcPat b
+  MatchPrefix s pat -> MatchPrefix s <$> zonkTcPat pat
+  MatchArrayPrefix ty ts all ->
+    MatchArrayPrefix
+      <$> zonkType ty
+      <*> mapM zonkTcPat ts
+      <*> zonkTcPat all
+  MatchExt (Typed ty e) ->
+    MatchExt <$> (Typed <$> zonkType ty <*> zonkTcTerm e)
+  where
+  var (Var _ n _) = do
+    vars <- gets tcVars
+    case IntMap.lookup n vars of
+      Nothing -> error "zonkMatch"
+      Just v -> return v
+
+zonkTcTerm :: TcTerm -> T TcTerm
+zonkTcTerm t = case t of
+  TcOr a b -> TcOr <$> zonkTcPat a <*> zonkTcPat b
+  TcFactGen pid k v sec ->
+    TcFactGen pid <$> zonkTcPat k <*> zonkTcPat v <*> pure sec
+  TcElementsOfArray a -> TcElementsOfArray <$> zonkTcPat a
+  TcQueryGen q -> TcQueryGen <$> zonkTcQuery q
+  TcAll q -> TcAll <$> zonkTcQuery q
+  TcNegation stmts -> TcNegation <$> mapM zonkTcStatement stmts
+  TcPrimCall op args -> TcPrimCall op <$> mapM zonkTcPat args
+  TcIf (Typed ty cond) th el ->
+    TcIf
+      <$> (Typed <$> zonkType ty <*> zonkTcPat cond)
+      <*> zonkTcPat th
+      <*> zonkTcPat el
+  TcDeref ty p ->
+    TcDeref <$> zonkType ty <*> zonkTcPat p
+  TcFieldSelect (Typed ty p) f ->
+    TcFieldSelect
+      <$> (Typed <$> zonkType ty <*> zonkTcPat p)
+      <*> pure f
+  TcAltSelect (Typed ty p) f ->
+    TcAltSelect
+      <$> (Typed <$> zonkType ty <*> zonkTcPat p)
+      <*> pure f
+  TcElementsOfSet p -> TcElementsOfSet <$> zonkTcPat p
+  TcElementsUnresolved{} -> error "zonkTcTerm: TcElementsUnresolved" -- handled in zonkTcPat
+  TcPromote{} -> error "zonkTcTerm: TcPromote" -- handled in zonkTcPat
+  TcDemote{} -> error "zonkTcTerm: TcPromote" -- handled in zonkTcPat
+  TcStructPat{} -> error "zonkTcTerm: TcStructPat" -- handled in zonkTcPat
+
+zonkTcStatement :: TcStatement -> T TcStatement
+zonkTcStatement (TcStatement ty l r) =
+  TcStatement
+    <$> zonkType ty
+    <*> zonkTcPat l
+    <*> zonkTcPat r
diff --git a/glean/db/Glean/Query/UserQuery.hs b/glean/db/Glean/Query/UserQuery.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/UserQuery.hs
@@ -0,0 +1,1296 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.UserQuery
+  ( userQueryFacts
+  , userQuery
+  , userQueryWrites
+  , schemaVersionForQuery
+  ) where
+
+import Control.Applicative
+import Control.DeepSeq
+import Control.Exception
+import Control.Monad
+import Control.Monad.Except
+import Data.Bifunctor (first)
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as B
+import Data.Coerce
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Data.Hashable (hash)
+import Data.Int
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Set (Set)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter hiding ((<>))
+import Compat.Prettyprinter.Render.Text
+import qualified Data.Vector as Vector
+import Data.Vector (Vector)
+import qualified Data.Vector.Storable as VS
+import Data.Word (Word64)
+import System.IO
+import TextShow
+
+import ServiceData.GlobalStats as Stats
+import qualified ServiceData.Types as Stats
+import Util.AllocLimit
+import Util.Timing
+import Util.Log
+import Util.STM
+
+import Glean.Display
+import qualified Glean.Angle.Parser as Angle
+import Glean.Angle.Types hiding (Type, FieldDef, SourcePat_(..))
+import qualified Glean.Angle.Types as Angle
+import qualified Glean.Internal.Types as Thrift
+import qualified Glean.Backend.Types as Backend
+import Glean.Schema.Types
+  (RefTarget(..), LookupResult(..), NameEnv, resolveRef)
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Schema.Types
+import Glean.Database.Open
+import qualified Glean.Database.PredicateStats as PredicateStats
+import Glean.Database.Types as Database
+import Glean.Database.Writes
+import Glean.FFI
+import Glean.Query.Codegen
+import Glean.Query.Codegen.Types hiding (Match(..))
+import Glean.Query.Transform
+import Glean.Query.Flatten
+import Glean.Query.Opt
+import Glean.Query.Reorder
+import Glean.Query.Incremental (makeIncremental)
+import Glean.RTS as RTS
+import Glean.RTS.Bytecode.Disassemble
+import qualified Glean.RTS.Bytecode.Gen.Version as Bytecode
+import qualified Glean.RTS.Foreign.Bytecode as Bytecode
+import Glean.RTS.Foreign.FactSet (FactSet)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Lookup
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Foreign.Query
+import Glean.RTS.Foreign.Stacked (stacked)
+import Glean.RTS.Types (Type, PidRef(..))
+import qualified Glean.Types as Thrift
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Query.JSON
+import Glean.Schema.Resolve
+import Glean.Schema.Util
+import Glean.Util.Observed as Observed
+import Glean.Query.Typecheck
+import Glean.Bytecode.SysCalls (userQuerySysCalls)
+import Glean.Types (UserQueryCont)
+import qualified Glean.Backend.Types as StackedDbOpts
+import Glean.Util.Some
+import Glean.Query.Typecheck.Types (TcPred)
+-- NOTE: We keep the public interface monomorphic, at least for now.
+
+--
+-- | Perform a query using the JSON query syntax, and return the results
+-- as JSON-encoded Thrift data.
+--
+userQuery
+  :: Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQuery
+  -> IO Thrift.UserQueryResults
+userQuery env repo query = chooseEncoding
+  (Thrift.userQuery_options query)
+  (Thrift.userQuery_encodings query)
+  $ genericUserQuery env repo query
+
+--
+-- | Query a list of facts and return the result as JSON-encoded Thrift data.
+--
+userQueryFacts
+  :: Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQueryFacts
+  -> IO Thrift.UserQueryResults
+userQueryFacts env repo query = chooseEncoding
+  (Thrift.userQueryFacts_options query)
+  (Thrift.userQueryFacts_encodings query)
+  $ genericUserQueryFacts env repo query
+
+-- | A generic implementation of scan queries.
+genericUserQuery
+  :: Encoding e
+  => Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQuery
+  -> e
+  -> IO Thrift.UserQueryResults
+{-# INLINE genericUserQuery #-}
+genericUserQuery env repo query enc = do
+  config@ServerConfig.Config{..} <- Observed.get (envServerConfig env)
+  readDatabaseWithBoundaries env repo $ \odb bounds lookup ->
+    maybe id limitAllocsThrow config_query_alloc_limit
+      $ performUserQuery enc (odbSchema odb)
+      $ userQueryImpl env odb config NoExtraSteps bounds lookup repo query
+
+-- | A generic implementation of lookup queries.
+genericUserQueryFacts
+  :: Encoding e
+  => Database.Env
+  -> Thrift.Repo
+  -> Thrift.UserQueryFacts
+  -> e
+  -> IO Thrift.UserQueryResults
+{-# INLINE genericUserQueryFacts #-}
+genericUserQueryFacts env repo query enc = do
+  config <- Observed.get (envServerConfig env)
+  readDatabase env repo $ \odb lookup ->
+    performUserQuery enc (odbSchema odb) $
+      userQueryFactsImpl (odbSchema odb) config lookup query
+
+-- | Results returned from a query, parametrised of the types of facts and
+-- statistics
+data Results stats fact = Results
+  { -- | Facts matching the query
+    resFacts :: [(Fid, fact)]
+
+    -- | Type of the results, if known
+  , resPredicate :: Maybe PredicateDetails
+
+    -- | Additional facts satisfying nested parts of the query
+  , resNestedFacts :: IntMap fact
+
+    -- | Continuation for paging
+  , resCont :: Maybe Thrift.UserQueryCont
+
+    -- | Statistics
+  , resStats :: stats
+
+    -- | Diagnostics
+  , resDiags :: [Text]
+
+    -- | Write handle for derived facts
+  , resWriteHandle :: Maybe Thrift.Handle
+
+    -- | Count of the facts searched per Pid
+  , resFactsSearched :: Maybe (Map Int64 Int64)
+
+    -- | Inferred type of the query, for logging
+  , resType :: Maybe Text
+
+    -- | Size of compiled bytecode, for logging
+  , resBytecodeSize :: Maybe Int
+
+    -- | Query compile time, for logging, in seconds
+  , resCompileTime :: Maybe Double
+
+  , resCodegenTime :: Maybe Double
+
+    -- | Query execution time after compilation, for logging, in nanoseconds
+  , resExecutionTime :: Maybe Word64
+
+  -- | Size of query results, for logging
+  , resResultBytes :: Maybe Int64
+  }
+
+class Encoding e where
+  type EncodedFact e
+
+  shouldExpand :: e -> Bool
+  serializeFact
+    :: e
+    -> IntMap (EncodedFact e)
+    -> Fid
+    -> PredicateDetails
+    -> Thrift.Fact
+    -> IO (EncodedFact e)
+  setResults
+    :: e
+    -> Results stats (EncodedFact e)
+    -> Thrift.UserQueryResults
+    -> Thrift.UserQueryResults
+
+withEncoding
+  :: Thrift.UserQueryEncoding
+  -> (forall e. Encoding e => e -> a)
+  -> Maybe a
+{-# INLINE withEncoding #-}
+withEncoding (Thrift.UserQueryEncoding_bin x) f = Just $ f x
+withEncoding (Thrift.UserQueryEncoding_json x) f = Just $ f x
+withEncoding (Thrift.UserQueryEncoding_compact x) f = Just $ f x
+withEncoding (Thrift.UserQueryEncoding_listbin x) f = Just $ f x
+withEncoding _ _ = Nothing
+
+chooseEncoding
+  :: Maybe Thrift.UserQueryOptions
+  -> [Thrift.UserQueryEncoding]
+  -> (forall e. Encoding e => e -> IO a)
+  -> IO a
+{-# INLINE chooseEncoding #-}
+chooseEncoding mopts encs f = do
+  forM_ (Thrift.userQueryOptions_continuation =<< mopts) checkUserQueryCont
+  case encs of
+    [] -> f $ LegacyJSONEncoding $ fromMaybe def mopts
+    _ | act : _ <- mapMaybe (`withEncoding` f) encs -> act
+      | otherwise -> throwIO $ Thrift.BadQuery
+          "none of the requested encodings are supported"
+
+newtype LegacyJSONEncoding = LegacyJSONEncoding Thrift.UserQueryOptions
+
+instance Encoding LegacyJSONEncoding where
+  type EncodedFact LegacyJSONEncoding = ByteString
+
+  shouldExpand (LegacyJSONEncoding opts) =
+    Thrift.userQueryOptions_expand_results opts
+
+  serializeFact
+    (LegacyJSONEncoding opts)
+    serialized
+    fid
+    predicateDetails
+    Thrift.Fact{..} = factToJSON
+      (Thrift.userQueryOptions_no_base64_binary opts)
+      serialized
+      predicateDetails
+      fid
+      fact_key
+      fact_value
+
+  setResults _ res qres = qres
+      { Thrift.userQueryResults_facts = snd <$> resFacts res
+      , Thrift.userQueryResults_nestedFacts = Map.fromList
+          [ (fromIntegral i, fact)
+            | (i,fact) <- IntMap.toList $ resNestedFacts res ]
+      }
+
+instance Encoding Thrift.UserQueryEncodingJSON where
+  type EncodedFact Thrift.UserQueryEncodingJSON = ByteString
+
+  shouldExpand = Thrift.userQueryEncodingJSON_expand_results
+
+  serializeFact enc serialized fid predicateDetails Thrift.Fact{..} =
+    factToJSON
+      (Thrift.userQueryEncodingJSON_no_base64_binary enc)
+      serialized
+      predicateDetails
+      fid
+      fact_key
+      fact_value
+
+  setResults enc res qres = qres
+    { Thrift.userQueryResults_results = Thrift.UserQueryEncodedResults_json
+        Thrift.UserQueryResultsJSON
+          { userQueryResultsJSON_encoding = enc
+          , userQueryResultsJSON_facts = snd <$> resFacts res
+          , userQueryResultsJSON_nestedFacts = Map.fromList
+              [ (fromIntegral i, fact)
+                | (i,fact) <- IntMap.toList $ resNestedFacts res ]
+          }
+    }
+
+instance Encoding Thrift.UserQueryEncodingCompact where
+  type EncodedFact Thrift.UserQueryEncodingCompact = ByteString
+
+  shouldExpand = Thrift.userQueryEncodingCompact_expand_results
+
+  serializeFact _ serialized fid predicateDetails Thrift.Fact{..} =
+    factToCompact
+      serialized
+      predicateDetails
+      fid
+      fact_key
+      fact_value
+
+  setResults enc res qres = qres
+    { Thrift.userQueryResults_results = Thrift.UserQueryEncodedResults_compact
+        Thrift.UserQueryResultsCompact
+          { userQueryResultsCompact_encoding = enc
+          , userQueryResultsCompact_facts = snd <$> resFacts res
+          , userQueryResultsCompact_nestedFacts = Map.fromList
+              [ (fromIntegral i, fact)
+                | (i,fact) <- IntMap.toList $ resNestedFacts res ]
+          }
+    }
+
+instance Encoding Thrift.UserQueryEncodingBin where
+  type EncodedFact Thrift.UserQueryEncodingBin = Thrift.Fact
+
+  shouldExpand _ = False
+
+  serializeFact _ _ _ _ = return
+
+  setResults enc res qres = qres
+    { Thrift.userQueryResults_results = Thrift.UserQueryEncodedResults_bin
+        Thrift.UserQueryResultsBin
+          { userQueryResultsBin_encoding = enc
+          , userQueryResultsBin_facts =
+              Map.fromList
+              $ coerce
+              $ resFacts res
+          , userQueryResultsBin_nestedFacts =
+              Map.fromList
+              $ map (first fromIntegral)
+              $ IntMap.toList
+              $ resNestedFacts res
+          }
+    }
+
+instance Encoding Thrift.UserQueryEncodingListBin where
+  type EncodedFact Thrift.UserQueryEncodingListBin = Thrift.Fact
+
+  shouldExpand _ = False
+
+  serializeFact _ _ _ _ = return
+
+  setResults enc res qres = qres
+    { Thrift.userQueryResults_results = Thrift.UserQueryEncodedResults_listbin
+        Thrift.UserQueryResultsListBin
+          { userQueryResultsListBin_encoding = enc
+          , userQueryResultsListBin_ids =
+              coerce $ Vector.fromList (map fst (resFacts res))
+          , userQueryResultsListBin_facts =
+              Vector.fromList (map snd (resFacts res))
+          , userQueryResultsListBin_nestedFacts =
+              Map.fromList
+              $ map (first fromIntegral)
+              $ IntMap.toList
+              $ resNestedFacts res
+          }
+    }
+
+-- | Perform a query and convert the 'Results' to a Thrift result
+performUserQuery
+  :: Encoding e
+  => e
+  -> DbSchema
+  -> IO (Results Stats Thrift.Fact)
+  -> IO Thrift.UserQueryResults
+{-# INLINE performUserQuery #-}
+performUserQuery encoding schema query = do
+  !results <- withStats $ do
+    res <- query
+
+    -- Convert nested facts - we do it in the order of their fact ids
+    -- which means we can only depend on facts converted earlier.
+    nested <- foldM
+      (\expanded (fid, fact@Thrift.Fact{..}) -> do
+          details <- pidDetails schema fact_type
+          encoded <- serializeFact
+            encoding
+            (if shouldExpand encoding then expanded else IntMap.empty)
+            (Fid $ fromIntegral fid)
+            details
+            fact
+          return $ IntMap.insert fid encoded expanded)
+      IntMap.empty
+      (IntMap.toList $ resNestedFacts res)
+
+    let
+      -- avoid lookupPid if we know the result type
+      getDetails = case resPredicate res of
+        Just d -> const (return d)
+        Nothing -> pidDetails schema
+
+    facts <- forM (resFacts res) $ \(i, fact) -> do
+      details <- getDetails (Thrift.fact_type fact)
+      enc <- serializeFact
+        encoding
+        (if shouldExpand encoding then nested else IntMap.empty)
+        i
+        details
+        fact
+      return (i,enc)
+
+    return res
+      { resFacts = facts
+      , resNestedFacts = if shouldExpand encoding then IntMap.empty else nested
+      }
+  return $ setResults encoding results def
+    { Thrift.userQueryResults_stats = Just $ resStats results
+    , Thrift.userQueryResults_continuation = resCont results
+    , Thrift.userQueryResults_diagnostics = resDiags results
+    , Thrift.userQueryResults_handle = resWriteHandle results
+    , Thrift.userQueryResults_type = resType results
+    }
+
+pidDetails :: DbSchema -> Int64 -> IO PredicateDetails
+pidDetails schema ty = do
+  case lookupPid (Pid (fromIntegral ty)) schema of
+    Nothing ->  throwIO $ Thrift.Exception $
+      "failed looking up fact type: " <> Text.pack (show ty)
+    Just d -> return d
+
+userQueryFactsImpl
+  :: DbSchema
+  -> ServerConfig.Config
+  -> Lookup
+  -> Thrift.UserQueryFacts
+  -> IO (Results Stats Thrift.Fact)
+     -- The length of the result list is guaranteed to be the same
+     -- as the userQueryFacts_facts list in the input.
+userQueryFactsImpl
+    schema@DbSchema{..}
+    config
+    lookup
+    query@Thrift.UserQueryFacts{..} = do
+  let opts = fromMaybe def userQueryFacts_options
+
+  schemaSelector <- schemaVersionForQuery schema config userQueryFacts_schema_id
+
+  expandPids <- optsExpandPids opts schemaSelector schema
+  let limits = mkQueryRuntimeOptions opts config expandPids
+
+  trans <- transformationsForQuery schema schemaSelector
+
+  vlog 2 $ "userQueryFactsImpl: " <> show (length userQueryFacts_facts)
+  (qResults@QueryResults{..}, fullScans) <- do
+    nextId <- firstFreeId lookup
+    -- executeCompiled needs a Define, even though we won't use it
+    bracket (FactSet.new nextId) release $ \derived -> do
+    let stack = stacked lookup derived
+    bracket
+      (compileQueryFacts userQueryFacts_facts)
+      (release . compiledQuerySub) $ \sub -> do
+        results <- executeCompiled schemaInventory Nothing stack sub limits
+        appliedTrans <- either (throwIO . Thrift.BadQuery) return $
+          userQueryFactsTransformations trans schemaSelector schema query results
+        -- use Pids in result facts to apply a suitable transformation if neded.
+        return
+          ( transformResultsBack appliedTrans results
+          , compiledQueryFullScans sub
+          )
+
+  stats <- getStats schema fullScans qResults
+
+  let results = Results
+        { resFacts = Vector.toList queryResultsFacts
+        , resPredicate = Nothing
+        , resNestedFacts = mkNestedFacts queryResultsNestedFacts
+        , resCont = Nothing
+        , resStats = stats
+        , resDiags = []
+        , resWriteHandle = Nothing
+        , resFactsSearched = Nothing
+        , resType = Nothing  -- could be facts of different predicates
+        , resBytecodeSize = Nothing
+        , resCompileTime = Nothing
+        , resCodegenTime = Nothing
+        , resExecutionTime = Nothing
+        , resResultBytes = Nothing
+        }
+
+  return $ if Thrift.userQueryOptions_omit_results opts
+     then withoutFacts results
+     else results
+
+userQueryFactsTransformations
+  :: QueryTransformations
+  -> SchemaSelector
+  -> DbSchema
+  -> Thrift.UserQueryFacts
+  -> QueryResults
+  -> Either Text ResultTransformations
+userQueryFactsTransformations qtrans selector schema query results = do
+  nameEnv <-  maybe (Left "invalid schema_id") return $ do
+    schemaNameEnv schema selector
+
+  let predRefs :: [PidRef]
+      predRefs = mapMaybe (toPidRef nameEnv) sourceRefs
+
+      -- a type containing all types in the response
+      allTypes :: Type
+      allTypes = Angle.RecordTy
+        [ Angle.FieldDef "" (PredicateTy () predId) | predId <- predRefs ]
+
+  -- errors if multiple versions of the same predicate are requested.
+  transformationsFor schema qtrans allTypes
+  where
+    sourceRefs :: [SourceRef]
+    sourceRefs = mapMaybe toRef $ Set.toList vset
+      where
+        vset :: Set (Pid, Maybe Version)
+        vset = Vector.foldr insert mempty zipped
+        zipped = Vector.zip (queryResultsFacts results) versions
+        insert ((_, fact), version) acc =
+          Set.insert (Pid $ Thrift.fact_type fact, version) acc
+
+        versions :: Vector (Maybe Version)
+        versions = Vector.fromList $
+          Thrift.factQuery_predicate_version <$>
+            Thrift.userQueryFacts_facts query
+
+        toRef :: (Pid, Maybe Version) -> Maybe SourceRef
+        toRef (pid, mversion) = do
+          details <- lookupPid pid schema
+          let PredicateRef name _ = predicateRef details
+          return $ SourceRef name mversion
+
+    toPidRef :: NameEnv RefTargetId -> SourceRef -> Maybe PidRef
+    toPidRef nameEnv ref = do
+      ResolvesTo (RefPred predId) <- return $ resolveRef nameEnv ref
+      details <- lookupPredicateId predId schema
+      return (pidRef details)
+
+-- | A version of userQuery where we only care about the resulting writes
+-- caused by the query. Used for stored predicate derivation.
+userQueryWrites
+  :: Database.Env
+  -> OpenDB s
+  -> ServerConfig.Config
+  -> Boundaries
+  -> Lookup
+  -> Thrift.Repo
+  -> PredicateId
+  -> Thrift.UserQuery
+  -> IO (
+       Thrift.UserQueryStats,
+       Maybe Thrift.UserQueryCont,
+       Maybe Thrift.Handle
+     )
+userQueryWrites env odb config bounds lookup repo pred q = do
+  meta <- atomically $ Catalog.readMeta (envCatalog env) repo
+  inc <- shouldDeriveIncrementally meta
+  mode <-
+    if inc
+    then IncrementalDerivation <$> sectionsStats
+    else return NoExtraSteps
+  Results{..} <- withStats $
+    userQueryImpl env odb config mode bounds lookup repo q
+  return (resStats, resCont, resWriteHandle)
+  where
+    -- We derive incrementally if
+    --   1. the DB is stacked, and
+    --   2. the predicate was derived in the base DB
+    --
+    -- (2) might be false if we're deriving a predicate in a
+    -- stacked DB that we didn't derive on the base DB.
+    shouldDeriveIncrementally meta =
+      case Thrift.metaDependencies meta of
+        Just (Thrift.Dependencies_stacked Thrift.Stacked{..}) ->
+          check $ Thrift.Repo stacked_name stacked_hash
+        Just (Thrift.Dependencies_pruned pruned) ->
+          check (Thrift.pruned_base pruned)
+        Nothing -> return False
+      where
+      check base = do
+        meta <- atomically $ Catalog.readMeta (envCatalog env) base
+        return $ predicateIdRef pred `elem` Thrift.metaCompletePredicates meta
+
+    -- Here the best we can do is say whether a Pid could have facts in a DB.
+    -- Because of ownership slicing it may be that even though
+    -- `Backend.predicateStats` gives a positive number all facts could be
+    -- filtered out.
+    sectionsStats :: IO (SeekSection -> Pid -> Bool)
+    sectionsStats = do
+      stackStats <- stats Backend.IncludeBase
+      topStats <- stats Backend.ExcludeBase
+      let baseStats = stackStats `minus` topStats
+          pidHasFacts seekWhere (Pid pid) = case seekWhere  of
+            SeekOnAllFacts -> hasFacts pid stackStats
+            SeekOnBase -> hasFacts pid baseStats
+            SeekOnStacked -> hasFacts pid topStats
+      return pidHasFacts
+
+    stats opts =
+      fmap Thrift.predicateStats_count
+      <$> PredicateStats.predicateStats env repo opts
+    minus = Map.unionWith (-)
+    hasFacts pid m = maybe False (> 0) $ Map.lookup pid m
+
+userQueryImpl
+  :: Database.Env
+  -> OpenDB s
+  -> ServerConfig.Config
+  -> CompilationMode
+  -> Boundaries
+  -> Lookup
+  -> Thrift.Repo
+  -> Thrift.UserQuery
+  -> IO (Results Stats Thrift.Fact)
+
+userQueryImpl
+  env
+  odb
+  config
+  mode
+  bounds
+  lookup
+  repo
+  query@Thrift.UserQuery{..} = do
+    let opts = fromMaybe def userQuery_options
+
+    case Thrift.userQueryOptions_syntax opts of
+      Thrift.QuerySyntax_ANGLE -> return ()
+      other -> throwIO $ Thrift.Exception $
+        "query syntax not supported: " <> Text.pack (show other)
+
+    let
+      schema = odbSchema odb
+      stored = Thrift.userQueryOptions_store_derived_facts opts
+      debug = Thrift.userQueryOptions_debug opts
+
+    schemaVersion <-
+      schemaVersionForQuery schema config userQuery_schema_id
+
+    (returnType,compileTime,diag,cont) <-
+      case Thrift.userQueryOptions_continuation opts of
+        Just ucont
+          | Just retTy <- Thrift.userQueryCont_returnType ucont -> do
+          (compileTime, _, returnType) <-
+            timeIt $ compileType schema schemaVersion retTy
+          return (returnType,compileTime,[],Right ucont)
+
+        -- This is either a new query or the continuation of a query
+        -- that returns a temporary predicate.
+        _ -> do
+          (compileTime, _, (query@QueryWithInfo{..}, ty, preds)) <-
+            timeIt $ compileAngleQuery
+              (envEnableRecursion env)
+              schemaVersion
+              schema
+              mode
+              userQuery_query
+              stored
+              (envDebug env)
+
+          predDiag <- if Thrift.queryDebugOptions_pred_has_facts debug then
+              getPredDiags env repo schema preds
+              else return []
+          let
+            irDiag =
+              [ "ir:\n" <> Text.pack (show (displayDefault qiQuery))
+              | Thrift.queryDebugOptions_ir debug ]
+
+            cont = case Thrift.userQueryOptions_continuation opts of
+              Just c -> Right c
+              Nothing -> Left query
+          return (ty,compileTime,irDiag <> predDiag,cont)
+
+    details <- getReturnPredicateDetails schema returnType
+
+    if Thrift.userQueryOptions_just_check opts then do
+      return $ emptyResult {resDiags = diag}
+    else do
+      let compileInfo = CompileInfo {
+        returnType = returnType,
+        compileTime = compileTime,
+        compileDiag = diag,
+        cont = cont
+        }
+      runQuery env odb config bounds lookup repo details compileInfo query
+
+data CompileInfo = CompileInfo {
+  returnType :: Type,
+  compileTime :: Double,
+  compileDiag :: [Text],
+  cont :: Either CodegenQuery UserQueryCont
+}
+
+getPredDiags
+  :: Database.Env
+  -> Thrift.Repo
+  -> DbSchema
+  -> [TcPred]
+  -> IO [Text]
+getPredDiags env repo schema preds = do
+  predStats <- PredicateStats.predicateStats env repo StackedDbOpts.IncludeBase
+  let predsMissing = filter (\p -> not (tcPredExist p predStats)) preds
+  return $ map warnDiag predsMissing
+    where
+      tcPredExist (PidRef pid _, _) predStats =
+        derived schema pid || hasFacts predStats pid
+      -- we assume derived predicates "exist" since we won't find any facts
+      derived schema pid = case lookupPid pid schema of
+        Just details -> case predicateDeriving details of
+          Derive DeriveOnDemand _ -> True
+          Derive DeriveIfEmpty _ -> True
+          _ -> False
+        Nothing -> error "Unknown Pid in getPredDiags"
+      hasFacts predStats pid = case Map.lookup (fromPid pid) predStats of
+        Just stat -> Thrift.predicateStats_count stat > 0
+        Nothing -> False
+      warnDiag :: TcPred -> Text
+      warnDiag (PidRef _ (PredicateId predRef _), Some span) = Text.pack $
+        "Warning: "
+        <> show (pretty span) ++ " "
+        <> Text.unpack (predicateRef_name predRef)
+        <> Text.unpack " doesn't exist in " ++ show (Thrift.repo_name repo)
+
+getReturnPredicateDetails :: DbSchema -> Type -> IO PredicateDetails
+getReturnPredicateDetails schema@DbSchema{..} returnType = do
+  case returnType of
+    Angle.PredicateTy _ (PidRef pid _) ->
+      case IntMap.lookup (fromIntegral (fromPid pid)) predicatesByPid of
+        Nothing -> throwIO $ Thrift.Exception "internal: no predicate"
+        Just d -> return d
+
+    _not_a_predicate -> do
+      return
+          -- This is a temporary Pid generated by Flatten.captureKey,
+          -- because the query doesn't return facts. In this case we
+          -- are pretending the query returns facts for a new predicate,
+          -- so we need a PredicateDetails to pass to unfoldFacts below.
+          -- (this is temporary, unfoldFacts wil go away in due course
+          -- when we compile it to bytecode).
+          PredicateDetails
+            { predicatePid = tempPid schema
+            , predicateKeyType = returnType
+            , predicateValueType = unit
+            , predicateId = tempPredicateId
+            , predicateSchema = error "predicateSchema"
+            , predicateTraversal = error "predicateTraversal"
+            , predicateTypecheck = error "predicateTypecheck"
+            , predicateDeriving = NoDeriving
+            , predicateInStoredSchema = False
+            }
+
+runQuery
+  :: Database.Env
+  -> OpenDB s
+  -> ServerConfig.Config
+  -> Boundaries
+  -> Lookup
+  -> Thrift.Repo
+  -> PredicateDetails
+  -> CompileInfo
+  -> Thrift.UserQuery
+  -> IO (Results Stats Thrift.Fact)
+runQuery
+  env
+  odb
+  config
+  bounds
+  lookup
+  repo
+  details
+  CompileInfo{..}
+  Thrift.UserQuery{..} = do
+    vlog 2 $ "return type: " <> show (displayDefault returnType)
+
+    let
+      schema@DbSchema{..} = odbSchema odb
+      opts = fromMaybe def userQuery_options
+      stored = Thrift.userQueryOptions_store_derived_facts opts
+
+    schemaVersion <-
+        schemaVersionForQuery schema config userQuery_schema_id
+    trans <- transformationsForQuery schema schemaVersion
+
+    unless (Text.null userQuery_predicate) $ do
+      -- With Angle queries, setting userQuery_predicate is
+      -- optional. If the client sets it, we will check it: this
+      -- can be a useful way to catch errors in the client.
+      -- If the query is not returning whole facts, then the
+      -- client should set this field to "".
+      let ref = SourceRef userQuery_predicate userQuery_predicate_version
+      checkPredicatesMatch schema details ref schemaVersion
+
+    expandPids <- optsExpandPids opts schemaVersion schema
+    let limits = mkQueryRuntimeOptions opts config expandPids
+
+    nextId <- case Thrift.userQueryOptions_continuation opts of
+      Just Thrift.UserQueryCont{..}
+        | userQueryCont_nextId > 0 -> return (Fid userQueryCont_nextId)
+      _otherwise -> firstFreeId lookup
+    derived <- FactSet.new nextId
+    let stack = stacked lookup derived
+
+    defineOwners <- if stored
+      then do
+        maybeOwnership <- readTVarIO (odbOwnership odb)
+        forM maybeOwnership $ \ownership ->
+          newDefineOwnership ownership nextId
+      else return Nothing
+
+    appliedTrans <- either (throwIO . Thrift.BadQuery) return $
+      transformationsFor schema trans returnType
+
+    ( qResults@QueryResults{..}
+      , queryDiag
+      , bytecodeSize
+      , codegenTime
+      , fullScans ) <-
+      case cont of
+        Right ucont -> do
+          let binaryCont = Thrift.userQueryCont_continuation ucont
+          results <- transformResultsBack appliedTrans <$>
+            restartCompiled
+              schemaInventory
+              defineOwners
+              stack
+              (Just $ predicatePid details)
+              limits
+              binaryCont
+          return (results, [], B.length binaryCont, 0, [])
+
+        Left query -> do
+          let
+            debug = Thrift.userQueryOptions_debug opts
+            bytecodeDiag sub =
+              [ "bytecode:\n" <> Text.unlines
+                (disassemble "Query" userQuerySysCalls $ compiledQuerySub sub)
+              | Thrift.queryDebugOptions_bytecode debug ]
+
+          bracket
+            (timeIt $ compileQuery (envEnableRecursion env) trans bounds query)
+            (\(_, _, sub) -> release $ compiledQuerySub sub)
+            $ \(codegenTime, _, sub) -> do
+              results <- transformResultsBack appliedTrans <$>
+                executeCompiled schemaInventory defineOwners stack sub limits
+
+              diags <-
+                evaluate $ force (bytecodeDiag sub) -- don't keep sub alive
+              sz <- evaluate $ Bytecode.size (compiledQuerySub sub)
+              let fullScans = compiledQueryFullScans sub
+              return (results, diags, sz, codegenTime, fullScans)
+
+    -- If we're storing derived facts, queue them for writing and
+    -- return the handle. We allow querying for stored derived
+    -- predicates with stored=True on a read-only DB; this is used
+    -- by the regression testing framework to test derived predicates.
+    maybeWriteHandle <-
+      if stored && (
+          isJust (odbWriting odb) ||
+          Thrift.userQueryOptions_omit_results opts)
+        then writeDerivedFacts env repo nextId derived defineOwners
+          queryResultsFacts
+        else return Nothing
+
+    userCont <- case queryResultsCont of
+      Nothing -> return Nothing
+      Just bs -> do
+        nextId <- firstFreeId derived
+        return $ Just $ mkUserQueryCont (Right returnType) bs nextId
+
+    stats <- getStats schema fullScans qResults
+
+    when (isJust userCont) $
+      addStatValueType "glean.query.truncated" 1 Stats.Sum
+
+    let ppType = renderStrict $ layoutPretty defaultLayoutOptions $
+          displayDefault returnType
+
+        results = Results
+          { resFacts = Vector.toList queryResultsFacts
+          , resPredicate = Just details
+          , resNestedFacts = mkNestedFacts queryResultsNestedFacts
+          , resCont = userCont
+          , resStats = stats
+          , resDiags = compileDiag ++ queryDiag
+          , resWriteHandle = maybeWriteHandle
+          , resFactsSearched = queryResultsStats
+          , resType = Just ppType
+          , resBytecodeSize = Just bytecodeSize
+          , resCompileTime = Just compileTime
+          , resCodegenTime = Just codegenTime
+          , resExecutionTime = Just queryResultsElapsedNs
+          , resResultBytes = Just queryResultsResultBytes
+          }
+
+    return $ if Thrift.userQueryOptions_omit_results opts
+      then withoutFacts results
+      else results
+
+transformationsForQuery
+  :: DbSchema
+  -> SchemaSelector
+  -> IO QueryTransformations
+transformationsForQuery schema selector = do
+  case allSchemaVersion schema selector of
+    Nothing -> throwIO $ Thrift.BadQuery "invalid schema_id"
+    Just schemaId ->
+      let transMap = predicatesTransformations schema in
+      case HashMap.lookup schemaId transMap of
+        Just trans -> return trans
+        Nothing -> throwIO $ Thrift.BadQuery "no transformations for schema_id"
+
+schemaVersionForQuery
+  :: DbSchema
+  -> ServerConfig.Config
+  -> Maybe Thrift.SchemaId  -- ^ SchemaId specified by client
+  -> IO SchemaSelector
+schemaVersionForQuery schema ServerConfig.Config{..} qid = do
+  use <-
+    case qid of
+      Nothing -> return LatestSchema
+      Just id
+        | id `Map.member` schemaEnvs schema -> return (SpecificSchemaId id)
+        | config_strict_query_schema_id ->
+            throwIO (Thrift.UnknownSchemaId id)
+        | otherwise -> do
+            logWarning $ "schema unavailable: " <> show id
+            return LatestSchema
+
+  vlog 1 $ "using schema ID: " <> show (pretty use)
+  return use
+
+optsExpandPids
+  :: Thrift.UserQueryOptions
+  -> SchemaSelector
+  -> DbSchema
+  -> IO (Set Pid)
+optsExpandPids opts schemaVersion dbSchema =
+  fmap Set.fromList $ forM (Thrift.userQueryOptions_expand_predicates opts) $
+    \(Thrift.SourcePredicate name version) -> do
+      let ref = SourceRef name version
+      case lookupPredicateSourceRef ref schemaVersion dbSchema of
+        Left err -> throwIO $ Thrift.BadQuery err
+        Right details -> return (predicatePid details)
+
+data CompilationMode
+  = NoExtraSteps
+  | IncrementalDerivation (SeekSection -> Pid -> Bool)
+
+compileAngleQuery
+  :: EnableRecursion
+  -> SchemaSelector
+    -- ^ Schema version to resolve unversioned predicates
+  -> DbSchema
+  -> CompilationMode
+    -- ^ only used in predicate derivations on incremental dbs
+  -> ByteString
+  -> Bool
+  -> DebugFlags
+  -> IO (CodegenQuery, Type, [TcPred])
+compileAngleQuery rec ver dbSchema mode source stored debug = do
+  parsed <- checkBadQuery Text.pack $ Angle.parseQuery source
+  ifDebug $ "parsed query: " <> show (displayDefault parsed)
+
+  let scope = addTmpPredicate $ fromMaybe HashMap.empty $
+        schemaNameEnv dbSchema ver
+
+  resolved <- checkBadQuery id $ runExcept $
+    runResolve latestAngleVersion scope $ resolveQuery parsed
+  ifDebug $ "resolved query: " <> show (displayDefault resolved)
+
+  (typechecked, preds) <- (checkBadQuery id =<<) $ runExceptT $
+    typecheck dbSchema (defaultTcOpts debug latestAngleVersion)
+      (dbSchemaRtsType dbSchema) resolved
+  ifDebug $ "typechecked query: " <> show (displayDefault (qiQuery typechecked))
+
+  flattened <- checkBadQuery id $ runExcept $
+    flatten rec dbSchema latestAngleVersion stored typechecked
+  ifDebug $ "flattened query: " <> show (displayDefault (qiQuery flattened))
+
+  optimised <- checkBadQuery id $ runExcept $ optimise flattened
+  ifDebug $ "optimised query: " <> show (displayDefault (qiQuery optimised))
+
+  reordered <- checkBadQuery id $ runExcept $ reorder dbSchema optimised
+  ifDebug $ "reordered query: " <> show (displayDefault (qiQuery reordered))
+
+  final <- case mode of
+    NoExtraSteps -> return reordered
+    IncrementalDerivation getStats -> do
+      vlog 2 "made incremental"
+      return $ makeIncremental getStats reordered
+
+  return (final, qiReturnType typechecked, preds)
+  where
+  ifDebug = when (queryDebug debug) . hPutStrLn stderr
+
+  checkBadQuery :: (err -> Text) -> Either err a -> IO a
+  checkBadQuery txt act = case act of
+    Left str -> throwIO $ Thrift.BadQuery $ txt str
+    Right a -> return a
+
+-- | Put the nested facts in the right form for the conversion to
+-- (JSON, Compact, Bin).
+mkNestedFacts :: Vector (Fid, Thrift.Fact) -> IntMap Thrift.Fact
+mkNestedFacts facts =
+  IntMap.fromList
+    [ (fromIntegral (fromFid id), f)
+    | (id,f) <- Vector.toList facts ]
+
+withoutFacts :: Results stats fact -> Results stats fact
+withoutFacts results = results
+    { resFacts = mempty
+    , resNestedFacts = mempty
+    }
+
+mkQueryRuntimeOptions
+  :: Thrift.UserQueryOptions
+  -> ServerConfig.Config
+  -> Set Pid
+  -> QueryRuntimeOptions
+mkQueryRuntimeOptions
+    Thrift.UserQueryOptions{..} ServerConfig.Config{..} expandPids =
+  QueryRuntimeOptions
+    { queryMaxResults = userQueryOptions_max_results
+        <|> config_default_max_results -- from ServerConfig
+    , queryMaxBytes = userQueryOptions_max_bytes
+        <|> config_default_max_bytes -- from ServerConfig
+    , queryMaxTimeMs = userQueryOptions_max_time_ms
+        <|> config_default_max_time_ms -- from ServerConfig
+    , queryMaxSetSize = config_max_set_size_bytes
+    , queryWantStats = userQueryOptions_collect_facts_searched
+    , queryDepth = if
+        | userQueryOptions_recursive && not userQueryOptions_omit_results ->
+          ExpandRecursive
+        | not (null expandPids) -> ExpandPartial expandPids
+        | otherwise -> ResultsOnly
+    }
+
+emptyResult :: Results Stats fact
+emptyResult = Results {
+    resFacts = mempty
+  , resPredicate = Nothing
+  , resNestedFacts = mempty
+  , resCont = Nothing
+  , resStats = Stats {
+      statFactCount = 0
+    , statResultCount = 0
+    , statFullScans = []
+    }
+  , resDiags = []
+  , resWriteHandle = Nothing
+  , resFactsSearched = Nothing
+  , resType = Nothing
+  , resBytecodeSize = Nothing
+  , resCompileTime = Nothing
+  , resCodegenTime = Nothing
+  , resExecutionTime = Nothing
+  , resResultBytes = Nothing
+  }
+
+
+{- Note [Writing derived facts]
+
+When deriving, we
+  (1) Run a query that produces all the derived facts
+  (2) Serialize the FactSet
+  (3) Write this to the DB
+
+As the query runs, it writes derived facts into a FactSet and also
+produces a set of results. The results are correct, however the
+FactSet may contain some additional invalid facts. For example, this
+can happen if the derived predicate is something like
+
+predicate P : string
+  X where
+    Q X;
+    X != "foo"
+
+when we compile the query, it can look something like
+
+F where
+  Q X;
+  F = P<- X;    -- (*)
+  X != "foo"
+
+The statement labelled (*) produces the derived fact. Note that this
+is just a regular statement; it can get arbitrarily reordered relative
+to the other statements. In this case the compiler chose to put it
+before the final filter X != "foo", which means that we'll create some
+derived facts that aren't actually true. There's nothing wrong with
+this: the result of the query is still correct, but we have to be
+careful to use the query results and not just write the whole contents
+of the FactSet to the DB.
+
+It would be difficult to ensure the compiler always ordered F = P<- X
+after the filter, there's nothing requiring it to do this. We can't
+use statement ordering for this, because statement ordering is for
+optimisation and shouldn't change sementics. The compiler can override
+ordering hints if it wants.
+
+The right thing to do is to use the query results to filter the
+FactSet, and fortunately there's a good place to do this: we already
+reorder the results when we serialize the FactSet (for ownership
+reasons), so we can do the filtering there.
+-}
+
+writeDerivedFacts
+  :: Env
+  -> Thrift.Repo
+  -> Fid
+  -> FactSet
+  -> Maybe DefineOwnership
+  -> Vector (Fid, Thrift.Fact)
+  -> IO (Maybe Thrift.Handle)
+writeDerivedFacts env repo firstId derived owned results = do
+  -- See Note [Writing Derived Facts] for why we filter here
+  let order = VS.fromList
+         [ fromFid fid
+         | (fid,_) <- Vector.toList results
+         , fid >= firstId  -- ignore existing facts
+         ]
+  batch <- case owned of
+    Nothing -> FactSet.serializeReorder derived order
+    Just define -> do
+      nextId <- firstFreeId derived
+      let count = fromIntegral (fromFid nextId - fromFid firstId)
+      sorted <- defineOwnershipSortByOwner define count order
+      FactSet.serializeReorder derived sorted
+  -- If the batch is empty, we may still have new ownership data about
+  -- existing facts, so we have to write that
+  if Thrift.batch_count batch == 0 && isNothing owned
+    then return Nothing
+    else do
+      resp <- enqueueBatch env Thrift.ComputedBatch
+        { computedBatch_repo = repo
+        , computedBatch_remember = True
+        , computedBatch_batch = batch }
+        owned
+      case resp of
+        Thrift.SendResponse_handle handle -> return (Just handle)
+        Thrift.SendResponse_retry (Thrift.BatchRetry s) ->
+          throwIO $ Thrift.Retry s
+
+
+-- | Check that the predicate declared in the UserQuery request
+-- matches the actual type of the query as determined by the
+-- typechecker. This adds some rudimentary type safety: the predicate
+-- declared in the UserQuery is typically the one expected at the call
+-- site.
+checkPredicatesMatch
+  :: DbSchema
+  -> PredicateDetails
+  -> SourceRef
+  -> SchemaSelector
+  -> IO ()
+checkPredicatesMatch dbSchema details predicate schemaVer = do
+  case lookupPredicateSourceRef predicate schemaVer dbSchema of
+    Left err -> throwIO $ Thrift.BadQuery err
+    Right details' ->
+      if predicatePid details == predicatePid details'
+        then return ()
+        else throwIO $ Thrift.BadQuery $ mconcat
+          [ "predicate " <> showRef predicate <>
+            " does not match type of query: "
+          <> predicateRef_name (predicateRef details) <> "."
+          <> showt (predicateRef_version (predicateRef details)) ]
+
+
+data Stats = Stats
+  { statFactCount :: {-# UNPACK #-} !Int
+  , statResultCount :: {-# UNPACK #-} !Int
+  , statFullScans :: [PredicateRef]
+  }
+
+getStats :: DbSchema -> [Pid] -> QueryResults -> IO Stats
+getStats schema fullScans QueryResults{..} = do
+  let
+    results =
+      Vector.length queryResultsFacts
+
+    facts =
+      Vector.length queryResultsFacts +
+      Vector.length queryResultsNestedFacts
+
+    pref pid = case lookupPid pid schema of
+      Nothing -> error "Unknown Pid in getStats"
+      Just details -> predicateIdRef $ predicateId details
+
+  addStatValueType "glean.query.facts" facts Stats.Sum
+  addStatValueType "glean.query.results" results Stats.Sum
+  return $ Stats
+    { statFactCount = facts
+    , statResultCount  = results
+    , statFullScans = map pref fullScans
+    }
+
+withStats :: IO (Results Stats fact) -> IO (Results Thrift.UserQueryStats fact)
+withStats io = do
+  (secs, bytes, res) <- timeIt io
+  let stats = Thrift.UserQueryStats
+        { Thrift.userQueryStats_num_facts =
+            fromIntegral $ statFactCount $ resStats res
+        , Thrift.userQueryStats_result_count =
+            fromIntegral $ statResultCount $ resStats res
+        , Thrift.userQueryStats_elapsed_ns = truncate (secs * 1000000000)
+        , Thrift.userQueryStats_allocated_bytes = fromIntegral bytes
+        , Thrift.userQueryStats_facts_searched = resFactsSearched res
+        , Thrift.userQueryStats_bytecode_size =
+            fromIntegral <$> resBytecodeSize res
+        , Thrift.userQueryStats_compile_time_ns =
+            fmap (round . (* 1000000000)) (resCompileTime res )
+        , Thrift.userQueryStats_codegen_time_ns =
+            fmap (round . (* 1000000000)) (resCodegenTime res )
+        , Thrift.userQueryStats_execute_time_ns =
+            fromIntegral <$> resExecutionTime res
+        , Thrift.userQueryStats_full_scans = statFullScans $ resStats res
+        , Thrift.userQueryStats_result_bytes =
+            fromIntegral <$> resResultBytes res
+        }
+  return res{ resStats = stats }
+
+mkUserQueryCont
+  :: Either (Set Pid) Type
+  -> ByteString
+  -> Fid
+  -> Thrift.UserQueryCont
+mkUserQueryCont contInfo cont nextId =
+  hashUserQueryCont $ Thrift.UserQueryCont
+  { userQueryCont_continuation = cont
+  , userQueryCont_nextId = fromFid nextId
+  , userQueryCont_version = fromIntegral Bytecode.version
+  , userQueryCont_hash = 0
+  , userQueryCont_returnType = returnType
+  , userQueryCont_pids = pids
+  }
+  where
+    returnType = case contInfo of
+      Right ty -> Just $ serializeType ty
+      Left _ -> Nothing
+    pids = case contInfo of
+      Right _ -> []
+      Left ps -> map fromPid $ Set.elems ps
+
+checkUserQueryCont :: Thrift.UserQueryCont -> IO ()
+checkUserQueryCont cont@Thrift.UserQueryCont{..} = do
+  when
+    (userQueryCont_version < fromIntegral Bytecode.lowestSupportedVersion
+      || userQueryCont_version > fromIntegral Bytecode.version)
+    $ throwIO $ Thrift.BadQuery $
+        "unsupported query continuation version "
+          <> Text.pack (show userQueryCont_version)
+  when
+    (userQueryCont_hash /= Thrift.userQueryCont_hash (hashUserQueryCont cont))
+    $ throwIO $ Thrift.BadQuery "invalid query continuation hash"
+
+hashUserQueryCont :: Thrift.UserQueryCont -> Thrift.UserQueryCont
+hashUserQueryCont Thrift.UserQueryCont{..} = Thrift.UserQueryCont
+  -- NOTE: The hash is really just a checksum to detect accidental corruption
+  -- so a 64 bit non-crypto hash should work fine. Hashable currently uses a
+  -- slightly broken (https://github.com/tibbe/hashable/issues/190) version of
+  -- FNV-1 but should still be good enough.
+  { userQueryCont_hash = fromIntegral $ hash
+      ( userQueryCont_continuation
+      , userQueryCont_nextId
+      , userQueryCont_version
+      , userQueryCont_returnType
+      )
+  , ..
+  }
+
+serializeType :: Type -> ByteString
+serializeType = Text.encodeUtf8 . renderStrict . layoutCompact .
+  displayDefault
+    -- Note that we have to print PredicateIds as PredicateRefs, because
+    -- the parser will parse it as a source type. The default display options
+    -- do exactly that.
+
+compileType :: DbSchema -> SchemaSelector -> ByteString -> IO Type
+compileType schema version src = do
+  parsed <- checkParsed $ Angle.parseType src
+  let scope = addTmpPredicate $ fromMaybe HashMap.empty $
+        schemaNameEnv schema version
+  resolved <- checkResolved $ runResolve latestAngleVersion scope $
+    resolveType parsed
+  checkConverted $ dbSchemaRtsType schema resolved
+  where
+    checkParsed = either (badQuery . Text.pack) return
+    checkResolved = either badQuery return . runExcept
+    checkConverted = maybe (badQuery "type not present in schema") return
+
+    badQuery :: Text -> IO a
+    badQuery err = throwIO $ Thrift.BadQuery $ Text.unlines
+      ["unable to compile type: ", err, "type was: ", Text.decodeUtf8 src]
diff --git a/glean/db/Glean/Query/Vars.hs b/glean/db/Glean/Query/Vars.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Query/Vars.hs
@@ -0,0 +1,213 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Collecting the variables mentioned by a term
+module Glean.Query.Vars (
+    VarId,
+    VarSet,
+    WhichVars(..),
+    VarsOf(..),
+    vars,
+    varsBound,
+    varsUsed,
+    Fresh(..),
+    fresh,
+    freshWild,
+    freshWildVars,
+    reWild,
+    reWildGenerator,
+    reWildQuery,
+  ) where
+
+import qualified Data.IntSet as IntSet
+import Data.IntSet (IntSet)
+import qualified Data.IntMap as IntMap
+import Data.IntMap (IntMap)
+import Data.List.NonEmpty (NonEmpty)
+
+import Glean.Display
+import Glean.Query.Codegen.Types
+import Glean.RTS.Term
+import Glean.RTS.Types as RTS
+
+type VarId = Int
+type VarSet = IntSet
+type VarMap = IntMap VarId
+
+vars :: VarsOf a => a -> VarSet
+vars x = varsOf AllVars x IntSet.empty
+
+varsBound :: VarsOf a => a -> VarSet
+varsBound x = varsOf VarsBound x IntSet.empty
+
+varsUsed :: VarsOf a => a -> VarSet
+varsUsed x = varsOf VarsUsed x IntSet.empty
+
+data WhichVars = VarsUsed | VarsBound | AllVars
+  deriving Eq
+
+class VarsOf a where
+  varsOf :: WhichVars -> a -> VarSet -> VarSet
+
+instance VarsOf Generator where
+  varsOf w (FactGenerator _ key val _) r = varsOf w key $! varsOf w val r
+  varsOf w (TermGenerator exp) r = varsOf w exp r
+  varsOf w (DerivedFactGenerator _ key val) r = varsOf w key $! varsOf w val r
+  varsOf w (ArrayElementGenerator _ arr) r = varsOf w arr r
+  varsOf w (SetElementGenerator _ set) r = varsOf w set r
+  varsOf w (PrimCall _ args _) r = varsOf w args r
+
+instance (VarsOf a) => VarsOf [a] where
+  varsOf w container r = foldr (varsOf w) r container
+
+instance (VarsOf a) => VarsOf (NonEmpty a) where
+  varsOf w container r = foldr (varsOf w) r container
+
+instance VarsOf m => VarsOf (Term m) where
+  varsOf w t r = case t of
+    Byte{} -> r
+    Nat{} -> r
+    ByteArray{} -> r
+    String{} -> r
+    Ref x -> varsOf w x r
+    Tuple xs -> varsOf w xs r
+    Array xs -> varsOf w xs r
+    Alt _ x -> varsOf w x r
+
+instance VarsOf (Match () Var) where
+  varsOf w m r = case m of
+    MatchWild{} -> r
+    MatchNever{} -> r
+    MatchFid{} -> r
+    MatchBind (Var _ v _) -> if w == VarsUsed then r else IntSet.insert v r
+    MatchVar (Var _ v _) -> if w == VarsBound then r else IntSet.insert v r
+    MatchAnd a b -> varsOf w a $! varsOf w b r
+    MatchPrefix _ t -> varsOf w t r
+    MatchArrayPrefix _ty pre all -> varsOf w pre (varsOf w all r)
+    MatchExt{} -> r
+
+instance VarsOf CgQuery where
+  varsOf w (CgQuery head stmts) r = varsOf w head $! varsOf w stmts r
+
+instance VarsOf CgStatement where
+  varsOf w (CgStatement lhs gen) r = varsOf w lhs $! varsOf w gen r
+  varsOf w (CgAllStatement (Var _ v _) expr stmts) r =
+    varsOf w expr $! varsOf w stmts $!
+    if w /= VarsUsed then IntSet.insert v r else r
+  varsOf w (CgNegation stmts) r = varsOf w stmts r
+  varsOf w (CgDisjunction stmtss) r = varsOf w stmtss r
+  varsOf w (CgConditional cond then_ else_) r =
+    varsOf w cond $! varsOf w then_ $! varsOf w else_ r
+
+-- -----------------------------------------------------------------------------
+-- Fresh variables
+
+class Fresh m where
+  peek :: m VarId
+  alloc :: m VarId
+
+fresh :: (Monad m, Fresh m) => Type -> m Var
+fresh ty = do
+  n <- alloc
+  return (Var ty n Nothing)
+
+-- -----------------------------------------------------------------------------
+-- Replace wildcards with fresh variables
+
+freshWildVars :: (Monad m, Fresh m) => (a -> m a) -> a -> m (a, VarSet)
+freshWildVars freshen thing = do
+  v0 <- peek
+  pat' <- freshen thing
+  v1 <- peek
+  return (pat', IntSet.fromList [v0..v1])
+
+-- | Instantiate all the wildcards in a pattern with fresh
+-- variables. This makes the pattern usable when we substitute it, for
+-- two reasons: (1) it might occur in multiple places, and we must
+-- ensure that it matches the same term in all places, and (2) it
+-- might occur in an expression (E where ...) where wildcards don't
+-- make sense.
+freshWild :: forall m . (Monad m, Fresh m) => Pat -> m Pat
+freshWild pat = mapM freshWildMatch pat
+  where
+  freshWildMatch :: Match a Var -> m (Match a Var)
+  freshWildMatch m = case m of
+    MatchWild ty -> MatchBind <$> fresh ty
+    MatchPrefix str rest -> MatchPrefix str <$> mapM freshWildMatch rest
+    MatchArrayPrefix ty pre all ->
+      MatchArrayPrefix ty
+        <$> (mapM.mapM) freshWildMatch pre
+        <*> mapM freshWildMatch all
+    MatchNever ty -> return (MatchNever ty)
+    MatchFid f -> return (MatchFid f)
+    MatchBind v -> return (MatchVar v)  -- also make all variables MatchVar
+    MatchVar v -> return (MatchVar v)
+    MatchAnd x y -> MatchAnd <$> mapM freshWildMatch x <*> mapM freshWildMatch y
+    MatchExt _ -> error "freshWildMatch"
+
+-- | Replace unused variables with wildcards and remap variable numbers
+reWild :: VarMap -> Pat -> Pat
+reWild used pat = fmap reWildMatch pat
+  where
+  reWildMatch :: Match () Var -> Match () Var
+  reWildMatch m = case m of
+    MatchWild ty -> MatchWild ty
+    MatchBind (Var ty n x) -> case IntMap.lookup n used of
+      Nothing -> MatchWild ty
+      Just new -> MatchBind (Var ty new x)
+    MatchVar (Var ty n x) -> case IntMap.lookup n used of
+      Nothing -> error $ "reWild: " <> show (displayVerbose m)
+      Just new -> MatchVar (Var ty new x)
+    MatchPrefix str rest -> MatchPrefix str (fmap reWildMatch rest)
+    MatchArrayPrefix ty pre all ->
+      MatchArrayPrefix ty ((fmap . fmap) reWildMatch pre) (fmap reWildMatch all)
+    MatchAnd x y -> MatchAnd (fmap reWildMatch x) (fmap reWildMatch y)
+    MatchNever ty -> MatchNever ty
+    MatchFid f -> MatchFid f
+    MatchExt _ -> error "reWild"
+
+reWildGenerator :: VarMap -> Generator -> Generator
+reWildGenerator used gen = case gen of
+  FactGenerator pid key val sec ->
+    FactGenerator pid (reWild used key) (reWild used val) sec
+  TermGenerator t -> TermGenerator (reWild used t)
+  DerivedFactGenerator pid key val ->
+    DerivedFactGenerator pid (reWild used key) (reWild used val)
+  ArrayElementGenerator ty exp ->
+    ArrayElementGenerator ty (reWild used exp)
+  SetElementGenerator ty exp ->
+    SetElementGenerator ty (reWild used exp)
+  PrimCall op args ty ->
+    PrimCall op (map (reWild used) args) ty
+
+reWildStatement :: VarMap -> CgStatement -> CgStatement
+reWildStatement used (CgStatement lhs rhs) =
+  CgStatement (reWild used lhs) (reWildGenerator used rhs)
+reWildStatement used s@(CgAllStatement (Var ty n x) expr stmts) =
+  case IntMap.lookup n used of
+    Nothing -> error $
+      "reWildStatement: var " <> show n <>
+      " not in scope in " <> show (displayVerbose s) <>
+      "\nVarMap: " <> show used
+    Just new ->
+      CgAllStatement
+        (Var ty new x) (reWild used expr)
+        (map (reWildStatement used) stmts)
+reWildStatement used (CgNegation stmts) =
+  CgNegation (map (reWildStatement used) stmts)
+reWildStatement used (CgDisjunction stmtss) =
+  CgDisjunction (map (map (reWildStatement used)) stmtss)
+reWildStatement used (CgConditional cond then_ else_) =
+  CgConditional
+    (map (reWildStatement used) cond)
+    (map (reWildStatement used) then_)
+    (map (reWildStatement used) else_)
+
+reWildQuery :: VarMap -> CgQuery -> CgQuery
+reWildQuery used (CgQuery head stmts) =
+  CgQuery (reWild used head) (map (reWildStatement used) stmts)
diff --git a/glean/db/Glean/Write/JSON.hs b/glean/db/Glean/Write/JSON.hs
new file mode 100644
--- /dev/null
+++ b/glean/db/Glean/Write/JSON.hs
@@ -0,0 +1,462 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE MultiWayIf #-}
+
+module Glean.Write.JSON
+  ( buildJsonBatch
+  , syncWriteJsonBatch
+  , writeJsonBatch
+  ) where
+
+import Control.Exception hiding (catch, throw)
+import Control.Monad
+import Control.Monad.Reader
+import Control.Monad.Catch
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Unsafe as BS
+import Data.Coerce (coerce)
+import Data.Default
+import Data.IORef
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Compat.Prettyprinter hiding ((<>))
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Vector.Storable as Vector
+import Foreign hiding (void)
+import Foreign.C.Types (CSize)
+import TextShow hiding (Builder)
+
+import Thrift.Protocol.JSON.Base64
+import Util.FFI (invoke)
+
+import Glean.Database.Open
+import Glean.Database.Write.Batch
+import Glean.Database.Schema.Types
+import Glean.Database.Types as Database
+import Glean.Display
+import qualified Glean.FFI as FFI
+import Glean.RTS as RTS
+import Glean.RTS.Builder
+import Glean.RTS.Set
+import Glean.RTS.Constants
+import qualified Glean.RTS.Foreign.JSON as J
+import Glean.RTS.Types
+import Glean.Angle.Types hiding (Type)
+import Glean.Schema.Util
+import Glean.Types as Thrift hiding (Value, Nat, Byte)
+
+
+syncWriteJsonBatch
+  :: Env
+  -> Repo
+  -> [Thrift.JsonFactBatch]
+  -> Maybe Thrift.SendJsonBatchOptions
+  -> IO ()
+syncWriteJsonBatch env repo batches opts = do
+  let batch =
+        Thrift.SendJsonBatch
+          { Thrift.sendJsonBatch_batches = batches
+          , Thrift.sendJsonBatch_options = opts
+          , Thrift.sendJsonBatch_remember = False }
+  content <- writeJsonBatch env repo batch
+  void $ syncWriteContentDatabase env repo content
+
+writeJsonBatch
+  :: Env
+  -> Repo
+  -> SendJsonBatch
+  -> IO WriteContent
+writeJsonBatch env repo SendJsonBatch{..} = do
+  dbSchema <- withOpenDatabase env repo (return . Database.odbSchema)
+  writeContentFromBatch <$>
+    buildJsonBatch dbSchema sendJsonBatch_options sendJsonBatch_batches
+
+buildJsonBatch
+  :: DbSchema
+  -> Maybe SendJsonBatchOptions
+  -> [JsonFactBatch]
+  -> IO Batch
+buildJsonBatch dbSchema opts batches =
+  withFactBuilder $ \builders ->
+    forM_ batches $ \JsonFactBatch{..} ->
+      writeFacts dbSchema (fromMaybe def opts) builders
+        jsonFactBatch_predicate jsonFactBatch_facts jsonFactBatch_unit
+
+writeFacts
+  :: DbSchema
+  -> SendJsonBatchOptions
+  -> FactBuilder
+  -> PredicateRef
+  -> [ByteString]  -- ^ The facts to write, in JSON
+  -> Maybe ByteString -- ^ The unit that owns the facts, if any
+  -> IO ()
+writeFacts dbSchema opts builder@FactBuilder{..} pred factList maybeUnit = do
+  details <- predDetailsForWriting dbSchema pred
+  before <- readIORef nextId
+  mapM_ (writeFact dbSchema opts builder details) factList
+  after <- readIORef nextId
+  forM_ maybeUnit $ \unit ->
+    when (after > before) $ do
+      -- merge adjacent ranges
+      let merge _ (Fid last : rest) | last+1 == before = Fid (after-1) : rest
+          merge new old = new ++ old
+      modifyIORef' owned $
+        HashMap.insertWith merge unit [Fid (after-1), Fid before]
+
+predDetailsForWriting :: DbSchema -> PredicateRef -> IO PredicateDetails
+predDetailsForWriting dbSchema (PredicateRef name ver) = do
+  let sourceRef = SourceRef name (Just ver)
+  case lookupPredicateSourceRef sourceRef LatestSchema dbSchema of
+    Right info ->
+      assert (predicateInStoredSchema info) $ return info
+      -- it should be impossible for predicateInStoredSchema to be
+      -- False because we don't update the schema of a writable DB.
+    Left err ->
+      throwIO $ Thrift.Exception err
+
+writeFact
+  :: DbSchema
+  -> SendJsonBatchOptions
+  -> FactBuilder
+  -> PredicateDetails
+  -> ByteString
+  -> IO ()
+writeFact dbSchema opts builders details str =
+  J.withParsed str $ \json ->
+    runReaderT (writeJsonFact dbSchema opts details json) builders
+
+
+data FactBuilder = FactBuilder
+  { facts :: Builder
+  , nextId :: {-# UNPACK #-} !(IORef Int64)
+  , idsRef :: {-# UNPACK #-} !(IORef [Fid])  -- TODO: use a Storable Vector
+  , owned :: {-# UNPACK #-} !(IORef (HashMap ByteString [Fid]))
+      -- maps each unit to a *reversed* list of inclusive fact ID ranges
+      -- e.g. [end2,start2,end1,start1,end0,start0]
+      -- reversed so that we can prepend the next one easily and merge it
+      -- with the previous one.
+  }
+
+withFactBuilder :: (FactBuilder -> IO ()) -> IO Thrift.Batch
+withFactBuilder action =
+  withBuilder $ \facts -> do
+  nextId <- newIORef firstAnonId
+  idsRef <- newIORef []
+  owned <- newIORef HashMap.empty
+  action FactBuilder{..}
+  mem <- finishBuilder facts
+  ids <- readIORef idsRef
+  ownerMap <- readIORef owned
+  return $ Thrift.Batch
+    firstAnonId
+    (fromIntegral (length ids))
+    mem
+    (Just $ Vector.fromList $ coerce $ reverse ids)
+    (fmap (Vector.fromList . coerce . reverse) ownerMap)
+    mempty
+    Nothing -- TODO: we should have a schema ID for JSON batches
+
+
+type WriteFacts a = ReaderT FactBuilder IO a
+
+
+writeBatchFact :: Builder -> Pid -> Builder -> CSize -> WriteFacts ()
+writeBatchFact builder pid clause key_size = liftIO $
+  -- TODO: avoid copy
+  invoke $ glean_push_fact builder pid clause key_size
+
+namedFact :: Fid -> Pid -> Builder -> CSize -> WriteFacts Fid
+namedFact fid pid clause key_size = do
+  when (fromFid fid >= firstAnonId) $
+    liftIO $ throwIO $ Thrift.Exception $ "id too high: " <> showt (fromFid fid)
+  FactBuilder{..} <- ask
+  writeBatchFact facts pid clause key_size
+  id <- liftIO $ readIORef nextId
+  liftIO $ writeIORef nextId $! id+1
+  liftIO $ modifyIORef' idsRef (fid:)
+  return (Fid id)
+
+anonFact :: Pid -> Builder -> CSize -> WriteFacts Fid
+anonFact pid clause key_size = do
+  FactBuilder{..} <- ask
+  writeBatchFact facts pid clause key_size
+  id <- liftIO $ readIORef nextId
+  liftIO $ writeIORef nextId $! id+1
+  liftIO $ modifyIORef' idsRef (Fid Thrift.iNVALID_ID :)
+     -- Thrift.iNVALID_ID: this tells the fact renamer that this Id
+     -- maps to itself. This is so that we avoid needing to construct
+     -- a mapping with all the Ids for anonymous facts.
+  return (Fid id)
+
+--
+-- | Convert a JSON value to a Term, according to the type (Type) given
+-- by the schema for this predicate.
+--
+writeJsonFact
+  :: DbSchema                           -- ^ needed for looking up typerefs
+  -> Thrift.SendJsonBatchOptions        -- ^ needed for no_base64_binary
+  -> PredicateDetails
+  -> J.Value
+  -> WriteFacts ()
+writeJsonFact
+    dbSchema
+    Thrift.SendJsonBatchOptions{..}
+    details json =
+  wrapJsonContextM json $ void $ factToTerm details json
+  where
+
+  factToTerm PredicateDetails{..} json@(J.Object obj) = do
+    r <- lift $ J.field obj "id"
+    case r of
+      Just (J.Int id)
+        | J.arity obj == 1 ->
+          if id == fromFid invalidFid
+            then invalidFactIdError
+            else return (Fid id)
+        | otherwise -> fact 1 (namedFact (Fid id)) obj
+      _ -> fact 0 anonFact obj
+    where
+      -- id_arity is 0 if we don't have an id field and 1 otherwise
+      fact id_arity create obj = do
+        key <- do
+          r <- lift $ J.field obj "key"
+          case r of
+            Just key -> return key
+            Nothing -> badFact json
+        val <- lift $ J.field obj "value"
+        when (J.arity obj /= id_arity + if isJust val then 2 else 1) $
+          badFact json
+        withBuilder $ \clause -> do
+          jsonToTerm clause predicateKeyType key
+          key_size <- liftIO $ sizeOfBuilder clause
+          forM_ val $ \v ->
+            jsonToTerm clause predicateValueType v
+          create predicatePid clause key_size
+  factToTerm _ json = badFact json
+
+  wrapJsonContextM :: J.Value -> WriteFacts a -> WriteFacts a
+  wrapJsonContextM json act =
+    act `catch` \(Thrift.Exception msg) -> do
+      msg' <- wrapJsonContext json (pretty msg)
+      throwM $ Thrift.Exception $ Text.pack $ show msg'
+
+  wrapJsonContext :: MonadIO m => J.Value -> Doc ann -> m (Doc ann)
+  wrapJsonContext json doc = do
+    enc <- liftIO $ J.encode json
+    return $ vcat
+      [ doc
+      , "in JSON term:"
+      , indent 2 (pretty (Text.decodeUtf8 enc))
+      ]
+
+  badFact :: J.Value -> WriteFacts a
+  badFact json = do
+    msg <- wrapJsonContext json $ vcat
+      [ "Expecting a fact, which should be of the form:"
+      , indent 2 "{[\"id\" : N, ] \"key\": ... [, \"value\": ...]}"
+      ]
+    throwM $ Thrift.Exception $ Text.pack $ show msg
+
+  -- Defining a fact with ID 0 means "don't care"; we want this
+  -- behaviour because Thrift serialization will use ID 0 when the
+  -- "id" field is unspecified. However, we don't support referring to
+  -- fact ID 0 (see anonFact above), so catch and report that error
+  -- here rather than waiting for the typechecker.
+  invalidFactIdError :: WriteFacts a
+  invalidFactIdError = liftIO $ do
+    enc <- J.encode json
+    throwIO $ Thrift.Exception $ Text.pack $ show $ vcat
+      [ "Cannot use " <> pretty (fromFid invalidFid) <> " as a fact ID:"
+      , indent 2 (pretty (Text.decodeUtf8 enc))
+      ]
+
+  jsonToTerm
+    :: Builder
+    -> Type                               -- ^ the schema type
+    -> J.Value                            -- ^ the JSON value
+    -> WriteFacts ()
+  jsonToTerm b typ v = case (typ, v) of
+    (NatTy, J.Int n) ->
+      lift $ invoke $ glean_push_value_nat b $ fromIntegral n
+    (ByteTy, J.Int n) ->
+      lift $ invoke $ glean_push_value_byte b $ fromIntegral n
+    (StringTy, J.String (J.ByteStringRef p n)) ->
+      lift $ invoke $ glean_push_value_string b (castPtr p) n
+    (ArrayTy ByteTy, J.String (J.ByteStringRef p n))
+      | sendJsonBatchOptions_no_base64_binary -> lift $ do
+          invoke $ glean_push_value_array b n
+          invoke $ glean_push_value_bytes b (castPtr p) n
+      | otherwise -> lift $ do
+          bytes <-
+            decodeBase64 <$> BS.unsafePackCStringLen (castPtr p, fromIntegral n)
+          FFI.unsafeWithBytes bytes $ \ptr len -> do
+            invoke $ glean_push_value_array b len
+            invoke $ glean_push_value_bytes b (castPtr ptr) len
+    (ArrayTy ty, J.Array arr) -> do
+      let !n = J.size arr
+      lift $ invoke $ glean_push_value_array b $ fromIntegral n
+      when (n > 0) $ forM_ [0 .. n-1] $ \i -> do
+        x <- lift $ J.index arr i
+        jsonToTerm b ty x
+    (SetTy byteTy, J.String (J.ByteStringRef p n))
+      | ByteTy == repType byteTy -> if
+        | sendJsonBatchOptions_no_base64_binary ->
+          withWordRtsSet $ \rtsset ->
+            lift $ do
+            insertBytesRtsSet rtsset p n
+            buildWordSetBytes rtsset b
+        | otherwise -> lift $ do
+            bytes <- decodeBase64 <$>
+              BS.unsafePackCStringLen (castPtr p, fromIntegral n)
+            FFI.unsafeWithBytes bytes $ \ptr len ->
+              withWordRtsSet $ \rtsset -> do
+                insertBytesRtsSet rtsset (castPtr ptr) len
+                buildWordSetBytes rtsset b
+    (SetTy natTy, J.Array set)
+      | NatTy == repType natTy ->
+      withWordRtsSet $ \rtsset -> do
+        let !n = J.size set
+        forM_ [0 .. n-1] $ \i -> do
+          J.Int n <- lift $ J.index set i
+          lift $ insertWordRtsSet rtsset n
+        lift $ buildWordSet rtsset b
+    (SetTy ty, J.Array set) ->
+      withBuilder $ \tb ->
+      withRtsSet $ \rtsset -> do
+        let !n = J.size set
+        forM_ [0 .. n-1] $ \i -> do
+          x <- lift $ J.index set i
+          jsonToTerm tb ty x
+          lift $ insertBuilder rtsset tb
+          lift $ resetBuilder tb
+        lift $ buildSet rtsset b
+    (RecordTy fields, J.Object obj) -> do
+      let
+        doField !n (FieldDef name ty) = do
+          r <- lift $ J.field obj $ Text.encodeUtf8 name
+          case r of
+            Just val -> do
+              jsonToTerm b ty val
+              return $! n+1
+            Nothing -> do
+              lift $ defaultValue b v (name, ty)
+              return n
+      n <- foldM doField 0 fields
+      -- ensure that all the fields mentioned in the fact are valid
+      when (J.arity obj /= n) $ termError typ v
+    (SumTy fields, J.Object obj)
+      | J.arity obj == 1 -> do
+          let -- this is O(number of alternatives) but I don't expect this is
+              -- a problem
+              get !n (FieldDef name ty : rest) = do
+                -- TODO: avoid the encodeUtf8 (name should really be a
+                -- bytestring)
+                r <- lift $ J.field obj $ Text.encodeUtf8 name
+                case r of
+                  Just val -> do
+                    lift $ invoke $ glean_push_value_selector b n
+                    jsonToTerm b ty val
+                  Nothing -> get (n+1) rest
+              get _ _ = termError typ v
+          get 0 fields
+    (NamedTy _ (ExpandedType _ ty), val) -> jsonToTerm b ty val
+    (PredicateTy{}, J.Int n)
+      | n == fromFid invalidFid -> invalidFactIdError
+      | otherwise -> lift $ invoke $ glean_push_value_fact b $ Fid n
+    -- allow { "id": N } for predicate refs, this allows us to accept
+    -- JSON-serialized Thrift facts.
+    (PredicateTy _ (PidRef pid ref), val) ->
+      -- Facts can be nested. We know from the schema the predicate of
+      -- the fact at this position.
+      case lookupPid pid dbSchema of
+        Nothing ->
+          throwError $ "unknown predicate " ++ show (displayDefault ref)
+        Just deets -> do
+          fid <- factToTerm deets val
+          lift $ invoke $ glean_push_value_fact b fid
+    (EnumeratedTy vals, J.Int n)
+      | fromIntegral n < length vals ->
+        lift $ invoke $ glean_push_value_selector b $ fromIntegral n
+    (MaybeTy ty, val) -> do
+      lift $ invoke $ glean_push_value_selector b 1
+      jsonToTerm b ty val
+    (BooleanTy, J.Bool False) ->
+      lift $ invoke $ glean_push_value_selector b 0
+    (BooleanTy, J.Bool True) ->
+      lift $ invoke $ glean_push_value_selector b 1
+    _otherwise -> termError typ v
+
+  -- Remove named types so that we can match on the underlying
+  -- representation of the type
+  repType :: Type -> Type
+  repType (NamedTy _ (ExpandedType _ ty)) = ty
+  repType ty = ty
+
+  -- Thrift might omit fields from the output if they have the
+  -- default value, so we have to reconstruct the default value
+  -- here.
+  defaultValue :: Builder -> J.Value -> (Text, Type) -> IO ()
+  defaultValue b json (fieldName, typ) = case typ of
+    ByteTy -> invoke $ glean_push_value_byte b 0
+    NatTy -> invoke $ glean_push_value_nat b 0
+    StringTy -> invoke $ glean_push_value_string b nullPtr 0
+    ArrayTy{} -> invoke $ glean_push_value_array b 0
+    SetTy{} -> invoke $ glean_push_value_set b 0
+    RecordTy fields ->
+      mapM_ (defaultValue b json) [(nm, ty) | FieldDef nm ty <- fields ]
+    SumTy (FieldDef _ ty : _) -> do
+      invoke $ glean_push_value_selector b 0
+      defaultValue b json (fieldName, ty)
+    NamedTy _ (ExpandedType _ ty) -> defaultValue b json (fieldName, ty)
+    PredicateTy{} -> do
+      msg <- wrapJsonContext json $
+        "Field '" <> pretty fieldName <>
+        "' is missing, but it has a predicate type: " <> displayDefault typ
+      throwError $ show msg
+    EnumeratedTy{} -> invoke $ glean_push_value_selector b 0
+    MaybeTy ty -> defaultValue b json (fieldName, lowerMaybe ty)
+    BooleanTy -> invoke $ glean_push_value_selector b 0
+    _otherwise -> throwError $ "internal: defaultValue: " <> show typ
+
+  throwError :: MonadIO m => String -> m a
+  throwError str = liftIO $ throwIO $ Thrift.Exception $ Text.pack str
+
+  termError typ v = do
+    msg <- wrapJsonContext v $ vcat
+      [ "Error in fact. Expecting an expression of type:"
+      , indent 2 (displayDefault typ)
+      , "which should be of the form:"
+      , indent 2 (expecting typ)
+      ]
+    throwError $ show msg
+
+  allowed fields = hcat $
+    punctuate ", " [ dquotes (pretty f) | FieldDef f _ <- fields ]
+
+  expecting :: Type -> Doc ann
+  expecting NatTy = "number"
+  expecting ByteTy = "number"
+  expecting StringTy = "string"
+  expecting (ArrayTy ByteTy) = "string"
+  expecting ArrayTy{} = "[..]"
+  expecting SetTy{} = "set"
+  expecting (RecordTy fields) =
+    "{..} (allowed fields: " <> allowed fields <> ")"
+  expecting (SumTy fields) =
+    "{\"field\" : value} (allowed fields: " <> allowed fields <> ")"
+  expecting (EnumeratedTy vals) =
+    "number (< " <> pretty (length vals) <> ")"
+  expecting (MaybeTy ty) =
+    expecting (lowerMaybe ty)
+  expecting BooleanTy = "true or false"
+  expecting PredicateTy{} = "N, or {\"id\": N }, where N is a fact ID"
+  expecting _ = error "expecting"
diff --git a/glean/demo/Hyperlink.hs b/glean/demo/Hyperlink.hs
new file mode 100644
--- /dev/null
+++ b/glean/demo/Hyperlink.hs
@@ -0,0 +1,557 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | run with
+--
+-- > ./hyperlink --http=8080
+
+{-# LANGUAGE ApplicativeDo, TypeApplications #-}
+module Hyperlink (main) where
+
+import Data.Function
+import Control.Monad
+import Glean.Schema.Builtin.Types (schema_id)
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Pp1.Types as Pp1
+import qualified Glean.Schema.Codemarkup.Types as CodeMarkup
+import qualified Glean.Schema.CodemarkupTypes.Types as CodeMarkup
+
+import qualified Glean
+import qualified Glean.Remote
+import Glean.Impl.ConfigProvider
+import Glean.Angle as Angle
+import Glean.Util.ConfigProvider
+import Glean.Util.Range (ByteRange(..), byteOffsetToLineCol, getLineOffsets)
+import Glean.Util.XRefs (collectXRefTargets)
+import Glean.Util.Some
+
+import Util.EventBase (withEventBaseDataplane)
+import Util.Log
+import Util.OptParse
+import Util.Timing
+
+import qualified Network.HTTP.Types as HTTP
+import qualified Network.Wai as Wai
+import qualified Network.Wai.Handler.Warp as Warp
+
+import Control.DeepSeq
+import Control.Exception
+import Control.Monad.Extra (whenJust)
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Reader as Reader
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Char8 as BC
+import Data.Binary.Builder (Builder)
+import qualified Data.Binary.Builder as Builder
+import Data.Char (ord)
+import Data.List (sort, sortBy)
+import Data.Maybe
+import qualified Data.Set as Set
+import Data.String (fromString)
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Data.Word (Word8)
+import qualified Options.Applicative as O
+import System.FilePath
+
+data Config = Config
+  { cfgService :: Glean.ThriftSource Glean.ClientConfig
+  , cfgHttp :: Maybe Int
+  , cfgHttpIface :: String
+  , cfgRepoName :: Text
+  , cfgRepoHash :: Maybe String
+  , cfgRoot :: FilePath
+  , cfgStyles :: [String]
+  }
+
+options :: O.ParserInfo Config
+options = O.info (O.helper <*> parser) O.fullDesc
+  where
+    parser = Config
+      <$> Glean.Remote.options
+      <*> O.optional (O.option O.auto
+            (O.long "http" <> O.metavar "PORT"))
+      <*> O.strOption (O.long "http-iface" <> O.metavar "IFACE" <> O.value "*6")
+      <*> textOption (O.long "repo" <> O.metavar "NAME" <> O.value "fbsource")
+      <*> O.optional (O.strOption (O.long "repo-hash" <> O.metavar "HASH"))
+      <*> O.strOption (O.long "root" <> O.metavar "PATH" <> O.value "")
+      <*> O.many (O.option (O.maybeReader style)
+            (O.long "highlight" <> O.short 'l' <> O.metavar "KIND:COLOUR"))
+
+    style s
+      | (kind,':':color) <- break (==':') s =
+          Just $ '.' : kind ++ " { background-color: " ++ color ++ "; }"
+      | otherwise = Nothing
+
+data State = State
+  { stateCfg  :: Config
+  , stateBackend :: Some Glean.Backend
+  , stateRepo :: Glean.Repo
+  }
+
+type HM = Reader.ReaderT State IO
+
+
+haxl :: Glean.Haxl w a -> HM a
+haxl h = do
+  backend <- Reader.asks stateBackend
+  repo <- Reader.asks stateRepo
+  liftIO $ Glean.runHaxl backend repo h
+
+listFiles :: State -> IO Builder.Builder
+listFiles State{..} = do
+  files <- Glean.runQuery_ stateBackend stateRepo $ Angle.query $
+    predicate @Src.File wild
+  let
+    paths =
+      [ path
+      | Src.File { Src.file_key = Just path } <- files ]
+  return $ htmlPre stateCfg Nothing $ mconcat
+    [mconcat $ map Builder.fromByteString
+      ["<a href=\"", path, "\">", path, "</a>\n"]
+        | path <- map Text.encodeUtf8 $ sort paths]
+
+data TargetLoc
+  = TargetLine !Int
+  | TargetByteOffset !Int
+
+data Target = Target
+  { targetKind :: !ByteString
+  , targetPath :: !ByteString
+  , targetLoc :: !TargetLoc
+  }
+
+
+data Hyperlink = Hyperlink
+  { hlBegin :: !Int
+  , hlEnd :: !Int
+  , hlTarget :: !Target
+  }
+instance NFData Hyperlink where
+  rnf x = x `seq` ()
+
+hyperlinkFile :: State -> FilePath -> Maybe Int -> IO Builder.Builder
+hyperlinkFile st path offset = do
+  text <- BS.readFile $ cfgRoot (stateCfg st) </> path
+  links <- reportTime ("queries for " ++ path) $ do
+    r <- flip runReaderT st $ haxl $ do
+      cxx <- cxxGetHyperlinks (fromString path)
+      cm <- codeMarkupHyperlinks (fromString path)
+      return (cxx ++ cm)
+    evaluate (force r)
+  let
+    jump = case offset of
+      Nothing -> Nothing
+      Just o -> Just $ fromIntegral $ fst $
+        byteOffsetToLineCol (getLineOffsets text) (fromIntegral o)
+
+  return $ hyperlink (stateCfg st) links jump text
+
+codeMarkupHyperlinks :: Text.Text -> Glean.Haxl w [Hyperlink]
+codeMarkupHyperlinks path = do
+  xrefs <- Glean.search_ $ Angle.query $
+    var $ \x -> x `where_` [
+      wild .= predicate @CodeMarkup.FileEntityXRefLocations (
+        rec $
+          field @"file" (string path) $
+          field @"xref" x
+        end)
+      ]
+
+  hyperlinks <- forM xrefs $ \CodeMarkup.XRefLocation{..} -> do
+    file <- Glean.keyOf (CodeMarkup.location_file xRefLocation_target)
+    let
+      (start,length) = case xRefLocation_source of
+        CodeMarkup.RangeSpan_span span ->
+          ( fromIntegral $ Glean.unNat $ Src.byteSpan_start span
+          , fromIntegral $ Glean.unNat $ Src.byteSpan_length span
+          )
+        _ -> (0,0)
+    return Hyperlink
+      { hlBegin = start
+      , hlEnd = start + length
+      , hlTarget = Target
+        { targetKind = Text.encodeUtf8 $
+            CodeMarkup.location_name xRefLocation_target
+        , targetPath = Text.encodeUtf8 file
+        , targetLoc = TargetByteOffset $
+            case CodeMarkup.location_location xRefLocation_target of
+              CodeMarkup.RangeSpan_span span ->
+                fromIntegral (Glean.unNat (Src.byteSpan_start span))
+              _ -> 0
+        }
+      }
+
+  let
+    -- When there are annotations covering identical spans, prefer an
+    -- annotation that points to a different file.  This is mainly to
+    -- support Flow, which for a non-local reference produces two
+    -- Annotations, one pointing to the import declaration and another
+    -- pointing to the original declaraiton.
+    unoverlap :: [Hyperlink] -> [Hyperlink]
+    unoverlap links = walk links
+      where
+      walk (a : b : xs)
+        | hlBegin a == hlBegin b && hlEnd a == hlEnd b =
+          walk (preferred a b : xs)
+        | otherwise = a : walk (b : xs)
+      walk xs = xs
+
+      -- prefer links that point to a different file
+      preferred a b
+        | targetPath (hlTarget a) /= Text.encodeUtf8 path = a
+        | otherwise = b
+
+  return $ unoverlap $ sortBy (compare `on` hlBegin) hyperlinks
+
+
+-- | Find all 'Hyperlink' spans for the given file
+cxxGetHyperlinks :: Text.Text -> Glean.Haxl w [Hyperlink]
+cxxGetHyperlinks path = do  -- ApplicativeDo makes these parallel:
+
+  xref_links <- do
+    filexrefs <-
+      Glean.search_ $
+        Glean.expanding @Cxx.FileXRefMap $
+        Glean.expanding @Cxx.XRefTargets $
+        Angle.query $
+        predicate @Cxx.FileXRefs $
+          rec $
+            field @"xmap" (rec $ field @"file" (string path) end)
+          end
+
+    let
+      crossref (ByteRange{byteRange_begin=b, byteRange_length=l}, tgt) =
+        fmap (Hyperlink (fromIntegral b) (fromIntegral (b+l)))
+          <$> xrefTarget tgt
+
+      unoverlap :: [(ByteRange, a)] -> [(ByteRange, a)]
+      unoverlap = go 0
+        where
+          go !_ [] = []
+          go k (x@(ByteRange{byteRange_begin=b, byteRange_length=l}, _) : xs)
+            | b >= k = x : go (b+l) xs
+            | otherwise = go k xs
+
+      -- A given file can have *many* cxx1.FileXRefs facts corresponding
+      -- to different compilation traces, but we only want one hyperlink
+      -- for each non-overlapping source range. So we want to de-duplicate
+      -- the xrefs *before* we start fetching the data about what they
+      -- refer to, otherwise we overfetch.
+      xrefs = unoverlap $ Set.toList $ collectXRefTargets filexrefs
+
+    mapM crossref xrefs
+
+  pp_links <- do
+    traces <- Glean.search_ $ Angle.query $
+      predicate @Cxx.PPTrace $ rec $ field @"file" (string path) end
+
+    let crossref (Cxx.PPEvent_include_ trace) = do
+          key <- Glean.getKey (Cxx.includeTrace_include_ trace)
+          let !Pp1.Include_key
+                { include_key_file = file
+                , include_key_pathSpan = Src.ByteSpan s l } = key
+          fmap (Hyperlink (fromIntegral $ Glean.unNat s)
+              (fromIntegral $ Glean.unNat s + Glean.unNat l))
+            <$> target_locH "include" file (Glean.Nat 1)
+
+        crossref (Cxx.PPEvent_use use) = do
+          key <- Glean.getKey use
+          case key of
+            Pp1.Use_key
+              { use_key_nameSpan = Src.ByteSpan s l
+              , use_key_definition = Just (Src.Loc file line _) } ->
+              fmap (Hyperlink (fromIntegral $ Glean.unNat s)
+                  (fromIntegral $ Glean.unNat s + Glean.unNat l))
+                <$> target_locH "macro" file line
+            _ -> return Nothing
+
+        crossref _ = return Nothing
+
+    fmap catMaybes
+      $ mapM crossref
+      $ concatMap Cxx.pPTrace_key_events
+      $ mapMaybe Cxx.pPTrace_key traces
+
+  return
+    $ unoverlap
+    $ sortBy order $ catMaybes xref_links ++ pp_links
+
+  where
+    order :: Hyperlink -> Hyperlink -> Ordering
+    order (Hyperlink a1 b1 _) (Hyperlink a2 b2 _) =
+      compare a1 a2 <> compare b1 b2
+
+    unoverlap [] = []
+    unoverlap (h : hs) = h : go (hlEnd h) hs
+      where
+        go !_ [] = []
+        go k (h : hs)
+          | hlBegin h >= k = h : go (hlEnd h) hs
+          | otherwise = go k hs
+
+    -- Thanks to the magic of Haxl, all the Glean.getKey calls below
+    -- are batched into a single request to Glean, and sharing in
+    -- the results is retained.
+    xrefTarget :: Cxx.XRefTarget -> Glean.Haxl w (Maybe Target)
+    xrefTarget x = case x of
+      Cxx.XRefTarget_declaration (Cxx.Declaration_namespace_ r) -> do
+        key <- Glean.getKey r
+        target_range "namespace" $ Cxx.namespaceDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_namespaceAlias r) -> do
+        key <- Glean.getKey r
+        target_range "namespace" $ Cxx.namespaceAliasDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration Cxx.Declaration_usingDeclaration{} ->
+        return Nothing
+
+      Cxx.XRefTarget_declaration Cxx.Declaration_usingDirective{} ->
+        return Nothing
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_record_ r) -> do
+        key <- Glean.getKey r
+        target_range "record" $ Cxx.recordDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_enum_ r) -> do
+        key <- Glean.getKey r
+        target_range "enum" $ Cxx.enumDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_typeAlias r) -> do
+        key <- Glean.getKey r
+        let kind = case Cxx.typeAliasDeclaration_key_kind key of
+              Cxx.TypeAliasKind_Typedef -> "typedef"
+              Cxx.TypeAliasKind_Using -> "using"
+              Cxx.TypeAliasKind__UNKNOWN{} -> ""
+        target_range
+          ("type alias (" <> kind <> ")")
+          $ Cxx.typeAliasDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_function_ r) -> do
+        key <- Glean.getKey r
+        target_range "function" $
+          Cxx.functionDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_variable r) -> do
+        key <- Glean.getKey r
+        let mkind = case Cxx.variableDeclaration_key_kind key of
+              Cxx.VariableKind_global_{} -> Just "variable"
+              Cxx.VariableKind_local{} -> Just "variable"
+              Cxx.VariableKind_field{} -> Just "field"
+              Cxx.VariableKind_ivar{} -> Just "ivar"
+              Cxx.VariableKind_EMPTY -> Nothing
+        case mkind of
+          Nothing -> return Nothing
+          Just kind -> target_range kind $
+            Cxx.variableDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_objcContainer r) -> do
+        key <- Glean.getKey r
+        let mkind = case Cxx.objcContainerDeclaration_key_id key of
+              Cxx.ObjcContainerId_protocol{} -> Just "objc protocol"
+              Cxx.ObjcContainerId_interface_{} -> Just "objc interface"
+              Cxx.ObjcContainerId_categoryInterface{} -> Just "objc category"
+              Cxx.ObjcContainerId_extensionInterface{} -> Just "objc extension"
+              Cxx.ObjcContainerId_implementation{} -> Just "objc implementation"
+              Cxx.ObjcContainerId_categoryImplementation{} ->
+                Just "objc category implementation"
+              Cxx.ObjcContainerId_EMPTY -> Nothing
+        case mkind of
+          Nothing -> return Nothing
+          Just kind -> target_range kind $
+            Cxx.objcContainerDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration Cxx.Declaration_EMPTY ->
+        return Nothing
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_objcMethod r) -> do
+        key <- Glean.getKey r
+        target_range "objc method" $
+          Cxx.objcMethodDeclaration_key_source key
+
+      Cxx.XRefTarget_declaration (Cxx.Declaration_objcProperty r) -> do
+        key <- Glean.getKey r
+        target_range "objc property" $
+          Cxx.objcPropertyDeclaration_key_source key
+
+      Cxx.XRefTarget_enumerator r -> do
+        key <- Glean.getKey r
+        target_range "enumerator" $ Cxx.enumerator_key_source key
+
+      Cxx.XRefTarget_objcSelector{} -> return Nothing
+
+      Cxx.XRefTarget_objcSelectorSlot{} -> return Nothing
+
+      Cxx.XRefTarget_unknown (Src.Loc file line _) ->
+        target_locH "unknown" file line
+
+      Cxx.XRefTarget_indirect r -> do
+        key <- Glean.getKey r
+        xrefTarget $ Cxx.xRefIndirectTarget_key_target key
+
+      Cxx.XRefTarget_EMPTY ->
+        return Nothing
+
+    target_range kind (Src.Range file line _ _ _) =
+      target_locH kind file line
+
+    target_locH kind file line = do
+      path <- Glean.getKey (file :: Src.File)
+      return (Just $ Target kind (Text.encodeUtf8 path) $
+        TargetLine $ fromIntegral $ Glean.unNat line)
+
+
+
+hyperlink :: Config -> [Hyperlink] -> Maybe Int -> ByteString -> Builder
+hyperlink cfg links jump s =
+  htmlPre cfg jump $ mconcat $ map html $ chunks links s
+
+data Chunk
+  = BeginLink !Target
+  | EndLink
+  | BeginLine !Int
+  | EndLine
+  | Text ByteString
+
+ord8 :: Char -> Word8
+ord8 = fromIntegral . ord
+
+html :: Chunk -> Builder
+html (BeginLink t) = Builder.fromByteString $ mconcat $
+  ["<a href=\"/", targetPath t] ++
+  (case targetLoc t of
+    TargetLine l -> ["#", fromString $ show l]
+    TargetByteOffset o -> ["?offset=", fromString $ show o]) ++
+  ["\" title=\"", targetKind t, "\" class=\"", targetKind t, "\"/>"]
+html EndLink = Builder.fromByteString "</a>"
+html (BeginLine n) = Builder.fromByteString $ mconcat
+  ["\n<code id=\"", fromString $ show n, "\">"]
+html EndLine = Builder.fromByteString "</code>"
+html (Text s) =
+  mconcat $ map (Builder.fromByteString . escape) $ BS.unpack s
+  where
+    escape c
+      | c == ord8 '<' = "&lt;"
+      | c == ord8 '>' = "&gt;"
+      | c == ord8 '&' = "&amp;"
+      | otherwise = BS.singleton c
+
+chunks :: [Hyperlink] -> ByteString -> [Chunk]
+chunks links !s = BeginLine 1 : notLinked 1 0 0 links
+  where
+    !n = BS.length s
+
+    notLinked !_line !begin !end _
+      | end == n = [text begin end, EndLine]
+    notLinked !line !begin !end (link : links)
+      | hlBegin link < end = notLinked line begin end links
+      | hlBegin link == end =
+        let begin_link = BeginLink $ hlTarget link
+        in
+        text begin end
+        : begin_link : linked line end end (hlEnd link) begin_link links
+    notLinked !line !begin !end links
+      | BS.index s end == ord8 '\n' =
+          text begin end
+          : EndLine
+          : BeginLine (line+1)
+          : notLinked (line+1) (end+1) (end+1) links
+      | otherwise = notLinked line begin (end+1) links
+
+    linked !line !begin !end !k begin_link links
+      | end == n = [text begin end, EndLink, EndLine]
+      | end == k = text begin end : EndLink : notLinked line end end links
+      | BS.index s end == ord8 '\n' =
+          text begin end
+          : EndLink
+          : EndLine
+          : BeginLine (line+1)
+          : begin_link
+          : linked (line+1) (end+1) (end+1) k begin_link links
+      | otherwise = linked line begin (end+1) k begin_link links
+
+    text begin end = Text $ BS.take (end-begin) $ BS.drop begin s
+
+htmlPre :: Config -> Maybe Int -> Builder -> Builder
+htmlPre cfg j s = mconcat
+  [ Builder.fromByteString header
+  , s
+  , Builder.fromByteString footer
+  ]
+  where
+    header = fromString $ unlines $
+      ["<html><head>"
+      ,"<style>"]
+      ++
+      cfgStyles cfg
+      ++
+      ["</style>"] ++
+      jump j ++
+      ["</head><body><pre>"]
+    footer = "</pre></body></html>"
+
+    -- Scroll the page to the desired line
+    jump :: Maybe Int -> [String]
+    jump Nothing = []
+    jump (Just o) =
+      [ "<script>"
+      , "function scroll(id){"
+      , "var e = document.getElementById(id);"
+      , "window.scrollTo(e.offsetLeft, e.offsetTop);}"
+      , "window.onload = function() { scroll(\"" <> show o <> "\"); };"
+      , "</script>"
+      ]
+
+serve :: State -> Wai.Application
+serve state req respond = do
+  s <- if Wai.pathInfo req `elem` [[],["index.html"]]
+    then do
+      logInfo "list files"
+      listFiles state
+    else do
+      let path = joinPath $ map Text.unpack $ Wai.pathInfo req
+      logInfo path
+      let
+        offset = case Wai.queryString req of
+          [("offset", Just n)] -> Just (read (BC.unpack n))
+          _ -> Nothing
+      hyperlinkFile state path offset
+  respond $
+    Wai.responseBuilder
+      HTTP.status200
+      [(HTTP.hContentType, "text/html")]
+      s
+
+main :: IO ()
+main =
+  withConfigOptions options $ \(cfg, cfgOpts) ->
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider cfgOpts $ \(configAPI :: ConfigAPI) -> do
+    Glean.Remote.withRemoteBackend evb configAPI
+      (cfgService cfg) (Just schema_id) $ \backend -> do
+      repo <- case cfgRepoHash cfg of
+        Nothing -> Glean.getLatestRepo backend (cfgRepoName cfg)
+        Just hash -> return $ Glean.Repo
+          (cfgRepoName cfg)
+          (fromString hash)
+
+      let state = State
+            { stateCfg = cfg
+            , stateBackend = Some backend
+            , stateRepo = repo
+            }
+
+      whenJust (cfgHttp cfg) $ \port -> do
+        Warp.runSettings
+          (Warp.setPort port
+            $ Warp.setHost (fromString $ cfgHttpIface cfg)
+            Warp.defaultSettings)
+          (serve state)
diff --git a/glean/github/Facebook/Fb303.hs b/glean/github/Facebook/Fb303.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Facebook/Fb303.hs
@@ -0,0 +1,63 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Facebook.Fb303
+  ( Fb303State(..)
+  , newFb303
+  , withFb303
+  , fb303BaseHandler
+  , fb303Handler
+  ) where
+
+import Data.Text (Text)
+import Data.IORef
+
+import qualified Util.TimeSec as Time
+
+import Fb303Core.BaseService.Service
+import Fb303Core.Types
+import Fb303.FacebookService.Service
+import Fb303.Types
+
+
+data Fb303State = Fb303State
+  { fb303_name :: Text
+  , fb303_status :: IORef Fb_status
+  , fb303_startTime :: Time.Time
+  }
+
+-- | Constructs all fb303 state given the name to be returned by getName
+newFb303 :: Text -> IO Fb303State
+newFb303 name = do
+  currTime <- Time.now
+  statusRef <- newIORef Fb303_status_DEAD
+  return Fb303State
+    { fb303_name = name
+    , fb303_status = statusRef
+    , fb303_startTime = currTime
+    }
+
+-- | 'with' equivalent of newFb303
+withFb303 :: Text -> (Fb303State -> IO a) -> IO a
+withFb303 name f = do
+  fb303 <- newFb303 name
+  f fb303
+
+-- | Handler for fb303 core methods.
+fb303BaseHandler :: Fb303State -> BaseServiceCommand a -> IO a
+fb303BaseHandler Fb303State{..} GetName = return fb303_name
+fb303BaseHandler Fb303State{..} GetStatus = readIORef fb303_status
+fb303BaseHandler Fb303State{..} AliveSince = return $ fromIntegral t
+  where
+    Time.Time t = fb303_startTime
+
+-- | Handler for all things fb303. All services should send `Fb303State`
+-- commands through this handler
+fb303Handler :: Fb303State -> FacebookServiceCommand a -> IO a
+fb303Handler state (SuperBaseService c) =
+  fb303BaseHandler state c
diff --git a/glean/github/Facebook/Service.hs b/glean/github/Facebook/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Facebook/Service.hs
@@ -0,0 +1,172 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Facebook.Service
+  ( runFacebookService
+  , runFacebookService'
+  , withBackgroundFacebookService
+  , withBackgroundFacebookService'
+  , runFacebookServiceDeferredAlive
+  , runFacebookServiceDeferredAlive'
+  , withBackgroundFacebookServiceDeferredAlive
+  , withBackgroundFacebookServiceDeferredAlive'
+  , waitForTerminateSignals
+  ) where
+
+import Control.Concurrent.MVar
+import Control.Exception
+import Control.Monad (void)
+import Data.IORef
+import System.Posix.Signals
+
+import Fb303Core.Types
+import Facebook.Fb303
+import Thrift.Processor
+#ifdef FBTHRIFT
+import Thrift.Server.CppServer
+#else
+import Thrift.Server.HTTP
+#endif
+
+-- | Runs a facebook service on a CPPServer
+-- Handles fb303 statuses as well as shutting down on process signals
+runFacebookService
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> ServerOptions -- ^ server options
+  -> IO ()
+runFacebookService fb303 handler = do
+  runFacebookService' fb303 handler nilPostProcess
+
+runFacebookService'
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> (forall r. s r -> Either SomeException r -> Header)
+  -> ServerOptions -- ^ server options
+  -> IO ()
+runFacebookService' fb303State handler postProcess opts = do
+  withBackgroundFacebookService' fb303State handler postProcess opts $
+    const waitForTerminateSignals
+
+-- | Like 'runFacebookService' but does not set the fb303 status to
+-- @ALIVE@ when the server starts up. It is the caller's responsibility
+-- to set the status to alive via the 'Fb303State' when the server is
+-- ready to receive requests.
+runFacebookServiceDeferredAlive
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> ServerOptions -- ^ server options
+  -> IO ()
+runFacebookServiceDeferredAlive fb303 handler = do
+  runFacebookServiceDeferredAlive' fb303 handler nilPostProcess
+
+runFacebookServiceDeferredAlive'
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> (forall r. s r -> Either SomeException r -> Header)
+  -> ServerOptions -- ^ server options
+  -> IO ()
+runFacebookServiceDeferredAlive' fb303State handler postProcess opts = do
+  withBackgroundFacebookServiceDeferredAlive'
+    fb303State handler postProcess opts
+    $ const waitForTerminateSignals
+
+-- | Block indefinitely until the process receives SIGTERM or SIGINT,
+-- and then return.
+waitForTerminateSignals :: IO ()
+waitForTerminateSignals = do
+  -- To wait in Haskell-land while the server is taking requests,
+  -- use an mvar that gets filled when the right signals are read
+  mvar <- newEmptyMVar
+  let sigHandler = void $ tryPutMVar mvar ()
+  withSignalHandler sigTERM sigHandler $ \_ ->
+    withSignalHandler sigINT sigHandler $ \_ ->
+      -- Haskell will wait here until being instructed to stop
+      takeMVar mvar
+  where
+    withSignalHandler sig h = bracket
+      (installHandler sig (Catch h) Nothing)
+      (\old -> installHandler sig old Nothing)
+
+-- | Runs a facebook service on a CPPServer
+-- Handles fb303 statuses and gracefully shuts down the server once the
+-- passed in wait action completes.
+withBackgroundFacebookService
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> ServerOptions -- ^ server options
+  -> (Server -> IO a) -- ^ wait action
+  -> IO a
+withBackgroundFacebookService fb303 handler =
+  withBackgroundFacebookService' fb303 handler nilPostProcess
+
+withBackgroundFacebookService'
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> (forall r. s r -> Either SomeException r -> Header)
+  -> ServerOptions -- ^ server options
+  -> (Server -> IO a) -- ^ wait action
+  -> IO a
+withBackgroundFacebookService' fb303 handler postProcess opts waitAction =
+  withBackgroundFacebookService_ fb303 handler postProcess opts $ \server ->
+    bracketFb303 fb303 Fb303_status_ALIVE Fb303_status_STOPPING $
+      waitAction server
+
+-- | Like 'withBackgroundFacebookService', but does not set the fb303
+-- status to @ALIVE@ when the server starts up. It is the caller's
+-- responsibility to set the status to alive via the 'Fb303State'
+-- when the server is ready to receive requests.
+withBackgroundFacebookServiceDeferredAlive
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> ServerOptions -- ^ server options
+  -> (Server -> IO a) -- ^ wait action
+  -> IO a
+withBackgroundFacebookServiceDeferredAlive fb303 handler =
+  withBackgroundFacebookServiceDeferredAlive' fb303 handler nilPostProcess
+
+withBackgroundFacebookServiceDeferredAlive'
+  :: Processor s
+  => Fb303State -- ^ Mandatory fb303 state
+  -> (forall r. s r -> IO r) -- ^ your handler
+  -> (forall r. s r -> Either SomeException r -> Header)
+  -> ServerOptions -- ^ server options
+  -> (Server -> IO a) -- ^ wait action
+  -> IO a
+withBackgroundFacebookServiceDeferredAlive' fb303 handler postP opts waitAction
+  =
+  withBackgroundFacebookService_ fb303 handler postP opts $ \server ->
+    waitAction server
+      `finally` writeIORef (fb303_status fb303) Fb303_status_STOPPING
+
+bracketFb303 :: Fb303State -> Fb303_status -> Fb303_status -> IO a -> IO a
+bracketFb303 Fb303State{..} a b =
+  bracket_ (writeIORef fb303_status a) (writeIORef fb303_status b)
+
+withBackgroundFacebookService_
+  :: Processor s
+  => Fb303State
+  -> (forall r. s r -> IO r)
+  -> (forall r. s r -> Either SomeException r -> Header)
+  -> ServerOptions
+  -> (Server -> IO a)
+  -> IO a
+withBackgroundFacebookService_ fb303 handler postProcess opts waitAction = do
+  bracketFb303 fb303 Fb303_status_STARTING Fb303_status_STOPPED $ do
+    withBackgroundServer' handler postProcess opts waitAction
+
+nilPostProcess :: a -> b -> [c]
+nilPostProcess _ _ = []
diff --git a/glean/github/Glean/BuildInfo.hs b/glean/github/Glean/BuildInfo.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/BuildInfo.hs
@@ -0,0 +1,38 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TemplateHaskell #-}
+module Glean.BuildInfo (module Glean.BuildInfo) where
+
+import Control.Monad.IO.Class
+import Data.Text (Text)
+import Data.Time
+import Language.Haskell.TH
+import System.Exit
+import System.Process
+
+buildRule :: Text
+buildRule = "glean"
+
+buildMode :: Text
+buildMode = "cabal"
+
+buildTimeISO8601 :: Text
+buildTimeISO8601 = $(do
+  now <- liftIO getCurrentTime
+  litE (stringL (show now))
+  )
+
+buildRevision :: Text
+buildRevision = $(do
+  (exit, rev, _) <- liftIO $
+    readProcessWithExitCode "git" ["rev-parse", "HEAD"] ""
+  case exit of
+    ExitSuccess -> litE (stringL (head (lines rev)))
+    _ -> litE (stringL "<unknown>")
+  )
diff --git a/glean/github/Glean/Datasource/Scribe/Write.hs b/glean/github/Glean/Datasource/Scribe/Write.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/Datasource/Scribe/Write.hs
@@ -0,0 +1,22 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Datasource.Scribe.Write
+  ( scribeWriteBatches
+  ) where
+
+import Control.Exception
+
+scribeWriteBatches
+  :: writeFromScribe
+  -> bucket
+  -> [jsonFactBatch]
+  -> Bool
+  -> IO ()
+scribeWriteBatches _ _ _ _ = do
+  throwIO $ ErrorCall "writing via Scribe is not supported in this build"
diff --git a/glean/github/Glean/DefaultConfigs.hs b/glean/github/Glean/DefaultConfigs.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/DefaultConfigs.hs
@@ -0,0 +1,36 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.DefaultConfigs (
+    defaultSchemaLocation,
+    defaultClientConfigSource,
+    serverConfigPath,
+    schemaConfigPath,
+  ) where
+
+import Data.Text (Text)
+
+import Glean.Util.ThriftSource
+import Glean.ClientConfig.Types
+import Glean.ServerConfig.Types
+
+-- | Where do we find the schema by default?
+defaultSchemaLocation :: SchemaLocation
+defaultSchemaLocation = SchemaLocation_dir "$datadir/glean/schema/source"
+
+-- | Path under ~/.config/glean where the default client config lives
+defaultClientConfigSource :: ThriftSource ClientConfig
+defaultClientConfigSource = configDefault "client"
+
+-- | Path under ~/.config/glean where the server config lives
+serverConfigPath :: String
+serverConfigPath = "server"
+
+-- | Path under ~/.config/glean where the schema lives if we use `--schema indexconfig`
+schemaConfigPath :: Text
+schemaConfigPath = "schema-index"
diff --git a/glean/github/Glean/Index.hs b/glean/github/Glean/Index.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/Index.hs
@@ -0,0 +1,25 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Index
+  ( index
+  )
+  where
+
+import qualified Glean.Types as Thrift
+import qualified Glean.Index.Types as Thrift
+import Control.Exception (throwIO)
+
+type Port = Int
+
+index
+  :: IO Port
+  -> a
+  -> Thrift.IndexRequest
+  -> IO Thrift.IndexResponse
+index _ _ _ = throwIO $ Thrift.Exception "not implemented"
diff --git a/glean/github/Glean/Init.hsc b/glean/github/Glean/Init.hsc
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/Init.hsc
@@ -0,0 +1,148 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, TemplateHaskell #-}
+module Glean.Init (
+    withUnitTest,
+    withOptions,
+    withOptionsGen,
+    withUnitTestOptions,
+    InitOptions,
+    parserInfo,
+    setArgs,
+    setFromFilePrefix,
+    setPrefs,
+    setTransformGflags,
+  ) where
+
+import Control.Exception
+import Foreign
+import Foreign.C
+import Options.Applicative
+import qualified System.Environment as Sys
+
+import Util.OptParse
+import Util.Text (withCStrings)
+import Util.Control.Exception (tryAll)
+
+import TestRunner
+
+import Mangle.TH
+
+$(mangle
+  "void folly::init(int*, char***, bool)"
+  [d|
+    foreign import ccall unsafe
+      c_follyInit
+        :: Ptr CInt
+        -> Ptr (Ptr (Ptr CChar))
+        -> CBool
+        -> IO ()
+  |])
+
+follyInit :: [String] -> IO ()
+follyInit args = do
+  name <- Sys.getExecutablePath
+  let allArgs = defaultGflags <> args
+  withCStrings (name : allArgs) $ \argv ->
+    with (fromIntegral (1 + length allArgs)) $ \pargc ->
+    with argv $ \pargv ->
+      c_follyInit pargc pargv 0
+
+-- Tell glog to log to stderr by default, this can be overridden by
+-- command-line flags.
+defaultGflags :: [String]
+defaultGflags = ["--logtostderr"]
+
+follyUninit :: IO ()
+follyUninit = return ()
+
+withUnitTest :: IO () -> IO ()
+withUnitTest = id
+
+withOptions :: ParserInfo a -> (a -> IO b) -> IO b
+withOptions p f = withOptionsGen (parserInfo p) f
+
+data InitOptions a = InitOptions
+  { initArgs :: Maybe [String] -- otherwise use getArgs
+  , initPrefs :: PrefsMod
+  , initParser :: ParserInfo a
+  , initTransformGflags :: a -> [String] -> [String]
+  , initFromFilesPrefix :: Maybe Char
+  }
+
+parserInfo :: ParserInfo a -> InitOptions a
+parserInfo p =
+  InitOptions
+    { initArgs = Nothing
+    , initPrefs = idm
+    , initParser = p
+    , initTransformGflags = \_ x -> x
+    , initFromFilesPrefix = Nothing
+    }
+
+type InitSpec a = InitOptions a -> InitOptions a
+
+setPrefs :: PrefsMod -> InitSpec a
+setPrefs m opts = opts { initPrefs = m }
+
+setArgs :: [String] -> InitSpec a
+setArgs a opts = opts { initArgs = Just a }
+
+setTransformGflags :: (a -> [String] -> [String]) -> InitSpec a
+setTransformGflags tr opts = opts { initTransformGflags = tr }
+
+setFromFilePrefix :: Char -> InitSpec a
+setFromFilePrefix c opts = opts { initFromFilesPrefix = Just c}
+
+withUnitTestOptions :: ParserInfo a -> (TestAction -> a -> IO b) -> IO b
+withUnitTestOptions opts f = withOptions opts $ f TestAction
+
+withOptionsGen :: InitOptions a -> (a -> IO b) -> IO b
+withOptionsGen InitOptions{..} act = do
+  args <- maybe Sys.getArgs pure initArgs
+  args' <- case initFromFilesPrefix of
+    Nothing -> return args
+    Just c -> expandFromFiles c args
+  r <- tryAll $ partialParse (prefs initPrefs) p' args'
+  case r of
+    Left e -> run (fixHelp args) $ throwIO e
+    Right (opts, fbArgs) ->
+      run (initTransformGflags opts (fixHelp fbArgs)) $
+        act opts
+  where
+    p' = initParser { infoParser = fbhelper <*> infoParser initParser }
+    run args act = bracket_ (follyInit args) follyUninit act
+    -- Because the C++ flag help is usually a huge amount of spew, we want to
+    -- reserve --help for the Haskell options helper, and provide a --help-all
+    -- flag to show the help for the C++ flags.
+    fixHelp :: [String] -> [String]
+    fixHelp [] = []
+    fixHelp ("--help":r) = fixHelp r
+    fixHelp ("--help-all":r) = "--help" : fixHelp r
+    fixHelp (f:r) = f : fixHelp r
+
+-- | Expand argument files identified by the given char prefix
+expandFromFiles :: Char -> [String] -> IO [String]
+expandFromFiles prefix = fmap concat . mapM expandArg
+  where
+    expandArg (p:path) | p == prefix = lines <$> readFile path
+    expandArg arg = pure [arg]
+
+fbhelper :: Parser (a -> a)
+fbhelper = abortOption showHelpText $ mconcat
+  [ long "help-all"
+  , help "Show all possible options."
+  , hidden
+  ]
+  where
+#if MIN_VERSION_optparse_applicative(0,16,0)
+  showHelpText = ShowHelpText Nothing
+#else
+  showHelpText = ShowHelpText
+#endif
diff --git a/glean/github/Glean/Server/PublishShards.hs b/glean/github/Glean/Server/PublishShards.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/Server/PublishShards.hs
@@ -0,0 +1,21 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Server.PublishShards
+  ( ShardKey
+  , getShardKey
+  , updateShards
+  ) where
+
+data ShardKey = ShardKey
+
+getShardKey :: eventBaseDataplane -> port -> IO ShardKey
+getShardKey _ _ = return ShardKey
+
+updateShards :: eventBaseDataplane -> ShardKey -> [shard] -> IO ()
+updateShards _ _ _ = return ()
diff --git a/glean/github/Glean/Username.hs b/glean/github/Glean/Username.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Glean/Username.hs
@@ -0,0 +1,16 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Username (getUsername) where
+
+import System.Posix.User
+
+getUsername :: IO (Maybe String)
+getUsername = do
+    user <- getUserEntryForID =<< getRealUserID
+    return $ Just $ userName user
diff --git a/glean/github/Logger/GleanGlass.hs b/glean/github/Logger/GleanGlass.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Logger/GleanGlass.hs
@@ -0,0 +1,120 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Logger.GleanGlass (module Logger.GleanGlass) where
+
+import Data.Text
+
+import Logger.IO
+
+data GleanGlassLogger = GleanGlassLogger
+
+instance Semigroup GleanGlassLogger where
+  _ <> _ = GleanGlassLogger
+
+instance Monoid GleanGlassLogger where
+  mempty = GleanGlassLogger
+
+runLog :: Logger -> GleanGlassLogger -> IO ()
+runLog _ _ = return ()
+
+setSuccess :: Bool -> GleanGlassLogger
+setSuccess _ = GleanGlassLogger
+
+setError :: Text -> GleanGlassLogger
+setError _ = GleanGlassLogger
+
+setTimeElapsedUs :: Int -> GleanGlassLogger
+setTimeElapsedUs _ = GleanGlassLogger
+
+setAllocatedBytes :: Int -> GleanGlassLogger
+setAllocatedBytes _ = GleanGlassLogger
+
+setFilepath :: Text -> GleanGlassLogger
+setFilepath _ = GleanGlassLogger
+
+setRepo :: Text -> GleanGlassLogger
+setRepo _ = GleanGlassLogger
+
+setRepoOther :: [Text] -> GleanGlassLogger
+setRepoOther _ = GleanGlassLogger
+
+setSymbol :: Text -> GleanGlassLogger
+setSymbol _ = GleanGlassLogger
+
+setItemCount :: Int -> GleanGlassLogger
+setItemCount _ = GleanGlassLogger
+
+setRepoName :: Text -> GleanGlassLogger
+setRepoName _ = GleanGlassLogger
+
+setRepoHash :: Text -> GleanGlassLogger
+setRepoHash _ = GleanGlassLogger
+
+setMethod :: Text -> GleanGlassLogger
+setMethod _ = GleanGlassLogger
+
+setRevision :: Text -> GleanGlassLogger
+setRevision _ = GleanGlassLogger
+
+setExactRevision :: Bool -> GleanGlassLogger
+setExactRevision _ = GleanGlassLogger
+
+setNearestRevision :: Bool -> GleanGlassLogger
+setNearestRevision _ = GleanGlassLogger
+
+setMatchingRevision :: Bool -> GleanGlassLogger
+setMatchingRevision _ = GleanGlassLogger
+
+setRevisionUsed :: Text -> GleanGlassLogger
+setRevisionUsed _ = GleanGlassLogger
+
+setDbUsedName :: Text -> GleanGlassLogger
+setDbUsedName _ = GleanGlassLogger
+
+setDbUsedInstance :: Text -> GleanGlassLogger
+setDbUsedInstance _ = GleanGlassLogger
+
+setSnapshot :: Text -> GleanGlassLogger
+setSnapshot _ = GleanGlassLogger
+
+setTruncated :: Bool -> GleanGlassLogger
+setTruncated _ = GleanGlassLogger
+
+setLimit :: Int -> GleanGlassLogger
+setLimit _ = GleanGlassLogger
+
+setIncludeXlangXrefs :: Bool -> GleanGlassLogger
+setIncludeXlangXrefs _ = GleanGlassLogger
+
+setContentCheck :: Bool -> GleanGlassLogger
+setContentCheck _ = GleanGlassLogger
+
+setContentMatch :: Bool -> GleanGlassLogger
+setContentMatch _ = GleanGlassLogger
+
+setInternalError :: Text -> GleanGlassLogger
+setInternalError _ = GleanGlassLogger
+
+setInternalErrorType :: Text -> GleanGlassLogger
+setInternalErrorType _ = GleanGlassLogger
+
+setNumAttributeSamples :: Int -> GleanGlassLogger
+setNumAttributeSamples _ = GleanGlassLogger
+
+setNumAssignedAttributeSamples :: Int -> GleanGlassLogger
+setNumAssignedAttributeSamples _ = GleanGlassLogger
+
+setAttributeDbs :: [Text] -> GleanGlassLogger
+setAttributeDbs _ = GleanGlassLogger
+
+setAttributeOptions :: Text -> GleanGlassLogger
+setAttributeOptions _ = GleanGlassLogger
+
+setDynamicAttributeStats  :: [Text] -> GleanGlassLogger
+setDynamicAttributeStats _ = GleanGlassLogger
diff --git a/glean/github/Logger/GleanGlassErrors.hs b/glean/github/Logger/GleanGlassErrors.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Logger/GleanGlassErrors.hs
@@ -0,0 +1,48 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Logger.GleanGlassErrors (module Logger.GleanGlassErrors) where
+
+import Data.Text
+
+import Logger.IO
+
+data GleanGlassErrorsLogger = GleanGlassErrorsLogger
+
+instance Semigroup GleanGlassErrorsLogger where
+  _ <> _ = GleanGlassErrorsLogger
+
+instance Monoid GleanGlassErrorsLogger where
+  mempty = GleanGlassErrorsLogger
+
+runLog :: Logger -> GleanGlassErrorsLogger -> IO ()
+runLog _ _ = return ()
+
+setError :: Text -> GleanGlassErrorsLogger
+setError _ = GleanGlassErrorsLogger
+
+setErrorType :: Text -> GleanGlassErrorsLogger
+setErrorType _ = GleanGlassErrorsLogger
+
+setRepoName :: Text -> GleanGlassErrorsLogger
+setRepoName _ = GleanGlassErrorsLogger
+
+setRepoHash :: Text -> GleanGlassErrorsLogger
+setRepoHash _ = GleanGlassErrorsLogger
+
+setFilepath :: Text -> GleanGlassErrorsLogger
+setFilepath _ = GleanGlassErrorsLogger
+
+setRepo :: Text -> GleanGlassErrorsLogger
+setRepo _ = GleanGlassErrorsLogger
+
+setSymbol :: Text -> GleanGlassErrorsLogger
+setSymbol _ = GleanGlassErrorsLogger
+
+setMethod :: Text -> GleanGlassErrorsLogger
+setMethod _ = GleanGlassErrorsLogger
diff --git a/glean/github/Logger/IO.hs b/glean/github/Logger/IO.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/Logger/IO.hs
@@ -0,0 +1,16 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Logger.IO (module Logger.IO) where
+
+import Glean.Impl.ConfigProvider
+
+data Logger = Logger
+
+withLogger :: ConfigAPI -> (Logger -> IO a) -> IO a
+withLogger _ f = f Logger
diff --git a/glean/github/ServiceData/GlobalStats.hs b/glean/github/ServiceData/GlobalStats.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/ServiceData/GlobalStats.hs
@@ -0,0 +1,35 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module ServiceData.GlobalStats (module ServiceData.GlobalStats) where
+
+import Data.ByteString (ByteString)
+import qualified Data.HashMap.Strict as HashMap
+
+import ServiceData.Types
+
+setCounter :: ByteString -> Int -> IO ()
+setCounter _ _ = return ()
+
+clearCounter :: ByteString -> IO ()
+clearCounter _ = return ()
+
+getCounters :: IO (HashMap.HashMap ByteString Int)
+getCounters = return HashMap.empty
+
+addStatValue :: ByteString -> Int -> IO ()
+addStatValue _ _ = return ()
+
+addStatValueType :: ByteString -> Int -> ExportType -> IO ()
+addStatValueType _ _ _ = return ()
+
+addHistogram :: ByteString -> Int -> Int -> Int -> IO ()
+addHistogram _ _ _ _ = return ()
+
+exportHistogramPercentile :: ByteString -> Int -> IO ()
+exportHistogramPercentile _ _ = return ()
diff --git a/glean/github/ServiceData/Types.hs b/glean/github/ServiceData/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/ServiceData/Types.hs
@@ -0,0 +1,11 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module ServiceData.Types (module ServiceData.Types) where
+
+data ExportType = Sum | Avg
diff --git a/glean/github/TestRunner.hs b/glean/github/TestRunner.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/TestRunner.hs
@@ -0,0 +1,43 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module TestRunner (module TestRunner) where
+
+import System.Environment (withArgs)
+import Test.HUnit
+import qualified Test.Tasty as Tasty
+import qualified Test.Tasty.HUnit.Adapter as Tasty
+
+-- | Wraps the HUnit test using tasty, so we get parallel test runs,
+-- test listing, and test selection.
+testRunner :: Test -> IO ()
+testRunner t =
+  Tasty.defaultMain $
+  Tasty.testGroup "test" $
+  Tasty.hUnitTestToTestTree t
+
+data TestAction = TestAction
+
+-- | This entry point is designed for combining the test runner's
+-- option parser with the program's own options. Ideally we would use
+-- this to combine Tasty's option parser with the program's parser,
+-- but Tasty's option parser depends on the `Test`, and we don't have
+-- that when parsing options (it might depend on the options), so
+-- there's a circular dependency.
+--
+-- Therefore we run Tasty's CLI parser with empty arguments. We can
+-- still use the environment variables to set Tasty options, e.g.
+--
+-- > TASTY_NUM_THREADS=12 cabal run my-test
+--
+testRunnerAction :: TestAction -> Test -> IO ()
+testRunnerAction _ t =
+  withArgs [] $
+  Tasty.defaultMain $
+  Tasty.testGroup "test" $
+  Tasty.hUnitTestToTestTree t
diff --git a/glean/github/if/gen-hs2/Fb303/FacebookService/Client.hs b/glean/github/if/gen-hs2/Fb303/FacebookService/Client.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303/FacebookService/Client.hs
@@ -0,0 +1,26 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Fb303.FacebookService.Client (FacebookService) where
+import qualified Fb303Core.BaseService.Client as BaseService
+import qualified Fb303Core.Types as Fb303Core
+import qualified Thrift.Codegen as Thrift
+import Fb303.Types
+
+data FacebookService
+
+type instance Thrift.Super FacebookService =
+     BaseService.BaseService
diff --git a/glean/github/if/gen-hs2/Fb303/FacebookService/Service.hs b/glean/github/if/gen-hs2/Fb303/FacebookService/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303/FacebookService/Service.hs
@@ -0,0 +1,75 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GADTs #-}
+module Fb303.FacebookService.Service
+       (FacebookServiceCommand(..), reqName', reqParser', respWriter',
+        methodsInfo')
+       where
+import qualified Control.Exception as Exception
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Fb303.Types as Types
+import qualified Fb303Core.BaseService.Service as BaseService
+import qualified Fb303Core.Types as Fb303Core
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Processor as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Control.Applicative ((<*), (*>))
+import Data.Monoid ((<>))
+import Prelude ((<$>), (<*>), (++), (.), (==))
+
+data FacebookServiceCommand a where
+  SuperBaseService ::
+    BaseService.BaseServiceCommand a -> FacebookServiceCommand a
+
+instance Thrift.Processor FacebookServiceCommand where
+  reqName = reqName'
+  reqParser = reqParser'
+  respWriter = respWriter'
+  methodsInfo _ = methodsInfo'
+
+reqName' :: FacebookServiceCommand a -> Text.Text
+reqName' (SuperBaseService x) = BaseService.reqName' x
+
+reqParser' ::
+             Thrift.Protocol p =>
+             Proxy.Proxy p ->
+               Text.Text -> Parser.Parser (Thrift.Some FacebookServiceCommand)
+reqParser' _proxy funName
+  = do Thrift.Some x <- BaseService.reqParser' _proxy funName
+       Prelude.return (Thrift.Some (SuperBaseService x))
+
+respWriter' ::
+              Thrift.Protocol p =>
+              Proxy.Proxy p ->
+                Int.Int32 ->
+                  FacebookServiceCommand a ->
+                    Prelude.Either Exception.SomeException a ->
+                      (Builder.Builder,
+                       Prelude.Maybe (Exception.SomeException, Thrift.Blame))
+respWriter' _proxy _seqNum (SuperBaseService _x) _r
+  = BaseService.respWriter' _proxy _seqNum _x _r
+
+methodsInfo' :: Map.Map Text.Text Thrift.MethodInfo
+methodsInfo' = Map.union (Map.fromList []) BaseService.methodsInfo'
diff --git a/glean/github/if/gen-hs2/Fb303/Types.hs b/glean/github/if/gen-hs2/Fb303/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303/Types.hs
@@ -0,0 +1,20 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Fb303.Types (Fb_status) where
+import qualified Fb303Core.Types as Fb303Core
+import qualified Prelude as Prelude
+import qualified Thrift.CodegenTypesOnly as Thrift
+
+type Fb_status = Fb303Core.Fb303_status
diff --git a/glean/github/if/gen-hs2/Fb303Core/BaseService/Client.hs b/glean/github/if/gen-hs2/Fb303Core/BaseService/Client.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303Core/BaseService/Client.hs
@@ -0,0 +1,341 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Fb303Core.BaseService.Client
+       (BaseService, getStatus, getStatusIO, send_getStatus,
+        _build_getStatus, recv_getStatus, _parse_getStatus, getName,
+        getNameIO, send_getName, _build_getName, recv_getName,
+        _parse_getName, aliveSince, aliveSinceIO, send_aliveSince,
+        _build_aliveSince, recv_aliveSince, _parse_aliveSince)
+       where
+import qualified Control.Arrow as Arrow
+import qualified Control.Concurrent as Concurrent
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Control.Monad.Trans.Reader as Reader
+import qualified Data.ByteString.Builder as ByteString
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Data.Monoid ((<>))
+import Prelude ((==), (=<<), (>>=), (<$>), (.))
+import Fb303Core.Types
+
+data BaseService
+
+getStatus ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s BaseService) =>
+            Thrift.ThriftM p c s Fb303_status
+getStatus
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift (getStatusIO _proxy _channel _counter _opts)
+
+getStatusIO ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s BaseService) =>
+              Proxy.Proxy p ->
+                c s ->
+                  Thrift.Counter -> Thrift.RpcOptions -> Prelude.IO Fb303_status
+getStatusIO _proxy _channel _counter _opts
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_getStatus _proxy)
+       send_getStatus _proxy _channel _counter _sendCob _recvCob _opts
+       Thrift.wait _handle
+
+send_getStatus ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s BaseService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.SendCallback ->
+                         Thrift.RecvCallback -> Thrift.RpcOptions -> Prelude.IO ()
+send_getStatus _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString (_build_getStatus _proxy _seqNum))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_getStatus ::
+                 (Thrift.Protocol p) =>
+                 Proxy.Proxy p ->
+                   Thrift.Response ->
+                     Prelude.Either Exception.SomeException Fb303_status
+recv_getStatus _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_getStatus _proxy) _response))
+
+_build_getStatus ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p -> Int.Int32 -> ByteString.Builder
+_build_getStatus _proxy _seqNum
+  = Thrift.genMsgBegin _proxy "getStatus" 1 _seqNum <>
+      Thrift.genStruct _proxy []
+      <> Thrift.genMsgEnd _proxy
+
+_parse_getStatus ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p ->
+                     Parser.Parser (Prelude.Either Exception.SomeException Fb303_status)
+_parse_getStatus _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "getStatus: expected reply but got function call"
+                    2 | _name == "getStatus" ->
+                        do let
+                             _idMap = HashMap.fromList [("getStatus_success", 0)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getI32Type
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseEnum
+                                                                                _proxy
+                                                                                "Fb303_status")
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "getStatus: expected reply but got oneway function call"
+                    _ -> Prelude.fail "getStatus: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+getName ::
+          (Thrift.Protocol p, Thrift.ClientChannel c,
+           (Thrift.<:) s BaseService) =>
+          Thrift.ThriftM p c s Text.Text
+getName
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift (getNameIO _proxy _channel _counter _opts)
+
+getNameIO ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s BaseService) =>
+            Proxy.Proxy p ->
+              c s -> Thrift.Counter -> Thrift.RpcOptions -> Prelude.IO Text.Text
+getNameIO _proxy _channel _counter _opts
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_getName _proxy)
+       send_getName _proxy _channel _counter _sendCob _recvCob _opts
+       Thrift.wait _handle
+
+send_getName ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s BaseService) =>
+               Proxy.Proxy p ->
+                 c s ->
+                   Thrift.Counter ->
+                     Thrift.SendCallback ->
+                       Thrift.RecvCallback -> Thrift.RpcOptions -> Prelude.IO ()
+send_getName _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString (_build_getName _proxy _seqNum))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_getName ::
+               (Thrift.Protocol p) =>
+               Proxy.Proxy p ->
+                 Thrift.Response -> Prelude.Either Exception.SomeException Text.Text
+recv_getName _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_getName _proxy) _response))
+
+_build_getName ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p -> Int.Int32 -> ByteString.Builder
+_build_getName _proxy _seqNum
+  = Thrift.genMsgBegin _proxy "getName" 1 _seqNum <>
+      Thrift.genStruct _proxy []
+      <> Thrift.genMsgEnd _proxy
+
+_parse_getName ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p ->
+                   Parser.Parser (Prelude.Either Exception.SomeException Text.Text)
+_parse_getName _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "getName: expected reply but got function call"
+                    2 | _name == "getName" ->
+                        do let
+                             _idMap = HashMap.fromList [("getName_success", 0)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStringType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseText
+                                                                                _proxy)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "getName: expected reply but got oneway function call"
+                    _ -> Prelude.fail "getName: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+aliveSince ::
+             (Thrift.Protocol p, Thrift.ClientChannel c,
+              (Thrift.<:) s BaseService) =>
+             Thrift.ThriftM p c s Int.Int64
+aliveSince
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift (aliveSinceIO _proxy _channel _counter _opts)
+
+aliveSinceIO ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s BaseService) =>
+               Proxy.Proxy p ->
+                 c s -> Thrift.Counter -> Thrift.RpcOptions -> Prelude.IO Int.Int64
+aliveSinceIO _proxy _channel _counter _opts
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_aliveSince _proxy)
+       send_aliveSince _proxy _channel _counter _sendCob _recvCob _opts
+       Thrift.wait _handle
+
+send_aliveSince ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s BaseService) =>
+                  Proxy.Proxy p ->
+                    c s ->
+                      Thrift.Counter ->
+                        Thrift.SendCallback ->
+                          Thrift.RecvCallback -> Thrift.RpcOptions -> Prelude.IO ()
+send_aliveSince _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString (_build_aliveSince _proxy _seqNum))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_aliveSince ::
+                  (Thrift.Protocol p) =>
+                  Proxy.Proxy p ->
+                    Thrift.Response -> Prelude.Either Exception.SomeException Int.Int64
+recv_aliveSince _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_aliveSince _proxy) _response))
+
+_build_aliveSince ::
+                    Thrift.Protocol p =>
+                    Proxy.Proxy p -> Int.Int32 -> ByteString.Builder
+_build_aliveSince _proxy _seqNum
+  = Thrift.genMsgBegin _proxy "aliveSince" 1 _seqNum <>
+      Thrift.genStruct _proxy []
+      <> Thrift.genMsgEnd _proxy
+
+_parse_aliveSince ::
+                    Thrift.Protocol p =>
+                    Proxy.Proxy p ->
+                      Parser.Parser (Prelude.Either Exception.SomeException Int.Int64)
+_parse_aliveSince _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "aliveSince: expected reply but got function call"
+                    2 | _name == "aliveSince" ->
+                        do let
+                             _idMap = HashMap.fromList [("aliveSince_success", 0)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getI64Type
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseI64
+                                                                                _proxy)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "aliveSince: expected reply but got oneway function call"
+                    _ -> Prelude.fail "aliveSince: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
diff --git a/glean/github/if/gen-hs2/Fb303Core/BaseService/Service.hs b/glean/github/if/gen-hs2/Fb303Core/BaseService/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303Core/BaseService/Service.hs
@@ -0,0 +1,208 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GADTs #-}
+module Fb303Core.BaseService.Service
+       (BaseServiceCommand(..), reqName', reqParser', respWriter',
+        methodsInfo')
+       where
+import qualified Control.Exception as Exception
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303Core.Types as Types
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Processor as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Control.Applicative ((<*), (*>))
+import Data.Monoid ((<>))
+import Prelude ((<$>), (<*>), (++), (.), (==))
+
+data BaseServiceCommand a where
+  GetStatus :: BaseServiceCommand Types.Fb303_status
+  GetName :: BaseServiceCommand Text.Text
+  AliveSince :: BaseServiceCommand Int.Int64
+
+instance Thrift.Processor BaseServiceCommand where
+  reqName = reqName'
+  reqParser = reqParser'
+  respWriter = respWriter'
+  methodsInfo _ = methodsInfo'
+
+reqName' :: BaseServiceCommand a -> Text.Text
+reqName' GetStatus = "getStatus"
+reqName' GetName = "getName"
+reqName' AliveSince = "aliveSince"
+
+reqParser' ::
+             Thrift.Protocol p =>
+             Proxy.Proxy p ->
+               Text.Text -> Parser.Parser (Thrift.Some BaseServiceCommand)
+reqParser' _proxy "getStatus"
+  = ST.runSTT
+      (do Prelude.return ()
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do Prelude.pure (Thrift.Some GetStatus)
+            _idMap = HashMap.fromList []
+          _parse 0)
+reqParser' _proxy "getName"
+  = ST.runSTT
+      (do Prelude.return ()
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do Prelude.pure (Thrift.Some GetName)
+            _idMap = HashMap.fromList []
+          _parse 0)
+reqParser' _proxy "aliveSince"
+  = ST.runSTT
+      (do Prelude.return ()
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do Prelude.pure (Thrift.Some AliveSince)
+            _idMap = HashMap.fromList []
+          _parse 0)
+reqParser' _ funName
+  = Prelude.errorWithoutStackTrace
+      ("unknown function call: " ++ Text.unpack funName)
+
+respWriter' ::
+              Thrift.Protocol p =>
+              Proxy.Proxy p ->
+                Int.Int32 ->
+                  BaseServiceCommand a ->
+                    Prelude.Either Exception.SomeException a ->
+                      (Builder.Builder,
+                       Prelude.Maybe (Exception.SomeException, Thrift.Blame))
+respWriter' _proxy _seqNum GetStatus{} _r
+  = (Thrift.genMsgBegin _proxy "getStatus" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getI32Type _proxy) 0 0
+                                         ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                             Thrift.fromThriftEnum)
+                                            _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum GetName{} _r
+  = (Thrift.genMsgBegin _proxy "getName" _msgType _seqNum <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStringType _proxy) 0 0
+                                         (Thrift.genText _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum AliveSince{} _r
+  = (Thrift.genMsgBegin _proxy "aliveSince" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genFieldPrim _proxy "" (Thrift.getI64Type _proxy) 0 0
+                                         (Thrift.genI64Prim _proxy)
+                                         _result],
+                                    Prelude.Nothing)
+
+methodsInfo' :: Map.Map Text.Text Thrift.MethodInfo
+methodsInfo'
+  = Map.fromList
+      [("getStatus",
+        Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+       ("getName", Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+       ("aliveSince",
+        Thrift.MethodInfo Thrift.NormalPriority Prelude.False)]
diff --git a/glean/github/if/gen-hs2/Fb303Core/Types.hs b/glean/github/if/gen-hs2/Fb303Core/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/github/if/gen-hs2/Fb303Core/Types.hs
@@ -0,0 +1,84 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Fb303Core.Types
+       (Fb303_status(Fb303_status_DEAD, Fb303_status_STARTING,
+                     Fb303_status_ALIVE, Fb303_status_STOPPING, Fb303_status_STOPPED,
+                     Fb303_status_WARNING, Fb303_status__UNKNOWN))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Prelude as Prelude
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Prelude ((.), (++), (>), (==))
+
+data Fb303_status = Fb303_status_DEAD
+                  | Fb303_status_STARTING
+                  | Fb303_status_ALIVE
+                  | Fb303_status_STOPPING
+                  | Fb303_status_STOPPED
+                  | Fb303_status_WARNING
+                  | Fb303_status__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Fb303_status where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Fb303_status where
+  rnf __Fb303_status = Prelude.seq __Fb303_status ()
+
+instance Default.Default Fb303_status where
+  def = Fb303_status_DEAD
+
+instance Hashable.Hashable Fb303_status where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Fb303_status where
+  toThriftEnum 0 = Fb303_status_DEAD
+  toThriftEnum 1 = Fb303_status_STARTING
+  toThriftEnum 2 = Fb303_status_ALIVE
+  toThriftEnum 3 = Fb303_status_STOPPING
+  toThriftEnum 4 = Fb303_status_STOPPED
+  toThriftEnum 5 = Fb303_status_WARNING
+  toThriftEnum val = Fb303_status__UNKNOWN val
+  fromThriftEnum Fb303_status_DEAD = 0
+  fromThriftEnum Fb303_status_STARTING = 1
+  fromThriftEnum Fb303_status_ALIVE = 2
+  fromThriftEnum Fb303_status_STOPPING = 3
+  fromThriftEnum Fb303_status_STOPPED = 4
+  fromThriftEnum Fb303_status_WARNING = 5
+  fromThriftEnum (Fb303_status__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Fb303_status_DEAD, Fb303_status_STARTING, Fb303_status_ALIVE,
+       Fb303_status_STOPPING, Fb303_status_STOPPED, Fb303_status_WARNING]
+  toThriftEnumEither 0 = Prelude.Right Fb303_status_DEAD
+  toThriftEnumEither 1 = Prelude.Right Fb303_status_STARTING
+  toThriftEnumEither 2 = Prelude.Right Fb303_status_ALIVE
+  toThriftEnumEither 3 = Prelude.Right Fb303_status_STOPPING
+  toThriftEnumEither 4 = Prelude.Right Fb303_status_STOPPED
+  toThriftEnumEither 5 = Prelude.Right Fb303_status_WARNING
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Fb303_status: "
+           ++ Prelude.show val)
diff --git a/glean/glass/Glean/Glass/Annotations.hs b/glean/glass/Glean/Glass/Annotations.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Annotations.hs
@@ -0,0 +1,245 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Annotations
+  ( getAnnotationsForEntity
+
+  -- * testing
+  , prettyHackAnnotation
+  ) where
+
+
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Map as Map
+import Data.Maybe (catMaybes)
+import Control.Monad (forM )
+
+import qualified Glean
+import Glean.Glass.Base ( GleanPath(..) )
+import Glean.Angle as Angle
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodeCxx.Types as Cxx1
+import qualified Glean.Schema.CodeHack.Types as Hack
+import qualified Glean.Schema.CodePython.Types as Python
+import qualified Glean.Schema.CodeJava.Types as Java
+import qualified Glean.Schema.Cxx1.Types as Cxx1
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Glean.Schema.Python.Types as Python
+import qualified Glean.Schema.JavaAlpha.Types as Java
+import qualified Glean.Schema.JavakotlinAlpha.Types as JavaKotlin
+
+import Glean.Glass.SymbolId (entityToAngle, toSymbolId)
+import Glean.Glass.SymbolId.Java ( flattenPath )
+import qualified Glean.Glass.Types as Glass
+import Glean.Glass.Utils ( searchRecursiveWithLimit )
+import Glean.Glass.Path ( fromGleanPath )
+
+-- | For Hack, Java and Python, the annotations are a single array fact.
+-- For C++ they're sprinkled across each function decl, forcing us to search
+max_annotations_limit :: Int
+max_annotations_limit = 10
+
+getAnnotationsForEntity
+  :: Glass.RepoName
+  -> Code.Entity
+  -> Glean.RepoHaxl u w (Either Text (Maybe [Glass.Annotation]))
+getAnnotationsForEntity repo entity = fetch repo `mapM` entityToAngle entity
+
+-- Get all the annotations for a given entity. This may include
+-- computing symbolId for these annotations.
+fetch
+  :: Glass.RepoName -> Angle Code.Entity
+  -> Glean.RepoHaxl u w (Maybe [Glass.Annotation])
+fetch repo ent = do
+  anns <- queryAnnotations ent
+  annsWithSyms <- forM anns (annotationsToSymbols repo)
+  getAnnotations annsWithSyms
+
+-- | Entity to its annotation facts.
+queryAnnotations :: Angle Code.Entity -> Glean.RepoHaxl u w [Code.Annotations]
+queryAnnotations entity =
+  fmap fst <$> searchRecursiveWithLimit (Just max_annotations_limit) $
+    entityAnnotations entity
+
+entityAnnotations :: Angle Code.Entity -> Angle Code.Annotations
+entityAnnotations ent =
+  var $ \anns -> anns `where_` [
+    wild .= Angle.predicate @Code.EntityToAnnotations (
+        rec $
+          field @"entity" ent $
+          field @"annotations" anns
+        end)
+  ]
+
+--
+-- Per-language unpacking of annotations
+--
+
+-- Maps an Annotations (e.g. a list of annotation, to their possible
+-- corresponding symbolId). Codemarkup doesn't expose a single Annotation
+-- type, so we use zipped list. Currently, the symbolId are only used for
+-- Hack. For the other languages, we use an empty list of symbolIds.
+newtype AnnotationsSymbolId =
+  AnnotationsSymbolId (Code.Annotations, [Maybe Glass.SymbolId])
+
+annotationsToSymbols
+  :: Glass.RepoName
+  -> Code.Annotations
+  -> Glean.RepoHaxl u w AnnotationsSymbolId
+annotationsToSymbols repo annotations = case annotations of
+  Code.Annotations_hack (Hack.Annotations_attributes attrs) -> do
+    attributeToDecl <- queryAttributeToDecl attrs
+    decls <- forM attributeToDecl (declarationsToSymbolId repo)
+    let mapAnnotSym = Map.fromList decls
+        syms = (`Map.lookup` mapAnnotSym) <$> attrs
+    return $ AnnotationsSymbolId (annotations, syms)
+  _ -> return $ AnnotationsSymbolId (annotations, [])
+
+-- Generate a query of the form
+--   hack.AttributeToDeclaration.6 {attribute = X0}
+--   where X0 = [$388098 : hack.UserAttribute.6,
+--               $41135,
+--               $139800678][..]"]
+-- From AttributeToDeclaration facts, we get the info
+-- required to build an Annotation SymbolId
+queryAttributeToDecl
+  :: [Hack.UserAttribute]
+  -> Glean.RepoHaxl u w [Hack.AttributeToDeclaration]
+queryAttributeToDecl [] = return []
+queryAttributeToDecl attrs = fmap fst <$> searchRecursiveWithLimit
+    (Just (length attrs)) $
+  Angle.predicate @Hack.AttributeToDeclaration $
+    rec $
+      field @"attribute" (asPredicate (elementsOf factIds))
+    end
+  where
+    factIds = factIdsArray (map Glean.getId attrs)
+
+-- | Unpack the decl and file fields of the annotation lookup and
+-- construct a symbol id
+declarationsToSymbolId
+  :: Glass.RepoName
+  -> Hack.AttributeToDeclaration
+  -> Glean.RepoHaxl u w (Hack.UserAttribute, Glass.SymbolId)
+declarationsToSymbolId repo attrDecl = do
+  Hack.AttributeToDeclaration_key{..} <- Glean.keyOf attrDecl
+  path <- Glean.keyOf attributeToDeclaration_key_file
+  let userAttribute = attributeToDeclaration_key_attribute
+  let decl = attributeToDeclaration_key_declaration
+      entity = Code.Entity_hack (Hack.Entity_decl decl) -- do this in Angle
+  sym <- toSymbolId (fromGleanPath repo (GleanPath path)) entity
+  return (userAttribute, sym)
+
+--
+-- The type of annotations is language specific. We unwrap here in the client
+-- this also lets us do a bit of language-specific processing
+--
+-- We should think about encoding this in the schema Glean-side
+--
+class HasAnnotations a where
+  getAnnotations :: a -> Glean.RepoHaxl u w (Maybe [Glass.Annotation])
+
+instance HasAnnotations a => HasAnnotations [a] where
+  getAnnotations [] = pure Nothing
+  getAnnotations anns = do
+    result <- mapM getAnnotations anns
+    return $ Just (concat (catMaybes result))
+    -- we could drop empty results here, and not emit the attr at all?
+
+instance HasAnnotations AnnotationsSymbolId where
+  getAnnotations (AnnotationsSymbolId (ann, syms)) = case (ann, syms) of
+    (Code.Annotations_cxx ann, _) -> getAnnotations ann
+    (Code.Annotations_hack ann, syms) -> getAnnotations (ann, syms)
+    (Code.Annotations_python anns, _) -> getAnnotations anns
+    (Code.Annotations_java anns, _) -> getAnnotations anns
+    (Code.Annotations_fbthrift{}, _) -> pure Nothing -- Not yet supported
+    (Code.Annotations_EMPTY, _) -> pure Nothing
+
+instance HasAnnotations Cxx1.Annotations where
+  getAnnotations (Cxx1.Annotations_attributes anns) = getAnnotations anns
+  getAnnotations Cxx1.Annotations_EMPTY = pure Nothing
+
+instance HasAnnotations Cxx1.Attribute where
+  getAnnotations Cxx1.Attribute{attribute_key=Just key} = return $ Just
+    [ Glass.Annotation
+        { annotation_source = key
+        , annotation_name = key
+        , annotation_symbol = Nothing
+        }
+    ]
+  getAnnotations _ = pure Nothing
+
+instance HasAnnotations Python.Annotations where
+  getAnnotations (Python.Annotations_decorators anns) = getAnnotations anns
+  getAnnotations Python.Annotations_EMPTY = pure Nothing
+
+instance HasAnnotations Python.Decorator where
+  getAnnotations key = return $ Just $ pure Glass.Annotation {
+          annotation_source = key,
+          annotation_symbol = Nothing,
+          annotation_name = key
+        }
+
+instance HasAnnotations Java.Annotations where
+  getAnnotations (Java.Annotations_annotations anns) = getAnnotations anns
+  getAnnotations Java.Annotations_EMPTY = pure Nothing
+
+instance HasAnnotations Java.Annotation where
+  getAnnotations ann = do
+    Java.Annotation_key mname _ctor _constant _span <- Glean.keyOf ann
+    JavaKotlin.QName_key qName mcontext <- Glean.keyOf mname
+    nameStr <- Glean.keyOf qName
+    context <- Glean.keyOf mcontext
+    toks <- flattenPath context
+    let annKey = Text.intercalate "." (nameStr : reverse toks)
+
+    return $ Just $ pure Glass.Annotation {
+          annotation_source = nameStr,
+          annotation_symbol = Nothing, -- annotations don't have definitions yet
+          annotation_name = annKey
+        }
+
+instance HasAnnotations (Hack.Annotations, [Maybe Glass.SymbolId]) where
+  getAnnotations (Hack.Annotations_attributes anns, syms) =
+    getAnnotations (anns, syms)
+  getAnnotations (Hack.Annotations_EMPTY, _) = pure Nothing
+
+instance HasAnnotations ([Hack.UserAttribute], [Maybe Glass.SymbolId]) where
+  getAnnotations (attrs, syms) = getAnnotations $ zip attrs syms
+
+instance HasAnnotations (Hack.UserAttribute, Maybe Glass.SymbolId) where
+  getAnnotations
+    (Hack.UserAttribute
+      {
+        userAttribute_key = Just Hack.UserAttribute_key
+          {
+            userAttribute_key_name=Hack.Name{name_key=Just name}
+          , userAttribute_key_parameters=args
+          }
+      }, symbol) = return $ Just
+          [ Glass.Annotation
+              { annotation_source = prettyHackAnnotation name args
+              , annotation_name = name
+              , annotation_symbol = symbol
+              }
+          ]
+  getAnnotations _ = pure Nothing
+
+prettyHackAnnotation :: Text -> [Text] -> Text
+prettyHackAnnotation name [] = name
+prettyHackAnnotation name args = name <> parens (commas (map quotes args))
+  where
+    parens x = "(" <> x <> ")"
+    commas = Text.intercalate ", "
+    quotes arg = "\"" <> arg <> "\""
diff --git a/glean/glass/Glean/Glass/Attributes.hs b/glean/glass/Glean/Glass/Attributes.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Attributes.hs
@@ -0,0 +1,25 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Attributes
+  ( -- * export known attribute types
+    SymbolKind.SymbolKindAttr(..)
+    -- * class
+  , ToAttributes(..)
+  , LogAttr(..)
+  , RefEntitySymbol
+  , DefEntitySymbol
+
+    -- * operating with attributes
+  , extendAttributes
+  , attrListToMap
+  , attrMapToList
+  ) where
+
+import Glean.Glass.Attributes.Class
+import Glean.Glass.Attributes.SymbolKind as SymbolKind
diff --git a/glean/glass/Glean/Glass/Attributes/Class.hs b/glean/glass/Glean/Glass/Attributes/Class.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Attributes/Class.hs
@@ -0,0 +1,139 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE ConstraintKinds #-}
+-- Copyright 2004-present Facebook. All Rights Reserved.
+
+{-# OPTIONS_GHC -Wno-star-is-type -Wno-orphans #-}
+module Glean.Glass.Attributes.Class
+  ( ToAttributes(..)
+  , LogAttr(..)
+  , RefEntitySymbol
+  , DefEntitySymbol
+  , extendAttributes
+  , attrListToMap
+  , attrMapToList
+  ) where
+
+import qualified Data.Map as Map
+import qualified Data.Aeson as A
+
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+import qualified Haxl.DataSource.Glean as Glean (HasRepo)
+import Glean.Glass.Types
+
+import Glean.Glass.SourceControl ( SourceControl )
+import qualified Glean.Schema.Src.Types as Src ( File )
+import qualified Glean.Schema.Code.Types as Code
+
+
+
+-- | Class for defining log structures that can be converted to JSON text
+class LogAttr a where
+  -- | Convert the structure to a single JSON-formatted text string
+  toLogText :: a -> A.Value
+
+instance LogAttr () where
+  toLogText _ = A.Null
+
+-- | Class for querying attributes and converting them to thrift
+class LogAttr (AttrLog key) => ToAttributes key where
+
+  type AttrRep key :: *
+  type FileAttrRep key :: *
+  type AttrLog key :: *
+
+  -- | Fetch the metadata about the attributes for this file
+  -- e.g. a list of available denominators/slices
+  queryMetadataForFile
+    :: key
+    -> Maybe Int
+    -> Glean.IdOf Src.File
+    -> AttributeOptions
+    -> Revision
+    -> Glean.RepoHaxl u w [FileAttrRep key]
+
+  fileAttrsToAttributeList
+   :: key
+    -> [FileAttrRep key]
+    -> Maybe AttributeList
+
+  -- | Fetch the data for this attribute type for a file
+  queryForFile
+    :: (SourceControl scm, Glean.HasRepo u)
+    => key
+    -> Maybe Int
+    -> Glean.IdOf Src.File
+    -> AttributeOptions
+    -> scm
+    -> RepoName
+    -> Path
+    -> Revision
+    -> [FileAttrRep key]
+    -> Glean.RepoHaxl u w [AttrRep key]
+
+  -- | Add attributes to symbols
+  augmentSymbols
+    :: key
+    -> [AttrRep key]
+    -> [RefEntitySymbol]
+    -> [DefEntitySymbol]
+    -> AttributeOptions
+    -> ([RefEntitySymbol], [DefEntitySymbol], AttrLog key)
+
+type RefEntitySymbol = (Code.Entity, ReferenceRangeSymbolX)
+type DefEntitySymbol = (Code.Entity, DefinitionSymbolX)
+
+-- | Given some definitions, combine their attributes from any additional
+-- ones in the attribute maps. Helper for implementing augmentSymbols.
+extendAttributes
+  :: Ord k
+  => (SymbolId -> Code.Entity -> k)
+  -> Map.Map k Attributes
+  -> [RefEntitySymbol]
+  -> [DefEntitySymbol]
+  -> ([RefEntitySymbol], [DefEntitySymbol])
+extendAttributes keyFn attrMap theRefs theDefs = (refs, defs)
+  where
+    defs = map (uncurry extendDef) theDefs
+    refs = map (uncurry extendRef) theRefs
+
+    extend symId entity def = case Map.lookup (keyFn symId entity) attrMap of
+      Nothing -> def
+      Just attr -> attrMapToList attr <> def
+
+    extendRef entity ref@ReferenceRangeSymbolX{..} = (entity,) $
+        ref { referenceRangeSymbolX_attributes = attrs }
+      where
+        attrs = extend referenceRangeSymbolX_sym entity
+          referenceRangeSymbolX_attributes
+
+    extendDef entity def@DefinitionSymbolX{..} = (entity,) $
+        def { definitionSymbolX_attributes = attrs }
+      where
+        attrs = extend definitionSymbolX_sym entity
+          definitionSymbolX_attributes
+
+instance Prelude.Semigroup AttributeList where
+  AttributeList a <> AttributeList b = AttributeList (a <> b)
+
+-- | Convert between attribute bag representations
+attrMapToList :: Attributes -> AttributeList
+attrMapToList (Attributes attrMap) = AttributeList $
+    map pair $ Map.toList attrMap
+  where
+    pair (k,v) = KeyedAttribute k v
+
+-- | Convert attribute list to map keyed by attr key
+attrListToMap :: AttributeList -> Attributes
+attrListToMap (AttributeList elems) = Attributes $
+    Map.fromList $ map unpair elems
+  where
+    unpair (KeyedAttribute k v) = (k,v)
diff --git a/glean/glass/Glean/Glass/Attributes/SymbolKind.hs b/glean/glass/Glean/Glass/Attributes/SymbolKind.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Attributes/SymbolKind.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+-- Copyright 2004-present Facebook. All Rights Reserved.
+
+module Glean.Glass.Attributes.SymbolKind
+  ( {- instances -}
+    SymbolKindAttr(..)
+  , symbolKindToSymbolKind
+  , symbolKindFromSymbolKind
+  ) where
+
+--
+-- Labels for entities, usually based on the constructor
+--
+
+import qualified Data.Map as Map
+
+import qualified Glean
+import Glean.Angle as Angle
+
+import qualified Glean.Glass.Utils as Utils
+import Glean.Glass.Attributes.Class
+import Glean.Glass.Types as Glass
+    ( SymbolKind(..), Attribute(Attribute_aInteger), Attributes(Attributes) )
+
+import Thrift.Protocol ( fromThriftEnum, ThriftEnum (toThriftEnum) )
+
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+
+-- | Key of generic kind labels
+data SymbolKindAttr = SymbolKindAttr
+
+type EntityKindLabel = (Code.Entity, Code.SymbolKind)
+
+instance ToAttributes SymbolKindAttr where
+  type AttrRep SymbolKindAttr = EntityKindLabel
+  type AttrLog SymbolKindAttr = ()
+  type FileAttrRep SymbolKindAttr = ()
+
+  fileAttrsToAttributeList _ _ = undefined
+
+
+  queryForFile _ lim fileId _ _ _ _ _ _ =
+    fst <$> Utils.searchRecursiveWithLimit lim q
+    where
+    -- We actually make two queries!
+    q = fileEntityKinds fileId .| fileEntityXRefKinds fileId
+
+  augmentSymbols _ kinds refs defs _ =
+      (refs_result, defs_result, ())
+     where
+     (refs_result, defs_result) =
+      extendAttributes (\_ ent -> ent) attrMap refs defs
+      where
+      attrMap = Map.fromList
+        [ (entity, toAttributes kind)
+        | (entity, kind) <- kinds
+        ]
+      toAttributes kind = Attributes $ Map.singleton "symbolKind"
+        (Attribute_aInteger (fromIntegral
+          (fromThriftEnum $ symbolKindToSymbolKind kind)))
+
+
+  queryMetadataForFile _ _ _ _ _ = pure []
+
+fileEntityKinds :: Glean.IdOf Src.File -> Angle.Angle EntityKindLabel
+fileEntityKinds fileId =
+  vars $ \(entity :: Angle Code.Entity) (kind :: Angle Code.SymbolKind) ->
+    tuple (entity, kind) `where_` [
+      wild .= predicate @Code.FileEntityKinds (
+            rec $
+              field @"file" (asPredicate (factId fileId)) $
+              field @"entity" entity $
+              field @"kind" kind
+            end
+      )
+    ]
+
+fileEntityXRefKinds :: Glean.IdOf Src.File -> Angle.Angle EntityKindLabel
+fileEntityXRefKinds fileId =
+  vars $ \(entity :: Angle Code.Entity) (kind :: Angle Code.SymbolKind) ->
+    tuple (entity, kind) `where_` [
+      wild .= predicate @Code.FileEntityXRefKinds (
+            rec $
+              field @"file" (asPredicate (factId fileId)) $
+              field @"entity" entity $
+              field @"kind" kind
+            end
+      )
+    ]
+
+-- | Type safe mapping from the SymbolKind type defined in codemarkup (which
+-- generates a thrift type), and the client-exposed kind.
+--
+-- We don't want to expose something that depends on how Glean represents enums
+--
+symbolKindToSymbolKind :: Code.SymbolKind -> Glass.SymbolKind
+symbolKindToSymbolKind k = case k of
+  Code.SymbolKind_Package -> Glass.SymbolKind_Package
+  Code.SymbolKind_Type -> Glass.SymbolKind_Type
+  Code.SymbolKind_Value -> Glass.SymbolKind_Value
+  Code.SymbolKind_File -> Glass.SymbolKind_File
+  Code.SymbolKind_Module -> Glass.SymbolKind_Module
+  Code.SymbolKind_Namespace -> Glass.SymbolKind_Namespace
+  Code.SymbolKind_Class_ -> Glass.SymbolKind_Class_
+  Code.SymbolKind_Method -> Glass.SymbolKind_Method
+  Code.SymbolKind_Property -> Glass.SymbolKind_Property
+  Code.SymbolKind_Field -> Glass.SymbolKind_Field
+  Code.SymbolKind_Constructor -> Glass.SymbolKind_Constructor
+  Code.SymbolKind_Enum_ -> Glass.SymbolKind_Enum
+  Code.SymbolKind_Interface -> Glass.SymbolKind_Interface
+  Code.SymbolKind_Function -> Glass.SymbolKind_Function
+  Code.SymbolKind_Variable -> Glass.SymbolKind_Variable
+  Code.SymbolKind_Constant -> Glass.SymbolKind_Constant
+  Code.SymbolKind_String -> Glass.SymbolKind_String
+  Code.SymbolKind_Number -> Glass.SymbolKind_Number
+  Code.SymbolKind_Boolean -> Glass.SymbolKind_Boolean
+  Code.SymbolKind_Array -> Glass.SymbolKind_Array
+  Code.SymbolKind_Object_ -> Glass.SymbolKind_Object
+  Code.SymbolKind_Key -> Glass.SymbolKind_Key
+  Code.SymbolKind_Null -> Glass.SymbolKind_Null
+  Code.SymbolKind_Enumerator -> Glass.SymbolKind_Enumerator
+  Code.SymbolKind_Struct -> Glass.SymbolKind_Struct
+  Code.SymbolKind_Event -> Glass.SymbolKind_Event
+  Code.SymbolKind_Operator -> Glass.SymbolKind_Operator
+  Code.SymbolKind_TypeParameter -> Glass.SymbolKind_TypeParameter
+  Code.SymbolKind_Union -> Glass.SymbolKind_Union
+  Code.SymbolKind_Macro -> Glass.SymbolKind_Macro
+  Code.SymbolKind_Trait -> Glass.SymbolKind_Trait
+  Code.SymbolKind_Fragment -> Glass.SymbolKind_Fragment
+  Code.SymbolKind_Operation -> Glass.SymbolKind_Operation
+  Code.SymbolKind_Directive -> Glass.SymbolKind_Directive
+  Code.SymbolKind__UNKNOWN n -> Glass.SymbolKind__UNKNOWN n
+
+-- | Type safe mapping from the client-exposed SymbolKind type to the SymbolKind
+-- defined in codemarkup (which generates a thrift type).
+--
+-- We don't want to expose something that depends on how Glean represents enums
+--
+symbolKindFromSymbolKind :: Glass.SymbolKind -> Code.SymbolKind
+symbolKindFromSymbolKind k = case k of
+  Glass.SymbolKind_Package -> Code.SymbolKind_Package
+  Glass.SymbolKind_Type -> Code.SymbolKind_Type
+  Glass.SymbolKind_Value -> Code.SymbolKind_Value
+  Glass.SymbolKind_File -> Code.SymbolKind_File
+  Glass.SymbolKind_Module -> Code.SymbolKind_Module
+  Glass.SymbolKind_Namespace -> Code.SymbolKind_Namespace
+  Glass.SymbolKind_Class_ -> Code.SymbolKind_Class_
+  Glass.SymbolKind_Method -> Code.SymbolKind_Method
+  Glass.SymbolKind_Property -> Code.SymbolKind_Property
+  Glass.SymbolKind_Field -> Code.SymbolKind_Field
+  Glass.SymbolKind_Constructor -> Code.SymbolKind_Constructor
+  Glass.SymbolKind_Enum -> Code.SymbolKind_Enum_
+  Glass.SymbolKind_Interface -> Code.SymbolKind_Interface
+  Glass.SymbolKind_Function -> Code.SymbolKind_Function
+  Glass.SymbolKind_Variable -> Code.SymbolKind_Variable
+  Glass.SymbolKind_Constant -> Code.SymbolKind_Constant
+  Glass.SymbolKind_String -> Code.SymbolKind_String
+  Glass.SymbolKind_Number -> Code.SymbolKind_Number
+  Glass.SymbolKind_Boolean -> Code.SymbolKind_Boolean
+  Glass.SymbolKind_Array -> Code.SymbolKind_Array
+  Glass.SymbolKind_Object -> Code.SymbolKind_Object_
+  Glass.SymbolKind_Key -> Code.SymbolKind_Key
+  Glass.SymbolKind_Null -> Code.SymbolKind_Null
+  Glass.SymbolKind_Enumerator -> Code.SymbolKind_Enumerator
+  Glass.SymbolKind_Struct -> Code.SymbolKind_Struct
+  Glass.SymbolKind_Event -> Code.SymbolKind_Event
+  Glass.SymbolKind_Operator -> Code.SymbolKind_Operator
+  Glass.SymbolKind_TypeParameter -> Code.SymbolKind_TypeParameter
+  Glass.SymbolKind_Union -> Code.SymbolKind_Union
+  Glass.SymbolKind_Macro -> Code.SymbolKind_Macro
+  Glass.SymbolKind_Trait -> Code.SymbolKind_Trait
+  Glass.SymbolKind_Fragment -> Code.SymbolKind_Fragment
+  Glass.SymbolKind_Operation -> Code.SymbolKind_Operation
+  Glass.SymbolKind_Directive -> Code.SymbolKind_Directive
+  Glass.SymbolKind__UNKNOWN x -> toThriftEnum x -- this might throw
diff --git a/glean/glass/Glean/Glass/Base.hs b/glean/glass/Glean/Glass/Base.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Base.hs
@@ -0,0 +1,102 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Base
+  ( GleanDBName(..)
+  , GleanPath(..)
+  , SymbolRepoPath(..)
+  , GleanDBAttrName(..)
+  , RepoMapping(..)
+  , GleanDBSelector(..)
+  ) where
+
+import Data.Function
+import Data.Hashable
+import Data.List.NonEmpty(NonEmpty(..))
+import qualified Data.List.NonEmpty as NE
+import qualified Data.Map as Map
+import Data.String
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import qualified Logger.GleanGlass as Logger
+
+import Glean ( Repo(..) )
+import qualified Glean.Glass.Types as Glass
+import Glean.Glass.Logging
+import Glean.Glass.Attributes.Class as Attributes
+
+-- | Just a wrapper for a db name as Text
+newtype GleanDBName = GleanDBName { unGleanDBName :: Text }
+  deriving (Eq, Ord, Show, Hashable)
+
+instance IsString GleanDBName where fromString = GleanDBName . fromString
+
+instance LogResult (NonEmpty (GleanDBName, Glean.Repo)) where
+  logResult ((_, repo) :| []) =
+    Logger.setRepoName (Glean.repo_name repo) <>
+    Logger.setRepoHash (Glean.repo_hash repo)
+  logResult rs0@(_ :| _) =
+    Logger.setRepoName (commas repo_name rs) <>
+    Logger.setRepoHash (commas (Text.take 12 . repo_hash) rs)
+    where
+      rs = NE.sortBy (compare `on` Glean.repo_name) (fmap snd rs0)
+
+commas :: (Glean.Repo -> Text) -> NonEmpty Glean.Repo -> Text
+commas f = Text.intercalate "," . map f . NE.toList
+
+--
+-- | A glean path for www is prefixed with www/
+-- For all other repos, it is relative to the repo root.
+--
+newtype GleanPath = GleanPath { gleanPath :: Text }
+  deriving (Show, Eq)
+
+--
+-- | A path relative to the given repo root
+--
+data SymbolRepoPath = SymbolRepoPath
+  { symbolRepo :: Glass.RepoName
+  , symbolPath :: Glass.Path
+  }
+  deriving (Show, Eq)
+
+-- | A little existential type key for attributes
+data GleanDBAttrName =
+  forall attr . (Attributes.ToAttributes attr) =>
+  GleanDBAttrName {
+    gleanAttrDBName :: GleanDBName,
+    attributeKey :: attr
+  }
+
+data GleanDBSelector = GleanDBSelector
+  { dbName :: GleanDBName
+  , language :: Glass.Language
+  , branchName :: Maybe Text
+  -- ^ Nothing means the db is default, can be used for any branch
+  }
+
+data RepoMapping = RepoMapping
+  { gleanIndices :: Map.Map Glass.RepoName [GleanDBSelector]
+    -- ^ This should be in a config
+    --
+    -- This is the set of Glean dbs that should implement codemarkup.*
+    --
+    -- Note: the order here determines the order of search/lookup
+    -- if you have overlapping dbs , for file contents, the first in the order
+    -- with a src.File fact will win.
+    --
+    -- If you add/remove a db, consider if it needs to be present in
+    -- gleanRequiredIndices as well
+
+  , gleanAttrIndices :: Map.Map Glass.RepoName [GleanDBAttrName]
+    -- ^ Map of source db to attr db names & attribute key types
+    --
+    -- This pairs attribute Glean dbs with a key type to index the ToAttribute
+    -- class, that in turns knowns how to query and marshal the attributes
+  }
diff --git a/glean/glass/Glean/Glass/Comments.hs b/glean/glass/Glean/Glass/Comments.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Comments.hs
@@ -0,0 +1,78 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Comments (
+    getCommentsForEntity
+  ) where
+
+import Data.Text (Text)
+
+import Glean.Angle as Angle
+import Glean.Glass.Range ( rangeSpanToLocationRange )
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+
+import Glean.Glass.SymbolId (entityToAngle)
+import Glean.Glass.Utils ( searchRecursiveWithLimit )
+import qualified Glean.Glass.Types as Glass
+
+-- | Set a low bound on maximum results so we don't search too long
+mAX_COMMENTS :: Int
+mAX_COMMENTS = 3
+
+getCommentsForEntity
+  :: Glass.RepoName
+  -> Code.Entity
+  -> Glean.RepoHaxl u w (Either Text [Glass.SymbolComment])
+getCommentsForEntity repo entity = case entityToAngle entity of
+  Left err -> pure (Left err)
+  Right q -> Right <$> getEntityComments repo q
+
+getEntityComments
+  :: Glass.RepoName
+  -> Angle Code.Entity
+  -> Glean.RepoHaxl u w [Glass.SymbolComment]
+getEntityComments repo entity = do
+    (res, _truncated) <- searchRecursiveWithLimit (Just mAX_COMMENTS) $
+      entityComments entity
+    mapM toLocation res
+  where
+    toLocation (file, span, mtext) = do
+      range <- mkLocationRange repo file span
+      return (Glass.SymbolComment range mtext)
+
+-- | Docs are always bytespans at the moment. Convert them out.
+-- these files should be in the src.FileLines cache as they're almost always
+-- the same file as the declaration location, which is already processed
+mkLocationRange
+   :: Glass.RepoName -> Src.File -> Src.ByteSpan
+   -> Glean.RepoHaxl u w Glass.LocationRange
+mkLocationRange repo file span = rangeSpanToLocationRange repo file
+  (Code.RangeSpan_span span)
+
+entityComments
+  :: Angle Code.Entity -> Angle (Src.File, Src.ByteSpan, Maybe Text)
+entityComments entity =
+  vars $ \ (file :: Angle Src.File) (span :: Angle Src.ByteSpan)
+    (mtext :: Angle (Maybe Text)) ->
+  tuple (file, span, mtext) `where_` [
+    wild .= Angle.predicate @Code.EntityComments (
+      rec $
+        field @"entity" entity $
+        field @"file" (asPredicate file) $
+        field @"span" span $
+        field @"text" mtext
+      end
+    )
+  ]
diff --git a/glean/glass/Glean/Glass/Config.hs b/glean/glass/Glean/Glass/Config.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Config.hs
@@ -0,0 +1,44 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Config
+  (
+    defaultConfigKey,
+    defaultPort,
+    defaultServiceName,
+    defaultRefreshFreq,
+    defaultListDatabasesRetry,
+    defaultWelcomeMessage
+  ) where
+
+import Data.Text (Text)
+import Util.Time
+import Glean.Glass.Env
+import Util.Text (textShow)
+
+defaultPort :: Int
+defaultPort = 26073
+
+defaultConfigKey :: Text
+defaultConfigKey = "glean/glass/glass_server"
+
+defaultServiceName :: Text
+defaultServiceName = "glean_glass"
+
+defaultRefreshFreq :: DiffTimePoints
+defaultRefreshFreq = minutes 5
+
+defaultListDatabasesRetry :: Int
+defaultListDatabasesRetry = 5
+
+defaultWelcomeMessage :: Config a -> Text
+defaultWelcomeMessage Config{..} = mconcat
+          [ "glass"
+          , ": port " <> textShow listenPort
+          , ", config " <> configKey
+          ]
diff --git a/glean/glass/Glean/Glass/Describe.hs b/glean/glass/Glean/Glass/Describe.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Describe.hs
@@ -0,0 +1,153 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Describe (
+  -- * symbol information API
+    mkSymbolDescription,
+    mkBriefSymbolDescription,
+    describeEntity,
+    briefDescribeEntity
+  ) where
+
+import Data.Maybe ( listToMaybe )
+import Data.Either.Extra ( eitherToMaybe )
+
+import qualified Glean
+import Glean.Haxl.Repos as Glean ( RepoHaxl )
+
+import Glean.Glass.Range ( rangeSpanToLocationRange )
+import Glean.Glass.Types
+import Glean.Glass.SymbolId ( toQualifiedName, entityLanguage, nativeSymbol )
+import Glean.Glass.SymbolKind ( findSymbolKind )
+import Glean.Glass.Search ( CodeEntityLocation(..) )
+import Glean.Glass.SymbolSig ( toSymbolSignatureText )
+import Glean.Glass.Annotations ( getAnnotationsForEntity )
+import Glean.Glass.Visibility ( getInfoForEntity )
+import Glean.Glass.Comments ( getCommentsForEntity )
+import Glean.Glass.Repos ( ScmRevisions, getRepoHashForLocation )
+import Glean.Glass.Utils ( eThrow, fst4)
+import Glean.Glass.Pretty.Cxx as Cxx (Qualified(..))
+import qualified Glean.Glass.SearchRelated as Search
+
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Glass.Types as Glass
+
+-- Helper to fill out symbol description metadata uniformly
+mkSymbolDescription
+  :: SymbolId
+  -> ScmRevisions
+  -> RepoName
+  -> CodeEntityLocation
+  -> Maybe SymbolContext
+  -> Glean.RepoHaxl u w SymbolDescription
+mkSymbolDescription  = mkDescription describeEntity
+
+-- Helper to fill out _basic_ symbol description metadata uniformly
+mkBriefSymbolDescription
+  :: SymbolId
+  -> ScmRevisions
+  -> RepoName
+  -> CodeEntityLocation
+  -> Maybe SymbolContext
+  -> Glean.RepoHaxl u w SymbolBasicDescription
+mkBriefSymbolDescription = mkDescription (const briefDescribeEntity)
+
+--- Worker to fill out symbol description metadata uniformly
+mkDescription
+  :: (ScmRevisions -> Code.Entity -> SymbolResult -> Glean.RepoHaxl u w t)
+  -> SymbolId
+  -> ScmRevisions
+  -> RepoName
+  -> CodeEntityLocation
+  -> Maybe SymbolContext
+  -> Glean.RepoHaxl u w t
+mkDescription fn symbolId scmRevs repo CodeEntityLocation{..} mctx = do
+  range <- rangeSpanToLocationRange repo entityFile entityRange
+  kind <- eitherToMaybe <$> findSymbolKind entity
+  qname <- eThrow =<< toQualifiedName entity -- non-optional now
+  let lang = entityLanguage entity
+      score = mempty
+  fn scmRevs entity $
+    SymbolResult symbolId range lang kind entityName score qname mctx
+
+-- | Return a brief description with only required fields set.
+-- Far more efficient for cases where we don't need everything
+briefDescribeEntity
+  :: Code.Entity -> SymbolResult -> Glean.RepoHaxl u w SymbolBasicDescription
+briefDescribeEntity ent SymbolResult{..} = do
+  symbolBasicDescription_signature <- fst <$> toSymbolSignatureText ent repo
+    symbolResult_symbol Cxx.Qualified
+  pure SymbolBasicDescription{..}
+  where
+    symbolBasicDescription_sym = symbolResult_symbol
+    symbolBasicDescription_name = symbolResult_qname
+    symbolBasicDescription_kind = symbolResult_kind
+    symbolBasicDescription_language = symbolResult_language
+    repo = locationRange_repository symbolResult_location
+
+-- | Return a description for a single Entity with a unique location.
+describeEntity
+  :: ScmRevisions
+  -> Code.Entity
+  -> SymbolResult
+  -> Glean.RepoHaxl u w SymbolDescription
+describeEntity scmRevs ent SymbolResult{..} = do
+  symbolDescription_repo_hash <-
+    getRepoHashForLocation symbolResult_location scmRevs <$> Glean.haxlRepo
+  let symbolDescription_name = symbolResult_qname
+  symbolDescription_annotations <- eThrow =<< getAnnotationsForEntity repo ent
+  symbolDescription_pretty_comments <- eThrow =<< getCommentsForEntity repo ent
+  (symbolDescription_visibility, symbolDescription_modifiers)
+     <- eThrow =<< getInfoForEntity ent
+  (symbolDescription_signature, symbolDescription_type_xrefs)
+    <- toSymbolSignatureText ent repo symbolResult_symbol Cxx.Qualified
+  symbolDescription_extends_relation <-
+    relationDescription RelationType_Extends
+  symbolDescription_contains_relation <-
+    relationDescription RelationType_Contains
+  symbolDescription_native_sym <- fmap Glass.NativeSymbol <$> nativeSymbol ent
+  pure SymbolDescription{..}
+  where
+    symbolDescription_sym = symbolResult_symbol
+    symbolDescription_kind = symbolResult_kind
+    symbolDescription_language = symbolResult_language
+
+    symbolDescription_sym_location = symbolResult_location
+    symbolDescription_sym_other_locations = []
+
+    repo = locationRange_repository symbolResult_location
+
+    -- deprecated. we already have sym_location
+    symbolDescription_location = SymbolPath {
+      symbolPath_range = locationRange_range symbolResult_location,
+      symbolPath_repository = locationRange_repository symbolResult_location,
+      symbolPath_filepath = locationRange_filepath symbolResult_location
+    }
+
+    relationDescription relatedBy = do
+      parents <- describeRelation RelationDirection_Parent
+      children <- describeRelation RelationDirection_Child
+
+      let firstParent = Search.parentRL <$> listToMaybe parents
+          firstChild = Search.childRL <$> listToMaybe children
+          relationDescription_firstParent = snd <$> firstParent
+          relationDescription_firstChild = snd <$> firstChild
+          relationDescription_hasMoreParents = length parents > 1
+          relationDescription_hasMoreChildren = length children > 1
+
+      relationDescription_firstParentName <- case firstParent of
+        Nothing -> pure Nothing
+        Just (p,_) -> eitherToMaybe <$> toQualifiedName (fst4 p)
+      relationDescription_firstChildName <- case firstChild of
+        Nothing -> pure Nothing
+        Just (p,_) -> eitherToMaybe <$> toQualifiedName (fst4 p)
+
+      pure RelationDescription{..}
+      where
+        describeRelation relation = Search.searchRelatedEntities 2
+          Search.ShowAll Search.NotRecursive relation relatedBy ent repo
diff --git a/glean/glass/Glean/Glass/Digest.hs b/glean/glass/Glean/Glass/Digest.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Digest.hs
@@ -0,0 +1,60 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Digest
+  (
+    fetchFileDigests,
+    toDigest,
+    toDigestMap
+  ) where
+
+import Data.Text ( Text )
+import Data.Map.Strict ( Map )
+import qualified Data.Map.Strict as Map
+
+import qualified Glean
+import Glean.Haxl.Repos as Glean
+import qualified Glean.Glass.Query as Query
+import Glean.Glass.Utils ( searchWithLimit )
+
+import Glean.Glass.Types
+
+import qualified Glean.Schema.Digest.Types as Digest
+import qualified Glean.Schema.Src.Types as Src
+
+type RepoName_ = Text -- avoid newtype double-quoting in thrift
+
+fetchFileDigests
+  :: Int -> [Glean.IdOf Src.File] -> Glean.RepoHaxl u w [Digest.FileDigest]
+fetchFileDigests _ [] = pure [] -- avoid an empty call
+fetchFileDigests n srcFiles = searchWithLimit (Just n) query
+  where
+    query = Query.fileDigests srcFiles
+
+-- Export Src.Digest to Glass type
+toDigest :: Digest.Digest -> FileDigest
+toDigest Digest.Digest{..} = FileDigest{..}
+  where
+    fileDigest_hash = digest_hash
+    fileDigest_size = Glean.unNat digest_size
+
+-- Join the fileDigest predicate (keyed by id) back onto the full repo/path
+toDigestMap
+  :: Map (Glean.IdOf Src.File) (RepoName, Path)
+  -> [Digest.FileDigest]
+  -> Glean.RepoHaxl u w (Map RepoName_ FileDigestMap)
+toDigestMap fileIdMap digests = go digests mempty
+  where
+    go [] !acc = pure acc
+    go (pred:ps) !acc = do
+      Digest.FileDigest_key fileId digest <- Glean.keyOf pred
+      case Map.lookup (Glean.getId fileId) fileIdMap of
+        Nothing -> go ps acc -- digest with no associated file
+        Just (RepoName repo, Path path) -> do
+          let v = Map.singleton path (toDigest digest)
+          go ps $! Map.insertWith mappend repo v acc
diff --git a/glean/glass/Glean/Glass/Env.hs b/glean/glass/Glean/Glass/Env.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Env.hs
@@ -0,0 +1,128 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DuplicateRecordFields #-}
+module Glean.Glass.Env
+  (
+    -- * Read-only configuration
+    Config(..),
+    setSnapshotBackend,
+    setSourceControl,
+    setHaxlState,
+    setTracer,
+    setAllocationLimit,
+    updateWelcomeMessage,
+
+    -- * Session resources
+    Env,
+    Env'(..),
+    setUseSnapshotsForSymbolsList,
+    withAllocationLimit,
+  ) where
+
+import Data.Int
+import Data.Text (Text)
+
+import Facebook.Fb303 (Fb303State)
+import qualified Haxl.Core as Haxl
+import Logger.IO (Logger)
+import Util.AllocLimit
+import Util.EventBase (EventBaseDataplane)
+import Util.STM ( TVar )
+
+import qualified Glean
+import Glean.Impl.ConfigProvider (ConfigAPI)
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Util.Some ( Some )
+import Util.Time ( DiffTimePoints )
+
+import Glean.Glass.Base (RepoMapping)
+import Glean.Glass.Repos (GleanDBInfo)
+import Glean.Glass.SnapshotBackend ( SnapshotBackend(..) )
+import Glean.Glass.SourceControl
+import Glean.Glass.Tracing (Tracer, GlassTrace)
+
+-- | Init-time configuration
+data Config trace = Config
+  { listenPort :: Int
+  , configKey :: Text
+  , gleanService :: Glean.Service
+  , serviceName :: Text
+  , refreshFreq :: DiffTimePoints
+      -- ^ refresh glean repos on this frequency
+  , listDatabasesRetry :: Maybe Int
+      -- ^ whether to trust listDatabases and how often to wait to retry N times
+  , numWorkerThreads :: Maybe Int
+  , snapshotBackend :: EventBaseDataplane -> IO (Some SnapshotBackend)
+  , sourceControl :: EventBaseDataplane -> IO (Some SourceControl)
+  , haxlState :: EventBaseDataplane -> IO Haxl.StateStore
+      -- ^ Haxl datasource state to use with runHaxl, e.g. for sourceControl
+  , tracer :: Tracer trace
+  , welcomeMessage :: forall a. EventBaseDataplane -> Config a -> IO Text
+  , useSnapshotsForSymbolsList :: IO Bool
+  , allocationLimit :: IO (Maybe Int64)
+  }
+
+setSnapshotBackend
+  :: (EventBaseDataplane -> IO(Some SnapshotBackend)) -> Config a -> Config a
+setSnapshotBackend snapshotBackend_ Config{..} =
+  Config { snapshotBackend = snapshotBackend_, .. }
+
+setSourceControl
+  :: (EventBaseDataplane -> IO (Some SourceControl))
+  -> Config a -> Config a
+setSourceControl sourceControl_ Config{..} =
+  Config { sourceControl = sourceControl_, .. }
+
+setHaxlState
+  :: (EventBaseDataplane -> IO Haxl.StateStore)
+  -> Config a -> Config a
+setHaxlState st Config{..} = Config { haxlState = st, .. }
+
+setTracer :: Tracer trace -> Config trace -> Config trace
+setTracer tracer' Config{..}= Config{ tracer = tracer <> tracer', .. }
+
+setUseSnapshotsForSymbolsList :: IO Bool -> Config trace -> Config trace
+setUseSnapshotsForSymbolsList check Config{..} =
+  Config { useSnapshotsForSymbolsList = check, .. }
+
+setAllocationLimit :: IO (Maybe Int64) -> Config a -> Config a
+setAllocationLimit l Config{..} = Config { allocationLimit = l, .. }
+
+updateWelcomeMessage
+  :: ( forall a. (EventBaseDataplane -> Config a -> IO Text)
+      -> EventBaseDataplane -> Config a -> IO Text)
+  -> Config a
+  -> Config a
+updateWelcomeMessage f config =
+  config{ welcomeMessage = f (welcomeMessage config)}
+
+-- | Read-only, scoped, dynamic resources.
+type Env = Env' GlassTrace
+
+data Env' trace = Env
+  { evp :: EventBaseDataplane
+  , cfgapi :: ConfigAPI
+  , logger :: Logger
+  , gleanBackend :: Some Glean.Backend
+  , fb303 :: Fb303State
+  , latestGleanRepos :: TVar GleanDBInfo
+  , snapshotBackend :: Some SnapshotBackend
+  , gleanDB :: Maybe Glean.Repo -- if provided, use as target Glean DB
+  , repoMapping :: RepoMapping
+  , sourceControl :: Some SourceControl
+  , haxlState :: Haxl.StateStore
+  , tracer :: Tracer trace
+  , useSnapshotsForSymbolsList :: IO Bool
+  , allocationLimit :: IO (Maybe Int64)
+  }
+
+withAllocationLimit :: Env' t -> IO a -> IO a
+withAllocationLimit Env{..} act = do
+  l <- allocationLimit
+  maybe id limitAllocsThrow l act
diff --git a/glean/glass/Glean/Glass/Handler/Cxx.hs b/glean/glass/Glean/Glass/Handler/Cxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Handler/Cxx.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Handler.Cxx
+  (
+  -- * C++ specific methods
+    fileIncludeLocations
+  , clangUSRToDefinition
+  , usrToDefinition
+  , hashUSR
+  ) where
+
+import Control.Applicative ( (<|>) )
+import Control.Monad.Catch ( MonadThrow(throwM) )
+import Control.Monad ( forM )
+import qualified Data.Digest.Pure.SHA as SHA
+import qualified Data.Map.Strict as Map
+import Data.Foldable ( find )
+import qualified Data.Text as Text
+import Data.Text ( Text )
+import qualified Data.Text.Lazy as TextLazy
+import Data.Text.Lazy.Encoding (encodeUtf8)
+
+import Glean.Glass.Base
+import Glean.Glass.SymbolId
+import Glean.Haxl as Glean ( keyOf, haxlRepo )
+import Glean.Haxl.Repos as Glean ( RepoHaxl )
+import qualified Glean.Glass.Env as Glass
+import Glean.Glass.Handler.Utils
+import Glean.Glass.Repos
+import Glean.Glass.Logging ( errorsText, QueryEachRepoLog )
+import Glean.Glass.Path
+import Glean.Glass.Types
+import Glean.Glass.Range
+
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+
+import qualified Glean.Glass.Query.Cxx as Cxx
+import Data.Maybe (fromMaybe)
+
+fileIncludeLocations
+  :: Glass.Env
+  -> FileIncludeLocationRequest
+  -> RequestOptions
+  -> IO FileIncludeLocationResults
+fileIncludeLocations env@Glass.Env{..} req opts = do
+  fmap fst $ do
+  withRepoFile "fileIncludeLocations" env opts
+    req repo rootfile $ \gleanDBs _ _ ->
+      backendRunHaxl GleanBackend{..} env $ do
+        result <- firstOrErrors $ do
+          rev <- getRepoHash <$> Glean.haxlRepo
+          efile <- getFile (toGleanPath (SymbolRepoPath repo rootfile))
+          case efile of
+            Left err -> return (Left err)
+            Right file -> do
+              includes <- Cxx.fileIncludeLocationsForCxx depth mlimit file
+              Right <$> processFileIncludes repo rev includes
+        case result of
+          Left err -> throwM $ ServerException $ errorsText err
+          Right (efile, gleanDataLog) ->
+            return ((efile, gleanDataLog), Nothing)
+  where
+    repo = fileIncludeLocationRequest_repository req
+    rootfile = fileIncludeLocationRequest_filepath req
+    depth_ = fileIncludeLocationRequest_depth req
+    depth | depth_ <= 0 = 1
+          | otherwise = fromIntegral depth_
+    mlimit = fromIntegral <$> requestOptions_limit opts
+
+
+-- | Lookup the USR in Glean to yield and entity,
+-- compute entity declToDef, return the pairs and other info.
+clangUSRToDefinition
+  :: Glass.Env
+  -> USRHash
+  -> RequestOptions
+  -> IO (USRSymbolDefinition, QueryEachRepoLog)
+clangUSRToDefinition env@Glass.Env{..} usr@(USRHash hash) opts = do
+  withRepoLanguage "clangUSRToDefinition" env usr repo mlang opts $
+    \gleanDBs _ _ -> do
+      backendRunHaxl GleanBackend{..} env $ do
+        result <- firstOrErrors $ do
+          mdefn <- Cxx.usrHashToDeclaration hash
+          defnResToUSRSymbolDefinition mdefn repo
+        case result of
+          Left err -> throwM $ ServerException $ errorsText err
+          Right defn -> return (defn, Nothing)
+  where
+    repo = RepoName "fbsource"
+    mlang = Just Language_Cpp
+
+usrToDefinition ::
+  Glass.Env ->
+  USRToDefinitionRequest ->
+  RequestOptions ->
+  IO (USRSymbolDefinition, QueryEachRepoLog)
+usrToDefinition
+  env@Glass.Env{..}
+  req@(USRToDefinitionRequest (USR usr) mRepo)
+  opts =
+    withRepoLanguage "usrToDefinition" env req repo (Just lang) opts $
+      \gleanDBs _ _ -> do
+        backendRunHaxl GleanBackend{..} env $ do
+          result <- firstOrErrors $ do
+            mdefn <- Cxx.usrToDeclaration usr
+            defnResToUSRSymbolDefinition mdefn repo
+          case result of
+            Left err -> throwM $ ServerException $ errorsText err
+            Right defn -> return (defn, Nothing)
+   where
+    lang = Language_Swift
+    repo =
+      fromMaybe
+        (RepoName "fbsource")
+        ( mRepo
+          <|> fmap fst
+              ( find
+                  (any ((== lang) . language) . snd)
+                  (Map.toList $ gleanIndices repoMapping)
+              )
+        )
+
+defnResToUSRSymbolDefinition
+  :: Maybe (Code.Location, Code.Entity) -- ^
+  -> RepoName -- ^
+  -> Glean.RepoHaxl u w (Either GlassExceptionReason USRSymbolDefinition)
+defnResToUSRSymbolDefinition mdefn repo = do
+  rev <- getRepoHash <$> Glean.haxlRepo
+  case mdefn of
+    Nothing -> -- either usr is unknown or decl is already defn
+      pure (Left (GlassExceptionReason_entitySearchFail
+        "No definition result for USR"))
+    Just (Code.Location{..}, entity) -> do
+      range <- case location_destination of
+        Just Src.FileLocation{..} -> do
+          let rangeSpan = Code.RangeSpan_span fileLocation_span
+          rangeSpanToLocationRange repo fileLocation_file rangeSpan
+        Nothing -> rangeSpanToLocationRange repo location_file
+          location_location
+      path <- GleanPath <$> Glean.keyOf location_file
+      sym <- toSymbolId (fromGleanPath repo path) entity
+      pure (Right (USRSymbolDefinition {
+        uSRSymbolDefinition_location = range,
+        uSRSymbolDefinition_revision = rev,
+        uSRSymbolDefinition_sym = sym
+      }))
+
+-- | Scrub all glean types for export to the client
+-- And flatten to lists for GraphQL.
+processFileIncludes
+  :: RepoName
+  -> Revision
+  -> Map.Map Src.File [(Src.File , Src.Range)]
+  -> Glean.RepoHaxl u w FileIncludeLocationResults
+processFileIncludes repo rev xmap = do
+  forExport <- forM (Map.toList xmap) $ \(file, xrefs) -> do
+    key <- GleanPath <$> Glean.keyOf file
+    refs <- forM xrefs $ \(targetFile, srcRange) -> do
+      targetPath <- GleanPath <$> Glean.keyOf targetFile
+      let range = inclusiveRangeToExclusiveRange srcRange
+      pure (FileXRefTarget (symbolPath $ fromGleanPath repo targetPath) range)
+    pure FileIncludeXRef {
+      fileIncludeXRef_source = symbolPath (fromGleanPath repo key),
+      fileIncludeXRef_includes = refs
+    }
+  pure FileIncludeLocationResults {
+    fileIncludeLocationResults_references = XRefFileList forExport,
+    fileIncludeLocationResults_revision = rev
+  }
+
+hashUSR :: Text -> Text
+hashUSR =
+  -- /!\ Keep in sync with glean/lang/clang/hash.cpp!
+  Text.toUpper
+    . Text.pack
+    . take 16
+    . SHA.showDigest
+    . SHA.sha1
+    . encodeUtf8
+    . TextLazy.fromStrict
diff --git a/glean/glass/Glean/Glass/Handler/Documents.hs b/glean/glass/Glean/Glass/Handler/Documents.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Handler/Documents.hs
@@ -0,0 +1,1064 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Handler.Documents
+  (
+  -- * listing symbols by file
+    documentSymbolListX
+  , documentSymbolListXSnapshot
+  , documentSymbolIndex
+  ) where
+
+import Control.Monad
+import Control.Exception ( SomeException )
+import Control.Monad.Catch ( try )
+import Data.Hashable
+import Data.List as List ( find )
+import Data.List.NonEmpty (NonEmpty(..))
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.Maybe
+import Data.Text ( Text, isPrefixOf )
+import qualified Control.Concurrent.Async as Async
+import qualified Data.Map.Strict as Map
+import qualified Data.Text as Text
+
+import qualified Haxl.Core as Haxl
+import Glean.Util.ToAngle
+import Util.Text ( textShow )
+
+import Thrift.Protocol ( fromThriftEnum )
+
+import qualified Glean
+import Glean.Haxl as Glean ( keyOf, haxlRepo )
+import Glean.Haxl.Repos as Glean
+import Glean.Util.Some as Glean ( Some )
+import qualified Haxl.DataSource.Glean as Glean (HasRepo)
+import qualified Glean.Util.Range as Range
+
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+
+import qualified Glean.Glass.Attributes as Attributes
+import Glean.Glass.Base
+import Glean.Glass.Digest
+import Glean.Glass.Handler.Utils
+import Glean.Glass.Logging
+import Glean.Glass.Repos
+import Glean.Glass.Path ( toGleanPath, fromGleanPath )
+import Glean.Glass.Range
+import Glean.Glass.SymbolId
+import Glean.Glass.SymbolSig ( toSymbolSignatureText )
+import Glean.Glass.Pretty.Cxx as Cxx (Qualified(..))
+import Glean.Glass.Types
+import Glean.Glass.RepoMapping (
+   mirrorConfig, Mirror(Mirror)
+  )
+import qualified Glean.Glass.Env as Glass
+import Glean.Glass.XRefs
+  ( GenXRef(..), XRef, resolveEntitiesRange, XlangXRef )
+import Glean.Glass.SymbolMap ( toSymbolIndex )
+
+import Glean.Glass.SnapshotBackend
+  ( SnapshotBackend(getSnapshot),
+    SnapshotStatus() )
+import qualified Glean.Glass.SnapshotBackend as Snapshot
+import Glean.Glass.Env (
+  Env' (tracer, sourceControl, useSnapshotsForSymbolsList))
+import Glean.Glass.SourceControl (SourceControl(..), NilSourceControl(..))
+import Glean.Glass.Tracing (traceSpan)
+import qualified Glean.Glass.Utils as Utils
+import Glean.Glass.Utils ( fst4 )
+import Logger.GleanGlass (GleanGlassLogger)
+import qualified Glean.Schema.Scip.Types as Scip
+import Data.Either (partitionEithers, fromLeft)
+import qualified Data.Text.Lazy as TL
+import Data.Aeson.Text (encodeToLazyText)
+import Glean.Glass.Handler.Cxx (hashUSR)
+import ServiceData.GlobalStats as Stats
+import ServiceData.Types as Stats
+import Util.Time (elapsedTime, toDiffMillis)
+
+-- | Runner for methods that are keyed by a file path.
+-- Select the right Glean DBs and pass them to the function (via a GleanBackend)
+runRepoFile
+  :: (LogResult t)
+  => Text
+  -> (GleanDBInfo
+    -> DocumentSymbolsRequest
+    -> RequestOptions
+    -> GleanBackend (Glean.Some Glean.Backend)
+    -> Glean.Some SnapshotBackend
+    -> Maybe Language
+    -> IO (t, Maybe ErrorLogger))
+  -> Glass.Env
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> IO t
+runRepoFile sym fn env@Glass.Env{..} req opts =
+  withRepoFile sym env opts req repo file $ \gleanDBs dbInfo mlang ->
+      fn dbInfo req opts
+         GleanBackend{gleanBackend, gleanDBs, tracer}
+         snapshotBackend
+         mlang
+  where
+    repo = documentSymbolsRequest_repository req
+    file = documentSymbolsRequest_filepath req
+
+-- | Discover navigable symbols in this file, resolving all bytespans and
+-- adding any attributes
+documentSymbolListX
+  :: Glass.Env
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> IO DocumentSymbolListXResult
+documentSymbolListX env r opts = do
+  useSnapshots <- useSnapshotsForSymbolsList env
+  fst4 <$>
+    runRepoFile
+      "documentSymbolListX"
+      (if useSnapshots
+        then fetchSymbolsAndAttributes env
+        else (\dbInfo req opts be _ mlang -> do
+                ((res, log, attrLog), err) <- fetchSymbolsAndAttributesGlean
+                  env dbInfo req opts be Nothing mlang
+                return ((res, Snapshot.Unrequested, log, attrLog), err)
+              )
+      )
+      env r opts
+
+-- | Variation of documentSymbolListX
+-- Always use Glean (and not XDB snapshot backend).
+-- Possibly use a different backend o resolve xlang
+-- entities to their location.
+--
+-- Use case: constructing document symbols lists
+-- snapshots from local dbs, and resolving xlang
+-- entities location from global dbs not locally indexed.
+documentSymbolListXSnapshot
+  :: Glass.Env
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> Maybe (Some Glean.Backend, GleanDBInfo)
+  -> IO DocumentSymbolListXResult
+documentSymbolListXSnapshot env r opts mGleanBe = do
+  fst4 <$>
+    runRepoFile
+      "documentSymbolListXSnapshot"
+      (\dbInfo req opts be _ mlang -> do
+          ((res, log, attrLog), err) <- fetchSymbolsAndAttributesGlean
+            env dbInfo req opts be mGleanBe mlang
+          return ((res, Snapshot.Unrequested, log, attrLog), err)
+          )
+      env r opts
+
+-- | Same as documentSymbolList() but construct a line-indexed map for easy
+-- cursor/position lookup, and add extra metadata
+documentSymbolIndex
+  :: Glass.Env
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> IO DocumentSymbolIndex
+documentSymbolIndex env r opts =
+  fst4 <$>
+    runRepoFile
+      "documentSymbolIndex"
+      (fetchDocumentSymbolIndex env)
+      env r opts
+
+-- | Normalized (to Glean) paths
+data FileReference =
+  FileReference {
+    _repoName :: !RepoName,
+    theGleanPath :: !GleanPath
+  }
+
+toFileReference :: RepoName -> Path -> FileReference
+toFileReference repo path =
+  FileReference repo (toGleanPath $ SymbolRepoPath repo path)
+
+repoPathToMirror :: RepoName -> Path -> Maybe Mirror
+repoPathToMirror repository (Path filepath) =
+  let isReqInMirror (Mirror mirrorRepo prefix _) =
+        repository == mirrorRepo && isPrefixOf prefix filepath in
+  find isReqInMirror mirrorConfig
+
+translateMirroredRepoListXResult
+  :: DocumentSymbolsRequest
+  -> DocumentSymbolListXResult
+  -> DocumentSymbolListXResult
+translateMirroredRepoListXResult
+  (DocumentSymbolsRequest repository path _ _ _) res =
+  case repoPathToMirror repository path of
+    Just (Mirror mirror prefix origin) ->
+      Utils.translateDocumentSymbolListXResult origin mirror prefix Nothing res
+    _ -> res
+
+fetchSymbolsAndAttributesGlean
+  :: Glean.Backend b
+  => Glass.Env
+  -> GleanDBInfo
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> GleanBackend b
+  -> Maybe (Some Glean.Backend, GleanDBInfo)
+  -> Maybe Language
+  -> IO (
+       (DocumentSymbolListXResult, QueryEachRepoLog, GleanGlassLogger),
+       Maybe ErrorLogger
+     )
+fetchSymbolsAndAttributesGlean
+  env@Glass.Env{tracer, gleanBackend}
+  dbInfo req opts be mOtherBackend mlang = do
+  (res1, gLogs, elogs) <- traceSpan tracer "fetchDocumentSymbols" $
+    fetchDocumentSymbols env file path mlimit
+      (requestOptions_revision opts)
+      (requestOptions_exact_revision opts)
+      withContentHash
+      ExtraSymbolOpts{..} be mlang dbInfo (requestOptions_attribute_opts opts)
+
+  (res2, attributesLog) <- do
+    (t, result) <- elapsedTime $ traceSpan tracer "addDynamicAttributes" $
+      addDynamicAttributes env dbInfo repo opts
+        file mlimit be res1
+    let metricName = if attributeOptions_fetch_default_view (requestOptions_attribute_opts opts)
+                     then "glass.dynamic_attributes.default_view.latency_ms"
+                     else "glass.dynamic_attributes.perf_view.latency_ms"
+    Stats.addStatValueType metricName (toDiffMillis t) Stats.Avg
+    return result
+
+  let be = fromMaybe (gleanBackend, dbInfo) mOtherBackend
+  res3 <- resolveXlangXrefs env path res2 repo be mlang
+
+  let res4 = toDocumentSymbolResult res3
+  let res5 = translateMirroredRepoListXResult req res4
+  return ((res5, gLogs, attributesLog), elogs)
+  where
+    repo = documentSymbolsRequest_repository req
+    path = documentSymbolsRequest_filepath req
+    file = toFileReference repo path
+    oIncludeRefs = documentSymbolsRequest_include_refs req
+    oLineRange = documentSymbolsRequest_range req
+    withContentHash = shouldFetchContentHash opts
+    oIncludeXlangRefs = case opts of
+      RequestOptions { requestOptions_feature_flags = Just
+        FeatureFlags { featureFlags_include_xlang_refs = Just True } } -> True
+      _ -> documentSymbolsRequest_include_xlang_refs req
+
+    mlimit = Just (fromIntegral (fromMaybe mAXIMUM_SYMBOLS_QUERY_LIMIT
+      (requestOptions_limit opts)))
+
+shouldFetchContentHash :: RequestOptions -> Bool
+shouldFetchContentHash opts =
+  not (requestOptions_exact_revision opts) &&
+  (requestOptions_content_check opts ||
+    requestOptions_matching_revision opts)
+
+type FetchDocumentSymbols =
+  ((DocumentSymbolListXResult, SnapshotStatus,
+    QueryEachRepoLog, GleanGlassLogger), Maybe ErrorLogger)
+
+-- | When an explicit revision is requested, we attempt to fetch both
+-- Glean results and a snapshot. This function chooses which result to
+-- use based on the requested revision, the revision of the result and
+-- RequestOptions.
+chooseGleanOrSnapshot
+  :: RequestOptions
+  -> Revision
+  -> (
+       (DocumentSymbolListXResult, QueryEachRepoLog, GleanGlassLogger),
+       Maybe ErrorLogger
+     )
+     -- ^ Glean result
+  -> Either
+       SnapshotStatus
+       (Revision, DocumentSymbolListXResult, Maybe Bool)
+     -- ^ Snapshot result (with deferred fetch)
+  -> IO FetchDocumentSymbols
+chooseGleanOrSnapshot RequestOptions{..} revision glean esnapshot
+  | isRevisionHit revision glean =
+    returnGlean
+  | Right (rev, res, _) <- esnapshot, rev == revision =
+    return $ returnSnapshot res Snapshot.ExactMatch
+  | requestOptions_matching_revision && not requestOptions_exact_revision =
+    doMatching
+  | otherwise =
+    returnGlean
+  where
+    returnGlean = return $
+      addStatus (fromLeft Snapshot.Ignored esnapshot) glean
+
+    doMatching
+      | Just True <- resultContentMatch glean = returnGlean
+      | Right (_, res, match) <- esnapshot =
+          return $ if match == Just True
+            then returnSnapshot res Snapshot.CompatibleMatch
+            else empty Snapshot.Ignored
+      | Left s <- esnapshot = return $ empty s
+      where
+      empty status =
+        ((toDocumentSymbolResult(emptyDocumentSymbols revision)
+          , status
+          , FoundNone, mempty)
+        , Just $ logError $
+            GlassExceptionReason_matchingRevisionNotAvailable $
+              unRevision revision
+        )
+
+    addStatus st ((res, gleanLog, attributesLog), mlogger) =
+      ((res, st, gleanLog, attributesLog), mlogger)
+
+    getResultRevision ((x, _ ,_), _) = documentSymbolListXResult_revision x
+    isRevisionHit rev = (== rev) . getResultRevision
+
+    resultContentMatch ((r, _, _), _) =
+      documentSymbolListXResult_content_match r
+
+returnSnapshot
+  :: DocumentSymbolListXResult
+  -> SnapshotStatus
+  -> FetchDocumentSymbols
+returnSnapshot queryResult match =
+  ((setContentMatch queryResult, match,
+    QueryEachRepoUnrequested, mempty), Nothing)
+  where
+    -- set the content_match field appropriately if we used a snapshot
+    setContentMatch res = case match of
+      Snapshot.ExactMatch -> matchYes
+      Snapshot.CompatibleMatch -> matchYes
+      _ -> res
+      where
+      matchYes = res { documentSymbolListXResult_content_match = Just True }
+
+-- | Fall back to the best snapshot available for new files (not yet in repo)
+fallbackForNewFiles
+  :: SnapshotBackend snapshotBackend
+  => Glass.Env
+  -> RequestOptions
+  -> snapshotBackend
+  -> RepoName
+  -> Path
+  -> FetchDocumentSymbols
+  -> IO FetchDocumentSymbols
+fallbackForNewFiles Glass.Env{..} RequestOptions{..} snapshotbe repo file res
+  | ((_,_,_,_), Just ErrorLogger {errorTy}) <- res, all isNoSrcFileFact errorTy,
+    -- assume it's a new file if no src.File fact
+    Just revision <- requestOptions_revision,
+    not requestOptions_exact_revision = do
+      gen <- getGeneration sourceControl repo revision
+      bestSnapshot <- getSnapshot tracer snapshotbe repo file Nothing gen
+      case bestSnapshot of
+        Right (_, fetch) ->
+          maybe res (`returnSnapshot` Snapshot.Latest) <$> fetch
+        Left _ ->
+          return res
+  | otherwise =
+    return res
+  where
+    isNoSrcFileFact GlassExceptionReason_noSrcFileFact{} = True
+    isNoSrcFileFact _ = False
+
+-- Find all symbols and refs in file and add all attributes
+fetchSymbolsAndAttributes
+  :: (Glean.Backend b, SnapshotBackend snapshotBackend)
+  => Glass.Env
+  -> GleanDBInfo
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> GleanBackend b
+  -> snapshotBackend
+  -> Maybe Language
+  -> IO (
+      (DocumentSymbolListXResult, SnapshotStatus, QueryEachRepoLog,
+         GleanGlassLogger),
+      Maybe ErrorLogger
+    )
+fetchSymbolsAndAttributes env@Glass.Env{..} dbInfo req
+  opts@RequestOptions{..} be snapshotbe mlang = do
+  res <- case requestOptions_revision of
+    Nothing ->
+      addStatus Snapshot.Unrequested <$> getFromGlean
+    Just revision -> do
+      (esnapshot, glean) <- Async.concurrently
+        (traceSpan tracer "getSnapshot" $ getFromSnapshot revision)
+        (traceSpan tracer "getFromGlean" getFromGlean)
+      chooseGleanOrSnapshot opts revision glean esnapshot
+
+  fallbackForNewFiles env opts snapshotbe repo file res
+  where
+    file = documentSymbolsRequest_filepath req
+    repo = documentSymbolsRequest_repository req
+
+    addStatus st ((res, gleanLog, attributeLog), mlogger) =
+      ((res, st, gleanLog, attributeLog), mlogger)
+
+    getFromSnapshot revision = do
+      let matching = requestOptions_matching_revision &&
+            not requestOptions_exact_revision
+      gen <-
+        if matching
+          then getGeneration sourceControl repo revision
+          else return Nothing
+      res <- getSnapshot tracer snapshotbe repo file (Just revision) gen
+      case res of
+        Left s -> return (Left s)
+        Right (snapshotRev, fetch) -> do
+          let result Nothing _ = Left Snapshot.InternalError
+              result (Just res) match = Right (snapshotRev, res, match)
+          if matching
+            then do
+              (content, match) <- Async.concurrently
+                fetch
+                (contentMatch snapshotRev revision)
+              return $ result content match
+            else do
+              content <- fetch
+              return $ result content Nothing
+
+    contentMatch myrev wantedrev
+      | myrev == wantedrev = return (Just True)
+      | otherwise =
+        backendRunHaxl be env $
+          withRepo (snd (NonEmpty.head (gleanDBs be))) $ do
+            wanted <- getFileContentHash sourceControl repo file wantedrev
+            mine <- getFileContentHash sourceControl repo file myrev
+            return $ (==) <$> wanted <*> mine
+              -- Nothing if either getContentHash failed
+
+    getFromGlean =
+      Glass.withAllocationLimit env $
+        fetchSymbolsAndAttributesGlean env dbInfo req opts be Nothing mlang
+
+xRefDataToRefEntitySymbol :: XRefData -> (Code.Entity, ReferenceRangeSymbolX)
+xRefDataToRefEntitySymbol XRefData{..} = (xrefEntity, xrefSymbol)
+
+-- Find all references and definitions in a file that might be in a set of repos
+fetchDocumentSymbols
+  :: Glean.Backend b
+  => Glass.Env
+  -> FileReference
+  -> Path  -- ^ original path in the repo
+  -> Maybe Int
+  -> Maybe Revision
+  -> Bool  -- ^ exact revision only?
+  -> Bool  -- ^ fetch file content hash?
+  -> ExtraSymbolOpts
+  -> GleanBackend b
+  -> Maybe Language
+  -> GleanDBInfo
+  -> AttributeOptions
+  -> IO (DocumentSymbols, QueryEachRepoLog, Maybe ErrorLogger)
+fetchDocumentSymbols env@Glass.Env{..} (FileReference scsrepo path)
+    repoPath mlimit wantedRevision exactRevision fetchContentHash extraOpts
+    b mlang dbInfo attrOpts = do
+  backendRunHaxl b env $ do
+    --
+    -- we pick the first db in the list that has the full FileInfo{..}
+    -- and in exact_revision mode the rev also has to match precisely
+    --
+    efile <- firstOrErrors $ do
+      repo <- Glean.haxlRepo
+      if not (revisionAcceptable repo)
+        then return $ Left $ GlassExceptionReason_exactRevisionNotAvailable $
+          revisionSpecifierError wantedRevision
+        else do
+          res <- getFileInfo repo path
+          return $ case res of
+            Left _ -> res
+            Right fi@FileInfo{..}
+              | not isIndexed -> Left $ GlassExceptionReason_notIndexedFile $
+                case indexFailure of
+                  Nothing -> "Not indexed: " <> gleanPath path
+                  Just Src.IndexFailure_key{..} -> Text.pack $
+                      show indexFailure_key_reason
+                      <> ": " <>
+                      show indexFailure_key_details
+              | otherwise -> Right fi
+
+    case efile of
+      Left err -> do
+        let logs = logError err <> logError (gleanDBs b)
+        return (emptyDocumentSymbols (revision b), FoundNone, Just logs)
+        where
+          -- Use first db's revision
+          revision GleanBackend {gleanDBs = ((_, repo) :| _)} =
+            getDBRevision (scmRevisions dbInfo) repo scsrepo
+
+      Right (FileInfo{..}, gleanDataLog) -> do
+
+        -- from Glean, fetch xrefs and defs in two batches
+        (xrefs, defns, truncated) <- withRepo fileRepo $
+          documentSymbolsForLanguage
+            mlimit mlang extraOpts
+            fileId
+        -- todo this could be done in Glean in a single pass
+        (kinds, _, merr) <- withRepo fileRepo $
+          documentSymbolKinds mlimit mlang fileId attrOpts
+
+        let revision = getDBRevision (scmRevisions dbInfo) fileRepo scsrepo
+        contentMatch <- case wantedRevision of
+          Nothing -> return Nothing
+          Just wanted
+            | wanted == revision -> return (Just True)
+            | fetchContentHash -> withRepo fileRepo $ do
+              let getHash = getFileContentHash sourceControl scsrepo repoPath
+              contentHash <- getHash revision
+              wantedHash <- getHash wanted
+              return $ (==) <$> contentHash <*> wantedHash
+                -- Nothing if either getContentHash failed
+            | otherwise ->
+              return Nothing
+
+        let xrefsPlain = [ (refloc, ent) | PlainXRef (refloc, ent) <- xrefs ]
+
+        refsPlain <- withRepo fileRepo $
+          mapM (toReferenceSymbolPlain scsrepo srcFile offsets) xrefsPlain
+
+        -- mark up symbols into normal format with static attributes
+
+        defs1 <- withRepo fileRepo $
+          mapM (toDefinitionSymbol scsrepo srcFile offsets) defns
+
+        xref_digests <- withRepo fileRepo $ do
+          let fileMap = xrefFileMap refsPlain
+          results <- fetchFileDigests (Map.size fileMap) (Map.keys fileMap)
+          toDigestMap fileMap results
+
+        let digest = toDigest <$> fileDigest
+
+        -- only handle XlangEntities with known entity
+        let unresolvedXrefsXlang = [ ref | XlangXRef ref <- xrefs ]
+
+        let (refs, defs, _) = Attributes.augmentSymbols
+              Attributes.SymbolKindAttr
+              kinds
+              (xRefDataToRefEntitySymbol <$> refsPlain)
+              defs1
+              attrOpts
+
+        return (DocumentSymbols {
+                 srcFile = Just srcFile,
+                 attributes = Nothing,
+                 ..
+                },
+                gleanDataLog, merr)
+
+  where
+    revisionAcceptable :: Glean.Repo -> Bool
+    revisionAcceptable = case wantedRevision of
+      Just rev | exactRevision -> \repo ->
+        getDBRevision (scmRevisions dbInfo) repo scsrepo == rev
+      _otherwise -> const True
+
+    -- We will lookup digests by file id, but return to the user a map by
+    -- glass path and scm repo
+    xrefFileMap :: [XRefData] -> Map.Map (Glean.IdOf Src.File) (RepoName, Path)
+    xrefFileMap xrefs = Map.fromList $ map (\XRefData{..} ->
+        (xrefFile,
+          let LocationRange{..} = referenceRangeSymbolX_target xrefSymbol
+          in (locationRange_repository, locationRange_filepath)
+      )) xrefs
+
+-- | Xlang xrefs needs db determination and range resolution
+--   possibly using a separate backend than the one computed
+--   from the origin query.
+--   Always choose latest db, as exactRevision can't usually be
+--   enforced for xlang refs
+resolveXlangXrefs
+  :: Glean.Backend b
+  => Glass.Env
+  -> Path
+  -> DocumentSymbols
+  -> RepoName
+  -> (b, GleanDBInfo)
+  -> Maybe Language
+  -> IO DocumentSymbols
+resolveXlangXrefs
+    env@Glass.Env{tracer, sourceControl, repoMapping}
+    path
+    docSyms@DocumentSymbols{..}
+    scsrepo
+    (gleanBackend, dbInfo)
+    sourceLang = do
+  case (unresolvedXrefsXlang, srcFile) of
+    ((_, xref) : _, Just srcFile) -> do
+       -- we assume all xlang xrefs belong to the same db
+       -- we pick the xlang dbs based on target lang and
+       -- repo. Corner case: the document is in a mirror repo,
+       -- use to origin repo to determine xlang db
+      let targetLang = targetLanguage xref sourceLang
+          targetRepo = case repoPathToMirror scsrepo path of
+              Just (Mirror _mirror _prefix origin) -> origin
+              Nothing -> scsrepo
+      gleanDBs <- getGleanRepos tracer sourceControl repoMapping dbInfo
+        targetRepo (Just targetLang) Nothing ChooseLatest Nothing
+      let gleanBe = GleanBackend {gleanDBs, tracer, gleanBackend}
+      let (ents, symbols) =
+            partitionEithers $ mapMaybe (mangle targetLang) unresolvedXrefsXlang
+      xlangRefs <- backendRunHaxl gleanBe env $ do
+        xrefsXlang <- join <$>
+          mapM (\gleanDB -> withRepo (snd gleanDB) $ do
+            xrefs <- resolveEntitiesRange targetRepo symbols ents
+            mapM
+              (toReferenceSymbolXlang targetRepo srcFile offsets targetLang)
+              xrefs)
+          (NonEmpty.toList gleanDBs)
+        return $ xRefDataToRefEntitySymbol <$> xrefsXlang
+      return $ docSyms  { refs = refs ++ xlangRefs, unresolvedXrefsXlang = [] }
+    _ -> return docSyms
+  where
+    targetLanguage xref mlang =
+      case xref of
+        Left (Code.IdlEntity _ _ ent _)  ->
+          maybe (Language__UNKNOWN 0) entityLanguage ent
+        Right _ ->
+          case mlang of
+            Just Language_Swift -> Language_Cpp
+            _ -> Language__UNKNOWN 0
+
+    mangle :: Language -> XlangXRef
+      -> Maybe (Either
+        (Code.Entity, Code.RangeSpan) (Code.SymbolId, Code.RangeSpan))
+    mangle targetLang (range, ref) = case ref of
+      Left (Code.IdlEntity _ _ mEnt _) ->
+        Left . (,range) <$> mEnt
+      Right symbol ->
+        Just $ Right $ (,range) $ translateSymbol sourceLang targetLang symbol
+
+    translateSymbol ::
+      Maybe Language -> Language -> Code.SymbolId -> Code.SymbolId
+    translateSymbol
+        (Just Language_Swift)
+        Language_Cpp
+        (Code.SymbolId_scip (Scip.Symbol _ (Just usr))) =
+      Code.SymbolId_cxx $ hashUSR usr
+    translateSymbol _ _ symId = symId
+
+-- | Wrapper for tracking symbol/entity pairs through processing
+data DocumentSymbols = DocumentSymbols
+  { refs :: [(Code.Entity, ReferenceRangeSymbolX)]
+  , defs :: [(Code.Entity, DefinitionSymbolX)]
+  , revision :: !Revision
+  , contentMatch :: Maybe Bool
+  , truncated :: !Bool
+  , digest :: Maybe FileDigest
+  , xref_digests :: Map.Map Text FileDigestMap
+  , unresolvedXrefsXlang :: [XlangXRef]
+  , srcFile :: Maybe Src.File
+  , offsets :: Maybe Range.LineOffsets
+  , attributes :: Maybe AttributeList
+  }
+
+emptyDocumentSymbols :: Revision -> DocumentSymbols
+emptyDocumentSymbols revision =
+  DocumentSymbols [] [] revision Nothing False Nothing mempty mempty Nothing
+    Nothing Nothing
+
+-- | Drop any remnant entities after we are done with them
+toDocumentSymbolResult :: DocumentSymbols -> DocumentSymbolListXResult
+toDocumentSymbolResult DocumentSymbols{..} = DocumentSymbolListXResult{..}
+  where
+    documentSymbolListXResult_references = map snd refs
+    documentSymbolListXResult_definitions = map snd defs
+    documentSymbolListXResult_revision = revision
+    documentSymbolListXResult_truncated = truncated
+    documentSymbolListXResult_digest = digest
+    documentSymbolListXResult_referenced_file_digests = xref_digests
+    documentSymbolListXResult_content_match = contentMatch
+    documentSymbolListXResult_attributes = attributes
+
+
+
+-- And build a line-indexed map of symbols, resolved to spans
+-- With extra attributes loaded from any associated attr db
+fetchDocumentSymbolIndex
+  :: (Glean.Backend b, SnapshotBackend snapshotBackend)
+  => Glass.Env
+  -> GleanDBInfo
+  -> DocumentSymbolsRequest
+  -> RequestOptions
+  -> GleanBackend b
+  -> snapshotBackend
+  -> Maybe Language
+  -> IO ((
+    DocumentSymbolIndex, SnapshotStatus,
+    QueryEachRepoLog, GleanGlassLogger),
+    Maybe ErrorLogger)
+fetchDocumentSymbolIndex env latest req opts be
+    snapshotbe mlang = do
+  ((DocumentSymbolListXResult{..}, status, gleanDataLog, attrLog), merr1) <-
+    fetchSymbolsAndAttributes env latest req opts be snapshotbe mlang
+
+  --  refs defs revision truncated digest = result
+  let lineIndex = toSymbolIndex documentSymbolListXResult_references
+        documentSymbolListXResult_definitions
+      totalSymCount = length documentSymbolListXResult_references +
+        length documentSymbolListXResult_definitions
+
+  let idxResult = DocumentSymbolIndex {
+        documentSymbolIndex_symbols = lineIndex,
+        documentSymbolIndex_revision = documentSymbolListXResult_revision,
+        documentSymbolIndex_size = fromIntegral totalSymCount,
+        documentSymbolIndex_truncated = documentSymbolListXResult_truncated,
+        documentSymbolIndex_digest = documentSymbolListXResult_digest,
+        documentSymbolIndex_referenced_file_digests =
+          documentSymbolListXResult_referenced_file_digests,
+        documentSymbolIndex_content_match =
+          documentSymbolListXResult_content_match,
+        documentSymbolIndex_attributes = documentSymbolListXResult_attributes
+      }
+  return ((idxResult, status, gleanDataLog, attrLog), merr1)
+
+-- | Same repo generic attributes
+documentSymbolKinds
+  :: Maybe Int
+  -> Maybe Language
+  -> Glean.IdOf Src.File
+  -> AttributeOptions
+  -> Glean.RepoHaxl u w
+     ([Attributes.AttrRep Attributes.SymbolKindAttr],
+     [Attributes.FileAttrRep Attributes.SymbolKindAttr],
+     Maybe ErrorLogger)
+
+-- It's not sound to key for all entities in file in C++ , due to traces
+-- So we can't use the generic a attribute technique
+documentSymbolKinds _mlimit (Just Language_Cpp) _fileId _ =
+  return mempty
+
+-- Anything else, just load from Glean
+documentSymbolKinds mlimit _ fileId attrOpts =
+  searchFileAttributes Attributes.SymbolKindAttr mlimit fileId attrOpts
+    NilSourceControl (RepoName "") (Path "") (Revision "")
+
+searchFileAttributes
+  :: (Attributes.ToAttributes key, SourceControl scm, Glean.HasRepo u)
+  => key
+  -> Maybe Int
+  -> Glean.IdOf Src.File
+  -> AttributeOptions
+  -> scm
+  -> RepoName
+  -> Path
+  -> Revision
+  -> Glean.RepoHaxl u w
+    ([Attributes.AttrRep key], [Attributes.FileAttrRep key], Maybe ErrorLogger)
+searchFileAttributes key mlimit fileId attrOpts sourceControl scsrepo repoPath revision = do
+  eraw_file <- (
+    if attributeOptions_fetch_per_line_data attrOpts then
+        searchFileAttributesMetadata key mlimit fileId attrOpts revision
+    else
+        mempty)
+
+  eraw <- try $ Attributes.queryForFile key mlimit fileId attrOpts
+    sourceControl scsrepo repoPath revision eraw_file
+  repo <- Glean.haxlRepo
+  case eraw of
+    Left (err::SomeException) -- logic errors or transient errors
+      -> return
+        (mempty, mempty,
+        Just (logError (GlassExceptionReason_attributesError $ textShow err)
+              <> logError repo))
+    Right raw
+      -> return (raw,eraw_file, Nothing)
+
+searchFileAttributesMetadata
+  :: Attributes.ToAttributes key
+  => key
+  -> Maybe Int
+  -> Glean.IdOf Src.File
+  -> AttributeOptions
+  -> Revision
+  -> Glean.RepoHaxl u w [Attributes.FileAttrRep key]
+searchFileAttributesMetadata key mlimit fileId attrOpts rev = do
+  eraw_file <-
+    try $ Attributes.queryMetadataForFile key mlimit fileId attrOpts rev
+  case eraw_file of
+    Left (_::SomeException) -> return mempty
+    Right raw -> return raw
+
+data XRefData = XRefData
+  { xrefEntity :: !Code.Entity
+  , xrefSymbol :: !ReferenceRangeSymbolX
+  , xrefFile :: {-# UNPACK #-}!(Glean.IdOf Src.File)
+  }
+
+-- | Convert an Xlang/Plain xref to a normal format
+--   (includes attribute, source/target spans, symbol id)
+toReferenceSymbolGen
+  :: RepoName
+  -> Src.File
+  -> Maybe Range.LineOffsets
+  -> Code.RangeSpan
+  -> Src.File
+  -> Code.Entity
+  -> LocationRange
+  -> Maybe Src.FileLocation
+  -> Maybe Language
+  -> Glean.RepoHaxl u w XRefData
+toReferenceSymbolGen repoName file srcOffsets rangeSpanSrc xrefFile xrefEntity
+  xrefRange mDestination mLang = do
+  path <- GleanPath <$> Glean.keyOf file
+  sym <- toSymbolId (fromGleanPath repoName path) xrefEntity
+  attributes <- getStaticAttributes xrefEntity repoName sym mLang
+  (target, xrefFile) <- case mDestination of
+    -- if we have a best identifier location
+    Just (Src.FileLocation fileLocation_file fileLocation_span) -> do
+      let rangeSpan = Code.RangeSpan_span fileLocation_span
+      t <- rangeSpanToLocationRange repoName fileLocation_file rangeSpan
+      return (t, Glean.getId fileLocation_file)
+    _ -> do
+      return (xrefRange, Glean.getId xrefFile)
+  -- resolved the local span to a location
+  let range = rangeSpanToRange srcOffsets rangeSpanSrc
+      xrefSymbol = ReferenceRangeSymbolX sym range target attributes
+  return $ XRefData xrefEntity xrefSymbol xrefFile
+
+-- | Convert plain entity to normal format
+--   adapter to toReferenceSymbolGen
+toReferenceSymbolPlain
+  :: RepoName
+  -> Src.File
+  -> Maybe Range.LineOffsets
+  -> XRef
+  -> Glean.RepoHaxl u w XRefData
+toReferenceSymbolPlain
+  repoName file srcOffsets (Code.XRefLocation{..}, xrefEntity) = do
+    -- reference target is a Declaration and an Entity
+    let Code.Location{..} = xRefLocation_target
+    xrefRange <- rangeSpanToLocationRange repoName location_file
+      location_location
+    toReferenceSymbolGen repoName file srcOffsets xRefLocation_source
+      location_file xrefEntity xrefRange location_destination Nothing
+
+-- | Convert xlang entity to normal format
+--   adapter to toReferenceSymbolGen
+toReferenceSymbolXlang
+  :: RepoName
+  -> Src.File
+  -> Maybe Range.LineOffsets
+  -> Language
+  -> ((Code.Entity, Code.RangeSpan), (Src.File, LocationRange))
+  -> Glean.RepoHaxl u w XRefData
+toReferenceSymbolXlang
+  repoName file srcOffsets lang
+  ((xrefEntity, rangeSpanSrc), (xlangFile, xrefRange)) = do
+    toReferenceSymbolGen repoName file srcOffsets rangeSpanSrc xlangFile
+      xrefEntity xrefRange Nothing (Just lang)
+
+-- | Building a resolved definition symbol is just taking a direct xref to it,
+-- and converting the bytespan, adding any static attributes
+toDefinitionSymbol
+  :: RepoName
+  -> Src.File
+  -> Maybe Range.LineOffsets
+  -> (Code.Location, Code.Entity)
+  -> Glean.RepoHaxl u w (Code.Entity, DefinitionSymbolX)
+toDefinitionSymbol repoName file offsets (Code.Location {..}, entity) = do
+  path <- GleanPath <$> Glean.keyOf file
+  let symbolRepoPath@(SymbolRepoPath symbolRepo symbolPath) =
+        fromGleanPath repoName path
+  sym <- toSymbolId symbolRepoPath entity
+  attributes <- getStaticAttributes entity repoName sym Nothing
+  destination <- forM location_destination $ \Src.FileLocation{..} ->
+    let rangeSpan = Code.RangeSpan_span fileLocation_span in
+    rangeSpanToLocationRange repoName fileLocation_file rangeSpan
+
+  -- full entity range (i.e. body of the method + signature)
+  let range = rangeSpanToRange offsets location_location
+  -- entity name/identifying location range (the name token for go-to-def)
+  let nameRange = case destination of
+        Just LocationRange{..} | symbolRepo == locationRange_repository &&
+                                 symbolPath == locationRange_filepath
+          -> Just locationRange_range
+        _ -> Nothing
+
+  return $ (entity,) $ DefinitionSymbolX sym range nameRange attributes
+
+-- | Decorate an entity with 'static' attributes.
+-- These are static in that they are derivable from the entity and
+-- schema information alone, without additional repos.
+-- They're expected to be cheap, as we call these once per entity in a file
+getStaticAttributes
+  :: Code.Entity
+  -> RepoName
+  -> SymbolId
+  -> Maybe Language  -- Xlang language
+  -> Glean.RepoHaxl u w AttributeList
+getStaticAttributes e repo sym mLang = memo $ do
+  mLocalName <- toSymbolLocalName e
+  mParent <- toSymbolQualifiedContainer e -- the "parent" of the symbol
+  (mSignature, _xrefs) <- toSymbolSignatureText e repo sym Cxx.Unqualified
+  mKind <- entityKind e -- optional glass-side symbol kind labels
+  return $ AttributeList $ map (\(a,b) -> KeyedAttribute a b) $ catMaybes
+    [ asLocalName <$> mLocalName
+    , asParentAttr <$> mParent
+    , asSignature  <$> mSignature
+    , asKind <$> mKind
+    , Just $ asLanguage (entityLanguage e)
+    , asDefinitionType <$> entityDefinitionType e
+    , asLang =<< mLang
+    ]
+  where
+    asLocalName (Name local) = ("symbolName", Attribute_aString local)
+    asParentAttr (Name x) = ("symbolParent", Attribute_aString x)
+    asSignature sig = ("symbolSignature", Attribute_aString sig)
+    asKind kind = ("symbolKind",
+      Attribute_aInteger (fromIntegral $ fromThriftEnum kind))
+    asLanguage lang = ("symbolLanguage",
+      Attribute_aInteger (fromIntegral $ fromThriftEnum lang))
+    asDefinitionType kind = ("symbolDefinitionType",
+      Attribute_aInteger (fromIntegral $ fromThriftEnum kind))
+    asLang Language_Thrift = Just ("crossLanguage",
+      Attribute_aString "thrift")
+    asLang Language_Python = Just ("crossLanguage",
+      Attribute_aString "python")
+    asLang _ = Nothing
+
+    -- memoizing getStaticAttributes can save a lot of work because a
+    -- symbol reference often occurs multiple times in a file.
+    memo act
+      | memoizable e = do
+        gleanRepo <- Glean.haxlRepo
+        Haxl.memo (GetStaticAttributes (gleanRepo, prune e, mLang)) act
+      | otherwise = act
+
+    -- languages that support Prune
+    memoizable Code.Entity_cxx{} = True
+    memoizable Code.Entity_hack{} = True
+    memoizable Code.Entity_python{} = True
+    memoizable _ = False
+
+newtype GetStaticAttributes =
+  GetStaticAttributes (Glean.Repo, Code.Entity, Maybe Language)
+  deriving (Eq, Hashable)
+
+-- -----------------------------------------------------------------------------
+-- Attributes
+
+
+--
+-- | Check if this db / lang pair has additional dynamic attributes
+-- and add them if so
+--
+addDynamicAttributes
+  :: Glean.Backend b
+  => Glass.Env
+  -> GleanDBInfo
+  -> RepoName
+  -> RequestOptions
+  -> FileReference
+  -> Maybe Int
+  -> GleanBackend b
+  -> DocumentSymbols
+  -> IO (DocumentSymbols, GleanGlassLogger)
+addDynamicAttributes env dbInfo repo opts repofile mlimit be syms = do
+  -- combine additional dynamic attributes
+  (mattrs, fattrs) <-
+   getSymbolAttributes env dbInfo repo opts repofile mlimit be (revision syms)
+  return $ extend mattrs [] [] syms fattrs
+  where
+    extend [] log dblog syms _ = (syms, logResult log <> logResult dblog)
+    extend (augment : xs) log dblog syms [] =
+     extend xs newLog newDBLog
+       (syms { refs = refs' , defs = defs', attributes =  Nothing }) []
+      where
+      (refs',defs',log', dblog') = augment (refs syms) (defs syms)
+      newLog = log' : log
+      newDBLog = dblog' : dblog
+    extend (augment : xs) log dblog syms f =
+      extend xs newLog newDBLog
+       (syms { refs = refs' , defs = defs', attributes = flattenAttrs }) f
+      where
+      (refs',defs',log', dblog') = augment (refs syms) (defs syms)
+
+      flattenAttrs :: Maybe AttributeList
+      flattenAttrs = mconcat f
+      newLog = log' : log
+      newDBLog = dblog' : dblog
+
+type Augment =
+   [Attributes.RefEntitySymbol] ->
+   [Attributes.DefEntitySymbol] ->
+   ([Attributes.RefEntitySymbol],
+    [Attributes.DefEntitySymbol],
+    AttrStatsLog, AttrDBsLog)
+
+-- Work out if we have extra attribute dbs and then run the queries
+getSymbolAttributes
+  :: Glean.Backend b
+  => Glass.Env
+  -> GleanDBInfo
+  -> RepoName
+  -> RequestOptions
+  -> FileReference
+  -> Maybe Int
+  -> GleanBackend b
+  -> Revision
+  -> IO ([Augment], [Maybe AttributeList])
+getSymbolAttributes env dbInfo repo opts repofile mlimit
+    be@GleanBackend{..} revision = do
+  mAttrDBs <-
+    getLatestAttrDBs tracer (sourceControl env) (Glass.repoMapping env)
+      dbInfo repo
+  backendRunHaxl be env $ do
+    attrsTuples <- forM mAttrDBs $
+      \(attrDB, GleanDBAttrName _ attrKey{- existential key -}) ->
+        withRepo attrDB $ do
+          (attrs,fileAttrs,_merr2) <- genericFetchFileAttributes
+            attrKey
+            (theGleanPath repofile)
+            mlimit
+            (requestOptions_attribute_opts opts)
+            (sourceControl env)
+            (_repoName repofile)
+            (symbolPath (fromGleanPath (_repoName repofile) (theGleanPath repofile)))
+            (fromMaybe revision (requestOptions_revision opts))
+
+          let augment refs defs = case Attributes.augmentSymbols
+                attrKey attrs refs defs (requestOptions_attribute_opts opts) of
+                 (refs, defs, log) ->
+                  (refs, defs, AttrStatsLog $ TL.toStrict $ encodeToLazyText $ Attributes.toLogText log, AttrDBsLog attrDB)
+
+          let fileAttributes = case fileAttrs of
+               [] -> Nothing
+               f -> Attributes.fileAttrsToAttributeList attrKey f
+
+          return (augment, fileAttributes)
+
+    let (augments, fileAttrs) = unzip attrsTuples
+    return (augments, fileAttrs)
+
+
+-- | External (non-local db) Attributes of symbols. Just Hack only for now
+genericFetchFileAttributes
+  :: (Attributes.ToAttributes key, SourceControl scm, Glean.HasRepo u)
+  => key
+  -> GleanPath
+  -> Maybe Int
+  -> AttributeOptions
+  -> scm
+  -> RepoName
+  -> Path
+  -> Revision
+  -> RepoHaxl u w (
+     [Attributes.AttrRep key],
+     [Attributes.FileAttrRep key],
+     Maybe ErrorLogger)
+genericFetchFileAttributes key path mlimit attrOpts sourceControl scsrepo repoPath revision = do
+  efile <- getFile path
+  repo <- Glean.haxlRepo
+  case efile of
+    Left err ->
+      return (mempty, mempty, Just (logError err <> logError repo))
+    Right fileId -> do searchFileAttributes
+                        key mlimit (Glean.getId fileId) attrOpts sourceControl scsrepo repoPath revision
diff --git a/glean/glass/Glean/Glass/Handler/Symbols.hs b/glean/glass/Glean/Glass/Handler/Symbols.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Handler/Symbols.hs
@@ -0,0 +1,945 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Handler.Symbols
+  (
+  -- ** find references
+   findReferenceRanges
+
+  -- * working with symbol ids
+  , symbolLocation
+  , describeSymbol
+  , resolveSymbols
+
+  -- * searching by string
+  , searchSymbol
+
+  -- ** by relationship
+  , searchRelated
+
+  -- ** a large report of all information we know about a symbol
+  , searchRelatedNeighborhood
+
+  ) where
+
+import Control.Monad
+import Control.Exception ( throwIO )
+import Control.Monad.Catch ( throwM )
+import Data.Bifunctor (second)
+import Data.Either.Extra (eitherToMaybe)
+import Data.Hashable
+import Data.List as List ( sortOn )
+import Data.List.Extra ( nubOrd, nubOrdOn, groupOn, groupSortOn )
+import Data.List.NonEmpty (NonEmpty(..), nonEmpty)
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.Maybe
+import Data.Ord ( comparing )
+import Data.Text ( Text )
+import qualified Data.Set as Set
+import Data.Set ( Set )
+import qualified Control.Concurrent.Async as Async
+import qualified Data.Map.Strict as Map
+import qualified Data.Text as Text
+
+import Util.List ( uniq, uniqBy )
+
+
+import Glean.Angle as Angle ( Angle )
+import qualified Glean
+import Glean.Haxl as Glean ( keyOf, haxlRepo )
+import Glean.Haxl.Repos as Glean
+
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+
+import Glean.Glass.Base (GleanPath(GleanPath))
+import Glean.Glass.Describe
+  ( mkSymbolDescription
+  , describeEntity
+  , mkBriefSymbolDescription
+  )
+import Glean.Glass.Handler.Utils
+import Glean.Glass.Logging
+import Glean.Glass.Repos
+import Glean.Glass.Path ( fromGleanPath )
+import Glean.Glass.Range
+import Glean.Glass.SymbolId
+import Glean.Glass.Types
+import Glean.Glass.RepoMapping (
+   supportsCxxDeclarationSources
+  )
+import Glean.Glass.Search.Class ( ResultLocation )
+import qualified Glean.Glass.Env as Glass
+import qualified Glean.Glass.Query as Query
+import Glean.Glass.NameSearch (
+    SearchCase(..), SearchType(..),
+    SearchScope(..), SearchMode(..),
+    SearchQuery(..), SingleSymbol, FeelingLuckyResult(..),
+    QueryExpr(..), RepoSearchResult, SymbolSearchData(..),
+    toSearchResult, ToSearchResult(..), AngleSearch(..), srEntity,
+    buildLuckyContainerQuery, buildSearchQuery, dedupSearchResult
+  )
+import Glean.Glass.XRefs ( GenXRef(..) )
+import Glean.Glass.Search as Search
+    ( CodeEntityLocation(..),
+      SearchEntity(..),
+      SearchResult(Many, None, One, rest, message, initial),
+      searchEntity,
+      searchEntityLocation )
+import Glean.Glass.Utils
+import Glean.Glass.Attributes.SymbolKind
+    ( symbolKindToSymbolKind, symbolKindFromSymbolKind )
+import qualified Glean.Glass.SearchRelated as Search
+import Glean.Glass.SearchRelated
+    ( RelatedLocatedEntities(childRL, parentRL),
+      Recursive(NotRecursive) )
+import Glean.Glass.Neighborhood ( searchNeighborhood )
+import qualified Glean.Glass.Handler.Utils as Utils
+
+import Glean.Glass.SymbolKind (findSymbolKind)
+import Glean.Glass.Env (Env' (tracer, sourceControl, useSnapshotsForSymbolsList))
+
+-- | Symbol-based find-references.
+findReferenceRanges
+  :: Glass.Env -> SymbolId -> RequestOptions -> IO [LocationRange]
+findReferenceRanges env@Glass.Env{..} sym opts@RequestOptions{..} =
+  withSymbol "findReferenceRanges" env opts sym
+    $ \gleanDBs _dbInfo (repo, lang, toks) ->
+      fetchSymbolReferenceRanges env repo lang toks limit
+        GleanBackend{..}
+  where
+    limit = fmap fromIntegral requestOptions_limit
+
+-- | Resolve a symbol identifier to its range-based location in the latest db
+-- This is about 10x cheaper than a full describeSymbol() call
+symbolLocation :: Glass.Env -> SymbolId -> RequestOptions -> IO SymbolLocation
+symbolLocation env@Glass.Env{..} sym opts =
+  withSymbol "symbolLocation" env opts sym $
+    \gleanDBs dbInfo (scmRepo, lang, toks) ->
+      backendRunHaxl GleanBackend{..} env $ do
+        r <- Search.searchEntityLocation lang toks
+        (entity, err) <- case r of
+          None t -> throwM (ServerException t)
+          One e -> return (e, Nothing)
+          Many { initial = e, message = t } ->
+            return
+              (e, Just (GlassExceptionReason_entitySearchFail t))
+        let SearchEntity { entityRepo, decl = (_,file,rangespan,_) } = entity
+        let scmRevs = scmRevisions dbInfo
+        (, fmap logError err) <$> withRepo entityRepo (do
+          location <- rangeSpanToLocationRange scmRepo file rangespan
+          repo_hash <- getRepoHashForLocation location scmRevs <$> Glean.haxlRepo
+          return $ SymbolLocation {
+            symbolLocation_location = location,
+            symbolLocation_revision = repo_hash
+          })
+
+-- | Describe characteristics of a symbol
+describeSymbol
+  :: Glass.Env -> SymbolId -> RequestOptions
+  -> IO SymbolDescription
+describeSymbol env@Glass.Env{..} symId opts =
+  withSymbol "describeSymbol" env opts symId $
+    \gleanDBs dbInfo (scmRepo, lang, toks) ->
+      backendRunHaxl GleanBackend{..} env $ do
+        r <- Search.searchEntityLocation lang toks
+        (first :| rest, err) <- case r of
+          None t -> throwM (ServerException t)
+          One e -> return (e :| [], Nothing)
+          Many { initial = e, rest = es } -> return (e :| es, Nothing) -- log?
+        let scmRevs = scmRevisions dbInfo
+        desc0 <- withRepo (entityRepo first) $ mkSymbolDescription symId scmRevs
+                  scmRepo (toCodeEntityLoc first) Nothing
+        -- now combine with up to N additional results, possibly across repos
+        -- we have e.g. Optional across fbsource.arvr and fbsource.*
+        -- but typical case is Hack namespaces
+        descN <- forM rest $ \this -> withRepo (entityRepo this) $
+            mkSymbolDescription symId scmRevs
+              scmRepo (toCodeEntityLoc this) Nothing
+        let !desc = foldr combineDescriptions desc0 descN
+        pure (desc, err)
+
+resolveSymbols
+  :: Glass.Env
+  -> ResolveSymbolsRequest
+  -> RequestOptions
+  -> IO ResolveSymbolsResult
+resolveSymbols env@Glass.Env{..} (ResolveSymbolsRequest symIds) opts = do
+  results <- forM symIds $ \symId -> do
+    -- Try to resolve the symbol, returning any error encountered
+    (resolutions, err) <- withSymbol "resolveSymbols" env opts symId $
+      \gleanDBs dbInfo (scmRepo, lang, toks) ->
+      backendRunHaxl GleanBackend{..} env $ do
+        r <- Search.searchEntityLocation lang toks
+        (entities, err) <- case r of
+          None t ->
+            return ([], Just $ SymbolResolutionFailure symId
+              (GlassExceptionReason_entitySearchFail t))
+          One e -> return ([e], Nothing)
+          Many{initial = e, rest = es} -> return (e : es, Nothing)
+        let scmRevs = scmRevisions dbInfo
+        resolutions <- forM entities $ \this ->
+          let SearchEntity
+                { entityRepo
+                , decl = (_entity, file, rangespan, _text)
+                } = this
+            in withRepo entityRepo $ do
+                location <- rangeSpanToLocationRange scmRepo file rangespan
+                repoHash <-
+                  getRepoHashForLocation location scmRevs <$> Glean.haxlRepo
+                SymbolBasicDescription{..} <-
+                  mkBriefSymbolDescription
+                    symId
+                    scmRevs
+                    scmRepo
+                    (toCodeEntityLoc this)
+                    Nothing
+                pure SymbolResolution
+                  { symbolResolution_qname = symbolBasicDescription_name
+                  , symbolResolution_location = location
+                  , symbolResolution_revision = repoHash
+                  , symbolResolution_kind = symbolBasicDescription_kind
+                  , symbolResolution_language = symbolBasicDescription_language
+                  , symbolResolution_signature = symbolBasicDescription_signature
+                  }
+        pure ((resolutions, err), Nothing)
+    pure (ResolvedSymbol symId resolutions err)
+
+  return $ ResolveSymbolsResult results
+
+
+toCodeEntityLoc ::
+  SearchEntity (ResultLocation Code.Entity) -> CodeEntityLocation
+toCodeEntityLoc SearchEntity{decl = (decl, file, rangespan, name)} =
+  CodeEntityLocation decl file rangespan name
+
+-- | Given a description for a symbol, fold in extra comments, annotations
+-- and locations from zero or more additional occurences of the same symbol
+-- Should only be necessary for rare non-unique symbols, like Hack namespaces
+--
+combineDescriptions
+  :: SymbolDescription -> SymbolDescription -> SymbolDescription
+combineDescriptions y x =
+  x { symbolDescription_annotations = symbolDescription_annotations x <>
+        symbolDescription_annotations y -- <> Maybe [a]
+    , symbolDescription_pretty_comments = uniq $
+        symbolDescription_pretty_comments x <>
+        symbolDescription_pretty_comments y
+    , symbolDescription_sym_other_locations =
+        filter (/= symbolDescription_sym_location x) $
+          uniq ( -- collapse duplicate syms
+            symbolDescription_sym_location y : -- copy the single unique value
+            symbolDescription_sym_other_locations x
+          )
+    }
+
+-- | Search for entities by string name with kind and language filters
+searchSymbol
+  :: Glass.Env
+  -> SymbolSearchRequest
+  -> RequestOptions
+  -> IO SymbolSearchResult
+searchSymbol
+    env@Glass.Env{..}
+    req@SymbolSearchRequest{..}
+    opts@RequestOptions{..} = do
+  case selectGleanDBs repoMapping scmRepo languageSet of
+    Left err -> throwIO $ ServerException err
+    Right rs -> case sFeelingLucky of
+      Normal -> joinSearchResults mlimit terse sorted <$>
+        Async.mapConcurrently
+          (continueOnErrors. uncurry searchSymbolsIn)
+          (Map.toList rs)
+      -- lucky mode is quite different, as it has to make priority choices
+      FeelingLucky -> joinLuckyResults <$>
+        Async.mapConcurrently
+          (continueOnErrors . uncurry searchLuckySymbolsIn)
+          (Map.toList rs)
+  where
+    continueOnErrors = fmap fst -- TODO support strict errors
+    scmRepo = symbolSearchRequest_repo_name
+    languageSet = symbolSearchRequest_language
+    SymbolSearchOptions{..} = symbolSearchRequest_options
+    terse = not symbolSearchOptions_detailedResults
+    sorted = symbolSearchOptions_sortResults
+    mlimit = fromIntegral <$> requestOptions_limit
+    -- inner limit can be higher if we are sampling/sorting into kind/lang sets
+    mlimitInner = if sorted then fmap (*5) mlimit else mlimit
+
+    sCase = if symbolSearchOptions_ignoreCase then Insensitive else Sensitive
+    sType = if symbolSearchOptions_exactMatch then Exact else Prefix
+    sScope = if symbolSearchOptions_namespaceSearch then Scope else NoScope
+    sString = Text.strip symbolSearchRequest_name -- drop leading whitespace
+    sKinds = map symbolKindFromSymbolKind (Set.elems symbolSearchRequest_kinds)
+    sLangs = languageExpandCpp $ mapMaybe languageToCodeLang
+      (Set.elems languageSet)
+    sFeelingLucky =
+      if symbolSearchOptions_feelingLucky then FeelingLucky else Normal
+    querySpec = SearchQuery{..}
+    searchQs = buildSearchQuery sFeelingLucky querySpec
+
+    -- run the same query across more than one glean db
+    searchSymbolsIn
+      :: RepoName
+      -> Set GleanDBName
+      -> IO (RepoSearchResult, Maybe ErrorLogger)
+    searchSymbolsIn repo dbs = Glass.withAllocationLimit env $
+      case nonEmpty (Set.toList dbs) of
+        Nothing -> pure ([], Nothing)
+        Just names ->
+          withGleanDBs "searchSymbol" env opts req repo names $
+            \gleanDBs dbInfo -> do
+              res <- backendRunHaxl GleanBackend{..} env $
+                Glean.queryAllRepos $ do
+                  let scmRevs = scmRevisions dbInfo
+                  res <- mapM (runSearch querySpec
+                                repo scmRevs mlimitInner terse sString) searchQs
+                  return (nubOrd (concat res))
+                  -- remove latter duplicates in n*log n
+              pure (res, Nothing)
+
+    -- In lucky mode, we avoid flattening, instead selecting from the first
+    -- unique result found in priority order. We don't de-dup as we go.
+    searchLuckySymbolsIn
+      :: RepoName -> Set GleanDBName -> IO (FeelingLuckyResult, Maybe ErrorLogger)
+    searchLuckySymbolsIn repo dbs = case nonEmpty (Set.toList dbs) of
+      Nothing -> pure (FeelingLuckyResult [], Nothing)
+      Just names ->
+        withGleanDBs "feelingLucky" env opts req repo names $
+          \gleanDBs dbInfo -> do
+            res <- backendRunHaxl GleanBackend{..} env $
+              Glean.queryEachRepo $ do
+                -- we can conveniently limit to 2 matches per inner search
+                let scmRevs = scmRevisions dbInfo
+                rs <- forM searchQs $
+                  runSearch querySpec repo scmRevs (Just 2) terse sString
+                return (map (nubOrdOn symbolIdOrder) rs)
+            pure (FeelingLuckyResult res, Nothing)
+
+-- cheap way to fix up entities with non-unique locations: uniq on symbol id
+symbolIdOrder :: (SymbolResult, a) -> SymbolId
+symbolIdOrder = symbolResult_symbol . fst
+
+-- Run a specific Query.AngleSearch query, with optional time boxing
+runSearch
+  :: SearchQuery
+  -> RepoName
+  -> ScmRevisions
+  -> Maybe Int
+  -> Bool
+  -> Text
+  -> AngleSearch
+  -> RepoHaxl u w [(SymbolResult, Maybe SymbolDescription)]
+runSearch querySpec repo scmRevs mlimit terse sString (Search query) = do
+  (ctx,names) <- case query of
+    Complete q -> (Nothing,) <$> searchWithTimeLimit mlimit queryTimeLimit q
+    InheritedScope sCase term searchFn -> do
+      names <- luckyParentSearch queryTimeLimit querySpec term
+      case names of
+        (_,[]) -> pure (Nothing,[])
+        (baseEntity,parentNames) -> do
+          syms <- searchWithTimeLimit mlimit queryTimeLimit
+                   (searchFn sCase parentNames)
+          return (baseEntity, syms)
+  mapM (processSymbolResult terse sString repo scmRevs ctx) names
+  where
+    queryTimeLimit = 5000 -- milliseconds, make this a flag?
+
+-- | Do a lucky search for the parent entity and return it. It will anchor
+-- our later search, and we can generate a link to it later.
+luckyParentSearch
+  :: Int
+  -> SearchQuery
+  -> NonEmpty Text
+  -> RepoHaxl u w (Maybe SymbolSearchData, [NonEmpty Text])
+luckyParentSearch queryTimeLimit querySpec term = do
+    parentSet <- mapM (runLuckyParentSearch queryTimeLimit) parentQs
+    case findUnique parentSet of
+      Found baseEntity -> do -- this is the anchor container, now search parents
+        parents <- uniq . map Search.parentEntity <$>
+          Search.searchRecursiveEntities maxInheritedDepth
+            RelationDirection_Parent RelationType_Extends
+              (srEntity baseEntity)
+        xs <- forM parents $ fmap flattenScope . eThrow <=< toQualifiedName
+        return (Just baseEntity, xs)
+      _ -> pure (Nothing, []) -- not sufficiently unique. can't proceed
+  where
+    parentQs = buildLuckyContainerQuery querySpec term
+    maxInheritedDepth = 1000
+
+    -- this isn't the full scope (i.e. nested container parents) , but 2 levels
+    flattenScope qn = case unName (qualifiedName_container qn) of
+      "" -> unName (qualifiedName_localName qn) :| []
+      parent -> parent :| [unName (qualifiedName_localName qn)]
+
+runLuckyParentSearch :: Int -> AngleSearch -> RepoHaxl u w [SymbolSearchData]
+runLuckyParentSearch timeLimit (Search query) = do
+  result <- case query of
+    Complete q -> searchWithTimeLimit (Just 2) timeLimit q
+    InheritedScope{} -> return [] -- no inner recursion please
+  mapM toSearchResult result
+
+-- n.b. we need the RepoName (i.e. "fbsource" to construct symbol ids)
+processSymbolResult
+  :: ToSearchResult a
+  => Bool
+  -> Text
+  -> RepoName
+  -> ScmRevisions
+  -> Maybe SymbolSearchData
+  -> a
+  -> RepoHaxl u w (SymbolResult, Maybe SymbolDescription)
+processSymbolResult terse sString repo scmRevs mContext result = do
+  SymbolSearchData{..} <- toSearchResult result
+  let Code.Location{..} = srLocation
+  symbolResult_location <- rangeSpanToLocationRange
+    repo location_file location_location
+  path <- GleanPath <$> Glean.keyOf location_file
+  symbolResult_symbol <- toSymbolId (fromGleanPath repo path) srEntity
+  symbolResult_qname <- eThrow =<< toQualifiedName srEntity
+  let symbolResult_kind = symbolKindToSymbolKind <$> srKind
+  symbolResult_context <- case mContext of
+    Just ctx -> Just <$> processContext repo ctx
+    Nothing -> case symbolResult_kind of
+      Just kind
+        | kind `Set.member` atomicKinds -- use parent container
+        -> parentContainer repo srEntity
+      _ -> pure Nothing
+  let symbolResult_language = entityLanguage srEntity
+      symbolResult_name = location_name
+      symbolResult_score = Map.singleton
+        "exactness"
+        (fromIntegral (fromEnum
+            (scoreResult sString location_name)))
+      basics = SymbolResult{..} -- just sym id, kind, lang, location
+  (basics,) <$>
+    if terse then pure Nothing else
+      Just <$> describeEntity scmRevs srEntity basics
+
+-- | Leaf kinds, those that don't contain other symbols. We will try to
+-- put in parent context
+atomicKinds :: Set SymbolKind
+atomicKinds = Set.fromList
+  [ SymbolKind_Method
+  , SymbolKind_Field
+  , SymbolKind_Constant
+  , SymbolKind_Type
+  , SymbolKind_Value
+  , SymbolKind_Function
+  , SymbolKind_Variable
+  , SymbolKind_Enumerator
+  , SymbolKind_Operator
+  ]
+
+-- | A little bit of processing for the related symbol context
+processContext
+  :: RepoName -> SymbolSearchData -> Glean.RepoHaxl u w SymbolContext
+processContext repo SymbolSearchData{..} = do
+  let Code.Location{..} = srLocation
+  path <- GleanPath <$> Glean.keyOf location_file
+  symbolContext_symbol <- toSymbolId (fromGleanPath repo path) srEntity
+  symbolContext_qname <- eThrow =<< toQualifiedName srEntity
+  let symbolContext_kind = symbolKindToSymbolKind <$> srKind
+  return SymbolContext{..}
+
+-- this takes first N results. We could try other strategies (such as
+-- selecting evenly by language, first n in alpha order by sym or file, ..
+--
+-- This is also where we sort the groups (kinds) so that the top N
+-- search results appear sampled and ranked.
+--
+joinSearchResults
+  :: Maybe Int
+  -> Bool
+  -> Bool
+  -> [RepoSearchResult]
+  -> SymbolSearchResult
+joinSearchResults mlimit terse sorted xs = SymbolSearchResult syms $
+    if terse then [] else catMaybes descs
+  where
+    uniqXs = dedupSearchResult <$> xs
+    (syms,descs) = unzip $ nubOrd $ case (mlimit, sorted) of
+      (Nothing, _) -> flattened
+      (Just n, False) -> take n flattened
+      -- codehub/aka "sorted" mode grouping, ranking and sampling
+      (Just n, True) -> takeFairN n (concatMap sortResults uniqXs)
+
+    flattened = concat uniqXs
+
+--
+-- DFS to first singleton result.
+--
+-- Search matrix for feeling lucky
+-- - scm repo
+-- - dbs within repo
+-- - queries in order within db
+--
+-- Second result will be the anchor container if it was an inherited search
+--
+joinLuckyResults :: [FeelingLuckyResult] -> SymbolSearchResult
+joinLuckyResults allResults = case findLucky allResults of
+    Nothing -> SymbolSearchResult [] []
+    Just (result, desc) -> SymbolSearchResult [result] (catMaybes [desc])
+  where
+    -- little state machine across logical scm repos (e.g. "fbsource")
+    findLucky :: [FeelingLuckyResult] -> Maybe SingleSymbol
+    findLucky [] = Nothing
+    findLucky (FeelingLuckyResult scmRepo : rest) =
+      case findUniqueInner scmRepo of
+        Continue -> findLucky rest
+        Stop -> Nothing
+        Found result -> Just result
+
+    -- across a particular scm repo's glean dbs (e.g. arvr.cxx, fbcode.cxx)
+    findUniqueInner :: [[[a]]] -> MaybeResult a
+    findUniqueInner [] = Continue
+    findUniqueInner (db : dbs) = case findUnique db of
+      Continue -> findUniqueInner dbs
+      Stop -> Stop -- could try to be smart and merge duplicates
+      Found x -> Found x
+
+-- results across each underlying glean query.
+-- if we see a unique result that's our winner
+findUnique :: [[a]] -> MaybeResult a
+findUnique [] = Continue
+findUnique (q : qs) = case hasUniqueResult q of
+  Continue -> findUnique qs -- continue in priority order
+  Stop -> Stop -- can't proceed
+  Found x -> Found x -- got it!
+
+hasUniqueResult :: [a] -> MaybeResult a
+hasUniqueResult results = case results of
+  [] -> Continue
+  [unique] -> Found unique
+  _ -> Stop -- more than 1 result, terminate
+
+data MaybeResult a
+  = Continue -- so far, no results, keep going
+  | Found a -- one perfect result
+  | Stop -- yikes, too many results. abandon ship
+
+-- | Sort the results of one query set
+sortResults
+  :: RepoSearchResult
+  -> [[(SymbolResult, Maybe SymbolDescription)]]
+sortResults xs = map (List.sortOn relevance) (groupSortOn features xs)
+  where
+    -- we group on the language/kind sets to produce result sets
+    -- then sort those results by score and alpha (note: not groupSortOn with
+    -- relevance as that would create too many classes to select from)
+    features (SymbolResult{..},_desc) = Feature
+      symbolResult_language (scoreKind symbolResult_kind)
+
+  -- we could improve this slightly with a qualified vs global qname check
+    relevance (SymbolResult{..},_desc) =
+      ( symbolResult_score
+      , scoreKind symbolResult_kind
+      , scoreScope symbolResult_qname
+      , symbolResult_name
+      , qualifiedName_container symbolResult_qname)
+
+-- Match feelingLuck() server-side classes
+containerishKinds :: Set SymbolKind
+containerishKinds = Set.fromList
+  [ SymbolKind_Namespace
+  , SymbolKind_Class_
+  , SymbolKind_Trait
+  , SymbolKind_Interface
+  , SymbolKind_Module
+  ]
+
+scoreScope :: QualifiedName -> Int
+scoreScope qname = case qualifiedName_container qname of
+  Name "" -> 0 -- free or global things have empty container names
+  _ -> 1
+
+scoreKind :: Maybe SymbolKind -> Int
+scoreKind kind = case kind of
+  Just k
+    | k `Set.member` containerishKinds -> 1
+    | k == SymbolKind_Function || k == SymbolKind_Method -> 2
+    | otherwise -> 3
+  _unknown -> 4
+
+-- | We do some light ranking of the results
+scoreResult :: Text -> Text -> MatchType
+scoreResult query result
+  | result == query = ExactMatch
+  | Text.toLower result == queryLC = ExactInsensitiveMatch
+  | otherwise = Otherwise
+  where
+    queryLC = Text.toLower query
+
+-- A projection from the search result to features for fair sampling groups
+--
+-- todo: we might want to have fewer symbolkind groups (e.g. combine class-like
+-- things)
+--
+data Feature = Feature !Language {-# UNPACK #-}!KindSort
+  deriving (Eq, Ord)
+
+-- Containerish, function/method, other
+type KindSort = Int
+
+-- | Glass needs to mark results by how good they are
+-- For scope searches we don't care so much as the scope will filter
+-- results. But for bare string searches we need to do a bit of work
+data MatchType
+  = ExactMatch             -- "FBID"
+  | ExactInsensitiveMatch  -- "fbid" ~ "FBID"
+  | Otherwise
+  deriving (Eq, Ord, Bounded, Enum)
+
+-- | Symbol search for references as ranges.
+fetchSymbolReferenceRanges
+  :: Glean.Backend b
+  => Glass.Env
+  -> RepoName
+  -> Language
+  -> [Text]
+  -> Maybe Int
+  -> GleanBackend b
+  -> IO ([LocationRange], Maybe ErrorLogger)
+fetchSymbolReferenceRanges env scsrepo lang toks limit b =
+  backendRunHaxl b env $ do
+    er <- symbolToAngleEntities lang toks
+    let logDBs x = logError (gleanDBs b) <> x
+    case er of
+      Left err -> return ([], Just $ logDBs err)
+      Right (entities, searchErr) -> do
+        ranges <- forM entities $ \(entityRepo, query) ->
+          withRepo entityRepo $ do
+            let convert (targetFile, rspan) =
+                  rangeSpanToLocationRange scsrepo targetFile rspan
+            uses <- searchWithLimit limit $ Query.findReferenceRangeSpan query
+            mapM convert uses
+        return (nubOrd $ concat ranges, fmap (logDBs . logError) searchErr)
+
+-- | Search for a symbol and return an Angle query that identifies the entities
+-- Return the angle query and the Glean.repo to which it applies.
+--
+-- Todo: this entity query only works on the db it came from.
+-- Should be in the type
+--
+symbolToAngleEntities
+  :: Language
+  -> [Text]
+  -> ReposHaxl u w
+      (Either ErrorLogger
+        (NonEmpty (Glean.Repo, Angle Code.Entity), Maybe GlassExceptionReason))
+symbolToAngleEntities lang toks = do
+  r <- Search.searchEntity lang toks -- search everywhere for something a match
+  (entities, searchErr) <- case r of
+    None t -> throwM (ServerException t) -- return [] ?
+    One e -> return (e:|[], Nothing)
+      -- n.b. picks the first entity only
+    Many { initial = e, rest = es, message = t } ->
+      return (e:|es, Just (GlassExceptionReason_entitySearchFail t))
+  let
+    eithers =
+      NonEmpty.map
+        (\SearchEntity{entityRepo, decl} ->(entityRepo,) <$> entityToAngle decl)
+        entities
+
+  return $ case allOrError eithers of
+    Left err -> Left (logError (GlassExceptionReason_entityNotSupported err))
+    Right results -> Right (results, searchErr)
+
+newtype GetStaticAttributes =
+  GetStaticAttributes (Glean.Repo, Code.Entity, Maybe Language)
+  deriving (Eq, Hashable)
+
+parentContainer
+  :: RepoName -> Code.Entity -> Glean.RepoHaxl u w (Maybe SymbolContext)
+parentContainer repo ent = do
+  parents <- Search.searchRelatedEntities 2 Search.ShowAll NotRecursive
+    RelationDirection_Parent RelationType_Contains ent repo
+  let mParent = Search.parentRL <$> listToMaybe parents
+  case mParent of
+    Nothing -> return Nothing
+    Just (p, symbolContext_symbol) -> do
+      mQName <- eitherToMaybe <$> toQualifiedName (fst4 p)
+      return $ do -- :: Maybe
+        symbolContext_qname <- mQName
+        let symbolContext_kind = Nothing
+        pure SymbolContext{..}
+
+--
+-- | Relational search. Given a symbol id find symbols related to it.
+-- Relationships could be parent/child or oo inheritance, for example.
+--
+searchRelated
+  :: Glass.Env
+  -> SymbolId
+  -> RequestOptions
+  -> SearchRelatedRequest
+  -> IO SearchRelatedResult
+searchRelated env@Glass.Env{..} sym opts@RequestOptions{..}
+    SearchRelatedRequest{..} =
+  withSymbol "searchRelated" env opts sym $
+    \gleanDBs_ dbInfo (repo, lang, toks) ->
+      let gleanDBs = filterDBs lang gleanDBs_ in
+      backendRunHaxl GleanBackend{..} env $ do
+        entity <- searchFirstEntity lang toks
+        withRepo (entityRepo entity) $ do
+          (symPairs, desc, merr) <- case searchRelatedRequest_relatedBy of
+            RelationType_Calls -> do
+              (entityPairs, merr) <-
+                searchRelatedCalls
+                  repo searchRelatedRequest_relation entity lang
+              desc <- descriptions repo entityPairs dbInfo
+              let symPairs = symbolIdPairs entityPairs
+              return (symPairs, desc, merr)
+            RelationType_Generates -> do
+              (symPairs, merr) <-
+                searchRelatedGenerate
+                  repo searchRelatedRequest_relation entity lang
+              return (symPairs, Map.empty, merr)
+            _ -> do
+              (entityPairs, merr) <- do
+                relatedLocatedEntities <-
+                        Search.searchRelatedEntities limit
+                          Search.ShowAll
+                          searchRecursively
+                          searchRelatedRequest_relation
+                          searchRelatedRequest_relatedBy
+                          (fst4 (decl entity))
+                          repo
+                return ((,Nothing) <$> relatedLocatedEntities, Nothing)
+              desc <- descriptions repo entityPairs dbInfo
+              let symPairs = symbolIdPairs entityPairs
+              return (symPairs, desc, merr)
+          let result = SearchRelatedResult
+                { searchRelatedResult_edges = symPairs
+                , searchRelatedResult_symbolDetails = desc
+                }
+          pure (result, merr)
+
+  where
+    symbolIdPairs
+      :: [(RelatedLocatedEntities, Maybe [LocationRange])] -> [RelatedSymbols]
+    symbolIdPairs entityPairs =
+      map (\(Search.RelatedLocatedEntities{..}, ranges) ->
+        RelatedSymbols (snd parentRL) (snd childRL) ranges
+      ) entityPairs
+
+    descriptions
+      :: RepoName
+      -> [(RelatedLocatedEntities, Maybe [LocationRange])]
+      -> GleanDBInfo
+      -> RepoHaxl u w (Map.Map Text SymbolDescription)
+    descriptions repo entityPairs dbInfo =
+     if searchRelatedRequest_detailedResults
+        then do
+          let uniqSymIds = uniqBy (comparing snd) $ concat
+                [ [ e1, e2 ]
+                | (Search.RelatedLocatedEntities e1 e2, _) <- entityPairs ]
+          let scmRevs = scmRevisions dbInfo
+          descs <- mapM (mkDescribe repo scmRevs) uniqSymIds
+            -- carefully in parallel!
+          pure $ Map.fromAscList descs
+        else pure mempty
+
+    -- building map of sym id -> descriptions, by first occurence
+    mkDescribe repo scmRevs e@(_,SymbolId rawSymId) = (rawSymId,) <$>
+      describe repo scmRevs e
+
+    describe repo scmRevs ((entity, entityFile, entityRange, entityName), symId)
+      = mkSymbolDescription symId scmRevs repo CodeEntityLocation{..} Nothing
+
+    searchRecursively
+      | searchRelatedRequest_recursive = Search.Recursive
+      | otherwise = Search.NotRecursive
+
+    limit = fromIntegral $ case requestOptions_limit of
+      Just x | x < rELATED_SYMBOLS_MAX_LIMIT -> x
+      _ -> rELATED_SYMBOLS_MAX_LIMIT
+
+    -- Caller hieararchy for C++ requires cxx1.DeclarationSources,
+    -- which may not be supported by all DBs.
+    filterDBs :: Language -> NonEmpty (GleanDBName,a) -> NonEmpty (GleanDBName,a)
+    filterDBs lang
+      | RelationType_Calls <- searchRelatedRequest_relatedBy
+      , RelationDirection_Parent <- searchRelatedRequest_relation
+      , Language_Cpp <- lang
+      = NonEmpty.fromList .
+        NonEmpty.filter (supportsCxxDeclarationSources . fst)
+      | otherwise
+      = id
+
+    searchRelatedGenerate
+      :: RepoName
+      -> RelationDirection
+      -> SearchEntity (ResultLocation Code.Entity)
+      -> Language
+      -> RepoHaxl u w
+          ([RelatedSymbols], Maybe ErrorLogger)
+    searchRelatedGenerate repoName RelationDirection_Parent child _ = do
+      let SearchEntity{decl = (decl, _file, _rangespan, _name)} = child
+      case entityToAngle decl of
+        Left err -> do
+          repo <- Glean.haxlRepo
+          return
+            ([], Just (logError (GlassExceptionReason_entityNotSupported err)
+                    <> logError repo)
+            )
+        Right query -> do
+          results <- searchWithLimit Nothing $
+            Query.generatedEntityToIdlEntity query
+          idlDef <- forM results $ \(entity, file) -> do
+            gleanPath <- GleanPath <$> Glean.keyOf file
+            parentSymbol <- toSymbolId (fromGleanPath repoName gleanPath) entity
+            return  $ RelatedSymbols parentSymbol sym Nothing
+          return (idlDef, Nothing)
+
+    -- TODO implement RelationDirection_Child
+    searchRelatedGenerate _ _ _ _ = return ([], Nothing)
+
+    -- Implements Call hierarchy (check LSP spec)
+    searchRelatedCalls
+      :: RepoName
+      -> RelationDirection
+      -> SearchEntity (ResultLocation Code.Entity)
+      -> Language
+      -> RepoHaxl u w
+          ([(RelatedLocatedEntities, Maybe [LocationRange])], Maybe ErrorLogger)
+    searchRelatedCalls _ RelationDirection__UNKNOWN{} _ _ = error "unreachable"
+    -- Incoming calls, mapping a symbol to all its callers symbols.
+    searchRelatedCalls repoName RelationDirection_Parent child Language_Cpp = do
+      -- For C++ we use a more efficient predicate, albeit without call sites
+      let SearchEntity{decl = (decl, file, rangespan, name)} = child
+      case entityToAngle decl of
+        Left err -> do
+          repo <- Glean.haxlRepo
+          return ([], Just (logError (GlassExceptionReason_entityNotSupported err)
+                    <> logError repo)
+            )
+        Right query -> do
+          let childRL = ((decl, file, rangespan, name), sym)
+              limit = fromIntegral <$> requestOptions_limit
+          results <- searchWithLimit limit $
+            Query.findReferenceEntitiesFast query
+          callers <- forM results $ \(entity, loc) -> do
+            let path = Code.location_file loc
+            gleanPath <- GleanPath <$> Glean.keyOf path
+            symbol <- toSymbolId (fromGleanPath repoName gleanPath) entity
+            let name = Code.location_name loc
+                range = Code.location_location loc
+                parentRL = ((entity, path, range, name), symbol)
+            return Search.RelatedLocatedEntities{..}
+          return ((,Nothing) <$> callers, Nothing)
+
+    searchRelatedCalls repoName RelationDirection_Parent child _ = do
+        let SearchEntity{decl = (decl, file, rangespan, name)} = child
+        case entityToAngle decl of
+          Left err -> do
+            repo <- Glean.haxlRepo
+            return
+              ([], Just (logError (GlassExceptionReason_entityNotSupported err)
+                      <> logError repo)
+              )
+          Right query -> do
+            let childRL = ((decl, file, rangespan, name), sym)
+                -- limit until we optimize the query to use DeclarationSource
+                limit = maybe 200 fromIntegral requestOptions_limit
+                timeLimit = 2000 -- ms
+            results <- searchWithTimeLimit (Just limit) timeLimit $
+              Query.findReferenceEntities query
+            callers <- forM results $ \(path, entity, loc, callSite) -> do
+              gleanPath <- GleanPath <$> Glean.keyOf path
+              symbol <- toSymbolId (fromGleanPath repoName gleanPath) entity
+              let name = Code.location_name loc
+                  range = Code.location_location loc
+                  parentRL = ((entity, path, range, name), symbol)
+              location <- rangeSpanToLocationRange repoName path callSite
+              return (Search.RelatedLocatedEntities{..}, location)
+            let groups = groupLocatedEntitiesOn parentRL callers
+            return (second Just <$> groups, Nothing)
+
+    -- | Outgoing calls, maps a symbol to all the symbols it references.
+    searchRelatedCalls repoName RelationDirection_Child parent lang = do
+      let SearchEntity{decl = (decl, file, rangespan, name)} = parent
+          parentRL = ((decl, file, rangespan, name), sym)
+      parentRange <-
+        locationRange_range <$> rangeSpanToLocationRange repoName file rangespan
+      (xrefs_, _, _) <- Utils.documentSymbolsForLanguage Nothing (Just lang)
+          (Utils.ExtraSymbolOpts True False Nothing)
+          (Glean.getId file)
+      -- only consider non-xlang xrefs
+      let xrefs = [x | PlainXRef x <- xrefs_]
+      xrefsRanges <- forM xrefs $ \(Code.XRefLocation{..}, entity) -> do
+        gleanPath <- GleanPath <$>
+          Glean.keyOf (Code.location_file xRefLocation_target)
+        symbol <- toSymbolId (fromGleanPath repoName gleanPath) entity
+        sourceRange <- rangeSpanToLocationRange repoName file xRefLocation_source
+        kind <- findSymbolKind entity
+        return (sourceRange, symbol, kind)
+      let callees =
+            [ (Search.RelatedLocatedEntities{..}, callRange)
+            | ((Code.XRefLocation{..}, entity), (callRange, symbol, Right kind))
+                <- zip xrefs xrefsRanges
+            , kind `elem`
+                [ SymbolKind_Constructor
+                , SymbolKind_Function
+                , SymbolKind_Method
+                , SymbolKind_Macro
+                ]
+            , rangeContains parentRange (locationRange_range callRange)
+            , let childRL =
+                    (( entity
+                    , Code.location_file xRefLocation_target
+                    , Code.location_location xRefLocation_target
+                    , Code.location_name xRefLocation_target
+                    ), symbol)
+            ]
+      let groups = groupLocatedEntitiesOn childRL callees
+      return (second Just <$> groups, Nothing)
+
+    groupLocatedEntitiesOn f locatedEntities =
+      [ (locatedEntity, locs)
+      | group@((locatedEntity, _) : _) <-
+          groupOn (snd . f . fst) locatedEntities
+      , let locs = map snd group
+      ]
+--
+-- Extract the "API" neighborhood of a symbol
+--
+searchRelatedNeighborhood
+  :: Glass.Env
+  -> SymbolId
+  -> RequestOptions
+  -> RelatedNeighborhoodRequest
+  -> IO RelatedNeighborhoodResult
+searchRelatedNeighborhood env@Glass.Env{..} sym opts@RequestOptions{..} req =
+  withSymbol "searchRelatedNeighborhood" env opts sym $
+    \gleanDBs dbInfo (repo, lang, toks) ->
+      backendRunHaxl GleanBackend{..} env $ do
+        baseEntity <- searchFirstEntity lang toks
+        let lang = entityLanguage (fst4 (decl baseEntity))
+        (,Nothing) <$> searchNeighborhood limit req sym repo
+          (scmRevisions dbInfo) lang baseEntity
+  where
+    limit = fromIntegral $ case requestOptions_limit of
+      Just x | x < rELATED_SYMBOLS_MAX_LIMIT -> x
+      _ -> rELATED_SYMBOLS_MAX_LIMIT
+
+searchFirstEntity
+  :: Language
+  -> [Text]
+  -> Glean.ReposHaxl u w (SearchEntity (ResultLocation Code.Entity))
+searchFirstEntity lang toks = do
+  r <- Search.searchEntityLocation lang toks
+  case r of
+    None t -> throwM (ServerException t)
+    One e -> return e
+    Many { initial = e } -> return e
diff --git a/glean/glass/Glean/Glass/Handler/Utils.hs b/glean/glass/Glean/Glass/Handler/Utils.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Handler/Utils.hs
@@ -0,0 +1,383 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Handler.Utils (
+    -- * Handler wrappers: handlers should call one of these
+    withRepoFile,
+    withRepoLanguage,
+    withSymbol,
+    withRequest,
+
+    -- * deprecated handler wrappers
+    withGleanDBs,
+    getLatestAttrDBs,
+
+    -- * Utils for building handlers
+    GleanBackend(..),
+    backendRunHaxl,
+    getGleanRepos,
+
+    revisionSpecifierError,
+
+    firstOrErrors,
+    allOrError,
+
+    -- * Utils for computing defs and xrefs in a document
+    documentSymbolsForLanguage,
+    ExtraSymbolOpts(..)
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.Catch ( throwM )
+import Data.Either
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Data.List.NonEmpty ( NonEmpty(..), nonEmpty, toList )
+import Data.Text ( Text )
+import qualified Data.Text as Text
+
+import Haxl.Core as Haxl
+import Haxl.DataSource.Glean (HasRepo)
+import Util.Logger ( loggingAction )
+import Util.STM
+import qualified Logger.GleanGlass as Logger
+
+import qualified Glean
+import Glean.Haxl.Repos as Glean
+import Glean.Util.Some
+
+import Glean.Glass.Base
+import Glean.Glass.Logging
+import Glean.Glass.Repos
+import Glean.Glass.SourceControl
+import Glean.Glass.SymbolId
+import Glean.Glass.Tracing
+import Glean.Glass.Types
+import qualified Glean.Glass.Query as Query
+import qualified Glean.Glass.Query.Cxx as Cxx
+import qualified Glean.Glass.Env as Glass
+import Glean.Glass.XRefs ( GenXRef(..), buildGenXRefs )
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Glass.Utils as Utils
+
+-- | The DBs we've chosen for this request
+type ChosenDBs = NonEmpty (GleanDBName, Glean.Repo)
+
+-- | Given a query, run it on all available repos and return the first success
+--   plus an explainer
+firstOrErrors
+  :: (HasRepo u => ReposHaxl u w (Either GlassExceptionReason a))
+  -> ReposHaxl u w
+      (Either (NonEmpty GlassExceptionReason) (a, QueryEachRepoLog))
+firstOrErrors act = do
+  results <- queryEachRepo $ do
+    repo <- Glean.haxlRepo
+    result <- act
+    return $ (repo,) <$> result
+  let (fail, success) = partitionEithers results
+  return $ case success of
+    (repo, x) : rest ->
+      Right (x, FoundSome (repo :| fmap fst rest))
+    [] -> Left $ fromMaybe (error "unreachable") $ nonEmpty fail
+
+allOrError :: NonEmpty (Either a1 a2) -> Either a1 (NonEmpty a2)
+allOrError = go (Right [])
+  where
+    go
+      :: Either err [ok]
+      -> NonEmpty (Either err ok)
+      -> Either err (NonEmpty ok)
+    go (Left err) _ = Left err
+    go (Right _es) ((Left err) :| _) = Left err
+    go (Right res) ((Right ok) :| []) =
+      Right (ok :| res)
+    go (Right res) ((Right ok) :| (x:xs)) =
+      go (Right (ok:res)) (x :| xs)
+
+-- | Bundle of glean db handle resources
+data GleanBackend b =
+  GleanBackend {
+    gleanBackend :: b,
+    gleanDBs :: ChosenDBs,
+    tracer :: GlassTracer
+  }
+
+backendRunHaxl
+  :: Glean.Backend b
+  => GleanBackend b
+  -> Glass.Env
+  -> (forall u. ReposHaxl u w a)
+  -> IO a
+backendRunHaxl GleanBackend{..} Glass.Env{haxlState} haxl =
+  traceSpan tracer "glean" $ do
+    (state1,state2) <- Glean.initGlobalState gleanBackend
+    let st = Haxl.stateSet state1 $ Haxl.stateSet state2 haxlState
+    haxlEnv <- Haxl.initEnv st (Glean.Repos (fmap snd gleanDBs))
+    runHaxl haxlEnv haxl
+
+revisionSpecifierError :: Maybe Revision -> Text
+revisionSpecifierError Nothing = "AnyRevision"
+revisionSpecifierError (Just (Revision rev))= "Requested exactly " <> rev
+
+-- Depending on revision provided in the options (none, exact or otherwise)
+-- decide whether we'll need to choose latest, nearest or exact DB
+dbChooser :: RepoName -> RequestOptions -> ChooseGleanDBs
+dbChooser repo opts =
+  case requestOptions_revision opts of
+    Nothing -> ChooseLatest
+    Just rev
+      | not exact -> ChooseNearest repo rev
+      | otherwise -> ChooseExactOrLatest rev
+ where
+ exact = requestOptions_exact_revision opts
+
+-- | Top-level wrapper for all requests.
+--
+-- * Snapshots the GleanDBInfo
+-- * Implements strict vs. non-strict error handling
+-- * Logs the request and result
+--
+withRequest
+  :: (LogRequest req, LogResult res)
+  => Text
+  -> Glass.Env
+  -> req
+  -> RequestOptions
+  -> (GleanDBInfo -> IO (res, Maybe ErrorLogger))
+  -> IO res
+withRequest method env@Glass.Env{..} req opts fn = do
+  dbInfo <- readTVarIO latestGleanRepos
+  withStrictErrorHandling dbInfo opts $
+    withLog method env opts req $
+      fn dbInfo
+
+-- | Run an action that provides a repo and maybe a language, log it
+withRepoLanguage
+  :: (LogRequest a, LogResult b)
+  => Text
+  -> Glass.Env
+  -> a
+  -> RepoName
+  -> Maybe Language
+  -> RequestOptions
+  -> (  ChosenDBs
+     -> GleanDBInfo
+     -> Maybe Language
+     -> IO (b, Maybe ErrorLogger))
+  -> IO b
+withRepoLanguage method env@Glass.Env{..} req repo mlanguage opts fn =
+  fmap fst $ withRequest method env req opts $ \dbInfo -> do
+    dbs <- getGleanRepos tracer sourceControl repoMapping dbInfo repo
+      mlanguage (requestOptions_revision opts) (dbChooser repo opts) gleanDB
+    withLogDB dbs $
+      fn dbs dbInfo mlanguage
+
+-- | Run an action that provides a repo and filepath, log it
+withRepoFile
+  :: (LogRequest a, LogResult b)
+  => Text
+  -> Glass.Env
+  -> RequestOptions
+  -> a
+  -> RepoName
+  -> Path
+  -> (  NonEmpty (GleanDBName,Glean.Repo)
+     -> GleanDBInfo
+     -> Maybe Language
+     -> IO (b, Maybe ErrorLogger))
+  -> IO b
+withRepoFile method env opts req repo file fn = do
+  withRepoLanguage method env req repo (fileLanguage file) opts fn
+
+-- | Run an action that provides a symbol id, log it
+withSymbol
+  :: LogResult res
+  => Text
+  -> Glass.Env
+  -> RequestOptions
+  -> SymbolId
+  -> (  NonEmpty (GleanDBName, Glean.Repo)
+     -> GleanDBInfo
+     -> (RepoName, Language, [Text])
+     -> IO (res, Maybe ErrorLogger))
+  -> IO res
+withSymbol method env@Glass.Env{..} opts sym fn =
+  fmap fst $ withRequest method env sym opts $ \dbInfo ->
+    case symbolTokens sym of
+      Left err -> throwM $ ServerException err
+      Right req@(repo, lang, _toks) -> do
+        dbs <- getGleanRepos tracer sourceControl repoMapping dbInfo repo
+          (Just lang) (requestOptions_revision opts)
+          (dbChooser repo opts) gleanDB
+        withLogDB dbs $ fn dbs dbInfo req
+
+withStrictErrorHandling
+  :: GleanDBInfo
+  -> RequestOptions
+  -> IO (res, Maybe ErrorLogger)
+  -> IO res
+withStrictErrorHandling dbInfo opts action = do
+  (res, merr) <- action
+  case merr of
+    Just err
+      | requestOptions_strict opts
+      , not $ null $ errorTy err
+      -> do
+          let getFirstRevision repo =
+                case HashMap.lookup repo (scmRevisions dbInfo) of
+                  Just m | rev : _ <- HashMap.elems m ->
+                    Just (scmRevision rev)
+                  _ -> Nothing
+          throwM $ GlassException
+            (errorTy err)
+            (mapMaybe getFirstRevision (errorGleanRepo err))
+    _ -> return res
+
+-- | Perform logging for a request. Logs the request and the response
+-- or errors that were thrown.
+withLog
+  :: (LogRequest req, LogResult res)
+  => Text
+  -> Glass.Env
+  -> RequestOptions
+  -> req
+  -> IO res
+  -> IO res
+withLog cmd env opts req action = do
+  let requestLogs =
+        Logger.setMethod cmd <>
+        logRequest req <>
+        logRequest opts
+  loggingAction
+    (Logger.runLog (Glass.logger env) . (requestLogs <>))
+    logResult
+    action
+
+withLogDB
+  :: ChosenDBs
+  -> IO (b, Maybe ErrorLogger)
+  -> IO ((b, ChosenDBs), Maybe ErrorLogger)
+withLogDB dbs act = do
+  (b, merr) <- act
+  return ((b,dbs), merr)
+
+-- | Given an SCS repo name, and a candidate path, find latest Glean dbs or
+-- throw. Returns the chosen db name and Glean repo handles.
+-- If a Glean.Repo is given, use it instead.
+getGleanRepos
+  :: GlassTracer
+  -> Some SourceControl
+  -> RepoMapping
+  -> GleanDBInfo
+  -> RepoName
+  -> Maybe Language
+  -> Maybe Revision
+  -> ChooseGleanDBs
+  -> Maybe Glean.Repo
+  -> IO ChosenDBs
+getGleanRepos tracer scm repoMapping dbInfo
+  scsrepo mlanguage revision chooser mGleanDB =
+    case mGleanDB of
+      Nothing -> do
+        gleanDBs <- fromSCSRepo repoMapping scsrepo branchesFilter mlanguage
+        case gleanDBs of
+          [] ->  throwIO $ ServerException $ "No repository found for: " <>
+            unRepoName scsrepo <>
+              maybe "" (\x -> " (" <> toShortCode x <> ")") mlanguage
+          (x:xs) ->
+            getSpecificGleanDBs tracer scm dbInfo chooser (x :| xs)
+      Just gleanDB@Glean.Repo{repo_name} ->
+        return ((GleanDBName repo_name, gleanDB) :| [])
+  where
+    branchesFilter :: Maybe (Text -> IO Bool)
+    branchesFilter = fmap (isDescendantBranch scm scsrepo) revision
+
+-- | If you already know the set of dbs you need, just get them.
+getSpecificGleanDBs
+  :: GlassTracer
+  -> Some SourceControl
+  -> GleanDBInfo
+  -> ChooseGleanDBs
+  -> NonEmpty GleanDBName
+  -> IO ChosenDBs
+getSpecificGleanDBs tracer scm dbInfo chooser gleanDBNames = do
+  dbs <- chooseGleanDBs tracer scm dbInfo chooser (toList gleanDBNames)
+  case dbs of
+    [] -> throwIO $ ServerException $ "No Glean dbs found for: " <>
+            Text.intercalate ", " (map unGleanDBName $ toList gleanDBNames)
+    db:dbs -> return (db :| dbs)
+
+-- | Legacy API that (a) doesn't do strict error handling and (b) chooses
+-- DBs by name, not repo. TODO: clean this up
+withGleanDBs
+  :: (LogRequest req, LogResult res)
+  => Text
+  -> Glass.Env
+  -> RequestOptions
+  -> req
+  -> RepoName
+  -> NonEmpty GleanDBName
+  -> (ChosenDBs -> GleanDBInfo -> IO res)
+  -> IO res
+withGleanDBs method env@Glass.Env{..} opts req repo dbNames fn = do
+  dbInfo <- readTVarIO latestGleanRepos
+  dbs <- getSpecificGleanDBs tracer sourceControl dbInfo (dbChooser repo opts) dbNames
+  fmap fst $ withLog method env opts req $
+    (,dbs) <$> fn dbs dbInfo
+
+-- | Get glean db for an attribute type (always choose the latest)
+getLatestAttrDBs
+  :: GlassTracer
+  -> Some SourceControl
+  -> RepoMapping
+  -> GleanDBInfo
+  -> RepoName
+  -> IO [(Glean.Repo, GleanDBAttrName)]
+getLatestAttrDBs tracer scm repoMapping dbInfo repo =
+  fmap catMaybes $ forM (attrDBsForRepo repoMapping repo) $
+    \attrDBName -> do
+      dbs <- chooseGleanDBs tracer scm dbInfo ChooseLatest
+        [gleanAttrDBName attrDBName]
+      return $ case dbs of
+        [] -> Nothing
+        db:_ -> Just (snd db, attrDBName)
+
+-- | Args that modify the shape of the output
+data ExtraSymbolOpts = ExtraSymbolOpts {
+  oIncludeRefs :: !Bool,  -- ^ include references?
+  oIncludeXlangRefs :: !Bool,  -- ^ include xlang references?
+  oLineRange :: Maybe [LineRange] -- ^ restrict to specifc range
+}
+
+type Defns = [(Code.Location,Code.Entity)]
+
+-- | Which fileEntityLocations and fileEntityXRefLocation implementations to use
+documentSymbolsForLanguage
+  :: Maybe Int
+  -> Maybe Language
+  -> ExtraSymbolOpts
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w ([GenXRef], Defns, Bool)
+
+-- For Cpp, we need to do a bit of client-side processing
+documentSymbolsForLanguage
+  mlimit (Just Language_Cpp) opts fileId = Cxx.documentSymbolsForCxx
+    mlimit (oIncludeRefs opts) (oIncludeXlangRefs opts) fileId
+
+-- For everyone else, we just query the generic codemarkup predicates
+documentSymbolsForLanguage mlimit _ ExtraSymbolOpts{..} fileId = do
+  (xrefs, trunc1) <- if oIncludeRefs
+    then Utils.searchRecursiveWithLimit mlimit $
+      Query.fileEntityXRefsGenEntities fileId oIncludeXlangRefs
+    else return ([], False)
+  (defns, trunc2) <- Utils.searchRecursiveWithLimit mlimit $
+    Query.fileEntityLocations fileId
+  return (mapMaybe buildGenXRefs xrefs, defns, trunc1 || trunc2)
diff --git a/glean/glass/Glean/Glass/Logging.hs b/glean/glass/Glean/Glass/Logging.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Logging.hs
@@ -0,0 +1,398 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Logging
+  (
+  -- * classes for convenient typed logging
+    LogResult(..)
+  , LogRequest(..)
+  , LogError(..)
+
+  -- * some types
+  , QueryEachRepoLog(..)
+  , ErrorText(..)
+  , ErrorLogger(..)
+  , AttrDBsLog(..)
+  , AttrStatsLog(..)
+  , errorText
+  , errorsText
+
+  ) where
+
+import Control.Applicative ((<|>))
+import Data.Coerce
+import Data.List.Extra (nubOrd)
+import Data.List.NonEmpty(NonEmpty(..))
+import qualified Data.List.NonEmpty as NE
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Function (on)
+import Util.Text (textShow)
+
+import Util.Logger (ActionLog(..))
+import Logger.GleanGlass (GleanGlassLogger)
+import qualified Logger.GleanGlass as Logger
+
+import Glean (Repo(..), repoToText)
+import Glean.Glass.Types
+import Glean.Glass.SnapshotBackend ( SnapshotStatus(..) )
+import qualified Thrift.Protocol.JSON as Thrift
+
+instance ActionLog GleanGlassLogger where
+  successLog = Logger.setSuccess True
+  failureLog ex = mconcat
+    [ Logger.setSuccess False
+    , Logger.setError (textShow ex)
+    ]
+  timeLog = Logger.setTimeElapsedUs . floor . (* 1000) . (* 1000)
+  allocLog = Logger.setAllocatedBytes . fromIntegral
+
+class LogRequest a where
+  logRequest :: a -> GleanGlassLogger
+
+instance LogRequest a => LogRequest (Maybe a) where
+  logRequest = maybe mempty logRequest
+
+instance LogRequest RequestOptions where
+  logRequest RequestOptions{..} =
+    maybe mempty (Logger.setRevision . unRevision) requestOptions_revision <>
+    maybe mempty (Logger.setLimit . fromIntegral) requestOptions_limit <>
+    Logger.setExactRevision requestOptions_exact_revision <>
+    Logger.setMatchingRevision requestOptions_matching_revision <>
+    Logger.setContentCheck requestOptions_content_check <>
+    logRequest requestOptions_feature_flags <>
+    logRequest requestOptions_attribute_opts
+
+instance LogRequest AttributeOptions where
+  logRequest AttributeOptions{..} =
+    Logger.setAttributeOptions $ textShow $ Thrift.serializeJSON AttributeOptions{..}
+
+instance LogRequest FeatureFlags where
+  logRequest FeatureFlags{..} =
+    maybe mempty Logger.setIncludeXlangXrefs featureFlags_include_xlang_refs
+
+instance LogRequest DocumentSymbolsRequest where
+  logRequest = logDocumentSymbolsRequestSG Logger.setFilepath Logger.setRepo
+
+instance LogRequest SymbolId where
+  logRequest = logSymbolSG Logger.setSymbol
+
+instance LogRequest USRHash where
+  logRequest (USRHash hash) = logSymbolSG Logger.setSymbol (SymbolId hash)
+
+instance LogRequest USR where
+  logRequest (USR usr) = logSymbolSG Logger.setSymbol (SymbolId usr)
+
+instance LogRequest USRToDefinitionRequest where
+  logRequest = logUSRToDefinitionRequestSG Logger.setSymbol Logger.setRepo
+
+instance LogRequest SymbolPath where
+  logRequest = logSymbolPathSG Logger.setFilepath Logger.setRepo
+
+instance LogRequest SymbolSearchRequest where
+  logRequest = logSymbolSearchRequestSG Logger.setSymbol Logger.setRepo
+
+instance LogRequest FileIncludeLocationRequest where
+  logRequest FileIncludeLocationRequest{..} =
+    Logger.setFilepath (unPath fileIncludeLocationRequest_filepath) <>
+      Logger.setRepo (unRepoName fileIncludeLocationRequest_repository)
+
+class LogResult a where
+  logResult :: a -> GleanGlassLogger
+
+instance LogResult () where
+  logResult = mempty
+
+instance LogResult GleanGlassLogger where
+  logResult = id
+
+instance LogResult a => LogResult (Maybe a) where
+  logResult = maybe mempty logResult
+
+instance (LogResult a, LogResult b) => LogResult (a,b) where
+  logResult (a,b) = logResult a <> logResult b
+
+instance (LogResult a, LogResult b, LogResult c) => LogResult (a,b,c) where
+  logResult (a,b,c) = logResult a <> logResult b <> logResult c
+
+instance (LogResult a, LogResult b, LogResult c,  LogResult d)
+  => LogResult (a,b,c,d) where
+    logResult (a,b,c,d) =
+      logResult a <> logResult b <> logResult c  <> logResult d
+
+instance LogResult DocumentSymbolListXResult  where
+  logResult DocumentSymbolListXResult{..} =
+    Logger.setTruncated documentSymbolListXResult_truncated <>
+    Logger.setItemCount (length documentSymbolListXResult_references +
+      length documentSymbolListXResult_definitions) <>
+    Logger.setRevisionUsed (coerce documentSymbolListXResult_revision) <>
+    maybe mempty Logger.setContentMatch documentSymbolListXResult_content_match
+
+instance LogResult FileIncludeLocationResults where
+  logResult FileIncludeLocationResults{..} =
+    Logger.setItemCount (sum
+       (map (length . fileIncludeXRef_includes)
+          (unXRefFileList fileIncludeLocationResults_references)
+       ))
+
+instance LogResult SnapshotStatus where
+  logResult st = logSnapshotStatus st
+
+data QueryEachRepoLog
+  = FoundNone
+  | FoundSome (NonEmpty Glean.Repo)
+  | QueryEachRepoUnrequested
+
+instance LogResult QueryEachRepoLog where
+  logResult glog = case glog of
+    FoundSome (one :| more) ->
+      Logger.setDbUsedName (Glean.repo_name one) <>
+      Logger.setDbUsedInstance (Glean.repo_hash one) <>
+      if null more
+        then mempty
+        else Logger.setRepoOther (map Glean.repo_name more)
+    _ -> mempty
+
+instance LogResult DocumentSymbolIndex where
+  logResult DocumentSymbolIndex{..} =
+    Logger.setItemCount (fromIntegral documentSymbolIndex_size)
+        <> Logger.setTruncated documentSymbolIndex_truncated
+        <> Logger.setRevisionUsed (coerce documentSymbolIndex_revision)
+        <> maybe mempty Logger.setContentMatch documentSymbolIndex_content_match
+
+instance LogResult Range where
+  logResult _ = mempty
+
+instance LogResult [LocationRange] where
+  logResult xs = Logger.setItemCount (length xs)
+
+instance LogResult LocationRange where
+  logResult LocationRange{..} = mconcat
+    [ Logger.setItemCount 1
+    , Logger.setRepo $ unRepoName locationRange_repository
+    ]
+
+instance LogResult SymbolLocation where
+  logResult SymbolLocation{..} = logResult symbolLocation_location
+      <> Logger.setRevisionUsed (coerce symbolLocation_revision)
+
+instance LogResult SymbolDescription where
+  logResult SymbolDescription{..} =
+    logResult symbolDescription_location <>
+    logResult symbolDescription_sym <>
+    Logger.setItemCount 1
+
+instance LogResult [SymbolResolution] where
+  logResult xs = Logger.setItemCount (length xs)
+
+instance LogResult SymbolResolutionFailure where
+  logResult SymbolResolutionFailure{..} =
+      Logger.setInternalError (errorText symbolResolutionFailure_reason)
+
+instance LogResult SymbolPath where
+  logResult SymbolPath{..} =
+    Logger.setRepo (unRepoName symbolPath_repository)
+
+instance LogResult SymbolId where
+  logResult sym = logSymbolSG Logger.setSymbol sym
+
+instance LogResult [SymbolId] where
+  logResult xs = Logger.setItemCount (length xs)
+
+instance LogResult [(SymbolResult, Maybe SymbolDescription)] where
+  logResult rs = Logger.setItemCount (length rs)
+
+instance LogResult SymbolSearchResult where
+  logResult SymbolSearchResult{..} =
+    Logger.setItemCount (length symbolSearchResult_symbols)
+
+instance LogResult SearchRelatedResult where
+  logResult SearchRelatedResult{..} =
+    logResult searchRelatedResult_edges
+
+instance LogResult RelatedNeighborhoodResult where
+  logResult RelatedNeighborhoodResult{..} =
+    Logger.setItemCount
+      (length relatedNeighborhoodResult_childrenContained +
+        length relatedNeighborhoodResult_childrenExtended +
+        length relatedNeighborhoodResult_containsParents +
+        length relatedNeighborhoodResult_parentsExtended +
+        sum (map (\x -> 1 + length (inheritedSymbols_provides x))
+              relatedNeighborhoodResult_inheritedSymbols
+            )
+      )
+
+instance LogResult USRSymbolDefinition where
+  logResult USRSymbolDefinition{..} =
+    logResult uSRSymbolDefinition_location <>
+    Logger.setItemCount 1
+
+
+instance LogResult USRSymbolReference  where
+  logResult USRSymbolReference{..} =
+    logResult uSRSymbolReference_location <>
+    Logger.setItemCount 1
+
+instance LogResult [USRSymbolReference] where
+  logResult xs = Logger.setItemCount (length xs)
+
+instance LogResult [RelatedSymbols] where
+  logResult edges = Logger.setItemCount (length edges)
+
+newtype AttrDBsLog = AttrDBsLog { attrDb :: Glean.Repo }
+instance LogResult [AttrDBsLog] where
+  logResult logs = Logger.setAttributeDbs (map (Glean.repoToText . attrDb) logs)
+
+newtype AttrStatsLog = AttrStatsLog { stats :: Text }
+instance LogResult [AttrStatsLog] where
+  logResult logs = Logger.setDynamicAttributeStats (map stats logs)
+
+--
+-- | Intern error logging
+--
+
+newtype ErrorText = ErrorText Text
+
+errorText :: GlassExceptionReason -> Text
+errorText e = case e of
+  GlassExceptionReason_noSrcFileFact t -> t
+  GlassExceptionReason_noSrcFileLinesFact t -> t
+  GlassExceptionReason_notIndexedFile t -> t
+  GlassExceptionReason_entitySearchFail t -> t
+  GlassExceptionReason_entityNotSupported t -> t
+  GlassExceptionReason_attributesError t -> t
+  GlassExceptionReason_exactRevisionNotAvailable t -> t
+  GlassExceptionReason_matchingRevisionNotAvailable t -> t
+  GlassExceptionReason_EMPTY -> ""
+
+errorsText :: NonEmpty GlassExceptionReason -> Text
+errorsText errs =
+  Text.unlines $ "Multiple errors:": map
+    (("  " <>) . errorText)
+    (NE.toList errs)
+
+data ErrorLogger = ErrorLogger
+  { errorTy :: ![GlassExceptionReason]
+  , errorGleanRepo :: ![Glean.Repo]
+    -- ^ The repo(s) in which the error(s) occurred.
+  }
+
+instance Semigroup ErrorLogger where
+  e1 <> e2 = ErrorLogger
+    { errorTy = errorTy e1 <|> errorTy e2
+    , errorGleanRepo = errorGleanRepo e1 <> errorGleanRepo e2
+    }
+
+instance Monoid ErrorLogger where
+  mempty = ErrorLogger mempty []
+
+instance LogResult ErrorLogger where
+  logResult ErrorLogger{..} =
+    case nubOrd errorTy of
+      [] -> mempty
+      [e] ->
+        Logger.setInternalError (errorText e) <>
+        Logger.setInternalErrorType (case e of
+          GlassExceptionReason_noSrcFileFact{} -> "NoSrcFileFact"
+          GlassExceptionReason_noSrcFileLinesFact{} -> "NoSrcFileLinesFact"
+          GlassExceptionReason_entitySearchFail{} -> "EntitySearchFail"
+          GlassExceptionReason_entityNotSupported{} -> "EntityNotSupported"
+          GlassExceptionReason_attributesError{} -> "AttributesError"
+          GlassExceptionReason_notIndexedFile{} -> "NotIndexedFile"
+          GlassExceptionReason_exactRevisionNotAvailable{} ->
+            "ExactRevisionNotAvaiable"
+          GlassExceptionReason_matchingRevisionNotAvailable{} ->
+            "MatchingRevisionNotAvailable"
+          GlassExceptionReason_EMPTY{} -> "EMPTY"
+        )
+      (e:es) ->
+        Logger.setInternalError (errorsText (e :| es)) <>
+        Logger.setInternalErrorType "AggregateError"
+
+class LogError a where
+  logError :: a -> ErrorLogger
+
+instance LogError GlassExceptionReason where
+  logError e = ErrorLogger [e] []
+
+instance LogError (NonEmpty GlassExceptionReason) where
+  logError (e :| []) = logError e
+  logError errors = ErrorLogger (NE.toList errors) []
+
+instance LogError Glean.Repo where
+  logError x =
+    ErrorLogger [] [x]
+
+instance LogError (NonEmpty (a, Glean.Repo)) where
+  logError = logError . NE.map snd
+
+instance LogError (NonEmpty Glean.Repo) where
+  logError (repo :| []) = logError repo
+  logError rs0 = ErrorLogger [] (NE.toList rs)
+    where
+    rs = NE.sortBy (compare `on` Glean.repo_name) rs0
+
+--
+-- Lift log accessors generically over Glass types
+--
+
+logSymbolSG :: Semigroup a => (Text -> a)
+  -> SymbolId -> a
+logSymbolSG f (SymbolId s) = f s
+
+logSymbolPathSG :: Semigroup a => (Text -> a) -> (Text -> a)
+  -> SymbolPath -> a
+logSymbolPathSG f g SymbolPath{..} =
+    f (unPath symbolPath_filepath) <>
+      g (unRepoName symbolPath_repository)
+
+logDocumentSymbolsRequestSG :: Semigroup a => (Text -> a) -> (Text -> a)
+  -> DocumentSymbolsRequest  -> a
+logDocumentSymbolsRequestSG f g DocumentSymbolsRequest{..} =
+    f (unPath documentSymbolsRequest_filepath) <>
+    g (unRepoName documentSymbolsRequest_repository)
+
+logSymbolSearchRequestSG :: Semigroup a => (Text -> a) -> (Text -> a)
+  -> SymbolSearchRequest -> a
+logSymbolSearchRequestSG logQuery logRepo SymbolSearchRequest{..} =
+  case repo of
+    Nothing -> logQuery symbolSearchRequest_name
+    Just r -> logRepo r <> logQuery symbolSearchRequest_name
+  where
+    repo = unRepoName <$> symbolSearchRequest_repo_name
+
+logUSRToDefinitionRequestSG ::
+  Semigroup a =>
+  (Text -> a) ->
+  (Text -> a) ->
+  USRToDefinitionRequest ->
+  a
+logUSRToDefinitionRequestSG
+    logQuery
+    logRepo
+    (USRToDefinitionRequest usrr repo_name) =
+  case repo of
+    Nothing -> logQuery usr
+    Just r -> logRepo r <> logQuery usr
+ where
+  usr = unUSR usrr
+  repo = unRepoName <$> repo_name
+
+logSnapshotStatus :: SnapshotStatus -> GleanGlassLogger
+logSnapshotStatus st = case st of
+  Unrequested -> mempty
+  DbError -> Logger.setSnapshot "DB error"
+  InternalError -> Logger.setSnapshot "Internal error"
+  Timeout -> Logger.setSnapshot "Timeout"
+  NotFound -> Logger.setSnapshot  "Not found"
+  ExactMatch -> Logger.setSnapshot  "Exact"
+  CompatibleMatch -> Logger.setSnapshot  "Matching"
+  Ignored -> Logger.setSnapshot  "Ignored"
+  Latest -> Logger.setSnapshot "Latest"
diff --git a/glean/glass/Glean/Glass/Main.hs b/glean/glass/Glean/Glass/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Main.hs
@@ -0,0 +1,226 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Glass.Main
+  ( mainWith
+
+  -- * Useful helpers
+  , withEnv
+  ) where
+
+import Control.Concurrent (myThreadId)
+import Control.Trace (traceMsg, (>$<))
+import Data.Hashable (hash)
+import Data.List (stripPrefix)
+import Facebook.Service ( runFacebookService' )
+import Facebook.Fb303 ( fb303Handler, withFb303 )
+import System.Timeout
+import TextShow
+import Thrift.Channel (Header)
+import Thrift.Protocol.ApplicationException.Types as Thrift
+#ifdef FBTHRIFT
+import qualified Thrift.Server.CppServer as Thrift
+#else
+import qualified Thrift.Server.HTTP as Thrift
+#endif
+import Util.EventBase ( withEventBaseDataplane )
+import Util.Log.Text ( logInfo )
+import Logger.IO (withLogger)
+
+import Control.Exception (SomeException, fromException, throwIO)
+import Data.Text (Text)
+import Data.Text.Encoding (encodeUtf8)
+import Options.Applicative (Parser)
+
+import qualified Glean
+import Glean.Init ( withOptions )
+import Glean.LocalOrRemote as Glean
+    ( Service(Remote), withBackendWithDefaultOptions )
+import Glean.Schema.Builtin.Types (schema_id)
+import Glean.Util.ConfigProvider
+    ( ConfigProvider(defaultConfigOptions, withConfigProvider) )
+import Glean.Util.Some ( Some(Some) )
+
+import Glean.Glass.RepoMapping -- site-specific
+import qualified Glean.Glass.Env as Glass
+import Glean.Glass.Repos (withLatestRepos)
+import qualified Glean.Glass.Options as Glass
+import qualified Glean.Glass.Handler.Documents as Handler
+import qualified Glean.Glass.Handler.Symbols as Handler
+import Glean.Glass.GlassService.Service ( GlassServiceCommand(..) )
+
+import Glean.Glass.Types
+  ( GlassException (GlassException, glassException_reasons),
+    GlassExceptionReason (..))
+import Glean.Glass.Env (Env'(tracer), Env)
+import Glean.Glass.Tracer ( isTracingEnabled )
+import Glean.Glass.Handler.Cxx as Cxx
+import Glean.Glass.Tracing
+  (GlassTrace(TraceCommand), GlassTraceWithId (GlassTraceWithId))
+
+kThriftCacheNoCache :: Text
+kThriftCacheNoCache = "nocache"
+
+-- | Ok, go.
+mainWith
+  :: Parser (Glass.Config GlassTraceWithId -> Glass.Config GlassTraceWithId)
+  -> IO ()
+mainWith = withGlass runGlass
+
+type Server trace = Glass.Env' trace -> Glass.Config trace -> IO ()
+
+-- | Set up the resources we'll need
+withGlass
+  :: TextShow trace
+  => Server trace -> Parser (Glass.Config trace -> Glass.Config trace) -> IO ()
+withGlass f backendsP =
+  withOptions (Glass.options backendsP) $ \config ->
+  withEnv config Nothing $ \env -> f env config
+
+-- | Construct a server environment
+withEnv
+  :: TextShow trace
+  => Glass.Config trace
+  -> Maybe Glean.Repo
+  -> (Glass.Env' trace -> IO a)
+  -> IO a
+withEnv Glass.Config{..} gleanDB f =
+  withEventBaseDataplane $ \evp ->
+  withConfigProvider defaultConfigOptions $ \cfgapi ->
+  withLogger cfgapi $ \logger ->
+  withFb303 serviceName $ \fb303 ->
+  withBackendWithDefaultOptions evp cfgapi gleanService (Just schema_id)
+    $ \backend -> do
+  scm <- sourceControl evp
+  snapshotBackend <- snapshotBackend evp
+  hst <- haxlState evp
+  withLatestRepos backend scm (Just logger)
+    (if isRemote gleanService then listDatabasesRetry else Nothing) refreshFreq
+    $ \latestGleanRepos -> do
+      repoMapping <- getRepoMapping
+      f Glass.Env
+        { gleanBackend = Some backend
+        , gleanDB = gleanDB
+        , snapshotBackend = snapshotBackend
+        , sourceControl = scm
+        , haxlState = hst
+        , ..
+        }
+
+-- | Some of the retry/logging logic only applies to remote services
+isRemote :: Service -> Bool
+isRemote service = case service of
+  Remote{} -> True
+  _ -> False
+
+-- | Kick off the server
+runGlass :: Server GlassTraceWithId
+runGlass res@Glass.Env{fb303, evp} conf@Glass.Config{..} = do
+
+  logInfo =<< welcomeMessage evp conf
+
+  let options = Thrift.defaultOptions
+        { Thrift.desiredPort = Just listenPort
+        , Thrift.numWorkerThreads = numWorkerThreads
+        }
+  runFacebookService' fb303 (glassHandler res) assignHeaders options
+
+assignHeaders :: GlassServiceCommand r -> Either SomeException r -> Header
+assignHeaders _ (Left e) | isRevisionNotAvailableException e =
+  [ (encodeUtf8 kThriftCacheNoCache, "1")]
+  where
+    isRevisionNotAvailableException e = case fromException e of
+      Just GlassException{glassException_reasons} ->
+        all isRevisionNotAvailable glassException_reasons
+      _ -> False
+    isRevisionNotAvailable e = case e of
+      GlassExceptionReason_exactRevisionNotAvailable{} -> True
+      GlassExceptionReason_matchingRevisionNotAvailable{} -> True
+      _ -> False
+assignHeaders _ _ = []
+
+-- | Perform an operation with the latest RepoMapping
+withCurrentRepoMapping :: Glass.Env -> (Glass.Env -> IO a) -> IO a
+withCurrentRepoMapping env0 fn = do
+  current <- getRepoMapping
+  fn (env0 { Glass.repoMapping = current })
+
+withRequestTracing :: Env' GlassTraceWithId -> (Env -> IO b) -> IO b
+withRequestTracing env k = do
+  enabled <- isTracingEnabled
+  if enabled
+    then do
+      -- Fix the trace id for this request traces.
+      -- Since every request is handled by a fresh new thread,
+      -- we reuse thread ids as trace ids
+      tid <- tidToIndex <$> myThreadId
+      k env{tracer = GlassTraceWithId tid >$< tracer env}
+    else k env { tracer = mempty }
+  where
+    tidToIndex tid = case stripPrefix "ThreadId " (show tid) of
+      Just n | [(i, "")] <- reads n -> i
+      _ -> hash tid -- should be unreachable
+
+-- Actual glass service handler, types from glass.thrift
+-- TODO: snapshot the env, rather than passing in the mutable fields
+--
+glassHandler :: Glass.Env' GlassTraceWithId -> GlassServiceCommand r -> IO r
+glassHandler env0 cmd =
+  Glass.withAllocationLimit env0 $
+  withRequestTracing env0 $ \env1 ->
+  withCurrentRepoMapping env1 $ \env ->
+  tracing env $
+  withTimeout $ case cmd of
+  SuperFacebookService r -> fb303Handler (Glass.fb303 env) r
+
+  -- Listing symbols in files
+  DocumentSymbolListX r opts -> Handler.documentSymbolListX env r opts
+  DocumentSymbolIndex r opts -> Handler.documentSymbolIndex env r opts
+
+  -- Navigating
+  FindReferenceRanges r opts -> Handler.findReferenceRanges env r opts
+
+  -- Symbol info
+  DescribeSymbol r opts -> Handler.describeSymbol env r opts
+  SymbolLocation r opts -> Handler.symbolLocation env r opts
+  ResolveSymbols r opts -> Handler.resolveSymbols env r opts
+
+  -- Search for symbols
+  -- by string
+  SearchSymbol r opts -> Handler.searchSymbol env r opts
+
+  -- by relationship
+  SearchRelated r opts req -> Handler.searchRelated env r opts req
+  SearchRelatedNeighborhood r opts req ->
+    Handler.searchRelatedNeighborhood env r opts req
+
+  -- C++/LSP specific
+  FileIncludeLocations r opts -> Cxx.fileIncludeLocations env r opts
+  ClangUSRToDefinition r opts -> fst <$> Cxx.clangUSRToDefinition env r opts
+  UsrToDefinition r opts -> fst <$> Cxx.usrToDefinition env r opts
+
+  where
+    tracing env
+      | SuperFacebookService{} <- cmd = id
+      | otherwise = traceMsg (tracer env) (TraceCommand cmd)
+
+    withTimeout act = do
+      -- workaround for lack of request cancellation on client-side timeout
+      result <- timeout clientTimeoutMs act
+      case result of
+        Nothing ->
+          throwIO $
+            Thrift.ApplicationException
+              "glass server timeout"
+                Thrift.ApplicationExceptionType_Timeout
+        Just r -> return r
+
+    clientTimeoutMs =
+      -- TODO get the client timeout from the Thrift request
+      30 * 1000000
diff --git a/glean/glass/Glean/Glass/NameSearch.hs b/glean/glass/Glean/Glass/NameSearch.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/NameSearch.hs
@@ -0,0 +1,680 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.NameSearch
+  (
+  -- * Search
+    SearchFn
+  , SymbolSearchData(..)
+  , ToSearchResult(..)
+  , RepoSearchResult
+  , FeelingLuckyResult(..)
+  , SingleSymbol
+  , dedupSearchResult
+
+  -- * Search
+  -- ** Search flags
+  , SearchCase(..)
+  , SearchType(..)
+  , SearchQuery(..)
+  , SearchScope(..)
+  , SearchMode(..)
+  , AngleSearch(..)
+  , QueryExpr(..)
+
+  -- ** Search query builder
+  , buildSearchQuery
+  , buildLuckyContainerQuery
+
+  -- ** scoped search
+
+  -- * for tests
+  , toScopeTokens
+  , ScopeQuery(..)
+
+  ) where
+
+import Data.Text (Text, toLower)
+import qualified Data.Text as Text
+import Data.Maybe
+import Data.List.NonEmpty as NonEmpty (NonEmpty(..), toList)
+import qualified Data.List.NonEmpty as NonEmpty
+
+import qualified Logger.GleanGlass as Logger
+
+import qualified Glean
+import Glean.Angle as Angle
+import Glean.Haxl.Repos (RepoHaxl)
+
+import Glean.Glass.Logging
+import Glean.Glass.Types (SymbolResult(..), SymbolDescription(..))
+import Glean.Glass.Utils (splitOnAny, QueryType )
+
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.CodemarkupSearch.Types as CodeSearch
+import qualified Glean.Schema.Code.Types as Code
+import qualified Data.HashMap.Strict as Map
+
+--
+-- Finding entities by name search
+--
+
+-- | Which search
+data SearchType = Exact | Prefix
+
+-- | Whether we care about case
+data SearchCase = Sensitive | Insensitive
+
+-- | Whether to parse the string at all
+data SearchScope = NoScope | Scope
+
+-- | Search modes: unique/feeling lucky or full search
+data SearchMode = Normal | FeelingLucky
+
+-- | Abstract over search predicates
+data AngleSearch = forall p . ( QueryType p, ToSearchResult p) =>
+  Search (QueryExpr p)
+
+-- | Either a fully evaluated angle query
+data QueryExpr p
+  = Complete (Angle p)
+  | InheritedScope {
+      _scopeCase :: SearchCase,
+      _baseScopeTerm :: NonEmpty Text,
+      _searchFun :: SearchCase -> [NonEmpty Text] -> Angle p
+  }
+
+-- | Named arguments to the search query builder. These come from the client
+data SearchQuery = SearchQuery {
+  sType :: SearchType,
+  sCase :: SearchCase,
+  sScope :: SearchScope,
+  sString :: Text,
+  sKinds :: [Code.SymbolKind],
+  sLangs :: [Code.Language]
+}
+
+--
+-- | Given user preferences for search type, kind and language, and the query
+-- string, choose a list of queries to run in order. results will be combined in
+-- the order of specified.
+--
+-- We combine a few search policies here.
+--
+-- - prefix searches, we prefer exact matches first. Guarantee that by running
+-- an exact match query
+-- - scope searches with prefix can be expensive, so mark as Slow, which will
+-- put a time limit on the query
+-- - searches with namespace tokens that parse as names (e.g. ::foo) get
+-- re-routed to a name search
+--
+-- Finding entities by string search. Base layer in Glean
+--
+-- There are four main flavors
+--
+-- > "Glean" , exact and sensitive
+-- > "glean" , exact and case insensitive
+-- > "Gle".. , prefix and sensitive
+-- > "GLE".. , prefix and insensitive (most generic)
+--
+-- Additionally, you can filter on the server side by kind. Empty list of
+-- kinds will return all matching entities, with or without kinds.
+--
+-- You can also filter on the server by language id.
+--
+-- In all cases we return a basic triple of (entity, location, maybe kind)
+--
+-- Search for symbols in namespaces
+--
+-- > folly::Optional
+-- > ::Optional
+-- > folly::
+-- > HH\map
+-- > ::folly::
+-- > facebook::folly::Optional
+--
+-- We go to some effort to rank query results so that "C" or "Vec" apear
+-- early (i.e. namesspaces), and in qnames, exact matches win.
+--
+buildSearchQuery :: SearchMode -> SearchQuery -> [AngleSearch]
+buildSearchQuery Normal query =
+  map (compileQuery (sKinds query) (sLangs query)) (toRankedSearchQuery query)
+buildSearchQuery FeelingLucky query =
+  map (compileQuery (sKinds query) (sLangs query)) (feelingLuckyQuery query)
+
+-- | For nested inherited queries, we have to do an inner container search
+buildLuckyContainerQuery :: SearchQuery -> NonEmpty Text -> [AngleSearch]
+buildLuckyContainerQuery query scope =
+  map (compileQuery (sKinds query) (sLangs query))
+    (feelingLuckyContainer (sCase query) scope)
+
+compileQuery
+  :: [Code.SymbolKind] -> [Code.Language] -> SearchExpr -> AngleSearch
+compileQuery sKinds sLangs e = case e of
+  -- most precise
+  -- in feeling lucky mode, free functions in the global scoped are
+  -- considered as important as classes.
+    GlobalScopedPriorityKinds sCase name -> scopeQ Exact sCase Nothing name
+      (Code.SymbolKind_Function : containerishKinds)
+    GlobalScoped sCase name ->
+      scopeQ Exact sCase Nothing name sKinds
+  -- becoming more imprecise
+    ContainerLiteral sCase name ->
+      nameQ Exact sCase name containerKinds
+    GlobalScopedPrefixly sCase name ->
+      scopeQ Prefix sCase Nothing name sKinds
+    Literal sCase name ->
+      nameQ Exact sCase name sKinds
+    Prefixly sCase name ->
+      nameQ Prefix sCase name sKinds
+    -- quite precise but different
+    Scoped sCase scope name ->
+      scopeQ Exact sCase (Just scope) name sKinds
+    ScopedPrefixly sCase scope name ->
+      scopeQ Prefix sCase (Just scope) name sKinds
+    -- meta-query
+    InheritedScoped sCase scope name ->
+      inheritedQ Exact sCase scope name sKinds
+  where
+    containerKinds = if null sKinds then containerishKinds else sKinds
+
+    -- two main search predicates: by name or by name and scope
+    nameQ sTy sCa name kinds = Search $ Complete $ codeSearchByName $
+      compileSearchQ sTy sCa (Just name) Nothing kinds sLangs
+    scopeQ sTy sCa scopes name kinds = Search $ Complete $ codeSearchByScope $
+      compileSearchQ sTy sCa (Just name) scopes kinds sLangs
+    inheritedQ sTy sCa scopes name kinds =
+      let (Inherited term, searchFn) = codeSearchByInheritedScope $
+            compileInheritedSearchQ sTy sCa name scopes kinds sLangs
+      in Search $ InheritedScope sCa term searchFn
+
+-- | Common "API"-level things, you could reasonably expect to be ranked highly
+containerishKinds :: [Code.SymbolKind]
+containerishKinds =
+  [ Code.SymbolKind_Namespace
+  , Code.SymbolKind_Class_
+  , Code.SymbolKind_Trait
+  , Code.SymbolKind_Interface
+  , Code.SymbolKind_Module
+  ]
+
+--
+-- The major search styles, in policy "accuracy" order
+--
+data SearchExpr
+  -- literal name searches
+  = ContainerLiteral SearchCase Text -- exactly "Vec" or "vec" of kind:namespace
+  | GlobalScopedPriorityKinds SearchCase Text -- exactly "vec" the class in HH
+  | GlobalScoped SearchCase Text -- exactly "genmk" in the global scope
+  | GlobalScopedPrefixly SearchCase Text -- prefix e.g. "genm".. in global scope
+  | Literal SearchCase Text  -- exactly "Vec" or "C" (or "vec" or "VEC" or "Vec"
+  | Prefixly SearchCase Text   -- "vec".. or "Vec".. etc any case
+  -- scope searches (ignoring globals)
+  | Scoped SearchCase (NonEmpty Text) Text -- "Vec\sort"
+  | ScopedPrefixly SearchCase (NonEmpty Text) Text   -- "Vec\so"..
+  -- More interesting: inherited scope terms, anchored to a base scope
+  | InheritedScoped SearchCase (NonEmpty Text) Text -- "Vec\sort"
+
+-- we do namespace (or class?) first if no kind filter, or kinds included
+searchContainer :: Text -> [Code.SymbolKind] -> SearchCase -> [SearchExpr]
+searchContainer sName sKinds sCase
+  | null sKinds
+  = [ContainerLiteral sCase sName]
+  | otherwise
+  = []
+
+-- for global literal searches, case-sensitive matches beat insensitive matches
+searchGlobal :: Text -> SearchCase -> [SearchExpr]
+searchGlobal sName sCase = case sCase of
+  Sensitive -> [GlobalScoped Sensitive sName]
+  Insensitive -> [GlobalScoped Sensitive sName, GlobalScoped Insensitive sName]
+
+-- Prefix search requested (default in codehub)
+searchGlobalPrefix :: Text -> SearchType -> SearchCase -> [SearchExpr]
+searchGlobalPrefix sName sType sCase = case sType of
+  Prefix -> [GlobalScopedPrefixly sCase sName]
+  Exact -> []
+
+-- for literal searches, case-sensitive matches beat insensitive matches
+searchLiteral :: Text -> SearchCase -> [SearchExpr]
+searchLiteral sName sCase = case sCase of
+  Sensitive -> [Literal Sensitive sName]
+  Insensitive -> [Literal Sensitive sName, Literal Insensitive sName]
+
+-- Prefix search requested (default in codehub)
+searchPrefix :: Text -> SearchType -> SearchCase -> [SearchExpr]
+searchPrefix sName sType sCase = case sType of
+  Prefix -> [Prefixly sCase sName]
+  Exact -> []
+
+-- Scope search, exact or if prefix, then exact first
+searchScope
+  :: NonEmpty Text -> Text -> SearchType -> SearchCase -> [SearchExpr]
+searchScope scope name sType sCase = case sType of
+  Exact ->
+      [ Scoped sCase scope name
+      , InheritedScoped sCase scope name
+      ]
+  -- CodeHub default: lets always make sure to do an exact case search
+  Prefix -> case sCase of
+    Sensitive ->
+      [ Scoped Sensitive scope name
+      , InheritedScoped Sensitive scope name
+      , ScopedPrefixly Sensitive scope name
+      ]
+    -- CodeHub default symbol search is prefixly, case insensitive
+    Insensitive ->
+      [ Scoped Sensitive scope name -- always aim for exact matches to appear
+      , Scoped Insensitive scope name -- even if there's a lot of matches
+      , InheritedScoped Sensitive scope name
+      , InheritedScoped Insensitive scope name
+      , ScopedPrefixly sCase scope name
+      ]
+
+-- | Ranked symbol search types.
+-- Refine the query flags to ranking policy.
+--
+-- 0. exact namespace (e.g. "Vec" or "C" or "vec" or "c")
+-- 1. maybe scope match (e.g. "Vec\sort" or "folly::optional")
+-- 2. exact string match (e.g. "Optional")
+-- 4. prefix match (e.g. "option..")
+--
+toRankedSearchQuery :: SearchQuery -> [SearchExpr]
+toRankedSearchQuery query@SearchQuery{..} = case sScope of
+  -- scope search. glass search -s  , and default on codehub
+  Scope -> case toScopeTokens sString of
+    Just scopeQ -> searchScopes scopeQ query
+    Nothing -> toRankedSearchQuery (query { sScope = NoScope })
+
+  -- not a scope search. i.e. glass cli default
+  -- we will try to match strictly against the local name of the identifier
+  NoScope -> searchGlobal sString sCase
+     <> searchContainer sString sKinds sCase
+     <> searchLiteral sString sCase
+     <> searchGlobalPrefix sString sType sCase
+     <> searchPrefix sString sType sCase
+
+searchScopes :: ScopeQuery -> SearchQuery -> [SearchExpr]
+searchScopes scopeQ SearchQuery{..} = case scopeQ of
+  -- parses as valid qname. we could also try searching for the fragments as
+  -- literals but unclear if that's useful. could search for scope symbols too
+  ScopeAndName scope name ->
+       searchScope scope name sType sCase
+    <> searchLiteral sString sCase
+  -- could be a container as well or a sub-namespace
+  ScopeOnly scope@(_ :| (_ : _)) -> -- i.e length > 1
+      searchScope (NonEmpty.fromList (NonEmpty.init scope))
+         (NonEmpty.last scope) sType sCase
+      <> searchLiteral sString sCase
+    -- singleton scope term (like 'foo::')
+  ScopeOnly (name :| []) ->
+        searchContainer name sKinds sCase
+    <> searchLiteral name sCase
+    <> searchLiteral sString sCase
+    <> searchPrefix sString sType sCase
+
+  NameOnly name -> searchLiteral name sCase <> searchPrefix name sType sCase
+
+-- | In feeling lucky mode, we do concurrent precise searches
+-- then return the first of the exact matches we hit in priority order
+-- We only need to search with limit=2 for these, so they can be fast and we
+-- can do more of them
+feelingLuckyQuery :: SearchQuery -> [SearchExpr]
+feelingLuckyQuery query@SearchQuery{..} = case sScope of
+  -- try to parse as a scope query first
+  Scope ->
+    case toScopeTokens sString of
+      -- valid qname
+      Just (ScopeAndName scope name) ->
+        luckyScope scope name ++
+        feelingLuckyQuery (query { sScope = NoScope }) -- plus try as literal
+
+      -- qname prefix, non-singleton
+      Just (ScopeOnly scopeOnly@(_ :| (_ : _))) ->
+        let scope = NonEmpty.fromList (NonEmpty.init scopeOnly)
+            name = NonEmpty.last scopeOnly
+        in
+          luckyScope scope name ++
+          feelingLuckyQuery (query { sScope = NoScope }) -- plus try as literal
+
+      -- prefix part (e.g. `Foo::`)
+      Just (ScopeOnly (name :| [])) ->
+        feelingLuckyQuery (query {
+          sScope = NoScope,
+          sString = name }
+        )
+      -- suffix part (e.g. `::bar`)
+      Just (NameOnly name) ->
+        feelingLuckyQuery (query { sScope = NoScope, sString = name })
+
+      -- doesn't parse, just usual literal search
+      Nothing -> feelingLuckyQuery (query { sScope = NoScope })
+
+  -- not a scope search. i.e. glass cli default
+  -- we will try to match strictly against the local name of the identifier
+  -- I think we should be respecting the 'case sensitive flag here?
+  NoScope ->
+    [ GlobalScopedPriorityKinds Sensitive sString -- "vec" the class
+    , GlobalScoped Sensitive sString -- "genmk", global "C"
+    , GlobalScoped Insensitive sString -- "Vec" vs "vec", match above containers
+    , ContainerLiteral Sensitive sString -- "C" or "vec"
+    , ContainerLiteral Insensitive sString
+    , Literal Sensitive sString
+    , Literal Insensitive sString
+    , GlobalScopedPrefixly Sensitive sString
+    , GlobalScopedPrefixly Insensitive sString
+    , Prefixly Sensitive sString  -- any sensitive prefix
+    , Prefixly Insensitive sString  -- any insensitive prefix, broadest possible
+    ]
+  where
+    luckyScope scope name =
+      [ Scoped Sensitive scope name
+      , Scoped Insensitive scope name
+      , InheritedScoped Sensitive scope name
+      , InheritedScoped Insensitive scope name
+      , ScopedPrefixly Sensitive scope name
+      , ScopedPrefixly Insensitive scope name
+      ]
+
+-- | For inherited scope terms we need to a (nested) guess as to the parent
+-- scope to seed the search. It's like feelingLucky, but we know it has to be
+-- a container-ish thing
+feelingLuckyContainer :: SearchCase -> NonEmpty Text -> [SearchExpr]
+feelingLuckyContainer sCase scopes = case scopes of
+  container :| [] ->
+    [ GlobalScopedPriorityKinds Sensitive container
+    , ContainerLiteral Sensitive container
+    , GlobalScoped Sensitive container
+    , GlobalScopedPriorityKinds Insensitive container
+    , ContainerLiteral Insensitive container
+    , GlobalScoped Insensitive container -- if sCase == Sensitive we can skip
+    , Literal Sensitive container
+    , Literal Insensitive container
+    ]
+  -- "a::b::c" -> ([a,b], c)
+  _ :| _ -> case (NonEmpty.init scopes, NonEmpty.last scopes) of
+    (path, container) -> case path of
+      [] -> feelingLuckyContainer sCase (container :| [])
+      (p:ps) ->
+        let nonEmptyPath = p :| ps
+        in
+          [ Scoped Sensitive nonEmptyPath container
+          , Scoped Insensitive nonEmptyPath container
+          ] -- or assume the path is wrong and try to find container?
+          ++ feelingLuckyContainer sCase (container :| [])
+
+-- | Search params compiled to Angle expressions
+data SearchQ q = SearchQ {
+    nameQ :: Angle Text,
+    caseQ  :: Angle CodeSearch.SearchCase,
+    scopeQ :: q,
+    mKindQ :: Maybe (Angle Code.SymbolKind),
+    mLangQ :: Maybe (Angle Code.Language)
+  }
+
+-- | Regular searches compile into search terms directly
+newtype Direct = Direct { scopeTerm :: Maybe (Angle [Text]) }
+
+-- | Inherited scope terms are suspended into a staged computation
+-- that produces terms for a new direct query
+--
+-- We won't try to support prefix versions of this
+--
+newtype Inherited = Inherited {
+    _scopeTerm :: NonEmpty Text -- base entity of the search
+  }
+
+--
+-- Translate our structured search values into Angle expressions
+--
+compileSearchQ
+  :: SearchType -> SearchCase -> Maybe Text
+  -> Maybe (NonEmpty Text)
+  -> [Code.SymbolKind] -> [Code.Language] -> SearchQ Direct
+compileSearchQ = compileAnySearchQ id (\a b -> Direct (toScopeQuery a b))
+
+--
+-- Inherited searches: the scope term is non-empty and never Nothing/wild/global
+--
+compileInheritedSearchQ
+  :: SearchType -> SearchCase -> Text -> NonEmpty Text
+  -> [Code.SymbolKind] -> [Code.Language] -> SearchQ Inherited
+compileInheritedSearchQ = compileAnySearchQ Just (const Inherited)
+
+--
+-- Or translate into a suspended computation
+--
+compileAnySearchQ
+  :: (name -> Maybe Text)
+  -> (SearchCase -> scope -> scopeTerm)
+  -> SearchType -> SearchCase
+  -> name
+  -> scope
+  -> [Code.SymbolKind] -> [Code.Language] -> SearchQ scopeTerm
+compileAnySearchQ nameFn scopeFn sType sCase name scope kinds langs =
+    SearchQ{..}
+  where
+    nameQ = toNameQuery sType sCase (nameFn name)
+    scopeQ = scopeFn sCase scope
+    caseQ = toCaseQuery sCase
+    mKindQ = toEnumSet kinds
+    mLangQ = toEnumSet langs
+
+-- We support scope insensitive queries, so check that
+toScopeQuery :: SearchCase -> Maybe (NonEmpty Text) -> Maybe (Angle [Text])
+toScopeQuery _ Nothing = Nothing -- corresponds to a global scoped search
+toScopeQuery sCase (Just scope) = Just (array (map string scopeLits))
+  where
+    scopeLits = case sCase of
+      Sensitive -> toList scope
+      Insensitive -> map toLower (toList scope)
+
+toNameQuery :: SearchType -> SearchCase -> Maybe Text -> Angle Text
+toNameQuery _ _ Nothing = wild
+toNameQuery sType sCase (Just name)= case sType of
+    Exact -> string nameLit
+    Prefix -> stringPrefix nameLit
+  where
+    nameLit = case sCase of
+      Sensitive -> name
+      Insensitive -> toLower name
+
+toEnumSet :: AngleEnum a => [a] -> Maybe (Angle (AngleEnumTy a))
+toEnumSet langs = case langs of
+  [] -> Nothing -- n.b. unconstrained
+  ls -> Just $ foldr1 (.|) (map enum ls) -- restrict to specific langs
+
+toCaseQuery :: SearchCase -> Angle CodeSearch.SearchCase
+toCaseQuery sCase = enum $ case sCase of
+  Sensitive -> CodeSearch.SearchCase_Sensitive
+  Insensitive -> CodeSearch.SearchCase_Insensitive
+
+-- | Variants of the scope query syntax
+data ScopeQuery
+  = ScopeAndName (NonEmpty Text) !Text -- ::a::b::ident
+  | ScopeOnly (NonEmpty Text) -- ::a::b:: or a::
+  | NameOnly !Text -- ::a
+  deriving (Eq, Show)
+
+-- | If it looks like we can parse this as a qualified name, then do that
+-- We want to avoid any "" or wild cards appearing until perf is ok.
+toScopeTokens :: Text -> Maybe ScopeQuery
+toScopeTokens str = go (splitOnAny delimiters str)
+  where
+    -- these are applied in order
+    delimiters = ["::", "\\", "."]
+
+    -- first match with 2 or more scope fragments
+    go :: [Text] -> Maybe ScopeQuery
+    go [] = Nothing
+    go [_] = Nothing -- i.e. this isn't a scope query
+    go toks@(_:_:_) = case (dropWhile Text.null (init toks), last toks) of
+      ([],"") -> Nothing -- i.e. "::"
+      ([],name) -> Just (NameOnly name) -- i.e. ::b
+      (s:ss, "") -> Just (ScopeOnly (s :| ss)) -- i.e. a:: or ::a::
+      (s:ss, name) -> Just (ScopeAndName (s :| ss) name) -- a::b::c or ::a::b
+
+--
+-- Actual Glean queries for search
+--
+
+--
+-- Find entities by strings, with an optional kind expression filter
+--
+codeSearchByName :: SearchQ Direct -> Angle CodeSearch.SearchByName
+codeSearchByName SearchQ{..} =
+  vars $ \p langs (k :: Angle (Maybe Code.SymbolKind)) ->
+    p `where_` [
+      langs .= sig languagePat,
+      k .= sig kindPat,
+      p .= predicate @CodeSearch.SearchByName (
+        rec $
+          field @"name" nameQ $ -- may be prefix
+          field @"searchcase" caseQ $
+          field @"kind" k $ -- specific kinds only
+          field @"language" langs -- optional language filters
+        end)
+    ]
+  where
+    kindPat = maybe wild just mKindQ
+    languagePat = fromMaybe wild mLangQ
+
+--
+-- Find entities by name in tokenized namespace
+--
+codeSearchByScope :: SearchQ Direct -> Angle CodeSearch.SearchByScope
+codeSearchByScope SearchQ{..} =
+  vars $ \p langs (k :: Angle (Maybe Code.SymbolKind)) ->
+    p `where_` [
+      langs .= sig languagePat,
+      k .= sig kindPat,
+      p .= predicate @CodeSearch.SearchByScope (
+        rec $
+          field @"name" nameQ $
+          field @"scope" scopePat $
+          field @"searchcase" caseQ $
+          field @"kind" k $ -- specific kinds only
+          field @"language" languagePat -- optional language filters
+        end)
+    ]
+  where
+    scopePat = fromMaybe (array []) (scopeTerm scopeQ) -- Nothing ==global scope
+    kindPat = maybe wild just mKindQ
+    languagePat = fromMaybe wild mLangQ
+
+--
+-- A suspended code search by scope with disjoint scope terms
+-- It's like a regular codeSearchByScope, but we evaluate the scope term
+-- to a set externally first, then subsitute into the angle query
+--
+codeSearchByInheritedScope
+  :: SearchQ Inherited
+  -> (Inherited,
+      SearchCase -> [NonEmpty Text] -> Angle CodeSearch.SearchByScope)
+codeSearchByInheritedScope SearchQ{..} = (scopeQ, queryFn)
+  where
+    kindPat = maybe wild just mKindQ
+    languagePat = fromMaybe wild mLangQ
+
+    queryFn = \caseTerm scopeTerm ->
+      let
+        scopePat = fromMaybe (array []) (toScopeSetQuery caseTerm scopeTerm)
+      in
+        vars $ \p langs k (s :: Angle [Text]) ->
+          p `where_` [
+            s .= scopePat,
+            langs .= sig languagePat,
+            k .= sig kindPat,
+            p .= predicate @CodeSearch.SearchByScope (
+              rec $
+                field @"name" nameQ $
+                field @"scope" s $
+                field @"searchcase" caseQ $
+                field @"kind" k $ -- specific kinds only
+                field @"language" langs -- optional language filters
+              end)
+          ]
+
+-- | Scope terms expanded into set of names, then compiled to disjoint query
+--
+-- Compile set of terms to regular scope queries, then compose them with .|
+--
+toScopeSetQuery :: SearchCase -> [NonEmpty Text] -> Maybe (Angle [Text])
+toScopeSetQuery _ [] = Nothing
+toScopeSetQuery sCase ts =  Just $ foldr1 (.|) (catMaybes scopeQs)
+  where
+    scopeQs = map (toScopeQuery sCase . Just) ts
+
+--
+-- A class for converting the different search predicates to a standard format
+--
+
+type SearchFn
+  = SearchCase
+  -> Text
+  -> [Code.SymbolKind]
+  -> [Code.Language]
+  -> Angle CodeSearch.SearchByName
+
+-- | Glean-specific types from symbol search
+-- note could return the language id but its also cheap to recompute from entity
+data SymbolSearchData = SymbolSearchData
+  { srEntity :: !Code.Entity
+  , srLocation :: !Code.Location
+  , srKind :: !(Maybe Code.SymbolKind)
+  }
+
+-- | We need most of the result of the predicate, so rather than a
+-- data query we just unmarshall here and call the predicate directly
+class ToSearchResult a where
+  -- normalize predicate to search result type
+  toSearchResult :: a -> RepoHaxl u w SymbolSearchData
+
+instance ToSearchResult CodeSearch.SearchByName where
+  toSearchResult p = do
+    CodeSearch.SearchByName_key{..} <- Glean.keyOf p
+    pure $ SymbolSearchData
+      searchByName_key_entity
+      searchByName_key_location
+      searchByName_key_kind
+
+instance ToSearchResult CodeSearch.SearchByScope where
+  toSearchResult p = do
+    CodeSearch.SearchByScope_key{..} <- Glean.keyOf p
+    pure $ SymbolSearchData
+      searchByScope_key_entity
+      searchByScope_key_location
+      searchByScope_key_kind
+
+-- | Type of processed search results from a single scm repo
+type RepoSearchResult = [SingleSymbol]
+
+-- | Ensure all SymbolResults in a (repo-wide) search result are unique.
+--
+--   We can have multiple descriptions when querying dbs
+--   having the same content (for instance, incremental and full
+--   DBs). In that case, descriptions differ only in the repo_hash
+--   field.
+--   dedupSearchResult picks one abitrarily. TODO pick the most
+--   recent revision one, and don't discard a description if it
+--   differs by more than the repo_hash field
+dedupSearchResult :: RepoSearchResult -> RepoSearchResult
+dedupSearchResult results = Map.toList $ Map.fromListWith max results
+
+-- An un-concatenated set of query results to search for unique hits in
+-- within one scm repo, across dbs, across queries, a set of result symbols.
+newtype FeelingLuckyResult = FeelingLuckyResult [[RepoSearchResult]]
+
+instance LogResult FeelingLuckyResult where
+  logResult (FeelingLuckyResult rs) =
+    Logger.setItemCount
+      (sum (map (sum . map length) rs))
+
+type SingleSymbol = (SymbolResult,Maybe SymbolDescription)
diff --git a/glean/glass/Glean/Glass/Neighborhood.hs b/glean/glass/Glean/Glass/Neighborhood.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Neighborhood.hs
@@ -0,0 +1,270 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Neighborhood ( searchNeighborhood) where
+
+import Data.Ord ( comparing )
+import Data.Text ( Text )
+import qualified Data.Map.Strict as Map
+
+import Util.List ( uniq, uniqBy )
+
+import Glean.Haxl.Repos as Glean ( withRepo, RepoHaxl, ReposHaxl )
+
+import qualified Glean.Schema.Code.Types as Code
+
+import Glean.Glass.Utils ( fst4 )
+import Glean.Glass.Describe
+    ( mkSymbolDescription, mkBriefSymbolDescription )
+import Glean.Glass.Repos ( Language(Language_Hack), ScmRevisions )
+import Glean.Glass.Types
+    ( SymbolId(SymbolId),
+      RelatedNeighborhoodRequest(..),
+      SymbolDescription,
+      RelatedNeighborhoodResult(..),
+      InheritedSymbols(..),
+      RelatedSymbols(RelatedSymbols),
+      RelationDirection(RelationDirection_Parent,
+                        RelationDirection_Child),
+      RelationType(RelationType_Extends, RelationType_Contains,
+                   RelationType_RequireExtends, RelationType_RequireImplements,
+                   RelationType_RequireClass),
+      RepoName,
+      SymbolBasicDescription,
+      SymbolDescription(..) )
+import Glean.Glass.Search as Search
+    ( CodeEntityLocation(CodeEntityLocation, entityName, entityRange,
+                         entityFile, entity),
+      SearchEntity(..) )
+import Glean.Glass.SearchRelated (InheritedContainer, LocatedEntity)
+import qualified Glean.Glass.SearchRelated as Search
+import Glean.Glass.Search.Class ( ResultLocation )
+
+type SearchRelatedQuery u w = Code.Entity -> RepoName
+      -> RepoHaxl u w [Search.RelatedLocatedEntities]
+type SearchRelatedList u w = Code.Entity -> RepoName
+      -> RepoHaxl u w [Search.LocatedEntity]
+
+-- being careful to keep things with clear data dependencies
+searchNeighborhood
+  :: Int
+  -> RelatedNeighborhoodRequest
+  -> SymbolId
+  -> RepoName
+  -> ScmRevisions -> Language -> SearchEntity (ResultLocation Code.Entity)
+  -> ReposHaxl u w RelatedNeighborhoodResult
+searchNeighborhood limit
+    RelatedNeighborhoodRequest{..} sym repo scmRevs lang baseEntity =
+  withRepo (entityRepo baseEntity) $ do
+    let entity = fst4 $ decl baseEntity
+    a <- childrenContains1Level
+          (fromIntegral relatedNeighborhoodRequest_children_limit) entity repo
+    b <- childrenExtends1Level
+          (fromIntegral relatedNeighborhoodRequest_inherited_limit) entity repo
+    c <- parentContainsNLevel
+          (fromIntegral relatedNeighborhoodRequest_parent_depth) entity repo
+    d <- parentExtends1Level limit entity repo
+    e <- parentRequire RelationType_RequireExtends limit entity repo
+    f <- parentRequire RelationType_RequireImplements limit entity repo
+    g <- parentRequire RelationType_RequireClass limit entity repo
+
+    (parents, members, inheritedSyms) <- inheritedSymbols lang limit
+      (fromIntegral relatedNeighborhoodRequest_inherited_limit)
+      (if relatedNeighborhoodRequest_hide_uninteresting
+        then Search.HideUninteresting
+        else Search.ShowAll)
+      entity repo
+    -- syms visible to the client, we need their full details
+    let !syms = uniqBy (comparing snd) $ fromSearchEntity sym baseEntity :
+            a ++ flattenEdges c ++ members
+              -- full descriptions of final methods
+    descriptions <- Map.fromAscList <$> mapM (mkDescribe repo scmRevs) syms
+    -- brief descriptions for inherited things
+    basics <- Map.fromAscList <$> mapM (mkBriefDescribe repo scmRevs)
+      (uniqBy (comparing snd) $ (b ++ d ++ e ++ f ++ g) ++ parents)
+
+    return $ RelatedNeighborhoodResult {
+        relatedNeighborhoodResult_childrenContained = map snd a,
+        relatedNeighborhoodResult_childrenExtended = map snd b,
+        relatedNeighborhoodResult_containsParents = symbolIdPairs c,
+        relatedNeighborhoodResult_parentsExtended = map snd d,
+        relatedNeighborhoodResult_inheritedSymbols = inheritedSyms,
+        relatedNeighborhoodResult_symbolDetails = descriptions,
+        relatedNeighborhoodResult_symbolBasicDetails = basics,
+        relatedNeighborhoodResult_requireExtends = map snd e,
+        relatedNeighborhoodResult_requireImplements = map snd f,
+        relatedNeighborhoodResult_requireClass = map snd g
+      }
+
+-- building map of sym id -> descriptions, by first occurence
+mkDescribe
+  :: RepoName
+  -> ScmRevisions
+  -> Search.LocatedEntity
+  -> Glean.RepoHaxl u w (Text, SymbolDescription)
+mkDescribe repo scmRevs e@(_,SymbolId rawSymId) =
+  (rawSymId,) <$> describe repo scmRevs e
+
+describe
+   :: RepoName
+  -> ScmRevisions
+  -> Search.LocatedEntity
+  -> Glean.RepoHaxl u w SymbolDescription
+describe repo scmRevs ((entity, entityFile, entityRange, entityName), symId)
+  = mkSymbolDescription symId scmRevs repo CodeEntityLocation{..} Nothing
+
+-- for children by inheritance, we only need name, kind, parent name, sym id
+-- and signature. In particular, we don't e.g. need comments or annotations
+-- or type xrefs
+mkBriefDescribe
+  :: RepoName
+  -> ScmRevisions
+  -> Search.LocatedEntity
+  -> Glean.RepoHaxl u w (Text, SymbolBasicDescription)
+mkBriefDescribe repo scmRevs e@(_,SymbolId rawSymId) =
+  (rawSymId,) <$> briefDescribe repo scmRevs e
+
+briefDescribe
+  :: RepoName
+  -> ScmRevisions
+  -> Search.LocatedEntity
+  -> Glean.RepoHaxl u w SymbolBasicDescription
+briefDescribe repo scmRevs
+    ((entity, entityFile, entityRange, entityName), symId)
+  = mkBriefSymbolDescription symId scmRevs repo CodeEntityLocation{..}
+    Nothing
+
+childrenContains1Level :: Int -> SearchRelatedList u w
+childrenContains1Level limit baseEntity repo = map Search.childRL <$>
+  Search.searchRelatedEntities
+    limit
+    Search.ShowAll
+    Search.NotRecursive
+    RelationDirection_Child
+    RelationType_Contains
+    baseEntity
+    repo
+
+-- children by `extends`. typically a list. this includes method overrides
+-- note that some methods have a lot of overrides (50k+) so be careful with
+-- the limit values
+childrenExtends1Level :: Int -> SearchRelatedList u w
+childrenExtends1Level limit baseEntity repo = map Search.childRL <$>
+  Search.searchRelatedEntities
+    limit
+    Search.ShowAll
+    Search.NotRecursive
+    RelationDirection_Child
+    RelationType_Extends
+    baseEntity
+    repo
+
+-- Direct inheritance parents
+parentExtends1Level :: Int -> SearchRelatedList u w
+parentExtends1Level limit baseEntity repo = map Search.parentRL <$>
+  Search.searchRelatedEntities
+    limit
+    Search.ShowAll
+    Search.NotRecursive
+    RelationDirection_Parent
+    RelationType_Extends
+    baseEntity
+    repo
+
+-- N levels of container hierarchy
+parentContainsNLevel :: Int -> SearchRelatedQuery u w
+parentContainsNLevel limit baseEntity repo = Search.searchRelatedEntities
+  limit
+  Search.ShowAll
+  Search.Recursive
+  RelationDirection_Parent
+  RelationType_Contains
+  baseEntity
+  repo
+
+--  Returns (recursively) parent entities, inherited members
+--  and inherited symbols of a container entity
+--
+--  If not directly available in DB computes an over approximation
+--  of inherited methods computed by unioning the contained children
+--  of inheritedLimit levels of extended parents
+inheritedSymbols
+  :: Language -> Int -> Int -> Search.SearchStyle -> Code.Entity -> RepoName
+  -> RepoHaxl u w ([LocatedEntity], [LocatedEntity], [InheritedSymbols])
+
+-- Optimized implementation for Hack: all members inherited into scope by parent
+inheritedSymbols Language_Hack
+  memberLimit _inheritedLimit style entity repo = do
+    inherited <- Search.searchInheritedEntities style memberLimit entity repo
+    let parents = map fst inherited
+        members = concatMap snd inherited
+        inheritedSyms = map inheritedSymbolIdSets inherited
+    return (parents, members, inheritedSyms)
+
+-- Fall back implementation: enumerate inherited parents, and find their members
+inheritedSymbols _ memberLimit inheritedLimit style entity repo = do
+    topoEdges <- Search.searchRelatedEntities  -- "extend relationship"
+      inheritedLimit
+      style
+      Search.Recursive
+      RelationDirection_Parent
+      RelationType_Extends
+      entity
+      repo
+    let parents = uniq (map Search.parentRL topoEdges)
+    inherited <- mapM (childrenOf memberLimit repo) parents
+    let inheritedSyms = map inheritedSymbolIdSets inherited
+    let members = concatMap snd inherited
+    return (parents, members, inheritedSyms)
+
+-- Fetch the "required" parent entities
+-- This only exists for Hack entity so we can avoid
+-- useless queries for other languages
+parentRequire :: RelationType -> Int -> SearchRelatedList u w
+parentRequire relationType limit baseEntity repo =
+  case baseEntity of
+    Code.Entity_hack _ ->
+        map Search.parentRL <$>
+          Search.searchRelatedEntities
+            limit
+            Search.ShowAll
+            Search.NotRecursive
+            RelationDirection_Parent
+            relationType
+            baseEntity
+            repo
+    _ -> return []
+
+childrenOf
+  :: Int -> RepoName -> Search.LocatedEntity
+  -> Glean.RepoHaxl u w (Search.LocatedEntity, [Search.LocatedEntity])
+childrenOf limit repo parent = (parent,) <$>
+  childrenContains1Level limit (toEntity parent) repo
+
+toEntity :: Search.LocatedEntity -> Code.Entity
+toEntity ((entity, _file, _rangespan, _name), _symId) = entity
+
+symbolIdPairs :: [Search.RelatedLocatedEntities] -> [RelatedSymbols]
+symbolIdPairs = map (\Search.RelatedLocatedEntities{..} ->
+  RelatedSymbols (snd parentRL) (snd childRL) Nothing)
+
+inheritedSymbolIdSets :: InheritedContainer -> InheritedSymbols
+inheritedSymbolIdSets (parent, children) = InheritedSymbols {
+    inheritedSymbols_base = snd parent,
+    inheritedSymbols_provides = map snd children
+  }
+
+fromSearchEntity
+  :: SymbolId
+  -> SearchEntity (ResultLocation Code.Entity)
+  -> Search.LocatedEntity
+fromSearchEntity symId SearchEntity{..} = (decl, symId)
+
+flattenEdges :: [Search.RelatedLocatedEntities] -> [Search.LocatedEntity]
+flattenEdges pairs = concat
+  [ [ e1, e2 ] | Search.RelatedLocatedEntities e1 e2 <- pairs ]
diff --git a/glean/glass/Glean/Glass/Options.hs b/glean/glass/Glean/Glass/Options.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Options.hs
@@ -0,0 +1,96 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Glass.Options
+  ( options
+  , configParser
+  ) where
+
+import Options.Applicative
+import Data.Text (Text)
+import TextShow
+
+import Control.Trace
+import qualified Haxl.Core as Haxl
+
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Util.Some (Some(..))
+import Util.Time
+
+import qualified Glean.Glass.Env as Glass
+import qualified Glean.Glass.Config as Glass
+import Glean.Glass.SnapshotBackend
+import Glean.Glass.SourceControl
+import Glean.Glass.Config (defaultWelcomeMessage)
+
+options
+  :: TextShow a
+  => Parser (Glass.Config a -> Glass.Config a) -> ParserInfo (Glass.Config a)
+options mod = info (helper <*> mod <*> configParser) fullDesc
+
+configParser :: TextShow a => Parser (Glass.Config a)
+configParser = do
+  gleanService <- Glean.options
+  listenPort <- portParser
+  serviceName <- serviceNameParser
+  refreshFreq <- refreshFreqParser
+  listDatabasesRetry <- listDatabasesRetryParser
+  numWorkerThreads <- workerThreadsParser
+  snapshotBackend <- pure $ pure $ pure $ Some NilSnapshotBackend
+  sourceControl <- pure (const (return (Some NilSourceControl)))
+  haxlState <- pure (const (return Haxl.stateEmpty))
+  allocationLimit <- pure (return Nothing)
+  tracer <- tracerParser
+  return $ Glass.Config{
+        configKey = Glass.defaultConfigKey,
+        welcomeMessage = pure (pure . defaultWelcomeMessage),
+        useSnapshotsForSymbolsList = pure True,
+         ..}
+
+portParser :: Parser Int
+portParser = option auto $ mconcat
+  [ long "port"
+  , short 'p'
+  , help "Default port to listen on"
+  , value Glass.defaultPort
+  ]
+
+refreshFreqParser :: Parser DiffTimePoints
+refreshFreqParser = option (minutes <$> auto) $ mconcat
+  [ long "refresh"
+  , help "Default update frequency for latest repos (minutes)"
+  , value Glass.defaultRefreshFreq
+  ]
+
+listDatabasesRetryParser :: Parser (Maybe Int)
+listDatabasesRetryParser = optional $ option auto $ mconcat
+  [ long "list-databases-retry"
+  , help "Default retry attempts for listing databases"
+  , value Glass.defaultListDatabasesRetry
+  ]
+
+serviceNameParser :: Parser Text
+serviceNameParser = option auto $ mconcat
+  [ long "service-name"
+  , help "Override service name for fb303 etc"
+  , value Glass.defaultServiceName
+  ]
+
+workerThreadsParser :: Parser (Maybe Int)
+workerThreadsParser = optional $ option auto $ mconcat
+  [ long "worker-threads"
+  , help "Number of worker threads (defaults to the number of cores)"
+  ]
+
+tracerParser :: TextShow a => Parser (Tracer a)
+tracerParser = flag mempty (vlogShowTracer $ const 0) $ mconcat
+  [ long "trace-to-vlog"
+  , help "Sends telemetry traces to vlog"
+  ]
diff --git a/glean/glass/Glean/Glass/Path.hs b/glean/glass/Glean/Glass/Path.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Path.hs
@@ -0,0 +1,25 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Path where
+
+import Glean.Glass.Base ( SymbolRepoPath(..), GleanPath(GleanPath) )
+import qualified Glean.Glass.Types as Glass
+
+-- TODO: We probably want to read the repo config from a file, or put it in a
+-- server config
+
+-- Convert repo-relative Glass normalized paths to Glean-index specific paths
+toGleanPath :: SymbolRepoPath -> GleanPath
+toGleanPath (SymbolRepoPath _ (Glass.Path path)) = GleanPath path
+
+-- | Site-level rules for processing index paths to the filesystem
+-- Glass paths are always repo-root relative.
+fromGleanPath
+  :: Glass.RepoName -> GleanPath -> SymbolRepoPath
+fromGleanPath repo (GleanPath path) = SymbolRepoPath repo $ Glass.Path path
diff --git a/glean/glass/Glean/Glass/Pretty/Angle.hs b/glean/glass/Glean/Glass/Pretty/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Angle.hs
@@ -0,0 +1,54 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Glass.Pretty.Angle
+  (
+    prettyAngleSignature
+  ) where
+
+import Data.Text ( pack )
+import Compat.Prettyprinter
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Schema.CodeAnglelang.Types as A ( Entity(..) )
+import qualified Glean.Schema.Anglelang.Types as A
+import Glean.Glass.Types
+import Glean.Glass.SymbolId.Class (toQName, ToQName)
+import Glean.Glass.SymbolId.Angle ({- instances -})
+import Glean.Haxl.Repos (RepoHaxl)
+
+
+prettyAngleSignature
+  :: LayoutOptions
+  -> A.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyAngleSignature opts entity = do
+  let decl = A.entity_decl entity
+      kind = prettyDeclKind decl
+  name <- prettyName decl
+  let doc = layoutSmart opts (kind <+> name)
+      annDoc = reAnnotateS (\() -> Nothing) doc
+  return $ Just annDoc
+
+prettyDeclKind :: A.Declaration -> Doc ()
+prettyDeclKind decl = case decl of
+  A.Declaration_pred _ -> pretty $ pack "predicate"
+  A.Declaration_ty _ -> pretty $ pack "type"
+  A.Declaration_schema _ -> pretty $ pack "schema"
+  _ -> emptyDoc
+
+
+prettyName
+  :: ToQName A.Declaration => A.Declaration
+  -> RepoHaxl u w (Doc ())
+prettyName decl = do
+  qname <- toQName decl
+  case qname of
+    Left _ -> return emptyDoc
+    Right (Name name,_ns) -> return (pretty name)
diff --git a/glean/glass/Glean/Glass/Pretty/Cxx.hs b/glean/glass/Glean/Glass/Pretty/Cxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Cxx.hs
@@ -0,0 +1,485 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Pretty.Cxx (
+  prettyCxxSignature,
+  Qualified(..)
+) where
+
+import qualified Glean
+
+import qualified Glean.Schema.CodeCxx.Types as Cxx
+import qualified Glean.Schema.Cxx1.Types as Cxx
+
+import Data.Text ( Text, intercalate )
+import Compat.Prettyprinter
+  (pretty, layoutSmart, LayoutOptions, SimpleDocStream, reAnnotateS)
+import Data.Maybe ( fromMaybe )
+import qualified Data.Text as Text
+import Safe (atMay)
+import Util.Text (textShow)
+import Glean.Glass.Types ( SymbolId(..) )
+
+(<+>) :: Text -> Text -> Text
+"" <+> b = b
+a <+> "" = a
+a <+> b = a <> " " <> b
+
+(<::>) :: Text -> Text -> Text
+a <::> b = a <> "::" <> b
+
+data Qualified = Qualified | Unqualified
+
+isQualified :: Qualified -> Bool
+isQualified Qualified = True
+isQualified Unqualified = False
+
+-- This behavior is intended to match clangd 'hover' feature
+-- to make sure, user would not notice the change from
+-- clangd language server to glean-glass language server.
+--
+-- Some signatures doesn't match clangd
+--   * glean-glass signatures have more information than clangd (easy to fix)
+--   * glean-glass signatures have less information than clangd (hard to fix,
+--      as it may involve changing of the cxx schema and clang indexer changes)
+--
+-- Signatures can be qualified or unqualified. This affects whether the
+-- scope of the symbol will be output. Other symbol signatures in
+-- the pretty signature will remain fully qualified even if this is
+-- false.
+prettyCxxSignature
+  :: LayoutOptions
+  -> Cxx.Entity
+  -> Qualified
+  -> Maybe (SimpleDocStream (Maybe SymbolId))
+prettyCxxSignature opts e qualified = case text of
+    "" -> Nothing
+    _ ->  Just $ reAnnotateS (const Nothing) $ layoutSmart opts $ pretty text
+  where
+    text = case e of
+      Cxx.Entity_decl decl -> prettyDecl decl qualified
+      Cxx.Entity_defn def -> prettyDefinition def qualified
+      Cxx.Entity_enumerator x ->
+        prettyEnumerator x -- clangd doesn't qualify enumerators
+      Cxx.Entity_objcSelectorSlot slot -> prettyObjcSelectorSlot slot
+      Cxx.Entity_EMPTY -> intentionallyEmpty
+
+intentionallyEmpty :: Text
+intentionallyEmpty = ""
+
+todoEmpty :: Text
+todoEmpty = ""
+
+-- The key should always be there, but it may not be fetched.
+-- It is a responsibility of the caller to make sure
+-- the Entity is fully fetched before
+-- generating Entity's signature
+missingKey :: Text
+missingKey = ""
+
+anonymousNamespace :: Text
+anonymousNamespace = "(anonymous)"
+
+implicitUnderlyingEnumType :: Text
+implicitUnderlyingEnumType = "int"
+
+prettyEnumerator :: Cxx.Enumerator -> Text
+prettyEnumerator (Cxx.Enumerator _ mkey) = case mkey of
+  Nothing -> missingKey
+  -- clangd just shows name and just it :( it is not useful actually
+  -- but we want to stick to the clangd
+  Just (Cxx.Enumerator_key name _ _) -> prettyName name
+
+-- Instead we could have had potentially:
+-- -> prettyEnum enum_decl <+> "{ " <+> prettyName name <+> " }"
+-- which would have produced something like
+-- "enum class biggrep::FetchResult {  NoSpace  }"
+--   * Which doesn't have all values of the enum
+--   * but it is easy to read
+--   * and it WILL be correctly cpp-highlighted
+
+prettyDecl :: Cxx.Declaration -> Qualified -> Text
+prettyDecl d qualified = case d of
+  Cxx.Declaration_namespace_ x -> prettyNamespace x qualified
+  Cxx.Declaration_usingDeclaration x -> prettyUsingDecl x
+  Cxx.Declaration_usingDirective x -> prettyUsingDirective x
+  Cxx.Declaration_enum_ x -> prettyEnum x qualified
+  Cxx.Declaration_variable x -> prettyVariable x qualified
+  Cxx.Declaration_objcContainer _ -> intentionallyEmpty
+  Cxx.Declaration_objcMethod _ -> intentionallyEmpty
+  Cxx.Declaration_objcProperty _ -> intentionallyEmpty
+  Cxx.Declaration_typeAlias x -> prettyTypeAlias x qualified
+  Cxx.Declaration_namespaceAlias x -> prettyNamespaceAlias x qualified
+  Cxx.Declaration_record_ x -> prettyRecord x qualified
+  Cxx.Declaration_function_ x -> prettyFunction x qualified
+  Cxx.Declaration_EMPTY -> intentionallyEmpty
+
+prettyEnum :: Cxx.EnumDeclaration -> Qualified -> Text
+prettyEnum (Cxx.EnumDeclaration _ mkey) qualified = case mkey of
+  Just (Cxx.EnumDeclaration_key qname is_scoped ttype _) ->
+    foldr1
+      (<+>)
+      [ "enum"
+      , optional is_scoped "class"
+      , prettyQName qname qualified
+      , prettyEnumType ttype
+      ]
+  Nothing -> missingKey
+
+prettyEnumType :: Maybe Cxx.Type -> Text
+prettyEnumType maybeType = ":" <+> fillImplicitUnderlyingType maybeType
+  where
+    fillImplicitUnderlyingType Nothing = implicitUnderlyingEnumType
+    fillImplicitUnderlyingType (Just ttype) = prettyType ttype
+
+prettyObjcSelectorSlot :: Cxx.ObjcSelectorSlotEntity -> Text
+prettyObjcSelectorSlot (Cxx.ObjcSelectorSlotEntity method idx) =
+  fromMaybe missingKey $ do
+    decl <- case method of
+      Cxx.ObjcMethodEntity_decl decl -> Just decl
+      Cxx.ObjcMethodEntity_defn Cxx.ObjcMethodDefinition{
+        objcMethodDefinition_key = Just decl} -> Just decl
+      _ -> Nothing
+    Cxx.ObjcMethodDeclaration_key{
+      objcMethodDeclaration_key_selector = Cxx.ObjcSelector{
+        objcSelector_key = Just selector
+      }
+    } <- Glean.getFactKey decl
+    let index = fromIntegral $ Glean.fromNat idx
+    atMay selector index
+-- Notes:
+-- * "kind = { global_ = {definition = true}" doesn't guarantee that this
+--   variable has an 'extern' key
+prettyVariable :: Cxx.VariableDeclaration -> Qualified -> Text
+prettyVariable (Cxx.VariableDeclaration _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.VariableDeclaration_key qname ttype kind _) ->
+    foldr1
+      (<+>)
+      [ prettyVarPrefix kind
+      , prettyType ttype
+      , prettyQName qname qualified
+      ]
+
+prettyVarPrefix :: Cxx.VariableKind -> Text
+prettyVarPrefix kind = case kind of
+  Cxx.VariableKind_field (Cxx.Field mutable _) -> optional mutable "mutable"
+  Cxx.VariableKind_global_ (Cxx.GlobalVariable gv_kind attribute _) ->
+    prefix1 <+> prefix2
+    where
+      prefix1 = case gv_kind of
+        Cxx.GlobalVariableKind_StaticVariable -> "static"
+        Cxx.GlobalVariableKind_StaticMember -> "static"
+        Cxx.GlobalVariableKind_SimpleVariable -> intentionallyEmpty
+        Cxx.GlobalVariableKind__UNKNOWN {} -> intentionallyEmpty
+      prefix2 = case attribute of
+        Cxx.GlobalVariableAttribute_Plain -> intentionallyEmpty
+        Cxx.GlobalVariableAttribute_Inline -> intentionallyEmpty
+        -- TODO: there is a bug with const
+        Cxx.GlobalVariableAttribute_Constexpr -> todoEmpty
+        Cxx.GlobalVariableAttribute__UNKNOWN {} -> todoEmpty
+  Cxx.VariableKind_local (Cxx.LocalVariable lv_kind attribute) ->
+    prefix1 <+> prefix2
+    where
+      prefix1 = case lv_kind of
+        Cxx.LocalVariableKind_StaticVariable -> "static"
+        Cxx.LocalVariableKind_SimpleVariable -> intentionallyEmpty
+        Cxx.LocalVariableKind_Parameter -> intentionallyEmpty
+        Cxx.LocalVariableKind__UNKNOWN {} -> intentionallyEmpty
+      prefix2 = case attribute of
+        Cxx.LocalVariableAttribute_Plain -> intentionallyEmpty
+        -- TODO: there is a bug with const
+        Cxx.LocalVariableAttribute_Constexpr -> todoEmpty
+        Cxx.LocalVariableAttribute__UNKNOWN {} -> todoEmpty
+  Cxx.VariableKind_ivar _ -> intentionallyEmpty
+  Cxx.VariableKind_EMPTY -> todoEmpty
+
+prettyTypeAlias :: Cxx.TypeAliasDeclaration -> Qualified -> Text
+prettyTypeAlias (Cxx.TypeAliasDeclaration _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.TypeAliasDeclaration_key name ttype kind _) -> case kind of
+    Cxx.TypeAliasKind_Typedef ->
+      foldr1
+        (<+>)
+        [ "typedef"
+        , prettyType ttype
+        , prettyQName name qualified
+        ]
+    Cxx.TypeAliasKind_Using ->
+      foldr1
+        (<+>)
+        [ "using"
+        , prettyQName name qualified
+        , "="
+        , prettyType ttype
+        ]
+    Cxx.TypeAliasKind__UNKNOWN {} -> todoEmpty
+
+prettyNamespaceAlias :: Cxx.NamespaceAliasDeclaration -> Qualified -> Text
+prettyNamespaceAlias (Cxx.NamespaceAliasDeclaration _ mkey) qualified =
+  case mkey of
+    Nothing -> missingKey
+    Just (Cxx.NamespaceAliasDeclaration_key qname target _) ->
+      foldr1
+        (<+>)
+        [ "namespace", prettyNamespaceQName qname qualified, "=", targetName ]
+      where
+        targetName = case target of
+          Cxx.NamespaceTarget_namespace_
+            (Cxx.NamespaceDeclaration _ mkey) ->
+              case mkey of
+                Just (Cxx.NamespaceDeclaration_key qname _) ->
+                  prettyNamespaceQName qname Qualified
+                Nothing -> missingKey
+          Cxx.NamespaceTarget_namespaceAlias
+            (Cxx.NamespaceAliasDeclaration _ mkey) ->
+              case mkey of
+                Just (Cxx.NamespaceAliasDeclaration_key qname _ _) ->
+                  prettyNamespaceQName qname Qualified
+                Nothing -> missingKey
+          Cxx.NamespaceTarget_EMPTY -> todoEmpty
+
+prettyFunction :: Cxx.FunctionDeclaration -> Qualified -> Text
+prettyFunction (Cxx.FunctionDeclaration _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.FunctionDeclaration_key name sign mmethod _) ->
+    foldr1
+      (<+>)
+      [ prettyFuncPrefix mmethod
+      , if hasReturn name then prettyReturnType sign else intentionallyEmpty
+      , prettyFuncQName name qualified <> "(" <> prettyParams sign <> ")"
+      , prettyFuncPostfix mmethod
+      ]
+
+-- False means that we MUST not even try to print the return type
+-- For example in constructor we have it set to 'void'
+-- but we do not want to print it
+hasReturn :: Cxx.FunctionQName -> Bool
+hasReturn (Cxx.FunctionQName _ mkey) = case mkey of
+  Nothing -> True
+  Just (Cxx.FunctionQName_key (Cxx.FunctionName _ mmkey) _) -> case mmkey of
+    Nothing -> True -- TODO
+    Just key -> case key of
+      Cxx.FunctionName_key_name _ -> True
+      Cxx.FunctionName_key_literalOperator _ -> True -- TODO: check it
+      Cxx.FunctionName_key_conversionOperator _ -> False
+      Cxx.FunctionName_key_operator_ _ -> True
+      Cxx.FunctionName_key_constructor _ -> False
+      Cxx.FunctionName_key_destructor _ -> False
+      Cxx.FunctionName_key_EMPTY -> True
+
+prettyFuncPostfix :: Maybe Cxx.MethodSignature -> Text
+prettyFuncPostfix Nothing = todoEmpty
+prettyFuncPostfix (Just (Cxx.MethodSignature _ is_const _ _)) =
+  optional is_const "const"
+
+prettyFuncPrefix :: Maybe Cxx.MethodSignature -> Text
+prettyFuncPrefix Nothing = todoEmpty
+prettyFuncPrefix (Just (Cxx.MethodSignature is_virtual _ is_volatile _)) =
+  optional is_virtual "virtual"
+    <+> optional is_volatile "volatile"
+
+prettyReturnType :: Cxx.Signature -> Text
+prettyReturnType (Cxx.Signature _ mkey) = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.Signature_key mtype _) -> prettyType mtype
+
+prettyParams :: Cxx.Signature -> Text
+prettyParams (Cxx.Signature _ mkey) = case mkey of
+  Nothing -> todoEmpty
+  Just (Cxx.Signature_key _ []) -> intentionallyEmpty
+  Just (Cxx.Signature_key _ params) ->
+    intercalate ", " (map prettyParameter params)
+
+prettyParameter :: Cxx.Parameter -> Text
+prettyParameter (Cxx.Parameter name mtype) =
+  prettyType mtype <+> prettyName name
+
+prettyType :: Cxx.Type -> Text
+prettyType (Cxx.Type _ mkey) = alignRefOrPtrQualifier
+  $ fromMaybe "<unknown-type>" mkey
+
+alignRefOrPtrQualifier :: Text -> Text
+alignRefOrPtrQualifier ttype =
+  Text.stripEnd (Text.dropWhileEnd isRefOrPtrQualifier ttype)
+  <> Text.takeWhileEnd isRefOrPtrQualifier ttype
+  where
+    isRefOrPtrQualifier x = x == '&' || x == '*'
+
+prettyFuncQName :: Cxx.FunctionQName -> Qualified -> Text
+prettyFuncQName (Cxx.FunctionQName _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.FunctionQName_key func_name scope)
+    | isQualified qualified ->
+      prettyScope scope "::" <> prettyFunctionName func_name scope
+    | otherwise ->
+      prettyFunctionName func_name scope
+
+prettyFunctionName :: Cxx.FunctionName -> Cxx.Scope -> Text
+prettyFunctionName (Cxx.FunctionName _ mkey) scope = case mkey of
+  Nothing -> missingKey
+  Just key -> case key of
+    Cxx.FunctionName_key_name nname -> prettyName nname
+    Cxx.FunctionName_key_literalOperator loname -> loname
+    Cxx.FunctionName_key_conversionOperator mtype -> prettyType mtype
+    Cxx.FunctionName_key_operator_ oname
+      | is_lambda -> "lambda_" <> getRecordId scope
+      | otherwise -> oname
+    Cxx.FunctionName_key_constructor _ -> owner_name
+    Cxx.FunctionName_key_destructor _ -> "~" <> owner_name
+    Cxx.FunctionName_key_EMPTY -> "<unknown>"
+    where
+      owner_name = prettyScopeBasic scope
+      is_lambda = case scope of
+        Cxx.Scope_recordWithAccess (Cxx.Scope_recordWithAccess_ _ _) ->
+          Text.null owner_name
+        _ -> False
+
+getRecordId :: Cxx.Scope -> Text
+getRecordId scope = case scope of
+  -- TODO: Make it better. Seems to be prone to errors
+  Cxx.Scope_recordWithAccess
+    ( Cxx.Scope_recordWithAccess_
+        (Cxx.QName _ (Just (Cxx.QName_key (Cxx.Name id _) _)))
+        _
+      ) -> textShow id
+  _ -> intentionallyEmpty
+
+prettyNamespace :: Cxx.NamespaceDeclaration -> Qualified -> Text
+prettyNamespace (Cxx.NamespaceDeclaration _ mkey) qualified = case mkey of
+  Just (Cxx.NamespaceDeclaration_key qname _) ->
+    "namespace" <+> prettyNamespaceQName qname qualified
+  -- TODO: Decide anonymousNamespace | intentionallyEmpty | missingKey
+  -- Check if there are "anonymous" things setting 'key' to Nothing.
+  Nothing -> todoEmpty
+
+prettyNamespaceQName :: Cxx.NamespaceQName -> Qualified -> Text
+prettyNamespaceQName (Cxx.NamespaceQName _ mkey) qualified = case mkey of
+  Just key -> case key of
+    -- TODO: Decide anonymousNamespace | intentionallyEmpty | missingKey
+    -- Check if there are "anonymous" namespaces setting 'name' to Nothing.
+    Cxx.NamespaceQName_key name Nothing -> maybe todoEmpty prettyName name
+    Cxx.NamespaceQName_key name (Just parent)
+      | isQualified qualified ->
+        prettyNamespaceQName parent Qualified <::>
+          maybe todoEmpty prettyName name
+      | otherwise -> maybe todoEmpty prettyName name
+  -- Scope.namespace in VariableDeclaration hits it here
+  Nothing -> anonymousNamespace
+
+prettyName :: Cxx.Name -> Text
+-- NamespaceDeclaration hits it here
+prettyName (Cxx.Name _ key) = fromMaybe anonymousNamespace key
+
+prettyRecord :: Cxx.RecordDeclaration -> Qualified -> Text
+prettyRecord (Cxx.RecordDeclaration _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.RecordDeclaration_key name kind _) -> case kind of
+    Cxx.RecordKind_struct_ {} -> "struct" <+> prettyQName name qualified
+    Cxx.RecordKind_class_ {} -> "class" <+> prettyQName name qualified
+    Cxx.RecordKind_union_ {} -> "union" <+> prettyQName name qualified
+    Cxx.RecordKind_EMPTY ->
+      "<unknown-declaration>" <+> prettyQName name qualified
+
+-- Produces X::Y::Z::T
+-- Uses "::" as separator everywhere
+prettyQName :: Cxx.QName -> Qualified -> Text
+prettyQName (Cxx.QName _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.QName_key name scope)
+    | isQualified qualified ->
+      prettyScope scope "::" <> prettyName name
+    | otherwise -> prettyName name
+
+-- Intentionally scope has the <::> inside the function
+-- as we want to distinguish local and global as otherwise
+-- it is impossible to handle it different ways on the caller side
+prettyScope :: Cxx.Scope -> Text -> Text
+prettyScope k separator = case k of
+  Cxx.Scope_global_ _ -> separator
+  Cxx.Scope_namespace_ name -> prettyNamespaceQName name Qualified <> separator
+  Cxx.Scope_recordWithAccess (Cxx.Scope_recordWithAccess_ record _) ->
+    prettyQName record Qualified <> separator
+  -- Current implementation explicitly ignores it
+  -- but we can actually print a function name if needed
+  Cxx.Scope_local _ -> intentionallyEmpty
+  Cxx.Scope_EMPTY -> "<unknown-scope>"
+
+prettyScopeBasic :: Cxx.Scope -> Text
+prettyScopeBasic k = case k of
+  Cxx.Scope_recordWithAccess
+    (Cxx.Scope_recordWithAccess_ (Cxx.QName _ mkey) _) ->
+      case mkey of
+        Nothing -> missingKey
+        Just (Cxx.QName_key name _) -> prettyName name
+  _ -> intentionallyEmpty
+
+optional :: Bool -> Text -> Text
+optional True text = text
+optional False _ = intentionallyEmpty
+
+prettyUsingDecl :: Cxx.UsingDeclaration -> Text
+prettyUsingDecl (Cxx.UsingDeclaration _ mkey) = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.UsingDeclaration_key name _) ->
+    -- using declarations are always qualified as they don't
+    -- have a declarator nested-name-specifier to omit in an
+    -- unqualified-id
+    -- for example `using namespace std::chrono;` declares no
+    -- symbol name that could be an unqualified-id OR a qualified-id
+    -- In this case, we qualify the symbol they refer to, which
+    -- is always unscoped but fully qualified
+    "using" <+> prettyFuncQName name Qualified
+
+prettyUsingDirective :: Cxx.UsingDirective -> Text
+prettyUsingDirective (Cxx.UsingDirective _ mkey) = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.UsingDirective_key name _) ->
+    -- using directives are always qualified as they don't
+    -- have a declarator nested-name-specifier to omit in an
+    -- unqualified-id
+    -- for example `using namespace std::chrono;` declares no
+    -- symbol name that could be an unqualified-id OR a qualified-id
+    -- In this case, we qualify the symbol they refer to, which
+    -- is always unscoped but fully qualified
+    "using namespace" <+> prettyQName name Qualified
+
+prettyDefinition :: Cxx.Definition -> Qualified -> Text
+prettyDefinition def qualified = case def of
+  Cxx.Definition_record_ x -> prettyRecordDef x qualified
+  Cxx.Definition_function_ x -> prettyFuncDef x qualified
+  Cxx.Definition_enum_ x -> prettyEnumDef x qualified
+  Cxx.Definition_objcMethod _ -> intentionallyEmpty
+  Cxx.Definition_objcContainer _ -> intentionallyEmpty
+  Cxx.Definition_variable x -> prettyVariable x qualified
+  Cxx.Definition_namespace_ x -> prettyNamespaceDef x qualified
+  Cxx.Definition_EMPTY -> intentionallyEmpty
+
+prettyNamespaceDef :: Cxx.NamespaceDefinition -> Qualified -> Text
+prettyNamespaceDef (Cxx.NamespaceDefinition _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.NamespaceDefinition_key decl _) -> prettyNamespace decl qualified
+
+prettyEnumDef :: Cxx.EnumDefinition -> Qualified -> Text
+prettyEnumDef (Cxx.EnumDefinition _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.EnumDefinition_key decl _) -> prettyEnum decl qualified
+
+prettyFuncDef :: Cxx.FunctionDefinition -> Qualified -> Text
+prettyFuncDef (Cxx.FunctionDefinition _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.FunctionDefinition_key decl _) -> prettyFunction decl qualified
+
+prettyRecordDef :: Cxx.RecordDefinition -> Qualified -> Text
+prettyRecordDef (Cxx.RecordDefinition _ mkey) qualified = case mkey of
+  Nothing -> missingKey
+  Just (Cxx.RecordDefinition_key decl _ _) -> prettyRecord decl qualified
diff --git a/glean/glass/Glean/Glass/Pretty/Fbthrift.hs b/glean/glass/Glean/Glass/Pretty/Fbthrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Fbthrift.hs
@@ -0,0 +1,198 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Pretty.Fbthrift
+  (
+    prettyFbthriftSignature
+  ) where
+
+import System.FilePath ( dropExtension, takeBaseName )
+import Data.Text ( Text, unpack )
+import Compat.Prettyprinter
+
+import Glean.Glass.Types ( SymbolId(..), RepoName(..) )
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Schema.CodeFbthrift.Types as Fbthrift ( Entity(..) )
+import qualified Glean.Schema.Fbthrift.Types as Fbthrift
+import qualified Glean.Schema.Src.Types as Src
+
+-- Type of Fbthrift entity signatures to capture the the subset we generate
+-- We use this to separate the processing of the Glean type from the text
+-- we wish to generate
+
+newtype File = File Text
+
+newtype Identifier = Identifier Text
+
+data NamedKind = Typedef | Enum | Struct | Union
+
+data FieldKind = FUnion | FStruct | FException
+
+data QualName = QualName File Identifier
+
+data Declaration
+  = IncludeFile File
+  | Named QualName NamedKind -- user declared type
+  | Service QualName
+  | Exception QualName
+  | Constant QualName
+  | Function QualName Identifier
+  | EnumValue QualName NamedKind Identifier
+  | FieldDecl QualName FieldKind Identifier
+
+-- The returned DocStream is annotated with SymbolId (links from sig
+-- tokens to their definition). This isn't supported yet for thrift.
+-- It'll be always Nothing, and () in the returned Doc types.
+prettyFbthriftSignature
+  :: LayoutOptions
+  -> RepoName
+  -> SymbolId
+  -> Fbthrift.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyFbthriftSignature opts _repo sym (Fbthrift.Entity_decl d) =
+    do
+      mDecl <- fromAngleDeclaration d
+      case mDecl of
+        Nothing -> return Nothing
+        Just decl ->
+          let doc = layoutSmart opts $ prettyDecl opts sym decl
+              annDoc = reAnnotateS (\() -> Nothing) doc in
+          return $ Just annDoc
+prettyFbthriftSignature _ _ _ Fbthrift.Entity_EMPTY = return Nothing
+
+ppKind :: NamedKind -> Doc ()
+ppKind kind = case kind of
+  Typedef -> "typedef"
+  Enum -> "enum"
+  Struct -> "struct"
+  Union -> "union"
+
+ppFieldKind :: FieldKind -> Doc ()
+ppFieldKind kind = case kind of
+  FUnion -> "union"
+  FStruct -> "struct"
+  FException -> "exception"
+
+ppFile :: File -> Doc ()
+ppFile (File f) = pretty f
+
+ppQualName :: QualName -> Doc ()
+ppQualName (QualName (File file) (Identifier id)) =
+  pretty (dropExtension (takeBaseName (unpack file)) <> "." <> unpack id)
+
+ppScopedId :: QualName -> Identifier -> Doc ()
+ppScopedId (QualName (File file) (Identifier idService)) (Identifier id) =
+  pretty $ mconcat [
+    dropExtension (takeBaseName (unpack file)), ".", unpack idService, "::",
+    unpack id
+  ]
+
+prettyDecl :: LayoutOptions -> SymbolId -> Declaration -> Doc ()
+prettyDecl _ _sym (Service qName ) = "service" <+> ppQualName qName
+prettyDecl _ _sym (Exception qName ) = "exception" <+> ppQualName qName
+prettyDecl _ _sym (Constant qName ) = "constant" <+> ppQualName qName
+prettyDecl _ _sym (IncludeFile file) = "include" <+> ppFile file
+prettyDecl _ _sym (Named qName kind) = ppKind kind <+> ppQualName qName
+prettyDecl _ _sym (Function qName id) = "function" <+> ppScopedId qName id
+prettyDecl _ _sym (EnumValue qName _kd id) = "enum value" <+> ppScopedId qName id
+prettyDecl _ _sym (FieldDecl qName kind id) =
+  ppFieldKind kind <+> "field" <+> ppScopedId qName id
+
+fromFile :: Src.File -> Glean.RepoHaxl u w File
+fromFile file = File <$> Glean.keyOf file
+
+fromKind :: Fbthrift.NamedKind -> NamedKind
+fromKind kind = case kind of
+  Fbthrift.NamedKind_typedef_ -> Typedef
+  Fbthrift.NamedKind_enum_ -> Enum
+  Fbthrift.NamedKind_struct_ -> Struct
+  Fbthrift.NamedKind_union_ -> Union
+  Fbthrift.NamedKind__UNKNOWN _ -> error "unexpected NamedKind"
+
+fromFieldKind :: Fbthrift.FieldKind -> FieldKind
+fromFieldKind kind = case kind of
+  Fbthrift.FieldKind_exception_ -> FException
+  Fbthrift.FieldKind_struct_ -> FStruct
+  Fbthrift.FieldKind_union_ -> FUnion
+  Fbthrift.FieldKind__UNKNOWN _ -> error "unexpected FieldKind"
+
+fromQualName :: Fbthrift.QualName_key -> Glean.RepoHaxl u w QualName
+fromQualName (Fbthrift.QualName_key file id) = do
+  id <- Identifier <$> Glean.keyOf id
+  file <- fromFile =<< Glean.keyOf file
+  return $ QualName file id
+
+fromNamedDecl :: Fbthrift.NamedDecl_key -> Glean.RepoHaxl u w Declaration
+fromNamedDecl (Fbthrift.NamedDecl_key namedType) = do
+  let Fbthrift.NamedType qName kind = namedType
+  qName <- fromQualName =<< Glean.keyOf qName
+  return $ Named qName (fromKind kind)
+
+fromExceptionName
+ :: Fbthrift.ExceptionName_key -> Glean.RepoHaxl u w Declaration
+fromExceptionName  (Fbthrift.ExceptionName_key qName) = do
+  qName <- fromQualName =<< Glean.keyOf qName
+  return $ Exception qName
+
+fromServiceName :: Fbthrift.ServiceName_key -> Glean.RepoHaxl u w Declaration
+fromServiceName (Fbthrift.ServiceName_key qName) = do
+  qName <- fromQualName =<< Glean.keyOf qName
+  return $ Service qName
+
+fromConstant :: Fbthrift.Constant_key -> Glean.RepoHaxl u w Declaration
+fromConstant (Fbthrift.Constant_key qName) = do
+  qName <- fromQualName =<< Glean.keyOf qName
+  return $ Constant qName
+
+fromEnumValue :: Fbthrift.EnumValue_key -> Glean.RepoHaxl u w Declaration
+fromEnumValue (Fbthrift.EnumValue_key enum name) = do
+  let Fbthrift.NamedType qname kind = enum
+  qualName <- fromQualName =<< Glean.keyOf qname
+  id <- Identifier <$> Glean.keyOf name
+  return $ EnumValue qualName (fromKind kind) id
+
+fromFieldDecl :: Fbthrift.FieldDecl_key -> Glean.RepoHaxl u w Declaration
+fromFieldDecl (Fbthrift.FieldDecl_key qname kind name) = do
+  qualName <- fromQualName =<< Glean.keyOf qname
+  id <- Identifier <$> Glean.keyOf name
+  return $ FieldDecl qualName (fromFieldKind kind) id
+
+fromFunctionName :: Fbthrift.FunctionName_key -> Glean.RepoHaxl u w Declaration
+fromFunctionName (Fbthrift.FunctionName_key service name) = do
+  Fbthrift.ServiceName_key serviceName <- Glean.keyOf service
+  qName <- fromQualName =<< Glean.keyOf serviceName
+  id <- Identifier <$> Glean.keyOf name
+  return $ Function qName id
+
+--
+-- Process the raw declaration result from Glean to build up a cleaner
+-- `Declaration` description of the type signature, possibly pulling in
+-- some related information as we go
+--
+fromAngleDeclaration
+  :: Fbthrift.Declaration -> Glean.RepoHaxl u w (Maybe Declaration)
+fromAngleDeclaration d = case d of
+  Fbthrift.XRefTarget_include_ file ->
+    Just . IncludeFile <$> (fromFile =<< Glean.keyOf file)
+  Fbthrift.XRefTarget_named namedDecl ->
+    Just <$> (fromNamedDecl =<< Glean.keyOf namedDecl)
+  Fbthrift.XRefTarget_exception_ exceptionName  ->
+    Just <$> (fromExceptionName =<< Glean.keyOf exceptionName)
+  Fbthrift.XRefTarget_service_ serviceName ->
+    Just <$> (fromServiceName =<< Glean.keyOf serviceName)
+  Fbthrift.XRefTarget_constant constant ->
+    Just <$> (fromConstant =<< Glean.keyOf constant)
+  Fbthrift.XRefTarget_enumValue enumValue ->
+    Just <$> (fromEnumValue =<< Glean.keyOf enumValue)
+  Fbthrift.XRefTarget_function_ functionName  ->
+    Just <$> (fromFunctionName =<< Glean.keyOf functionName)
+  Fbthrift.XRefTarget_field fieldDecl  ->
+    Just <$> (fromFieldDecl =<< Glean.keyOf fieldDecl)
+  Fbthrift.XRefTarget_EMPTY -> return Nothing
diff --git a/glean/glass/Glean/Glass/Pretty/Flow.hs b/glean/glass/Glean/Glass/Pretty/Flow.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Flow.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo #-}
+
+module Glean.Glass.Pretty.Flow
+  (
+    prettyFlowSignature
+  ) where
+
+import Data.Text ( Text )
+import Compat.Prettyprinter
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Schema.CodeFlow.Types as Flow ( Entity(..) )
+import qualified Glean.Schema.Flow.Types as Flow
+import Glean.Util.ToAngle ( ToAngle(toAngle) )
+import Glean.Glass.Types
+import Glean.Glass.Utils ( fetchData )
+
+prettyFlowSignature
+  :: LayoutOptions
+  -> Flow.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyFlowSignature opts entity = case entity of
+    Flow.Entity_decl decl  -> do
+      mSig <- fetchData (angleFlowTypeSignature (toAngle decl))
+      case mSig of
+        Nothing -> return Nothing
+        Just sig -> ppr =<< declSignature decl sig
+    Flow.Entity_module_ mod -> ppr =<<
+      (moduleSignature =<< Glean.keyOf mod)
+    Flow.Entity_EMPTY -> return Nothing
+  where
+    ppr mText = do
+      let docStream = layoutSmart opts . pretty <$> mText
+      return $ reAnnotateS (const Nothing) <$> docStream
+
+moduleSignature :: Flow.Module_key -> Glean.RepoHaxl u w (Maybe Text)
+moduleSignature m = case m of
+  Flow.Module_key_file file -> Just <$> Glean.keyOf file
+  Flow.Module_key_lib text -> pure (Just ("module " <> text))
+  Flow.Module_key_string_ text -> pure (Just ("module " <> text))
+  Flow.Module_key_builtin _ -> pure Nothing
+  Flow.Module_key_noSource _ -> pure Nothing
+  Flow.Module_key_EMPTY -> pure Nothing
+
+declSignature :: Flow.SomeDeclaration -> Text -> Glean.RepoHaxl u w (Maybe Text)
+declSignature decl sig = do
+  mName <- case decl of
+    Flow.SomeDeclaration_localDecl x -> do
+      Flow.Declaration_key name _ <- Glean.keyOf x
+      Just <$> Glean.keyOf name
+    Flow.SomeDeclaration_memberDecl x -> do
+      Flow.MemberDeclaration_key name _ <- Glean.keyOf x
+      Just <$> Glean.keyOf name
+    Flow.SomeDeclaration_typeDecl x -> do
+      Flow.TypeDeclaration_key name _ <- Glean.keyOf x
+      Just <$> Glean.keyOf name
+    Flow.SomeDeclaration_EMPTY -> return Nothing
+  return $ (\name -> name <> ": " <> sig ) <$> mName
+
+angleFlowTypeSignature :: Angle Flow.SomeDeclaration -> Angle Text
+angleFlowTypeSignature decl = var $ \(sig :: Angle Text) ->
+  sig `where_` [
+    wild .= predicate @Flow.DeclarationSignature (
+      rec $
+        field @"decl" decl $
+        field @"signature" sig
+      end
+    )
+  ]
diff --git a/glean/glass/Glean/Glass/Pretty/Hack.hs b/glean/glass/Glean/Glass/Pretty/Hack.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Hack.hs
@@ -0,0 +1,918 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo #-}
+
+module Glean.Glass.Pretty.Hack
+  ( prettyHackSignature
+    -- for testing
+  , prettyDecl
+  , ByteSpan(..)
+  , Decl(..)
+  , Name(..)
+  , Qual(..)
+  , QualName(..)
+  , FunctionMod(..)
+  , PropertyMod(..)
+  , ClassMod(..)
+  , MethodMod(..)
+  , Abstract(..)
+  , Final(..)
+  , Visibility(..)
+  , Static(..)
+  , Async(..)
+  , ReadOnly(..)
+  , Signature (..)
+  , HackType(..)
+  , ReturnType(..)
+  , ModuleInternal(..)
+  , DefaultValue(..)
+  , Inout(..)
+  , Variadic(..)
+  , Parameter(..)
+  , Variance(..)
+  , Reify(..)
+  , TypeParameter(..)
+  , Constraint(..)
+  , ConstraintKind(..)
+  , Container(..)
+  , EnumKind(..)
+  , EnumConstraint(..)
+  , TypeConstKind(..)
+  , Transparency(..)
+  ) where
+
+import Data.List as List ( foldl' )
+import Data.Maybe (fromMaybe, mapMaybe)
+import Data.Text (Text)
+import Compat.Prettyprinter
+import Compat.Prettyprinter.Render.Text (renderStrict)
+import qualified Data.Text as Text
+import Control.Monad.Extra ( when, whenJust )
+import Control.Monad.Trans (MonadTrans(lift))
+import Control.Monad.Trans.Maybe (MaybeT (..))
+import Control.Monad.Trans.Writer.Strict ( execWriter, tell )
+import qualified Data.Map.Strict as Map
+
+import Glean.Glass.SymbolId ( toSymbolId )
+import Glean.Glass.Types ( SymbolId(..), RepoName(..) )
+import Glean.Glass.Base ( GleanPath(..) )
+import Glean.Glass.Path ( fromGleanPath )
+import Glean.Util.ToAngle ( ToAngle(toAngle) )
+import Glean.Glass.Utils
+import qualified Glean.Glass.SymbolId.Hack as Hack
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Schema.CodeHack.Types as Hack
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+
+-- Pretty-printer annotations for Doc or SimpleDocStream
+-- Used to collect xrefs bytespan in pretty-printed signatures
+data Ann
+  = None
+  | BareDecl !Hack.Declaration {- todo: !GleanPath -}
+  | SymId !SymbolId
+
+prettyHackSignature
+  :: LayoutOptions
+  -> RepoName
+  -> SymbolId
+  -> Hack.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyHackSignature opts repo sym (Hack.Entity_decl d) =
+  runMaybeT $ do
+    docStream <- layoutSmart opts . prettyDecl opts sym <$> decl d
+    let docStreamSymbol = sequence $ reAnnotateS (declToSymbolId repo) docStream
+    maybeT $ Just <$> docStreamSymbol
+prettyHackSignature _ _ _ Hack.Entity_EMPTY = return Nothing
+
+-- Turn declaration to symbol ids
+-- This requires a query to Code.EntityLocation to gather
+-- the path to an entity, needed for constructing a SymbolId
+declToSymbolId :: RepoName -> Ann -> Glean.RepoHaxl u w (Maybe SymbolId)
+declToSymbolId _repo None = return Nothing
+declToSymbolId _repo (SymId sym) = return (Just sym)
+declToSymbolId repo (BareDecl decl) = runMaybeT $ do
+  Code.EntityLocation{..} <- maybeT $ fetchDataRecursive $
+    angleEntityLocation entityAngle
+  Code.EntityLocation_key{..} <- liftMaybe entityLocation_key
+  let Code.Location{..} = entityLocation_key_location
+  path <- MaybeT (Just . GleanPath <$> Glean.keyOf location_file)
+  MaybeT $ Just <$> toSymbolId (fromGleanPath repo path) entity
+  where
+    entity = Code.Entity_hack (Hack.Entity_decl decl)
+    entityAngle = alt @"hack" (alt @"decl" (toAngle decl))
+
+newtype Name = Name Text
+newtype Qual = Qual [Text]
+newtype QualName = QualName ([Text], Text)
+
+-- Hack modifier orderings are not as strict as this but since we want
+-- to print them in some consistent ordering we enforce the most popular
+data FunctionMod = FunctionMod !Async !ModuleInternal
+data ClassMod    = ClassMod Abstract Final !ModuleInternal
+data MethodMod   =
+  MethodMod Abstract Final Visibility Static Async ReadOnly
+data PropertyMod   = PropertyMod Abstract Final Visibility Static
+
+data Abstract = Abstract | NotAbstract deriving Eq
+data Final = Final | NotFinal deriving Eq
+data Visibility = Public | Protected | Private | Internal
+data Static = Static | NotStatic deriving Eq
+data Async = Async | NotAsync deriving Eq
+data ModuleInternal = IsInternal | NotInternal deriving Eq
+data ReadOnly = IsReadOnly | NotReadOnly deriving Eq
+
+data ByteSpan = ByteSpan
+  { start :: {-# UNPACK #-}!Int
+  , length :: {-# UNPACK #-}!Int
+  }
+type XRefs = [(Hack.Declaration, ByteSpan)]
+newtype HackType = HackType { unHackType :: Text }
+newtype ReturnType = ReturnType { unReturnType :: Text }
+newtype DefaultValue = DefaultValue Text
+data Inout = Inout
+data Variadic = Variadic
+data Parameter
+  = Parameter Name HackType (Maybe Inout)
+      (Maybe Variadic) (Maybe DefaultValue) ReadOnly XRefs
+data Variance = Contravariant | Covariant | Invariant
+data Reify = Erased | Reified | SoftReified
+data ConstraintKind = As | Equal | Super
+data Constraint = Constraint ConstraintKind HackType
+data TypeParameter = TypeParameter Name Variance Reify [Constraint] [UserAttr]
+data UserAttr = UserAttr Name [Text]
+newtype Context = Context { _unContext :: Text }
+data Signature = Signature ReadOnly ReturnType [TypeParameter] [Parameter]
+  (Maybe [Context]) XRefs
+data Container
+  = ClassContainer | InterfaceContainer | TraitContainer | EnumContainer
+  deriving Eq
+data EnumKind = IsClass | Regular
+data EnumConstraint = EnumBase HackType | Constrained HackType HackType
+data TypeConstKind = IsAbstract | Concrete | PartiallyAbstract
+data Transparency = Newtype_ | Type_
+
+data Decl
+  = ClassConst Name
+  | Enum QualName EnumKind EnumConstraint ModuleInternal
+  | Trait QualName [TypeParameter] ModuleInternal
+  | Class ClassMod QualName [TypeParameter]
+  | Interface QualName [TypeParameter] ModuleInternal
+  | Enumerator QualName Name
+  | Function FunctionMod QualName Signature
+  | GlobalConst QualName
+  | Namespace Qual
+  | Method MethodMod Container Name Signature
+  | Property PropertyMod Container Name HackType
+  | TypeConst Name TypeConstKind
+  | Typedef QualName [TypeParameter] Transparency ModuleInternal
+  | Module Name
+
+prettyDecl :: LayoutOptions -> SymbolId -> Decl -> Doc Ann
+prettyDecl _ sym (ClassConst name) =
+  "const" <+> annotate (SymId sym) (ppName name)
+prettyDecl _ sym (Module name) =
+  "module" <+> annotate (SymId sym) (ppName name)
+
+prettyDecl _ sym (Enum name enumKind (EnumBase ty1) internal) =
+  ppModuleInternal internal <>
+    "enum" <> ppEnumClass enumKind <+>
+      annotate (SymId sym) (ppQualName name) <+> ":" <+> ppType ty1
+prettyDecl _ sym (Enum name enumKind (Constrained ty1 ty2) internal) =
+  ppModuleInternal internal <>
+    "enum" <> ppEnumClass enumKind <+>
+      annotate (SymId sym) (ppQualName name) <+>
+       ":" <+> ppConstraintTypes ty1 ty2
+
+prettyDecl _ sym (Class modifiers name typeParams) =
+  ppClassModifiers modifiers <> "class" <+>
+    annotate (SymId sym) (ppQualName name) <> ppTypeParams typeParams
+prettyDecl _ sym (Interface name typeParams internal) =
+  ppModuleInternal internal <> "interface" <+>
+    annotate (SymId sym) (ppQualName name) <> ppTypeParams typeParams
+prettyDecl _ sym (Trait name typeParams internal) =
+  ppModuleInternal internal <> "trait" <+>
+    annotate (SymId sym) (ppQualName name) <> ppTypeParams typeParams
+
+prettyDecl _ _sym (Enumerator enum name) =
+  ppQualName enum <> "::" <> ppName name
+
+prettyDecl opts sym (Function modifiers name sig) =
+  ppSignature opts (ppFunctionModifiers modifiers <+>
+    annotate (SymId sym) (ppQualName name)) sig
+prettyDecl opts sym (Method modifiers container name sig) =
+  ppSignature opts (ppMethodModifiers container modifiers <+>
+    annotate (SymId sym) (ppName name)) sig
+
+prettyDecl _ _sym (GlobalConst name) =
+  "const" <+> ppQualName name
+prettyDecl _ sym (Namespace name) =
+  "namespace" <+> annotate (SymId sym) (ppQual name)
+
+prettyDecl _ _ (Property modifiers container name mhacktype) =
+  ppPropertyModifiers container modifiers <+> ppType mhacktype <+> ppName name
+
+prettyDecl _ sym (TypeConst name IsAbstract) =
+  "abstract" <+> "const" <+> "type" <+> annotate (SymId sym) (ppName name)
+prettyDecl _ sym (TypeConst name _) =
+  "const" <+> "type" <+> annotate (SymId sym) (ppName name)
+
+prettyDecl _ _sym (Typedef name typeParams Type_ internal) =
+  ppModuleInternal internal <>
+    "type" <+> ppQualName name <> ppTypeParams typeParams
+prettyDecl _ _sym (Typedef name typeParams Newtype_ internal) =
+  ppModuleInternal internal <>
+    "newtype" <+> ppQualName name <> ppTypeParams typeParams
+
+ppEnumClass :: EnumKind -> Doc Ann
+ppEnumClass Regular = emptyDoc
+ppEnumClass IsClass = space <> "class"
+
+ppName :: Name -> Doc Ann
+ppName (Name n) = pretty n
+
+-- | We never qualify names in generated signatures now
+ppQualName :: QualName -> Doc Ann
+ppQualName (QualName ([], name)) = pretty name
+ppQualName (QualName (_namespace, name)) = pretty name
+
+ppQual :: Qual -> Doc Ann
+ppQual (Qual namespace) = concatWith (surround "\\") (pretty <$> namespace)
+
+ppFunctionModifiers :: FunctionMod -> Doc Ann
+ppFunctionModifiers (FunctionMod async internal) =
+  hcat [ ppModuleInternal internal, ppAsync async, "function" ]
+
+ppClassModifiers :: ClassMod -> Doc Ann
+ppClassModifiers (ClassMod abstract final internal) =
+  hcat [ ppModuleInternal internal, ppAbstract abstract, ppFinal final ]
+
+ppModuleInternal :: ModuleInternal -> Doc Ann
+ppModuleInternal IsInternal = "internal" <> space
+ppModuleInternal NotInternal = mempty
+
+ppAsync :: Async -> Doc Ann
+ppAsync Async = "async" <> space
+ppAsync NotAsync = mempty
+
+ppAbstract :: Abstract -> Doc Ann
+ppAbstract Abstract = "abstract" <> space
+ppAbstract NotAbstract = mempty
+
+ppFinal :: Final -> Doc Ann
+ppFinal Final = "final" <> space
+ppFinal NotFinal = mempty
+
+ppReadOnly :: Doc Ann
+ppReadOnly = "readonly"
+
+ppSignature :: LayoutOptions -> Doc Ann -> Signature -> Doc Ann
+ppSignature
+  opts head (Signature readOnly returnType typeParams params ctxs xrefs) =
+    if fitsOnOneLine then onelineSig else multilineSig
+  where
+    onelineTypeParams = if null typeParams then emptyDoc else cat
+      [ "<"
+      , sep $ punctuate "," (map ppTypeParam typeParams)
+      , ">"
+      ]
+    onelineArgs = if null params then "()" else
+      parens (hsep $ punctuate comma (map ppParameter params))
+    onelineSig = nest 4 $ head <> fillCat
+      [ onelineTypeParams
+      , onelineArgs
+      , ppContexts ctxs
+      , ":" <> readOnlyKwd <+> ppReturnType returnType xrefs
+      ]
+    multilineTypeParams = if null typeParams then emptyDoc else vcat
+        [ nest 4 $ vcat
+          [ "<"
+          , vcat $ map ((<> ",") . ppTypeParam) typeParams
+          ]
+        , ">"
+        ]
+    multilineArgs = vcat
+      [ nest 4 (vcat $
+        "("
+        : map ((<> ",") . ppParameter) params
+        )
+      , ")"
+      ]
+    multilineSig = head
+      <> multilineTypeParams
+      <> multilineArgs
+      <> nest 4 (
+        ppContexts ctxs
+        <> ":"
+        <> readOnlyKwd
+        <+> ppReturnType returnType xrefs
+      )
+    paramsText = renderStrict $ layoutSmart opts onelineSig
+    fitsOnOneLine = not containsNewline
+    containsNewline = Text.any (== '\n') paramsText
+    readOnlyKwd = case readOnly of
+      IsReadOnly -> space <> ppReadOnly
+      NotReadOnly -> ""
+
+ppTypeParams :: [TypeParameter] -> Doc Ann
+ppTypeParams typeParams | null typeParams = emptyDoc
+ppTypeParams typeParams = cat
+  [ nest 4 $ cat
+    [ "<", sep $ punctuate "," (map ppTypeParam typeParams)]
+  , ">"
+  ]
+
+--
+-- Lots of interesting syntax for type parameters
+-- https://docs.hhvm.com/hack/generics/introduction
+--
+ppTypeParam :: TypeParameter -> Doc Ann
+ppTypeParam (TypeParameter name variance reify constraints userAttrs) = hcat
+  [ ppAttrs userAttrs -- attributes
+  , ppReified reify -- reify keyword
+  , ppVariance variance -- then the variance markers
+  , ppName name -- then the type param name
+  , hsep (map ppConstraint constraints) -- and any constraints
+  ]
+
+-- User attributes on type parameters, including the reification attributes
+ppAttrs :: [UserAttr] -> Doc Ann
+ppAttrs attrs = case attrs of
+  [] -> emptyDoc
+  _ -> hcat ["<<", hsep (punctuate comma (map ppAttr attrs)), ">> "]
+
+-- https://docs.hhvm.com/hack/attributes/introduction
+ppAttr :: UserAttr -> Doc Ann
+-- e.g. __Memoize
+ppAttr (UserAttr name []) = ppName name
+-- __Deprecated("foo")
+-- <<Contributors("John Doe", keyset["ORM Team", "Core Library Team"])>>
+ppAttr (UserAttr name args)
+  = ppName name <>
+      parens (hsep (punctuate comma (map pretty args)))
+
+-- Reified generics
+-- https://docs.hhvm.com/hack/reified-generics/reified-generics
+ppReified :: Reify -> Doc Ann
+ppReified SoftReified = "reify "
+ppReified Reified = "reify "
+ppReified _ = emptyDoc
+
+--
+-- Variance markers on type parameters
+-- See https://docs.hhvm.com/hack/generics/variance
+--
+ppVariance :: Variance -> Doc Ann
+ppVariance Covariant = "+"
+ppVariance Contravariant = "-"
+ppVariance _ = emptyDoc
+
+--
+-- Generic type parameter constraint syntax
+-- See https://docs.hhvm.com/hack/generics/type-constraints
+--
+ppConstraint :: Constraint -> Doc Ann
+ppConstraint (Constraint kind ty) = hcat
+  [ case kind of
+      Equal -> " = "
+      As -> " as "
+      Super -> " super "
+  , ppType ty
+  ]
+
+ppTypeXRefs :: HackType -> XRefs -> Doc Ann
+ppTypeXRefs (HackType t) xrefs =
+  let spans = fmap (\(ann, ByteSpan{..}) -> (ann, start, length)) xrefs
+      fragments = splitString t spans in
+  mconcat $ (\(frag, ann) -> annotate (toAnn ann) $ pretty frag) <$> fragments
+  where
+    toAnn Nothing = None
+    toAnn (Just decl) = BareDecl decl
+
+ppType :: HackType -> Doc Ann
+ppType (HackType t) = pretty t
+
+ppReturnType :: ReturnType -> XRefs -> Doc Ann
+ppReturnType (ReturnType t) xrefs = ppTypeXRefs (HackType t) xrefs
+
+ppParameter :: Parameter -> Doc Ann
+ppParameter (Parameter name typeName inout variadic defaultValue readOnly xrefs)
+  = nest 4 $ sep $ execWriter $ do
+    when (readOnly == IsReadOnly) $ tell [ppReadOnly]
+    whenJust inout $ tell . ppInout
+    tell [ppTypeXRefs typeName xrefs]
+    case variadic of
+      Just Variadic -> tell [hcat ["...", ppName name]]
+      Nothing ->  tell [ppName name]
+    whenJust defaultValue $ tell . pure . ppDefaultValue typeName
+
+-- Contexts can be parameterised, empty, missing. or a simple list
+-- https://docs.hhvm.com/hack/contexts-and-capabilities/introduction
+ppContexts :: Maybe [Context] -> Doc Ann
+ppContexts Nothing = emptyDoc
+ppContexts (Just []) = brackets emptyDoc
+ppContexts (Just ctxs) = brackets $ hsep (punctuate comma (map ppContext ctxs))
+
+ppContext :: Context -> Doc Ann
+ppContext (Context ctx) = pretty ctx
+
+ppDefaultValue :: HackType -> DefaultValue -> Doc Ann
+ppDefaultValue typeName (DefaultValue v) = "=" <+>
+  case typeName of -- work around for type-sensitive quoting
+    HackType ty
+      | ty `elem` ["string", "?string"], v /= "null" -> squotes (pretty v)
+    _ -> pretty v
+
+ppInout :: Inout -> [Doc Ann]
+ppInout Inout = ["inout"]
+
+ppConstraintTypes :: HackType -> HackType -> Doc Ann
+ppConstraintTypes ty1 ty2 = ppType ty1 <+> "as" <+> ppType ty2
+
+ppMethodModifiers :: Container -> MethodMod -> Doc Ann
+ppMethodModifiers container
+  (MethodMod abstract final visibility static async readonlyThis) =
+  fillSep $ execWriter $ do
+    when
+      (  abstract == Abstract
+      && container /= InterfaceContainer
+      ) $ tell ["abstract"]
+    when (final==Final) $ tell ["final"]
+    tell $ pure $ case visibility of
+      Public -> "public"
+      Protected -> "protected"
+      Private -> "private"
+      Internal -> "internal"
+    when (static==Static) $ tell ["static"]
+    when (readonlyThis==IsReadOnly) $ tell ["readonly"]
+    when (async==Async) $ tell ["async"]
+    tell ["function"]
+
+ppPropertyModifiers :: Container -> PropertyMod -> Doc Ann
+ppPropertyModifiers container (PropertyMod abstract final visibility static) =
+  fillSep $ execWriter $ do
+    when
+      (  abstract == Abstract
+      && container /= InterfaceContainer
+      ) $ tell ["abstract"]
+    when (final==Final) $ tell ["final"]
+    tell $ pure $ case visibility of
+      Public -> "public"
+      Protected -> "protected"
+      Private -> "private"
+      Internal -> "internal"
+    when (static==Static) $ tell ["static"]
+
+--
+-- Process the raw declaration result from Glean to build up a cleaner
+-- `Decl` description of the type signature, possibly pulling in some related
+-- information as we go
+--
+decl :: Hack.Declaration -> Glean.MaybeTRepoHaxl u w Decl
+decl (Hack.Declaration_classConst Hack.ClassConstDeclaration{..}) = do
+  Hack.ClassConstDeclaration_key{..} <- liftMaybe classConstDeclaration_key
+  name <- liftMaybe $ Hack.name_key classConstDeclaration_key_name
+  pure $ ClassConst $ Name name
+decl (Hack.Declaration_container container) = containerDecl container
+decl (Hack.Declaration_enumerator Hack.Enumerator{..}) = do
+  Hack.Enumerator_key{..} <- liftMaybe enumerator_key
+  Hack.EnumDeclaration{..} <- pure enumerator_key_enumeration
+  Hack.EnumDeclaration_key{..} <- liftMaybe enumDeclaration_key
+  enum <- qName enumDeclaration_key_name
+  name <- liftMaybe $ Hack.name_key enumerator_key_name
+  pure $ Enumerator (QualName enum) $ Name name
+decl (Hack.Declaration_function_ decl@Hack.FunctionDeclaration{..}) = do
+  Hack.FunctionDeclaration_key{..} <- liftMaybe functionDeclaration_key
+  Hack.FunctionDefinition{..} <- maybeT $ fetchDataRecursive $
+    angleFunctionDefinition (Angle.factId (Glean.getId decl))
+  name <- qName functionDeclaration_key_name
+  def <- liftMaybe functionDefinition_key
+  let typeParams = Hack.functionDefinition_key_typeParams def
+  let sign = Hack.functionDefinition_key_signature def
+  pure $ Function (modifiersForFunction def) (QualName name)
+    (toSignature typeParams sign (Hack.functionDefinition_key_readonlyRet def))
+decl (Hack.Declaration_module Hack.ModuleDeclaration{..}) = do
+  Hack.ModuleDeclaration_key{..} <- liftMaybe moduleDeclaration_key
+  name <- liftMaybe $ Hack.name_key moduleDeclaration_key_name
+  pure $ Module $ Name name
+decl (Hack.Declaration_globalConst Hack.GlobalConstDeclaration{..}) = do
+  Hack.GlobalConstDeclaration_key{..} <- liftMaybe globalConstDeclaration_key
+  name <- qName globalConstDeclaration_key_name
+  pure $ GlobalConst $ QualName name
+decl (Hack.Declaration_namespace_ Hack.NamespaceDeclaration{..}) = do
+  Hack.NamespaceDeclaration_key{..} <- liftMaybe namespaceDeclaration_key
+  name <- namespaceQName $ Just namespaceDeclaration_key_name
+  pure $ Namespace $ Qual name
+decl (Hack.Declaration_method decl@Hack.MethodDeclaration{..}) = do
+  Hack.MethodDeclaration_key{..} <- liftMaybe methodDeclaration_key
+  Hack.MethodDefinition{..} <- maybeT $ fetchDataRecursive $
+    angleMethodDefinition (Angle.factId (Glean.getId decl))
+  name <- liftMaybe $ Hack.name_key methodDeclaration_key_name
+  def <- liftMaybe methodDefinition_key
+  let typeParams = Hack.methodDefinition_key_typeParams def
+  let sig = Hack.methodDefinition_key_signature def
+  let container = containerKind methodDeclaration_key_container
+  pure $ Method (modifiersForMethod def) container (Name name)
+    (toSignature typeParams sig (Hack.methodDefinition_key_readonlyRet def))
+decl (Hack.Declaration_property_ prop@Hack.PropertyDeclaration{..}) = do
+  Hack.PropertyDeclaration_key{..} <- liftMaybe propertyDeclaration_key
+  Hack.PropertyDefinition{..} <- maybeT $ fetchDataRecursive $
+    predicate @Hack.PropertyDefinition $
+      rec $
+        field @"declaration"
+          (Angle.asPredicate $ Angle.factId $ Glean.getId prop)
+      end
+  def <- liftMaybe propertyDefinition_key
+  let type_ = typeInfoToType $ Hack.propertyDefinition_key_typeInfo def
+  name <- liftMaybe $ Hack.name_key propertyDeclaration_key_name
+  let container = containerKind propertyDeclaration_key_container
+  pure $ Property (modifiersForProperty def) container (Name name) type_
+decl (Hack.Declaration_typeConst decl@Hack.TypeConstDeclaration{..}) = do
+  Hack.TypeConstDeclaration_key{..} <- liftMaybe typeConstDeclaration_key
+  hackTypeConstKind <- maybeT $ fetchData $
+    angleTypeConstDefinition (Angle.factId (Glean.getId decl))
+  let typeConstKind = case hackTypeConstKind of
+        Hack.TypeConstKind_Abstract -> IsAbstract
+        Hack.TypeConstKind_Concrete -> Concrete
+        Hack.TypeConstKind_PartiallyAbstract -> PartiallyAbstract
+        Hack.TypeConstKind__UNKNOWN{} -> error "unexpected typeconst kind"
+  name <- liftMaybe $ Hack.name_key typeConstDeclaration_key_name
+  pure $ TypeConst (Name name) typeConstKind
+decl (Hack.Declaration_typedef_ decl@Hack.TypedefDeclaration{..}) = do
+  Hack.TypedefDeclaration_key{..} <- liftMaybe typedefDeclaration_key
+  (typedefTypeParams, isTransparent, moduleMembership) <- maybeT $
+    fetchDataRecursive $
+      angleTypedefDefinition (Angle.factId (Glean.getId decl))
+  name <- qName typedefDeclaration_key_name
+  let typeParams = map toTypeParameter typedefTypeParams
+      isNewtype = if isTransparent then Type_ else Newtype_
+  pure $ Typedef (QualName name) typeParams isNewtype
+    (toModuleVisibility moduleMembership)
+decl Hack.Declaration_EMPTY = MaybeT (return Nothing)
+
+containerDecl :: Hack.ContainerDeclaration -> Glean.MaybeTRepoHaxl u w Decl
+containerDecl (Hack.ContainerDeclaration_enum_
+      decl@Hack.EnumDeclaration{..}) = do
+    Hack.EnumDeclaration_key{..} <- liftMaybe enumDeclaration_key
+    (enumBaseTypeInfo,enumConstraintTypeInfo,isClass,moduleInfo) <- maybeT $
+      fetchDataRecursive $ angleEnumDefinition (Angle.factId (Glean.getId decl))
+    let enumKind = if isClass then IsClass else Regular
+    let baseType = typeInfoToType enumBaseTypeInfo
+    let constraint =  case enumConstraintTypeInfo of
+          Nothing -> EnumBase baseType
+          Just ty -> Constrained baseType (typeInfoToType (Just ty))
+    name <- qName enumDeclaration_key_name
+    pure $ Enum (QualName name) enumKind constraint
+      (toModuleVisibility moduleInfo)
+containerDecl
+  (Hack.ContainerDeclaration_trait decl@Hack.TraitDeclaration{..}) = do
+    Hack.TraitDeclaration_key{..} <- liftMaybe traitDeclaration_key
+    (traitTypeParams, moduleInfo) <- maybeT $ fetchDataRecursive $
+      angleTraitDefinition (Angle.factId (Glean.getId decl))
+    name <- qName traitDeclaration_key_name
+    let typeParams = map toTypeParameter traitTypeParams
+    pure $ Trait (QualName name) typeParams (toModuleVisibility moduleInfo)
+containerDecl
+  (Hack.ContainerDeclaration_class_ decl@Hack.ClassDeclaration{..}) = do
+    Hack.ClassDeclaration_key{..} <- liftMaybe classDeclaration_key
+    (isAbstract, isFinal, classTypeParams, moduleInfo) <- maybeT $
+      fetchDataRecursive $ angleClassDefinition
+        (Angle.factId (Glean.getId decl))
+    name <- qName classDeclaration_key_name
+    let typeParams = map toTypeParameter classTypeParams
+    pure $ Class (modifiersForClass isAbstract isFinal
+             (toModuleVisibility moduleInfo))
+       (QualName name) typeParams
+containerDecl
+  (Hack.ContainerDeclaration_interface_ decl@Hack.InterfaceDeclaration{..}) = do
+    Hack.InterfaceDeclaration_key{..} <- liftMaybe interfaceDeclaration_key
+    (interTypeParams, moduleInfo) <- maybeT $ fetchDataRecursive $
+      angleInterfaceDefinition (Angle.factId (Glean.getId decl))
+    name <- qName interfaceDeclaration_key_name
+    let typeParams = map toTypeParameter interTypeParams
+    pure $ Interface (QualName name) typeParams (toModuleVisibility moduleInfo)
+containerDecl Hack.ContainerDeclaration_EMPTY = MaybeT (return Nothing)
+
+containerKind
+  :: Hack.ContainerDeclaration -> Container
+containerKind Hack.ContainerDeclaration_enum_ {} = EnumContainer
+containerKind Hack.ContainerDeclaration_trait {} = TraitContainer
+containerKind Hack.ContainerDeclaration_class_ {} = ClassContainer
+containerKind Hack.ContainerDeclaration_interface_ {} = InterfaceContainer
+containerKind Hack.ContainerDeclaration_EMPTY = ClassContainer
+
+qName :: Hack.QName -> Glean.MaybeTRepoHaxl u w ([Text], Text)
+qName Hack.QName{..} = do
+ Hack.QName_key{..} <- liftMaybe qName_key
+ namespace <- namespaceQName qName_key_namespace_
+ name <- liftMaybe $ Hack.name_key qName_key_name
+ return (namespace, name)
+
+namespaceQName :: Maybe Hack.NamespaceQName -> Glean.MaybeTRepoHaxl u w [Text]
+namespaceQName nsqname = go nsqname []
+  where
+    go Nothing acc = return acc
+    go (Just nsqname@Hack.NamespaceQName{..}) acc = do
+      mshortname <- lift $ shortenGlobalAlias nsqname
+      case mshortname of -- if this one is global alias, we're done.
+        Just name -> return (name : acc)
+        Nothing -> do -- else collect name and try parent
+          Hack.NamespaceQName_key{..} <- liftMaybe namespaceQName_key
+          name <- liftMaybe $ Hack.name_key namespaceQName_key_name
+          go namespaceQName_key_parent (name : acc)
+
+-- in a (recursive) hack.NamespaceQName, occurences of global namespace
+-- aliases should be shortened wherever they occur.
+shortenGlobalAlias :: Hack.NamespaceQName -> Glean.RepoHaxl u w (Maybe Text)
+shortenGlobalAlias nsqname = Map.lookup (Glean.getId nsqname) <$>
+  Hack.hackGlobalNamespaceAliases
+
+modifiersForFunction :: Hack.FunctionDefinition_key -> FunctionMod
+modifiersForFunction Hack.FunctionDefinition_key{..} =
+  FunctionMod asyncMod visibility
+  where
+    asyncMod = if functionDefinition_key_isAsync then Async else NotAsync
+    visibility = toModuleVisibility functionDefinition_key_module_
+
+toModuleVisibility :: Maybe Hack.ModuleMembership -> ModuleInternal
+toModuleVisibility (Just (Hack.ModuleMembership _ True)) = IsInternal
+toModuleVisibility _ = NotInternal
+
+modifiersForClass :: Bool -> Bool -> ModuleInternal -> ClassMod
+modifiersForClass isAbstract isFinal internal = ClassMod
+  (if isAbstract then Abstract else NotAbstract)
+  (if isFinal then Final else NotFinal)
+  internal
+
+modifiersForMethod :: Hack.MethodDefinition_key -> MethodMod
+modifiersForMethod Hack.MethodDefinition_key {..} =
+  MethodMod
+  (if methodDefinition_key_isAbstract then Abstract else NotAbstract)
+  (if methodDefinition_key_isFinal then Final else NotFinal)
+  (fromHackVisibility methodDefinition_key_visibility)
+  (if methodDefinition_key_isStatic then Static else NotStatic)
+  (if methodDefinition_key_isAsync then Async else NotAsync)
+  (if methodDefinition_key_isReadonlyThis == Just True
+     then IsReadOnly else NotReadOnly)
+
+modifiersForProperty :: Hack.PropertyDefinition_key -> PropertyMod
+modifiersForProperty Hack.PropertyDefinition_key {..} =
+  PropertyMod
+  (if propertyDefinition_key_isAbstract then Abstract else NotAbstract)
+  (if propertyDefinition_key_isFinal then Final else NotFinal)
+  (fromHackVisibility propertyDefinition_key_visibility)
+  (if propertyDefinition_key_isStatic then Static else NotStatic)
+
+fromHackVisibility :: Hack.Visibility  -> Visibility
+fromHackVisibility v = case v of
+  Hack.Visibility_Public -> Public
+  Hack.Visibility_Protected -> Protected
+  Hack.Visibility_Private -> Private
+  Hack.Visibility_Internal -> Internal
+  Hack.Visibility__UNKNOWN{} -> error "unexpected visibility"
+
+-- Glass-side implementation of fbcode/glean/rts/prim.cpp:relSpansToAbs
+relSpansToAbs :: [Src.RelByteSpan] -> [ByteSpan]
+relSpansToAbs byteSpans = snd $ List.foldl' f (0, []) byteSpans
+  where
+    f (!start, acc) (Src.RelByteSpan offset length) =
+      let off = fromIntegral (Glean.fromNat offset)
+          len = fromIntegral (Glean.fromNat length)
+          start' = start + off
+      in (start', ByteSpan start' len : acc)
+
+-- Extracts type and xrefs from a TypeInfo
+-- XRefs are converted from relative spans (Glean representation)
+-- to absolute (Glass representation)
+-- If TypeInfo doesn't exist, returned type is overridden by provided
+-- default.
+toTypeAndXRefs :: Maybe Hack.TypeInfo -> (HackType, XRefs)
+toTypeAndXRefs typeInfo = case typeInfo of
+  (Just (Hack.TypeInfo _ (Just (Hack.TypeInfo_key displayType hackXRefs _)))) ->
+    let f (Hack.XRef declaration ranges) = case declaration of
+          Hack.XRefTarget_declaration decl ->
+            Just ((\x -> (decl, x)) <$> relSpansToAbs ranges)
+          _ -> Nothing
+        xrefs = concat (mapMaybe f hackXRefs)
+    in (toType $ Just displayType, xrefs)
+
+  _ -> (toType Nothing, [])
+
+toSignature ::
+  [Hack.TypeParameter] -> Hack.Signature -> Maybe Hack.ReadonlyKind -> Signature
+toSignature typeParams Hack.Signature{..} mbReadOnly = case signature_key of
+  Nothing -> Signature NotReadOnly (ReturnType unknownType) [] [] Nothing []
+  Just (Hack.Signature_key _ params mctxs retTypeInfo) ->
+   let (type_, xrefs) = toTypeAndXRefs retTypeInfo
+       readOnly = case mbReadOnly of
+         Just _ -> IsReadOnly
+         Nothing -> NotReadOnly
+   in Signature
+        readOnly
+        (ReturnType (unHackType type_))
+        (map toTypeParameter typeParams)
+        (map toParameter params)
+        (map toContext <$> mctxs)
+        -- Maybe [] is used to distinguish default context from literal "[]"
+        xrefs
+
+toType :: Maybe Hack.Type -> HackType
+toType Nothing = HackType unknownType
+toType (Just (Hack.Type _ mkey)) = HackType $ fromMaybe unknownType mkey
+
+toTypeParameter :: Hack.TypeParameter -> TypeParameter
+toTypeParameter
+  (Hack.TypeParameter name variance reifyKind constraints attributes) =
+    TypeParameter
+    (toName name)
+    (toVariance variance)
+    (toReifyKind reifyKind)
+    (map toConstraint constraints)
+    (mapMaybe toAttribute attributes)
+
+toAttribute :: Hack.UserAttribute -> Maybe UserAttr
+toAttribute (Hack.UserAttribute _ Nothing) = Nothing
+toAttribute (Hack.UserAttribute _ (Just
+    (Hack.UserAttribute_key name params _))) =
+  Just $ UserAttr (toName name) params
+
+toContext :: Hack.Context_ -> Context
+toContext (Hack.Context_ _ Nothing) = Context unknownType
+toContext (Hack.Context_ _ (Just ctx)) = Context ctx'
+  where
+    -- There are only a few dozen contexts in use.
+    -- Gronky auto-imported handling hack to get a short name
+    --
+    -- > [\HH\Contexts\leak_safe] -> [leak_safe]
+    --
+    -- If we switch to proper declarations and auto-import tables we can avoid
+    -- the string handling here.
+    ctx' | Just tidy <- Text.stripPrefix "HH\\Contexts\\" ctx = tidy
+         | Just tidy <- Text.stripPrefix "\\HH\\Contexts\\" ctx = tidy
+         | otherwise = ctx
+
+toVariance :: Hack.Variance -> Variance
+toVariance Hack.Variance_Invariant = Invariant
+toVariance Hack.Variance_Contravariant = Contravariant
+toVariance Hack.Variance_Covariant = Covariant
+toVariance (Hack.Variance__UNKNOWN _) = Invariant
+
+toReifyKind :: Hack.ReifyKind -> Reify
+toReifyKind Hack.ReifyKind_Reified = Reified
+toReifyKind Hack.ReifyKind_SoftReified = SoftReified
+toReifyKind Hack.ReifyKind_Erased = Erased
+toReifyKind (Hack.ReifyKind__UNKNOWN _) = Erased
+
+typeInfoToType :: Maybe Hack.TypeInfo -> HackType
+typeInfoToType typeInfo =
+  toType $ case typeInfo of
+        (Just (Hack.TypeInfo _ (Just (Hack.TypeInfo_key displayType _ _)))) ->
+          Just displayType
+        _ -> Nothing
+
+toConstraint :: Hack.Constraint -> Constraint
+toConstraint (Hack.Constraint kind _ typeInfo) =
+  Constraint (toConstraintKind kind) (typeInfoToType typeInfo)
+
+toConstraintKind :: Hack.ConstraintKind -> ConstraintKind
+toConstraintKind Hack.ConstraintKind_Equal = Equal
+toConstraintKind Hack.ConstraintKind_As = As
+toConstraintKind Hack.ConstraintKind_Super = Super
+toConstraintKind (Hack.ConstraintKind__UNKNOWN _) = Equal
+
+toParameter :: Hack.Parameter -> Parameter
+toParameter
+  (Hack.Parameter name _ inout variadic mdefaultValue _ typeInfo readOnly) =
+  let (type_, xrefs) = toTypeAndXRefs typeInfo
+  in Parameter
+      (toName name)
+      (HackType (unHackType type_))
+      (if inout then Just Inout else Nothing)
+      (if variadic then Just Variadic else Nothing)
+      (DefaultValue <$> mdefaultValue)
+      (maybe NotReadOnly (const IsReadOnly) readOnly)
+      xrefs
+
+toName :: Hack.Name -> Name
+toName (Hack.Name _ mkey) = Name $ fromMaybe "(anonymous)" mkey
+
+unknownType :: Text
+unknownType = "<unknown-type>"
+
+angleClassDefinition
+  :: Angle Hack.ClassDeclaration
+  -> Angle (Bool, Bool, [Hack.TypeParameter], Maybe Hack.ModuleMembership )
+angleClassDefinition decl = vars $ \isAbstract isFinal typeParams moduleInfo ->
+  tuple (isAbstract, isFinal, typeParams, moduleInfo) `where_` [
+    wild .= predicate @Hack.ClassDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"isAbstract" isAbstract $
+        field @"isFinal" isFinal $
+        field @"typeParams" typeParams $
+        field @"module_" moduleInfo
+      end)
+  ]
+
+angleTraitDefinition
+  :: Angle Hack.TraitDeclaration
+  -> Angle ([Hack.TypeParameter], Maybe Hack.ModuleMembership)
+angleTraitDefinition decl = vars $ \typeParams modInfo ->
+  tuple (typeParams, modInfo) `where_` [
+    wild .= predicate @Hack.TraitDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"typeParams" typeParams $
+        field @"module_" modInfo
+      end)
+  ]
+
+angleInterfaceDefinition
+  :: Angle Hack.InterfaceDeclaration
+  -> Angle ([Hack.TypeParameter], Maybe Hack.ModuleMembership)
+angleInterfaceDefinition decl = vars $ \typeParams modInfo ->
+  tuple (typeParams, modInfo) `where_` [
+    wild .= predicate @Hack.InterfaceDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"typeParams" typeParams $
+        field @"module_" modInfo
+      end)
+  ]
+
+angleTypedefDefinition
+  :: Angle Hack.TypedefDeclaration
+  -> Angle ([Hack.TypeParameter], Bool, Maybe Hack.ModuleMembership)
+angleTypedefDefinition decl = vars $ \typeParams transparency moduleInfo ->
+  tuple (typeParams, transparency, moduleInfo) `where_` [
+    wild .= predicate @Hack.TypedefDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"typeParams" typeParams $
+        field @"isTransparent" transparency $
+        field @"module_" moduleInfo
+      end)
+  ]
+
+angleTypeConstDefinition
+  :: Angle Hack.TypeConstDeclaration -> Angle Hack.TypeConstKind
+angleTypeConstDefinition decl = var $ \typeConstKind ->
+  typeConstKind `where_` [
+    wild .= predicate @Hack.TypeConstDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"kind" typeConstKind
+      end)
+  ]
+
+-- hack enums: need to distinguish `enum T : Z` , or `enum class T : X as Y`
+angleEnumDefinition
+  :: Angle Hack.EnumDeclaration
+  -> Angle (Maybe Hack.TypeInfo, Maybe Hack.TypeInfo, Bool,
+            Maybe Hack.ModuleMembership)
+angleEnumDefinition decl = vars $ \(baseType :: Angle (Maybe Hack.TypeInfo))
+    asType isEnumClass modInfo ->
+  tuple (baseType, asType, isEnumClass, modInfo ) `where_` [
+    wild .= predicate @Hack.EnumDefinition (
+      rec $
+        field @"declaration" (Angle.asPredicate decl) $
+        field @"enumBaseTypeInfo" baseType $
+        field @"enumConstraintTypeInfo" asType $
+        field @"isEnumClass" isEnumClass $
+        field @"module_" modInfo
+      end)
+  ]
+
+angleMethodDefinition
+  :: Angle Hack.MethodDeclaration -> Angle Hack.MethodDefinition
+angleMethodDefinition decl = predicate @Hack.MethodDefinition $
+  rec $
+    field @"declaration" (Angle.asPredicate decl)
+  end
+
+angleFunctionDefinition
+  :: Angle Hack.FunctionDeclaration -> Angle Hack.FunctionDefinition
+angleFunctionDefinition decl = predicate @Hack.FunctionDefinition $
+  rec $
+    field @"declaration" (Angle.asPredicate decl)
+  end
+
+angleEntityLocation
+  :: Angle Code.Entity -> Angle Code.EntityLocation
+angleEntityLocation ent =
+  predicate @Code.EntityLocation $
+    rec $
+      field @"entity" ent
+    end
diff --git a/glean/glass/Glean/Glass/Pretty/Haskell.hs b/glean/glass/Glean/Glass/Pretty/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Haskell.hs
@@ -0,0 +1,263 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo, CPP #-}
+
+module Glean.Glass.Pretty.Haskell
+  (
+    prettyHaskellSignature
+  ) where
+
+import Compat.Prettyprinter
+
+#if MIN_VERSION_ghc(9,2,0)
+import Data.Char
+import Data.List (foldl')
+import Data.Text ( Text )
+import qualified Data.Text.Encoding as Text
+
+import qualified GHC
+import qualified GHC.Utils.Outputable as GHC (
+  renderWithContext, defaultSDocContext, defaultUserStyle, SDocContext(..))
+import qualified GHC.Iface.Type as GHC (
+  pprIfaceType, IfaceType(..), IfaceType(..), IfaceTyLit(..),
+  IfaceTyCon(..), IfaceTyConInfo(..), IfExtName, IfaceTyConSort(..),
+  IfaceAppArgs(..), many_ty, IfaceBndr(..))
+#if !MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Iface.Type as GHC (AnonArgFlag(..))
+#endif
+import qualified GHC.Types.Basic as GHC (TupleSort(..))
+#if !MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Types.Basic as GHC (PromotionFlag(..))
+#endif
+import qualified GHC.Types.Unique as GHC (getUnique)
+import qualified GHC.Types.Name as GHC (mkExternalName)
+import qualified GHC.Types.Name.Cache as GHC
+import qualified GHC.Types.Name.Occurrence as GHC (
+  mkOccNameFS, varName, dataName, tvName, tcName)
+#if MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Types.Var as GHC (
+  Specificity(..), ForAllTyFlag(..), FunTyFlag(..), VarBndr(..),
+  visArgTypeLike, invisArgTypeLike)
+#else
+import qualified GHC.Types.Var as GHC (
+  Specificity(..), ArgFlag(..), VarBndr(..))
+#endif
+import qualified GHC.Unit.Module.Env as GHC (emptyModuleEnv)
+#if !MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Unit.Module.Name as GHC (mkModuleNameFS)
+#endif
+import qualified GHC.Unit.Types as GHC (fsToUnit)
+import qualified GHC.Data.FastString as GHC (FastString, mkFastStringByteString)
+import qualified GHC.Builtin.Utils as GHC (knownKeyNames)
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Schema.Hs.Types as Hs
+import Glean.Glass.Utils ( fetchDataRecursive )
+#endif
+
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.CodeHs.Types as Hs
+import Glean.Glass.Types
+
+prettyHaskellSignature
+  :: LayoutOptions
+  -> Hs.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+
+#if !MIN_VERSION_ghc(9,2,0)
+prettyHaskellSignature _opts _entity = return Nothing
+#else
+prettyHaskellSignature opts entity = case entity of
+    Hs.Entity_name name -> do
+      mDecl <- fetchDataRecursive $ angleHaskellNameDeclaration $
+        factId (Glean.getId name)
+      case mDecl of
+        Nothing -> return Nothing
+        Just decl -> do
+          mTy <- typeOfDeclaration decl
+          case mTy of
+            Nothing -> return Nothing
+            Just ty -> do
+              ifaceTy <- toIfaceType ty
+              return $ Just $ ppr $
+                GHC.renderWithContext ctx $
+                GHC.pprIfaceType ifaceTy
+    _ -> return Nothing
+  where
+    ppr = reAnnotateS (const Nothing) . layoutSmart opts . pretty
+    baseCtx = GHC.defaultSDocContext { GHC.sdocStyle = GHC.defaultUserStyle }
+    ctx = case layoutPageWidth opts of
+      AvailablePerLine w _ -> baseCtx { GHC.sdocLineLength = w }
+      Unbounded -> baseCtx
+
+toIfaceType :: Hs.Type -> Glean.RepoHaxl u w GHC.IfaceType
+toIfaceType ty = Glean.keyOf ty >>= \case
+  Hs.Type_key_tyvar var -> return $ GHC.IfaceTyVar (textToFS var)
+  Hs.Type_key_app (Hs.Type_app_ ty args) ->
+    GHC.IfaceAppTy
+      <$> toIfaceType ty
+      <*> toIfaceTypeArgs args
+  Hs.Type_key_tyconapp (Hs.Type_tyconapp_ tycon args) ->
+    GHC.IfaceTyConApp
+      <$> toIfaceTyCon tycon
+      <*> toIfaceTypeArgs args
+  Hs.Type_key_forall (Hs.Type_forall_ name kind flag inner) -> do
+    let af = toIfaceArgFlag flag
+    k <- toIfaceType kind
+    GHC.IfaceForAllTy (GHC.Bndr (GHC.IfaceTvBndr (textToFS name, k)) af)
+      <$> toIfaceType inner
+  Hs.Type_key_fun (Hs.Type_fun_ mult arg res) -> do
+    GHC.IfaceFunTy visArg
+      <$> toIfaceType mult
+      <*> toIfaceType arg
+      <*> toIfaceType res
+  Hs.Type_key_qual (Hs.Type_qual_ pred res) ->
+    GHC.IfaceFunTy invisArg
+      <$> pure GHC.many_ty
+      <*> toIfaceType pred
+      <*> toIfaceType res
+  Hs.Type_key_lit lit -> GHC.IfaceLitTy <$> toIfaceLitType lit
+  Hs.Type_key_cast ty -> toIfaceType ty
+  Hs.Type_key_coercion{} -> return $ GHC.IfaceTyVar "<coercion type>"
+  _ -> return $ GHC.IfaceTyVar "<unknown type>"
+  where
+
+#if MIN_VERSION_ghc(9,6,0)
+visArg :: GHC.FunTyFlag
+visArg = GHC.visArgTypeLike
+#else
+visArg :: GHC.AnonArgFlag
+visArg = GHC.VisArg
+#endif
+
+#if MIN_VERSION_ghc(9,6,0)
+invisArg :: GHC.FunTyFlag
+invisArg = GHC.invisArgTypeLike
+#else
+invisArg :: GHC.AnonArgFlag
+invisArg = GHC.InvisArg
+#endif
+
+toIfaceTyCon :: Hs.TyCon -> Glean.RepoHaxl u w GHC.IfaceTyCon
+toIfaceTyCon tycon = do
+  Hs.TyCon_key name sort prom <- Glean.keyOf tycon
+  let p = if prom then GHC.IsPromoted else GHC.NotPromoted
+  GHC.IfaceTyCon
+    <$> toIfaceExtName name
+    <*> pure (GHC.IfaceTyConInfo p (toIfaceTyConSort sort))
+
+toIfaceExtName :: Hs.Name -> Glean.RepoHaxl u w GHC.IfExtName
+toIfaceExtName n = do
+  Hs.Name_key occ mod _sort <- Glean.keyOf n
+  Hs.OccName_key str ns <- Glean.keyOf occ
+  Hs.Module_key modname unit <- Glean.keyOf mod
+  modtext <- Glean.keyOf modname
+  unittext <- Glean.keyOf unit
+  let
+    ghcNamespace = case ns of
+      Hs.Namespace_var_ -> GHC.varName
+      Hs.Namespace_datacon -> GHC.dataName
+      Hs.Namespace_tyvar -> GHC.tvName
+      Hs.Namespace_tycon -> GHC.tcName
+      _ -> GHC.tcName
+    id = Glean.fromFid (Glean.idOf (Glean.getId n))
+    ghcUnique = GHC.getUnique (fromIntegral id :: Int)
+    ghcOcc = GHC.mkOccNameFS ghcNamespace (textToFS str)
+    ghcModName = GHC.mkModuleNameFS (textToFS modtext)
+    ghcUnit = GHC.fsToUnit (textToFS unittext)
+    ghcMod = GHC.mkModule ghcUnit ghcModName
+  case GHC.lookupOrigNameCache nameCache ghcMod ghcOcc of
+    Just name -> return name
+    Nothing -> return $ GHC.mkExternalName ghcUnique ghcMod ghcOcc GHC.noSrcSpan
+
+-- For known-key Names we have to ensure that we use the correct Name,
+-- otherwise pretty-printing won't work correctly. This cache maps
+-- known qualified names to their GHC.Name. It must be at the top
+-- level, so it is built only once and cached.
+nameCache :: GHC.OrigNameCache
+#if MIN_VERSION_ghc(9,4,0)
+nameCache = foldl' GHC.extendOrigNameCache' GHC.emptyModuleEnv GHC.knownKeyNames
+#else
+nameCache = foldl' GHC.extendOrigNameCache GHC.emptyModuleEnv GHC.knownKeyNames
+#endif
+
+toIfaceTyConSort :: Hs.TyConSort -> GHC.IfaceTyConSort
+toIfaceTyConSort sort = case sort of
+  Hs.TyConSort_normal{} -> GHC.IfaceNormalTyCon
+  Hs.TyConSort_tuple (Hs.TyConSort_tuple_ arity sort) ->
+    GHC.IfaceTupleTyCon (fromIntegral (Glean.fromNat arity)) $
+      case sort of
+        Hs.TupleSort_boxed -> GHC.BoxedTuple
+        Hs.TupleSort_unboxed -> GHC.UnboxedTuple
+        Hs.TupleSort_constraint -> GHC.ConstraintTuple
+        Hs.TupleSort__UNKNOWN{} -> GHC.BoxedTuple
+  Hs.TyConSort_sum (Hs.TyConSort_sum_ arity) ->
+    GHC.IfaceSumTyCon (fromIntegral (Glean.fromNat arity))
+  Hs.TyConSort_equality{} -> GHC.IfaceEqualityTyCon
+  Hs.TyConSort_EMPTY -> GHC.IfaceNormalTyCon
+
+toIfaceTypeArgs :: [Hs.TypeArg] -> Glean.RepoHaxl u w GHC.IfaceAppArgs
+toIfaceTypeArgs [] = return GHC.IA_Nil
+toIfaceTypeArgs (Hs.TypeArg vis ty : xs) =
+  GHC.IA_Arg
+    <$> toIfaceType ty
+    <*> pure (if vis then GHC.Required else GHC.Specified)
+    <*> toIfaceTypeArgs xs
+
+toIfaceArgFlag :: Hs.ArgFlag -> ForAllTyFlag
+toIfaceArgFlag (Hs.ArgFlag_invisible spec) =
+  GHC.Invisible $ case spec of
+    Hs.Specificity_inferred -> GHC.InferredSpec
+    Hs.Specificity_specified -> GHC.SpecifiedSpec
+    Hs.Specificity__UNKNOWN{} -> GHC.SpecifiedSpec
+toIfaceArgFlag Hs.ArgFlag_requird{} = GHC.Required
+toIfaceArgFlag Hs.ArgFlag_EMPTY{} = GHC.Required
+
+#if MIN_VERSION_ghc(9,6,0)
+type ForAllTyFlag = GHC.ForAllTyFlag
+#else
+type ForAllTyFlag = GHC.ArgFlag
+#endif
+
+toIfaceLitType :: Hs.LitType -> Glean.RepoHaxl u w GHC.IfaceTyLit
+toIfaceLitType l = Glean.keyOf l >>= \case
+  Hs.LitType_key_num n ->
+    return $ GHC.IfaceNumTyLit (fromIntegral (Glean.fromNat n))
+  Hs.LitType_key_str txt ->
+    return $ GHC.IfaceStrTyLit (textToFS txt)
+  Hs.LitType_key_chr c ->
+    return $ GHC.IfaceCharTyLit (chr (fromIntegral (Glean.fromNat c)))
+  Hs.LitType_key_EMPTY{} ->
+    return $ GHC.IfaceNumTyLit 0
+
+angleHaskellNameDeclaration :: Angle Hs.Name -> Angle Hs.Declaration
+angleHaskellNameDeclaration name = var $ \decl ->
+  decl `where_` [
+    wild .= predicate @Hs.DeclarationOfName (
+      rec $
+        field @"name" (asPredicate name) $
+        field @"decl" decl
+      end
+    )
+  ]
+
+typeOfDeclaration :: Hs.Declaration -> Glean.RepoHaxl u w (Maybe Hs.Type)
+typeOfDeclaration (Hs.Declaration_val val) = do
+  k <- Glean.keyOf val
+  return (Hs.valBind_key_ty k)
+typeOfDeclaration (Hs.Declaration_patBind val) = do
+  k <- Glean.keyOf val
+  return (Hs.patBind_key_ty k)
+typeOfDeclaration _other =
+  return Nothing
+
+textToFS :: Text -> GHC.FastString
+textToFS txt = GHC.mkFastStringByteString (Text.encodeUtf8 txt)
+#endif
diff --git a/glean/glass/Glean/Glass/Pretty/Java.hs b/glean/glass/Glean/Glass/Pretty/Java.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Java.hs
@@ -0,0 +1,426 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo #-}
+
+module Glean.Glass.Pretty.Java
+  (
+    prettyJavaSignature
+  ) where
+
+import Data.Maybe
+import Data.Text ( Text )
+import Compat.Prettyprinter
+import Control.Monad.Trans.Maybe (MaybeT (..))
+import Control.Monad ( (<=<) )
+
+import Glean.Angle as Angle hiding (Type)
+import Glean.Glass.Path ( fromGleanPath )
+import Glean.Glass.Base ( GleanPath(..) )
+import Glean.Glass.Types ( SymbolId(..), RepoName(..) )
+import Glean.Glass.Utils
+import Glean.Glass.SymbolId ( toSymbolId )
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Code.Types as Code
+
+import qualified Glean.Schema.CodeJava.Types as Java (Entity(..))
+import qualified Glean.Schema.JavaAlpha.Types as Java
+import qualified Glean.Schema.JavakotlinAlpha.Types as JavaKotlin
+import qualified Glean.Schema.JavaAlpha.Types as JavaKotlin
+
+-- Java signatures
+data Declaration
+  = Class {
+      modifiers :: [Java.Modifier],
+      clsName :: !Name,
+      typeParams :: [TypeParam]
+    }
+  | Interface {
+      modifiers :: [Java.Modifier],
+      ifaceName :: !Name,
+      typeParams :: [TypeParam]
+    }
+  | Enum {
+      modifiers :: [Java.Modifier],
+      enumName :: !Name
+    }
+  | Method {
+      modifiers :: [Java.Modifier],
+      methName :: !Name,
+      params :: [Parameter],
+      returnTy :: Maybe Type,
+      throwTys :: [Type]
+    }
+  | CTor {
+      modifiers :: [Java.Modifier],
+      parent :: Type,
+      params :: [Parameter],
+      throwTys :: [Type]
+    }
+  | Field {
+      modifiers :: [Java.Modifier],
+      fieldName :: !Name,
+      fieldTy :: Maybe Type
+    }
+
+-- names
+newtype Name = Name Text
+
+data Parameter =
+  Parameter {
+    pName :: !Name,
+    pType :: Maybe Type,
+    pAnns :: [Annotation]
+  }
+
+newtype Annotation = Annotation Name
+
+data Type
+  = Type {
+      typeName :: Name,
+      typeArgs :: [TypeArg],
+      typeXRefs :: Maybe (Java.Declaration, GleanPath)
+    }
+  | ArrayType Type
+
+data TypeArg = TypeArg Type | TypeArgWild WildCardType
+
+data WildCardType
+  = Extends Type
+  | Super Type
+  | UnboundedWildcard
+
+-- types
+data TypeParam = TypeParam {
+    tyName :: Name,
+    tyExtends :: [Type]
+  }
+
+data Ann
+  = None
+  | BareDecl !Java.Declaration !GleanPath
+  | SymId !SymbolId
+
+--
+-- Generate a nicely formatted Java signature with xrefs from a Java entity
+--
+prettyJavaSignature
+  :: LayoutOptions
+  -> RepoName
+  -> SymbolId
+  -> Java.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyJavaSignature opts repo sym (Java.Entity_decl decl) = runMaybeT $ do
+    def <- maybeT $ fmap (pprDeclaration sym) <$> fromAngleDeclaration decl
+    maybeT $ Just <$> sequence (annotateDocs def)
+  where
+    annotateDocs doc = reAnnotateS (declToSymbolId repo) (layoutSmart opts doc)
+prettyJavaSignature _ _ _ Java.Entity_EMPTY = return Nothing
+
+declToSymbolId :: RepoName -> Ann -> Glean.RepoHaxl u w (Maybe SymbolId)
+declToSymbolId _repo None = return Nothing
+declToSymbolId _repo (SymId symId) = return (Just symId)
+declToSymbolId repo (BareDecl decl filepath) = Just <$>
+    toSymbolId (fromGleanPath repo filepath) entity
+  where
+    entity = Code.Entity_java (Java.Entity_decl decl)
+
+fromAngleDeclaration
+  :: Java.Declaration -> Glean.RepoHaxl u w (Maybe Declaration)
+fromAngleDeclaration def = case def of
+{-
+  Java.Declaration_param e -> Just <$> (fromParamDeclaration =<< Glean.keyOf e)
+  Java.Declaration_local e -> Just <$> (fromLocalDeclaration =<< Glean.keyOf e)
+-}
+  Java.Declaration_field e -> Just <$> (fromFieldDeclaration =<< Glean.keyOf e)
+  Java.Declaration_ctor e -> Just <$> (fromCtorDeclaration =<< Glean.keyOf e)
+  Java.Declaration_method e -> Just <$>
+    (fromMethodDeclaration =<< Glean.keyOf e)
+  Java.Declaration_interface_ e ->
+    Just <$> (fromInterfaceDeclaration =<< Glean.keyOf e)
+  Java.Declaration_class_ e -> Just <$> (fromClassDeclaration =<< Glean.keyOf e)
+  Java.Declaration_enum_ e -> Just <$> (fromEnumDeclaration =<< Glean.keyOf e)
+  _ -> pure Nothing
+
+fromMName :: JavaKotlin.MethodName -> Glean.RepoHaxl u w Name
+fromMName mname = do
+  JavaKotlin.MethodName_key qname _sig <- Glean.keyOf mname
+  fromQName qname
+
+fromQName :: JavaKotlin.QName -> Glean.RepoHaxl u w Name
+fromQName qname = do
+  JavaKotlin.QName_key nameFact _ctx <- Glean.keyOf qname
+  nameStr <- Glean.keyOf nameFact
+  return (Name nameStr)
+
+fromTypeParams :: [Java.TypeParam] -> Glean.RepoHaxl u w [TypeParam]
+fromTypeParams tys = mapM (fromTypeParam <=< Glean.keyOf) tys
+
+fromTypeParam :: Java.TypeParam_key -> Glean.RepoHaxl u w TypeParam
+fromTypeParam Java.TypeParam_key{..} = do
+  tyName <- Name <$> Glean.keyOf typeParam_key_name
+  tyExtends <- catMaybes <$>
+    mapM (fromType <=< Glean.keyOf) typeParam_key_extends_
+  return TypeParam{..}
+
+fromTypeArg :: Java.TypeArg_key -> Glean.RepoHaxl u w (Maybe TypeArg)
+fromTypeArg (Java.TypeArg_key_type ty) = do
+  theTy <- fromType =<< Glean.keyOf ty
+  return (TypeArg <$> theTy)
+fromTypeArg (Java.TypeArg_key_wildcard card) = case card of
+  Java.Wildcard_extends_ ty -> do
+    mty <- fromType =<< Glean.keyOf ty
+    return (TypeArgWild . Extends <$> mty)
+  Java.Wildcard_super_ ty -> do
+    mty <- fromType =<< Glean.keyOf ty
+    return (TypeArgWild . Super <$> mty)
+  Java.Wildcard_unbounded _b -> pure (Just (TypeArgWild UnboundedWildcard))
+  Java.Wildcard_EMPTY{} -> pure Nothing
+fromTypeArg Java.TypeArg_key_EMPTY{} = pure Nothing
+
+-- todo: type args and interop types
+fromType :: Java.Type_key -> Glean.RepoHaxl u w (Maybe Type)
+fromType Java.Type_key{..} = do
+  typeArgs <- catMaybes <$> mapM (fromTypeArg <=< Glean.keyOf) type_key_typeArgs
+  case type_key_baseType of
+    Java.BaseType_object oTy -> do
+      Java.ObjectType_key{..} <- Glean.keyOf oTy
+      typeName <- fromQName objectType_key_type
+      mDecl <- fetchDataRecursive $
+        qnameToDecl (Glean.getId objectType_key_type)
+      typeXRefs <- case mDecl of
+        Nothing -> pure Nothing
+        Just (decl, srcFile) -> do
+          file <- GleanPath <$> Glean.keyOf srcFile
+          return (Just (decl, file))
+      return (Just Type{..})
+    Java.BaseType_primitive pTy  -> do
+      Java.PrimitiveType_key{..} <- Glean.keyOf pTy
+      return (Just (Type (Name primitiveType_key_type) typeArgs Nothing))
+    Java.BaseType_variable vTy -> do
+      Java.TypeVar_key{..} <- Glean.keyOf vTy
+      nameStr <- Name <$> Glean.keyOf typeVar_key_type
+      return (Just (Type nameStr typeArgs Nothing))
+    Java.BaseType_array aTy -> do
+      Java.ArrayType_key{..} <- Glean.keyOf aTy
+      typeFact <- Glean.keyOf arrayType_key_contents
+      ty <- fromType typeFact
+      return $ case ty of
+        Nothing -> Nothing
+        Just ty -> Just (ArrayType ty)
+    JavaKotlin.BaseType_EMPTY{} ->
+      return Nothing
+
+fromFieldDeclaration
+  :: Java.FieldDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromFieldDeclaration Java.FieldDeclaration_key{..} = do
+  let modifiers = fieldDeclaration_key_modifiers
+  fieldName <- fromQName fieldDeclaration_key_name
+  fieldTy <- fromType =<< Glean.keyOf fieldDeclaration_key_type
+  return Field {..}
+
+fromMethodDeclaration
+  :: Java.MethodDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromMethodDeclaration Java.MethodDeclaration_key{..} = do
+  let modifiers = methodDeclaration_key_modifiers
+  methName <- fromMName methodDeclaration_key_name
+  params <- mapM (fromParamDeclaration <=< Glean.keyOf)
+    methodDeclaration_key_parameters
+  returnTy <- fromType =<< Glean.keyOf methodDeclaration_key_returnType
+  throwTys <- catMaybes <$> mapM (fromType <=< Glean.keyOf)
+    methodDeclaration_key_throws_
+  return Method {..}
+
+fromCtorDeclaration
+  :: Java.ConstructorDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromCtorDeclaration Java.ConstructorDeclaration_key{..} = do
+  let modifiers = constructorDeclaration_key_modifiers
+
+  JavaKotlin.MethodName_key qname _ <-
+    Glean.keyOf constructorDeclaration_key_name
+  JavaKotlin.QName_key _name path <- Glean.keyOf qname
+  JavaKotlin.Path_key base _ <- Glean.keyOf path
+  pNameStr <- Name <$> Glean.keyOf base
+
+  mParentDecl <- case constructorDeclaration_key_container of
+        Java.Definition_class_ decl -> do
+          key <- Glean.keyOf decl
+          return $ Just (Java.Declaration_class_ decl
+                 ,Java.classDeclaration_key_file key)
+
+        Java.Definition_interface_ decl -> do
+          key <- Glean.keyOf decl
+          return $ Just (Java.Declaration_interface_ decl
+                  ,Java.interfaceDeclaration_key_file key)
+        Java.Definition_enum_ decl -> do
+          key <- Glean.keyOf decl
+          return $ Just (Java.Declaration_enum_ decl
+                  ,Java.enumDeclaration_key_file key)
+
+        Java.Definition_EMPTY{} -> pure Nothing
+
+  parent <- Type pNameStr [] <$> case mParentDecl of
+        Nothing -> pure Nothing
+        Just (decl, srcFile) -> do
+          path <- GleanPath <$> Glean.keyOf srcFile
+          return (Just (decl, path))
+
+  params <- mapM (fromParamDeclaration <=< Glean.keyOf)
+    constructorDeclaration_key_parameters
+  throwTys <- catMaybes <$> mapM (fromType <=< Glean.keyOf)
+    constructorDeclaration_key_throws_
+  return CTor {..}
+
+fromAnn :: Java.Annotation -> Glean.RepoHaxl u w Annotation
+fromAnn ann = do
+  Java.Annotation_key{..} <- Glean.keyOf ann
+  Annotation <$> fromQName annotation_key_name
+
+fromParamDeclaration
+  :: Java.ParameterDeclaration_key -> Glean.RepoHaxl u w Parameter
+fromParamDeclaration Java.ParameterDeclaration_key{..} = do
+  pName <- fromQName parameterDeclaration_key_name
+  pType <- fromType =<< Glean.keyOf parameterDeclaration_key_type
+  pAnns <- mapM fromAnn parameterDeclaration_key_annotations
+  return Parameter {..}
+
+fromClassDeclaration
+  :: Java.ClassDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromClassDeclaration Java.ClassDeclaration_key{..} = do
+  clsName <- fromQName classDeclaration_key_name
+  typeParams <- fromTypeParams classDeclaration_key_typeParams
+  let modifiers = classDeclaration_key_modifiers
+  return Class {..}
+
+fromInterfaceDeclaration
+  :: Java.InterfaceDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromInterfaceDeclaration Java.InterfaceDeclaration_key{..} = do
+  ifaceName <- fromQName interfaceDeclaration_key_name
+  typeParams <- fromTypeParams interfaceDeclaration_key_typeParams
+  let modifiers = interfaceDeclaration_key_modifiers
+  return Interface {..}
+
+fromEnumDeclaration
+  :: Java.EnumDeclaration_key -> Glean.RepoHaxl u w Declaration
+fromEnumDeclaration Java.EnumDeclaration_key{..} = do
+  enumName <- fromQName enumDeclaration_key_name
+  let modifiers = enumDeclaration_key_modifiers
+  return Enum {..}
+
+pprDeclaration :: SymbolId -> Declaration -> Doc Ann
+pprDeclaration self (Class mods name []) =
+  hsep (map pprModifier mods) <+>
+  "class" <+> annotate (SymId self) (pprName name)
+pprDeclaration self (Class mods name tys) =
+  hsep (map pprModifier mods) <+>
+  "class" <+> annotate (SymId self) (pprName name) <>
+    hcat ("<" : punctuate comma (map pprTypeParam tys) ++ [">"])
+pprDeclaration self (Interface mods name []) =
+  hsep (map pprModifier mods) <+>
+  "interface" <+> annotate (SymId self) (pprName name)
+pprDeclaration self (Interface mods name tys) =
+  hsep (map pprModifier mods) <+>
+  "interface" <+> annotate (SymId self) (pprName name) <>
+    hcat ("<" : punctuate comma (map pprTypeParam tys) ++ [">"])
+pprDeclaration self (Enum mods name) =
+  hsep (map pprModifier mods) <+>
+  "enum" <+> annotate (SymId self) (pprName name)
+pprDeclaration self (Method _mods name params retTy throwTys) =
+  maybe emptyDoc pprType retTy <+>
+  annotate (SymId self) (pprName name) <> pprParamList params <> (
+      if null throwTys then emptyDoc
+        else hang 4 (space <> "throws"
+           <+> hsep (punctuate comma (map pprType throwTys)))
+    )
+pprDeclaration _self (CTor _mods parent params throwTys) =
+  pprType parent <> pprParamList params <> (
+      if null throwTys then emptyDoc
+        else nest 4 (space <> "throws"
+           <+> hsep (punctuate comma (map pprType throwTys)))
+    )
+pprDeclaration self (Field _mods name fieldTy) =
+  maybe emptyDoc pprType fieldTy <+>
+    annotate (SymId self) (pprName name)
+
+pprParamList :: [Parameter] -> Doc Ann
+pprParamList [] = "()"
+pprParamList ps
+ | length ps < 5 = "(" <> hsep (punctuate comma (map pprParam ps)) <> ")"
+ | otherwise = vcat [
+      nest 4 (vcat ("(" : punctuate comma (map pprParam ps))),
+      ")"
+    ]
+
+pprParam :: Parameter -> Doc Ann
+pprParam (Parameter name mty []) = maybe emptyDoc pprType mty <+> pprName name
+pprParam (Parameter name mty anns) =
+  hsep (map pprAnn anns) <+> maybe emptyDoc pprType mty <+> pprName name
+
+pprAnn :: Annotation -> Doc Ann
+pprAnn (Annotation n) = "@" <> pprName n
+
+pprModifier :: Java.Modifier -> Doc Ann
+pprModifier m = case m of
+  Java.Modifier_abstract_ -> "abstract"
+  Java.Modifier_default_ -> "default"
+  Java.Modifier_final_ -> "final"
+  Java.Modifier_native_ -> "native"
+  Java.Modifier_private_ -> "private"
+  Java.Modifier_protected_ -> "protected"
+  Java.Modifier_public_ -> "public"
+  Java.Modifier_static_ -> "static"
+  Java.Modifier_strictfp_ -> "strictfp"
+  Java.Modifier_synchronized_ -> "synchronized"
+  Java.Modifier_transient_ -> "transient"
+  Java.Modifier_volatile_ -> "volatile"
+  Java.Modifier__UNKNOWN{} -> emptyDoc
+
+-- grab the symbol id here and we can xref it
+pprTypeParam :: TypeParam -> Doc Ann
+pprTypeParam (TypeParam nm []) = pprName nm
+pprTypeParam (TypeParam nm exts) = pprName nm <+> "extends" <+>
+  hsep (punctuate comma (map pprType exts))
+
+pprTypeArg :: TypeArg -> Doc Ann
+pprTypeArg (TypeArg ty) = pprType ty
+pprTypeArg (TypeArgWild card) = case card of
+  Extends ty -> "?" <+> "extends" <+> pprType ty
+  Super ty -> "?" <+> "super" <+> pprType ty
+  UnboundedWildcard -> "?"
+
+pprType :: Type -> Doc Ann
+pprType (Type nm [] Nothing) = pprName nm
+pprType (Type nm args Nothing) = pprName nm <>
+  hcat ("<" : punctuate comma (map pprTypeArg args) ++ [">"])
+pprType (Type nm _args (Just (decl, file))) =
+  annotate (BareDecl decl file) $ pprName nm
+pprType (ArrayType nm) = pprType nm <> "[]"
+
+pprName :: Name -> Doc Ann
+pprName (Name name) = pretty name
+
+qnameToDecl :: Glean.IdOf JavaKotlin.QName -> Angle (Java.Declaration, Src.File)
+qnameToDecl qnameId = vars $ \(decl :: Angle Java.Declaration)
+  (file :: Angle Src.File) ->
+      tuple (decl, file) `where_` [
+        wild .= predicate @Java.QNameToDefinition (
+          rec $
+            field @"name" (asPredicate (factId qnameId)) $
+            field @"defn" decl
+          end
+        ),
+        wild .= predicate @Java.DeclarationLocation (
+          rec $
+            field @"decl" decl $
+            field @"file" (asPredicate file)
+          end
+        )
+      ]
diff --git a/glean/glass/Glean/Glass/Pretty/LSIF.hs b/glean/glass/Glean/Glass/Pretty/LSIF.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/LSIF.hs
@@ -0,0 +1,53 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Pretty.LSIF ( prettyLsifSignature ) where
+
+import Data.Text ( Text )
+
+import qualified Glean
+import Glean.Angle as Angle
+import Glean.Haxl.Repos as Glean ( RepoHaxl )
+import Glean.Glass.Utils ( fetchData )
+import Compat.Prettyprinter
+  (pretty,
+   layoutSmart,
+   LayoutOptions,
+   SimpleDocStream,
+   reAnnotateS)
+
+import qualified Glean.Schema.Lsif.Types as LSIF
+import Glean.Glass.Types ( SymbolId(..) )
+
+prettyLsifSignature
+  :: LayoutOptions
+  -> LSIF.SomeEntity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyLsifSignature opts (LSIF.SomeEntity_defn dm) = do
+  LSIF.DefinitionMoniker_key{..} <- Glean.keyOf dm
+  text <- fetchData (definitionHover (Glean.getId definitionMoniker_key_defn))
+  let docStream = layoutSmart opts . pretty <$> text
+  return $ reAnnotateS (const Nothing) <$> docStream
+prettyLsifSignature _ _ = pure Nothing
+
+definitionHover :: Glean.IdOf LSIF.Definition -> Angle Text
+definitionHover defnId = vars $ \text hoverText ->
+  text `where_` [
+    wild .= predicate @LSIF.DefinitionHover (
+      rec $
+        field @"defn" (asPredicate (factId defnId)) $
+        field @"hover" (
+          rec $
+            field @"text" (asPredicate hoverText)
+          end)
+      end),
+    hoverText .= predicate @LSIF.HoverText text
+
+  ]
diff --git a/glean/glass/Glean/Glass/Pretty/Python.hs b/glean/glass/Glean/Glass/Pretty/Python.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/Python.hs
@@ -0,0 +1,429 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo #-}
+
+module Glean.Glass.Pretty.Python
+  (
+    prettyPythonSignature
+  ) where
+
+import Data.Maybe ( mapMaybe, isNothing )
+import Data.Map.Strict ( Map )
+import qualified Data.Map.Strict as Map
+import Data.Text ( Text, takeWhileEnd )
+import Compat.Prettyprinter
+import Control.Monad.Trans.Maybe (MaybeT (..))
+import Control.Monad ( forM )
+import Util.List ( uniq )
+
+import Glean.Angle as Angle
+import Glean.Glass.Path ( fromGleanPath )
+import Glean.Glass.Base ( GleanPath(GleanPath) )
+import Glean.Glass.Types ( SymbolId(..), RepoName(..) )
+import Glean.Glass.Utils
+import Glean.Glass.SymbolId ( toSymbolId )
+import Glean.Util.ToAngle ( ToAngle(toAngle) )
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Schema.CodePython.Types as Python ( Entity(..) )
+import qualified Glean.Schema.Python.Types as Python
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+
+-- Type of Python entity signatures to capture the the subset we generate
+-- We use this to separate the processing of the Glean type from the text
+-- we wish to generate
+
+-- Python symbol kinds
+data Definition
+  = Function {
+      funModifier :: !AsyncModifier,
+      funName :: !Name,
+      funParams :: [Parameter], -- regular parameters
+      funPosOnlyParams :: [Parameter], -- posonly
+      funKWOnlyParams :: [Parameter], -- kw only
+      funStarArg :: Maybe Parameter, -- star args
+      funStarKWArg :: Maybe Parameter, --  star star kwargs
+      funRetType :: !AType
+    }
+  | Module !Name
+  | Variable !Name !AType
+  | Class {
+      _clsName :: !Name,
+      _baseNames :: [Name]
+    }
+
+data AType
+  = NoType
+  | AType !PyType XRefs
+
+data Parameter = Parameter !Name (Maybe ExprText) !(Maybe PyType) XRefs
+
+-- modifiers
+data AsyncModifier = Async | NotAsync
+ deriving (Eq, Show)
+
+newtype ExprText = ExprText Text
+
+-- names
+newtype Name = Name Text
+
+newtype PyType = PyType Text
+
+type XRef = (Python.Declaration, Src.ByteSpan, GleanPath)
+type XRefs = [XRef]
+
+data Ann
+  = None
+  | BareDecl !Python.Declaration !GleanPath
+  | SymId !SymbolId
+
+prettyPythonSignature
+  :: LayoutOptions
+  -> RepoName
+  -> SymbolId
+  -> Python.Entity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyPythonSignature opts repo sym (Python.Entity_decl decl) = runMaybeT $ do
+    pyDef <- maybeT $ fetchDataRecursive (angleDeclToDef (toAngle decl))
+    def <- maybeT $ fmap (pprDefinition sym) <$> fromAngleDefinition pyDef
+    maybeT $ Just <$> sequence (annotateDocs def)
+  where
+    annotateDocs doc = reAnnotateS (declToSymbolId repo) (layoutSmart opts doc)
+prettyPythonSignature _ _ _ Python.Entity_EMPTY = return Nothing
+
+declToSymbolId :: RepoName -> Ann -> Glean.RepoHaxl u w (Maybe SymbolId)
+declToSymbolId _repo None = return Nothing
+declToSymbolId _repo (SymId symId) = return (Just symId)
+declToSymbolId repo (BareDecl decl filepath) = Just <$>
+    toSymbolId (fromGleanPath repo filepath) entity
+  where
+    entity = Code.Entity_python (Python.Entity_decl decl)
+
+fromAngleDefinition
+  :: Python.Definition -> Glean.RepoHaxl u w (Maybe Definition)
+fromAngleDefinition def = case def of
+  Python.Definition_func fn -> Just <$>
+    (fromFunctionDefinition =<< Glean.keyOf fn)
+  Python.Definition_module m -> Just <$>
+    (fromModuleDefinition =<< Glean.keyOf m)
+  Python.Definition_cls c -> Just <$>
+    (fromClassDefinition =<< Glean.keyOf c)
+  Python.Definition_variable v -> Just <$>
+    (fromVariableDefinition =<< Glean.keyOf v)
+  _ -> pure Nothing
+
+fromClassDefinition
+  :: Python.ClassDefinition_key -> Glean.RepoHaxl u w Definition
+fromClassDefinition def = do
+  Python.ClassDeclaration_key name _bases <- Glean.keyOf decl
+  -- get class xrefs from bases
+  baseNames <- case mBases of
+    Nothing -> pure []
+    Just decls ->
+      mapM (fmap Python.classDeclaration_key_name <$> Glean.keyOf) decls
+
+  nameStr <- trimModule <$> Glean.keyOf name
+  baseStrs <- mapM (fmap trimModule <$> Glean.keyOf) baseNames
+  return $ Class nameStr baseStrs
+  where
+    Python.ClassDefinition_key {
+      classDefinition_key_bases = mBases,
+      classDefinition_key_declaration = decl
+    } = def
+
+fromVariableDefinition
+  :: Python.VariableDefinition_key -> Glean.RepoHaxl u w Definition
+fromVariableDefinition def = do
+  Python.VariableDeclaration_key name <- Glean.keyOf decl
+  let mVarTy = case mTypeInfo of
+        Nothing -> Nothing
+        Just tyInfo ->
+          let tyNames = map Python.xRefViaName_target
+                (Python.typeInfo_xrefs tyInfo)
+          in Just (tyNames, tyInfo)
+  declMap <- fetchDeclWithNames $ maybe [] fst mVarTy
+  varType <- case mVarTy of
+    Nothing -> pure NoType
+    Just (_, retTyInfo) -> do
+      retTyText <- fromTypeInfo retTyInfo
+      pure $ AType retTyText (mkXRefs declMap retTyInfo)
+  varName <- trimModule <$> Glean.keyOf name
+  return $ Variable varName varType
+  where
+    Python.VariableDefinition_key {
+      variableDefinition_key_typeInfo = mTypeInfo,
+      variableDefinition_key_declaration = decl
+    } = def
+
+fromModuleDefinition
+  :: Python.ModuleDefinition_key -> Glean.RepoHaxl u w Definition
+fromModuleDefinition (Python.ModuleDefinition_key mod) = do
+  Python.Module_key name <- Glean.keyOf mod
+  modName <- Glean.keyOf name
+  return $ Module (Name modName)
+
+fromFunctionDefinition
+  :: Python.FunctionDefinition_key -> Glean.RepoHaxl u w Definition
+fromFunctionDefinition def = do
+  Python.FunctionDeclaration_key name <- Glean.keyOf decl
+
+  let returnTy = case mReturnTy of
+        Nothing -> Nothing
+        Just tyInfo ->
+          let retTypeDeclNames = map Python.xRefViaName_target
+                (Python.typeInfo_xrefs tyInfo)
+          in Just (retTypeDeclNames, tyInfo)
+
+  -- resolve all names to their xref decls in one shot
+  declMap <- fetchDeclWithNames $ concat
+    [ map Python.xRefViaName_target (Python.typeInfo_xrefs tyInfo)
+    | Just tyInfo <- map Python.parameter_typeInfo pyParams
+    ] ++ maybe [] fst returnTy
+      ++ maybe []
+            (map Python.xRefViaName_target . Python.typeInfo_xrefs)
+            (Python.parameter_typeInfo =<< mStarKWArg)
+      ++ maybe []
+            (map Python.xRefViaName_target . Python.typeInfo_xrefs)
+            (Python.parameter_typeInfo =<< mStarArg)
+      ++ maybe [] (\ps -> concat
+          [ map Python.xRefViaName_target (Python.typeInfo_xrefs tyInfo)
+          | Just tyInfo <- map Python.parameter_typeInfo ps
+          ]) mKWOnlyParams
+      ++ maybe [] (\ps -> concat
+          [ map Python.xRefViaName_target (Python.typeInfo_xrefs tyInfo)
+          | Just tyInfo <- map Python.parameter_typeInfo ps
+          ]) mPosOnlyParams
+
+  let regParamsAndXRefs =
+        [ case parameter_typeInfo of
+            Nothing -> (param, [])
+            Just tyInfo -> (param, mkXRefs declMap tyInfo)
+        | param@Python.Parameter{..} <- pyParams
+        ]
+  let kwOnlyParamsAndXRefs = case mKWOnlyParams of
+        Nothing -> []
+        Just ps ->
+          [ case parameter_typeInfo of
+              Nothing -> (param, [])
+              Just tyInfo -> (param, mkXRefs declMap tyInfo)
+          | param@Python.Parameter{..} <- ps
+          ]
+  let posOnlyParamsAndXRefs = case mPosOnlyParams of
+        Nothing -> []
+        Just ps ->
+          [ case parameter_typeInfo of
+              Nothing -> (param, [])
+              Just tyInfo -> (param, mkXRefs declMap tyInfo)
+          | param@Python.Parameter{..} <- ps
+          ]
+  let starKWArgsAndXRefs = case mStarKWArg of
+        Nothing -> Nothing
+        Just param@Python.Parameter{..} -> Just $ case parameter_typeInfo of
+            Nothing -> (param, []) -- has no type info
+            Just tyInfo -> (param, mkXRefs declMap tyInfo)
+  let starArgAndXRefs = case mStarArg of
+        Nothing -> Nothing
+        Just param@Python.Parameter{..} -> Just $ case parameter_typeInfo of
+            Nothing -> (param, []) -- has no type info
+            Just tyInfo -> (param, mkXRefs declMap tyInfo)
+
+  funRetType <- case returnTy of
+    Nothing -> pure NoType
+    Just (_, retTyInfo) -> do
+      retTyText <- fromTypeInfo retTyInfo
+      pure $ AType retTyText (mkXRefs declMap retTyInfo)
+
+  funName <- trimModule <$> Glean.keyOf name
+  funParams <- mapM fromParameter regParamsAndXRefs
+  funPosOnlyParams <- mapM fromParameter posOnlyParamsAndXRefs
+  funKWOnlyParams <- mapM fromParameter kwOnlyParamsAndXRefs
+  funStarKWArg <- mapM fromParameter starKWArgsAndXRefs
+  funStarArg <- mapM fromParameter starArgAndXRefs
+
+  return $ Function { funModifier = if async then Async else NotAsync, .. }
+  where
+    Python.FunctionDefinition_key {
+      functionDefinition_key_declaration = decl,
+      functionDefinition_key_is_async = async,
+      functionDefinition_key_params = pyParams,
+      functionDefinition_key_kwonly_params = mKWOnlyParams,
+      functionDefinition_key_posonly_params = mPosOnlyParams,
+      functionDefinition_key_star_arg = mStarArg,
+      functionDefinition_key_star_kwarg = mStarKWArg,
+      functionDefinition_key_returnsInfo = mReturnTy
+    } = def
+
+mkXRefs
+  :: Map.Map Python.Name (Python.Declaration, GleanPath)
+  -> Python.TypeInfo
+  -> XRefs
+mkXRefs declMap Python.TypeInfo{..} =
+  mapMaybe (\Python.XRefViaName{..} ->
+    case Map.lookup xRefViaName_target declMap of
+      Nothing -> Nothing
+      Just (decl, path) -> Just (decl, xRefViaName_source, path)
+  ) typeInfo_xrefs
+
+fromTypeInfo  :: Python.TypeInfo -> Glean.RepoHaxl u w PyType
+fromTypeInfo Python.TypeInfo{..} = PyType <$> Glean.keyOf
+  typeInfo_displayType
+
+fromParameter :: (Python.Parameter, XRefs) -> Glean.RepoHaxl u w Parameter
+fromParameter (Python.Parameter{..}, xrefs) = do
+  nameStr <- Glean.keyOf parameter_name
+  tyInfo <- case parameter_typeInfo of
+    Nothing -> return Nothing
+    Just ty -> Just <$> fromTypeInfo ty
+  return $ Parameter (Name nameStr) (ExprText <$> parameter_value) tyInfo xrefs
+
+pprDefinition :: SymbolId -> Definition -> Doc Ann
+pprDefinition self (Module name) =
+  "module" <+> annotate (SymId self) (pprName name)
+pprDefinition self (Class name _) =
+  "class" <+> annotate (SymId self) (pprName name)
+
+pprDefinition self (Variable name mTyInfo) =
+  annotate (SymId self) (pprName name) <> case mTyInfo of
+    NoType -> emptyDoc
+    AType ty xrefs -> colon <+> pprTypeXRefs ty xrefs
+
+-- empty param case
+pprDefinition self (Function async name [] [] [] Nothing Nothing returnTy) =
+  hcat [
+   pprAsync async, "def" <+>
+      annotate (SymId self) (pprName name), "()",
+   pprReturnType returnTy
+  ]
+-- full param list
+pprDefinition self (Function async name params posOnlyParams
+       kwOnlyParams starArg starKWArg returnTy) =
+  vcat [
+    nest 4 (vsep (
+      hcat [pprAsync async, "def" <> space,
+        annotate (SymId self) (pprName name) <> lparen] :
+      punctuate comma ( -- ordering is quite semantically sensitive
+        concat [
+          pprPosOnlyParams posOnlyParams,
+          map pprParam params,
+          maybe [] (pure . pprStarArg) starArg,
+          pprKWOnlyParams (isNothing starArg) kwOnlyParams,
+          maybe [] (pure . pprStarKWArg) starKWArg
+        ]))),
+    rparen <> pprReturnType returnTy
+    ]
+
+pprAsync :: AsyncModifier -> Doc Ann
+pprAsync Async = "async" <> space
+pprAsync _ = emptyDoc
+
+pprReturnType :: AType -> Doc Ann
+pprReturnType NoType = emptyDoc
+pprReturnType (AType ty xrefs) = space <> "->" <+> pprTypeXRefs ty xrefs
+
+pprKWOnlyParams :: Bool -> [Parameter] -> [Doc Ann]
+pprKWOnlyParams _ [] = []
+pprKWOnlyParams True xs  = "*" : map pprParam xs
+pprKWOnlyParams False xs =       map pprParam xs
+
+pprPosOnlyParams :: [Parameter] -> [Doc Ann]
+pprPosOnlyParams [] = []
+pprPosOnlyParams xs = map pprParam xs ++ ["/"]
+
+pprParam :: Parameter -> Doc Ann
+pprParam (Parameter name mDefValue mty xrefs) = hcat
+  [ pprName name
+  , case mty of
+    Nothing -> emptyDoc
+    Just ty -> colon <+> pprTypeXRefs ty xrefs
+  , case mDefValue of
+    Nothing -> emptyDoc
+    Just (ExprText val) -> space <> equals <+> pretty val
+  ]
+
+pprStarArg :: Parameter -> Doc Ann
+pprStarArg param = "*" <> pprParam param
+
+pprStarKWArg :: Parameter -> Doc Ann
+pprStarKWArg param = "**" <> pprParam param
+
+pprName :: Name -> Doc Ann
+pprName (Name name) = pretty name
+
+pprTypeXRefs :: PyType -> XRefs -> Doc Ann
+pprTypeXRefs (PyType ty) xrefs =
+    mconcat $ (\(frag, ann) -> annotate (toAnn ann) $ pretty frag) <$>
+      splitString ty spans
+  where
+    toAnn Nothing = None
+    toAnn (Just (decl, path)) = BareDecl decl path
+
+    spans = map (\(decl, Src.ByteSpan{..}, filepath) ->
+               ((decl,filepath), fromIntegral (Glean.fromNat byteSpan_start)
+                   , fromIntegral (Glean.fromNat byteSpan_length))) xrefs
+
+--
+-- | Convert a list of python.Names into their corresponding decl/location pairs
+--
+fetchDeclWithNames
+  :: [Python.Name]
+  -> Glean.RepoHaxl u w (Map Python.Name (Python.Declaration, GleanPath))
+fetchDeclWithNames [] = pure mempty
+fetchDeclWithNames names = do
+  (result,_truncated) <- searchRecursiveWithLimit maxXRefs
+    (angleDeclsByNames ids)
+  Map.fromList <$> forM result (\(decl,srcFile) -> do
+    Python.DeclarationWithName_key{..} <- Glean.keyOf decl
+    filepath <- GleanPath <$> Glean.keyOf srcFile
+    let decl = (declarationWithName_key_declaration, filepath)
+        name = declarationWithName_key_name
+    return (name, decl)
+   )
+  where
+    maxXRefs = Just (length ids)
+
+    ids :: [Glean.IdOf Python.Name]
+    ids = uniq (map Glean.getId names)
+
+angleDeclToDef :: Angle Python.Declaration -> Angle Python.Definition
+angleDeclToDef decl = var $ \(def :: Angle Python.Definition) ->
+  def `where_` [
+    wild .= predicate @Python.DeclarationDefinition (
+      rec $
+        field @"declaration" decl $
+        field @"definition" def
+      end
+    )
+  ]
+
+-- Bulk convert each name to its definition entity and file location
+-- to build a symbol id later
+angleDeclsByNames
+  :: [Glean.IdOf Python.Name] -> Angle (Python.DeclarationWithName, Src.File)
+angleDeclsByNames names = vars $ \(decl :: Angle Python.Declaration)
+    (file :: Angle Src.File) (p :: Angle Python.DeclarationWithName) ->
+  tuple (p, file) `where_` [
+    p .= predicate @Python.DeclarationWithName (
+      rec $
+        field @"name" (asPredicate (elementsOf (factIdsArray names))) $
+        field @"declaration" decl
+      end),
+    wild .= predicate @Code.EntityLocation (
+      rec $
+        field @"entity" (alt @"python" (alt @"decl" decl)) $
+        field @"location" (rec $ field @"file" (asPredicate file) $ end)
+      end)
+    ]
+
+-- | we could use the sname here to lookup the associated decl fact
+-- as an xref in the type signature (c.f how Hack does this)
+trimModule :: Text -> Name
+trimModule qname = Name (takeWhileEnd (/= '.') qname)
diff --git a/glean/glass/Glean/Glass/Pretty/SCIP.hs b/glean/glass/Glean/Glass/Pretty/SCIP.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Pretty/SCIP.hs
@@ -0,0 +1,48 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Pretty.SCIP ( prettyScipSignature ) where
+
+import Data.Text ( Text )
+
+import qualified Glean
+import Glean.Angle as Angle
+import Glean.Haxl.Repos as Glean ( RepoHaxl )
+import Glean.Glass.Utils ( fetchData )
+import Compat.Prettyprinter
+  (pretty,
+   layoutSmart,
+   LayoutOptions,
+   SimpleDocStream,
+   reAnnotateS)
+
+import qualified Glean.Schema.Scip.Types as Scip
+import Glean.Glass.Types ( SymbolId(..) )
+
+prettyScipSignature
+  :: LayoutOptions
+  -> Scip.SomeEntity
+  -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+prettyScipSignature opts (Scip.SomeEntity defn) = do
+  text <- fetchData (definitionHover (Glean.getId defn)) -- just first result
+  let docStream = layoutSmart opts . pretty <$> text
+  return $ reAnnotateS (const Nothing) <$> docStream
+
+definitionHover :: Glean.IdOf Scip.Definition -> Angle Text
+definitionHover defnId = vars $ \text docText ->
+  text `where_` [
+    wild .= predicate @Scip.DefinitionDocumentation (
+      rec $
+        field @"defn" (asPredicate (factId defnId)) $
+        field @"docs" (asPredicate docText)
+      end),
+    docText .= predicate @Scip.Documentation text
+
+  ]
diff --git a/glean/glass/Glean/Glass/Query.hs b/glean/glass/Glean/Glass/Query.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Query.hs
@@ -0,0 +1,262 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Query
+  (
+  -- * Files
+    srcFile
+  , fileInfo
+  , fileDigests
+
+  -- * Working with XRefs
+  , fileEntityLocations
+  , fileEntityXRefsGenEntities
+
+  -- * Finding references to declarations
+  , findReferenceRangeSpan
+
+  -- * Finding references for call hierarchy
+  , findReferenceEntities
+  , findReferenceEntitiesFast
+
+  -- * Finding source definitions for generated entities
+  , generatedEntityToIdlEntity
+
+  -- * offsets and conversions to lines
+  , fileLines
+
+  -- * Entity annotations
+  , symbolKind
+
+  -- * Query helpers
+  , entityLocation
+
+  , symbolToEntity
+
+  ) where
+
+import Data.Text (Text)
+
+import qualified Glean
+import Glean.Angle as Angle
+
+import Glean.Glass.Base (GleanPath(..))
+
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Glass.Types as Glass
+import qualified Glean.Schema.Digest.Types as Digest
+
+--
+-- Find the id in this db of a source file. We mostly operate on these ids once
+-- we have them, to avoid passing strings around.
+--
+-- > src.File "www/flib/intern/glean/Glean.php"
+--
+srcFile :: GleanPath -> Angle Src.File
+srcFile (GleanPath path) =
+  predicate @Src.File $
+    string path
+
+-- For a potential filepath, fetch all file metadata
+fileInfo :: GleanPath -> Angle Glass.FileInfo
+fileInfo (GleanPath path) = predicate @Glass.FileInfo $
+  rec $
+    field @"file" (string path)
+  end
+
+-- | Given a file id, look up the index of line endings
+--
+-- Line ending tables are needed to do line:col conversions, but we want to
+-- minimize when we have to do this conversion. The Range vs Location types in
+-- the .thrift API capture when this is needed.
+--
+fileLines :: Glean.IdOf Src.File -> Angle Src.FileLines
+fileLines fileid =
+  predicate @Src.FileLines (
+    rec $ field @"file"
+      (asPredicate (factId fileid))
+    end)
+
+--
+-- Bulk fetch all digests for a set of filepath facts. Non-recursive, as the
+-- Digest type will expand. Extremely cheap
+--
+-- > digest.FileDigest { file = [$371971 : src.File, $61059][..] }
+--
+fileDigests :: [Glean.IdOf Src.File] -> Angle Digest.FileDigest
+fileDigests fileIds =
+  predicate @Digest.FileDigest (
+    rec $ field @"file"
+      (asPredicate (elementsOf (factIdsArray fileIds)))
+    end)
+
+-- | Get the definition entities defined in this file, and their declaration
+-- sites.
+--
+-- > www> src.File "www/flib/intern/glean/Glean.php"
+-- { "id": 123968960, "key": "www/flib/intern/glean/Glean.php" }
+--
+-- > {L , E} where
+-- >  codemarkup.FileEntityLocations {$123968960, L, E}
+--
+fileEntityLocations :: Glean.IdOf Src.File -> Angle (Code.Location, Code.Entity)
+fileEntityLocations fileid =
+  vars $ \(location :: Angle Code.Location) (entity :: Angle Code.Entity) ->
+    tuple (location,entity) `where_` [
+      wild .= predicate @Code.FileEntityLocations (
+        rec $
+          field @"file" (asPredicate (factId fileid)) $
+          field @"location" location $
+          field @"entity" entity
+        end)
+      ]
+
+-- | Find all "generic" xrefs from this file, regular and xlang
+fileEntityXRefsGenEntities
+ :: Glean.IdOf Src.File
+ -> Bool
+ -> Angle Code.GenericEntity
+fileEntityXRefsGenEntities fileid includeXRefs =
+   vars $ \(genEntity :: Angle Code.GenericEntity) ->
+    genEntity `where_` (
+      stmt (predicate @Code.FileXRefsGenericEntities (
+        rec $
+          field @"file" (asPredicate (factId fileid)) $
+          field @"genEntity" genEntity
+        end)) : [genEntity .= alt @"plainEntity" wild | not includeXRefs])
+
+-- | Entity-based find-references returning native range or bytespan
+findReferenceRangeSpan
+  :: Angle Code.Entity
+  -> Angle (Src.File, Code.RangeSpan)
+findReferenceRangeSpan ent =
+  vars $ \(reffile :: Angle Src.File) (rangespan :: Angle Code.RangeSpan) ->
+    Angle.tuple (reffile, rangespan) `where_` [
+      wild .= predicate @Code.EntityReferences (
+      rec $
+          field @"target" ent $
+          field @"file" (asPredicate reffile) $
+          field @"range" rangespan
+        end
+      )
+    ]
+
+generatedEntityToIdlEntity
+  :: Angle Code.Entity
+  -> Angle (Code.Entity, Src.File)
+generatedEntityToIdlEntity entity =
+  vars $ \(idlEntity :: Angle Code.Entity) (file :: Angle Src.File) ->
+    tuple (idlEntity, file) `where_` [
+      wild .=
+        predicate @Code.GeneratedEntityToIdlEntity (
+          rec $
+            field @"entity" entity $
+            field @"idlEntity" (rec $
+                field @"entity" (just idlEntity) $
+                field @"file" (asPredicate file)
+              end)
+          end)
+    ]
+
+-- | Entity-based find-references for call hierarchy.
+--   Returns referencing entities with their location, and the call site
+--   Beware: O(NM) on the number of referencing entites
+--           and the xrefs in their source files
+findReferenceEntities
+  :: Angle Code.Entity
+  -> Angle (Src.File, Code.Entity, Code.Location, Code.RangeSpan)
+findReferenceEntities ent =
+  vars $ \(reffile :: Angle Src.File)
+          (caller :: Angle Code.Entity)
+          (referenceRangespan :: Angle Code.RangeSpan)
+          (callerLocation :: Angle Code.Location)
+          ->
+    Angle.tuple (reffile, caller, callerLocation, referenceRangespan) `where_`
+    [ wild .= predicate @Code.ReferencingEntity (
+      rec $
+          field @"target" ent $
+          field @"referrer" caller $
+          field @"reference_file" (asPredicate reffile) $
+          field @"reference_range" referenceRangespan $
+          field @"referrer_location" callerLocation
+        end
+      )
+    , wild .= predicate @Code.FileEntityKinds (
+        rec $
+          field @"entity" caller $
+          field @"file" (asPredicate reffile) $
+          field @"kind"
+            (enum Code.SymbolKind_Constructor .|
+             enum Code.SymbolKind_Function .|
+             enum Code.SymbolKind_Macro .|
+             enum Code.SymbolKind_Method
+            )
+        end
+    )
+    ]
+
+-- | Like 'findReferenceEntities' but faster
+--   Available only for fbsource and www.hack
+--   Does not return call site locations
+findReferenceEntitiesFast
+  :: Angle Code.Entity -> Angle (Code.Entity, Code.Location)
+findReferenceEntitiesFast target =
+  vars $ \(caller :: Angle Code.Entity) (location :: Angle Code.Location) ->
+    Angle.tuple (caller, location) `where_`
+      [ wild .= predicate @Code.EntitySource (rec $
+          field @"target" target $
+          field @"source" caller
+          end)
+      , wild .= predicate @Code.EntityLocation (rec $
+          field @"entity" caller $
+          field @"location" location
+          end)
+      ]
+
+-- | Given an entity find the kind associated with it
+symbolKind :: Angle Code.Entity -> Angle Code.SymbolKind
+symbolKind ent = var $ \kind -> kind `where_`
+  [ wild .= predicate @Code.EntityKind (
+      rec $
+          field @"entity" ent $
+          field @"kind" kind
+      end)
+  ]
+
+-- | Helper to generate entity location footers on entity search queries
+-- Takes free file and rangespan variables to bind
+entityLocation
+  :: Angle Code.Entity
+  -> (Angle Src.File -> Angle Code.RangeSpan -> Angle Text -> AngleStatement)
+entityLocation entity file rangespan name =
+  wild .= predicate @Code.EntityLocation (
+    rec $
+      field @"entity" entity $
+      field @"location" (
+        rec $
+          field @"name" name $
+          field @"file" (asPredicate file) $
+          field @"location" rangespan
+        end)
+    end)
+
+symbolToEntity :: Angle Code.SymbolId -> Angle (Code.SymbolId, Code.Entity)
+symbolToEntity symbol =
+  vars $ \(entity :: Angle Code.Entity) ->
+    tuple (symbol, entity) `where_` [
+      wild .= predicate @Code.SymbolToEntity (
+        rec $
+          field @"symbol" symbol $
+          field @"entity" entity
+        end)
+    ]
diff --git a/glean/glass/Glean/Glass/Query/Cxx.hs b/glean/glass/Glean/Glass/Query/Cxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Query/Cxx.hs
@@ -0,0 +1,822 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Glass.Query.Cxx
+  (
+    documentSymbolsForCxx,
+    fileIncludeLocationsForCxx,
+    usrHashToDeclaration,
+    usrHashToXRefs,
+    usrToDeclaration,
+  ) where
+
+import Data.Maybe ( catMaybes )
+import Data.Map.Strict ( Map )
+import qualified Data.Map as Map
+import Data.Text (Text)
+import Safe (atMay)
+import Util.List ( uniq )
+
+import qualified Glean
+import Glean.Angle
+import Glean.Haxl.Repos as Glean
+
+import qualified Glean.Schema.CodemarkupCxx.Types as Code
+import qualified Glean.Schema.CodemarkupPp.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodeCxx.Types as Cxx
+import qualified Glean.Schema.CodePp.Types as Pp
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodeScip.Types as Scip
+import qualified Glean.Schema.CodemarkupScip.Types as Scip
+import Glean.Util.ToAngle ( ToAngle(toAngle) )
+import qualified Glean.Util.Range as Range
+
+import Glean.Glass.XRefs ( XRef, GenXRef(..), fetchCxxIdlXRefs )
+import Glean.Glass.Utils
+import qualified Glean.Schema.Codemarkup.Types as Code
+
+--
+-- The cxx1 schema is complicated for xrefs and decls, as files have multiple
+-- "traces" that instantiate them.
+--
+-- These are represented by cxx1.Trace values, and cxx1.FileXRef facts
+--
+-- We pick one trace and filexref set to start with, and use that to
+-- consistently index.
+--
+-- Definitions in file:
+-- * codemarkup.{cxx,pp}.{Cxx,Pp}ResolveTraceLocations
+--
+-- Computing xrefs:
+-- * fixed xrefs
+-- * variable xrefs
+-- * uses of decls to their defs
+-- * decls to def xrefs
+-- * def to decl xrefs
+--
+-- A frequent source of problems is enumerating too many traces and filexrefs
+--
+-- We also have a set of different kind of symbols
+-- * declarations, definitions, enumerators
+-- Compounding this, xrefs come in many forms
+-- * direct, indirect, unknown ,..
+--
+-- Finally, fixed and external xrefs are logically just xrefs, but
+-- one requires lookup and zip.
+--
+-- Finally, finally, we have to do c preprocessor symbols at the same time, via
+-- PPTrace tables
+--
+documentSymbolsForCxx
+  :: Maybe Int
+  -> Bool  -- ^ include references?
+  -> Bool  -- ^ include xlang references?
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w ([GenXRef], [(Code.Location, Code.Entity)], Bool)
+documentSymbolsForCxx mlimit includeRefs includeXlangRefs fileId = do
+  mTraceId <- getFirstFileTrace fileId
+  case mTraceId of
+    Nothing -> return ([], [], False)
+    Just traceId -> do
+      -- these can run concurrently
+      (defns, trunc1) <- fileEntityLocations mlimit traceId
+      (xrefs, trunc2{- one of the sub queries truncated-}) <- if includeRefs
+        then fileEntityXRefLocations mlimit fileId traceId includeXlangRefs
+        else return ([], False)
+      let (xrefs', trunc3) = maybeTake mlimit xrefs
+      return (xrefs', defns, trunc1 || trunc2 || trunc3)
+
+maybeTake :: Maybe Int -> [a] -> ([a], Bool)
+maybeTake Nothing xs = (xs, False)
+maybeTake (Just n) xs = (take n xs, m > n)
+  where
+    m = length xs
+
+-- | Get first (arbitrary) file trace
+-- TODO: we can generalize this to return more traces
+getFirstFileTrace
+  :: Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w (Maybe (Glean.IdOf Cxx.Trace))
+getFirstFileTrace = fetchFactIdOnly . cxxFileTrace
+
+-- | Get first file xrefs set, and keep the fact id around
+-- > cxx1.FileXRefs { xmap = { file = "fbcode/admarket/lib/stringdb/StringDB.h"
+--
+getFirstFileXRefs
+  :: Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w (Maybe (Glean.IdOf Cxx.FileXRefs))
+getFirstFileXRefs = fetchFactIdOnly . cxxFileXRefs
+
+--
+-- | Find the cxx and pp entities associated with a file, using
+-- a specific trace.
+--
+fileEntityLocations
+  :: Maybe Int
+  -> Glean.IdOf Cxx.Trace
+  -> Glean.RepoHaxl u w ([(Code.Location, Code.Entity)], Bool)
+fileEntityLocations mlimit traceId = searchRecursiveWithLimit mlimit $
+  cxxPpResolveTraceLocations traceId
+
+-- | Find xrefs from this file, and their associated entities,
+-- using a specific FileXRefMap annd cxx1.Trace
+--
+-- Share the Cxx.Trace fact between Cpp decls and xrefs for consistency
+--
+fileEntityXRefLocations
+  :: Maybe Int
+  -> Glean.IdOf Src.File
+  -> Glean.IdOf Cxx.Trace
+  -> Bool  -- ^ include xlang refs
+  -> Glean.RepoHaxl u w ([GenXRef], Bool)
+fileEntityXRefLocations mlimit fileId traceId includeXlangRefs = do
+  let reg (locEntities, trunc) = (PlainXRef <$> locEntities, trunc)
+  mresult <- getFirstFileXRefs fileId
+  extractIdl <- case (mresult, includeXlangRefs) of
+    -- fetch from Glean a map from generated entities to their idl entity
+    (Just xrefId, True) -> fetchCxxIdlXRefs mlimit xrefId
+    _ -> return reg
+  fixedAndVariable <- case mresult of -- C++ xrefs rely on a cxxFileXRefs fact
+    Nothing -> return []
+    Just xrefId -> do
+      fixedXRefs <- fixedXRefs mlimit xrefId
+      variableXRefs <- externalXRefs mlimit xrefId fileId
+      return [fixedXRefs, variableXRefs]
+  -- these do not depend on a cxx1.FileXRefs fact, run independently
+  ppxrefs <- ppXRefs mlimit traceId
+  defXRefs <- declToDefXRefs mlimit traceId
+  spellingXRefs <- spellingXRefs mlimit fileId
+  let result = (extractIdl <$> fixedAndVariable) ++
+        (reg <$> [ppxrefs, defXRefs, spellingXRefs])
+  return (concatMap fst result, any snd result)
+
+-- spelling (easily discoverable) xrefs
+spellingXRefs
+  :: Maybe Int
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w ([XRef], Bool)
+spellingXRefs mlimit fileId = searchRecursiveWithLimit mlimit $
+  cxxFileEntitySpellingXRefLocations fileId
+
+-- fixed (easily discoverable) xrefs
+fixedXRefs
+  :: Maybe Int
+  -> Glean.IdOf Cxx.FileXRefs
+  -> Glean.RepoHaxl u w ([XRef], Bool)
+fixedXRefs mlimit xmapId = searchRecursiveWithLimit mlimit $
+  cxxFileEntityXMapFixedXRefLocations xmapId
+
+-- and the external xrefs (zip)
+externalXRefs
+  :: Maybe Int
+  -> Glean.IdOf Cxx.FileXRefs
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w ([XRef], Bool)
+externalXRefs mlimit xrefId fileId = do
+  -- process concurrently
+  maybeRawXRefs <- variableXRefs xrefId
+  declToDefMap  <- externalDeclToDefXRefs mlimit xrefId
+  declLocMap <- externalDeclToLocations mlimit xrefId
+  case maybeRawXRefs of
+    Nothing -> return ([], False)
+    Just (sources, targets) -> do
+      locations <- mapM (mapM (cxxXRefTargetToLocation (fst declLocMap)))
+        [ xrefs | Cxx.XRefTargets{xRefTargets_key = Just xrefs} <- targets ]
+      let ranges = fromToRanges sources
+          declXRefs = zipXRefSourceAndTargets ranges locations
+          defnXRefs = zipXRefSourcesAndDefinitions (fst declToDefMap)
+                        ranges locations
+      indirectXRefs <- catMaybes <$> mapM (mkIndirectXRef fileId)
+        [ indirect
+        | Cxx.XRefTargets { xRefTargets_key = Just xrefs} <- targets
+        , Cxx.XRefTarget_indirect indirect <- xrefs -- initial indirect xrefs
+        ]
+      return (defnXRefs ++ declXRefs ++ indirectXRefs,
+        snd declLocMap || snd declToDefMap)
+  where
+    fromToRanges :: [Cxx.From] -> [[Src.ByteSpan]]
+    fromToRanges =
+      map (map Range.rangeToByteSpan . Range.fromToSpansAndSpellings)
+
+-- | Extract depth=1 "indirect" xref "via" targets, and make them into
+-- first-class xrefs results. Build xref source span from `via` emit target
+-- entity/location from target of "via"
+mkIndirectXRef
+  :: Glean.IdOf Src.File -- ^ we only want indirect xrefs whose use is here
+  -> Cxx.XRefIndirectTarget
+  -> Glean.RepoHaxl u w (Maybe XRef)
+mkIndirectXRef fileId viaFact = do
+  (Cxx.XRefIndirectTarget_key via target) <- Glean.keyOf viaFact
+  mXRefTarget <- cxxXRefTargetToLocation mempty target
+  case mXRefTarget of
+    Nothing -> return Nothing -- filter unknowns
+    Just (targetEntity, targetLocation) -> do -- now get the source from XRefVia
+      mSourceRange <- getXRefViaRange via
+      case mSourceRange of
+        Just sourceRange -- validate the via use is in this file only
+          | Glean.getId (Src.range_file sourceRange) == fileId -> do
+            let xrefLocation = Code.XRefLocation {
+                  Code.xRefLocation_target = targetLocation,
+                  Code.xRefLocation_source = Code.RangeSpan_range sourceRange
+                }
+            return $ Just (xrefLocation, targetEntity)
+        _ -> return Nothing
+
+-- Find the use span of an indirect xref: the `via` xref source range
+getXRefViaRange :: Cxx.XRefVia -> Glean.RepoHaxl u w (Maybe Src.Range)
+getXRefViaRange via = case via of
+  Cxx.XRefVia_usingDeclaration decl -> do
+    Cxx.UsingDeclaration_key _name range <- Glean.keyOf decl
+    return (Just range)
+{-
+-- TODO: until we verify how these behave, disable them:
+-- e.g "using namespace" is potentially a UPND source due to the import of
+-- many unrelated xrefs
+  Cxx.XRefVia_usingDirective decl -> do
+    Cxx.UsingDirective_key _name range <- Glean.keyOf decl
+    return (Just range)
+  Cxx.XRefVia_macro use -> do
+    Pp.Use_key _m _d _e source _name <- Glean.keyOf use
+    return (Just source) -- entire term including args is xref use site?
+-}
+  _ -> pure Nothing
+
+-- Laboriously stitch the unzipped xref source and target into
+-- XRefLocation and Entities again.
+zipXRefSourceAndTargets
+  :: [[Src.ByteSpan]]
+  -> [[Maybe (Code.Entity, Code.Location)]]
+  -> [XRef]
+zipXRefSourceAndTargets sources targets =
+  [ (xrefFromLocationAndSpan targetLocation span, entity)
+  | (spans, xrefs) <- zip sources targets
+  , span <- spans
+  , Just (entity, targetLocation) <- xrefs -- filter unknown xref targets
+  ]
+
+-- Laboriously stitch the unzipped xref source to target _definition_
+-- by looking it up in the decl to def map
+zipXRefSourcesAndDefinitions
+  :: DeclToDefMap
+  -> [[Src.ByteSpan]]
+  -> [[Maybe (Code.Entity, Code.Location)]]
+  -> [XRef]
+zipXRefSourcesAndDefinitions declToDefMap sources targets = catMaybes
+  [ case entity of
+      Cxx.Entity_decl decl -> do
+        (entity, targetLocation) <- Map.lookup decl declToDefMap
+        return (xrefFromLocationAndSpan targetLocation span, entity)
+      Cxx.Entity_objcSelectorSlot (Cxx.ObjcSelectorSlotEntity
+          (Cxx.ObjcMethodEntity_decl decl) idx) -> do
+        (Code.Entity_cxx (Cxx.Entity_defn (Cxx.Definition_objcMethod defn)), _)
+          <- Map.lookup (Cxx.Declaration_objcMethod decl) declToDefMap
+        (entity, location) <- objcSelectorSlotLocation $
+          Cxx.ObjcSelectorSlotEntity (Cxx.ObjcMethodEntity_defn defn) idx
+        return (xrefFromLocationAndSpan location span, entity)
+      _ -> Nothing
+  | (spans, xrefs) <- zip sources targets -- find just the decls
+  , span <- spans
+  , Just (Code.Entity_cxx entity, _) <- xrefs
+  ]
+
+xrefFromLocationAndSpan :: Code.Location -> Src.ByteSpan -> Code.XRefLocation
+xrefFromLocationAndSpan location span =
+  Code.XRefLocation {
+    Code.xRefLocation_target = location,
+    Code.xRefLocation_source = Code.RangeSpan_span span
+  }
+
+-- | Map of decl to their def entity
+type DeclToDefMap = Map Cxx.Declaration (Code.Entity, Code.Location)
+
+-- The standard variable xrefs. Takes the first cxx.FileXRefs result for the
+-- FileXRefMap fact. There may be additional facts (more xrefs in other traces)
+variableXRefs
+  :: Glean.IdOf Cxx.FileXRefs
+  -> Glean.RepoHaxl u w (Maybe ([Cxx.From], [Cxx.XRefTargets]))
+variableXRefs = fetchDataRecursive . cxxFileEntityXMapVariableXRefLocations
+
+-- | Build lookup table of definitions found from declToDef calls
+-- on the exteranl xrefs in the file
+externalDeclToDefXRefs
+  :: Maybe Int
+  -> Glean.IdOf Cxx.FileXRefs
+  -> Glean.RepoHaxl u w (DeclToDefMap, Bool)
+externalDeclToDefXRefs mlimit xrefId = do
+  (defRefs, truncated) <- searchRecursiveWithLimit mlimit $
+    cxxFileEntityXMapVariableXRefDeclToDefs xrefId
+  return $ (,truncated) (Map.fromList $
+    map (\(decl, entity, loc) -> (decl, (entity, loc))) defRefs)
+
+-- | Map of external xref decl to location
+type DeclLocationMap = Map Cxx.Declaration Code.Location
+
+-- | Build lookup table of external xref target decls to their location
+-- We need all results, so just assume we don't want to exceed the limit.
+-- The value here should actually be the length of the trace `targets*spans`?
+externalDeclToLocations
+  :: Maybe Int
+  -> Glean.IdOf Cxx.FileXRefs
+  -> Glean.RepoHaxl u w (DeclLocationMap, Bool)
+externalDeclToLocations mlimit xrefId = do
+  (rows, truncated) <- searchRecursiveWithLimit mlimit
+    (cxxFileEntityXMapVariableXRefDeclLocations xrefId)
+  return (Map.fromList rows, truncated)
+
+-- and the pp #define and #include occurences
+ppXRefs
+  :: Maybe Int
+  -> Glean.IdOf Cxx.Trace
+  -> Glean.RepoHaxl u w ([XRef], Bool)
+ppXRefs mlimit traceId = searchRecursiveWithLimit mlimit $
+  ppEntityTraceXRefLocations traceId
+
+-- and the underlying definitions of any decls that have them
+declToDefXRefs
+  :: Maybe Int
+  -> Glean.IdOf Cxx.Trace
+  -> Glean.RepoHaxl u w ([XRef], Bool)
+declToDefXRefs mlimit traceId = searchRecursiveWithLimit mlimit $
+  cxxFileEntityTraceDeclToDefXRefLocations traceId
+
+objcSelectorSlotLocation
+  :: Cxx.ObjcSelectorSlotEntity -> Maybe (Code.Entity, Code.Location)
+objcSelectorSlotLocation slot@(Cxx.ObjcSelectorSlotEntity method idx) = do
+  decl <- case method of
+    Cxx.ObjcMethodEntity_decl decl -> Just decl
+    Cxx.ObjcMethodEntity_defn Cxx.ObjcMethodDefinition{
+      objcMethodDefinition_key = Just decl} -> Just decl
+    _ -> Nothing
+  Cxx.ObjcMethodDeclaration_key{
+    objcMethodDeclaration_key_selector = Cxx.ObjcSelector{
+      objcSelector_key = Just selector
+    },
+    objcMethodDeclaration_key_locations = locations
+  } <- Glean.getFactKey decl
+  let index = fromIntegral $ Glean.fromNat idx
+  name <- atMay selector index
+  Src.FileLocation{..} <- atMay locations index
+  return (
+    Code.Entity_cxx (Cxx.Entity_objcSelectorSlot slot),
+    Code.Location {
+      Code.location_name = name,
+      Code.location_file = fileLocation_file,
+      Code.location_location = Code.RangeSpan_span fileLocation_span,
+      Code.location_destination = Nothing
+    })
+
+-- Basically the body of CxxFileEntityTraceFixedXRefLocations
+-- But split between client and server calls.
+--
+-- TODO: this could be replaced with a single bulk fetch and Decl
+-- index like we do for DeclToDef externals , for the declarations and enums
+--
+cxxXRefTargetToLocation
+  :: DeclLocationMap
+  -> Cxx.XRefTarget
+  -> Glean.RepoHaxl u w (Maybe (Code.Entity, Code.Location))
+cxxXRefTargetToLocation declLocMap (Cxx.XRefTarget_declaration decl) = do
+  -- try the cache first
+  mloc <- case Map.lookup decl declLocMap of
+    Just location -> return $ Just location -- done
+    Nothing -> do -- maybe it was indirect, fetch it
+       mlocation <- fetchDataRecursive $ cxxDeclarationLocation (toAngle decl)
+       case mlocation of
+          Nothing -> return Nothing
+          Just (range, name, file, span) -> do
+            let location = Code.Location {
+                Code.location_name = name,
+                Code.location_file = Src.range_file range,
+                Code.location_location = Code.RangeSpan_range range,
+                Code.location_destination = Just Src.FileLocation {
+                  Src.fileLocation_file = file,
+                  Src.fileLocation_span = span
+                }
+              }
+            return $ Just location
+
+  case mloc of
+    Nothing -> return Nothing
+    Just location -> do
+      let entity = Code.Entity_cxx (Cxx.Entity_decl decl)
+      return $ Just (entity, location)
+
+-- Indirect xrefs: we resolve it fully to its target
+cxxXRefTargetToLocation declLocMap (Cxx.XRefTarget_indirect indirect) = do
+  Cxx.XRefIndirectTarget_key _via target <- Glean.keyOf indirect
+  cxxXRefTargetToLocation declLocMap target  -- n.b recurse to find target
+
+cxxXRefTargetToLocation _ (Cxx.XRefTarget_enumerator enumerator) = do
+  Cxx.Enumerator_key name _decl range <- Glean.keyOf enumerator
+  nameStr <- Glean.keyOf name
+  let entity = Code.Entity_cxx (Cxx.Entity_enumerator enumerator)
+  let location = Code.Location {
+      Code.location_name = nameStr,
+      Code.location_file = Src.range_file range,
+      Code.location_location = Code.RangeSpan_range range,
+      Code.location_destination = Nothing
+    }
+  return $ Just (entity, location)
+
+cxxXRefTargetToLocation _ (Cxx.XRefTarget_objcSelectorSlot slot) =
+  return $ objcSelectorSlotLocation $
+    Cxx.ObjcSelectorSlotEntity (Cxx.ObjcMethodEntity_decl method) idx
+  where
+    (Cxx.ObjcSelectorSlot method idx) = slot
+
+{-
+XRefTarget_objcSelector ObjcSelector
+XRefTarget_unknown Loc
+-}
+cxxXRefTargetToLocation _ _ = return Nothing
+
+--
+-- Take the ids of the declaration and pptrace facts of the file
+--
+-- > fbsource> cxx1.Trace { file = "fbcode/folly/Synchronized.h" }
+-- > { "id": 431259564, "key": { "tuplefield0": { "id":...
+-- > 1 results, 1 facts, 0.43ms, 240632 bytes, 1253 compiled bytes
+--
+-- N.B. this is a predicate query, not a data query
+--
+cxxFileTrace :: Glean.IdOf Src.File -> Angle Cxx.Trace
+cxxFileTrace fileId =
+  predicate @Cxx.Trace (
+    rec $
+      field @"file" (asPredicate (factId fileId))
+    end
+  )
+
+--
+-- Same idea as for cxx1.Trace, for xrefs. There are multiple "traces"
+-- of xref maps, so pick the first one, then key off it.
+--
+cxxFileXRefs :: Glean.IdOf Src.File -> Angle Cxx.FileXRefs
+cxxFileXRefs fileId =
+  predicate @Cxx.FileXRefs (
+    rec $
+      field @"xmap" (
+        rec $ field @"file" (asPredicate (factId fileId)) end
+      )
+    end
+  )
+
+--
+-- Find file entities for a specific trace associated with a file
+--
+cxxPpResolveTraceLocations
+  :: Glean.IdOf Cxx.Trace
+  -> Angle (Code.Location, Code.Entity)
+cxxPpResolveTraceLocations traceId =
+  vars $ \(location :: Angle Code.Location)
+          (entity :: Angle Code.Entity)
+          (cxx_entity :: Angle Cxx.Entity)
+          (pp_entity :: Angle Pp.Entity) ->
+    tuple (location,entity) `where_` [
+      wild .=
+        [
+          wild .= predicate @Code.CxxResolveTraceLocation (
+            rec $
+              field @"trace" (asPredicate (factId traceId)) $
+              field @"location" location $
+              field @"entity" cxx_entity
+            end),
+          entity .= sig (alt @"cxx" cxx_entity)
+        ] `or_` [
+          wild .= predicate @Code.PpResolveTraceLocation (
+            rec $
+              field @"trace" (asPredicate (factId traceId)) $
+              field @"location" location $
+              field @"entity" pp_entity
+            end),
+          entity .= sig (alt @"pp" pp_entity)
+        ]
+    ]
+
+-- Spelling XRefs associated with a file
+cxxFileEntitySpellingXRefLocations
+  :: Glean.IdOf Src.File
+  -> Angle XRef
+cxxFileEntitySpellingXRefLocations fileId =
+  vars $ \(xref :: Angle Code.XRefLocation) (entity :: Angle Cxx.Entity) ->
+    tuple (xref, sig (alt @"cxx" entity) :: Angle Code.Entity) `where_` [
+      wild .= predicate @Code.CxxFileEntitySpellingXRefLocations (
+        rec $
+          field @"file" (asPredicate (factId fileId)) $
+          field @"xref" xref $
+          field @"entity" entity
+        end)
+      ]
+
+-- Fixed XRefs associated with a file and xmap /xref set
+cxxFileEntityXMapFixedXRefLocations
+  :: Glean.IdOf Cxx.FileXRefs
+  -> Angle XRef
+cxxFileEntityXMapFixedXRefLocations xrefId =
+  vars $ \(xref :: Angle Code.XRefLocation) (entity :: Angle Cxx.Entity) ->
+    tuple (xref, sig (alt @"cxx" entity) :: Angle Code.Entity) `where_` [
+      wild .= predicate @Code.CxxFileEntityXMapFixedXRefLocations (
+        rec $
+          field @"trace" (asPredicate (factId xrefId)) $
+          field @"xref" xref $
+          field @"entity" entity
+        end)
+      ]
+
+--
+-- "Variable" xrefs associated with a file and an xref map
+-- These get processed on the client, here, into Entity and XRefLocations
+--
+cxxFileEntityXMapVariableXRefLocations
+  :: Glean.IdOf Cxx.FileXRefs
+  -> Angle ([Cxx.From], [Cxx.XRefTargets])
+cxxFileEntityXMapVariableXRefLocations xrefId =
+  vars $ \(froms :: Angle [Cxx.From]) (targets :: Angle [Cxx.XRefTargets]) ->
+    tuple (froms, targets) `where_` [
+      factId xrefId .= predicate @Cxx.FileXRefs (
+        rec $
+          field @"xmap" (rec $ field @"froms" froms end) $
+          field @"targets" targets
+        end
+      )
+    ]
+
+--
+-- Defn xref targets computed from file Decls
+-- N.B. won't contain indirect decls. Just the first level Decls
+--
+cxxFileEntityTraceDeclToDefXRefLocations
+  :: Glean.IdOf Cxx.Trace
+  -> Angle XRef
+cxxFileEntityTraceDeclToDefXRefLocations traceId =
+  vars $ \(xref :: Angle Code.XRefLocation) (entity :: Angle Cxx.Entity) ->
+    tuple (xref, sig (alt @"cxx" entity) :: Angle Code.Entity) `where_` [
+      wild .= predicate @Code.CxxFileEntityTraceDeclToDefXRefLocations (
+        rec $
+          field @"trace" (asPredicate (factId traceId)) $
+          field @"xref" xref $
+          field @"entity" entity
+        end)
+      ]
+
+--
+-- Get location information for a Cxx Declaration
+--
+cxxDeclarationLocation :: Angle Cxx.Declaration
+  -> Angle (Src.Range, Text, Src.File, Src.ByteSpan)
+cxxDeclarationLocation decl =
+  vars $ \(source :: Angle Src.Range)
+          (name :: Angle Text)
+          (file :: Angle Src.File)
+          (span :: Angle Src.ByteSpan) ->
+  tuple (source, name, file, span) `where_` [
+    wild .= predicate @Cxx.DeclarationLocationNameSpan (
+      rec $
+        field @"decl" decl $
+        field @"source" source $
+        field @"name" name $
+        field @"file" (asPredicate file) $
+        field @"span" span
+      end)
+    ]
+
+--
+-- decl xref target locations computed from external xrefs, bulk fetch
+--
+cxxFileEntityXMapVariableXRefDeclLocations
+  :: Glean.IdOf Cxx.FileXRefs
+  -> Angle (Cxx.Declaration, Code.Location)
+cxxFileEntityXMapVariableXRefDeclLocations xrefId =
+  vars $ \(decl :: Angle Cxx.Declaration)
+      (location :: Angle Code.Location) ->
+    tuple (decl, location) `where_` [
+      wild .= predicate @Code.CxxFileEntityXMapVariableXRefDeclLocations (
+        rec $
+          field @"trace" (asPredicate (factId xrefId)) $
+          field @"source" decl $
+          field @"location" location
+        end)
+      ]
+
+--
+-- Defn xref targets computed from external decls
+-- Returns pairs of each decl fact and the corresponding xref defn target
+--
+cxxFileEntityXMapVariableXRefDeclToDefs
+  :: Glean.IdOf Cxx.FileXRefs
+  -> Angle (Cxx.Declaration, Code.Entity, Code.Location)
+cxxFileEntityXMapVariableXRefDeclToDefs xrefId =
+  vars $ \(decl :: Angle Cxx.Declaration) (entity :: Angle Cxx.Entity)
+      (location :: Angle Code.Location) ->
+    tuple (decl, sig (alt @"cxx" entity) :: Angle Code.Entity, location)
+    `where_` [
+      wild .= predicate @Code.CxxFileEntityXMapVariableXRefDeclToDefs (
+        rec $
+          field @"trace" (asPredicate (factId xrefId)) $
+          field @"source" decl $
+          field @"entity" entity $ -- todo this needs to be a location
+          field @"location" location
+        end)
+      ]
+
+-- C preprocessor #define and #include uses associated with a cxx1.Trace
+ppEntityTraceXRefLocations
+  :: Glean.IdOf Cxx.Trace
+  -> Angle XRef
+ppEntityTraceXRefLocations traceId =
+  vars $ \(xref :: Angle Code.XRefLocation) (entity :: Angle Pp.Entity) ->
+    tuple (xref, sig (alt @"pp" entity) :: Angle Code.Entity) `where_` [
+      wild .= predicate @Code.PpEntityTraceXRefLocations (
+        rec $
+          field @"trace" (asPredicate (factId traceId)) $
+          field @"xref" xref $
+          field @"entity" entity
+        end)
+      ]
+
+--
+-- | Breadth first, find at most @n@ #include src.file targets for #include
+-- xrefs in this file. Recursively visiting each #include file to gather more
+--
+fileIncludeLocationsForCxx
+  :: Int
+  -> Maybe Int
+  -> Src.File
+  -> Glean.RepoHaxl u w (Map Src.File [(Src.File, Src.Range)])
+fileIncludeLocationsForCxx depth mlimit file = go depth Map.empty [file]
+  where
+    go 0 acc _ = pure acc
+    go _ acc [] = pure acc -- no more #includes to process
+    go n !acc files = do
+      res <- mapM fetch files -- ensure haxl can do this concurrently
+      let seen = Map.fromList res `Map.union` acc
+          candidates = uniq (map fst (concatMap snd res))
+          new = filter (`Map.notMember` seen) candidates
+      go (n-1) seen new
+
+    fetch f = do -- named for haxl magic concurrency
+      rs <- fileIncludeLocations mlimit (Glean.getId f)
+      return (f,rs)
+
+fileIncludeLocations
+  :: Maybe Int
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w [(Src.File, Src.Range)]
+fileIncludeLocations mlimit fileId = do
+  traces <- getPPTraces traceMaxLimit fileId
+  let mquery = case traces of
+        [] -> Nothing -- no pp trace events for this file
+        [fact] -> Just (asPredicate (factId fact))
+        facts -> Just $ foldr1 (.|) (map (asPredicate . factId) facts)
+  case mquery of
+    Nothing -> return []
+    Just traceQ ->
+      fst <$> searchRecursiveWithLimit mlimit (ppXRefFileLocations traceQ)
+  where
+    -- arbitrary number of fact traces to be reasonable. More than 1. But
+    -- don't overwhelm things. c.f PPTrace { file = folly/Optional.h }
+    -- also the query gets quite large
+    traceMaxLimit = 10
+
+usrHashToDeclaration
+  :: Text -> Glean.RepoHaxl u w (Maybe (Code.Location, Code.Entity))
+usrHashToDeclaration usrhash =
+  fetchDataRecursive (usrHashToDeclarationAngle usrhash)
+
+-- | Resolve USR hash to its definition site
+usrHashToDeclarationAngle :: Text -> Angle (Code.Location, Code.Entity)
+usrHashToDeclarationAngle usrhash =
+  vars $ \(decl :: Angle Cxx.Declaration) (loc :: Angle Code.Location)
+      (defn :: Angle Cxx.Definition) ->
+    tuple (loc, sig (alt @"cxx" (alt @"defn" defn)) :: Angle Code.Entity)
+      `where_` [
+        wild .= predicate @Cxx.USRToDeclaration (
+          rec $
+            field @"hash" (string usrhash) $
+            field @"declaration" decl
+          end),
+        wild .= predicate @Cxx.DeclToDef (
+          rec $
+            field @"decl" decl $
+            field @"defn" defn
+          end),
+        wild .= predicate @Code.CxxEntityLocation (
+          rec $
+            field @"entity"  (alt @"defn" defn) $
+            field @"location" loc
+          end)
+      ]
+
+usrToDeclaration
+  :: Text -> Glean.RepoHaxl u w (Maybe (Code.Location, Code.Entity))
+usrToDeclaration usr = fetchDataRecursive (usrToDeclarationAngle usr)
+
+-- | Resolve USR to its definition site
+usrToDeclarationAngle :: Text -> Angle (Code.Location, Code.Entity)
+usrToDeclarationAngle usr =
+  vars $ \(scipEnt :: Angle Scip.Entity) (loc :: Angle Code.Location) ->
+    tuple
+      ( loc, sig (alt @"scip" scipEnt) :: Angle Code.Entity)
+      `where_` [
+        scipEnt .= alt @"swift"
+          (rec $ field @"defn" (rec $ field @"symbol" (string usr) end) end),
+        wild .= predicate @Scip.ScipEntityLocation (
+          rec $
+            field @"entity" scipEnt $
+            field @"location" loc
+          end)
+      ]
+
+--
+-- #include resolution acceleration. We can quickly return target filepaths
+-- for all or most #includes in a file.
+--
+-- N.B. we want more than 1, but not all, as some are large (>50k facts)
+--
+getPPTraces
+  :: Int
+  -> Glean.IdOf Src.File
+  -> Glean.RepoHaxl u w [Glean.IdOf Cxx.PPTrace]
+getPPTraces n fileId = fmap (Glean.getId . fst) <$>
+  searchWithLimit (Just n) (factIdQuery (ppFileTrace fileId))
+
+--
+-- find the PPTrace facts when we only care about C pre-processor events
+--
+ppFileTrace :: Glean.IdOf Src.File -> Angle Cxx.PPTrace
+ppFileTrace fileId =
+  predicate @Cxx.PPTrace (
+    rec $
+      field @"file" (asPredicate (factId fileId))
+    end
+  )
+
+-- | Given a PPTrace expression, find C preprocessor #include filepath targets
+ppXRefFileLocations :: Angle Cxx.PPTrace_key -> Angle (Src.File, Src.Range)
+ppXRefFileLocations ppTraceQ =
+  vars $ \(filepath :: Angle Src.File) (range :: Angle Src.Range) ->
+    tuple (filepath, range) `where_` [
+      wild .= predicate @Code.PpIncludeXRefLocations (
+        rec $
+          field @"trace" ppTraceQ $
+          field @"range" range $
+          field @"target" (asPredicate filepath)
+        end)
+      ]
+
+--
+-- "On the economy of bandwidth through content elision
+--     in the Glean database system"
+--
+-- This is a little trick to non-recursivley pull something that might
+-- have a large payload, but we know we only need the fact id
+--
+fetchFactIdOnly
+  :: (Glean.Predicate p, QueryType p)
+  => Angle p -> Glean.RepoHaxl u w (Maybe (Glean.IdOf p))
+fetchFactIdOnly p = fmap (Glean.getId . fst) <$> fetchData (factIdQuery p)
+
+-- | Used to avoid recursive expansion when we just need a fact id
+factIdQuery :: Type t => Angle t -> Angle (t, ())
+factIdQuery p = var $ \r ->
+  tuple (r, sig unit) `where_` [ r .= p ]
+
+usrHashToXRefs
+  :: Maybe Int
+    -> Text
+    -> Glean.RepoHaxl u w [(Src.File, Code.RangeSpan) ]
+usrHashToXRefs n usrhash = searchWithLimit n (usrToXref usrhash)
+
+-- | Return all reference locations of the symbol that corresponds to USR hash.
+--
+-- Equivalent to a findReferenceRanges but accepts a USR instead of a glean
+-- symbol id
+usrToXref :: Text -> Angle ( Src.File, Code.RangeSpan)
+usrToXref usrhash =
+  vars $ \(reffile :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+          (decl :: Angle Cxx.Declaration) ->
+    tuple (reffile, rangespan) `where_` [
+      wild .= predicate @Cxx.USRToDeclaration (
+        rec $
+          field @"hash" (string usrhash) $
+          field @"declaration" decl
+        end),
+      wild .= predicate @Code.EntityReferences (
+      rec $
+          field @"target" (alt @"cxx" (alt @"decl" decl)) $
+          field @"file" (asPredicate reffile) $
+          field @"range" rangespan
+        end
+      )
+    ]
diff --git a/glean/glass/Glean/Glass/Range.hs b/glean/glass/Glean/Glass/Range.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Range.hs
@@ -0,0 +1,239 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Range
+  (
+  -- * working with ranges and bytespans, to and from Glean representations
+     rangeContains
+
+  -- ** high level
+  , rangeSpanToLocationRange
+
+  -- ** lower level
+  , rangeSpanToRange
+  , inclusiveRangeToExclusiveRange
+
+  -- * File metadata
+  , FileInfo(..)
+  , getFileInfo
+  , getFile
+
+  ) where
+
+import Data.Default ( Default(def) )
+import Data.Function (on)
+import Data.Hashable
+import Data.Text
+
+import qualified Glean
+import qualified Glean.Util.Range as Range
+
+import qualified Glean.Glass.Types as Glass
+import qualified Glean.Glass.Query as Query
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Digest.Types as Digest
+
+import Glean.Glass.Types
+    ( LocationRange(..),
+      RepoName,
+      Range(range_columnEnd, range_lineEnd, range_columnBegin, range_lineBegin),
+      GlassExceptionReason (GlassExceptionReason_noSrcFileFact)
+    )
+import Glean.Glass.Utils ( fetchDataRecursive )
+import Glean.Glass.Base ( GleanPath(..),  SymbolRepoPath(..))
+import Glean.Glass.Path ( fromGleanPath )
+import qualified Haxl.Core.Memo as Haxl
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Glass.Types as Glass
+import Glean.Angle ( query )
+import qualified Glean.Haxl.Repos as Glean
+
+-- | @rangeContains x y@ is True iff the range of y is the same as x, or
+-- inside x.
+rangeContains :: Range -> Range -> Bool
+rangeContains big small =
+  checkLE range_lineBegin range_columnBegin big small &&
+  checkLE range_lineEnd range_columnEnd small big
+  where
+    checkLE line col a b = GT /= compareLineCol line col a b
+    compareLineCol line col a b =
+      (compare `on` line) a b <> (compare `on` col) a b
+
+-- | Convert Glean-side range span and file to the Glass range locations, with
+-- ranges in exclusive-end form, and paths adjusted to be repo-relative
+rangeSpanToLocationRange -- locationRangeFromCodeLocation
+  :: RepoName
+  -> Src.File
+  -> Code.RangeSpan
+  -> Glean.RepoHaxl u w Glass.LocationRange
+rangeSpanToLocationRange repo file rangespan = do
+  range <- memoRangeSpanToRange file rangespan
+  toLocationRange repo file range
+
+-- | Convert Glean-side rangeSpan to Glass Range, with memo filelines if needed
+-- Like rangeSpanToRange, but memoizes the file offsets for the span case.
+memoRangeSpanToRange
+  :: Src.File
+  -> Code.RangeSpan
+  -> Glean.RepoHaxl u w Range
+memoRangeSpanToRange file rangespan@Code.RangeSpan_span{} = do
+  mOffsets <- memoLineOffsets file
+  return $ rangeSpanToRange mOffsets rangespan
+memoRangeSpanToRange _ rangespan =
+  pure $ rangeSpanToRange Nothing rangespan
+
+-- | Glean provides either a bytespan or a range for a symbol location.
+-- Normalize it to Glass.Range (exclusive of end line/col spans)
+-- Only use this if you know the offsets are already memoized.
+rangeSpanToRange :: Maybe Range.LineOffsets -> Code.RangeSpan -> Range
+rangeSpanToRange offsets (Code.RangeSpan_span span) =
+  fileByteSpanToExclusiveRange offsets span
+rangeSpanToRange _ (Code.RangeSpan_range range) =
+  inclusiveRangeToExclusiveRange range
+rangeSpanToRange _ Code.RangeSpan_EMPTY =
+  unexpected
+
+-- | Package of src.File metadata we typically need
+data FileInfo = FileInfo {
+    fileRepo :: Glean.Repo,
+    fileId :: {-# UNPACK #-} !(Glean.IdOf Src.File),
+    srcFile :: !Src.File,
+    offsets :: !(Maybe Range.LineOffsets),
+    isIndexed :: !Bool,
+    fileDigest :: Maybe Digest.Digest,
+    indexFailure :: Maybe Src.IndexFailure_key
+  }
+
+getFileInfo
+  :: Glean.Repo
+  -> GleanPath
+  -> Glean.RepoHaxl u w (Either GlassExceptionReason FileInfo)
+getFileInfo fileRepo path = do
+  minfo <- fetchDataRecursive (Query.fileInfo path)
+  case minfo of
+    Nothing -> return $ Left $
+      GlassExceptionReason_noSrcFileFact $ "No src.File fact for "
+        <> gleanPath path
+    Just fileInfoP -> do
+      Glass.FileInfo_key srcFile infos <- Glean.keyOf fileInfoP
+      let fileId = Glean.getId srcFile
+          Glass.FileMetadata isIndexed mLineOffsets fileDigest mFailure
+            = infos
+          indexFailure = Src.indexFailure_key =<< mFailure
+      offsets <- memoLineOffsetsFileLines srcFile mLineOffsets
+      return $ Right FileInfo{..}
+
+-- | Get the src.File fact for a path
+getFile
+  :: GleanPath -> Glean.RepoHaxl u w (Either GlassExceptionReason Src.File)
+getFile path = do
+  mfile <- Glean.getFirstResult (query (Query.srcFile path))
+  return $ case mfile of
+    Nothing -> Left $
+      GlassExceptionReason_noSrcFileFact $ "No src.File fact for "
+        <> gleanPath path
+    Just srcFile -> Right srcFile
+
+-- | Glean's Src.Range is inclusive of start/end. Glass is exclusive of end
+inclusiveRangeToExclusiveRange :: Src.Range -> Glass.Range
+inclusiveRangeToExclusiveRange Src.Range{..} =
+  Glass.Range {
+    range_lineBegin = Glean.unNat range_lineBegin,
+    range_columnBegin = Glean.unNat range_columnBegin,
+    range_lineEnd = Glean.unNat range_lineEnd,
+    range_columnEnd = Glean.unNat range_columnEnd + 1 -- n.b. exclusive end
+  }
+
+--
+-- Internal stuff
+--
+
+unexpected :: a
+unexpected = error "unexpected RangeSpan"
+
+-- | (internal) Converts Glean-specific bytespan into client-visible line/col
+-- offsets convert Glean ranges into customer range types, with exclusive line
+-- end Warning: if the file doesn't have src.FileLines facts and the language
+-- schema uses span instead of range, the exclusive range will be incorrect (see
+-- type RangeSpan in codemarkup.angle)
+-- Note: This logic is similar to `Range.byteRangeToRange` except this function
+-- handles empty spans correctly. Inclusive bounds can't support empty spans.
+fileByteSpanToExclusiveRange
+  :: Maybe Range.LineOffsets -> Src.ByteSpan -> Glass.Range
+fileByteSpanToExclusiveRange Nothing _ = def
+fileByteSpanToExclusiveRange (Just lineoffs) bytespan =
+  let -- be careful subtracting Word64 to avoid wrap-around
+      be@Range.ByteRange{..} = Range.byteSpanToRange bytespan
+      -- Convert from 0-based col to 1-based col for Src.Range
+      (range_lineBegin, range_columnBegin) =
+        Range.byteOffsetToLineCol lineoffs byteRange_begin
+      (range_lineEnd, range_columnEnd) =
+        Range.byteOffsetToLineCol
+          lineoffs (Range.byteRangeExclusiveEnd be)
+  in Glass.Range {
+    range_lineBegin = fromIntegral range_lineBegin,
+    range_columnBegin = fromIntegral $ range_columnBegin + 1,
+    range_lineEnd = fromIntegral range_lineEnd,
+    range_columnEnd = fromIntegral $ range_columnEnd + 1
+  }
+
+newtype Glass_LineOffsets_Cache_Key =
+    Glass_LineOffsets_Cache_Key (Glean.Repo, Text)
+  deriving (Eq, Hashable, Ord, Show)
+
+-- | Memoize the result of computing the line offsets on a file
+-- This provides up to 15x win for xrefs on large files
+-- (internal)
+memoLineOffsets :: Src.File -> Glean.RepoHaxl u w (Maybe Range.LineOffsets)
+memoLineOffsets file = do
+  repo <- Glean.haxlRepo
+  key <- Glean.keyOf file
+  Haxl.memo (Glass_LineOffsets_Cache_Key (repo, key)) $ toLineOffsets file
+
+newtype Glass_FileLines_Conversion_Cache_Key =
+    Glass_FileLines_Conversion_Cache_Key (Glean.Repo, Text)
+  deriving (Eq, Hashable, Ord, Show)
+
+-- | Sometimes we already have the FileLines fact handy. Set the memo table
+-- directly in this case (internal)
+memoLineOffsetsFileLines
+  :: Src.File
+  -> Maybe Src.FileLines
+  -> Glean.RepoHaxl u w (Maybe Range.LineOffsets)
+memoLineOffsetsFileLines file mFileLines = do
+  repo <- Glean.haxlRepo
+  key <- Glean.keyOf file
+  Haxl.memo (Glass_FileLines_Conversion_Cache_Key (repo, key)) $
+    fromFileLines mFileLines
+
+-- | (internal) Get the line offsets associated with a file
+-- Use the memoized version, memoLineOffsets
+toLineOffsets :: Src.File -> Glean.RepoHaxl u w (Maybe Range.LineOffsets)
+toLineOffsets file = do
+  let fileId = Glean.getId file
+  fromFileLines =<< Glean.getFirstResult (query (Query.fileLines fileId))
+
+-- | Just the file line endings to range conversion
+fromFileLines
+  :: Maybe Src.FileLines -> Glean.RepoHaxl u w (Maybe Range.LineOffsets)
+fromFileLines mlines = case mlines of
+  Nothing -> pure Nothing
+  Just offs -> Just . Range.lengthsToLineOffsets <$> Glean.keyOf offs
+
+-- | (internal) Like toLocation, but for ranges.
+toLocationRange
+  :: RepoName -> Src.File -> Range -> Glean.RepoHaxl u w LocationRange
+toLocationRange repo file range = do
+  path <- GleanPath <$> Glean.keyOf file
+  let SymbolRepoPath locationRange_repository locationRange_filepath =
+        fromGleanPath repo path
+  return $ LocationRange {
+       locationRange_repository = locationRange_repository,
+       locationRange_filepath = locationRange_filepath,
+       locationRange_range = range
+     }
diff --git a/glean/glass/Glean/Glass/RepoMapping.hs b/glean/glass/Glean/Glass/RepoMapping.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/RepoMapping.hs
@@ -0,0 +1,102 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.RepoMapping
+  ( getRepoMapping
+  , fixedRepoMapping
+  , gleanRequiredIndices
+  , allGleanRepos
+  , supportsCxxDeclarationSources
+  , mirrorConfig
+  , Mirror(..)
+  ) where
+
+import Data.Set (Set)
+import qualified Data.Set as Set
+import qualified Data.Map.Strict as Map
+
+import Glean.Glass.Base
+  ( GleanDBName(..)
+  , RepoMapping(..)
+  , GleanDBSelector(..)
+  )
+import Glean.Glass.Types ( Language(..), RepoName(..) )
+import Data.Text(Text)
+
+getRepoMapping :: IO RepoMapping
+getRepoMapping = return RepoMapping
+  { gleanIndices = gleanIndices_
+  , gleanAttrIndices = Map.empty
+  }
+
+fixedRepoMapping :: RepoMapping
+fixedRepoMapping = RepoMapping
+  { gleanIndices = gleanIndices_
+  , gleanAttrIndices = Map.empty
+  }
+
+-- example: the open source react repo.
+gleanIndices_ :: Map.Map RepoName [GleanDBSelector]
+gleanIndices_ = Map.fromList
+  -- demo
+  [ ( RepoName "react",
+      [ GleanDBSelector
+        { dbName = "react"
+        , language = Language_JavaScript
+        , branchName = Nothing
+        }
+      ]
+    )
+  -- for running tests with locally-indexed repos:
+  , ( RepoName "test",
+      [ testSelector Language_JavaScript
+      , testSelector Language_Hack
+      , testSelector Language_Haskell
+      , testSelector Language_Cpp
+      , testSelector Language_PreProcessor
+      , testSelector Language_Python
+      , testSelector Language_Thrift
+      , testSelector Language_Buck
+      , testSelector Language_Go
+      , testSelector Language_TypeScript
+      , testSelector Language_Rust
+      , testSelector Language_Java
+      , testSelector Language_Swift
+      ]
+    )
+  ]
+  where
+    testSelector language =
+      GleanDBSelector
+        { dbName = "test"
+        , language = language
+        , branchName = Nothing
+        }
+
+-- | All the Glean db repo names we're aware of
+-- We will only be able to query members of this set
+allGleanRepos :: Set GleanDBName
+allGleanRepos = Set.fromList $
+  map dbName (concat (Map.elems gleanIndices_))
+
+-- repos that are required
+gleanRequiredIndices :: Set.Set GleanDBName
+gleanRequiredIndices = Set.empty
+
+supportsCxxDeclarationSources :: GleanDBName -> Bool
+supportsCxxDeclarationSources = const True
+
+-- Some repos can be mirrored
+data Mirror = Mirror
+  { mirrorRepo :: RepoName
+  , mirrorPath :: Text
+  , sourceRepo :: RepoName
+  }
+
+mirrorConfig :: [Mirror]
+mirrorConfig = []
diff --git a/glean/glass/Glean/Glass/Repos.hs b/glean/glass/Glean/Glass/Repos.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Repos.hs
@@ -0,0 +1,548 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ExplicitForAll #-}
+
+module Glean.Glass.Repos
+  (
+  -- * Types
+  Language(..)
+  , GleanDBName(..)
+  , GleanDBAttrName(..)
+  , GleanDBInfo(..)
+  , ScmRevisions
+  , ScmRevisionInfo(..)
+
+  -- * Mappings
+  , fromSCSRepo
+  , fileLanguage
+  , attrDBsForRepo
+
+  -- * Operation on a pool of latest repos
+  , withLatestRepos
+  , ChooseGleanDBs(..)
+  , chooseGleanDBs
+  , updateLatestRepos
+
+  -- * Misc
+  , toRepoName
+  , selectGleanDBs
+  , getRepoHash
+  , getRepoHashForLocation
+  , getDBRevision
+  , getLatestRepos
+  ) where
+
+import Control.Concurrent.Stream
+import Control.Monad
+import qualified Data.IntMap as IntMap
+import Data.IntMap (IntMap)
+import Data.List (nub)
+import qualified Data.Text as Text
+import qualified Data.Set as Set
+import Control.Applicative
+import Control.Concurrent.Async ( withAsync )
+import Control.Exception ( uninterruptibleMask_ )
+import Data.Maybe ( catMaybes, fromMaybe )
+import Data.Set ( Set )
+import qualified Data.Map.Strict as Map
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text ( Text, intercalate )
+import qualified Logger.GleanGlassErrors as Errors
+import Text.Printf
+
+import Util.Log
+import Logger.IO (Logger)
+import qualified Util.Log as LocalLog
+import Glean.Util.Some
+import Glean.Util.Periodic ( doPeriodicallySynchronised )
+import Util.Text ( textShow )
+import Util.Time
+import Util.Timing
+import qualified Glean
+import Util.STM
+import qualified Glean.Repo as Glean
+
+import Glean.Glass.Base
+import Glean.Glass.SourceControl
+import Glean.Glass.SymbolId ( toShortCode )
+import Glean.Glass.Types
+import qualified Glean.Glass.RepoMapping as Mapping -- site-specific
+import Glean.Repo (LatestRepos)
+import Glean.Glass.Tracing (GlassTracer, traceSpan)
+
+-- | mapping from Glean DB to info about the scm repositories it covers
+type ScmRevisions = HashMap Glean.Repo (HashMap RepoName ScmRevisionInfo)
+
+-- | Information about a source control revision
+data ScmRevisionInfo = ScmRevisionInfo
+  { scmRevision :: Revision
+  , scmGeneration :: Maybe ScmGeneration
+  } deriving Show
+
+-- | mapping from revision to Glean DB. We assume that revisions are
+-- globally unique hashes, so there's no need to include the
+-- repository in the key.
+type DbByRevision = HashMap Revision Glean.Repo
+
+-- | mapping from scm repo to (generation -> DB mapping)
+type DbByGeneration = HashMap RepoName (IntMap Glean.Repo)
+
+-- | info about which Glean DBs are currently available
+data GleanDBInfo = GleanDBInfo
+  { latestRepos :: Glean.LatestRepos
+  , scmRevisions :: ScmRevisions
+  , dbByRevision :: HashMap GleanDBName (DbByRevision, DbByGeneration)
+  }
+
+-- return a RepoName if indexed by glean
+toRepoName :: RepoMapping -> Text -> Maybe RepoName
+toRepoName RepoMapping{..} repo =
+  case Map.lookup repoName gleanIndices of
+    Just _ -> Just repoName
+    Nothing -> Nothing
+  where
+    repoName = RepoName repo
+
+-- | Additional metadata about files and methods in attribute dbs
+attrDBsForRepo :: RepoMapping -> RepoName -> [GleanDBAttrName]
+attrDBsForRepo RepoMapping{..} repo =
+  Map.findWithDefault [] repo gleanAttrIndices
+
+-- | Expand generic string search request parameters into a set of candidate
+-- GleanDBs, grouped by logical SCM repo or corpus.
+--
+-- (We need to know which repo each GleanDB was discovered under to construct
+-- symbol ids later on, which use SCM repo names).
+--
+-- Glean databases and language filters implied by the query.
+--
+-- Inputs are:
+-- - an scm repo (like "www") or corpus (like "fbsource")
+-- - language filters
+--
+-- Examples:
+--
+-- > 'www / *' selects [(www,hack), (www,flow)]
+-- > '* / *' selects all
+-- > '* / hack' selects www and fbsource
+--
+-- The special case of 'test / _' selects only the test db/lang pairs
+--
+-- Note:
+-- - Selection does not preserve the order of dbs in a repo.
+-- - Overlapping dbs (e.g. fbsource and fbsource.arvr.cxx) are de-duped
+--
+selectGleanDBs
+  :: RepoMapping
+  -> Maybe RepoName
+  -> Set Language
+  -> Either Text (Map.Map RepoName (Set GleanDBName))
+selectGleanDBs repoMapping mRepoName langs0 =
+  case map flatten (filter matches candidates) of
+    [] -> Left err
+    dbs -> Right $ Map.fromListWith Set.union dbs
+  where
+    candidates = listGleanIndices repoMapping isTestOnly
+    langs = Set.map normalizeLanguages langs0
+
+    flatten (repo, GleanDBSelector{..}) = (repo, Set.singleton dbName)
+
+    -- if client requests tests only, search expansion is limited to the test db
+    isTestOnly = mRepoName == Just (RepoName "test")
+
+    matches :: (RepoName, GleanDBSelector) -> Bool
+    matches (repo, GleanDBSelector{..}) = case (mRepoName, Set.null langs) of
+      (Nothing, True)  -> True
+      (Just rr, False) -> repo == rr && language `Set.member` langs
+      (Nothing, False) -> language `Set.member` langs
+      (Just rr, True)  -> repo == rr
+
+    err = case (mRepoName, Set.toList langs) of
+      (Nothing, []) -> "Empty index: no repos or languages found"
+      (Just r, []) -> "Unknown repository: " <> unRepoName r
+      (Nothing, ll) -> "No repository for " <>
+        intercalate "," (map toShortCode ll)
+      (Just r, ll) -> "Unknown repo/lang combination: " <> unRepoName r
+        <> "(" <> intercalate "," (map toShortCode ll) <> ")"
+
+-- | We don't distinguish between flavors of distinct related languages
+-- notably, objective-c and objective C++ are treated like cpp by clang
+normalizeLanguages :: Language -> Language
+normalizeLanguages Language_ObjectiveC = Language_Cpp
+normalizeLanguages l = l
+
+-- | Select universe of glean repo,(db/language) pairs.
+-- Either just the test dbs, or all the non-test dbs.
+listGleanIndices :: RepoMapping -> Bool -> [(RepoName, GleanDBSelector)]
+listGleanIndices RepoMapping{..} testsOnly =
+  let testRepos = [RepoName "test", RepoName "test-xlang"]
+      flatten (repo,langs) = map (repo,) langs
+      flattened = concatMap flatten $ Map.toList gleanIndices
+      isTest (repo, _) = elem repo testRepos in
+    filter (if testsOnly then isTest else not . isTest) flattened
+
+-- | Do something simple to map SCS repo to Glean repos
+-- Names from configerator/scm/myles/service as a start
+-- This should be in a config or SV to make onboarding simple, or from Glean
+-- properties?
+fromSCSRepo
+  :: RepoMapping
+  -> RepoName
+  -> Maybe (Text -> IO Bool)
+  -> Maybe Language
+  -> IO [GleanDBName]
+fromSCSRepo RepoMapping{..} repo branchFilter mLanguage
+  | Just rs <- Map.lookup repo gleanIndices = do
+    let filteredByLang = filterByLanguage mLanguage rs
+    filteredByBranch <- filterByBranch branchFilter filteredByLang
+    return $ nub $ map dbName filteredByBranch
+  | otherwise = return []
+  where
+    filterByLanguage Nothing = id
+    filterByLanguage (Just lang) = filter ((== lang) . language)
+
+    filterByBranch Nothing = pure
+    filterByBranch (Just f) = filterM (maybe (pure True) f . branchName)
+
+-- | Used to minimize the choice of Glean db when looking for a file
+-- This could be in DB properties if it becomes important
+--
+-- When onboarding a language, you should register the filetype, for
+-- any src.Files we have xrefs for
+--
+fileLanguage :: Path -> Maybe Language
+fileLanguage (Path file)
+  | is ".c"  = Just Language_Cpp
+  | is ".cc"  = Just Language_Cpp
+  | is ".cpp"  = Just Language_Cpp
+  | is ".cu"  = Just Language_Cpp -- CUDA
+  | is ".cxx"  = Just Language_Cpp
+  | is ".c++"  = Just Language_Cpp
+  | is ".h"  = Just Language_Cpp
+  | is ".hh"  = Just Language_Cpp
+  | is ".hip"  = Just Language_Cpp
+  | is ".hpp"  = Just Language_Cpp
+  | is ".hxx"  = Just Language_Cpp
+  | is ".h++"  = Just Language_Cpp
+  | is ".mm"  = Just Language_Cpp
+  | is ".m"  = Just Language_Cpp
+  | is ".tcc"  = Just Language_Cpp
+
+  | is ".flow"  = Just Language_JavaScript
+  | is ".js"  = Just Language_JavaScript
+
+  | is ".java"  = Just Language_Java
+  | is ".kt"  = Just Language_Kotlin
+
+  | is ".hhi"  = Just Language_Hack
+  | is ".php"  = Just Language_Hack
+
+  | is ".hs"  = Just Language_Haskell
+
+  | is ".py"  = Just Language_Python
+  | is ".pyi"  = Just Language_Python
+  | is ".cinc"  = Just Language_Python
+  | is ".cconf"  = Just Language_Python
+  | is ".mcconf"  = Just Language_Python
+  | is ".ctest"  = Just Language_Python
+  | is ".thrift-cvalidator"  = Just Language_Python
+
+  | is ".thrift"  = Just Language_Thrift
+
+  | is ".rs"  = Just Language_Rust
+  | is ".swift"  = Just Language_Swift
+  | is ".erl"  = Just Language_Erlang
+  | is ".go"  = Just Language_Go
+  | is ".ts"  = Just Language_TypeScript
+  | is ".tsx"  = Just Language_TypeScript
+
+  | is "TARGETS"  = Just Language_Buck
+  | is "BUCK"  = Just Language_Buck
+  | is ".bzl"  = Just Language_Buck
+
+  | is ".cs"  = Just Language_CSharp
+  | is ".graphql"  = Just Language_GraphQL
+
+  | is ".yaml"  = Just Language_Yaml
+
+  | otherwise = Nothing
+
+  where
+    is a =  a `Text.isSuffixOf` file
+
+--
+-- Operating on the latest repo statea
+--
+
+-- | Fetch all latest dbs we care for
+getLatestRepos
+  :: Glean.Backend b
+  => b
+  -> Some SourceControl
+  -> Maybe Logger
+  -> Maybe Int
+  -> IO GleanDBInfo
+getLatestRepos backend scm mlogger mretry = go mretry
+  where
+    go :: Maybe Int -> IO GleanDBInfo
+    go n = do
+      latest <- Glean.getLatestRepos backend $ \name ->
+        GleanDBName name `Set.member` Mapping.allGleanRepos
+
+      -- Filter unavailable DBs using hasDatabase. Glean.getLatestRepos does
+      -- this for latestRepos but not allLatestRepos, in that case it's up to
+      -- the client (us). Since we're fetching DBs periodically and caching
+      -- them, it's no problem to check availability for the whole set.
+      let available = Glean.hasDatabase backend . Glean.database_repo
+      (time, _, dbs) <- timeIt $ do
+        avail <- mapM (filterM available) (Glean.allLatestRepos latest)
+        return latest { Glean.allLatestRepos = avail }
+      let numDBs = sum (fmap length (Glean.allLatestRepos latest))
+          numAvailableDBs = sum (fmap length (Glean.allLatestRepos dbs))
+      logInfo $ printf "filtered available DBs in %s, %d/%d unavailable"
+        (showTime time) (numDBs - numAvailableDBs) numDBs
+
+      scmRevisions <- getScmRevisions scm dbs
+      let advertised = Map.keysSet (Glean.latestRepos dbs)
+          info = GleanDBInfo
+            { latestRepos = dbs
+            , scmRevisions = scmRevisions
+            , dbByRevision = getDbByRevision dbs scmRevisions
+            }
+      if required `Set.isSubsetOf` advertised
+        then return info
+        else do
+          -- some required dbs are missing! this is transient? and bad
+          -- in prod/full service mode this would be bad
+          let missing = required `Set.difference` advertised
+          logIt mlogger dbs missing n backend
+          case n of
+            Just n
+              | n > 1 -> do {- i.e. try more than 1 time -}
+                delay (seconds 1) >> go (Just (n-1))
+
+            _ -> return info -- if no retries allowed, give up
+
+    required = Set.map unGleanDBName Mapping.gleanRequiredIndices
+
+-- | Log an entry in glean_glass_server_error_events if a logger is available,
+-- and locally (e.g. to stderr). Do not log otherwise (e.g. in test mode).
+logIt
+  :: Glean.Backend b
+  => Maybe Logger -> LatestRepos -> Set Text -> Maybe Int -> b -> IO ()
+logIt mlogger latest missing attempt backend = do
+  case mlogger of
+    Just logger -> do
+      LocalLog.logError $ mconcat [
+        "Error listing databases: ",
+        Text.unpack missingDBNames,
+        " not found. ",
+        Text.unpack errorMsg
+       ]
+      Errors.runLog logger $ mconcat [
+        Errors.setErrorType errorTy,
+        Errors.setError errorMsg,
+        Errors.setRepoName missingDBNames, -- these are the ones not found
+        Errors.setMethod "getLatestRepos" -- fake thrift method is required
+       ]
+    Nothing -> return () -- don't log unless Just attempt
+  where
+    missingDBNames = Text.intercalate "," (Set.toList missing)
+    errorTy = "ListDatabases"
+    errorMsg =
+      let remaining = subtract 1 <$> attempt
+          reposListed = Text.unlines
+            [ "Instances listed for " <> db <> " : " <> intercalate ","
+              [ Glean.repo_hash (Glean.database_repo repo)
+              | Just repos <- [Map.lookup db (Glean.allLatestRepos latest)]
+              , repo <- repos
+              ]
+              | db <- Set.toList missing
+            ]
+
+      in case remaining of
+        Just 0 -> Text.concat [ -- final attempt failed
+                "Failed finding required databases in listDatabases",
+                " (no more attempts possible!)",
+                ". Using " <> formatBackend backend,
+                ". \n",
+                reposListed
+                ]
+        _ -> Text.concat [
+                "Missing some required databases in listDatabases",
+                " (attempts remaining " <> maybe "unknown" textShow remaining,
+                "). Using " <> formatBackend backend
+            ]
+
+
+-- This is the full glean backend details so should have some useful stuff
+formatBackend :: Glean.Backend b => b -> Text
+formatBackend = Text.pack . Glean.displayBackend
+
+getScmRevisions
+  :: Some SourceControl
+  -> Glean.LatestRepos
+  -> IO ScmRevisions
+getScmRevisions scm repos = do
+  let all = Map.toList (Glean.allLatestRepos repos)
+  (time, _, r) <- timeIt $ fmap HashMap.fromList $
+    forConcurrently_unordered 16 (concatMap snd all) $ \db -> do
+      revmap <- revMap db
+      return (Glean.database_repo db, revmap)
+  logInfo $ printf "fetched commit generations for %d DBs in %s"
+    (HashMap.size r) (showTime time)
+  return r
+  where
+  revMap db =
+    fmap HashMap.fromList $ forM revs $ \(repo, r) -> do
+      let repoName = RepoName repo
+          rev = Revision r
+      gen <- getGeneration scm repoName rev
+      return (repoName, ScmRevisionInfo rev gen)
+    where
+    revs = HashMap.toList (Glean.scmRevisionsOfDatabase db)
+
+getDbByRevision
+  :: Glean.LatestRepos
+  -> ScmRevisions
+  -> HashMap GleanDBName (DbByRevision, DbByGeneration)
+getDbByRevision repos scmRevs =
+  HashMap.fromList
+    [ (GleanDBName name, (revmap, genmap))
+    | (name, dbs) <- Map.toList (Glean.allLatestRepos repos)
+    , let
+        revmap = HashMap.fromList
+          [ (scmRevision info, Glean.database_repo db)
+          | db <- dbs
+          , (_repo, info) <- getDBRevisions db
+          ]
+        genmap = HashMap.fromListWith IntMap.union
+          [ (repo, IntMap.fromList [(fromIntegral gen, Glean.database_repo db)])
+          | db <- dbs
+          , (repo, ScmRevisionInfo { scmGeneration =
+              Just (ScmGeneration gen) }) <- getDBRevisions db
+          ]
+    ]
+    where
+      getDBRevisions db =
+        maybe [] HashMap.toList $
+          HashMap.lookup (Glean.database_repo db) scmRevs
+
+-- | Introduce a latest repo cache.
+-- TODO: this should pass the configured repo list through
+withLatestRepos
+  :: Glean.Backend b
+   => b
+   -> Some SourceControl
+   -> Maybe Logger
+   -> Maybe Int
+   -> DiffTimePoints
+   -> (TVar GleanDBInfo -> IO a)
+   -> IO a
+withLatestRepos backend scm mlogger mretry freq f = do
+  repos <- getLatestRepos backend scm mlogger mretry
+  tvRepos <- newTVarIO repos
+  withAsync (worker tvRepos) $ \_async -> f tvRepos
+  where
+    worker tvRepos =
+      doPeriodicallySynchronised freq $
+      uninterruptibleMask_ $
+        -- prevents the update from being cancelled while in progress
+        -- which can cause memory leaks if the process exits
+        -- immediately. This is benign, but can lead to ASAN test
+        -- failures.
+      updateLatestRepos backend scm mlogger mretry tvRepos
+
+-- | Update a TVar with the latest repos
+-- TODO: should take latest configuration repo list
+updateLatestRepos
+  :: Glean.Backend b
+  => b
+  -> Some SourceControl
+  -> Maybe Logger
+  -> Maybe Int
+  -> TVar GleanDBInfo -> IO ()
+updateLatestRepos backend scm mlogger mretry tvRepos = do
+  repos <- getLatestRepos backend scm mlogger mretry
+  atomically $ writeTVar tvRepos repos
+
+data ChooseGleanDBs
+  = ChooseLatest
+  | ChooseExactOrLatest Revision
+  | ChooseNearest RepoName Revision
+
+-- | Choose DBs for the given DB names and ChooseGleanDBs spec
+chooseGleanDBs
+  :: GlassTracer
+  -> Some SourceControl
+  -> GleanDBInfo
+  -> ChooseGleanDBs
+  -> [GleanDBName]
+  -> IO [(GleanDBName, Glean.Repo)]
+chooseGleanDBs _ _ dbInfo ChooseLatest repoNames =
+  return $ catMaybes
+    [ (dbName,) <$> Map.lookup name (Glean.latestRepos (latestRepos dbInfo))
+    | dbName@(GleanDBName name) <- repoNames
+    ]
+chooseGleanDBs _ _ dbInfo (ChooseExactOrLatest rev) repoNames =
+  return $ catMaybes
+    [ (dbName,) <$> (dbForRevision <|> latestDb)
+    | dbName@(GleanDBName name) <- repoNames
+    , let
+        latestDb = Map.lookup name (Glean.latestRepos (latestRepos dbInfo))
+        dbForRevision =
+          HashMap.lookup dbName (dbByRevision dbInfo) >>= \(byrev, _) ->
+          HashMap.lookup rev byrev
+    ]
+chooseGleanDBs tracer scm dbInfo (ChooseNearest repo rev) repoNames = do
+  maybeGen <- traceSpan tracer "getGeneration" $ getGeneration scm repo rev
+  case maybeGen of
+    Nothing ->
+      chooseGleanDBs tracer scm dbInfo (ChooseExactOrLatest rev) repoNames
+    Just (ScmGeneration gen) -> do
+      return $ catMaybes
+        [ (dbName,) <$> (dbForRevision <|> latestDb)
+        | dbName@(GleanDBName name) <- repoNames
+        , let
+            latestDb = Map.lookup name (Glean.latestRepos (latestRepos dbInfo))
+            dbForRevision =
+              HashMap.lookup dbName (dbByRevision dbInfo) >>= \(_, repos) ->
+              HashMap.lookup repo repos >>= best gen
+        ]
+  where
+  -- find the DB with the closest generation number
+  best gen bygen =
+   case (low, high) of
+      (Nothing, Nothing) -> Nothing
+      (Nothing, Just (_, db)) -> Just db
+      (Just (_, db), Nothing) -> Just db
+      (Just (lowgen, lowdb), Just (highgen, highdb))
+        | gen' - lowgen < highgen - gen' -> Just lowdb
+        | otherwise -> Just highdb
+     where
+      gen' = fromIntegral gen
+      low = IntMap.lookupLE gen' bygen
+      high = IntMap.lookupGT gen' bygen
+
+-- TODO (T122759515): Get repo revision from db properties
+getRepoHash :: Glean.Repo -> Revision
+getRepoHash repo = Revision (Text.take 40 (Glean.repo_hash repo))
+
+getRepoHashForLocation
+  :: LocationRange -> ScmRevisions -> Glean.Repo -> Revision
+getRepoHashForLocation LocationRange{..} scmRevs gleanDB =
+  getDBRevision scmRevs gleanDB locationRange_repository
+
+getDBRevision :: ScmRevisions -> Glean.Repo -> RepoName -> Revision
+getDBRevision scmRevs gleanDB repo =
+  fromMaybe (getRepoHash gleanDB) $ do
+    scmRepoToHash <- HashMap.lookup gleanDB scmRevs
+    scmRevision <$> HashMap.lookup repo scmRepoToHash
diff --git a/glean/glass/Glean/Glass/Search.hs b/glean/glass/Glean/Glass/Search.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search.hs
@@ -0,0 +1,111 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Search
+  ( searchEntity
+  , searchEntityLocation
+  , SearchResult(..)
+  , SearchEntity(..)
+  , CodeEntityLocation(..)
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Glass.Repos (Language(..) )
+import Glean.Glass.SymbolId ( toShortCode )
+
+import Glean.Glass.Search.Class as Search
+    ( Search(symbolSearch),
+      SearchResult(..),
+      SearchEntity(..),
+      CodeEntityLocation(..),
+      ResultLocation,
+      mapResultLocation)
+import qualified Glean.Glass.Search.Angle ({- instances -})
+import qualified Glean.Glass.Search.Buck ({- instances -})
+import qualified Glean.Glass.Search.Cxx ({- instances -})
+import qualified Glean.Glass.Search.Erlang ({- instances -})
+import qualified Glean.Glass.Search.Flow ({- instances -})
+import qualified Glean.Glass.Search.GraphQL ({- instances -})
+import qualified Glean.Glass.Search.Hack ({- instances -})
+import qualified Glean.Glass.Search.Haskell ({- instances -})
+import qualified Glean.Glass.Search.LSIF ({- instances -})
+import qualified Glean.Glass.Search.Pp ({- instances -})
+import qualified Glean.Glass.Search.Python ({- instances -})
+import qualified Glean.Glass.Search.SCIP ({- instances -})
+import qualified Glean.Glass.Search.Thrift ({- instances -})
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Glass.Utils ( fst4 )
+
+--
+-- | Entity search: decodes a symbol id to a code.Entity fact
+--
+-- Note: this is different to e.g. approximate string search, as we
+-- should _always_ be able to decode valid symbol ids back to their (unique*)
+-- entity. Unlike searchSymbol() we typically have full entity scope information
+-- sufficient to uniquely identify the symbol in an index.
+--
+-- There are cases where symbol ids are not unique:
+--
+-- - weird code
+-- - hack namespaces
+-- - bugs/approximations in our encoder
+--
+-- We log the duplicates to glass_errors
+--
+searchEntityLocation
+  :: Language
+  -> [Text]
+  -> Glean.ReposHaxl u w (SearchResult (ResultLocation Code.Entity))
+searchEntityLocation lang toks = case lang of
+  Language_Angle ->
+    fmap (mapResultLocation Code.Entity_angle) <$> Search.symbolSearch toks
+  Language_Buck ->
+    fmap (mapResultLocation Code.Entity_buck) <$> Search.symbolSearch toks
+  Language_Cpp ->
+    fmap (mapResultLocation Code.Entity_cxx) <$> Search.symbolSearch toks
+  Language_Erlang ->
+    fmap (mapResultLocation Code.Entity_erlang) <$> Search.symbolSearch toks
+  Language_GraphQL ->
+    fmap (mapResultLocation Code.Entity_graphql) <$> Search.symbolSearch toks
+  Language_Hack ->
+    fmap (mapResultLocation Code.Entity_hack) <$> Search.symbolSearch toks
+  Language_Haskell ->
+    fmap (mapResultLocation Code.Entity_hs) <$> Search.symbolSearch toks
+  Language_JavaScript ->
+    fmap (mapResultLocation Code.Entity_flow) <$> Search.symbolSearch toks
+  Language_PreProcessor ->
+    fmap (mapResultLocation Code.Entity_pp) <$> Search.symbolSearch toks
+  Language_Python ->
+    fmap (mapResultLocation Code.Entity_python) <$> Search.symbolSearch toks
+  Language_Thrift ->
+    fmap (mapResultLocation Code.Entity_fbthrift) <$> Search.symbolSearch toks
+  -- scip-based indexers
+  Language_Rust ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  Language_Go ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  Language_TypeScript ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  Language_Java ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  Language_Kotlin ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  Language_Swift ->
+    fmap (mapResultLocation Code.Entity_scip) <$> Search.symbolSearch toks
+  lang ->
+    return $ None $ "searchEntity: language not supported: " <> toShortCode lang
+
+searchEntity
+  :: Language
+  -> [Text]
+  -> Glean.ReposHaxl u w (SearchResult Code.Entity)
+searchEntity lang toks = case lang of
+  Language_Thrift -> fmap Code.Entity_fbthrift <$> Search.symbolSearch toks
+  _ -> fmap fst4 <$> searchEntityLocation lang toks
diff --git a/glean/glass/Glean/Glass/Search/Angle.hs b/glean/glass/Glean/Glass/Search/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Angle.hs
@@ -0,0 +1,42 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Angle
+  ( {- instances -}
+  ) where
+
+import Glean.Angle as Angle
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+import qualified Glean.Schema.CodeAnglelang.Types as A
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.SearchAnglelang.Types as A
+import qualified Glean.Schema.Src.Types as Src
+import Data.Text ( Text )
+
+instance Search (ResultLocation A.Entity) where
+  symbolSearch toks = case reverse toks of
+    [] -> return $ None "Anglelang.symbolSearch: empty"
+    -- name is the last token
+    (name:_) -> searchSymbolId toks $ searchByName name
+
+searchByName :: Text -> Angle (ResultLocation A.Entity)
+searchByName sym =
+  vars $ \(ent :: Angle A.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    wild .= predicate @A.SearchByName (
+      rec $
+        field @"name" (string sym) $
+        field @"entity" ent
+      end),
+    entityLocation (alt @"angle" ent) file rangespan lname
+  ]
diff --git a/glean/glass/Glean/Glass/Search/Buck.hs b/glean/glass/Glean/Glass/Search/Buck.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Buck.hs
@@ -0,0 +1,106 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans -Wno-incomplete-uni-patterns #-}
+
+module Glean.Glass.Search.Buck
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+import Data.List.Split ( splitOn )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+    ( searchSymbolId, ResultLocation, Search(..), SearchResult(None) )
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeBuck.Types as Buck
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.SearchBuck.Types as Buck
+import qualified Glean.Schema.Src.Types as Src
+
+import Glean.Glass.Utils as Utils
+
+
+parse :: [Text] -> Maybe (Maybe Text, Text, Text)
+parse locator = do
+  let name : rest = reverse locator
+  let [subdir, path] = splitOn ["PATH"] (reverse rest)
+  let mSubdir = case subdir of
+          [] -> Nothing
+          _ -> Just $ Utils.joinFragments subdir
+  return (mSubdir, Utils.joinFragments path, name)
+
+
+instance Search (ResultLocation Buck.Entity) where
+  symbolSearch toks = case toks of
+    ("t" : locator) -> do
+      case parse locator of
+        Just (subdir, path, name) ->
+          searchSymbolId toks $ searchByFQN subdir path name
+        Nothing -> invalid_symbol
+    ("f" : path) -> do
+      searchSymbolId toks $ searchFile (Utils.joinFragments path)
+    ("d" : module_name) -> do
+      case reverse module_name of
+        name : rev_module -> searchSymbolId toks $ searchDefinition
+          (Utils.joinFragments $ reverse rev_module) name
+        _ -> invalid_symbol
+    _ -> invalid_symbol
+    where
+      invalid_symbol = return $ None "Buck.symbolSearch: invalid symbol"
+
+
+searchByFQN :: Maybe Text -> Text -> Text -> Angle (ResultLocation Buck.Entity)
+searchByFQN mSubdir path name =
+  vars $ \(ent :: Angle Buck.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    wild .= predicate @Buck.SearchByFQN (
+      rec $
+        field @"subdir" subDirQ $
+        field @"path" (string path) $
+        field @"name" (string name) $
+        field @"entity" ent
+      end),
+      entityLocation (alt @"buck" ent) file rangespan lname
+  ]
+  where
+    subDirQ = case mSubdir of
+      Just str -> just (string str)
+      Nothing -> nothing
+
+searchFile :: Text -> Angle (ResultLocation Buck.Entity)
+searchFile path =
+  vars $ \(ent :: Angle Buck.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    wild .= predicate @Buck.SearchFile (
+      rec $
+        field @"file" (string path) $
+        field @"entity" ent
+      end),
+      entityLocation (alt @"buck" ent) file rangespan lname
+  ]
+
+searchDefinition :: Text -> Text -> Angle (ResultLocation Buck.Entity)
+searchDefinition module_ name =
+  vars $ \(ent :: Angle Buck.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    wild .= predicate @Buck.SearchDefinition (
+      rec $
+        field @"module" (string module_) $
+        field @"name" (string name) $
+        field @"entity" ent
+      end),
+      entityLocation (alt @"buck" ent) file rangespan lname
+  ]
diff --git a/glean/glass/Glean/Glass/Search/Class.hs b/glean/glass/Glean/Glass/Search/Class.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Class.hs
@@ -0,0 +1,129 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+module Glean.Glass.Search.Class
+  ( Search(..)
+  , SearchResult(..)
+  , SearchEntity(..)
+  , ResultLocation
+  , searchSymbolId
+  , resultToDecl
+  , CodeEntityLocation(..)
+  , mapResultLocation
+  ) where
+
+import Data.Text (Text, intercalate)
+import Util.Text (textShow)
+
+import Data.Typeable (Typeable)
+
+import qualified Glean
+
+import Glean.Angle ( Angle, Type )
+import Glean.Haxl.Repos as Glean
+
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+
+import Glean.Glass.Utils ( searchRecursiveWithLimit )
+
+-- Search-based inverse of Symbol.toSymbol :: a -> [Text]
+-- Decodes a symbol id to a code.Entity fact
+--
+-- Note: this is different to e.g. approximate string search, as we
+-- should _always_ be able to decode valid symbol ids back to their (unique*)
+-- entity.
+--
+-- There are cases where symbol ids are not unique:
+-- - weird code
+-- - hack namespaces
+-- - bugs/approximations in our encoder
+--
+-- We log the duplicates to glass_errors
+--
+class Search t where
+  symbolSearch :: [Text] -> ReposHaxl u w (SearchResult t)
+
+-- | We have zero, one or multiple matches for entities
+data SearchResult t
+  = None !Text -- no result found
+  | One (SearchEntity t) -- preicsely one entity, yay.
+  | Many -- oh dear, several
+     { initial :: SearchEntity t
+     , rest :: [SearchEntity t]
+     , message :: !Text }
+
+data SearchEntity t =
+  SearchEntity {
+    entityRepo :: !Glean.Repo, -- vital to know which repo this came from
+    decl :: !t
+  }
+
+-- | Summary form used for describe()
+data CodeEntityLocation =
+  CodeEntityLocation {
+    entity :: !Code.Entity,
+    entityFile :: !Src.File,
+    entityRange :: !Code.RangeSpan,
+    entityName :: !Text
+  }
+
+-- Similar to SearchEntity , used in Angle data queries. Searches return this
+type ResultLocation t = (t, Src.File, Code.RangeSpan, Text)
+
+mapResultLocation :: (t -> t') -> ResultLocation t -> ResultLocation t'
+mapResultLocation f (res, file, range, name) = (f res, file, range, name)
+
+resultToDecl :: [(d, a, b)] -> [d]
+resultToDecl = map (\(x, _, _) -> x)
+
+-- We tend to map over the decl building up layers
+instance Functor SearchResult where
+  fmap _ (None t) = None t
+  fmap f (One e) = One (e { decl = f (decl e) })
+  fmap f m@Many { initial = e, rest = es } =
+    m { initial = e { decl = f (decl e)}
+      , rest = map (\e -> e { decl = f (decl e) }) es }
+
+-- | Find matching code.Entity values by repo and language for the
+-- symbol id tokens.
+--
+-- symbol ids are "mostly" unique. This code checks explicitly if the
+-- symbol id search generated 0, 1 or >1 result. We always return the first
+-- match.
+--
+-- There are some scenarios where we might want to return all matches.
+--
+searchSymbolId :: (Typeable t, Show t, Type t)
+  => [Text]
+  -> Angle t
+  -> ReposHaxl u w (SearchResult t)
+searchSymbolId toks query = do
+  results <- Glean.queryAllRepos $ do
+    repo <- Glean.haxlRepo
+    (results,_truncated) <- searchRecursiveWithLimit (Just max_symbolid_matches)
+      query
+    return $ map (repo,) results
+  let toksText = intercalate "/" toks
+  return $ case results of
+    [] -> None $ "runSearch: No results found for " <> toksText
+    [(entityRepo, decl)] -> One SearchEntity{..}
+    (firstResult:moreResults) ->
+      Many { initial = uncurry mkSearchEntity firstResult
+           , rest = map (uncurry mkSearchEntity) moreResults
+           , message = "runSearch: " <> textShow (length results) <>
+            " results found for " <> toksText
+      }
+  where
+    mkSearchEntity entityRepo decl = SearchEntity{..}
+
+    -- symbol ids do have collisions, but they should be rare. If they are
+    -- expensive it means we have a bad query from symbold id to entity
+    max_symbolid_matches = 10
diff --git a/glean/glass/Glean/Glass/Search/Cxx.hs b/glean/glass/Glean/Glass/Search/Cxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Cxx.hs
@@ -0,0 +1,707 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo, PartialTypeSignatures #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Cxx
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+import qualified Data.Text as Text
+import Data.Set ( Set )
+import qualified Data.Set as Set
+
+import Glean.Angle as Angle
+import Glean.Haxl.Repos (ReposHaxl)
+
+import Glean.Glass.Search.Class
+    ( ResultLocation, SearchResult(None), Search(..), searchSymbolId )
+import Glean.Glass.Query ( entityLocation )
+import qualified Glean.Glass.SymbolId.Cxx.Parse as P
+
+import qualified Glean.Schema.CodeCxx.Types as Cxx
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.SymbolidCxx.Types as SymbolId
+
+instance Search (ResultLocation Cxx.Entity) where
+  symbolSearch = cxxSymbolSearch
+
+cxxSymbolSearch ::
+  [Text] -> ReposHaxl u w (SearchResult (ResultLocation Cxx.Entity))
+cxxSymbolSearch t = case P.validateSymbolId t of
+  Left errs -> return $ None (Text.unlines errs)
+  Right env -> case P.compileSymbolEnv env of
+    Left err -> return $ None err
+    Right exp -> case exp of
+      P.CxxDecl e -> cxxSymbolExprEvalDecl t e
+      P.CxxDefn e -> cxxSymbolExprEvalDefn t e
+
+cxxSymbolExprEvalDecl
+  :: [Text]
+  -> P.CxxSymbolExpr
+  -> ReposHaxl u w (SearchResult (ResultLocation Cxx.Entity))
+cxxSymbolExprEvalDecl t exp = case exp of
+  P.CxxConstructor{..} -> searchSymbolId t $
+    lookupCTorSignatureDeclaration cPath cScope cParams
+  P.CxxDestructor{..} -> searchSymbolId t $
+    lookupDTorDeclaration cPath cScope
+  P.CxxFunction{..} -> searchSymbolId t $
+    lookupFunctionSignatureDeclaration cPath cScope cName cParams cQuals
+  P.CxxOperator{..} -> searchSymbolId t $
+    lookupOperatorSignatureDeclaration cPath cScope cName cParams cQuals
+  P.CxxTypeConversionOperator{..} -> searchSymbolId t $
+    lookupTypeOperatorSignatureDeclaration cPath cScope cReturns cQuals
+
+  P.CxxLegacyCTorParams{..} ->
+    let scope' = cScope <> [P.Name ".ctor"] -- hack into scope query builder
+    in searchSymbolId t $ lookupDeclaration cPath scope' cName
+  P.CxxAny{..} -> searchDeclarations t cPath cScope cName
+
+cxxSymbolExprEvalDefn
+  :: [Text] -> P.CxxSymbolExpr -> ReposHaxl u w (SearchResult (ResultLocation Cxx.Entity))
+cxxSymbolExprEvalDefn t exp = case exp of
+  P.CxxConstructor{..} -> searchSymbolId t $
+    lookupCTorSignatureDefinition cPath cScope cParams
+  P.CxxDestructor{..} -> searchSymbolId t $
+    lookupDTorDefinition cPath cScope
+  P.CxxFunction{..} -> searchSymbolId t $
+    lookupFunctionSignatureDefinition cPath cScope cName cParams cQuals
+  P.CxxOperator{..} -> searchSymbolId t $
+    lookupOperatorSignatureDefinition cPath cScope cName cParams cQuals
+  P.CxxTypeConversionOperator{..} -> searchSymbolId t $
+    lookupTypeOperatorSignatureDefinition cPath cScope cReturns cQuals
+
+  P.CxxLegacyCTorParams{..} ->
+    let scope' = cScope <> [P.Name ".ctor"] -- hack into scope query builder
+    in searchSymbolId t $ lookupDefinition cPath scope' cName
+  P.CxxAny{..} -> searchDefinitions t cPath cScope cName
+
+-- this is the most common path, for e.g. classes and functions
+--
+-- > fbsource/cpp @ fbcode/folly/Optional/assign
+-- > fbsource/cpp @ fbcode/folly/Optional
+--
+-- would resolve to their definition occurences.
+--
+-- enumerators (fields of enums) are also in this path
+--
+searchDefinitions
+  :: [Text] -> Text -> [P.Name] -> P.Name
+  -> ReposHaxl u w (SearchResult (ResultLocation Cxx.Entity))
+searchDefinitions t path ns name =
+  searchSymbolId t (lookupDefinition path ns name)
+    .|?
+  searchSymbolId t (lookupFunctionDefinition path ns name)
+    .|?
+  searchSymbolId t (lookupNamespaceDefinition path ns name)
+    .|?
+  (if not (null ns)
+      then searchSymbolId t (lookupEnumerator path (init ns) (last ns) name)
+      else pure $ None "Cxx.searchDefinitions: no results found")
+
+--
+-- declaration entities only
+--
+searchDeclarations
+  :: [Text] -> Text -> [P.Name] -> P.Name
+  -> ReposHaxl u w (SearchResult (ResultLocation Cxx.Entity))
+searchDeclarations t path ns name = -- `ns` might be [] for global scope
+  searchSymbolId t (lookupDeclaration path ns name)
+    .|?
+  searchSymbolId t (lookupFunctionDeclaration path ns name)
+    .|?
+  searchSymbolId t (lookupNamespaceDeclaration path ns name)
+
+--
+-- A little `then` or .|. thing for searching until first match
+--
+(.|?)
+  :: ReposHaxl u w (SearchResult t)
+  -> ReposHaxl u w (SearchResult t)
+  -> ReposHaxl u w (SearchResult t)
+a .|? b = do
+  v <- a
+  case v of
+    None{} -> b
+    _ -> pure v
+
+------------------------------------------------------------------------
+
+--
+-- Records, Variables, Enum, TypeAlias, Using Directives.
+--
+lookupDefinition
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupDefinition = lookupEntityFn $ \(P.Name name) ns entity ->
+  predicate @SymbolId.LookupDefinition (
+    rec $
+      field @"name" (string name) $
+      field @"scope" (scopeQ (reverse (P.unNames ns))) $
+      field @"entity" entity
+    end)
+
+lookupFunctionDefinition
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupFunctionDefinition = lookupEntityFn $ \(P.Name name) ns entity ->
+  predicate @SymbolId.LookupFunctionDefinition (
+    rec $
+      field @"name" (functionName name) $
+      field @"scope" (scopeQ (reverse (P.unNames ns))) $
+      field @"entity" entity
+    end)
+
+lookupNamespaceDefinition
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupNamespaceDefinition = lookupEntityFn $ \(P.Name name) ns entity ->
+  predicate @SymbolId.LookupNamespaceDefinition (
+    rec $
+      field @"name" (maybeName name) $
+      field @"parent" (namespaceParentQName (reverse (P.unNames ns))) $
+      field @"entity" entity
+    end)
+
+--
+-- enum values (fields of an enumerator) are a bit different again.
+-- they are a field in an enum declaration, so to query you need to
+-- know the field, and also the parent enum name and scope.
+--
+lookupEnumerator
+  :: Text -> [P.Name] -> P.Name -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupEnumerator anchor ns (P.Name parent) (P.Name name) =
+  vars $ \ (decl :: Angle Cxx.Enumerator) (entity :: Angle Cxx.Entity)
+    (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+      (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` (
+      (scope .= sig (scopeQ (reverse scopes))):(
+      wild .= predicate @SymbolId.LookupEnumerator (
+        rec $
+          field @"name" (string name) $
+          field @"parent" (string parent) $
+          field @"scope" scope $
+          field @"decl" (asPredicate decl)
+        end))
+      : (alt @"enumerator" (asPredicate decl) .= sig entity)
+      : entityFooter anchor entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+lookupDTorDeclaration :: Text -> [P.Name] -> Angle (ResultLocation Cxx.Entity)
+lookupDTorDeclaration anchor ns =
+  vars $ \(decl :: Angle Cxx.Declaration) (entity :: Angle Cxx.Entity)
+     (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+     (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+     (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` (
+      (scope .= sig (scopeQ (reverse scopes))):(
+      wild .= predicate @SymbolId.LookupFunctionDeclaration (
+        rec $
+          field @"name" (alt @"destructor" wild) $
+          field @"scope" scope $
+          field @"decl" decl
+        end))
+      : entityDeclFooter anchor decl entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+lookupDTorDefinition :: Text -> [P.Name] -> Angle (ResultLocation Cxx.Entity)
+lookupDTorDefinition anchor ns =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+     (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+       (lname :: Angle Text) (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` (
+      (scope .= sig (scopeQ (reverse scopes))):(
+      wild .= predicate @SymbolId.LookupFunctionDefinition (
+        rec $
+          field @"name" (alt @"destructor" wild) $
+          field @"scope" scope $
+          field @"entity" entity
+        end))
+      : entityFooter anchor entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+lookupCTorSignatureDefinition
+  :: Text -> [P.Name] -> [P.Name] -> Angle (ResultLocation Cxx.Entity)
+lookupCTorSignatureDefinition anchor ns ps =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+     (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text)
+      (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureDefinition (
+        rec $
+          field @"name" (alt @"constructor" wild) $ -- either @alt ctor or dtor
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"entity" entity
+        end)
+      ] <> entityFooter anchor entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+lookupCTorSignatureDeclaration
+  :: Text -> [P.Name] -> [P.Name] -> Angle (ResultLocation Cxx.Entity)
+lookupCTorSignatureDeclaration anchor ns ps =
+  vars $ \(decl :: Angle Cxx.Declaration)  (entity :: Angle Cxx.Entity)
+      (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+        (rangespan :: Angle Code.RangeSpan)
+        (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureDeclaration (
+        rec $
+          field @"name" (alt @"constructor" wild) $ -- either @alt ctor or dtor
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"decl" decl
+        end)
+      ] <> entityDeclFooter anchor decl entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+lookupFunctionSignatureDeclaration
+  :: Text -> [P.Name] -> P.Name -> [P.Name] -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupFunctionSignatureDeclaration anchor ns (P.Name name) ps quals =
+  vars $ \(decl :: Angle Cxx.Declaration)  (entity :: Angle Cxx.Entity)
+      (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+        (rangespan :: Angle Code.RangeSpan)
+        (fname :: Angle Cxx.FunctionName) (n :: Angle Cxx.Name)
+        (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      n .= predicate @Cxx.Name (string name),
+      fname .= predicate @Cxx.FunctionName (alt @"name" (asPredicate n)),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDeclaration (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"decl" decl
+        end)
+    ] <> entityDeclFooter anchor decl entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+lookupFunctionSignatureDefinition
+  :: Text -> [P.Name] -> P.Name -> [P.Name] -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupFunctionSignatureDefinition anchor ns (P.Name name) ps quals =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+      (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+        (fname :: Angle Cxx.FunctionName) (n :: Angle Cxx.Name)
+        (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      n .= predicate @Cxx.Name (string name),
+      fname .= predicate @Cxx.FunctionName (alt @"name" (asPredicate n)),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDefinition (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"entity" entity
+        end)
+      ] <> entityFooter anchor entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+--
+-- Like functions, but there's no Name fact to bind
+--
+lookupOperatorSignatureDeclaration
+  :: Text -> [P.Name] -> P.Name -> [P.Name] -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupOperatorSignatureDeclaration anchor ns (P.Name o) ps quals =
+  vars $ \(decl :: Angle Cxx.Declaration)  (entity :: Angle Cxx.Entity)
+      (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+        (rangespan :: Angle Code.RangeSpan)
+        (fname :: Angle Cxx.FunctionName) (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      fname .= predicate @Cxx.FunctionName (operatorQ o),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDeclaration (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"decl" decl
+        end)
+    ] <> entityDeclFooter anchor decl entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+lookupOperatorSignatureDefinition
+  :: Text -> [P.Name] -> P.Name -> [P.Name] -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupOperatorSignatureDefinition anchor ns (P.Name o) ps quals =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+      (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+        (fname :: Angle Cxx.FunctionName) (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      fname .= predicate @Cxx.FunctionName (operatorQ o),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDefinition (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (paramTypesQ params)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"entity" entity
+        end)
+      ] <> entityFooter anchor entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+    params = P.unNames ps
+
+--
+-- Like functions, but there's no Name fact to bind
+--
+lookupTypeOperatorSignatureDeclaration
+  :: Text -> [P.Name] -> P.Name -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupTypeOperatorSignatureDeclaration anchor ns (P.Name retTy) quals =
+  vars $ \(decl :: Angle Cxx.Declaration)  (entity :: Angle Cxx.Entity)
+      (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+        (rangespan :: Angle Code.RangeSpan) (tyFact :: Angle Cxx.Type)
+        (fname :: Angle Cxx.FunctionName) (lname :: Angle Text)
+        (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      tyFact .= predicate @Cxx.Type (string retTy),
+      fname .= predicate @Cxx.FunctionName
+        (alt @"conversionOperator" (asPredicate tyFact)),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDeclaration (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (returnTypeQ tyFact)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"decl" decl
+        end)
+    ] <> entityDeclFooter anchor decl entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+
+lookupTypeOperatorSignatureDefinition
+  :: Text -> [P.Name] -> P.Name -> Set P.Qualifier
+  -> Angle (ResultLocation Cxx.Entity)
+lookupTypeOperatorSignatureDefinition anchor ns (P.Name retTy) quals =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+      (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+        (tyFact :: Angle Cxx.Type) (fname :: Angle Cxx.FunctionName)
+        (lname :: Angle Text) (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` ([
+      tyFact .= predicate @Cxx.Type (string retTy),
+      fname .= predicate @Cxx.FunctionName
+        (alt @"conversionOperator" (asPredicate tyFact)),
+      scope .= sig (scopeQ (reverse scopes)),
+      wild .= predicate @SymbolId.LookupFunctionSignatureQualifierDefinition (
+        rec $
+          field @"name" (asPredicate fname) $
+          field @"scope" scope $
+          field @"signature" (asPredicate (returnTypeQ tyFact)) $
+          field @"qualifiers" (qualifiersQ quals) $
+          field @"entity" entity
+        end)
+      ] <> entityFooter anchor entity codeEntity file rangespan lname)
+  where
+    scopes = P.unNames ns
+
+--
+-- We have four variants, and two ways to resolve each
+--
+-- - record, variable, enum, type , using
+-- - functions (and function-like things)
+-- - namespaces
+-- - enumerators
+--
+-- And for the first 3, a defn version as well.
+--
+
+--
+-- Declarations of records, variables, enums, type , using directives
+-- n.b. a lot of variables are not considered "Definitions" (e.g. local/auto)
+-- so they are only discoverable through decl search
+--
+lookupDeclaration
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupDeclaration anchor ns (P.Name name) =
+  vars $ \ (decl :: Angle Cxx.Declaration) (entity :: Angle Cxx.Entity)
+    (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+      (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` (
+      (scope .= sig (scopeQ (reverse scopes))):(
+      wild .= predicate @SymbolId.LookupDeclaration (
+        rec $
+          field @"name" (string name) $
+          field @"scope" scope $
+          field @"decl" decl
+        end))
+      : entityDeclFooter anchor decl entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+--
+-- Declarations of functions, including regular named functions, operators,
+-- literl operators, constructors (anonymous), destructors (anonymous), and
+-- type conversion operators.
+--
+-- Note things like variables, within a function, have a FunctionQName scope
+-- but are not FunctionName-indexed
+--
+lookupFunctionDeclaration
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupFunctionDeclaration anchor ns (P.Name name) =
+  vars $ \ (decl :: Angle Cxx.Declaration) (entity :: Angle Cxx.Entity)
+    (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+      (scope :: Angle Cxx.Scope) ->
+    tuple (entity, file, rangespan, lname) `where_` (
+      (scope .= sig (scopeQ (reverse scopes))):(
+      wild .= predicate @SymbolId.LookupFunctionDeclaration (
+        rec $
+          field @"name" (functionName name) $
+          -- scopeQuery: too generic? can this ever be local or a function?
+          field @"scope" scope $
+          field @"decl" decl
+        end))
+      : entityDeclFooter anchor decl entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+--
+-- Namespaces are a bit like regular scopes but they can be anonymous.
+-- This is a "" in the symbol id, corresponding to a nothing in the query
+--
+lookupNamespaceDeclaration
+  :: Text -> [P.Name] -> P.Name -> Angle (ResultLocation Cxx.Entity)
+lookupNamespaceDeclaration anchor ns (P.Name name) =
+  vars $ \ (decl :: Angle Cxx.Declaration) (entity :: Angle Cxx.Entity)
+    (codeEntity :: Angle Code.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (entity, file, rangespan, lname) `where_` ((
+      wild .= predicate @SymbolId.LookupNamespaceDeclaration (
+        rec $
+          field @"name" (maybeName name) $
+          field @"parent" (namespaceParentQName (reverse scopes)) $
+          field @"decl" decl
+        end))
+      : entityDeclFooter anchor decl entity codeEntity file rangespan lname
+      )
+  where scopes = P.unNames ns
+
+--
+-- AngleStatement helpers, to generate query fragments
+--
+
+lookupEntityFn ::
+  Angle.AngleVars
+    (Angle Cxx.Entity
+      -> Angle Code.Entity
+      -> Angle Src.File
+      -> Angle Code.RangeSpan
+      -> Angle Text
+      -> Angle (Cxx.Entity, Src.File, Code.RangeSpan, Text)) r
+  => (P.Name -> [P.Name] -> Angle Cxx.Entity -> Angle t)
+  -> Text -> [P.Name] -> P.Name -> Angle r
+lookupEntityFn pred anchor ns name =
+  vars $ \(entity :: Angle Cxx.Entity) (codeEntity :: Angle Code.Entity)
+      (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity, file, rangespan, lname) `where_` ((
+      wild .= pred name ns entity)
+      : entityFooter anchor entity codeEntity file rangespan lname
+    )
+
+entityDeclFooter
+  :: Text -> Angle Cxx.Declaration -> Angle Cxx.Entity -> Angle Code.Entity
+  -> Angle Src.File -> Angle Code.RangeSpan -> Angle Text
+  -> [AngleStatement]
+entityDeclFooter anchor decl entity codeEntity file rangespan lname =
+  (alt @"decl" decl .= sig entity)
+  : entityFooter anchor entity codeEntity file rangespan lname
+
+entityFooter
+  :: Text -> Angle Cxx.Entity -> Angle Code.Entity
+  -> Angle Src.File -> Angle Code.RangeSpan -> Angle Text
+  -> [AngleStatement]
+entityFooter anchor entity codeEntity file rangespan lname =
+  [ alt @"cxx" entity .= sig codeEntity
+  , entityLocation codeEntity file rangespan lname
+  ] ++ -- refine to specific sub-repo if we have a prefix
+  [file .= predicate @Src.File (stringPrefix anchor) | not (Text.null anchor)]
+
+--
+-- Scope queries
+--
+
+-- These will never be empty strings
+functionName :: Text -> Angle Cxx.FunctionName_key
+functionName name =
+  alt @"name" (string name) .|
+  alt @"operator_" (string name) .|
+  alt @"literalOperator" (string name) .|
+  alt @"conversionOperator" (string name)
+
+operatorQ :: Text -> Angle Cxx.FunctionName_key
+operatorQ name =
+  alt @"operator_" (string name) .|
+  alt @"literalOperator" (string name)
+
+--
+-- For namespaces, which may have anonymous components
+--
+maybeName :: Text -> Angle (Maybe Cxx.Name)
+maybeName "" = nothing
+maybeName n = just (predicate (string n))
+
+namespaceParentQName :: [Text] -> Angle (Maybe Cxx.NamespaceQName)
+namespaceParentQName [] = nothing
+namespaceParentQName (n:ns) = just $ predicate $
+  rec $
+    field @"name" (maybeName n) $
+    field @"parent" (namespaceParentQName ns)
+  end
+
+namespaceQName :: [Text] -> Text -> Angle Cxx.NamespaceQName_key
+namespaceQName ns n =
+  rec $
+    field @"name" (maybeName n) $
+    field @"parent" (namespaceParentQName ns)
+  end
+
+functionQName :: Angle Cxx.Scope -> Text -> Angle Cxx.FunctionQName_key
+functionQName scope_ns ".ctor" = -- hard coded tokens. fix.
+  rec $
+    field @"name" (alt @"constructor" wild) $
+    field @"scope" scope_ns
+  end
+functionQName scope_ns ".dtor" = -- hard coded tokens
+  rec $
+    field @"name" (alt @"destructor" wild) $
+    field @"scope" scope_ns
+  end
+functionQName scope_ns n =
+  rec $
+    field @"name" (functionName n) $ -- i suspect we have params to constrs here
+    field @"scope" scope_ns
+  end
+
+--
+-- Scope queries. There are lots of alternatives, recursively, unfortunately
+--
+scopeQ :: [Text] -> Angle Cxx.Scope
+scopeQ [] = alt @"global_" wild
+scopeQ (n:ns) =
+  alt @"namespace_" (namespaceQName ns n)
+  .| (
+    var $ \scope_ns ->
+      let
+        result =
+          alt @"recordWithAccess" (rec $
+            field @"record" (rec $ -- anonymous QName
+              field @"name" (string n) $
+              field @"scope" scope_ns -- I suspect this is too generic
+            end) $
+            field @"access" (
+              enum Cxx.Access_Public .|
+              enum Cxx.Access_Protected .|
+              enum Cxx.Access_Private
+            )
+          end)
+          .|
+          alt @"local" (functionQName scope_ns n)
+            -- too broad, will yield local (global ..)
+      in
+      result `where_` [scopeQ ns .= scope_ns]
+  )
+
+--
+-- cxx1.Signature type only of param queries
+--  Fn where S = cxx1.Scope {
+--         recordWithAccess = { record = { name = "dynamic",
+--          scope = { namespace_ = { name = { just =  "folly" } }}}}};
+--   Fn = symbolid.cxx.LookupFunctionDeclaration { name = { constructor = {} },
+--        scope = S, decl = { function_ =
+--  { signature = { parameters = [{"r","folly::dynamic::Array &&"}] }
+-- , source = {file = F } } }}; F = src.File "fbcode/"..
+--
+-- Note: params are in the non-left position, so this should always be used
+-- _after_ matching the FunctionDeclaration
+--
+paramTypesQ :: [Text] -> Angle Cxx.Signature
+paramTypesQ ps = predicate @Cxx.Signature $
+    rec $
+      field @"parameters" (array (map paramQ ps))
+    end
+  where
+    paramQ :: Text -> Angle Cxx.Parameter
+    paramQ tyStr =
+      rec $
+        field @"type" (string tyStr)
+      end
+
+--
+-- return type matching
+--
+returnTypeQ :: Angle Cxx.Type -> Angle Cxx.Signature
+returnTypeQ retTyQ = predicate @Cxx.Signature $
+  rec $
+    field @"returns" (asPredicate retTyQ)
+  end
+
+--
+-- function signature qualifiers (const &&, volatile etc)
+--
+qualifiersQ :: Set P.Qualifier -> Angle (Maybe Cxx.MethodSignature)
+qualifiersQ qs
+  | Set.null qs    -- if there's no qualifiers its either nothing or all false
+  = sig nothing .| just (
+      rec $
+        field @"isVirtual" false $
+        field @"isConst" false $
+        field @"isVolatile" false $
+        field @"refQualifier" (enum Cxx.RefQualifier_None_)
+      end)
+  | otherwise   -- its definitely set
+  = just $ sig $
+      rec $
+        field @"isVirtual" (bool $ P.Virtual `Set.member` qs) $
+        field @"isConst" (bool $ P.Const `Set.member` qs) $
+        field @"isVolatile" (bool $ P.Volatile `Set.member` qs) $
+        field @"refQualifier" (enum
+          (if P.RefQual P.LValue `Set.member` qs
+            then Cxx.RefQualifier_LValue
+            else if P.RefQual P.RValue `Set.member` qs
+            then Cxx.RefQualifier_RValue
+            else Cxx.RefQualifier_None_
+          ))
+      end
diff --git a/glean/glass/Glean/Glass/Search/Erlang.hs b/glean/glass/Glean/Glass/Search/Erlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Erlang.hs
@@ -0,0 +1,51 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
+
+module Glean.Glass.Search.Erlang
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text, unpack )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeErlang.Types as Erlang
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.SearchErlang.Types as Erlang
+import qualified Glean.Schema.Src.Types as Src
+import Text.Read ( readMaybe )
+import Data.Word ( Word64 )
+
+instance Search (ResultLocation Erlang.Entity) where
+  symbolSearch toks
+    | [module_, name, arity] <- toks
+    , Just arityNum <- readMaybe $ unpack arity = do
+        searchSymbolId toks $ searchByFQN module_ name arityNum
+    | otherwise = return $ None "Erlang.symbolSearch: invalid query"
+
+searchByFQN :: Text -> Text -> Word64 -> Angle (ResultLocation Erlang.Entity)
+searchByFQN module_ name arity =
+  vars $ \(ent :: Angle Erlang.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    wild .= predicate @Erlang.SearchByFQN (
+      rec $
+        field @"module" (string module_) $
+        field @"name" (string name) $
+        field @"arity" (nat arity) $
+        field @"entity" ent
+      end),
+    entityLocation (alt @"erlang" ent) file rangespan lname
+  ]
diff --git a/glean/glass/Glean/Glass/Search/Flow.hs b/glean/glass/Glean/Glass/Search/Flow.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Flow.hs
@@ -0,0 +1,119 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Flow
+  ( {- instances -}
+  ) where
+
+import Data.Text as Text ( Text )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+import Glean.Glass.Utils ( joinFragments )
+
+import qualified Glean.Schema.CodeFlow.Types as Flow
+import qualified Glean.Schema.Flow.Types as Flow
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+
+instance Search (ResultLocation Flow.Entity) where
+  symbolSearch [] = return $ None "Flow.symbolSearch: empty"
+
+  -- if it is a single token it is either a string_ or Haste module name
+  symbolSearch toks@[module_] = do
+    m <- searchSymbolId toks (searchByModuleName module_)
+    return $ mapResultLocation Flow.Entity_module_ <$> m
+
+  -- (string or lib) module , method
+  -- module only, of any sort.
+  symbolSearch ("m":toks) = do
+    a <- searchSymbolId toks $ searchByModuleName (joinFragments toks)
+    return $ mapResultLocation Flow.Entity_module_ <$> a
+
+  -- (string or lib) module , method
+  symbolSearch toks@[module_, name] = do
+    a <- searchSymbolId toks $ searchByModule module_ name
+    decl <- case a of
+      None{} -> searchSymbolId toks $ searchTypeByModuleExport module_ name
+      _ -> return a
+    return $ mapResultLocation Flow.Entity_decl <$> decl
+
+  -- inverse of T90301808 , if we don't have a short name use filepath
+  symbolSearch toks = do
+    let name = last toks
+        path = joinFragments (init toks)
+    a <- searchSymbolId toks $ searchByFileModule path name
+    return $ mapResultLocation Flow.Entity_decl <$> a
+
+-- With the Haste short module name and an identifier, find the decl
+searchByModule :: Text -> Text -> Angle (ResultLocation Flow.SomeDeclaration)
+searchByModule module_ name =
+  vars $ \(decl :: Angle Flow.SomeDeclaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan,lname) `where_` [
+      wild .= predicate @Flow.SearchByModule (
+        rec $
+          field @"string_" (string module_) $
+          field @"name" (string name) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"flow" (alt @"decl" decl)) file rangespan lname
+    ]
+
+-- With the repo-anchored filepath and an identifier, find the decl
+searchByFileModule
+  :: Text -> Text -> Angle (ResultLocation Flow.SomeDeclaration)
+searchByFileModule path name =
+  vars $ \(decl :: Angle Flow.SomeDeclaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      wild .= predicate @Flow.SearchByFileModule (
+        rec $
+          field @"file" (asPredicate file) $
+          field @"name" (string name) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"flow" (alt @"decl" decl)) file rangespan lname
+    ]
+
+-- With the Haste name, find the type decl from a .js.flow file
+searchTypeByModuleExport
+  :: Text -> Text -> Angle (ResultLocation Flow.SomeDeclaration)
+searchTypeByModuleExport module_ name =
+  vars $ \(decl :: Angle Flow.SomeDeclaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan,lname) `where_` [
+      wild .= predicate @Flow.SearchTypeByModuleExport (
+        rec $
+          field @"string_" (string module_) $
+          field @"name" (string name) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"flow" (alt @"decl" decl)) file rangespan lname
+    ]
+
+-- Single token module name lookup
+searchByModuleName :: Text -> Angle (ResultLocation Flow.Module)
+searchByModuleName modstr = vars $ \(modent :: Angle Flow.Module)
+  (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+    (lname :: Angle Text) ->
+  tuple (modent, file, rangespan, lname) `where_` [
+    wild .= predicate @Flow.SearchByModuleName (
+      rec $
+        field @"name" (string modstr) $
+        field @"module" (asPredicate modent)
+      end),
+    entityLocation (alt @"flow" (alt @"module_" (asPredicate modent)))
+      file rangespan lname
+  ]
diff --git a/glean/glass/Glean/Glass/Search/GraphQL.hs b/glean/glass/Glean/Glass/Search/GraphQL.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/GraphQL.hs
@@ -0,0 +1,73 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.GraphQL
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeGraphql.Types as GraphQL
+import qualified Glean.Schema.Graphql.Types as GraphQL
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Src.Types as Src
+
+--
+-- Recover GraphQL entities from their Symbol ID encoding
+--
+
+instance Search (ResultLocation GraphQL.Entity) where
+  symbolSearch toks
+    | [name] <- toks -- fragment
+    = searchSymbolId toks $ searchFragment name
+
+    | ["o",name] <- toks -- operation
+    = searchSymbolId toks $ searchOperation name
+
+    -- fields and enums don't have entries in the db yet.
+    -- directive defs don't have a sensible location to be an entity?
+
+    | otherwise = return $ None "GraphQL.symbolSearch: unsupported symbol id"
+
+searchFragment :: Text -> Angle (ResultLocation GraphQL.Entity)
+searchFragment fname =
+  vars $ \(ent :: Angle GraphQL.Entity) (file :: Angle Src.File)
+    (fragment :: Angle GraphQL.Fragment) (decl :: Angle GraphQL.Declaration)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    fragment .= predicate @GraphQL.Fragment (
+      rec $
+        field @"name" (string fname)
+      end),
+    alt @"fragment_" (asPredicate fragment) .= sig decl,
+    alt @"decl" decl .= sig ent,
+    entityLocation (alt @"graphql" ent) file rangespan lname
+  ]
+
+searchOperation :: Text -> Angle (ResultLocation GraphQL.Entity)
+searchOperation fname =
+  vars $ \(ent :: Angle GraphQL.Entity) (file :: Angle Src.File)
+    (op :: Angle GraphQL.Operation) (decl :: Angle GraphQL.Declaration)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+  tuple (ent, file, rangespan, lname) `where_` [
+    op .= predicate @GraphQL.Operation (
+      rec $
+        field @"name" (string fname)
+      end),
+    alt @"operation_" (asPredicate op) .= sig decl,
+    alt @"decl" decl .= sig ent,
+    entityLocation (alt @"graphql" ent) file rangespan lname
+  ]
diff --git a/glean/glass/Glean/Glass/Search/Hack.hs b/glean/glass/Glean/Glass/Search/Hack.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Hack.hs
@@ -0,0 +1,213 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo, AllowAmbiguousTypes #-}
+{-# OPTIONS_GHC -Wno-orphans -Wno-incomplete-uni-patterns #-}
+
+module Glean.Glass.Search.Hack
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeHack.Types as Hack
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Glean.Schema.SearchHack.Types as Hack
+import qualified Glean.Schema.Src.Types as Src
+
+instance Search (ResultLocation Hack.Entity) where
+  symbolSearch toks =
+    fmap (mapResultLocation Hack.Entity_decl) <$> symbolSearch toks
+
+instance Search (ResultLocation Hack.Declaration) where
+  symbolSearch t@("ns":[name]) = searchSymbolId t $ searchNamespace [] name
+  symbolSearch ("ns":t@(_:_:_)) = do -- 2 or more path elements
+    let name:rest = reverse t
+    searchSymbolId t $ searchNamespace rest name
+
+  symbolSearch ("fun":t@(_:_)) = do
+    let name:rest = reverse t
+    searchSymbolId t $ searchFunctionInNamespace rest name
+
+  symbolSearch t@("module":[name]) = searchSymbolId t $ searchModule name
+
+  symbolSearch ("const":t@(_:_)) = do -- 2 or more path elements
+    let name:rest = reverse t
+    searchSymbolId t $ searchGlobalConstInNamespace rest name
+
+  symbolSearch t@[name] = searchSymbolId t $ searchTypeInNamespace [] name
+  symbolSearch t@(_:_) = -- 2 or more path elements
+    let (name:rest) = reverse t in
+    case rest of
+      ":prop":context:ns ->
+         searchSymbolId t $ searchPropertyInContainer ns context name
+      context:ns -> do
+        a <- searchSymbolId t $ searchTypeInNamespace rest name
+        b <- searchSymbolId t $
+          searchInContainerOrEnumNoProperty ns context name
+
+        return $ case (a,b) of
+          (x@One{}, _) -> x
+          (_, y@One{}) -> y
+          (x@Many{}, _) -> x
+          (_, y@Many{}) -> y
+          (x@None{}, None{}) -> x
+      [] -> fail "rest has at least one element"
+
+  symbolSearch [] = return $ None "Hack.symbolSearch: empty path"
+
+searchTypeInNamespace
+  :: [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchTypeInNamespace = searchTypeInNamespace_ False
+
+searchFunctionInNamespace
+  :: [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchFunctionInNamespace = searchFunctionInNamespace_ False
+
+searchModule :: Text -> Angle (ResultLocation Hack.Declaration)
+searchModule = searchModule_ False
+
+searchGlobalConstInNamespace
+  :: [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchGlobalConstInNamespace = searchGlobalConstInNamespace_ False
+
+searchPropertyInContainer
+  :: [Text] -> Text -> Text -> Angle (ResultLocation Hack.Declaration)
+searchPropertyInContainer = searchPropertyInContainer_ False
+
+searchInContainerOrEnumNoProperty
+  :: [Text] -> Text -> Text -> Angle (ResultLocation Hack.Declaration)
+searchInContainerOrEnumNoProperty = searchInContainerOrEnumNoProperty_ False
+
+searchFunctionInNamespace_
+  :: Bool -> [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchFunctionInNamespace_ isPrefix ns name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchFunctionInNamespace (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"namespace_" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchModule_
+  :: Bool -> Text -> Angle (ResultLocation Hack.Declaration)
+searchModule_ isPrefix name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchModule (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchGlobalConstInNamespace_
+  :: Bool -> [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchGlobalConstInNamespace_ isPrefix ns name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchGlobalConstInNamespace (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"namespace_" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchTypeInNamespace_
+  :: Bool -> [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchTypeInNamespace_ isPrefix ns name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchTypeInNamespace (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"namespace_" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchNamespace :: [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchNamespace = searchNamespace_ False
+
+searchNamespace_
+  :: Bool -> [Text] -> Text -> Angle (ResultLocation Hack.Declaration)
+searchNamespace_ isPrefix ns name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl,file,rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchNamespace (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"namespace_" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchInContainerOrEnumNoProperty_
+  :: Bool -> [Text] -> Text -> Text -> Angle (ResultLocation Hack.Declaration)
+searchInContainerOrEnumNoProperty_ isPrefix ns context name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl, file, rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchInContainerOrEnumNoProperty (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"contextName" (string context) $
+          field @"contextNamespace" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+searchPropertyInContainer_
+  :: Bool -> [Text] -> Text -> Text -> Angle (ResultLocation Hack.Declaration)
+searchPropertyInContainer_ isPrefix ns container name =
+  vars $ \(decl :: Angle Hack.Declaration) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl, file, rangespan, lname) `where_` [
+      wild .= predicate @Hack.SearchPropertyInContainer (
+        rec $
+          field @"name" (stringOrPrefix isPrefix name) $
+          field @"containerName" (string container) $
+          field @"containerNamespace" (namespaceQName ns) $
+          field @"decl" decl
+        end),
+      entityLocation (alt @"hack" (alt @"decl" decl)) file rangespan lname
+    ]
+
+namespaceQName :: [Text] -> Angle (Maybe Hack.NamespaceQName)
+namespaceQName [] = nothing
+namespaceQName (n:ns) = just $ predicate $
+  rec $
+    field @"name" (string n) $
+    field @"parent" (namespaceQName ns)
+  end
+
+stringOrPrefix :: Bool -> Text -> Angle Text
+stringOrPrefix isPrefix
+  | isPrefix = stringPrefix
+  | otherwise = string
diff --git a/glean/glass/Glean/Glass/Search/Haskell.hs b/glean/glass/Glean/Glass/Search/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Haskell.hs
@@ -0,0 +1,88 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Haskell
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+import qualified Data.Text as Text ( intercalate )
+import Util.Text
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+
+import qualified Glean.Schema.CodeHs.Types as Haskell
+import qualified Glean.Schema.Hs.Types as Hs
+
+instance Search (ResultLocation Haskell.Entity) where
+  symbolSearch [] = return $ None "Haskell.symbolSearch: empty"
+  symbolSearch toks@(pkg : rest) = do
+    case reverse rest of
+      end : start : ident : namespace : mod
+        | Right e <- textToInt end,
+          Right s <- textToInt start,
+          Just ns <- fromNamespace namespace ->
+          searchSymbolId toks $
+            symbolIdQuery pkg (Text.intercalate "." (reverse mod)) ident ns
+              (Just (s,e))
+      ident : namespace : mod
+        | Just ns <- fromNamespace namespace ->
+          searchSymbolId toks $
+            symbolIdQuery pkg (Text.intercalate "." (reverse mod)) ident ns
+              Nothing
+      _ -> return $ None "Haskell.symbolSearch: empty"
+    where
+    fromNamespace "var" = Just Hs.Namespace_var_
+    fromNamespace "ty" = Just Hs.Namespace_tycon
+    fromNamespace "con" = Just Hs.Namespace_datacon
+    fromNamespace "tyvar" = Just Hs.Namespace_tyvar
+    fromNamespace _ = Nothing
+
+
+symbolIdQuery
+  :: Text  -- ^ package
+  -> Text  -- ^ module name
+  -> Text  -- ^ identifier
+  -> Hs.Namespace -- ^ namespace (var, datacon, tycon, tyvar)
+  -> Maybe (Int, Int)  -- ^ span, for local names
+  -> Angle (ResultLocation Haskell.Entity)
+symbolIdQuery pkg mod ident ns sort =
+  vars $ \name file span ->
+    tuple (
+      alt @"name" (asPredicate name),
+      file,
+      alt @"span" span,
+      string ident
+    ) `where_` [
+        name .= predicate @Hs.Name (
+          rec $
+            field @"occ" (rec $
+              field @"name" (string ident) $
+              field @"namespace_" (enum ns) end) $
+            field @"mod" (rec $
+              field @"name" (string mod) $
+              field @"unit" (stringPrefix pkg) end) $
+            field @"sort" (
+              case sort of
+                Nothing -> alt @"external" wild
+                Just (s,l) -> alt @"internal" (rec $
+                  field @"start" (nat (fromIntegral s)) $
+                  field @"length" (nat (fromIntegral l)) end)
+            ) end),
+        stmt $ predicate @Hs.DeclarationLocation (
+          rec $
+            field @"name" (asPredicate name) $
+            field @"file" (asPredicate file) $
+            field @"span" span end
+        )
+    ]
diff --git a/glean/glass/Glean/Glass/Search/Java.hs b/glean/glass/Glean/Glass/Search/Java.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Java.hs
@@ -0,0 +1,212 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Java
+  ( {- instances -}
+    toQName,
+    toMName
+  ) where
+
+import Data.Maybe
+import Data.Text as Text ( Text )
+import qualified Data.Text as Text
+import Data.List.NonEmpty  ( NonEmpty((:|)) )
+
+import Glean.Angle as Angle
+import Glean.Haxl.Repos (ReposHaxl)
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeJava.Types as Java
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.JavaAlpha.Types as Java
+import qualified Glean.Schema.JavakotlinAlpha.Types as JavaKotlin
+import qualified Glean.Schema.SymbolidJava.Types as Java
+import qualified Glean.Schema.Src.Types as Src
+
+instance Search (ResultLocation Java.Entity) where
+  symbolSearch toks = case toks of
+    [] -> return $ None "Java.symbolSearch: empty"
+    [_] -> return $ None "Java.symbolSearch: singleton: not a symbolid"
+    (x:y:rest) -> runQuery x y rest
+
+runQuery ::
+  Text
+  -> Text
+  -> [Text]
+  -> ReposHaxl u w (SearchResult (ResultLocation Java.Entity))
+runQuery x y toks =
+  let q = parse x y (map tokenize toks) in
+  case q of
+    Nothing -> pure $ None "No entity found"
+    Just (Term name path Nothing) -> do -- either qname or mname witout sig
+      result <- searchSymbolId (x:y:toks) $ searchByQName (toQName name path)
+      case result of
+        None{} -> searchSymbolId (x:y:toks) $
+           searchByMName (toMName name path Nothing)
+        x -> return x
+    Just (Term name path msig) -> -- definitely a method name with sig
+      searchSymbolId (x:y:toks) $ searchByMName (toMName name path msig)
+
+--
+-- Parsing the symbol id format
+--
+
+-- | Two flavors of query
+data Term = Term {
+    _base :: Text,
+    _path :: NonEmpty Text,
+    _sig :: Maybe Signature
+  }
+  deriving Show
+
+newtype Signature = Signature [Param]
+  deriving Show
+
+newtype Param = Param [Text]
+  deriving Show
+
+data Token
+  = TName !Text
+  | TSignature
+
+tokenize :: Text -> Token
+tokenize ".t" = TSignature
+tokenize n = TName n
+
+-- | format: name/name/name*/(.t/name+)?
+parse :: Text -> Text -> [Token] -> Maybe Term
+parse base path [] = Just (Term path (base :| []) Nothing)
+parse base path rest = case path' ++ [path, base] of
+    (name:r:rs) -> Just (Term name (r :| rs) msig) -- inside out order
+    _ -> Nothing
+  where
+    (path', msig) = parsePath rest
+
+parsePath :: [Token] -> ([Text], Maybe Signature)
+parsePath [] = ([], Nothing)
+parsePath ((TName n):rest) = parseNames rest [n]
+parsePath (TSignature:rest) = ([], parseSig rest [])
+
+parseNames :: [Token] -> [Text] -> ([Text], Maybe Signature)
+parseNames [] acc = (acc, Nothing)
+parseNames (TName n:rest) acc = parseNames rest (n:acc)
+parseNames (TSignature:rest) acc = (acc, parseSig rest [])
+
+parseSig :: [Token] -> [Text] -> Maybe Signature
+parseSig [] [] = Nothing
+parseSig [] acc = Just (Signature (map split (reverse acc)))
+  where
+    split tok = Param (Text.splitOn "." tok)
+parseSig (TName n:rest) acc = parseSig rest (n:acc)
+parseSig (TSignature:_) _ = Nothing -- invalid signature token
+
+--
+-- Actually doing the search
+--
+
+searchByQName :: Angle JavaKotlin.QName -> Angle (ResultLocation Java.Entity)
+searchByQName qname =
+  vars $ \(entity :: Angle Java.Entity) (file :: Angle Src.File)
+    (decl :: Angle Java.Declaration) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      wild .= predicate @Java.LookupDeclaration (
+        rec $
+          field @"qname" (asPredicate qname) $
+          field @"decl" decl
+        end),
+      alt @"decl" decl .= sig entity,
+      entityLocation (alt @"java" entity) file rangespan lname
+    ]
+
+-- methods and cosntructors with empty signatures
+searchByMName
+  :: Angle JavaKotlin.MethodName -> Angle (ResultLocation Java.Entity)
+searchByMName mname =
+  vars $ \(entity :: Angle Java.Entity) (file :: Angle Src.File)
+    (decl :: Angle Java.Declaration) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      wild .= predicate @Java.LookupMethodDeclaration (
+        rec $
+          field @"mname" (asPredicate mname) $
+          field @"decl" decl
+        end),
+      alt @"decl" decl .= sig entity,
+      entityLocation (alt @"java" entity) file rangespan lname
+    ]
+
+--
+-- Generic to Java and Kotlin
+--
+
+toMName
+ :: Text -> NonEmpty Text -> Maybe Signature -> Angle JavaKotlin.MethodName
+toMName name (base :| rest) Nothing =
+  predicate @JavaKotlin.MethodName $
+    rec $
+      field @"name" (asPredicate (toQName name (base :| rest)))
+    end
+
+toMName name (base :| rest) (Just (Signature tys)) =
+  predicate @JavaKotlin.MethodName $
+    rec $
+      field @"name" (asPredicate (toQName name (base :| rest))) $
+      field @"signature" (array (mapMaybe toType tys))
+    end
+
+toType :: Param -> Maybe (Angle JavaKotlin.Type)
+toType (Param st) = case reverse st of
+  [] -> Nothing
+  x:xs -> Just (toSimpleTypeOuter x xs)
+
+toSimpleTypeOuter :: Text -> [Text] -> Angle JavaKotlin.Type
+toSimpleTypeOuter x [] = predicate @JavaKotlin.Type
+  (alt @"primitive" (string x)) -- non-qualified name. has to be a primitive
+toSimpleTypeOuter x xs
+  | Just x' <- Text.stripSuffix "[]" x -- definitely an array
+  = predicate @JavaKotlin.Type (
+      alt @"array" (asPredicate (toSimpleType x' xs)) -- array of xs.x
+    )
+  | otherwise = toSimpleType x xs
+
+toSimpleType :: Text -> [Text] -> Angle JavaKotlin.Type
+toSimpleType x xs = predicate @JavaKotlin.Type (
+  alt @"object" (
+    rec $
+      field @"base" (string x) $
+      field @"container" (case xs of
+        [] -> nothing
+        y:ys -> just (toPath y ys)
+      )
+    end)
+  )
+
+toQName :: Text -> NonEmpty Text -> Angle JavaKotlin.QName
+toQName name (base :| rest) = predicate @JavaKotlin.QName $
+  rec $
+    field @"name" (string name) $
+    field @"context" (asPredicate (toPath base rest))
+  end
+
+toPath :: Text -> [Text] -> Angle JavaKotlin.Path
+toPath base [] = predicate @JavaKotlin.Path $
+  rec $
+    field @"base" (string base) $
+    field @"container" nothing
+  end
+toPath base (x:xs) = predicate @JavaKotlin.Path $
+  rec $
+    field @"base" (string base) $
+    field @"container" (just (toPath x xs))
+  end
diff --git a/glean/glass/Glean/Glass/Search/Kotlin.hs b/glean/glass/Glean/Glass/Search/Kotlin.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Kotlin.hs
@@ -0,0 +1,78 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Kotlin
+  ( {- instances -}
+  ) where
+
+import Data.Text as Text ( Text )
+import Data.List.NonEmpty  ( NonEmpty((:|)) )
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Glass.Search.Java as JavaKotlin
+
+import qualified Glean.Schema.CodeKotlin.Types as Kotlin
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.KotlinAlpha.Types as Kotlin
+import qualified Glean.Schema.JavakotlinAlpha.Types as JavaKotlin
+import qualified Glean.Schema.SymbolidKotlin.Types as Kotlin
+import qualified Glean.Schema.Src.Types as Src
+
+instance Search (ResultLocation Kotlin.Entity) where
+  symbolSearch skot = case toks of
+      [] -> return $ None "Kotlin.symbolSearch: empty"
+      [_] -> return $ None "Kotlin.symbolSearch: singleton: not a symbolid"
+      (name:base:rest) -> do
+        result <- searchSymbolId skot $
+          searchByQName (JavaKotlin.toQName name (base :| rest))
+        case result of
+          None{}  -> searchSymbolId skot $
+            searchByMName (JavaKotlin.toMName name (base :| rest) Nothing)
+          x -> return x
+    where
+      toks = reverse skot
+
+searchByQName
+  :: Angle JavaKotlin.QName -> Angle (ResultLocation Kotlin.Entity)
+searchByQName qname =
+  vars $ \(entity :: Angle Kotlin.Entity) (file :: Angle Src.File)
+    (decl :: Angle Kotlin.Declaration) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      wild .= predicate @Kotlin.LookupDeclaration (
+        rec $
+          field @"qname" (asPredicate qname) $
+          field @"decl" decl
+        end),
+      alt @"decl" decl .= sig entity,
+      entityLocation (alt @"kotlin" entity) file rangespan lname
+    ]
+
+-- methods
+searchByMName
+  :: Angle JavaKotlin.MethodName -> Angle (ResultLocation Kotlin.Entity)
+searchByMName mname =
+  vars $ \(entity :: Angle Kotlin.Entity) (file :: Angle Src.File)
+    (decl :: Angle Kotlin.Declaration) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      wild .= predicate @Kotlin.LookupMethodDeclaration (
+        rec $
+          field @"mname" (asPredicate mname) $
+          field @"decl" decl
+        end),
+      alt @"decl" decl .= sig entity,
+      entityLocation (alt @"kotlin" entity) file rangespan lname
+    ]
diff --git a/glean/glass/Glean/Glass/Search/LSIF.hs b/glean/glass/Glean/Glass/Search/LSIF.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/LSIF.hs
@@ -0,0 +1,146 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.LSIF
+  ( {- instances -}
+  ) where
+
+import Data.Text as Text ( Text )
+import Data.Coerce
+import Util.Text
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+import Glean.Glass.Utils ( joinFragments )
+
+import qualified Glean.Schema.CodeLsif.Types as Lsif ( Entity(..) )
+import qualified Glean.Schema.Lsif.Types as LSIF
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+
+instance Search (ResultLocation Lsif.Entity) where
+  symbolSearch [] = return $ None "LSIF.symbolSearch: empty"
+
+  -- case 2: purely a moniker
+  symbolSearch toks@("lsif":rest) =
+    searchSymbolId toks $ searchByMoniker (joinFragments rest)
+
+  -- case 1a) <local> with no identifier
+  symbolSearch toks
+    | ceT:leT:cbT:lbT:"<local>":revpath <- reverse toks
+    , Right lb <- textToInt lbT
+    , Right cb <- textToInt cbT
+    , Right le <- textToInt leT
+    , Right ce <- textToInt ceT
+    = searchSymbolId toks $ searchByExactLocation
+        (joinFragments (reverse revpath)) lb cb le ce
+
+  -- case 1b) <local> with identifier
+  symbolSearch toks
+    | ceT:leT:cbT:lbT:name:"<local>":revpath <- reverse toks
+    , Right lb <- textToInt lbT
+    , Right cb <- textToInt cbT
+    , Right le <- textToInt leT
+    , Right ce <- textToInt ceT
+    = searchSymbolId toks $ searchByExactLocationAndName
+        (joinFragments (reverse revpath)) name lb cb le ce
+
+  -- case 3: only path and name
+    | name:revpath <- rtoks
+    = searchSymbolId toks $ searchNonLocalByLocation
+        (joinFragments (reverse revpath)) name
+    where
+      rtoks = reverse toks
+
+  -- anything else is malformed
+  symbolSearch _ = return $ None "LSIF.symbolSearch: malformed symbol id"
+
+searchByMoniker :: Text -> Angle (ResultLocation Lsif.Entity)
+searchByMoniker ident =
+  vars $ \(ent :: Angle Lsif.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (ent,file,rangespan,lname) `where_` [
+      wild .= predicate @LSIF.SearchByMoniker (
+        rec $
+          field @"ident" (string ident) $
+          field @"entity" (cast ent)
+        end),
+      entityLocation (alt @"lsif" ent) file rangespan lname
+    ]
+
+searchNonLocalByLocation
+  :: Text -> Text -> Angle (ResultLocation Lsif.Entity)
+searchNonLocalByLocation path name =
+  vars $ \(ent :: Angle Lsif.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (ent,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      wild .= predicate @LSIF.SearchNonLocalByLocation (
+        rec $
+          field @"file" (asPredicate file) $
+          field @"name" (string name) $
+          field @"entity" (cast ent)
+        end),
+      entityLocation (alt @"lsif" ent) file rangespan lname
+    ]
+
+searchByExactLocation
+  :: Text -> Int -> Int -> Int -> Int
+  -> Angle (ResultLocation Lsif.Entity)
+searchByExactLocation path lb cb le ce =
+  vars $ \(ent :: Angle Lsif.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (ent,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      wild .= predicate @LSIF.SearchByExactLocation (
+        rec $
+          field @"file" (asPredicate file) $
+          field @"span" (
+            rec $
+              field @"lineBegin" (nat (fromIntegral lb)) $
+              field @"columnBegin" (nat (fromIntegral cb)) $
+              field @"lineEnd" (nat (fromIntegral le)) $
+              field @"columnEnd" (nat (fromIntegral ce - 1))
+            end) $
+          field @"entity" (cast ent)
+        end),
+      entityLocation (alt @"lsif" ent) file rangespan lname
+    ]
+
+searchByExactLocationAndName
+  :: Text -> Text -> Int -> Int -> Int -> Int
+  -> Angle (ResultLocation Lsif.Entity)
+searchByExactLocationAndName path name lb cb le ce =
+  vars $ \(ent :: Angle Lsif.Entity) (file :: Angle Src.File)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (ent,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      wild .= predicate @LSIF.SearchByExactLocationAndName (
+        rec $
+          field @"file" (asPredicate file) $
+          field @"name" (string name) $
+          field @"span" (
+            rec $
+              field @"lineBegin" (nat (fromIntegral lb)) $
+              field @"columnBegin" (nat (fromIntegral cb)) $
+              field @"lineEnd" (nat (fromIntegral le)) $
+              field @"columnEnd" (nat (fromIntegral ce - 1))
+            end) $
+          field @"entity" (cast ent)
+        end),
+      entityLocation (alt @"lsif" ent) file rangespan lname
+    ]
+
+-- we are coercing (silently) lsif.Entity to code.lsif.Entity
+cast :: Angle Lsif.Entity -> Angle LSIF.Entity
+cast = coerce
diff --git a/glean/glass/Glean/Glass/Search/Pp.hs b/glean/glass/Glean/Glass/Search/Pp.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Pp.hs
@@ -0,0 +1,105 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ApplicativeDo, PartialTypeSignatures #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.Pp
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Glass.Search.Class
+import Glean.Angle as Angle
+import Glean.Glass.Query ( entityLocation )
+import Glean.Glass.Utils ( joinFragments )
+
+import qualified Glean.Schema.CodePp.Types as Pp
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Pp1.Types as Pp
+import qualified Glean.Schema.Src.Types as Src
+
+breakPathAndName :: [Text] -> Maybe (Path, Name)
+breakPathAndName [] = Nothing
+breakPathAndName [_name] = Nothing -- has to be a file and a name
+breakPathAndName toks@(_:_) = Just (Path path, Name name)
+  where
+    path = joinFragments (init toks)
+    name = last toks
+
+data Query
+  = Define !Path !Name
+  | Undef !Path !Name
+  | Include !Path
+
+newtype Path = Path Text
+newtype Name = Name Text
+
+instance Search (ResultLocation Pp.Entity) where
+  symbolSearch toks = case toks of
+    [] -> return $ None "PP.symbolSearch: empty"
+    [_] -> return $ None "PP.symbolSearch: singleton: not a symbolid"
+    base:rest -> case base of
+      "define" -> case breakPathAndName rest of
+        Nothing -> return $ None "Pp.symbolSearch: define: missing name"
+        Just (path, name) -> searchSymbolId toks $ runQuery (Define path name)
+      "undef"  -> case breakPathAndName rest of
+        Nothing -> return $ None "Pp.symbolSearch: undef: missing name"
+        Just (path, name) -> searchSymbolId toks $ runQuery (Undef path name)
+      _ -> searchSymbolId toks $ runQuery (Include (Path (joinFragments toks)))
+
+runQuery :: Query -> Angle (ResultLocation Pp.Entity)
+runQuery (Define path name) = searchDefine path name
+runQuery (Undef path name) = searchUndef path name
+runQuery (Include path) = searchInclude path
+
+searchDefine :: Path -> Name -> Angle (ResultLocation Pp.Entity)
+searchDefine (Path path) (Name name) =
+  vars $ \(entity :: Angle Pp.Entity) (file :: Angle Src.File)
+    (decl :: Angle Pp.Define) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      decl .= predicate @Pp.Define (
+        rec $
+          field @"macro" (string name) $
+          field @"source" (rec $ field @"file" (asPredicate file) end)
+        end),
+      alt @"define" (asPredicate decl) .= sig entity,
+      entityLocation (alt @"pp" entity) file rangespan lname
+    ]
+
+searchUndef :: Path -> Name -> Angle (ResultLocation Pp.Entity)
+searchUndef (Path path) (Name name) =
+  vars $ \(entity :: Angle Pp.Entity) (file :: Angle Src.File)
+    (decl :: Angle Pp.Undef) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      decl .= predicate @Pp.Undef (
+        rec $
+          field @"macro" (string name) $
+          field @"source" (rec $ field @"file" (asPredicate file) end)
+        end),
+      alt @"undef" (asPredicate decl) .= sig entity,
+      entityLocation (alt @"pp" entity) file rangespan lname
+    ]
+
+searchInclude :: Path -> Angle (ResultLocation Pp.Entity)
+searchInclude (Path path) =
+  vars $ \(entity :: Angle Pp.Entity) (file :: Angle Src.File)
+    (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (entity,file,rangespan,lname) `where_` [
+      file .= predicate @Src.File (string path),
+      wild .= predicate @Pp.Include ( -- asserts it is a member of pp.Include
+        rec $ field @"file" (asPredicate file) end),
+      alt @"include_" (asPredicate file) .= sig entity,
+      entityLocation (alt @"pp" entity) file rangespan lname
+    ]
diff --git a/glean/glass/Glean/Glass/Search/Python.hs b/glean/glass/Glean/Glass/Search/Python.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Python.hs
@@ -0,0 +1,81 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Search.Python
+  ( {- instances -}
+  ) where
+
+import Glean.Angle as Angle
+    ( AngleVars(vars),
+      AngleStatement,
+      Angle,
+      predicate,
+      where_,
+      (.=),
+      string,
+      stringPrefix,
+      tuple,
+      rec,
+      alt,
+      field,
+      end,
+      wild )
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodePython.Types as Py
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Python.Types as Py
+import qualified Glean.Schema.Src.Types as Src
+import Data.Text (Text)
+
+instance Search (ResultLocation Py.Entity) where
+  symbolSearch params =
+    fmap (mapResultLocation Py.Entity_decl) <$> symbolSearch params
+
+instance Search (ResultLocation Py.Declaration) where
+  symbolSearch t@[fqname] = searchSymbolId t $
+    findByFQName fqname Nothing
+  symbolSearch t@[loc, fqname] = searchSymbolId t $
+    findByFQName fqname (Just loc)
+  symbolSearch _ = return $
+    None "Python.symbolSearch: invalid query"
+
+findByFQName
+  :: Text -> Maybe Text
+  -> Angle (ResultLocation Py.Declaration)
+findByFQName = searchByFQName False
+
+searchByFQName
+  :: Bool -> Text -> Maybe Text
+  -> Angle (ResultLocation Py.Declaration)
+searchByFQName isPrefix fqname mloc =
+  vars $ \decl (file :: Angle Src.File) (rangespan :: Angle Code.RangeSpan)
+      (lname :: Angle Text) ->
+    tuple (decl, file, rangespan, lname) `where_` ([
+        wild .= predicate @Py.DeclarationWithName (
+          rec $
+              field @"name" (stringOrPrefix fqname) $
+              field @"declaration" decl
+          end),
+        entityLocation (alt @"python" (alt @"decl" decl)) file rangespan lname
+      ] <> location file)
+  where
+    location :: Angle Src.File -> [AngleStatement]
+    location file
+      | Just "." <- mloc
+      = []
+      | Just loc <- mloc
+      = [file .= predicate @Src.File (stringPrefix loc)]
+      | otherwise
+      = []
+    stringOrPrefix = if isPrefix then stringPrefix else string
diff --git a/glean/glass/Glean/Glass/Search/SCIP.hs b/glean/glass/Glean/Glass/Search/SCIP.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/SCIP.hs
@@ -0,0 +1,54 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.Search.SCIP
+  ( {- instances -}
+  ) where
+
+import Data.Text as Text ( Text )
+import qualified Data.Text as Text
+import Data.Coerce
+
+import Glean.Angle as Angle
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+
+import qualified Glean.Schema.CodeScip.Types as SCIP ( Entity(..) )
+import qualified Glean.Schema.Scip.Types as Scip
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+
+instance Search (ResultLocation SCIP.Entity) where
+  symbolSearch [] = return $ None "SCIP.symbolSearch: empty"
+  -- global symbols
+  symbolSearch toks = searchSymbolId toks $
+    searchBySymbol (Text.intercalate " " toks)
+
+searchBySymbol :: Text -> Angle (ResultLocation SCIP.Entity)
+searchBySymbol sym =
+  vars $ \(ent :: Angle Scip.Entity) (file :: Angle Src.File)
+    (symbol :: Angle Scip.Symbol)
+      (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (cast ent,file,rangespan,lname) `where_` [
+      symbol .= predicate @Scip.Symbol (string sym),
+      wild .= predicate @Scip.SearchBySymbol (
+        rec $
+          field @"symbol" (asPredicate symbol) $
+          field @"entity" ent
+        end),
+      entityLocation (alt @"scip" (cast ent)) file rangespan lname
+    ]
+
+-- we are coercing (silently) scip.Entity to code.scip.Entity
+-- We do this due to the file -> language tag conversion (see LSIF)
+cast :: Angle Scip.Entity -> Angle SCIP.Entity
+cast = coerce
diff --git a/glean/glass/Glean/Glass/Search/Thrift.hs b/glean/glass/Glean/Glass/Search/Thrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Search/Thrift.hs
@@ -0,0 +1,211 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
+
+module Glean.Glass.Search.Thrift
+  ( {- instances -}
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Angle as Angle
+    ( AngleVars(vars),
+      Angle,
+      predicate,
+      where_,
+      (.=),
+      string,
+      tuple,
+      rec,
+      alt,
+      field,
+      end,
+      wild,
+      asPredicate,
+      sig,
+      AngleStatement
+      )
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Query ( entityLocation )
+import Glean.Glass.Utils ( joinFragments )
+
+import Glean.Angle (Type)
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Fbthrift.Types as Thrift
+import qualified Glean.Schema.CodeFbthrift.Types as Thrift
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Haxl.Repos as Glean
+import Data.Typeable (Typeable)
+
+-- Depending on context (e.g. find-references or describe), we want to
+--  decode a symbol id into an entity with our without its location.
+--
+--  This module defines the corresponding Search instances and Angle queries
+
+instance Search (ResultLocation Thrift.Entity) where
+  symbolSearch toks =
+    fmap (mapResultLocation Thrift.Entity_decl) <$> symbolSearch toks
+
+instance Search Thrift.Entity where
+  symbolSearch toks = fmap Thrift.Entity_decl <$> symbolSearch toks
+
+instance Search (ResultLocation Thrift.Declaration) where
+  symbolSearch = symbolSearchGen searchQNameWithLoc searchThriftFileWithLoc
+    searchMemberDeclWithLoc
+
+instance Search Thrift.Declaration where
+  symbolSearch =
+    symbolSearchGen searchQName searchThriftFile searchMemberDecl
+
+-- Resolve symbol id tokens into an entity, with or without location.
+symbolSearchGen ::
+  (Typeable t, Show t, Type t, QueryRepos u)
+  => (Text -> Text -> Angle t)
+  -> (Text -> Angle t)
+  -> (Text -> Text -> Text -> Angle t)
+  -> [Text]
+  -> ReposHaxl u v (SearchResult t)
+symbolSearchGen searchQName searchThriftFile searchMemberDecl toks =
+  case toks of
+  [] -> return $ None "Thrift.symbolSearch: empty query"
+  _ -> case (init toks, last toks) of
+    (pieces, name) -> do
+      let path = joinFragments pieces
+      result <- searchSymbolId toks $ searchQName path name
+      case result of
+        None{} -> case (init pieces, last pieces) of
+          (morePieces, serviceName) -> do
+            let path = joinFragments morePieces
+            moreResult <-
+              searchSymbolId toks $ searchMemberDecl path serviceName name
+            case moreResult of
+              None{} ->
+                searchSymbolId toks $ searchThriftFile (joinFragments toks)
+              r -> return r
+        r -> return r
+
+thriftFileDecl
+  :: Text -> Angle Src.File -> Angle Thrift.File -> Angle Thrift.Declaration
+  -> [AngleStatement]
+thriftFileDecl path file thriftFile decl =
+    [
+      file .= predicate @Src.File (string path),
+      thriftFile .= predicate @Thrift.File file,
+      decl .= sig (alt @"include_"
+              (asPredicate thriftFile) :: Angle Thrift.Declaration)
+    ]
+
+searchThriftFileWithLoc :: Text -> Angle (ResultLocation Thrift.Declaration)
+searchThriftFileWithLoc path = vars $ \(file :: Angle Src.File)
+  (thriftFile :: Angle Thrift.File) (decl :: Angle Thrift.Declaration)
+       (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text) ->
+    tuple (decl, file, rangespan, lname) `where_` (
+    thriftFileDecl path file thriftFile decl ++ [
+      entityLocation (alt @"fbthrift" (alt @"decl" decl)) file rangespan lname
+    ])
+
+searchThriftFile :: Text -> Angle Thrift.Declaration
+searchThriftFile path = vars $ \(file :: Angle Src.File)
+  (thriftFile :: Angle Thrift.File) (decl :: Angle Thrift.Declaration) ->
+    decl `where_` thriftFileDecl path file thriftFile decl
+
+thriftMemberDecl
+  :: Text -> Text -> Text -> Angle Src.File -> Angle Thrift.File
+  -> Angle Thrift.QualName -> Angle Thrift.Identifier -> Angle Thrift.XRefTarget
+  -> [AngleStatement]
+thriftMemberDecl
+  path typename name file thriftFile qname thriftIdentifier decl =
+ [
+    file .= predicate @Src.File (string path),
+    thriftFile .= predicate @Thrift.File file,
+    thriftIdentifier .= predicate @Thrift.Identifier (string name),
+    qname .= predicate @Thrift.QualName (
+      rec $
+        field @"file" (asPredicate thriftFile) $
+        field @"name" (string typename)
+      end
+    ),
+    wild .= predicate @Thrift.DeclarationMember (
+      rec $
+        field @"qname" (asPredicate qname) $
+        field @"member" (asPredicate thriftIdentifier) $
+        field @"decl" decl
+      end)
+  ]
+
+-- Member lookup. This will find fields (struct, exception, union), enum values,
+-- and functions. They are uniquely indentified by a triple
+-- (path, typename, name)
+searchMemberDecl
+  :: Text -> Text -> Text -> Angle Thrift.Declaration
+searchMemberDecl path typename name =
+  vars $ \(file :: Angle Src.File) (qname :: Angle Thrift.QualName)
+     (thriftFile :: Angle Thrift.File) (identifier :: Angle Thrift.Identifier)
+     (decl :: Angle Thrift.Declaration) ->
+  decl `where_`
+    thriftMemberDecl path typename name file thriftFile qname identifier decl
+
+-- Same as searchMemberDecl but with location
+searchMemberDeclWithLoc
+  :: Text -> Text -> Text -> Angle (ResultLocation Thrift.Declaration)
+searchMemberDeclWithLoc path typename name =
+  vars $ \(file :: Angle Src.File)
+     (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+     (qname :: Angle Thrift.QualName)
+     (thriftFile :: Angle Thrift.File) (identifier :: Angle Thrift.Identifier)
+     (decl :: Angle Thrift.Declaration) ->
+
+  tuple (decl, file, rangespan, lname) `where_`
+  (thriftMemberDecl path typename name file thriftFile qname identifier decl
+  ++ [
+    entityLocation (alt @"fbthrift" (alt @"decl" decl)) file rangespan lname
+  ])
+
+qNameDecl
+  :: Text -> Text -> Angle Thrift.File -> Angle Thrift.QualName
+  -> Angle Src.File -> Angle Thrift.XRefTarget -> [AngleStatement]
+qNameDecl path name thriftFile qname file decl =
+  [ file .= predicate @Src.File (string path),
+  thriftFile .= predicate @Thrift.File file,
+  qname .= predicate @Thrift.QualName (
+    rec $
+      field @"file" (asPredicate thriftFile) $
+      field @"name" (string name)
+    end
+  ),
+  wild .= predicate @Thrift.DeclarationName (
+    rec $
+      field @"qname" (asPredicate qname) $
+      field @"decl" decl
+    end)]
+
+-- Entity lookup: this will find type declarations (union, struct,
+-- typedef), exceptions, constants and service names, which are uniquely
+-- identified by a qualified name (path, name)
+searchQName :: Text -> Text -> Angle Thrift.Declaration
+searchQName path name =
+  vars $ \(file :: Angle Src.File) (qname :: Angle Thrift.QualName)
+     (thriftFile :: Angle Thrift.File) (decl :: Angle Thrift.Declaration) ->
+  decl `where_` qNameDecl path name thriftFile qname file decl
+
+-- Same as searchQName but also get location
+searchQNameWithLoc :: Text -> Text -> Angle (ResultLocation Thrift.Declaration)
+searchQNameWithLoc path name =
+  vars $ \(file :: Angle Src.File)
+     (rangespan :: Angle Code.RangeSpan) (lname :: Angle Text)
+     (qname :: Angle Thrift.QualName)
+     (thriftFile :: Angle Thrift.File) (decl :: Angle Thrift.Declaration) ->
+
+  tuple (decl, file, rangespan, lname) `where_`
+    (qNameDecl path name thriftFile qname file decl ++ [
+    entityLocation (alt @"fbthrift" (alt @"decl" decl)) file rangespan lname
+  ])
diff --git a/glean/glass/Glean/Glass/SearchRelated.hs b/glean/glass/Glean/Glass/SearchRelated.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SearchRelated.hs
@@ -0,0 +1,325 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE DeriveAnyClass #-}
+{-# LANGUAGE DeriveGeneric #-}
+
+module Glean.Glass.SearchRelated
+  ( searchRelatedEntities
+  , searchInheritedEntities
+  , searchRecursiveEntities
+  , Recursive(..)
+  , SearchStyle(..)
+  , RelatedLocatedEntities(..)
+  , RelatedEntities(..)
+  , LocatedEntity
+  , InheritedContainer
+  , edgesToTopoMap
+  ) where
+
+import Control.Monad (forM)
+import Control.Monad.Catch (MonadThrow(throwM))
+import Data.Hashable ( Hashable(..) )
+import Data.HashSet ( HashSet )
+import Data.List (groupBy, sortOn)
+import Data.Function (on)
+import Data.HashMap.Strict ( HashMap )
+import qualified Data.HashMap.Strict as HM
+import GHC.Generics (Generic)
+import qualified Data.HashSet as HashSet
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+
+import Glean.Glass.Search.Class
+import Glean.Glass.Base (GleanPath (..))
+import Glean.Glass.Path
+import Glean.Glass.SymbolId (entityToAngle, toSymbolId)
+import Glean.Glass.Types
+import Glean.Glass.Utils (searchRecursiveWithLimit)
+import Glean.Haxl.Repos (RepoHaxl)
+
+-- | Whether to expand relationships recursively
+data Recursive
+  = Recursive
+  | NotRecursive
+  deriving Eq
+
+-- | Whether to hide uninteresting things
+data SearchStyle
+  = ShowAll
+  | HideUninteresting
+
+-- | Pairs of edges of related entities
+data RelatedEntities = RelatedEntities
+  { parentEntity :: !Code.Entity
+  , parentLocation :: {-# UNPACK #-}!Code.Location
+  , childEntity :: !Code.Entity
+  , childLocation :: {-# UNPACK #-}!Code.Location
+  } deriving (Eq,Generic,Hashable)
+
+-- | Pairs of edges of related entities, with all metadata
+data RelatedLocatedEntities = RelatedLocatedEntities
+  { parentRL :: LocatedEntity
+  , childRL :: LocatedEntity
+  } deriving (Generic,Eq,Hashable)
+
+type LocatedEntity = (ResultLocation Code.Entity, SymbolId)
+
+-- Convenience type for a parent with a set of contained children
+type InheritedContainer = (LocatedEntity, [LocatedEntity])
+
+styleToCode :: SearchStyle -> Code.SearchStyle
+styleToCode ShowAll = Code.SearchStyle_ShowAll
+styleToCode HideUninteresting = Code.SearchStyle_HideUninteresting
+
+-- | Flatten results into the container-level topological ordering
+-- from child to set of parents it inherits from.
+edgesToTopoMap
+  :: [RelatedLocatedEntities] -> HashMap SymbolId (HashSet SymbolId)
+edgesToTopoMap edges = HM.fromListWith HashSet.union
+  [ (snd (childRL e), HashSet.singleton (snd (parentRL e))) | e <- edges ]
+
+-- returns all inherited members in container entity as "RelatedEntity"
+-- parentEntity is the entity defining the member
+-- childEntity is the member itself
+runSearchInherited
+  :: SearchStyle
+  -> Int
+  -> Angle Code.Entity
+  -> RepoHaxl u w [RelatedEntities]
+runSearchInherited style limit angle = do
+  (entities, _truncated) <- searchRecursiveWithLimit (Just limit) $
+    query angle
+  pure $
+    [ RelatedEntities
+      { parentEntity = parentEntity_parent
+      , childEntity = childEntity_child
+      , parentLocation = parentEntity_location
+      , childLocation = childEntity_location
+      }
+    | (Code.ParentEntity{..}, Code.ChildEntity{..}) <- entities ]
+  where
+    styleTy = styleToCode style
+    query
+      :: Angle Code.Entity
+      -> Angle (Code.ParentEntity, Code.ChildEntity)
+    query entity =
+      vars $ \(parent :: Angle Code.ParentEntity)
+          (child :: Angle Code.ChildEntity) ->
+        tuple (parent, child) `where_` [
+          wild .= predicate @Code.SearchInheritedEntities (
+            rec $
+              field @"base" entity $
+              field @"parent" parent $
+              field @"child" child $
+              field @"style" (enum styleTy)
+            end)
+          ]
+
+-- returns all inherited members in container entity
+-- grouped by parentEntity
+searchInheritedEntities
+  :: SearchStyle
+  -> Int
+  -> Code.Entity
+  -> RepoName
+  -> RepoHaxl u w [InheritedContainer]
+searchInheritedEntities style limit entity repo = do
+  angle <- case entityToAngle entity of
+        Right angle -> return angle
+        Left t -> throwM (ServerException t)
+  relatedEntities <- runSearchInherited style limit angle >>= toSymbolIds repo
+  return $ groupChildEntities relatedEntities
+  where
+    groupChildEntities :: [RelatedLocatedEntities] -> [InheritedContainer]
+    groupChildEntities xs =
+      map (\g -> (parentRL (head g), map childRL g)) grouped
+      where
+        sorted = sortOn parentRL xs
+        grouped = groupBy ((==) `on` parentRL) sorted
+
+--
+-- Given some search parameters, find entities by relation
+--
+searchRelatedEntities
+  :: Int
+  -> SearchStyle
+  -> Recursive
+  -> RelationDirection
+  -> RelationType
+  -> Code.Entity
+  -> RepoName
+  -> RepoHaxl u w [RelatedLocatedEntities]
+searchRelatedEntities limit hide recurse dir rel entity repo =
+  toSymbolIds repo =<< searchRelation opts limit [entity] HashSet.empty
+  where
+    opts = SearchOptions limit hide recurse rel dir
+
+-- | For internal searches, we don't need the symbol id. So we can be slightly
+-- more efficient. TODO: we could also avoid the location in the result entirely
+-- used for lucky search/context resolution
+searchRecursiveEntities
+  :: Int -> RelationDirection -> RelationType -> Code.Entity
+  -> RepoHaxl u w [RelatedEntities]
+searchRecursiveEntities limit dir rel entity =
+    searchRelation opts limit [entity] HashSet.empty
+  where
+    opts = SearchOptions limit ShowAll Recursive rel dir
+
+-- | Lift entity search results into pairs of entities that we found,
+-- along with their location and symbol id
+--
+-- TODO: we will be recomputing these for some symbols many times,
+-- and in some cases we are dropping them as well. Can we defer this until
+-- later?
+--
+toSymbolIds
+  :: RepoName -> [RelatedEntities] -> RepoHaxl u w [RelatedLocatedEntities]
+toSymbolIds repo edges = mapM locatePairs edges
+  where
+    locatePairs RelatedEntities{..} = RelatedLocatedEntities
+      <$> mkLocate parentEntity parentLocation
+      <*> mkLocate childEntity childLocation
+    mkLocate entity Code.Location{..} = do
+      symId <- symbol entity location_file
+      return ((entity,location_file,location_location,location_name), symId)
+    symbol entity file = do
+      path <- GleanPath <$> Glean.keyOf file
+      toSymbolId (fromGleanPath repo path) entity
+
+-- | Constants to determine how we search
+data SearchOptions = SearchOptions {
+  totalLimit :: Int,
+  style :: SearchStyle,
+  recursive :: Recursive,
+  relation :: RelationType,
+  direction :: RelationDirection
+}
+
+--
+-- Search driver, expand search until done, returning pairs of edges
+-- of entity relationships.
+--
+searchRelation
+  :: SearchOptions
+  -> Int
+  -> [Code.Entity]
+  -> HashSet RelatedEntities
+  -> RepoHaxl u w [RelatedEntities]
+searchRelation opts@SearchOptions{..} limit toVisit visited =
+    runSearch searchFn opts limit toVisit visited
+  where
+    -- the search flavor is known up front, so we can partially apply
+    baseSearchFn = \ty angle -> runSearchRelated totalLimit style angle ty
+    searchFn = case (relation, direction) of
+      (RelationType_Extends, RelationDirection_Parent) ->
+        baseSearchFn Code.RelationType_ExtendsParentOfChild
+      (RelationType_Extends, RelationDirection_Child) ->
+        baseSearchFn Code.RelationType_ExtendsChildOfParent
+      (RelationType_Contains, RelationDirection_Parent) ->
+        baseSearchFn Code.RelationType_ContainsParentOfChild
+      (RelationType_Contains, RelationDirection_Child) ->
+        baseSearchFn Code.RelationType_ContainsChildOfParent
+      (RelationType_RequireExtends, RelationDirection_Parent) ->
+        baseSearchFn Code.RelationType_RequireExtendsParentOfChild
+      (RelationType_RequireImplements, RelationDirection_Parent) ->
+        baseSearchFn Code.RelationType_RequireImplementsParentOfChild
+      (RelationType_RequireClass, RelationDirection_Parent) ->
+        baseSearchFn Code.RelationType_RequireClassParentOfChild
+      _ -> \_angle -> pure []
+
+-- recursively search up to limit
+runSearch
+  :: ([Angle Code.Entity] -> RepoHaxl u w [RelatedEntities])
+  -> SearchOptions
+  -> Int
+  -> [Code.Entity]
+  -> HashSet RelatedEntities
+  -> RepoHaxl u w [RelatedEntities]
+runSearch searchFn opts@SearchOptions{..} !limit toVisit visited = do
+  angle <- forM toVisit $ \entity ->
+    case entityToAngle entity of
+      Right angle -> return angle
+      Left t -> throwM (ServerException t)
+  justVisited <- searchFn angle
+  let newlyVisited = HashSet.fromList justVisited `HashSet.difference` visited
+      visited' = visited `HashSet.union` newlyVisited
+      toVisit = HashSet.toList $ case direction of
+        RelationDirection_Parent -> HashSet.map parentEntity newlyVisited
+        RelationDirection_Child -> HashSet.map childEntity newlyVisited
+        _ -> HashSet.empty -- unknown direction
+      recLimit = limit - length visited'
+  if
+    recursive == Recursive && recLimit > 0 && recLimit < limit &&
+    not (null toVisit)
+  then
+    runSearch searchFn opts recLimit toVisit visited'
+  else
+    return $! HashSet.toList visited'
+
+runSearchRelated
+  :: Int
+  -> SearchStyle
+  -> [Angle Code.Entity]
+  -> Code.RelationType
+  -> RepoHaxl u w [RelatedEntities]
+runSearchRelated limit style angle searchType = do
+  (entities, _truncated) <- searchRecursiveWithLimit (Just limit) $
+    searchRelatedEntitiesQ searchType styleType entities
+  pure $
+    [ RelatedEntities
+      { parentEntity = parentEntity_parent
+      , childEntity = childEntity_child
+      , parentLocation = parentEntity_location
+      , childLocation = childEntity_location
+      }
+    | Code.SearchRelatedEntities{..} <- entities
+    , Just Code.SearchRelatedEntities_key{..} <- [searchRelatedEntities_key]
+    , let Code.ParentEntity{..} = searchRelatedEntities_key_parent
+    , let Code.ChildEntity{..} = searchRelatedEntities_key_child
+    ]
+  where
+    entities = elementsOf (array angle)
+    styleType = styleToCode style
+
+--
+-- unified search by relation
+--
+searchRelatedEntitiesQ
+  :: Code.RelationType
+  -> Code.SearchStyle
+  -> Angle Code.Entity
+  -> Angle Code.SearchRelatedEntities
+searchRelatedEntitiesQ queryTy styleTy entity = case queryTy of
+    Code.RelationType_ExtendsParentOfChild -> keyedByChild
+    Code.RelationType_ContainsParentOfChild -> keyedByChild
+    Code.RelationType_ExtendsChildOfParent -> keyedByParent
+    Code.RelationType_ContainsChildOfParent -> keyedByParent
+    Code.RelationType_RequireClassParentOfChild -> keyedByChild
+    Code.RelationType_RequireImplementsParentOfChild -> keyedByChild
+    Code.RelationType_RequireExtendsParentOfChild -> keyedByChild
+    Code.RelationType__UNKNOWN _ -> error "Unkonwn Code.RelationType"
+  where
+    keyedByChild = predicate @Code.SearchRelatedEntities $
+      rec $ -- bind to child entity
+        field @"query" (enum queryTy) $
+        field @"style" (enum styleTy) $
+        field @"child" (rec $ field @"child" entity end)
+      end
+    keyedByParent = predicate @Code.SearchRelatedEntities $
+      rec $ -- search by parent entities
+        field @"query" (enum queryTy) $
+        field @"style" (enum styleTy) $
+        field @"parent" (rec $ field @"parent" entity end)
+      end
diff --git a/glean/glass/Glean/Glass/SnapshotBackend.hs b/glean/glass/Glean/Glass/SnapshotBackend.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SnapshotBackend.hs
@@ -0,0 +1,72 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+A snapshot backend is a DB in which we store precomputed results
+of some Glass queries. This isn't implemented yet in the open source version
+of Glass
+-}
+
+module Glean.Glass.SnapshotBackend
+  ( SnapshotBackend(..)
+  , SnapshotStatus(..)
+  , snapshotBackendParser
+  , NilSnapshotBackend(..)
+  ) where
+
+import Data.Text ( Text )
+import Options.Applicative
+    ( Parser, auto, help, long, option, value )
+
+import qualified Glean.Glass.Types as Types
+import Glean.Util.Some (Some(..))
+import Glean.Glass.SourceControl (ScmGeneration)
+import Glean.Glass.Types (
+      Revision,
+      Path,
+      RepoName(..),
+      Path (..) )
+import Glean.Glass.Tracing (GlassTracer)
+
+class SnapshotBackend backend where
+  getSnapshot
+    :: GlassTracer
+    -> backend
+    -> RepoName
+    -> Path
+    -> Maybe Revision
+    -> Maybe ScmGeneration
+    -> IO (Either SnapshotStatus (Revision, IO (Maybe Types.DocumentSymbolListXResult)))
+
+instance SnapshotBackend (Some SnapshotBackend) where
+  getSnapshot t (Some backend) = getSnapshot t backend
+
+data SnapshotStatus
+  = Unrequested
+  | DbError
+  | InternalError
+  | Timeout
+  | NotFound
+  | ExactMatch
+  | CompatibleMatch
+  | Ignored
+  | Latest
+  deriving Show
+
+-- | Always produces the 'NilSnapshotBackend'
+snapshotBackendParser :: Parser (Some SnapshotBackend)
+snapshotBackendParser = Some NilSnapshotBackend <$ (option auto (mconcat
+  [ long "snapshot-tier-name"
+  , help "snapshot tier name (unused)"
+  , value "unused"
+  ]) :: Parser Text)
+
+data NilSnapshotBackend = NilSnapshotBackend
+
+instance SnapshotBackend NilSnapshotBackend where
+  getSnapshot _ _ _ _ _ _ = return $ Left Unrequested
diff --git a/glean/glass/Glean/Glass/SourceControl.hs b/glean/glass/Glean/Glass/SourceControl.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SourceControl.hs
@@ -0,0 +1,68 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.SourceControl (
+    SourceControl(..),
+    ScmGeneration(..),
+    NilSourceControl(..),
+    ContentHash(..),
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.Hashable
+import Data.Int
+
+import Glean.Glass.Types
+import Glean.Util.Some
+import Glean.Haxl.Repos
+import Data.Text (Text)
+
+-- | Source control generation, used for ordering revisions
+newtype ScmGeneration = ScmGeneration Int64
+  deriving (Eq, Hashable, Ord, Show)
+
+newtype ContentHash = ContentHash ByteString
+  deriving (Eq, Hashable, Ord, Show)
+
+-- | Interface to source control operations
+class SourceControl scm where
+  -- | Retrieve the generation number for a revision, i.e. the number
+  -- of commits between the given revision and the root of the repository.
+  getGeneration :: scm -> RepoName -> Revision -> IO (Maybe ScmGeneration)
+
+  -- | Retrieve a content hash for the given file, if the file exists
+  -- in the repository at the given revision.
+  getFileContentHash
+    :: scm -> RepoName -> Path -> Revision -> RepoHaxl u w (Maybe ContentHash)
+
+  getFileLineDiff
+    :: scm -> RepoName -> Path -> Revision -> Revision -> RepoHaxl u w (Maybe Text)
+
+  -- | Check if the given branch is reachable (descendant)
+  -- from a given revision. In case of a failure,
+  -- returns False and logs an error.
+  isDescendantBranch
+    :: scm
+    -> RepoName
+    -> Revision
+    -> Text
+    -> IO Bool
+
+data NilSourceControl = NilSourceControl
+
+instance SourceControl NilSourceControl where
+  getGeneration _ _ _ = return Nothing
+  getFileContentHash _ _ _ _ = return Nothing
+  isDescendantBranch _ _ _ _ = return False
+  getFileLineDiff _ _ _ _ _ = return Nothing
+
+instance SourceControl (Some SourceControl) where
+  getGeneration (Some scm) = getGeneration scm
+  getFileContentHash (Some scm) = getFileContentHash scm
+  isDescendantBranch (Some scm) = isDescendantBranch scm
+  getFileLineDiff (Some scm) = getFileLineDiff scm
diff --git a/glean/glass/Glean/Glass/SymbolId.hs b/glean/glass/Glean/Glass/SymbolId.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId.hs
@@ -0,0 +1,457 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId
+  (
+    -- * introduction
+    toSymbolId
+
+    -- * elimination
+  , symbolTokens
+
+  -- * the language an entity is contained within
+  , entityLanguage
+  , entityDefinitionType
+  , entityKind
+  , languageToCodeLang
+  , languageExpandCpp
+
+  -- * Lookups and language names
+  , toShortCode
+  , fromShortCode
+
+  -- * searching for entities
+  , entityToAngle
+
+  -- * Qualified names
+  , toQualifiedName
+  , toSymbolLocalName
+  , toSymbolQualifiedContainer
+
+  -- reexports
+  , SymbolRepoPath(..)
+
+  ,nativeSymbol) where
+
+import Control.Monad.Catch ( throwM, try )
+import Data.Maybe ( fromMaybe )
+import Data.Tuple ( swap )
+import Util.Text ( textShow )
+import Data.Text ( Text )
+import qualified Data.Map as Map
+import qualified Data.Text as Text
+import qualified Network.URI.Encode as URI
+
+import Glean.Glass.Base (SymbolRepoPath(..))
+import Glean.Glass.Types as Glass
+    ( DefinitionKind(DefinitionKind_Definition),
+      SymbolKind,
+      QualifiedName(..),
+      Language(..),
+      SymbolId(SymbolId),
+      RepoName(..),
+      Name, )
+
+import Glean.Angle ( alt, Angle )
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Util.ToAngle ( ToAngle(toAngle) )
+
+import Glean.Glass.SymbolId.Class
+    ( Symbol(..),
+      SymbolError(SymbolError),
+      ToQName(..),
+      ToSymbolParent(..),
+      ToNativeSymbol(..) )
+import Glean.Glass.SymbolId.Angle ({- instances -})
+import Glean.Glass.SymbolId.Buck ({- instances -})
+import Glean.Glass.SymbolId.Cxx ({- instances -})
+import Glean.Glass.SymbolId.Erlang ({- instances -})
+import Glean.Glass.SymbolId.Fbthrift ({- instances -})
+import Glean.Glass.SymbolId.Flow ({- instances -})
+import Glean.Glass.SymbolId.GraphQL ({- instances -})
+import Glean.Glass.SymbolId.Hack ({- instances -})
+import Glean.Glass.SymbolId.Hs ({- instances -})
+import Glean.Glass.SymbolId.Java ({- instances -})
+import Glean.Glass.SymbolId.LSIF ({- instances -})
+import Glean.Glass.SymbolId.Pp ({- instances -})
+import Glean.Glass.SymbolId.Python ({- instances -})
+import Glean.Glass.SymbolId.SCIP ({- instances -})
+import Glean.Glass.SymbolId.CSharp ({- instances -})
+
+import qualified Glean.Glass.SymbolId.Cxx as Cxx
+import qualified Glean.Glass.SymbolId.Pp as Pp
+
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodeLsif.Types as Lsif
+import qualified Glean.Schema.CodeScip.Types as Scip
+
+import Glean.Schema.CodeErlang.Types as Erlang ( Entity(Entity_decl) )
+import Glean.Schema.CodeHack.Types as Hack ( Entity(Entity_decl) )
+import Glean.Schema.CodeJava.Types as Java ( Entity(Entity_decl) )
+import Glean.Schema.CodeKotlin.Types as Kotlin ( Entity(Entity_decl) )
+import Glean.Schema.CodePython.Types as Python ( Entity(Entity_decl) )
+import Glean.Schema.CodeFbthrift.Types as Fbthrift ( Entity(Entity_decl) )
+import Glean.Schema.CodeCsharp.Types as CSharp ( Entity(Entity_decl) )
+
+-- Introduce a SymbolId. This is essentially the semantic "path to this symbol
+-- in the Codex style. www/php/Glean/getLatestRepo
+--
+-- If we can't encode the entity, it is still useful to return the path and
+-- file, as this is enough to navigate with.
+--
+-- Symbol IDs have 3 parts:
+--
+-- - scm repo (corpus in biggrep term), e.g. "fbsource"
+-- - language short code (e.g py or php or cpp)
+-- - entity encoding
+--
+-- We uri encode the pieces and separate with / so they look like nice urls
+--
+toSymbolId :: SymbolRepoPath -> Code.Entity -> Glean.RepoHaxl u w SymbolId
+toSymbolId path entity = do
+  let langCode = toShortCode (entityLanguage entity)
+  eqname <- try $ toSymbolWithPath entity (symbolPath path)
+  return $ case eqname of
+    Left (SymbolError _e) -> symbol [repo, langCode, "SYMBOL_ID_MISSING"]
+    Right spec -> symbol $ repo : langCode :
+      map (URI.encodeTextWith isAllowed) spec
+  where
+    symbol = SymbolId . Text.intercalate "/"
+    Glass.RepoName repo = symbolRepo path
+
+    -- for readability, we permit these control chars in the symbol id uri
+    isAllowed ':' = True
+    isAllowed '+' = True
+    isAllowed ',' = True
+    isAllowed '*' = True
+    isAllowed '[' = True
+    isAllowed ']' = True
+    isAllowed c = URI.isAllowed c
+
+--
+-- For entity descriptions, we use toQualifiedName to extract some info
+-- about the namespace or scope of the entity
+--
+toQualifiedName :: Code.Entity -> Glean.RepoHaxl u w (Either Text QualifiedName)
+toQualifiedName entity = do
+  qname <- toQName entity
+  return $ case qname of
+    Right (qualifiedName_localName, qualifiedName_container) ->
+      Right QualifiedName {..}
+    Left e -> Left $ "QualifiedName: " <> e
+
+
+toSymbolLocalName :: Code.Entity -> Glean.RepoHaxl u w (Maybe Name)
+toSymbolLocalName entity = do
+  qname <- toQName entity
+  return $ case qname of
+    Right (qualifiedName_localName, _) -> Just qualifiedName_localName
+    Left _ -> Nothing
+
+toSymbolQualifiedContainer :: Code.Entity -> Glean.RepoHaxl u w (Maybe Name)
+toSymbolQualifiedContainer entity = do
+  qname <- toQName entity
+  return $ case qname of
+    Right (_, qualifiedName_container) -> Just qualifiedName_container
+    Left _ -> Nothing
+
+-- | Tokenize a symbol (inverse of the intercalate "/")
+-- Leaves the path/qname/syms for further search.
+symbolTokens :: SymbolId -> Either Text (RepoName, Language, [Text])
+symbolTokens (SymbolId symid)
+  | (repo: code: pieces) <- tokens
+  , Just lang <- fromShortCode code
+  = Right (RepoName repo, lang, map URI.decodeText pieces)
+  | otherwise = Left $ "Invalid symbol: " <> symid
+  where
+    tokens = Text.split (=='/') symid
+
+-- | SymbolID-encoded language, used for db name lookups
+shortCodeTable :: [(Language,Text)]
+shortCodeTable =
+  [ (Language_Angle , "angle")
+  , (Language_Buck , "buck")
+  , (Language_CSharp, "cs")
+  , (Language_Cpp, "cpp")
+  , (Language_Dataswarm, "dataswarm")
+  , (Language_Erlang , "erl")
+  , (Language_Go , "go")
+  , (Language_GraphQL, "graphql")
+  , (Language_Hack, "php")
+  , (Language_Haskell, "hs")
+  , (Language_Java , "java")
+  , (Language_JavaScript, "js")
+  , (Language_Kotlin , "kotlin")
+  , (Language_PreProcessor , "pp")
+  , (Language_Python, "py")
+  , (Language_Rust , "rs")
+  , (Language_Swift , "swift")
+  , (Language_Thrift , "thrift")
+  , (Language_TypeScript , "ts")
+  ]
+
+languageToCode :: Map.Map Language Text
+languageToCode = Map.fromList shortCodeTable
+
+codeToLanguage :: Map.Map Text Language
+codeToLanguage = Map.fromList (map swap shortCodeTable)
+
+-- | Symbol identifier to use when we don't support symbol identifiers
+unsupportedSymbol :: Text
+unsupportedSymbol = "UNSUPPORTED_LANGUAGE"
+
+-- | Language to canonical shortcode in symbol
+toShortCode :: Language -> Text
+toShortCode lang = fromMaybe unsupportedSymbol
+  (Map.lookup lang languageToCode)
+
+fromShortCode :: Text -> Maybe Language
+fromShortCode code = Map.lookup code codeToLanguage
+
+-- | The language is the outermost tag of the code.Entity constructor
+entityLanguage :: Code.Entity -> Language
+entityLanguage e = case e of
+  Code.Entity_angle{} -> Language_Angle
+  Code.Entity_buck{} -> Language_Buck
+  Code.Entity_csharp{} -> Language_CSharp
+  Code.Entity_cxx{} -> Language_Cpp
+  Code.Entity_erlang{} -> Language_Erlang
+  Code.Entity_dataswarm{} -> Language_Dataswarm
+  Code.Entity_fbthrift{} -> Language_Thrift
+  Code.Entity_flow{} -> Language_JavaScript
+  Code.Entity_graphql{} -> Language_GraphQL
+  Code.Entity_hack{} -> Language_Hack
+  Code.Entity_hs{} -> Language_Haskell
+  Code.Entity_java{} -> Language_Java
+  Code.Entity_kotlin{} -> Language_Kotlin
+  Code.Entity_pp{} -> Language_PreProcessor
+  Code.Entity_python{} -> Language_Python
+  -- lsif languages
+  Code.Entity_lsif Lsif.Entity_go{} -> Language_Go
+  Code.Entity_lsif Lsif.Entity_typescript{} -> Language_TypeScript
+  Code.Entity_lsif Lsif.Entity_rust{} -> Language_Rust
+  Code.Entity_lsif _ -> Language__UNKNOWN 0
+  -- scip languages
+  Code.Entity_scip Scip.Entity_rust{} -> Language_Rust
+  Code.Entity_scip Scip.Entity_go{} -> Language_Go
+  Code.Entity_scip Scip.Entity_typescript{} -> Language_TypeScript
+  Code.Entity_scip Scip.Entity_java{} -> Language_Java
+  Code.Entity_scip Scip.Entity_kotlin{} -> Language_Kotlin
+  Code.Entity_scip Scip.Entity_swift{} -> Language_Swift
+  Code.Entity_scip _ -> Language__UNKNOWN 0
+  Code.Entity_EMPTY -> Language__UNKNOWN 0
+
+-- | Map the user-visible glass.thrift Language enum to the internal Glean
+-- language id. This can be used for optional filtering in search.
+languageToCodeLang :: Language -> Maybe Code.Language
+languageToCodeLang l = case l of
+  Language_Angle -> Just Code.Language_Angle
+  Language_Buck -> Just Code.Language_Buck
+  Language_CSharp -> Just Code.Language_CSharp
+  Language_Cpp -> Just Code.Language_Cpp
+  Language_Dataswarm -> Just Code.Language_Dataswarm
+  Language_Erlang -> Just Code.Language_Erlang
+  Language_Go -> Just Code.Language_Go
+  Language_GraphQL -> Just Code.Language_GraphQL
+  Language_Hack -> Just Code.Language_Hack
+  Language_Haskell -> Just Code.Language_Haskell
+  Language_Java -> Just Code.Language_Java
+  Language_JavaScript -> Just Code.Language_JavaScript
+  Language_Kotlin -> Just Code.Language_Kotlin
+  Language_ObjectiveC -> Just Code.Language_Cpp -- we don't distinguish these
+  Language_PreProcessor -> Just Code.Language_PreProcessor
+  Language_Python -> Just Code.Language_Python
+  Language_Rust -> Just Code.Language_Rust
+  Language_Swift -> Just Code.Language_Swift
+  Language_Thrift -> Just Code.Language_Thrift
+  Language_TypeScript -> Just Code.Language_TypeScript
+  Language_Yaml -> Just Code.Language_Yaml
+  Language__UNKNOWN{} -> Nothing
+
+-- | Search queries for C++ should always imply the PreProcessor too
+languageExpandCpp :: [Code.Language] -> [Code.Language]
+languageExpandCpp [] = []
+languageExpandCpp (Code.Language_Cpp : rest) = Code.Language_Cpp :
+  Code.Language_PreProcessor : rest
+languageExpandCpp (lang : rest) = lang : languageExpandCpp rest
+
+-- | An encoded Entity.
+--
+-- e.g. Glean/getRepoName -- method
+--      GleanRecursive   -- enum
+--
+instance Symbol Code.Entity where
+  toSymbol _ = throwM $ SymbolError "Code.Entity: use toSymbolWithPath"
+
+  toSymbolWithPath e p = case e of
+    Code.Entity_angle x -> toSymbolWithPath x p
+    Code.Entity_hack (Hack.Entity_decl x) -> toSymbolWithPath x p
+    Code.Entity_python (Python.Entity_decl x) -> toSymbolWithPath x p
+    Code.Entity_flow x -> toSymbolWithPath x p
+    Code.Entity_csharp x -> toSymbolWithPath x p
+    Code.Entity_cxx x -> toSymbolWithPath x p
+    Code.Entity_buck x -> toSymbolWithPath x p
+    Code.Entity_erlang x -> toSymbolWithPath x p
+    Code.Entity_graphql x -> toSymbolWithPath x p
+    Code.Entity_hs x -> toSymbolWithPath x p
+    Code.Entity_java x -> toSymbolWithPath x p
+    Code.Entity_kotlin x -> toSymbolWithPath x p
+    Code.Entity_pp x -> toSymbolWithPath x p
+    Code.Entity_fbthrift (Fbthrift.Entity_decl x) -> toSymbolWithPath x p
+    Code.Entity_lsif ent -> case ent of -- enumerate all variants for lsif
+      Lsif.Entity_erlang se -> toSymbolWithPath se p
+      Lsif.Entity_fsharp se -> toSymbolWithPath se p
+      Lsif.Entity_go se -> toSymbolWithPath se p
+      Lsif.Entity_haskell se -> toSymbolWithPath se p
+      Lsif.Entity_java se -> toSymbolWithPath se p
+      Lsif.Entity_kotlin se -> toSymbolWithPath se p
+      Lsif.Entity_ocaml se -> toSymbolWithPath se p
+      Lsif.Entity_python se -> toSymbolWithPath se p
+      Lsif.Entity_rust se -> toSymbolWithPath se p
+      Lsif.Entity_scala se -> toSymbolWithPath se p
+      Lsif.Entity_swift se -> toSymbolWithPath se p
+      Lsif.Entity_typescript se -> toSymbolWithPath se p
+      Lsif.Entity_EMPTY -> throwM $ SymbolError "Unknown LSIF language"
+
+    Code.Entity_scip ent -> case ent of
+      Scip.Entity_rust se -> toSymbolWithPath se p
+      Scip.Entity_go se -> toSymbolWithPath se p
+      Scip.Entity_typescript se -> toSymbolWithPath se p
+      Scip.Entity_java se -> toSymbolWithPath se p
+      Scip.Entity_kotlin se -> toSymbolWithPath se p
+      Scip.Entity_swift se -> toSymbolWithPath se p
+      Scip.Entity_EMPTY -> throwM $ SymbolError "Unknown SCIP language"
+
+    _ -> throwM $ SymbolError "Language not supported"
+
+-- | Top level with error handler, to catch attempts to query
+-- languages we don't support
+entityToAngle :: Code.Entity -> Either Text (Angle Code.Entity)
+entityToAngle e = case e of
+  Code.Entity_angle x -> Right $
+    alt @"angle" (toAngle x)
+  Code.Entity_hack (Hack.Entity_decl x) -> Right $
+    alt @"hack" (alt @"decl" (toAngle x))
+  Code.Entity_python (Python.Entity_decl x) -> Right $
+    alt @"python" (alt @"decl" (toAngle x))
+  Code.Entity_flow x -> Right $
+    alt @"flow" (toAngle x)
+  Code.Entity_cxx x -> Right $
+    alt @"cxx" (toAngle x)
+  Code.Entity_pp x -> Right $
+    alt @"pp" (toAngle x)
+  Code.Entity_hs x -> Right $
+    alt @"hs" (toAngle x)
+  Code.Entity_erlang (Erlang.Entity_decl x) -> Right $
+    alt @"erlang" (alt @"decl" (toAngle x))
+  Code.Entity_graphql x -> Right $
+    alt @"graphql" (toAngle x)
+  Code.Entity_buck x -> Right $
+    alt @"buck" (toAngle x)
+  Code.Entity_java (Java.Entity_decl x) -> Right $
+    alt @"java" (alt @"decl" (toAngle x))
+  Code.Entity_kotlin (Kotlin.Entity_decl x) -> Right $
+    alt @"kotlin" (alt @"decl" (toAngle x))
+  Code.Entity_fbthrift (Fbthrift.Entity_decl x) -> Right $
+    alt @"fbthrift" (alt @"decl" (toAngle x))
+  Code.Entity_csharp (CSharp.Entity_decl x) -> Right $
+    alt @"csharp" (alt @"decl" (toAngle x))
+  -- lsif languages, enumerate all lang constructors
+  Code.Entity_lsif se -> alt @"lsif" <$> case se of
+      Lsif.Entity_erlang x -> Right $ alt @"erlang" (toAngle x)
+      Lsif.Entity_fsharp x -> Right $ alt @"fsharp" (toAngle x)
+      Lsif.Entity_go x -> Right $ alt @"go" (toAngle x)
+      Lsif.Entity_haskell x -> Right $ alt @"haskell" (toAngle x)
+      Lsif.Entity_java x -> Right $ alt @"java" (toAngle x)
+      Lsif.Entity_kotlin x -> Right $ alt @"kotlin" (toAngle x)
+      Lsif.Entity_ocaml x -> Right $ alt @"ocaml" (toAngle x)
+      Lsif.Entity_python x -> Right $ alt @"python" (toAngle x)
+      Lsif.Entity_rust x -> Right $ alt @"rust" (toAngle x)
+      Lsif.Entity_scala x -> Right $ alt @"scala" (toAngle x)
+      Lsif.Entity_swift x -> Right $ alt @"swift" (toAngle x)
+      Lsif.Entity_typescript x -> Right $ alt @"typescript" (toAngle x)
+      Lsif.Entity_EMPTY -> Left "toAngle: Unknown LSIF language"
+  -- scip anguages, enumerate all lang constructors
+  Code.Entity_scip se -> alt @"scip" <$> case se of
+      Scip.Entity_rust x -> Right $ alt @"rust" (toAngle x)
+      Scip.Entity_go x -> Right $ alt @"go" (toAngle x)
+      Scip.Entity_typescript x -> Right $ alt @"typescript" (toAngle x)
+      Scip.Entity_java x -> Right $ alt @"java" (toAngle x)
+      Scip.Entity_kotlin x -> Right $ alt @"kotlin" (toAngle x)
+      Scip.Entity_swift x -> Right $ alt @"swift" (toAngle x)
+      Scip.Entity_EMPTY -> Left "toAngle: Unknown SCIP language"
+
+  _ -> Left $
+    "ToAngle: Unsupported language: " <> toShortCode (entityLanguage e)
+
+instance ToQName Code.Entity where
+  toQName e = case e of
+    Code.Entity_angle x -> toQName x
+    Code.Entity_buck x -> toQName x
+    Code.Entity_csharp x -> toQName x
+    Code.Entity_cxx x -> toQName x
+    Code.Entity_erlang x -> toQName x
+    Code.Entity_fbthrift (Fbthrift.Entity_decl x) -> toQName x
+    Code.Entity_flow x -> toQName x
+    Code.Entity_graphql x -> toQName x
+    Code.Entity_hack (Hack.Entity_decl x) -> toQName x
+    Code.Entity_hs x -> toQName x
+    Code.Entity_java x -> toQName x
+    Code.Entity_kotlin x -> toQName x
+    Code.Entity_pp x -> toQName x
+    Code.Entity_python (Python.Entity_decl x) -> toQName x
+    Code.Entity_lsif se -> case se of -- enumerate all cases for lsif
+      Lsif.Entity_erlang x -> toQName x
+      Lsif.Entity_fsharp x -> toQName x
+      Lsif.Entity_go x -> toQName x
+      Lsif.Entity_haskell x -> toQName x
+      Lsif.Entity_java x -> toQName x
+      Lsif.Entity_kotlin x -> toQName x
+      Lsif.Entity_ocaml x -> toQName x
+      Lsif.Entity_python x -> toQName x
+      Lsif.Entity_rust x -> toQName x
+      Lsif.Entity_scala x -> toQName x
+      Lsif.Entity_swift x -> toQName x
+      Lsif.Entity_typescript x -> toQName x
+      Lsif.Entity_EMPTY -> pure $ Left "LSIF: language unsupported"
+    Code.Entity_scip se -> case se of -- enumerate all cases for lsif
+      Scip.Entity_rust x -> toQName x
+      Scip.Entity_go x -> toQName x
+      Scip.Entity_typescript x -> toQName x
+      Scip.Entity_java x -> toQName x
+      Scip.Entity_kotlin x -> toQName x
+      Scip.Entity_swift x -> toQName x
+      Scip.Entity_EMPTY -> pure $ Left "SCIP: language unsupported"
+    _ -> pure $ Left ("Language unsupported: " <> textShow (entityLanguage e))
+
+instance ToSymbolParent Code.Entity where
+  toSymbolParent e = case e of
+    Code.Entity_cxx x -> toSymbolParent x
+    Code.Entity_pp{} -> return Nothing
+    _ -> return Nothing
+
+
+-- | Attribute for definition/declaration distinction
+entityDefinitionType :: Code.Entity -> Maybe Glass.DefinitionKind
+entityDefinitionType (Code.Entity_cxx e) = Just (Cxx.cxxEntityDefinitionType e)
+entityDefinitionType Code.Entity_pp{} = Just Glass.DefinitionKind_Definition
+entityDefinitionType _ = Nothing
+
+-- | Glass-side implementation of entity kinds, for C++ only
+entityKind :: Code.Entity -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+entityKind (Code.Entity_cxx e) = Cxx.cxxEntityKind e
+entityKind (Code.Entity_pp e) = Pp.ppEntityKind e
+entityKind _ = return Nothing
+
+nativeSymbol :: Code.Entity -> Glean.RepoHaxl u w (Maybe Text)
+nativeSymbol (Code.Entity_cxx e) = toNativeSymbol e
+nativeSymbol _ = return Nothing
diff --git a/glean/glass/Glean/Glass/SymbolId/Angle.hs b/glean/glass/Glean/Glass/SymbolId/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Angle.hs
@@ -0,0 +1,114 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Angle (
+    {- instances and -}
+  ) where
+
+import qualified Glean
+
+import Glean.Glass.SymbolId.Class
+import Control.Monad.Catch ( throwM )
+import Glean.Glass.Types (Path(..), Name(..))
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Anglelang.Types as A
+import qualified Glean.Schema.CodeAnglelang.Types as A
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+{-
+  Angle symbol ids:
+    <path>/<qualified_name>
+    <path>/<attribute>/<qualified_name>
+
+  Note that searchSymbol will assume that the last token is qualified_name
+  if any extra attributes are added to the symbolid,
+  they should be added before the qualified name.
+-}
+
+instance Symbol A.Entity where
+  toSymbol _ = throwM $ SymbolError "Angle.Entity: use toSymbolWithPath"
+  toSymbolWithPath e (Path p) = do
+    syms <- toSymbol $ A.entity_decl e
+    return $ case syms of
+      [] ->  []
+      (x:xs) -> Text.splitOn "/" p <> (x:xs)
+
+instance Symbol A.Declaration where
+  toSymbol d = case d of
+        A.Declaration_pred x -> toSymbolPredicate x
+        A.Declaration_ty x -> toSymbolPredicate x
+        A.Declaration_schema x -> toSymbolPredicate x
+        A.Declaration_imp x -> toSymbol x
+        A.Declaration_derive_ x -> toSymbolPredicate x
+        A.Declaration_evolve x -> toSymbolPredicate x
+        A.Declaration_EMPTY -> return []
+
+instance Symbol A.PredicateDecl_key where
+  toSymbol A.PredicateDecl_key{..} = toSymbol predicateDecl_key_name
+
+instance Symbol A.TypeDecl_key where
+  toSymbol A.TypeDecl_key{..} = toSymbol typeDecl_key_name
+
+instance Symbol A.SchemaDecl_key where
+  toSymbol A.SchemaDecl_key{..} = toSymbol schemaDecl_key_name
+
+instance Symbol A.DerivingDecl_key where
+   toSymbol (A.DerivingDecl_key n _) = ("derived" :) <$> toSymbol n
+
+instance Symbol A.EvolveDecl_key where
+  toSymbol A.EvolveDecl_key{..} = do
+  new <- Glean.keyOf evolveDecl_key_new_
+  old <- Glean.keyOf evolveDecl_key_new_
+  return [Text.intercalate "_evolves_" [new, old]]
+
+instance Symbol A.Name where
+  toSymbol k = do
+    v <- Glean.keyOf k
+    return [v]
+
+
+-- Searching for Angle Entities
+instance ToQName A.Entity where
+  toQName e = toQName $ A.entity_decl e
+
+instance ToQName A.Declaration where
+  toQName d = case d of
+    A.Declaration_pred x -> Glean.keyOf x >>= toQName
+    A.Declaration_ty x -> Glean.keyOf x >>= toQName
+    A.Declaration_schema x -> Glean.keyOf x >>= toQName
+    A.Declaration_imp x -> toQNameEmptyNs x
+    A.Declaration_evolve x -> Glean.keyOf x >>= toQName
+    A.Declaration_derive_ x -> Glean.keyOf x >>= toQName
+    A.Declaration_EMPTY -> return $ Left "unknown Declaration"
+
+instance ToQName A.PredicateDecl_key where
+  toQName A.PredicateDecl_key{..} = toQNameEmptyNs predicateDecl_key_name
+
+instance ToQName A.TypeDecl_key where
+  toQName A.TypeDecl_key{..} = toQNameEmptyNs typeDecl_key_name
+
+instance ToQName A.SchemaDecl_key where
+  toQName A.SchemaDecl_key{..} = toQNameEmptyNs schemaDecl_key_name
+
+instance ToQName A.DerivingDecl_key where
+  toQName A.DerivingDecl_key{..} = toQNameEmptyNs derivingDecl_key_name
+
+instance ToQName A.EvolveDecl_key where
+  toQName A.EvolveDecl_key{..} = do
+  new <- Glean.keyOf evolveDecl_key_new_
+  old <- Glean.keyOf evolveDecl_key_old_
+  let qname = Text.intercalate "_evolves_" [new, old]
+  return $ Right (Name qname, Name mempty)
+
+toQNameEmptyNs :: A.Name -> Glean.RepoHaxl u w (Either Text (Name, Name))
+toQNameEmptyNs name = do
+  nameStr <- Glean.keyOf name
+  return $ Right (Name nameStr, Name mempty)
diff --git a/glean/glass/Glean/Glass/SymbolId/Buck.hs b/glean/glass/Glean/Glass/SymbolId/Buck.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Buck.hs
@@ -0,0 +1,63 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Buck
+  ({- instances -})
+  where
+
+import Glean.Glass.SymbolId.Class
+import qualified Glean
+
+import qualified Glean.Schema.Buck.Types as Buck
+import Glean.Glass.Utils as Utils
+import Glean.Glass.Types
+
+import Glean.Schema.CodeBuck.Types as CodeBuck
+    ( Entity(..) )
+
+instance Symbol CodeBuck.Entity where
+  toSymbol e = case e of
+    CodeBuck.Entity_locator locator -> toSymbolPredicate locator
+    CodeBuck.Entity_file file ->
+       ("f" :) <$> (Utils.pathFragments <$> Glean.keyOf file)
+    CodeBuck.Entity_definition definition -> toSymbolPredicate definition
+    CodeBuck.Entity_EMPTY -> return []
+
+-- to avoid ambiguity when encoding locator, we add a tag between
+-- the subdir and the path
+instance Symbol Buck.Locator_key where
+  toSymbol (Buck.Locator_key subdir path name) =
+    let prefix = maybe [] Utils.pathFragments subdir in
+    return $ concat [["t"], prefix, ["PATH"], Utils.pathFragments path,
+                     [name]]
+
+instance Symbol Buck.Definition_key where
+  toSymbol (Buck.Definition_key module_ name) = do
+    path <- Utils.pathFragments <$> Glean.keyOf module_
+    return $ "d" : path ++ [ name ]
+
+instance ToQName CodeBuck.Entity where
+  toQName e = case e of
+    CodeBuck.Entity_locator locator -> do
+      Buck.Locator_key _subdir path name <- Glean.keyOf locator
+      return $ Right (Name name, Name path)
+
+    CodeBuck.Entity_file file -> do
+      path <- Glean.keyOf file
+      return $ case reverse (pathFragments path) of
+        [] -> Left "QName not supported for empty Buck file path"
+        (h:t) -> Right (Name h, Name (joinFragments (reverse t)))
+
+    CodeBuck.Entity_definition definition -> do
+      Buck.Definition_key module_ name <- Glean.keyOf definition
+      path <- Glean.keyOf module_
+      return (Right (Name name, Name path))
+
+    CodeBuck.Entity_EMPTY -> pure $ Left "ToQName: Unknown Buck entity"
diff --git a/glean/glass/Glean/Glass/SymbolId/CSharp.hs b/glean/glass/Glean/Glass/SymbolId/CSharp.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/CSharp.hs
@@ -0,0 +1,250 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.CSharp
+  ({- instances -})
+  where
+
+import Data.Text ( Text )
+import qualified Data.Text as Text
+
+import Glean.Glass.SymbolId.Class
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Glass.Types
+import qualified Glean.Schema.Csharp.Types as CSharp
+import Glean.Schema.CodeCsharp.Types as CodeCsharp ( Entity(..) )
+
+instance Symbol CodeCsharp.Entity where
+  toSymbol e = case e of
+    CodeCsharp.Entity_decl defn -> toSymbol defn
+    CodeCsharp.Entity_EMPTY -> return []
+
+instance Symbol CSharp.Definition where
+  toSymbol d = case d of
+    CSharp.Definition_method m -> toSymbolPredicate m
+    CSharp.Definition_type t -> toSymbol t
+    CSharp.Definition_field f -> toSymbolPredicate f
+    CSharp.Definition_parameter p -> toSymbolPredicate p
+    CSharp.Definition_typeParameter t -> toSymbolPredicate t
+    CSharp.Definition_local p -> toSymbolPredicate p
+    CSharp.Definition_property t -> toSymbolPredicate t
+    CSharp.Definition_EMPTY -> return []
+
+instance Symbol CSharp.Name where
+  toSymbol n = (:[]) <$> Glean.keyOf n
+
+instance Symbol CSharp.Namespace where
+  toSymbol ns = Glean.keyOf ns >>= \CSharp.Namespace_key{..} -> do
+    n <- Glean.keyOf namespace_key_name
+    case namespace_key_containingNamespace of
+      Nothing -> return [n]
+      Just ns -> do
+        ns' <- toSymbol ns
+        return $ if null ns' then [n] else ns' ++ [n]
+
+instance Symbol CSharp.FullName_key where
+  toSymbol CSharp.FullName_key{..} =
+    fullName_key_containingNamespace <:> fullName_key_name
+
+instance Symbol CSharp.FullName where
+  toSymbol fn = Glean.keyOf fn >>= toSymbol
+
+instance Symbol CSharp.Method_key where
+  toSymbol CSharp.Method_key{..} =
+    method_key_containingType <:> method_key_name
+
+instance Symbol CSharp.Field_key where
+  toSymbol CSharp.Field_key{..} = do
+    nameStr <- Glean.keyOf field_key_name
+    return [nameStr]
+
+instance Symbol CSharp.Parameter_key where
+  toSymbol CSharp.Parameter_key{..} = do
+    nameStr <- Glean.keyOf parameter_key_name
+    return [nameStr]
+
+instance Symbol CSharp.TypeParameter_key where
+  toSymbol CSharp.TypeParameter_key{..} = do
+    nameStr <- Glean.keyOf typeParameter_key_name
+    return [nameStr]
+
+instance Symbol CSharp.Local_key where
+  toSymbol CSharp.Local_key{..} = do
+    nameStr <- Glean.keyOf local_key_name
+    return [nameStr]
+
+instance Symbol CSharp.Property_key where
+  toSymbol CSharp.Property_key{..} = do
+    nameStr <- Glean.keyOf property_key_name
+    return [nameStr]
+
+instance Symbol CSharp.ArrayType_key where
+  toSymbol CSharp.ArrayType_key{..} = toSymbol arrayType_key_elementType
+
+instance Symbol CSharp.PointerType_key where
+  toSymbol CSharp.PointerType_key{..} = toSymbol pointerType_key_pointedAtType
+
+instance Symbol CSharp.FunctionPointerType_key where
+  toSymbol CSharp.FunctionPointerType_key{..} = do
+    CSharp.FullName_key name _ns <- Glean.keyOf functionPointerType_key_name
+    nameStr <- Glean.keyOf name
+    return [nameStr]
+
+instance Symbol CSharp.Class_key where
+  toSymbol CSharp.Class_key{..} = Glean.keyOf class_key_name >>= toSymbol
+
+instance Symbol CSharp.Interface_key where
+  toSymbol CSharp.Interface_key{..} =
+    Glean.keyOf interface_key_name >>= toSymbol
+
+instance Symbol CSharp.Record_key where
+  toSymbol CSharp.Record_key{..} = Glean.keyOf record_key_name >>= toSymbol
+
+instance Symbol CSharp.Struct_key where
+  toSymbol CSharp.Struct_key{..} = Glean.keyOf struct_key_name >>= toSymbol
+
+instance Symbol CSharp.NamedType where
+  toSymbol nt = case nt of
+    CSharp.NamedType_class_ c -> toSymbolPredicate c
+    CSharp.NamedType_interface_ i -> toSymbolPredicate i
+    CSharp.NamedType_record_ r -> toSymbolPredicate r
+    CSharp.NamedType_struct_ s -> toSymbolPredicate s
+    CSharp.NamedType_EMPTY -> return []
+
+instance Symbol CSharp.AType where
+  toSymbol d = case d of
+    CSharp.AType_arrayType at -> toSymbolPredicate at
+    CSharp.AType_namedType nt -> toSymbol nt
+    CSharp.AType_functionPointerType fpt -> toSymbolPredicate fpt
+    CSharp.AType_pointerType pt -> toSymbolPredicate pt
+    CSharp.AType_typeParameter tp -> toSymbolPredicate tp
+    CSharp.AType_EMPTY -> return []
+
+instance ToQName CodeCsharp.Entity where
+  toQName e = case e of
+    CodeCsharp.Entity_decl defn -> toQName defn
+    CodeCsharp.Entity_EMPTY -> pure $ Left "ToQName: Unknown Buck entity"
+
+instance ToQName CSharp.Definition where
+  toQName d = case d of
+    CSharp.Definition_method m -> Glean.keyOf m >>= toQName
+    CSharp.Definition_field f -> Glean.keyOf f >>= toQName
+    CSharp.Definition_parameter p -> Glean.keyOf p >>= toQName
+    CSharp.Definition_typeParameter p -> Glean.keyOf p >>= toQName
+    CSharp.Definition_local l -> Glean.keyOf l >>= toQName
+    CSharp.Definition_property p -> Glean.keyOf p >>= toQName
+    CSharp.Definition_type t -> toQName t
+    _ -> pure $ Left "ToQName: Unknown C# entity"
+
+instance ToQName CSharp.AType where
+  toQName d = case d of
+    CSharp.AType_arrayType at -> Glean.keyOf at >>= toQName
+    CSharp.AType_namedType nt -> toQName nt
+    CSharp.AType_functionPointerType fpt -> Glean.keyOf fpt >>= toQName
+    CSharp.AType_pointerType pt -> Glean.keyOf pt >>= toQName
+    CSharp.AType_typeParameter tp -> Glean.keyOf tp >>= toQName
+    CSharp.AType_EMPTY -> pure $ Left "ToQName: Unknown C# AType"
+
+instance ToQName CSharp.ArrayType_key where
+  toQName (CSharp.ArrayType_key at _rank) = toQName at
+
+instance ToQName CSharp.FunctionPointerType_key where
+  toQName (CSharp.FunctionPointerType_key name _sig) = do
+    CSharp.FullName_key name _ns <- Glean.keyOf name
+    nameStr <- Glean.keyOf name
+    -- TODO: method signature
+    return $ Right (Name nameStr, Name mempty)
+
+instance ToQName CSharp.PointerType_key where
+  toQName (CSharp.PointerType_key at) = toQName at
+
+instance ToQName CSharp.NamedType where
+  toQName nt = case nt of
+    CSharp.NamedType_class_ c -> Glean.keyOf c >>= toQName
+    CSharp.NamedType_interface_ i -> Glean.keyOf i >>= toQName
+    CSharp.NamedType_record_ r -> Glean.keyOf r >>= toQName
+    CSharp.NamedType_struct_ s -> Glean.keyOf s >>= toQName
+    CSharp.NamedType_EMPTY -> pure $ Left "ToQName: Unknown C# NamedType"
+
+instance ToQName CSharp.Struct_key where
+  toQName CSharp.Struct_key{..} = do
+    (n, ns) <- flattenFullName =<< Glean.keyOf struct_key_name
+    return $ Right (Name n, Name ns)
+
+instance ToQName CSharp.Record_key where
+  toQName CSharp.Record_key{..} = do
+    (n, ns) <- flattenFullName =<< Glean.keyOf record_key_name
+    return $ Right (Name n, Name ns)
+
+instance ToQName CSharp.Interface_key where
+  toQName CSharp.Interface_key{..} = do
+    (n, ns) <- flattenFullName =<< Glean.keyOf interface_key_name
+    return $ Right (Name n, Name ns)
+
+instance ToQName CSharp.Class_key where
+  toQName CSharp.Class_key{..} = do
+    (n, ns) <- flattenFullName =<< Glean.keyOf class_key_name
+    return $ Right (Name n, Name ns)
+
+flattenNamespace :: CSharp.Namespace_key -> Glean.RepoHaxl u w [Text]
+flattenNamespace CSharp.Namespace_key{..} = do
+  nameStr <- Glean.keyOf namespace_key_name
+  case namespace_key_containingNamespace of
+    Nothing -> return [nameStr]
+    Just ns -> do
+      ms <- flattenNamespace =<< Glean.keyOf ns
+      return (ms ++ [nameStr])
+
+flattenFullName :: CSharp.FullName_key -> Glean.RepoHaxl u w (Text, Text)
+flattenFullName (CSharp.FullName_key name ns) = do
+  names <- flattenNamespace =<< Glean.keyOf ns
+  nameStr <- Glean.keyOf name
+  return (nameStr, Text.intercalate "." names)
+
+instance ToQName CSharp.Local_key where
+  toQName CSharp.Local_key{..} = do
+    nameStr <- Glean.keyOf local_key_name
+    return $ Right (Name nameStr, Name mempty)
+
+instance ToQName CSharp.TypeParameter_key where
+  toQName CSharp.TypeParameter_key{..} = do
+    nameStr <- Glean.keyOf typeParameter_key_name
+    return $ Right (Name nameStr, Name mempty)
+
+instance ToQName CSharp.Parameter_key where
+  toQName CSharp.Parameter_key{..} = do
+    nameStr <- Glean.keyOf parameter_key_name -- parent method
+    return $ Right (Name nameStr, Name mempty)
+
+instance ToQName CSharp.Property_key where
+  toQName CSharp.Property_key{..} = do
+    nameStr <- Glean.keyOf property_key_name
+    container <- toQName property_key_containingType
+    return $ Right $ case container of
+      Left{} -> (Name nameStr, Name mempty)
+      Right (Name n, Name ns) -> (Name nameStr, Name (ns <> "." <> n))
+
+instance ToQName CSharp.Field_key where
+  toQName CSharp.Field_key{..} = do
+    nameStr <- Glean.keyOf field_key_name
+    container <- toQName field_key_containingType
+    return $ Right $ case container of
+      Left{} -> (Name nameStr, Name mempty)
+      Right (Name n, Name ns) -> (Name nameStr, Name (ns <> "." <> n))
+
+instance ToQName CSharp.Method_key where
+  toQName CSharp.Method_key{..} = do
+    nameStr <- Glean.keyOf method_key_name
+    container <- toQName method_key_containingType
+    return $ Right $ case container of
+      Left{} -> (Name nameStr, Name mempty)
+      Right (Name n, Name ns) -> (Name nameStr, Name (ns <> "." <> n))
diff --git a/glean/glass/Glean/Glass/SymbolId/Class.hs b/glean/glass/Glean/Glass/SymbolId/Class.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Class.hs
@@ -0,0 +1,125 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE ConstraintKinds #-}
+
+module Glean.Glass.SymbolId.Class (
+  -- * classes
+    Symbol(..)
+  , SymbolError(..)
+
+  -- ** qualified names
+  , ToQName(..)
+
+  -- ** labels and other attributes
+  , ToSymbolParent(..)
+
+  -- * for predicate types
+  , toSymbolPredicate
+  , SymbolKeyType
+
+  -- * builders
+  , (<:>)
+  , symbolPairToQName
+
+  ,ToNativeSymbol(..)) where
+
+import Data.Text (Text, intercalate)
+import Control.Exception ( Exception(..) )
+import Data.Typeable ( Typeable )
+
+import qualified Haxl.Core.Exception as Haxl
+
+import Glean ( keyOf, Predicate(KeyType) )
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Glass.Types as Glass ( Name(Name), Path(..) )
+
+--
+-- Codex-like qname ids for Hack, Flow and Python
+--
+-- This creates a dependency in Glass on the Entity schema structure.
+--
+-- * move into an Entity-based search layer, something like
+-- >      nameToEntity { Name, QName, Entity }
+-- >      entityToName { Entity, Name, QName }
+-- >      entityToDeclaration { Entity, Declaration }
+--
+-- * round-trip encode/decode
+--
+-- Encode/decode should work
+--
+
+newtype SymbolError = SymbolError Text
+  deriving Show
+
+instance Exception SymbolError where
+  toException = Haxl.logicErrorToException
+  fromException = Haxl.logicErrorFromException
+
+-- | An encoded Entity.
+--
+-- e.g. Glean/getRepoName -- method
+--      GleanRecursive   -- enum
+--
+class Symbol a where
+  toSymbol :: a -> Glean.RepoHaxl u w [Text]
+
+  toSymbolWithPath :: a ->  Glass.Path -> Glean.RepoHaxl u w [Text]
+  toSymbolWithPath entity _ = toSymbol entity
+
+-- | Symbols that have qualified names can be searched
+class Symbol a => ToQName a where
+  toQName :: a -> Glean.RepoHaxl u w (Either Text (Name, Name))
+
+
+-- first level parent identifier
+class ToSymbolParent a where
+  toSymbolParent :: a -> Glean.RepoHaxl u w (Maybe Name)
+
+class ToNativeSymbol a where
+  toNativeSymbol :: a -> Glean.RepoHaxl u w (Maybe Text)
+
+type SymbolKeyType p =
+  ( Typeable p
+  , Typeable (KeyType p)
+  , Show p
+  , Show (KeyType p)
+  , Predicate p
+  , Symbol (KeyType p)
+  )
+
+-- | Generically traverse predicates for keys
+toSymbolPredicate :: (SymbolKeyType p) => p -> Glean.RepoHaxl u w [Text]
+toSymbolPredicate k = Glean.keyOf k >>= toSymbol
+
+-- TODO: use a short string builder
+(<:>) :: (Symbol a, Symbol b) => a -> b -> Glean.RepoHaxl u w [Text]
+container <:> name = do
+  xs <- toSymbol container
+  x <- toSymbol name
+  return $ xs ++ x
+
+-- Useful generic instannce
+instance Symbol a => Symbol (Maybe a) where
+  toSymbol Nothing = return []
+  toSymbol (Just a) = toSymbol a
+
+-- | Build qualified name pairs (of name and container) from the
+-- symbol id pieces of the name. The separator is the language-specific
+-- concept of namespace or identifier separator.
+symbolPairToQName
+  :: (Symbol name, Symbol container)
+  => Text  -- ^ qualified name separator
+  -> name
+  -> container
+  -> Glean.RepoHaxl u w (Name, Name)
+symbolPairToQName separator name container = do
+  cSym <- Name . intercalate separator <$> toSymbol container
+  nSym <- Name . intercalate separator <$> toSymbol name
+  return (nSym, cSym)
diff --git a/glean/glass/Glean/Glass/SymbolId/Cxx.hs b/glean/glass/Glean/Glass/SymbolId/Cxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Cxx.hs
@@ -0,0 +1,734 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.SymbolId.Cxx (
+    {- instances -}
+    cxxEntityDefinitionType
+  , cxxEntityKind
+
+  ) where
+
+import Data.Text as Text ( Text, intercalate, break, replace, splitOn, pack)
+import Data.Maybe
+import Control.Monad.Catch ( throwM )
+
+import Glean.Glass.SymbolId.Class
+
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Glass.Types
+import qualified Glean.Glass.Types as Glass
+import qualified Glean.Schema.CodeCxx.Types as Cxx
+import qualified Glean.Schema.Cxx1.Types as Cxx
+
+import Glean.Angle
+import qualified Glean.Schema.CodemarkupCxx.Types as Code
+import Glean.Util.ToAngle (ToAngle(toAngle))
+import Glean.Glass.Utils (fetchData)
+
+instance Symbol Cxx.Entity where
+  toSymbol _ = throwM $ SymbolError "Cxx.Entity: use toSymbolWithPath"
+
+  toSymbolWithPath e (Path path) = (root++) <$> case e of
+      Cxx.Entity_defn defn -> toSymbol defn
+      -- these are "second class" in that they're less significant in
+      -- glass activities than defns, so we tag them to differentiate
+      -- we see a lot of them in xrefs through, where we don't do as much
+      -- decl -> defn conversions
+      Cxx.Entity_decl decl -> do
+        sym <- toSymbol decl
+        pure (sym ++ [".decl"])
+      Cxx.Entity_enumerator enum -> toSymbolPredicate enum
+      Cxx.Entity_objcSelectorSlot (Cxx.ObjcSelectorSlotEntity method idx) -> do
+        sym <- case method of
+          Cxx.ObjcMethodEntity_decl decl -> do
+            sym <- toSymbolPredicate decl
+            pure (sym ++ [".decl"])
+          Cxx.ObjcMethodEntity_defn defn -> toSymbolPredicate defn
+          Cxx.ObjcMethodEntity_EMPTY -> return []
+        pure (sym ++ [Text.pack $ show $ Glean.fromNat idx])
+      Cxx.Entity_EMPTY -> return []
+    where
+      -- find common repo anchor (e.g. "fbcode" or "xplat")
+      (mroot, rest) = Text.break (=='/') path
+      root = case mroot of
+        "" -> []
+        p | rest == "" -> [mempty] -- no path (e.g. "test" repo) produces //
+          | otherwise -> [p]
+
+instance Symbol Cxx.Declaration where
+  toSymbol d = case d of
+    Cxx.Declaration_namespace_ x -> toSymbolPredicate x
+    Cxx.Declaration_usingDeclaration x -> toSymbolPredicate x
+    Cxx.Declaration_usingDirective x -> toSymbolPredicate x
+    Cxx.Declaration_record_ x -> toSymbolPredicate x
+    Cxx.Declaration_enum_ x -> toSymbolPredicate x
+    Cxx.Declaration_function_ x -> toSymbolPredicate x
+    Cxx.Declaration_variable x -> toSymbolPredicate x
+    Cxx.Declaration_objcContainer x -> toSymbolPredicate x
+    Cxx.Declaration_objcMethod x -> toSymbolPredicate x
+    Cxx.Declaration_objcProperty x -> toSymbolPredicate x
+    Cxx.Declaration_typeAlias x -> toSymbolPredicate x
+    Cxx.Declaration_namespaceAlias x -> toSymbolPredicate x
+    Cxx.Declaration_EMPTY -> return []
+
+-- Results of DeclToDef calls
+instance Symbol Cxx.Definition where
+  toSymbol defn = case defn of
+    Cxx.Definition_record_ x -> toSymbolPredicate x
+    Cxx.Definition_function_ x -> toSymbolPredicate x
+    Cxx.Definition_enum_ x -> toSymbolPredicate x
+    Cxx.Definition_objcMethod x -> toSymbolPredicate x
+    Cxx.Definition_objcContainer x -> toSymbolPredicate x
+    Cxx.Definition_variable x -> toSymbolPredicate x
+    Cxx.Definition_namespace_ x -> toSymbolPredicate x
+    Cxx.Definition_EMPTY -> return []
+
+instance Symbol Cxx.RecordDefinition_key where
+  toSymbol (Cxx.RecordDefinition_key decl _bases _members) =
+    toSymbolPredicate decl
+
+instance Symbol Cxx.FunctionDefinition_key where
+  toSymbol (Cxx.FunctionDefinition_key decl _inline) =
+    toSymbolPredicate decl
+
+instance Symbol Cxx.EnumDefinition_key where
+  toSymbol (Cxx.EnumDefinition_key decl _enums) =
+    toSymbolPredicate decl
+
+instance Symbol Cxx.ObjcMethodDeclaration where
+  toSymbol decl = Glean.keyOf decl >>= toSymbol
+
+instance Symbol Cxx.NamespaceDefinition_key where
+  toSymbol (Cxx.NamespaceDefinition_key decl _members) =
+    toSymbolPredicate decl
+
+instance Symbol Cxx.ObjcContainerDefinition_key where
+  toSymbol (Cxx.ObjcContainerDefinition_key decl _protocols _members) =
+    toSymbolPredicate decl
+
+instance Symbol Cxx.Enumerator_key where
+  toSymbol (Cxx.Enumerator_key name decl _) = decl <:> name
+
+instance Symbol Cxx.EnumDeclaration where
+  toSymbol e = toSymbolPredicate e
+
+instance Symbol Cxx.NamespaceDeclaration_key where
+  toSymbol (Cxx.NamespaceDeclaration_key qname _) = toSymbolPredicate qname
+
+instance Symbol Cxx.UsingDeclaration_key where
+  toSymbol (Cxx.UsingDeclaration_key qname _) = toSymbolPredicate qname
+
+instance Symbol Cxx.UsingDirective_key where
+  toSymbol (Cxx.UsingDirective_key qname _) = toSymbolPredicate qname
+
+instance Symbol Cxx.RecordDeclaration_key where
+  toSymbol (Cxx.RecordDeclaration_key qname _kind _) = toSymbolPredicate qname
+
+instance Symbol Cxx.EnumDeclaration_key where
+  toSymbol (Cxx.EnumDeclaration_key qname _is_scoped _type _) =
+    toSymbolPredicate qname
+
+instance Symbol Cxx.FunctionDeclaration_key where
+  toSymbol (Cxx.FunctionDeclaration_key fqname sig quals _) =
+    toSymbolFunctionDeclaration fqname sig quals
+
+--
+-- function declarations. Symbol Id format is
+--
+-- scope1 / scope2 / name ( / .decl )?
+-- scope1 / name / .ctor / .decl  -- default constructor
+-- scope1 / name / .ctor / sig_param .. / .decl  -- overloaded by type
+--
+toSymbolFunctionDeclaration
+  :: Cxx.FunctionQName
+  -> Cxx.Signature
+  -> Maybe Cxx.MethodSignature
+  -> Glean.RepoHaxl u w [Text]
+toSymbolFunctionDeclaration fqname sig mquals = do
+  Cxx.FunctionQName_key fname scope <- Glean.keyOf fqname
+  scopeToks <- toSymbol scope
+  fn <- Glean.keyOf fname
+  nameToks <- case fn of
+    --
+    -- functions: name/.f/p1,p2(/const,volatile,lvalue)?(/.decl)?
+    --
+    Cxx.FunctionName_key_name n -> do
+      nameStr <- Glean.keyOf n
+      sigText <- sigAndQualifiers sig mquals
+      return $ [nameStr,".f"] ++ sigText
+    --
+    -- operators are basically identical to functions in their richness
+    --
+    Cxx.FunctionName_key_operator_ opStr -> do
+      sigText <- sigAndQualifiers sig mquals
+      return $ [opStr,".o"] ++ sigText
+
+    Cxx.FunctionName_key_literalOperator opStr -> do
+      sigText <- sigAndQualifiers sig mquals
+      return $ [opStr,".o"] ++ sigText
+
+    --
+    -- constructors: class/.c/p1,p2(/.decl)?
+    --
+    -- Note: .c doesn't use the body of the explicit constructors in unions
+    -- e.g.   explicit Data() : nul(nullptr) {}
+    -- nor:   const_dynamic_view() noexcept = default;
+    --
+    -- Nullary constructors have no signature token.
+    --
+    Cxx.FunctionName_key_constructor{}-> do
+      Cxx.Signature_key _retTy params <- Glean.keyOf sig
+      mSigStr <- toSymbolSignatureParams params
+      return (".c" : maybeToList mSigStr)
+
+    --
+    --  tbd: virtual vs non virtual ?
+    --
+    Cxx.FunctionName_key_destructor{} -> return [".d"]
+
+    --
+    -- type conversion operators are denoted by their return type.
+    -- the name of the conversion operator is an arbitrary type expr, so has to
+    -- be encoded properly to work. They're otherwise anonymous.
+    --
+    Cxx.FunctionName_key_conversionOperator ty -> do
+      tyToks <- toTypeSymbol ty
+      let mQualifiersStr = toSymbolQualifiers =<< mquals
+      return (".t" : tyToks : maybeToList mQualifiersStr)
+
+    Cxx.FunctionName_key_EMPTY -> return []
+
+  return (scopeToks ++ nameToks)
+
+-- standardise how we render parameters & cv or ref qualifiers
+sigAndQualifiers
+  :: Cxx.Signature -> Maybe Cxx.MethodSignature -> Glean.RepoHaxl u w [Text]
+sigAndQualifiers sig mquals = do
+  Cxx.Signature_key _retTy params <- Glean.keyOf sig
+  mSigStr <- toSymbolSignatureParams params
+  let mQualifiersStr = toSymbolQualifiers =<< mquals
+  return $ fromMaybe "" mSigStr : maybeToList mQualifiersStr
+
+instance Symbol Cxx.VariableDeclaration_key where
+  toSymbol (Cxx.VariableDeclaration_key qname _ty _kind _) =
+     toSymbolPredicate qname
+
+instance Symbol Cxx.ObjcContainerDeclaration_key where
+  toSymbol (Cxx.ObjcContainerDeclaration_key cid _) = toSymbol cid
+
+instance Symbol Cxx.ObjcMethodDeclaration_key where
+  toSymbol Cxx.ObjcMethodDeclaration_key {
+    objcMethodDeclaration_key_selector = selector,
+    objcMethodDeclaration_key_container = cid
+  } =
+    cid <:> selector
+
+instance Symbol Cxx.ObjcPropertyDeclaration_key where
+  toSymbol (Cxx.ObjcPropertyDeclaration_key name cid _ty _ _ _ _ _) =
+    cid <:> name
+
+instance Symbol Cxx.TypeAliasDeclaration_key  where
+  toSymbol (Cxx.TypeAliasDeclaration_key name _ _ _) = toSymbolPredicate name
+
+instance Symbol Cxx.NamespaceAliasDeclaration_key where
+  toSymbol (Cxx.NamespaceAliasDeclaration_key qname _ _) =
+    toSymbolPredicate qname
+
+instance Symbol Cxx.NamespaceQName_key where
+  toSymbol (Cxx.NamespaceQName_key mname Nothing) = toMaybeName mname
+  toSymbol (Cxx.NamespaceQName_key mname (Just ns)) = do
+    xs <- toSymbol ns
+    x <- toMaybeName mname
+    return (xs ++ x)
+
+instance Symbol Cxx.QName_key where
+  toSymbol (Cxx.QName_key name scope) = scope <:> name
+
+instance Symbol Cxx.FunctionQName where
+  toSymbol fqn = Glean.keyOf fqn >>= toSymbol
+
+instance Symbol Cxx.FunctionQName_key where
+  toSymbol (Cxx.FunctionQName_key name scope) = scope <:> name
+
+instance Symbol Cxx.NamespaceQName where
+  toSymbol k = toSymbolPredicate k
+
+instance Symbol Cxx.FunctionName where
+  toSymbol k = toSymbolPredicate k
+
+-- For things like constructors where we know the return type is void
+-- we can just focus on the param types
+toSymbolSignatureParams :: [Cxx.Parameter] -> Glean.RepoHaxl u w (Maybe Text)
+toSymbolSignatureParams [] = pure Nothing
+toSymbolSignatureParams params = do
+  sigToks <- mapM (\(Cxx.Parameter _name ty) -> toTypeSymbol ty) params
+  return $ Just (intercalate "," sigToks)
+
+-- nb. no `mutable`
+toSymbolQualifiers :: Cxx.MethodSignature -> Maybe Text
+toSymbolQualifiers Cxx.MethodSignature{..} = case spec of
+    [] -> Nothing
+    xs -> Just (Text.intercalate "," xs)
+  where
+    spec = catMaybes
+      [ if methodSignature_isVirtual then Just "virtual" else Nothing
+      , if methodSignature_isConst then Just "const" else Nothing
+      , if methodSignature_isVolatile then Just "volatile" else Nothing
+      , case methodSignature_refQualifier of
+          Cxx.RefQualifier_LValue -> Just "lvalue" -- &
+          Cxx.RefQualifier_RValue -> Just "rvalue" -- &&
+          Cxx.RefQualifier_None_ -> Nothing
+          Cxx.RefQualifier__UNKNOWN{} -> Nothing
+      ]
+
+instance Symbol Cxx.FunctionName_key where
+  toSymbol k = case k of
+    Cxx.FunctionName_key_name x -> toSymbol x
+    Cxx.FunctionName_key_operator_ x -> return [x]
+    Cxx.FunctionName_key_literalOperator x -> return [x]
+    Cxx.FunctionName_key_constructor _ -> return [".ctor"]
+    Cxx.FunctionName_key_destructor _ -> return [".d"]
+    Cxx.FunctionName_key_conversionOperator ty -> pure <$> Glean.keyOf ty
+    Cxx.FunctionName_key_EMPTY -> return []
+
+instance Symbol Cxx.Scope where
+  toSymbol k = case k of
+    Cxx.Scope_global_ _ -> return []
+    Cxx.Scope_namespace_ nsqname -> toSymbolPredicate nsqname
+    Cxx.Scope_recordWithAccess (Cxx.Scope_recordWithAccess_ qname _) ->
+      toSymbolPredicate qname
+      -- local scope: could be e.g. a function ctor
+    Cxx.Scope_local qname -> toSymbolPredicate qname
+    Cxx.Scope_EMPTY -> return []
+
+instance Symbol Cxx.ObjcContainerId where
+  toSymbol k = case k of
+    Cxx.ObjcContainerId_protocol x -> toSymbol x
+    Cxx.ObjcContainerId_interface_ x -> toSymbol x
+    Cxx.ObjcContainerId_categoryInterface x -> toSymbol x
+    Cxx.ObjcContainerId_extensionInterface x -> toSymbol x
+    Cxx.ObjcContainerId_implementation x -> toSymbol x
+    Cxx.ObjcContainerId_categoryImplementation x -> toSymbol x
+    Cxx.ObjcContainerId_EMPTY -> return []
+
+instance Symbol Cxx.ObjcCategoryId where
+  toSymbol (Cxx.ObjcCategoryId n1 n2) = do
+    k1 <- Glean.keyOf n1
+    k2 <- Glean.keyOf n2
+    return [k1,k2] -- which order?
+
+instance Symbol Cxx.ObjcSelector where
+  toSymbol k = Glean.keyOf k
+
+-- Currently we don't encode the parameter name, just its type.
+-- > "folly::dynamic::Array &&"
+toTypeSymbol :: Cxx.Type -> Glean.RepoHaxl u w Text
+toTypeSymbol ty = escape . normalize <$> Glean.keyOf ty
+  where
+    -- For readability in the url encoding we replace %20 with +
+    -- so we can get encodings like:
+    -- > fbsource/cpp/fbcode/folly/dynamic/.c/const+char+*
+    --
+    -- reversed in Cxx.Parse.tokenize
+    --
+    normalize :: Text -> Text
+    normalize = Text.replace " " "+"
+    --
+    -- We also need to escape any comma literals, as that's our separate char
+    -- e.g. 'std::pair<a, b>' has to go through unscathed
+    --
+    escape :: Text -> Text
+    escape = Text.replace "," " "
+
+-- The cxx schema sometimes uses nothing to represent implicit or anonymous
+-- scopes and names. We need to preserve that rather than elide
+toMaybeName :: Maybe Cxx.Name -> Glean.RepoHaxl u w [Text]
+toMaybeName Nothing = return [""]
+toMaybeName (Just name) = toSymbol name
+
+instance Symbol Cxx.Name where
+  toSymbol k = do
+    v <- Glean.keyOf k
+    return [v]
+
+--
+-- Entity "parent" relationship labelling
+--
+
+instance ToSymbolParent Cxx.Entity where
+  toSymbolParent e = case e of
+    Cxx.Entity_decl x -> toSymbolParent x
+    Cxx.Entity_defn{} -> return Nothing
+    Cxx.Entity_enumerator x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Entity_objcSelectorSlot{} -> return Nothing
+    Cxx.Entity_EMPTY -> return Nothing
+
+instance ToSymbolParent Cxx.Declaration where
+  toSymbolParent e = case e of
+    Cxx.Declaration_namespace_ x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_usingDeclaration x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_usingDirective x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_record_ x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_enum_ x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_function_ x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_variable x-> Glean.keyOf x  >>= toSymbolParent
+    Cxx.Declaration_objcContainer{} -> return Nothing -- TODO
+    Cxx.Declaration_objcMethod{} -> return Nothing -- TODO
+    Cxx.Declaration_objcProperty{} -> return Nothing -- TODO
+    Cxx.Declaration_typeAlias x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_namespaceAlias x -> Glean.keyOf x >>= toSymbolParent
+    Cxx.Declaration_EMPTY -> return Nothing
+
+instance ToSymbolParent Cxx.Enumerator_key where
+  toSymbolParent (Cxx.Enumerator_key _name decl _) =
+    Glean.keyOf decl >>= cxxEnumDeclParentName
+
+instance ToSymbolParent Cxx.NamespaceDeclaration_key where
+  toSymbolParent (Cxx.NamespaceDeclaration_key qname _) =
+    Glean.keyOf qname >>= toSymbolParent
+
+instance ToSymbolParent Cxx.UsingDeclaration_key where
+  toSymbolParent (Cxx.UsingDeclaration_key qname _) =
+    Glean.keyOf qname >>= toSymbolParent
+
+instance ToSymbolParent Cxx.UsingDirective_key where
+  toSymbolParent (Cxx.UsingDirective_key qname _) =
+    Glean.keyOf qname >>= toSymbolParent
+
+instance ToSymbolParent Cxx.QName_key where
+  toSymbolParent (Cxx.QName_key _name scope) = cxxScopeName scope
+
+-- The parent of a qname is the first immediate parent name identifier
+instance ToSymbolParent Cxx.NamespaceQName_key where
+  toSymbolParent (Cxx.NamespaceQName_key _name mparent) =
+    case mparent of
+      Nothing -> return Nothing
+      Just p -> cxxParentNSName p
+
+instance ToSymbolParent Cxx.FunctionQName_key where
+  toSymbolParent (Cxx.FunctionQName_key _name scope) = cxxScopeName scope
+
+instance ToSymbolParent Cxx.RecordDeclaration_key where
+  toSymbolParent (Cxx.RecordDeclaration_key qname _kind _) =
+    cxxParentQNameScope qname
+
+instance ToSymbolParent Cxx.EnumDeclaration_key where
+  toSymbolParent (Cxx.EnumDeclaration_key qname _is_scoped _type _) =
+    cxxParentQNameScope qname
+
+instance ToSymbolParent Cxx.FunctionDeclaration_key where
+  toSymbolParent (Cxx.FunctionDeclaration_key fqname _sig _todo _) =
+    Glean.keyOf fqname >>= toSymbolParent
+
+instance ToSymbolParent Cxx.VariableDeclaration_key where
+  toSymbolParent (Cxx.VariableDeclaration_key qname _ty _kind _) =
+    cxxParentQNameScope qname
+
+instance ToSymbolParent Cxx.TypeAliasDeclaration_key where
+  toSymbolParent (Cxx.TypeAliasDeclaration_key qname _ _ _) =
+    cxxParentQNameScope qname
+
+instance ToSymbolParent Cxx.NamespaceAliasDeclaration_key where
+  toSymbolParent (Cxx.NamespaceAliasDeclaration_key qname _ _) =
+    Glean.keyOf qname >>= toSymbolParent
+
+instance ToNativeSymbol Cxx.Entity where
+  toNativeSymbol = entityToUsr
+
+cxxEnumDeclParentName
+  :: Cxx.EnumDeclaration_key -> Glean.RepoHaxl u w (Maybe Name)
+cxxEnumDeclParentName (Cxx.EnumDeclaration_key qname _scoped _type _) =
+  cxxParentQNameScope qname
+
+cxxScopeName :: Cxx.Scope -> Glean.RepoHaxl u w (Maybe Name)
+cxxScopeName scope = case scope of
+  Cxx.Scope_global_ _ -> return Nothing
+  Cxx.Scope_namespace_ nsqname -> cxxParentNSName nsqname
+  Cxx.Scope_recordWithAccess (Cxx.Scope_recordWithAccess_ qname _) ->
+    Just <$> cxxParentQName qname
+  Cxx.Scope_local fqname -> cxxParentFunctionQName fqname
+  Cxx.Scope_EMPTY -> return Nothing
+
+cxxParentFunctionQName :: Cxx.FunctionQName -> Glean.RepoHaxl u w (Maybe Name)
+cxxParentFunctionQName fqname = do
+  (Cxx.FunctionQName_key _name _scope) <- Glean.keyOf fqname
+  return Nothing -- TODO(batanasov) parent name from Cxx.FunctionName_key
+
+cxxParentQName :: Cxx.QName -> Glean.RepoHaxl u w Name
+cxxParentQName qname = do
+  (Cxx.QName_key name _scope) <- Glean.keyOf qname
+  cxxNameToName name
+
+cxxParentQNameScope :: Cxx.QName -> Glean.RepoHaxl u w (Maybe Name)
+cxxParentQNameScope qname = do
+  (Cxx.QName_key _name scope) <- Glean.keyOf qname
+  cxxScopeName scope
+
+cxxParentNSName :: Cxx.NamespaceQName -> Glean.RepoHaxl u w (Maybe Name)
+cxxParentNSName nsqname = do
+  (Cxx.NamespaceQName_key mname _) <- Glean.keyOf nsqname
+  case mname of
+    Nothing -> return Nothing
+    Just name -> Just <$> cxxNameToName name
+
+cxxNameToName :: Cxx.Name -> Glean.RepoHaxl u w Name
+cxxNameToName name = Name <$> Glean.keyOf name
+
+--
+-- Tag to distinguish definition entities from declaration entities
+--
+-- All can be xref targets, but depending on language context we might
+-- prefer one or the other
+--
+cxxEntityDefinitionType :: Cxx.Entity -> Glass.DefinitionKind
+cxxEntityDefinitionType e = case e of
+  Cxx.Entity_decl{} -> Glass.DefinitionKind_Declaration
+  Cxx.Entity_defn{} -> Glass.DefinitionKind_Definition
+  Cxx.Entity_enumerator{} -> Glass.DefinitionKind_Definition -- is this ok?
+  Cxx.Entity_objcSelectorSlot (Cxx.ObjcSelectorSlotEntity method _) -> do
+    case method of
+      Cxx.ObjcMethodEntity_decl{} -> Glass.DefinitionKind_Declaration
+      Cxx.ObjcMethodEntity_defn{} -> Glass.DefinitionKind_Definition
+      Cxx.ObjcMethodEntity_EMPTY -> Glass.DefinitionKind_Definition -- fallback
+  Cxx.Entity_EMPTY -> Glass.DefinitionKind_Definition -- fallback to definition
+
+--
+-- entity labelling
+--
+cxxEntityKind :: Cxx.Entity -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+cxxEntityKind e = case e of
+  Cxx.Entity_decl x -> toSymbolDeclKind x
+  Cxx.Entity_defn x -> toSymbolDefnKind x
+  Cxx.Entity_enumerator{} -> return $ Just SymbolKind_Enumerator
+  Cxx.Entity_objcSelectorSlot{} -> return $ Just SymbolKind_Method
+  Cxx.Entity_EMPTY -> return Nothing
+
+-- to match idelsp/GleanLSPConverter.php
+-- Glean-side implementation in codemarkup.cxx.angle. This exists to
+-- avoid O(n) symbolkind calls on document open
+toSymbolDeclKind
+  :: Cxx.Declaration -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+toSymbolDeclKind e = case e of
+  Cxx.Declaration_namespace_{} -> return $ Just SymbolKind_Namespace
+  Cxx.Declaration_usingDeclaration{} -> return $ Just SymbolKind_Namespace
+  Cxx.Declaration_usingDirective{} -> return Nothing -- unknown
+  Cxx.Declaration_record_ x -> toSymbolRecordKind x
+  Cxx.Declaration_enum_{} -> return $ Just SymbolKind_Enum
+  Cxx.Declaration_function_ fn ->
+    Just <$> (toSymbolFunctionDeclKind =<< Glean.keyOf fn)
+  Cxx.Declaration_variable{} -> return $ Just SymbolKind_Variable
+  Cxx.Declaration_objcContainer{} -> return Nothing
+  Cxx.Declaration_objcMethod{} -> return $ Just SymbolKind_Method
+  Cxx.Declaration_objcProperty{} -> return $ Just SymbolKind_Property
+  Cxx.Declaration_typeAlias{} -> return $ Just SymbolKind_Type
+  Cxx.Declaration_namespaceAlias{} -> return $ Just SymbolKind_Type
+  Cxx.Declaration_EMPTY -> return Nothing
+
+toSymbolFunctionDeclKind
+  :: Cxx.FunctionDeclaration_key -> Glean.RepoHaxl u w Glass.SymbolKind
+toSymbolFunctionDeclKind (Cxx.FunctionDeclaration_key fqname _ mmethod _) = do
+  Cxx.FunctionQName_key fname _ <- Glean.keyOf fqname
+  name <- Glean.keyOf fname
+  pure $ case name of
+    Cxx.FunctionName_key_name{} -> case mmethod of
+      Just{} -> SymbolKind_Method
+      _ -> SymbolKind_Function
+    Cxx.FunctionName_key_constructor{} -> SymbolKind_Constructor
+    Cxx.FunctionName_key_destructor{} -> SymbolKind_Constructor
+    Cxx.FunctionName_key_operator_{} -> SymbolKind_Operator
+    Cxx.FunctionName_key_literalOperator{} -> SymbolKind_Operator
+    Cxx.FunctionName_key_conversionOperator{} -> SymbolKind_Operator
+    Cxx.FunctionName_key_EMPTY -> SymbolKind_Function
+
+toSymbolRecordKind
+  :: Cxx.RecordDeclaration
+  -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+toSymbolRecordKind k = do
+  (Cxx.RecordDeclaration_key _ kind _) <- Glean.keyOf k
+  return $ case kind of
+    Cxx.RecordKind_struct_{} -> Just SymbolKind_Struct
+    Cxx.RecordKind_class_{} -> Just SymbolKind_Class_
+    Cxx.RecordKind_union_{} -> Just SymbolKind_Union
+    Cxx.RecordKind_EMPTY -> Nothing
+
+toSymbolDefnKind
+  :: Cxx.Definition -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+toSymbolDefnKind k = case k of
+  Cxx.Definition_record_ x -> do
+    Cxx.RecordDefinition_key decl _ _ <- Glean.keyOf x
+    toSymbolRecordKind decl
+  Cxx.Definition_function_ f -> do
+    Cxx.FunctionDefinition_key decl _ <- Glean.keyOf f
+    Just <$> (toSymbolFunctionDeclKind =<< Glean.keyOf decl)
+  Cxx.Definition_enum_{} -> return $ Just SymbolKind_Enum
+  Cxx.Definition_objcMethod{} -> return $ Just SymbolKind_Method
+  Cxx.Definition_objcContainer{} -> return Nothing
+  Cxx.Definition_variable{} -> return $ Just SymbolKind_Variable
+  Cxx.Definition_namespace_{} -> return $ Just SymbolKind_Namespace
+  Cxx.Definition_EMPTY -> return Nothing
+
+--
+-- Qualified names for C++
+--
+-- Todo: rewrite this entirely based on induction on the entity type
+-- make sure the generated scope/local name fragments match clangd
+--
+instance ToQName Cxx.Entity where
+  toQName e = do
+    symId <- toSymbolWithPath e (Path mempty) -- we already had the symbolid tho
+    return $ case symId of -- this is a hack, should use the real scope/qname
+      [] -> Left "C++: toQName: No qualified name for this symbol"
+      [name] -> Right (Name name, Name "")
+      x@(_:_) ->
+        -- check .c signature case
+        case Prelude.break (== ".c") x of
+          (scope, ".c":params) -> ctorSignatureQName scope params
+          _ -> case Prelude.break (\x -> x `elem` [".f",".o"]) x of
+            (scope, ".f":params) -> functionSignatureQName False scope params
+            (scope, ".o":params) -> functionSignatureQName True scope params
+            _ -> case Prelude.break (== ".d") x of
+              (scope, ".d":_anything) -> dtorQName scope
+              _ -> case Prelude.break (== ".t") x of
+                (scope, ".t":retTy:rest) -> tyConvQName scope retTy rest
+                _ -> case (init x, last x) of
+                  (ms, name)
+                    | name `elem` [".ctor",".decl"]
+                    -> let (ns, name') = (init ms, last ms)
+                      in Right (Name name', Name (intercalate "::" ns))
+                    | otherwise -> Right (Name name, Name (intercalate "::" ms))
+
+
+
+-- e.g. default constructors:
+-- fbsource/cpp/fbcode/folly/dynamic/.c/.decl
+--
+-- fbsource/cpp/fbcode/folly/dynamic_view/.c
+-- > dynamic_view() in folly::dynamic_view
+--
+-- fbsour..../folly/dynamic_view/.c/const+folly::dynamic_view+%26
+-- > dynamic_view(const folly::dynamic_view &) in folly::dynamic_view
+--
+ctorSignatureQName :: [Text] -> [Text] -> Either Text (Name, Name)
+ctorSignatureQName prefix ps = Right (Name localname, Name scopename)
+  where
+    localname = name <> formatParams (sigOf ps)
+    scopename = intercalate "::" scope
+    (scope, name) = case prefix of
+      [n] -> ([n], n)
+      _ -> (prefix, last prefix)
+
+dtorQName :: [Text] -> Either Text (Name, Name)
+dtorQName prefix = Right (Name localname, Name scopename)
+  where
+    localname = "~" <> name <> "()"
+    scopename = intercalate "::" scope
+    (scope, name) = case prefix of
+      [n] -> ([n], n)
+      _ -> (prefix, last prefix)
+
+tyConvQName :: [Text] -> Text -> [Text] -> Either Text (Name, Name)
+tyConvQName prefix retTyStr rest = Right (Name localname, Name scopename)
+  where
+    retTy = uncode retTyStr
+    quals = case rest of
+      [] -> Nothing
+      [".decl"] -> Nothing
+      [quals] -> Just (denormalize quals)
+      [quals,".decl"] -> Just (denormalize quals)
+      _ -> Nothing
+    localname = retTy <> "()" <> pprQuals quals
+    scopename = intercalate "::" prefix
+
+sigOf :: [Text] -> Maybe Text
+sigOf ps = case ps of
+  [] -> Nothing
+  [".decl"] -> Nothing
+  [sig,".decl"] -> Just sig
+  [sig] -> Just sig
+  _ -> Nothing -- we never have more than one sig token
+
+qualsOf :: [Text] -> Maybe (Text, Maybe Text)
+qualsOf ps = case ps of
+  [] -> Nothing
+  [".decl"] -> Nothing
+  [sig] -> Just (sig, Nothing)
+  [sig,".decl"] -> Just (sig, Nothing)
+  [sig,quals] -> Just (sig, Just quals)
+  [sig,quals,".decl"] -> Just (sig, Just quals)
+  _ -> Nothing -- we never have more than two sig tokens
+
+--
+-- function names
+--
+functionSignatureQName :: Bool -> [Text] -> [Text] -> Either Text (Name, Name)
+functionSignatureQName _ [] _ =
+  Left "functionSignatureQName: empty function name"
+functionSignatureQName _ _ [] =
+  Left "functionSignatureQName: empty signature"
+functionSignatureQName isOp prefix ps0 = Right (Name localname, Name scopename)
+  where
+    (params, quals) = case qualsOf ps0 of
+      Nothing -> (Nothing , Nothing)
+      Just (ps, Nothing) -> (Just (denormalize ps), Nothing)
+      Just (ps, Just qs) -> (Just (denormalize ps), Just (denormalize qs))
+
+    localname = name <> case params of
+      Nothing -> if isOp then "()" else ""
+      Just [] -> if isOp then "()" else ""
+      Just [""] -> case pprQuals quals of -- foo() const&
+        "" -> if isOp then "()" else ""
+        qs -> "()" <> qs
+
+      Just tys -> "(" <> Text.intercalate ", " tys <> ")" <> pprQuals quals
+
+    scopename = intercalate "::" scope
+
+    (scope, name) = case prefix of
+      [n] -> ([], n) -- global function
+      _ -> (init prefix, last prefix)
+
+pprQuals :: Maybe [Text] -> Text
+pprQuals Nothing = ""
+pprQuals (Just []) = ""
+pprQuals (Just qs) = " " <> pprCv <> pprRef
+  where
+    pprCv :: Text
+    pprCv | "const" `elem` qs = "const"
+          | otherwise = mempty
+    pprRef :: Text
+    pprRef | "lvalue" `elem` qs = "&"
+           | "rvalue" `elem` qs = "&&"
+           | otherwise = mempty
+
+formatParams :: Maybe Text -> Text
+formatParams params =
+  "(" <> maybe "" (Text.intercalate ", " . denormalize) params <> ")"
+
+denormalize :: Text -> [Text]
+denormalize = map uncode . Text.splitOn ","
+
+uncode :: Text -> Text
+uncode = Text.replace "+" " " .  Text.replace " " ","
+
+--
+-- Look up the USR if present
+--
+entityToUsr :: Cxx.Entity -> Glean.RepoHaxl u w (Maybe Text)
+entityToUsr ent = fetchData $ vars $ \(usr :: Angle Text) ->
+  usr `where_` [
+    wild .= predicate @Code.CxxEntityUSR (
+        rec $
+          field @"entity" (toAngle ent) $
+          field @"usr" usr
+        end)
+  ]
diff --git a/glean/glass/Glean/Glass/SymbolId/Cxx/Parse.hs b/glean/glass/Glean/Glass/SymbolId/Cxx/Parse.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Cxx/Parse.hs
@@ -0,0 +1,441 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveGeneric #-}
+
+module Glean.Glass.SymbolId.Cxx.Parse (
+    validateSymbolId,
+    compileSymbolEnv, -- valid symbol ids can be compiled to a search term
+    SymbolEnv(..),
+    SymbolTag(..),
+    Name(..),
+    Qualifier(..),
+    RefQualifier(..),
+    unName,
+    unNames,
+    CxxTaggedSymbolExpr(..),
+    CxxSymbolExpr(..),
+
+    -- testing
+    toQualifier
+  ) where
+
+import Control.Monad.State.Strict
+import Data.Aeson.Types ( ToJSON )
+import Data.Set ( Set )
+import Data.Text ( Text )
+import GHC.Generics
+import Util.Text ( textShow )
+import qualified Data.Set as Set
+import qualified Data.Text as Text
+
+-- "lexer"
+
+-- | Tokenize each fragment
+data Token
+  = TName !Text
+  | TDecl
+  | TCtor
+  | TDtor
+  | TCtorSignature
+  | TFunction
+  | TOperator
+  | TConversionOperator
+  deriving Show
+
+tokenize :: Text -> Token
+tokenize ".decl" = TDecl
+tokenize ".ctor" = TCtor
+tokenize ".d" = TDtor
+tokenize ".c" = TCtorSignature
+tokenize ".f" = TFunction
+tokenize ".o" = TOperator
+tokenize ".t" = TConversionOperator
+tokenize n = TName n
+
+name :: Text -> Name
+name = Name
+
+-- | in type signatures literal "," (as in std::pair<a, b>) is replaced with " "
+-- to avoid the "," param seperator
+--
+-- And spaces are replaced with +
+--
+sig :: Text -> Name
+sig = Name . Text.replace "+" " " . Text.replace " " ","
+
+-- "parser"
+
+type Parse a = State SymbolEnv a
+
+-- | Process the symbol id left to right accumulating information
+data SymbolEnv = SymbolEnv {
+  path :: Text,
+  scopes :: [Name], -- accumulated scope terms
+  localname :: Maybe Name, -- the local name of the identifier
+  declaration :: Bool, -- .decl tag occurs
+  tag :: Maybe SymbolTag,
+  params :: [Name], -- maybe parameter signature
+  returns :: Maybe Name, -- return type name where present
+  qualifiers :: Set Qualifier, -- optional list of qualifiers (const, &&, etc)
+  errors :: [Text] -- any errors we find
+} deriving (Eq, Ord, Show, Generic)
+
+newtype Name = Name Text
+  deriving (Eq, Ord, Show, Generic)
+
+data Qualifier
+  = Virtual
+  | Const
+  | Volatile
+  | RefQual RefQualifier
+  deriving (Eq, Ord, Show, Generic)
+
+data RefQualifier = LValue | RValue
+  deriving (Eq, Ord, Show, Generic)
+
+-- standalone to avoid having it appear in the generic JSON writer
+unName :: Name -> Text
+unName (Name n) = n
+
+-- Any tags that help to classify the sort of symbol we have
+-- These will be variants of an ADT
+data SymbolTag
+  = Constructor
+  | CTorSignature -- .ctor with type signature of params
+  | Destructor
+  | Function
+  | Operator
+  | TypeConversionOperator
+  deriving (Eq, Ord, Show, Generic)
+
+-- for regression testing
+instance ToJSON Name
+instance ToJSON SymbolTag
+instance ToJSON SymbolEnv
+instance ToJSON Qualifier
+instance ToJSON RefQualifier
+
+data CxxTaggedSymbolExpr
+  = CxxDecl CxxSymbolExpr
+  | CxxDefn CxxSymbolExpr
+
+tagged :: Bool -> CxxSymbolExpr -> CxxTaggedSymbolExpr
+tagged True = CxxDecl
+tagged False = CxxDefn
+
+-- Compile SymbolEnv to a typed ADT that makes bugs harder
+data CxxSymbolExpr
+  = CxxConstructor {
+      cPath :: Text,
+      cScope :: [Name],
+      cParams :: [Name]
+    }
+  | CxxDestructor {
+      cPath :: Text,
+      cScope :: [Name]
+    }
+  | CxxFunction {
+      cPath :: Text,
+      cScope :: [Name],
+      cName :: Name,
+      cParams :: [Name],
+      cQuals :: Set Qualifier
+    }
+  | CxxOperator {
+      cPath :: Text,
+      cScope :: [Name],
+      cName :: Name,
+      cParams :: [Name],
+      cQuals :: Set Qualifier
+
+    }
+  | CxxTypeConversionOperator {
+      cPath :: Text,
+      cScope :: [Name],
+      cReturns :: Name,
+      cQuals :: Set Qualifier
+  }
+  -- Legacy: constructor params (TODO replace with general local var case)
+  | CxxLegacyCTorParams {
+      cPath :: Text,
+      cScope :: [Name],
+      cName :: Name
+    }
+  -- Fall back: any symbol
+  | CxxAny {
+      cPath :: Text,
+      cScope :: [Name],
+      cName :: Name
+    }
+
+unNames :: [Name] -> [Text]
+unNames = map unName
+
+--
+-- Refine the parsed symbol tokens into a more precise symbol id query ADT
+--
+compileSymbolEnv :: SymbolEnv -> Either Text CxxTaggedSymbolExpr
+compileSymbolEnv env@SymbolEnv{..} = case tag of
+  Just CTorSignature ->
+    Right $ tagged declaration $ CxxConstructor { -- .c
+        cPath = path,
+        cScope = scopes,
+        cParams = params
+    }
+  Just Destructor -> -- .d
+    Right $ tagged declaration $ CxxDestructor {
+        cPath = path,
+        cScope = scopes
+    }
+  Just Function  -- .f
+    | Just name <- localname ->
+      Right $ tagged declaration $ CxxFunction {
+          cPath = path,
+          cScope = scopes,
+          cName = name,
+          cParams = params,
+          cQuals = qualifiers
+      }
+    | otherwise ->
+      Left $ "compileSymbolEnv: Function missing local name: " <> textShow env
+
+  Just Operator -- .o
+    | Just name <- localname ->
+      Right $ tagged declaration $ CxxOperator {
+          cPath = path,
+          cScope = scopes,
+          cName = name,
+          cParams = params,
+          cQuals = qualifiers
+      }
+    | otherwise ->
+      Left $ "compileSymbolEnv: Operator missing name: " <> textShow env
+
+  Just TypeConversionOperator -- .t
+    | Just returnTy <- returns ->
+      Right $ tagged declaration $ CxxTypeConversionOperator {
+          cPath = path,
+          cScope = scopes,
+          cReturns = returnTy,
+          cQuals = qualifiers
+      }
+    | otherwise ->
+      Left $ "compileSymbolEnv: Type conversion operator: missing type: "
+        <> textShow env
+
+  Just Constructor -- legacy .ctor params, aka local vars in ctor scope
+    | Just name <- localname ->
+    Right $ tagged declaration $ CxxLegacyCTorParams {
+        cPath = path,
+        cScope = scopes,
+        cName = name
+    }
+    | otherwise ->
+      Left "compileSymbolEnv: constructor params missing local name"
+  Nothing
+    | Just name <- localname ->
+      Right $ tagged declaration $ CxxAny {
+          cPath = path,
+          cScope = scopes,
+          cName = name
+      }
+    | otherwise ->
+      Left "compileSymbolEnv: CxxAny: missing local name for entity"
+
+initState :: Text -> SymbolEnv
+initState p = SymbolEnv {
+    path = p,
+    scopes = mempty,
+    localname = Nothing,
+    declaration = False,
+    tag = Nothing,
+    params = [],
+    returns = Nothing,
+    qualifiers = mempty,
+    errors = []
+  }
+
+pushScope :: Text -> Parse ()
+pushScope s = modify' $ \env -> env { scopes = name s : scopes env }
+
+pushParam :: Text -> Parse ()
+pushParam s = modify' $ \env -> env { params = sig s : params env }
+
+setReturnType :: Text -> Parse ()
+setReturnType s = modify' $ \env -> env { returns = Just (sig s) }
+
+setName :: Text -> Parse ()
+setName n = modify' $ \env -> env { localname = Just (name n) }
+
+pushQualifier :: Qualifier -> Parse ()
+pushQualifier q = modify' $ \env ->
+    env { qualifiers = Set.insert q (qualifiers env)
+  }
+
+setTag :: SymbolTag -> Parse ()
+setTag t = modify' $ \env -> env { tag = Just t }
+
+setDecl :: Parse ()
+setDecl = modify' $ \env -> env { declaration = True }
+
+setErr :: Text -> Parse ()
+setErr s = modify' $ \env -> env { errors = s : errors env }
+
+--
+-- | Parse the symbol id term
+--
+validateSymbolId :: [Text] -> Either [Text] SymbolEnv
+validateSymbolId toks = case toks of
+  [] -> Left ["Cxx.parseSymbolId: empty symbol"]
+  [_] -> Left ["Cxx.parseSymbolId: incomplete symbol:" <> textShow toks]
+  path:name:rest ->
+    let env = execState
+               (parseOneName (tokenize name) (map tokenize rest))
+               (initState path)
+    in case errors env of
+        [] -> Right $ env { scopes = reverse (scopes env)
+                          , params = reverse (params env)
+                          }
+        errs -> Left errs
+
+-- | at least one name is required
+parseOneName :: Token -> [Token] -> Parse ()
+parseOneName (TName name) rest = parseScopeOrName name rest
+parseOneName tok _ = setErr $
+  "Cxx.parseScopedSymbol: expected identifier, found tag:" <> textShow tok
+
+-- | scope* name (tag*)
+parseScopeOrName :: Text -> [Token] -> Parse ()
+parseScopeOrName name [] = setName name -- last identifier is always name
+parseScopeOrName name (n : ns) = case n of
+  TName n -> pushScope name >> parseScopeOrName n ns
+  TCtor -> pushScope name >> setTag Constructor >> parseCtor ns
+  TDtor -> pushScope name >> setTag Destructor >> parseDtor ns
+  TCtorSignature -> pushScope name >> setTag CTorSignature >> parseCtorSig ns
+  TFunction -> setName name >> setTag Function >> parseFunctionSig ns
+  TOperator -> setName name >> setTag Operator >> parseFunctionSig ns
+  TConversionOperator ->
+    pushScope name >> setTag TypeConversionOperator >> parseTypeOperatorSig ns
+  TDecl -> do
+    setName name >> setDecl
+    case ns of
+      [] -> pure ()
+      _ -> setErr $
+        "Cxx.parseScopedSymbol: unexpected tokens after .decl in symbol id: "
+          <> textShow ns
+
+-- | following /.ctor/ can only be:
+--
+-- > name
+-- > name / .decl
+-- > .
+--
+parseCtor :: [Token] -> Parse ()
+parseCtor [] = return () -- ctor definition occurence
+parseCtor [TDecl] = setDecl -- a ctor decl . subsumed by CtorSig.
+parseCtor [TName name, TDecl] = setName name >> setDecl -- ctor parameter decl
+parseCtor rest = setErr $
+  "Cxx.parseCtor: unexpected trailing tokens in .ctor signature: " <>
+    textShow rest
+
+parseDtor :: [Token] -> Parse ()
+parseDtor [] = return ()
+parseDtor [TDecl] = setDecl
+parseDtor rest = setErr $
+  "Cxx.parseDtor: unexpected trailing tokens in destructor: " <>
+    textShow rest
+
+parseCtorSig :: [Token] -> Parse ()
+-- constructor with no params
+parseCtorSig [] = return ()
+-- one or more param signatures
+parseCtorSig [TName name] = mapM_ pushParam params
+  where
+    params = splitCommas name
+
+-- nullary construct decl
+parseCtorSig [TDecl] = setDecl
+
+-- one or more param signatures decl
+parseCtorSig [TName name, TDecl] =
+    mapM_ pushParam params >> setDecl
+  where
+    params = splitCommas name
+parseCtorSig rest = setErr $
+  "Cxx.parseCtorSig: unexpected trailing tokens in .ctor signature: " <>
+    textShow rest
+
+--
+-- Type conversion operators: a single return type and optional qualifiers
+--
+parseTypeOperatorSig :: [Token] -> Parse ()
+parseTypeOperatorSig [] = setErr $
+  "Cxx.parseTypeOperatorSig: missing type name for conversion symbol"
+parseTypeOperatorSig [TDecl] = setErr $
+  "Cxx.parseTypeOperatorSig: missing type name for conversion decl symbol"
+parseTypeOperatorSig [TName name] = -- return type only, no qualifiers
+  setReturnType name
+parseTypeOperatorSig [TName name, TDecl] =
+  setReturnType name >> setDecl
+parseTypeOperatorSig [TName name, TName quals] = -- return type and quals
+  setReturnType name >> mapM_ parseQualifier (splitCommas quals)
+parseTypeOperatorSig [TName name, TName quals, TDecl] = do -- decl variant
+  setReturnType name
+  mapM_ parseQualifier (splitCommas quals)
+  setDecl
+parseTypeOperatorSig rest = setErr $
+  "Cxx.parseTypeOperatorSig: unexpected trailing tokens in operator: " <>
+    textShow rest
+
+--
+-- Function signatures always have parameter types if non-nullary
+--
+parseFunctionSig :: [Token] -> Parse ()
+-- nullary definition
+parseFunctionSig [] = pure ()
+-- nullary construct decl
+parseFunctionSig [TDecl] =
+  setDecl
+
+parseFunctionSig [TName name] = do -- single set of params (or trailing "/")
+  mapM_ pushParam (splitCommas name)
+parseFunctionSig [TName name, TDecl] = do -- decl variant
+  mapM_ pushParam (splitCommas name) >> setDecl
+
+parseFunctionSig [TName name, TName quals] = do -- set of params and quals
+  mapM_ pushParam (splitCommas name)
+  mapM_ parseQualifier (splitCommas quals)
+parseFunctionSig [TName name, TName quals, TDecl] = do -- decl variant
+  mapM_ pushParam (splitCommas name)
+  mapM_ parseQualifier (splitCommas quals)
+  setDecl
+
+parseFunctionSig rest = setErr $
+  "Cxx.parseCtorSig: unexpected trailing tokens in .ctor signature: " <>
+    textShow rest
+
+-- | type signatures are a single token separated by commas
+splitCommas :: Text -> [Text]
+splitCommas "" = []
+splitCommas xs = Text.splitOn "," xs
+
+parseQualifier :: Text -> Parse ()
+parseQualifier s = case toQualifier s of
+  Just x -> pushQualifier x
+  Nothing -> setErr $ "parseQualifier: invalid qualifier: " <> s
+
+-- | Parse cv qualfier encodings
+toQualifier :: Text -> Maybe Qualifier
+toQualifier s = case s of
+  "virtual" -> Just Virtual
+  "const" -> Just Const
+  "volatile" -> Just Volatile
+  "lvalue" -> Just (RefQual LValue)
+  "rvalue" -> Just (RefQual RValue)
+  _ -> Nothing
diff --git a/glean/glass/Glean/Glass/SymbolId/Erlang.hs b/glean/glass/Glean/Glass/SymbolId/Erlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Erlang.hs
@@ -0,0 +1,75 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Erlang
+  ({- instances -})
+  where
+
+import TextShow
+
+import Glean (Nat, fromNat, keyOf)
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Types (Name(..))
+import qualified Glean.Haxl.Repos as Glean
+
+import qualified Glean.Schema.Erlang.Types as Erlang
+import Data.Text (Text, intercalate)
+
+import Glean.Schema.CodeErlang.Types as CodeErlang
+    ( Entity(..) )
+
+instance Symbol CodeErlang.Entity where
+  toSymbol e = case e of
+    CodeErlang.Entity_decl decl -> toSymbol decl
+    CodeErlang.Entity_EMPTY -> return []
+
+instance Symbol Erlang.Declaration where
+  toSymbol decl = case decl of
+    Erlang.Declaration_func func -> toSymbolPredicate func
+    Erlang.Declaration_EMPTY -> return []
+
+instance Symbol Erlang.FunctionDeclaration_key where
+  toSymbol (Erlang.FunctionDeclaration_key fqn _file _span) = toSymbol fqn
+
+instance Symbol Erlang.Fqn where
+  toSymbol (Erlang.Fqn module_ name arity) =
+    return [module_, name, showt (fromNat arity)]
+
+instance Symbol Text where
+  toSymbol module_ = return [module_]
+
+instance Symbol (Text, Nat) where
+  toSymbol (name, arity) =
+      return [intercalate "." [name, showt (fromNat arity)]]
+
+instance ToQName CodeErlang.Entity where
+  toQName e = case e of
+    CodeErlang.Entity_decl x -> toQName x
+    CodeErlang.Entity_EMPTY -> return $ Left "unknown Entity"
+
+instance ToQName Erlang.Declaration where
+  toQName e = case e of
+    Erlang.Declaration_func x -> Glean.keyOf x >>= toQName
+    Erlang.Declaration_EMPTY -> return $ Left "unknown Declaration"
+
+instance ToQName Erlang.FunctionDeclaration_key where
+  toQName e = case e of
+    Erlang.FunctionDeclaration_key fqn _file _span -> toQName fqn
+
+instance ToQName Erlang.Fqn where
+  toQName e = case e of
+    Erlang.Fqn module_ name arity -> pairToQName (name, arity) module_
+
+pairToQName
+  :: (Symbol name, Symbol container)
+  => name
+  -> container
+  -> Glean.RepoHaxl u w (Either a (Name, Name))
+pairToQName a b = Right <$> symbolPairToQName "." a b
diff --git a/glean/glass/Glean/Glass/SymbolId/Fbthrift.hs b/glean/glass/Glean/Glass/SymbolId/Fbthrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Fbthrift.hs
@@ -0,0 +1,164 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+-- Thrift symbol ids can be of three forms
+-- repo/thrift/FILE
+-- repo/thrift/FILE/NAME
+--    NAME can refer to a union, struct, exception, service, constant, typedef
+--    there's no possible ambiguity as these names are guaranteed to be unique
+--    in a file
+-- repo/thrift/FILE/NAME/MEMBER
+--    MEMBER can be a struct/union/exception field, an enum value,
+--    or a service function
+--
+-- The symbol id is ambiguous, repo/thrift/a.thrift/b.thrift/c can refer to
+-- field c in struct b.thrift, or struct c in file b.thrift.
+-- TODO add more structure to disambiguate
+--
+module Glean.Glass.SymbolId.Fbthrift
+  ({- instances -})
+  where
+
+import Data.Maybe
+import Data.Text ( intercalate, stripSuffix )
+
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Types (Name(..))
+
+import qualified Glean
+
+import qualified Glean.Schema.Fbthrift.Types as Thrift
+
+import Glean.Glass.Utils ( pathFragments )
+import qualified Glean.Schema.Src.Types as Src
+
+instance Symbol Thrift.XRefTarget where
+  toSymbol x = case x of
+    Thrift.XRefTarget_include_ thrift_file -> toSymbolPredicate thrift_file
+    Thrift.XRefTarget_named named -> toSymbolPredicate named
+    Thrift.XRefTarget_exception_ exception_ -> toSymbolPredicate exception_
+    Thrift.XRefTarget_service_ service_ -> toSymbolPredicate service_
+    Thrift.XRefTarget_constant constant -> toSymbolPredicate constant
+    Thrift.XRefTarget_enumValue enumvalue -> toSymbolPredicate enumvalue
+    Thrift.XRefTarget_function_ fn -> toSymbolPredicate fn
+    Thrift.XRefTarget_field fn -> toSymbolPredicate fn
+    Thrift.XRefTarget_EMPTY -> return []
+
+instance Symbol Src.File where
+  toSymbol k = pathFragments <$> Glean.keyOf k
+
+instance Symbol Thrift.File where
+  toSymbol f = toSymbolPredicate f
+
+instance Symbol Thrift.NamedDecl_key where
+  toSymbol (Thrift.NamedDecl_key (Thrift.NamedType qualname _kind)) =
+    toSymbolPredicate qualname
+
+instance Symbol Thrift.EnumValue_key where
+  toSymbol (Thrift.EnumValue_key (Thrift.NamedType qualname _kind) name) =
+    qualname <:> name
+
+instance Symbol Thrift.FieldDecl_key where
+  toSymbol (Thrift.FieldDecl_key qualname _kind name) =
+    qualname <:> name
+
+instance Symbol Thrift.Constant_key where
+  toSymbol (Thrift.Constant_key qualname) =
+    toSymbolPredicate qualname
+
+instance Symbol Thrift.ServiceName where
+  toSymbol = toSymbolPredicate
+
+instance Symbol Thrift.ServiceName_key where
+  toSymbol (Thrift.ServiceName_key qualname) =
+    toSymbolPredicate qualname
+
+instance Symbol Thrift.FunctionName_key where
+  toSymbol (Thrift.FunctionName_key service name) = service <:> name
+
+instance Symbol Thrift.ExceptionName_key where
+  toSymbol (Thrift.ExceptionName_key qualname) =
+    toSymbolPredicate qualname
+
+instance Symbol Thrift.QualName_key where
+  toSymbol (Thrift.QualName_key file name) = file <:> name
+
+instance Symbol Thrift.QualName where
+  toSymbol = toSymbolPredicate
+
+instance Symbol Thrift.Identifier where
+  toSymbol identifier = do
+    n <- Glean.keyOf identifier
+    return [n]
+
+instance ToQName Thrift.XRefTarget where
+  toQName e = case e of
+    Thrift.XRefTarget_include_ file -> do
+      thriftFile <- Glean.keyOf file
+      path <- Glean.keyOf thriftFile
+      return $ case reverse (pathFragments path) of
+        [] -> Left "QName not supported for empty thrift path"
+        (h:t) -> Right (Name h, Name (intercalate "." (reverse t)))
+    Thrift.XRefTarget_named x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_exception_ x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_service_ x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_constant x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_enumValue x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_function_ x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_field x -> Glean.keyOf x >>= toQName
+    Thrift.XRefTarget_EMPTY -> return $ Left "unknown thrift.Declaration"
+
+instance ToQName Thrift.NamedDecl_key where
+  toQName (Thrift.NamedDecl_key (Thrift.NamedType qname _kind)) = do
+    toQName =<< Glean.keyOf qname
+
+instance ToQName Thrift.ExceptionName_key where
+  toQName (Thrift.ExceptionName_key qname ) = do
+    toQName =<< Glean.keyOf qname
+
+instance ToQName Thrift.ServiceName_key where
+  toQName (Thrift.ServiceName_key qname ) = do
+    toQName =<< Glean.keyOf qname
+
+instance ToQName Thrift.FunctionName_key where
+  toQName (Thrift.FunctionName_key service name ) = do
+    eName <- toQName =<< Glean.keyOf service
+    case eName of
+      Left err -> pure (Left err)
+      Right (service, _ ) -> do
+        str <- Glean.keyOf name
+        return $ Right (Name str, service)
+
+instance ToQName Thrift.Constant_key where
+  toQName (Thrift.Constant_key qname ) = do
+    toQName =<< Glean.keyOf qname
+
+instance ToQName Thrift.EnumValue_key where
+  toQName (Thrift.EnumValue_key (Thrift.NamedType qname _kind) ident) = do
+    Thrift.QualName_key _file parent <- Glean.keyOf qname
+    name <- Glean.keyOf ident
+    parentName <- Glean.keyOf parent
+    return $ Right (Name name, Name parentName)
+
+instance ToQName Thrift.FieldDecl_key where
+  toQName (Thrift.FieldDecl_key qname _kind ident) = do
+    Thrift.QualName_key _file parent <- Glean.keyOf qname
+    name <- Glean.keyOf ident
+    parentName <- Glean.keyOf parent
+    return $ Right (Name name, Name parentName)
+
+instance ToQName Thrift.QualName_key where
+  toQName (Thrift.QualName_key file ident) = do
+    path <- Glean.keyOf =<< Glean.keyOf file
+    let parent = case pathFragments path of
+          [] -> ""
+          xs -> let f = last xs in fromMaybe f (stripSuffix ".thrift" f)
+    str <- Glean.keyOf ident
+    return (Right (Name str, Name parent))
diff --git a/glean/glass/Glean/Glass/SymbolId/Flow.hs b/glean/glass/Glean/Glass/SymbolId/Flow.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Flow.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Flow ( {- instances -} ) where
+
+import Data.Text ( stripSuffix, intercalate, Text )
+import Data.Hashable
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Glass.SymbolId.Class
+
+import qualified Glean.Schema.Flow.Types as Flow
+import qualified Glean.Schema.Src.Types as Src
+
+import Glean.Glass.Utils
+import Glean.Glass.Base ( GleanPath(..))
+import Glean.Glass.Types ( Name(..) )
+import qualified Haxl.Core.Memo as Haxl
+
+import Glean.Schema.CodeFlow.Types as Flow ( Entity(..) )
+
+instance Symbol Flow.Entity where
+  toSymbol e = case e of
+    Flow.Entity_decl decl -> toSymbol decl
+    Flow.Entity_module_ module_ -> do
+      symId <- toSymbolPredicate module_
+      case symId of
+        [_] -> return symId -- keep Haste or string_ module symIds neat
+        _ -> return ("m" : symId)
+    Flow.Entity_EMPTY -> return []
+
+instance Symbol Flow.SomeDeclaration where
+  toSymbol e = case e of
+    Flow.SomeDeclaration_localDecl decl -> toSymbolPredicate decl
+    Flow.SomeDeclaration_memberDecl member -> toSymbolPredicate member
+    Flow.SomeDeclaration_typeDecl type_ -> toSymbolPredicate type_
+    Flow.SomeDeclaration_EMPTY -> return []
+
+-- flow declarations are a bare name and a `Range`, which can be a module or
+-- other location
+instance Symbol Flow.Declaration_key where
+  toSymbol (Flow.Declaration_key name loc_range) = loc_range <:> name
+
+instance Symbol Flow.MemberDeclaration_key where
+  toSymbol (Flow.MemberDeclaration_key name container) = container <:> name
+
+instance Symbol Flow.TypeDeclaration_key where
+  toSymbol (Flow.TypeDeclaration_key name container) = container <:> name
+
+instance Symbol Flow.Range where
+  toSymbol = toSymbolPredicate
+
+instance Symbol Flow.Range_key where
+  toSymbol (Flow.Range_key module_ _span) = toSymbolPredicate module_
+
+instance Symbol Flow.Module_key where
+  toSymbol m = case m of
+    Flow.Module_key_file file -> memoModuleNameQuery file
+    Flow.Module_key_builtin _ -> return []
+    Flow.Module_key_lib text -> return [text]
+    Flow.Module_key_noSource _ -> return []
+    Flow.Module_key_string_ text -> return [text]
+    Flow.Module_key_EMPTY -> return []
+
+instance Symbol Flow.Name where
+  toSymbol k = do
+    v <- Glean.keyOf k
+    return [v]
+
+newtype Glass_SymbolId_Flow_ModuleName_Key =
+    Glass_SymbolId_Flow_ModuleName_Key (Glean.Repo, Text)
+  deriving (Eq, Hashable, Ord, Show)
+
+-- | Memoize the result of figuring out the best short name for a file
+-- since this is common to all symbols in a file it can be a good win.
+memoModuleNameQuery :: Src.File -> Glean.RepoHaxl u w [Text]
+memoModuleNameQuery file = do
+  repo <- Glean.haxlRepo
+  key <- Glean.keyOf file
+  Haxl.memo (Glass_SymbolId_Flow_ModuleName_Key (repo, key)) $
+    runModuleNameQuery file
+
+-- Need to encode the module as a "container". For most (?) cases
+-- there is a nice short string associated with the file, so we get
+-- ww/js/Module/identifier and unique globally (?)
+--
+-- But in case we don't , use the file name.
+--
+-- T90301808 - Haste short names are not always present. In the case they
+-- are missing we should use the fully qualified filepath. Note: this will leak
+-- the non-relative paths used in the www indexers. TBD
+--
+runModuleNameQuery :: Src.File -> Glean.RepoHaxl u w [Text]
+runModuleNameQuery file = do
+  mfile <- toJSFile file
+  names <- case mfile of
+    -- its not a .js.flow file so we already have a valid fact id
+    Nothing -> fetchData (moduleStringName $ Glean.getId file)
+    -- try for a .js equivalent
+    Just path -> fetchData (moduleStringNameByFile path)
+  case names of
+    Nothing -> pathFragments <$> Glean.keyOf file
+    Just n -> return [n]
+
+-- Normalize any .flow suffix of a file to its base .js file
+--
+-- A smarter way would be to reverse the SourceOfTypeExport for .flow files
+--
+toJSFile :: Src.File -> Glean.RepoHaxl u w (Maybe GleanPath)
+toJSFile file = do
+  path <- Glean.keyOf file
+  return $ GleanPath <$> stripSuffix flowSuffix path
+  where
+    flowSuffix :: Text
+    flowSuffix = ".flow"
+
+-- Flow module name of file id of module
+moduleStringName :: Glean.IdOf Src.File -> Angle Text
+moduleStringName fileid =
+  vars $ \(str :: Angle Text) (file :: Angle Src.File) ->
+  str `where_` [
+    file .= factId fileid,
+    wild .= predicate @Flow.FileOfStringModule (
+      rec $
+        field @"file" (asPredicate file) $
+        field @"string_" str
+      end)
+  ]
+
+-- Flow module name of file path of module
+moduleStringNameByFile :: GleanPath -> Angle Text
+moduleStringNameByFile (GleanPath path) =
+  vars $ \(str :: Angle Text) (file :: Angle Src.File) ->
+  str `where_` [
+    file .= predicate @Src.File (string path),
+    wild .= predicate @Flow.FileOfStringModule (
+      rec $
+        field @"file" (asPredicate file) $
+        field @"string_" str
+      end)
+  ]
+
+instance ToQName Flow.Entity where
+  toQName e = case e of
+    Flow.Entity_decl x -> toQName x
+    Flow.Entity_module_ x -> Glean.keyOf x >>= toQName
+    Flow.Entity_EMPTY -> return $ Left "unknown Entity"
+
+instance ToQName Flow.SomeDeclaration where
+  toQName e = case e of
+    Flow.SomeDeclaration_localDecl x -> Glean.keyOf x >>= toQName
+    Flow.SomeDeclaration_memberDecl x -> Glean.keyOf x >>= toQName
+    Flow.SomeDeclaration_typeDecl x -> Glean.keyOf x >>= toQName
+    Flow.SomeDeclaration_EMPTY -> return $ Left "unknown SomeDeclaration"
+
+instance ToQName Flow.Declaration_key where
+  toQName (Flow.Declaration_key name container) = pairToQName name container
+
+instance ToQName Flow.MemberDeclaration_key where
+  toQName (Flow.MemberDeclaration_key name container) = pairToQName name container
+
+instance ToQName Flow.TypeDeclaration_key where
+  toQName (Flow.TypeDeclaration_key name container) = pairToQName name container
+
+instance ToQName Flow.Module_key where
+  toQName m = do
+    sym <- toSymbol m
+    return $ case reverse sym of
+      [] -> Left "QName not supported for this symbol"
+      (h:t) -> Right (Name h, Name (intercalate "." (reverse t)))
+
+pairToQName
+  :: (Symbol name, Symbol container)
+  => name
+  -> container
+  -> Glean.RepoHaxl u w (Either a (Name, Name))
+pairToQName a b = Right <$> symbolPairToQName "." a b
diff --git a/glean/glass/Glean/Glass/SymbolId/GraphQL.hs b/glean/glass/Glean/Glass/SymbolId/GraphQL.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/GraphQL.hs
@@ -0,0 +1,126 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.GraphQL
+  ({- instances -})
+  where
+
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Utils
+import Glean.Glass.Types (Name(..))
+
+import qualified Glean.Schema.CodeGraphql.Types as GraphQL
+import qualified Glean.Schema.Graphql.Types as GraphQL
+import qualified Glean.Schema.Src.Types as Src
+
+import qualified Glean
+import Glean.Angle as Angle
+
+instance Symbol GraphQL.Entity where
+    toSymbol x = case x of
+        GraphQL.Entity_decl d -> toSymbol d
+        GraphQL.Entity_EMPTY -> return []
+
+instance Symbol GraphQL.Declaration where
+    toSymbol x = case x of
+        GraphQL.Declaration_operation_ o -> toSymbolPredicate o
+        GraphQL.Declaration_fragment_ f -> toSymbolPredicate f
+        GraphQL.Declaration_field_ f -> toSymbolPredicate f
+        GraphQL.Declaration_enum_ e -> toSymbolPredicate e
+        GraphQL.Declaration_directive_ d -> toSymbolPredicate d
+        GraphQL.Declaration_EMPTY{} -> return []
+
+instance Symbol GraphQL.Operation_key where
+    toSymbol GraphQL.Operation_key{..} = do
+        name <- Glean.keyOf operation_key_name
+        return ["o", name]
+
+instance Symbol GraphQL.Fragment_key where
+    toSymbol GraphQL.Fragment_key{..} = do
+        name <- Glean.keyOf fragment_key_name
+        return [name]
+
+instance Symbol GraphQL.FieldDef_key where
+    toSymbol GraphQL.FieldDef_key{..} = do
+        name <- Glean.keyOf fieldDef_key_name
+        return ["f", name]
+
+instance Symbol GraphQL.EnumTypeDef_key where
+    toSymbol GraphQL.EnumTypeDef_key{..} = do
+        name <- Glean.keyOf enumTypeDef_key_name
+        return ["e", name]
+
+instance Symbol GraphQL.DirectiveDef_key where
+    toSymbol GraphQL.DirectiveDef_key{..} = do
+        name <- Glean.keyOf directiveDef_key_name
+        return ["d", name]
+
+instance ToQName GraphQL.Entity where
+    toQName e = case e of
+        GraphQL.Entity_decl d -> toQName d
+        GraphQL.Entity_EMPTY -> return $ Left "unknown GraphQL.Entity"
+
+instance ToQName GraphQL.Declaration where
+    toQName e = case e of
+        GraphQL.Declaration_operation_ o -> Glean.keyOf o >>= toQName
+        GraphQL.Declaration_fragment_ f -> Glean.keyOf f >>= toQName
+        GraphQL.Declaration_field_ f -> Glean.keyOf f >>= toQName
+        GraphQL.Declaration_enum_ e -> Glean.keyOf e >>= toQName
+        GraphQL.Declaration_directive_ d -> Glean.keyOf d >>= toQName
+        GraphQL.Declaration_EMPTY{} ->
+            return $ Left "unknown GraphQL.Declaration"
+
+instance ToQName GraphQL.Operation_key where
+    toQName GraphQL.Operation_key{..} = do
+        name <- Glean.keyOf operation_key_name
+        let Src.FileLocation{..} = operation_key_loc
+        mconfig <- fetchData (buildConfig (Glean.getId fileLocation_file))
+        case mconfig of
+            Just c -> do
+                config <- Glean.keyOf c
+                return $ Right (Name name, Name config)
+            Nothing -> return $ Right (Name name, Name "")
+
+instance ToQName GraphQL.Fragment_key where
+    toQName GraphQL.Fragment_key{..} = do
+        name <- Glean.keyOf fragment_key_name
+        let Src.FileLocation{..} = fragment_key_loc
+        mconfig <- fetchData (buildConfig (Glean.getId fileLocation_file))
+        case mconfig of
+            Just c -> do
+                config <- Glean.keyOf c
+                return $ Right (Name name, Name config)
+            Nothing -> return $ Right (Name name, Name "")
+
+instance ToQName GraphQL.FieldDef_key where
+    toQName GraphQL.FieldDef_key{..} = do
+        name <- Glean.keyOf fieldDef_key_name
+        return $ Right (Name name, Name "")
+
+instance ToQName GraphQL.EnumTypeDef_key where
+    toQName GraphQL.EnumTypeDef_key{..} = do
+        name <- Glean.keyOf enumTypeDef_key_name
+        return $ Right (Name name, Name "")
+
+instance ToQName GraphQL.DirectiveDef_key where
+    toQName GraphQL.DirectiveDef_key{..} = do
+        name <- Glean.keyOf directiveDef_key_name
+        return $ Right (Name name, Name "")
+
+buildConfig :: Glean.IdOf Src.File -> Angle GraphQL.Value
+buildConfig fileId = var $ \config ->
+    config `where_` [
+        wild .= predicate @GraphQL.BelongToConfig (
+            rec $
+                field @"file" (asPredicate (factId fileId)) $
+                field @"buildConfig" (asPredicate config)
+            end)
+    ]
diff --git a/glean/glass/Glean/Glass/SymbolId/Hack.hs b/glean/glass/Glean/Glass/SymbolId/Hack.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Hack.hs
@@ -0,0 +1,255 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Hack (
+    {- instances and -} hackGlobalNamespaceAliases
+  ) where
+
+import Control.Monad (forM)
+import qualified Data.Map.Strict as Map
+import Data.Text (Text, intercalate)
+import Data.Hashable
+
+import qualified Glean
+
+import Glean.Angle
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Types (Name(..))
+import Glean.Haxl.Repos (RepoHaxl)
+import qualified Glean.Glass.Utils as Utils
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Haxl.Core.Memo as Haxl
+
+--
+-- Hack language name boilerplate
+--
+instance Symbol Hack.Declaration where
+  toSymbol e = case e of
+    Hack.Declaration_method x -> toSymbolPredicate x
+    Hack.Declaration_enumerator x -> toSymbolPredicate x
+    Hack.Declaration_container x -> toSymbol x
+    Hack.Declaration_function_ x -> toSymbolPredicate x
+    Hack.Declaration_classConst x -> toSymbolPredicate x
+    Hack.Declaration_property_ x -> toSymbolPredicate x
+    Hack.Declaration_typeConst x -> toSymbolPredicate x
+    Hack.Declaration_globalConst x -> toSymbolPredicate x
+    Hack.Declaration_namespace_ x -> toSymbolPredicate x
+    Hack.Declaration_typedef_ x -> toSymbolPredicate x
+    Hack.Declaration_module x -> toSymbolPredicate x
+    Hack.Declaration_EMPTY -> return []
+
+instance Symbol Hack.TypeConstDeclaration_key where
+  toSymbol (Hack.TypeConstDeclaration_key name container) = container <:> name
+
+instance Symbol Hack.PropertyDeclaration_key where
+  toSymbol (Hack.PropertyDeclaration_key name container) = do
+    xs <- toSymbol container
+    x <- (":prop" :) <$> toSymbol name
+    return $ xs ++ x
+
+instance Symbol Hack.ClassConstDeclaration_key where
+  toSymbol (Hack.ClassConstDeclaration_key name container) = container <:> name
+
+instance Symbol Hack.MethodDeclaration_key where
+  toSymbol (Hack.MethodDeclaration_key name container) = container <:> name
+
+instance Symbol Hack.ModuleDeclaration_key where
+  toSymbol (Hack.ModuleDeclaration_key name) =  ("module" :) <$> toSymbol name
+
+instance Symbol Hack.EnumDeclaration_key where
+  toSymbol (Hack.EnumDeclaration_key qn) = toSymbol qn
+
+instance Symbol Hack.EnumDeclaration where
+  toSymbol k = Glean.keyOf k >>= toSymbol
+
+instance Symbol Hack.Enumerator_key where
+  toSymbol (Hack.Enumerator_key name decl) = decl <:> name
+
+instance Symbol Hack.FunctionDeclaration_key where
+  toSymbol (Hack.FunctionDeclaration_key qn) =  ("fun" :) <$> toSymbol qn
+
+instance Symbol Hack.ContainerDeclaration where
+  toSymbol (Hack.ContainerDeclaration_class_ c) = toSymbolPredicate c
+  toSymbol (Hack.ContainerDeclaration_enum_ c) = toSymbolPredicate c
+  toSymbol (Hack.ContainerDeclaration_interface_ c) = toSymbolPredicate c
+  toSymbol (Hack.ContainerDeclaration_trait c) = toSymbolPredicate c
+  toSymbol Hack.ContainerDeclaration_EMPTY = return []
+
+instance Symbol Hack.ClassDeclaration_key where
+  toSymbol (Hack.ClassDeclaration_key qn) = toSymbol qn
+
+instance Symbol Hack.InterfaceDeclaration_key where
+  toSymbol (Hack.InterfaceDeclaration_key qn) = toSymbol qn
+
+instance Symbol Hack.TraitDeclaration_key where
+  toSymbol (Hack.TraitDeclaration_key qn) = toSymbol qn
+
+instance Symbol Hack.TypedefDeclaration_key where
+  toSymbol (Hack.TypedefDeclaration_key qn) = toSymbol qn
+
+instance Symbol Hack.NamespaceDeclaration_key where
+  toSymbol (Hack.NamespaceDeclaration_key qn) = ("ns" :) <$> toSymbol qn
+
+instance Symbol Hack.NamespaceDeclaration where
+  toSymbol k = Glean.keyOf k >>= toSymbol
+
+instance Symbol Hack.NamespaceQName where
+  toSymbol k = Glean.keyOf k >>= toSymbol
+
+instance Symbol Hack.NamespaceQName_key where
+  toSymbol (Hack.NamespaceQName_key name parent) = parent <:> name
+
+instance Symbol Hack.GlobalConstDeclaration_key where
+  toSymbol (Hack.GlobalConstDeclaration_key qn) = ("const" :) <$> toSymbol qn
+
+instance Symbol Hack.QName where
+  toSymbol k = Glean.keyOf k >>= toSymbol
+
+instance Symbol Hack.QName_key where
+  toSymbol (Hack.QName_key name Nothing) = toSymbol name
+  toSymbol (Hack.QName_key name (Just ns)) = ns <:> name
+
+instance Symbol Hack.Name where
+  toSymbol k = do
+    v <- Glean.keyOf k
+    return [v]
+
+--
+-- And searching for Hack Entities
+--
+
+instance ToQName Hack.Declaration where
+  toQName e = case e of
+    Hack.Declaration_classConst x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_container x -> toQName x
+    Hack.Declaration_enumerator x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_function_ x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_globalConst x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_method x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_module x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_namespace_ x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_property_ x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_typeConst x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_typedef_ x -> Glean.keyOf x >>= toQName
+    Hack.Declaration_EMPTY -> return $ Left "unknown Declaration"
+
+instance ToQName Hack.ClassConstDeclaration_key where
+  toQName (Hack.ClassConstDeclaration_key name container) =
+    Right <$> symbolPairToQName "\\" name container
+
+instance ToQName Hack.ModuleDeclaration_key where
+  toQName (Hack.ModuleDeclaration_key name) =
+      Right . (, Name "") . Name . intercalate "/" <$> toSymbol name
+
+instance ToQName Hack.ContainerDeclaration where
+  toQName (Hack.ContainerDeclaration_class_ x) = Glean.keyOf x >>= toQName
+  toQName (Hack.ContainerDeclaration_enum_ x) = Glean.keyOf x >>= toQName
+  toQName (Hack.ContainerDeclaration_interface_ x) = Glean.keyOf x >>= toQName
+  toQName (Hack.ContainerDeclaration_trait x) = Glean.keyOf x >>= toQName
+  toQName Hack.ContainerDeclaration_EMPTY =
+    return $ Left "unknown ContainerDeclaration"
+
+instance ToQName Hack.EnumDeclaration_key where
+  toQName (Hack.EnumDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.Enumerator_key where
+  toQName (Hack.Enumerator_key name container) =
+    Right <$> symbolPairToQName "\\" name container
+
+instance ToQName Hack.TypeConstDeclaration_key where
+  toQName (Hack.TypeConstDeclaration_key name container) =
+    Right <$> symbolPairToQName "\\" name container
+
+instance ToQName Hack.GlobalConstDeclaration_key where
+  toQName (Hack.GlobalConstDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.PropertyDeclaration_key where
+  toQName (Hack.PropertyDeclaration_key name container) =
+    Right <$> symbolPairToQName "\\" name container
+
+instance ToQName Hack.MethodDeclaration_key where
+  toQName (Hack.MethodDeclaration_key name container) =
+    Right <$> symbolPairToQName "\\" name container
+
+instance ToQName Hack.FunctionDeclaration_key where
+  toQName (Hack.FunctionDeclaration_key qname) = toQName qname
+
+instance ToQName Hack.ClassDeclaration_key where
+  toQName (Hack.ClassDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.InterfaceDeclaration_key where
+  toQName (Hack.InterfaceDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.TraitDeclaration_key where
+  toQName (Hack.TraitDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.TypedefDeclaration_key where
+  toQName (Hack.TypedefDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.NamespaceDeclaration_key where
+  toQName (Hack.NamespaceDeclaration_key qn) = toQName qn
+
+instance ToQName Hack.NamespaceQName where
+  toQName nsqname@Hack.NamespaceQName{} = do
+    mShort <- Map.lookup (Glean.getId nsqname) <$> hackGlobalNamespaceAliases
+    case mShort of -- exact key is an alias (e.g. FlibSL\Vec)
+      Just name -> return $ Right (Name name, Name "")
+      Nothing -> Glean.keyOf nsqname >>= toQName -- break it apart and try again
+
+instance ToQName Hack.NamespaceQName_key where
+  toQName (Hack.NamespaceQName_key name Nothing) = do
+    nameStr <- Name <$> Glean.keyOf name
+    return $ Right (nameStr, Name "")
+  toQName (Hack.NamespaceQName_key name (Just parent)) = do
+    nameStr <- Name <$> Glean.keyOf name
+    mParent <- toQName parent -- might need to shorten
+    return $ case mParent of
+      Right (parentName, Name "") -> Right (nameStr, parentName)
+      Right (Name p, Name ps) -> Right (nameStr, Name (ps <> "\\" <> p))
+      Left e -> Left e
+
+instance ToQName Hack.QName where
+  toQName x = Glean.keyOf x >>= toQName
+
+instance ToQName Hack.QName_key where
+  toQName (Hack.QName_key name Nothing) = do
+    nameStr <- Name <$> Glean.keyOf name
+    return $ Right (nameStr, Name "")
+  toQName (Hack.QName_key name (Just nsqname)) = do
+    nameStr <- Name <$> Glean.keyOf name
+    mParent <- toQName nsqname
+    return $ case mParent of
+      Right (parentName, Name "") -> Right (nameStr, parentName)
+      Right (Name p, Name ps) -> Right (nameStr, Name (ps <> "\\" <> p))
+      Left e -> Left e
+
+newtype Glass_SymbolId_Hack_ShortNamespace_Key =
+    Glass_SymbolId_Hack_ShortNamespace_Key (Glean.Repo, Text)
+  deriving (Eq, Hashable, Ord, Show)
+
+-- Memoize implementation of short namespace lookup
+--
+hackGlobalNamespaceAliases
+  :: RepoHaxl u w (Map.Map (Glean.IdOf Hack.NamespaceQName) Text)
+hackGlobalNamespaceAliases = do
+  repo <- Glean.haxlRepo -- use repo as memo hash as we store Ids
+  Haxl.memo (Glass_SymbolId_Hack_ShortNamespace_Key
+      (repo, "Glean.Glass.SymbolId.Hack"::Text)) $ do
+    (pairs,_lim) <- Utils.searchRecursiveWithLimit (Just maxMappings) query
+    Map.fromList <$> forM pairs (\alias -> do
+        Hack.GlobalNamespaceAlias_key{..} <- Glean.keyOf alias
+        let nsQName = Glean.getId globalNamespaceAlias_key_to
+        shortName <- Glean.keyOf globalNamespaceAlias_key_from
+        return (nsQName, shortName)
+      )
+  where
+    query = predicate @Hack.GlobalNamespaceAlias wild
+    maxMappings = 100 -- there's only about 15 actually
diff --git a/glean/glass/Glean/Glass/SymbolId/Hs.hs b/glean/glass/Glean/Glass/SymbolId/Hs.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Hs.hs
@@ -0,0 +1,86 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Hs ({- instances -}) where
+
+import Data.Char
+import qualified Data.Text as Text
+import TextShow
+
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Types (Name(..))
+import Glean.Schema.CodeHs.Types as Hs (Entity(..))
+import qualified Glean
+import qualified Glean.Schema.Hs.Types as Hs
+import qualified Glean.Schema.Src.Types as Src
+
+-- REPO/hs/containers/Data/Map/{var|datacon|tyvar|tycon}/toList[/START/END]
+
+instance Symbol Hs.Entity where
+  toSymbol (Hs.Entity_name x) = toSymbolPredicate x
+  toSymbol (Hs.Entity_mod x) = toSymbolPredicate x
+  toSymbol _ = error "toSymbol: unknown Hs.Entity"
+
+instance Symbol Hs.Name_key where
+  toSymbol (Hs.Name_key occ mod sort) = do
+    m <- toSymbol mod
+    o <- toSymbol occ
+    s <- toSymbol sort
+    return $ m <> o <> s
+
+instance Symbol Hs.Module where
+  toSymbol = toSymbolPredicate
+
+instance Symbol Hs.OccName where
+  toSymbol = toSymbolPredicate
+
+instance Symbol Hs.Module_key where
+  toSymbol (Hs.Module_key name unit) = do
+    u <- Glean.keyOf unit
+    n <- Glean.keyOf name
+    -- unit names are things like glean-0.1.0.0-inplace-core
+    -- let's strip the version and everything after it
+    let pkg = Text.intercalate "-" (fst (break isVer (Text.splitOn "-" u)))
+    return (pkg : Text.splitOn "." n)
+    where
+    isVer t
+      | Just (d, _) <- Text.uncons t = isDigit d
+      | otherwise = False
+
+instance Symbol Hs.OccName_key where
+  toSymbol (Hs.OccName_key name namespace) = do
+    let sp = case namespace of
+          Hs.Namespace_var_ -> "var"
+          Hs.Namespace_datacon -> "con"
+          Hs.Namespace_tyvar -> "tyvar"
+          Hs.Namespace_tycon -> "ty"
+          _ -> error "namespace"
+    return [sp,name]
+
+instance Symbol Hs.NameSort where
+  toSymbol Hs.NameSort_external{} = return []
+  toSymbol (Hs.NameSort_internal (Src.ByteSpan start end)) =
+    return [showt (Glean.fromNat start), showt (Glean.fromNat end)]
+  toSymbol _ = error "toSymbol: unknown Hs.NameSort"
+
+instance ToQName Hs.Entity where
+  toQName (Hs.Entity_name n) = Glean.keyOf n >>= toQName
+  toQName (Hs.Entity_mod mod) = do
+    Hs.Module_key m _ <- Glean.keyOf mod
+    modname <- Glean.keyOf m
+    return $ Right (Name modname, Name "")
+  toQName _ = error "ToQName: unknown Hs.Entity"
+
+instance ToQName Hs.Name_key where
+  toQName (Hs.Name_key occ mod _) = do
+    Hs.Module_key m _ <- Glean.keyOf mod
+    modname <- Glean.keyOf m
+    Hs.OccName_key n _ <- Glean.keyOf occ
+    return $ Right (Name n, Name modname)
diff --git a/glean/glass/Glean/Glass/SymbolId/Java.hs b/glean/glass/Glean/Glass/SymbolId/Java.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Java.hs
@@ -0,0 +1,252 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Java (
+    flattenPath
+    {- instances -}
+
+  ) where
+
+import qualified Glean
+import Glean.Glass.Types
+import Glean.Glass.SymbolId.Class
+import Glean.Haxl.Repos (RepoHaxl)
+import Data.Text ( Text )
+import qualified Data.Text as Text
+
+import qualified Glean.Schema.CodeJava.Types as Java
+import qualified Glean.Schema.CodeKotlin.Types as Kotlin
+import qualified Glean.Schema.JavaAlpha.Types as Java
+import qualified Glean.Schema.KotlinAlpha.Types as Kotlin
+import qualified Glean.Schema.JavakotlinAlpha.Types as JavaKotlin
+
+instance Symbol Java.Entity where
+  toSymbol e = case e of
+    Java.Entity_decl d -> toSymbol d
+    Java.Entity_EMPTY -> return []
+
+instance Symbol Kotlin.Entity where
+  toSymbol e = case e of
+    Kotlin.Entity_decl d -> toSymbol d
+    Kotlin.Entity_EMPTY -> return []
+
+instance Symbol Java.Declaration where
+  toSymbol e = case e of
+    Java.Declaration_class_ c -> toSymbolPredicate c
+    Java.Declaration_interface_ i -> toSymbolPredicate i
+    Java.Declaration_enum_ e -> toSymbolPredicate e
+    Java.Declaration_method e -> toSymbolPredicate e
+    Java.Declaration_ctor e -> toSymbolPredicate e
+    Java.Declaration_local e -> toSymbolPredicate e
+    Java.Declaration_field e -> toSymbolPredicate e
+    Java.Declaration_param e -> toSymbolPredicate e
+    Java.Declaration_EMPTY -> return []
+
+instance Symbol Kotlin.Declaration where
+  toSymbol e = case e of
+    Kotlin.Declaration_class_ c -> toSymbolPredicate c
+    Kotlin.Declaration_method e -> toSymbolPredicate e
+    Kotlin.Declaration_variable e -> toSymbolPredicate e
+    Kotlin.Declaration_EMPTY -> return []
+
+instance Symbol Java.ClassDeclaration_key where
+  toSymbol Java.ClassDeclaration_key{..} =
+    toSymbolPredicate classDeclaration_key_name
+
+instance Symbol Kotlin.ClassDeclaration_key where
+  toSymbol Kotlin.ClassDeclaration_key{..} =
+    toSymbolPredicate classDeclaration_key_name
+
+instance Symbol Java.InterfaceDeclaration_key where
+  toSymbol Java.InterfaceDeclaration_key{..} =
+    toSymbolPredicate interfaceDeclaration_key_name
+
+instance Symbol Java.EnumDeclaration_key where
+  toSymbol Java.EnumDeclaration_key{..} =
+    toSymbolPredicate enumDeclaration_key_name
+
+instance Symbol Java.MethodDeclaration_key where
+  toSymbol Java.MethodDeclaration_key{..} =
+    toSymbolPredicate methodDeclaration_key_name
+
+instance Symbol Kotlin.MethodDeclaration_key where
+  toSymbol Kotlin.MethodDeclaration_key{..} =
+    toSymbolPredicate methodDeclaration_key_name
+
+instance Symbol Java.ConstructorDeclaration_key where
+  toSymbol Java.ConstructorDeclaration_key{..} =
+    toSymbolPredicate constructorDeclaration_key_name
+
+instance Symbol Java.LocalDeclaration_key where
+  toSymbol Java.LocalDeclaration_key{..} =
+    toSymbolPredicate localDeclaration_key_name
+
+instance Symbol Java.FieldDeclaration_key where
+  toSymbol Java.FieldDeclaration_key{..} =
+    toSymbolPredicate fieldDeclaration_key_name
+
+instance Symbol Java.ParameterDeclaration_key where
+  toSymbol Java.ParameterDeclaration_key{..} =
+    toSymbolPredicate parameterDeclaration_key_name
+
+instance Symbol Kotlin.VariableDeclaration_key where
+  toSymbol Kotlin.VariableDeclaration_key{..} =
+    toSymbolPredicate variableDeclaration_key_name
+
+--
+-- generic to both Java and Kotlin
+--
+
+instance Symbol JavaKotlin.MethodName_key where
+  toSymbol JavaKotlin.MethodName_key{..} = do
+    qname <- toSymbolPredicate methodName_key_name
+    types <- mapM encodeType methodName_key_signature
+    return $ case types of
+      [] -> qname
+      _ -> qname ++ (".t" : types)
+
+instance Symbol JavaKotlin.Path_key where
+  toSymbol JavaKotlin.Path_key{..} = path_key_container <:> path_key_base
+
+instance Symbol JavaKotlin.Path where
+  toSymbol path = toSymbol =<< Glean.keyOf path
+
+instance Symbol JavaKotlin.QName_key where
+  toSymbol JavaKotlin.QName_key{..} = qName_key_context <:> qName_key_name
+
+instance Symbol JavaKotlin.Name where
+  toSymbol name = (:[]) <$> Glean.keyOf name
+
+--
+-- symbol ids for overloading: encode parameter types
+--
+encodeType :: JavaKotlin.Type -> RepoHaxl u w Text
+encodeType ty = do
+  key <- Glean.keyOf ty
+  case key of
+    JavaKotlin.Type_key_primitive prim -> return prim
+
+    JavaKotlin.Type_key_object path -> do
+      Text.intercalate "." . reverse <$> (flattenPath =<< Glean.keyOf path)
+
+    JavaKotlin.Type_key_array ty -> do
+      textTy <- encodeType ty
+      return (textTy <> "[]")
+    JavaKotlin.Type_key_EMPTY{} -> return "<unknown>"
+
+--
+-- names
+--
+
+instance ToQName Java.Entity where
+  toQName e = case e of
+    Java.Entity_decl d -> toQName d
+    Java.Entity_EMPTY -> return $ Left "unknown Java.Entity"
+
+instance ToQName Kotlin.Entity where
+  toQName e = case e of
+    Kotlin.Entity_decl d -> toQName d
+    Kotlin.Entity_EMPTY -> return $ Left "unknown Kotlin.Entity"
+
+instance ToQName Java.Declaration where
+  toQName d = case d of
+    Java.Declaration_enum_ e -> Glean.keyOf e >>= toQName
+    Java.Declaration_class_ e -> Glean.keyOf e >>= toQName
+    Java.Declaration_interface_ e -> Glean.keyOf e >>= toQName
+    Java.Declaration_method e -> Glean.keyOf e >>= toQName
+    Java.Declaration_ctor e -> Glean.keyOf e >>= toQName
+    Java.Declaration_field e -> Glean.keyOf e >>= toQName
+    Java.Declaration_local e -> Glean.keyOf e >>= toQName
+    Java.Declaration_param e -> Glean.keyOf e >>= toQName
+    Java.Declaration_EMPTY -> return $ Left "Unknown Java.Declaration type"
+
+instance ToQName Kotlin.Declaration where
+  toQName d = case d of
+    Kotlin.Declaration_class_ e -> Glean.keyOf e >>= toQName
+    Kotlin.Declaration_method e -> Glean.keyOf e >>= toQName
+    Kotlin.Declaration_variable e -> Glean.keyOf e >>= toQName
+    Kotlin.Declaration_EMPTY -> return $ Left "Unknown Kotlin.Declaration type"
+
+instance ToQName Java.ClassDeclaration_key where
+  toQName Java.ClassDeclaration_key{..} =
+    Glean.keyOf classDeclaration_key_name >>= toQName
+
+instance ToQName Kotlin.ClassDeclaration_key where
+  toQName Kotlin.ClassDeclaration_key{..} =
+    Glean.keyOf classDeclaration_key_name >>= toQName
+
+instance ToQName Java.InterfaceDeclaration_key where
+  toQName Java.InterfaceDeclaration_key{..} =
+    Glean.keyOf interfaceDeclaration_key_name >>= toQName
+
+instance ToQName Java.EnumDeclaration_key where
+  toQName Java.EnumDeclaration_key{..} =
+    Glean.keyOf enumDeclaration_key_name >>= toQName
+
+instance ToQName Java.MethodDeclaration_key where
+  toQName Java.MethodDeclaration_key{..} =
+    Glean.keyOf methodDeclaration_key_name >>= toQName
+
+instance ToQName Kotlin.MethodDeclaration_key where
+  toQName Kotlin.MethodDeclaration_key{..} =
+    Glean.keyOf methodDeclaration_key_name >>= toQName
+
+-- ctor qnames are indexed as "<init>" but should be the parent name + sig
+instance ToQName Java.ConstructorDeclaration_key where
+  toQName Java.ConstructorDeclaration_key{..} = do
+    parentName <- case constructorDeclaration_key_container of
+      Java.Definition_class_ cdecl -> toQName =<< Glean.keyOf cdecl
+      Java.Definition_interface_ idecl -> toQName =<< Glean.keyOf idecl
+      Java.Definition_enum_ edecl -> toQName =<< Glean.keyOf edecl
+      Java.Definition_EMPTY -> return $
+        Left "Java constructor with no parent container"
+    case parentName of
+      Left _err -> Glean.keyOf constructorDeclaration_key_name >>= toQName
+      Right (Name n, Name rest) -> return $
+        Right (Name n, Name (rest <> "." <> n))
+
+instance ToQName Java.LocalDeclaration_key where
+  toQName Java.LocalDeclaration_key{..} =
+    Glean.keyOf localDeclaration_key_name >>= toQName
+
+instance ToQName Java.FieldDeclaration_key where
+  toQName Java.FieldDeclaration_key{..} =
+    Glean.keyOf fieldDeclaration_key_name >>= toQName
+
+instance ToQName Java.ParameterDeclaration_key where
+  toQName Java.ParameterDeclaration_key{..} =
+    Glean.keyOf parameterDeclaration_key_name >>= toQName
+
+instance ToQName Kotlin.VariableDeclaration_key where
+  toQName Kotlin.VariableDeclaration_key{..} =
+    Glean.keyOf variableDeclaration_key_name >>= toQName
+
+--
+-- Generic to both Java and Kotlin
+--
+
+instance ToQName JavaKotlin.MethodName_key where
+  toQName JavaKotlin.MethodName_key{..} =
+    Glean.keyOf methodName_key_name >>= toQName
+
+instance ToQName JavaKotlin.QName_key where
+  toQName JavaKotlin.QName_key{..} = do
+    nameStr <- Glean.keyOf qName_key_name
+    context <- flattenPath =<< Glean.keyOf qName_key_context
+    return $ Right (Name nameStr, Name (Text.intercalate "." (reverse context)))
+
+flattenPath :: JavaKotlin.Path_key -> RepoHaxl u w [Text]
+flattenPath JavaKotlin.Path_key{..} = do
+  nameStr <- Glean.keyOf path_key_base
+  case path_key_container of
+    Nothing -> return [nameStr]
+    Just path -> do
+      rest <- flattenPath =<< Glean.keyOf path
+      return (nameStr : rest)
diff --git a/glean/glass/Glean/Glass/SymbolId/LSIF.hs b/glean/glass/Glean/Glass/SymbolId/LSIF.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/LSIF.hs
@@ -0,0 +1,131 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.LSIF ({- instances -}) where
+
+import Control.Monad.Catch ( throwM )
+import Data.Maybe
+import Data.Text ( Text )
+import qualified Data.Text as Text
+import qualified Network.URI.Encode as URI
+import Util.Text ( textShow )
+
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Lsif.Types as Lsif
+import qualified Glean.Schema.LsifTypes.Types as Lsif
+import Glean.Glass.Utils ( pathFragments )
+import Glean.Glass.Types
+
+import Glean.Glass.SymbolId.Class
+
+instance Symbol Lsif.SomeEntity where
+  toSymbol e = case e of
+    Lsif.SomeEntity_defn defn -> toSymbolPredicate defn
+    Lsif.SomeEntity_decl decl -> toSymbolPredicate decl
+    _ -> throwM $ SymbolError "Unknown LSIF case"
+
+instance Symbol Lsif.DefinitionMoniker_key where
+  toSymbol (Lsif.DefinitionMoniker_key defn (Just moniker)) = do
+    Lsif.Moniker_key kind _scheme ident <- Glean.keyOf moniker
+    case kind of
+      -- case 1: locals. case a) no id, just position or b) id + pos
+      Lsif.MonikerKind_Local -> Glean.keyOf defn >>= localsIdent
+
+      -- case 2: non-locals w/ monikers
+      _ -> do -- use the "lsif" tag to indicate symbol is a moniker only
+        i <- Glean.keyOf ident
+        return ("lsif" : pathFragments (URI.decodeText i))
+
+      -- case 3: no monikers at all, use path + global ident and hope for best
+  toSymbol (Lsif.DefinitionMoniker_key defn Nothing) = toSymbolPredicate defn
+
+instance Symbol Lsif.Definition_key where
+  toSymbol (Lsif.Definition_key doc range) = pathAndMaybeName doc range
+
+instance Symbol Lsif.Declaration_key where
+  toSymbol (Lsif.Declaration_key doc range) = pathAndMaybeName doc range
+
+localsIdent :: Lsif.Definition_key -> Glean.RepoHaxl u m [Text]
+localsIdent (Lsif.Definition_key doc range) = pathAndLocalPosition doc range
+
+pathAndLocalPosition :: Lsif.Document -> Lsif.Range -> Glean.RepoHaxl u m [Text]
+pathAndLocalPosition doc range = do
+  path <- filePathOfDocument doc
+  mident <- identOfRange range
+  pos <- positionOfRange range
+  return (path ++ ["<local>"] ++ maybeToList mident ++ pos)
+
+pathAndMaybeName :: Lsif.Document -> Lsif.Range -> Glean.RepoHaxl u m [Text]
+pathAndMaybeName doc range = do
+  path <- filePathOfDocument doc
+  mident <- identOfRange range
+  case mident of
+    Just ident -> return (path ++ [ident])
+    Nothing -> do
+      pos <- positionOfRange range
+      return (path ++ ["<global>"] ++ pos)
+
+filePathOfDocument :: Lsif.Document -> Glean.RepoHaxl u m [Text]
+filePathOfDocument doc = do
+  Lsif.Document_key{..} <- Glean.keyOf doc
+  path <- Glean.keyOf document_key_file
+  return (pathFragments path)
+
+identOfRange :: Lsif.Range -> Glean.RepoHaxl u m (Maybe Text)
+identOfRange range = do
+  Lsif.Range_key{..} <- Glean.keyOf range
+  ident <- Glean.keyOf range_key_text
+  return $ if Text.null ident then Nothing else Just ident
+
+positionOfRange :: Lsif.Range -> Glean.RepoHaxl u m [Text]
+positionOfRange range = do
+  Lsif.Range_key{..} <- Glean.keyOf range
+  pure $ showSpan range_key_range
+
+showSpan :: Lsif.RangeSpan -> [Text]
+showSpan Lsif.RangeSpan{..} = map textShow
+  [Glean.unNat rangeSpan_lineBegin, Glean.unNat rangeSpan_columnBegin
+  ,Glean.unNat rangeSpan_lineEnd, Glean.unNat rangeSpan_columnEnd + 1]
+
+instance ToQName Lsif.SomeEntity where
+  toQName e = case e of
+    Lsif.SomeEntity_defn defn -> Glean.keyOf defn >>= toQName
+    Lsif.SomeEntity_decl decl -> Glean.keyOf decl >>= toQName
+    _ -> throwM $ SymbolError "Unknown LSIF case"
+
+instance ToQName Lsif.DefinitionMoniker_key where
+  toQName (Lsif.DefinitionMoniker_key defn Nothing) =
+    Glean.keyOf defn >>= toQName
+  toQName (Lsif.DefinitionMoniker_key defn (Just moniker)) = do
+    Lsif.Moniker_key kind _scheme ident <- Glean.keyOf moniker
+    base <- symbolName defn
+    fullContainer <- case kind of
+      Lsif.MonikerKind_Local -> "" -- can't use moniker for locals namespace
+      _ -> Glean.keyOf ident
+    let container = fromMaybe fullContainer
+          (Text.stripSuffix (":" <> base) fullContainer)
+    return $ Right (Name base, Name container)
+
+instance ToQName Lsif.Definition_key where
+  toQName (Lsif.Definition_key _ range) = do
+    mid <- identOfRange range
+    return $ Right (Name "", Name (fromMaybe "<unknown>" mid))
+
+instance ToQName Lsif.Declaration_key where
+  toQName (Lsif.Declaration_key _ range) = do
+    mid <- identOfRange range
+    return $ Right (Name "", Name (fromMaybe "<unknown>" mid))
+
+symbolName :: Lsif.Definition -> Glean.RepoHaxl u m Text
+symbolName defn = do
+  Lsif.Definition_key _ range <- Glean.keyOf defn
+  mid <- identOfRange range
+  pure (fromMaybe "<unknown>" mid)
diff --git a/glean/glass/Glean/Glass/SymbolId/Pp.hs b/glean/glass/Glean/Glass/SymbolId/Pp.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Pp.hs
@@ -0,0 +1,89 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.Pp (
+    {- instances -}
+    ppEntityKind
+  ) where
+
+import Data.Text ( Text )
+
+import Glean.Glass.SymbolId.Class
+
+import qualified Glean
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Glass.Utils
+import Glean.Glass.Types as Glass
+
+import qualified Glean.Schema.CodePp.Types as Pp
+import qualified Glean.Schema.Pp1.Types as Pp1
+import qualified Glean.Schema.Src.Types as Src
+
+instance Symbol Pp.Entity where
+  toSymbol e = case e of
+    Pp.Entity_define e -> toSymbolPredicate e
+    Pp.Entity_undef e -> toSymbolPredicate e
+    Pp.Entity_include_ f -> toSymbol f
+    Pp.Entity_EMPTY -> return []
+
+instance Symbol Pp1.Define_key where
+  toSymbol (Pp1.Define_key macro source) =
+    (\x -> "define" : x) <$> toSymbolMacro macro source
+
+instance Symbol Pp1.Undef_key where
+  toSymbol (Pp1.Undef_key macro source) =
+    (\x -> "undef" : x) <$> toSymbolMacro macro source
+
+instance Symbol Src.File where
+  toSymbol k = pathFragments <$> Glean.keyOf k
+
+toSymbolMacro :: Pp1.Macro -> Src.Range -> Glean.RepoHaxl u w [Text]
+toSymbolMacro macro source = do
+  name <- Glean.keyOf macro
+  path <- pathFragments <$> Glean.keyOf (Src.range_file source)
+  return $ path ++ [name]
+
+instance ToSymbolParent Pp1.Define where
+  toSymbolParent _ = return Nothing
+
+instance ToSymbolParent Pp.Entity where
+  toSymbolParent _ = return Nothing
+
+ppEntityKind ::  Pp.Entity -> Glean.RepoHaxl u w (Maybe Glass.SymbolKind)
+ppEntityKind e = case e of
+  Pp.Entity_define{} -> return (Just SymbolKind_Macro)
+  Pp.Entity_undef{} -> return (Just SymbolKind_Macro)
+  Pp.Entity_include_{} -> return (Just SymbolKind_File)
+  Pp.Entity_EMPTY -> return Nothing
+
+instance ToQName Pp.Entity where
+  toQName e = case e of
+    Pp.Entity_define e -> do
+      Pp1.Define_key macro source <- Glean.keyOf e
+      macroQName macro source
+    Pp.Entity_undef e -> do
+      Pp1.Undef_key macro source <- Glean.keyOf e
+      macroQName macro source
+    Pp.Entity_include_ f -> do -- Not sure we need #include entities
+      path <- Glean.keyOf f
+      return $ case reverse (pathFragments path) of
+        [] -> Left "QName not supported for empty #include path"
+        (h:t) -> Right (Name h, Name (joinFragments (reverse t)))
+    Pp.Entity_EMPTY -> return $ Left "unknown code.pp.Entity"
+
+macroQName
+  :: Pp1.Macro -> Src.Range
+  -> Glean.RepoHaxl u w (Either Text (Name, Name))
+macroQName macro source = do
+  toks <- toSymbolMacro macro source
+  return $ case reverse toks of
+    [] -> Left "macroQName: empty"
+    [name] -> Right (Name name, Name "")
+    (name : base : _) -> Right (Name name, Name base)
diff --git a/glean/glass/Glean/Glass/SymbolId/Python.hs b/glean/glass/Glean/Glass/SymbolId/Python.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/Python.hs
@@ -0,0 +1,125 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.SymbolId.Python () where
+
+import Data.Text (Text, splitOn)
+import Data.List (nub)
+import Data.Maybe ( maybeToList )
+
+import qualified Glean
+import Glean.Angle as Angle
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Python.Types as Py
+import Glean.Util.ToAngle
+
+import Glean.Glass.SymbolId.Class
+import Glean.Glass.Types (Name(..))
+import Glean.Glass.Utils ( fetchData )
+
+instance Symbol Py.Name where
+  toSymbol k = do
+    v <- Glean.keyOf k
+    return [v]
+
+instance Symbol Py.Declaration where
+  toSymbol d = do
+    locations <- maybeToList <$> fetchData (declarationLocation $ toAngle d)
+    let loc = case nub $ map (head . splitOn "/") locations of
+              [location] -> location
+              _ -> "."
+    sym <- case d of
+      Py.Declaration_cls x -> toSymbolPredicate x
+      Py.Declaration_func x -> toSymbolPredicate x
+      Py.Declaration_module x -> toSymbolPredicate x
+      Py.Declaration_variable x -> toSymbolPredicate x
+      Py.Declaration_imp x -> toSymbolPredicate x
+      Py.Declaration_EMPTY -> return []
+    return $ loc:sym
+
+instance Symbol Py.ImportStatement_key where
+  toSymbol (Py.ImportStatement_key _ asName) = toSymbol asName
+
+instance Symbol Py.VariableDeclaration_key where
+  toSymbol (Py.VariableDeclaration_key n) = toSymbol n
+
+instance Symbol Py.FunctionDeclaration_key where
+  toSymbol (Py.FunctionDeclaration_key n) = toSymbol n
+
+instance Symbol Py.ClassDeclaration_key where
+  toSymbol (Py.ClassDeclaration_key n _) = toSymbol n
+
+instance Symbol Py.Module_key where
+  toSymbol (Py.Module_key n) = toSymbol n
+
+declarationLocation :: Angle Py.Declaration -> Angle Text
+declarationLocation decl = var $ \file ->
+  file `where_` [
+    wild .= predicate @Py.DeclarationLocation (
+      rec $
+        field @"declaration" decl $
+        field @"file" (sig file)
+      end)
+  ]
+
+instance ToQName Py.Declaration where
+  toQName (Py.Declaration_cls x) = Glean.keyOf x >>= toQName
+  toQName (Py.Declaration_func x) = Glean.keyOf x >>= toQName
+  toQName (Py.Declaration_module x) = Glean.keyOf x >>= toQName
+  toQName (Py.Declaration_variable x) = Glean.keyOf x >>= toQName
+  toQName (Py.Declaration_imp x) = Glean.keyOf x >>= toQName
+  toQName Py.Declaration_EMPTY = return $ Left "unknown Declaration"
+
+instance ToQName Py.ImportStatement_key where
+  toQName (Py.ImportStatement_key _ asName) = toQName asName
+
+instance ToQName Py.VariableDeclaration_key where
+  toQName (Py.VariableDeclaration_key x) = toQName x
+
+instance ToQName Py.FunctionDeclaration_key where
+  toQName (Py.FunctionDeclaration_key x) = toQName x
+
+instance ToQName Py.ClassDeclaration_key where
+  toQName (Py.ClassDeclaration_key x _) = toQName x
+
+instance ToQName Py.Module_key where
+  toQName (Py.Module_key x) = toQName x
+
+instance ToQName Py.Name where
+  toQName name = do
+    let nameId = Glean.getId name
+    (mr :: Maybe (Py.Name, Py.Name)) <- fetchData $ qNameQuery nameId
+    case mr of
+      Nothing -> Left . ("No qualified names found for " <>) <$>
+        Glean.keyOf name
+      Just (local, container) ->
+        fmap Right $ (,) <$> pyNameToName local <*> pyNameToName container
+
+pyNameToName :: Py.Name -> Glean.RepoHaxl u w Name
+pyNameToName name = Name <$> Glean.keyOf name
+
+qNameQuery :: Glean.IdOf Py.Name -> Angle (Py.Name, Py.Name)
+qNameQuery nameId = vars $
+  \ (lname :: Angle Py.Name)
+    (pname :: Angle Py.Name)
+    (psname :: Angle Py.SName)
+    (maybe_psname :: Angle (Maybe Py.SName)) ->
+    tuple (lname, pname) `where_` [
+        wild .= predicate @Py.NameToSName (factId nameId
+          .-> predicate @Py.SName (rec $
+              field @"local_name" (asPredicate lname) $
+              field @"parent" maybe_psname
+            end))
+      , wild .=
+          or_ [ just psname .= maybe_psname,
+                wild .= (predicate @Py.SNameToName $ psname .-> pname) ]
+              [ nothing .= maybe_psname, pname .= predicate @Py.Name "" ]
+      ]
diff --git a/glean/glass/Glean/Glass/SymbolId/SCIP.hs b/glean/glass/Glean/Glass/SymbolId/SCIP.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolId/SCIP.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Glass.SymbolId.SCIP ({- instances -}) where
+
+import qualified Data.Text as Text
+
+import qualified Glean
+import qualified Glean.Schema.Scip.Types as Scip
+import Glean.Glass.Types ( Name(Name) )
+
+import Glean.Glass.SymbolId.Class
+
+instance Symbol Scip.SomeEntity where
+  toSymbol (Scip.SomeEntity defn) = toSymbolPredicate defn
+
+instance Symbol Scip.Definition_key where
+  toSymbol (Scip.Definition_key symbol _filerange) = do
+    str <- Glean.keyOf symbol
+    return (Text.splitOn " " str)
+
+instance ToQName Scip.SomeEntity where
+  toQName (Scip.SomeEntity defn) = Glean.keyOf defn >>= toQName
+
+instance ToQName Scip.Definition_key where
+  toQName (Scip.Definition_key symbol _range) = do
+    str <- Glean.keyOf symbol
+    return $ Right $ case reverse (Text.splitOn " " str) of
+      [] -> (Name "", Name "")
+      (x:_) -> (Name x, Name "")
diff --git a/glean/glass/Glean/Glass/SymbolKind.hs b/glean/glass/Glean/Glass/SymbolKind.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolKind.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.SymbolKind
+  (
+  -- * searching by prefix
+    findSymbolKind
+  ) where
+
+import Data.Text (Text)
+
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Code.Types as Code
+
+import Glean.Glass.Attributes.SymbolKind as Glass
+    ( symbolKindToSymbolKind )
+import Glean.Glass.SymbolId ( entityToAngle )
+import Glean.Glass.Query as Query
+import Glean.Glass.Types as Glass
+import Glean.Glass.Utils as Utils
+
+-- | Pointwise lookup of a symbol kind by entity
+findSymbolKind
+  :: Code.Entity
+  -> Glean.RepoHaxl u w (Either Text Glass.SymbolKind)
+findSymbolKind e = case entityToAngle e of
+  Left err -> return $ Left $ "ToSymbolKind: " <> err
+  Right ent -> do
+    r <- Utils.fetchData $ Query.symbolKind ent
+    return $ case r of
+      Nothing -> Left "No kind found"
+      Just kind -> Right $ Glass.symbolKindToSymbolKind kind
diff --git a/glean/glass/Glean/Glass/SymbolMap.hs b/glean/glass/Glean/Glass/SymbolMap.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolMap.hs
@@ -0,0 +1,132 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.SymbolMap
+  (
+    SymbolIndex
+  , toSymbolIndex
+
+  -- * helpers
+  , toReferences
+  , toDefinitions
+
+  ) where
+
+import qualified Data.Map.Strict as Map
+
+import Data.Maybe ( fromMaybe )
+import Data.Int ( Int64 )
+import Data.List as List ( sortBy, groupBy )
+import Data.Ord ( comparing )
+import Data.Function as List ( on )
+
+import Glean.Glass.Types
+    ( Range(range_lineBegin),
+      SymbolX(..),
+      DefinitionSymbolX(..),
+      ReferenceRangeSymbolX(..) )
+
+import Glean.Glass.Attributes as Attributes
+    ( attrMapToList, attrListToMap )
+
+--
+-- Resolved range version of the API. No bytespans to leak to client
+--
+
+type SymbolIndex = Map.Map Int64 [SymbolX]
+
+-- | Build a sparse map of line numbers to all symbols that span that line
+--
+-- This is a line-indexed map to symbols whose spans cover that line
+-- Lines are 1-indexed.
+--
+-- This structure is useful for clients that use cursor / pointer navigation
+-- to find the symbol under the pointer
+--
+-- In most indexers we have "invisible" symbols whose span is a container, e.g.
+-- in Python, the module span is the entire file. For symbol maps such symbols
+-- are not useful, so we only anchor symbols to the first line they appear on,
+-- when doing navigation maps.
+--
+-- We can have mulitple symbols with identical spans
+--
+toSymbolIndex :: [ReferenceRangeSymbolX] -> [DefinitionSymbolX] -> SymbolIndex
+toSymbolIndex theRefs theDefs = Map.unionWith (++) defs refs
+  where
+    refs = toLineMap $ map referenceToSymbolX theRefs
+    defs = toLineMap $ map definitionToSymbolX theDefs
+
+    toLineMap :: [SymbolX] -> SymbolIndex
+    toLineMap syms = Map.fromAscList keyvals
+      where
+        keyvals :: [(Int64, [SymbolX])]
+        keyvals =
+          map (\xs -> (fst (head xs), map snd xs)) $
+          groupBy ((==) `on` fst) $
+          sortBy (comparing fst) $
+            [ (symbolXToStartLine sym, sym)
+            | sym <- syms
+            ]
+
+definitionToSymbolX :: DefinitionSymbolX -> SymbolX
+definitionToSymbolX DefinitionSymbolX{..} =
+  SymbolX {
+    symbolX_sym = definitionSymbolX_sym,
+    symbolX_range = fromMaybe definitionSymbolX_range
+      definitionSymbolX_nameRange,
+    symbolX_target = Nothing,
+    symbolX_attributes = Attributes.attrListToMap definitionSymbolX_attributes
+  }
+
+referenceToSymbolX :: ReferenceRangeSymbolX -> SymbolX
+referenceToSymbolX ReferenceRangeSymbolX{..} =
+  SymbolX {
+    symbolX_sym = referenceRangeSymbolX_sym,
+    symbolX_range = referenceRangeSymbolX_range,
+    symbolX_target = Just referenceRangeSymbolX_target,
+    symbolX_attributes =
+      Attributes.attrListToMap referenceRangeSymbolX_attributes
+  }
+
+-- | Symbols can span multiple lines (e.g. containers). However for the
+-- line-index map, we simply tie symbols to the identifier first line if
+-- available, or just to the first line if not.
+symbolXToStartLine :: SymbolX -> Int64
+symbolXToStartLine SymbolX{..} = range_lineBegin symbolX_range
+
+--
+-- Elimination functions for testing
+--
+
+-- | Extract references (xrefs) from the symbol map
+toReferences :: SymbolIndex -> [ReferenceRangeSymbolX]
+toReferences m =
+  [ ReferenceRangeSymbolX {
+      referenceRangeSymbolX_sym = symbolX_sym,
+      referenceRangeSymbolX_range = symbolX_range,
+      referenceRangeSymbolX_target = actual_target,
+      referenceRangeSymbolX_attributes =
+        Attributes.attrMapToList symbolX_attributes
+    }
+  | lines <- Map.elems m
+  , SymbolX { symbolX_target = Just actual_target, .. } <- lines
+  ]
+
+-- | Extract definitions from the symbol map
+toDefinitions :: SymbolIndex -> [DefinitionSymbolX]
+toDefinitions m =
+  [ DefinitionSymbolX {
+      definitionSymbolX_sym = symbolX_sym,
+      definitionSymbolX_range = symbolX_range,
+      definitionSymbolX_nameRange = Just symbolX_range,
+      definitionSymbolX_attributes =
+        Attributes.attrMapToList symbolX_attributes
+    }
+  | lines <- Map.elems m
+  , SymbolX { symbolX_target = Nothing, .. } <- lines
+  ]
diff --git a/glean/glass/Glean/Glass/SymbolSig.hs b/glean/glass/Glean/Glass/SymbolSig.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/SymbolSig.hs
@@ -0,0 +1,167 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.SymbolSig
+  (
+    ToSymbolSignature(..),
+    toSymbolSignatureText,
+    -- testing
+    renderTest
+  ) where
+
+import Data.Text (Text, replicate, length)
+import Compat.Prettyprinter
+
+import qualified Glean.Haxl.Repos as Glean
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodeLsif.Types as Lsif
+import qualified Glean.Schema.CodeScip.Types as Scip
+
+import Glean.Glass.Pretty.Angle as Angle ( prettyAngleSignature )
+import Glean.Glass.Pretty.Cxx as Cxx ( prettyCxxSignature, Qualified(..) )
+import Glean.Glass.Pretty.Flow as Flow ( prettyFlowSignature )
+import Glean.Glass.Pretty.Hack as Hack ( prettyHackSignature )
+import Glean.Glass.Pretty.Haskell as Haskell ( prettyHaskellSignature )
+import Glean.Glass.Pretty.LSIF as LSIF ( prettyLsifSignature )
+import Glean.Glass.Pretty.SCIP as SCIP ( prettyScipSignature )
+import Glean.Glass.Pretty.Python as Python ( prettyPythonSignature )
+import Glean.Glass.Pretty.Java as Java ( prettyJavaSignature )
+import Glean.Glass.Pretty.Fbthrift as Fbthrift ( prettyFbthriftSignature )
+import Glean.Glass.Types
+    ( RepoName, SymbolId(..), TypeSymSpan(..), ByteSpan(..) )
+import qualified Data.Text.Lazy.Builder as TLB
+import qualified Data.Text.Lazy as TL
+
+-- This is equivalent to renderStrict but extract the symbol spans
+-- from the DocStream. Offsets are relative to the returned text.
+render :: SimpleDocStream (Maybe SymbolId) -> (Text, [TypeSymSpan])
+render stream =
+    let (txt, xrefs) = render' stream 0 Nothing (mempty, []) in
+    (TL.toStrict $ TLB.toLazyText txt, reverse xrefs)
+  where
+    -- curAnnot is the starting offset of the last symbol seen
+    -- we know its length and generate the span when the annotation
+    -- is popped
+    render' stream curLen curAnnot res =
+      let (txt, xrefs) = res in
+      case stream of
+        SFail -> error "render: the impossible has happened"
+        SEmpty -> res
+        SChar c rest ->
+          render' rest (curLen + 1) curAnnot (txt <> TLB.singleton c, xrefs)
+        SText _l t rest ->
+          let res' = (txt <> TLB.fromText t, xrefs) in
+          render' rest (curLen + Data.Text.length t) curAnnot res'
+        SLine i rest ->
+          let res' = (txt <>  TLB.singleton '\n' <>
+                      TLB.fromText (Data.Text.replicate i " "), xrefs) in
+          render' rest (curLen + 1 + i) curAnnot res'
+        SAnnPush ann rest ->
+          case ann of
+            Just sym ->
+              render' rest curLen (Just (sym, curLen)) res
+            Nothing ->
+              render' rest curLen Nothing res
+        SAnnPop rest ->
+          case curAnnot of
+            Just (sym, xrefStart) ->
+              let span = ByteSpan
+                    (fromIntegral xrefStart)
+                    (fromIntegral $ curLen - xrefStart) in
+              let xref = TypeSymSpan sym span in
+              render' rest curLen Nothing (txt, xref : xrefs)
+            Nothing ->
+              render' rest curLen Nothing res
+
+
+renderTest :: SimpleDocStream ann  -> Text
+renderTest stream =
+  fst $ render $ reAnnotateS (const Nothing) stream
+
+sIGNATURE_LINEWRAP :: Int
+sIGNATURE_LINEWRAP = 120
+
+toSymbolSignatureText
+  :: ToSymbolSignature a
+  => a
+  -> RepoName
+  -> SymbolId
+  -> Cxx.Qualified
+  -> Glean.RepoHaxl u w (Maybe Text, [TypeSymSpan])
+toSymbolSignatureText entity repo sym qualified = do
+  maybeDoc <- toSymbolSignature (LayoutOptions
+      (AvailablePerLine sIGNATURE_LINEWRAP 1)) entity repo sym qualified
+  case maybeDoc of
+    Nothing -> return (Nothing, [])
+    Just doc ->
+      let (txt, xrefs) = render doc in
+      return (Just txt, xrefs)
+
+-- signature of symbols
+-- The signature SimpleDocStream is annotated with SymbolId.
+-- The renderer can extract them with their span so as to
+-- generate type xrefs
+--
+class ToSymbolSignature a where
+  toSymbolSignature
+    :: LayoutOptions
+    -> a
+    -> RepoName -- ^ repo name of this entity
+    -> SymbolId -- ^ symbol id of this entity if you need to link to it
+    -> Cxx.Qualified
+    -> Glean.RepoHaxl u w (Maybe (SimpleDocStream (Maybe SymbolId)))
+
+-- signature of symbols
+-- for supported languages (c++), qualified indicates whether to
+-- fully qualify the name of the code entity in question. Other
+-- symbols in the signature will always remain fully qualified.
+instance ToSymbolSignature Code.Entity where
+  toSymbolSignature opts e repo sym qualified = case e of
+    Code.Entity_angle x -> Angle.prettyAngleSignature opts x
+    -- cxx pretty signatures
+    Code.Entity_cxx x -> pure $ Cxx.prettyCxxSignature opts x qualified
+    Code.Entity_pp{} -> pure Nothing
+    -- hack pretty signatures
+    Code.Entity_hack x -> Hack.prettyHackSignature opts repo sym x
+    -- haskell pretty signatures
+    Code.Entity_hs x -> Haskell.prettyHaskellSignature opts x
+    -- Flow signatures direct from the DB
+    Code.Entity_flow x -> Flow.prettyFlowSignature opts x
+    -- python pretty signatures
+    Code.Entity_python x -> Python.prettyPythonSignature opts repo sym x
+    -- thrift pretty signatures
+    Code.Entity_fbthrift x -> Fbthrift.prettyFbthriftSignature opts repo sym x
+    -- python pretty signatures
+    Code.Entity_java x -> Java.prettyJavaSignature opts repo sym x
+
+    -- scip languages, just enumerate completely to stay total
+    Code.Entity_scip e -> case e of
+      Scip.Entity_rust x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_go x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_typescript x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_java x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_kotlin x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_swift x -> SCIP.prettyScipSignature opts x
+      Scip.Entity_EMPTY -> pure Nothing
+    -- lsif languages, just enumerate completely to stay total
+    Code.Entity_lsif e -> case e of
+      Lsif.Entity_erlang x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_fsharp x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_go x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_haskell x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_java x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_kotlin x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_ocaml x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_python x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_rust x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_scala x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_swift x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_typescript x -> LSIF.prettyLsifSignature opts x
+      Lsif.Entity_EMPTY -> pure Nothing
+    -- otherwise
+    _ -> return Nothing
diff --git a/glean/glass/Glean/Glass/Tracer.hs b/glean/glass/Glean/Glass/Tracer.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Tracer.hs
@@ -0,0 +1,14 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Glass.Tracer
+  ( isTracingEnabled
+  ) where
+
+isTracingEnabled :: IO Bool
+isTracingEnabled = return True
diff --git a/glean/glass/Glean/Glass/Tracing.hs b/glean/glass/Glean/Glass/Tracing.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Tracing.hs
@@ -0,0 +1,105 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-unused-matches #-}
+module Glean.Glass.Tracing
+  ( GlassTrace(..)
+  , GlassTraceWithId(..)
+  , GlassTracer
+  , TraceId
+  , Tracer
+  , traceSpan
+  , glassTraceEvent
+  ) where
+
+import Data.Text (Text)
+import TextShow
+
+import Control.Trace (traceMsg, Tracer)
+
+import Glean.Glass.GlassService.Service as Glass
+import Glean.Glass.Types
+import Data.Aeson ( pairs, fromEncoding, toEncoding, KeyValue((.=)) )
+import Data.Text.Lazy (toStrict)
+import Data.Text.Lazy.Encoding (decodeUtf8)
+import Data.Binary.Builder ( toLazyByteString )
+
+type GlassTracer = Tracer GlassTrace
+
+type TraceId = Int
+
+data GlassTraceWithId = GlassTraceWithId
+  { traceId :: !TraceId
+  , traceEvent :: !GlassTrace
+  }
+
+instance TextShow GlassTraceWithId where
+  showb t = case glassTraceEvent t of
+    (id, _, _) -> showb id
+
+data GlassTrace where
+  TraceCommand :: forall r . GlassServiceCommand r -> GlassTrace
+  TraceSpan :: !Text -> Maybe Text -> GlassTrace
+
+instance TextShow GlassTrace where
+  showb t = case glassTraceEvent (GlassTraceWithId 0 t) of
+    (id, _, _) -> showb id
+
+traceSpan :: GlassTracer -> Text -> IO a -> IO a
+traceSpan tracer span = traceMsg tracer (TraceSpan span Nothing)
+
+{-# INLINE glassTraceEvent #-}
+glassTraceEvent :: GlassTraceWithId -> (Text, Int, Maybe Text)
+glassTraceEvent (GlassTraceWithId tid (TraceSpan event args)) =
+  (event, tid, args)
+glassTraceEvent (GlassTraceWithId tid (TraceCommand cmd)) = case cmd of
+  Glass.SuperFacebookService r -> ("SuperFacebookService", tid, Nothing)
+  Glass.DocumentSymbolListX DocumentSymbolsRequest{..} opts ->
+    ( "DocumentSymbolListX"
+    , tid
+    , json $ pairs $
+       "filepath" .= documentSymbolsRequest_filepath <>
+       "repository" .= documentSymbolsRequest_repository <>
+       "revision" .= requestOptions_revision opts <>
+       "exact" .= requestOptions_exact_revision opts <>
+       "matching" .= requestOptions_matching_revision opts
+    )
+  Glass.DocumentSymbolIndex DocumentSymbolsRequest{..} opts ->
+    ("DocumentSymbolIndex"
+    , tid
+    , json $ pairs $
+       "filepath" .= documentSymbolsRequest_filepath <>
+       "repository" .= documentSymbolsRequest_repository <>
+       "revision" .= requestOptions_revision opts <>
+       "exact" .= requestOptions_exact_revision opts <>
+       "matching" .= requestOptions_matching_revision opts
+    )
+  Glass.FindReferenceRanges r opts ->
+    ("FindReferenceRanges", tid, json $ toEncoding r)
+  Glass.SymbolLocation r opts ->
+    ("SymbolLocation", tid, json $ toEncoding r)
+  Glass.ResolveSymbols r opts ->
+    ("SymbolResolution", tid, json $ toEncoding r)
+  Glass.DescribeSymbol r opts ->
+    ("DescribeSymbol", tid, json $ toEncoding r)
+  Glass.SearchSymbol r opts ->
+    ("SearchSymbol", tid, json $ toEncoding r)
+  Glass.SearchRelated r opts req ->
+    ("SearchRelated", tid, json $ toEncoding r)
+  Glass.SearchRelatedNeighborhood r opts req ->
+    ("SearchRelatedNeighborhood", tid, json $ toEncoding r)
+  Glass.FileIncludeLocations r opts ->
+    ("FileIncludeLocations", tid, json $ toEncoding r)
+  Glass.ClangUSRToDefinition r opts ->
+    ("ClangUSRToDefinition", tid, json $ toEncoding r)
+  Glass.UsrToDefinition r opts ->
+    ("UsrToDefinition", tid, json $ toEncoding r)
+
+  where
+    json =
+      Just . toStrict . decodeUtf8 . toLazyByteString . fromEncoding
diff --git a/glean/glass/Glean/Glass/Utils.hs b/glean/glass/Glean/Glass/Utils.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Utils.hs
@@ -0,0 +1,232 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Glass.Utils (
+  -- Search utilities
+    fetchData
+  , fetchDataRecursive
+  , searchWithLimit
+  , searchWithTimeLimit
+  , searchReposWithLimit
+
+  , searchPredicateWithLimit
+  , searchRecursiveWithLimit
+
+  -- File utilities
+  , pathFragments
+  , joinFragments
+
+  -- Tuple utilities
+  , fst4
+
+  -- List utils
+  , takeFairN
+  , splitOnAny
+
+  -- Str utils
+  , splitString
+
+  -- Exceptions
+  , eThrow
+
+  -- Types
+  , QueryType
+
+  -- compat stuff
+  , liftMaybe
+  , maybeT
+
+  ,translateDocumentSymbolListXResult) where
+
+import Control.Monad.Catch ( throwM )
+import Data.Maybe (fromMaybe)
+import Data.Tuple.Extra ( snd3 )
+import Data.Text ( Text, length )
+import qualified Data.Text as Text
+import Data.Typeable ( Typeable )
+import System.FilePath ( splitDirectories, joinPath )
+import qualified Data.List as List
+
+import Control.Monad.Extra ( MonadPlus(mzero) )
+import Control.Monad.Trans ( MonadTrans(..) )
+
+import Glean ( recursive, limit, limitTime, search, getFirstResult, Predicate )
+import Glean.Angle as Angle ( query, Angle, Type )
+import Util.Text (slice)
+
+import qualified Glean.Haxl.Repos as Glean
+import Glean.Haxl.Repos (RepoHaxl, ReposHaxl)
+
+import qualified Glean.Glass.Types as Types
+import Glean.Glass.Types (
+    mAXIMUM_SYMBOLS_QUERY_LIMIT,
+    mAXIMUM_QUERY_TIME_LIMIT,
+    ServerException(..), Path (Path), RepoName
+  )
+
+type QueryType q =
+  ( Typeable q
+  , Show q
+  , Type q
+  )
+
+--
+-- | Evaluate an Angle data query and return the first result or Nothing
+-- No more than 1 result will be returned from the server.
+--
+fetchData :: (QueryType a) => Angle a -> RepoHaxl u w (Maybe a)
+fetchData = getFirstResult . query
+
+-- | Fetch exactly 0 or 1 results, recusively
+fetchDataRecursive :: (QueryType a) => Angle a -> RepoHaxl u w (Maybe a)
+fetchDataRecursive = getFirstResult . recursive . query
+
+-- | Run a non-recursive data query with optional limit on search results.
+-- Without an explicit limit the global limits apply.
+-- This uses the global time limit of 30s per query (2x the expected thrift
+-- limit)
+searchWithLimit :: QueryType q => Maybe Int -> Angle q -> RepoHaxl u w [q]
+searchWithLimit mlimit = searchWithTimeLimit mlimit
+  (fromIntegral mAXIMUM_QUERY_TIME_LIMIT)
+
+-- | Like searchWithLimit but enforce a time bound on the query too.
+-- Time budget in milliseconds
+searchWithTimeLimit
+  :: QueryType q => Maybe Int -> Int -> Angle q -> RepoHaxl u w [q]
+searchWithTimeLimit mlimit time =
+    fmap fst <$> search . limitTime time . limit item . Angle.query
+  where
+    item = fromMaybe (fromIntegral mAXIMUM_SYMBOLS_QUERY_LIMIT) mlimit
+
+-- | Run a non-recursive predicate only query with optional limit
+searchPredicateWithLimit
+  :: (Predicate q, QueryType q) => Maybe Int -> Angle q -> RepoHaxl u w [q]
+searchPredicateWithLimit = searchWithLimit
+
+-- | Run a recursive data query with optional limit on search results
+-- If not limit set, MAXIMUM_SYMBOLS_QUERY_LIMIT is enforced
+--
+-- Returns a status bit indicating truncated results
+--
+searchRecursiveWithLimit
+  :: QueryType q => Maybe Int -> Angle q -> RepoHaxl u w ([q], Bool)
+searchRecursiveWithLimit mlimit =
+    search . recursive . limitTime time . limit item . Angle.query
+  where
+    item = fromMaybe (fromIntegral mAXIMUM_SYMBOLS_QUERY_LIMIT) mlimit
+    time = fromIntegral mAXIMUM_QUERY_TIME_LIMIT
+
+-- | Run a non-recursive data query with optional limit over multiple repos
+searchReposWithLimit
+  :: QueryType q
+  => Maybe Int
+  -> Angle q
+  -> (q -> RepoHaxl u w a)
+  -> ReposHaxl u w [a]
+searchReposWithLimit limit angle act = do
+  results <- Glean.queryAllRepos $ do
+    res <- searchWithLimit limit angle
+    mapM act res -- we would like this to be concurrent
+  return $ maybe id take limit results
+
+-- | Split a filepath into a list of directory components
+pathFragments :: Text -> [Text]
+pathFragments = map Text.pack . splitDirectories . Text.unpack
+
+joinFragments :: [Text] -> Text
+joinFragments = Text.pack . joinPath . map Text.unpack
+
+-- | Take elements in row,column ordering, so that we select
+-- evenly up to N from the set of input lists
+--
+-- > takeFairN 3 [[1,2],[3],[4,5]] == [1,3,4]
+--
+takeFairN :: Int -> [[a]] -> [a]
+takeFairN _ [] = []
+takeFairN n [vs] = take n vs
+takeFairN n xs = take n (concat (List.transpose xs))
+
+--
+-- Splitv string on substring, with left to right precedence of patterns
+--
+splitOnAny :: [Text] -> Text -> [Text]
+splitOnAny pats src =
+  List.foldl' (\acc p -> concatMap (Text.splitOn p) acc) [src] pats
+
+subString :: Int -> Int -> Text -> Text
+subString start len = slice start len
+
+-- Split a type string along reference spans. Annotate extracted fragments.
+-- (annotation, start, length) if spans are inconsistent, don't fragment
+splitString :: Text -> [(ann, Int, Int)] -> [(Text, Maybe ann)]
+splitString s xrefs =
+  let res = reverse $ splitStringAux 0 (List.sortOn snd3 xrefs) []
+      check = Text.concat $ fmap fst res
+  in if check == s then res else [(s, Nothing)]
+  where
+    n = Data.Text.length s
+    splitStringAux pos xrefs res = case xrefs of
+        [] | pos == n -> res
+           | otherwise -> (subString pos (n - pos) s, Nothing) : res
+        (ann, start, length) : xrefs' ->
+          if pos == start then
+            splitStringAux
+              (pos + length)
+              xrefs'
+              ((subString pos length s, Just ann) : res)
+          else
+            splitStringAux
+              start
+              xrefs
+              ((subString pos (start - pos) s, Nothing) : res)
+
+-- From Control.Monad.Extra in newer versions
+liftMaybe :: (MonadPlus m) => Maybe a -> m a
+liftMaybe = maybe mzero return
+
+maybeT :: (MonadTrans t, Monad m, MonadPlus (t m)) => m (Maybe b) -> t m b
+maybeT act = lift act >>= liftMaybe
+
+eThrow :: Either Text a -> RepoHaxl u w a
+eThrow (Right x) = pure x
+eThrow (Left err) = throwM $ ServerException err
+
+fst4 :: (a,b,c,d) -> a
+fst4 (x,_,_,_) = x
+
+
+-- replace locationRange and revision in DocumentSymbolListXResult
+--  oldRepo -> newRepo
+--  path -> prefixPath <> path
+--  revision -> newRev (if provided)
+translateDocumentSymbolListXResult
+ :: RepoName
+ -> RepoName
+ -> Text
+ -> Maybe Types.Revision
+ -> Types.DocumentSymbolListXResult
+ -> Types.DocumentSymbolListXResult
+translateDocumentSymbolListXResult oldRepo newRepo prefixPath newRev result =
+  let defaultRev = Types.documentSymbolListXResult_revision result in
+  let references' =
+        translateRef <$> Types.documentSymbolListXResult_references result in
+  result{
+        Types.documentSymbolListXResult_revision = fromMaybe defaultRev newRev,
+        Types.documentSymbolListXResult_references = references'}
+  where
+    translateRef ref =
+      let t = translateLocationRange $ Types.referenceRangeSymbolX_target ref in
+      ref{Types.referenceRangeSymbolX_target = t}
+    translateLocationRange ref@(Types.LocationRange repo path range) =
+      if repo == oldRepo then
+          Types.LocationRange  newRepo (translatePath path) range
+        else ref
+    translatePath (Path path) = Path (prefixPath <> path)
diff --git a/glean/glass/Glean/Glass/Visibility.hs b/glean/glass/Glean/Glass/Visibility.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/Visibility.hs
@@ -0,0 +1,84 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.Visibility ( getInfoForEntity ) where
+
+import Data.Text
+import qualified Data.Set as Set
+import Data.Set ( Set )
+import Data.Maybe
+
+import Glean.Angle as Angle
+import Glean.Glass.SymbolId ( entityToAngle )
+import Glean.Glass.Utils
+import qualified Glean.Haxl.Repos as Glean
+
+import Glean.Glass.Types as Glass
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+
+getInfoForEntity
+  :: Code.Entity
+  -> Glean.RepoHaxl u w (Either Text (Maybe Visibility, Set Modifier))
+getInfoForEntity entity = case entityToAngle entity of
+  Left t -> return $ Left t
+  Right ent -> do
+    mVisibility <- fetchData $ angleVisibility ent
+    mModifiers <- fetchData $ angleModifiers ent
+    return $ Right
+      (visibilityToGlassType <$> mVisibility,
+       maybe Set.empty modifiersToSet mModifiers)
+
+-- | Glean type to Glass external type
+visibilityToGlassType :: Code.Visibility -> Visibility
+visibilityToGlassType x = case x of
+  Code.Visibility_Public -> Visibility_Public
+  Code.Visibility_Protected -> Visibility_Protected
+  Code.Visibility_Private -> Visibility_Private
+  Code.Visibility_Internal -> Visibility_Internal
+  Code.Visibility__UNKNOWN i -> Visibility__UNKNOWN i
+
+modifiersToSet :: Code.Modifiers -> Set Modifier
+modifiersToSet Code.Modifiers{..} = Set.fromList $ catMaybes
+  [ modifiers_isAbstract *-> Modifier_ABSTRACT
+  , modifiers_isFinal *-> Modifier_FINAL
+  , modifiers_isAsync *-> Modifier_ASYNC
+  , modifiers_isStatic *-> Modifier_STATIC
+  , modifiers_isReadonly *-> Modifier_READONLY
+  , modifiers_isConst *-> Modifier_CONST
+  , modifiers_isMutable *-> Modifier_MUTABLE
+  , modifiers_isVolatile *-> Modifier_VOLATILE
+  , modifiers_isVirtual *-> Modifier_VIRTUAL
+  , modifiers_isInline *-> Modifier_INLINE
+  ]
+  where
+    x *-> y = if x then Just y else Nothing
+
+-- | Avoid recursively expanding the entity, just return the tag
+angleVisibility :: Angle Code.Entity -> Angle Code.Visibility
+angleVisibility entity = var $ \visibility ->
+  visibility `where_` [
+    wild .= Angle.predicate @Code.EntityVisibility (
+        entity .-> visibility
+      )
+  ]
+
+angleModifiers :: Angle Code.Entity -> Angle Code.Modifiers
+angleModifiers entity = var $ \modifiers ->
+  modifiers `where_` [
+    wild .= Angle.predicate @Code.EntityModifiers (
+      rec $
+        field @"entity" entity $
+        field @"modifiers" modifiers
+      end
+    )
+  ]
diff --git a/glean/glass/Glean/Glass/XRefs.hs b/glean/glass/Glean/Glass/XRefs.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/Glean/Glass/XRefs.hs
@@ -0,0 +1,214 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Glean.Glass.XRefs
+ (
+    GenXRef(..),
+    XRef,
+    XlangXRef,
+    resolveEntitiesRange,
+    buildGenXRefs,
+    fetchCxxIdlXRefs
+  ) where
+
+import Data.Map.Strict ( Map )
+
+import qualified Data.Map as Map
+import Data.Bifunctor ( bimap, Bifunctor (first) )
+import Data.List ( foldl' )
+import Data.List.NonEmpty ( NonEmpty(..) )
+import Util.List ( uniq )
+
+import qualified Glean
+import Glean.Angle
+import Glean.Util.ToAngle ( ToAngleFull(toAngleFull), Normalize(normalize) )
+import Glean.Haxl.Repos as Glean ( RepoHaxl )
+import Glean.Glass.Range ( rangeSpanToLocationRange )
+import Glean.Glass.Utils
+import Glean.Glass.Types ( LocationRange, RepoName(..) )
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+import qualified Glean.Schema.Codemarkup.Types as Code
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.CodemarkupCxx.Types as CodeCxx
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Glass.Query (symbolToEntity)
+import Data.Maybe (mapMaybe)
+import Control.Monad.Extra (mapMaybeM)
+
+type XRef = (Code.XRefLocation, Code.Entity)
+type XlangXRef = (Code.RangeSpan, Either Code.IdlEntity Code.SymbolId)
+data GenXRef = PlainXRef XRef | XlangXRef XlangXRef
+
+-- Turn a Codemarkup "genericEntity" (plain or xlang) into
+-- the corresponding Glass datastructure
+buildGenXRefs :: Code.GenericEntity -> Maybe GenXRef
+buildGenXRefs genEntity = case genEntity of
+  Code.GenericEntity_xlangEntity (Code.GenericEntity_xlangEntity_ source entity)
+    -> Just $ XlangXRef (source, Left entity)
+  Code.GenericEntity_xlangSymbol (Code.GenericEntity_xlangSymbol_ source symbol)
+    -> Just $ XlangXRef (source, Right symbol)
+  Code.GenericEntity_plainEntity (Code.GenericEntity_plainEntity_ xref entity)
+    -> Just $ PlainXRef (xref, entity)
+  Code.GenericEntity_EMPTY -> Nothing
+
+-- | First fetch the entities for a given list of symbols.
+--  Then annotate all the entities with the
+--  LocationRange/File of the definitions of these entities.
+--
+--  Note that the rangespans from the parameters are spans for the
+--  references to the entities, not the spans of the entity definitions,
+--  but we want to preserve the correspondence.
+--
+--  This can't be done in Codemarkup for xlang entities as the entity facts
+--  and EntityLocation facts may live in different dbs.
+resolveEntitiesRange
+ :: RepoName
+ -> [(Code.SymbolId, Code.RangeSpan)]
+ -> [(Code.Entity, Code.RangeSpan)]
+ -> Glean.RepoHaxl u w
+      [((Code.Entity, Code.RangeSpan), (Src.File, LocationRange))]
+resolveEntitiesRange repo symbols ents = do
+    entsFromSymbols <- resolveSymbolsToEntities symbols
+    resolveEntitiesRanges repo $ uniq $ ents ++ entsFromSymbols
+
+resolveSymbolsToEntities ::
+  [(Code.SymbolId, Code.RangeSpan)]
+  -> Glean.RepoHaxl u w [(Code.Entity, Code.RangeSpan)]
+resolveSymbolsToEntities symbolRanges = do
+  -- We want to query Glean for the entities corresponding to the symbols.
+  -- This is more efficiently done in bulk so we need to extract
+  -- the symbol list from `symbolRanges`.
+  -- To preserve the correspondence between symbols and ranges, we
+  -- have to build a map from symbol to entities which we look up at the end.
+  let symbols = uniq $ fst <$> symbolRanges
+  symbolEnts <- fetchSymbolEntities symbols
+  let symbolEntsMap = Map.fromList symbolEnts
+  pure $ mapMaybe (mapMaybeFst symbolEntsMap) symbolRanges
+  where
+    mapMaybeFst :: forall k v a. Ord k => Map k v -> (k, a) -> Maybe (v, a)
+    mapMaybeFst map (k, x) = (, x) <$> Map.lookup k map
+
+    -- | Query Glean for the entities corresponding to symbols
+    fetchSymbolEntities ::
+      [Code.SymbolId] -> Glean.RepoHaxl u w [(Code.SymbolId, Code.Entity)]
+    fetchSymbolEntities symbols =
+      mapMaybeM (fetchDataRecursive . symbolToEntity . toAngleFull) symbols
+
+resolveEntitiesRanges ::
+  RepoName
+  -> [(Code.Entity, Code.RangeSpan)]
+  -> Glean.RepoHaxl u w
+      [((Code.Entity, Code.RangeSpan), (Src.File, LocationRange))]
+resolveEntitiesRanges repo entRanges = do
+  -- We want to query Glean for the locations corresponding to the entities.
+  -- This is more efficiently done in bulk so we need to extract
+  -- the entity list from `entRanges`.
+  -- To preserve the correspondence between entities and their reference ranges,
+  -- we have to build a map from entity to range which we look up at the end.
+  entityLocs <- entityLocRange repo (fst <$> entRanges)
+  let entityLocsMap = Map.fromList $ first normalize <$> entityLocs
+  pure $ mapMaybe (withLoc entityLocsMap) entRanges
+  where
+    withLoc map entRange@(ent, _) =
+      (entRange,) <$> Map.lookup (normalize ent) map
+
+    -- | query glean for idl entity locations and
+    --   convert those to location ranges
+    entityLocRange :: RepoName
+      -> [Code.Entity]
+      -> RepoHaxl u w [(Code.Entity, (Src.File, LocationRange))]
+    entityLocRange reponame refs =
+        fetchEntityLocations refs >>= mapM convertSpan
+      where
+        convertSpan :: (Code.Entity, Code.Location)
+          -> RepoHaxl u w (Code.Entity, (Src.File, LocationRange))
+        convertSpan (ent, loc) = do
+          let file = Code.location_file loc
+          range <- rangeSpanToLocationRange reponame file
+            (Code.location_location loc)
+          return (ent, (file, range))
+
+    -- | query glean for idl entity locations
+    fetchEntityLocations ::
+      [Code.Entity] -> Glean.RepoHaxl u w [(Code.Entity, Code.Location)]
+    fetchEntityLocations ents = do
+      -- careful to not rely on fact ids in this query
+      let angleEntities = toAngleFull <$> ents
+      case angleEntities of
+        [] -> return []
+        hd : tl -> fst <$>
+          searchRecursiveWithLimit Nothing (declarationLocation (hd :| tl))
+      where
+        declarationLocation
+          :: NonEmpty (Angle Code.Entity)
+          -> Angle (Code.Entity, Code.Location)
+        declarationLocation (hd :| tl) =
+          let or_ents = foldl' (.|) hd tl in
+          vars $ \ent loc ->
+            tuple (ent, loc) `where_` [
+              or_ents .= ent,
+              wild .= predicate @Code.EntityLocation (
+                rec $
+                  field @"entity" ent $
+                  field @"location" loc
+                end)
+            ]
+
+--  Cxx has a specific logic: The only supported xlang xrefs are "IDL" based,
+--  and rely on a mapping "generated entity -> idl entity"
+type EntityIdlMap = Map Code.Entity Code.IdlEntity
+
+-- For Cxx, fetch from Glean the "generated entity -> idl entity" map
+-- and returns an idl extractor which extracts the idl xrefs from
+-- the regular ones. Also propagate the "trunc" status.
+fetchCxxIdlXRefs :: Maybe Int
+  -> Glean.IdOf Cxx.FileXRefs
+  -> Glean.RepoHaxl u w
+    (([XRef], Bool) -> ([GenXRef], Bool))
+fetchCxxIdlXRefs mlimit xrefId =
+  do
+    (map, trunc) <- entityIdlCxxMap mlimit xrefId
+    return $ Data.Bifunctor.bimap (extractIdlXRefs map)(trunc ||)
+  where
+    entityIdlCxxMap
+      :: Maybe Int
+      -> Glean.IdOf Cxx.FileXRefs
+      -> Glean.RepoHaxl u w (EntityIdlMap, Bool)
+    entityIdlCxxMap mlimit xrefId = do
+      (rows, truncated) <- searchRecursiveWithLimit mlimit
+        (cxxFileEntityIdl xrefId)
+      return (Map.fromList rows, truncated)
+      where
+        cxxFileEntityIdl
+          :: Glean.IdOf Cxx.FileXRefs
+          -> Angle (Code.Entity, Code.IdlEntity)
+        cxxFileEntityIdl xrefId =
+          vars $ \(ent :: Angle Code.Entity)
+              (idl :: Angle Code.IdlEntity) ->
+            tuple (ent, idl) `where_` [
+              wild .= predicate @CodeCxx.CxxFileEntityIdl (
+                rec $
+                  field @"trace" (asPredicate (factId xrefId)) $
+                  field @"ent" ent $
+                  field @"idlEnt" idl
+                end)
+              ]
+
+    -- | extract idl xrefs from the regular ones
+    extractIdlXRefs
+      :: EntityIdlMap -> [(Code.XRefLocation, Code.Entity)] -> [GenXRef]
+    extractIdlXRefs entityIdlMap xRefs =
+      let pred (loc, ent) = case Map.lookup ent entityIdlMap of
+            Just idl ->
+              [PlainXRef (loc, ent),
+                XlangXRef (Code.xRefLocation_source loc, Left idl)]
+            _ -> [PlainXRef (loc, ent)] in
+      concatMap pred xRefs
diff --git a/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Client.hs b/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Client.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Client.hs
@@ -0,0 +1,1870 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Glean.Glass.GlassService.Client
+       (GlassService, documentSymbolListX, documentSymbolListXIO,
+        send_documentSymbolListX, _build_documentSymbolListX,
+        recv_documentSymbolListX, _parse_documentSymbolListX,
+        documentSymbolIndex, documentSymbolIndexIO,
+        send_documentSymbolIndex, _build_documentSymbolIndex,
+        recv_documentSymbolIndex, _parse_documentSymbolIndex,
+        findReferenceRanges, findReferenceRangesIO,
+        send_findReferenceRanges, _build_findReferenceRanges,
+        recv_findReferenceRanges, _parse_findReferenceRanges,
+        describeSymbol, describeSymbolIO, send_describeSymbol,
+        _build_describeSymbol, recv_describeSymbol, _parse_describeSymbol,
+        symbolLocation, symbolLocationIO, send_symbolLocation,
+        _build_symbolLocation, recv_symbolLocation, _parse_symbolLocation,
+        resolveSymbols, resolveSymbolsIO, send_resolveSymbols,
+        _build_resolveSymbols, recv_resolveSymbols, _parse_resolveSymbols,
+        searchSymbol, searchSymbolIO, send_searchSymbol,
+        _build_searchSymbol, recv_searchSymbol, _parse_searchSymbol,
+        searchRelated, searchRelatedIO, send_searchRelated,
+        _build_searchRelated, recv_searchRelated, _parse_searchRelated,
+        searchRelatedNeighborhood, searchRelatedNeighborhoodIO,
+        send_searchRelatedNeighborhood, _build_searchRelatedNeighborhood,
+        recv_searchRelatedNeighborhood, _parse_searchRelatedNeighborhood,
+        fileIncludeLocations, fileIncludeLocationsIO,
+        send_fileIncludeLocations, _build_fileIncludeLocations,
+        recv_fileIncludeLocations, _parse_fileIncludeLocations,
+        clangUSRToDefinition, clangUSRToDefinitionIO,
+        send_clangUSRToDefinition, _build_clangUSRToDefinition,
+        recv_clangUSRToDefinition, _parse_clangUSRToDefinition,
+        usrToDefinition, usrToDefinitionIO, send_usrToDefinition,
+        _build_usrToDefinition, recv_usrToDefinition,
+        _parse_usrToDefinition)
+       where
+import qualified Control.Arrow as Arrow
+import qualified Control.Concurrent as Concurrent
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Control.Monad.Trans.Reader as Reader
+import qualified Data.ByteString.Builder as ByteString
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.FacebookService.Client as FacebookService
+import qualified Fb303.Types as Fb303
+import qualified Hack.Types as Hack
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Data.Monoid ((<>))
+import Prelude ((==), (=<<), (>>=), (<$>), (.))
+import Glean.Glass.Types
+
+data GlassService
+
+type instance Thrift.Super GlassService =
+     FacebookService.FacebookService
+
+documentSymbolListX ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      DocumentSymbolsRequest ->
+                        RequestOptions -> Thrift.ThriftM p c s DocumentSymbolListXResult
+documentSymbolListX __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (documentSymbolListXIO _proxy _channel _counter _opts
+            __field__request
+            __field__options)
+
+documentSymbolListXIO ::
+                        (Thrift.Protocol p, Thrift.ClientChannel c,
+                         (Thrift.<:) s GlassService) =>
+                        Proxy.Proxy p ->
+                          c s ->
+                            Thrift.Counter ->
+                              Thrift.RpcOptions ->
+                                DocumentSymbolsRequest ->
+                                  RequestOptions -> Prelude.IO DocumentSymbolListXResult
+documentSymbolListXIO _proxy _channel _counter _opts
+  __field__request __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_documentSymbolListX _proxy)
+       send_documentSymbolListX _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_documentSymbolListX ::
+                           (Thrift.Protocol p, Thrift.ClientChannel c,
+                            (Thrift.<:) s GlassService) =>
+                           Proxy.Proxy p ->
+                             c s ->
+                               Thrift.Counter ->
+                                 Thrift.SendCallback ->
+                                   Thrift.RecvCallback ->
+                                     Thrift.RpcOptions ->
+                                       DocumentSymbolsRequest -> RequestOptions -> Prelude.IO ()
+send_documentSymbolListX _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_documentSymbolListX _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_documentSymbolListX ::
+                           (Thrift.Protocol p) =>
+                           Proxy.Proxy p ->
+                             Thrift.Response ->
+                               Prelude.Either Exception.SomeException DocumentSymbolListXResult
+recv_documentSymbolListX _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_documentSymbolListX _proxy) _response))
+
+_build_documentSymbolListX ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Int.Int32 ->
+                                 DocumentSymbolsRequest -> RequestOptions -> ByteString.Builder
+_build_documentSymbolListX _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "documentSymbolListX" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_documentSymbolListX ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Parser.Parser
+                                 (Prelude.Either Exception.SomeException DocumentSymbolListXResult)
+_parse_documentSymbolListX _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "documentSymbolListX: expected reply but got function call"
+                    2 | _name == "documentSymbolListX" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("documentSymbolListX_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "documentSymbolListX: expected reply but got oneway function call"
+                    _ -> Prelude.fail "documentSymbolListX: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+documentSymbolIndex ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      DocumentSymbolsRequest ->
+                        RequestOptions -> Thrift.ThriftM p c s DocumentSymbolIndex
+documentSymbolIndex __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (documentSymbolIndexIO _proxy _channel _counter _opts
+            __field__request
+            __field__options)
+
+documentSymbolIndexIO ::
+                        (Thrift.Protocol p, Thrift.ClientChannel c,
+                         (Thrift.<:) s GlassService) =>
+                        Proxy.Proxy p ->
+                          c s ->
+                            Thrift.Counter ->
+                              Thrift.RpcOptions ->
+                                DocumentSymbolsRequest ->
+                                  RequestOptions -> Prelude.IO DocumentSymbolIndex
+documentSymbolIndexIO _proxy _channel _counter _opts
+  __field__request __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_documentSymbolIndex _proxy)
+       send_documentSymbolIndex _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_documentSymbolIndex ::
+                           (Thrift.Protocol p, Thrift.ClientChannel c,
+                            (Thrift.<:) s GlassService) =>
+                           Proxy.Proxy p ->
+                             c s ->
+                               Thrift.Counter ->
+                                 Thrift.SendCallback ->
+                                   Thrift.RecvCallback ->
+                                     Thrift.RpcOptions ->
+                                       DocumentSymbolsRequest -> RequestOptions -> Prelude.IO ()
+send_documentSymbolIndex _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_documentSymbolIndex _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_documentSymbolIndex ::
+                           (Thrift.Protocol p) =>
+                           Proxy.Proxy p ->
+                             Thrift.Response ->
+                               Prelude.Either Exception.SomeException DocumentSymbolIndex
+recv_documentSymbolIndex _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_documentSymbolIndex _proxy) _response))
+
+_build_documentSymbolIndex ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Int.Int32 ->
+                                 DocumentSymbolsRequest -> RequestOptions -> ByteString.Builder
+_build_documentSymbolIndex _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "documentSymbolIndex" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_documentSymbolIndex ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Parser.Parser
+                                 (Prelude.Either Exception.SomeException DocumentSymbolIndex)
+_parse_documentSymbolIndex _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "documentSymbolIndex: expected reply but got function call"
+                    2 | _name == "documentSymbolIndex" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("documentSymbolIndex_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "documentSymbolIndex: expected reply but got oneway function call"
+                    _ -> Prelude.fail "documentSymbolIndex: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+findReferenceRanges ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      SymbolId -> RequestOptions -> Thrift.ThriftM p c s [LocationRange]
+findReferenceRanges __field__symbol __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (findReferenceRangesIO _proxy _channel _counter _opts
+            __field__symbol
+            __field__options)
+
+findReferenceRangesIO ::
+                        (Thrift.Protocol p, Thrift.ClientChannel c,
+                         (Thrift.<:) s GlassService) =>
+                        Proxy.Proxy p ->
+                          c s ->
+                            Thrift.Counter ->
+                              Thrift.RpcOptions ->
+                                SymbolId -> RequestOptions -> Prelude.IO [LocationRange]
+findReferenceRangesIO _proxy _channel _counter _opts
+  __field__symbol __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_findReferenceRanges _proxy)
+       send_findReferenceRanges _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__symbol
+         __field__options
+       Thrift.wait _handle
+
+send_findReferenceRanges ::
+                           (Thrift.Protocol p, Thrift.ClientChannel c,
+                            (Thrift.<:) s GlassService) =>
+                           Proxy.Proxy p ->
+                             c s ->
+                               Thrift.Counter ->
+                                 Thrift.SendCallback ->
+                                   Thrift.RecvCallback ->
+                                     Thrift.RpcOptions ->
+                                       SymbolId -> RequestOptions -> Prelude.IO ()
+send_findReferenceRanges _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__symbol __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_findReferenceRanges _proxy _seqNum __field__symbol
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_findReferenceRanges ::
+                           (Thrift.Protocol p) =>
+                           Proxy.Proxy p ->
+                             Thrift.Response ->
+                               Prelude.Either Exception.SomeException [LocationRange]
+recv_findReferenceRanges _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_findReferenceRanges _proxy) _response))
+
+_build_findReferenceRanges ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Int.Int32 -> SymbolId -> RequestOptions -> ByteString.Builder
+_build_findReferenceRanges _proxy _seqNum __field__symbol
+  __field__options
+  = Thrift.genMsgBegin _proxy "findReferenceRanges" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_findReferenceRanges ::
+                             Thrift.Protocol p =>
+                             Proxy.Proxy p ->
+                               Parser.Parser
+                                 (Prelude.Either Exception.SomeException [LocationRange])
+_parse_findReferenceRanges _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "findReferenceRanges: expected reply but got function call"
+                    2 | _name == "findReferenceRanges" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("findReferenceRanges_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getListType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Prelude.snd <$>
+                                                                                Thrift.parseList
+                                                                                  _proxy
+                                                                                  (Thrift.parseStruct
+                                                                                     _proxy))
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "findReferenceRanges: expected reply but got oneway function call"
+                    _ -> Prelude.fail "findReferenceRanges: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+describeSymbol ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GlassService) =>
+                 SymbolId ->
+                   RequestOptions -> Thrift.ThriftM p c s SymbolDescription
+describeSymbol __field__symbol __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (describeSymbolIO _proxy _channel _counter _opts __field__symbol
+            __field__options)
+
+describeSymbolIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GlassService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           SymbolId -> RequestOptions -> Prelude.IO SymbolDescription
+describeSymbolIO _proxy _channel _counter _opts __field__symbol
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_describeSymbol _proxy)
+       send_describeSymbol _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__symbol
+         __field__options
+       Thrift.wait _handle
+
+send_describeSymbol ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> SymbolId -> RequestOptions -> Prelude.IO ()
+send_describeSymbol _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__symbol __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_describeSymbol _proxy _seqNum __field__symbol
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_describeSymbol ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException SymbolDescription
+recv_describeSymbol _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_describeSymbol _proxy) _response))
+
+_build_describeSymbol ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 -> SymbolId -> RequestOptions -> ByteString.Builder
+_build_describeSymbol _proxy _seqNum __field__symbol
+  __field__options
+  = Thrift.genMsgBegin _proxy "describeSymbol" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_describeSymbol ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException SymbolDescription)
+_parse_describeSymbol _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "describeSymbol: expected reply but got function call"
+                    2 | _name == "describeSymbol" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("describeSymbol_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "describeSymbol: expected reply but got oneway function call"
+                    _ -> Prelude.fail "describeSymbol: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+symbolLocation ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GlassService) =>
+                 SymbolId -> RequestOptions -> Thrift.ThriftM p c s SymbolLocation
+symbolLocation __field__symbol __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (symbolLocationIO _proxy _channel _counter _opts __field__symbol
+            __field__options)
+
+symbolLocationIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GlassService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           SymbolId -> RequestOptions -> Prelude.IO SymbolLocation
+symbolLocationIO _proxy _channel _counter _opts __field__symbol
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_symbolLocation _proxy)
+       send_symbolLocation _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__symbol
+         __field__options
+       Thrift.wait _handle
+
+send_symbolLocation ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> SymbolId -> RequestOptions -> Prelude.IO ()
+send_symbolLocation _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__symbol __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_symbolLocation _proxy _seqNum __field__symbol
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_symbolLocation ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException SymbolLocation
+recv_symbolLocation _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_symbolLocation _proxy) _response))
+
+_build_symbolLocation ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 -> SymbolId -> RequestOptions -> ByteString.Builder
+_build_symbolLocation _proxy _seqNum __field__symbol
+  __field__options
+  = Thrift.genMsgBegin _proxy "symbolLocation" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_symbolLocation ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException SymbolLocation)
+_parse_symbolLocation _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "symbolLocation: expected reply but got function call"
+                    2 | _name == "symbolLocation" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("symbolLocation_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "symbolLocation: expected reply but got oneway function call"
+                    _ -> Prelude.fail "symbolLocation: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+resolveSymbols ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GlassService) =>
+                 ResolveSymbolsRequest ->
+                   RequestOptions -> Thrift.ThriftM p c s ResolveSymbolsResult
+resolveSymbols __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (resolveSymbolsIO _proxy _channel _counter _opts __field__request
+            __field__options)
+
+resolveSymbolsIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GlassService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           ResolveSymbolsRequest ->
+                             RequestOptions -> Prelude.IO ResolveSymbolsResult
+resolveSymbolsIO _proxy _channel _counter _opts __field__request
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_resolveSymbols _proxy)
+       send_resolveSymbols _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_resolveSymbols ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GlassService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions ->
+                                  ResolveSymbolsRequest -> RequestOptions -> Prelude.IO ()
+send_resolveSymbols _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_resolveSymbols _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_resolveSymbols ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException ResolveSymbolsResult
+recv_resolveSymbols _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_resolveSymbols _proxy) _response))
+
+_build_resolveSymbols ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 ->
+                            ResolveSymbolsRequest -> RequestOptions -> ByteString.Builder
+_build_resolveSymbols _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "resolveSymbols" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_resolveSymbols ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException ResolveSymbolsResult)
+_parse_resolveSymbols _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "resolveSymbols: expected reply but got function call"
+                    2 | _name == "resolveSymbols" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("resolveSymbols_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "resolveSymbols: expected reply but got oneway function call"
+                    _ -> Prelude.fail "resolveSymbols: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+searchSymbol ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s GlassService) =>
+               SymbolSearchRequest ->
+                 RequestOptions -> Thrift.ThriftM p c s SymbolSearchResult
+searchSymbol __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (searchSymbolIO _proxy _channel _counter _opts __field__request
+            __field__options)
+
+searchSymbolIO ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GlassService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.RpcOptions ->
+                         SymbolSearchRequest ->
+                           RequestOptions -> Prelude.IO SymbolSearchResult
+searchSymbolIO _proxy _channel _counter _opts __field__request
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_searchSymbol _proxy)
+       send_searchSymbol _proxy _channel _counter _sendCob _recvCob _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_searchSymbol ::
+                    (Thrift.Protocol p, Thrift.ClientChannel c,
+                     (Thrift.<:) s GlassService) =>
+                    Proxy.Proxy p ->
+                      c s ->
+                        Thrift.Counter ->
+                          Thrift.SendCallback ->
+                            Thrift.RecvCallback ->
+                              Thrift.RpcOptions ->
+                                SymbolSearchRequest -> RequestOptions -> Prelude.IO ()
+send_searchSymbol _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_searchSymbol _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_searchSymbol ::
+                    (Thrift.Protocol p) =>
+                    Proxy.Proxy p ->
+                      Thrift.Response ->
+                        Prelude.Either Exception.SomeException SymbolSearchResult
+recv_searchSymbol _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_searchSymbol _proxy) _response))
+
+_build_searchSymbol ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Int.Int32 ->
+                          SymbolSearchRequest -> RequestOptions -> ByteString.Builder
+_build_searchSymbol _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "searchSymbol" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 3 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_searchSymbol ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Parser.Parser
+                          (Prelude.Either Exception.SomeException SymbolSearchResult)
+_parse_searchSymbol _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "searchSymbol: expected reply but got function call"
+                    2 | _name == "searchSymbol" ->
+                        do let
+                             _idMap = HashMap.fromList [("searchSymbol_success", 0), ("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "searchSymbol: expected reply but got oneway function call"
+                    _ -> Prelude.fail "searchSymbol: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+searchRelated ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GlassService) =>
+                SymbolId ->
+                  RequestOptions ->
+                    SearchRelatedRequest -> Thrift.ThriftM p c s SearchRelatedResult
+searchRelated __field__symbol __field__options __field__request
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (searchRelatedIO _proxy _channel _counter _opts __field__symbol
+            __field__options
+            __field__request)
+
+searchRelatedIO ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s GlassService) =>
+                  Proxy.Proxy p ->
+                    c s ->
+                      Thrift.Counter ->
+                        Thrift.RpcOptions ->
+                          SymbolId ->
+                            RequestOptions ->
+                              SearchRelatedRequest -> Prelude.IO SearchRelatedResult
+searchRelatedIO _proxy _channel _counter _opts __field__symbol
+  __field__options __field__request
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_searchRelated _proxy)
+       send_searchRelated _proxy _channel _counter _sendCob _recvCob _opts
+         __field__symbol
+         __field__options
+         __field__request
+       Thrift.wait _handle
+
+send_searchRelated ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GlassService) =>
+                     Proxy.Proxy p ->
+                       c s ->
+                         Thrift.Counter ->
+                           Thrift.SendCallback ->
+                             Thrift.RecvCallback ->
+                               Thrift.RpcOptions ->
+                                 SymbolId -> RequestOptions -> SearchRelatedRequest -> Prelude.IO ()
+send_searchRelated _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__symbol __field__options __field__request
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_searchRelated _proxy _seqNum __field__symbol
+                     __field__options
+                     __field__request))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_searchRelated ::
+                     (Thrift.Protocol p) =>
+                     Proxy.Proxy p ->
+                       Thrift.Response ->
+                         Prelude.Either Exception.SomeException SearchRelatedResult
+recv_searchRelated _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_searchRelated _proxy) _response))
+
+_build_searchRelated ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Int.Int32 ->
+                           SymbolId ->
+                             RequestOptions -> SearchRelatedRequest -> ByteString.Builder
+_build_searchRelated _proxy _seqNum __field__symbol
+  __field__options __field__request
+  = Thrift.genMsgBegin _proxy "searchRelated" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             :
+             Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__request)
+               : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_searchRelated ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Parser.Parser
+                           (Prelude.Either Exception.SomeException SearchRelatedResult)
+_parse_searchRelated _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "searchRelated: expected reply but got function call"
+                    2 | _name == "searchRelated" ->
+                        do let
+                             _idMap = HashMap.fromList [("searchRelated_success", 0), ("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "searchRelated: expected reply but got oneway function call"
+                    _ -> Prelude.fail "searchRelated: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+searchRelatedNeighborhood ::
+                            (Thrift.Protocol p, Thrift.ClientChannel c,
+                             (Thrift.<:) s GlassService) =>
+                            SymbolId ->
+                              RequestOptions ->
+                                RelatedNeighborhoodRequest ->
+                                  Thrift.ThriftM p c s RelatedNeighborhoodResult
+searchRelatedNeighborhood __field__symbol __field__options
+  __field__request
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (searchRelatedNeighborhoodIO _proxy _channel _counter _opts
+            __field__symbol
+            __field__options
+            __field__request)
+
+searchRelatedNeighborhoodIO ::
+                              (Thrift.Protocol p, Thrift.ClientChannel c,
+                               (Thrift.<:) s GlassService) =>
+                              Proxy.Proxy p ->
+                                c s ->
+                                  Thrift.Counter ->
+                                    Thrift.RpcOptions ->
+                                      SymbolId ->
+                                        RequestOptions ->
+                                          RelatedNeighborhoodRequest ->
+                                            Prelude.IO RelatedNeighborhoodResult
+searchRelatedNeighborhoodIO _proxy _channel _counter _opts
+  __field__symbol __field__options __field__request
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_searchRelatedNeighborhood _proxy)
+       send_searchRelatedNeighborhood _proxy _channel _counter _sendCob
+         _recvCob
+         _opts
+         __field__symbol
+         __field__options
+         __field__request
+       Thrift.wait _handle
+
+send_searchRelatedNeighborhood ::
+                                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                                  (Thrift.<:) s GlassService) =>
+                                 Proxy.Proxy p ->
+                                   c s ->
+                                     Thrift.Counter ->
+                                       Thrift.SendCallback ->
+                                         Thrift.RecvCallback ->
+                                           Thrift.RpcOptions ->
+                                             SymbolId ->
+                                               RequestOptions ->
+                                                 RelatedNeighborhoodRequest -> Prelude.IO ()
+send_searchRelatedNeighborhood _proxy _channel _counter _sendCob
+  _recvCob _rpcOpts __field__symbol __field__options __field__request
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_searchRelatedNeighborhood _proxy _seqNum __field__symbol
+                     __field__options
+                     __field__request))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_searchRelatedNeighborhood ::
+                                 (Thrift.Protocol p) =>
+                                 Proxy.Proxy p ->
+                                   Thrift.Response ->
+                                     Prelude.Either Exception.SomeException
+                                       RelatedNeighborhoodResult
+recv_searchRelatedNeighborhood _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_searchRelatedNeighborhood _proxy) _response))
+
+_build_searchRelatedNeighborhood ::
+                                   Thrift.Protocol p =>
+                                   Proxy.Proxy p ->
+                                     Int.Int32 ->
+                                       SymbolId ->
+                                         RequestOptions ->
+                                           RelatedNeighborhoodRequest -> ByteString.Builder
+_build_searchRelatedNeighborhood _proxy _seqNum __field__symbol
+  __field__options __field__request
+  = Thrift.genMsgBegin _proxy "searchRelatedNeighborhood" 1 _seqNum
+      <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             :
+             Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__request)
+               : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_searchRelatedNeighborhood ::
+                                   Thrift.Protocol p =>
+                                   Proxy.Proxy p ->
+                                     Parser.Parser
+                                       (Prelude.Either Exception.SomeException
+                                          RelatedNeighborhoodResult)
+_parse_searchRelatedNeighborhood _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "searchRelatedNeighborhood: expected reply but got function call"
+                    2 | _name == "searchRelatedNeighborhood" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("searchRelatedNeighborhood_success", 0), ("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "searchRelatedNeighborhood: expected reply but got oneway function call"
+                    _ -> Prelude.fail "searchRelatedNeighborhood: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+fileIncludeLocations ::
+                       (Thrift.Protocol p, Thrift.ClientChannel c,
+                        (Thrift.<:) s GlassService) =>
+                       FileIncludeLocationRequest ->
+                         RequestOptions -> Thrift.ThriftM p c s FileIncludeLocationResults
+fileIncludeLocations __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (fileIncludeLocationsIO _proxy _channel _counter _opts
+            __field__request
+            __field__options)
+
+fileIncludeLocationsIO ::
+                         (Thrift.Protocol p, Thrift.ClientChannel c,
+                          (Thrift.<:) s GlassService) =>
+                         Proxy.Proxy p ->
+                           c s ->
+                             Thrift.Counter ->
+                               Thrift.RpcOptions ->
+                                 FileIncludeLocationRequest ->
+                                   RequestOptions -> Prelude.IO FileIncludeLocationResults
+fileIncludeLocationsIO _proxy _channel _counter _opts
+  __field__request __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_fileIncludeLocations _proxy)
+       send_fileIncludeLocations _proxy _channel _counter _sendCob
+         _recvCob
+         _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_fileIncludeLocations ::
+                            (Thrift.Protocol p, Thrift.ClientChannel c,
+                             (Thrift.<:) s GlassService) =>
+                            Proxy.Proxy p ->
+                              c s ->
+                                Thrift.Counter ->
+                                  Thrift.SendCallback ->
+                                    Thrift.RecvCallback ->
+                                      Thrift.RpcOptions ->
+                                        FileIncludeLocationRequest ->
+                                          RequestOptions -> Prelude.IO ()
+send_fileIncludeLocations _proxy _channel _counter _sendCob
+  _recvCob _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_fileIncludeLocations _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_fileIncludeLocations ::
+                            (Thrift.Protocol p) =>
+                            Proxy.Proxy p ->
+                              Thrift.Response ->
+                                Prelude.Either Exception.SomeException FileIncludeLocationResults
+recv_fileIncludeLocations _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_fileIncludeLocations _proxy) _response))
+
+_build_fileIncludeLocations ::
+                              Thrift.Protocol p =>
+                              Proxy.Proxy p ->
+                                Int.Int32 ->
+                                  FileIncludeLocationRequest -> RequestOptions -> ByteString.Builder
+_build_fileIncludeLocations _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "fileIncludeLocations" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_fileIncludeLocations ::
+                              Thrift.Protocol p =>
+                              Proxy.Proxy p ->
+                                Parser.Parser
+                                  (Prelude.Either Exception.SomeException
+                                     FileIncludeLocationResults)
+_parse_fileIncludeLocations _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "fileIncludeLocations: expected reply but got function call"
+                    2 | _name == "fileIncludeLocations" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("fileIncludeLocations_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "fileIncludeLocations: expected reply but got oneway function call"
+                    _ -> Prelude.fail "fileIncludeLocations: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+clangUSRToDefinition ::
+                       (Thrift.Protocol p, Thrift.ClientChannel c,
+                        (Thrift.<:) s GlassService) =>
+                       USRHash ->
+                         RequestOptions -> Thrift.ThriftM p c s USRSymbolDefinition
+clangUSRToDefinition __field__hash __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (clangUSRToDefinitionIO _proxy _channel _counter _opts
+            __field__hash
+            __field__options)
+
+clangUSRToDefinitionIO ::
+                         (Thrift.Protocol p, Thrift.ClientChannel c,
+                          (Thrift.<:) s GlassService) =>
+                         Proxy.Proxy p ->
+                           c s ->
+                             Thrift.Counter ->
+                               Thrift.RpcOptions ->
+                                 USRHash -> RequestOptions -> Prelude.IO USRSymbolDefinition
+clangUSRToDefinitionIO _proxy _channel _counter _opts __field__hash
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_clangUSRToDefinition _proxy)
+       send_clangUSRToDefinition _proxy _channel _counter _sendCob
+         _recvCob
+         _opts
+         __field__hash
+         __field__options
+       Thrift.wait _handle
+
+send_clangUSRToDefinition ::
+                            (Thrift.Protocol p, Thrift.ClientChannel c,
+                             (Thrift.<:) s GlassService) =>
+                            Proxy.Proxy p ->
+                              c s ->
+                                Thrift.Counter ->
+                                  Thrift.SendCallback ->
+                                    Thrift.RecvCallback ->
+                                      Thrift.RpcOptions ->
+                                        USRHash -> RequestOptions -> Prelude.IO ()
+send_clangUSRToDefinition _proxy _channel _counter _sendCob
+  _recvCob _rpcOpts __field__hash __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_clangUSRToDefinition _proxy _seqNum __field__hash
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_clangUSRToDefinition ::
+                            (Thrift.Protocol p) =>
+                            Proxy.Proxy p ->
+                              Thrift.Response ->
+                                Prelude.Either Exception.SomeException USRSymbolDefinition
+recv_clangUSRToDefinition _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_clangUSRToDefinition _proxy) _response))
+
+_build_clangUSRToDefinition ::
+                              Thrift.Protocol p =>
+                              Proxy.Proxy p ->
+                                Int.Int32 -> USRHash -> RequestOptions -> ByteString.Builder
+_build_clangUSRToDefinition _proxy _seqNum __field__hash
+  __field__options
+  = Thrift.genMsgBegin _proxy "clangUSRToDefinition" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unUSRHash) __field__hash)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_clangUSRToDefinition ::
+                              Thrift.Protocol p =>
+                              Proxy.Proxy p ->
+                                Parser.Parser
+                                  (Prelude.Either Exception.SomeException USRSymbolDefinition)
+_parse_clangUSRToDefinition _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "clangUSRToDefinition: expected reply but got function call"
+                    2 | _name == "clangUSRToDefinition" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("clangUSRToDefinition_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "clangUSRToDefinition: expected reply but got oneway function call"
+                    _ -> Prelude.fail "clangUSRToDefinition: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+usrToDefinition ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s GlassService) =>
+                  USRToDefinitionRequest ->
+                    RequestOptions -> Thrift.ThriftM p c s USRSymbolDefinition
+usrToDefinition __field__request __field__options
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (usrToDefinitionIO _proxy _channel _counter _opts __field__request
+            __field__options)
+
+usrToDefinitionIO ::
+                    (Thrift.Protocol p, Thrift.ClientChannel c,
+                     (Thrift.<:) s GlassService) =>
+                    Proxy.Proxy p ->
+                      c s ->
+                        Thrift.Counter ->
+                          Thrift.RpcOptions ->
+                            USRToDefinitionRequest ->
+                              RequestOptions -> Prelude.IO USRSymbolDefinition
+usrToDefinitionIO _proxy _channel _counter _opts __field__request
+  __field__options
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_usrToDefinition _proxy)
+       send_usrToDefinition _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__request
+         __field__options
+       Thrift.wait _handle
+
+send_usrToDefinition ::
+                       (Thrift.Protocol p, Thrift.ClientChannel c,
+                        (Thrift.<:) s GlassService) =>
+                       Proxy.Proxy p ->
+                         c s ->
+                           Thrift.Counter ->
+                             Thrift.SendCallback ->
+                               Thrift.RecvCallback ->
+                                 Thrift.RpcOptions ->
+                                   USRToDefinitionRequest -> RequestOptions -> Prelude.IO ()
+send_usrToDefinition _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__request __field__options
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_usrToDefinition _proxy _seqNum __field__request
+                     __field__options))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_usrToDefinition ::
+                       (Thrift.Protocol p) =>
+                       Proxy.Proxy p ->
+                         Thrift.Response ->
+                           Prelude.Either Exception.SomeException USRSymbolDefinition
+recv_usrToDefinition _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_usrToDefinition _proxy) _response))
+
+_build_usrToDefinition ::
+                         Thrift.Protocol p =>
+                         Proxy.Proxy p ->
+                           Int.Int32 ->
+                             USRToDefinitionRequest -> RequestOptions -> ByteString.Builder
+_build_usrToDefinition _proxy _seqNum __field__request
+  __field__options
+  = Thrift.genMsgBegin _proxy "usrToDefinition" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           :
+           Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__options)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_usrToDefinition ::
+                         Thrift.Protocol p =>
+                         Proxy.Proxy p ->
+                           Parser.Parser
+                             (Prelude.Either Exception.SomeException USRSymbolDefinition)
+_parse_usrToDefinition _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "usrToDefinition: expected reply but got function call"
+                    2 | _name == "usrToDefinition" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("usrToDefinition_success", 0), ("e", 1), ("g", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  ServerException)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  GlassException)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "usrToDefinition: expected reply but got oneway function call"
+                    _ -> Prelude.fail "usrToDefinition: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
diff --git a/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Service.hs b/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/if/glass/gen-hs2/Glean/Glass/GlassService/Service.hs
@@ -0,0 +1,1160 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GADTs #-}
+module Glean.Glass.GlassService.Service
+       (GlassServiceCommand(..), reqName', reqParser', respWriter',
+        methodsInfo')
+       where
+import qualified Control.Exception as Exception
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.FacebookService.Service as FacebookService
+import qualified Fb303.Types as Fb303
+import qualified Glean.Glass.Types as Types
+import qualified Hack.Types as Hack
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Processor as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Control.Applicative ((<*), (*>))
+import Data.Monoid ((<>))
+import Prelude ((<$>), (<*>), (++), (.), (==))
+
+data GlassServiceCommand a where
+  DocumentSymbolListX ::
+    Types.DocumentSymbolsRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.DocumentSymbolListXResult
+  DocumentSymbolIndex ::
+    Types.DocumentSymbolsRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.DocumentSymbolIndex
+  FindReferenceRanges ::
+    Types.SymbolId ->
+      Types.RequestOptions -> GlassServiceCommand [Types.LocationRange]
+  DescribeSymbol ::
+    Types.SymbolId ->
+      Types.RequestOptions -> GlassServiceCommand Types.SymbolDescription
+  SymbolLocation ::
+    Types.SymbolId ->
+      Types.RequestOptions -> GlassServiceCommand Types.SymbolLocation
+  ResolveSymbols ::
+    Types.ResolveSymbolsRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.ResolveSymbolsResult
+  SearchSymbol ::
+    Types.SymbolSearchRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.SymbolSearchResult
+  SearchRelated ::
+    Types.SymbolId ->
+      Types.RequestOptions ->
+        Types.SearchRelatedRequest ->
+          GlassServiceCommand Types.SearchRelatedResult
+  SearchRelatedNeighborhood ::
+    Types.SymbolId ->
+      Types.RequestOptions ->
+        Types.RelatedNeighborhoodRequest ->
+          GlassServiceCommand Types.RelatedNeighborhoodResult
+  FileIncludeLocations ::
+    Types.FileIncludeLocationRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.FileIncludeLocationResults
+  ClangUSRToDefinition ::
+    Types.USRHash ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.USRSymbolDefinition
+  UsrToDefinition ::
+    Types.USRToDefinitionRequest ->
+      Types.RequestOptions ->
+        GlassServiceCommand Types.USRSymbolDefinition
+  SuperFacebookService ::
+    FacebookService.FacebookServiceCommand a -> GlassServiceCommand a
+
+instance Thrift.Processor GlassServiceCommand where
+  reqName = reqName'
+  reqParser = reqParser'
+  respWriter = respWriter'
+  methodsInfo _ = methodsInfo'
+
+reqName' :: GlassServiceCommand a -> Text.Text
+reqName' (DocumentSymbolListX __field__request __field__options)
+  = "documentSymbolListX"
+reqName' (DocumentSymbolIndex __field__request __field__options)
+  = "documentSymbolIndex"
+reqName' (FindReferenceRanges __field__symbol __field__options)
+  = "findReferenceRanges"
+reqName' (DescribeSymbol __field__symbol __field__options)
+  = "describeSymbol"
+reqName' (SymbolLocation __field__symbol __field__options)
+  = "symbolLocation"
+reqName' (ResolveSymbols __field__request __field__options)
+  = "resolveSymbols"
+reqName' (SearchSymbol __field__request __field__options)
+  = "searchSymbol"
+reqName'
+  (SearchRelated __field__symbol __field__options __field__request)
+  = "searchRelated"
+reqName'
+  (SearchRelatedNeighborhood __field__symbol __field__options
+     __field__request)
+  = "searchRelatedNeighborhood"
+reqName' (FileIncludeLocations __field__request __field__options)
+  = "fileIncludeLocations"
+reqName' (ClangUSRToDefinition __field__hash __field__options)
+  = "clangUSRToDefinition"
+reqName' (UsrToDefinition __field__request __field__options)
+  = "usrToDefinition"
+reqName' (SuperFacebookService x) = FacebookService.reqName' x
+
+reqParser' ::
+             Thrift.Protocol p =>
+             Proxy.Proxy p ->
+               Text.Text -> Parser.Parser (Thrift.Some GlassServiceCommand)
+reqParser' _proxy "documentSymbolListX"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (DocumentSymbolListX __val__request __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "documentSymbolIndex"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (DocumentSymbolIndex __val__request __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "findReferenceRanges"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__symbol <- ST.newSTRef (Types.SymbolId "")
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.SymbolId
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__symbol
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                               __field__symbol
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (FindReferenceRanges __val__symbol __val__options))
+            _idMap = HashMap.fromList [("symbol", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "describeSymbol"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__symbol <- ST.newSTRef (Types.SymbolId "")
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.SymbolId
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__symbol
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                               __field__symbol
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (DescribeSymbol __val__symbol __val__options))
+            _idMap = HashMap.fromList [("symbol", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "symbolLocation"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__symbol <- ST.newSTRef (Types.SymbolId "")
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.SymbolId
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__symbol
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                               __field__symbol
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (SymbolLocation __val__symbol __val__options))
+            _idMap = HashMap.fromList [("symbol", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "resolveSymbols"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (ResolveSymbols __val__request __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "searchSymbol"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               3 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (SearchSymbol __val__request __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 3)]
+          _parse 0)
+reqParser' _proxy "searchRelated"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__symbol <- ST.newSTRef (Types.SymbolId "")
+          __field__options <- ST.newSTRef Default.def
+          __field__request <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.SymbolId
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__symbol
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               3 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                               __field__symbol
+                                           !__val__options <- ST.readSTRef __field__options
+                                           !__val__request <- ST.readSTRef __field__request
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (SearchRelated __val__symbol __val__options
+                                                   __val__request))
+            _idMap
+              = HashMap.fromList [("symbol", 1), ("options", 2), ("request", 3)]
+          _parse 0)
+reqParser' _proxy "searchRelatedNeighborhood"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__symbol <- ST.newSTRef (Types.SymbolId "")
+          __field__options <- ST.newSTRef Default.def
+          __field__request <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.SymbolId
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__symbol
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               3 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                               __field__symbol
+                                           !__val__options <- ST.readSTRef __field__options
+                                           !__val__request <- ST.readSTRef __field__request
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (SearchRelatedNeighborhood __val__symbol
+                                                   __val__options
+                                                   __val__request))
+            _idMap
+              = HashMap.fromList [("symbol", 1), ("options", 2), ("request", 3)]
+          _parse 0)
+reqParser' _proxy "fileIncludeLocations"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (FileIncludeLocations __val__request
+                                                   __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "clangUSRToDefinition"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__hash <- ST.newSTRef (Types.USRHash "")
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.fmap
+                                                                                    Types.USRHash
+                                                                                    (Thrift.parseText
+                                                                                       _proxy))
+                                                                      ST.writeSTRef __field__hash
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (ClangUSRToDefinition __val__hash __val__options))
+            _idMap = HashMap.fromList [("hash", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy "usrToDefinition"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          __field__options <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__options
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           !__val__options <- ST.readSTRef __field__options
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (UsrToDefinition __val__request __val__options))
+            _idMap = HashMap.fromList [("request", 1), ("options", 2)]
+          _parse 0)
+reqParser' _proxy funName
+  = do Thrift.Some x <- FacebookService.reqParser' _proxy funName
+       Prelude.return (Thrift.Some (SuperFacebookService x))
+
+respWriter' ::
+              Thrift.Protocol p =>
+              Proxy.Proxy p ->
+                Int.Int32 ->
+                  GlassServiceCommand a ->
+                    Prelude.Either Exception.SomeException a ->
+                      (Builder.Builder,
+                       Prelude.Maybe (Exception.SomeException, Thrift.Blame))
+respWriter' _proxy _seqNum DocumentSymbolListX{} _r
+  = (Thrift.genMsgBegin _proxy "documentSymbolListX" _msgType _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum DocumentSymbolIndex{} _r
+  = (Thrift.genMsgBegin _proxy "documentSymbolIndex" _msgType _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum FindReferenceRanges{} _r
+  = (Thrift.genMsgBegin _proxy "findReferenceRanges" _msgType _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getListType _proxy) 0 0
+                                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                            (Thrift.buildStruct _proxy)
+                                            _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum DescribeSymbol{} _r
+  = (Thrift.genMsgBegin _proxy "describeSymbol" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SymbolLocation{} _r
+  = (Thrift.genMsgBegin _proxy "symbolLocation" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum ResolveSymbols{} _r
+  = (Thrift.genMsgBegin _proxy "resolveSymbols" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SearchSymbol{} _r
+  = (Thrift.genMsgBegin _proxy "searchSymbol" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SearchRelated{} _r
+  = (Thrift.genMsgBegin _proxy "searchRelated" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SearchRelatedNeighborhood{} _r
+  = (Thrift.genMsgBegin _proxy "searchRelatedNeighborhood" _msgType
+       _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum FileIncludeLocations{} _r
+  = (Thrift.genMsgBegin _proxy "fileIncludeLocations" _msgType
+       _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum ClangUSRToDefinition{} _r
+  = (Thrift.genMsgBegin _proxy "clangUSRToDefinition" _msgType
+       _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum UsrToDefinition{} _r
+  = (Thrift.genMsgBegin _proxy "usrToDefinition" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.ServerException{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.GlassException{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "g" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum (SuperFacebookService _x) _r
+  = FacebookService.respWriter' _proxy _seqNum _x _r
+
+methodsInfo' :: Map.Map Text.Text Thrift.MethodInfo
+methodsInfo'
+  = Map.union
+      (Map.fromList
+         [("documentSymbolListX",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("documentSymbolIndex",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("findReferenceRanges",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("describeSymbol",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("symbolLocation",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("resolveSymbols",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("searchSymbol",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("searchRelated",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("searchRelatedNeighborhood",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("fileIncludeLocations",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("clangUSRToDefinition",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("usrToDefinition",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False)])
+      FacebookService.methodsInfo'
diff --git a/glean/glass/if/glass/gen-hs2/Glean/Glass/Types.hs b/glean/glass/if/glass/gen-hs2/Glean/Glass/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/if/glass/gen-hs2/Glean/Glass/Types.hs
@@ -0,0 +1,8763 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Glass.Types
+       (mAXIMUM_SYMBOLS_QUERY_LIMIT, mAXIMUM_QUERY_TIME_LIMIT,
+        RepoName(RepoName, unRepoName), Path(Path, unPath),
+        Revision(Revision, unRevision), USR(USR, unUSR),
+        USRHash(USRHash, unUSRHash),
+        LineRange(LineRange, lineRange_lineBegin, lineRange_lineEnd),
+        Range(Range, range_lineBegin, range_columnBegin, range_lineEnd,
+              range_columnEnd),
+        ByteSpan(ByteSpan, byteSpan_start, byteSpan_length),
+        LocationRange(LocationRange, locationRange_repository,
+                      locationRange_filepath, locationRange_range),
+        SymbolLocation(SymbolLocation, symbolLocation_location,
+                       symbolLocation_revision),
+        SymbolResolution(SymbolResolution, symbolResolution_qname,
+                         symbolResolution_location, symbolResolution_revision,
+                         symbolResolution_kind, symbolResolution_language,
+                         symbolResolution_signature),
+        AttributeOptions(AttributeOptions,
+                         attributeOptions_fetch_per_line_data, attributeOptions_revision,
+                         attributeOptions_service_id, attributeOptions_binary_name,
+                         attributeOptions_fetch_frame_matches,
+                         attributeOptions_fetch_assembly_data,
+                         attributeOptions_fetch_strobelight_frames,
+                         attributeOptions_fetch_default_view),
+        ServiceID(ServiceID, unServiceID),
+        BinaryName(BinaryName, unBinaryName),
+        RequestOptions(RequestOptions, requestOptions_revision,
+                       requestOptions_limit, requestOptions_feature_flags,
+                       requestOptions_strict, requestOptions_exact_revision,
+                       requestOptions_content_check, requestOptions_matching_revision,
+                       requestOptions_attribute_opts),
+        FeatureFlags(FeatureFlags, featureFlags_include_xlang_refs),
+        DocumentSymbolsRequest(DocumentSymbolsRequest,
+                               documentSymbolsRequest_repository, documentSymbolsRequest_filepath,
+                               documentSymbolsRequest_range, documentSymbolsRequest_include_refs,
+                               documentSymbolsRequest_include_xlang_refs),
+        SymbolId(SymbolId, unSymbolId),
+        Attribute(Attribute_EMPTY, Attribute_aBool, Attribute_aInteger,
+                  Attribute_aDouble, Attribute_aString, Attribute_aList,
+                  Attribute_aMapIntDouble, Attribute_aMapIntString,
+                  Attribute_aMapStringDouble),
+        Attributes(Attributes, unAttributes),
+        KeyedAttribute(KeyedAttribute, keyedAttribute_key,
+                       keyedAttribute_attribute),
+        AttributeList(AttributeList, unAttributeList),
+        ReferenceRangeSymbolX(ReferenceRangeSymbolX,
+                              referenceRangeSymbolX_sym, referenceRangeSymbolX_range,
+                              referenceRangeSymbolX_target, referenceRangeSymbolX_attributes),
+        DefinitionSymbolX(DefinitionSymbolX, definitionSymbolX_sym,
+                          definitionSymbolX_range, definitionSymbolX_nameRange,
+                          definitionSymbolX_attributes),
+        SymbolX(SymbolX, symbolX_sym, symbolX_range, symbolX_target,
+                symbolX_attributes),
+        SymbolPath(SymbolPath, symbolPath_repository, symbolPath_filepath,
+                   symbolPath_range),
+        FileDigestMap, RepoFileDigestMap,
+        DocumentSymbolListXResult(DocumentSymbolListXResult,
+                                  documentSymbolListXResult_references,
+                                  documentSymbolListXResult_definitions,
+                                  documentSymbolListXResult_revision,
+                                  documentSymbolListXResult_truncated,
+                                  documentSymbolListXResult_digest,
+                                  documentSymbolListXResult_referenced_file_digests,
+                                  documentSymbolListXResult_content_match,
+                                  documentSymbolListXResult_attributes),
+        DocumentSymbolIndex(DocumentSymbolIndex,
+                            documentSymbolIndex_symbols, documentSymbolIndex_revision,
+                            documentSymbolIndex_size, documentSymbolIndex_truncated,
+                            documentSymbolIndex_digest,
+                            documentSymbolIndex_referenced_file_digests,
+                            documentSymbolIndex_content_match, documentSymbolIndex_attributes),
+        ServerException(ServerException, serverException_message),
+        GlassExceptionReason(GlassExceptionReason_EMPTY,
+                             GlassExceptionReason_noSrcFileFact,
+                             GlassExceptionReason_noSrcFileLinesFact,
+                             GlassExceptionReason_notIndexedFile,
+                             GlassExceptionReason_entitySearchFail,
+                             GlassExceptionReason_entityNotSupported,
+                             GlassExceptionReason_attributesError,
+                             GlassExceptionReason_exactRevisionNotAvailable,
+                             GlassExceptionReason_matchingRevisionNotAvailable),
+        GlassException(GlassException, glassException_reasons,
+                       glassException_revisions),
+        Name(Name, unName),
+        QualifiedName(QualifiedName, qualifiedName_localName,
+                      qualifiedName_container),
+        Annotation(Annotation, annotation_source, annotation_symbol,
+                   annotation_name),
+        Visibility(Visibility_Public, Visibility_Protected,
+                   Visibility_Private, Visibility_Internal, Visibility__UNKNOWN),
+        Modifier(Modifier_ABSTRACT, Modifier_FINAL, Modifier_ASYNC,
+                 Modifier_STATIC, Modifier_READONLY, Modifier_CONST,
+                 Modifier_MUTABLE, Modifier_VOLATILE, Modifier_VIRTUAL,
+                 Modifier_INLINE, Modifier__UNKNOWN),
+        TypeSymSpan(TypeSymSpan, typeSymSpan_type, typeSymSpan_span),
+        SymbolBasicDescription(SymbolBasicDescription,
+                               symbolBasicDescription_sym, symbolBasicDescription_name,
+                               symbolBasicDescription_kind, symbolBasicDescription_language,
+                               symbolBasicDescription_signature),
+        SymbolDescription(SymbolDescription, symbolDescription_sym,
+                          symbolDescription_location, symbolDescription_name,
+                          symbolDescription_kind, symbolDescription_annotations,
+                          symbolDescription_visibility, symbolDescription_repo_hash,
+                          symbolDescription_language, symbolDescription_signature,
+                          symbolDescription_sym_location,
+                          symbolDescription_sym_other_locations,
+                          symbolDescription_extends_relation,
+                          symbolDescription_contains_relation, symbolDescription_modifiers,
+                          symbolDescription_type_xrefs, symbolDescription_pretty_comments,
+                          symbolDescription_native_sym),
+        SymbolComment(SymbolComment, symbolComment_location,
+                      symbolComment_comment),
+        RelationDescription(RelationDescription,
+                            relationDescription_firstParent,
+                            relationDescription_hasMoreParents, relationDescription_firstChild,
+                            relationDescription_hasMoreChildren,
+                            relationDescription_firstParentName,
+                            relationDescription_firstChildName),
+        SearchContext(SearchContext, searchContext_repo_name,
+                      searchContext_language, searchContext_kinds),
+        SymbolKind(SymbolKind_Package, SymbolKind_Type, SymbolKind_Value,
+                   SymbolKind_File, SymbolKind_Module, SymbolKind_Namespace,
+                   SymbolKind_Class_, SymbolKind_Method, SymbolKind_Property,
+                   SymbolKind_Field, SymbolKind_Constructor, SymbolKind_Enum,
+                   SymbolKind_Interface, SymbolKind_Function, SymbolKind_Variable,
+                   SymbolKind_Constant, SymbolKind_String, SymbolKind_Number,
+                   SymbolKind_Boolean, SymbolKind_Array, SymbolKind_Object,
+                   SymbolKind_Key, SymbolKind_Null, SymbolKind_Enumerator,
+                   SymbolKind_Struct, SymbolKind_Event, SymbolKind_Operator,
+                   SymbolKind_TypeParameter, SymbolKind_Union, SymbolKind_Macro,
+                   SymbolKind_Trait, SymbolKind_Fragment, SymbolKind_Operation,
+                   SymbolKind_Directive, SymbolKind__UNKNOWN),
+        Language(Language_Cpp, Language_JavaScript, Language_Hack,
+                 Language_Haskell, Language_Java, Language_ObjectiveC,
+                 Language_Python, Language_PreProcessor, Language_Thrift,
+                 Language_Rust, Language_Buck, Language_Erlang, Language_TypeScript,
+                 Language_Go, Language_Kotlin, Language_CSharp, Language_GraphQL,
+                 Language_Dataswarm, Language_Yaml, Language_Swift, Language_Angle,
+                 Language__UNKNOWN),
+        DefinitionKind(DefinitionKind_Definition,
+                       DefinitionKind_Declaration, DefinitionKind__UNKNOWN),
+        SymbolSearchOptions(SymbolSearchOptions,
+                            symbolSearchOptions_detailedResults,
+                            symbolSearchOptions_exactMatch, symbolSearchOptions_ignoreCase,
+                            symbolSearchOptions_namespaceSearch,
+                            symbolSearchOptions_sortResults, symbolSearchOptions_feelingLucky),
+        SymbolSearchRequest(SymbolSearchRequest, symbolSearchRequest_name,
+                            symbolSearchRequest_repo_name, symbolSearchRequest_language,
+                            symbolSearchRequest_kinds, symbolSearchRequest_options),
+        SymbolResult(SymbolResult, symbolResult_symbol,
+                     symbolResult_location, symbolResult_language, symbolResult_kind,
+                     symbolResult_name, symbolResult_score, symbolResult_qname,
+                     symbolResult_context),
+        SymbolContext(SymbolContext, symbolContext_symbol,
+                      symbolContext_qname, symbolContext_kind),
+        SymbolSearchResult(SymbolSearchResult, symbolSearchResult_symbols,
+                           symbolSearchResult_symbolDetails),
+        SearchByNameRequest(SearchByNameRequest,
+                            searchByNameRequest_context, searchByNameRequest_name,
+                            searchByNameRequest_detailedResults,
+                            searchByNameRequest_ignoreCase),
+        SearchByNameResult(SearchByNameResult, searchByNameResult_symbols,
+                           searchByNameResult_symbolDetails),
+        RelationType(RelationType_Extends, RelationType_Contains,
+                     RelationType_Calls, RelationType_RequireImplements,
+                     RelationType_RequireExtends, RelationType_RequireClass,
+                     RelationType_Generates, RelationType__UNKNOWN),
+        RelationDirection(RelationDirection_Parent,
+                          RelationDirection_Child, RelationDirection__UNKNOWN),
+        SearchRelatedRequest(SearchRelatedRequest,
+                             searchRelatedRequest_relatedBy, searchRelatedRequest_relation,
+                             searchRelatedRequest_recursive, searchRelatedRequest_filter,
+                             searchRelatedRequest_detailedResults),
+        RelatedNeighborhoodRequest(RelatedNeighborhoodRequest,
+                                   relatedNeighborhoodRequest_children_limit,
+                                   relatedNeighborhoodRequest_inherited_limit,
+                                   relatedNeighborhoodRequest_parent_depth,
+                                   relatedNeighborhoodRequest_hide_uninteresting),
+        rELATED_SYMBOLS_MAX_LIMIT,
+        RelatedSymbols(RelatedSymbols, relatedSymbols_parent,
+                       relatedSymbols_child, relatedSymbols_ranges),
+        SearchRelatedResult(SearchRelatedResult, searchRelatedResult_edges,
+                            searchRelatedResult_symbolDetails),
+        InheritedSymbols(InheritedSymbols, inheritedSymbols_base,
+                         inheritedSymbols_provides),
+        RelatedNeighborhoodResult(RelatedNeighborhoodResult,
+                                  relatedNeighborhoodResult_childrenContained,
+                                  relatedNeighborhoodResult_childrenExtended,
+                                  relatedNeighborhoodResult_parentsExtended,
+                                  relatedNeighborhoodResult_containsParents,
+                                  relatedNeighborhoodResult_inheritedSymbols,
+                                  relatedNeighborhoodResult_symbolDetails,
+                                  relatedNeighborhoodResult_symbolBasicDetails,
+                                  relatedNeighborhoodResult_requireImplements,
+                                  relatedNeighborhoodResult_requireExtends,
+                                  relatedNeighborhoodResult_requireClass),
+        FileIncludeLocationRequest(FileIncludeLocationRequest,
+                                   fileIncludeLocationRequest_repository,
+                                   fileIncludeLocationRequest_filepath,
+                                   fileIncludeLocationRequest_depth),
+        FileXRefTarget(FileXRefTarget, fileXRefTarget_target,
+                       fileXRefTarget_range),
+        FileIncludeXRef(FileIncludeXRef, fileIncludeXRef_source,
+                        fileIncludeXRef_includes),
+        XRefFileList(XRefFileList, unXRefFileList),
+        FileIncludeLocationResults(FileIncludeLocationResults,
+                                   fileIncludeLocationResults_revision,
+                                   fileIncludeLocationResults_references),
+        ResolveSymbolsRequest(ResolveSymbolsRequest,
+                              resolveSymbolsRequest_symbols),
+        SymbolResolutionFailure(SymbolResolutionFailure,
+                                symbolResolutionFailure_symbol, symbolResolutionFailure_reason),
+        ResolvedSymbol(ResolvedSymbol, resolvedSymbol_symbol,
+                       resolvedSymbol_symbolResolutions, resolvedSymbol_failure),
+        ResolveSymbolsResult(ResolveSymbolsResult,
+                             resolveSymbolsResult_resolvedSymbols),
+        USRToDefinitionRequest(USRToDefinitionRequest,
+                               uSRToDefinitionRequest_usr, uSRToDefinitionRequest_repo_name),
+        USRSymbolDefinition(USRSymbolDefinition,
+                            uSRSymbolDefinition_location, uSRSymbolDefinition_sym,
+                            uSRSymbolDefinition_revision),
+        USRSymbolReference(USRSymbolReference,
+                           uSRSymbolReference_location),
+        NativeSymbol(NativeSymbol, nativeSymbol_sym),
+        FileDigest(FileDigest, fileDigest_hash, fileDigest_size))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Set as Set
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.Types as Fb303
+import qualified GHC.Magic as GHC
+import qualified Hack.Types as Hack
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+mAXIMUM_SYMBOLS_QUERY_LIMIT :: Int.Int32
+mAXIMUM_SYMBOLS_QUERY_LIMIT = 10000
+
+mAXIMUM_QUERY_TIME_LIMIT :: Int.Int32
+mAXIMUM_QUERY_TIME_LIMIT = 15000
+
+newtype RepoName = RepoName{unRepoName :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable RepoName where
+  hashWithSalt __salt (RepoName __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON RepoName where
+  toJSON (RepoName __val) = Aeson.toJSON __val
+
+newtype Path = Path{unPath :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Path where
+  hashWithSalt __salt (Path __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON Path where
+  toJSON (Path __val) = Aeson.toJSON __val
+
+newtype Revision = Revision{unRevision :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Revision where
+  hashWithSalt __salt (Revision __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON Revision where
+  toJSON (Revision __val) = Aeson.toJSON __val
+
+newtype USR = USR{unUSR :: Text.Text}
+              deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable USR where
+  hashWithSalt __salt (USR __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON USR where
+  toJSON (USR __val) = Aeson.toJSON __val
+
+newtype USRHash = USRHash{unUSRHash :: Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable USRHash where
+  hashWithSalt __salt (USRHash __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON USRHash where
+  toJSON (USRHash __val) = Aeson.toJSON __val
+
+data LineRange = LineRange{lineRange_lineBegin ::
+                           {-# UNPACK #-} !Int.Int64,
+                           lineRange_lineEnd :: {-# UNPACK #-} !Int.Int64}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LineRange where
+  toJSON (LineRange __field__lineBegin __field__lineEnd)
+    = Aeson.object
+        ("lineBegin" .= __field__lineBegin :
+           "lineEnd" .= __field__lineEnd : Prelude.mempty)
+
+instance Thrift.ThriftStruct LineRange where
+  buildStruct _proxy (LineRange __field__lineBegin __field__lineEnd)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "lineBegin" (Thrift.getI64Type _proxy)
+           1
+           0
+           (Thrift.genI64Prim _proxy)
+           __field__lineBegin
+           :
+           Thrift.genFieldPrim _proxy "lineEnd" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64Prim _proxy)
+             __field__lineEnd
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lineBegin <- ST.newSTRef Default.def
+            __field__lineEnd <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lineBegin
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lineEnd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lineBegin <- ST.readSTRef
+                                                                    __field__lineBegin
+                                             !__val__lineEnd <- ST.readSTRef __field__lineEnd
+                                             Prelude.pure
+                                               (LineRange __val__lineBegin __val__lineEnd)
+              _idMap = HashMap.fromList [("lineBegin", 1), ("lineEnd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LineRange where
+  rnf (LineRange __field__lineBegin __field__lineEnd)
+    = DeepSeq.rnf __field__lineBegin `Prelude.seq`
+        DeepSeq.rnf __field__lineEnd `Prelude.seq` ()
+
+instance Default.Default LineRange where
+  def = LineRange Default.def Default.def
+
+instance Hashable.Hashable LineRange where
+  hashWithSalt __salt (LineRange _lineBegin _lineEnd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lineBegin)
+        _lineEnd
+
+data Range = Range{range_lineBegin :: {-# UNPACK #-} !Int.Int64,
+                   range_columnBegin :: {-# UNPACK #-} !Int.Int64,
+                   range_lineEnd :: {-# UNPACK #-} !Int.Int64,
+                   range_columnEnd :: {-# UNPACK #-} !Int.Int64}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range where
+  toJSON
+    (Range __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = Aeson.object
+        ("lineBegin" .= __field__lineBegin :
+           "columnBegin" .= __field__columnBegin :
+             "lineEnd" .= __field__lineEnd :
+               "columnEnd" .= __field__columnEnd : Prelude.mempty)
+
+instance Thrift.ThriftStruct Range where
+  buildStruct _proxy
+    (Range __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "lineBegin" (Thrift.getI64Type _proxy)
+           1
+           0
+           (Thrift.genI64Prim _proxy)
+           __field__lineBegin
+           :
+           Thrift.genFieldPrim _proxy "columnBegin" (Thrift.getI64Type _proxy)
+             2
+             1
+             (Thrift.genI64Prim _proxy)
+             __field__columnBegin
+             :
+             Thrift.genFieldPrim _proxy "lineEnd" (Thrift.getI64Type _proxy) 3 2
+               (Thrift.genI64Prim _proxy)
+               __field__lineEnd
+               :
+               Thrift.genFieldPrim _proxy "columnEnd" (Thrift.getI64Type _proxy) 4
+                 3
+                 (Thrift.genI64Prim _proxy)
+                 __field__columnEnd
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lineBegin <- ST.newSTRef Default.def
+            __field__columnBegin <- ST.newSTRef Default.def
+            __field__lineEnd <- ST.newSTRef Default.def
+            __field__columnEnd <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lineBegin
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__columnBegin
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lineEnd
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__columnEnd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lineBegin <- ST.readSTRef
+                                                                    __field__lineBegin
+                                             !__val__columnBegin <- ST.readSTRef
+                                                                      __field__columnBegin
+                                             !__val__lineEnd <- ST.readSTRef __field__lineEnd
+                                             !__val__columnEnd <- ST.readSTRef __field__columnEnd
+                                             Prelude.pure
+                                               (Range __val__lineBegin __val__columnBegin
+                                                  __val__lineEnd
+                                                  __val__columnEnd)
+              _idMap
+                = HashMap.fromList
+                    [("lineBegin", 1), ("columnBegin", 2), ("lineEnd", 3),
+                     ("columnEnd", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Range where
+  rnf
+    (Range __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = DeepSeq.rnf __field__lineBegin `Prelude.seq`
+        DeepSeq.rnf __field__columnBegin `Prelude.seq`
+          DeepSeq.rnf __field__lineEnd `Prelude.seq`
+            DeepSeq.rnf __field__columnEnd `Prelude.seq` ()
+
+instance Default.Default Range where
+  def = Range Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable Range where
+  hashWithSalt __salt
+    (Range _lineBegin _columnBegin _lineEnd _columnEnd)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lineBegin)
+              _columnBegin)
+           _lineEnd)
+        _columnEnd
+
+data ByteSpan = ByteSpan{byteSpan_start ::
+                         {-# UNPACK #-} !Int.Int64,
+                         byteSpan_length :: {-# UNPACK #-} !Int.Int64}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ByteSpan where
+  toJSON (ByteSpan __field__start __field__length)
+    = Aeson.object
+        ("start" .= __field__start :
+           "length" .= __field__length : Prelude.mempty)
+
+instance Thrift.ThriftStruct ByteSpan where
+  buildStruct _proxy (ByteSpan __field__start __field__length)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "start" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64Prim _proxy)
+           __field__start
+           :
+           Thrift.genFieldPrim _proxy "length" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64Prim _proxy)
+             __field__length
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__start <- ST.newSTRef Default.def
+            __field__length <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__start
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__length
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__start <- ST.readSTRef __field__start
+                                             !__val__length <- ST.readSTRef __field__length
+                                             Prelude.pure (ByteSpan __val__start __val__length)
+              _idMap = HashMap.fromList [("start", 1), ("length", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ByteSpan where
+  rnf (ByteSpan __field__start __field__length)
+    = DeepSeq.rnf __field__start `Prelude.seq`
+        DeepSeq.rnf __field__length `Prelude.seq` ()
+
+instance Default.Default ByteSpan where
+  def = ByteSpan Default.def Default.def
+
+instance Hashable.Hashable ByteSpan where
+  hashWithSalt __salt (ByteSpan _start _length)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _start)
+        _length
+
+data LocationRange = LocationRange{locationRange_repository ::
+                                   RepoName,
+                                   locationRange_filepath :: Path,
+                                   locationRange_range :: {-# NOUNPACK #-} !Range}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocationRange where
+  toJSON
+    (LocationRange __field__repository __field__filepath
+       __field__range)
+    = Aeson.object
+        ("repository" .= unRepoName __field__repository :
+           "filepath" .= unPath __field__filepath :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocationRange where
+  buildStruct _proxy
+    (LocationRange __field__repository __field__filepath
+       __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repository" (Thrift.getStringType _proxy)
+           1
+           0
+           ((Thrift.genText _proxy . unRepoName) __field__repository)
+           :
+           Thrift.genField _proxy "filepath" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unPath) __field__filepath)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repository <- ST.newSTRef (RepoName "")
+            __field__filepath <- ST.newSTRef (Path "")
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repository
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__filepath
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repository <- ST.readSTRef
+                                                                     __field__repository
+                                             !__val__filepath <- ST.readSTRef __field__filepath
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (LocationRange __val__repository __val__filepath
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList
+                    [("repository", 1), ("filepath", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LocationRange where
+  rnf
+    (LocationRange __field__repository __field__filepath
+       __field__range)
+    = DeepSeq.rnf __field__repository `Prelude.seq`
+        DeepSeq.rnf __field__filepath `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default LocationRange where
+  def = LocationRange (RepoName "") (Path "") Default.def
+
+instance Hashable.Hashable LocationRange where
+  hashWithSalt __salt (LocationRange _repository _filepath _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repository)
+           _filepath)
+        _range
+
+data SymbolLocation = SymbolLocation{symbolLocation_location ::
+                                     LocationRange,
+                                     symbolLocation_revision :: Revision}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolLocation where
+  toJSON (SymbolLocation __field__location __field__revision)
+    = Aeson.object
+        ("location" .= __field__location :
+           "revision" .= unRevision __field__revision : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolLocation where
+  buildStruct _proxy
+    (SymbolLocation __field__location __field__revision)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unRevision) __field__revision)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__revision <- ST.newSTRef (Revision "")
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             Prelude.pure
+                                               (SymbolLocation __val__location __val__revision)
+              _idMap = HashMap.fromList [("location", 1), ("revision", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolLocation where
+  rnf (SymbolLocation __field__location __field__revision)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__revision `Prelude.seq` ()
+
+instance Default.Default SymbolLocation where
+  def = SymbolLocation Default.def (Revision "")
+
+instance Hashable.Hashable SymbolLocation where
+  hashWithSalt __salt (SymbolLocation _location _revision)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _revision
+
+data SymbolResolution = SymbolResolution{symbolResolution_qname ::
+                                         QualifiedName,
+                                         symbolResolution_location :: LocationRange,
+                                         symbolResolution_revision :: Revision,
+                                         symbolResolution_kind :: Prelude.Maybe SymbolKind,
+                                         symbolResolution_language :: Language,
+                                         symbolResolution_signature :: Prelude.Maybe Text.Text}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolResolution where
+  toJSON
+    (SymbolResolution __field__qname __field__location
+       __field__revision __field__kind __field__language
+       __field__signature)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "location" .= __field__location :
+             "revision" .= unRevision __field__revision :
+               Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+                 ("language" .= __field__language :
+                    Prelude.maybe Prelude.id ((:) . ("signature" .=))
+                      __field__signature
+                      Prelude.mempty))
+
+instance Thrift.ThriftStruct SymbolResolution where
+  buildStruct _proxy
+    (SymbolResolution __field__qname __field__location
+       __field__revision __field__kind __field__language
+       __field__signature)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 3 2
+               ((Thrift.genText _proxy . unRevision) __field__revision)
+               :
+               let (__cereal__kind, __id__kind)
+                     = case __field__kind of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kind"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kind
+                   (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 5
+                      __id__kind
+                      ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                          Thrift.fromThriftEnum)
+                         __field__language)
+                      :
+                      case __field__signature of
+                        Prelude.Just _val -> Thrift.genField _proxy "signature"
+                                               (Thrift.getStringType _proxy)
+                                               6
+                                               5
+                                               (Thrift.genText _proxy _val)
+                                               : []
+                        Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__revision <- ST.newSTRef (Revision "")
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             Prelude.pure
+                                               (SymbolResolution __val__qname __val__location
+                                                  __val__revision
+                                                  __val__kind
+                                                  __val__language
+                                                  __val__signature)
+              _idMap
+                = HashMap.fromList
+                    [("qname", 1), ("location", 2), ("revision", 3), ("kind", 4),
+                     ("language", 5), ("signature", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolResolution where
+  rnf
+    (SymbolResolution __field__qname __field__location
+       __field__revision __field__kind __field__language
+       __field__signature)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__revision `Prelude.seq`
+            DeepSeq.rnf __field__kind `Prelude.seq`
+              DeepSeq.rnf __field__language `Prelude.seq`
+                DeepSeq.rnf __field__signature `Prelude.seq` ()
+
+instance Default.Default SymbolResolution where
+  def
+    = SymbolResolution Default.def Default.def (Revision "")
+        Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable SymbolResolution where
+  hashWithSalt __salt
+    (SymbolResolution _qname _location _revision _kind _language
+       _signature)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname)
+                    _location)
+                 _revision)
+              _kind)
+           _language)
+        _signature
+
+data AttributeOptions = AttributeOptions{attributeOptions_fetch_per_line_data
+                                         :: Prelude.Bool,
+                                         attributeOptions_revision :: Prelude.Maybe Revision,
+                                         attributeOptions_service_id :: Prelude.Maybe ServiceID,
+                                         attributeOptions_binary_name :: Prelude.Maybe BinaryName,
+                                         attributeOptions_fetch_frame_matches :: Prelude.Bool,
+                                         attributeOptions_fetch_assembly_data :: Prelude.Bool,
+                                         attributeOptions_fetch_strobelight_frames :: Prelude.Bool,
+                                         attributeOptions_fetch_default_view :: Prelude.Bool}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeOptions where
+  toJSON
+    (AttributeOptions __field__fetch_per_line_data __field__revision
+       __field__service_id __field__binary_name
+       __field__fetch_frame_matches __field__fetch_assembly_data
+       __field__fetch_strobelight_frames __field__fetch_default_view)
+    = Aeson.object
+        ("fetch_per_line_data" .= __field__fetch_per_line_data :
+           Prelude.maybe Prelude.id ((:) . ("revision" .=))
+             (Prelude.fmap unRevision __field__revision)
+             (Prelude.maybe Prelude.id ((:) . ("service_id" .=))
+                (Prelude.fmap unServiceID __field__service_id)
+                (Prelude.maybe Prelude.id ((:) . ("binary_name" .=))
+                   (Prelude.fmap unBinaryName __field__binary_name)
+                   ("fetch_frame_matches" .= __field__fetch_frame_matches :
+                      "fetch_assembly_data" .= __field__fetch_assembly_data :
+                        "fetch_strobelight_frames" .= __field__fetch_strobelight_frames :
+                          "fetch_default_view" .= __field__fetch_default_view :
+                            Prelude.mempty))))
+
+instance Thrift.ThriftStruct AttributeOptions where
+  buildStruct _proxy
+    (AttributeOptions __field__fetch_per_line_data __field__revision
+       __field__service_id __field__binary_name
+       __field__fetch_frame_matches __field__fetch_assembly_data
+       __field__fetch_strobelight_frames __field__fetch_default_view)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "fetch_per_line_data" 1 0
+           __field__fetch_per_line_data
+           :
+           let (__cereal__revision, __id__revision)
+                 = case __field__revision of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "revision"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genText _proxy . unRevision) _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__revision
+               (let (__cereal__service_id, __id__service_id)
+                      = case __field__service_id of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "service_id"
+                                                     (Thrift.getStringType _proxy)
+                                                     3
+                                                     __id__revision
+                                                     ((Thrift.genText _proxy . unServiceID) _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__revision)
+                  in
+                  __cereal__service_id
+                    (let (__cereal__binary_name, __id__binary_name)
+                           = case __field__binary_name of
+                               Prelude.Just _val -> ((:)
+                                                       (Thrift.genField _proxy "binary_name"
+                                                          (Thrift.getStringType _proxy)
+                                                          4
+                                                          __id__service_id
+                                                          ((Thrift.genText _proxy . unBinaryName)
+                                                             _val)),
+                                                     4)
+                               Prelude.Nothing -> (Prelude.id, __id__service_id)
+                       in
+                       __cereal__binary_name
+                         (Thrift.genFieldBool _proxy "fetch_frame_matches" 5
+                            __id__binary_name
+                            __field__fetch_frame_matches
+                            :
+                            Thrift.genFieldBool _proxy "fetch_assembly_data" 6 5
+                              __field__fetch_assembly_data
+                              :
+                              Thrift.genFieldBool _proxy "fetch_strobelight_frames" 7 6
+                                __field__fetch_strobelight_frames
+                                :
+                                Thrift.genFieldBool _proxy "fetch_default_view" 8 7
+                                  __field__fetch_default_view
+                                  : []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fetch_per_line_data <- ST.newSTRef Prelude.False
+            __field__revision <- ST.newSTRef Prelude.Nothing
+            __field__service_id <- ST.newSTRef Prelude.Nothing
+            __field__binary_name <- ST.newSTRef Prelude.Nothing
+            __field__fetch_frame_matches <- ST.newSTRef Prelude.False
+            __field__fetch_assembly_data <- ST.newSTRef Prelude.False
+            __field__fetch_strobelight_frames <- ST.newSTRef Prelude.False
+            __field__fetch_default_view <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__fetch_per_line_data
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      ServiceID
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__service_id
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      BinaryName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__binary_name
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__fetch_frame_matches
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__fetch_assembly_data
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__fetch_strobelight_frames
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__fetch_default_view
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fetch_per_line_data <- ST.readSTRef
+                                                                              __field__fetch_per_line_data
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             !__val__service_id <- ST.readSTRef __field__service_id
+                                             !__val__binary_name <- ST.readSTRef
+                                                                      __field__binary_name
+                                             !__val__fetch_frame_matches <- ST.readSTRef
+                                                                              __field__fetch_frame_matches
+                                             !__val__fetch_assembly_data <- ST.readSTRef
+                                                                              __field__fetch_assembly_data
+                                             !__val__fetch_strobelight_frames <- ST.readSTRef
+                                                                                   __field__fetch_strobelight_frames
+                                             !__val__fetch_default_view <- ST.readSTRef
+                                                                             __field__fetch_default_view
+                                             Prelude.pure
+                                               (AttributeOptions __val__fetch_per_line_data
+                                                  __val__revision
+                                                  __val__service_id
+                                                  __val__binary_name
+                                                  __val__fetch_frame_matches
+                                                  __val__fetch_assembly_data
+                                                  __val__fetch_strobelight_frames
+                                                  __val__fetch_default_view)
+              _idMap
+                = HashMap.fromList
+                    [("fetch_per_line_data", 1), ("revision", 2), ("service_id", 3),
+                     ("binary_name", 4), ("fetch_frame_matches", 5),
+                     ("fetch_assembly_data", 6), ("fetch_strobelight_frames", 7),
+                     ("fetch_default_view", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeOptions where
+  rnf
+    (AttributeOptions __field__fetch_per_line_data __field__revision
+       __field__service_id __field__binary_name
+       __field__fetch_frame_matches __field__fetch_assembly_data
+       __field__fetch_strobelight_frames __field__fetch_default_view)
+    = DeepSeq.rnf __field__fetch_per_line_data `Prelude.seq`
+        DeepSeq.rnf __field__revision `Prelude.seq`
+          DeepSeq.rnf __field__service_id `Prelude.seq`
+            DeepSeq.rnf __field__binary_name `Prelude.seq`
+              DeepSeq.rnf __field__fetch_frame_matches `Prelude.seq`
+                DeepSeq.rnf __field__fetch_assembly_data `Prelude.seq`
+                  DeepSeq.rnf __field__fetch_strobelight_frames `Prelude.seq`
+                    DeepSeq.rnf __field__fetch_default_view `Prelude.seq` ()
+
+instance Default.Default AttributeOptions where
+  def
+    = AttributeOptions Prelude.False Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable AttributeOptions where
+  hashWithSalt __salt
+    (AttributeOptions _fetch_per_line_data _revision _service_id
+       _binary_name _fetch_frame_matches _fetch_assembly_data
+       _fetch_strobelight_frames _fetch_default_view)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt __salt _fetch_per_line_data)
+                          _revision)
+                       _service_id)
+                    _binary_name)
+                 _fetch_frame_matches)
+              _fetch_assembly_data)
+           _fetch_strobelight_frames)
+        _fetch_default_view
+
+newtype ServiceID = ServiceID{unServiceID :: Text.Text}
+                    deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable ServiceID where
+  hashWithSalt __salt (ServiceID __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON ServiceID where
+  toJSON (ServiceID __val) = Aeson.toJSON __val
+
+newtype BinaryName = BinaryName{unBinaryName :: Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable BinaryName where
+  hashWithSalt __salt (BinaryName __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON BinaryName where
+  toJSON (BinaryName __val) = Aeson.toJSON __val
+
+data RequestOptions = RequestOptions{requestOptions_revision ::
+                                     Prelude.Maybe Revision,
+                                     requestOptions_limit :: Prelude.Maybe Int.Int32,
+                                     requestOptions_feature_flags :: Prelude.Maybe FeatureFlags,
+                                     requestOptions_strict :: Prelude.Bool,
+                                     requestOptions_exact_revision :: Prelude.Bool,
+                                     requestOptions_content_check :: Prelude.Bool,
+                                     requestOptions_matching_revision :: Prelude.Bool,
+                                     requestOptions_attribute_opts :: AttributeOptions}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RequestOptions where
+  toJSON
+    (RequestOptions __field__revision __field__limit
+       __field__feature_flags __field__strict __field__exact_revision
+       __field__content_check __field__matching_revision
+       __field__attribute_opts)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("revision" .=))
+           (Prelude.fmap unRevision __field__revision)
+           (Prelude.maybe Prelude.id ((:) . ("limit" .=)) __field__limit
+              (Prelude.maybe Prelude.id ((:) . ("feature_flags" .=))
+                 __field__feature_flags
+                 ("strict" .= __field__strict :
+                    "exact_revision" .= __field__exact_revision :
+                      "content_check" .= __field__content_check :
+                        "matching_revision" .= __field__matching_revision :
+                          "attribute_opts" .= __field__attribute_opts : Prelude.mempty))))
+
+instance Thrift.ThriftStruct RequestOptions where
+  buildStruct _proxy
+    (RequestOptions __field__revision __field__limit
+       __field__feature_flags __field__strict __field__exact_revision
+       __field__content_check __field__matching_revision
+       __field__attribute_opts)
+    = Thrift.genStruct _proxy
+        (let (__cereal__revision, __id__revision)
+               = case __field__revision of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "revision"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              ((Thrift.genText _proxy . unRevision) _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__revision
+             (let (__cereal__limit, __id__limit)
+                    = case __field__limit of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genFieldPrim _proxy "limit"
+                                                   (Thrift.getI32Type _proxy)
+                                                   2
+                                                   __id__revision
+                                                   (Thrift.genI32Prim _proxy)
+                                                   _val),
+                                              2)
+                        Prelude.Nothing -> (Prelude.id, __id__revision)
+                in
+                __cereal__limit
+                  (let (__cereal__feature_flags, __id__feature_flags)
+                         = case __field__feature_flags of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genField _proxy "feature_flags"
+                                                        (Thrift.getStructType _proxy)
+                                                        3
+                                                        __id__limit
+                                                        (Thrift.buildStruct _proxy _val)),
+                                                   3)
+                             Prelude.Nothing -> (Prelude.id, __id__limit)
+                     in
+                     __cereal__feature_flags
+                       (Thrift.genFieldBool _proxy "strict" 4 __id__feature_flags
+                          __field__strict
+                          :
+                          Thrift.genFieldBool _proxy "exact_revision" 5 4
+                            __field__exact_revision
+                            :
+                            Thrift.genFieldBool _proxy "content_check" 7 5
+                              __field__content_check
+                              :
+                              Thrift.genFieldBool _proxy "matching_revision" 6 7
+                                __field__matching_revision
+                                :
+                                Thrift.genField _proxy "attribute_opts"
+                                  (Thrift.getStructType _proxy)
+                                  8
+                                  6
+                                  (Thrift.buildStruct _proxy __field__attribute_opts)
+                                  : []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__revision <- ST.newSTRef Prelude.Nothing
+            __field__limit <- ST.newSTRef Prelude.Nothing
+            __field__feature_flags <- ST.newSTRef Prelude.Nothing
+            __field__strict <- ST.newSTRef Prelude.False
+            __field__exact_revision <- ST.newSTRef Prelude.False
+            __field__content_check <- ST.newSTRef Prelude.False
+            __field__matching_revision <- ST.newSTRef Prelude.False
+            __field__attribute_opts <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__limit
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__feature_flags
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__strict
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__exact_revision
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__content_check
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__matching_revision
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute_opts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__revision <- ST.readSTRef
+                                                                   __field__revision
+                                             !__val__limit <- ST.readSTRef __field__limit
+                                             !__val__feature_flags <- ST.readSTRef
+                                                                        __field__feature_flags
+                                             !__val__strict <- ST.readSTRef __field__strict
+                                             !__val__exact_revision <- ST.readSTRef
+                                                                         __field__exact_revision
+                                             !__val__content_check <- ST.readSTRef
+                                                                        __field__content_check
+                                             !__val__matching_revision <- ST.readSTRef
+                                                                            __field__matching_revision
+                                             !__val__attribute_opts <- ST.readSTRef
+                                                                         __field__attribute_opts
+                                             Prelude.pure
+                                               (RequestOptions __val__revision __val__limit
+                                                  __val__feature_flags
+                                                  __val__strict
+                                                  __val__exact_revision
+                                                  __val__content_check
+                                                  __val__matching_revision
+                                                  __val__attribute_opts)
+              _idMap
+                = HashMap.fromList
+                    [("revision", 1), ("limit", 2), ("feature_flags", 3),
+                     ("strict", 4), ("exact_revision", 5), ("content_check", 7),
+                     ("matching_revision", 6), ("attribute_opts", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData RequestOptions where
+  rnf
+    (RequestOptions __field__revision __field__limit
+       __field__feature_flags __field__strict __field__exact_revision
+       __field__content_check __field__matching_revision
+       __field__attribute_opts)
+    = DeepSeq.rnf __field__revision `Prelude.seq`
+        DeepSeq.rnf __field__limit `Prelude.seq`
+          DeepSeq.rnf __field__feature_flags `Prelude.seq`
+            DeepSeq.rnf __field__strict `Prelude.seq`
+              DeepSeq.rnf __field__exact_revision `Prelude.seq`
+                DeepSeq.rnf __field__content_check `Prelude.seq`
+                  DeepSeq.rnf __field__matching_revision `Prelude.seq`
+                    DeepSeq.rnf __field__attribute_opts `Prelude.seq` ()
+
+instance Default.Default RequestOptions where
+  def
+    = RequestOptions Prelude.Nothing Prelude.Nothing Prelude.Nothing
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Default.def
+
+instance Hashable.Hashable RequestOptions where
+  hashWithSalt __salt
+    (RequestOptions _revision _limit _feature_flags _strict
+       _exact_revision _content_check _matching_revision _attribute_opts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _revision)
+                          _limit)
+                       _feature_flags)
+                    _strict)
+                 _exact_revision)
+              _content_check)
+           _matching_revision)
+        _attribute_opts
+
+newtype FeatureFlags = FeatureFlags{featureFlags_include_xlang_refs
+                                    :: Prelude.Maybe Prelude.Bool}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FeatureFlags where
+  toJSON (FeatureFlags __field__include_xlang_refs)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("include_xlang_refs" .=))
+           __field__include_xlang_refs
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct FeatureFlags where
+  buildStruct _proxy (FeatureFlags __field__include_xlang_refs)
+    = Thrift.genStruct _proxy
+        (case __field__include_xlang_refs of
+           Prelude.Just _val -> Thrift.genFieldBool _proxy
+                                  "include_xlang_refs"
+                                  3
+                                  0
+                                  _val
+                                  : []
+           Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__include_xlang_refs <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__include_xlang_refs
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__include_xlang_refs <- ST.readSTRef
+                                                                             __field__include_xlang_refs
+                                             Prelude.pure (FeatureFlags __val__include_xlang_refs)
+              _idMap = HashMap.fromList [("include_xlang_refs", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FeatureFlags where
+  rnf (FeatureFlags __field__include_xlang_refs)
+    = DeepSeq.rnf __field__include_xlang_refs `Prelude.seq` ()
+
+instance Default.Default FeatureFlags where
+  def = FeatureFlags Prelude.Nothing
+
+instance Hashable.Hashable FeatureFlags where
+  hashWithSalt __salt (FeatureFlags _include_xlang_refs)
+    = Hashable.hashWithSalt __salt _include_xlang_refs
+
+data DocumentSymbolsRequest = DocumentSymbolsRequest{documentSymbolsRequest_repository
+                                                     :: RepoName,
+                                                     documentSymbolsRequest_filepath :: Path,
+                                                     documentSymbolsRequest_range ::
+                                                     Prelude.Maybe [LineRange],
+                                                     documentSymbolsRequest_include_refs ::
+                                                     Prelude.Bool,
+                                                     documentSymbolsRequest_include_xlang_refs ::
+                                                     Prelude.Bool}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DocumentSymbolsRequest where
+  toJSON
+    (DocumentSymbolsRequest __field__repository __field__filepath
+       __field__range __field__include_refs __field__include_xlang_refs)
+    = Aeson.object
+        ("repository" .= unRepoName __field__repository :
+           "filepath" .= unPath __field__filepath :
+             Prelude.maybe Prelude.id ((:) . ("range" .=)) __field__range
+               ("include_refs" .= __field__include_refs :
+                  "include_xlang_refs" .= __field__include_xlang_refs :
+                    Prelude.mempty))
+
+instance Thrift.ThriftStruct DocumentSymbolsRequest where
+  buildStruct _proxy
+    (DocumentSymbolsRequest __field__repository __field__filepath
+       __field__range __field__include_refs __field__include_xlang_refs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repository" (Thrift.getStringType _proxy)
+           1
+           0
+           ((Thrift.genText _proxy . unRepoName) __field__repository)
+           :
+           Thrift.genField _proxy "filepath" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unPath) __field__filepath)
+             :
+             let (__cereal__range, __id__range)
+                   = case __field__range of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "range"
+                                                  (Thrift.getListType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.genList _proxy
+                                                     (Thrift.getStructType _proxy)
+                                                     (Thrift.buildStruct _proxy)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__range
+                 (Thrift.genFieldBool _proxy "include_refs" 4 __id__range
+                    __field__include_refs
+                    :
+                    Thrift.genFieldBool _proxy "include_xlang_refs" 5 4
+                      __field__include_xlang_refs
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repository <- ST.newSTRef (RepoName "")
+            __field__filepath <- ST.newSTRef (Path "")
+            __field__range <- ST.newSTRef Prelude.Nothing
+            __field__include_refs <- ST.newSTRef Prelude.True
+            __field__include_xlang_refs <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repository
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__filepath
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__range
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__include_refs
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__include_xlang_refs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repository <- ST.readSTRef
+                                                                     __field__repository
+                                             !__val__filepath <- ST.readSTRef __field__filepath
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__include_refs <- ST.readSTRef
+                                                                       __field__include_refs
+                                             !__val__include_xlang_refs <- ST.readSTRef
+                                                                             __field__include_xlang_refs
+                                             Prelude.pure
+                                               (DocumentSymbolsRequest __val__repository
+                                                  __val__filepath
+                                                  __val__range
+                                                  __val__include_refs
+                                                  __val__include_xlang_refs)
+              _idMap
+                = HashMap.fromList
+                    [("repository", 1), ("filepath", 2), ("range", 3),
+                     ("include_refs", 4), ("include_xlang_refs", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData DocumentSymbolsRequest where
+  rnf
+    (DocumentSymbolsRequest __field__repository __field__filepath
+       __field__range __field__include_refs __field__include_xlang_refs)
+    = DeepSeq.rnf __field__repository `Prelude.seq`
+        DeepSeq.rnf __field__filepath `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq`
+            DeepSeq.rnf __field__include_refs `Prelude.seq`
+              DeepSeq.rnf __field__include_xlang_refs `Prelude.seq` ()
+
+instance Default.Default DocumentSymbolsRequest where
+  def
+    = DocumentSymbolsRequest (RepoName "") (Path "") Prelude.Nothing
+        Prelude.True
+        Prelude.False
+
+instance Hashable.Hashable DocumentSymbolsRequest where
+  hashWithSalt __salt
+    (DocumentSymbolsRequest _repository _filepath _range _include_refs
+       _include_xlang_refs)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repository)
+                 _filepath)
+              _range)
+           _include_refs)
+        _include_xlang_refs
+
+newtype SymbolId = SymbolId{unSymbolId :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable SymbolId where
+  hashWithSalt __salt (SymbolId __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON SymbolId where
+  toJSON (SymbolId __val) = Aeson.toJSON __val
+
+data Attribute = Attribute_aBool Prelude.Bool
+               | Attribute_aInteger Int.Int64
+               | Attribute_aDouble Prelude.Double
+               | Attribute_aString Text.Text
+               | Attribute_aList [Text.Text]
+               | Attribute_aMapIntDouble (Map.Map Int.Int64 Prelude.Double)
+               | Attribute_aMapIntString (Map.Map Int.Int64 Text.Text)
+               | Attribute_aMapStringDouble (Map.Map Text.Text Prelude.Double)
+               | Attribute_EMPTY
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Attribute where
+  toJSON (Attribute_aBool __aBool)
+    = Aeson.object ["aBool" .= __aBool]
+  toJSON (Attribute_aInteger __aInteger)
+    = Aeson.object ["aInteger" .= __aInteger]
+  toJSON (Attribute_aDouble __aDouble)
+    = Aeson.object ["aDouble" .= __aDouble]
+  toJSON (Attribute_aString __aString)
+    = Aeson.object ["aString" .= __aString]
+  toJSON (Attribute_aList __aList)
+    = Aeson.object ["aList" .= __aList]
+  toJSON (Attribute_aMapIntDouble __aMapIntDouble)
+    = Aeson.object
+        ["aMapIntDouble" .= Map.mapKeys Thrift.keyToStr __aMapIntDouble]
+  toJSON (Attribute_aMapIntString __aMapIntString)
+    = Aeson.object
+        ["aMapIntString" .= Map.mapKeys Thrift.keyToStr __aMapIntString]
+  toJSON (Attribute_aMapStringDouble __aMapStringDouble)
+    = Aeson.object ["aMapStringDouble" .= __aMapStringDouble]
+  toJSON Attribute_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Attribute where
+  buildStruct _proxy (Attribute_aBool __aBool)
+    = Thrift.genStruct _proxy
+        [Thrift.genFieldBool _proxy "aBool" 1 0 __aBool]
+  buildStruct _proxy (Attribute_aInteger __aInteger)
+    = Thrift.genStruct _proxy
+        [Thrift.genFieldPrim _proxy "aInteger" (Thrift.getI64Type _proxy) 2
+           0
+           (Thrift.genI64Prim _proxy)
+           __aInteger]
+  buildStruct _proxy (Attribute_aDouble __aDouble)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aDouble" (Thrift.getDoubleType _proxy) 3 0
+           (Thrift.genDouble _proxy __aDouble)]
+  buildStruct _proxy (Attribute_aString __aString)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aString" (Thrift.getStringType _proxy) 4 0
+           (Thrift.genText _proxy __aString)]
+  buildStruct _proxy (Attribute_aList __aList)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aList" (Thrift.getListType _proxy) 5 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __aList)]
+  buildStruct _proxy (Attribute_aMapIntDouble __aMapIntDouble)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aMapIntDouble" (Thrift.getMapType _proxy)
+           6
+           0
+           ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+               (Thrift.getDoubleType _proxy)
+               Prelude.False
+               (Thrift.genI64 _proxy)
+               (Thrift.genDouble _proxy)
+               . Map.toList)
+              __aMapIntDouble)]
+  buildStruct _proxy (Attribute_aMapIntString __aMapIntString)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aMapIntString" (Thrift.getMapType _proxy)
+           7
+           0
+           ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+               (Thrift.getStringType _proxy)
+               Prelude.False
+               (Thrift.genI64 _proxy)
+               (Thrift.genText _proxy)
+               . Map.toList)
+              __aMapIntString)]
+  buildStruct _proxy (Attribute_aMapStringDouble __aMapStringDouble)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "aMapStringDouble"
+           (Thrift.getMapType _proxy)
+           8
+           0
+           ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+               (Thrift.getDoubleType _proxy)
+               Prelude.True
+               (Thrift.genText _proxy)
+               (Thrift.genDouble _proxy)
+               . Map.toList)
+              __aMapStringDouble)]
+  buildStruct _proxy Attribute_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getBoolType _proxy ->
+                                                         do _val <- Thrift.parseBoolF _proxy _bool
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Attribute_aBool _val)
+                                                     2 | _type == Thrift.getI64Type _proxy ->
+                                                         do _val <- Thrift.parseI64 _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Attribute_aInteger _val)
+                                                     3 | _type == Thrift.getDoubleType _proxy ->
+                                                         do _val <- Thrift.parseDouble _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Attribute_aDouble _val)
+                                                     4 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Attribute_aString _val)
+                                                     5 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseText _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Attribute_aList _val)
+                                                     6 | _type == Thrift.getMapType _proxy ->
+                                                         do _val <- Map.fromList <$>
+                                                                      Thrift.parseMap _proxy
+                                                                        (Thrift.parseI64 _proxy)
+                                                                        (Thrift.parseDouble _proxy)
+                                                                        Prelude.False
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Attribute_aMapIntDouble _val)
+                                                     7 | _type == Thrift.getMapType _proxy ->
+                                                         do _val <- Map.fromList <$>
+                                                                      Thrift.parseMap _proxy
+                                                                        (Thrift.parseI64 _proxy)
+                                                                        (Thrift.parseText _proxy)
+                                                                        Prelude.False
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Attribute_aMapIntString _val)
+                                                     8 | _type == Thrift.getMapType _proxy ->
+                                                         do _val <- Map.fromList <$>
+                                                                      Thrift.parseMap _proxy
+                                                                        (Thrift.parseText _proxy)
+                                                                        (Thrift.parseDouble _proxy)
+                                                                        Prelude.True
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Attribute_aMapStringDouble _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Attribute_EMPTY
+           Thrift.FieldEnd -> Prelude.return Attribute_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("aBool", 1), ("aInteger", 2), ("aDouble", 3), ("aString", 4),
+             ("aList", 5), ("aMapIntDouble", 6), ("aMapIntString", 7),
+             ("aMapStringDouble", 8)]
+
+instance DeepSeq.NFData Attribute where
+  rnf (Attribute_aBool __aBool) = DeepSeq.rnf __aBool
+  rnf (Attribute_aInteger __aInteger) = DeepSeq.rnf __aInteger
+  rnf (Attribute_aDouble __aDouble) = DeepSeq.rnf __aDouble
+  rnf (Attribute_aString __aString) = DeepSeq.rnf __aString
+  rnf (Attribute_aList __aList) = DeepSeq.rnf __aList
+  rnf (Attribute_aMapIntDouble __aMapIntDouble)
+    = DeepSeq.rnf __aMapIntDouble
+  rnf (Attribute_aMapIntString __aMapIntString)
+    = DeepSeq.rnf __aMapIntString
+  rnf (Attribute_aMapStringDouble __aMapStringDouble)
+    = DeepSeq.rnf __aMapStringDouble
+  rnf Attribute_EMPTY = ()
+
+instance Default.Default Attribute where
+  def = Attribute_EMPTY
+
+instance Hashable.Hashable Attribute where
+  hashWithSalt __salt (Attribute_aBool _aBool)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _aBool)
+  hashWithSalt __salt (Attribute_aInteger _aInteger)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _aInteger)
+  hashWithSalt __salt (Attribute_aDouble _aDouble)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _aDouble)
+  hashWithSalt __salt (Attribute_aString _aString)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _aString)
+  hashWithSalt __salt (Attribute_aList _aList)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _aList)
+  hashWithSalt __salt (Attribute_aMapIntDouble _aMapIntDouble)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+              _aMapIntDouble))
+  hashWithSalt __salt (Attribute_aMapIntString _aMapIntString)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 7
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+              _aMapIntString))
+  hashWithSalt __salt (Attribute_aMapStringDouble _aMapStringDouble)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 8
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+              _aMapStringDouble))
+  hashWithSalt __salt Attribute_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+newtype Attributes = Attributes{unAttributes ::
+                                Map.Map Text.Text Attribute}
+                     deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Attributes where
+  hashWithSalt __salt (Attributes __val)
+    = Hashable.hashWithSalt __salt
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) __val)
+
+instance Aeson.ToJSON Attributes where
+  toJSON (Attributes __val) = Aeson.toJSON __val
+
+data KeyedAttribute = KeyedAttribute{keyedAttribute_key ::
+                                     Text.Text,
+                                     keyedAttribute_attribute :: Attribute}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KeyedAttribute where
+  toJSON (KeyedAttribute __field__key __field__attribute)
+    = Aeson.object
+        ("key" .= __field__key :
+           "attribute" .= __field__attribute : Prelude.mempty)
+
+instance Thrift.ThriftStruct KeyedAttribute where
+  buildStruct _proxy (KeyedAttribute __field__key __field__attribute)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__key)
+           :
+           Thrift.genField _proxy "attribute" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__attribute)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key <- ST.newSTRef ""
+            __field__attribute <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key <- ST.readSTRef __field__key
+                                             !__val__attribute <- ST.readSTRef __field__attribute
+                                             Prelude.pure
+                                               (KeyedAttribute __val__key __val__attribute)
+              _idMap = HashMap.fromList [("key", 1), ("attribute", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KeyedAttribute where
+  rnf (KeyedAttribute __field__key __field__attribute)
+    = DeepSeq.rnf __field__key `Prelude.seq`
+        DeepSeq.rnf __field__attribute `Prelude.seq` ()
+
+instance Default.Default KeyedAttribute where
+  def = KeyedAttribute "" Default.def
+
+instance Hashable.Hashable KeyedAttribute where
+  hashWithSalt __salt (KeyedAttribute _key _attribute)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key)
+        _attribute
+
+newtype AttributeList = AttributeList{unAttributeList ::
+                                      [KeyedAttribute]}
+                        deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable AttributeList where
+  hashWithSalt __salt (AttributeList __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON AttributeList where
+  toJSON (AttributeList __val) = Aeson.toJSON __val
+
+data ReferenceRangeSymbolX = ReferenceRangeSymbolX{referenceRangeSymbolX_sym
+                                                   :: SymbolId,
+                                                   referenceRangeSymbolX_range ::
+                                                   {-# NOUNPACK #-} !Range,
+                                                   referenceRangeSymbolX_target :: LocationRange,
+                                                   referenceRangeSymbolX_attributes ::
+                                                   AttributeList}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferenceRangeSymbolX where
+  toJSON
+    (ReferenceRangeSymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = Aeson.object
+        ("sym" .= unSymbolId __field__sym :
+           "range" .= __field__range :
+             "target" .= __field__target :
+               "attributes" .= unAttributeList __field__attributes :
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferenceRangeSymbolX where
+  buildStruct _proxy
+    (ReferenceRangeSymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__sym)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               :
+               Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 4 3
+                 ((Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     . unAttributeList)
+                    __field__attributes)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__range <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef (AttributeList Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      AttributeList
+                                                                                      (Prelude.snd
+                                                                                         <$>
+                                                                                         Thrift.parseList
+                                                                                           _proxy
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (ReferenceRangeSymbolX __val__sym __val__range
+                                                  __val__target
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("sym", 1), ("range", 2), ("target", 3), ("attributes", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferenceRangeSymbolX where
+  rnf
+    (ReferenceRangeSymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = DeepSeq.rnf __field__sym `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default ReferenceRangeSymbolX where
+  def
+    = ReferenceRangeSymbolX (SymbolId "") Default.def Default.def
+        (AttributeList Default.def)
+
+instance Hashable.Hashable ReferenceRangeSymbolX where
+  hashWithSalt __salt
+    (ReferenceRangeSymbolX _sym _range _target _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sym) _range)
+           _target)
+        _attributes
+
+data DefinitionSymbolX = DefinitionSymbolX{definitionSymbolX_sym ::
+                                           SymbolId,
+                                           definitionSymbolX_range :: {-# NOUNPACK #-} !Range,
+                                           definitionSymbolX_nameRange ::
+                                           {-# NOUNPACK #-} !(Prelude.Maybe Range),
+                                           definitionSymbolX_attributes :: AttributeList}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionSymbolX where
+  toJSON
+    (DefinitionSymbolX __field__sym __field__range __field__nameRange
+       __field__attributes)
+    = Aeson.object
+        ("sym" .= unSymbolId __field__sym :
+           "range" .= __field__range :
+             Prelude.maybe Prelude.id ((:) . ("nameRange" .=))
+               __field__nameRange
+               ("attributes" .= unAttributeList __field__attributes :
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct DefinitionSymbolX where
+  buildStruct _proxy
+    (DefinitionSymbolX __field__sym __field__range __field__nameRange
+       __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__sym)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             let (__cereal__nameRange, __id__nameRange)
+                   = case __field__nameRange of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "nameRange"
+                                                  (Thrift.getStructType _proxy)
+                                                  4
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             4)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__nameRange
+                 (Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 3
+                    __id__nameRange
+                    ((Thrift.genList _proxy (Thrift.getStructType _proxy)
+                        (Thrift.buildStruct _proxy)
+                        . unAttributeList)
+                       __field__attributes)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__range <- ST.newSTRef Default.def
+            __field__nameRange <- ST.newSTRef Prelude.Nothing
+            __field__attributes <- ST.newSTRef (AttributeList Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameRange
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      AttributeList
+                                                                                      (Prelude.snd
+                                                                                         <$>
+                                                                                         Thrift.parseList
+                                                                                           _proxy
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__nameRange <- ST.readSTRef __field__nameRange
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (DefinitionSymbolX __val__sym __val__range
+                                                  __val__nameRange
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("sym", 1), ("range", 2), ("nameRange", 4), ("attributes", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionSymbolX where
+  rnf
+    (DefinitionSymbolX __field__sym __field__range __field__nameRange
+       __field__attributes)
+    = DeepSeq.rnf __field__sym `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__nameRange `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default DefinitionSymbolX where
+  def
+    = DefinitionSymbolX (SymbolId "") Default.def Prelude.Nothing
+        (AttributeList Default.def)
+
+instance Hashable.Hashable DefinitionSymbolX where
+  hashWithSalt __salt
+    (DefinitionSymbolX _sym _range _nameRange _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sym) _range)
+           _nameRange)
+        _attributes
+
+data SymbolX = SymbolX{symbolX_sym :: SymbolId,
+                       symbolX_range :: {-# NOUNPACK #-} !Range,
+                       symbolX_target :: Prelude.Maybe LocationRange,
+                       symbolX_attributes :: Attributes}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolX where
+  toJSON
+    (SymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = Aeson.object
+        ("sym" .= unSymbolId __field__sym :
+           "range" .= __field__range :
+             Prelude.maybe Prelude.id ((:) . ("target" .=)) __field__target
+               ("attributes" .= unAttributes __field__attributes :
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct SymbolX where
+  buildStruct _proxy
+    (SymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__sym)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             let (__cereal__target, __id__target)
+                   = case __field__target of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "target"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__target
+                 (Thrift.genField _proxy "attributes" (Thrift.getMapType _proxy) 4
+                    __id__target
+                    ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                        (Thrift.getStructType _proxy)
+                        Prelude.True
+                        (Thrift.genText _proxy)
+                        (Thrift.buildStruct _proxy)
+                        . Map.toList
+                        . unAttributes)
+                       __field__attributes)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__range <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Prelude.Nothing
+            __field__attributes <- ST.newSTRef (Attributes Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Attributes
+                                                                                      (Map.fromList
+                                                                                         <$>
+                                                                                         Thrift.parseMap
+                                                                                           _proxy
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)
+                                                                                           Prelude.True))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (SymbolX __val__sym __val__range __val__target
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("sym", 1), ("range", 2), ("target", 3), ("attributes", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolX where
+  rnf
+    (SymbolX __field__sym __field__range __field__target
+       __field__attributes)
+    = DeepSeq.rnf __field__sym `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default SymbolX where
+  def
+    = SymbolX (SymbolId "") Default.def Prelude.Nothing
+        (Attributes Default.def)
+
+instance Hashable.Hashable SymbolX where
+  hashWithSalt __salt (SymbolX _sym _range _target _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sym) _range)
+           _target)
+        _attributes
+
+data SymbolPath = SymbolPath{symbolPath_repository :: RepoName,
+                             symbolPath_filepath :: Path,
+                             symbolPath_range :: {-# NOUNPACK #-} !Range}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolPath where
+  toJSON
+    (SymbolPath __field__repository __field__filepath __field__range)
+    = Aeson.object
+        ("repository" .= unRepoName __field__repository :
+           "filepath" .= unPath __field__filepath :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolPath where
+  buildStruct _proxy
+    (SymbolPath __field__repository __field__filepath __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repository" (Thrift.getStringType _proxy)
+           1
+           0
+           ((Thrift.genText _proxy . unRepoName) __field__repository)
+           :
+           Thrift.genField _proxy "filepath" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unPath) __field__filepath)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repository <- ST.newSTRef (RepoName "")
+            __field__filepath <- ST.newSTRef (Path "")
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repository
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__filepath
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repository <- ST.readSTRef
+                                                                     __field__repository
+                                             !__val__filepath <- ST.readSTRef __field__filepath
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (SymbolPath __val__repository __val__filepath
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList
+                    [("repository", 1), ("filepath", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolPath where
+  rnf
+    (SymbolPath __field__repository __field__filepath __field__range)
+    = DeepSeq.rnf __field__repository `Prelude.seq`
+        DeepSeq.rnf __field__filepath `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default SymbolPath where
+  def = SymbolPath (RepoName "") (Path "") Default.def
+
+instance Hashable.Hashable SymbolPath where
+  hashWithSalt __salt (SymbolPath _repository _filepath _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repository)
+           _filepath)
+        _range
+
+type FileDigestMap = Map.Map Text.Text FileDigest
+
+type RepoFileDigestMap = Map.Map Text.Text FileDigestMap
+
+data DocumentSymbolListXResult = DocumentSymbolListXResult{documentSymbolListXResult_references
+                                                           :: [ReferenceRangeSymbolX],
+                                                           documentSymbolListXResult_definitions ::
+                                                           [DefinitionSymbolX],
+                                                           documentSymbolListXResult_revision ::
+                                                           Revision,
+                                                           documentSymbolListXResult_truncated ::
+                                                           Prelude.Bool,
+                                                           documentSymbolListXResult_digest ::
+                                                           Prelude.Maybe FileDigest,
+                                                           documentSymbolListXResult_referenced_file_digests
+                                                           :: RepoFileDigestMap,
+                                                           documentSymbolListXResult_content_match
+                                                           :: Prelude.Maybe Prelude.Bool,
+                                                           documentSymbolListXResult_attributes ::
+                                                           Prelude.Maybe AttributeList}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DocumentSymbolListXResult where
+  toJSON
+    (DocumentSymbolListXResult __field__references __field__definitions
+       __field__revision __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = Aeson.object
+        ("references" .= __field__references :
+           "definitions" .= __field__definitions :
+             "revision" .= unRevision __field__revision :
+               "truncated" .= __field__truncated :
+                 Prelude.maybe Prelude.id ((:) . ("digest" .=)) __field__digest
+                   ("referenced_file_digests" .= __field__referenced_file_digests :
+                      Prelude.maybe Prelude.id ((:) . ("content_match" .=))
+                        __field__content_match
+                        (Prelude.maybe Prelude.id ((:) . ("attributes" .=))
+                           (Prelude.fmap unAttributeList __field__attributes)
+                           Prelude.mempty)))
+
+instance Thrift.ThriftStruct DocumentSymbolListXResult where
+  buildStruct _proxy
+    (DocumentSymbolListXResult __field__references __field__definitions
+       __field__revision __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "references" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__references)
+           :
+           Thrift.genField _proxy "definitions" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__definitions)
+             :
+             Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 3 2
+               ((Thrift.genText _proxy . unRevision) __field__revision)
+               :
+               Thrift.genFieldBool _proxy "truncated" 4 3 __field__truncated :
+                 let (__cereal__digest, __id__digest)
+                       = case __field__digest of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "digest"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__digest
+                     (Thrift.genField _proxy "referenced_file_digests"
+                        (Thrift.getMapType _proxy)
+                        6
+                        __id__digest
+                        ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                            (Thrift.getMapType _proxy)
+                            Prelude.True
+                            (Thrift.genText _proxy)
+                            (Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                               (Thrift.getStructType _proxy)
+                               Prelude.True
+                               (Thrift.genText _proxy)
+                               (Thrift.buildStruct _proxy)
+                               . Map.toList)
+                            . Map.toList)
+                           __field__referenced_file_digests)
+                        :
+                        let (__cereal__content_match, __id__content_match)
+                              = case __field__content_match of
+                                  Prelude.Just _val -> ((:)
+                                                          (Thrift.genFieldBool _proxy
+                                                             "content_match"
+                                                             7
+                                                             6
+                                                             _val),
+                                                        7)
+                                  Prelude.Nothing -> (Prelude.id, 6)
+                          in
+                          __cereal__content_match
+                            (case __field__attributes of
+                               Prelude.Just _val -> Thrift.genField _proxy "attributes"
+                                                      (Thrift.getListType _proxy)
+                                                      8
+                                                      __id__content_match
+                                                      ((Thrift.genList _proxy
+                                                          (Thrift.getStructType _proxy)
+                                                          (Thrift.buildStruct _proxy)
+                                                          . unAttributeList)
+                                                         _val)
+                                                      : []
+                               Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__references <- ST.newSTRef Default.def
+            __field__definitions <- ST.newSTRef Default.def
+            __field__revision <- ST.newSTRef (Revision "")
+            __field__truncated <- ST.newSTRef Prelude.False
+            __field__digest <- ST.newSTRef Prelude.Nothing
+            __field__referenced_file_digests <- ST.newSTRef Default.def
+            __field__content_match <- ST.newSTRef Prelude.Nothing
+            __field__attributes <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__references
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__definitions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__truncated
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__digest
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Map.fromList
+                                                                                           <$>
+                                                                                           Thrift.parseMap
+                                                                                             _proxy
+                                                                                             (Thrift.parseText
+                                                                                                _proxy)
+                                                                                             (Thrift.parseStruct
+                                                                                                _proxy)
+                                                                                             Prelude.True)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__referenced_file_digests
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__content_match
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      AttributeList
+                                                                                      (Prelude.snd
+                                                                                         <$>
+                                                                                         Thrift.parseList
+                                                                                           _proxy
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__references <- ST.readSTRef
+                                                                     __field__references
+                                             !__val__definitions <- ST.readSTRef
+                                                                      __field__definitions
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             !__val__truncated <- ST.readSTRef __field__truncated
+                                             !__val__digest <- ST.readSTRef __field__digest
+                                             !__val__referenced_file_digests <- ST.readSTRef
+                                                                                  __field__referenced_file_digests
+                                             !__val__content_match <- ST.readSTRef
+                                                                        __field__content_match
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (DocumentSymbolListXResult __val__references
+                                                  __val__definitions
+                                                  __val__revision
+                                                  __val__truncated
+                                                  __val__digest
+                                                  __val__referenced_file_digests
+                                                  __val__content_match
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("references", 1), ("definitions", 2), ("revision", 3),
+                     ("truncated", 4), ("digest", 5), ("referenced_file_digests", 6),
+                     ("content_match", 7), ("attributes", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData DocumentSymbolListXResult where
+  rnf
+    (DocumentSymbolListXResult __field__references __field__definitions
+       __field__revision __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = DeepSeq.rnf __field__references `Prelude.seq`
+        DeepSeq.rnf __field__definitions `Prelude.seq`
+          DeepSeq.rnf __field__revision `Prelude.seq`
+            DeepSeq.rnf __field__truncated `Prelude.seq`
+              DeepSeq.rnf __field__digest `Prelude.seq`
+                DeepSeq.rnf __field__referenced_file_digests `Prelude.seq`
+                  DeepSeq.rnf __field__content_match `Prelude.seq`
+                    DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default DocumentSymbolListXResult where
+  def
+    = DocumentSymbolListXResult Default.def Default.def (Revision "")
+        Prelude.False
+        Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable DocumentSymbolListXResult where
+  hashWithSalt __salt
+    (DocumentSymbolListXResult _references _definitions _revision
+       _truncated _digest _referenced_file_digests _content_match
+       _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _references)
+                          _definitions)
+                       _revision)
+                    _truncated)
+                 _digest)
+              ((Prelude.map
+                  (\ (_k, _v) ->
+                     (_k, (Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _v))
+                  . Map.toAscList)
+                 _referenced_file_digests))
+           _content_match)
+        _attributes
+
+data DocumentSymbolIndex = DocumentSymbolIndex{documentSymbolIndex_symbols
+                                               :: Map.Map Int.Int64 [SymbolX],
+                                               documentSymbolIndex_revision :: Revision,
+                                               documentSymbolIndex_size ::
+                                               {-# UNPACK #-} !Int.Int64,
+                                               documentSymbolIndex_truncated :: Prelude.Bool,
+                                               documentSymbolIndex_digest ::
+                                               Prelude.Maybe FileDigest,
+                                               documentSymbolIndex_referenced_file_digests ::
+                                               RepoFileDigestMap,
+                                               documentSymbolIndex_content_match ::
+                                               Prelude.Maybe Prelude.Bool,
+                                               documentSymbolIndex_attributes ::
+                                               Prelude.Maybe AttributeList}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DocumentSymbolIndex where
+  toJSON
+    (DocumentSymbolIndex __field__symbols __field__revision
+       __field__size __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = Aeson.object
+        ("symbols" .= Map.mapKeys Thrift.keyToStr __field__symbols :
+           "revision" .= unRevision __field__revision :
+             "size" .= __field__size :
+               "truncated" .= __field__truncated :
+                 Prelude.maybe Prelude.id ((:) . ("digest" .=)) __field__digest
+                   ("referenced_file_digests" .= __field__referenced_file_digests :
+                      Prelude.maybe Prelude.id ((:) . ("content_match" .=))
+                        __field__content_match
+                        (Prelude.maybe Prelude.id ((:) . ("attributes" .=))
+                           (Prelude.fmap unAttributeList __field__attributes)
+                           Prelude.mempty)))
+
+instance Thrift.ThriftStruct DocumentSymbolIndex where
+  buildStruct _proxy
+    (DocumentSymbolIndex __field__symbols __field__revision
+       __field__size __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbols" (Thrift.getMapType _proxy) 1 0
+           ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+               (Thrift.getListType _proxy)
+               Prelude.False
+               (Thrift.genI64 _proxy)
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy))
+               . Map.toList)
+              __field__symbols)
+           :
+           Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unRevision) __field__revision)
+             :
+             Thrift.genFieldPrim _proxy "size" (Thrift.getI64Type _proxy) 3 2
+               (Thrift.genI64Prim _proxy)
+               __field__size
+               :
+               Thrift.genFieldBool _proxy "truncated" 4 3 __field__truncated :
+                 let (__cereal__digest, __id__digest)
+                       = case __field__digest of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "digest"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__digest
+                     (Thrift.genField _proxy "referenced_file_digests"
+                        (Thrift.getMapType _proxy)
+                        6
+                        __id__digest
+                        ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                            (Thrift.getMapType _proxy)
+                            Prelude.True
+                            (Thrift.genText _proxy)
+                            (Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                               (Thrift.getStructType _proxy)
+                               Prelude.True
+                               (Thrift.genText _proxy)
+                               (Thrift.buildStruct _proxy)
+                               . Map.toList)
+                            . Map.toList)
+                           __field__referenced_file_digests)
+                        :
+                        let (__cereal__content_match, __id__content_match)
+                              = case __field__content_match of
+                                  Prelude.Just _val -> ((:)
+                                                          (Thrift.genFieldBool _proxy
+                                                             "content_match"
+                                                             7
+                                                             6
+                                                             _val),
+                                                        7)
+                                  Prelude.Nothing -> (Prelude.id, 6)
+                          in
+                          __cereal__content_match
+                            (case __field__attributes of
+                               Prelude.Just _val -> Thrift.genField _proxy "attributes"
+                                                      (Thrift.getListType _proxy)
+                                                      8
+                                                      __id__content_match
+                                                      ((Thrift.genList _proxy
+                                                          (Thrift.getStructType _proxy)
+                                                          (Thrift.buildStruct _proxy)
+                                                          . unAttributeList)
+                                                         _val)
+                                                      : []
+                               Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbols <- ST.newSTRef Default.def
+            __field__revision <- ST.newSTRef (Revision "")
+            __field__size <- ST.newSTRef Default.def
+            __field__truncated <- ST.newSTRef Prelude.False
+            __field__digest <- ST.newSTRef Prelude.Nothing
+            __field__referenced_file_digests <- ST.newSTRef Default.def
+            __field__content_match <- ST.newSTRef Prelude.Nothing
+            __field__attributes <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Prelude.snd
+                                                                                           <$>
+                                                                                           Thrift.parseList
+                                                                                             _proxy
+                                                                                             (Thrift.parseStruct
+                                                                                                _proxy))
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__symbols
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__size
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__truncated
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__digest
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Map.fromList
+                                                                                           <$>
+                                                                                           Thrift.parseMap
+                                                                                             _proxy
+                                                                                             (Thrift.parseText
+                                                                                                _proxy)
+                                                                                             (Thrift.parseStruct
+                                                                                                _proxy)
+                                                                                             Prelude.True)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__referenced_file_digests
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__content_match
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      AttributeList
+                                                                                      (Prelude.snd
+                                                                                         <$>
+                                                                                         Thrift.parseList
+                                                                                           _proxy
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbols <- ST.readSTRef
+                                                                  __field__symbols
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             !__val__size <- ST.readSTRef __field__size
+                                             !__val__truncated <- ST.readSTRef __field__truncated
+                                             !__val__digest <- ST.readSTRef __field__digest
+                                             !__val__referenced_file_digests <- ST.readSTRef
+                                                                                  __field__referenced_file_digests
+                                             !__val__content_match <- ST.readSTRef
+                                                                        __field__content_match
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (DocumentSymbolIndex __val__symbols __val__revision
+                                                  __val__size
+                                                  __val__truncated
+                                                  __val__digest
+                                                  __val__referenced_file_digests
+                                                  __val__content_match
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("symbols", 1), ("revision", 2), ("size", 3), ("truncated", 4),
+                     ("digest", 5), ("referenced_file_digests", 6),
+                     ("content_match", 7), ("attributes", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData DocumentSymbolIndex where
+  rnf
+    (DocumentSymbolIndex __field__symbols __field__revision
+       __field__size __field__truncated __field__digest
+       __field__referenced_file_digests __field__content_match
+       __field__attributes)
+    = DeepSeq.rnf __field__symbols `Prelude.seq`
+        DeepSeq.rnf __field__revision `Prelude.seq`
+          DeepSeq.rnf __field__size `Prelude.seq`
+            DeepSeq.rnf __field__truncated `Prelude.seq`
+              DeepSeq.rnf __field__digest `Prelude.seq`
+                DeepSeq.rnf __field__referenced_file_digests `Prelude.seq`
+                  DeepSeq.rnf __field__content_match `Prelude.seq`
+                    DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default DocumentSymbolIndex where
+  def
+    = DocumentSymbolIndex Default.def (Revision "") Default.def
+        Prelude.False
+        Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable DocumentSymbolIndex where
+  hashWithSalt __salt
+    (DocumentSymbolIndex _symbols _revision _size _truncated _digest
+       _referenced_file_digests _content_match _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt __salt
+                             ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _symbols))
+                          _revision)
+                       _size)
+                    _truncated)
+                 _digest)
+              ((Prelude.map
+                  (\ (_k, _v) ->
+                     (_k, (Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _v))
+                  . Map.toAscList)
+                 _referenced_file_digests))
+           _content_match)
+        _attributes
+
+newtype ServerException = ServerException{serverException_message
+                                          :: Text.Text}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServerException where
+  toJSON (ServerException __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServerException where
+  buildStruct _proxy (ServerException __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (ServerException __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ServerException where
+  rnf (ServerException __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default ServerException where
+  def = ServerException ""
+
+instance Hashable.Hashable ServerException where
+  hashWithSalt __salt (ServerException _message)
+    = Hashable.hashWithSalt __salt _message
+
+instance Exception.Exception ServerException
+
+data GlassExceptionReason = GlassExceptionReason_noSrcFileFact Text.Text
+                          | GlassExceptionReason_noSrcFileLinesFact Text.Text
+                          | GlassExceptionReason_notIndexedFile Text.Text
+                          | GlassExceptionReason_entitySearchFail Text.Text
+                          | GlassExceptionReason_entityNotSupported Text.Text
+                          | GlassExceptionReason_attributesError Text.Text
+                          | GlassExceptionReason_exactRevisionNotAvailable Text.Text
+                          | GlassExceptionReason_matchingRevisionNotAvailable Text.Text
+                          | GlassExceptionReason_EMPTY
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlassExceptionReason where
+  toJSON (GlassExceptionReason_noSrcFileFact __noSrcFileFact)
+    = Aeson.object ["noSrcFileFact" .= __noSrcFileFact]
+  toJSON
+    (GlassExceptionReason_noSrcFileLinesFact __noSrcFileLinesFact)
+    = Aeson.object ["noSrcFileLinesFact" .= __noSrcFileLinesFact]
+  toJSON (GlassExceptionReason_notIndexedFile __notIndexedFile)
+    = Aeson.object ["notIndexedFile" .= __notIndexedFile]
+  toJSON (GlassExceptionReason_entitySearchFail __entitySearchFail)
+    = Aeson.object ["entitySearchFail" .= __entitySearchFail]
+  toJSON
+    (GlassExceptionReason_entityNotSupported __entityNotSupported)
+    = Aeson.object ["entityNotSupported" .= __entityNotSupported]
+  toJSON (GlassExceptionReason_attributesError __attributesError)
+    = Aeson.object ["attributesError" .= __attributesError]
+  toJSON
+    (GlassExceptionReason_exactRevisionNotAvailable
+       __exactRevisionNotAvailable)
+    = Aeson.object
+        ["exactRevisionNotAvailable" .= __exactRevisionNotAvailable]
+  toJSON
+    (GlassExceptionReason_matchingRevisionNotAvailable
+       __matchingRevisionNotAvailable)
+    = Aeson.object
+        ["matchingRevisionNotAvailable" .= __matchingRevisionNotAvailable]
+  toJSON GlassExceptionReason_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct GlassExceptionReason where
+  buildStruct _proxy
+    (GlassExceptionReason_noSrcFileFact __noSrcFileFact)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "noSrcFileFact"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __noSrcFileFact)]
+  buildStruct _proxy
+    (GlassExceptionReason_noSrcFileLinesFact __noSrcFileLinesFact)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "noSrcFileLinesFact"
+           (Thrift.getStringType _proxy)
+           2
+           0
+           (Thrift.genText _proxy __noSrcFileLinesFact)]
+  buildStruct _proxy
+    (GlassExceptionReason_notIndexedFile __notIndexedFile)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "notIndexedFile"
+           (Thrift.getStringType _proxy)
+           3
+           0
+           (Thrift.genText _proxy __notIndexedFile)]
+  buildStruct _proxy
+    (GlassExceptionReason_entitySearchFail __entitySearchFail)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "entitySearchFail"
+           (Thrift.getStringType _proxy)
+           4
+           0
+           (Thrift.genText _proxy __entitySearchFail)]
+  buildStruct _proxy
+    (GlassExceptionReason_entityNotSupported __entityNotSupported)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "entityNotSupported"
+           (Thrift.getStringType _proxy)
+           5
+           0
+           (Thrift.genText _proxy __entityNotSupported)]
+  buildStruct _proxy
+    (GlassExceptionReason_attributesError __attributesError)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "attributesError"
+           (Thrift.getStringType _proxy)
+           6
+           0
+           (Thrift.genText _proxy __attributesError)]
+  buildStruct _proxy
+    (GlassExceptionReason_exactRevisionNotAvailable
+       __exactRevisionNotAvailable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "exactRevisionNotAvailable"
+           (Thrift.getStringType _proxy)
+           7
+           0
+           (Thrift.genText _proxy __exactRevisionNotAvailable)]
+  buildStruct _proxy
+    (GlassExceptionReason_matchingRevisionNotAvailable
+       __matchingRevisionNotAvailable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "matchingRevisionNotAvailable"
+           (Thrift.getStringType _proxy)
+           8
+           0
+           (Thrift.genText _proxy __matchingRevisionNotAvailable)]
+  buildStruct _proxy GlassExceptionReason_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_noSrcFileFact
+                                                                 _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_noSrcFileLinesFact
+                                                                 _val)
+                                                     3 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_notIndexedFile
+                                                                 _val)
+                                                     4 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_entitySearchFail
+                                                                 _val)
+                                                     5 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_entityNotSupported
+                                                                 _val)
+                                                     6 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_attributesError
+                                                                 _val)
+                                                     7 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_exactRevisionNotAvailable
+                                                                 _val)
+                                                     8 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GlassExceptionReason_matchingRevisionNotAvailable
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               GlassExceptionReason_EMPTY
+           Thrift.FieldEnd -> Prelude.return GlassExceptionReason_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("noSrcFileFact", 1), ("noSrcFileLinesFact", 2),
+             ("notIndexedFile", 3), ("entitySearchFail", 4),
+             ("entityNotSupported", 5), ("attributesError", 6),
+             ("exactRevisionNotAvailable", 7),
+             ("matchingRevisionNotAvailable", 8)]
+
+instance DeepSeq.NFData GlassExceptionReason where
+  rnf (GlassExceptionReason_noSrcFileFact __noSrcFileFact)
+    = DeepSeq.rnf __noSrcFileFact
+  rnf (GlassExceptionReason_noSrcFileLinesFact __noSrcFileLinesFact)
+    = DeepSeq.rnf __noSrcFileLinesFact
+  rnf (GlassExceptionReason_notIndexedFile __notIndexedFile)
+    = DeepSeq.rnf __notIndexedFile
+  rnf (GlassExceptionReason_entitySearchFail __entitySearchFail)
+    = DeepSeq.rnf __entitySearchFail
+  rnf (GlassExceptionReason_entityNotSupported __entityNotSupported)
+    = DeepSeq.rnf __entityNotSupported
+  rnf (GlassExceptionReason_attributesError __attributesError)
+    = DeepSeq.rnf __attributesError
+  rnf
+    (GlassExceptionReason_exactRevisionNotAvailable
+       __exactRevisionNotAvailable)
+    = DeepSeq.rnf __exactRevisionNotAvailable
+  rnf
+    (GlassExceptionReason_matchingRevisionNotAvailable
+       __matchingRevisionNotAvailable)
+    = DeepSeq.rnf __matchingRevisionNotAvailable
+  rnf GlassExceptionReason_EMPTY = ()
+
+instance Default.Default GlassExceptionReason where
+  def = GlassExceptionReason_EMPTY
+
+instance Hashable.Hashable GlassExceptionReason where
+  hashWithSalt __salt
+    (GlassExceptionReason_noSrcFileFact _noSrcFileFact)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _noSrcFileFact)
+  hashWithSalt __salt
+    (GlassExceptionReason_noSrcFileLinesFact _noSrcFileLinesFact)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _noSrcFileLinesFact)
+  hashWithSalt __salt
+    (GlassExceptionReason_notIndexedFile _notIndexedFile)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _notIndexedFile)
+  hashWithSalt __salt
+    (GlassExceptionReason_entitySearchFail _entitySearchFail)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _entitySearchFail)
+  hashWithSalt __salt
+    (GlassExceptionReason_entityNotSupported _entityNotSupported)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _entityNotSupported)
+  hashWithSalt __salt
+    (GlassExceptionReason_attributesError _attributesError)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _attributesError)
+  hashWithSalt __salt
+    (GlassExceptionReason_exactRevisionNotAvailable
+       _exactRevisionNotAvailable)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 7 _exactRevisionNotAvailable)
+  hashWithSalt __salt
+    (GlassExceptionReason_matchingRevisionNotAvailable
+       _matchingRevisionNotAvailable)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 8 _matchingRevisionNotAvailable)
+  hashWithSalt __salt GlassExceptionReason_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data GlassException = GlassException{glassException_reasons ::
+                                     [GlassExceptionReason],
+                                     glassException_revisions :: [Revision]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlassException where
+  toJSON (GlassException __field__reasons __field__revisions)
+    = Aeson.object
+        ("reasons" .= __field__reasons :
+           "revisions" .= Prelude.map unRevision __field__revisions :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GlassException where
+  buildStruct _proxy
+    (GlassException __field__reasons __field__revisions)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "reasons" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__reasons)
+           :
+           Thrift.genField _proxy "revisions" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy . unRevision)
+                __field__revisions)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__reasons <- ST.newSTRef Default.def
+            __field__revisions <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__reasons
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           Revision
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__revisions
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__reasons <- ST.readSTRef
+                                                                  __field__reasons
+                                             !__val__revisions <- ST.readSTRef __field__revisions
+                                             Prelude.pure
+                                               (GlassException __val__reasons __val__revisions)
+              _idMap = HashMap.fromList [("reasons", 1), ("revisions", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GlassException where
+  rnf (GlassException __field__reasons __field__revisions)
+    = DeepSeq.rnf __field__reasons `Prelude.seq`
+        DeepSeq.rnf __field__revisions `Prelude.seq` ()
+
+instance Default.Default GlassException where
+  def = GlassException Default.def Default.def
+
+instance Hashable.Hashable GlassException where
+  hashWithSalt __salt (GlassException _reasons _revisions)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _reasons)
+        _revisions
+
+instance Exception.Exception GlassException
+
+newtype Name = Name{unName :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __val) = Aeson.toJSON __val
+
+data QualifiedName = QualifiedName{qualifiedName_localName :: Name,
+                                   qualifiedName_container :: Name}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QualifiedName where
+  toJSON (QualifiedName __field__localName __field__container)
+    = Aeson.object
+        ("localName" .= unName __field__localName :
+           "container" .= unName __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct QualifiedName where
+  buildStruct _proxy
+    (QualifiedName __field__localName __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "localName" (Thrift.getStringType _proxy) 1
+           0
+           ((Thrift.genText _proxy . unName) __field__localName)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStringType _proxy) 2
+             1
+             ((Thrift.genText _proxy . unName) __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__localName <- ST.newSTRef (Name "")
+            __field__container <- ST.newSTRef (Name "")
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Name
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__localName
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Name
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__localName <- ST.readSTRef
+                                                                    __field__localName
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (QualifiedName __val__localName __val__container)
+              _idMap = HashMap.fromList [("localName", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QualifiedName where
+  rnf (QualifiedName __field__localName __field__container)
+    = DeepSeq.rnf __field__localName `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default QualifiedName where
+  def = QualifiedName (Name "") (Name "")
+
+instance Hashable.Hashable QualifiedName where
+  hashWithSalt __salt (QualifiedName _localName _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _localName)
+        _container
+
+data Annotation = Annotation{annotation_source :: Text.Text,
+                             annotation_symbol :: Prelude.Maybe SymbolId,
+                             annotation_name :: Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotation where
+  toJSON (Annotation __field__source __field__symbol __field__name)
+    = Aeson.object
+        ("source" .= __field__source :
+           Prelude.maybe Prelude.id ((:) . ("symbol" .=))
+             (Prelude.fmap unSymbolId __field__symbol)
+             ("name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct Annotation where
+  buildStruct _proxy
+    (Annotation __field__source __field__symbol __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__source)
+           :
+           let (__cereal__symbol, __id__symbol)
+                 = case __field__symbol of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "symbol"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genText _proxy . unSymbolId) _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__symbol
+               (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3
+                  __id__symbol
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef ""
+            __field__symbol <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__symbol <- ST.readSTRef __field__symbol
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (Annotation __val__source __val__symbol __val__name)
+              _idMap
+                = HashMap.fromList [("source", 1), ("symbol", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Annotation where
+  rnf (Annotation __field__source __field__symbol __field__name)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__symbol `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Annotation where
+  def = Annotation "" Prelude.Nothing ""
+
+instance Hashable.Hashable Annotation where
+  hashWithSalt __salt (Annotation _source _symbol _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+           _symbol)
+        _name
+
+data Visibility = Visibility_Public
+                | Visibility_Protected
+                | Visibility_Private
+                | Visibility_Internal
+                | Visibility__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Visibility where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Visibility where
+  rnf __Visibility = Prelude.seq __Visibility ()
+
+instance Default.Default Visibility where
+  def = Visibility_Public
+
+instance Hashable.Hashable Visibility where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Visibility where
+  toThriftEnum 20 = Visibility_Public
+  toThriftEnum 30 = Visibility_Protected
+  toThriftEnum 40 = Visibility_Private
+  toThriftEnum 50 = Visibility_Internal
+  toThriftEnum val = Visibility__UNKNOWN val
+  fromThriftEnum Visibility_Public = 20
+  fromThriftEnum Visibility_Protected = 30
+  fromThriftEnum Visibility_Private = 40
+  fromThriftEnum Visibility_Internal = 50
+  fromThriftEnum (Visibility__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Visibility_Public, Visibility_Protected, Visibility_Private,
+       Visibility_Internal]
+  toThriftEnumEither 20 = Prelude.Right Visibility_Public
+  toThriftEnumEither 30 = Prelude.Right Visibility_Protected
+  toThriftEnumEither 40 = Prelude.Right Visibility_Private
+  toThriftEnumEither 50 = Prelude.Right Visibility_Internal
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Visibility: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord Visibility where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data Modifier = Modifier_ABSTRACT
+              | Modifier_FINAL
+              | Modifier_ASYNC
+              | Modifier_STATIC
+              | Modifier_READONLY
+              | Modifier_CONST
+              | Modifier_MUTABLE
+              | Modifier_VOLATILE
+              | Modifier_VIRTUAL
+              | Modifier_INLINE
+              | Modifier__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Modifier where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Modifier where
+  rnf __Modifier = Prelude.seq __Modifier ()
+
+instance Default.Default Modifier where
+  def = Modifier_ABSTRACT
+
+instance Hashable.Hashable Modifier where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Modifier where
+  toThriftEnum 1 = Modifier_ABSTRACT
+  toThriftEnum 2 = Modifier_FINAL
+  toThriftEnum 3 = Modifier_ASYNC
+  toThriftEnum 4 = Modifier_STATIC
+  toThriftEnum 5 = Modifier_READONLY
+  toThriftEnum 6 = Modifier_CONST
+  toThriftEnum 7 = Modifier_MUTABLE
+  toThriftEnum 8 = Modifier_VOLATILE
+  toThriftEnum 9 = Modifier_VIRTUAL
+  toThriftEnum 10 = Modifier_INLINE
+  toThriftEnum val = Modifier__UNKNOWN val
+  fromThriftEnum Modifier_ABSTRACT = 1
+  fromThriftEnum Modifier_FINAL = 2
+  fromThriftEnum Modifier_ASYNC = 3
+  fromThriftEnum Modifier_STATIC = 4
+  fromThriftEnum Modifier_READONLY = 5
+  fromThriftEnum Modifier_CONST = 6
+  fromThriftEnum Modifier_MUTABLE = 7
+  fromThriftEnum Modifier_VOLATILE = 8
+  fromThriftEnum Modifier_VIRTUAL = 9
+  fromThriftEnum Modifier_INLINE = 10
+  fromThriftEnum (Modifier__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Modifier_ABSTRACT, Modifier_FINAL, Modifier_ASYNC,
+       Modifier_STATIC, Modifier_READONLY, Modifier_CONST,
+       Modifier_MUTABLE, Modifier_VOLATILE, Modifier_VIRTUAL,
+       Modifier_INLINE]
+  toThriftEnumEither 1 = Prelude.Right Modifier_ABSTRACT
+  toThriftEnumEither 2 = Prelude.Right Modifier_FINAL
+  toThriftEnumEither 3 = Prelude.Right Modifier_ASYNC
+  toThriftEnumEither 4 = Prelude.Right Modifier_STATIC
+  toThriftEnumEither 5 = Prelude.Right Modifier_READONLY
+  toThriftEnumEither 6 = Prelude.Right Modifier_CONST
+  toThriftEnumEither 7 = Prelude.Right Modifier_MUTABLE
+  toThriftEnumEither 8 = Prelude.Right Modifier_VOLATILE
+  toThriftEnumEither 9 = Prelude.Right Modifier_VIRTUAL
+  toThriftEnumEither 10 = Prelude.Right Modifier_INLINE
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Modifier: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord Modifier where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data TypeSymSpan = TypeSymSpan{typeSymSpan_type :: SymbolId,
+                               typeSymSpan_span :: ByteSpan}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeSymSpan where
+  toJSON (TypeSymSpan __field__type __field__span)
+    = Aeson.object
+        ("type" .= unSymbolId __field__type :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeSymSpan where
+  buildStruct _proxy (TypeSymSpan __field__type __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__type)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef (SymbolId "")
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (TypeSymSpan __val__type __val__span)
+              _idMap = HashMap.fromList [("type", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeSymSpan where
+  rnf (TypeSymSpan __field__type __field__span)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default TypeSymSpan where
+  def = TypeSymSpan (SymbolId "") Default.def
+
+instance Hashable.Hashable TypeSymSpan where
+  hashWithSalt __salt (TypeSymSpan _type _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _span
+
+data SymbolBasicDescription = SymbolBasicDescription{symbolBasicDescription_sym
+                                                     :: SymbolId,
+                                                     symbolBasicDescription_name :: QualifiedName,
+                                                     symbolBasicDescription_kind ::
+                                                     Prelude.Maybe SymbolKind,
+                                                     symbolBasicDescription_language :: Language,
+                                                     symbolBasicDescription_signature ::
+                                                     Prelude.Maybe Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolBasicDescription where
+  toJSON
+    (SymbolBasicDescription __field__sym __field__name __field__kind
+       __field__language __field__signature)
+    = Aeson.object
+        ("sym" .= unSymbolId __field__sym :
+           "name" .= __field__name :
+             Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+               ("language" .= __field__language :
+                  Prelude.maybe Prelude.id ((:) . ("signature" .=))
+                    __field__signature
+                    Prelude.mempty))
+
+instance Thrift.ThriftStruct SymbolBasicDescription where
+  buildStruct _proxy
+    (SymbolBasicDescription __field__sym __field__name __field__kind
+       __field__language __field__signature)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__sym)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             let (__cereal__kind, __id__kind)
+                   = case __field__kind of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kind"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kind
+                 (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 4
+                    __id__kind
+                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                        Thrift.fromThriftEnum)
+                       __field__language)
+                    :
+                    case __field__signature of
+                      Prelude.Just _val -> Thrift.genField _proxy "signature"
+                                             (Thrift.getStringType _proxy)
+                                             5
+                                             4
+                                             (Thrift.genText _proxy _val)
+                                             : []
+                      Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__name <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             Prelude.pure
+                                               (SymbolBasicDescription __val__sym __val__name
+                                                  __val__kind
+                                                  __val__language
+                                                  __val__signature)
+              _idMap
+                = HashMap.fromList
+                    [("sym", 1), ("name", 2), ("kind", 3), ("language", 4),
+                     ("signature", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolBasicDescription where
+  rnf
+    (SymbolBasicDescription __field__sym __field__name __field__kind
+       __field__language __field__signature)
+    = DeepSeq.rnf __field__sym `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq`
+            DeepSeq.rnf __field__language `Prelude.seq`
+              DeepSeq.rnf __field__signature `Prelude.seq` ()
+
+instance Default.Default SymbolBasicDescription where
+  def
+    = SymbolBasicDescription (SymbolId "") Default.def Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable SymbolBasicDescription where
+  hashWithSalt __salt
+    (SymbolBasicDescription _sym _name _kind _language _signature)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sym) _name)
+              _kind)
+           _language)
+        _signature
+
+data SymbolDescription = SymbolDescription{symbolDescription_sym ::
+                                           SymbolId,
+                                           symbolDescription_location :: SymbolPath,
+                                           symbolDescription_name :: QualifiedName,
+                                           symbolDescription_kind :: Prelude.Maybe SymbolKind,
+                                           symbolDescription_annotations ::
+                                           Prelude.Maybe [Annotation],
+                                           symbolDescription_visibility :: Prelude.Maybe Visibility,
+                                           symbolDescription_repo_hash :: Revision,
+                                           symbolDescription_language :: Language,
+                                           symbolDescription_signature :: Prelude.Maybe Text.Text,
+                                           symbolDescription_sym_location :: LocationRange,
+                                           symbolDescription_sym_other_locations :: [LocationRange],
+                                           symbolDescription_extends_relation ::
+                                           RelationDescription,
+                                           symbolDescription_contains_relation ::
+                                           RelationDescription,
+                                           symbolDescription_modifiers :: Set.Set Modifier,
+                                           symbolDescription_type_xrefs :: [TypeSymSpan],
+                                           symbolDescription_pretty_comments :: [SymbolComment],
+                                           symbolDescription_native_sym ::
+                                           Prelude.Maybe NativeSymbol}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolDescription where
+  toJSON
+    (SymbolDescription __field__sym __field__location __field__name
+       __field__kind __field__annotations __field__visibility
+       __field__repo_hash __field__language __field__signature
+       __field__sym_location __field__sym_other_locations
+       __field__extends_relation __field__contains_relation
+       __field__modifiers __field__type_xrefs __field__pretty_comments
+       __field__native_sym)
+    = Aeson.object
+        ("sym" .= unSymbolId __field__sym :
+           "location" .= __field__location :
+             "name" .= __field__name :
+               Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+                 (Prelude.maybe Prelude.id ((:) . ("annotations" .=))
+                    __field__annotations
+                    (Prelude.maybe Prelude.id ((:) . ("visibility" .=))
+                       __field__visibility
+                       ("repo_hash" .= unRevision __field__repo_hash :
+                          "language" .= __field__language :
+                            Prelude.maybe Prelude.id ((:) . ("signature" .=))
+                              __field__signature
+                              ("sym_location" .= __field__sym_location :
+                                 "sym_other_locations" .= __field__sym_other_locations :
+                                   "extends_relation" .= __field__extends_relation :
+                                     "contains_relation" .= __field__contains_relation :
+                                       "modifiers" .= __field__modifiers :
+                                         "type_xrefs" .= __field__type_xrefs :
+                                           "pretty_comments" .= __field__pretty_comments :
+                                             Prelude.maybe Prelude.id ((:) . ("native_sym" .=))
+                                               __field__native_sym
+                                               Prelude.mempty)))))
+
+instance Thrift.ThriftStruct SymbolDescription where
+  buildStruct _proxy
+    (SymbolDescription __field__sym __field__location __field__name
+       __field__kind __field__annotations __field__visibility
+       __field__repo_hash __field__language __field__signature
+       __field__sym_location __field__sym_other_locations
+       __field__extends_relation __field__contains_relation
+       __field__modifiers __field__type_xrefs __field__pretty_comments
+       __field__native_sym)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__sym)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               :
+               let (__cereal__kind, __id__kind)
+                     = case __field__kind of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kind"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kind
+                   (let (__cereal__annotations, __id__annotations)
+                          = case __field__annotations of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "annotations"
+                                                         (Thrift.getListType _proxy)
+                                                         5
+                                                         __id__kind
+                                                         (Thrift.genList _proxy
+                                                            (Thrift.getStructType _proxy)
+                                                            (Thrift.buildStruct _proxy)
+                                                            _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, __id__kind)
+                      in
+                      __cereal__annotations
+                        (let (__cereal__visibility, __id__visibility)
+                               = case __field__visibility of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "visibility"
+                                                              (Thrift.getI32Type _proxy)
+                                                              7
+                                                              __id__annotations
+                                                              ((Thrift.genI32 _proxy .
+                                                                  Prelude.fromIntegral
+                                                                  . Thrift.fromThriftEnum)
+                                                                 _val)),
+                                                         7)
+                                   Prelude.Nothing -> (Prelude.id, __id__annotations)
+                           in
+                           __cereal__visibility
+                             (Thrift.genField _proxy "repo_hash" (Thrift.getStringType _proxy) 8
+                                __id__visibility
+                                ((Thrift.genText _proxy . unRevision) __field__repo_hash)
+                                :
+                                Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 9 8
+                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                      Thrift.fromThriftEnum)
+                                     __field__language)
+                                  :
+                                  let (__cereal__signature, __id__signature)
+                                        = case __field__signature of
+                                            Prelude.Just _val -> ((:)
+                                                                    (Thrift.genField _proxy
+                                                                       "signature"
+                                                                       (Thrift.getStringType _proxy)
+                                                                       10
+                                                                       9
+                                                                       (Thrift.genText _proxy
+                                                                          _val)),
+                                                                  10)
+                                            Prelude.Nothing -> (Prelude.id, 9)
+                                    in
+                                    __cereal__signature
+                                      (Thrift.genField _proxy "sym_location"
+                                         (Thrift.getStructType _proxy)
+                                         11
+                                         __id__signature
+                                         (Thrift.buildStruct _proxy __field__sym_location)
+                                         :
+                                         Thrift.genField _proxy "sym_other_locations"
+                                           (Thrift.getListType _proxy)
+                                           12
+                                           11
+                                           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                              (Thrift.buildStruct _proxy)
+                                              __field__sym_other_locations)
+                                           :
+                                           Thrift.genField _proxy "extends_relation"
+                                             (Thrift.getStructType _proxy)
+                                             13
+                                             12
+                                             (Thrift.buildStruct _proxy __field__extends_relation)
+                                             :
+                                             Thrift.genField _proxy "contains_relation"
+                                               (Thrift.getStructType _proxy)
+                                               14
+                                               13
+                                               (Thrift.buildStruct _proxy
+                                                  __field__contains_relation)
+                                               :
+                                               Thrift.genField _proxy "modifiers"
+                                                 (Thrift.getSetType _proxy)
+                                                 15
+                                                 14
+                                                 ((Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                                                     (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                     . Set.toList)
+                                                    __field__modifiers)
+                                                 :
+                                                 Thrift.genField _proxy "type_xrefs"
+                                                   (Thrift.getListType _proxy)
+                                                   16
+                                                   15
+                                                   (Thrift.genList _proxy
+                                                      (Thrift.getStructType _proxy)
+                                                      (Thrift.buildStruct _proxy)
+                                                      __field__type_xrefs)
+                                                   :
+                                                   Thrift.genField _proxy "pretty_comments"
+                                                     (Thrift.getListType _proxy)
+                                                     17
+                                                     16
+                                                     (Thrift.genList _proxy
+                                                        (Thrift.getStructType _proxy)
+                                                        (Thrift.buildStruct _proxy)
+                                                        __field__pretty_comments)
+                                                     :
+                                                     case __field__native_sym of
+                                                       Prelude.Just _val -> Thrift.genField _proxy
+                                                                              "native_sym"
+                                                                              (Thrift.getStructType
+                                                                                 _proxy)
+                                                                              18
+                                                                              17
+                                                                              (Thrift.buildStruct
+                                                                                 _proxy
+                                                                                 _val)
+                                                                              : []
+                                                       Prelude.Nothing -> [])))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__location <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__annotations <- ST.newSTRef Prelude.Nothing
+            __field__visibility <- ST.newSTRef Prelude.Nothing
+            __field__repo_hash <- ST.newSTRef (Revision "")
+            __field__language <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Prelude.Nothing
+            __field__sym_location <- ST.newSTRef Default.def
+            __field__sym_other_locations <- ST.newSTRef Default.def
+            __field__extends_relation <- ST.newSTRef Default.def
+            __field__contains_relation <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__type_xrefs <- ST.newSTRef Default.def
+            __field__pretty_comments <- ST.newSTRef Default.def
+            __field__native_sym <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repo_hash
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getStringType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseText
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__signature
+                                                                           (Prelude.Just _val)
+                                                                 11 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__sym_location
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__sym_other_locations
+                                                                           _val
+                                                                 13 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__extends_relation
+                                                                           _val
+                                                                 14 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__contains_relation
+                                                                           _val
+                                                                 15 | _type ==
+                                                                        Thrift.getSetType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Set.fromList .
+                                                                                       Prelude.snd
+                                                                                       <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseEnum
+                                                                                            _proxy
+                                                                                            "Modifier"))
+                                                                         ST.writeSTRef
+                                                                           __field__modifiers
+                                                                           _val
+                                                                 16 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__type_xrefs
+                                                                           _val
+                                                                 17 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__pretty_comments
+                                                                           _val
+                                                                 18 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__native_sym
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             !__val__repo_hash <- ST.readSTRef __field__repo_hash
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__sym_location <- ST.readSTRef
+                                                                       __field__sym_location
+                                             !__val__sym_other_locations <- ST.readSTRef
+                                                                              __field__sym_other_locations
+                                             !__val__extends_relation <- ST.readSTRef
+                                                                           __field__extends_relation
+                                             !__val__contains_relation <- ST.readSTRef
+                                                                            __field__contains_relation
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__type_xrefs <- ST.readSTRef __field__type_xrefs
+                                             !__val__pretty_comments <- ST.readSTRef
+                                                                          __field__pretty_comments
+                                             !__val__native_sym <- ST.readSTRef __field__native_sym
+                                             Prelude.pure
+                                               (SymbolDescription __val__sym __val__location
+                                                  __val__name
+                                                  __val__kind
+                                                  __val__annotations
+                                                  __val__visibility
+                                                  __val__repo_hash
+                                                  __val__language
+                                                  __val__signature
+                                                  __val__sym_location
+                                                  __val__sym_other_locations
+                                                  __val__extends_relation
+                                                  __val__contains_relation
+                                                  __val__modifiers
+                                                  __val__type_xrefs
+                                                  __val__pretty_comments
+                                                  __val__native_sym)
+              _idMap
+                = HashMap.fromList
+                    [("sym", 1), ("location", 2), ("name", 3), ("kind", 4),
+                     ("annotations", 5), ("visibility", 7), ("repo_hash", 8),
+                     ("language", 9), ("signature", 10), ("sym_location", 11),
+                     ("sym_other_locations", 12), ("extends_relation", 13),
+                     ("contains_relation", 14), ("modifiers", 15), ("type_xrefs", 16),
+                     ("pretty_comments", 17), ("native_sym", 18)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolDescription where
+  rnf
+    (SymbolDescription __field__sym __field__location __field__name
+       __field__kind __field__annotations __field__visibility
+       __field__repo_hash __field__language __field__signature
+       __field__sym_location __field__sym_other_locations
+       __field__extends_relation __field__contains_relation
+       __field__modifiers __field__type_xrefs __field__pretty_comments
+       __field__native_sym)
+    = DeepSeq.rnf __field__sym `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__kind `Prelude.seq`
+              DeepSeq.rnf __field__annotations `Prelude.seq`
+                DeepSeq.rnf __field__visibility `Prelude.seq`
+                  DeepSeq.rnf __field__repo_hash `Prelude.seq`
+                    DeepSeq.rnf __field__language `Prelude.seq`
+                      DeepSeq.rnf __field__signature `Prelude.seq`
+                        DeepSeq.rnf __field__sym_location `Prelude.seq`
+                          DeepSeq.rnf __field__sym_other_locations `Prelude.seq`
+                            DeepSeq.rnf __field__extends_relation `Prelude.seq`
+                              DeepSeq.rnf __field__contains_relation `Prelude.seq`
+                                DeepSeq.rnf __field__modifiers `Prelude.seq`
+                                  DeepSeq.rnf __field__type_xrefs `Prelude.seq`
+                                    DeepSeq.rnf __field__pretty_comments `Prelude.seq`
+                                      DeepSeq.rnf __field__native_sym `Prelude.seq` ()
+
+instance Default.Default SymbolDescription where
+  def
+    = SymbolDescription (SymbolId "") Default.def Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        (Revision "")
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable SymbolDescription where
+  hashWithSalt __salt
+    (SymbolDescription _sym _location _name _kind _annotations
+       _visibility _repo_hash _language _signature _sym_location
+       _sym_other_locations _extends_relation _contains_relation
+       _modifiers _type_xrefs _pretty_comments _native_sym)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt
+                                   (Hashable.hashWithSalt
+                                      (Hashable.hashWithSalt
+                                         (Hashable.hashWithSalt
+                                            (Hashable.hashWithSalt
+                                               (Hashable.hashWithSalt
+                                                  (Hashable.hashWithSalt
+                                                     (Hashable.hashWithSalt __salt _sym)
+                                                     _location)
+                                                  _name)
+                                               _kind)
+                                            _annotations)
+                                         _visibility)
+                                      _repo_hash)
+                                   _language)
+                                _signature)
+                             _sym_location)
+                          _sym_other_locations)
+                       _extends_relation)
+                    _contains_relation)
+                 (Set.elems _modifiers))
+              _type_xrefs)
+           _pretty_comments)
+        _native_sym
+
+data SymbolComment = SymbolComment{symbolComment_location ::
+                                   LocationRange,
+                                   symbolComment_comment :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolComment where
+  toJSON (SymbolComment __field__location __field__comment)
+    = Aeson.object
+        ("location" .= __field__location :
+           Prelude.maybe Prelude.id ((:) . ("comment" .=)) __field__comment
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolComment where
+  buildStruct _proxy
+    (SymbolComment __field__location __field__comment)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           case __field__comment of
+             Prelude.Just _val -> Thrift.genField _proxy "comment"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__comment <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__comment
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__comment <- ST.readSTRef __field__comment
+                                             Prelude.pure
+                                               (SymbolComment __val__location __val__comment)
+              _idMap = HashMap.fromList [("location", 1), ("comment", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolComment where
+  rnf (SymbolComment __field__location __field__comment)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__comment `Prelude.seq` ()
+
+instance Default.Default SymbolComment where
+  def = SymbolComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolComment where
+  hashWithSalt __salt (SymbolComment _location _comment)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _comment
+
+data RelationDescription = RelationDescription{relationDescription_firstParent
+                                               :: Prelude.Maybe SymbolId,
+                                               relationDescription_hasMoreParents :: Prelude.Bool,
+                                               relationDescription_firstChild ::
+                                               Prelude.Maybe SymbolId,
+                                               relationDescription_hasMoreChildren :: Prelude.Bool,
+                                               relationDescription_firstParentName ::
+                                               Prelude.Maybe QualifiedName,
+                                               relationDescription_firstChildName ::
+                                               Prelude.Maybe QualifiedName}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelationDescription where
+  toJSON
+    (RelationDescription __field__firstParent __field__hasMoreParents
+       __field__firstChild __field__hasMoreChildren
+       __field__firstParentName __field__firstChildName)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("firstParent" .=))
+           (Prelude.fmap unSymbolId __field__firstParent)
+           ("hasMoreParents" .= __field__hasMoreParents :
+              Prelude.maybe Prelude.id ((:) . ("firstChild" .=))
+                (Prelude.fmap unSymbolId __field__firstChild)
+                ("hasMoreChildren" .= __field__hasMoreChildren :
+                   Prelude.maybe Prelude.id ((:) . ("firstParentName" .=))
+                     __field__firstParentName
+                     (Prelude.maybe Prelude.id ((:) . ("firstChildName" .=))
+                        __field__firstChildName
+                        Prelude.mempty))))
+
+instance Thrift.ThriftStruct RelationDescription where
+  buildStruct _proxy
+    (RelationDescription __field__firstParent __field__hasMoreParents
+       __field__firstChild __field__hasMoreChildren
+       __field__firstParentName __field__firstChildName)
+    = Thrift.genStruct _proxy
+        (let (__cereal__firstParent, __id__firstParent)
+               = case __field__firstParent of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "firstParent"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              ((Thrift.genText _proxy . unSymbolId) _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__firstParent
+             (Thrift.genFieldBool _proxy "hasMoreParents" 2 __id__firstParent
+                __field__hasMoreParents
+                :
+                let (__cereal__firstChild, __id__firstChild)
+                      = case __field__firstChild of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "firstChild"
+                                                     (Thrift.getStringType _proxy)
+                                                     3
+                                                     2
+                                                     ((Thrift.genText _proxy . unSymbolId) _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, 2)
+                  in
+                  __cereal__firstChild
+                    (Thrift.genFieldBool _proxy "hasMoreChildren" 4 __id__firstChild
+                       __field__hasMoreChildren
+                       :
+                       let (__cereal__firstParentName, __id__firstParentName)
+                             = case __field__firstParentName of
+                                 Prelude.Just _val -> ((:)
+                                                         (Thrift.genField _proxy "firstParentName"
+                                                            (Thrift.getStructType _proxy)
+                                                            5
+                                                            4
+                                                            (Thrift.buildStruct _proxy _val)),
+                                                       5)
+                                 Prelude.Nothing -> (Prelude.id, 4)
+                         in
+                         __cereal__firstParentName
+                           (case __field__firstChildName of
+                              Prelude.Just _val -> Thrift.genField _proxy "firstChildName"
+                                                     (Thrift.getStructType _proxy)
+                                                     6
+                                                     __id__firstParentName
+                                                     (Thrift.buildStruct _proxy _val)
+                                                     : []
+                              Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__firstParent <- ST.newSTRef Prelude.Nothing
+            __field__hasMoreParents <- ST.newSTRef Prelude.False
+            __field__firstChild <- ST.newSTRef Prelude.Nothing
+            __field__hasMoreChildren <- ST.newSTRef Prelude.False
+            __field__firstParentName <- ST.newSTRef Prelude.Nothing
+            __field__firstChildName <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__firstParent
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasMoreParents
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__firstChild
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasMoreChildren
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__firstParentName
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__firstChildName
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__firstParent <- ST.readSTRef
+                                                                      __field__firstParent
+                                             !__val__hasMoreParents <- ST.readSTRef
+                                                                         __field__hasMoreParents
+                                             !__val__firstChild <- ST.readSTRef __field__firstChild
+                                             !__val__hasMoreChildren <- ST.readSTRef
+                                                                          __field__hasMoreChildren
+                                             !__val__firstParentName <- ST.readSTRef
+                                                                          __field__firstParentName
+                                             !__val__firstChildName <- ST.readSTRef
+                                                                         __field__firstChildName
+                                             Prelude.pure
+                                               (RelationDescription __val__firstParent
+                                                  __val__hasMoreParents
+                                                  __val__firstChild
+                                                  __val__hasMoreChildren
+                                                  __val__firstParentName
+                                                  __val__firstChildName)
+              _idMap
+                = HashMap.fromList
+                    [("firstParent", 1), ("hasMoreParents", 2), ("firstChild", 3),
+                     ("hasMoreChildren", 4), ("firstParentName", 5),
+                     ("firstChildName", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData RelationDescription where
+  rnf
+    (RelationDescription __field__firstParent __field__hasMoreParents
+       __field__firstChild __field__hasMoreChildren
+       __field__firstParentName __field__firstChildName)
+    = DeepSeq.rnf __field__firstParent `Prelude.seq`
+        DeepSeq.rnf __field__hasMoreParents `Prelude.seq`
+          DeepSeq.rnf __field__firstChild `Prelude.seq`
+            DeepSeq.rnf __field__hasMoreChildren `Prelude.seq`
+              DeepSeq.rnf __field__firstParentName `Prelude.seq`
+                DeepSeq.rnf __field__firstChildName `Prelude.seq` ()
+
+instance Default.Default RelationDescription where
+  def
+    = RelationDescription Prelude.Nothing Prelude.False Prelude.Nothing
+        Prelude.False
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable RelationDescription where
+  hashWithSalt __salt
+    (RelationDescription _firstParent _hasMoreParents _firstChild
+       _hasMoreChildren _firstParentName _firstChildName)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _firstParent)
+                    _hasMoreParents)
+                 _firstChild)
+              _hasMoreChildren)
+           _firstParentName)
+        _firstChildName
+
+data SearchContext = SearchContext{searchContext_repo_name ::
+                                   Prelude.Maybe RepoName,
+                                   searchContext_language :: Prelude.Maybe Language,
+                                   searchContext_kinds :: Set.Set SymbolKind}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchContext where
+  toJSON
+    (SearchContext __field__repo_name __field__language __field__kinds)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("repo_name" .=))
+           (Prelude.fmap unRepoName __field__repo_name)
+           (Prelude.maybe Prelude.id ((:) . ("language" .=)) __field__language
+              ("kinds" .= __field__kinds : Prelude.mempty)))
+
+instance Thrift.ThriftStruct SearchContext where
+  buildStruct _proxy
+    (SearchContext __field__repo_name __field__language __field__kinds)
+    = Thrift.genStruct _proxy
+        (let (__cereal__repo_name, __id__repo_name)
+               = case __field__repo_name of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "repo_name"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              ((Thrift.genText _proxy . unRepoName) _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__repo_name
+             (let (__cereal__language, __id__language)
+                    = case __field__language of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genField _proxy "language"
+                                                   (Thrift.getI32Type _proxy)
+                                                   2
+                                                   __id__repo_name
+                                                   ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                       Thrift.fromThriftEnum)
+                                                      _val)),
+                                              2)
+                        Prelude.Nothing -> (Prelude.id, __id__repo_name)
+                in
+                __cereal__language
+                  (Thrift.genField _proxy "kinds" (Thrift.getSetType _proxy) 4
+                     __id__language
+                     ((Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                         (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                            Thrift.fromThriftEnum)
+                         . Set.toList)
+                        __field__kinds)
+                     : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo_name <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repo_name
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "SymbolKind"))
+                                                                        ST.writeSTRef __field__kinds
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo_name <- ST.readSTRef
+                                                                    __field__repo_name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             Prelude.pure
+                                               (SearchContext __val__repo_name __val__language
+                                                  __val__kinds)
+              _idMap
+                = HashMap.fromList
+                    [("repo_name", 1), ("language", 2), ("kinds", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchContext where
+  rnf
+    (SearchContext __field__repo_name __field__language __field__kinds)
+    = DeepSeq.rnf __field__repo_name `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq` ()
+
+instance Default.Default SearchContext where
+  def = SearchContext Prelude.Nothing Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchContext where
+  hashWithSalt __salt (SearchContext _repo_name _language _kinds)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo_name)
+           _language)
+        (Set.elems _kinds)
+
+data SymbolKind = SymbolKind_Package
+                | SymbolKind_Type
+                | SymbolKind_Value
+                | SymbolKind_File
+                | SymbolKind_Module
+                | SymbolKind_Namespace
+                | SymbolKind_Class_
+                | SymbolKind_Method
+                | SymbolKind_Property
+                | SymbolKind_Field
+                | SymbolKind_Constructor
+                | SymbolKind_Enum
+                | SymbolKind_Interface
+                | SymbolKind_Function
+                | SymbolKind_Variable
+                | SymbolKind_Constant
+                | SymbolKind_String
+                | SymbolKind_Number
+                | SymbolKind_Boolean
+                | SymbolKind_Array
+                | SymbolKind_Object
+                | SymbolKind_Key
+                | SymbolKind_Null
+                | SymbolKind_Enumerator
+                | SymbolKind_Struct
+                | SymbolKind_Event
+                | SymbolKind_Operator
+                | SymbolKind_TypeParameter
+                | SymbolKind_Union
+                | SymbolKind_Macro
+                | SymbolKind_Trait
+                | SymbolKind_Fragment
+                | SymbolKind_Operation
+                | SymbolKind_Directive
+                | SymbolKind__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON SymbolKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData SymbolKind where
+  rnf __SymbolKind = Prelude.seq __SymbolKind ()
+
+instance Default.Default SymbolKind where
+  def = SymbolKind_Package
+
+instance Hashable.Hashable SymbolKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum SymbolKind where
+  toThriftEnum 1 = SymbolKind_Package
+  toThriftEnum 2 = SymbolKind_Type
+  toThriftEnum 3 = SymbolKind_Value
+  toThriftEnum 4 = SymbolKind_File
+  toThriftEnum 5 = SymbolKind_Module
+  toThriftEnum 6 = SymbolKind_Namespace
+  toThriftEnum 7 = SymbolKind_Class_
+  toThriftEnum 8 = SymbolKind_Method
+  toThriftEnum 9 = SymbolKind_Property
+  toThriftEnum 10 = SymbolKind_Field
+  toThriftEnum 11 = SymbolKind_Constructor
+  toThriftEnum 12 = SymbolKind_Enum
+  toThriftEnum 13 = SymbolKind_Interface
+  toThriftEnum 14 = SymbolKind_Function
+  toThriftEnum 15 = SymbolKind_Variable
+  toThriftEnum 16 = SymbolKind_Constant
+  toThriftEnum 17 = SymbolKind_String
+  toThriftEnum 18 = SymbolKind_Number
+  toThriftEnum 19 = SymbolKind_Boolean
+  toThriftEnum 20 = SymbolKind_Array
+  toThriftEnum 21 = SymbolKind_Object
+  toThriftEnum 22 = SymbolKind_Key
+  toThriftEnum 23 = SymbolKind_Null
+  toThriftEnum 24 = SymbolKind_Enumerator
+  toThriftEnum 25 = SymbolKind_Struct
+  toThriftEnum 26 = SymbolKind_Event
+  toThriftEnum 27 = SymbolKind_Operator
+  toThriftEnum 28 = SymbolKind_TypeParameter
+  toThriftEnum 29 = SymbolKind_Union
+  toThriftEnum 30 = SymbolKind_Macro
+  toThriftEnum 31 = SymbolKind_Trait
+  toThriftEnum 32 = SymbolKind_Fragment
+  toThriftEnum 33 = SymbolKind_Operation
+  toThriftEnum 34 = SymbolKind_Directive
+  toThriftEnum val = SymbolKind__UNKNOWN val
+  fromThriftEnum SymbolKind_Package = 1
+  fromThriftEnum SymbolKind_Type = 2
+  fromThriftEnum SymbolKind_Value = 3
+  fromThriftEnum SymbolKind_File = 4
+  fromThriftEnum SymbolKind_Module = 5
+  fromThriftEnum SymbolKind_Namespace = 6
+  fromThriftEnum SymbolKind_Class_ = 7
+  fromThriftEnum SymbolKind_Method = 8
+  fromThriftEnum SymbolKind_Property = 9
+  fromThriftEnum SymbolKind_Field = 10
+  fromThriftEnum SymbolKind_Constructor = 11
+  fromThriftEnum SymbolKind_Enum = 12
+  fromThriftEnum SymbolKind_Interface = 13
+  fromThriftEnum SymbolKind_Function = 14
+  fromThriftEnum SymbolKind_Variable = 15
+  fromThriftEnum SymbolKind_Constant = 16
+  fromThriftEnum SymbolKind_String = 17
+  fromThriftEnum SymbolKind_Number = 18
+  fromThriftEnum SymbolKind_Boolean = 19
+  fromThriftEnum SymbolKind_Array = 20
+  fromThriftEnum SymbolKind_Object = 21
+  fromThriftEnum SymbolKind_Key = 22
+  fromThriftEnum SymbolKind_Null = 23
+  fromThriftEnum SymbolKind_Enumerator = 24
+  fromThriftEnum SymbolKind_Struct = 25
+  fromThriftEnum SymbolKind_Event = 26
+  fromThriftEnum SymbolKind_Operator = 27
+  fromThriftEnum SymbolKind_TypeParameter = 28
+  fromThriftEnum SymbolKind_Union = 29
+  fromThriftEnum SymbolKind_Macro = 30
+  fromThriftEnum SymbolKind_Trait = 31
+  fromThriftEnum SymbolKind_Fragment = 32
+  fromThriftEnum SymbolKind_Operation = 33
+  fromThriftEnum SymbolKind_Directive = 34
+  fromThriftEnum (SymbolKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [SymbolKind_Package, SymbolKind_Type, SymbolKind_Value,
+       SymbolKind_File, SymbolKind_Module, SymbolKind_Namespace,
+       SymbolKind_Class_, SymbolKind_Method, SymbolKind_Property,
+       SymbolKind_Field, SymbolKind_Constructor, SymbolKind_Enum,
+       SymbolKind_Interface, SymbolKind_Function, SymbolKind_Variable,
+       SymbolKind_Constant, SymbolKind_String, SymbolKind_Number,
+       SymbolKind_Boolean, SymbolKind_Array, SymbolKind_Object,
+       SymbolKind_Key, SymbolKind_Null, SymbolKind_Enumerator,
+       SymbolKind_Struct, SymbolKind_Event, SymbolKind_Operator,
+       SymbolKind_TypeParameter, SymbolKind_Union, SymbolKind_Macro,
+       SymbolKind_Trait, SymbolKind_Fragment, SymbolKind_Operation,
+       SymbolKind_Directive]
+  toThriftEnumEither 1 = Prelude.Right SymbolKind_Package
+  toThriftEnumEither 2 = Prelude.Right SymbolKind_Type
+  toThriftEnumEither 3 = Prelude.Right SymbolKind_Value
+  toThriftEnumEither 4 = Prelude.Right SymbolKind_File
+  toThriftEnumEither 5 = Prelude.Right SymbolKind_Module
+  toThriftEnumEither 6 = Prelude.Right SymbolKind_Namespace
+  toThriftEnumEither 7 = Prelude.Right SymbolKind_Class_
+  toThriftEnumEither 8 = Prelude.Right SymbolKind_Method
+  toThriftEnumEither 9 = Prelude.Right SymbolKind_Property
+  toThriftEnumEither 10 = Prelude.Right SymbolKind_Field
+  toThriftEnumEither 11 = Prelude.Right SymbolKind_Constructor
+  toThriftEnumEither 12 = Prelude.Right SymbolKind_Enum
+  toThriftEnumEither 13 = Prelude.Right SymbolKind_Interface
+  toThriftEnumEither 14 = Prelude.Right SymbolKind_Function
+  toThriftEnumEither 15 = Prelude.Right SymbolKind_Variable
+  toThriftEnumEither 16 = Prelude.Right SymbolKind_Constant
+  toThriftEnumEither 17 = Prelude.Right SymbolKind_String
+  toThriftEnumEither 18 = Prelude.Right SymbolKind_Number
+  toThriftEnumEither 19 = Prelude.Right SymbolKind_Boolean
+  toThriftEnumEither 20 = Prelude.Right SymbolKind_Array
+  toThriftEnumEither 21 = Prelude.Right SymbolKind_Object
+  toThriftEnumEither 22 = Prelude.Right SymbolKind_Key
+  toThriftEnumEither 23 = Prelude.Right SymbolKind_Null
+  toThriftEnumEither 24 = Prelude.Right SymbolKind_Enumerator
+  toThriftEnumEither 25 = Prelude.Right SymbolKind_Struct
+  toThriftEnumEither 26 = Prelude.Right SymbolKind_Event
+  toThriftEnumEither 27 = Prelude.Right SymbolKind_Operator
+  toThriftEnumEither 28 = Prelude.Right SymbolKind_TypeParameter
+  toThriftEnumEither 29 = Prelude.Right SymbolKind_Union
+  toThriftEnumEither 30 = Prelude.Right SymbolKind_Macro
+  toThriftEnumEither 31 = Prelude.Right SymbolKind_Trait
+  toThriftEnumEither 32 = Prelude.Right SymbolKind_Fragment
+  toThriftEnumEither 33 = Prelude.Right SymbolKind_Operation
+  toThriftEnumEither 34 = Prelude.Right SymbolKind_Directive
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum SymbolKind: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord SymbolKind where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data Language = Language_Cpp
+              | Language_JavaScript
+              | Language_Hack
+              | Language_Haskell
+              | Language_Java
+              | Language_ObjectiveC
+              | Language_Python
+              | Language_PreProcessor
+              | Language_Thrift
+              | Language_Rust
+              | Language_Buck
+              | Language_Erlang
+              | Language_TypeScript
+              | Language_Go
+              | Language_Kotlin
+              | Language_CSharp
+              | Language_GraphQL
+              | Language_Dataswarm
+              | Language_Yaml
+              | Language_Swift
+              | Language_Angle
+              | Language__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Language where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Language where
+  rnf __Language = Prelude.seq __Language ()
+
+instance Default.Default Language where
+  def = Language_Cpp
+
+instance Hashable.Hashable Language where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Language where
+  toThriftEnum 1 = Language_Cpp
+  toThriftEnum 2 = Language_JavaScript
+  toThriftEnum 3 = Language_Hack
+  toThriftEnum 4 = Language_Haskell
+  toThriftEnum 5 = Language_Java
+  toThriftEnum 6 = Language_ObjectiveC
+  toThriftEnum 7 = Language_Python
+  toThriftEnum 8 = Language_PreProcessor
+  toThriftEnum 9 = Language_Thrift
+  toThriftEnum 10 = Language_Rust
+  toThriftEnum 11 = Language_Buck
+  toThriftEnum 12 = Language_Erlang
+  toThriftEnum 13 = Language_TypeScript
+  toThriftEnum 14 = Language_Go
+  toThriftEnum 15 = Language_Kotlin
+  toThriftEnum 16 = Language_CSharp
+  toThriftEnum 17 = Language_GraphQL
+  toThriftEnum 18 = Language_Dataswarm
+  toThriftEnum 19 = Language_Yaml
+  toThriftEnum 20 = Language_Swift
+  toThriftEnum 21 = Language_Angle
+  toThriftEnum val = Language__UNKNOWN val
+  fromThriftEnum Language_Cpp = 1
+  fromThriftEnum Language_JavaScript = 2
+  fromThriftEnum Language_Hack = 3
+  fromThriftEnum Language_Haskell = 4
+  fromThriftEnum Language_Java = 5
+  fromThriftEnum Language_ObjectiveC = 6
+  fromThriftEnum Language_Python = 7
+  fromThriftEnum Language_PreProcessor = 8
+  fromThriftEnum Language_Thrift = 9
+  fromThriftEnum Language_Rust = 10
+  fromThriftEnum Language_Buck = 11
+  fromThriftEnum Language_Erlang = 12
+  fromThriftEnum Language_TypeScript = 13
+  fromThriftEnum Language_Go = 14
+  fromThriftEnum Language_Kotlin = 15
+  fromThriftEnum Language_CSharp = 16
+  fromThriftEnum Language_GraphQL = 17
+  fromThriftEnum Language_Dataswarm = 18
+  fromThriftEnum Language_Yaml = 19
+  fromThriftEnum Language_Swift = 20
+  fromThriftEnum Language_Angle = 21
+  fromThriftEnum (Language__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Language_Cpp, Language_JavaScript, Language_Hack,
+       Language_Haskell, Language_Java, Language_ObjectiveC,
+       Language_Python, Language_PreProcessor, Language_Thrift,
+       Language_Rust, Language_Buck, Language_Erlang, Language_TypeScript,
+       Language_Go, Language_Kotlin, Language_CSharp, Language_GraphQL,
+       Language_Dataswarm, Language_Yaml, Language_Swift, Language_Angle]
+  toThriftEnumEither 1 = Prelude.Right Language_Cpp
+  toThriftEnumEither 2 = Prelude.Right Language_JavaScript
+  toThriftEnumEither 3 = Prelude.Right Language_Hack
+  toThriftEnumEither 4 = Prelude.Right Language_Haskell
+  toThriftEnumEither 5 = Prelude.Right Language_Java
+  toThriftEnumEither 6 = Prelude.Right Language_ObjectiveC
+  toThriftEnumEither 7 = Prelude.Right Language_Python
+  toThriftEnumEither 8 = Prelude.Right Language_PreProcessor
+  toThriftEnumEither 9 = Prelude.Right Language_Thrift
+  toThriftEnumEither 10 = Prelude.Right Language_Rust
+  toThriftEnumEither 11 = Prelude.Right Language_Buck
+  toThriftEnumEither 12 = Prelude.Right Language_Erlang
+  toThriftEnumEither 13 = Prelude.Right Language_TypeScript
+  toThriftEnumEither 14 = Prelude.Right Language_Go
+  toThriftEnumEither 15 = Prelude.Right Language_Kotlin
+  toThriftEnumEither 16 = Prelude.Right Language_CSharp
+  toThriftEnumEither 17 = Prelude.Right Language_GraphQL
+  toThriftEnumEither 18 = Prelude.Right Language_Dataswarm
+  toThriftEnumEither 19 = Prelude.Right Language_Yaml
+  toThriftEnumEither 20 = Prelude.Right Language_Swift
+  toThriftEnumEither 21 = Prelude.Right Language_Angle
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Language: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord Language where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data DefinitionKind = DefinitionKind_Definition
+                    | DefinitionKind_Declaration
+                    | DefinitionKind__UNKNOWN Prelude.Int
+                      deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON DefinitionKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData DefinitionKind where
+  rnf __DefinitionKind = Prelude.seq __DefinitionKind ()
+
+instance Default.Default DefinitionKind where
+  def = DefinitionKind_Definition
+
+instance Hashable.Hashable DefinitionKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum DefinitionKind where
+  toThriftEnum 1 = DefinitionKind_Definition
+  toThriftEnum 2 = DefinitionKind_Declaration
+  toThriftEnum val = DefinitionKind__UNKNOWN val
+  fromThriftEnum DefinitionKind_Definition = 1
+  fromThriftEnum DefinitionKind_Declaration = 2
+  fromThriftEnum (DefinitionKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [DefinitionKind_Definition, DefinitionKind_Declaration]
+  toThriftEnumEither 1 = Prelude.Right DefinitionKind_Definition
+  toThriftEnumEither 2 = Prelude.Right DefinitionKind_Declaration
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum DefinitionKind: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord DefinitionKind where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data SymbolSearchOptions = SymbolSearchOptions{symbolSearchOptions_detailedResults
+                                               :: Prelude.Bool,
+                                               symbolSearchOptions_exactMatch :: Prelude.Bool,
+                                               symbolSearchOptions_ignoreCase :: Prelude.Bool,
+                                               symbolSearchOptions_namespaceSearch :: Prelude.Bool,
+                                               symbolSearchOptions_sortResults :: Prelude.Bool,
+                                               symbolSearchOptions_feelingLucky :: Prelude.Bool}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolSearchOptions where
+  toJSON
+    (SymbolSearchOptions __field__detailedResults __field__exactMatch
+       __field__ignoreCase __field__namespaceSearch __field__sortResults
+       __field__feelingLucky)
+    = Aeson.object
+        ("detailedResults" .= __field__detailedResults :
+           "exactMatch" .= __field__exactMatch :
+             "ignoreCase" .= __field__ignoreCase :
+               "namespaceSearch" .= __field__namespaceSearch :
+                 "sortResults" .= __field__sortResults :
+                   "feelingLucky" .= __field__feelingLucky : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolSearchOptions where
+  buildStruct _proxy
+    (SymbolSearchOptions __field__detailedResults __field__exactMatch
+       __field__ignoreCase __field__namespaceSearch __field__sortResults
+       __field__feelingLucky)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "detailedResults" 1 0
+           __field__detailedResults
+           :
+           Thrift.genFieldBool _proxy "exactMatch" 2 1 __field__exactMatch :
+             Thrift.genFieldBool _proxy "ignoreCase" 3 2 __field__ignoreCase :
+               Thrift.genFieldBool _proxy "namespaceSearch" 4 3
+                 __field__namespaceSearch
+                 :
+                 Thrift.genFieldBool _proxy "sortResults" 5 4 __field__sortResults :
+                   Thrift.genFieldBool _proxy "feelingLucky" 6 5 __field__feelingLucky
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__detailedResults <- ST.newSTRef Prelude.False
+            __field__exactMatch <- ST.newSTRef Prelude.False
+            __field__ignoreCase <- ST.newSTRef Prelude.False
+            __field__namespaceSearch <- ST.newSTRef Prelude.False
+            __field__sortResults <- ST.newSTRef Prelude.False
+            __field__feelingLucky <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__detailedResults
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__exactMatch
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__ignoreCase
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__namespaceSearch
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__sortResults
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__feelingLucky
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__detailedResults <- ST.readSTRef
+                                                                          __field__detailedResults
+                                             !__val__exactMatch <- ST.readSTRef __field__exactMatch
+                                             !__val__ignoreCase <- ST.readSTRef __field__ignoreCase
+                                             !__val__namespaceSearch <- ST.readSTRef
+                                                                          __field__namespaceSearch
+                                             !__val__sortResults <- ST.readSTRef
+                                                                      __field__sortResults
+                                             !__val__feelingLucky <- ST.readSTRef
+                                                                       __field__feelingLucky
+                                             Prelude.pure
+                                               (SymbolSearchOptions __val__detailedResults
+                                                  __val__exactMatch
+                                                  __val__ignoreCase
+                                                  __val__namespaceSearch
+                                                  __val__sortResults
+                                                  __val__feelingLucky)
+              _idMap
+                = HashMap.fromList
+                    [("detailedResults", 1), ("exactMatch", 2), ("ignoreCase", 3),
+                     ("namespaceSearch", 4), ("sortResults", 5), ("feelingLucky", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolSearchOptions where
+  rnf
+    (SymbolSearchOptions __field__detailedResults __field__exactMatch
+       __field__ignoreCase __field__namespaceSearch __field__sortResults
+       __field__feelingLucky)
+    = DeepSeq.rnf __field__detailedResults `Prelude.seq`
+        DeepSeq.rnf __field__exactMatch `Prelude.seq`
+          DeepSeq.rnf __field__ignoreCase `Prelude.seq`
+            DeepSeq.rnf __field__namespaceSearch `Prelude.seq`
+              DeepSeq.rnf __field__sortResults `Prelude.seq`
+                DeepSeq.rnf __field__feelingLucky `Prelude.seq` ()
+
+instance Default.Default SymbolSearchOptions where
+  def
+    = SymbolSearchOptions Prelude.False Prelude.False Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable SymbolSearchOptions where
+  hashWithSalt __salt
+    (SymbolSearchOptions _detailedResults _exactMatch _ignoreCase
+       _namespaceSearch _sortResults _feelingLucky)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt __salt _detailedResults)
+                    _exactMatch)
+                 _ignoreCase)
+              _namespaceSearch)
+           _sortResults)
+        _feelingLucky
+
+data SymbolSearchRequest = SymbolSearchRequest{symbolSearchRequest_name
+                                               :: Text.Text,
+                                               symbolSearchRequest_repo_name ::
+                                               Prelude.Maybe RepoName,
+                                               symbolSearchRequest_language :: Set.Set Language,
+                                               symbolSearchRequest_kinds :: Set.Set SymbolKind,
+                                               symbolSearchRequest_options :: SymbolSearchOptions}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolSearchRequest where
+  toJSON
+    (SymbolSearchRequest __field__name __field__repo_name
+       __field__language __field__kinds __field__options)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("repo_name" .=))
+             (Prelude.fmap unRepoName __field__repo_name)
+             ("language" .= __field__language :
+                "kinds" .= __field__kinds :
+                  "options" .= __field__options : Prelude.mempty))
+
+instance Thrift.ThriftStruct SymbolSearchRequest where
+  buildStruct _proxy
+    (SymbolSearchRequest __field__name __field__repo_name
+       __field__language __field__kinds __field__options)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__repo_name, __id__repo_name)
+                 = case __field__repo_name of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "repo_name"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genText _proxy . unRepoName) _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__repo_name
+               (Thrift.genField _proxy "language" (Thrift.getSetType _proxy) 3
+                  __id__repo_name
+                  ((Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                      (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                         Thrift.fromThriftEnum)
+                      . Set.toList)
+                     __field__language)
+                  :
+                  Thrift.genField _proxy "kinds" (Thrift.getSetType _proxy) 4 3
+                    ((Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                        (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                           Thrift.fromThriftEnum)
+                        . Set.toList)
+                       __field__kinds)
+                    :
+                    Thrift.genField _proxy "options" (Thrift.getStructType _proxy) 5 4
+                      (Thrift.buildStruct _proxy __field__options)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__repo_name <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Default.def
+            __field__options <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repo_name
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Language"))
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "SymbolKind"))
+                                                                        ST.writeSTRef __field__kinds
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__repo_name <- ST.readSTRef __field__repo_name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__options <- ST.readSTRef __field__options
+                                             Prelude.pure
+                                               (SymbolSearchRequest __val__name __val__repo_name
+                                                  __val__language
+                                                  __val__kinds
+                                                  __val__options)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("repo_name", 2), ("language", 3), ("kinds", 4),
+                     ("options", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolSearchRequest where
+  rnf
+    (SymbolSearchRequest __field__name __field__repo_name
+       __field__language __field__kinds __field__options)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__repo_name `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__kinds `Prelude.seq`
+              DeepSeq.rnf __field__options `Prelude.seq` ()
+
+instance Default.Default SymbolSearchRequest where
+  def
+    = SymbolSearchRequest "" Prelude.Nothing Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable SymbolSearchRequest where
+  hashWithSalt __salt
+    (SymbolSearchRequest _name _repo_name _language _kinds _options)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _repo_name)
+              (Set.elems _language))
+           (Set.elems _kinds))
+        _options
+
+data SymbolResult = SymbolResult{symbolResult_symbol :: SymbolId,
+                                 symbolResult_location :: LocationRange,
+                                 symbolResult_language :: Language,
+                                 symbolResult_kind :: Prelude.Maybe SymbolKind,
+                                 symbolResult_name :: Text.Text,
+                                 symbolResult_score :: Map.Map Text.Text Prelude.Double,
+                                 symbolResult_qname :: QualifiedName,
+                                 symbolResult_context :: Prelude.Maybe SymbolContext}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolResult where
+  toJSON
+    (SymbolResult __field__symbol __field__location __field__language
+       __field__kind __field__name __field__score __field__qname
+       __field__context)
+    = Aeson.object
+        ("symbol" .= unSymbolId __field__symbol :
+           "location" .= __field__location :
+             "language" .= __field__language :
+               Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+                 ("name" .= __field__name :
+                    "score" .= __field__score :
+                      "qname" .= __field__qname :
+                        Prelude.maybe Prelude.id ((:) . ("context" .=)) __field__context
+                          Prelude.mempty))
+
+instance Thrift.ThriftStruct SymbolResult where
+  buildStruct _proxy
+    (SymbolResult __field__symbol __field__location __field__language
+       __field__kind __field__name __field__score __field__qname
+       __field__context)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__language)
+               :
+               let (__cereal__kind, __id__kind)
+                     = case __field__kind of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kind"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kind
+                   (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 5
+                      __id__kind
+                      (Thrift.genText _proxy __field__name)
+                      :
+                      Thrift.genField _proxy "score" (Thrift.getMapType _proxy) 6 5
+                        ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                            (Thrift.getDoubleType _proxy)
+                            Prelude.True
+                            (Thrift.genText _proxy)
+                            (Thrift.genDouble _proxy)
+                            . Map.toList)
+                           __field__score)
+                        :
+                        Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 7 6
+                          (Thrift.buildStruct _proxy __field__qname)
+                          :
+                          case __field__context of
+                            Prelude.Just _val -> Thrift.genField _proxy "context"
+                                                   (Thrift.getStructType _proxy)
+                                                   8
+                                                   7
+                                                   (Thrift.buildStruct _proxy _val)
+                                                   : []
+                            Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef (SymbolId "")
+            __field__location <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            __field__score <- ST.newSTRef Default.def
+            __field__qname <- ST.newSTRef Default.def
+            __field__context <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseDouble
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef __field__score
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__context
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__score <- ST.readSTRef __field__score
+                                             !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__context <- ST.readSTRef __field__context
+                                             Prelude.pure
+                                               (SymbolResult __val__symbol __val__location
+                                                  __val__language
+                                                  __val__kind
+                                                  __val__name
+                                                  __val__score
+                                                  __val__qname
+                                                  __val__context)
+              _idMap
+                = HashMap.fromList
+                    [("symbol", 1), ("location", 2), ("language", 3), ("kind", 4),
+                     ("name", 5), ("score", 6), ("qname", 7), ("context", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolResult where
+  rnf
+    (SymbolResult __field__symbol __field__location __field__language
+       __field__kind __field__name __field__score __field__qname
+       __field__context)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__kind `Prelude.seq`
+              DeepSeq.rnf __field__name `Prelude.seq`
+                DeepSeq.rnf __field__score `Prelude.seq`
+                  DeepSeq.rnf __field__qname `Prelude.seq`
+                    DeepSeq.rnf __field__context `Prelude.seq` ()
+
+instance Default.Default SymbolResult where
+  def
+    = SymbolResult (SymbolId "") Default.def Default.def
+        Prelude.Nothing
+        ""
+        Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable SymbolResult where
+  hashWithSalt __salt
+    (SymbolResult _symbol _location _language _kind _name _score _qname
+       _context)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+                          _location)
+                       _language)
+                    _kind)
+                 _name)
+              ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _score))
+           _qname)
+        _context
+
+data SymbolContext = SymbolContext{symbolContext_symbol ::
+                                   SymbolId,
+                                   symbolContext_qname :: QualifiedName,
+                                   symbolContext_kind :: Prelude.Maybe SymbolKind}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolContext where
+  toJSON (SymbolContext __field__symbol __field__qname __field__kind)
+    = Aeson.object
+        ("symbol" .= unSymbolId __field__symbol :
+           "qname" .= __field__qname :
+             Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolContext where
+  buildStruct _proxy
+    (SymbolContext __field__symbol __field__qname __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__qname)
+             :
+             case __field__kind of
+               Prelude.Just _val -> Thrift.genField _proxy "kind"
+                                      (Thrift.getI32Type _proxy)
+                                      3
+                                      2
+                                      ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                          Thrift.fromThriftEnum)
+                                         _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef (SymbolId "")
+            __field__qname <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (SymbolContext __val__symbol __val__qname
+                                                  __val__kind)
+              _idMap
+                = HashMap.fromList [("symbol", 1), ("qname", 2), ("kind", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolContext where
+  rnf (SymbolContext __field__symbol __field__qname __field__kind)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__qname `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default SymbolContext where
+  def = SymbolContext (SymbolId "") Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolContext where
+  hashWithSalt __salt (SymbolContext _symbol _qname _kind)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+           _qname)
+        _kind
+
+data SymbolSearchResult = SymbolSearchResult{symbolSearchResult_symbols
+                                             :: [SymbolResult],
+                                             symbolSearchResult_symbolDetails ::
+                                             [SymbolDescription]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolSearchResult where
+  toJSON (SymbolSearchResult __field__symbols __field__symbolDetails)
+    = Aeson.object
+        ("symbols" .= __field__symbols :
+           "symbolDetails" .= __field__symbolDetails : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolSearchResult where
+  buildStruct _proxy
+    (SymbolSearchResult __field__symbols __field__symbolDetails)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbols" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__symbols)
+           :
+           Thrift.genField _proxy "symbolDetails" (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__symbolDetails)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbols <- ST.newSTRef Default.def
+            __field__symbolDetails <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbols
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbolDetails
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbols <- ST.readSTRef
+                                                                  __field__symbols
+                                             !__val__symbolDetails <- ST.readSTRef
+                                                                        __field__symbolDetails
+                                             Prelude.pure
+                                               (SymbolSearchResult __val__symbols
+                                                  __val__symbolDetails)
+              _idMap = HashMap.fromList [("symbols", 1), ("symbolDetails", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolSearchResult where
+  rnf (SymbolSearchResult __field__symbols __field__symbolDetails)
+    = DeepSeq.rnf __field__symbols `Prelude.seq`
+        DeepSeq.rnf __field__symbolDetails `Prelude.seq` ()
+
+instance Default.Default SymbolSearchResult where
+  def = SymbolSearchResult Default.def Default.def
+
+instance Hashable.Hashable SymbolSearchResult where
+  hashWithSalt __salt (SymbolSearchResult _symbols _symbolDetails)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbols)
+        _symbolDetails
+
+data SearchByNameRequest = SearchByNameRequest{searchByNameRequest_context
+                                               :: SearchContext,
+                                               searchByNameRequest_name :: Text.Text,
+                                               searchByNameRequest_detailedResults :: Prelude.Bool,
+                                               searchByNameRequest_ignoreCase :: Prelude.Bool}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameRequest where
+  toJSON
+    (SearchByNameRequest __field__context __field__name
+       __field__detailedResults __field__ignoreCase)
+    = Aeson.object
+        ("context" .= __field__context :
+           "name" .= __field__name :
+             "detailedResults" .= __field__detailedResults :
+               "ignoreCase" .= __field__ignoreCase : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameRequest where
+  buildStruct _proxy
+    (SearchByNameRequest __field__context __field__name
+       __field__detailedResults __field__ignoreCase)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "context" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__context)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genFieldBool _proxy "detailedResults" 3 2
+               __field__detailedResults
+               :
+               Thrift.genFieldBool _proxy "ignoreCase" 4 3 __field__ignoreCase :
+                 [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__context <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__detailedResults <- ST.newSTRef Prelude.False
+            __field__ignoreCase <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__context
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__detailedResults
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__ignoreCase
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__context <- ST.readSTRef
+                                                                  __field__context
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__detailedResults <- ST.readSTRef
+                                                                          __field__detailedResults
+                                             !__val__ignoreCase <- ST.readSTRef __field__ignoreCase
+                                             Prelude.pure
+                                               (SearchByNameRequest __val__context __val__name
+                                                  __val__detailedResults
+                                                  __val__ignoreCase)
+              _idMap
+                = HashMap.fromList
+                    [("context", 1), ("name", 2), ("detailedResults", 3),
+                     ("ignoreCase", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameRequest where
+  rnf
+    (SearchByNameRequest __field__context __field__name
+       __field__detailedResults __field__ignoreCase)
+    = DeepSeq.rnf __field__context `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__detailedResults `Prelude.seq`
+            DeepSeq.rnf __field__ignoreCase `Prelude.seq` ()
+
+instance Default.Default SearchByNameRequest where
+  def
+    = SearchByNameRequest Default.def "" Prelude.False Prelude.False
+
+instance Hashable.Hashable SearchByNameRequest where
+  hashWithSalt __salt
+    (SearchByNameRequest _context _name _detailedResults _ignoreCase)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _context)
+              _name)
+           _detailedResults)
+        _ignoreCase
+
+data SearchByNameResult = SearchByNameResult{searchByNameResult_symbols
+                                             :: [SymbolId],
+                                             searchByNameResult_symbolDetails ::
+                                             [SymbolDescription]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameResult where
+  toJSON (SearchByNameResult __field__symbols __field__symbolDetails)
+    = Aeson.object
+        ("symbols" .= Prelude.map unSymbolId __field__symbols :
+           "symbolDetails" .= __field__symbolDetails : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameResult where
+  buildStruct _proxy
+    (SearchByNameResult __field__symbols __field__symbolDetails)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbols" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy . unSymbolId)
+              __field__symbols)
+           :
+           Thrift.genField _proxy "symbolDetails" (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__symbolDetails)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbols <- ST.newSTRef Default.def
+            __field__symbolDetails <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__symbols
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbolDetails
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbols <- ST.readSTRef
+                                                                  __field__symbols
+                                             !__val__symbolDetails <- ST.readSTRef
+                                                                        __field__symbolDetails
+                                             Prelude.pure
+                                               (SearchByNameResult __val__symbols
+                                                  __val__symbolDetails)
+              _idMap = HashMap.fromList [("symbols", 1), ("symbolDetails", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameResult where
+  rnf (SearchByNameResult __field__symbols __field__symbolDetails)
+    = DeepSeq.rnf __field__symbols `Prelude.seq`
+        DeepSeq.rnf __field__symbolDetails `Prelude.seq` ()
+
+instance Default.Default SearchByNameResult where
+  def = SearchByNameResult Default.def Default.def
+
+instance Hashable.Hashable SearchByNameResult where
+  hashWithSalt __salt (SearchByNameResult _symbols _symbolDetails)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbols)
+        _symbolDetails
+
+data RelationType = RelationType_Extends
+                  | RelationType_Contains
+                  | RelationType_Calls
+                  | RelationType_RequireImplements
+                  | RelationType_RequireExtends
+                  | RelationType_RequireClass
+                  | RelationType_Generates
+                  | RelationType__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON RelationType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RelationType where
+  rnf __RelationType = Prelude.seq __RelationType ()
+
+instance Default.Default RelationType where
+  def = RelationType_Extends
+
+instance Hashable.Hashable RelationType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RelationType where
+  toThriftEnum 1 = RelationType_Extends
+  toThriftEnum 2 = RelationType_Contains
+  toThriftEnum 3 = RelationType_Calls
+  toThriftEnum 4 = RelationType_RequireImplements
+  toThriftEnum 5 = RelationType_RequireExtends
+  toThriftEnum 6 = RelationType_RequireClass
+  toThriftEnum 7 = RelationType_Generates
+  toThriftEnum val = RelationType__UNKNOWN val
+  fromThriftEnum RelationType_Extends = 1
+  fromThriftEnum RelationType_Contains = 2
+  fromThriftEnum RelationType_Calls = 3
+  fromThriftEnum RelationType_RequireImplements = 4
+  fromThriftEnum RelationType_RequireExtends = 5
+  fromThriftEnum RelationType_RequireClass = 6
+  fromThriftEnum RelationType_Generates = 7
+  fromThriftEnum (RelationType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RelationType_Extends, RelationType_Contains, RelationType_Calls,
+       RelationType_RequireImplements, RelationType_RequireExtends,
+       RelationType_RequireClass, RelationType_Generates]
+  toThriftEnumEither 1 = Prelude.Right RelationType_Extends
+  toThriftEnumEither 2 = Prelude.Right RelationType_Contains
+  toThriftEnumEither 3 = Prelude.Right RelationType_Calls
+  toThriftEnumEither 4 = Prelude.Right RelationType_RequireImplements
+  toThriftEnumEither 5 = Prelude.Right RelationType_RequireExtends
+  toThriftEnumEither 6 = Prelude.Right RelationType_RequireClass
+  toThriftEnumEither 7 = Prelude.Right RelationType_Generates
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RelationType: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord RelationType where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data RelationDirection = RelationDirection_Parent
+                       | RelationDirection_Child
+                       | RelationDirection__UNKNOWN Prelude.Int
+                         deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON RelationDirection where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RelationDirection where
+  rnf __RelationDirection = Prelude.seq __RelationDirection ()
+
+instance Default.Default RelationDirection where
+  def = RelationDirection_Parent
+
+instance Hashable.Hashable RelationDirection where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RelationDirection where
+  toThriftEnum 1 = RelationDirection_Parent
+  toThriftEnum 2 = RelationDirection_Child
+  toThriftEnum val = RelationDirection__UNKNOWN val
+  fromThriftEnum RelationDirection_Parent = 1
+  fromThriftEnum RelationDirection_Child = 2
+  fromThriftEnum (RelationDirection__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RelationDirection_Parent, RelationDirection_Child]
+  toThriftEnumEither 1 = Prelude.Right RelationDirection_Parent
+  toThriftEnumEither 2 = Prelude.Right RelationDirection_Child
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RelationDirection: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord RelationDirection where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data SearchRelatedRequest = SearchRelatedRequest{searchRelatedRequest_relatedBy
+                                                 :: RelationType,
+                                                 searchRelatedRequest_relation :: RelationDirection,
+                                                 searchRelatedRequest_recursive :: Prelude.Bool,
+                                                 searchRelatedRequest_filter ::
+                                                 Prelude.Maybe (Set.Set SymbolKind),
+                                                 searchRelatedRequest_detailedResults ::
+                                                 Prelude.Bool}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchRelatedRequest where
+  toJSON
+    (SearchRelatedRequest __field__relatedBy __field__relation
+       __field__recursive __field__filter __field__detailedResults)
+    = Aeson.object
+        ("relatedBy" .= __field__relatedBy :
+           "relation" .= __field__relation :
+             "recursive" .= __field__recursive :
+               Prelude.maybe Prelude.id ((:) . ("filter" .=)) __field__filter
+                 ("detailedResults" .= __field__detailedResults : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchRelatedRequest where
+  buildStruct _proxy
+    (SearchRelatedRequest __field__relatedBy __field__relation
+       __field__recursive __field__filter __field__detailedResults)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "relatedBy" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__relatedBy)
+           :
+           Thrift.genField _proxy "relation" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__relation)
+             :
+             Thrift.genFieldBool _proxy "recursive" 3 2 __field__recursive :
+               let (__cereal__filter, __id__filter)
+                     = case __field__filter of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "filter"
+                                                    (Thrift.getSetType _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genList _proxy
+                                                        (Thrift.getI32Type _proxy)
+                                                        (Thrift.genI32 _proxy . Prelude.fromIntegral
+                                                           . Thrift.fromThriftEnum)
+                                                        . Set.toList)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__filter
+                   (Thrift.genFieldBool _proxy "detailedResults" 5 __id__filter
+                      __field__detailedResults
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__relatedBy <- ST.newSTRef Default.def
+            __field__relation <- ST.newSTRef Default.def
+            __field__recursive <- ST.newSTRef Prelude.False
+            __field__filter <- ST.newSTRef Prelude.Nothing
+            __field__detailedResults <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RelationType")
+                                                                        ST.writeSTRef
+                                                                          __field__relatedBy
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RelationDirection")
+                                                                        ST.writeSTRef
+                                                                          __field__relation
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__recursive
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getSetType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Set.fromList .
+                                                                                      Prelude.snd
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "SymbolKind"))
+                                                                        ST.writeSTRef
+                                                                          __field__filter
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__detailedResults
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__relatedBy <- ST.readSTRef
+                                                                    __field__relatedBy
+                                             !__val__relation <- ST.readSTRef __field__relation
+                                             !__val__recursive <- ST.readSTRef __field__recursive
+                                             !__val__filter <- ST.readSTRef __field__filter
+                                             !__val__detailedResults <- ST.readSTRef
+                                                                          __field__detailedResults
+                                             Prelude.pure
+                                               (SearchRelatedRequest __val__relatedBy
+                                                  __val__relation
+                                                  __val__recursive
+                                                  __val__filter
+                                                  __val__detailedResults)
+              _idMap
+                = HashMap.fromList
+                    [("relatedBy", 1), ("relation", 2), ("recursive", 3),
+                     ("filter", 4), ("detailedResults", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchRelatedRequest where
+  rnf
+    (SearchRelatedRequest __field__relatedBy __field__relation
+       __field__recursive __field__filter __field__detailedResults)
+    = DeepSeq.rnf __field__relatedBy `Prelude.seq`
+        DeepSeq.rnf __field__relation `Prelude.seq`
+          DeepSeq.rnf __field__recursive `Prelude.seq`
+            DeepSeq.rnf __field__filter `Prelude.seq`
+              DeepSeq.rnf __field__detailedResults `Prelude.seq` ()
+
+instance Default.Default SearchRelatedRequest where
+  def
+    = SearchRelatedRequest Default.def Default.def Prelude.False
+        Prelude.Nothing
+        Prelude.False
+
+instance Hashable.Hashable SearchRelatedRequest where
+  hashWithSalt __salt
+    (SearchRelatedRequest _relatedBy _relation _recursive _filter
+       _detailedResults)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _relatedBy)
+                 _relation)
+              _recursive)
+           (Prelude.fmap Set.elems _filter))
+        _detailedResults
+
+data RelatedNeighborhoodRequest = RelatedNeighborhoodRequest{relatedNeighborhoodRequest_children_limit
+                                                             :: Int.Int32,
+                                                             relatedNeighborhoodRequest_inherited_limit
+                                                             :: Int.Int32,
+                                                             relatedNeighborhoodRequest_parent_depth
+                                                             :: Int.Int32,
+                                                             relatedNeighborhoodRequest_hide_uninteresting
+                                                             :: Prelude.Bool}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelatedNeighborhoodRequest where
+  toJSON
+    (RelatedNeighborhoodRequest __field__children_limit
+       __field__inherited_limit __field__parent_depth
+       __field__hide_uninteresting)
+    = Aeson.object
+        ("children_limit" .= __field__children_limit :
+           "inherited_limit" .= __field__inherited_limit :
+             "parent_depth" .= __field__parent_depth :
+               "hide_uninteresting" .= __field__hide_uninteresting :
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct RelatedNeighborhoodRequest where
+  buildStruct _proxy
+    (RelatedNeighborhoodRequest __field__children_limit
+       __field__inherited_limit __field__parent_depth
+       __field__hide_uninteresting)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "children_limit"
+           (Thrift.getI32Type _proxy)
+           1
+           0
+           (Thrift.genI32Prim _proxy)
+           __field__children_limit
+           :
+           Thrift.genFieldPrim _proxy "inherited_limit"
+             (Thrift.getI32Type _proxy)
+             2
+             1
+             (Thrift.genI32Prim _proxy)
+             __field__inherited_limit
+             :
+             Thrift.genFieldPrim _proxy "parent_depth"
+               (Thrift.getI32Type _proxy)
+               3
+               2
+               (Thrift.genI32Prim _proxy)
+               __field__parent_depth
+               :
+               Thrift.genFieldBool _proxy "hide_uninteresting" 4 3
+                 __field__hide_uninteresting
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__children_limit <- ST.newSTRef 5000
+            __field__inherited_limit <- ST.newSTRef 500
+            __field__parent_depth <- ST.newSTRef 500
+            __field__hide_uninteresting <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__children_limit
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__inherited_limit
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent_depth
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hide_uninteresting
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__children_limit <- ST.readSTRef
+                                                                         __field__children_limit
+                                             !__val__inherited_limit <- ST.readSTRef
+                                                                          __field__inherited_limit
+                                             !__val__parent_depth <- ST.readSTRef
+                                                                       __field__parent_depth
+                                             !__val__hide_uninteresting <- ST.readSTRef
+                                                                             __field__hide_uninteresting
+                                             Prelude.pure
+                                               (RelatedNeighborhoodRequest __val__children_limit
+                                                  __val__inherited_limit
+                                                  __val__parent_depth
+                                                  __val__hide_uninteresting)
+              _idMap
+                = HashMap.fromList
+                    [("children_limit", 1), ("inherited_limit", 2),
+                     ("parent_depth", 3), ("hide_uninteresting", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData RelatedNeighborhoodRequest where
+  rnf
+    (RelatedNeighborhoodRequest __field__children_limit
+       __field__inherited_limit __field__parent_depth
+       __field__hide_uninteresting)
+    = DeepSeq.rnf __field__children_limit `Prelude.seq`
+        DeepSeq.rnf __field__inherited_limit `Prelude.seq`
+          DeepSeq.rnf __field__parent_depth `Prelude.seq`
+            DeepSeq.rnf __field__hide_uninteresting `Prelude.seq` ()
+
+instance Default.Default RelatedNeighborhoodRequest where
+  def = RelatedNeighborhoodRequest 5000 500 500 Prelude.False
+
+instance Hashable.Hashable RelatedNeighborhoodRequest where
+  hashWithSalt __salt
+    (RelatedNeighborhoodRequest _children_limit _inherited_limit
+       _parent_depth _hide_uninteresting)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _children_limit)
+              _inherited_limit)
+           _parent_depth)
+        _hide_uninteresting
+
+rELATED_SYMBOLS_MAX_LIMIT :: Int.Int32
+rELATED_SYMBOLS_MAX_LIMIT = 1000
+
+data RelatedSymbols = RelatedSymbols{relatedSymbols_parent ::
+                                     SymbolId,
+                                     relatedSymbols_child :: SymbolId,
+                                     relatedSymbols_ranges :: Prelude.Maybe [LocationRange]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelatedSymbols where
+  toJSON
+    (RelatedSymbols __field__parent __field__child __field__ranges)
+    = Aeson.object
+        ("parent" .= unSymbolId __field__parent :
+           "child" .= unSymbolId __field__child :
+             Prelude.maybe Prelude.id ((:) . ("ranges" .=)) __field__ranges
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct RelatedSymbols where
+  buildStruct _proxy
+    (RelatedSymbols __field__parent __field__child __field__ranges)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unSymbolId) __field__child)
+             :
+             case __field__ranges of
+               Prelude.Just _val -> Thrift.genField _proxy "ranges"
+                                      (Thrift.getListType _proxy)
+                                      3
+                                      2
+                                      (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                         (Thrift.buildStruct _proxy)
+                                         _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef (SymbolId "")
+            __field__child <- ST.newSTRef (SymbolId "")
+            __field__ranges <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__ranges
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             !__val__ranges <- ST.readSTRef __field__ranges
+                                             Prelude.pure
+                                               (RelatedSymbols __val__parent __val__child
+                                                  __val__ranges)
+              _idMap
+                = HashMap.fromList [("parent", 1), ("child", 2), ("ranges", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RelatedSymbols where
+  rnf (RelatedSymbols __field__parent __field__child __field__ranges)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq`
+          DeepSeq.rnf __field__ranges `Prelude.seq` ()
+
+instance Default.Default RelatedSymbols where
+  def = RelatedSymbols (SymbolId "") (SymbolId "") Prelude.Nothing
+
+instance Hashable.Hashable RelatedSymbols where
+  hashWithSalt __salt (RelatedSymbols _parent _child _ranges)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+           _child)
+        _ranges
+
+data SearchRelatedResult = SearchRelatedResult{searchRelatedResult_edges
+                                               :: [RelatedSymbols],
+                                               searchRelatedResult_symbolDetails ::
+                                               Map.Map Text.Text SymbolDescription}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchRelatedResult where
+  toJSON (SearchRelatedResult __field__edges __field__symbolDetails)
+    = Aeson.object
+        ("edges" .= __field__edges :
+           "symbolDetails" .= __field__symbolDetails : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchRelatedResult where
+  buildStruct _proxy
+    (SearchRelatedResult __field__edges __field__symbolDetails)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "edges" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__edges)
+           :
+           Thrift.genField _proxy "symbolDetails" (Thrift.getMapType _proxy) 2
+             1
+             ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                 (Thrift.getStructType _proxy)
+                 Prelude.True
+                 (Thrift.genText _proxy)
+                 (Thrift.buildStruct _proxy)
+                 . Map.toList)
+                __field__symbolDetails)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__edges <- ST.newSTRef Default.def
+            __field__symbolDetails <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__edges
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__symbolDetails
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__edges <- ST.readSTRef __field__edges
+                                             !__val__symbolDetails <- ST.readSTRef
+                                                                        __field__symbolDetails
+                                             Prelude.pure
+                                               (SearchRelatedResult __val__edges
+                                                  __val__symbolDetails)
+              _idMap = HashMap.fromList [("edges", 1), ("symbolDetails", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchRelatedResult where
+  rnf (SearchRelatedResult __field__edges __field__symbolDetails)
+    = DeepSeq.rnf __field__edges `Prelude.seq`
+        DeepSeq.rnf __field__symbolDetails `Prelude.seq` ()
+
+instance Default.Default SearchRelatedResult where
+  def = SearchRelatedResult Default.def Default.def
+
+instance Hashable.Hashable SearchRelatedResult where
+  hashWithSalt __salt (SearchRelatedResult _edges _symbolDetails)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _edges)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _symbolDetails)
+
+data InheritedSymbols = InheritedSymbols{inheritedSymbols_base ::
+                                         SymbolId,
+                                         inheritedSymbols_provides :: [SymbolId]}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InheritedSymbols where
+  toJSON (InheritedSymbols __field__base __field__provides)
+    = Aeson.object
+        ("base" .= unSymbolId __field__base :
+           "provides" .= Prelude.map unSymbolId __field__provides :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InheritedSymbols where
+  buildStruct _proxy
+    (InheritedSymbols __field__base __field__provides)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__base)
+           :
+           Thrift.genField _proxy "provides" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy . unSymbolId)
+                __field__provides)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef (SymbolId "")
+            __field__provides <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__provides
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__provides <- ST.readSTRef __field__provides
+                                             Prelude.pure
+                                               (InheritedSymbols __val__base __val__provides)
+              _idMap = HashMap.fromList [("base", 1), ("provides", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InheritedSymbols where
+  rnf (InheritedSymbols __field__base __field__provides)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__provides `Prelude.seq` ()
+
+instance Default.Default InheritedSymbols where
+  def = InheritedSymbols (SymbolId "") Default.def
+
+instance Hashable.Hashable InheritedSymbols where
+  hashWithSalt __salt (InheritedSymbols _base _provides)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _provides
+
+data RelatedNeighborhoodResult = RelatedNeighborhoodResult{relatedNeighborhoodResult_childrenContained
+                                                           :: [SymbolId],
+                                                           relatedNeighborhoodResult_childrenExtended
+                                                           :: [SymbolId],
+                                                           relatedNeighborhoodResult_parentsExtended
+                                                           :: [SymbolId],
+                                                           relatedNeighborhoodResult_containsParents
+                                                           :: [RelatedSymbols],
+                                                           relatedNeighborhoodResult_inheritedSymbols
+                                                           :: [InheritedSymbols],
+                                                           relatedNeighborhoodResult_symbolDetails
+                                                           :: Map.Map Text.Text SymbolDescription,
+                                                           relatedNeighborhoodResult_symbolBasicDetails
+                                                           ::
+                                                           Map.Map Text.Text SymbolBasicDescription,
+                                                           relatedNeighborhoodResult_requireImplements
+                                                           :: [SymbolId],
+                                                           relatedNeighborhoodResult_requireExtends
+                                                           :: [SymbolId],
+                                                           relatedNeighborhoodResult_requireClass ::
+                                                           [SymbolId]}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelatedNeighborhoodResult where
+  toJSON
+    (RelatedNeighborhoodResult __field__childrenContained
+       __field__childrenExtended __field__parentsExtended
+       __field__containsParents __field__inheritedSymbols
+       __field__symbolDetails __field__symbolBasicDetails
+       __field__requireImplements __field__requireExtends
+       __field__requireClass)
+    = Aeson.object
+        ("childrenContained" .=
+           Prelude.map unSymbolId __field__childrenContained
+           :
+           "childrenExtended" .=
+             Prelude.map unSymbolId __field__childrenExtended
+             :
+             "parentsExtended" .=
+               Prelude.map unSymbolId __field__parentsExtended
+               :
+               "containsParents" .= __field__containsParents :
+                 "inheritedSymbols" .= __field__inheritedSymbols :
+                   "symbolDetails" .= __field__symbolDetails :
+                     "symbolBasicDetails" .= __field__symbolBasicDetails :
+                       "requireImplements" .=
+                         Prelude.map unSymbolId __field__requireImplements
+                         :
+                         "requireExtends" .= Prelude.map unSymbolId __field__requireExtends
+                           :
+                           "requireClass" .= Prelude.map unSymbolId __field__requireClass :
+                             Prelude.mempty)
+
+instance Thrift.ThriftStruct RelatedNeighborhoodResult where
+  buildStruct _proxy
+    (RelatedNeighborhoodResult __field__childrenContained
+       __field__childrenExtended __field__parentsExtended
+       __field__containsParents __field__inheritedSymbols
+       __field__symbolDetails __field__symbolBasicDetails
+       __field__requireImplements __field__requireExtends
+       __field__requireClass)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "childrenContained"
+           (Thrift.getListType _proxy)
+           7
+           0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy . unSymbolId)
+              __field__childrenContained)
+           :
+           Thrift.genField _proxy "childrenExtended"
+             (Thrift.getListType _proxy)
+             8
+             7
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy . unSymbolId)
+                __field__childrenExtended)
+             :
+             Thrift.genField _proxy "parentsExtended"
+               (Thrift.getListType _proxy)
+               9
+               8
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy . unSymbolId)
+                  __field__parentsExtended)
+               :
+               Thrift.genField _proxy "containsParents"
+                 (Thrift.getListType _proxy)
+                 3
+                 9
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__containsParents)
+                 :
+                 Thrift.genField _proxy "inheritedSymbols"
+                   (Thrift.getListType _proxy)
+                   5
+                   3
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__inheritedSymbols)
+                   :
+                   Thrift.genField _proxy "symbolDetails" (Thrift.getMapType _proxy) 6
+                     5
+                     ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                         (Thrift.getStructType _proxy)
+                         Prelude.True
+                         (Thrift.genText _proxy)
+                         (Thrift.buildStruct _proxy)
+                         . Map.toList)
+                        __field__symbolDetails)
+                     :
+                     Thrift.genField _proxy "symbolBasicDetails"
+                       (Thrift.getMapType _proxy)
+                       10
+                       6
+                       ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                           (Thrift.getStructType _proxy)
+                           Prelude.True
+                           (Thrift.genText _proxy)
+                           (Thrift.buildStruct _proxy)
+                           . Map.toList)
+                          __field__symbolBasicDetails)
+                       :
+                       Thrift.genField _proxy "requireImplements"
+                         (Thrift.getListType _proxy)
+                         11
+                         10
+                         (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                            (Thrift.genText _proxy . unSymbolId)
+                            __field__requireImplements)
+                         :
+                         Thrift.genField _proxy "requireExtends" (Thrift.getListType _proxy)
+                           12
+                           11
+                           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                              (Thrift.genText _proxy . unSymbolId)
+                              __field__requireExtends)
+                           :
+                           Thrift.genField _proxy "requireClass" (Thrift.getListType _proxy)
+                             13
+                             12
+                             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                                (Thrift.genText _proxy . unSymbolId)
+                                __field__requireClass)
+                             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__childrenContained <- ST.newSTRef Default.def
+            __field__childrenExtended <- ST.newSTRef Default.def
+            __field__parentsExtended <- ST.newSTRef Default.def
+            __field__containsParents <- ST.newSTRef Default.def
+            __field__inheritedSymbols <- ST.newSTRef Default.def
+            __field__symbolDetails <- ST.newSTRef Default.def
+            __field__symbolBasicDetails <- ST.newSTRef Default.def
+            __field__requireImplements <- ST.newSTRef Default.def
+            __field__requireExtends <- ST.newSTRef Default.def
+            __field__requireClass <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__childrenContained
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__childrenExtended
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__parentsExtended
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__containsParents
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__inheritedSymbols
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__symbolDetails
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getMapType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Map.fromList
+                                                                                       <$>
+                                                                                       Thrift.parseMap
+                                                                                         _proxy
+                                                                                         (Thrift.parseText
+                                                                                            _proxy)
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy)
+                                                                                         Prelude.True)
+                                                                         ST.writeSTRef
+                                                                           __field__symbolBasicDetails
+                                                                           _val
+                                                                 11 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.fmap
+                                                                                            SymbolId
+                                                                                            (Thrift.parseText
+                                                                                               _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__requireImplements
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.fmap
+                                                                                            SymbolId
+                                                                                            (Thrift.parseText
+                                                                                               _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__requireExtends
+                                                                           _val
+                                                                 13 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.fmap
+                                                                                            SymbolId
+                                                                                            (Thrift.parseText
+                                                                                               _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__requireClass
+                                                                           _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__childrenContained <- ST.readSTRef
+                                                                            __field__childrenContained
+                                             !__val__childrenExtended <- ST.readSTRef
+                                                                           __field__childrenExtended
+                                             !__val__parentsExtended <- ST.readSTRef
+                                                                          __field__parentsExtended
+                                             !__val__containsParents <- ST.readSTRef
+                                                                          __field__containsParents
+                                             !__val__inheritedSymbols <- ST.readSTRef
+                                                                           __field__inheritedSymbols
+                                             !__val__symbolDetails <- ST.readSTRef
+                                                                        __field__symbolDetails
+                                             !__val__symbolBasicDetails <- ST.readSTRef
+                                                                             __field__symbolBasicDetails
+                                             !__val__requireImplements <- ST.readSTRef
+                                                                            __field__requireImplements
+                                             !__val__requireExtends <- ST.readSTRef
+                                                                         __field__requireExtends
+                                             !__val__requireClass <- ST.readSTRef
+                                                                       __field__requireClass
+                                             Prelude.pure
+                                               (RelatedNeighborhoodResult __val__childrenContained
+                                                  __val__childrenExtended
+                                                  __val__parentsExtended
+                                                  __val__containsParents
+                                                  __val__inheritedSymbols
+                                                  __val__symbolDetails
+                                                  __val__symbolBasicDetails
+                                                  __val__requireImplements
+                                                  __val__requireExtends
+                                                  __val__requireClass)
+              _idMap
+                = HashMap.fromList
+                    [("childrenContained", 7), ("childrenExtended", 8),
+                     ("parentsExtended", 9), ("containsParents", 3),
+                     ("inheritedSymbols", 5), ("symbolDetails", 6),
+                     ("symbolBasicDetails", 10), ("requireImplements", 11),
+                     ("requireExtends", 12), ("requireClass", 13)]
+            _parse 0)
+
+instance DeepSeq.NFData RelatedNeighborhoodResult where
+  rnf
+    (RelatedNeighborhoodResult __field__childrenContained
+       __field__childrenExtended __field__parentsExtended
+       __field__containsParents __field__inheritedSymbols
+       __field__symbolDetails __field__symbolBasicDetails
+       __field__requireImplements __field__requireExtends
+       __field__requireClass)
+    = DeepSeq.rnf __field__childrenContained `Prelude.seq`
+        DeepSeq.rnf __field__childrenExtended `Prelude.seq`
+          DeepSeq.rnf __field__parentsExtended `Prelude.seq`
+            DeepSeq.rnf __field__containsParents `Prelude.seq`
+              DeepSeq.rnf __field__inheritedSymbols `Prelude.seq`
+                DeepSeq.rnf __field__symbolDetails `Prelude.seq`
+                  DeepSeq.rnf __field__symbolBasicDetails `Prelude.seq`
+                    DeepSeq.rnf __field__requireImplements `Prelude.seq`
+                      DeepSeq.rnf __field__requireExtends `Prelude.seq`
+                        DeepSeq.rnf __field__requireClass `Prelude.seq` ()
+
+instance Default.Default RelatedNeighborhoodResult where
+  def
+    = RelatedNeighborhoodResult Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable RelatedNeighborhoodResult where
+  hashWithSalt __salt
+    (RelatedNeighborhoodResult _childrenContained _childrenExtended
+       _parentsExtended _containsParents _inheritedSymbols _symbolDetails
+       _symbolBasicDetails _requireImplements _requireExtends
+       _requireClass)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt __salt _childrenContained)
+                                _childrenExtended)
+                             _parentsExtended)
+                          _containsParents)
+                       _inheritedSymbols)
+                    ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                       _symbolDetails))
+                 ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                    _symbolBasicDetails))
+              _requireImplements)
+           _requireExtends)
+        _requireClass
+
+data FileIncludeLocationRequest = FileIncludeLocationRequest{fileIncludeLocationRequest_repository
+                                                             :: RepoName,
+                                                             fileIncludeLocationRequest_filepath ::
+                                                             Path,
+                                                             fileIncludeLocationRequest_depth ::
+                                                             Int.Int32}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileIncludeLocationRequest where
+  toJSON
+    (FileIncludeLocationRequest __field__repository __field__filepath
+       __field__depth)
+    = Aeson.object
+        ("repository" .= unRepoName __field__repository :
+           "filepath" .= unPath __field__filepath :
+             "depth" .= __field__depth : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileIncludeLocationRequest where
+  buildStruct _proxy
+    (FileIncludeLocationRequest __field__repository __field__filepath
+       __field__depth)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repository" (Thrift.getStringType _proxy)
+           1
+           0
+           ((Thrift.genText _proxy . unRepoName) __field__repository)
+           :
+           Thrift.genField _proxy "filepath" (Thrift.getStringType _proxy) 2 1
+             ((Thrift.genText _proxy . unPath) __field__filepath)
+             :
+             Thrift.genFieldPrim _proxy "depth" (Thrift.getI32Type _proxy) 3 2
+               (Thrift.genI32Prim _proxy)
+               __field__depth
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repository <- ST.newSTRef (RepoName "")
+            __field__filepath <- ST.newSTRef (Path "")
+            __field__depth <- ST.newSTRef 2
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repository
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__filepath
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__depth
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repository <- ST.readSTRef
+                                                                     __field__repository
+                                             !__val__filepath <- ST.readSTRef __field__filepath
+                                             !__val__depth <- ST.readSTRef __field__depth
+                                             Prelude.pure
+                                               (FileIncludeLocationRequest __val__repository
+                                                  __val__filepath
+                                                  __val__depth)
+              _idMap
+                = HashMap.fromList
+                    [("repository", 1), ("filepath", 2), ("depth", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileIncludeLocationRequest where
+  rnf
+    (FileIncludeLocationRequest __field__repository __field__filepath
+       __field__depth)
+    = DeepSeq.rnf __field__repository `Prelude.seq`
+        DeepSeq.rnf __field__filepath `Prelude.seq`
+          DeepSeq.rnf __field__depth `Prelude.seq` ()
+
+instance Default.Default FileIncludeLocationRequest where
+  def = FileIncludeLocationRequest (RepoName "") (Path "") 2
+
+instance Hashable.Hashable FileIncludeLocationRequest where
+  hashWithSalt __salt
+    (FileIncludeLocationRequest _repository _filepath _depth)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repository)
+           _filepath)
+        _depth
+
+data FileXRefTarget = FileXRefTarget{fileXRefTarget_target :: Path,
+                                     fileXRefTarget_range :: {-# NOUNPACK #-} !Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefTarget where
+  toJSON (FileXRefTarget __field__target __field__range)
+    = Aeson.object
+        ("target" .= unPath __field__target :
+           "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefTarget where
+  buildStruct _proxy (FileXRefTarget __field__target __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unPath) __field__target)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef (Path "")
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (FileXRefTarget __val__target __val__range)
+              _idMap = HashMap.fromList [("target", 1), ("range", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefTarget where
+  rnf (FileXRefTarget __field__target __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default FileXRefTarget where
+  def = FileXRefTarget (Path "") Default.def
+
+instance Hashable.Hashable FileXRefTarget where
+  hashWithSalt __salt (FileXRefTarget _target _range)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _range
+
+data FileIncludeXRef = FileIncludeXRef{fileIncludeXRef_source ::
+                                       Path,
+                                       fileIncludeXRef_includes :: [FileXRefTarget]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileIncludeXRef where
+  toJSON (FileIncludeXRef __field__source __field__includes)
+    = Aeson.object
+        ("source" .= unPath __field__source :
+           "includes" .= __field__includes : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileIncludeXRef where
+  buildStruct _proxy
+    (FileIncludeXRef __field__source __field__includes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unPath) __field__source)
+           :
+           Thrift.genField _proxy "includes" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__includes)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef (Path "")
+            __field__includes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Path
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__includes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__includes <- ST.readSTRef __field__includes
+                                             Prelude.pure
+                                               (FileIncludeXRef __val__source __val__includes)
+              _idMap = HashMap.fromList [("source", 1), ("includes", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileIncludeXRef where
+  rnf (FileIncludeXRef __field__source __field__includes)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__includes `Prelude.seq` ()
+
+instance Default.Default FileIncludeXRef where
+  def = FileIncludeXRef (Path "") Default.def
+
+instance Hashable.Hashable FileIncludeXRef where
+  hashWithSalt __salt (FileIncludeXRef _source _includes)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _includes
+
+newtype XRefFileList = XRefFileList{unXRefFileList ::
+                                    [FileIncludeXRef]}
+                       deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable XRefFileList where
+  hashWithSalt __salt (XRefFileList __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON XRefFileList where
+  toJSON (XRefFileList __val) = Aeson.toJSON __val
+
+data FileIncludeLocationResults = FileIncludeLocationResults{fileIncludeLocationResults_revision
+                                                             :: Revision,
+                                                             fileIncludeLocationResults_references
+                                                             :: XRefFileList}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileIncludeLocationResults where
+  toJSON
+    (FileIncludeLocationResults __field__revision __field__references)
+    = Aeson.object
+        ("revision" .= unRevision __field__revision :
+           "references" .= unXRefFileList __field__references :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileIncludeLocationResults where
+  buildStruct _proxy
+    (FileIncludeLocationResults __field__revision __field__references)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 2
+           0
+           ((Thrift.genText _proxy . unRevision) __field__revision)
+           :
+           Thrift.genField _proxy "references" (Thrift.getListType _proxy) 3 2
+             ((Thrift.genList _proxy (Thrift.getStructType _proxy)
+                 (Thrift.buildStruct _proxy)
+                 . unXRefFileList)
+                __field__references)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__revision <- ST.newSTRef (Revision "")
+            __field__references <- ST.newSTRef (XRefFileList Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      XRefFileList
+                                                                                      (Prelude.snd
+                                                                                         <$>
+                                                                                         Thrift.parseList
+                                                                                           _proxy
+                                                                                           (Thrift.parseStruct
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__references
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__revision <- ST.readSTRef
+                                                                   __field__revision
+                                             !__val__references <- ST.readSTRef __field__references
+                                             Prelude.pure
+                                               (FileIncludeLocationResults __val__revision
+                                                  __val__references)
+              _idMap = HashMap.fromList [("revision", 2), ("references", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileIncludeLocationResults where
+  rnf
+    (FileIncludeLocationResults __field__revision __field__references)
+    = DeepSeq.rnf __field__revision `Prelude.seq`
+        DeepSeq.rnf __field__references `Prelude.seq` ()
+
+instance Default.Default FileIncludeLocationResults where
+  def
+    = FileIncludeLocationResults (Revision "")
+        (XRefFileList Default.def)
+
+instance Hashable.Hashable FileIncludeLocationResults where
+  hashWithSalt __salt
+    (FileIncludeLocationResults _revision _references)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _revision)
+        _references
+
+newtype ResolveSymbolsRequest = ResolveSymbolsRequest{resolveSymbolsRequest_symbols
+                                                      :: [SymbolId]}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveSymbolsRequest where
+  toJSON (ResolveSymbolsRequest __field__symbols)
+    = Aeson.object
+        ("symbols" .= Prelude.map unSymbolId __field__symbols :
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveSymbolsRequest where
+  buildStruct _proxy (ResolveSymbolsRequest __field__symbols)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbols" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy . unSymbolId)
+              __field__symbols)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbols <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           SymbolId
+                                                                                           (Thrift.parseText
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__symbols
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbols <- ST.readSTRef
+                                                                  __field__symbols
+                                             Prelude.pure (ResolveSymbolsRequest __val__symbols)
+              _idMap = HashMap.fromList [("symbols", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveSymbolsRequest where
+  rnf (ResolveSymbolsRequest __field__symbols)
+    = DeepSeq.rnf __field__symbols `Prelude.seq` ()
+
+instance Default.Default ResolveSymbolsRequest where
+  def = ResolveSymbolsRequest Default.def
+
+instance Hashable.Hashable ResolveSymbolsRequest where
+  hashWithSalt __salt (ResolveSymbolsRequest _symbols)
+    = Hashable.hashWithSalt __salt _symbols
+
+data SymbolResolutionFailure = SymbolResolutionFailure{symbolResolutionFailure_symbol
+                                                       :: SymbolId,
+                                                       symbolResolutionFailure_reason ::
+                                                       GlassExceptionReason}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolResolutionFailure where
+  toJSON (SymbolResolutionFailure __field__symbol __field__reason)
+    = Aeson.object
+        ("symbol" .= unSymbolId __field__symbol :
+           "reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolResolutionFailure where
+  buildStruct _proxy
+    (SymbolResolutionFailure __field__symbol __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "reason" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__reason)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef (SymbolId "")
+            __field__reason <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             Prelude.pure
+                                               (SymbolResolutionFailure __val__symbol __val__reason)
+              _idMap = HashMap.fromList [("symbol", 1), ("reason", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolResolutionFailure where
+  rnf (SymbolResolutionFailure __field__symbol __field__reason)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default SymbolResolutionFailure where
+  def = SymbolResolutionFailure (SymbolId "") Default.def
+
+instance Hashable.Hashable SymbolResolutionFailure where
+  hashWithSalt __salt (SymbolResolutionFailure _symbol _reason)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _reason
+
+data ResolvedSymbol = ResolvedSymbol{resolvedSymbol_symbol ::
+                                     SymbolId,
+                                     resolvedSymbol_symbolResolutions :: [SymbolResolution],
+                                     resolvedSymbol_failure ::
+                                     Prelude.Maybe SymbolResolutionFailure}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolvedSymbol where
+  toJSON
+    (ResolvedSymbol __field__symbol __field__symbolResolutions
+       __field__failure)
+    = Aeson.object
+        ("symbol" .= unSymbolId __field__symbol :
+           "symbolResolutions" .= __field__symbolResolutions :
+             Prelude.maybe Prelude.id ((:) . ("failure" .=)) __field__failure
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolvedSymbol where
+  buildStruct _proxy
+    (ResolvedSymbol __field__symbol __field__symbolResolutions
+       __field__failure)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unSymbolId) __field__symbol)
+           :
+           Thrift.genField _proxy "symbolResolutions"
+             (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__symbolResolutions)
+             :
+             case __field__failure of
+               Prelude.Just _val -> Thrift.genField _proxy "failure"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef (SymbolId "")
+            __field__symbolResolutions <- ST.newSTRef Default.def
+            __field__failure <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__symbolResolutions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__failure
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__symbolResolutions <- ST.readSTRef
+                                                                            __field__symbolResolutions
+                                             !__val__failure <- ST.readSTRef __field__failure
+                                             Prelude.pure
+                                               (ResolvedSymbol __val__symbol
+                                                  __val__symbolResolutions
+                                                  __val__failure)
+              _idMap
+                = HashMap.fromList
+                    [("symbol", 1), ("symbolResolutions", 2), ("failure", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolvedSymbol where
+  rnf
+    (ResolvedSymbol __field__symbol __field__symbolResolutions
+       __field__failure)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__symbolResolutions `Prelude.seq`
+          DeepSeq.rnf __field__failure `Prelude.seq` ()
+
+instance Default.Default ResolvedSymbol where
+  def = ResolvedSymbol (SymbolId "") Default.def Prelude.Nothing
+
+instance Hashable.Hashable ResolvedSymbol where
+  hashWithSalt __salt
+    (ResolvedSymbol _symbol _symbolResolutions _failure)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+           _symbolResolutions)
+        _failure
+
+newtype ResolveSymbolsResult = ResolveSymbolsResult{resolveSymbolsResult_resolvedSymbols
+                                                    :: [ResolvedSymbol]}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveSymbolsResult where
+  toJSON (ResolveSymbolsResult __field__resolvedSymbols)
+    = Aeson.object
+        ("resolvedSymbols" .= __field__resolvedSymbols : Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveSymbolsResult where
+  buildStruct _proxy (ResolveSymbolsResult __field__resolvedSymbols)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "resolvedSymbols"
+           (Thrift.getListType _proxy)
+           1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__resolvedSymbols)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__resolvedSymbols <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__resolvedSymbols
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__resolvedSymbols <- ST.readSTRef
+                                                                          __field__resolvedSymbols
+                                             Prelude.pure
+                                               (ResolveSymbolsResult __val__resolvedSymbols)
+              _idMap = HashMap.fromList [("resolvedSymbols", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveSymbolsResult where
+  rnf (ResolveSymbolsResult __field__resolvedSymbols)
+    = DeepSeq.rnf __field__resolvedSymbols `Prelude.seq` ()
+
+instance Default.Default ResolveSymbolsResult where
+  def = ResolveSymbolsResult Default.def
+
+instance Hashable.Hashable ResolveSymbolsResult where
+  hashWithSalt __salt (ResolveSymbolsResult _resolvedSymbols)
+    = Hashable.hashWithSalt __salt _resolvedSymbols
+
+data USRToDefinitionRequest = USRToDefinitionRequest{uSRToDefinitionRequest_usr
+                                                     :: USR,
+                                                     uSRToDefinitionRequest_repo_name ::
+                                                     Prelude.Maybe RepoName}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON USRToDefinitionRequest where
+  toJSON (USRToDefinitionRequest __field__usr __field__repo_name)
+    = Aeson.object
+        ("usr" .= unUSR __field__usr :
+           Prelude.maybe Prelude.id ((:) . ("repo_name" .=))
+             (Prelude.fmap unRepoName __field__repo_name)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct USRToDefinitionRequest where
+  buildStruct _proxy
+    (USRToDefinitionRequest __field__usr __field__repo_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "usr" (Thrift.getStringType _proxy) 1 0
+           ((Thrift.genText _proxy . unUSR) __field__usr)
+           :
+           case __field__repo_name of
+             Prelude.Just _val -> Thrift.genField _proxy "repo_name"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    ((Thrift.genText _proxy . unRepoName) _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__usr <- ST.newSTRef (USR "")
+            __field__repo_name <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap USR
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__usr
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      RepoName
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repo_name
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__usr <- ST.readSTRef __field__usr
+                                             !__val__repo_name <- ST.readSTRef __field__repo_name
+                                             Prelude.pure
+                                               (USRToDefinitionRequest __val__usr __val__repo_name)
+              _idMap = HashMap.fromList [("usr", 1), ("repo_name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData USRToDefinitionRequest where
+  rnf (USRToDefinitionRequest __field__usr __field__repo_name)
+    = DeepSeq.rnf __field__usr `Prelude.seq`
+        DeepSeq.rnf __field__repo_name `Prelude.seq` ()
+
+instance Default.Default USRToDefinitionRequest where
+  def = USRToDefinitionRequest (USR "") Prelude.Nothing
+
+instance Hashable.Hashable USRToDefinitionRequest where
+  hashWithSalt __salt (USRToDefinitionRequest _usr _repo_name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _usr)
+        _repo_name
+
+data USRSymbolDefinition = USRSymbolDefinition{uSRSymbolDefinition_location
+                                               :: LocationRange,
+                                               uSRSymbolDefinition_sym :: SymbolId,
+                                               uSRSymbolDefinition_revision :: Revision}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON USRSymbolDefinition where
+  toJSON
+    (USRSymbolDefinition __field__location __field__sym
+       __field__revision)
+    = Aeson.object
+        ("location" .= __field__location :
+           "sym" .= unSymbolId __field__sym :
+             "revision" .= unRevision __field__revision : Prelude.mempty)
+
+instance Thrift.ThriftStruct USRSymbolDefinition where
+  buildStruct _proxy
+    (USRSymbolDefinition __field__location __field__sym
+       __field__revision)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 3 2
+             ((Thrift.genText _proxy . unSymbolId) __field__sym)
+             :
+             Thrift.genField _proxy "revision" (Thrift.getStringType _proxy) 5 3
+               ((Thrift.genText _proxy . unRevision) __field__revision)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__sym <- ST.newSTRef (SymbolId "")
+            __field__revision <- ST.newSTRef (Revision "")
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SymbolId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Revision
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__revision
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__sym <- ST.readSTRef __field__sym
+                                             !__val__revision <- ST.readSTRef __field__revision
+                                             Prelude.pure
+                                               (USRSymbolDefinition __val__location __val__sym
+                                                  __val__revision)
+              _idMap
+                = HashMap.fromList [("location", 2), ("sym", 3), ("revision", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData USRSymbolDefinition where
+  rnf
+    (USRSymbolDefinition __field__location __field__sym
+       __field__revision)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__sym `Prelude.seq`
+          DeepSeq.rnf __field__revision `Prelude.seq` ()
+
+instance Default.Default USRSymbolDefinition where
+  def = USRSymbolDefinition Default.def (SymbolId "") (Revision "")
+
+instance Hashable.Hashable USRSymbolDefinition where
+  hashWithSalt __salt (USRSymbolDefinition _location _sym _revision)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+           _sym)
+        _revision
+
+newtype USRSymbolReference = USRSymbolReference{uSRSymbolReference_location
+                                                :: LocationRange}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON USRSymbolReference where
+  toJSON (USRSymbolReference __field__location)
+    = Aeson.object ("location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct USRSymbolReference where
+  buildStruct _proxy (USRSymbolReference __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             Prelude.pure (USRSymbolReference __val__location)
+              _idMap = HashMap.fromList [("location", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData USRSymbolReference where
+  rnf (USRSymbolReference __field__location)
+    = DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default USRSymbolReference where
+  def = USRSymbolReference Default.def
+
+instance Hashable.Hashable USRSymbolReference where
+  hashWithSalt __salt (USRSymbolReference _location)
+    = Hashable.hashWithSalt __salt _location
+
+newtype NativeSymbol = NativeSymbol{nativeSymbol_sym :: Text.Text}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NativeSymbol where
+  toJSON (NativeSymbol __field__sym)
+    = Aeson.object ("sym" .= __field__sym : Prelude.mempty)
+
+instance Thrift.ThriftStruct NativeSymbol where
+  buildStruct _proxy (NativeSymbol __field__sym)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sym" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__sym)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sym <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sym
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sym <- ST.readSTRef __field__sym
+                                             Prelude.pure (NativeSymbol __val__sym)
+              _idMap = HashMap.fromList [("sym", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData NativeSymbol where
+  rnf (NativeSymbol __field__sym)
+    = DeepSeq.rnf __field__sym `Prelude.seq` ()
+
+instance Default.Default NativeSymbol where
+  def = NativeSymbol ""
+
+instance Hashable.Hashable NativeSymbol where
+  hashWithSalt __salt (NativeSymbol _sym)
+    = Hashable.hashWithSalt __salt _sym
+
+data FileDigest = FileDigest{fileDigest_hash :: Text.Text,
+                             fileDigest_size :: Int.Int64}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDigest where
+  toJSON (FileDigest __field__hash __field__size)
+    = Aeson.object
+        ("hash" .= __field__hash :
+           "size" .= __field__size : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDigest where
+  buildStruct _proxy (FileDigest __field__hash __field__size)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__hash)
+           :
+           Thrift.genFieldPrim _proxy "size" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64Prim _proxy)
+             __field__size
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hash <- ST.newSTRef ""
+            __field__size <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__size
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__size <- ST.readSTRef __field__size
+                                             Prelude.pure (FileDigest __val__hash __val__size)
+              _idMap = HashMap.fromList [("hash", 1), ("size", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDigest where
+  rnf (FileDigest __field__hash __field__size)
+    = DeepSeq.rnf __field__hash `Prelude.seq`
+        DeepSeq.rnf __field__size `Prelude.seq` ()
+
+instance Default.Default FileDigest where
+  def = FileDigest "" Default.def
+
+instance Hashable.Hashable FileDigest where
+  hashWithSalt __salt (FileDigest _hash _size)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hash) _size
diff --git a/glean/glass/server/Server.hs b/glean/glass/server/Server.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/server/Server.hs
@@ -0,0 +1,14 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Server ( main ) where
+
+import qualified Glean.Glass.Main ( mainWith )
+
+main :: IO ()
+main = Glean.Glass.Main.mainWith (pure id)
diff --git a/glean/glass/test/Glean/Glass/Test/Range.hs b/glean/glass/test/Glean/Glass/Test/Range.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/test/Glean/Glass/Test/Range.hs
@@ -0,0 +1,109 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+--
+-- Check some things about line/col range conversoins
+--
+module Glean.Glass.Test.Range (main) where
+
+import Test.HUnit ( Test(..), (@=?) )
+
+import Data.Word ( Word64 )
+import Data.Int ( Int64 )
+import Data.ByteString ( ByteString )
+
+import TestRunner ( testRunner )
+import Glean.Init ( withUnitTest )
+
+import Glean.Glass.Range
+import Glean (toNat)
+
+import qualified Glean.Glass.Types as Glass
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Util.Range as Range
+import qualified Glean.Schema.CodemarkupTypes.Types as Code
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList $
+  [ TestList
+      [ TestLabel name $
+         testByteSpanToExcRange bs glass_range offs
+      ]
+  | (name,bs,glass_range,offs) <- empty : examples
+  ] ++
+  [ TestList
+      [ TestLabel ("inc-exl-range" <> name) $
+         testIncRangeToExcRange src_range glass_range
+      ]
+  | (name,bs,glass_range,offs) <- examples
+  , let src_range = Range.byteRangeToRange dummyfile offs
+          (Range.byteSpanToRange bs)
+  ]
+
+-- covnersion from glean-internal bytespan to glass range
+testByteSpanToExcRange
+  :: Src.ByteSpan -> Glass.Range -> Range.LineOffsets -> Test
+testByteSpanToExcRange bs expected offs = TestCase $ expected @=? actual
+  where
+    actual = rangeSpanToRange (Just offs) (Code.RangeSpan_span bs)
+
+-- covnersion from glean-internal inclusive-end range to glass range
+testIncRangeToExcRange
+  :: Src.Range -> Glass.Range -> Test
+testIncRangeToExcRange src_range expected = TestCase $ expected @=? actual
+  where
+    actual = rangeSpanToRange Nothing (Code.RangeSpan_range src_range)
+
+dummyfile :: Src.File
+dummyfile = Src.File 0 Nothing
+
+empty :: (String, Src.ByteSpan, Glass.Range, Range.LineOffsets)
+empty =
+  ("empty"
+    , bytespan 0 0
+    , range 1 1 1 1
+    , filemap "ab     \n"
+  )
+
+examples :: [(String, Src.ByteSpan, Glass.Range, Range.LineOffsets)]
+examples =
+  [ ("origin"
+    , bytespan 0 2
+    , range 1 1 1 3
+    , filemap "ab     \n"
+  )
+  , ("origin-offset"
+    , bytespan 1 2
+    , range 1 2 1 4
+    , filemap "ab     \n"
+  )
+  , ("origin-unit"
+    , bytespan 0 1
+    , range 1 1 1 2
+    , filemap "ab     \n"
+  )
+  , ("origin-multiline"
+    , bytespan 0 4
+    , range 1 1 2 2
+    , filemap "12\n34\n56\n78\n"
+  )
+  , ("flow-off-by-one T92482625"
+    , bytespan 174 31
+    , range 12 8 12 39
+    , filemap "/**\n * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.\n *\n * @flow strict-local\n * @format\n * @oncall codehub\n */\n\n'use strict';\n\nimport type {\n  CodeHubSearchAtoms"
+    )
+  ]
+
+filemap :: ByteString -> Range.LineOffsets
+filemap = Range.getLineOffsets
+
+bytespan :: Word64 -> Word64 -> Src.ByteSpan
+bytespan a b = Src.ByteSpan (toNat a) (toNat b)
+
+range :: Int64 -> Int64 -> Int64 -> Int64 -> Glass.Range
+range = Glass.Range
diff --git a/glean/glass/tools/Glean/Glass/Test/DemoClient.hs b/glean/glass/tools/Glean/Glass/Test/DemoClient.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/tools/Glean/Glass/Test/DemoClient.hs
@@ -0,0 +1,248 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Glass.Test.DemoClient ( main ) where
+
+import Glean.Init as Glean ( withOptions )
+
+import Glean.Glass.Types
+import Glean.Glass.GlassService.Client
+
+import Data.Default ( Default(def) )
+import Data.Maybe ( catMaybes )
+import Data.Text (Text)
+import Options.Applicative
+import Options.Applicative.Types ( readerAsk )
+import System.FilePath ( pathSeparator )
+import Util.Text ( textShow, textToInt )
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+
+import Glean.Impl.ThriftService
+import Glean.Util.ThriftService
+import Glean.Util.Service
+import Thrift.Protocol
+import Thrift.Monad hiding (runThrift)
+import Thrift.Channel
+
+import Util.EventBase ( withEventBaseDataplane )
+
+data Options =
+  Options {
+    optCommand :: Command,
+    optHost :: Service
+  }
+
+defService :: Service
+defService = HostPort "127.0.0.1" 26073
+
+data Command
+  = List RepoName Path
+  | Describe SymbolId
+  | FindRefs SymbolId
+  | FindLocation SymbolId
+  | Search RepoName Text Bool{- case-insensitve? -}
+
+options :: ParserInfo Options
+options = info (helper <*> parser) (fullDesc <>
+    progDesc "Glass code navigation and search tool")
+  where
+    parser :: Parser Options
+    parser = do
+      optHost <- option readService
+        (value defService
+        <> long "service"
+        <> metavar "HOST:PORT"
+        )
+      optCommand <- hsubparser $
+        command "list" (info listCommand
+          (progDesc $ unlines
+            ["List symbols in file specified by REPO/PATH"
+            ]
+          )
+        ) <>
+        command "describe" (info describeCommand
+          (progDesc $ unlines
+            ["Describe basic details of a symbol"
+            ]
+          )
+        ) <>
+        command "references" (info findRefsCommand
+          (progDesc $ unlines
+            ["Find references to this symbol"
+            ]
+          )
+        ) <>
+        command "location" (info locationCommand
+          (progDesc $ unlines
+            ["Find the definition location of a symbol"
+            ]
+          )
+        ) <>
+        command "search" (info searchCommand
+          (progDesc $ unlines
+            ["Find entities matching string"
+            ]
+          )
+        )
+      return $ Options {..}
+
+    cmd parser help = argument parser help
+
+    symbolHelp = metavar "SYMBOL"
+    searchHelp = metavar "REPO/STR"
+
+    listCommand = cmd readListRepoPath (metavar "REPO/PATH")
+    describeCommand = cmd (Describe <$> readSymbol) symbolHelp
+    findRefsCommand = cmd (FindRefs <$> readSymbol) symbolHelp
+    locationCommand = cmd (FindLocation <$> readSymbol) symbolHelp
+    searchCommand = do
+      ~(repo,needle) <- argument readSearch searchHelp
+      ignoreCase <- switch
+        (  long "case-insensitive"
+        <> short 'i'
+        )
+      return $ Search repo needle ignoreCase
+
+readService :: ReadM Service
+readService = do
+  hostPort <- Text.pack <$> readerAsk
+  case Text.breakOn ":" hostPort of
+    (_, "") -> fail "Not a valid host:port"
+    (host, portStr) -> case textToInt (Text.drop 1 portStr) of
+      Left _ -> fail ("Not a valid port: " <> show portStr)
+      Right port -> return (HostPort host (fromIntegral port))
+
+readSearch :: ReadM (RepoName, Text)
+readSearch = do
+  repoStr <- Text.pack <$> readerAsk
+  case Text.breakOn "/" repoStr of
+    (_, "") -> fail "Not a valid repo/string"
+    (repo, str) -> return (RepoName repo, Text.tail str)
+
+readListRepoPath :: ReadM Command
+readListRepoPath = do
+  path <- Text.pack <$> readerAsk
+  case Text.breakOn sep path of
+    (_, "") -> fail "Not a valid repo/path"
+    (repo, file) -> return $ case Text.stripPrefix sep file of
+        Nothing -> List (RepoName repo) (Path file)
+        Just file' -> List (RepoName repo) (Path file')
+    where
+      sep = Text.singleton pathSeparator
+
+readSymbol :: ReadM SymbolId
+readSymbol = do
+  sym <- Text.pack <$> readerAsk
+  if length (Text.splitOn "/" sym) < 3
+    then err
+    else return (SymbolId sym)
+  where
+    err = fail "Not a valid symbol. Symbols have the form: repo/lang/path-ish"
+
+defDocumentSymbolsReq :: DocumentSymbolsRequest
+defDocumentSymbolsReq = def {
+  documentSymbolsRequest_repository = RepoName "react",
+  documentSymbolsRequest_filepath = Path "packages/react/src/ReactHooks.js",
+  documentSymbolsRequest_include_refs = False -- just definitions
+}
+
+defCfg :: ThriftServiceOptions
+defCfg = def { processingTimeout = Just 15000 }
+
+type GlassM p a = forall c . ClientChannel c => ThriftM p c GlassService a
+
+svc :: Service -> ThriftService GlassService
+svc s =  mkThriftService s defCfg
+
+main :: IO ()
+main = Glean.withOptions options $ \Options{..} ->
+  withEventBaseDataplane $ \evp -> do
+    res <- runThrift evp (svc optHost) $
+      case optCommand of
+        List repo path -> runListSymbols repo path
+        Describe sym -> runDescribe sym
+        FindRefs sym -> runFindRefs sym
+        FindLocation sym -> runLocation sym
+        Search repo str ignoreCase -> runSearch repo str ignoreCase
+    mapM_ Text.putStrLn res
+
+runListSymbols :: Protocol p => RepoName -> Path -> GlassM p [Text]
+runListSymbols repo path = do
+  DocumentSymbolListXResult{..} <- documentSymbolListX query def
+  return $ pprDefs documentSymbolListXResult_definitions
+  where
+    query = defDocumentSymbolsReq {
+            documentSymbolsRequest_repository = repo
+          , documentSymbolsRequest_filepath = path
+    }
+
+runDescribe :: Protocol p => SymbolId -> GlassM p [Text]
+runDescribe sym = do
+  SymbolDescription{..} <- describeSymbol sym def
+  let loc = pprLocationRange $ locationRange symbolDescription_location
+      name = pprQName symbolDescription_name
+      kind = textShow <$> symbolDescription_kind
+      annot = textShow <$> symbolDescription_annotations
+  return $ [loc,name] <> catMaybes [kind,annot]
+
+runSearch :: Protocol p => RepoName -> Text -> Bool -> GlassM p [Text]
+runSearch repoName strName ignoreCase = do
+  SymbolSearchResult syms _ <- searchSymbol req def
+  return (map textShow syms)
+  where
+    req = SymbolSearchRequest
+        strName
+        (Just repoName)
+        def -- language
+        def -- kinds
+        def { -- search options
+          symbolSearchOptions_ignoreCase = ignoreCase
+        }
+
+runLocation :: Protocol p => SymbolId -> GlassM p [Text]
+runLocation sym = do
+  range <- symbolLocation sym def
+  return [pprLocationRange (symbolLocation_location range)]
+
+runFindRefs :: Protocol p => SymbolId -> GlassM p [Text]
+runFindRefs sym = do
+  ranges <- findReferenceRanges sym def
+  return $
+    ("Found " <> textShow (length ranges) <> " references") :
+    map pprLocationRange ranges
+
+-- List unique definition symbols
+pprDefs :: [DefinitionSymbolX] -> [Text]
+pprDefs = map (unSymbolId . definitionSymbolX_sym)
+
+pprLocationRange :: LocationRange -> Text
+pprLocationRange LocationRange{..} =
+   Text.concat [repo, "@", path,":", pprRange range]
+  where
+    RepoName repo = locationRange_repository
+    Path path = locationRange_filepath
+    range = locationRange_range
+
+pprRange :: Range -> Text
+pprRange (Range lineBegin colBegin lineEnd colEnd) = Text.concat [
+    textShow lineBegin, ":", textShow colBegin, "-",
+    textShow lineEnd, ":", textShow colEnd
+  ]
+
+pprQName :: QualifiedName -> Text
+pprQName QualifiedName{..} =
+  unName qualifiedName_container <> ":" <> unName qualifiedName_localName
+
+locationRange :: SymbolPath -> LocationRange
+locationRange SymbolPath{..} = LocationRange {
+    locationRange_repository = symbolPath_repository,
+    locationRange_filepath = symbolPath_filepath,
+    locationRange_range = symbolPath_range
+  }
diff --git a/glean/glass/tools/Glean/Glass/Test/Symbol.hs b/glean/glass/tools/Glean/Glass/Test/Symbol.hs
new file mode 100644
--- /dev/null
+++ b/glean/glass/tools/Glean/Glass/Test/Symbol.hs
@@ -0,0 +1,203 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Glass.Test.Symbol
+  ( main
+  ) where
+
+import Data.Default ( Default(def) )
+import Data.Int (Int64 ,Int32)
+import Control.Exception ( handle )
+import Control.Monad ( forM_ ,(<=<) )
+import Data.Text ( Text )
+import Text.Printf ( printf )
+import Data.Tuple.Extra (fst3,thd3)
+import Options.Applicative
+
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+
+import Glean.Init ( withOptions )
+import Util.OptParse ( maybeTextOption, maybeIntOption )
+import Util.Timing ( showTime, timeIt )
+import Util.Text ( textShow )
+import Util.IO ( readFileUTF8Text )
+
+import Glean.Glass.Types
+import qualified Glean.Glass.Env as Glass
+import qualified Glean.Glass.Handler.Symbols as Handle
+import qualified Glean.Glass.Main as Glass
+import qualified Glean.Glass.Options as Glass
+import Glean.Glass.Tracing (GlassTrace)
+
+data Config = Config
+  { cfgGlass :: Glass.Config GlassTrace
+  , cfgSymbol :: Maybe SymbolId
+  , cfgFile :: Maybe Text
+  , cfgCmd :: Cmd
+  , cfgLimit :: Maybe Int32
+  }
+
+data Cmd
+  = FindLocation
+  | FindReferences
+  | Describe
+
+options :: ParserInfo Config
+options = info (helper <*> parser) fullDesc
+  where
+    parser :: Parser Config
+    parser = do
+      cfgGlass <- Glass.configParser
+      cfgCmd <- (\(cmd::String) -> case cmd of
+                    "references" -> FindReferences
+                    "describe" -> Describe
+                    _ -> FindLocation)
+            <$> strOption (short 'c' <> long "command" <> metavar "COMMAND")
+      cfgSymbol <- fmap SymbolId <$>
+        maybeTextOption (long "symbol" <> short 's' <> metavar "SYMBOL")
+      cfgFile <-
+        maybeTextOption (long "file" <> short 'f' <> metavar "FILE")
+      cfgLimit <- fmap fromIntegral <$>
+        maybeIntOption (long "limit" <> short 'n' <> metavar "LIMIT")
+      return Config{..}
+
+main :: IO ()
+main =
+  withOptions options $ \Config{cfgGlass = glassConfig, ..} ->
+  Glass.withEnv glassConfig Nothing $ \env -> do
+
+    syms <- case (cfgSymbol, cfgFile) of
+      (Nothing, Nothing) ->
+        map SymbolId . Text.lines <$> Text.getContents
+
+      (Just symid, _) -> return [symid]
+      (_, Just file) -> map SymbolId . Text.lines <$>
+         readFileUTF8Text (Text.unpack file)
+
+    case cfgCmd of
+      FindLocation -> do
+        let symbolLocation :: SymbolId -> IO SymbolLocation
+            symbolLocation r =
+              Handle.symbolLocation env r (def :: RequestOptions)
+        forM_ syms $ Text.putStrLn <=< testSymbolLocation symbolLocation
+
+      FindReferences -> do
+        let findReferences :: SymbolId -> IO [LocationRange]
+            findReferences r =
+              Handle.findReferenceRanges env r
+                (def  { requestOptions_limit = cfgLimit } )
+        forM_ syms $ mapM_ Text.putStrLn <=< testFindReferences findReferences
+
+      Describe -> do
+        let describe :: SymbolId -> IO SymbolDescription
+            describe r =
+              Handle.describeSymbol env r
+                (def  { requestOptions_limit = cfgLimit } )
+        forM_ syms $ Text.putStrLn <=< testDescribe describe
+
+testFindReferences
+  :: (SymbolId -> IO [LocationRange])
+  -> SymbolId
+  -> IO [Text]
+testFindReferences handler symbol@(SymbolId name) = do
+  handle (\(ServerException e) -> return ["FAIL " <> e]) $ do
+    res <- runTest handler symbol
+    let title = Text.concat
+          [ "OK "
+          , Text.pack (showTime (fst3 res))
+          , " "
+          , name
+          , Text.pack (printf " (Found %d references)" (length $ thd3 res))
+          ]
+    let body = map pprLocationRange (thd3 res)
+
+    return $ title : body
+
+testSymbolLocation
+  :: (SymbolId -> IO SymbolLocation)
+  -> SymbolId
+  -> IO Text
+testSymbolLocation handler symbol@(SymbolId name) = do
+  handle (\(ServerException e) -> return ("FAIL " <> e)) $ do
+    res <- runTest handler symbol
+    return $ Text.concat
+      [ "OK "
+      , Text.pack (showTime (fst3 res))
+      , " "
+      , name
+      ," -> "
+      ,pprLocationRange (symbolLocation_location (thd3 res))
+      ]
+
+testDescribe
+  :: (SymbolId -> IO SymbolDescription)
+  -> SymbolId
+  -> IO Text
+testDescribe handler symbol@(SymbolId name) = do
+  handle (\(ServerException e) -> return ("FAIL " <> e)) $ do
+    res <- runTest handler symbol
+    return $ Text.concat
+      [ "OK "
+      , Text.pack (showTime (fst3 res))
+      , " "
+      , name
+      ," -> "
+      ,pprDescription (thd3 res)
+      ]
+
+pprLocationRange :: LocationRange -> Text
+pprLocationRange LocationRange{..} =
+  Text.concat [
+    unRepoName locationRange_repository, "@",
+    unPath locationRange_filepath, " ",
+    pprRange locationRange_range
+  ]
+
+pprSymbolPath :: SymbolPath -> Text
+pprSymbolPath SymbolPath{..} = pprLocationRange LocationRange{..}
+  where
+    locationRange_filepath  = symbolPath_filepath
+    locationRange_range = symbolPath_range
+    locationRange_repository = symbolPath_repository
+
+pprQName :: QualifiedName -> Text
+pprQName QualifiedName{..} = Text.concat
+  [ "container: ", unName qualifiedName_container
+  , " "
+  , "localname: ", unName qualifiedName_localName
+  ]
+
+pprKind :: Maybe SymbolKind -> Text
+pprKind = textShow
+
+pprDescription :: SymbolDescription -> Text
+pprDescription SymbolDescription{..} =
+  Text.unlines [
+    pprSymbolPath symbolDescription_location,
+    "qualified name: "<> pprQName symbolDescription_name,
+    "symbol kind: "<> pprKind symbolDescription_kind
+  ]
+
+pprRange :: Range -> Text
+pprRange Range{..} = Text.concat
+  [ "("
+  , textShow range_lineBegin, ":"
+  , textShow range_columnBegin, "-"
+  , textShow range_lineEnd, ":"
+  , textShow range_columnEnd
+  , ")"
+  ]
+
+runTest
+  :: (a -> IO r)
+  -> a
+  -> IO (Double, Int64, r)
+runTest handler sym = timeIt $ handler sym
diff --git a/glean/haxl/Haxl/DataSource/Glean.hs b/glean/haxl/Haxl/DataSource/Glean.hs
new file mode 100644
--- /dev/null
+++ b/glean/haxl/Haxl/DataSource/Glean.hs
@@ -0,0 +1,145 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
+module Haxl.DataSource.Glean
+  ( get
+  , getRec
+  , getOfId
+  , getRecOfId
+  , getKey
+  , getKeyRec
+  , getKeyOfId
+  , getKeyRecOfId
+  , haxlRepo
+  , search
+  , search_
+  , searchWith
+  , count
+  , withRepo
+  , HasRepo(..)
+  ) where
+
+import Data.Hashable
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.Typeable
+
+import Haxl.Core hiding (Env)
+
+import Glean.Backend.Types
+import Glean.Query.Thrift
+import Glean.Types
+import Glean.Typed as Typed
+
+-- User Interface --------
+
+class HasRepo u where
+  getRepoFromUserEnv :: u -> Repo
+
+instance HasRepo Repo where
+  getRepoFromUserEnv = id
+
+haxlRepo :: HasRepo u => GenHaxl u w Repo
+haxlRepo = do
+  userEnv <- env userEnv
+  return $ getRepoFromUserEnv userEnv
+
+withRepo :: HasRepo u => u -> GenHaxl u w a -> GenHaxl u w a
+withRepo userEnv action = do
+  coreEnv <- env id
+  withEnv coreEnv{userEnv=userEnv} action
+
+get, getRec
+  :: (Typeable p, Show p, Predicate p, HasRepo u)
+  => p
+  -> GenHaxl u w p
+
+get p = haxlRepo >>= \repo -> dataFetch $ Get (getId p) False repo
+getRec p = haxlRepo >>= \repo -> dataFetch $ Get (getId p) True repo
+
+getOfId, getRecOfId
+  :: (Typeable p, Show p, Predicate p, HasRepo u)
+  => IdOf p
+  -> GenHaxl u w p
+
+getOfId p = haxlRepo >>= \repo -> dataFetch $ Get p False repo
+getRecOfId p = haxlRepo >>= \repo -> dataFetch $ Get p True repo
+
+getKey, getKeyRec
+  :: ( Typeable p, Typeable (KeyType p)
+     , Show p, Show (KeyType p)
+     , Predicate p, HasRepo u )
+  => p
+  -> GenHaxl u w (KeyType p)
+
+getKey p = haxlRepo >>= \repo -> dataFetch $ GetKey (getId p) False repo
+getKeyRec p = haxlRepo >>= \repo -> dataFetch $ GetKey (getId p) True repo
+
+getKeyOfId, getKeyRecOfId
+  :: ( Typeable p, Typeable (KeyType p)
+     , Show p, Show (KeyType p)
+     , Predicate p, HasRepo u )
+  => IdOf p
+  -> GenHaxl u w (KeyType p)
+
+getKeyOfId id = haxlRepo >>= \repo -> dataFetch $ GetKey id False repo
+getKeyRecOfId id = haxlRepo >>= \repo -> dataFetch $ GetKey id True repo
+
+-- | Perform a query using Glean. Returns the results and a 'Bool'
+-- indicating whether the results were truncated (either by the server
+-- or by an explicit 'limit' applied to the query).
+search
+  :: (Typeable q, Show q, HasRepo u)
+  => Query q
+  -> GenHaxl u w ([q], Bool)
+search q = haxlRepo >>= \repo -> do
+  (a, b) <- dataFetch $ mkQueryReq repo q False
+  return (fromAppendList a, b)
+
+-- | Like 'search', but returns results only. Always returns all the
+-- results, streaming results from the server if necessary.
+search_
+  :: (Typeable q, Show q, HasRepo u)
+  => Query q
+  -> GenHaxl u w [q]
+search_ = fmap fromAppendList . searchWith
+
+searchWith
+  :: (Typeable r, Show r, Typeable q, Show q, HasRepo u, QueryResult q r)
+  => Query q
+  -> GenHaxl u w r
+searchWith q = haxlRepo >>= \repo ->
+  fmap fst $ dataFetch $ mkQueryReq repo q True
+
+newtype UniqueResults a = UniqueResults { fromUniqueResults :: HashSet a }
+  deriving (Semigroup, Monoid, Show)
+
+instance (Hashable q, Eq q) => QueryResult q (UniqueResults q) where
+  fromResults = UniqueResults . HashSet.fromList
+
+-- | Count the unique results of a query.
+count
+  :: forall q u w.
+     (Typeable q, Show q, Hashable q, Eq q, HasRepo u)
+  => Query q
+  -> GenHaxl u w Int
+count q = haxlRepo >>= \repo -> do
+  (UniqueResults (s :: HashSet q), _) <- dataFetch $ mkQueryReq repo q True
+  return (HashSet.size s)
+
+-- -----------------------------------------------------------------------------
+
+-- | smart constructor to ensure the query result encoding is set to binary
+mkQueryReq
+  :: forall q r . (Show q, Typeable q, QueryResult q r)
+  => Repo
+  -> Query q
+  -> Bool
+  -> GleanQuery (r, Bool)
+mkQueryReq repo q b = QueryReq q repo b
diff --git a/glean/haxl/Haxl/DataSource/Glean/Common.hs b/glean/haxl/Haxl/DataSource/Glean/Common.hs
new file mode 100644
--- /dev/null
+++ b/glean/haxl/Haxl/DataSource/Glean/Common.hs
@@ -0,0 +1,199 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+module Haxl.DataSource.Glean.Common
+  ( GleanGet(..)
+  , GleanFetcher
+  , mkUserQueryFacts
+  , mkUserQuery
+  , putResults
+  , requestByRepo
+  , GleanQuery(..)
+  , GleanQueryer
+  , putQueryResults
+  , putQueryResultsOrException
+  , State(GleanGetState, GleanQueryState)
+  , intId
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.IO.Class
+import Data.Coerce
+import Data.Default
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.IntMap as IntMap
+import Data.IORef
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Typeable
+import TextShow
+
+import Haxl.Core
+import Unsafe.Coerce
+
+import Glean.Backend.Types
+import Glean.Query.Thrift.Internal
+import Glean.Types
+import Glean.Typed as Typed
+import qualified Haxl.Core.DataSource as Haxl
+
+
+{-# INLINE intId #-}
+intId :: IdOf p -> Id
+intId id = fromIntegral (fromFid (idOf id))
+
+mkUserQueryFacts
+  :: Maybe UserQueryClientInfo
+  -> Maybe SchemaId
+  -> [BlockedFetch GleanGet]
+  -> UserQueryFacts
+mkUserQueryFacts minfo schema requests = def
+  { userQueryFacts_facts = map toFactQuery requests
+  , userQueryFacts_options = Just def
+    { userQueryOptions_expand_results = False
+    , userQueryOptions_recursive = False
+    , userQueryOptions_max_results =
+       Just (fromIntegral (length requests)) }
+  , userQueryFacts_encodings = [UserQueryEncoding_bin def]
+  , userQueryFacts_client_info = minfo
+  , userQueryFacts_schema_id = coerce schema
+  }
+  where
+    toFactQuery :: BlockedFetch GleanGet -> FactQuery
+    toFactQuery (BlockedFetch (Get (p :: IdOf p) rec _repo) _) =
+      FactQuery
+        (intId p)
+        (Just (predicateRef_version (getName (Proxy @p))))
+        rec
+    toFactQuery (BlockedFetch (GetKey (p :: IdOf p) rec _repo) _) =
+      FactQuery
+        (intId p)
+        (Just (predicateRef_version (getName (Proxy @p))))
+        rec
+
+mkUserQuery
+  :: Maybe UserQueryClientInfo
+  -> Maybe SchemaId
+  -> UserQuery
+  -> UserQuery
+mkUserQuery minfo schema q = q
+  { userQuery_encodings = [UserQueryEncoding_bin def]
+  , userQuery_client_info = minfo
+  , userQuery_schema_id = coerce schema
+  }
+
+requestByRepo :: [BlockedFetch GleanGet] -> HashMap Repo [BlockedFetch GleanGet]
+requestByRepo requests =
+  HashMap.fromListWith (++) $ map (\req -> (repoOf req, [req])) requests
+  where
+    repoOf (BlockedFetch (Get _ _ repo) _) = repo
+    repoOf (BlockedFetch (GetKey _ _ repo) _) = repo
+
+putResults :: UserQueryResults -> [BlockedFetch GleanGet] -> IO ()
+putResults UserQueryResults{..} requests = do
+  mapM_ reportUserQueryStats userQueryResults_stats
+  UserQueryResultsBin{..} <- expectBinResults userQueryResults_results
+  cacheRef <- newIORef IntMap.empty
+  emptyCacheRef <- newIORef IntMap.empty
+  let
+    serialized = IntMap.fromList
+      [ (fromIntegral id,f)
+      | (id,f) <- Map.toList userQueryResultsBin_nestedFacts ]
+
+    decodeResult (BlockedFetch (Get (p :: IdOf p) rec _repo) rvar) = do
+      let fid = intId p
+      case Map.lookup fid userQueryResultsBin_facts of
+        Nothing ->
+          putFailure rvar (Exception $ "can't find fact: " <> showt fid)
+        Just fact -> do
+          fact' <- liftIO $ decodeFact
+            (if rec then serialized else IntMap.empty)
+            (if rec then cacheRef else emptyCacheRef)
+            (IdOf (Fid fid)) fact
+          putSuccess rvar (unsafeCoerce (fact' :: p))
+    decodeResult (BlockedFetch (GetKey (p :: IdOf p) rec _repo) rvar) = do
+      let fid = intId p
+      case Map.lookup fid userQueryResultsBin_facts of
+        Nothing ->
+          putFailure rvar (Exception $ "can't find fact: " <> showt fid)
+        Just (Fact _ k _) -> do
+          key <- liftIO $ decodeWithCache
+            (if rec then serialized else IntMap.empty)
+            (if rec then cacheRef else emptyCacheRef)
+            decodeRtsValue k
+          putSuccess rvar key
+
+  mapM_ decodeResult requests
+
+expectBinResults :: UserQueryEncodedResults -> IO UserQueryResultsBin
+expectBinResults (UserQueryEncodedResults_bin r) = return r
+expectBinResults _ = throwIO $ Exception "server returned the wrong encoding"
+
+
+putQueryResults
+  :: forall q r . QueryResult q r
+  => Query q
+  -> UserQueryResults
+  -> Maybe r -- results so far
+  -> ResultVar (r, Bool)
+  -> (Query q -> Maybe r -> IO ())
+     -- ^ How to resume if we're streaming
+  -> IO ()
+putQueryResults (Query q) UserQueryResults{..} maybeAcc rvar more = do
+  mapM_ reportUserQueryStats userQueryResults_stats
+  UserQueryResultsBin{..} <- expectBinResults userQueryResults_results
+  cacheRef <- newIORef IntMap.empty
+  let
+    serialized = IntMap.fromList
+      [ (fromIntegral id,f)
+      | (id,f) <- Map.toList userQueryResultsBin_nestedFacts ]
+  results :: [q] <- forM (Map.toList userQueryResultsBin_facts) $
+    \(fid, fact) -> do
+      liftIO $ decodeAsFact serialized cacheRef
+        (Typed.IdOf (Fid fid)) fact
+
+  if
+    -- If the server gave us fewer results and streaming is enabled,
+    -- fetch more results.
+    | Just acc <- maybeAcc, Just cont <- userQueryResults_continuation
+      -> let !newAcc = acc <> fromResults results in
+         more
+         (Query q { userQuery_options = Just
+           (fromMaybe def (userQuery_options q))
+             { userQueryOptions_continuation = Just cont } })
+         (Just newAcc)
+
+    | otherwise -> do
+      let allResults = fromMaybe mempty maybeAcc <> fromResults results
+      putSuccess rvar (allResults, isJust userQueryResults_continuation)
+
+
+putQueryResultsOrException
+  :: QueryResult q r
+  => Query q
+  -> UserQueryResultsOrException
+  -> Maybe r -- results so far
+  -> ResultVar (r, Bool)
+  -> (Query q -> Maybe r -> IO ())
+     -- ^ How to resume if we're streaming
+  -> IO ()
+putQueryResultsOrException q r maybeAcc rvar more =
+  case r of
+    UserQueryResultsOrException_results r ->
+      putQueryResults q r maybeAcc rvar more
+    UserQueryResultsOrException_badQuery (BadQueryException ex) ->
+      Haxl.putFailure rvar (BadQuery ex)
+    UserQueryResultsOrException_retry (RetryException ex) ->
+      Haxl.putFailure rvar (Retry ex)
+    UserQueryResultsOrException_other (GleanException ex) ->
+      Haxl.putFailure rvar (Exception ex)
+    other -> throwIO $ userError $ "unexpected: " <> show other
diff --git a/glean/hs/Glean/Angle/Hash.hs b/glean/hs/Glean/Angle/Hash.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Angle/Hash.hs
@@ -0,0 +1,53 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Fingerprints for schema versioning.
+--
+-- Doesn't need to be cryptographically secure, but does need to be
+-- robust against accidental collisions.
+
+module Glean.Angle.Hash
+  ( Hash
+  , hash0
+  , hashString
+  , hashByteString
+  , hashBinary
+  , hashFingerprint
+  ) where
+
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Lazy as LB
+import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
+import Data.Binary (Binary)
+import qualified Data.Binary as Binary
+import Data.Hashable
+import Foreign (castPtr)
+import GHC.Fingerprint as GHC
+import System.IO.Unsafe ( unsafeDupablePerformIO )
+
+-- efficient MD5 hash
+type Hash = GHC.Fingerprint
+
+hash0 :: Hash
+hash0 = GHC.fingerprint0
+
+hashString :: String -> Hash
+hashString = GHC.fingerprintString
+
+hashByteString :: B.ByteString -> Hash
+hashByteString bs = unsafeDupablePerformIO $ do
+  unsafeUseAsCStringLen bs $ \(ptr, len) ->
+    GHC.fingerprintData (castPtr ptr) (fromIntegral len)
+
+hashBinary :: Binary a => a -> Hash
+hashBinary = hashByteString . LB.toStrict . Binary.encode
+
+-- | For building Hashable instances. Avoiding an orphan instance by
+-- making this a function instead.
+hashFingerprint :: Int -> Hash -> Int
+hashFingerprint salt (GHC.Fingerprint _ w) = hashWithSalt salt w
diff --git a/glean/hs/Glean/Angle/Lexer.x b/glean/hs/Glean/Angle/Lexer.x
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Angle/Lexer.x
@@ -0,0 +1,318 @@
+-- Copyright (c) Facebook, Inc. and its affiliates.
+
+{
+{-# OPTIONS_GHC -funbox-strict-fields #-}
+{-# LANGUAGE DeriveFunctor, NamedFieldPuns #-}
+module Glean.Angle.Lexer
+  ( Token(..)
+  , TokenType(..)
+  , Located(..)
+  , AlexInput
+  , alexGetInput
+  , AlexPosn(..)
+  , runAlex
+  , lexer
+  , Alex(..)
+  , alexError
+  , alexMonadScan
+  , getFile
+  , encodeTextForAngle
+  , getVersion
+  , setVersion
+  ) where
+
+import qualified Data.Aeson as Aeson
+import Data.Aeson.Parser
+import Data.Attoparsec.ByteString (parseOnly)
+import Data.ByteString.Lazy (ByteString)
+import qualified Data.ByteString.UTF8 as UTF8
+import qualified Data.ByteString as Strict
+import qualified Data.ByteString.Lazy as Lazy
+import Data.Text (Text)
+import qualified Data.Text.Encoding as Text
+import Data.Word (Word64)
+
+import Glean.Angle.Types (SrcSpan(..), SrcLoc(..), AngleVersion(..), latestAngleVersion)
+}
+
+%wrapper "monadUserState-bytestring"
+
+$all = [.\n]
+$digit = [0-9]
+
+-- The # in identifiers is reserved for "special" uses. Currently
+-- there are two: <predicate>#new and <predicate>#old for
+-- restricting queries to the stacked and base DB respectively, when
+-- writing incremental derivers.
+@ident = [a-zA-Z_] [a-zA-Z0-9_]*
+@lident = [a-z] [a-zA-Z0-9_]*
+@uident = [A-Z_] [a-zA-Z0-9_]*
+
+@string = \" (\\ $all | $all # [\"\\] )* \"
+
+-- A qualified name with an optional version:
+--    VALID: "a" "a.b" "a.b.3" "a.b#new" "a.b.3#old"
+--    INVALID: "a." "a..b" "a.3.b" "a.3b"
+@lqident = @lident (\. @ident)* (\. ($digit+ | @ident)) (\# @ident)?
+
+-- versioned: Predicate.1
+@uqident = @uident (\. @ident)* \. $digit+ (\# @ident)?
+
+tokens :-
+  $white+       ;
+  "#FILE " .* \n { setFile }
+  "#" .*        ;
+
+  $digit+       { tokenContent $ T_NatLit . number  }
+  @string       { tokenContentP $ \b -> T_StringLit <$> parseString b }
+
+  "bool"        { basicToken T_Bool }
+  "byte"        { basicToken T_Byte }
+  "default"     { basicToken T_Default }
+  "derive"      { basicToken T_Derive }
+  "enum"        { basicToken T_Enum }
+  "import"      { basicToken T_Import }
+  "maybe"       { basicToken T_Maybe }
+  "nat"         { basicToken T_Nat }
+  "predicate"   { basicToken T_Predicate }
+  "schema"      { basicToken T_Schema }
+  "set"         { versionDependentToken (AngleVersion 8) T_Set (T_LIdent . ByteString.toStrict) }
+  "elements"    { versionDependentToken (AngleVersion 8) T_Elements (T_LIdent . ByteString.toStrict) }
+  "all"         { versionDependentToken (AngleVersion 8) T_All (T_LIdent . ByteString.toStrict) }
+  "string"      { basicToken T_String }
+  "type"        { basicToken T_Type }
+  "stored"      { basicToken T_Stored }
+  "where"       { basicToken T_QueryDef }
+  "evolves"     { basicToken T_Evolves }
+  "never"       { basicToken T_Never }
+  "if"          { basicToken T_If }
+  "then"        { basicToken T_Then }
+  "else"        { basicToken T_Else }
+  "++"          { basicToken T_Append }
+  ("."){2,}     { basicTokenDotDot }
+  "->"          { basicToken T_RightArrow }
+  ","           { basicToken T_Comma }
+  "|"           { basicToken T_Bar }
+  ":"           { basicToken T_Colon }
+  "("           { basicToken T_LeftParen }
+  ")"           { basicToken T_RightParen }
+  "["           { basicToken T_LeftSquare }
+  "]"           { basicToken T_RightSquare }
+  "{"           { basicToken T_LeftCurly }
+  "}"           { basicToken T_RightCurly }
+  "="           { basicToken T_Equals }
+  "!"           { basicToken T_Negate }
+  "!=="         { basicToken T_NotEquals }
+  "!="          { basicToken T_NotEqualsSingle }
+  ">"           { basicToken T_GreaterThan }
+  ">="          { basicToken T_GreaterThanOrEquals }
+  "<"           { basicToken T_LessThan }
+  "<="          { basicToken T_LessThanOrEquals }
+  "+"           { basicToken T_Plus }
+  ";"           { basicToken T_Semi }
+  "_"           { basicToken T_Underscore }
+  "$"           { basicToken T_Dollar }
+  ".*"          { basicToken T_DotStar }
+
+  -- dot-syntax was introduced in version 9
+  "." @lident / { ifVersion 9 }
+                { tokenContent $ T_Select . ByteString.toStrict . ByteString.tail }
+  "." @lident "?" / { ifVersion 9 }
+                { tokenContent $ T_SelectAlt . ByteString.toStrict .
+                    ByteString.tail . ByteString.init }
+
+  @lqident      { tokenContent $ T_QIdent . ByteString.toStrict }
+  @uqident      { tokenContent $ T_QIdent . ByteString.toStrict }
+  @uident       { tokenContent $ T_UIdent . ByteString.toStrict }
+  @lident       { tokenContent $ T_LIdent . ByteString.toStrict }
+{
+data AlexUserState = AlexUserState
+  { angleVersion :: AngleVersion
+  , currentFile :: FilePath
+  }
+
+alexInitUserState :: AlexUserState
+alexInitUserState = AlexUserState latestAngleVersion ""
+
+ifVersion n AlexUserState{angleVersion=AngleVersion v} _ _ _ = v >= n
+
+-- | A value with its source location.
+data Located a = L
+  { lspan :: SrcSpan
+  , lval  :: a
+  }
+  deriving (Eq, Show, Functor)
+
+data Token = Token ByteString TokenType
+
+data TokenType
+  = T_Bool
+  | T_Byte
+  | T_Derive
+  | T_Default
+  | T_Enum
+  | T_Import
+  | T_Maybe
+  | T_Nat
+  | T_Predicate
+  | T_Schema
+  | T_Set
+  | T_Elements
+  | T_All
+  | T_String
+  | T_Type
+  | T_Stored
+  | T_Where
+  | T_UIdent Strict.ByteString
+  | T_LIdent Strict.ByteString
+  | T_QIdent Strict.ByteString
+  | T_StringLit Text
+  | T_NatLit Word64
+  | T_QueryDef
+  | T_Evolves
+  | T_Never
+  | T_If
+  | T_Then
+  | T_Else
+  | T_Append
+  | T_DotDot
+  | T_RightArrow
+  | T_Comma
+  | T_Bar
+  | T_Colon
+  | T_LeftParen
+  | T_RightParen
+  | T_LeftSquare
+  | T_RightSquare
+  | T_LeftCurly
+  | T_RightCurly
+  | T_Equals
+  | T_Negate
+  | T_NotEquals
+  | T_NotEqualsSingle
+  | T_GreaterThan
+  | T_GreaterThanOrEquals
+  | T_LessThan
+  | T_LessThanOrEquals
+  | T_Plus
+  | T_Semi
+  | T_Underscore
+  | T_Dollar
+  | T_Select Strict.ByteString
+  | T_SelectAlt Strict.ByteString
+  | T_DotStar
+  | T_EOF
+  deriving Show
+
+-- setFile :: AlexAction a
+setFile inp@(_,_,b,_) len = do
+  let filename = ByteString.drop 6 $ ByteString.take (len-1) b
+  Alex $ \state -> Right (
+    state { alex_ust = (alex_ust state) {
+              currentFile = UTF8.toString (ByteString.toStrict filename) }
+          , alex_pos = alexStartPos }, ())
+  skip inp len
+
+getFile :: Alex FilePath
+getFile = Alex $ \state -> Right (state, currentFile (alex_ust state))
+
+getVersion :: Alex AngleVersion
+getVersion = Alex $ \state -> Right (state, angleVersion (alex_ust state))
+
+setVersion :: AngleVersion -> Alex ()
+setVersion ver = Alex $ \state -> Right
+  (state { alex_ust = (alex_ust state) { angleVersion = ver }}, ())
+
+basicToken :: TokenType -> AlexAction (SrcLoc, Token)
+basicToken t (AlexPn _ line col,_,b,_) len =
+  return $ (SrcLoc line col, Token (ByteString.take len b) t)
+
+versionDependentToken :: AngleVersion -> TokenType -> (ByteString -> TokenType) -> AlexAction (SrcLoc, Token)
+versionDependentToken firstSupportedVersion newToken oldToken =
+  tokenContentP $ \bs -> do
+    currentVersion <- getVersion
+    if currentVersion >= firstSupportedVersion
+      then return newToken
+      else return $ oldToken bs
+
+basicTokenDotDot :: AlexAction (SrcLoc, Token)
+basicTokenDotDot i@(AlexPn _ line col,_,_,_) len =
+  if len > 2 then
+    alexError $ "Too many dots at line " ++ show line ++
+      ", column " ++ show col ++
+      ". Try using '..' instead of '" ++ (replicate (fromIntegral len) '.') ++ "'"
+  else
+    basicToken T_DotDot i len
+
+tokenContent :: (ByteString -> TokenType) -> AlexAction (SrcLoc, Token)
+tokenContent f = tokenContentP (return . f)
+
+tokenContentP :: (ByteString -> Alex TokenType) -> AlexAction (SrcLoc, Token)
+tokenContentP f (AlexPn _ line col,_,b,_) len =
+  (SrcLoc line col,) . Token content <$> f content
+  where
+    content = ByteString.take len b
+
+number :: ByteString -> Word64
+number = ByteString.foldl' f 0 where
+  f x y = x * 10 + fromIntegral (y - fromIntegral (Data.Char.ord '0'))
+
+alexEOF :: Alex (SrcLoc, Token)
+alexEOF = do
+  (AlexPn _ line col,_,_,_) <- alexGetInput
+  return (SrcLoc line col, Token "" T_EOF)
+
+-- | We'll use JSON syntax for strings, as a reasonably fast way to support
+-- some escaping syntax.
+parseString :: ByteString -> Alex Text
+parseString b =
+  case parseOnly jstring (ByteString.toStrict b) of
+    Left{} -> alexError "lexical error in string"
+    Right a -> return a
+
+-- | encode a Text value into an Angle string, with appropriate escaping and
+-- surrounded by double quotes. e.g.
+--
+-- > ghci> encodeTextForAngle "ab\"\NUL"
+-- > "\"ab\\\"\\u0000\""
+--
+encodeTextForAngle :: Text -> Text
+encodeTextForAngle =
+  Text.decodeUtf8 . Lazy.toStrict . Aeson.encode . Aeson.String
+
+alexGetUserState_ :: Alex AlexUserState
+alexGetUserState_ = Alex $ \s@AlexState{alex_ust} -> Right (s, alex_ust)
+
+getToken :: Alex (SrcLoc, Token)
+getToken = do
+  inp__@(_,_,_,n) <- alexGetInput
+  sc <- alexGetStartCode
+  ust <- alexGetUserState_
+  case alexScanUser ust inp__ sc of
+    AlexEOF -> alexEOF
+    AlexError ((AlexPn _ line column),_,_,_) ->
+      let
+          file = currentFile ust
+          err = "lexical error at line " ++ show line ++
+            ", column " ++ show column
+      in
+      if null file
+        then alexError err
+        else alexError $ file <> ": " <> err
+
+    AlexSkip  inp__ _len -> do
+      alexSetInput inp__
+      getToken
+
+    AlexToken inp2__@(_,_,_,m) _ action -> let len = m-n in do
+      alexSetInput inp2__
+      action (ignorePendingBytes inp__) len
+
+lexer :: (Located Token -> Alex a) -> Alex a
+lexer f = do
+  (start, tok) <- getToken
+  (AlexPn _ eline ecol,_,_,_) <- alexGetInput
+  let end = SrcLoc eline ecol
+  f $ L (SrcSpan start end) tok
+
+}
diff --git a/glean/hs/Glean/Angle/Parser.y b/glean/hs/Glean/Angle/Parser.y
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Angle/Parser.y
@@ -0,0 +1,510 @@
+-- Copyright (c) Facebook, Inc. and its affiliates.
+
+{
+module Glean.Angle.Parser
+  ( parseQuery
+  , parseQueryWithVersion
+  , parseSchema
+  , stripAngleVersion
+  , parseSchemaWithVersion
+  , parseType
+  ) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as B
+import qualified Data.ByteString.Lazy.Char8 as LB
+import Data.Char
+import Data.Either (partitionEithers)
+import Data.List.NonEmpty (NonEmpty((:|)))
+import Data.Maybe
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Data.Text (Text)
+import Data.Word
+import Data.Text.Prettyprint.Doc (pretty)
+
+import Glean.Angle.Lexer
+import Glean.Schema.Util
+import Glean.Types hiding (Query, Nat)
+import Glean.Angle.Types as Schema
+}
+
+%tokentype { Located Token }
+%token
+  'bool'        { L _ (Token _ T_Bool) }
+  'byte'        { L _ (Token _ T_Byte) }
+  'derive'      { L _ (Token _ T_Derive) }
+  'default'     { L _ (Token _ T_Default) }
+  'enum'        { L _ (Token _ T_Enum) }
+  'import'      { L _ (Token _ T_Import) }
+  'maybe'       { L _ (Token _ T_Maybe) }
+  'nat'         { L _ (Token _ T_Nat) }
+  'predicate'   { L _ (Token _ T_Predicate) }
+  'schema'      { L _ (Token _ T_Schema) }
+  'set'         { L _ (Token _ T_Set) }
+  'elements'    { L _ (Token _ T_Elements) }
+  'all'         { L _ (Token _ T_All) }
+  'string'      { L _ (Token _ T_String) }
+  'stored'      { L _ (Token _ T_Stored) }
+  'type'        { L _ (Token _ T_Type) }
+  'where'       { L _ (Token _ T_QueryDef) }
+  'evolves'     { L _ (Token _ T_Evolves) }
+  'never'       { L _ (Token _ T_Never) }
+  'if'          { L _ (Token _ T_If) }
+  'then'        { L _ (Token _ T_Then) }
+  'else'        { L _ (Token _ T_Else) }
+  '++'          { L _ (Token _ T_Append) }
+  '..'          { L _ (Token _ T_DotDot) }
+  '->'          { L _ (Token _ T_RightArrow) }
+  ','           { L _ (Token _ T_Comma) }
+  '|'           { L _ (Token _ T_Bar) }
+  ':'           { L _ (Token _ T_Colon) }
+  ';'           { L _ (Token _ T_Semi) }
+  '('           { L _ (Token _ T_LeftParen) }
+  ')'           { L _ (Token _ T_RightParen) }
+  '['           { L _ (Token _ T_LeftSquare) }
+  ']'           { L _ (Token _ T_RightSquare) }
+  '{'           { L _ (Token _ T_LeftCurly) }
+  '}'           { L _ (Token _ T_RightCurly) }
+  '='           { L _ (Token _ T_Equals) }
+  '!'           { L _ (Token _ T_Negate) }
+  '!=='         { L _ (Token _ T_NotEquals) }
+  '!='          { L _ (Token _ T_NotEqualsSingle) }
+  '>'           { L _ (Token _ T_GreaterThan) }
+  '>='          { L _ (Token _ T_GreaterThanOrEquals) }
+  '<'           { L _ (Token _ T_LessThan) }
+  '<='          { L _ (Token _ T_LessThanOrEquals) }
+  '+'           { L _ (Token _ T_Plus) }
+  '_'           { L _ (Token _ T_Underscore) }
+  '$'           { L _ (Token _ T_Dollar) }
+  '.*'          { L _ (Token _ T_DotStar) }
+
+  SELECT_       { L _ (Token _ (T_Select _)) }
+  SELECTALT_    { L _ (Token _ (T_SelectAlt _)) }
+  UIDENT_       { L _ (Token _ (T_UIdent _)) }
+  LIDENT_       { L _ (Token _ (T_LIdent _)) }
+  QIDENT_       { L _ (Token _ (T_QIdent _)) }
+  STRING_       { L _ (Token _ (T_StringLit _)) }
+  NAT_          { L _ (Token _ (T_NatLit _)) }
+
+
+%name query query
+%name schema schemas
+%name type_ type
+%monad { P }
+%lexer { lexer } { L _ (Token _ T_EOF)}
+%error { parseError }
+%expect 0
+
+%%
+
+query :: { SourceQuery }
+query
+  : pattern 'where' seplist_(statement,';') { SourceQuery (Just $1) $3 Ordered }
+  | seplist_(statement,';')  { SourceQuery Nothing $1 Ordered }
+
+statement :: { SourceStatement }
+statement
+  : pattern '=' pattern  { SourceStatement $1 $3 }
+  | pattern              { SourceStatement (Wildcard $ sspan $1) $1 }
+
+pattern :: { SourcePat }
+pattern
+  : gen '++' pattern { OrPattern (s $1 $3) $1 $3 } -- deprecated syntax
+  | gen '|' pattern  { OrPattern (s $1 $3) $1 $3 }
+  | '!' gen          { Negation (s $1 $2) $2 }
+  | 'if' pattern
+    'then' pattern
+    'else' pattern   { IfPattern (s $1 $6) $2 $4 $6 }
+  | gen              { $1 }
+
+gen :: { SourcePat }
+gen
+  : op { $1 }
+  | op ':' type    { TypeSignature (s $1 $3) $1 (lval $3) }
+
+op :: { SourcePat }
+op
+  : plus  { $1 }
+  | plus '!=' plus   { App (s $1 $3) (Variable (sspan $2) "prim.neExpr") [$1, $3] }
+  | plus '!==' plus  { App (s $1 $3) (Variable (sspan $2) "prim.neNat") [$1, $3] }
+  | plus '>' plus    { App (s $1 $3) (Variable (sspan $2) "prim.gtNat") [$1, $3] }
+  | plus '>=' plus   { App (s $1 $3) (Variable (sspan $2) "prim.geNat") [$1, $3] }
+  | plus '<' plus    { App (s $1 $3) (Variable (sspan $2) "prim.ltNat") [$1, $3] }
+  | plus '<=' plus   { App (s $1 $3) (Variable (sspan $2) "prim.leNat") [$1, $3] }
+  | kv '[' '..' ']'  { ElementsOfArray (s $1 $4) $1 }
+    -- NB. kv to resolve shift-reduce conflict
+
+plus :: { SourcePat }
+plus
+  : plus '+' app  { App (s $1 $3) (Variable (sspan $2) "prim.addNat") [$1, $3] }
+  | app  { $1 }
+
+app :: { SourcePat }
+app
+  : list1(kv)  { case $1 of [f] -> f; f:args -> App (s f $ last args) f args }
+  | 'elements' kv { Elements (s $1 $2) $2 }
+  | 'all' kv { All (s $1 $2) $2 }
+
+-- K -> V binds tighter than application, so that e.g.
+--   p K -> V
+-- can be used to match facts of the functional predicate p.
+kv :: { SourcePat }
+kv
+  : select '->' select  { KeyValue (s $1 $3) $1 $3 }
+  | select  { $1 }
+
+select :: { SourcePat }
+select
+  : select SELECT { FieldSelect (s $1 $2) $1 (lval $2) Record }
+  | select SELECTALT { FieldSelect (s $1 $2) $1 (lval $2) Sum }
+  | select '.*' { Deref (s $1 $2) $1 }
+  | apat  { $1 }
+
+apat :: { SourcePat }
+apat
+  : NAT                             { Nat (sspan $1) (lval $1) }
+  | STRING                          { String (sspan $1) (lval $1) }
+  | STRING '..'                     { StringPrefix (s $1 $2) (lval $1) }
+  | '$' NAT                         { FactId (s $1 $2) Nothing (lval $2)  }
+  | '$' var NAT                     { FactId (s $1 $3) (Just $ lval $2) (lval $3) }
+  | '[' seplist0(pattern,',') ']'   { Array (s $1 $3) $2 }
+  | '[' seplist__(pattern,',') '..' ']'  { ArrayPrefix (s $1 $4) (let (h:t) = $2 in h:|t) }
+  | '{' seplist2(pattern,',') '}'   { Tuple (s $1 $3) $2 }
+  | '{' seplist0_(field,',') '}'    { Struct (s $1 $3) $2 }
+  | '_'                             { Wildcard (sspan $1) }
+  | var                             { Variable (sspan $1) (lval $1) }
+  | lident                          { Enum (sspan $1) (lval $1) }
+  | 'never'                         { Never (sspan $1) }
+  | '(' query ')'                   { nestedQuery (s $1 $3) $2 }
+
+field :: { Field SrcSpan SrcSpan SourceRef SourceRef }
+field
+  : fieldname '=' pattern  { Field $1 $3 }
+
+var :: { Located Text }
+var
+  : qident { $1 }
+  | uident { $1 }
+
+lident :: { Located Text }
+lident : LIDENT  { fmap Text.decodeUtf8 $1 }
+
+uident :: { Located Text }
+uident : UIDENT  { fmap Text.decodeUtf8 $1 }
+
+qident :: { Located Text }
+qident : QIDENT  { fmap Text.decodeUtf8 $1 }
+
+UIDENT :: { Located ByteString }
+UIDENT : UIDENT_ { let L span (Token _ (T_UIdent val)) = $1 in L span val }
+
+LIDENT :: { Located ByteString }
+LIDENT : LIDENT_ { let L span (Token _ (T_LIdent val)) = $1 in L span val }
+
+QIDENT :: { Located ByteString }
+QIDENT : QIDENT_ { let L span (Token _ (T_QIdent val)) = $1 in L span val }
+
+STRING :: { Located Text }
+STRING : STRING_ { let L span (Token _ (T_StringLit val)) = $1 in L span val }
+
+SELECT :: { Located Text }
+SELECT : SELECT_ {
+  let L span (Token _ (T_Select val)) = $1 in
+  L span (Text.decodeUtf8 val) }
+
+SELECTALT :: { Located Text }
+SELECTLAT : SELECTALT_ {
+  let L span (Token _ (T_SelectAlt val)) = $1 in
+  L span (Text.decodeUtf8 val) }
+
+NAT :: { Located Word64 }
+NAT : NAT_ { let L span (Token _ (T_NatLit val)) = $1 in L span val }
+
+-- -----------------------------------------------------------------------------
+-- Schema
+
+schemas :: { [Either Schema.SourceEvolves Schema.SourceSchema] }
+schemas
+  : schemas schemadef { Right $2 : $1 }
+  | schemas evolves { Left $2 : $1 }
+  | {- empty -}  { [] }
+
+evolves :: { Schema.SourceEvolves }
+evolves
+  : 'schema' qname 'evolves' qname
+    { Schema.SourceEvolves (s $1 $4) (lval $2) (lval $4) }
+
+schemadef :: { Schema.SourceSchema }
+schemadef
+  : 'schema' qname inherit '{' list(schemadecl) '}'
+    { Schema.SourceSchema (lval $2) $3 (concat $5) (s $1 $6) }
+
+inherit :: { [SourceRef] }
+inherit
+  : ':' seplist_(qname, ',')  { map lval $2 }
+  | {- empty -}  { [] }
+
+schemadecl :: { [Schema.SourceDecl] }
+schemadecl
+  : 'import' qname  { [Schema.SourceImport (lval $2) (sspan $2)] }
+  | typedef  { [$1] }
+  | predicate  { $1 }
+  | derivedecl  { [$1] }
+
+predicate :: { [Schema.SourceDecl] }
+predicate
+  : 'predicate' predicatename ':' type optval maybe(deriving)
+    { let ref = parseRef $2 in
+      Schema.SourcePredicate Schema.PredicateDef
+        { predicateDefRef = ref
+        , predicateDefKeyType = lval $4
+        , predicateDefValueType = $5
+        , predicateDefDeriving = Schema.NoDeriving
+        , predicateDefSrcSpan = case $6 of
+            Just d -> s $1 d
+            _ -> s $1 $4 }
+        : case $6 of
+            Just d -> [Schema.SourceDeriving $ Schema.DerivingDef ref (lval d) (sspan d)]
+            Nothing -> []
+
+    }
+
+deriving :: { Located Schema.SourceDerivingInfo }
+deriving
+  : {- empty -} query { L (sspan $1) $ Schema.Derive Schema.DeriveOnDemand $1 }
+  | derivewhen query {L (s $1 $2) $  Schema.Derive (lval $1) $2 }
+
+derivewhen :: { Located Schema.DeriveWhen }
+derivewhen
+  : 'stored'  { L (sspan $1)  Schema.DerivedAndStored }
+  | 'default'  { % ifVersionOrOlder (AngleVersion 11) $1 (L (sspan $1) Schema.DeriveIfEmpty) }
+
+
+derivedecl :: { Schema.SourceDecl }
+derivedecl
+  : 'derive' qname deriving  { Schema.SourceDeriving
+    Schema.DerivingDef {
+      derivingDefRef = (lval $2)
+      , derivingDefDeriveInfo = lval $3
+      , derivingDefSrcSpan = s $1 $3 }
+    }
+
+optval :: { Schema.SourceType }
+optval
+  : {- empty -} { unit }
+  | '->' type { lval $2 }
+
+type :: { Located Schema.SourceType }
+type
+  : 'byte'                                  { L (sspan $1)   Schema.ByteTy }
+  | 'nat'                                   { L (sspan $1)   Schema.NatTy }
+  | 'string'                                { L (sspan $1)   Schema.StringTy }
+  | '[' type ']'                            { L (s $1 $3)  $ Schema.ArrayTy (lval $2) }
+  | '{' seplist0_(fielddef, ',') '}'        { L (s $1 $3)  $ Schema.RecordTy $2 }
+  | '{' fielddef '|' '}'                    { L (s $1 $4)  $ Schema.SumTy [$2] }
+  | '{' seplist2_(fielddef, '|')  '}'       { L (s $1 $3)  $ Schema.SumTy $2 }
+  | 'set' type                              { L (s $1 $2)  $ Schema.SetTy (lval $2) }
+  | 'enum' '{' seplist_(fieldname, '|') '}' { L (s $1 $4)  $ Schema.EnumeratedTy $3 }
+  | qname                                   { L (sspan $1) $ Schema.PredicateTy (sspan $1) (lval $1) }
+     -- resolved to typedef/predicate later
+  | 'maybe' type                            { L (s $1 $2)  $ Schema.MaybeTy (lval $2) }
+  | 'bool'                                  { L (sspan $1) $ Schema.BooleanTy }
+  | '(' type ')'                            { L (s $1 $3)  $ lval $2 }
+
+fielddef :: { Schema.SourceFieldDef }
+fielddef
+  : fieldname ':' type { Schema.FieldDef $1 (lval $3) }
+  | fieldname  { Schema.FieldDef $1 unit }
+
+predicatename :: { Name }
+predicatename
+  : fieldname { $1 }
+  | qident { lval $1 }
+
+-- Allow keywords to be used as fieldnames
+fieldname :: { Name }
+fieldname
+  : lident  { lval $1 }
+  | uident  { lval $1 } -- we want to deprecate this
+  | 'bool'  { "bool" }
+  | 'byte'  { "byte" }
+  | 'enum'  { "enum" }
+  | 'import'  { "import" }
+  | 'maybe'  { "maybe" }
+  | 'nat'  { "nat" }
+  | 'predicate'  { "predicate" }
+  | 'schema'  { "schema" }
+  | 'string'  { "string" }
+  | 'type'  { "type" }
+  | 'where'  { "where" }
+
+typedef :: { Schema.SourceDecl }
+typedef
+  : 'type' predicatename '=' type
+    { Schema.SourceType Schema.TypeDef
+        { typeDefRef = parseRef $2
+        , typeDefType = lval $4
+        , typeDefSrcSpan = s $1 $4 }
+    }
+
+qname :: { Located SourceRef }
+qname
+  : uident { fmap parseRef $1 }
+  | qident { fmap parseRef $1 }
+  | lident { fmap parseRef $1 } -- probably shouldn't be allowed
+
+-- -----------------------------------------------------------------------------
+-- Utils
+
+-- Optional item
+maybe(p)
+  : {- empty -}  { Nothing }
+  | p  { Just $1 }
+
+-- List with no separator
+list(p)
+  : {- empty -} { [] }
+  | p list(p) { $1 : $2 }
+
+-- List with no separator, >=1 elements
+list1(p)
+  : p  { [$1] }
+  | p list1(p) { $1 : $2 }
+
+-- List with a separator, >=1 elements
+seplist(p,sep)
+  : p sep seplist(p,sep) { $1 : $3 }
+  | p { [$1] }
+
+-- List with a separator, >=0 elements
+seplist0(p,sep)
+  : {- empty -} { [] }
+  | seplist(p,sep) { $1 }
+
+-- List with a separator, >=2 elements
+seplist2(p,sep)
+  : p sep seplist(p,sep) { $1 : $3 }
+
+-- List with a separator, >=1 elements, optional final separator
+seplist_(p,sep)
+  : p sep seplist_(p,sep) { $1 : $3 }
+  | p maybe(sep) { [$1] }
+
+-- List with a separator, >=0 elements, optional final separator
+seplist0_(p,sep)
+  : {- empty -} { [] }
+  | seplist_(p,sep) { $1 }
+
+-- List with a separator, >=2 elements, optional final separator
+seplist2_(p,sep)
+  : p sep seplist_(p,sep) { $1 : $3 }
+
+-- List with a separator, >=1 elements, mandatory final separator
+seplist__(p,sep)
+  : p sep seplist__(p,sep) { $1 : $3 }
+  | p sep { [$1] }
+
+-- List with a separator, >= 1 elements.
+-- The span of the elements is also returned.
+seplistSpan(p,sep)
+  : p sep seplistSpan(p,sep) { (sspan $1, $1) : $3 }
+  | p { [(sspan $1, $1)] }
+
+-- List with a separator, >=0 elements.
+-- The span of the elements is also returned.
+seplistSpan0(p,sep)
+  : {- empty -} { [] }
+  | seplistSpan(p,sep) { $1 }
+
+{
+parseQuery :: ByteString -> Either String SourceQuery
+parseQuery bs = runAlex (LB.fromStrict bs) $ query
+
+parseType :: ByteString -> Either String Schema.SourceType
+parseType bs = runAlex (LB.fromStrict bs) $ fmap lval type_
+
+parseQueryWithVersion
+  :: AngleVersion
+  -> ByteString
+  -> Either String SourceQuery
+parseQueryWithVersion ver bs =
+  runAlex (LB.fromStrict bs) (setVersion ver >> query)
+
+parseSchema :: ByteString -> Either String Schema.SourceSchemas
+parseSchema bs = parseSchemaWithVersion ver rest
+  where (ver, rest) = stripAngleVersion bs
+
+stripAngleVersion :: ByteString -> (AngleVersion, ByteString)
+stripAngleVersion bs
+  | Just bs1 <- B.stripPrefix "version: " (B.dropWhile isSpace bs)
+  , Just (ver, bs2) <- B.readInt bs1 = (Schema.AngleVersion ver, bs2)
+  | otherwise = (latestAngleVersion, bs)
+  -- if the header is omitted, assume we are using the latest version
+
+parseSchemaWithVersion
+  :: AngleVersion
+  -> ByteString
+  -> Either String Schema.SourceSchemas
+parseSchemaWithVersion ver bs =
+  runAlex (LB.fromStrict bs) $ do
+    setVersion ver
+    (srcEvolves, srcSchemas) <- partitionEithers <$> schema
+    return Schema.SourceSchemas
+      { srcAngleVersion = ver
+      , srcSchemas = reverse srcSchemas
+      , srcEvolves = reverse srcEvolves
+      }
+
+type P a = Alex a
+
+class HasSpan a where
+  sspan :: a -> SrcSpan
+instance HasSpan (Located a) where
+  sspan (L span _) = span
+instance HasSpan (SourcePat_ SrcSpan SrcSpan a b) where
+  sspan = sourcePatSpan
+instance HasSpan (SourceStatement_ SrcSpan SrcSpan p t) where
+  sspan (SourceStatement p1 p2) = s p1 p2
+instance HasSpan (SourceQuery_ SrcSpan SrcSpan p t) where
+  sspan (SourceQuery Nothing stmts _) = s (head stmts) (last stmts)
+  sspan (SourceQuery (Just pat) stmts _) = s pat (last stmts)
+
+s :: (HasSpan a, HasSpan b) => a -> b -> SrcSpan
+s from to = spanBetween (sspan from) (sspan to)
+
+-- | Located between two items
+lbetween :: Located a -> Located b -> c -> Located c
+lbetween (L from _) (L to _) = L (spanBetween from to)
+
+invalid :: SourcePat
+invalid = Nat invalidSrcSpan (fromIntegral iNVALID_ID)
+  where
+    invalidSrcSpan = SrcSpan invalidLoc invalidLoc
+    invalidLoc = SrcLoc (-1) (-1)
+
+parseError :: Located Token -> P a
+parseError (L (SrcSpan loc _) (Token b t)) = do
+  filename <- getFile
+  alexError $
+    show (pretty loc) <> "\n" <>
+    (if null filename then "" else filename <> ": ")
+    <> "parse error at: "
+    <> case t of
+      T_EOF -> "end of string"
+      _ -> LB.unpack b
+
+-- | Smart constructor for NestedQuery
+nestedQuery :: SrcSpan -> SourceQuery -> SourcePat
+nestedQuery _s (SourceQuery Nothing [SourceStatement (Wildcard _) pat] _) = pat
+nestedQuery s q = NestedQuery s q
+
+-- Accept older constructs for backwards-compability only when we're
+-- parsing the appropriate version(s) of the syntax.
+ifVersionOrOlder :: AngleVersion -> Located Token -> a -> Alex a
+ifVersionOrOlder v tok r = do
+  thisVer <- getVersion
+  when (thisVer > v) $ parseError tok
+  return r
+}
diff --git a/glean/hs/Glean/Angle/Types.hs b/glean/hs/Glean/Angle/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Angle/Types.hs
@@ -0,0 +1,1216 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DeriveFunctor #-}
+{-# LANGUAGE DeriveFoldable  #-}
+{-# LANGUAGE DeriveAnyClass  #-}
+{-# OPTIONS_GHC -Wno-orphans -Wno-star-is-type #-}
+
+-- | Types representing a source-level schema
+module Glean.Angle.Types
+  ( -- * Names and references
+    Name
+  , FieldName
+  , Version
+  , PredicateRef(..)
+  , TypeRef(..)
+  , PredicateId(..)
+  , tempPredicateId
+  , TypeId(..)
+
+  -- * Source locations
+  , IsSrcSpan(..)
+  , SrcSpan(..)
+  , SrcLoc(..)
+  , rmLocSchemas
+  , rmLocSchema
+  , rmLocEvolves
+  , rmLocDecl
+  , rmLocQuery
+  , rmLocStatement
+  , rmLocPat
+  , rmLocField
+  , rmLocTypeDef
+  , rmLocType
+  , rmLocPredDef
+  , rmTypeLocPredDef
+
+  -- * Types
+  , Type_(..)
+  , RecordOrSum(..)
+
+  -- * Queries
+  , SourceQuery_(..)
+  , Ordered(..)
+  , SourceStatement_(..)
+  , SourcePat_(..)
+  , PrimOp(..)
+  , SeekSection(..)
+
+  -- * Schemas and definitions
+  , DerivingDef_(..)
+  , TypeDef_(..)
+  , FieldDef_(..)
+  , PredicateDef_(..)
+  , Statement_
+  , Query_
+  , Type
+  , FieldDef
+  , TypeDef
+  , Field(..)
+  , IsWild(..)
+  , tupleField
+  , sourcePatSpan
+  , spanBetween
+  , PredicateDef
+  , DerivingInfo(..)
+  , DeriveWhen(..)
+  , SourceSchema
+  , SourceSchemas
+  , SourceEvolves
+  , SourceDecl
+  , SourceRef(..)
+  , SourceType
+  , SourceFieldDef
+  , SourceTypeDef
+  , SourcePredicateDef
+  , SourceDerivingInfo
+  , SourcePat
+  , SourceStatement
+  , SourceQuery
+  , SourcePat'
+  , SourceStatement'
+  , SourceQuery'
+  , SourceDerivingInfo'
+  , DerivingDef'
+  , SourceType'
+  , Type'
+  , FieldDef'
+  , PredicateDef'
+  , SourceSchemas_(..)
+  , SourceEvolves_(..)
+  , SourceSchema_(..)
+  , SourceDecl_(..)
+
+  -- * Versions of the Angle syntax
+  , AngleVersion(..)
+  , latestAngleVersion
+  , latestSupportedAngleVersion
+
+  -- * Pretty printing
+  , displayStatement
+
+  -- * Description
+  , Describe(..)
+  ) where
+
+import qualified Data.Aeson as Aeson
+import Data.Binary
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Lazy as BL
+import Data.Hashable
+import Data.List
+import Data.List.NonEmpty (NonEmpty, toList)
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Text (Text)
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter
+import Data.Bifunctor
+import Data.Bifoldable
+import GHC.Generics
+
+import Glean.Angle.Hash
+import Glean.Display
+import Glean.Types (PredicateRef(..), TypeRef(..), Version)
+
+
+-- -----------------------------------------------------------------------------
+-- Names and references
+
+type Name = Text
+
+type FieldName = Text
+
+-- | A reference to a name or type in a source schema. Versions are
+-- often omitted at this level, and will be later resolved by
+-- resolveSchema.
+data SourceRef = SourceRef
+  { sourceRefName :: Name
+  , sourceRefVersion :: Maybe Version
+  }
+  deriving (Show, Eq, Ord, Generic, Hashable)
+
+instance Binary SourceRef
+
+-- -----------------------------------------------------------------------------
+-- Source locations
+
+-- | A 'SrcSpan' delimits a portion of a text file.
+-- The end position is the column /after/ the end of the span.
+-- That is, a span of (1,1)-(1,2) is one character long, and a span of
+-- (1,1)-(1,1) is zero characters long.
+data SrcSpan = SrcSpan
+  { spanStart :: {-# UNPACK #-} !SrcLoc -- inclusive
+  , spanEnd   :: {-# UNPACK #-} !SrcLoc -- exclusive
+  }
+  deriving (Eq, Show)
+
+-- | A point in a source text file.
+data SrcLoc = SrcLoc
+  { locLine :: {-# UNPACK #-} !Int
+  , locCol  :: {-# UNPACK #-} !Int
+  }
+  deriving (Show, Eq)
+
+-- -----------------------------------------------------------------------------
+-- Queries
+
+data SourceQuery_ s st p t = SourceQuery
+  { srcQueryHead :: Maybe (SourcePat_ s st p t)
+  , srcQueryStmts :: [SourceStatement_ s st p t]
+  , srcQueryOrdered :: Ordered
+  }
+  deriving (Eq, Show, Generic, Functor)
+
+data Ordered = Ordered | Unordered
+  deriving (Eq, Show, Generic)
+
+instance Binary Ordered
+
+instance (Binary p, Binary t) => Binary (SourceQuery_ () () p t)
+
+instance Bifunctor (SourceQuery_ s st) where
+  bimap f g (SourceQuery h s o) =
+    SourceQuery (fmap (bimap f g) h) (fmap (bimap f g) s) o
+
+instance Bifoldable (SourceQuery_ s st ) where
+  bifoldMap f g (SourceQuery h s _) =
+    foldMap (bifoldMap f g) h <> foldMap (bifoldMap f g) s
+
+data SourceStatement_ s st p t =
+  SourceStatement (SourcePat_ s st p t) (SourcePat_ s st p t)
+  deriving (Eq, Show, Generic, Functor)
+
+instance (Binary p, Binary t) => Binary (SourceStatement_ () () p t)
+
+instance Bifunctor (SourceStatement_ s st) where
+  bimap f g (SourceStatement l r) = SourceStatement (bimap f g l) (bimap f g r)
+
+instance Bifoldable (SourceStatement_ s st) where
+  bifoldMap f g (SourceStatement l r) = bifoldMap f g l <> bifoldMap f g r
+
+data SourcePat_ s st p t
+  = Nat s Word64
+  | String s Text
+  | StringPrefix s Text
+  | ByteArray s ByteString
+    -- ^ There's no concrete syntax for this (yet), but it can be used
+    -- via the DSL.
+  | Array s [SourcePat_ s st p t]
+  | ArrayPrefix s (NonEmpty (SourcePat_ s st p t))
+  | Tuple s [SourcePat_ s st p t]
+  | Struct s [Field s st p t]
+  | App s (SourcePat_ s st p t) [SourcePat_ s st p t]
+  | KeyValue s (SourcePat_ s st p t) (SourcePat_ s st p t)
+  | Elements s (SourcePat_ s st p t)
+  | All s (SourcePat_ s st p t)
+  | Wildcard s
+  | Variable s Name
+  | ElementsOfArray s (SourcePat_ s st p t)
+  | OrPattern s (SourcePat_ s st p t) (SourcePat_ s st p t)
+  | NestedQuery s (SourceQuery_ s st p t)
+  | Negation s (SourcePat_ s st p t)
+  | FactId s (Maybe Text) Word64
+  | TypeSignature s (SourcePat_ s st p t) (Type_ st p t)
+  | Never s
+  | IfPattern
+      { span :: s
+      , cond :: SourcePat_ s st p t
+      , then_ :: SourcePat_ s st p t
+      , else_ :: SourcePat_ s st p t
+      }
+  | FieldSelect s (SourcePat_ s st p t) FieldName RecordOrSum
+  | Deref s (SourcePat_ s st p t)
+  | Enum s Text
+
+  -- The following forms are introduced by the resolver, and replace
+  -- the Variable and App forms produced by the parser.
+  | Clause s s p (SourcePat_ s st p t) SeekSection
+  | Prim s PrimOp [SourcePat_ s st p t]
+ deriving (Eq, Show, Generic, Functor)
+
+-- | Should a `seek` call be restricted to a section of the database?
+--
+-- When performing a query over a stacked database we have three levels
+--  * base db
+--  * stacked db
+--  * writable FactSet
+--
+-- The writable FactSet is there to store facts from derived predicates
+-- generated during the querying.
+--
+-- This type specifies which of these sections should be be covered in a seek.
+data SeekSection
+  = SeekOnAllFacts -- ^ base + stacked + writable
+  | SeekOnBase -- ^ base only
+  | SeekOnStacked -- ^ stacked only
+  deriving (Eq, Show, Generic)
+
+instance Binary SeekSection
+
+instance (Binary p, Binary t) => Binary (SourcePat_ () () p t)
+
+instance Bifunctor (SourcePat_ s st) where
+  bimap f g pat = case pat of
+    Nat s w -> Nat s w
+    String s t -> String s t
+    StringPrefix s t -> StringPrefix s t
+    ByteArray s t -> ByteArray s t
+    Array s pats -> Array s (fmap (bimap f g) pats)
+    ArrayPrefix s pats -> ArrayPrefix s (fmap (bimap f g) pats)
+    Tuple s pats -> Tuple s (map (bimap f g) pats)
+    Struct s fields -> Struct s (map (bimap f g) fields)
+    App s l r -> App s (bimap f g l) (map (bimap f g) r)
+    KeyValue s k v -> KeyValue s (bimap f g k) (bimap f g v)
+    Elements s pat -> Elements s (bimap f g pat)
+    All s query -> All s (bimap f g query)
+    Wildcard s -> Wildcard s
+    Variable s n -> Variable s n
+    ElementsOfArray s pat -> ElementsOfArray s (bimap f g pat)
+    OrPattern s l r -> OrPattern s (bimap f g l) (bimap f g r)
+    NestedQuery s (SourceQuery head stmts ord) ->
+      NestedQuery s (SourceQuery (fmap (bimap f g) head)
+        (fmap (bimap f g) stmts) ord)
+    Negation s pat -> Negation s (bimap f g pat)
+    FactId s n w -> FactId s n w
+    TypeSignature s pat ty -> TypeSignature s (bimap f g pat) (bimap f g ty)
+    Never s -> Never s
+    IfPattern s a b c -> IfPattern s (bimap f g a) (bimap f g b) (bimap f g c)
+    FieldSelect s pat field q -> FieldSelect s (bimap f g pat) field q
+    Deref s pat -> Deref s (bimap f g pat)
+    Enum s f -> Enum s f
+    Clause sPat sPred p pat rng -> Clause sPat sPred (f p) (bimap f g pat) rng
+    Prim s p pats -> Prim s p (fmap (bimap f g) pats)
+
+instance Bifoldable (SourcePat_ s st) where
+  bifoldMap f g = \case
+    Nat{} -> mempty
+    String{} -> mempty
+    StringPrefix{} -> mempty
+    ByteArray{} -> mempty
+    Array _ pats -> foldMap (bifoldMap f g) pats
+    ArrayPrefix _ pats -> foldMap (bifoldMap f g) pats
+    Tuple _ pats -> foldMap (bifoldMap f g) pats
+    Struct _ fields -> foldMap (bifoldMap f g) fields
+    App _ l r -> foldMap (bifoldMap f g) (l:r)
+    KeyValue _ k v -> bifoldMap f g k <> bifoldMap f g v
+    Elements _ pat -> bifoldMap f g pat
+    All _ query -> bifoldMap f g query
+    Wildcard{} -> mempty
+    Variable{} -> mempty
+    ElementsOfArray _ pat -> bifoldMap f g pat
+    OrPattern _ l r -> bifoldMap f g l <> bifoldMap f g r
+    NestedQuery _ (SourceQuery head stmts _) ->
+      foldMap (bifoldMap f g) head <> foldMap (bifoldMap f g) stmts
+    Negation _ pat -> bifoldMap f g pat
+    FactId{} -> mempty
+    TypeSignature _ pat ty -> bifoldMap f g pat <> bifoldMap f g ty
+    Never{} -> mempty
+    IfPattern _ a b c -> bifoldMap f g a <> bifoldMap f g b <> bifoldMap f g c
+    FieldSelect _ pat _ _ -> bifoldMap f g pat
+    Deref _ pat -> bifoldMap f g pat
+    Enum _ _ -> mempty
+    Clause _ _ p pat _ -> f p <> bifoldMap f g pat
+    Prim _ _ pats -> foldMap (bifoldMap f g) pats
+
+data Field s st p t = Field FieldName (SourcePat_ s st p t)
+  deriving (Eq, Show, Generic, Functor)
+
+instance (Binary p, Binary t) => Binary (Field () () p t)
+
+instance Bifunctor (Field s st) where
+  bimap f g (Field n pat) = Field n (bimap f g pat)
+
+instance Bifoldable (Field s st) where
+  bifoldMap f g (Field _ pat) = bifoldMap f g pat
+
+-- | Primitive operations
+data PrimOp
+  = PrimOpToLower
+  | PrimOpLength
+  | PrimOpZip
+  | PrimOpConcat
+  | PrimOpReverse
+  | PrimOpSize
+  | PrimOpRelToAbsByteSpans
+  | PrimOpUnpackByteSpans
+  | PrimOpGtNat
+  | PrimOpGeNat
+  | PrimOpLtNat
+  | PrimOpLeNat
+  | PrimOpNeNat
+  | PrimOpAddNat
+  | PrimOpNeExpr
+  deriving (Eq, Show, Generic)
+
+instance Binary PrimOp
+
+sourcePatSpan :: SourcePat_ s st p t -> s
+sourcePatSpan = \case
+  Nat s _ -> s
+  String s _ -> s
+  StringPrefix s _ -> s
+  ByteArray s _ -> s
+  Array s _ -> s
+  ArrayPrefix s _ -> s
+  Tuple s _ -> s
+  Struct s _ -> s
+  App s _ _ -> s
+  KeyValue s _ _ -> s
+  Elements s _ -> s
+  All s _ -> s
+  Wildcard s -> s
+  Variable s _ -> s
+  ElementsOfArray s _ -> s
+  OrPattern s _ _ -> s
+  IfPattern s _ _ _ -> s
+  NestedQuery s _ -> s
+  Negation s _ -> s
+  FactId s _ _ -> s
+  TypeSignature s _ _ -> s
+  Never s -> s
+  FieldSelect s _ _ _ -> s
+  Deref s _ -> s
+  Enum s _ -> s
+  Clause s _ _ _ _ -> s
+  Prim s _ _ -> s
+
+-- -----------------------------------------------------------------------------
+-- Types
+
+-- | A Glean Type
+data Type_ srcspan pref tref
+  -- Native types
+  = ByteTy
+  | NatTy
+  | StringTy
+  | ArrayTy (Type_ srcspan pref tref)
+  | RecordTy [FieldDef_ srcspan pref tref]
+  | SumTy [FieldDef_ srcspan pref tref]
+  | SetTy (Type_ srcspan pref tref)
+  | PredicateTy srcspan pref
+  | NamedTy srcspan tref
+
+  -- Derived types. These appear in the source language, but are
+  -- translated into the native types above internally. They also
+  -- act as hints to the code generators, e.g. maybe translates to
+  -- Thrift's optional and enum translates to Thrift's enum.
+  | MaybeTy (Type_ srcspan pref tref)
+    -- maybe T  => { nothing | just : T }
+  | EnumeratedTy [Name]
+    -- enum { a | b } => { a : {}, b : {} }
+  | BooleanTy
+    -- bool => { false : {} | true : {} }
+
+  -- These are used during typechecking only
+  | TyVar {-# UNPACK #-}!Int
+  | HasTy (Map Name (Type_ srcspan pref tref))
+      !(Maybe RecordOrSum) {-# UNPACK #-}!Int
+    -- HasTy { field:type .. } R X
+    --   Constrains X to be a record or sum type containing at least
+    --   the given fields/types. X can only be instantiated
+    --   with a type containing a superset of those fields: either
+    --   a bigger HasTy or a RecordTy/SumTy.
+    --   R is
+    --     Just Record -> type must be a record
+    --     Just Sum -> type must be a sum type
+    --     Nothing -> type can be either a RecordTy or a SumTy
+  | HasKey (Type_ srcspan pref tref) {-# UNPACK #-}!Int
+    -- HasKey K X
+    --   A type variable X that is constrained to be a predicate
+    --   type with key K
+  | ElementsOf (Type_ srcspan pref tref) {-# UNPACK #-}!Int
+    -- ElementsOf T X
+    --   A type variable that is either set T or [T]
+  deriving (Eq, Show, Functor, Foldable, Generic)
+
+data RecordOrSum = Record | Sum
+  deriving (Eq, Show, Generic)
+
+instance Binary RecordOrSum
+
+instance (Binary pref, Binary tref) => Binary (Type_ () pref tref)
+
+instance Bifunctor (Type_ s) where
+  bimap f g = \case
+    ByteTy -> ByteTy
+    NatTy -> NatTy
+    StringTy -> StringTy
+    ArrayTy ty -> ArrayTy $ bimap f g ty
+    RecordTy xs -> RecordTy $ bimap f g <$> xs
+    SumTy xs -> SumTy $ bimap f g <$> xs
+    SetTy ty -> SetTy $ bimap f g ty
+    PredicateTy s pref -> PredicateTy s (f pref)
+    NamedTy s tref -> NamedTy s (g tref)
+    MaybeTy ty -> MaybeTy (bimap f g ty)
+    EnumeratedTy xs -> EnumeratedTy xs
+    BooleanTy -> BooleanTy
+    TyVar x -> TyVar x
+    HasTy m r x -> HasTy (bimap f g <$> m) r x
+    HasKey ty x -> HasKey (bimap f g ty) x
+    ElementsOf ty x -> ElementsOf (bimap f g ty) x
+
+instance Bifoldable (Type_ s) where
+  bifoldr f g r = \case
+    ByteTy -> r
+    NatTy -> r
+    StringTy -> r
+    ArrayTy ty -> bifoldr f g r ty
+    RecordTy xs -> foldr (flip $ bifoldr f g) r xs
+    SumTy xs -> foldr (flip $ bifoldr f g) r xs
+    SetTy ty -> bifoldr f g r ty
+    PredicateTy _ pref -> f pref r
+    NamedTy _ tref -> g tref r
+    MaybeTy ty -> bifoldr f g r ty
+    EnumeratedTy _ -> r
+    BooleanTy -> r
+    TyVar _ -> r
+    HasTy m _ _ -> foldr (flip $ bifoldr f g) r m
+    HasKey ty _ -> bifoldr f g r ty
+    ElementsOf ty _ -> bifoldr f g r ty
+
+{- Note [Types]
+
+There are three main instantiations of `Type_` used throughout
+Glean:
+
+> type SourceType = Type_ SourceRef SourceRef
+
+These are the types from the parser. Predicates and types may be
+unqualified and don't necessarily have versions.
+
+> type Type = Type_ PredicateId TypeId
+
+These are the types after name resolution
+(Glean.Schema.Resolve). Predicates and Types are fully qualified and
+refer to specific hashes.
+
+> type RTS.Type = Type_ PidRef ExpandedType
+
+(see 'Glean.RTS.Type')
+
+These are the types that relate to a particular DB, and are
+constructed when a schema is loaded in `Glean.Database.Schema`.
+
+* Predicates have a particular 'Pid'
+* Named types are expanded (but we can still see them in the AST)
+* A 'RTS.Type' can be converted into a pure representation ('Rep')
+  using 'repType'
+-}
+
+-- -----------------------------------------------------------------------------
+-- Schemas and definitions
+
+data FieldDef_ st pref tref = FieldDef
+  { fieldDefName :: Name
+  , fieldDefType :: Type_ st pref tref
+  }
+  deriving (Eq, Show, Functor, Foldable, Generic)
+
+instance (Binary pref, Binary tref)
+  => Binary (FieldDef_ () pref tref)
+
+instance Bifunctor (FieldDef_ st) where
+  bimap f g (FieldDef n ty)  = FieldDef n $ bimap f g ty
+
+instance Bifoldable (FieldDef_ st) where
+  bifoldMap f g (FieldDef _ ty) = bifoldMap f g ty
+
+tupleField :: Text
+tupleField = "tuplefield"
+
+-- | A definition of a named type
+data TypeDef_ st pref tref = TypeDef
+  { typeDefRef :: tref
+  , typeDefType :: Type_ st pref tref
+  , typeDefSrcSpan :: st
+  }
+  deriving Eq
+
+-- | A definition of a predicate
+data PredicateDef_ s st pref tref = PredicateDef
+  { predicateDefRef :: pref
+  , predicateDefKeyType :: Type_ st pref tref
+  , predicateDefValueType :: Type_ st pref tref
+  , predicateDefDeriving :: DerivingInfo (SourceQuery_ s st pref tref)
+  , predicateDefSrcSpan :: s
+  }
+  deriving Eq
+
+data DerivingDef_ s st pref tref = DerivingDef
+  { derivingDefRef :: pref
+  , derivingDefDeriveInfo :: DerivingInfo (SourceQuery_ s st pref tref)
+  , derivingDefSrcSpan :: s
+  }
+  deriving Eq
+
+-- | Globally unique identifier for a predicate. This is not the same
+-- as a Pid, which is unique only within a particular DB.
+data PredicateId = PredicateId
+  { predicateIdRef :: PredicateRef  -- ^ e.g. python.Name.1
+  , predicateIdHash :: {-# UNPACK #-} !Hash
+  } deriving (Ord, Generic, Show)
+
+instance Hashable PredicateId where
+  hashWithSalt s (PredicateId _ h) = hashFingerprint s h
+
+instance Eq PredicateId where
+  PredicateId _ a == PredicateId _ b = a == b
+
+instance Binary PredicateRef where
+  put (PredicateRef a b) = put a >> put b
+  get = PredicateRef <$> get <*> get
+
+instance Binary PredicateId
+  -- TODO maybe just serialize the hash?
+
+-- | Globally unique identifier for a type.
+data TypeId = TypeId
+  { typeIdRef :: TypeRef -- ^ e.g. python.Declaration.1
+  , typeIdHash :: {-# UNPACK #-} !Hash
+  } deriving (Ord, Generic, Show)
+
+instance Hashable TypeId where
+  hashWithSalt s (TypeId _ h) = hashFingerprint s h
+
+instance Eq TypeId where
+  TypeId _ a == TypeId _ b = a == b
+
+-- Used by query compilation
+tempPredicateId :: PredicateId
+tempPredicateId = PredicateId (PredicateRef "_tmp_" 0) hash0
+
+instance Binary TypeRef where
+  put (TypeRef a b) = put a >> put b
+  get = TypeRef <$> get <*> get
+
+instance Binary TypeId
+  -- TODO maybe just serialize the hash?
+
+-- | How to derive a predicate
+data DerivingInfo q
+  = NoDeriving
+  | Derive DeriveWhen q
+  deriving (Eq, Functor, Foldable, Show, Generic)
+
+instance Binary q => Binary (DerivingInfo q)
+
+data DeriveWhen
+  = DeriveOnDemand
+    -- ^ derived whenever this predicate is queried. Facts of this
+    -- predicate are not expected to be stored in the DB.
+  | DerivedAndStored
+    -- ^ derived eagerly and stored in the DB. By default, queries for
+    -- this predicate will search the DB, just like underived
+    -- predicates.
+  | DeriveIfEmpty
+    -- ^ derived only when the DB has no facts of this predicate.
+    -- This is used to add derivations for backwards compatibility
+    -- during a schema migration.
+  deriving (Eq, Show, Generic)
+
+instance Binary DeriveWhen
+
+-- Source (parsed) abstract syntax
+
+type SourcePat' s st = SourcePat_ s st SourceRef SourceRef
+type SourceStatement' s st = SourceStatement_ s st SourceRef SourceRef
+type SourceQuery' s st = SourceQuery_ s st SourceRef SourceRef
+type SourceDerivingInfo' s = DerivingInfo (SourceQuery' s s)
+type SourcePredicateDef' s = PredicateDef_ s s SourceRef SourceRef
+type SourceTypeDef' s = TypeDef_ s SourceRef SourceRef
+type DerivingDef' s = DerivingDef_ s s SourceRef SourceRef
+type SourceType' st = Type_ st SourceRef SourceRef
+type Type' st = Type_ st PredicateId TypeId
+
+type SourcePat = SourcePat' SrcSpan SrcSpan
+type SourceStatement = SourceStatement' SrcSpan SrcSpan
+type SourceQuery = SourceQuery' SrcSpan SrcSpan
+type SourceType = Type_ SrcSpan SourceRef SourceRef
+type SourceFieldDef = FieldDef_ SrcSpan SourceRef SourceRef
+type SourceTypeDef = TypeDef_ SrcSpan SourceRef SourceRef
+type SourcePredicateDef = SourcePredicateDef' SrcSpan
+type SourceDerivingInfo = SourceDerivingInfo' SrcSpan
+type SourceSchemas = SourceSchemas_ SrcSpan
+type SourceSchema = SourceSchema_ SrcSpan
+type SourceEvolves = SourceEvolves_ SrcSpan
+type SourceDecl = SourceDecl_ SrcSpan
+
+type Statement_ p t = SourceStatement_ SrcSpan SrcSpan p t
+type Query_ p t = SourceQuery_ SrcSpan SrcSpan p t
+
+data SourceEvolves_ s = SourceEvolves
+  { evolvesSpan :: s
+  , evolvesNew :: SourceRef
+  , evolvesOld :: SourceRef
+  }
+  deriving (Eq)
+
+-- | A 'schema' declaration
+data SourceSchema_ s = SourceSchema
+  { schemaName :: SourceRef
+  , schemaInherits :: [SourceRef]
+  , schemaDecls :: [SourceDecl_ s]
+  , schemaSrcSpan :: s
+  }
+  deriving (Eq)
+
+data SourceSchemas_ s = SourceSchemas
+  { srcAngleVersion :: AngleVersion
+  , srcSchemas :: [SourceSchema_ s]
+  , srcEvolves :: [SourceEvolves_ s]
+  }
+  deriving (Eq)
+
+data SourceDecl_ s
+  = SourceImport SourceRef s
+  | SourcePredicate (SourcePredicateDef' s)
+  | SourceType (SourceTypeDef' s)
+  | SourceDeriving (DerivingDef' s)
+  deriving (Eq)
+
+-- Abstract syntax with global Ids
+
+type Type = Type_ SrcSpan PredicateId TypeId
+type FieldDef = FieldDef_ SrcSpan PredicateId TypeId
+type TypeDef = TypeDef_ SrcSpan PredicateId TypeId
+type PredicateDef = PredicateDef_ SrcSpan SrcSpan PredicateId TypeId
+
+type PredicateDef' s st = PredicateDef_ s st PredicateId TypeId
+type FieldDef' st = FieldDef_ st PredicateId TypeId
+
+-- -----------------------------------------------------------------------------
+
+-- | Version of the syntax. This is required so that we can change the
+-- syntax while still allowing DBs that contain a schema with the old
+-- syntax to be understood.
+newtype AngleVersion = AngleVersion Int
+  deriving (Eq, Ord)
+  deriving newtype (Pretty)
+
+-- version 8:
+--   - added set constructs
+-- version 9:
+--   - added dot syntax
+-- version 10:
+--   - optional versions in `import`, `evolves`, inheritance
+-- version 11:
+--   - size primop
+-- version 12:
+--   - remove support for deriving default
+
+latestSupportedAngleVersion :: AngleVersion
+latestSupportedAngleVersion = AngleVersion 5
+
+latestAngleVersion :: AngleVersion
+latestAngleVersion = AngleVersion 12
+
+-- -----------------------------------------------------------------------------
+-- Pretty-printing
+
+instance Display SourceRef where
+  display _ (SourceRef name ver) = pretty name <> case ver of
+    Nothing -> mempty
+    Just ver -> "." <> pretty ver
+
+instance Display PredicateRef where
+  display _ = pretty
+
+instance Display TypeRef where
+  display _ = pretty
+
+instance Display PredicateId where
+  display opts (PredicateId name hash) =
+    case predicateStyle opts of
+      PredicateWithHash -> pretty name <> "." <> pretty (show hash)
+      PredicateWithoutHash -> pretty name
+
+instance Display TypeId where
+  display opts (TypeId name hash) =
+    case predicateStyle opts of
+      PredicateWithHash -> pretty name <> "." <> pretty (show hash)
+      PredicateWithoutHash -> pretty name
+
+instance Display (SourceEvolves_ s) where
+  display opts (SourceEvolves _ new old) =
+    "schema " <> display opts new <> " evolves " <> display opts old
+
+instance (Display pref, Display tref) => Display (Type_ st pref tref) where
+  display _ ByteTy = "byte"
+  display _ NatTy = "nat"
+  display _ StringTy = "string"
+  display opts (ArrayTy ty) = "[" <> display opts ty <> "]"
+  display opts (RecordTy fields) =
+    sep
+      [ nest 2 $ vsep $ "{" :  punctuate "," (map (display opts) fields)
+      , "}" ]
+  display opts (SumTy fields) =
+    sep
+      [ nest 2 $ vsep $ "{" :  map ((<> " |") . display opts) fields
+      , "}" ]
+  display opts (SetTy ty) = "set " <> displayAtom opts ty
+  display opts (PredicateTy _ p) = display opts p
+  display opts (NamedTy _ t) = display opts t
+  display opts (MaybeTy t) = "maybe" <+> displayAtom opts t
+  display _ (EnumeratedTy names) =
+    sep
+      [ nest 2 $ vsep $ "enum {" :  map (<> " |") (map pretty names)
+      , "}" ]
+  display _ BooleanTy = "bool"
+  display _ (TyVar n) = "T" <> pretty n
+  display opts (HasTy m rec x)
+    | Just Sum <- rec =
+    sep
+      [ nest 2 $ vsep $ "{" :  intersperse "|" (map doField (Map.toList m))
+      , "|", "T" <> pretty x, "}" ]
+    | otherwise =
+    sep
+      [ nest 2 $ vsep $ "{" :  map (<> ",") (map doField (Map.toList m))
+      , "T" <> pretty x, "}" ]
+    where
+    doField (n, ty) = pretty n <> " : " <> display opts ty
+  display opts (HasKey ty x) =
+    "T" <> pretty x <> parens (display opts ty)
+  display opts (ElementsOf ty x) =
+    "T" <> pretty x <> brackets (display opts ty)
+  displayAtom opts t = case t of
+    MaybeTy{} -> parens $ display opts t
+    EnumeratedTy{} -> parens $ display opts t
+    SetTy{} -> parens $ display opts t
+    _other -> display opts t
+
+instance (Display pref, Display tref) => Display (FieldDef_ st pref tref) where
+  display opts (FieldDef n ty) = pretty n <> " : " <> displayAtom opts ty
+
+instance (Display pref, Display tref) =>
+    Display (PredicateDef_ s st pref tref) where
+  display opts PredicateDef{..} =
+    hang 2 $ sep $
+      [ "predicate" <+> display opts predicateDefRef <+> ":"
+      , display opts predicateDefKeyType
+      ] ++
+      (case predicateDefValueType of
+         RecordTy [] -> []
+         _other -> [ "->" <+> display opts predicateDefValueType ]) ++
+      (case predicateDefDeriving of
+         Derive DerivedAndStored query -> [ "stored", display opts query ]
+         Derive _ query -> [ display opts query ]
+         _other -> [])
+
+instance (Display pref, Display tref) => Display (TypeDef_ s pref tref) where
+  display opts TypeDef{..} =
+    hang 2 $ sep
+      [ "type" <+> display opts typeDefRef <+> "="
+      , display opts typeDefType
+      ]
+
+instance Display SourceSchemas where
+  display opts SourceSchemas{..} = vcat $
+    ("version:" <+> pretty srcAngleVersion)
+    : map (display opts) srcSchemas <> map (display opts) srcEvolves
+
+instance Display SourceSchema where
+  display opts SourceSchema{..} = vcat
+    [ "schema" <+> display opts schemaName <>
+        case schemaInherits of
+          [] -> mempty
+          _ -> " : " <> hcat (punctuate "," (map (display opts) schemaInherits))
+        <> " {"
+    , vcat (map (display opts) schemaDecls)
+    , "}"
+    ]
+
+instance Display SourceDecl where
+  display opts (SourceImport name _) = "import " <> display opts name
+  display opts (SourcePredicate def) = display opts def
+  display opts (SourceType def) = display opts def
+  display opts (SourceDeriving DerivingDef{..}) =
+    hang 2 $ sep ["derive "
+      <> display opts derivingDefRef, display opts derivingDefDeriveInfo]
+
+instance Display q => Display (DerivingInfo q) where
+  display _ NoDeriving = mempty
+  display opts (Derive DeriveOnDemand q) = display opts q
+  display opts (Derive DerivedAndStored q) = "stored" <+> display opts q
+  display opts (Derive DeriveIfEmpty q) = "default" <+> display opts q
+
+-- ---------------------------------------------------------------------------
+-- Display printing queries
+
+class IsWild pat where
+  isWild :: pat -> Bool
+
+instance IsWild (SourcePat_ s st p t) where
+  isWild Wildcard{} = True
+  isWild _ = False
+
+-- | Types that represent the source location of a term in the AST
+class (Pretty a, Pretty (Loc a)) => IsSrcSpan a where
+  type Loc a :: *
+  startLoc   :: a -> Loc a
+  endLoc     :: a -> Loc a
+  mkSpan     :: Loc a -> Loc a -> a
+
+-- space encompassing from start of first span to end of second.
+spanBetween :: IsSrcSpan a => a -> a-> a
+spanBetween x y = mkSpan (startLoc x) (endLoc y)
+
+instance IsSrcSpan SrcSpan where
+  type Loc SrcSpan = SrcLoc
+  startLoc = spanStart
+  endLoc = spanEnd
+  mkSpan = SrcSpan
+
+instance Display SrcSpan where
+  display opts s =
+    display opts (spanStart s)
+    <> pretty (" - " :: String)
+    <> display opts (spanEnd s)
+
+instance Pretty SrcSpan where
+  pretty = displayDefault
+
+instance Display SrcLoc where
+  display _ (SrcLoc line col) =
+    "line " <> pretty line <> ", column " <> pretty col
+
+instance Pretty SrcLoc where
+  pretty = displayDefault
+
+instance (Display p, Display t) => Pretty (SourcePat_ s st p t) where
+  pretty = displayDefault
+
+instance (Display p, Display t) => Display (SourcePat_ s st p t) where
+  display _ (Nat _ w) = pretty w
+  display _ (String _ str) =
+    pretty (Text.decodeUtf8 (BL.toStrict (Aeson.encode (Aeson.String str))))
+  display opts (StringPrefix s str) =
+    display opts (String s str :: SourcePat_ s st p t) <> ".."
+  display _ (ByteArray _ b) = pretty (show b)
+  display opts (Array _ pats) =
+    brackets $ hsep (punctuate "," (map (display opts) pats))
+  display opts (ArrayPrefix _ pats) =
+    encloseSep "[" ", ..]" "," (map (display opts) $ toList pats)
+  display opts (Tuple _ pats) =
+    braces $ hsep (punctuate "," (map (display opts) pats))
+  display opts (Struct _ fs) = cat [ nest 2 $ cat [ "{", fields fs], "}"]
+    where
+    fields = sep . punctuate "," . map field
+    field (Field name pat) = pretty name <+> "=" <+> display opts pat
+  display opts (App _ l pats) =
+    display opts l <+> hsep (punctuate " " (map (displayAtom opts) pats))
+  display opts (KeyValue _ k v) =
+    displayAtom opts k <+> "->" <+> displayAtom opts v
+  display opts (Elements _ pat) =
+    "elements" <+> parens (display opts pat)
+  display opts (All _ query) =
+    "all" <+> parens (display opts query)
+  display _ (Wildcard _) = "_"
+  display _ (Variable _ name) = pretty name
+  display opts (ElementsOfArray _ pat) = displayAtom opts pat <> "[..]"
+  display opts (OrPattern _ lhs rhs) =
+    sep [displayAtom opts lhs <+> "|", displayAtom opts rhs]
+  display opts (IfPattern _ cond then_ else_) = sep
+    [ nest 2 $ sep ["if", displayAtom opts cond ]
+    , nest 2 $ sep ["then", displayAtom opts then_]
+    , nest 2 $ sep ["else", displayAtom opts else_]
+    ]
+  display opts (NestedQuery _ q) = parens $ display opts q
+  display opts (Negation _ q) = "!" <> parens (display opts q)
+  display _ (FactId _ Nothing n) = "$" <> pretty n
+  display _ (FactId _ (Just p) n) = "$" <> pretty p <+> pretty n
+  display opts (TypeSignature _ p t) =
+    displayAtom opts p <+> ":" <+> display opts t
+  display _ (Never _) = "never"
+  display opts (Clause _ _ p pat rng) =
+    display opts p <> prng <+> displayAtom opts pat
+    where prng = case rng of
+            SeekOnBase -> "#old"
+            SeekOnStacked -> "#new"
+            _ -> mempty
+  display opts (Prim _ p pats) =
+    display opts p <+> hsep (punctuate " " (map (displayAtom opts) pats))
+  display opts (FieldSelect _ pat field q) =
+    displayAtom opts pat <> "." <> pretty field <>
+      case q of
+        Sum -> "?"
+        Record -> mempty
+  display opts (Deref _ pat) =
+    displayAtom opts pat <> ".*"
+  display _ (Enum _ f) = pretty f
+
+  displayAtom opts pat = case pat of
+    App{} -> parens $ display opts pat
+    KeyValue{} -> parens $ display opts pat
+    OrPattern{} -> parens $ display opts pat
+    IfPattern{} -> parens $ display opts pat
+    TypeSignature{} -> parens $ display opts pat
+    Nat{} -> display opts pat
+    String{} -> display opts pat
+    StringPrefix{} -> display opts pat
+    ByteArray{} -> display opts pat
+    Array{} -> display opts pat
+    ArrayPrefix{} -> display opts pat
+    Tuple{} -> display opts pat
+    Struct{} -> display opts pat
+    ElementsOfArray{} -> parens $ display opts pat
+    Elements{} -> display opts pat
+    All{} -> parens $ display opts pat
+    Wildcard{} -> display opts pat
+    Variable{} -> display opts pat
+    NestedQuery{} -> display opts pat
+    Negation{} -> display opts pat
+    FactId{} -> display opts pat
+    Never{} -> display opts pat
+    Clause{} -> parens $ display opts pat
+    Prim{} -> parens $ display opts pat
+    FieldSelect{} -> display opts pat
+    Deref{} -> display opts pat
+    Enum _ _ -> display opts pat
+
+instance (Display p, Display t) => Display (SourceQuery_ s st p t) where
+  display opts (SourceQuery maybeHead stmts _ord) = case stmts of
+    [] -> maybe mempty (display opts) maybeHead
+    _ -> case maybeHead of
+      Just head -> hang 2 (sep (display opts head <+> "where" : pstmts))
+      Nothing -> sep pstmts
+    where
+    pstmts = punctuate ";" (map (display opts) stmts)
+
+instance (Display p, Display t) => Display (SourceStatement_ s st p t) where
+  display opts (SourceStatement lhs rhs) = displayStatement opts lhs rhs
+
+displayStatement
+  :: (IsWild pat, Display pat)
+  => DisplayOpts
+  -> pat
+  -> pat
+  -> Doc ann
+displayStatement opts lhs rhs
+  | isWild lhs = display opts rhs
+  | otherwise = hang 2 $ sep [display opts lhs <+> "=", display opts rhs]
+
+instance Display PrimOp where
+  display _ PrimOpToLower = "prim.toLower"
+  display _ PrimOpLength = "prim.length"
+  display _ PrimOpZip = "prim.zip"
+  display _ PrimOpConcat = "prim.concat"
+  display _ PrimOpReverse = "prim.reverse"
+  display _ PrimOpSize = "prim.size"
+  display _ PrimOpRelToAbsByteSpans = "prim.relToAbsByteSpans"
+  display _ PrimOpUnpackByteSpans = "prim.unpackByteSpans"
+  display _ PrimOpGtNat = "prim.gtNat"
+  display _ PrimOpGeNat = "prim.geNat"
+  display _ PrimOpLtNat = "prim.ltNat"
+  display _ PrimOpLeNat = "prim.leNat"
+  display _ PrimOpNeNat = "prim.neNat"
+  display _ PrimOpAddNat = "prim.addNat"
+  display _ PrimOpNeExpr = "prim.neExpr"
+
+-- -----------------------------------------------------------------------------
+-- Removing source locations from the AST
+
+rmLocSchemas :: SourceSchemas_ a -> SourceSchemas_ ()
+rmLocSchemas (SourceSchemas version schemas evolves) =
+  SourceSchemas version (rmLocSchema <$> schemas) (rmLocEvolves <$> evolves)
+
+rmLocSchema :: SourceSchema_ a -> SourceSchema_ ()
+rmLocSchema (SourceSchema name inherits decls _) =
+  SourceSchema name inherits (rmLocDecl <$> decls) ()
+
+rmLocEvolves :: SourceEvolves_ a -> SourceEvolves_ ()
+rmLocEvolves (SourceEvolves _ a b) = SourceEvolves () a b
+
+rmLocDecl :: SourceDecl_ s -> SourceDecl_ ()
+rmLocDecl = \case
+  SourceImport name _ -> SourceImport name ()
+  SourcePredicate pred -> SourcePredicate $ rmLocPredDef pred
+  SourceType typeDef -> SourceType $ rmLocTypeDef typeDef
+  SourceDeriving DerivingDef{..} -> SourceDeriving $ DerivingDef
+    derivingDefRef (rmLocQuery <$> derivingDefDeriveInfo) ()
+
+rmLocPredDef :: PredicateDef_ s st p t -> PredicateDef_ () () p t
+rmLocPredDef PredicateDef{..} = PredicateDef {
+  predicateDefRef = predicateDefRef,
+  predicateDefKeyType = rmLocType predicateDefKeyType,
+  predicateDefValueType = rmLocType predicateDefValueType,
+  predicateDefDeriving = rmLocQuery <$> predicateDefDeriving,
+  predicateDefSrcSpan = ()
+}
+
+rmLocQuery :: SourceQuery_ s st p t -> SourceQuery_ () () p t
+rmLocQuery (SourceQuery mhead stmts ord) =
+  SourceQuery (rmLocPat <$> mhead) (rmLocStatement <$> stmts) ord
+
+rmLocStatement :: SourceStatement_ s st p t -> SourceStatement_ () () p t
+rmLocStatement (SourceStatement x y) =
+  SourceStatement (rmLocPat x) (rmLocPat y)
+
+rmLocTypeDef :: TypeDef_ s p t -> TypeDef_ () p t
+rmLocTypeDef (TypeDef tref ty _) = TypeDef tref (rmLocType ty) ()
+
+rmLocType :: Type_ st p t -> Type_ () p t
+rmLocType = \case
+  ByteTy -> ByteTy
+  NatTy -> NatTy
+  StringTy -> StringTy
+  ArrayTy ty -> ArrayTy $ rmLocType ty
+  RecordTy xs -> RecordTy $ rmLocFieldDef <$> xs
+  SumTy xs -> SumTy $ rmLocFieldDef <$> xs
+  SetTy ty -> SetTy $ rmLocType ty
+  PredicateTy _ pref -> PredicateTy () pref
+  NamedTy _ tref -> NamedTy () tref
+  MaybeTy ty -> MaybeTy $ rmLocType ty
+  EnumeratedTy xs -> EnumeratedTy xs
+  BooleanTy -> BooleanTy
+  TyVar x -> TyVar x
+  HasTy m r x -> HasTy (rmLocType <$> m) r x
+  HasKey ty x -> HasKey (rmLocType ty) x
+  ElementsOf ty x -> ElementsOf (rmLocType ty) x
+
+rmLocFieldDef :: FieldDef_ s p t -> FieldDef_ () p t
+rmLocFieldDef (FieldDef n ty) = FieldDef n $ rmLocType ty
+
+rmLocPat :: SourcePat_ s st p t -> SourcePat_ () () p t
+rmLocPat = \case
+  Nat _ x -> Nat () x
+  String _ x -> String () x
+  StringPrefix _ x -> StringPrefix () x
+  ByteArray _ x -> ByteArray () x
+  Array _ xs -> Array () (rmLocPat <$> xs)
+  ArrayPrefix _ xs -> ArrayPrefix () (rmLocPat <$> xs)
+  Tuple _ xs -> Tuple () (rmLocPat <$> xs)
+  Struct _ xs -> Struct () (rmLocField <$> xs)
+  App _ x xs -> App () (rmLocPat x) (rmLocPat <$> xs)
+  KeyValue _ x y -> KeyValue () (rmLocPat x) (rmLocPat y)
+  Elements _ pat -> Elements () (rmLocPat pat)
+  All _ query -> All () (rmLocPat query)
+  Wildcard _ -> Wildcard ()
+  Never _ -> Never ()
+  Variable _ v -> Variable () v
+  ElementsOfArray _ x -> ElementsOfArray () (rmLocPat x)
+  OrPattern _ x y -> OrPattern () (rmLocPat x) (rmLocPat y)
+  IfPattern _ x y z -> IfPattern () (rmLocPat x) (rmLocPat y) (rmLocPat z)
+  Negation _ x -> Negation () (rmLocPat x)
+  NestedQuery _ query -> NestedQuery () $ rmLocQuery query
+  FactId _ x y -> FactId () x y
+  TypeSignature _ x t -> TypeSignature () (rmLocPat x) (rmLocType t)
+  Clause _ _ x y rng -> Clause () () x (rmLocPat y) rng
+  Prim _ p ps -> Prim () p (rmLocPat <$> ps)
+  FieldSelect _ pat field q -> FieldSelect () (rmLocPat pat) field q
+  Deref _ pat -> Deref () (rmLocPat pat)
+  Enum _ f -> Enum () f
+
+rmLocField :: Field s st p t -> Field () () p t
+rmLocField (Field name pat) =
+  Field name (rmLocPat pat)
+
+-- Remove spans from type refs only. Useful when
+-- the two span types are different (s != st), e.g., s = SrcSpan, st = ()
+rmTypeLocPredDef :: PredicateDef_ s st p t -> PredicateDef_ s () p t
+rmTypeLocPredDef pred = pred
+    { predicateDefKeyType = rmLocType $ predicateDefKeyType pred
+    , predicateDefValueType = rmLocType $ predicateDefValueType pred
+    , predicateDefDeriving = rmTypeLocQuery <$> predicateDefDeriving pred}
+
+rmTypeLocQuery :: SourceQuery_ s st p t -> SourceQuery_ s () p t
+rmTypeLocQuery (SourceQuery mhead stmts ord) =
+  SourceQuery (rmTypeLocPat <$> mhead) (rmTypeLocStatement <$> stmts) ord
+
+rmTypeLocStatement :: SourceStatement_ s st p t -> SourceStatement_ s () p t
+rmTypeLocStatement (SourceStatement x y) =
+  SourceStatement (rmTypeLocPat x) (rmTypeLocPat y)
+
+rmTypeLocPat :: SourcePat_ s st p t -> SourcePat_ s () p t
+rmTypeLocPat pat = case pat of
+  Nat s x -> Nat s x
+  String s x -> String s x
+  StringPrefix s x -> StringPrefix s x
+  ByteArray s x -> ByteArray s x
+  TypeSignature s x t -> TypeSignature s (rmTypeLocPat x) (rmLocType t)
+  Array s xs -> Array s (rmTypeLocPat <$> xs)
+  ArrayPrefix s xs -> ArrayPrefix s (rmTypeLocPat <$> xs)
+  Tuple s xs -> Tuple s (rmTypeLocPat <$> xs)
+  Struct s xs -> Struct s (rmTypeLocField <$> xs)
+  App s x xs -> App s (rmTypeLocPat x) (rmTypeLocPat <$> xs)
+  KeyValue s x y -> KeyValue s (rmTypeLocPat x) (rmTypeLocPat y)
+  Elements s pat -> Elements s (rmTypeLocPat pat)
+  All s query -> All s (rmTypeLocPat query)
+  Wildcard s -> Wildcard s
+  Never s -> Never s
+  Variable s v -> Variable s v
+  ElementsOfArray s x -> ElementsOfArray s (rmTypeLocPat x)
+  OrPattern s x y -> OrPattern s (rmTypeLocPat x) (rmTypeLocPat y)
+  IfPattern s x y z ->
+    IfPattern s (rmTypeLocPat x) (rmTypeLocPat y) (rmTypeLocPat z)
+  Negation s x -> Negation s (rmTypeLocPat x)
+  NestedQuery s query -> NestedQuery s $ rmTypeLocQuery query
+  FactId s x y -> FactId s x y
+  Clause s ss x y rng -> Clause s ss x (rmTypeLocPat y) rng
+  Prim s p ps -> Prim s p (rmTypeLocPat <$> ps)
+  FieldSelect s pat field q -> FieldSelect s (rmTypeLocPat pat) field q
+  Deref s pat -> Deref s (rmTypeLocPat pat)
+  Enum s f -> Enum s f
+
+rmTypeLocField :: Field s st p t -> Field s () p t
+rmTypeLocField (Field name pat) =
+  Field name (rmTypeLocPat pat)
+
+-- -----------------------------------------------------------------------------
+-- Describing the kind of pattern
+
+class Describe a where
+  describe :: a -> Doc ann
+
+instance Describe (SourcePat_ s st p t) where
+  describe = \case
+    Nat {} -> "a nat"
+    String {} -> "a string"
+    StringPrefix {} -> "a string prefix"
+    ByteArray {} -> "a byte array"
+    Array {} -> "an array"
+    ArrayPrefix {} -> "an array prefix"
+    Tuple {} -> "a tuple"
+    Struct {} -> "a struct"
+    App {} -> "an application"
+    KeyValue {} -> "a key value pattern"
+    All {} -> "a set with all the results of its argument"
+    Wildcard {} -> "a wildcard pattern"
+    Never {} -> "a never pattern"
+    Variable {} -> "a variable"
+    ElementsOfArray {} -> "an element of an array"
+    Elements {} -> "an element of a set"
+    OrPattern {} -> "an or pattern"
+    IfPattern {} -> "an if pattern"
+    Negation {} -> "a negation"
+    NestedQuery {} -> "a nested query"
+    FactId {} -> "a fact id"
+    TypeSignature {} -> "a type signature"
+    Clause {} -> "a clause"
+    Prim {} -> "a primitive function"
+    FieldSelect{} -> "a record field"
+    Deref{} -> "a dereference"
+    Enum{} -> "an enum value"
+
+instance Describe SrcSpan where
+  describe _ = "a source span"
+
+instance Describe SrcLoc where
+  describe _ = "a source location"
diff --git a/glean/hs/Glean/Backend/Retry.hs b/glean/hs/Glean/Backend/Retry.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Backend/Retry.hs
@@ -0,0 +1,121 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Backend.Retry
+  ( RetryWritesBackend(..)
+  , backendRetryWrites
+  , RetryReadsBackend(..)
+  , backendRetryReads
+  ) where
+
+import Glean.Backend.Types
+import Glean.Util.RetryChannelException
+import Glean.Util.Some
+
+data RetryWritesBackend = RetryWritesBackend RetryPolicy (Some Backend)
+
+-- | Make a 'Backend' that will retry all write-related operations
+-- according to the given 'RetryPolicy'
+backendRetryWrites :: Backend b => b -> RetryPolicy -> RetryWritesBackend
+backendRetryWrites backend policy = RetryWritesBackend policy (Some backend)
+
+instance Backend RetryWritesBackend where
+  queryFact (RetryWritesBackend _ backend) = queryFact backend
+  factIdRange (RetryWritesBackend _ backend) = factIdRange backend
+  getSchemaInfo (RetryWritesBackend _ backend) = getSchemaInfo backend
+  validateSchema (RetryWritesBackend _ backend) = validateSchema backend
+  predicateStats (RetryWritesBackend _ backend) = predicateStats backend
+  listDatabases (RetryWritesBackend _ backend) = listDatabases backend
+  getDatabase (RetryWritesBackend _ backend) = getDatabase backend
+  userQueryFacts (RetryWritesBackend _ backend) = userQueryFacts backend
+  userQuery (RetryWritesBackend _ backend) = userQuery backend
+  userQueryBatch (RetryWritesBackend _ backend) = userQueryBatch backend
+  deriveStored (RetryWritesBackend _ backend) = deriveStored backend
+
+  kickOffDatabase (RetryWritesBackend policy backend) kickOff =
+    retryChannelExceptions policy $ kickOffDatabase backend kickOff
+  finishDatabase (RetryWritesBackend policy backend) repo =
+    retryChannelExceptions policy $ finishDatabase backend repo
+  finalizeDatabase (RetryWritesBackend policy backend) repo =
+    retryChannelExceptions policy $ finalizeDatabase backend repo
+  updateProperties (RetryWritesBackend policy backend) repo props vals =
+    retryChannelExceptions policy $ updateProperties backend repo props vals
+  completePredicates_ (RetryWritesBackend policy backend) repo preds =
+    retryChannelExceptions policy $ completePredicates_ backend repo preds
+
+  restoreDatabase (RetryWritesBackend _ backend) = restoreDatabase backend
+  deleteDatabase (RetryWritesBackend _ backend) = deleteDatabase backend
+
+  enqueueBatch (RetryWritesBackend policy backend) batch =
+    retryChannelExceptions policy $ enqueueBatch backend batch
+  enqueueJsonBatch (RetryWritesBackend policy backend) repo batch =
+    retryChannelExceptions policy $ enqueueJsonBatch backend repo batch
+  enqueueBatchDescriptor (RetryWritesBackend policy backend)
+    repo batch waitPolicy =
+      retryChannelExceptions policy
+        $ enqueueBatchDescriptor backend repo batch waitPolicy
+  pollBatch (RetryWritesBackend policy backend) handle =
+    retryChannelExceptions policy $ pollBatch backend handle
+
+  displayBackend (RetryWritesBackend _ backend) = displayBackend backend
+  hasDatabase (RetryWritesBackend _ backend) = hasDatabase backend
+  schemaId (RetryWritesBackend _ backend) = schemaId backend
+  usingShards (RetryWritesBackend _ backend) = usingShards backend
+  initGlobalState (RetryWritesBackend _ backend) = initGlobalState backend
+
+data RetryReadsBackend = RetryReadsBackend RetryPolicy (Some Backend)
+
+-- | Make a 'Backend' that will retry all read-related operations
+-- according to the given 'RetryPolicy'
+backendRetryReads :: Backend b => b -> RetryPolicy -> RetryReadsBackend
+backendRetryReads backend policy = RetryReadsBackend policy (Some backend)
+
+instance Backend RetryReadsBackend where
+  queryFact (RetryReadsBackend policy backend) repo id =
+    retryChannelExceptions policy $ queryFact backend repo id
+  factIdRange (RetryReadsBackend policy backend) repo =
+    retryChannelExceptions policy $ factIdRange backend repo
+  getSchemaInfo (RetryReadsBackend policy backend) repo opts =
+    retryChannelExceptions policy $ getSchemaInfo backend repo opts
+  validateSchema (RetryReadsBackend policy backend) req =
+    retryChannelExceptions policy $ validateSchema backend req
+  predicateStats (RetryReadsBackend policy backend) repo opts =
+    retryChannelExceptions policy $ predicateStats backend repo opts
+  listDatabases (RetryReadsBackend policy backend) req =
+    retryChannelExceptions policy $ listDatabases backend req
+  getDatabase (RetryReadsBackend policy backend) repo =
+    retryChannelExceptions policy $ getDatabase backend repo
+  userQueryFacts (RetryReadsBackend policy backend) repo req =
+    retryChannelExceptions policy $ userQueryFacts backend repo req
+  userQuery (RetryReadsBackend policy backend) repo req =
+    retryChannelExceptions policy $ userQuery backend repo req
+  userQueryBatch (RetryReadsBackend policy backend) repo req =
+    retryChannelExceptions policy $ userQueryBatch backend repo req
+  deriveStored (RetryReadsBackend _ backend) = deriveStored backend
+
+  kickOffDatabase (RetryReadsBackend _ backend) = kickOffDatabase backend
+  finishDatabase (RetryReadsBackend _ backend) = finishDatabase backend
+  finalizeDatabase (RetryReadsBackend _ backend) = finalizeDatabase backend
+  updateProperties (RetryReadsBackend _ backend) = updateProperties backend
+  completePredicates_ (RetryReadsBackend _ backend) =
+    completePredicates_ backend
+
+  restoreDatabase (RetryReadsBackend _ backend) = restoreDatabase backend
+  deleteDatabase (RetryReadsBackend _ backend) = deleteDatabase backend
+
+  enqueueBatch (RetryReadsBackend _ backend) = enqueueBatch backend
+  enqueueJsonBatch (RetryReadsBackend _ backend) = enqueueJsonBatch backend
+  enqueueBatchDescriptor (RetryReadsBackend _ backend) =
+    enqueueBatchDescriptor backend
+  pollBatch (RetryReadsBackend _ backend) = pollBatch backend
+
+  displayBackend (RetryReadsBackend _ backend) = displayBackend backend
+  hasDatabase (RetryReadsBackend _ backend) = hasDatabase backend
+  schemaId (RetryReadsBackend _ backend) = schemaId backend
+  usingShards (RetryReadsBackend _ backend) = usingShards backend
+  initGlobalState (RetryReadsBackend _ backend) = initGlobalState backend
diff --git a/glean/hs/Glean/Backend/Types.hs b/glean/hs/Glean/Backend/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Backend/Types.hs
@@ -0,0 +1,451 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module Glean.Backend.Types
+  (
+    -- * Types
+    Backend(..)
+  , StackedDbOpts(..)
+  , LogDerivationResult
+
+    -- * Operations
+  , SchemaPredicates
+  , loadPredicates
+  , loadPredicatesForSchema
+  , databases
+  , localDatabases
+  , create
+  , finish
+  , fillDatabase
+  , finalize
+  , completePredicates
+  , untilDone
+
+    -- * Haxl
+  , GleanGet(..)
+  , GleanQuery(..)
+  , GleanFetcher
+  , GleanQueryer
+  , Haxl.State(..)
+  , QueryResult(..)
+  , AppendList(..)
+  , fromAppendList
+
+    -- * Shards
+  , dbShard
+  , dbShardWord
+  ) where
+
+import qualified Data.ByteString.Unsafe as B
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import Data.Bits
+import Data.Default
+import Data.Hashable
+import qualified Data.HashMap.Strict as HashMap
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Monoid
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Data.Word
+import Data.Typeable
+import Foreign.Ptr
+import GHC.Fingerprint
+import qualified Haxl.Core as Haxl
+import System.IO.Unsafe
+
+import Util.Control.Exception
+import Util.Time (DiffTimePoints)
+
+import Glean.Query.Thrift.Internal
+import Glean.Typed
+import qualified Glean.Types as Thrift
+import Glean.Util.Some
+import Glean.Util.ThriftService (DbShard)
+import Glean.Types
+import Data.Either
+
+data StackedDbOpts
+  = IncludeBase
+  | ExcludeBase
+  deriving (Eq, Show)
+
+-- |
+-- An abstraction over Glean's Thrift API. This allows client code
+-- to work with either a local or remote backend, chosen at runtime.
+--
+class Backend a where
+  queryFact :: a -> Thrift.Repo -> Thrift.Id -> IO (Maybe Thrift.Fact)
+  factIdRange :: a -> Thrift.Repo -> IO Thrift.FactIdRange
+  getSchemaInfo :: a -> Maybe Thrift.Repo -> Thrift.GetSchemaInfo
+    -> IO Thrift.SchemaInfo
+  validateSchema :: a -> Thrift.ValidateSchema -> IO ()
+  predicateStats :: a -> Thrift.Repo -> StackedDbOpts
+    -> IO (Map Thrift.Id Thrift.PredicateStats)
+  listDatabases :: a -> Thrift.ListDatabases -> IO Thrift.ListDatabasesResult
+  getDatabase :: a -> Thrift.Repo -> IO Thrift.GetDatabaseResult
+
+  userQueryFacts :: a -> Thrift.Repo -> Thrift.UserQueryFacts
+    -> IO Thrift.UserQueryResults
+  userQuery :: a -> Thrift.Repo -> Thrift.UserQuery
+    -> IO Thrift.UserQueryResults
+  userQueryBatch :: a -> Thrift.Repo -> Thrift.UserQueryBatch
+    -> IO [Thrift.UserQueryResultsOrException]
+
+  deriveStored :: a -> LogDerivationResult -> Thrift.Repo
+    -> Thrift.DerivePredicateQuery -> IO Thrift.DerivationStatus
+
+  kickOffDatabase :: a -> Thrift.KickOff -> IO Thrift.KickOffResponse
+  finishDatabase :: a -> Thrift.Repo -> IO Thrift.FinishDatabaseResponse
+  finalizeDatabase :: a -> Thrift.Repo -> IO Thrift.FinalizeResponse
+
+  updateProperties
+    :: a
+    -> Thrift.Repo
+    -> Thrift.DatabaseProperties
+    -> [Text]
+    -> IO Thrift.UpdatePropertiesResponse
+
+  completePredicates_
+    :: a
+    -> Thrift.Repo
+    -> Thrift.CompletePredicates
+    -> IO Thrift.CompletePredicatesResponse
+
+  -- | Request a backed up database (specified via its backup locator) to be
+  -- made available. This call doesn't wait until the database actually becomes
+  -- available, it only issues the request.
+  --
+  -- This might (for local databases) or might not (for databases on a Thrift
+  -- server) return an STM action that waits for the restore operation.
+  restoreDatabase :: a -> Text -> IO ()
+
+  -- For a local database this will delete the specified repo
+  deleteDatabase :: a -> Thrift.Repo -> IO Thrift.DeleteDatabaseResult
+
+  -- Enqueue a batch for writing
+  enqueueBatch :: a -> Thrift.ComputedBatch -> IO Thrift.SendResponse
+
+  -- Enqueue a JSON batch for writing
+  enqueueJsonBatch
+    :: a
+    -> Thrift.Repo
+    -> Thrift.SendJsonBatch
+    -> IO Thrift.SendJsonBatchResponse
+
+  -- Enqueue a batch descriptor to be downloaded and written
+  enqueueBatchDescriptor
+    :: a
+    -> Thrift.Repo
+    -> Thrift.EnqueueBatch
+    -> Thrift.EnqueueBatchWaitPolicy
+    -> IO Thrift.EnqueueBatchResponse
+
+  -- Poll the status of a write batch
+  pollBatch :: a -> Thrift.Handle -> IO Thrift.FinishResponse
+
+  -- | Render for debugging
+  displayBackend :: a -> String
+
+  -- | For a given 'Repo', check whether any servers have the DB.  If
+  -- the backend is remote and using shards, this should check whether
+  -- any servers are advertising the appropriate shard.
+  hasDatabase :: a -> Thrift.Repo -> IO Bool
+
+  -- | The schema version the client wants to use. This is sent along
+  -- with queries.
+  schemaId :: a -> Maybe Thrift.SchemaId
+
+  -- | True if this is a distributed backend, and different servers
+  -- may have different DBs. If this returns True, then `hasDatabase`
+  -- can be used to check the availability of a DB.
+  usingShards :: a -> Bool
+
+  -- | Initialise the Haxl state for this Backend.
+  initGlobalState :: a -> IO (Haxl.State GleanGet, Haxl.State GleanQuery)
+
+
+-- | The exception includes the length of time from start to error
+type LogDerivationResult =
+  Either (DiffTimePoints, SomeException) Thrift.UserQueryStats -> IO ()
+
+instance Backend (Some Backend) where
+  queryFact (Some backend) = queryFact backend
+  factIdRange (Some backend) = factIdRange backend
+  getSchemaInfo (Some backend) = getSchemaInfo backend
+  validateSchema (Some backend) = validateSchema backend
+  predicateStats (Some backend) = predicateStats backend
+  listDatabases (Some backend) = listDatabases backend
+  getDatabase (Some backend) = getDatabase backend
+  userQueryFacts (Some backend) = userQueryFacts backend
+  userQuery (Some backend) = userQuery backend
+  userQueryBatch (Some backend) = userQueryBatch backend
+  deriveStored (Some backend) = deriveStored backend
+
+  kickOffDatabase (Some backend) = kickOffDatabase backend
+  finishDatabase (Some backend) = finishDatabase backend
+  finalizeDatabase (Some backend) = finalizeDatabase backend
+  updateProperties (Some backend) = updateProperties backend
+  completePredicates_ (Some backend) = completePredicates_ backend
+
+  restoreDatabase (Some backend) = restoreDatabase backend
+  deleteDatabase (Some backend) = deleteDatabase backend
+
+  enqueueBatch (Some backend) = enqueueBatch backend
+  enqueueJsonBatch (Some backend) = enqueueJsonBatch backend
+  enqueueBatchDescriptor (Some backend) = enqueueBatchDescriptor backend
+  pollBatch (Some backend) = pollBatch backend
+  displayBackend (Some backend) = displayBackend backend
+  hasDatabase (Some backend) = hasDatabase backend
+  schemaId (Some backend) = schemaId backend
+  usingShards (Some backend) = usingShards backend
+  initGlobalState (Some backend) = initGlobalState backend
+
+-- -----------------------------------------------------------------------------
+-- Functionality built on Backend
+
+loadPredicates
+  :: Backend a
+  => a
+  -> Thrift.Repo
+  -> [SchemaPredicates]
+  -> IO Predicates
+loadPredicates backend repo refs =
+  makePredicates refs <$> getSchemaInfo backend (Just repo)
+    def { Thrift.getSchemaInfo_omit_source = True }
+
+loadPredicatesForSchema :: Backend a => a -> SchemaId -> IO Predicates
+loadPredicatesForSchema backend schemaId = do
+  info <- getSchemaInfo backend Nothing
+    def {
+      Thrift.getSchemaInfo_select = Thrift.SelectSchema_schema_id schemaId,
+      Thrift.getSchemaInfo_omit_source = True
+    }
+  return $ makePredicates [Map.elems (Thrift.schemaInfo_predicateIds info)] info
+
+databases :: Backend a => a -> IO [Thrift.Database]
+databases be =
+  Thrift.listDatabasesResult_databases <$>
+    listDatabases be def { Thrift.listDatabases_includeBackups = True }
+
+localDatabases :: Backend a => a -> IO [Thrift.Database]
+localDatabases be =
+  Thrift.listDatabasesResult_databases <$>
+    listDatabases be def { Thrift.listDatabases_includeBackups = False }
+
+-- | Create a database and run the supplied IO action to write data
+-- into it. When the IO action returns, the DB will be marked complete
+-- and cannot be modified further.
+fillDatabase
+  :: Backend a
+  => a
+    -- ^ The backend
+  -> Repo
+    -- ^ The repo to create
+  -> Maybe Dependencies
+    -- ^ Optionally stack the new DB on another DB
+  -> IO ()
+    -- ^ What to do if the DB already exists. @return ()@ to continue,
+    -- or @throwIO@ to forbid.
+  -> IO b
+    -- ^ Caller-supplied action to write data into the DB.
+  -> IO b
+fillDatabase env repo maybeDeps ifexists action =
+  tryBracket
+    (do
+      exists <- create env repo maybeDeps
+      when exists ifexists
+    )
+    (\_ ex -> do
+      when (isRight ex) $ do
+        finish env repo
+    )
+    (const action)
+
+-- | Create a database. The schema ID is set from the Backend.
+create
+  :: Backend a
+  => a
+  -> Repo
+  -> Maybe Dependencies
+  -> IO Bool  -- ^ Returns 'True' if the DB already existed
+create backend repo maybeDeps = do
+  r <- kickOffDatabase backend def
+    { kickOff_repo = repo
+    , kickOff_properties = HashMap.fromList $
+        [ ("glean.schema_id", id)
+        | Just (SchemaId id) <- [schemaId backend]
+        ]
+    , kickOff_dependencies = maybeDeps
+    }
+  return (kickOffResponse_alreadyExists r)
+
+-- | Finish a DB created with 'create'
+finish
+  :: Backend a
+  => a
+  -> Repo
+  -> IO ()
+finish backend repo = do
+  void $ finishDatabase backend repo
+  finalize backend repo
+
+-- | Wait for a database to finish finalizing and enter the "complete"
+-- state after all writing has finished. Before the database is
+-- complete, it may be queried but a stacked database cannot be
+-- created on top of it.
+finalize :: Backend a => a -> Repo -> IO ()
+finalize env repo =
+  void $ untilDone $ finalizeDatabase env repo
+
+-- | Notify the server when non-derived predicates are complete. This
+-- must be called before derivedStored.
+completePredicates :: Backend a => a -> Repo -> CompletePredicates -> IO ()
+completePredicates env repo preds =
+  void $ untilDone $ completePredicates_ env repo preds
+
+untilDone :: IO a -> IO a
+untilDone io = loop
+  where
+  loop = do
+    r <- try io
+    case r of
+      Right a -> return a
+      Left (Retry n) -> do
+        threadDelay (truncate (n * 1000000))
+        loop
+
+
+-- -----------------------------------------------------------------------------
+-- Haxl
+
+data GleanGet p where
+  Get
+    :: (Typeable p, Show p, Predicate p)
+    => {-# UNPACK #-} !(IdOf p)
+    -> Bool
+    -> Repo
+    -> GleanGet p
+  GetKey
+    :: (Typeable p, Show p, Predicate p)
+    => {-# UNPACK #-} !(IdOf p)
+    -> Bool
+    -> Repo
+    -> GleanGet (KeyType p)
+
+deriving instance Show (GleanGet a)
+instance Haxl.ShowP GleanGet where showp = show
+
+instance Eq (GleanGet p) where
+  (Get p rec repo) == (Get q rec' repo') =
+    p == q && rec == rec' && repo == repo'
+  (GetKey (p :: IdOf a) rec repo) == (GetKey (q :: IdOf b) rec' repo')
+    | Just Refl <- eqT @a @b = p == q && rec == rec' && repo == repo'
+    -- the KeyTypes being equal doesn't tell us that the predicates are
+    -- equal, so we need to check that with eqT here.
+  _ == _ = False
+
+instance Hashable (GleanGet a) where
+  hashWithSalt salt (Get p rec repo) =
+    hashWithSalt salt (0::Int, typeOf p, p, rec, repo)
+  hashWithSalt salt (GetKey p rec repo) =
+    hashWithSalt salt (1::Int, typeOf p, p, rec, repo)
+
+instance Haxl.DataSourceName GleanGet where
+  dataSourceName _ = "GleanGet"
+
+type GleanFetcher = Haxl.PerformFetch GleanGet
+
+instance Haxl.StateKey GleanGet where
+  data State GleanGet = GleanGetState GleanFetcher
+
+instance Haxl.DataSource u GleanGet where
+  fetch (GleanGetState fetcher) _ _ = fetcher
+
+{-
+Why is streaming handled behind the datasource abstraction instead of
+exposing resumable queries as a request?  Because exposing resumable
+queries as a Haxl data fetch would mean hashing the continuation and
+keeping it in the Haxl cache.
+-}
+
+data GleanQuery a where
+  QueryReq
+    :: (Show q, Typeable q, QueryResult q r)
+    => Query q   -- The query
+    -> Repo
+    -> Bool -- stream all results?
+    -> GleanQuery (r, Bool)
+
+-- | List with O(1) append and O(n) conversion to [], aka DList
+newtype AppendList a = AppendList ([a] -> [a])
+
+instance Semigroup (AppendList a) where
+  AppendList x <> AppendList y = AppendList (x . y)
+
+instance Monoid (AppendList a) where
+  mempty = AppendList id
+
+fromAppendList :: AppendList a -> [a]
+fromAppendList (AppendList f) = f []
+
+instance Show a => Show (AppendList a) where
+  show = show . fromAppendList
+
+class Monoid r => QueryResult q r where
+  fromResults :: [q] -> r
+
+instance QueryResult q (AppendList q) where
+  fromResults qs = AppendList (qs++)
+
+instance QueryResult q (Sum Int) where
+  fromResults = Sum . length
+
+deriving instance Show (GleanQuery q)
+instance Haxl.ShowP GleanQuery where showp = show
+
+instance Eq (GleanQuery r) where
+  QueryReq (q1 :: Query a) repo1 s1 == QueryReq (q2 :: Query b) repo2 s2
+    | Just Refl <- eqT @a @b = q1 == q2 && repo1 == repo2 && s1 == s2
+  _ == _ = False
+
+instance Hashable (GleanQuery q) where
+  hashWithSalt salt (QueryReq q s repo) = hashWithSalt salt (q,s,repo)
+
+
+instance Haxl.DataSourceName GleanQuery where
+  dataSourceName _ = "GleanQuery"
+
+type GleanQueryer = Haxl.PerformFetch GleanQuery
+
+instance Haxl.StateKey GleanQuery where
+  data State GleanQuery = GleanQueryState GleanQueryer
+
+instance Haxl.DataSource u GleanQuery where
+  fetch (GleanQueryState queryer) _ _ = queryer
+
+-- -----------------------------------------------------------------------------
+-- Shards
+
+dbShard :: Thrift.Repo -> DbShard
+dbShard = Text.pack . show . dbShardWord
+
+dbShardWord :: Thrift.Repo -> Word64
+dbShardWord Thrift.Repo{..} =
+  unsafeDupablePerformIO $ B.unsafeUseAsCStringLen repo $ \(ptr,len) -> do
+      -- Use GHC's md5 binding. If this ever changes then the test in
+      -- hs/tests/TestShard.hs will detect it.
+    Fingerprint w _ <- fingerprintData (castPtr ptr) len
+    return (w `shiftR` 1)
+       -- SR doesn't like shards >= 0x8000000000000000
+  where
+  repo = Text.encodeUtf8 repo_name <> "/" <> Text.encodeUtf8 repo_hash
diff --git a/glean/hs/Glean/Display.hs b/glean/hs/Glean/Display.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Display.hs
@@ -0,0 +1,65 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Display (
+    displayDefault,
+    displayVerbose,
+    Display(..),
+    DisplayOpts(..),
+    PredicateStyle(..),
+    defaultDisplayOpts,
+    verboseDisplayOpts,
+  ) where
+
+import Data.Text (Text)
+import Compat.Prettyprinter
+
+data PredicateStyle = PredicateWithHash | PredicateWithoutHash
+
+newtype DisplayOpts = DisplayOpts
+  { predicateStyle :: PredicateStyle
+  -- more later
+  }
+
+-- | A "human readable" style, for things like error messages
+defaultDisplayOpts :: DisplayOpts
+defaultDisplayOpts = DisplayOpts
+  { predicateStyle = PredicateWithoutHash
+  }
+
+-- | All the details, for debugging
+verboseDisplayOpts :: DisplayOpts
+verboseDisplayOpts = DisplayOpts
+  { predicateStyle = PredicateWithHash
+  }
+
+displayDefault :: Display a => a -> Doc ann
+displayDefault = display defaultDisplayOpts
+
+displayVerbose :: Display a => a -> Doc ann
+displayVerbose = display verboseDisplayOpts
+
+-- | A class for paramterising pretty-printers with some options to
+-- control what gets printed, for example to select different levels
+-- of verbosity.
+class Display a where
+  display :: DisplayOpts -> a -> Doc ann
+
+  -- | If necessary, parenthesise the output to make it suitable for
+  -- use in an "atomic" position such as a function argument.
+  displayAtom :: DisplayOpts -> a -> Doc ann
+  displayAtom opts = display opts
+
+instance Display () where
+  display _ = pretty
+
+instance Display String where
+  display _ = pretty
+
+instance Display Text where
+  display _ = pretty
diff --git a/glean/hs/Glean/FFI.hs b/glean/hs/Glean/FFI.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/FFI.hs
@@ -0,0 +1,157 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.FFI (
+  unsafeWithBytes, copyByteString, unsafeMallocedByteString,
+  unsafeMallocedVector,
+  withUTF8Text, fromUTF8, unsafeMallocedUTF8,
+
+  usingMalloced, usingManyMalloced, withMany,
+
+  Destroy, Object(..), create, release, construct, with,
+  Constructor, constructor, Static(..), withStatic, using,
+
+  FFIResultBuf, withFFIResultBuf, ffiBuf, ffiBuf2,
+) where
+
+import Foreign hiding (with, withMany)
+import Foreign.C
+import Control.Exception
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Unsafe as BS
+import Data.Text (Text)
+import qualified Data.Text.Encoding as Text
+import qualified Data.Text.Encoding.Error as Text
+import qualified Data.Vector.Storable
+
+import Util.FFI
+
+unsafeWithBytes :: ByteString -> (Ptr () -> CSize -> IO a) -> IO a
+unsafeWithBytes s f = BS.unsafeUseAsCStringLen s $ \(p,n) ->
+  f (castPtr p) (fromIntegral n)
+
+copyByteString :: Ptr () -> CSize -> IO ByteString
+copyByteString p n = BS.packCStringLen (castPtr p, fromIntegral n)
+
+unsafeMallocedByteString :: Ptr () -> CSize -> IO ByteString
+unsafeMallocedByteString p n =
+  BS.unsafePackMallocCStringLen (castPtr p, fromIntegral n)
+
+unsafeMallocedVector
+  :: Storable a => Ptr a -> CSize -> IO (Data.Vector.Storable.Vector a)
+unsafeMallocedVector p n = do
+  fp <- newForeignPtr finalizerFree p
+  return $ Data.Vector.Storable.unsafeFromForeignPtr0 fp $ fromIntegral n
+
+withUTF8Text :: Text -> (Ptr () -> CSize -> IO a) -> IO a
+withUTF8Text = unsafeWithBytes . Text.encodeUtf8
+
+fromUTF8 :: Ptr () -> CSize -> IO Text
+fromUTF8 p n = Text.decodeUtf8With Text.lenientDecode <$> copyByteString p n
+
+unsafeMallocedUTF8 :: Ptr () -> CSize -> IO Text
+unsafeMallocedUTF8 p n =
+  Text.decodeUtf8With Text.lenientDecode <$> unsafeMallocedByteString p n
+
+usingMalloced :: Ptr a -> IO b -> IO b
+usingMalloced p action = action `finally` free p
+
+usingManyMalloced :: [Ptr a] -> IO b -> IO b
+usingManyMalloced ps action = foldr usingMalloced action ps
+
+withMany :: (a -> (b -> IO r) -> IO r) -> [a] -> ([b] -> IO r) -> IO r
+withMany with as f = go [] as
+  where
+    go bs [] = f $ reverse bs
+    go bs (a:as) = with a $ \b -> go (b:bs) as
+
+type Destroy a = FunPtr (Ptr a -> IO ())
+
+class Object a where
+  wrap :: ForeignPtr a -> a
+  unwrap :: a -> ForeignPtr a
+  destroy :: Destroy a
+
+create :: Object a => Ptr a -> IO a
+create = fmap wrap . newForeignPtr destroy
+
+release :: Object a => a -> IO ()
+release = finalizeForeignPtr . unwrap
+
+construct :: Object a => IO (Ptr a) -> IO a
+construct mk = mask_ $ mk >>= create
+
+with :: Object a => a -> (Ptr a -> IO b) -> IO b
+with x f = unsafeWithForeignPtr (unwrap x) f
+
+class Static a where
+  destroyStatic :: a -> IO ()
+
+newtype Constructor a = Constructor (IO a)
+
+constructor :: IO a -> Constructor a
+constructor = Constructor
+
+withStatic :: Static a => Constructor a -> (a -> IO b) -> IO b
+withStatic (Constructor mk) = using mk
+
+using :: Static a => IO a -> (a -> IO b) -> IO b
+using mk = bracket mk destroyStatic
+
+
+-- -----------------------------------------------------------------------------
+-- Sharing buffers to hold the result of FFI calls
+
+newtype FFIResultBuf = FFIResultBuf (Ptr Word64)
+
+wORD64_SIZE :: Int
+wORD64_SIZE = sizeOf (undefined :: Word64)
+
+-- | Create a temporary buffer which has space for 2 'Word64'. This can be used
+-- via 'ffiBuf' and 'ffiBuf2' to avoid allocating a new buffer for every call
+-- (as 'invoke' does) which is inefficient for high-volume/low-overhead calls.
+-- 2 'Word64' are enough for everything we want to do currently.
+withFFIResultBuf :: (FFIResultBuf -> IO a) -> IO a
+withFFIResultBuf f = allocaBytes (wORD64_SIZE * 2) $ f . FFIResultBuf
+
+-- | Execute an 'invoke'-like call, using the shared buffer to store the result.
+--
+-- NOTE: the value must be no bigger than `Word64`. This is checked
+-- with an assertion, but will silently segfault when optimisation is
+-- on.
+ffiBuf
+  :: forall a. (Storable a)
+  => FFIResultBuf
+  -> (Ptr a -> IO CString)
+  -> IO a
+{-# INLINE ffiBuf #-}
+ffiBuf (FFIResultBuf buf) fun = do
+  assert (sizeOf (undefined :: a) <= wORD64_SIZE) $ return ()
+  invoke $ fun (castPtr buf)
+  peek (castPtr buf)
+
+-- | Execute an 'invoke'-like call, using the shared buffer to store the two
+-- results.
+--
+-- NOTE: the values must be no bigger than `Word64` each. This is checked
+-- with an assertion, but will silently segfault when optimisation is
+-- on.
+ffiBuf2
+  :: forall a b. (Storable a, Storable b)
+  => FFIResultBuf
+  -> (Ptr a -> Ptr b -> IO CString)
+  -> IO (a,b)
+{-# INLINE ffiBuf2 #-}
+ffiBuf2 (FFIResultBuf buf) fun = do
+  assert (sizeOf (undefined :: a) <= wORD64_SIZE) $ return ()
+  assert (sizeOf (undefined :: b) <= wORD64_SIZE) $ return ()
+  let p = castPtr buf
+      q = castPtr $ buf `plusPtr` wORD64_SIZE
+  invoke $ fun p q
+  (,) <$> peek p <*> peek q
diff --git a/glean/hs/Glean/Query/Angle.hs b/glean/hs/Glean/Query/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Query/Angle.hs
@@ -0,0 +1,566 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- |
+-- Small domain-specific language for building Angle queries
+-- programmatically.
+--
+{-# LANGUAGE TypeApplications, TypeOperators, AllowAmbiguousTypes #-}
+{-# OPTIONS_GHC -Wno-star-is-type #-}
+module Glean.Query.Angle
+  ( Angle
+  , AngleStatement
+  , var
+  , Type
+  , vars
+  , predicate
+  , where_
+  , not_
+  , (.=)
+  , stmt
+  , (.|)
+  , or_
+  , (.->)
+  , query
+  , nat
+  , byte
+  , enum
+  , string
+  , stringPrefix
+  , byteArray
+  , array
+  , tuple
+  , wild
+  , never
+  , field
+  , end
+  , rec
+  , alt
+  , asPredicate
+  , sig
+  , factId
+  , factIds
+  , factIdsArray
+  , elementsOf
+  , arrayPrefix
+  , unit
+  , if_
+  , true
+  , false
+  , bool
+  , just
+  , nothing
+  , (.+)
+  , zipp
+  , conc
+  , display
+  , RecordFields
+  , SumFields
+  , TFields(..)
+  , HasFields
+  , HasField
+  , AngleEnum(..)
+  , AngleVars
+  , new
+  , old
+  ) where
+
+import Control.Monad.State.Strict
+import Data.ByteString (ByteString)
+import Data.Proxy
+import Data.String
+import qualified Data.List.Extra as List (nubOrd)
+import Data.List.NonEmpty (NonEmpty(..))
+import qualified Data.List.NonEmpty as NonEmpty (fromList, toList)
+import Data.Text (Text)
+import Compat.Prettyprinter hiding ((<>))
+import Compat.Prettyprinter.Render.Text
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Data.Word
+import GHC.TypeLits hiding (Nat)
+import TextShow
+
+import Glean.Angle.Types hiding
+  (SourcePat, SourceStatement, SourceQuery, Field, Type)
+import qualified Glean.Angle.Types as Angle
+import qualified Glean.Display as Display
+import Glean.Query.Thrift.Internal as Thrift
+import Glean.Typed hiding (end)
+import Glean.Types (Nat, Byte)
+
+data SpanAngleDSL = DSL
+  deriving (Show, Eq)
+
+instance IsSrcSpan SpanAngleDSL where
+  type Loc SpanAngleDSL = SpanAngleDSL
+  startLoc _ = DSL
+  endLoc _ = DSL
+  mkSpan _ _ = DSL
+
+instance Pretty SpanAngleDSL where
+  pretty DSL = "angle DSL"
+
+type SourcePat = SourcePat' SpanAngleDSL ()
+type SourceStatement = SourceStatement' SpanAngleDSL ()
+type SourceQuery = SourceQuery' SpanAngleDSL ()
+
+newtype Angle t = Angle { gen :: State Int SourcePat }
+
+newtype AngleStatement =
+  AngleStatement { genStmt :: State Int SourceStatement }
+
+-- | Render to angle text, to aid logging and debugging
+display :: Angle t -> Text
+display = render . build
+
+render :: SourceQuery -> Text
+render q = renderStrict (layoutCompact (Display.displayDefault q))
+
+build :: Angle t -> SourceQuery
+build (Angle m) =
+  case evalState m 0 of
+    NestedQuery _ q -> q
+    t -> Angle.SourceQuery (Just t) [] Unordered
+
+-- | Build a query. It can returns facts of a predicate:
+--
+-- >    query $ predicate @Pp.Define (field @"macro" "NULL" end)
+--
+-- Or arbitrary values:
+--
+-- >    query $ var $ \n ->
+-- >      n `where_` [
+-- >        stmt $ predicate @Hack.MethodDeclaration $
+-- >          rec $
+-- >            field @"name" "foo" $
+-- >            field @"container"
+-- >              (rec $
+-- >                 field @"class_"
+-- >                    (rec (field @"name" n end))
+-- >                 end)
+-- >      ]
+query :: (Type t) => Angle t -> Query t
+query = Thrift.angleData . display . sig
+  -- adding a type signature ensures that our type matches the type
+  -- Glean infers. Otherwise these could diverge, leading to
+  -- deserialization errors or just wrong data.
+
+class AngleVars f r where
+  -- | Use `vars` to batch up a series of nested `var` calls:
+  --
+  -- > let foo :: Angle a -> Angle b -> Angle c -> Angle d -> Angle e
+  -- > vars foo == var $ \a -> var $ \b -> var $ \c -> var $ \d -> foo a b c d
+  vars :: f -> Angle r
+
+instance (a ~ b) => AngleVars (Angle a) b where
+  vars = id
+
+instance (Type a, AngleVars s r) => AngleVars (Angle a -> s) r where
+  vars f = var $ \ a -> vars (f a)
+
+-- | Introduce an Angle variable
+var :: forall a b . Type a => (Angle a -> Angle b) -> Angle b
+var f = Angle $ do
+  x <- get
+  modify (+1)
+  let v = Angle (pure (Variable DSL ("X" <> showt x)))
+  ty <- gen (sig v)
+  r <- gen (f v)
+  let stmt = Angle.SourceStatement (Wildcard DSL) ty
+  case r of
+    Angle.NestedQuery DSL (Angle.SourceQuery q stmts ord) ->
+      return (Angle.NestedQuery DSL (Angle.SourceQuery q (stmt : stmts) ord))
+    _ ->
+      return (Angle.NestedQuery DSL (Angle.SourceQuery (Just r) [stmt] Ordered))
+
+predicate :: forall p . Predicate p => Angle (KeyType p) -> Angle p
+predicate (Angle pat) = Angle $ do
+  p <- pat
+  return $ App DSL (Variable DSL (predicateRef (Proxy @p))) [p]
+
+-- | Build a query of the form `X where statements`
+where_ :: Angle t -> [AngleStatement] -> Angle t
+where_ t stmts = Angle $
+  nest <$> gen t <*> mapM genStmt stmts
+  where
+  -- merge adjacent where-clauses
+  nest (Angle.NestedQuery DSL (Angle.SourceQuery (Just q) stmts1 ord)) stmts2 =
+    Angle.NestedQuery DSL $
+      Angle.SourceQuery (Just q) (stmts1 <> stmts2) ord
+  nest q stmts =
+    Angle.NestedQuery DSL (Angle.SourceQuery (Just q) stmts Ordered)
+
+not_ :: [AngleStatement] -> AngleStatement
+not_ stmts = unit' .= Angle (Negation DSL <$> gen t)
+  where
+    t = unit' `where_` stmts
+    unit' = sig unit
+
+-- | Build a statement, `A = B`
+(.=) :: Angle t -> Angle t -> AngleStatement
+l .= r = AngleStatement $ Angle.SourceStatement <$> gen l <*> gen r
+
+-- | Build a statement from a plain Angle expression, ignoring the result.
+-- `stmt A` is equivalent in Angle to the statement `_ = A`. For example
+--
+-- > var $ \x ->
+-- >   x `where_` [
+-- >      stmt $ predicate @Src.File x
+-- >   ]
+--
+stmt :: Angle t -> AngleStatement
+stmt = (wild .=)
+
+infix 1 .=
+infixr 2 `or_`
+infixr 3 .|
+
+class ToExpr a where
+  type Result a
+  toExpr :: a -> Angle (Result a)
+
+instance ToExpr (Angle a) where
+  type Result (Angle a) = a
+  toExpr = id
+
+instance ToExpr AngleStatement where
+  type Result AngleStatement = ()
+  toExpr stmt = sig unit `where_` [stmt]
+
+instance ToExpr [AngleStatement] where
+  type Result [AngleStatement] = ()
+  toExpr stmts = sig unit `where_` stmts
+
+-- | Build an or-pattern, `A | B`
+(.|) :: (Result a ~ Result b, ToExpr a, ToExpr b) => a -> b -> Angle (Result a)
+a .| b = Angle $ OrPattern DSL <$> gen (toExpr a) <*> gen (toExpr b)
+
+-- | Build an or-pattern between statements (deprecated: just use '.|' instead)
+or_ :: [AngleStatement] -> [AngleStatement] -> Angle ()
+or_ = (.|)
+
+-- | Build a key-value pattern, `A -> B`
+(.->) :: Angle a -> Angle b -> Angle c
+a .-> b = Angle $ KeyValue DSL <$> gen a <*> gen b
+
+instance IsString (Angle Text) where
+  fromString s = Angle (pure (String DSL (Text.pack s)))
+
+-- | A string expression. Note that literal strings may be used as Angle
+-- expressions directly if the @OverloadedStrings@ extension is
+-- enabled.
+string :: Text -> Angle Text
+string t = Angle (pure (String DSL t))
+
+nat :: Word64 -> Angle Nat
+nat w = Angle (pure (Nat DSL w))
+
+byte :: Word8 -> Angle Byte
+byte w = Angle (pure (Nat DSL (fromIntegral w)))
+
+-- | HACK: A typeclass to represent enums generated from Angle. This is used
+-- to splice values of these Angle-generated Thrift enum values back into Angle
+-- queries.
+--
+-- Ideally implementations of these should be codegenerated or we should come
+-- up with a better way of embedding enum values in this DSL.
+class AngleEnum a where
+  type AngleEnumTy a
+  enumName :: a -> Text
+
+enum :: AngleEnum a => a -> Angle (AngleEnumTy a)
+enum e = Angle (pure (Enum DSL (enumName e)))
+
+stringPrefix :: Text -> Angle Text
+stringPrefix t = Angle (pure (StringPrefix DSL t))
+
+-- | A query for a literal value of type [byte]
+byteArray :: ByteString -> Angle ByteString
+byteArray b = Angle (pure (String DSL (Text.decodeUtf8 b)))
+
+-- | Build an array expression
+array :: [Angle t] -> Angle [t]
+array xs = Angle $ Array DSL <$> mapM gen xs
+
+-- | Build a tuple
+tuple :: AngleTuple a => a -> Angle (AngleTupleTy a)
+tuple = fromTuple
+
+type SourceField = Angle.Field SpanAngleDSL () SourceRef SourceRef
+
+-- | Match a record. Zero or more of the fields may be matched.
+--
+-- >   rec $
+-- >     field @"abc" x $
+-- >     field @"def" y $
+-- >   end
+--
+rec :: HasFields f (RecordFields t) => Fields f -> Angle t
+rec fs = Angle $ Struct DSL <$> go fs []
+  where
+  go :: forall f . Fields f -> [SourceField] -> State Int [SourceField]
+  go f acc = case f of
+    NoFields -> return acc
+    Field l v rest  -> do
+      v' <- gen v
+      go rest (Angle.Field l v' : acc)
+
+-- ToDo: we will also probably want a way to cast a record to a
+-- subtype, and to emit a type signature.
+
+-- | Match an alternative of a sum type
+--
+-- >   alt @"abc" value .| alt @"def" value
+--
+alt
+  :: forall (l :: Symbol) v r .
+     (KnownSymbol l, HasField l v (SumFields r)) =>
+     Angle v
+  -> Angle r
+alt val = Angle $ do
+  v <- gen val
+  return $ Struct DSL
+    [Angle.Field (Text.pack (symbolVal (Proxy @l))) v]
+
+data Fields :: TFields -> * where
+  NoFields :: Fields 'TNoFields
+  Field :: Text -> Angle v -> Fields fs -> Fields ('TField l v fs)
+
+field
+  :: forall (l :: Symbol) v fs . KnownSymbol l =>
+     Angle v
+  -> Fields fs
+  -> Fields ('TField l v fs)
+field val rest = Field (Text.pack (symbolVal (Proxy @l))) val rest
+
+end :: Fields 'TNoFields
+end = NoFields
+
+wild :: Angle t
+wild = Angle $ pure $ Wildcard DSL
+
+never :: Angle t
+never = Angle $ pure (Variable DSL "never")
+
+-- | Use this when you want a variable to match a nested predicate
+-- rather than its key.
+--
+-- >  var $ \(n :: Angle Hack.Name) ->
+-- >    n `where_` [
+-- >      stmt $ predicate @Hack.MethodDeclaration $
+-- >        rec $
+-- >          field @"name" (asPredicate n) $
+-- >          field @"container"
+-- >             (rec $
+-- >                field @"class_"
+-- >                   (rec (field @"name" "MyClass" end))
+-- >              end) $
+-- >         end
+-- >    ]
+--
+asPredicate :: Angle p -> Angle (KeyType p)
+asPredicate (Angle a) = Angle a
+
+-- | Sometimes the Angle typechecker needs a type signature.
+-- This adds a type signature for any Angle type.
+sig :: forall p. Type p => Angle p -> Angle p
+sig a = Angle $ do
+  ta <- gen a
+  return $ TypeSignature DSL ta $ sourceType (Proxy @p)
+
+class AngleTuple a where
+  type AngleTupleTy a
+  fromTuple :: a -> Angle (AngleTupleTy a)
+
+instance AngleTuple (Angle a, Angle b) where
+  type AngleTupleTy (Angle a, Angle b) = (a,b)
+  fromTuple (a, b) = Angle $ do
+    ta <- gen a
+    tb <- gen b
+    return $ Tuple DSL [ta,tb]
+
+instance AngleTuple (Angle a, Angle b, Angle c) where
+  type AngleTupleTy (Angle a, Angle b, Angle c) = (a,b,c)
+  fromTuple (a,b,c) = Angle $ do
+    ta <- gen a
+    tb <- gen b
+    tc <- gen c
+    return $ Tuple DSL [ta,tb,tc]
+
+instance AngleTuple (Angle a, Angle b, Angle c, Angle d) where
+  type AngleTupleTy (Angle a, Angle b, Angle c, Angle d) = (a,b,c,d)
+  fromTuple (a,b,c,d) = Angle $ do
+    ta <- gen a
+    tb <- gen b
+    tc <- gen c
+    td <- gen d
+    return $ Tuple DSL [ta,tb,tc,td]
+
+instance AngleTuple (Angle a, Angle b, Angle c, Angle d, Angle e) where
+  type AngleTupleTy (Angle a, Angle b, Angle c, Angle d, Angle e) = (a,b,c,d,e)
+  fromTuple (a,b,c,d,e) = Angle $ do
+    ta <- gen a
+    tb <- gen b
+    tc <- gen c
+    td <- gen d
+    te <- gen e
+    return $ Tuple DSL [ta,tb,tc,td,te]
+
+instance AngleTuple (Angle a, Angle b, Angle c, Angle d, Angle e, Angle f) where
+  type AngleTupleTy (Angle a, Angle b, Angle c, Angle d, Angle e, Angle f) =
+    (a,b,c,d,e,f)
+  fromTuple (a,b,c,d,e,f) = Angle $ do
+    ta <- gen a
+    tb <- gen b
+    tc <- gen c
+    td <- gen d
+    te <- gen e
+    tf <- gen f
+    return $ Tuple DSL [ta,tb,tc,td,te,tf]
+
+-- | Build a fact id with an explicit type @$123 : Type.2@
+factId :: forall p. Predicate p => IdOf p -> Angle p
+factId = sig . factId_
+
+-- | Build a fact id without an explicit type, @$ 123@
+factId_ :: forall p. IdOf p -> Angle p
+factId_ = Angle
+  . return
+  . FactId DSL Nothing
+  . fromIntegral
+  . fromFid
+  . idOf
+
+-- | Convert @factIds (1 :| [2,3]) :: NonEmpty (IdOf p)@ into
+-- @($1 : p.v) ++ $2 ++ $3@ for building angle
+-- queries, where @v@ is the version of predicate @p@.
+-- Uses disjuction, and nubOrds the input list
+factIds :: forall p. Predicate p => NonEmpty (IdOf p) -> Angle p
+factIds xs = sig $ foldr1 (.|) (fmap factId_ (nubOrd' xs))
+  where
+    -- Our version of package extra lacks Data.List.NonEmpty.Extra
+    nubOrd' :: Ord a => NonEmpty a -> NonEmpty a
+    nubOrd' = NonEmpty.fromList . List.nubOrd . NonEmpty.toList
+
+-- | Similar to `factIds` but generate an array of ids with the signature of the
+-- first element only. This doesn't nubOrd the input set
+factIdsArray :: forall p. Predicate p => [IdOf p] -> Angle [p]
+factIdsArray [] = array []
+factIdsArray (x:xs) = array (sig (factId_ x) : map factId_ xs)
+
+elementsOf :: Angle [x] -> Angle x
+elementsOf listOfX = Angle $ do
+  xs <- gen listOfX
+  return (ElementsOfArray DSL xs)
+
+arrayPrefix :: NonEmpty (Angle x) -> Angle x
+arrayPrefix pats = Angle $ do
+  pats <- traverse gen pats
+  return (ArrayPrefix DSL pats)
+
+unit :: Angle ()
+unit = Angle $ pure (Struct DSL  [])
+
+if_ :: Angle cond -> Angle a -> Angle a -> Angle a
+if_ cond t e = Angle $ IfPattern DSL <$> gen cond <*> gen t <*> gen e
+
+true :: Angle Bool
+true = Angle $ pure (Variable DSL "true")
+
+false :: Angle Bool
+false = Angle $ pure (Variable DSL "false")
+
+-- | Lift a boolean literal into Angle
+bool :: Bool -> Angle Bool
+bool True = true
+bool False = false
+
+just :: Angle a -> Angle (Maybe a)
+just x = Angle $ do
+  tx <- gen x
+  pure (Struct DSL [Angle.Field "just" tx])
+
+nothing :: Angle (Maybe a)
+nothing = Angle $ pure (Variable DSL "nothing")
+
+{-
+  TODO:
+  | KeyValue (SourcePat_ v t) (SourcePat_ v t)
+-}
+
+-- Primitives
+
+(.+) :: (ToExpr a, ToExpr b, Result a ~ Nat, Result b ~ Nat)
+     => a -> b -> Angle Nat
+a .+ b =
+  Angle $ App DSL (Variable DSL "prim.addNat") <$>
+  sequence [gen $ toExpr a, gen $ toExpr b]
+
+zipp :: Angle [a] -> Angle [b] -> Angle [(a,b)]
+zipp a b =
+  Angle $ App DSL (Variable DSL "prim.zip") <$>
+  sequence [gen a, gen b]
+
+conc :: Angle [a] -> Angle [a] -> Angle [a]
+conc a b =
+  Angle $ App DSL (Variable DSL "prim.concat") <$>
+  sequence [gen a, gen b]
+
+-- -----------------------------------------------------------------------------
+-- Special queries
+
+-- | Query only new facts of the given predicate, i.e. facts in the
+-- topmost DB in the stack.
+--
+-- (This is a special-purpose query tool for building incremental fact
+-- derivers)
+new :: Predicate p => Angle p -> Angle p
+new = specialPredicateQuery "new"
+
+-- | Query only old facts of the given predicate, i.e. facts from all
+-- but the topmost DB in the stack.
+--
+-- (This is a special-purpose query tool for building incremental fact
+-- derivers)
+old :: Predicate p => Angle p -> Angle p
+old = specialPredicateQuery "old"
+
+specialPredicateQuery :: Predicate p => Text -> Angle p -> Angle p
+specialPredicateQuery suffix (Angle pat) = Angle $ do
+  p <- pat
+  case p of
+    App DSL (Variable DSL p) args ->
+      return $ App DSL (Variable DSL (p <> "#" <> suffix)) args
+    _ -> error ": not a predicate"
+
+-- -----------------------------------------------------------------------------
+-- Type checking for records and sum types
+
+-- | Maps a Thrift-generated record type to its fields
+type family RecordFields t :: TFields
+
+-- | Maps a Thrift-generated union type to its fields
+type family SumFields t :: TFields
+
+-- | @HasFields f t@ asserts that all the fields @f@ are present in
+-- @t@, in any order.
+class HasFields (f :: TFields) (t :: TFields)
+
+instance HasFields 'TNoFields f
+instance (HasField l v f, HasFields r f) => HasFields ('TField l v r) f
+
+-- | @HasField l v f@ asserts that field @l@ is present in @f@ with type @v@
+class HasField (l :: Symbol) v (f :: TFields)
+
+instance {-# OVERLAPPING #-} (v ~ v') => HasField l v ('TField l v' f)
+instance HasField l v f => HasField l v ('TField l' v' f)
+
+data TFields where
+  TNoFields :: TFields
+  TField :: Symbol -> v -> TFields -> TFields
diff --git a/glean/hs/Glean/Query/Thrift.hs b/glean/hs/Glean/Query/Thrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Query/Thrift.hs
@@ -0,0 +1,152 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Query.Thrift
+  ( -- * Types
+    Query
+    -- * Perform query
+  , runQuery
+  , runQuery_
+  , runQueryPage
+    -- ** streaming
+  , runQueryMapPages_
+  , runQueryEach
+  , runQueryEachBatch
+    -- * Query combinators
+  , angle
+  , angleData
+  , keys
+  , recursive
+  , limit
+  , limitBytes
+  , limitTime
+  , expanding
+  , store
+  , allFacts
+    -- * Support
+  , displayQuery
+  ) where
+
+import Control.Concurrent.Async
+import Control.Monad
+import Data.Default
+import Data.Maybe
+
+import Util.Log.Text
+
+import Glean.Typed.Binary
+import Glean.Types as Thrift
+import Glean.Backend.Types (Backend(..))
+import Glean.Query.Thrift.Internal
+import Glean.Write.SendBatch
+
+-- | Perform a query, fetching all results
+runQuery_
+  :: forall q backend . (Backend backend)
+  => backend    -- ^ Backend to use to perform the query
+  -> Repo       -- ^ Repo to query
+  -> Query q    -- ^ The query
+  -> IO [q]
+runQuery_ backend repo query = do
+  r <- runQueryEachBatch backend repo query id $
+    \acc page -> return (acc . (page++))
+  return (r [])
+
+-- | Perform a query, fetching results up to the limits specified by
+-- the query ('limit', 'limitBytes', 'limitTime').
+runQuery
+  :: forall q backend . (Backend backend)
+  => backend    -- ^ Backend to use to perform the query
+  -> Repo       -- ^ Repo to query
+  -> Query q    -- ^ The query
+  -> IO ([q], Bool)
+       -- ^ The 'Bool' is 'True' if the query results were truncated
+       -- by a limit (either a user-supplied limit, or one imposed by
+       -- the query server).
+runQuery backend repo query = do
+  (io, cont) <- runQueryPage backend repo Nothing query
+  results <- io
+  return (results, isJust cont)
+
+
+-- | Perform a query, fetching results up to the limits specified by
+-- the query ('limit', 'limitBytes', 'limitTime'), and returning a
+-- continuation to fetch more results if a limit was hit.
+runQueryPage
+  :: forall q backend . (Backend backend)
+  => backend
+  -> Repo
+  -> Maybe UserQueryCont
+  -> Query q
+  -> IO (IO [q], Maybe UserQueryCont)
+
+runQueryPage be repo cont (Query query) = do
+  let
+    query' = query
+      { userQuery_options = Just
+          (fromMaybe def (userQuery_options query))
+            { userQueryOptions_continuation = cont }
+      , userQuery_encodings = [
+          UserQueryEncoding_listbin def,
+          UserQueryEncoding_bin def
+        ]
+      }
+  UserQueryResults{..} <- userQuery be repo query'
+  mapM_ reportUserQueryStats userQueryResults_stats
+  mapM_ (vlog 1) userQueryResults_diagnostics
+  mapM_ (waitBatch be) userQueryResults_handle
+  let results = decodeResults userQueryResults_results decodeAsFact
+  return (results, userQueryResults_continuation)
+
+
+-- | Perform a query and map an IO function over the results, running the
+-- query over multiple pages of results if necessary.
+runQueryMapPages_
+  :: forall q backend . (Backend backend)
+  => backend
+  -> Repo
+  -> ([q] -> IO ())
+  -> Query q
+  -> IO ()
+runQueryMapPages_ be repo fn query =
+  runQueryEachBatch be repo query () (const fn)
+
+-- | Perform a query, by pages, and map a state function over each
+-- result in each page. The query is pipelined so that each page of
+-- results are decoded and processed while the next page is being
+-- fetched.
+runQueryEach
+  :: forall q backend s . (Backend backend)
+  => backend
+  -> Repo
+  -> Query q
+  -> s
+  -> (s -> q -> IO s)
+  -> IO s
+runQueryEach be repo query s fn =
+  runQueryEachBatch be repo query s (foldM fn)
+
+-- | Like runQueryEach, but process results in batches.
+runQueryEachBatch
+  :: forall q backend s . (Backend backend)
+  => backend
+  -> Repo
+  -> Query q
+  -> s
+  -> (s -> [q] -> IO s)
+  -> IO s
+runQueryEachBatch be repo query init f = do
+  (page, cont) <- runQueryPage be repo Nothing query
+  go page cont init
+  where
+  go page Nothing s = f s =<< page
+  go page cont@Just{} s = do
+    ((nextPage, nextCont), s2) <- concurrently
+      (runQueryPage be repo cont query)
+      (f s =<< page)
+    go nextPage nextCont s2
diff --git a/glean/hs/Glean/Query/Thrift/Internal.hs b/glean/hs/Glean/Query/Thrift/Internal.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Query/Thrift/Internal.hs
@@ -0,0 +1,241 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE TypeFamilyDependencies #-}
+{-# LANGUAGE InstanceSigs #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+-- | Define internal pieces, please import "Glean.Query.Thrift" instead
+module Glean.Query.Thrift.Internal
+  ( -- * Types
+    Query(..)
+    -- * Query combinators
+  , angle
+  , angleData
+  , keys
+  , recursive
+  , limit
+  , limitBytes
+  , limitTime
+  , store
+  , allFacts
+  , expanding
+    -- * Support
+  , reportUserQueryStats
+  , showUserQueryStats
+  , displayQuery
+  , decodeResults
+  , justCheck
+  , dbgPredHasFacts
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.IO.Class
+import Data.Default
+import Data.Dynamic
+import Data.Hashable
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.IORef
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Proxy
+import Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter hiding ((<>))
+import qualified Data.Vector as Vector
+import Text.Printf
+
+import Util.Log
+
+import Glean.Typed as Typed
+import Glean.Types as Thrift
+
+type ResultDecoder a =
+     IntMap Thrift.Fact               -- ^ serialized nested facts
+  -> IORef (IntMap Dynamic)           -- ^ cached deserialized facts
+  -> IdOf a
+  -> Thrift.Fact
+  -> IO a
+
+-- | A query that can be performed by 'runQuery'. Build using 'query'.
+data Query a = Type a => Query
+  { querySpec :: UserQuery
+  }
+
+instance Show (Query a) where
+  show (Query spec) = show spec
+
+instance Eq (Query a) where
+  Query spec1 == Query spec2 = spec1 == spec2
+
+instance Hashable (Query a) where
+  hashWithSalt salt (Query spec) = hashWithSalt salt spec
+
+decodeResults :: UserQueryEncodedResults -> ResultDecoder a -> IO [a]
+decodeResults results decoder =
+  case results of
+    UserQueryEncodedResults_bin UserQueryResultsBin{..} -> do
+      cacheRef <- newIORef IntMap.empty
+      let serialized = IntMap.fromList
+            [ (fromIntegral id,f)
+            | (id,f) <- Map.toList userQueryResultsBin_nestedFacts ]
+      forM (Map.toList userQueryResultsBin_facts) $ \(fid, fact) -> do
+        liftIO $ decoder serialized cacheRef (Typed.IdOf (Fid fid)) fact
+
+    UserQueryEncodedResults_listbin UserQueryResultsListBin{..} -> do
+      cacheRef <- newIORef IntMap.empty
+      let serialized = IntMap.fromList
+            [ (fromIntegral id,f)
+            | (id,f) <- Map.toList userQueryResultsListBin_nestedFacts ]
+          fids = Vector.toList userQueryResultsListBin_ids
+          facts = Vector.toList userQueryResultsListBin_facts
+          f fid fact = liftIO $
+            decoder serialized cacheRef (Typed.IdOf (Fid fid)) fact
+      zipWithM f fids facts
+
+    _other -> throwIO $ ErrorCall
+      "runQueryPage: server returned the wrong encoding"
+
+-- | A human-readable form of the Query.
+displayQuery :: Query a -> Text
+displayQuery (Query UserQuery{..}) = Text.decodeUtf8 userQuery_query
+
+allFacts :: forall q . (Predicate q) => Query q
+allFacts = angle $ Text.pack $
+  show (pretty (getName (Proxy :: Proxy q))) <> " _"
+
+-- | Build a query for facts using Angle syntax
+--
+-- Warning: nothing is checking that the type of the query matches the
+-- expected type at the callsite. If you get this wrong, undefined
+-- behaviour will ensue.
+angle :: forall r. (Predicate r) => Text -> Query r
+angle q = Query
+  { querySpec = angleQuery (getName (Proxy @r)) q
+  }
+
+-- | Fetch just the keys of the given fact query
+keys :: (Predicate r) => Query r -> Query (KeyType r)
+keys (Query spec) = Query { querySpec = spec }
+
+angleQuery :: PredicateRef -> Text -> UserQuery
+angleQuery pref query = def
+  { userQuery_predicate = predicateRef_name pref
+  , userQuery_predicate_version =
+    Just (fromIntegral (predicateRef_version pref))
+  , userQuery_query = Text.encodeUtf8 query
+  , userQuery_options = Just def
+    { userQueryOptions_expand_results = False
+    , userQueryOptions_syntax = QuerySyntax_ANGLE
+    }
+  }
+
+-- | A query for arbitrary data, as opposed to 'angle' which queries
+-- for facts.
+--
+-- For example:
+--
+-- > angleData "{ 3, false }" :: Query (Nat, Bool)
+--
+-- Warning: nothing is checking that the type of the query matches the
+-- expected type at the callsite. If you get this wrong, undefined
+-- behaviour will ensue.
+angleData :: (Type r) => Text -> Query r
+angleData query = Query { querySpec = spec  }
+  where
+  spec = def
+    { userQuery_query = Text.encodeUtf8 query
+    , userQuery_options = Just def
+      { userQueryOptions_expand_results = False
+      , userQueryOptions_syntax = QuerySyntax_ANGLE
+      }
+    }
+
+-- | Make a query recursive
+recursive :: Query a -> Query a
+recursive (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+    { userQueryOptions_recursive = True } }
+
+-- | Instead of 'recursive', pick individual predicates to expand in
+-- the result
+--
+-- e.g.
+--   expanding @My.Predicate1 $ expanding @My.Predicate2 $ query ...
+--
+expanding :: forall p a . Predicate p => Query a -> Query a
+expanding (Query q) = Query q'
+  where
+  old = fromMaybe def (userQuery_options q)
+  PredicateRef name version = getName (Proxy @p)
+  ref = Thrift.SourcePredicate name (Just version)
+  q' = q { userQuery_options = Just old
+    { userQueryOptions_expand_predicates =
+       ref : userQueryOptions_expand_predicates old }}
+
+-- | Set a limit on the number of results returned by a query. This controls
+-- query result page size when streaming.
+limit :: Int -> Query a -> Query a
+limit n (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+    { userQueryOptions_max_results = Just (fromIntegral n) } }
+
+-- | Set a limit on the size of data returned by a query. This
+-- controls query result page size when streaming.
+limitBytes :: Int -> Query a -> Query a
+limitBytes n (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+    { userQueryOptions_max_bytes = Just (fromIntegral n) } }
+
+-- | Set a limit on the time that a query can execute for. When streaming,
+-- this imposes a time budget on each query page.
+limitTime
+  :: Int  -- ^ time budget in milliseconds
+  -> Query a -> Query a
+limitTime n (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+    { userQueryOptions_max_time_ms = Just (fromIntegral n) } }
+
+-- | Store derived facts arising from the query. This is intended for
+-- caching derived facts after creating a DB, not for normal usage. If
+-- the datbase is read-only, this will cause the query to fail.
+store :: Query a -> Query a
+store (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+    { userQueryOptions_store_derived_facts = True } }
+
+justCheck :: Query a -> Query a
+justCheck (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+  { userQueryOptions_just_check = True } }
+
+dbgPredHasFacts :: Query a -> Query a
+dbgPredHasFacts (Query q) = Query q'
+  where
+  q' = q { userQuery_options = Just (fromMaybe def (userQuery_options q))
+  { userQueryOptions_debug = def {queryDebugOptions_pred_has_facts = True}}}
+
+reportUserQueryStats :: Thrift.UserQueryStats -> IO ()
+reportUserQueryStats stats =
+  vlog 1 $ showUserQueryStats stats
+
+showUserQueryStats :: Thrift.UserQueryStats -> String
+showUserQueryStats Thrift.UserQueryStats{..} =
+  printf "%d facts, %.2fms, %ld bytes\n"
+    userQueryStats_num_facts
+    (realToFrac userQueryStats_elapsed_ns / 1000000 :: Double)
+    userQueryStats_allocated_bytes
diff --git a/glean/hs/Glean/RTS.hs b/glean/hs/Glean/RTS.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS.hs
@@ -0,0 +1,310 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DerivingStrategies #-}
+module Glean.RTS (
+  Fid(..), lowestFid,
+  Pid(..), lowestPid,
+
+  withValue,
+  toValue, fromValue,
+  encodeByteArray,
+  mangleString,
+
+  ByteStringRef(..), unsafeWithByteStringRef, derefByteString,
+  MangledStringRef(..), unsafeWithMangledStringRef, demangle,
+  Decoder, DecodingException(..), withDecoder,
+  dByte, dNat,
+  dTrustedStringRef, dString,
+  dArray, dSet, dByteStringRef, dBytes,
+  dSelector, dFact,
+
+  glean_push_value_byte,
+  glean_push_value_nat,
+  glean_push_value_string,
+  glean_push_value_array,
+  glean_push_value_set,
+  glean_push_value_bytes,
+  glean_push_value_selector,
+  glean_push_value_fact,
+
+  glean_push_fact,
+
+  glean_pop_value_byte,
+  glean_pop_value_nat,
+  glean_pop_value_string,
+  glean_pop_value_array,
+  glean_pop_value_set,
+  glean_pop_value_bytes,
+  glean_pop_value_selector,
+  glean_pop_value_fact,
+) where
+
+import Data.Word
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Marshal.Alloc
+import Foreign.Ptr
+import Foreign.Storable
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.ST
+import Control.Monad.ST.Unsafe
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Unsafe as BS
+import System.IO.Unsafe (unsafePerformIO)
+
+import qualified Util.FFI as FFI
+import Util.List (uniq)
+
+import qualified Glean.FFI as FFI
+import Glean.RTS.Builder
+import Glean.RTS.Types
+import Glean.RTS.Term
+
+withValue :: Value -> (Builder -> IO a) -> IO a
+withValue v f = withBuilder $ \b -> do
+  encodeValue b v
+  f b
+
+encodeValue :: Builder -> Value -> IO ()
+encodeValue b (Byte n) = FFI.call $ glean_push_value_byte b n
+encodeValue b (Nat n) = FFI.call $ glean_push_value_nat b n
+encodeValue b (Array xs) = do
+  FFI.call $ glean_push_value_array b $ fromIntegral $ length xs
+  mapM_ (encodeValue b) xs
+encodeValue b (ByteArray xs) = encodeByteArray b xs
+encodeValue b (Tuple xs) = mapM_ (encodeValue b) xs
+encodeValue b (Alt n x) = do
+  FFI.call $ glean_push_value_selector b $ fromIntegral n
+  encodeValue b x
+encodeValue b (String s) = FFI.unsafeWithBytes s $ \p n ->
+  FFI.call $ glean_push_value_string b (castPtr p) n
+encodeValue b (Ref id) = FFI.call $ glean_push_value_fact b id
+
+encodeByteArray :: Builder -> ByteString -> IO ()
+encodeByteArray b xs =
+  BS.unsafeUseAsCStringLen xs $ \(p,n) -> do
+    FFI.call $ glean_push_value_array b (fromIntegral n)
+    FFI.call $ glean_push_value_bytes b (castPtr p) (fromIntegral n)
+
+toValue :: Rep Pid -> ByteString -> Value
+toValue ty bs = runST $ withDecoder bs $ \d -> decodeValue d ty
+
+fromValue :: Value -> ByteString
+fromValue val = unsafePerformIO $ withValue val finishBuilder
+
+-- | A reference to a range of bytes with a context-dependent lifetime.
+data ByteStringRef = ByteStringRef
+  { byteStringRefPtr :: {-# UNPACK #-} !(Ptr Word8)
+  , byteStringRefSize :: {-# UNPACK #-} !CSize
+  }
+
+-- | Execute the action with a reference to the contents of the 'ByteString'.
+unsafeWithByteStringRef :: ByteString -> (ByteStringRef -> IO a) -> IO a
+unsafeWithByteStringRef s f =
+  FFI.unsafeWithBytes s $ \p n -> f $ ByteStringRef (castPtr p) n
+
+-- | Construct a 'ByteString' by copying a range of bytes.
+derefByteString :: ByteStringRef -> IO ByteString
+derefByteString (ByteStringRef p n) = FFI.copyByteString (castPtr p) n
+
+-- | A reference to a range of bytes containing an RTS-mangled string.
+newtype MangledStringRef = MangledStringRef
+  { mangledBytes  :: ByteStringRef
+      -- ^ Byte range including terminator.
+  }
+
+-- | Construct a 'MangledStringRef' from a 'ByteString' containing the mangled
+-- bytes. The references can't be used outside the function.
+unsafeWithMangledStringRef :: ByteString -> (MangledStringRef -> IO a) -> IO a
+unsafeWithMangledStringRef s f =
+  unsafeWithByteStringRef s $ f . MangledStringRef
+
+-- | Yield the internal representation of a UTF-8 string.
+mangleString :: ByteString -> ByteString
+mangleString s = BS.intercalate "\0\1" (BS.split 0 s) <> "\0\0"
+
+-- | A stateful 'Decoder' for binary values.
+data Decoder s = Decoder
+  { decoderPtr :: {-# UNPACK #-} !(Ptr (Ptr ()))
+  , decoderEnd :: {-# UNPACK #-} !(Ptr ())
+  , decoderBuf :: {-# UNPACK #-} !FFI.FFIResultBuf
+  }
+
+newtype DecodingException = DecodingException String
+  deriving newtype Show
+
+instance Exception DecodingException
+
+-- | Create a temporary 'Decoder' for a 'ByteString'.
+withDecoder :: ByteString -> (Decoder s -> ST s a) -> ST s a
+withDecoder bs f = unsafeIOToST $
+  FFI.withFFIResultBuf $ \ !buf ->
+  FFI.unsafeWithBytes bs $ \start len ->
+  alloca $ \pstart -> do
+    poke pstart start
+    let end = start `plusPtr` fromIntegral len
+    res <- unsafeSTToIO $ f Decoder
+      { decoderPtr = pstart
+      , decoderEnd = end
+      , decoderBuf = buf
+      }
+    pos <- peek pstart
+    when (pos /= end) $
+      let extra = show (end `minusPtr` pos) in
+      throwIO $ DecodingException $ "extra "<> extra <>" bytes at end of value"
+    return res
+
+dffi
+  :: Storable a
+  => (Ptr (Ptr ()) -> Ptr () -> Ptr a -> IO CString) -> Decoder s -> ST s a
+{-# INLINE dffi #-}
+dffi f d =
+  unsafeIOToST $ FFI.ffiBuf (decoderBuf d) $ f (decoderPtr d) (decoderEnd d)
+
+dffi2
+  :: (Storable a, Storable b)
+  => (Ptr (Ptr ()) -> Ptr () -> Ptr a -> Ptr b -> IO CString)
+  -> Decoder s
+  -> ST s (a,b)
+{-# INLINE dffi2 #-}
+dffi2 f d =
+  unsafeIOToST $ FFI.ffiBuf2 (decoderBuf d) $ f (decoderPtr d) (decoderEnd d)
+
+-- | Obtain the next byte from the 'Decoder'.
+dByte :: Decoder s -> ST s Word8
+dByte = dffi glean_pop_value_byte
+
+-- | Obtain a packed natural number from the 'Decoder'.
+dNat :: Decoder s -> ST s Word64
+dNat = dffi glean_pop_value_nat
+
+-- | Obtain the length of an array from the 'Decoder'.
+dArray :: Decoder s -> ST s CSize
+dArray = dffi glean_pop_value_array
+
+dSet :: Decoder s -> ST s CSize
+dSet = dffi glean_pop_value_set
+
+-- | Obtain a fixed number of bytes from the 'Decoder'. The 'ByteStringRef'
+-- has the same lifetime as the 'Decoder'.
+dByteStringRef :: Decoder s -> CSize -> ST s ByteStringRef
+dByteStringRef d n = do
+  p <- dffi (\s e -> glean_pop_value_bytes_ref s e n) d
+  return $ ByteStringRef p n
+
+-- | Obtain the given number of bytes from the 'Decoder'.
+dBytes :: Decoder s -> CSize -> ST s ByteString
+dBytes d n = do
+  -- TODO: reimplement based on dByteStringRef
+  p <- dffi (\s e -> glean_pop_value_bytes s e n) d
+  unsafeIOToST $ FFI.unsafeMallocedByteString (castPtr p) n
+
+-- | Obtain a selector from the 'Decoder'.
+dSelector :: Decoder s -> ST s CSize
+dSelector = dffi glean_pop_value_selector
+
+-- | Obtain a reference to an RTS-mangled string from the 'Decoder'. The
+-- reference has the same lifetime as the 'Decoder'.
+dTrustedStringRef :: Decoder s -> ST s (MangledStringRef, CSize)
+dTrustedStringRef Decoder{..} = unsafeIOToST $ do
+  start <- peek decoderPtr
+  n <- glean_pop_value_trusted_string_ref decoderPtr decoderEnd
+  end <- peek decoderPtr
+  return
+    ( MangledStringRef
+        { mangledBytes = ByteStringRef
+          { byteStringRefPtr = castPtr start
+          , byteStringRefSize = fromIntegral $ end `minusPtr` start
+          }
+        },
+      n )
+
+
+-- | Obtain a UTF8-encoded string from the 'Decoder'.
+dString :: Decoder s -> ST s ByteString
+dString d = do
+  -- TODO: reimplement based on dStringRef
+  (p,n) <- dffi2 glean_pop_value_string d
+  unsafeIOToST $ FFI.unsafeMallocedByteString (castPtr p) n
+
+-- | Obtain a fact id from the 'Decoder'.
+dFact :: Decoder s -> ST s Fid
+dFact = dffi glean_pop_value_fact
+
+demangle :: MangledStringRef -> Ptr Word8 -> IO CSize
+demangle (MangledStringRef (ByteStringRef p n)) q =
+  glean_string_demangle_trusted p n q
+
+-- | Decode a binary value. We allocate a single slot to hold results and reuse
+-- it for every decoding step, which is a lot more efficient.
+decodeValue :: Decoder s -> Rep Pid -> ST s (Term Fid)
+decodeValue d ty = case ty of
+  ByteRep -> Byte <$> dByte d
+  NatRep -> Nat <$> dNat d
+  ArrayRep elty -> do
+    size <- dArray d
+    case elty of
+      ByteRep -> ByteArray <$> dBytes d size
+      _ -> Array <$> replicateM (fromIntegral size) (decodeValue d elty)
+  TupleRep tys -> Tuple <$> mapM (decodeValue d) tys
+  SumRep tys -> do
+    sel <- dSelector d
+    Alt (fromIntegral sel) <$> decodeValue d (tys !! fromIntegral sel)
+  SetRep elty -> do
+    size <- dSet d
+    Array . uniq <$> replicateM (fromIntegral size) (decodeValue d elty)
+  StringRep -> String <$> dString d
+  PredicateRep _ -> Ref <$> dFact d
+
+foreign import ccall unsafe glean_push_value_byte
+  :: Builder -> Word8 -> IO CString
+foreign import ccall unsafe glean_push_value_nat
+  :: Builder -> Word64 -> IO CString
+foreign import ccall unsafe glean_push_value_array
+  :: Builder -> CSize -> IO CString
+foreign import ccall unsafe glean_push_value_set
+  :: Builder -> CSize -> IO CString
+foreign import ccall unsafe glean_push_value_bytes
+  :: Builder -> Ptr Word8 -> CSize -> IO CString
+foreign import ccall unsafe glean_push_value_selector
+  :: Builder -> CSize -> IO CString
+foreign import ccall unsafe glean_push_value_string
+  :: Builder -> Ptr Word8 -> CSize -> IO CString
+foreign import ccall unsafe glean_push_value_fact
+  :: Builder -> Fid -> IO CString
+
+foreign import ccall unsafe glean_pop_value_byte
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr Word8 -> IO CString
+foreign import ccall unsafe glean_pop_value_nat
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr Word64 -> IO CString
+foreign import ccall unsafe glean_pop_value_array
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr CSize -> IO CString
+foreign import ccall unsafe glean_pop_value_set
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr CSize -> IO CString
+foreign import ccall unsafe glean_pop_value_bytes_ref
+  :: Ptr (Ptr ()) -> Ptr () -> CSize -> Ptr (Ptr Word8) -> IO CString
+foreign import ccall unsafe glean_pop_value_bytes
+  :: Ptr (Ptr ()) -> Ptr () -> CSize -> Ptr (Ptr Word8) -> IO CString
+foreign import ccall unsafe glean_pop_value_selector
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr CSize -> IO CString
+foreign import ccall unsafe glean_pop_value_trusted_string_ref
+  :: Ptr (Ptr ()) -> Ptr () -> IO CSize
+foreign import ccall unsafe glean_pop_value_string
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr (Ptr Word8) -> Ptr CSize -> IO CString
+foreign import ccall unsafe glean_pop_value_fact
+  :: Ptr (Ptr ()) -> Ptr () -> Ptr Fid -> IO CString
+
+foreign import ccall unsafe glean_push_fact
+  :: Builder -> Pid -> Builder -> CSize -> IO CString
+
+foreign import ccall unsafe glean_string_demangle_trusted
+  :: Ptr Word8 -> CSize -> Ptr Word8 -> IO CSize
diff --git a/glean/hs/Glean/RTS/Builder.hs b/glean/hs/Glean/RTS/Builder.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Builder.hs
@@ -0,0 +1,59 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Builder
+  ( Builder(..)
+  , withBuilder
+  , finishBuilder
+  , newBuilder
+  , sizeOfBuilder
+  , freeBuilder
+  , resetBuilder
+  ) where
+
+import Control.Monad.Catch
+import Control.Monad.IO.Class
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Unsafe as BS
+import Foreign
+import Foreign.C
+
+import qualified Util.FFI as FFI
+
+newtype Builder = Builder (Ptr Builder)
+  deriving(Storable)
+
+withBuilder :: (MonadMask m, MonadIO m) => (Builder -> m a) -> m a
+withBuilder = bracket (liftIO newBuilder) (liftIO . freeBuilder)
+
+finishBuilder :: Builder -> IO ByteString
+finishBuilder b = do
+  (p,n) <- FFI.invoke $ glean_finish_builder b
+  BS.unsafePackMallocCStringLen (castPtr p, fromIntegral n)
+
+sizeOfBuilder :: Builder -> IO CSize
+sizeOfBuilder = glean_builder_size
+
+newBuilder :: IO Builder
+newBuilder = FFI.invoke glean_new_builder
+
+-- | release the current contents of the Builder and reinitialise it
+-- to empty.  A bit cheaper than freeing and allocating a new Builder,
+resetBuilder :: Builder -> IO ()
+resetBuilder b = FFI.invoke $ glean_reset_builder b
+
+foreign import ccall unsafe glean_new_builder
+  :: Ptr Builder -> IO CString
+foreign import ccall unsafe "glean_free_builder" freeBuilder
+  :: Builder -> IO ()
+foreign import ccall unsafe glean_builder_size
+  :: Builder -> IO CSize
+foreign import ccall unsafe glean_finish_builder
+  :: Builder -> Ptr (Ptr Word8) -> Ptr CSize -> IO CString
+foreign import ccall unsafe glean_reset_builder
+  :: Builder -> IO ()
diff --git a/glean/hs/Glean/RTS/Bytecode/Code.hs b/glean/hs/Glean/RTS/Bytecode/Code.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Code.hs
@@ -0,0 +1,501 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Bytecode.Code
+  ( Code
+  , Register
+  , Label
+  , CodeGen
+  , OutputSupply
+  , Many(..)
+  , Optimised(..)
+  , Meta(..)
+  , literal
+  , label
+  , issue
+  , issueEndBlock
+  , constant
+  , local
+  , output
+  , outputUninitialized
+  , generate
+  , castRegister
+  , callSite
+  , calledFrom
+  , fullScan
+  , vlog
+  ) where
+
+import Control.Exception (assert)
+import Control.Monad
+import Control.Monad.Fix (MonadFix(..))
+import Control.Monad.ST (ST, runST)
+import Control.Monad.Trans
+import qualified Control.Monad.Trans.State.Strict as S
+import Data.Bits
+import Data.ByteString (ByteString)
+import Data.Functor
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.IntSet (IntSet)
+import qualified Data.IntSet as IntSet
+import Data.List (mapAccumL, sortBy)
+import Data.Maybe
+import Data.Ord
+import qualified Data.Vector as V
+import qualified Data.Vector.Primitive as VP
+import qualified Data.Vector.Primitive.Mutable as VPM
+import qualified Data.Vector.Storable as VS
+import Data.Word (Word64)
+import GHC.Stack
+import qualified Util.Log as Log
+
+import Glean.Bytecode.Types
+import Glean.RTS.Types (Pid)
+import Glean.RTS.Bytecode.Gen.Instruction
+import Glean.RTS.Bytecode.Supply
+import Glean.RTS.Foreign.Bytecode (Subroutine, subroutine)
+
+-- | A basic block
+newtype Block = Block
+  { -- | Instructions (reversed)
+    blockInsns :: [Insn]
+  }
+
+data CodeS = CodeS
+  { -- | Label of current block
+    csLabel :: {-# UNPACK #-} !Label
+
+    -- | Instructions in current block (reversed)
+  , csInsns :: [Insn]
+
+    -- | Blocks produced so far (reversed)
+  , csBlocks :: [Block]
+
+    -- | All constant values used by the subroutine. These will be preloaded
+    -- into registers at the start.
+  , csConstants :: [Word64]
+
+    -- | Cached `length csConstants`
+  , csNextConstant :: !(Register 'Word)
+
+    -- | Map known constants to their registers
+  , csConstantMap :: IntMap (Register 'Word)
+
+    -- | All literals in the subroutine.
+  , csLiterals :: HashMap ByteString Word64
+
+    -- | Cached `length csLiterals`
+  , csLiteralsSize :: !Word64
+
+    -- | Currently used number of local registers
+  , csNextLocal :: {-# UNPACK #-} !(Register 'Word)
+
+    -- | Maximum number of local registers used so far
+  , csMaxLocal :: {-# UNPACK #-} !(Register 'Word)
+
+    -- | Currently used number of binary::Output registers
+  , csNextOutput :: {-# UNPACK #-} !(Register 'BinaryOutputPtr)
+
+    -- | Maximum number of binary::Output registers
+  , csMaxOutputs :: {-# UNPACK #-} !(Register 'BinaryOutputPtr)
+
+    -- | Predicates we perform full scans on.
+    -- Repeated entries mean multiple scans of the same predicate
+  , csFullScans:: [Pid]
+  }
+
+-- | Code gen monad
+newtype Code a = Code { runCode :: S.StateT CodeS IO a }
+  deriving(Functor, Applicative, Monad, MonadFix)
+
+-- | Things that generate code of the form
+-- > Register t1 -> ... -> Register tn -> Code a
+--
+class CodeGen s cg where
+  genCode :: cg -> S.State s (Code (CodeResult cg))
+
+instance CodeGen s (Code a) where
+  genCode = pure
+
+instance (Supply a s, CodeGen s cg) => CodeGen s (a -> cg) where
+  genCode f = S.state supply >>= genCode . f
+
+-- | Allocate `n` registers where `n` isn't statically known.
+-- Example:
+--
+-- local $ Many n $ \regs -> ...
+data Many a cg = Many Int ([a] -> cg)
+
+instance (Supply a s, CodeGen s cg) => CodeGen s (Many a cg) where
+  genCode (Many n f) = replicateM n (S.state supply) >>= genCode . f
+
+type family CodeResult cg
+type instance CodeResult (Code a) = a
+type instance CodeResult (a -> cg) = CodeResult cg
+type instance CodeResult (Many a cg) = CodeResult cg
+
+-- | Load a constant value into a register. This will happen at the start of
+-- the subroutine, effectively giving us a poor man's version of constant
+-- hoisting.
+constant :: Word64 -> Code (Register 'Word)
+constant w = Code $ do
+  s@CodeS{..} <- S.get
+  case IntMap.lookup (fromIntegral w) csConstantMap of
+    Just r -> return r
+    Nothing -> do
+      S.put s
+        { csConstants = w : csConstants
+        , csNextConstant = succ csNextConstant
+        , csConstantMap =
+            IntMap.insert (fromIntegral w) csNextConstant csConstantMap
+        }
+      return csNextConstant
+
+-- | Generate a chunk of code with reserved fresh registers. The registers can
+-- be reused afterwards.
+local :: CodeGen RegSupply cg => cg -> Code (CodeResult cg)
+local = runLocal
+  regSupply
+  csNextLocal
+  (\r s -> s { csNextLocal = r })
+  (\r s -> s { csMaxLocal = max (csMaxLocal s) r })
+
+-- | Supply of @Register 'BinaryOutputPtr@ (cf. 'output').
+newtype OutputSupply = OutputSupply RegSupply
+  deriving (Supply (Register 'BinaryOutputPtr))
+
+-- | Declare registers of type @Register 'BinaryOutputPtr@.  The registers
+-- are inputs to the subroutine. Use 'resetOutput' to reset the byte array
+-- stored in these registers to empty.
+outputUninitialized :: CodeGen OutputSupply cg => cg -> Code (CodeResult cg)
+outputUninitialized = runLocal
+  (OutputSupply . regSupply)
+  csNextOutput
+  (\r s -> s { csNextOutput = r })
+  (\r s -> s { csMaxOutputs = max (csMaxOutputs s) r })
+
+output :: (Register 'BinaryOutputPtr -> Code a) -> Code a
+output f = outputUninitialized $ \out -> do
+  issue $ ResetOutput out
+  f out
+
+runLocal
+  :: (Supply r s, CodeGen s cg)
+  => (r -> s)
+  -> (CodeS -> r)
+  -> (r -> CodeS -> CodeS)
+  -> (r -> CodeS -> CodeS)
+  -> cg
+  -> Code (CodeResult cg)
+runLocal make get set setmax cg = do
+  r <- Code $ S.gets get
+  let (gen, sup) = S.runState (genCode cg) $ make r
+      !next = peekSupply sup
+  Code $ S.modify' $ setmax next . set next
+  x <- gen
+  Code $ S.modify' $ set r
+  return x
+
+-- | Poor man's function calls
+--
+-- * Put the label of the return address into a register with
+--   'loadReg', jump to the code, and return with 'jumpReg'.
+--
+-- * We have to avoid local registers at the call site(s) clashing
+--   with local registers in the called code.  So 'callSite' remembers
+--   the number of locals in scope at the call site(s) and
+--   'calledCode' uses the high-water mark of the call sites as the
+--   base for its local registers.
+--
+data CallSite = CallSite
+  { callSiteNextLocal :: Register 'Word
+  , callSiteNextOutput :: Register 'BinaryOutputPtr
+  }
+
+callSite :: Code CallSite
+callSite = do
+  CodeS{..} <- Code S.get
+  return (CallSite csNextLocal csNextOutput)
+
+calledFrom :: [CallSite] -> Code a -> Code a
+calledFrom frames inner = do
+  CodeS{..} <- Code S.get
+  Code $ S.modify' $ \s -> s
+    { csNextLocal = maximum (map callSiteNextLocal frames)
+    , csNextOutput = maximum (map callSiteNextOutput frames) }
+  x <- inner
+  Code $ S.modify' $ \s -> s
+    { csNextLocal = csNextLocal
+    , csNextOutput = csNextOutput }
+  return x
+
+-- | Register that a query statement performs a full scan over a predicate.
+fullScan :: Pid -> Code ()
+fullScan pid = Code $ S.modify' $ \s -> s { csFullScans = pid : csFullScans s }
+
+data Optimised = Optimised | Unoptimised
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+-- | Metadata about the subroutine
+newtype Meta = Meta
+  { meta_fullScans :: [Pid]
+  }
+
+-- | Generate a 'Subroutine', allocating input registers as necessary.
+-- Example:
+--
+-- generate $ \reg1 reg2 -> do
+--   add reg1 reg2 reg1
+--   ret
+--
+generate
+  :: (CodeGen RegSupply cg, CodeResult cg ~ ())
+  => Optimised -> cg -> IO (Meta, Subroutine t)
+generate opt cg = do
+  let (gen, sup) = S.runState (genCode cg) $ regSupply $ register Input 0
+      !nextInput = peekSupply sup
+  ((), CodeS{..}) <- S.runStateT (runCode gen) CodeS
+        { csLabel = Label 0
+        , csInsns = []
+        , csBlocks = []
+        , csConstants = []
+        , csConstantMap = IntMap.empty
+        , csNextConstant = register Constant 0
+        , csLiterals = HashMap.empty
+        , csLiteralsSize = 0
+        , csNextLocal = register Local 0
+        , csMaxLocal = register Local 0
+        , csNextOutput = castRegister nextInput
+        , csMaxOutputs = castRegister nextInput
+        , csFullScans = mempty }
+      -- sanity check
+  when (not $ null csInsns) $ fail "unterminated basic block"
+  let -- output registers go after input registers
+      finalInputSize = registerIndex csMaxOutputs
+      constantsSize = registerIndex csNextConstant
+      get_label pc label =
+        let addr = offsets VP.! fromLabel label
+        in assert (addr /= maxBound) $ addr - pc
+      get_reg :: forall ty . Register ty -> Word64
+      get_reg r = case registerSegment r of
+        Input -> assert (n < finalInputSize) n
+        Constant -> assert (n < constantsSize) (n + finalInputSize)
+        Local -> n + finalInputSize + constantsSize
+        where
+          !n = registerIndex r
+      optimise = case opt of
+        Optimised -> shortcut
+        Unoptimised -> id
+      (insns, offsets) = layout $ optimise CFG
+        { cfgBlocks = V.fromListN (fromLabel csLabel) $ reverse csBlocks
+        , cfgEntry = Label 0
+        }
+      code = concat $ snd $ mapAccumL
+        (\offset insn ->
+          let !next = offset + insnSize insn
+          in
+          (next, insnWords get_reg (get_label next) insn))
+        0
+        insns
+      meta = Meta csFullScans
+  (meta,) <$> subroutine
+    (VS.fromListN (length code) code)
+    finalInputSize
+    (finalInputSize - registerIndex nextInput)
+    (registerIndex csMaxLocal + constantsSize)
+    (reverse csConstants)
+    (map fst $ sortBy (comparing snd) $ HashMap.toList csLiterals)
+
+
+-- | Control flow graph
+data CFG = CFG
+  { -- | Basic blocks
+    cfgBlocks :: !(V.Vector Block)
+
+    -- | Entry block
+  , cfgEntry :: {-# UNPACK #-} !Label
+  }
+
+-- | Inline blocks containing only one instruction and short-circuit labels
+-- which point to blocks consisting of a single Jump.
+--
+-- NOTE: This will leave behind unreachable blocks.
+shortcut :: CFG -> CFG
+shortcut cfg@CFG{..}
+  | V.all isNothing shortcuts = cfg
+  | otherwise = CFG
+      { cfgBlocks = V.imap
+          (\i Block{..} ->
+              Block { blockInsns = mapLabels relabel <$> inline i blockInsns })
+          cfgBlocks
+      , cfgEntry = relabel cfgEntry
+      }
+  where
+    inline i _
+      | Just insn <- shortcuts V.! i = [insn]
+    inline _ (Jump target : insns)
+      | Just insn <- shortcuts V.! fromLabel target = insn : insns
+    inline _ insns = insns
+
+    -- FIXME: This can loop if the generated code contains infinite loops
+    shortcuts = cfgBlocks <&> \Block{..} -> case blockInsns of
+      [insn] -> Just $ case insn of
+        Jump target | Just insn' <- shortcuts V.! fromLabel target -> insn'
+        _ -> insn
+      _ -> Nothing
+
+    relabel label
+      | Just (Jump target) <- shortcuts V.! fromLabel label = target
+      | otherwise = label
+
+data Layout s = Layout
+  { -- | Current offset in the instruction stream
+    layoutOffset :: {-# UNPACK #-} !Word64
+
+    -- | Label offsets, 'maxBound' for blocks which haven't been emitted yet
+  , layoutLabels :: !(VPM.STVector s Word64)
+
+    -- | Insn stream (all reversed)
+  , layoutInsns :: [[Insn]]
+
+    -- | Blocks we want to emit (some of them might have been emitted already)
+  , layoutTodo :: !IntSet
+  }
+
+-- | Compute a flat instruction stream for a subroutine as well as a mapping
+-- from labels to their offsets in that stream. Note that we don't emit
+-- unreachable blocks - a block that hasn't been emitted because it's dead will
+-- have the magic value of maxBound in the label->offset mapping.
+--
+-- This is really simple at the moment.
+--
+-- * Start with the entry block.
+-- * If the current block ends with an unconditional jump and the block it jumps
+--   to hasn't been emitted yet, continue with that block, thus saving the jump.
+-- * Otherwise, continue with the unemitted block with lowest label number.
+--
+-- There is obviously ample room for improvement here.
+layout :: CFG -> ([Insn], VP.Vector Word64)
+layout CFG{..} = runST $ do
+  mlabels <- VPM.replicate (V.length cfgBlocks) maxBound
+  emit cfgEntry Layout
+    { layoutOffset = 0
+    , layoutLabels = mlabels
+    , layoutInsns = []
+    , layoutTodo = IntSet.empty
+    }
+  where
+    -- Emit a specific block which must not have been emitted already
+    emit :: Label -> Layout s -> ST s ([Insn], VP.Vector Word64)
+    emit !label layout@Layout{..} = do
+      VPM.write layoutLabels (fromLabel label) layoutOffset
+
+      case blockInsns (cfgBlocks V.! fromLabel label) of
+        -- Handle unconditional jumps specially
+        Jump target : insns -> do
+          s <- stillTodo layout target
+          if s
+            then emit target $ addInsns insns layout
+            else emitNext $ addInsns (Jump target : insns) layout
+
+        insns -> emitNext $ addInsns insns layout
+
+    -- Emit the numerically lowest unemitted block (if any)
+    emitNext :: Layout s -> ST s ([Insn], VP.Vector Word64)
+    emitNext layout@Layout{..}
+      | Just (label, todo) <- IntSet.minView layoutTodo = do
+          s <- stillTodo layout $ Label label
+          (if s then emit (Label label) else emitNext) layout{layoutTodo = todo}
+      | otherwise = do
+          labels <- VP.unsafeFreeze layoutLabels
+          return (reverse $ concat layoutInsns, labels)
+
+    -- Has a block already been emitted
+    stillTodo :: Layout s -> Label -> ST s Bool
+    stillTodo Layout{..} label =
+      (== maxBound) <$> VPM.read layoutLabels (fromLabel label)
+
+    -- Emit instructions
+    addInsns :: [Insn] -> Layout s -> Layout s
+    addInsns insns !layout = layout
+      { layoutOffset = layoutOffset layout + sum (map insnSize insns)
+      , layoutTodo = foldr
+          (IntSet.insert . fromLabel)
+          (layoutTodo layout)
+          (concatMap insnLabels insns)
+      , layoutInsns = insns : layoutInsns layout
+      }
+
+-- | Frame segment which a register belongs to
+data Segment = Input | Constant | Local
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+-- A register has a 'Segment' and an index within the segment, packed into
+-- a word.
+
+-- | Create a register with the given 'Segment' and index
+register :: Segment -> Word64 -> Register a
+register s i = Register $ (fromIntegral (fromEnum s) `shiftL` 62) .|. i
+
+-- | Get the 'Segment' of the register
+registerSegment :: Register a  -> Segment
+registerSegment (Register i) = toEnum $ fromIntegral (i `shiftR` 62)
+
+-- | Get the index of the register within its segment
+registerIndex :: Register a -> Word64
+registerIndex (Register i) = i .&. 0x3FFFFFFFFFFFFFFF
+
+-- | Start a new basic block. The previous block will be terminated by the
+-- supplied unconditional jump instruction or, if none is provided, by a jump
+-- to the new block.
+newBlock :: Maybe Insn -> Code ()
+newBlock terminator = Code $ do
+  s@CodeS{..} <- S.get
+  let !label = succ csLabel
+      insn = fromMaybe (Jump label) terminator
+  S.put $! s
+    { csLabel = label
+    , csInsns = []
+    , csBlocks = Block (insn : csInsns) : csBlocks
+    }
+
+-- | Add a literal to the literal table and yield its index
+literal :: ByteString -> Code Literal
+literal lit = Code $ Literal . fromIntegral <$> do
+  m <- S.gets csLiterals
+  case HashMap.lookup lit m of
+    Just n -> return n
+    Nothing -> do
+      n <- S.gets csLiteralsSize
+      S.modify' $ \s@CodeS{..} -> s
+        { csLiterals = HashMap.insert lit n csLiterals
+        , csLiteralsSize = csLiteralsSize + 1 }
+      return n
+
+-- | Yield a label for the current position in the code
+label :: Code Label
+label = do
+  insns <- Code $ S.gets csInsns
+  when (not $ null insns) $ newBlock Nothing
+  Code $ S.gets csLabel
+
+-- | Issue an instruction which doesn't modify the program counter
+issue :: Insn -> Code ()
+issue insn = Code $ S.modify' $ \s@CodeS{..} -> s { csInsns = insn : csInsns }
+
+-- | Issue an instruction which always modifies the program counter
+issueEndBlock :: Insn -> Code ()
+issueEndBlock = newBlock . Just
+
+-- | Make some noise during code generation. Helpful for debugging.
+--
+vlog :: HasCallStack => String -> Code ()
+vlog msg = Code $ lift (Log.vlog 2 msg)
diff --git a/glean/hs/Glean/RTS/Bytecode/Disassemble.hs b/glean/hs/Glean/RTS/Bytecode/Disassemble.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Disassemble.hs
@@ -0,0 +1,92 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Bytecode.Disassemble
+where
+
+import qualified Data.ByteString as BS
+import Data.Functor
+import qualified Data.IntMap as IntMap
+import qualified Data.IntSet as IntSet
+import Data.List (foldl', mapAccumL)
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Vector.Storable as V
+
+import Glean.Bytecode.Decode as D
+import Glean.Bytecode.Types
+import Glean.RTS.Bytecode.Gen.Instruction
+import Glean.RTS.Foreign.Bytecode
+
+disassemble :: Text -> [String] -> Subroutine s -> [Text]
+disassemble name syscalls sub =
+  [ "Subroutine " <> name
+  , "  // Code: "
+      <> Text.pack (show (length instructions)) <> " insns, "
+      <> Text.pack (show (V.length subInsns)) <> " bytes"
+  , "  // Literals: "
+            <> Text.pack (show $ sum $ map BS.length subLiterals)
+            <> " bytes"
+  , "  #inputs = " <> Text.pack (show subInputs)
+  , "  #outputs = " <> Text.pack (show subOutputs)
+  , "  #locals = " <> Text.pack (show subLocals) ]
+  ++
+  [ "  #" <> Text.pack (show i) <> " = " <> Text.pack (show lit)
+    | (i,lit) <- zip [0 :: Int ..] subLiterals ]
+  ++
+  [ "  %" <> Text.pack (show i) <> " = " <> Text.pack (show c)
+    | (i,c) <- zip [subInputs..] (V.toList subConstants) ]
+  ++
+  [ "" ]
+  ++ code ++
+  [ "*** ERROR ***" | not $ null rest ]
+  where
+    SubroutineCode{..} = inspect sub
+
+    instructions :: [Insn]
+    (instructions, rest) = D.decodeAll $ V.toList subInsns
+
+    labels = snd
+      $ IntMap.mapAccum
+          (\ !i _ -> (i+1, '$' : show i))
+          (0 :: Int)
+      $ IntMap.fromSet (const ())
+      $ snd
+      $ foldl'
+          (\(m, ts) insn ->
+            let !n = m + insnSize insn
+            in
+            ( n
+            , foldr
+                (\o -> IntSet.insert $ fromIntegral n + fromLabel o)
+                ts
+                $ insnLabels insn ))
+          (0, IntSet.empty)
+          instructions
+
+    show_label o (Label k) =
+      fromMaybe (show k) $ IntMap.lookup (fromIntegral o + k) labels
+
+    show_reg (Register n) = '%' : show n
+
+    code :: [Text]
+    code = concat
+      $ snd
+      $ mapAccumL
+        (\ !o insn ->
+          let !o' = o + insnSize insn
+          in
+          ( o'
+          , catMaybes
+              [IntMap.lookup (fromIntegral o) labels
+                <&> \s -> Text.pack s <> ":"]
+            ++
+            [ "  " <> Text.pack (insnShow syscalls (show_label o') show_reg insn) ] ))
+        0
+        instructions
diff --git a/glean/hs/Glean/RTS/Bytecode/Gen/Instruction.hs b/glean/hs/Glean/RTS/Bytecode/Gen/Instruction.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Gen/Instruction.hs
@@ -0,0 +1,369 @@
+-- @generated
+{-# OPTIONS_GHC -Wno-unused-matches #-}
+module Glean.RTS.Bytecode.Gen.Instruction
+  ( Insn(..)
+  , mapLabels
+  , insnLabels
+  , insnSize
+  , insnWords
+  , insnShow
+  ) where
+
+import Data.Word (Word64)
+import Text.Show (showListWith)
+import qualified Glean.Bytecode.Decode as D
+import Glean.Bytecode.Types
+
+data Insn where
+  InputNat :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  InputByte :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  InputBytes :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  InputSkipUntrustedString :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> Insn
+  InputShiftLit :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !Literal -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  InputShiftBytes :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  InputSkipNat :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> Insn
+  InputSkipTrustedString :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> Insn
+  ResetOutput :: {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputNat :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputNatImm :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputByte :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputByteImm :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputBytes :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputStringToLower :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputRelToAbsByteSpans :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputUnpackByteSpans :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  OutputStringReverse :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> Insn
+  GetOutput :: {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> Insn
+  GetOutputSize :: {-# UNPACK #-} !(Register 'BinaryOutputPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  LoadConst :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  LoadLiteral :: {-# UNPACK #-} !Literal -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> Insn
+  Move :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> Insn
+  SubConst :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  Sub :: {-# UNPACK #-} !(Register b) -> {-# UNPACK #-} !(Register a) -> Insn
+  AddConst :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !(Register a) -> Insn
+  Add :: {-# UNPACK #-} !(Register b) -> {-# UNPACK #-} !(Register a) -> Insn
+  PtrDiff :: {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'DataPtr) -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  LoadLabel :: {-# UNPACK #-} !Label -> {-# UNPACK #-} !(Register 'Offset) -> Insn
+  Jump :: {-# UNPACK #-} !Label -> Insn
+  JumpReg :: {-# UNPACK #-} !(Register 'Offset) -> Insn
+  JumpIf0 :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfNot0 :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfEq :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfNe :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfGt :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfGe :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfLt :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  JumpIfLe :: {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !(Register a) -> {-# UNPACK #-} !Label -> Insn
+  DecrAndJumpIfNot0 :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !Label -> Insn
+  DecrAndJumpIf0 :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !Label -> Insn
+  CallFun_0_1 :: {-# UNPACK #-} !(Register ('Fun '[ 'WordPtr ])) -> (Register 'Word) -> Insn
+  CallFun_0_2 :: {-# UNPACK #-} !(Register ('Fun '[ 'WordPtr,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_1_1 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_1_0 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word ])) -> (Register 'Word) -> Insn
+  CallFun_2_1 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_2_0 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word ])) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_3_0 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'Word ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_4_0 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'Word,'Word ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_3_1 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'Word,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_5_0 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'Word,'Word,'Word ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_5_1 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'Word,'Word,'Word,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_2_2 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'WordPtr,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  CallFun_2_5 :: {-# UNPACK #-} !(Register ('Fun '[ 'Word,'Word,'WordPtr,'WordPtr,'WordPtr,'WordPtr,'WordPtr ])) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> (Register 'Word) -> Insn
+  Select :: {-# UNPACK #-} !(Register 'Word) -> [Label] -> Insn
+  Raise :: {-# UNPACK #-} !Literal -> Insn
+  Trace :: {-# UNPACK #-} !Literal -> Insn
+  TraceReg :: {-# UNPACK #-} !Literal -> {-# UNPACK #-} !(Register 'Word) -> Insn
+  Suspend :: {-# UNPACK #-} !(Register 'Word) -> {-# UNPACK #-} !Label -> Insn
+  Ret :: Insn
+
+mapLabels :: (Label -> Label) -> Insn -> Insn
+mapLabels f (LoadLabel lbl dst) = LoadLabel (f lbl) dst
+mapLabels f (Jump tgt) = Jump (f tgt)
+mapLabels f (JumpIf0 reg tgt) = JumpIf0 reg (f tgt)
+mapLabels f (JumpIfNot0 reg tgt) = JumpIfNot0 reg (f tgt)
+mapLabels f (JumpIfEq reg1 reg2 tgt) = JumpIfEq reg1 reg2 (f tgt)
+mapLabels f (JumpIfNe reg1 reg2 tgt) = JumpIfNe reg1 reg2 (f tgt)
+mapLabels f (JumpIfGt reg1 reg2 tgt) = JumpIfGt reg1 reg2 (f tgt)
+mapLabels f (JumpIfGe reg1 reg2 tgt) = JumpIfGe reg1 reg2 (f tgt)
+mapLabels f (JumpIfLt reg1 reg2 tgt) = JumpIfLt reg1 reg2 (f tgt)
+mapLabels f (JumpIfLe reg1 reg2 tgt) = JumpIfLe reg1 reg2 (f tgt)
+mapLabels f (DecrAndJumpIfNot0 reg tgt) = DecrAndJumpIfNot0 reg (f tgt)
+mapLabels f (DecrAndJumpIf0 reg tgt) = DecrAndJumpIf0 reg (f tgt)
+mapLabels f (Select sel tgts) = Select sel (map f tgts)
+mapLabels f (Suspend unused cont) = Suspend unused (f cont)
+mapLabels _ insn = insn
+
+insnLabels :: Insn -> [Label]
+insnLabels (LoadLabel lbl dst) = [lbl]
+insnLabels (Jump tgt) = [tgt]
+insnLabels (JumpIf0 reg tgt) = [tgt]
+insnLabels (JumpIfNot0 reg tgt) = [tgt]
+insnLabels (JumpIfEq reg1 reg2 tgt) = [tgt]
+insnLabels (JumpIfNe reg1 reg2 tgt) = [tgt]
+insnLabels (JumpIfGt reg1 reg2 tgt) = [tgt]
+insnLabels (JumpIfGe reg1 reg2 tgt) = [tgt]
+insnLabels (JumpIfLt reg1 reg2 tgt) = [tgt]
+insnLabels (JumpIfLe reg1 reg2 tgt) = [tgt]
+insnLabels (DecrAndJumpIfNot0 reg tgt) = [tgt]
+insnLabels (DecrAndJumpIf0 reg tgt) = [tgt]
+insnLabels (Select sel tgts) = tgts
+insnLabels (Suspend unused cont) = [cont]
+insnLabels _ = []
+
+insnSize :: Insn -> Word64
+insnSize InputNat{} = 4
+insnSize InputByte{} = 4
+insnSize InputBytes{} = 4
+insnSize InputSkipUntrustedString{} = 3
+insnSize InputShiftLit{} = 5
+insnSize InputShiftBytes{} = 6
+insnSize InputSkipNat{} = 3
+insnSize InputSkipTrustedString{} = 3
+insnSize ResetOutput{} = 2
+insnSize OutputNat{} = 3
+insnSize OutputNatImm{} = 3
+insnSize OutputByte{} = 3
+insnSize OutputByteImm{} = 3
+insnSize OutputBytes{} = 4
+insnSize OutputStringToLower{} = 4
+insnSize OutputRelToAbsByteSpans{} = 4
+insnSize OutputUnpackByteSpans{} = 4
+insnSize OutputStringReverse{} = 4
+insnSize GetOutput{} = 4
+insnSize GetOutputSize{} = 3
+insnSize LoadConst{} = 3
+insnSize LoadLiteral{} = 4
+insnSize Move{} = 3
+insnSize SubConst{} = 3
+insnSize Sub{} = 3
+insnSize AddConst{} = 3
+insnSize Add{} = 3
+insnSize PtrDiff{} = 4
+insnSize LoadLabel{} = 3
+insnSize Jump{} = 2
+insnSize JumpReg{} = 2
+insnSize JumpIf0{} = 3
+insnSize JumpIfNot0{} = 3
+insnSize JumpIfEq{} = 4
+insnSize JumpIfNe{} = 4
+insnSize JumpIfGt{} = 4
+insnSize JumpIfGe{} = 4
+insnSize JumpIfLt{} = 4
+insnSize JumpIfLe{} = 4
+insnSize DecrAndJumpIfNot0{} = 3
+insnSize DecrAndJumpIf0{} = 3
+insnSize CallFun_0_1{} = 3
+insnSize CallFun_0_2{} = 4
+insnSize CallFun_1_1{} = 4
+insnSize CallFun_1_0{} = 3
+insnSize CallFun_2_1{} = 5
+insnSize CallFun_2_0{} = 4
+insnSize CallFun_3_0{} = 5
+insnSize CallFun_4_0{} = 6
+insnSize CallFun_3_1{} = 6
+insnSize CallFun_5_0{} = 7
+insnSize CallFun_5_1{} = 8
+insnSize CallFun_2_2{} = 6
+insnSize CallFun_2_5{} = 9
+insnSize (Select _ tgts) = 3 + fromIntegral (length tgts)
+insnSize Raise{} = 2
+insnSize Trace{} = 2
+insnSize TraceReg{} = 3
+insnSize Suspend{} = 3
+insnSize Ret = 1
+
+insnWords
+  :: (forall ty. Register ty -> Word64) -> (Label -> Word64) -> Insn -> [Word64]
+insnWords fromReg fromLabel (InputNat begin end dst) = [0, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (InputByte begin end dst) = [1, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (InputBytes begin end size) = [2, fromReg begin, fromReg end, fromReg size]
+insnWords fromReg fromLabel (InputSkipUntrustedString begin end) = [3, fromReg begin, fromReg end]
+insnWords fromReg fromLabel (InputShiftLit begin end lit match) = [4, fromReg begin, fromReg end, fromLiteral lit, fromReg match]
+insnWords fromReg fromLabel (InputShiftBytes begin end ptr ptrend match) = [5, fromReg begin, fromReg end, fromReg ptr, fromReg ptrend, fromReg match]
+insnWords fromReg fromLabel (InputSkipNat begin end) = [6, fromReg begin, fromReg end]
+insnWords fromReg fromLabel (InputSkipTrustedString begin end) = [7, fromReg begin, fromReg end]
+insnWords fromReg fromLabel (ResetOutput output) = [8, fromReg output]
+insnWords fromReg fromLabel (OutputNat src output) = [9, fromReg src, fromReg output]
+insnWords fromReg fromLabel (OutputNatImm src output) = [10, src, fromReg output]
+insnWords fromReg fromLabel (OutputByte src output) = [11, fromReg src, fromReg output]
+insnWords fromReg fromLabel (OutputByteImm src output) = [12, src, fromReg output]
+insnWords fromReg fromLabel (OutputBytes ptr end output) = [13, fromReg ptr, fromReg end, fromReg output]
+insnWords fromReg fromLabel (OutputStringToLower begin end dst) = [14, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (OutputRelToAbsByteSpans begin end dst) = [15, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (OutputUnpackByteSpans begin end dst) = [16, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (OutputStringReverse begin end dst) = [17, fromReg begin, fromReg end, fromReg dst]
+insnWords fromReg fromLabel (GetOutput output ptr end) = [18, fromReg output, fromReg ptr, fromReg end]
+insnWords fromReg fromLabel (GetOutputSize output dst) = [19, fromReg output, fromReg dst]
+insnWords fromReg fromLabel (LoadConst imm dst) = [20, imm, fromReg dst]
+insnWords fromReg fromLabel (LoadLiteral lit ptr end) = [21, fromLiteral lit, fromReg ptr, fromReg end]
+insnWords fromReg fromLabel (Move src dst) = [22, fromReg src, fromReg dst]
+insnWords fromReg fromLabel (SubConst imm dst) = [23, imm, fromReg dst]
+insnWords fromReg fromLabel (Sub src dst) = [24, fromReg src, fromReg dst]
+insnWords fromReg fromLabel (AddConst imm dst) = [25, imm, fromReg dst]
+insnWords fromReg fromLabel (Add src dst) = [26, fromReg src, fromReg dst]
+insnWords fromReg fromLabel (PtrDiff src1 src2 dst) = [27, fromReg src1, fromReg src2, fromReg dst]
+insnWords fromReg fromLabel (LoadLabel lbl dst) = [28, fromLabel lbl, fromReg dst]
+insnWords fromReg fromLabel (Jump tgt) = [29, fromLabel tgt]
+insnWords fromReg fromLabel (JumpReg tgt) = [30, fromReg tgt]
+insnWords fromReg fromLabel (JumpIf0 reg tgt) = [31, fromReg reg, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfNot0 reg tgt) = [32, fromReg reg, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfEq reg1 reg2 tgt) = [33, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfNe reg1 reg2 tgt) = [34, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfGt reg1 reg2 tgt) = [35, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfGe reg1 reg2 tgt) = [36, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfLt reg1 reg2 tgt) = [37, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (JumpIfLe reg1 reg2 tgt) = [38, fromReg reg1, fromReg reg2, fromLabel tgt]
+insnWords fromReg fromLabel (DecrAndJumpIfNot0 reg tgt) = [39, fromReg reg, fromLabel tgt]
+insnWords fromReg fromLabel (DecrAndJumpIf0 reg tgt) = [40, fromReg reg, fromLabel tgt]
+insnWords fromReg fromLabel (CallFun_0_1 fun args1) = [41, fromReg fun, fromReg args1]
+insnWords fromReg fromLabel (CallFun_0_2 fun args1 args2) = [42, fromReg fun, fromReg args1, fromReg args2]
+insnWords fromReg fromLabel (CallFun_1_1 fun args1 args2) = [43, fromReg fun, fromReg args1, fromReg args2]
+insnWords fromReg fromLabel (CallFun_1_0 fun args1) = [44, fromReg fun, fromReg args1]
+insnWords fromReg fromLabel (CallFun_2_1 fun args1 args2 args3) = [45, fromReg fun, fromReg args1, fromReg args2, fromReg args3]
+insnWords fromReg fromLabel (CallFun_2_0 fun args1 args2) = [46, fromReg fun, fromReg args1, fromReg args2]
+insnWords fromReg fromLabel (CallFun_3_0 fun args1 args2 args3) = [47, fromReg fun, fromReg args1, fromReg args2, fromReg args3]
+insnWords fromReg fromLabel (CallFun_4_0 fun args1 args2 args3 args4) = [48, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4]
+insnWords fromReg fromLabel (CallFun_3_1 fun args1 args2 args3 args4) = [49, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4]
+insnWords fromReg fromLabel (CallFun_5_0 fun args1 args2 args3 args4 args5) = [50, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4, fromReg args5]
+insnWords fromReg fromLabel (CallFun_5_1 fun args1 args2 args3 args4 args5 args6) = [51, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4, fromReg args5, fromReg args6]
+insnWords fromReg fromLabel (CallFun_2_2 fun args1 args2 args3 args4) = [52, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4]
+insnWords fromReg fromLabel (CallFun_2_5 fun args1 args2 args3 args4 args5 args6 args7) = [53, fromReg fun, fromReg args1, fromReg args2, fromReg args3, fromReg args4, fromReg args5, fromReg args6, fromReg args7]
+insnWords fromReg fromLabel (Select sel tgts) = [54, fromReg sel, fromIntegral (length tgts)] ++ map fromLabel tgts ++ []
+insnWords fromReg fromLabel (Raise msg) = [55, fromLiteral msg]
+insnWords fromReg fromLabel (Trace msg) = [56, fromLiteral msg]
+insnWords fromReg fromLabel (TraceReg msg reg) = [57, fromLiteral msg, fromReg reg]
+insnWords fromReg fromLabel (Suspend unused cont) = [58, fromReg unused, fromLabel cont]
+insnWords fromReg fromLabel (Ret) = [59]
+
+instance D.Decodable Insn where
+  decode = do
+    op <- D.decode
+    case (op :: Word64) of
+      0 -> InputNat <$> D.decode <*> D.decode <*> D.decode
+      1 -> InputByte <$> D.decode <*> D.decode <*> D.decode
+      2 -> InputBytes <$> D.decode <*> D.decode <*> D.decode
+      3 -> InputSkipUntrustedString <$> D.decode <*> D.decode
+      4 -> InputShiftLit <$> D.decode <*> D.decode <*> D.decode <*> D.decode
+      5 -> InputShiftBytes <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      6 -> InputSkipNat <$> D.decode <*> D.decode
+      7 -> InputSkipTrustedString <$> D.decode <*> D.decode
+      8 -> ResetOutput <$> D.decode
+      9 -> OutputNat <$> D.decode <*> D.decode
+      10 -> OutputNatImm <$> D.decode <*> D.decode
+      11 -> OutputByte <$> D.decode <*> D.decode
+      12 -> OutputByteImm <$> D.decode <*> D.decode
+      13 -> OutputBytes <$> D.decode <*> D.decode <*> D.decode
+      14 -> OutputStringToLower <$> D.decode <*> D.decode <*> D.decode
+      15 -> OutputRelToAbsByteSpans <$> D.decode <*> D.decode <*> D.decode
+      16 -> OutputUnpackByteSpans <$> D.decode <*> D.decode <*> D.decode
+      17 -> OutputStringReverse <$> D.decode <*> D.decode <*> D.decode
+      18 -> GetOutput <$> D.decode <*> D.decode <*> D.decode
+      19 -> GetOutputSize <$> D.decode <*> D.decode
+      20 -> LoadConst <$> D.decode <*> D.decode
+      21 -> LoadLiteral <$> D.decode <*> D.decode <*> D.decode
+      22 -> Move <$> D.decode <*> D.decode
+      23 -> SubConst <$> D.decode <*> D.decode
+      24 -> Sub <$> D.decode <*> D.decode
+      25 -> AddConst <$> D.decode <*> D.decode
+      26 -> Add <$> D.decode <*> D.decode
+      27 -> PtrDiff <$> D.decode <*> D.decode <*> D.decode
+      28 -> LoadLabel <$> D.decode <*> D.decode
+      29 -> Jump <$> D.decode
+      30 -> JumpReg <$> D.decode
+      31 -> JumpIf0 <$> D.decode <*> D.decode
+      32 -> JumpIfNot0 <$> D.decode <*> D.decode
+      33 -> JumpIfEq <$> D.decode <*> D.decode <*> D.decode
+      34 -> JumpIfNe <$> D.decode <*> D.decode <*> D.decode
+      35 -> JumpIfGt <$> D.decode <*> D.decode <*> D.decode
+      36 -> JumpIfGe <$> D.decode <*> D.decode <*> D.decode
+      37 -> JumpIfLt <$> D.decode <*> D.decode <*> D.decode
+      38 -> JumpIfLe <$> D.decode <*> D.decode <*> D.decode
+      39 -> DecrAndJumpIfNot0 <$> D.decode <*> D.decode
+      40 -> DecrAndJumpIf0 <$> D.decode <*> D.decode
+      41 -> CallFun_0_1 <$> D.decode <*> D.decode
+      42 -> CallFun_0_2 <$> D.decode <*> D.decode <*> D.decode
+      43 -> CallFun_1_1 <$> D.decode <*> D.decode <*> D.decode
+      44 -> CallFun_1_0 <$> D.decode <*> D.decode
+      45 -> CallFun_2_1 <$> D.decode <*> D.decode <*> D.decode <*> D.decode
+      46 -> CallFun_2_0 <$> D.decode <*> D.decode <*> D.decode
+      47 -> CallFun_3_0 <$> D.decode <*> D.decode <*> D.decode <*> D.decode
+      48 -> CallFun_4_0 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      49 -> CallFun_3_1 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      50 -> CallFun_5_0 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      51 -> CallFun_5_1 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      52 -> CallFun_2_2 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      53 -> CallFun_2_5 <$> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode <*> D.decode
+      54 -> Select <$> D.decode <*> D.decode
+      55 -> Raise <$> D.decode
+      56 -> Trace <$> D.decode
+      57 -> TraceReg <$> D.decode <*> D.decode
+      58 -> Suspend <$> D.decode <*> D.decode
+      59 -> pure Ret
+      _ -> fail $ "invalid opcode " ++ show op
+
+insnShow
+  :: [String]
+  -> (Label -> String)
+  -> (forall t. Register t -> String)
+  -> Insn
+  -> String
+insnShow syscalls showLabel showReg (InputNat begin end dst) = concat ["InputNat", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (InputByte begin end dst) = concat ["InputByte", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (InputBytes begin end size) = concat ["InputBytes", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg size]
+insnShow syscalls showLabel showReg (InputSkipUntrustedString begin end) = concat ["InputSkipUntrustedString", ' ' : showReg begin, ",", ' ' : showReg end]
+insnShow syscalls showLabel showReg (InputShiftLit begin end lit match) = concat ["InputShiftLit", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : show (fromLiteral lit), ",", ' ' : showReg match]
+insnShow syscalls showLabel showReg (InputShiftBytes begin end ptr ptrend match) = concat ["InputShiftBytes", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg ptr, ",", ' ' : showReg ptrend, ",", ' ' : showReg match]
+insnShow syscalls showLabel showReg (InputSkipNat begin end) = concat ["InputSkipNat", ' ' : showReg begin, ",", ' ' : showReg end]
+insnShow syscalls showLabel showReg (InputSkipTrustedString begin end) = concat ["InputSkipTrustedString", ' ' : showReg begin, ",", ' ' : showReg end]
+insnShow syscalls showLabel showReg (ResetOutput output) = concat ["ResetOutput", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputNat src output) = concat ["OutputNat", ' ' : showReg src, ",", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputNatImm src output) = concat ["OutputNatImm", ' ' : show src, ",", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputByte src output) = concat ["OutputByte", ' ' : showReg src, ",", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputByteImm src output) = concat ["OutputByteImm", ' ' : show src, ",", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputBytes ptr end output) = concat ["OutputBytes", ' ' : showReg ptr, ",", ' ' : showReg end, ",", ' ' : showReg output]
+insnShow syscalls showLabel showReg (OutputStringToLower begin end dst) = concat ["OutputStringToLower", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (OutputRelToAbsByteSpans begin end dst) = concat ["OutputRelToAbsByteSpans", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (OutputUnpackByteSpans begin end dst) = concat ["OutputUnpackByteSpans", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (OutputStringReverse begin end dst) = concat ["OutputStringReverse", ' ' : showReg begin, ",", ' ' : showReg end, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (GetOutput output ptr end) = concat ["GetOutput", ' ' : showReg output, ",", ' ' : showReg ptr, ",", ' ' : showReg end]
+insnShow syscalls showLabel showReg (GetOutputSize output dst) = concat ["GetOutputSize", ' ' : showReg output, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (LoadConst imm dst) = concat ["LoadConst", ' ' : show imm, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (LoadLiteral lit ptr end) = concat ["LoadLiteral", ' ' : show (fromLiteral lit), ",", ' ' : showReg ptr, ",", ' ' : showReg end]
+insnShow syscalls showLabel showReg (Move src dst) = concat ["Move", ' ' : showReg src, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (SubConst imm dst) = concat ["SubConst", ' ' : show imm, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (Sub src dst) = concat ["Sub", ' ' : showReg src, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (AddConst imm dst) = concat ["AddConst", ' ' : show imm, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (Add src dst) = concat ["Add", ' ' : showReg src, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (PtrDiff src1 src2 dst) = concat ["PtrDiff", ' ' : showReg src1, ",", ' ' : showReg src2, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (LoadLabel lbl dst) = concat ["LoadLabel", ' ' : showLabel lbl, ",", ' ' : showReg dst]
+insnShow syscalls showLabel showReg (Jump tgt) = concat ["Jump", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpReg tgt) = concat ["JumpReg", ' ' : showReg tgt]
+insnShow syscalls showLabel showReg (JumpIf0 reg tgt) = concat ["JumpIf0", ' ' : showReg reg, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfNot0 reg tgt) = concat ["JumpIfNot0", ' ' : showReg reg, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfEq reg1 reg2 tgt) = concat ["JumpIfEq", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfNe reg1 reg2 tgt) = concat ["JumpIfNe", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfGt reg1 reg2 tgt) = concat ["JumpIfGt", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfGe reg1 reg2 tgt) = concat ["JumpIfGe", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfLt reg1 reg2 tgt) = concat ["JumpIfLt", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (JumpIfLe reg1 reg2 tgt) = concat ["JumpIfLe", ' ' : showReg reg1, ",", ' ' : showReg reg2, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (DecrAndJumpIfNot0 reg tgt) = concat ["DecrAndJumpIfNot0", ' ' : showReg reg, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (DecrAndJumpIf0 reg tgt) = concat ["DecrAndJumpIf0", ' ' : showReg reg, ",", ' ' : showLabel tgt]
+insnShow syscalls showLabel showReg (CallFun_0_1 fun args1) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1]
+insnShow syscalls showLabel showReg (CallFun_0_2 fun args1 args2) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2]
+insnShow syscalls showLabel showReg (CallFun_1_1 fun args1 args2) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2]
+insnShow syscalls showLabel showReg (CallFun_1_0 fun args1) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1]
+insnShow syscalls showLabel showReg (CallFun_2_1 fun args1 args2 args3) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3]
+insnShow syscalls showLabel showReg (CallFun_2_0 fun args1 args2) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2]
+insnShow syscalls showLabel showReg (CallFun_3_0 fun args1 args2 args3) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3]
+insnShow syscalls showLabel showReg (CallFun_4_0 fun args1 args2 args3 args4) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4]
+insnShow syscalls showLabel showReg (CallFun_3_1 fun args1 args2 args3 args4) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4]
+insnShow syscalls showLabel showReg (CallFun_5_0 fun args1 args2 args3 args4 args5) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4, ",", ' ' : showReg args5]
+insnShow syscalls showLabel showReg (CallFun_5_1 fun args1 args2 args3 args4 args5 args6) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4, ",", ' ' : showReg args5, ",", ' ' : showReg args6]
+insnShow syscalls showLabel showReg (CallFun_2_2 fun args1 args2 args3 args4) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4]
+insnShow syscalls showLabel showReg (CallFun_2_5 fun args1 args2 args3 args4 args5 args6 args7) = concat [(syscalls !! fromIntegral (fromRegister fun)), ' ' : showReg args1, ",", ' ' : showReg args2, ",", ' ' : showReg args3, ",", ' ' : showReg args4, ",", ' ' : showReg args5, ",", ' ' : showReg args6, ",", ' ' : showReg args7]
+insnShow syscalls showLabel showReg (Select sel tgts) = concat ["Select", ' ' : showReg sel, ",", ' ' : showListWith (showString . showLabel) tgts ""]
+insnShow syscalls showLabel showReg (Raise msg) = concat ["Raise", ' ' : show (fromLiteral msg)]
+insnShow syscalls showLabel showReg (Trace msg) = concat ["Trace", ' ' : show (fromLiteral msg)]
+insnShow syscalls showLabel showReg (TraceReg msg reg) = concat ["TraceReg", ' ' : show (fromLiteral msg), ",", ' ' : showReg reg]
+insnShow syscalls showLabel showReg (Suspend unused cont) = concat ["Suspend", ' ' : showReg unused, ",", ' ' : showLabel cont]
+insnShow syscalls showLabel showReg (Ret) = concat ["Ret"]
diff --git a/glean/hs/Glean/RTS/Bytecode/Gen/Issue.hs b/glean/hs/Glean/RTS/Bytecode/Gen/Issue.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Gen/Issue.hs
@@ -0,0 +1,315 @@
+-- @generated
+{-# OPTIONS_GHC -Wno-unused-matches #-}
+module Glean.RTS.Bytecode.Gen.Issue
+  ( inputNat
+  , inputByte
+  , inputBytes
+  , inputSkipUntrustedString
+  , inputShiftLit
+  , inputShiftBytes
+  , inputSkipNat
+  , inputSkipTrustedString
+  , resetOutput
+  , outputNat
+  , outputNatImm
+  , outputByte
+  , outputByteImm
+  , outputBytes
+  , outputStringToLower
+  , outputRelToAbsByteSpans
+  , outputUnpackByteSpans
+  , outputStringReverse
+  , getOutput
+  , getOutputSize
+  , loadConst
+  , loadLiteral
+  , move
+  , subConst
+  , sub
+  , addConst
+  , add
+  , ptrDiff
+  , loadLabel
+  , jump
+  , jumpReg
+  , jumpIf0
+  , jumpIfNot0
+  , jumpIfEq
+  , jumpIfNe
+  , jumpIfGt
+  , jumpIfGe
+  , jumpIfLt
+  , jumpIfLe
+  , decrAndJumpIfNot0
+  , decrAndJumpIf0
+  , callFun_0_1
+  , callFun_0_2
+  , callFun_1_1
+  , callFun_1_0
+  , callFun_2_1
+  , callFun_2_0
+  , callFun_3_0
+  , callFun_4_0
+  , callFun_3_1
+  , callFun_5_0
+  , callFun_5_1
+  , callFun_2_2
+  , callFun_2_5
+  , select
+  , raise
+  , trace
+  , traceReg
+  , suspend
+  , ret
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.Word (Word64)
+import Glean.RTS.Bytecode.Gen.Instruction (Insn(..))
+import Glean.RTS.Bytecode.Code
+import Glean.Bytecode.Types
+
+inputNat :: Register 'DataPtr -> Register 'DataPtr -> Register 'Word -> Code ()
+inputNat begin end dst = do
+  issue $ InputNat begin end dst
+
+inputByte :: Register 'DataPtr -> Register 'DataPtr -> Register 'Word -> Code ()
+inputByte begin end dst = do
+  issue $ InputByte begin end dst
+
+inputBytes :: Register 'DataPtr -> Register 'DataPtr -> Register 'Word -> Code ()
+inputBytes begin end size = do
+  issue $ InputBytes begin end size
+
+inputSkipUntrustedString :: Register 'DataPtr -> Register 'DataPtr -> Code ()
+inputSkipUntrustedString begin end = do
+  issue $ InputSkipUntrustedString begin end
+
+inputShiftLit :: Register 'DataPtr -> Register 'DataPtr -> ByteString -> Register 'Word -> Code ()
+inputShiftLit begin end lit match = do
+  lit_i <- literal lit
+  issue $ InputShiftLit begin end lit_i match
+
+inputShiftBytes :: Register 'DataPtr -> Register 'DataPtr -> Register 'DataPtr -> Register 'DataPtr -> Register 'Word -> Code ()
+inputShiftBytes begin end ptr ptrend match = do
+  issue $ InputShiftBytes begin end ptr ptrend match
+
+inputSkipNat :: Register 'DataPtr -> Register 'DataPtr -> Code ()
+inputSkipNat begin end = do
+  issue $ InputSkipNat begin end
+
+inputSkipTrustedString :: Register 'DataPtr -> Register 'DataPtr -> Code ()
+inputSkipTrustedString begin end = do
+  issue $ InputSkipTrustedString begin end
+
+resetOutput :: Register 'BinaryOutputPtr -> Code ()
+resetOutput output = do
+  issue $ ResetOutput output
+
+outputNat :: Register 'Word -> Register 'BinaryOutputPtr -> Code ()
+outputNat src output = do
+  issue $ OutputNat src output
+
+outputNatImm :: Word64 -> Register 'BinaryOutputPtr -> Code ()
+outputNatImm src output = do
+  issue $ OutputNatImm src output
+
+outputByte :: Register 'Word -> Register 'BinaryOutputPtr -> Code ()
+outputByte src output = do
+  issue $ OutputByte src output
+
+outputByteImm :: Word64 -> Register 'BinaryOutputPtr -> Code ()
+outputByteImm src output = do
+  issue $ OutputByteImm src output
+
+outputBytes :: Register 'DataPtr -> Register 'DataPtr -> Register 'BinaryOutputPtr -> Code ()
+outputBytes ptr end output = do
+  issue $ OutputBytes ptr end output
+
+outputStringToLower :: Register 'DataPtr -> Register 'DataPtr -> Register 'BinaryOutputPtr -> Code ()
+outputStringToLower begin end dst = do
+  issue $ OutputStringToLower begin end dst
+
+outputRelToAbsByteSpans :: Register 'DataPtr -> Register 'DataPtr -> Register 'BinaryOutputPtr -> Code ()
+outputRelToAbsByteSpans begin end dst = do
+  issue $ OutputRelToAbsByteSpans begin end dst
+
+outputUnpackByteSpans :: Register 'DataPtr -> Register 'DataPtr -> Register 'BinaryOutputPtr -> Code ()
+outputUnpackByteSpans begin end dst = do
+  issue $ OutputUnpackByteSpans begin end dst
+
+outputStringReverse :: Register 'DataPtr -> Register 'DataPtr -> Register 'BinaryOutputPtr -> Code ()
+outputStringReverse begin end dst = do
+  issue $ OutputStringReverse begin end dst
+
+getOutput :: Register 'BinaryOutputPtr -> Register 'DataPtr -> Register 'DataPtr -> Code ()
+getOutput output ptr end = do
+  issue $ GetOutput output ptr end
+
+getOutputSize :: Register 'BinaryOutputPtr -> Register 'Word -> Code ()
+getOutputSize output dst = do
+  issue $ GetOutputSize output dst
+
+loadConst :: Word64 -> Register 'Word -> Code ()
+loadConst imm dst = do
+  issue $ LoadConst imm dst
+
+loadLiteral :: ByteString -> Register 'DataPtr -> Register 'DataPtr -> Code ()
+loadLiteral lit ptr end = do
+  lit_i <- literal lit
+  issue $ LoadLiteral lit_i ptr end
+
+move :: Register a -> Register a -> Code ()
+move src dst = do
+  issue $ Move src dst
+
+subConst :: Word64 -> Register 'Word -> Code ()
+subConst imm dst = do
+  issue $ SubConst imm dst
+
+sub :: Addable a b => Register b -> Register a -> Code ()
+sub src dst = do
+  issue $ Sub src dst
+
+addConst :: Addable a 'Word => Word64 -> Register a -> Code ()
+addConst imm dst = do
+  issue $ AddConst imm dst
+
+add :: Addable a b => Register b -> Register a -> Code ()
+add src dst = do
+  issue $ Add src dst
+
+ptrDiff :: Register 'DataPtr -> Register 'DataPtr -> Register 'Word -> Code ()
+ptrDiff src1 src2 dst = do
+  issue $ PtrDiff src1 src2 dst
+
+loadLabel :: Label -> Register 'Offset -> Code ()
+loadLabel lbl dst = do
+  issue $ LoadLabel lbl dst
+
+jump :: Label -> Code ()
+jump tgt = do
+  issueEndBlock $ Jump tgt
+
+jumpReg :: Register 'Offset -> Code ()
+jumpReg tgt = do
+  issueEndBlock $ JumpReg tgt
+
+jumpIf0 :: Register 'Word -> Label -> Code ()
+jumpIf0 reg tgt = do
+  issue $ JumpIf0 reg tgt
+
+jumpIfNot0 :: Register 'Word -> Label -> Code ()
+jumpIfNot0 reg tgt = do
+  issue $ JumpIfNot0 reg tgt
+
+jumpIfEq :: Register a -> Register a -> Label -> Code ()
+jumpIfEq reg1 reg2 tgt = do
+  issue $ JumpIfEq reg1 reg2 tgt
+
+jumpIfNe :: Register a -> Register a -> Label -> Code ()
+jumpIfNe reg1 reg2 tgt = do
+  issue $ JumpIfNe reg1 reg2 tgt
+
+jumpIfGt :: Ordered a => Register a -> Register a -> Label -> Code ()
+jumpIfGt reg1 reg2 tgt = do
+  issue $ JumpIfGt reg1 reg2 tgt
+
+jumpIfGe :: Ordered a => Register a -> Register a -> Label -> Code ()
+jumpIfGe reg1 reg2 tgt = do
+  issue $ JumpIfGe reg1 reg2 tgt
+
+jumpIfLt :: Ordered a => Register a -> Register a -> Label -> Code ()
+jumpIfLt reg1 reg2 tgt = do
+  issue $ JumpIfLt reg1 reg2 tgt
+
+jumpIfLe :: Ordered a => Register a -> Register a -> Label -> Code ()
+jumpIfLe reg1 reg2 tgt = do
+  issue $ JumpIfLe reg1 reg2 tgt
+
+decrAndJumpIfNot0 :: Register 'Word -> Label -> Code ()
+decrAndJumpIfNot0 reg tgt = do
+  issue $ DecrAndJumpIfNot0 reg tgt
+
+decrAndJumpIf0 :: Register 'Word -> Label -> Code ()
+decrAndJumpIf0 reg tgt = do
+  issue $ DecrAndJumpIf0 reg tgt
+
+callFun_0_1 :: Register ('Fun '[ 'WordPtr ]) -> Register 'Word -> Code ()
+callFun_0_1 fun args1 = do
+  issue $ CallFun_0_1 fun args1
+
+callFun_0_2 :: Register ('Fun '[ 'WordPtr,'WordPtr ]) -> Register 'Word -> Register 'Word -> Code ()
+callFun_0_2 fun args1 args2 = do
+  issue $ CallFun_0_2 fun args1 args2
+
+callFun_1_1 :: Register ('Fun '[ 'Word,'WordPtr ]) -> Register 'Word -> Register 'Word -> Code ()
+callFun_1_1 fun args1 args2 = do
+  issue $ CallFun_1_1 fun args1 args2
+
+callFun_1_0 :: Register ('Fun '[ 'Word ]) -> Register 'Word -> Code ()
+callFun_1_0 fun args1 = do
+  issue $ CallFun_1_0 fun args1
+
+callFun_2_1 :: Register ('Fun '[ 'Word,'Word,'WordPtr ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_2_1 fun args1 args2 args3 = do
+  issue $ CallFun_2_1 fun args1 args2 args3
+
+callFun_2_0 :: Register ('Fun '[ 'Word,'Word ]) -> Register 'Word -> Register 'Word -> Code ()
+callFun_2_0 fun args1 args2 = do
+  issue $ CallFun_2_0 fun args1 args2
+
+callFun_3_0 :: Register ('Fun '[ 'Word,'Word,'Word ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_3_0 fun args1 args2 args3 = do
+  issue $ CallFun_3_0 fun args1 args2 args3
+
+callFun_4_0 :: Register ('Fun '[ 'Word,'Word,'Word,'Word ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_4_0 fun args1 args2 args3 args4 = do
+  issue $ CallFun_4_0 fun args1 args2 args3 args4
+
+callFun_3_1 :: Register ('Fun '[ 'Word,'Word,'Word,'WordPtr ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_3_1 fun args1 args2 args3 args4 = do
+  issue $ CallFun_3_1 fun args1 args2 args3 args4
+
+callFun_5_0 :: Register ('Fun '[ 'Word,'Word,'Word,'Word,'Word ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_5_0 fun args1 args2 args3 args4 args5 = do
+  issue $ CallFun_5_0 fun args1 args2 args3 args4 args5
+
+callFun_5_1 :: Register ('Fun '[ 'Word,'Word,'Word,'Word,'Word,'WordPtr ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_5_1 fun args1 args2 args3 args4 args5 args6 = do
+  issue $ CallFun_5_1 fun args1 args2 args3 args4 args5 args6
+
+callFun_2_2 :: Register ('Fun '[ 'Word,'Word,'WordPtr,'WordPtr ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_2_2 fun args1 args2 args3 args4 = do
+  issue $ CallFun_2_2 fun args1 args2 args3 args4
+
+callFun_2_5 :: Register ('Fun '[ 'Word,'Word,'WordPtr,'WordPtr,'WordPtr,'WordPtr,'WordPtr ]) -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Register 'Word -> Code ()
+callFun_2_5 fun args1 args2 args3 args4 args5 args6 args7 = do
+  issue $ CallFun_2_5 fun args1 args2 args3 args4 args5 args6 args7
+
+select :: Register 'Word -> [Label] -> Code ()
+select sel tgts = do
+  issue $ Select sel tgts
+
+raise :: ByteString -> Code ()
+raise msg = do
+  msg_i <- literal msg
+  issueEndBlock $ Raise msg_i
+
+trace :: ByteString -> Code ()
+trace msg = do
+  msg_i <- literal msg
+  issue $ Trace msg_i
+
+traceReg :: ByteString -> Register 'Word -> Code ()
+traceReg msg reg = do
+  msg_i <- literal msg
+  issue $ TraceReg msg_i reg
+
+suspend :: Register 'Word -> Label -> Code ()
+suspend unused cont = do
+  issueEndBlock $ Suspend unused cont
+
+ret :: Code ()
+ret = do
+  issueEndBlock $ Ret
diff --git a/glean/hs/Glean/RTS/Bytecode/Gen/Version.hs b/glean/hs/Glean/RTS/Bytecode/Gen/Version.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Gen/Version.hs
@@ -0,0 +1,12 @@
+-- @generated
+{-# OPTIONS_GHC -Wno-unused-matches #-}
+module Glean.RTS.Bytecode.Gen.Version
+  ( version
+  , lowestSupportedVersion
+  ) where
+
+version :: Int
+version = 15
+
+lowestSupportedVersion :: Int
+lowestSupportedVersion = 15
diff --git a/glean/hs/Glean/RTS/Bytecode/Supply.hs b/glean/hs/Glean/RTS/Bytecode/Supply.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Bytecode/Supply.hs
@@ -0,0 +1,36 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Bytecode.Supply
+  ( Supply(..)
+  , peekSupply
+  , RegSupply
+  , regSupply
+  ) where
+
+import Glean.Bytecode.Types
+
+-- | Class of things of type `a` which can be supplied from `s`
+class Supply a s where
+  -- | Produce the next `a` and and updated `s`
+  supply :: s -> (a,s)
+
+-- | Get the next `a` in the supply
+peekSupply :: Supply a s => s -> a
+peekSupply = fst . supply
+
+-- | A supply of registers
+newtype RegSupply = RegSupply (Register 'Word)
+
+-- | Create a new register supply which allocates consecutive registers starting
+-- with the given one.
+regSupply :: Register a -> RegSupply
+regSupply = RegSupply . castRegister
+
+instance Supply (Register a) RegSupply where
+  supply (RegSupply r) = (castRegister r, RegSupply $ succ r)
diff --git a/glean/hs/Glean/RTS/Constants.hs b/glean/hs/Glean/RTS/Constants.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Constants.hs
@@ -0,0 +1,17 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Constants
+  ( firstAnonId
+  ) where
+
+import Data.Int
+
+-- | Fact IDs used for anonymous facts, see Glean.Write.JSON
+firstAnonId :: Int64
+firstAnonId = 0x4000000000000000  -- 50% of the positive Id range
diff --git a/glean/hs/Glean/RTS/Foreign/Benchmarking.hs b/glean/hs/Glean/RTS/Foreign/Benchmarking.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Benchmarking.hs
@@ -0,0 +1,163 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Benchmarking
+  ( FactBlock
+  , createFactBlock
+  , factCount
+  , factMemory
+
+  , defineEach
+  , lookupEachType
+  , lookupEachById
+  , lookupEachByKey
+  , seekToEach
+  , seekCount
+  ) where
+
+import qualified Data.Vector.Storable as V
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Foreign.Define (Define(..), CanDefine(..))
+import Glean.RTS.Foreign.Lookup (Lookup(..), CanLookup(..))
+import Glean.RTS.Types (Pid(..))
+
+newtype FactBlock = FactBlock (ForeignPtr FactBlock)
+
+instance Object FactBlock where
+  wrap = FactBlock
+  unwrap (FactBlock p) = p
+  destroy = glean_benchmarking_factblock_free
+
+createFactBlock :: CanLookup l => l -> IO FactBlock
+createFactBlock l = withLookup  l $ \look ->
+  construct $ invoke $ glean_benchmarking_factblock_create look
+
+factCount :: FactBlock -> IO Int
+factCount block =
+  fromIntegral <$> with block glean_benchmarking_factblock_fact_count
+
+factMemory :: FactBlock -> IO Int
+factMemory block =
+  fromIntegral <$> with block glean_benchmarking_factblock_fact_memory
+
+-- | Define each fact from the 'FactBlock'. Fail if the ids of the defined
+-- facts are different from their ids in the 'FactBlock'
+defineEach :: CanDefine d => d -> FactBlock -> IO Bool
+defineEach d block =
+  withDefine d $ \def ->
+  with block $ \ptr -> do
+    r <- invoke $ glean_benchmarking_define_each def ptr
+    return $ r /= 0
+
+-- | Look up the type of each fact. Fail if the types are different from those
+-- in the 'FactBlock'.
+lookupEachType :: CanLookup l => l -> FactBlock -> IO Bool
+lookupEachType l block =
+  withLookup l $ \look ->
+  with block $ \ptr -> do
+    r <- invoke $ glean_benchmarking_lookup_each_type look ptr
+    return $ r /= 0
+
+-- | Look up each fact by id. Fail if a fact doesn't exist or if its type or key
+-- are different.
+lookupEachById :: CanLookup l => l -> FactBlock -> IO Bool
+lookupEachById l block =
+  withLookup l $ \look ->
+  with block $ \ptr -> do
+    r <- invoke $ glean_benchmarking_lookup_each_by_id look ptr
+    return $ r /= 0
+
+-- | Look up each fact by key. Fail if a fact doesn't exist or if its id or type
+-- are different.
+lookupEachByKey :: CanLookup l => l -> FactBlock -> IO Bool
+lookupEachByKey l block =
+  withLookup l $ \look ->
+  with block $ \ptr -> do
+    r <- invoke $ glean_benchmarking_lookup_each_by_key look ptr
+    return $ r /= 0
+
+-- | Seek to each fact by key. Fail if a fact doesn't exist or if its id or type
+-- are different.
+seekToEach ::  CanLookup l => l -> FactBlock -> IO Bool
+seekToEach l block =
+  withLookup l $ \look ->
+  with block $ \ptr -> do
+    r <- invoke $ glean_benchmarking_seek_to_each look ptr
+    return $ r /= 0
+
+-- | For each 'Pid', iterate through all its facts via seek. Return the total
+-- number of facts iterated over.
+seekCount :: CanLookup a => a -> V.Vector Pid -> IO Int
+seekCount look pids =
+  withLookup look $ \look_ptr ->
+  V.unsafeWith pids $ \pids_ptr ->
+  fmap fromIntegral $ invoke $ glean_benchmarking_seek_count
+    look_ptr
+    pids_ptr
+    (fromIntegral $ V.length pids)
+
+foreign import ccall safe glean_benchmarking_factblock_create
+  :: Ptr Lookup
+  -> Ptr (Ptr FactBlock)
+  -> IO CString
+
+foreign import ccall unsafe "&glean_benchmarking_factblock_free"
+  glean_benchmarking_factblock_free
+  :: FunPtr (Ptr FactBlock -> IO ())
+
+foreign import ccall unsafe glean_benchmarking_factblock_fact_count
+  :: Ptr FactBlock
+  -> IO CSize
+
+foreign import ccall unsafe glean_benchmarking_factblock_fact_memory
+  :: Ptr FactBlock
+  -> IO CSize
+
+foreign import ccall safe glean_benchmarking_define_each
+  :: Define
+  -> Ptr FactBlock
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall safe glean_benchmarking_lookup_each_type
+  :: Ptr Lookup
+  -> Ptr FactBlock
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall safe glean_benchmarking_lookup_each_by_id
+  :: Ptr Lookup
+  -> Ptr FactBlock
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall safe glean_benchmarking_lookup_each_by_key
+  :: Ptr Lookup
+  -> Ptr FactBlock
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall safe glean_benchmarking_seek_to_each
+  :: Ptr Lookup
+  -> Ptr FactBlock
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall safe glean_benchmarking_seek_count
+  :: Ptr Lookup
+  -> Ptr Pid
+  -> CSize
+  -> Ptr CSize
+  -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/Bytecode.hs b/glean/hs/Glean/RTS/Foreign/Bytecode.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Bytecode.hs
@@ -0,0 +1,152 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Bytecode
+  ( Subroutine
+  , SubroutineCode(..)
+  , subroutine
+  , inspect
+  , size
+  ) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import qualified Data.Vector.Storable as V
+import Data.Word (Word64)
+import Foreign (withArray, withArrayLen)
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+import Foreign.Storable (peekElemOff)
+import System.IO.Unsafe (unsafePerformIO, unsafeDupablePerformIO)
+
+import Glean.FFI
+import Util.FFI
+
+data SubroutineCode = SubroutineCode
+  { -- | Instructions
+    subInsns :: !(V.Vector Word64)
+
+    -- | Number of inputs
+  , subInputs :: {-# UNPACK #-} !Word64
+
+    -- | Number of outputs
+  , subOutputs :: {-# UNPACK #-} !Word64
+
+    -- | Number of local registers
+  , subLocals :: {-# UNPACK #-} !Word64
+
+    -- | Constants (copied into local registers at beginning)
+  , subConstants :: !(V.Vector Word64)
+
+    -- | Literals
+  , subLiterals :: [ByteString]
+  }
+
+-- | A bytecode subroutine. The s parameter describes the kind of
+-- subroutine this is (e.g. CompiledTypecheck, CompiledQuery), to
+-- avoid us mixing up the two.
+newtype Subroutine s = Subroutine (ForeignPtr (Subroutine s))
+
+instance Object (Subroutine s) where
+  wrap = Subroutine
+  unwrap (Subroutine p) = p
+  destroy = glean_subroutine_free
+
+-- | Create a subroutine
+subroutine
+  :: V.Vector Word64 -- ^ instructions
+  -> Word64 -- ^ number of inputs
+  -> Word64 -- ^ number of outputs
+  -> Word64 -- ^ number of local registers
+  -> [Word64] -- ^ constants
+  -> [ByteString] -- ^ literals
+  -> IO (Subroutine s)
+subroutine code inputs outputs locals consts lits =
+  V.unsafeWith code $ \code_ptr ->
+  withArrayLen consts $ \consts_len consts_ptr ->
+  withMany (\s -> unsafeWithBytes s . curry) lits $ \ps ->
+  let (lit_ptrs, lit_sizes) = unzip ps
+  in
+  withArray lit_ptrs $ \p_lit_ptrs ->
+  withArray lit_sizes $ \p_lit_sizes ->
+  construct $ invoke $ glean_subroutine_new
+    code_ptr
+    (fromIntegral $ V.length code)
+    (fromIntegral inputs)
+    (fromIntegral outputs)
+    (fromIntegral locals)
+    consts_ptr
+    (fromIntegral consts_len)
+    p_lit_ptrs
+    p_lit_sizes
+    (fromIntegral $ length ps)
+
+size :: Subroutine s -> Int
+size sub = unsafeDupablePerformIO $ with sub $ \p_sub -> do
+  fromIntegral <$> glean_subroutine_size p_sub
+
+inspect :: Subroutine s -> SubroutineCode
+inspect sub = unsafePerformIO $ with sub $ \p_sub -> do
+  ( insns_ptr, insns_size
+    , inputs, outputs, locals
+    , consts_ptr, consts_size
+    , lit_count) <- invoke $ glean_subroutine_inspect p_sub
+  insns <- V.generateM (fromIntegral insns_size) $ peekElemOff insns_ptr
+  consts <- V.generateM (fromIntegral consts_size) $ peekElemOff consts_ptr
+  lits <- forM [1 .. lit_count] $ \i -> do
+    (lit_ptr, lit_size) <- invoke $ glean_subroutine_literal p_sub (i-1)
+    copyByteString lit_ptr lit_size
+  return SubroutineCode
+    { subInsns = insns
+    , subInputs = inputs
+    , subOutputs = outputs
+    , subLocals = locals
+    , subConstants = consts
+    , subLiterals = lits
+    }
+
+foreign import ccall unsafe glean_subroutine_new
+  :: Ptr Word64
+  -> CSize
+  -> CSize
+  -> CSize
+  -> CSize
+  -> Ptr Word64
+  -> CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> CSize
+  -> Ptr (Ptr (Subroutine s))
+  -> IO CString
+foreign import ccall unsafe "&glean_subroutine_free" glean_subroutine_free
+  :: FunPtr (Ptr (Subroutine s) -> IO ())
+
+foreign import ccall unsafe glean_subroutine_inspect
+  :: Ptr (Subroutine s)
+  -> Ptr (Ptr Word64)
+  -> Ptr CSize
+  -> Ptr Word64
+  -> Ptr Word64
+  -> Ptr Word64
+  -> Ptr (Ptr Word64)
+  -> Ptr CSize
+  -> Ptr CSize
+  -> IO ()
+
+foreign import ccall unsafe glean_subroutine_size
+  :: Ptr (Subroutine s)
+  -> IO CSize
+
+foreign import ccall unsafe glean_subroutine_literal
+  :: Ptr (Subroutine s)
+  -> CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO ()
diff --git a/glean/hs/Glean/RTS/Foreign/Define.hs b/glean/hs/Glean/RTS/Foreign/Define.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Define.hs
@@ -0,0 +1,135 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Define
+  ( Define(..)
+  , CanDefine(..)
+  , InvalidRedefinition(..)
+  , DefineFlags(..)
+  , defineFact
+  , defineBatch
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.Default
+import Data.Typeable
+import qualified Data.Vector.Storable as VS
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+import Foreign.Storable
+import Foreign.Marshal.Utils (fromBool)
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Builder
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Foreign.Subst (Subst)
+import Glean.RTS.Types (Fid(..), Pid(..), invalidFid)
+import qualified Glean.Types as Thrift
+import Glean.Util.Vector
+
+-- | A reference to a thing we can define facts in
+newtype Define = Define (Ptr Define)
+  deriving(Storable)
+
+-- | Class of things we can define facts in
+class CanDefine a where
+  withDefine :: a -> (Define -> IO b) -> IO b
+
+instance CanDefine Define where
+  withDefine l f = f l
+
+newtype InvalidRedefinition = InvalidRedefinition String
+  deriving(Show, Typeable)
+
+instance Exception InvalidRedefinition
+
+defineFact :: CanDefine a => a -> Pid -> Builder -> CSize -> IO Fid
+defineFact facts pred clause key_size =
+  withDefine facts $ \facts_ptr -> do
+    id <- invoke $ glean_define_fact facts_ptr pred clause key_size
+    when (id == invalidFid) $
+      throwIO $ InvalidRedefinition "invalid fact redefinition"
+    return id
+
+data DefineFlags = DefineFlags
+  { trustRefs :: Bool
+    -- ^ Whether to trust that fact references have the right type.
+    -- If the facts have already been typechecked then this can be set
+    -- to True to improve performance.
+  , ignoreRedef :: Bool
+    -- ^ When True, if we see a redefinition of a key/value fact where
+    -- the value is different, just discard the fact. When False,
+    -- redefinition is an error. Redefinition may safely arise in
+    -- cases where we have a cache of remote facts and the values have
+    -- been rebased with respect to different caches: the values may
+    -- be literally different but semantically identical.
+  }
+
+instance Default DefineFlags where
+  def = DefineFlags
+    { trustRefs = False
+    , ignoreRedef = False
+    }
+
+-- Prepare a Thrift batch for writing into the database by renaming and
+-- deduplicating facts.
+defineBatch
+  :: CanDefine a
+  => a                  -- ^ where to define facts
+  -> Inventory          -- ^ inventory
+  -> Thrift.Batch       -- ^ batch to rename
+  -> DefineFlags        -- ^ flags
+  -> IO Subst           -- ^ resulting substitution
+defineBatch facts inventory batch DefineFlags{..} =
+  withDefine facts $ \p_facts ->
+  with inventory $ \p_inventory ->
+  withIds $ \ids_ptr ->
+  unsafeWithBytes (Thrift.batch_facts batch) $ \facts_ptr facts_size ->
+    construct $ invoke $ glean_define_batch
+      p_facts
+      p_inventory
+      (Fid $ Thrift.batch_firstId batch)
+      ids_ptr
+      (fromIntegral $ Thrift.batch_count batch)
+      facts_ptr
+      facts_size
+      (fromBool trustRefs)
+      (fromBool ignoreRedef)
+  where
+    withIds f
+      | Just ids <- Thrift.batch_ids batch =
+          if fromIntegral (VS.length ids) == Thrift.batch_count batch
+            then VS.unsafeWith (unsafeCoerceVector ids) f
+            else throwIO $
+              Thrift.Exception "mismatch between count and ids.size in batch"
+      | otherwise = f nullPtr
+
+foreign import ccall unsafe glean_define_fact
+  :: Define
+  -> Pid
+  -> Builder
+  -> CSize
+  -> Ptr Fid
+  -> IO CString
+
+foreign import ccall safe glean_define_batch
+  :: Define
+  -> Ptr Inventory
+  -> Fid
+  -> Ptr Fid
+  -> CSize
+  -> Ptr ()
+  -> CSize
+  -> CBool
+  -> CBool
+  -> Ptr (Ptr Subst)
+  -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/FactSet.hs b/glean/hs/Glean/RTS/Foreign/FactSet.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/FactSet.hs
@@ -0,0 +1,202 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.FactSet
+  ( FactSet
+  , new
+  , factCount
+  , factMemory
+  , allocatedMemory
+  , predicateStats
+  , firstFreeId
+  , serialize
+  , serializeReorder
+  , append
+  , rebase
+  , renameFacts
+  , DefineFlags(..)
+  ) where
+
+import Control.Exception
+import Data.Int
+import Data.Vector.Storable as Vector hiding (create)
+import Data.Word
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Foreign.Define
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Foreign.Lookup (Lookup(..), CanLookup(..))
+import Glean.RTS.Foreign.LookupCache (LookupCache)
+import Glean.RTS.Foreign.Stacked (stacked)
+import Glean.RTS.Foreign.Stats (marshalPredicateStats)
+import Glean.RTS.Foreign.Subst (Subst)
+import Glean.RTS.Types (Fid(..), Pid(..))
+import qualified Glean.Types as Thrift
+
+-- An environment for defining facts
+newtype FactSet = FactSet (ForeignPtr FactSet)
+
+instance Object FactSet where
+  wrap = FactSet
+  unwrap (FactSet p) = p
+  destroy = glean_factset_free
+
+instance CanLookup FactSet where
+  lookupName _ = "factset"
+  withLookup x f = with x $ f . glean_factset_lookup
+
+instance CanDefine FactSet where
+  withDefine x f = with x $ f . glean_factset_define
+
+new :: Fid -> IO FactSet
+new next_id = construct $ invoke $ glean_factset_new next_id
+
+factCount :: FactSet -> IO Int
+factCount facts = fromIntegral <$> with facts glean_factset_fact_count
+
+factMemory :: FactSet -> IO Int
+factMemory facts = fromIntegral <$> with facts glean_factset_fact_memory
+
+allocatedMemory :: FactSet -> IO Int
+allocatedMemory facts =
+  fromIntegral <$> with facts glean_factset_allocated_memory
+
+predicateStats :: FactSet -> IO [(Pid, Thrift.PredicateStats)]
+predicateStats facts = with facts
+    $ marshalPredicateStats . glean_factset_predicateStats
+
+firstFreeId :: FactSet -> IO Fid
+firstFreeId facts = with facts glean_factset_first_free_id
+
+mkBatch :: IO (Fid, CSize, Ptr (), CSize) -> IO Thrift.Batch
+mkBatch fn = mask_ $ do
+  (Fid first_id, count, facts_data, facts_size) <- fn
+  Thrift.Batch first_id (fromIntegral count)
+    <$> unsafeMallocedByteString facts_data facts_size
+    <*> pure Nothing
+    <*> pure mempty
+    <*> pure mempty
+    <*> pure Nothing
+
+serialize :: FactSet -> IO Thrift.Batch
+serialize facts =
+  with facts $ \facts_ptr -> do
+  mkBatch $ invoke $ glean_factset_serialize facts_ptr
+
+serializeReorder :: FactSet -> Vector Int64 -> IO Thrift.Batch
+serializeReorder facts order =
+  with facts $ \facts_ptr -> do
+  unsafeWith order $ \order_ptr -> do
+    mkBatch $ invoke $ glean_factset_serializeReorder
+      facts_ptr
+      order_ptr
+      (fromIntegral (Vector.length order))
+
+rebase :: Inventory -> Subst -> LookupCache -> FactSet -> IO (FactSet, Subst)
+rebase inventory subst cache facts =
+  with inventory $ \inventory_ptr ->
+  with subst $ \subst_ptr ->
+  with cache $ \cache_ptr ->
+  with facts $ \facts_ptr ->
+  mask_ $ do
+    (p_factset, p_subst) <- invoke $
+      glean_factset_rebase
+        facts_ptr
+        inventory_ptr
+        subst_ptr
+        cache_ptr
+    (,) <$> create p_factset <*> create p_subst
+
+append :: FactSet -> FactSet -> IO ()
+append target source =
+  with target $ \target_ptr ->
+  with source $ \source_ptr ->
+  invoke $ glean_factset_append target_ptr source_ptr
+
+-- Prepare a Thrift batch for writing into the database by renaming and
+-- deduplicating facts.
+renameFacts
+  :: CanLookup l
+  => Inventory          -- ^ where to lookup predicates
+  -> l                  -- ^ where to lookup facts
+  -> Fid                -- ^ first free fact id in the database
+  -> Thrift.Batch       -- ^ batch to rename
+  -> DefineFlags        -- ^ flags
+  -> IO (FactSet, Subst)
+                        -- ^ resulting facts and substitution
+renameFacts inventory base next batch flags = do
+  added <- new next
+  subst <- defineBatch (stacked base added) inventory batch flags
+  return (added, subst)
+
+foreign import ccall unsafe glean_factset_new
+  :: Fid -> Ptr (Ptr FactSet) -> IO CString
+foreign import ccall unsafe "&glean_factset_free" glean_factset_free
+  :: FunPtr (Ptr FactSet -> IO ())
+
+foreign import ccall unsafe glean_factset_fact_count
+  :: Ptr FactSet -> IO CSize
+
+foreign import ccall unsafe glean_factset_fact_memory
+  :: Ptr FactSet -> IO CSize
+
+foreign import ccall unsafe glean_factset_allocated_memory
+  :: Ptr FactSet -> IO CSize
+
+foreign import ccall safe glean_factset_predicateStats
+  :: Ptr FactSet
+  -> Ptr CSize
+  -> Ptr (Ptr Int64)
+  -> Ptr (Ptr Word64)
+  -> Ptr (Ptr Word64)
+  -> IO CString
+
+foreign import ccall unsafe glean_factset_first_free_id
+  :: Ptr FactSet -> IO Fid
+
+foreign import ccall unsafe glean_factset_lookup
+  :: Ptr FactSet -> Ptr Lookup
+
+foreign import ccall unsafe glean_factset_define
+  :: Ptr FactSet -> Define
+
+foreign import ccall unsafe glean_factset_serialize
+  :: Ptr FactSet
+  -> Ptr Fid
+  -> Ptr CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_factset_serializeReorder
+  :: Ptr FactSet
+  -> Ptr Int64
+  -> CSize
+  -> Ptr Fid
+  -> Ptr CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_factset_rebase
+  :: Ptr FactSet
+  -> Ptr Inventory
+  -> Ptr Subst
+  -> Ptr LookupCache
+  -> Ptr (Ptr FactSet)
+  -> Ptr (Ptr Subst)
+  -> IO CString
+
+foreign import ccall unsafe glean_factset_append
+  :: Ptr FactSet -> Ptr FactSet -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/Inventory.hs b/glean/hs/Glean/RTS/Foreign/Inventory.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Inventory.hs
@@ -0,0 +1,203 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Inventory
+  ( Inventory
+  , CompiledPredicate(..)
+  , new
+  , predicates
+  , serialize
+  , deserialize
+  , Validate(..)
+  , validate
+  ) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import Data.Default
+import Data.List (unzip6)
+import Foreign hiding (with, withMany, new)
+import Foreign.C
+import System.IO.Unsafe (unsafePerformIO)
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Typecheck
+import Glean.RTS.Traverse
+import Glean.RTS.Foreign.Bytecode (Subroutine)
+import Glean.RTS.Foreign.Lookup (Lookup(..), CanLookup(..))
+import Glean.RTS.Types (Pid(..))
+import Glean.Types (PredicateRef(..))
+
+-- | Information about predicates in an open DB
+newtype Inventory = Inventory (ForeignPtr Inventory)
+
+instance Object Inventory where
+  wrap = Inventory
+  unwrap (Inventory p) = p
+  destroy = glean_inventory_free
+
+-- | A compiled predicate definition
+data CompiledPredicate = CompiledPredicate
+  { compiledPid :: Pid
+  , compiledRef :: PredicateRef
+  , compiledTypecheck :: Subroutine CompiledTypecheck
+  , compiledTraversal :: Subroutine CompiledTraversal
+  }
+
+-- | Create a new 'Inventory' from a list of predicate specs. Predicates will be
+-- assigned consecutive ids starting with first. Each predicate is accompanied
+-- by a bytecode subrouting for fact typechecking (from
+-- 'Glean.RTS.Typecheck.checkSignature').
+new :: [CompiledPredicate] -> Inventory
+-- NOTE: This is pure because inventories are immutable.
+new ps = unsafePerformIO $ withMany predicate ps $ \qs ->
+  let (ids,
+       name_ptrs,
+       name_sizes,
+       versions,
+       tcs,
+       trs) = unzip6 qs
+  in
+  withArray ids $ \p_ids ->
+  withArray name_ptrs $ \p_name_ptrs ->
+  withArray name_sizes $ \p_name_sizes ->
+  withArray versions $ \p_versions ->
+  withArray tcs $ \p_tcs ->
+  withArray trs $ \p_trs ->
+  construct $ invoke $ glean_inventory_new
+    (fromIntegral n)
+    p_ids
+    p_name_ptrs
+    p_name_sizes
+    p_versions
+    p_tcs
+    p_trs
+  where
+    !n = length ps
+    predicate CompiledPredicate{..} f =
+      withUTF8Text (predicateRef_name compiledRef) $ \name_ptr name_size ->
+      with compiledTypecheck $ \tc_ptr ->
+      with compiledTraversal $ \tr_ptr ->
+      f ( compiledPid
+        , name_ptr
+        , name_size
+        , fromIntegral $ predicateRef_version compiledRef
+        , tc_ptr
+        , tr_ptr )
+
+instance Eq Inventory where
+  a == b = unsafePerformIO $
+    with a $ \a_ptr ->
+    with b $ \b_ptr -> do
+      r <- invoke $ glean_inventory_equal a_ptr b_ptr
+      return $ r /= 0
+
+newtype PredicatePtr = PredicatePtr (Ptr PredicatePtr)
+  deriving(Storable)
+
+-- | Return all predicates from an 'Inventory'
+predicates :: Inventory -> IO [(Pid, PredicateRef)]
+predicates inventory = with inventory $ \inventory_ptr -> do
+  (count, preds) <- invoke $ glean_inventory_predicates inventory_ptr
+  usingMalloced preds $ forM [1 .. count] $ \i -> do
+    p <- peekElemOff preds $ fromIntegral i - 1
+    (pid, name_ptr, name_size, version) <- invoke $ glean_predicate_unpack p
+    ref <- PredicateRef
+      <$> fromUTF8 name_ptr name_size
+      <*> pure (fromIntegral version)
+    return (pid, ref)
+
+serialize :: Inventory -> ByteString
+serialize inventory = unsafePerformIO $
+  with inventory $ \inventory_ptr -> do
+    (bytes, size) <- invoke $ glean_inventory_serialize inventory_ptr
+    unsafeMallocedByteString bytes size
+
+deserialize :: ByteString -> Inventory
+deserialize s = unsafePerformIO $
+  unsafeWithBytes s $ \p n ->
+  construct $ invoke $ glean_inventory_deserialize p n
+
+data Validate = Validate
+  { validateTypecheck :: Bool
+  , validateKeys :: Bool
+  , validateLimit :: Maybe Int
+  }
+
+instance Default Validate where
+  def = Validate
+    { validateTypecheck = True
+    , validateKeys = True
+    , validateLimit = Nothing
+    }
+
+validate :: CanLookup a => Inventory -> Validate -> a -> IO ()
+validate inventory Validate{..} lookupable =
+  with inventory $ \inventory_ptr ->
+  withLookup lookupable $ \lookup ->
+  invoke $ glean_validate
+    inventory_ptr
+    (if validateTypecheck then 1 else 0)
+    (if validateKeys then 1 else 0)
+    (maybe maxBound fromIntegral validateLimit)
+    lookup
+
+foreign import ccall unsafe glean_inventory_new
+  :: CSize
+  -> Ptr Pid
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> Ptr Int32
+  -> Ptr (Ptr (Subroutine CompiledTypecheck))
+  -> Ptr (Ptr (Subroutine CompiledTraversal))
+  -> Ptr (Ptr Inventory)
+  -> IO CString
+foreign import ccall unsafe "&glean_inventory_free" glean_inventory_free
+  :: Destroy Inventory
+
+foreign import ccall unsafe glean_inventory_predicates
+  :: Ptr Inventory
+  -> Ptr CSize
+  -> Ptr (Ptr PredicatePtr)
+  -> IO CString
+
+foreign import ccall unsafe glean_inventory_serialize
+  :: Ptr Inventory
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_inventory_deserialize
+  :: Ptr ()
+  -> CSize
+  -> Ptr (Ptr Inventory)
+  -> IO CString
+
+foreign import ccall unsafe glean_inventory_equal
+  :: Ptr Inventory
+  -> Ptr Inventory
+  -> Ptr CBool
+  -> IO CString
+
+foreign import ccall unsafe glean_predicate_unpack
+  :: PredicatePtr
+  -> Ptr Pid
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> Ptr Int32
+  -> IO CString
+
+foreign import ccall safe glean_validate
+  :: Ptr Inventory
+  -> CChar
+  -> CChar
+  -> CSize
+  -> Ptr Lookup
+  -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/JSON.hs b/glean/hs/Glean/RTS/Foreign/JSON.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/JSON.hs
@@ -0,0 +1,265 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.JSON
+  ( Dyn, Value(..), withParsed, unfold
+  , ByteStringRef(..), getUTF8
+  , ArrayRef, size, index, toList
+  , ObjectRef, arity, field
+  , JSONError(..)
+  , encode
+  , encodeNumber
+  , getStringEscapedSize, escapeString
+  , getMangledStringEscapedSize, escapeMangledString
+  )
+where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.ST
+import Control.Monad.ST.Unsafe (unsafeIOToST)
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as Char8
+import Data.Int (Int64)
+import Data.Text (Text)
+import Data.Word (Word8)
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+import Foreign.Storable
+
+import qualified Util.Buffer as Buffer
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS (ByteStringRef(..), MangledStringRef(..))
+
+-- | Type of JSON exceptions
+newtype JSONError = JSONError String
+  deriving(Show)
+
+instance Exception JSONError
+
+-- | A dynamic JSON value which can be inspected via 'unfold'.
+newtype Dyn = Dyn (Ptr Dyn)
+
+newtype Document = Document (Ptr Document)
+  deriving(Storable)
+
+instance Static Document where
+  destroyStatic = glean_json_document_free
+
+-- | Parse a 'ByteString' containing JSON and invoke the function with the
+-- resulting 'Value'.
+--
+-- WARNING: The 'Value' and any parts of it obtained via 'unfold' are only
+-- value within the function and will be deallocated at the end.
+withParsed :: ByteString -> (Value -> IO a) -> IO a
+withParsed s f =
+  handle (throwIO . JSONError . ffiErrorMessage) $
+  unsafeWithBytes s $ \bytes size ->
+  using (invoke $ glean_json_parse (castPtr bytes) size recursionLimit) $
+  f <=< unfold <=< glean_json_document_root
+  where
+    -- folly's default of 100 is too low.
+    recursionLimit = 500
+
+-- | Reference to a JSON array.
+data ArrayRef =
+  ArrayRef
+    {-# UNPACK #-} !Dyn
+    {-# UNPACK #-} !CSize
+
+-- | Reference to a JSON object.
+data ObjectRef =
+  ObjectRef
+    {-# UNPACK #-} !Dyn
+    {-# UNPACK #-} !CSize
+
+-- | Decoded JSON value.
+data Value
+  = Null
+  | Bool !Bool
+  | Int {-# UNPACK #-} !Int64
+  | Double {-# UNPACK #-} !Double
+  | String {-# UNPACK #-} !ByteStringRef
+  | Array {-# UNPACK #-} !ArrayRef
+  | Object {-# UNPACK #-} !ObjectRef
+
+data Type
+  = NULL
+  | ARRAY
+  | BOOL
+  | DOUBLE
+  | INT64
+  | OBJECT
+  | STRING
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+-- | Unfold one level of the JSON value.
+unfold :: Dyn -> IO Value
+unfold dyn = do
+  ty <- glean_json_value_type dyn
+  case toEnum ty of
+    NULL -> return Null
+    BOOL -> do
+      b <- glean_json_value_get_bool dyn
+      return $ Bool $ b /= 0
+    INT64 -> Int <$> glean_json_value_get_int dyn
+    DOUBLE -> throwIO $
+      JSONError "JSON floating point numbers aren't supported by Glean"
+    STRING -> do
+      (chars,size) <- invoke $ glean_json_value_get_string dyn
+      return $ String $ ByteStringRef chars size
+    ARRAY -> Array . ArrayRef dyn <$> glean_json_value_get_size dyn
+    OBJECT -> Object . ObjectRef dyn <$> glean_json_value_get_size dyn
+
+getUTF8 :: ByteStringRef -> IO Text
+getUTF8 (ByteStringRef p n) = fromUTF8 (castPtr p) n
+
+-- | Array length
+size :: ArrayRef -> Int
+size (ArrayRef _ n) = fromIntegral n
+
+-- | Array indexing
+index :: ArrayRef -> Int -> IO Value
+index (ArrayRef dyn n) i
+  | j >= n = throwIO $ JSONError "JSON.index out of bounds"
+  | otherwise =
+      unfold =<< glean_json_value_get_array_element dyn j
+  where
+    j = fromIntegral i
+
+-- | Obtain all elements of the array
+toList :: ArrayRef -> IO [Value]
+toList (ArrayRef dyn n)
+  | n == 0 = return []
+  | otherwise =
+      mapM (unfold <=< glean_json_value_get_array_element dyn) [0 .. n-1]
+
+-- | Number of fiels in an object
+arity :: ObjectRef -> Int
+arity (ObjectRef _ n) = fromIntegral n
+
+-- | Field lookup by name
+field :: ObjectRef -> ByteString -> IO (Maybe Value)
+field (ObjectRef dyn _) key =
+  unsafeWithBytes key $ \bytes size -> do
+    p <- glean_json_value_get_object_field dyn (castPtr bytes) size
+    if p == nullPtr
+      then return Nothing
+      else Just <$> unfold (Dyn p)
+
+-- | Encode a 'Value' to JSON
+--
+-- FIXME: This is a truly terrible hack.
+encode :: Value -> IO ByteString
+encode Null = return "null"
+encode (Bool False) = return "false"
+encode (Bool True) = return "true"
+encode (Int n) = return $ Char8.pack $ show n
+encode (Double x) = return $ Char8.pack $ show x
+encode (String ref) = stToIO $ Buffer.fillByteString 1 $ do
+  n <- Buffer.liftST $ getStringEscapedSize ref
+  Buffer.ascii '\"'
+  Buffer.alloc n $ \p -> do
+    escapeString ref p n
+    return n
+  Buffer.ascii '\"'
+encode (Array (ArrayRef dyn _)) = encodeDyn dyn
+encode (Object (ObjectRef dyn _)) = encodeDyn dyn
+
+encodeDyn :: Dyn -> IO ByteString
+encodeDyn dyn = do
+  (s,n) <- invoke $ glean_json_encode dyn
+  unsafeMallocedByteString (castPtr s) n
+
+-- | Convert a number to its JSON representation. The output buffer must have
+-- enough space (at most 21 bytes for a signed 64 bit number).
+encodeNumber :: Int64 -> Ptr Word8 -> ST s Int
+encodeNumber w p = fromIntegral <$> unsafeIOToST (glean_json_encode_number w p)
+
+-- | Given a reference to a UTF8 string, compute the size of its JSON-escaped
+-- representation.
+getStringEscapedSize :: ByteStringRef -> ST s Int
+getStringEscapedSize (ByteStringRef p n) =
+  fromIntegral
+  <$> unsafeIOToST (glean_json_string_escaped_size p n)
+
+-- | Escape a UTF8 string for JSON.
+escapeString
+  :: ByteStringRef -- ^ string
+  -> Ptr Word8 -- ^ output buffer which must have enough space
+  -> Int -- ^ size of the escaped representation computed by
+         -- 'getStringEscapedSize'
+  -> ST s ()
+escapeString (ByteStringRef p n) o k =
+  unsafeIOToST (glean_json_string_escape p n o (fromIntegral k))
+
+-- | Given a reference to an RTS-mangled string, compute the size of its
+-- JSON-escaped representation.
+getMangledStringEscapedSize :: MangledStringRef -> ST s Int
+getMangledStringEscapedSize (MangledStringRef (ByteStringRef p n)) =
+  fromIntegral
+  <$> unsafeIOToST (glean_json_mangled_string_escaped_size p n)
+
+-- | Escape an RTS-mangled string for JSON.
+escapeMangledString
+  :: MangledStringRef -- ^ string
+  -> Ptr Word8 -- ^ output buffer which must have enough space
+  -> Int -- ^ size of the escaped representation computed by
+         -- 'getStringEscapedSize'
+  -> ST s ()
+escapeMangledString (MangledStringRef (ByteStringRef p n)) o k =
+  unsafeIOToST (glean_json_mangled_string_escape p n o (fromIntegral k))
+
+foreign import ccall safe glean_json_parse
+  :: Ptr CChar -> CSize -> CSize -> Ptr Document -> IO CString
+foreign import ccall unsafe glean_json_document_free
+  :: Document -> IO ()
+foreign import ccall unsafe glean_json_document_root
+  :: Document -> IO Dyn
+
+foreign import ccall unsafe glean_json_value_type
+  :: Dyn -> IO Int
+
+foreign import ccall unsafe glean_json_value_get_int
+  :: Dyn -> IO Int64
+foreign import ccall unsafe glean_json_value_get_bool
+  :: Dyn -> IO CInt
+foreign import ccall unsafe glean_json_value_get_string
+  :: Dyn -> Ptr (Ptr Word8) -> Ptr CSize -> IO ()
+foreign import ccall unsafe glean_json_value_get_size
+  :: Dyn -> IO CSize
+foreign import ccall unsafe glean_json_value_get_array_element
+  :: Dyn -> CSize -> IO Dyn
+foreign import ccall unsafe glean_json_value_get_object_field
+  :: Dyn
+  -> Ptr CChar
+  -> CSize
+  -> IO (Ptr Dyn)
+
+foreign import ccall unsafe glean_json_encode
+  :: Dyn -> Ptr (Ptr Word8) -> Ptr CSize -> IO CString
+
+foreign import ccall unsafe glean_json_encode_number
+  :: Int64
+  -> Ptr Word8
+  -> IO CSize
+
+foreign import ccall unsafe glean_json_string_escaped_size
+  :: Ptr Word8 -> CSize -> IO CSize
+
+foreign import ccall unsafe glean_json_string_escape
+  :: Ptr Word8 -> CSize -> Ptr Word8 -> CSize -> IO ()
+
+foreign import ccall unsafe glean_json_mangled_string_escaped_size
+  :: Ptr Word8 -> CSize -> IO CSize
+
+foreign import ccall unsafe glean_json_mangled_string_escape
+  :: Ptr Word8 -> CSize -> Ptr Word8 -> CSize -> IO ()
diff --git a/glean/hs/Glean/RTS/Foreign/Lookup.hs b/glean/hs/Glean/RTS/Foreign/Lookup.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Lookup.hs
@@ -0,0 +1,109 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Lookup
+  ( Lookup(..)
+  , CanLookup(..)
+  , withCanLookup
+  , EmptyLookup(..)
+  , startingId
+  , firstFreeId
+  , lookupFact
+  , withSnapshot
+) where
+
+import Control.Exception (bracket)
+import Data.Int
+import Data.Text
+import Foreign.C
+import Foreign.Ptr
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Types (Fid(..))
+import qualified Glean.Types as Thrift
+
+-- | A reference to a thing we can look up facts in
+data Lookup = Lookup
+  { lookupPtr :: Ptr Lookup
+  , lookupName_ :: Text
+  }
+
+-- | Class of things we can look up facts in
+class CanLookup a where
+  withLookup :: a -> (Ptr Lookup -> IO b) -> IO b
+  lookupName :: a -> Text
+
+instance CanLookup Lookup where
+  withLookup l f = f (lookupPtr l)
+  lookupName = lookupName_
+
+withCanLookup :: CanLookup lookup => lookup -> (Lookup -> IO a) -> IO a
+withCanLookup lookup f =
+  withLookup lookup $ \p -> f (Lookup p (lookupName lookup))
+
+startingId :: CanLookup a => a -> IO Fid
+startingId x = withLookup x $ \l -> invoke $ glean_lookup_starting_id l
+
+firstFreeId :: CanLookup a => a -> IO Fid
+firstFreeId x = withLookup x $ \l -> invoke $ glean_lookup_first_free_id l
+
+data EmptyLookup = EmptyLookup
+
+instance CanLookup EmptyLookup where
+  lookupName EmptyLookup = "lookup:empty"
+  withLookup EmptyLookup f =
+    bracket
+      (invoke glean_lookup_empty)
+      glean_lookup_free
+      f
+
+lookupFact :: CanLookup a => a -> Fid -> IO (Maybe Thrift.Fact)
+lookupFact look fid =
+  withLookup look $ \look_ptr -> do
+    (pid, key_ptr, key_size, val_ptr, val_size) <-
+      invoke $ glean_lookup_fact look_ptr fid
+    if pid == 0
+      then return Nothing
+      else fmap Just $ Thrift.Fact pid
+            <$> unsafeMallocedByteString key_ptr key_size
+            <*> unsafeMallocedByteString val_ptr val_size
+
+-- | Restrict the Lookup to facts up to the specified fact id
+withSnapshot :: CanLookup a => a -> Fid -> (Lookup -> IO b) -> IO b
+withSnapshot base boundary f =
+  withLookup base $ \base_ptr ->
+  bracket
+    (invoke $ glean_snapshot_new base_ptr boundary)
+    glean_lookup_free
+    (\p -> f (Lookup p (lookupName base)))
+
+foreign import ccall unsafe glean_lookup_empty
+  :: Ptr (Ptr Lookup) -> IO CString
+
+foreign import ccall unsafe glean_lookup_free
+  :: Ptr Lookup -> IO ()
+
+foreign import ccall unsafe glean_snapshot_new
+  :: Ptr Lookup -> Fid -> Ptr (Ptr Lookup) -> IO CString
+
+foreign import ccall unsafe glean_lookup_starting_id
+  :: Ptr Lookup -> Ptr Fid -> IO CString
+foreign import ccall unsafe glean_lookup_first_free_id
+  :: Ptr Lookup -> Ptr Fid -> IO CString
+
+foreign import ccall safe glean_lookup_fact
+  :: Ptr Lookup
+  -> Fid
+  -> Ptr Int64
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/LookupCache.hs b/glean/hs/Glean/RTS/Foreign/LookupCache.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/LookupCache.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.LookupCache
+ ( LookupCache, new, clear, withCache, ReplacementPolicy(..)
+ , Stats, StatValues, Stat(..)
+ , isCounter, getStat, newStats, readStatsAndResetCounters
+ , countFailuresAsMisses
+ )
+where
+
+import Control.Exception
+import Data.List
+import qualified Data.Vector.Storable as V
+import qualified Data.Vector.Storable.Mutable as VM
+import Data.Word
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Foreign.Lookup
+
+-- NOTE: This must be kept in sync with the ReplacementPolicy in rts/cache.h
+data ReplacementPolicy
+  = LRU  -- evict least-recently-used entries
+  | FIFO -- evict the oldest entries. Faster with many concurrent clients
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+newtype LookupCache = LookupCache (ForeignPtr LookupCache)
+
+instance Object LookupCache where
+  wrap = LookupCache
+  unwrap (LookupCache p) = p
+  destroy = glean_lookupcache_free
+
+-- | Pair the 'LookupCache' with a base 'Lookup' for looking up facts. It is
+-- the user's responsibility to ensure that the 'Lookup's are morally the same
+-- throughout the cache's lifetime (such as different instances of the same
+-- database).
+withCache
+  :: CanLookup base
+  => base
+  -> LookupCache
+  -> ReplacementPolicy
+  -> (Lookup -> IO a)
+  -> IO a
+withCache base cache replacement_policy f =
+  withLookup base $ \base_lookup ->
+  with cache $ \cache_ptr ->
+  bracket
+    (invoke $ glean_lookupcache_anchor_new
+      base_lookup
+      cache_ptr
+      (fromEnum replacement_policy))
+    glean_lookupcache_anchor_free
+    (\p -> f (Lookup p ("anchor:" <> lookupName base)))
+
+-- | The 'Stat' object can be shared between different 'LookupCache's which will
+-- accumulate their statistics into it (cf. 'new').
+newtype Stats = Stats (ForeignPtr Stats)
+
+instance Object Stats where
+  wrap = Stats
+  unwrap (Stats p) = p
+  destroy = glean_lookupcache_stats_free
+
+
+-- | An approximate snapshot of the values in a 'Stats' object
+newtype StatValues = StatValues (V.Vector Word64)
+
+instance Semigroup StatValues where
+  StatValues old <> StatValues new = StatValues $
+    V.izipWith (\i o n -> if isCounter (toEnum i) then o+n else n) old new
+
+instance Monoid StatValues where
+  mempty = StatValues $ V.replicate sTAT_COUNT 0
+
+instance Show StatValues where
+  show statValues = intercalate ", " $ map (f statValues) $ enumFrom minBound
+    where
+      f statValues stat =
+        show stat <> ": " <> show (getStat statValues stat)
+
+-- NOTE: This must be kept in sync with the stats in rts/cache.h
+data Stat
+  = IdByKey_hits
+  | IdByKey_misses
+  | IdByKey_failures
+  | IdByKey_deletes
+  | TypeById_hits
+  | TypeById_misses
+  | TypeById_failures
+  | FactById_hits
+  | FactById_misses
+  | FactById_failures
+  | FactById_deletes
+
+    -- slightly ugly names because we want them to be nice on ODS
+  | Fact_bytes
+  | Fact_count
+  deriving(Eq,Ord,Enum,Bounded,Show)
+
+sTAT_COUNT :: Int
+sTAT_COUNT = fromEnum (maxBound :: Stat) + 1
+
+lAST_COUNTER :: Stat
+lAST_COUNTER = FactById_deletes
+
+-- | Counters are values which we want to bump in ODS; the others we want to
+-- set.
+isCounter :: Stat -> Bool
+isCounter x = x <= lAST_COUNTER
+
+getStat :: StatValues -> Stat -> Word64
+getStat (StatValues as) c = as V.! fromEnum c
+
+newStats :: IO Stats
+newStats = construct $ invoke glean_lookupcache_stats_new
+
+-- | Obtain an approximate snapshot of the values in 'Stats' and reset all
+-- counters to 0 (but not sums like total cache size).
+readStatsAndResetCounters :: Stats -> IO StatValues
+readStatsAndResetCounters stats = do
+  v <- VM.new sTAT_COUNT
+  with stats $ \pstats ->
+    VM.unsafeWith v $ \pdata ->
+    glean_lookupcache_stats_read_and_reset_counters
+      pstats
+      pdata
+      (fromIntegral $ VM.length v)
+  StatValues <$> V.unsafeFreeze v
+
+-- | Replace miss counts with failure counts. This is useful when the cache is
+-- being used without a base DB, e.g. in SendAndRebaseQueue. In that case there
+-- will always be zero cache misses, and we're interested in failures.
+countFailuresAsMisses :: StatValues -> StatValues
+countFailuresAsMisses stats@(StatValues vec) = StatValues $
+  vec V.//
+    [ (fromEnum IdByKey_misses, getStat stats IdByKey_failures)
+    , (fromEnum TypeById_misses, getStat stats TypeById_failures)
+    , (fromEnum FactById_misses, getStat stats FactById_failures)
+    ]
+
+new :: Word64 -> Int -> Stats -> IO LookupCache
+new capacity shards stats =
+  with stats $ construct . invoke . glean_lookupcache_new
+    (fromIntegral capacity)
+    (fromIntegral shards)
+
+clear :: LookupCache -> IO ()
+clear cache = with cache $ invoke . glean_lookupcache_clear
+
+foreign import ccall unsafe glean_lookupcache_stats_new
+  :: Ptr (Ptr Stats) -> IO CString
+foreign import ccall unsafe "&glean_lookupcache_stats_free"
+  glean_lookupcache_stats_free :: Destroy Stats
+foreign import ccall safe glean_lookupcache_stats_read_and_reset_counters
+  :: Ptr Stats -> Ptr Word64 -> CSize -> IO ()
+
+
+foreign import ccall unsafe glean_lookupcache_new
+  :: CSize
+  -> CSize
+  -> Ptr Stats
+  -> Ptr (Ptr LookupCache)
+  -> IO CString
+foreign import ccall unsafe "&glean_lookupcache_free" glean_lookupcache_free
+  :: Destroy LookupCache
+foreign import ccall safe glean_lookupcache_clear
+  :: Ptr LookupCache -> IO ()
+
+foreign import ccall unsafe glean_lookupcache_anchor_new
+  :: Ptr Lookup
+  -> Ptr LookupCache
+  -> Int
+  -> Ptr (Ptr Lookup)
+  -> IO CString
+foreign import ccall unsafe glean_lookupcache_anchor_free
+  :: Ptr Lookup -> IO ()
diff --git a/glean/hs/Glean/RTS/Foreign/Ownership.hsc b/glean/hs/Glean/RTS/Foreign/Ownership.hsc
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Ownership.hsc
@@ -0,0 +1,482 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Ownership
+  ( UnitIterator
+  , compute
+  , UnitId(..)
+  , UsetId(..)
+  , firstUsetId
+  , Ownership
+  , ComputedOwnership
+  , Slice
+  , slice
+  , slicedStack
+  , SlicedStack
+  , serializeSlice
+  , deserializeSlice
+  , newDefineOwnership
+  , DefineOwnership
+  , substDefineOwnership
+  , defineOwnershipSortByOwner
+  , addDerivedOwners
+  , DerivedFactOwnershipIterator
+  , computeDerivedOwnership
+  , getFactOwner
+  , SetOp(..)
+  , getOwnershipSet
+  , OwnershipStats(..)
+  , getOwnershipStats
+  , showOwnershipStats
+  , nextUsetId
+  , FactOwnership(..)
+  , substOwnership
+  , unionOwnership
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.ByteString (ByteString)
+import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
+import Data.Coerce
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List (unzip4)
+import Data.Text (Text)
+import qualified Data.Vector.Storable as VS
+import Data.Vector.Storable (Vector)
+import Data.Int
+import Data.Word
+import Foreign.Ptr
+import Foreign.ForeignPtr
+import Foreign.Storable
+import Foreign.Marshal hiding (with)
+import Foreign.C
+import TextShow
+
+import Foreign.CPP.HsStruct
+import Foreign.CPP.Marshallable
+import Util.FFI
+import Util.PrettyPrint
+
+import Glean.FFI hiding (withMany)
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Foreign.Lookup
+import Glean.RTS.Foreign.Subst
+import Glean.RTS.Types
+import qualified Glean.Types as Thrift
+import Glean.Util.Vector
+
+newtype UnitIterator = UnitIterator (Ptr UnitIterator)
+  deriving(Storable)
+
+instance Static UnitIterator where
+  destroyStatic = glean_ownership_unit_iterator_free
+
+-- | Id of a unit
+newtype UnitId = UnitId Word32
+  deriving (Storable, Show)
+
+-- | Id of an ownership set
+newtype UsetId = UsetId Word32
+  deriving (Storable)
+
+firstUsetId :: UsetId
+firstUsetId = UsetId 0
+
+newtype Ownership = Ownership (ForeignPtr Ownership)
+
+instance Object Ownership where
+  wrap = Ownership
+  unwrap (Ownership p) = p
+  destroy = glean_ownership_free
+
+newtype ComputedOwnership = ComputedOwnership (ForeignPtr ComputedOwnership)
+
+instance Object ComputedOwnership where
+  wrap = ComputedOwnership
+  unwrap (ComputedOwnership p) = p
+  destroy = glean_computed_ownership_free
+
+compute
+  :: (CanLookup db, CanLookup base)
+  => Inventory
+  -> db
+  -> Maybe base
+     -- ^ base DB if there is one
+  -> UnitIterator
+  -> IO ComputedOwnership
+compute inv l base iter =
+  with inv $ \inv_ptr ->
+  withLookup l $ \lookup ->
+  maybe ($ nullPtr) withLookup base $ \base_lookup_ptr ->
+  construct $ invoke $
+    glean_ownership_compute inv_ptr lookup iter base_lookup_ptr
+
+newtype Slice = Slice (ForeignPtr Slice)
+
+instance Object Slice where
+  wrap = Slice
+  unwrap (Slice p) = p
+  destroy = glean_slice_free
+
+-- | Construct a slice view of a DB from a set of UnitIds
+slice :: Ownership -> [Slice] -> [UnitId] -> Bool -> IO Slice
+slice ownership bases units exclude =
+  with ownership $ \ownership_ptr ->
+  withArrayLen (coerce units) $ \unit_arr_size unit_arr ->
+  withMany with bases $ \bases_ptrs ->
+  withArrayLen bases_ptrs $ \bases_arr_size bases_arr ->
+  construct $ invoke $ glean_slice_compute
+    ownership_ptr
+    unit_arr
+    (fromIntegral unit_arr_size)
+    (fromIntegral (fromEnum exclude))
+    bases_arr
+    (fromIntegral bases_arr_size)
+
+serializeSlice :: Slice -> IO ByteString
+serializeSlice slice =
+  with slice $ \p_slice -> do
+    (bytes, size) <- invoke $ glean_slice_serialize p_slice
+    unsafeMallocedByteString bytes size
+
+deserializeSlice :: ByteString -> IO Slice
+deserializeSlice bs =
+  unsafeUseAsCStringLen bs $ \(ptr, len) ->
+    construct $ invoke $
+      glean_slice_deserialize (castPtr ptr) (fromIntegral len)
+
+data SlicedStack base = SlicedStack [Slice] base
+
+slicedStack
+  :: CanLookup base
+  => [Slice]
+  -> base
+  -> SlicedStack base
+slicedStack = SlicedStack
+
+instance CanLookup base => CanLookup (SlicedStack base) where
+  lookupName (SlicedStack _ base) = "slicedstack:" <> lookupName base
+  withLookup (SlicedStack list base) f =
+    withLookup base $ \p_base ->
+    withMany with list $ \slices ->
+    withArray slices $ \slices_arr ->
+    bracket
+      (invoke $ glean_make_sliced_stack
+        p_base (fromIntegral (length list)) slices_arr)
+      glean_sliced_stack_free
+      f
+
+newtype DefineOwnership = DefineOwnership (ForeignPtr DefineOwnership)
+
+instance Object DefineOwnership where
+  wrap = DefineOwnership
+  unwrap (DefineOwnership p) = p
+  destroy = glean_define_ownership_free
+
+newDefineOwnership :: Ownership -> Fid -> IO DefineOwnership
+newDefineOwnership ownership (Fid first_id) =
+  with ownership $ \ownership_ptr ->
+    construct $ invoke $
+      glean_new_define_ownership ownership_ptr (fromIntegral first_id)
+
+substDefineOwnership :: DefineOwnership -> Subst -> IO ()
+substDefineOwnership define subst =
+  with define $ \define_ptr ->
+  with subst $ \subst_ptr ->
+    invoke $ glean_define_ownership_subst define_ptr subst_ptr
+
+addDerivedOwners
+  :: CanLookup base
+  => base
+  -> DefineOwnership
+  -> Pid
+  -> [Thrift.FactDependencies]
+  -> IO ()
+addDerivedOwners base define (Pid pid) deps =
+  when (not $ null deps) $
+  with define $ \define_ptr ->
+  withLookup base $ \base_lookup_ptr ->
+  withMany entry deps $ \xs ->
+  let !(facts_ptrs, facts_sizes, deps_ptrs, deps_sizes) = unzip4 xs in
+  withArray facts_ptrs $ \p_facts_ptrs ->
+  withArray facts_sizes $ \p_facts_sizes ->
+  withArray deps_ptrs $ \p_deps_ptrs ->
+  withArray deps_sizes $ \p_deps_sizes ->
+    invoke $ glean_define_ownership_add_derived
+      base_lookup_ptr
+      define_ptr
+      (fromIntegral pid)
+      (fromIntegral $ length deps)
+      (castPtr p_facts_ptrs)
+      p_facts_sizes
+      (castPtr p_deps_ptrs)
+      p_deps_sizes
+  where
+    entry (Thrift.FactDependencies facts deps) f =
+      VS.unsafeWith facts $ \facts_ptr ->
+      VS.unsafeWith deps $ \deps_ptr -> do
+      let
+        !num_facts = fromIntegral $ VS.length facts
+        !num_deps = fromIntegral $ VS.length deps
+      f (facts_ptr, num_facts, deps_ptr, num_deps)
+
+
+newtype DerivedFactOwnershipIterator =
+  DerivedFactOwnershipIterator (Ptr DerivedFactOwnershipIterator)
+  deriving(Storable)
+
+instance Static DerivedFactOwnershipIterator where
+  destroyStatic = glean_derived_fact_ownership_iterator_free
+
+computeDerivedOwnership
+  :: (CanLookup base)
+  => Ownership
+  -> Maybe base
+  -> DerivedFactOwnershipIterator
+  -> IO ComputedOwnership
+computeDerivedOwnership ownership base iter =
+  with ownership $ \ownership_ptr ->
+  maybe ($ nullPtr) withLookup base $ \base_lookup_ptr ->
+    construct $ invoke $
+      glean_derived_ownership_compute ownership_ptr base_lookup_ptr iter
+
+defineOwnershipSortByOwner
+  :: DefineOwnership
+  -> Int
+  -> VS.Vector Int64
+  -> IO (VS.Vector Int64)
+defineOwnershipSortByOwner define count order =
+  with define $ \define_ptr -> do
+  VS.unsafeWith order $ \order_ptr -> do
+  withDefaultCxxObject $ \arr_ptr -> do
+    invoke $ glean_define_ownership_sort_by_owner define_ptr
+      (fromIntegral count) order_ptr (fromIntegral (VS.length order)) arr_ptr
+    hsArrayStorable <$> peek (castPtr arr_ptr)
+
+#include <glean/rts/ownership/uset.h>
+#include <glean/rts/ownership.h>
+
+getFactOwner :: CanLookup a => a -> Fid -> IO (Maybe UsetId)
+getFactOwner lookup (Fid fid) =
+  withLookup lookup $ \p_lookup -> do
+    usetId <- invoke $ glean_get_fact_owner p_lookup (fromIntegral fid)
+    if usetId == (#const facebook::glean::rts::INVALID_USET)
+      then return Nothing
+      else return (Just (UsetId usetId))
+
+data SetOp = Or | And
+  deriving (Eq, Ord, Enum)
+
+getOwnershipSet :: Ownership -> UsetId -> IO (Maybe (SetOp, VS.Vector UsetId))
+getOwnershipSet ownership usetid =
+  with ownership $ \ownership_ptr ->
+  bracket
+    (invoke $ glean_get_ownership_set ownership_ptr usetid)
+    (\(_, arr_ptr) -> when (arr_ptr /= nullPtr) $ delete arr_ptr)
+    (\(cop, arr_ptr) -> do
+      if arr_ptr == nullPtr
+        then return Nothing
+        else do
+          vec <- hsArrayStorable <$> peek (castPtr arr_ptr)
+          let op | cop == (#const facebook::glean::rts::Or) = Or
+                 | cop == (#const facebook::glean::rts::And) = And
+                 | otherwise = error "unknown SetOp"
+          return $ Just (op, unsafeCoerceVector (vec :: VS.Vector Word32))
+    )
+
+data OwnershipStats = OwnershipStats
+  { numUnits :: Word64
+  , unitsSize :: Word64
+  , numSets :: Word64
+  , setsSize :: Word64
+  , numOwnerEntries :: Word64
+  , ownersSize :: Word64
+  , numOrphanFacts :: Int64
+  }
+
+showOwnershipStats :: OwnershipStats -> Text
+showOwnershipStats OwnershipStats{..} =
+  showt numUnits <> " units (" <>
+    renderBytes (fromIntegral unitsSize) <> "), " <>
+  showt numSets <> " sets (" <>
+    renderBytes (fromIntegral setsSize) <> "), " <>
+  showt numOwnerEntries <> " owners (" <>
+    renderBytes (fromIntegral ownersSize) <> ")" <>
+  (if numOrphanFacts >= 0
+    then ", " <> showt numOrphanFacts <> " orphan facts"
+    else "")
+
+instance Storable OwnershipStats where
+  peek p = do
+    numUnits <- (# peek facebook::glean::rts::OwnershipStats, num_units) p
+    unitsSize <- (# peek facebook::glean::rts::OwnershipStats, units_size) p
+    numSets <- (# peek facebook::glean::rts::OwnershipStats, num_sets) p
+    setsSize <- (# peek facebook::glean::rts::OwnershipStats, sets_size) p
+    numOwnerEntries <-
+      (# peek facebook::glean::rts::OwnershipStats, num_owner_entries) p
+    ownersSize <- (# peek facebook::glean::rts::OwnershipStats, owners_size) p
+    numOrphanFacts <-
+      (# peek facebook::glean::rts::OwnershipStats, num_orphan_facts) p
+    return OwnershipStats{..}
+  sizeOf _ = (# size facebook::glean::rts::OwnershipStats)
+  alignment _ = (# alignment facebook::glean::rts::OwnershipStats)
+  poke _ = error "Storable OwnershipStats"
+
+getOwnershipStats :: Ownership -> IO OwnershipStats
+getOwnershipStats ownership =
+  with ownership $ \ownership_ptr -> do
+    invoke $ glean_get_ownership_stats ownership_ptr
+
+nextUsetId :: Ownership -> IO UsetId
+nextUsetId ownership =
+  with ownership $ \ownership_ptr -> do
+    invoke $ glean_ownership_next_set_id ownership_ptr
+
+-- -----------------------------------------------------------------------------
+-- Fact ownership
+
+-- | Ownership associated with a fact batch
+newtype FactOwnership = FactOwnership
+  { ownershipUnits :: HashMap Thrift.UnitName (Vector Thrift.Id)
+     -- ^ exactly the same as Batch.owned in glean.thrift
+  }
+
+substOwnership :: Subst -> FactOwnership -> IO FactOwnership
+substOwnership subst (FactOwnership owned) = do
+  let apply x = unsafeCoerceVector <$>
+        unsafeSubstIntervalsAndRelease subst (unsafeCoerceVector x)
+  FactOwnership <$> traverse apply owned
+
+unionOwnership :: [FactOwnership] -> FactOwnership
+unionOwnership =
+  FactOwnership
+  . fmap VS.concat
+  . foldr
+      (HashMap.unionWith (<>) . fmap (: []) . ownershipUnits)
+      HashMap.empty
+
+-- -----------------------------------------------------------------------------
+-- FFI
+
+foreign import ccall safe glean_get_ownership_stats
+  :: Ptr Ownership
+  -> Ptr OwnershipStats
+  -> IO CString
+
+foreign import ccall unsafe glean_new_define_ownership
+  :: Ptr Ownership
+  -> Word64
+  -> Ptr (Ptr DefineOwnership)
+  -> IO CString
+
+foreign import ccall unsafe "&glean_define_ownership_free"
+  glean_define_ownership_free :: FunPtr (Ptr DefineOwnership -> IO ())
+
+foreign import ccall safe glean_define_ownership_subst
+  :: Ptr DefineOwnership
+  -> Ptr Subst
+  -> IO CString
+
+foreign import ccall safe glean_define_ownership_sort_by_owner
+  :: Ptr DefineOwnership
+  -> Word64
+  -> Ptr Int64
+  -> CSize
+  -> Ptr (HsArray Int64)
+  -> IO CString
+
+foreign import ccall safe glean_define_ownership_add_derived
+  :: Ptr Lookup
+  -> Ptr DefineOwnership
+  -> Word64
+  -> CSize
+  -> Ptr (Ptr Word64)
+  -> Ptr CSize
+  -> Ptr (Ptr Word64)
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_ownership_unit_iterator_free
+  :: UnitIterator -> IO ()
+
+foreign import ccall unsafe glean_derived_fact_ownership_iterator_free
+  :: DerivedFactOwnershipIterator -> IO ()
+
+foreign import ccall safe glean_ownership_compute
+  :: Ptr Inventory
+  -> Ptr Lookup
+  -> UnitIterator
+  -> Ptr Lookup
+  -> Ptr (Ptr ComputedOwnership)
+  -> IO CString
+
+foreign import ccall unsafe glean_get_fact_owner
+  :: Ptr Lookup
+  -> Word64
+  -> Ptr Word32
+  -> IO CString
+
+foreign import ccall unsafe glean_get_ownership_set
+  :: Ptr Ownership
+  -> UsetId
+  -> Ptr CInt
+  -> Ptr (Ptr (HsArray Word32))
+  -> IO CString
+
+foreign import ccall safe glean_derived_ownership_compute
+  :: Ptr Ownership
+  -> Ptr Lookup
+  -> DerivedFactOwnershipIterator
+  -> Ptr (Ptr ComputedOwnership)
+  -> IO CString
+
+foreign import ccall unsafe "&glean_ownership_free"
+   glean_ownership_free :: FunPtr (Ptr Ownership -> IO ())
+
+foreign import ccall unsafe "&glean_computed_ownership_free"
+   glean_computed_ownership_free :: FunPtr (Ptr ComputedOwnership -> IO ())
+
+foreign import ccall safe glean_slice_compute
+  :: Ptr Ownership
+  -> Ptr Word32
+  -> CSize
+  -> CInt
+  -> Ptr (Ptr Slice)
+  -> CSize
+  -> Ptr (Ptr Slice)
+  -> IO CString
+
+foreign import ccall unsafe glean_slice_serialize
+  :: Ptr Slice
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_slice_deserialize
+  :: Ptr ()
+  -> CSize
+  -> Ptr (Ptr Slice)
+  -> IO CString
+
+foreign import ccall unsafe "&glean_slice_free"
+   glean_slice_free :: FunPtr (Ptr Slice -> IO ())
+
+foreign import ccall unsafe glean_make_sliced_stack
+  :: Ptr Lookup
+  -> CSize
+  -> Ptr (Ptr Slice)
+  -> Ptr (Ptr Lookup)
+  -> IO CString
+
+foreign import ccall unsafe
+   glean_sliced_stack_free :: Ptr Lookup -> IO ()
+
+foreign import ccall unsafe
+   glean_ownership_next_set_id :: Ptr Ownership -> Ptr UsetId -> IO CString
diff --git a/glean/hs/Glean/RTS/Foreign/Query.hsc b/glean/hs/Glean/RTS/Foreign/Query.hsc
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Query.hsc
@@ -0,0 +1,305 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Query
+  ( CompiledQuery(..)
+  , executeCompiled
+  , restartCompiled
+  , interruptRunningQueries
+  , QueryRuntimeOptions(..)
+  , Depth(..)
+  , QueryResults(..)
+  ) where
+
+#include "glean/rts/ffi.h"
+#include "glean/rts/query.h"
+
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as ByteString
+import Data.Int
+import Data.Map (Map)
+import Data.Maybe
+import Data.Set (Set)
+import qualified Data.Set as Set
+import qualified Data.Vector as Vector
+import Data.Vector (Vector)
+import Foreign.C
+import Foreign hiding (with)
+
+import Foreign.CPP.HsStruct.Types
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Foreign.Bytecode
+import Glean.RTS.Foreign.Define
+import Glean.RTS.Foreign.Inventory
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Traverse
+import Glean.RTS.Types (Fid(..), Pid(..))
+import Glean.Types as Thrift
+
+newtype Results = Results (Ptr Results)
+  deriving(Storable)
+
+instance Static Results where
+  destroyStatic = glean_free_query_results
+
+-- | Specifies the depth to which we expand nested facts in the results
+data Depth
+  = ResultsOnly
+    -- ^ Don't expand any nested facts in the results
+  | ExpandRecursive
+    -- ^ Expand all nested facts recursively
+  | ExpandPartial (Set Pid)
+    -- ^ Only expand nested facts with these Pids
+
+data QueryRuntimeOptions = QueryRuntimeOptions
+  { queryMaxResults :: Maybe Int64
+  , queryMaxBytes :: Maybe Int64
+  , queryMaxTimeMs :: Maybe Int64
+  , queryMaxSetSize :: Maybe Int64
+  , queryDepth :: Depth
+  , queryWantStats :: Bool
+  }
+
+data QueryResults = QueryResults
+  { queryResultsFacts :: Vector (Fid, Thrift.Fact)
+  , queryResultsNestedFacts :: Vector (Fid, Thrift.Fact)
+  , queryResultsStats :: Maybe (Map Int64 Int64)
+  , queryResultsElapsedNs :: Word64
+  , queryResultsCont :: Maybe ByteString
+  , queryResultsResultBytes :: Int64
+  }
+
+data CompiledQuery = CompiledQuery
+  { compiledQuerySub :: Subroutine CompiledQuery
+  , compiledQueryResultPid :: Maybe Pid
+    -- ^ If all the result facts have the same Pid, this is it.
+  , compiledQueryResultTraversal :: Maybe (Subroutine CompiledTraversal)
+    -- ^ The query engine needs to know how to traverse the query
+    -- results to expand nested facts. If the result is not an
+    -- existing predicate type then we have to pass in a bespoke
+    -- CompiledTraversal subroutine.
+  , compiledQueryFullScans :: [Pid]
+    -- ^ whether the query performs a full predicate scan
+  }
+
+executeCompiled
+  :: CanDefine a
+  => Inventory
+  -> Maybe DefineOwnership
+  -> a
+  -> CompiledQuery
+  -> QueryRuntimeOptions
+  -> IO QueryResults
+executeCompiled inventory ownership facts
+    CompiledQuery{..} QueryRuntimeOptions{..} =
+  withDefine facts $ \facts_ptr ->
+  with inventory $ \inventory_ptr ->
+  with compiledQuerySub $ \sub_ptr ->
+  maybe ($ nullPtr) with ownership $ \ownership_ptr ->
+  let
+    maxr = fromIntegral (fromMaybe 0 queryMaxResults)
+    maxb = fromIntegral (fromMaybe 0 queryMaxBytes)
+    maxt = fromIntegral (fromMaybe 0 queryMaxTimeMs)
+    maxs = fromIntegral (fromMaybe 0 queryMaxSetSize)
+    withTraversal = case compiledQueryResultTraversal of
+       Nothing -> ($ nullPtr)
+       Just sub -> with sub
+  in
+  withTraversal $ \traversal_ptr ->
+  withDepth queryDepth $ \(depth, expand_pids, num_expand_pids) ->
+  using
+    (invoke $ \presults -> glean_query_execute_compiled
+      inventory_ptr
+      facts_ptr
+      ownership_ptr
+      sub_ptr
+      (maybe 0 (fromIntegral . fromPid) compiledQueryResultPid)
+      traversal_ptr
+      maxr
+      maxb
+      maxt
+      maxs
+      depth
+      expand_pids
+      num_expand_pids
+      (if queryWantStats then 1 else 0)
+      presults)
+    (unpackResults queryWantStats compiledQueryResultPid)
+
+restartCompiled
+  :: CanDefine a
+  => Inventory
+  -> Maybe DefineOwnership
+  -> a
+  -> Maybe Pid
+  -> QueryRuntimeOptions
+  -> ByteString   -- serialized thrift::internal::QueryCont
+  -> IO QueryResults
+restartCompiled inventory ownership facts pid
+    QueryRuntimeOptions{..} serializedCont =
+  withDefine facts $ \facts_ptr ->
+  with inventory $ \inventory_ptr ->
+  unsafeWithBytes serializedCont $ \cont_ptr cont_size ->
+  maybe ($ nullPtr) with ownership $ \ownership_ptr ->
+  let
+    maxr = fromIntegral (fromMaybe 0 queryMaxResults)
+    maxb = fromIntegral (fromMaybe 0 queryMaxBytes)
+    maxt = fromIntegral (fromMaybe 0 queryMaxTimeMs)
+    maxs = fromIntegral (fromMaybe 0 queryMaxSetSize)
+  in
+  withDepth queryDepth $ \(depth, expand_pids, num_expand_pids) ->
+  using
+    (invoke $ \presults -> glean_query_restart_compiled
+      inventory_ptr
+      facts_ptr
+      ownership_ptr
+      cont_ptr
+      cont_size
+      maxr
+      maxb
+      maxt
+      maxs
+      depth
+      expand_pids
+      num_expand_pids
+      (if queryWantStats then 1 else 0)
+      presults)
+    (unpackResults queryWantStats pid)
+
+withDepth :: Depth -> ((Word64, Ptr Word64, Word64) -> IO a) -> IO a
+withDepth depth f = case depth of
+  ResultsOnly -> f (depth_ResultsOnly, nullPtr, 0)
+  ExpandRecursive -> f (depth_ExpandRecursive, nullPtr, 0)
+  ExpandPartial pids -> do
+    let list = [ fromIntegral (fromPid p) | p <- Set.toList pids ]
+    withArrayLen list $ \len p ->
+      f (depth_ExpandPartial, p, fromIntegral len)
+
+unpackResults :: Bool -> Maybe Pid -> Results -> IO QueryResults
+unpackResults wantStats maybePid (Results p) = do
+  fact_ids <- (# peek facebook::glean::rts::QueryResults, fact_ids) p
+  -- don't marshal the pids if we know what they are
+  fact_pids <-
+    if isNothing maybePid
+      then (# peek facebook::glean::rts::QueryResults, fact_pids) p
+      else return (HsArray Vector.empty)
+  fact_keys <- (# peek facebook::glean::rts::QueryResults, fact_keys) p
+  fact_values <- (# peek facebook::glean::rts::QueryResults, fact_values) p
+  nested_fact_ids <-
+    (# peek facebook::glean::rts::QueryResults, nested_fact_ids) p
+  nested_fact_pids <-
+    (# peek facebook::glean::rts::QueryResults, nested_fact_pids) p
+  nested_fact_keys <-
+    (# peek facebook::glean::rts::QueryResults, nested_fact_keys) p
+  nested_fact_values <-
+    (# peek facebook::glean::rts::QueryResults, nested_fact_values) p
+
+  let
+    mkResultFact pid id key value =
+      (Fid (fromIntegral (id::Word64)),
+        Fact pid (hsByteString key) (hsByteString value))
+
+    mkFact id pid key value =
+      (Fid (fromIntegral (id::Word64)),
+        Fact pid (hsByteString key) (hsByteString value))
+
+    resultFacts = case maybePid of
+      Nothing -> Vector.zipWith4 mkFact
+        (hsArray fact_ids)
+        (hsArray fact_pids)
+        (hsArray fact_keys)
+        (hsArray fact_values)
+      Just (Pid pid) -> Vector.zipWith3 (mkResultFact pid)
+        (hsArray fact_ids)
+        (hsArray fact_keys)
+        (hsArray fact_values)
+
+    nestedFacts = Vector.zipWith4 mkFact
+      (hsArray nested_fact_ids)
+      (hsArray nested_fact_pids)
+      (hsArray nested_fact_keys)
+      (hsArray nested_fact_values)
+
+  stats <-
+    if wantStats
+      then Just . hsMap <$> (# peek facebook::glean::rts::QueryResults, stats) p
+      else return Nothing
+  elapsed_ns <- (# peek facebook::glean::rts::QueryResults, elapsed_ns) p
+  cont <- (# peek facebook::glean::rts::QueryResults, continuation) p
+  result_bytes <- (# peek facebook::glean::rts::QueryResults, result_bytes) p
+
+  return QueryResults
+    { queryResultsFacts = resultFacts
+    , queryResultsNestedFacts = nestedFacts
+    , queryResultsStats = stats
+    , queryResultsElapsedNs = elapsed_ns
+    , queryResultsCont =
+        let contBytes = hsByteString cont in
+        if ByteString.length contBytes == 0
+          then Nothing
+          else Just contBytes
+    , queryResultsResultBytes = result_bytes
+    }
+
+interruptRunningQueries :: IO ()
+interruptRunningQueries = glean_interrupt_running_queries
+
+depth_ResultsOnly :: Word64
+depth_ResultsOnly =
+  (# const (int)facebook::glean::rts::Depth::ResultsOnly)
+
+depth_ExpandRecursive :: Word64
+depth_ExpandRecursive =
+  (# const (int)facebook::glean::rts::Depth::ExpandRecursive)
+
+depth_ExpandPartial :: Word64
+depth_ExpandPartial =
+  (# const (int)facebook::glean::rts::Depth::ExpandPartial)
+
+foreign import ccall safe glean_query_execute_compiled
+  :: Ptr Inventory
+  -> Define
+  -> Ptr DefineOwnership
+  -> Ptr (Subroutine CompiledQuery)
+  -> Word64 -- pid
+  -> Ptr (Subroutine CompiledTraversal) -- traverse
+  -> Word64 -- max_results
+  -> Word64 -- max_bytes
+  -> Word64 -- max_time_ms
+  -> Word64 -- max_set_size
+  -> Word64 -- depth
+  -> Ptr Word64 -- expand_pids
+  -> Word64 -- num_expand_pids
+  -> Word64 -- want_stats
+  -> Ptr Results
+  -> IO CString
+
+foreign import ccall safe glean_query_restart_compiled
+  :: Ptr Inventory
+  -> Define
+  -> Ptr DefineOwnership
+  -> Ptr () -- cont
+  -> CSize  -- cont_size
+  -> Word64 -- max_results
+  -> Word64 -- max_bytes
+  -> Word64 -- max_time_ms
+  -> Word64 -- max_set_size
+  -> Word64 -- depth
+  -> Ptr Word64 -- expand_pids
+  -> Word64 -- num_expand_pids
+  -> Word64 -- want_stats
+  -> Ptr Results
+  -> IO CString
+
+foreign import ccall unsafe glean_interrupt_running_queries
+  :: IO ()
+
+foreign import ccall unsafe glean_free_query_results
+  :: Results -> IO ()
diff --git a/glean/hs/Glean/RTS/Foreign/Stacked.hs b/glean/hs/Glean/RTS/Foreign/Stacked.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Stacked.hs
@@ -0,0 +1,59 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Stacked
+  ( Stacked
+  , stacked
+  ) where
+
+import Control.Exception (bracket)
+import Data.Text
+import Foreign.C.String
+import Foreign.Ptr
+
+import Util.FFI
+
+import Glean.RTS.Foreign.Define (Define(..), CanDefine(..))
+import Glean.RTS.Foreign.Lookup (Lookup(..), CanLookup(..))
+
+-- | An `a` stacked on top of a base 'CanLookup'.
+data Stacked a = forall base. CanLookup base => Stacked base a Text
+
+-- | Stack a value on top of a base 'CanLookup'
+stacked :: (CanLookup base, CanLookup a) => base -> a -> Stacked a
+stacked base l = Stacked base l name
+  where name = lookupName base <> ";" <> lookupName l
+
+instance CanLookup a => CanLookup (Stacked a) where
+  lookupName (Stacked _ _ name) = name
+  withLookup (Stacked base added _) f =
+    withLookup base $ \p_base ->
+    withLookup added $ \p_added ->
+    bracket
+      (invoke $ glean_stacked_lookup_new p_base p_added)
+      glean_lookup_free
+      f
+
+instance CanDefine a => CanDefine (Stacked a) where
+  withDefine (Stacked base added _) f =
+    withLookup base $ \p_base ->
+    withDefine added $ \p_added ->
+    bracket
+      (invoke $ glean_stacked_define_new p_base p_added)
+      glean_stacked_define_free
+      f
+
+foreign import ccall unsafe glean_stacked_lookup_new
+  :: Ptr Lookup -> Ptr Lookup -> Ptr (Ptr Lookup) -> IO CString
+foreign import ccall unsafe glean_lookup_free
+  :: Ptr Lookup -> IO ()
+
+foreign import ccall unsafe glean_stacked_define_new
+  :: Ptr Lookup -> Define -> Ptr Define -> IO CString
+foreign import ccall unsafe glean_stacked_define_free
+  :: Define -> IO ()
diff --git a/glean/hs/Glean/RTS/Foreign/Stats.hs b/glean/hs/Glean/RTS/Foreign/Stats.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Stats.hs
@@ -0,0 +1,43 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Stats
+  ( marshalPredicateStats
+  ) where
+
+import Control.Monad (forM)
+import Data.Int
+import Data.Word
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+import Foreign.Storable
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Types (Pid(..))
+import Glean.Types
+
+marshalPredicateStats
+  :: (Ptr CSize
+      -> Ptr (Ptr Int64)
+      -> Ptr (Ptr Word64)
+      -> Ptr (Ptr Word64)
+      -> IO CString)
+  -> IO [(Pid, PredicateStats)]
+marshalPredicateStats get = do
+  (count, pids, counts, sizes) <- invoke get
+  usingMalloced pids $
+    usingMalloced counts $
+    usingMalloced sizes $
+    forM [0 .. fromIntegral count - 1] $ \i -> do
+      pid <- peekElemOff pids i
+      count <- peekElemOff counts i
+      size <- peekElemOff sizes i
+      return (Pid pid, PredicateStats (fromIntegral count) (fromIntegral size))
diff --git a/glean/hs/Glean/RTS/Foreign/Subst.hs b/glean/hs/Glean/RTS/Foreign/Subst.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Subst.hs
@@ -0,0 +1,162 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Subst
+  ( Subst
+  , empty
+  , serialize
+  , substIntervals
+  , unsafeSubstIntervalsAndRelease
+  , subst
+  , substVector
+  , deserialize
+  , substOffset
+  ) where
+
+import Control.Exception
+import Data.Int
+import Data.Word
+import qualified Data.Vector.Storable as VS
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+import System.IO.Unsafe
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Types (Fid(..), lowestFid)
+import qualified Glean.Types as Thrift
+
+newtype Subst = Subst (ForeignPtr Subst)
+
+instance Object Subst where
+  wrap = Subst
+  unwrap (Subst p) = p
+  destroy = glean_free_subst
+
+instance Semigroup Subst where
+  s <> t = unsafePerformIO $ with s $ \s_ptr -> with t $ \t_ptr ->
+    construct $ invoke $ glean_subst_compose s_ptr t_ptr
+
+instance Monoid Subst where
+  mempty = empty
+
+empty :: Subst
+{-# NOINLINE empty #-}
+empty = unsafePerformIO $ construct $ invoke $ glean_new_subst lowestFid 0
+
+serialize :: Subst -> Thrift.Subst
+serialize subst = unsafePerformIO $
+  with subst $ \subst_ptr -> do
+    (Fid id,count,p) <- invoke $ glean_serialize_subst subst_ptr
+    vec <- unsafeMallocedVector p count
+    return $ Thrift.Subst id vec
+
+substOffset :: Subst -> Int
+substOffset subst = fromIntegral $ unsafeDupablePerformIO $
+  with subst glean_subst_offset
+
+-- | Apply the given substitution to one Fid
+subst :: Subst -> Fid -> Fid
+subst subst old = unsafePerformIO $
+  with subst $ \subst_ptr ->
+  mask_ $ invoke $ glean_subst_subst subst_ptr old
+
+-- | Apply the given subsitution to all the Fids in the vector
+substVector :: Subst -> VS.Vector Fid -> IO (VS.Vector Fid)
+substVector subst vec =
+  with subst $ \subst_ptr ->
+  VS.unsafeWith vec $ \vec_ptr -> mask_ $ do
+    (outs_ptr, outs_size) <- invoke $ glean_subst_vector
+      subst_ptr
+      vec_ptr
+      (fromIntegral $ VS.length vec)
+    unsafeMallocedVector outs_ptr outs_size
+
+-- | Apply the given substitution to the intervals
+substIntervals :: Subst -> VS.Vector Fid -> IO (VS.Vector Fid)
+substIntervals subst ins =
+  with subst $ \subst_ptr ->
+  VS.unsafeWith ins $ \ins_ptr -> mask_ $ do
+    (outs_ptr, outs_size) <- invoke $ glean_subst_intervals
+      subst_ptr
+      ins_ptr
+      (fromIntegral $ VS.length ins)
+    unsafeMallocedVector outs_ptr outs_size
+
+-- | Like 'substIntervals', but also releases the input vector
+-- immediately, rather than waiting for the GC to run. The input
+-- vector must never be used again.
+unsafeSubstIntervalsAndRelease :: Subst -> VS.Vector Fid -> IO (VS.Vector Fid)
+unsafeSubstIntervalsAndRelease subst ins = do
+  new <- substIntervals subst ins
+  let !(fp, _) = VS.unsafeToForeignPtr0 ins
+  finalizeForeignPtr fp
+  return new
+
+deserialize :: Thrift.Subst -> IO Subst
+deserialize Thrift.Subst{..} =
+  VS.unsafeWith subst_ids $ \ids_ptr ->
+    construct $ invoke $
+      glean_subst_deserialize
+        (Fid subst_firstId)
+        (fromIntegral $ VS.length subst_ids)
+        ids_ptr
+
+foreign import ccall unsafe glean_new_subst
+  :: Fid -> CSize -> Ptr (Ptr Subst) -> IO CString
+foreign import ccall unsafe "&glean_free_subst" glean_free_subst
+  :: FunPtr (Ptr Subst -> IO ())
+
+foreign import ccall unsafe glean_subst_compose
+  :: Ptr Subst
+  -> Ptr Subst
+  -> Ptr (Ptr Subst)
+  -> IO CString
+
+foreign import ccall safe glean_serialize_subst
+  :: Ptr Subst
+  -> Ptr Fid
+  -> Ptr CSize
+  -> Ptr (Ptr Int64)
+  -> IO CString
+
+foreign import ccall safe glean_subst_deserialize
+  :: Fid
+  -> CSize
+  -> Ptr Int64
+  -> Ptr (Ptr Subst)
+  -> IO CString
+
+foreign import ccall safe glean_subst_intervals
+  :: Ptr Subst
+  -> Ptr Fid
+  -> CSize
+  -> Ptr (Ptr Fid)
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_subst_subst
+  :: Ptr Subst
+  -> Fid
+  -> Ptr Fid
+  -> IO CString
+
+foreign import ccall safe glean_subst_vector
+  :: Ptr Subst
+  -> Ptr Fid
+  -> CSize
+  -> Ptr (Ptr Fid)
+  -> Ptr CSize
+  -> IO CString
+
+foreign import ccall unsafe glean_subst_offset
+  :: Ptr Subst
+  -> IO Word64
diff --git a/glean/hs/Glean/RTS/Foreign/Thrift.hs b/glean/hs/Glean/RTS/Foreign/Thrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Thrift.hs
@@ -0,0 +1,33 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Thrift
+  ( encodeVarint, encodeZigZag
+  )
+where
+
+import Control.Monad.ST.Unsafe (unsafeIOToST)
+import Data.Int (Int64)
+import Data.Word
+import Foreign.C.Types
+import Foreign.Ptr
+
+import qualified Util.Buffer as Buffer
+
+encodeVarint :: Word64 -> Buffer.Fill s ()
+encodeVarint !x = Buffer.alloc 10 $
+  unsafeIOToST . fmap fromIntegral . glean_thrift_encode_varint x
+
+encodeZigZag :: Int64 -> Buffer.Fill s ()
+encodeZigZag !x = Buffer.alloc 10 $
+  unsafeIOToST . fmap fromIntegral . glean_thrift_encode_zigzag x
+
+foreign import ccall unsafe glean_thrift_encode_varint
+  :: Word64 -> Ptr Word8 -> IO CSize
+foreign import ccall unsafe glean_thrift_encode_zigzag
+  :: Int64 -> Ptr Word8 -> IO CSize
diff --git a/glean/hs/Glean/RTS/Foreign/Typecheck.hs b/glean/hs/Glean/RTS/Foreign/Typecheck.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Foreign/Typecheck.hs
@@ -0,0 +1,46 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Foreign.Typecheck
+  ( invokeTypechecker
+  ) where
+
+import Data.ByteString (ByteString)
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+import System.IO.Unsafe (unsafePerformIO)
+
+import Util.FFI
+
+import Glean.FFI
+import Glean.RTS.Foreign.Bytecode
+import Glean.RTS.Typecheck (CompiledTypecheck)
+
+-- | Invoke a typecheck subroutine on the given (encoded) type. Only used for
+-- testing.
+invokeTypechecker
+  :: Subroutine CompiledTypecheck
+  -> ByteString
+  -> ByteString
+invokeTypechecker sub val = unsafePerformIO $
+  with sub $ \sub_ptr ->
+  unsafeWithBytes val $ \val_ptr val_size -> do
+    (res_ptr, res_size) <- invoke $ glean_invoke_typechecker
+      sub_ptr
+      val_ptr
+      val_size
+    unsafeMallocedByteString res_ptr res_size
+
+foreign import ccall unsafe glean_invoke_typechecker
+  :: Ptr (Subroutine CompiledTypecheck)
+  -> Ptr ()
+  -> CSize
+  -> Ptr (Ptr ())
+  -> Ptr CSize
+  -> IO CString
diff --git a/glean/hs/Glean/RTS/Set.hs b/glean/hs/Glean/RTS/Set.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Set.hs
@@ -0,0 +1,98 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.RTS.Set
+  ( RtsSet
+  , withRtsSet
+  , insertBuilder
+  , buildSet
+  , WordRtsSet
+  , withWordRtsSet
+  , insertWordRtsSet
+  , insertBytesRtsSet
+  , buildWordSet
+  , buildWordSetBytes
+  ) where
+
+import Control.Monad.Catch
+import Control.Monad.IO.Class
+import Foreign
+import Foreign.C
+
+import qualified Util.FFI as FFI
+
+import Glean.RTS.Builder
+
+newtype RtsSet = RtsSet (Ptr RtsSet)
+  deriving(Storable)
+
+withRtsSet ::  (MonadMask m, MonadIO m) => (RtsSet -> m a) -> m a
+withRtsSet = bracket (liftIO newRtsSet) (liftIO . freeRtsSet)
+
+newRtsSet :: IO RtsSet
+newRtsSet = FFI.invoke glean_rtsset_new
+
+insertBuilder :: RtsSet -> Builder -> IO ()
+insertBuilder set builder = FFI.invoke $ glean_rtsset_insert set builder
+
+buildSet :: RtsSet -> Builder -> IO ()
+buildSet set builder = FFI.invoke $ glean_rtsset_build set builder
+
+newtype WordRtsSet = WordRtsSet (Ptr WordRtsSet)
+  deriving (Storable)
+
+withWordRtsSet ::  (MonadMask m, MonadIO m) => (WordRtsSet -> m a) -> m a
+withWordRtsSet = bracket (liftIO newWordRtsSet) (liftIO . freeWordRtsSet)
+
+newWordRtsSet :: IO WordRtsSet
+newWordRtsSet = FFI.invoke glean_wordrtsset_new
+
+insertWordRtsSet :: Integral n => WordRtsSet -> n -> IO ()
+insertWordRtsSet set elem =
+  FFI.invoke $ glean_wordrtsset_insert set (fromIntegral elem)
+
+insertBytesRtsSet :: Integral n => WordRtsSet -> Ptr Word8 -> n -> IO ()
+insertBytesRtsSet set bytes size =
+  FFI.invoke $ glean_wordrtsset_insert_bytes set bytes (fromIntegral size)
+
+buildWordSet :: WordRtsSet -> Builder -> IO ()
+buildWordSet set builder = FFI.invoke $ glean_wordrtsset_build set builder
+
+buildWordSetBytes :: WordRtsSet -> Builder -> IO ()
+buildWordSetBytes set builder =
+  FFI.invoke $ glean_wordrtsset_build_bytes set builder
+
+foreign import ccall unsafe glean_rtsset_new
+  :: Ptr RtsSet -> IO CString
+
+foreign import ccall unsafe glean_rtsset_insert
+  :: RtsSet -> Builder -> IO CString
+
+foreign import ccall unsafe glean_rtsset_build
+  :: RtsSet -> Builder -> IO CString
+
+foreign import ccall unsafe "glean_rtsset_free" freeRtsSet
+  :: RtsSet -> IO ()
+
+foreign import ccall unsafe glean_wordrtsset_new
+  :: Ptr WordRtsSet -> IO CString
+
+foreign import ccall unsafe glean_wordrtsset_insert
+  :: WordRtsSet -> CULong -> IO CString
+
+foreign import ccall unsafe glean_wordrtsset_insert_bytes
+  :: WordRtsSet -> Ptr Word8 -> CSize -> IO CString
+
+foreign import ccall unsafe glean_wordrtsset_build
+  :: WordRtsSet -> Builder -> IO CString
+
+foreign import ccall unsafe glean_wordrtsset_build_bytes
+  :: WordRtsSet -> Builder -> IO CString
+
+foreign import ccall unsafe "glean_wordrtsset_free" freeWordRtsSet
+  :: WordRtsSet -> IO ()
diff --git a/glean/hs/Glean/RTS/Term.hs b/glean/hs/Glean/RTS/Term.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Term.hs
@@ -0,0 +1,68 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveGeneric, DeriveTraversable #-}
+module Glean.RTS.Term
+  ( Term(..)
+  , Value
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.Hashable
+import qualified Data.Text.Encoding as Text
+import qualified Data.Text.Encoding.Error as Text
+import Compat.Prettyprinter
+import Data.Word (Word8, Word64)
+import GHC.Generics hiding (Rep)
+
+import Glean.Display
+import Glean.RTS.Types (Fid)
+
+-- -----------------------------------------------------------------------------
+-- Runtime terms
+
+-- | Haskell representation of a Glean term, i.e. the key or value of
+-- a fact. These are stored binary-encoded in the DB (see
+-- "Glean.Typed.Binary").
+--
+-- Parameterised over @ref@, the representation of a fact
+-- reference. This type is often extended by instantiating @ref@. For
+-- example we represent query patterns by instantiating @ref@ with a
+-- pattern type in the query engine, see "Glean.Query.Typecheck.Types".
+
+data Term ref
+  = Byte {-# UNPACK #-} !Word8
+  | Nat {-# UNPACK #-} !Word64
+  | Array [Term ref]
+  | ByteArray {-# UNPACK #-} !ByteString
+  | Tuple [Term ref]
+  | Alt {-# UNPACK #-} !Word64 (Term ref)
+  | String {-# UNPACK #-} !ByteString -- utf8-encoded
+  | Ref ref
+  deriving(Eq, Ord, Generic, Show, Functor, Foldable, Traversable)
+
+instance Hashable ref => Hashable (Term ref)
+
+instance Display ref => Display (Term ref) where
+  display _ (Byte x) = "#" <> pretty x
+  display _ (Nat x) = pretty x
+  display opts (Array xs) =
+    align $ encloseSep "[" "]" "," $ map (display opts) xs
+  display _ (ByteArray xs) = pretty (show xs) <> "#"
+  display opts (Tuple xs) =
+    align $ encloseSep "{" "}" "," $ map (display opts) xs
+  display opts (Alt s x) = "(" <> pretty s <> "|" <> display opts x <> ")"
+  -- display opts (String s) = "\"" <> display opts s <> "\""
+  display _ (String s) =
+    "\"" <> pretty (Text.decodeUtf8With Text.lenientDecode s) <> "\""
+  display opts (Ref ref) = display opts ref
+
+  displayAtom opts (Ref ref) = displayAtom opts ref
+  displayAtom opts other = display opts other
+
+type Value = Term Fid
diff --git a/glean/hs/Glean/RTS/Traverse.hs b/glean/hs/Glean/RTS/Traverse.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Traverse.hs
@@ -0,0 +1,119 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE RecursiveDo #-}
+module Glean.RTS.Traverse
+  ( CompiledTraversal
+  , genTraversal
+  ) where
+
+import Control.Monad
+
+import Glean.Bytecode.Types
+import Glean.RTS.Foreign.Bytecode
+import Glean.RTS.Types
+import Glean.RTS.Bytecode.Code
+import Glean.RTS.Bytecode.Gen.Issue
+import GHC.Stack (HasCallStack)
+
+-- | Type tag for Subroutine
+data CompiledTraversal
+
+traversal
+  :: HasCallStack => Register ('Fun '[ 'Word, 'Word ])
+  -> Register 'DataPtr
+  -> Register 'DataPtr
+  -> Type
+  -> Code ()
+traversal callback input inputend ty = go False (repType ty)
+  where
+    -- if refs is True, we *must* leave the input pointer pointing
+    -- after the value, because we're going to traverse more data.
+    --
+    -- If refs is False, we *must not* traverse the value unless
+    -- (hasRefs ty) is True, because we might not have traversed the
+    -- previous value.
+    go refs ByteRep = when refs $ addConst 1 input
+    go refs NatRep = when refs $ inputSkipNat input inputend
+    go refs StringRep = when refs $ inputSkipTrustedString input inputend
+    go refs (ArrayRep elty) = when (refs || hasRefs elty) $ local $ \size -> do
+      inputNat input inputend size
+      case elty of
+        ByteRep -> add size input
+        _ -> mdo
+          jumpIf0 size end
+          loop <- label
+          go True elty
+          decrAndJumpIfNot0 size loop
+          end <- label
+          return ()
+    go refs (TupleRep tys) = mapM_ (uncurry go) $ zip
+      (drop 1 $ scanr (\ty refs -> hasRefs ty || refs) refs tys)
+      tys
+    go refs (SumRep tys)
+      | all isUnit tys = when refs $ if length tys <= 127
+          then addConst 1 input
+          else inputSkipNat input inputend
+      | otherwise = when (refs || any hasRefs tys) $ mdo
+          local $ \sel -> do
+            -- TODO: read byte rather than Nat if arity <= 127
+            inputNat input inputend sel
+            let unknownAlt = [end]
+            select sel (alts ++ unknownAlt)
+          raise "selector out of range"
+          alts <- forM tys $ \ty -> do
+            alt <- label
+            go refs ty
+            jump end
+            return alt
+          end <- label
+          return ()
+    go refs (SetRep elty) = when (refs || hasRefs elty) $ local $ \size -> mdo
+      inputNat input inputend size
+      jumpIf0 size end
+      loop <- label
+      go True elty
+      decrAndJumpIfNot0 size loop
+      end <- label
+      return ()
+    go _ (PredicateRep (Pid pid)) = local $ \ide -> do
+      inputNat input inputend ide
+      pidr <- constant (fromIntegral pid)
+      callFun_2_0 callback ide pidr
+
+-- | Generate a subroutine which traverses a clause (fact key + value)
+-- and invokes the supplied callback function for each fact ID
+-- contained in it.
+--
+-- NOTE: The subroutine assumes that the clause is type correct.
+genTraversal :: HasCallStack => Type -> Type -> IO (Subroutine CompiledTraversal)
+genTraversal key_ty val_ty =
+  fmap snd $ generate Optimised $ \handler clause_begin key_end clause_end -> do
+    traversal handler clause_begin key_end key_ty
+    traversal handler key_end clause_end val_ty
+    ret
+
+hasRefs :: Rep a -> Bool
+hasRefs ByteRep = False
+hasRefs NatRep = False
+hasRefs StringRep = False
+hasRefs (ArrayRep elty) = hasRefs elty
+hasRefs (TupleRep tys) = any hasRefs tys
+hasRefs (SumRep tys) = any hasRefs tys
+hasRefs (SetRep elty) = hasRefs elty
+hasRefs PredicateRep{} = True
+
+isUnit :: Rep a -> Bool
+isUnit ByteRep = False
+isUnit NatRep = False
+isUnit StringRep = False
+isUnit ArrayRep{} = False
+isUnit (TupleRep tys) = all isUnit tys
+isUnit SumRep{} = False
+isUnit SetRep{} = False
+isUnit PredicateRep{} = False
diff --git a/glean/hs/Glean/RTS/Typecheck.hs b/glean/hs/Glean/RTS/Typecheck.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Typecheck.hs
@@ -0,0 +1,250 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE RecursiveDo #-}
+module Glean.RTS.Typecheck
+  ( CompiledTypecheck
+  , checkType
+  , checkSignature
+  ) where
+
+import Control.Monad
+
+import Glean.Angle.Types hiding (Type)
+import Glean.Bytecode.Types
+import Glean.RTS.Foreign.Bytecode
+import Glean.RTS.Types
+import Glean.RTS.Bytecode.Code
+import Glean.RTS.Bytecode.Gen.Issue
+
+-- | Type tag for Subroutine
+data CompiledTypecheck
+
+typecheck
+  :: SysCalls
+  -> Register 'DataPtr
+  -> Register 'DataPtr
+  -> Register 'BinaryOutputPtr
+  -> Type
+  -> Code ()
+typecheck syscalls@SysCalls{..} input inputend out = tc
+  where
+    tc ByteTy = do
+      size <- constant 1
+      local $ \ptr -> do
+        move input ptr
+        inputBytes input inputend size
+        outputBytes ptr input out
+    tc NatTy = local $ \reg -> do
+      inputNat input inputend reg
+      outputNat reg out
+    tc StringTy =
+      local $ \ptr -> do
+        move input ptr
+        inputSkipUntrustedString input inputend
+        outputBytes ptr input out
+    tc (ArrayTy elty) = local $ \size -> do
+      inputNat input inputend size
+      outputNat size out
+      case derefType elty of
+        ByteTy -> local $ \ptr -> do
+          move input ptr
+          inputBytes input inputend size
+          outputBytes ptr input out
+        _ -> mdo
+          jumpIf0 size end
+          loop <- label
+          tc elty
+          decrAndJumpIfNot0 size loop
+          end <- label
+          return ()
+    tc (RecordTy fields) = mapM_ (tc . fieldDefType) fields
+    tc (SumTy fields) = mdo
+      local $ \sel -> do
+        inputNat input inputend sel
+        outputNat sel out
+        select sel alts
+      raise "selector out of range"
+      alts <- forM fields $ \(FieldDef _ ty) -> do
+        alt <- label
+        tc ty
+        jump end
+        return alt
+      end <- label
+      return ()
+    tc (SetTy ByteTy) = local $ \size -> do
+      inputNat input inputend size
+      local $ \set ptr -> do
+        newWordSet set
+        move input ptr
+        inputBytes input inputend size
+        insertBytesWordSet set ptr input
+        byteSetToByteArray set out
+        freeWordSet set
+      return ()
+    tc (SetTy elty) = local $ \size -> do
+      inputNat input inputend size
+      local $ \set -> mdo
+        newSet set
+        jumpIf0 size end
+        loop <- label
+        output $ \tempOut -> do
+          typecheck syscalls input inputend tempOut elty
+          insertOutputSet set tempOut
+          decrAndJumpIfNot0 size loop
+        end <- label
+        setToArray set out
+        freeSet set
+      return ()
+    tc (PredicateTy _ (PidRef (Pid pid) _)) = local $ \ide -> do
+      t <- constant $ fromIntegral pid
+      inputNat input inputend ide
+      rename ide t ide
+      outputNat ide out
+    tc (NamedTy _ (ExpandedType _ ty)) = tc ty
+    tc (MaybeTy ty) = mdo
+      local $ \sel -> do
+        inputNat input inputend sel
+        outputNat sel out
+        select sel [end,just]
+      raise "maybe selector out of range"
+      just <- label
+      tc ty
+      end <- label
+      return ()
+    tc (EnumeratedTy names) = tcEnum $ fromIntegral $ length names
+    tc BooleanTy = tcEnum 2
+    tc _ = error "typecheck"
+
+    tcEnum arity = mdo
+      k <- constant arity
+      local $ \sel -> do
+        inputNat input inputend sel
+        outputNat sel out
+        jumpIfLt sel k end
+        raise "selector out of range"
+      end <- label
+      return ()
+
+data SysCalls = SysCalls {
+    rename
+    :: Register 'Word
+    -> Register 'Word
+    -> Register 'Word
+    -> Code()
+
+  , newSet
+    :: Register 'Word -- (output) set token
+    -> Code ()
+
+  , insertOutputSet
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr
+    -> Code ()
+
+  , setToArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , freeSet
+    :: Register 'Word -- set token (invalid after this call)
+    -> Code ()
+
+  , newWordSet
+    :: Register 'Word -- (output) set token
+    -> Code ()
+
+  , insertBytesWordSet
+    :: Register 'Word -- set token
+    -> Register 'DataPtr
+    -> Register 'DataPtr
+    -> Code ()
+
+  , wordSetToArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , byteSetToByteArray
+    :: Register 'Word -- set token
+    -> Register 'BinaryOutputPtr -- (output) array
+    -> Code ()
+
+  , freeWordSet
+    :: Register 'Word -- set token (invalid after this call)
+    -> Code ()
+  }
+
+-- | Generate a subroutine which typechecks and substitutes a value. It has
+-- the following arguments:
+--
+-- std::function<Id(Id id, Id type)> - fact substitution
+-- binary::Input * - value
+-- binary::Output * - substituted value
+--
+checkType :: Type -> IO (Subroutine CompiledTypecheck)
+checkType ty = checkSignature ty $ RecordTy []
+
+-- | Generate a subroutine which typechecks and substitutes a clause. It has
+-- the following arguments:
+--
+-- std::function<Id(Id id, Id type)> - fact substitution
+-- set syscalls.
+-- const void * - begin of clause/key
+-- const void * - end of key/begin of value
+-- const void * - end of clause/value
+--
+-- It returns the substituted clause in the first output and size of the
+-- substituted key in the first local register.
+--
+checkSignature :: Type -> Type -> IO (Subroutine CompiledTypecheck)
+checkSignature key_ty val_ty =
+  fmap snd $ generate Optimised $
+    \rename_
+      newSet_ insertOutputSet_ setToArray_ freeSet_
+      newWordSet_ insertBytesWordSet_ wordSetToArray_
+      byteSetToByteArray_ freeWordSet_
+      clause_begin key_end clause_end -> output $ \out -> do
+    let syscalls = SysCalls
+          { rename = \id pid reg ->
+              callFun_2_1 rename_ id pid reg
+          , newSet = callFun_0_1 newSet_
+          , insertOutputSet = \set out ->
+              callFun_2_0 insertOutputSet_ set (castRegister out)
+          , setToArray = \set arr ->
+              callFun_1_1 setToArray_ set (castRegister arr)
+          , freeSet = callFun_1_0 freeSet_
+          , newWordSet = callFun_0_1 newWordSet_
+          , insertBytesWordSet = \set start end ->
+              callFun_3_0
+              insertBytesWordSet_ set (castRegister start) (castRegister end)
+          , wordSetToArray = \set arr ->
+              callFun_1_1 wordSetToArray_ set (castRegister arr)
+          , byteSetToByteArray = \set arr ->
+              callFun_1_1 byteSetToByteArray_ set (castRegister arr)
+          , freeWordSet = callFun_1_0 freeWordSet_
+          }
+    -- We return the key size in the first local register
+    local $ \key_size -> mdo
+    typecheck syscalls clause_begin key_end out key_ty
+    check "key" clause_begin key_end
+    getOutputSize out key_size
+    typecheck syscalls clause_begin clause_end out val_ty
+    check "value" clause_begin clause_end
+    ret
+  where
+  check str reg1 reg2 = mdo
+    jumpIfNe (castRegister reg1) (castRegister reg2) bad
+    -- The basic block layout algorithm will make the happy path sequential and
+    -- delete this jump.
+    jump ok
+    bad <- label
+    raise $ "extra bytes at end of " <> str
+    ok <- label
+    return ()
diff --git a/glean/hs/Glean/RTS/Types.hs b/glean/hs/Glean/RTS/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/RTS/Types.hs
@@ -0,0 +1,204 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+module Glean.RTS.Types
+  ( -- * fact types
+    -- ** type
+    Id
+    -- ** newtype
+  , Fid(..), invalidFid, lowestFid
+    -- ** phantom type
+  , Pid(..), invalidPid, lowestPid
+    -- * Types
+  , Type
+  , Glean.RTS.Types.FieldDef
+  , PidRef(..)
+  , ExpandedType(..)
+  , repType
+  , sumLike
+  , eqType
+  , derefType
+    -- ** Representation types
+  , Rep(..)
+) where
+
+import Control.DeepSeq
+import Data.Hashable
+import qualified Data.Text as Text
+import Compat.Prettyprinter
+import Data.Vector.Primitive (Prim)
+import Foreign
+
+import Glean.Types (Id, fIRST_FREE_ID)
+import Glean.Angle.Types hiding (Type)
+import Glean.Display
+import Glean.Schema.Util
+
+-- | 'Pid' holds the glean Id corresponding to the definition of a predicate.
+--
+-- As a Fid that Id points to the glean fact that holds the predicate name and
+-- key type and value type).
+--
+-- Querying for this Id (as prefix of key) gives all facts for this predicate.
+newtype Pid = Pid { fromPid :: Int64 }
+  deriving(Eq,Ord,Enum,Hashable,Storable,Show,NFData,Prim)
+
+instance Pretty Pid where
+  pretty (Pid n) = "{" <> pretty n <> "}"
+
+instance Display Pid where
+  display _ = pretty
+
+invalidPid :: Pid
+invalidPid = Pid 0
+
+lowestPid :: Pid
+lowestPid = Pid fIRST_FREE_ID
+
+-- | Id of a fact that points to an entry in the database.
+-- If this entry happens to be a predicate definition then this
+-- is also logically a Pid.  If this entry is fact about some
+-- predicate 'p' then this is also logically an 'IdOf p'.
+newtype Fid = Fid { fromFid :: Id }
+  deriving(Eq,Ord,Enum,Hashable,Storable,Show,NFData,Prim)
+
+instance Pretty Fid where
+  pretty (Fid n) = "{" <> pretty n <> "}"
+
+instance Display Fid where
+  display _ = pretty
+
+invalidFid :: Fid
+invalidFid = Fid 0
+
+lowestFid :: Fid
+lowestFid = Fid fIRST_FREE_ID
+
+-- -----------------------------------------------------------------------------
+-- Runtime types
+
+data PidRef = PidRef Pid PredicateId
+  deriving Show
+
+instance Eq PidRef where
+  PidRef a _ == PidRef b _ = a == b
+
+instance Ord PidRef where
+  compare (PidRef a _) (PidRef b _) = compare a b
+
+instance Display PidRef where
+  display opts (PidRef _ ref) = display opts ref
+    -- we could add an option to display the Pids too
+
+data ExpandedType = ExpandedType TypeId Type
+  deriving (Show, Eq)
+
+instance Display ExpandedType where
+  display opts (ExpandedType ref _) = display opts ref
+
+type Type = Type_ () PidRef ExpandedType
+type FieldDef = FieldDef_ () PidRef ExpandedType
+
+
+-- | Construct the representation of a Type
+repType :: Type -> Rep Pid
+repType ByteTy = ByteRep
+repType NatTy = NatRep
+repType StringTy = StringRep
+repType (ArrayTy ty) = ArrayRep (repType ty)
+repType (RecordTy fields) =
+  TupleRep [ repType ty | FieldDef _ ty <- fields ]
+repType (SumTy fields) =
+  SumRep [ repType ty | FieldDef _ ty <- fields ]
+repType (SetTy ty)  = SetRep (repType ty)
+repType (PredicateTy _ (PidRef pid _)) = PredicateRep pid
+repType (NamedTy _ (ExpandedType _ ty)) = repType ty
+repType (MaybeTy ty) = repType (lowerMaybe ty)
+repType (EnumeratedTy names) = repType (lowerEnum names)
+repType BooleanTy = repType lowerBool
+repType TyVar{} = error "repType: TyVar"
+repType HasTy{} = error "repType: HasTy"
+repType HasKey{} = error "repType: HasKey"
+repType ElementsOf{} = error "repType: ElementsOf"
+
+sumLike :: Type -> Maybe [Glean.RTS.Types.FieldDef]
+sumLike (SumTy fs) = Just fs
+sumLike (MaybeTy ty) = Just (maybeFields ty)
+sumLike (EnumeratedTy names) = Just (enumFields names)
+sumLike BooleanTy = Just boolFields
+sumLike _ = Nothing
+
+-- | Compare types for (structural) equality
+eqType :: AngleVersion -> Type -> Type -> Bool
+eqType version a b = case (a,b) of
+  (ByteTy, ByteTy) -> True
+  (NatTy, NatTy) -> True
+  (StringTy, StringTy) -> True
+  (ArrayTy a, ArrayTy b) -> eqType version a b
+  (RecordTy as, RecordTy bs) ->
+    let isTuple = all (Text.isInfixOf "tuplefield"  . fieldDefName)
+        -- previous to version 7 records were always compared structurally
+        compareStructurally =
+          version < AngleVersion 7 || isTuple as || isTuple bs
+        -- structural equality for tuples by ignoring field names.
+        eqField fa fb = fa == fb
+    in
+    length as == length bs &&
+    and [ eqType version a b && (compareStructurally || eqField fa fb)
+        | (FieldDef fa a, FieldDef fb b) <- zip as bs ]
+  (SumTy as, SumTy bs) ->
+    length as == length bs &&
+    and [ eqType version a b | (FieldDef _ a, FieldDef _ b) <- zip as bs ]
+  (PredicateTy _ (PidRef p _), PredicateTy _ (PidRef q _)) -> p == q
+  (NamedTy _ (ExpandedType n t), NamedTy _ (ExpandedType m u)) ->
+    n == m || eqType version t u
+  (NamedTy _ (ExpandedType _ t), u) -> eqType version t u
+  (t, NamedTy _ (ExpandedType _ u)) -> eqType version t u
+  (MaybeTy t, MaybeTy u) -> eqType version t u
+  (MaybeTy t, u) ->  eqType version (lowerMaybe t) u
+  (t, MaybeTy u) -> eqType version t (lowerMaybe u)
+  (EnumeratedTy xs, EnumeratedTy ys) -> xs == ys
+  (EnumeratedTy xs, t) -> eqType version (lowerEnum xs) t
+  (t, EnumeratedTy xs) -> eqType version t (lowerEnum xs)
+  (BooleanTy, BooleanTy) -> True
+  (BooleanTy, t) -> eqType version lowerBool t
+  (t, BooleanTy) -> eqType version t lowerBool
+  _ -> False
+
+-- | dereference NamedTy on the outside of a Type
+derefType :: Type -> Type
+derefType (NamedTy _ (ExpandedType _ ty)) = derefType ty
+derefType ty = ty
+
+-- | Type describing the raw representation of a value. This makes
+-- fewer distinctions than Type, in particular: there are no field
+-- names or named types, and sugar like maybe, bool and enumerations
+-- are expanded into their low-level representations.
+data Rep id
+  = ByteRep
+  | NatRep
+  | ArrayRep (Rep id)
+  | TupleRep [Rep id]
+  | SumRep [Rep id]
+  | SetRep (Rep id)
+  | StringRep
+  | PredicateRep id
+  deriving (Eq, Show, Functor, Foldable, Traversable)
+
+instance Pretty id => Pretty (Rep id) where
+  pretty ByteRep = "byte#"
+  pretty NatRep = "nat#"
+  pretty (ArrayRep ty) = "[" <> pretty ty <> "]"
+  pretty (TupleRep ty) = align $ encloseSep "(" ")" "," $ map pretty ty
+  pretty (SumRep ty) = align $ encloseSep "(|" "|)" "," $ map pretty ty
+  pretty (SetRep ty) = "set " <> pretty ty
+  pretty StringRep = "string#"
+  pretty (PredicateRep id) = pretty id
diff --git a/glean/hs/Glean/Repo/Text.hs b/glean/hs/Glean/Repo/Text.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Repo/Text.hs
@@ -0,0 +1,72 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Converting between Repo and String/Text
+module Glean.Repo.Text
+  ( showRepo
+  , showRepoSep
+  , repoToText
+  , repoToTextSep
+  , readRepo
+  , parseRepo
+  , parseRepoText
+  , parseRepoTextSep
+  ) where
+
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import Glean.Types
+
+-- | Show a repo in NAME/HASH format to String
+showRepo :: Repo -> String
+showRepo = showRepoSep "/"
+
+showRepoSep :: String -> Repo -> String
+showRepoSep sep repo =
+  Text.unpack (repo_name repo) <> sep <> Text.unpack (repo_hash repo)
+
+-- | Render the Repo in NAME/HASH format to Text
+repoToText :: Repo -> Text
+repoToText Repo{..} = repo_name <> "/" <> repo_hash
+
+repoToTextSep :: Text -> Repo -> Text
+repoToTextSep sep Repo{..} = repo_name <> sep <> repo_hash
+
+readRepo :: String -> String -> Repo
+readRepo sep s = fromMaybe (Repo t "") (parseRepoTextSep tsep t)
+  where
+    tsep = Text.pack sep
+    t = Text.pack s
+
+-- | Attempt to parse a repo of the form <name>/<hash> as commonly
+-- used by Glean tools.
+parseRepo :: String -> Maybe Repo
+parseRepo = parseRepoTextSep "/" . Text.pack
+
+-- | Attempt to parse a repo of the form <name>/<hash> as commonly
+-- used by Glean tools.
+parseRepoText :: Text -> Maybe Repo
+parseRepoText = parseRepoTextSep "/"
+
+-- | Parse a repository spec with the given separator. Everything before the
+-- *last* separator is the repo name, everything after is the hash. Yields
+-- @Nothing@ if the separator doesn't occur in the spec.
+--
+-- > parseRepo "." "a.b.c.d" == Just (Repo "a.b.c" "d")
+-- > parseRepo "/" "a.b.c.d" == Nothing
+parseRepoTextSep
+  :: Text  -- ^ separator
+  -> Text  -- ^ spec
+  -> Maybe Repo
+parseRepoTextSep sep s = case Text.breakOnEnd sep s of
+  ("", _) -> Nothing
+  (pfx, sfx) -> Just Repo
+    { repo_name = Text.dropEnd (Text.length sep) pfx
+    , repo_hash = sfx }
diff --git a/glean/hs/Glean/Schema/Evolve.hs b/glean/hs/Glean/Schema/Evolve.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Schema/Evolve.hs
@@ -0,0 +1,460 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- |
+This module focuses on determining which predicate should be transformed
+into which by looking at the contents of schemas and at the evolution
+relationships between schemas.
+-}
+{-# LANGUAGE CPP #-}
+module Glean.Schema.Evolve
+  ( validateResolvedEvolutions
+  , directSchemaEvolutions
+  , calcEvolutions
+  , validateEvolutions
+  , visiblePredicates
+  , mapVisible
+  , VisiblePredicates
+  , visibleDefined
+  , canBeStored
+  ) where
+
+import Control.Applicative
+import Control.Monad
+#if !MIN_VERSION_base(4,16,0)
+import Data.Foldable
+#endif
+import Data.Graph
+import Data.Hashable
+import qualified Data.HashSet as HashSet
+import Data.HashSet (HashSet)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.List.Extra (nubOrdOn)
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe (listToMaybe)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import Glean.Angle.Types
+import Glean.Display
+import Glean.Schema.Types
+import Glean.Schema.Util
+
+{- Note [Schema Evolutions]
+
+An 'schema evolution' is a non-commuting transitive relationship between two
+schemas. It is established by a source code annotation saying:
+
+    schema A evolves B
+
+It establishes a 'predicate evolution' relationship between all predicates
+exported by B and predicates exported by A if they have the same name. Schema
+evolutions must form a graph with no cycles.
+
+A 'predicate evolution' is a reflexive, commutative, non-transitive
+relationship between two predicates. It means that facts from one predicate can
+be transformed into facts from the other.
+
+It is established in two cases:
+
+  - predicate P evolves predicate Q if the schema containing P evolves the
+  schema containing Q and both P and Q have the same name.
+  This is caused by a source code annotation.
+
+  - predicate P evolves predicate Q if they are defined in schemas with the
+  same SchemaRef and have the same name but different hashes.
+  This is caused by a version-less schema migration and the two instances
+  live in different ProcessedSchema.
+
+NB: Although 'predicate evolution' is not a transitive relationship, we
+expect it to work in all transitively evolved predicates because we want
+'schema evolution' to be transitive.
+
+Example of why predicate evolution is not transitive:
+  predicate P.1 = { a : maybe nat }
+  predicate P.2 = {}
+  predicate P.3 = { a : maybe string }
+
+P.2 can evolve P.1 and P.3 can evolve P.2, but P.3 cannot evolve P.1.
+-}
+
+-- | As specified by a `schema x evolves y` line.
+-- Does not take the db's content into account.
+-- value evolves key
+directSchemaEvolutions
+  :: [ResolvedSchemaRef]
+  -> Either Text (Map SchemaRef SchemaRef)
+directSchemaEvolutions schemas =
+  Map.traverseWithKey checkMultipleEvolves $
+  Map.fromListWith (++)
+    [ (evolved, [schemaRef resolved])
+    | resolved <- schemas
+    , evolved <- Set.toList $ resolvedSchemaEvolves resolved
+    ]
+  where
+  checkMultipleEvolves old newList =
+    case nub newList of
+      [new] -> Right new
+      _     -> Left $ "multiple schemas evolve "
+        <> showSchemaRef old
+        <> ": "
+        <> Text.unwords (map showSchemaRef newList)
+
+-- | Visible predicates which can be evolved.
+data VisiblePredicates p = VisiblePredicates
+  { visibleDefined :: HashSet p
+  , visibleReexported :: HashSet p
+  }
+
+visiblePredicates :: ResolvedSchemaRef -> VisiblePredicates PredicateRef
+visiblePredicates ResolvedSchema{..} = VisiblePredicates
+  { visibleDefined = evolvable resolvedSchemaPredicates
+  , visibleReexported = evolvable resolvedSchemaReExportedPredicates
+  }
+  where
+  evolvable :: HashMap PredicateRef ResolvedPredicateDef -> HashSet PredicateRef
+  evolvable = HashSet.fromList . filter stored . HashMap.keys
+
+  stored ref =
+    maybe True (canBeStored . derivingDefDeriveInfo) $
+      HashMap.lookup ref resolvedSchemaDeriving
+
+canBeStored :: DerivingInfo a -> Bool
+canBeStored = \case
+  Derive DeriveOnDemand _ -> False
+  Derive DerivedAndStored _ -> True
+  Derive DeriveIfEmpty _ -> True
+  NoDeriving -> True
+
+mapVisible
+  :: (Eq q, Hashable q)
+  => (p -> q)
+  -> VisiblePredicates p
+  -> VisiblePredicates q
+mapVisible f (VisiblePredicates d r) =
+  VisiblePredicates (HashSet.map f d) (HashSet.map f r)
+
+instance (Eq p, Hashable p) => Semigroup (VisiblePredicates p) where
+  VisiblePredicates d r <> VisiblePredicates d' r' =
+    VisiblePredicates (d <> d') (r <> r')
+
+instance (Eq p, Hashable p) => Monoid (VisiblePredicates p) where
+  mappend = (<>)
+  mempty = VisiblePredicates mempty mempty
+
+-- | Given evolutions between schemas and evolutions between instances of the
+-- same predicate, calculate the final instance-to-instance predicate
+-- evolutions.
+calcEvolutions
+  :: forall p. (Eq p, Ord p, Hashable p, ShowRef p)
+  => (p -> PredicateRef)
+  -> Map PredicateRef [p]          -- ^ all predicates by ref
+  -> Map SchemaRef (VisiblePredicates p) -- ^ all predicates by schema ref
+  -> Map SchemaRef SchemaRef       -- ^ evolutions from src code directives
+  -> Map PredicateRef p            -- ^ evolutions from versionless migrations
+  -> Either Text (HashMap p p)
+calcEvolutions toRef byPredRef bySchemaRef schemaEvolutions autoEvolutions =
+  case cycles evolutions of
+    [] -> Right evolutions
+    []:_ -> error "calcEvolutions"
+    (x:xs):_ -> Left $ "found a cycle in predicate evolutions: " <>
+      Text.intercalate " -> " (map showRef $ x:xs ++ [x])
+  where
+  cycles :: Ord a => HashMap a a -> [[a]]
+  cycles hm = [ cycle | CyclicSCC cycle <- scc]
+    where
+    scc = stronglyConnComp [ (k,k,[v]) | (k, v) <- HashMap.toList hm ]
+
+  evolutions = fromSourceAnnotations `HashMap.union` fromVersionlessMigrations
+
+  fromVersionlessMigrations :: HashMap p p
+  fromVersionlessMigrations = HashMap.fromList
+    [ (old, new)
+    | (ref, preds) <- Map.toList byPredRef
+    , old <- preds
+    , Just new <- [Map.lookup ref autoEvolutions]
+    , new /= old
+    ]
+
+  fromSourceAnnotations :: HashMap p p
+  fromSourceAnnotations =
+    HashMap.unions
+    $ map concrete
+    $ map (uncurry match)
+    $ Map.toList schemaEvolutions
+    where
+      concrete :: HashMap PredicateRef PredicateRef -> HashMap p p
+      concrete = HashMap.fromList . concatMap expand . HashMap.toList
+
+      expand :: (PredicateRef, PredicateRef) -> [(p,p)]
+      expand (from, to) =
+        [ (from', to')
+        | from' <- allInstances from
+        , Just to' <- [mostEvolvedInstance to]
+        ]
+
+      allInstances :: PredicateRef -> [p]
+      allInstances ref = Map.findWithDefault [] ref byPredRef
+
+      mostEvolvedInstance :: PredicateRef -> Maybe p
+      mostEvolvedInstance ref = evolved <|> anyInstance
+        where
+        evolved = Map.lookup ref autoEvolutions
+        anyInstance = listToMaybe =<< Map.lookup ref byPredRef
+
+  match :: SchemaRef -> SchemaRef -> HashMap PredicateRef PredicateRef
+  match old new = HashMap.fromList
+    [ (rold, rnew)
+    | rold <- predicates old
+    , Just rnew <- [Map.lookup (name rold) newByName]
+    , rnew /= rold -- avoid re-exports evolving themselves
+    ]
+    where
+    newByName :: Map Name PredicateRef
+    newByName = Map.fromList [ (name ref, ref) | ref <- predicates new ]
+
+  predicates :: SchemaRef -> [PredicateRef]
+  predicates sref =
+    -- defined override reexported
+    nubOrdOn name
+      $ map toRef
+      $ HashSet.toList defined <> HashSet.toList reexported
+    where
+      VisiblePredicates defined reexported =
+        Map.findWithDefault mempty sref bySchemaRef
+
+  name :: PredicateRef -> Name
+  name = predicateRef_name
+
+-- | Check schemas for compatibility and map each predicate to their
+-- evolved counterpart in the the evolvedBy map.
+--
+-- This is abstracted over the type of predicates and types, because
+-- we use it in two different ways:
+--
+-- 1. To check the validity of "schema A evolves B" declarations.  This
+--    check is performa at schema resolution time, so
+--       p = PredicateRef
+--       t = TypeRef
+--
+-- 2. To check compatibility between complete schemas when a new
+--    schema instance is added to the SchemaIndex. We're dealing with
+--    complete hashed schemas in this case, so
+--       p = PredicateId
+--       t = TypeId
+--
+validateEvolutions
+  :: (Eq p, Eq t, ShowRef p, ShowRef t,
+      Hashable p, Hashable t, Display p, Display t)
+  => Maybe (p -> Bool)               -- ^ does the db has facts of p
+  -> HashMap t (TypeDef_ st p t)        -- ^ types to their definitions
+  -> HashMap p (PredicateDef_ s st p t) -- ^ predicates to their definitions
+  -> HashMap p p                     -- ^ predicate evolutions
+  -> Either Text ()
+validateEvolutions mHasFacts types preds evolutions =
+  void $ HashMap.traverseWithKey validate evolutions
+  where
+    validate old new =
+      let PredicateDef _ oldKey oldVal _ _ = preds HashMap.! old
+          PredicateDef _ newKey newVal _ _ = preds HashMap.! new
+          keyErr = newKey `canEvolve'` oldKey
+          valErr = newVal `canEvolve'` oldVal
+      in
+      case keyErr <|> valErr of
+        Nothing -> Right ()
+        Just err -> Left $
+          "cannot evolve predicate " <> showRef old <>
+          " into " <> showRef new <> ": " <> err
+
+    canEvolve' = canEvolve types compatible
+
+    compatible new old =
+      case mHasFacts of
+        Nothing ->
+          -- Here we are validating an evolution graph without a database.
+          -- Compatible predicates must ultimately evolve to the same
+          -- PredicateRef. We ignore hashes because auto-evolutions will make
+          -- all predicates with the same PredicateRef evolve to the same thing
+          -- in a concrete database.
+          ref (evolved new) == ref (evolved old)
+        Just hasFacts
+            -- if there are no facts, there will be no transformation so all
+            -- types are considered compatible.
+          | not (hasFacts old) -> True
+            -- there will be a transformation so the evolutions map should have
+            -- an exact match.
+          | otherwise ->
+            HashMap.lookupDefault old old evolutions
+              ==  HashMap.lookupDefault new new evolutions
+
+    ref p = predicateDefRef $ preds HashMap.! p
+
+    -- get most evolved version of a predicate
+    evolved p = case HashMap.lookup p evolutions of
+      Nothing -> p
+      Just p' -> if p' == p then p else evolved p'
+
+
+-- | Create a mapping from a schema to the schema that evolves it. This will
+--  - check if any schema is evolved by multiple schemas.
+--  - check if all schema evolutions are legal.
+--
+-- If 'B evolves A' and 'C evolves A', when a query for A comes we won't
+-- know whether to serve facts from C or from B. Therefore we disallow
+-- multiple schemas to evolve a single one.
+validateResolvedEvolutions :: [ResolvedSchemaRef] -> Either Text ()
+validateResolvedEvolutions resolved = do
+  schemaEvolutions <- directSchemaEvolutions resolved
+  let autoEvolutions = mempty
+  evolutions <- calcEvolutions
+    id
+    byRef
+    bySchemaRef
+    schemaEvolutions
+    autoEvolutions
+
+  validateEvolutions Nothing types preds evolutions
+  where
+    byRef :: Map PredicateRef [PredicateRef]
+    byRef = Map.fromList [ (ref, [ref]) | ref <- HashMap.keys preds ]
+
+    bySchemaRef :: Map SchemaRef (VisiblePredicates PredicateRef)
+    bySchemaRef = Map.fromList
+      [ (schemaRef schema, visiblePredicates schema)
+      | schema <- resolved
+      ]
+
+    -- Later definitions override earlier ones in case of db overrides
+    -- (is this really the case or are overrides added to a new ProcessedSchema?)
+    preds :: HashMap PredicateRef
+      (PredicateDef_ SrcSpan SrcSpan PredicateRef TypeRef)
+    preds = HashMap.unions $ reverse $ map resolvedSchemaPredicates resolved
+
+    types :: HashMap TypeRef ResolvedTypeDef
+    types = HashMap.unions $ reverse $ map resolvedSchemaTypes resolved
+
+data Opt = Option | FieldOpt
+
+-- | Check if a type is backward and forward compatible.
+--
+-- For backward and forward compatibility the rules are:
+--  - only add or remove fields with defaultable values
+--  - if a field referencing a predicate is changed, it must be
+--    to a compatible predicate reference.
+--
+-- Two predicate references are compatible if they evolve to the same predicate
+-- or have the same PredicateRef.
+canEvolve
+  :: (Eq p, Eq t, ShowRef p, ShowRef t,
+      Hashable p, Hashable t, Display p, Display t)
+  => HashMap t (TypeDef_ s p t) -- ^ type definitions
+  -> (p -> p -> Bool)         -- ^ whether two predicates are compatible
+  -> Type_ s p t                -- ^ updated type
+  -> Type_ s p t                -- ^ old type
+  -> Maybe Text               -- ^ compatibility error
+canEvolve types compatible new old = go new old
+  where
+    get ty = case HashMap.lookup ty types of
+      Just v -> typeDefType v
+      Nothing -> error $ "unknown type " <> Text.unpack (showRef ty)
+
+    go (NamedTy _ new) (NamedTy _ old )
+      | new == old = Nothing
+      | otherwise = go (get new) (get old)
+    go (NamedTy _ t) old = go (get t) old
+    go new (NamedTy _ t) = go new (get t)
+    go (MaybeTy new) (MaybeTy old) = go new old
+    go ByteTy ByteTy = Nothing
+    go NatTy NatTy = Nothing
+    go StringTy StringTy = Nothing
+    go BooleanTy BooleanTy = Nothing
+    go (ArrayTy new) (ArrayTy old) = go new old
+    go (SetTy new) (SetTy old) = go new old
+    go (PredicateTy _ new) (PredicateTy _ old)
+      | not (compatible new old) = Just
+          $ "type changed from " <> showRef old
+          <> " to " <> showRef new
+      | otherwise = Nothing
+    go (EnumeratedTy new) (EnumeratedTy old) =
+      compareFieldList Option new' old'
+      where
+        new' = map unitOpt new
+        old' = map unitOpt old
+        unitOpt name = FieldDef name (RecordTy [])
+    go (SumTy new) (SumTy old) = compareFieldList Option new old
+    go (RecordTy new) (RecordTy old) = compareFieldList FieldOpt new old
+    go (SetTy new) (ArrayTy old) = go new old
+    go (ArrayTy new) (SetTy old) = go new old
+    go new old = Just $ Text.pack $
+      "type changed from " <>
+        show (displayDefault old) <> " to " <>
+        show (displayDefault new)
+
+    compareFieldList optName new old =
+      removedFieldsError <|> newRequiredFieldsError <|>
+      asum (map compareField matchingFields)
+      where
+        names = map fieldDefName
+        oldByName = Map.fromList (zip (names old) old)
+        newByName = Map.fromList (zip (names new) new)
+        matchingFields =
+          [ (name, fNew, fOld)
+          | FieldDef name fNew <- new
+          , Just (FieldDef _ fOld) <- [Map.lookup name oldByName]
+          ]
+        compareField (name, new, old) = addLocation <$> go new old
+          where
+            addLocation err =
+              "in " <> showOpt optName <> " '" <> name <> "', " <> err
+
+        addedFields = Map.difference newByName oldByName
+        removedFields = Map.difference oldByName newByName
+        required fields = Map.filter (not . hasDefault . fieldDefType) fields
+        hasDefault ty = case ty of
+          MaybeTy _ -> True
+          NatTy -> True
+          StringTy -> True
+          BooleanTy -> True
+          ByteTy -> True
+          ArrayTy _ -> True
+          SetTy _ -> True
+          RecordTy fields -> all (hasDefault . fieldDefType) fields
+          EnumeratedTy{} -> True
+          SumTy (first : _) -> hasDefault (fieldDefType first)
+          NamedTy _ ty -> hasDefault (get ty)
+          _ -> False
+
+        newRequiredFields = Map.keys (required addedFields)
+        removedRequiredFields = Map.keys (required removedFields)
+
+        removedFieldsError = case optName of
+          Option -> Nothing
+          FieldOpt -> case removedRequiredFields  of
+            [] -> Nothing
+            fields -> Just $ "missing required " <> plural optName fields
+              <> ": " <> Text.unwords fields
+
+        newRequiredFieldsError = case optName of
+          Option -> Nothing
+          FieldOpt -> case newRequiredFields of
+            [] -> Nothing
+            _ -> Just $ Text.unlines
+              [ Text.unwords [ "required" , plural optName newRequiredFields
+                , "added:" , Text.unwords newRequiredFields ]
+              , "For backward and forward compatibility, predicate evolutions"
+                <> " require that all new fields are non-predicate types"
+              ]
+
+    plural s [_] = showOpt s
+    plural s _ = showOpt s <> "s"
+    showOpt Option = "option"
+    showOpt FieldOpt = "field"
diff --git a/glean/hs/Glean/Schema/Resolve.hs b/glean/hs/Glean/Schema/Resolve.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Schema/Resolve.hs
@@ -0,0 +1,824 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveGeneric #-}
+
+module Glean.Schema.Resolve
+  ( parseAndResolveSchema
+  , parseAndResolveSchemaCached
+  , SchemaParserCache
+  , resolveType
+  , resolveSchema
+  , runResolve
+  , resolveQuery
+  , resolveSchemaRefs
+  ) where
+
+import Control.Monad
+import Control.Monad.Reader
+import Control.Monad.Except
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as ByteString
+import Data.Char
+import Data.Graph
+import Data.Foldable
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import Data.HashSet (HashSet)
+import Data.List
+import Data.Maybe
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Compat.Prettyprinter hiding (group)
+import TextShow
+
+import Glean.Angle.Hash
+import Glean.Angle.Parser
+import Glean.Angle.Types
+import Glean.Schema.Types
+import Glean.Schema.Util
+import Glean.Schema.Evolve (validateResolvedEvolutions)
+
+type SchemaParserCache = HashMap Hash SourceSchemas
+
+-- ---------------------------------------------------------------------------
+-- High-level schema parsing / resolution APIs
+
+--
+-- | Useful packaging of 'parseSchema' and 'resolveSchema'. Note that
+-- parsing and resolution of a schema is a pure function.
+--
+parseAndResolveSchema
+  :: ByteString
+  -> Either String (SourceSchemas, ResolvedSchemas)
+parseAndResolveSchema str =
+  case parseSchema str of
+    Left str -> Left str
+    Right ss -> case resolveSchema ss of
+      Left txt -> Left (Text.unpack txt)
+      Right r -> Right (ss, r)
+
+--
+-- | Like parseAndResolveSchema but uses a cache to avoid repeatedly
+-- parsing the same schema fragments.
+--
+-- We split the input string at "schema" declarations and hash the
+-- content of each one to use as the cache key. There are a couple of
+-- caveats here:
+--
+--  * we lose the benefit of the FILE annotations that tell us the
+--    original source file name for error messages. Therefore don't
+--    use this parsing method when you want error messages; use
+--    the uncached parseAndResolveSchema instead.
+--
+--  * "schema" should appear in column 0. But if it doesn't, the worst
+--    that can happen is we miss out on some caching. Since "schema" is
+--    a keyword, it can't appear inside a schema or anything silly like
+--    that.
+--
+parseAndResolveSchemaCached
+  :: SchemaParserCache
+  -> ByteString
+  -> Either String (SourceSchemas, ResolvedSchemas, SchemaParserCache)
+parseAndResolveSchemaCached cache str = do
+  let
+    (ver, rest) = stripAngleVersion str
+
+    cutSchemas b =
+      (h <> "\n") : -- put the "\n" back on the end
+        if ByteString.null t
+          then []
+          else cutSchemas (ByteString.drop 1 t) -- drop the "\n"
+      where (h,t) = ByteString.breakSubstring "\nschema" b
+
+    schemaFragments =
+      [ (hashByteString frag, frag)
+      | frag <- cutSchemas rest ]
+
+  parsed <- forM schemaFragments $ \(key, str) ->
+    case HashMap.lookup key cache of
+      Nothing -> case parseSchemaWithVersion ver str of
+        Left err -> Left err
+        Right ss -> return (key, ss)
+      Just cached -> return (key, cached)
+
+  let
+    merged = SourceSchemas
+      { srcAngleVersion = ver
+      , srcSchemas = schemas
+      , srcEvolves = evolves }
+      where
+        schemas = concatMap (srcSchemas . snd) parsed
+        evolves = concatMap (srcEvolves . snd) parsed
+
+    newCache = HashMap.union cache (HashMap.fromList parsed)
+
+  case resolveSchema merged of
+    Left txt -> Left (Text.unpack txt)
+    Right r -> Right (merged, r, newCache)
+
+--
+-- | Turn 'SourceSchemas' into a 'ResolvedSchemas' by resolving all the
+-- references and checking for validity.
+--
+resolveSchema :: SourceSchemas -> Either Text ResolvedSchemas
+resolveSchema schemas = runExcept $ do
+  checkAngleVersion (srcAngleVersion schemas)
+
+  SourceSchemas{..} <- resolveSchemaRefs schemas
+
+  let
+    -- dependency analysis: we want to process schemas in dependency
+    -- order, and detect cycles in evolves declarations.
+    sccs = stronglyConnComp
+      [ (schema, schemaName schema, out schema)
+      | schema <- srcSchemas ]
+
+    out s = schemaDependencies s <> evolvesOf (schemaName s)
+
+    schemaDependencies SourceSchema{..} =
+      schemaInherits ++ [ name | SourceImport name _ <- schemaDecls ]
+
+    evolves = HashMap.fromListWith (++)
+      [ (new, [old])
+      | SourceEvolves _ new old <- srcEvolves
+      ]
+
+    evolvesOf name = HashMap.lookupDefault [] name evolves
+
+    resolveSchemas env [] = return env
+    resolveSchemas env (AcyclicSCC one : rest) = do
+      let schemaEvolves = HashMap.lookupDefault [] (schemaName one) evolves
+      resolved <- resolveOneSchema env srcAngleVersion
+        schemaEvolves one
+      resolveSchemas (HashMap.insert (schemaName one) resolved env) rest
+    resolveSchemas _ (CyclicSCC some : _) = throwError $
+      "cycle in schema definitions between: " <>
+        Text.intercalate ", " (map (showRef . schemaName) some)
+
+  -- Resolve all the references in each individual schema
+  finalEnv <- resolveSchemas HashMap.empty sccs
+
+  let
+    resolved =
+        [ schema
+        | AcyclicSCC one <- sccs
+        , Just schema <- [HashMap.lookup (schemaName one) finalEnv ] ]
+
+    allSchemas =
+      [ schema
+      | schema@ResolvedSchema{..} <- HashMap.elems finalEnv
+      , resolvedSchemaName == "all"
+      ]
+
+  when (srcAngleVersion >= AngleVersion 6) $
+    liftEither $ validateResolvedEvolutions resolved
+
+  return ResolvedSchemas
+    { schemasHighestVersion =
+        if null allSchemas
+           then Nothing
+           else Just (maximum $ map resolvedSchemaVersion allSchemas)
+    , schemasResolved = resolved
+    }
+
+
+resolveSchemaRefs :: SourceSchemas -> Except Text SourceSchemas
+resolveSchemaRefs SourceSchemas{..} = do
+  let
+     unqualMap
+       | srcAngleVersion >= AngleVersion 10 =
+         HashMap.fromListWith (<>)
+           [ (SourceRef name Nothing, HashSet.singleton ref)
+           | SourceSchema{..} <- srcSchemas
+           , let ref@(SourceRef name _) = schemaName
+           ]
+       | otherwise = HashMap.empty
+
+     refMap = unqualMap <> HashMap.fromList
+       [ (schemaName, HashSet.singleton schemaName)
+       | SourceSchema{..} <- srcSchemas
+       ]
+
+     schemaByName ref =
+       case HashMap.lookup ref refMap of
+         Nothing -> unknown
+         Just s -> case HashSet.toList s of
+           [one] -> return one
+           names -> throwError $
+             "ambiguous schema " <> showRef ref <>
+             ", could be one of " <> Text.intercalate ", " (map showRef names)
+       where
+       unknown = throwError $ "unknown schema: " <> showRef ref
+
+     schemaByNameWithNamespace parentSchema ref =
+       let message e = e <> " within schema: " <> showRef parentSchema
+       in withExcept message (schemaByName ref)
+
+     resolveDecl parentSchema (SourceImport r s) =
+      SourceImport <$> schemaByNameWithNamespace parentSchema r <*> pure s
+     resolveDecl _ decl = return decl
+
+     resolveEvolve (SourceEvolves l n o) =
+       SourceEvolves l <$> schemaByName n <*> schemaByName o
+
+     resolveSchema SourceSchema{..} = do
+       inherits <- mapM (schemaByNameWithNamespace schemaName) schemaInherits
+       decls <- mapM (resolveDecl schemaName) schemaDecls
+       return SourceSchema
+         { schemaName = schemaName
+         , schemaInherits = inherits
+         , schemaDecls = decls
+         , schemaSrcSpan = schemaSrcSpan
+         }
+
+  schemas <- traverse resolveSchema srcSchemas
+  evolves <- traverse resolveEvolve srcEvolves
+
+  return SourceSchemas
+    { srcAngleVersion = srcAngleVersion
+    , srcSchemas = schemas
+    , srcEvolves = evolves
+    }
+
+type Environment = HashMap SourceRef ResolvedSchemaRef
+
+resolveOneSchema
+  :: Environment
+  -> AngleVersion
+  -> [SourceRef]
+  -> SourceSchema
+  -> Except Text ResolvedSchemaRef
+
+resolveOneSchema env angleVersion evolves SourceSchema{..} =
+  let inSchema e = throwError $ "In " <> showRef schemaName <> ":\n  " <> e in
+  flip catchError inSchema $ do
+  let
+    SourceRef namespace maybeVer = schemaName
+
+    schemaByName name = case HashMap.lookup name env of
+      Nothing -> throwError $ "unknown schema: " <> showRef name
+      Just one -> return one
+
+  checkNameSpace namespace
+
+  -- Version of this schema
+  version <- case maybeVer of
+    Nothing -> throwError $ "missing version: " <> showRef schemaName
+    Just v -> return v
+
+  -- All the schemas we're inheriting from
+  inherits <- traverse schemaByName schemaInherits
+
+  -- All the schemas we imported
+  imports <- traverse schemaByName [ name | SourceImport name _ <- schemaDecls ]
+
+  let
+    qualify :: Name -> Name
+    qualify x = namespace <> "." <> x
+
+    qualifyNameEnv :: NameEnv t -> NameEnv t
+    qualifyNameEnv env = HashMap.fromList
+      [ (SourceRef (qualify name) ver, target)
+      | (SourceRef name ver, target) <- HashMap.toList env ]
+
+    localPreds =
+      [ let
+          SourceRef name explicitVersion = predicateDefRef p
+          thisVersion = fromMaybe version explicitVersion
+          qname = qualify name
+        in
+          (name, PredicateRef qname thisVersion, p)
+      | SourcePredicate p <- schemaDecls
+      ]
+
+    localTypes =
+      [ let
+          SourceRef name explicitVersion = typeDefRef p
+          thisVersion = fromMaybe version explicitVersion
+          qname = qualify name
+        in
+          (name, TypeRef qname thisVersion, p)
+      | SourceType p <- schemaDecls
+      ]
+
+  -- Check for multiple definitions of the same name/version.
+  -- Multiple definitions of the same name is OK: an unqualified
+  -- reference will be rejected as ambiguous, but can be resolved by
+  -- using an explicit version.
+  let
+    numRefs = HashMap.fromListWith (+) $
+      [ ((predicateRef_name, predicateRef_version), 1::Int)
+      | (_, PredicateRef{..}, _) <- localPreds ] ++
+      [ ((typeRef_name, typeRef_version), 1)
+      | (_, TypeRef{..}, _) <- localTypes]
+  forM_ (HashMap.toList numRefs) $ \((name,ver), num) -> do
+    when (num > 1) $ throwError $
+      "multiple definitions for: " <> name <> "." <> showt ver
+
+  -- Build the scope: a mapping from unversioned names to RefTarget
+  let
+    -- inherited definitions are in scope unqualified and qualified
+    --   (but unqualified local names override unqualified inherited names)
+    qualInheritedScope :: NameEnv RefResolved
+    qualInheritedScope =
+      unionNameEnvs $ map resolvedSchemaQualScope inherits
+
+    unqualInheritedScope :: NameEnv RefResolved
+    unqualInheritedScope =
+      unionNameEnvs $ map resolvedSchemaUnqualScope inherits
+
+    -- imported names are in scope qualified only
+    importedScope :: NameEnv RefResolved
+    importedScope = unionNameEnvs $ map resolvedSchemaQualScope imports
+
+    unionNameEnvs :: [NameEnv RefResolved] -> NameEnv RefResolved
+    unionNameEnvs = foldl' (HashMap.unionWith Set.union) HashMap.empty
+
+    nameEntries name ver target =
+      [ (SourceRef name Nothing, set),
+        (SourceRef name (Just ver), set) ]
+      where set = Set.singleton target
+
+    -- local definitions are in scope unqualified and qualified
+    unqualLocalScope :: NameEnv RefResolved
+    unqualLocalScope = HashMap.fromListWith Set.union unqualLocalEntities
+
+    qualLocalScope :: NameEnv RefResolved
+    qualLocalScope = qualifyNameEnv unqualLocalScope
+
+    unqualLocalEntities =
+      -- P and P.1 for each local predicate
+      [ entry
+      | (name, r, _) <- localPreds
+      , entry <- nameEntries name (predicateRef_version r) (RefPred r)
+      ] ++
+      -- T and T.1 for each local type
+      [ entry
+      | (name, r, _) <- localTypes
+      , entry <- nameEntries name (typeRef_version r) (RefType r)
+      ]
+
+    scope =
+      HashMap.union unqualLocalScope $
+      HashMap.union unqualInheritedScope $
+      HashMap.unionWith Set.union qualLocalScope $
+      HashMap.unionWith Set.union qualInheritedScope
+      importedScope
+
+  -- Check for inheriting multiple versions of a predicate/types
+  --
+  -- As a special case, if the schema is called "all" then allow name
+  -- clashes in the inheritance set. This is to facilitate our "all.N"
+  -- convention for declaring the "top-level" schema which will
+  -- inevitably have name clashes, but we don't care about what it
+  -- exports.
+  unless (namespace == "all") $
+    forM_ (HashMap.toList unqualInheritedScope) $ \(ref, targets) -> do
+      case Set.elems targets of
+        (_:_:_) -> throwError $
+          "inherited schemas give multiple definitions for: " <> showRef ref
+        _ -> return ()
+
+  -- resolve type definitions
+  types <- forM localTypes $
+    \(name, ref, TypeDef{..}) -> do
+      checkName name
+      type' <- runResolve angleVersion scope (resolveType typeDefType)
+      return (name, TypeDef
+        { typeDefRef = ref
+        , typeDefType = type'
+        , typeDefSrcSpan = typeDefSrcSpan })
+
+  -- resolve predicate definitions
+  predicates <- forM localPreds $
+    \(name, ref, PredicateDef{..}) -> do
+      checkName name
+      runResolve angleVersion scope $ do
+        key <- resolveType predicateDefKeyType
+        value <- resolveType predicateDefValueType
+        return (name, PredicateDef
+          { predicateDefRef = ref
+          , predicateDefKeyType = key
+          , predicateDefValueType = value
+          , predicateDefDeriving = NoDeriving
+          , predicateDefSrcSpan = predicateDefSrcSpan })
+
+  let
+    -- scope of predicates that we can specify queries for. Namely
+    -- locally-defined predicates and inherited predicates.
+    predScope = resolveRef $
+      HashMap.union unqualLocalScope $
+      HashMap.union unqualInheritedScope $
+      HashMap.unionWith Set.union qualLocalScope
+      qualInheritedScope
+
+  -- resolve queries
+  localDeriving <-
+    forM [ (derivingDefRef,derive)
+      | SourceDeriving derive@DerivingDef{..} <- schemaDecls ] $
+    \(ref, DerivingDef{..}) -> do
+      ty <- lookupResultToExcept ref $ predScope ref
+      ref <- case ty of
+        RefPred ref -> return ref
+        _ -> throwError $ showRef ref <> " is not a predicate"
+      resolvedDerInfo <- runResolve angleVersion scope $
+        resolveDeriving derivingDefDeriveInfo
+      return (ref, DerivingDef ref resolvedDerInfo derivingDefSrcSpan)
+
+  let
+    localTypeNames = HashSet.fromList $
+      map (typeRef_name . typeDefRef . snd) types
+
+    localTypes = HashMap.fromList
+      [ (typeDefRef def, def) | (_, def) <- types ]
+
+    -- The types we re-export from this schema are all the types that
+    -- are inherited but not shadowed by a locally-defined type.
+    reExportedTypes =
+      HashMap.fromList
+        [ (typeDefRef def, def)
+        | schema <- inherits
+        , (ref, def) <- HashMap.toList $
+            resolvedSchemaTypes schema <>
+            resolvedSchemaReExportedTypes schema
+        , not (typeRef_name ref `HashSet.member` localTypeNames)
+        ]
+
+    localPredicateNames = HashSet.fromList $
+      [ predicateRef_name (predicateDefRef def) | (_, def) <- predicates ]
+
+    localPredicates = HashMap.fromList
+      [ (predicateDefRef def, def) | (_, def) <- predicates ]
+
+    -- Similarly for predicates.
+    reExportedPredicates =
+      HashMap.fromList
+        [ (predicateDefRef def, def)
+        | schema <- inherits
+        , (ref, def) <- HashMap.toList $
+            resolvedSchemaPredicates schema <>
+            resolvedSchemaReExportedPredicates schema
+        , not (predicateRef_name ref `HashSet.member` localPredicateNames)
+        ]
+
+    exportedUnqualScope = HashMap.union unqualLocalScope unqualInheritedScope
+      -- Note: local names override inherited names
+
+    -- Qualified exported names. The "all" schema is special: we don't
+    -- re-export things qualified with "all.", only with the original
+    -- schema name.
+    exportedQualScope
+      | namespace == "all" = qualInheritedScope
+      | otherwise =
+         HashMap.union
+           (qualifyNameEnv exportedUnqualScope)
+           qualInheritedScope -- NB. local overrides inherited
+
+  schemaEvolves <- traverse schemaByName evolves
+
+  return ResolvedSchema
+    { resolvedSchemaName = namespace
+    , resolvedSchemaVersion = version
+    , resolvedSchemaAngleVersion = angleVersion
+    , resolvedSchemaTypes = localTypes
+    , resolvedSchemaReExportedTypes = reExportedTypes
+    , resolvedSchemaPredicates = localPredicates
+    , resolvedSchemaReExportedPredicates = reExportedPredicates
+    , resolvedSchemaUnqualScope = exportedUnqualScope
+    , resolvedSchemaQualScope = exportedQualScope
+    , resolvedSchemaDeriving = HashMap.fromList localDeriving
+    , resolvedSchemaEvolves = Set.fromList (schemaRef <$> schemaEvolves)
+    }
+
+resolveType :: (ShowRef t, ShowRef p) =>
+  SourceType -> Resolve p t (Type_ SrcSpan p t)
+resolveType typ = go typ
+  where
+  go typ = case typ of
+    ByteTy -> return ByteTy
+    NatTy -> return NatTy
+    StringTy -> return StringTy
+    ArrayTy ty -> ArrayTy <$> go ty
+    RecordTy fields -> do checkFields fields; RecordTy <$> mapM goField fields
+    SumTy fields -> do checkFields fields; SumTy <$> mapM goField fields
+    SetTy ty -> SetTy <$> go ty
+    PredicateTy s ref -> goRef ref s
+    NamedTy s ref -> goRef ref s -- shouldn't happen, but handle it anyway
+    MaybeTy ty -> MaybeTy <$> go ty
+    EnumeratedTy names -> lift $ do
+      mapM_ checkName names
+      return (EnumeratedTy names)
+    BooleanTy -> return BooleanTy
+    _ -> error "resolveType"
+
+  goRef ref s = do
+    scope <- getScope
+    target <- lift $ lookupResultToExcept ref $
+      resolveRef scope ref
+    case target of
+      RefType ref -> return (NamedTy s ref)
+      RefPred ref -> return (PredicateTy s ref)
+
+  checkFields fields = do
+    sequence_
+      [ throwError $ "duplicate field: " <> x
+        | x:_:_ <- group $ sort $ map fieldDefName fields ]
+    lift $ do
+      mapM_ (checkName . fieldDefName) fields
+      mapM_ (checkFieldName . fieldDefName) fields
+
+  goField (FieldDef name ty) = FieldDef name <$> go ty
+
+
+lookupResultToExcept
+  :: (ShowRef t, ShowRef p)
+  => SourceRef
+  -> LookupResult (RefTarget p t)
+  -> Except Text (RefTarget p t)
+lookupResultToExcept ref res =
+  either throwError return (lookupResultToEither ref res)
+
+checkAngleVersion :: AngleVersion -> Except Text ()
+checkAngleVersion v =
+  unless (v >= latestSupportedAngleVersion) $
+    let ver = Text.pack $ show $ pretty v in
+    throwError $ "Angle version " <> ver <> " is not supported"
+
+checkFieldName :: Name -> Except Text ()
+checkFieldName n =
+  when (isUpper (Text.head n)) $
+    throwError $ "field names must begin with a lowercase letter: " <> n
+
+checkName :: Name -> Except Text ()
+checkName n = do
+  when (n `HashSet.member` reservedWords) $
+    throwError $ n <> " is a reserved word, it cannot be used"
+
+checkNameSpace :: Name -> Except Text ()
+checkNameSpace n = mapM_ checkName (splitDot n)
+
+reservedWords :: HashSet Text
+reservedWords = HashSet.fromList [
+    -- Thrift reserved words, seems like a good idea to avoid these
+    "binary", "bool", "byte", "const", "cpp_include",
+    "double", "enum", "exception", "extends", "false", "float",
+    "hash_map", "hash_set", "hs_include", "i16", "i32", "i64", "include",
+    "list", "map", "namespace", "oneway", "optional", "required", "senum",
+    "service", "set", "stream", "string", "struct", "throws", "true",
+    "typedef", "union", "view", "void",
+
+    -- keywords that the fbthrift compiler rejects (see
+    -- thrift/compiler/parse/thrift.ll)
+    "abstract",
+    "and",
+    "args",
+    "as",
+    "assert",
+    "auto",
+    "break",
+    "case",
+    "char",
+    "class",
+    "continue",
+    "declare",
+    "def",
+    "default",
+    "del",
+    "do",
+    "elif",
+    "else",
+    "elseif",
+    "except",
+    "exec",
+    "extern",
+    "finally",
+    "for",
+    "foreach",
+    "function",
+    "global",
+    "goto",
+    "if",
+    "implements",
+    "import",
+    "in",
+    "int",
+    "inline",
+    "instanceof",
+    "interface",
+    "is",
+    "lambda",
+    "long",
+    "native",
+    "new",
+    "not",
+    "or",
+    "pass",
+    "public",
+    "print",
+    "private",
+    "protected",
+    "raise",
+    "register",
+    "return",
+    "short",
+    "signed",
+    "sizeof",
+    "static",
+    "switch",
+    "synchronized",
+    "template",
+    "this",
+    "throw",
+    "transient",
+    "try",
+    "unsigned",
+    "var",
+    "virtual",
+    "volatile",
+    "while",
+    "with",
+    "yield",
+    "Object",
+    "Client",
+    "IFace",
+    "Processor",
+
+    -- Other words to avoid, because they lead to Thrift-generated code that
+    -- does not compile for one or more languages.
+    "None", "operator", {- TODO: "Enum" -}
+
+    -- Reserved for temporary predicates
+    "_tmp_"
+  ]
+
+
+-- -----------------------------------------------------------------------------
+-- Resolving queries
+
+runResolve
+  :: AngleVersion
+  -> NameEnv (RefTarget p t)
+  -> Resolve p t a
+  -> Except Text a
+runResolve ver scope act = runReaderT act (ver,scope)
+
+type Resolve p t a =
+  ReaderT (AngleVersion, NameEnv (RefTarget p t)) (Except Text) a
+
+getScope :: Resolve p t (NameEnv (RefTarget p t))
+getScope = asks snd
+
+resolveDeriving
+  :: (ShowRef t, ShowRef p)
+  => SourceDerivingInfo' SrcSpan
+  -> Resolve p t (DerivingInfo (Query_ p t))
+resolveDeriving NoDeriving = return NoDeriving
+resolveDeriving (Derive when query) = Derive when <$> resolveQuery query
+
+resolveQuery
+  :: (ShowRef t, ShowRef p)
+  => SourceQuery
+  -> Resolve p t (Query_ p t)
+resolveQuery (SourceQuery head stmts ord) =
+  SourceQuery
+    <$> mapM resolvePat head
+    <*> mapM resolveStatement stmts
+    <*> pure ord
+
+resolvePat
+  :: (ShowRef t, ShowRef p)
+  => SourcePat
+  -> Resolve p t (SourcePat_ SrcSpan SrcSpan p t)
+resolvePat pat = case pat of
+  Nat s i -> return (Nat s i)
+  String s t -> return (String s t)
+  StringPrefix s t -> return (StringPrefix s t)
+  ByteArray s b -> return (ByteArray s b)
+  Array s pats -> Array s <$> mapM resolvePat pats
+  ArrayPrefix s pats -> ArrayPrefix s <$> mapM resolvePat pats
+  Tuple s pats -> Tuple s <$> mapM resolvePat pats
+  All s qs -> All s <$> resolvePat qs
+  Elements s pat -> Elements s <$> resolvePat pat
+  Wildcard s -> return (Wildcard s)
+  TypeSignature s pat ty ->
+    TypeSignature s
+      <$> resolvePat pat
+      <*> resolveType ty
+  Variable s n -> return (Variable s n)
+  FactId s Nothing id -> return (FactId s Nothing id)
+  FactId s (Just pred) id -> do
+    res <- resolveTypeOrPred s pred
+    case res of
+      RefPred ref ->
+        return (TypeSignature s (FactId s Nothing id) (PredicateTy s ref))
+      _other -> prettyErrorIn pat $ "not a predicate: " <> pretty pred
+  OrPattern s l r -> OrPattern s <$> resolvePat l <*> resolvePat r
+  Negation s pat -> Negation s <$> resolvePat pat
+  Never s -> return (Never s)
+  IfPattern s cond then_ else_ ->
+    IfPattern s
+      <$> resolvePat cond
+      <*> resolvePat then_
+      <*> resolvePat else_
+  ElementsOfArray s pat -> ElementsOfArray s <$> resolvePat pat
+  KeyValue s k v -> KeyValue s <$> resolvePat k <*> resolvePat v
+  NestedQuery s q -> NestedQuery s <$> resolveQuery q
+  Struct s fields -> Struct s <$> mapM resolveField fields
+    where resolveField (Field n pat) = Field n <$> resolvePat pat
+  App s (Variable svar txt) args
+    | Just primOp <- HashMap.lookup txt primitives -> do
+      Prim s primOp <$> mapM resolvePat args
+    | otherwise ->
+    case args of
+      [arg] -> do
+        arg' <- resolvePat arg
+        let (range, txt') = if
+              | Just rem <- Text.stripSuffix "#new" txt -> (SeekOnStacked, rem)
+              | Just rem <- Text.stripSuffix "#old" txt -> (SeekOnBase, rem)
+              | otherwise -> (SeekOnAllFacts, txt)
+        res <- resolveTypeOrPred svar txt'
+        case res of
+          RefPred ref -> return (Clause s svar ref arg' range)
+          RefType ref
+            | SeekOnAllFacts <- range ->
+              return (TypeSignature s arg' (NamedTy svar ref))
+            | otherwise ->
+              prettyErrorIn pat "cannot use #new or #old with types"
+            -- The syntax "T pat" for "pat : T" is something we might
+            -- consider deprecating later. For now it's just desugared
+            -- here.
+      _ -> prettyErrorIn pat "unexpected extra argument(s)"
+  App s (StringPrefix a b) [pat] -> do
+    pat' <- resolvePat pat
+    return (App s (StringPrefix a b) [pat'])
+  App _ f _ ->
+    prettyErrorIn pat $ "invalid pattern: cannot apply " <>
+    describe f <> " to arguments"
+  FieldSelect s pat field q ->
+    (\p -> FieldSelect s p field q)
+      <$> resolvePat pat
+  Deref s pat -> Deref s <$> resolvePat pat
+  Enum s n -> return (Enum s n)
+  Clause{} -> internal
+  Prim{} -> internal
+  where
+  internal = throwError $ "internal: unexpected: " <>
+    Text.pack (show (pretty pat))
+
+resolveTypeOrPred
+  :: (ShowRef p, ShowRef t)
+  => SrcSpan
+  -> Name
+  -> Resolve p t (RefTarget p t)
+resolveTypeOrPred span txt = do
+  scope <- getScope
+  let ref = parseRef txt
+  case lookupResultToEither ref $ resolveRef scope ref of
+    Left s -> prettyErrorAt span (pretty s)
+    Right r -> return r
+
+prettyError :: Doc ann -> Resolve p t a
+prettyError = throwError . Text.pack . show
+
+prettyErrorIn :: IsSrcSpan s => SourcePat' s st -> Doc ann -> Resolve p t a
+prettyErrorIn pat doc = prettyErrorAt (sourcePatSpan pat) doc
+
+prettyErrorAt :: IsSrcSpan span => span -> Doc ann -> Resolve p t a
+prettyErrorAt span doc = prettyError $ vcat
+  [ pretty span
+  , doc
+  ]
+
+resolveStatement
+  :: (ShowRef t, ShowRef p)
+  => SourceStatement
+  -> Resolve p t (Statement_ p t)
+resolveStatement (SourceStatement l r) =
+  SourceStatement <$> resolvePat l <*> resolvePat r
+
+primitives :: HashMap Text PrimOp
+primitives = HashMap.fromList
+  [ ("prim.toLower", PrimOpToLower)
+  , ("prim.length", PrimOpLength)
+  , ("prim.relToAbsByteSpans", PrimOpRelToAbsByteSpans)
+  , ("prim.unpackByteSpans", PrimOpUnpackByteSpans)
+  , ("prim.zip", PrimOpZip)
+  , ("prim.concat", PrimOpConcat)
+  , ("prim.reverse", PrimOpReverse)
+  , ("prim.size", PrimOpSize)
+  , ("prim.gtNat", PrimOpGtNat)
+  , ("prim.geNat", PrimOpGeNat)
+  , ("prim.ltNat", PrimOpLtNat)
+  , ("prim.leNat", PrimOpLeNat)
+  , ("prim.neNat", PrimOpNeNat)
+  , ("prim.addNat", PrimOpAddNat)
+  , ("prim.neExpr", PrimOpNeExpr)
+  ]
diff --git a/glean/hs/Glean/Schema/Types.hs b/glean/hs/Glean/Schema/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Schema/Types.hs
@@ -0,0 +1,191 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+{-# LANGUAGE DeriveFunctor #-}
+module Glean.Schema.Types (
+  -- * Schema references
+  SchemaRef(..), showSchemaRef,
+
+  -- * Name targets
+  RefTarget(..), RefResolved,
+
+  -- * Resolved abstract syntax
+  ResolvedPat,
+  ResolvedType,
+  ResolvedFieldDef,
+  ResolvedTypeDef,
+  ResolvedPredicateDef,
+  ResolvedDerivingDef,
+  ResolvedQuery,
+  ResolvedStatement,
+  ResolvedDeriving,
+
+  ResolvedPat',
+  ResolvedStatement',
+  ResolvedQuery',
+  ResolvedDeriving',
+  ResolvedTypeDef',
+  ResolvedType',
+  ResolvedFieldDef',
+
+  -- * Name environments and resolution
+  NameEnv,
+  mapNameEnv,
+  LookupResult(..),
+  resolveRef,
+  resolveRefFiltered,
+  lookupResultToEither,
+
+  -- * Resolved schemas
+  ResolvedSchemas(..),
+  ResolvedSchema(..),
+  ResolvedSchemaRef,
+  schemaRef,
+) where
+
+import Data.Bifunctor
+import Data.Binary
+import Data.Hashable
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Set (Set)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import GHC.Generics
+
+import Glean.Angle.Types
+import Glean.Schema.Util
+
+-- | Identify a schema
+data SchemaRef = SchemaRef Name Version
+  deriving (Eq, Ord, Show, Generic)
+
+showSchemaRef :: SchemaRef -> Text
+showSchemaRef (SchemaRef name version) =
+  name <> "." <> Text.pack (show version)
+
+instance Hashable SchemaRef
+
+-- | The target of a reference
+data RefTarget p t = RefPred p | RefType t
+  deriving (Eq, Ord, Show, Generic, Functor)
+
+instance (Binary p, Binary t) => Binary (RefTarget p t)
+
+instance Bifunctor RefTarget where
+  bimap f _ (RefPred p) = RefPred (f p)
+  bimap _ g (RefType t) = RefType (g t)
+
+type RefResolved = RefTarget PredicateRef TypeRef
+
+showRefTarget :: (ShowRef t, ShowRef p) => RefTarget p t -> Text
+showRefTarget (RefType t) = showRef t
+showRefTarget (RefPred p) = showRef p
+
+-- | An environment that describes which names are in scope.
+type NameEnv t = HashMap SourceRef (Set t)
+
+mapNameEnv :: Ord b => (a -> Maybe b) -> NameEnv a -> NameEnv b
+mapNameEnv f = fmap g
+  where
+  g set = Set.fromList [ b | a <- Set.toList set, Just b <- [f a] ]
+
+data LookupResult t
+  = OutOfScope
+  | Ambiguous [t]
+  | ResolvesTo t
+
+lookupResultToEither
+  :: (ShowRef t, ShowRef p)
+  => SourceRef
+  -> LookupResult (RefTarget p t)
+  -> Either Text (RefTarget p t)
+lookupResultToEither ref OutOfScope =
+  Left $ "not in scope: " <> showRef ref
+lookupResultToEither ref (Ambiguous targets) =
+  Left $ showRef ref <> " is ambiguous. It could refer to: " <>
+      Text.intercalate ", " (map showRefTarget targets)
+lookupResultToEither _ (ResolvesTo target) = Right target
+
+-- | Resolve a name (@SourceRef@) with respect to a scope (@NameEnv@)
+resolveRef :: NameEnv t -> SourceRef -> LookupResult t
+resolveRef scope ref = resolveRefFiltered scope (const True) ref
+
+resolveRefFiltered :: NameEnv t -> (t -> Bool) -> SourceRef -> LookupResult t
+resolveRefFiltered scope p ref =
+  case HashMap.lookup ref scope of
+    Nothing -> OutOfScope
+    Just set -> case filter p $ Set.toList set of
+      [] -> OutOfScope
+      [one] -> ResolvesTo one
+      many -> Ambiguous many
+
+-- Resolved abstract syntax
+
+type ResolvedType = Type_ SrcSpan PredicateRef TypeRef
+type ResolvedFieldDef = FieldDef_ SrcSpan PredicateRef TypeRef
+type ResolvedTypeDef = TypeDef_ SrcSpan PredicateRef TypeRef
+type ResolvedPredicateDef = PredicateDef_ SrcSpan SrcSpan PredicateRef TypeRef
+type ResolvedDerivingDef = DerivingDef_ SrcSpan SrcSpan PredicateRef TypeRef
+type ResolvedPat = SourcePat_ SrcSpan SrcSpan PredicateRef TypeRef
+type ResolvedStatement = SourceStatement_ SrcSpan SrcSpan PredicateRef TypeRef
+type ResolvedQuery = SourceQuery_ SrcSpan SrcSpan PredicateRef TypeRef
+type ResolvedDeriving = DerivingInfo ResolvedQuery
+
+-- Versions of the above types abstracted over the source spans
+type ResolvedPat' s = SourcePat_ s s PredicateRef TypeRef
+type ResolvedStatement' s = SourceStatement_ s s PredicateRef TypeRef
+type ResolvedQuery' s = SourceQuery_ s s PredicateRef TypeRef
+type ResolvedDeriving' s = DerivingInfo (ResolvedQuery' s)
+type ResolvedTypeDef' s = TypeDef_ s PredicateRef TypeRef
+type ResolvedType' s = Type_ s PredicateRef TypeRef
+type ResolvedFieldDef' s = FieldDef_ s PredicateRef TypeRef
+-- | A 'ResolvedSchema' is used during schema resolution to resolve
+-- schemas that import or inherit from this schema.
+data ResolvedSchema p t = ResolvedSchema
+  { resolvedSchemaName :: Name
+  , resolvedSchemaVersion :: Version
+  , resolvedSchemaAngleVersion :: AngleVersion
+  , resolvedSchemaTypes :: HashMap TypeRef (TypeDef_ SrcSpan p t )
+    -- ^ types that are defined by this schema
+  , resolvedSchemaReExportedTypes :: HashMap TypeRef (TypeDef_ SrcSpan p t )
+    -- ^ types that are inherited and re-exported by this schema
+  , resolvedSchemaPredicates ::
+      HashMap PredicateRef (PredicateDef_ SrcSpan SrcSpan p t)
+    -- ^ predicates that are defined by this schema
+  , resolvedSchemaReExportedPredicates ::
+      HashMap PredicateRef (PredicateDef_ SrcSpan SrcSpan p t)
+    -- ^ predicates that are inherited and re-exported by this schema
+  , resolvedSchemaUnqualScope :: NameEnv (RefTarget p t)
+    -- ^ The scope exposed by this schema, unqualified. This will be
+    -- used when the schema is inherited.
+  , resolvedSchemaQualScope :: NameEnv (RefTarget p t)
+    -- ^ The scope exposed by this schema, qualified. This will be
+    -- used when the schema is inherited or imported.
+  , resolvedSchemaDeriving ::
+      HashMap PredicateRef (DerivingDef_ SrcSpan SrcSpan p t)
+    -- ^ deriving declarations, for predicates defined in this schema
+    -- or an inherited schema.
+  , resolvedSchemaEvolves :: Set SchemaRef
+    -- ^ schemas evolves by this schema.
+  }
+
+type ResolvedSchemaRef = ResolvedSchema PredicateRef TypeRef
+
+schemaRef :: ResolvedSchema p t -> SchemaRef
+schemaRef ResolvedSchema{..} =
+  SchemaRef resolvedSchemaName resolvedSchemaVersion
+
+-- | A set of schemas after name resolution
+data ResolvedSchemas = ResolvedSchemas
+  { schemasHighestVersion :: Maybe Version
+  , schemasResolved :: [ResolvedSchemaRef]
+    -- ^ Resolved schemas in dependency order
+  }
diff --git a/glean/hs/Glean/Schema/Util.hs b/glean/hs/Glean/Schema/Util.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Schema/Util.hs
@@ -0,0 +1,115 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Utilities for working with Glean.Angle.Types
+module Glean.Schema.Util
+  ( unit
+  , lowerBool
+  , lowerMaybe
+  , lowerEnum
+  , boolFields
+  , maybeFields
+  , enumFields
+  , tupleSchema
+  , parseRef
+  , convertRef
+  , ShowRef(..)
+  , NameSpaces
+  , splitDot
+  , SourceRef(..)
+  ) where
+
+import Data.Text (Text)
+import qualified Data.Text as Text
+import TextShow
+
+import Util.Text
+
+import Glean.Angle.Types
+
+unit :: Type_ s a b
+unit = RecordTy []
+
+-- | A maybe type is equivalent to a sum type with {nothing,just} fields.
+lowerMaybe :: Type_ s a b -> Type_ s a b
+lowerMaybe param = SumTy (maybeFields param)
+
+maybeFields :: Type_ s a b -> [FieldDef_ s a b]
+maybeFields param =
+  [ FieldDef "nothing" unit
+  , FieldDef "just" param ]
+
+lowerBool :: Type_ s a b
+lowerBool = SumTy boolFields
+
+boolFields :: [FieldDef_ s a b]
+boolFields = [FieldDef "false" unit, FieldDef "true" unit]
+
+lowerEnum :: [Name] -> Type_ s a b
+lowerEnum ides = SumTy (enumFields ides)
+
+enumFields :: [Name] -> [FieldDef_ s a b]
+enumFields ides = [FieldDef ide unit | ide <- ides]
+
+tupleSchema :: [Type_ s a b] -> Type_ s a b
+tupleSchema tys = RecordTy
+  [ FieldDef (tupleField <> Text.pack (show n)) ty
+  | (n,ty) <- zip [0::Int ..] tys ]
+
+-- | Parse a predicate reference of the form @<predicate>[.<version>]@
+-- If the version is omitted, it defaults to the most recent version
+-- of that predicate.
+--
+-- This syntax is used in:
+--  * The JSON format for writing facts
+--  * Referring to predicates in the shell
+--
+parseRef :: Text -> SourceRef
+parseRef txt
+  | Right ver <- textToInt after =
+    SourceRef (Text.init before) (Just (fromIntegral ver))
+  | otherwise =
+    SourceRef txt Nothing
+  where
+   (before,after) = Text.breakOnEnd "." txt
+
+-- | Convert from a 'PredicateRef' (oftem from 'getName') to 'SourceRef'
+-- (which is guaranteed to have a 'Version')
+convertRef :: PredicateRef -> SourceRef
+convertRef p = SourceRef
+  { sourceRefName = predicateRef_name p
+  , sourceRefVersion = Just (fromIntegral (predicateRef_version p)) }
+
+class ShowRef t where
+  showRef :: t -> Text
+
+-- | Render the SourceRef to @name@ or @name.ver@
+instance ShowRef SourceRef where
+  showRef (SourceRef name Nothing) = name
+  showRef (SourceRef name (Just ver)) = name <> "." <> showt ver
+
+instance ShowRef TypeRef where
+  showRef (TypeRef name ver) = name <> "." <> showt ver
+
+instance ShowRef PredicateRef where
+  showRef = showRef . convertRef
+
+instance ShowRef PredicateId where
+  showRef (PredicateId name hash) = showRef name <> "." <> Text.pack (show hash)
+
+instance ShowRef TypeId where
+  showRef (TypeId name hash) = showRef name <> "." <> Text.pack (show hash)
+
+type NameSpaces = [Text]
+
+splitDot :: Name -> (NameSpaces, Text)
+splitDot x =
+  let pieces = Text.split ('.' ==) x
+  in case reverse pieces of
+      [] -> ([], "")
+      x : ys -> (reverse ys, x)
diff --git a/glean/hs/Glean/Typed.hs b/glean/hs/Glean/Typed.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed.hs
@@ -0,0 +1,28 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- |
+-- Support for working with strongly-typed Glean data.
+--
+module Glean.Typed
+  ( module Glean.Typed.Binary
+  , module Glean.Typed.Build
+  , module Glean.Typed.BuildFact
+  , module Glean.Typed.Fact
+  , module Glean.Typed.Id
+  , module Glean.Typed.Predicate
+  , module Glean.Typed.Prim
+  ) where
+
+import Glean.Typed.Binary
+import Glean.Typed.Build
+import Glean.Typed.BuildFact
+import Glean.Typed.Fact
+import Glean.Typed.Id
+import Glean.Typed.Predicate
+import Glean.Typed.Prim
diff --git a/glean/hs/Glean/Typed/Binary.hs b/glean/hs/Glean/Typed/Binary.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Binary.hs
@@ -0,0 +1,330 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE AllowAmbiguousTypes, TypeApplications #-}
+
+-- |
+-- Support for converting between Haskell types and Glean's binary
+-- format.
+--
+module Glean.Typed.Binary
+  ( -- * 'Type' encoder / decoder
+    Type(..)
+    -- ** helper
+  , decodeRts
+    -- * Used in generated Haskell code
+  , mapD, buildRtsSelector, thriftEnum_buildRtsValue
+  ) where
+
+import Control.Monad
+import Control.Monad.IO.Class
+import Data.ByteString ( ByteString )
+import qualified Data.ByteString.Unsafe as BS
+import Data.Dynamic
+import Data.IORef
+import Data.IntMap (IntMap)
+import Data.Proxy (Proxy(..))
+import Data.Set
+import Data.Text ( Text )
+import Data.Word ( Word64 )
+import Foreign.Ptr
+
+import Thrift.Protocol (ThriftEnum, fromThriftEnum)
+import qualified Util.FFI as FFI
+
+import qualified Glean.Angle.Types as Angle
+import qualified Glean.Schema.Util as Angle
+import qualified Glean.FFI as FFI
+import qualified Glean.RTS as RTS
+import qualified Glean.RTS.Builder as RTS
+import Glean.RTS.Set
+import Glean.Typed.Build
+import Glean.Typed.Id
+import Glean.Types as Thrift
+
+-- -----------------------------------------------------------------------------
+
+-- | Types that can be converted to/from Glean's binary representation
+class Type a where
+  -- | Convert to a Glean value
+  buildRtsValue :: RTS.Builder -> a -> IO ()
+
+  -- | Convert from a Glean value
+  decodeRtsValue :: Decoder a
+
+  -- | If this type only has one possible value and hence doesn't have a
+  -- run-time representation (i.e., is effectively ()), yield that value
+  constantRtsValue :: Maybe a
+
+  constantRtsValue = Nothing
+
+  -- | Decode this type when it is the result of a query. Queries for
+  -- a predicate type return the facts of the predicate directly,
+  -- whereas queries for non-predicate types return facts of a
+  -- pseudo-predicate whose keys are the query results.  The
+  -- 'decodeAsFact' method abstracts the difference in representation
+  -- between predicate and non-predicate query results, so we can just
+  -- use 'decodeAsFact' to decode query results.
+  --
+  -- The default implementation works for all non-predicate types;
+  -- predicate types override it with 'decodeFact'.
+  decodeAsFact
+    :: (MonadIO m)
+    => IntMap Thrift.Fact               -- ^ serialized nested facts
+    -> IORef (IntMap Dynamic)           -- ^ cached deserialized facts
+    -> IdOf a                           -- ^ Id of fact to decode
+    -> Thrift.Fact                      -- ^ fact to decode
+    -> m a
+
+  decodeAsFact nested cache _fid (Thrift.Fact _ k _) =
+    decodeWithCache nested cache decodeRtsValue k
+
+  -- | Get the representation of the type
+  sourceType :: Proxy a -> Angle.SourceType' ()
+
+-- -----------------------------------------------------------------------------
+
+-- | Convenient combination, buiding on the 'decode' from
+-- "Glean.RTS.Types.Build"
+decodeRts :: forall m a. (MonadIO m, Type a) => ByteString -> m a
+decodeRts = decode decodeRtsValue
+
+-- | Nicer and shorter name, very handy to implement custom types by
+-- using the tuple instances defined in this module.
+mapD :: Type a => (a -> b) -> Decoder b
+mapD f = f <$> decodeRtsValue
+
+-- | Helper for SUM types
+buildRtsSelector :: RTS.Builder -> Int -> IO ()
+buildRtsSelector b = FFI.call . RTS.glean_push_value_selector b . fromIntegral
+
+thriftEnum_buildRtsValue :: forall a. ThriftEnum a => RTS.Builder -> a -> IO ()
+thriftEnum_buildRtsValue b x = buildRtsSelector b $ fromThriftEnum x
+
+-- -----------------------------------------------------------------------------
+-- Basic Type instances
+
+instance Type Word64 where
+  buildRtsValue b x = FFI.call $ RTS.glean_push_value_nat b x
+  decodeRtsValue = Decoder $ \DecoderEnv{..} ->
+    FFI.ffiBuf buf $ RTS.glean_pop_value_nat begin end
+  sourceType _ = Angle.NatTy
+
+instance Type ByteString where
+  buildRtsValue b xs = BS.unsafeUseAsCStringLen xs $ \(p,n) -> do
+    FFI.call $ RTS.glean_push_value_array b (fromIntegral n)
+    FFI.call $ RTS.glean_push_value_bytes b (castPtr p) (fromIntegral n)
+  decodeRtsValue = Decoder $ \DecoderEnv{..} -> do
+    size <- FFI.ffiBuf buf $ RTS.glean_pop_value_array begin end
+    ptr <- FFI.ffiBuf buf $ RTS.glean_pop_value_bytes begin end size
+    BS.unsafePackMallocCStringLen (castPtr ptr, fromIntegral size)
+  sourceType _ = Angle.ArrayTy Angle.ByteTy
+
+instance Type Text where
+  buildRtsValue b s = FFI.withUTF8Text s $ \p n ->
+    FFI.call $ RTS.glean_push_value_string b (castPtr p) n
+  decodeRtsValue = Decoder $ \DecoderEnv{..} -> do
+    (p,n) <- FFI.invoke $ RTS.glean_pop_value_string begin end
+    FFI.unsafeMallocedUTF8 (castPtr p) n
+  sourceType _ = Angle.StringTy
+
+-- | The instance for () does not encode or decode bytes, it is vacuous
+instance Type () where
+  buildRtsValue _ () = return ()
+  decodeRtsValue = pure ()
+  constantRtsValue = Just ()
+  sourceType _ = Angle.unit
+
+
+-- | Bool is alias for sum of two ()
+instance Type Bool where
+  buildRtsValue b False = buildRtsSelector b 0
+  buildRtsValue b True = buildRtsSelector b 1
+  decodeRtsValue = enumD fail
+    where fail = Decoder $ \_ -> decodeFail "bool selector out of range"
+  sourceType _ = Angle.BooleanTy
+
+
+instance Type Nat where
+  buildRtsValue b nat = FFI.call $
+    RTS.glean_push_value_nat b ((fromIntegral . unNat) nat)
+  decodeRtsValue = Decoder $ \DecoderEnv{..} ->
+    fmap (Nat . fromIntegral)
+         (FFI.ffiBuf buf (RTS.glean_pop_value_nat begin end))
+  sourceType _ = Angle.NatTy
+
+instance Type Byte where
+  buildRtsValue b byt = FFI.call $
+    RTS.glean_push_value_byte b ((fromIntegral . unByte) byt)
+  decodeRtsValue = Decoder $ \DecoderEnv{..} ->
+    fmap (Byte . fromIntegral)
+         (FFI.ffiBuf buf (RTS.glean_pop_value_byte begin end))
+  sourceType _ = Angle.ByteTy
+
+-- -----------------------------------------------------------------------------
+-- Containers
+
+-- | Lists are preceded with their length
+instance Type a => Type [a] where
+  buildRtsValue b xs = liftIO $ do
+    FFI.call $ RTS.glean_push_value_array b $ fromIntegral $ length xs
+    mapM_ (buildRtsValue b) xs
+  decodeRtsValue = Decoder $ \env@DecoderEnv{..} -> do
+    size <- FFI.ffiBuf buf $ RTS.glean_pop_value_array begin end
+    replicateM (fromIntegral size) (runDecoder decodeRtsValue env)
+
+  sourceType _ = Angle.ArrayTy (sourceType (Proxy @a))
+
+-- | 'Maybe' is alias pattern for sum of () | 'a' (in this order)
+instance Type a => Type (Maybe a) where
+  buildRtsValue b Nothing = buildRtsSelector b 0
+  buildRtsValue b (Just x) = do
+    buildRtsSelector b 1
+    buildRtsValue b x
+  decodeRtsValue = sumD
+    (Decoder $ \_ -> decodeFail "maybe selector out of range")
+    [pure Nothing, Just <$> decodeRtsValue]
+  sourceType _ = Angle.MaybeTy (sourceType (Proxy @a))
+
+instance {-# OVERLAPPING #-} Type (Set Byte) where
+  buildRtsValue b xs =
+    withWordRtsSet $ \set -> do
+      forM_ xs $ \x ->
+        insertWordRtsSet set (unByte x)
+      buildWordSetBytes set b
+  decodeRtsValue = Decoder $ \env@DecoderEnv{..} -> do
+    size <- FFI.ffiBuf buf $ RTS.glean_pop_value_set begin end
+    fromList <$> replicateM (fromIntegral size) (runDecoder decodeRtsValue env)
+  sourceType _ = Angle.SetTy Angle.ByteTy
+
+instance {-# OVERLAPPING #-} Type (Set Nat) where
+  buildRtsValue b xs =
+    withWordRtsSet $ \set -> do
+      forM_ xs $ \x -> do
+        insertWordRtsSet set (unNat x)
+      buildWordSet set b
+  decodeRtsValue = Decoder $ \env@DecoderEnv{..} -> do
+    size <- FFI.ffiBuf buf $ RTS.glean_pop_value_set begin end
+    fromList <$> replicateM (fromIntegral size) (runDecoder decodeRtsValue env)
+  sourceType _ = Angle.SetTy Angle.NatTy
+
+instance {-# OVERLAPPABLE #-} (Type a, Ord a) => Type (Set a) where
+  buildRtsValue b xs = liftIO $
+    withRtsSet $ \set -> do
+      RTS.withBuilder $ \tb ->
+        forM_ xs $ \x -> do
+          buildRtsValue tb x
+          insertBuilder set tb
+          RTS.resetBuilder tb
+      buildSet set b
+  decodeRtsValue = Decoder $ \env@DecoderEnv{..} -> do
+    size <- FFI.ffiBuf buf $ RTS.glean_pop_value_set begin end
+    fromList <$> replicateM (fromIntegral size) (runDecoder decodeRtsValue env)
+  sourceType _ = Angle.SetTy (sourceType (Proxy @a))
+
+-- -----------------------------------------------------------------------------
+
+-- | 'IdOf' as a Glean primitive
+instance (Type p) => Type (IdOf p) where
+  buildRtsValue b (IdOf fid) = FFI.call $ RTS.glean_push_value_fact b fid
+  decodeRtsValue = Decoder $ \DecoderEnv{..} ->
+    IdOf <$> FFI.ffiBuf buf (RTS.glean_pop_value_fact begin end)
+  sourceType _ = sourceType (Proxy @p)
+
+-- -----------------------------------------------------------------------------
+-- All the tuples, using the wonderful Applicative instance of Decoder
+
+instance (Type a, Type b) => Type (a,b) where
+  buildRtsValue builder (a,b) = do
+    buildRtsValue builder a
+    buildRtsValue builder b
+  decodeRtsValue = (,)
+    <$> decodeRtsValue
+    <*> decodeRtsValue
+  sourceType _ = Angle.tupleSchema
+      [ sourceType (Proxy @a)
+      , sourceType (Proxy @b)
+      ]
+
+instance (Type a, Type b, Type c) => Type (a,b,c) where
+  buildRtsValue builder (a,b,c) = do
+    buildRtsValue builder a
+    buildRtsValue builder b
+    buildRtsValue builder c
+  decodeRtsValue = (,,)
+    <$> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+  sourceType _ = Angle.tupleSchema
+      [ sourceType (Proxy @a)
+      , sourceType (Proxy @b)
+      , sourceType (Proxy @c)
+      ]
+
+instance (Type a, Type b, Type c, Type d) => Type (a,b,c,d) where
+  buildRtsValue builder (a,b,c,d) = do
+    buildRtsValue builder a
+    buildRtsValue builder b
+    buildRtsValue builder c
+    buildRtsValue builder d
+  decodeRtsValue = (,,,)
+    <$> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+  sourceType _ = Angle.tupleSchema
+      [ sourceType (Proxy @a)
+      , sourceType (Proxy @b)
+      , sourceType (Proxy @c)
+      , sourceType (Proxy @d)
+      ]
+
+instance (Type a, Type b, Type c, Type d, Type e) => Type (a,b,c,d,e) where
+  buildRtsValue builder (a,b,c,d,e) = do
+    buildRtsValue builder a
+    buildRtsValue builder b
+    buildRtsValue builder c
+    buildRtsValue builder d
+    buildRtsValue builder e
+  decodeRtsValue = (,,,,)
+    <$> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+  sourceType _ = Angle.tupleSchema
+      [ sourceType (Proxy @a)
+      , sourceType (Proxy @b)
+      , sourceType (Proxy @c)
+      , sourceType (Proxy @d)
+      , sourceType (Proxy @e)
+      ]
+
+instance (Type a, Type b, Type c, Type d, Type e, Type f) => Type (a,b,c,d,e,f) where
+  buildRtsValue builder (a,b,c,d,e,f) = do
+    buildRtsValue builder a
+    buildRtsValue builder b
+    buildRtsValue builder c
+    buildRtsValue builder d
+    buildRtsValue builder e
+    buildRtsValue builder f
+  decodeRtsValue = (,,,,,)
+    <$> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+    <*> decodeRtsValue
+  sourceType _ = Angle.tupleSchema
+      [ sourceType (Proxy @a)
+      , sourceType (Proxy @b)
+      , sourceType (Proxy @c)
+      , sourceType (Proxy @d)
+      , sourceType (Proxy @e)
+      , sourceType (Proxy @f)
+      ]
diff --git a/glean/hs/Glean/Typed/Build.hs b/glean/hs/Glean/Typed/Build.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Build.hs
@@ -0,0 +1,139 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+-- | This splits out the RTSType encoding and decoding from Typed.hs
+module Glean.Typed.Build
+  ( Decoder(..)
+  , DecoderEnv(..)
+  , DecodingException(..), decodeFail
+  , decode
+  , decodeWithCache
+  , sumD, enumD, thriftEnumD
+  ) where
+
+import Control.Exception ( Exception, throwIO )
+import Control.Monad
+import Control.Monad.IO.Class ( MonadIO, liftIO )
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Unsafe as BS
+import Data.Dynamic
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.IORef
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Foreign.Marshal.Utils as Marshal ( with )
+import Foreign
+import Thrift.Protocol (ThriftEnum, toThriftEnum)
+
+import qualified Glean.FFI as FFI
+import qualified Glean.RTS as RTS
+import qualified Glean.Types as Thrift
+
+-- -----------------------------------------------------------------------------
+
+data DecoderEnv = DecoderEnv
+  { begin :: {-# UNPACK #-} !(Ptr (Ptr ()))
+  , end :: {-# UNPACK #-} !(Ptr ())
+  , buf :: {-# UNPACK #-} !FFI.FFIResultBuf
+  , serialized :: IntMap Thrift.Fact
+  , cacheRef :: {-# UNPACK #-}!(IORef (IntMap Dynamic))
+  }
+
+-- | runDecoder takes 'begin' and 'end' and advances the 'begin' position.
+-- Can usually throw 'GleanFFIError' or 'DecodingException'
+newtype Decoder a = Decoder
+ { runDecoder :: DecoderEnv -> IO a
+ }
+
+instance Functor Decoder where
+  fmap f (Decoder g) = Decoder $ \env -> fmap f (g env)
+
+instance Applicative Decoder where
+  pure x = Decoder $ \_ -> pure x
+  {-# INLINE (<*>) #-}
+  (<*>) = ap
+
+instance Monad Decoder where
+  return = pure
+  {-# INLINE (>>=) #-}
+  Decoder m >>= k = Decoder $ \env -> do
+    a <- m env
+    runDecoder (k a) env
+
+-- -----------------------------------------------------------------------------
+
+newtype DecodingException = DecodingException { decodingException :: Text }
+
+instance Show DecodingException where show = Text.unpack . decodingException
+
+instance Exception DecodingException
+
+-- | Throw 'DecodingException'
+decodeFail :: Text -> IO a
+decodeFail = throwIO . DecodingException
+
+-- -----------------------------------------------------------------------------
+
+-- | Can throw 'DecodingException'-. The 'Decoder' must consume the entire
+-- 'ByteString' leaving no extra bytes.
+decode :: forall m a. (MonadIO m) => Decoder a -> ByteString -> m a
+decode decoder v = do
+  cache <- liftIO $ newIORef IntMap.empty
+  decodeWithCache IntMap.empty cache decoder v
+
+decodeWithCache
+  :: forall m a. (MonadIO m)
+  => IntMap Thrift.Fact
+  -> IORef (IntMap Dynamic)
+  -> Decoder a
+  -> ByteString
+  -> m a
+decodeWithCache serialized cache decoder v =
+  liftIO $ BS.unsafeUseAsCStringLen v $ \(p,n) -> do
+    let begin = castPtr p :: Ptr ()
+        end   = castPtr (p `plusPtr` n) :: Ptr ()
+    Marshal.with begin $ \ (pbegin :: Ptr (Ptr ())) -> do
+      FFI.withFFIResultBuf $ \buf -> do
+        x <- runDecoder decoder (DecoderEnv pbegin end buf serialized cache)
+        pos <- peek pbegin
+        when (pos /= end) $ do
+          let extra = Text.pack (show (end `minusPtr` pos))
+          decodeFail ("extra " <> extra <> " bytes at end of value")
+        return x
+
+
+-- | A generic decoder for sum types. Can throw 'GleanFFIError'
+sumD :: Decoder b -> [Decoder b] -> Decoder b
+sumD empty alts = Decoder $ \env@DecoderEnv{..} -> do
+  sel <- FFI.ffiBuf buf $ RTS.glean_pop_value_selector begin end
+  let Decoder f = index sel alts
+  f env
+  where
+    index 0 (x:_) = x
+    index i (_:xs) = index (i-1) xs
+    index _ [] = empty
+
+-- | A generic decoder, used for Bool. Can throw 'GleanFFIError'
+enumD :: forall a. (Enum a, Bounded a) => Decoder a -> Decoder a
+enumD unknown = Decoder $ \env@DecoderEnv{..} -> do
+  sel <- FFI.ffiBuf buf $ RTS.glean_pop_value_selector begin end
+  let Decoder f = if sel <= ord maxBound - ord minBound
+        then return $ toEnum $ fromIntegral $ sel + ord minBound
+        else unknown
+  f env
+  where
+    ord x = fromIntegral $ fromEnum (x :: a)
+
+-- | A generic decoder for thrift enum types.
+thriftEnumD :: ThriftEnum a => Decoder a
+thriftEnumD = Decoder $ \DecoderEnv{..} ->
+  fmap (toThriftEnum . fromIntegral)
+    $ FFI.ffiBuf buf
+    $ RTS.glean_pop_value_selector begin end
diff --git a/glean/hs/Glean/Typed/BuildFact.hs b/glean/hs/Glean/Typed/BuildFact.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/BuildFact.hs
@@ -0,0 +1,213 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE AllowAmbiguousTypes, TypeApplications, CPP, InstanceSigs #-}
+module Glean.Typed.BuildFact
+  ( NewFact(newFact,withUnit, derivedFrom)
+  , makeFact
+  , makeFact_
+  , makeFactV
+  , makeFactV_
+  , Facts
+  , newFacts
+  , serializeFacts
+  , factsMemory
+  , FactBuilder
+  , buildFacts
+  , extendFacts
+  , buildBatch
+  ) where
+
+import Data.Coerce
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Int
+import Data.IORef
+import Data.Maybe
+import qualified Data.Vector.Storable as Vector
+import Control.Monad
+import Control.Monad.IO.Class
+#if !MIN_VERSION_base(4,13,0)
+import Control.Monad.Fail (MonadFail)
+#endif
+import Control.Monad.Trans.Class
+import Control.Monad.Trans.Reader
+
+import Glean.RTS.Builder (sizeOfBuilder, withBuilder)
+import Glean.RTS.Foreign.Define (defineFact)
+import Glean.RTS.Foreign.FactSet (FactSet)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Lookup
+import Glean.RTS.Types (lowestFid)
+import Glean.Typed.Binary
+import Glean.Typed.Id
+import Glean.Typed.Predicate
+import qualified Glean.Types as Thrift
+
+-- -----------------------------------------------------------------------------
+
+-- | Class of monads which support creation of new typed facts
+--
+-- Include 'MonadFail' constraint to avoid needing 'error'
+class (MonadFail m, Monad m) => NewFact m where
+  -- | Create a new fact with a the given key and value
+  newFact :: Predicate p => KeyType p -> ValueType p -> m (IdOf p)
+
+  -- | Create some facts owned by the given UnitName
+  withUnit ::Thrift.UnitName -> m a -> m a
+
+  -- | Set dependencies of an externally derived fact
+  derivedFrom :: Predicate p => [Fid] -> [p] -> m ()
+
+-- | Create a new fact in a 'NewFact' monad and return the corresponding Thrift
+-- structure which will have 'Just' the passed key and value.
+makeFactV
+  :: forall p m. (Predicate p, NewFact m)
+  => KeyType p -> ValueType p -> m p
+makeFactV key value =
+  (\i -> mkFact i (Just key) (Just value)) <$> newFact key value
+
+-- | Create a new fact in a 'NewFact' monad.
+makeFactV_
+  :: forall p m. (Predicate p, NewFact m)
+  => KeyType p -> ValueType p -> m ()
+makeFactV_ key value = void $ newFact @m @p key value
+
+-- | Create a new key-only fact in a 'NewFact' monad and return the
+-- corresponding Thrift structure which will have 'Just' the passed key.
+makeFact
+  :: forall p m. (Predicate p, ValueType p ~ (), NewFact m)
+  => KeyType p -> m p
+makeFact key = makeFactV key ()
+
+-- | Create a new key-only fact in a 'NewFact' monad.
+makeFact_
+  :: forall p m. (Predicate p, ValueType p ~ (), NewFact m)
+  => KeyType p -> m ()
+makeFact_ key = makeFactV_ @p key ()
+
+-- | A collection of facts which can be written to and then serialized.
+data Facts = Facts
+  { factsPredicates :: Predicates
+  , factsData :: FactSet
+  , factsOwnership :: IORef (HashMap Thrift.UnitName [Int64])
+  , factsDerivations :: IORef (HashMap Pid [([Fid],[Fid])])
+  }
+
+-- | Create a new empty collection of facts. New facts will be assigned
+-- ids >= start id if a start id is supplied; otherwise, they will be
+-- assigned ids which are guaranteed not to clash with any pids in the
+-- 'Predicates' map.
+newFacts
+  :: Predicates -- ^ pid map
+  -> Maybe Fid -- ^ start id
+  -> IO Facts
+newFacts ps start =
+  Facts ps
+    <$> FactSet.new (fromMaybe lowestFid start)
+    <*> newIORef HashMap.empty
+    <*> newIORef HashMap.empty
+
+-- | Serialize the facts into a batch which can be sent via Thrift.
+serializeFacts :: Facts -> IO Thrift.Batch
+serializeFacts Facts{..} = do
+  batch <- FactSet.serialize factsData
+  ownership <- readIORef factsOwnership
+  derivations <- readIORef factsDerivations
+  return batch
+    { Thrift.batch_owned = fmap Vector.fromList ownership
+    , Thrift.batch_dependencies = HashMap.fromList
+        [ (fromPid pid, map toFactDependencies deps)
+        | (pid, deps) <- HashMap.toList derivations ]
+    }
+  where
+    toFactDependencies :: ([Fid],[Fid]) -> Thrift.FactDependencies
+    toFactDependencies (deps, facts) =
+      Thrift.FactDependencies
+        (Vector.fromList (coerce facts))
+        (Vector.fromList (coerce deps))
+
+-- | Return a rough estimate of how much memory is used by the facts.
+factsMemory :: Facts -> IO Int
+factsMemory = FactSet.factMemory . factsData
+
+-- | A monad for creating fact batches.
+--
+-- We expose 'MonadFail' to avoid needing 'error'.
+--
+-- NOTE: This is very specifically not an instance of MonadIO or
+-- MonadTrans as we want to restrict side effects just to fact creation.
+newtype FactsM a = FactsM { runFactsM :: ReaderT Facts IO a }
+  deriving(Functor,Applicative,Monad,MonadFail)
+
+instance NewFact FactsM where
+  newFact key value = FactsM $ do
+    facts <- ask
+    lift $ withBuilder $ \builder -> do
+      buildRtsValue builder key
+      key_size <- sizeOfBuilder builder
+      buildRtsValue builder value
+      mk facts $ \pid -> IdOf <$> defineFact
+        (factsData facts)
+        (pidOf pid)
+        builder
+        key_size
+      where
+        mk :: Predicate p => Facts -> (PidOf p -> f (IdOf p)) -> f (IdOf p)
+        mk facts f = f $ getPid $ factsPredicates facts
+
+  withUnit unit build = FactsM $ do
+    Facts{..} <- ask
+    firstId <- liftIO $ firstFreeId factsData
+    a <- runFactsM build
+    lastId <- liftIO $ firstFreeId factsData
+    when (lastId > firstId) $ liftIO $
+      modifyIORef' factsOwnership $
+        HashMap.insertWith (++) unit
+          [fromFid firstId, fromFid lastId - 1]
+    return a
+
+  derivedFrom :: forall p. Predicate p => [Fid] -> [p] -> FactsM ()
+  derivedFrom deps facts = FactsM $ do
+    Facts{..} <- ask
+    let pid = pidOf (getPid factsPredicates :: PidOf p)
+    liftIO $ modifyIORef' factsDerivations $
+        HashMap.insertWith (<>) pid [(deps, map (idOf . getId) facts)]
+
+-- | A fact builder
+type FactBuilder = forall m. NewFact m => m ()
+
+-- | Run a fact builder to produce facts based on the supplied
+-- 'Predicates' map. The facts will be assigned ids >= start id if a
+-- start id is supplied; otherwise, they will be assigned ids which are
+-- guaranteed not to clash with any pids in the 'Predicates' map.
+buildFacts
+  :: Predicates -- ^ pid map
+  -> Maybe Fid -- ^ start id
+  -> FactBuilder -- ^ builder
+  -> IO Facts
+buildFacts ps start builder = do
+  facts <- newFacts ps start
+  runReaderT (runFactsM builder) facts
+  return facts
+
+extendFacts :: Facts -> FactBuilder -> IO ()
+extendFacts facts builder = runReaderT (runFactsM builder) facts
+
+-- | Run a fact builder and produce a batch of facts based on
+-- the supplied 'Predicates' map. The facts will be assigned
+-- ids >= start id if a start id is supplied; otherwise, they will be
+-- assigned ids which are guaranteed not to clash with any pids in the
+-- 'Predicates' map.
+buildBatch
+  :: Predicates -- ^ pid map
+  -> Maybe Fid -- ^ start id
+  -> FactBuilder -- ^ builder
+  -> IO Thrift.Batch
+buildBatch ps start builder =
+  serializeFacts =<< buildFacts ps start builder
diff --git a/glean/hs/Glean/Typed/Fact.hs b/glean/hs/Glean/Typed/Fact.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Fact.hs
@@ -0,0 +1,66 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Typed.Fact
+  ( decodeFact
+  , decodeRef
+  ) where
+
+import Control.Exception
+import Control.Monad.IO.Class
+import Data.Dynamic
+import qualified Data.IntMap as IntMap
+import Data.IORef
+import Data.IntMap (IntMap)
+
+import Glean.Typed.Build
+import Glean.Typed.Binary
+import Glean.Typed.Id
+import Glean.Typed.Predicate
+import Glean.Types as Thrift
+
+-- | Decode a serialized fact, possibly with nested facts
+decodeFact
+  :: (Predicate p, MonadIO m)
+  => IntMap Thrift.Fact               -- ^ serialized nested facts
+  -> IORef (IntMap Dynamic)           -- ^ cached deserialized facts
+  -> IdOf p                           -- ^ Id of fact to decode
+  -> Thrift.Fact                      -- ^ fact to decode
+  -> m p
+{-# INLINE decodeFact #-}
+decodeFact serialized cache fid (Thrift.Fact _pid k v) = mkFact fid
+  <$> (Just <$> decodeWithCache serialized cache decodeRtsValue k)
+  <*> (Just <$> case constantRtsValue of
+    Just val -> return val
+    Nothing -> decodeWithCache serialized cache decodeRtsValue v)
+
+-- | Decode a fact reference inside a fact.
+--
+-- * If the nested fact is in the cache, then return it
+-- * If the serialized fact is available, we decode it and add it to the cache
+-- * Otherwise, we simply construct the empty fact with 'justId'.
+--
+decodeRef
+  :: forall p. (Predicate p, Typeable p)
+  => Decoder p
+decodeRef = Decoder $ \env@DecoderEnv{..} -> do
+  (fid :: IdOf p) <- runDecoder decodeRtsValue env
+  cache <- liftIO $ readIORef cacheRef
+  let id = fromIntegral (fromFid (idOf fid))
+  case IntMap.lookup id cache of
+    Just dyn
+      | Just p <- fromDynamic dyn -> return p
+      | otherwise -> liftIO $ throwIO $ ErrorCall "decodeRef: wrong type"
+    Nothing -> do
+      case IntMap.lookup id serialized of
+        Nothing -> return (justId fid)
+        Just fact -> do
+          f <- decodeFact serialized cacheRef fid fact
+          liftIO $ modifyIORef' cacheRef $ \cache ->
+            IntMap.insert id (toDyn f) cache
+          return f
diff --git a/glean/hs/Glean/Typed/Id.hs b/glean/hs/Glean/Typed/Id.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Id.hs
@@ -0,0 +1,41 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- Note: UnboxedTuples needed for deriving Prim
+{-# LANGUAGE GeneralizedNewtypeDeriving, UnboxedTuples #-}
+  -- | This does not import Glean modules at all
+module Glean.Typed.Id
+  ( -- * Id-like
+    Pid(..), Fid(..)
+  , PidOf(..), IdOf(..)
+) where
+
+import Control.DeepSeq
+import Data.Hashable (Hashable)
+import Compat.Prettyprinter (Pretty(..))
+import Data.Vector.Primitive (Prim)
+import Foreign.Storable (Storable)
+
+import Glean.RTS.Types
+
+-- -----------------------------------------------------------------------------
+
+-- | Tie the Pid to a predicate phantom type 'p'.
+newtype PidOf p = PidOf { pidOf :: Pid }
+  deriving(Eq, Ord, Show)
+
+instance Pretty (PidOf p) where
+  pretty (PidOf p) = pretty p
+
+-- | Id of a fact of a given predicate type 'p' (phantom type parameter).
+-- Note: This is not the Id/Fid/Pid of the definition of predicate 'p'.
+newtype IdOf p = IdOf { idOf :: Fid }
+  deriving(Eq, Ord, Show, Hashable, NFData, Storable, Prim)
+
+instance Pretty (IdOf p) where
+  pretty (IdOf f) = pretty f
diff --git a/glean/hs/Glean/Typed/Predicate.hs b/glean/hs/Glean/Typed/Predicate.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Predicate.hs
@@ -0,0 +1,156 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+
+-- | Support for working with Thrift-generated predicate types
+module Glean.Typed.Predicate
+  ( -- * class Predicate
+    Predicate(..)
+  , justId
+  , predicateRef
+  , predicateSourceType
+    -- * Lookup PidOf
+  , HasPredicates(..)
+    -- ** exception
+  , MissingPredicate(..), throwMissingPredicate
+    -- * Vector Predicates
+  , Predicates, SchemaPredicates, makePredicates
+  ) where
+
+import Control.Concurrent
+import Control.Exception
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.IORef
+import qualified Data.Map as Map
+import Data.Proxy
+import Data.Text (Text)
+import Data.Vector.Primitive (Vector)
+import qualified Data.Vector.Primitive as Vector
+import System.IO.Unsafe
+import TextShow
+
+import Glean.RTS.Types (invalidPid)
+import qualified Glean.Schema.Util as Angle
+import Glean.Types (PredicateRef(..), SchemaInfo(..))
+import Glean.Typed.Binary
+import Glean.Typed.Id
+import qualified Glean.Angle.Types as Angle
+
+-- -----------------------------------------------------------------------------
+
+-- | 'Predicate' provides information about the schema's data structures,
+-- and convenience functions.
+--
+-- * Types
+--     * @'KeyType' Foo@ : the generated type (often @Foo_key*) that
+--       stores the predicate's fields.
+--     * @'ValueType' Foo@ : the generated values type, defaults to @()@.
+-- * Methods
+--     * @'getName' Foo@ : the @glean.thrift@ derived 'PredicateRef' holding
+--       the Text name and Int version of the predicate.
+--     * @'getIndex' Foo@ : internal use, index into all schema predicate list.
+--       Used to efficiently lookup @'T.PidOf' p@ for a particular repo.
+--
+-- Superclass constraint of 'BT.Type' ensures this can be serialized into
+-- the underlying binary format.
+
+class (Type p, Type (KeyType p), Type (ValueType p)) => Predicate p where
+  type KeyType p
+  type ValueType p
+  type ValueType p = ()
+  getName :: proxy p -> PredicateRef
+  mkFact :: IdOf p -> Maybe (KeyType p) -> Maybe (ValueType p) -> p
+  getId :: p -> IdOf p
+  getFactKey :: p -> Maybe (KeyType p)
+  getFactValue :: p -> Maybe (ValueType p)
+
+  -- A unique integer per predicate, used for fast lookup of Pids when
+  -- writing facts.
+  getIndex :: proxy p -> PredicateIndex
+  getIndex = const (predicateIndex (getName (Proxy :: Proxy p)))
+    -- this should be computed once and cached per predicate type
+
+-- | Retrieve the Angle representation of the type
+predicateSourceType :: Predicate p => Proxy p -> Angle.SourceType' ()
+predicateSourceType proxy =
+  Angle.PredicateTy () (Angle.convertRef (getName proxy))
+
+justId :: Predicate p => IdOf p -> p
+justId x = mkFact x Nothing Nothing
+
+newtype MissingPredicate = MissingPredicate PredicateRef deriving(Show)
+instance Exception MissingPredicate
+
+-- | Useful error for 'getPid' in 'HasPredicates'
+throwMissingPredicate :: forall p. Predicate p => PidOf p
+throwMissingPredicate = throw $ MissingPredicate $ getName (Proxy :: Proxy p)
+
+-- | An index into the Predicates vector. Used when writing facts only.
+type PredicateIndex = Int
+
+newtype Predicates = Predicates (Vector Pid)
+  -- invalidPid for predicates missing from the schema
+
+-- | Class of values 'a' that have definitions for any predicate 'p'
+class HasPredicates a where
+  getPid :: Predicate p => a -> PidOf p
+
+instance HasPredicates Predicates where
+  getPid = get
+    where
+      get :: forall p. Predicate p => Predicates -> PidOf p
+      get (Predicates pids)
+        | pid /= invalidPid = PidOf pid
+        | otherwise = throw $ MissingPredicate $ getName (Proxy :: Proxy p)
+        where
+          index = getIndex (Proxy :: Proxy p)
+          pid = if index < Vector.length pids
+            then pids Vector.! index
+            else invalidPid
+
+-- | The type of @allPredicates@ generated for each schema. To get this,
+-- import the generated module for the schema, e.g. @Glean.Schema.Src@.
+type SchemaPredicates = [PredicateRef]
+
+predicateIndex :: PredicateRef -> Int
+predicateIndex ref =
+  unsafeDupablePerformIO $ do
+    modifyMVar predicateIndices $ \hm ->
+      case HashMap.lookup ref hm of
+        Nothing -> do
+          n <- atomicModifyIORef' predicateNextIndex (\x -> (x+1, x+1))
+          return (HashMap.insert ref n hm, n)
+        Just n -> return (hm, n)
+
+{-# NOINLINE predicateIndices #-}
+predicateIndices :: MVar (HashMap PredicateRef Int)
+predicateIndices = unsafePerformIO $ newMVar HashMap.empty
+
+{-# NOINLINE predicateNextIndex #-}
+predicateNextIndex :: IORef Int
+predicateNextIndex = unsafePerformIO $ newIORef 0
+
+makePredicates :: [SchemaPredicates] -> SchemaInfo -> Predicates
+makePredicates schemas info = Predicates $
+  (Vector.//) (Vector.replicate (maxIx+1) invalidPid) assocs
+  where
+    maxIx = maximum $ map fst assocs
+    assocs =
+      [ (predicateIndex ref, HashMap.lookupDefault invalidPid ref ref_ids)
+      | ref <- concat schemas
+      ]
+    ref_ids = HashMap.fromList
+      [(ref, Pid id) | (id,ref) <- Map.toList $ schemaInfo_predicateIds info]
+
+-- | Convert a predicate type to a versioned predicate name. This is
+-- useful for building Angle queries that refer to specific versions.
+predicateRef :: forall p proxy . Predicate p => proxy p -> Text
+predicateRef _ = name <> "." <> showt version
+  where !(PredicateRef name version) = getName (Proxy @p)
diff --git a/glean/hs/Glean/Typed/Prim.hs b/glean/hs/Glean/Typed/Prim.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Typed/Prim.hs
@@ -0,0 +1,24 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+-- | Support for base types
+module Glean.Typed.Prim
+  ( fromNat, toNat,
+  ) where
+
+import Data.Word
+
+import Glean.Types
+
+
+fromNat :: Nat -> Word64
+fromNat = fromIntegral . unNat
+
+toNat :: Word64 -> Nat
+toNat = Nat . fromIntegral
diff --git a/glean/hs/Glean/Write/Async.hs b/glean/hs/Glean/Write/Async.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/Async.hs
@@ -0,0 +1,271 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Write.Async (
+  Sender, SendQueueSettings(..), SendQueueEvent(..), withSender,
+  senderQueue,
+  Writer, WriterSettings(..), WriterEvent(..),
+  withWriter, withWriters, writeFacts,
+  withBatchWriter,
+  basicWriter
+) where
+
+import Control.Applicative
+import Control.Concurrent.Async
+import Control.Concurrent.MVar
+import Control.Exception
+import Control.Monad
+import Data.Default
+import Data.Maybe
+
+import Util.STM
+import Util.Time
+
+import Glean.Backend.Types (Backend)
+import qualified Glean.Backend.Types as Backend
+import Glean.RTS as RTS
+import Glean.Typed.BuildFact
+import Glean.Typed.Predicate
+import qualified Glean.Types as Thrift
+import Glean.Write.SendQueue
+import Glean.Util.Some
+
+
+-- | An asynchronous batch sender. Can be interacted with via a 'Writer'.
+data Sender = Sender
+  { senderQueue :: SendQueue
+  , senderPredicates :: Predicates
+  , senderBackend :: Some Backend
+  , senderRepo :: Thrift.Repo
+  }
+
+instance HasPredicates Sender where
+  getPid = getPid . senderPredicates
+
+-- | Create an asynchronous 'Sender', run an action and wait until the sender
+-- finished sending all batches. The 'Sender' is only usable within the action
+-- but is thread safe. Any communication errors will be raised as exceptions.
+--
+-- A 'Sender' wraps a 'SendQueue', so 'withSender' takes
+-- 'SendQueueSettings' to manage its behaviour.
+withSender
+  :: (Backend be)
+  => be
+  -> Thrift.Repo
+  -> [SchemaPredicates]
+  -> SendQueueSettings
+  -> (Sender -> IO a)
+  -> IO a
+withSender backend repo proxy settings action = do
+  predicates <- Backend.loadPredicates backend repo proxy
+  withSendQueue backend repo settings $ \q ->
+    action Sender
+      { senderQueue = q
+      , senderPredicates = predicates
+      , senderBackend = Some backend
+      , senderRepo = repo
+      }
+
+-- | An event that happens in a 'Writer' and can be logged
+data WriterEvent
+  =
+    -- | Writer is pushing a patch to the sender
+    WriterPushing Thrift.Batch
+
+    -- | Writer is stalling due to the send queue being full
+  | WriterStalling
+
+    -- | Writer is resuming after having stalled previously
+  | WriterResuming
+      DiffTimePoints -- time spent stalled
+
+-- | 'Writer' settings
+data WriterSettings = WriterSettings
+  { -- | Maximum size of a batch the write can accumulate before pushing it
+    -- to the 'Sender' (soft limit)
+    writerMaxSize :: !Int
+
+    -- | Function called whenever a 'WriterEvent' occurs
+  , writerLog :: WriterEvent -> IO ()
+  }
+
+instance Show WriterSettings where
+  show _ = "WriterSettings{}"
+
+instance Default WriterSettings where
+  def = WriterSettings
+    { writerMaxSize = 30000000
+    , writerLog = const $ return ()
+    }
+
+-- | An asynchronous writer. It accumulates facts (via 'writeFacts') into
+-- batches and pushes those batches to the underlying 'Sender' when they reach
+-- a certain size.  Alternatively, the 'WriterContext' holds the 'Predicates'
+-- and 'withBatchWriter' produces a single 'Batch' for regression testing.
+--
+-- NOTE: Writers serialise all writes - if you want to produce facts in
+-- parallel, use multiple writers.
+data Writer = Writer
+  { writerPredicates :: !Predicates
+  , writerSender :: Maybe Sender
+  , writerFirstId :: !Fid
+  , writerFacts :: !(MVar Facts)
+  , writerSettings :: WriterSettings
+  }
+
+instance HasPredicates Writer where
+  getPid = getPid . writerPredicates
+
+newWriter :: Sender -> WriterSettings -> IO Writer
+newWriter s settings = do
+  Thrift.FactIdRange { factIdRange_finish = finish } <-
+    Backend.factIdRange (senderBackend s) (senderRepo s)
+  let first_id = Fid finish
+  v <- newMVar =<< newFacts (senderPredicates s) (Just first_id)
+  return Writer
+    { writerPredicates = senderPredicates s
+    , writerSender = Just s
+    , writerFirstId = first_id
+    , writerFacts = v
+    , writerSettings = settings
+    }
+
+newWriterFromPredicates :: Predicates -> Fid -> WriterSettings -> IO Writer
+newWriterFromPredicates ps firstId settings = do
+  v <- newMVar =<< newFacts ps (Just firstId)
+  return Writer
+    { writerPredicates = ps
+    , writerSender = Nothing
+    , writerFirstId = firstId
+    , writerFacts = v
+    , writerSettings = settings
+    }
+
+-- Helper type for the @action@ passed to 'maybeFlush'
+data MaybeFlush = DoNotFlushFacts | FlushFacts
+  deriving (Eq)
+
+flushWriter :: Writer -> Callback -> IO ()
+flushWriter w callback = maybeFlush w callback $ const $ return FlushFacts
+
+-- | Create a new 'Writer' based on the given 'Sender'. The facts created
+-- by the 'Writer' will have fact ids which are guaranteed not to clash with
+-- any facts already in the database at the point the 'Writer' is created. At
+-- the end, the function will wait until all batches have been delivered to
+-- and acknowledged by the server. This means that any subsequent queries will
+-- return the facts produced by the 'Writer'.
+withWriter :: Sender -> WriterSettings -> (Writer -> IO a) -> IO a
+withWriter s settings action = do
+  w <- newWriter s settings
+  result <- action w
+  done <- newEmptyTMVarIO
+  flushWriter w (void . tryPutTMVar done)
+  r <- atomically $ readTMVar done
+  case r of
+    Right _subst -> return result
+    Left exc -> throwIO exc
+
+-- | Create many Writers for writing to a sender in parallel. Use this
+-- instead of `withMany withWriter`, because it will flush the writers
+-- in parallel rather than sequentially at the end.
+withWriters :: Sender -> WriterSettings -> Int -> ([Writer] -> IO a) -> IO a
+withWriters  s settings n action = do
+  ws <- replicateM n $ newWriter s settings
+  result <- action ws
+  forConcurrently_ ws $ \w -> do
+    done <- newEmptyTMVarIO
+    flushWriter w (void . tryPutTMVar done)
+    r <- atomically $ readTMVar done
+    case r of
+      Right _subst -> return ()
+      Left exc -> throwIO exc
+  return result
+
+-- | Create a new 'Writer' for regression testing.  This accumulates into
+-- a single 'Facts' and produces a single 'Batch' without sending to a backend.
+withBatchWriter
+  :: (Backend be)
+  => be
+  -> Thrift.SchemaId
+  -> Maybe Fid
+    --  ^ starting fact ID to create. If the batch will be added to an
+    -- existing DB and the indexer will be creating facts that refer
+    -- to facts from the DB, this should be obtained by calling
+    -- 'firstFreeId' on the DB; otherwise it can be 'Nothing'.
+  -> WriterSettings
+  -> (Writer -> IO a)
+  -> IO (a, Thrift.Batch)
+withBatchWriter backend schemaId firstId settings action = do
+  ps <- Backend.loadPredicatesForSchema backend schemaId
+  w <- newWriterFromPredicates ps (fromMaybe lowestFid firstId) settings
+  result <- action w
+  facts <- takeMVar (writerFacts w)
+  batch <- serializeFacts facts
+  return (result, batch { Thrift.batch_schema_id = Just schemaId })
+
+-- | Write a bunch of facts to a 'Writer'. If the accumulated batch goes over
+-- the threshold (cf. 'writerMaxSize') the batch will be pushed to the 'Sender'.
+--
+-- Because 'FactBuilder' uses a forall so as not to expose 'IO' (or similar),
+-- fact ids created while running 'FactBuilder' are local to one call of
+-- 'writeFacts' and cannot be saved or reused later.
+writeFacts :: Writer -> FactBuilder -> IO ()
+writeFacts w builder = maybeFlush w (const $ return ()) $ \facts -> do
+  extendFacts facts builder
+  mem <- factsMemory facts
+  return $ if mem > writerMaxSize (writerSettings w)
+    then FlushFacts
+    else DoNotFlushFacts
+
+-- @'maybeFlush' w calback action@ without a 'Sender' is used merely
+-- runs the @action@ and @callback is ignored.
+--
+-- With a 'Sender' this checks 'MaybeFlush' and if the result is 'FlushFacts'
+-- will write to the 'Sender' queue and execute the @callback@ , and if the
+-- result is 'DoNotFlushFacts' the @callback@ is ignored.
+maybeFlush :: Writer -> Callback -> (Facts -> IO MaybeFlush) -> IO ()
+maybeFlush w callback action = modifyMVar_ (writerFacts w) $ \facts -> do
+  flush <- action facts
+  case writerSender w of
+    Just sender | flush == FlushFacts -> do
+      new_facts <- newFacts (writerPredicates w) (Just $ writerFirstId w)
+      batch <- addSchemaId sender <$> serializeFacts facts
+      writerLog (writerSettings w) $ WriterPushing batch
+      let write = writeSendQueue (senderQueue sender) batch callback
+      -- NOTE: Yes, we're intentionally blocking inside modifyMVar_
+      ok <- atomically $ (write >> return True) <|> return False
+      when (not ok) $ do
+        writerLog (writerSettings w) WriterStalling
+        start <- getTimePoint
+        atomically write
+        elapsed <- getElapsedTime start
+        writerLog (writerSettings w) $ WriterResuming elapsed
+      return new_facts
+
+    _ -> return facts
+
+-- If we add our schema ID to the batch, the server will check that it
+-- matches the DB's schema, so we can catch schema mismatches before
+-- we get (de)serialization errors.
+addSchemaId :: Sender -> Thrift.Batch -> Thrift.Batch
+addSchemaId Sender{..} batch =
+  batch { Thrift.batch_schema_id = Backend.schemaId senderBackend }
+
+-- | Write facts to a Repo using an asynchronous sender, with all the
+-- default settings.
+basicWriter
+  :: (Backend be)
+  => be
+  -> Thrift.Repo
+  -> [SchemaPredicates]
+  -> FactBuilder
+  -> IO ()
+basicWriter backend repo proxy builder =
+  withSender backend repo proxy def $ \sender ->
+  withWriter sender def $ \writer ->
+  writeFacts writer builder
diff --git a/glean/hs/Glean/Write/Options.hs b/glean/hs/Glean/Write/Options.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/Options.hs
@@ -0,0 +1,123 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Glean.Write.Options
+  ( sendQueueOptions
+  , sendAndRebaseQueueOptions
+  , writerOptions
+  ) where
+
+import Control.Exception
+import qualified Data.ByteString as B
+import Data.Default (def)
+import qualified Options.Applicative as O
+import System.IO
+import Text.Printf
+
+import Thrift.Protocol.Compact
+import Util.Log
+
+import Glean.Write.Async (WriterSettings(..), WriterEvent(..))
+import Glean.Write.SendQueue (SendQueueSettings(..))
+import Glean.Write.SendAndRebaseQueue (SendAndRebaseQueueSettings(..))
+import Glean.Util.RetryChannelException
+
+
+sendQueueOptions :: O.Parser SendQueueSettings
+sendQueueOptions = do
+  sendQueueThreads <- O.option O.auto $
+    O.long "sender-threads"
+    <> O.metavar "N"
+    <> O.value 1
+    <> O.showDefault
+    <> O.help "number of concurrent sender threads"
+  sendQueueMaxMemory <- O.option O.auto $
+    O.long "max-send-queue-size"
+    <> O.metavar "N"
+    <> O.value 2000000000
+    <> O.showDefault
+    <> O.help "maximum size of send queue (in bytes)"
+  sendQueueMaxBatches <- O.option O.auto $
+    O.long "max-send-queue-batches"
+    <> O.metavar "N"
+    <> O.value 1024
+    <> O.showDefault
+    <> O.help "maximum number of batches in send queue"
+  sendQueueRetry <- fmap toRetryPolicy $ O.option O.auto $
+    O.long "send-retries"
+    <> O.metavar "N"
+    <> O.value 20
+    <> O.showDefault
+    <> O.help "number of retries"
+  return def
+    { sendQueueThreads
+    , sendQueueMaxMemory
+    , sendQueueMaxBatches
+    , sendQueueRetry
+    }
+  where
+  toRetryPolicy n = defaultRetryPolicy { maxRetries = n }
+
+
+sendAndRebaseQueueOptions :: O.Parser SendAndRebaseQueueSettings
+sendAndRebaseQueueOptions = do
+  sendAndRebaseQueueSendQueueSettings <- sendQueueOptions
+  sendAndRebaseQueueFactCacheSize <- O.option O.auto $
+    O.long "fact-cache-size"
+    <> O.metavar "N"
+    <> O.value 2000000000
+    <> O.showDefault
+    <> O.help "size of the cache for sent facts"
+  sendAndRebaseQueueFactBufferSize <- O.option O.auto $
+    O.long "fact-buffer-size"
+    <> O.metavar "N"
+    <> O.value (200*1000*1000)
+    <> O.showDefault
+    <> O.help "size of the buffer for unsent facts per sender"
+  return SendAndRebaseQueueSettings
+    { sendAndRebaseQueueSendQueueSettings
+    , sendAndRebaseQueueFactCacheSize
+    , sendAndRebaseQueueFactBufferSize
+    , sendAndRebaseQueueSenders =
+        sendQueueThreads sendAndRebaseQueueSendQueueSettings
+    , sendAndRebaseQueueAllowRemoteReferences = False
+    , sendAndRebaseQueueStats = Nothing
+    }
+
+
+writerOptions :: O.Parser WriterSettings
+writerOptions = do
+  writerMaxSize <- O.option O.auto $
+    O.long "max-batch-size"
+    <> O.metavar "N"
+    <> O.value 30000000
+    <> O.showDefault
+    <> O.help "maximum size of Thrift batch (in bytes)"
+  writerDump <- O.optional $ O.strOption $
+    O.long "dump-batches"
+    <> O.metavar "DIR"
+    <> O.help ("also dump all batches in binary format to DIR. " <>
+      "The files can be used with 'glean write --file-format=binary'")
+  return def
+    { writerMaxSize = writerMaxSize
+    , writerLog = logBatch writerDump
+    }
+  where
+    logBatch dump (WriterPushing batch)
+      | Just dir <- dump = do
+        let serialized = serializeCompact batch
+        bracket
+          (openTempFile dir "batch.bin")
+          (hClose . snd)
+          $ \(f,h) -> do
+            logInfo $ printf "dumping batch (%d bytes) to %s"
+              (B.length serialized) f
+            B.hPut h serialized
+    logBatch _ _ = return ()
diff --git a/glean/hs/Glean/Write/SendAndRebaseQueue.hs b/glean/hs/Glean/Write/SendAndRebaseQueue.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/SendAndRebaseQueue.hs
@@ -0,0 +1,442 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Write.SendAndRebaseQueue
+  ( SendAndRebaseQueueSettings(..)
+  , SendAndRebaseQueue
+  , withSendAndRebaseQueue
+  , writeSendAndRebaseQueue
+  ) where
+
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import qualified Data.ByteString as BS
+import Data.Word
+
+import Util.Log
+import Util.STM
+
+import Glean.Backend.Types (Backend)
+import Glean.FFI (release)
+import qualified Glean.Write.SendQueue as SendQueue
+import Glean.Write.SendQueue (SendQueue)
+import Glean.RTS.Constants (firstAnonId)
+import Glean.Write.Stats as Stats
+import Glean.RTS.Foreign.Define
+import Glean.RTS.Foreign.Ownership
+import Glean.RTS.Foreign.Stacked
+import qualified Glean.RTS.Foreign.Lookup as Lookup
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+import Glean.RTS.Foreign.LookupCache (LookupCache, countFailuresAsMisses)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.FactSet (FactSet)
+import Glean.RTS.Foreign.Inventory (Inventory)
+import Glean.RTS.Foreign.Subst
+import Glean.RTS.Types (Fid(..))
+import Glean.Util.Metric
+import qualified Glean.Types as Thrift
+
+{-
+SendAndRebaseQueue
+------------------
+
+This is a queue for sending facts to a Glean server. It has a couple
+of advantages over using a raw SendQueue:
+
+* The queue avoids sending duplicate facts to the server by performing
+  some de-duplication before sending the data.
+
+* When the input is JSON, the facts are serialized as binary before
+  being sent to the server.
+
+De-duplication
+--------------
+
+De-duplication happens in two ways:
+
+1. Each batch is added to the current fact buffer, and de-duplicatd
+against the facts already in the buffer.
+
+2. The contents of the buffer are sent to the server asynchronously,
+and when the server responds with a substitution (mapping facts in the
+buffer to their real fact IDs) the queue places the renamed facts in a
+cache, which is used to de-duplicate new batches.
+
+Details
+-------
+
+The queue looks like this:
+
+  +-------+     +-------------+
+  | cache |     | fact buffer |
+  +-------+     +-------------+
+
+when a new batch is added (via writeSendAndRebaseQueue), it is added
+to the fact buffer:
+
+                              +---------------+
+                              |   new facts   |
+                              +---------------+
+                              |              /
+                              |   rebase    /
+                              |            /
+  +-------+     +-------------+-----------+
+  | cache |     | fact buffer | new facts |
+  +-------+     +-------------+-----------+
+
+when this happens, any facts in the new batch that duplicate facts in
+the cache or the existing fact buffer are removed.
+
+The fact buffer is sent to the server as a single batch:
+
+  +-------+     +-------------+
+  | cache |     | fact buffer |
+  +-------+     +------+------+
+                       |
+                       v
+                    server
+
+which will later respond with a substitution. When the server
+responds, we will have added more facts to the buffer, so the
+situation is now:
+
+  +-------+     +-------------+-----------+
+  | cache |     | fact buffer | new facts |
+  +-------+     +------+------+-----------+
+                       |
+                       v
+                    server
+
+The server's substitution maps facts in the buffer to their real fact
+IDs. At this point we rename the fact buffer using the substitution,
+and move those facts into the cache, leaving the fact buffer
+containing just the new facts:
+
+  +-------+-------------+    +-----------+
+  | cache | fact buffer |    | new facts |
+  +-------+-------------+    +-----------+
+
+The new facts are then sent to the server:
+
+  +-------+-------------+    +-----------+
+  | cache | fact buffer |    | new facts |
+  +-------+-------------+    +-----+-----+
+                                   |
+                                   v
+                                server
+
+so over time we build up a cache of facts from the server:
+essentially a cache of part of the DB, and use it to avoid sending
+facts that are already in the DB, thereby reducing the amount of data
+we send to the server.
+
+All of this is subject to limits:
+
+- sendAndRebaseQueueFactCacheSize: a limit on the size of the cache
+  (we drop old entries according to an eviction policy)
+
+- sendAndRebaseQueueFactBufferSize: A limit on the size of the fact
+  buffer (writers will wait for the server to respond if the buffer is
+  full)
+
+Threads and SendQueue
+---------------------
+
+The fact buffer is a bottleneck if multiple threads are writing
+simultaneously. To avoid that, we can have multiple fact buffers that
+share a cache: this is done by setting sendAndRebaseQueueThreads to a
+value higher than 1.
+
+SendAndRebaseQueue is built on top of SendQueue, which manages sending
+the individual batches to the server, retrying and resending as
+necessary. SendQueue is automatically configured to use the same
+number of sender threads as SendAndRebaseQueue, to parallelise the
+sending.
+-}
+
+
+-- | When the send operation fails or is completed this is called once.
+type Callback = Either SomeException () -> STM ()
+
+data WaitSubst
+  = WaitSubstNone
+  | WaitSubstError SomeException
+  | WaitSubstSuccess Thrift.Subst
+
+data Sender = Sender
+  { sId :: Integer
+  , sSubstVar :: TMVar WaitSubst
+  , sSent :: TVar Point
+    -- ^ Records the size and time the last batch was sent, for stats
+  , sFacts :: MVar (FactSet, [FactOwnership])
+    -- ^ [Ownership] is the ownership assignments for facts in the FactSet
+  , sCallbacks :: TQueue Callback
+  }
+
+data SendAndRebaseQueue = SendAndRebaseQueue
+  { srqSendQueue :: !SendQueue
+    -- ^ Underlying send queue
+
+  , srqSenders :: TQueue Sender
+    -- ^ Senders accumulate facts while waiting for a substitution
+
+  , srqInventory :: !Inventory
+    -- ^ Schema inventory (used for rebasing)
+
+  , srqFacts :: !LookupCache
+    -- ^ Cache the ids of facts stored on the server
+
+  , srqCacheStats :: !LookupCache.Stats
+    -- ^ Stats for the Lookup cache
+
+  , srqStats :: Maybe Stats
+    -- ^ How to report stats.
+
+  , srqFactBufferSize :: !Int
+    -- ^ Max size of fact buffer
+  }
+
+-- | Settings for a 'SendAndRebase'
+data SendAndRebaseQueueSettings = SendAndRebaseQueueSettings
+  { -- | Settings for the underlying send queue
+    sendAndRebaseQueueSendQueueSettings :: !SendQueue.SendQueueSettings
+
+    -- | Max memory that the fact cache should use
+  , sendAndRebaseQueueFactCacheSize :: !Int
+
+    -- | Max memory that the fact buffer should use (per sender). The
+    -- purpose of this limit is to prevent the buffer from growing
+    -- without bound if the server's write queue is full. When the
+    -- buffer exceeds this limit, writers will start waiting for the
+    -- server. Note that the limit is per sender.
+  , sendAndRebaseQueueFactBufferSize :: !Int
+
+    -- | Number of senders
+  , sendAndRebaseQueueSenders :: !Int
+
+    -- | Allow facts in the batch to make reference to facts in the remote
+    -- server that may not be in the local cache.
+  , sendAndRebaseQueueAllowRemoteReferences :: Bool
+
+    -- | How to log stats. Obatin this with 'Glean.Write.Stats.new'.
+  , sendAndRebaseQueueStats :: Maybe Stats
+  }
+
+-- | Add a new batch to the fact buffer, de-duplicating against the
+-- buffer and the cache.
+rebase
+  :: Inventory
+  -> Thrift.Batch
+  -> LookupCache
+  -> FactSet.FactSet
+  -> IO (FactSet.FactSet, FactOwnership)
+rebase inventory batch cache base = do
+  LookupCache.withCache Lookup.EmptyLookup cache LookupCache.FIFO $ \cache -> do
+    -- when there are multiple senders, the cache may have new facts since
+    -- we previously rebased, and it may contain fact IDs that overlap with
+    -- the current base. So we have to use a snapshot of the cache, restricted
+    -- to fact IDs less than the current base startingId.
+    first_id <- Lookup.startingId base
+    Lookup.withSnapshot cache first_id $ \snapshot -> do
+      factSet <- Lookup.firstFreeId base >>= FactSet.new
+      let define = snapshot `stacked` base `stacked` factSet
+      subst <- defineBatch define inventory batch DefineFlags
+        { trustRefs = True
+        , ignoreRedef = True  -- see Note [redefinition]
+        }
+      owned <- substOwnership subst $
+        FactOwnership $ Thrift.batch_owned batch
+      return (factSet, owned)
+
+{- Note [redefinition]
+
+Redefinition is when we have two facts A->B, C->D where A == C but B /= D.
+
+Normally this would be an error, and defineBatch rejects it with an
+error. But it can arise naturally here because when
+typechecking/rebasing A->B we may have used a different cache from
+when we typechecked/rebased C->D. So even though B and D may be
+semantically identical, they are literally different.
+
+It doesn't seem possible to ensure that we always use a consistent
+cache, so it's inevitable that benign fact redefinitions may
+occur. Therefore we ignore redefinitions in `defineBatch`.
+
+Note: this might mean that we are ignoring actual errors and silently
+picking one of the two facts if they really did differ. That's bad,
+but I don't see an alternative.
+
+-}
+
+-- | Send the current fact buffer to the server
+senderFlush :: SendAndRebaseQueue -> Sender -> IO ()
+senderFlush srq sender = modifyMVar_ (sFacts sender) $ \(facts, owned) -> do
+  factOnlyBatch <- FactSet.serialize facts
+  let batch = factOnlyBatch {
+        Thrift.batch_owned = ownershipUnits (unionOwnership owned) }
+  !size <- FactSet.factMemory facts
+  start <- beginTick (fromIntegral size)
+  atomically $ do
+    callbacks <- flushTQueue (sCallbacks sender)
+    SendQueue.writeSendQueue (srqSendQueue srq) batch $ \result -> do
+      case result of
+        Right subst -> putTMVar (sSubstVar sender) (WaitSubstSuccess subst)
+        Left e -> putTMVar (sSubstVar sender) (WaitSubstError e)
+      forM_ callbacks ($ void result)
+    writeTVar (sSent sender) start
+  return (facts, [])
+
+-- | If the server has returned a substutition, rebase the current
+-- fact buffer against it. Send the current fact buffer to the server,
+-- unless we're already waiting for a substitution.
+senderRebaseAndFlush :: Bool -> SendAndRebaseQueue -> Sender -> IO ()
+senderRebaseAndFlush wait srq sender = do
+  maybeSubst <- atomically $
+    if wait then
+      Just <$> takeTMVar (sSubstVar sender)
+    else
+      tryTakeTMVar (sSubstVar sender)
+  case maybeSubst of
+    Nothing -> do -- waiting on subst
+      log "Waiting on substitution from server"
+      return ()
+    Just (WaitSubstError e) -> do
+      log "Send failure"
+      atomically $ putTMVar (sSubstVar sender) (WaitSubstError e)
+      throwIO e
+    Just WaitSubstNone -> do -- first send
+      log "Sending first batch"
+      senderFlush srq sender
+    Just (WaitSubstSuccess thriftSubst) -> do -- got subst
+      log "Sending next batch"
+      handle (\(e :: SomeException) -> do
+          logError (show e)
+          atomically $ putTMVar (sSubstVar sender) (WaitSubstError e)
+          throwIO e) $
+        modifyMVar_ (sFacts sender) $ \(base,owned) ->
+          -- eagerly release the subst when we're done
+          bracket (deserialize thriftSubst) release $ \subst -> do
+            (newBase, newSubst) <-
+              FactSet.rebase (srqInventory srq) subst (srqFacts srq) base
+            newOwned <- mapM (substOwnership newSubst) owned
+            return (newBase, newOwned)
+      -- "Commit throughput" will be write throughput to the server
+      start <- readTVarIO (sSent sender)
+      statBump srq Stats.commitThroughput =<< endTick start
+      senderFlush srq sender
+    where log msg = vlog 1 $ "Sender " <> show (sId sender) <> ": " <> msg
+
+updateLookupCacheStats :: SendAndRebaseQueue -> IO ()
+updateLookupCacheStats SendAndRebaseQueue{..} =
+  forM_ srqStats $ \stats -> do
+    statValues <- LookupCache.readStatsAndResetCounters srqCacheStats
+    Stats.bump stats Stats.lookupCacheStats (countFailuresAsMisses statValues)
+
+statTick :: SendAndRebaseQueue -> Bump Tick -> Word64 -> IO a -> IO a
+statTick SendAndRebaseQueue{..} bump val act =
+  case srqStats of
+    Nothing -> act
+    Just stats -> Stats.tick stats bump val act
+
+statBump :: SendAndRebaseQueue -> Bump Tick -> Tick -> IO ()
+statBump SendAndRebaseQueue{..} bump val =
+  case srqStats of
+    Nothing -> return ()
+    Just stats -> Stats.bump stats bump val
+
+senderSendOrAppend
+  :: SendAndRebaseQueue
+  -> Sender
+  -> Thrift.Batch
+  -> Callback
+  -> Point
+  -> IO ()
+senderSendOrAppend srq sender batch callback latency = do
+  -- "Mutator latency" is the latency between calling writeSendAndRebaseQueue
+  -- and having a free Sender to write the batch.
+  statBump srq Stats.mutatorLatency =<< endTick latency
+  let !size = BS.length $ Thrift.batch_facts batch
+  newSize <-
+    -- "Mutator throughput" is how fast we are appending new facts
+    -- to the FactSet.
+    statTick srq Stats.mutatorThroughput (fromIntegral size) $ do
+      modifyMVar (sFacts sender) $ \(base, ownership) -> do
+        (facts, owned) <- rebase (srqInventory srq) batch (srqFacts srq) base
+        FactSet.append base facts
+        atomically $ writeTQueue (sCallbacks sender) callback
+        newSize <- FactSet.factMemory base
+        return ((base, owned : ownership), newSize)
+  updateLookupCacheStats srq
+  let !wait = newSize >= srqFactBufferSize srq
+  senderRebaseAndFlush wait srq sender
+
+withSendAndRebaseQueue
+  :: Backend e
+  => e
+  -> Thrift.Repo
+  -> Inventory
+  -> SendAndRebaseQueueSettings
+  -> (SendAndRebaseQueue -> IO a)
+  -> IO a
+withSendAndRebaseQueue backend repo inventory settings action = do
+  vlog 1 $ "Allow remote refs: " <> show sendAndRebaseQueueAllowRemoteReferences
+  SendQueue.withSendQueue backend repo sendAndRebaseQueueSendQueueSettings $
+    \sendQueue -> do
+      cacheStats <- LookupCache.newStats
+      let cacheSize = fromIntegral sendAndRebaseQueueFactCacheSize
+      srq <- SendAndRebaseQueue
+        <$> pure sendQueue
+        <*> newTQueueIO
+        <*> pure inventory
+        <*> LookupCache.new cacheSize 1 cacheStats
+        <*> pure cacheStats
+        <*> pure sendAndRebaseQueueStats
+        <*> pure sendAndRebaseQueueFactBufferSize
+      bracket_ (createSenderPool srq) (deleteSenderPool srq) $
+        action srq
+    where
+      SendAndRebaseQueueSettings{..} = settings
+      createSenderPool srq =
+        forM_ senderIds $ \i -> do
+          factset <- FactSet.new baseId
+          worker <- Sender i
+            <$> newTMVarIO WaitSubstNone
+            <*> newTVarIO (error "missing sSent")
+            <*> newMVar (factset, [])
+            <*> newTQueueIO
+          atomically $ writeTQueue (srqSenders srq) worker
+      deleteSenderPool srq =
+        forM_ senderIds $ \_i -> do
+          -- don't deadlock here in case we died leaving the queue empty
+          sender <- atomically $ tryReadTQueue (srqSenders srq)
+          forM_ sender $ senderRebaseAndFlush True srq
+      senderIds = take sendAndRebaseQueueSenders [1..]
+
+      baseId = if sendAndRebaseQueueAllowRemoteReferences
+        then firstLocalId
+        else Fid Thrift.fIRST_FREE_ID
+
+      -- Higher than Ids in the remote db to avoid remote fact references
+      -- from being mistaken for local fact references.
+      -- Lower than Ids in JSON batches to avoid references within the
+      -- batch from being mistaken for references to the local db.
+      firstLocalId = Fid (firstAnonId `div` 2)
+
+
+writeSendAndRebaseQueue
+  :: SendAndRebaseQueue
+  -> Thrift.Batch
+  -> Callback
+  -> IO ()
+writeSendAndRebaseQueue srq batch callback = do
+  point <- beginTick 1
+  bracket
+    (atomically $ readTQueue $ srqSenders srq)
+    (\sender -> atomically $ writeTQueue (srqSenders srq) sender)
+    (\sender -> senderSendOrAppend srq sender batch callback point)
diff --git a/glean/hs/Glean/Write/SendBatch.hs b/glean/hs/Glean/Write/SendBatch.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/SendBatch.hs
@@ -0,0 +1,136 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- |
+-- This layer provides synchronous writing on top of the lower-level
+-- asynchronous write API, by doing polling and waiting as necessary.
+--
+module Glean.Write.SendBatch
+  ( sendBatch
+  , sendBatchAsync
+  , sendJsonBatch
+  , sendJsonBatchAsync
+  , sendBatchDescriptor
+  , sendBatchDescriptorAsync
+  , waitBatch
+  ) where
+
+import Control.Exception
+import Data.Default
+import qualified Data.Text as Text
+import System.Time.Extra
+
+import Glean.Backend.Types
+import qualified Glean.Types as Thrift
+
+sendBatch
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> Thrift.Batch
+  -> IO Thrift.Subst
+sendBatch backend repo batch = do
+  handle <- sendBatchAsync backend repo batch
+  waitBatch backend handle
+
+sendBatchAsync
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> Thrift.Batch
+  -> IO Thrift.Handle
+sendBatchAsync backend repo batch = do
+  r <- enqueueBatch backend $ Thrift.ComputedBatch repo True batch
+  case r of
+    Thrift.SendResponse_handle h -> return h
+    Thrift.SendResponse_retry (Thrift.BatchRetry r) ->
+      retry r $ sendBatchAsync backend repo batch
+
+sendJsonBatchAsync
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> [Thrift.JsonFactBatch]
+  -> Maybe Thrift.SendJsonBatchOptions
+  -> IO Thrift.Handle
+sendJsonBatchAsync backend repo batches opts = do
+  r <- try $ enqueueJsonBatch backend repo
+    Thrift.SendJsonBatch
+      { Thrift.sendJsonBatch_batches = batches
+      , Thrift.sendJsonBatch_options = opts
+      , Thrift.sendJsonBatch_remember = True }
+  case r of
+    Right Thrift.SendJsonBatchResponse{..} ->
+      return sendJsonBatchResponse_handle
+    Left Thrift.Retry{..} ->
+      retry retry_seconds $
+        sendJsonBatchAsync backend repo batches opts
+
+sendJsonBatch
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> [Thrift.JsonFactBatch]
+  -> Maybe Thrift.SendJsonBatchOptions
+  -> IO Thrift.Subst
+sendJsonBatch backend repo batches opts = do
+  handle <- sendJsonBatchAsync backend repo batches opts
+  -- Cope with talking to an old server where this API was synchronous
+  -- and didn't return a handle.
+  if Text.null handle
+    then return def
+    else waitBatch backend handle
+
+sendBatchDescriptor
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> Thrift.BatchDescriptor
+  -> IO Thrift.Subst
+sendBatchDescriptor backend repo descriptor = do
+  handle <- sendBatchDescriptorAsync backend repo descriptor
+  if Text.null handle
+    then return def
+    else waitBatch backend handle
+
+sendBatchDescriptorAsync
+  :: Backend be
+  => be
+  -> Thrift.Repo
+  -> Thrift.BatchDescriptor
+  -> IO Thrift.Handle
+sendBatchDescriptorAsync backend repo descriptor = do
+  let batch = Thrift.EnqueueBatch_descriptor descriptor
+  r <- try $ enqueueBatchDescriptor backend repo batch
+    Thrift.EnqueueBatchWaitPolicy_Remember
+  case r of
+    Right Thrift.EnqueueBatchResponse{..} ->
+      return enqueueBatchResponse_handle
+    Left Thrift.Retry{..} ->
+      retry retry_seconds $
+        sendBatchDescriptorAsync backend repo descriptor
+
+retry :: Double -> IO a -> IO a
+retry secs action = do
+  sleep $ max secs 1
+  action
+
+waitBatch
+  :: Backend be
+  => be
+  -> Thrift.Handle
+  -> IO Thrift.Subst
+waitBatch backend handle = do
+  e <- try $ pollBatch backend handle
+  case e of
+    Left Thrift.Retry{..} ->
+      retry retry_seconds $ waitBatch backend handle
+    Right r -> case r of
+      Thrift.FinishResponse_subst subst -> return subst
+      Thrift.FinishResponse_retry (Thrift.BatchRetry r) ->
+        retry r $ waitBatch backend handle
diff --git a/glean/hs/Glean/Write/SendQueue.hs b/glean/hs/Glean/Write/SendQueue.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/SendQueue.hs
@@ -0,0 +1,365 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Write.SendQueue
+  ( SendQueueSettings(..)
+  , SendQueueEvent(..)
+  , SendQueue
+  , Callback
+  , withSendQueue
+  , writeSendQueue
+  , writeSendQueueJson
+  , writeSendQueueDescriptor
+  ) where
+
+import qualified Control.Concurrent.Async as Async
+import Control.Exception
+import Control.Monad
+import qualified Data.ByteString as BS
+import Data.Default
+import System.Time.Extra (sleep)
+import Text.Printf (printf)
+
+import Util.Control.Exception (tryBracket)
+import Util.Log.String
+import Util.STM
+import Util.Time
+
+import Glean.Backend.Types (Backend)
+import Glean.Backend.Retry
+import qualified Glean.Backend.Types as Backend
+import qualified Glean.Types as Thrift
+import Glean.Write.SendBatch
+import Glean.Util.RetryChannelException
+
+
+-- | An event that happens in a 'SendQueue' and can be logged
+data SendQueueEvent
+  = -- | Started sending a batch
+    SendQueueSending Thrift.Batch
+
+    -- | Started sending a JSON batch
+  | SendQueueSendingJson [Thrift.JsonFactBatch]
+
+    -- | Started sending a batch descriptor
+  | SendQueueSendingDescriptor Thrift.BatchDescriptor
+
+    -- | Finished sending a batch
+  | SendQueueSent
+      Int -- batch size
+      DiffTimePoints -- time taken
+
+    -- | Finished sending all batches and shutting down
+  | SendQueueFinished
+
+    -- | Sending failed
+  | SendQueueFailed SomeException
+
+
+data QueueStatus
+  = Open
+  | Closed
+  | Failed SomeException
+
+-- | When the send operation fails or is completed this is called once.
+type Callback = Either SomeException Thrift.Subst -> STM ()
+
+-- | The GleanService can return a Handle for an async operation, and the
+-- client can later poll to determine the actual result/retry/error.
+data Wait = Wait
+  { waitHandle :: !Thrift.Handle  -- ^ handle from GleanService
+  , waitStart :: !TimePoint  -- ^ When this 'Wait' was constructed
+  , waitCallback :: !Callback  -- ^ use-once callback with result.
+  , waitOriginalBatch :: !Batch  -- ^ the batch, so we can resend it
+  }
+
+data Batch
+  = BinaryBatch Thrift.Batch
+  | JsonBatch !Int {- size -} [Thrift.JsonFactBatch]
+  | BatchDescriptor Thrift.BatchDescriptor
+
+batchSize :: Batch -> Int
+batchSize (BinaryBatch bin) = BS.length $ Thrift.batch_facts bin
+batchSize (JsonBatch sz _) = sz
+batchSize (BatchDescriptor _) = 0
+
+data SendQueue = SendQueue
+  { -- | Batches we haven't sent yet
+    sqOutQueue :: TQueue (Batch, Callback)
+
+    -- | Batches we've sent and are now waiting for the server to commit
+  , sqWaitQueue :: TQueue Wait
+
+    -- | Memory used by batches in sqOutQueue and sqWaitQueue
+  , sqMemory :: TVar Int
+
+    -- | Number of batches in flight (in sqOutQueue and sqWaitQueue)
+  , sqCount :: TVar Int
+
+    -- | Limit on sqMemory
+  , sqMaxMemory :: Int
+
+    -- | Limit on sqCount
+  , sqMaxCount :: Int
+
+    -- | Queue status
+  , sqStatus :: TVar QueueStatus
+  }
+
+data WriteQueueClosed = WriteQueueClosed deriving(Show)
+instance Exception WriteQueueClosed
+
+newSendQueue :: Int -> Int -> IO SendQueue
+newSendQueue max_mem max_count = SendQueue
+  <$> newTQueueIO
+  <*> newTQueueIO
+  <*> newTVarIO 0
+  <*> newTVarIO 0
+  <*> pure max_mem
+  <*> pure max_count
+  <*> newTVarIO Open
+
+releaseBatch :: SendQueue -> Int -> STM ()
+releaseBatch sq size = do
+  modifyTVar' (sqCount sq) $ \n -> n - 1
+  modifyTVar' (sqMemory sq) $ \n -> n - size
+
+acquireBatch :: SendQueue -> Int -> STM ()
+acquireBatch sq size = do
+  mem <- readTVar $ sqMemory sq
+  count <- readTVar $ sqCount sq
+  when (mem > sqMaxMemory sq || count > sqMaxCount sq) retry
+  writeTVar (sqMemory sq) $! mem + size
+  writeTVar (sqCount sq) $! count + 1
+
+writeSendQueue :: SendQueue -> Thrift.Batch -> Callback -> STM ()
+writeSendQueue sq batch callback =
+  writeSendQueue_ sq (BinaryBatch batch) callback
+
+writeSendQueueJson :: SendQueue -> [Thrift.JsonFactBatch] -> Callback -> STM ()
+writeSendQueueJson sq json callback =
+  writeSendQueue_ sq (JsonBatch size json) callback
+  where
+  -- size is approximate for JSON
+  size = sum (map jsonFactBatchSize json)
+  jsonFactBatchSize Thrift.JsonFactBatch{..} =
+    sum (map BS.length jsonFactBatch_facts) +
+    maybe 0 BS.length jsonFactBatch_unit
+
+writeSendQueueDescriptor
+  :: SendQueue
+  -> Thrift.BatchDescriptor
+  -> Callback
+  -> STM ()
+writeSendQueueDescriptor sq descriptor callback =
+  writeSendQueue_ sq (BatchDescriptor descriptor) callback
+
+writeSendQueue_ :: SendQueue -> Batch -> Callback -> STM ()
+writeSendQueue_ sq batch callback = do
+  status <- readTVar $ sqStatus sq
+  case status of
+    Open -> return ()
+    Closed -> throwSTM WriteQueueClosed
+    Failed exc -> throwSTM exc
+  let !size = batchSize batch
+  acquireBatch sq size
+  writeTQueue (sqOutQueue sq) (batch, callback)
+
+closeSendQueue :: SendQueue -> STM ()
+closeSendQueue sq = do
+  status <- readTVar $ sqStatus sq
+  case status of
+    Open -> writeTVar (sqStatus sq) Closed
+    Closed -> return ()
+    Failed exc -> throwSTM exc
+
+failSendQueue :: SendQueue -> SomeException -> STM ()
+failSendQueue sq exc = do
+  writeTVar (sqStatus sq) $ Failed exc
+  xs <- map waitCallback <$> flushTQueue (sqWaitQueue sq)
+  ys <- map snd <$> flushTQueue (sqOutQueue sq)
+  mapM_ ($ Left exc) (xs ++ ys)
+
+readSendQueue :: SendQueue -> STM (Maybe (Batch, Callback))
+readSendQueue sq = do
+  status <- readTVar $ sqStatus sq
+  case status of
+    Open -> get
+    Closed -> do
+      -- Don't exit the sendFromQueue until all batches are safely
+      -- written. We might have to resend batches if the server
+      -- forgets them.
+      count <- readTVar $ sqCount sq
+      if count /= 0 then get else return Nothing
+    Failed exc -> throwSTM exc
+  where
+    get = do
+      (batch, callback) <- readTQueue $ sqOutQueue sq
+      return $ Just (batch, callback)
+
+readWaitQueue :: SendQueue -> STM (Maybe Wait)
+readWaitQueue sq = do
+  status <- readTVar $ sqStatus sq
+  case status of
+    Open -> get
+    Closed -> do
+      -- NOTE: There can still be outstanding batches even if both queues are
+      -- empty - sendFromQueue might be writing one.
+      count <- readTVar $ sqCount sq
+      if count /= 0 then get else return Nothing
+    Failed exc -> throwSTM exc
+  where
+    get = Just <$> readTQueue (sqWaitQueue sq)
+
+pollFromWaitQueue
+  :: Backend.Backend e => e -> SendQueueSettings -> SendQueue -> IO ()
+pollFromWaitQueue backend settings sq = do
+  cont <- tryBracket
+    (atomically $ readWaitQueue sq)
+    (\r ex -> case (ex,r) of
+      (Left exc, Just wait) -> do
+        logWarning $ "Thread killed: " <> show exc
+        atomically $ do
+          waitCallback wait $ Left exc
+          failSendQueue sq exc
+        sendQueueLog settings $ SendQueueFailed exc
+      _ -> return ())
+    $ \r ->
+    case r of
+      Just Wait{..} -> do
+        result <- try $ waitBatch backend waitHandle
+        let !size = batchSize waitOriginalBatch
+        case result of
+          Left e@Thrift.UnknownBatchHandle{} -> do
+            logWarning $ "Server forgot batch; resending (" <> show e <> ")"
+            atomically $ do
+              -- don't writeSendQueue; retries should work even if the
+              -- queue is in the Closed state and shutting down
+              writeTQueue (sqOutQueue sq) (waitOriginalBatch, waitCallback)
+              return True
+          Right subst -> do
+            atomically $ do
+              waitCallback $ Right subst
+              releaseBatch sq size
+            elapsed <- getElapsedTime waitStart
+            sendQueueLog settings $ SendQueueSent size elapsed
+            return True
+
+      Nothing -> return False
+
+  when cont $ pollFromWaitQueue backend settings sq
+
+sendFromQueue
+  :: Backend.Backend e
+  => e
+  -> Thrift.Repo
+  -> SendQueueSettings
+  -> SendQueue
+  -> IO ()
+sendFromQueue backend repo settings sq = do
+  cont <- tryBracket
+    (atomically $ readSendQueue sq)
+    (\r ex -> case (ex,r) of
+      (Left exc, Just (_, callback)) -> do
+        logWarning $ "Thread killed: " <> show exc
+        atomically $ do
+          callback $ Left exc
+          failSendQueue sq exc
+        sendQueueLog settings $ SendQueueFailed exc
+      _ -> return ())
+    $ \r ->
+    case r of
+      Just (batch, callback) -> do
+        sendQueueLog settings $ case batch of
+          BinaryBatch bin -> SendQueueSending bin
+          JsonBatch _ json -> SendQueueSendingJson json
+          BatchDescriptor descriptor -> SendQueueSendingDescriptor descriptor
+        start <- getTimePoint
+        handle <- case batch of
+          BinaryBatch bin -> sendBatchAsync backend repo bin
+          JsonBatch _ json -> sendJsonBatchAsync backend repo json Nothing
+          BatchDescriptor descriptor
+            -> sendBatchDescriptorAsync backend repo descriptor
+        atomically $ writeTQueue (sqWaitQueue sq) Wait
+          { waitHandle = handle
+          , waitStart = start
+          , waitCallback = callback
+          , waitOriginalBatch = batch
+          }
+        return True
+
+      Nothing -> return False
+  when cont $ sendFromQueue backend repo settings sq
+
+-- | Settings for a 'SendQueue'
+data SendQueueSettings = SendQueueSettings
+  { -- | Max memory that the send queue should occupy (soft limit)
+    sendQueueMaxMemory :: !Int
+
+    -- | Max number of batches that the queue should hold
+  , sendQueueMaxBatches :: !Int
+
+    -- | Number of threads to use for sending
+  , sendQueueThreads :: !Int
+
+    -- | A function called whenever a 'SendQueueEvent' occurs
+  , sendQueueLog :: SendQueueEvent -> IO ()
+
+    -- | How to retry failures
+  , sendQueueRetry :: RetryPolicy
+
+    -- | Optionally log stats every 10s
+  , sendQueueLogStats :: Bool
+  }
+
+instance Show SendQueueSettings where
+  show _ = "SendQueueSettings{}"
+
+instance Default SendQueueSettings where
+  def = SendQueueSettings
+    { sendQueueMaxMemory = 1000000000
+    , sendQueueMaxBatches = 10000
+    , sendQueueThreads = 1
+    , sendQueueLog = const $ return ()
+    , sendQueueRetry = defaultRetryPolicy
+    , sendQueueLogStats = False
+    }
+
+withSendQueue
+  :: Backend e
+  => e
+  -> Thrift.Repo
+  -> SendQueueSettings
+  -> (SendQueue -> IO a)
+  -> IO a
+withSendQueue backend repo settings@SendQueueSettings{..} action =
+  mask $ \restore -> do
+    q <- newSendQueue sendQueueMaxMemory sendQueueMaxBatches
+    let retryBackend = backendRetryWrites backend sendQueueRetry
+    withStats sendQueueLogStats q $ do
+      snd <$> Async.concurrently
+        (Async.mapConcurrently_ id
+          $ restore (pollFromWaitQueue retryBackend settings q)
+          : replicate
+              sendQueueThreads
+              (restore (sendFromQueue retryBackend repo settings q)))
+        (restore (action q)
+          `finally` atomically (closeSendQueue q))
+
+withStats :: Bool -> SendQueue -> IO a -> IO a
+withStats on SendQueue{..} act = do
+  verbose <- vlogIsOn 1
+  if on || verbose
+    then Async.withAsync (forever $ logQueueStats >> sleep 10) $ \_ -> act
+    else act
+  where
+  logQueueStats = do
+    count <- readTVarIO sqCount
+    memory <- readTVarIO sqMemory
+    logInfo $ printf "count:%d/%d memory:%d/%d"
+      count sqMaxCount memory sqMaxMemory
diff --git a/glean/hs/Glean/Write/Stats.hs b/glean/hs/Glean/Write/Stats.hs
new file mode 100644
--- /dev/null
+++ b/glean/hs/Glean/Write/Stats.hs
@@ -0,0 +1,232 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Write.Stats (
+  Stats, new, Bump, bump, tick,
+  mutatorLatency, mutatorInput, mutatorThroughput, mutatorDedupedThroughput,
+  mutatorDupThroughput,
+  renameThroughput, commitThroughput,
+  lookupCacheStats
+) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as Char8
+import Data.Char (toLower)
+import Data.Functor.Contravariant
+import Data.IORef
+import Data.Word
+import System.Clock (TimeSpec)
+
+import qualified Glean.RTS.Foreign.LookupCache as LookupCache
+
+import ServiceData.GlobalStats
+import ServiceData.Types
+import Util.Log
+
+import Glean.Util.Metric
+import Glean.Util.Throttle
+
+data Stat a = Stat
+  { statNew :: !a
+  , statAll :: !a
+  }
+
+data Stats = Stats
+  { statsLogger :: Execute
+  , statsMutatorLatency :: !(IORef (Stat Tick))
+  , statsMutatorInput :: !(IORef (Stat Tick))
+  , statsMutatorThroughput :: !(IORef (Stat Tick))
+  , statsMutatorDedupedThroughput :: !(IORef (Stat Tick))
+  , statsMutatorDupThroughput :: !(IORef (Stat Tick))
+  , statsRenameThroughput :: !(IORef (Stat Tick))
+  , statsCommitThroughput :: !(IORef (Stat Tick))
+  , statsLookupCache :: !(IORef (Stat LookupCache.StatValues))
+  }
+
+data Ref = forall a. Monoid a => Ref (Stats -> IORef (Stat a))
+
+refs :: [Ref]
+refs =
+  [ Ref statsMutatorLatency
+  , Ref statsMutatorInput
+  , Ref statsMutatorThroughput
+  , Ref statsMutatorDedupedThroughput
+  , Ref statsMutatorDupThroughput
+  , Ref statsRenameThroughput
+  , Ref statsCommitThroughput
+  , Ref statsLookupCache
+  ]
+
+bumper :: Monoid a => (Stats -> IORef (Stat a)) -> Bump a
+bumper f = Bump $ \stats x -> atomicModifyIORef' (f stats) $
+  \(Stat new all) -> (Stat (new <> x) (all <> x), ())
+
+-- | A metric that can be bumped using 'bump'.  Metrics of the same
+-- type can be bumped together using the `Monoid` instance.
+newtype Bump a = Bump { runBump :: Stats -> a -> IO () }
+
+instance Semigroup (Bump a) where
+  Bump p <> Bump q = Bump $ \stats a -> p stats a >> q stats a
+
+instance Monoid (Bump a) where
+  mempty = Bump $ const $ const $ return ()
+
+instance Contravariant Bump where
+  contramap f (Bump g) = Bump $ \stats a -> g stats (f a)
+
+-- | The latency between a write request being received, and it being completed.
+mutatorLatency :: Bump Tick
+mutatorLatency =
+  bumper statsMutatorLatency <>
+  bumpServiceCounterLatency "glean.db.write.latency_ms"
+
+-- | The throughput of writes in bytes per unit time
+mutatorThroughput :: Bump Tick
+mutatorThroughput =
+  bumper statsMutatorThroughput <>
+  contramap tickValue (bumpServiceCounter "glean.db.write.throughput")
+
+mutatorInput :: Bump Tick
+mutatorInput =
+  bumper statsMutatorInput
+
+-- | The throughput of writes in bytes per unit time
+mutatorDedupedThroughput :: Bump Tick
+mutatorDedupedThroughput =
+  bumper statsMutatorDedupedThroughput <>
+  contramap tickValue (bumpServiceCounter "glean.db.write.deduped.bytes")
+
+-- | The throughput of writes in bytes per unit time
+mutatorDupThroughput :: Bump Tick
+mutatorDupThroughput =
+  bumper statsMutatorDupThroughput <>
+  contramap tickValue (bumpServiceCounter "glean.db.write.undeduped.bytes") <>
+  contramap tickMillis (bumpServiceCounter "glean.db.write.undeduped.ms")
+
+-- | The throughput of renames in bytes per unit time
+renameThroughput :: Bump Tick
+renameThroughput =
+  bumper statsRenameThroughput <>
+  contramap tickValue (bumpServiceCounter "glean.db.write.rename.bytes") <>
+  contramap tickMillis (bumpServiceCounter "glean.db.write.rename.ms")
+
+-- | The throughput of commits in bytes per unit time
+commitThroughput :: Bump Tick
+commitThroughput =
+  bumper statsCommitThroughput <>
+  contramap tickValue (bumpServiceCounter "glean.db.write.commit.bytes") <>
+  contramap tickMillis (bumpServiceCounter "glean.db.write.commit.ms")
+
+lookupCacheStats :: Bump LookupCache.StatValues
+lookupCacheStats = mconcat $ bumper statsLookupCache
+  : [contramap (`LookupCache.getStat` c) bump | (c,bump) <- lookupCacheCounters]
+
+lookupCacheCounters :: [(LookupCache.Stat, Bump Word64)]
+lookupCacheCounters =
+  [(c, bump c $ Char8.pack $ "glean.db.write.cache." ++ map toLower (show c))
+    | c <- [minBound .. maxBound]]
+  where
+    bump c
+      | LookupCache.isCounter c = bumpServiceCounter
+      | otherwise = setServiceCounter
+
+-- | Bump an fb303 counter representing latency
+bumpServiceCounterLatency :: ByteString -> Bump Tick
+bumpServiceCounterLatency counter = Bump $ \_ tick ->
+  let ms = fromIntegral (tickLatencyNanoSecs tick `div` 1000000) in
+  addStatValueType counter ms Avg
+
+-- | Bump an fb303 counter
+bumpServiceCounter :: ByteString -> Bump Word64
+bumpServiceCounter counter = Bump $ \_ value ->
+  addStatValueType counter (fromIntegral value) Sum
+
+-- | Set an fb303 counter
+setServiceCounter :: ByteString -> Bump Word64
+setServiceCounter counter = Bump $ \_ value ->
+  void $ setCounter counter (fromIntegral value)
+
+allStats :: [(String, Stats -> IO String)]
+allStats =
+  [("mut_lat", counter showLatency statsMutatorLatency)
+  ,("mut_thp", counter showThroughput statsMutatorThroughput)
+  ,("ded_thp", counter showThroughput statsMutatorDedupedThroughput)
+  ,("dup_thp", counter showThroughput statsMutatorDupThroughput)
+  ,("rnm_thp", counter showThroughput statsRenameThroughput)
+  ,("cmt_thp", counter showThroughput statsCommitThroughput)
+  ,("ibk_mis", counter
+    (showMissRate LookupCache.IdByKey_hits LookupCache.IdByKey_misses)
+    statsLookupCache)
+  ,("tbi_mis", counter
+    (showMissRate LookupCache.TypeById_hits LookupCache.TypeById_misses)
+    statsLookupCache)
+  ,("fbi_mis", counter
+    (showMissRate LookupCache.FactById_hits LookupCache.FactById_misses)
+    statsLookupCache)
+  ,("lch_mem", value
+    (LookupCache.Fact_bytes `using` showMemory)
+    statsLookupCache)
+  ,("lch_cnt", value
+    (LookupCache.Fact_count `using` showCount)
+    statsLookupCache)
+  ]
+  where
+    counter :: Monoid a
+            => (a -> String) -> (Stats -> IORef (Stat a)) -> Stats -> IO String
+    counter shw get stats = do
+      stat <- readIORef (get stats)
+      return $ concat [shw $ statNew stat, " [", shw $ statAll stat, "]"]
+
+    showMissRate h m stats = pad 5 $ case hits+misses of
+      0 -> "-"
+      n ->
+        let !rate = (misses * 1000) `div` n
+        in concat [show (rate `div` 10), ".", show (rate `mod` 10), "%"]
+      where
+        hits = LookupCache.getStat stats h
+        misses = LookupCache.getStat stats m
+
+    value :: (a -> String) -> (Stats -> IORef (Stat a)) -> Stats -> IO String
+    value shw get stats = shw . statNew <$> readIORef (get stats)
+
+    using c f stats = f (LookupCache.getStat stats c)
+
+class Initial a where
+  initial :: IO a -> IO Stats
+
+instance Initial Stats where
+  initial = id
+
+instance (Monoid a, Initial b) => Initial (IORef (Stat a) -> b) where
+  initial p = initial $ do
+    f <- p
+    f <$> newIORef (Stat mempty mempty)
+
+new :: TimeSpec -> IO Stats
+new period = initial $ Stats <$> atMostEvery period
+
+-- | Bump a metric
+bump :: Stats -> Bump a -> a -> IO ()
+bump stats b a = do
+  runBump b stats a
+  statsLogger stats $ do
+    s <- fmap unwords $ forM allStats $ \(tag, f) -> do
+      s <- f stats
+      return $ tag ++ ": " ++ s
+    logInfo s
+    forM_ refs $ \(Ref f) -> atomicModifyIORef' (f stats) $
+      \stat -> (stat { statNew = mempty }, ())
+
+tick :: Stats -> Bump Tick -> Word64 -> IO a -> IO a
+tick stats b val io = do
+  p <- beginTick val
+  x <- io
+  t <- endTick p
+  bump stats b t
+  return x
diff --git a/glean/if/gen-hs2/Glean/GleanService/Client.hs b/glean/if/gen-hs2/Glean/GleanService/Client.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/gen-hs2/Glean/GleanService/Client.hs
@@ -0,0 +1,3318 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Glean.GleanService.Client
+       (GleanService, getSchemaInfo, getSchemaInfoIO, send_getSchemaInfo,
+        _build_getSchemaInfo, recv_getSchemaInfo, _parse_getSchemaInfo,
+        getSchemaInfoForSchema, getSchemaInfoForSchemaIO,
+        send_getSchemaInfoForSchema, _build_getSchemaInfoForSchema,
+        recv_getSchemaInfoForSchema, _parse_getSchemaInfoForSchema,
+        validateSchema, validateSchemaIO, send_validateSchema,
+        _build_validateSchema, recv_validateSchema, _parse_validateSchema,
+        sendBatch, sendBatchIO, send_sendBatch, _build_sendBatch,
+        recv_sendBatch, _parse_sendBatch, enqueueBatch, enqueueBatchIO,
+        send_enqueueBatch, _build_enqueueBatch, recv_enqueueBatch,
+        _parse_enqueueBatch, finishBatch, finishBatchIO, send_finishBatch,
+        _build_finishBatch, recv_finishBatch, _parse_finishBatch,
+        sendJsonBatch, sendJsonBatchIO, send_sendJsonBatch,
+        _build_sendJsonBatch, recv_sendJsonBatch, _parse_sendJsonBatch,
+        kickOff, kickOffIO, send_kickOff, _build_kickOff, recv_kickOff,
+        _parse_kickOff, updateProperties, updatePropertiesIO,
+        send_updateProperties, _build_updateProperties,
+        recv_updateProperties, _parse_updateProperties, completePredicates,
+        completePredicatesIO, send_completePredicates,
+        _build_completePredicates, recv_completePredicates,
+        _parse_completePredicates, finish, finishIO, send_finish,
+        _build_finish, recv_finish, _parse_finish, finalize, finalizeIO,
+        send_finalize, _build_finalize, recv_finalize, _parse_finalize,
+        queryFact, queryFactIO, send_queryFact, _build_queryFact,
+        recv_queryFact, _parse_queryFact, factIdRange, factIdRangeIO,
+        send_factIdRange, _build_factIdRange, recv_factIdRange,
+        _parse_factIdRange, predicateStats, predicateStatsIO,
+        send_predicateStats, _build_predicateStats, recv_predicateStats,
+        _parse_predicateStats, listDatabases, listDatabasesIO,
+        send_listDatabases, _build_listDatabases, recv_listDatabases,
+        _parse_listDatabases, getDatabase, getDatabaseIO, send_getDatabase,
+        _build_getDatabase, recv_getDatabase, _parse_getDatabase,
+        deleteDatabase, deleteDatabaseIO, send_deleteDatabase,
+        _build_deleteDatabase, recv_deleteDatabase, _parse_deleteDatabase,
+        restore, restoreIO, send_restore, _build_restore, recv_restore,
+        _parse_restore, userQueryFacts, userQueryFactsIO,
+        send_userQueryFacts, _build_userQueryFacts, recv_userQueryFacts,
+        _parse_userQueryFacts, userQuery, userQueryIO, send_userQuery,
+        _build_userQuery, recv_userQuery, _parse_userQuery, userQueryBatch,
+        userQueryBatchIO, send_userQueryBatch, _build_userQueryBatch,
+        recv_userQueryBatch, _parse_userQueryBatch, deriveStored,
+        deriveStoredIO, send_deriveStored, _build_deriveStored,
+        recv_deriveStored, _parse_deriveStored)
+       where
+import qualified Control.Arrow as Arrow
+import qualified Control.Concurrent as Concurrent
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Control.Monad.Trans.Reader as Reader
+import qualified Data.ByteString.Builder as ByteString
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.FacebookService.Client as FacebookService
+import qualified Fb303.Types as Fb303
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Data.Monoid ((<>))
+import Prelude ((==), (=<<), (>>=), (<$>), (.))
+import Glean.Types
+
+data GleanService
+
+type instance Thrift.Super GleanService =
+     FacebookService.FacebookService
+
+getSchemaInfo ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Repo -> GetSchemaInfo -> Thrift.ThriftM p c s SchemaInfo
+getSchemaInfo __field__repo __field__get
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (getSchemaInfoIO _proxy _channel _counter _opts __field__repo
+            __field__get)
+
+getSchemaInfoIO ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s GleanService) =>
+                  Proxy.Proxy p ->
+                    c s ->
+                      Thrift.Counter ->
+                        Thrift.RpcOptions -> Repo -> GetSchemaInfo -> Prelude.IO SchemaInfo
+getSchemaInfoIO _proxy _channel _counter _opts __field__repo
+  __field__get
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_getSchemaInfo _proxy)
+       send_getSchemaInfo _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__get
+       Thrift.wait _handle
+
+send_getSchemaInfo ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GleanService) =>
+                     Proxy.Proxy p ->
+                       c s ->
+                         Thrift.Counter ->
+                           Thrift.SendCallback ->
+                             Thrift.RecvCallback ->
+                               Thrift.RpcOptions -> Repo -> GetSchemaInfo -> Prelude.IO ()
+send_getSchemaInfo _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__get
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_getSchemaInfo _proxy _seqNum __field__repo __field__get))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_getSchemaInfo ::
+                     (Thrift.Protocol p) =>
+                     Proxy.Proxy p ->
+                       Thrift.Response ->
+                         Prelude.Either Exception.SomeException SchemaInfo
+recv_getSchemaInfo _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_getSchemaInfo _proxy) _response))
+
+_build_getSchemaInfo ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Int.Int32 -> Repo -> GetSchemaInfo -> ByteString.Builder
+_build_getSchemaInfo _proxy _seqNum __field__repo __field__get
+  = Thrift.genMsgBegin _proxy "getSchemaInfo" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "get" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__get)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_getSchemaInfo ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Parser.Parser (Prelude.Either Exception.SomeException SchemaInfo)
+_parse_getSchemaInfo _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "getSchemaInfo: expected reply but got function call"
+                    2 | _name == "getSchemaInfo" ->
+                        do let
+                             _idMap = HashMap.fromList [("getSchemaInfo_success", 0), ("u", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "getSchemaInfo: expected reply but got oneway function call"
+                    _ -> Prelude.fail "getSchemaInfo: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+getSchemaInfoForSchema ::
+                         (Thrift.Protocol p, Thrift.ClientChannel c,
+                          (Thrift.<:) s GleanService) =>
+                         GetSchemaInfo -> Thrift.ThriftM p c s SchemaInfo
+getSchemaInfoForSchema __field__get
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (getSchemaInfoForSchemaIO _proxy _channel _counter _opts
+            __field__get)
+
+getSchemaInfoForSchemaIO ::
+                           (Thrift.Protocol p, Thrift.ClientChannel c,
+                            (Thrift.<:) s GleanService) =>
+                           Proxy.Proxy p ->
+                             c s ->
+                               Thrift.Counter ->
+                                 Thrift.RpcOptions -> GetSchemaInfo -> Prelude.IO SchemaInfo
+getSchemaInfoForSchemaIO _proxy _channel _counter _opts
+  __field__get
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_getSchemaInfoForSchema _proxy)
+       send_getSchemaInfoForSchema _proxy _channel _counter _sendCob
+         _recvCob
+         _opts
+         __field__get
+       Thrift.wait _handle
+
+send_getSchemaInfoForSchema ::
+                              (Thrift.Protocol p, Thrift.ClientChannel c,
+                               (Thrift.<:) s GleanService) =>
+                              Proxy.Proxy p ->
+                                c s ->
+                                  Thrift.Counter ->
+                                    Thrift.SendCallback ->
+                                      Thrift.RecvCallback ->
+                                        Thrift.RpcOptions -> GetSchemaInfo -> Prelude.IO ()
+send_getSchemaInfoForSchema _proxy _channel _counter _sendCob
+  _recvCob _rpcOpts __field__get
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_getSchemaInfoForSchema _proxy _seqNum __field__get))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_getSchemaInfoForSchema ::
+                              (Thrift.Protocol p) =>
+                              Proxy.Proxy p ->
+                                Thrift.Response ->
+                                  Prelude.Either Exception.SomeException SchemaInfo
+recv_getSchemaInfoForSchema _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_getSchemaInfoForSchema _proxy) _response))
+
+_build_getSchemaInfoForSchema ::
+                                Thrift.Protocol p =>
+                                Proxy.Proxy p -> Int.Int32 -> GetSchemaInfo -> ByteString.Builder
+_build_getSchemaInfoForSchema _proxy _seqNum __field__get
+  = Thrift.genMsgBegin _proxy "getSchemaInfoForSchema" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "get" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__get)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_getSchemaInfoForSchema ::
+                                Thrift.Protocol p =>
+                                Proxy.Proxy p ->
+                                  Parser.Parser (Prelude.Either Exception.SomeException SchemaInfo)
+_parse_getSchemaInfoForSchema _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "getSchemaInfoForSchema: expected reply but got function call"
+                    2 | _name == "getSchemaInfoForSchema" ->
+                        do let
+                             _idMap = HashMap.fromList [("getSchemaInfoForSchema_success", 0)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "getSchemaInfoForSchema: expected reply but got oneway function call"
+                    _ -> Prelude.fail "getSchemaInfoForSchema: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+validateSchema ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 ValidateSchema -> Thrift.ThriftM p c s ()
+validateSchema __field__v
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (validateSchemaIO _proxy _channel _counter _opts __field__v)
+
+validateSchemaIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions -> ValidateSchema -> Prelude.IO ()
+validateSchemaIO _proxy _channel _counter _opts __field__v
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_validateSchema _proxy)
+       send_validateSchema _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__v
+       Thrift.wait _handle
+
+send_validateSchema ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GleanService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> ValidateSchema -> Prelude.IO ()
+send_validateSchema _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__v
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_validateSchema _proxy _seqNum __field__v))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_validateSchema ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response -> Prelude.Either Exception.SomeException ()
+recv_validateSchema _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_validateSchema _proxy) _response))
+
+_build_validateSchema ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p -> Int.Int32 -> ValidateSchema -> ByteString.Builder
+_build_validateSchema _proxy _seqNum __field__v
+  = Thrift.genMsgBegin _proxy "validateSchema" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "v" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__v)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_validateSchema ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser (Prelude.Either Exception.SomeException ())
+_parse_validateSchema _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "validateSchema: expected reply but got function call"
+                    2 | _name == "validateSchema" ->
+                        do let
+                             _idMap = HashMap.fromList [("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.return (Prelude.Right ())
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "validateSchema: expected reply but got oneway function call"
+                    _ -> Prelude.fail "validateSchema: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+sendBatch ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s GleanService) =>
+            ComputedBatch -> Thrift.ThriftM p c s SendResponse
+sendBatch __field__batch
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (sendBatchIO _proxy _channel _counter _opts __field__batch)
+
+sendBatchIO ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Proxy.Proxy p ->
+                c s ->
+                  Thrift.Counter ->
+                    Thrift.RpcOptions -> ComputedBatch -> Prelude.IO SendResponse
+sendBatchIO _proxy _channel _counter _opts __field__batch
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_sendBatch _proxy)
+       send_sendBatch _proxy _channel _counter _sendCob _recvCob _opts
+         __field__batch
+       Thrift.wait _handle
+
+send_sendBatch ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.SendCallback ->
+                         Thrift.RecvCallback ->
+                           Thrift.RpcOptions -> ComputedBatch -> Prelude.IO ()
+send_sendBatch _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__batch
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_sendBatch _proxy _seqNum __field__batch))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_sendBatch ::
+                 (Thrift.Protocol p) =>
+                 Proxy.Proxy p ->
+                   Thrift.Response ->
+                     Prelude.Either Exception.SomeException SendResponse
+recv_sendBatch _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_sendBatch _proxy) _response))
+
+_build_sendBatch ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p -> Int.Int32 -> ComputedBatch -> ByteString.Builder
+_build_sendBatch _proxy _seqNum __field__batch
+  = Thrift.genMsgBegin _proxy "sendBatch" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "batch" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__batch)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_sendBatch ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p ->
+                     Parser.Parser (Prelude.Either Exception.SomeException SendResponse)
+_parse_sendBatch _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "sendBatch: expected reply but got function call"
+                    2 | _name == "sendBatch" ->
+                        do let
+                             _idMap = HashMap.fromList [("sendBatch_success", 0), ("u", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "sendBatch: expected reply but got oneway function call"
+                    _ -> Prelude.fail "sendBatch: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+enqueueBatch ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s GleanService) =>
+               Repo ->
+                 EnqueueBatch ->
+                   EnqueueBatchWaitPolicy -> Thrift.ThriftM p c s EnqueueBatchResponse
+enqueueBatch __field__repo __field__batch __field__waitPolicy
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (enqueueBatchIO _proxy _channel _counter _opts __field__repo
+            __field__batch
+            __field__waitPolicy)
+
+enqueueBatchIO ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.RpcOptions ->
+                         Repo ->
+                           EnqueueBatch ->
+                             EnqueueBatchWaitPolicy -> Prelude.IO EnqueueBatchResponse
+enqueueBatchIO _proxy _channel _counter _opts __field__repo
+  __field__batch __field__waitPolicy
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_enqueueBatch _proxy)
+       send_enqueueBatch _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__batch
+         __field__waitPolicy
+       Thrift.wait _handle
+
+send_enqueueBatch ::
+                    (Thrift.Protocol p, Thrift.ClientChannel c,
+                     (Thrift.<:) s GleanService) =>
+                    Proxy.Proxy p ->
+                      c s ->
+                        Thrift.Counter ->
+                          Thrift.SendCallback ->
+                            Thrift.RecvCallback ->
+                              Thrift.RpcOptions ->
+                                Repo -> EnqueueBatch -> EnqueueBatchWaitPolicy -> Prelude.IO ()
+send_enqueueBatch _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__batch __field__waitPolicy
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_enqueueBatch _proxy _seqNum __field__repo __field__batch
+                     __field__waitPolicy))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_enqueueBatch ::
+                    (Thrift.Protocol p) =>
+                    Proxy.Proxy p ->
+                      Thrift.Response ->
+                        Prelude.Either Exception.SomeException EnqueueBatchResponse
+recv_enqueueBatch _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_enqueueBatch _proxy) _response))
+
+_build_enqueueBatch ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Int.Int32 ->
+                          Repo ->
+                            EnqueueBatch -> EnqueueBatchWaitPolicy -> ByteString.Builder
+_build_enqueueBatch _proxy _seqNum __field__repo __field__batch
+  __field__waitPolicy
+  = Thrift.genMsgBegin _proxy "enqueueBatch" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "batch" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__batch)
+             :
+             Thrift.genField _proxy "waitPolicy" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__waitPolicy)
+               : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_enqueueBatch ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Parser.Parser
+                          (Prelude.Either Exception.SomeException EnqueueBatchResponse)
+_parse_enqueueBatch _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "enqueueBatch: expected reply but got function call"
+                    2 | _name == "enqueueBatch" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("enqueueBatch_success", 0), ("e", 1), ("r", 2), ("u", 3)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser Retry)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "enqueueBatch: expected reply but got oneway function call"
+                    _ -> Prelude.fail "enqueueBatch: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+finishBatch ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Handle -> Thrift.ThriftM p c s FinishResponse
+finishBatch __field__handle
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (finishBatchIO _proxy _channel _counter _opts __field__handle)
+
+finishBatchIO ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Proxy.Proxy p ->
+                  c s ->
+                    Thrift.Counter ->
+                      Thrift.RpcOptions -> Handle -> Prelude.IO FinishResponse
+finishBatchIO _proxy _channel _counter _opts __field__handle
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_finishBatch _proxy)
+       send_finishBatch _proxy _channel _counter _sendCob _recvCob _opts
+         __field__handle
+       Thrift.wait _handle
+
+send_finishBatch ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.SendCallback ->
+                           Thrift.RecvCallback -> Thrift.RpcOptions -> Handle -> Prelude.IO ()
+send_finishBatch _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__handle
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_finishBatch _proxy _seqNum __field__handle))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_finishBatch ::
+                   (Thrift.Protocol p) =>
+                   Proxy.Proxy p ->
+                     Thrift.Response ->
+                       Prelude.Either Exception.SomeException FinishResponse
+recv_finishBatch _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_finishBatch _proxy) _response))
+
+_build_finishBatch ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p -> Int.Int32 -> Handle -> ByteString.Builder
+_build_finishBatch _proxy _seqNum __field__handle
+  = Thrift.genMsgBegin _proxy "finishBatch" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "handle" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__handle)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_finishBatch ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p ->
+                       Parser.Parser
+                         (Prelude.Either Exception.SomeException FinishResponse)
+_parse_finishBatch _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "finishBatch: expected reply but got function call"
+                    2 | _name == "finishBatch" ->
+                        do let
+                             _idMap = HashMap.fromList [("finishBatch_success", 0), ("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownBatchHandle)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "finishBatch: expected reply but got oneway function call"
+                    _ -> Prelude.fail "finishBatch: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+sendJsonBatch ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Repo -> SendJsonBatch -> Thrift.ThriftM p c s SendJsonBatchResponse
+sendJsonBatch __field__repo __field__s
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (sendJsonBatchIO _proxy _channel _counter _opts __field__repo
+            __field__s)
+
+sendJsonBatchIO ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s GleanService) =>
+                  Proxy.Proxy p ->
+                    c s ->
+                      Thrift.Counter ->
+                        Thrift.RpcOptions ->
+                          Repo -> SendJsonBatch -> Prelude.IO SendJsonBatchResponse
+sendJsonBatchIO _proxy _channel _counter _opts __field__repo
+  __field__s
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_sendJsonBatch _proxy)
+       send_sendJsonBatch _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__s
+       Thrift.wait _handle
+
+send_sendJsonBatch ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GleanService) =>
+                     Proxy.Proxy p ->
+                       c s ->
+                         Thrift.Counter ->
+                           Thrift.SendCallback ->
+                             Thrift.RecvCallback ->
+                               Thrift.RpcOptions -> Repo -> SendJsonBatch -> Prelude.IO ()
+send_sendJsonBatch _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__s
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_sendJsonBatch _proxy _seqNum __field__repo __field__s))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_sendJsonBatch ::
+                     (Thrift.Protocol p) =>
+                     Proxy.Proxy p ->
+                       Thrift.Response ->
+                         Prelude.Either Exception.SomeException SendJsonBatchResponse
+recv_sendJsonBatch _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_sendJsonBatch _proxy) _response))
+
+_build_sendJsonBatch ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Int.Int32 -> Repo -> SendJsonBatch -> ByteString.Builder
+_build_sendJsonBatch _proxy _seqNum __field__repo __field__s
+  = Thrift.genMsgBegin _proxy "sendJsonBatch" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "s" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__s)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_sendJsonBatch ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Parser.Parser
+                           (Prelude.Either Exception.SomeException SendJsonBatchResponse)
+_parse_sendJsonBatch _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "sendJsonBatch: expected reply but got function call"
+                    2 | _name == "sendJsonBatch" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("sendJsonBatch_success", 0), ("e", 1), ("r", 2), ("u", 3)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser Retry)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "sendJsonBatch: expected reply but got oneway function call"
+                    _ -> Prelude.fail "sendJsonBatch: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+kickOff ::
+          (Thrift.Protocol p, Thrift.ClientChannel c,
+           (Thrift.<:) s GleanService) =>
+          KickOff -> Thrift.ThriftM p c s KickOffResponse
+kickOff __field__request
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (kickOffIO _proxy _channel _counter _opts __field__request)
+
+kickOffIO ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s GleanService) =>
+            Proxy.Proxy p ->
+              c s ->
+                Thrift.Counter ->
+                  Thrift.RpcOptions -> KickOff -> Prelude.IO KickOffResponse
+kickOffIO _proxy _channel _counter _opts __field__request
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_kickOff _proxy)
+       send_kickOff _proxy _channel _counter _sendCob _recvCob _opts
+         __field__request
+       Thrift.wait _handle
+
+send_kickOff ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s GleanService) =>
+               Proxy.Proxy p ->
+                 c s ->
+                   Thrift.Counter ->
+                     Thrift.SendCallback ->
+                       Thrift.RecvCallback ->
+                         Thrift.RpcOptions -> KickOff -> Prelude.IO ()
+send_kickOff _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__request
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_kickOff _proxy _seqNum __field__request))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_kickOff ::
+               (Thrift.Protocol p) =>
+               Proxy.Proxy p ->
+                 Thrift.Response ->
+                   Prelude.Either Exception.SomeException KickOffResponse
+recv_kickOff _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_kickOff _proxy) _response))
+
+_build_kickOff ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p -> Int.Int32 -> KickOff -> ByteString.Builder
+_build_kickOff _proxy _seqNum __field__request
+  = Thrift.genMsgBegin _proxy "kickOff" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_kickOff ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p ->
+                   Parser.Parser
+                     (Prelude.Either Exception.SomeException KickOffResponse)
+_parse_kickOff _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "kickOff: expected reply but got function call"
+                    2 | _name == "kickOff" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList [("kickOff_success", 0), ("u", 1), ("e", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  InvalidDependency)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "kickOff: expected reply but got oneway function call"
+                    _ -> Prelude.fail "kickOff: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+updateProperties ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Repo ->
+                     DatabaseProperties ->
+                       [Text.Text] -> Thrift.ThriftM p c s UpdatePropertiesResponse
+updateProperties __field__repo __field__set_ __field__unset
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (updatePropertiesIO _proxy _channel _counter _opts __field__repo
+            __field__set_
+            __field__unset)
+
+updatePropertiesIO ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GleanService) =>
+                     Proxy.Proxy p ->
+                       c s ->
+                         Thrift.Counter ->
+                           Thrift.RpcOptions ->
+                             Repo ->
+                               DatabaseProperties ->
+                                 [Text.Text] -> Prelude.IO UpdatePropertiesResponse
+updatePropertiesIO _proxy _channel _counter _opts __field__repo
+  __field__set_ __field__unset
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_updateProperties _proxy)
+       send_updateProperties _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+         __field__set_
+         __field__unset
+       Thrift.wait _handle
+
+send_updateProperties ::
+                        (Thrift.Protocol p, Thrift.ClientChannel c,
+                         (Thrift.<:) s GleanService) =>
+                        Proxy.Proxy p ->
+                          c s ->
+                            Thrift.Counter ->
+                              Thrift.SendCallback ->
+                                Thrift.RecvCallback ->
+                                  Thrift.RpcOptions ->
+                                    Repo -> DatabaseProperties -> [Text.Text] -> Prelude.IO ()
+send_updateProperties _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__set_ __field__unset
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_updateProperties _proxy _seqNum __field__repo __field__set_
+                     __field__unset))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_updateProperties ::
+                        (Thrift.Protocol p) =>
+                        Proxy.Proxy p ->
+                          Thrift.Response ->
+                            Prelude.Either Exception.SomeException UpdatePropertiesResponse
+recv_updateProperties _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_updateProperties _proxy) _response))
+
+_build_updateProperties ::
+                          Thrift.Protocol p =>
+                          Proxy.Proxy p ->
+                            Int.Int32 ->
+                              Repo -> DatabaseProperties -> [Text.Text] -> ByteString.Builder
+_build_updateProperties _proxy _seqNum __field__repo __field__set_
+  __field__unset
+  = Thrift.genMsgBegin _proxy "updateProperties" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "set_" (Thrift.getMapType _proxy) 2 1
+             ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                 (Thrift.getStringType _proxy)
+                 Prelude.True
+                 (Thrift.genText _proxy)
+                 (Thrift.genText _proxy)
+                 . HashMap.toList)
+                __field__set_)
+             :
+             Thrift.genField _proxy "unset" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__unset)
+               : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_updateProperties ::
+                          Thrift.Protocol p =>
+                          Proxy.Proxy p ->
+                            Parser.Parser
+                              (Prelude.Either Exception.SomeException UpdatePropertiesResponse)
+_parse_updateProperties _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "updateProperties: expected reply but got function call"
+                    2 | _name == "updateProperties" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("updateProperties_success", 0), ("e", 1), ("u", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "updateProperties: expected reply but got oneway function call"
+                    _ -> Prelude.fail "updateProperties: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+completePredicates ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GleanService) =>
+                     Repo ->
+                       CompletePredicates ->
+                         Thrift.ThriftM p c s CompletePredicatesResponse
+completePredicates __field__repo __field__predicates
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (completePredicatesIO _proxy _channel _counter _opts __field__repo
+            __field__predicates)
+
+completePredicatesIO ::
+                       (Thrift.Protocol p, Thrift.ClientChannel c,
+                        (Thrift.<:) s GleanService) =>
+                       Proxy.Proxy p ->
+                         c s ->
+                           Thrift.Counter ->
+                             Thrift.RpcOptions ->
+                               Repo -> CompletePredicates -> Prelude.IO CompletePredicatesResponse
+completePredicatesIO _proxy _channel _counter _opts __field__repo
+  __field__predicates
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_completePredicates _proxy)
+       send_completePredicates _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+         __field__predicates
+       Thrift.wait _handle
+
+send_completePredicates ::
+                          (Thrift.Protocol p, Thrift.ClientChannel c,
+                           (Thrift.<:) s GleanService) =>
+                          Proxy.Proxy p ->
+                            c s ->
+                              Thrift.Counter ->
+                                Thrift.SendCallback ->
+                                  Thrift.RecvCallback ->
+                                    Thrift.RpcOptions -> Repo -> CompletePredicates -> Prelude.IO ()
+send_completePredicates _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__predicates
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_completePredicates _proxy _seqNum __field__repo
+                     __field__predicates))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_completePredicates ::
+                          (Thrift.Protocol p) =>
+                          Proxy.Proxy p ->
+                            Thrift.Response ->
+                              Prelude.Either Exception.SomeException CompletePredicatesResponse
+recv_completePredicates _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_completePredicates _proxy) _response))
+
+_build_completePredicates ::
+                            Thrift.Protocol p =>
+                            Proxy.Proxy p ->
+                              Int.Int32 -> Repo -> CompletePredicates -> ByteString.Builder
+_build_completePredicates _proxy _seqNum __field__repo
+  __field__predicates
+  = Thrift.genMsgBegin _proxy "completePredicates" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "predicates" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__predicates)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_completePredicates ::
+                            Thrift.Protocol p =>
+                            Proxy.Proxy p ->
+                              Parser.Parser
+                                (Prelude.Either Exception.SomeException CompletePredicatesResponse)
+_parse_completePredicates _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "completePredicates: expected reply but got function call"
+                    2 | _name == "completePredicates" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("completePredicates_success", 0), ("e", 1), ("r", 3), ("u", 4)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser Retry)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "completePredicates: expected reply but got oneway function call"
+                    _ -> Prelude.fail "completePredicates: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+finish ::
+         (Thrift.Protocol p, Thrift.ClientChannel c,
+          (Thrift.<:) s GleanService) =>
+         Repo -> Thrift.ThriftM p c s FinishDatabaseResponse
+finish __field__repo
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift (finishIO _proxy _channel _counter _opts __field__repo)
+
+finishIO ::
+           (Thrift.Protocol p, Thrift.ClientChannel c,
+            (Thrift.<:) s GleanService) =>
+           Proxy.Proxy p ->
+             c s ->
+               Thrift.Counter ->
+                 Thrift.RpcOptions -> Repo -> Prelude.IO FinishDatabaseResponse
+finishIO _proxy _channel _counter _opts __field__repo
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_finish _proxy)
+       send_finish _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+       Thrift.wait _handle
+
+send_finish ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Proxy.Proxy p ->
+                c s ->
+                  Thrift.Counter ->
+                    Thrift.SendCallback ->
+                      Thrift.RecvCallback -> Thrift.RpcOptions -> Repo -> Prelude.IO ()
+send_finish _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__repo
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_finish _proxy _seqNum __field__repo))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_finish ::
+              (Thrift.Protocol p) =>
+              Proxy.Proxy p ->
+                Thrift.Response ->
+                  Prelude.Either Exception.SomeException FinishDatabaseResponse
+recv_finish _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_finish _proxy) _response))
+
+_build_finish ::
+                Thrift.Protocol p =>
+                Proxy.Proxy p -> Int.Int32 -> Repo -> ByteString.Builder
+_build_finish _proxy _seqNum __field__repo
+  = Thrift.genMsgBegin _proxy "finish" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_finish ::
+                Thrift.Protocol p =>
+                Proxy.Proxy p ->
+                  Parser.Parser
+                    (Prelude.Either Exception.SomeException FinishDatabaseResponse)
+_parse_finish _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "finish: expected reply but got function call"
+                    2 | _name == "finish" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("finish_success", 0), ("e", 1), ("c", 2), ("u", 3)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  DatabaseNotIncomplete)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "finish: expected reply but got oneway function call"
+                    _ -> Prelude.fail "finish: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+finalize ::
+           (Thrift.Protocol p, Thrift.ClientChannel c,
+            (Thrift.<:) s GleanService) =>
+           Repo -> Thrift.ThriftM p c s FinalizeResponse
+finalize __field__repo
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (finalizeIO _proxy _channel _counter _opts __field__repo)
+
+finalizeIO ::
+             (Thrift.Protocol p, Thrift.ClientChannel c,
+              (Thrift.<:) s GleanService) =>
+             Proxy.Proxy p ->
+               c s ->
+                 Thrift.Counter ->
+                   Thrift.RpcOptions -> Repo -> Prelude.IO FinalizeResponse
+finalizeIO _proxy _channel _counter _opts __field__repo
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_finalize _proxy)
+       send_finalize _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+       Thrift.wait _handle
+
+send_finalize ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Proxy.Proxy p ->
+                  c s ->
+                    Thrift.Counter ->
+                      Thrift.SendCallback ->
+                        Thrift.RecvCallback -> Thrift.RpcOptions -> Repo -> Prelude.IO ()
+send_finalize _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__repo
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_finalize _proxy _seqNum __field__repo))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_finalize ::
+                (Thrift.Protocol p) =>
+                Proxy.Proxy p ->
+                  Thrift.Response ->
+                    Prelude.Either Exception.SomeException FinalizeResponse
+recv_finalize _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_finalize _proxy) _response))
+
+_build_finalize ::
+                  Thrift.Protocol p =>
+                  Proxy.Proxy p -> Int.Int32 -> Repo -> ByteString.Builder
+_build_finalize _proxy _seqNum __field__repo
+  = Thrift.genMsgBegin _proxy "finalize" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_finalize ::
+                  Thrift.Protocol p =>
+                  Proxy.Proxy p ->
+                    Parser.Parser
+                      (Prelude.Either Exception.SomeException FinalizeResponse)
+_parse_finalize _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "finalize: expected reply but got function call"
+                    2 | _name == "finalize" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("finalize_success", 0), ("e", 1), ("r", 3), ("u", 4)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser Retry)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "finalize: expected reply but got oneway function call"
+                    _ -> Prelude.fail "finalize: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+queryFact ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s GleanService) =>
+            Repo -> Id -> Thrift.ThriftM p c s Fact
+queryFact __field__repo __field__id
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (queryFactIO _proxy _channel _counter _opts __field__repo
+            __field__id)
+
+queryFactIO ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Proxy.Proxy p ->
+                c s ->
+                  Thrift.Counter ->
+                    Thrift.RpcOptions -> Repo -> Id -> Prelude.IO Fact
+queryFactIO _proxy _channel _counter _opts __field__repo
+  __field__id
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_queryFact _proxy)
+       send_queryFact _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__id
+       Thrift.wait _handle
+
+send_queryFact ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.SendCallback ->
+                         Thrift.RecvCallback ->
+                           Thrift.RpcOptions -> Repo -> Id -> Prelude.IO ()
+send_queryFact _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__repo __field__id
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_queryFact _proxy _seqNum __field__repo __field__id))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_queryFact ::
+                 (Thrift.Protocol p) =>
+                 Proxy.Proxy p ->
+                   Thrift.Response -> Prelude.Either Exception.SomeException Fact
+recv_queryFact _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_queryFact _proxy) _response))
+
+_build_queryFact ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p -> Int.Int32 -> Repo -> Id -> ByteString.Builder
+_build_queryFact _proxy _seqNum __field__repo __field__id
+  = Thrift.genMsgBegin _proxy "queryFact" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64 _proxy __field__id)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_queryFact ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p ->
+                     Parser.Parser (Prelude.Either Exception.SomeException Fact)
+_parse_queryFact _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "queryFact: expected reply but got function call"
+                    2 | _name == "queryFact" ->
+                        do let
+                             _idMap = HashMap.fromList [("queryFact_success", 0), ("u", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "queryFact: expected reply but got oneway function call"
+                    _ -> Prelude.fail "queryFact: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+factIdRange ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Repo -> Thrift.ThriftM p c s FactIdRange
+factIdRange __field__repo
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (factIdRangeIO _proxy _channel _counter _opts __field__repo)
+
+factIdRangeIO ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Proxy.Proxy p ->
+                  c s ->
+                    Thrift.Counter ->
+                      Thrift.RpcOptions -> Repo -> Prelude.IO FactIdRange
+factIdRangeIO _proxy _channel _counter _opts __field__repo
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_factIdRange _proxy)
+       send_factIdRange _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+       Thrift.wait _handle
+
+send_factIdRange ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.SendCallback ->
+                           Thrift.RecvCallback -> Thrift.RpcOptions -> Repo -> Prelude.IO ()
+send_factIdRange _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_factIdRange _proxy _seqNum __field__repo))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_factIdRange ::
+                   (Thrift.Protocol p) =>
+                   Proxy.Proxy p ->
+                     Thrift.Response ->
+                       Prelude.Either Exception.SomeException FactIdRange
+recv_factIdRange _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_factIdRange _proxy) _response))
+
+_build_factIdRange ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p -> Int.Int32 -> Repo -> ByteString.Builder
+_build_factIdRange _proxy _seqNum __field__repo
+  = Thrift.genMsgBegin _proxy "factIdRange" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_factIdRange ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p ->
+                       Parser.Parser (Prelude.Either Exception.SomeException FactIdRange)
+_parse_factIdRange _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "factIdRange: expected reply but got function call"
+                    2 | _name == "factIdRange" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList [("factIdRange_success", 0), ("e", 1), ("u", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "factIdRange: expected reply but got oneway function call"
+                    _ -> Prelude.fail "factIdRange: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+predicateStats ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Repo ->
+                   PredicateStatsOpts ->
+                     Thrift.ThriftM p c s (Map.Map Id PredicateStats)
+predicateStats __field__repo __field__opts
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (predicateStatsIO _proxy _channel _counter _opts __field__repo
+            __field__opts)
+
+predicateStatsIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           Repo ->
+                             PredicateStatsOpts -> Prelude.IO (Map.Map Id PredicateStats)
+predicateStatsIO _proxy _channel _counter _opts __field__repo
+  __field__opts
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_predicateStats _proxy)
+       send_predicateStats _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+         __field__opts
+       Thrift.wait _handle
+
+send_predicateStats ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GleanService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> Repo -> PredicateStatsOpts -> Prelude.IO ()
+send_predicateStats _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__opts
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_predicateStats _proxy _seqNum __field__repo __field__opts))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_predicateStats ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException (Map.Map Id PredicateStats)
+recv_predicateStats _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_predicateStats _proxy) _response))
+
+_build_predicateStats ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 -> Repo -> PredicateStatsOpts -> ByteString.Builder
+_build_predicateStats _proxy _seqNum __field__repo __field__opts
+  = Thrift.genMsgBegin _proxy "predicateStats" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "opts" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__opts)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_predicateStats ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException
+                               (Map.Map Id PredicateStats))
+_parse_predicateStats _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "predicateStats: expected reply but got function call"
+                    2 | _name == "predicateStats" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("predicateStats_success", 0), ("e", 1), ("u", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getMapType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Map.fromList <$>
+                                                                                Thrift.parseMap
+                                                                                  _proxy
+                                                                                  (Thrift.parseI64
+                                                                                     _proxy)
+                                                                                  (Thrift.parseStruct
+                                                                                     _proxy)
+                                                                                  Prelude.False)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "predicateStats: expected reply but got oneway function call"
+                    _ -> Prelude.fail "predicateStats: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+listDatabases ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                ListDatabases -> Thrift.ThriftM p c s ListDatabasesResult
+listDatabases __field__l
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (listDatabasesIO _proxy _channel _counter _opts __field__l)
+
+listDatabasesIO ::
+                  (Thrift.Protocol p, Thrift.ClientChannel c,
+                   (Thrift.<:) s GleanService) =>
+                  Proxy.Proxy p ->
+                    c s ->
+                      Thrift.Counter ->
+                        Thrift.RpcOptions ->
+                          ListDatabases -> Prelude.IO ListDatabasesResult
+listDatabasesIO _proxy _channel _counter _opts __field__l
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_listDatabases _proxy)
+       send_listDatabases _proxy _channel _counter _sendCob _recvCob _opts
+         __field__l
+       Thrift.wait _handle
+
+send_listDatabases ::
+                     (Thrift.Protocol p, Thrift.ClientChannel c,
+                      (Thrift.<:) s GleanService) =>
+                     Proxy.Proxy p ->
+                       c s ->
+                         Thrift.Counter ->
+                           Thrift.SendCallback ->
+                             Thrift.RecvCallback ->
+                               Thrift.RpcOptions -> ListDatabases -> Prelude.IO ()
+send_listDatabases _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__l
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_listDatabases _proxy _seqNum __field__l))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_listDatabases ::
+                     (Thrift.Protocol p) =>
+                     Proxy.Proxy p ->
+                       Thrift.Response ->
+                         Prelude.Either Exception.SomeException ListDatabasesResult
+recv_listDatabases _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_listDatabases _proxy) _response))
+
+_build_listDatabases ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p -> Int.Int32 -> ListDatabases -> ByteString.Builder
+_build_listDatabases _proxy _seqNum __field__l
+  = Thrift.genMsgBegin _proxy "listDatabases" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "l" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__l)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_listDatabases ::
+                       Thrift.Protocol p =>
+                       Proxy.Proxy p ->
+                         Parser.Parser
+                           (Prelude.Either Exception.SomeException ListDatabasesResult)
+_parse_listDatabases _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "listDatabases: expected reply but got function call"
+                    2 | _name == "listDatabases" ->
+                        do let
+                             _idMap = HashMap.fromList [("listDatabases_success", 0)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "listDatabases: expected reply but got oneway function call"
+                    _ -> Prelude.fail "listDatabases: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+getDatabase ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Repo -> Thrift.ThriftM p c s GetDatabaseResult
+getDatabase __field__repo
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (getDatabaseIO _proxy _channel _counter _opts __field__repo)
+
+getDatabaseIO ::
+                (Thrift.Protocol p, Thrift.ClientChannel c,
+                 (Thrift.<:) s GleanService) =>
+                Proxy.Proxy p ->
+                  c s ->
+                    Thrift.Counter ->
+                      Thrift.RpcOptions -> Repo -> Prelude.IO GetDatabaseResult
+getDatabaseIO _proxy _channel _counter _opts __field__repo
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_getDatabase _proxy)
+       send_getDatabase _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+       Thrift.wait _handle
+
+send_getDatabase ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.SendCallback ->
+                           Thrift.RecvCallback -> Thrift.RpcOptions -> Repo -> Prelude.IO ()
+send_getDatabase _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_getDatabase _proxy _seqNum __field__repo))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_getDatabase ::
+                   (Thrift.Protocol p) =>
+                   Proxy.Proxy p ->
+                     Thrift.Response ->
+                       Prelude.Either Exception.SomeException GetDatabaseResult
+recv_getDatabase _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_getDatabase _proxy) _response))
+
+_build_getDatabase ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p -> Int.Int32 -> Repo -> ByteString.Builder
+_build_getDatabase _proxy _seqNum __field__repo
+  = Thrift.genMsgBegin _proxy "getDatabase" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_getDatabase ::
+                     Thrift.Protocol p =>
+                     Proxy.Proxy p ->
+                       Parser.Parser
+                         (Prelude.Either Exception.SomeException GetDatabaseResult)
+_parse_getDatabase _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "getDatabase: expected reply but got function call"
+                    2 | _name == "getDatabase" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList [("getDatabase_success", 0), ("e", 1), ("u", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "getDatabase: expected reply but got oneway function call"
+                    _ -> Prelude.fail "getDatabase: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+deleteDatabase ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Repo -> Thrift.ThriftM p c s DeleteDatabaseResult
+deleteDatabase __field__repo
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (deleteDatabaseIO _proxy _channel _counter _opts __field__repo)
+
+deleteDatabaseIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions -> Repo -> Prelude.IO DeleteDatabaseResult
+deleteDatabaseIO _proxy _channel _counter _opts __field__repo
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_deleteDatabase _proxy)
+       send_deleteDatabase _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+       Thrift.wait _handle
+
+send_deleteDatabase ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GleanService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback -> Thrift.RpcOptions -> Repo -> Prelude.IO ()
+send_deleteDatabase _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_deleteDatabase _proxy _seqNum __field__repo))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_deleteDatabase ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException DeleteDatabaseResult
+recv_deleteDatabase _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_deleteDatabase _proxy) _response))
+
+_build_deleteDatabase ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p -> Int.Int32 -> Repo -> ByteString.Builder
+_build_deleteDatabase _proxy _seqNum __field__repo
+  = Thrift.genMsgBegin _proxy "deleteDatabase" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_deleteDatabase ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException DeleteDatabaseResult)
+_parse_deleteDatabase _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "deleteDatabase: expected reply but got function call"
+                    2 | _name == "deleteDatabase" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("deleteDatabase_success", 0), ("e", 1), ("u", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "deleteDatabase: expected reply but got oneway function call"
+                    _ -> Prelude.fail "deleteDatabase: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+restore ::
+          (Thrift.Protocol p, Thrift.ClientChannel c,
+           (Thrift.<:) s GleanService) =>
+          Text.Text -> Thrift.ThriftM p c s ()
+restore __field__locator
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (restoreIO _proxy _channel _counter _opts __field__locator)
+
+restoreIO ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s GleanService) =>
+            Proxy.Proxy p ->
+              c s ->
+                Thrift.Counter -> Thrift.RpcOptions -> Text.Text -> Prelude.IO ()
+restoreIO _proxy _channel _counter _opts __field__locator
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_restore _proxy)
+       send_restore _proxy _channel _counter _sendCob _recvCob _opts
+         __field__locator
+       Thrift.wait _handle
+
+send_restore ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s GleanService) =>
+               Proxy.Proxy p ->
+                 c s ->
+                   Thrift.Counter ->
+                     Thrift.SendCallback ->
+                       Thrift.RecvCallback ->
+                         Thrift.RpcOptions -> Text.Text -> Prelude.IO ()
+send_restore _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__locator
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_restore _proxy _seqNum __field__locator))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_restore ::
+               (Thrift.Protocol p) =>
+               Proxy.Proxy p ->
+                 Thrift.Response -> Prelude.Either Exception.SomeException ()
+recv_restore _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_restore _proxy) _response))
+
+_build_restore ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p -> Int.Int32 -> Text.Text -> ByteString.Builder
+_build_restore _proxy _seqNum __field__locator
+  = Thrift.genMsgBegin _proxy "restore" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__locator)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_restore ::
+                 Thrift.Protocol p =>
+                 Proxy.Proxy p ->
+                   Parser.Parser (Prelude.Either Exception.SomeException ())
+_parse_restore _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "restore: expected reply but got function call"
+                    2 | _name == "restore" ->
+                        do let
+                             _idMap = HashMap.fromList [("e", 1)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  InvalidLocator)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.return (Prelude.Right ())
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "restore: expected reply but got oneway function call"
+                    _ -> Prelude.fail "restore: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+userQueryFacts ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Repo -> UserQueryFacts -> Thrift.ThriftM p c s UserQueryResults
+userQueryFacts __field__repo __field__q
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (userQueryFactsIO _proxy _channel _counter _opts __field__repo
+            __field__q)
+
+userQueryFactsIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           Repo -> UserQueryFacts -> Prelude.IO UserQueryResults
+userQueryFactsIO _proxy _channel _counter _opts __field__repo
+  __field__q
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_userQueryFacts _proxy)
+       send_userQueryFacts _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+         __field__q
+       Thrift.wait _handle
+
+send_userQueryFacts ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GleanService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> Repo -> UserQueryFacts -> Prelude.IO ()
+send_userQueryFacts _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__q
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_userQueryFacts _proxy _seqNum __field__repo __field__q))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_userQueryFacts ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException UserQueryResults
+recv_userQueryFacts _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_userQueryFacts _proxy) _response))
+
+_build_userQueryFacts ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 -> Repo -> UserQueryFacts -> ByteString.Builder
+_build_userQueryFacts _proxy _seqNum __field__repo __field__q
+  = Thrift.genMsgBegin _proxy "userQueryFacts" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "q" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__q)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_userQueryFacts ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException UserQueryResults)
+_parse_userQueryFacts _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "userQueryFacts: expected reply but got function call"
+                    2 | _name == "userQueryFacts" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("userQueryFacts_success", 0), ("e", 1), ("b", 3), ("u", 4),
+                                    ("s", 5)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  BadQuery)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       5 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownSchemaId)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "userQueryFacts: expected reply but got oneway function call"
+                    _ -> Prelude.fail "userQueryFacts: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+userQuery ::
+            (Thrift.Protocol p, Thrift.ClientChannel c,
+             (Thrift.<:) s GleanService) =>
+            Repo -> UserQuery -> Thrift.ThriftM p c s UserQueryResults
+userQuery __field__repo __field__q
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (userQueryIO _proxy _channel _counter _opts __field__repo
+            __field__q)
+
+userQueryIO ::
+              (Thrift.Protocol p, Thrift.ClientChannel c,
+               (Thrift.<:) s GleanService) =>
+              Proxy.Proxy p ->
+                c s ->
+                  Thrift.Counter ->
+                    Thrift.RpcOptions ->
+                      Repo -> UserQuery -> Prelude.IO UserQueryResults
+userQueryIO _proxy _channel _counter _opts __field__repo __field__q
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_userQuery _proxy)
+       send_userQuery _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__q
+       Thrift.wait _handle
+
+send_userQuery ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.SendCallback ->
+                         Thrift.RecvCallback ->
+                           Thrift.RpcOptions -> Repo -> UserQuery -> Prelude.IO ()
+send_userQuery _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__repo __field__q
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_userQuery _proxy _seqNum __field__repo __field__q))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_userQuery ::
+                 (Thrift.Protocol p) =>
+                 Proxy.Proxy p ->
+                   Thrift.Response ->
+                     Prelude.Either Exception.SomeException UserQueryResults
+recv_userQuery _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_userQuery _proxy) _response))
+
+_build_userQuery ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p ->
+                     Int.Int32 -> Repo -> UserQuery -> ByteString.Builder
+_build_userQuery _proxy _seqNum __field__repo __field__q
+  = Thrift.genMsgBegin _proxy "userQuery" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "q" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__q)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_userQuery ::
+                   Thrift.Protocol p =>
+                   Proxy.Proxy p ->
+                     Parser.Parser
+                       (Prelude.Either Exception.SomeException UserQueryResults)
+_parse_userQuery _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "userQuery: expected reply but got function call"
+                    2 | _name == "userQuery" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("userQuery_success", 0), ("e", 1), ("b", 3), ("r", 4),
+                                    ("u", 5), ("s", 6)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  BadQuery)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser Retry)
+                                                                       5 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       6 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownSchemaId)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "userQuery: expected reply but got oneway function call"
+                    _ -> Prelude.fail "userQuery: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+userQueryBatch ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Repo ->
+                   UserQueryBatch ->
+                     Thrift.ThriftM p c s [UserQueryResultsOrException]
+userQueryBatch __field__repo __field__q
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (userQueryBatchIO _proxy _channel _counter _opts __field__repo
+            __field__q)
+
+userQueryBatchIO ::
+                   (Thrift.Protocol p, Thrift.ClientChannel c,
+                    (Thrift.<:) s GleanService) =>
+                   Proxy.Proxy p ->
+                     c s ->
+                       Thrift.Counter ->
+                         Thrift.RpcOptions ->
+                           Repo -> UserQueryBatch -> Prelude.IO [UserQueryResultsOrException]
+userQueryBatchIO _proxy _channel _counter _opts __field__repo
+  __field__q
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_userQueryBatch _proxy)
+       send_userQueryBatch _proxy _channel _counter _sendCob _recvCob
+         _opts
+         __field__repo
+         __field__q
+       Thrift.wait _handle
+
+send_userQueryBatch ::
+                      (Thrift.Protocol p, Thrift.ClientChannel c,
+                       (Thrift.<:) s GleanService) =>
+                      Proxy.Proxy p ->
+                        c s ->
+                          Thrift.Counter ->
+                            Thrift.SendCallback ->
+                              Thrift.RecvCallback ->
+                                Thrift.RpcOptions -> Repo -> UserQueryBatch -> Prelude.IO ()
+send_userQueryBatch _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__q
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_userQueryBatch _proxy _seqNum __field__repo __field__q))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_userQueryBatch ::
+                      (Thrift.Protocol p) =>
+                      Proxy.Proxy p ->
+                        Thrift.Response ->
+                          Prelude.Either Exception.SomeException
+                            [UserQueryResultsOrException]
+recv_userQueryBatch _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_userQueryBatch _proxy) _response))
+
+_build_userQueryBatch ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Int.Int32 -> Repo -> UserQueryBatch -> ByteString.Builder
+_build_userQueryBatch _proxy _seqNum __field__repo __field__q
+  = Thrift.genMsgBegin _proxy "userQueryBatch" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "q" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__q)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_userQueryBatch ::
+                        Thrift.Protocol p =>
+                        Proxy.Proxy p ->
+                          Parser.Parser
+                            (Prelude.Either Exception.SomeException
+                               [UserQueryResultsOrException])
+_parse_userQueryBatch _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "userQueryBatch: expected reply but got function call"
+                    2 | _name == "userQueryBatch" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("userQueryBatch_success", 0), ("e", 1), ("u", 4)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getListType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Prelude.snd <$>
+                                                                                Thrift.parseList
+                                                                                  _proxy
+                                                                                  (Thrift.parseStruct
+                                                                                     _proxy))
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownDatabase)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "userQueryBatch: expected reply but got oneway function call"
+                    _ -> Prelude.fail "userQueryBatch: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
+
+deriveStored ::
+               (Thrift.Protocol p, Thrift.ClientChannel c,
+                (Thrift.<:) s GleanService) =>
+               Repo ->
+                 DerivePredicateQuery -> Thrift.ThriftM p c s DerivationStatus
+deriveStored __field__repo __field__q
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (deriveStoredIO _proxy _channel _counter _opts __field__repo
+            __field__q)
+
+deriveStoredIO ::
+                 (Thrift.Protocol p, Thrift.ClientChannel c,
+                  (Thrift.<:) s GleanService) =>
+                 Proxy.Proxy p ->
+                   c s ->
+                     Thrift.Counter ->
+                       Thrift.RpcOptions ->
+                         Repo -> DerivePredicateQuery -> Prelude.IO DerivationStatus
+deriveStoredIO _proxy _channel _counter _opts __field__repo
+  __field__q
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_deriveStored _proxy)
+       send_deriveStored _proxy _channel _counter _sendCob _recvCob _opts
+         __field__repo
+         __field__q
+       Thrift.wait _handle
+
+send_deriveStored ::
+                    (Thrift.Protocol p, Thrift.ClientChannel c,
+                     (Thrift.<:) s GleanService) =>
+                    Proxy.Proxy p ->
+                      c s ->
+                        Thrift.Counter ->
+                          Thrift.SendCallback ->
+                            Thrift.RecvCallback ->
+                              Thrift.RpcOptions -> Repo -> DerivePredicateQuery -> Prelude.IO ()
+send_deriveStored _proxy _channel _counter _sendCob _recvCob
+  _rpcOpts __field__repo __field__q
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_deriveStored _proxy _seqNum __field__repo __field__q))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_deriveStored ::
+                    (Thrift.Protocol p) =>
+                    Proxy.Proxy p ->
+                      Thrift.Response ->
+                        Prelude.Either Exception.SomeException DerivationStatus
+recv_deriveStored _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_deriveStored _proxy) _response))
+
+_build_deriveStored ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Int.Int32 -> Repo -> DerivePredicateQuery -> ByteString.Builder
+_build_deriveStored _proxy _seqNum __field__repo __field__q
+  = Thrift.genMsgBegin _proxy "deriveStored" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "q" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__q)
+             : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_deriveStored ::
+                      Thrift.Protocol p =>
+                      Proxy.Proxy p ->
+                        Parser.Parser
+                          (Prelude.Either Exception.SomeException DerivationStatus)
+_parse_deriveStored _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail
+                           "deriveStored: expected reply but got function call"
+                    2 | _name == "deriveStored" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList
+                                   [("deriveStored_success", 0), ("e", 1), ("n", 2), ("u", 3),
+                                    ("d", 4)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Exception)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  NotAStoredPredicate)
+                                                                       3 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  UnknownPredicate)
+                                                                       4 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  IncompleteDependencies)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "deriveStored: expected reply but got oneway function call"
+                    _ -> Prelude.fail "deriveStored: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
diff --git a/glean/if/gen-hs2/Glean/GleanService/Service.hs b/glean/if/gen-hs2/Glean/GleanService/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/gen-hs2/Glean/GleanService/Service.hs
@@ -0,0 +1,1904 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GADTs #-}
+module Glean.GleanService.Service
+       (GleanServiceCommand(..), reqName', reqParser', respWriter',
+        methodsInfo')
+       where
+import qualified Control.Exception as Exception
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.FacebookService.Service as FacebookService
+import qualified Fb303.Types as Fb303
+import qualified Glean.Types as Types
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Processor as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Control.Applicative ((<*), (*>))
+import Data.Monoid ((<>))
+import Prelude ((<$>), (<*>), (++), (.), (==))
+
+data GleanServiceCommand a where
+  GetSchemaInfo ::
+    Types.Repo ->
+      Types.GetSchemaInfo -> GleanServiceCommand Types.SchemaInfo
+  GetSchemaInfoForSchema ::
+    Types.GetSchemaInfo -> GleanServiceCommand Types.SchemaInfo
+  ValidateSchema :: Types.ValidateSchema -> GleanServiceCommand ()
+  SendBatch ::
+    Types.ComputedBatch -> GleanServiceCommand Types.SendResponse
+  EnqueueBatch ::
+    Types.Repo ->
+      Types.EnqueueBatch ->
+        Types.EnqueueBatchWaitPolicy ->
+          GleanServiceCommand Types.EnqueueBatchResponse
+  FinishBatch ::
+    Types.Handle -> GleanServiceCommand Types.FinishResponse
+  SendJsonBatch ::
+    Types.Repo ->
+      Types.SendJsonBatch ->
+        GleanServiceCommand Types.SendJsonBatchResponse
+  KickOff ::
+    Types.KickOff -> GleanServiceCommand Types.KickOffResponse
+  UpdateProperties ::
+    Types.Repo ->
+      Types.DatabaseProperties ->
+        [Text.Text] -> GleanServiceCommand Types.UpdatePropertiesResponse
+  CompletePredicates ::
+    Types.Repo ->
+      Types.CompletePredicates ->
+        GleanServiceCommand Types.CompletePredicatesResponse
+  Finish ::
+    Types.Repo -> GleanServiceCommand Types.FinishDatabaseResponse
+  Finalize ::
+    Types.Repo -> GleanServiceCommand Types.FinalizeResponse
+  QueryFact ::
+    Types.Repo -> Types.Id -> GleanServiceCommand Types.Fact
+  FactIdRange :: Types.Repo -> GleanServiceCommand Types.FactIdRange
+  PredicateStats ::
+    Types.Repo ->
+      Types.PredicateStatsOpts ->
+        GleanServiceCommand (Map.Map Types.Id Types.PredicateStats)
+  ListDatabases ::
+    Types.ListDatabases ->
+      GleanServiceCommand Types.ListDatabasesResult
+  GetDatabase ::
+    Types.Repo -> GleanServiceCommand Types.GetDatabaseResult
+  DeleteDatabase ::
+    Types.Repo -> GleanServiceCommand Types.DeleteDatabaseResult
+  Restore :: Text.Text -> GleanServiceCommand ()
+  UserQueryFacts ::
+    Types.Repo ->
+      Types.UserQueryFacts -> GleanServiceCommand Types.UserQueryResults
+  UserQuery ::
+    Types.Repo ->
+      Types.UserQuery -> GleanServiceCommand Types.UserQueryResults
+  UserQueryBatch ::
+    Types.Repo ->
+      Types.UserQueryBatch ->
+        GleanServiceCommand [Types.UserQueryResultsOrException]
+  DeriveStored ::
+    Types.Repo ->
+      Types.DerivePredicateQuery ->
+        GleanServiceCommand Types.DerivationStatus
+  SuperFacebookService ::
+    FacebookService.FacebookServiceCommand a -> GleanServiceCommand a
+
+instance Thrift.Processor GleanServiceCommand where
+  reqName = reqName'
+  reqParser = reqParser'
+  respWriter = respWriter'
+  methodsInfo _ = methodsInfo'
+
+reqName' :: GleanServiceCommand a -> Text.Text
+reqName' (GetSchemaInfo __field__repo __field__get)
+  = "getSchemaInfo"
+reqName' (GetSchemaInfoForSchema __field__get)
+  = "getSchemaInfoForSchema"
+reqName' (ValidateSchema __field__v) = "validateSchema"
+reqName' (SendBatch __field__batch) = "sendBatch"
+reqName'
+  (EnqueueBatch __field__repo __field__batch __field__waitPolicy)
+  = "enqueueBatch"
+reqName' (FinishBatch __field__handle) = "finishBatch"
+reqName' (SendJsonBatch __field__repo __field__s) = "sendJsonBatch"
+reqName' (KickOff __field__request) = "kickOff"
+reqName'
+  (UpdateProperties __field__repo __field__set_ __field__unset)
+  = "updateProperties"
+reqName' (CompletePredicates __field__repo __field__predicates)
+  = "completePredicates"
+reqName' (Finish __field__repo) = "finish"
+reqName' (Finalize __field__repo) = "finalize"
+reqName' (QueryFact __field__repo __field__id) = "queryFact"
+reqName' (FactIdRange __field__repo) = "factIdRange"
+reqName' (PredicateStats __field__repo __field__opts)
+  = "predicateStats"
+reqName' (ListDatabases __field__l) = "listDatabases"
+reqName' (GetDatabase __field__repo) = "getDatabase"
+reqName' (DeleteDatabase __field__repo) = "deleteDatabase"
+reqName' (Restore __field__locator) = "restore"
+reqName' (UserQueryFacts __field__repo __field__q)
+  = "userQueryFacts"
+reqName' (UserQuery __field__repo __field__q) = "userQuery"
+reqName' (UserQueryBatch __field__repo __field__q)
+  = "userQueryBatch"
+reqName' (DeriveStored __field__repo __field__q) = "deriveStored"
+reqName' (SuperFacebookService x) = FacebookService.reqName' x
+
+reqParser' ::
+             Thrift.Protocol p =>
+             Proxy.Proxy p ->
+               Text.Text -> Parser.Parser (Thrift.Some GleanServiceCommand)
+reqParser' _proxy "getSchemaInfo"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__get <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__get
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__get <- ST.readSTRef __field__get
+                                           Prelude.pure
+                                             (Thrift.Some (GetSchemaInfo __val__repo __val__get))
+            _idMap = HashMap.fromList [("repo", 1), ("get", 2)]
+          _parse 0)
+reqParser' _proxy "getSchemaInfoForSchema"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__get <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__get
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__get <- ST.readSTRef __field__get
+                                           Prelude.pure
+                                             (Thrift.Some (GetSchemaInfoForSchema __val__get))
+            _idMap = HashMap.fromList [("get", 1)]
+          _parse 0)
+reqParser' _proxy "validateSchema"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__v <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__v _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__v <- ST.readSTRef __field__v
+                                           Prelude.pure (Thrift.Some (ValidateSchema __val__v))
+            _idMap = HashMap.fromList [("v", 1)]
+          _parse 0)
+reqParser' _proxy "sendBatch"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__batch <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__batch
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__batch <- ST.readSTRef __field__batch
+                                           Prelude.pure (Thrift.Some (SendBatch __val__batch))
+            _idMap = HashMap.fromList [("batch", 1)]
+          _parse 0)
+reqParser' _proxy "enqueueBatch"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__batch <- ST.newSTRef Default.def
+          __field__waitPolicy <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__batch
+                                                                        _val
+                                                               3 | _type == Thrift.getI32Type _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseEnum
+                                                                                    _proxy
+                                                                                    "EnqueueBatchWaitPolicy")
+                                                                      ST.writeSTRef
+                                                                        __field__waitPolicy
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__batch <- ST.readSTRef __field__batch
+                                           !__val__waitPolicy <- ST.readSTRef __field__waitPolicy
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (EnqueueBatch __val__repo __val__batch
+                                                   __val__waitPolicy))
+            _idMap
+              = HashMap.fromList [("repo", 1), ("batch", 2), ("waitPolicy", 3)]
+          _parse 0)
+reqParser' _proxy "finishBatch"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__handle <- ST.newSTRef ""
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseText
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__handle
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__handle <- ST.readSTRef
+                                                               __field__handle
+                                           Prelude.pure (Thrift.Some (FinishBatch __val__handle))
+            _idMap = HashMap.fromList [("handle", 1)]
+          _parse 0)
+reqParser' _proxy "sendJsonBatch"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__s <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__s _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__s <- ST.readSTRef __field__s
+                                           Prelude.pure
+                                             (Thrift.Some (SendJsonBatch __val__repo __val__s))
+            _idMap = HashMap.fromList [("repo", 1), ("s", 2)]
+          _parse 0)
+reqParser' _proxy "kickOff"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           Prelude.pure (Thrift.Some (KickOff __val__request))
+            _idMap = HashMap.fromList [("request", 1)]
+          _parse 0)
+reqParser' _proxy "updateProperties"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__set_ <- ST.newSTRef (HashMap.fromList [])
+          __field__unset <- ST.newSTRef []
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type == Thrift.getMapType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (HashMap.fromList
+                                                                                    <$>
+                                                                                    Thrift.parseMap
+                                                                                      _proxy
+                                                                                      (Thrift.parseText
+                                                                                         _proxy)
+                                                                                      (Thrift.parseText
+                                                                                         _proxy)
+                                                                                      Prelude.True)
+                                                                      ST.writeSTRef __field__set_
+                                                                        _val
+                                                               3 | _type ==
+                                                                     Thrift.getListType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Prelude.snd <$>
+                                                                                    Thrift.parseList
+                                                                                      _proxy
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                      ST.writeSTRef __field__unset
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__set_ <- ST.readSTRef __field__set_
+                                           !__val__unset <- ST.readSTRef __field__unset
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (UpdateProperties __val__repo __val__set_
+                                                   __val__unset))
+            _idMap = HashMap.fromList [("repo", 1), ("set_", 2), ("unset", 3)]
+          _parse 0)
+reqParser' _proxy "completePredicates"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__predicates <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef
+                                                                        __field__predicates
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__predicates <- ST.readSTRef __field__predicates
+                                           Prelude.pure
+                                             (Thrift.Some
+                                                (CompletePredicates __val__repo __val__predicates))
+            _idMap = HashMap.fromList [("repo", 1), ("predicates", 2)]
+          _parse 0)
+reqParser' _proxy "finish"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           Prelude.pure (Thrift.Some (Finish __val__repo))
+            _idMap = HashMap.fromList [("repo", 1)]
+          _parse 0)
+reqParser' _proxy "finalize"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           Prelude.pure (Thrift.Some (Finalize __val__repo))
+            _idMap = HashMap.fromList [("repo", 1)]
+          _parse 0)
+reqParser' _proxy "queryFact"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__id <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type == Thrift.getI64Type _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseI64
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__id _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__id <- ST.readSTRef __field__id
+                                           Prelude.pure
+                                             (Thrift.Some (QueryFact __val__repo __val__id))
+            _idMap = HashMap.fromList [("repo", 1), ("id", 2)]
+          _parse 0)
+reqParser' _proxy "factIdRange"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           Prelude.pure (Thrift.Some (FactIdRange __val__repo))
+            _idMap = HashMap.fromList [("repo", 1)]
+          _parse 0)
+reqParser' _proxy "predicateStats"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__opts <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__opts
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__opts <- ST.readSTRef __field__opts
+                                           Prelude.pure
+                                             (Thrift.Some (PredicateStats __val__repo __val__opts))
+            _idMap = HashMap.fromList [("repo", 1), ("opts", 2)]
+          _parse 0)
+reqParser' _proxy "listDatabases"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__l <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__l _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__l <- ST.readSTRef __field__l
+                                           Prelude.pure (Thrift.Some (ListDatabases __val__l))
+            _idMap = HashMap.fromList [("l", 1)]
+          _parse 0)
+reqParser' _proxy "getDatabase"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           Prelude.pure (Thrift.Some (GetDatabase __val__repo))
+            _idMap = HashMap.fromList [("repo", 1)]
+          _parse 0)
+reqParser' _proxy "deleteDatabase"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           Prelude.pure (Thrift.Some (DeleteDatabase __val__repo))
+            _idMap = HashMap.fromList [("repo", 1)]
+          _parse 0)
+reqParser' _proxy "restore"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__locator <- ST.newSTRef ""
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStringType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseText
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__locator
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                __field__locator
+                                           Prelude.pure (Thrift.Some (Restore __val__locator))
+            _idMap = HashMap.fromList [("locator", 1)]
+          _parse 0)
+reqParser' _proxy "userQueryFacts"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__q <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__q _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__q <- ST.readSTRef __field__q
+                                           Prelude.pure
+                                             (Thrift.Some (UserQueryFacts __val__repo __val__q))
+            _idMap = HashMap.fromList [("repo", 1), ("q", 2)]
+          _parse 0)
+reqParser' _proxy "userQuery"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__q <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__q _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__q <- ST.readSTRef __field__q
+                                           Prelude.pure
+                                             (Thrift.Some (UserQuery __val__repo __val__q))
+            _idMap = HashMap.fromList [("repo", 1), ("q", 2)]
+          _parse 0)
+reqParser' _proxy "userQueryBatch"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__q <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__q _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__q <- ST.readSTRef __field__q
+                                           Prelude.pure
+                                             (Thrift.Some (UserQueryBatch __val__repo __val__q))
+            _idMap = HashMap.fromList [("repo", 1), ("q", 2)]
+          _parse 0)
+reqParser' _proxy "deriveStored"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__repo <- ST.newSTRef Default.def
+          __field__q <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__repo
+                                                                        _val
+                                                               2 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__q _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                           !__val__q <- ST.readSTRef __field__q
+                                           Prelude.pure
+                                             (Thrift.Some (DeriveStored __val__repo __val__q))
+            _idMap = HashMap.fromList [("repo", 1), ("q", 2)]
+          _parse 0)
+reqParser' _proxy funName
+  = do Thrift.Some x <- FacebookService.reqParser' _proxy funName
+       Prelude.return (Thrift.Some (SuperFacebookService x))
+
+respWriter' ::
+              Thrift.Protocol p =>
+              Proxy.Proxy p ->
+                Int.Int32 ->
+                  GleanServiceCommand a ->
+                    Prelude.Either Exception.SomeException a ->
+                      (Builder.Builder,
+                       Prelude.Maybe (Exception.SomeException, Thrift.Blame))
+respWriter' _proxy _seqNum GetSchemaInfo{} _r
+  = (Thrift.genMsgBegin _proxy "getSchemaInfo" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum GetSchemaInfoForSchema{} _r
+  = (Thrift.genMsgBegin _proxy "getSchemaInfoForSchema" _msgType
+       _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum ValidateSchema{} _r
+  = (Thrift.genMsgBegin _proxy "validateSchema" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2, Thrift.genStruct _proxy [],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SendBatch{} _r
+  = (Thrift.genMsgBegin _proxy "sendBatch" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum EnqueueBatch{} _r
+  = (Thrift.genMsgBegin _proxy "enqueueBatch" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.Retry{} <- Exception.fromException _ex ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum FinishBatch{} _r
+  = (Thrift.genMsgBegin _proxy "finishBatch" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.UnknownBatchHandle{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum SendJsonBatch{} _r
+  = (Thrift.genMsgBegin _proxy "sendJsonBatch" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.Retry{} <- Exception.fromException _ex ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum KickOff{} _r
+  = (Thrift.genMsgBegin _proxy "kickOff" _msgType _seqNum <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.InvalidDependency{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum UpdateProperties{} _r
+  = (Thrift.genMsgBegin _proxy "updateProperties" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum CompletePredicates{} _r
+  = (Thrift.genMsgBegin _proxy "completePredicates" _msgType _seqNum
+       <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.Retry{} <- Exception.fromException _ex ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum Finish{} _r
+  = (Thrift.genMsgBegin _proxy "finish" _msgType _seqNum <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.DatabaseNotIncomplete{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "c" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum Finalize{} _r
+  = (Thrift.genMsgBegin _proxy "finalize" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.Retry{} <- Exception.fromException _ex ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum QueryFact{} _r
+  = (Thrift.genMsgBegin _proxy "queryFact" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum FactIdRange{} _r
+  = (Thrift.genMsgBegin _proxy "factIdRange" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum PredicateStats{} _r
+  = (Thrift.genMsgBegin _proxy "predicateStats" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getMapType _proxy) 0 0
+                                         ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                                             (Thrift.getStructType _proxy)
+                                             Prelude.False
+                                             (Thrift.genI64 _proxy)
+                                             (Thrift.buildStruct _proxy)
+                                             . Map.toList)
+                                            _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum ListDatabases{} _r
+  = (Thrift.genMsgBegin _proxy "listDatabases" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum GetDatabase{} _r
+  = (Thrift.genMsgBegin _proxy "getDatabase" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum DeleteDatabase{} _r
+  = (Thrift.genMsgBegin _proxy "deleteDatabase" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum Restore{} _r
+  = (Thrift.genMsgBegin _proxy "restore" _msgType _seqNum <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.InvalidLocator{} <- Exception.fromException
+                                                                         _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2, Thrift.genStruct _proxy [],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum UserQueryFacts{} _r
+  = (Thrift.genMsgBegin _proxy "userQueryFacts" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.BadQuery{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "b" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownSchemaId{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "s" (Thrift.getStructType _proxy) 5 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum UserQuery{} _r
+  = (Thrift.genMsgBegin _proxy "userQuery" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.BadQuery{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "b" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Types.Retry{} <- Exception.fromException _ex ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 5 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownSchemaId{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "s" (Thrift.getStructType _proxy) 6 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum UserQueryBatch{} _r
+  = (Thrift.genMsgBegin _proxy "userQueryBatch" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownDatabase{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getListType _proxy) 0 0
+                                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                            (Thrift.buildStruct _proxy)
+                                            _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum DeriveStored{} _r
+  = (Thrift.genMsgBegin _proxy "deriveStored" _msgType _seqNum <>
+       _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just _e@Types.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.NotAStoredPredicate{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "n" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.UnknownPredicate{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "u" (Thrift.getStructType _proxy) 3 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just
+                               _e@Types.IncompleteDependencies{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "d" (Thrift.getStructType _proxy) 4 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum (SuperFacebookService _x) _r
+  = FacebookService.respWriter' _proxy _seqNum _x _r
+
+methodsInfo' :: Map.Map Text.Text Thrift.MethodInfo
+methodsInfo'
+  = Map.union
+      (Map.fromList
+         [("getSchemaInfo",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("getSchemaInfoForSchema",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("validateSchema",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("sendBatch",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("enqueueBatch",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("finishBatch",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("sendJsonBatch",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("kickOff", Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("updateProperties",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("completePredicates",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("finish", Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("finalize",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("queryFact",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("factIdRange",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("predicateStats",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("listDatabases",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("getDatabase",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("deleteDatabase",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("restore", Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("userQueryFacts",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("userQuery",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("userQueryBatch",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False),
+          ("deriveStored",
+           Thrift.MethodInfo Thrift.NormalPriority Prelude.False)])
+      FacebookService.methodsInfo'
diff --git a/glean/if/gen-hs2/Glean/Types.hs b/glean/if/gen-hs2/Glean/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/gen-hs2/Glean/Types.hs
@@ -0,0 +1,9949 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 8 ".build/def/codegen/thrift-glean-hs/glean/if/gen-hs2/Glean/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Types
+       (Id, ListOfIds, MultimapOfIds, iNVALID_ID, fIRST_FREE_ID, Version,
+        Identifier, PredicateName, TypeName,
+        PosixEpochTime(PosixEpochTime, unPosixEpochTime), Bytestring, Json,
+        PredicateRef(PredicateRef, predicateRef_name,
+                     predicateRef_version),
+        SourcePredicate(SourcePredicate, sourcePredicate_name,
+                        sourcePredicate_version),
+        TypeRef(TypeRef, typeRef_name, typeRef_version), UnitName,
+        Empty(Empty), SchemaId(SchemaId, unSchemaId), Nat(Nat, unNat),
+        Byte(Byte, unByte), Repo(Repo, repo_name, repo_hash),
+        SendJsonBatchOptions(SendJsonBatchOptions,
+                             sendJsonBatchOptions_no_base64_binary,
+                             sendJsonBatchOptions_schema_id),
+        DatabaseProperties,
+        Stacked(Stacked, stacked_name, stacked_hash, stacked_guid),
+        Pruned(Pruned, pruned_base, pruned_units, pruned_exclude,
+               pruned_guid),
+        Dependencies(Dependencies_stacked, Dependencies_pruned), Value,
+        Fact(Fact, fact_type, fact_key, fact_value),
+        FactDependencies(FactDependencies, factDependencies_facts,
+                         factDependencies_dependencies),
+        Batch(Batch, batch_firstId, batch_count, batch_facts, batch_ids,
+              batch_owned, batch_dependencies, batch_schema_id),
+        Subst(Subst, subst_firstId, subst_ids),
+        Error(Error, error_message),
+        Exception(Exception, exception_message),
+        BadQuery(BadQuery, badQuery_message),
+        InvalidLocator(InvalidLocator, invalidLocator_message),
+        Retry(Retry, retry_seconds),
+        UnknownDatabase(UnknownDatabase, unknownDatabase_repo,
+                        unknownDatabase_callStack),
+        InvalidDependency(InvalidDependency, invalidDependency_repo,
+                          invalidDependency_dependency, invalidDependency_reason),
+        UnknownBatchHandle(UnknownBatchHandle),
+        DatabaseNotIncomplete(DatabaseNotIncomplete,
+                              databaseNotIncomplete_status),
+        UnknownSchemaId(UnknownSchemaId, unknownSchemaId_schema_id),
+        DatabaseStatus(DatabaseStatus_Complete, DatabaseStatus_Available,
+                       DatabaseStatus_Incomplete, DatabaseStatus_Restoring,
+                       DatabaseStatus_Broken, DatabaseStatus_Restorable,
+                       DatabaseStatus_Finalizing, DatabaseStatus_Missing),
+        DatabaseBroken(DatabaseBroken, databaseBroken_task,
+                       databaseBroken_reason),
+        DatabaseComplete(DatabaseComplete, databaseComplete_time,
+                         databaseComplete_bytes),
+        Database(Database, database_repo, database_status,
+                 database_location, database_created_since_epoch,
+                 database_expire_time, database_properties, database_completed,
+                 database_repo_hash_time, database_dependencies, database_broken,
+                 database_complete),
+        PredicateStats(PredicateStats, predicateStats_count,
+                       predicateStats_size),
+        Handle,
+        ComputedBatch(ComputedBatch, computedBatch_repo,
+                      computedBatch_remember, computedBatch_batch),
+        BatchRetry(BatchRetry, batchRetry_seconds),
+        SendResponse(SendResponse_handle, SendResponse_retry),
+        FinishResponse(FinishResponse_subst, FinishResponse_retry),
+        FinalizeResponse(FinalizeResponse),
+        FinishDatabaseResponse(FinishDatabaseResponse),
+        UserQueryCont(UserQueryCont, userQueryCont_continuation,
+                      userQueryCont_nextId, userQueryCont_version, userQueryCont_hash,
+                      userQueryCont_returnType, userQueryCont_pids),
+        QuerySyntax(QuerySyntax_JSON, QuerySyntax_ANGLE),
+        UserQueryOptions(UserQueryOptions,
+                         userQueryOptions_no_base64_binary, userQueryOptions_expand_results,
+                         userQueryOptions_recursive, userQueryOptions_max_results,
+                         userQueryOptions_max_bytes, userQueryOptions_max_time_ms,
+                         userQueryOptions_continuation, userQueryOptions_syntax,
+                         userQueryOptions_store_derived_facts,
+                         userQueryOptions_collect_facts_searched, userQueryOptions_debug,
+                         userQueryOptions_omit_results, userQueryOptions_expand_predicates,
+                         userQueryOptions_just_check),
+        QueryDebugOptions(QueryDebugOptions, queryDebugOptions_ir,
+                          queryDebugOptions_bytecode, queryDebugOptions_pred_has_facts),
+        UserQueryEncodingBin(UserQueryEncodingBin),
+        UserQueryEncodingListBin(UserQueryEncodingListBin),
+        UserQueryEncodingJSON(UserQueryEncodingJSON,
+                              userQueryEncodingJSON_expand_results,
+                              userQueryEncodingJSON_no_base64_binary),
+        UserQueryEncodingCompact(UserQueryEncodingCompact,
+                                 userQueryEncodingCompact_expand_results),
+        UserQueryEncoding(UserQueryEncoding_EMPTY, UserQueryEncoding_bin,
+                          UserQueryEncoding_json, UserQueryEncoding_compact,
+                          UserQueryEncoding_listbin),
+        DerivePredicateQuery(DerivePredicateQuery,
+                             derivePredicateQuery_predicate,
+                             derivePredicateQuery_predicate_version,
+                             derivePredicateQuery_client_info, derivePredicateQuery_options,
+                             derivePredicateQuery_parallel),
+        ParallelDerivation(ParallelDerivation,
+                           parallelDerivation_outer_predicate, parallelDerivation_inner_query,
+                           parallelDerivation_min_batch_size),
+        DerivePredicateOptions(DerivePredicateOptions,
+                               derivePredicateOptions_max_results_per_query,
+                               derivePredicateOptions_max_bytes_per_query,
+                               derivePredicateOptions_max_time_ms_per_query,
+                               derivePredicateOptions_collect_facts_searched),
+        NotAStoredPredicate(NotAStoredPredicate),
+        UnknownDerivationHandle(UnknownDerivationHandle),
+        UnknownPredicate(UnknownPredicate, unknownPredicate_predicate),
+        PredicateAlreadyComplete(PredicateAlreadyComplete,
+                                 predicateAlreadyComplete_predicate),
+        PredicateAlreadyBeingDerived(PredicateAlreadyBeingDerived,
+                                     predicateAlreadyBeingDerived_predicate),
+        IncompleteDependencies(IncompleteDependencies,
+                               incompleteDependencies_incomplete),
+        DerivationProgress(DerivationProgress_ongoing,
+                           DerivationProgress_complete),
+        DerivationOngoing(DerivationOngoing, derivationOngoing_stats),
+        DerivationComplete(DerivationComplete, derivationComplete_stats),
+        DerivationStatus(DerivationStatus_ongoing,
+                         DerivationStatus_complete),
+        UserQuery(UserQuery, userQuery_predicate, userQuery_query,
+                  userQuery_predicate_version, userQuery_options,
+                  userQuery_encodings, userQuery_client_info, userQuery_schema_id),
+        UserQueryBatch(UserQueryBatch, userQueryBatch_predicate,
+                       userQueryBatch_queries, userQueryBatch_predicate_version,
+                       userQueryBatch_options, userQueryBatch_encodings,
+                       userQueryBatch_client_info, userQueryBatch_schema_id),
+        UserQueryStats(UserQueryStats, userQueryStats_num_facts,
+                       userQueryStats_elapsed_ns, userQueryStats_allocated_bytes,
+                       userQueryStats_facts_searched, userQueryStats_compile_time_ns,
+                       userQueryStats_bytecode_size, userQueryStats_execute_time_ns,
+                       userQueryStats_result_count, userQueryStats_codegen_time_ns,
+                       userQueryStats_full_scans, userQueryStats_result_bytes),
+        UserQueryResultsBin(UserQueryResultsBin,
+                            userQueryResultsBin_encoding, userQueryResultsBin_facts,
+                            userQueryResultsBin_nestedFacts),
+        UserQueryResultsListBin(UserQueryResultsListBin,
+                                userQueryResultsListBin_encoding, userQueryResultsListBin_ids,
+                                userQueryResultsListBin_facts,
+                                userQueryResultsListBin_nestedFacts),
+        UserQueryResultsJSON(UserQueryResultsJSON,
+                             userQueryResultsJSON_encoding, userQueryResultsJSON_facts,
+                             userQueryResultsJSON_nestedFacts),
+        UserQueryResultsCompact(UserQueryResultsCompact,
+                                userQueryResultsCompact_encoding, userQueryResultsCompact_facts,
+                                userQueryResultsCompact_nestedFacts),
+        UserQueryEncodedResults(UserQueryEncodedResults_EMPTY,
+                                UserQueryEncodedResults_bin, UserQueryEncodedResults_json,
+                                UserQueryEncodedResults_compact, UserQueryEncodedResults_listbin),
+        UserQueryResults(UserQueryResults, userQueryResults_facts,
+                         userQueryResults_stats, userQueryResults_nestedFacts,
+                         userQueryResults_continuation, userQueryResults_diagnostics,
+                         userQueryResults_results, userQueryResults_handle,
+                         userQueryResults_type),
+        RetryException(RetryException, retryException_seconds),
+        BadQueryException(BadQueryException, badQueryException_reason),
+        GleanException(GleanException, gleanException_message),
+        UserQueryResultsOrException(UserQueryResultsOrException_EMPTY,
+                                    UserQueryResultsOrException_results,
+                                    UserQueryResultsOrException_badQuery,
+                                    UserQueryResultsOrException_retry,
+                                    UserQueryResultsOrException_other),
+        FactQuery(FactQuery, factQuery_id, factQuery_predicate_version,
+                  factQuery_recursive),
+        UserQueryFacts(UserQueryFacts, userQueryFacts_facts,
+                       userQueryFacts_options, userQueryFacts_encodings,
+                       userQueryFacts_client_info, userQueryFacts_schema_id),
+        ClientInfo,
+        UserQueryClientInfo(UserQueryClientInfo, userQueryClientInfo_name,
+                            userQueryClientInfo_unixname, userQueryClientInfo_application),
+        ListDatabases(ListDatabases, listDatabases_includeBackups,
+                      listDatabases_client_info),
+        ListDatabasesResult(ListDatabasesResult,
+                            listDatabasesResult_databases),
+        GetDatabaseResult(GetDatabaseResult, getDatabaseResult_database),
+        DeleteDatabaseResult(DeleteDatabaseResult),
+        JsonFactBatch(JsonFactBatch, jsonFactBatch_predicate,
+                      jsonFactBatch_facts, jsonFactBatch_unit),
+        SendJsonBatch(SendJsonBatch, sendJsonBatch_batches,
+                      sendJsonBatch_options, sendJsonBatch_remember),
+        SendJsonBatchResponse(SendJsonBatchResponse,
+                              sendJsonBatchResponse_handle),
+        BatchFormat(BatchFormat_JSON, BatchFormat_Binary,
+                    BatchFormat__UNKNOWN),
+        BatchDescriptor(BatchDescriptor, batchDescriptor_location,
+                        batchDescriptor_format),
+        EnqueueBatch(EnqueueBatch_EMPTY, EnqueueBatch_descriptor),
+        EnqueueBatchWaitPolicy(EnqueueBatchWaitPolicy_None,
+                               EnqueueBatchWaitPolicy_Remember, EnqueueBatchWaitPolicy__UNKNOWN),
+        EnqueueBatchResponse(EnqueueBatchResponse,
+                             enqueueBatchResponse_handle),
+        KickOff(KickOff, kickOff_repo, kickOff_properties,
+                kickOff_dependencies, kickOff_repo_hash_time,
+                kickOff_update_schema_for_stacked),
+        KickOffResponse(KickOffResponse, kickOffResponse_alreadyExists),
+        UpdatePropertiesResponse(UpdatePropertiesResponse),
+        SchemaInfo(SchemaInfo, schemaInfo_schema, schemaInfo_predicateIds,
+                   schemaInfo_schemaIds, schemaInfo_dbSchemaIds,
+                   schemaInfo_otherSchemaIds, schemaInfo_derivationDependencies),
+        SelectSchema(SelectSchema_EMPTY, SelectSchema_stored,
+                     SelectSchema_current, SelectSchema_schema_id),
+        GetSchemaInfo(GetSchemaInfo, getSchemaInfo_select,
+                      getSchemaInfo_omit_source),
+        FactIdRange(FactIdRange, factIdRange_start, factIdRange_finish),
+        ValidateSchema(ValidateSchema, validateSchema_schema),
+        PredicateStatsOpts(PredicateStatsOpts,
+                           predicateStatsOpts_excludeBase),
+        CompleteAxiomPredicates(CompleteAxiomPredicates),
+        CompleteDerivedPredicate(CompleteDerivedPredicate,
+                                 completeDerivedPredicate_predicate),
+        CompletePredicates(CompletePredicates_axiom,
+                           CompletePredicates_derived),
+        CompletePredicatesResponse(CompletePredicatesResponse),
+        PredicateAnnotation(PredicateAnnotation, predicateAnnotation_name,
+                            predicateAnnotation_version),
+        List_Fact_2137, List_Id_2029, List_i64,
+        Map_Id_list_FactDependencies_964, Map_UnitName_listOfIds)
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Vector as Vector
+import qualified Data.Vector.Storable as VectorStorable
+import qualified Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       as Facebook.Thrift.Annotation.Cpp.Cpp
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Fb303.Types as Fb303
+import qualified GHC.Magic as GHC
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 13 "glean/if/glean_include.hs" #-}
+import Compat.Prettyprinter
+{-# LINE 267 ".build/def/codegen/thrift-glean-hs/glean/if/gen-hs2/Glean/Types.hs" #-}
+
+type Id = Int.Int64
+
+type ListOfIds = VectorStorable.Vector Id
+
+type MultimapOfIds = HashMap.HashMap Id ListOfIds
+
+iNVALID_ID :: Id
+iNVALID_ID = 0
+
+fIRST_FREE_ID :: Id
+fIRST_FREE_ID = 1024
+
+type Version = Int.Int32
+
+type Identifier = Text.Text
+
+type PredicateName = Identifier
+
+type TypeName = Identifier
+
+newtype PosixEpochTime = PosixEpochTime{unPosixEpochTime ::
+                                        Int.Int64}
+                         deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable PosixEpochTime where
+  hashWithSalt __salt (PosixEpochTime __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON PosixEpochTime where
+  toJSON (PosixEpochTime __val) = Aeson.toJSON __val
+
+type Bytestring = ByteString.ByteString
+
+type Json = Bytestring
+
+data PredicateRef = PredicateRef{predicateRef_name ::
+                                 PredicateName,
+                                 predicateRef_version :: Version}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateRef where
+  toJSON (PredicateRef __field__name __field__version)
+    = Aeson.object
+        ("name" .= __field__name :
+           "version" .= __field__version : Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateRef where
+  buildStruct _proxy (PredicateRef __field__name __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "version" (Thrift.getI32Type _proxy) 2 1
+             (Thrift.genI32 _proxy __field__version)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__version <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure (PredicateRef __val__name __val__version)
+              _idMap = HashMap.fromList [("name", 1), ("version", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateRef where
+  rnf (PredicateRef __field__name __field__version)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default PredicateRef where
+  def = PredicateRef "" Default.def
+
+instance Hashable.Hashable PredicateRef where
+  hashWithSalt __salt (PredicateRef _name _version)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _version
+
+data SourcePredicate = SourcePredicate{sourcePredicate_name ::
+                                       Text.Text,
+                                       sourcePredicate_version :: Prelude.Maybe Version}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourcePredicate where
+  toJSON (SourcePredicate __field__name __field__version)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("version" .=)) __field__version
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourcePredicate where
+  buildStruct _proxy (SourcePredicate __field__name __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           case __field__version of
+             Prelude.Just _val -> Thrift.genField _proxy "version"
+                                    (Thrift.getI32Type _proxy)
+                                    2
+                                    1
+                                    (Thrift.genI32 _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__version <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure
+                                               (SourcePredicate __val__name __val__version)
+              _idMap = HashMap.fromList [("name", 1), ("version", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourcePredicate where
+  rnf (SourcePredicate __field__name __field__version)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default SourcePredicate where
+  def = SourcePredicate "" Prelude.Nothing
+
+instance Hashable.Hashable SourcePredicate where
+  hashWithSalt __salt (SourcePredicate _name _version)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _version
+
+data TypeRef = TypeRef{typeRef_name :: TypeName,
+                       typeRef_version :: Version}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeRef where
+  toJSON (TypeRef __field__name __field__version)
+    = Aeson.object
+        ("name" .= __field__name :
+           "version" .= __field__version : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeRef where
+  buildStruct _proxy (TypeRef __field__name __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "version" (Thrift.getI32Type _proxy) 2 1
+             (Thrift.genI32 _proxy __field__version)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__version <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure (TypeRef __val__name __val__version)
+              _idMap = HashMap.fromList [("name", 1), ("version", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeRef where
+  rnf (TypeRef __field__name __field__version)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default TypeRef where
+  def = TypeRef "" Default.def
+
+instance Hashable.Hashable TypeRef where
+  hashWithSalt __salt (TypeRef _name _version)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _version
+
+type UnitName = Bytestring
+
+data Empty = Empty{}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Empty where
+  toJSON Empty = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Empty where
+  buildStruct _proxy Empty = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Empty)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Empty where
+  rnf Empty = ()
+
+instance Default.Default Empty where
+  def = Empty
+
+instance Hashable.Hashable Empty where
+  hashWithSalt __salt Empty = __salt
+
+newtype SchemaId = SchemaId{unSchemaId :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable SchemaId where
+  hashWithSalt __salt (SchemaId __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON SchemaId where
+  toJSON (SchemaId __val) = Aeson.toJSON __val
+
+newtype Nat = Nat{unNat :: Int.Int64}
+              deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Nat where
+  hashWithSalt __salt (Nat __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON Nat where
+  toJSON (Nat __val) = Aeson.toJSON __val
+
+newtype Byte = Byte{unByte :: Int.Int8}
+               deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
+
+instance Hashable.Hashable Byte where
+  hashWithSalt __salt (Byte __val)
+    = Hashable.hashWithSalt __salt __val
+
+instance Aeson.ToJSON Byte where
+  toJSON (Byte __val) = Aeson.toJSON __val
+
+data Repo = Repo{repo_name :: Text.Text, repo_hash :: Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Repo where
+  toJSON (Repo __field__name __field__hash)
+    = Aeson.object
+        ("name" .= __field__name :
+           "hash" .= __field__hash : Prelude.mempty)
+
+instance Thrift.ThriftStruct Repo where
+  buildStruct _proxy (Repo __field__name __field__hash)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__hash)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__hash <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__hash <- ST.readSTRef __field__hash
+                                             Prelude.pure (Repo __val__name __val__hash)
+              _idMap = HashMap.fromList [("name", 1), ("hash", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Repo where
+  rnf (Repo __field__name __field__hash)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__hash `Prelude.seq` ()
+
+instance Default.Default Repo where
+  def = Repo "" ""
+
+instance Hashable.Hashable Repo where
+  hashWithSalt __salt (Repo _name _hash)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _hash
+
+data SendJsonBatchOptions = SendJsonBatchOptions{sendJsonBatchOptions_no_base64_binary
+                                                 :: Prelude.Bool,
+                                                 sendJsonBatchOptions_schema_id ::
+                                                 Prelude.Maybe SchemaId}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SendJsonBatchOptions where
+  toJSON
+    (SendJsonBatchOptions __field__no_base64_binary __field__schema_id)
+    = Aeson.object
+        ("no_base64_binary" .= __field__no_base64_binary :
+           Prelude.maybe Prelude.id ((:) . ("schema_id" .=))
+             (Prelude.fmap unSchemaId __field__schema_id)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SendJsonBatchOptions where
+  buildStruct _proxy
+    (SendJsonBatchOptions __field__no_base64_binary __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "no_base64_binary" 1 0
+           __field__no_base64_binary
+           :
+           case __field__schema_id of
+             Prelude.Just _val -> Thrift.genField _proxy "schema_id"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    ((Thrift.genText _proxy . unSchemaId) _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__no_base64_binary <- ST.newSTRef Prelude.False
+            __field__schema_id <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__no_base64_binary
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__no_base64_binary <- ST.readSTRef
+                                                                           __field__no_base64_binary
+                                             !__val__schema_id <- ST.readSTRef __field__schema_id
+                                             Prelude.pure
+                                               (SendJsonBatchOptions __val__no_base64_binary
+                                                  __val__schema_id)
+              _idMap
+                = HashMap.fromList [("no_base64_binary", 1), ("schema_id", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SendJsonBatchOptions where
+  rnf
+    (SendJsonBatchOptions __field__no_base64_binary __field__schema_id)
+    = DeepSeq.rnf __field__no_base64_binary `Prelude.seq`
+        DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default SendJsonBatchOptions where
+  def = SendJsonBatchOptions Prelude.False Prelude.Nothing
+
+instance Hashable.Hashable SendJsonBatchOptions where
+  hashWithSalt __salt
+    (SendJsonBatchOptions _no_base64_binary _schema_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _no_base64_binary)
+        _schema_id
+
+type DatabaseProperties = HashMap.HashMap Text.Text Text.Text
+
+data Stacked = Stacked{stacked_name :: Text.Text,
+                       stacked_hash :: Text.Text, stacked_guid :: Prelude.Maybe Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Stacked where
+  toJSON (Stacked __field__name __field__hash __field__guid)
+    = Aeson.object
+        ("name" .= __field__name :
+           "hash" .= __field__hash :
+             Prelude.maybe Prelude.id ((:) . ("guid" .=)) __field__guid
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct Stacked where
+  buildStruct _proxy
+    (Stacked __field__name __field__hash __field__guid)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__hash)
+             :
+             case __field__guid of
+               Prelude.Just _val -> Thrift.genField _proxy "guid"
+                                      (Thrift.getStringType _proxy)
+                                      3
+                                      2
+                                      (Thrift.genText _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__hash <- ST.newSTRef ""
+            __field__guid <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__guid
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__guid <- ST.readSTRef __field__guid
+                                             Prelude.pure
+                                               (Stacked __val__name __val__hash __val__guid)
+              _idMap = HashMap.fromList [("name", 1), ("hash", 2), ("guid", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Stacked where
+  rnf (Stacked __field__name __field__hash __field__guid)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__hash `Prelude.seq`
+          DeepSeq.rnf __field__guid `Prelude.seq` ()
+
+instance Default.Default Stacked where
+  def = Stacked "" "" Prelude.Nothing
+
+instance Hashable.Hashable Stacked where
+  hashWithSalt __salt (Stacked _name _hash _guid)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _hash)
+        _guid
+
+data Pruned = Pruned{pruned_base :: Repo,
+                     pruned_units :: [ByteString.ByteString],
+                     pruned_exclude :: Prelude.Bool,
+                     pruned_guid :: Prelude.Maybe Text.Text}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Pruned where
+  toJSON
+    (Pruned __field__base __field__units __field__exclude
+       __field__guid)
+    = Aeson.object
+        ("base" .= __field__base :
+           "units" .= Prelude.map Thrift.encodeBase64Text __field__units :
+             "exclude" .= __field__exclude :
+               Prelude.maybe Prelude.id ((:) . ("guid" .=)) __field__guid
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct Pruned where
+  buildStruct _proxy
+    (Pruned __field__base __field__units __field__exclude
+       __field__guid)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "units" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genBytes _proxy)
+                __field__units)
+             :
+             Thrift.genFieldBool _proxy "exclude" 3 2 __field__exclude :
+               case __field__guid of
+                 Prelude.Just _val -> Thrift.genField _proxy "guid"
+                                        (Thrift.getStringType _proxy)
+                                        4
+                                        3
+                                        (Thrift.genText _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__units <- ST.newSTRef Default.def
+            __field__exclude <- ST.newSTRef Prelude.False
+            __field__guid <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseBytes
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__units
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__exclude
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__guid
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__units <- ST.readSTRef __field__units
+                                             !__val__exclude <- ST.readSTRef __field__exclude
+                                             !__val__guid <- ST.readSTRef __field__guid
+                                             Prelude.pure
+                                               (Pruned __val__base __val__units __val__exclude
+                                                  __val__guid)
+              _idMap
+                = HashMap.fromList
+                    [("base", 1), ("units", 2), ("exclude", 3), ("guid", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Pruned where
+  rnf
+    (Pruned __field__base __field__units __field__exclude
+       __field__guid)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__units `Prelude.seq`
+          DeepSeq.rnf __field__exclude `Prelude.seq`
+            DeepSeq.rnf __field__guid `Prelude.seq` ()
+
+instance Default.Default Pruned where
+  def = Pruned Default.def Default.def Prelude.False Prelude.Nothing
+
+instance Hashable.Hashable Pruned where
+  hashWithSalt __salt (Pruned _base _units _exclude _guid)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base) _units)
+           _exclude)
+        _guid
+
+data Dependencies = Dependencies_stacked Stacked
+                  | Dependencies_pruned Pruned
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Dependencies where
+  toJSON (Dependencies_stacked __stacked)
+    = Aeson.object ["stacked" .= __stacked]
+  toJSON (Dependencies_pruned __pruned)
+    = Aeson.object ["pruned" .= __pruned]
+
+instance Thrift.ThriftStruct Dependencies where
+  buildStruct _proxy (Dependencies_stacked __stacked)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "stacked" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __stacked)]
+  buildStruct _proxy (Dependencies_pruned __pruned)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "pruned" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __pruned)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Dependencies_stacked _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Dependencies_pruned _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'Dependencies': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'Dependencies' is empty"
+    where
+      _idMap = HashMap.fromList [("stacked", 1), ("pruned", 2)]
+
+instance DeepSeq.NFData Dependencies where
+  rnf (Dependencies_stacked __stacked) = DeepSeq.rnf __stacked
+  rnf (Dependencies_pruned __pruned) = DeepSeq.rnf __pruned
+
+instance Default.Default Dependencies where
+  def = Dependencies_stacked Default.def
+
+instance Hashable.Hashable Dependencies where
+  hashWithSalt __salt (Dependencies_stacked _stacked)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _stacked)
+  hashWithSalt __salt (Dependencies_pruned _pruned)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _pruned)
+
+type Value = ByteString.ByteString
+
+data Fact = Fact{fact_type :: Id, fact_key :: Value,
+                 fact_value :: Value}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Fact where
+  toJSON (Fact __field__type __field__key __field__value)
+    = Aeson.object
+        ("type" .= __field__type :
+           "key" .= Thrift.encodeBase64Text __field__key :
+             "value" .= Thrift.encodeBase64Text __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct Fact where
+  buildStruct _proxy (Fact __field__type __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__type)
+           :
+           Thrift.genField _proxy "key" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genBytes _proxy __field__key)
+             :
+             Thrift.genField _proxy "value" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genBytes _proxy __field__value)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef ""
+            __field__value <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Fact __val__type __val__key __val__value)
+              _idMap = HashMap.fromList [("type", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Fact where
+  rnf (Fact __field__type __field__key __field__value)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Fact where
+  def = Fact Default.def "" ""
+
+instance Hashable.Hashable Fact where
+  hashWithSalt __salt (Fact _type _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _key)
+        _value
+
+data FactDependencies = FactDependencies{factDependencies_facts ::
+                                         ListOfIds,
+                                         factDependencies_dependencies :: ListOfIds}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FactDependencies where
+  toJSON (FactDependencies __field__facts __field__dependencies)
+    = Aeson.object
+        ("facts" .= __field__facts :
+           "dependencies" .= __field__dependencies : Prelude.mempty)
+
+instance Thrift.ThriftStruct FactDependencies where
+  buildStruct _proxy
+    (FactDependencies __field__facts __field__dependencies)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 1 0
+           ((Thrift.genList _proxy (Thrift.getI64Type _proxy)
+               (Thrift.genI64 _proxy)
+               . VectorStorable.toList)
+              __field__facts)
+           :
+           Thrift.genField _proxy "dependencies" (Thrift.getListType _proxy) 2
+             1
+             ((Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.genI64 _proxy)
+                 . VectorStorable.toList)
+                __field__dependencies)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__facts <- ST.newSTRef VectorStorable.empty
+            __field__dependencies <- ST.newSTRef VectorStorable.empty
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      VectorStorable.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      VectorStorable.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__dependencies
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__dependencies <- ST.readSTRef
+                                                                       __field__dependencies
+                                             Prelude.pure
+                                               (FactDependencies __val__facts __val__dependencies)
+              _idMap = HashMap.fromList [("facts", 1), ("dependencies", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FactDependencies where
+  rnf (FactDependencies __field__facts __field__dependencies)
+    = DeepSeq.rnf __field__facts `Prelude.seq`
+        DeepSeq.rnf __field__dependencies `Prelude.seq` ()
+
+instance Default.Default FactDependencies where
+  def = FactDependencies VectorStorable.empty VectorStorable.empty
+
+instance Hashable.Hashable FactDependencies where
+  hashWithSalt __salt (FactDependencies _facts _dependencies)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt (VectorStorable.toList _facts))
+        (VectorStorable.toList _dependencies)
+
+data Batch = Batch{batch_firstId :: Id, batch_count :: Int.Int64,
+                   batch_facts :: ByteString.ByteString,
+                   batch_ids :: Prelude.Maybe List_i64,
+                   batch_owned :: Map_UnitName_listOfIds,
+                   batch_dependencies :: Map_Id_list_FactDependencies_964,
+                   batch_schema_id :: Prelude.Maybe SchemaId}
+             deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Batch where
+  toJSON
+    (Batch __field__firstId __field__count __field__facts __field__ids
+       __field__owned __field__dependencies __field__schema_id)
+    = Aeson.object
+        ("firstId" .= __field__firstId :
+           "count" .= __field__count :
+             "facts" .= Thrift.encodeBase64Text __field__facts :
+               Prelude.maybe Prelude.id ((:) . ("ids" .=)) __field__ids
+                 ("owned" .=
+                    (Thrift.hmMapKeys Thrift.keyToStr .
+                       Thrift.hmMapKeys Text.decodeUtf8)
+                      __field__owned
+                    :
+                    "dependencies" .=
+                      Thrift.hmMapKeys Thrift.keyToStr __field__dependencies
+                      :
+                      Prelude.maybe Prelude.id ((:) . ("schema_id" .=))
+                        (Prelude.fmap unSchemaId __field__schema_id)
+                        Prelude.mempty))
+
+instance Thrift.ThriftStruct Batch where
+  buildStruct _proxy
+    (Batch __field__firstId __field__count __field__facts __field__ids
+       __field__owned __field__dependencies __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "firstId" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__firstId)
+           :
+           Thrift.genFieldPrim _proxy "count" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64Prim _proxy)
+             __field__count
+             :
+             Thrift.genField _proxy "facts" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genBytes _proxy __field__facts)
+               :
+               let (__cereal__ids, __id__ids)
+                     = case __field__ids of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "ids"
+                                                    (Thrift.getListType _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genListPrim _proxy
+                                                        (Thrift.getI64Type _proxy)
+                                                        (Thrift.genI64Prim _proxy)
+                                                        . VectorStorable.toList)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__ids
+                   (Thrift.genField _proxy "owned" (Thrift.getMapType _proxy) 5
+                      __id__ids
+                      ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                          (Thrift.getListType _proxy)
+                          Prelude.True
+                          (Thrift.genByteString _proxy)
+                          (Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                             (Thrift.genI64 _proxy)
+                             . VectorStorable.toList)
+                          . HashMap.toList)
+                         __field__owned)
+                      :
+                      Thrift.genField _proxy "dependencies" (Thrift.getMapType _proxy) 6
+                        5
+                        ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                            (Thrift.getListType _proxy)
+                            Prelude.False
+                            (Thrift.genI64 _proxy)
+                            (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                               (Thrift.buildStruct _proxy))
+                            . HashMap.toList)
+                           __field__dependencies)
+                        :
+                        case __field__schema_id of
+                          Prelude.Just _val -> Thrift.genField _proxy "schema_id"
+                                                 (Thrift.getStringType _proxy)
+                                                 7
+                                                 6
+                                                 ((Thrift.genText _proxy . unSchemaId) _val)
+                                                 : []
+                          Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__firstId <- ST.newSTRef Default.def
+            __field__count <- ST.newSTRef Default.def
+            __field__facts <- ST.newSTRef ""
+            __field__ids <- ST.newSTRef Prelude.Nothing
+            __field__owned <- ST.newSTRef HashMap.empty
+            __field__dependencies <- ST.newSTRef HashMap.empty
+            __field__schema_id <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__firstId
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__count
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      VectorStorable.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__ids
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy)
+                                                                                        (Prelude.uncurry
+                                                                                           VectorStorable.fromListN
+                                                                                           <$>
+                                                                                           Thrift.parseList
+                                                                                             _proxy
+                                                                                             (Thrift.parseI64
+                                                                                                _proxy))
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef __field__owned
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Prelude.snd
+                                                                                           <$>
+                                                                                           Thrift.parseList
+                                                                                             _proxy
+                                                                                             (Thrift.parseStruct
+                                                                                                _proxy))
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__dependencies
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__firstId <- ST.readSTRef
+                                                                  __field__firstId
+                                             !__val__count <- ST.readSTRef __field__count
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__ids <- ST.readSTRef __field__ids
+                                             !__val__owned <- ST.readSTRef __field__owned
+                                             !__val__dependencies <- ST.readSTRef
+                                                                       __field__dependencies
+                                             !__val__schema_id <- ST.readSTRef __field__schema_id
+                                             Prelude.pure
+                                               (Batch __val__firstId __val__count __val__facts
+                                                  __val__ids
+                                                  __val__owned
+                                                  __val__dependencies
+                                                  __val__schema_id)
+              _idMap
+                = HashMap.fromList
+                    [("firstId", 1), ("count", 2), ("facts", 3), ("ids", 4),
+                     ("owned", 5), ("dependencies", 6), ("schema_id", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Batch where
+  rnf
+    (Batch __field__firstId __field__count __field__facts __field__ids
+       __field__owned __field__dependencies __field__schema_id)
+    = DeepSeq.rnf __field__firstId `Prelude.seq`
+        DeepSeq.rnf __field__count `Prelude.seq`
+          DeepSeq.rnf __field__facts `Prelude.seq`
+            DeepSeq.rnf __field__ids `Prelude.seq`
+              DeepSeq.rnf __field__owned `Prelude.seq`
+                DeepSeq.rnf __field__dependencies `Prelude.seq`
+                  DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default Batch where
+  def
+    = Batch Default.def Default.def "" Prelude.Nothing HashMap.empty
+        HashMap.empty
+        Prelude.Nothing
+
+instance Hashable.Hashable Batch where
+  hashWithSalt __salt
+    (Batch _firstId _count _facts _ids _owned _dependencies _schema_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _firstId)
+                       _count)
+                    _facts)
+                 (Prelude.fmap VectorStorable.toList _ids))
+              ((List.sort .
+                  Prelude.map (\ (_k, _v) -> (_k, VectorStorable.toList _v)) .
+                    HashMap.toList)
+                 _owned))
+           ((List.sort .
+               Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+              _dependencies))
+        _schema_id
+
+instance Ord.Ord Batch where
+  compare __a __b
+    = case Ord.compare (batch_firstId __a) (batch_firstId __b) of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case Ord.compare (batch_count __a) (batch_count __b) of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> case Ord.compare (batch_facts __a) (batch_facts __b) of
+                                Ord.LT -> Ord.LT
+                                Ord.GT -> Ord.GT
+                                Ord.EQ -> case Ord.compare (batch_ids __a) (batch_ids __b) of
+                                            Ord.LT -> Ord.LT
+                                            Ord.GT -> Ord.GT
+                                            Ord.EQ -> case
+                                                        Ord.compare
+                                                          ((List.sort .
+                                                              Prelude.map (\ (_k, _v) -> (_k, _v)) .
+                                                                HashMap.toList)
+                                                             (batch_owned __a))
+                                                          ((List.sort .
+                                                              Prelude.map (\ (_k, _v) -> (_k, _v)) .
+                                                                HashMap.toList)
+                                                             (batch_owned __b))
+                                                        of
+                                                        Ord.LT -> Ord.LT
+                                                        Ord.GT -> Ord.GT
+                                                        Ord.EQ -> case
+                                                                    Ord.compare
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (batch_dependencies __a))
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (batch_dependencies __b))
+                                                                    of
+                                                                    Ord.LT -> Ord.LT
+                                                                    Ord.GT -> Ord.GT
+                                                                    Ord.EQ -> Ord.compare
+                                                                                (batch_schema_id
+                                                                                   __a)
+                                                                                (batch_schema_id
+                                                                                   __b)
+
+data Subst = Subst{subst_firstId :: Id, subst_ids :: List_i64}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Subst where
+  toJSON (Subst __field__firstId __field__ids)
+    = Aeson.object
+        ("firstId" .= __field__firstId :
+           "ids" .= __field__ids : Prelude.mempty)
+
+instance Thrift.ThriftStruct Subst where
+  buildStruct _proxy (Subst __field__firstId __field__ids)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "firstId" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__firstId)
+           :
+           Thrift.genField _proxy "ids" (Thrift.getListType _proxy) 2 1
+             ((Thrift.genListPrim _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.genI64Prim _proxy)
+                 . VectorStorable.toList)
+                __field__ids)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__firstId <- ST.newSTRef Default.def
+            __field__ids <- ST.newSTRef VectorStorable.empty
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__firstId
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      VectorStorable.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__ids
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__firstId <- ST.readSTRef
+                                                                  __field__firstId
+                                             !__val__ids <- ST.readSTRef __field__ids
+                                             Prelude.pure (Subst __val__firstId __val__ids)
+              _idMap = HashMap.fromList [("firstId", 1), ("ids", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Subst where
+  rnf (Subst __field__firstId __field__ids)
+    = DeepSeq.rnf __field__firstId `Prelude.seq`
+        DeepSeq.rnf __field__ids `Prelude.seq` ()
+
+instance Default.Default Subst where
+  def = Subst Default.def VectorStorable.empty
+
+instance Hashable.Hashable Subst where
+  hashWithSalt __salt (Subst _firstId _ids)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _firstId)
+        (VectorStorable.toList _ids)
+
+newtype Error = Error{error_message :: Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Error where
+  toJSON (Error __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct Error where
+  buildStruct _proxy (Error __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (Error __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Error where
+  rnf (Error __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default Error where
+  def = Error ""
+
+instance Hashable.Hashable Error where
+  hashWithSalt __salt (Error _message)
+    = Hashable.hashWithSalt __salt _message
+
+newtype Exception = Exception{exception_message :: Text.Text}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Exception where
+  toJSON (Exception __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct Exception where
+  buildStruct _proxy (Exception __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (Exception __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Exception where
+  rnf (Exception __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default Exception where
+  def = Exception ""
+
+instance Hashable.Hashable Exception where
+  hashWithSalt __salt (Exception _message)
+    = Hashable.hashWithSalt __salt _message
+
+instance Exception.Exception Exception
+
+newtype BadQuery = BadQuery{badQuery_message :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BadQuery where
+  toJSON (BadQuery __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct BadQuery where
+  buildStruct _proxy (BadQuery __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (BadQuery __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData BadQuery where
+  rnf (BadQuery __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default BadQuery where
+  def = BadQuery ""
+
+instance Hashable.Hashable BadQuery where
+  hashWithSalt __salt (BadQuery _message)
+    = Hashable.hashWithSalt __salt _message
+
+instance Exception.Exception BadQuery
+
+newtype InvalidLocator = InvalidLocator{invalidLocator_message ::
+                                        Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InvalidLocator where
+  toJSON (InvalidLocator __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct InvalidLocator where
+  buildStruct _proxy (InvalidLocator __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (InvalidLocator __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData InvalidLocator where
+  rnf (InvalidLocator __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default InvalidLocator where
+  def = InvalidLocator ""
+
+instance Hashable.Hashable InvalidLocator where
+  hashWithSalt __salt (InvalidLocator _message)
+    = Hashable.hashWithSalt __salt _message
+
+instance Exception.Exception InvalidLocator
+
+newtype Retry = Retry{retry_seconds :: Prelude.Double}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Retry where
+  toJSON (Retry __field__seconds)
+    = Aeson.object ("seconds" .= __field__seconds : Prelude.mempty)
+
+instance Thrift.ThriftStruct Retry where
+  buildStruct _proxy (Retry __field__seconds)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "seconds" (Thrift.getDoubleType _proxy) 1 0
+           (Thrift.genDouble _proxy __field__seconds)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__seconds <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getDoubleType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseDouble
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__seconds
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__seconds <- ST.readSTRef
+                                                                  __field__seconds
+                                             Prelude.pure (Retry __val__seconds)
+              _idMap = HashMap.fromList [("seconds", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Retry where
+  rnf (Retry __field__seconds)
+    = DeepSeq.rnf __field__seconds `Prelude.seq` ()
+
+instance Default.Default Retry where
+  def = Retry Default.def
+
+instance Hashable.Hashable Retry where
+  hashWithSalt __salt (Retry _seconds)
+    = Hashable.hashWithSalt __salt _seconds
+
+instance Exception.Exception Retry
+
+data UnknownDatabase = UnknownDatabase{unknownDatabase_repo ::
+                                       Repo,
+                                       unknownDatabase_callStack :: Text.Text}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnknownDatabase where
+  toJSON (UnknownDatabase __field__repo __field__callStack)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "callStack" .= __field__callStack : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnknownDatabase where
+  buildStruct _proxy
+    (UnknownDatabase __field__repo __field__callStack)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "callStack" (Thrift.getStringType _proxy) 2
+             1
+             (Thrift.genText _proxy __field__callStack)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__callStack <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callStack
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__callStack <- ST.readSTRef __field__callStack
+                                             Prelude.pure
+                                               (UnknownDatabase __val__repo __val__callStack)
+              _idMap = HashMap.fromList [("repo", 1), ("callStack", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnknownDatabase where
+  rnf (UnknownDatabase __field__repo __field__callStack)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__callStack `Prelude.seq` ()
+
+instance Default.Default UnknownDatabase where
+  def = UnknownDatabase Default.def ""
+
+instance Hashable.Hashable UnknownDatabase where
+  hashWithSalt __salt (UnknownDatabase _repo _callStack)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo)
+        _callStack
+
+instance Exception.Exception UnknownDatabase
+
+data InvalidDependency = InvalidDependency{invalidDependency_repo
+                                           :: Repo,
+                                           invalidDependency_dependency :: Repo,
+                                           invalidDependency_reason :: Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InvalidDependency where
+  toJSON
+    (InvalidDependency __field__repo __field__dependency
+       __field__reason)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "dependency" .= __field__dependency :
+             "reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct InvalidDependency where
+  buildStruct _proxy
+    (InvalidDependency __field__repo __field__dependency
+       __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "dependency" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__dependency)
+             :
+             Thrift.genField _proxy "reason" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__reason)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__dependency <- ST.newSTRef Default.def
+            __field__reason <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__dependency
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__dependency <- ST.readSTRef __field__dependency
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             Prelude.pure
+                                               (InvalidDependency __val__repo __val__dependency
+                                                  __val__reason)
+              _idMap
+                = HashMap.fromList [("repo", 1), ("dependency", 2), ("reason", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData InvalidDependency where
+  rnf
+    (InvalidDependency __field__repo __field__dependency
+       __field__reason)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__dependency `Prelude.seq`
+          DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default InvalidDependency where
+  def = InvalidDependency Default.def Default.def ""
+
+instance Hashable.Hashable InvalidDependency where
+  hashWithSalt __salt (InvalidDependency _repo _dependency _reason)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo)
+           _dependency)
+        _reason
+
+instance Exception.Exception InvalidDependency
+
+data UnknownBatchHandle = UnknownBatchHandle{}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnknownBatchHandle where
+  toJSON UnknownBatchHandle = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UnknownBatchHandle where
+  buildStruct _proxy UnknownBatchHandle = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UnknownBatchHandle)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UnknownBatchHandle where
+  rnf UnknownBatchHandle = ()
+
+instance Default.Default UnknownBatchHandle where
+  def = UnknownBatchHandle
+
+instance Hashable.Hashable UnknownBatchHandle where
+  hashWithSalt __salt UnknownBatchHandle = __salt
+
+instance Exception.Exception UnknownBatchHandle
+
+newtype DatabaseNotIncomplete = DatabaseNotIncomplete{databaseNotIncomplete_status
+                                                      :: DatabaseStatus}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseNotIncomplete where
+  toJSON (DatabaseNotIncomplete __field__status)
+    = Aeson.object ("status" .= __field__status : Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseNotIncomplete where
+  buildStruct _proxy (DatabaseNotIncomplete __field__status)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "status" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__status)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__status <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnumNoUnknown
+                                                                                      _proxy
+                                                                                      "DatabaseStatus")
+                                                                        ST.writeSTRef
+                                                                          __field__status
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__status <- ST.readSTRef
+                                                                 __field__status
+                                             Prelude.pure (DatabaseNotIncomplete __val__status)
+              _idMap = HashMap.fromList [("status", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseNotIncomplete where
+  rnf (DatabaseNotIncomplete __field__status)
+    = DeepSeq.rnf __field__status `Prelude.seq` ()
+
+instance Default.Default DatabaseNotIncomplete where
+  def = DatabaseNotIncomplete Default.def
+
+instance Hashable.Hashable DatabaseNotIncomplete where
+  hashWithSalt __salt (DatabaseNotIncomplete _status)
+    = Hashable.hashWithSalt __salt _status
+
+instance Exception.Exception DatabaseNotIncomplete
+
+newtype UnknownSchemaId = UnknownSchemaId{unknownSchemaId_schema_id
+                                          :: SchemaId}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnknownSchemaId where
+  toJSON (UnknownSchemaId __field__schema_id)
+    = Aeson.object
+        ("schema_id" .= unSchemaId __field__schema_id : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnknownSchemaId where
+  buildStruct _proxy (UnknownSchemaId __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "schema_id" (Thrift.getStringType _proxy) 1
+           0
+           ((Thrift.genText _proxy . unSchemaId) __field__schema_id)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__schema_id <- ST.newSTRef (SchemaId "")
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__schema_id <- ST.readSTRef
+                                                                    __field__schema_id
+                                             Prelude.pure (UnknownSchemaId __val__schema_id)
+              _idMap = HashMap.fromList [("schema_id", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData UnknownSchemaId where
+  rnf (UnknownSchemaId __field__schema_id)
+    = DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default UnknownSchemaId where
+  def = UnknownSchemaId (SchemaId "")
+
+instance Hashable.Hashable UnknownSchemaId where
+  hashWithSalt __salt (UnknownSchemaId _schema_id)
+    = Hashable.hashWithSalt __salt _schema_id
+
+instance Exception.Exception UnknownSchemaId
+
+data DatabaseStatus = DatabaseStatus_Complete
+                    | DatabaseStatus_Incomplete
+                    | DatabaseStatus_Restoring
+                    | DatabaseStatus_Broken
+                    | DatabaseStatus_Restorable
+                    | DatabaseStatus_Finalizing
+                    | DatabaseStatus_Missing
+                    | DatabaseStatus_Available
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseStatus where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData DatabaseStatus where
+  rnf __DatabaseStatus = Prelude.seq __DatabaseStatus ()
+
+instance Default.Default DatabaseStatus where
+  def = DatabaseStatus_Complete
+
+instance Hashable.Hashable DatabaseStatus where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum DatabaseStatus where
+  toThriftEnum 0 = DatabaseStatus_Complete
+  toThriftEnum 7 = DatabaseStatus_Available
+  toThriftEnum 1 = DatabaseStatus_Incomplete
+  toThriftEnum 2 = DatabaseStatus_Restoring
+  toThriftEnum 3 = DatabaseStatus_Broken
+  toThriftEnum 4 = DatabaseStatus_Restorable
+  toThriftEnum 5 = DatabaseStatus_Finalizing
+  toThriftEnum 6 = DatabaseStatus_Missing
+  toThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("toThriftEnum: not a valid identifier for enum DatabaseStatus: "
+              ++ Prelude.show _val))
+  fromThriftEnum DatabaseStatus_Complete = 0
+  fromThriftEnum DatabaseStatus_Available = 7
+  fromThriftEnum DatabaseStatus_Incomplete = 1
+  fromThriftEnum DatabaseStatus_Restoring = 2
+  fromThriftEnum DatabaseStatus_Broken = 3
+  fromThriftEnum DatabaseStatus_Restorable = 4
+  fromThriftEnum DatabaseStatus_Finalizing = 5
+  fromThriftEnum DatabaseStatus_Missing = 6
+  fromThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("fromThriftEnum: not a valid identifier for enum DatabaseStatus: "
+              ++ Prelude.show _val))
+  allThriftEnumValues
+    = [DatabaseStatus_Complete, DatabaseStatus_Incomplete,
+       DatabaseStatus_Restoring, DatabaseStatus_Broken,
+       DatabaseStatus_Restorable, DatabaseStatus_Finalizing,
+       DatabaseStatus_Missing, DatabaseStatus_Available]
+  toThriftEnumEither 0 = Prelude.Right DatabaseStatus_Complete
+  toThriftEnumEither 7 = Prelude.Right DatabaseStatus_Available
+  toThriftEnumEither 1 = Prelude.Right DatabaseStatus_Incomplete
+  toThriftEnumEither 2 = Prelude.Right DatabaseStatus_Restoring
+  toThriftEnumEither 3 = Prelude.Right DatabaseStatus_Broken
+  toThriftEnumEither 4 = Prelude.Right DatabaseStatus_Restorable
+  toThriftEnumEither 5 = Prelude.Right DatabaseStatus_Finalizing
+  toThriftEnumEither 6 = Prelude.Right DatabaseStatus_Missing
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum DatabaseStatus: "
+           ++ Prelude.show val)
+
+data DatabaseBroken = DatabaseBroken{databaseBroken_task ::
+                                     Text.Text,
+                                     databaseBroken_reason :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseBroken where
+  toJSON (DatabaseBroken __field__task __field__reason)
+    = Aeson.object
+        ("task" .= __field__task :
+           "reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseBroken where
+  buildStruct _proxy (DatabaseBroken __field__task __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "task" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__task)
+           :
+           Thrift.genField _proxy "reason" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__reason)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__task <- ST.newSTRef ""
+            __field__reason <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__task
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__task <- ST.readSTRef __field__task
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             Prelude.pure (DatabaseBroken __val__task __val__reason)
+              _idMap = HashMap.fromList [("task", 1), ("reason", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseBroken where
+  rnf (DatabaseBroken __field__task __field__reason)
+    = DeepSeq.rnf __field__task `Prelude.seq`
+        DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default DatabaseBroken where
+  def = DatabaseBroken "" ""
+
+instance Hashable.Hashable DatabaseBroken where
+  hashWithSalt __salt (DatabaseBroken _task _reason)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _task)
+        _reason
+
+data DatabaseComplete = DatabaseComplete{databaseComplete_time ::
+                                         PosixEpochTime,
+                                         databaseComplete_bytes :: Prelude.Maybe Int.Int64}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseComplete where
+  toJSON (DatabaseComplete __field__time __field__bytes)
+    = Aeson.object
+        ("time" .= unPosixEpochTime __field__time :
+           Prelude.maybe Prelude.id ((:) . ("bytes" .=)) __field__bytes
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DatabaseComplete where
+  buildStruct _proxy (DatabaseComplete __field__time __field__bytes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "time" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . unPosixEpochTime) __field__time)
+           :
+           case __field__bytes of
+             Prelude.Just _val -> Thrift.genFieldPrim _proxy "bytes"
+                                    (Thrift.getI64Type _proxy)
+                                    2
+                                    1
+                                    (Thrift.genI64Prim _proxy)
+                                    _val
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__time <- ST.newSTRef (PosixEpochTime Default.def)
+            __field__bytes <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__time
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__bytes
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__time <- ST.readSTRef __field__time
+                                             !__val__bytes <- ST.readSTRef __field__bytes
+                                             Prelude.pure
+                                               (DatabaseComplete __val__time __val__bytes)
+              _idMap = HashMap.fromList [("time", 1), ("bytes", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseComplete where
+  rnf (DatabaseComplete __field__time __field__bytes)
+    = DeepSeq.rnf __field__time `Prelude.seq`
+        DeepSeq.rnf __field__bytes `Prelude.seq` ()
+
+instance Default.Default DatabaseComplete where
+  def = DatabaseComplete (PosixEpochTime Default.def) Prelude.Nothing
+
+instance Hashable.Hashable DatabaseComplete where
+  hashWithSalt __salt (DatabaseComplete _time _bytes)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _time) _bytes
+
+data Database = Database{database_repo :: Repo,
+                         database_status :: DatabaseStatus,
+                         database_location :: Prelude.Maybe Text.Text,
+                         database_created_since_epoch :: PosixEpochTime,
+                         database_expire_time :: Prelude.Maybe PosixEpochTime,
+                         database_properties :: DatabaseProperties,
+                         database_completed :: Prelude.Maybe PosixEpochTime,
+                         database_repo_hash_time :: Prelude.Maybe PosixEpochTime,
+                         database_dependencies :: Prelude.Maybe Dependencies,
+                         database_broken :: Prelude.Maybe DatabaseBroken,
+                         database_complete :: Prelude.Maybe DatabaseComplete}
+                deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Database where
+  toJSON
+    (Database __field__repo __field__status __field__location
+       __field__created_since_epoch __field__expire_time
+       __field__properties __field__completed __field__repo_hash_time
+       __field__dependencies __field__broken __field__complete)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "status" .= __field__status :
+             Prelude.maybe Prelude.id ((:) . ("location" .=)) __field__location
+               ("created_since_epoch" .=
+                  unPosixEpochTime __field__created_since_epoch
+                  :
+                  Prelude.maybe Prelude.id ((:) . ("expire_time" .=))
+                    (Prelude.fmap unPosixEpochTime __field__expire_time)
+                    ("properties" .= __field__properties :
+                       Prelude.maybe Prelude.id ((:) . ("completed" .=))
+                         (Prelude.fmap unPosixEpochTime __field__completed)
+                         (Prelude.maybe Prelude.id ((:) . ("repo_hash_time" .=))
+                            (Prelude.fmap unPosixEpochTime __field__repo_hash_time)
+                            (Prelude.maybe Prelude.id ((:) . ("dependencies" .=))
+                               __field__dependencies
+                               (Prelude.maybe Prelude.id ((:) . ("broken" .=)) __field__broken
+                                  (Prelude.maybe Prelude.id ((:) . ("complete" .=))
+                                     __field__complete
+                                     Prelude.mempty)))))))
+
+instance Thrift.ThriftStruct Database where
+  buildStruct _proxy
+    (Database __field__repo __field__status __field__location
+       __field__created_since_epoch __field__expire_time
+       __field__properties __field__completed __field__repo_hash_time
+       __field__dependencies __field__broken __field__complete)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "status" (Thrift.getI32Type _proxy) 4 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__status)
+             :
+             let (__cereal__location, __id__location)
+                   = case __field__location of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "location"
+                                                  (Thrift.getStringType _proxy)
+                                                  5
+                                                  4
+                                                  (Thrift.genText _proxy _val)),
+                                             5)
+                       Prelude.Nothing -> (Prelude.id, 4)
+               in
+               __cereal__location
+                 (Thrift.genField _proxy "created_since_epoch"
+                    (Thrift.getI64Type _proxy)
+                    6
+                    __id__location
+                    ((Thrift.genI64 _proxy . unPosixEpochTime)
+                       __field__created_since_epoch)
+                    :
+                    let (__cereal__expire_time, __id__expire_time)
+                          = case __field__expire_time of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "expire_time"
+                                                         (Thrift.getI64Type _proxy)
+                                                         7
+                                                         6
+                                                         ((Thrift.genI64 _proxy . unPosixEpochTime)
+                                                            _val)),
+                                                    7)
+                              Prelude.Nothing -> (Prelude.id, 6)
+                      in
+                      __cereal__expire_time
+                        (Thrift.genField _proxy "properties" (Thrift.getMapType _proxy) 8
+                           __id__expire_time
+                           ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                               (Thrift.getStringType _proxy)
+                               Prelude.True
+                               (Thrift.genText _proxy)
+                               (Thrift.genText _proxy)
+                               . HashMap.toList)
+                              __field__properties)
+                           :
+                           let (__cereal__completed, __id__completed)
+                                 = case __field__completed of
+                                     Prelude.Just _val -> ((:)
+                                                             (Thrift.genField _proxy "completed"
+                                                                (Thrift.getI64Type _proxy)
+                                                                9
+                                                                8
+                                                                ((Thrift.genI64 _proxy .
+                                                                    unPosixEpochTime)
+                                                                   _val)),
+                                                           9)
+                                     Prelude.Nothing -> (Prelude.id, 8)
+                             in
+                             __cereal__completed
+                               (let (__cereal__repo_hash_time, __id__repo_hash_time)
+                                      = case __field__repo_hash_time of
+                                          Prelude.Just _val -> ((:)
+                                                                  (Thrift.genField _proxy
+                                                                     "repo_hash_time"
+                                                                     (Thrift.getI64Type _proxy)
+                                                                     10
+                                                                     __id__completed
+                                                                     ((Thrift.genI64 _proxy .
+                                                                         unPosixEpochTime)
+                                                                        _val)),
+                                                                10)
+                                          Prelude.Nothing -> (Prelude.id, __id__completed)
+                                  in
+                                  __cereal__repo_hash_time
+                                    (let (__cereal__dependencies, __id__dependencies)
+                                           = case __field__dependencies of
+                                               Prelude.Just _val -> ((:)
+                                                                       (Thrift.genField _proxy
+                                                                          "dependencies"
+                                                                          (Thrift.getStructType
+                                                                             _proxy)
+                                                                          11
+                                                                          __id__repo_hash_time
+                                                                          (Thrift.buildStruct _proxy
+                                                                             _val)),
+                                                                     11)
+                                               Prelude.Nothing -> (Prelude.id, __id__repo_hash_time)
+                                       in
+                                       __cereal__dependencies
+                                         (let (__cereal__broken, __id__broken)
+                                                = case __field__broken of
+                                                    Prelude.Just _val -> ((:)
+                                                                            (Thrift.genField _proxy
+                                                                               "broken"
+                                                                               (Thrift.getStructType
+                                                                                  _proxy)
+                                                                               12
+                                                                               __id__dependencies
+                                                                               (Thrift.buildStruct
+                                                                                  _proxy
+                                                                                  _val)),
+                                                                          12)
+                                                    Prelude.Nothing -> (Prelude.id,
+                                                                        __id__dependencies)
+                                            in
+                                            __cereal__broken
+                                              (case __field__complete of
+                                                 Prelude.Just _val -> Thrift.genField _proxy
+                                                                        "complete"
+                                                                        (Thrift.getStructType
+                                                                           _proxy)
+                                                                        13
+                                                                        __id__broken
+                                                                        (Thrift.buildStruct _proxy
+                                                                           _val)
+                                                                        : []
+                                                 Prelude.Nothing -> [])))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__status <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Prelude.Nothing
+            __field__created_since_epoch <- ST.newSTRef
+                                              (PosixEpochTime Default.def)
+            __field__expire_time <- ST.newSTRef Prelude.Nothing
+            __field__properties <- ST.newSTRef HashMap.empty
+            __field__completed <- ST.newSTRef Prelude.Nothing
+            __field__repo_hash_time <- ST.newSTRef Prelude.Nothing
+            __field__dependencies <- ST.newSTRef Prelude.Nothing
+            __field__broken <- ST.newSTRef Prelude.Nothing
+            __field__complete <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnumNoUnknown
+                                                                                      _proxy
+                                                                                      "DatabaseStatus")
+                                                                        ST.writeSTRef
+                                                                          __field__status
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__created_since_epoch
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__expire_time
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__properties
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__completed
+                                                                          (Prelude.Just _val)
+                                                                 10 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.fmap
+                                                                                       PosixEpochTime
+                                                                                       (Thrift.parseI64
+                                                                                          _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__repo_hash_time
+                                                                           (Prelude.Just _val)
+                                                                 11 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__dependencies
+                                                                           (Prelude.Just _val)
+                                                                 12 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__broken
+                                                                           (Prelude.Just _val)
+                                                                 13 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__complete
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__status <- ST.readSTRef __field__status
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__created_since_epoch <- ST.readSTRef
+                                                                              __field__created_since_epoch
+                                             !__val__expire_time <- ST.readSTRef
+                                                                      __field__expire_time
+                                             !__val__properties <- ST.readSTRef __field__properties
+                                             !__val__completed <- ST.readSTRef __field__completed
+                                             !__val__repo_hash_time <- ST.readSTRef
+                                                                         __field__repo_hash_time
+                                             !__val__dependencies <- ST.readSTRef
+                                                                       __field__dependencies
+                                             !__val__broken <- ST.readSTRef __field__broken
+                                             !__val__complete <- ST.readSTRef __field__complete
+                                             Prelude.pure
+                                               (Database __val__repo __val__status __val__location
+                                                  __val__created_since_epoch
+                                                  __val__expire_time
+                                                  __val__properties
+                                                  __val__completed
+                                                  __val__repo_hash_time
+                                                  __val__dependencies
+                                                  __val__broken
+                                                  __val__complete)
+              _idMap
+                = HashMap.fromList
+                    [("repo", 1), ("status", 4), ("location", 5),
+                     ("created_since_epoch", 6), ("expire_time", 7), ("properties", 8),
+                     ("completed", 9), ("repo_hash_time", 10), ("dependencies", 11),
+                     ("broken", 12), ("complete", 13)]
+            _parse 0)
+
+instance DeepSeq.NFData Database where
+  rnf
+    (Database __field__repo __field__status __field__location
+       __field__created_since_epoch __field__expire_time
+       __field__properties __field__completed __field__repo_hash_time
+       __field__dependencies __field__broken __field__complete)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__status `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq`
+            DeepSeq.rnf __field__created_since_epoch `Prelude.seq`
+              DeepSeq.rnf __field__expire_time `Prelude.seq`
+                DeepSeq.rnf __field__properties `Prelude.seq`
+                  DeepSeq.rnf __field__completed `Prelude.seq`
+                    DeepSeq.rnf __field__repo_hash_time `Prelude.seq`
+                      DeepSeq.rnf __field__dependencies `Prelude.seq`
+                        DeepSeq.rnf __field__broken `Prelude.seq`
+                          DeepSeq.rnf __field__complete `Prelude.seq` ()
+
+instance Default.Default Database where
+  def
+    = Database Default.def Default.def Prelude.Nothing
+        (PosixEpochTime Default.def)
+        Prelude.Nothing
+        HashMap.empty
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable Database where
+  hashWithSalt __salt
+    (Database _repo _status _location _created_since_epoch _expire_time
+       _properties _completed _repo_hash_time _dependencies _broken
+       _complete)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo)
+                                   _status)
+                                _location)
+                             _created_since_epoch)
+                          _expire_time)
+                       ((List.sort .
+                           Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                          _properties))
+                    _completed)
+                 _repo_hash_time)
+              _dependencies)
+           _broken)
+        _complete
+
+instance Ord.Ord Database where
+  compare __a __b
+    = case Ord.compare (database_repo __a) (database_repo __b) of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case
+                    Ord.compare (database_status __a) (database_status __b) of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> case
+                                Ord.compare (database_location __a) (database_location __b) of
+                                Ord.LT -> Ord.LT
+                                Ord.GT -> Ord.GT
+                                Ord.EQ -> case
+                                            Ord.compare (database_created_since_epoch __a)
+                                              (database_created_since_epoch __b)
+                                            of
+                                            Ord.LT -> Ord.LT
+                                            Ord.GT -> Ord.GT
+                                            Ord.EQ -> case
+                                                        Ord.compare (database_expire_time __a)
+                                                          (database_expire_time __b)
+                                                        of
+                                                        Ord.LT -> Ord.LT
+                                                        Ord.GT -> Ord.GT
+                                                        Ord.EQ -> case
+                                                                    Ord.compare
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (database_properties __a))
+                                                                      ((List.sort .
+                                                                          Prelude.map
+                                                                            (\ (_k, _v) -> (_k, _v))
+                                                                            . HashMap.toList)
+                                                                         (database_properties __b))
+                                                                    of
+                                                                    Ord.LT -> Ord.LT
+                                                                    Ord.GT -> Ord.GT
+                                                                    Ord.EQ -> case
+                                                                                Ord.compare
+                                                                                  (database_completed
+                                                                                     __a)
+                                                                                  (database_completed
+                                                                                     __b)
+                                                                                of
+                                                                                Ord.LT -> Ord.LT
+                                                                                Ord.GT -> Ord.GT
+                                                                                Ord.EQ -> case
+                                                                                            Ord.compare
+                                                                                              (database_repo_hash_time
+                                                                                                 __a)
+                                                                                              (database_repo_hash_time
+                                                                                                 __b)
+                                                                                            of
+                                                                                            Ord.LT -> Ord.LT
+                                                                                            Ord.GT -> Ord.GT
+                                                                                            Ord.EQ -> case
+                                                                                                        Ord.compare
+                                                                                                          (database_dependencies
+                                                                                                             __a)
+                                                                                                          (database_dependencies
+                                                                                                             __b)
+                                                                                                        of
+                                                                                                        Ord.LT -> Ord.LT
+                                                                                                        Ord.GT -> Ord.GT
+                                                                                                        Ord.EQ -> case
+                                                                                                                    Ord.compare
+                                                                                                                      (database_broken
+                                                                                                                         __a)
+                                                                                                                      (database_broken
+                                                                                                                         __b)
+                                                                                                                    of
+                                                                                                                    Ord.LT -> Ord.LT
+                                                                                                                    Ord.GT -> Ord.GT
+                                                                                                                    Ord.EQ -> Ord.compare
+                                                                                                                                (database_complete
+                                                                                                                                   __a)
+                                                                                                                                (database_complete
+                                                                                                                                   __b)
+
+data PredicateStats = PredicateStats{predicateStats_count ::
+                                     Int.Int64,
+                                     predicateStats_size :: Int.Int64}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateStats where
+  toJSON (PredicateStats __field__count __field__size)
+    = Aeson.object
+        ("count" .= __field__count :
+           "size" .= __field__size : Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateStats where
+  buildStruct _proxy (PredicateStats __field__count __field__size)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "count" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64Prim _proxy)
+           __field__count
+           :
+           Thrift.genFieldPrim _proxy "size" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64Prim _proxy)
+             __field__size
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__count <- ST.newSTRef Default.def
+            __field__size <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__count
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__size
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__count <- ST.readSTRef __field__count
+                                             !__val__size <- ST.readSTRef __field__size
+                                             Prelude.pure (PredicateStats __val__count __val__size)
+              _idMap = HashMap.fromList [("count", 1), ("size", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateStats where
+  rnf (PredicateStats __field__count __field__size)
+    = DeepSeq.rnf __field__count `Prelude.seq`
+        DeepSeq.rnf __field__size `Prelude.seq` ()
+
+instance Default.Default PredicateStats where
+  def = PredicateStats Default.def Default.def
+
+instance Hashable.Hashable PredicateStats where
+  hashWithSalt __salt (PredicateStats _count _size)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _count) _size
+
+type Handle = Text.Text
+
+data ComputedBatch = ComputedBatch{computedBatch_repo :: Repo,
+                                   computedBatch_remember :: Prelude.Bool,
+                                   computedBatch_batch :: Batch}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ComputedBatch where
+  toJSON
+    (ComputedBatch __field__repo __field__remember __field__batch)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "remember" .= __field__remember :
+             "batch" .= __field__batch : Prelude.mempty)
+
+instance Thrift.ThriftStruct ComputedBatch where
+  buildStruct _proxy
+    (ComputedBatch __field__repo __field__remember __field__batch)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genFieldBool _proxy "remember" 3 1 __field__remember :
+             Thrift.genField _proxy "batch" (Thrift.getStructType _proxy) 4 3
+               (Thrift.buildStruct _proxy __field__batch)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__remember <- ST.newSTRef Prelude.False
+            __field__batch <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__remember
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__batch
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__remember <- ST.readSTRef __field__remember
+                                             !__val__batch <- ST.readSTRef __field__batch
+                                             Prelude.pure
+                                               (ComputedBatch __val__repo __val__remember
+                                                  __val__batch)
+              _idMap
+                = HashMap.fromList [("repo", 1), ("remember", 3), ("batch", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ComputedBatch where
+  rnf (ComputedBatch __field__repo __field__remember __field__batch)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__remember `Prelude.seq`
+          DeepSeq.rnf __field__batch `Prelude.seq` ()
+
+instance Default.Default ComputedBatch where
+  def = ComputedBatch Default.def Prelude.False Default.def
+
+instance Hashable.Hashable ComputedBatch where
+  hashWithSalt __salt (ComputedBatch _repo _remember _batch)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo)
+           _remember)
+        _batch
+
+newtype BatchRetry = BatchRetry{batchRetry_seconds ::
+                                Prelude.Double}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BatchRetry where
+  toJSON (BatchRetry __field__seconds)
+    = Aeson.object ("seconds" .= __field__seconds : Prelude.mempty)
+
+instance Thrift.ThriftStruct BatchRetry where
+  buildStruct _proxy (BatchRetry __field__seconds)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "seconds" (Thrift.getDoubleType _proxy) 1 0
+           (Thrift.genDouble _proxy __field__seconds)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__seconds <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getDoubleType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseDouble
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__seconds
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__seconds <- ST.readSTRef
+                                                                  __field__seconds
+                                             Prelude.pure (BatchRetry __val__seconds)
+              _idMap = HashMap.fromList [("seconds", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData BatchRetry where
+  rnf (BatchRetry __field__seconds)
+    = DeepSeq.rnf __field__seconds `Prelude.seq` ()
+
+instance Default.Default BatchRetry where
+  def = BatchRetry Default.def
+
+instance Hashable.Hashable BatchRetry where
+  hashWithSalt __salt (BatchRetry _seconds)
+    = Hashable.hashWithSalt __salt _seconds
+
+data SendResponse = SendResponse_handle Handle
+                  | SendResponse_retry BatchRetry
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SendResponse where
+  toJSON (SendResponse_handle __handle)
+    = Aeson.object ["handle" .= __handle]
+  toJSON (SendResponse_retry __retry)
+    = Aeson.object ["retry" .= __retry]
+
+instance Thrift.ThriftStruct SendResponse where
+  buildStruct _proxy (SendResponse_handle __handle)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "handle" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __handle)]
+  buildStruct _proxy (SendResponse_retry __retry)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "retry" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __retry)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SendResponse_handle _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SendResponse_retry _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'SendResponse': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'SendResponse' is empty"
+    where
+      _idMap = HashMap.fromList [("handle", 1), ("retry", 2)]
+
+instance DeepSeq.NFData SendResponse where
+  rnf (SendResponse_handle __handle) = DeepSeq.rnf __handle
+  rnf (SendResponse_retry __retry) = DeepSeq.rnf __retry
+
+instance Default.Default SendResponse where
+  def = SendResponse_handle ""
+
+instance Hashable.Hashable SendResponse where
+  hashWithSalt __salt (SendResponse_handle _handle)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _handle)
+  hashWithSalt __salt (SendResponse_retry _retry)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _retry)
+
+data FinishResponse = FinishResponse_subst Subst
+                    | FinishResponse_retry BatchRetry
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FinishResponse where
+  toJSON (FinishResponse_subst __subst)
+    = Aeson.object ["subst" .= __subst]
+  toJSON (FinishResponse_retry __retry)
+    = Aeson.object ["retry" .= __retry]
+
+instance Thrift.ThriftStruct FinishResponse where
+  buildStruct _proxy (FinishResponse_subst __subst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "subst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __subst)]
+  buildStruct _proxy (FinishResponse_retry __retry)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "retry" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __retry)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FinishResponse_subst _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FinishResponse_retry _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'FinishResponse': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'FinishResponse' is empty"
+    where
+      _idMap = HashMap.fromList [("subst", 1), ("retry", 2)]
+
+instance DeepSeq.NFData FinishResponse where
+  rnf (FinishResponse_subst __subst) = DeepSeq.rnf __subst
+  rnf (FinishResponse_retry __retry) = DeepSeq.rnf __retry
+
+instance Default.Default FinishResponse where
+  def = FinishResponse_subst Default.def
+
+instance Hashable.Hashable FinishResponse where
+  hashWithSalt __salt (FinishResponse_subst _subst)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _subst)
+  hashWithSalt __salt (FinishResponse_retry _retry)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _retry)
+
+data FinalizeResponse = FinalizeResponse{}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FinalizeResponse where
+  toJSON FinalizeResponse = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct FinalizeResponse where
+  buildStruct _proxy FinalizeResponse = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (FinalizeResponse)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData FinalizeResponse where
+  rnf FinalizeResponse = ()
+
+instance Default.Default FinalizeResponse where
+  def = FinalizeResponse
+
+instance Hashable.Hashable FinalizeResponse where
+  hashWithSalt __salt FinalizeResponse = __salt
+
+data FinishDatabaseResponse = FinishDatabaseResponse{}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FinishDatabaseResponse where
+  toJSON FinishDatabaseResponse = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct FinishDatabaseResponse where
+  buildStruct _proxy FinishDatabaseResponse
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (FinishDatabaseResponse)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData FinishDatabaseResponse where
+  rnf FinishDatabaseResponse = ()
+
+instance Default.Default FinishDatabaseResponse where
+  def = FinishDatabaseResponse
+
+instance Hashable.Hashable FinishDatabaseResponse where
+  hashWithSalt __salt FinishDatabaseResponse = __salt
+
+data UserQueryCont = UserQueryCont{userQueryCont_continuation ::
+                                   ByteString.ByteString,
+                                   userQueryCont_nextId :: Int.Int64,
+                                   userQueryCont_version :: Int.Int32,
+                                   userQueryCont_hash :: Int.Int64,
+                                   userQueryCont_returnType :: Prelude.Maybe ByteString.ByteString,
+                                   userQueryCont_pids :: [Int.Int64]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryCont where
+  toJSON
+    (UserQueryCont __field__continuation __field__nextId
+       __field__version __field__hash __field__returnType __field__pids)
+    = Aeson.object
+        ("continuation" .= Thrift.encodeBase64Text __field__continuation :
+           "nextId" .= __field__nextId :
+             "version" .= __field__version :
+               "hash" .= __field__hash :
+                 Prelude.maybe Prelude.id ((:) . ("returnType" .=))
+                   (Prelude.fmap Thrift.encodeBase64Text __field__returnType)
+                   ("pids" .= __field__pids : Prelude.mempty))
+
+instance Thrift.ThriftStruct UserQueryCont where
+  buildStruct _proxy
+    (UserQueryCont __field__continuation __field__nextId
+       __field__version __field__hash __field__returnType __field__pids)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "continuation"
+           (Thrift.getStringType _proxy)
+           3
+           0
+           (Thrift.genBytes _proxy __field__continuation)
+           :
+           Thrift.genFieldPrim _proxy "nextId" (Thrift.getI64Type _proxy) 4 3
+             (Thrift.genI64Prim _proxy)
+             __field__nextId
+             :
+             Thrift.genFieldPrim _proxy "version" (Thrift.getI32Type _proxy) 5 4
+               (Thrift.genI32Prim _proxy)
+               __field__version
+               :
+               Thrift.genFieldPrim _proxy "hash" (Thrift.getI64Type _proxy) 6 5
+                 (Thrift.genI64Prim _proxy)
+                 __field__hash
+                 :
+                 let (__cereal__returnType, __id__returnType)
+                       = case __field__returnType of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "returnType"
+                                                      (Thrift.getStringType _proxy)
+                                                      7
+                                                      6
+                                                      (Thrift.genBytes _proxy _val)),
+                                                 7)
+                           Prelude.Nothing -> (Prelude.id, 6)
+                   in
+                   __cereal__returnType
+                     (Thrift.genField _proxy "pids" (Thrift.getListType _proxy) 8
+                        __id__returnType
+                        (Thrift.genListPrim _proxy (Thrift.getI64Type _proxy)
+                           (Thrift.genI64Prim _proxy)
+                           __field__pids)
+                        : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__continuation <- ST.newSTRef ""
+            __field__nextId <- ST.newSTRef Default.def
+            __field__version <- ST.newSTRef Default.def
+            __field__hash <- ST.newSTRef Default.def
+            __field__returnType <- ST.newSTRef Prelude.Nothing
+            __field__pids <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__continuation
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nextId
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnType
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__pids
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__continuation <- ST.readSTRef
+                                                                       __field__continuation
+                                             !__val__nextId <- ST.readSTRef __field__nextId
+                                             !__val__version <- ST.readSTRef __field__version
+                                             !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__returnType <- ST.readSTRef __field__returnType
+                                             !__val__pids <- ST.readSTRef __field__pids
+                                             Prelude.pure
+                                               (UserQueryCont __val__continuation __val__nextId
+                                                  __val__version
+                                                  __val__hash
+                                                  __val__returnType
+                                                  __val__pids)
+              _idMap
+                = HashMap.fromList
+                    [("continuation", 3), ("nextId", 4), ("version", 5), ("hash", 6),
+                     ("returnType", 7), ("pids", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryCont where
+  rnf
+    (UserQueryCont __field__continuation __field__nextId
+       __field__version __field__hash __field__returnType __field__pids)
+    = DeepSeq.rnf __field__continuation `Prelude.seq`
+        DeepSeq.rnf __field__nextId `Prelude.seq`
+          DeepSeq.rnf __field__version `Prelude.seq`
+            DeepSeq.rnf __field__hash `Prelude.seq`
+              DeepSeq.rnf __field__returnType `Prelude.seq`
+                DeepSeq.rnf __field__pids `Prelude.seq` ()
+
+instance Default.Default UserQueryCont where
+  def
+    = UserQueryCont "" Default.def Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable UserQueryCont where
+  hashWithSalt __salt
+    (UserQueryCont _continuation _nextId _version _hash _returnType
+       _pids)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _continuation)
+                    _nextId)
+                 _version)
+              _hash)
+           _returnType)
+        _pids
+
+data QuerySyntax = QuerySyntax_JSON
+                 | QuerySyntax_ANGLE
+                   deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON QuerySyntax where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData QuerySyntax where
+  rnf __QuerySyntax = Prelude.seq __QuerySyntax ()
+
+instance Default.Default QuerySyntax where
+  def = QuerySyntax_JSON
+
+instance Hashable.Hashable QuerySyntax where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum QuerySyntax where
+  toThriftEnum 1 = QuerySyntax_JSON
+  toThriftEnum 2 = QuerySyntax_ANGLE
+  toThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("toThriftEnum: not a valid identifier for enum QuerySyntax: " ++
+              Prelude.show _val))
+  fromThriftEnum QuerySyntax_JSON = 1
+  fromThriftEnum QuerySyntax_ANGLE = 2
+  fromThriftEnum _val
+    = Exception.throw
+        (Thrift.ProtocolException
+           ("fromThriftEnum: not a valid identifier for enum QuerySyntax: " ++
+              Prelude.show _val))
+  allThriftEnumValues = [QuerySyntax_JSON, QuerySyntax_ANGLE]
+  toThriftEnumEither 1 = Prelude.Right QuerySyntax_JSON
+  toThriftEnumEither 2 = Prelude.Right QuerySyntax_ANGLE
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum QuerySyntax: "
+           ++ Prelude.show val)
+
+instance Prelude.Ord QuerySyntax where
+  compare = Function.on Prelude.compare Thrift.fromThriftEnum
+
+data UserQueryOptions = UserQueryOptions{userQueryOptions_no_base64_binary
+                                         :: Prelude.Bool,
+                                         userQueryOptions_expand_results :: Prelude.Bool,
+                                         userQueryOptions_recursive :: Prelude.Bool,
+                                         userQueryOptions_max_results :: Prelude.Maybe Int.Int64,
+                                         userQueryOptions_max_bytes :: Prelude.Maybe Int.Int64,
+                                         userQueryOptions_max_time_ms :: Prelude.Maybe Int.Int64,
+                                         userQueryOptions_continuation ::
+                                         Prelude.Maybe UserQueryCont,
+                                         userQueryOptions_syntax :: QuerySyntax,
+                                         userQueryOptions_store_derived_facts :: Prelude.Bool,
+                                         userQueryOptions_collect_facts_searched :: Prelude.Bool,
+                                         userQueryOptions_debug :: QueryDebugOptions,
+                                         userQueryOptions_omit_results :: Prelude.Bool,
+                                         userQueryOptions_expand_predicates :: [SourcePredicate],
+                                         userQueryOptions_just_check :: Prelude.Bool}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryOptions where
+  toJSON
+    (UserQueryOptions __field__no_base64_binary __field__expand_results
+       __field__recursive __field__max_results __field__max_bytes
+       __field__max_time_ms __field__continuation __field__syntax
+       __field__store_derived_facts __field__collect_facts_searched
+       __field__debug __field__omit_results __field__expand_predicates
+       __field__just_check)
+    = Aeson.object
+        ("no_base64_binary" .= __field__no_base64_binary :
+           "expand_results" .= __field__expand_results :
+             "recursive" .= __field__recursive :
+               Prelude.maybe Prelude.id ((:) . ("max_results" .=))
+                 __field__max_results
+                 (Prelude.maybe Prelude.id ((:) . ("max_bytes" .=))
+                    __field__max_bytes
+                    (Prelude.maybe Prelude.id ((:) . ("max_time_ms" .=))
+                       __field__max_time_ms
+                       (Prelude.maybe Prelude.id ((:) . ("continuation" .=))
+                          __field__continuation
+                          ("syntax" .= __field__syntax :
+                             "store_derived_facts" .= __field__store_derived_facts :
+                               "collect_facts_searched" .= __field__collect_facts_searched :
+                                 "debug" .= __field__debug :
+                                   "omit_results" .= __field__omit_results :
+                                     "expand_predicates" .= __field__expand_predicates :
+                                       "just_check" .= __field__just_check : Prelude.mempty)))))
+
+instance Thrift.ThriftStruct UserQueryOptions where
+  buildStruct _proxy
+    (UserQueryOptions __field__no_base64_binary __field__expand_results
+       __field__recursive __field__max_results __field__max_bytes
+       __field__max_time_ms __field__continuation __field__syntax
+       __field__store_derived_facts __field__collect_facts_searched
+       __field__debug __field__omit_results __field__expand_predicates
+       __field__just_check)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "no_base64_binary" 1 0
+           __field__no_base64_binary
+           :
+           Thrift.genFieldBool _proxy "expand_results" 2 1
+             __field__expand_results
+             :
+             Thrift.genFieldBool _proxy "recursive" 3 2 __field__recursive :
+               let (__cereal__max_results, __id__max_results)
+                     = case __field__max_results of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genFieldPrim _proxy "max_results"
+                                                    (Thrift.getI64Type _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.genI64Prim _proxy)
+                                                    _val),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__max_results
+                   (let (__cereal__max_bytes, __id__max_bytes)
+                          = case __field__max_bytes of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genFieldPrim _proxy "max_bytes"
+                                                         (Thrift.getI64Type _proxy)
+                                                         8
+                                                         __id__max_results
+                                                         (Thrift.genI64Prim _proxy)
+                                                         _val),
+                                                    8)
+                              Prelude.Nothing -> (Prelude.id, __id__max_results)
+                      in
+                      __cereal__max_bytes
+                        (let (__cereal__max_time_ms, __id__max_time_ms)
+                               = case __field__max_time_ms of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genFieldPrim _proxy "max_time_ms"
+                                                              (Thrift.getI64Type _proxy)
+                                                              10
+                                                              __id__max_bytes
+                                                              (Thrift.genI64Prim _proxy)
+                                                              _val),
+                                                         10)
+                                   Prelude.Nothing -> (Prelude.id, __id__max_bytes)
+                           in
+                           __cereal__max_time_ms
+                             (let (__cereal__continuation, __id__continuation)
+                                    = case __field__continuation of
+                                        Prelude.Just _val -> ((:)
+                                                                (Thrift.genField _proxy
+                                                                   "continuation"
+                                                                   (Thrift.getStructType _proxy)
+                                                                   5
+                                                                   __id__max_time_ms
+                                                                   (Thrift.buildStruct _proxy
+                                                                      _val)),
+                                                              5)
+                                        Prelude.Nothing -> (Prelude.id, __id__max_time_ms)
+                                in
+                                __cereal__continuation
+                                  (Thrift.genField _proxy "syntax" (Thrift.getI32Type _proxy) 7
+                                     __id__continuation
+                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                         Thrift.fromThriftEnum)
+                                        __field__syntax)
+                                     :
+                                     Thrift.genFieldBool _proxy "store_derived_facts" 9 7
+                                       __field__store_derived_facts
+                                       :
+                                       Thrift.genFieldBool _proxy "collect_facts_searched" 11 9
+                                         __field__collect_facts_searched
+                                         :
+                                         Thrift.genField _proxy "debug"
+                                           (Thrift.getStructType _proxy)
+                                           12
+                                           11
+                                           (Thrift.buildStruct _proxy __field__debug)
+                                           :
+                                           Thrift.genFieldBool _proxy "omit_results" 13 12
+                                             __field__omit_results
+                                             :
+                                             Thrift.genField _proxy "expand_predicates"
+                                               (Thrift.getListType _proxy)
+                                               14
+                                               13
+                                               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                                  (Thrift.buildStruct _proxy)
+                                                  __field__expand_predicates)
+                                               :
+                                               Thrift.genFieldBool _proxy "just_check" 15 14
+                                                 __field__just_check
+                                                 : [])))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__no_base64_binary <- ST.newSTRef Prelude.False
+            __field__expand_results <- ST.newSTRef Prelude.True
+            __field__recursive <- ST.newSTRef Prelude.False
+            __field__max_results <- ST.newSTRef Prelude.Nothing
+            __field__max_bytes <- ST.newSTRef Prelude.Nothing
+            __field__max_time_ms <- ST.newSTRef Prelude.Nothing
+            __field__continuation <- ST.newSTRef Prelude.Nothing
+            __field__syntax <- ST.newSTRef QuerySyntax_JSON
+            __field__store_derived_facts <- ST.newSTRef Prelude.False
+            __field__collect_facts_searched <- ST.newSTRef Prelude.False
+            __field__debug <- ST.newSTRef Default.def
+            __field__omit_results <- ST.newSTRef Prelude.False
+            __field__expand_predicates <- ST.newSTRef Default.def
+            __field__just_check <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__no_base64_binary
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__expand_results
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__recursive
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_results
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_bytes
+                                                                          (Prelude.Just _val)
+                                                                 10 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__max_time_ms
+                                                                           (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__continuation
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnumNoUnknown
+                                                                                      _proxy
+                                                                                      "QuerySyntax")
+                                                                        ST.writeSTRef
+                                                                          __field__syntax
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__store_derived_facts
+                                                                          _val
+                                                                 11 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__collect_facts_searched
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__debug
+                                                                           _val
+                                                                 13 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__omit_results
+                                                                           _val
+                                                                 14 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__expand_predicates
+                                                                           _val
+                                                                 15 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__just_check
+                                                                           _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__no_base64_binary <- ST.readSTRef
+                                                                           __field__no_base64_binary
+                                             !__val__expand_results <- ST.readSTRef
+                                                                         __field__expand_results
+                                             !__val__recursive <- ST.readSTRef __field__recursive
+                                             !__val__max_results <- ST.readSTRef
+                                                                      __field__max_results
+                                             !__val__max_bytes <- ST.readSTRef __field__max_bytes
+                                             !__val__max_time_ms <- ST.readSTRef
+                                                                      __field__max_time_ms
+                                             !__val__continuation <- ST.readSTRef
+                                                                       __field__continuation
+                                             !__val__syntax <- ST.readSTRef __field__syntax
+                                             !__val__store_derived_facts <- ST.readSTRef
+                                                                              __field__store_derived_facts
+                                             !__val__collect_facts_searched <- ST.readSTRef
+                                                                                 __field__collect_facts_searched
+                                             !__val__debug <- ST.readSTRef __field__debug
+                                             !__val__omit_results <- ST.readSTRef
+                                                                       __field__omit_results
+                                             !__val__expand_predicates <- ST.readSTRef
+                                                                            __field__expand_predicates
+                                             !__val__just_check <- ST.readSTRef __field__just_check
+                                             Prelude.pure
+                                               (UserQueryOptions __val__no_base64_binary
+                                                  __val__expand_results
+                                                  __val__recursive
+                                                  __val__max_results
+                                                  __val__max_bytes
+                                                  __val__max_time_ms
+                                                  __val__continuation
+                                                  __val__syntax
+                                                  __val__store_derived_facts
+                                                  __val__collect_facts_searched
+                                                  __val__debug
+                                                  __val__omit_results
+                                                  __val__expand_predicates
+                                                  __val__just_check)
+              _idMap
+                = HashMap.fromList
+                    [("no_base64_binary", 1), ("expand_results", 2), ("recursive", 3),
+                     ("max_results", 4), ("max_bytes", 8), ("max_time_ms", 10),
+                     ("continuation", 5), ("syntax", 7), ("store_derived_facts", 9),
+                     ("collect_facts_searched", 11), ("debug", 12),
+                     ("omit_results", 13), ("expand_predicates", 14),
+                     ("just_check", 15)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryOptions where
+  rnf
+    (UserQueryOptions __field__no_base64_binary __field__expand_results
+       __field__recursive __field__max_results __field__max_bytes
+       __field__max_time_ms __field__continuation __field__syntax
+       __field__store_derived_facts __field__collect_facts_searched
+       __field__debug __field__omit_results __field__expand_predicates
+       __field__just_check)
+    = DeepSeq.rnf __field__no_base64_binary `Prelude.seq`
+        DeepSeq.rnf __field__expand_results `Prelude.seq`
+          DeepSeq.rnf __field__recursive `Prelude.seq`
+            DeepSeq.rnf __field__max_results `Prelude.seq`
+              DeepSeq.rnf __field__max_bytes `Prelude.seq`
+                DeepSeq.rnf __field__max_time_ms `Prelude.seq`
+                  DeepSeq.rnf __field__continuation `Prelude.seq`
+                    DeepSeq.rnf __field__syntax `Prelude.seq`
+                      DeepSeq.rnf __field__store_derived_facts `Prelude.seq`
+                        DeepSeq.rnf __field__collect_facts_searched `Prelude.seq`
+                          DeepSeq.rnf __field__debug `Prelude.seq`
+                            DeepSeq.rnf __field__omit_results `Prelude.seq`
+                              DeepSeq.rnf __field__expand_predicates `Prelude.seq`
+                                DeepSeq.rnf __field__just_check `Prelude.seq` ()
+
+instance Default.Default UserQueryOptions where
+  def
+    = UserQueryOptions Prelude.False Prelude.True Prelude.False
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        QuerySyntax_JSON
+        Prelude.False
+        Prelude.False
+        Default.def
+        Prelude.False
+        Default.def
+        Prelude.False
+
+instance Hashable.Hashable UserQueryOptions where
+  hashWithSalt __salt
+    (UserQueryOptions _no_base64_binary _expand_results _recursive
+       _max_results _max_bytes _max_time_ms _continuation _syntax
+       _store_derived_facts _collect_facts_searched _debug _omit_results
+       _expand_predicates _just_check)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt
+                                   (Hashable.hashWithSalt
+                                      (Hashable.hashWithSalt
+                                         (Hashable.hashWithSalt
+                                            (Hashable.hashWithSalt __salt _no_base64_binary)
+                                            _expand_results)
+                                         _recursive)
+                                      _max_results)
+                                   _max_bytes)
+                                _max_time_ms)
+                             _continuation)
+                          _syntax)
+                       _store_derived_facts)
+                    _collect_facts_searched)
+                 _debug)
+              _omit_results)
+           _expand_predicates)
+        _just_check
+
+data QueryDebugOptions = QueryDebugOptions{queryDebugOptions_ir ::
+                                           Prelude.Bool,
+                                           queryDebugOptions_bytecode :: Prelude.Bool,
+                                           queryDebugOptions_pred_has_facts :: Prelude.Bool}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryDebugOptions where
+  toJSON
+    (QueryDebugOptions __field__ir __field__bytecode
+       __field__pred_has_facts)
+    = Aeson.object
+        ("ir" .= __field__ir :
+           "bytecode" .= __field__bytecode :
+             "pred_has_facts" .= __field__pred_has_facts : Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryDebugOptions where
+  buildStruct _proxy
+    (QueryDebugOptions __field__ir __field__bytecode
+       __field__pred_has_facts)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "ir" 1 0 __field__ir :
+           Thrift.genFieldBool _proxy "bytecode" 2 1 __field__bytecode :
+             Thrift.genFieldBool _proxy "pred_has_facts" 3 2
+               __field__pred_has_facts
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ir <- ST.newSTRef Prelude.False
+            __field__bytecode <- ST.newSTRef Prelude.False
+            __field__pred_has_facts <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__ir
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__bytecode
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__pred_has_facts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ir <- ST.readSTRef __field__ir
+                                             !__val__bytecode <- ST.readSTRef __field__bytecode
+                                             !__val__pred_has_facts <- ST.readSTRef
+                                                                         __field__pred_has_facts
+                                             Prelude.pure
+                                               (QueryDebugOptions __val__ir __val__bytecode
+                                                  __val__pred_has_facts)
+              _idMap
+                = HashMap.fromList
+                    [("ir", 1), ("bytecode", 2), ("pred_has_facts", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryDebugOptions where
+  rnf
+    (QueryDebugOptions __field__ir __field__bytecode
+       __field__pred_has_facts)
+    = DeepSeq.rnf __field__ir `Prelude.seq`
+        DeepSeq.rnf __field__bytecode `Prelude.seq`
+          DeepSeq.rnf __field__pred_has_facts `Prelude.seq` ()
+
+instance Default.Default QueryDebugOptions where
+  def = QueryDebugOptions Prelude.False Prelude.False Prelude.False
+
+instance Hashable.Hashable QueryDebugOptions where
+  hashWithSalt __salt
+    (QueryDebugOptions _ir _bytecode _pred_has_facts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ir)
+           _bytecode)
+        _pred_has_facts
+
+data UserQueryEncodingBin = UserQueryEncodingBin{}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncodingBin where
+  toJSON UserQueryEncodingBin = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UserQueryEncodingBin where
+  buildStruct _proxy UserQueryEncodingBin
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UserQueryEncodingBin)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryEncodingBin where
+  rnf UserQueryEncodingBin = ()
+
+instance Default.Default UserQueryEncodingBin where
+  def = UserQueryEncodingBin
+
+instance Hashable.Hashable UserQueryEncodingBin where
+  hashWithSalt __salt UserQueryEncodingBin = __salt
+
+data UserQueryEncodingListBin = UserQueryEncodingListBin{}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncodingListBin where
+  toJSON UserQueryEncodingListBin = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UserQueryEncodingListBin where
+  buildStruct _proxy UserQueryEncodingListBin
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UserQueryEncodingListBin)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryEncodingListBin where
+  rnf UserQueryEncodingListBin = ()
+
+instance Default.Default UserQueryEncodingListBin where
+  def = UserQueryEncodingListBin
+
+instance Hashable.Hashable UserQueryEncodingListBin where
+  hashWithSalt __salt UserQueryEncodingListBin = __salt
+
+data UserQueryEncodingJSON = UserQueryEncodingJSON{userQueryEncodingJSON_expand_results
+                                                   :: Prelude.Bool,
+                                                   userQueryEncodingJSON_no_base64_binary ::
+                                                   Prelude.Bool}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncodingJSON where
+  toJSON
+    (UserQueryEncodingJSON __field__expand_results
+       __field__no_base64_binary)
+    = Aeson.object
+        ("expand_results" .= __field__expand_results :
+           "no_base64_binary" .= __field__no_base64_binary : Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryEncodingJSON where
+  buildStruct _proxy
+    (UserQueryEncodingJSON __field__expand_results
+       __field__no_base64_binary)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "expand_results" 1 0
+           __field__expand_results
+           :
+           Thrift.genFieldBool _proxy "no_base64_binary" 2 1
+             __field__no_base64_binary
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__expand_results <- ST.newSTRef Prelude.False
+            __field__no_base64_binary <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__expand_results
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__no_base64_binary
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__expand_results <- ST.readSTRef
+                                                                         __field__expand_results
+                                             !__val__no_base64_binary <- ST.readSTRef
+                                                                           __field__no_base64_binary
+                                             Prelude.pure
+                                               (UserQueryEncodingJSON __val__expand_results
+                                                  __val__no_base64_binary)
+              _idMap
+                = HashMap.fromList [("expand_results", 1), ("no_base64_binary", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryEncodingJSON where
+  rnf
+    (UserQueryEncodingJSON __field__expand_results
+       __field__no_base64_binary)
+    = DeepSeq.rnf __field__expand_results `Prelude.seq`
+        DeepSeq.rnf __field__no_base64_binary `Prelude.seq` ()
+
+instance Default.Default UserQueryEncodingJSON where
+  def = UserQueryEncodingJSON Prelude.False Prelude.False
+
+instance Hashable.Hashable UserQueryEncodingJSON where
+  hashWithSalt __salt
+    (UserQueryEncodingJSON _expand_results _no_base64_binary)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _expand_results)
+        _no_base64_binary
+
+newtype UserQueryEncodingCompact = UserQueryEncodingCompact{userQueryEncodingCompact_expand_results
+                                                            :: Prelude.Bool}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncodingCompact where
+  toJSON (UserQueryEncodingCompact __field__expand_results)
+    = Aeson.object
+        ("expand_results" .= __field__expand_results : Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryEncodingCompact where
+  buildStruct _proxy
+    (UserQueryEncodingCompact __field__expand_results)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "expand_results" 1 0
+           __field__expand_results
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__expand_results <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__expand_results
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__expand_results <- ST.readSTRef
+                                                                         __field__expand_results
+                                             Prelude.pure
+                                               (UserQueryEncodingCompact __val__expand_results)
+              _idMap = HashMap.fromList [("expand_results", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryEncodingCompact where
+  rnf (UserQueryEncodingCompact __field__expand_results)
+    = DeepSeq.rnf __field__expand_results `Prelude.seq` ()
+
+instance Default.Default UserQueryEncodingCompact where
+  def = UserQueryEncodingCompact Prelude.False
+
+instance Hashable.Hashable UserQueryEncodingCompact where
+  hashWithSalt __salt (UserQueryEncodingCompact _expand_results)
+    = Hashable.hashWithSalt __salt _expand_results
+
+data UserQueryEncoding = UserQueryEncoding_bin UserQueryEncodingBin
+                       | UserQueryEncoding_json UserQueryEncodingJSON
+                       | UserQueryEncoding_compact UserQueryEncodingCompact
+                       | UserQueryEncoding_listbin UserQueryEncodingListBin
+                       | UserQueryEncoding_EMPTY
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncoding where
+  toJSON (UserQueryEncoding_bin __bin)
+    = Aeson.object ["bin" .= __bin]
+  toJSON (UserQueryEncoding_json __json)
+    = Aeson.object ["json" .= __json]
+  toJSON (UserQueryEncoding_compact __compact)
+    = Aeson.object ["compact" .= __compact]
+  toJSON (UserQueryEncoding_listbin __listbin)
+    = Aeson.object ["listbin" .= __listbin]
+  toJSON UserQueryEncoding_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct UserQueryEncoding where
+  buildStruct _proxy (UserQueryEncoding_bin __bin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "bin" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __bin)]
+  buildStruct _proxy (UserQueryEncoding_json __json)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "json" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __json)]
+  buildStruct _proxy (UserQueryEncoding_compact __compact)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "compact" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __compact)]
+  buildStruct _proxy (UserQueryEncoding_listbin __listbin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "listbin" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __listbin)]
+  buildStruct _proxy UserQueryEncoding_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncoding_bin _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncoding_json _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncoding_compact _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncoding_listbin _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return UserQueryEncoding_EMPTY
+           Thrift.FieldEnd -> Prelude.return UserQueryEncoding_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("bin", 1), ("json", 2), ("compact", 3), ("listbin", 4)]
+
+instance DeepSeq.NFData UserQueryEncoding where
+  rnf (UserQueryEncoding_bin __bin) = DeepSeq.rnf __bin
+  rnf (UserQueryEncoding_json __json) = DeepSeq.rnf __json
+  rnf (UserQueryEncoding_compact __compact) = DeepSeq.rnf __compact
+  rnf (UserQueryEncoding_listbin __listbin) = DeepSeq.rnf __listbin
+  rnf UserQueryEncoding_EMPTY = ()
+
+instance Default.Default UserQueryEncoding where
+  def = UserQueryEncoding_EMPTY
+
+instance Hashable.Hashable UserQueryEncoding where
+  hashWithSalt __salt (UserQueryEncoding_bin _bin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _bin)
+  hashWithSalt __salt (UserQueryEncoding_json _json)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _json)
+  hashWithSalt __salt (UserQueryEncoding_compact _compact)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _compact)
+  hashWithSalt __salt (UserQueryEncoding_listbin _listbin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _listbin)
+  hashWithSalt __salt UserQueryEncoding_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DerivePredicateQuery = DerivePredicateQuery{derivePredicateQuery_predicate
+                                                 :: Text.Text,
+                                                 derivePredicateQuery_predicate_version ::
+                                                 Prelude.Maybe Version,
+                                                 derivePredicateQuery_client_info ::
+                                                 Prelude.Maybe UserQueryClientInfo,
+                                                 derivePredicateQuery_options ::
+                                                 Prelude.Maybe DerivePredicateOptions,
+                                                 derivePredicateQuery_parallel ::
+                                                 Prelude.Maybe ParallelDerivation}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivePredicateQuery where
+  toJSON
+    (DerivePredicateQuery __field__predicate __field__predicate_version
+       __field__client_info __field__options __field__parallel)
+    = Aeson.object
+        ("predicate" .= __field__predicate :
+           Prelude.maybe Prelude.id ((:) . ("predicate_version" .=))
+             __field__predicate_version
+             (Prelude.maybe Prelude.id ((:) . ("client_info" .=))
+                __field__client_info
+                (Prelude.maybe Prelude.id ((:) . ("options" .=)) __field__options
+                   (Prelude.maybe Prelude.id ((:) . ("parallel" .=)) __field__parallel
+                      Prelude.mempty))))
+
+instance Thrift.ThriftStruct DerivePredicateQuery where
+  buildStruct _proxy
+    (DerivePredicateQuery __field__predicate __field__predicate_version
+       __field__client_info __field__options __field__parallel)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "predicate" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__predicate)
+           :
+           let (__cereal__predicate_version, __id__predicate_version)
+                 = case __field__predicate_version of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "predicate_version"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                (Thrift.genI32 _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__predicate_version
+               (let (__cereal__client_info, __id__client_info)
+                      = case __field__client_info of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "client_info"
+                                                     (Thrift.getStructType _proxy)
+                                                     4
+                                                     __id__predicate_version
+                                                     (Thrift.buildStruct _proxy _val)),
+                                                4)
+                          Prelude.Nothing -> (Prelude.id, __id__predicate_version)
+                  in
+                  __cereal__client_info
+                    (let (__cereal__options, __id__options)
+                           = case __field__options of
+                               Prelude.Just _val -> ((:)
+                                                       (Thrift.genField _proxy "options"
+                                                          (Thrift.getStructType _proxy)
+                                                          5
+                                                          __id__client_info
+                                                          (Thrift.buildStruct _proxy _val)),
+                                                     5)
+                               Prelude.Nothing -> (Prelude.id, __id__client_info)
+                       in
+                       __cereal__options
+                         (case __field__parallel of
+                            Prelude.Just _val -> Thrift.genField _proxy "parallel"
+                                                   (Thrift.getStructType _proxy)
+                                                   6
+                                                   __id__options
+                                                   (Thrift.buildStruct _proxy _val)
+                                                   : []
+                            Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef ""
+            __field__predicate_version <- ST.newSTRef Prelude.Nothing
+            __field__client_info <- ST.newSTRef Prelude.Nothing
+            __field__options <- ST.newSTRef Prelude.Nothing
+            __field__parallel <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate_version
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__client_info
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parallel
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             !__val__predicate_version <- ST.readSTRef
+                                                                            __field__predicate_version
+                                             !__val__client_info <- ST.readSTRef
+                                                                      __field__client_info
+                                             !__val__options <- ST.readSTRef __field__options
+                                             !__val__parallel <- ST.readSTRef __field__parallel
+                                             Prelude.pure
+                                               (DerivePredicateQuery __val__predicate
+                                                  __val__predicate_version
+                                                  __val__client_info
+                                                  __val__options
+                                                  __val__parallel)
+              _idMap
+                = HashMap.fromList
+                    [("predicate", 1), ("predicate_version", 2), ("client_info", 4),
+                     ("options", 5), ("parallel", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivePredicateQuery where
+  rnf
+    (DerivePredicateQuery __field__predicate __field__predicate_version
+       __field__client_info __field__options __field__parallel)
+    = DeepSeq.rnf __field__predicate `Prelude.seq`
+        DeepSeq.rnf __field__predicate_version `Prelude.seq`
+          DeepSeq.rnf __field__client_info `Prelude.seq`
+            DeepSeq.rnf __field__options `Prelude.seq`
+              DeepSeq.rnf __field__parallel `Prelude.seq` ()
+
+instance Default.Default DerivePredicateQuery where
+  def
+    = DerivePredicateQuery "" Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable DerivePredicateQuery where
+  hashWithSalt __salt
+    (DerivePredicateQuery _predicate _predicate_version _client_info
+       _options _parallel)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _predicate)
+                 _predicate_version)
+              _client_info)
+           _options)
+        _parallel
+
+data ParallelDerivation = ParallelDerivation{parallelDerivation_outer_predicate
+                                             :: Text.Text,
+                                             parallelDerivation_inner_query :: Text.Text,
+                                             parallelDerivation_min_batch_size ::
+                                             Prelude.Maybe Int.Int64}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParallelDerivation where
+  toJSON
+    (ParallelDerivation __field__outer_predicate __field__inner_query
+       __field__min_batch_size)
+    = Aeson.object
+        ("outer_predicate" .= __field__outer_predicate :
+           "inner_query" .= __field__inner_query :
+             Prelude.maybe Prelude.id ((:) . ("min_batch_size" .=))
+               __field__min_batch_size
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct ParallelDerivation where
+  buildStruct _proxy
+    (ParallelDerivation __field__outer_predicate __field__inner_query
+       __field__min_batch_size)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "outer_predicate"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__outer_predicate)
+           :
+           Thrift.genField _proxy "inner_query" (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__inner_query)
+             :
+             case __field__min_batch_size of
+               Prelude.Just _val -> Thrift.genFieldPrim _proxy "min_batch_size"
+                                      (Thrift.getI64Type _proxy)
+                                      3
+                                      2
+                                      (Thrift.genI64Prim _proxy)
+                                      _val
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__outer_predicate <- ST.newSTRef ""
+            __field__inner_query <- ST.newSTRef ""
+            __field__min_batch_size <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__outer_predicate
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__inner_query
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__min_batch_size
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__outer_predicate <- ST.readSTRef
+                                                                          __field__outer_predicate
+                                             !__val__inner_query <- ST.readSTRef
+                                                                      __field__inner_query
+                                             !__val__min_batch_size <- ST.readSTRef
+                                                                         __field__min_batch_size
+                                             Prelude.pure
+                                               (ParallelDerivation __val__outer_predicate
+                                                  __val__inner_query
+                                                  __val__min_batch_size)
+              _idMap
+                = HashMap.fromList
+                    [("outer_predicate", 1), ("inner_query", 2), ("min_batch_size", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ParallelDerivation where
+  rnf
+    (ParallelDerivation __field__outer_predicate __field__inner_query
+       __field__min_batch_size)
+    = DeepSeq.rnf __field__outer_predicate `Prelude.seq`
+        DeepSeq.rnf __field__inner_query `Prelude.seq`
+          DeepSeq.rnf __field__min_batch_size `Prelude.seq` ()
+
+instance Default.Default ParallelDerivation where
+  def = ParallelDerivation "" "" Prelude.Nothing
+
+instance Hashable.Hashable ParallelDerivation where
+  hashWithSalt __salt
+    (ParallelDerivation _outer_predicate _inner_query _min_batch_size)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _outer_predicate)
+           _inner_query)
+        _min_batch_size
+
+data DerivePredicateOptions = DerivePredicateOptions{derivePredicateOptions_max_results_per_query
+                                                     :: Prelude.Maybe Int.Int64,
+                                                     derivePredicateOptions_max_bytes_per_query ::
+                                                     Prelude.Maybe Int.Int64,
+                                                     derivePredicateOptions_max_time_ms_per_query ::
+                                                     Prelude.Maybe Int.Int64,
+                                                     derivePredicateOptions_collect_facts_searched
+                                                     :: Prelude.Bool}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivePredicateOptions where
+  toJSON
+    (DerivePredicateOptions __field__max_results_per_query
+       __field__max_bytes_per_query __field__max_time_ms_per_query
+       __field__collect_facts_searched)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("max_results_per_query" .=))
+           __field__max_results_per_query
+           (Prelude.maybe Prelude.id ((:) . ("max_bytes_per_query" .=))
+              __field__max_bytes_per_query
+              (Prelude.maybe Prelude.id ((:) . ("max_time_ms_per_query" .=))
+                 __field__max_time_ms_per_query
+                 ("collect_facts_searched" .= __field__collect_facts_searched :
+                    Prelude.mempty))))
+
+instance Thrift.ThriftStruct DerivePredicateOptions where
+  buildStruct _proxy
+    (DerivePredicateOptions __field__max_results_per_query
+       __field__max_bytes_per_query __field__max_time_ms_per_query
+       __field__collect_facts_searched)
+    = Thrift.genStruct _proxy
+        (let (__cereal__max_results_per_query, __id__max_results_per_query)
+               = case __field__max_results_per_query of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genFieldPrim _proxy "max_results_per_query"
+                                              (Thrift.getI64Type _proxy)
+                                              1
+                                              0
+                                              (Thrift.genI64Prim _proxy)
+                                              _val),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__max_results_per_query
+             (let (__cereal__max_bytes_per_query, __id__max_bytes_per_query)
+                    = case __field__max_bytes_per_query of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genFieldPrim _proxy "max_bytes_per_query"
+                                                   (Thrift.getI64Type _proxy)
+                                                   2
+                                                   __id__max_results_per_query
+                                                   (Thrift.genI64Prim _proxy)
+                                                   _val),
+                                              2)
+                        Prelude.Nothing -> (Prelude.id, __id__max_results_per_query)
+                in
+                __cereal__max_bytes_per_query
+                  (let (__cereal__max_time_ms_per_query, __id__max_time_ms_per_query)
+                         = case __field__max_time_ms_per_query of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genFieldPrim _proxy
+                                                        "max_time_ms_per_query"
+                                                        (Thrift.getI64Type _proxy)
+                                                        3
+                                                        __id__max_bytes_per_query
+                                                        (Thrift.genI64Prim _proxy)
+                                                        _val),
+                                                   3)
+                             Prelude.Nothing -> (Prelude.id, __id__max_bytes_per_query)
+                     in
+                     __cereal__max_time_ms_per_query
+                       (Thrift.genFieldBool _proxy "collect_facts_searched" 4
+                          __id__max_time_ms_per_query
+                          __field__collect_facts_searched
+                          : []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__max_results_per_query <- ST.newSTRef Prelude.Nothing
+            __field__max_bytes_per_query <- ST.newSTRef Prelude.Nothing
+            __field__max_time_ms_per_query <- ST.newSTRef Prelude.Nothing
+            __field__collect_facts_searched <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_results_per_query
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_bytes_per_query
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__max_time_ms_per_query
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__collect_facts_searched
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__max_results_per_query <- ST.readSTRef
+                                                                                __field__max_results_per_query
+                                             !__val__max_bytes_per_query <- ST.readSTRef
+                                                                              __field__max_bytes_per_query
+                                             !__val__max_time_ms_per_query <- ST.readSTRef
+                                                                                __field__max_time_ms_per_query
+                                             !__val__collect_facts_searched <- ST.readSTRef
+                                                                                 __field__collect_facts_searched
+                                             Prelude.pure
+                                               (DerivePredicateOptions __val__max_results_per_query
+                                                  __val__max_bytes_per_query
+                                                  __val__max_time_ms_per_query
+                                                  __val__collect_facts_searched)
+              _idMap
+                = HashMap.fromList
+                    [("max_results_per_query", 1), ("max_bytes_per_query", 2),
+                     ("max_time_ms_per_query", 3), ("collect_facts_searched", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivePredicateOptions where
+  rnf
+    (DerivePredicateOptions __field__max_results_per_query
+       __field__max_bytes_per_query __field__max_time_ms_per_query
+       __field__collect_facts_searched)
+    = DeepSeq.rnf __field__max_results_per_query `Prelude.seq`
+        DeepSeq.rnf __field__max_bytes_per_query `Prelude.seq`
+          DeepSeq.rnf __field__max_time_ms_per_query `Prelude.seq`
+            DeepSeq.rnf __field__collect_facts_searched `Prelude.seq` ()
+
+instance Default.Default DerivePredicateOptions where
+  def
+    = DerivePredicateOptions Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.False
+
+instance Hashable.Hashable DerivePredicateOptions where
+  hashWithSalt __salt
+    (DerivePredicateOptions _max_results_per_query _max_bytes_per_query
+       _max_time_ms_per_query _collect_facts_searched)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _max_results_per_query)
+              _max_bytes_per_query)
+           _max_time_ms_per_query)
+        _collect_facts_searched
+
+data NotAStoredPredicate = NotAStoredPredicate{}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NotAStoredPredicate where
+  toJSON NotAStoredPredicate = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct NotAStoredPredicate where
+  buildStruct _proxy NotAStoredPredicate = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (NotAStoredPredicate)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData NotAStoredPredicate where
+  rnf NotAStoredPredicate = ()
+
+instance Default.Default NotAStoredPredicate where
+  def = NotAStoredPredicate
+
+instance Hashable.Hashable NotAStoredPredicate where
+  hashWithSalt __salt NotAStoredPredicate = __salt
+
+instance Exception.Exception NotAStoredPredicate
+
+data UnknownDerivationHandle = UnknownDerivationHandle{}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnknownDerivationHandle where
+  toJSON UnknownDerivationHandle = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UnknownDerivationHandle where
+  buildStruct _proxy UnknownDerivationHandle
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UnknownDerivationHandle)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UnknownDerivationHandle where
+  rnf UnknownDerivationHandle = ()
+
+instance Default.Default UnknownDerivationHandle where
+  def = UnknownDerivationHandle
+
+instance Hashable.Hashable UnknownDerivationHandle where
+  hashWithSalt __salt UnknownDerivationHandle = __salt
+
+instance Exception.Exception UnknownDerivationHandle
+
+newtype UnknownPredicate = UnknownPredicate{unknownPredicate_predicate
+                                            :: Prelude.Maybe Text.Text}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnknownPredicate where
+  toJSON (UnknownPredicate __field__predicate)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("predicate" .=))
+           __field__predicate
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct UnknownPredicate where
+  buildStruct _proxy (UnknownPredicate __field__predicate)
+    = Thrift.genStruct _proxy
+        (case __field__predicate of
+           Prelude.Just _val -> Thrift.genField _proxy "predicate"
+                                  (Thrift.getStringType _proxy)
+                                  1
+                                  0
+                                  (Thrift.genText _proxy _val)
+                                  : []
+           Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             Prelude.pure (UnknownPredicate __val__predicate)
+              _idMap = HashMap.fromList [("predicate", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData UnknownPredicate where
+  rnf (UnknownPredicate __field__predicate)
+    = DeepSeq.rnf __field__predicate `Prelude.seq` ()
+
+instance Default.Default UnknownPredicate where
+  def = UnknownPredicate Prelude.Nothing
+
+instance Hashable.Hashable UnknownPredicate where
+  hashWithSalt __salt (UnknownPredicate _predicate)
+    = Hashable.hashWithSalt __salt _predicate
+
+instance Exception.Exception UnknownPredicate
+
+newtype PredicateAlreadyComplete = PredicateAlreadyComplete{predicateAlreadyComplete_predicate
+                                                            :: Prelude.Maybe Text.Text}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateAlreadyComplete where
+  toJSON (PredicateAlreadyComplete __field__predicate)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("predicate" .=))
+           __field__predicate
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateAlreadyComplete where
+  buildStruct _proxy (PredicateAlreadyComplete __field__predicate)
+    = Thrift.genStruct _proxy
+        (case __field__predicate of
+           Prelude.Just _val -> Thrift.genField _proxy "predicate"
+                                  (Thrift.getStringType _proxy)
+                                  1
+                                  0
+                                  (Thrift.genText _proxy _val)
+                                  : []
+           Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             Prelude.pure
+                                               (PredicateAlreadyComplete __val__predicate)
+              _idMap = HashMap.fromList [("predicate", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateAlreadyComplete where
+  rnf (PredicateAlreadyComplete __field__predicate)
+    = DeepSeq.rnf __field__predicate `Prelude.seq` ()
+
+instance Default.Default PredicateAlreadyComplete where
+  def = PredicateAlreadyComplete Prelude.Nothing
+
+instance Hashable.Hashable PredicateAlreadyComplete where
+  hashWithSalt __salt (PredicateAlreadyComplete _predicate)
+    = Hashable.hashWithSalt __salt _predicate
+
+instance Exception.Exception PredicateAlreadyComplete
+
+newtype PredicateAlreadyBeingDerived = PredicateAlreadyBeingDerived{predicateAlreadyBeingDerived_predicate
+                                                                    :: Prelude.Maybe Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateAlreadyBeingDerived where
+  toJSON (PredicateAlreadyBeingDerived __field__predicate)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("predicate" .=))
+           __field__predicate
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateAlreadyBeingDerived where
+  buildStruct _proxy
+    (PredicateAlreadyBeingDerived __field__predicate)
+    = Thrift.genStruct _proxy
+        (case __field__predicate of
+           Prelude.Just _val -> Thrift.genField _proxy "predicate"
+                                  (Thrift.getStringType _proxy)
+                                  1
+                                  0
+                                  (Thrift.genText _proxy _val)
+                                  : []
+           Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             Prelude.pure
+                                               (PredicateAlreadyBeingDerived __val__predicate)
+              _idMap = HashMap.fromList [("predicate", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateAlreadyBeingDerived where
+  rnf (PredicateAlreadyBeingDerived __field__predicate)
+    = DeepSeq.rnf __field__predicate `Prelude.seq` ()
+
+instance Default.Default PredicateAlreadyBeingDerived where
+  def = PredicateAlreadyBeingDerived Prelude.Nothing
+
+instance Hashable.Hashable PredicateAlreadyBeingDerived where
+  hashWithSalt __salt (PredicateAlreadyBeingDerived _predicate)
+    = Hashable.hashWithSalt __salt _predicate
+
+instance Exception.Exception PredicateAlreadyBeingDerived
+
+newtype IncompleteDependencies = IncompleteDependencies{incompleteDependencies_incomplete
+                                                        :: [PredicateRef]}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncompleteDependencies where
+  toJSON (IncompleteDependencies __field__incomplete)
+    = Aeson.object
+        ("incomplete" .= __field__incomplete : Prelude.mempty)
+
+instance Thrift.ThriftStruct IncompleteDependencies where
+  buildStruct _proxy (IncompleteDependencies __field__incomplete)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "incomplete" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__incomplete)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__incomplete <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__incomplete
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__incomplete <- ST.readSTRef
+                                                                     __field__incomplete
+                                             Prelude.pure (IncompleteDependencies __val__incomplete)
+              _idMap = HashMap.fromList [("incomplete", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData IncompleteDependencies where
+  rnf (IncompleteDependencies __field__incomplete)
+    = DeepSeq.rnf __field__incomplete `Prelude.seq` ()
+
+instance Default.Default IncompleteDependencies where
+  def = IncompleteDependencies Default.def
+
+instance Hashable.Hashable IncompleteDependencies where
+  hashWithSalt __salt (IncompleteDependencies _incomplete)
+    = Hashable.hashWithSalt __salt _incomplete
+
+instance Exception.Exception IncompleteDependencies
+
+data DerivationProgress = DerivationProgress_ongoing UserQueryStats
+                        | DerivationProgress_complete UserQueryStats
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivationProgress where
+  toJSON (DerivationProgress_ongoing __ongoing)
+    = Aeson.object ["ongoing" .= __ongoing]
+  toJSON (DerivationProgress_complete __complete)
+    = Aeson.object ["complete" .= __complete]
+
+instance Thrift.ThriftStruct DerivationProgress where
+  buildStruct _proxy (DerivationProgress_ongoing __ongoing)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ongoing" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __ongoing)]
+  buildStruct _proxy (DerivationProgress_complete __complete)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "complete" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __complete)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DerivationProgress_ongoing _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DerivationProgress_complete _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'DerivationProgress': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail
+                                "union 'DerivationProgress' is empty"
+    where
+      _idMap = HashMap.fromList [("ongoing", 1), ("complete", 2)]
+
+instance DeepSeq.NFData DerivationProgress where
+  rnf (DerivationProgress_ongoing __ongoing) = DeepSeq.rnf __ongoing
+  rnf (DerivationProgress_complete __complete)
+    = DeepSeq.rnf __complete
+
+instance Default.Default DerivationProgress where
+  def = DerivationProgress_ongoing Default.def
+
+instance Hashable.Hashable DerivationProgress where
+  hashWithSalt __salt (DerivationProgress_ongoing _ongoing)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _ongoing)
+  hashWithSalt __salt (DerivationProgress_complete _complete)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _complete)
+
+newtype DerivationOngoing = DerivationOngoing{derivationOngoing_stats
+                                              :: UserQueryStats}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivationOngoing where
+  toJSON (DerivationOngoing __field__stats)
+    = Aeson.object ("stats" .= __field__stats : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivationOngoing where
+  buildStruct _proxy (DerivationOngoing __field__stats)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "stats" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__stats)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__stats <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__stats
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__stats <- ST.readSTRef __field__stats
+                                             Prelude.pure (DerivationOngoing __val__stats)
+              _idMap = HashMap.fromList [("stats", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivationOngoing where
+  rnf (DerivationOngoing __field__stats)
+    = DeepSeq.rnf __field__stats `Prelude.seq` ()
+
+instance Default.Default DerivationOngoing where
+  def = DerivationOngoing Default.def
+
+instance Hashable.Hashable DerivationOngoing where
+  hashWithSalt __salt (DerivationOngoing _stats)
+    = Hashable.hashWithSalt __salt _stats
+
+newtype DerivationComplete = DerivationComplete{derivationComplete_stats
+                                                :: UserQueryStats}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivationComplete where
+  toJSON (DerivationComplete __field__stats)
+    = Aeson.object ("stats" .= __field__stats : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivationComplete where
+  buildStruct _proxy (DerivationComplete __field__stats)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "stats" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__stats)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__stats <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__stats
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__stats <- ST.readSTRef __field__stats
+                                             Prelude.pure (DerivationComplete __val__stats)
+              _idMap = HashMap.fromList [("stats", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivationComplete where
+  rnf (DerivationComplete __field__stats)
+    = DeepSeq.rnf __field__stats `Prelude.seq` ()
+
+instance Default.Default DerivationComplete where
+  def = DerivationComplete Default.def
+
+instance Hashable.Hashable DerivationComplete where
+  hashWithSalt __salt (DerivationComplete _stats)
+    = Hashable.hashWithSalt __salt _stats
+
+data DerivationStatus = DerivationStatus_ongoing DerivationOngoing
+                      | DerivationStatus_complete DerivationComplete
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivationStatus where
+  toJSON (DerivationStatus_ongoing __ongoing)
+    = Aeson.object ["ongoing" .= __ongoing]
+  toJSON (DerivationStatus_complete __complete)
+    = Aeson.object ["complete" .= __complete]
+
+instance Thrift.ThriftStruct DerivationStatus where
+  buildStruct _proxy (DerivationStatus_ongoing __ongoing)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ongoing" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __ongoing)]
+  buildStruct _proxy (DerivationStatus_complete __complete)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "complete" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __complete)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DerivationStatus_ongoing _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DerivationStatus_complete _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'DerivationStatus': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'DerivationStatus' is empty"
+    where
+      _idMap = HashMap.fromList [("ongoing", 1), ("complete", 2)]
+
+instance DeepSeq.NFData DerivationStatus where
+  rnf (DerivationStatus_ongoing __ongoing) = DeepSeq.rnf __ongoing
+  rnf (DerivationStatus_complete __complete) = DeepSeq.rnf __complete
+
+instance Default.Default DerivationStatus where
+  def = DerivationStatus_ongoing Default.def
+
+instance Hashable.Hashable DerivationStatus where
+  hashWithSalt __salt (DerivationStatus_ongoing _ongoing)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _ongoing)
+  hashWithSalt __salt (DerivationStatus_complete _complete)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _complete)
+
+data UserQuery = UserQuery{userQuery_predicate :: Text.Text,
+                           userQuery_query :: Bytestring,
+                           userQuery_predicate_version :: Prelude.Maybe Version,
+                           userQuery_options :: Prelude.Maybe UserQueryOptions,
+                           userQuery_encodings :: [UserQueryEncoding],
+                           userQuery_client_info :: Prelude.Maybe UserQueryClientInfo,
+                           userQuery_schema_id :: Prelude.Maybe SchemaId}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQuery where
+  toJSON
+    (UserQuery __field__predicate __field__query
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Aeson.object
+        ("predicate" .= __field__predicate :
+           "query" .= Text.decodeUtf8 __field__query :
+             Prelude.maybe Prelude.id ((:) . ("predicate_version" .=))
+               __field__predicate_version
+               (Prelude.maybe Prelude.id ((:) . ("options" .=)) __field__options
+                  ("encodings" .= __field__encodings :
+                     Prelude.maybe Prelude.id ((:) . ("client_info" .=))
+                       __field__client_info
+                       (Prelude.maybe Prelude.id ((:) . ("schema_id" .=))
+                          (Prelude.fmap unSchemaId __field__schema_id)
+                          Prelude.mempty))))
+
+instance Thrift.ThriftStruct UserQuery where
+  buildStruct _proxy
+    (UserQuery __field__predicate __field__query
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "predicate" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__predicate)
+           :
+           Thrift.genField _proxy "query" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genByteString _proxy __field__query)
+             :
+             let (__cereal__predicate_version, __id__predicate_version)
+                   = case __field__predicate_version of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "predicate_version"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.genI32 _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__predicate_version
+                 (let (__cereal__options, __id__options)
+                        = case __field__options of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "options"
+                                                       (Thrift.getStructType _proxy)
+                                                       5
+                                                       __id__predicate_version
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  5)
+                            Prelude.Nothing -> (Prelude.id, __id__predicate_version)
+                    in
+                    __cereal__options
+                      (Thrift.genField _proxy "encodings" (Thrift.getListType _proxy) 6
+                         __id__options
+                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                            (Thrift.buildStruct _proxy)
+                            __field__encodings)
+                         :
+                         let (__cereal__client_info, __id__client_info)
+                               = case __field__client_info of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "client_info"
+                                                              (Thrift.getStructType _proxy)
+                                                              7
+                                                              6
+                                                              (Thrift.buildStruct _proxy _val)),
+                                                         7)
+                                   Prelude.Nothing -> (Prelude.id, 6)
+                           in
+                           __cereal__client_info
+                             (case __field__schema_id of
+                                Prelude.Just _val -> Thrift.genField _proxy "schema_id"
+                                                       (Thrift.getStringType _proxy)
+                                                       8
+                                                       __id__client_info
+                                                       ((Thrift.genText _proxy . unSchemaId) _val)
+                                                       : []
+                                Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef ""
+            __field__query <- ST.newSTRef Default.def
+            __field__predicate_version <- ST.newSTRef Prelude.Nothing
+            __field__options <- ST.newSTRef Prelude.Nothing
+            __field__encodings <- ST.newSTRef []
+            __field__client_info <- ST.newSTRef Prelude.Nothing
+            __field__schema_id <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseByteString
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate_version
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__encodings
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__client_info
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             !__val__query <- ST.readSTRef __field__query
+                                             !__val__predicate_version <- ST.readSTRef
+                                                                            __field__predicate_version
+                                             !__val__options <- ST.readSTRef __field__options
+                                             !__val__encodings <- ST.readSTRef __field__encodings
+                                             !__val__client_info <- ST.readSTRef
+                                                                      __field__client_info
+                                             !__val__schema_id <- ST.readSTRef __field__schema_id
+                                             Prelude.pure
+                                               (UserQuery __val__predicate __val__query
+                                                  __val__predicate_version
+                                                  __val__options
+                                                  __val__encodings
+                                                  __val__client_info
+                                                  __val__schema_id)
+              _idMap
+                = HashMap.fromList
+                    [("predicate", 1), ("query", 2), ("predicate_version", 3),
+                     ("options", 5), ("encodings", 6), ("client_info", 7),
+                     ("schema_id", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQuery where
+  rnf
+    (UserQuery __field__predicate __field__query
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = DeepSeq.rnf __field__predicate `Prelude.seq`
+        DeepSeq.rnf __field__query `Prelude.seq`
+          DeepSeq.rnf __field__predicate_version `Prelude.seq`
+            DeepSeq.rnf __field__options `Prelude.seq`
+              DeepSeq.rnf __field__encodings `Prelude.seq`
+                DeepSeq.rnf __field__client_info `Prelude.seq`
+                  DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default UserQuery where
+  def
+    = UserQuery "" Default.def Prelude.Nothing Prelude.Nothing []
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable UserQuery where
+  hashWithSalt __salt
+    (UserQuery _predicate _query _predicate_version _options _encodings
+       _client_info _schema_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _predicate)
+                       _query)
+                    _predicate_version)
+                 _options)
+              _encodings)
+           _client_info)
+        _schema_id
+
+data UserQueryBatch = UserQueryBatch{userQueryBatch_predicate ::
+                                     Text.Text,
+                                     userQueryBatch_queries :: [Bytestring],
+                                     userQueryBatch_predicate_version :: Prelude.Maybe Version,
+                                     userQueryBatch_options :: Prelude.Maybe UserQueryOptions,
+                                     userQueryBatch_encodings :: [UserQueryEncoding],
+                                     userQueryBatch_client_info ::
+                                     Prelude.Maybe UserQueryClientInfo,
+                                     userQueryBatch_schema_id :: Prelude.Maybe SchemaId}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryBatch where
+  toJSON
+    (UserQueryBatch __field__predicate __field__queries
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Aeson.object
+        ("predicate" .= __field__predicate :
+           "queries" .= Prelude.map Text.decodeUtf8 __field__queries :
+             Prelude.maybe Prelude.id ((:) . ("predicate_version" .=))
+               __field__predicate_version
+               (Prelude.maybe Prelude.id ((:) . ("options" .=)) __field__options
+                  ("encodings" .= __field__encodings :
+                     Prelude.maybe Prelude.id ((:) . ("client_info" .=))
+                       __field__client_info
+                       (Prelude.maybe Prelude.id ((:) . ("schema_id" .=))
+                          (Prelude.fmap unSchemaId __field__schema_id)
+                          Prelude.mempty))))
+
+instance Thrift.ThriftStruct UserQueryBatch where
+  buildStruct _proxy
+    (UserQueryBatch __field__predicate __field__queries
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "predicate" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__predicate)
+           :
+           Thrift.genField _proxy "queries" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genByteString _proxy)
+                __field__queries)
+             :
+             let (__cereal__predicate_version, __id__predicate_version)
+                   = case __field__predicate_version of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "predicate_version"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.genI32 _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__predicate_version
+                 (let (__cereal__options, __id__options)
+                        = case __field__options of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "options"
+                                                       (Thrift.getStructType _proxy)
+                                                       5
+                                                       __id__predicate_version
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  5)
+                            Prelude.Nothing -> (Prelude.id, __id__predicate_version)
+                    in
+                    __cereal__options
+                      (Thrift.genField _proxy "encodings" (Thrift.getListType _proxy) 6
+                         __id__options
+                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                            (Thrift.buildStruct _proxy)
+                            __field__encodings)
+                         :
+                         let (__cereal__client_info, __id__client_info)
+                               = case __field__client_info of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "client_info"
+                                                              (Thrift.getStructType _proxy)
+                                                              7
+                                                              6
+                                                              (Thrift.buildStruct _proxy _val)),
+                                                         7)
+                                   Prelude.Nothing -> (Prelude.id, 6)
+                           in
+                           __cereal__client_info
+                             (case __field__schema_id of
+                                Prelude.Just _val -> Thrift.genField _proxy "schema_id"
+                                                       (Thrift.getStringType _proxy)
+                                                       8
+                                                       __id__client_info
+                                                       ((Thrift.genText _proxy . unSchemaId) _val)
+                                                       : []
+                                Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef ""
+            __field__queries <- ST.newSTRef Default.def
+            __field__predicate_version <- ST.newSTRef Prelude.Nothing
+            __field__options <- ST.newSTRef Prelude.Nothing
+            __field__encodings <- ST.newSTRef []
+            __field__client_info <- ST.newSTRef Prelude.Nothing
+            __field__schema_id <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__queries
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate_version
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__encodings
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__client_info
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             !__val__queries <- ST.readSTRef __field__queries
+                                             !__val__predicate_version <- ST.readSTRef
+                                                                            __field__predicate_version
+                                             !__val__options <- ST.readSTRef __field__options
+                                             !__val__encodings <- ST.readSTRef __field__encodings
+                                             !__val__client_info <- ST.readSTRef
+                                                                      __field__client_info
+                                             !__val__schema_id <- ST.readSTRef __field__schema_id
+                                             Prelude.pure
+                                               (UserQueryBatch __val__predicate __val__queries
+                                                  __val__predicate_version
+                                                  __val__options
+                                                  __val__encodings
+                                                  __val__client_info
+                                                  __val__schema_id)
+              _idMap
+                = HashMap.fromList
+                    [("predicate", 1), ("queries", 2), ("predicate_version", 3),
+                     ("options", 5), ("encodings", 6), ("client_info", 7),
+                     ("schema_id", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryBatch where
+  rnf
+    (UserQueryBatch __field__predicate __field__queries
+       __field__predicate_version __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = DeepSeq.rnf __field__predicate `Prelude.seq`
+        DeepSeq.rnf __field__queries `Prelude.seq`
+          DeepSeq.rnf __field__predicate_version `Prelude.seq`
+            DeepSeq.rnf __field__options `Prelude.seq`
+              DeepSeq.rnf __field__encodings `Prelude.seq`
+                DeepSeq.rnf __field__client_info `Prelude.seq`
+                  DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default UserQueryBatch where
+  def
+    = UserQueryBatch "" Default.def Prelude.Nothing Prelude.Nothing []
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable UserQueryBatch where
+  hashWithSalt __salt
+    (UserQueryBatch _predicate _queries _predicate_version _options
+       _encodings _client_info _schema_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _predicate)
+                       _queries)
+                    _predicate_version)
+                 _options)
+              _encodings)
+           _client_info)
+        _schema_id
+
+data UserQueryStats = UserQueryStats{userQueryStats_num_facts ::
+                                     Int.Int64,
+                                     userQueryStats_elapsed_ns :: Int.Int64,
+                                     userQueryStats_allocated_bytes :: Int.Int64,
+                                     userQueryStats_facts_searched ::
+                                     Prelude.Maybe (Map.Map Id Int.Int64),
+                                     userQueryStats_compile_time_ns :: Prelude.Maybe Int.Int64,
+                                     userQueryStats_bytecode_size :: Prelude.Maybe Int.Int64,
+                                     userQueryStats_execute_time_ns :: Prelude.Maybe Int.Int64,
+                                     userQueryStats_result_count :: Int.Int64,
+                                     userQueryStats_codegen_time_ns :: Prelude.Maybe Int.Int64,
+                                     userQueryStats_full_scans :: [PredicateRef],
+                                     userQueryStats_result_bytes :: Prelude.Maybe Int.Int64}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryStats where
+  toJSON
+    (UserQueryStats __field__num_facts __field__elapsed_ns
+       __field__allocated_bytes __field__facts_searched
+       __field__compile_time_ns __field__bytecode_size
+       __field__execute_time_ns __field__result_count
+       __field__codegen_time_ns __field__full_scans __field__result_bytes)
+    = Aeson.object
+        ("num_facts" .= __field__num_facts :
+           "elapsed_ns" .= __field__elapsed_ns :
+             "allocated_bytes" .= __field__allocated_bytes :
+               Prelude.maybe Prelude.id ((:) . ("facts_searched" .=))
+                 (Prelude.fmap (Map.mapKeys Thrift.keyToStr)
+                    __field__facts_searched)
+                 (Prelude.maybe Prelude.id ((:) . ("compile_time_ns" .=))
+                    __field__compile_time_ns
+                    (Prelude.maybe Prelude.id ((:) . ("bytecode_size" .=))
+                       __field__bytecode_size
+                       (Prelude.maybe Prelude.id ((:) . ("execute_time_ns" .=))
+                          __field__execute_time_ns
+                          ("result_count" .= __field__result_count :
+                             Prelude.maybe Prelude.id ((:) . ("codegen_time_ns" .=))
+                               __field__codegen_time_ns
+                               ("full_scans" .= __field__full_scans :
+                                  Prelude.maybe Prelude.id ((:) . ("result_bytes" .=))
+                                    __field__result_bytes
+                                    Prelude.mempty))))))
+
+instance Thrift.ThriftStruct UserQueryStats where
+  buildStruct _proxy
+    (UserQueryStats __field__num_facts __field__elapsed_ns
+       __field__allocated_bytes __field__facts_searched
+       __field__compile_time_ns __field__bytecode_size
+       __field__execute_time_ns __field__result_count
+       __field__codegen_time_ns __field__full_scans __field__result_bytes)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "num_facts" (Thrift.getI64Type _proxy)
+           2
+           0
+           (Thrift.genI64Prim _proxy)
+           __field__num_facts
+           :
+           Thrift.genFieldPrim _proxy "elapsed_ns" (Thrift.getI64Type _proxy)
+             3
+             2
+             (Thrift.genI64Prim _proxy)
+             __field__elapsed_ns
+             :
+             Thrift.genFieldPrim _proxy "allocated_bytes"
+               (Thrift.getI64Type _proxy)
+               4
+               3
+               (Thrift.genI64Prim _proxy)
+               __field__allocated_bytes
+               :
+               let (__cereal__facts_searched, __id__facts_searched)
+                     = case __field__facts_searched of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "facts_searched"
+                                                    (Thrift.getMapType _proxy)
+                                                    5
+                                                    4
+                                                    ((Thrift.genMap _proxy
+                                                        (Thrift.getI64Type _proxy)
+                                                        (Thrift.getI64Type _proxy)
+                                                        Prelude.False
+                                                        (Thrift.genI64 _proxy)
+                                                        (Thrift.genI64 _proxy)
+                                                        . Map.toList)
+                                                       _val)),
+                                               5)
+                         Prelude.Nothing -> (Prelude.id, 4)
+                 in
+                 __cereal__facts_searched
+                   (let (__cereal__compile_time_ns, __id__compile_time_ns)
+                          = case __field__compile_time_ns of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genFieldPrim _proxy "compile_time_ns"
+                                                         (Thrift.getI64Type _proxy)
+                                                         6
+                                                         __id__facts_searched
+                                                         (Thrift.genI64Prim _proxy)
+                                                         _val),
+                                                    6)
+                              Prelude.Nothing -> (Prelude.id, __id__facts_searched)
+                      in
+                      __cereal__compile_time_ns
+                        (let (__cereal__bytecode_size, __id__bytecode_size)
+                               = case __field__bytecode_size of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genFieldPrim _proxy
+                                                              "bytecode_size"
+                                                              (Thrift.getI64Type _proxy)
+                                                              7
+                                                              __id__compile_time_ns
+                                                              (Thrift.genI64Prim _proxy)
+                                                              _val),
+                                                         7)
+                                   Prelude.Nothing -> (Prelude.id, __id__compile_time_ns)
+                           in
+                           __cereal__bytecode_size
+                             (let (__cereal__execute_time_ns, __id__execute_time_ns)
+                                    = case __field__execute_time_ns of
+                                        Prelude.Just _val -> ((:)
+                                                                (Thrift.genFieldPrim _proxy
+                                                                   "execute_time_ns"
+                                                                   (Thrift.getI64Type _proxy)
+                                                                   8
+                                                                   __id__bytecode_size
+                                                                   (Thrift.genI64Prim _proxy)
+                                                                   _val),
+                                                              8)
+                                        Prelude.Nothing -> (Prelude.id, __id__bytecode_size)
+                                in
+                                __cereal__execute_time_ns
+                                  (Thrift.genFieldPrim _proxy "result_count"
+                                     (Thrift.getI64Type _proxy)
+                                     9
+                                     __id__execute_time_ns
+                                     (Thrift.genI64Prim _proxy)
+                                     __field__result_count
+                                     :
+                                     let (__cereal__codegen_time_ns, __id__codegen_time_ns)
+                                           = case __field__codegen_time_ns of
+                                               Prelude.Just _val -> ((:)
+                                                                       (Thrift.genFieldPrim _proxy
+                                                                          "codegen_time_ns"
+                                                                          (Thrift.getI64Type _proxy)
+                                                                          10
+                                                                          9
+                                                                          (Thrift.genI64Prim _proxy)
+                                                                          _val),
+                                                                     10)
+                                               Prelude.Nothing -> (Prelude.id, 9)
+                                       in
+                                       __cereal__codegen_time_ns
+                                         (Thrift.genField _proxy "full_scans"
+                                            (Thrift.getListType _proxy)
+                                            11
+                                            __id__codegen_time_ns
+                                            (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                               (Thrift.buildStruct _proxy)
+                                               __field__full_scans)
+                                            :
+                                            case __field__result_bytes of
+                                              Prelude.Just _val -> Thrift.genFieldPrim _proxy
+                                                                     "result_bytes"
+                                                                     (Thrift.getI64Type _proxy)
+                                                                     12
+                                                                     11
+                                                                     (Thrift.genI64Prim _proxy)
+                                                                     _val
+                                                                     : []
+                                              Prelude.Nothing -> []))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__num_facts <- ST.newSTRef Default.def
+            __field__elapsed_ns <- ST.newSTRef Default.def
+            __field__allocated_bytes <- ST.newSTRef Default.def
+            __field__facts_searched <- ST.newSTRef Prelude.Nothing
+            __field__compile_time_ns <- ST.newSTRef Prelude.Nothing
+            __field__bytecode_size <- ST.newSTRef Prelude.Nothing
+            __field__execute_time_ns <- ST.newSTRef Prelude.Nothing
+            __field__result_count <- ST.newSTRef Default.def
+            __field__codegen_time_ns <- ST.newSTRef Prelude.Nothing
+            __field__full_scans <- ST.newSTRef []
+            __field__result_bytes <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__num_facts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__elapsed_ns
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__allocated_bytes
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__facts_searched
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__compile_time_ns
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__bytecode_size
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__execute_time_ns
+                                                                          (Prelude.Just _val)
+                                                                 9 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__result_count
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__codegen_time_ns
+                                                                           (Prelude.Just _val)
+                                                                 11 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__full_scans
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getI64Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseI64
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__result_bytes
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__num_facts <- ST.readSTRef
+                                                                    __field__num_facts
+                                             !__val__elapsed_ns <- ST.readSTRef __field__elapsed_ns
+                                             !__val__allocated_bytes <- ST.readSTRef
+                                                                          __field__allocated_bytes
+                                             !__val__facts_searched <- ST.readSTRef
+                                                                         __field__facts_searched
+                                             !__val__compile_time_ns <- ST.readSTRef
+                                                                          __field__compile_time_ns
+                                             !__val__bytecode_size <- ST.readSTRef
+                                                                        __field__bytecode_size
+                                             !__val__execute_time_ns <- ST.readSTRef
+                                                                          __field__execute_time_ns
+                                             !__val__result_count <- ST.readSTRef
+                                                                       __field__result_count
+                                             !__val__codegen_time_ns <- ST.readSTRef
+                                                                          __field__codegen_time_ns
+                                             !__val__full_scans <- ST.readSTRef __field__full_scans
+                                             !__val__result_bytes <- ST.readSTRef
+                                                                       __field__result_bytes
+                                             Prelude.pure
+                                               (UserQueryStats __val__num_facts __val__elapsed_ns
+                                                  __val__allocated_bytes
+                                                  __val__facts_searched
+                                                  __val__compile_time_ns
+                                                  __val__bytecode_size
+                                                  __val__execute_time_ns
+                                                  __val__result_count
+                                                  __val__codegen_time_ns
+                                                  __val__full_scans
+                                                  __val__result_bytes)
+              _idMap
+                = HashMap.fromList
+                    [("num_facts", 2), ("elapsed_ns", 3), ("allocated_bytes", 4),
+                     ("facts_searched", 5), ("compile_time_ns", 6),
+                     ("bytecode_size", 7), ("execute_time_ns", 8), ("result_count", 9),
+                     ("codegen_time_ns", 10), ("full_scans", 11), ("result_bytes", 12)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryStats where
+  rnf
+    (UserQueryStats __field__num_facts __field__elapsed_ns
+       __field__allocated_bytes __field__facts_searched
+       __field__compile_time_ns __field__bytecode_size
+       __field__execute_time_ns __field__result_count
+       __field__codegen_time_ns __field__full_scans __field__result_bytes)
+    = DeepSeq.rnf __field__num_facts `Prelude.seq`
+        DeepSeq.rnf __field__elapsed_ns `Prelude.seq`
+          DeepSeq.rnf __field__allocated_bytes `Prelude.seq`
+            DeepSeq.rnf __field__facts_searched `Prelude.seq`
+              DeepSeq.rnf __field__compile_time_ns `Prelude.seq`
+                DeepSeq.rnf __field__bytecode_size `Prelude.seq`
+                  DeepSeq.rnf __field__execute_time_ns `Prelude.seq`
+                    DeepSeq.rnf __field__result_count `Prelude.seq`
+                      DeepSeq.rnf __field__codegen_time_ns `Prelude.seq`
+                        DeepSeq.rnf __field__full_scans `Prelude.seq`
+                          DeepSeq.rnf __field__result_bytes `Prelude.seq` ()
+
+instance Default.Default UserQueryStats where
+  def
+    = UserQueryStats Default.def Default.def Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        []
+        Prelude.Nothing
+
+instance Hashable.Hashable UserQueryStats where
+  hashWithSalt __salt
+    (UserQueryStats _num_facts _elapsed_ns _allocated_bytes
+       _facts_searched _compile_time_ns _bytecode_size _execute_time_ns
+       _result_count _codegen_time_ns _full_scans _result_bytes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _num_facts)
+                                   _elapsed_ns)
+                                _allocated_bytes)
+                             (Prelude.fmap
+                                (Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                                _facts_searched))
+                          _compile_time_ns)
+                       _bytecode_size)
+                    _execute_time_ns)
+                 _result_count)
+              _codegen_time_ns)
+           _full_scans)
+        _result_bytes
+
+data UserQueryResultsBin = UserQueryResultsBin{userQueryResultsBin_encoding
+                                               :: UserQueryEncodingBin,
+                                               userQueryResultsBin_facts :: Map.Map Id Fact,
+                                               userQueryResultsBin_nestedFacts :: Map.Map Id Fact}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResultsBin where
+  toJSON
+    (UserQueryResultsBin __field__encoding __field__facts
+       __field__nestedFacts)
+    = Aeson.object
+        ("encoding" .= __field__encoding :
+           "facts" .= Map.mapKeys Thrift.keyToStr __field__facts :
+             "nestedFacts" .= Map.mapKeys Thrift.keyToStr __field__nestedFacts :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryResultsBin where
+  buildStruct _proxy
+    (UserQueryResultsBin __field__encoding __field__facts
+       __field__nestedFacts)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "encoding" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__encoding)
+           :
+           Thrift.genField _proxy "facts" (Thrift.getMapType _proxy) 2 1
+             ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.getStructType _proxy)
+                 Prelude.False
+                 (Thrift.genI64 _proxy)
+                 (Thrift.buildStruct _proxy)
+                 . Map.toList)
+                __field__facts)
+             :
+             Thrift.genField _proxy "nestedFacts" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                   (Thrift.getStructType _proxy)
+                   Prelude.False
+                   (Thrift.genI64 _proxy)
+                   (Thrift.buildStruct _proxy)
+                   . Map.toList)
+                  __field__nestedFacts)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__encoding <- ST.newSTRef Default.def
+            __field__facts <- ST.newSTRef Default.def
+            __field__nestedFacts <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__encoding
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__nestedFacts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__encoding <- ST.readSTRef
+                                                                   __field__encoding
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__nestedFacts <- ST.readSTRef
+                                                                      __field__nestedFacts
+                                             Prelude.pure
+                                               (UserQueryResultsBin __val__encoding __val__facts
+                                                  __val__nestedFacts)
+              _idMap
+                = HashMap.fromList
+                    [("encoding", 1), ("facts", 2), ("nestedFacts", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryResultsBin where
+  rnf
+    (UserQueryResultsBin __field__encoding __field__facts
+       __field__nestedFacts)
+    = DeepSeq.rnf __field__encoding `Prelude.seq`
+        DeepSeq.rnf __field__facts `Prelude.seq`
+          DeepSeq.rnf __field__nestedFacts `Prelude.seq` ()
+
+instance Default.Default UserQueryResultsBin where
+  def = UserQueryResultsBin Default.def Default.def Default.def
+
+instance Hashable.Hashable UserQueryResultsBin where
+  hashWithSalt __salt
+    (UserQueryResultsBin _encoding _facts _nestedFacts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _encoding)
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _facts))
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _nestedFacts)
+
+data UserQueryResultsListBin = UserQueryResultsListBin{userQueryResultsListBin_encoding
+                                                       :: UserQueryEncodingListBin,
+                                                       userQueryResultsListBin_ids :: List_Id_2029,
+                                                       userQueryResultsListBin_facts ::
+                                                       List_Fact_2137,
+                                                       userQueryResultsListBin_nestedFacts ::
+                                                       Map.Map Id Fact}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResultsListBin where
+  toJSON
+    (UserQueryResultsListBin __field__encoding __field__ids
+       __field__facts __field__nestedFacts)
+    = Aeson.object
+        ("encoding" .= __field__encoding :
+           "ids" .= __field__ids :
+             "facts" .= __field__facts :
+               "nestedFacts" .= Map.mapKeys Thrift.keyToStr __field__nestedFacts :
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryResultsListBin where
+  buildStruct _proxy
+    (UserQueryResultsListBin __field__encoding __field__ids
+       __field__facts __field__nestedFacts)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "encoding" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__encoding)
+           :
+           Thrift.genField _proxy "ids" (Thrift.getListType _proxy) 2 1
+             ((Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.genI64 _proxy)
+                 . Vector.toList)
+                __field__ids)
+             :
+             Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 3 2
+               ((Thrift.genList _proxy (Thrift.getStructType _proxy)
+                   (Thrift.buildStruct _proxy)
+                   . Vector.toList)
+                  __field__facts)
+               :
+               Thrift.genField _proxy "nestedFacts" (Thrift.getMapType _proxy) 4 3
+                 ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                     (Thrift.getStructType _proxy)
+                     Prelude.False
+                     (Thrift.genI64 _proxy)
+                     (Thrift.buildStruct _proxy)
+                     . Map.toList)
+                    __field__nestedFacts)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__encoding <- ST.newSTRef Default.def
+            __field__ids <- ST.newSTRef Vector.empty
+            __field__facts <- ST.newSTRef Vector.empty
+            __field__nestedFacts <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__encoding
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      Vector.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__ids
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.uncurry
+                                                                                      Vector.fromListN
+                                                                                      <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__nestedFacts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__encoding <- ST.readSTRef
+                                                                   __field__encoding
+                                             !__val__ids <- ST.readSTRef __field__ids
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__nestedFacts <- ST.readSTRef
+                                                                      __field__nestedFacts
+                                             Prelude.pure
+                                               (UserQueryResultsListBin __val__encoding __val__ids
+                                                  __val__facts
+                                                  __val__nestedFacts)
+              _idMap
+                = HashMap.fromList
+                    [("encoding", 1), ("ids", 2), ("facts", 3), ("nestedFacts", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryResultsListBin where
+  rnf
+    (UserQueryResultsListBin __field__encoding __field__ids
+       __field__facts __field__nestedFacts)
+    = DeepSeq.rnf __field__encoding `Prelude.seq`
+        DeepSeq.rnf __field__ids `Prelude.seq`
+          DeepSeq.rnf __field__facts `Prelude.seq`
+            DeepSeq.rnf __field__nestedFacts `Prelude.seq` ()
+
+instance Default.Default UserQueryResultsListBin where
+  def
+    = UserQueryResultsListBin Default.def Vector.empty Vector.empty
+        Default.def
+
+instance Hashable.Hashable UserQueryResultsListBin where
+  hashWithSalt __salt
+    (UserQueryResultsListBin _encoding _ids _facts _nestedFacts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _encoding)
+              (Vector.toList _ids))
+           (Vector.toList _facts))
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _nestedFacts)
+
+data UserQueryResultsJSON = UserQueryResultsJSON{userQueryResultsJSON_encoding
+                                                 :: UserQueryEncodingJSON,
+                                                 userQueryResultsJSON_facts :: [Json],
+                                                 userQueryResultsJSON_nestedFacts ::
+                                                 Map.Map Id Json}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResultsJSON where
+  toJSON
+    (UserQueryResultsJSON __field__encoding __field__facts
+       __field__nestedFacts)
+    = Aeson.object
+        ("encoding" .= __field__encoding :
+           "facts" .= Prelude.map Text.decodeUtf8 __field__facts :
+             "nestedFacts" .=
+               (Map.mapKeys Thrift.keyToStr . Map.map Text.decodeUtf8)
+                 __field__nestedFacts
+               : Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryResultsJSON where
+  buildStruct _proxy
+    (UserQueryResultsJSON __field__encoding __field__facts
+       __field__nestedFacts)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "encoding" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__encoding)
+           :
+           Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genByteString _proxy)
+                __field__facts)
+             :
+             Thrift.genField _proxy "nestedFacts" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                   (Thrift.getStringType _proxy)
+                   Prelude.False
+                   (Thrift.genI64 _proxy)
+                   (Thrift.genByteString _proxy)
+                   . Map.toList)
+                  __field__nestedFacts)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__encoding <- ST.newSTRef Default.def
+            __field__facts <- ST.newSTRef Default.def
+            __field__nestedFacts <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__encoding
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__nestedFacts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__encoding <- ST.readSTRef
+                                                                   __field__encoding
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__nestedFacts <- ST.readSTRef
+                                                                      __field__nestedFacts
+                                             Prelude.pure
+                                               (UserQueryResultsJSON __val__encoding __val__facts
+                                                  __val__nestedFacts)
+              _idMap
+                = HashMap.fromList
+                    [("encoding", 1), ("facts", 2), ("nestedFacts", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryResultsJSON where
+  rnf
+    (UserQueryResultsJSON __field__encoding __field__facts
+       __field__nestedFacts)
+    = DeepSeq.rnf __field__encoding `Prelude.seq`
+        DeepSeq.rnf __field__facts `Prelude.seq`
+          DeepSeq.rnf __field__nestedFacts `Prelude.seq` ()
+
+instance Default.Default UserQueryResultsJSON where
+  def = UserQueryResultsJSON Default.def Default.def Default.def
+
+instance Hashable.Hashable UserQueryResultsJSON where
+  hashWithSalt __salt
+    (UserQueryResultsJSON _encoding _facts _nestedFacts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _encoding)
+           _facts)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _nestedFacts)
+
+data UserQueryResultsCompact = UserQueryResultsCompact{userQueryResultsCompact_encoding
+                                                       :: UserQueryEncodingCompact,
+                                                       userQueryResultsCompact_facts ::
+                                                       [ByteString.ByteString],
+                                                       userQueryResultsCompact_nestedFacts ::
+                                                       Map.Map Id ByteString.ByteString}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResultsCompact where
+  toJSON
+    (UserQueryResultsCompact __field__encoding __field__facts
+       __field__nestedFacts)
+    = Aeson.object
+        ("encoding" .= __field__encoding :
+           "facts" .= Prelude.map Thrift.encodeBase64Text __field__facts :
+             "nestedFacts" .=
+               (Map.mapKeys Thrift.keyToStr . Map.map Thrift.encodeBase64Text)
+                 __field__nestedFacts
+               : Prelude.mempty)
+
+instance Thrift.ThriftStruct UserQueryResultsCompact where
+  buildStruct _proxy
+    (UserQueryResultsCompact __field__encoding __field__facts
+       __field__nestedFacts)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "encoding" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__encoding)
+           :
+           Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genBytes _proxy)
+                __field__facts)
+             :
+             Thrift.genField _proxy "nestedFacts" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                   (Thrift.getStringType _proxy)
+                   Prelude.False
+                   (Thrift.genI64 _proxy)
+                   (Thrift.genBytes _proxy)
+                   . Map.toList)
+                  __field__nestedFacts)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__encoding <- ST.newSTRef Default.def
+            __field__facts <- ST.newSTRef Default.def
+            __field__nestedFacts <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__encoding
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseBytes
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseBytes
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__nestedFacts
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__encoding <- ST.readSTRef
+                                                                   __field__encoding
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__nestedFacts <- ST.readSTRef
+                                                                      __field__nestedFacts
+                                             Prelude.pure
+                                               (UserQueryResultsCompact __val__encoding __val__facts
+                                                  __val__nestedFacts)
+              _idMap
+                = HashMap.fromList
+                    [("encoding", 1), ("facts", 2), ("nestedFacts", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryResultsCompact where
+  rnf
+    (UserQueryResultsCompact __field__encoding __field__facts
+       __field__nestedFacts)
+    = DeepSeq.rnf __field__encoding `Prelude.seq`
+        DeepSeq.rnf __field__facts `Prelude.seq`
+          DeepSeq.rnf __field__nestedFacts `Prelude.seq` ()
+
+instance Default.Default UserQueryResultsCompact where
+  def = UserQueryResultsCompact Default.def Default.def Default.def
+
+instance Hashable.Hashable UserQueryResultsCompact where
+  hashWithSalt __salt
+    (UserQueryResultsCompact _encoding _facts _nestedFacts)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _encoding)
+           _facts)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _nestedFacts)
+
+data UserQueryEncodedResults = UserQueryEncodedResults_bin UserQueryResultsBin
+                             | UserQueryEncodedResults_json UserQueryResultsJSON
+                             | UserQueryEncodedResults_compact UserQueryResultsCompact
+                             | UserQueryEncodedResults_listbin UserQueryResultsListBin
+                             | UserQueryEncodedResults_EMPTY
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryEncodedResults where
+  toJSON (UserQueryEncodedResults_bin __bin)
+    = Aeson.object ["bin" .= __bin]
+  toJSON (UserQueryEncodedResults_json __json)
+    = Aeson.object ["json" .= __json]
+  toJSON (UserQueryEncodedResults_compact __compact)
+    = Aeson.object ["compact" .= __compact]
+  toJSON (UserQueryEncodedResults_listbin __listbin)
+    = Aeson.object ["listbin" .= __listbin]
+  toJSON UserQueryEncodedResults_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct UserQueryEncodedResults where
+  buildStruct _proxy (UserQueryEncodedResults_bin __bin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "bin" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __bin)]
+  buildStruct _proxy (UserQueryEncodedResults_json __json)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "json" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __json)]
+  buildStruct _proxy (UserQueryEncodedResults_compact __compact)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "compact" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __compact)]
+  buildStruct _proxy (UserQueryEncodedResults_listbin __listbin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "listbin" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __listbin)]
+  buildStruct _proxy UserQueryEncodedResults_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncodedResults_bin _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncodedResults_json _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncodedResults_compact _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryEncodedResults_listbin _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               UserQueryEncodedResults_EMPTY
+           Thrift.FieldEnd -> Prelude.return UserQueryEncodedResults_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("bin", 1), ("json", 2), ("compact", 3), ("listbin", 4)]
+
+instance DeepSeq.NFData UserQueryEncodedResults where
+  rnf (UserQueryEncodedResults_bin __bin) = DeepSeq.rnf __bin
+  rnf (UserQueryEncodedResults_json __json) = DeepSeq.rnf __json
+  rnf (UserQueryEncodedResults_compact __compact)
+    = DeepSeq.rnf __compact
+  rnf (UserQueryEncodedResults_listbin __listbin)
+    = DeepSeq.rnf __listbin
+  rnf UserQueryEncodedResults_EMPTY = ()
+
+instance Default.Default UserQueryEncodedResults where
+  def = UserQueryEncodedResults_EMPTY
+
+instance Hashable.Hashable UserQueryEncodedResults where
+  hashWithSalt __salt (UserQueryEncodedResults_bin _bin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _bin)
+  hashWithSalt __salt (UserQueryEncodedResults_json _json)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _json)
+  hashWithSalt __salt (UserQueryEncodedResults_compact _compact)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _compact)
+  hashWithSalt __salt (UserQueryEncodedResults_listbin _listbin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _listbin)
+  hashWithSalt __salt UserQueryEncodedResults_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data UserQueryResults = UserQueryResults{userQueryResults_facts ::
+                                         [Json],
+                                         userQueryResults_stats :: Prelude.Maybe UserQueryStats,
+                                         userQueryResults_nestedFacts :: Map.Map Id Json,
+                                         userQueryResults_continuation ::
+                                         Prelude.Maybe UserQueryCont,
+                                         userQueryResults_diagnostics :: [Text.Text],
+                                         userQueryResults_results :: UserQueryEncodedResults,
+                                         userQueryResults_handle :: Prelude.Maybe Handle,
+                                         userQueryResults_type :: Prelude.Maybe Text.Text}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResults where
+  toJSON
+    (UserQueryResults __field__facts __field__stats
+       __field__nestedFacts __field__continuation __field__diagnostics
+       __field__results __field__handle __field__type)
+    = Aeson.object
+        ("facts" .= Prelude.map Text.decodeUtf8 __field__facts :
+           Prelude.maybe Prelude.id ((:) . ("stats" .=)) __field__stats
+             ("nestedFacts" .=
+                (Map.mapKeys Thrift.keyToStr . Map.map Text.decodeUtf8)
+                  __field__nestedFacts
+                :
+                Prelude.maybe Prelude.id ((:) . ("continuation" .=))
+                  __field__continuation
+                  ("diagnostics" .= __field__diagnostics :
+                     "results" .= __field__results :
+                       Prelude.maybe Prelude.id ((:) . ("handle" .=)) __field__handle
+                         (Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+                            Prelude.mempty))))
+
+instance Thrift.ThriftStruct UserQueryResults where
+  buildStruct _proxy
+    (UserQueryResults __field__facts __field__stats
+       __field__nestedFacts __field__continuation __field__diagnostics
+       __field__results __field__handle __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genByteString _proxy)
+              __field__facts)
+           :
+           let (__cereal__stats, __id__stats)
+                 = case __field__stats of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "stats"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__stats
+               (Thrift.genField _proxy "nestedFacts" (Thrift.getMapType _proxy) 3
+                  __id__stats
+                  ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                      (Thrift.getStringType _proxy)
+                      Prelude.False
+                      (Thrift.genI64 _proxy)
+                      (Thrift.genByteString _proxy)
+                      . Map.toList)
+                     __field__nestedFacts)
+                  :
+                  let (__cereal__continuation, __id__continuation)
+                        = case __field__continuation of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "continuation"
+                                                       (Thrift.getStructType _proxy)
+                                                       5
+                                                       3
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  5)
+                            Prelude.Nothing -> (Prelude.id, 3)
+                    in
+                    __cereal__continuation
+                      (Thrift.genField _proxy "diagnostics" (Thrift.getListType _proxy) 6
+                         __id__continuation
+                         (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                            (Thrift.genText _proxy)
+                            __field__diagnostics)
+                         :
+                         Thrift.genField _proxy "results" (Thrift.getStructType _proxy) 7 6
+                           (Thrift.buildStruct _proxy __field__results)
+                           :
+                           let (__cereal__handle, __id__handle)
+                                 = case __field__handle of
+                                     Prelude.Just _val -> ((:)
+                                                             (Thrift.genField _proxy "handle"
+                                                                (Thrift.getStringType _proxy)
+                                                                8
+                                                                7
+                                                                (Thrift.genText _proxy _val)),
+                                                           8)
+                                     Prelude.Nothing -> (Prelude.id, 7)
+                             in
+                             __cereal__handle
+                               (case __field__type of
+                                  Prelude.Just _val -> Thrift.genField _proxy "type"
+                                                         (Thrift.getStringType _proxy)
+                                                         9
+                                                         __id__handle
+                                                         (Thrift.genText _proxy _val)
+                                                         : []
+                                  Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__facts <- ST.newSTRef Default.def
+            __field__stats <- ST.newSTRef Prelude.Nothing
+            __field__nestedFacts <- ST.newSTRef Default.def
+            __field__continuation <- ST.newSTRef Prelude.Nothing
+            __field__diagnostics <- ST.newSTRef Default.def
+            __field__results <- ST.newSTRef Default.def
+            __field__handle <- ST.newSTRef Prelude.Nothing
+            __field__type <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__stats
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__nestedFacts
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__continuation
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__diagnostics
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__results
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__handle
+                                                                          (Prelude.Just _val)
+                                                                 9 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__stats <- ST.readSTRef __field__stats
+                                             !__val__nestedFacts <- ST.readSTRef
+                                                                      __field__nestedFacts
+                                             !__val__continuation <- ST.readSTRef
+                                                                       __field__continuation
+                                             !__val__diagnostics <- ST.readSTRef
+                                                                      __field__diagnostics
+                                             !__val__results <- ST.readSTRef __field__results
+                                             !__val__handle <- ST.readSTRef __field__handle
+                                             !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure
+                                               (UserQueryResults __val__facts __val__stats
+                                                  __val__nestedFacts
+                                                  __val__continuation
+                                                  __val__diagnostics
+                                                  __val__results
+                                                  __val__handle
+                                                  __val__type)
+              _idMap
+                = HashMap.fromList
+                    [("facts", 1), ("stats", 2), ("nestedFacts", 3),
+                     ("continuation", 5), ("diagnostics", 6), ("results", 7),
+                     ("handle", 8), ("type", 9)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryResults where
+  rnf
+    (UserQueryResults __field__facts __field__stats
+       __field__nestedFacts __field__continuation __field__diagnostics
+       __field__results __field__handle __field__type)
+    = DeepSeq.rnf __field__facts `Prelude.seq`
+        DeepSeq.rnf __field__stats `Prelude.seq`
+          DeepSeq.rnf __field__nestedFacts `Prelude.seq`
+            DeepSeq.rnf __field__continuation `Prelude.seq`
+              DeepSeq.rnf __field__diagnostics `Prelude.seq`
+                DeepSeq.rnf __field__results `Prelude.seq`
+                  DeepSeq.rnf __field__handle `Prelude.seq`
+                    DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default UserQueryResults where
+  def
+    = UserQueryResults Default.def Prelude.Nothing Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable UserQueryResults where
+  hashWithSalt __salt
+    (UserQueryResults _facts _stats _nestedFacts _continuation
+       _diagnostics _results _handle _type)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _facts)
+                          _stats)
+                       ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                          _nestedFacts))
+                    _continuation)
+                 _diagnostics)
+              _results)
+           _handle)
+        _type
+
+newtype RetryException = RetryException{retryException_seconds ::
+                                        Prelude.Double}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RetryException where
+  toJSON (RetryException __field__seconds)
+    = Aeson.object ("seconds" .= __field__seconds : Prelude.mempty)
+
+instance Thrift.ThriftStruct RetryException where
+  buildStruct _proxy (RetryException __field__seconds)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "seconds" (Thrift.getDoubleType _proxy) 1 0
+           (Thrift.genDouble _proxy __field__seconds)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__seconds <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getDoubleType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseDouble
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__seconds
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__seconds <- ST.readSTRef
+                                                                  __field__seconds
+                                             Prelude.pure (RetryException __val__seconds)
+              _idMap = HashMap.fromList [("seconds", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData RetryException where
+  rnf (RetryException __field__seconds)
+    = DeepSeq.rnf __field__seconds `Prelude.seq` ()
+
+instance Default.Default RetryException where
+  def = RetryException Default.def
+
+instance Hashable.Hashable RetryException where
+  hashWithSalt __salt (RetryException _seconds)
+    = Hashable.hashWithSalt __salt _seconds
+
+newtype BadQueryException = BadQueryException{badQueryException_reason
+                                              :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BadQueryException where
+  toJSON (BadQueryException __field__reason)
+    = Aeson.object ("reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct BadQueryException where
+  buildStruct _proxy (BadQueryException __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "reason" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__reason)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__reason <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__reason <- ST.readSTRef
+                                                                 __field__reason
+                                             Prelude.pure (BadQueryException __val__reason)
+              _idMap = HashMap.fromList [("reason", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData BadQueryException where
+  rnf (BadQueryException __field__reason)
+    = DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default BadQueryException where
+  def = BadQueryException ""
+
+instance Hashable.Hashable BadQueryException where
+  hashWithSalt __salt (BadQueryException _reason)
+    = Hashable.hashWithSalt __salt _reason
+
+newtype GleanException = GleanException{gleanException_message ::
+                                        Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GleanException where
+  toJSON (GleanException __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct GleanException where
+  buildStruct _proxy (GleanException __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (GleanException __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData GleanException where
+  rnf (GleanException __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default GleanException where
+  def = GleanException ""
+
+instance Hashable.Hashable GleanException where
+  hashWithSalt __salt (GleanException _message)
+    = Hashable.hashWithSalt __salt _message
+
+data UserQueryResultsOrException = UserQueryResultsOrException_results UserQueryResults
+                                 | UserQueryResultsOrException_badQuery BadQueryException
+                                 | UserQueryResultsOrException_retry RetryException
+                                 | UserQueryResultsOrException_other GleanException
+                                 | UserQueryResultsOrException_EMPTY
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryResultsOrException where
+  toJSON (UserQueryResultsOrException_results __results)
+    = Aeson.object ["results" .= __results]
+  toJSON (UserQueryResultsOrException_badQuery __badQuery)
+    = Aeson.object ["badQuery" .= __badQuery]
+  toJSON (UserQueryResultsOrException_retry __retry)
+    = Aeson.object ["retry" .= __retry]
+  toJSON (UserQueryResultsOrException_other __other)
+    = Aeson.object ["other" .= __other]
+  toJSON UserQueryResultsOrException_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct UserQueryResultsOrException where
+  buildStruct _proxy (UserQueryResultsOrException_results __results)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "results" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __results)]
+  buildStruct _proxy
+    (UserQueryResultsOrException_badQuery __badQuery)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "badQuery" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __badQuery)]
+  buildStruct _proxy (UserQueryResultsOrException_retry __retry)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "retry" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __retry)]
+  buildStruct _proxy (UserQueryResultsOrException_other __other)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "other" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __other)]
+  buildStruct _proxy UserQueryResultsOrException_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryResultsOrException_results
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryResultsOrException_badQuery
+                                                                 _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryResultsOrException_retry
+                                                                 _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (UserQueryResultsOrException_other
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               UserQueryResultsOrException_EMPTY
+           Thrift.FieldEnd -> Prelude.return UserQueryResultsOrException_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("results", 1), ("badQuery", 2), ("retry", 3), ("other", 4)]
+
+instance DeepSeq.NFData UserQueryResultsOrException where
+  rnf (UserQueryResultsOrException_results __results)
+    = DeepSeq.rnf __results
+  rnf (UserQueryResultsOrException_badQuery __badQuery)
+    = DeepSeq.rnf __badQuery
+  rnf (UserQueryResultsOrException_retry __retry)
+    = DeepSeq.rnf __retry
+  rnf (UserQueryResultsOrException_other __other)
+    = DeepSeq.rnf __other
+  rnf UserQueryResultsOrException_EMPTY = ()
+
+instance Default.Default UserQueryResultsOrException where
+  def = UserQueryResultsOrException_EMPTY
+
+instance Hashable.Hashable UserQueryResultsOrException where
+  hashWithSalt __salt (UserQueryResultsOrException_results _results)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _results)
+  hashWithSalt __salt
+    (UserQueryResultsOrException_badQuery _badQuery)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _badQuery)
+  hashWithSalt __salt (UserQueryResultsOrException_retry _retry)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _retry)
+  hashWithSalt __salt (UserQueryResultsOrException_other _other)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _other)
+  hashWithSalt __salt UserQueryResultsOrException_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FactQuery = FactQuery{factQuery_id :: Id,
+                           factQuery_predicate_version :: Prelude.Maybe Version,
+                           factQuery_recursive :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FactQuery where
+  toJSON
+    (FactQuery __field__id __field__predicate_version
+       __field__recursive)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("predicate_version" .=))
+             __field__predicate_version
+             ("recursive" .= __field__recursive : Prelude.mempty))
+
+instance Thrift.ThriftStruct FactQuery where
+  buildStruct _proxy
+    (FactQuery __field__id __field__predicate_version
+       __field__recursive)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__predicate_version, __id__predicate_version)
+                 = case __field__predicate_version of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "predicate_version"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                (Thrift.genI32 _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__predicate_version
+               (Thrift.genFieldBool _proxy "recursive" 3 __id__predicate_version
+                  __field__recursive
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__predicate_version <- ST.newSTRef Prelude.Nothing
+            __field__recursive <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate_version
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__recursive
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__predicate_version <- ST.readSTRef
+                                                                            __field__predicate_version
+                                             !__val__recursive <- ST.readSTRef __field__recursive
+                                             Prelude.pure
+                                               (FactQuery __val__id __val__predicate_version
+                                                  __val__recursive)
+              _idMap
+                = HashMap.fromList
+                    [("id", 1), ("predicate_version", 2), ("recursive", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FactQuery where
+  rnf
+    (FactQuery __field__id __field__predicate_version
+       __field__recursive)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__predicate_version `Prelude.seq`
+          DeepSeq.rnf __field__recursive `Prelude.seq` ()
+
+instance Default.Default FactQuery where
+  def = FactQuery Default.def Prelude.Nothing Prelude.False
+
+instance Hashable.Hashable FactQuery where
+  hashWithSalt __salt (FactQuery _id _predicate_version _recursive)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id)
+           _predicate_version)
+        _recursive
+
+data UserQueryFacts = UserQueryFacts{userQueryFacts_facts ::
+                                     [FactQuery],
+                                     userQueryFacts_options :: Prelude.Maybe UserQueryOptions,
+                                     userQueryFacts_encodings :: [UserQueryEncoding],
+                                     userQueryFacts_client_info ::
+                                     Prelude.Maybe UserQueryClientInfo,
+                                     userQueryFacts_schema_id :: Prelude.Maybe SchemaId}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryFacts where
+  toJSON
+    (UserQueryFacts __field__facts __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Aeson.object
+        ("facts" .= __field__facts :
+           Prelude.maybe Prelude.id ((:) . ("options" .=)) __field__options
+             ("encodings" .= __field__encodings :
+                Prelude.maybe Prelude.id ((:) . ("client_info" .=))
+                  __field__client_info
+                  (Prelude.maybe Prelude.id ((:) . ("schema_id" .=))
+                     (Prelude.fmap unSchemaId __field__schema_id)
+                     Prelude.mempty)))
+
+instance Thrift.ThriftStruct UserQueryFacts where
+  buildStruct _proxy
+    (UserQueryFacts __field__facts __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__facts)
+           :
+           let (__cereal__options, __id__options)
+                 = case __field__options of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "options"
+                                                (Thrift.getStructType _proxy)
+                                                4
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           4)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__options
+               (Thrift.genField _proxy "encodings" (Thrift.getListType _proxy) 5
+                  __id__options
+                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     __field__encodings)
+                  :
+                  let (__cereal__client_info, __id__client_info)
+                        = case __field__client_info of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "client_info"
+                                                       (Thrift.getStructType _proxy)
+                                                       6
+                                                       5
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  6)
+                            Prelude.Nothing -> (Prelude.id, 5)
+                    in
+                    __cereal__client_info
+                      (case __field__schema_id of
+                         Prelude.Just _val -> Thrift.genField _proxy "schema_id"
+                                                (Thrift.getStringType _proxy)
+                                                7
+                                                __id__client_info
+                                                ((Thrift.genText _proxy . unSchemaId) _val)
+                                                : []
+                         Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__facts <- ST.newSTRef Default.def
+            __field__options <- ST.newSTRef Prelude.Nothing
+            __field__encodings <- ST.newSTRef []
+            __field__client_info <- ST.newSTRef Prelude.Nothing
+            __field__schema_id <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__encodings
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__client_info
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      SchemaId
+                                                                                      (Thrift.parseText
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__schema_id
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__options <- ST.readSTRef __field__options
+                                             !__val__encodings <- ST.readSTRef __field__encodings
+                                             !__val__client_info <- ST.readSTRef
+                                                                      __field__client_info
+                                             !__val__schema_id <- ST.readSTRef __field__schema_id
+                                             Prelude.pure
+                                               (UserQueryFacts __val__facts __val__options
+                                                  __val__encodings
+                                                  __val__client_info
+                                                  __val__schema_id)
+              _idMap
+                = HashMap.fromList
+                    [("facts", 1), ("options", 4), ("encodings", 5),
+                     ("client_info", 6), ("schema_id", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryFacts where
+  rnf
+    (UserQueryFacts __field__facts __field__options __field__encodings
+       __field__client_info __field__schema_id)
+    = DeepSeq.rnf __field__facts `Prelude.seq`
+        DeepSeq.rnf __field__options `Prelude.seq`
+          DeepSeq.rnf __field__encodings `Prelude.seq`
+            DeepSeq.rnf __field__client_info `Prelude.seq`
+              DeepSeq.rnf __field__schema_id `Prelude.seq` ()
+
+instance Default.Default UserQueryFacts where
+  def
+    = UserQueryFacts Default.def Prelude.Nothing [] Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable UserQueryFacts where
+  hashWithSalt __salt
+    (UserQueryFacts _facts _options _encodings _client_info _schema_id)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _facts)
+                 _options)
+              _encodings)
+           _client_info)
+        _schema_id
+
+type ClientInfo = UserQueryClientInfo
+
+data UserQueryClientInfo = UserQueryClientInfo{userQueryClientInfo_name
+                                               :: Text.Text,
+                                               userQueryClientInfo_unixname ::
+                                               Prelude.Maybe Text.Text,
+                                               userQueryClientInfo_application :: Text.Text}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserQueryClientInfo where
+  toJSON
+    (UserQueryClientInfo __field__name __field__unixname
+       __field__application)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("unixname" .=)) __field__unixname
+             ("application" .= __field__application : Prelude.mempty))
+
+instance Thrift.ThriftStruct UserQueryClientInfo where
+  buildStruct _proxy
+    (UserQueryClientInfo __field__name __field__unixname
+       __field__application)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__unixname, __id__unixname)
+                 = case __field__unixname of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "unixname"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genText _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__unixname
+               (Thrift.genField _proxy "application" (Thrift.getStringType _proxy)
+                  3
+                  __id__unixname
+                  (Thrift.genText _proxy __field__application)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__unixname <- ST.newSTRef Prelude.Nothing
+            __field__application <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__unixname
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__application
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__unixname <- ST.readSTRef __field__unixname
+                                             !__val__application <- ST.readSTRef
+                                                                      __field__application
+                                             Prelude.pure
+                                               (UserQueryClientInfo __val__name __val__unixname
+                                                  __val__application)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("unixname", 2), ("application", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UserQueryClientInfo where
+  rnf
+    (UserQueryClientInfo __field__name __field__unixname
+       __field__application)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__unixname `Prelude.seq`
+          DeepSeq.rnf __field__application `Prelude.seq` ()
+
+instance Default.Default UserQueryClientInfo where
+  def = UserQueryClientInfo "" Prelude.Nothing ""
+
+instance Hashable.Hashable UserQueryClientInfo where
+  hashWithSalt __salt
+    (UserQueryClientInfo _name _unixname _application)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _unixname)
+        _application
+
+data ListDatabases = ListDatabases{listDatabases_includeBackups ::
+                                   Prelude.Bool,
+                                   listDatabases_client_info :: Prelude.Maybe ClientInfo}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ListDatabases where
+  toJSON (ListDatabases __field__includeBackups __field__client_info)
+    = Aeson.object
+        ("includeBackups" .= __field__includeBackups :
+           Prelude.maybe Prelude.id ((:) . ("client_info" .=))
+             __field__client_info
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ListDatabases where
+  buildStruct _proxy
+    (ListDatabases __field__includeBackups __field__client_info)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "includeBackups" 1 0
+           __field__includeBackups
+           :
+           case __field__client_info of
+             Prelude.Just _val -> Thrift.genField _proxy "client_info"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__includeBackups <- ST.newSTRef Prelude.False
+            __field__client_info <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__includeBackups
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__client_info
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__includeBackups <- ST.readSTRef
+                                                                         __field__includeBackups
+                                             !__val__client_info <- ST.readSTRef
+                                                                      __field__client_info
+                                             Prelude.pure
+                                               (ListDatabases __val__includeBackups
+                                                  __val__client_info)
+              _idMap
+                = HashMap.fromList [("includeBackups", 1), ("client_info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ListDatabases where
+  rnf (ListDatabases __field__includeBackups __field__client_info)
+    = DeepSeq.rnf __field__includeBackups `Prelude.seq`
+        DeepSeq.rnf __field__client_info `Prelude.seq` ()
+
+instance Default.Default ListDatabases where
+  def = ListDatabases Prelude.False Prelude.Nothing
+
+instance Hashable.Hashable ListDatabases where
+  hashWithSalt __salt (ListDatabases _includeBackups _client_info)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _includeBackups)
+        _client_info
+
+newtype ListDatabasesResult = ListDatabasesResult{listDatabasesResult_databases
+                                                  :: [Database]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ListDatabasesResult where
+  toJSON (ListDatabasesResult __field__databases)
+    = Aeson.object ("databases" .= __field__databases : Prelude.mempty)
+
+instance Thrift.ThriftStruct ListDatabasesResult where
+  buildStruct _proxy (ListDatabasesResult __field__databases)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "databases" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__databases)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__databases <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__databases
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__databases <- ST.readSTRef
+                                                                    __field__databases
+                                             Prelude.pure (ListDatabasesResult __val__databases)
+              _idMap = HashMap.fromList [("databases", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ListDatabasesResult where
+  rnf (ListDatabasesResult __field__databases)
+    = DeepSeq.rnf __field__databases `Prelude.seq` ()
+
+instance Default.Default ListDatabasesResult where
+  def = ListDatabasesResult Default.def
+
+instance Hashable.Hashable ListDatabasesResult where
+  hashWithSalt __salt (ListDatabasesResult _databases)
+    = Hashable.hashWithSalt __salt _databases
+
+newtype GetDatabaseResult = GetDatabaseResult{getDatabaseResult_database
+                                              :: Database}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GetDatabaseResult where
+  toJSON (GetDatabaseResult __field__database)
+    = Aeson.object ("database" .= __field__database : Prelude.mempty)
+
+instance Thrift.ThriftStruct GetDatabaseResult where
+  buildStruct _proxy (GetDatabaseResult __field__database)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "database" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__database)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__database <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__database
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__database <- ST.readSTRef
+                                                                   __field__database
+                                             Prelude.pure (GetDatabaseResult __val__database)
+              _idMap = HashMap.fromList [("database", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData GetDatabaseResult where
+  rnf (GetDatabaseResult __field__database)
+    = DeepSeq.rnf __field__database `Prelude.seq` ()
+
+instance Default.Default GetDatabaseResult where
+  def = GetDatabaseResult Default.def
+
+instance Hashable.Hashable GetDatabaseResult where
+  hashWithSalt __salt (GetDatabaseResult _database)
+    = Hashable.hashWithSalt __salt _database
+
+data DeleteDatabaseResult = DeleteDatabaseResult{}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeleteDatabaseResult where
+  toJSON DeleteDatabaseResult = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DeleteDatabaseResult where
+  buildStruct _proxy DeleteDatabaseResult
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DeleteDatabaseResult)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DeleteDatabaseResult where
+  rnf DeleteDatabaseResult = ()
+
+instance Default.Default DeleteDatabaseResult where
+  def = DeleteDatabaseResult
+
+instance Hashable.Hashable DeleteDatabaseResult where
+  hashWithSalt __salt DeleteDatabaseResult = __salt
+
+data JsonFactBatch = JsonFactBatch{jsonFactBatch_predicate ::
+                                   PredicateRef,
+                                   jsonFactBatch_facts :: [Json],
+                                   jsonFactBatch_unit :: Prelude.Maybe Bytestring}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JsonFactBatch where
+  toJSON
+    (JsonFactBatch __field__predicate __field__facts __field__unit)
+    = Aeson.object
+        ("predicate" .= __field__predicate :
+           "facts" .= Prelude.map Text.decodeUtf8 __field__facts :
+             Prelude.maybe Prelude.id ((:) . ("unit" .=))
+               (Prelude.fmap Text.decodeUtf8 __field__unit)
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct JsonFactBatch where
+  buildStruct _proxy
+    (JsonFactBatch __field__predicate __field__facts __field__unit)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "predicate" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__predicate)
+           :
+           Thrift.genField _proxy "facts" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genByteString _proxy)
+                __field__facts)
+             :
+             case __field__unit of
+               Prelude.Just _val -> Thrift.genField _proxy "unit"
+                                      (Thrift.getStringType _proxy)
+                                      3
+                                      2
+                                      (Thrift.genByteString _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef Default.def
+            __field__facts <- ST.newSTRef Default.def
+            __field__unit <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseByteString
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__facts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseByteString
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__unit
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             !__val__facts <- ST.readSTRef __field__facts
+                                             !__val__unit <- ST.readSTRef __field__unit
+                                             Prelude.pure
+                                               (JsonFactBatch __val__predicate __val__facts
+                                                  __val__unit)
+              _idMap
+                = HashMap.fromList [("predicate", 1), ("facts", 2), ("unit", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData JsonFactBatch where
+  rnf (JsonFactBatch __field__predicate __field__facts __field__unit)
+    = DeepSeq.rnf __field__predicate `Prelude.seq`
+        DeepSeq.rnf __field__facts `Prelude.seq`
+          DeepSeq.rnf __field__unit `Prelude.seq` ()
+
+instance Default.Default JsonFactBatch where
+  def = JsonFactBatch Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable JsonFactBatch where
+  hashWithSalt __salt (JsonFactBatch _predicate _facts _unit)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _predicate)
+           _facts)
+        _unit
+
+data SendJsonBatch = SendJsonBatch{sendJsonBatch_batches ::
+                                   [JsonFactBatch],
+                                   sendJsonBatch_options :: Prelude.Maybe SendJsonBatchOptions,
+                                   sendJsonBatch_remember :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SendJsonBatch where
+  toJSON
+    (SendJsonBatch __field__batches __field__options __field__remember)
+    = Aeson.object
+        ("batches" .= __field__batches :
+           Prelude.maybe Prelude.id ((:) . ("options" .=)) __field__options
+             ("remember" .= __field__remember : Prelude.mempty))
+
+instance Thrift.ThriftStruct SendJsonBatch where
+  buildStruct _proxy
+    (SendJsonBatch __field__batches __field__options __field__remember)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "batches" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__batches)
+           :
+           let (__cereal__options, __id__options)
+                 = case __field__options of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "options"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__options
+               (Thrift.genFieldBool _proxy "remember" 3 __id__options
+                  __field__remember
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__batches <- ST.newSTRef Default.def
+            __field__options <- ST.newSTRef Prelude.Nothing
+            __field__remember <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__batches
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__options
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__remember
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__batches <- ST.readSTRef
+                                                                  __field__batches
+                                             !__val__options <- ST.readSTRef __field__options
+                                             !__val__remember <- ST.readSTRef __field__remember
+                                             Prelude.pure
+                                               (SendJsonBatch __val__batches __val__options
+                                                  __val__remember)
+              _idMap
+                = HashMap.fromList
+                    [("batches", 1), ("options", 2), ("remember", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SendJsonBatch where
+  rnf
+    (SendJsonBatch __field__batches __field__options __field__remember)
+    = DeepSeq.rnf __field__batches `Prelude.seq`
+        DeepSeq.rnf __field__options `Prelude.seq`
+          DeepSeq.rnf __field__remember `Prelude.seq` ()
+
+instance Default.Default SendJsonBatch where
+  def = SendJsonBatch Default.def Prelude.Nothing Prelude.False
+
+instance Hashable.Hashable SendJsonBatch where
+  hashWithSalt __salt (SendJsonBatch _batches _options _remember)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _batches)
+           _options)
+        _remember
+
+newtype SendJsonBatchResponse = SendJsonBatchResponse{sendJsonBatchResponse_handle
+                                                      :: Handle}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SendJsonBatchResponse where
+  toJSON (SendJsonBatchResponse __field__handle)
+    = Aeson.object ("handle" .= __field__handle : Prelude.mempty)
+
+instance Thrift.ThriftStruct SendJsonBatchResponse where
+  buildStruct _proxy (SendJsonBatchResponse __field__handle)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "handle" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__handle)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__handle <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__handle
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__handle <- ST.readSTRef
+                                                                 __field__handle
+                                             Prelude.pure (SendJsonBatchResponse __val__handle)
+              _idMap = HashMap.fromList [("handle", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData SendJsonBatchResponse where
+  rnf (SendJsonBatchResponse __field__handle)
+    = DeepSeq.rnf __field__handle `Prelude.seq` ()
+
+instance Default.Default SendJsonBatchResponse where
+  def = SendJsonBatchResponse ""
+
+instance Hashable.Hashable SendJsonBatchResponse where
+  hashWithSalt __salt (SendJsonBatchResponse _handle)
+    = Hashable.hashWithSalt __salt _handle
+
+data BatchFormat = BatchFormat_JSON
+                 | BatchFormat_Binary
+                 | BatchFormat__UNKNOWN Prelude.Int
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BatchFormat where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData BatchFormat where
+  rnf __BatchFormat = Prelude.seq __BatchFormat ()
+
+instance Default.Default BatchFormat where
+  def = BatchFormat_JSON
+
+instance Hashable.Hashable BatchFormat where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum BatchFormat where
+  toThriftEnum 0 = BatchFormat_JSON
+  toThriftEnum 1 = BatchFormat_Binary
+  toThriftEnum val = BatchFormat__UNKNOWN val
+  fromThriftEnum BatchFormat_JSON = 0
+  fromThriftEnum BatchFormat_Binary = 1
+  fromThriftEnum (BatchFormat__UNKNOWN val) = val
+  allThriftEnumValues = [BatchFormat_JSON, BatchFormat_Binary]
+  toThriftEnumEither 0 = Prelude.Right BatchFormat_JSON
+  toThriftEnumEither 1 = Prelude.Right BatchFormat_Binary
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum BatchFormat: "
+           ++ Prelude.show val)
+
+data BatchDescriptor = BatchDescriptor{batchDescriptor_location ::
+                                       Text.Text,
+                                       batchDescriptor_format :: BatchFormat}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BatchDescriptor where
+  toJSON (BatchDescriptor __field__location __field__format)
+    = Aeson.object
+        ("location" .= __field__location :
+           "format" .= __field__format : Prelude.mempty)
+
+instance Thrift.ThriftStruct BatchDescriptor where
+  buildStruct _proxy
+    (BatchDescriptor __field__location __field__format)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__location)
+           :
+           Thrift.genField _proxy "format" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__format)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef ""
+            __field__format <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "BatchFormat")
+                                                                        ST.writeSTRef
+                                                                          __field__format
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__format <- ST.readSTRef __field__format
+                                             Prelude.pure
+                                               (BatchDescriptor __val__location __val__format)
+              _idMap = HashMap.fromList [("location", 1), ("format", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BatchDescriptor where
+  rnf (BatchDescriptor __field__location __field__format)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__format `Prelude.seq` ()
+
+instance Default.Default BatchDescriptor where
+  def = BatchDescriptor "" Default.def
+
+instance Hashable.Hashable BatchDescriptor where
+  hashWithSalt __salt (BatchDescriptor _location _format)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _format
+
+data EnqueueBatch = EnqueueBatch_descriptor BatchDescriptor
+                  | EnqueueBatch_EMPTY
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnqueueBatch where
+  toJSON (EnqueueBatch_descriptor __descriptor)
+    = Aeson.object ["descriptor" .= __descriptor]
+  toJSON EnqueueBatch_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct EnqueueBatch where
+  buildStruct _proxy (EnqueueBatch_descriptor __descriptor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "descriptor" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __descriptor)]
+  buildStruct _proxy EnqueueBatch_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (EnqueueBatch_descriptor _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return EnqueueBatch_EMPTY
+           Thrift.FieldEnd -> Prelude.return EnqueueBatch_EMPTY
+    where
+      _idMap = HashMap.fromList [("descriptor", 1)]
+
+instance DeepSeq.NFData EnqueueBatch where
+  rnf (EnqueueBatch_descriptor __descriptor)
+    = DeepSeq.rnf __descriptor
+  rnf EnqueueBatch_EMPTY = ()
+
+instance Default.Default EnqueueBatch where
+  def = EnqueueBatch_EMPTY
+
+instance Hashable.Hashable EnqueueBatch where
+  hashWithSalt __salt (EnqueueBatch_descriptor _descriptor)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _descriptor)
+  hashWithSalt __salt EnqueueBatch_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EnqueueBatchWaitPolicy = EnqueueBatchWaitPolicy_None
+                            | EnqueueBatchWaitPolicy_Remember
+                            | EnqueueBatchWaitPolicy__UNKNOWN Prelude.Int
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnqueueBatchWaitPolicy where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData EnqueueBatchWaitPolicy where
+  rnf __EnqueueBatchWaitPolicy
+    = Prelude.seq __EnqueueBatchWaitPolicy ()
+
+instance Default.Default EnqueueBatchWaitPolicy where
+  def = EnqueueBatchWaitPolicy_None
+
+instance Hashable.Hashable EnqueueBatchWaitPolicy where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum EnqueueBatchWaitPolicy where
+  toThriftEnum 0 = EnqueueBatchWaitPolicy_None
+  toThriftEnum 1 = EnqueueBatchWaitPolicy_Remember
+  toThriftEnum val = EnqueueBatchWaitPolicy__UNKNOWN val
+  fromThriftEnum EnqueueBatchWaitPolicy_None = 0
+  fromThriftEnum EnqueueBatchWaitPolicy_Remember = 1
+  fromThriftEnum (EnqueueBatchWaitPolicy__UNKNOWN val) = val
+  allThriftEnumValues
+    = [EnqueueBatchWaitPolicy_None, EnqueueBatchWaitPolicy_Remember]
+  toThriftEnumEither 0 = Prelude.Right EnqueueBatchWaitPolicy_None
+  toThriftEnumEither 1
+    = Prelude.Right EnqueueBatchWaitPolicy_Remember
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum EnqueueBatchWaitPolicy: "
+           ++ Prelude.show val)
+
+newtype EnqueueBatchResponse = EnqueueBatchResponse{enqueueBatchResponse_handle
+                                                    :: Handle}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnqueueBatchResponse where
+  toJSON (EnqueueBatchResponse __field__handle)
+    = Aeson.object ("handle" .= __field__handle : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnqueueBatchResponse where
+  buildStruct _proxy (EnqueueBatchResponse __field__handle)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "handle" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__handle)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__handle <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__handle
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__handle <- ST.readSTRef
+                                                                 __field__handle
+                                             Prelude.pure (EnqueueBatchResponse __val__handle)
+              _idMap = HashMap.fromList [("handle", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData EnqueueBatchResponse where
+  rnf (EnqueueBatchResponse __field__handle)
+    = DeepSeq.rnf __field__handle `Prelude.seq` ()
+
+instance Default.Default EnqueueBatchResponse where
+  def = EnqueueBatchResponse ""
+
+instance Hashable.Hashable EnqueueBatchResponse where
+  hashWithSalt __salt (EnqueueBatchResponse _handle)
+    = Hashable.hashWithSalt __salt _handle
+
+data KickOff = KickOff{kickOff_repo :: Repo,
+                       kickOff_properties :: DatabaseProperties,
+                       kickOff_dependencies :: Prelude.Maybe Dependencies,
+                       kickOff_repo_hash_time :: Prelude.Maybe PosixEpochTime,
+                       kickOff_update_schema_for_stacked :: Prelude.Bool}
+               deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON KickOff where
+  toJSON
+    (KickOff __field__repo __field__properties __field__dependencies
+       __field__repo_hash_time __field__update_schema_for_stacked)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "properties" .= __field__properties :
+             Prelude.maybe Prelude.id ((:) . ("dependencies" .=))
+               __field__dependencies
+               (Prelude.maybe Prelude.id ((:) . ("repo_hash_time" .=))
+                  (Prelude.fmap unPosixEpochTime __field__repo_hash_time)
+                  ("update_schema_for_stacked" .= __field__update_schema_for_stacked
+                     : Prelude.mempty)))
+
+instance Thrift.ThriftStruct KickOff where
+  buildStruct _proxy
+    (KickOff __field__repo __field__properties __field__dependencies
+       __field__repo_hash_time __field__update_schema_for_stacked)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "properties" (Thrift.getMapType _proxy) 3 1
+             ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                 (Thrift.getStringType _proxy)
+                 Prelude.True
+                 (Thrift.genText _proxy)
+                 (Thrift.genText _proxy)
+                 . HashMap.toList)
+                __field__properties)
+             :
+             let (__cereal__dependencies, __id__dependencies)
+                   = case __field__dependencies of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "dependencies"
+                                                  (Thrift.getStructType _proxy)
+                                                  4
+                                                  3
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             4)
+                       Prelude.Nothing -> (Prelude.id, 3)
+               in
+               __cereal__dependencies
+                 (let (__cereal__repo_hash_time, __id__repo_hash_time)
+                        = case __field__repo_hash_time of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "repo_hash_time"
+                                                       (Thrift.getI64Type _proxy)
+                                                       5
+                                                       __id__dependencies
+                                                       ((Thrift.genI64 _proxy . unPosixEpochTime)
+                                                          _val)),
+                                                  5)
+                            Prelude.Nothing -> (Prelude.id, __id__dependencies)
+                    in
+                    __cereal__repo_hash_time
+                      (Thrift.genFieldBool _proxy "update_schema_for_stacked" 6
+                         __id__repo_hash_time
+                         __field__update_schema_for_stacked
+                         : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__properties <- ST.newSTRef HashMap.empty
+            __field__dependencies <- ST.newSTRef Prelude.Nothing
+            __field__repo_hash_time <- ST.newSTRef Prelude.Nothing
+            __field__update_schema_for_stacked <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__properties
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__dependencies
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__repo_hash_time
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__update_schema_for_stacked
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__properties <- ST.readSTRef __field__properties
+                                             !__val__dependencies <- ST.readSTRef
+                                                                       __field__dependencies
+                                             !__val__repo_hash_time <- ST.readSTRef
+                                                                         __field__repo_hash_time
+                                             !__val__update_schema_for_stacked <- ST.readSTRef
+                                                                                    __field__update_schema_for_stacked
+                                             Prelude.pure
+                                               (KickOff __val__repo __val__properties
+                                                  __val__dependencies
+                                                  __val__repo_hash_time
+                                                  __val__update_schema_for_stacked)
+              _idMap
+                = HashMap.fromList
+                    [("repo", 1), ("properties", 3), ("dependencies", 4),
+                     ("repo_hash_time", 5), ("update_schema_for_stacked", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData KickOff where
+  rnf
+    (KickOff __field__repo __field__properties __field__dependencies
+       __field__repo_hash_time __field__update_schema_for_stacked)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__properties `Prelude.seq`
+          DeepSeq.rnf __field__dependencies `Prelude.seq`
+            DeepSeq.rnf __field__repo_hash_time `Prelude.seq`
+              DeepSeq.rnf __field__update_schema_for_stacked `Prelude.seq` ()
+
+instance Default.Default KickOff where
+  def
+    = KickOff Default.def HashMap.empty Prelude.Nothing Prelude.Nothing
+        Prelude.False
+
+instance Hashable.Hashable KickOff where
+  hashWithSalt __salt
+    (KickOff _repo _properties _dependencies _repo_hash_time
+       _update_schema_for_stacked)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo)
+                 ((List.sort .
+                     Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                    _properties))
+              _dependencies)
+           _repo_hash_time)
+        _update_schema_for_stacked
+
+instance Ord.Ord KickOff where
+  compare __a __b
+    = case Ord.compare (kickOff_repo __a) (kickOff_repo __b) of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case
+                    Ord.compare
+                      ((List.sort .
+                          Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                         (kickOff_properties __a))
+                      ((List.sort .
+                          Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                         (kickOff_properties __b))
+                    of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> case
+                                Ord.compare (kickOff_dependencies __a) (kickOff_dependencies __b)
+                                of
+                                Ord.LT -> Ord.LT
+                                Ord.GT -> Ord.GT
+                                Ord.EQ -> case
+                                            Ord.compare (kickOff_repo_hash_time __a)
+                                              (kickOff_repo_hash_time __b)
+                                            of
+                                            Ord.LT -> Ord.LT
+                                            Ord.GT -> Ord.GT
+                                            Ord.EQ -> Ord.compare
+                                                        (kickOff_update_schema_for_stacked __a)
+                                                        (kickOff_update_schema_for_stacked __b)
+
+newtype KickOffResponse = KickOffResponse{kickOffResponse_alreadyExists
+                                          :: Prelude.Bool}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KickOffResponse where
+  toJSON (KickOffResponse __field__alreadyExists)
+    = Aeson.object
+        ("alreadyExists" .= __field__alreadyExists : Prelude.mempty)
+
+instance Thrift.ThriftStruct KickOffResponse where
+  buildStruct _proxy (KickOffResponse __field__alreadyExists)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "alreadyExists" 1 0
+           __field__alreadyExists
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__alreadyExists <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__alreadyExists
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__alreadyExists <- ST.readSTRef
+                                                                        __field__alreadyExists
+                                             Prelude.pure (KickOffResponse __val__alreadyExists)
+              _idMap = HashMap.fromList [("alreadyExists", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData KickOffResponse where
+  rnf (KickOffResponse __field__alreadyExists)
+    = DeepSeq.rnf __field__alreadyExists `Prelude.seq` ()
+
+instance Default.Default KickOffResponse where
+  def = KickOffResponse Prelude.False
+
+instance Hashable.Hashable KickOffResponse where
+  hashWithSalt __salt (KickOffResponse _alreadyExists)
+    = Hashable.hashWithSalt __salt _alreadyExists
+
+data UpdatePropertiesResponse = UpdatePropertiesResponse{}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UpdatePropertiesResponse where
+  toJSON UpdatePropertiesResponse = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UpdatePropertiesResponse where
+  buildStruct _proxy UpdatePropertiesResponse
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UpdatePropertiesResponse)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UpdatePropertiesResponse where
+  rnf UpdatePropertiesResponse = ()
+
+instance Default.Default UpdatePropertiesResponse where
+  def = UpdatePropertiesResponse
+
+instance Hashable.Hashable UpdatePropertiesResponse where
+  hashWithSalt __salt UpdatePropertiesResponse = __salt
+
+data SchemaInfo = SchemaInfo{schemaInfo_schema :: Bytestring,
+                             schemaInfo_predicateIds :: Map.Map Id PredicateRef,
+                             schemaInfo_schemaIds :: Map.Map Text.Text Version,
+                             schemaInfo_dbSchemaIds :: Map.Map Text.Text Version,
+                             schemaInfo_otherSchemaIds :: [Map.Map Text.Text Version],
+                             schemaInfo_derivationDependencies :: Map.Map Id [Id]}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaInfo where
+  toJSON
+    (SchemaInfo __field__schema __field__predicateIds
+       __field__schemaIds __field__dbSchemaIds __field__otherSchemaIds
+       __field__derivationDependencies)
+    = Aeson.object
+        ("schema" .= Text.decodeUtf8 __field__schema :
+           "predicateIds" .= Map.mapKeys Thrift.keyToStr __field__predicateIds
+             :
+             "schemaIds" .= __field__schemaIds :
+               "dbSchemaIds" .= __field__dbSchemaIds :
+                 "otherSchemaIds" .= __field__otherSchemaIds :
+                   "derivationDependencies" .=
+                     Map.mapKeys Thrift.keyToStr __field__derivationDependencies
+                     : Prelude.mempty)
+
+instance Thrift.ThriftStruct SchemaInfo where
+  buildStruct _proxy
+    (SchemaInfo __field__schema __field__predicateIds
+       __field__schemaIds __field__dbSchemaIds __field__otherSchemaIds
+       __field__derivationDependencies)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "schema" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genByteString _proxy __field__schema)
+           :
+           Thrift.genField _proxy "predicateIds" (Thrift.getMapType _proxy) 2
+             1
+             ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.getStructType _proxy)
+                 Prelude.False
+                 (Thrift.genI64 _proxy)
+                 (Thrift.buildStruct _proxy)
+                 . Map.toList)
+                __field__predicateIds)
+             :
+             Thrift.genField _proxy "schemaIds" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                   (Thrift.getI32Type _proxy)
+                   Prelude.True
+                   (Thrift.genText _proxy)
+                   (Thrift.genI32 _proxy)
+                   . Map.toList)
+                  __field__schemaIds)
+               :
+               Thrift.genField _proxy "dbSchemaIds" (Thrift.getMapType _proxy) 4 3
+                 ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                     (Thrift.getI32Type _proxy)
+                     Prelude.True
+                     (Thrift.genText _proxy)
+                     (Thrift.genI32 _proxy)
+                     . Map.toList)
+                    __field__dbSchemaIds)
+                 :
+                 Thrift.genField _proxy "otherSchemaIds" (Thrift.getListType _proxy)
+                   5
+                   4
+                   (Thrift.genList _proxy (Thrift.getMapType _proxy)
+                      (Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                         (Thrift.getI32Type _proxy)
+                         Prelude.True
+                         (Thrift.genText _proxy)
+                         (Thrift.genI32 _proxy)
+                         . Map.toList)
+                      __field__otherSchemaIds)
+                   :
+                   Thrift.genField _proxy "derivationDependencies"
+                     (Thrift.getMapType _proxy)
+                     6
+                     5
+                     ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                         (Thrift.getListType _proxy)
+                         Prelude.False
+                         (Thrift.genI64 _proxy)
+                         (Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                            (Thrift.genI64 _proxy))
+                         . Map.toList)
+                        __field__derivationDependencies)
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__schema <- ST.newSTRef Default.def
+            __field__predicateIds <- ST.newSTRef Default.def
+            __field__schemaIds <- ST.newSTRef Default.def
+            __field__dbSchemaIds <- ST.newSTRef Default.def
+            __field__otherSchemaIds <- ST.newSTRef Default.def
+            __field__derivationDependencies <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseByteString
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__schema
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__predicateIds
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__schemaIds
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__dbSchemaIds
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Map.fromList
+                                                                                           <$>
+                                                                                           Thrift.parseMap
+                                                                                             _proxy
+                                                                                             (Thrift.parseText
+                                                                                                _proxy)
+                                                                                             (Thrift.parseI32
+                                                                                                _proxy)
+                                                                                             Prelude.True))
+                                                                        ST.writeSTRef
+                                                                          __field__otherSchemaIds
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Prelude.snd
+                                                                                           <$>
+                                                                                           Thrift.parseList
+                                                                                             _proxy
+                                                                                             (Thrift.parseI64
+                                                                                                _proxy))
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__derivationDependencies
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__schema <- ST.readSTRef
+                                                                 __field__schema
+                                             !__val__predicateIds <- ST.readSTRef
+                                                                       __field__predicateIds
+                                             !__val__schemaIds <- ST.readSTRef __field__schemaIds
+                                             !__val__dbSchemaIds <- ST.readSTRef
+                                                                      __field__dbSchemaIds
+                                             !__val__otherSchemaIds <- ST.readSTRef
+                                                                         __field__otherSchemaIds
+                                             !__val__derivationDependencies <- ST.readSTRef
+                                                                                 __field__derivationDependencies
+                                             Prelude.pure
+                                               (SchemaInfo __val__schema __val__predicateIds
+                                                  __val__schemaIds
+                                                  __val__dbSchemaIds
+                                                  __val__otherSchemaIds
+                                                  __val__derivationDependencies)
+              _idMap
+                = HashMap.fromList
+                    [("schema", 1), ("predicateIds", 2), ("schemaIds", 3),
+                     ("dbSchemaIds", 4), ("otherSchemaIds", 5),
+                     ("derivationDependencies", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData SchemaInfo where
+  rnf
+    (SchemaInfo __field__schema __field__predicateIds
+       __field__schemaIds __field__dbSchemaIds __field__otherSchemaIds
+       __field__derivationDependencies)
+    = DeepSeq.rnf __field__schema `Prelude.seq`
+        DeepSeq.rnf __field__predicateIds `Prelude.seq`
+          DeepSeq.rnf __field__schemaIds `Prelude.seq`
+            DeepSeq.rnf __field__dbSchemaIds `Prelude.seq`
+              DeepSeq.rnf __field__otherSchemaIds `Prelude.seq`
+                DeepSeq.rnf __field__derivationDependencies `Prelude.seq` ()
+
+instance Default.Default SchemaInfo where
+  def
+    = SchemaInfo Default.def Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable SchemaInfo where
+  hashWithSalt __salt
+    (SchemaInfo _schema _predicateIds _schemaIds _dbSchemaIds
+       _otherSchemaIds _derivationDependencies)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _schema)
+                    ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                       _predicateIds))
+                 ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                    _schemaIds))
+              ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+                 _dbSchemaIds))
+           (Prelude.map (Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+              _otherSchemaIds))
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+           _derivationDependencies)
+
+data SelectSchema = SelectSchema_stored Empty
+                  | SelectSchema_current Empty
+                  | SelectSchema_schema_id SchemaId
+                  | SelectSchema_EMPTY
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SelectSchema where
+  toJSON (SelectSchema_stored __stored)
+    = Aeson.object ["stored" .= __stored]
+  toJSON (SelectSchema_current __current)
+    = Aeson.object ["current" .= __current]
+  toJSON (SelectSchema_schema_id __schema_id)
+    = Aeson.object ["schema_id" .= unSchemaId __schema_id]
+  toJSON SelectSchema_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SelectSchema where
+  buildStruct _proxy (SelectSchema_stored __stored)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "stored" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __stored)]
+  buildStruct _proxy (SelectSchema_current __current)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "current" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __current)]
+  buildStruct _proxy (SelectSchema_schema_id __schema_id)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "schema_id" (Thrift.getStringType _proxy) 3
+           0
+           ((Thrift.genText _proxy . unSchemaId) __schema_id)]
+  buildStruct _proxy SelectSchema_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SelectSchema_stored _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SelectSchema_current _val)
+                                                     3 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Prelude.fmap SchemaId
+                                                                      (Thrift.parseText _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SelectSchema_schema_id _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SelectSchema_EMPTY
+           Thrift.FieldEnd -> Prelude.return SelectSchema_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("stored", 1), ("current", 2), ("schema_id", 3)]
+
+instance DeepSeq.NFData SelectSchema where
+  rnf (SelectSchema_stored __stored) = DeepSeq.rnf __stored
+  rnf (SelectSchema_current __current) = DeepSeq.rnf __current
+  rnf (SelectSchema_schema_id __schema_id) = DeepSeq.rnf __schema_id
+  rnf SelectSchema_EMPTY = ()
+
+instance Default.Default SelectSchema where
+  def = SelectSchema_EMPTY
+
+instance Hashable.Hashable SelectSchema where
+  hashWithSalt __salt (SelectSchema_stored _stored)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _stored)
+  hashWithSalt __salt (SelectSchema_current _current)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _current)
+  hashWithSalt __salt (SelectSchema_schema_id _schema_id)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _schema_id)
+  hashWithSalt __salt SelectSchema_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data GetSchemaInfo = GetSchemaInfo{getSchemaInfo_select ::
+                                   SelectSchema,
+                                   getSchemaInfo_omit_source :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GetSchemaInfo where
+  toJSON (GetSchemaInfo __field__select __field__omit_source)
+    = Aeson.object
+        ("select" .= __field__select :
+           "omit_source" .= __field__omit_source : Prelude.mempty)
+
+instance Thrift.ThriftStruct GetSchemaInfo where
+  buildStruct _proxy
+    (GetSchemaInfo __field__select __field__omit_source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "select" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__select)
+           :
+           Thrift.genFieldBool _proxy "omit_source" 2 1 __field__omit_source :
+             [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__select <- ST.newSTRef Default.def
+            __field__omit_source <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__select
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__omit_source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__select <- ST.readSTRef
+                                                                 __field__select
+                                             !__val__omit_source <- ST.readSTRef
+                                                                      __field__omit_source
+                                             Prelude.pure
+                                               (GetSchemaInfo __val__select __val__omit_source)
+              _idMap = HashMap.fromList [("select", 1), ("omit_source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GetSchemaInfo where
+  rnf (GetSchemaInfo __field__select __field__omit_source)
+    = DeepSeq.rnf __field__select `Prelude.seq`
+        DeepSeq.rnf __field__omit_source `Prelude.seq` ()
+
+instance Default.Default GetSchemaInfo where
+  def = GetSchemaInfo Default.def Prelude.False
+
+instance Hashable.Hashable GetSchemaInfo where
+  hashWithSalt __salt (GetSchemaInfo _select _omit_source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _select)
+        _omit_source
+
+data FactIdRange = FactIdRange{factIdRange_start :: Id,
+                               factIdRange_finish :: Id}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FactIdRange where
+  toJSON (FactIdRange __field__start __field__finish)
+    = Aeson.object
+        ("start" .= __field__start :
+           "finish" .= __field__finish : Prelude.mempty)
+
+instance Thrift.ThriftStruct FactIdRange where
+  buildStruct _proxy (FactIdRange __field__start __field__finish)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "start" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__start)
+           :
+           Thrift.genField _proxy "finish" (Thrift.getI64Type _proxy) 2 1
+             (Thrift.genI64 _proxy __field__finish)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__start <- ST.newSTRef Default.def
+            __field__finish <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__start
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__finish
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__start <- ST.readSTRef __field__start
+                                             !__val__finish <- ST.readSTRef __field__finish
+                                             Prelude.pure (FactIdRange __val__start __val__finish)
+              _idMap = HashMap.fromList [("start", 1), ("finish", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FactIdRange where
+  rnf (FactIdRange __field__start __field__finish)
+    = DeepSeq.rnf __field__start `Prelude.seq`
+        DeepSeq.rnf __field__finish `Prelude.seq` ()
+
+instance Default.Default FactIdRange where
+  def = FactIdRange Default.def Default.def
+
+instance Hashable.Hashable FactIdRange where
+  hashWithSalt __salt (FactIdRange _start _finish)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _start)
+        _finish
+
+newtype ValidateSchema = ValidateSchema{validateSchema_schema ::
+                                        Bytestring}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ValidateSchema where
+  toJSON (ValidateSchema __field__schema)
+    = Aeson.object
+        ("schema" .= Text.decodeUtf8 __field__schema : Prelude.mempty)
+
+instance Thrift.ThriftStruct ValidateSchema where
+  buildStruct _proxy (ValidateSchema __field__schema)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "schema" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genByteString _proxy __field__schema)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__schema <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseByteString
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__schema
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__schema <- ST.readSTRef
+                                                                 __field__schema
+                                             Prelude.pure (ValidateSchema __val__schema)
+              _idMap = HashMap.fromList [("schema", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ValidateSchema where
+  rnf (ValidateSchema __field__schema)
+    = DeepSeq.rnf __field__schema `Prelude.seq` ()
+
+instance Default.Default ValidateSchema where
+  def = ValidateSchema Default.def
+
+instance Hashable.Hashable ValidateSchema where
+  hashWithSalt __salt (ValidateSchema _schema)
+    = Hashable.hashWithSalt __salt _schema
+
+newtype PredicateStatsOpts = PredicateStatsOpts{predicateStatsOpts_excludeBase
+                                                :: Prelude.Bool}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateStatsOpts where
+  toJSON (PredicateStatsOpts __field__excludeBase)
+    = Aeson.object
+        ("excludeBase" .= __field__excludeBase : Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateStatsOpts where
+  buildStruct _proxy (PredicateStatsOpts __field__excludeBase)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "excludeBase" 1 0 __field__excludeBase
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__excludeBase <- ST.newSTRef Prelude.True
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__excludeBase
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__excludeBase <- ST.readSTRef
+                                                                      __field__excludeBase
+                                             Prelude.pure (PredicateStatsOpts __val__excludeBase)
+              _idMap = HashMap.fromList [("excludeBase", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateStatsOpts where
+  rnf (PredicateStatsOpts __field__excludeBase)
+    = DeepSeq.rnf __field__excludeBase `Prelude.seq` ()
+
+instance Default.Default PredicateStatsOpts where
+  def = PredicateStatsOpts Prelude.True
+
+instance Hashable.Hashable PredicateStatsOpts where
+  hashWithSalt __salt (PredicateStatsOpts _excludeBase)
+    = Hashable.hashWithSalt __salt _excludeBase
+
+data CompleteAxiomPredicates = CompleteAxiomPredicates{}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CompleteAxiomPredicates where
+  toJSON CompleteAxiomPredicates = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct CompleteAxiomPredicates where
+  buildStruct _proxy CompleteAxiomPredicates
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (CompleteAxiomPredicates)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData CompleteAxiomPredicates where
+  rnf CompleteAxiomPredicates = ()
+
+instance Default.Default CompleteAxiomPredicates where
+  def = CompleteAxiomPredicates
+
+instance Hashable.Hashable CompleteAxiomPredicates where
+  hashWithSalt __salt CompleteAxiomPredicates = __salt
+
+newtype CompleteDerivedPredicate = CompleteDerivedPredicate{completeDerivedPredicate_predicate
+                                                            :: PredicateRef}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CompleteDerivedPredicate where
+  toJSON (CompleteDerivedPredicate __field__predicate)
+    = Aeson.object ("predicate" .= __field__predicate : Prelude.mempty)
+
+instance Thrift.ThriftStruct CompleteDerivedPredicate where
+  buildStruct _proxy (CompleteDerivedPredicate __field__predicate)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "predicate" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__predicate)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__predicate <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__predicate
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__predicate <- ST.readSTRef
+                                                                    __field__predicate
+                                             Prelude.pure
+                                               (CompleteDerivedPredicate __val__predicate)
+              _idMap = HashMap.fromList [("predicate", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData CompleteDerivedPredicate where
+  rnf (CompleteDerivedPredicate __field__predicate)
+    = DeepSeq.rnf __field__predicate `Prelude.seq` ()
+
+instance Default.Default CompleteDerivedPredicate where
+  def = CompleteDerivedPredicate Default.def
+
+instance Hashable.Hashable CompleteDerivedPredicate where
+  hashWithSalt __salt (CompleteDerivedPredicate _predicate)
+    = Hashable.hashWithSalt __salt _predicate
+
+data CompletePredicates = CompletePredicates_axiom CompleteAxiomPredicates
+                        | CompletePredicates_derived CompleteDerivedPredicate
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CompletePredicates where
+  toJSON (CompletePredicates_axiom __axiom)
+    = Aeson.object ["axiom" .= __axiom]
+  toJSON (CompletePredicates_derived __derived)
+    = Aeson.object ["derived" .= __derived]
+
+instance Thrift.ThriftStruct CompletePredicates where
+  buildStruct _proxy (CompletePredicates_axiom __axiom)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "axiom" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __axiom)]
+  buildStruct _proxy (CompletePredicates_derived __derived)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __derived)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (CompletePredicates_axiom _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (CompletePredicates_derived _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'CompletePredicates': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail
+                                "union 'CompletePredicates' is empty"
+    where
+      _idMap = HashMap.fromList [("axiom", 1), ("derived", 2)]
+
+instance DeepSeq.NFData CompletePredicates where
+  rnf (CompletePredicates_axiom __axiom) = DeepSeq.rnf __axiom
+  rnf (CompletePredicates_derived __derived) = DeepSeq.rnf __derived
+
+instance Default.Default CompletePredicates where
+  def = CompletePredicates_axiom Default.def
+
+instance Hashable.Hashable CompletePredicates where
+  hashWithSalt __salt (CompletePredicates_axiom _axiom)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _axiom)
+  hashWithSalt __salt (CompletePredicates_derived _derived)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _derived)
+
+data CompletePredicatesResponse = CompletePredicatesResponse{}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CompletePredicatesResponse where
+  toJSON CompletePredicatesResponse = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct CompletePredicatesResponse where
+  buildStruct _proxy CompletePredicatesResponse
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (CompletePredicatesResponse)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData CompletePredicatesResponse where
+  rnf CompletePredicatesResponse = ()
+
+instance Default.Default CompletePredicatesResponse where
+  def = CompletePredicatesResponse
+
+instance Hashable.Hashable CompletePredicatesResponse where
+  hashWithSalt __salt CompletePredicatesResponse = __salt
+
+data PredicateAnnotation = PredicateAnnotation{predicateAnnotation_name
+                                               :: PredicateName,
+                                               predicateAnnotation_version :: Int.Int32}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateAnnotation where
+  toJSON (PredicateAnnotation __field__name __field__version)
+    = Aeson.object
+        ("name" .= __field__name :
+           "version" .= __field__version : Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateAnnotation where
+  buildStruct _proxy
+    (PredicateAnnotation __field__name __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genFieldPrim _proxy "version" (Thrift.getI32Type _proxy) 2 1
+             (Thrift.genI32Prim _proxy)
+             __field__version
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__version <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure
+                                               (PredicateAnnotation __val__name __val__version)
+              _idMap = HashMap.fromList [("name", 1), ("version", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateAnnotation where
+  rnf (PredicateAnnotation __field__name __field__version)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default PredicateAnnotation where
+  def = PredicateAnnotation "" Default.def
+
+instance Hashable.Hashable PredicateAnnotation where
+  hashWithSalt __salt (PredicateAnnotation _name _version)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _version
+
+type List_Fact_2137 = Vector.Vector Fact
+
+type List_Id_2029 = Vector.Vector Id
+
+type List_i64 = VectorStorable.Vector Int.Int64
+
+type Map_Id_list_FactDependencies_964 =
+     HashMap.HashMap Id [FactDependencies]
+
+type Map_UnitName_listOfIds = HashMap.HashMap UnitName ListOfIds
+{-# LINE 15 "glean/if/glean_include.hs" #-}
+instance Pretty PredicateRef where
+  pretty (PredicateRef n v) = pretty n <> "." <> pretty v
+{-# LINE 18 "glean/if/glean_include.hs" #-}
+instance Pretty TypeRef where
+  pretty (TypeRef n v) = pretty n <> "." <> pretty v
+{-# LINE 21 "glean/if/glean_include.hs" #-}
+instance Prelude.Enum Nat where
+  succ = Nat . Prelude.succ . unNat
+  pred = Nat . Prelude.pred . unNat
+  toEnum = Nat . Prelude.toEnum
+  fromEnum = Prelude.fromEnum . unNat
+{-# LINE 27 "glean/if/glean_include.hs" #-}
+instance Prelude.Enum Byte where
+  succ = Byte . Prelude.succ . unByte
+  pred = Byte . Prelude.pred . unByte
+  toEnum = Byte . Prelude.toEnum
+  fromEnum = Prelude.fromEnum . unByte
+{-# LINE 33 "glean/if/glean_include.hs" #-}
+instance Prelude.Semigroup PredicateStats where
+  x <> y
+    = PredicateStats{predicateStats_count =
+                       predicateStats_count x Prelude.+ predicateStats_count y,
+                     predicateStats_size =
+                       predicateStats_size x Prelude.+ predicateStats_size y}
+{-# LINE 41 "glean/if/glean_include.hs" #-}
+instance Prelude.Semigroup UserQueryStats where
+  (<>)
+    UserQueryStats{userQueryStats_num_facts = num_facts1,
+                   userQueryStats_elapsed_ns = elapsed_ns1,
+                   userQueryStats_allocated_bytes = allocated_bytes1,
+                   userQueryStats_facts_searched = facts_searched1,
+                   userQueryStats_compile_time_ns = compile_time_ns1,
+                   userQueryStats_bytecode_size = bytecode_size1,
+                   userQueryStats_execute_time_ns = execute_time_ns1,
+                   userQueryStats_result_count = result_count1,
+                   userQueryStats_codegen_time_ns = codegen_time_ns1,
+                   userQueryStats_full_scans = full_scans1,
+                   userQueryStats_result_bytes = result_bytes1}
+    UserQueryStats{userQueryStats_num_facts = num_facts2,
+                   userQueryStats_elapsed_ns = elapsed_ns2,
+                   userQueryStats_allocated_bytes = allocated_bytes2,
+                   userQueryStats_facts_searched = facts_searched2,
+                   userQueryStats_compile_time_ns = compile_time_ns2,
+                   userQueryStats_bytecode_size = bytecode_size2,
+                   userQueryStats_execute_time_ns = execute_time_ns2,
+                   userQueryStats_result_count = result_count2,
+                   userQueryStats_codegen_time_ns = codegen_time_ns2,
+                   userQueryStats_full_scans = full_scans2,
+                   userQueryStats_result_bytes = result_bytes2}
+    = UserQueryStats{userQueryStats_num_facts =
+                       num_facts1 Prelude.+ num_facts2,
+                     userQueryStats_elapsed_ns = elapsed_ns1 Prelude.+ elapsed_ns2,
+                     userQueryStats_allocated_bytes =
+                       allocated_bytes1 Prelude.+ allocated_bytes2,
+                     userQueryStats_facts_searched =
+                       fMaybe (Map.unionWith (Prelude.+)) facts_searched1 facts_searched2,
+                     userQueryStats_compile_time_ns =
+                       fMaybe (Prelude.+) compile_time_ns1 compile_time_ns2,
+                     userQueryStats_bytecode_size =
+                       bytecode_size1 `Prelude.max` bytecode_size2,
+                     userQueryStats_execute_time_ns =
+                       fMaybe (Prelude.+) execute_time_ns1 execute_time_ns2,
+                     userQueryStats_result_count =
+                       result_count1 Prelude.+ result_count2,
+                     userQueryStats_codegen_time_ns =
+                       fMaybe (Prelude.+) codegen_time_ns1 codegen_time_ns2,
+                     userQueryStats_full_scans = List.nub (full_scans1 <> full_scans2),
+                     userQueryStats_result_bytes =
+                       fMaybe (Prelude.+) result_bytes1 result_bytes2}
+    where
+      fMaybe _ Prelude.Nothing a = a
+      fMaybe _ a Prelude.Nothing = a
+      fMaybe f (Prelude.Just a) (Prelude.Just b) = Prelude.Just (f a b)
diff --git a/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Client.hs b/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Client.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Client.hs
@@ -0,0 +1,180 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+module Glean.Index.GleanIndexingService.Client
+       (GleanIndexingService, index, indexIO, send_index, _build_index,
+        recv_index, _parse_index)
+       where
+import qualified Control.Arrow as Arrow
+import qualified Control.Concurrent as Concurrent
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Control.Monad.Trans.Reader as Reader
+import qualified Data.ByteString.Builder as ByteString
+import qualified Data.ByteString.Lazy as LBS
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Proxy as Proxy
+import qualified Glean.GleanService.Client as GleanService
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Data.Monoid ((<>))
+import Prelude ((==), (=<<), (>>=), (<$>), (.))
+import Glean.Index.Types
+
+data GleanIndexingService
+
+type instance Thrift.Super GleanIndexingService =
+     GleanService.GleanService
+
+index ::
+        (Thrift.Protocol p, Thrift.ClientChannel c,
+         (Thrift.<:) s GleanIndexingService) =>
+        IndexRequest -> Thrift.ThriftM p c s IndexResponse
+index __field__request
+  = do Thrift.ThriftEnv _proxy _channel _opts _counter <- Reader.ask
+       Trans.lift
+         (indexIO _proxy _channel _counter _opts __field__request)
+
+indexIO ::
+          (Thrift.Protocol p, Thrift.ClientChannel c,
+           (Thrift.<:) s GleanIndexingService) =>
+          Proxy.Proxy p ->
+            c s ->
+              Thrift.Counter ->
+                Thrift.RpcOptions -> IndexRequest -> Prelude.IO IndexResponse
+indexIO _proxy _channel _counter _opts __field__request
+  = do (_handle, _sendCob, _recvCob) <- Thrift.mkCallbacks
+                                          (recv_index _proxy)
+       send_index _proxy _channel _counter _sendCob _recvCob _opts
+         __field__request
+       Thrift.wait _handle
+
+send_index ::
+             (Thrift.Protocol p, Thrift.ClientChannel c,
+              (Thrift.<:) s GleanIndexingService) =>
+             Proxy.Proxy p ->
+               c s ->
+                 Thrift.Counter ->
+                   Thrift.SendCallback ->
+                     Thrift.RecvCallback ->
+                       Thrift.RpcOptions -> IndexRequest -> Prelude.IO ()
+send_index _proxy _channel _counter _sendCob _recvCob _rpcOpts
+  __field__request
+  = do _seqNum <- _counter
+       let
+         _callMsg
+           = LBS.toStrict
+               (ByteString.toLazyByteString
+                  (_build_index _proxy _seqNum __field__request))
+       Thrift.sendRequest _channel
+         (Thrift.Request _callMsg
+            (Thrift.setRpcPriority _rpcOpts Thrift.NormalPriority))
+         _sendCob
+         _recvCob
+
+recv_index ::
+             (Thrift.Protocol p) =>
+             Proxy.Proxy p ->
+               Thrift.Response ->
+                 Prelude.Either Exception.SomeException IndexResponse
+recv_index _proxy (Thrift.Response _response _)
+  = Monad.join
+      (Arrow.left (Exception.SomeException . Thrift.ProtocolException)
+         (Parser.parse (_parse_index _proxy) _response))
+
+_build_index ::
+               Thrift.Protocol p =>
+               Proxy.Proxy p -> Int.Int32 -> IndexRequest -> ByteString.Builder
+_build_index _proxy _seqNum __field__request
+  = Thrift.genMsgBegin _proxy "index" 1 _seqNum <>
+      Thrift.genStruct _proxy
+        (Thrift.genField _proxy "request" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__request)
+           : [])
+      <> Thrift.genMsgEnd _proxy
+
+_parse_index ::
+               Thrift.Protocol p =>
+               Proxy.Proxy p ->
+                 Parser.Parser
+                   (Prelude.Either Exception.SomeException IndexResponse)
+_parse_index _proxy
+  = do Thrift.MsgBegin _name _msgTy _ <- Thrift.parseMsgBegin _proxy
+       _result <- case _msgTy of
+                    1 -> Prelude.fail "index: expected reply but got function call"
+                    2 | _name == "index" ->
+                        do let
+                             _idMap
+                               = HashMap.fromList [("index_success", 0), ("n", 1), ("e", 2)]
+                           _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+                           case _fieldBegin of
+                             Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                       0 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             Prelude.Right
+                                                                             (Thrift.parseStruct
+                                                                                _proxy)
+                                                                       1 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  NoIndexerAvailable)
+                                                                       2 | _type ==
+                                                                             Thrift.getStructType
+                                                                               _proxy
+                                                                           ->
+                                                                           Prelude.fmap
+                                                                             (Prelude.Left .
+                                                                                Exception.SomeException)
+                                                                             (Thrift.parseStruct
+                                                                                _proxy
+                                                                                ::
+                                                                                Parser.Parser
+                                                                                  Glean.Exception)
+                                                                       _ -> Prelude.fail
+                                                                              (Prelude.unwords
+                                                                                 ["unrecognized exception, type:",
+                                                                                  Prelude.show
+                                                                                    _type,
+                                                                                  "field id:",
+                                                                                  Prelude.show _id])
+                             Thrift.FieldEnd -> Prelude.fail "no response"
+                      | Prelude.otherwise -> Prelude.fail "reply function does not match"
+                    3 -> Prelude.fmap (Prelude.Left . Exception.SomeException)
+                           (Thrift.parseStruct _proxy ::
+                              Parser.Parser Thrift.ApplicationException)
+                    4 -> Prelude.fail
+                           "index: expected reply but got oneway function call"
+                    _ -> Prelude.fail "index: invalid message type"
+       Thrift.parseMsgEnd _proxy
+       Prelude.return _result
diff --git a/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Service.hs b/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/index/gen-hs2/Glean/Index/GleanIndexingService/Service.hs
@@ -0,0 +1,150 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GADTs #-}
+module Glean.Index.GleanIndexingService.Service
+       (GleanIndexingServiceCommand(..), reqName', reqParser',
+        respWriter', methodsInfo')
+       where
+import qualified Control.Exception as Exception
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.ByteString.Builder as Builder
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Int as Int
+import qualified Data.Map.Strict as Map
+import qualified Data.Proxy as Proxy
+import qualified Data.Text as Text
+import qualified Glean.GleanService.Service as GleanService
+import qualified Glean.Index.Types as Types
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.Codegen as Thrift
+import qualified Thrift.Processor as Thrift
+import qualified Thrift.Protocol.ApplicationException.Types
+       as Thrift
+import Control.Applicative ((<*), (*>))
+import Data.Monoid ((<>))
+import Prelude ((<$>), (<*>), (++), (.), (==))
+
+data GleanIndexingServiceCommand a where
+  Index ::
+    Types.IndexRequest ->
+      GleanIndexingServiceCommand Types.IndexResponse
+  SuperGleanService ::
+    GleanService.GleanServiceCommand a -> GleanIndexingServiceCommand a
+
+instance Thrift.Processor GleanIndexingServiceCommand where
+  reqName = reqName'
+  reqParser = reqParser'
+  respWriter = respWriter'
+  methodsInfo _ = methodsInfo'
+
+reqName' :: GleanIndexingServiceCommand a -> Text.Text
+reqName' (Index __field__request) = "index"
+reqName' (SuperGleanService x) = GleanService.reqName' x
+
+reqParser' ::
+             Thrift.Protocol p =>
+             Proxy.Proxy p ->
+               Text.Text ->
+                 Parser.Parser (Thrift.Some GleanIndexingServiceCommand)
+reqParser' _proxy "index"
+  = ST.runSTT
+      (do Prelude.return ()
+          __field__request <- ST.newSTRef Default.def
+          let
+            _parse _lastId
+              = do _fieldBegin <- Trans.lift
+                                    (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                   case _fieldBegin of
+                     Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                               1 | _type ==
+                                                                     Thrift.getStructType _proxy
+                                                                   ->
+                                                                   do !_val <- Trans.lift
+                                                                                 (Thrift.parseStruct
+                                                                                    _proxy)
+                                                                      ST.writeSTRef __field__request
+                                                                        _val
+                                                               _ -> Trans.lift
+                                                                      (Thrift.parseSkip _proxy _type
+                                                                         (Prelude.Just _bool))
+                                                             _parse _id
+                     Thrift.FieldEnd -> do !__val__request <- ST.readSTRef
+                                                                __field__request
+                                           Prelude.pure (Thrift.Some (Index __val__request))
+            _idMap = HashMap.fromList [("request", 1)]
+          _parse 0)
+reqParser' _proxy funName
+  = do Thrift.Some x <- GleanService.reqParser' _proxy funName
+       Prelude.return (Thrift.Some (SuperGleanService x))
+
+respWriter' ::
+              Thrift.Protocol p =>
+              Proxy.Proxy p ->
+                Int.Int32 ->
+                  GleanIndexingServiceCommand a ->
+                    Prelude.Either Exception.SomeException a ->
+                      (Builder.Builder,
+                       Prelude.Maybe (Exception.SomeException, Thrift.Blame))
+respWriter' _proxy _seqNum Index{} _r
+  = (Thrift.genMsgBegin _proxy "index" _msgType _seqNum <> _msgBody
+       <> Thrift.genMsgEnd _proxy,
+     _msgException)
+  where
+    (_msgType, _msgBody, _msgException)
+      = case _r of
+          Prelude.Left _ex | Prelude.Just
+                               _e@Thrift.ApplicationException{} <- Exception.fromException _ex
+                             ->
+                             (3, Thrift.buildStruct _proxy _e,
+                              Prelude.Just (_ex, Thrift.ServerError))
+                           | Prelude.Just
+                               _e@Types.NoIndexerAvailable{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "n" (Thrift.getStructType _proxy) 1 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.Just _e@Glean.Exception{} <- Exception.fromException _ex
+                             ->
+                             (2,
+                              Thrift.genStruct _proxy
+                                [Thrift.genField _proxy "e" (Thrift.getStructType _proxy) 2 0
+                                   (Thrift.buildStruct _proxy _e)],
+                              Prelude.Just (_ex, Thrift.ClientError))
+                           | Prelude.otherwise ->
+                             let _e
+                                   = Thrift.ApplicationException (Text.pack (Prelude.show _ex))
+                                       Thrift.ApplicationExceptionType_InternalError
+                               in
+                               (3, Thrift.buildStruct _proxy _e,
+                                Prelude.Just (Exception.toException _e, Thrift.ServerError))
+          Prelude.Right _result -> (2,
+                                    Thrift.genStruct _proxy
+                                      [Thrift.genField _proxy "" (Thrift.getStructType _proxy) 0 0
+                                         (Thrift.buildStruct _proxy _result)],
+                                    Prelude.Nothing)
+respWriter' _proxy _seqNum (SuperGleanService _x) _r
+  = GleanService.respWriter' _proxy _seqNum _x _r
+
+methodsInfo' :: Map.Map Text.Text Thrift.MethodInfo
+methodsInfo'
+  = Map.union
+      (Map.fromList
+         [("index", Thrift.MethodInfo Thrift.NormalPriority Prelude.False)])
+      GleanService.methodsInfo'
diff --git a/glean/if/index/gen-hs2/Glean/Index/Types.hs b/glean/if/index/gen-hs2/Glean/Index/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/index/gen-hs2/Glean/Index/Types.hs
@@ -0,0 +1,657 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Index.Types
+       (Revision(Revision, revision_hash), FilePath,
+        Diff(Diff, diff_line, diff_removed, diff_added),
+        FileModified(FileModified, fileModified_diffs),
+        FileMoved(FileMoved, fileMoved_new_path, fileMoved_diffs),
+        FileDeleted(FileDeleted),
+        FileChange(FileChange_modified, FileChange_moved,
+                   FileChange_deleted),
+        IndexRequest(IndexRequest, indexRequest_repo, indexRequest_base,
+                     indexRequest_changes),
+        IndexResponse(IndexResponse, indexResponse_repo),
+        NoIndexerAvailable(NoIndexerAvailable, noIndexerAvailable_message))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+newtype Revision = Revision{revision_hash :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Revision where
+  toJSON (Revision __field__hash)
+    = Aeson.object ("hash" .= __field__hash : Prelude.mempty)
+
+instance Thrift.ThriftStruct Revision where
+  buildStruct _proxy (Revision __field__hash)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__hash)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hash <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                             Prelude.pure (Revision __val__hash)
+              _idMap = HashMap.fromList [("hash", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Revision where
+  rnf (Revision __field__hash)
+    = DeepSeq.rnf __field__hash `Prelude.seq` ()
+
+instance Default.Default Revision where
+  def = Revision ""
+
+instance Hashable.Hashable Revision where
+  hashWithSalt __salt (Revision _hash)
+    = Hashable.hashWithSalt __salt _hash
+
+type FilePath = Text.Text
+
+data Diff = Diff{diff_line :: Int.Int32, diff_removed :: Int.Int32,
+                 diff_added :: [Text.Text]}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Diff where
+  toJSON (Diff __field__line __field__removed __field__added)
+    = Aeson.object
+        ("line" .= __field__line :
+           "removed" .= __field__removed :
+             "added" .= __field__added : Prelude.mempty)
+
+instance Thrift.ThriftStruct Diff where
+  buildStruct _proxy
+    (Diff __field__line __field__removed __field__added)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldPrim _proxy "line" (Thrift.getI32Type _proxy) 1 0
+           (Thrift.genI32Prim _proxy)
+           __field__line
+           :
+           Thrift.genFieldPrim _proxy "removed" (Thrift.getI32Type _proxy) 2 1
+             (Thrift.genI32Prim _proxy)
+             __field__removed
+             :
+             Thrift.genField _proxy "added" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__added)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__line <- ST.newSTRef Default.def
+            __field__removed <- ST.newSTRef Default.def
+            __field__added <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__line
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI32
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__removed
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__added
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__line <- ST.readSTRef __field__line
+                                             !__val__removed <- ST.readSTRef __field__removed
+                                             !__val__added <- ST.readSTRef __field__added
+                                             Prelude.pure
+                                               (Diff __val__line __val__removed __val__added)
+              _idMap
+                = HashMap.fromList [("line", 1), ("removed", 2), ("added", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Diff where
+  rnf (Diff __field__line __field__removed __field__added)
+    = DeepSeq.rnf __field__line `Prelude.seq`
+        DeepSeq.rnf __field__removed `Prelude.seq`
+          DeepSeq.rnf __field__added `Prelude.seq` ()
+
+instance Default.Default Diff where
+  def = Diff Default.def Default.def Default.def
+
+instance Hashable.Hashable Diff where
+  hashWithSalt __salt (Diff _line _removed _added)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _line)
+           _removed)
+        _added
+
+newtype FileModified = FileModified{fileModified_diffs :: [Diff]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileModified where
+  toJSON (FileModified __field__diffs)
+    = Aeson.object ("diffs" .= __field__diffs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileModified where
+  buildStruct _proxy (FileModified __field__diffs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "diffs" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__diffs)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__diffs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__diffs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__diffs <- ST.readSTRef __field__diffs
+                                             Prelude.pure (FileModified __val__diffs)
+              _idMap = HashMap.fromList [("diffs", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData FileModified where
+  rnf (FileModified __field__diffs)
+    = DeepSeq.rnf __field__diffs `Prelude.seq` ()
+
+instance Default.Default FileModified where
+  def = FileModified Default.def
+
+instance Hashable.Hashable FileModified where
+  hashWithSalt __salt (FileModified _diffs)
+    = Hashable.hashWithSalt __salt _diffs
+
+data FileMoved = FileMoved{fileMoved_new_path :: FilePath,
+                           fileMoved_diffs :: [Diff]}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileMoved where
+  toJSON (FileMoved __field__new_path __field__diffs)
+    = Aeson.object
+        ("new_path" .= __field__new_path :
+           "diffs" .= __field__diffs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileMoved where
+  buildStruct _proxy (FileMoved __field__new_path __field__diffs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "new_path" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__new_path)
+           :
+           Thrift.genField _proxy "diffs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__diffs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__new_path <- ST.newSTRef ""
+            __field__diffs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__new_path
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__diffs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__new_path <- ST.readSTRef
+                                                                   __field__new_path
+                                             !__val__diffs <- ST.readSTRef __field__diffs
+                                             Prelude.pure (FileMoved __val__new_path __val__diffs)
+              _idMap = HashMap.fromList [("new_path", 1), ("diffs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileMoved where
+  rnf (FileMoved __field__new_path __field__diffs)
+    = DeepSeq.rnf __field__new_path `Prelude.seq`
+        DeepSeq.rnf __field__diffs `Prelude.seq` ()
+
+instance Default.Default FileMoved where
+  def = FileMoved "" Default.def
+
+instance Hashable.Hashable FileMoved where
+  hashWithSalt __salt (FileMoved _new_path _diffs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _new_path)
+        _diffs
+
+data FileDeleted = FileDeleted{}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeleted where
+  toJSON FileDeleted = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct FileDeleted where
+  buildStruct _proxy FileDeleted = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (FileDeleted)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData FileDeleted where
+  rnf FileDeleted = ()
+
+instance Default.Default FileDeleted where
+  def = FileDeleted
+
+instance Hashable.Hashable FileDeleted where
+  hashWithSalt __salt FileDeleted = __salt
+
+data FileChange = FileChange_modified FileModified
+                | FileChange_moved FileMoved
+                | FileChange_deleted FileDeleted
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileChange where
+  toJSON (FileChange_modified __modified)
+    = Aeson.object ["modified" .= __modified]
+  toJSON (FileChange_moved __moved)
+    = Aeson.object ["moved" .= __moved]
+  toJSON (FileChange_deleted __deleted)
+    = Aeson.object ["deleted" .= __deleted]
+
+instance Thrift.ThriftStruct FileChange where
+  buildStruct _proxy (FileChange_modified __modified)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "modified" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __modified)]
+  buildStruct _proxy (FileChange_moved __moved)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moved" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __moved)]
+  buildStruct _proxy (FileChange_deleted __deleted)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "deleted" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __deleted)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FileChange_modified _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (FileChange_moved _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (FileChange_deleted _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'FileChange': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'FileChange' is empty"
+    where
+      _idMap
+        = HashMap.fromList [("modified", 1), ("moved", 2), ("deleted", 3)]
+
+instance DeepSeq.NFData FileChange where
+  rnf (FileChange_modified __modified) = DeepSeq.rnf __modified
+  rnf (FileChange_moved __moved) = DeepSeq.rnf __moved
+  rnf (FileChange_deleted __deleted) = DeepSeq.rnf __deleted
+
+instance Default.Default FileChange where
+  def = FileChange_modified Default.def
+
+instance Hashable.Hashable FileChange where
+  hashWithSalt __salt (FileChange_modified _modified)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _modified)
+  hashWithSalt __salt (FileChange_moved _moved)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _moved)
+  hashWithSalt __salt (FileChange_deleted _deleted)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _deleted)
+
+data IndexRequest = IndexRequest{indexRequest_repo :: Glean.Repo,
+                                 indexRequest_base :: Revision,
+                                 indexRequest_changes :: Map.Map FilePath FileChange}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexRequest where
+  toJSON (IndexRequest __field__repo __field__base __field__changes)
+    = Aeson.object
+        ("repo" .= __field__repo :
+           "base" .= __field__base :
+             "changes" .= Map.mapKeys Thrift.keyToStr __field__changes :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexRequest where
+  buildStruct _proxy
+    (IndexRequest __field__repo __field__base __field__changes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             :
+             Thrift.genField _proxy "changes" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                   (Thrift.getStructType _proxy)
+                   Prelude.True
+                   (Thrift.genText _proxy)
+                   (Thrift.buildStruct _proxy)
+                   . Map.toList)
+                  __field__changes)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            __field__changes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__changes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             !__val__base <- ST.readSTRef __field__base
+                                             !__val__changes <- ST.readSTRef __field__changes
+                                             Prelude.pure
+                                               (IndexRequest __val__repo __val__base __val__changes)
+              _idMap
+                = HashMap.fromList [("repo", 1), ("base", 2), ("changes", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexRequest where
+  rnf (IndexRequest __field__repo __field__base __field__changes)
+    = DeepSeq.rnf __field__repo `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq`
+          DeepSeq.rnf __field__changes `Prelude.seq` ()
+
+instance Default.Default IndexRequest where
+  def = IndexRequest Default.def Default.def Default.def
+
+instance Hashable.Hashable IndexRequest where
+  hashWithSalt __salt (IndexRequest _repo _base _changes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _repo) _base)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _changes)
+
+newtype IndexResponse = IndexResponse{indexResponse_repo ::
+                                      Glean.Repo}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexResponse where
+  toJSON (IndexResponse __field__repo)
+    = Aeson.object ("repo" .= __field__repo : Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexResponse where
+  buildStruct _proxy (IndexResponse __field__repo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "repo" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__repo)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__repo <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repo
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__repo <- ST.readSTRef __field__repo
+                                             Prelude.pure (IndexResponse __val__repo)
+              _idMap = HashMap.fromList [("repo", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexResponse where
+  rnf (IndexResponse __field__repo)
+    = DeepSeq.rnf __field__repo `Prelude.seq` ()
+
+instance Default.Default IndexResponse where
+  def = IndexResponse Default.def
+
+instance Hashable.Hashable IndexResponse where
+  hashWithSalt __salt (IndexResponse _repo)
+    = Hashable.hashWithSalt __salt _repo
+
+newtype NoIndexerAvailable = NoIndexerAvailable{noIndexerAvailable_message
+                                                :: Text.Text}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NoIndexerAvailable where
+  toJSON (NoIndexerAvailable __field__message)
+    = Aeson.object ("message" .= __field__message : Prelude.mempty)
+
+instance Thrift.ThriftStruct NoIndexerAvailable where
+  buildStruct _proxy (NoIndexerAvailable __field__message)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "message" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__message)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__message <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__message
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__message <- ST.readSTRef
+                                                                  __field__message
+                                             Prelude.pure (NoIndexerAvailable __val__message)
+              _idMap = HashMap.fromList [("message", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData NoIndexerAvailable where
+  rnf (NoIndexerAvailable __field__message)
+    = DeepSeq.rnf __field__message `Prelude.seq` ()
+
+instance Default.Default NoIndexerAvailable where
+  def = NoIndexerAvailable ""
+
+instance Hashable.Hashable NoIndexerAvailable where
+  hashWithSalt __salt (NoIndexerAvailable _message)
+    = Hashable.hashWithSalt __salt _message
+
+instance Exception.Exception NoIndexerAvailable
diff --git a/glean/if/internal/gen-hs2/Glean/Internal/Types.hs b/glean/if/internal/gen-hs2/Glean/Internal/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/if/internal/gen-hs2/Glean/Internal/Types.hs
@@ -0,0 +1,894 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Internal.Types
+       (StoredSchema(StoredSchema, storedSchema_schema,
+                     storedSchema_predicateIds, storedSchema_versions),
+        DatabaseIncomplete(DatabaseIncomplete),
+        DatabaseFinalizing(DatabaseFinalizing),
+        Completeness(Incomplete, Complete, Broken, Finalizing),
+        Meta(Meta, metaVersion, metaCreated, metaCompleteness, metaBackup,
+             metaProperties, metaDependencies, metaCompletePredicates,
+             metaAxiomComplete, metaRepoHashTime),
+        SchemaInstance(SchemaInstance, schemaInstance_versions,
+                       schemaInstance_file),
+        SchemaIndex(SchemaIndex, schemaIndex_current, schemaIndex_older),
+        String_321)
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Glean.ServerConfig.Types as Glean.ServerConfig
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+data StoredSchema = StoredSchema{storedSchema_schema :: String_321,
+                                 storedSchema_predicateIds :: Map.Map Glean.Id Glean.PredicateRef,
+                                 storedSchema_versions :: Map.Map Text.Text Glean.Version}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredSchema where
+  toJSON
+    (StoredSchema __field__schema __field__predicateIds
+       __field__versions)
+    = Aeson.object
+        ("schema" .= Text.decodeUtf8 __field__schema :
+           "predicateIds" .= Map.mapKeys Thrift.keyToStr __field__predicateIds
+             : "versions" .= __field__versions : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredSchema where
+  buildStruct _proxy
+    (StoredSchema __field__schema __field__predicateIds
+       __field__versions)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "schema" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genByteString _proxy __field__schema)
+           :
+           Thrift.genField _proxy "predicateIds" (Thrift.getMapType _proxy) 2
+             1
+             ((Thrift.genMap _proxy (Thrift.getI64Type _proxy)
+                 (Thrift.getStructType _proxy)
+                 Prelude.False
+                 (Thrift.genI64 _proxy)
+                 (Thrift.buildStruct _proxy)
+                 . Map.toList)
+                __field__predicateIds)
+             :
+             Thrift.genField _proxy "versions" (Thrift.getMapType _proxy) 3 2
+               ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                   (Thrift.getI32Type _proxy)
+                   Prelude.True
+                   (Thrift.genText _proxy)
+                   (Thrift.genI32 _proxy)
+                   . Map.toList)
+                  __field__versions)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__schema <- ST.newSTRef Default.def
+            __field__predicateIds <- ST.newSTRef Default.def
+            __field__versions <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseByteString
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__schema
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI64
+                                                                                           _proxy)
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__predicateIds
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__versions
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__schema <- ST.readSTRef
+                                                                 __field__schema
+                                             !__val__predicateIds <- ST.readSTRef
+                                                                       __field__predicateIds
+                                             !__val__versions <- ST.readSTRef __field__versions
+                                             Prelude.pure
+                                               (StoredSchema __val__schema __val__predicateIds
+                                                  __val__versions)
+              _idMap
+                = HashMap.fromList
+                    [("schema", 1), ("predicateIds", 2), ("versions", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredSchema where
+  rnf
+    (StoredSchema __field__schema __field__predicateIds
+       __field__versions)
+    = DeepSeq.rnf __field__schema `Prelude.seq`
+        DeepSeq.rnf __field__predicateIds `Prelude.seq`
+          DeepSeq.rnf __field__versions `Prelude.seq` ()
+
+instance Default.Default StoredSchema where
+  def = StoredSchema Default.def Default.def Default.def
+
+instance Hashable.Hashable StoredSchema where
+  hashWithSalt __salt (StoredSchema _schema _predicateIds _versions)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _schema)
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
+              _predicateIds))
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _versions)
+
+data DatabaseIncomplete = DatabaseIncomplete{}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseIncomplete where
+  toJSON DatabaseIncomplete = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DatabaseIncomplete where
+  buildStruct _proxy DatabaseIncomplete = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DatabaseIncomplete)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseIncomplete where
+  rnf DatabaseIncomplete = ()
+
+instance Default.Default DatabaseIncomplete where
+  def = DatabaseIncomplete
+
+instance Hashable.Hashable DatabaseIncomplete where
+  hashWithSalt __salt DatabaseIncomplete = __salt
+
+data DatabaseFinalizing = DatabaseFinalizing{}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DatabaseFinalizing where
+  toJSON DatabaseFinalizing = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DatabaseFinalizing where
+  buildStruct _proxy DatabaseFinalizing = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DatabaseFinalizing)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DatabaseFinalizing where
+  rnf DatabaseFinalizing = ()
+
+instance Default.Default DatabaseFinalizing where
+  def = DatabaseFinalizing
+
+instance Hashable.Hashable DatabaseFinalizing where
+  hashWithSalt __salt DatabaseFinalizing = __salt
+
+data Completeness = Incomplete DatabaseIncomplete
+                  | Complete Glean.DatabaseComplete
+                  | Broken Glean.DatabaseBroken
+                  | Finalizing DatabaseFinalizing
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Completeness where
+  toJSON (Incomplete __incomplete)
+    = Aeson.object ["incomplete" .= __incomplete]
+  toJSON (Complete __complete)
+    = Aeson.object ["complete" .= __complete]
+  toJSON (Broken __broken) = Aeson.object ["broken" .= __broken]
+  toJSON (Finalizing __finalizing)
+    = Aeson.object ["finalizing" .= __finalizing]
+
+instance Thrift.ThriftStruct Completeness where
+  buildStruct _proxy (Incomplete __incomplete)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "incomplete" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __incomplete)]
+  buildStruct _proxy (Complete __complete)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "complete" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __complete)]
+  buildStruct _proxy (Broken __broken)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "broken" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __broken)]
+  buildStruct _proxy (Finalizing __finalizing)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "finalizing" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __finalizing)]
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Incomplete _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Complete _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Broken _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Finalizing _val)
+                                                     _ -> Prelude.fail
+                                                            ("unrecognized alternative for union 'Completeness': "
+                                                               ++ Prelude.show _id)
+           Thrift.FieldEnd -> Prelude.fail "union 'Completeness' is empty"
+    where
+      _idMap
+        = HashMap.fromList
+            [("incomplete", 1), ("complete", 3), ("broken", 4),
+             ("finalizing", 5)]
+
+instance DeepSeq.NFData Completeness where
+  rnf (Incomplete __incomplete) = DeepSeq.rnf __incomplete
+  rnf (Complete __complete) = DeepSeq.rnf __complete
+  rnf (Broken __broken) = DeepSeq.rnf __broken
+  rnf (Finalizing __finalizing) = DeepSeq.rnf __finalizing
+
+instance Default.Default Completeness where
+  def = Incomplete Default.def
+
+instance Hashable.Hashable Completeness where
+  hashWithSalt __salt (Incomplete _incomplete)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _incomplete)
+  hashWithSalt __salt (Complete _complete)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _complete)
+  hashWithSalt __salt (Broken _broken)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _broken)
+  hashWithSalt __salt (Finalizing _finalizing)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _finalizing)
+
+data Meta = Meta{metaVersion :: Glean.ServerConfig.DBVersion,
+                 metaCreated :: Glean.PosixEpochTime,
+                 metaCompleteness :: Completeness,
+                 metaBackup :: Prelude.Maybe Text.Text,
+                 metaProperties :: Glean.DatabaseProperties,
+                 metaDependencies :: Prelude.Maybe Glean.Dependencies,
+                 metaCompletePredicates :: [Glean.PredicateRef],
+                 metaAxiomComplete :: Prelude.Bool,
+                 metaRepoHashTime :: Prelude.Maybe Glean.PosixEpochTime}
+            deriving (Prelude.Eq, Prelude.Show)
+
+instance Aeson.ToJSON Meta where
+  toJSON
+    (Meta __field__metaVersion __field__metaCreated
+       __field__metaCompleteness __field__metaBackup
+       __field__metaProperties __field__metaDependencies
+       __field__metaCompletePredicates __field__metaAxiomComplete
+       __field__metaRepoHashTime)
+    = Aeson.object
+        ("metaVersion" .=
+           Glean.ServerConfig.unDBVersion __field__metaVersion
+           :
+           "metaCreated" .= Glean.unPosixEpochTime __field__metaCreated :
+             "metaCompleteness" .= __field__metaCompleteness :
+               Prelude.maybe Prelude.id ((:) . ("metaBackup" .=))
+                 __field__metaBackup
+                 ("metaProperties" .= __field__metaProperties :
+                    Prelude.maybe Prelude.id ((:) . ("metaDependencies" .=))
+                      __field__metaDependencies
+                      ("metaCompletePredicates" .= __field__metaCompletePredicates :
+                         "metaAxiomComplete" .= __field__metaAxiomComplete :
+                           Prelude.maybe Prelude.id ((:) . ("metaRepoHashTime" .=))
+                             (Prelude.fmap Glean.unPosixEpochTime __field__metaRepoHashTime)
+                             Prelude.mempty)))
+
+instance Thrift.ThriftStruct Meta where
+  buildStruct _proxy
+    (Meta __field__metaVersion __field__metaCreated
+       __field__metaCompleteness __field__metaBackup
+       __field__metaProperties __field__metaDependencies
+       __field__metaCompletePredicates __field__metaAxiomComplete
+       __field__metaRepoHashTime)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "metaVersion" (Thrift.getI64Type _proxy) 1
+           0
+           ((Thrift.genI64 _proxy . Glean.ServerConfig.unDBVersion)
+              __field__metaVersion)
+           :
+           Thrift.genField _proxy "metaCreated" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unPosixEpochTime)
+                __field__metaCreated)
+             :
+             Thrift.genField _proxy "metaCompleteness"
+               (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__metaCompleteness)
+               :
+               let (__cereal__metaBackup, __id__metaBackup)
+                     = case __field__metaBackup of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "metaBackup"
+                                                    (Thrift.getStringType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.genText _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__metaBackup
+                   (Thrift.genField _proxy "metaProperties" (Thrift.getMapType _proxy)
+                      5
+                      __id__metaBackup
+                      ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+                          (Thrift.getStringType _proxy)
+                          Prelude.True
+                          (Thrift.genText _proxy)
+                          (Thrift.genText _proxy)
+                          . HashMap.toList)
+                         __field__metaProperties)
+                      :
+                      let (__cereal__metaDependencies, __id__metaDependencies)
+                            = case __field__metaDependencies of
+                                Prelude.Just _val -> ((:)
+                                                        (Thrift.genField _proxy "metaDependencies"
+                                                           (Thrift.getStructType _proxy)
+                                                           6
+                                                           5
+                                                           (Thrift.buildStruct _proxy _val)),
+                                                      6)
+                                Prelude.Nothing -> (Prelude.id, 5)
+                        in
+                        __cereal__metaDependencies
+                          (Thrift.genField _proxy "metaCompletePredicates"
+                             (Thrift.getListType _proxy)
+                             7
+                             __id__metaDependencies
+                             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                (Thrift.buildStruct _proxy)
+                                __field__metaCompletePredicates)
+                             :
+                             Thrift.genFieldBool _proxy "metaAxiomComplete" 8 7
+                               __field__metaAxiomComplete
+                               :
+                               case __field__metaRepoHashTime of
+                                 Prelude.Just _val -> Thrift.genField _proxy "metaRepoHashTime"
+                                                        (Thrift.getI64Type _proxy)
+                                                        9
+                                                        8
+                                                        ((Thrift.genI64 _proxy .
+                                                            Glean.unPosixEpochTime)
+                                                           _val)
+                                                        : []
+                                 Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__metaVersion <- ST.newSTRef
+                                      (Glean.ServerConfig.DBVersion Default.def)
+            __field__metaCreated <- ST.newSTRef
+                                      (Glean.PosixEpochTime Default.def)
+            __field__metaCompleteness <- ST.newSTRef Default.def
+            __field__metaBackup <- ST.newSTRef Prelude.Nothing
+            __field__metaProperties <- ST.newSTRef HashMap.empty
+            __field__metaDependencies <- ST.newSTRef Prelude.Nothing
+            __field__metaCompletePredicates <- ST.newSTRef Default.def
+            __field__metaAxiomComplete <- ST.newSTRef Prelude.False
+            __field__metaRepoHashTime <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.ServerConfig.DBVersion
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__metaVersion
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__metaCreated
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__metaCompleteness
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__metaBackup
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (HashMap.fromList
+                                                                                      <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__metaProperties
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__metaDependencies
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__metaCompletePredicates
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__metaAxiomComplete
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.PosixEpochTime
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__metaRepoHashTime
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__metaVersion <- ST.readSTRef
+                                                                      __field__metaVersion
+                                             !__val__metaCreated <- ST.readSTRef
+                                                                      __field__metaCreated
+                                             !__val__metaCompleteness <- ST.readSTRef
+                                                                           __field__metaCompleteness
+                                             !__val__metaBackup <- ST.readSTRef __field__metaBackup
+                                             !__val__metaProperties <- ST.readSTRef
+                                                                         __field__metaProperties
+                                             !__val__metaDependencies <- ST.readSTRef
+                                                                           __field__metaDependencies
+                                             !__val__metaCompletePredicates <- ST.readSTRef
+                                                                                 __field__metaCompletePredicates
+                                             !__val__metaAxiomComplete <- ST.readSTRef
+                                                                            __field__metaAxiomComplete
+                                             !__val__metaRepoHashTime <- ST.readSTRef
+                                                                           __field__metaRepoHashTime
+                                             Prelude.pure
+                                               (Meta __val__metaVersion __val__metaCreated
+                                                  __val__metaCompleteness
+                                                  __val__metaBackup
+                                                  __val__metaProperties
+                                                  __val__metaDependencies
+                                                  __val__metaCompletePredicates
+                                                  __val__metaAxiomComplete
+                                                  __val__metaRepoHashTime)
+              _idMap
+                = HashMap.fromList
+                    [("metaVersion", 1), ("metaCreated", 2), ("metaCompleteness", 3),
+                     ("metaBackup", 4), ("metaProperties", 5), ("metaDependencies", 6),
+                     ("metaCompletePredicates", 7), ("metaAxiomComplete", 8),
+                     ("metaRepoHashTime", 9)]
+            _parse 0)
+
+instance DeepSeq.NFData Meta where
+  rnf
+    (Meta __field__metaVersion __field__metaCreated
+       __field__metaCompleteness __field__metaBackup
+       __field__metaProperties __field__metaDependencies
+       __field__metaCompletePredicates __field__metaAxiomComplete
+       __field__metaRepoHashTime)
+    = DeepSeq.rnf __field__metaVersion `Prelude.seq`
+        DeepSeq.rnf __field__metaCreated `Prelude.seq`
+          DeepSeq.rnf __field__metaCompleteness `Prelude.seq`
+            DeepSeq.rnf __field__metaBackup `Prelude.seq`
+              DeepSeq.rnf __field__metaProperties `Prelude.seq`
+                DeepSeq.rnf __field__metaDependencies `Prelude.seq`
+                  DeepSeq.rnf __field__metaCompletePredicates `Prelude.seq`
+                    DeepSeq.rnf __field__metaAxiomComplete `Prelude.seq`
+                      DeepSeq.rnf __field__metaRepoHashTime `Prelude.seq` ()
+
+instance Default.Default Meta where
+  def
+    = Meta (Glean.ServerConfig.DBVersion Default.def)
+        (Glean.PosixEpochTime Default.def)
+        Default.def
+        Prelude.Nothing
+        HashMap.empty
+        Prelude.Nothing
+        Default.def
+        Prelude.False
+        Prelude.Nothing
+
+instance Hashable.Hashable Meta where
+  hashWithSalt __salt
+    (Meta _metaVersion _metaCreated _metaCompleteness _metaBackup
+       _metaProperties _metaDependencies _metaCompletePredicates
+       _metaAxiomComplete _metaRepoHashTime)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _metaVersion)
+                             _metaCreated)
+                          _metaCompleteness)
+                       _metaBackup)
+                    ((List.sort .
+                        Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
+                       _metaProperties))
+                 _metaDependencies)
+              _metaCompletePredicates)
+           _metaAxiomComplete)
+        _metaRepoHashTime
+
+instance Ord.Ord Meta where
+  compare __a __b
+    = case Ord.compare (metaVersion __a) (metaVersion __b) of
+        Ord.LT -> Ord.LT
+        Ord.GT -> Ord.GT
+        Ord.EQ -> case Ord.compare (metaCreated __a) (metaCreated __b) of
+                    Ord.LT -> Ord.LT
+                    Ord.GT -> Ord.GT
+                    Ord.EQ -> case
+                                Ord.compare (metaCompleteness __a) (metaCompleteness __b) of
+                                Ord.LT -> Ord.LT
+                                Ord.GT -> Ord.GT
+                                Ord.EQ -> case Ord.compare (metaBackup __a) (metaBackup __b) of
+                                            Ord.LT -> Ord.LT
+                                            Ord.GT -> Ord.GT
+                                            Ord.EQ -> case
+                                                        Ord.compare
+                                                          ((List.sort .
+                                                              Prelude.map (\ (_k, _v) -> (_k, _v)) .
+                                                                HashMap.toList)
+                                                             (metaProperties __a))
+                                                          ((List.sort .
+                                                              Prelude.map (\ (_k, _v) -> (_k, _v)) .
+                                                                HashMap.toList)
+                                                             (metaProperties __b))
+                                                        of
+                                                        Ord.LT -> Ord.LT
+                                                        Ord.GT -> Ord.GT
+                                                        Ord.EQ -> case
+                                                                    Ord.compare
+                                                                      (metaDependencies __a)
+                                                                      (metaDependencies __b)
+                                                                    of
+                                                                    Ord.LT -> Ord.LT
+                                                                    Ord.GT -> Ord.GT
+                                                                    Ord.EQ -> case
+                                                                                Ord.compare
+                                                                                  (metaCompletePredicates
+                                                                                     __a)
+                                                                                  (metaCompletePredicates
+                                                                                     __b)
+                                                                                of
+                                                                                Ord.LT -> Ord.LT
+                                                                                Ord.GT -> Ord.GT
+                                                                                Ord.EQ -> case
+                                                                                            Ord.compare
+                                                                                              (metaAxiomComplete
+                                                                                                 __a)
+                                                                                              (metaAxiomComplete
+                                                                                                 __b)
+                                                                                            of
+                                                                                            Ord.LT -> Ord.LT
+                                                                                            Ord.GT -> Ord.GT
+                                                                                            Ord.EQ -> Ord.compare
+                                                                                                        (metaRepoHashTime
+                                                                                                           __a)
+                                                                                                        (metaRepoHashTime
+                                                                                                           __b)
+
+data SchemaInstance = SchemaInstance{schemaInstance_versions ::
+                                     Map.Map Text.Text Glean.Version,
+                                     schemaInstance_file :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaInstance where
+  toJSON (SchemaInstance __field__versions __field__file)
+    = Aeson.object
+        ("versions" .= __field__versions :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct SchemaInstance where
+  buildStruct _proxy (SchemaInstance __field__versions __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "versions" (Thrift.getMapType _proxy) 1 0
+           ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+               (Thrift.getI32Type _proxy)
+               Prelude.True
+               (Thrift.genText _proxy)
+               (Thrift.genI32 _proxy)
+               . Map.toList)
+              __field__versions)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStringType _proxy) 3 1
+             (Thrift.genText _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__versions <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef
+                                                                          __field__versions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__versions <- ST.readSTRef
+                                                                   __field__versions
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (SchemaInstance __val__versions __val__file)
+              _idMap = HashMap.fromList [("versions", 1), ("file", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SchemaInstance where
+  rnf (SchemaInstance __field__versions __field__file)
+    = DeepSeq.rnf __field__versions `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default SchemaInstance where
+  def = SchemaInstance Default.def ""
+
+instance Hashable.Hashable SchemaInstance where
+  hashWithSalt __salt (SchemaInstance _versions _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt
+           ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _versions))
+        _file
+
+data SchemaIndex = SchemaIndex{schemaIndex_current ::
+                               SchemaInstance,
+                               schemaIndex_older :: [SchemaInstance]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaIndex where
+  toJSON (SchemaIndex __field__current __field__older)
+    = Aeson.object
+        ("current" .= __field__current :
+           "older" .= __field__older : Prelude.mempty)
+
+instance Thrift.ThriftStruct SchemaIndex where
+  buildStruct _proxy (SchemaIndex __field__current __field__older)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "current" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__current)
+           :
+           Thrift.genField _proxy "older" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__older)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__current <- ST.newSTRef Default.def
+            __field__older <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__current
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__older
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__current <- ST.readSTRef
+                                                                  __field__current
+                                             !__val__older <- ST.readSTRef __field__older
+                                             Prelude.pure (SchemaIndex __val__current __val__older)
+              _idMap = HashMap.fromList [("current", 1), ("older", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SchemaIndex where
+  rnf (SchemaIndex __field__current __field__older)
+    = DeepSeq.rnf __field__current `Prelude.seq`
+        DeepSeq.rnf __field__older `Prelude.seq` ()
+
+instance Default.Default SchemaIndex where
+  def = SchemaIndex Default.def Default.def
+
+instance Hashable.Hashable SchemaIndex where
+  hashWithSalt __salt (SchemaIndex _current _older)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _current)
+        _older
+
+type String_321 = ByteString.ByteString
diff --git a/glean/index/Glean/Indexer.hs b/glean/index/Glean/Indexer.hs
new file mode 100644
--- /dev/null
+++ b/glean/index/Glean/Indexer.hs
@@ -0,0 +1,75 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Indexer
+  ( Indexer(..)
+  , IndexerParams(..)
+  , RunIndexer
+  , indexerWithNoOptions
+  , indexerThen
+  ) where
+
+import Options.Applicative
+
+import Glean
+import Glean.LocalOrRemote
+import Glean.Util.Some
+
+
+-- | An 'Indexer' knows how to index some source code.
+--
+-- Indexers have command-line options, and a function to index the
+-- code specified by the 'TestConfig' using a given 'Env' as a
+-- backend.
+--
+data Indexer opts = Indexer
+  { indexerShortName :: String
+  , indexerDescription :: String
+  , indexerOptParser :: Parser opts
+  , indexerRun :: opts -> RunIndexer
+  }
+
+type RunIndexer = Some LocalOrRemote -> Repo -> IndexerParams -> IO ()
+
+data IndexerParams = IndexerParams
+  { indexerRoot :: FilePath
+    -- ^ path containing source files to index
+  , indexerProjectRoot :: FilePath
+    -- ^ path to the root of the repository
+  , indexerOutput :: FilePath
+    -- ^ Where to put temporary files. The caller will choose whether
+    -- to create a temporary directory, or to use one specified by the
+    -- user in case they want to keep the temporary files for
+    -- debugging purposes.
+  , indexerGroup :: String
+    -- ^ which "group" to use. This is for when we run a set of tests
+    -- in multiple different ways. The interpretation of "group" is up
+    -- to the indexing backend; indexers that don't need to support
+    -- groups can ignore this.
+  } deriving Show
+
+-- | An indexer composed of two separate indexing tasks. The left
+-- indexer is run before the right indexer.  This is useful when we
+-- have a base indexer and we want to add a deriving pass, for
+-- example.
+--
+-- The right indexer doesn't have any options. It's possible to
+-- generalise this, but this more restricted form was found to be more
+-- convenient when used with 'Driver'.
+indexerThen :: Indexer opts -> (opts -> RunIndexer) -> Indexer opts
+indexerThen indexer run2 = indexer
+  { indexerRun = \opts -> indexerRun indexer opts <> run2 opts
+  }
+
+indexerWithNoOptions :: String -> RunIndexer -> Indexer ()
+indexerWithNoOptions name run = Indexer
+  { indexerShortName = name
+  , indexerDescription = name
+  , indexerOptParser = pure ()
+  , indexerRun = const run
+  }
diff --git a/glean/index/Glean/Indexer/External.hs b/glean/index/Glean/Indexer/External.hs
new file mode 100644
--- /dev/null
+++ b/glean/index/Glean/Indexer/External.hs
@@ -0,0 +1,196 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, ApplicativeDo #-}
+
+-- | An 'Indexer' that uses an external process, as opposed to a
+-- library. The indexer might involve running an executable to
+-- generate JSON files and then writing them to the repo using the
+-- 'glean' CLI tool, or it might involve running a server.
+--
+module Glean.Indexer.External
+  ( externalIndexer
+  , Ext(..)
+  , Flavour(..)
+  , sendJsonBatches
+  ) where
+
+import Control.Exception
+import Control.Monad
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import Data.Char(isAlphaNum)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.List.Extra as L
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Options.Applicative as O
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+import System.Process
+
+import Control.Concurrent.Stream (stream)
+import Facebook.Fb303
+import Facebook.Service
+#ifdef FBTHRIFT
+import qualified Thrift.Server.CppServer as ThriftServer
+#else
+import qualified Thrift.Server.HTTP as ThriftServer
+#endif
+
+import qualified Glean
+import qualified Glean.LocalOrRemote as LocalOrRemote
+import Glean.LocalOrRemote (BackendKind(..), LocalOrRemote(..))
+import Glean.Remote (ThriftBackend(..))
+import Glean.Derive
+import qualified Glean.Handler as GleanHandler
+import Glean.Indexer
+import Glean.Write
+import Glean.Util.Service
+
+listDirectoryRecursive :: FilePath -> IO [FilePath]
+listDirectoryRecursive dir = do
+  contents <- listDirectory dir
+  paths <- forM contents $ \name -> do
+      let path = dir </> name
+      isDirectory <- doesDirectoryExist path
+      if isDirectory
+          then listDirectoryRecursive path
+          else return [path]
+  return (concat paths)
+
+externalIndexer :: Indexer Ext
+externalIndexer = Indexer
+  { indexerShortName = "external"
+  , indexerDescription = "A generic indexer that runs an external binary"
+  , indexerOptParser = extOptions
+  , indexerRun = execExternal
+  }
+
+data Flavour = Json | Server
+
+data Ext = Ext
+  { extRunScript :: FilePath
+  , extArgs :: [String]
+  , extFlavour :: Flavour
+  , extDerivePredicates :: [Text]
+  }
+
+extOptions :: O.Parser Ext
+extOptions = do
+  extRunScript <- O.strOption $
+    O.long "binary" <> O.metavar "PATH" <>
+    O.help "script to run to produce facts, arguments supplied by --arg/--args"
+  extArgs <- fmap concat $ O.many $
+    fmap (:[]) (O.strOption $ O.long "arg" <> O.metavar "ARG")
+    O.<|>
+    fmap words (O.strOption $ O.long "args" <> O.metavar "ARGS")
+  extFlavour <-
+    O.flag' Json (
+      O.long "json" <>
+      O.help "the binary should put JSON files in ${JSON_BATCH_DIR}") O.<|>
+    O.flag' Server (
+      O.long "server" <>
+      O.help ("the binary should connect to a Glean server at " <>
+        "${GLEAN_SERVER} to write facts"))
+  extDerivePredicates <-
+    fmap (maybe [] (Text.splitOn "," . Text.pack)) $
+    O.optional $
+    O.strOption $
+    O.long "derive" <> O.metavar "PREDICATE,PREDICATE,..." <>
+    O.help "predicates to derive after writing facts (ordered)"
+  return Ext{..}
+
+-- | Finish decoding parameters from @glean_test@ by
+-- performing substitutions on @TEST_*@ variables, and return the
+-- 'RunIndexer'.
+execExternal :: Ext -> RunIndexer
+execExternal Ext{..} env repo IndexerParams{..} = do index; derive
+  where
+  derive = forM_ extDerivePredicates $ \pred ->
+    derivePredicate env repo Nothing Nothing
+      (parseRef pred) Nothing
+
+  repoName = Text.unpack (Glean.repo_name repo)
+  repoHash = Text.unpack (Glean.repo_hash repo)
+
+  vars = HashMap.fromList
+    [ ("TEST_REPO", Glean.showRepo repo)
+    , ("TEST_REPO_NAME", repoName)
+    , ("TEST_REPO_HASH", repoHash)
+    , ("TEST_ROOT", indexerRoot)
+    ]
+
+  -- We could make this configurable, but there's not a lot to be
+  -- gained and it would have to be plumbed through all the separate
+  -- language indexers that build on External.
+  maxConcurrency = 20 :: Int
+
+  index = case extFlavour of
+    Json -> do
+      jsonBatchDir <- createTempDirectory indexerOutput "glean-json"
+      let jsonVars = HashMap.insert "JSON_BATCH_DIR" jsonBatchDir vars
+      callCommand
+        (unwords (extRunScript : map (quoteArg . subst jsonVars) extArgs))
+      files <- listDirectoryRecursive jsonBatchDir
+      stream maxConcurrency (forM_ files) $ \file -> do
+        (batches, schema_id) <- fileToBatches (jsonBatchDir </> file)
+        let opts = schemaIdToOpts schema_id
+
+        void $ LocalOrRemote.sendJsonBatch env repo batches opts
+
+    Server -> do
+      let
+        go service = do
+          let serverVars = HashMap.insert "GLEAN_SERVER" service vars
+          callCommand
+            (unwords (extRunScript : map (quoteArg . subst serverVars) extArgs))
+      case backendKind env of
+        BackendEnv env -> do
+          fb303 <- newFb303 "gleandriver"
+          let state = GleanHandler.State fb303 env
+          withBackgroundFacebookService
+            (GleanHandler.fb303State state)
+            (GleanHandler.handler state)
+            ThriftServer.defaultOptions
+            $ \server -> go ("localhost:" <>
+                show (ThriftServer.serverPort server))
+        BackendThrift thrift -> do
+          let clientConfig = thriftBackendClientConfig thrift
+          go (serviceToString (Glean.clientConfig_serv clientConfig))
+
+  subst vars ('$':'{':s)
+    | (var,'}':rest) <- break (=='}') s
+    , all (\c -> isAlphaNum c || c == '_') var =
+        HashMap.lookupDefault ("${" <> var <> "}") var vars ++ subst vars rest
+  subst vars (c:s) = c : subst vars s
+  subst _ "" = ""
+
+  -- Quotes a value to allow it to be safely exposed to the shell
+  -- The method used is to replace ' with '"'"' and wrap the value inside
+  -- single quotes. This works for POSIX shells.
+  quoteArg t =  q <> L.intercalate "'\"'\"'" (L.splitOn q t) <> q
+    where
+      q = "'"
+
+
+
+sendJsonBatches
+  :: LocalOrRemote.LocalOrRemote b
+  => b
+  -> Glean.Repo
+  -> String
+  -> Aeson.Value
+  -> IO ()
+sendJsonBatches backend repo msg val = do
+  (batches, schema_id) <- case Aeson.parse parseJsonFactBatches val of
+    Aeson.Error s -> throwIO $ ErrorCall $ msg <> ": " <> s
+    Aeson.Success x -> return x
+  let opts = schemaIdToOpts schema_id
+  void $ LocalOrRemote.sendJsonBatch backend repo batches opts
diff --git a/glean/index/list/Glean/Indexer/List.hs b/glean/index/list/Glean/Indexer/List.hs
new file mode 100644
--- /dev/null
+++ b/glean/index/list/Glean/Indexer/List.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.List (
+    SomeIndexer(..),
+    indexers,
+    cmdLineParser,
+  ) where
+
+import Data.Foldable
+import Options.Applicative
+
+import Util.OptParse
+
+import Glean.Indexer
+import qualified Glean.Indexer.Cpp as Cpp
+import qualified Glean.Indexer.External as External
+import qualified Glean.Indexer.Flow as Flow
+import qualified Glean.Indexer.Hack as Hack
+#ifdef GLEAN_FACEBOOK
+import qualified Glean.Indexer.Buck as Buck
+import qualified Glean.Indexer.Fbthrift as Fbthrift
+import qualified Glean.Indexer.Python as Python
+import qualified Glean.Indexer.Yaml as Yaml
+#endif
+import qualified Glean.Indexer.Go as Go
+import qualified Glean.Indexer.JavaLsif as JavaLsif
+import qualified Glean.Indexer.RustLsif as RustLsif
+import qualified Glean.Indexer.RustScip as RustScip
+import qualified Glean.Indexer.Swift as Swift
+import qualified Glean.Indexer.Typescript as Typescript
+import qualified Glean.Indexer.LSIF as LSIF
+import qualified Glean.Indexer.SCIP as SCIP
+import qualified Glean.Indexer.Haskell as Hs
+import qualified Glean.Indexer.PythonScip as PythonScip
+import qualified Glean.Indexer.DotnetScip as DotnetScip
+
+data SomeIndexer = forall opts . SomeIndexer (Indexer opts)
+
+indexers :: [SomeIndexer]
+indexers =
+  [ SomeIndexer Cpp.indexer
+  , SomeIndexer External.externalIndexer
+  , SomeIndexer Flow.indexer
+  , SomeIndexer Hack.indexer
+#ifdef GLEAN_FACEBOOK
+  , SomeIndexer Buck.indexer
+  , SomeIndexer Fbthrift.indexer
+  , SomeIndexer Python.indexer
+  , SomeIndexer Yaml.indexer
+#endif
+  , SomeIndexer Hs.indexer
+  , SomeIndexer Go.indexer
+  , SomeIndexer JavaLsif.indexer
+  , SomeIndexer LSIF.indexer
+  , SomeIndexer SCIP.indexer
+  , SomeIndexer RustLsif.indexer
+  , SomeIndexer RustScip.indexer
+  , SomeIndexer Swift.indexer
+  , SomeIndexer Typescript.indexer
+  , SomeIndexer PythonScip.indexer
+  , SomeIndexer DotnetScip.indexer
+  ]
+
+cmdLineParser :: Parser RunIndexer
+cmdLineParser = asum langs
+  where
+  langs = flip map indexers $ \(SomeIndexer indexer) ->
+    let desc = indexerDescription indexer in
+    commandParser (indexerShortName indexer) (progDesc desc) $ do
+      opts <- indexerOptParser indexer
+      return (indexerRun indexer opts)
diff --git a/glean/interprocess/cpp/counters.cpp b/glean/interprocess/cpp/counters.cpp
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/counters.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/interprocess/cpp/counters.h"
+#include "glean/interprocess/cpp/counters_ffi.h"
+
+#include <fstream>
+#include <unordered_map>
+
+#include <boost/interprocess/file_mapping.hpp>
+#include <boost/interprocess/mapped_region.hpp>
+
+using namespace facebook::hs;
+
+extern "C" {
+
+struct glean_interprocess_counters_t final
+    : public facebook::glean::interprocess::Counters {
+  boost::interprocess::file_mapping mapping;
+  boost::interprocess::mapped_region region;
+  std::atomic<uint64_t>* counters;
+  size_t size;
+
+  explicit glean_interprocess_counters_t(const char* path, size_t n) {
+    mapping = boost::interprocess::file_mapping(
+        path, boost::interprocess::read_write);
+    region = boost::interprocess::mapped_region(
+        mapping, boost::interprocess::read_write, 0, n * sizeof(uint64_t));
+    counters = static_cast<std::atomic<uint64_t>*>(region.get_address());
+    size = n;
+    assert(std::atomic_is_lock_free(counters));
+  }
+
+  static void create(const char* path, size_t n) {
+    std::vector<uint64_t> contents(n, 0);
+    std::ofstream stream(path, std::ios::out | std::ios::binary);
+    stream.write(
+        reinterpret_cast<const char*>(contents.data()), n * sizeof(uint64_t));
+  }
+
+  std::atomic<uint64_t>* counter(size_t i) override {
+    if (i >= size) {
+      throw std::invalid_argument("counter index out of range");
+    }
+    return counters + i;
+  }
+};
+
+const char* glean_interprocess_counters_create(const char* path, size_t size) {
+  return ffi::wrap([=] { glean_interprocess_counters_t::create(path, size); });
+}
+
+const char* glean_interprocess_counters_open(
+    const char* path,
+    size_t size,
+    glean_interprocess_counters_t** counters) {
+  return ffi::wrap(
+      [=] { *counters = new glean_interprocess_counters_t(path, size); });
+}
+
+void glean_interprocess_counters_close(
+    glean_interprocess_counters_t* counters) {
+  ffi::free_(counters);
+}
+
+const char* glean_interprocess_counters_set(
+    glean_interprocess_counters_t* counters,
+    size_t index,
+    uint64_t value) {
+  return ffi::wrap([=] { counters->counter(index)->store(value); });
+}
+
+const char* glean_interprocess_counters_get(
+    glean_interprocess_counters_t* counters,
+    size_t index,
+    uint64_t* value) {
+  return ffi::wrap([=] { *value = counters->counter(index)->load(); });
+}
+}
+
+namespace facebook::glean::interprocess {
+
+void countersSetup(const std::string& path, size_t size) {
+  glean_interprocess_counters_t::create(path.c_str(), size);
+}
+
+std::unique_ptr<Counters> counters(const std::string& path, size_t size) {
+  return std::make_unique<glean_interprocess_counters_t>(path.c_str(), size);
+}
+
+} // namespace facebook::glean::interprocess
diff --git a/glean/interprocess/cpp/counters.h b/glean/interprocess/cpp/counters.h
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/counters.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <atomic>
+#include <cinttypes>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace facebook::glean::interprocess {
+
+struct Counters {
+  using counter_t = std::atomic<uint64_t>;
+
+  virtual ~Counters() = default;
+  virtual counter_t* counter(size_t index) = 0;
+};
+
+void countersSetup(const std::string& path, size_t count);
+
+std::unique_ptr<Counters> counters(const std::string& path, size_t size);
+
+} // namespace facebook::glean::interprocess
diff --git a/glean/interprocess/cpp/counters_ffi.h b/glean/interprocess/cpp/counters_ffi.h
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/counters_ffi.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <cinttypes>
+#include <cstddef>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct glean_interprocess_counters_t;
+
+const char* glean_interprocess_counters_create(const char* file, size_t size);
+
+const char* glean_interprocess_counters_open(
+    const char* file,
+    size_t size,
+    glean_interprocess_counters_t** counters);
+
+void glean_interprocess_counters_close(glean_interprocess_counters_t* counters);
+
+const char* glean_interprocess_counters_set(
+    glean_interprocess_counters_t* counters,
+    size_t index,
+    uint64_t value);
+
+const char* glean_interprocess_counters_get(
+    glean_interprocess_counters_t* counters,
+    size_t index,
+    uint64_t* value);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/glean/interprocess/cpp/worklist.cpp b/glean/interprocess/cpp/worklist.cpp
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/worklist.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/interprocess/cpp/worklist.h"
+#include "glean/interprocess/cpp/worklist_ffi.h"
+
+#include <atomic>
+#include <fstream>
+
+#include <boost/interprocess/file_mapping.hpp>
+#include <boost/interprocess/mapped_region.hpp>
+
+#ifdef OSS
+#include <glog/logging.h>
+#else
+#include "common/logging/logging.h"
+#endif
+
+// A stealing counter file has the following structure:
+//
+//   uint64    uint32   uint32
+// +--------+--------+--------+-------+------------+------------+
+// |   n    | start0 |  end0  | ..... | start(n-1) |  end(n-1)  |
+// +--------+--------+--------+-------+------------+------------+
+//
+// That is, it starts with a 64 bit word which contains the number of workers
+// and then for each worker there is a pair of (start,end) - the current index
+// and the index at which to stop - which are both 32 bits.
+//
+// We manipulate each such pair as atomic 64-bit values which makes the logic
+// quite simple. In particular, we can atomically increment the 64 bit value
+// to get to the next element.
+//
+// With files, we don't need the size at the beginning, strictly speaking. We
+// will, though, if we switch to shmem objects.
+
+using namespace facebook::hs;
+using namespace facebook::glean;
+
+extern "C" {
+
+struct glean_interprocess_worklist_t {
+  boost::interprocess::file_mapping mapping;
+  boost::interprocess::mapped_region region;
+  std::atomic<uint64_t>* counters;
+  size_t size;
+
+  static worklist::Counter::Value unpack(uint64_t n) {
+    return {static_cast<uint32_t>(n), static_cast<uint32_t>(n >> 32)};
+  }
+
+  static uint64_t pack(worklist::Counter::Value val) {
+    return (uint64_t(val.end) << 32) | val.start;
+  }
+
+  explicit glean_interprocess_worklist_t(const char* path) {
+    mapping = boost::interprocess::file_mapping(
+        path, boost::interprocess::read_write);
+    region = boost::interprocess::mapped_region(
+        mapping, boost::interprocess::read_only, 0, sizeof(uint64_t));
+    size = *static_cast<const uint64_t*>(region.get_address());
+    region = boost::interprocess::mapped_region(
+        mapping,
+        boost::interprocess::read_write,
+        0,
+        sizeof(uint64_t) * (size + 1));
+    counters = static_cast<std::atomic<uint64_t>*>(region.get_address()) + 1;
+    assert(std::atomic_is_lock_free(counters));
+  }
+
+  static void create(
+      const char* path,
+      const std::vector<worklist::Counter::Value>& values) {
+    std::vector<uint64_t> words;
+    words.reserve(values.size() + 1);
+    words.push_back(values.size());
+    for (const auto& value : values) {
+      words.push_back(pack(value));
+    }
+    std::ofstream stream(path, std::ios::out | std::ios::binary);
+    stream.write(
+        reinterpret_cast<const char*>(words.data()),
+        words.size() * sizeof(uint64_t));
+  }
+
+  worklist::Counter::Value get(size_t worker) const noexcept {
+    return unpack(counters[worker].load());
+  }
+
+  std::pair<worklist::Counter::Value, size_t> next(size_t worker) noexcept {
+    auto victim = worker;
+    auto value = unpack(counters[worker].fetch_add(1));
+    if (value.empty()) {
+      // NOTE: We assume that other workers will only steal from us, never give
+      // us things to do.
+      bool done = false;
+
+      // The basic idea is to find the worker with the most work and steal half
+      // of it. We do this in a loop until success because we want a lock-free
+      // algorithm.
+      while (!done) {
+        worklist::Counter::Value other = value;
+
+        // Find the worker with the most work.
+        for (size_t i = (worker + 1) % size; i != worker; i = (i + 1) % size) {
+          auto x = get(i);
+          if (x.size() > other.size()) {
+            other = x;
+            victim = i;
+          }
+        }
+
+        if (!other.empty()) {
+          // If we found a worker which has some work left, steal half of it.
+          uint32_t split = other.start + other.size() / 2;
+          auto expected = pack(other);
+
+          // To steal, just update their start/end pair provided it hasn't
+          // changed. If it has, we'll do the whole thing again.
+          if (counters[victim].compare_exchange_strong(
+                  expected, pack({other.start, split}))) {
+            // We've stolen work, now set our start/end pair. We know it hasn't
+            // changed because we have no more work left so nobody else is going
+            // to update it.
+            value = {split, other.end};
+            counters[worker].store(pack({split + 1, other.end}));
+            done = true;
+          }
+        } else {
+          // Nobody has any work left. We've already set the start/end outputs
+          // when we were fetching our own counter.
+          done = true;
+        }
+      }
+    }
+    return {value, victim};
+  }
+};
+
+const char* glean_interprocess_worklist_create(
+    const char* path,
+    size_t count,
+    const uint32_t* starts,
+    const uint32_t* ends) {
+  return ffi::wrap([=] {
+    std::vector<worklist::Counter::Value> values;
+    values.reserve(count);
+    for (size_t i = 0; i < count; ++i) {
+      values.push_back({starts[i], ends[i]});
+    }
+    glean_interprocess_worklist_t::create(path, values);
+  });
+}
+
+const char* glean_interprocess_worklist_open(
+    const char* path,
+    glean_interprocess_worklist_t** worklist) {
+  return ffi::wrap([=] {
+    auto w = std::make_unique<glean_interprocess_worklist_t>(path);
+    *worklist = w.release();
+  });
+}
+
+void glean_interprocess_worklist_close(
+    glean_interprocess_worklist_t* worklist) {
+  ffi::free_(worklist);
+}
+
+void glean_interprocess_worklist_get(
+    const glean_interprocess_worklist_t* worklist,
+    size_t worker,
+    uint32_t* start,
+    uint32_t* end) {
+  auto value = worklist->get(worker);
+  *start = value.start;
+  *end = value.end;
+}
+
+void glean_interprocess_worklist_next(
+    glean_interprocess_worklist_t* worklist,
+    size_t worker,
+    uint32_t* start,
+    uint32_t* end,
+    size_t* victim) {
+  auto r = worklist->next(worker);
+  *start = r.first.start;
+  *end = r.first.end;
+  *victim = r.second;
+}
+}
+
+namespace facebook::glean::worklist {
+
+namespace {
+
+struct SerialCounter : public Counter {
+  uint32_t start;
+  uint32_t end;
+
+  explicit SerialCounter(uint32_t i, uint32_t e) : start(i), end(e) {}
+
+  folly::Optional<Value> next() override {
+    if (start < end) {
+      auto i = start;
+      ++start;
+      return Value{i, end};
+    } else {
+      return folly::none;
+    }
+  }
+};
+
+struct StealingCounter : public Counter {
+  glean_interprocess_worklist_t worklist;
+  size_t worker;
+
+  StealingCounter(
+      const std::string& path,
+      size_t worker_index,
+      size_t worker_count)
+      : worklist(path.c_str()) {
+    CHECK_EQ(worker_count, worklist.size);
+    worker = worker_index;
+  }
+
+  folly::Optional<Value> next() override {
+    auto r = worklist.next(worker);
+    if (r.second != worker) {
+      LOG(INFO) << worker << ": stole " << r.first.start + 1 << "-"
+                << r.first.end << " from " << r.second;
+    }
+    if (!r.first.empty()) {
+      return r.first;
+    } else {
+      return folly::none;
+    }
+  }
+};
+
+} // namespace
+
+std::unique_ptr<Counter> serialCounter(size_t start, size_t end) {
+  return std::make_unique<SerialCounter>(start, end);
+}
+
+std::unique_ptr<Counter> stealingCounter(
+    const std::string& path,
+    size_t worker_index,
+    size_t worker_count) {
+  return std::make_unique<StealingCounter>(path, worker_index, worker_count);
+}
+
+void stealingCounterSetup(
+    const std::string& path,
+    const std::vector<Counter::Value>& values) {
+  glean_interprocess_worklist_t::create(path.c_str(), values);
+}
+
+} // namespace facebook::glean::worklist
diff --git a/glean/interprocess/cpp/worklist.h b/glean/interprocess/cpp/worklist.h
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/worklist.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <cinttypes>
+#include <vector>
+
+#include <folly/Optional.h>
+
+namespace facebook::glean::worklist {
+
+struct Counter {
+  struct Value {
+    // index of current work item
+    uint32_t start;
+    // index of first work item not in current work block
+    uint32_t end;
+
+    uint32_t size() const {
+      return start < end ? end - start : 0;
+    }
+
+    bool empty() const {
+      return start >= end;
+    }
+
+    bool operator==(const Value& other) const {
+      return start == other.start && end == other.end;
+    }
+
+    bool operator!=(const Value& other) const {
+      return !(*this == other);
+    }
+  };
+
+  /// Returns the next work item to process or none if we are done
+  virtual folly::Optional<Value> next() = 0;
+
+  virtual ~Counter() = default;
+};
+
+/// A Counter which simply returns all items in the range [index,end[ and
+/// then stops.
+std::unique_ptr<Counter> serialCounter(size_t index, size_t end);
+
+/// A work-stealing Counter.
+std::unique_ptr<Counter> stealingCounter(
+    const std::string& path, // path a file initialised via stealingCounterSetup
+    size_t worker_index, // index of current worker
+    size_t worker_count // total number of workers
+);
+
+/// Setup a stealing counter file
+void stealingCounterSetup(
+    const std::string& path,
+    const std::vector<Counter::Value>& values);
+
+} // namespace facebook::glean::worklist
diff --git a/glean/interprocess/cpp/worklist_ffi.h b/glean/interprocess/cpp/worklist_ffi.h
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/cpp/worklist_ffi.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <cinttypes>
+#include <cstddef>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct glean_interprocess_worklist_t;
+
+const char* glean_interprocess_worklist_create(
+    const char* file,
+    size_t count,
+    const uint32_t* indices,
+    const uint32_t* sizes);
+
+const char* glean_interprocess_worklist_open(
+    const char* file,
+    glean_interprocess_worklist_t** worklist);
+
+void glean_interprocess_worklist_close(glean_interprocess_worklist_t* worklist);
+
+void glean_interprocess_worklist_get(
+    const glean_interprocess_worklist_t* worklist,
+    size_t worker,
+    uint32_t* start,
+    uint32_t* end);
+
+void glean_interprocess_worklist_next(
+    glean_interprocess_worklist_t* worklist,
+    size_t worker,
+    uint32_t* start,
+    uint32_t* end,
+    size_t* victim);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/glean/interprocess/hs/Glean/Interprocess/Counters.hs b/glean/interprocess/hs/Glean/Interprocess/Counters.hs
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/hs/Glean/Interprocess/Counters.hs
@@ -0,0 +1,58 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Interprocess.Counters (
+  Counters, withTemp, get, set
+) where
+
+import Util.FFI (invoke)
+
+import Control.Exception (bracket)
+import Data.Word (Word64)
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr (Ptr)
+import Foreign.Storable (Storable)
+import System.IO (hClose)
+import System.IO.Temp (withSystemTempFile)
+
+newtype Counters = Counters (Ptr Counters)
+  deriving(Storable)
+
+withTemp :: Int -> (FilePath -> Counters -> IO a) -> IO a
+withTemp n f = withSystemTempFile ".glean-counters" $ \path h -> do
+  hClose h
+  withCString path $ \cpath -> do
+    invoke $ glean_interprocess_counters_create
+      cpath
+      (fromIntegral n)
+    bracket
+      (invoke $ glean_interprocess_counters_open cpath $ fromIntegral n)
+      glean_interprocess_counters_close
+      (f path)
+
+get :: Counters -> Int -> IO Word64
+get c i = invoke $ glean_interprocess_counters_get c (fromIntegral i)
+
+set :: Counters -> Int -> Word64 -> IO ()
+set c i x = invoke $ glean_interprocess_counters_set c (fromIntegral i) x
+
+foreign import ccall unsafe glean_interprocess_counters_create
+  :: CString -> CSize -> IO CString
+
+foreign import ccall unsafe glean_interprocess_counters_open
+  :: CString -> CSize -> Ptr Counters -> IO CString
+
+foreign import ccall unsafe glean_interprocess_counters_close
+  :: Counters -> IO ()
+
+foreign import ccall unsafe glean_interprocess_counters_get
+  :: Counters -> CSize -> Ptr Word64 -> IO CString
+
+foreign import ccall unsafe glean_interprocess_counters_set
+  :: Counters -> CSize -> Word64 -> IO CString
diff --git a/glean/interprocess/hs/Glean/Interprocess/Worklist.hs b/glean/interprocess/hs/Glean/Interprocess/Worklist.hs
new file mode 100644
--- /dev/null
+++ b/glean/interprocess/hs/Glean/Interprocess/Worklist.hs
@@ -0,0 +1,92 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Interprocess.Worklist
+  ( Worker, Worklist, Range(..), withTemp, get, next, peek, doNext
+  ) where
+
+import Util.FFI (invoke)
+
+import Control.Exception (bracket)
+import Data.Word (Word32)
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Marshal.Array
+import Foreign.Ptr (Ptr)
+import Foreign.Storable (Storable)
+import System.IO (hClose)
+import System.IO.Temp (withSystemTempFile)
+
+newtype Worklist = Worklist (Ptr Worklist)
+  deriving(Storable)
+
+data Range = Range
+  { rangeStart :: {-# UNPACK #-} !Int
+  , rangeEnd   :: {-# UNPACK #-} !Int
+  }
+  deriving(Eq,Ord,Show)
+
+mkRange :: Word32 -> Word32 -> Range
+mkRange start end = Range (fromIntegral start) (fromIntegral end)
+
+withTemp :: [Range] -> (FilePath -> Worklist -> IO a) -> IO a
+withTemp xs f = withSystemTempFile ".glean-worklist" $ \path h -> do
+  hClose h
+  withCString path $ \cpath -> do
+    withArray (map (fromIntegral . rangeStart) xs) $ \starts ->
+      withArray (map (fromIntegral . rangeEnd) xs) $ \ends ->
+        invoke $ glean_interprocess_worklist_create
+          cpath
+          (fromIntegral $ length xs)
+          starts
+          ends
+    bracket
+      (invoke $ glean_interprocess_worklist_open cpath)
+      glean_interprocess_worklist_close
+      (f path)
+
+type Worker = Int
+
+get :: Worklist -> Worker -> IO Range
+get w i = fmap (uncurry mkRange) $
+  invoke $ glean_interprocess_worklist_get w $ fromIntegral i
+
+next :: Worklist -> Worker -> IO (Range, Worker)
+next w i = do
+  (start,end,victim) <-
+    invoke $ glean_interprocess_worklist_next w $ fromIntegral i
+  return (mkRange start end, fromIntegral victim)
+
+withWorkfile
+  :: (Worklist -> Worker -> IO a)
+  -> FilePath -> Worker -> IO a
+withWorkfile op workfile w = withCString workfile $ \ cpath -> bracket
+  (invoke $ glean_interprocess_worklist_open cpath)
+  glean_interprocess_worklist_close
+  (`op` w)
+
+doNext :: FilePath -> Worker -> IO (Range, Worker)
+doNext w = withWorkfile next w
+
+peek :: FilePath -> Worker -> IO Range
+peek w = withWorkfile get w
+
+foreign import ccall unsafe glean_interprocess_worklist_create
+  :: CString -> CSize -> Ptr Word32 -> Ptr Word32 -> IO CString
+
+foreign import ccall unsafe glean_interprocess_worklist_open
+  :: CString -> Ptr Worklist -> IO CString
+
+foreign import ccall unsafe glean_interprocess_worklist_close
+  :: Worklist -> IO ()
+
+foreign import ccall unsafe glean_interprocess_worklist_get
+  :: Worklist -> CSize -> Ptr Word32 -> Ptr Word32 -> IO ()
+
+foreign import ccall unsafe glean_interprocess_worklist_next
+  :: Worklist -> CSize -> Ptr Word32 -> Ptr Word32 -> Ptr CSize -> IO ()
diff --git a/glean/lang/clang/Derive/Common.hs b/glean/lang/clang/Derive/Common.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/Common.hs
@@ -0,0 +1,168 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module Derive.Common
+  ( getFileXRefsFor
+  , getIndirectTargets
+  , resolve
+  , Indirects
+  , XRefs
+  , emptyBatch
+  , batchingYield
+  ) where
+
+import Control.Monad
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.Maybe
+import qualified Data.Vector as V
+import qualified Data.Vector.Mutable as VM
+
+import Util.List
+
+import Glean
+import Glean.Angle
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.PredMap (PredMap)
+import qualified Glean.Util.PredMap as PredMap
+import Glean.Util.PredSet (PredSet)
+import qualified Glean.Util.PredSet as PredSet
+
+import Derive.Types
+
+-- | Keys are xRefIndirectTarget_id, values are xRefIndirectTarget_key_target
+-- Note: XRefTarget_indirect constructor does not appear in these values
+type Indirects = PredMap Cxx.XRefIndirectTarget Cxx.XRefTarget
+
+-- Keys are fileXRefMap_id, values are sets of targets for each external target
+-- in the map.
+type XRefs =
+  PredMap
+    Cxx.FileXRefMap
+    (PredSet Cxx.FileXRefs, V.Vector (HashSet Cxx.XRefTarget))
+
+type MutableXRefs =
+  PredMap
+    Cxx.FileXRefMap
+    (PredSet Cxx.FileXRefs, VM.IOVector (HashSet Cxx.XRefTarget))
+
+getIndirectTargets
+  :: Backend e => e -> Config -> IO Indirects
+getIndirectTargets e cfg = do
+
+  let q = maybe id limit (cfgMaxQueryFacts cfg) $
+        limitBytes (cfgMaxQuerySize cfg) allFacts
+
+  -- Build indirect map that is 1-level deep.  Chains of indirections not
+  -- yet resolved so the values may be XRefTarget_indirect.
+  targets <- runQueryEach e (cfgRepo cfg) q mempty $ \targets fact -> do
+    return $ PredMap.insert
+      (getId fact)
+      (Cxx.xRefIndirectTarget_key_target $ fromJust $ getFactKey fact)
+      targets
+
+  let -- Use 'targets' to resolve chains of indirections to resolve
+      -- (or remove) all XRefTarget_indirect constructors.
+      squash (Cxx.XRefTarget_indirect x)
+        | Just next <- PredMap.lookup (getId x) targets = squash next
+        | otherwise = Nothing -- shouldn't happen
+      squash x = Just x
+
+  return $ PredMap.mapMaybe squash targets
+
+-- | The result never has XRefTarget_indirect constructor
+resolve :: Indirects -> Cxx.XRefTarget -> Maybe Cxx.XRefTarget
+resolve indirects (Cxx.XRefTarget_indirect x) =
+  PredMap.lookup (getId x) indirects
+resolve _ x = Just x
+
+getFileXRefsFor
+  :: Backend e
+  => e
+  -> [IdOf Cxx.FileXRefMap]
+  -> Config
+  -> IO XRefs
+getFileXRefsFor _ [] _ = return PredMap.empty
+getFileXRefsFor e xmapIds cfg = do
+  let
+    q :: Query Cxx.FileXRefs
+    q = limitBytes (cfgMaxQuerySize cfg) $
+          expanding @Cxx.XRefTargets $
+          query $
+          vars $ \(xmap :: Angle Cxx.FileXRefMap) xrefs ->
+            xrefs `where_` [
+              xmap .= elementsOf (factIdsArray xmapIds),
+              xrefs .= (predicate @Cxx.FileXRefs $ rec $
+                field @"xmap" (asPredicate xmap) end)
+            ]
+
+  (_, xrefs) <- runQueryEachBatch e (cfgRepo cfg) q (mempty, mempty)
+    withFileXRefs
+  traverse (\(deps, xs) -> (deps,) <$> V.unsafeFreeze xs) xrefs
+
+  where
+  withFileXRefs
+    :: (PredMap Cxx.XRefTargets (HashSet Cxx.XRefTarget), MutableXRefs)
+    -> [Cxx.FileXRefs]
+    -> IO (PredMap Cxx.XRefTargets (HashSet Cxx.XRefTarget), MutableXRefs)
+  withFileXRefs (oldTargetMap, xrefs) fileXRefs = do
+    let
+      newTargets = uniq
+          [ t
+          | Cxx.FileXRefs _ (Just (Cxx.FileXRefs_key _ targets)) <- fileXRefs
+          , t <- targets
+          , not (getId t `PredMap.member` oldTargetMap)
+          ]
+
+      newTargetMap = PredMap.fromList
+          [ (IdOf $ Fid i, HashSet.fromList k)
+          | Cxx.XRefTargets i (Just k) <- newTargets
+          ]
+
+      targetMap = PredMap.union newTargetMap oldTargetMap
+
+    let
+      add xrefs (Cxx.FileXRefs i (Just (Cxx.FileXRefs_key xmap targetIds))) = do
+        let !id = getId xmap
+            targets = [ key | t <- targetIds,
+              Just key <- [PredMap.lookup (getId t) targetMap]]
+        case PredMap.lookup id xrefs of
+          Just (deps, xs) -> do
+            forM_ (zip [0 .. VM.length xs - 1] targets) $ \(i, ts) -> do
+              x <- VM.unsafeRead xs i
+              VM.unsafeWrite xs i $! HashSet.union ts x
+            let !newDeps = PredSet.insert (IdOf $ Fid i) deps
+            return $ PredMap.insert id (newDeps, xs) xrefs
+          Nothing -> do
+            xs <- VM.new (length targets)
+            forM_ (zip [0..] targets) $ \(i, ts) ->
+              VM.unsafeWrite xs i ts
+            return $
+              PredMap.insert id (PredSet.singleton (IdOf $ Fid i), xs) xrefs
+      add xrefs _ = return xrefs
+
+    newXrefs <- foldM add xrefs fileXRefs
+    return (targetMap, newXrefs)
+
+-- -----------------------------------------------------------------------------
+-- Batching utils
+
+emptyBatch :: (Int, [a])
+emptyBatch = (0, [])
+
+batchingYield
+  :: Int  -- batch size
+  -> ([a] -> IO ())  -- yield a complete batch
+  -> Int -- size of item
+  -> a -- item
+  -> (Int, [a]) -- current accumuulated batch
+  -> IO (Int, [a]) -- new accumulated batch
+batchingYield batchSize yield n item (size, batch)
+  | size+n >= batchSize = do yield (item:batch); return emptyBatch
+  | otherwise = return (size+n, item:batch)
diff --git a/glean/lang/clang/Derive/CxxDeclarationSources.hs b/glean/lang/clang/Derive/CxxDeclarationSources.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/CxxDeclarationSources.hs
@@ -0,0 +1,163 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo, TypeApplications #-}
+-- | Reversing DeclarationTargets into DeclarationSources
+--
+-- * Load the DeclarationTargets which hold (source, [target])
+--   into vector of (target, source)
+--
+-- * Sort them by target
+--
+-- * Group them by target
+--
+-- * convert the group into (target, [source])
+--
+-- * Make this into DeclarationSources facts
+--
+-- * chunk the facts and write to Glean
+module Derive.CxxDeclarationSources
+  ( deriveCxxDeclarationSources
+  ) where
+
+import Data.Int (Int64)
+import qualified Data.Vector.Algorithms.Intro as VSort
+import qualified Data.Vector.Unboxed as VU
+import qualified Data.Vector.Unboxed.Mutable as VUM
+import Data.Word (Word8)
+import Util.Log (logInfo)
+
+import Glean
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.Declarations (getDeclId)
+import qualified Glean.Util.ValueBuffer as Buffer
+
+import Derive.Types
+
+-- -----------------------------------------------------------------------------
+
+-- | This represents which 'Cxx.Declaration' constructor is being
+-- used.  This means we will not depend on each predicate
+-- having a non-overlapping space of fact Ids.
+type DeclTag x = x
+
+-- | Get the branch index.
+toDeclTag :: Cxx.Declaration -> DeclTag Word8
+toDeclTag = \case
+  Cxx.Declaration_namespace_{} -> 0
+  Cxx.Declaration_usingDeclaration{} -> 1
+  Cxx.Declaration_usingDirective{} -> 2
+  Cxx.Declaration_record_{} -> 3
+  Cxx.Declaration_enum_{} -> 4
+  Cxx.Declaration_function_{} -> 5
+  Cxx.Declaration_variable{} -> 6
+  Cxx.Declaration_objcContainer{} -> 7
+  Cxx.Declaration_objcMethod{} -> 8
+  Cxx.Declaration_objcProperty{} -> 9
+  Cxx.Declaration_typeAlias{} -> 10
+  Cxx.Declaration_namespaceAlias{} -> 11
+  Cxx.Declaration_EMPTY -> error "unknown Cxx.Declaration"
+
+-- | Reconstruct the 'Cxx.Declaration' from the branch index (creatged by
+-- 'toDeclTag') and the fact id.
+fromDeclTag :: DeclTag Word8 -> Int64 -> Cxx.Declaration
+fromDeclTag n i = case n of
+  0 -> Cxx.Declaration_namespace_ $! justId (IdOf (Fid i))
+  1 -> Cxx.Declaration_usingDeclaration $! justId (IdOf (Fid i))
+  2 -> Cxx.Declaration_usingDirective $! justId (IdOf (Fid i))
+  3 -> Cxx.Declaration_record_ $! justId (IdOf (Fid i))
+  4 -> Cxx.Declaration_enum_ $! justId (IdOf (Fid i))
+  5 -> Cxx.Declaration_function_ $! justId (IdOf (Fid i))
+  6 -> Cxx.Declaration_variable $! justId (IdOf (Fid i))
+  7 -> Cxx.Declaration_objcContainer $! justId (IdOf (Fid i))
+  8 -> Cxx.Declaration_objcMethod $! justId (IdOf (Fid i))
+  9 -> Cxx.Declaration_objcProperty $! justId (IdOf (Fid i))
+  10 -> Cxx.Declaration_typeAlias $! justId (IdOf (Fid i))
+  11 -> Cxx.Declaration_namespaceAlias $! justId (IdOf (Fid i))
+  _ -> error "impossible fromDeclTag"
+
+-- | Decompose the declaration into pieces, and it can be
+--reconstructed by 'fromDecN'
+fromDecl :: Cxx.Declaration -> (DeclTag Word8, Int64)
+fromDecl d =  (toDeclTag d, getDeclId d)
+
+-- | Represent an edge from target to source. Put the target's Id
+-- first so that sorting will only need the first component of
+-- the tuple.
+--
+-- > (targetId, targetTag, sourceId, sourceTag)
+type TargetSource = (Int64, DeclTag Word8, Int64, DeclTag Word8)
+
+type TargetSourcesBuffer = Buffer.IOBuffer VU.Vector TargetSource
+
+type TargetSourcesM = VUM.IOVector TargetSource
+
+type TargetSources = VU.Vector TargetSource
+
+-- | Start with a small 'ValueBuffer', it will grow by doubling as needed.
+initialSize :: Int
+initialSize = 2^(10 :: Int)
+
+-- -----------------------------------------------------------------------------
+
+addDeclarationTarget
+  :: TargetSourcesBuffer
+  -> ()
+  -> Cxx.DeclarationTargets_key
+  -> IO ()
+addDeclarationTarget buffer () Cxx.DeclarationTargets_key{..} =
+  mapM_ (Buffer.push buffer)
+    [ (targetId, targetTag, sourceId, sourceTag)
+    | let (sourceTag, sourceId) = fromDecl declarationTargets_key_source
+    , target <- declarationTargets_key_targets
+    , let (targetTag, targetId) = fromDecl target ]
+
+-- | Create lazy list of facts to write
+toDeclarationSources :: TargetSources -> [Cxx.DeclarationSources_key]
+toDeclarationSources = loop
+  where
+    loop v | VU.null v = []
+           | otherwise =
+      let front = VU.head v  -- head is safe due to null check above
+          (matching, next) = VU.span (eqTarget front) v
+          this = Cxx.DeclarationSources_key
+            { declarationSources_key_target = targetOf front
+            , declarationSources_key_sources =
+              map sourceOf (VU.toList matching) }
+      in this : loop next
+
+    eqTarget (x1, x2, _, _) (y1, y2, _, _) = x1 == y1 && x2 == y2
+    targetOf (targetId, targetTag, _, _) = fromDeclTag targetTag targetId
+    sourceOf (_, _, sourceId, sourceTag) = fromDeclTag sourceTag sourceId
+
+-- | Write all the 'Cxx.DeclarationSources' facts to Glean
+writeDeclSources :: Writer -> TargetSources -> IO ()
+writeDeclSources writer targetSources = do
+  logInfo "writeDeclSources"
+  mapM_ (\f -> writeFacts writer (makeFact_ @Cxx.DeclarationSources f))
+    (toDeclarationSources targetSources)
+  logInfo "writeDeclSources done"
+
+deriveCxxDeclarationSources :: Backend e => e -> Config -> Writer -> IO ()
+deriveCxxDeclarationSources e cfg writer = do
+  logInfo "deriveCxxDeclarationSources"
+  let
+    q :: Query Cxx.DeclarationTargets_key
+    q = keys $ maybe id limit (cfgMaxQueryFacts cfg) $
+      limitBytes (cfgMaxQuerySize cfg)
+      (allFacts :: Query Cxx.DeclarationTargets)
+  (targetSourcesM :: TargetSourcesM) <- do
+    (buffer :: TargetSourcesBuffer) <- Buffer.new initialSize
+    runQueryEach e (cfgRepo cfg) q () (addDeclarationTarget buffer)
+    Buffer.get buffer
+  logInfo "query complete, got targetSourcesM"
+  VSort.sort targetSourcesM
+  logInfo "sorted targetSourcesM"
+  (targetSources :: TargetSources) <- VU.unsafeFreeze targetSourcesM
+  writeDeclSources writer (VU.uniq targetSources)
+  logInfo "deriveCxxDeclarationSources done"
diff --git a/glean/lang/clang/Derive/CxxSame.hs b/glean/lang/clang/Derive/CxxSame.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/CxxSame.hs
@@ -0,0 +1,127 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo, PartialTypeSignatures, TypeApplications #-}
+{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
+module Derive.CxxSame
+  ( deriveSame
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.Coerce
+import Data.Int
+import qualified Data.IntMap.Strict as IntMap
+import Data.Graph as Graph
+import Data.Proxy
+import Data.Tree as Tree
+
+import Util.Log (logInfo)
+
+import Glean
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.Declarations (getDeclId)
+import Glean.Util.PredSet (PredSet)
+import qualified Glean.Util.PredSet as PredSet
+
+import Derive.Types
+
+-- -----------------------------------------------------------------------------
+
+{- |
+Derive Cxx.DeclFamily predicates from Cxx.Same predicates.
+
+The indexer produces Cxx.Same predicates which indicates that two
+declarations refer to the same underlying entity. Typically this
+expresses the connection between a declaration and a definition,
+but there may in general be many declarations for the same
+definition, and even multiple definitions.
+
+The Cxx.Same edges produced by the indexer are not transitively
+closed. We want to find the components of the graph represented by the
+cxx.Same edges, and produce:
+
+  predicate DeclFamily : [Declaration]
+
+  predicate DeclToFamily :
+    {
+      decl : Declaration,
+      family : DeclFamily,
+    }
+
+The basic algorithm is:
+* For each @Cxx.Same d1 d2@,
+  * add @d1->d2@ to the graph
+  * find the components of this graph (/O(n)/)
+  * each component is a @Cxx.DeclFamily@
+* For each @Cxx.DeclFamily@
+  * Emit a @Cxx.DeclToFamily@ predicate for each decl in the family
+-}
+deriveSame :: Backend e => e -> Config -> Writer -> IO ()
+deriveSame e cfg writer = do
+  logInfo "deriveSame"
+
+  let
+    q :: Query Cxx.Same
+    q = maybe id limit (cfgMaxQueryFacts cfg) $
+       limitBytes (cfgMaxQuerySize cfg) allFacts
+
+  -- The nodes and edges are IntMap because 'getDeclId' is not a single
+  -- predicate type.  We cannot use PredMap here.
+  (nodes,edges) <- runQueryEachBatch e (cfgRepo cfg) q (mempty, mempty)
+    $ \(nodes,edges) bs -> do
+    let
+      procSame (nodes, edges)
+        (Cxx.Same fid (Just (Cxx.Same_key decl1 decl2))) = do
+        let
+          d1 = getDeclId decl1
+          d2 = getDeclId decl2
+          id = coerce fid :: IdOf Cxx.Same
+          one_id = PredSet.singleton id
+          ins (decl, set) _ = (decl, PredSet.insert id set)
+          !nodes' =
+            IntMap.insertWith ins (fromIntegral d1) (decl1, one_id) $
+            IntMap.insertWith ins (fromIntegral d2) (decl2, one_id) nodes
+          !edges' = IntMap.insertWith (const (d2:)) (fromIntegral d1) [d2] edges
+        return (nodes',edges')
+      procSame _ _ = throwIO $ ErrorCall "internal error: procSame"
+
+    foldM procSame (nodes,edges) bs
+
+  let
+    adjacencyList :: [((Cxx.Declaration, PredSet Cxx.Same), Int64, [Int64])]
+    adjacencyList =
+      [ (decl, fromIntegral n, IntMap.findWithDefault [] n edges)
+      | (n,decl) <- IntMap.toList nodes ]
+
+    (theGraph, fromVertex, _) = Graph.graphFromEdges adjacencyList
+
+    fromVs :: [Graph.Vertex] -> ([Cxx.Declaration], PredSet Cxx.Same)
+    fromVs vs = (ds, foldr PredSet.union mempty sets)
+      where
+      (ds, sets) = unzip [ d | v <- vs, let (d, _, _) = fromVertex v ]
+
+    generateFamilies :: [([Cxx.Declaration], PredSet Cxx.Same)] -> IO ()
+    generateFamilies groups =
+      writeFacts writer $
+        forM_ groups $ \(group, sames) -> do
+          let sources = coerce $ PredSet.toList sames
+          fam <- makeFact @Cxx.DeclFamily group
+          tos <- forM group $ \decl ->
+            makeFact @Cxx.DeclToFamily $ Cxx.DeclToFamily_key decl fam
+          derivedFrom sources [fam]
+          derivedFrom sources tos
+
+  generateFamilies $ map (fromVs . Tree.flatten) $ Graph.components theGraph
+
+  completePredicates e (cfgRepo cfg) $
+    CompletePredicates_derived $ CompleteDerivedPredicate $
+      getName (Proxy @Cxx.DeclFamily)
+  completePredicates e (cfgRepo cfg) $
+    CompletePredicates_derived $ CompleteDerivedPredicate $
+      getName (Proxy @Cxx.DeclToFamily)
diff --git a/glean/lang/clang/Derive/CxxTargetUses.hs b/glean/lang/clang/Derive/CxxTargetUses.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/CxxTargetUses.hs
@@ -0,0 +1,177 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE PartialTypeSignatures, TypeApplications #-}
+{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
+module Derive.CxxTargetUses
+  ( deriveUses
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.Coerce
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import Data.Maybe
+import Data.Proxy
+import qualified Data.Set as Set
+import qualified Data.Vector as V
+
+import Control.Concurrent.Stream (streamWithState)
+import Util.Log (logInfo)
+
+import Glean
+import Glean.Angle
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Util.PredMap as PredMap
+import qualified Glean.Util.PredSet as PredSet
+import Glean.Util.Range
+
+import Derive.Common
+import Derive.Types
+
+data Ranges = Ranges
+  { ranges     :: !(Set.Set ByteRange)
+  , expansions :: !(Set.Set ByteRange)
+  , spellings  :: !(Set.Set ByteRange)
+  }
+
+instance Semigroup Ranges where
+  (Ranges r e s) <> (Ranges r' e' s') = Ranges (r <> r') (e <> e') (s <> s')
+
+instance Monoid Ranges where
+  mempty = Ranges Set.empty Set.empty Set.empty
+  mappend = (<>)
+
+type Uses = HashMap.HashMap Cxx.XRefTarget Ranges
+
+addUses :: Indirects -> (Cxx.XRefTarget, Cxx.From) -> Uses -> Uses
+addUses indirects (target, Cxx.From{..})
+  | Just direct <- resolve indirects target = HashMap.insertWith
+      (<>)
+      direct
+      mempty
+        { ranges = spansToRanges from_spans
+        , expansions = spansToRanges from_expansions
+        , spellings = spansToRanges from_spellings
+        }
+  | otherwise = id
+  where spansToRanges = Set.fromList . packedByteSpansToRanges
+
+deriveUses
+  :: Backend e
+  => e
+  -> Config
+  -> (Int -> ([Writer] -> IO ()) -> IO ())
+  -> IO ()
+
+deriveUses e cfg withWriters = do
+  logInfo $ "deriveUses" <> if cfgIncremental cfg then " (incremental)" else ""
+  indirects <- getIndirectTargets e cfg
+    -- There are usually not many indirect targets, so we can get away
+    -- without doing anything special in incremental mode for
+    -- getIndirectTargets.
+  logInfo $ "loaded " ++ show (PredMap.size indirects) ++ " indirect targets"
+
+  let generateUses
+        :: Writer
+        -> Maybe Src.File
+        -> [IdOf Cxx.FileXRefs]
+        -> Uses
+        -> IO ()
+      generateUses writer (Just file) deps uses = do
+        when (not $ cfgDryRun cfg) $ writeFacts writer $ do
+          facts <- forM (HashMap.toList uses) $ \(target, Ranges{..}) -> do
+            let rangesToSpans = rangesToPackedByteSpans . Set.toList
+            makeFact @Cxx.TargetUses Cxx.TargetUses_key
+              { targetUses_key_target = target
+              , targetUses_key_file = file
+              , targetUses_key_from = Cxx.From (rangesToSpans ranges)
+                                               (rangesToSpans expansions)
+                                               (rangesToSpans spellings)
+              }
+          when (not (null deps)) $ derivedFrom (coerce deps) facts
+
+      generateUses _ _ _ _ = return ()
+
+      ifIncremental f = if cfgIncremental cfg then f else id
+
+      -- NOTE: We rely on the ordering property of the `allFacts` query.
+      --       Specifically, we expect to encounter `FileXRefMap`s for
+      --       a single file in a single sequence.
+      -- NOTE (incremental):
+      --   what's the rationale for only processing the new FileXRefMaps?
+      --   Provided we did the fanout correctly, this will include all
+      --   FileXRefMaps corresponding to files that have changed.
+      q :: Query Cxx.FileXRefMap
+      q = maybe id limit (cfgMaxQueryFacts cfg) $
+          limitBytes (cfgMaxQuerySize cfg) $ query $ ifIncremental new $
+            predicate @Cxx.FileXRefMap wild
+
+      -- The dependencies we record for each cxx.TargetUses fact are
+      -- the set of cxx.FileXRefs used to generate it. The other
+      -- facts that we touch are reachable from the FileXRefs:
+      --   - cxx.FileXRefMap is pointed to by FileXRefs
+      --   - cxx.XRefIndirectTarget is pointed to by FileXRefMap
+      --
+      -- Note that this is not strictly accurate. Each TargetUses fact
+      -- is actually derived from some subset of the FileXRefs facts
+      -- that we saw, since not all FileXRefs have the same
+      -- targets. But since we will never hide just a subset of the
+      -- FileXRef facts (if we fully index the fanout) widening the
+      -- ownership like this is safe and more efficient because we
+      -- generate fewer ownership sets.
+
+  let
+    producer yield = do
+      let item = batchingYield (cfgBatchSize cfg) yield
+      (file, final_facts, batch) <-
+        runQueryEach e (cfgRepo cfg) q (Nothing, [], emptyBatch)
+          $ \(last_file, facts, batch) fact@(Cxx.FileXRefMap _ k) -> do
+            key <- case k of
+              Just k -> return k
+              Nothing -> throwIO $ ErrorCall "internal error: deriveUses"
+            let file = Just $ Cxx.fileXRefMap_key_file key
+            if last_file == file
+              then return (file, fact:facts, batch)
+              else do
+                batch <- item (length facts) (last_file, facts) batch
+                return (file, [fact], batch)
+      yield ([(file, final_facts) | isJust file] <> snd batch)
+
+    worker writer files = do
+      fileXRefs <- getFileXRefsFor e (map getId (concatMap snd files)) cfg
+      forM_ files $ \(file, facts) -> do
+        let
+          (deps, uses) = foldr f (mempty, HashMap.empty) facts
+          f (Cxx.FileXRefMap i (Just key)) (deps, uses) =
+            (new_deps, new_uses)
+            where
+              !new_deps = PredSet.toList these_deps <> deps
+              (these_deps, map_targets) =
+                case PredMap.lookup (IdOf $ Fid i) fileXRefs of
+                  Nothing -> (PredSet.empty, mempty)
+                  Just x -> x
+              !new_uses = foldr (addUses indirects) uses $
+                [ (target, from)
+                | Cxx.FixedXRef target from <- Cxx.fileXRefMap_key_fixed key ]
+                ++
+                [ (target, from)
+                | (targets, from) <-
+                    zip (V.toList map_targets) (Cxx.fileXRefMap_key_froms key)
+                , target <- HashSet.toList targets ]
+          f _ x = x
+        generateUses writer file deps uses
+
+  withWriters (cfgWorkerThreads cfg) $ \writers ->
+    streamWithState producer writers worker
+
+  completePredicates e (cfgRepo cfg) $
+    CompletePredicates_derived $ CompleteDerivedPredicate $
+      getName (Proxy @Cxx.TargetUses)
diff --git a/glean/lang/clang/Derive/Env.hs b/glean/lang/clang/Derive/Env.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/Env.hs
@@ -0,0 +1,59 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE AllowAmbiguousTypes #-}
+module Derive.Env
+  ( Env(..)
+  , withEnv
+  , withEnvWriter
+  , withEnvWriters
+  , queryEnv
+  )
+where
+
+import Glean
+import Glean.Remote
+import Glean.Util.Some
+import Glean.Write.SimpleAsync
+
+import Derive.Types
+
+data Env = Env
+  { envConfig :: Config
+  , envBackend :: Some Backend
+  , envSender :: Sender
+  , envWriterSettings :: WriterSettings
+  }
+
+withEnv
+  :: Backend e
+  => Config
+  -> [SchemaPredicates]
+  -> e
+  -> (Env -> IO a)
+  -> IO a
+withEnv cfg allPredicates be action =
+  withSimpleSender be (cfgRepo cfg) allPredicates (cfgSendQueue cfg)
+    $ \sender -> action Env
+    { envConfig = cfg
+    , envBackend = Some (backendRetryReads be defaultRetryPolicy)
+    , envSender = sender
+    , envWriterSettings = cfgWriter cfg
+    }
+
+withEnvWriter :: Env -> (Writer -> IO a) -> IO a
+withEnvWriter env = withSimpleWriter (envSender env) (envWriterSettings env)
+
+withEnvWriters :: Env -> Int -> ([Writer] -> IO a) -> IO a
+withEnvWriters env = withSimpleWriters (envSender env) (envWriterSettings env)
+
+queryEnv :: forall p. Predicate p => Env -> Query p
+queryEnv env =
+  maybe id limit (cfgMaxQueryFacts (envConfig env)) $
+  limitBytes (cfgMaxQuerySize (envConfig env))
+  allFacts
diff --git a/glean/lang/clang/Derive/Generic.hs b/glean/lang/clang/Derive/Generic.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/Generic.hs
@@ -0,0 +1,31 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Derive.Generic
+  ( derivePredicate
+  ) where
+
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+import Util.Log
+
+import Glean
+import qualified Glean.Derive
+
+import Derive.Types
+
+derivePredicate :: Backend b => b -> Config -> Text -> IO ()
+derivePredicate backend cfg txt = do
+  logInfo $ "deriving " <> Text.unpack txt
+  Glean.Derive.derivePredicate backend (cfgRepo cfg)
+    (Just (fromIntegral (cfgMaxStoreQuerySize cfg)))
+    (fromIntegral <$> cfgMaxQueryFacts cfg)
+    (parseRef txt)
+    Nothing
+  logInfo $ "done deriving " <> Text.unpack txt
diff --git a/glean/lang/clang/Derive/Lib.hs b/glean/lang/clang/Derive/Lib.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/Lib.hs
@@ -0,0 +1,88 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Derive.Lib
+  ( dispatchDerive
+  , allPredicates
+  , allManualPasses
+  , DerivePass(..)
+  , optionsPasses
+  ) where
+
+import Control.Applicative
+import Data.Set (Set)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Options.Applicative as O
+
+import Glean
+import qualified Glean.Schema.Cxx1 as Cxx
+import qualified Glean.Schema.Src as Src
+
+import Derive.Env
+
+import Derive.CxxDeclarationSources (deriveCxxDeclarationSources)
+import Derive.CxxSame (deriveSame)
+import Derive.CxxTargetUses (deriveUses)
+import Derive.Generic (derivePredicate)
+
+-- | Uniform way to call our standard derived passes.  One can return
+-- a subsequent 'DerivePass' to allow further work that can read
+-- what was just written.
+dispatchDerive :: Env -> DerivePass -> IO ()
+dispatchDerive env = \case
+  DeriveTargetUses -> execN deriveUses
+  DeriveDeclFamilies -> exec deriveSame
+  DeriveFunctionCalls -> return () -- no-op; facts now emitted by the indexer
+  DeriveFunctionCalls_Pass_2 -> exec deriveCxxDeclarationSources
+  DeriveGeneric p -> storedPredicate p
+  where
+    exec f = withEnvWriter env $ f (envBackend env) (envConfig env)
+    execN f = f (envBackend env) (envConfig env) (withEnvWriters env)
+    storedPredicate = derivePredicate (envBackend env) (envConfig env)
+
+allPredicates :: [SchemaPredicates]
+allPredicates =
+  [ Cxx.allPredicates
+  , Src.allPredicates
+  ]
+
+-- | Central enumeration of all derived passes supported by "Derive"
+data DerivePass
+  = DeriveTargetUses
+  | DeriveDeclFamilies
+  | DeriveFunctionCalls  -- backwards compat, this pass is a no-op
+  | DeriveFunctionCalls_Pass_2
+  | DeriveGeneric Text
+  deriving (Eq,Ord)
+
+allManualPasses :: [DerivePass]
+allManualPasses =
+  [ DeriveTargetUses
+  , DeriveDeclFamilies
+  , DeriveFunctionCalls_Pass_2
+  ]
+
+optionsPasses :: O.Parser (Set DerivePass)
+optionsPasses =
+  -- With no flags, we run all the derive passes. If you specify
+  -- one or more flags, we run only those passes.
+  fmap Set.fromList $
+    some (foldr1 (<|>)
+      [ O.flag' DeriveTargetUses (O.long "target-uses")
+      , O.flag' DeriveDeclFamilies (O.long "decl-families")
+      , O.flag' DeriveFunctionCalls (O.long "function-calls")
+      , O.flag' DeriveFunctionCalls_Pass_2 (O.long "function-calls-pass-2")
+      , DeriveGeneric <$> O.option (Text.pack <$> O.str)
+          (  O.long "predicate"
+          <> O.metavar "NAME[.VERSION]"
+          )
+      ])
+    <|>
+      pure allManualPasses
diff --git a/glean/lang/clang/Derive/Types.hs b/glean/lang/clang/Derive/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Derive/Types.hs
@@ -0,0 +1,152 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+-- | Supporting types for "Derive" so that some passes
+-- can compile separately.
+module Derive.Types
+  ( -- * types
+    Config(..), MatchAlgorithm(..)
+    -- * parsing options
+  , options
+    -- * testing
+  , testConfig
+  ) where
+
+import Control.Applicative
+import Data.Default
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Options.Applicative as O
+
+import Glean
+import qualified Glean.LocalOrRemote as Glean
+
+-- | Options for 'DeriveFunctionCalls' pass for benchmarking algorithms
+data MatchAlgorithm = Naive | SweepingLine | SourceVector
+
+instance Default MatchAlgorithm where def = SourceVector
+
+-- | Configuration options for "Derive" and its passes
+data Config = Config
+  { cfgService :: Glean.Service
+  , cfgDefaultCell :: Text
+  , cfgRepo :: Repo
+  , cfgDryRun :: Bool
+  , cfgNumCapabilities :: Maybe Int  -- ^ override @+RTS -Nx -RTS@
+  , cfgWorkerThreads :: Int  -- ^ number of threads with a Writer
+  , cfgSendQueue :: SendQueueSettings
+  , cfgWriter :: WriterSettings
+  , cfgMaxQueryFacts :: Maybe Int
+  , cfgMaxQuerySize :: Int
+  , cfgMaxStoreQuerySize :: Int
+    -- storing takes a lot longer than just querying, so we set a much
+    -- lower size limit when storing to avoid timeouts.
+  , cfgBenchmark :: Bool  -- ^ function-calls pass
+  , cfgMatchAlgorithm :: MatchAlgorithm  -- ^ function-calls pass
+  , cfgDebugPrintReferences :: Bool  -- ^ function-calls pass
+  , cfgBatchSize :: Int -- ^ batch size for function-calls
+  , cfgIncremental :: Bool  -- ^ derive incrementally
+  , cfgTestedFileShards :: Int -- Number of shards for --tested-file deriver
+  , cfgTestedFileShard :: Int -- Shard number for ---tested-file deriver
+  }
+
+-- | Only used for regression testing derived passes
+testConfig :: Repo -> Config
+testConfig repo = Config
+  { cfgService = error "testConfig.cfgService"
+  , cfgDefaultCell = repo_name repo
+  , cfgRepo = repo
+  , cfgDryRun = False
+  , cfgNumCapabilities = Nothing
+  , cfgWorkerThreads = 1
+  , cfgSendQueue = def
+    { sendQueueThreads = 1
+    , sendQueueMaxMemory = 2000000000
+    , sendQueueMaxBatches = 1024 }
+  , cfgWriter = def{ writerMaxSize = 30000000 }
+  , cfgMaxQueryFacts = Nothing
+  , cfgMaxQuerySize = 30000000
+  , cfgMaxStoreQuerySize = 10000000
+  , cfgBenchmark = False
+  , cfgMatchAlgorithm = def
+  , cfgDebugPrintReferences = False
+  , cfgIncremental = False
+  , cfgTestedFileShards = 1
+  , cfgTestedFileShard = 0
+  , cfgBatchSize = 1
+  }
+
+-- | Command-line argument parser for "Derive" to get 'Config'
+--
+-- See 'Runner.Server.callDerived'
+options :: O.Parser Config
+options = do
+  cfgService <- Glean.options
+  cfgDefaultCell <- O.option (Text.pack <$> O.str) $
+    O.long "default-cell"
+    <> O.metavar "CELL"
+    <> O.help "Default buck cell name for buck.Locator{subdir=nothing}"
+    <> O.value "fbsource"
+  cfgRepo <- readRepo "/" <$> O.strOption
+    (  O.long "repo"
+    <> O.metavar "NAME/HASH"
+    <> O.help "repo DB (default: use latest complete DB)" )
+  cfgDryRun <- O.switch $ O.long "dry-run"
+  cfgNumCapabilities <- O.optional $ O.option O.auto $
+    O.long "num-capabilities"
+    <> O.metavar "N"
+    <> O.help "optionally override +RTS -Nx -RTS"
+  cfgWorkerThreads <- O.option O.auto $
+    O.long "worker-threads"
+    <> O.metavar "N"
+    <> O.value 1
+    <> O.help "number of concurrent writer threads, default 1"
+  cfgSendQueue <- sendQueueOptions
+  cfgWriter <- writerOptions
+  cfgMaxQueryFacts <- O.optional $ O.option O.auto $
+    O.long "max-query-facts"
+    <> O.metavar "N"
+    <> O.help "maximum number of facts to query in one step"
+  cfgMaxQuerySize <- O.option O.auto $
+    O.long "max-query-size"
+    <> O.metavar "N"
+    <> O.value 30000000
+    <> O.help "maximum number of bytes to query in one step"
+  cfgMaxStoreQuerySize <- O.option O.auto $
+    O.long "max-store-query-size"
+    <> O.metavar "N"
+    <> O.value 1000000
+    <> O.help "maximum number of bytes to query in one step when storing"
+  cfgBenchmark <- O.switch $ O.long "benchmark"
+  cfgMatchAlgorithm <- O.flag' Naive (O.long "match-naive") <|>
+        O.flag' SweepingLine (O.long "match-sweeping-line") <|>
+        O.flag' SourceVector (O.long "match-source-vector") <|>
+        pure def
+  cfgDebugPrintReferences <- O.switch $ O.long "debug-print"
+  _ :: Maybe Int <- O.optional $ O.option O.auto $
+    O.long "max-queue-size" <> O.hidden
+    -- ignored for backwards-compat
+  cfgIncremental <- O.switch $
+    O.long "incremental"
+  cfgTestedFileShards <- O.option O.auto $
+    O.long "tested-file-shards"
+    <> O.metavar "N"
+    <> O.value 1
+    <> O.help "number of file shards for the --tested-file deriver"
+  cfgTestedFileShard <- O.option O.auto $
+    O.long "tested-file-shard"
+    <> O.metavar "N"
+    <> O.value 0
+    <> O.help "the shard number to filter files for ---tested-file deriver"
+  cfgBatchSize <- O.option O.auto $
+    O.long "batch-size"
+    <> O.metavar "N"
+    <> O.value 1
+    <> O.help "batch size for function-calls"
+  return Config{..}
diff --git a/glean/lang/clang/Glean/Indexer/Cpp.hs b/glean/lang/clang/Glean/Indexer/Cpp.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/Glean/Indexer/Cpp.hs
@@ -0,0 +1,388 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, ApplicativeDo #-}
+module Glean.Indexer.Cpp
+  ( indexerWith, indexer, indexerNoDeriv, Clang(..)
+  , findExecutableRecursive ) where
+
+import Control.Concurrent (threadDelay)
+import Control.Concurrent.Async
+import Control.Exception
+import Control.Monad
+import qualified Data.ByteString as BS
+import Data.Proxy
+import Options.Applicative
+import qualified System.Console.ANSI as ANSI
+import System.Directory
+import System.Environment
+import System.Exit
+import System.FilePath
+import System.IO
+import System.Process
+import Thrift.Protocol (deserializeGen)
+import Thrift.Protocol.Compact (Compact)
+import Util.List (chunk)
+import qualified Data.ByteString.Lazy.Char8 as BL
+import qualified Data.Text as Text
+
+import Facebook.Fb303
+import Facebook.Service
+
+#ifdef FBTHRIFT
+import qualified Thrift.Server.CppServer as ThriftServer
+#else
+import qualified Thrift.Server.HTTP as ThriftServer
+#endif
+
+import Glean
+  ( sendBatch
+  , clientConfig_serv
+  , showRepo
+  , completePredicates
+  , CompletePredicates (CompletePredicates_axiom), CompleteAxiomPredicates(..)
+  )
+import Glean.Remote (thriftBackendClientConfig)
+import Glean.Indexer
+import Glean.LocalOrRemote ( BackendKind(..),
+  LocalOrRemote(..), serializeInventory )
+import Glean.Util.Service
+import qualified Glean.Interprocess.Worklist as Worklist
+import qualified Glean.Handler as GleanHandler
+import Data.Aeson (decode, Object, Value (String))
+import Data.Foldable (toList)
+
+data Clang = Clang
+  { clangIndexBin     :: Maybe FilePath -- ^ path to @clang-index@ binary
+  , clangDeriveBin    :: Maybe FilePath -- ^ path to @clang-derive@ binary
+  , clangCompileDBDir :: Maybe FilePath
+      -- ^ (optional) path to pre-existing @compile_commands.json@
+  , clangTarget       :: Maybe String -- ^ (optional) target to index
+  , clangJobs         :: Int -- ^ number of indexers to run concurrently
+  , clangVerbose      :: Bool -- ^ display debugging information
+  , clangProgress     :: Bool -- ^ display indexing progress
+  , clangIncremental  :: Bool -- ^ use incremental derivation
+  } deriving Show
+
+options :: Parser Clang
+options = do
+  clangIndexBin <- optional $ strOption $
+    long "indexer" <>
+    help "path to the clang-index binary"
+  clangDeriveBin <- optional $ strOption $
+    long "deriver" <>
+    help "path to the clang-derive binary"
+  clangCompileDBDir <- optional $ strOption $
+    long "cdb-dir" <>
+    help "path to a directory containing an existing compile_commands.json file"
+  clangTarget <- optional $ strOption $
+    long "c-target" <>
+    help "target to index (e.g. //path/to:target)"
+  clangJobs <- option auto $
+    short 'j' <>
+    long "jobs" <>
+    value 1 <>
+    help "run N indexers in parallel"
+  clangVerbose <- switch $
+    short 'v' <>
+    long "verbose" <>
+    help "Enable verbose logging from subprocesses"
+  clangProgress <- switch $
+    long "progress" <>
+    help "Display indexing progress even in verbose mode"
+  clangIncremental <- pure False -- internal, not a CLI flag
+  return Clang{..}
+
+-- | Standard indexer, that also runs the deriver
+indexer :: Indexer Clang
+indexer = indexerWith True
+
+-- | Indexing only, no deriving
+indexerNoDeriv :: Indexer Clang
+indexerNoDeriv = indexerWith False
+
+-- | C++ indexer. The 'Bool' specifies whether the indexer
+--   also runs the deriver. It creates a compilation database, either
+--   using CMake or taking the one provided as param, and then creates
+--   glean facts from it.
+indexerWith :: Bool -> Indexer Clang
+indexerWith deriveToo = Indexer {
+  indexerShortName = "cpp-cmake",
+  indexerDescription = "Index C++ code with CMake (via Clang)",
+  indexerOptParser = options,
+  indexerRun = \clang@Clang{..} backend repo IndexerParams{..} -> do
+    -- indexing
+    let tmpDir        = indexerOutput
+        inventoryFile = tmpDir </> "inventory.data"
+    generateInventory backend repo inventoryFile
+    compileDBDir <-
+      case clangCompileDBDir of
+        Nothing  ->
+          case clangTarget of
+            Nothing -> cmake clangVerbose indexerRoot tmpDir >> return tmpDir
+            Just target -> do
+              cdb <- runBuckFullCompilationDatabase target
+              return $ takeDirectory cdb
+        Just dir -> return dir
+    indexerData <-
+      index clang inventoryFile indexerRoot compileDBDir indexerOutput
+    writeToDB backend repo indexerData
+
+    -- deriving
+    when deriveToo $ do
+      completePredicates backend repo $
+        CompletePredicates_axiom CompleteAxiomPredicates
+      derive clangVerbose clangDeriveBin backend repo
+  }
+
+  where
+    runBuckFullCompilationDatabase :: String -> IO String
+    runBuckFullCompilationDatabase target = do
+      let args =
+            [ "--isolation-dir=glean-indexer"
+            , "build"
+            , target <> "[full-compilation-database]"
+            , "--show-full-json-output"
+            ]
+      (exit, out, err) <- readProcessWithExitCode "buck" args ""
+      case exit of
+        ExitSuccess -> do
+          let json :: Maybe Object = decode $ BL.pack $ head $ lines out
+          case json of
+            Nothing -> invalidJson out
+            Just obj -> do
+              case toList obj of
+                [cdb] -> case cdb of
+                  String cdb -> return $ Text.unpack cdb
+                  _ -> invalidJson out
+                _ -> invalidJson out
+        ExitFailure i -> error $ unwords (args ++
+          [ "returned exit code", show i
+          , "with output", out
+          , "and error", err])
+        where
+          invalidJson out = error $ "buck returned invalid JSON: " ++ out
+
+    generateInventory backend repo outFile =
+      serializeInventory backend repo >>= BS.writeFile outFile
+
+    cmake verbose srcDir tmpDir = withExe "cmake" Nothing $ \cmakeBin ->
+      spawnAndConcurrentLog verbose cmakeBin
+        [ "-DCMAKE_EXPORT_COMPILE_COMMANDS=1"
+        , "-S", srcDir
+        , "-B", tmpDir
+        ]
+
+    index Clang{..} inventory srcDir buildDir tmpDir =
+      withExe "clang-index" clangIndexBin $ \clangIndex -> do
+      let args =
+            [ "-cdb_dir", buildDir
+            , "-cdb_target", "all"
+            , "-root", srcDir
+            , "--inventory", inventory
+            , "-logtostderr"
+            ]
+
+      -- get the total number of source files
+      sourceCount <- do
+        let pargs = args ++ ["--print_sources_count"]
+        s <- readProcess clangIndex pargs ""
+        case reads s of
+          [(sources,"")] -> return sources
+          _ -> error $ unwords (clangIndex:pargs)
+            ++ " produced unexpect output \"" ++ s ++ "\""
+
+      case sourceCount of
+        0 -> do
+          -- TODO: should this be an error?
+          putStrLn "No source files to index"
+          return []
+        _ ->
+          -- set up worklist
+          let ranges = map (\(i,n) -> Worklist.Range i (i+n)) $
+                  chunk clangJobs sourceCount
+              !workers = length ranges
+          in
+          Worklist.withTemp ranges $ \wfile worklist ->
+
+          -- progress and logging
+          (if clangProgress || not clangVerbose
+            then withProgress worklist clangJobs sourceCount
+            else id) $
+          withLog clangVerbose (void . evaluate . length) $ \stream -> do
+
+          -- run workers
+          let dataFile i = tmpDir </> "indexer-" <> show i <> ".data"
+              workerargs i = args ++
+                [ "-dump", dataFile i
+                , "--work_file", wfile
+                , "--worker_index", show i
+                , "--worker_count", show workers
+                ]
+          currentDir <- getCurrentDirectory
+          let cdUp = not $ isPathPrefixOf currentDir buildDir
+          forConcurrently_ [0 .. workers-1] $ \i -> bracket
+            -- createProcess_ because we don't want the stdout/stderr handles
+            -- to be closed
+            (createProcess_
+                "Cpp.index"
+                (proc clangIndex $ workerargs i)
+                  {std_out = stream,
+                   std_err = stream,
+                   cwd = if cdUp then Just (takeDirectory currentDir) else Nothing})
+            cleanupProcess
+            $ \(_, _, _, ph) -> do
+              ex <- waitForProcess ph
+              case ex of
+                ExitSuccess -> return ()
+                ExitFailure i -> error $ unwords (clangIndex:workerargs i)
+                  ++ " returned exit code " ++ show i
+
+          -- return data file names
+          return $ map dataFile [0 .. workers-1]
+
+    isPathPrefixOf :: FilePath -> FilePath -> Bool
+    isPathPrefixOf prefix path = prefix == take (length prefix) path
+
+
+    writeToDB backend repo = mapM_ $ \dataFile -> do
+      dat <- BS.readFile dataFile
+      case deserializeGen (Proxy :: Proxy Compact) dat of
+        Left parseError -> error parseError
+        Right batch     -> sendBatch backend repo batch
+
+    derive verbose deriveBin backend repo =
+      withExe "clang-derive" deriveBin $ \clangDerive -> do
+        let go service = spawnAndConcurrentLog verbose clangDerive
+              [ "--repo", showRepo repo
+              , "--service", service
+              ]
+        case backendKind backend of
+          BackendEnv env -> do
+            fb303 <- newFb303 "gleandriver"
+            let state = GleanHandler.State fb303 env
+            withBackgroundFacebookService
+              (GleanHandler.fb303State state)
+              (GleanHandler.handler state)
+              ThriftServer.defaultOptions
+              $ \server ->
+                go ("localhost:" <> show (ThriftServer.serverPort server))
+          BackendThrift thrift -> do
+            let clientConfig = thriftBackendClientConfig thrift
+            go $ serviceToString (clientConfig_serv clientConfig)
+
+withProgress ::  Worklist.Worklist -> Int -> Int -> IO a -> IO a
+withProgress worklist jobs total action = do
+  terminal <- ANSI.hSupportsANSI stdout
+  flush $ start terminal
+  x <- withAsync (showProgress terminal 0) $ const action
+  flush $ finish terminal
+  return x
+  where
+    flush f = f >> hFlush stdout
+
+    tmsg n =
+      unwords ["Indexed", show (total - n), "of", show total, "source files"]
+
+    start True = putStrLn $ tmsg total
+    start False = putStr $ unwords ["Indexing", show total, "source files: 0%"]
+
+    finish True = do
+      ANSI.cursorUpLine 1
+      putStrLn $ tmsg 0
+    finish False =
+      putStrLn $ " ... 100%\nIndexed " ++ show total ++ "source files"
+
+    message True before now = when (before /= now) $ do
+      ANSI.cursorUpLine 1
+      putStrLn $ tmsg now
+    message False before now = do
+      let tenth n = ((total - n) * 10) `div` total
+          t = tenth now
+      when (t /= 0 && t /= 10 && t /= tenth before) $
+        putStr $ " ... " <> show (tenth now) <> "0%"
+
+    showProgress terminal before = do
+      ranges <- mapM (Worklist.get worklist) [0 .. jobs-1]
+      let remaining = max 0 $ sum $ map (\(Worklist.Range i k) -> k-i) ranges
+      flush $ message terminal before remaining
+      threadDelay 1000000
+      showProgress terminal remaining
+
+withLog :: Bool -> (String -> IO ()) -> (StdStream -> IO a) -> IO a
+withLog verbose log act
+  | verbose = act Inherit
+  | otherwise = bracket createPipe (\(r,w) -> hClose r >> hClose w)
+      $ \(outRead, outWrite) ->
+          withAsync (log =<< hGetContents outRead)
+          $ const $ act $ UseHandle outWrite
+
+-- | Simple concurrent logger. Spawn the process and asynchronously log
+-- concise or full contents to stdout. Should use a fancy progress bar really
+spawnAndConcurrentLog :: Bool -> FilePath -> [String] -> IO ()
+spawnAndConcurrentLog verbose exe args = withLog verbose log $ \stream -> do
+  (_, _, _, ph) <- createProcess (proc exe args)
+    { std_out = stream, std_err = stream }
+  ex <- waitForProcess ph
+  case ex of
+    ExitSuccess -> return ()
+    ExitFailure i -> error $
+      unwords (exe:args) ++ " returned exit code " ++ show i
+  where
+    log s = mapM_ (const $ putChar '.' >> hFlush stdout) (lines s)
+      `finally` do
+        putStr "\n"
+        hFlush stdout
+
+--
+-- We need to find clang-index and clang-derive in $PATH or in-tree
+--
+withExe :: FilePath -> Maybe FilePath -> (FilePath -> IO a) -> IO a
+withExe _ (Just exePath) f = do
+  exeExists <- doesFileExist exePath
+  if exeExists
+    then f exePath
+    else error $ exePath ++ " does not exist"
+withExe exeName Nothing  f = do
+  -- check $PATH
+  mPath <- findExecutable exeName
+  case mPath of
+    Just exe -> f exe
+    Nothing -> do -- well maybe we are in-tree, check local build
+      wrapperExePath <- getExecutablePath
+      case inTreeSearchPath wrapperExePath of
+        Just path -> do
+          mPath <- findExecutableRecursive exeName path
+          case mPath of
+            [] -> error $ "Could not find " <> exeName <>
+                     " in $PATH or in " <> path
+            exe:_ -> f exe
+        Nothing -> error $ "Could not find " <> exeName <> " in $PATH"
+
+-- determine if we are invoking glean in-tree, to find the clang-* binaries
+inTreeSearchPath :: FilePath -> Maybe FilePath
+inTreeSearchPath exePath = do
+  case reverse (splitDirectories  exePath) of
+    -- definitely running in tree:
+    (_:_:"build":_:ty:_:xs)
+      | ty `elem` ["x", "t"] -> Just $ joinPath (reverse xs)
+    _ -> Nothing
+
+-- do a silly recursive search in the dist-newstyle under the ghc dirs
+-- > findExecutableRecursive "clang-index" ..path
+--
+findExecutableRecursive :: String -> FilePath -> IO [FilePath]
+findExecutableRecursive exeName dirPath = do
+  mFound <- findExecutablesInDirectories [dirPath] exeName
+  case mFound of
+    exe:_ -> return [exe]
+    [] -> do
+      dirs <- listDirectory dirPath
+      let subDirs = map (dirPath </>) dirs
+      subdirs <- filterM doesDirectoryExist subDirs
+      concat <$> mapM (findExecutableRecursive exeName) subdirs
diff --git a/glean/lang/clang/tests/Glean/Clang/Test.hs b/glean/lang/clang/tests/Glean/Clang/Test.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Clang/Test.hs
@@ -0,0 +1,99 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.Test (
+    driver, driverWith, Options, Cpp.clangIncremental
+  ) where
+
+import qualified Data.Aeson as Aeson
+import Data.List
+import System.Directory
+import System.FilePath
+import Text.JSON
+
+import Glean.Indexer
+import Glean.Indexer.Cpp
+import qualified Glean.Indexer.Cpp as Cpp ( clangIncremental )
+import Glean.Regression.Snapshot.Driver
+import Glean.Regression.Snapshot.Transform
+import Glean.Util.CxxXRef
+
+import Debug.Trace (trace)
+
+import qualified Data.HashMap.Strict as HM
+
+type Options = Clang
+
+driverWith :: Bool -> Driver Clang
+driverWith deriveToo =
+  driver' {
+    driverTransforms = HM.insert "xrefs" (Transform xrefTransform)
+      (driverTransforms driver')
+  }
+  where
+    driver' = driverFromIndexer indexer'
+    baseIndexer = indexerWith deriveToo
+    isSrcFile file = takeExtension file `elem` [".c", ".cpp", ".m", ".mm"]
+    withCompileCommandsFor _opts params f = do
+      srcFiles <- map (indexerRoot params </>) . filter isSrcFile <$>
+        listDirectory (indexerRoot params)
+      writeFile (indexerOutput params </> "compile_commands.json") $
+        commandsJsonFor (indexerOutput params) srcFiles
+      f (indexerOutput params)
+    indexer' = baseIndexer
+      { indexerRun = \clang backend repo params ->
+          withCompileCommandsFor clang params $ \cdbDir ->
+            indexerRun baseIndexer (clang { clangCompileDBDir = Just cdbDir })
+              backend repo params
+      }
+
+driver :: Driver Clang
+driver = driverWith False
+
+commandsJsonFor :: FilePath -> [FilePath] -> String
+commandsJsonFor tmpDir srcFiles =
+  ("[" ++) $ (++ "]")
+    ( unlines $ intersperse ","
+      [ unlines
+        [ "{"
+        , "  \"directory\": \"" ++ tmpDir ++ "\","
+        , "  \"command\": \"/usr/bin/clang-11 "
+            ++ argsFor srcFile
+            ++ " -o "
+            ++ objFileFor srcFile
+            ++ " -c "
+            ++ srcFile
+            ++ "\","
+        , "  \"file\": \"" ++ srcFile ++ "\""
+        , "}"
+        ]
+      | srcFile <- srcFiles
+      ]
+    )
+
+  where objFileFor srcFile = tmpDir </> (takeFileName srcFile <.> "o")
+        argsFor srcFile
+          | takeExtension srcFile == ".cpp" = "-std=c++14 -fcoroutines-ts -xc++"
+          | takeExtension srcFile == ".c"   = "-std=c99 -xc"
+          | takeExtension srcFile == ".mm"  = "-xobjective-c++"
+          | otherwise                       = "-xobjective-c"
+
+xrefTransform :: Unit -> [JSValue] -> [JSValue]
+xrefTransform _ = map go
+  where go jsval = case transformXRefs jsval of
+          Ok x -> x
+          Error msg -> trace ("xrefTransform error: " ++ show msg) jsval
+
+-- with aeson <2, () isn't a valid decoding of
+-- [] and {}, which xrefTransform apparently runs into,
+-- so we embed our ()-like little helper that can
+-- always be decoded.
+-- (problem is fixed with aeson >= 2)
+data Unit = Unit
+instance Aeson.FromJSON Unit where
+  parseJSON _ = pure Unit
diff --git a/glean/lang/clang/tests/Glean/Clang/Test/DerivePass.hs b/glean/lang/clang/tests/Glean/Clang/Test/DerivePass.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Clang/Test/DerivePass.hs
@@ -0,0 +1,42 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Regression testing, see "Glean.Regression.Test" for Derive.hs
+module Glean.Clang.Test.DerivePass (testDeriver, driver, derivePasses) where
+
+import Control.Monad
+import Data.Default
+
+import Glean
+import Glean.Indexer
+import qualified Glean.Clang.Test as Clang
+import Glean.Regression.Snapshot.Driver
+import Glean.Regression.Snapshot
+
+import Derive.Env (withEnv)
+import Derive.Lib (dispatchDerive, DerivePass, allPredicates)
+import Derive.Types (testConfig, Config(..))
+
+-- | Run the Clang indexer followed by the specified deriving passes
+driver :: [DerivePass] -> Driver Clang.Options
+driver passes = Clang.driver { driverIndexer = indexer }
+  where
+  indexer = driverIndexer Clang.driver `indexerThen` derivePasses passes
+
+derivePasses
+  :: Backend backend => [DerivePass] -> Clang.Options -> backend -> Repo -> p -> IO ()
+derivePasses passes opts backend repo _params = do
+    completePredicates backend repo (CompletePredicates_axiom def)
+    forM_ passes $ \thisPass -> do
+      -- withTestWriter completes before next pass
+      let conf = (testConfig repo) { cfgIncremental = Clang.clangIncremental opts }
+      withEnv conf allPredicates backend $ \env ->
+        dispatchDerive env thisPass
+
+testDeriver :: [DerivePass] -> IO ()
+testDeriver passes = testMain (driver passes)
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/Clang.hs b/glean/lang/clang/tests/Glean/Regression/Driver/Clang.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/Clang.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.Clang (main) where
+
+import qualified Glean.Clang.Test as Clang
+import Glean.Regression.Snapshot
+
+main :: IO ()
+main = testMain Clang.driver
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/DeriveDeclFamilies.hs b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveDeclFamilies.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveDeclFamilies.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.DeriveDeclFamilies (main) where
+
+import Derive.Lib
+import Glean.Clang.Test.DerivePass
+
+main :: IO ()
+main = testDeriver [DeriveDeclFamilies]
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/DeriveForCodemarkup.hs b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveForCodemarkup.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveForCodemarkup.hs
@@ -0,0 +1,59 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.DeriveForCodemarkup (
+    main,
+    codemarkupDerivePasses
+  ) where
+
+import Derive.Lib as Lib
+import Glean.Clang.Test.DerivePass
+
+--
+-- Derive things we will need for codemarkup.* calls
+--
+main :: IO ()
+main = testDeriver codemarkupDerivePasses
+
+--
+-- Standard things we need to derive (also Glass) for full code search/nav
+--
+codemarkupDerivePasses :: [DerivePass]
+codemarkupDerivePasses =
+  Lib.allManualPasses ++
+  [DeriveGeneric "cxx1.FunctionDeclAttribute"
+  ,DeriveGeneric "cxx1.DeclarationToUSR"
+  ,DeriveGeneric "cxx1.RecordDerived"
+  ,DeriveGeneric "cxx1.ThriftToCxx"
+  -- name search
+  ,DeriveGeneric "cxx1.EnumDeclarationByName"
+  ,DeriveGeneric "cxx1.EnumeratorByName"
+  ,DeriveGeneric "cxx1.FunctionDeclarationByNameScope"
+  ,DeriveGeneric "cxx1.NamespaceDeclarationByName"
+  ,DeriveGeneric "cxx1.ObjcContainerDeclarationInterface"
+  ,DeriveGeneric "cxx1.RecordDeclarationClass"
+  ,DeriveGeneric "cxx1.RecordDeclarationStruct"
+  ,DeriveGeneric "cxx1.RecordDeclarationUnion"
+  ,DeriveGeneric "cxx1.TypeAliasDeclarationByName"
+  ,DeriveGeneric "cxx1.VariableDeclarationNonLocalByName"
+  -- lowercase name search
+  ,DeriveGeneric "pp1.DefineLowerCase"
+  ,DeriveGeneric "cxx1.EnumLowerCase"
+  ,DeriveGeneric "cxx1.EnumeratorLowerCase"
+  ,DeriveGeneric "cxx1.FunctionLowerCase"
+  ,DeriveGeneric "cxx1.NamespaceLowerCase"
+  ,DeriveGeneric "cxx1.ObjcContainerInterfaceLowerCase"
+  ,DeriveGeneric "cxx1.RecordClassLowerCase"
+  ,DeriveGeneric "cxx1.RecordStructLowerCase"
+  ,DeriveGeneric "cxx1.RecordUnionLowerCase"
+  ,DeriveGeneric "cxx1.TypeAliasLowerCase"
+  ,DeriveGeneric "cxx1.VariableLowerCase"
+  -- objc
+  ,DeriveGeneric "cxx1.ObjcContainerInheritance"
+  ,DeriveGeneric "cxx1.ObjcInterfaceToImplementation"
+  ]
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionCalls.hs b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionCalls.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionCalls.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.DeriveFunctionCalls (main) where
+
+import Derive.Lib
+import Glean.Clang.Test.DerivePass
+
+main :: IO ()
+main = testDeriver [DeriveFunctionCalls_Pass_2]
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionDeclAttribute.hs b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionDeclAttribute.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveFunctionDeclAttribute.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.DeriveFunctionDeclAttribute (main) where
+
+import Derive.Lib
+import Glean.Clang.Test.DerivePass
+
+main :: IO ()
+main = testDeriver [DeriveGeneric "cxx1.FunctionDeclAttribute"]
diff --git a/glean/lang/clang/tests/Glean/Regression/Driver/DeriveObjcInheritance.hs b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveObjcInheritance.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/Glean/Regression/Driver/DeriveObjcInheritance.hs
@@ -0,0 +1,15 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Driver.DeriveObjcInheritance(main) where
+
+import Derive.Lib
+import Glean.Clang.Test.DerivePass
+
+main :: IO ()
+main = testDeriver [DeriveGeneric "cxx1.ObjcContainerInheritance"]
diff --git a/glean/lang/clang/tests/github/Glean/Clang/CodeMarkup.hs b/glean/lang/clang/tests/github/Glean/Clang/CodeMarkup.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/CodeMarkup.hs
@@ -0,0 +1,26 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.CodeMarkup where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.DeriveForCodemarkup as D
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ extraArgs) D.main
+  where
+    extraArgs = [
+      "--root", path,
+      "--omit", "declarations/typeAlias1"
+        -- Bug fixed upstream in LLVM:
+        --  https://github.com/llvm/llvm-project/commit/d9c979ef33ff83b49ba14c2eecdf499bae4565f4
+        -- TODO: re-enable when using a fixed LLVM
+      ]
+    path = "glean/lang/codemarkup/tests/clang"
diff --git a/glean/lang/clang/tests/github/Glean/Clang/DeriveAttrs.hs b/glean/lang/clang/tests/github/Glean/Clang/DeriveAttrs.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/DeriveAttrs.hs
@@ -0,0 +1,20 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.DeriveAttrs where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.DeriveFunctionDeclAttribute as D
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ ["--root", path]) D.main
+
+  where
+    path = "glean/lang/clang/tests/regression_derive-attributes"
diff --git a/glean/lang/clang/tests/github/Glean/Clang/DeriveFamilies.hs b/glean/lang/clang/tests/github/Glean/Clang/DeriveFamilies.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/DeriveFamilies.hs
@@ -0,0 +1,20 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.DeriveFamilies where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.DeriveDeclFamilies as D
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ ["--root", path]) D.main
+
+  where
+    path = "glean/lang/clang/tests/regression_derive-decl-families"
diff --git a/glean/lang/clang/tests/github/Glean/Clang/DeriveFunCalls.hs b/glean/lang/clang/tests/github/Glean/Clang/DeriveFunCalls.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/DeriveFunCalls.hs
@@ -0,0 +1,20 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.DeriveFunCalls where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.DeriveFunctionCalls as D
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ ["--root", path]) D.main
+
+  where
+    path = "glean/lang/clang/tests/regression_derive-function-calls"
diff --git a/glean/lang/clang/tests/github/Glean/Clang/DeriveObjCInheritance.hs b/glean/lang/clang/tests/github/Glean/Clang/DeriveObjCInheritance.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/DeriveObjCInheritance.hs
@@ -0,0 +1,20 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.DeriveObjCInheritance where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.DeriveObjcInheritance as D
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ ["--root", path]) D.main
+
+  where
+    path = "glean/lang/clang/tests/regression_derive-objc-inheritance"
diff --git a/glean/lang/clang/tests/github/Glean/Clang/Regression.hs b/glean/lang/clang/tests/github/Glean/Clang/Regression.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/clang/tests/github/Glean/Clang/Regression.hs
@@ -0,0 +1,29 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Clang.Regression (main) where
+
+import System.Environment
+
+import qualified Glean.Regression.Driver.Clang as Clang
+
+main :: IO ()
+main = getArgs >>= \args ->
+  withArgs (args ++ ["--root", path] ++ expectedFailures) Clang.main
+
+  where
+    path = "glean/lang/clang/tests/regression"
+
+    -- tests known to fail in opensource environment
+    expectedFailures = map ("--omit="++)
+      [ "declarations/typeAlias1"
+      , "declarations/objc-property1"
+      , "xrefs/coro1"             -- Needs Clang 15
+      , "xrefs/using-directive4"  -- Needs Clang 15
+      , "index_failure/cpp"
+      ]
diff --git a/glean/lang/codemarkup/tests/flow/Glean/Regression/Flow/Main.hs b/glean/lang/codemarkup/tests/flow/Glean/Regression/Flow/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/codemarkup/tests/flow/Glean/Regression/Flow/Main.hs
@@ -0,0 +1,21 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Flow.Main ( main ) where
+
+import System.Environment
+
+import Glean.Indexer.Flow as Flow
+import Glean.Regression.Snapshot
+import Glean.Regression.Snapshot.Driver
+
+main :: IO ()
+main = getArgs >>= \args -> withArgs (args ++["--root", path]) $ testMain driver
+  where
+      driver = driverFromIndexer Flow.indexer
+      path = "glean/lang/codemarkup/tests/flow/cases"
diff --git a/glean/lang/codemarkup/tests/hack/Glean/Regression/Hack/Main.hs b/glean/lang/codemarkup/tests/hack/Glean/Regression/Hack/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/codemarkup/tests/hack/Glean/Regression/Hack/Main.hs
@@ -0,0 +1,21 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Hack.Main ( main ) where
+
+import System.Environment
+
+import Glean.Indexer.Hack as Hack
+import Glean.Regression.Snapshot
+import Glean.Regression.Snapshot.Driver
+
+main :: IO ()
+main = getArgs >>= \args -> withArgs (args ++["--root", path]) $ testMain driver
+  where
+      driver = driverFromIndexer Hack.indexer
+      path = "glean/lang/codemarkup/tests/hack/cases"
diff --git a/glean/lang/dotnet-scip/Glean/Indexer/DotnetScip.hs b/glean/lang/dotnet-scip/Glean/Indexer/DotnetScip.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/dotnet-scip/Glean/Indexer/DotnetScip.hs
@@ -0,0 +1,44 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.DotnetScip ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External (sendJsonBatches)
+import Glean.Indexer.SCIP (derive)
+import Glean.SCIP.Driver as SCIP
+
+newtype DotnetScip = DotnetScip { dotnetScipBinary :: FilePath }
+
+options :: Parser DotnetScip
+options = do
+    dotnetScipBinary <- strOption $
+        long "scip-dotnet" <>
+        value "scip-dotnet" <>
+        help "path to scip-dotnet binary"
+    return DotnetScip{..}
+
+indexer :: Indexer DotnetScip
+indexer = Indexer {
+        indexerShortName = "dotnet-scip",
+        indexerDescription = "Index C# code with `scip-dotnet`",
+        indexerOptParser = options,
+        indexerRun = \DotnetScip{..} backend repo IndexerParams{..} -> do
+            val <- SCIP.runIndexer ScipIndexerParams {
+                scipBinary = dotnetScipBinary,
+                scipArgs = const [ "index"],
+                scipRoot = indexerRoot,
+                scipWritesLocal = True,
+                scipLanguage = Just SCIP.CSharp
+            }
+            sendJsonBatches backend repo (dotnetScipBinary <> "/scip") val
+            derive backend repo
+    }
diff --git a/glean/lang/flow/Glean/Indexer/Flow.hs b/glean/lang/flow/Glean/Indexer/Flow.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/flow/Glean/Indexer/Flow.hs
@@ -0,0 +1,77 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Flow ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+
+data Flow = Flow
+  { flowBinary :: FilePath
+  , flowWriteRoot :: String
+  , flowIncludeDirectDeps :: Bool
+  , flowIncludeTransitiveDeps :: Bool
+  }
+
+options :: Parser Flow
+options = do
+  flowBinary <- strOption $
+    long "flow" <>
+    value "flow" <>
+    help "path to the flow binary"
+  flowWriteRoot <- strOption $ long "write-root" <> value "test"
+  flowIncludeDirectDeps <- switch (long "include-direct-deps")
+  flowIncludeTransitiveDeps <- switch (long "include-transitive-deps")
+  return Flow{..}
+
+indexer :: Indexer Flow
+indexer = Indexer {
+  indexerShortName = "flow",
+  indexerDescription = "Index JS/Flow code",
+  indexerOptParser = options,
+  indexerRun = \Flow{..} -> do
+    let ext = Ext {
+          extRunScript = flowBinary,
+          extFlavour = Json,
+          extArgs =
+            [ "glean"
+            , "${TEST_ROOT}"
+            , "--output-dir"
+            , "${JSON_BATCH_DIR}"
+            , "--write-root"
+            , flowWriteRoot
+            ] ++
+            [ "--include-direct-deps" | flowIncludeDirectDeps] ++
+            [ "--include-transitive-deps" | flowIncludeTransitiveDeps],
+          extDerivePredicates =
+            [ "flow.StringToFileModule"
+            , "flow.FileXRef"
+            , "flow.FileDeclaration"
+            , "flow.FlowEntityImportUses"
+            , "flow.FlowTypeEntityImportUses"
+            , "flow.ModuleContains"
+            , "flow.ModuleComments"
+
+              -- possibly deprecated
+            , "flow.ModuleNameLowerCase"
+
+            -- new search predicates
+            , "flow.SearchDeclarationByName"
+            , "flow.SearchDeclarationByLowerCaseName"
+            , "flow.SearchMemberDeclarationByName"
+            , "flow.SearchMemberDeclarationByLowerCaseName"
+            , "flow.SearchTypeDeclarationByName"
+            , "flow.SearchTypeDeclarationByLowerCaseName"
+            , "flow.SearchModuleByLowerCaseName"
+            ]
+        }
+    indexerRun externalIndexer ext
+  }
diff --git a/glean/lang/go/Glean/Indexer/Go.hs b/glean/lang/go/Glean/Indexer/Go.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/go/Glean/Indexer/Go.hs
@@ -0,0 +1,60 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Go ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Indexer.SCIP ( derive )
+import qualified Glean.SCIP.Driver as SCIP
+import System.Environment (setEnv)
+import Control.Monad (forM_)
+
+data Go = Go
+  { scipGoBinary :: FilePath
+  , goPackagesDriverBinary :: Maybe FilePath
+  , scipExtraArgs :: [String]
+  }
+
+options :: Parser Go
+options = do
+  scipGoBinary <- strOption $
+    long "scip-go" <>
+    value "scip-go" <>
+    help "path to the scip-go binary"
+  goPackagesDriverBinary <- optional (strOption $
+    long "gopackagesdriver" <>
+    value "gopackagesdriver" <>
+    help "path to the gopackagesdriver binary")
+  scipExtraArgs <- many $ strOption $
+    long "extra-arg" <>
+    help "extra arguments to pass to the indexer"
+  return Go{..}
+
+indexer :: Indexer Go
+indexer = Indexer {
+  indexerShortName = "go",
+  indexerDescription = "Index Go code",
+  indexerOptParser = options,
+  indexerRun = \Go{..} backend repo IndexerParams{..} -> do
+    forM_ goPackagesDriverBinary (setEnv "GOPACKAGESDRIVER")
+    val <- SCIP.runIndexer SCIP.ScipIndexerParams {
+        scipBinary = scipGoBinary,
+        scipArgs = \outFile ->
+           ["--module-version=glean", "--no-animation", "-o", outFile ]
+           ++ scipExtraArgs,
+        scipRoot = indexerRoot,
+        scipWritesLocal = False,
+        scipLanguage = Just SCIP.Go
+      }
+    sendJsonBatches backend repo (scipGoBinary <> "/scip") val
+    derive backend repo
+  }
diff --git a/glean/lang/hack/Derive/All.hs b/glean/lang/hack/Derive/All.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Derive/All.hs
@@ -0,0 +1,22 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Derive.All
+  (derive)
+  where
+
+import Glean (Backend)
+import Derive.Types (Config)
+import Derive.Env (withEnv)
+import Derive.HackDeclarationTarget (deriveHackDeclarationTarget)
+
+-- | Programatically derive predicates after an indexer run
+derive :: Backend e => e -> Config -> IO ()
+derive backend config =
+  withEnv config backend $ \env -> do
+    deriveHackDeclarationTarget env
diff --git a/glean/lang/hack/Derive/Env.hs b/glean/lang/hack/Derive/Env.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Derive/Env.hs
@@ -0,0 +1,41 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+module Derive.Env
+  ( Env(..)
+  , withEnv
+  , withEnvWriter
+  ) where
+
+import Glean (Backend)
+import qualified Glean.Schema.Hack as Hack
+import Glean.Util.Some
+import Glean.Write.SimpleAsync
+
+import Derive.Types
+
+data Env = Env
+  { envConfig :: Config
+  , envBackend :: Some Backend
+  , envSender :: Sender
+  , envWriterSettings :: WriterSettings
+  }
+
+withEnv :: Backend e => Config -> e -> (Env -> IO a) -> IO a
+withEnv cfg be action =
+  withSimpleSender be (cfgRepo cfg) [Hack.allPredicates] (cfgSendQueue cfg)
+    $ \sender -> action Env
+    { envConfig = cfg
+    , envBackend = Some be
+    , envSender = sender
+    , envWriterSettings = cfgWriter cfg
+    }
+
+withEnvWriter :: Env -> (Writer -> IO a) -> IO a
+withEnvWriter env = withSimpleWriter (envSender env) (envWriterSettings env)
diff --git a/glean/lang/hack/Derive/HackDeclarationTarget.hs b/glean/lang/hack/Derive/HackDeclarationTarget.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Derive/HackDeclarationTarget.hs
@@ -0,0 +1,258 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module Derive.HackDeclarationTarget
+  ( deriveHackDeclarationTarget
+  ) where
+
+import Prelude hiding (span)
+
+import Control.Concurrent (getNumCapabilities)
+import Control.Concurrent.Async
+import Control.Concurrent.STM
+import Control.DeepSeq
+import Control.Exception
+import Control.Monad
+import qualified Data.Int as Int
+import qualified Data.IntervalMap.Generic.Strict as IM
+import Data.Maybe
+import Data.List (foldl')
+import Data.List.Extra (chunksOf)
+import Util.Log (logInfo)
+
+import Glean
+import Glean.Angle as Angle
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Util.PredMap (PredMap)
+import qualified Glean.Util.PredMap as PredMap
+import Glean.Util.Mutex
+
+import Derive.Env
+import Derive.Types
+
+type TargetSpans = IM.IntervalMap ByteSpan [Hack.Declaration]
+type Files = PredMap Src.File ()
+type Sources = PredMap Src.File [(Hack.Declaration, ByteSpan)]
+type Targets = PredMap Src.File [[TargetSpans]]
+
+newtype ByteSpan = ByteSpan Src.ByteSpan
+  deriving (Eq, Ord, Show)
+
+instance IM.Interval ByteSpan Int.Int64 where
+  lowerBound (ByteSpan bs) = unNat $ Src.byteSpan_start bs
+  upperBound (ByteSpan bs) =
+    unNat (Src.byteSpan_start bs) +
+    unNat (Src.byteSpan_length bs)
+  leftClosed _ = True -- The interval contains the start value
+  rightClosed _ = False -- The interval does not contain start + length
+
+getFilesQuery :: Query Hack.FileXRefs
+getFilesQuery = Angle.query $ Angle.predicate @Hack.FileXRefs Angle.wild
+
+getSourcesQuery :: [IdOf Src.File] -> Query Hack.DeclarationSpan
+getSourcesQuery files =
+  Angle.query $ Angle.vars $ \x file decls decl -> x `Angle.where_`
+  [ file .= Angle.elementsOf (Angle.array $ map Angle.factId files)
+  , wild .= Angle.predicate @Hack.FileDeclarations  (
+      rec $
+        field @"file" (asPredicate file) $
+        field @"declarations" decls
+      end
+    )
+  , decl .= Angle.elementsOf decls
+  , x .= Angle.predicate @Hack.DeclarationSpan (
+      rec $
+        field @"declaration" decl $
+        field @"file" (asPredicate file)
+      end
+    )
+  ]
+
+getTargetsQuery :: [IdOf Src.File] ->  Query Hack.FileXRefs
+getTargetsQuery files =
+  Angle.query $ Angle.vars $ \x file -> x `Angle.where_`
+  [ file .= Angle.elementsOf (Angle.array $ map Angle.factId files)
+  , x .= Angle.predicate @Hack.FileXRefs (
+      rec $
+        field @"file" (asPredicate file)
+      end
+    )
+  ]
+
+getFiles
+  :: (Backend e)
+  => e
+  -> Config
+  -> IO Files
+getFiles e cfg =
+  runQueryEach e (cfgRepo cfg) keysQuery mempty $ \ pm p -> do
+    return $! PredMap.insert (getId $ Hack.fileXRefs_key_file p) () pm
+  where
+      keysQuery = limitBytes (cfgMaxQuerySize cfg) $ keys getFilesQuery
+
+loadPredMap
+  :: (Backend e, Predicate p)
+  => e
+  -> Config
+  -> Query p
+  -> (KeyType p -> (IdOf k, v))
+  -> IO (PredMap k [v])
+loadPredMap e cfg q f =
+  runQueryEach e (cfgRepo cfg) keysQuery mempty $ \ pm p -> do
+    let (k, v) = f p
+    return $! PredMap.alter (Just . maybe [v] (v :)) k pm
+    where
+      keysQuery = limitBytes (cfgMaxQuerySize cfg) $ keys q
+
+getSources :: Backend e => e -> Config -> [IdOf Src.File] -> IO Sources
+getSources e cfg files = do
+  loadPredMap e cfg (getSourcesQuery files) f
+  where
+    f key = (getId file, (declaration, ByteSpan span))
+      where
+        file = Hack.declarationSpan_key_file key
+        declaration = Hack.declarationSpan_key_declaration key
+        span = Hack.declarationSpan_key_span key
+
+getTargets :: Backend e => e -> Config -> [IdOf Src.File] -> IO Targets
+getTargets e cfg files = do
+  loadPredMap e cfg (getTargetsQuery files) f
+  where
+    f key = (getId file, targets)
+      where
+        file = Hack.fileXRefs_key_file key
+        xrefs = Hack.fileXRefs_key_xrefs key
+        targets = mapMaybe target xrefs
+        target xref = case Hack.xRef_target xref of
+          Hack.XRefTarget_declaration decl ->
+            let spans = Hack.xRef_ranges xref
+                (_, im) = foldl' (buildIntervalMap decl) (0, IM.empty) spans
+            in Just im
+          Hack.XRefTarget_occurrence _ -> Nothing
+          Hack.XRefTarget_EMPTY -> Nothing
+        buildIntervalMap
+          :: Hack.Declaration
+          -> (Int.Int64, TargetSpans)
+          -> Src.RelByteSpan
+          -> (Int.Int64, TargetSpans)
+        buildIntervalMap decl (offset, im) span =
+            (nextOffset, IM.insert byteSpan [decl] im)
+          where
+            (nextOffset, byteSpan) = relToAbsolute offset span
+        relToAbsolute offset rel =
+          (start, ByteSpan $ Src.ByteSpan (Nat start) len)
+          where
+            start = unNat (Src.relByteSpan_offset rel) + offset
+            len = Src.relByteSpan_length rel
+
+declarationTargetsForFile
+  :: (Sources, Targets)
+  -> IdOf Src.File
+  -> [Hack.DeclarationTarget_key]
+declarationTargetsForFile (sources, targets) fileId =
+  declTargets
+  where
+    sourceList = PredMap.findWithDefault [] fileId sources
+    targetList = PredMap.findWithDefault [] fileId targets
+    targetIm = IM.unionsWith (++) $ concat targetList
+    declTargets = concatMap (declarationTargetsForSource targetIm) sourceList
+
+declarationTargetsForSource
+  :: TargetSpans
+  -> (Hack.Declaration, ByteSpan)
+  -> [Hack.DeclarationTarget_key]
+declarationTargetsForSource targetSpans (source, sourceSpan) =
+  map (Hack.DeclarationTarget_key source) targets
+  where
+    targets = concatMap snd $ IM.toList targetsIm
+    targetsIm = targetSpans `IM.within` sourceSpan
+
+writeHackDeclarationTargets
+  :: Writer -> TBQueue (Maybe [Hack.DeclarationTarget_key]) -> IO ()
+writeHackDeclarationTargets writer tbqueue = do
+  next <- atomically $ readTBQueue tbqueue
+  case next of
+    Nothing -> return ()
+    Just declTargets -> do
+      forM_ declTargets $ \declTarget -> writeFacts writer $
+        makeFact_ @Hack.DeclarationTarget declTarget
+      writeHackDeclarationTargets writer tbqueue
+
+
+writeChunkedParallelMap
+  :: (NFData b)
+  => Int
+  -> TBQueue (Maybe [b])
+  -> ((Int,[a]) -> IO ctx)
+  -> (ctx -> a -> [b])
+  -> [a]
+  -> IO ()
+writeChunkedParallelMap nchunks tbqueue chunkCtx f xs = do
+  logInfo $ "calculating " ++ show nchunks ++ " chunks for "
+    ++ show (length xs) ++ " inputs"
+  mutex <- newMutex ()
+  forConcurrently_ (zip [1..] chunks) $ \(i, chunk) -> do
+    -- Use mutex to avoid many queries in flight at once
+    ctx <- withMutex_ mutex $ chunkCtx (i, chunk)
+    ys <- evaluate $ force $ Just $ concatMap (f ctx) chunk
+    atomically $ writeTBQueue tbqueue ys
+    logInfo $ "calculated chunk " ++ show (i::Int)
+  where
+    chunks = chunksOf (max 1 chunkSize) xs
+    chunkSize = (len + nchunks - 1) `div` nchunks
+    len = length xs
+
+deriveHackDeclarationTarget
+  :: Env
+  -> IO ()
+deriveHackDeclarationTarget env@Env{..} = do
+  numCapabilities <- getNumCapabilities
+  logInfo "deriving HackDeclarationTarget"
+  files <- getFiles envBackend envConfig
+  logInfo "Got files"
+  tbqueue :: TBQueue (Maybe [Hack.DeclarationTarget_key]) <-
+    atomically $ newTBQueue (fromIntegral $ cfgMaxQueueSize envConfig)
+  if null files
+  then do
+    logInfo "no file facts found - skipping"
+    return ()
+  else do
+    let
+      contextFor (i, fileIds) = do
+        (sources, targets) <- concurrently
+           (getSources envBackend envConfig fileIds
+              >>= done ("Chunk " <> show i <> " got sources"))
+           (getTargets envBackend envConfig fileIds
+              >>= done ("Chunk " <> show i <> " got targets"))
+        return (sources, targets)
+
+      calcDeclTargets = do
+        writeChunkedParallelMap
+          nchunks
+          tbqueue
+          contextFor
+          declarationTargetsForFile
+          (PredMap.keys files)
+        atomically $ writeTBQueue tbqueue Nothing
+        where
+          nchunks = max 1 $ numCapabilities * cfgChunksPerCapability envConfig
+
+      writeDeclTargets =
+        withEnvWriter env $ \writer ->
+          writeHackDeclarationTargets writer tbqueue
+
+    ((), ()) <- runConcurrently $ (,)
+      <$> Concurrently
+           ( calcDeclTargets >>= done "calculated declaration targets")
+      <*> Concurrently
+            (writeDeclTargets >>= done "written facts")
+    return ()
+  where
+    done msg x = logInfo msg >> return x
diff --git a/glean/lang/hack/Derive/Types.hs b/glean/lang/hack/Derive/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Derive/Types.hs
@@ -0,0 +1,104 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module Derive.Types
+  ( Config(..)
+  , options
+  , defaultConfig
+  , Command(..)
+  ) where
+
+import Data.Default
+import qualified Options.Applicative as O
+
+import qualified Glean
+import qualified Glean.Remote
+import qualified Glean.Types as Thrift (Repo)-- gen
+
+-- | Configuration options for "Derive" and its passes
+data Config = Config
+  { cfgRepo :: Thrift.Repo
+  , cfgNumCapabilities :: Maybe Int  -- ^ override @+RTS -Nx -RTS@
+  , cfgMaxQueryFacts :: Maybe Int
+  , cfgMaxQuerySize :: Int
+  , cfgSendQueue :: Glean.SendQueueSettings
+  , cfgWriter :: Glean.WriterSettings
+  , cfgChunksPerCapability :: Int  -- ^ units of work per worker
+  , cfgMaxQueueSize :: Int
+  }
+
+defaultConfig :: Thrift.Repo -> Config
+defaultConfig repo = Config
+  { cfgRepo = repo
+  , cfgNumCapabilities =  Nothing
+  , cfgMaxQueryFacts = Nothing
+  , cfgMaxQuerySize = defaultMaxQuerySize
+  , cfgSendQueue = def
+  , cfgWriter = def
+  , cfgChunksPerCapability = defaultChunksPerCapability
+  , cfgMaxQueueSize = defaultMaxQueueSize
+  }
+
+defaultMaxQuerySize  :: Int
+defaultMaxQuerySize = 30000000
+
+defaultChunksPerCapability :: Int
+defaultChunksPerCapability = 5
+
+defaultMaxQueueSize :: Int
+defaultMaxQueueSize = 500
+
+data Command
+    = Derive (Config, Glean.ThriftSource Glean.ClientConfig)
+    | SchemaId
+
+-- | Command-line argument parser for "Derive" to get 'Config'
+options :: O.ParserInfo Command
+options = O.info (O.helper <*> (parserDerive O.<|> parserSchemaId)) O.fullDesc
+  where
+    parserSchemaId :: O.Parser Command
+    parserSchemaId =
+        O.flag' SchemaId (O.long "schema-id" <> O.help "display schema-id")
+
+    parserDerive :: O.Parser Command
+    parserDerive = Derive <$> ((,) <$> config <*> Glean.Remote.options)
+
+    config  :: O.Parser Config
+    config = do
+      cfgRepo <- Glean.readRepo "/" <$> O.strOption
+        (  O.long "repo"
+        <> O.metavar "REPO"
+        <> O.help "repo DB (default: use latest complete DB)" )
+      cfgNumCapabilities <- O.optional $ O.option O.auto $
+        O.long "num-capabilities"
+        <> O.metavar "N"
+        <> O.help "optionally override +RTS -Nx -RTS"
+      cfgMaxQueryFacts <- O.optional $ O.option O.auto $
+        O.long "max-query-facts"
+        <> O.metavar "N"
+        <> O.help "maximum number of facts to query in one step"
+      cfgMaxQuerySize <- O.option O.auto $
+        O.long "max-query-size"
+        <> O.metavar "N"
+        <> O.value defaultMaxQuerySize
+        <> O.help "maximum number of bytes to query in one step"
+      cfgSendQueue <- Glean.sendQueueOptions
+      cfgWriter <- Glean.writerOptions
+      cfgChunksPerCapability <- O.option O.auto $
+        O.long "chunks-per-capability"
+        <> O.metavar "N"
+        <> O.value defaultChunksPerCapability
+        <> O.help "units of work per worker"
+      cfgMaxQueueSize <- O.option O.auto $
+        O.long "max-queue-size"
+        <> O.metavar "N"
+        <> O.value defaultMaxQueueSize
+        <> O.help "maximum chunks stored in TBQueue"
+      return Config{..}
diff --git a/glean/lang/hack/Glean/Indexer/Hack.hs b/glean/lang/hack/Glean/Indexer/Hack.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Glean/Indexer/Hack.hs
@@ -0,0 +1,110 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Hack ( indexer, Hack(..) ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+
+data Hack = Hack
+  { hackBinary :: FilePath
+  , hackWriteRoot :: String
+  , hackOnly :: Maybe String
+  }
+
+options :: Parser Hack
+options = do
+  hackBinary <- strOption $
+    long "hack" <>
+    value "hh_server" <>
+    help "path to the hh_server binary"
+  hackWriteRoot <- strOption $
+    long "symbol-write-root-path" <>
+    value "www" <>
+    help "prefix to add to source file paths in the DB"
+  hackOnly <- optional $ strOption $
+    long "only-index" <>
+    help "comma-separated list of files to index (otherwise all)"
+  return Hack{..}
+
+indexer :: Indexer Hack
+indexer = Indexer {
+  indexerShortName = "hack",
+  indexerDescription = "Index Hack code",
+  indexerOptParser = options,
+  indexerRun = \Hack{..} -> do
+    let ext = Ext {
+          extRunScript = hackBinary,
+          extFlavour = Json,
+          extArgs =
+            [ "${TEST_ROOT}"
+            , "--write-symbol-info"
+            , "${JSON_BATCH_DIR}"
+            ] <> hhConfig,
+          extDerivePredicates =
+            [ "hack.NameLowerCase" -- retire me
+            , "hack.AttributeToDefinition"
+            , "hack.AttributeHasParameter"
+            , "hack.NamespaceMember"
+            , "hack.ContainerParent"
+            , "hack.ContainerChild"
+            , "hack.ModuleChild"
+            , "hack.MethodOverridden"
+            , "hack.TargetUses"
+            , "hack.AttributeToDeclaration"
+            , "hack.ThriftToHack"
+            -- new search predicates replacing hack.NameLowerCase
+            , "hack.SearchClassConstByName"
+            , "hack.SearchClassConstByLowerCaseName"
+            , "hack.SearchEnumeratorByName"
+            , "hack.SearchEnumeratorByLowerCaseName"
+            , "hack.SearchMethodByName"
+            , "hack.SearchMethodByLowerCaseName"
+            , "hack.SearchPropertyByName"
+            , "hack.SearchPropertyByLowerCaseName"
+            , "hack.SearchTypeConstByName"
+            , "hack.SearchTypeConstByLowerCaseName"
+            , "hack.SearchModuleByName"
+            , "hack.SearchModuleByLowerCaseName"
+            , "hack.SearchClassByName"
+            , "hack.SearchClassByLowerCaseName"
+            , "hack.SearchInterfaceByName"
+            , "hack.SearchInterfaceByLowerCaseName"
+            , "hack.SearchTraitByName"
+            , "hack.SearchTraitByLowerCaseName"
+            , "hack.SearchEnumByName"
+            , "hack.SearchEnumByLowerCaseName"
+            , "hack.SearchFunctionByName"
+            , "hack.SearchFunctionByLowerCaseName"
+            , "hack.SearchGlobalConstByName"
+            , "hack.SearchGlobalConstByLowerCaseName"
+            , "hack.SearchTypedefByName"
+            , "hack.SearchTypedefByLowerCaseName"
+            , "hack.SearchNamespaceByName"
+            , "hack.SearchNamespaceByLowerCaseName"
+            ]
+        }
+
+        hhConfig = concatMap (\x -> ["--config", x]) $
+          [ "symbol_write_include_hhi=false"
+          , "symbol_write_root_path=" <> hackWriteRoot
+          , "symbolindex_search_provider=NoIndex"
+          , "lazy_decl=true"
+          , "lazy_parse=true"
+          , "lazy_init2=true"
+          , "symbol_write_sym_hash_out=true"
+          ] <>
+          (case hackOnly of
+            Nothing -> []
+            Just paths -> ["symbol_write_index_paths=" <> paths])
+
+    indexerRun externalIndexer ext
+  }
diff --git a/glean/lang/hack/Glean/Indexer/HackWithDeriver.hs b/glean/lang/hack/Glean/Indexer/HackWithDeriver.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/Glean/Indexer/HackWithDeriver.hs
@@ -0,0 +1,25 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Indexer.HackWithDeriver (indexer) where
+
+import Derive.Env (withEnv)
+import Derive.HackDeclarationTarget (deriveHackDeclarationTarget)
+import qualified Derive.Types as DT
+import Glean.Derive
+import Glean.Indexer
+import qualified Glean.Indexer.Hack as Hack
+import Glean.Write
+
+indexer :: Indexer Hack.Hack
+indexer =
+  Hack.indexer `indexerThen` \_opts env repo _params -> do
+    withEnv (DT.defaultConfig repo) env
+      deriveHackDeclarationTarget
+    derivePredicate env repo Nothing Nothing
+      (parseRef "hack.DeclarationSource") Nothing
diff --git a/glean/lang/hack/deriver/Derive.hs b/glean/lang/hack/deriver/Derive.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/deriver/Derive.hs
@@ -0,0 +1,46 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Derive
+  ( main
+  ) where
+
+import Control.Concurrent (setNumCapabilities)
+
+import Util.EventBase (withEventBaseDataplane)
+
+import Glean.Init ( withOptions )
+import qualified Glean.Remote
+import Glean.Util.ConfigProvider
+import Glean.Impl.ConfigProvider
+import Glean.Schema.Builtin.Types (schema_id)
+
+import Derive.Types
+import Derive.All
+
+import Data.Aeson as J
+import Data.Aeson.Encode.Pretty as J
+import qualified Data.ByteString.Lazy.Char8 as BS
+
+withNumCapabilities :: Maybe Int -> IO a -> IO a
+withNumCapabilities Nothing act = act
+withNumCapabilities (Just n) act = setNumCapabilities n >> act
+
+main :: IO ()
+main = withOptions options $ \cmd ->
+  case cmd of
+    SchemaId ->
+      putStrLn $ BS.unpack $ J.encodePretty $
+        J.object ["schema_id" J..= J.toJSON schema_id]
+    Derive (cfg, service) ->
+      withNumCapabilities (cfgNumCapabilities cfg) $
+      withEventBaseDataplane $ \evb ->
+      withConfigProvider defaultConfigOptions $ \cfgAPI ->
+      Glean.Remote.withRemoteBackend evb (cfgAPI::ConfigAPI)
+        service Nothing $ \be ->
+          Derive.All.derive be cfg
diff --git a/glean/lang/hack/tests/Driver.hs b/glean/lang/hack/tests/Driver.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/tests/Driver.hs
@@ -0,0 +1,18 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Driver
+  ( main
+  ) where
+
+import Glean.Indexer.HackWithDeriver (indexer)
+import Glean.Regression.Snapshot (testMain)
+import Glean.Regression.Snapshot.Driver
+
+main :: IO ()
+main = testMain (driverFromIndexer indexer)
diff --git a/glean/lang/hack/tests/Main.hs b/glean/lang/hack/tests/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/hack/tests/Main.hs
@@ -0,0 +1,18 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Main ( main ) where
+
+import System.Environment ( withArgs )
+
+import qualified Driver ( main )
+
+main :: IO ()
+main = withArgs ["--root", path] Driver.main
+  where
+    path = "glean/lang/hack/tests/cases"
diff --git a/glean/lang/haskell/Glean/Indexer/Haskell.hs b/glean/lang/haskell/Glean/Indexer/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/haskell/Glean/Indexer/Haskell.hs
@@ -0,0 +1,87 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Haskell (
+  indexer,
+) where
+
+import Options.Applicative
+import System.Directory
+import System.FilePath
+import System.Process
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Util.IO
+
+data Haskell = Haskell
+  { haskellBinary :: FilePath
+  , haskellGhc :: Maybe FilePath
+  , haskellSrcs :: [FilePath]
+  }
+
+options :: Parser Haskell
+options = do
+  haskellBinary <-strOption
+    ( long "hie-indexer"
+        <> value "hie-indexer"
+        <> metavar "PATH"
+        <> showDefault
+        <> help "path to the hie-indexer binary"
+    )
+  haskellGhc <- optional $ strOption
+    ( long "with-ghc"
+        <> metavar "PATH"
+        <> help ("GHC to invoke to generate .hie files " <>
+             " (otherwise read existing .hie files)")
+    )
+  haskellSrcs <- many (strOption (long "src"))
+  return Haskell{..}
+
+indexer :: Indexer Haskell
+indexer =
+  Indexer
+    { indexerShortName = "haskell-hie"
+    , indexerDescription = "Index Haskell code"
+    , indexerOptParser = options
+    , indexerRun = \Haskell {..} backend repo params -> do
+        hieDir <- case haskellGhc of
+          Just ghc -> do
+            let isHs = (== ".hs") . takeExtension
+            root <- makeRelativeToCurrentDirectory (indexerRoot params)
+            srcs <- filter isHs <$> listDirectoryRecursive root
+            let out = indexerOutput params </> "ghc-out"
+            callProcess ghc $ [
+              "--make",
+              "-c",
+              "-fwrite-ide-info",
+              "-outputdir", out
+              ] <> srcs
+            return out
+          Nothing -> return (indexerRoot params)
+        let ext =
+              Ext
+                { extRunScript = haskellBinary
+                , extFlavour = Server
+                , extArgs =
+                    [ "--service"
+                    , "${GLEAN_SERVER}"
+                    , "--repo-name"
+                    , "${TEST_REPO_NAME}"
+                    , "--repo-hash"
+                    , "${TEST_REPO_HASH}"
+                    , hieDir
+                    ] <> [ "--src=" <> f | f <- haskellSrcs ]
+                , extDerivePredicates = [
+                    "hs.OccNameLowerCase",
+                    "hs.SourceModule"
+                  ]
+                }
+        indexerRun externalIndexer ext backend repo params
+    }
diff --git a/glean/lang/haskell/HieIndexer/Index.hs b/glean/lang/haskell/HieIndexer/Index.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/haskell/HieIndexer/Index.hs
@@ -0,0 +1,766 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE TypeApplications #-}
+module HieIndexer.Index (indexHieFile) where
+
+import Control.Applicative
+import Control.Monad
+import qualified Control.Monad.State.Strict as State
+import Control.Monad.Writer.Strict as Writer
+import Control.Monad.Trans.Maybe
+import qualified Data.Array as A
+import Data.Char
+import Data.Default
+import Data.IntMap (IntMap)
+import qualified Data.IntMap as IntMap
+import Data.List (foldl')
+import Data.List.NonEmpty (NonEmpty)
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+#if MIN_VERSION_ghc(9,6,0)
+import Data.Monoid (First(..), getFirst)
+#endif
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Vector.Unboxed as Vector
+import HieDb.Compat (nameModule_maybe, nameOccName)
+import System.Directory
+import System.FilePath
+import Control.Monad.Extra (findM, whenJust, mapMaybeM)
+
+import qualified GHC
+import qualified GHC.Types.Avail as GHC (availNames)
+import qualified GHC.Types.Basic as GHC (TupleSort(..))
+#if !MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Types.Basic as GHC (isPromoted)
+#endif
+import qualified GHC.Iface.Type as GHC (
+  IfaceTyLit(..), IfaceTyConSort(..), IfaceTyCon(..), IfaceTyConInfo(..))
+import GHC.Iface.Ext.Utils (generateReferencesMap, emptyNodeInfo, flattenAst)
+import GHC.Iface.Ext.Types
+import qualified GHC.Types.Name.Occurrence as GHC
+import qualified GHC.Types.Name as GHC (isSystemName, nameOccName)
+#if MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Types.Var as GHC (ForAllTyFlag(..), Specificity(..))
+#else
+import qualified GHC.Types.Var as GHC (ArgFlag(..), Specificity(..))
+#endif
+import GHC.Unit.Types (unitFS)
+#if !MIN_VERSION_ghc(9,6,0)
+import qualified GHC.Unit.Module.Name as GHC (moduleNameFS)
+#endif
+import qualified GHC.Data.FastString as GHC (FastString, bytesFS, mkFastString)
+
+import Util.Log
+
+import qualified Glean
+import Glean.Impl.ConfigProvider ()
+import qualified Glean.Schema.Hs.Types as Hs
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Util.Range
+
+{- TODO
+
+- issues with record fields
+  - DuplicateRecordFields generates names like $sel:field:Rec
+  - weird references to the record constructor from field decls
+  - why do we get a ref for the field decl?
+
+- types
+  - types on constructors
+    - no identType on the ConDec
+  - types on methods
+    - also no identType?
+  - types on refs? not supported by Glass
+  - types of foreign imports? Seems missing from Hie
+
+- declarations
+  - check that GADT data types work properly, including with record fields
+  - class defaults
+  - instance methods
+  - doing this properly is a lot of work, and it's hard to get this
+    info from Hie. A possible way to do this is using the Haddock API:
+    Haddock's Interface type has all the ASTs for the declarations
+    in addition to the Hie.
+
+- map Name to exportedness?
+
+- exclude generated names in a cleaner way
+
+- Glass / codemarkup
+  - search by scope
+  - should modules be symbols?
+  - SymbolKind, Visibility, etc.
+  - full signatures for symbols (needs declarations)
+  - Haddock docs for symbol
+-}
+
+mkModule :: Glean.NewFact m => GHC.Module -> m Hs.Module
+mkModule mod = do
+  modname <- Glean.makeFact @Hs.ModuleName $
+    fsToText (GHC.moduleNameFS (GHC.moduleName mod))
+  unitname <- Glean.makeFact @Hs.UnitName $
+    fsToText (unitFS (GHC.moduleUnit mod))
+  Glean.makeFact @Hs.Module $
+    Hs.Module_key modname unitname
+
+mkName :: Glean.NewFact m => GHC.Name -> Hs.Module -> Hs.NameSort -> m Hs.Name
+mkName name mod sort = do
+  let occ = nameOccName name
+  occFact <- Glean.makeFact @Hs.OccName $
+    Hs.OccName_key (fsToText (GHC.occNameFS occ)) (toNamespace occ)
+  Glean.makeFact @Hs.Name $
+    Hs.Name_key occFact mod sort
+
+srcSpanToSrcRange :: Src.File -> GHC.RealSrcSpan -> Src.Range
+srcSpanToSrcRange file sp =
+  Src.Range file
+    (Glean.Nat $ fromIntegral $ GHC.srcSpanStartLine sp)
+    (Glean.Nat $ fromIntegral $ GHC.srcSpanStartCol sp)
+    (Glean.Nat $ fromIntegral $ GHC.srcSpanEndLine sp)
+    (Glean.Nat $ fromIntegral $ GHC.srcSpanEndCol sp - 1)
+    -- GHC.RealSrcSpan is exclusive while Src.Range is inclusive, so
+    -- we subtract one from the end column when converting.
+
+fsToText :: GHC.FastString -> Text
+fsToText = Text.decodeUtf8 . GHC.bytesFS
+
+toNamespace :: GHC.OccName -> Hs.Namespace
+toNamespace occ
+  | GHC.isVarOcc occ = Hs.Namespace_var_
+  | GHC.isTvOcc occ = Hs.Namespace_tyvar
+  | GHC.isTcOcc occ = Hs.Namespace_tycon
+  | GHC.isDataOcc occ = Hs.Namespace_datacon
+  | otherwise = error "toNamespace"
+
+isRecFieldRef :: RecFieldContext -> Bool
+isRecFieldRef RecFieldAssign = True
+isRecFieldRef RecFieldMatch = True
+isRecFieldRef RecFieldOcc = True
+isRecFieldRef _ = False
+
+produceDecl
+ :: Glean.NewFact m
+ => Map (Glean.IdOf Hs.Name) Hs.SigDecl
+ -> Hs.Name
+ -> Maybe Hs.Type
+ -> ContextInfo
+ -> m ()
+produceDecl sigMap name maybeTy ctx = case ctx of
+  ValBind RegularBind _ _ ->
+    Glean.makeFact_ @Hs.ValBind $
+      Hs.ValBind_key name maybeTy (Map.lookup (Glean.getId name) sigMap)
+  Decl FamDec _ ->
+    Glean.makeFact_ @Hs.TypeFamilyDecl $ Hs.TypeFamilyDecl_key name
+  Decl SynDec _ ->
+    Glean.makeFact_ @Hs.TypeSynDecl $ Hs.TypeSynDecl_key name
+  Decl PatSynDec _ ->
+    Glean.makeFact_ @Hs.PatSynDecl $ Hs.PatSynDecl_key name
+  PatternBind{} ->
+    Glean.makeFact_ @Hs.PatBind $ Hs.PatBind_key name maybeTy
+  TyVarBind{} ->
+    Glean.makeFact_ @Hs.TyVarBind $ Hs.TyVarBind_key name
+  -- moved to produceDeclInfo:
+  ClassTyDecl{} -> return ()
+  RecField{} -> return ()
+  Decl DataDec _ -> return ()
+  Decl ConDec _ -> return ()
+  Decl ClassDec _ -> return ()
+  _ -> return ()
+
+produceDeclInfo
+  :: forall m . (Monad m, Glean.NewFact m)
+  => Src.File
+  -> (GHC.RealSrcSpan -> Src.ByteSpan)
+  -> (GHC.Name -> m (Maybe Hs.Name))
+  -> [DeclInfo]
+  -> m (Map (Glean.IdOf Hs.Name) Hs.SigDecl)
+produceDeclInfo fileFact toByteSpan getName_ infos =
+  fmap snd $ runWriterT $ mapM (runMaybeT . makeDecl) infos
+  where
+  glean = lift . lift
+
+  -- failure to lookup a Name will cause this DeclInfo to be ignored
+  getName name = MaybeT $ lift $ getName_ name
+
+  makeDecl
+    :: DeclInfo
+    -> MaybeT (WriterT (Map (Glean.IdOf Hs.Name) Hs.SigDecl) m) ()
+  makeDecl info =
+    case info of
+      SigDecl { sigDeclName = name, sigDeclSpan = span } -> do
+        hsName <- getName name
+        decl <- glean $ Glean.makeFact @Hs.SigDecl $
+          Hs.SigDecl_key hsName (
+            Src.FileLocation fileFact (toByteSpan span))
+        -- collect SigDecls using WriterT
+        Writer.tell (Map.singleton (Glean.getId hsName) decl)
+      DataDecl { dataDeclName = name, dataDeclConstrs = cs } -> do
+        hsName <- getName name
+        cons <- forM cs $ \(ConstrInfo cName fields) -> do
+          hsCName <- getName cName
+          fNames <- mapM getName fields
+          fDecls <- forM fNames $ \fName ->
+            glean $ Glean.makeFact @Hs.RecordFieldDecl $
+              Hs.RecordFieldDecl_key fName hsCName
+          glean $ Glean.makeFact @Hs.ConstrDecl $
+            Hs.ConstrDecl_key hsCName hsName fDecls
+        glean $ Glean.makeFact_ @Hs.DataDecl $
+          Hs.DataDecl_key hsName cons
+      ClassDecl {
+          classDeclName = name,
+          classDeclMethods = meths,
+          classDeclDefaults = defs } -> do
+        hsName <- getName name
+        mNames <- mapM getName meths
+        mDecls <- forM mNames $ \mName ->
+          glean $ Glean.makeFact @Hs.MethDecl $
+            Hs.MethDecl_key mName hsName
+        defaults <- mapM makeInstBind defs
+        decl <- glean $ Glean.makeFact @Hs.ClassDecl $
+          Hs.ClassDecl_key hsName mDecls defaults
+        forM_ defaults $ \bind ->
+          glean $ Glean.makeFact_ @Hs.InstanceBindToDecl $
+            Hs.InstanceBindToDecl_key bind
+              (Hs.InstanceBindToDecl_decl_class_ decl)
+      InstDecl {
+          instanceDeclBinds = instBinds,
+          instanceDeclSpan = span } -> do
+        binds <- mapM makeInstBind instBinds
+        decl <- glean $ Glean.makeFact @Hs.InstDecl $
+          Hs.InstDecl_key binds
+            (Src.FileLocation fileFact (toByteSpan span))
+        forM_ binds $ \bind ->
+          glean $ Glean.makeFact_ @Hs.InstanceBindToDecl $
+            Hs.InstanceBindToDecl_key bind
+              (Hs.InstanceBindToDecl_decl_inst decl)
+
+  makeInstBind InstanceBindInfo{..} = do
+    meth <- getName instBindMeth
+    glean $ Glean.makeFact @Hs.InstanceBind $
+      Hs.InstanceBind_key meth {-(IntMap.lookup instBindTy typeMap)-}
+        (Src.FileLocation fileFact (toByteSpan instBindSpan))
+
+nat :: Integral a => a -> Glean.Nat
+nat = Glean.toNat . fromIntegral
+
+indexTypes
+  :: forall m . (MonadFail m, Monad m, Glean.NewFact m)
+  => A.Array TypeIndex HieTypeFlat
+  -> m (IntMap Hs.Type)
+indexTypes typeArr = foldM go IntMap.empty (A.assocs typeArr)
+  where
+  go tymap (n,ty) = do
+    fact <- mkTy ty
+    return (IntMap.insert n fact tymap)
+    where
+    mkTy ty = case ty of
+      HTyVarTy n ->
+        Glean.makeFact @Hs.Type $ Hs.Type_key_tyvar $
+          fsToText (GHC.occNameFS (GHC.nameOccName n))
+      HAppTy a (HieArgs args) -> do
+        ta <- get a
+        targs <- mapM mkTyArg args
+        Glean.makeFact @Hs.Type $ Hs.Type_key_app $ Hs.Type_app_ ta targs
+      HLitTy l -> do
+        tl <- case l of
+          GHC.IfaceNumTyLit i ->
+            Glean.makeFact @Hs.LitType $
+              Hs.LitType_key_num (nat i)
+          GHC.IfaceStrTyLit fs ->
+            Glean.makeFact @Hs.LitType $
+              Hs.LitType_key_str (fsToText fs)
+          GHC.IfaceCharTyLit c ->
+            Glean.makeFact @Hs.LitType $
+              Hs.LitType_key_chr (nat (ord c))
+        Glean.makeFact @Hs.Type $ Hs.Type_key_lit tl
+      HForAllTy ((n,k),af) t -> do
+        let name = fsToText (GHC.occNameFS (GHC.nameOccName n))
+        tt <- get t
+        kt <- get k
+        let flag = case af of
+              GHC.Invisible spec ->
+                Hs.ArgFlag_invisible $ case spec of
+                  GHC.InferredSpec -> Hs.Specificity_inferred
+                  GHC.SpecifiedSpec -> Hs.Specificity_specified
+              GHC.Required ->
+                Hs.ArgFlag_requird def
+        Glean.makeFact @Hs.Type $ Hs.Type_key_forall $
+          Hs.Type_forall_ name kt flag tt
+      HFunTy w a b -> do
+        wt <- get w
+        ta <- get a
+        tb <- get b
+        Glean.makeFact @Hs.Type $ Hs.Type_key_fun $ Hs.Type_fun_ wt ta tb
+      HQualTy pred b -> do
+        predt <- get pred
+        tb <- get b
+        Glean.makeFact @Hs.Type $ Hs.Type_key_qual $ Hs.Type_qual_ predt tb
+      HCastTy a -> do
+        ta <- get a
+        Glean.makeFact @Hs.Type $ Hs.Type_key_cast ta
+      HCoercionTy -> Glean.makeFact @Hs.Type $ Hs.Type_key_coercion def
+      HTyConApp tc (HieArgs xs) -> do
+        let info = GHC.ifaceTyConInfo tc
+            name = GHC.ifaceTyConName tc
+        tcname <- case nameModule_maybe name of
+          Nothing -> fail "HTyConApp: internal name"
+          Just mod -> do
+            namemod <- mkModule mod
+            mkName name namemod (Hs.NameSort_external def)
+        let sort = case GHC.ifaceTyConSort info of
+              GHC.IfaceNormalTyCon -> Hs.TyConSort_normal def
+              GHC.IfaceTupleTyCon arity ts -> Hs.TyConSort_tuple $
+                  Hs.TyConSort_tuple_ (nat arity) $
+                    case ts of
+                      GHC.BoxedTuple -> Hs.TupleSort_boxed
+                      GHC.UnboxedTuple -> Hs.TupleSort_unboxed
+                      GHC.ConstraintTuple -> Hs.TupleSort_constraint
+              GHC.IfaceSumTyCon arity ->
+                Hs.TyConSort_sum $ Hs.TyConSort_sum_ $ nat arity
+              GHC.IfaceEqualityTyCon -> Hs.TyConSort_equality def
+        tycon <- Glean.makeFact @Hs.TyCon $
+          Hs.TyCon_key tcname sort
+            (GHC.isPromoted (GHC.ifaceTyConIsPromoted info))
+        xs <- mapM mkTyArg xs
+        Glean.makeFact @Hs.Type $ Hs.Type_key_tyconapp $
+          Hs.Type_tyconapp_ tycon xs
+
+    mkTyArg :: (Bool,TypeIndex) -> m Hs.TypeArg
+    mkTyArg (vis,ti) = do
+      t <- get ti
+      return (Hs.TypeArg vis t)
+
+    get :: TypeIndex -> m Hs.Type
+    get a = case IntMap.lookup a tymap of
+      Nothing -> fail $ "indexTypes: missing " <> show a
+      Just t -> return t
+
+indexHieFile
+  :: Glean.Writer
+  -> NonEmpty Text
+  -> FilePath
+  -> HieFile
+  -> IO ()
+indexHieFile writer srcPaths path hie = do
+  srcFile <- findSourceFile srcPaths (hie_module hie) (hie_hs_file hie)
+  logInfo $ "Indexing: " <> path <> " (" <> srcFile <> ")"
+  Glean.writeFacts writer $ do
+    modfact <- mkModule smod
+
+    let offs = getLineOffsets (hie_hs_src hie)
+    let hsFileFS = GHC.mkFastString $ hie_hs_file hie
+    filefact <- Glean.makeFact @Src.File (Text.pack srcFile)
+    let fileLines = mkFileLines filefact offs
+    Glean.makeFact_ @Src.FileLines fileLines
+
+    Glean.makeFact_ @Hs.ModuleSource $
+      Hs.ModuleSource_key modfact filefact
+
+    typeMap <- indexTypes (hie_types hie)
+
+    let toByteRange = srcRangeToByteRange fileLines (hie_hs_src hie)
+        toByteSpan sp
+          | GHC.srcSpanEndLine sp >= Vector.length (lineOffsets offs) =
+            Src.ByteSpan (Glean.toNat 0) (Glean.toNat 0)
+          | otherwise =
+            rangeToByteSpan (toByteRange (srcSpanToSrcRange filefact sp))
+
+    let allIds = [ (n, p) | (n, ps) <- Map.toList refmap, p <- ps ]
+        declInfo = concat $ fmap getDeclInfos $ getAsts $ hie_asts hie
+
+    -- produce names & declarations
+    names <- fmap catMaybes $ forM allIds $ \(ident, (span, dets)) -> if
+      | Right name <- ident
+      , Just sp <- getBindSpan span (identInfo dets)
+      , localOrGlobal name smod
+      , GHC.srcSpanFile sp == hsFileFS -> do -- Note [#included source files]
+        let byteSpan = toByteSpan sp
+        sort <- case nameModule_maybe name of
+          Nothing -> return $ Hs.NameSort_internal byteSpan
+          Just{} -> return $ Hs.NameSort_external def
+        namefact <- mkName name modfact sort
+        Glean.makeFact_ @Hs.DeclarationLocation $
+          Hs.DeclarationLocation_key namefact filefact byteSpan
+        {-
+          trace ("decl: " <>
+            GHC.occNameString (nameOccName name) <> ": " <>
+           show (ppr sp)) $ return ()
+        -}
+        return $ Just (name, namefact)
+      | otherwise -> return Nothing
+
+    -- A map for Names defined in this module
+    let
+      nameMap :: Map GHC.Name Hs.Name
+      nameMap = Map.fromList names
+
+      getName :: Glean.NewFact m => GHC.Name -> m (Maybe Hs.Name)
+      getName name =
+        case Map.lookup name nameMap of
+          Just hsName -> return $ Just hsName
+          Nothing -> case nameModule_maybe name of
+            Nothing ->
+              -- This shouldn't happen, it's probably a bug in the hie file.
+              -- But it does happen, so let's not crash.
+              return Nothing
+            Just m -> do
+              mod <- if m == smod then return modfact else mkModule m
+              Just <$> mkName name mod (Hs.NameSort_external def)
+
+    sigMap <- produceDeclInfo filefact toByteSpan getName declInfo
+
+    forM_ allIds $ \(ident, (_, dets)) -> if
+      | Right name <- ident
+      , Just namefact <- Map.lookup name nameMap -> do
+        let ty = identType dets >>= \ix -> IntMap.lookup ix typeMap
+        mapM_ (produceDecl sigMap namefact ty) (Set.toList (identInfo dets))
+      | otherwise -> return ()
+
+    eNames <- mapMaybeM getName (concatMap GHC.availNames (hie_exports hie))
+
+    Glean.makeFact_ @Hs.ModuleDeclarations $ Hs.ModuleDeclarations_key
+      modfact (map snd names) eNames
+
+    let refs = Map.fromListWith (Map.unionWith (++))
+          [ (ident, Map.singleton kind [span])
+          | (ident, (span, dets)) <- allIds,
+            Just kind <- map isRef (Set.toList (identInfo dets)),
+            case ident of
+              Left{} -> True
+              Right n ->
+                not (GHC.isSystemName n) &&
+                -- TODO: we should exclude generated names in a cleaner way
+                not (GHC.isDerivedOccName (nameOccName n))
+          ]
+
+    refs <- fmap catMaybes $ forM (Map.toList refs) $ \(ident, kindspans) -> do
+      refspans <- fmap concat $ forM (Map.toList kindspans) $ \(kind, spans) -> do
+        let gleanspans = map toByteSpan spans
+        return $ map (Hs.RefSpan kind) gleanspans
+      case ident of
+        Left modName -> do
+          gleanMod <- Glean.makeFact @Hs.ModuleName $
+            fsToText (GHC.moduleNameFS modName)
+          fmap Just $ Glean.makeFact @Hs.XRef $
+            Hs.XRef_key (Hs.RefTarget_modName gleanMod) filefact refspans
+        Right name -> do
+          maybe_namefact <- getName name
+          forM maybe_namefact $ \namefact -> do
+            Glean.makeFact @Hs.XRef $
+              Hs.XRef_key (Hs.RefTarget_name namefact) filefact refspans
+
+    Glean.makeFact_ @Hs.FileXRefs $ Hs.FileXRefs_key filefact refs
+
+  where
+  smod = hie_module hie
+  refmap = generateReferencesMap $ getAsts $ hie_asts hie
+
+  localOrGlobal :: GHC.Name -> GHC.Module -> Bool
+  localOrGlobal name mod = case nameModule_maybe name of
+    Nothing -> True
+    Just nameMod
+      | nameMod == mod -> True
+      | otherwise -> False
+
+  -- returns True if this ContextInfo is a reference
+  isRef Use = Just Hs.RefKind_coderef
+  isRef (RecField r _) | isRecFieldRef r = Just Hs.RefKind_coderef
+  isRef (ValBind InstanceBind _ _) = Just Hs.RefKind_coderef
+    -- treat these as refs, not binds
+  isRef TyDecl{} = Just Hs.RefKind_tydecl
+  isRef (IEThing Export) = Just Hs.RefKind_exportref
+  isRef (IEThing _) = Just Hs.RefKind_importref
+  isRef _ = Nothing
+
+  -- returns (Just span) if this ContextInfo is a definition
+  getBindSpan defaultSpan = getFirst . foldMap (First . goDecl)
+    where
+    goDecl (ValBind RegularBind _ sp) = sp
+    goDecl (PatternBind _ _ sp) = sp <|> Just defaultSpan
+    goDecl (Decl _ sp) = sp
+    goDecl (RecField r sp) | not (isRecFieldRef r) = sp
+    goDecl TyVarBind{} = Just defaultSpan
+    goDecl (ClassTyDecl sp) = sp
+    goDecl _ = Nothing
+
+-- |
+-- Attempt to find the original source file given the hie_hs_src value
+-- from the .hie file, the module, and the --src flags provided to the
+-- indexer.
+--
+-- See Note [source file paths]
+--
+findSourceFile :: NonEmpty Text -> GHC.Module -> FilePath -> IO FilePath
+findSourceFile srcPaths mod src = do
+  r <- findM doesFileExist
+    (fmap ((</> src) . Text.unpack) (NonEmpty.toList spliced))
+  cwd <- getCurrentDirectory
+  -- normalise because some paths are of the form ./A/B/C.hs
+  -- makeRelative because generated files can have absolute paths
+  makeRelative cwd . normalise <$> case r of
+    Nothing -> do
+      logWarning $ "couldn't find src for: " <> src
+      return src
+    Just f -> return f
+  where
+  pkg = fsToText (unitFS (GHC.moduleUnit mod))
+  isVer = Text.all (\c -> isDigit c || c == '.')
+  pkgNameAndVersion = case break isVer (Text.splitOn "-" pkg) of
+    (before, after) -> Text.intercalate "-" (before <> take 1 after)
+  spliced = fmap (Text.replace "$PACKAGE" pkgNameAndVersion) srcPaths
+
+{-
+Note [source file paths]
+
+We need
+- source file paths for src.File facts
+- source file contents so that we can create src.FileLines and convert
+  line/column to bytespan
+
+A src.File should uniquely determine the hs.Module, and should be
+relative to the root of the project we're indexing.
+
+The .hie file contains the file name of the original .hs file as seen
+by GHC, together with its contents as a ByteString.
+
+The source file path in the .hie file isn't exactly what we need, for
+a few reasons:
+
+1. If the project has multiple packages (with a cabal.project), then
+the source file names in the .hie files will be relative to each
+package. In that case we need to find the original source file to
+generate the `src.File` fact. This is done by passing a @--src@ flag to
+the indexer, e.g. @--src '$PACKAGE'@.
+
+2. The path often needs normalising, e.g. it's common to see paths
+like ./src/A/B/C.hs
+
+3. Sometimes the file path in the .hie file is absolute, but we need
+to make it relative, e.g. the Paths_foo.hs modules generated by Cabal
+will have absolute path names like
+/a/b/c/dist-newstyle/build/x86_64-linux/ghc-9.4.7/HUnit-1.6.2.0/build/autogen/Paths_HUnit.hs
+-}
+
+{-
+Note [#included source files]
+
+There might be other source files involved when compiling a module,
+e.g. if CPP is being used and the .hs file uses `#include`. We
+currently ignore Names that come from another source file (TODO).
+-}
+
+
+data DeclInfo
+  = DataDecl {
+      dataDeclName :: GHC.Name,
+      dataDeclConstrs :: [ConstrInfo]
+    }
+  | ClassDecl {
+      classDeclName :: GHC.Name,
+      classDeclMethods :: [GHC.Name],
+      classDeclDefaults :: [InstanceBindInfo]
+    }
+  | SigDecl {
+      sigDeclName :: GHC.Name,
+      sigDeclSpan :: GHC.RealSrcSpan
+    }
+  | InstDecl {
+      instanceDeclBinds :: [InstanceBindInfo],
+      instanceDeclSpan :: GHC.RealSrcSpan
+    }
+
+data InstanceBindInfo = InstanceBindInfo {
+    instBindMeth :: GHC.Name,
+    instBindSpan :: GHC.RealSrcSpan
+    -- TODO: add type. The identifier with context ValBind InstanceBind
+    -- doesn't have a type, but there is also a ValBind RegularBind
+    -- identifier that does have the type attached.
+  }
+
+data ConstrInfo =
+  ConstrInfo {
+    _constrName :: GHC.Name,
+    _constrFields :: [GHC.Name]
+  }
+
+getDeclInfos :: HieAST TypeIndex -> [DeclInfo]
+getDeclInfos node = snd $ State.runState (go node) []
+  where
+  go node@Node{..} = do
+    visit node
+    void $ traverse go nodeChildren
+
+  visit node =
+    {-
+      trace ("node: " <> show (ppr (nodeAnnotations nodeInfo)) <> ": " <> show (ppr (fmap (const ()) (nodeIdentifiers nodeInfo)))) $
+    -}
+    whenJust hasInfo $ \info ->
+      State.modify (info:)
+    where
+
+    nodeInfo = getNodeInfo node
+
+    hasInfo
+      | isDataDecl nodeInfo,
+        [(name,_,_)] <- findIdent dataDeclCtx nodeInfo node =
+         Just (DataDecl {
+           dataDeclName = name,
+           dataDeclConstrs = findConstrs node })
+      | isClassDecl nodeInfo,
+        [(name,_,_)] <- findIdent classDeclCtx nodeInfo node =
+         Just (ClassDecl {
+           classDeclName = name,
+           classDeclMethods = findMethods node,
+           classDeclDefaults = findInstBinds node })
+      | isTypeSig nodeInfo,
+        [(name,_,_)] <- findIdent tyDeclCtx nodeInfo node =
+         Just (SigDecl {
+           sigDeclName = name,
+           sigDeclSpan = nodeSpan node })
+      | isInstDecl nodeInfo =
+         Just (InstDecl {
+           instanceDeclBinds = findInstBinds node,
+           instanceDeclSpan = nodeSpan node })
+      | otherwise =
+          Nothing
+
+    -- The Name for a decl seems to be a child of the declaration Node
+    findIdent ctx ni Node{..} =
+      concatMap (namesWithContext ctx) $
+        map nodeIdentifiers (ni : map getNodeInfo nodeChildren)
+
+    findMethods Node{..} =
+      [ meth
+      | n <- nodeChildren
+      , let ni = getNodeInfo n
+      , isMethodDecl ni
+      , (meth,_,_) <- findIdent classTyDeclCtx ni n
+      ]
+
+    findInstBinds Node{..} =
+      [ InstanceBindInfo {
+          instBindMeth = meth,
+          instBindSpan = span
+        }
+      | n <- nodeChildren
+      , let ni = getNodeInfo n
+      , isInstanceBind ni
+      , (meth, _ty, ValBind _ _ (Just span))  <- findIdent instBindCtx ni n
+      ]
+
+    findConstrs Node{..} =
+      [ ConstrInfo con (fields n)
+      | n <- nodeChildren
+      , let ni = getNodeInfo n
+      , isConstrDecl ni
+      , (con,_,_) <- findIdent conDeclCtx ni n
+      ]
+      where
+      -- there are intermediate AST nodes between the constructor and
+      -- the fields, so rather than matching the shape exactly let's
+      -- just search the whole subtree to find fields.
+      fields n =
+        [ fld
+        | child <- flattenAst n
+        , let ni = getNodeInfo child
+        , (fld,_,_) <- namesWithContext recFieldDeclCtx (nodeIdentifiers ni)
+        ]
+
+namesWithContext
+  :: (ContextInfo -> Bool)
+  -> NodeIdentifiers a
+  -> [(GHC.Name, Maybe a, ContextInfo)]
+namesWithContext p ids =
+  [ (name, identType dtl, ctx)
+  | (Right name, dtl) <- Map.toList ids
+  , ctx <- Set.toList (identInfo dtl)
+  , p ctx ]
+
+getNodeInfo :: HieAST a -> NodeInfo a
+getNodeInfo =
+  foldl' combine emptyNodeInfo . getSourcedNodeInfo . sourcedNodeInfo
+  where
+  (NodeInfo as ai ad) `combine` (NodeInfo bs bi bd) =
+    NodeInfo (Set.union as bs) (ai <> bi) (Map.unionWith (<>) ad bd)
+
+dataDeclCtx :: ContextInfo -> Bool
+dataDeclCtx (Decl DataDec _) = True
+dataDeclCtx _ = False
+
+conDeclCtx :: ContextInfo -> Bool
+conDeclCtx (Decl ConDec _) = True
+conDeclCtx _ = False
+
+recFieldDeclCtx :: ContextInfo -> Bool
+recFieldDeclCtx (RecField r _) = not (isRecFieldRef r)
+recFieldDeclCtx _ = False
+
+tyDeclCtx :: ContextInfo -> Bool
+tyDeclCtx TyDecl = True
+tyDeclCtx _ = False
+
+classDeclCtx :: ContextInfo -> Bool
+classDeclCtx (Decl ClassDec _) = True
+classDeclCtx _ = False
+
+classTyDeclCtx :: ContextInfo -> Bool
+classTyDeclCtx (ClassTyDecl _) = True
+classTyDeclCtx _ = False
+
+instBindCtx :: ContextInfo -> Bool
+instBindCtx (ValBind InstanceBind _ _) = True
+instBindCtx _ = False
+
+isTypeSig, isDataDecl, isConstrDecl, isClassDecl,
+  isMethodDecl, isInstanceBind, isInstDecl :: NodeInfo a -> Bool
+
+isTypeSig = any (== typeSigAnnot) . nodeAnnotations
+isDataDecl = any (== dataDeclAnnot) . nodeAnnotations
+isConstrDecl = any (`elem` [constrAnnot, constrGadtAnnot]) . nodeAnnotations
+isClassDecl = any (== classDeclAnnot) . nodeAnnotations
+isMethodDecl = any (== classOpSigAnnot) . nodeAnnotations
+isInstDecl = any (== instDeclAnnot) . nodeAnnotations
+isInstanceBind =
+  any (`elem` [varBindAnnot, patBindAnnot, funBindAnnot]) . nodeAnnotations
+
+typeSigAnnot :: NodeAnnotation
+typeSigAnnot = NodeAnnotation "TypeSig" "Sig"
+
+dataDeclAnnot :: NodeAnnotation
+dataDeclAnnot = NodeAnnotation "DataDecl" "TyClDecl"
+
+constrAnnot :: NodeAnnotation
+constrAnnot = NodeAnnotation "ConDeclH98" "ConDecl"
+
+constrGadtAnnot :: NodeAnnotation
+constrGadtAnnot = NodeAnnotation "ConDeclGADT" "ConDecl"
+
+classOpSigAnnot :: NodeAnnotation
+classOpSigAnnot = NodeAnnotation "ClassOpSig" "Sig"
+
+classDeclAnnot :: NodeAnnotation
+classDeclAnnot = NodeAnnotation "ClassDecl" "TyClDecl"
+
+funBindAnnot :: NodeAnnotation
+funBindAnnot = NodeAnnotation "FunBind" "HsBindLR"
+
+patBindAnnot :: NodeAnnotation
+patBindAnnot = NodeAnnotation "PatBind" "HsBindLR"
+
+varBindAnnot :: NodeAnnotation
+varBindAnnot = NodeAnnotation "VarBind" "HsBindLR"
+
+instDeclAnnot :: NodeAnnotation
+instDeclAnnot = NodeAnnotation "ClsInstD" "InstDecl"
diff --git a/glean/lang/haskell/HieIndexer/Main.hs b/glean/lang/haskell/HieIndexer/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/haskell/HieIndexer/Main.hs
@@ -0,0 +1,169 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module HieIndexer.Main (main) where
+
+import Control.Monad
+import Control.Monad.State (StateT, evalStateT, get, liftIO, put)
+import qualified Data.ByteString as BS
+import Data.Default
+import Data.IORef
+import Data.List.NonEmpty (NonEmpty)
+import qualified Data.List.NonEmpty as NonEmpty
+import qualified Data.Map as AMap
+import qualified Data.Set as Set
+import qualified Data.HashSet as HashSet
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Options.Applicative
+import System.Directory
+import System.FilePath
+import qualified Thrift.Protocol.Compact
+import Text.Printf
+
+import HieDb (withHieFile)
+import HieDb.Utils (makeNc)
+import HieDb.Types (runDbM)
+
+import Util.EventBase
+import Util.Log
+
+import qualified Glean
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Impl.ConfigProvider (ConfigAPI)
+import Glean.Init (withOptions)
+import Glean.Schema.Builtin.Types (schema_id)
+import qualified Glean.Schema.Hs as Hs
+import qualified Glean.Schema.Src as Src
+import qualified Glean.Util.ConfigProvider as Glean
+
+import qualified HieIndexer.Options as Hie
+import HieIndexer.Index
+import HieIndexer.Options
+
+main :: IO ()
+main = do
+  let parser =
+        (,) <$> infoParser Hie.options <*> Glean.options
+      opts = info (helper <*> parser) fullDesc
+  withOptions opts $ \((cfg, mode), svc) ->
+    withEventBaseDataplane $ \evb ->
+      Glean.withConfigProvider Glean.defaultConfigOptions $
+        \(cfgAPI :: ConfigAPI) ->
+          Glean.withBackendWithDefaultOptions
+            evb
+            cfgAPI
+            svc
+            (case mode of
+              BinaryMode _ given_schema_id -> Just given_schema_id
+              _ -> Just schema_id)
+            $ case mode of
+                Hie.BinaryMode{..} ->
+                  outputMain cfg outputPath schemaId
+                Hie.WriteMode{..} ->
+                  defaultMain cfg repo
+
+defaultMain
+  :: Glean.Backend b
+  => HieIndexerOptions
+  -> Glean.Repo
+  -> b
+  -> IO ()
+defaultMain cfg repo backend = do
+  paths <- getHieFilesIn (NonEmpty.toList (hiePaths cfg))
+
+  logInfo $ printf "Indexing %d files" (HashSet.size paths)
+
+  let Glean.Repo{..} = repo
+
+  logInfo $ printf "Writing to Glean DB %s/%s" repo_name repo_hash
+
+  Glean.withSender backend repo allPredicates def $ \sender -> do
+    Glean.withWriter sender def $
+      indexHieFiles paths (srcPaths cfg)
+
+  predicates <-
+    Glean.schemaInfo_predicateIds
+      <$> Glean.getSchemaInfo backend (Just repo)
+            def { Glean.getSchemaInfo_omit_source = True }
+  repoStats <- Glean.predicateStats backend repo Glean.ExcludeBase
+  let readableStats =
+        [ printf " - %s: count = %d, size = %d"
+          (Text.unpack predicateRef_name)
+          predicateStats_count
+          predicateStats_size
+        | (p, Glean.PredicateStats {..}) <- AMap.toList repoStats
+        , Just Glean.PredicateRef {..} <- [AMap.lookup p predicates]
+        ]
+
+  logInfo $ unlines $ "Repo stats: " : readableStats
+
+allPredicates :: [Glean.SchemaPredicates]
+allPredicates = [Src.allPredicates, Hs.allPredicates]
+
+outputMain
+  :: Glean.Backend b
+  => HieIndexerOptions
+  -> FilePath
+  -> Glean.SchemaId
+  -> b
+  -> IO ()
+outputMain cfg out schema_id backend = do
+  paths <- getHieFilesIn (NonEmpty.toList (hiePaths cfg))
+  ((), batch) <-
+    Glean.withBatchWriter backend schema_id Nothing def $
+      indexHieFiles paths (srcPaths cfg)
+  BS.writeFile out (Thrift.Protocol.Compact.serializeCompact batch)
+
+indexHieFiles
+  :: HashSet.HashSet FilePath
+  -> NonEmpty Text
+  -> Glean.Writer
+  -> IO ()
+indexHieFiles paths srcs writer =
+  forM_ (HashSet.toList paths) $ \f -> do
+    nc <- newIORef =<< makeNc
+    runDbM nc $ do
+      withHieFile f $ \h ->
+        liftIO $ indexHieFile writer srcs f h
+
+{- | Recursively search for @.hie@ and @.hie-boot@  files in given directory
+   avoiding loops due to symlinks
+-}
+getHieFilesIn :: [FilePath] -> IO (HashSet.HashSet FilePath)
+getHieFilesIn = flip evalStateT mempty . foldMap go
+  where
+    go path = do
+      seen <- get
+      path' <- liftIO $ canonicalizePath path
+      if Set.member path' seen
+        then return HashSet.empty
+        else do
+          put (Set.insert path' seen)
+          isFile <- liftIO $ doesFileExist path'
+          if isFile
+            && ( "hie" `isExtensionOf` path'
+                  || "hie-boot" `isExtensionOf` path'
+               )
+            then do
+              return (HashSet.singleton path')
+            else do
+              isDir <- liftIO $ doesDirectoryExist path'
+              if isDir
+                then do
+                  cnts <- liftIO $ listDirectory path'
+                  foldMap (go . (path' </>)) cnts
+                else return HashSet.empty
+
+instance (Monoid a, Monad m) => Semigroup (StateT s m a) where
+  (<>) = liftA2 (<>)
+
+instance (Monoid a, Monad m) => Monoid (StateT s m a) where
+  mempty = pure mempty
diff --git a/glean/lang/haskell/HieIndexer/Options.hs b/glean/lang/haskell/HieIndexer/Options.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/haskell/HieIndexer/Options.hs
@@ -0,0 +1,106 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+module HieIndexer.Options (
+    HieIndexerOptions(..),
+    Mode(..),
+    options,
+  ) where
+
+import Data.List.NonEmpty (NonEmpty, nonEmpty)
+import qualified Data.List.NonEmpty as NonEmpty
+
+import Data.Maybe
+import Data.Text (Text)
+import Options.Applicative
+import Glean (Repo (Repo), SchemaId (SchemaId, unSchemaId))
+import Glean.Schema.Builtin.Types (schema_id)
+import Util.OptParse
+
+data HieIndexerOptions = HieIndexerOptions
+  { hiePaths :: NonEmpty FilePath
+      -- ^ Paths to search recursively for .hie files
+  , srcPaths :: NonEmpty Text
+      -- ^ Paths to look for source files. May include the string
+      -- @$PACKAGE@ which will be replaced by the package name
+      -- (@<pkg>-<version>@).
+  , verbosity :: Int
+  }
+
+data Mode
+  = WriteMode {
+      repo :: Repo
+    }
+  | BinaryMode {
+      outputPath :: FilePath,
+      schemaId :: SchemaId
+    }
+
+
+options :: ParserInfo (HieIndexerOptions, Mode)
+options = info (helper <*> parser) fullDesc
+  where
+    parser :: Parser (HieIndexerOptions, Mode)
+    parser = do
+
+      hiePaths <- fromJust . nonEmpty <$> some
+        (strArgument (metavar "PATH" <> help "Tree containing .hie files"))
+
+      srcPaths <- fromMaybe (NonEmpty.singleton ".") . nonEmpty <$>
+        many (textOption (
+          long "src" <>
+          metavar "PATH" <>
+          help (
+            "Path to search for source files. The string \"$PACKAGE\" is " <>
+            "replaced by the package name, e.g. text-2.0.2")))
+
+      verbosity <-
+        option
+          auto
+          ( long "verbosity"
+              <> short 'v'
+              <> help "Verbosity level."
+              <> showDefault
+              <> value 1
+              <> metavar "INT"
+          )
+
+      mode <- modeParser
+      return (HieIndexerOptions {..}, mode)
+
+modeParser :: Parser Mode
+modeParser = serviceModeParser <|> binaryModeParser
+  where
+    serviceModeParser = do
+      repoName <-
+        strOption
+          ( long "repo-name"
+              <> metavar "REPO_NAME"
+              <> help "Name of the Glean DB to be created."
+          )
+
+      repoHash <-
+        strOption
+          ( long "repo-hash"
+              <> metavar "REPO_HASH"
+              <> help "Hash of the DB to be created."
+          )
+      return $ WriteMode (Repo repoName repoHash)
+
+    binaryModeParser = do
+        outputPath <- strOption
+          ( long "output"
+            <> metavar "FILE"
+            <> help "Output binary serialized facts instead of writing to DB")
+        schemaId <- SchemaId <$> strOption
+          ( long "schema-id"
+            <> help "Glean schema id to use for encoding the facts (defaults to latest one)"
+            <> value (unSchemaId schema_id))
+        return $ BinaryMode{..}
diff --git a/glean/lang/java-lsif/Glean/Indexer/JavaLsif.hs b/glean/lang/java-lsif/Glean/Indexer/JavaLsif.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/java-lsif/Glean/Indexer/JavaLsif.hs
@@ -0,0 +1,47 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.JavaLsif ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Indexer.LSIF ( derive )
+import Glean.LSIF.Driver as LSIF
+
+newtype JavaLsif = JavaLsif
+  { lsifJavaBinary :: FilePath
+  }
+
+options :: Parser JavaLsif
+options = do
+  lsifJavaBinary <- strOption $
+    long "lsif-java" <>
+    value "lsif-java" <>
+    help "path to the lsif-java binary"
+  return JavaLsif{..}
+
+indexer :: Indexer JavaLsif
+indexer = Indexer {
+  indexerShortName = "java-lsif",
+  indexerDescription = "Index Java via LSIF",
+  indexerOptParser = options,
+  indexerRun = \JavaLsif{..} backend repo IndexerParams{..} -> do
+    let
+      params = LsifIndexerParams {
+        lsifBinary = lsifJavaBinary,
+        lsifArgs = \outFile -> [ "index", "--output", outFile ],
+        lsifRoot = indexerRoot,
+        lsifStdout = False
+      }
+    val <- LSIF.runIndexer params
+    sendJsonBatches backend repo (lsifJavaBinary <> "/lsif") val
+    derive backend repo
+  }
diff --git a/glean/lang/lsif/Data/LSIF/Angle.hs b/glean/lang/lsif/Data/LSIF/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/Angle.hs
@@ -0,0 +1,498 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Convert Data.LSIF into glean/schema/lsif.angle-compatible data via JSON.
+
+Note: this module generates Angle but has no dependency on the lsif schema, to
+make developer iteration quicker.
+
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE CPP #-}
+
+module Data.LSIF.Angle (
+    factToAngle, Predicate, PredicateMap,
+    generateJSON,
+    insertPredicateMap,
+    emitFileFactSets,
+    -- parse state
+    Env(..), emptyEnv
+  ) where
+
+import Control.Monad
+import Control.Monad.Extra ( concatMapM )
+import Control.Monad.State.Strict
+import Data.Aeson
+import Data.Aeson.Types ( Pair )
+import Data.Maybe ( catMaybes, fromMaybe, listToMaybe, mapMaybe )
+import qualified Data.IntMap.Strict as IMap
+import Data.Text ( Text )
+import qualified Data.Text as Text
+import qualified Data.Vector as V
+import qualified Data.Vector.Unboxed as U
+
+import Data.LSIF.Types
+import Data.LSIF.Moniker
+import Data.LSIF.Env
+import Data.LSIF.Gen
+import Data.LSIF.JSON ({- instances -})
+
+-- Drop projectRoot prefix from URI to yield repo-relative paths for Glean
+-- Some indexers generate uris outside of the repo. In those cases we
+-- just try to remove local environment specific-stuff
+filterRoot :: Text -> Parse Text
+filterRoot path = do
+  prefixes <- root <$> get -- try a few paths
+  let clean = mapMaybe (\p -> Text.stripPrefix (p <> "/") path) prefixes
+  pure (fromMaybe path (listToMaybe clean))
+
+--
+-- | Convert LSIF json to Glean json
+--
+-- Process each key/fact pair
+--
+-- We map over the statements, in order, generating 0 or more facts for Glean
+-- LSIF guarantees things are defined before references to them are used, and
+-- uses unique ids for facts. We can use that to simplify processing
+--
+-- vertexes correspond to facts holding new data
+-- edges relate existnig vertex facts to each other (with new facts)
+--
+factToAngle :: KeyFact -> Parse [Predicate]
+
+factToAngle (KeyFact _ MetaData{..}) = do
+  appendRoot projectRoot
+  predicate "lsif.Metadata" ([
+    "lsifVersion" .= version,
+    "positionEncoding" .= positionEncoding
+    ] ++ (case toolInfo of -- optional
+            Nothing -> []
+            Just ToolInfo{..} ->
+              ["toolInfo" .= object [
+                "toolName" .= toolName,
+                "toolArgs" .= toolArgs,
+                "version" .= version
+              ]]
+      ))
+
+factToAngle (KeyFact n Project{..}) = do
+  insertType n ProjectType
+  predicateId "lsif.Project" n [ "kind" .= fromEnum kind ]
+
+factToAngle (KeyFact _ PackageInformation{..}) =
+  predicate "lsif.PackageInformation" [
+    "name" .= name,
+    "manager" .= manager,
+    "version" .= version
+  ]
+
+-- LSIF Documents are uri/language pairs
+-- Rather than key on src.File, we use lsif.Document to keep the language of the
+-- symbol accessible, for mixed-language lsif dbs.
+--
+factToAngle (KeyFact n Document{..}) = do
+  insertType n FileType
+  path <- filterRoot uri
+  predicateId "lsif.Document" n
+    [ "file" .= string path, -- n.b. anonymous src.File fact
+      "language" .= fromEnum language
+    ]
+
+-- Push document or project identifier onto open stack. This is list of
+-- documents or projects for which facts may still be emitted.
+-- we don't currently use these event markers for anything
+factToAngle (KeyFact _ Event{}) = pure []
+
+-- Associate a range fact with a result set.
+-- We use this to track chains of ref -> resultset -> def for later generation
+-- note: inV targets are always resultSets, outVs may be ranges or resultSets
+factToAngle (KeyFact _ (Edge EdgeNext outV inV)) = [] <$ do
+  addToResultSet outV (tagResultSet inV)
+
+-- record which resultset this hover text is a member of
+factToAngle (KeyFact _ (Edge EdgeTextDocumentHover outV inV)) = [] <$
+  addHoverToResultSet inV outV
+
+-- record which resultset this moniker points at
+factToAngle (KeyFact _ (Edge EdgeMoniker outV inV)) = [] <$
+  addMonikerToResultSet inV outV
+
+-- edge:item for property:references associates an inV range with a
+-- textDocument/references result. record that the range is a reference type
+-- n.b. the spec doesn't guarantee property:references will be set.
+factToAngle (KeyFact _ (Item _outV inVs _fileId (Just References))) = [] <$
+  insertTypes inVs ReferenceType
+
+-- items : these add ranges to definition results
+-- we check the result set of this definitionResult, then record
+-- that the result set points at this definition ranges / document pair
+--
+-- other ranges may point at the same result set, but they will (implicitly)
+-- be reference ranges.
+--
+factToAngle (KeyFact _ (Item outV inVs{-ranges-} fileId Nothing)) = [] <$ do
+
+  -- if the item range inV points to a definitionResult, it must be a definition
+  -- if the item range inV points to a referenceResult, it must be a reference
+  mTy <- getTypeOf outV
+  case mTy of
+    Just DefinitionType -> insertTypes inVs DefinitionType
+    Just ReferenceType -> insertTypes inVs ReferenceType
+    Just DeclarationType -> insertTypes inVs DeclarationType
+    _ -> pure ()
+
+  -- check if we already know the result set of this definitionResult
+  -- this is generated by a textDocument/definition edge
+  mResultSet <- getResultSetOf outV
+  case mResultSet of
+    Nothing -> -- don't know result set, so log the edge from
+               -- definition to def/file
+      addToDefinitionFile (tagResultSet outV) {- definitionResult -}
+        (tagFile fileId) (tagDefinitions inVs)
+    Just resultSetId ->
+      addToDefinitionFile resultSetId
+        (tagFile fileId) (tagDefinitions inVs)
+
+-- collect textDocument/definition and textDocument/hover edges to resultsets
+-- If we have seen the definitionResult inV already, then just add an entry
+-- from the result set. Otherwise, record the edge from definition to result
+factToAngle (KeyFact _ (Edge EdgeTextDocumentDefinition outV inV)) = [] <$ do
+  mFileDefs <- getDefinitionFile (tagResultSet inV)
+  case mFileDefs of
+    Just fileDefs -> shareDefinitionFile (tagResultSet outV) fileDefs
+    Nothing -> pure ()
+  -- always log that this definitionResult is member of resultset
+  addToResultSet inV (tagResultSet outV)
+
+-- Range facts. These are range spans, 0-indexed, and may have optional
+-- tag/labels indicating what kind of span they are
+factToAngle (KeyFact n (SymbolRange range mtag)) = do
+  -- record the type of the range if we have the tag handy
+  -- it's convenient , but not required in the specification
+  case  mtag of
+    Just Definition{} -> insertType n DefinitionType
+    Just Declaration{} -> insertType n DeclarationType
+    Just Reference{} -> insertType n ReferenceType
+    _ -> pure ()
+
+  -- record the symbol kind if it exists (definitions only)
+  case tagToKind =<< mtag of
+    Just kind -> insertSymbolKind n kind
+    Nothing -> pure ()
+
+  -- emit a range fact for this id
+  predicateId "lsif.Range" n $
+    [ "range" .= toRange range
+    , "text" .= maybe (string "" {- better to use nothing? -}) toName mtag
+    ] ++ mFullRange
+    where
+      mFullRange = fromMaybe [] (tagToRange =<< mtag)
+
+-- Hover text
+factToAngle (KeyFact n (HoverResult contents)) = do
+  facts <- V.forM contents $ \case
+    HoverSignature language str ->
+      predicateId "lsif.HoverContent" n
+        [ "text" .= object [ "key" .= str ] -- bare lsif.HoverText
+        , "language" .= fromEnum language
+        ]
+    HoverText str ->
+      predicateId "lsif.HoverContent" n
+        [ "text" .= object [ "key" .= str ]
+        , "language" .= fromEnum UnknownLanguage
+        ]
+  return $ concat (V.toList facts)
+
+-- Moniker payloads
+factToAngle (KeyFact n (Moniker kind scheme ident)) =
+  case processMoniker kind scheme ident of
+    Nothing ->
+      predicateId "lsif.Moniker" n
+        [ "kind" .= fromEnum kind
+        , "scheme" .= string scheme
+        , "ident" .= string ident
+        ]
+    Just (ident', kindLiteral) -> do
+      a <- predicateId "lsif.Moniker" n
+        [ "kind" .= fromEnum kind
+        , "scheme" .= string scheme
+        , "ident" .= string ident'
+        ]
+      b <- predicate "lsif.MonikerSymbolKind"
+        [ "moniker" .= n
+        , "kind" .= fromEnum kindLiteral
+        ]
+      pure (a <> b)
+
+-- These are output nodes. We generally need to track the type of the id,
+-- as untyped item edges will piont at these, and it may be the only way to
+-- find the type of the underlying range
+factToAngle (KeyFact n DefinitionResult) = [] <$
+  insertType n DefinitionType
+factToAngle (KeyFact n DeclarationResult) = [] <$
+  insertType n DeclarationType
+factToAngle (KeyFact n ReferenceResult) = [] <$
+  insertType n ReferenceType
+
+factToAngle (KeyFact _ ResultSet) = pure []
+
+-- record the range ids that are contained in a file id
+-- or from file id to project id.
+factToAngle (KeyFact _ (Contains fileId inVs)) = [] <$
+  addFileContainsIds (tagFile fileId) inVs
+
+factToAngle _ = pure []
+
+--
+-- After consuming the LSIF graph, we should have the full set of
+-- {def,decl,ref} -> resutlset -> definitionResult data
+--
+emitFileFactSets :: Parse [Predicate]
+emitFileFactSets = do
+  fileSet <- IMap.toList . fileContains <$> get
+  ps <- mapM (\(k,v) ->
+          emitFileFacts (tagFile (Id $ fromIntegral k)) v)
+          fileSet
+  pure (concat ps)
+
+data IdSet =
+    IdSet {
+      defIds :: !IdVector,
+      declIds :: !IdVector,
+      refIds :: !IdVector,
+      fileIds :: !IdVector
+    }
+
+-- Lookup the type of each id as we recorded it in the env
+partitionByType :: IdVector -> Parse IdSet
+partitionByType ids = do
+  -- get types of all identifiers
+  tys <- V.generateM (U.length ids)
+           (\i -> getTypeOf (Id (ids `U.unsafeIndex` i)))
+
+  -- partition by type, we don't care about ordering
+  let defIds = U.ifilter
+        (\i _ -> tys `V.unsafeIndex` i == Just DefinitionType) ids
+      declIds = U.ifilter
+        (\i _ -> tys `V.unsafeIndex` i == Just DeclarationType) ids
+      refIds = U.ifilter
+        (\i _ -> tys `V.unsafeIndex` i == Just ReferenceType) ids
+      fileIds = U.ifilter
+        (\i _ -> tys `V.unsafeIndex` i == Just FileType) ids
+
+  return $ IdSet defIds declIds refIds fileIds
+
+emitFileFacts :: Id_ FileTy -> [IdVector] -> Parse [Predicate]
+emitFileFacts fileId = concatMapM (emitFileFacts_ fileId)
+
+-- We delay this until the post-processing phase to ensure all
+-- - item, textDocument/definition, etc.. nodes are added
+emitFileFacts_ :: Id_ FileTy -> IdVector -> Parse [Predicate]
+emitFileFacts_ fileId rawIds = do
+  IdSet{..} <- partitionByType rawIds
+
+  let defFacts = emitDefinitions fileId defIds
+      declFacts = emitDeclarations fileId declIds
+      projectFacts = emitProjects fileId fileIds {- from projectId to files -}
+  xrefFacts <- emitReferences fileId refIds
+  useFacts <- emitTargetUses fileId refIds
+  hoverFacts <- emitHovers fileId defIds
+  monikerFacts <- emitMonikers fileId defIds
+  symbolKindFacts <- emitSymbolKinds fileId defIds
+  return $ catMaybes
+    [defFacts, declFacts, xrefFacts, useFacts,
+     hoverFacts, projectFacts, monikerFacts, symbolKindFacts]
+
+emitProjects :: Id -> IdVector -> Maybe Predicate
+emitProjects projId ids
+  | U.null ids = Nothing
+  | otherwise = Just $
+      Predicate "lsif.ProjectDocument"
+        (map (\rangeId -> (object . pure . key)
+          [ "file" .= rangeId
+          , "project" .= projId
+          ]
+        ) (U.toList ids))
+
+emitSymbolKinds :: Id -> IdVector -> Parse (Maybe Predicate)
+emitSymbolKinds fileId ids = do
+  factBodies <- catMaybes <$>
+    mapM (generateSymbolKindFacts fileId . Id) (U.toList ids)
+  if null factBodies
+    then pure Nothing
+    else return $ Just $ Predicate "lsif.DefinitionKind" factBodies
+
+emitMonikers :: Id -> IdVector -> Parse (Maybe Predicate)
+emitMonikers fileId ids = do
+  factBodies <- catMaybes <$>
+    mapM (generateMonikerFacts fileId . Id) (U.toList ids)
+  if null factBodies
+    then pure Nothing
+    else return $ Just $ Predicate "lsif.DefinitionMoniker" factBodies
+
+emitHovers :: Id -> IdVector -> Parse (Maybe Predicate)
+emitHovers fileId ids = do
+  hoverBodies <- catMaybes <$>
+    mapM (generateHoverFacts fileId . Id) (U.toList ids)
+  if null hoverBodies
+    then pure Nothing
+    else return $ Just $ Predicate "lsif.DefinitionHover" hoverBodies
+
+emitReferences :: Id -> IdVector -> Parse (Maybe Predicate)
+emitReferences fileId ids = do
+  xrefBodies <- concat <$> mapM
+    (generateFileReferences fileId . Id) (U.toList ids)
+  if null xrefBodies
+    then pure Nothing
+    else return $ Just $
+      Predicate "lsif.Reference" $
+        map (object . pure . key) xrefBodies
+
+emitTargetUses :: Id -> IdVector -> Parse (Maybe Predicate)
+emitTargetUses fileId ids = do
+  useBodies <- concat <$>
+    mapM (generateTargetUses fileId . Id) (U.toList ids)
+  if null useBodies
+    then pure Nothing
+    else return $ Just $
+      Predicate "lsif.DefinitionUse" $
+        map (object . pure . key) useBodies
+
+-- For each refId, look up the result set, find the result sets file and defs
+-- and generate a single flat file -> ref -> targetDef fat
+generateFileReferences :: Id -> Id -> Parse [[Pair]]
+generateFileReferences fileId refRangeId =
+  withResultSet refRangeId getDefinitionFile $ \case
+    FileDefs targetFileId targetRanges -> pure
+      [ [ "file" .= fileId
+        , "range" .= refRangeId
+        , "target" .= (object . pure . key) -- inner key to lsif.Definition
+            [ "file" .= targetFileId
+            , "range" .= targetRange
+            ]
+        ]
+      | targetRange <- U.toList targetRanges
+      ]
+
+-- inverse of file references, emit them here since they're handy
+-- maybe later we want to use textDocument/reference edges
+generateTargetUses :: Id -> Id -> Parse [[Pair]]
+generateTargetUses fileId refRangeId =
+  withResultSet refRangeId getDefinitionFile $ \case
+    FileDefs targetFileId targetRanges -> pure
+      [ [ "target" .= (object . pure . key) -- inner key to lsif.Definition
+            [ "file" .= targetFileId
+            , "range" .= targetRange
+            ]
+        , "file" .= fileId
+        , "range" .= refRangeId
+        ]
+      | targetRange <- U.toList targetRanges
+      ]
+
+emitDefinitions :: Id_ FileTy -> IdVector -> Maybe Predicate
+emitDefinitions = emitDeclDefs "lsif.Definition"
+
+emitDeclarations :: Id_ FileTy -> IdVector -> Maybe Predicate
+emitDeclarations = emitDeclDefs "lsif.Declaration"
+
+emitDeclDefs :: Text -> Id_ FileTy -> IdVector -> Maybe Predicate
+emitDeclDefs name fileId ids
+  | U.null ids = Nothing
+  | otherwise = Just $
+      Predicate name
+        (map (\rangeId -> (object . pure . key)
+          [ "file" .= fileId
+          , "range" .= rangeId
+          ]
+        ) (U.toList ids))
+
+generateHoverFacts :: Id -> Id -> Parse (Maybe Value)
+generateHoverFacts fileId defRangeId =
+  withResultSet defRangeId getHoverTextId $ \hoverFactId ->
+    pure $ pure $ object $ pure $ key
+      [ "defn" .= (object . pure . key)
+          [ "file" .= fileId
+          , "range" .= defRangeId
+          ]
+      , "hover" .= hoverFactId
+      ]
+
+-- Monikers are the symbol ids of LSIF. But they are optional.
+-- We want to generate 'nothing' for definitions that are missing
+-- monikers, so they will still be useful in entity lookups as keys
+generateMonikerFacts :: Id -> Id -> Parse (Maybe Value)
+generateMonikerFacts fileId defRangeId = do
+  mId <- withResultSet defRangeId getMonikerId (pure . Just)
+  pure $ pure $ object $ pure $ key $
+    ( "defn" .= (object . pure . key)
+        [ "file" .= fileId
+        , "range" .= defRangeId
+        ]
+    ) :
+    (case mId of
+        Nothing -> []
+        Just monikerId -> [ "moniker" .= monikerId ]
+    )
+
+generateSymbolKindFacts :: Id -> Id -> Parse (Maybe Value)
+generateSymbolKindFacts fileId defRangeId = do
+  mKind <- getSymbolKind defRangeId
+  case mKind of
+    Nothing -> pure mzero
+    Just kindLiteral ->
+      pure $ pure $ object $ pure $ key
+        [ "defn" .= (object . pure . key)
+            [ "file" .= fileId
+            , "range" .= defRangeId
+            ]
+        , "kind" .= fromEnum kindLiteral
+        ]
+
+-- get the result set of an id, use that result set id to look up another
+-- environment, then apply a function to the result.
+-- used to jump from A to B via a [resultset] node
+withResultSet :: (MonadPlus m)
+  => Id
+  -> (Id_ ResultSetTy -> Parse (Maybe t))
+  -> (t -> Parse (m a))
+  -> Parse (m a)
+withResultSet id f g = do
+  mResultSet <- getResultSetOf id
+  case mResultSet of
+    Nothing -> pure mzero
+    Just resultSetId -> do
+      mv <- f resultSetId
+      case mv of
+        Nothing -> pure mzero
+        Just a -> g a
+
+--
+-- JSON-generating utilities
+--
+
+-- | Identifier text string
+toName :: Tag -> Value
+toName = string . tagText
+
+#if MIN_VERSION_aeson(2,2,0)
+tagToRange :: KeyValue e a => Tag -> Maybe [a]
+#else
+tagToRange :: KeyValue a => Tag -> Maybe [a]
+#endif
+tagToRange Definition{..} = Just ["fullRange" .= toRange fullRange]
+tagToRange Declaration{..} = Just ["fullRange" .= toRange fullRange]
+tagToRange _ = Nothing
+
+tagToKind :: Tag -> Maybe SymbolKind
+tagToKind Definition{..} = Just tagKind
+tagToKind Declaration{..} = Just tagKind
+tagToKind _ = Nothing
diff --git a/glean/lang/lsif/Data/LSIF/Env.hs b/glean/lang/lsif/Data/LSIF/Env.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/Env.hs
@@ -0,0 +1,251 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Data.LSIF.Env (
+
+    Env(..),
+    FileDefs(..),
+    emptyEnv,
+
+    -- some silly type tags
+    tagFile,
+    tagResultSet,
+    tagDefinitions,
+
+    -- tags as values
+    Id(..),
+    Id_,
+    VertexType(..),
+    ResultSetTy,
+    FileTy,
+    DefinitionTy,
+    IdVector,
+
+    -- modify env
+    appendRoot,
+    insertType,
+    insertTypes,
+    addToResultSet,
+    addToDefinitionFile,
+    addHoverToResultSet,
+    addMonikerToResultSet,
+    insertSymbolKind,
+    addFileContainsIds,
+    shareDefinitionFile,
+
+    -- lookups in env
+    getTypeOf,
+    getResultSetOf,
+    getDefinitionFile,
+    getHoverTextId,
+    getMonikerId,
+    getSymbolKind,
+
+    -- running a parser and getting results
+    Parse,
+
+  ) where
+
+import Control.Monad.State.Strict
+import Data.Int ( Int64 )
+import Data.IntMap ( IntMap )
+import Data.Text ( Text )
+import qualified Data.IntMap.Strict as IMap
+import qualified Data.Vector as V
+import qualified Data.Vector.Unboxed as U
+
+import Data.LSIF.Gen ( SymbolKind, Id(..) )
+
+-- Environment used to track things when we analyze the LSIF graph.
+-- We can mostly process LSIF linearly, but for xrefs and related predicates
+-- we track a few chains of values.
+--
+-- We also need to track types of identifiers (decls, refs, defns, files,
+-- projects, and synthetic lsif node types, to distinguish things)
+--
+
+--
+-- LSIF represents xrefs and target uses with cyclical graphs. Groups of related
+-- vertices are shared via "result set" nodes, to which they point.
+-- definitionResult or other nodes will refer to these result sets.
+--
+-- To embed into Glean, we process in two steps:
+--  - first, find all anchor facts (files, ranges) and capture all edges between
+--    files, refs, defs, result sets
+--  - then, using that complete graph environment, extract ref -> (file,def)
+--    pairs to generate File-keyed definition, hover and xref facts
+--
+-- We can't rely on ordering between different vertex and edge types in LSIF,
+-- only that facts will be defined before they are used.
+--
+
+-- | Parser env, to track command statements in LSIF that change scope
+data Env =
+  Env {
+    root :: [Text], -- ^ a list of path prefixes to strip from file paths
+
+    -- type environment. We often learn the inferred type of an id in its use
+    typeEnv :: !(IntMap VertexType),
+
+    -- tracking graph edges we care about
+
+    -- "next" edges associate ranges (defs, decls or xres) with resultsets
+    resultSet :: !(IntMap (Id_ ResultSetTy)),
+
+    -- textDocument/definition, edge from resultset back to ([def range], file)
+    definitionFile :: !(IntMap FileDefs),
+
+    -- textDocument/hover, edge from resultset to hovertext/lang
+    hoverText :: !(IntMap (Id_ HoverTextTy)),
+
+    -- symbol, file and project "moniker" records
+    moniker :: !(IntMap (Id_ MonikerTy)),
+
+    -- associate definition rangeids with their kind
+    symbolKinds :: !(IntMap SymbolKind),
+
+    -- track file "contains" edge associations from file to any ranges
+    fileContains :: !(IntMap [IdVector])
+
+  }
+
+
+-- | Run the fact generate with state Env
+type Parse a = forall m . Monad m => StateT Env m a
+
+-- It is useful to record the type of ids along the way
+-- We can infer these types from the use of the id, as edges lightly typed
+data VertexType
+  = ProjectType -- lsif.Project
+  | FileType -- src.File / lsif.Document
+  | DefinitionType
+  | ReferenceType -- Item property:references or tag:reference
+  | DeclarationType
+  deriving (Eq, Show)
+
+-- Payload for an xref is a file id and the id of the definition range
+data FileDefs
+   = FileDefs
+      {-# UNPACK #-}!(Id_ FileTy)
+      !IdVector
+
+-- | vectors of ids can be stored a bit more compactly
+type IdVector = U.Vector Int64
+
+fill :: V.Vector Id -> IdVector
+fill v = U.generate (V.length v) (\i -> case v `V.unsafeIndex` i of Id n -> n)
+
+-- tag the Id with a type when we put it in the env
+type Id_ a = Id
+
+data DefinitionTy
+-- data DeclarationTy
+-- data ReferenceTy
+data ResultSetTy
+data FileTy
+data HoverTextTy
+data MonikerTy
+data RangeTy
+
+tagResultSet :: Id -> Id_ ResultSetTy
+tagResultSet = id
+
+tagFile :: Id -> Id_ FileTy
+tagFile = id
+
+tagDefinitions :: V.Vector Id -> V.Vector (Id_ DefinitionTy)
+tagDefinitions = id
+
+-- Build up some lookup tables for the assoc lists between refs/defs/decls/files
+-- to aid in generaing flatter angle facts
+emptyEnv :: Env
+emptyEnv = Env [] IMap.empty IMap.empty IMap.empty
+  IMap.empty IMap.empty IMap.empty IMap.empty
+
+appendRoot :: Text -> Parse ()
+appendRoot path = modify' (\e -> e { root = path : root e })
+
+insertType :: Id -> VertexType -> Parse ()
+insertType (Id n) ty = modify' $ \e -> e { typeEnv =
+    IMap.insert (fromIntegral n) ty (typeEnv e)
+  }
+
+-- Add a bunch of types in one go
+insertTypes :: V.Vector Id -> VertexType -> Parse ()
+insertTypes ids ty = modify' $ \e -> e { typeEnv = IMap.union imap (typeEnv e) }
+  where
+    imap = IMap.fromAscList $ V.toList $
+              V.map (\(Id i) -> (fromIntegral i, ty)) ids
+
+getTypeOf :: Id -> Parse (Maybe VertexType)
+getTypeOf = lookupIMapEnv typeEnv
+
+addToResultSet :: Id -> Id_ ResultSetTy -> Parse ()
+addToResultSet (Id n) resultSetId  = modify' $ \e ->
+  e { resultSet = IMap.insert (fromIntegral n) resultSetId (resultSet e) }
+
+getResultSetOf :: Id -> Parse (Maybe (Id_ ResultSetTy))
+getResultSetOf = lookupIMapEnv resultSet
+
+addToDefinitionFile
+   :: Id_ ResultSetTy -> Id_ FileTy -> V.Vector (Id_ DefinitionTy) -> Parse ()
+addToDefinitionFile (Id resultSetId) fileId defIds  = modify' $ \e ->
+  e { definitionFile = IMap.insert
+        (fromIntegral resultSetId)
+          (FileDefs fileId (fill defIds)) (definitionFile e)
+  }
+
+-- like addToDefinition but shares a reference (i.e. another edge) to exixting
+-- file defs. We can use this to walk chains of resultsets/definition results
+shareDefinitionFile :: Id_ ResultSetTy -> FileDefs -> Parse ()
+shareDefinitionFile (Id resultSetId) fileDefs  = modify' $ \e ->
+  e { definitionFile = IMap.insert
+        (fromIntegral resultSetId) fileDefs (definitionFile e)
+  }
+
+getDefinitionFile :: Id_ ResultSetTy -> Parse (Maybe FileDefs)
+getDefinitionFile = lookupIMapEnv definitionFile
+
+addHoverToResultSet :: Id_ HoverTextTy -> Id_ ResultSetTy -> Parse ()
+addHoverToResultSet hoverId (Id resultSetId) = modify' $ \e ->
+  e { hoverText = IMap.insert
+        (fromIntegral resultSetId) hoverId (hoverText e)
+  }
+
+getHoverTextId :: Id_ ResultSetTy -> Parse (Maybe (Id_ HoverTextTy))
+getHoverTextId = lookupIMapEnv hoverText
+
+addMonikerToResultSet :: Id_ MonikerTy -> Id_ ResultSetTy -> Parse ()
+addMonikerToResultSet monikerId (Id resultSetId) = modify' $ \e ->
+  e { moniker = IMap.insert
+        (fromIntegral resultSetId) monikerId (moniker e)
+  }
+
+getMonikerId :: Id_ MonikerTy -> Parse (Maybe (Id_ HoverTextTy))
+getMonikerId = lookupIMapEnv moniker
+
+insertSymbolKind :: Id_ RangeTy -> SymbolKind -> Parse ()
+insertSymbolKind (Id rangeId) kind = modify' $ \e ->
+  e { symbolKinds = IMap.insert
+        (fromIntegral rangeId) kind (symbolKinds e)
+  }
+
+getSymbolKind :: Id -> Parse (Maybe SymbolKind)
+getSymbolKind = lookupIMapEnv symbolKinds
+
+addFileContainsIds :: Id_ FileTy -> V.Vector Id -> Parse ()
+addFileContainsIds (Id fileId) contents = modify' $ \e ->
+  e { fileContains = IMap.insertWith (<>)
+        (fromIntegral fileId) [fill contents] (fileContains e)
+  }
+
+lookupIMapEnv :: (Env -> IntMap a) -> Id -> Parse (Maybe a)
+lookupIMapEnv f (Id n) = do
+  imap <- f <$> get
+  pure (IMap.lookup (fromIntegral n) imap)
+
diff --git a/glean/lang/lsif/Data/LSIF/Gen.hs b/glean/lang/lsif/Data/LSIF/Gen.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/Gen.hs
@@ -0,0 +1,454 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Helpers for generating lsif angle json. Shared between the scip and lsif
+converters
+
+-}
+
+{-# LANGUAGE CPP #-}
+module Data.LSIF.Gen (
+
+    Predicate(..),
+    PredicateMap,
+    predicate,
+    predicateId,
+    key,
+    text,
+    string,
+    generateJSON,
+    generateSCIPJSON,
+    insertPredicateMap,
+    factId,
+    srcFile,
+
+    -- * more shared types
+    LanguageId(..),
+    MonikerKind(..),
+    Id(..),
+    Position(..),
+    Range(..),
+    SymbolKind(..),
+    toRange,
+
+    -- * parsing LanguageIds
+    parseLanguage,
+
+    -- * processing sourcegraph symbols
+    Suffix,
+    kindFromSuffix,
+    parseSuffix
+
+  ) where
+
+import Data.Aeson
+import Data.Maybe ( mapMaybe )
+import Data.Int ( Int64 )
+import Data.Aeson.Types ( Pair )
+import GHC.Generics ( Generic )
+import Data.HashMap.Strict ( HashMap )
+import Data.List ( foldl', sortOn )
+import Data.Text ( Text )
+import qualified Data.Text as Text
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Vector as V
+import Data.List.Split ( chunksOf )
+
+-- A predicate "block", containing multiple facts
+data Predicate = Predicate !Text [Value]
+  deriving Show
+
+-- | Tracking output by predicate
+type PredicateMap = HashMap Text [Value]
+
+-- | An Id to identify a vertex or an edge.
+newtype Id = Id Int64
+  deriving (Generic, Eq)
+
+-- keep instances handy
+instance FromJSON Id
+instance ToJSON Id where
+  toEncoding = genericToEncoding defaultOptions
+
+predicate :: Applicative f => Text -> [Pair] -> f [Predicate]
+predicate name facts = pure [Predicate name [object [key facts]]]
+
+predicateId :: Applicative f => Text -> Id -> [Pair] -> f [Predicate]
+predicateId name id_ facts =
+  pure [Predicate name [object [factId id_, key facts ]]]
+
+#if MIN_VERSION_aeson(2,2,0)
+key :: KeyValue e kv => [Pair] -> kv
+#else
+key :: KeyValue kv => [Pair] -> kv
+#endif
+key xs = "key" .= object xs
+
+string :: Text -> Value
+string s = object [ "key" .= s ]
+
+-- | Helper for src.File facts
+srcFile :: Id -> Text -> Predicate
+srcFile id_ path = Predicate "src.File" [
+    object [ factId id_, "key" .= path ]
+  ]
+
+#if MIN_VERSION_aeson(2,2,0)
+factId :: KeyValue e kv => Id -> kv
+#else
+factId :: KeyValue kv => Id -> kv
+#endif
+factId (Id id_) = "id" .= id_
+
+-- | Accumulate predicates
+insertPredicateMap :: PredicateMap -> [Predicate] -> PredicateMap
+insertPredicateMap = foldl' ins
+  where
+    ins hm (Predicate name vs) = HashMap.insertWith (++) name vs hm
+
+-- | Given a hashmap keyed by lsif predicate names, emit an array of json
+-- pred/facts with one entry per predicate. In case we have very large
+-- predicates, we chunk them into smaller top level groups, which makes memory
+-- mgmt a bit easier
+generateJSON :: PredicateMap -> [Value]
+generateJSON = mkGenerateJSON lsifSchemaVersion lsifDependencyOrder
+
+-- | Given a hashmap keyed by scip predicate names, emit an array of json
+-- pred/facts with one entry per predicate. In case we have very large
+-- predicates, we chunk them into smaller top level groups, which makes memory
+-- mgmt a bit easier
+generateSCIPJSON :: PredicateMap -> [Value]
+generateSCIPJSON = mkGenerateJSON scipSchemaVersion scipDependencyOrder
+
+mkGenerateJSON :: Int -> (Text -> Int) -> PredicateMap -> [Value]
+mkGenerateJSON version ordering hm = concat $
+    mapMaybe (\k -> gen k <$> HashMap.lookup k hm) keys
+  where
+    gen k = emitPredicate version . Predicate k
+    keys = sortOn ordering (HashMap.keys hm)
+
+-- | Try to be slightly robust about which version of the lsif facts we generate
+lsifSchemaVersion :: Int
+lsifSchemaVersion = 2
+
+-- | Try to be slightly robust about which version of the lsif facts we generate
+scipSchemaVersion :: Int
+scipSchemaVersion = 1
+
+-- | We do these in chunks to make parsing simpler
+emitPredicate :: Int -> Predicate -> [Value]
+emitPredicate version (Predicate name facts) =
+  [ object
+    [ "predicate" .= text (name <> "." <> Text.pack (show version))
+    , "facts" .= Array (V.fromList chunk)
+    ]
+  | chunk <- chunksOf 10000 facts
+  ]
+
+text :: Text -> Value
+text = String
+
+--
+-- Dependency ordering where we have sharing between facts
+--
+lsifDependencyOrder :: Text -> Int
+lsifDependencyOrder p = case p of
+  "lsif.Document" -> 0
+  "lsif.Project" -> 0
+  "lsif.Range" -> 1
+  "lsif.HoverContent" -> 2
+  "lsif.Moniker" -> 3
+  -- these refer to Range
+  "lsif.Definition" -> 10
+  "lsif.Declaration" -> 11
+  -- these refer to Declaration, Range
+  "lsif.Reference" -> 12
+  "lsif.DefinitionHover" ->  13
+  "lsif.DefinitionUse" -> 14
+  "lsif.ProjectDocument" -> 15
+  "lsif.DefinitionMoniker" ->  16
+  "lsif.DefinitionKind" ->  17
+  -- everything else, in the middle
+  _ -> 5
+
+--
+-- Topological ordering of predicates based on sharing in the indexer json
+-- We have to write fact for A before a reference to the factId for A
+--
+scipDependencyOrder :: Text -> Int
+scipDependencyOrder p = case p of
+  "src.File" -> 01
+  "scip.Range" -> 02
+  "scip.Symbol" -> 03
+  "scip.LocalName" -> 04
+  "scip.Documentation" -> 05
+  "scip.FileLanguage" -> 11 -- refers to src.File
+  "scip.FileRange" -> 21 -- refers to src.File and scip.Range
+  "scip.Definition" -> 31
+  "scip.Reference" -> 32
+  "scip.SymbolDocumentation" -> 33
+  "scip.SymbolName" -> 34
+  "scip.SymbolKind" -> 41
+  "scip.Metadata" -> 42
+  _ -> 100
+
+data MonikerKind = Export | Local | Import | Implementation
+  deriving (Enum)
+
+instance FromJSON MonikerKind where
+  parseJSON (String str) = case str of
+    "export" -> pure Export
+    "local" -> pure Local
+    "import" -> pure Import
+    "implementation" -> pure Implementation
+    s -> fail ("FromJSON.MonikerKind: unknown kind: " <> show s)
+  parseJSON s = fail ("FromJSON.MonikerKind: unknown kind: " <> show s)
+
+-- | A 0-indexed line/character-offset point in a document
+data Position = Position {
+      line :: {-# UNPACK #-} !Int64,
+      character :: {-# UNPACK #-} !Int64
+    }
+  deriving (Generic)
+
+instance FromJSON  Position where
+
+data Range = Range {
+      start :: {-# UNPACK #-} !Position,
+      end :: {-# UNPACK #-} !Position
+    }
+  deriving (Generic)
+
+instance FromJSON Range where
+
+-- LSIF ranges are 0-indexed, exclusive of end col.
+-- We want to store as Glean ranges, 1-indexed, inclusive of end col.
+toRange :: Range -> Value
+toRange Range{..} =
+  let colBegin = character start + 1
+       -- n.b. end col should be _inclusive_ of end, and >= col start
+      colEnd = max colBegin ((character end + 1) - 1)
+  in
+    object [
+      "lineBegin" .= (line start + 1),
+      "columnBegin" .= colBegin,
+      "lineEnd" .= (line end + 1),
+      "columnEnd" .= colEnd
+    ]
+
+--
+-- Rudimentary handling of semanticdb encoded symbol data
+--
+data Suffix
+  = SymUnspecifiedSuffix
+  | SymPackage
+  | SymType
+  | SymTerm
+  | SymMethod
+  | SymTypeParameter
+  | SymParameter
+  | SymMeta -- anything
+  deriving Enum
+
+-- These are all a bit wonky
+kindFromSuffix :: Suffix -> SymbolKind
+kindFromSuffix s = case s of
+  SymUnspecifiedSuffix -> SkUnknown
+  SymPackage -> SkPackage
+  SymType -> SkClass
+  SymTerm -> SkVariable
+  SymMethod -> SkMethod
+  SymTypeParameter -> SkTypeParameter
+  SymParameter -> SkField
+  SymMeta  -> SkUnknown
+
+parseSuffix :: Text -> (Text, Suffix)
+parseSuffix "" = ("", SymUnspecifiedSuffix)
+parseSuffix str = case Text.last str of
+  '/' -> (sym, SymPackage)
+  '#' -> (sym, SymType)
+  '.' -> case Text.last sym of
+    ')' -> (sym, SymMethod)
+    _'  -> (sym, SymTerm)
+  ':' -> (sym, SymMeta)
+  ']' -> (sym, SymTypeParameter)
+  ')' -> (sym, SymParameter)
+  _ -> (str, SymUnspecifiedSuffix)
+  where
+    sym = Text.init str
+
+-- | LSP symbolKind type (c.f. LSP.Types for similar examples)
+-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind
+--
+-- Should match lsif.SymbolKind
+--
+data SymbolKind
+    = SkFile
+    | SkModule
+    | SkNamespace
+    | SkPackage
+    | SkClass
+    | SkMethod
+    | SkProperty
+    | SkField
+    | SkConstructor
+    | SkEnum
+    | SkInterface
+    | SkFunction
+    | SkVariable
+    | SkConstant
+    | SkString
+    | SkNumber
+    | SkBoolean
+    | SkArray
+    | SkObject
+    | SkKey
+    | SkNull
+    | SkEnumMember
+    | SkStruct
+    | SkEvent
+    | SkOperator
+    | SkTypeParameter
+    | SkUnknown
+    deriving (Generic,Enum)
+
+-- From https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem
+-- Text documents have a language identifier to identify a document on the
+-- server side when it handles more than one language to avoid re-interpreting
+-- the file extension.
+--
+-- We add a couple of extra languages here
+--
+data LanguageId
+  = ABAP  -- "abap"
+  | WindowsBat -- "bat"
+  | BibTeX -- "bibtex"
+  | Clojure -- "clojure"
+  | Coffeescript -- "coffeescript"
+  | C -- "c"
+  | Cpp -- "cpp"
+  | CSharp -- "csharp"
+  | CSS -- "css"
+  | Diff -- "diff"
+  | Dart -- "dart"
+  | Dockerfile -- "dockerfile"
+  | Elixir -- "elixir"
+  | Erlang -- "erlang"
+  | FSharp -- "fsharp"
+  | Git -- "git-commit" and "git-rebase"
+  | Go -- "go"
+  | Groovy -- "groovy"
+  | Handlebars -- "handlebars"
+  | Haskell -- "haskell"
+  | HTML -- "html"
+  | Ini -- "ini"
+  | Java -- "java"
+  | JavaScript -- "javascript"
+  | JavaScriptReact -- "javascriptreact"
+  | JSON -- "json"
+  | LaTeX -- "latex"
+  | Less -- "less"
+  | Lua -- "lua"
+  | Makefile -- "makefile"
+  | Markdown -- "markdown"
+  | ObjectiveC -- "objective-c"
+  | ObjectiveCpp -- "objective-cpp"
+  | Perl -- "perl"
+  | Perl6 -- "perl6"
+  | PHP -- "php"
+  | Powershell -- "powershell"
+  | Pug -- "jade"
+  | Python -- "python"
+  | R -- "r"
+  | Razor -- (cshtml) "razor"
+  | Ruby -- "ruby"
+  | Rust -- "rust"
+  | SCSS -- "scss" (syntax using curly brackets), sass (indented syntax)
+  | Scala -- "scala"
+  | ShaderLab -- "shaderlab"
+  | Shell -- (Bash) "shellscript"
+  | SQL -- "sql"
+  | Swift -- "swift"
+  | TypeScript -- "typescript"
+  | TypeScriptReact -- "typescriptreact"
+  | TeX -- "tex"
+  | VisualBasic -- "vb"
+  | XML -- "xml"
+  | XSL -- "xsl"
+  | YAML -- "yaml"
+  | UnknownLanguage
+  -- extensions from Meta
+  | Kotlin
+  | OCaml
+  deriving (Enum)
+
+-- | Parse language strings from LSIF or SCIP to spec
+parseLanguage :: Text -> LanguageId
+parseLanguage s = case s of
+  "abap" -> ABAP
+  "bat" -> WindowsBat
+  "bibtex" -> BibTeX
+  "clojure" -> Clojure
+  "coffeescript" -> Coffeescript
+  "c" -> C
+  "cpp" -> Cpp
+  "csharp" -> CSharp
+  "css" -> CSS
+  "diff" -> Diff
+  "dart" -> Dart
+  "dockerfile" -> Dockerfile
+  "elixir" -> Elixir
+  "erlang" -> Erlang
+  "fsharp" -> FSharp
+  "git-commit" -> Git
+  "git-rebase" -> Git
+  "go" -> Go
+  "groovy" -> Groovy
+  "handlebars" -> Handlebars
+  "haskell" -> Haskell
+  "html" -> HTML
+  "ini" -> Ini
+  "java" -> Java
+  "javascript" -> JavaScript
+  "javascriptreact" -> JavaScriptReact
+  "json" -> JSON
+  "kotlin" -> Kotlin
+  "latex" -> LaTeX
+  "less" -> Less
+  "lua" -> Lua
+  "makefile" -> Makefile
+  "markdown" -> Markdown
+  "objective-c" -> ObjectiveC
+  "objective-cpp" -> ObjectiveCpp
+  "ocaml" -> OCaml
+  "perl" -> Perl
+  "perl6" -> Perl6
+  "php" -> PHP
+  "powershell" -> Powershell
+  "jade" -> Pug
+  "python" -> Python
+  "r" -> R
+  "razor" -> Razor
+  "ruby" -> Ruby
+  "rust" -> Rust
+  "scss" -> SCSS
+  "scala" -> Scala
+  "shaderlab" -> ShaderLab
+  "shellscript" -> Shell
+  "sql" -> SQL
+  "swift" -> Swift
+  "typescript" -> TypeScript
+  "typescriptreact" -> TypeScriptReact
+  "tex" -> TeX
+  "vb" -> VisualBasic
+  "xml" -> XML
+  "xsl" -> XSL
+  "yaml" -> YAML
+  _ -> UnknownLanguage
diff --git a/glean/lang/lsif/Data/LSIF/JSON.hs b/glean/lang/lsif/Data/LSIF/JSON.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/JSON.hs
@@ -0,0 +1,288 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- Barebones parser for LSIF/JSON dumps to LSIF.Types
+-- Examples given in
+-- https://github.com/microsoft/language-server-protocol/blob/main/indexFormat/specification.md
+--
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ApplicativeDo #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Data.LSIF.JSON ({-instances -}) where
+
+import Data.Aeson.Types
+import Data.Text ( Text )
+import qualified Data.Vector as V
+import Control.Applicative ( Alternative((<|>)) )
+
+import Data.Maybe ( fromMaybe )
+import Data.LSIF.Types
+import Data.LSIF.Gen
+
+instance FromJSON LSIF where
+  parseJSON = withArray "LSIF" $ fmap LSIF . V.mapM parseJSON
+
+instance FromJSON KeyFact where
+  parseJSON = withObject "LSIF.KeyFact" $ \o -> do
+    id_ <- o .: "id"
+    type_ <- o .: "type"
+    fact <- case (type_::Text) of
+      "vertex" -> parseVertex o
+      "edge" -> parseEdge o
+      _ -> fail $ "FromJSON.KeyFact: unknown object type: " <> show type_
+    return KeyFact{..}
+
+parseDiagnostic :: Value -> Parser Diagnostic
+parseDiagnostic (Object o) = Diagnostic
+  <$> o .: "severity"
+  <*> o .: "code"
+  <*> o .: "message"
+  <*> o .: "range"
+parseDiagnostic v = fail ("Unrecognized value in diagnostic results" <> show v)
+
+parseHoverContents :: Value -> Parser HoverContents
+parseHoverContents (Object o) = HoverSignature
+  <$> (o .: "language" <|> o .: "kind")
+  <*> o .: "value"
+parseHoverContents (String s) = pure (HoverText s)
+parseHoverContents v = fail ("Unrecognized value in hover contents: " <> show v)
+
+instance FromJSON Marker where
+  parseJSON (String str) = case str of
+    "begin" -> pure Begin
+    "end" -> pure End
+    s -> fail ("FromJSON.Marker: unknown marker: " <> show s)
+  parseJSON s = fail ("FromJSON.Marker. unknown marker: " <> show s)
+
+instance FromJSON Scope where
+  parseJSON (String str) = case str of
+    "project" -> pure ProjectScope
+    "document" -> pure DocumentScope
+    s -> fail ("FromJSON.Scope: unknown scope: " <> show s)
+  parseJSON s = fail ("FromJSON.Scope: unknown scope: " <> show s)
+
+-- | lsif dumps are rows of flattened objects, indexed by tags
+parseVertex :: Object -> Parser Fact
+parseVertex o = do
+  label::Text <- o .: "label"
+  case label of
+    "metaData" -> MetaData
+      <$> o .: "version"
+      <*> o .: "projectRoot"
+      <*> o .: "positionEncoding"
+      <*> o .: "toolInfo"
+    "project" -> Project
+      <$> o .: "kind"
+    "$event" -> Event
+      <$> o .: "kind"
+      <*> o .: "scope"
+      <*> o .: "data"
+    "range" -> SymbolRange
+      <$> (Range <$> o .: "start" <*> o .: "end")
+      <*> o .:? "tag"
+    "document" -> Document
+      <$> o .: "uri"
+      <*> (o .: "languageId" <|> o .: "language")
+    "moniker" -> Moniker
+      <$> o .: "kind"
+      <*> o .: "scheme"
+      <*> o .: "identifier"
+    "packageInformation" -> PackageInformation
+      <$> o .: "name"
+      <*> o .: "manager"
+      <*> (fromMaybe "" <$> (o .:? "version"))
+    "hoverResult" -> do
+      result <- o .: "result"
+      cs <- result .: "contents"
+      contents <- case cs of
+        Array arr -> V.mapM parseHoverContents arr
+        Object{} -> V.singleton <$> parseHoverContents cs
+        t -> fail $ "hoverResult: contents: unhandled type: " <> show t
+      return HoverResult{..}
+
+    "resultSet" -> pure ResultSet
+    "definitionResult" -> pure DefinitionResult
+    "declarationResult" -> pure DeclarationResult
+    "referenceResult" -> pure ReferenceResult
+
+    "diagnosticResult" -> do
+      rs <- o .: "result"
+      LsifDiagnosticResult <$> withArray "diagnosticResult"
+        (V.mapM parseDiagnostic) rs
+
+    "documentSymbolResult" -> do
+      rs <- o .: "result"
+      LsifDocumentSymbolResult <$> withArray "documentSymbols"
+        (V.mapM (withObject "documentSymbolId" (.: "id"))) rs
+
+    _ -> pure LsifUnknown
+
+instance FromJSON Tag where
+  parseJSON (Object o) = do
+    lsifType <- o .: "type"
+    case lsifType::Text of
+      "definition" -> Definition
+        <$> o .: "text"
+        <*> o .: "kind"
+        <*> o .: "fullRange"
+        <*> o .:? "tagDetail"
+      "declaration" -> Definition
+        <$> o .: "text"
+        <*> o .: "kind"
+        <*> o .: "fullRange"
+        <*> o .:? "tagDetail"
+      "reference" -> Reference
+        <$> o .: "text"
+      _ -> UnknownSymbol
+        <$> o .: "text"
+  parseJSON s = fail ("FromJSON.Tag: unknown tag type: " <> show s)
+
+instance FromJSON ToolInfo where
+  parseJSON = withObject "ToolInfo" $ \o -> ToolInfo
+    <$> o .: "name"
+    <*> (fromMaybe [] <$> o .:? "args")
+    <*> o .: "version"
+
+parseProperty :: Text -> Parser Property
+parseProperty "definitions" = pure Definitions
+parseProperty "references" = pure References
+parseProperty "referenceResults" = pure ReferenceResults
+parseProperty s = fail ("Unknown property: parsePropery: " <> show s)
+
+parseEdgeLabel :: Text -> Maybe Label
+parseEdgeLabel "moniker" = pure EdgeMoniker
+parseEdgeLabel "packageInformation" = pure EdgePackageInformation
+parseEdgeLabel "nextMoniker" = pure EdgeNextMoniker
+parseEdgeLabel "next" = pure EdgeNext
+parseEdgeLabel "textDocument/hover" = pure EdgeTextDocumentHover
+parseEdgeLabel "textDocument/definition" = pure EdgeTextDocumentDefinition
+parseEdgeLabel "textDocument/references" = pure EdgeTextDocumentReferences
+parseEdgeLabel "textDocument/diagnostic" = pure EdgeTextDocumentDiagnostic
+parseEdgeLabel "textDocument/documentSymbol" =
+  pure EdgeTextDocumentDocumentSymbol
+parseEdgeLabel "textDocument/foldingRange" = pure EdgeTextDocumentFoldingRange
+parseEdgeLabel "sourcegraph:documentationString" = Nothing
+parseEdgeLabel "sourcegraph:documentationChildren" = Nothing
+parseEdgeLabel _ = Nothing
+
+-- | lsif edges
+parseEdge :: Object -> Parser Fact
+parseEdge o = do
+  label <- o .: "label"
+  case label of
+    "contains" -> Contains
+      <$> o .: "outV"
+      <*> o .: "inVs"
+    "item" -> Item
+      <$> o .: "outV"
+      <*> o .: "inVs"
+      <*> o .: "document"
+      <*> explicitParseFieldMaybe
+            (withText "property" parseProperty) o "property"
+    s -> case parseEdgeLabel s of
+      Nothing -> pure LsifUnknown -- skip unknown edges
+      Just lbl -> Edge lbl
+        <$> o .: "outV"
+        <*> o .: "inV"
+
+-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind
+instance FromJSON SymbolKind where
+  parseJSON (Number n) = pure $ case n of
+    1 -> SkFile
+    2 -> SkModule
+    3 -> SkNamespace
+    4 -> SkPackage
+    5 -> SkClass
+    6 -> SkMethod
+    7 -> SkProperty
+    8 -> SkField
+    9 -> SkConstructor
+    10 -> SkEnum
+    11 -> SkInterface
+    12 -> SkFunction
+    13 -> SkVariable
+    14 -> SkConstant
+    15 -> SkString
+    16 -> SkNumber
+    17 -> SkBoolean
+    18 -> SkArray
+    19 -> SkObject
+    20 -> SkKey
+    21 -> SkNull
+    22 -> SkEnumMember
+    23 -> SkStruct
+    24 -> SkEvent
+    25 -> SkOperator
+    26 -> SkTypeParameter
+    _ -> SkUnknown
+  parseJSON s = fail ("FromJSON.SymbolKind: " <> show s)
+
+-- From https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem
+instance FromJSON LanguageId where
+  parseJSON (String s) = pure $ case s of
+    "abap" -> ABAP
+    "bat" -> WindowsBat
+    "bibtex" -> BibTeX
+    "clojure" -> Clojure
+    "coffeescript" -> Coffeescript
+    "c" -> C
+    "cpp" -> Cpp
+    "csharp" -> CSharp
+    "css" -> CSS
+    "diff" -> Diff
+    "dart" -> Dart
+    "dockerfile" -> Dockerfile
+    "elixir" -> Elixir
+    "erlang" -> Erlang
+    "fsharp" -> FSharp
+    "git-commit" -> Git
+    "git-rebase" -> Git
+    "go" -> Go
+    "groovy" -> Groovy
+    "handlebars" -> Handlebars
+    "haskell" -> Haskell
+    "html" -> HTML
+    "ini" -> Ini
+    "java" -> Java
+    "javascript" -> JavaScript
+    "javascriptreact" -> JavaScriptReact
+    "json" -> JSON
+    "latex" -> LaTeX
+    "less" -> Less
+    "lua" -> Lua
+    "makefile" -> Makefile
+    "markdown" -> Markdown
+    "objective-c" -> ObjectiveC
+    "objective-cpp" -> ObjectiveCpp
+    "perl" -> Perl
+    "perl6" -> Perl6
+    "php" -> PHP
+    "powershell" -> Powershell
+    "jade" -> Pug
+    "python" -> Python
+    "r" -> R
+    "razor" -> Razor
+    "ruby" -> Ruby
+    "rust" -> Rust
+    "scss" -> SCSS
+    "scala" -> Scala
+    "shaderlab" -> ShaderLab
+    "shellscript" -> Shell
+    "sql" -> SQL
+    "swift" -> Swift
+    "typescript" -> TypeScript
+    "typescriptreact" -> TypeScriptReact
+    "tex" -> TeX
+    "vb" -> VisualBasic
+    "xml" -> XML
+    "xsl" -> XSL
+    "yaml" -> YAML
+    _ -> UnknownLanguage
+  parseJSON s = fail ("FromJSON.LanguageId: " <> show s)
diff --git a/glean/lang/lsif/Data/LSIF/Moniker.hs b/glean/lang/lsif/Data/LSIF/Moniker.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/Moniker.hs
@@ -0,0 +1,38 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Processing moniker strings. These are indexer-specific entity encodings,
+often with a lot of structure. We can pull out some useful facts if we know
+the encoding.
+
+-}
+
+module Data.LSIF.Moniker ( processMoniker ) where
+
+import Data.Text ( Text )
+import Data.LSIF.Gen
+
+type Scheme = Text
+
+processMoniker :: MonikerKind -> Scheme -> Text -> Maybe (Text, SymbolKind)
+processMoniker _kind scheme ident = case scheme of
+  -- lsif-java or scip-java indexer
+  "semanticdb" -> processSemanticDB ident
+  _ -> Nothing
+
+-- From lsif-java, SemanticDB Symbols, the kind of a symbol is encoded
+-- in its final char. https://tinyurl.com/3xwarf74
+--
+-- In Scip, this is the final 'descriptor' of the symbol
+--
+processSemanticDB :: Text -> Maybe (Text, SymbolKind)
+processSemanticDB "" = Nothing
+processSemanticDB ident = case parseSuffix ident of
+    (ident', suffix) -> Just (ident', kindFromSuffix suffix)
diff --git a/glean/lang/lsif/Data/LSIF/Types.hs b/glean/lang/lsif/Data/LSIF/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Data/LSIF/Types.hs
@@ -0,0 +1,207 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- Types for LSIF
+-- https://github.com/microsoft/language-server-protocol/blob/main/indexFormat/specification.md
+--
+-- These represent VS Code LSP-like bulk requests for symbol information
+--
+
+module Data.LSIF.Types (
+  Fact(..),
+  ToolInfo(..),
+  Scope(..),
+  Marker(..),
+  Tag(..),
+  LSIF(..),
+  KeyFact(..),
+  Diagnostic(..),
+  HoverContents(..),
+  Property(..),
+  Label(..),
+
+) where
+
+-- types only
+import Data.Text ( Text )
+import Data.Vector ( Vector )
+import GHC.Generics ( Generic )
+
+import Data.LSIF.Gen ( Id, MonikerKind, Range, SymbolKind, LanguageId )
+
+-- | LSIF document facts. Fact with id N is at vector index N+1
+newtype LSIF = LSIF (Vector KeyFact)
+  deriving (Generic)
+
+-- | A single  "fact" in an LSIF dump, keyed by id
+data KeyFact
+  = KeyFact {
+      id_ :: {-# UNPACK #-}!Id,
+      fact :: !Fact
+  }
+
+-- | LSIF records of various sorts. Constructors correspond to labels
+-- We flatten edges and vertices here, as they will all be serialized back to
+-- Glean facts
+data Fact
+  --
+  -- Verticies
+  --
+  = MetaData {
+      version :: !Text, -- ^ LSIF format version
+      projectRoot :: !Text, -- ^ URI of project root
+      positionEncoding :: !Text, -- ^ encoding, always utf16
+      toolInfo :: Maybe ToolInfo -- ^ info about tool that made the index
+    }
+  | Project {
+      kind :: !LanguageId
+  }
+  -- begin and end events for documents and project sections
+  | Event {
+      eventKind :: !Marker,
+      scope :: !Scope,
+      data_ :: {-# UNPACK #-}!Id
+  }
+  | Document {
+      uri :: !Text,
+      language :: !LanguageId
+  }
+  | HoverResult {
+      contents :: Vector HoverContents
+  }
+  -- Project-level symbol identifiers, usually for imports and exports
+  -- These are glass-like symbol ids, identified by opaque text and a scheme
+  | Moniker {
+      monikerKind :: !MonikerKind,
+      scheme :: !Text,
+      identifier :: !Text
+  }
+  | PackageInformation {
+      name :: !Text,
+      manager :: !Text,
+      version :: !Text
+  }
+  | SymbolRange {
+      range :: {-# UNPACK #-}!Range,
+      tag :: Maybe Tag
+  }
+  | ResultSet -- indirection nodes
+  | DefinitionResult
+  | DeclarationResult
+  | ReferenceResult
+
+  | LsifDiagnosticResult {
+      diagnostics :: Vector Diagnostic
+  }
+  | LsifDocumentSymbolResult {
+      documentSymbols :: !(Vector Id)
+  }
+  | LsifUnknown
+  --
+  -- Edge constructors
+  -- Edges are labels + an in and out vertex id
+  --
+  | Edge {
+      label :: !Label,
+      outV :: {-# UNPACK #-}!Id,
+      inV :: {-# UNPACK #-}!Id
+    }
+  | Contains {
+    outV :: {-# UNPACK #-}!Id,
+    inVs :: !(Vector Id)
+  }
+  | Item {
+    outV :: {-# UNPACK #-}!Id,
+    inVs :: !(Vector Id),
+    document :: {-# UNPACK #-}!Id,
+    property :: Maybe Property
+  }
+  deriving (Generic)
+
+data HoverContents
+  = HoverSignature {
+      hoverLanguage :: !LanguageId,
+      value :: !Text
+  }
+  | HoverText !Text
+
+data Diagnostic
+  = Diagnostic {
+      severity :: !Int,
+      code :: !Int,
+      message :: !Text,
+      diagnosticRange :: {-# UNPACK #-}!Range
+  }
+
+
+data Marker = Begin | End
+
+data Scope = DocumentScope | ProjectScope
+
+
+
+-- | LSIF tags, very close to LSP method call results
+data Tag
+  = Definition {
+    -- The text covered by the range
+      tagText :: !Text,
+    -- The kind of the declaration.
+      tagKind :: !SymbolKind,
+      -- The full range of the declaration not including leading/trailing
+      -- whitespace but everything else, e.g comments and code.  The range must
+      -- be included in fullRange.
+      fullRange :: {-# UNPACK #-}!Range,
+      -- Optional detail information for the declaration.
+      tagDetail :: Maybe Text
+  }
+  | Declaration {
+    -- The text covered by the range
+      tagText :: !Text,
+    -- The kind of the declaration.
+      tagKind :: !SymbolKind,
+      -- The full range of the declaration not including leading/trailing
+      -- whitespace but everything else, e.g comments and code.  The range must
+      -- be included in fullRange.
+      fullRange :: {-# UNPACK #-}!Range,
+      -- Optional detail information for the declaration.
+      tagDetail :: Maybe Text
+  }
+  | Reference {
+      tagText :: !Text
+  }
+  | UnknownSymbol {
+      tagText :: !Text
+  }
+  deriving (Generic)
+
+-- | Information about the tool that created the dump
+data ToolInfo =
+  ToolInfo {
+    toolName :: !Text,
+    toolArgs :: [Text],
+    toolVersion :: Maybe Text
+  }
+  deriving (Generic)
+
+data Property = Definitions | References | ReferenceResults
+
+data Label
+  = EdgeContains
+  | EdgeMoniker
+  | EdgeNext
+  | EdgeNextMoniker
+  | EdgePackageInformation
+  | EdgeTextDocumentDefinition
+  | EdgeTextDocumentDiagnostic
+  | EdgeTextDocumentDocumentSymbol
+  | EdgeTextDocumentHover
+  | EdgeTextDocumentReferences
+  | EdgeTextDocumentFoldingRange
+  -- added in lsif-go 1.7.x
+  | EdgeSourceGraphDocString
+  | EdgeSourceGraphDocChildren
diff --git a/glean/lang/lsif/Glean/LSIF/Driver.hs b/glean/lang/lsif/Glean/LSIF/Driver.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/Glean/LSIF/Driver.hs
@@ -0,0 +1,164 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Generic indexer for LSIF. Supply name of lsif binary in $PATH to run
+predicates for typescript.
+
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+
+module Glean.LSIF.Driver (
+    LsifIndexerParams(..),
+    processLSIF,
+    runIndexer,
+
+    -- writing
+    writeJSON
+ ) where
+
+import Control.Exception ( throwIO, ErrorCall(ErrorCall) )
+import Control.Monad.State.Strict
+import Data.Text ( Text )
+import Data.List ( intersperse )
+import System.Directory ( getHomeDirectory, withCurrentDirectory, makeAbsolute )
+import System.FilePath
+    ( (</>), dropTrailingPathSeparator, takeBaseName )
+import System.IO ( openFile, IOMode(WriteMode), hClose )
+import System.IO.Temp ( withSystemTempDirectory )
+import System.Process ( callProcess, callCommand )
+import Text.Printf ( printf )
+import Util.Log ( logInfo )
+import qualified Data.Aeson as Aeson
+import qualified Data.ByteString.Char8 as Strict
+import qualified Data.ByteString.Lazy.Char8 as Lazy
+import qualified Data.Vector as V
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Text as Text
+
+import qualified Foreign.CPP.Dynamic
+
+import qualified Data.LSIF.Angle as LSIF
+
+data LsifIndexerParams = LsifIndexerParams
+  { lsifBinary :: FilePath
+  , lsifArgs :: FilePath -> [String]
+  , lsifRoot :: FilePath
+  , lsifStdout :: Bool
+  }
+
+-- | Run an LSIF indexer, and convert to a Glean's lsif.angle database
+-- foramt, returning a single JSON value that can be sent to the Glean server
+runIndexer :: LsifIndexerParams -> IO Aeson.Value
+runIndexer params@LsifIndexerParams{..} = do
+  repoDir <- makeAbsolute lsifRoot -- save this before we switch to tmp
+  withSystemTempDirectory "glean-lsif" $ \lsifDir -> do
+    let lsifFile = lsifDir </> "index.lsif"
+    runLSIFIndexer params { lsifRoot = repoDir } lsifFile
+    processLSIF repoDir lsifFile
+
+-- | Run a generic lsif-producing indexer on a repository,
+-- put lsif dump output into outputFile
+runLSIFIndexer :: LsifIndexerParams -> FilePath -> IO ()
+runLSIFIndexer LsifIndexerParams{..} outputFile =
+  withCurrentDirectory lsifRoot $ do
+    logInfo $ printf "Indexing %s with %s" (takeBaseName lsifRoot) lsifBinary
+    let args = lsifArgs outputFile
+    if lsifStdout
+      then callCommand $
+        printf "%s %s > %s" lsifBinary (unwords args) outputFile
+      else callProcess lsifBinary args
+
+-- | Convert an lsif json dump into Glean lsif.angle JSON object
+processLSIF :: FilePath -> FilePath -> IO Aeson.Value
+processLSIF repoDir lsifFile = do
+  logInfo $ "Using LSIF from " <> lsifFile
+  toLsifAngle repoDir =<< Lazy.readFile lsifFile
+
+-- | Write json to file
+writeJSON :: FilePath -> Aeson.Value -> IO ()
+writeJSON outFile json = do
+  logInfo $ "Writing Angle facts to " <> outFile
+  case json of
+    Aeson.Array facts -> encodeChunks outFile facts
+    _ -> Aeson.encodeFile outFile json
+
+-- Uses less memory if we do this piece-wise
+encodeChunks :: FilePath -> V.Vector Aeson.Value -> IO ()
+encodeChunks file vs = do
+  handle <- openFile file WriteMode
+  Lazy.hPut handle "["
+  mapM_ (writeChunk handle) $
+          intersperse (Right ",") (map Left (V.toList vs))
+  Lazy.hPut handle "]\n"
+  hClose handle
+  where
+    writeChunk handle (Left c) = Lazy.hPut handle (Aeson.encode c)
+    writeChunk handle (Right s) = Lazy.hPut handle (s <> "\n")
+
+-- Get some likely prefix paths to drop from indexers
+-- E.g. typescript with a yarn install puts .config/yarn paths for libraries
+dropPrefixPaths :: FilePath -> IO [Text]
+dropPrefixPaths repoDir = do
+  home <- Text.pack <$> getHomeDirectory
+  return $ map ("file://" <>)
+  -- typescript system paths
+    [ home <> "/.config/yarn/global/node_modules"
+    , "/usr/local/share/.config/yarn/global/node_modules"
+    -- tests/CI install path
+    , home <> "/.hsthrift/lib/node_modules"
+   -- typescript with npm
+    , "/usr/lib/node_modules"
+   -- rust system paths
+    , "/usr/lib"
+    , home <> "/.cargo/registry"
+    , home <> "/.rustup/toolchains/stable-x86_64-unknown-linux-gnu"
+    , home <> "/.rustup/toolchains/stable-aarch64-unknown-linux-gnu"
+    -- repoDir root, so everything is repo-relative
+    , Text.pack (dropTrailingPathSeparator repoDir)
+    ]
+
+toLsifAngle :: FilePath -> Lazy.ByteString -> IO Aeson.Value
+toLsifAngle repoDir str = do
+  paths <- dropPrefixPaths repoDir
+  (facts, env) <- parseChunks paths str
+  logInfo "Generating cross-references"
+  let !xrefs = evalState LSIF.emitFileFactSets  env
+  let result = LSIF.generateJSON (LSIF.insertPredicateMap facts xrefs)
+  return (Aeson.Array $ V.fromList result)
+
+-- | Lazily parse lsif as one object per line. File is consumed and can be
+-- dropped at end of parsing We go to some lengths to avoid retaining things,
+-- just the state needed to emit xrefs at the end of
+-- the analysis.
+parseChunks :: [Text] -> Lazy.ByteString -> IO (LSIF.PredicateMap, LSIF.Env)
+parseChunks paths str =
+  let contents = map (Strict.concat . Lazy.toChunks) (Lazy.lines str)
+      initState = LSIF.emptyEnv { LSIF.root = paths }
+  in runStateT (runToAngle contents) initState
+
+-- strict left fold over each chunk, producing accumulating output facts
+-- and final global state of the analysis
+runToAngle :: [Strict.ByteString] -> StateT LSIF.Env IO LSIF.PredicateMap
+runToAngle = go HashMap.empty -- a foldlM'
+  where
+    go !acc [] = return acc
+    go !acc (line:lines) = do
+      preds <- parseAsJSON line
+      go (LSIF.insertPredicateMap acc preds) lines
+
+parseAsJSON :: Strict.ByteString -> StateT LSIF.Env IO [LSIF.Predicate]
+parseAsJSON line = do
+  rawjson <- liftIO $ Foreign.CPP.Dynamic.parseJSON line
+  case rawjson of
+    Left bad -> liftIO $ throwIO (ErrorCall (Text.unpack bad))
+    Right good -> case Aeson.fromJSON good of
+      Aeson.Error err -> liftIO $ throwIO (ErrorCall err)
+      Aeson.Success fact -> LSIF.factToAngle fact
diff --git a/glean/lang/lsif/indexer/Glean/Indexer/LSIF.hs b/glean/lang/lsif/indexer/Glean/Indexer/LSIF.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/lsif/indexer/Glean/Indexer/LSIF.hs
@@ -0,0 +1,73 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Indexer.LSIF (
+    indexer,
+    derive
+  ) where
+
+import Options.Applicative
+import Data.Text ( Text )
+import Control.Monad ( forM_ )
+
+import Glean.Derive
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Write
+import Glean.LSIF.Driver as LSIF
+
+import qualified Glean
+import System.Directory (doesFileExist)
+import Util.OptParse (maybeStrOption)
+
+newtype LSIF = LSIF
+  { lsifIndexFile :: Maybe FilePath
+  }
+
+options :: Parser LSIF
+options =
+  LSIF <$> maybeStrOption (
+    long "input" <>
+    help "Optional path to a specific lsif index file")
+
+-- | An indexer that just slurps an existing LSIF file. Usage:
+--
+--   cli:    glean index lsif <file> --repo name/hash
+--   shell:  :index lsif <file>
+--
+indexer :: Indexer LSIF
+indexer = Indexer {
+  indexerShortName = "lsif",
+  indexerDescription = "Index an LSIF file",
+  indexerOptParser = options,
+  indexerRun = \LSIF{..} backend repo IndexerParams{..} -> do
+    lsifFile <- case lsifIndexFile of
+      Just f -> pure f
+      Nothing -> do -- then indexerRoot should be an lsif file
+        mFile <- doesFileExist indexerRoot
+        if mFile
+          then pure indexerRoot
+          else error "Neither --input nor --root are lsif files"
+    val <- LSIF.processLSIF indexerRoot lsifFile
+    sendJsonBatches backend repo "lsif" val
+    derive backend repo
+  }
+
+derive :: Glean.Backend b => b -> Glean.Repo -> IO ()
+derive backend repo = forM_ lsifDerivedPredicates $ \pred_ ->
+  derivePredicate backend repo Nothing Nothing
+    (parseRef pred_) Nothing
+
+-- Should correspond to stored predicates in lsif.angle
+-- shared amongst all LSIF-based language indexers
+lsifDerivedPredicates :: [Text]
+lsifDerivedPredicates =
+  [ "lsif.MonikerDefinition"
+  , "lsif.NameLowerCase"
+  , "lsif.NameDefinition"
+  ]
diff --git a/glean/lang/python-scip/Glean/Indexer/PythonScip.hs b/glean/lang/python-scip/Glean/Indexer/PythonScip.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/python-scip/Glean/Indexer/PythonScip.hs
@@ -0,0 +1,44 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.PythonScip ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External (sendJsonBatches)
+import Glean.Indexer.SCIP (derive)
+import Glean.SCIP.Driver as SCIP
+
+newtype PythonScip = PythonScip { pythonScipBinary :: FilePath }
+
+options :: Parser PythonScip
+options = do
+    pythonScipBinary <- strOption $
+        long "scip-python" <>
+        value "scip-python" <>
+        help "path to scip-python binary"
+    return PythonScip{..}
+
+indexer :: Indexer PythonScip
+indexer = Indexer {
+    indexerShortName = "python-scip",
+    indexerDescription = "Index Python code with `scip-python`",
+    indexerOptParser = options,
+    indexerRun = \PythonScip{..} backend repo IndexerParams{..} -> do
+        val <- SCIP.runIndexer ScipIndexerParams {
+            scipBinary = pythonScipBinary,
+            scipArgs = const [ "index", "--project-version", "test", "."],
+            scipRoot = indexerRoot,
+            scipWritesLocal = True,
+            scipLanguage = Just SCIP.Python
+        }
+        sendJsonBatches backend repo (pythonScipBinary <> "/scip") val
+        derive backend repo
+}
diff --git a/glean/lang/rust-lsif/Glean/Indexer/RustLsif.hs b/glean/lang/rust-lsif/Glean/Indexer/RustLsif.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/rust-lsif/Glean/Indexer/RustLsif.hs
@@ -0,0 +1,47 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.RustLsif ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Indexer.LSIF ( derive )
+import Glean.LSIF.Driver as LSIF
+
+newtype RustLsif = RustLsif
+  { rustAnalyzerBinary :: FilePath
+  }
+
+options :: Parser RustLsif
+options = do
+  rustAnalyzerBinary <- strOption $
+    long "rust-analyzer" <>
+    value "rust-analyzer" <>
+    help "path to the rust-analyzer binary"
+  return RustLsif{..}
+
+indexer :: Indexer RustLsif
+indexer = Indexer {
+  indexerShortName = "rust-lsif",
+  indexerDescription = "Index Rust code via LSIF",
+  indexerOptParser = options,
+  indexerRun = \RustLsif{..} backend repo IndexerParams{..} -> do
+    let
+      params = LsifIndexerParams {
+        lsifBinary = rustAnalyzerBinary,
+        lsifArgs = \_outFile -> [ "lsif", "." ],
+        lsifRoot = indexerRoot,
+        lsifStdout = True
+      }
+    val <- LSIF.runIndexer params
+    sendJsonBatches backend repo (rustAnalyzerBinary <> "/lsif") val
+    derive backend repo
+  }
diff --git a/glean/lang/rust-scip/Glean/Indexer/RustScip.hs b/glean/lang/rust-scip/Glean/Indexer/RustScip.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/rust-scip/Glean/Indexer/RustScip.hs
@@ -0,0 +1,46 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.RustScip ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Indexer.SCIP ( derive )
+import Glean.SCIP.Driver as SCIP
+
+newtype RustScip = RustScip
+  { rustAnalyzerBinary :: FilePath
+  }
+
+options :: Parser RustScip
+options = do
+  rustAnalyzerBinary <- strOption $
+    long "rust-analyzer" <>
+    value "rust-analyzer" <>
+    help "path to the rust-analyzer binary"
+  return RustScip{..}
+
+indexer :: Indexer RustScip
+indexer = Indexer {
+  indexerShortName = "rust-scip",
+  indexerDescription = "Index Rust code with `rust-analyzer scip`",
+  indexerOptParser = options,
+  indexerRun = \RustScip{..} backend repo IndexerParams{..} -> do
+    val <- SCIP.runIndexer ScipIndexerParams {
+                    scipBinary = rustAnalyzerBinary,
+                    scipArgs = const [ "scip", "." ],
+                    scipRoot = indexerRoot,
+                    scipWritesLocal = True,
+                    scipLanguage = Just SCIP.Rust
+                 }
+    sendJsonBatches backend repo (rustAnalyzerBinary <> "/scip") val
+    derive backend repo
+  }
diff --git a/glean/lang/scip/Data/SCIP/Angle.hs b/glean/lang/scip/Data/SCIP/Angle.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/scip/Data/SCIP/Angle.hs
@@ -0,0 +1,549 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Convert Data.SCIP into glean/schema/lsif.angle-compatible data via JSON.
+
+Note: this module generates Angle but has no dependency on the Glean LSIF
+schema (which it targets), to make developer iteration quicker.
+
+-}
+
+{-# LANGUAGE DataKinds         #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+module Data.SCIP.Angle (
+    scipToAngle,
+    SCIP.LanguageId(..)
+  ) where
+
+import Control.Monad
+import Lens.Micro ((^.))
+import Data.Bits ( Bits(testBit) )
+import Data.Maybe ( catMaybes, fromMaybe )
+import Data.Function ((&))
+import Data.Text ( Text )
+import qualified Data.Text as Text
+import Data.Set ( Set )
+import qualified Data.Set as Set
+import qualified Data.Aeson as Aeson
+import Data.Int ( Int32, Int64 )
+import qualified Data.ByteString as B
+import Data.HashMap.Strict ( HashMap )
+import qualified Data.HashMap.Strict as HashMap
+import Data.Map.Strict ( Map, ( !? ) )
+import qualified Data.Map.Strict as Map
+import Control.Monad.State.Strict
+import qualified Data.ProtoLens as Proto
+import qualified Data.Vector as V
+import Data.Aeson
+
+import qualified Proto.Scip as Scip
+import qualified Proto.Scip_Fields as Scip
+
+import qualified Data.LSIF.Gen as SCIP
+
+{-
+
+Debug scip files directly via protoc. Assuming you the scip.proto file handy
+From https://github.com/sourcegraph/scip/blob/main/scip.proto
+
+> protoc --decode scip.Index scip.proto  < index.scip
+
+The approach is to faithfully capture SCIP keyed by scip.Symbol.
+Then derive xref relationships (and connect hovers to definitions),
+in the Glean side
+
+-}
+
+type Parse a = forall m . Monad m => StateT Env m a
+
+data StringPredicate =
+  Symbol
+  | LocalName
+  | File
+  | DisplayName
+  deriving (Eq, Ord)
+
+data Env = Env {
+    -- unique supply for new Glean fact identifiers
+    unique :: {-# UNPACK #-}!Int64,
+
+    -- Hashmaps from any raw text fact to the id we generated.
+    -- Used to do a bit of sharing before emitting to Glean.
+    -- We maintain one hashmap per string predicate.
+    factId :: !(Map StringPredicate (HashMap Text SCIP.Id))
+  }
+
+emptyState :: Env
+emptyState = Env
+  1 {- cannot use 0 as a fact id -}
+  Map.empty
+
+--
+-- Scip doesn't number facts, but it is still useful for us to do so,
+-- to get more sharing in the output json
+--
+nextId :: Parse SCIP.Id
+nextId = do
+  !i <- gets unique
+  modify $ \e -> e { unique = i + 1 }
+  return (SCIP.Id i)
+
+setDefFact :: StringPredicate -> Text -> SCIP.Id -> Parse ()
+setDefFact pred val i = modify $ \e ->
+  let m = factId e !? pred & fromMaybe HashMap.empty & HashMap.insert val i in
+  e { factId = Map.insert pred m (factId e)}
+
+getDefFactId :: StringPredicate -> Text -> Parse (Maybe SCIP.Id)
+getDefFactId pred sym = do
+  m <- gets factId
+  pure $ m !? pred >>= HashMap.lookup sym
+
+-- | Make a fresh name or return an existing one if we've seen it
+getOrSetFact :: StringPredicate -> Text -> Parse (SCIP.Id, Bool)
+getOrSetFact pred sym = do
+  mId <- getDefFactId pred sym
+  case mId of
+    Nothing -> do
+      id_ <- nextId
+      setDefFact pred sym id_
+      return (id_, False)
+    Just id_ -> return (id_, True)
+
+--
+-- | Parse scip.proto into JSON-encoded Angle facts for the scip.angle schema
+--
+-- Uses the proto-lens interface to scip.proto
+--
+scipToAngle
+  :: Maybe SCIP.LanguageId
+  -> Bool
+  -> Maybe FilePath
+  -> Maybe FilePath
+  -> B.ByteString
+  -> Aeson.Value
+scipToAngle mlang inferLanguage mPathPrefix mStripPrefix scip =
+  Aeson.Array $ V.fromList $
+    SCIP.generateSCIPJSON (SCIP.insertPredicateMap HashMap.empty result)
+  where
+    (result,_) = runState (runTranslate mlang
+      inferLanguage mPathPrefix mStripPrefix scip) emptyState
+
+-- | First pass, grab all the occurences with _role := Definition
+-- build up symbol string -> fact id for all defs
+runTranslate
+  :: Maybe SCIP.LanguageId
+  -> Bool
+  -> Maybe FilePath
+  -> Maybe FilePath
+  -> B.ByteString
+  -> Parse [SCIP.Predicate]
+runTranslate mlang inferLanguage mPathPrefix mStripPrefix scip =
+  case Proto.decodeMessage scip of
+    Left err -> error err
+    Right (v :: Scip.Index) -> do
+      a <- decodeScipMetadata (v ^. Scip.metadata)
+      bs <- mapM
+        (decodeScipDoc mlang inferLanguage mPathPrefix mStripPrefix)
+        (v ^. Scip.documents)
+      return (a <> concat bs)
+
+--
+-- Each document has a repo-relative filepath, defs and refs (symbols and
+-- occurences). Generate fact ids and record symbol id facts as we find them,
+-- then cross-reference with occurences in second pass
+--
+decodeScipDoc
+  :: Maybe SCIP.LanguageId
+  -> Bool
+  -> Maybe FilePath
+  -> Maybe FilePath
+  -> Scip.Document
+  -> Parse [SCIP.Predicate]
+decodeScipDoc mlang inferLanguage mPathPrefix mStripPrefix doc = do
+  srcFileId <- nextId
+  let filepath0 = doc ^. Scip.relativePath
+      -- first, strip any matching prefix
+      filepath1 = case Text.pack <$> mStripPrefix of
+        Nothing -> filepath0
+        Just prefix -> fromMaybe filepath0 $ Text.stripPrefix prefix filepath0
+      -- and maybe prepend a new prefix
+      filepath = case Text.pack <$> mPathPrefix of
+        Nothing -> filepath1
+        Just prefix -> prefix <> filepath1
+  setDefFact File filepath srcFileId
+  let srcFile = SCIP.srcFile srcFileId filepath
+  langFileId <- nextId
+  let parseLang = SCIP.parseLanguage (doc ^. Scip.language)
+      langEnum = fromEnum $ case parseLang of
+                SCIP.UnknownLanguage
+                  -- if --infer-language , look at the suffix
+                  | inferLanguage
+                  , Just langId <- fileLanguageOf filepath
+                  -> langId
+                  -- otherwise if --language, assume that's correct
+                  | Just langId <- mlang -> langId -- use default if present
+                  -- otherwise its really unknown
+                  | otherwise -> SCIP.UnknownLanguage
+                x -> x -- scip document provides the language
+  fileLang <- SCIP.predicateId "scip.FileLanguage" langFileId
+    [ "file" .= srcFileId
+    , "language" .= langEnum
+    ]
+  occs <- mapM (decodeScipOccurence srcFileId filepath)
+      (doc ^. Scip.occurrences)
+  infos <- mapM (decodeScipInfo filepath) (doc ^. Scip.symbols)
+  return (srcFile : fileLang <> concat (occs <> infos))
+
+-- We really don't want to do a general purpose language detector
+-- but rely on the indexer knowing things. For the Java/Kotlin case,
+-- files are frequently intermingled in the same build so we can't
+-- decide a priori which language is being indexed
+fileLanguageOf :: Text -> Maybe  SCIP.LanguageId
+fileLanguageOf filepath
+  | "kt" `Text.isSuffixOf` filepath = Just SCIP.Kotlin
+  | "java" `Text.isSuffixOf` filepath = Just SCIP.Java
+  | otherwise = Nothing
+
+decodeScipInfo :: Text -> Scip.SymbolInformation -> Parse [SCIP.Predicate]
+decodeScipInfo filepath info = do
+  (docIds, docFacts) <- unzip <$> forM scipDocs (\docStr -> do
+    docId <- nextId
+    return (docId, SCIP.Predicate "scip.Documentation" [
+            object [ SCIP.factId docId, "key" .= Text.strip docStr ]
+          ]))
+  mSymId <- getSymbolId scipSymbol filepath
+  symDocFacts <- case mSymId of
+    Nothing -> return []
+    Just symId -> forM docIds (\docId ->
+        SCIP.predicateId "scip.SymbolDocumentation" docId [
+          "symbol" .= symId,
+          "docs" .= docId
+        ])
+  displayNameFacts <- case mSymId of
+    Nothing -> return []
+    Just symId -> case scipDisplayName of
+      "" -> return []
+      _ ->  displayNameFacts scipDisplayName symId
+  relationshipsFacts <- case mSymId of
+    Nothing -> return []
+    Just symId -> forM scipRelationshps (\rel ->
+        if rel ^. Scip.isImplementation then do
+          let implementedSymbol = rel ^. Scip.symbol
+          implementedSymbolId <- getSymbolId implementedSymbol filepath
+          case implementedSymbolId of
+            Nothing -> return []
+            Just implementedSymbolId ->
+              SCIP.predicate "scip.IsImplementation" [
+                  "symbol" .= symId,
+                  "implemented" .= implementedSymbolId
+                ]
+        else
+          pure [] )
+  return
+    ( docFacts
+    <> concat symDocFacts
+    <> displayNameFacts
+    <> concat relationshipsFacts )
+
+  where
+    scipSymbol = info ^. Scip.symbol
+    scipDocs = info ^. Scip.documentation
+    scipDisplayName = info ^. Scip.displayName
+    scipRelationshps = info ^. Scip.relationships
+
+getSymbolId :: Text -> Text -> Parse (Maybe SCIP.Id)
+getSymbolId symbol filepath = do
+  let eSym = symbolFromString symbol
+  let qualifiedSymbol = case eSym of
+        Left err -> error(show err)
+        Right (Local _) -> filepath <> "/" <> symbol
+        Right (Global {}) -> symbol
+  getDefFactId Symbol qualifiedSymbol
+
+
+displayNameFacts :: Text -> SCIP.Id -> Parse [SCIP.Predicate]
+displayNameFacts scipDisplayName symId = do
+  (displayNameId, seenDisplayName) <- getOrSetFact DisplayName scipDisplayName
+  let displayNameFact =
+        ([ SCIP.Predicate "scip.DisplayName"
+              [object [SCIP.factId displayNameId, "key" .= scipDisplayName]] |
+          not seenDisplayName ])
+  symbolDisplayNameFact <-
+    SCIP.predicate
+      "scip.DisplayNameSymbol"
+      ["symbol" .= symId, "displayName" .= displayNameId]
+  return (displayNameFact <> symbolDisplayNameFact)
+
+
+-- | An occurence of a symbol in a given document the optional symbol role
+-- will tell us if it is an xref or a def or other
+decodeScipOccurence
+  :: SCIP.Id
+  -> Text
+  -> Scip.Occurrence
+  -> Parse [SCIP.Predicate]
+decodeScipOccurence fileId filepath occ = do
+    fileRangeId <- nextId
+    fileRange <- SCIP.predicateId "scip.FileRange" fileRangeId
+      [ "file" .= fileId
+      , "range" .= decodeScipRange scipRange
+      ]
+    let eSym = symbolFromString scipSymbol
+    symbolFacts <- case eSym of
+          Left err -> error (show err) -- Can't handle this symbol format
+          Right (Local _) -> decodeLocalOccurence filepath scipSymbol symRoles
+              fileRangeId
+          Right Global{..} -> decodeGlobalOccurence scipSymbol symRoles
+              fileRangeId descriptor
+    return (fileRange <> symbolFacts)
+  where
+    scipRange = occ ^. Scip.range
+    scipSymbol = occ ^. Scip.symbol
+    symRoles = toSymbolRole (occ ^. Scip.symbolRoles)
+
+decodeGlobalOccurence
+  :: Text -> Set Scip.SymbolRole -> SCIP.Id -> Descriptor
+  -> Parse [SCIP.Predicate]
+decodeGlobalOccurence scipSymbol symRoles fileRangeId Descriptor{..} = do
+  (symbolId, seenSymbol) <- getOrSetFact Symbol scipSymbol
+  let symbolFact :: [SCIP.Predicate]
+        | seenSymbol = []
+        | otherwise = pure $
+            SCIP.Predicate "scip.Symbol" [
+                object [ SCIP.factId symbolId, "key" .= scipSymbol ]
+            ]
+  let roleFact :: [[SCIP.Predicate]] = if Scip.Definition `Set.member` symRoles
+        then SCIP.predicate "scip.Definition" [
+            "symbol" .= symbolId,
+            "location" .= fileRangeId
+          ]
+        else SCIP.predicate "scip.Reference" [
+            "symbol" .= symbolId,
+            "location" .= fileRangeId
+          ]
+  (nameId, seenName) <- getOrSetFact LocalName text
+  let nameFact :: [SCIP.Predicate]
+        | seenName = []
+        | otherwise = pure $
+            SCIP.Predicate "scip.LocalName" [
+                object [ SCIP.factId nameId, "key" .= text ]
+            ]
+  let symbolNameFact :: [[SCIP.Predicate]]
+        | seenSymbol = []
+        | otherwise = SCIP.predicate "scip.SymbolName" [
+              "symbol" .= symbolId,
+              "name" .= nameId
+           ]
+  let kindFact :: [SCIP.Predicate] = concat $
+        case SCIP.kindFromSuffix suffix of
+          SCIP.SkUnknown -> [[]]
+          kind -> SCIP.predicate "scip.SymbolKind" [
+              "symbol" .= symbolId,
+              "kind" .= fromEnum kind
+            ]
+  return $ symbolFact <> concat roleFact <> nameFact <>
+            concat symbolNameFact <> kindFact
+
+decodeLocalOccurence
+  :: Text
+  -> Text
+  -> Set Scip.SymbolRole
+  -> SCIP.Id
+  -> Parse [SCIP.Predicate]
+decodeLocalOccurence filepath localSymbol symRoles fileRangeId = do
+  let qualifiedSymbol = filepath <> "/" <> localSymbol
+  (symbolId, seenSymbol) <- getOrSetFact Symbol qualifiedSymbol
+  let symbolFact :: [SCIP.Predicate]
+        | seenSymbol = []
+        | otherwise = pure $
+            SCIP.Predicate "scip.Symbol" [
+                object [ SCIP.factId symbolId, "key" .= qualifiedSymbol ]
+            ]
+  let roleFact :: [[SCIP.Predicate]] = if Scip.Definition `Set.member` symRoles
+        then SCIP.predicate "scip.Definition" [
+            "symbol" .= symbolId,
+            "location" .= fileRangeId
+          ]
+        else SCIP.predicate "scip.Reference" [
+            "symbol" .= symbolId,
+            "location" .= fileRangeId
+          ]
+  (nameId, seenName) <- getOrSetFact LocalName localSymbol
+  let nameFact :: [SCIP.Predicate]
+        | seenName = []
+        | otherwise = pure $
+            SCIP.Predicate "scip.LocalName" [
+                object [ SCIP.factId nameId, "key" .= localSymbol ]
+            ]
+  let symbolNameFact :: [[SCIP.Predicate]]
+        | seenSymbol = []
+        | otherwise = SCIP.predicate "scip.SymbolName" [
+              "symbol" .= symbolId,
+              "name" .= nameId
+           ]
+  let kindFact :: [[SCIP.Predicate]]
+        | seenSymbol = []
+        | otherwise = SCIP.predicate "scip.SymbolKind" [
+              "symbol" .= symbolId,
+              -- TODO: this could be any SymbolInformation.Kind
+              "kind" .= fromEnum SCIP.SkVariable
+            ]
+  return $ symbolFact <> concat roleFact <> nameFact <>
+            concat symbolNameFact <> concat kindFact
+
+-- | For sharding we might want to take a repo-relative anchor here
+-- as it potentially differs to project root when combining SCIP files
+decodeScipMetadata :: Scip.Metadata -> Parse [SCIP.Predicate]
+decodeScipMetadata v = SCIP.predicate "scip.Metadata" $
+  [ "version" .= fromEnum (v ^. Scip.version)
+  , "textEncoding" .= fromEnum (v ^. Scip.textDocumentEncoding)
+  ] ++ (case v ^. Scip.maybe'toolInfo of
+          Nothing -> []
+          Just ti ->
+            ["toolInfo" .= object [
+              "toolName" .= (ti ^. Scip.name),
+              "toolArgs" .= (ti ^. Scip.arguments),
+              "version" .= (ti ^. Scip.version)
+            ]])
+
+-- scip ranges are int32
+toNat :: Int32 -> Int64
+toNat = fromIntegral
+
+-- [startLine, startCharacter, endCharacter]`. The end line
+--  is inferred to have the same value as the start line.
+decodeScipRange :: [Int32] -> Aeson.Value
+decodeScipRange [lineBegin,colBegin,colEnd] =
+  SCIP.toRange (SCIP.Range
+    (SCIP.Position (toNat lineBegin) (toNat colBegin))
+    (SCIP.Position (toNat lineBegin) (toNat colEnd))) -- n.b
+-- : `[startLine, startCharacter, endLine, endCharacter]`
+decodeScipRange [lineBegin,colBegin,lineEnd,colEnd] =
+  SCIP.toRange (SCIP.Range
+    (SCIP.Position (toNat lineBegin) (toNat colBegin))
+    (SCIP.Position (toNat lineEnd) (toNat colEnd)))
+decodeScipRange range = error $
+  "decodeScipRange: unexpected range format: " <> show range
+
+{-
+
+//   <symbol>               ::= <scheme> ' ' <package> ' ' { <descriptor> }
+//      | 'local ' <local-id>
+//   <package>              ::= <manager> ' ' <package-name> ' ' <version>
+//   <scheme>               ::= any UTF-8, escape spaces with double space.
+//   <manager>              ::= same as above, use the placeholder '.' to
+//          indicate an empty value
+//   <package-name>         ::= same as above
+//   <version>              ::= same as above
+//   <descriptor>           ::= <package> | <type> | <term> | <method>
+//       | <type-parameter> | <parameter> | <meta>
+//   <package>              ::= <name> '/'
+//   <type>                 ::= <name> '#'
+//   <term>                 ::= <name> '.'
+//   <meta>                 ::= <name> ':'
+//   <method>               ::= <name> '(' <method-disambiguator> ').'
+//   <type-parameter>       ::= '[' <name> ']'
+//   <parameter>            ::= '(' <name> ')'
+//   <name>                 ::= <identifier>
+//   <method-disambiguator> ::= <simple-identifier>
+//   <identifier>           ::= <simple-identifier> | <escaped-identifier>
+//   <simple-identifier>    ::= { <identifier-character> }
+//   <identifier-character> ::= '_' | '+' | '-' | '$' | ASCII letter or digit
+//   <escaped-identifier>   ::= '`' { <escaped-character> } '`'
+//   <escaped-characters>   ::= any UTF-8 character, escape backticks with
+//   d        ouble backtick.
+
+-}
+
+data ScipSymbol
+  = Local !Text
+  | Global
+      { scheme :: !Text
+      , package :: !Package
+      , descriptor :: !Descriptor -- grammar says these can be repetitions...
+      }
+
+data Package = Package
+  { manager :: !Text
+  , pkgname :: !Text
+  , version :: !Text
+}
+
+data Descriptor = Descriptor
+  { text:: !Text
+  , suffix :: !SCIP.Suffix
+  }
+
+--
+-- Parser and ADT for Scip.Symbol strings.
+-- These are well structured but stored as strings for reasons
+--
+-- https://github.com/sourcegraph/scip/blob/main/scip.proto#L81
+-- e.g.
+--
+-- >  "scip-typescript npm new.docusaurus.io 2.0.0-beta.17 \
+-- >      functionUtils/`playgroundUtils.ts`/CookieName."
+--
+symbolFromString :: Text -> Either Text ScipSymbol
+symbolFromString str
+  -- 'local ' <local-id>
+  | ("local", localId) <- split normalStr
+  = Right $ Local localId
+  --  <scheme> ' ' <package> ' ' { <descriptor> }
+  | (scheme, rest1) <- split normalStr
+  -- <package> ::= <manager> ' ' <package-name> ' ' <version>
+  , (manager, rest2) <- split rest1
+  , (pkgname, rest3) <- split rest2
+  , (version, symStrs) <- split rest3
+  , (text, suffix) <- SCIP.parseSuffix symStrs
+  = Right $ Global scheme Package{..} Descriptor {..}
+
+  where
+    -- we normalize space-escaping in identifiers with underscore
+    normalStr = Text.intercalate "_" (Text.splitOn doubleSpace str)
+      where doubleSpace = "  "
+
+    split xs = case Text.breakOn " " xs of
+      (tok, rest) -> (tok, if Text.null rest then rest else Text.tail rest)
+
+{-
+bitmask in i32
+
+enum SymbolRole {
+  // unused
+  UnspecifiedSymbolRole = 0;
+  // Is the symbol defined here? If not, then this is a symbol reference.
+  Definition = 0x1;
+  // Is the symbol imported here?
+  Import = 0x2;
+  // Is the symbol written here?
+  WriteAccess = 0x4;
+  // Is the symbol read here?
+  ReadAccess = 0x8;
+  // Is the symbol in generated code?
+  Generated = 0x10;
+  // Is the symbol in test code?
+  Test = 0x20;
+-}
+toSymbolRole :: Int32 -> Set Scip.SymbolRole
+toSymbolRole i = Set.fromList $ catMaybes
+  [ Nothing -- if i == 0 then Just Scip.UnspecifiedSymbolRole else Nothing
+  , has 0 Scip.Definition
+  , has 1 Scip.Import
+  , has 2 Scip.WriteAccess
+  , has 3 Scip.ReadAccess
+  , has 4 Scip.Generated
+  , has 5 Scip.Test
+  ]
+  where
+    has n ty
+      | i `testBit` n = Just ty
+      | otherwise = Nothing
diff --git a/glean/lang/scip/Glean/SCIP/Driver.hs b/glean/lang/scip/Glean/SCIP/Driver.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/scip/Glean/SCIP/Driver.hs
@@ -0,0 +1,80 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-
+
+Generic indexer for SCIP, "semantic code intelligence protocol":
+a typed lsif-like indexer format from SourceGraph.
+
+See https://github.com/sourcegraph/scip
+
+-}
+
+module Glean.SCIP.Driver (
+
+    ScipIndexerParams(..),
+    runIndexer,
+    processSCIP,
+    LanguageId(..),
+
+  ) where
+
+import Control.Monad
+import System.Directory
+import System.FilePath ( (</>), takeBaseName )
+import System.IO.Temp ( withSystemTempDirectory )
+import System.Process ( callProcess )
+import Text.Printf ( printf )
+import Util.Log ( logInfo )
+import qualified Data.Aeson as Aeson
+import qualified Data.ByteString as B
+
+import Data.SCIP.Angle ( scipToAngle, LanguageId(..) )
+
+data ScipIndexerParams = ScipIndexerParams
+  { scipBinary :: FilePath
+  , scipArgs :: FilePath -> [String]
+  , scipRoot :: FilePath
+  , scipWritesLocal :: Bool
+     -- ^ e.g. rust-analyzer always writes index.scip to repoDir
+  , scipLanguage :: Maybe LanguageId -- ^ a default language if known
+  }
+
+-- | Run a generic SCIP-producing indexer, and convert to a Glean's scip.angle
+-- database returning a single JSON value that can be sent to the Glean server
+runIndexer :: ScipIndexerParams -> IO Aeson.Value
+runIndexer params@ScipIndexerParams{..} = do
+  repoDir <- makeAbsolute scipRoot
+  withSystemTempDirectory "glean-scip" $ \scipDir -> do
+    let scipFile = scipDir </> "index.scip"
+    runSCIPIndexer params { scipRoot = repoDir } scipFile
+    when scipWritesLocal $ do
+        copyFile (repoDir </> "index.scip") scipFile
+        removeFile (repoDir </> "index.scip")
+    processSCIP scipLanguage False Nothing Nothing scipFile
+
+-- | Run a SCIP indexer on a repository, put scip dump output into outputFile
+runSCIPIndexer :: ScipIndexerParams -> FilePath -> IO ()
+runSCIPIndexer ScipIndexerParams{..} outputFile =
+  withCurrentDirectory scipRoot $ do
+    logInfo $ printf "Indexing %s with %s" (takeBaseName scipRoot) scipBinary
+    let args = scipArgs outputFile
+    logInfo $ printf "Running command: %s %s" scipBinary (unwords args)
+    callProcess scipBinary args
+
+-- | Convert an scip protobufs encoded file into Glean lsif.angle JSON object
+processSCIP
+  :: Maybe LanguageId
+  -> Bool
+  -> Maybe FilePath
+  -> Maybe FilePath
+  -> FilePath
+  -> IO Aeson.Value
+processSCIP mlang inferLanguage mPathPrefix mStripPrefix scipFile = do
+  logInfo $ "Using SCIP from " <> scipFile
+  scipToAngle mlang inferLanguage mPathPrefix mStripPrefix <$> B.readFile scipFile
diff --git a/glean/lang/scip/indexer/Glean/Indexer/SCIP.hs b/glean/lang/scip/indexer/Glean/Indexer/SCIP.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/scip/indexer/Glean/Indexer/SCIP.hs
@@ -0,0 +1,76 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Indexer.SCIP (
+    indexer,
+    derive,
+  ) where
+
+import Options.Applicative
+import Data.Text ( Text )
+import Control.Monad ( forM_ )
+
+import Glean.Derive
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.SCIP.Driver as SCIP
+import Glean.Write
+
+import qualified Glean
+import System.Directory (doesFileExist)
+import Util.OptParse (maybeStrOption)
+
+-- | A generic SCIP indexer, for existing scip files
+newtype SCIP = SCIP
+  { scipIndexFile :: Maybe FilePath
+  }
+  -- no options currently
+
+options :: Parser SCIP
+options =
+  SCIP <$> maybeStrOption (
+    long "input" <>
+    help "Optional path to a specific scip index file")
+
+-- | An indexer that just slurps an existing SCIP file. Usage:
+--
+--   cli:    glean index scip <file> --repo name/hash
+--   shell:  :index scip <file>
+--
+indexer :: Indexer SCIP
+indexer = Indexer {
+  indexerShortName = "scip",
+  indexerDescription = "Index a SCIP file",
+  indexerOptParser = options,
+  indexerRun = \SCIP{..} backend repo IndexerParams{..} -> do
+    scipFile <- case scipIndexFile of
+      Just f -> pure f
+      Nothing -> do -- then indexerRoot should be an lsif file
+        mFile <- doesFileExist indexerRoot
+        if mFile
+          then pure indexerRoot
+          else error "Neither --input nor --root are scip files"
+    val <- SCIP.processSCIP Nothing False Nothing Nothing scipFile
+    sendJsonBatches backend repo "scip" val
+    derive backend repo
+  }
+
+-- | Derive any SCIP stored predicates
+derive :: Glean.Backend b => b -> Glean.Repo -> IO ()
+derive backend repo = forM_ scipDerivedPredicates $ \pred_ ->
+  derivePredicate backend repo Nothing Nothing
+    (parseRef pred_) Nothing
+
+-- Should correspond to stored predicates in scip.angle
+scipDerivedPredicates :: [Text]
+scipDerivedPredicates =
+  [ "scip.DefinitionLocation"
+  , "scip.ReferenceLocation"
+  , "scip.SymbolDisplayName"
+  , "scip.IsImplemented"
+  ]
diff --git a/glean/lang/scip/proto/Proto/Scip.hs b/glean/lang/scip/proto/Proto/Scip.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/scip/proto/Proto/Scip.hs
@@ -0,0 +1,9311 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- This file was auto-generated from scip.proto by the proto-lens-protoc program. -}
+{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications, OverloadedStrings, DerivingStrategies#-}
+{-# OPTIONS_GHC -Wno-unused-imports#-}
+{-# OPTIONS_GHC -Wno-duplicate-exports#-}
+{-# OPTIONS_GHC -Wno-dodgy-exports#-}
+module Proto.Scip (
+        Descriptor(), Descriptor'Suffix(..),
+        Descriptor'Suffix(Descriptor'Package),
+        Descriptor'Suffix'UnrecognizedValue, Diagnostic(),
+        DiagnosticTag(..), DiagnosticTag(),
+        DiagnosticTag'UnrecognizedValue, Document(), Index(), Language(..),
+        Language(), Language'UnrecognizedValue, Metadata(), Occurrence(),
+        Package(), PositionEncoding(..), PositionEncoding(),
+        PositionEncoding'UnrecognizedValue, ProtocolVersion(..),
+        ProtocolVersion(), ProtocolVersion'UnrecognizedValue,
+        Relationship(), Severity(..), Severity(),
+        Severity'UnrecognizedValue, Symbol(), SymbolInformation(),
+        SymbolInformation'Kind(..), SymbolInformation'Kind(),
+        SymbolInformation'Kind'UnrecognizedValue, SymbolRole(..),
+        SymbolRole(), SymbolRole'UnrecognizedValue, SyntaxKind(..),
+        SyntaxKind(IdentifierKeyword, IdentifierModule),
+        SyntaxKind'UnrecognizedValue, TextEncoding(..), TextEncoding(),
+        TextEncoding'UnrecognizedValue, ToolInfo()
+    ) where
+import qualified Data.ProtoLens.Runtime.Control.DeepSeq as Control.DeepSeq
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Prism as Data.ProtoLens.Prism
+import qualified Data.ProtoLens.Runtime.Prelude as Prelude
+import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
+import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid
+import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens as Data.ProtoLens
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes as Data.ProtoLens.Encoding.Bytes
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing as Data.ProtoLens.Encoding.Growing
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe as Data.ProtoLens.Encoding.Parser.Unsafe
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire as Data.ProtoLens.Encoding.Wire
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field as Data.ProtoLens.Field
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum as Data.ProtoLens.Message.Enum
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types as Data.ProtoLens.Service.Types
+import qualified Data.ProtoLens.Runtime.Lens.Family2 as Lens.Family2
+import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked as Lens.Family2.Unchecked
+import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text
+import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map
+import qualified Data.ProtoLens.Runtime.Data.ByteString as Data.ByteString
+import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8 as Data.ByteString.Char8
+import qualified Data.ProtoLens.Runtime.Data.Text.Encoding as Data.Text.Encoding
+import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector
+import qualified Data.ProtoLens.Runtime.Data.Vector.Generic as Data.Vector.Generic
+import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed as Data.Vector.Unboxed
+import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read
+{- | Fields :
+
+         * 'Proto.Scip_Fields.name' @:: Lens' Descriptor Data.Text.Text@
+         * 'Proto.Scip_Fields.disambiguator' @:: Lens' Descriptor Data.Text.Text@
+         * 'Proto.Scip_Fields.suffix' @:: Lens' Descriptor Descriptor'Suffix@ -}
+data Descriptor
+  = Descriptor'_constructor {_Descriptor'name :: !Data.Text.Text,
+                             _Descriptor'disambiguator :: !Data.Text.Text,
+                             _Descriptor'suffix :: !Descriptor'Suffix,
+                             _Descriptor'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Descriptor where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Descriptor "name" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Descriptor'name (\ x__ y__ -> x__ {_Descriptor'name = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Descriptor "disambiguator" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Descriptor'disambiguator
+           (\ x__ y__ -> x__ {_Descriptor'disambiguator = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Descriptor "suffix" Descriptor'Suffix where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Descriptor'suffix (\ x__ y__ -> x__ {_Descriptor'suffix = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Descriptor where
+  messageName _ = Data.Text.pack "scip.Descriptor"
+  packedMessageDescriptor _
+    = "\n\
+      \\n\
+      \Descriptor\DC2\DC2\n\
+      \\EOTname\CAN\SOH \SOH(\tR\EOTname\DC2$\n\
+      \\rdisambiguator\CAN\STX \SOH(\tR\rdisambiguator\DC2/\n\
+      \\ACKsuffix\CAN\ETX \SOH(\SO2\ETB.scip.Descriptor.SuffixR\ACKsuffix\"\165\SOH\n\
+      \\ACKSuffix\DC2\NAK\n\
+      \\DC1UnspecifiedSuffix\DLE\NUL\DC2\r\n\
+      \\tNamespace\DLE\SOH\DC2\SI\n\
+      \\aPackage\DLE\SOH\SUB\STX\b\SOH\DC2\b\n\
+      \\EOTType\DLE\STX\DC2\b\n\
+      \\EOTTerm\DLE\ETX\DC2\n\
+      \\n\
+      \\ACKMethod\DLE\EOT\DC2\DC1\n\
+      \\rTypeParameter\DLE\ENQ\DC2\r\n\
+      \\tParameter\DLE\ACK\DC2\b\n\
+      \\EOTMeta\DLE\a\DC2\t\n\
+      \\ENQLocal\DLE\b\DC2\t\n\
+      \\ENQMacro\DLE\t\SUB\STX\DLE\SOH"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        name__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "name"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"name")) ::
+              Data.ProtoLens.FieldDescriptor Descriptor
+        disambiguator__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "disambiguator"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"disambiguator")) ::
+              Data.ProtoLens.FieldDescriptor Descriptor
+        suffix__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "suffix"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor Descriptor'Suffix)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"suffix")) ::
+              Data.ProtoLens.FieldDescriptor Descriptor
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, name__field_descriptor),
+           (Data.ProtoLens.Tag 2, disambiguator__field_descriptor),
+           (Data.ProtoLens.Tag 3, suffix__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Descriptor'_unknownFields
+        (\ x__ y__ -> x__ {_Descriptor'_unknownFields = y__})
+  defMessage
+    = Descriptor'_constructor
+        {_Descriptor'name = Data.ProtoLens.fieldDefault,
+         _Descriptor'disambiguator = Data.ProtoLens.fieldDefault,
+         _Descriptor'suffix = Data.ProtoLens.fieldDefault,
+         _Descriptor'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Descriptor -> Data.ProtoLens.Encoding.Bytes.Parser Descriptor
+        loop x
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x)
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "name"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"name") y x)
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "disambiguator"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"disambiguator") y x)
+                        24
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "suffix"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"suffix") y x)
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do loop Data.ProtoLens.defMessage) "Descriptor"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"name") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (let
+                   _v
+                     = Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"disambiguator") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v = Lens.Family2.view (Data.ProtoLens.Field.field @"suffix") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 24)
+                            ((Prelude..)
+                               ((Prelude..)
+                                  Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                               Prelude.fromEnum _v))
+                   (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                      (Lens.Family2.view Data.ProtoLens.unknownFields _x))))
+instance Control.DeepSeq.NFData Descriptor where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Descriptor'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Descriptor'name x__)
+                (Control.DeepSeq.deepseq
+                   (_Descriptor'disambiguator x__)
+                   (Control.DeepSeq.deepseq (_Descriptor'suffix x__) ())))
+newtype Descriptor'Suffix'UnrecognizedValue
+  = Descriptor'Suffix'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data Descriptor'Suffix
+  = Descriptor'UnspecifiedSuffix |
+    Descriptor'Namespace |
+    Descriptor'Type |
+    Descriptor'Term |
+    Descriptor'Method |
+    Descriptor'TypeParameter |
+    Descriptor'Parameter |
+    Descriptor'Meta |
+    Descriptor'Local |
+    Descriptor'Macro |
+    Descriptor'Suffix'Unrecognized !Descriptor'Suffix'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum Descriptor'Suffix where
+  maybeToEnum 0 = Prelude.Just Descriptor'UnspecifiedSuffix
+  maybeToEnum 1 = Prelude.Just Descriptor'Namespace
+  maybeToEnum 2 = Prelude.Just Descriptor'Type
+  maybeToEnum 3 = Prelude.Just Descriptor'Term
+  maybeToEnum 4 = Prelude.Just Descriptor'Method
+  maybeToEnum 5 = Prelude.Just Descriptor'TypeParameter
+  maybeToEnum 6 = Prelude.Just Descriptor'Parameter
+  maybeToEnum 7 = Prelude.Just Descriptor'Meta
+  maybeToEnum 8 = Prelude.Just Descriptor'Local
+  maybeToEnum 9 = Prelude.Just Descriptor'Macro
+  maybeToEnum k
+    = Prelude.Just
+        (Descriptor'Suffix'Unrecognized
+           (Descriptor'Suffix'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum Descriptor'UnspecifiedSuffix = "UnspecifiedSuffix"
+  showEnum Descriptor'Namespace = "Namespace"
+  showEnum Descriptor'Type = "Type"
+  showEnum Descriptor'Term = "Term"
+  showEnum Descriptor'Method = "Method"
+  showEnum Descriptor'TypeParameter = "TypeParameter"
+  showEnum Descriptor'Parameter = "Parameter"
+  showEnum Descriptor'Meta = "Meta"
+  showEnum Descriptor'Local = "Local"
+  showEnum Descriptor'Macro = "Macro"
+  showEnum
+    (Descriptor'Suffix'Unrecognized (Descriptor'Suffix'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedSuffix"
+    = Prelude.Just Descriptor'UnspecifiedSuffix
+    | (Prelude.==) k "Namespace" = Prelude.Just Descriptor'Namespace
+    | (Prelude.==) k "Package" = Prelude.Just Descriptor'Package
+    | (Prelude.==) k "Type" = Prelude.Just Descriptor'Type
+    | (Prelude.==) k "Term" = Prelude.Just Descriptor'Term
+    | (Prelude.==) k "Method" = Prelude.Just Descriptor'Method
+    | (Prelude.==) k "TypeParameter"
+    = Prelude.Just Descriptor'TypeParameter
+    | (Prelude.==) k "Parameter" = Prelude.Just Descriptor'Parameter
+    | (Prelude.==) k "Meta" = Prelude.Just Descriptor'Meta
+    | (Prelude.==) k "Local" = Prelude.Just Descriptor'Local
+    | (Prelude.==) k "Macro" = Prelude.Just Descriptor'Macro
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded Descriptor'Suffix where
+  minBound = Descriptor'UnspecifiedSuffix
+  maxBound = Descriptor'Macro
+instance Prelude.Enum Descriptor'Suffix where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum Suffix: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum Descriptor'UnspecifiedSuffix = 0
+  fromEnum Descriptor'Namespace = 1
+  fromEnum Descriptor'Type = 2
+  fromEnum Descriptor'Term = 3
+  fromEnum Descriptor'Method = 4
+  fromEnum Descriptor'TypeParameter = 5
+  fromEnum Descriptor'Parameter = 6
+  fromEnum Descriptor'Meta = 7
+  fromEnum Descriptor'Local = 8
+  fromEnum Descriptor'Macro = 9
+  fromEnum
+    (Descriptor'Suffix'Unrecognized (Descriptor'Suffix'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ Descriptor'Macro
+    = Prelude.error
+        "Descriptor'Suffix.succ: bad argument Descriptor'Macro. This value would be out of bounds."
+  succ Descriptor'UnspecifiedSuffix = Descriptor'Namespace
+  succ Descriptor'Namespace = Descriptor'Type
+  succ Descriptor'Type = Descriptor'Term
+  succ Descriptor'Term = Descriptor'Method
+  succ Descriptor'Method = Descriptor'TypeParameter
+  succ Descriptor'TypeParameter = Descriptor'Parameter
+  succ Descriptor'Parameter = Descriptor'Meta
+  succ Descriptor'Meta = Descriptor'Local
+  succ Descriptor'Local = Descriptor'Macro
+  succ (Descriptor'Suffix'Unrecognized _)
+    = Prelude.error
+        "Descriptor'Suffix.succ: bad argument: unrecognized value"
+  pred Descriptor'UnspecifiedSuffix
+    = Prelude.error
+        "Descriptor'Suffix.pred: bad argument Descriptor'UnspecifiedSuffix. This value would be out of bounds."
+  pred Descriptor'Namespace = Descriptor'UnspecifiedSuffix
+  pred Descriptor'Type = Descriptor'Namespace
+  pred Descriptor'Term = Descriptor'Type
+  pred Descriptor'Method = Descriptor'Term
+  pred Descriptor'TypeParameter = Descriptor'Method
+  pred Descriptor'Parameter = Descriptor'TypeParameter
+  pred Descriptor'Meta = Descriptor'Parameter
+  pred Descriptor'Local = Descriptor'Meta
+  pred Descriptor'Macro = Descriptor'Local
+  pred (Descriptor'Suffix'Unrecognized _)
+    = Prelude.error
+        "Descriptor'Suffix.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault Descriptor'Suffix where
+  fieldDefault = Descriptor'UnspecifiedSuffix
+instance Control.DeepSeq.NFData Descriptor'Suffix where
+  rnf x__ = Prelude.seq x__ ()
+pattern Descriptor'Package :: Descriptor'Suffix
+pattern Descriptor'Package = Descriptor'Namespace
+{- | Fields :
+
+         * 'Proto.Scip_Fields.severity' @:: Lens' Diagnostic Severity@
+         * 'Proto.Scip_Fields.code' @:: Lens' Diagnostic Data.Text.Text@
+         * 'Proto.Scip_Fields.message' @:: Lens' Diagnostic Data.Text.Text@
+         * 'Proto.Scip_Fields.source' @:: Lens' Diagnostic Data.Text.Text@
+         * 'Proto.Scip_Fields.tags' @:: Lens' Diagnostic [DiagnosticTag]@
+         * 'Proto.Scip_Fields.vec'tags' @:: Lens' Diagnostic (Data.Vector.Vector DiagnosticTag)@ -}
+data Diagnostic
+  = Diagnostic'_constructor {_Diagnostic'severity :: !Severity,
+                             _Diagnostic'code :: !Data.Text.Text,
+                             _Diagnostic'message :: !Data.Text.Text,
+                             _Diagnostic'source :: !Data.Text.Text,
+                             _Diagnostic'tags :: !(Data.Vector.Vector DiagnosticTag),
+                             _Diagnostic'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Diagnostic where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Diagnostic "severity" Severity where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'severity
+           (\ x__ y__ -> x__ {_Diagnostic'severity = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Diagnostic "code" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'code (\ x__ y__ -> x__ {_Diagnostic'code = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Diagnostic "message" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'message (\ x__ y__ -> x__ {_Diagnostic'message = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Diagnostic "source" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'source (\ x__ y__ -> x__ {_Diagnostic'source = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Diagnostic "tags" [DiagnosticTag] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'tags (\ x__ y__ -> x__ {_Diagnostic'tags = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Diagnostic "vec'tags" (Data.Vector.Vector DiagnosticTag) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Diagnostic'tags (\ x__ y__ -> x__ {_Diagnostic'tags = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Diagnostic where
+  messageName _ = Data.Text.pack "scip.Diagnostic"
+  packedMessageDescriptor _
+    = "\n\
+      \\n\
+      \Diagnostic\DC2*\n\
+      \\bseverity\CAN\SOH \SOH(\SO2\SO.scip.SeverityR\bseverity\DC2\DC2\n\
+      \\EOTcode\CAN\STX \SOH(\tR\EOTcode\DC2\CAN\n\
+      \\amessage\CAN\ETX \SOH(\tR\amessage\DC2\SYN\n\
+      \\ACKsource\CAN\EOT \SOH(\tR\ACKsource\DC2'\n\
+      \\EOTtags\CAN\ENQ \ETX(\SO2\DC3.scip.DiagnosticTagR\EOTtags"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        severity__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "severity"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor Severity)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"severity")) ::
+              Data.ProtoLens.FieldDescriptor Diagnostic
+        code__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "code"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"code")) ::
+              Data.ProtoLens.FieldDescriptor Diagnostic
+        message__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "message"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"message")) ::
+              Data.ProtoLens.FieldDescriptor Diagnostic
+        source__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "source"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"source")) ::
+              Data.ProtoLens.FieldDescriptor Diagnostic
+        tags__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "tags"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor DiagnosticTag)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Packed (Data.ProtoLens.Field.field @"tags")) ::
+              Data.ProtoLens.FieldDescriptor Diagnostic
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, severity__field_descriptor),
+           (Data.ProtoLens.Tag 2, code__field_descriptor),
+           (Data.ProtoLens.Tag 3, message__field_descriptor),
+           (Data.ProtoLens.Tag 4, source__field_descriptor),
+           (Data.ProtoLens.Tag 5, tags__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Diagnostic'_unknownFields
+        (\ x__ y__ -> x__ {_Diagnostic'_unknownFields = y__})
+  defMessage
+    = Diagnostic'_constructor
+        {_Diagnostic'severity = Data.ProtoLens.fieldDefault,
+         _Diagnostic'code = Data.ProtoLens.fieldDefault,
+         _Diagnostic'message = Data.ProtoLens.fieldDefault,
+         _Diagnostic'source = Data.ProtoLens.fieldDefault,
+         _Diagnostic'tags = Data.Vector.Generic.empty,
+         _Diagnostic'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Diagnostic
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld DiagnosticTag
+             -> Data.ProtoLens.Encoding.Bytes.Parser Diagnostic
+        loop x mutable'tags
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'tags <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'tags)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'tags") frozen'tags x))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        8 -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "severity"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"severity") y x)
+                                  mutable'tags
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "code"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"code") y x)
+                                  mutable'tags
+                        26
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "message"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"message") y x)
+                                  mutable'tags
+                        34
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "source"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y x)
+                                  mutable'tags
+                        40
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (Prelude.fmap
+                                           Prelude.toEnum
+                                           (Prelude.fmap
+                                              Prelude.fromIntegral
+                                              Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                        "tags"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append mutable'tags y)
+                                loop x v
+                        42
+                          -> do y <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                        Data.ProtoLens.Encoding.Bytes.isolate
+                                          (Prelude.fromIntegral len)
+                                          ((let
+                                              ploop qs
+                                                = do packedEnd <- Data.ProtoLens.Encoding.Bytes.atEnd
+                                                     if packedEnd then
+                                                         Prelude.return qs
+                                                     else
+                                                         do !q <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                                                    (Prelude.fmap
+                                                                       Prelude.toEnum
+                                                                       (Prelude.fmap
+                                                                          Prelude.fromIntegral
+                                                                          Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                                                    "tags"
+                                                            qs' <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                                     (Data.ProtoLens.Encoding.Growing.append
+                                                                        qs q)
+                                                            ploop qs'
+                                            in ploop)
+                                             mutable'tags)
+                                loop x y
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'tags
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'tags <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                Data.ProtoLens.Encoding.Growing.new
+              loop Data.ProtoLens.defMessage mutable'tags)
+          "Diagnostic"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"severity") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 8)
+                      ((Prelude..)
+                         ((Prelude..)
+                            Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                         Prelude.fromEnum _v))
+             ((Data.Monoid.<>)
+                (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"code") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v = Lens.Family2.view (Data.ProtoLens.Field.field @"message") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                            ((Prelude..)
+                               (\ bs
+                                  -> (Data.Monoid.<>)
+                                       (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                          (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                       (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                               Data.Text.Encoding.encodeUtf8 _v))
+                   ((Data.Monoid.<>)
+                      (let
+                         _v = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _x
+                       in
+                         if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                             Data.Monoid.mempty
+                         else
+                             (Data.Monoid.<>)
+                               (Data.ProtoLens.Encoding.Bytes.putVarInt 34)
+                               ((Prelude..)
+                                  (\ bs
+                                     -> (Data.Monoid.<>)
+                                          (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                             (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                          (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                  Data.Text.Encoding.encodeUtf8 _v))
+                      ((Data.Monoid.<>)
+                         (let
+                            p = Lens.Family2.view (Data.ProtoLens.Field.field @"vec'tags") _x
+                          in
+                            if Data.Vector.Generic.null p then
+                                Data.Monoid.mempty
+                            else
+                                (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt 42)
+                                  ((\ bs
+                                      -> (Data.Monoid.<>)
+                                           (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                              (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                           (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                     (Data.ProtoLens.Encoding.Bytes.runBuilder
+                                        (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                                           ((Prelude..)
+                                              ((Prelude..)
+                                                 Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                 Prelude.fromIntegral)
+                                              Prelude.fromEnum)
+                                           p))))
+                         (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                            (Lens.Family2.view Data.ProtoLens.unknownFields _x))))))
+instance Control.DeepSeq.NFData Diagnostic where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Diagnostic'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Diagnostic'severity x__)
+                (Control.DeepSeq.deepseq
+                   (_Diagnostic'code x__)
+                   (Control.DeepSeq.deepseq
+                      (_Diagnostic'message x__)
+                      (Control.DeepSeq.deepseq
+                         (_Diagnostic'source x__)
+                         (Control.DeepSeq.deepseq (_Diagnostic'tags x__) ())))))
+newtype DiagnosticTag'UnrecognizedValue
+  = DiagnosticTag'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data DiagnosticTag
+  = UnspecifiedDiagnosticTag |
+    Unnecessary |
+    Deprecated |
+    DiagnosticTag'Unrecognized !DiagnosticTag'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum DiagnosticTag where
+  maybeToEnum 0 = Prelude.Just UnspecifiedDiagnosticTag
+  maybeToEnum 1 = Prelude.Just Unnecessary
+  maybeToEnum 2 = Prelude.Just Deprecated
+  maybeToEnum k
+    = Prelude.Just
+        (DiagnosticTag'Unrecognized
+           (DiagnosticTag'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedDiagnosticTag = "UnspecifiedDiagnosticTag"
+  showEnum Unnecessary = "Unnecessary"
+  showEnum Deprecated = "Deprecated"
+  showEnum
+    (DiagnosticTag'Unrecognized (DiagnosticTag'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedDiagnosticTag"
+    = Prelude.Just UnspecifiedDiagnosticTag
+    | (Prelude.==) k "Unnecessary" = Prelude.Just Unnecessary
+    | (Prelude.==) k "Deprecated" = Prelude.Just Deprecated
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded DiagnosticTag where
+  minBound = UnspecifiedDiagnosticTag
+  maxBound = Deprecated
+instance Prelude.Enum DiagnosticTag where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum DiagnosticTag: "
+              (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedDiagnosticTag = 0
+  fromEnum Unnecessary = 1
+  fromEnum Deprecated = 2
+  fromEnum
+    (DiagnosticTag'Unrecognized (DiagnosticTag'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ Deprecated
+    = Prelude.error
+        "DiagnosticTag.succ: bad argument Deprecated. This value would be out of bounds."
+  succ UnspecifiedDiagnosticTag = Unnecessary
+  succ Unnecessary = Deprecated
+  succ (DiagnosticTag'Unrecognized _)
+    = Prelude.error
+        "DiagnosticTag.succ: bad argument: unrecognized value"
+  pred UnspecifiedDiagnosticTag
+    = Prelude.error
+        "DiagnosticTag.pred: bad argument UnspecifiedDiagnosticTag. This value would be out of bounds."
+  pred Unnecessary = UnspecifiedDiagnosticTag
+  pred Deprecated = Unnecessary
+  pred (DiagnosticTag'Unrecognized _)
+    = Prelude.error
+        "DiagnosticTag.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault DiagnosticTag where
+  fieldDefault = UnspecifiedDiagnosticTag
+instance Control.DeepSeq.NFData DiagnosticTag where
+  rnf x__ = Prelude.seq x__ ()
+{- | Fields :
+
+         * 'Proto.Scip_Fields.language' @:: Lens' Document Data.Text.Text@
+         * 'Proto.Scip_Fields.relativePath' @:: Lens' Document Data.Text.Text@
+         * 'Proto.Scip_Fields.occurrences' @:: Lens' Document [Occurrence]@
+         * 'Proto.Scip_Fields.vec'occurrences' @:: Lens' Document (Data.Vector.Vector Occurrence)@
+         * 'Proto.Scip_Fields.symbols' @:: Lens' Document [SymbolInformation]@
+         * 'Proto.Scip_Fields.vec'symbols' @:: Lens' Document (Data.Vector.Vector SymbolInformation)@
+         * 'Proto.Scip_Fields.text' @:: Lens' Document Data.Text.Text@
+         * 'Proto.Scip_Fields.positionEncoding' @:: Lens' Document PositionEncoding@ -}
+data Document
+  = Document'_constructor {_Document'language :: !Data.Text.Text,
+                           _Document'relativePath :: !Data.Text.Text,
+                           _Document'occurrences :: !(Data.Vector.Vector Occurrence),
+                           _Document'symbols :: !(Data.Vector.Vector SymbolInformation),
+                           _Document'text :: !Data.Text.Text,
+                           _Document'positionEncoding :: !PositionEncoding,
+                           _Document'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Document where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Document "language" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'language (\ x__ y__ -> x__ {_Document'language = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Document "relativePath" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'relativePath
+           (\ x__ y__ -> x__ {_Document'relativePath = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Document "occurrences" [Occurrence] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'occurrences
+           (\ x__ y__ -> x__ {_Document'occurrences = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Document "vec'occurrences" (Data.Vector.Vector Occurrence) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'occurrences
+           (\ x__ y__ -> x__ {_Document'occurrences = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Document "symbols" [SymbolInformation] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'symbols (\ x__ y__ -> x__ {_Document'symbols = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Document "vec'symbols" (Data.Vector.Vector SymbolInformation) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'symbols (\ x__ y__ -> x__ {_Document'symbols = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Document "text" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'text (\ x__ y__ -> x__ {_Document'text = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Document "positionEncoding" PositionEncoding where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Document'positionEncoding
+           (\ x__ y__ -> x__ {_Document'positionEncoding = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Document where
+  messageName _ = Data.Text.pack "scip.Document"
+  packedMessageDescriptor _
+    = "\n\
+      \\bDocument\DC2\SUB\n\
+      \\blanguage\CAN\EOT \SOH(\tR\blanguage\DC2#\n\
+      \\rrelative_path\CAN\SOH \SOH(\tR\frelativePath\DC22\n\
+      \\voccurrences\CAN\STX \ETX(\v2\DLE.scip.OccurrenceR\voccurrences\DC21\n\
+      \\asymbols\CAN\ETX \ETX(\v2\ETB.scip.SymbolInformationR\asymbols\DC2\DC2\n\
+      \\EOTtext\CAN\ENQ \SOH(\tR\EOTtext\DC2C\n\
+      \\DC1position_encoding\CAN\ACK \SOH(\SO2\SYN.scip.PositionEncodingR\DLEpositionEncoding"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        language__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "language"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"language")) ::
+              Data.ProtoLens.FieldDescriptor Document
+        relativePath__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "relative_path"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"relativePath")) ::
+              Data.ProtoLens.FieldDescriptor Document
+        occurrences__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "occurrences"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Occurrence)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"occurrences")) ::
+              Data.ProtoLens.FieldDescriptor Document
+        symbols__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "symbols"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor SymbolInformation)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"symbols")) ::
+              Data.ProtoLens.FieldDescriptor Document
+        text__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "text"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"text")) ::
+              Data.ProtoLens.FieldDescriptor Document
+        positionEncoding__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "position_encoding"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor PositionEncoding)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"positionEncoding")) ::
+              Data.ProtoLens.FieldDescriptor Document
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 4, language__field_descriptor),
+           (Data.ProtoLens.Tag 1, relativePath__field_descriptor),
+           (Data.ProtoLens.Tag 2, occurrences__field_descriptor),
+           (Data.ProtoLens.Tag 3, symbols__field_descriptor),
+           (Data.ProtoLens.Tag 5, text__field_descriptor),
+           (Data.ProtoLens.Tag 6, positionEncoding__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Document'_unknownFields
+        (\ x__ y__ -> x__ {_Document'_unknownFields = y__})
+  defMessage
+    = Document'_constructor
+        {_Document'language = Data.ProtoLens.fieldDefault,
+         _Document'relativePath = Data.ProtoLens.fieldDefault,
+         _Document'occurrences = Data.Vector.Generic.empty,
+         _Document'symbols = Data.Vector.Generic.empty,
+         _Document'text = Data.ProtoLens.fieldDefault,
+         _Document'positionEncoding = Data.ProtoLens.fieldDefault,
+         _Document'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Document
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Occurrence
+             -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld SymbolInformation
+                -> Data.ProtoLens.Encoding.Bytes.Parser Document
+        loop x mutable'occurrences mutable'symbols
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'occurrences <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                              (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                 mutable'occurrences)
+                      frozen'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                          (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                             mutable'symbols)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'occurrences") frozen'occurrences
+                              (Lens.Family2.set
+                                 (Data.ProtoLens.Field.field @"vec'symbols") frozen'symbols x)))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        34
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "language"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"language") y x)
+                                  mutable'occurrences mutable'symbols
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "relative_path"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"relativePath") y x)
+                                  mutable'occurrences mutable'symbols
+                        18
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "occurrences"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'occurrences y)
+                                loop x v mutable'symbols
+                        26
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "symbols"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append mutable'symbols y)
+                                loop x mutable'occurrences v
+                        42
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "text"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"text") y x)
+                                  mutable'occurrences mutable'symbols
+                        48
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "position_encoding"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"positionEncoding") y x)
+                                  mutable'occurrences mutable'symbols
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'occurrences mutable'symbols
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'occurrences <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       Data.ProtoLens.Encoding.Growing.new
+              mutable'symbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                   Data.ProtoLens.Encoding.Growing.new
+              loop Data.ProtoLens.defMessage mutable'occurrences mutable'symbols)
+          "Document"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 34)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (let
+                   _v
+                     = Lens.Family2.view (Data.ProtoLens.Field.field @"relativePath") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                      (\ _v
+                         -> (Data.Monoid.<>)
+                              (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                              ((Prelude..)
+                                 (\ bs
+                                    -> (Data.Monoid.<>)
+                                         (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                            (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                         (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                 Data.ProtoLens.encodeMessage _v))
+                      (Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"vec'occurrences") _x))
+                   ((Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                         (\ _v
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                                 ((Prelude..)
+                                    (\ bs
+                                       -> (Data.Monoid.<>)
+                                            (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                               (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                            (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                    Data.ProtoLens.encodeMessage _v))
+                         (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'symbols") _x))
+                      ((Data.Monoid.<>)
+                         (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"text") _x
+                          in
+                            if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                Data.Monoid.mempty
+                            else
+                                (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt 42)
+                                  ((Prelude..)
+                                     (\ bs
+                                        -> (Data.Monoid.<>)
+                                             (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                             (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                     Data.Text.Encoding.encodeUtf8 _v))
+                         ((Data.Monoid.<>)
+                            (let
+                               _v
+                                 = Lens.Family2.view
+                                     (Data.ProtoLens.Field.field @"positionEncoding") _x
+                             in
+                               if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                   Data.Monoid.mempty
+                               else
+                                   (Data.Monoid.<>)
+                                     (Data.ProtoLens.Encoding.Bytes.putVarInt 48)
+                                     ((Prelude..)
+                                        ((Prelude..)
+                                           Data.ProtoLens.Encoding.Bytes.putVarInt
+                                           Prelude.fromIntegral)
+                                        Prelude.fromEnum _v))
+                            (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                               (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))))
+instance Control.DeepSeq.NFData Document where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Document'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Document'language x__)
+                (Control.DeepSeq.deepseq
+                   (_Document'relativePath x__)
+                   (Control.DeepSeq.deepseq
+                      (_Document'occurrences x__)
+                      (Control.DeepSeq.deepseq
+                         (_Document'symbols x__)
+                         (Control.DeepSeq.deepseq
+                            (_Document'text x__)
+                            (Control.DeepSeq.deepseq (_Document'positionEncoding x__) ()))))))
+{- | Fields :
+
+         * 'Proto.Scip_Fields.metadata' @:: Lens' Index Metadata@
+         * 'Proto.Scip_Fields.maybe'metadata' @:: Lens' Index (Prelude.Maybe Metadata)@
+         * 'Proto.Scip_Fields.documents' @:: Lens' Index [Document]@
+         * 'Proto.Scip_Fields.vec'documents' @:: Lens' Index (Data.Vector.Vector Document)@
+         * 'Proto.Scip_Fields.externalSymbols' @:: Lens' Index [SymbolInformation]@
+         * 'Proto.Scip_Fields.vec'externalSymbols' @:: Lens' Index (Data.Vector.Vector SymbolInformation)@ -}
+data Index
+  = Index'_constructor {_Index'metadata :: !(Prelude.Maybe Metadata),
+                        _Index'documents :: !(Data.Vector.Vector Document),
+                        _Index'externalSymbols :: !(Data.Vector.Vector SymbolInformation),
+                        _Index'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Index where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Index "metadata" Metadata where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'metadata (\ x__ y__ -> x__ {_Index'metadata = y__}))
+        (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)
+instance Data.ProtoLens.Field.HasField Index "maybe'metadata" (Prelude.Maybe Metadata) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'metadata (\ x__ y__ -> x__ {_Index'metadata = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Index "documents" [Document] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'documents (\ x__ y__ -> x__ {_Index'documents = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Index "vec'documents" (Data.Vector.Vector Document) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'documents (\ x__ y__ -> x__ {_Index'documents = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Index "externalSymbols" [SymbolInformation] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'externalSymbols
+           (\ x__ y__ -> x__ {_Index'externalSymbols = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Index "vec'externalSymbols" (Data.Vector.Vector SymbolInformation) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Index'externalSymbols
+           (\ x__ y__ -> x__ {_Index'externalSymbols = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Index where
+  messageName _ = Data.Text.pack "scip.Index"
+  packedMessageDescriptor _
+    = "\n\
+      \\ENQIndex\DC2*\n\
+      \\bmetadata\CAN\SOH \SOH(\v2\SO.scip.MetadataR\bmetadata\DC2,\n\
+      \\tdocuments\CAN\STX \ETX(\v2\SO.scip.DocumentR\tdocuments\DC2B\n\
+      \\DLEexternal_symbols\CAN\ETX \ETX(\v2\ETB.scip.SymbolInformationR\SIexternalSymbols"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        metadata__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "metadata"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Metadata)
+              (Data.ProtoLens.OptionalField
+                 (Data.ProtoLens.Field.field @"maybe'metadata")) ::
+              Data.ProtoLens.FieldDescriptor Index
+        documents__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "documents"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Document)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"documents")) ::
+              Data.ProtoLens.FieldDescriptor Index
+        externalSymbols__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "external_symbols"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor SymbolInformation)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"externalSymbols")) ::
+              Data.ProtoLens.FieldDescriptor Index
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, metadata__field_descriptor),
+           (Data.ProtoLens.Tag 2, documents__field_descriptor),
+           (Data.ProtoLens.Tag 3, externalSymbols__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Index'_unknownFields
+        (\ x__ y__ -> x__ {_Index'_unknownFields = y__})
+  defMessage
+    = Index'_constructor
+        {_Index'metadata = Prelude.Nothing,
+         _Index'documents = Data.Vector.Generic.empty,
+         _Index'externalSymbols = Data.Vector.Generic.empty,
+         _Index'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Index
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Document
+             -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld SymbolInformation
+                -> Data.ProtoLens.Encoding.Bytes.Parser Index
+        loop x mutable'documents mutable'externalSymbols
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'documents <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                            (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                               mutable'documents)
+                      frozen'externalSymbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                  (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                     mutable'externalSymbols)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'documents") frozen'documents
+                              (Lens.Family2.set
+                                 (Data.ProtoLens.Field.field @"vec'externalSymbols")
+                                 frozen'externalSymbols x)))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                           Data.ProtoLens.Encoding.Bytes.isolate
+                                             (Prelude.fromIntegral len) Data.ProtoLens.parseMessage)
+                                       "metadata"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"metadata") y x)
+                                  mutable'documents mutable'externalSymbols
+                        18
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "documents"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append mutable'documents y)
+                                loop x v mutable'externalSymbols
+                        26
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "external_symbols"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'externalSymbols y)
+                                loop x mutable'documents v
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'documents mutable'externalSymbols
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'documents <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                     Data.ProtoLens.Encoding.Growing.new
+              mutable'externalSymbols <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                           Data.ProtoLens.Encoding.Growing.new
+              loop
+                Data.ProtoLens.defMessage mutable'documents
+                mutable'externalSymbols)
+          "Index"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (case
+                  Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'metadata") _x
+              of
+                Prelude.Nothing -> Data.Monoid.mempty
+                (Prelude.Just _v)
+                  -> (Data.Monoid.<>)
+                       (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                       ((Prelude..)
+                          (\ bs
+                             -> (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                     (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                  (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                          Data.ProtoLens.encodeMessage _v))
+             ((Data.Monoid.<>)
+                (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                   (\ _v
+                      -> (Data.Monoid.<>)
+                           (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                           ((Prelude..)
+                              (\ bs
+                                 -> (Data.Monoid.<>)
+                                      (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                         (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                      (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                              Data.ProtoLens.encodeMessage _v))
+                   (Lens.Family2.view
+                      (Data.ProtoLens.Field.field @"vec'documents") _x))
+                ((Data.Monoid.<>)
+                   (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                      (\ _v
+                         -> (Data.Monoid.<>)
+                              (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                              ((Prelude..)
+                                 (\ bs
+                                    -> (Data.Monoid.<>)
+                                         (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                            (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                         (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                 Data.ProtoLens.encodeMessage _v))
+                      (Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"vec'externalSymbols") _x))
+                   (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                      (Lens.Family2.view Data.ProtoLens.unknownFields _x))))
+instance Control.DeepSeq.NFData Index where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Index'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Index'metadata x__)
+                (Control.DeepSeq.deepseq
+                   (_Index'documents x__)
+                   (Control.DeepSeq.deepseq (_Index'externalSymbols x__) ())))
+newtype Language'UnrecognizedValue
+  = Language'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data Language
+  = UnspecifiedLanguage |
+    CSharp |
+    Swift |
+    Dart |
+    Kotlin |
+    Scala |
+    Java |
+    Groovy |
+    Clojure |
+    CommonLisp |
+    Scheme |
+    Racket |
+    Lua |
+    Perl |
+    Raku |
+    Python |
+    Ruby |
+    Elixir |
+    Erlang |
+    PHP |
+    Hack |
+    Coffeescript |
+    JavaScript |
+    TypeScript |
+    Flow |
+    Vue |
+    CSS |
+    Less |
+    Sass |
+    SCSS |
+    HTML |
+    XML |
+    XSL |
+    Go |
+    C |
+    CPP |
+    Objective_C |
+    Objective_CPP |
+    Zig |
+    Ada |
+    Rust |
+    OCaml |
+    FSharp |
+    SML |
+    Haskell |
+    Agda |
+    Idris |
+    Coq |
+    Lean |
+    APL |
+    Dyalog |
+    J |
+    Matlab |
+    Wolfram |
+    R |
+    Julia |
+    Fortran |
+    Delphi |
+    Assembly |
+    COBOL |
+    ABAP |
+    SAS |
+    Razor |
+    VisualBasic |
+    ShellScript |
+    Fish |
+    Awk |
+    PowerShell |
+    Bat |
+    SQL |
+    PLSQL |
+    Prolog |
+    Ini |
+    TOML |
+    YAML |
+    JSON |
+    Jsonnet |
+    Nix |
+    Skylark |
+    Makefile |
+    Dockerfile |
+    BibTeX |
+    TeX |
+    LaTeX |
+    Markdown |
+    ReST |
+    AsciiDoc |
+    Diff |
+    Git_Config |
+    Handlebars |
+    Git_Commit |
+    Git_Rebase |
+    JavaScriptReact |
+    TypeScriptReact |
+    Solidity |
+    Apex |
+    CUDA |
+    GraphQL |
+    Pascal |
+    Protobuf |
+    Tcl |
+    Repro |
+    Thrift |
+    Verilog |
+    VHDL |
+    Svelte |
+    Slang |
+    Luau |
+    Justfile |
+    Nickel |
+    Language'Unrecognized !Language'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum Language where
+  maybeToEnum 0 = Prelude.Just UnspecifiedLanguage
+  maybeToEnum 1 = Prelude.Just CSharp
+  maybeToEnum 2 = Prelude.Just Swift
+  maybeToEnum 3 = Prelude.Just Dart
+  maybeToEnum 4 = Prelude.Just Kotlin
+  maybeToEnum 5 = Prelude.Just Scala
+  maybeToEnum 6 = Prelude.Just Java
+  maybeToEnum 7 = Prelude.Just Groovy
+  maybeToEnum 8 = Prelude.Just Clojure
+  maybeToEnum 9 = Prelude.Just CommonLisp
+  maybeToEnum 10 = Prelude.Just Scheme
+  maybeToEnum 11 = Prelude.Just Racket
+  maybeToEnum 12 = Prelude.Just Lua
+  maybeToEnum 13 = Prelude.Just Perl
+  maybeToEnum 14 = Prelude.Just Raku
+  maybeToEnum 15 = Prelude.Just Python
+  maybeToEnum 16 = Prelude.Just Ruby
+  maybeToEnum 17 = Prelude.Just Elixir
+  maybeToEnum 18 = Prelude.Just Erlang
+  maybeToEnum 19 = Prelude.Just PHP
+  maybeToEnum 20 = Prelude.Just Hack
+  maybeToEnum 21 = Prelude.Just Coffeescript
+  maybeToEnum 22 = Prelude.Just JavaScript
+  maybeToEnum 23 = Prelude.Just TypeScript
+  maybeToEnum 24 = Prelude.Just Flow
+  maybeToEnum 25 = Prelude.Just Vue
+  maybeToEnum 26 = Prelude.Just CSS
+  maybeToEnum 27 = Prelude.Just Less
+  maybeToEnum 28 = Prelude.Just Sass
+  maybeToEnum 29 = Prelude.Just SCSS
+  maybeToEnum 30 = Prelude.Just HTML
+  maybeToEnum 31 = Prelude.Just XML
+  maybeToEnum 32 = Prelude.Just XSL
+  maybeToEnum 33 = Prelude.Just Go
+  maybeToEnum 34 = Prelude.Just C
+  maybeToEnum 35 = Prelude.Just CPP
+  maybeToEnum 36 = Prelude.Just Objective_C
+  maybeToEnum 37 = Prelude.Just Objective_CPP
+  maybeToEnum 38 = Prelude.Just Zig
+  maybeToEnum 39 = Prelude.Just Ada
+  maybeToEnum 40 = Prelude.Just Rust
+  maybeToEnum 41 = Prelude.Just OCaml
+  maybeToEnum 42 = Prelude.Just FSharp
+  maybeToEnum 43 = Prelude.Just SML
+  maybeToEnum 44 = Prelude.Just Haskell
+  maybeToEnum 45 = Prelude.Just Agda
+  maybeToEnum 46 = Prelude.Just Idris
+  maybeToEnum 47 = Prelude.Just Coq
+  maybeToEnum 48 = Prelude.Just Lean
+  maybeToEnum 49 = Prelude.Just APL
+  maybeToEnum 50 = Prelude.Just Dyalog
+  maybeToEnum 51 = Prelude.Just J
+  maybeToEnum 52 = Prelude.Just Matlab
+  maybeToEnum 53 = Prelude.Just Wolfram
+  maybeToEnum 54 = Prelude.Just R
+  maybeToEnum 55 = Prelude.Just Julia
+  maybeToEnum 56 = Prelude.Just Fortran
+  maybeToEnum 57 = Prelude.Just Delphi
+  maybeToEnum 58 = Prelude.Just Assembly
+  maybeToEnum 59 = Prelude.Just COBOL
+  maybeToEnum 60 = Prelude.Just ABAP
+  maybeToEnum 61 = Prelude.Just SAS
+  maybeToEnum 62 = Prelude.Just Razor
+  maybeToEnum 63 = Prelude.Just VisualBasic
+  maybeToEnum 64 = Prelude.Just ShellScript
+  maybeToEnum 65 = Prelude.Just Fish
+  maybeToEnum 66 = Prelude.Just Awk
+  maybeToEnum 67 = Prelude.Just PowerShell
+  maybeToEnum 68 = Prelude.Just Bat
+  maybeToEnum 69 = Prelude.Just SQL
+  maybeToEnum 70 = Prelude.Just PLSQL
+  maybeToEnum 71 = Prelude.Just Prolog
+  maybeToEnum 72 = Prelude.Just Ini
+  maybeToEnum 73 = Prelude.Just TOML
+  maybeToEnum 74 = Prelude.Just YAML
+  maybeToEnum 75 = Prelude.Just JSON
+  maybeToEnum 76 = Prelude.Just Jsonnet
+  maybeToEnum 77 = Prelude.Just Nix
+  maybeToEnum 78 = Prelude.Just Skylark
+  maybeToEnum 79 = Prelude.Just Makefile
+  maybeToEnum 80 = Prelude.Just Dockerfile
+  maybeToEnum 81 = Prelude.Just BibTeX
+  maybeToEnum 82 = Prelude.Just TeX
+  maybeToEnum 83 = Prelude.Just LaTeX
+  maybeToEnum 84 = Prelude.Just Markdown
+  maybeToEnum 85 = Prelude.Just ReST
+  maybeToEnum 86 = Prelude.Just AsciiDoc
+  maybeToEnum 88 = Prelude.Just Diff
+  maybeToEnum 89 = Prelude.Just Git_Config
+  maybeToEnum 90 = Prelude.Just Handlebars
+  maybeToEnum 91 = Prelude.Just Git_Commit
+  maybeToEnum 92 = Prelude.Just Git_Rebase
+  maybeToEnum 93 = Prelude.Just JavaScriptReact
+  maybeToEnum 94 = Prelude.Just TypeScriptReact
+  maybeToEnum 95 = Prelude.Just Solidity
+  maybeToEnum 96 = Prelude.Just Apex
+  maybeToEnum 97 = Prelude.Just CUDA
+  maybeToEnum 98 = Prelude.Just GraphQL
+  maybeToEnum 99 = Prelude.Just Pascal
+  maybeToEnum 100 = Prelude.Just Protobuf
+  maybeToEnum 101 = Prelude.Just Tcl
+  maybeToEnum 102 = Prelude.Just Repro
+  maybeToEnum 103 = Prelude.Just Thrift
+  maybeToEnum 104 = Prelude.Just Verilog
+  maybeToEnum 105 = Prelude.Just VHDL
+  maybeToEnum 106 = Prelude.Just Svelte
+  maybeToEnum 107 = Prelude.Just Slang
+  maybeToEnum 108 = Prelude.Just Luau
+  maybeToEnum 109 = Prelude.Just Justfile
+  maybeToEnum 110 = Prelude.Just Nickel
+  maybeToEnum k
+    = Prelude.Just
+        (Language'Unrecognized
+           (Language'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedLanguage = "UnspecifiedLanguage"
+  showEnum ABAP = "ABAP"
+  showEnum Apex = "Apex"
+  showEnum APL = "APL"
+  showEnum Ada = "Ada"
+  showEnum Agda = "Agda"
+  showEnum AsciiDoc = "AsciiDoc"
+  showEnum Assembly = "Assembly"
+  showEnum Awk = "Awk"
+  showEnum Bat = "Bat"
+  showEnum BibTeX = "BibTeX"
+  showEnum C = "C"
+  showEnum COBOL = "COBOL"
+  showEnum CPP = "CPP"
+  showEnum CSS = "CSS"
+  showEnum CSharp = "CSharp"
+  showEnum Clojure = "Clojure"
+  showEnum Coffeescript = "Coffeescript"
+  showEnum CommonLisp = "CommonLisp"
+  showEnum Coq = "Coq"
+  showEnum CUDA = "CUDA"
+  showEnum Dart = "Dart"
+  showEnum Delphi = "Delphi"
+  showEnum Diff = "Diff"
+  showEnum Dockerfile = "Dockerfile"
+  showEnum Dyalog = "Dyalog"
+  showEnum Elixir = "Elixir"
+  showEnum Erlang = "Erlang"
+  showEnum FSharp = "FSharp"
+  showEnum Fish = "Fish"
+  showEnum Flow = "Flow"
+  showEnum Fortran = "Fortran"
+  showEnum Git_Commit = "Git_Commit"
+  showEnum Git_Config = "Git_Config"
+  showEnum Git_Rebase = "Git_Rebase"
+  showEnum Go = "Go"
+  showEnum GraphQL = "GraphQL"
+  showEnum Groovy = "Groovy"
+  showEnum HTML = "HTML"
+  showEnum Hack = "Hack"
+  showEnum Handlebars = "Handlebars"
+  showEnum Haskell = "Haskell"
+  showEnum Idris = "Idris"
+  showEnum Ini = "Ini"
+  showEnum J = "J"
+  showEnum JSON = "JSON"
+  showEnum Java = "Java"
+  showEnum JavaScript = "JavaScript"
+  showEnum JavaScriptReact = "JavaScriptReact"
+  showEnum Jsonnet = "Jsonnet"
+  showEnum Julia = "Julia"
+  showEnum Justfile = "Justfile"
+  showEnum Kotlin = "Kotlin"
+  showEnum LaTeX = "LaTeX"
+  showEnum Lean = "Lean"
+  showEnum Less = "Less"
+  showEnum Lua = "Lua"
+  showEnum Luau = "Luau"
+  showEnum Makefile = "Makefile"
+  showEnum Markdown = "Markdown"
+  showEnum Matlab = "Matlab"
+  showEnum Nickel = "Nickel"
+  showEnum Nix = "Nix"
+  showEnum OCaml = "OCaml"
+  showEnum Objective_C = "Objective_C"
+  showEnum Objective_CPP = "Objective_CPP"
+  showEnum Pascal = "Pascal"
+  showEnum PHP = "PHP"
+  showEnum PLSQL = "PLSQL"
+  showEnum Perl = "Perl"
+  showEnum PowerShell = "PowerShell"
+  showEnum Prolog = "Prolog"
+  showEnum Protobuf = "Protobuf"
+  showEnum Python = "Python"
+  showEnum R = "R"
+  showEnum Racket = "Racket"
+  showEnum Raku = "Raku"
+  showEnum Razor = "Razor"
+  showEnum Repro = "Repro"
+  showEnum ReST = "ReST"
+  showEnum Ruby = "Ruby"
+  showEnum Rust = "Rust"
+  showEnum SAS = "SAS"
+  showEnum SCSS = "SCSS"
+  showEnum SML = "SML"
+  showEnum SQL = "SQL"
+  showEnum Sass = "Sass"
+  showEnum Scala = "Scala"
+  showEnum Scheme = "Scheme"
+  showEnum ShellScript = "ShellScript"
+  showEnum Skylark = "Skylark"
+  showEnum Slang = "Slang"
+  showEnum Solidity = "Solidity"
+  showEnum Svelte = "Svelte"
+  showEnum Swift = "Swift"
+  showEnum Tcl = "Tcl"
+  showEnum TOML = "TOML"
+  showEnum TeX = "TeX"
+  showEnum Thrift = "Thrift"
+  showEnum TypeScript = "TypeScript"
+  showEnum TypeScriptReact = "TypeScriptReact"
+  showEnum Verilog = "Verilog"
+  showEnum VHDL = "VHDL"
+  showEnum VisualBasic = "VisualBasic"
+  showEnum Vue = "Vue"
+  showEnum Wolfram = "Wolfram"
+  showEnum XML = "XML"
+  showEnum XSL = "XSL"
+  showEnum YAML = "YAML"
+  showEnum Zig = "Zig"
+  showEnum (Language'Unrecognized (Language'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedLanguage"
+    = Prelude.Just UnspecifiedLanguage
+    | (Prelude.==) k "ABAP" = Prelude.Just ABAP
+    | (Prelude.==) k "Apex" = Prelude.Just Apex
+    | (Prelude.==) k "APL" = Prelude.Just APL
+    | (Prelude.==) k "Ada" = Prelude.Just Ada
+    | (Prelude.==) k "Agda" = Prelude.Just Agda
+    | (Prelude.==) k "AsciiDoc" = Prelude.Just AsciiDoc
+    | (Prelude.==) k "Assembly" = Prelude.Just Assembly
+    | (Prelude.==) k "Awk" = Prelude.Just Awk
+    | (Prelude.==) k "Bat" = Prelude.Just Bat
+    | (Prelude.==) k "BibTeX" = Prelude.Just BibTeX
+    | (Prelude.==) k "C" = Prelude.Just C
+    | (Prelude.==) k "COBOL" = Prelude.Just COBOL
+    | (Prelude.==) k "CPP" = Prelude.Just CPP
+    | (Prelude.==) k "CSS" = Prelude.Just CSS
+    | (Prelude.==) k "CSharp" = Prelude.Just CSharp
+    | (Prelude.==) k "Clojure" = Prelude.Just Clojure
+    | (Prelude.==) k "Coffeescript" = Prelude.Just Coffeescript
+    | (Prelude.==) k "CommonLisp" = Prelude.Just CommonLisp
+    | (Prelude.==) k "Coq" = Prelude.Just Coq
+    | (Prelude.==) k "CUDA" = Prelude.Just CUDA
+    | (Prelude.==) k "Dart" = Prelude.Just Dart
+    | (Prelude.==) k "Delphi" = Prelude.Just Delphi
+    | (Prelude.==) k "Diff" = Prelude.Just Diff
+    | (Prelude.==) k "Dockerfile" = Prelude.Just Dockerfile
+    | (Prelude.==) k "Dyalog" = Prelude.Just Dyalog
+    | (Prelude.==) k "Elixir" = Prelude.Just Elixir
+    | (Prelude.==) k "Erlang" = Prelude.Just Erlang
+    | (Prelude.==) k "FSharp" = Prelude.Just FSharp
+    | (Prelude.==) k "Fish" = Prelude.Just Fish
+    | (Prelude.==) k "Flow" = Prelude.Just Flow
+    | (Prelude.==) k "Fortran" = Prelude.Just Fortran
+    | (Prelude.==) k "Git_Commit" = Prelude.Just Git_Commit
+    | (Prelude.==) k "Git_Config" = Prelude.Just Git_Config
+    | (Prelude.==) k "Git_Rebase" = Prelude.Just Git_Rebase
+    | (Prelude.==) k "Go" = Prelude.Just Go
+    | (Prelude.==) k "GraphQL" = Prelude.Just GraphQL
+    | (Prelude.==) k "Groovy" = Prelude.Just Groovy
+    | (Prelude.==) k "HTML" = Prelude.Just HTML
+    | (Prelude.==) k "Hack" = Prelude.Just Hack
+    | (Prelude.==) k "Handlebars" = Prelude.Just Handlebars
+    | (Prelude.==) k "Haskell" = Prelude.Just Haskell
+    | (Prelude.==) k "Idris" = Prelude.Just Idris
+    | (Prelude.==) k "Ini" = Prelude.Just Ini
+    | (Prelude.==) k "J" = Prelude.Just J
+    | (Prelude.==) k "JSON" = Prelude.Just JSON
+    | (Prelude.==) k "Java" = Prelude.Just Java
+    | (Prelude.==) k "JavaScript" = Prelude.Just JavaScript
+    | (Prelude.==) k "JavaScriptReact" = Prelude.Just JavaScriptReact
+    | (Prelude.==) k "Jsonnet" = Prelude.Just Jsonnet
+    | (Prelude.==) k "Julia" = Prelude.Just Julia
+    | (Prelude.==) k "Justfile" = Prelude.Just Justfile
+    | (Prelude.==) k "Kotlin" = Prelude.Just Kotlin
+    | (Prelude.==) k "LaTeX" = Prelude.Just LaTeX
+    | (Prelude.==) k "Lean" = Prelude.Just Lean
+    | (Prelude.==) k "Less" = Prelude.Just Less
+    | (Prelude.==) k "Lua" = Prelude.Just Lua
+    | (Prelude.==) k "Luau" = Prelude.Just Luau
+    | (Prelude.==) k "Makefile" = Prelude.Just Makefile
+    | (Prelude.==) k "Markdown" = Prelude.Just Markdown
+    | (Prelude.==) k "Matlab" = Prelude.Just Matlab
+    | (Prelude.==) k "Nickel" = Prelude.Just Nickel
+    | (Prelude.==) k "Nix" = Prelude.Just Nix
+    | (Prelude.==) k "OCaml" = Prelude.Just OCaml
+    | (Prelude.==) k "Objective_C" = Prelude.Just Objective_C
+    | (Prelude.==) k "Objective_CPP" = Prelude.Just Objective_CPP
+    | (Prelude.==) k "Pascal" = Prelude.Just Pascal
+    | (Prelude.==) k "PHP" = Prelude.Just PHP
+    | (Prelude.==) k "PLSQL" = Prelude.Just PLSQL
+    | (Prelude.==) k "Perl" = Prelude.Just Perl
+    | (Prelude.==) k "PowerShell" = Prelude.Just PowerShell
+    | (Prelude.==) k "Prolog" = Prelude.Just Prolog
+    | (Prelude.==) k "Protobuf" = Prelude.Just Protobuf
+    | (Prelude.==) k "Python" = Prelude.Just Python
+    | (Prelude.==) k "R" = Prelude.Just R
+    | (Prelude.==) k "Racket" = Prelude.Just Racket
+    | (Prelude.==) k "Raku" = Prelude.Just Raku
+    | (Prelude.==) k "Razor" = Prelude.Just Razor
+    | (Prelude.==) k "Repro" = Prelude.Just Repro
+    | (Prelude.==) k "ReST" = Prelude.Just ReST
+    | (Prelude.==) k "Ruby" = Prelude.Just Ruby
+    | (Prelude.==) k "Rust" = Prelude.Just Rust
+    | (Prelude.==) k "SAS" = Prelude.Just SAS
+    | (Prelude.==) k "SCSS" = Prelude.Just SCSS
+    | (Prelude.==) k "SML" = Prelude.Just SML
+    | (Prelude.==) k "SQL" = Prelude.Just SQL
+    | (Prelude.==) k "Sass" = Prelude.Just Sass
+    | (Prelude.==) k "Scala" = Prelude.Just Scala
+    | (Prelude.==) k "Scheme" = Prelude.Just Scheme
+    | (Prelude.==) k "ShellScript" = Prelude.Just ShellScript
+    | (Prelude.==) k "Skylark" = Prelude.Just Skylark
+    | (Prelude.==) k "Slang" = Prelude.Just Slang
+    | (Prelude.==) k "Solidity" = Prelude.Just Solidity
+    | (Prelude.==) k "Svelte" = Prelude.Just Svelte
+    | (Prelude.==) k "Swift" = Prelude.Just Swift
+    | (Prelude.==) k "Tcl" = Prelude.Just Tcl
+    | (Prelude.==) k "TOML" = Prelude.Just TOML
+    | (Prelude.==) k "TeX" = Prelude.Just TeX
+    | (Prelude.==) k "Thrift" = Prelude.Just Thrift
+    | (Prelude.==) k "TypeScript" = Prelude.Just TypeScript
+    | (Prelude.==) k "TypeScriptReact" = Prelude.Just TypeScriptReact
+    | (Prelude.==) k "Verilog" = Prelude.Just Verilog
+    | (Prelude.==) k "VHDL" = Prelude.Just VHDL
+    | (Prelude.==) k "VisualBasic" = Prelude.Just VisualBasic
+    | (Prelude.==) k "Vue" = Prelude.Just Vue
+    | (Prelude.==) k "Wolfram" = Prelude.Just Wolfram
+    | (Prelude.==) k "XML" = Prelude.Just XML
+    | (Prelude.==) k "XSL" = Prelude.Just XSL
+    | (Prelude.==) k "YAML" = Prelude.Just YAML
+    | (Prelude.==) k "Zig" = Prelude.Just Zig
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded Language where
+  minBound = UnspecifiedLanguage
+  maxBound = Nickel
+instance Prelude.Enum Language where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum Language: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedLanguage = 0
+  fromEnum CSharp = 1
+  fromEnum Swift = 2
+  fromEnum Dart = 3
+  fromEnum Kotlin = 4
+  fromEnum Scala = 5
+  fromEnum Java = 6
+  fromEnum Groovy = 7
+  fromEnum Clojure = 8
+  fromEnum CommonLisp = 9
+  fromEnum Scheme = 10
+  fromEnum Racket = 11
+  fromEnum Lua = 12
+  fromEnum Perl = 13
+  fromEnum Raku = 14
+  fromEnum Python = 15
+  fromEnum Ruby = 16
+  fromEnum Elixir = 17
+  fromEnum Erlang = 18
+  fromEnum PHP = 19
+  fromEnum Hack = 20
+  fromEnum Coffeescript = 21
+  fromEnum JavaScript = 22
+  fromEnum TypeScript = 23
+  fromEnum Flow = 24
+  fromEnum Vue = 25
+  fromEnum CSS = 26
+  fromEnum Less = 27
+  fromEnum Sass = 28
+  fromEnum SCSS = 29
+  fromEnum HTML = 30
+  fromEnum XML = 31
+  fromEnum XSL = 32
+  fromEnum Go = 33
+  fromEnum C = 34
+  fromEnum CPP = 35
+  fromEnum Objective_C = 36
+  fromEnum Objective_CPP = 37
+  fromEnum Zig = 38
+  fromEnum Ada = 39
+  fromEnum Rust = 40
+  fromEnum OCaml = 41
+  fromEnum FSharp = 42
+  fromEnum SML = 43
+  fromEnum Haskell = 44
+  fromEnum Agda = 45
+  fromEnum Idris = 46
+  fromEnum Coq = 47
+  fromEnum Lean = 48
+  fromEnum APL = 49
+  fromEnum Dyalog = 50
+  fromEnum J = 51
+  fromEnum Matlab = 52
+  fromEnum Wolfram = 53
+  fromEnum R = 54
+  fromEnum Julia = 55
+  fromEnum Fortran = 56
+  fromEnum Delphi = 57
+  fromEnum Assembly = 58
+  fromEnum COBOL = 59
+  fromEnum ABAP = 60
+  fromEnum SAS = 61
+  fromEnum Razor = 62
+  fromEnum VisualBasic = 63
+  fromEnum ShellScript = 64
+  fromEnum Fish = 65
+  fromEnum Awk = 66
+  fromEnum PowerShell = 67
+  fromEnum Bat = 68
+  fromEnum SQL = 69
+  fromEnum PLSQL = 70
+  fromEnum Prolog = 71
+  fromEnum Ini = 72
+  fromEnum TOML = 73
+  fromEnum YAML = 74
+  fromEnum JSON = 75
+  fromEnum Jsonnet = 76
+  fromEnum Nix = 77
+  fromEnum Skylark = 78
+  fromEnum Makefile = 79
+  fromEnum Dockerfile = 80
+  fromEnum BibTeX = 81
+  fromEnum TeX = 82
+  fromEnum LaTeX = 83
+  fromEnum Markdown = 84
+  fromEnum ReST = 85
+  fromEnum AsciiDoc = 86
+  fromEnum Diff = 88
+  fromEnum Git_Config = 89
+  fromEnum Handlebars = 90
+  fromEnum Git_Commit = 91
+  fromEnum Git_Rebase = 92
+  fromEnum JavaScriptReact = 93
+  fromEnum TypeScriptReact = 94
+  fromEnum Solidity = 95
+  fromEnum Apex = 96
+  fromEnum CUDA = 97
+  fromEnum GraphQL = 98
+  fromEnum Pascal = 99
+  fromEnum Protobuf = 100
+  fromEnum Tcl = 101
+  fromEnum Repro = 102
+  fromEnum Thrift = 103
+  fromEnum Verilog = 104
+  fromEnum VHDL = 105
+  fromEnum Svelte = 106
+  fromEnum Slang = 107
+  fromEnum Luau = 108
+  fromEnum Justfile = 109
+  fromEnum Nickel = 110
+  fromEnum (Language'Unrecognized (Language'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ Nickel
+    = Prelude.error
+        "Language.succ: bad argument Nickel. This value would be out of bounds."
+  succ UnspecifiedLanguage = CSharp
+  succ CSharp = Swift
+  succ Swift = Dart
+  succ Dart = Kotlin
+  succ Kotlin = Scala
+  succ Scala = Java
+  succ Java = Groovy
+  succ Groovy = Clojure
+  succ Clojure = CommonLisp
+  succ CommonLisp = Scheme
+  succ Scheme = Racket
+  succ Racket = Lua
+  succ Lua = Perl
+  succ Perl = Raku
+  succ Raku = Python
+  succ Python = Ruby
+  succ Ruby = Elixir
+  succ Elixir = Erlang
+  succ Erlang = PHP
+  succ PHP = Hack
+  succ Hack = Coffeescript
+  succ Coffeescript = JavaScript
+  succ JavaScript = TypeScript
+  succ TypeScript = Flow
+  succ Flow = Vue
+  succ Vue = CSS
+  succ CSS = Less
+  succ Less = Sass
+  succ Sass = SCSS
+  succ SCSS = HTML
+  succ HTML = XML
+  succ XML = XSL
+  succ XSL = Go
+  succ Go = C
+  succ C = CPP
+  succ CPP = Objective_C
+  succ Objective_C = Objective_CPP
+  succ Objective_CPP = Zig
+  succ Zig = Ada
+  succ Ada = Rust
+  succ Rust = OCaml
+  succ OCaml = FSharp
+  succ FSharp = SML
+  succ SML = Haskell
+  succ Haskell = Agda
+  succ Agda = Idris
+  succ Idris = Coq
+  succ Coq = Lean
+  succ Lean = APL
+  succ APL = Dyalog
+  succ Dyalog = J
+  succ J = Matlab
+  succ Matlab = Wolfram
+  succ Wolfram = R
+  succ R = Julia
+  succ Julia = Fortran
+  succ Fortran = Delphi
+  succ Delphi = Assembly
+  succ Assembly = COBOL
+  succ COBOL = ABAP
+  succ ABAP = SAS
+  succ SAS = Razor
+  succ Razor = VisualBasic
+  succ VisualBasic = ShellScript
+  succ ShellScript = Fish
+  succ Fish = Awk
+  succ Awk = PowerShell
+  succ PowerShell = Bat
+  succ Bat = SQL
+  succ SQL = PLSQL
+  succ PLSQL = Prolog
+  succ Prolog = Ini
+  succ Ini = TOML
+  succ TOML = YAML
+  succ YAML = JSON
+  succ JSON = Jsonnet
+  succ Jsonnet = Nix
+  succ Nix = Skylark
+  succ Skylark = Makefile
+  succ Makefile = Dockerfile
+  succ Dockerfile = BibTeX
+  succ BibTeX = TeX
+  succ TeX = LaTeX
+  succ LaTeX = Markdown
+  succ Markdown = ReST
+  succ ReST = AsciiDoc
+  succ AsciiDoc = Diff
+  succ Diff = Git_Config
+  succ Git_Config = Handlebars
+  succ Handlebars = Git_Commit
+  succ Git_Commit = Git_Rebase
+  succ Git_Rebase = JavaScriptReact
+  succ JavaScriptReact = TypeScriptReact
+  succ TypeScriptReact = Solidity
+  succ Solidity = Apex
+  succ Apex = CUDA
+  succ CUDA = GraphQL
+  succ GraphQL = Pascal
+  succ Pascal = Protobuf
+  succ Protobuf = Tcl
+  succ Tcl = Repro
+  succ Repro = Thrift
+  succ Thrift = Verilog
+  succ Verilog = VHDL
+  succ VHDL = Svelte
+  succ Svelte = Slang
+  succ Slang = Luau
+  succ Luau = Justfile
+  succ Justfile = Nickel
+  succ (Language'Unrecognized _)
+    = Prelude.error "Language.succ: bad argument: unrecognized value"
+  pred UnspecifiedLanguage
+    = Prelude.error
+        "Language.pred: bad argument UnspecifiedLanguage. This value would be out of bounds."
+  pred CSharp = UnspecifiedLanguage
+  pred Swift = CSharp
+  pred Dart = Swift
+  pred Kotlin = Dart
+  pred Scala = Kotlin
+  pred Java = Scala
+  pred Groovy = Java
+  pred Clojure = Groovy
+  pred CommonLisp = Clojure
+  pred Scheme = CommonLisp
+  pred Racket = Scheme
+  pred Lua = Racket
+  pred Perl = Lua
+  pred Raku = Perl
+  pred Python = Raku
+  pred Ruby = Python
+  pred Elixir = Ruby
+  pred Erlang = Elixir
+  pred PHP = Erlang
+  pred Hack = PHP
+  pred Coffeescript = Hack
+  pred JavaScript = Coffeescript
+  pred TypeScript = JavaScript
+  pred Flow = TypeScript
+  pred Vue = Flow
+  pred CSS = Vue
+  pred Less = CSS
+  pred Sass = Less
+  pred SCSS = Sass
+  pred HTML = SCSS
+  pred XML = HTML
+  pred XSL = XML
+  pred Go = XSL
+  pred C = Go
+  pred CPP = C
+  pred Objective_C = CPP
+  pred Objective_CPP = Objective_C
+  pred Zig = Objective_CPP
+  pred Ada = Zig
+  pred Rust = Ada
+  pred OCaml = Rust
+  pred FSharp = OCaml
+  pred SML = FSharp
+  pred Haskell = SML
+  pred Agda = Haskell
+  pred Idris = Agda
+  pred Coq = Idris
+  pred Lean = Coq
+  pred APL = Lean
+  pred Dyalog = APL
+  pred J = Dyalog
+  pred Matlab = J
+  pred Wolfram = Matlab
+  pred R = Wolfram
+  pred Julia = R
+  pred Fortran = Julia
+  pred Delphi = Fortran
+  pred Assembly = Delphi
+  pred COBOL = Assembly
+  pred ABAP = COBOL
+  pred SAS = ABAP
+  pred Razor = SAS
+  pred VisualBasic = Razor
+  pred ShellScript = VisualBasic
+  pred Fish = ShellScript
+  pred Awk = Fish
+  pred PowerShell = Awk
+  pred Bat = PowerShell
+  pred SQL = Bat
+  pred PLSQL = SQL
+  pred Prolog = PLSQL
+  pred Ini = Prolog
+  pred TOML = Ini
+  pred YAML = TOML
+  pred JSON = YAML
+  pred Jsonnet = JSON
+  pred Nix = Jsonnet
+  pred Skylark = Nix
+  pred Makefile = Skylark
+  pred Dockerfile = Makefile
+  pred BibTeX = Dockerfile
+  pred TeX = BibTeX
+  pred LaTeX = TeX
+  pred Markdown = LaTeX
+  pred ReST = Markdown
+  pred AsciiDoc = ReST
+  pred Diff = AsciiDoc
+  pred Git_Config = Diff
+  pred Handlebars = Git_Config
+  pred Git_Commit = Handlebars
+  pred Git_Rebase = Git_Commit
+  pred JavaScriptReact = Git_Rebase
+  pred TypeScriptReact = JavaScriptReact
+  pred Solidity = TypeScriptReact
+  pred Apex = Solidity
+  pred CUDA = Apex
+  pred GraphQL = CUDA
+  pred Pascal = GraphQL
+  pred Protobuf = Pascal
+  pred Tcl = Protobuf
+  pred Repro = Tcl
+  pred Thrift = Repro
+  pred Verilog = Thrift
+  pred VHDL = Verilog
+  pred Svelte = VHDL
+  pred Slang = Svelte
+  pred Luau = Slang
+  pred Justfile = Luau
+  pred Nickel = Justfile
+  pred (Language'Unrecognized _)
+    = Prelude.error "Language.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault Language where
+  fieldDefault = UnspecifiedLanguage
+instance Control.DeepSeq.NFData Language where
+  rnf x__ = Prelude.seq x__ ()
+{- | Fields :
+
+         * 'Proto.Scip_Fields.version' @:: Lens' Metadata ProtocolVersion@
+         * 'Proto.Scip_Fields.toolInfo' @:: Lens' Metadata ToolInfo@
+         * 'Proto.Scip_Fields.maybe'toolInfo' @:: Lens' Metadata (Prelude.Maybe ToolInfo)@
+         * 'Proto.Scip_Fields.projectRoot' @:: Lens' Metadata Data.Text.Text@
+         * 'Proto.Scip_Fields.textDocumentEncoding' @:: Lens' Metadata TextEncoding@ -}
+data Metadata
+  = Metadata'_constructor {_Metadata'version :: !ProtocolVersion,
+                           _Metadata'toolInfo :: !(Prelude.Maybe ToolInfo),
+                           _Metadata'projectRoot :: !Data.Text.Text,
+                           _Metadata'textDocumentEncoding :: !TextEncoding,
+                           _Metadata'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Metadata where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Metadata "version" ProtocolVersion where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Metadata'version (\ x__ y__ -> x__ {_Metadata'version = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Metadata "toolInfo" ToolInfo where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Metadata'toolInfo (\ x__ y__ -> x__ {_Metadata'toolInfo = y__}))
+        (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)
+instance Data.ProtoLens.Field.HasField Metadata "maybe'toolInfo" (Prelude.Maybe ToolInfo) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Metadata'toolInfo (\ x__ y__ -> x__ {_Metadata'toolInfo = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Metadata "projectRoot" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Metadata'projectRoot
+           (\ x__ y__ -> x__ {_Metadata'projectRoot = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Metadata "textDocumentEncoding" TextEncoding where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Metadata'textDocumentEncoding
+           (\ x__ y__ -> x__ {_Metadata'textDocumentEncoding = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Metadata where
+  messageName _ = Data.Text.pack "scip.Metadata"
+  packedMessageDescriptor _
+    = "\n\
+      \\bMetadata\DC2/\n\
+      \\aversion\CAN\SOH \SOH(\SO2\NAK.scip.ProtocolVersionR\aversion\DC2+\n\
+      \\ttool_info\CAN\STX \SOH(\v2\SO.scip.ToolInfoR\btoolInfo\DC2!\n\
+      \\fproject_root\CAN\ETX \SOH(\tR\vprojectRoot\DC2H\n\
+      \\SYNtext_document_encoding\CAN\EOT \SOH(\SO2\DC2.scip.TextEncodingR\DC4textDocumentEncoding"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        version__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "version"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor ProtocolVersion)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"version")) ::
+              Data.ProtoLens.FieldDescriptor Metadata
+        toolInfo__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "tool_info"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor ToolInfo)
+              (Data.ProtoLens.OptionalField
+                 (Data.ProtoLens.Field.field @"maybe'toolInfo")) ::
+              Data.ProtoLens.FieldDescriptor Metadata
+        projectRoot__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "project_root"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"projectRoot")) ::
+              Data.ProtoLens.FieldDescriptor Metadata
+        textDocumentEncoding__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "text_document_encoding"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor TextEncoding)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"textDocumentEncoding")) ::
+              Data.ProtoLens.FieldDescriptor Metadata
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, version__field_descriptor),
+           (Data.ProtoLens.Tag 2, toolInfo__field_descriptor),
+           (Data.ProtoLens.Tag 3, projectRoot__field_descriptor),
+           (Data.ProtoLens.Tag 4, textDocumentEncoding__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Metadata'_unknownFields
+        (\ x__ y__ -> x__ {_Metadata'_unknownFields = y__})
+  defMessage
+    = Metadata'_constructor
+        {_Metadata'version = Data.ProtoLens.fieldDefault,
+         _Metadata'toolInfo = Prelude.Nothing,
+         _Metadata'projectRoot = Data.ProtoLens.fieldDefault,
+         _Metadata'textDocumentEncoding = Data.ProtoLens.fieldDefault,
+         _Metadata'_unknownFields = []}
+  parseMessage
+    = let
+        loop :: Metadata -> Data.ProtoLens.Encoding.Bytes.Parser Metadata
+        loop x
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x)
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        8 -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "version"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"version") y x)
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                           Data.ProtoLens.Encoding.Bytes.isolate
+                                             (Prelude.fromIntegral len) Data.ProtoLens.parseMessage)
+                                       "tool_info"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"toolInfo") y x)
+                        26
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "project_root"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"projectRoot") y x)
+                        32
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "text_document_encoding"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"textDocumentEncoding") y x)
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do loop Data.ProtoLens.defMessage) "Metadata"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"version") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 8)
+                      ((Prelude..)
+                         ((Prelude..)
+                            Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                         Prelude.fromEnum _v))
+             ((Data.Monoid.<>)
+                (case
+                     Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'toolInfo") _x
+                 of
+                   Prelude.Nothing -> Data.Monoid.mempty
+                   (Prelude.Just _v)
+                     -> (Data.Monoid.<>)
+                          (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                          ((Prelude..)
+                             (\ bs
+                                -> (Data.Monoid.<>)
+                                     (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                        (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                     (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                             Data.ProtoLens.encodeMessage _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v
+                        = Lens.Family2.view (Data.ProtoLens.Field.field @"projectRoot") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                            ((Prelude..)
+                               (\ bs
+                                  -> (Data.Monoid.<>)
+                                       (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                          (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                       (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                               Data.Text.Encoding.encodeUtf8 _v))
+                   ((Data.Monoid.<>)
+                      (let
+                         _v
+                           = Lens.Family2.view
+                               (Data.ProtoLens.Field.field @"textDocumentEncoding") _x
+                       in
+                         if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                             Data.Monoid.mempty
+                         else
+                             (Data.Monoid.<>)
+                               (Data.ProtoLens.Encoding.Bytes.putVarInt 32)
+                               ((Prelude..)
+                                  ((Prelude..)
+                                     Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                                  Prelude.fromEnum _v))
+                      (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                         (Lens.Family2.view Data.ProtoLens.unknownFields _x)))))
+instance Control.DeepSeq.NFData Metadata where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Metadata'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Metadata'version x__)
+                (Control.DeepSeq.deepseq
+                   (_Metadata'toolInfo x__)
+                   (Control.DeepSeq.deepseq
+                      (_Metadata'projectRoot x__)
+                      (Control.DeepSeq.deepseq
+                         (_Metadata'textDocumentEncoding x__) ()))))
+{- | Fields :
+
+         * 'Proto.Scip_Fields.range' @:: Lens' Occurrence [Data.Int.Int32]@
+         * 'Proto.Scip_Fields.vec'range' @:: Lens' Occurrence (Data.Vector.Unboxed.Vector Data.Int.Int32)@
+         * 'Proto.Scip_Fields.symbol' @:: Lens' Occurrence Data.Text.Text@
+         * 'Proto.Scip_Fields.symbolRoles' @:: Lens' Occurrence Data.Int.Int32@
+         * 'Proto.Scip_Fields.overrideDocumentation' @:: Lens' Occurrence [Data.Text.Text]@
+         * 'Proto.Scip_Fields.vec'overrideDocumentation' @:: Lens' Occurrence (Data.Vector.Vector Data.Text.Text)@
+         * 'Proto.Scip_Fields.syntaxKind' @:: Lens' Occurrence SyntaxKind@
+         * 'Proto.Scip_Fields.diagnostics' @:: Lens' Occurrence [Diagnostic]@
+         * 'Proto.Scip_Fields.vec'diagnostics' @:: Lens' Occurrence (Data.Vector.Vector Diagnostic)@
+         * 'Proto.Scip_Fields.enclosingRange' @:: Lens' Occurrence [Data.Int.Int32]@
+         * 'Proto.Scip_Fields.vec'enclosingRange' @:: Lens' Occurrence (Data.Vector.Unboxed.Vector Data.Int.Int32)@ -}
+data Occurrence
+  = Occurrence'_constructor {_Occurrence'range :: !(Data.Vector.Unboxed.Vector Data.Int.Int32),
+                             _Occurrence'symbol :: !Data.Text.Text,
+                             _Occurrence'symbolRoles :: !Data.Int.Int32,
+                             _Occurrence'overrideDocumentation :: !(Data.Vector.Vector Data.Text.Text),
+                             _Occurrence'syntaxKind :: !SyntaxKind,
+                             _Occurrence'diagnostics :: !(Data.Vector.Vector Diagnostic),
+                             _Occurrence'enclosingRange :: !(Data.Vector.Unboxed.Vector Data.Int.Int32),
+                             _Occurrence'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Occurrence where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Occurrence "range" [Data.Int.Int32] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'range (\ x__ y__ -> x__ {_Occurrence'range = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Occurrence "vec'range" (Data.Vector.Unboxed.Vector Data.Int.Int32) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'range (\ x__ y__ -> x__ {_Occurrence'range = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "symbol" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'symbol (\ x__ y__ -> x__ {_Occurrence'symbol = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "symbolRoles" Data.Int.Int32 where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'symbolRoles
+           (\ x__ y__ -> x__ {_Occurrence'symbolRoles = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "overrideDocumentation" [Data.Text.Text] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'overrideDocumentation
+           (\ x__ y__ -> x__ {_Occurrence'overrideDocumentation = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Occurrence "vec'overrideDocumentation" (Data.Vector.Vector Data.Text.Text) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'overrideDocumentation
+           (\ x__ y__ -> x__ {_Occurrence'overrideDocumentation = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "syntaxKind" SyntaxKind where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'syntaxKind
+           (\ x__ y__ -> x__ {_Occurrence'syntaxKind = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "diagnostics" [Diagnostic] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'diagnostics
+           (\ x__ y__ -> x__ {_Occurrence'diagnostics = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Occurrence "vec'diagnostics" (Data.Vector.Vector Diagnostic) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'diagnostics
+           (\ x__ y__ -> x__ {_Occurrence'diagnostics = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Occurrence "enclosingRange" [Data.Int.Int32] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'enclosingRange
+           (\ x__ y__ -> x__ {_Occurrence'enclosingRange = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Occurrence "vec'enclosingRange" (Data.Vector.Unboxed.Vector Data.Int.Int32) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Occurrence'enclosingRange
+           (\ x__ y__ -> x__ {_Occurrence'enclosingRange = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Occurrence where
+  messageName _ = Data.Text.pack "scip.Occurrence"
+  packedMessageDescriptor _
+    = "\n\
+      \\n\
+      \Occurrence\DC2\DC4\n\
+      \\ENQrange\CAN\SOH \ETX(\ENQR\ENQrange\DC2\SYN\n\
+      \\ACKsymbol\CAN\STX \SOH(\tR\ACKsymbol\DC2!\n\
+      \\fsymbol_roles\CAN\ETX \SOH(\ENQR\vsymbolRoles\DC25\n\
+      \\SYNoverride_documentation\CAN\EOT \ETX(\tR\NAKoverrideDocumentation\DC21\n\
+      \\vsyntax_kind\CAN\ENQ \SOH(\SO2\DLE.scip.SyntaxKindR\n\
+      \syntaxKind\DC22\n\
+      \\vdiagnostics\CAN\ACK \ETX(\v2\DLE.scip.DiagnosticR\vdiagnostics\DC2'\n\
+      \\SIenclosing_range\CAN\a \ETX(\ENQR\SOenclosingRange"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        range__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "range"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Packed (Data.ProtoLens.Field.field @"range")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        symbol__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "symbol"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"symbol")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        symbolRoles__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "symbol_roles"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"symbolRoles")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        overrideDocumentation__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "override_documentation"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"overrideDocumentation")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        syntaxKind__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "syntax_kind"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor SyntaxKind)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"syntaxKind")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        diagnostics__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "diagnostics"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Diagnostic)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"diagnostics")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+        enclosingRange__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "enclosing_range"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Packed
+                 (Data.ProtoLens.Field.field @"enclosingRange")) ::
+              Data.ProtoLens.FieldDescriptor Occurrence
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, range__field_descriptor),
+           (Data.ProtoLens.Tag 2, symbol__field_descriptor),
+           (Data.ProtoLens.Tag 3, symbolRoles__field_descriptor),
+           (Data.ProtoLens.Tag 4, overrideDocumentation__field_descriptor),
+           (Data.ProtoLens.Tag 5, syntaxKind__field_descriptor),
+           (Data.ProtoLens.Tag 6, diagnostics__field_descriptor),
+           (Data.ProtoLens.Tag 7, enclosingRange__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Occurrence'_unknownFields
+        (\ x__ y__ -> x__ {_Occurrence'_unknownFields = y__})
+  defMessage
+    = Occurrence'_constructor
+        {_Occurrence'range = Data.Vector.Generic.empty,
+         _Occurrence'symbol = Data.ProtoLens.fieldDefault,
+         _Occurrence'symbolRoles = Data.ProtoLens.fieldDefault,
+         _Occurrence'overrideDocumentation = Data.Vector.Generic.empty,
+         _Occurrence'syntaxKind = Data.ProtoLens.fieldDefault,
+         _Occurrence'diagnostics = Data.Vector.Generic.empty,
+         _Occurrence'enclosingRange = Data.Vector.Generic.empty,
+         _Occurrence'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Occurrence
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Diagnostic
+             -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Unboxed.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Int.Int32
+                -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Text.Text
+                   -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Unboxed.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Int.Int32
+                      -> Data.ProtoLens.Encoding.Bytes.Parser Occurrence
+        loop
+          x
+          mutable'diagnostics
+          mutable'enclosingRange
+          mutable'overrideDocumentation
+          mutable'range
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'diagnostics <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                              (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                 mutable'diagnostics)
+                      frozen'enclosingRange <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                 (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                    mutable'enclosingRange)
+                      frozen'overrideDocumentation <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                        (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                           mutable'overrideDocumentation)
+                      frozen'range <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                        (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'range)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'diagnostics") frozen'diagnostics
+                              (Lens.Family2.set
+                                 (Data.ProtoLens.Field.field @"vec'enclosingRange")
+                                 frozen'enclosingRange
+                                 (Lens.Family2.set
+                                    (Data.ProtoLens.Field.field @"vec'overrideDocumentation")
+                                    frozen'overrideDocumentation
+                                    (Lens.Family2.set
+                                       (Data.ProtoLens.Field.field @"vec'range") frozen'range x)))))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        8 -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (Prelude.fmap
+                                           Prelude.fromIntegral
+                                           Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                        "range"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append mutable'range y)
+                                loop
+                                  x mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation v
+                        10
+                          -> do y <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                        Data.ProtoLens.Encoding.Bytes.isolate
+                                          (Prelude.fromIntegral len)
+                                          ((let
+                                              ploop qs
+                                                = do packedEnd <- Data.ProtoLens.Encoding.Bytes.atEnd
+                                                     if packedEnd then
+                                                         Prelude.return qs
+                                                     else
+                                                         do !q <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                                                    (Prelude.fmap
+                                                                       Prelude.fromIntegral
+                                                                       Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                                                    "range"
+                                                            qs' <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                                     (Data.ProtoLens.Encoding.Growing.append
+                                                                        qs q)
+                                                            ploop qs'
+                                            in ploop)
+                                             mutable'range)
+                                loop
+                                  x mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation y
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "symbol"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") y x)
+                                  mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation mutable'range
+                        24
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.fromIntegral
+                                          Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                       "symbol_roles"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"symbolRoles") y x)
+                                  mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation mutable'range
+                        34
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                        Data.ProtoLens.Encoding.Bytes.getBytes
+                                                          (Prelude.fromIntegral len)
+                                            Data.ProtoLens.Encoding.Bytes.runEither
+                                              (case Data.Text.Encoding.decodeUtf8' value of
+                                                 (Prelude.Left err)
+                                                   -> Prelude.Left (Prelude.show err)
+                                                 (Prelude.Right r) -> Prelude.Right r))
+                                        "override_documentation"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'overrideDocumentation y)
+                                loop x mutable'diagnostics mutable'enclosingRange v mutable'range
+                        40
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "syntax_kind"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"syntaxKind") y x)
+                                  mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation mutable'range
+                        50
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "diagnostics"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'diagnostics y)
+                                loop
+                                  x v mutable'enclosingRange mutable'overrideDocumentation
+                                  mutable'range
+                        56
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (Prelude.fmap
+                                           Prelude.fromIntegral
+                                           Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                        "enclosing_range"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'enclosingRange y)
+                                loop
+                                  x mutable'diagnostics v mutable'overrideDocumentation
+                                  mutable'range
+                        58
+                          -> do y <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                        Data.ProtoLens.Encoding.Bytes.isolate
+                                          (Prelude.fromIntegral len)
+                                          ((let
+                                              ploop qs
+                                                = do packedEnd <- Data.ProtoLens.Encoding.Bytes.atEnd
+                                                     if packedEnd then
+                                                         Prelude.return qs
+                                                     else
+                                                         do !q <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                                                    (Prelude.fmap
+                                                                       Prelude.fromIntegral
+                                                                       Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                                                    "enclosing_range"
+                                                            qs' <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                                     (Data.ProtoLens.Encoding.Growing.append
+                                                                        qs q)
+                                                            ploop qs'
+                                            in ploop)
+                                             mutable'enclosingRange)
+                                loop
+                                  x mutable'diagnostics y mutable'overrideDocumentation
+                                  mutable'range
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'diagnostics mutable'enclosingRange
+                                  mutable'overrideDocumentation mutable'range
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'diagnostics <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       Data.ProtoLens.Encoding.Growing.new
+              mutable'enclosingRange <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                          Data.ProtoLens.Encoding.Growing.new
+              mutable'overrideDocumentation <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                 Data.ProtoLens.Encoding.Growing.new
+              mutable'range <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                 Data.ProtoLens.Encoding.Growing.new
+              loop
+                Data.ProtoLens.defMessage mutable'diagnostics
+                mutable'enclosingRange mutable'overrideDocumentation mutable'range)
+          "Occurrence"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                p = Lens.Family2.view (Data.ProtoLens.Field.field @"vec'range") _x
+              in
+                if Data.Vector.Generic.null p then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((\ bs
+                          -> (Data.Monoid.<>)
+                               (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                  (Prelude.fromIntegral (Data.ByteString.length bs)))
+                               (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         (Data.ProtoLens.Encoding.Bytes.runBuilder
+                            (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                               ((Prelude..)
+                                  Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                               p))))
+             ((Data.Monoid.<>)
+                (let
+                   _v = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v
+                        = Lens.Family2.view (Data.ProtoLens.Field.field @"symbolRoles") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 24)
+                            ((Prelude..)
+                               Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral _v))
+                   ((Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                         (\ _v
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt 34)
+                                 ((Prelude..)
+                                    (\ bs
+                                       -> (Data.Monoid.<>)
+                                            (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                               (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                            (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                    Data.Text.Encoding.encodeUtf8 _v))
+                         (Lens.Family2.view
+                            (Data.ProtoLens.Field.field @"vec'overrideDocumentation") _x))
+                      ((Data.Monoid.<>)
+                         (let
+                            _v
+                              = Lens.Family2.view (Data.ProtoLens.Field.field @"syntaxKind") _x
+                          in
+                            if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                Data.Monoid.mempty
+                            else
+                                (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt 40)
+                                  ((Prelude..)
+                                     ((Prelude..)
+                                        Data.ProtoLens.Encoding.Bytes.putVarInt
+                                        Prelude.fromIntegral)
+                                     Prelude.fromEnum _v))
+                         ((Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                               (\ _v
+                                  -> (Data.Monoid.<>)
+                                       (Data.ProtoLens.Encoding.Bytes.putVarInt 50)
+                                       ((Prelude..)
+                                          (\ bs
+                                             -> (Data.Monoid.<>)
+                                                  (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                     (Prelude.fromIntegral
+                                                        (Data.ByteString.length bs)))
+                                                  (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                          Data.ProtoLens.encodeMessage _v))
+                               (Lens.Family2.view
+                                  (Data.ProtoLens.Field.field @"vec'diagnostics") _x))
+                            ((Data.Monoid.<>)
+                               (let
+                                  p = Lens.Family2.view
+                                        (Data.ProtoLens.Field.field @"vec'enclosingRange") _x
+                                in
+                                  if Data.Vector.Generic.null p then
+                                      Data.Monoid.mempty
+                                  else
+                                      (Data.Monoid.<>)
+                                        (Data.ProtoLens.Encoding.Bytes.putVarInt 58)
+                                        ((\ bs
+                                            -> (Data.Monoid.<>)
+                                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                    (Prelude.fromIntegral
+                                                       (Data.ByteString.length bs)))
+                                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                           (Data.ProtoLens.Encoding.Bytes.runBuilder
+                                              (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                                                 ((Prelude..)
+                                                    Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                    Prelude.fromIntegral)
+                                                 p))))
+                               (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                                  (Lens.Family2.view Data.ProtoLens.unknownFields _x))))))))
+instance Control.DeepSeq.NFData Occurrence where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Occurrence'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Occurrence'range x__)
+                (Control.DeepSeq.deepseq
+                   (_Occurrence'symbol x__)
+                   (Control.DeepSeq.deepseq
+                      (_Occurrence'symbolRoles x__)
+                      (Control.DeepSeq.deepseq
+                         (_Occurrence'overrideDocumentation x__)
+                         (Control.DeepSeq.deepseq
+                            (_Occurrence'syntaxKind x__)
+                            (Control.DeepSeq.deepseq
+                               (_Occurrence'diagnostics x__)
+                               (Control.DeepSeq.deepseq (_Occurrence'enclosingRange x__) ())))))))
+{- | Fields :
+
+         * 'Proto.Scip_Fields.manager' @:: Lens' Package Data.Text.Text@
+         * 'Proto.Scip_Fields.name' @:: Lens' Package Data.Text.Text@
+         * 'Proto.Scip_Fields.version' @:: Lens' Package Data.Text.Text@ -}
+data Package
+  = Package'_constructor {_Package'manager :: !Data.Text.Text,
+                          _Package'name :: !Data.Text.Text,
+                          _Package'version :: !Data.Text.Text,
+                          _Package'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Package where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Package "manager" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Package'manager (\ x__ y__ -> x__ {_Package'manager = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Package "name" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Package'name (\ x__ y__ -> x__ {_Package'name = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Package "version" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Package'version (\ x__ y__ -> x__ {_Package'version = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Package where
+  messageName _ = Data.Text.pack "scip.Package"
+  packedMessageDescriptor _
+    = "\n\
+      \\aPackage\DC2\CAN\n\
+      \\amanager\CAN\SOH \SOH(\tR\amanager\DC2\DC2\n\
+      \\EOTname\CAN\STX \SOH(\tR\EOTname\DC2\CAN\n\
+      \\aversion\CAN\ETX \SOH(\tR\aversion"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        manager__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "manager"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"manager")) ::
+              Data.ProtoLens.FieldDescriptor Package
+        name__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "name"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"name")) ::
+              Data.ProtoLens.FieldDescriptor Package
+        version__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "version"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"version")) ::
+              Data.ProtoLens.FieldDescriptor Package
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, manager__field_descriptor),
+           (Data.ProtoLens.Tag 2, name__field_descriptor),
+           (Data.ProtoLens.Tag 3, version__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Package'_unknownFields
+        (\ x__ y__ -> x__ {_Package'_unknownFields = y__})
+  defMessage
+    = Package'_constructor
+        {_Package'manager = Data.ProtoLens.fieldDefault,
+         _Package'name = Data.ProtoLens.fieldDefault,
+         _Package'version = Data.ProtoLens.fieldDefault,
+         _Package'_unknownFields = []}
+  parseMessage
+    = let
+        loop :: Package -> Data.ProtoLens.Encoding.Bytes.Parser Package
+        loop x
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x)
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "manager"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"manager") y x)
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "name"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"name") y x)
+                        26
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "version"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"version") y x)
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do loop Data.ProtoLens.defMessage) "Package"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"manager") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"name") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v = Lens.Family2.view (Data.ProtoLens.Field.field @"version") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                            ((Prelude..)
+                               (\ bs
+                                  -> (Data.Monoid.<>)
+                                       (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                          (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                       (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                               Data.Text.Encoding.encodeUtf8 _v))
+                   (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                      (Lens.Family2.view Data.ProtoLens.unknownFields _x))))
+instance Control.DeepSeq.NFData Package where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Package'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Package'manager x__)
+                (Control.DeepSeq.deepseq
+                   (_Package'name x__)
+                   (Control.DeepSeq.deepseq (_Package'version x__) ())))
+newtype PositionEncoding'UnrecognizedValue
+  = PositionEncoding'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data PositionEncoding
+  = UnspecifiedPositionEncoding |
+    UTF8CodeUnitOffsetFromLineStart |
+    UTF16CodeUnitOffsetFromLineStart |
+    UTF32CodeUnitOffsetFromLineStart |
+    PositionEncoding'Unrecognized !PositionEncoding'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum PositionEncoding where
+  maybeToEnum 0 = Prelude.Just UnspecifiedPositionEncoding
+  maybeToEnum 1 = Prelude.Just UTF8CodeUnitOffsetFromLineStart
+  maybeToEnum 2 = Prelude.Just UTF16CodeUnitOffsetFromLineStart
+  maybeToEnum 3 = Prelude.Just UTF32CodeUnitOffsetFromLineStart
+  maybeToEnum k
+    = Prelude.Just
+        (PositionEncoding'Unrecognized
+           (PositionEncoding'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedPositionEncoding
+    = "UnspecifiedPositionEncoding"
+  showEnum UTF8CodeUnitOffsetFromLineStart
+    = "UTF8CodeUnitOffsetFromLineStart"
+  showEnum UTF16CodeUnitOffsetFromLineStart
+    = "UTF16CodeUnitOffsetFromLineStart"
+  showEnum UTF32CodeUnitOffsetFromLineStart
+    = "UTF32CodeUnitOffsetFromLineStart"
+  showEnum
+    (PositionEncoding'Unrecognized (PositionEncoding'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedPositionEncoding"
+    = Prelude.Just UnspecifiedPositionEncoding
+    | (Prelude.==) k "UTF8CodeUnitOffsetFromLineStart"
+    = Prelude.Just UTF8CodeUnitOffsetFromLineStart
+    | (Prelude.==) k "UTF16CodeUnitOffsetFromLineStart"
+    = Prelude.Just UTF16CodeUnitOffsetFromLineStart
+    | (Prelude.==) k "UTF32CodeUnitOffsetFromLineStart"
+    = Prelude.Just UTF32CodeUnitOffsetFromLineStart
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded PositionEncoding where
+  minBound = UnspecifiedPositionEncoding
+  maxBound = UTF32CodeUnitOffsetFromLineStart
+instance Prelude.Enum PositionEncoding where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum PositionEncoding: "
+              (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedPositionEncoding = 0
+  fromEnum UTF8CodeUnitOffsetFromLineStart = 1
+  fromEnum UTF16CodeUnitOffsetFromLineStart = 2
+  fromEnum UTF32CodeUnitOffsetFromLineStart = 3
+  fromEnum
+    (PositionEncoding'Unrecognized (PositionEncoding'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ UTF32CodeUnitOffsetFromLineStart
+    = Prelude.error
+        "PositionEncoding.succ: bad argument UTF32CodeUnitOffsetFromLineStart. This value would be out of bounds."
+  succ UnspecifiedPositionEncoding = UTF8CodeUnitOffsetFromLineStart
+  succ UTF8CodeUnitOffsetFromLineStart
+    = UTF16CodeUnitOffsetFromLineStart
+  succ UTF16CodeUnitOffsetFromLineStart
+    = UTF32CodeUnitOffsetFromLineStart
+  succ (PositionEncoding'Unrecognized _)
+    = Prelude.error
+        "PositionEncoding.succ: bad argument: unrecognized value"
+  pred UnspecifiedPositionEncoding
+    = Prelude.error
+        "PositionEncoding.pred: bad argument UnspecifiedPositionEncoding. This value would be out of bounds."
+  pred UTF8CodeUnitOffsetFromLineStart = UnspecifiedPositionEncoding
+  pred UTF16CodeUnitOffsetFromLineStart
+    = UTF8CodeUnitOffsetFromLineStart
+  pred UTF32CodeUnitOffsetFromLineStart
+    = UTF16CodeUnitOffsetFromLineStart
+  pred (PositionEncoding'Unrecognized _)
+    = Prelude.error
+        "PositionEncoding.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault PositionEncoding where
+  fieldDefault = UnspecifiedPositionEncoding
+instance Control.DeepSeq.NFData PositionEncoding where
+  rnf x__ = Prelude.seq x__ ()
+newtype ProtocolVersion'UnrecognizedValue
+  = ProtocolVersion'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data ProtocolVersion
+  = UnspecifiedProtocolVersion |
+    ProtocolVersion'Unrecognized !ProtocolVersion'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum ProtocolVersion where
+  maybeToEnum 0 = Prelude.Just UnspecifiedProtocolVersion
+  maybeToEnum k
+    = Prelude.Just
+        (ProtocolVersion'Unrecognized
+           (ProtocolVersion'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedProtocolVersion = "UnspecifiedProtocolVersion"
+  showEnum
+    (ProtocolVersion'Unrecognized (ProtocolVersion'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedProtocolVersion"
+    = Prelude.Just UnspecifiedProtocolVersion
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded ProtocolVersion where
+  minBound = UnspecifiedProtocolVersion
+  maxBound = UnspecifiedProtocolVersion
+instance Prelude.Enum ProtocolVersion where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum ProtocolVersion: "
+              (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedProtocolVersion = 0
+  fromEnum
+    (ProtocolVersion'Unrecognized (ProtocolVersion'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ UnspecifiedProtocolVersion
+    = Prelude.error
+        "ProtocolVersion.succ: bad argument UnspecifiedProtocolVersion. This value would be out of bounds."
+  succ (ProtocolVersion'Unrecognized _)
+    = Prelude.error
+        "ProtocolVersion.succ: bad argument: unrecognized value"
+  pred UnspecifiedProtocolVersion
+    = Prelude.error
+        "ProtocolVersion.pred: bad argument UnspecifiedProtocolVersion. This value would be out of bounds."
+  pred (ProtocolVersion'Unrecognized _)
+    = Prelude.error
+        "ProtocolVersion.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault ProtocolVersion where
+  fieldDefault = UnspecifiedProtocolVersion
+instance Control.DeepSeq.NFData ProtocolVersion where
+  rnf x__ = Prelude.seq x__ ()
+{- | Fields :
+
+         * 'Proto.Scip_Fields.symbol' @:: Lens' Relationship Data.Text.Text@
+         * 'Proto.Scip_Fields.isReference' @:: Lens' Relationship Prelude.Bool@
+         * 'Proto.Scip_Fields.isImplementation' @:: Lens' Relationship Prelude.Bool@
+         * 'Proto.Scip_Fields.isTypeDefinition' @:: Lens' Relationship Prelude.Bool@
+         * 'Proto.Scip_Fields.isDefinition' @:: Lens' Relationship Prelude.Bool@ -}
+data Relationship
+  = Relationship'_constructor {_Relationship'symbol :: !Data.Text.Text,
+                               _Relationship'isReference :: !Prelude.Bool,
+                               _Relationship'isImplementation :: !Prelude.Bool,
+                               _Relationship'isTypeDefinition :: !Prelude.Bool,
+                               _Relationship'isDefinition :: !Prelude.Bool,
+                               _Relationship'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Relationship where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Relationship "symbol" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Relationship'symbol
+           (\ x__ y__ -> x__ {_Relationship'symbol = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Relationship "isReference" Prelude.Bool where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Relationship'isReference
+           (\ x__ y__ -> x__ {_Relationship'isReference = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Relationship "isImplementation" Prelude.Bool where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Relationship'isImplementation
+           (\ x__ y__ -> x__ {_Relationship'isImplementation = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Relationship "isTypeDefinition" Prelude.Bool where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Relationship'isTypeDefinition
+           (\ x__ y__ -> x__ {_Relationship'isTypeDefinition = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Relationship "isDefinition" Prelude.Bool where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Relationship'isDefinition
+           (\ x__ y__ -> x__ {_Relationship'isDefinition = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Relationship where
+  messageName _ = Data.Text.pack "scip.Relationship"
+  packedMessageDescriptor _
+    = "\n\
+      \\fRelationship\DC2\SYN\n\
+      \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2!\n\
+      \\fis_reference\CAN\STX \SOH(\bR\visReference\DC2+\n\
+      \\DC1is_implementation\CAN\ETX \SOH(\bR\DLEisImplementation\DC2,\n\
+      \\DC2is_type_definition\CAN\EOT \SOH(\bR\DLEisTypeDefinition\DC2#\n\
+      \\ris_definition\CAN\ENQ \SOH(\bR\fisDefinition"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        symbol__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "symbol"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"symbol")) ::
+              Data.ProtoLens.FieldDescriptor Relationship
+        isReference__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "is_reference"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.BoolField ::
+                 Data.ProtoLens.FieldTypeDescriptor Prelude.Bool)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"isReference")) ::
+              Data.ProtoLens.FieldDescriptor Relationship
+        isImplementation__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "is_implementation"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.BoolField ::
+                 Data.ProtoLens.FieldTypeDescriptor Prelude.Bool)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"isImplementation")) ::
+              Data.ProtoLens.FieldDescriptor Relationship
+        isTypeDefinition__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "is_type_definition"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.BoolField ::
+                 Data.ProtoLens.FieldTypeDescriptor Prelude.Bool)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"isTypeDefinition")) ::
+              Data.ProtoLens.FieldDescriptor Relationship
+        isDefinition__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "is_definition"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.BoolField ::
+                 Data.ProtoLens.FieldTypeDescriptor Prelude.Bool)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"isDefinition")) ::
+              Data.ProtoLens.FieldDescriptor Relationship
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, symbol__field_descriptor),
+           (Data.ProtoLens.Tag 2, isReference__field_descriptor),
+           (Data.ProtoLens.Tag 3, isImplementation__field_descriptor),
+           (Data.ProtoLens.Tag 4, isTypeDefinition__field_descriptor),
+           (Data.ProtoLens.Tag 5, isDefinition__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Relationship'_unknownFields
+        (\ x__ y__ -> x__ {_Relationship'_unknownFields = y__})
+  defMessage
+    = Relationship'_constructor
+        {_Relationship'symbol = Data.ProtoLens.fieldDefault,
+         _Relationship'isReference = Data.ProtoLens.fieldDefault,
+         _Relationship'isImplementation = Data.ProtoLens.fieldDefault,
+         _Relationship'isTypeDefinition = Data.ProtoLens.fieldDefault,
+         _Relationship'isDefinition = Data.ProtoLens.fieldDefault,
+         _Relationship'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Relationship -> Data.ProtoLens.Encoding.Bytes.Parser Relationship
+        loop x
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t) x)
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "symbol"
+                                loop (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") y x)
+                        16
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          ((Prelude./=) 0) Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                       "is_reference"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"isReference") y x)
+                        24
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          ((Prelude./=) 0) Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                       "is_implementation"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"isImplementation") y x)
+                        32
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          ((Prelude./=) 0) Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                       "is_type_definition"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"isTypeDefinition") y x)
+                        40
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          ((Prelude./=) 0) Data.ProtoLens.Encoding.Bytes.getVarInt)
+                                       "is_definition"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"isDefinition") y x)
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do loop Data.ProtoLens.defMessage) "Relationship"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (let
+                   _v
+                     = Lens.Family2.view (Data.ProtoLens.Field.field @"isReference") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 16)
+                         ((Prelude..)
+                            Data.ProtoLens.Encoding.Bytes.putVarInt (\ b -> if b then 1 else 0)
+                            _v))
+                ((Data.Monoid.<>)
+                   (let
+                      _v
+                        = Lens.Family2.view
+                            (Data.ProtoLens.Field.field @"isImplementation") _x
+                    in
+                      if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                          Data.Monoid.mempty
+                      else
+                          (Data.Monoid.<>)
+                            (Data.ProtoLens.Encoding.Bytes.putVarInt 24)
+                            ((Prelude..)
+                               Data.ProtoLens.Encoding.Bytes.putVarInt (\ b -> if b then 1 else 0)
+                               _v))
+                   ((Data.Monoid.<>)
+                      (let
+                         _v
+                           = Lens.Family2.view
+                               (Data.ProtoLens.Field.field @"isTypeDefinition") _x
+                       in
+                         if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                             Data.Monoid.mempty
+                         else
+                             (Data.Monoid.<>)
+                               (Data.ProtoLens.Encoding.Bytes.putVarInt 32)
+                               ((Prelude..)
+                                  Data.ProtoLens.Encoding.Bytes.putVarInt
+                                  (\ b -> if b then 1 else 0) _v))
+                      ((Data.Monoid.<>)
+                         (let
+                            _v
+                              = Lens.Family2.view (Data.ProtoLens.Field.field @"isDefinition") _x
+                          in
+                            if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                Data.Monoid.mempty
+                            else
+                                (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt 40)
+                                  ((Prelude..)
+                                     Data.ProtoLens.Encoding.Bytes.putVarInt
+                                     (\ b -> if b then 1 else 0) _v))
+                         (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                            (Lens.Family2.view Data.ProtoLens.unknownFields _x))))))
+instance Control.DeepSeq.NFData Relationship where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Relationship'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Relationship'symbol x__)
+                (Control.DeepSeq.deepseq
+                   (_Relationship'isReference x__)
+                   (Control.DeepSeq.deepseq
+                      (_Relationship'isImplementation x__)
+                      (Control.DeepSeq.deepseq
+                         (_Relationship'isTypeDefinition x__)
+                         (Control.DeepSeq.deepseq (_Relationship'isDefinition x__) ())))))
+newtype Severity'UnrecognizedValue
+  = Severity'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data Severity
+  = UnspecifiedSeverity |
+    Error |
+    Warning |
+    Information |
+    Hint |
+    Severity'Unrecognized !Severity'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum Severity where
+  maybeToEnum 0 = Prelude.Just UnspecifiedSeverity
+  maybeToEnum 1 = Prelude.Just Error
+  maybeToEnum 2 = Prelude.Just Warning
+  maybeToEnum 3 = Prelude.Just Information
+  maybeToEnum 4 = Prelude.Just Hint
+  maybeToEnum k
+    = Prelude.Just
+        (Severity'Unrecognized
+           (Severity'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedSeverity = "UnspecifiedSeverity"
+  showEnum Error = "Error"
+  showEnum Warning = "Warning"
+  showEnum Information = "Information"
+  showEnum Hint = "Hint"
+  showEnum (Severity'Unrecognized (Severity'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedSeverity"
+    = Prelude.Just UnspecifiedSeverity
+    | (Prelude.==) k "Error" = Prelude.Just Error
+    | (Prelude.==) k "Warning" = Prelude.Just Warning
+    | (Prelude.==) k "Information" = Prelude.Just Information
+    | (Prelude.==) k "Hint" = Prelude.Just Hint
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded Severity where
+  minBound = UnspecifiedSeverity
+  maxBound = Hint
+instance Prelude.Enum Severity where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum Severity: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedSeverity = 0
+  fromEnum Error = 1
+  fromEnum Warning = 2
+  fromEnum Information = 3
+  fromEnum Hint = 4
+  fromEnum (Severity'Unrecognized (Severity'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ Hint
+    = Prelude.error
+        "Severity.succ: bad argument Hint. This value would be out of bounds."
+  succ UnspecifiedSeverity = Error
+  succ Error = Warning
+  succ Warning = Information
+  succ Information = Hint
+  succ (Severity'Unrecognized _)
+    = Prelude.error "Severity.succ: bad argument: unrecognized value"
+  pred UnspecifiedSeverity
+    = Prelude.error
+        "Severity.pred: bad argument UnspecifiedSeverity. This value would be out of bounds."
+  pred Error = UnspecifiedSeverity
+  pred Warning = Error
+  pred Information = Warning
+  pred Hint = Information
+  pred (Severity'Unrecognized _)
+    = Prelude.error "Severity.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault Severity where
+  fieldDefault = UnspecifiedSeverity
+instance Control.DeepSeq.NFData Severity where
+  rnf x__ = Prelude.seq x__ ()
+{- | Fields :
+
+         * 'Proto.Scip_Fields.scheme' @:: Lens' Symbol Data.Text.Text@
+         * 'Proto.Scip_Fields.package' @:: Lens' Symbol Package@
+         * 'Proto.Scip_Fields.maybe'package' @:: Lens' Symbol (Prelude.Maybe Package)@
+         * 'Proto.Scip_Fields.descriptors' @:: Lens' Symbol [Descriptor]@
+         * 'Proto.Scip_Fields.vec'descriptors' @:: Lens' Symbol (Data.Vector.Vector Descriptor)@ -}
+data Symbol
+  = Symbol'_constructor {_Symbol'scheme :: !Data.Text.Text,
+                         _Symbol'package :: !(Prelude.Maybe Package),
+                         _Symbol'descriptors :: !(Data.Vector.Vector Descriptor),
+                         _Symbol'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show Symbol where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField Symbol "scheme" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Symbol'scheme (\ x__ y__ -> x__ {_Symbol'scheme = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Symbol "package" Package where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Symbol'package (\ x__ y__ -> x__ {_Symbol'package = y__}))
+        (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)
+instance Data.ProtoLens.Field.HasField Symbol "maybe'package" (Prelude.Maybe Package) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Symbol'package (\ x__ y__ -> x__ {_Symbol'package = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField Symbol "descriptors" [Descriptor] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Symbol'descriptors (\ x__ y__ -> x__ {_Symbol'descriptors = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField Symbol "vec'descriptors" (Data.Vector.Vector Descriptor) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _Symbol'descriptors (\ x__ y__ -> x__ {_Symbol'descriptors = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message Symbol where
+  messageName _ = Data.Text.pack "scip.Symbol"
+  packedMessageDescriptor _
+    = "\n\
+      \\ACKSymbol\DC2\SYN\n\
+      \\ACKscheme\CAN\SOH \SOH(\tR\ACKscheme\DC2'\n\
+      \\apackage\CAN\STX \SOH(\v2\r.scip.PackageR\apackage\DC22\n\
+      \\vdescriptors\CAN\ETX \ETX(\v2\DLE.scip.DescriptorR\vdescriptors"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        scheme__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "scheme"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"scheme")) ::
+              Data.ProtoLens.FieldDescriptor Symbol
+        package__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "package"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Package)
+              (Data.ProtoLens.OptionalField
+                 (Data.ProtoLens.Field.field @"maybe'package")) ::
+              Data.ProtoLens.FieldDescriptor Symbol
+        descriptors__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "descriptors"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Descriptor)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"descriptors")) ::
+              Data.ProtoLens.FieldDescriptor Symbol
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, scheme__field_descriptor),
+           (Data.ProtoLens.Tag 2, package__field_descriptor),
+           (Data.ProtoLens.Tag 3, descriptors__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _Symbol'_unknownFields
+        (\ x__ y__ -> x__ {_Symbol'_unknownFields = y__})
+  defMessage
+    = Symbol'_constructor
+        {_Symbol'scheme = Data.ProtoLens.fieldDefault,
+         _Symbol'package = Prelude.Nothing,
+         _Symbol'descriptors = Data.Vector.Generic.empty,
+         _Symbol'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          Symbol
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Descriptor
+             -> Data.ProtoLens.Encoding.Bytes.Parser Symbol
+        loop x mutable'descriptors
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'descriptors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                              (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                 mutable'descriptors)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'descriptors") frozen'descriptors
+                              x))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "scheme"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"scheme") y x)
+                                  mutable'descriptors
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                           Data.ProtoLens.Encoding.Bytes.isolate
+                                             (Prelude.fromIntegral len) Data.ProtoLens.parseMessage)
+                                       "package"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"package") y x)
+                                  mutable'descriptors
+                        26
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "descriptors"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'descriptors y)
+                                loop x v
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'descriptors
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'descriptors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       Data.ProtoLens.Encoding.Growing.new
+              loop Data.ProtoLens.defMessage mutable'descriptors)
+          "Symbol"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"scheme") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (case
+                     Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'package") _x
+                 of
+                   Prelude.Nothing -> Data.Monoid.mempty
+                   (Prelude.Just _v)
+                     -> (Data.Monoid.<>)
+                          (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                          ((Prelude..)
+                             (\ bs
+                                -> (Data.Monoid.<>)
+                                     (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                        (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                     (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                             Data.ProtoLens.encodeMessage _v))
+                ((Data.Monoid.<>)
+                   (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                      (\ _v
+                         -> (Data.Monoid.<>)
+                              (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                              ((Prelude..)
+                                 (\ bs
+                                    -> (Data.Monoid.<>)
+                                         (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                            (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                         (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                 Data.ProtoLens.encodeMessage _v))
+                      (Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"vec'descriptors") _x))
+                   (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                      (Lens.Family2.view Data.ProtoLens.unknownFields _x))))
+instance Control.DeepSeq.NFData Symbol where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_Symbol'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_Symbol'scheme x__)
+                (Control.DeepSeq.deepseq
+                   (_Symbol'package x__)
+                   (Control.DeepSeq.deepseq (_Symbol'descriptors x__) ())))
+{- | Fields :
+
+         * 'Proto.Scip_Fields.symbol' @:: Lens' SymbolInformation Data.Text.Text@
+         * 'Proto.Scip_Fields.documentation' @:: Lens' SymbolInformation [Data.Text.Text]@
+         * 'Proto.Scip_Fields.vec'documentation' @:: Lens' SymbolInformation (Data.Vector.Vector Data.Text.Text)@
+         * 'Proto.Scip_Fields.relationships' @:: Lens' SymbolInformation [Relationship]@
+         * 'Proto.Scip_Fields.vec'relationships' @:: Lens' SymbolInformation (Data.Vector.Vector Relationship)@
+         * 'Proto.Scip_Fields.kind' @:: Lens' SymbolInformation SymbolInformation'Kind@
+         * 'Proto.Scip_Fields.displayName' @:: Lens' SymbolInformation Data.Text.Text@
+         * 'Proto.Scip_Fields.signatureDocumentation' @:: Lens' SymbolInformation Document@
+         * 'Proto.Scip_Fields.maybe'signatureDocumentation' @:: Lens' SymbolInformation (Prelude.Maybe Document)@
+         * 'Proto.Scip_Fields.enclosingSymbol' @:: Lens' SymbolInformation Data.Text.Text@ -}
+data SymbolInformation
+  = SymbolInformation'_constructor {_SymbolInformation'symbol :: !Data.Text.Text,
+                                    _SymbolInformation'documentation :: !(Data.Vector.Vector Data.Text.Text),
+                                    _SymbolInformation'relationships :: !(Data.Vector.Vector Relationship),
+                                    _SymbolInformation'kind :: !SymbolInformation'Kind,
+                                    _SymbolInformation'displayName :: !Data.Text.Text,
+                                    _SymbolInformation'signatureDocumentation :: !(Prelude.Maybe Document),
+                                    _SymbolInformation'enclosingSymbol :: !Data.Text.Text,
+                                    _SymbolInformation'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show SymbolInformation where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField SymbolInformation "symbol" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'symbol
+           (\ x__ y__ -> x__ {_SymbolInformation'symbol = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "documentation" [Data.Text.Text] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'documentation
+           (\ x__ y__ -> x__ {_SymbolInformation'documentation = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField SymbolInformation "vec'documentation" (Data.Vector.Vector Data.Text.Text) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'documentation
+           (\ x__ y__ -> x__ {_SymbolInformation'documentation = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "relationships" [Relationship] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'relationships
+           (\ x__ y__ -> x__ {_SymbolInformation'relationships = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField SymbolInformation "vec'relationships" (Data.Vector.Vector Relationship) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'relationships
+           (\ x__ y__ -> x__ {_SymbolInformation'relationships = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "kind" SymbolInformation'Kind where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'kind
+           (\ x__ y__ -> x__ {_SymbolInformation'kind = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "displayName" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'displayName
+           (\ x__ y__ -> x__ {_SymbolInformation'displayName = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "signatureDocumentation" Document where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'signatureDocumentation
+           (\ x__ y__
+              -> x__ {_SymbolInformation'signatureDocumentation = y__}))
+        (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)
+instance Data.ProtoLens.Field.HasField SymbolInformation "maybe'signatureDocumentation" (Prelude.Maybe Document) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'signatureDocumentation
+           (\ x__ y__
+              -> x__ {_SymbolInformation'signatureDocumentation = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField SymbolInformation "enclosingSymbol" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _SymbolInformation'enclosingSymbol
+           (\ x__ y__ -> x__ {_SymbolInformation'enclosingSymbol = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message SymbolInformation where
+  messageName _ = Data.Text.pack "scip.SymbolInformation"
+  packedMessageDescriptor _
+    = "\n\
+      \\DC1SymbolInformation\DC2\SYN\n\
+      \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2$\n\
+      \\rdocumentation\CAN\ETX \ETX(\tR\rdocumentation\DC28\n\
+      \\rrelationships\CAN\EOT \ETX(\v2\DC2.scip.RelationshipR\rrelationships\DC20\n\
+      \\EOTkind\CAN\ENQ \SOH(\SO2\FS.scip.SymbolInformation.KindR\EOTkind\DC2!\n\
+      \\fdisplay_name\CAN\ACK \SOH(\tR\vdisplayName\DC2G\n\
+      \\ETBsignature_documentation\CAN\a \SOH(\v2\SO.scip.DocumentR\SYNsignatureDocumentation\DC2)\n\
+      \\DLEenclosing_symbol\CAN\b \SOH(\tR\SIenclosingSymbol\"\251\t\n\
+      \\EOTKind\DC2\DC3\n\
+      \\SIUnspecifiedKind\DLE\NUL\DC2\DC2\n\
+      \\SOAbstractMethod\DLEB\DC2\f\n\
+      \\bAccessor\DLEH\DC2\t\n\
+      \\ENQArray\DLE\SOH\DC2\r\n\
+      \\tAssertion\DLE\STX\DC2\DC2\n\
+      \\SOAssociatedType\DLE\ETX\DC2\r\n\
+      \\tAttribute\DLE\EOT\DC2\t\n\
+      \\ENQAxiom\DLE\ENQ\DC2\v\n\
+      \\aBoolean\DLE\ACK\DC2\t\n\
+      \\ENQClass\DLE\a\DC2\v\n\
+      \\aConcept\DLEV\DC2\f\n\
+      \\bConstant\DLE\b\DC2\SI\n\
+      \\vConstructor\DLE\t\DC2\f\n\
+      \\bContract\DLE>\DC2\SO\n\
+      \\n\
+      \DataFamily\DLE\n\
+      \\DC2\f\n\
+      \\bDelegate\DLEI\DC2\b\n\
+      \\EOTEnum\DLE\v\DC2\SO\n\
+      \\n\
+      \EnumMember\DLE\f\DC2\t\n\
+      \\ENQError\DLE?\DC2\t\n\
+      \\ENQEvent\DLE\r\DC2\r\n\
+      \\tExtension\DLET\DC2\b\n\
+      \\EOTFact\DLE\SO\DC2\t\n\
+      \\ENQField\DLE\SI\DC2\b\n\
+      \\EOTFile\DLE\DLE\DC2\f\n\
+      \\bFunction\DLE\DC1\DC2\n\
+      \\n\
+      \\ACKGetter\DLE\DC2\DC2\v\n\
+      \\aGrammar\DLE\DC3\DC2\f\n\
+      \\bInstance\DLE\DC4\DC2\r\n\
+      \\tInterface\DLE\NAK\DC2\a\n\
+      \\ETXKey\DLE\SYN\DC2\b\n\
+      \\EOTLang\DLE\ETB\DC2\t\n\
+      \\ENQLemma\DLE\CAN\DC2\v\n\
+      \\aLibrary\DLE@\DC2\t\n\
+      \\ENQMacro\DLE\EM\DC2\n\
+      \\n\
+      \\ACKMethod\DLE\SUB\DC2\SI\n\
+      \\vMethodAlias\DLEJ\DC2\DC2\n\
+      \\SOMethodReceiver\DLE\ESC\DC2\ETB\n\
+      \\DC3MethodSpecification\DLEC\DC2\v\n\
+      \\aMessage\DLE\FS\DC2\t\n\
+      \\ENQMixin\DLEU\DC2\f\n\
+      \\bModifier\DLEA\DC2\n\
+      \\n\
+      \\ACKModule\DLE\GS\DC2\r\n\
+      \\tNamespace\DLE\RS\DC2\b\n\
+      \\EOTNull\DLE\US\DC2\n\
+      \\n\
+      \\ACKNumber\DLE \DC2\n\
+      \\n\
+      \\ACKObject\DLE!\DC2\f\n\
+      \\bOperator\DLE\"\DC2\v\n\
+      \\aPackage\DLE#\DC2\DC1\n\
+      \\rPackageObject\DLE$\DC2\r\n\
+      \\tParameter\DLE%\DC2\DC2\n\
+      \\SOParameterLabel\DLE&\DC2\v\n\
+      \\aPattern\DLE'\DC2\r\n\
+      \\tPredicate\DLE(\DC2\f\n\
+      \\bProperty\DLE)\DC2\f\n\
+      \\bProtocol\DLE*\DC2\DC2\n\
+      \\SOProtocolMethod\DLED\DC2\NAK\n\
+      \\DC1PureVirtualMethod\DLEE\DC2\SI\n\
+      \\vQuasiquoter\DLE+\DC2\DC1\n\
+      \\rSelfParameter\DLE,\DC2\n\
+      \\n\
+      \\ACKSetter\DLE-\DC2\r\n\
+      \\tSignature\DLE.\DC2\DC2\n\
+      \\SOSingletonClass\DLEK\DC2\DC3\n\
+      \\SISingletonMethod\DLEL\DC2\DC4\n\
+      \\DLEStaticDataMember\DLEM\DC2\SI\n\
+      \\vStaticEvent\DLEN\DC2\SI\n\
+      \\vStaticField\DLEO\DC2\DLE\n\
+      \\fStaticMethod\DLEP\DC2\DC2\n\
+      \\SOStaticProperty\DLEQ\DC2\DC2\n\
+      \\SOStaticVariable\DLER\DC2\n\
+      \\n\
+      \\ACKString\DLE0\DC2\n\
+      \\n\
+      \\ACKStruct\DLE1\DC2\r\n\
+      \\tSubscript\DLE/\DC2\n\
+      \\n\
+      \\ACKTactic\DLE2\DC2\v\n\
+      \\aTheorem\DLE3\DC2\DC1\n\
+      \\rThisParameter\DLE4\DC2\t\n\
+      \\ENQTrait\DLE5\DC2\SI\n\
+      \\vTraitMethod\DLEF\DC2\b\n\
+      \\EOTType\DLE6\DC2\r\n\
+      \\tTypeAlias\DLE7\DC2\r\n\
+      \\tTypeClass\DLE8\DC2\DC3\n\
+      \\SITypeClassMethod\DLEG\DC2\SO\n\
+      \\n\
+      \TypeFamily\DLE9\DC2\DC1\n\
+      \\rTypeParameter\DLE:\DC2\t\n\
+      \\ENQUnion\DLE;\DC2\t\n\
+      \\ENQValue\DLE<\DC2\f\n\
+      \\bVariable\DLE="
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        symbol__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "symbol"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"symbol")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        documentation__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "documentation"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"documentation")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        relationships__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "relationships"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Relationship)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"relationships")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        kind__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "kind"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField ::
+                 Data.ProtoLens.FieldTypeDescriptor SymbolInformation'Kind)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"kind")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        displayName__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "display_name"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"displayName")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        signatureDocumentation__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "signature_documentation"
+              (Data.ProtoLens.MessageField Data.ProtoLens.MessageType ::
+                 Data.ProtoLens.FieldTypeDescriptor Document)
+              (Data.ProtoLens.OptionalField
+                 (Data.ProtoLens.Field.field @"maybe'signatureDocumentation")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+        enclosingSymbol__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "enclosing_symbol"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional
+                 (Data.ProtoLens.Field.field @"enclosingSymbol")) ::
+              Data.ProtoLens.FieldDescriptor SymbolInformation
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, symbol__field_descriptor),
+           (Data.ProtoLens.Tag 3, documentation__field_descriptor),
+           (Data.ProtoLens.Tag 4, relationships__field_descriptor),
+           (Data.ProtoLens.Tag 5, kind__field_descriptor),
+           (Data.ProtoLens.Tag 6, displayName__field_descriptor),
+           (Data.ProtoLens.Tag 7, signatureDocumentation__field_descriptor),
+           (Data.ProtoLens.Tag 8, enclosingSymbol__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _SymbolInformation'_unknownFields
+        (\ x__ y__ -> x__ {_SymbolInformation'_unknownFields = y__})
+  defMessage
+    = SymbolInformation'_constructor
+        {_SymbolInformation'symbol = Data.ProtoLens.fieldDefault,
+         _SymbolInformation'documentation = Data.Vector.Generic.empty,
+         _SymbolInformation'relationships = Data.Vector.Generic.empty,
+         _SymbolInformation'kind = Data.ProtoLens.fieldDefault,
+         _SymbolInformation'displayName = Data.ProtoLens.fieldDefault,
+         _SymbolInformation'signatureDocumentation = Prelude.Nothing,
+         _SymbolInformation'enclosingSymbol = Data.ProtoLens.fieldDefault,
+         _SymbolInformation'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          SymbolInformation
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Text.Text
+             -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Relationship
+                -> Data.ProtoLens.Encoding.Bytes.Parser SymbolInformation
+        loop x mutable'documentation mutable'relationships
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'documentation <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                   mutable'documentation)
+                      frozen'relationships <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                                (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                                   mutable'relationships)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'documentation")
+                              frozen'documentation
+                              (Lens.Family2.set
+                                 (Data.ProtoLens.Field.field @"vec'relationships")
+                                 frozen'relationships x)))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "symbol"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") y x)
+                                  mutable'documentation mutable'relationships
+                        26
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                        Data.ProtoLens.Encoding.Bytes.getBytes
+                                                          (Prelude.fromIntegral len)
+                                            Data.ProtoLens.Encoding.Bytes.runEither
+                                              (case Data.Text.Encoding.decodeUtf8' value of
+                                                 (Prelude.Left err)
+                                                   -> Prelude.Left (Prelude.show err)
+                                                 (Prelude.Right r) -> Prelude.Right r))
+                                        "documentation"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'documentation y)
+                                loop x v mutable'relationships
+                        34
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                            Data.ProtoLens.Encoding.Bytes.isolate
+                                              (Prelude.fromIntegral len)
+                                              Data.ProtoLens.parseMessage)
+                                        "relationships"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append
+                                          mutable'relationships y)
+                                loop x mutable'documentation v
+                        40
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (Prelude.fmap
+                                          Prelude.toEnum
+                                          (Prelude.fmap
+                                             Prelude.fromIntegral
+                                             Data.ProtoLens.Encoding.Bytes.getVarInt))
+                                       "kind"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"kind") y x)
+                                  mutable'documentation mutable'relationships
+                        50
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "display_name"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"displayName") y x)
+                                  mutable'documentation mutable'relationships
+                        58
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                           Data.ProtoLens.Encoding.Bytes.isolate
+                                             (Prelude.fromIntegral len) Data.ProtoLens.parseMessage)
+                                       "signature_documentation"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"signatureDocumentation") y x)
+                                  mutable'documentation mutable'relationships
+                        66
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "enclosing_symbol"
+                                loop
+                                  (Lens.Family2.set
+                                     (Data.ProtoLens.Field.field @"enclosingSymbol") y x)
+                                  mutable'documentation mutable'relationships
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'documentation mutable'relationships
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'documentation <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                         Data.ProtoLens.Encoding.Growing.new
+              mutable'relationships <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                         Data.ProtoLens.Encoding.Growing.new
+              loop
+                Data.ProtoLens.defMessage mutable'documentation
+                mutable'relationships)
+          "SymbolInformation"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let
+                _v = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                   (\ _v
+                      -> (Data.Monoid.<>)
+                           (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                           ((Prelude..)
+                              (\ bs
+                                 -> (Data.Monoid.<>)
+                                      (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                         (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                      (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                              Data.Text.Encoding.encodeUtf8 _v))
+                   (Lens.Family2.view
+                      (Data.ProtoLens.Field.field @"vec'documentation") _x))
+                ((Data.Monoid.<>)
+                   (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                      (\ _v
+                         -> (Data.Monoid.<>)
+                              (Data.ProtoLens.Encoding.Bytes.putVarInt 34)
+                              ((Prelude..)
+                                 (\ bs
+                                    -> (Data.Monoid.<>)
+                                         (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                            (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                         (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                 Data.ProtoLens.encodeMessage _v))
+                      (Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"vec'relationships") _x))
+                   ((Data.Monoid.<>)
+                      (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"kind") _x
+                       in
+                         if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                             Data.Monoid.mempty
+                         else
+                             (Data.Monoid.<>)
+                               (Data.ProtoLens.Encoding.Bytes.putVarInt 40)
+                               ((Prelude..)
+                                  ((Prelude..)
+                                     Data.ProtoLens.Encoding.Bytes.putVarInt Prelude.fromIntegral)
+                                  Prelude.fromEnum _v))
+                      ((Data.Monoid.<>)
+                         (let
+                            _v
+                              = Lens.Family2.view (Data.ProtoLens.Field.field @"displayName") _x
+                          in
+                            if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                Data.Monoid.mempty
+                            else
+                                (Data.Monoid.<>)
+                                  (Data.ProtoLens.Encoding.Bytes.putVarInt 50)
+                                  ((Prelude..)
+                                     (\ bs
+                                        -> (Data.Monoid.<>)
+                                             (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                             (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                     Data.Text.Encoding.encodeUtf8 _v))
+                         ((Data.Monoid.<>)
+                            (case
+                                 Lens.Family2.view
+                                   (Data.ProtoLens.Field.field @"maybe'signatureDocumentation") _x
+                             of
+                               Prelude.Nothing -> Data.Monoid.mempty
+                               (Prelude.Just _v)
+                                 -> (Data.Monoid.<>)
+                                      (Data.ProtoLens.Encoding.Bytes.putVarInt 58)
+                                      ((Prelude..)
+                                         (\ bs
+                                            -> (Data.Monoid.<>)
+                                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                    (Prelude.fromIntegral
+                                                       (Data.ByteString.length bs)))
+                                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                         Data.ProtoLens.encodeMessage _v))
+                            ((Data.Monoid.<>)
+                               (let
+                                  _v
+                                    = Lens.Family2.view
+                                        (Data.ProtoLens.Field.field @"enclosingSymbol") _x
+                                in
+                                  if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                                      Data.Monoid.mempty
+                                  else
+                                      (Data.Monoid.<>)
+                                        (Data.ProtoLens.Encoding.Bytes.putVarInt 66)
+                                        ((Prelude..)
+                                           (\ bs
+                                              -> (Data.Monoid.<>)
+                                                   (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                                      (Prelude.fromIntegral
+                                                         (Data.ByteString.length bs)))
+                                                   (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                           Data.Text.Encoding.encodeUtf8 _v))
+                               (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                                  (Lens.Family2.view Data.ProtoLens.unknownFields _x))))))))
+instance Control.DeepSeq.NFData SymbolInformation where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_SymbolInformation'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_SymbolInformation'symbol x__)
+                (Control.DeepSeq.deepseq
+                   (_SymbolInformation'documentation x__)
+                   (Control.DeepSeq.deepseq
+                      (_SymbolInformation'relationships x__)
+                      (Control.DeepSeq.deepseq
+                         (_SymbolInformation'kind x__)
+                         (Control.DeepSeq.deepseq
+                            (_SymbolInformation'displayName x__)
+                            (Control.DeepSeq.deepseq
+                               (_SymbolInformation'signatureDocumentation x__)
+                               (Control.DeepSeq.deepseq
+                                  (_SymbolInformation'enclosingSymbol x__) ())))))))
+newtype SymbolInformation'Kind'UnrecognizedValue
+  = SymbolInformation'Kind'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data SymbolInformation'Kind
+  = SymbolInformation'UnspecifiedKind |
+    SymbolInformation'Array |
+    SymbolInformation'Assertion |
+    SymbolInformation'AssociatedType |
+    SymbolInformation'Attribute |
+    SymbolInformation'Axiom |
+    SymbolInformation'Boolean |
+    SymbolInformation'Class |
+    SymbolInformation'Constant |
+    SymbolInformation'Constructor |
+    SymbolInformation'DataFamily |
+    SymbolInformation'Enum |
+    SymbolInformation'EnumMember |
+    SymbolInformation'Event |
+    SymbolInformation'Fact |
+    SymbolInformation'Field |
+    SymbolInformation'File |
+    SymbolInformation'Function |
+    SymbolInformation'Getter |
+    SymbolInformation'Grammar |
+    SymbolInformation'Instance |
+    SymbolInformation'Interface |
+    SymbolInformation'Key |
+    SymbolInformation'Lang |
+    SymbolInformation'Lemma |
+    SymbolInformation'Macro |
+    SymbolInformation'Method |
+    SymbolInformation'MethodReceiver |
+    SymbolInformation'Message |
+    SymbolInformation'Module |
+    SymbolInformation'Namespace |
+    SymbolInformation'Null |
+    SymbolInformation'Number |
+    SymbolInformation'Object |
+    SymbolInformation'Operator |
+    SymbolInformation'Package |
+    SymbolInformation'PackageObject |
+    SymbolInformation'Parameter |
+    SymbolInformation'ParameterLabel |
+    SymbolInformation'Pattern |
+    SymbolInformation'Predicate |
+    SymbolInformation'Property |
+    SymbolInformation'Protocol |
+    SymbolInformation'Quasiquoter |
+    SymbolInformation'SelfParameter |
+    SymbolInformation'Setter |
+    SymbolInformation'Signature |
+    SymbolInformation'Subscript |
+    SymbolInformation'String |
+    SymbolInformation'Struct |
+    SymbolInformation'Tactic |
+    SymbolInformation'Theorem |
+    SymbolInformation'ThisParameter |
+    SymbolInformation'Trait |
+    SymbolInformation'Type |
+    SymbolInformation'TypeAlias |
+    SymbolInformation'TypeClass |
+    SymbolInformation'TypeFamily |
+    SymbolInformation'TypeParameter |
+    SymbolInformation'Union |
+    SymbolInformation'Value |
+    SymbolInformation'Variable |
+    SymbolInformation'Contract |
+    SymbolInformation'Error |
+    SymbolInformation'Library |
+    SymbolInformation'Modifier |
+    SymbolInformation'AbstractMethod |
+    SymbolInformation'MethodSpecification |
+    SymbolInformation'ProtocolMethod |
+    SymbolInformation'PureVirtualMethod |
+    SymbolInformation'TraitMethod |
+    SymbolInformation'TypeClassMethod |
+    SymbolInformation'Accessor |
+    SymbolInformation'Delegate |
+    SymbolInformation'MethodAlias |
+    SymbolInformation'SingletonClass |
+    SymbolInformation'SingletonMethod |
+    SymbolInformation'StaticDataMember |
+    SymbolInformation'StaticEvent |
+    SymbolInformation'StaticField |
+    SymbolInformation'StaticMethod |
+    SymbolInformation'StaticProperty |
+    SymbolInformation'StaticVariable |
+    SymbolInformation'Extension |
+    SymbolInformation'Mixin |
+    SymbolInformation'Concept |
+    SymbolInformation'Kind'Unrecognized !SymbolInformation'Kind'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum SymbolInformation'Kind where
+  maybeToEnum 0 = Prelude.Just SymbolInformation'UnspecifiedKind
+  maybeToEnum 1 = Prelude.Just SymbolInformation'Array
+  maybeToEnum 2 = Prelude.Just SymbolInformation'Assertion
+  maybeToEnum 3 = Prelude.Just SymbolInformation'AssociatedType
+  maybeToEnum 4 = Prelude.Just SymbolInformation'Attribute
+  maybeToEnum 5 = Prelude.Just SymbolInformation'Axiom
+  maybeToEnum 6 = Prelude.Just SymbolInformation'Boolean
+  maybeToEnum 7 = Prelude.Just SymbolInformation'Class
+  maybeToEnum 8 = Prelude.Just SymbolInformation'Constant
+  maybeToEnum 9 = Prelude.Just SymbolInformation'Constructor
+  maybeToEnum 10 = Prelude.Just SymbolInformation'DataFamily
+  maybeToEnum 11 = Prelude.Just SymbolInformation'Enum
+  maybeToEnum 12 = Prelude.Just SymbolInformation'EnumMember
+  maybeToEnum 13 = Prelude.Just SymbolInformation'Event
+  maybeToEnum 14 = Prelude.Just SymbolInformation'Fact
+  maybeToEnum 15 = Prelude.Just SymbolInformation'Field
+  maybeToEnum 16 = Prelude.Just SymbolInformation'File
+  maybeToEnum 17 = Prelude.Just SymbolInformation'Function
+  maybeToEnum 18 = Prelude.Just SymbolInformation'Getter
+  maybeToEnum 19 = Prelude.Just SymbolInformation'Grammar
+  maybeToEnum 20 = Prelude.Just SymbolInformation'Instance
+  maybeToEnum 21 = Prelude.Just SymbolInformation'Interface
+  maybeToEnum 22 = Prelude.Just SymbolInformation'Key
+  maybeToEnum 23 = Prelude.Just SymbolInformation'Lang
+  maybeToEnum 24 = Prelude.Just SymbolInformation'Lemma
+  maybeToEnum 25 = Prelude.Just SymbolInformation'Macro
+  maybeToEnum 26 = Prelude.Just SymbolInformation'Method
+  maybeToEnum 27 = Prelude.Just SymbolInformation'MethodReceiver
+  maybeToEnum 28 = Prelude.Just SymbolInformation'Message
+  maybeToEnum 29 = Prelude.Just SymbolInformation'Module
+  maybeToEnum 30 = Prelude.Just SymbolInformation'Namespace
+  maybeToEnum 31 = Prelude.Just SymbolInformation'Null
+  maybeToEnum 32 = Prelude.Just SymbolInformation'Number
+  maybeToEnum 33 = Prelude.Just SymbolInformation'Object
+  maybeToEnum 34 = Prelude.Just SymbolInformation'Operator
+  maybeToEnum 35 = Prelude.Just SymbolInformation'Package
+  maybeToEnum 36 = Prelude.Just SymbolInformation'PackageObject
+  maybeToEnum 37 = Prelude.Just SymbolInformation'Parameter
+  maybeToEnum 38 = Prelude.Just SymbolInformation'ParameterLabel
+  maybeToEnum 39 = Prelude.Just SymbolInformation'Pattern
+  maybeToEnum 40 = Prelude.Just SymbolInformation'Predicate
+  maybeToEnum 41 = Prelude.Just SymbolInformation'Property
+  maybeToEnum 42 = Prelude.Just SymbolInformation'Protocol
+  maybeToEnum 43 = Prelude.Just SymbolInformation'Quasiquoter
+  maybeToEnum 44 = Prelude.Just SymbolInformation'SelfParameter
+  maybeToEnum 45 = Prelude.Just SymbolInformation'Setter
+  maybeToEnum 46 = Prelude.Just SymbolInformation'Signature
+  maybeToEnum 47 = Prelude.Just SymbolInformation'Subscript
+  maybeToEnum 48 = Prelude.Just SymbolInformation'String
+  maybeToEnum 49 = Prelude.Just SymbolInformation'Struct
+  maybeToEnum 50 = Prelude.Just SymbolInformation'Tactic
+  maybeToEnum 51 = Prelude.Just SymbolInformation'Theorem
+  maybeToEnum 52 = Prelude.Just SymbolInformation'ThisParameter
+  maybeToEnum 53 = Prelude.Just SymbolInformation'Trait
+  maybeToEnum 54 = Prelude.Just SymbolInformation'Type
+  maybeToEnum 55 = Prelude.Just SymbolInformation'TypeAlias
+  maybeToEnum 56 = Prelude.Just SymbolInformation'TypeClass
+  maybeToEnum 57 = Prelude.Just SymbolInformation'TypeFamily
+  maybeToEnum 58 = Prelude.Just SymbolInformation'TypeParameter
+  maybeToEnum 59 = Prelude.Just SymbolInformation'Union
+  maybeToEnum 60 = Prelude.Just SymbolInformation'Value
+  maybeToEnum 61 = Prelude.Just SymbolInformation'Variable
+  maybeToEnum 62 = Prelude.Just SymbolInformation'Contract
+  maybeToEnum 63 = Prelude.Just SymbolInformation'Error
+  maybeToEnum 64 = Prelude.Just SymbolInformation'Library
+  maybeToEnum 65 = Prelude.Just SymbolInformation'Modifier
+  maybeToEnum 66 = Prelude.Just SymbolInformation'AbstractMethod
+  maybeToEnum 67 = Prelude.Just SymbolInformation'MethodSpecification
+  maybeToEnum 68 = Prelude.Just SymbolInformation'ProtocolMethod
+  maybeToEnum 69 = Prelude.Just SymbolInformation'PureVirtualMethod
+  maybeToEnum 70 = Prelude.Just SymbolInformation'TraitMethod
+  maybeToEnum 71 = Prelude.Just SymbolInformation'TypeClassMethod
+  maybeToEnum 72 = Prelude.Just SymbolInformation'Accessor
+  maybeToEnum 73 = Prelude.Just SymbolInformation'Delegate
+  maybeToEnum 74 = Prelude.Just SymbolInformation'MethodAlias
+  maybeToEnum 75 = Prelude.Just SymbolInformation'SingletonClass
+  maybeToEnum 76 = Prelude.Just SymbolInformation'SingletonMethod
+  maybeToEnum 77 = Prelude.Just SymbolInformation'StaticDataMember
+  maybeToEnum 78 = Prelude.Just SymbolInformation'StaticEvent
+  maybeToEnum 79 = Prelude.Just SymbolInformation'StaticField
+  maybeToEnum 80 = Prelude.Just SymbolInformation'StaticMethod
+  maybeToEnum 81 = Prelude.Just SymbolInformation'StaticProperty
+  maybeToEnum 82 = Prelude.Just SymbolInformation'StaticVariable
+  maybeToEnum 84 = Prelude.Just SymbolInformation'Extension
+  maybeToEnum 85 = Prelude.Just SymbolInformation'Mixin
+  maybeToEnum 86 = Prelude.Just SymbolInformation'Concept
+  maybeToEnum k
+    = Prelude.Just
+        (SymbolInformation'Kind'Unrecognized
+           (SymbolInformation'Kind'UnrecognizedValue
+              (Prelude.fromIntegral k)))
+  showEnum SymbolInformation'UnspecifiedKind = "UnspecifiedKind"
+  showEnum SymbolInformation'AbstractMethod = "AbstractMethod"
+  showEnum SymbolInformation'Accessor = "Accessor"
+  showEnum SymbolInformation'Array = "Array"
+  showEnum SymbolInformation'Assertion = "Assertion"
+  showEnum SymbolInformation'AssociatedType = "AssociatedType"
+  showEnum SymbolInformation'Attribute = "Attribute"
+  showEnum SymbolInformation'Axiom = "Axiom"
+  showEnum SymbolInformation'Boolean = "Boolean"
+  showEnum SymbolInformation'Class = "Class"
+  showEnum SymbolInformation'Concept = "Concept"
+  showEnum SymbolInformation'Constant = "Constant"
+  showEnum SymbolInformation'Constructor = "Constructor"
+  showEnum SymbolInformation'Contract = "Contract"
+  showEnum SymbolInformation'DataFamily = "DataFamily"
+  showEnum SymbolInformation'Delegate = "Delegate"
+  showEnum SymbolInformation'Enum = "Enum"
+  showEnum SymbolInformation'EnumMember = "EnumMember"
+  showEnum SymbolInformation'Error = "Error"
+  showEnum SymbolInformation'Event = "Event"
+  showEnum SymbolInformation'Extension = "Extension"
+  showEnum SymbolInformation'Fact = "Fact"
+  showEnum SymbolInformation'Field = "Field"
+  showEnum SymbolInformation'File = "File"
+  showEnum SymbolInformation'Function = "Function"
+  showEnum SymbolInformation'Getter = "Getter"
+  showEnum SymbolInformation'Grammar = "Grammar"
+  showEnum SymbolInformation'Instance = "Instance"
+  showEnum SymbolInformation'Interface = "Interface"
+  showEnum SymbolInformation'Key = "Key"
+  showEnum SymbolInformation'Lang = "Lang"
+  showEnum SymbolInformation'Lemma = "Lemma"
+  showEnum SymbolInformation'Library = "Library"
+  showEnum SymbolInformation'Macro = "Macro"
+  showEnum SymbolInformation'Method = "Method"
+  showEnum SymbolInformation'MethodAlias = "MethodAlias"
+  showEnum SymbolInformation'MethodReceiver = "MethodReceiver"
+  showEnum SymbolInformation'MethodSpecification
+    = "MethodSpecification"
+  showEnum SymbolInformation'Message = "Message"
+  showEnum SymbolInformation'Mixin = "Mixin"
+  showEnum SymbolInformation'Modifier = "Modifier"
+  showEnum SymbolInformation'Module = "Module"
+  showEnum SymbolInformation'Namespace = "Namespace"
+  showEnum SymbolInformation'Null = "Null"
+  showEnum SymbolInformation'Number = "Number"
+  showEnum SymbolInformation'Object = "Object"
+  showEnum SymbolInformation'Operator = "Operator"
+  showEnum SymbolInformation'Package = "Package"
+  showEnum SymbolInformation'PackageObject = "PackageObject"
+  showEnum SymbolInformation'Parameter = "Parameter"
+  showEnum SymbolInformation'ParameterLabel = "ParameterLabel"
+  showEnum SymbolInformation'Pattern = "Pattern"
+  showEnum SymbolInformation'Predicate = "Predicate"
+  showEnum SymbolInformation'Property = "Property"
+  showEnum SymbolInformation'Protocol = "Protocol"
+  showEnum SymbolInformation'ProtocolMethod = "ProtocolMethod"
+  showEnum SymbolInformation'PureVirtualMethod = "PureVirtualMethod"
+  showEnum SymbolInformation'Quasiquoter = "Quasiquoter"
+  showEnum SymbolInformation'SelfParameter = "SelfParameter"
+  showEnum SymbolInformation'Setter = "Setter"
+  showEnum SymbolInformation'Signature = "Signature"
+  showEnum SymbolInformation'SingletonClass = "SingletonClass"
+  showEnum SymbolInformation'SingletonMethod = "SingletonMethod"
+  showEnum SymbolInformation'StaticDataMember = "StaticDataMember"
+  showEnum SymbolInformation'StaticEvent = "StaticEvent"
+  showEnum SymbolInformation'StaticField = "StaticField"
+  showEnum SymbolInformation'StaticMethod = "StaticMethod"
+  showEnum SymbolInformation'StaticProperty = "StaticProperty"
+  showEnum SymbolInformation'StaticVariable = "StaticVariable"
+  showEnum SymbolInformation'String = "String"
+  showEnum SymbolInformation'Struct = "Struct"
+  showEnum SymbolInformation'Subscript = "Subscript"
+  showEnum SymbolInformation'Tactic = "Tactic"
+  showEnum SymbolInformation'Theorem = "Theorem"
+  showEnum SymbolInformation'ThisParameter = "ThisParameter"
+  showEnum SymbolInformation'Trait = "Trait"
+  showEnum SymbolInformation'TraitMethod = "TraitMethod"
+  showEnum SymbolInformation'Type = "Type"
+  showEnum SymbolInformation'TypeAlias = "TypeAlias"
+  showEnum SymbolInformation'TypeClass = "TypeClass"
+  showEnum SymbolInformation'TypeClassMethod = "TypeClassMethod"
+  showEnum SymbolInformation'TypeFamily = "TypeFamily"
+  showEnum SymbolInformation'TypeParameter = "TypeParameter"
+  showEnum SymbolInformation'Union = "Union"
+  showEnum SymbolInformation'Value = "Value"
+  showEnum SymbolInformation'Variable = "Variable"
+  showEnum
+    (SymbolInformation'Kind'Unrecognized (SymbolInformation'Kind'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedKind"
+    = Prelude.Just SymbolInformation'UnspecifiedKind
+    | (Prelude.==) k "AbstractMethod"
+    = Prelude.Just SymbolInformation'AbstractMethod
+    | (Prelude.==) k "Accessor"
+    = Prelude.Just SymbolInformation'Accessor
+    | (Prelude.==) k "Array" = Prelude.Just SymbolInformation'Array
+    | (Prelude.==) k "Assertion"
+    = Prelude.Just SymbolInformation'Assertion
+    | (Prelude.==) k "AssociatedType"
+    = Prelude.Just SymbolInformation'AssociatedType
+    | (Prelude.==) k "Attribute"
+    = Prelude.Just SymbolInformation'Attribute
+    | (Prelude.==) k "Axiom" = Prelude.Just SymbolInformation'Axiom
+    | (Prelude.==) k "Boolean" = Prelude.Just SymbolInformation'Boolean
+    | (Prelude.==) k "Class" = Prelude.Just SymbolInformation'Class
+    | (Prelude.==) k "Concept" = Prelude.Just SymbolInformation'Concept
+    | (Prelude.==) k "Constant"
+    = Prelude.Just SymbolInformation'Constant
+    | (Prelude.==) k "Constructor"
+    = Prelude.Just SymbolInformation'Constructor
+    | (Prelude.==) k "Contract"
+    = Prelude.Just SymbolInformation'Contract
+    | (Prelude.==) k "DataFamily"
+    = Prelude.Just SymbolInformation'DataFamily
+    | (Prelude.==) k "Delegate"
+    = Prelude.Just SymbolInformation'Delegate
+    | (Prelude.==) k "Enum" = Prelude.Just SymbolInformation'Enum
+    | (Prelude.==) k "EnumMember"
+    = Prelude.Just SymbolInformation'EnumMember
+    | (Prelude.==) k "Error" = Prelude.Just SymbolInformation'Error
+    | (Prelude.==) k "Event" = Prelude.Just SymbolInformation'Event
+    | (Prelude.==) k "Extension"
+    = Prelude.Just SymbolInformation'Extension
+    | (Prelude.==) k "Fact" = Prelude.Just SymbolInformation'Fact
+    | (Prelude.==) k "Field" = Prelude.Just SymbolInformation'Field
+    | (Prelude.==) k "File" = Prelude.Just SymbolInformation'File
+    | (Prelude.==) k "Function"
+    = Prelude.Just SymbolInformation'Function
+    | (Prelude.==) k "Getter" = Prelude.Just SymbolInformation'Getter
+    | (Prelude.==) k "Grammar" = Prelude.Just SymbolInformation'Grammar
+    | (Prelude.==) k "Instance"
+    = Prelude.Just SymbolInformation'Instance
+    | (Prelude.==) k "Interface"
+    = Prelude.Just SymbolInformation'Interface
+    | (Prelude.==) k "Key" = Prelude.Just SymbolInformation'Key
+    | (Prelude.==) k "Lang" = Prelude.Just SymbolInformation'Lang
+    | (Prelude.==) k "Lemma" = Prelude.Just SymbolInformation'Lemma
+    | (Prelude.==) k "Library" = Prelude.Just SymbolInformation'Library
+    | (Prelude.==) k "Macro" = Prelude.Just SymbolInformation'Macro
+    | (Prelude.==) k "Method" = Prelude.Just SymbolInformation'Method
+    | (Prelude.==) k "MethodAlias"
+    = Prelude.Just SymbolInformation'MethodAlias
+    | (Prelude.==) k "MethodReceiver"
+    = Prelude.Just SymbolInformation'MethodReceiver
+    | (Prelude.==) k "MethodSpecification"
+    = Prelude.Just SymbolInformation'MethodSpecification
+    | (Prelude.==) k "Message" = Prelude.Just SymbolInformation'Message
+    | (Prelude.==) k "Mixin" = Prelude.Just SymbolInformation'Mixin
+    | (Prelude.==) k "Modifier"
+    = Prelude.Just SymbolInformation'Modifier
+    | (Prelude.==) k "Module" = Prelude.Just SymbolInformation'Module
+    | (Prelude.==) k "Namespace"
+    = Prelude.Just SymbolInformation'Namespace
+    | (Prelude.==) k "Null" = Prelude.Just SymbolInformation'Null
+    | (Prelude.==) k "Number" = Prelude.Just SymbolInformation'Number
+    | (Prelude.==) k "Object" = Prelude.Just SymbolInformation'Object
+    | (Prelude.==) k "Operator"
+    = Prelude.Just SymbolInformation'Operator
+    | (Prelude.==) k "Package" = Prelude.Just SymbolInformation'Package
+    | (Prelude.==) k "PackageObject"
+    = Prelude.Just SymbolInformation'PackageObject
+    | (Prelude.==) k "Parameter"
+    = Prelude.Just SymbolInformation'Parameter
+    | (Prelude.==) k "ParameterLabel"
+    = Prelude.Just SymbolInformation'ParameterLabel
+    | (Prelude.==) k "Pattern" = Prelude.Just SymbolInformation'Pattern
+    | (Prelude.==) k "Predicate"
+    = Prelude.Just SymbolInformation'Predicate
+    | (Prelude.==) k "Property"
+    = Prelude.Just SymbolInformation'Property
+    | (Prelude.==) k "Protocol"
+    = Prelude.Just SymbolInformation'Protocol
+    | (Prelude.==) k "ProtocolMethod"
+    = Prelude.Just SymbolInformation'ProtocolMethod
+    | (Prelude.==) k "PureVirtualMethod"
+    = Prelude.Just SymbolInformation'PureVirtualMethod
+    | (Prelude.==) k "Quasiquoter"
+    = Prelude.Just SymbolInformation'Quasiquoter
+    | (Prelude.==) k "SelfParameter"
+    = Prelude.Just SymbolInformation'SelfParameter
+    | (Prelude.==) k "Setter" = Prelude.Just SymbolInformation'Setter
+    | (Prelude.==) k "Signature"
+    = Prelude.Just SymbolInformation'Signature
+    | (Prelude.==) k "SingletonClass"
+    = Prelude.Just SymbolInformation'SingletonClass
+    | (Prelude.==) k "SingletonMethod"
+    = Prelude.Just SymbolInformation'SingletonMethod
+    | (Prelude.==) k "StaticDataMember"
+    = Prelude.Just SymbolInformation'StaticDataMember
+    | (Prelude.==) k "StaticEvent"
+    = Prelude.Just SymbolInformation'StaticEvent
+    | (Prelude.==) k "StaticField"
+    = Prelude.Just SymbolInformation'StaticField
+    | (Prelude.==) k "StaticMethod"
+    = Prelude.Just SymbolInformation'StaticMethod
+    | (Prelude.==) k "StaticProperty"
+    = Prelude.Just SymbolInformation'StaticProperty
+    | (Prelude.==) k "StaticVariable"
+    = Prelude.Just SymbolInformation'StaticVariable
+    | (Prelude.==) k "String" = Prelude.Just SymbolInformation'String
+    | (Prelude.==) k "Struct" = Prelude.Just SymbolInformation'Struct
+    | (Prelude.==) k "Subscript"
+    = Prelude.Just SymbolInformation'Subscript
+    | (Prelude.==) k "Tactic" = Prelude.Just SymbolInformation'Tactic
+    | (Prelude.==) k "Theorem" = Prelude.Just SymbolInformation'Theorem
+    | (Prelude.==) k "ThisParameter"
+    = Prelude.Just SymbolInformation'ThisParameter
+    | (Prelude.==) k "Trait" = Prelude.Just SymbolInformation'Trait
+    | (Prelude.==) k "TraitMethod"
+    = Prelude.Just SymbolInformation'TraitMethod
+    | (Prelude.==) k "Type" = Prelude.Just SymbolInformation'Type
+    | (Prelude.==) k "TypeAlias"
+    = Prelude.Just SymbolInformation'TypeAlias
+    | (Prelude.==) k "TypeClass"
+    = Prelude.Just SymbolInformation'TypeClass
+    | (Prelude.==) k "TypeClassMethod"
+    = Prelude.Just SymbolInformation'TypeClassMethod
+    | (Prelude.==) k "TypeFamily"
+    = Prelude.Just SymbolInformation'TypeFamily
+    | (Prelude.==) k "TypeParameter"
+    = Prelude.Just SymbolInformation'TypeParameter
+    | (Prelude.==) k "Union" = Prelude.Just SymbolInformation'Union
+    | (Prelude.==) k "Value" = Prelude.Just SymbolInformation'Value
+    | (Prelude.==) k "Variable"
+    = Prelude.Just SymbolInformation'Variable
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded SymbolInformation'Kind where
+  minBound = SymbolInformation'UnspecifiedKind
+  maxBound = SymbolInformation'Concept
+instance Prelude.Enum SymbolInformation'Kind where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum Kind: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum SymbolInformation'UnspecifiedKind = 0
+  fromEnum SymbolInformation'Array = 1
+  fromEnum SymbolInformation'Assertion = 2
+  fromEnum SymbolInformation'AssociatedType = 3
+  fromEnum SymbolInformation'Attribute = 4
+  fromEnum SymbolInformation'Axiom = 5
+  fromEnum SymbolInformation'Boolean = 6
+  fromEnum SymbolInformation'Class = 7
+  fromEnum SymbolInformation'Constant = 8
+  fromEnum SymbolInformation'Constructor = 9
+  fromEnum SymbolInformation'DataFamily = 10
+  fromEnum SymbolInformation'Enum = 11
+  fromEnum SymbolInformation'EnumMember = 12
+  fromEnum SymbolInformation'Event = 13
+  fromEnum SymbolInformation'Fact = 14
+  fromEnum SymbolInformation'Field = 15
+  fromEnum SymbolInformation'File = 16
+  fromEnum SymbolInformation'Function = 17
+  fromEnum SymbolInformation'Getter = 18
+  fromEnum SymbolInformation'Grammar = 19
+  fromEnum SymbolInformation'Instance = 20
+  fromEnum SymbolInformation'Interface = 21
+  fromEnum SymbolInformation'Key = 22
+  fromEnum SymbolInformation'Lang = 23
+  fromEnum SymbolInformation'Lemma = 24
+  fromEnum SymbolInformation'Macro = 25
+  fromEnum SymbolInformation'Method = 26
+  fromEnum SymbolInformation'MethodReceiver = 27
+  fromEnum SymbolInformation'Message = 28
+  fromEnum SymbolInformation'Module = 29
+  fromEnum SymbolInformation'Namespace = 30
+  fromEnum SymbolInformation'Null = 31
+  fromEnum SymbolInformation'Number = 32
+  fromEnum SymbolInformation'Object = 33
+  fromEnum SymbolInformation'Operator = 34
+  fromEnum SymbolInformation'Package = 35
+  fromEnum SymbolInformation'PackageObject = 36
+  fromEnum SymbolInformation'Parameter = 37
+  fromEnum SymbolInformation'ParameterLabel = 38
+  fromEnum SymbolInformation'Pattern = 39
+  fromEnum SymbolInformation'Predicate = 40
+  fromEnum SymbolInformation'Property = 41
+  fromEnum SymbolInformation'Protocol = 42
+  fromEnum SymbolInformation'Quasiquoter = 43
+  fromEnum SymbolInformation'SelfParameter = 44
+  fromEnum SymbolInformation'Setter = 45
+  fromEnum SymbolInformation'Signature = 46
+  fromEnum SymbolInformation'Subscript = 47
+  fromEnum SymbolInformation'String = 48
+  fromEnum SymbolInformation'Struct = 49
+  fromEnum SymbolInformation'Tactic = 50
+  fromEnum SymbolInformation'Theorem = 51
+  fromEnum SymbolInformation'ThisParameter = 52
+  fromEnum SymbolInformation'Trait = 53
+  fromEnum SymbolInformation'Type = 54
+  fromEnum SymbolInformation'TypeAlias = 55
+  fromEnum SymbolInformation'TypeClass = 56
+  fromEnum SymbolInformation'TypeFamily = 57
+  fromEnum SymbolInformation'TypeParameter = 58
+  fromEnum SymbolInformation'Union = 59
+  fromEnum SymbolInformation'Value = 60
+  fromEnum SymbolInformation'Variable = 61
+  fromEnum SymbolInformation'Contract = 62
+  fromEnum SymbolInformation'Error = 63
+  fromEnum SymbolInformation'Library = 64
+  fromEnum SymbolInformation'Modifier = 65
+  fromEnum SymbolInformation'AbstractMethod = 66
+  fromEnum SymbolInformation'MethodSpecification = 67
+  fromEnum SymbolInformation'ProtocolMethod = 68
+  fromEnum SymbolInformation'PureVirtualMethod = 69
+  fromEnum SymbolInformation'TraitMethod = 70
+  fromEnum SymbolInformation'TypeClassMethod = 71
+  fromEnum SymbolInformation'Accessor = 72
+  fromEnum SymbolInformation'Delegate = 73
+  fromEnum SymbolInformation'MethodAlias = 74
+  fromEnum SymbolInformation'SingletonClass = 75
+  fromEnum SymbolInformation'SingletonMethod = 76
+  fromEnum SymbolInformation'StaticDataMember = 77
+  fromEnum SymbolInformation'StaticEvent = 78
+  fromEnum SymbolInformation'StaticField = 79
+  fromEnum SymbolInformation'StaticMethod = 80
+  fromEnum SymbolInformation'StaticProperty = 81
+  fromEnum SymbolInformation'StaticVariable = 82
+  fromEnum SymbolInformation'Extension = 84
+  fromEnum SymbolInformation'Mixin = 85
+  fromEnum SymbolInformation'Concept = 86
+  fromEnum
+    (SymbolInformation'Kind'Unrecognized (SymbolInformation'Kind'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ SymbolInformation'Concept
+    = Prelude.error
+        "SymbolInformation'Kind.succ: bad argument SymbolInformation'Concept. This value would be out of bounds."
+  succ SymbolInformation'UnspecifiedKind = SymbolInformation'Array
+  succ SymbolInformation'Array = SymbolInformation'Assertion
+  succ SymbolInformation'Assertion = SymbolInformation'AssociatedType
+  succ SymbolInformation'AssociatedType = SymbolInformation'Attribute
+  succ SymbolInformation'Attribute = SymbolInformation'Axiom
+  succ SymbolInformation'Axiom = SymbolInformation'Boolean
+  succ SymbolInformation'Boolean = SymbolInformation'Class
+  succ SymbolInformation'Class = SymbolInformation'Constant
+  succ SymbolInformation'Constant = SymbolInformation'Constructor
+  succ SymbolInformation'Constructor = SymbolInformation'DataFamily
+  succ SymbolInformation'DataFamily = SymbolInformation'Enum
+  succ SymbolInformation'Enum = SymbolInformation'EnumMember
+  succ SymbolInformation'EnumMember = SymbolInformation'Event
+  succ SymbolInformation'Event = SymbolInformation'Fact
+  succ SymbolInformation'Fact = SymbolInformation'Field
+  succ SymbolInformation'Field = SymbolInformation'File
+  succ SymbolInformation'File = SymbolInformation'Function
+  succ SymbolInformation'Function = SymbolInformation'Getter
+  succ SymbolInformation'Getter = SymbolInformation'Grammar
+  succ SymbolInformation'Grammar = SymbolInformation'Instance
+  succ SymbolInformation'Instance = SymbolInformation'Interface
+  succ SymbolInformation'Interface = SymbolInformation'Key
+  succ SymbolInformation'Key = SymbolInformation'Lang
+  succ SymbolInformation'Lang = SymbolInformation'Lemma
+  succ SymbolInformation'Lemma = SymbolInformation'Macro
+  succ SymbolInformation'Macro = SymbolInformation'Method
+  succ SymbolInformation'Method = SymbolInformation'MethodReceiver
+  succ SymbolInformation'MethodReceiver = SymbolInformation'Message
+  succ SymbolInformation'Message = SymbolInformation'Module
+  succ SymbolInformation'Module = SymbolInformation'Namespace
+  succ SymbolInformation'Namespace = SymbolInformation'Null
+  succ SymbolInformation'Null = SymbolInformation'Number
+  succ SymbolInformation'Number = SymbolInformation'Object
+  succ SymbolInformation'Object = SymbolInformation'Operator
+  succ SymbolInformation'Operator = SymbolInformation'Package
+  succ SymbolInformation'Package = SymbolInformation'PackageObject
+  succ SymbolInformation'PackageObject = SymbolInformation'Parameter
+  succ SymbolInformation'Parameter = SymbolInformation'ParameterLabel
+  succ SymbolInformation'ParameterLabel = SymbolInformation'Pattern
+  succ SymbolInformation'Pattern = SymbolInformation'Predicate
+  succ SymbolInformation'Predicate = SymbolInformation'Property
+  succ SymbolInformation'Property = SymbolInformation'Protocol
+  succ SymbolInformation'Protocol = SymbolInformation'Quasiquoter
+  succ SymbolInformation'Quasiquoter
+    = SymbolInformation'SelfParameter
+  succ SymbolInformation'SelfParameter = SymbolInformation'Setter
+  succ SymbolInformation'Setter = SymbolInformation'Signature
+  succ SymbolInformation'Signature = SymbolInformation'Subscript
+  succ SymbolInformation'Subscript = SymbolInformation'String
+  succ SymbolInformation'String = SymbolInformation'Struct
+  succ SymbolInformation'Struct = SymbolInformation'Tactic
+  succ SymbolInformation'Tactic = SymbolInformation'Theorem
+  succ SymbolInformation'Theorem = SymbolInformation'ThisParameter
+  succ SymbolInformation'ThisParameter = SymbolInformation'Trait
+  succ SymbolInformation'Trait = SymbolInformation'Type
+  succ SymbolInformation'Type = SymbolInformation'TypeAlias
+  succ SymbolInformation'TypeAlias = SymbolInformation'TypeClass
+  succ SymbolInformation'TypeClass = SymbolInformation'TypeFamily
+  succ SymbolInformation'TypeFamily = SymbolInformation'TypeParameter
+  succ SymbolInformation'TypeParameter = SymbolInformation'Union
+  succ SymbolInformation'Union = SymbolInformation'Value
+  succ SymbolInformation'Value = SymbolInformation'Variable
+  succ SymbolInformation'Variable = SymbolInformation'Contract
+  succ SymbolInformation'Contract = SymbolInformation'Error
+  succ SymbolInformation'Error = SymbolInformation'Library
+  succ SymbolInformation'Library = SymbolInformation'Modifier
+  succ SymbolInformation'Modifier = SymbolInformation'AbstractMethod
+  succ SymbolInformation'AbstractMethod
+    = SymbolInformation'MethodSpecification
+  succ SymbolInformation'MethodSpecification
+    = SymbolInformation'ProtocolMethod
+  succ SymbolInformation'ProtocolMethod
+    = SymbolInformation'PureVirtualMethod
+  succ SymbolInformation'PureVirtualMethod
+    = SymbolInformation'TraitMethod
+  succ SymbolInformation'TraitMethod
+    = SymbolInformation'TypeClassMethod
+  succ SymbolInformation'TypeClassMethod = SymbolInformation'Accessor
+  succ SymbolInformation'Accessor = SymbolInformation'Delegate
+  succ SymbolInformation'Delegate = SymbolInformation'MethodAlias
+  succ SymbolInformation'MethodAlias
+    = SymbolInformation'SingletonClass
+  succ SymbolInformation'SingletonClass
+    = SymbolInformation'SingletonMethod
+  succ SymbolInformation'SingletonMethod
+    = SymbolInformation'StaticDataMember
+  succ SymbolInformation'StaticDataMember
+    = SymbolInformation'StaticEvent
+  succ SymbolInformation'StaticEvent = SymbolInformation'StaticField
+  succ SymbolInformation'StaticField = SymbolInformation'StaticMethod
+  succ SymbolInformation'StaticMethod
+    = SymbolInformation'StaticProperty
+  succ SymbolInformation'StaticProperty
+    = SymbolInformation'StaticVariable
+  succ SymbolInformation'StaticVariable = SymbolInformation'Extension
+  succ SymbolInformation'Extension = SymbolInformation'Mixin
+  succ SymbolInformation'Mixin = SymbolInformation'Concept
+  succ (SymbolInformation'Kind'Unrecognized _)
+    = Prelude.error
+        "SymbolInformation'Kind.succ: bad argument: unrecognized value"
+  pred SymbolInformation'UnspecifiedKind
+    = Prelude.error
+        "SymbolInformation'Kind.pred: bad argument SymbolInformation'UnspecifiedKind. This value would be out of bounds."
+  pred SymbolInformation'Array = SymbolInformation'UnspecifiedKind
+  pred SymbolInformation'Assertion = SymbolInformation'Array
+  pred SymbolInformation'AssociatedType = SymbolInformation'Assertion
+  pred SymbolInformation'Attribute = SymbolInformation'AssociatedType
+  pred SymbolInformation'Axiom = SymbolInformation'Attribute
+  pred SymbolInformation'Boolean = SymbolInformation'Axiom
+  pred SymbolInformation'Class = SymbolInformation'Boolean
+  pred SymbolInformation'Constant = SymbolInformation'Class
+  pred SymbolInformation'Constructor = SymbolInformation'Constant
+  pred SymbolInformation'DataFamily = SymbolInformation'Constructor
+  pred SymbolInformation'Enum = SymbolInformation'DataFamily
+  pred SymbolInformation'EnumMember = SymbolInformation'Enum
+  pred SymbolInformation'Event = SymbolInformation'EnumMember
+  pred SymbolInformation'Fact = SymbolInformation'Event
+  pred SymbolInformation'Field = SymbolInformation'Fact
+  pred SymbolInformation'File = SymbolInformation'Field
+  pred SymbolInformation'Function = SymbolInformation'File
+  pred SymbolInformation'Getter = SymbolInformation'Function
+  pred SymbolInformation'Grammar = SymbolInformation'Getter
+  pred SymbolInformation'Instance = SymbolInformation'Grammar
+  pred SymbolInformation'Interface = SymbolInformation'Instance
+  pred SymbolInformation'Key = SymbolInformation'Interface
+  pred SymbolInformation'Lang = SymbolInformation'Key
+  pred SymbolInformation'Lemma = SymbolInformation'Lang
+  pred SymbolInformation'Macro = SymbolInformation'Lemma
+  pred SymbolInformation'Method = SymbolInformation'Macro
+  pred SymbolInformation'MethodReceiver = SymbolInformation'Method
+  pred SymbolInformation'Message = SymbolInformation'MethodReceiver
+  pred SymbolInformation'Module = SymbolInformation'Message
+  pred SymbolInformation'Namespace = SymbolInformation'Module
+  pred SymbolInformation'Null = SymbolInformation'Namespace
+  pred SymbolInformation'Number = SymbolInformation'Null
+  pred SymbolInformation'Object = SymbolInformation'Number
+  pred SymbolInformation'Operator = SymbolInformation'Object
+  pred SymbolInformation'Package = SymbolInformation'Operator
+  pred SymbolInformation'PackageObject = SymbolInformation'Package
+  pred SymbolInformation'Parameter = SymbolInformation'PackageObject
+  pred SymbolInformation'ParameterLabel = SymbolInformation'Parameter
+  pred SymbolInformation'Pattern = SymbolInformation'ParameterLabel
+  pred SymbolInformation'Predicate = SymbolInformation'Pattern
+  pred SymbolInformation'Property = SymbolInformation'Predicate
+  pred SymbolInformation'Protocol = SymbolInformation'Property
+  pred SymbolInformation'Quasiquoter = SymbolInformation'Protocol
+  pred SymbolInformation'SelfParameter
+    = SymbolInformation'Quasiquoter
+  pred SymbolInformation'Setter = SymbolInformation'SelfParameter
+  pred SymbolInformation'Signature = SymbolInformation'Setter
+  pred SymbolInformation'Subscript = SymbolInformation'Signature
+  pred SymbolInformation'String = SymbolInformation'Subscript
+  pred SymbolInformation'Struct = SymbolInformation'String
+  pred SymbolInformation'Tactic = SymbolInformation'Struct
+  pred SymbolInformation'Theorem = SymbolInformation'Tactic
+  pred SymbolInformation'ThisParameter = SymbolInformation'Theorem
+  pred SymbolInformation'Trait = SymbolInformation'ThisParameter
+  pred SymbolInformation'Type = SymbolInformation'Trait
+  pred SymbolInformation'TypeAlias = SymbolInformation'Type
+  pred SymbolInformation'TypeClass = SymbolInformation'TypeAlias
+  pred SymbolInformation'TypeFamily = SymbolInformation'TypeClass
+  pred SymbolInformation'TypeParameter = SymbolInformation'TypeFamily
+  pred SymbolInformation'Union = SymbolInformation'TypeParameter
+  pred SymbolInformation'Value = SymbolInformation'Union
+  pred SymbolInformation'Variable = SymbolInformation'Value
+  pred SymbolInformation'Contract = SymbolInformation'Variable
+  pred SymbolInformation'Error = SymbolInformation'Contract
+  pred SymbolInformation'Library = SymbolInformation'Error
+  pred SymbolInformation'Modifier = SymbolInformation'Library
+  pred SymbolInformation'AbstractMethod = SymbolInformation'Modifier
+  pred SymbolInformation'MethodSpecification
+    = SymbolInformation'AbstractMethod
+  pred SymbolInformation'ProtocolMethod
+    = SymbolInformation'MethodSpecification
+  pred SymbolInformation'PureVirtualMethod
+    = SymbolInformation'ProtocolMethod
+  pred SymbolInformation'TraitMethod
+    = SymbolInformation'PureVirtualMethod
+  pred SymbolInformation'TypeClassMethod
+    = SymbolInformation'TraitMethod
+  pred SymbolInformation'Accessor = SymbolInformation'TypeClassMethod
+  pred SymbolInformation'Delegate = SymbolInformation'Accessor
+  pred SymbolInformation'MethodAlias = SymbolInformation'Delegate
+  pred SymbolInformation'SingletonClass
+    = SymbolInformation'MethodAlias
+  pred SymbolInformation'SingletonMethod
+    = SymbolInformation'SingletonClass
+  pred SymbolInformation'StaticDataMember
+    = SymbolInformation'SingletonMethod
+  pred SymbolInformation'StaticEvent
+    = SymbolInformation'StaticDataMember
+  pred SymbolInformation'StaticField = SymbolInformation'StaticEvent
+  pred SymbolInformation'StaticMethod = SymbolInformation'StaticField
+  pred SymbolInformation'StaticProperty
+    = SymbolInformation'StaticMethod
+  pred SymbolInformation'StaticVariable
+    = SymbolInformation'StaticProperty
+  pred SymbolInformation'Extension = SymbolInformation'StaticVariable
+  pred SymbolInformation'Mixin = SymbolInformation'Extension
+  pred SymbolInformation'Concept = SymbolInformation'Mixin
+  pred (SymbolInformation'Kind'Unrecognized _)
+    = Prelude.error
+        "SymbolInformation'Kind.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault SymbolInformation'Kind where
+  fieldDefault = SymbolInformation'UnspecifiedKind
+instance Control.DeepSeq.NFData SymbolInformation'Kind where
+  rnf x__ = Prelude.seq x__ ()
+newtype SymbolRole'UnrecognizedValue
+  = SymbolRole'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data SymbolRole
+  = UnspecifiedSymbolRole |
+    Definition |
+    Import |
+    WriteAccess |
+    ReadAccess |
+    Generated |
+    Test |
+    ForwardDefinition |
+    SymbolRole'Unrecognized !SymbolRole'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum SymbolRole where
+  maybeToEnum 0 = Prelude.Just UnspecifiedSymbolRole
+  maybeToEnum 1 = Prelude.Just Definition
+  maybeToEnum 2 = Prelude.Just Import
+  maybeToEnum 4 = Prelude.Just WriteAccess
+  maybeToEnum 8 = Prelude.Just ReadAccess
+  maybeToEnum 16 = Prelude.Just Generated
+  maybeToEnum 32 = Prelude.Just Test
+  maybeToEnum 64 = Prelude.Just ForwardDefinition
+  maybeToEnum k
+    = Prelude.Just
+        (SymbolRole'Unrecognized
+           (SymbolRole'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedSymbolRole = "UnspecifiedSymbolRole"
+  showEnum Definition = "Definition"
+  showEnum Import = "Import"
+  showEnum WriteAccess = "WriteAccess"
+  showEnum ReadAccess = "ReadAccess"
+  showEnum Generated = "Generated"
+  showEnum Test = "Test"
+  showEnum ForwardDefinition = "ForwardDefinition"
+  showEnum (SymbolRole'Unrecognized (SymbolRole'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedSymbolRole"
+    = Prelude.Just UnspecifiedSymbolRole
+    | (Prelude.==) k "Definition" = Prelude.Just Definition
+    | (Prelude.==) k "Import" = Prelude.Just Import
+    | (Prelude.==) k "WriteAccess" = Prelude.Just WriteAccess
+    | (Prelude.==) k "ReadAccess" = Prelude.Just ReadAccess
+    | (Prelude.==) k "Generated" = Prelude.Just Generated
+    | (Prelude.==) k "Test" = Prelude.Just Test
+    | (Prelude.==) k "ForwardDefinition"
+    = Prelude.Just ForwardDefinition
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded SymbolRole where
+  minBound = UnspecifiedSymbolRole
+  maxBound = ForwardDefinition
+instance Prelude.Enum SymbolRole where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum SymbolRole: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedSymbolRole = 0
+  fromEnum Definition = 1
+  fromEnum Import = 2
+  fromEnum WriteAccess = 4
+  fromEnum ReadAccess = 8
+  fromEnum Generated = 16
+  fromEnum Test = 32
+  fromEnum ForwardDefinition = 64
+  fromEnum (SymbolRole'Unrecognized (SymbolRole'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ ForwardDefinition
+    = Prelude.error
+        "SymbolRole.succ: bad argument ForwardDefinition. This value would be out of bounds."
+  succ UnspecifiedSymbolRole = Definition
+  succ Definition = Import
+  succ Import = WriteAccess
+  succ WriteAccess = ReadAccess
+  succ ReadAccess = Generated
+  succ Generated = Test
+  succ Test = ForwardDefinition
+  succ (SymbolRole'Unrecognized _)
+    = Prelude.error "SymbolRole.succ: bad argument: unrecognized value"
+  pred UnspecifiedSymbolRole
+    = Prelude.error
+        "SymbolRole.pred: bad argument UnspecifiedSymbolRole. This value would be out of bounds."
+  pred Definition = UnspecifiedSymbolRole
+  pred Import = Definition
+  pred WriteAccess = Import
+  pred ReadAccess = WriteAccess
+  pred Generated = ReadAccess
+  pred Test = Generated
+  pred ForwardDefinition = Test
+  pred (SymbolRole'Unrecognized _)
+    = Prelude.error "SymbolRole.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault SymbolRole where
+  fieldDefault = UnspecifiedSymbolRole
+instance Control.DeepSeq.NFData SymbolRole where
+  rnf x__ = Prelude.seq x__ ()
+newtype SyntaxKind'UnrecognizedValue
+  = SyntaxKind'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data SyntaxKind
+  = UnspecifiedSyntaxKind |
+    Comment |
+    PunctuationDelimiter |
+    PunctuationBracket |
+    Keyword |
+    IdentifierOperator |
+    Identifier |
+    IdentifierBuiltin |
+    IdentifierNull |
+    IdentifierConstant |
+    IdentifierMutableGlobal |
+    IdentifierParameter |
+    IdentifierLocal |
+    IdentifierShadowed |
+    IdentifierNamespace |
+    IdentifierFunction |
+    IdentifierFunctionDefinition |
+    IdentifierMacro |
+    IdentifierMacroDefinition |
+    IdentifierType |
+    IdentifierBuiltinType |
+    IdentifierAttribute |
+    RegexEscape |
+    RegexRepeated |
+    RegexWildcard |
+    RegexDelimiter |
+    RegexJoin |
+    StringLiteral |
+    StringLiteralEscape |
+    StringLiteralSpecial |
+    StringLiteralKey |
+    CharacterLiteral |
+    NumericLiteral |
+    BooleanLiteral |
+    Tag |
+    TagAttribute |
+    TagDelimiter |
+    SyntaxKind'Unrecognized !SyntaxKind'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum SyntaxKind where
+  maybeToEnum 0 = Prelude.Just UnspecifiedSyntaxKind
+  maybeToEnum 1 = Prelude.Just Comment
+  maybeToEnum 2 = Prelude.Just PunctuationDelimiter
+  maybeToEnum 3 = Prelude.Just PunctuationBracket
+  maybeToEnum 4 = Prelude.Just Keyword
+  maybeToEnum 5 = Prelude.Just IdentifierOperator
+  maybeToEnum 6 = Prelude.Just Identifier
+  maybeToEnum 7 = Prelude.Just IdentifierBuiltin
+  maybeToEnum 8 = Prelude.Just IdentifierNull
+  maybeToEnum 9 = Prelude.Just IdentifierConstant
+  maybeToEnum 10 = Prelude.Just IdentifierMutableGlobal
+  maybeToEnum 11 = Prelude.Just IdentifierParameter
+  maybeToEnum 12 = Prelude.Just IdentifierLocal
+  maybeToEnum 13 = Prelude.Just IdentifierShadowed
+  maybeToEnum 14 = Prelude.Just IdentifierNamespace
+  maybeToEnum 15 = Prelude.Just IdentifierFunction
+  maybeToEnum 16 = Prelude.Just IdentifierFunctionDefinition
+  maybeToEnum 17 = Prelude.Just IdentifierMacro
+  maybeToEnum 18 = Prelude.Just IdentifierMacroDefinition
+  maybeToEnum 19 = Prelude.Just IdentifierType
+  maybeToEnum 20 = Prelude.Just IdentifierBuiltinType
+  maybeToEnum 21 = Prelude.Just IdentifierAttribute
+  maybeToEnum 22 = Prelude.Just RegexEscape
+  maybeToEnum 23 = Prelude.Just RegexRepeated
+  maybeToEnum 24 = Prelude.Just RegexWildcard
+  maybeToEnum 25 = Prelude.Just RegexDelimiter
+  maybeToEnum 26 = Prelude.Just RegexJoin
+  maybeToEnum 27 = Prelude.Just StringLiteral
+  maybeToEnum 28 = Prelude.Just StringLiteralEscape
+  maybeToEnum 29 = Prelude.Just StringLiteralSpecial
+  maybeToEnum 30 = Prelude.Just StringLiteralKey
+  maybeToEnum 31 = Prelude.Just CharacterLiteral
+  maybeToEnum 32 = Prelude.Just NumericLiteral
+  maybeToEnum 33 = Prelude.Just BooleanLiteral
+  maybeToEnum 34 = Prelude.Just Tag
+  maybeToEnum 35 = Prelude.Just TagAttribute
+  maybeToEnum 36 = Prelude.Just TagDelimiter
+  maybeToEnum k
+    = Prelude.Just
+        (SyntaxKind'Unrecognized
+           (SyntaxKind'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedSyntaxKind = "UnspecifiedSyntaxKind"
+  showEnum Comment = "Comment"
+  showEnum PunctuationDelimiter = "PunctuationDelimiter"
+  showEnum PunctuationBracket = "PunctuationBracket"
+  showEnum Keyword = "Keyword"
+  showEnum IdentifierOperator = "IdentifierOperator"
+  showEnum Identifier = "Identifier"
+  showEnum IdentifierBuiltin = "IdentifierBuiltin"
+  showEnum IdentifierNull = "IdentifierNull"
+  showEnum IdentifierConstant = "IdentifierConstant"
+  showEnum IdentifierMutableGlobal = "IdentifierMutableGlobal"
+  showEnum IdentifierParameter = "IdentifierParameter"
+  showEnum IdentifierLocal = "IdentifierLocal"
+  showEnum IdentifierShadowed = "IdentifierShadowed"
+  showEnum IdentifierNamespace = "IdentifierNamespace"
+  showEnum IdentifierFunction = "IdentifierFunction"
+  showEnum IdentifierFunctionDefinition
+    = "IdentifierFunctionDefinition"
+  showEnum IdentifierMacro = "IdentifierMacro"
+  showEnum IdentifierMacroDefinition = "IdentifierMacroDefinition"
+  showEnum IdentifierType = "IdentifierType"
+  showEnum IdentifierBuiltinType = "IdentifierBuiltinType"
+  showEnum IdentifierAttribute = "IdentifierAttribute"
+  showEnum RegexEscape = "RegexEscape"
+  showEnum RegexRepeated = "RegexRepeated"
+  showEnum RegexWildcard = "RegexWildcard"
+  showEnum RegexDelimiter = "RegexDelimiter"
+  showEnum RegexJoin = "RegexJoin"
+  showEnum StringLiteral = "StringLiteral"
+  showEnum StringLiteralEscape = "StringLiteralEscape"
+  showEnum StringLiteralSpecial = "StringLiteralSpecial"
+  showEnum StringLiteralKey = "StringLiteralKey"
+  showEnum CharacterLiteral = "CharacterLiteral"
+  showEnum NumericLiteral = "NumericLiteral"
+  showEnum BooleanLiteral = "BooleanLiteral"
+  showEnum Tag = "Tag"
+  showEnum TagAttribute = "TagAttribute"
+  showEnum TagDelimiter = "TagDelimiter"
+  showEnum (SyntaxKind'Unrecognized (SyntaxKind'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedSyntaxKind"
+    = Prelude.Just UnspecifiedSyntaxKind
+    | (Prelude.==) k "Comment" = Prelude.Just Comment
+    | (Prelude.==) k "PunctuationDelimiter"
+    = Prelude.Just PunctuationDelimiter
+    | (Prelude.==) k "PunctuationBracket"
+    = Prelude.Just PunctuationBracket
+    | (Prelude.==) k "Keyword" = Prelude.Just Keyword
+    | (Prelude.==) k "IdentifierKeyword"
+    = Prelude.Just IdentifierKeyword
+    | (Prelude.==) k "IdentifierOperator"
+    = Prelude.Just IdentifierOperator
+    | (Prelude.==) k "Identifier" = Prelude.Just Identifier
+    | (Prelude.==) k "IdentifierBuiltin"
+    = Prelude.Just IdentifierBuiltin
+    | (Prelude.==) k "IdentifierNull" = Prelude.Just IdentifierNull
+    | (Prelude.==) k "IdentifierConstant"
+    = Prelude.Just IdentifierConstant
+    | (Prelude.==) k "IdentifierMutableGlobal"
+    = Prelude.Just IdentifierMutableGlobal
+    | (Prelude.==) k "IdentifierParameter"
+    = Prelude.Just IdentifierParameter
+    | (Prelude.==) k "IdentifierLocal" = Prelude.Just IdentifierLocal
+    | (Prelude.==) k "IdentifierShadowed"
+    = Prelude.Just IdentifierShadowed
+    | (Prelude.==) k "IdentifierNamespace"
+    = Prelude.Just IdentifierNamespace
+    | (Prelude.==) k "IdentifierModule" = Prelude.Just IdentifierModule
+    | (Prelude.==) k "IdentifierFunction"
+    = Prelude.Just IdentifierFunction
+    | (Prelude.==) k "IdentifierFunctionDefinition"
+    = Prelude.Just IdentifierFunctionDefinition
+    | (Prelude.==) k "IdentifierMacro" = Prelude.Just IdentifierMacro
+    | (Prelude.==) k "IdentifierMacroDefinition"
+    = Prelude.Just IdentifierMacroDefinition
+    | (Prelude.==) k "IdentifierType" = Prelude.Just IdentifierType
+    | (Prelude.==) k "IdentifierBuiltinType"
+    = Prelude.Just IdentifierBuiltinType
+    | (Prelude.==) k "IdentifierAttribute"
+    = Prelude.Just IdentifierAttribute
+    | (Prelude.==) k "RegexEscape" = Prelude.Just RegexEscape
+    | (Prelude.==) k "RegexRepeated" = Prelude.Just RegexRepeated
+    | (Prelude.==) k "RegexWildcard" = Prelude.Just RegexWildcard
+    | (Prelude.==) k "RegexDelimiter" = Prelude.Just RegexDelimiter
+    | (Prelude.==) k "RegexJoin" = Prelude.Just RegexJoin
+    | (Prelude.==) k "StringLiteral" = Prelude.Just StringLiteral
+    | (Prelude.==) k "StringLiteralEscape"
+    = Prelude.Just StringLiteralEscape
+    | (Prelude.==) k "StringLiteralSpecial"
+    = Prelude.Just StringLiteralSpecial
+    | (Prelude.==) k "StringLiteralKey" = Prelude.Just StringLiteralKey
+    | (Prelude.==) k "CharacterLiteral" = Prelude.Just CharacterLiteral
+    | (Prelude.==) k "NumericLiteral" = Prelude.Just NumericLiteral
+    | (Prelude.==) k "BooleanLiteral" = Prelude.Just BooleanLiteral
+    | (Prelude.==) k "Tag" = Prelude.Just Tag
+    | (Prelude.==) k "TagAttribute" = Prelude.Just TagAttribute
+    | (Prelude.==) k "TagDelimiter" = Prelude.Just TagDelimiter
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded SyntaxKind where
+  minBound = UnspecifiedSyntaxKind
+  maxBound = TagDelimiter
+instance Prelude.Enum SyntaxKind where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum SyntaxKind: " (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedSyntaxKind = 0
+  fromEnum Comment = 1
+  fromEnum PunctuationDelimiter = 2
+  fromEnum PunctuationBracket = 3
+  fromEnum Keyword = 4
+  fromEnum IdentifierOperator = 5
+  fromEnum Identifier = 6
+  fromEnum IdentifierBuiltin = 7
+  fromEnum IdentifierNull = 8
+  fromEnum IdentifierConstant = 9
+  fromEnum IdentifierMutableGlobal = 10
+  fromEnum IdentifierParameter = 11
+  fromEnum IdentifierLocal = 12
+  fromEnum IdentifierShadowed = 13
+  fromEnum IdentifierNamespace = 14
+  fromEnum IdentifierFunction = 15
+  fromEnum IdentifierFunctionDefinition = 16
+  fromEnum IdentifierMacro = 17
+  fromEnum IdentifierMacroDefinition = 18
+  fromEnum IdentifierType = 19
+  fromEnum IdentifierBuiltinType = 20
+  fromEnum IdentifierAttribute = 21
+  fromEnum RegexEscape = 22
+  fromEnum RegexRepeated = 23
+  fromEnum RegexWildcard = 24
+  fromEnum RegexDelimiter = 25
+  fromEnum RegexJoin = 26
+  fromEnum StringLiteral = 27
+  fromEnum StringLiteralEscape = 28
+  fromEnum StringLiteralSpecial = 29
+  fromEnum StringLiteralKey = 30
+  fromEnum CharacterLiteral = 31
+  fromEnum NumericLiteral = 32
+  fromEnum BooleanLiteral = 33
+  fromEnum Tag = 34
+  fromEnum TagAttribute = 35
+  fromEnum TagDelimiter = 36
+  fromEnum (SyntaxKind'Unrecognized (SyntaxKind'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ TagDelimiter
+    = Prelude.error
+        "SyntaxKind.succ: bad argument TagDelimiter. This value would be out of bounds."
+  succ UnspecifiedSyntaxKind = Comment
+  succ Comment = PunctuationDelimiter
+  succ PunctuationDelimiter = PunctuationBracket
+  succ PunctuationBracket = Keyword
+  succ Keyword = IdentifierOperator
+  succ IdentifierOperator = Identifier
+  succ Identifier = IdentifierBuiltin
+  succ IdentifierBuiltin = IdentifierNull
+  succ IdentifierNull = IdentifierConstant
+  succ IdentifierConstant = IdentifierMutableGlobal
+  succ IdentifierMutableGlobal = IdentifierParameter
+  succ IdentifierParameter = IdentifierLocal
+  succ IdentifierLocal = IdentifierShadowed
+  succ IdentifierShadowed = IdentifierNamespace
+  succ IdentifierNamespace = IdentifierFunction
+  succ IdentifierFunction = IdentifierFunctionDefinition
+  succ IdentifierFunctionDefinition = IdentifierMacro
+  succ IdentifierMacro = IdentifierMacroDefinition
+  succ IdentifierMacroDefinition = IdentifierType
+  succ IdentifierType = IdentifierBuiltinType
+  succ IdentifierBuiltinType = IdentifierAttribute
+  succ IdentifierAttribute = RegexEscape
+  succ RegexEscape = RegexRepeated
+  succ RegexRepeated = RegexWildcard
+  succ RegexWildcard = RegexDelimiter
+  succ RegexDelimiter = RegexJoin
+  succ RegexJoin = StringLiteral
+  succ StringLiteral = StringLiteralEscape
+  succ StringLiteralEscape = StringLiteralSpecial
+  succ StringLiteralSpecial = StringLiteralKey
+  succ StringLiteralKey = CharacterLiteral
+  succ CharacterLiteral = NumericLiteral
+  succ NumericLiteral = BooleanLiteral
+  succ BooleanLiteral = Tag
+  succ Tag = TagAttribute
+  succ TagAttribute = TagDelimiter
+  succ (SyntaxKind'Unrecognized _)
+    = Prelude.error "SyntaxKind.succ: bad argument: unrecognized value"
+  pred UnspecifiedSyntaxKind
+    = Prelude.error
+        "SyntaxKind.pred: bad argument UnspecifiedSyntaxKind. This value would be out of bounds."
+  pred Comment = UnspecifiedSyntaxKind
+  pred PunctuationDelimiter = Comment
+  pred PunctuationBracket = PunctuationDelimiter
+  pred Keyword = PunctuationBracket
+  pred IdentifierOperator = Keyword
+  pred Identifier = IdentifierOperator
+  pred IdentifierBuiltin = Identifier
+  pred IdentifierNull = IdentifierBuiltin
+  pred IdentifierConstant = IdentifierNull
+  pred IdentifierMutableGlobal = IdentifierConstant
+  pred IdentifierParameter = IdentifierMutableGlobal
+  pred IdentifierLocal = IdentifierParameter
+  pred IdentifierShadowed = IdentifierLocal
+  pred IdentifierNamespace = IdentifierShadowed
+  pred IdentifierFunction = IdentifierNamespace
+  pred IdentifierFunctionDefinition = IdentifierFunction
+  pred IdentifierMacro = IdentifierFunctionDefinition
+  pred IdentifierMacroDefinition = IdentifierMacro
+  pred IdentifierType = IdentifierMacroDefinition
+  pred IdentifierBuiltinType = IdentifierType
+  pred IdentifierAttribute = IdentifierBuiltinType
+  pred RegexEscape = IdentifierAttribute
+  pred RegexRepeated = RegexEscape
+  pred RegexWildcard = RegexRepeated
+  pred RegexDelimiter = RegexWildcard
+  pred RegexJoin = RegexDelimiter
+  pred StringLiteral = RegexJoin
+  pred StringLiteralEscape = StringLiteral
+  pred StringLiteralSpecial = StringLiteralEscape
+  pred StringLiteralKey = StringLiteralSpecial
+  pred CharacterLiteral = StringLiteralKey
+  pred NumericLiteral = CharacterLiteral
+  pred BooleanLiteral = NumericLiteral
+  pred Tag = BooleanLiteral
+  pred TagAttribute = Tag
+  pred TagDelimiter = TagAttribute
+  pred (SyntaxKind'Unrecognized _)
+    = Prelude.error "SyntaxKind.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault SyntaxKind where
+  fieldDefault = UnspecifiedSyntaxKind
+instance Control.DeepSeq.NFData SyntaxKind where
+  rnf x__ = Prelude.seq x__ ()
+pattern IdentifierKeyword :: SyntaxKind
+pattern IdentifierKeyword = Keyword
+pattern IdentifierModule :: SyntaxKind
+pattern IdentifierModule = IdentifierNamespace
+newtype TextEncoding'UnrecognizedValue
+  = TextEncoding'UnrecognizedValue Data.Int.Int32
+  deriving stock (Prelude.Eq, Prelude.Ord, Prelude.Show)
+data TextEncoding
+  = UnspecifiedTextEncoding |
+    UTF8 |
+    UTF16 |
+    TextEncoding'Unrecognized !TextEncoding'UnrecognizedValue
+  deriving stock (Prelude.Show, Prelude.Eq, Prelude.Ord)
+instance Data.ProtoLens.MessageEnum TextEncoding where
+  maybeToEnum 0 = Prelude.Just UnspecifiedTextEncoding
+  maybeToEnum 1 = Prelude.Just UTF8
+  maybeToEnum 2 = Prelude.Just UTF16
+  maybeToEnum k
+    = Prelude.Just
+        (TextEncoding'Unrecognized
+           (TextEncoding'UnrecognizedValue (Prelude.fromIntegral k)))
+  showEnum UnspecifiedTextEncoding = "UnspecifiedTextEncoding"
+  showEnum UTF8 = "UTF8"
+  showEnum UTF16 = "UTF16"
+  showEnum
+    (TextEncoding'Unrecognized (TextEncoding'UnrecognizedValue k))
+    = Prelude.show k
+  readEnum k
+    | (Prelude.==) k "UnspecifiedTextEncoding"
+    = Prelude.Just UnspecifiedTextEncoding
+    | (Prelude.==) k "UTF8" = Prelude.Just UTF8
+    | (Prelude.==) k "UTF16" = Prelude.Just UTF16
+    | Prelude.otherwise
+    = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum
+instance Prelude.Bounded TextEncoding where
+  minBound = UnspecifiedTextEncoding
+  maxBound = UTF16
+instance Prelude.Enum TextEncoding where
+  toEnum k__
+    = Prelude.maybe
+        (Prelude.error
+           ((Prelude.++)
+              "toEnum: unknown value for enum TextEncoding: "
+              (Prelude.show k__)))
+        Prelude.id (Data.ProtoLens.maybeToEnum k__)
+  fromEnum UnspecifiedTextEncoding = 0
+  fromEnum UTF8 = 1
+  fromEnum UTF16 = 2
+  fromEnum
+    (TextEncoding'Unrecognized (TextEncoding'UnrecognizedValue k))
+    = Prelude.fromIntegral k
+  succ UTF16
+    = Prelude.error
+        "TextEncoding.succ: bad argument UTF16. This value would be out of bounds."
+  succ UnspecifiedTextEncoding = UTF8
+  succ UTF8 = UTF16
+  succ (TextEncoding'Unrecognized _)
+    = Prelude.error
+        "TextEncoding.succ: bad argument: unrecognized value"
+  pred UnspecifiedTextEncoding
+    = Prelude.error
+        "TextEncoding.pred: bad argument UnspecifiedTextEncoding. This value would be out of bounds."
+  pred UTF8 = UnspecifiedTextEncoding
+  pred UTF16 = UTF8
+  pred (TextEncoding'Unrecognized _)
+    = Prelude.error
+        "TextEncoding.pred: bad argument: unrecognized value"
+  enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom
+  enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo
+  enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen
+  enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo
+instance Data.ProtoLens.FieldDefault TextEncoding where
+  fieldDefault = UnspecifiedTextEncoding
+instance Control.DeepSeq.NFData TextEncoding where
+  rnf x__ = Prelude.seq x__ ()
+{- | Fields :
+
+         * 'Proto.Scip_Fields.name' @:: Lens' ToolInfo Data.Text.Text@
+         * 'Proto.Scip_Fields.version' @:: Lens' ToolInfo Data.Text.Text@
+         * 'Proto.Scip_Fields.arguments' @:: Lens' ToolInfo [Data.Text.Text]@
+         * 'Proto.Scip_Fields.vec'arguments' @:: Lens' ToolInfo (Data.Vector.Vector Data.Text.Text)@ -}
+data ToolInfo
+  = ToolInfo'_constructor {_ToolInfo'name :: !Data.Text.Text,
+                           _ToolInfo'version :: !Data.Text.Text,
+                           _ToolInfo'arguments :: !(Data.Vector.Vector Data.Text.Text),
+                           _ToolInfo'_unknownFields :: !Data.ProtoLens.FieldSet}
+  deriving stock (Prelude.Eq, Prelude.Ord)
+instance Prelude.Show ToolInfo where
+  showsPrec _ __x __s
+    = Prelude.showChar
+        '{'
+        (Prelude.showString
+           (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s))
+instance Data.ProtoLens.Field.HasField ToolInfo "name" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _ToolInfo'name (\ x__ y__ -> x__ {_ToolInfo'name = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField ToolInfo "version" Data.Text.Text where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _ToolInfo'version (\ x__ y__ -> x__ {_ToolInfo'version = y__}))
+        Prelude.id
+instance Data.ProtoLens.Field.HasField ToolInfo "arguments" [Data.Text.Text] where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _ToolInfo'arguments (\ x__ y__ -> x__ {_ToolInfo'arguments = y__}))
+        (Lens.Family2.Unchecked.lens
+           Data.Vector.Generic.toList
+           (\ _ y__ -> Data.Vector.Generic.fromList y__))
+instance Data.ProtoLens.Field.HasField ToolInfo "vec'arguments" (Data.Vector.Vector Data.Text.Text) where
+  fieldOf _
+    = (Prelude..)
+        (Lens.Family2.Unchecked.lens
+           _ToolInfo'arguments (\ x__ y__ -> x__ {_ToolInfo'arguments = y__}))
+        Prelude.id
+instance Data.ProtoLens.Message ToolInfo where
+  messageName _ = Data.Text.pack "scip.ToolInfo"
+  packedMessageDescriptor _
+    = "\n\
+      \\bToolInfo\DC2\DC2\n\
+      \\EOTname\CAN\SOH \SOH(\tR\EOTname\DC2\CAN\n\
+      \\aversion\CAN\STX \SOH(\tR\aversion\DC2\FS\n\
+      \\targuments\CAN\ETX \ETX(\tR\targuments"
+  packedFileDescriptor _ = packedFileDescriptor
+  fieldsByTag
+    = let
+        name__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "name"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"name")) ::
+              Data.ProtoLens.FieldDescriptor ToolInfo
+        version__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "version"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.PlainField
+                 Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"version")) ::
+              Data.ProtoLens.FieldDescriptor ToolInfo
+        arguments__field_descriptor
+          = Data.ProtoLens.FieldDescriptor
+              "arguments"
+              (Data.ProtoLens.ScalarField Data.ProtoLens.StringField ::
+                 Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)
+              (Data.ProtoLens.RepeatedField
+                 Data.ProtoLens.Unpacked
+                 (Data.ProtoLens.Field.field @"arguments")) ::
+              Data.ProtoLens.FieldDescriptor ToolInfo
+      in
+        Data.Map.fromList
+          [(Data.ProtoLens.Tag 1, name__field_descriptor),
+           (Data.ProtoLens.Tag 2, version__field_descriptor),
+           (Data.ProtoLens.Tag 3, arguments__field_descriptor)]
+  unknownFields
+    = Lens.Family2.Unchecked.lens
+        _ToolInfo'_unknownFields
+        (\ x__ y__ -> x__ {_ToolInfo'_unknownFields = y__})
+  defMessage
+    = ToolInfo'_constructor
+        {_ToolInfo'name = Data.ProtoLens.fieldDefault,
+         _ToolInfo'version = Data.ProtoLens.fieldDefault,
+         _ToolInfo'arguments = Data.Vector.Generic.empty,
+         _ToolInfo'_unknownFields = []}
+  parseMessage
+    = let
+        loop ::
+          ToolInfo
+          -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld Data.Text.Text
+             -> Data.ProtoLens.Encoding.Bytes.Parser ToolInfo
+        loop x mutable'arguments
+          = do end <- Data.ProtoLens.Encoding.Bytes.atEnd
+               if end then
+                   do frozen'arguments <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                            (Data.ProtoLens.Encoding.Growing.unsafeFreeze
+                                               mutable'arguments)
+                      (let missing = []
+                       in
+                         if Prelude.null missing then
+                             Prelude.return ()
+                         else
+                             Prelude.fail
+                               ((Prelude.++)
+                                  "Missing required fields: "
+                                  (Prelude.show (missing :: [Prelude.String]))))
+                      Prelude.return
+                        (Lens.Family2.over
+                           Data.ProtoLens.unknownFields (\ !t -> Prelude.reverse t)
+                           (Lens.Family2.set
+                              (Data.ProtoLens.Field.field @"vec'arguments") frozen'arguments x))
+               else
+                   do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                      case tag of
+                        10
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "name"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"name") y x)
+                                  mutable'arguments
+                        18
+                          -> do y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                       (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                       Data.ProtoLens.Encoding.Bytes.getBytes
+                                                         (Prelude.fromIntegral len)
+                                           Data.ProtoLens.Encoding.Bytes.runEither
+                                             (case Data.Text.Encoding.decodeUtf8' value of
+                                                (Prelude.Left err)
+                                                  -> Prelude.Left (Prelude.show err)
+                                                (Prelude.Right r) -> Prelude.Right r))
+                                       "version"
+                                loop
+                                  (Lens.Family2.set (Data.ProtoLens.Field.field @"version") y x)
+                                  mutable'arguments
+                        26
+                          -> do !y <- (Data.ProtoLens.Encoding.Bytes.<?>)
+                                        (do value <- do len <- Data.ProtoLens.Encoding.Bytes.getVarInt
+                                                        Data.ProtoLens.Encoding.Bytes.getBytes
+                                                          (Prelude.fromIntegral len)
+                                            Data.ProtoLens.Encoding.Bytes.runEither
+                                              (case Data.Text.Encoding.decodeUtf8' value of
+                                                 (Prelude.Left err)
+                                                   -> Prelude.Left (Prelude.show err)
+                                                 (Prelude.Right r) -> Prelude.Right r))
+                                        "arguments"
+                                v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                       (Data.ProtoLens.Encoding.Growing.append mutable'arguments y)
+                                loop x v
+                        wire
+                          -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
+                                        wire
+                                loop
+                                  (Lens.Family2.over
+                                     Data.ProtoLens.unknownFields (\ !t -> (:) y t) x)
+                                  mutable'arguments
+      in
+        (Data.ProtoLens.Encoding.Bytes.<?>)
+          (do mutable'arguments <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO
+                                     Data.ProtoLens.Encoding.Growing.new
+              loop Data.ProtoLens.defMessage mutable'arguments)
+          "ToolInfo"
+  buildMessage
+    = \ _x
+        -> (Data.Monoid.<>)
+             (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"name") _x
+              in
+                if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                    Data.Monoid.mempty
+                else
+                    (Data.Monoid.<>)
+                      (Data.ProtoLens.Encoding.Bytes.putVarInt 10)
+                      ((Prelude..)
+                         (\ bs
+                            -> (Data.Monoid.<>)
+                                 (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                    (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                 (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                         Data.Text.Encoding.encodeUtf8 _v))
+             ((Data.Monoid.<>)
+                (let
+                   _v = Lens.Family2.view (Data.ProtoLens.Field.field @"version") _x
+                 in
+                   if (Prelude.==) _v Data.ProtoLens.fieldDefault then
+                       Data.Monoid.mempty
+                   else
+                       (Data.Monoid.<>)
+                         (Data.ProtoLens.Encoding.Bytes.putVarInt 18)
+                         ((Prelude..)
+                            (\ bs
+                               -> (Data.Monoid.<>)
+                                    (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                       (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                    (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                            Data.Text.Encoding.encodeUtf8 _v))
+                ((Data.Monoid.<>)
+                   (Data.ProtoLens.Encoding.Bytes.foldMapBuilder
+                      (\ _v
+                         -> (Data.Monoid.<>)
+                              (Data.ProtoLens.Encoding.Bytes.putVarInt 26)
+                              ((Prelude..)
+                                 (\ bs
+                                    -> (Data.Monoid.<>)
+                                         (Data.ProtoLens.Encoding.Bytes.putVarInt
+                                            (Prelude.fromIntegral (Data.ByteString.length bs)))
+                                         (Data.ProtoLens.Encoding.Bytes.putBytes bs))
+                                 Data.Text.Encoding.encodeUtf8 _v))
+                      (Lens.Family2.view
+                         (Data.ProtoLens.Field.field @"vec'arguments") _x))
+                   (Data.ProtoLens.Encoding.Wire.buildFieldSet
+                      (Lens.Family2.view Data.ProtoLens.unknownFields _x))))
+instance Control.DeepSeq.NFData ToolInfo where
+  rnf
+    = \ x__
+        -> Control.DeepSeq.deepseq
+             (_ToolInfo'_unknownFields x__)
+             (Control.DeepSeq.deepseq
+                (_ToolInfo'name x__)
+                (Control.DeepSeq.deepseq
+                   (_ToolInfo'version x__)
+                   (Control.DeepSeq.deepseq (_ToolInfo'arguments x__) ())))
+packedFileDescriptor :: Data.ByteString.ByteString
+packedFileDescriptor
+  = "\n\
+    \\n\
+    \scip.proto\DC2\EOTscip\"\165\SOH\n\
+    \\ENQIndex\DC2*\n\
+    \\bmetadata\CAN\SOH \SOH(\v2\SO.scip.MetadataR\bmetadata\DC2,\n\
+    \\tdocuments\CAN\STX \ETX(\v2\SO.scip.DocumentR\tdocuments\DC2B\n\
+    \\DLEexternal_symbols\CAN\ETX \ETX(\v2\ETB.scip.SymbolInformationR\SIexternalSymbols\"\213\SOH\n\
+    \\bMetadata\DC2/\n\
+    \\aversion\CAN\SOH \SOH(\SO2\NAK.scip.ProtocolVersionR\aversion\DC2+\n\
+    \\ttool_info\CAN\STX \SOH(\v2\SO.scip.ToolInfoR\btoolInfo\DC2!\n\
+    \\fproject_root\CAN\ETX \SOH(\tR\vprojectRoot\DC2H\n\
+    \\SYNtext_document_encoding\CAN\EOT \SOH(\SO2\DC2.scip.TextEncodingR\DC4textDocumentEncoding\"V\n\
+    \\bToolInfo\DC2\DC2\n\
+    \\EOTname\CAN\SOH \SOH(\tR\EOTname\DC2\CAN\n\
+    \\aversion\CAN\STX \SOH(\tR\aversion\DC2\FS\n\
+    \\targuments\CAN\ETX \ETX(\tR\targuments\"\139\STX\n\
+    \\bDocument\DC2\SUB\n\
+    \\blanguage\CAN\EOT \SOH(\tR\blanguage\DC2#\n\
+    \\rrelative_path\CAN\SOH \SOH(\tR\frelativePath\DC22\n\
+    \\voccurrences\CAN\STX \ETX(\v2\DLE.scip.OccurrenceR\voccurrences\DC21\n\
+    \\asymbols\CAN\ETX \ETX(\v2\ETB.scip.SymbolInformationR\asymbols\DC2\DC2\n\
+    \\EOTtext\CAN\ENQ \SOH(\tR\EOTtext\DC2C\n\
+    \\DC1position_encoding\CAN\ACK \SOH(\SO2\SYN.scip.PositionEncodingR\DLEpositionEncoding\"}\n\
+    \\ACKSymbol\DC2\SYN\n\
+    \\ACKscheme\CAN\SOH \SOH(\tR\ACKscheme\DC2'\n\
+    \\apackage\CAN\STX \SOH(\v2\r.scip.PackageR\apackage\DC22\n\
+    \\vdescriptors\CAN\ETX \ETX(\v2\DLE.scip.DescriptorR\vdescriptors\"Q\n\
+    \\aPackage\DC2\CAN\n\
+    \\amanager\CAN\SOH \SOH(\tR\amanager\DC2\DC2\n\
+    \\EOTname\CAN\STX \SOH(\tR\EOTname\DC2\CAN\n\
+    \\aversion\CAN\ETX \SOH(\tR\aversion\"\159\STX\n\
+    \\n\
+    \Descriptor\DC2\DC2\n\
+    \\EOTname\CAN\SOH \SOH(\tR\EOTname\DC2$\n\
+    \\rdisambiguator\CAN\STX \SOH(\tR\rdisambiguator\DC2/\n\
+    \\ACKsuffix\CAN\ETX \SOH(\SO2\ETB.scip.Descriptor.SuffixR\ACKsuffix\"\165\SOH\n\
+    \\ACKSuffix\DC2\NAK\n\
+    \\DC1UnspecifiedSuffix\DLE\NUL\DC2\r\n\
+    \\tNamespace\DLE\SOH\DC2\SI\n\
+    \\aPackage\DLE\SOH\SUB\STX\b\SOH\DC2\b\n\
+    \\EOTType\DLE\STX\DC2\b\n\
+    \\EOTTerm\DLE\ETX\DC2\n\
+    \\n\
+    \\ACKMethod\DLE\EOT\DC2\DC1\n\
+    \\rTypeParameter\DLE\ENQ\DC2\r\n\
+    \\tParameter\DLE\ACK\DC2\b\n\
+    \\EOTMeta\DLE\a\DC2\t\n\
+    \\ENQLocal\DLE\b\DC2\t\n\
+    \\ENQMacro\DLE\t\SUB\STX\DLE\SOH\"\210\f\n\
+    \\DC1SymbolInformation\DC2\SYN\n\
+    \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2$\n\
+    \\rdocumentation\CAN\ETX \ETX(\tR\rdocumentation\DC28\n\
+    \\rrelationships\CAN\EOT \ETX(\v2\DC2.scip.RelationshipR\rrelationships\DC20\n\
+    \\EOTkind\CAN\ENQ \SOH(\SO2\FS.scip.SymbolInformation.KindR\EOTkind\DC2!\n\
+    \\fdisplay_name\CAN\ACK \SOH(\tR\vdisplayName\DC2G\n\
+    \\ETBsignature_documentation\CAN\a \SOH(\v2\SO.scip.DocumentR\SYNsignatureDocumentation\DC2)\n\
+    \\DLEenclosing_symbol\CAN\b \SOH(\tR\SIenclosingSymbol\"\251\t\n\
+    \\EOTKind\DC2\DC3\n\
+    \\SIUnspecifiedKind\DLE\NUL\DC2\DC2\n\
+    \\SOAbstractMethod\DLEB\DC2\f\n\
+    \\bAccessor\DLEH\DC2\t\n\
+    \\ENQArray\DLE\SOH\DC2\r\n\
+    \\tAssertion\DLE\STX\DC2\DC2\n\
+    \\SOAssociatedType\DLE\ETX\DC2\r\n\
+    \\tAttribute\DLE\EOT\DC2\t\n\
+    \\ENQAxiom\DLE\ENQ\DC2\v\n\
+    \\aBoolean\DLE\ACK\DC2\t\n\
+    \\ENQClass\DLE\a\DC2\v\n\
+    \\aConcept\DLEV\DC2\f\n\
+    \\bConstant\DLE\b\DC2\SI\n\
+    \\vConstructor\DLE\t\DC2\f\n\
+    \\bContract\DLE>\DC2\SO\n\
+    \\n\
+    \DataFamily\DLE\n\
+    \\DC2\f\n\
+    \\bDelegate\DLEI\DC2\b\n\
+    \\EOTEnum\DLE\v\DC2\SO\n\
+    \\n\
+    \EnumMember\DLE\f\DC2\t\n\
+    \\ENQError\DLE?\DC2\t\n\
+    \\ENQEvent\DLE\r\DC2\r\n\
+    \\tExtension\DLET\DC2\b\n\
+    \\EOTFact\DLE\SO\DC2\t\n\
+    \\ENQField\DLE\SI\DC2\b\n\
+    \\EOTFile\DLE\DLE\DC2\f\n\
+    \\bFunction\DLE\DC1\DC2\n\
+    \\n\
+    \\ACKGetter\DLE\DC2\DC2\v\n\
+    \\aGrammar\DLE\DC3\DC2\f\n\
+    \\bInstance\DLE\DC4\DC2\r\n\
+    \\tInterface\DLE\NAK\DC2\a\n\
+    \\ETXKey\DLE\SYN\DC2\b\n\
+    \\EOTLang\DLE\ETB\DC2\t\n\
+    \\ENQLemma\DLE\CAN\DC2\v\n\
+    \\aLibrary\DLE@\DC2\t\n\
+    \\ENQMacro\DLE\EM\DC2\n\
+    \\n\
+    \\ACKMethod\DLE\SUB\DC2\SI\n\
+    \\vMethodAlias\DLEJ\DC2\DC2\n\
+    \\SOMethodReceiver\DLE\ESC\DC2\ETB\n\
+    \\DC3MethodSpecification\DLEC\DC2\v\n\
+    \\aMessage\DLE\FS\DC2\t\n\
+    \\ENQMixin\DLEU\DC2\f\n\
+    \\bModifier\DLEA\DC2\n\
+    \\n\
+    \\ACKModule\DLE\GS\DC2\r\n\
+    \\tNamespace\DLE\RS\DC2\b\n\
+    \\EOTNull\DLE\US\DC2\n\
+    \\n\
+    \\ACKNumber\DLE \DC2\n\
+    \\n\
+    \\ACKObject\DLE!\DC2\f\n\
+    \\bOperator\DLE\"\DC2\v\n\
+    \\aPackage\DLE#\DC2\DC1\n\
+    \\rPackageObject\DLE$\DC2\r\n\
+    \\tParameter\DLE%\DC2\DC2\n\
+    \\SOParameterLabel\DLE&\DC2\v\n\
+    \\aPattern\DLE'\DC2\r\n\
+    \\tPredicate\DLE(\DC2\f\n\
+    \\bProperty\DLE)\DC2\f\n\
+    \\bProtocol\DLE*\DC2\DC2\n\
+    \\SOProtocolMethod\DLED\DC2\NAK\n\
+    \\DC1PureVirtualMethod\DLEE\DC2\SI\n\
+    \\vQuasiquoter\DLE+\DC2\DC1\n\
+    \\rSelfParameter\DLE,\DC2\n\
+    \\n\
+    \\ACKSetter\DLE-\DC2\r\n\
+    \\tSignature\DLE.\DC2\DC2\n\
+    \\SOSingletonClass\DLEK\DC2\DC3\n\
+    \\SISingletonMethod\DLEL\DC2\DC4\n\
+    \\DLEStaticDataMember\DLEM\DC2\SI\n\
+    \\vStaticEvent\DLEN\DC2\SI\n\
+    \\vStaticField\DLEO\DC2\DLE\n\
+    \\fStaticMethod\DLEP\DC2\DC2\n\
+    \\SOStaticProperty\DLEQ\DC2\DC2\n\
+    \\SOStaticVariable\DLER\DC2\n\
+    \\n\
+    \\ACKString\DLE0\DC2\n\
+    \\n\
+    \\ACKStruct\DLE1\DC2\r\n\
+    \\tSubscript\DLE/\DC2\n\
+    \\n\
+    \\ACKTactic\DLE2\DC2\v\n\
+    \\aTheorem\DLE3\DC2\DC1\n\
+    \\rThisParameter\DLE4\DC2\t\n\
+    \\ENQTrait\DLE5\DC2\SI\n\
+    \\vTraitMethod\DLEF\DC2\b\n\
+    \\EOTType\DLE6\DC2\r\n\
+    \\tTypeAlias\DLE7\DC2\r\n\
+    \\tTypeClass\DLE8\DC2\DC3\n\
+    \\SITypeClassMethod\DLEG\DC2\SO\n\
+    \\n\
+    \TypeFamily\DLE9\DC2\DC1\n\
+    \\rTypeParameter\DLE:\DC2\t\n\
+    \\ENQUnion\DLE;\DC2\t\n\
+    \\ENQValue\DLE<\DC2\f\n\
+    \\bVariable\DLE=\"\201\SOH\n\
+    \\fRelationship\DC2\SYN\n\
+    \\ACKsymbol\CAN\SOH \SOH(\tR\ACKsymbol\DC2!\n\
+    \\fis_reference\CAN\STX \SOH(\bR\visReference\DC2+\n\
+    \\DC1is_implementation\CAN\ETX \SOH(\bR\DLEisImplementation\DC2,\n\
+    \\DC2is_type_definition\CAN\EOT \SOH(\bR\DLEisTypeDefinition\DC2#\n\
+    \\ris_definition\CAN\ENQ \SOH(\bR\fisDefinition\"\164\STX\n\
+    \\n\
+    \Occurrence\DC2\DC4\n\
+    \\ENQrange\CAN\SOH \ETX(\ENQR\ENQrange\DC2\SYN\n\
+    \\ACKsymbol\CAN\STX \SOH(\tR\ACKsymbol\DC2!\n\
+    \\fsymbol_roles\CAN\ETX \SOH(\ENQR\vsymbolRoles\DC25\n\
+    \\SYNoverride_documentation\CAN\EOT \ETX(\tR\NAKoverrideDocumentation\DC21\n\
+    \\vsyntax_kind\CAN\ENQ \SOH(\SO2\DLE.scip.SyntaxKindR\n\
+    \syntaxKind\DC22\n\
+    \\vdiagnostics\CAN\ACK \ETX(\v2\DLE.scip.DiagnosticR\vdiagnostics\DC2'\n\
+    \\SIenclosing_range\CAN\a \ETX(\ENQR\SOenclosingRange\"\167\SOH\n\
+    \\n\
+    \Diagnostic\DC2*\n\
+    \\bseverity\CAN\SOH \SOH(\SO2\SO.scip.SeverityR\bseverity\DC2\DC2\n\
+    \\EOTcode\CAN\STX \SOH(\tR\EOTcode\DC2\CAN\n\
+    \\amessage\CAN\ETX \SOH(\tR\amessage\DC2\SYN\n\
+    \\ACKsource\CAN\EOT \SOH(\tR\ACKsource\DC2'\n\
+    \\EOTtags\CAN\ENQ \ETX(\SO2\DC3.scip.DiagnosticTagR\EOTtags*1\n\
+    \\SIProtocolVersion\DC2\RS\n\
+    \\SUBUnspecifiedProtocolVersion\DLE\NUL*@\n\
+    \\fTextEncoding\DC2\ESC\n\
+    \\ETBUnspecifiedTextEncoding\DLE\NUL\DC2\b\n\
+    \\EOTUTF8\DLE\SOH\DC2\t\n\
+    \\ENQUTF16\DLE\STX*\164\SOH\n\
+    \\DLEPositionEncoding\DC2\US\n\
+    \\ESCUnspecifiedPositionEncoding\DLE\NUL\DC2#\n\
+    \\USUTF8CodeUnitOffsetFromLineStart\DLE\SOH\DC2$\n\
+    \ UTF16CodeUnitOffsetFromLineStart\DLE\STX\DC2$\n\
+    \ UTF32CodeUnitOffsetFromLineStart\DLE\ETX*\148\SOH\n\
+    \\n\
+    \SymbolRole\DC2\EM\n\
+    \\NAKUnspecifiedSymbolRole\DLE\NUL\DC2\SO\n\
+    \\n\
+    \Definition\DLE\SOH\DC2\n\
+    \\n\
+    \\ACKImport\DLE\STX\DC2\SI\n\
+    \\vWriteAccess\DLE\EOT\DC2\SO\n\
+    \\n\
+    \ReadAccess\DLE\b\DC2\r\n\
+    \\tGenerated\DLE\DLE\DC2\b\n\
+    \\EOTTest\DLE \DC2\NAK\n\
+    \\DC1ForwardDefinition\DLE@*\234\ACK\n\
+    \\n\
+    \SyntaxKind\DC2\EM\n\
+    \\NAKUnspecifiedSyntaxKind\DLE\NUL\DC2\v\n\
+    \\aComment\DLE\SOH\DC2\CAN\n\
+    \\DC4PunctuationDelimiter\DLE\STX\DC2\SYN\n\
+    \\DC2PunctuationBracket\DLE\ETX\DC2\v\n\
+    \\aKeyword\DLE\EOT\DC2\EM\n\
+    \\DC1IdentifierKeyword\DLE\EOT\SUB\STX\b\SOH\DC2\SYN\n\
+    \\DC2IdentifierOperator\DLE\ENQ\DC2\SO\n\
+    \\n\
+    \Identifier\DLE\ACK\DC2\NAK\n\
+    \\DC1IdentifierBuiltin\DLE\a\DC2\DC2\n\
+    \\SOIdentifierNull\DLE\b\DC2\SYN\n\
+    \\DC2IdentifierConstant\DLE\t\DC2\ESC\n\
+    \\ETBIdentifierMutableGlobal\DLE\n\
+    \\DC2\ETB\n\
+    \\DC3IdentifierParameter\DLE\v\DC2\DC3\n\
+    \\SIIdentifierLocal\DLE\f\DC2\SYN\n\
+    \\DC2IdentifierShadowed\DLE\r\DC2\ETB\n\
+    \\DC3IdentifierNamespace\DLE\SO\DC2\CAN\n\
+    \\DLEIdentifierModule\DLE\SO\SUB\STX\b\SOH\DC2\SYN\n\
+    \\DC2IdentifierFunction\DLE\SI\DC2 \n\
+    \\FSIdentifierFunctionDefinition\DLE\DLE\DC2\DC3\n\
+    \\SIIdentifierMacro\DLE\DC1\DC2\GS\n\
+    \\EMIdentifierMacroDefinition\DLE\DC2\DC2\DC2\n\
+    \\SOIdentifierType\DLE\DC3\DC2\EM\n\
+    \\NAKIdentifierBuiltinType\DLE\DC4\DC2\ETB\n\
+    \\DC3IdentifierAttribute\DLE\NAK\DC2\SI\n\
+    \\vRegexEscape\DLE\SYN\DC2\DC1\n\
+    \\rRegexRepeated\DLE\ETB\DC2\DC1\n\
+    \\rRegexWildcard\DLE\CAN\DC2\DC2\n\
+    \\SORegexDelimiter\DLE\EM\DC2\r\n\
+    \\tRegexJoin\DLE\SUB\DC2\DC1\n\
+    \\rStringLiteral\DLE\ESC\DC2\ETB\n\
+    \\DC3StringLiteralEscape\DLE\FS\DC2\CAN\n\
+    \\DC4StringLiteralSpecial\DLE\GS\DC2\DC4\n\
+    \\DLEStringLiteralKey\DLE\RS\DC2\DC4\n\
+    \\DLECharacterLiteral\DLE\US\DC2\DC2\n\
+    \\SONumericLiteral\DLE \DC2\DC2\n\
+    \\SOBooleanLiteral\DLE!\DC2\a\n\
+    \\ETXTag\DLE\"\DC2\DLE\n\
+    \\fTagAttribute\DLE#\DC2\DLE\n\
+    \\fTagDelimiter\DLE$\SUB\STX\DLE\SOH*V\n\
+    \\bSeverity\DC2\ETB\n\
+    \\DC3UnspecifiedSeverity\DLE\NUL\DC2\t\n\
+    \\ENQError\DLE\SOH\DC2\v\n\
+    \\aWarning\DLE\STX\DC2\SI\n\
+    \\vInformation\DLE\ETX\DC2\b\n\
+    \\EOTHint\DLE\EOT*N\n\
+    \\rDiagnosticTag\DC2\FS\n\
+    \\CANUnspecifiedDiagnosticTag\DLE\NUL\DC2\SI\n\
+    \\vUnnecessary\DLE\SOH\DC2\SO\n\
+    \\n\
+    \Deprecated\DLE\STX*\155\n\
+    \\n\
+    \\bLanguage\DC2\ETB\n\
+    \\DC3UnspecifiedLanguage\DLE\NUL\DC2\b\n\
+    \\EOTABAP\DLE<\DC2\b\n\
+    \\EOTApex\DLE`\DC2\a\n\
+    \\ETXAPL\DLE1\DC2\a\n\
+    \\ETXAda\DLE'\DC2\b\n\
+    \\EOTAgda\DLE-\DC2\f\n\
+    \\bAsciiDoc\DLEV\DC2\f\n\
+    \\bAssembly\DLE:\DC2\a\n\
+    \\ETXAwk\DLEB\DC2\a\n\
+    \\ETXBat\DLED\DC2\n\
+    \\n\
+    \\ACKBibTeX\DLEQ\DC2\ENQ\n\
+    \\SOHC\DLE\"\DC2\t\n\
+    \\ENQCOBOL\DLE;\DC2\a\n\
+    \\ETXCPP\DLE#\DC2\a\n\
+    \\ETXCSS\DLE\SUB\DC2\n\
+    \\n\
+    \\ACKCSharp\DLE\SOH\DC2\v\n\
+    \\aClojure\DLE\b\DC2\DLE\n\
+    \\fCoffeescript\DLE\NAK\DC2\SO\n\
+    \\n\
+    \CommonLisp\DLE\t\DC2\a\n\
+    \\ETXCoq\DLE/\DC2\b\n\
+    \\EOTCUDA\DLEa\DC2\b\n\
+    \\EOTDart\DLE\ETX\DC2\n\
+    \\n\
+    \\ACKDelphi\DLE9\DC2\b\n\
+    \\EOTDiff\DLEX\DC2\SO\n\
+    \\n\
+    \Dockerfile\DLEP\DC2\n\
+    \\n\
+    \\ACKDyalog\DLE2\DC2\n\
+    \\n\
+    \\ACKElixir\DLE\DC1\DC2\n\
+    \\n\
+    \\ACKErlang\DLE\DC2\DC2\n\
+    \\n\
+    \\ACKFSharp\DLE*\DC2\b\n\
+    \\EOTFish\DLEA\DC2\b\n\
+    \\EOTFlow\DLE\CAN\DC2\v\n\
+    \\aFortran\DLE8\DC2\SO\n\
+    \\n\
+    \Git_Commit\DLE[\DC2\SO\n\
+    \\n\
+    \Git_Config\DLEY\DC2\SO\n\
+    \\n\
+    \Git_Rebase\DLE\\\DC2\ACK\n\
+    \\STXGo\DLE!\DC2\v\n\
+    \\aGraphQL\DLEb\DC2\n\
+    \\n\
+    \\ACKGroovy\DLE\a\DC2\b\n\
+    \\EOTHTML\DLE\RS\DC2\b\n\
+    \\EOTHack\DLE\DC4\DC2\SO\n\
+    \\n\
+    \Handlebars\DLEZ\DC2\v\n\
+    \\aHaskell\DLE,\DC2\t\n\
+    \\ENQIdris\DLE.\DC2\a\n\
+    \\ETXIni\DLEH\DC2\ENQ\n\
+    \\SOHJ\DLE3\DC2\b\n\
+    \\EOTJSON\DLEK\DC2\b\n\
+    \\EOTJava\DLE\ACK\DC2\SO\n\
+    \\n\
+    \JavaScript\DLE\SYN\DC2\DC3\n\
+    \\SIJavaScriptReact\DLE]\DC2\v\n\
+    \\aJsonnet\DLEL\DC2\t\n\
+    \\ENQJulia\DLE7\DC2\f\n\
+    \\bJustfile\DLEm\DC2\n\
+    \\n\
+    \\ACKKotlin\DLE\EOT\DC2\t\n\
+    \\ENQLaTeX\DLES\DC2\b\n\
+    \\EOTLean\DLE0\DC2\b\n\
+    \\EOTLess\DLE\ESC\DC2\a\n\
+    \\ETXLua\DLE\f\DC2\b\n\
+    \\EOTLuau\DLEl\DC2\f\n\
+    \\bMakefile\DLEO\DC2\f\n\
+    \\bMarkdown\DLET\DC2\n\
+    \\n\
+    \\ACKMatlab\DLE4\DC2\n\
+    \\n\
+    \\ACKNickel\DLEn\DC2\a\n\
+    \\ETXNix\DLEM\DC2\t\n\
+    \\ENQOCaml\DLE)\DC2\SI\n\
+    \\vObjective_C\DLE$\DC2\DC1\n\
+    \\rObjective_CPP\DLE%\DC2\n\
+    \\n\
+    \\ACKPascal\DLEc\DC2\a\n\
+    \\ETXPHP\DLE\DC3\DC2\t\n\
+    \\ENQPLSQL\DLEF\DC2\b\n\
+    \\EOTPerl\DLE\r\DC2\SO\n\
+    \\n\
+    \PowerShell\DLEC\DC2\n\
+    \\n\
+    \\ACKProlog\DLEG\DC2\f\n\
+    \\bProtobuf\DLEd\DC2\n\
+    \\n\
+    \\ACKPython\DLE\SI\DC2\ENQ\n\
+    \\SOHR\DLE6\DC2\n\
+    \\n\
+    \\ACKRacket\DLE\v\DC2\b\n\
+    \\EOTRaku\DLE\SO\DC2\t\n\
+    \\ENQRazor\DLE>\DC2\t\n\
+    \\ENQRepro\DLEf\DC2\b\n\
+    \\EOTReST\DLEU\DC2\b\n\
+    \\EOTRuby\DLE\DLE\DC2\b\n\
+    \\EOTRust\DLE(\DC2\a\n\
+    \\ETXSAS\DLE=\DC2\b\n\
+    \\EOTSCSS\DLE\GS\DC2\a\n\
+    \\ETXSML\DLE+\DC2\a\n\
+    \\ETXSQL\DLEE\DC2\b\n\
+    \\EOTSass\DLE\FS\DC2\t\n\
+    \\ENQScala\DLE\ENQ\DC2\n\
+    \\n\
+    \\ACKScheme\DLE\n\
+    \\DC2\SI\n\
+    \\vShellScript\DLE@\DC2\v\n\
+    \\aSkylark\DLEN\DC2\t\n\
+    \\ENQSlang\DLEk\DC2\f\n\
+    \\bSolidity\DLE_\DC2\n\
+    \\n\
+    \\ACKSvelte\DLEj\DC2\t\n\
+    \\ENQSwift\DLE\STX\DC2\a\n\
+    \\ETXTcl\DLEe\DC2\b\n\
+    \\EOTTOML\DLEI\DC2\a\n\
+    \\ETXTeX\DLER\DC2\n\
+    \\n\
+    \\ACKThrift\DLEg\DC2\SO\n\
+    \\n\
+    \TypeScript\DLE\ETB\DC2\DC3\n\
+    \\SITypeScriptReact\DLE^\DC2\v\n\
+    \\aVerilog\DLEh\DC2\b\n\
+    \\EOTVHDL\DLEi\DC2\SI\n\
+    \\vVisualBasic\DLE?\DC2\a\n\
+    \\ETXVue\DLE\EM\DC2\v\n\
+    \\aWolfram\DLE5\DC2\a\n\
+    \\ETXXML\DLE\US\DC2\a\n\
+    \\ETXXSL\DLE \DC2\b\n\
+    \\EOTYAML\DLEJ\DC2\a\n\
+    \\ETXZig\DLE&B/Z-github.com/sourcegraph/scip/bindings/go/scip/J\139\185\STX\n\
+    \\a\DC2\ENQ\n\
+    \\NUL\244\ACK\SOH\n\
+    \\130\EOT\n\
+    \\SOH\f\DC2\ETX\n\
+    \\NUL\DC22\247\ETX An index contains one or more pieces of information about a given piece of\n\
+    \ source code or software artifact. Complementary information can be merged\n\
+    \ together from multiple sources to provide a unified code intelligence\n\
+    \ experience.\n\
+    \\n\
+    \ Programs producing a file of this format is an \"indexer\" and may operate\n\
+    \ somewhere on the spectrum between precision, such as indexes produced by\n\
+    \ compiler-backed indexers, and heurstics, such as indexes produced by local\n\
+    \ syntax-directed analysis for scope rules.\n\
+    \\n\
+    \\b\n\
+    \\SOH\STX\DC2\ETX\f\NUL\r\n\
+    \\b\n\
+    \\SOH\b\DC2\ETX\SO\NULD\n\
+    \\t\n\
+    \\STX\b\v\DC2\ETX\SO\NULD\n\
+    \\208\ETX\n\
+    \\STX\EOT\NUL\DC2\EOT\SYN\NUL#\SOH\SUB\195\ETX Index represents a complete SCIP index for a workspace this is rooted at a\n\
+    \ single directory. An Index message payload can have a large memory footprint\n\
+    \ and it's therefore recommended to emit and consume an Index payload one field\n\
+    \ value at a time. To permit streaming consumption of an Index payload, the\n\
+    \ `metadata` field must appear at the start of the stream and must only appear\n\
+    \ once in the stream. Other field values may appear in any order.\n\
+    \\n\
+    \\n\
+    \\n\
+    \\ETX\EOT\NUL\SOH\DC2\ETX\SYN\b\r\n\
+    \)\n\
+    \\EOT\EOT\NUL\STX\NUL\DC2\ETX\CAN\STX\CAN\SUB\FS Metadata about this index.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\NUL\ACK\DC2\ETX\CAN\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\NUL\SOH\DC2\ETX\CAN\v\DC3\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\NUL\ETX\DC2\ETX\CAN\SYN\ETB\n\
+    \3\n\
+    \\EOT\EOT\NUL\STX\SOH\DC2\ETX\SUB\STX\"\SUB& Documents that belong to this index.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\SOH\EOT\DC2\ETX\SUB\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\SOH\ACK\DC2\ETX\SUB\v\DC3\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\SOH\SOH\DC2\ETX\SUB\DC4\GS\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\SOH\ETX\DC2\ETX\SUB !\n\
+    \\246\ETX\n\
+    \\EOT\EOT\NUL\STX\STX\DC2\ETX \STX2\SUB\233\STX (optional) Symbols that are referenced from this index but are defined in\n\
+    \ an external package (a separate `Index` message). Leave this field empty\n\
+    \ if you assume the external package will get indexed separately. If the\n\
+    \ external package won't get indexed for some reason then you can use this\n\
+    \ field to provide hover documentation for those external symbols.\n\
+    \\"} IMPORTANT: When adding a new field to `Index` here, add a matching\n\
+    \ function in `IndexVisitor` and update `ParseStreaming`.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\STX\EOT\DC2\ETX \STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\STX\ACK\DC2\ETX \v\FS\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\STX\SOH\DC2\ETX \GS-\n\
+    \\f\n\
+    \\ENQ\EOT\NUL\STX\STX\ETX\DC2\ETX 01\n\
+    \\n\
+    \\n\
+    \\STX\EOT\SOH\DC2\EOT%\NUL2\SOH\n\
+    \\n\
+    \\n\
+    \\ETX\EOT\SOH\SOH\DC2\ETX%\b\DLE\n\
+    \N\n\
+    \\EOT\EOT\SOH\STX\NUL\DC2\ETX'\STX\RS\SUBA Which version of this protocol was used to generate this index?\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\NUL\ACK\DC2\ETX'\STX\DC1\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\NUL\SOH\DC2\ETX'\DC2\EM\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\NUL\ETX\DC2\ETX'\FS\GS\n\
+    \C\n\
+    \\EOT\EOT\SOH\STX\SOH\DC2\ETX)\STX\EM\SUB6 Information about the tool that produced this index.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\SOH\ACK\DC2\ETX)\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\SOH\SOH\DC2\ETX)\v\DC4\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\SOH\ETX\DC2\ETX)\ETB\CAN\n\
+    \\162\SOH\n\
+    \\EOT\EOT\SOH\STX\STX\DC2\ETX-\STX\SUB\SUB\148\SOH URI-encoded absolute path to the root directory of this index. All\n\
+    \ documents in this index must appear in a subdirectory of this root\n\
+    \ directory.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\STX\ENQ\DC2\ETX-\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\STX\SOH\DC2\ETX-\t\NAK\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\STX\ETX\DC2\ETX-\CAN\EM\n\
+    \\224\SOH\n\
+    \\EOT\EOT\SOH\STX\ETX\DC2\ETX1\STX*\SUB\210\SOH Text encoding of the source files on disk that are referenced from\n\
+    \ `Document.relative_path`. This value is unrelated to the `Document.text`\n\
+    \ field, which is a Protobuf string and hence must be UTF-8 encoded.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\ETX\ACK\DC2\ETX1\STX\SO\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\ETX\SOH\DC2\ETX1\SI%\n\
+    \\f\n\
+    \\ENQ\EOT\SOH\STX\ETX\ETX\DC2\ETX1()\n\
+    \\n\
+    \\n\
+    \\STX\ENQ\NUL\DC2\EOT4\NUL6\SOH\n\
+    \\n\
+    \\n\
+    \\ETX\ENQ\NUL\SOH\DC2\ETX4\ENQ\DC4\n\
+    \\v\n\
+    \\EOT\ENQ\NUL\STX\NUL\DC2\ETX5\STX!\n\
+    \\f\n\
+    \\ENQ\ENQ\NUL\STX\NUL\SOH\DC2\ETX5\STX\FS\n\
+    \\f\n\
+    \\ENQ\ENQ\NUL\STX\NUL\STX\DC2\ETX5\US \n\
+    \\n\
+    \\n\
+    \\STX\ENQ\SOH\DC2\EOT8\NUL<\SOH\n\
+    \\n\
+    \\n\
+    \\ETX\ENQ\SOH\SOH\DC2\ETX8\ENQ\DC1\n\
+    \\v\n\
+    \\EOT\ENQ\SOH\STX\NUL\DC2\ETX9\STX\RS\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\NUL\SOH\DC2\ETX9\STX\EM\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\NUL\STX\DC2\ETX9\FS\GS\n\
+    \\v\n\
+    \\EOT\ENQ\SOH\STX\SOH\DC2\ETX:\STX\v\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\SOH\SOH\DC2\ETX:\STX\ACK\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\SOH\STX\DC2\ETX:\t\n\
+    \\n\
+    \\v\n\
+    \\EOT\ENQ\SOH\STX\STX\DC2\ETX;\STX\f\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\STX\SOH\DC2\ETX;\STX\a\n\
+    \\f\n\
+    \\ENQ\ENQ\SOH\STX\STX\STX\DC2\ETX;\n\
+    \\v\n\
+    \\n\
+    \\n\
+    \\STX\EOT\STX\DC2\EOT>\NULE\SOH\n\
+    \\n\
+    \\n\
+    \\ETX\EOT\STX\SOH\DC2\ETX>\b\DLE\n\
+    \<\n\
+    \\EOT\EOT\STX\STX\NUL\DC2\ETX@\STX\DC2\SUB/ Name of the indexer that produced this index.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\NUL\ENQ\DC2\ETX@\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\NUL\SOH\DC2\ETX@\t\r\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\NUL\ETX\DC2\ETX@\DLE\DC1\n\
+    \?\n\
+    \\EOT\EOT\STX\STX\SOH\DC2\ETXB\STX\NAK\SUB2 Version of the indexer that produced this index.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\SOH\ENQ\DC2\ETXB\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\SOH\SOH\DC2\ETXB\t\DLE\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\SOH\ETX\DC2\ETXB\DC3\DC4\n\
+    \L\n\
+    \\EOT\EOT\STX\STX\STX\DC2\ETXD\STX \SUB? Command-line arguments that were used to invoke this indexer.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\STX\EOT\DC2\ETXD\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\STX\ENQ\DC2\ETXD\v\DC1\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\STX\SOH\DC2\ETXD\DC2\ESC\n\
+    \\f\n\
+    \\ENQ\EOT\STX\STX\STX\ETX\DC2\ETXD\RS\US\n\
+    \H\n\
+    \\STX\EOT\ETX\DC2\EOTH\NULu\SOH\SUB< Document defines the metadata about a source file on disk.\n\
+    \\n\
+    \\n\
+    \\n\
+    \\ETX\EOT\ETX\SOH\DC2\ETXH\b\DLE\n\
+    \\165\STX\n\
+    \\EOT\EOT\ETX\STX\NUL\DC2\ETXM\STX\SYN\SUB\151\STX The string ID for the programming language this file is written in.\n\
+    \ The `Language` enum contains the names of most common programming languages.\n\
+    \ This field is typed as a string to permit any programming language, including\n\
+    \ ones that are not specified by the `Language` enum.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\NUL\ENQ\DC2\ETXM\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\NUL\SOH\DC2\ETXM\t\DC1\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\NUL\ETX\DC2\ETXM\DC4\NAK\n\
+    \\181\ETX\n\
+    \\EOT\EOT\ETX\STX\SOH\DC2\ETXW\STX\ESC\SUB\167\ETX (Required) Unique path to the text document.\n\
+    \\n\
+    \ 1. The path must be relative to the directory supplied in the associated\n\
+    \    `Metadata.project_root`.\n\
+    \ 2. The path must not begin with a leading '/'.\n\
+    \ 3. The path must point to a regular file, not a symbolic link.\n\
+    \ 4. The path must use '/' as the separator, including on Windows.\n\
+    \ 5. The path must be canonical; it cannot include empty components ('//'),\n\
+    \    or '.' or '..'.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\SOH\ENQ\DC2\ETXW\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\SOH\SOH\DC2\ETXW\t\SYN\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\SOH\ETX\DC2\ETXW\EM\SUB\n\
+    \4\n\
+    \\EOT\EOT\ETX\STX\STX\DC2\ETXY\STX&\SUB' Occurrences that appear in this file.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\STX\EOT\DC2\ETXY\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\STX\ACK\DC2\ETXY\v\NAK\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\STX\SOH\DC2\ETXY\SYN!\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\STX\ETX\DC2\ETXY$%\n\
+    \\234\SOH\n\
+    \\EOT\EOT\ETX\STX\ETX\DC2\ETX_\STX)\SUB\220\SOH Symbols that are \"defined\" within this document.\n\
+    \\n\
+    \ This should include symbols which technically do not have any definition,\n\
+    \ but have a reference and are defined by some other symbol (see\n\
+    \ Relationship.is_definition).\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ETX\EOT\DC2\ETX_\STX\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ETX\ACK\DC2\ETX_\v\FS\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ETX\SOH\DC2\ETX_\GS$\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ETX\ETX\DC2\ETX_'(\n\
+    \\247\ETX\n\
+    \\EOT\EOT\ETX\STX\EOT\DC2\ETXh\STX\DC2\SUB\233\ETX (optional) Text contents of the this document. Indexers are not expected to\n\
+    \ include the text by default. It's preferrable that clients read the text\n\
+    \ contents from the file system by resolving the absolute path from joining\n\
+    \ `Index.metadata.project_root` and `Document.relative_path`. This field was\n\
+    \ introduced to support `SymbolInformation.signature_documentation`, but it\n\
+    \ can be used for other purposes as well, for example testing or when working\n\
+    \ with virtual/in-memory documents.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\EOT\ENQ\DC2\ETXh\STX\b\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\EOT\SOH\DC2\ETXh\t\r\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\EOT\ETX\DC2\ETXh\DLE\DC1\n\
+    \\231\ETX\n\
+    \\EOT\EOT\ETX\STX\ENQ\DC2\ETXt\STX)\SUB\217\ETX Specifies the encoding used for source ranges in this Document.\n\
+    \\n\
+    \ Usually, this will match the type used to index the string type\n\
+    \ in the indexer's implementation language in O(1) time.\n\
+    \ - For an indexer implemented in JVM/.NET language or JavaScript/TypeScript,\n\
+    \   use UTF16CodeUnitOffsetFromLineStart.\n\
+    \ - For an indexer implemented in Python,\n\
+    \   use UTF32CodeUnitOffsetFromLineStart.\n\
+    \ - For an indexer implemented in Go, Rust or C++,\n\
+    \   use UTF8ByteOffsetFromLineStart.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ENQ\ACK\DC2\ETXt\STX\DC2\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ENQ\SOH\DC2\ETXt\DC3$\n\
+    \\f\n\
+    \\ENQ\EOT\ETX\STX\ENQ\ETX\DC2\ETXt'(\n\
+    \Q\n\
+    \\STX\ENQ\STX\DC2\ENQx\NUL\144\SOH\SOH\SUBD Encoding used to interpret the 'character' value in source ranges.\n\
+    \\n\
+    \\n\
+    \\n\
+    \\ETX\ENQ\STX\SOH\DC2\ETXx\ENQ\NAK\n\
+    \\147\SOH\n\
+    \\EOT\ENQ\STX\STX\NUL\DC2\ETX{\STX\"\SUB\133\SOH Default value. This value should not be used by new SCIP indexers\n\
+    \ so that a consumer can process the SCIP index without ambiguity.\n\
+    \\n\
+    \\f\n\
+    \\ENQ\ENQ\STX\STX\NUL\SOH\DC2\ETX{\STX\GS\n\
+    \\f\n\
+    \\ENQ\ENQ\STX\STX\NUL\STX\DC2\ETX{ !\n\
+    \\247\SOH\n\
+    \\EOT\ENQ\STX\STX\SOH\DC2\EOT\130\SOH\STX&\SUB\232\SOH The 'character' value is interpreted as an offset in terms\n\
+    \ of UTF-8 code units (i.e. bytes).\n\
+    \\n\
+    \ Example: For the string \"\240\159\154\128 Woo\" in UTF-8, the bytes are\n\
+    \ [240, 159, 154, 128, 32, 87, 111, 111], so the offset for 'W'\n\
+    \ would be 5.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\SOH\SOH\DC2\EOT\130\SOH\STX!\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\SOH\STX\DC2\EOT\130\SOH$%\n\
+    \\130\STX\n\
+    \\EOT\ENQ\STX\STX\STX\DC2\EOT\137\SOH\STX'\SUB\243\SOH The 'character' value is interpreted as an offset in terms\n\
+    \ of UTF-16 code units (each is 2 bytes).\n\
+    \\n\
+    \ Example: For the string \"\240\159\154\128 Woo\", the UTF-16 code units are\n\
+    \ ['\\ud83d', '\\ude80', ' ', 'W', 'o', 'o'], so the offset for 'W'\n\
+    \ would be 3.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\STX\SOH\DC2\EOT\137\SOH\STX\"\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\STX\STX\DC2\EOT\137\SOH%&\n\
+    \\245\SOH\n\
+    \\EOT\ENQ\STX\STX\ETX\DC2\EOT\143\SOH\STX'\SUB\230\SOH The 'character' value is interpreted as an offset in terms\n\
+    \ of UTF-32 code units (each is 4 bytes).\n\
+    \\n\
+    \ Example: For the string \"\240\159\154\128 Woo\", the UTF-32 code units are\n\
+    \ ['\240\159\154\128', ' ', 'W', 'o', 'o'], so the offset for 'W' would be 2.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\ETX\SOH\DC2\EOT\143\SOH\STX\"\n\
+    \\r\n\
+    \\ENQ\ENQ\STX\STX\ETX\STX\DC2\EOT\143\SOH%&\n\
+    \\204\DC2\n\
+    \\STX\EOT\EOT\DC2\ACK\188\SOH\NUL\192\SOH\SOH\SUB\189\DC2 Symbol is similar to a URI, it identifies a class, method, or a local\n\
+    \ variable. `SymbolInformation` contains rich metadata about symbols such as\n\
+    \ the docstring.\n\
+    \\n\
+    \ Symbol has a standardized string representation, which can be used\n\
+    \ interchangeably with `Symbol`. The syntax for Symbol is the following:\n\
+    \ ```\n\
+    \ # (<x>)+ stands for one or more repetitions of <x>\n\
+    \ # (<x>)? stands for zero or one occurrence of <x>\n\
+    \ <symbol>               ::= <scheme> ' ' <package> ' ' (<descriptor>)+ | 'local ' <local-id>\n\
+    \ <package>              ::= <manager> ' ' <package-name> ' ' <version>\n\
+    \ <scheme>               ::= any UTF-8, escape spaces with double space. Must not be empty nor start with 'local'\n\
+    \ <manager>              ::= any UTF-8, escape spaces with double space. Use the placeholder '.' to indicate an empty value\n\
+    \ <package-name>         ::= same as above\n\
+    \ <version>              ::= same as above\n\
+    \ <descriptor>           ::= <namespace> | <type> | <term> | <method> | <type-parameter> | <parameter> | <meta> | <macro>\n\
+    \ <namespace>            ::= <name> '/'\n\
+    \ <type>                 ::= <name> '#'\n\
+    \ <term>                 ::= <name> '.'\n\
+    \ <meta>                 ::= <name> ':'\n\
+    \ <macro>                ::= <name> '!'\n\
+    \ <method>               ::= <name> '(' (<method-disambiguator>)? ').'\n\
+    \ <type-parameter>       ::= '[' <name> ']'\n\
+    \ <parameter>            ::= '(' <name> ')'\n\
+    \ <name>                 ::= <identifier>\n\
+    \ <method-disambiguator> ::= <simple-identifier>\n\
+    \ <identifier>           ::= <simple-identifier> | <escaped-identifier>\n\
+    \ <simple-identifier>    ::= (<identifier-character>)+\n\
+    \ <identifier-character> ::= '_' | '+' | '-' | '$' | ASCII letter or digit\n\
+    \ <escaped-identifier>   ::= '`' (<escaped-character>)+ '`', must contain at least one non-<identifier-character>\n\
+    \ <escaped-characters>   ::= any UTF-8, escape backticks with double backtick.\n\
+    \ <local-id>             ::= <simple-identifier>\n\
+    \ ```\n\
+    \\n\
+    \ The list of descriptors for a symbol should together form a fully\n\
+    \ qualified name for the symbol. That is, it should serve as a unique\n\
+    \ identifier across the package. Typically, it will include one descriptor\n\
+    \ for every node in the AST (along the ancestry path) between the root of\n\
+    \ the file and the node corresponding to the symbol.\n\
+    \\n\
+    \ Local symbols MUST only be used for entities which are local to a Document,\n\
+    \ and cannot be accessed from outside the Document.\n\
+    \\n\
+    \\v\n\
+    \\ETX\EOT\EOT\SOH\DC2\EOT\188\SOH\b\SO\n\
+    \\f\n\
+    \\EOT\EOT\EOT\STX\NUL\DC2\EOT\189\SOH\STX\DC4\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\NUL\ENQ\DC2\EOT\189\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\NUL\SOH\DC2\EOT\189\SOH\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\NUL\ETX\DC2\EOT\189\SOH\DC2\DC3\n\
+    \\f\n\
+    \\EOT\EOT\EOT\STX\SOH\DC2\EOT\190\SOH\STX\SYN\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\SOH\ACK\DC2\EOT\190\SOH\STX\t\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\SOH\SOH\DC2\EOT\190\SOH\n\
+    \\DC1\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\SOH\ETX\DC2\EOT\190\SOH\DC4\NAK\n\
+    \\f\n\
+    \\EOT\EOT\EOT\STX\STX\DC2\EOT\191\SOH\STX&\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\STX\EOT\DC2\EOT\191\SOH\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\STX\ACK\DC2\EOT\191\SOH\v\NAK\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\STX\SOH\DC2\EOT\191\SOH\SYN!\n\
+    \\r\n\
+    \\ENQ\EOT\EOT\STX\STX\ETX\DC2\EOT\191\SOH$%\n\
+    \q\n\
+    \\STX\EOT\ENQ\DC2\ACK\197\SOH\NUL\201\SOH\SOH\SUBc Unit of packaging and distribution.\n\
+    \\n\
+    \ NOTE: This corresponds to a module in Go and JVM languages.\n\
+    \\n\
+    \\v\n\
+    \\ETX\EOT\ENQ\SOH\DC2\EOT\197\SOH\b\SI\n\
+    \\f\n\
+    \\EOT\EOT\ENQ\STX\NUL\DC2\EOT\198\SOH\STX\NAK\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\NUL\ENQ\DC2\EOT\198\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\NUL\SOH\DC2\EOT\198\SOH\t\DLE\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\NUL\ETX\DC2\EOT\198\SOH\DC3\DC4\n\
+    \\f\n\
+    \\EOT\EOT\ENQ\STX\SOH\DC2\EOT\199\SOH\STX\DC2\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\SOH\ENQ\DC2\EOT\199\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\SOH\SOH\DC2\EOT\199\SOH\t\r\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\SOH\ETX\DC2\EOT\199\SOH\DLE\DC1\n\
+    \\f\n\
+    \\EOT\EOT\ENQ\STX\STX\DC2\EOT\200\SOH\STX\NAK\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\STX\ENQ\DC2\EOT\200\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\STX\SOH\DC2\EOT\200\SOH\t\DLE\n\
+    \\r\n\
+    \\ENQ\EOT\ENQ\STX\STX\ETX\DC2\EOT\200\SOH\DC3\DC4\n\
+    \\f\n\
+    \\STX\EOT\ACK\DC2\ACK\203\SOH\NUL\228\SOH\SOH\n\
+    \\v\n\
+    \\ETX\EOT\ACK\SOH\DC2\EOT\203\SOH\b\DC2\n\
+    \\SO\n\
+    \\EOT\EOT\ACK\EOT\NUL\DC2\ACK\204\SOH\STX\222\SOH\ETX\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\EOT\NUL\SOH\DC2\EOT\204\SOH\a\r\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\EOT\NUL\ETX\DC2\EOT\205\SOH\EOT\RS\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\ETX\STX\DC2\EOT\205\SOH\EOT\RS\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\NUL\DC2\EOT\206\SOH\EOT\SUB\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\NUL\SOH\DC2\EOT\206\SOH\EOT\NAK\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\NUL\STX\DC2\EOT\206\SOH\CAN\EM\n\
+    \}\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\SOH\DC2\EOT\210\SOH\EOT\DC2\SUBm Unit of code abstraction and/or namespacing.\n\
+    \\n\
+    \ NOTE: This corresponds to a package in Go and JVM languages.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\SOH\SOH\DC2\EOT\210\SOH\EOT\r\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\SOH\STX\DC2\EOT\210\SOH\DLE\DC1\n\
+    \(\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\STX\DC2\EOT\212\SOH\EOT\"\SUB\CAN Use Namespace instead.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\STX\SOH\DC2\EOT\212\SOH\EOT\v\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\STX\STX\DC2\EOT\212\SOH\SO\SI\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\STX\ETX\DC2\EOT\212\SOH\DLE!\n\
+    \\DLE\n\
+    \\b\EOT\ACK\EOT\NUL\STX\STX\ETX\SOH\DC2\EOT\212\SOH\DC1 \n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\ETX\DC2\EOT\213\SOH\EOT\r\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ETX\SOH\DC2\EOT\213\SOH\EOT\b\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ETX\STX\DC2\EOT\213\SOH\v\f\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\EOT\DC2\EOT\214\SOH\EOT\r\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\EOT\SOH\DC2\EOT\214\SOH\EOT\b\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\EOT\STX\DC2\EOT\214\SOH\v\f\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\ENQ\DC2\EOT\215\SOH\EOT\SI\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ENQ\SOH\DC2\EOT\215\SOH\EOT\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ENQ\STX\DC2\EOT\215\SOH\r\SO\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\ACK\DC2\EOT\216\SOH\EOT\SYN\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ACK\SOH\DC2\EOT\216\SOH\EOT\DC1\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\ACK\STX\DC2\EOT\216\SOH\DC4\NAK\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\a\DC2\EOT\217\SOH\EOT\DC2\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\a\SOH\DC2\EOT\217\SOH\EOT\r\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\a\STX\DC2\EOT\217\SOH\DLE\DC1\n\
+    \.\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\b\DC2\EOT\219\SOH\EOT\r\SUB\RS Can be used for any purpose.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\b\SOH\DC2\EOT\219\SOH\EOT\b\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\b\STX\DC2\EOT\219\SOH\v\f\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\t\DC2\EOT\220\SOH\EOT\SO\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\t\SOH\DC2\EOT\220\SOH\EOT\t\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\t\STX\DC2\EOT\220\SOH\f\r\n\
+    \\SO\n\
+    \\ACK\EOT\ACK\EOT\NUL\STX\n\
+    \\DC2\EOT\221\SOH\EOT\SO\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\n\
+    \\SOH\DC2\EOT\221\SOH\EOT\t\n\
+    \\SI\n\
+    \\a\EOT\ACK\EOT\NUL\STX\n\
+    \\STX\DC2\EOT\221\SOH\f\r\n\
+    \\f\n\
+    \\EOT\EOT\ACK\STX\NUL\DC2\EOT\223\SOH\STX\DC2\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\NUL\ENQ\DC2\EOT\223\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\NUL\SOH\DC2\EOT\223\SOH\t\r\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\NUL\ETX\DC2\EOT\223\SOH\DLE\DC1\n\
+    \\f\n\
+    \\EOT\EOT\ACK\STX\SOH\DC2\EOT\224\SOH\STX\ESC\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\SOH\ENQ\DC2\EOT\224\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\SOH\SOH\DC2\EOT\224\SOH\t\SYN\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\SOH\ETX\DC2\EOT\224\SOH\EM\SUB\n\
+    \\130\SOH\n\
+    \\EOT\EOT\ACK\STX\STX\DC2\EOT\225\SOH\STX\DC4\"t NOTE: If you add new fields here, make sure to update the prepareSlot()\n\
+    \ function responsible for parsing symbols.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\STX\ACK\DC2\EOT\225\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\STX\SOH\DC2\EOT\225\SOH\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\ACK\STX\STX\ETX\DC2\EOT\225\SOH\DC2\DC3\n\
+    \\131\SOH\n\
+    \\STX\EOT\a\DC2\ACK\232\SOH\NUL\186\ETX\SOH\SUBu SymbolInformation defines metadata about a symbol, such as the symbol's\n\
+    \ docstring or what package it's defined it.\n\
+    \\n\
+    \\v\n\
+    \\ETX\EOT\a\SOH\DC2\EOT\232\SOH\b\EM\n\
+    \\160\SOH\n\
+    \\EOT\EOT\a\STX\NUL\DC2\EOT\235\SOH\STX\DC4\SUB\145\SOH Identifier of this symbol, which can be referenced from `Occurence.symbol`.\n\
+    \ The string must be formatted according to the grammar in `Symbol`.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\NUL\ENQ\DC2\EOT\235\SOH\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\NUL\SOH\DC2\EOT\235\SOH\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\NUL\ETX\DC2\EOT\235\SOH\DC2\DC3\n\
+    \\180\ETX\n\
+    \\EOT\EOT\a\STX\SOH\DC2\EOT\242\SOH\STX$\SUB\165\ETX (optional, but strongly recommended) The markdown-formatted documentation\n\
+    \ for this symbol. Use `SymbolInformation.signature_documentation` to\n\
+    \ document the method/class/type signature of this symbol.\n\
+    \ Due to historical reasons, indexers may include signature documentation in\n\
+    \ this field by rendering markdown code blocks. New indexers should only\n\
+    \ include non-code documentation in this field, for example docstrings.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\SOH\EOT\DC2\EOT\242\SOH\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\SOH\ENQ\DC2\EOT\242\SOH\v\DC1\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\SOH\SOH\DC2\EOT\242\SOH\DC2\US\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\SOH\ETX\DC2\EOT\242\SOH\"#\n\
+    \^\n\
+    \\EOT\EOT\a\STX\STX\DC2\EOT\244\SOH\STX*\SUBP (optional) Relationships to other symbols (e.g., implements, type definition).\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\STX\EOT\DC2\EOT\244\SOH\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\STX\ACK\DC2\EOT\244\SOH\v\ETB\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\STX\SOH\DC2\EOT\244\SOH\CAN%\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\STX\ETX\DC2\EOT\244\SOH()\n\
+    \\164\SOH\n\
+    \\EOT\EOT\a\STX\ETX\DC2\EOT\248\SOH\STX\DLE\SUB\149\SOH The kind of this symbol. Use this field instead of\n\
+    \ `SymbolDescriptor.Suffix` to determine whether something is, for example, a\n\
+    \ class or a method.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ETX\ACK\DC2\EOT\248\SOH\STX\ACK\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ETX\SOH\DC2\EOT\248\SOH\a\v\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ETX\ETX\DC2\EOT\248\SOH\SO\SI\n\
+    \\245\ENQ\n\
+    \\EOT\EOT\a\EOT\NUL\DC2\ACK\135\STX\STX\150\ETX\ETX\SUB\228\ENQ (optional) Kind represents the fine-grained category of a symbol, suitable for presenting\n\
+    \ information about the symbol's meaning in the language.\n\
+    \\n\
+    \ For example:\n\
+    \ - A Java method would have the kind `Method` while a Go function would\n\
+    \   have the kind `Function`, even if the symbols for these use the same\n\
+    \   syntax for the descriptor `SymbolDescriptor.Suffix.Method`.\n\
+    \ - A Go struct has the symbol kind `Struct` while a Java class has\n\
+    \   the symbol kind `Class` even if they both have the same descriptor:\n\
+    \   `SymbolDescriptor.Suffix.Type`.\n\
+    \\n\
+    \ Since Kind is more fine-grained than Suffix:\n\
+    \ - If two symbols have the same Kind, they should share the same Suffix.\n\
+    \ - If two symbols have different Suffixes, they should have different Kinds.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\EOT\NUL\SOH\DC2\EOT\135\STX\a\v\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\NUL\DC2\EOT\136\STX\ACK\SUB\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\NUL\SOH\DC2\EOT\136\STX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\NUL\STX\DC2\EOT\136\STX\CAN\EM\n\
+    \R\n\
+    \\ACK\EOT\a\EOT\NUL\STX\SOH\DC2\EOT\138\STX\ACK\SUB\SUBB A method which may or may not have a body. For Java, Kotlin etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SOH\SOH\DC2\EOT\138\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SOH\STX\DC2\EOT\138\STX\ETB\EM\n\
+    \*\n\
+    \\ACK\EOT\a\EOT\NUL\STX\STX\DC2\EOT\140\STX\ACK\DC4\SUB\SUB For Ruby's attr_accessor\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\STX\SOH\DC2\EOT\140\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\STX\STX\DC2\EOT\140\STX\DC1\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\ETX\DC2\EOT\141\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ETX\SOH\DC2\EOT\141\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ETX\STX\DC2\EOT\141\STX\SO\SI\n\
+    \\ESC\n\
+    \\ACK\EOT\a\EOT\NUL\STX\EOT\DC2\EOT\143\STX\ACK\DC4\SUB\v For Alloy\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\EOT\SOH\DC2\EOT\143\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\EOT\STX\DC2\EOT\143\STX\DC2\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\ENQ\DC2\EOT\144\STX\ACK\EM\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ENQ\SOH\DC2\EOT\144\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ENQ\STX\DC2\EOT\144\STX\ETB\CAN\n\
+    \\EM\n\
+    \\ACK\EOT\a\EOT\NUL\STX\ACK\DC2\EOT\146\STX\ACK\DC4\SUB\t For C++\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ACK\SOH\DC2\EOT\146\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ACK\STX\DC2\EOT\146\STX\DC2\DC3\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX\a\DC2\EOT\148\STX\ACK\DLE\SUB\n\
+    \ For Lean\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\a\SOH\DC2\EOT\148\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\a\STX\DC2\EOT\148\STX\SO\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\b\DC2\EOT\149\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\b\SOH\DC2\EOT\149\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\b\STX\DC2\EOT\149\STX\DLE\DC1\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\t\DC2\EOT\150\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\t\SOH\DC2\EOT\150\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\t\STX\DC2\EOT\150\STX\SO\SI\n\
+    \\EM\n\
+    \\ACK\EOT\a\EOT\NUL\STX\n\
+    \\DC2\EOT\152\STX\ACK\DC3\SUB\t For C++\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\n\
+    \\SOH\DC2\EOT\152\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\n\
+    \\STX\DC2\EOT\152\STX\DLE\DC2\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\v\DC2\EOT\153\STX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\v\SOH\DC2\EOT\153\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\v\STX\DC2\EOT\153\STX\DC1\DC2\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\f\DC2\EOT\154\STX\ACK\SYN\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\f\SOH\DC2\EOT\154\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\f\STX\DC2\EOT\154\STX\DC4\NAK\n\
+    \\RS\n\
+    \\ACK\EOT\a\EOT\NUL\STX\r\DC2\EOT\156\STX\ACK\DC4\SUB\SO For Solidity\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\r\SOH\DC2\EOT\156\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\r\STX\DC2\EOT\156\STX\DC1\DC3\n\
+    \\GS\n\
+    \\ACK\EOT\a\EOT\NUL\STX\SO\DC2\EOT\158\STX\ACK\SYN\SUB\r For Haskell\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SO\SOH\DC2\EOT\158\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SO\STX\DC2\EOT\158\STX\DC3\NAK\n\
+    \\US\n\
+    \\ACK\EOT\a\EOT\NUL\STX\SI\DC2\EOT\160\STX\ACK\DC4\SUB\SI For C# and F#\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SI\SOH\DC2\EOT\160\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SI\STX\DC2\EOT\160\STX\DC1\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\DLE\DC2\EOT\161\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DLE\SOH\DC2\EOT\161\STX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DLE\STX\DC2\EOT\161\STX\r\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\DC1\DC2\EOT\162\STX\ACK\SYN\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC1\SOH\DC2\EOT\162\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC1\STX\DC2\EOT\162\STX\DC3\NAK\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\DC2\DC2\EOT\163\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC2\SOH\DC2\EOT\163\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC2\STX\DC2\EOT\163\STX\SO\DLE\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\DC3\DC2\EOT\164\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC3\SOH\DC2\EOT\164\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC3\STX\DC2\EOT\164\STX\SO\DLE\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX\DC4\DC2\EOT\166\STX\ACK\NAK\SUB\n\
+    \ For Dart\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC4\SOH\DC2\EOT\166\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\DC4\STX\DC2\EOT\166\STX\DC2\DC4\n\
+    \\ESC\n\
+    \\ACK\EOT\a\EOT\NUL\STX\NAK\DC2\EOT\168\STX\ACK\DLE\SUB\v For Alloy\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\NAK\SOH\DC2\EOT\168\STX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\NAK\STX\DC2\EOT\168\STX\r\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\SYN\DC2\EOT\169\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SYN\SOH\DC2\EOT\169\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SYN\STX\DC2\EOT\169\STX\SO\DLE\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\ETB\DC2\EOT\170\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ETB\SOH\DC2\EOT\170\STX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ETB\STX\DC2\EOT\170\STX\r\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\CAN\DC2\EOT\171\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\CAN\SOH\DC2\EOT\171\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\CAN\STX\DC2\EOT\171\STX\DC1\DC3\n\
+    \;\n\
+    \\ACK\EOT\a\EOT\NUL\STX\EM\DC2\EOT\173\STX\ACK\DC2\SUB+ For 'get' in Swift, 'attr_reader' in Ruby\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\EM\SOH\DC2\EOT\173\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\EM\STX\DC2\EOT\173\STX\SI\DC1\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX\SUB\DC2\EOT\175\STX\ACK\DC3\SUB\n\
+    \ For Raku\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SUB\SOH\DC2\EOT\175\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\SUB\STX\DC2\EOT\175\STX\DLE\DC2\n\
+    \)\n\
+    \\ACK\EOT\a\EOT\NUL\STX\ESC\DC2\EOT\177\STX\ACK\DC4\SUB\EM For Purescript and Lean\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ESC\SOH\DC2\EOT\177\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\ESC\STX\DC2\EOT\177\STX\DC1\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\FS\DC2\EOT\178\STX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\FS\SOH\DC2\EOT\178\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\FS\STX\DC2\EOT\178\STX\DC2\DC4\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\GS\DC2\EOT\179\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\GS\SOH\DC2\EOT\179\STX\ACK\t\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\GS\STX\DC2\EOT\179\STX\f\SO\n\
+    \\FS\n\
+    \\ACK\EOT\a\EOT\NUL\STX\RS\DC2\EOT\181\STX\ACK\DLE\SUB\f For Racket\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\RS\SOH\DC2\EOT\181\STX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\RS\STX\DC2\EOT\181\STX\r\SI\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX\US\DC2\EOT\183\STX\ACK\DC1\SUB\n\
+    \ For Lean\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\US\SOH\DC2\EOT\183\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\US\STX\DC2\EOT\183\STX\SO\DLE\n\
+    \\RS\n\
+    \\ACK\EOT\a\EOT\NUL\STX \DC2\EOT\185\STX\ACK\DC3\SUB\SO For solidity\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX \SOH\DC2\EOT\185\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX \STX\DC2\EOT\185\STX\DLE\DC2\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX!\DC2\EOT\186\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX!\SOH\DC2\EOT\186\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX!\STX\DC2\EOT\186\STX\SO\DLE\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX\"\DC2\EOT\187\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\"\SOH\DC2\EOT\187\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX\"\STX\DC2\EOT\187\STX\SI\DC1\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX#\DC2\EOT\189\STX\ACK\ETB\SUB\n\
+    \ For Ruby\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX#\SOH\DC2\EOT\189\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX#\STX\DC2\EOT\189\STX\DC4\SYN\n\
+    \\148\SOH\n\
+    \\ACK\EOT\a\EOT\NUL\STX$\DC2\EOT\192\STX\ACK\SUB\SUB\131\SOH Analogous to 'ThisParameter' and 'SelfParameter', but for languages\n\
+    \ like Go where the receiver doesn't have a conventional name.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX$\SOH\DC2\EOT\192\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX$\STX\DC2\EOT\192\STX\ETB\EM\n\
+    \8\n\
+    \\ACK\EOT\a\EOT\NUL\STX%\DC2\EOT\194\STX\ACK\US\SUB( Analogous to 'AbstractMethod', for Go.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX%\SOH\DC2\EOT\194\STX\ACK\EM\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX%\STX\DC2\EOT\194\STX\FS\RS\n\
+    \\RS\n\
+    \\ACK\EOT\a\EOT\NUL\STX&\DC2\EOT\196\STX\ACK\DC3\SUB\SO For Protobuf\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX&\SOH\DC2\EOT\196\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX&\STX\DC2\EOT\196\STX\DLE\DC2\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX'\DC2\EOT\198\STX\ACK\DC1\SUB\n\
+    \ For Dart\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX'\SOH\DC2\EOT\198\STX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX'\STX\DC2\EOT\198\STX\SO\DLE\n\
+    \\RS\n\
+    \\ACK\EOT\a\EOT\NUL\STX(\DC2\EOT\200\STX\ACK\DC4\SUB\SO For Solidity\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX(\SOH\DC2\EOT\200\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX(\STX\DC2\EOT\200\STX\DC1\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX)\DC2\EOT\201\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX)\SOH\DC2\EOT\201\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX)\STX\DC2\EOT\201\STX\SI\DC1\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX*\DC2\EOT\202\STX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX*\SOH\DC2\EOT\202\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX*\STX\DC2\EOT\202\STX\DC2\DC4\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX+\DC2\EOT\203\STX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX+\SOH\DC2\EOT\203\STX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX+\STX\DC2\EOT\203\STX\r\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX,\DC2\EOT\204\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX,\SOH\DC2\EOT\204\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX,\STX\DC2\EOT\204\STX\SI\DC1\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX-\DC2\EOT\205\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX-\SOH\DC2\EOT\205\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX-\STX\DC2\EOT\205\STX\SI\DC1\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX.\DC2\EOT\206\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX.\SOH\DC2\EOT\206\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX.\STX\DC2\EOT\206\STX\DC1\DC3\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX/\DC2\EOT\207\STX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX/\SOH\DC2\EOT\207\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX/\STX\DC2\EOT\207\STX\DLE\DC2\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX0\DC2\EOT\208\STX\ACK\EM\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX0\SOH\DC2\EOT\208\STX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX0\STX\DC2\EOT\208\STX\SYN\CAN\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX1\DC2\EOT\209\STX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX1\SOH\DC2\EOT\209\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX1\STX\DC2\EOT\209\STX\DC2\DC4\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX2\DC2\EOT\210\STX\ACK\SUB\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX2\SOH\DC2\EOT\210\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX2\STX\DC2\EOT\210\STX\ETB\EM\n\
+    \/\n\
+    \\ACK\EOT\a\EOT\NUL\STX3\DC2\EOT\212\STX\ACK\DC3\SUB\US For Haskell's PatternSynonyms\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX3\SOH\DC2\EOT\212\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX3\STX\DC2\EOT\212\STX\DLE\DC2\n\
+    \\ESC\n\
+    \\ACK\EOT\a\EOT\NUL\STX4\DC2\EOT\214\STX\ACK\NAK\SUB\v For Alloy\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX4\SOH\DC2\EOT\214\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX4\STX\DC2\EOT\214\STX\DC2\DC4\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STX5\DC2\EOT\215\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX5\SOH\DC2\EOT\215\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX5\STX\DC2\EOT\215\STX\DC1\DC3\n\
+    \Q\n\
+    \\ACK\EOT\a\EOT\NUL\STX6\DC2\EOT\217\STX\ACK\DC4\SUBA Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX6\SOH\DC2\EOT\217\STX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX6\STX\DC2\EOT\217\STX\DC1\DC3\n\
+    \K\n\
+    \\ACK\EOT\a\EOT\NUL\STX7\DC2\EOT\219\STX\ACK\SUB\SUB; Analogous to 'AbstractMethod', for Swift and Objective-C.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX7\SOH\DC2\EOT\219\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX7\STX\DC2\EOT\219\STX\ETB\EM\n\
+    \9\n\
+    \\ACK\EOT\a\EOT\NUL\STX8\DC2\EOT\221\STX\ACK\GS\SUB) Analogous to 'AbstractMethod', for C++.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX8\SOH\DC2\EOT\221\STX\ACK\ETB\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX8\STX\DC2\EOT\221\STX\SUB\FS\n\
+    \\GS\n\
+    \\ACK\EOT\a\EOT\NUL\STX9\DC2\EOT\223\STX\ACK\ETB\SUB\r For Haskell\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX9\SOH\DC2\EOT\223\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX9\STX\DC2\EOT\223\STX\DC4\SYN\n\
+    \4\n\
+    \\ACK\EOT\a\EOT\NUL\STX:\DC2\EOT\225\STX\ACK\EM\SUB$ 'self' in Python, Rust, Swift etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX:\SOH\DC2\EOT\225\STX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX:\STX\DC2\EOT\225\STX\SYN\CAN\n\
+    \;\n\
+    \\ACK\EOT\a\EOT\NUL\STX;\DC2\EOT\227\STX\ACK\DC2\SUB+ For 'set' in Swift, 'attr_writer' in Ruby\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX;\SOH\DC2\EOT\227\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX;\STX\DC2\EOT\227\STX\SI\DC1\n\
+    \3\n\
+    \\ACK\EOT\a\EOT\NUL\STX<\DC2\EOT\229\STX\ACK\NAK\SUB# For Alloy, analogous to 'Struct'.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX<\SOH\DC2\EOT\229\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX<\STX\DC2\EOT\229\STX\DC2\DC4\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STX=\DC2\EOT\231\STX\ACK\SUB\SUB\n\
+    \ For Ruby\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX=\SOH\DC2\EOT\231\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX=\STX\DC2\EOT\231\STX\ETB\EM\n\
+    \8\n\
+    \\ACK\EOT\a\EOT\NUL\STX>\DC2\EOT\233\STX\ACK\ESC\SUB( Analogous to 'StaticMethod', for Ruby.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX>\SOH\DC2\EOT\233\STX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX>\STX\DC2\EOT\233\STX\CAN\SUB\n\
+    \5\n\
+    \\ACK\EOT\a\EOT\NUL\STX?\DC2\EOT\235\STX\ACK\FS\SUB% Analogous to 'StaticField', for C++\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX?\SOH\DC2\EOT\235\STX\ACK\SYN\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX?\STX\DC2\EOT\235\STX\EM\ESC\n\
+    \\CAN\n\
+    \\ACK\EOT\a\EOT\NUL\STX@\DC2\EOT\237\STX\ACK\ETB\SUB\b For C#\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX@\SOH\DC2\EOT\237\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STX@\STX\DC2\EOT\237\STX\DC4\SYN\n\
+    \\CAN\n\
+    \\ACK\EOT\a\EOT\NUL\STXA\DC2\EOT\239\STX\ACK\ETB\SUB\b For C#\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXA\SOH\DC2\EOT\239\STX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXA\STX\DC2\EOT\239\STX\DC4\SYN\n\
+    \(\n\
+    \\ACK\EOT\a\EOT\NUL\STXB\DC2\EOT\241\STX\ACK\CAN\SUB\CAN For Java, C#, C++ etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXB\SOH\DC2\EOT\241\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXB\STX\DC2\EOT\241\STX\NAK\ETB\n\
+    \)\n\
+    \\ACK\EOT\a\EOT\NUL\STXC\DC2\EOT\243\STX\ACK\SUB\SUB\EM For C#, TypeScript etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXC\SOH\DC2\EOT\243\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXC\STX\DC2\EOT\243\STX\ETB\EM\n\
+    \\FS\n\
+    \\ACK\EOT\a\EOT\NUL\STXD\DC2\EOT\245\STX\ACK\SUB\SUB\f For C, C++\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXD\SOH\DC2\EOT\245\STX\ACK\DC4\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXD\STX\DC2\EOT\245\STX\ETB\EM\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STXE\DC2\EOT\246\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXE\SOH\DC2\EOT\246\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXE\STX\DC2\EOT\246\STX\SI\DC1\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STXF\DC2\EOT\247\STX\ACK\DC2\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXF\SOH\DC2\EOT\247\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXF\STX\DC2\EOT\247\STX\SI\DC1\n\
+    \\ESC\n\
+    \\ACK\EOT\a\EOT\NUL\STXG\DC2\EOT\249\STX\ACK\NAK\SUB\v For Swift\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXG\SOH\DC2\EOT\249\STX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXG\STX\DC2\EOT\249\STX\DC2\DC4\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STXH\DC2\EOT\251\STX\ACK\DC2\SUB\n\
+    \ For Lean\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXH\SOH\DC2\EOT\251\STX\ACK\f\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXH\STX\DC2\EOT\251\STX\SI\DC1\n\
+    \\SUB\n\
+    \\ACK\EOT\a\EOT\NUL\STXI\DC2\EOT\253\STX\ACK\DC3\SUB\n\
+    \ For Lean\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXI\SOH\DC2\EOT\253\STX\ACK\r\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXI\STX\DC2\EOT\253\STX\DLE\DC2\n\
+    \U\n\
+    \\ACK\EOT\a\EOT\NUL\STXJ\DC2\EOT\128\ETX\ACK\EM\SUBE Method receiver for languages\n\
+    \ 'this' in JavaScript, C++, Java etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXJ\SOH\DC2\EOT\128\ETX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXJ\STX\DC2\EOT\128\ETX\SYN\CAN\n\
+    \O\n\
+    \\ACK\EOT\a\EOT\NUL\STXK\DC2\EOT\130\ETX\ACK\DC1\SUB? Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXK\SOH\DC2\EOT\130\ETX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXK\STX\DC2\EOT\130\ETX\SO\DLE\n\
+    \E\n\
+    \\ACK\EOT\a\EOT\NUL\STXL\DC2\EOT\132\ETX\ACK\ETB\SUB5 Analogous to 'AbstractMethod', for Rust, Scala etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXL\SOH\DC2\EOT\132\ETX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXL\STX\DC2\EOT\132\ETX\DC4\SYN\n\
+    \\137\SOH\n\
+    \\ACK\EOT\a\EOT\NUL\STXM\DC2\EOT\135\ETX\ACK\DLE\SUBy Data type definition for languages like OCaml which use `type`\n\
+    \ rather than separate keywords like `struct` and `enum`.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXM\SOH\DC2\EOT\135\ETX\ACK\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXM\STX\DC2\EOT\135\ETX\r\SI\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STXN\DC2\EOT\136\ETX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXN\SOH\DC2\EOT\136\ETX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXN\STX\DC2\EOT\136\ETX\DC2\DC4\n\
+    \S\n\
+    \\ACK\EOT\a\EOT\NUL\STXO\DC2\EOT\138\ETX\ACK\NAK\SUBC Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXO\SOH\DC2\EOT\138\ETX\ACK\SI\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXO\STX\DC2\EOT\138\ETX\DC2\DC4\n\
+    \M\n\
+    \\ACK\EOT\a\EOT\NUL\STXP\DC2\EOT\140\ETX\ACK\ESC\SUB= Analogous to 'AbstractMethod', for Haskell, Purescript etc.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXP\SOH\DC2\EOT\140\ETX\ACK\NAK\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXP\STX\DC2\EOT\140\ETX\CAN\SUB\n\
+    \\GS\n\
+    \\ACK\EOT\a\EOT\NUL\STXQ\DC2\EOT\142\ETX\ACK\SYN\SUB\r For Haskell\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXQ\SOH\DC2\EOT\142\ETX\ACK\DLE\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXQ\STX\DC2\EOT\142\ETX\DC3\NAK\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STXR\DC2\EOT\143\ETX\ACK\EM\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXR\SOH\DC2\EOT\143\ETX\ACK\DC3\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXR\STX\DC2\EOT\143\ETX\SYN\CAN\n\
+    \(\n\
+    \\ACK\EOT\a\EOT\NUL\STXS\DC2\EOT\145\ETX\ACK\DC1\SUB\CAN For C, C++, Capn Proto\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXS\SOH\DC2\EOT\145\ETX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXS\STX\DC2\EOT\145\ETX\SO\DLE\n\
+    \\SO\n\
+    \\ACK\EOT\a\EOT\NUL\STXT\DC2\EOT\146\ETX\ACK\DC1\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXT\SOH\DC2\EOT\146\ETX\ACK\v\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXT\STX\DC2\EOT\146\ETX\SO\DLE\n\
+    \[\n\
+    \\ACK\EOT\a\EOT\NUL\STXU\DC2\EOT\147\ETX\ACK\DC4\"K Next = 87;\n\
+    \ Feel free to open a PR proposing new language-specific kinds.\n\
+    \\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXU\SOH\DC2\EOT\147\ETX\ACK\SO\n\
+    \\SI\n\
+    \\a\EOT\a\EOT\NUL\STXU\STX\DC2\EOT\147\ETX\DC1\DC3\n\
+    \\243\ETX\n\
+    \\EOT\EOT\a\STX\EOT\DC2\EOT\160\ETX\STX\SUB\SUB\228\ETX (optional) The name of this symbol as it should be displayed to the user.\n\
+    \ For example, the symbol \"com/example/MyClass#myMethod(+1).\" should have the\n\
+    \ display name \"myMethod\". The `symbol` field is not a reliable source of\n\
+    \ the display name for several reasons:\n\
+    \\n\
+    \ - Local symbols don't encode the name.\n\
+    \ - Some languages have case-insensitive names, so the symbol is all-lowercase.\n\
+    \ - The symbol may encode names with special characters that should not be\n\
+    \   displayed to the user.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\EOT\ENQ\DC2\EOT\160\ETX\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\EOT\SOH\DC2\EOT\160\ETX\t\NAK\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\EOT\ETX\DC2\EOT\160\ETX\CAN\EM\n\
+    \\196\ETX\n\
+    \\EOT\EOT\a\STX\ENQ\DC2\EOT\167\ETX\STX'\SUB\181\ETX (optional) The signature of this symbol as it's displayed in API\n\
+    \ documentation or in hover tooltips. For example, a Java method that adds\n\
+    \ two numbers this would have `Document.language = \"java\"` and `Document.text\n\
+    \ = \"void add(int a, int b)\". The `language` and `text` fields are required\n\
+    \ while other fields such as `Documentation.occurrences` can be optionally\n\
+    \ included to support hyperlinking referenced symbols in the signature.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ENQ\ACK\DC2\EOT\167\ETX\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ENQ\SOH\DC2\EOT\167\ETX\v\"\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ENQ\ETX\DC2\EOT\167\ETX%&\n\
+    \\201\b\n\
+    \\EOT\EOT\a\STX\ACK\DC2\EOT\185\ETX\STX\RS\SUB\186\b (optional) The enclosing symbol if this is a local symbol.  For non-local\n\
+    \ symbols, the enclosing symbol should be parsed from the `symbol` field\n\
+    \ using the `Descriptor` grammar.\n\
+    \\n\
+    \ The primary use-case for this field is to allow local symbol to be displayed\n\
+    \ in a symbol hierarchy for API documentation. It's OK to leave this field\n\
+    \ empty for local variables since local variables usually don't belong in API\n\
+    \ documentation. However, in the situation that you wish to include a local\n\
+    \ symbol in the hierarchy, then you can use `enclosing_symbol` to locate the\n\
+    \ \"parent\" or \"owner\" of this local symbol. For example, a Java indexer may\n\
+    \ choose to use local symbols for private class fields while providing an\n\
+    \ `enclosing_symbol` to reference the enclosing class to allow the field to\n\
+    \ be part of the class documentation hierarchy. From the perspective of an\n\
+    \ author of an indexer, the decision to use a local symbol or global symbol\n\
+    \ should exclusively be determined whether the local symbol is accessible\n\
+    \ outside the document, not by the capability to find the enclosing\n\
+    \ symbol.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ACK\ENQ\DC2\EOT\185\ETX\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ACK\SOH\DC2\EOT\185\ETX\t\EM\n\
+    \\r\n\
+    \\ENQ\EOT\a\STX\ACK\ETX\DC2\EOT\185\ETX\FS\GS\n\
+    \\f\n\
+    \\STX\EOT\b\DC2\ACK\189\ETX\NUL\245\ETX\SOH\n\
+    \\v\n\
+    \\ETX\EOT\b\SOH\DC2\EOT\189\ETX\b\DC4\n\
+    \\f\n\
+    \\EOT\EOT\b\STX\NUL\DC2\EOT\190\ETX\STX\DC4\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\NUL\ENQ\DC2\EOT\190\ETX\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\NUL\SOH\DC2\EOT\190\ETX\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\NUL\ETX\DC2\EOT\190\ETX\DC2\DC3\n\
+    \\222\b\n\
+    \\EOT\EOT\b\STX\SOH\DC2\EOT\215\ETX\STX\CAN\SUB\207\b When resolving \"Find references\", this field documents what other symbols\n\
+    \ should be included together with this symbol. For example, consider the\n\
+    \ following TypeScript code that defines two symbols `Animal#sound()` and\n\
+    \ `Dog#sound()`:\n\
+    \ ```ts\n\
+    \ interface Animal {\n\
+    \           ^^^^^^ definition Animal#\n\
+    \   sound(): string\n\
+    \   ^^^^^ definition Animal#sound()\n\
+    \ }\n\
+    \ class Dog implements Animal {\n\
+    \       ^^^ definition Dog#, relationships = [{symbol: \"Animal#\", is_implementation: true}]\n\
+    \   public sound(): string { return \"woof\" }\n\
+    \          ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), relationships = [{symbol: \"Animal#sound()\", is_implementation:true, is_reference: true}]\n\
+    \ }\n\
+    \ const animal: Animal = new Dog()\n\
+    \               ^^^^^^ reference Animal#\n\
+    \ console.log(animal.sound())\n\
+    \                    ^^^^^ reference Animal#sound()\n\
+    \ ```\n\
+    \ Doing \"Find references\" on the symbol `Animal#sound()` should return\n\
+    \ references to the `Dog#sound()` method as well. Vice-versa, doing \"Find\n\
+    \ references\" on the `Dog#sound()` method should include references to the\n\
+    \ `Animal#sound()` method as well.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\SOH\ENQ\DC2\EOT\215\ETX\STX\ACK\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\SOH\SOH\DC2\EOT\215\ETX\a\DC3\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\SOH\ETX\DC2\EOT\215\ETX\SYN\ETB\n\
+    \\238\ETX\n\
+    \\EOT\EOT\b\STX\STX\DC2\EOT\224\ETX\STX\GS\SUB\223\ETX Similar to `is_reference` but for \"Find implementations\".\n\
+    \ It's common for `is_implementation` and `is_reference` to both be true but\n\
+    \ it's not always the case.\n\
+    \ In the TypeScript example above, observe that `Dog#` has an\n\
+    \ `is_implementation` relationship with `\"Animal#\"` but not `is_reference`.\n\
+    \ This is because \"Find references\" on the \"Animal#\" symbol should not return\n\
+    \ \"Dog#\". We only want \"Dog#\" to return as a result for \"Find\n\
+    \ implementations\" on the \"Animal#\" symbol.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\STX\ENQ\DC2\EOT\224\ETX\STX\ACK\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\STX\SOH\DC2\EOT\224\ETX\a\CAN\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\STX\ETX\DC2\EOT\224\ETX\ESC\FS\n\
+    \P\n\
+    \\EOT\EOT\b\STX\ETX\DC2\EOT\226\ETX\STX\RS\SUBB Similar to `references_symbols` but for \"Go to type definition\".\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\ETX\ENQ\DC2\EOT\226\ETX\STX\ACK\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\ETX\SOH\DC2\EOT\226\ETX\a\EM\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\ETX\ETX\DC2\EOT\226\ETX\FS\GS\n\
+    \\167\a\n\
+    \\EOT\EOT\b\STX\EOT\DC2\EOT\243\ETX\STX\EM\SUB\213\ACK Allows overriding the behavior of \"Go to definition\" and \"Find references\"\n\
+    \ for symbols which do not have a definition of their own or could\n\
+    \ potentially have multiple definitions.\n\
+    \\n\
+    \ For example, in a language with single inheritance and no field overriding,\n\
+    \ inherited fields can reuse the same symbol as the ancestor which declares\n\
+    \ the field. In such a situation, is_definition is not needed.\n\
+    \\n\
+    \ On the other hand, in languages with single inheritance and some form\n\
+    \ of mixins, you can use is_definition to relate the symbol to the\n\
+    \ matching symbol in ancestor classes, and is_reference to relate the\n\
+    \ symbol to the matching symbol in mixins.\n\
+    \\n\
+    \ NOTE: At the moment, due to limitations of the SCIP to LSIF conversion,\n\
+    \ only global symbols in an index are allowed to use is_definition.\n\
+    \ The relationship may not get recorded if either symbol is local.\n\
+    \\"A Update registerInverseRelationships on adding a new field here.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\EOT\ENQ\DC2\EOT\243\ETX\STX\ACK\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\EOT\SOH\DC2\EOT\243\ETX\a\DC4\n\
+    \\r\n\
+    \\ENQ\EOT\b\STX\EOT\ETX\DC2\EOT\243\ETX\ETB\CAN\n\
+    \\136\ETX\n\
+    \\STX\ENQ\ETX\DC2\ACK\252\ETX\NUL\146\EOT\SOH\SUB\249\STX SymbolRole declares what \"role\" a symbol has in an occurrence. A role is\n\
+    \ encoded as a bitset where each bit represents a different role. For example,\n\
+    \ to determine if the `Import` role is set, test whether the second bit of the\n\
+    \ enum value is defined. In pseudocode, this can be implemented with the\n\
+    \ logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`.\n\
+    \\n\
+    \\v\n\
+    \\ETX\ENQ\ETX\SOH\DC2\EOT\252\ETX\ENQ\SI\n\
+    \v\n\
+    \\EOT\ENQ\ETX\STX\NUL\DC2\EOT\255\ETX\STX\FS\SUBh This case is not meant to be used; it only exists to avoid an error\n\
+    \ from the Protobuf code generator.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\NUL\SOH\DC2\EOT\255\ETX\STX\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\NUL\STX\DC2\EOT\255\ETX\SUB\ESC\n\
+    \T\n\
+    \\EOT\ENQ\ETX\STX\SOH\DC2\EOT\129\EOT\STX\DC3\SUBF Is the symbol defined here? If not, then this is a symbol reference.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\SOH\SOH\DC2\EOT\129\EOT\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\SOH\STX\DC2\EOT\129\EOT\SI\DC2\n\
+    \,\n\
+    \\EOT\ENQ\ETX\STX\STX\DC2\EOT\131\EOT\STX\SI\SUB\RS Is the symbol imported here?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\STX\SOH\DC2\EOT\131\EOT\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\STX\STX\DC2\EOT\131\EOT\v\SO\n\
+    \+\n\
+    \\EOT\ENQ\ETX\STX\ETX\DC2\EOT\133\EOT\STX\DC4\SUB\GS Is the symbol written here?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ETX\SOH\DC2\EOT\133\EOT\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ETX\STX\DC2\EOT\133\EOT\DLE\DC3\n\
+    \(\n\
+    \\EOT\ENQ\ETX\STX\EOT\DC2\EOT\135\EOT\STX\DC3\SUB\SUB Is the symbol read here?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\EOT\SOH\DC2\EOT\135\EOT\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\EOT\STX\DC2\EOT\135\EOT\SI\DC2\n\
+    \0\n\
+    \\EOT\ENQ\ETX\STX\ENQ\DC2\EOT\137\EOT\STX\DC3\SUB\" Is the symbol in generated code?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ENQ\SOH\DC2\EOT\137\EOT\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ENQ\STX\DC2\EOT\137\EOT\SO\DC2\n\
+    \+\n\
+    \\EOT\ENQ\ETX\STX\ACK\DC2\EOT\139\EOT\STX\SO\SUB\GS Is the symbol in test code?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ACK\SOH\DC2\EOT\139\EOT\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\ACK\STX\DC2\EOT\139\EOT\t\r\n\
+    \\237\SOH\n\
+    \\EOT\ENQ\ETX\STX\a\DC2\EOT\145\EOT\STX\ESC\SUB\222\SOH Is this a signature for a symbol that is defined elsewhere?\n\
+    \\n\
+    \ Applies to forward declarations for languages like C, C++\n\
+    \ and Objective-C, as well as `val` declarations in interface\n\
+    \ files in languages like SML and OCaml.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\a\SOH\DC2\EOT\145\EOT\STX\DC3\n\
+    \\r\n\
+    \\ENQ\ENQ\ETX\STX\a\STX\DC2\EOT\145\EOT\SYN\SUB\n\
+    \\f\n\
+    \\STX\ENQ\EOT\DC2\ACK\148\EOT\NUL\241\EOT\SOH\n\
+    \\v\n\
+    \\ETX\ENQ\EOT\SOH\DC2\EOT\148\EOT\ENQ\SI\n\
+    \\v\n\
+    \\ETX\ENQ\EOT\ETX\DC2\EOT\149\EOT\STX\FS\n\
+    \\f\n\
+    \\EOT\ENQ\EOT\ETX\STX\DC2\EOT\149\EOT\STX\FS\n\
+    \\f\n\
+    \\EOT\ENQ\EOT\STX\NUL\DC2\EOT\151\EOT\STX\FS\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\NUL\SOH\DC2\EOT\151\EOT\STX\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\NUL\STX\DC2\EOT\151\EOT\SUB\ESC\n\
+    \;\n\
+    \\EOT\ENQ\EOT\STX\SOH\DC2\EOT\154\EOT\STX\SO\SUB- Comment, including comment markers and text\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SOH\SOH\DC2\EOT\154\EOT\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SOH\STX\DC2\EOT\154\EOT\f\r\n\
+    \\ESC\n\
+    \\EOT\ENQ\EOT\STX\STX\DC2\EOT\157\EOT\STX\ESC\SUB\r `;` `.` `,`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\STX\SOH\DC2\EOT\157\EOT\STX\SYN\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\STX\STX\DC2\EOT\157\EOT\EM\SUB\n\
+    \2\n\
+    \\EOT\ENQ\EOT\STX\ETX\DC2\EOT\159\EOT\STX\EM\SUB$ (), {}, [] when used syntactically\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ETX\SOH\DC2\EOT\159\EOT\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ETX\STX\DC2\EOT\159\EOT\ETB\CAN\n\
+    \5\n\
+    \\EOT\ENQ\EOT\STX\EOT\DC2\EOT\162\EOT\STX\SO\SUB' `if`, `else`, `return`, `class`, etc.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\EOT\SOH\DC2\EOT\162\EOT\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\EOT\STX\DC2\EOT\162\EOT\f\r\n\
+    \\f\n\
+    \\EOT\ENQ\EOT\STX\ENQ\DC2\EOT\163\EOT\STX*\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ENQ\SOH\DC2\EOT\163\EOT\STX\DC3\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ENQ\STX\DC2\EOT\163\EOT\SYN\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ENQ\ETX\DC2\EOT\163\EOT\CAN)\n\
+    \\SO\n\
+    \\ACK\ENQ\EOT\STX\ENQ\ETX\SOH\DC2\EOT\163\EOT\EM(\n\
+    \\RS\n\
+    \\EOT\ENQ\EOT\STX\ACK\DC2\EOT\166\EOT\STX\EM\SUB\DLE `+`, `*`, etc.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ACK\SOH\DC2\EOT\166\EOT\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ACK\STX\DC2\EOT\166\EOT\ETB\CAN\n\
+    \X\n\
+    \\EOT\ENQ\EOT\STX\a\DC2\EOT\169\EOT\STX\DC1\SUBJ non-specific catch-all for any identifier not better described elsewhere\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\a\SOH\DC2\EOT\169\EOT\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\a\STX\DC2\EOT\169\EOT\SI\DLE\n\
+    \N\n\
+    \\EOT\ENQ\EOT\STX\b\DC2\EOT\171\EOT\STX\CAN\SUB@ Identifiers builtin to the language: `min`, `print` in Python.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\b\SOH\DC2\EOT\171\EOT\STX\DC3\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\b\STX\DC2\EOT\171\EOT\SYN\ETB\n\
+    \[\n\
+    \\EOT\ENQ\EOT\STX\t\DC2\EOT\173\EOT\STX\NAK\SUBM Identifiers representing `null`-like values: `None` in Python, `nil` in Go.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\t\SOH\DC2\EOT\173\EOT\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\t\STX\DC2\EOT\173\EOT\DC3\DC4\n\
+    \.\n\
+    \\EOT\ENQ\EOT\STX\n\
+    \\DC2\EOT\175\EOT\STX\EM\SUB  `xyz` in `const xyz = \"hello\"`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\n\
+    \\SOH\DC2\EOT\175\EOT\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\n\
+    \\STX\DC2\EOT\175\EOT\ETB\CAN\n\
+    \'\n\
+    \\EOT\ENQ\EOT\STX\v\DC2\EOT\177\EOT\STX\US\SUB\EM `var X = \"hello\"` in Go\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\v\SOH\DC2\EOT\177\EOT\STX\EM\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\v\STX\DC2\EOT\177\EOT\FS\RS\n\
+    \3\n\
+    \\EOT\ENQ\EOT\STX\f\DC2\EOT\179\EOT\STX\ESC\SUB% Parameter definition and references\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\f\SOH\DC2\EOT\179\EOT\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\f\STX\DC2\EOT\179\EOT\CAN\SUB\n\
+    \X\n\
+    \\EOT\ENQ\EOT\STX\r\DC2\EOT\181\EOT\STX\ETB\SUBJ Identifiers for variable definitions and references within a local scope\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\r\SOH\DC2\EOT\181\EOT\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\r\STX\DC2\EOT\181\EOT\DC4\SYN\n\
+    \K\n\
+    \\EOT\ENQ\EOT\STX\SO\DC2\EOT\183\EOT\STX\SUB\SUB= Identifiers that shadow other identifiers in an outer scope\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SO\SOH\DC2\EOT\183\EOT\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SO\STX\DC2\EOT\183\EOT\ETB\EM\n\
+    \\205\SOH\n\
+    \\EOT\ENQ\EOT\STX\SI\DC2\EOT\188\EOT\STX\ESC\SUB\190\SOH Identifier representing a unit of code abstraction and/or namespacing.\n\
+    \\n\
+    \ NOTE: This corresponds to a package in Go and JVM languages,\n\
+    \ and a module in languages like Python and JavaScript.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SI\SOH\DC2\EOT\188\EOT\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SI\STX\DC2\EOT\188\EOT\CAN\SUB\n\
+    \\f\n\
+    \\EOT\ENQ\EOT\STX\DLE\DC2\EOT\189\EOT\STX*\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DLE\SOH\DC2\EOT\189\EOT\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DLE\STX\DC2\EOT\189\EOT\NAK\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DLE\ETX\DC2\EOT\189\EOT\CAN)\n\
+    \\SO\n\
+    \\ACK\ENQ\EOT\STX\DLE\ETX\SOH\DC2\EOT\189\EOT\EM(\n\
+    \4\n\
+    \\EOT\ENQ\EOT\STX\DC1\DC2\EOT\192\EOT\STX\SUB\SUB& Function references, including calls\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC1\SOH\DC2\EOT\192\EOT\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC1\STX\DC2\EOT\192\EOT\ETB\EM\n\
+    \(\n\
+    \\EOT\ENQ\EOT\STX\DC2\DC2\EOT\194\EOT\STX$\SUB\SUB Function definition only\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC2\SOH\DC2\EOT\194\EOT\STX\RS\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC2\STX\DC2\EOT\194\EOT!#\n\
+    \7\n\
+    \\EOT\ENQ\EOT\STX\DC3\DC2\EOT\197\EOT\STX\ETB\SUB) Macro references, including invocations\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC3\SOH\DC2\EOT\197\EOT\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC3\STX\DC2\EOT\197\EOT\DC4\SYN\n\
+    \%\n\
+    \\EOT\ENQ\EOT\STX\DC4\DC2\EOT\199\EOT\STX!\SUB\ETB Macro definition only\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC4\SOH\DC2\EOT\199\EOT\STX\ESC\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\DC4\STX\DC2\EOT\199\EOT\RS \n\
+    \!\n\
+    \\EOT\ENQ\EOT\STX\NAK\DC2\EOT\202\EOT\STX\SYN\SUB\DC3 non-builtin types\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\NAK\SOH\DC2\EOT\202\EOT\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\NAK\STX\DC2\EOT\202\EOT\DC3\NAK\n\
+    \K\n\
+    \\EOT\ENQ\EOT\STX\SYN\DC2\EOT\204\EOT\STX\GS\SUB= builtin types only, such as `str` for Python or `int` in Go\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SYN\SOH\DC2\EOT\204\EOT\STX\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SYN\STX\DC2\EOT\204\EOT\SUB\FS\n\
+    \7\n\
+    \\EOT\ENQ\EOT\STX\ETB\DC2\EOT\207\EOT\STX\ESC\SUB) Python decorators, c-like __attribute__\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ETB\SOH\DC2\EOT\207\EOT\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ETB\STX\DC2\EOT\207\EOT\CAN\SUB\n\
+    \\DC4\n\
+    \\EOT\ENQ\EOT\STX\CAN\DC2\EOT\210\EOT\STX\DC3\SUB\ACK `\\b`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\CAN\SOH\DC2\EOT\210\EOT\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\CAN\STX\DC2\EOT\210\EOT\DLE\DC2\n\
+    \\CAN\n\
+    \\EOT\ENQ\EOT\STX\EM\DC2\EOT\212\EOT\STX\NAK\SUB\n\
+    \ `*`, `+`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\EM\SOH\DC2\EOT\212\EOT\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\EM\STX\DC2\EOT\212\EOT\DC2\DC4\n\
+    \\DC3\n\
+    \\EOT\ENQ\EOT\STX\SUB\DC2\EOT\214\EOT\STX\NAK\SUB\ENQ `.`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SUB\SOH\DC2\EOT\214\EOT\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\SUB\STX\DC2\EOT\214\EOT\DC2\DC4\n\
+    \\"\n\
+    \\EOT\ENQ\EOT\STX\ESC\DC2\EOT\216\EOT\STX\SYN\SUB\DC4 `(`, `)`, `[`, `]`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ESC\SOH\DC2\EOT\216\EOT\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\ESC\STX\DC2\EOT\216\EOT\DC3\NAK\n\
+    \\CAN\n\
+    \\EOT\ENQ\EOT\STX\FS\DC2\EOT\218\EOT\STX\DC1\SUB\n\
+    \ `|`, `-`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\FS\SOH\DC2\EOT\218\EOT\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\FS\STX\DC2\EOT\218\EOT\SO\DLE\n\
+    \0\n\
+    \\EOT\ENQ\EOT\STX\GS\DC2\EOT\221\EOT\STX\NAK\SUB\" Literal strings: \"Hello, world!\"\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\GS\SOH\DC2\EOT\221\EOT\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\GS\STX\DC2\EOT\221\EOT\DC2\DC4\n\
+    \-\n\
+    \\EOT\ENQ\EOT\STX\RS\DC2\EOT\223\EOT\STX\ESC\SUB\US non-regex escapes: \"\\t\", \"\\n\"\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\RS\SOH\DC2\EOT\223\EOT\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\RS\STX\DC2\EOT\223\EOT\CAN\SUB\n\
+    \_\n\
+    \\EOT\ENQ\EOT\STX\US\DC2\EOT\225\EOT\STX\FS\SUBQ datetimes within strings, special words within a string, `{}` in format strings\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\US\SOH\DC2\EOT\225\EOT\STX\SYN\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\US\STX\DC2\EOT\225\EOT\EM\ESC\n\
+    \G\n\
+    \\EOT\ENQ\EOT\STX \DC2\EOT\227\EOT\STX\CAN\SUB9 \"key\" in { \"key\": \"value\" }, useful for example in JSON\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX \SOH\DC2\EOT\227\EOT\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX \STX\DC2\EOT\227\EOT\NAK\ETB\n\
+    \V\n\
+    \\EOT\ENQ\EOT\STX!\DC2\EOT\229\EOT\STX\CAN\SUBH 'c' or similar, in languages that differentiate strings and characters\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX!\SOH\DC2\EOT\229\EOT\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX!\STX\DC2\EOT\229\EOT\NAK\ETB\n\
+    \9\n\
+    \\EOT\ENQ\EOT\STX\"\DC2\EOT\231\EOT\STX\SYN\SUB+ Literal numbers, both floats and integers\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\"\SOH\DC2\EOT\231\EOT\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX\"\STX\DC2\EOT\231\EOT\DC3\NAK\n\
+    \\US\n\
+    \\EOT\ENQ\EOT\STX#\DC2\EOT\233\EOT\STX\SYN\SUB\DC1 `true`, `false`\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX#\SOH\DC2\EOT\233\EOT\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX#\STX\DC2\EOT\233\EOT\DC3\NAK\n\
+    \&\n\
+    \\EOT\ENQ\EOT\STX$\DC2\EOT\236\EOT\STX\v\SUB\CAN Used for XML-like tags\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX$\SOH\DC2\EOT\236\EOT\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX$\STX\DC2\EOT\236\EOT\b\n\
+    \\n\
+    \/\n\
+    \\EOT\ENQ\EOT\STX%\DC2\EOT\238\EOT\STX\DC4\SUB! Attribute name in XML-like tags\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX%\SOH\DC2\EOT\238\EOT\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX%\STX\DC2\EOT\238\EOT\DC1\DC3\n\
+    \,\n\
+    \\EOT\ENQ\EOT\STX&\DC2\EOT\240\EOT\STX\DC4\SUB\RS Delimiters for XML-like tags\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX&\SOH\DC2\EOT\240\EOT\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\EOT\STX&\STX\DC2\EOT\240\EOT\DC1\DC3\n\
+    \\249\SOH\n\
+    \\STX\EOT\t\DC2\ACK\248\EOT\NUL\217\ENQ\SOH\SUB\234\SOH Occurrence associates a source position with a symbol and/or highlighting\n\
+    \ information.\n\
+    \\n\
+    \ If possible, indexers should try to bundle logically related information\n\
+    \ across occurrences into a single occurrence to reduce payload sizes.\n\
+    \\n\
+    \\v\n\
+    \\ETX\EOT\t\SOH\DC2\EOT\248\EOT\b\DC2\n\
+    \\232\b\n\
+    \\EOT\EOT\t\STX\NUL\DC2\EOT\144\ENQ\STX\ESC\SUB\217\b Half-open [start, end) range of this occurrence. Must be exactly three or four\n\
+    \ elements:\n\
+    \\n\
+    \ - Four elements: `[startLine, startCharacter, endLine, endCharacter]`\n\
+    \ - Three elements: `[startLine, startCharacter, endCharacter]`. The end line\n\
+    \   is inferred to have the same value as the start line.\n\
+    \\n\
+    \ It is allowed for the range to be empty (i.e. start==end).\n\
+    \\n\
+    \ Line numbers and characters are always 0-based. Make sure to increment the\n\
+    \ line/character values before displaying them in an editor-like UI because\n\
+    \ editors conventionally use 1-based numbers.\n\
+    \\n\
+    \ The 'character' value is interpreted based on the PositionEncoding for\n\
+    \ the Document.\n\
+    \\n\
+    \ Historical note: the original draft of this schema had a `Range` message\n\
+    \ type with `start` and `end` fields of type `Position`, mirroring LSP.\n\
+    \ Benchmarks revealed that this encoding was inefficient and that we could\n\
+    \ reduce the total payload size of an index by 50% by using `repeated int32`\n\
+    \ instead. The `repeated int32` encoding is admittedly more embarrassing to\n\
+    \ work with in some programming languages but we hope the performance\n\
+    \ improvements make up for it.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\NUL\EOT\DC2\EOT\144\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\NUL\ENQ\DC2\EOT\144\ENQ\v\DLE\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\NUL\SOH\DC2\EOT\144\ENQ\DC1\SYN\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\NUL\ETX\DC2\EOT\144\ENQ\EM\SUB\n\
+    \\138\SOH\n\
+    \\EOT\EOT\t\STX\SOH\DC2\EOT\147\ENQ\STX\DC4\SUB| (optional) The symbol that appears at this position. See\n\
+    \ `SymbolInformation.symbol` for how to format symbols as strings.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\SOH\ENQ\DC2\EOT\147\ENQ\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\SOH\SOH\DC2\EOT\147\ENQ\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\SOH\ETX\DC2\EOT\147\ENQ\DC2\DC3\n\
+    \\151\SOH\n\
+    \\EOT\EOT\t\STX\STX\DC2\EOT\150\ENQ\STX\EM\SUB\136\SOH (optional) Bitset containing `SymbolRole`s in this occurrence.\n\
+    \ See `SymbolRole`'s documentation for how to read and write this field.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\STX\ENQ\DC2\EOT\150\ENQ\STX\a\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\STX\SOH\DC2\EOT\150\ENQ\b\DC4\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\STX\ETX\DC2\EOT\150\ENQ\ETB\CAN\n\
+    \\241\ETX\n\
+    \\EOT\EOT\t\STX\ETX\DC2\EOT\159\ENQ\STX-\SUB\226\ETX (optional) CommonMark-formatted documentation for this specific range. If\n\
+    \ empty, the `Symbol.documentation` field is used instead. One example\n\
+    \ where this field might be useful is when the symbol represents a generic\n\
+    \ function (with abstract type parameters such as `List<T>`) and at this\n\
+    \ occurrence we know the exact values (such as `List<String>`).\n\
+    \\n\
+    \ This field can also be used for dynamically or gradually typed languages,\n\
+    \ which commonly allow for type-changing assignment.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ETX\EOT\DC2\EOT\159\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ETX\ENQ\DC2\EOT\159\ENQ\v\DC1\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ETX\SOH\DC2\EOT\159\ENQ\DC2(\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ETX\ETX\DC2\EOT\159\ENQ+,\n\
+    \X\n\
+    \\EOT\EOT\t\STX\EOT\DC2\EOT\161\ENQ\STX\GS\SUBJ (optional) What syntax highlighting class should be used for this range?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\EOT\ACK\DC2\EOT\161\ENQ\STX\f\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\EOT\SOH\DC2\EOT\161\ENQ\r\CAN\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\EOT\ETX\DC2\EOT\161\ENQ\ESC\FS\n\
+    \W\n\
+    \\EOT\EOT\t\STX\ENQ\DC2\EOT\163\ENQ\STX&\SUBI (optional) Diagnostics that have been reported for this specific range.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ENQ\EOT\DC2\EOT\163\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ENQ\ACK\DC2\EOT\163\ENQ\v\NAK\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ENQ\SOH\DC2\EOT\163\ENQ\SYN!\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ENQ\ETX\DC2\EOT\163\ENQ$%\n\
+    \\183\SO\n\
+    \\EOT\EOT\t\STX\ACK\DC2\EOT\216\ENQ\STX%\SUB\168\SO (optional) Using the same encoding as the sibling `range` field, half-open\n\
+    \ source range of the nearest non-trivial enclosing AST node. This range must\n\
+    \ enclose the `range` field. Example applications that make use of the\n\
+    \ enclosing_range field:\n\
+    \\n\
+    \ - Call hierarchies: to determine what symbols are references from the body\n\
+    \   of a function\n\
+    \ - Symbol outline: to display breadcrumbs from the cursor position to the\n\
+    \   root of the file\n\
+    \ - Expand selection: to select the nearest enclosing AST node.\n\
+    \ - Highlight range: to indicate the AST expression that is associated with a\n\
+    \   hover popover\n\
+    \\n\
+    \ For definition occurrences, the enclosing range should indicate the\n\
+    \ start/end bounds of the entire definition AST node, including\n\
+    \ documentation.\n\
+    \ ```\n\
+    \ const n = 3\n\
+    \       ^ range\n\
+    \ ^^^^^^^^^^^ enclosing_range\n\
+    \\n\
+    \ /** Parses the string into something */\n\
+    \ ^ enclosing_range start --------------------------------------|\n\
+    \ function parse(input string): string {                        |\n\
+    \          ^^^^^ range                                          |\n\
+    \     return input.slice(n)                                     |\n\
+    \ }                                                             |\n\
+    \ ^ enclosing_range end <---------------------------------------|\n\
+    \ ```\n\
+    \\n\
+    \ Any attributes/decorators/attached macros should also be part of the\n\
+    \ enclosing range.\n\
+    \\n\
+    \ ```python\n\
+    \ @cache\n\
+    \ ^ enclosing_range start---------------------|\n\
+    \ def factorial(n):                           |\n\
+    \     return n * factorial(n-1) if n else 1   |\n\
+    \ < enclosing_range end-----------------------|\n\
+    \\n\
+    \ ```\n\
+    \\n\
+    \ For reference occurrences, the enclosing range should indicate the start/end\n\
+    \ bounds of the parent expression.\n\
+    \ ```\n\
+    \ const a = a.b\n\
+    \             ^ range\n\
+    \           ^^^ enclosing_range\n\
+    \ const b = a.b(41).f(42).g(43)\n\
+    \                   ^ range\n\
+    \           ^^^^^^^^^^^^^ enclosing_range\n\
+    \ ```\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ACK\EOT\DC2\EOT\216\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ACK\ENQ\DC2\EOT\216\ENQ\v\DLE\n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ACK\SOH\DC2\EOT\216\ENQ\DC1 \n\
+    \\r\n\
+    \\ENQ\EOT\t\STX\ACK\ETX\DC2\EOT\216\ENQ#$\n\
+    \w\n\
+    \\STX\EOT\n\
+    \\DC2\ACK\221\ENQ\NUL\232\ENQ\SOH\SUBi Represents a diagnostic, such as a compiler error or warning, which should be\n\
+    \ reported for a document.\n\
+    \\n\
+    \\v\n\
+    \\ETX\EOT\n\
+    \\SOH\DC2\EOT\221\ENQ\b\DC2\n\
+    \W\n\
+    \\EOT\EOT\n\
+    \\STX\NUL\DC2\EOT\223\ENQ\STX\CAN\SUBI Should this diagnostic be reported as an error, warning, info, or hint?\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\NUL\ACK\DC2\EOT\223\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\NUL\SOH\DC2\EOT\223\ENQ\v\DC3\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\NUL\ETX\DC2\EOT\223\ENQ\SYN\ETB\n\
+    \]\n\
+    \\EOT\EOT\n\
+    \\STX\SOH\DC2\EOT\225\ENQ\STX\DC2\SUBO (optional) Code of this diagnostic, which might appear in the user interface.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\SOH\ENQ\DC2\EOT\225\ENQ\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\SOH\SOH\DC2\EOT\225\ENQ\t\r\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\SOH\ETX\DC2\EOT\225\ENQ\DLE\DC1\n\
+    \+\n\
+    \\EOT\EOT\n\
+    \\STX\STX\DC2\EOT\227\ENQ\STX\NAK\SUB\GS Message of this diagnostic.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\STX\ENQ\DC2\EOT\227\ENQ\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\STX\SOH\DC2\EOT\227\ENQ\t\DLE\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\STX\ETX\DC2\EOT\227\ENQ\DC3\DC4\n\
+    \~\n\
+    \\EOT\EOT\n\
+    \\STX\ETX\DC2\EOT\230\ENQ\STX\DC4\SUBp (optional) Human-readable string describing the source of this diagnostic, e.g.\n\
+    \ 'typescript' or 'super lint'.\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\ETX\ENQ\DC2\EOT\230\ENQ\STX\b\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\ETX\SOH\DC2\EOT\230\ENQ\t\SI\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\ETX\ETX\DC2\EOT\230\ENQ\DC2\DC3\n\
+    \\f\n\
+    \\EOT\EOT\n\
+    \\STX\EOT\DC2\EOT\231\ENQ\STX\"\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\EOT\EOT\DC2\EOT\231\ENQ\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\EOT\ACK\DC2\EOT\231\ENQ\v\CAN\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\EOT\SOH\DC2\EOT\231\ENQ\EM\GS\n\
+    \\r\n\
+    \\ENQ\EOT\n\
+    \\STX\EOT\ETX\DC2\EOT\231\ENQ !\n\
+    \\f\n\
+    \\STX\ENQ\ENQ\DC2\ACK\234\ENQ\NUL\240\ENQ\SOH\n\
+    \\v\n\
+    \\ETX\ENQ\ENQ\SOH\DC2\EOT\234\ENQ\ENQ\r\n\
+    \\f\n\
+    \\EOT\ENQ\ENQ\STX\NUL\DC2\EOT\235\ENQ\STX\SUB\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\NUL\SOH\DC2\EOT\235\ENQ\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\NUL\STX\DC2\EOT\235\ENQ\CAN\EM\n\
+    \\f\n\
+    \\EOT\ENQ\ENQ\STX\SOH\DC2\EOT\236\ENQ\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\SOH\SOH\DC2\EOT\236\ENQ\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\SOH\STX\DC2\EOT\236\ENQ\n\
+    \\v\n\
+    \\f\n\
+    \\EOT\ENQ\ENQ\STX\STX\DC2\EOT\237\ENQ\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\STX\SOH\DC2\EOT\237\ENQ\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\STX\STX\DC2\EOT\237\ENQ\f\r\n\
+    \\f\n\
+    \\EOT\ENQ\ENQ\STX\ETX\DC2\EOT\238\ENQ\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\ETX\SOH\DC2\EOT\238\ENQ\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\ETX\STX\DC2\EOT\238\ENQ\DLE\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\ENQ\STX\EOT\DC2\EOT\239\ENQ\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\EOT\SOH\DC2\EOT\239\ENQ\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\ENQ\STX\EOT\STX\DC2\EOT\239\ENQ\t\n\
+    \\n\
+    \\f\n\
+    \\STX\ENQ\ACK\DC2\ACK\242\ENQ\NUL\246\ENQ\SOH\n\
+    \\v\n\
+    \\ETX\ENQ\ACK\SOH\DC2\EOT\242\ENQ\ENQ\DC2\n\
+    \\f\n\
+    \\EOT\ENQ\ACK\STX\NUL\DC2\EOT\243\ENQ\STX\US\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\NUL\SOH\DC2\EOT\243\ENQ\STX\SUB\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\NUL\STX\DC2\EOT\243\ENQ\GS\RS\n\
+    \\f\n\
+    \\EOT\ENQ\ACK\STX\SOH\DC2\EOT\244\ENQ\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\SOH\SOH\DC2\EOT\244\ENQ\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\SOH\STX\DC2\EOT\244\ENQ\DLE\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\ACK\STX\STX\DC2\EOT\245\ENQ\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\STX\SOH\DC2\EOT\245\ENQ\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\ACK\STX\STX\STX\DC2\EOT\245\ENQ\SI\DLE\n\
+    \\208\ETX\n\
+    \\STX\ENQ\a\DC2\ACK\254\ENQ\NUL\244\ACK\SOH\SUB\193\ETX Language standardises names of common programming languages that can be used\n\
+    \ for the `Document.language` field. The primary purpose of this enum is to\n\
+    \ prevent a situation where we have a single programming language ends up with\n\
+    \ multiple string representations. For example, the C++ language uses the name\n\
+    \ \"CPP\" in this enum and other names such as \"cpp\" are incompatible.\n\
+    \ Feel free to send a pull-request to add missing programming languages.\n\
+    \\n\
+    \\v\n\
+    \\ETX\ENQ\a\SOH\DC2\EOT\254\ENQ\ENQ\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\NUL\DC2\EOT\255\ENQ\STX\SUB\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\NUL\SOH\DC2\EOT\255\ENQ\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\NUL\STX\DC2\EOT\255\ENQ\CAN\EM\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\SOH\DC2\EOT\128\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SOH\SOH\DC2\EOT\128\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SOH\STX\DC2\EOT\128\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\STX\DC2\EOT\129\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\STX\SOH\DC2\EOT\129\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\STX\STX\DC2\EOT\129\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\ETX\DC2\EOT\130\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ETX\SOH\DC2\EOT\130\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ETX\STX\DC2\EOT\130\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\EOT\DC2\EOT\131\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\EOT\SOH\DC2\EOT\131\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\EOT\STX\DC2\EOT\131\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\ENQ\DC2\EOT\132\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ENQ\SOH\DC2\EOT\132\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ENQ\STX\DC2\EOT\132\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\ACK\DC2\EOT\133\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ACK\SOH\DC2\EOT\133\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ACK\STX\DC2\EOT\133\ACK\r\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\a\DC2\EOT\134\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\a\SOH\DC2\EOT\134\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\a\STX\DC2\EOT\134\ACK\r\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\b\DC2\EOT\135\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\b\SOH\DC2\EOT\135\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\b\STX\DC2\EOT\135\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\t\DC2\EOT\136\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\t\SOH\DC2\EOT\136\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\t\STX\DC2\EOT\136\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\n\
+    \\DC2\EOT\137\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\n\
+    \\SOH\DC2\EOT\137\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\n\
+    \\STX\DC2\EOT\137\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\v\DC2\EOT\138\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\v\SOH\DC2\EOT\138\ACK\STX\ETX\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\v\STX\DC2\EOT\138\ACK\ACK\b\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\f\DC2\EOT\139\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\f\SOH\DC2\EOT\139\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\f\STX\DC2\EOT\139\ACK\n\
+    \\f\n\
+    \H\n\
+    \\EOT\ENQ\a\STX\r\DC2\EOT\140\ACK\STX\v\": C++ (the name \"CPP\" was chosen for consistency with LSP)\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\r\SOH\DC2\EOT\140\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\r\STX\DC2\EOT\140\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\SO\DC2\EOT\141\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SO\SOH\DC2\EOT\141\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SO\STX\DC2\EOT\141\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\SI\DC2\EOT\142\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SI\SOH\DC2\EOT\142\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SI\STX\DC2\EOT\142\ACK\v\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\DLE\DC2\EOT\143\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DLE\SOH\DC2\EOT\143\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DLE\STX\DC2\EOT\143\ACK\f\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\DC1\DC2\EOT\144\ACK\STX\DC4\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC1\SOH\DC2\EOT\144\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC1\STX\DC2\EOT\144\ACK\DC1\DC3\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\DC2\DC2\EOT\145\ACK\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC2\SOH\DC2\EOT\145\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC2\STX\DC2\EOT\145\ACK\SI\DLE\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\DC3\DC2\EOT\146\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC3\SOH\DC2\EOT\146\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC3\STX\DC2\EOT\146\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\DC4\DC2\EOT\147\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC4\SOH\DC2\EOT\147\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\DC4\STX\DC2\EOT\147\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\NAK\DC2\EOT\148\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\NAK\SOH\DC2\EOT\148\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\NAK\STX\DC2\EOT\148\ACK\t\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\SYN\DC2\EOT\149\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SYN\SOH\DC2\EOT\149\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SYN\STX\DC2\EOT\149\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\ETB\DC2\EOT\150\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ETB\SOH\DC2\EOT\150\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ETB\STX\DC2\EOT\150\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\CAN\DC2\EOT\151\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\CAN\SOH\DC2\EOT\151\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\CAN\STX\DC2\EOT\151\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\EM\DC2\EOT\152\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\EM\SOH\DC2\EOT\152\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\EM\STX\DC2\EOT\152\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\SUB\DC2\EOT\153\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SUB\SOH\DC2\EOT\153\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\SUB\STX\DC2\EOT\153\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\ESC\DC2\EOT\154\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ESC\SOH\DC2\EOT\154\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\ESC\STX\DC2\EOT\154\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\FS\DC2\EOT\155\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\FS\SOH\DC2\EOT\155\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\FS\STX\DC2\EOT\155\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\GS\DC2\EOT\156\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\GS\SOH\DC2\EOT\156\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\GS\STX\DC2\EOT\156\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\RS\DC2\EOT\157\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\RS\SOH\DC2\EOT\157\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\RS\STX\DC2\EOT\157\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\US\DC2\EOT\158\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\US\SOH\DC2\EOT\158\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\US\STX\DC2\EOT\158\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX \DC2\EOT\159\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX \SOH\DC2\EOT\159\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX \STX\DC2\EOT\159\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX!\DC2\EOT\160\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX!\SOH\DC2\EOT\160\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX!\STX\DC2\EOT\160\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\"\DC2\EOT\161\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\"\SOH\DC2\EOT\161\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\"\STX\DC2\EOT\161\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX#\DC2\EOT\162\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX#\SOH\DC2\EOT\162\ACK\STX\EOT\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX#\STX\DC2\EOT\162\ACK\a\t\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX$\DC2\EOT\163\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX$\SOH\DC2\EOT\163\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX$\STX\DC2\EOT\163\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX%\DC2\EOT\164\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX%\SOH\DC2\EOT\164\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX%\STX\DC2\EOT\164\ACK\v\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX&\DC2\EOT\165\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX&\SOH\DC2\EOT\165\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX&\STX\DC2\EOT\165\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX'\DC2\EOT\166\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX'\SOH\DC2\EOT\166\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX'\STX\DC2\EOT\166\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX(\DC2\EOT\167\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX(\SOH\DC2\EOT\167\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX(\STX\DC2\EOT\167\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX)\DC2\EOT\168\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX)\SOH\DC2\EOT\168\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX)\STX\DC2\EOT\168\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX*\DC2\EOT\169\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX*\SOH\DC2\EOT\169\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX*\STX\DC2\EOT\169\ACK\n\
+    \\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX+\DC2\EOT\170\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX+\SOH\DC2\EOT\170\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX+\STX\DC2\EOT\170\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX,\DC2\EOT\171\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX,\SOH\DC2\EOT\171\ACK\STX\ETX\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX,\STX\DC2\EOT\171\ACK\ACK\b\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX-\DC2\EOT\172\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX-\SOH\DC2\EOT\172\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX-\STX\DC2\EOT\172\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX.\DC2\EOT\173\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX.\SOH\DC2\EOT\173\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX.\STX\DC2\EOT\173\ACK\t\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX/\DC2\EOT\174\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX/\SOH\DC2\EOT\174\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX/\STX\DC2\EOT\174\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX0\DC2\EOT\175\ACK\STX\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX0\SOH\DC2\EOT\175\ACK\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX0\STX\DC2\EOT\175\ACK\DC4\SYN\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX1\DC2\EOT\176\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX1\SOH\DC2\EOT\176\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX1\STX\DC2\EOT\176\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX2\DC2\EOT\177\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX2\SOH\DC2\EOT\177\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX2\STX\DC2\EOT\177\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX3\DC2\EOT\178\ACK\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX3\SOH\DC2\EOT\178\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX3\STX\DC2\EOT\178\ACK\r\DLE\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX4\DC2\EOT\179\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX4\SOH\DC2\EOT\179\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX4\STX\DC2\EOT\179\ACK\v\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX5\DC2\EOT\180\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX5\SOH\DC2\EOT\180\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX5\STX\DC2\EOT\180\ACK\n\
+    \\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX6\DC2\EOT\181\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX6\SOH\DC2\EOT\181\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX6\STX\DC2\EOT\181\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX7\DC2\EOT\182\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX7\SOH\DC2\EOT\182\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX7\STX\DC2\EOT\182\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX8\DC2\EOT\183\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX8\SOH\DC2\EOT\183\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX8\STX\DC2\EOT\183\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX9\DC2\EOT\184\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX9\SOH\DC2\EOT\184\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX9\STX\DC2\EOT\184\ACK\t\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX:\DC2\EOT\185\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX:\SOH\DC2\EOT\185\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX:\STX\DC2\EOT\185\ACK\r\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX;\DC2\EOT\186\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX;\SOH\DC2\EOT\186\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX;\STX\DC2\EOT\186\ACK\r\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX<\DC2\EOT\187\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX<\SOH\DC2\EOT\187\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX<\STX\DC2\EOT\187\ACK\v\r\n\
+    \(\n\
+    \\EOT\ENQ\a\STX=\DC2\EOT\188\ACK\STX\SI\"\SUB https://nickel-lang.org/\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX=\SOH\DC2\EOT\188\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX=\STX\DC2\EOT\188\ACK\v\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX>\DC2\EOT\189\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX>\SOH\DC2\EOT\189\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX>\STX\DC2\EOT\189\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX?\DC2\EOT\190\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX?\SOH\DC2\EOT\190\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX?\STX\DC2\EOT\190\ACK\n\
+    \\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX@\DC2\EOT\191\ACK\STX\DC3\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX@\SOH\DC2\EOT\191\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX@\STX\DC2\EOT\191\ACK\DLE\DC2\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXA\DC2\EOT\192\ACK\STX\NAK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXA\SOH\DC2\EOT\192\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXA\STX\DC2\EOT\192\ACK\DC2\DC4\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXB\DC2\EOT\193\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXB\SOH\DC2\EOT\193\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXB\STX\DC2\EOT\193\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXC\DC2\EOT\194\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXC\SOH\DC2\EOT\194\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXC\STX\DC2\EOT\194\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXD\DC2\EOT\195\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXD\SOH\DC2\EOT\195\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXD\STX\DC2\EOT\195\ACK\n\
+    \\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXE\DC2\EOT\196\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXE\SOH\DC2\EOT\196\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXE\STX\DC2\EOT\196\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXF\DC2\EOT\197\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXF\SOH\DC2\EOT\197\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXF\STX\DC2\EOT\197\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXG\DC2\EOT\198\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXG\SOH\DC2\EOT\198\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXG\STX\DC2\EOT\198\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXH\DC2\EOT\199\ACK\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXH\SOH\DC2\EOT\199\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXH\STX\DC2\EOT\199\ACK\r\DLE\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXI\DC2\EOT\200\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXI\SOH\DC2\EOT\200\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXI\STX\DC2\EOT\200\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXJ\DC2\EOT\201\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXJ\SOH\DC2\EOT\201\ACK\STX\ETX\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXJ\STX\DC2\EOT\201\ACK\ACK\b\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXK\DC2\EOT\202\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXK\SOH\DC2\EOT\202\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXK\STX\DC2\EOT\202\ACK\v\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXL\DC2\EOT\203\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXL\SOH\DC2\EOT\203\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXL\STX\DC2\EOT\203\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXM\DC2\EOT\204\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXM\SOH\DC2\EOT\204\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXM\STX\DC2\EOT\204\ACK\n\
+    \\f\n\
+    \2\n\
+    \\EOT\ENQ\a\STXN\DC2\EOT\205\ACK\STX\SO\"$ Internal language for testing SCIP\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXN\SOH\DC2\EOT\205\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXN\STX\DC2\EOT\205\ACK\n\
+    \\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXO\DC2\EOT\206\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXO\SOH\DC2\EOT\206\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXO\STX\DC2\EOT\206\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXP\DC2\EOT\207\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXP\SOH\DC2\EOT\207\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXP\STX\DC2\EOT\207\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXQ\DC2\EOT\208\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXQ\SOH\DC2\EOT\208\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXQ\STX\DC2\EOT\208\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXR\DC2\EOT\209\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXR\SOH\DC2\EOT\209\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXR\STX\DC2\EOT\209\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXS\DC2\EOT\210\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXS\SOH\DC2\EOT\210\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXS\STX\DC2\EOT\210\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXT\DC2\EOT\211\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXT\SOH\DC2\EOT\211\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXT\STX\DC2\EOT\211\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXU\DC2\EOT\212\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXU\SOH\DC2\EOT\212\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXU\STX\DC2\EOT\212\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXV\DC2\EOT\213\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXV\SOH\DC2\EOT\213\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXV\STX\DC2\EOT\213\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXW\DC2\EOT\214\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXW\SOH\DC2\EOT\214\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXW\STX\DC2\EOT\214\ACK\n\
+    \\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXX\DC2\EOT\215\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXX\SOH\DC2\EOT\215\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXX\STX\DC2\EOT\215\ACK\v\r\n\
+    \\DC4\n\
+    \\EOT\ENQ\a\STXY\DC2\EOT\216\ACK\STX\DC3\"\ACK Bash\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXY\SOH\DC2\EOT\216\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXY\STX\DC2\EOT\216\ACK\DLE\DC2\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXZ\DC2\EOT\217\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXZ\SOH\DC2\EOT\217\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXZ\STX\DC2\EOT\217\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX[\DC2\EOT\218\ACK\STX\SO\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX[\SOH\DC2\EOT\218\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX[\STX\DC2\EOT\218\ACK\n\
+    \\r\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX\\\DC2\EOT\219\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\\\SOH\DC2\EOT\219\ACK\STX\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX\\\STX\DC2\EOT\219\ACK\r\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX]\DC2\EOT\220\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX]\SOH\DC2\EOT\220\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX]\STX\DC2\EOT\220\ACK\v\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX^\DC2\EOT\221\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX^\SOH\DC2\EOT\221\ACK\STX\a\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX^\STX\DC2\EOT\221\ACK\n\
+    \\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX_\DC2\EOT\222\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX_\SOH\DC2\EOT\222\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX_\STX\DC2\EOT\222\ACK\b\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STX`\DC2\EOT\223\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX`\SOH\DC2\EOT\223\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STX`\STX\DC2\EOT\223\ACK\t\v\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXa\DC2\EOT\224\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXa\SOH\DC2\EOT\224\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXa\STX\DC2\EOT\224\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXb\DC2\EOT\225\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXb\SOH\DC2\EOT\225\ACK\STX\b\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXb\STX\DC2\EOT\225\ACK\v\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXc\DC2\EOT\226\ACK\STX\DC2\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXc\SOH\DC2\EOT\226\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXc\STX\DC2\EOT\226\ACK\SI\DC1\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXd\DC2\EOT\227\ACK\STX\ETB\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXd\SOH\DC2\EOT\227\ACK\STX\DC1\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXd\STX\DC2\EOT\227\ACK\DC4\SYN\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXe\DC2\EOT\228\ACK\STX\DLE\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXe\SOH\DC2\EOT\228\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXe\STX\DC2\EOT\228\ACK\f\SI\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXf\DC2\EOT\229\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXf\SOH\DC2\EOT\229\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXf\STX\DC2\EOT\229\ACK\t\f\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXg\DC2\EOT\230\ACK\STX\DC3\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXg\SOH\DC2\EOT\230\ACK\STX\r\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXg\STX\DC2\EOT\230\ACK\DLE\DC2\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXh\DC2\EOT\231\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXh\SOH\DC2\EOT\231\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXh\STX\DC2\EOT\231\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXi\DC2\EOT\232\ACK\STX\SI\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXi\SOH\DC2\EOT\232\ACK\STX\t\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXi\STX\DC2\EOT\232\ACK\f\SO\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXj\DC2\EOT\233\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXj\SOH\DC2\EOT\233\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXj\STX\DC2\EOT\233\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXk\DC2\EOT\234\ACK\STX\v\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXk\SOH\DC2\EOT\234\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXk\STX\DC2\EOT\234\ACK\b\n\
+    \\n\
+    \\f\n\
+    \\EOT\ENQ\a\STXl\DC2\EOT\235\ACK\STX\f\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXl\SOH\DC2\EOT\235\ACK\STX\ACK\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXl\STX\DC2\EOT\235\ACK\t\v\n\
+    \\147\ETX\n\
+    \\EOT\ENQ\a\STXm\DC2\EOT\236\ACK\STX\v\"\132\ETX NextLanguage = 111;\n\
+    \ Steps add a new language:\n\
+    \ 1. Copy-paste the \"NextLanguage = N\" line above\n\
+    \ 2. Increment \"NextLanguage = N\" to \"NextLanguage = N+1\"\n\
+    \ 3. Replace \"NextLanguage = N\" with the name of the new language.\n\
+    \ 4. Move the new language to the correct line above using alphabetical order\n\
+    \ 5. (optional) Add a brief comment behind the language if the name is not self-explanatory\n\
+    \\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXm\SOH\DC2\EOT\236\ACK\STX\ENQ\n\
+    \\r\n\
+    \\ENQ\ENQ\a\STXm\STX\DC2\EOT\236\ACK\b\n\
+    \b\ACKproto3"
diff --git a/glean/lang/scip/proto/Proto/Scip_Fields.hs b/glean/lang/scip/proto/Proto/Scip_Fields.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/scip/proto/Proto/Scip_Fields.hs
@@ -0,0 +1,389 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- This file was auto-generated from scip.proto by the proto-lens-protoc program. -}
+{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications, OverloadedStrings, DerivingStrategies#-}
+{-# OPTIONS_GHC -Wno-unused-imports#-}
+{-# OPTIONS_GHC -Wno-duplicate-exports#-}
+{-# OPTIONS_GHC -Wno-dodgy-exports#-}
+module Proto.Scip_Fields where
+import qualified Data.ProtoLens.Runtime.Prelude as Prelude
+import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
+import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid
+import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens as Data.ProtoLens
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes as Data.ProtoLens.Encoding.Bytes
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing as Data.ProtoLens.Encoding.Growing
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe as Data.ProtoLens.Encoding.Parser.Unsafe
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire as Data.ProtoLens.Encoding.Wire
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field as Data.ProtoLens.Field
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum as Data.ProtoLens.Message.Enum
+import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types as Data.ProtoLens.Service.Types
+import qualified Data.ProtoLens.Runtime.Lens.Family2 as Lens.Family2
+import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked as Lens.Family2.Unchecked
+import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text
+import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map
+import qualified Data.ProtoLens.Runtime.Data.ByteString as Data.ByteString
+import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8 as Data.ByteString.Char8
+import qualified Data.ProtoLens.Runtime.Data.Text.Encoding as Data.Text.Encoding
+import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector
+import qualified Data.ProtoLens.Runtime.Data.Vector.Generic as Data.Vector.Generic
+import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed as Data.Vector.Unboxed
+import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read
+arguments ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "arguments" a) =>
+  Lens.Family2.LensLike' f s a
+arguments = Data.ProtoLens.Field.field @"arguments"
+code ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "code" a) =>
+  Lens.Family2.LensLike' f s a
+code = Data.ProtoLens.Field.field @"code"
+descriptors ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "descriptors" a) =>
+  Lens.Family2.LensLike' f s a
+descriptors = Data.ProtoLens.Field.field @"descriptors"
+diagnostics ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "diagnostics" a) =>
+  Lens.Family2.LensLike' f s a
+diagnostics = Data.ProtoLens.Field.field @"diagnostics"
+disambiguator ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "disambiguator" a) =>
+  Lens.Family2.LensLike' f s a
+disambiguator = Data.ProtoLens.Field.field @"disambiguator"
+displayName ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "displayName" a) =>
+  Lens.Family2.LensLike' f s a
+displayName = Data.ProtoLens.Field.field @"displayName"
+documentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "documentation" a) =>
+  Lens.Family2.LensLike' f s a
+documentation = Data.ProtoLens.Field.field @"documentation"
+documents ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "documents" a) =>
+  Lens.Family2.LensLike' f s a
+documents = Data.ProtoLens.Field.field @"documents"
+enclosingRange ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "enclosingRange" a) =>
+  Lens.Family2.LensLike' f s a
+enclosingRange = Data.ProtoLens.Field.field @"enclosingRange"
+enclosingSymbol ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "enclosingSymbol" a) =>
+  Lens.Family2.LensLike' f s a
+enclosingSymbol = Data.ProtoLens.Field.field @"enclosingSymbol"
+externalSymbols ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "externalSymbols" a) =>
+  Lens.Family2.LensLike' f s a
+externalSymbols = Data.ProtoLens.Field.field @"externalSymbols"
+isDefinition ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "isDefinition" a) =>
+  Lens.Family2.LensLike' f s a
+isDefinition = Data.ProtoLens.Field.field @"isDefinition"
+isImplementation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "isImplementation" a) =>
+  Lens.Family2.LensLike' f s a
+isImplementation = Data.ProtoLens.Field.field @"isImplementation"
+isReference ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "isReference" a) =>
+  Lens.Family2.LensLike' f s a
+isReference = Data.ProtoLens.Field.field @"isReference"
+isTypeDefinition ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "isTypeDefinition" a) =>
+  Lens.Family2.LensLike' f s a
+isTypeDefinition = Data.ProtoLens.Field.field @"isTypeDefinition"
+kind ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "kind" a) =>
+  Lens.Family2.LensLike' f s a
+kind = Data.ProtoLens.Field.field @"kind"
+language ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "language" a) =>
+  Lens.Family2.LensLike' f s a
+language = Data.ProtoLens.Field.field @"language"
+manager ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "manager" a) =>
+  Lens.Family2.LensLike' f s a
+manager = Data.ProtoLens.Field.field @"manager"
+maybe'metadata ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "maybe'metadata" a) =>
+  Lens.Family2.LensLike' f s a
+maybe'metadata = Data.ProtoLens.Field.field @"maybe'metadata"
+maybe'package ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "maybe'package" a) =>
+  Lens.Family2.LensLike' f s a
+maybe'package = Data.ProtoLens.Field.field @"maybe'package"
+maybe'signatureDocumentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "maybe'signatureDocumentation" a) =>
+  Lens.Family2.LensLike' f s a
+maybe'signatureDocumentation
+  = Data.ProtoLens.Field.field @"maybe'signatureDocumentation"
+maybe'toolInfo ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "maybe'toolInfo" a) =>
+  Lens.Family2.LensLike' f s a
+maybe'toolInfo = Data.ProtoLens.Field.field @"maybe'toolInfo"
+message ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "message" a) =>
+  Lens.Family2.LensLike' f s a
+message = Data.ProtoLens.Field.field @"message"
+metadata ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "metadata" a) =>
+  Lens.Family2.LensLike' f s a
+metadata = Data.ProtoLens.Field.field @"metadata"
+name ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "name" a) =>
+  Lens.Family2.LensLike' f s a
+name = Data.ProtoLens.Field.field @"name"
+occurrences ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "occurrences" a) =>
+  Lens.Family2.LensLike' f s a
+occurrences = Data.ProtoLens.Field.field @"occurrences"
+overrideDocumentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "overrideDocumentation" a) =>
+  Lens.Family2.LensLike' f s a
+overrideDocumentation
+  = Data.ProtoLens.Field.field @"overrideDocumentation"
+package ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "package" a) =>
+  Lens.Family2.LensLike' f s a
+package = Data.ProtoLens.Field.field @"package"
+positionEncoding ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "positionEncoding" a) =>
+  Lens.Family2.LensLike' f s a
+positionEncoding = Data.ProtoLens.Field.field @"positionEncoding"
+projectRoot ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "projectRoot" a) =>
+  Lens.Family2.LensLike' f s a
+projectRoot = Data.ProtoLens.Field.field @"projectRoot"
+range ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "range" a) =>
+  Lens.Family2.LensLike' f s a
+range = Data.ProtoLens.Field.field @"range"
+relationships ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "relationships" a) =>
+  Lens.Family2.LensLike' f s a
+relationships = Data.ProtoLens.Field.field @"relationships"
+relativePath ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "relativePath" a) =>
+  Lens.Family2.LensLike' f s a
+relativePath = Data.ProtoLens.Field.field @"relativePath"
+scheme ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "scheme" a) =>
+  Lens.Family2.LensLike' f s a
+scheme = Data.ProtoLens.Field.field @"scheme"
+severity ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "severity" a) =>
+  Lens.Family2.LensLike' f s a
+severity = Data.ProtoLens.Field.field @"severity"
+signatureDocumentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "signatureDocumentation" a) =>
+  Lens.Family2.LensLike' f s a
+signatureDocumentation
+  = Data.ProtoLens.Field.field @"signatureDocumentation"
+source ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "source" a) =>
+  Lens.Family2.LensLike' f s a
+source = Data.ProtoLens.Field.field @"source"
+suffix ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "suffix" a) =>
+  Lens.Family2.LensLike' f s a
+suffix = Data.ProtoLens.Field.field @"suffix"
+symbol ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbol" a) =>
+  Lens.Family2.LensLike' f s a
+symbol = Data.ProtoLens.Field.field @"symbol"
+symbolRoles ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "symbolRoles" a) =>
+  Lens.Family2.LensLike' f s a
+symbolRoles = Data.ProtoLens.Field.field @"symbolRoles"
+symbols ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "symbols" a) =>
+  Lens.Family2.LensLike' f s a
+symbols = Data.ProtoLens.Field.field @"symbols"
+syntaxKind ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "syntaxKind" a) =>
+  Lens.Family2.LensLike' f s a
+syntaxKind = Data.ProtoLens.Field.field @"syntaxKind"
+tags ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "tags" a) =>
+  Lens.Family2.LensLike' f s a
+tags = Data.ProtoLens.Field.field @"tags"
+text ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "text" a) =>
+  Lens.Family2.LensLike' f s a
+text = Data.ProtoLens.Field.field @"text"
+textDocumentEncoding ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "textDocumentEncoding" a) =>
+  Lens.Family2.LensLike' f s a
+textDocumentEncoding
+  = Data.ProtoLens.Field.field @"textDocumentEncoding"
+toolInfo ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "toolInfo" a) =>
+  Lens.Family2.LensLike' f s a
+toolInfo = Data.ProtoLens.Field.field @"toolInfo"
+vec'arguments ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'arguments" a) =>
+  Lens.Family2.LensLike' f s a
+vec'arguments = Data.ProtoLens.Field.field @"vec'arguments"
+vec'descriptors ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'descriptors" a) =>
+  Lens.Family2.LensLike' f s a
+vec'descriptors = Data.ProtoLens.Field.field @"vec'descriptors"
+vec'diagnostics ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'diagnostics" a) =>
+  Lens.Family2.LensLike' f s a
+vec'diagnostics = Data.ProtoLens.Field.field @"vec'diagnostics"
+vec'documentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'documentation" a) =>
+  Lens.Family2.LensLike' f s a
+vec'documentation = Data.ProtoLens.Field.field @"vec'documentation"
+vec'documents ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'documents" a) =>
+  Lens.Family2.LensLike' f s a
+vec'documents = Data.ProtoLens.Field.field @"vec'documents"
+vec'enclosingRange ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'enclosingRange" a) =>
+  Lens.Family2.LensLike' f s a
+vec'enclosingRange
+  = Data.ProtoLens.Field.field @"vec'enclosingRange"
+vec'externalSymbols ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'externalSymbols" a) =>
+  Lens.Family2.LensLike' f s a
+vec'externalSymbols
+  = Data.ProtoLens.Field.field @"vec'externalSymbols"
+vec'occurrences ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'occurrences" a) =>
+  Lens.Family2.LensLike' f s a
+vec'occurrences = Data.ProtoLens.Field.field @"vec'occurrences"
+vec'overrideDocumentation ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'overrideDocumentation" a) =>
+  Lens.Family2.LensLike' f s a
+vec'overrideDocumentation
+  = Data.ProtoLens.Field.field @"vec'overrideDocumentation"
+vec'range ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'range" a) =>
+  Lens.Family2.LensLike' f s a
+vec'range = Data.ProtoLens.Field.field @"vec'range"
+vec'relationships ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'relationships" a) =>
+  Lens.Family2.LensLike' f s a
+vec'relationships = Data.ProtoLens.Field.field @"vec'relationships"
+vec'symbols ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'symbols" a) =>
+  Lens.Family2.LensLike' f s a
+vec'symbols = Data.ProtoLens.Field.field @"vec'symbols"
+vec'tags ::
+  forall f s a.
+  (Prelude.Functor f,
+   Data.ProtoLens.Field.HasField s "vec'tags" a) =>
+  Lens.Family2.LensLike' f s a
+vec'tags = Data.ProtoLens.Field.field @"vec'tags"
+version ::
+  forall f s a.
+  (Prelude.Functor f, Data.ProtoLens.Field.HasField s "version" a) =>
+  Lens.Family2.LensLike' f s a
+version = Data.ProtoLens.Field.field @"version"
diff --git a/glean/lang/swift/Glean/Indexer/Swift.hs b/glean/lang/swift/Glean/Indexer/Swift.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/swift/Glean/Indexer/Swift.hs
@@ -0,0 +1,58 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Swift ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Indexer.SCIP ( derive )
+import qualified Glean.SCIP.Driver as SCIP
+import System.FilePath (takeDirectory)
+
+data Swift = Swift
+  { scipGen :: FilePath
+  , target :: String
+  }
+
+options :: Parser Swift
+options = do
+  scipGen <- strOption $
+    long "scip-gen" <>
+    value "scip-gen" <>
+    help "path to an executable generating index.scip from swift code"
+  target <- strOption $
+    long "target" <>
+    value "target" <>
+    help "target to build and index"
+  return Swift{..}
+
+indexer :: Indexer Swift
+indexer = Indexer {
+  indexerShortName = "swift",
+  indexerDescription = "Index Swift code",
+  indexerOptParser = options,
+  indexerRun = \Swift{..} backend repo IndexerParams{..} -> do
+    val <- SCIP.runIndexer SCIP.ScipIndexerParams {
+        scipBinary = scipGen,
+        scipArgs = \outFile ->
+           let outDir = takeDirectory outFile in
+           [ "--output-dir", outDir
+            , "--target", target
+            , "--swift-only"
+            , "--output-type", "scip"
+            , "--build-indexer" ],
+        scipRoot = indexerRoot,
+        scipWritesLocal = False,
+        scipLanguage = Just SCIP.Swift
+      }
+    sendJsonBatches backend repo (scipGen <> "/scip") val
+    derive backend repo
+  }
diff --git a/glean/lang/typescript/Glean/Indexer/Typescript.hs b/glean/lang/typescript/Glean/Indexer/Typescript.hs
new file mode 100644
--- /dev/null
+++ b/glean/lang/typescript/Glean/Indexer/Typescript.hs
@@ -0,0 +1,51 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Indexer.Typescript ( indexer ) where
+
+import Options.Applicative
+
+import Glean.Indexer
+import Glean.Indexer.SCIP ( derive )
+import Glean.Indexer.External
+
+import Glean.SCIP.Driver as SCIP
+
+newtype Typescript = Typescript
+  { scipTypescriptBinary :: FilePath
+  }
+
+options :: Parser Typescript
+options = do
+  scipTypescriptBinary <- strOption $
+    long "scip-typescript" <>
+    value "scip-typescript" <>
+    help "path to the scip-typescipt binary"
+  return Typescript{..}
+
+indexer :: Indexer Typescript
+indexer = Indexer {
+  indexerShortName = "typescript",
+  indexerDescription = "Index Typescript code",
+  indexerOptParser = options,
+  indexerRun = \Typescript{..} backend repo IndexerParams{..} -> do
+    let
+      params = ScipIndexerParams {
+        scipBinary = scipTypescriptBinary,
+        scipArgs = \outFile ->
+           [ "index", "--no-progress-bar"
+           , "--cwd", indexerRoot, "--output", outFile ],
+        scipWritesLocal = False,
+        scipRoot = indexerRoot,
+        scipLanguage = Just SCIP.TypeScript
+      }
+    val <- SCIP.runIndexer params
+    sendJsonBatches backend repo (scipTypescriptBinary <> "/scip") val
+    derive backend repo
+  }
diff --git a/glean/lib/Glean/Derive.hs b/glean/lib/Glean/Derive.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Derive.hs
@@ -0,0 +1,81 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Derive
+  ( derivePredicate
+  ) where
+
+import Control.Concurrent
+import Data.Default
+import Data.Int
+import qualified Data.Text as Text
+
+import Glean
+import Glean.Types
+import Util.Log
+
+-- | Compute and store the specified derived predicate
+derivePredicate
+  :: Glean.Backend b
+  => b
+  -> Repo
+  -> Maybe Int64  -- ^ page size (bytes)
+  -> Maybe Int64  -- ^ page size (results)
+  -> SourceRef
+     -- ^ predicate to derive. This will be resolved using the schema
+     -- specified by the `glean.schema_id` property when the DB was
+     -- created; otherwise the current schema at the time.
+  -> Maybe ParallelDerivation -- ^ how to derive in parallel
+  -> IO ()
+
+derivePredicate backend repo maxBytes maxResults s parallel = loop
+  where
+    loop = do
+      result <- Glean.deriveStored backend (const mempty) repo query
+      case result of
+        DerivationStatus_complete stats ->
+          report "complete" $ derivationComplete_stats stats
+        DerivationStatus_ongoing x -> do
+          report "progress" $ derivationOngoing_stats x
+          retry loop
+
+    query = def
+      { derivePredicateQuery_predicate = name
+      , derivePredicateQuery_predicate_version = version
+      , derivePredicateQuery_options = Just def
+        { derivePredicateOptions_max_results_per_query = maxResults
+        , derivePredicateOptions_max_bytes_per_query = maxBytes
+        }
+      , derivePredicateQuery_parallel = parallel
+      }
+
+    SourceRef name version = s
+
+    predicate = unwords [showRepo repo, Text.unpack $ showRef s]
+
+    report status stats = do
+      putStrLn $ unwords
+        [ Text.unpack $ showRef s
+        , ":"
+        , show $ userQueryStats_num_facts stats
+        , "facts"
+        ]
+      vlog 1 $ unwords
+        ["derivation"
+        , status
+        , ":"
+        , predicate
+        , showUserQueryStats stats
+        ]
+
+    retry :: IO a -> IO a
+    retry action = do
+      let sec = 1000000
+      threadDelay $ 1 * sec
+      action
+
diff --git a/glean/lib/Glean/Util/CxxXRef.hs b/glean/lib/Glean/Util/CxxXRef.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/CxxXRef.hs
@@ -0,0 +1,89 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
+module Glean.Util.CxxXRef
+  ( transformXRefs
+  ) where
+
+import Control.Monad
+import Data.List
+import Text.JSON
+
+data XRef = XRef !Int !Int JSValue
+
+order :: XRef -> XRef -> Ordering
+order (XRef o1 n1 v1) (XRef o2 n2 v2) =
+  compare o1 o2 <> compare n2 n1 <> compare v1 v2
+
+-- | Process a `cxx1.FileXRefs` (as JSON) into a flat list of absolute
+-- offsets, which is more useful for inspecting and comparing.  This
+-- is used by regression tests and the special "xref" query in the
+-- shell.
+transformXRefs :: JSValue -> Result JSValue
+transformXRefs v = do
+  [ ("xmap", xmap), ("targets", JSArray targets) ] <- keyVals v
+  [ ("file", file),
+    ("fixed", JSArray fixed),
+    ("froms", JSArray froms) ] <- keyVals xmap
+  fixed_xrefs <- forM fixed $ \x -> do
+    [ ("target", target), ("from", from) ] <- objVals x
+    spans <- fromToByteSpans from
+    return [ XRef o n target | (o, n) <- spans ]
+  when (length froms /= length targets) $ fail "invalid xrefs"
+  variable_xrefs <- forM (zip targets froms) $ \(t, from) -> do
+    JSObject xrefs <- return t
+    JSArray ts <- valFromObj "key" xrefs
+    spans <- fromToByteSpans from
+    return [ XRef o n t | (o, n) <- spans, t <- ts ]
+  return $ makeObj
+    [ ("key", JSObject $ toJSObject
+        [ ("file", file)
+        , ("xrefs", JSArray
+            $ map toXRef
+            $ sortBy order
+            $ concat
+            $ variable_xrefs ++ fixed_xrefs)
+        ])
+    ]
+  where
+    fromToByteSpans from = do
+      [ ("spans", JSArray packedSpans),
+        ("expansions", JSArray packedExpansions),
+        ("spellings", JSArray packedSpellings) ] <- objVals from
+      spans <- unpackByteSpans packedSpans
+      expansions <- unpackByteSpans packedExpansions
+      spellings <- unpackByteSpans packedSpellings
+      return $ sort $ spans ++ expansions ++ spellings
+
+    unpackByteSpans packedByteSpans = do
+      relByteSpans <- mapM toRelByteSpans packedByteSpans
+      return $ reoffset 0 (concat relByteSpans)
+      where
+      toRelByteSpans x = do
+        [("length", JSRational _ n), ("offsets", JSArray offsets)] <- objVals x
+        return $ map ((, floor n) . (\(JSRational _ o) -> floor o)) offsets
+
+    toXRef (XRef o n t) = makeObj
+      [ ("range", makeObj
+          [ ("begin", showJSON o)
+          , ("end", showJSON n)
+          ]),
+        ("target", t)
+      ]
+
+    reoffset !_ [] = []
+    reoffset !k ((o, n) : xs) = (o+k, o+k+n) : reoffset (o+k) xs
+
+    objVals :: JSValue -> Result [(String, JSValue)]
+    objVals (JSObject obj) = return $ fromJSObject obj
+    objVals _ = fail "not an object"
+
+    keyVals :: JSValue -> Result [(String, JSValue)]
+    keyVals (JSObject obj) = objVals =<< valFromObj "key" obj
+    keyVals _ = fail "not an object"
diff --git a/glean/lib/Glean/Util/Declarations.hs b/glean/lib/Glean/Util/Declarations.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/Declarations.hs
@@ -0,0 +1,78 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, ConstraintKinds #-}
+{-# OPTIONS_GHC -Wno-star-is-type #-}
+
+-- | The 'Cxx.Declaration' type has so many cases.  Try to capture some
+-- using 'IsDeclaration' so we can reuse them.
+module Glean.Util.Declarations
+  ( -- * Visiting branches
+    DeclBranch, applyDeclaration
+    -- * Ranges
+  , declarationSrcRange
+    -- * Fact Id
+  , getDeclId
+  ) where
+
+import Data.Int (Int64)
+import Data.Typeable
+
+import Glean.Schema.Cxx1.Types as Cxx -- gen
+import Glean.Schema.Src.Types as Src -- gen
+import Glean.Util.Range (HasSrcRange(..))
+import Glean
+
+-- -----------------------------------------------------------------------------
+
+-- | 'DeclBranch' is the class constraint for writing the case handler
+-- of 'applyDeclaration'
+type DeclBranch p =
+  ( Predicate p
+  , Typeable p
+  , Show p
+  , Typeable (KeyType p), Show (KeyType p)
+  , HasSrcRange (KeyType p)
+  )
+
+-- -----------------------------------------------------------------------------
+
+{-# INLINE applyDeclaration #-}
+-- | Provide a case handler.  If the 'DeclBranch' does not provide enough
+-- constraints then please extend it, or use 'applyConstainedDeclaration'
+applyDeclaration
+  :: (forall a . DeclBranch a => a -> b)
+  -> Cxx.Declaration
+  -> b
+applyDeclaration f = \case
+  Cxx.Declaration_namespace_ d -> f d
+  Cxx.Declaration_usingDeclaration d -> f d
+  Cxx.Declaration_usingDirective d -> f d
+  Cxx.Declaration_record_ d -> f d
+  Cxx.Declaration_enum_ d -> f d
+  Cxx.Declaration_function_ d -> f d
+  Cxx.Declaration_variable d -> f d
+  Cxx.Declaration_objcContainer d -> f d
+  Cxx.Declaration_objcMethod d -> f d
+  Cxx.Declaration_objcProperty d -> f d
+  Cxx.Declaration_typeAlias d -> f d
+  Cxx.Declaration_namespaceAlias d -> f d
+  Cxx.Declaration_EMPTY -> error "unknown declaration branch"
+
+
+-- -----------------------------------------------------------------------------
+
+declarationSrcRange :: Cxx.Declaration -> Maybe Src.Range
+declarationSrcRange = applyDeclaration (fmap srcRange . getFactKey)
+-- -----------------------------------------------------------------------------
+
+{-# INLINE getDeclId #-}
+-- | The fact id from 'getDeclId' can be from the type of any branch, so
+-- it cannot be 'IdOf'
+getDeclId :: Cxx.Declaration -> Int64
+getDeclId = applyDeclaration (fromFid . idOf . getId)
diff --git a/glean/lib/Glean/Util/PredMap.hs b/glean/lib/Glean/Util/PredMap.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/PredMap.hs
@@ -0,0 +1,114 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveTraversable, GeneralizedNewtypeDeriving #-}
+-- | A tagged intmap to keep the type of keys clear.  Mainly intended for
+-- Glean predicates.
+module Glean.Util.PredMap
+  ( PredMap(..), makePredMap, fromList, fromDistinctAscList, fromListWith
+  , lookup, findWithDefault, mapMaybe, alter, empty, insert, insertWith, elems
+  , union
+  , unionsWith
+  , keys
+  , toList, toAscList
+  , size
+  , member, notMember
+  , filterValues
+  ) where
+
+import Control.DeepSeq (NFData)
+import Data.IntMap.Strict (IntMap)
+import qualified Data.IntMap.Strict as IntMap
+import qualified Data.Maybe (mapMaybe)
+import Prelude hiding (lookup)
+
+import Glean hiding (keys)
+
+-- -----------------------------------------------------------------------------
+-- Helpers, to make most of this module into one liners
+
+one :: IdOf p -> Int
+one = fromIntegral . fromFid . idOf
+
+withKey :: (IdOf p, v) -> (Int, v)
+withKey (p, v) = (one p, v)
+
+-- -----------------------------------------------------------------------------
+
+-- | I want some more type safety around IntMap. The 'p' will usually
+-- be a Predicate type, e.g. (IdOf p) as the logical key.
+newtype PredMap p v = PredMap { predMap :: IntMap v }
+  deriving (Show, Semigroup, Monoid, Functor, Foldable, Traversable, NFData)
+
+empty :: PredMap p v
+empty = PredMap IntMap.empty
+
+-- | Simplest way to make a 'PredMap' but not the only way.  Any 'p' without
+-- a key are silently dropped.
+makePredMap :: Predicate p => [p] -> PredMap p (KeyType p)
+makePredMap = PredMap . IntMap.fromList . Data.Maybe.mapMaybe getWithKey
+  where getWithKey p = (one (getId p),) <$> getFactKey p
+
+fromList :: [(IdOf p, v)] -> PredMap p v
+fromList = PredMap . IntMap.fromList . map withKey
+
+fromDistinctAscList :: [(IdOf p, v)] -> PredMap p v
+fromDistinctAscList = PredMap . IntMap.fromDistinctAscList . map withKey
+
+fromListWith :: (v -> v -> v) -> [(IdOf p, v)] -> PredMap p v
+fromListWith f = PredMap . IntMap.fromListWith f . map withKey
+
+lookup :: Predicate p => IdOf p -> PredMap p v -> Maybe v
+lookup p pm = IntMap.lookup (one p) (predMap pm)
+
+findWithDefault :: Predicate p => v -> IdOf p -> PredMap p v -> v
+findWithDefault d p = IntMap.findWithDefault d (one p) . predMap
+
+mapMaybe :: Predicate p => (a -> Maybe b) -> PredMap p a -> PredMap p b
+mapMaybe f = PredMap . IntMap.mapMaybe f . predMap
+
+alter :: (Maybe v -> Maybe v) -> IdOf p -> PredMap p v -> PredMap p v
+alter f p = PredMap . IntMap.alter f (one p) . predMap
+
+insert :: IdOf p -> v -> PredMap p v -> PredMap p v
+insert p v = PredMap . IntMap.insert (one p) v . predMap
+
+insertWith :: (v -> v -> v) -> IdOf p -> v -> PredMap p v -> PredMap p v
+insertWith f p v = PredMap . IntMap.insertWith f (one p) v . predMap
+
+union :: PredMap p v -> PredMap p v -> PredMap p v
+union a b = PredMap $ IntMap.union (predMap a) (predMap b)
+
+unionsWith :: (v -> v -> v) -> [PredMap p v] -> PredMap p v
+unionsWith f = PredMap . IntMap.unionsWith f . map predMap
+
+keys :: PredMap p v -> [IdOf p]
+keys = map (\k -> IdOf (Fid (fromIntegral k))) . IntMap.keys . predMap
+
+elems :: PredMap p v -> [v]
+elems = IntMap.elems . predMap
+
+-- | Synonym of 'toAscList'
+toList :: PredMap p v -> [(IdOf p, v)]
+toList = toAscList
+
+toAscList :: PredMap p v -> [(IdOf p, v)]
+toAscList = map (\ (k, v) -> (IdOf (Fid (fromIntegral k)), v))
+       . IntMap.toAscList . predMap
+
+size :: PredMap p v -> Int
+size = IntMap.size . predMap
+
+member :: IdOf p -> PredMap p v -> Bool
+member p pm = IntMap.member (one p) (predMap pm)
+
+notMember :: IdOf p -> PredMap p v -> Bool
+notMember p pm = IntMap.notMember (one p) (predMap pm)
+
+filterValues :: (v -> Bool) -> PredMap p v -> PredMap p v
+filterValues f (PredMap m) = PredMap $ IntMap.filter f m
diff --git a/glean/lib/Glean/Util/PredSet.hs b/glean/lib/Glean/Util/PredSet.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/PredSet.hs
@@ -0,0 +1,94 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+-- | A tagged intset to keep the type of keys clear.  Mainly intended for
+-- Glean predicates.
+module Glean.Util.PredSet
+  ( PredSet(..), fromList, fromDistinctAscList
+  , empty, insert, toList, toAscList, size
+  , member, notMember
+  , singleton, union, difference
+    -- * PredSet to/from PredMap
+  , keysSet, fromSet, fromSetM
+  ) where
+
+import Control.DeepSeq (NFData)
+import qualified Data.IntMap.Strict as IntMap
+import Data.IntSet (IntSet)
+import qualified Data.IntSet as IntSet
+import Prelude hiding (lookup)
+
+import Glean
+import Glean.Util.PredMap (PredMap)
+import qualified Glean.Util.PredMap as PredMap
+
+-- -----------------------------------------------------------------------------
+
+{-# INLINE one #-}
+one :: IdOf p -> Int
+one = fromIntegral . fromFid . idOf
+
+-- -----------------------------------------------------------------------------
+
+-- | I want some more type safety around IntSet. The 'p' will usually
+-- be a Predicate type, e.g. (IdOf p) as the logical key.
+newtype PredSet p = PredSet { predSet :: IntSet }
+  deriving (Show, Semigroup, Monoid, NFData)
+
+fromList :: [IdOf p] -> PredSet p
+fromList = PredSet . IntSet.fromList . map one
+
+singleton :: IdOf p -> PredSet p
+singleton = PredSet . IntSet.singleton . one
+
+fromDistinctAscList :: [IdOf p] -> PredSet p
+fromDistinctAscList = PredSet . IntSet.fromDistinctAscList . map one
+
+empty :: PredSet p
+empty = PredSet IntSet.empty
+
+insert :: IdOf p -> PredSet p -> PredSet p
+insert p = PredSet . IntSet.insert (one p) . predSet
+
+-- | Synonym for 'toAscList'
+toList :: PredSet p -> [IdOf p]
+toList = toAscList
+
+toAscList :: PredSet p -> [IdOf p]
+toAscList = map (IdOf . Fid . fromIntegral) . IntSet.toAscList . predSet
+
+size :: PredSet p -> Int
+size = IntSet.size . predSet
+
+member :: IdOf p -> PredSet p -> Bool
+member k pm = IntSet.member (one k) (predSet pm)
+
+notMember :: IdOf p -> PredSet p -> Bool
+notMember k pm = IntSet.notMember (one k) (predSet pm)
+
+union :: PredSet p -> PredSet p -> PredSet p
+union x y = PredSet $ IntSet.union (predSet x) (predSet y)
+
+difference :: PredSet p -> PredSet p -> PredSet p
+difference x y = PredSet $ IntSet.difference (predSet x) (predSet y)
+
+-- -----------------------------------------------------------------------------
+
+keysSet :: PredMap p v -> PredSet p
+keysSet = PredSet . IntMap.keysSet . PredMap.predMap
+
+fromSet :: (IdOf p -> v) -> PredSet p -> PredMap p v
+fromSet f =
+  PredMap.PredMap . IntMap.fromSet (f . IdOf . Fid . fromIntegral) . predSet
+
+fromSetM :: Monad m => (IdOf p -> m v) -> PredSet p -> m (PredMap p v)
+fromSetM f ps = do
+  let ks = toAscList ps
+  kvs <- mapM (\ k -> (k,) <$> f k) ks
+  return (PredMap.fromDistinctAscList kvs)
diff --git a/glean/lib/Glean/Util/Range.hs b/glean/lib/Glean/Util/Range.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/Range.hs
@@ -0,0 +1,532 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | There are several concepts of ranges to convert between.
+module Glean.Util.Range
+  ( -- * source range get/set
+    HasSrcRange(..)
+    -- * byte range
+  , ByteRange(..)
+  , byteRangeExclusiveEnd
+  , byteRangeContains
+  , srcRangeToByteRange
+  , packedByteSpansToRanges
+  , fromToSpansAndExpansions
+  , fromToSpansAndSpellings
+  , rangesToPackedByteSpans
+  , byteSpanToRange
+  , rangeToByteSpan
+  -- * comparisons
+  , compareLineCol
+  , rangeContains
+  , compareRange
+  , topLevelRanges
+  -- * LineOffsets
+  , LineOffsets(..), getLineOffsets, lengthsToLineOffsets, firstLineOffsetsDiff
+  , sameUpToLastNewline, debugLineOffsets
+  , srcRangeToFileLocation
+  , srcRangeToSimpleByteRange
+  , mkFileLines
+  -- ** converting with LineOffsets
+  , byteOffsetToLineCol
+  , byteRangeToRange
+  , byteRangesToLineNumbers
+  ) where
+
+import Control.DeepSeq
+import Control.Exception.Extra (Partial)
+import Data.Bifunctor (bimap)
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as B
+import Data.Function (on)
+import Data.List (groupBy, sortBy)
+import Data.List.Extra (chunksOf, merge)
+import Data.Maybe (fromMaybe)
+import qualified Data.String.UTF8 as UTF8 hiding (take)
+import qualified Data.Vector as BoxedVector
+import Data.Vector.Unboxed (Vector, (!), (!?))
+import qualified Data.Vector.Unboxed as Vector
+import Data.Word
+
+import Glean (toNat, fromNat)
+import Glean.Schema.Pp1.Types as Pp
+import Glean.Schema.Src.Types as Src hiding (ByteRange(..))
+import Glean.Schema.Cxx1.Types as Cxx
+
+class HasSrcRange a where
+  srcRange :: a -> Src.Range
+  setSrcRange :: Src.Range -> a -> a
+
+instance HasSrcRange Cxx.NamespaceDeclaration_key where
+  srcRange = namespaceDeclaration_key_source
+  setSrcRange r a = a{ namespaceDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.RecordDeclaration_key where
+  srcRange = recordDeclaration_key_source
+  setSrcRange r a = a{ recordDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.EnumDeclaration_key where
+  srcRange = enumDeclaration_key_source
+  setSrcRange r a = a{ enumDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.FunctionDeclaration_key where
+  srcRange = functionDeclaration_key_source
+  setSrcRange r a = a{ functionDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.ObjcContainerDeclaration_key where
+  srcRange = objcContainerDeclaration_key_source
+  setSrcRange r a = a{ objcContainerDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.ObjcMethodDeclaration_key where
+  srcRange = objcMethodDeclaration_key_source
+  setSrcRange r a = a{ objcMethodDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.ObjcPropertyDeclaration_key where
+  srcRange = objcPropertyDeclaration_key_source
+  setSrcRange r a = a{ objcPropertyDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.UsingDeclaration_key where
+  srcRange = usingDeclaration_key_source
+  setSrcRange r a = a{ usingDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.UsingDirective_key where
+  srcRange = usingDirective_key_source
+  setSrcRange r a = a{ usingDirective_key_source = r }
+
+instance HasSrcRange Cxx.TypeAliasDeclaration_key where
+  srcRange = typeAliasDeclaration_key_source
+  setSrcRange r a = a{ typeAliasDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.NamespaceAliasDeclaration_key where
+  srcRange = namespaceAliasDeclaration_key_source
+  setSrcRange r a = a{ namespaceAliasDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.VariableDeclaration_key where
+  srcRange = variableDeclaration_key_source
+  setSrcRange r a = a{ variableDeclaration_key_source = r }
+
+instance HasSrcRange Cxx.Enumerator_key where
+  srcRange = enumerator_key_source
+  setSrcRange r a = a{ enumerator_key_source = r }
+
+instance HasSrcRange Pp.Define_key where
+  srcRange = define_key_source
+  setSrcRange r a = a{ define_key_source = r }
+
+instance HasSrcRange Pp.Use_key where
+  srcRange = use_key_source
+  setSrcRange r a = a{ use_key_source = r }
+
+data ByteRange = ByteRange
+  { byteRange_begin :: {-# UNPACK #-}!Word64
+  , byteRange_length :: {-# UNPACK #-}!Word64
+  }
+  deriving (Show, Eq, Ord)
+
+instance NFData ByteRange where
+  rnf = (`seq` ())
+
+-- | Compute the (exclusive) end offset
+byteRangeExclusiveEnd :: ByteRange -> Word64
+byteRangeExclusiveEnd ByteRange{..} = byteRange_begin + byteRange_length
+
+-- | byteRangeContains r1 r2 is True iff r1 contains the range r2
+byteRangeContains :: ByteRange -> ByteRange -> Bool
+byteRangeContains r1 r2 =
+  byteRange_begin r1 <= byteRange_begin r2 &&
+  byteRangeExclusiveEnd r1 >= byteRangeExclusiveEnd r2
+
+-- | Positions of start of each line in bytes.
+--
+-- Index `lineOffsets` with 0-based line number to get start of that line.
+--
+-- Never empty, the first value is always zero, strictly monotonically
+-- ascending.
+data LineOffsets = LineOffsets
+  { lineOffsets :: Vector Word64
+  , lineOffsets_endsInNewline :: Bool
+  , lineOffsets_hasUnicodeOrTabs :: Bool
+  } deriving ( Eq, Show, Ord )
+
+-- | Help with debugging by showin a multi-line friendly view of 'LineOffsets'
+-- prefixed with the provided 'String' label.
+debugLineOffsets :: String -> LineOffsets -> String
+debugLineOffsets msg x =
+  let prefix = msg <> ": "
+      header =
+        [ "Length of lineOffsets :: Vector Word64 = "
+          <> show (Vector.length (lineOffsets x))
+        , "Ends in newline: " <> show (lineOffsets_endsInNewline x)
+        , "Has unicode or tabs: " <> show (lineOffsets_hasUnicodeOrTabs x) ]
+      lengths = map show (chunksOf 10 (Vector.toList
+        (lineOffsets x)))
+  in unlines (map (prefix<>) (header ++ lengths))
+
+-- | This finds the newlines (each line includes terminating newline) as well
+-- as the final line.
+getLineOffsets :: ByteString -> LineOffsets
+getLineOffsets bs
+  | B.null bs = LineOffsets (Vector.singleton 0) False False
+  | otherwise =
+    let newlines = map (succ . fromIntegral) (B.elemIndices '\n' bs)
+        lineOffsets_hasUnicodeOrTabs = B.any (\c -> c == '\t' || c >= big) bs
+          where big = toEnum 128
+    in if B.last bs == '\n'
+        then LineOffsets
+          { lineOffsets = Vector.fromList . (0:) $ newlines
+          , lineOffsets_endsInNewline = True
+          , lineOffsets_hasUnicodeOrTabs }
+        else LineOffsets
+          { lineOffsets = Vector.fromList . (0:)
+             . (++ [fromIntegral (B.length bs)])
+             $ newlines
+          , lineOffsets_endsInNewline = False
+          , lineOffsets_hasUnicodeOrTabs }
+
+mkFileLines :: Src.File -> LineOffsets -> Src.FileLines_key
+mkFileLines fp offs =
+  Src.FileLines_key
+    { fileLines_key_file = fp
+    , fileLines_key_lengths =
+        let lineOffs = Vector.toList $ lineOffsets offs in
+        map toNat $ zipWith (-) (drop 1 lineOffs) lineOffs
+    , fileLines_key_endsInNewline = lineOffsets_endsInNewline offs
+    , fileLines_key_hasUnicodeOrTabs = lineOffsets_hasUnicodeOrTabs offs
+    }
+
+-- | This assumes that the fileLines_key_lengths are strictly positive
+lengthsToLineOffsets :: Src.FileLines_key -> LineOffsets
+lengthsToLineOffsets flk = LineOffsets
+  { lineOffsets = Vector.fromList $
+      scanl (+) 0 (map fromNat (fileLines_key_lengths flk))
+  , lineOffsets_endsInNewline = fileLines_key_endsInNewline flk
+  , lineOffsets_hasUnicodeOrTabs = fileLines_key_hasUnicodeOrTabs flk }
+
+-- | For 0-based lines, the index of the first line to disagree, if any.
+--
+-- If one vector is an incomplete prefix of the other vector, then the
+-- index of first difference will be the (length-1) of the shorter vector.
+--
+-- The returned Int is always greater than or equal to zero
+-- (a good 0-based line number).
+firstLineOffsetsDiff :: LineOffsets -> LineOffsets -> Maybe Int
+firstLineOffsetsDiff lo1 lo2 =
+    case Vector.findIndex not (Vector.zipWith (==) v1 v2) of
+      Nothing -> if Vector.length v1 == Vector.length v2
+        then Nothing -- assert than 0 < length v1 && 0 < length v2
+        else Just (pred (min (Vector.length v1) (Vector.length v2)))
+      Just i -> Just (pred i) -- assert that 0 < i
+  where
+    v1 = lineOffsets lo1
+    v2 = lineOffsets lo2
+
+-- | Diffusion is crazy and omits the trailing newline.  So cope with
+-- only differing at the trailing newline. Returns 'True' when the two
+-- arguments have identical length lines, or if they merely disagree about the
+-- final newline and so thus one (with final newline) has the last line length
+-- of 1 greater than the other.
+sameUpToLastNewline :: LineOffsets -> LineOffsets -> Bool
+sameUpToLastNewline a b = case firstLineOffsetsDiff a b of
+  Nothing -> True
+  Just line0 -> lineOffsets_endsInNewline x
+    && not (lineOffsets_endsInNewline y)
+    && (Vector.length (lineOffsets x) == Vector.length (lineOffsets y))
+    && (2 + line0 == Vector.length (lineOffsets x))
+    && (Vector.last (lineOffsets x) == 1 + Vector.last (lineOffsets y))
+  where
+    -- If at least one of a or b ends in newline then x ends in newline
+    (x, y) | lineOffsets_endsInNewline a = (a, b)
+           | otherwise = (b, a)
+
+
+-- | Using the information in 'LineOffsets' this converts a 'Word64' byte
+-- offset into a pair of (1-based line, 0-based column).
+--
+-- This is a total function, but there are numerous unspecified conditions
+-- (which may result in the line number being 0).
+--
+-- This requires 'lineOffsets' to be non-empty and ascending with no duplicates
+-- to get a sane return value.
+--
+-- This does handle 'lineOffsets_endsInNewline' correctly.
+--
+-- This does not handle 'lineOffsets_hasUnicodeOrTabs' yet, so column
+-- number is actually byte offset along that line and only correct for Ascii.
+-- ( To handle this would require the actual 'Text' or utf8 'ByteString' )
+-- Tracked in T62313027
+--
+-- If you ask for a byte offset smaller than the first 'lineOffsets' value then
+-- then return is unspecified.
+-- If you ask for a byte offset larger than the last in 'lineOffsets' value then
+-- the return is unspecified.
+-- If 'lineOffsets' is empty then the line return is unspecified.
+-- If 'lineOffsets' has duplicates then the line return is unspecified.
+-- if 'lineOffsets' is ever descending then the line returned is unspecified.
+--
+-- Unicode versus column number
+--
+-- This needs to become utf-8 aware, and make column count codepoints.
+-- utf-8 bytes can be classified as
+-- * 0 .. 127 : Ascii
+-- * 128..191 : continue multibyte codepoint
+-- * 192 .. 193 : invalid
+-- * 194 .. 244 : Start of multibyte codepoint
+-- * 245 .. 255 : invalid
+-- Need to count Ascii and Start characters from the start of the line to
+-- the current position.
+--
+-- For bonus points, ignore utf-8 BOM in the first line (0xEF, 0xBB, 0xBF).
+byteOffsetToLineCol :: LineOffsets -> Word64 -> (Word64, Word64)
+byteOffsetToLineCol LineOffsets{lineOffsets=a, ..}
+    | Vector.length a == 0 = (0,)   -- should not happen, unspecified answer
+    | Vector.length a == 1 = \p ->
+        if p < a!0 then (0, p)      -- before first line, unspecified answer
+                   else done 0 p    -- only one line, you are on it
+    | otherwise = search
+  where
+    search p | p < a!0 = (0, p)     -- before first line, unspecified answer
+             | a!e <= p = done e p  -- after final newline (not impossible)
+             | otherwise = go 0 e   -- know 0 < e due to above guards
+      where
+        -- know 0 <= e since 2 <= Vector.length a due to original guards
+        e | lineOffsets_endsInNewline = pred (Vector.length a) -- final \n
+          | otherwise = pred (pred (Vector.length a)) -- final \n is earlier
+        go :: Int -> Int -> (Word64, Word64)
+        go i j = -- know (a!i) <= p < (a!j) and i < j
+          if succ i == j -- found precise line
+          then done i p
+          else  -- know i < succ i < j
+               let mid = i + ((j - i + 1) `quot` 2) -- know i < mid < j
+               in if p < a!mid
+                  then go i mid -- know (a!i) <= p < (a!mid) and i < mid
+                  else go mid j -- know (a!mid) <= p < (a!j) and mid < j
+    -- Does not handle tabs or unicode yet
+    done :: Int -> Word64 -> (Word64, Word64)
+    done line_zero_based bytes =
+      let line_one_based = fromIntegral (succ line_zero_based)
+          column_zero_based = bytes - a!line_zero_based
+      in (line_one_based, column_zero_based )
+
+-- | Convert a Src.Range to a ByteRange, given a Src.FileLines
+srcRangeToByteRange
+  :: Src.FileLines_key
+  -> ByteString
+  -> (Src.Range -> ByteRange)
+srcRangeToByteRange flk contents =
+  let
+    LineOffsets{..} = lengthsToLineOffsets flk
+
+    -- Takes a single line and computes vector of utf-8 byte offsets of each
+    -- unicode character (codepoint) in the row.
+    -- Index the vector with a 0-based character-col
+    -- and the values is the 0-based byte-offset-col
+    --
+    -- tabs characters are not expanded, so count as 1 byte wide.
+    charOffsets :: ByteString -> Vector Word64
+    charOffsets b = Vector.fromList $ 0 : go 0 (UTF8.fromRep b)
+      where
+      go :: Int -> UTF8.UTF8 ByteString -> [Word64]
+      go off rest = case UTF8.uncons rest of
+        Nothing -> []
+        Just (_, more) -> fromIntegral newOffset : go newOffset more
+          where newOffset = off + B.length (UTF8.toRep rest)
+                  - B.length (UTF8.toRep more)
+
+    -- Take 0-based line and character-column, return 0-based byte-offset-column
+    -- This is always identity when there are no unicode or tab characters
+    charToByteCol :: Int -> Int -> Word64
+    charToByteCol
+      | lineOffsets_hasUnicodeOrTabs = \line col ->
+         let
+           offsets = lineVec BoxedVector.! line
+           size = Vector.length offsets
+         in
+         -- Don't return _|_ if the column is out of range, just clamp
+         -- to the end of the line.
+         if col < size
+            then offsets ! col
+            else offsets ! (size-1)
+      | otherwise = \_ col -> fromIntegral col
+      where
+      lineVec = BoxedVector.fromList $ map charOffsets (B.lines contents)
+
+  in
+    srcRangeToAdjustedByteRange (Just charToByteCol) lineOffsets
+
+-- | Convert a 'Src.Range' to a 'ByteRange', given a 'LineOffsets{lineOffsets}'
+-- and an optional function to correct for unicode and tab characters
+-- (where bytes and characters are not the same width).
+--
+-- If Nothing is passed then this assumes characters are one byte wide.
+-- In particular this assumes the 'columnBegin' and 'columnEnd' in the
+-- 'Src.Range' are the same as byte offsets. Thus Nothing is equivalent to
+-- passing @(\ _ col -> fromIntegral col)@ as the function.
+srcRangeToAdjustedByteRange
+  :: Partial
+  => Maybe (Int -> Int -> Word64)
+    -- ^ converts column from character count to byte count.
+    -- Takes line (0-based) and column (0-based character count)
+    -- to 0-based byte-count column.
+  -> Vector Word64
+  -> Src.Range
+  -> ByteRange
+srcRangeToAdjustedByteRange mCharToByte lineOffsets Src.Range{..} =
+  let
+    -- Convert from 1-based line and col (from Src.Range) to 0-based, and
+    -- be careful subtracting Word64 to avoid wrap-around
+    prevNat n = let w = fromNat n in fromIntegral (pred (max 1 w))
+    charToByteCol = fromMaybe (\ _ col -> fromIntegral col) mCharToByte
+
+    -- compute 0-based lines and column coordinates from Src.Range
+    -- * lines need to be 0-based to be an index into lineOffsets
+    --     and to be passed to charToByteCol
+    -- * columns need to be 0-based to be passed to charToByteCol
+    --     (and then add to the byte offset)
+    lineBegin = prevNat range_lineBegin
+    lineEnd = prevNat range_lineEnd
+    colBegin = prevNat range_columnBegin
+    colEnd = prevNat range_columnEnd
+    -- Note: range_columnEnd is the column of the last char (inclusive)
+    -- so colEnd is inclusive, and so is inclusiveEnd
+    lBegin = fromMaybe (error err) (lineOffsets !? lineBegin)
+    lEnd = fromMaybe (error err) (lineOffsets !? lineEnd)
+    err = show (lineBegin, lineEnd, Vector.length lineOffsets)
+    begin = lBegin + charToByteCol lineBegin colBegin
+    inclusiveEnd = lEnd + charToByteCol lineEnd colEnd
+    -- be careful subtracting Word64 to avoid wrap-around
+    len | begin <= inclusiveEnd = (inclusiveEnd - begin) + 1
+        | otherwise = 0
+  in
+  ByteRange{ byteRange_begin = begin, byteRange_length = len }
+
+-- | Convert a Src.Range to a ByteRange, given a LineOffsets, and assuming
+-- columns count bytes (assuming characters and bytes and the same width).
+srcRangeToSimpleByteRange :: Partial => LineOffsets -> Src.Range -> ByteRange
+srcRangeToSimpleByteRange = srcRangeToAdjustedByteRange Nothing . lineOffsets
+
+-- | Convert a Src.Range to a Src.FileLocation, given the length of each line
+-- of the file. CAN'T be used with files that have unicode or tab characters.
+srcRangeToFileLocation
+  :: [Int]
+  -> (Src.Range -> Src.FileLocation)
+srcRangeToFileLocation lengths =
+  let
+    lineOffsets :: Vector Word64
+    lineOffsets = Vector.fromList $
+      scanl (+) 0 (map fromIntegral lengths)
+  in
+    \ sr ->
+      let
+        br = srcRangeToAdjustedByteRange Nothing lineOffsets sr
+      in
+        Src.FileLocation
+          { fileLocation_file = range_file sr
+          , fileLocation_span = Src.ByteSpan
+            { byteSpan_start = toNat (byteRange_begin br)
+            , byteSpan_length = toNat (byteRange_length br)
+            }
+          }
+
+packedByteSpansToRanges :: Src.PackedByteSpans -> [ByteRange]
+packedByteSpansToRanges = go 0
+  where
+  go !_ [] = []
+  go !off (Src.PackedByteSpansGroup{..} : rest) =
+    go2 off (fromNat packedByteSpansGroup_length) packedByteSpansGroup_offsets rest
+    where
+    go2 !off !_ [] rest = go off rest
+    go2 !prev !len (off : offs) rest =
+      ByteRange (fromNat off + prev) len :
+        go2 (fromNat off + prev) len offs rest
+
+fromToSpansAndExpansions :: Cxx.From -> [ByteRange]
+fromToSpansAndExpansions Cxx.From{..} =
+  merge (packedByteSpansToRanges from_spans)
+        (packedByteSpansToRanges from_expansions)
+
+fromToSpansAndSpellings :: Cxx.From -> [ByteRange]
+fromToSpansAndSpellings Cxx.From{..} =
+  merge (packedByteSpansToRanges from_spans)
+        (packedByteSpansToRanges from_spellings)
+
+rangesToPackedByteSpans :: [ByteRange] -> Src.PackedByteSpans
+rangesToPackedByteSpans [] = []
+rangesToPackedByteSpans (ByteRange begin len : rest) =
+  go begin len [toNat begin] rest
+  where
+  go !off !len acc (ByteRange begin len' : rest)
+    | len == len' = go begin len (tok : acc) rest
+    | otherwise =
+        Src.PackedByteSpansGroup (toNat len) (reverse acc) :
+          go begin len' [tok] rest
+    where
+    !tok = toNat (begin-off)
+  go !_ !_ [] [] = []
+  go !_ !len acc [] = [Src.PackedByteSpansGroup (toNat len) (reverse acc)]
+
+-- | Convert Src schema bytespans to ranges
+byteSpanToRange :: Src.ByteSpan -> ByteRange
+byteSpanToRange Src.ByteSpan{..} = ByteRange
+  { byteRange_begin = fromNat byteSpan_start
+  , byteRange_length = fromNat byteSpan_length
+  }
+
+-- | Convert byte ranges to Src schema bytespans
+rangeToByteSpan :: ByteRange -> Src.ByteSpan
+rangeToByteSpan ByteRange{..} = Src.ByteSpan
+  { byteSpan_start = toNat byteRange_begin
+  , byteSpan_length = toNat byteRange_length
+  }
+
+-- | Convert from byte coordinates to (line, col) coordinates.
+--
+-- This does not yet handle uncode or tabs, which would require access
+-- the contents of the file.
+byteRangeToRange :: Src.File -> LineOffsets -> ByteRange -> Src.Range
+byteRangeToRange range_file lineOffsets be@ByteRange{..} =
+  let -- be careful subtracting Word64 to avoid wrap-around
+      inclusiveEnd = pred (max 1 (byteRangeExclusiveEnd be))
+      -- Convert from 0-based col to 1-based col for Src.Range
+      nextNat w = toNat (succ w)
+      (range_lineBegin, range_columnBegin) = bimap toNat nextNat $
+        byteOffsetToLineCol lineOffsets byteRange_begin
+      (range_lineEnd, range_columnEnd) = bimap toNat nextNat $
+        byteOffsetToLineCol lineOffsets inclusiveEnd
+  in Src.Range{..}
+
+byteRangesToLineNumbers :: LineOffsets -> [ByteRange] -> [Word64]
+byteRangesToLineNumbers lineOffsets =  map
+  (fst . byteOffsetToLineCol lineOffsets . byteRange_begin)
+
+-- | @compareLineCol line col a b@ is a helper for comparing @(line, col)@
+-- coordinates of @a@ and @b@
+compareLineCol :: Ord x => (a -> x) -> (a -> x) -> a -> a -> Ordering
+compareLineCol line col a b = (compare `on` line) a b <> (compare `on` col) a b
+
+-- | @rangeContains x y@ is True iff the range of y is the same as x, or
+-- inside x.
+rangeContains :: Src.Range -> Src.Range -> Bool
+rangeContains big small =
+  ((==) `on` Src.range_file) big small &&
+  checkLE Src.range_lineBegin Src.range_columnBegin big small &&
+  checkLE Src.range_lineEnd Src.range_columnEnd small big
+  where
+    checkLE line col a b = GT /= compareLineCol line col a b
+
+-- | Order is by file id, ascending begin position, descending end position.
+compareRange :: Src.Range -> Src.Range -> Ordering
+compareRange r1 r2 =
+  (compare `on` (Src.file_id . Src.range_file)) r1 r2 <>
+  compareLineCol Src.range_lineBegin Src.range_columnBegin r1 r2 <>
+  compareLineCol Src.range_lineEnd Src.range_columnEnd r2 r1
+
+-- | Sort and filter the @[a]@ removing contained items. Order is by file,
+-- ascending begin position, descending end position.
+topLevelRanges :: (a -> Src.Range) -> [a] -> [a]
+topLevelRanges f = map head . groupBy (rangeContains `on` f)
+  . sortBy (compareRange `on` f)
diff --git a/glean/lib/Glean/Util/Same.hs b/glean/lib/Glean/Util/Same.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/Same.hs
@@ -0,0 +1,33 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilyDependencies #-}
+module Glean.Util.Same
+  ( queryDeclFamily
+  ) where
+
+import Glean
+import Glean.Angle
+import qualified Glean.Angle as Angle
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.ToAngle
+
+-- | Use 'Cxx.DeclToFamily' to find the same facts (shallow query)
+--
+-- Always returns non-empty list, in same order as in 'Cxx.DeclFamily' fact
+queryDeclFamily :: Cxx.Declaration -> Haxl w [Cxx.Declaration]
+queryDeclFamily decl = do
+  fams <- search_ $ Angle.query $
+    predicate @Cxx.DeclToFamily $
+      rec $ field @"decl" (toAngle decl) end
+  case fams of
+    [] -> return [decl]
+    (Cxx.DeclToFamily _ (Just key):_) ->
+      getKey (Cxx.declToFamily_key_family key)
+    _ -> error ("queryDeclFamily: " ++ show decl)
diff --git a/glean/lib/Glean/Util/ShowSchemaId.hs b/glean/lib/Glean/Util/ShowSchemaId.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/ShowSchemaId.hs
@@ -0,0 +1,28 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.ShowSchemaId
+  ( showSchemaId
+  ) where
+
+import Data.Text (unpack)
+import Options.Applicative ( Parser, help, infoOption, long )
+
+import Glean.Types (unSchemaId)
+import Glean.Schema.Builtin.Types (schema_id)
+
+-- | Adds a flag to show the schema id
+--
+--   > parser <**> helper <**> showSchemaId
+
+showSchemaId :: Parser (a -> a)
+showSchemaId =
+  infoOption (unpack $ unSchemaId schema_id)
+    (long "show-schema-id" <>
+     help "Show schema id and exit"
+     )
diff --git a/glean/lib/Glean/Util/ToAngle.hs b/glean/lib/Glean/Util/ToAngle.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/ToAngle.hs
@@ -0,0 +1,1022 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module Glean.Util.ToAngle
+  ( ToAngle(..)
+  , ToAngleFull(..)
+  , Normalize(..)
+  , Prune(..)
+  ) where
+
+import Glean
+import Glean.Angle
+
+import qualified Glean.Schema.Anglelang.Types as Anglelang
+import qualified Glean.Schema.Src.Types as Src
+import qualified Glean.Schema.Csharp.Types as CSharp
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Erlang.Types as Erlang
+import qualified Glean.Schema.Fbthrift.Types as Fbthrift
+import qualified Glean.Schema.Flow.Types as Flow
+import qualified Glean.Schema.Graphql.Types as GraphQL
+import qualified Glean.Schema.Hack.Types as Hack
+import qualified Glean.Schema.JavaAlpha.Types as Java
+import qualified Glean.Schema.KotlinAlpha.Types as Kotlin
+import qualified Glean.Schema.Lsif.Types as Lsif
+import qualified Glean.Schema.Python.Types as Py
+import qualified Glean.Schema.Scip.Types as Scip
+
+import qualified Glean.Schema.CodeAnglelang.Types as Anglelang
+import qualified Glean.Schema.Code.Types as Code
+import qualified Glean.Schema.CodeHack.Types as Hack
+import qualified Glean.Schema.CodePython.Types as Py
+import qualified Glean.Schema.CodeCxx.Types as Cxx
+import qualified Glean.Schema.CodeGraphql.Types as GraphQL
+import qualified Glean.Schema.CodePp.Types as Pp
+import qualified Glean.Schema.CodeBuck.Types as Buck
+import qualified Glean.Schema.CodeFlow.Types as Flow
+import qualified Glean.Schema.CodeFbthrift.Types as Fbthrift
+import qualified Glean.Schema.CodeHs.Types as Hs
+import Data.Text (Text)
+
+class ToAngle a where
+  -- | Convert a value to a query for that value. Useful when we want to
+  -- use a result we got back from a query in another query.
+  --
+  -- Returns a shallow query and will use fact IDs instead
+  -- of matching by structure, so the resulting query only works on the
+  -- same DB that the value was obtained from. See also toAngleFull.
+  toAngle :: a -> Angle a
+
+class ToAngleFull a where
+  -- | Convert a value to a query for that value. Useful when we want to
+  -- use a result we got back from a query in another query.
+  --
+  -- Return deep queries, provided the parameter is fully
+  -- resolved. Useful for querying a different db from the one the value
+  -- was obtained. See also toAngle.
+  toAngleFull :: a -> Angle a
+
+class Normalize a where
+  -- | Return a canonical representation of Glean fact where
+  -- identifiers are replaced with 0. Useful for comparing facts generated
+  -- from different dbs, as long as the facts are fully computed (all keys
+  -- are present).
+  normalize :: a -> a
+
+instance Normalize Glean.Id where
+  normalize _ = 0
+
+-- | Prune keys, leaving only fact IDs. Useful for hashing values cheaply.
+class Prune a where
+  prune :: a -> a
+
+instance Prune Code.Entity where
+  prune e = case e of
+    Code.Entity_hack (Hack.Entity_decl x) ->
+      Code.Entity_hack (Hack.Entity_decl (prune x))
+    Code.Entity_python (Py.Entity_decl x) ->
+      Code.Entity_python (Py.Entity_decl (prune x))
+    Code.Entity_cxx x ->
+      Code.Entity_cxx (prune x)
+    x -> x
+
+-- | Generically get an Angle key query
+mkKey :: Glean.Predicate p => p -> Angle (Glean.KeyType p)
+mkKey x = asPredicate (factId (Glean.getId x))
+
+-- Haskell types
+
+instance Normalize Nat where
+  normalize = id
+
+instance Normalize Bool where
+  normalize = id
+
+-- Src
+
+instance Normalize Src.FileLocation where
+  normalize (Src.FileLocation x y) =
+    Src.FileLocation (normalize x) (normalize y)
+
+instance Normalize Src.ByteSpan where
+  normalize (Src.ByteSpan x y) =
+    Src.ByteSpan (normalize x) (normalize y)
+
+instance Normalize Src.Range where
+  normalize (Src.Range a b c d e) =
+    Src.Range
+      (normalize a)
+      (normalize b)
+      (normalize c)
+      (normalize d)
+      (normalize e)
+
+-- C pre-processor
+
+instance ToAngle Pp.Entity where
+  toAngle e = case e of
+    Pp.Entity_define x -> alt @"define" (mkKey x)
+    Pp.Entity_undef x -> alt @"undef" (mkKey x)
+    Pp.Entity_include_ x -> alt @"include_" (mkKey x)
+    Pp.Entity_EMPTY -> error "unknown code.pp.Entity"
+
+-- Cxx
+
+instance ToAngle Cxx.Entity where
+  toAngle e = case e of
+    Cxx.Entity_decl x -> alt @"decl" (toAngle x)
+    Cxx.Entity_defn x -> alt @"defn" (toAngle x)
+    Cxx.Entity_enumerator x -> alt @"enumerator" (mkKey x)
+    Cxx.Entity_objcSelectorSlot x -> alt @"objcSelectorSlot" (toAngle x)
+    Cxx.Entity_EMPTY -> error "unknown Entity"
+
+instance Prune Cxx.Entity where
+  prune e = case e of
+    Cxx.Entity_decl x ->
+      Cxx.Entity_decl (prune x)
+    Cxx.Entity_defn x ->
+      Cxx.Entity_defn (prune x)
+    Cxx.Entity_enumerator x ->
+      Cxx.Entity_enumerator (mkFact (getId x) Nothing Nothing)
+    Cxx.Entity_objcSelectorSlot x ->
+      Cxx.Entity_objcSelectorSlot x
+    Cxx.Entity_EMPTY -> error "unknown Entity"
+
+instance ToAngle Cxx.Declaration where
+  toAngle e = case e of
+    Cxx.Declaration_namespace_ x -> alt @"namespace_" (mkKey x)
+    Cxx.Declaration_usingDeclaration x -> alt @"usingDeclaration" (mkKey x)
+    Cxx.Declaration_usingDirective x -> alt @"usingDirective" (mkKey x)
+    Cxx.Declaration_record_ x -> alt @"record_" (mkKey x)
+    Cxx.Declaration_enum_ x -> alt @"enum_" (mkKey x)
+    Cxx.Declaration_function_ x -> alt @"function_" (mkKey x)
+    Cxx.Declaration_variable x -> alt @"variable" (mkKey x)
+    Cxx.Declaration_objcContainer x -> alt @"objcContainer" (mkKey x)
+    Cxx.Declaration_objcMethod x -> alt @"objcMethod" (mkKey x)
+    Cxx.Declaration_objcProperty x -> alt @"objcProperty" (mkKey x)
+    Cxx.Declaration_typeAlias x -> alt @"typeAlias" (mkKey x)
+    Cxx.Declaration_namespaceAlias x -> alt @"namespaceAlias" (mkKey x)
+    Cxx.Declaration_EMPTY -> error "unknown Declaration"
+
+instance Prune Cxx.Declaration where
+  prune e = case e of
+    Cxx.Declaration_namespace_ x ->
+      Cxx.Declaration_namespace_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_usingDeclaration x ->
+      Cxx.Declaration_usingDeclaration (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_usingDirective x ->
+      Cxx.Declaration_usingDirective (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_record_ x ->
+      Cxx.Declaration_record_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_enum_ x ->
+      Cxx.Declaration_enum_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_function_ x ->
+      Cxx.Declaration_function_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_variable x ->
+      Cxx.Declaration_variable (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_objcContainer x ->
+      Cxx.Declaration_objcContainer (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_objcMethod x ->
+      Cxx.Declaration_objcMethod (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_objcProperty x ->
+      Cxx.Declaration_objcProperty (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_typeAlias x ->
+      Cxx.Declaration_typeAlias (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_namespaceAlias x ->
+      Cxx.Declaration_namespaceAlias (mkFact (getId x) Nothing Nothing)
+    Cxx.Declaration_EMPTY -> error "unknown Declaration"
+
+instance ToAngle Cxx.Definition where
+  toAngle e = case e of
+    Cxx.Definition_record_ x -> alt @"record_" (mkKey x)
+    Cxx.Definition_function_ x -> alt @"function_" (mkKey x)
+    Cxx.Definition_enum_ x -> alt @"enum_" (mkKey x)
+    Cxx.Definition_objcMethod x -> alt @"objcMethod" (mkKey x)
+    Cxx.Definition_objcContainer x -> alt @"objcContainer" (mkKey x)
+    Cxx.Definition_variable x -> alt @"variable" (mkKey x)
+    Cxx.Definition_namespace_ x -> alt @"namespace_" (mkKey x)
+    Cxx.Definition_EMPTY -> error "unknown Definition"
+
+instance Prune Cxx.Definition where
+  prune e = case e of
+    Cxx.Definition_record_ x ->
+      Cxx.Definition_record_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_function_ x ->
+      Cxx.Definition_function_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_enum_ x ->
+      Cxx.Definition_enum_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_objcMethod x ->
+      Cxx.Definition_objcMethod (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_objcContainer x ->
+      Cxx.Definition_objcContainer (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_variable x ->
+      Cxx.Definition_variable (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_namespace_ x ->
+      Cxx.Definition_namespace_ (mkFact (getId x) Nothing Nothing)
+    Cxx.Definition_EMPTY -> error "unknown Definition"
+
+instance ToAngle Cxx.ObjcMethodEntity where
+  toAngle e = case e of
+    Cxx.ObjcMethodEntity_decl x -> alt @"decl" (mkKey x)
+    Cxx.ObjcMethodEntity_defn x -> alt @"defn" (mkKey x)
+    Cxx.ObjcMethodEntity_EMPTY -> error "unknown ObjcMethodEntity"
+
+instance ToAngle Cxx.ObjcSelectorSlotEntity where
+  toAngle (Cxx.ObjcSelectorSlotEntity method idx) =
+    rec $
+      field @"objcMethod" (toAngle method) $
+      field @"index" (nat $ fromNat idx)
+    end
+
+instance Normalize Cxx.Declaration where
+  normalize (Cxx.Declaration_objcContainer x) =
+    Cxx.Declaration_objcContainer $ normalize x
+  normalize (Cxx.Declaration_objcMethod x) =
+    Cxx.Declaration_objcMethod $ normalize x
+  normalize (Cxx.Declaration_objcProperty x) =
+    Cxx.Declaration_objcProperty $ normalize x
+  normalize Cxx.Declaration_EMPTY = error "unknown Declaration"
+  normalize _ = error "expected Objc Declaration"
+
+instance Normalize Cxx.ObjcContainerDeclaration where
+  normalize (Cxx.ObjcContainerDeclaration x y) =
+    Cxx.ObjcContainerDeclaration (normalize x) (normalize y)
+
+instance Normalize Cxx.ObjcMethodDeclaration where
+  normalize (Cxx.ObjcMethodDeclaration x y) =
+    Cxx.ObjcMethodDeclaration (normalize x) (normalize y)
+
+instance Normalize Cxx.ObjcPropertyDeclaration where
+  normalize (Cxx.ObjcPropertyDeclaration x y) =
+    Cxx.ObjcPropertyDeclaration (normalize x) (normalize y)
+
+instance Normalize Cxx.ObjcContainerDeclaration_key where
+  normalize (Cxx.ObjcContainerDeclaration_key x y) =
+    Cxx.ObjcContainerDeclaration_key
+      (normalize x)
+      (normalize y)
+
+instance Normalize Cxx.ObjcMethodDeclaration_key where
+  normalize (Cxx.ObjcMethodDeclaration_key a b c d e f g h) =
+    Cxx.ObjcMethodDeclaration_key
+      (normalize a)
+      (normalize b)
+      (normalize c)
+      (normalize d)
+      (normalize e)
+      (normalize f)
+      (normalize g)
+      (normalize h)
+
+instance Normalize Cxx.ObjcPropertyDeclaration_key where
+  normalize (Cxx.ObjcPropertyDeclaration_key a b c d e f g h) =
+    Cxx.ObjcPropertyDeclaration_key
+      (normalize a)
+      (normalize b)
+      (normalize c)
+      (normalize d)
+      (normalize e)
+      (normalize f)
+      (normalize g)
+      (normalize h)
+
+instance Normalize Cxx.ObjcContainerId where
+  normalize (Cxx.ObjcContainerId_protocol x) =
+    Cxx.ObjcContainerId_protocol (normalize x)
+  normalize (Cxx.ObjcContainerId_interface_ x) =
+    Cxx.ObjcContainerId_interface_ (normalize x)
+  normalize (Cxx.ObjcContainerId_implementation x) =
+    Cxx.ObjcContainerId_implementation (normalize x)
+  normalize (Cxx.ObjcContainerId_categoryInterface x) =
+    Cxx.ObjcContainerId_categoryInterface (normalize x)
+  normalize (Cxx.ObjcContainerId_extensionInterface x) =
+    Cxx.ObjcContainerId_extensionInterface (normalize x)
+  normalize (Cxx.ObjcContainerId_categoryImplementation x) =
+    Cxx.ObjcContainerId_categoryImplementation (normalize x)
+  normalize Cxx.ObjcContainerId_EMPTY = error "unknown ObjcContainerId"
+
+instance Normalize Cxx.ObjcCategoryId where
+  normalize (Cxx.ObjcCategoryId x y) =
+    Cxx.ObjcCategoryId (normalize x) (normalize y)
+
+instance Normalize Cxx.ObjcSelector where
+  normalize (Cxx.ObjcSelector x y) =
+    Cxx.ObjcSelector (normalize x) (normalize y)
+
+instance Normalize Cxx.Name where
+  normalize (Cxx.Name x y) = Cxx.Name (normalize x) (normalize y)
+
+instance Normalize Cxx.Type where
+  normalize (Cxx.Type x y) = Cxx.Type (normalize x) (normalize y)
+
+instance Normalize Cxx.Signature where
+  normalize (Cxx.Signature x y) = Cxx.Signature (normalize x) (normalize y)
+
+instance Normalize Cxx.Signature_key where
+  normalize (Cxx.Signature_key x y) =
+    Cxx.Signature_key (normalize x) (normalize y)
+
+instance Normalize Cxx.Parameter where
+  normalize (Cxx.Parameter x y) = Cxx.Parameter (normalize x) (normalize y)
+
+instance ToAngleFull Cxx.Declaration where
+  toAngleFull
+      (Cxx.Declaration_objcContainer (Cxx.ObjcContainerDeclaration _ (Just x))) =
+    alt @"objcContainer" (toAngleFull x)
+  toAngleFull
+      (Cxx.Declaration_objcMethod (Cxx.ObjcMethodDeclaration _ (Just x))) =
+    alt @"objcMethod" (toAngleFull x)
+  toAngleFull
+      (Cxx.Declaration_objcProperty (Cxx.ObjcPropertyDeclaration _ (Just x))) =
+    alt @"objcProperty" (toAngleFull x)
+  toAngleFull Cxx.Declaration_EMPTY = error "unknown Declaration"
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Cxx.ObjcContainerDeclaration_key where
+  toAngleFull (Cxx.ObjcContainerDeclaration_key x y) =
+    rec $
+      field @"id" (toAngleFull x) $
+      field @"source" (toAngleFull y)
+    end
+
+instance ToAngleFull Cxx.ObjcMethodDeclaration_key where
+  toAngleFull
+      (Cxx.ObjcMethodDeclaration_key
+        (Cxx.ObjcSelector _ (Just x)) _ z _ _ _ _ _) =
+    rec $
+      field @"selector" (toAngleFull x) $
+      field @"container" (toAngleFull z)
+    end
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Cxx.ObjcPropertyDeclaration_key where
+  toAngleFull
+      (Cxx.ObjcPropertyDeclaration_key (Cxx.Name _ (Just x)) y _ _ _ _ _ _) =
+    rec $
+      field @"name" (toAngleFull x) $
+      field @"container" (toAngleFull y)
+    end
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Cxx.ObjcContainerId where
+  toAngleFull (Cxx.ObjcContainerId_protocol (Cxx.Name _ (Just x))) =
+    alt @"protocol" (toAngleFull x)
+  toAngleFull (Cxx.ObjcContainerId_interface_ (Cxx.Name _ (Just x))) =
+    alt @"interface_" (toAngleFull x)
+  toAngleFull (Cxx.ObjcContainerId_categoryInterface x) =
+    alt @"categoryInterface" (toAngleFull x)
+  toAngleFull (Cxx.ObjcContainerId_categoryImplementation x) =
+    alt @"categoryImplementation" (toAngleFull x)
+  toAngleFull (Cxx.ObjcContainerId_extensionInterface (Cxx.Name _ (Just x))) =
+    alt @"extensionInterface" (toAngleFull x)
+  toAngleFull (Cxx.ObjcContainerId_implementation (Cxx.Name _ (Just x))) =
+    alt @"implementation" (toAngleFull x)
+  toAngleFull Cxx.ObjcContainerId_EMPTY = error "unknown ObjcContainerId"
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Cxx.ObjcCategoryId where
+  toAngleFull (Cxx.ObjcCategoryId (Cxx.Name _ (Just x)) (Cxx.Name _ (Just y))) =
+    rec $
+      field @"className" (toAngleFull x) $
+      field @"categoryName" (toAngleFull y)
+    end
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Src.Range where
+  toAngleFull (Src.Range (Src.File _ (Just f)) x y z t) =
+    rec $
+      field @"file" (toAngleFull f) $
+      field @"lineBegin" (toAngleFull x) $
+      field @"columnBegin" (toAngleFull y) $
+      field @"lineEnd" (toAngleFull z) $
+      field @"columnEnd" (toAngleFull t)
+    end
+  toAngleFull _ = error "toAngleFull not implemented"
+
+instance ToAngleFull Nat where
+  toAngleFull x = nat $ fromNat x
+
+instance ToAngleFull a => ToAngleFull [a] where
+  toAngleFull = array . map toAngleFull
+
+-- Erlang
+
+instance ToAngle Erlang.Declaration where
+  toAngle d = case d of
+    Erlang.Declaration_func x -> alt @"func" (mkKey x)
+    Erlang.Declaration_EMPTY -> error "unknown Declaration"
+
+-- Angle
+instance ToAngle Anglelang.Entity where
+  toAngle e = rec $ field @"decl" (toAngle decl) end
+    where decl = Anglelang.entity_decl e
+
+instance ToAngle Anglelang.Declaration where
+  toAngle x = case x of
+    Anglelang.Declaration_pred x -> alt @"pred" (mkKey x)
+    Anglelang.Declaration_ty x -> alt @"ty" (mkKey x)
+    Anglelang.Declaration_schema x -> alt @"schema" (mkKey x)
+    Anglelang.Declaration_evolve x -> alt @"evolve" (mkKey x)
+    Anglelang.Declaration_derive_ x -> alt @"derive_" (mkKey x)
+    Anglelang.Declaration_imp x -> alt @"imp" (factId (Glean.getId x))
+    Anglelang.Declaration_EMPTY -> error "unknown Declaration"
+
+-- Buck
+
+instance ToAngle Buck.Entity where
+  toAngle e = case e of
+    Buck.Entity_locator x -> alt @"locator" (mkKey x)
+    Buck.Entity_file x -> alt @"file" (mkKey x)
+    Buck.Entity_definition x -> alt @"definition" (mkKey x)
+    Buck.Entity_EMPTY -> error "unknown entity"
+
+-- Flow
+
+instance ToAngle Flow.Entity where
+  toAngle e = case e of
+    Flow.Entity_decl x -> alt @"decl" (toAngle x)
+    Flow.Entity_module_ x -> alt @"module_" (mkKey x)
+    Flow.Entity_EMPTY -> error "unknown Entity"
+
+instance ToAngle Flow.SomeDeclaration where
+  toAngle e = case e of
+    Flow.SomeDeclaration_localDecl x -> alt @"localDecl" (mkKey x)
+    Flow.SomeDeclaration_memberDecl x -> alt @"memberDecl" (mkKey x)
+    Flow.SomeDeclaration_typeDecl x -> alt @"typeDecl" (mkKey x)
+    Flow.SomeDeclaration_EMPTY -> error "unknown SomeDeclaration"
+
+-- GraphQL
+
+instance ToAngle GraphQL.Entity where
+  toAngle e = case e of
+    GraphQL.Entity_decl x -> alt @"decl" (toAngle x)
+    GraphQL.Entity_EMPTY -> error "unknown Entity"
+
+instance ToAngle GraphQL.Declaration where
+  toAngle e = case e of
+    GraphQL.Declaration_operation_ x -> alt @"operation_" (mkKey x)
+    GraphQL.Declaration_fragment_ x -> alt @"fragment_" (mkKey x)
+    GraphQL.Declaration_field_ x -> alt @"field_" (mkKey x)
+    GraphQL.Declaration_enum_ x -> alt @"enum_" (mkKey x)
+    GraphQL.Declaration_directive_ x -> alt @"directive_" (mkKey x)
+    GraphQL.Declaration_EMPTY -> error "unknown GraphQL.Declaration"
+
+-- Hack
+
+instance ToAngle Hack.Declaration where
+  toAngle e = case e of
+    Hack.Declaration_classConst x -> alt @"classConst" (mkKey x)
+    Hack.Declaration_container x -> alt @"container" (toAngle x)
+    Hack.Declaration_enumerator x -> alt @"enumerator" (mkKey x)
+    Hack.Declaration_function_ x -> alt @"function_" (mkKey x)
+    Hack.Declaration_globalConst x -> alt @"globalConst" (mkKey x)
+    Hack.Declaration_method x -> alt @"method" (mkKey x)
+    Hack.Declaration_module x -> alt @"module" (mkKey x)
+    Hack.Declaration_namespace_ x -> alt @"namespace_" (mkKey x)
+    Hack.Declaration_property_ x -> alt @"property_" (mkKey x)
+    Hack.Declaration_typeConst x -> alt @"typeConst" (mkKey x)
+    Hack.Declaration_typedef_ x -> alt @"typedef_" (mkKey x)
+    Hack.Declaration_EMPTY -> error "unknown Declaration"
+
+instance Prune Hack.Declaration where
+  prune d = case d of
+    Hack.Declaration_classConst x ->
+      Hack.Declaration_classConst (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_container x ->
+      Hack.Declaration_container (prune x)
+    Hack.Declaration_enumerator x ->
+      Hack.Declaration_enumerator (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_function_ x ->
+      Hack.Declaration_function_ (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_globalConst x ->
+      Hack.Declaration_globalConst (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_method x ->
+      Hack.Declaration_method (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_module x ->
+      Hack.Declaration_module (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_namespace_ x ->
+      Hack.Declaration_namespace_ (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_property_ x ->
+      Hack.Declaration_property_ (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_typeConst x ->
+      Hack.Declaration_typeConst (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_typedef_ x ->
+      Hack.Declaration_typedef_ (mkFact (getId x) Nothing Nothing)
+    Hack.Declaration_EMPTY -> error "unknown Declaration"
+
+instance ToAngle Hack.ContainerDeclaration where
+  toAngle e = case e of
+    Hack.ContainerDeclaration_class_ x -> alt @"class_" (mkKey x)
+    Hack.ContainerDeclaration_enum_ x -> alt @"enum_" (mkKey x)
+    Hack.ContainerDeclaration_interface_ x -> alt @"interface_" (mkKey x)
+    Hack.ContainerDeclaration_trait x -> alt @"trait" (mkKey x)
+    Hack.ContainerDeclaration_EMPTY -> error "unknown ContainerDeclaration"
+
+instance Prune Hack.ContainerDeclaration where
+  prune e = case e of
+    Hack.ContainerDeclaration_class_ x ->
+      Hack.ContainerDeclaration_class_ (mkFact (getId x) Nothing Nothing)
+    Hack.ContainerDeclaration_enum_ x ->
+      Hack.ContainerDeclaration_enum_ (mkFact (getId x) Nothing Nothing)
+    Hack.ContainerDeclaration_interface_ x ->
+      Hack.ContainerDeclaration_interface_ (mkFact (getId x) Nothing Nothing)
+    Hack.ContainerDeclaration_trait x ->
+      Hack.ContainerDeclaration_trait (mkFact (getId x) Nothing Nothing)
+    Hack.ContainerDeclaration_EMPTY -> error "unknown ContainerDeclaration"
+
+-- Haskell
+
+instance ToAngle Hs.Entity where
+  toAngle (Hs.Entity_name x) = alt @"name" (mkKey x)
+  toAngle (Hs.Entity_mod x) = alt @"mod" (mkKey x)
+  toAngle x = error $ "unknown Hs.Entity: " <> show x
+
+-- Python
+
+instance ToAngle Py.Declaration where
+  toAngle (Py.Declaration_cls x) = alt @"cls" (mkKey x)
+  toAngle (Py.Declaration_func x) = alt @"func" (mkKey x)
+  toAngle (Py.Declaration_module x) = alt @"module" (mkKey x)
+  toAngle (Py.Declaration_variable x) = alt @"variable" (mkKey x)
+  toAngle (Py.Declaration_imp x) = alt @"imp" (mkKey x)
+  toAngle Py.Declaration_EMPTY = error "unknown Declaration"
+
+instance Prune Py.Declaration where
+  prune (Py.Declaration_cls x) =
+    Py.Declaration_cls (mkFact (getId x) Nothing Nothing)
+  prune (Py.Declaration_func x) =
+    Py.Declaration_func (mkFact (getId x) Nothing Nothing)
+  prune (Py.Declaration_module x) =
+    Py.Declaration_module (mkFact (getId x) Nothing Nothing)
+  prune (Py.Declaration_variable x) =
+    Py.Declaration_variable (mkFact (getId x) Nothing Nothing)
+  prune (Py.Declaration_imp x) =
+    Py.Declaration_imp (mkFact (getId x) Nothing Nothing)
+  prune Py.Declaration_EMPTY = error "unknown Declaration"
+
+-- Src
+
+instance Normalize Src.File where
+  normalize (Src.File _ (Just k)) = Src.File 0 (Just k)
+  normalize  _ = error "Not fully resolved"
+
+instance ToAngleFull Src.File where
+  toAngleFull (Src.File _ (Just k)) = predicate $ string k
+  toAngleFull  _ = error "Not fully resolved"
+
+-- Fbthrift
+
+instance Normalize Fbthrift.File where
+  normalize (Fbthrift.File _ (Just k)) = Fbthrift.File 0 (Just (normalize k))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.QualName_key where
+  normalize
+    (Fbthrift.QualName_key (Fbthrift.File _ (Just file))
+    (Fbthrift.Identifier _ (Just identifier))) =
+    Fbthrift.QualName_key (Fbthrift.File 0 (Just (normalize file)))
+    (Fbthrift.Identifier 0 (Just identifier))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.ExceptionName_key where
+  normalize (Fbthrift.ExceptionName_key (Fbthrift.QualName _ (Just qualname)))
+    =
+    Fbthrift.ExceptionName_key (Fbthrift.QualName 0 (Just (normalize qualname)))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.ServiceName_key where
+  normalize (Fbthrift.ServiceName_key (Fbthrift.QualName _ (Just qualname)))
+    =
+    Fbthrift.ServiceName_key (Fbthrift.QualName 0 (Just (normalize qualname)))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.NamedDecl_key where
+  normalize
+    (Fbthrift.NamedDecl_key
+      (Fbthrift.NamedType (Fbthrift.QualName _ (Just qualname)) kind)) =
+    Fbthrift.NamedDecl_key
+      (Fbthrift.NamedType
+        (Fbthrift.QualName 0 (Just (normalize qualname))) kind)
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.FunctionName_key where
+  normalize
+    (Fbthrift.FunctionName_key (Fbthrift.ServiceName _ (Just service_))
+      (Fbthrift.Identifier _ (Just identifier))) =
+    Fbthrift.FunctionName_key (Fbthrift.ServiceName 0
+      (Just (normalize service_))) (Fbthrift.Identifier 0 (Just identifier))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.FieldDecl_key where
+  normalize
+    (Fbthrift.FieldDecl_key
+      (Fbthrift.QualName _ (Just qualname))
+       kind
+      (Fbthrift.Identifier _ (Just identifier))) =
+    Fbthrift.FieldDecl_key
+      (Fbthrift.QualName 0 (Just (normalize qualname)))
+      kind
+      (Fbthrift.Identifier 0 (Just identifier))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.EnumValue_key where
+  normalize
+    (Fbthrift.EnumValue_key
+      (Fbthrift.NamedType (Fbthrift.QualName _ (Just qualname)) kind)
+      (Fbthrift.Identifier _ (Just identifier))) =
+    Fbthrift.EnumValue_key
+      (Fbthrift.NamedType
+        (Fbthrift.QualName 0 (Just (normalize qualname))) kind)
+      (Fbthrift.Identifier 0 (Just identifier))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.Constant_key where
+  normalize (Fbthrift.Constant_key (Fbthrift.QualName _ (Just qualname))) =
+    Fbthrift.Constant_key (Fbthrift.QualName 0 (Just (normalize qualname)))
+  normalize  _ = error "Not fully resolved"
+
+instance Normalize Fbthrift.XRefTarget where
+  normalize
+    (Fbthrift.XRefTarget_function_
+      (Fbthrift.FunctionName _ (Just x))) =
+    Fbthrift.XRefTarget_function_ (Fbthrift.FunctionName 0 (Just (normalize x)))
+  normalize (Fbthrift.XRefTarget_service_
+      (Fbthrift.ServiceName _ (Just x))) =
+    Fbthrift.XRefTarget_service_ (Fbthrift.ServiceName 0 (Just (normalize x)))
+  normalize (Fbthrift.XRefTarget_exception_
+      (Fbthrift.ExceptionName _ (Just x))) =
+    Fbthrift.XRefTarget_exception_
+      (Fbthrift.ExceptionName 0 (Just (normalize x)))
+  normalize (Fbthrift.XRefTarget_named
+      (Fbthrift.NamedDecl _ (Just x))) =
+    Fbthrift.XRefTarget_named (Fbthrift.NamedDecl 0 (Just (normalize x)))
+  normalize
+    (Fbthrift.XRefTarget_field
+      (Fbthrift.FieldDecl _ (Just x))) =
+    Fbthrift.XRefTarget_field (Fbthrift.FieldDecl 0 (Just (normalize x)))
+  normalize
+    (Fbthrift.XRefTarget_enumValue
+      (Fbthrift.EnumValue _ (Just x))) =
+    Fbthrift.XRefTarget_enumValue (Fbthrift.EnumValue 0 (Just (normalize x)))
+  normalize
+    (Fbthrift.XRefTarget_constant
+      (Fbthrift.Constant _ (Just x))) =
+    Fbthrift.XRefTarget_constant (Fbthrift.Constant 0 (Just (normalize x)))
+  normalize
+    (Fbthrift.XRefTarget_include_
+      (Fbthrift.File _ (Just x))) =
+    Fbthrift.XRefTarget_include_ (Fbthrift.File 0 (Just (normalize x)))
+  normalize _  = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.File where
+  toAngleFull (Fbthrift.File _ (Just k)) = predicate $ toAngleFull k
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.QualName_key where
+  toAngleFull
+    (Fbthrift.QualName_key (Fbthrift.File _ (Just file))
+    (Fbthrift.Identifier _ (Just identifier))) = rec $
+        field @"file" (sig (toAngleFull file)) $
+        field @"name" (string identifier)
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.ServiceName_key where
+  toAngleFull (Fbthrift.ServiceName_key (Fbthrift.QualName _ (Just qualname)))
+    = rec $
+        field @"name" (toAngleFull qualname)
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.NamedDecl_key where
+  toAngleFull
+    (Fbthrift.NamedDecl_key
+      (Fbthrift.NamedType (Fbthrift.QualName _ (Just qualname)) kind)) =
+      let namedType :: Angle Fbthrift.NamedType = rec $
+            field @"name" (toAngleFull qualname) $
+            field @"kind" (enum kind)
+            end
+      in
+      rec $
+        field @"name" namedType
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.EnumValue_key where
+  toAngleFull
+    (Fbthrift.EnumValue_key
+      (Fbthrift.NamedType (Fbthrift.QualName _ (Just qualname)) kind)
+      (Fbthrift.Identifier _ (Just identifier))
+      ) =
+      let namedType :: Angle Fbthrift.NamedType = rec $
+            field @"name" (toAngleFull qualname) $
+            field @"kind" (enum kind)
+            end
+      in
+      rec $
+        field @"enum_" namedType $
+        field @"name" (string identifier)
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+
+instance ToAngleFull Fbthrift.ExceptionName_key where
+  toAngleFull (Fbthrift.ExceptionName_key (Fbthrift.QualName _ (Just qualname)))
+    = rec $
+        field @"name" (toAngleFull qualname)
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.FunctionName_key where
+  toAngleFull
+    (Fbthrift.FunctionName_key (Fbthrift.ServiceName _ (Just service_))
+    (Fbthrift.Identifier _ (Just identifier))) = rec $
+      field @"service_" (toAngleFull service_) $
+      field @"name" (string identifier)
+    end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.FieldDecl_key where
+  toAngleFull
+    (Fbthrift.FieldDecl_key
+      (Fbthrift.QualName _ (Just qualname))
+      kind
+      (Fbthrift.Identifier _ (Just identifier))) =
+      rec $
+        field @"qname" (toAngleFull qualname) $
+        field @"kind" (enum kind) $
+        field @"name" (string identifier)
+      end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.Constant_key where
+  toAngleFull
+    (Fbthrift.Constant_key
+      (Fbthrift.QualName _ (Just qualname))) =
+      rec $
+        field @"name" (toAngleFull qualname)
+      end
+  toAngleFull  _ = error "Not fully resolved"
+
+instance ToAngleFull Fbthrift.XRefTarget where
+  toAngleFull
+    (Fbthrift.XRefTarget_function_ (Fbthrift.FunctionName _ (Just x))) =
+    alt @"function_" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_service_ (Fbthrift.ServiceName _ (Just x))) =
+    alt @"service_" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_exception_ (Fbthrift.ExceptionName _ (Just x))) =
+    alt @"exception_" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_named (Fbthrift.NamedDecl _ (Just x))) =
+    alt @"named" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_field (Fbthrift.FieldDecl _ (Just x))) =
+    alt @"field" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_enumValue (Fbthrift.EnumValue _ (Just x))) =
+    alt @"enumValue" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_constant (Fbthrift.Constant _ (Just x))) =
+    alt @"constant" (toAngleFull x)
+  toAngleFull
+    (Fbthrift.XRefTarget_include_ (Fbthrift.File _ (Just x))) =
+    alt @"include_" (toAngleFull x)
+  toAngleFull _  = error "Not fully resolved"
+
+instance ToAngle Fbthrift.XRefTarget where
+  toAngle (Fbthrift.XRefTarget_include_ x) = alt @"include_" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_named x) = alt @"named" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_exception_ x) = alt @"exception_" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_service_ x) = alt @"service_" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_constant x) = alt @"constant" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_enumValue x) = alt @"enumValue" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_function_ x) = alt @"function_" (mkKey x)
+  toAngle (Fbthrift.XRefTarget_field x) = alt @"field" (mkKey x)
+  toAngle Fbthrift.XRefTarget_EMPTY = error "unknown Entity"
+
+-- Python
+
+instance ToAngleFull Py.Declaration where
+  toAngleFull (Py.Declaration_cls (Py.ClassDeclaration _  (Just k))) =
+    alt @"cls" (toAngleFull k)
+  toAngleFull (Py.Declaration_func (Py.FunctionDeclaration _  (Just k))) =
+    alt @"func" (toAngleFull k)
+  toAngleFull (Py.Declaration_module (Py.Module _  (Just k))) =
+    alt @"module" (toAngleFull k)
+  toAngleFull (Py.Declaration_variable (Py.VariableDeclaration _  (Just k))) =
+    alt @"variable" (toAngleFull k)
+  toAngleFull (Py.Declaration_imp (Py.ImportStatement _  (Just k))) =
+    alt @"imp" (toAngleFull k)
+  toAngleFull Py.Declaration_EMPTY = error "unknown Entity"
+  toAngleFull _  = error "Not fully resolved"
+
+instance ToAngleFull Py.ImportStatement_key where
+  toAngleFull
+   (Py.ImportStatement_key
+     (Py.Name _ (Just from)) (Py.Name _ (Just as))) = rec $
+       field @"from_name" (string from) $
+       field @"as_name" (string as)
+    end
+  toAngleFull _ = error "Not fully resolved"
+
+instance ToAngleFull Py.Module_key where
+  toAngleFull (Py.Module_key ((Py.Name _ (Just k)))) = rec $
+    field @"name" (string k)
+    end
+  toAngleFull _ = error "Not fully resolved"
+
+instance ToAngleFull Py.FunctionDeclaration_key where
+  toAngleFull (Py.FunctionDeclaration_key ((Py.Name _ (Just k)))) = rec $
+    field @"name" (string k)
+    end
+  toAngleFull _ = error "Not fully resolved"
+
+instance ToAngleFull Py.VariableDeclaration_key where
+  toAngleFull (Py.VariableDeclaration_key ((Py.Name _ (Just k)))) = rec $
+    field @"name" (string k)
+    end
+  toAngleFull _ = error "Not fully resolved"
+
+instance ToAngleFull Py.ClassDeclaration_key where
+  toAngleFull (Py.ClassDeclaration_key ((Py.Name _ (Just k))) _bases) = rec $
+    field @"name" (string k)
+    end
+  toAngleFull _ = error "Not fully resolved"
+
+instance Normalize Py.Name where
+  normalize (Py.Name _ (Just k)) = Py.Name 0 (Just k)
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.Declaration where
+  normalize (Py.Declaration_cls cls) = Py.Declaration_cls $ normalize cls
+  normalize (Py.Declaration_func f) = Py.Declaration_func $ normalize f
+  normalize (Py.Declaration_variable v) = Py.Declaration_variable $ normalize v
+  normalize (Py.Declaration_module m) = Py.Declaration_module $ normalize m
+  normalize (Py.Declaration_imp i) = Py.Declaration_imp $ normalize i
+  normalize Py.Declaration_EMPTY = error "unknown entity"
+
+instance Normalize Py.ImportStatement where
+  normalize (Py.ImportStatement _ (Just k)) =
+    Py.ImportStatement 0 (Just (normalize k))
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.ImportStatement_key where
+  normalize (Py.ImportStatement_key f a) =
+    Py.ImportStatement_key (normalize f) (normalize a)
+
+instance Normalize Py.ClassDeclaration where
+  normalize (Py.ClassDeclaration _ (Just k)) =
+    Py.ClassDeclaration 0 (Just (normalize k))
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.ClassDeclaration_key where
+  normalize (Py.ClassDeclaration_key name _base) =
+    Py.ClassDeclaration_key (normalize name) (Just [])
+
+instance Normalize Py.VariableDeclaration where
+  normalize (Py.VariableDeclaration _ (Just k)) =
+    Py.VariableDeclaration 0 (Just (normalize k))
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.VariableDeclaration_key where
+  normalize (Py.VariableDeclaration_key name) =
+    Py.VariableDeclaration_key (normalize name)
+
+instance Normalize Py.FunctionDeclaration where
+  normalize (Py.FunctionDeclaration _ (Just k)) =
+    Py.FunctionDeclaration 0 (Just (normalize k))
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.FunctionDeclaration_key where
+  normalize (Py.FunctionDeclaration_key name) =
+    Py.FunctionDeclaration_key (normalize name)
+
+instance Normalize Py.Module where
+  normalize (Py.Module _ (Just k)) =
+    Py.Module 0 (Just (normalize k))
+  normalize _ = error "Not fully resolved"
+
+instance Normalize Py.Module_key where
+  normalize (Py.Module_key name) =
+    Py.Module_key (normalize name)
+
+
+-- Java
+
+instance ToAngle Java.Declaration where
+  toAngle (Java.Declaration_class_ x) = alt @"class_" (mkKey x)
+  toAngle (Java.Declaration_interface_ x) = alt @"interface_" (mkKey x)
+  toAngle (Java.Declaration_enum_ x) = alt @"enum_" (mkKey x)
+  toAngle (Java.Declaration_method x) = alt @"method" (mkKey x)
+  toAngle (Java.Declaration_ctor x) = alt @"ctor" (mkKey x)
+  toAngle (Java.Declaration_field x) = alt @"field" (mkKey x)
+  toAngle (Java.Declaration_param x) = alt @"param" (mkKey x)
+  toAngle (Java.Declaration_local x) = alt @"local" (mkKey x)
+  toAngle Java.Declaration_EMPTY = error "unknown Declaration"
+
+-- Kotlin
+
+instance ToAngle Kotlin.Declaration where
+  toAngle (Kotlin.Declaration_class_ x) = alt @"class_" (mkKey x)
+  toAngle (Kotlin.Declaration_method x) = alt @"method" (mkKey x)
+  toAngle (Kotlin.Declaration_variable x) = alt @"variable" (mkKey x)
+  toAngle Kotlin.Declaration_EMPTY = error "unknown Declaration"
+
+-- C#
+
+instance ToAngle CSharp.Definition where
+  toAngle (CSharp.Definition_type atype) = alt @"type" (toAngle atype)
+  toAngle (CSharp.Definition_method x) = alt @"method" (mkKey x)
+  toAngle (CSharp.Definition_field x) = alt @"field" (mkKey x)
+  toAngle (CSharp.Definition_parameter x) = alt @"parameter" (mkKey x)
+  toAngle (CSharp.Definition_typeParameter x) = alt @"typeParameter" (mkKey x)
+  toAngle (CSharp.Definition_local x) = alt @"local" (mkKey x)
+  toAngle (CSharp.Definition_property x) = alt @"property" (mkKey x)
+  toAngle CSharp.Definition_EMPTY = error "unknown Definition"
+
+instance ToAngle CSharp.AType where
+  toAngle (CSharp.AType_arrayType x) = alt @"arrayType" (mkKey x)
+  toAngle (CSharp.AType_namedType x) = alt @"namedType" (toAngle x)
+  toAngle (CSharp.AType_functionPointerType x) =
+    alt @"functionPointerType" (mkKey x)
+  toAngle (CSharp.AType_pointerType x) = alt @"pointerType" (mkKey x)
+  toAngle (CSharp.AType_typeParameter x) = alt @"typeParameter" (mkKey x)
+  toAngle CSharp.AType_EMPTY = error "unknown AType"
+
+instance ToAngle CSharp.NamedType where
+  toAngle (CSharp.NamedType_class_ x) = alt @"class_" (mkKey x)
+  toAngle (CSharp.NamedType_interface_ x) = alt @"interface_" (mkKey x)
+  toAngle (CSharp.NamedType_record_ x) = alt @"record_" (mkKey x)
+  toAngle (CSharp.NamedType_struct_ x) = alt @"struct_" (mkKey x)
+  toAngle CSharp.NamedType_EMPTY = error "unknown NamedType"
+
+-- LSIF and SCIP languages
+
+instance ToAngle Lsif.SomeEntity where
+  toAngle e = case e of
+    Lsif.SomeEntity_defn x -> alt @"defn" (mkKey x)
+    Lsif.SomeEntity_decl x -> alt @"decl" (mkKey x)
+    Lsif.SomeEntity_EMPTY -> error "unknown Lsif.SomeEntity"
+
+instance ToAngle Scip.SomeEntity where
+  toAngle (Scip.SomeEntity defn) = rec $ field @"defn" (mkKey defn) end
+    -- note: singleton type, not a sum.
+
+-- Codemarkup
+
+instance ToAngleFull Code.Entity where
+  toAngleFull entity = case entity of
+    Code.Entity_fbthrift (Fbthrift.Entity_decl x) ->
+      alt @"fbthrift" (alt @"decl" (toAngleFull x))
+    Code.Entity_python (Py.Entity_decl x) ->
+      alt @"python" (alt @"decl" (toAngleFull x))
+    Code.Entity_cxx (Cxx.Entity_decl x) ->
+      alt @"cxx" (alt @"decl" (toAngleFull x))
+    _ -> error "Only thrift or python entities are expected"
+
+instance ToAngleFull Code.SymbolId where
+  toAngleFull (Code.SymbolId_cxx x) = alt @"cxx" (toAngleFull x)
+  toAngleFull (Code.SymbolId_scip x) = alt @"scip" (toAngleFull x)
+  toAngleFull Code.SymbolId_EMPTY = error "unknown Code.SymbolId"
+
+instance ToAngleFull Scip.Symbol where
+  toAngleFull (Scip.Symbol _ (Just x)) = predicate $ toAngleFull x
+  toAngleFull _ = error "Not fully resolved"
+
+instance Normalize Code.SymbolId  where
+  normalize (Code.SymbolId_cxx x) = Code.SymbolId_cxx (normalize x)
+  normalize (Code.SymbolId_scip x) = Code.SymbolId_scip (normalize x)
+  normalize Code.SymbolId_EMPTY = Code.SymbolId_EMPTY
+
+instance Normalize Scip.Symbol where
+  normalize (Scip.Symbol _ x) = Scip.Symbol 0 (normalize x)
+
+
+instance Normalize Code.Entity where
+    normalize entity = case entity of
+      Code.Entity_fbthrift (Fbthrift.Entity_decl x) ->
+        Code.Entity_fbthrift (Fbthrift.Entity_decl (normalize x))
+      Code.Entity_python (Py.Entity_decl x) ->
+        Code.Entity_python (Py.Entity_decl (normalize x))
+      Code.Entity_cxx (Cxx.Entity_decl x) ->
+        Code.Entity_cxx (Cxx.Entity_decl (normalize x))
+      _ -> error $
+        "Only thrift or python or cxx entities are expected, got: " <> show entity
+
+instance ToAngleFull Text where
+  toAngleFull x = string x
+
+instance Normalize Text where
+  normalize x = x
+
+instance (Functor f, Normalize x) => Normalize (f x) where
+  normalize x = normalize <$> x
diff --git a/glean/lib/Glean/Util/XRefs.hs b/glean/lib/Glean/Util/XRefs.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Util/XRefs.hs
@@ -0,0 +1,53 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.XRefs (collectXRefTargets) where
+
+import Data.Ord
+import qualified Data.Set as Set
+import Data.Set (Set)
+
+import Util.List
+
+import Glean.Schema.Cxx1.Types as Cxx
+import Glean.Util.Range
+
+-- | Expand the compact xref format we store in the schema into a simple
+-- list of byte ranges and xref targets.
+collectXRefTargets :: [Cxx.FileXRefs] -> Set (ByteRange, Cxx.XRefTarget)
+collectXRefTargets allFileXRefs = Set.fromList $ fixedXRefs <> externalXRefs
+  where
+    -- There might be multiple cxx.FileXRefMaps if the file is
+    -- compiled multiple times with different CPP #defines, for
+    -- example.
+    uniqMaps = uniqBy (comparing Cxx.fileXRefMap_id)
+      [ fileXRefs_key_xmap
+      | Cxx.FileXRefs{fileXRefs_key = Just Cxx.FileXRefs_key{..}}
+         <- allFileXRefs
+      ]
+
+    fixedXRefs =
+      [ (span, fixedXRef_target)
+      | Cxx.FileXRefMap{fileXRefMap_key =
+          Just Cxx.FileXRefMap_key{..}} <- uniqMaps
+      , Cxx.FixedXRef{..} <- fileXRefMap_key_fixed
+      , span <- fromToSpansAndExpansions fixedXRef_from
+      ]
+
+    externalXRefs =
+      [ (span, xref)
+      | Cxx.FileXRefs{fileXRefs_key = Just Cxx.FileXRefs_key
+          { fileXRefs_key_xmap = Cxx.FileXRefMap{
+              fileXRefMap_key = Just Cxx.FileXRefMap_key{..}}
+          , fileXRefs_key_targets = targets }} <- allFileXRefs
+      , let ranges = map fromToSpansAndExpansions fileXRefMap_key_froms
+      , (spans, Cxx.XRefTargets{xRefTargets_key = Just xrefs})
+          <- zip ranges targets
+      , span <- spans
+      , xref <- xrefs
+      ]
diff --git a/glean/lib/Glean/Write/SimpleAsync.hs b/glean/lib/Glean/Write/SimpleAsync.hs
new file mode 100644
--- /dev/null
+++ b/glean/lib/Glean/Write/SimpleAsync.hs
@@ -0,0 +1,103 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | This is in a separate module from "Glean.Write.Async" in order
+-- so that depending on "//glean/schema/hs:hs" does not create a cycle.
+--
+-- This creates simpler uses of 'withSender' and 'withWriter'
+module Glean.Write.SimpleAsync
+  ( Sender, SendQueueSettings(..)
+  , Writer, WriterSettings(..)
+  , withSimpleSender
+  , withSimpleWriter, withSimpleWriters
+  , withTestWriter
+  ) where
+
+import qualified Data.ByteString as BS
+import Data.Default
+import Util.Log (logError, logInfo)
+
+import Glean
+import Util.Time ( toDiffMillis )
+import Glean.Types
+
+-- | 'withSimpleSender' has 'senderLog' write to "Util.Log"
+--
+-- One sender is used for all writers.
+withSimpleSender
+  :: (Backend be)
+  => be
+  -> Repo
+  -> [SchemaPredicates]
+  -> SendQueueSettings
+  -> (Sender -> IO a)
+  -> IO a
+withSimpleSender be repo predicates settings =
+    withSender
+      be
+      repo
+      predicates
+      settings
+        { sendQueueLog = \event -> do
+            case event of
+              SendQueueSending{} -> return ()
+              SendQueueSendingJson{} -> return ()
+              SendQueueSendingDescriptor{} -> return ()
+              SendQueueSent size time -> logInfo $ concat
+                [ "sent batch ", show size, " in "
+                , show (toDiffMillis time), "ms" ]
+              SendQueueFinished -> logInfo "all batches sent"
+              SendQueueFailed exc -> logError $ "sending failed: " ++ show exc
+            sendQueueLog settings event
+        }
+
+-- | 'withSimpleWriter' has 'writerLog' output to "Util.Log"
+--
+-- NOTE: Writers serialise all writes - if you want to produce facts in
+-- parallel, use multiple writers (see 'withSimpleWriters' below)
+withSimpleWriter
+  :: Sender
+  -> WriterSettings
+  -> (Writer -> IO a)
+  -> IO a
+withSimpleWriter sender settings =
+  withWriter sender (withLogging settings)
+
+-- | Multiple Writer version of 'withSimpleWriter'
+withSimpleWriters
+  :: Sender
+  -> WriterSettings
+  -> Int
+  -> ([Writer] -> IO a)
+  -> IO a
+withSimpleWriters sender settings n =
+  withWriters sender (withLogging settings) n
+
+withLogging :: WriterSettings -> WriterSettings
+withLogging settings =
+  settings
+    { writerLog = \event -> do
+        case event of
+          WriterPushing batch -> logInfo $
+            "pushing batch " ++ show (BS.length $ batch_facts batch)
+          WriterStalling -> logInfo "writing stalled"
+          WriterResuming time -> logInfo $
+            "writing caught up in " ++ show (toDiffMillis time) ++ "ms"
+        writerLog settings event
+    }
+
+withTestWriter
+  :: (Backend be)
+  => be
+  -> Repo
+  -> [SchemaPredicates]
+  -> (Writer -> IO a)
+  -> IO a
+withTestWriter be repo predicates act =
+  withSimpleSender be repo predicates def $ \sender ->
+  withSimpleWriter sender def act
diff --git a/glean/rocksdb/container-impl.cpp b/glean/rocksdb/container-impl.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/container-impl.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rocksdb/container-impl.h"
+#include "glean/rocksdb/database-impl.h"
+#include "glean/rocksdb/util.h"
+
+#include <rocksdb/filter_policy.h>
+#include <rocksdb/slice_transform.h>
+#include <rocksdb/statistics.h>
+#include <rocksdb/table.h>
+
+#ifdef GLEAN_FACEBOOK
+#include "glean/facebook/rocksdb/rocksdb.h"
+#endif
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+std::vector<const Family*> Family::families;
+
+const Family Family::admin("admin", [](auto& opts) {
+  opts.OptimizeForPointLookup(10);
+});
+const Family Family::entities("entities", [](auto& opts) {
+  // NOTE: Setting inplace_update_support=true leads to rocksdb assertion
+  // failures when iteration backwards.
+  opts.inplace_update_support = false;
+});
+const Family Family::keys("keys", [](auto& opts) {
+  opts.prefix_extractor.reset(
+      rocksdb::NewFixedPrefixTransform(sizeof(Id::word_type)));
+});
+const Family Family::stats("stats", [](auto& opts) {
+  opts.OptimizeForPointLookup(10);
+});
+const Family Family::meta("meta", [](auto&) {});
+
+// Maps a unit's name to its UnitId
+// ownershipUnits: String -> UnitId
+const Family Family::ownershipUnits("ownershipUnits", [](auto& opts) {
+  opts.OptimizeForPointLookup(10);
+});
+
+// Translates UnitId to its name. Dual of ownershipUnits.
+// ownershipUnitIds: UnitId -> String
+const Family Family::ownershipUnitIds("ownershipUnitIds", [](auto& opts) {
+  opts.OptimizeForPointLookup(10);
+});
+
+// Append-only log of non-derived facts' ownership information.
+// Describes a map from UnitId to list of facts.
+// The key contains a tuple of UnitId and a monotonically incrementing counter.
+// The value is an interval map of fact ids.
+// ownershipRaw: (UnitId, nat) -> [Fid]
+const Family Family::ownershipRaw("ownershipRaw", [](auto&) {}, false);
+
+// Append-only log of derived facts' ownership information.
+// Describes a (Map Pid (Map Fid UsetId))
+// The key contains a tuple of Pid and a monotonically incrementing counter.
+// ownershipDerivedRaw: (Pid, nat) -> ( [Fid], [UsetId] )
+const Family Family::ownershipDerivedRaw(
+    "ownershipDerivedRaw",
+    [](auto& opts) { opts.inplace_update_support = false; },
+    false);
+
+// ownershipSets: UsetId -> (Operation, [UsetId])
+const Family Family::ownershipSets("ownershipSets", [](auto& opts) {
+  opts.inplace_update_support = false;
+});
+
+// An interval map, mapping fact ids to UsetId.
+// factOwners: Fid -> UsetId
+const Family Family::factOwners(
+    "factOwners",
+    [](auto& opts) { opts.inplace_update_support = false; },
+    false);
+
+// Used to efficiently map fact ids to UsetIds
+// Contains:
+// - A page index at key INDEX_KEY with type [UsetId]
+// - A map from page prefix to a map from page suffix to UsetId
+//    prefix -> ([suffix], [UsetId])
+const Family Family::factOwnerPages("factOwnerPages", [](auto& opts) {
+  opts.OptimizeForPointLookup(10);
+});
+
+#ifndef GLEAN_FACEBOOK
+namespace {
+rocksdb::Status openRocksDB(
+    const rocksdb::Options& options,
+    const std::string& name,
+    rocksdb::DB** dbptr,
+    const std::vector<rocksdb::ColumnFamilyDescriptor>& column_families,
+    std::vector<rocksdb::ColumnFamilyHandle*>* handles,
+    bool read_only) {
+  if (read_only) {
+    return rocksdb::DB::OpenForReadOnly(
+        options, name, column_families, handles, dbptr);
+  } else {
+    return rocksdb::DB::Open(options, name, column_families, handles, dbptr);
+  }
+}
+
+void exportStatistics(std::shared_ptr<rocksdb::Statistics> stats) {}
+} // namespace
+#endif
+
+ContainerImpl::ContainerImpl(
+    const std::string& path,
+    Mode m,
+    bool cache_index_and_filter_blocks,
+    folly::Optional<std::shared_ptr<Cache>> cache) {
+  mode = m;
+
+  if (mode == Mode::Create) {
+    options.error_if_exists = true;
+    options.create_if_missing = true;
+  } else {
+    options.error_if_exists = false;
+    options.create_if_missing = false;
+  }
+
+  options.inplace_update_support = true;
+  options.allow_concurrent_memtable_write = false;
+
+  {
+    rocksdb::BlockBasedTableOptions table_options;
+    if (cache) {
+      table_options.block_cache = std::move(cache.value());
+    }
+    table_options.filter_policy.reset(rocksdb::NewBloomFilterPolicy(10, false));
+    table_options.whole_key_filtering = true;
+
+    if (cache_index_and_filter_blocks) {
+      table_options.cache_index_and_filter_blocks = true;
+      table_options.cache_index_and_filter_blocks_with_high_priority = true;
+      table_options.pin_l0_filter_and_index_blocks_in_cache = true;
+    }
+
+    // The default setting of block_size_deviation = 10 means that
+    // RocksDB will always add another KV to the current block if it
+    // is <90% full, even if the key is huge. We had an issue where
+    // there was a large entry in the entities column family adjacent
+    // to smaller entries in the same block, and because the block was
+    // massive it didn't get cached, so we had very poor performance
+    // for fetching all keys in that block.
+    //
+    // This setting means that RocksDB will never add a large K/V pair
+    // to a block if it would make the block larger than the max block
+    // size.
+    table_options.block_size_deviation = 100;
+
+    options.table_factory.reset(
+        rocksdb::NewBlockBasedTableFactory(table_options));
+  }
+
+  // options.IncreaseParallelism();
+  // options.compression = rocksdb::CompressionType::kNoCompression;
+  // writeOptions.sync = false;
+  // writeOptions.disableWAL = true;
+
+  options.compression = rocksdb::CompressionType::kLZ4Compression;
+
+  statistics = rocksdb::CreateDBStatistics();
+  options.statistics = statistics;
+
+  exportStatistics(statistics);
+
+  families.resize(Family::count(), nullptr);
+  std::vector<std::string> names;
+  if (mode != Mode::Create) {
+    check(rocksdb::DB::ListColumnFamilies(options, path, &names));
+  }
+
+  std::vector<rocksdb::ColumnFamilyDescriptor> existing;
+  std::vector<rocksdb::ColumnFamilyHandle**> ptrs;
+  for (const auto& name : names) {
+    if (name != rocksdb::kDefaultColumnFamilyName) {
+      if (auto family = Family::family(name)) {
+        rocksdb::ColumnFamilyOptions opts(options);
+        family->options(opts);
+        existing.push_back(rocksdb::ColumnFamilyDescriptor(name, opts));
+        ptrs.push_back(&families[family->index]);
+      } else {
+        rts::error("Unknown column family '{}'", name);
+      }
+    }
+  }
+  existing.push_back(rocksdb::ColumnFamilyDescriptor(
+      rocksdb::kDefaultColumnFamilyName, options));
+  ptrs.push_back(nullptr);
+
+  std::vector<rocksdb::ColumnFamilyHandle*> hs;
+  rocksdb::DB* db_ptr;
+  check(openRocksDB(
+      options, path, &db_ptr, existing, &hs, mode == Mode::ReadOnly));
+  if (!db_ptr) {
+    rts::error("got nullptr from rocksdb");
+  } else {
+    db.reset(db_ptr);
+  }
+
+  assert(hs.size() == ptrs.size());
+  for (size_t i = 0; i < ptrs.size(); ++i) {
+    if (ptrs[i] != nullptr) {
+      *ptrs[i] = hs[i];
+    } else {
+      db->DestroyColumnFamilyHandle(hs[i]);
+    }
+  }
+
+  for (size_t i = 0; i < families.size(); ++i) {
+    if (families[i] == nullptr) {
+      auto family = Family::family(i);
+      assert(family != nullptr);
+
+      rocksdb::ColumnFamilyOptions opts(options);
+      family->options(opts);
+      check(db->CreateColumnFamily(opts, family->name, &families[i]));
+    }
+  }
+}
+
+void ContainerImpl::close() noexcept {
+  if (db) {
+    for (auto handle : families) {
+      if (handle) {
+        try {
+          db->DestroyColumnFamilyHandle(handle);
+        } catch (const std::exception& e) {
+          LOG(ERROR) << e.what();
+        } catch (...) {
+          LOG(ERROR) << "unknown error while closing column family";
+        }
+      }
+    }
+    families.resize(0);
+    // ensure the WAL is fully sync'd, otherwise re-opening the DB will take a
+    // long time due to WAL recovery.
+    db->FlushWAL(true);
+    db.reset();
+  }
+}
+
+void ContainerImpl::requireOpen() const {
+  if (!db) {
+    rts::error("rocksdb: database is closed");
+  }
+}
+
+rocksdb::ColumnFamilyHandle* ContainerImpl::family(const Family& family) const {
+  assert(family.index < families.size());
+  return families[family.index];
+}
+
+void ContainerImpl::writeData(folly::ByteRange key, folly::ByteRange value) {
+  requireOpen();
+  check(db->Put(writeOptions, family(Family::meta), slice(key), slice(value)));
+}
+
+bool ContainerImpl::readData(
+    folly::ByteRange key,
+    std::function<void(folly::ByteRange)> f) {
+  requireOpen();
+  rocksdb::PinnableSlice val;
+  auto s =
+      db->Get(rocksdb::ReadOptions(), family(Family::meta), slice(key), &val);
+  if (s.IsNotFound()) {
+    return false;
+  } else {
+    check(s);
+    f(byteRange(val));
+    return true;
+  }
+}
+
+void ContainerImpl::optimize(bool compact) {
+  for (uint32_t i = 0; i < families.size(); i++) {
+    auto family = Family::family(i);
+    auto handle = families[i];
+    if (handle && family) {
+      // For some reason backup doesn't always flush all the WAL logs, but
+      // flushing here seems to fix it. If we backup the DB with WAL logs (which
+      // may be many GB in size), every time the DB is opened the logs have to
+      // be replayed, which takes a long time and consumes memory.
+      rocksdb::FlushOptions flush_options;
+      db->Flush(flush_options, handle);
+      if (!family->keep) {
+        // delete the contents of this column family
+        check(db->DropColumnFamily(handle));
+        db->DestroyColumnFamilyHandle(handle);
+        rocksdb::ColumnFamilyOptions opts(options);
+        family->options(opts);
+        check(db->CreateColumnFamily(opts, family->name, &handle));
+        families[i] = handle;
+      }
+      if (compact) {
+        const auto nlevels = db->NumberLevels(handle);
+        if (nlevels != 2) {
+          rocksdb::CompactRangeOptions copts;
+          check(db->CompactRange(copts, handle, nullptr, nullptr));
+        }
+      }
+    }
+  }
+}
+
+std::unique_ptr<Database> ContainerImpl::openDatabase(
+    Id start,
+    rts::UsetId first_unit_id,
+    int32_t version) && {
+  return std::make_unique<DatabaseImpl>(
+      std::move(*this), start, first_unit_id, version);
+}
+
+namespace {
+
+std::unique_ptr<rocksdb::BackupEngine> backupEngine(
+    const std::string& path,
+    bool sync = true) {
+  rocksdb::BackupEngine* p;
+  rocksdb::BackupEngineOptions opts{path};
+  opts.sync = sync;
+  opts.max_background_operations = 16;
+  check(rocksdb::BackupEngine::Open(rocksdb::Env::Default(), opts, &p));
+  return std::unique_ptr<rocksdb::BackupEngine>(p);
+}
+} // namespace
+
+void ContainerImpl::backup(const std::string& path) {
+  requireOpen();
+  bool flush{mode != Mode::ReadOnly};
+  // no need to sync on backup: we're going to upload and delete it immediately
+  check(backupEngine(path, false)->CreateNewBackup(db.get(), flush));
+}
+
+} // namespace impl
+
+void restore(const std::string& target, const std::string& source) {
+  impl::check(
+      impl::backupEngine(source)->RestoreDBFromLatestBackup(target, target));
+}
+
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/container-impl.h b/glean/rocksdb/container-impl.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/container-impl.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rocksdb/rocksdb.h"
+#include "glean/rocksdb/util.h"
+
+#include <rocksdb/db.h>
+#include <rocksdb/utilities/backup_engine.h>
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+struct Family {
+ private:
+  template <typename F>
+  Family(const char* n, F&& o, bool keep_ = true)
+      : index(families.size()),
+        name(n),
+        options(std::forward<F>(o)),
+        keep(keep_) {
+    families.push_back(this);
+  }
+
+  Family(const Family&) = delete;
+  Family& operator=(const Family&) = delete;
+
+  static std::vector<const Family*> families;
+
+ public:
+  size_t index;
+  const char* name;
+  std::function<void(rocksdb::ColumnFamilyOptions&)> options;
+
+  // Whether to keep this column family after the DB is complete. If
+  // keep = false, then the contents of the column family will be
+  // deleted before compaction.
+  bool keep = true;
+
+  static const Family admin;
+  static const Family entities;
+  static const Family keys;
+  static const Family stats;
+  static const Family meta;
+  static const Family ownershipUnits;
+  static const Family ownershipUnitIds;
+  static const Family ownershipRaw;
+  static const Family ownershipDerivedRaw;
+  static const Family ownershipSets;
+  static const Family factOwners;
+  static const Family factOwnerPages;
+
+  static size_t count() {
+    return families.size();
+  }
+
+  static const Family* FOLLY_NULLABLE family(const std::string& name) {
+    for (auto p : families) {
+      if (name == p->name) {
+        return p;
+      }
+    }
+    return nullptr;
+  }
+
+  static const Family* FOLLY_NULLABLE family(size_t i) {
+    return i < families.size() ? families[i] : nullptr;
+  }
+};
+
+struct ContainerImpl final : Container {
+  Mode mode;
+  rocksdb::Options options;
+  rocksdb::WriteOptions writeOptions;
+  std::unique_ptr<rocksdb::DB> db;
+  std::vector<rocksdb::ColumnFamilyHandle*> families;
+  std::shared_ptr<rocksdb::Statistics> statistics;
+
+  ContainerImpl(
+      const std::string& path,
+      Mode m,
+      bool cache_index_and_filter_blocks,
+      folly::Optional<std::shared_ptr<Cache>> cache);
+
+  ContainerImpl(const ContainerImpl&) = delete;
+  ContainerImpl(ContainerImpl&& other) = default;
+  ContainerImpl& operator=(const ContainerImpl&) = delete;
+  ContainerImpl& operator=(ContainerImpl&&) = delete;
+
+  ~ContainerImpl() override {
+    close();
+  }
+
+  void close() noexcept override;
+
+  void requireOpen() const;
+
+  void backup(const std::string& path) override;
+  std::unique_ptr<Database>
+      openDatabase(Id start, rts::UsetId first_unit_id, int32_t version) &&
+      override;
+
+  void writeData(folly::ByteRange key, folly::ByteRange value) override;
+
+  bool readData(folly::ByteRange key, std::function<void(folly::ByteRange)> f)
+      override;
+
+  void optimize(bool compact) override;
+
+  rocksdb::ColumnFamilyHandle* family(const Family& family) const;
+};
+
+} // namespace impl
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/database-impl.cpp b/glean/rocksdb/database-impl.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/database-impl.cpp
@@ -0,0 +1,538 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rocksdb/database-impl.h"
+#include "glean/rocksdb/container-impl.h"
+
+#include "glean/rts/timer.h"
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+using namespace rts;
+
+const char* admin_names[] = {
+    "NEXT_ID",
+    "VERSION",
+    "STARTING_ID",
+    "FIRST_UNIT_ID",
+    "NEXT_UNIT_ID",
+    "ORPHAN_FACTS",
+};
+
+namespace {
+
+template <typename T, typename F>
+T initAdminValue(
+    ContainerImpl& container_,
+    AdminId id,
+    T def,
+    bool write,
+    F&& notFound) {
+  auto current = readAdminValue<T>(container_, id);
+  if (current.hasValue()) {
+    return *current;
+  } else {
+    notFound();
+    if (write) {
+      binary::Output key;
+      key.fixed(id);
+      binary::Output value;
+      value.fixed(def);
+      check(container_.db->Put(
+          container_.writeOptions,
+          container_.family(Family::admin),
+          slice(key),
+          slice(value)));
+    }
+    return def;
+  }
+}
+
+} // namespace
+
+DatabaseImpl::DatabaseImpl(
+    ContainerImpl c,
+    Id start,
+    UsetId first_unit_id_,
+    int64_t version)
+    : container_(std::move(c)) {
+  starting_id = Id::fromWord(initAdminValue(
+      container_,
+      AdminId::STARTING_ID,
+      start.toWord(),
+      container_.mode == Mode::Create,
+      [] {}));
+
+  next_id = Id::fromWord(initAdminValue(
+      container_,
+      AdminId::NEXT_ID,
+      start.toWord(),
+      container_.mode == Mode::Create,
+      [mode = container_.mode] {
+        if (mode != Mode::Create) {
+          rts::error("corrupt database - missing NEXT_ID");
+        }
+      }));
+
+  first_unit_id = initAdminValue(
+      container_,
+      AdminId::FIRST_UNIT_ID,
+      first_unit_id_,
+      container_.mode == Mode::Create,
+      [] {
+        // TODO: later this should be an error, for now we have to be
+        // able to open old DBs.
+      });
+  VLOG(1) << folly::sformat("first_unit_id: {}", first_unit_id);
+
+  next_uset_id = initAdminValue(
+      container_,
+      AdminId::NEXT_UNIT_ID,
+      first_unit_id,
+      container_.mode == Mode::Create,
+      [] {
+        // TODO: later this should be an error, for now we have to be
+        // able to open old DBs.
+      });
+  VLOG(1) << folly::sformat("next_uset_id: {}", next_uset_id);
+
+  db_version = initAdminValue(
+      container_,
+      AdminId::VERSION,
+      version,
+      container_.mode == Mode::Create,
+      [] {});
+
+  if (db_version != version) {
+    rts::error("unexpected database version {}", db_version);
+  }
+
+  stats_.set(loadStats());
+
+  if (container_.mode != Mode::ReadOnly) {
+    // These are only used when writing
+    ownership_unit_counters = loadOwnershipUnitCounters();
+    ownership_derived_counters = loadOwnershipDerivedCounters();
+
+    // We only need usets_ for writable DBs, and it takes time and
+    // memory to load them so omit this for ReadOnly DBs.
+    usets_ = loadOwnershipSets();
+  }
+
+  // Enable the fact owner cache when the DB is read-only
+  if (container_.mode == Mode::ReadOnly) {
+    cacheOwnership();
+  }
+}
+
+rts::PredicateStats DatabaseImpl::loadStats() {
+  container_.requireOpen();
+  rts::PredicateStats stats;
+  std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+      rocksdb::ReadOptions(), container_.family(Family::stats)));
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate iterator");
+  }
+
+  for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
+    binary::Input key(byteRange(iter->key()));
+    stats[key.fixed<Pid>()] = fromSlice<MemoryStats>(iter->value());
+    assert(key.empty());
+  }
+  auto s = iter->status();
+  if (!s.IsNotFound()) {
+    check(s);
+  }
+  return stats;
+}
+
+Id DatabaseImpl::idByKey(Pid type, folly::ByteRange key) {
+  if (count(type).high() == 0) {
+    return Id::invalid();
+  }
+
+  container_.requireOpen();
+  rocksdb::PinnableSlice out;
+  binary::Output k;
+  k.fixed(type);
+  k.put(key);
+  auto s = container_.db->Get(
+      rocksdb::ReadOptions(), container_.family(Family::keys), slice(k), &out);
+  if (s.IsNotFound()) {
+    return Id::invalid();
+  } else {
+    check(s);
+    binary::Input value = input(out);
+    auto id = value.fixed<Id>();
+    assert(value.empty());
+    return id;
+  }
+}
+
+Pid DatabaseImpl::typeById(Id id) {
+  container_.requireOpen();
+  rocksdb::PinnableSlice val;
+  if (lookupById(id, val)) {
+    return input(val).packed<Pid>();
+  } else {
+    return Pid::invalid();
+  }
+}
+
+namespace {
+
+rts::Fact::Ref decomposeFact(Id id, const rocksdb::Slice& data) {
+  auto inp = input(data);
+  const auto ty = inp.packed<Pid>();
+  const auto key_size = inp.packed<uint32_t>();
+  return rts::Fact::Ref{id, ty, rts::Fact::Clause::from(inp.bytes(), key_size)};
+}
+
+} // namespace
+
+bool DatabaseImpl::factById(Id id, std::function<void(Pid, Fact::Clause)> f) {
+  container_.requireOpen();
+  rocksdb::PinnableSlice val;
+  if (lookupById(id, val)) {
+    auto ref = decomposeFact(id, val);
+    f(ref.type, ref.clause);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+bool DatabaseImpl::lookupById(Id id, rocksdb::PinnableSlice& val) const {
+  if (id < startingId() || id >= firstFreeId()) {
+    return false;
+  }
+  binary::Output key;
+  key.nat(id.toWord());
+  val.Reset();
+  auto s = container_.db->Get(
+      rocksdb::ReadOptions(),
+      container_.family(Family::entities),
+      slice(key),
+      &val);
+  if (s.IsNotFound()) {
+    return false;
+  } else {
+    check(s);
+    return true;
+  }
+}
+
+namespace {
+
+struct SeekIterator final : rts::FactIterator {
+  SeekIterator(
+      folly::ByteRange start,
+      size_t prefix_size,
+      Pid type,
+      const DatabaseImpl* db)
+      : upper_bound_(
+            binary::lexicographicallyNext({start.data(), prefix_size})),
+        upper_bound_slice_(
+            reinterpret_cast<const char*>(upper_bound_.data()),
+            upper_bound_.size()),
+        type_(type),
+        db_(db) {
+    assert(prefix_size <= start.size());
+    // both upper_bound_slice_ and options_ need to be alive for the duration
+    // of the iteration
+    options_.iterate_upper_bound = &upper_bound_slice_;
+    iter_.reset(db->container_.db->NewIterator(
+        options_, db->container_.family(Family::keys)));
+    if (iter_) {
+      iter_->Seek(slice(start));
+    } else {
+      rts::error("rocksdb: couldn't allocate iterator");
+    }
+  }
+
+  void next() override {
+    iter_->Next();
+    auto s = iter_->status();
+    if (!s.IsNotFound()) {
+      check(s);
+    }
+  }
+
+  Fact::Ref get(Demand demand) override {
+    if (iter_->Valid()) {
+      auto key = input(iter_->key());
+      [[maybe_unused]] auto ty = key.fixed<Pid>();
+      assert(ty == type_);
+      auto value = input(iter_->value());
+      auto id = value.fixed<Id>();
+      assert(value.empty());
+
+      if (demand == KeyOnly) {
+        return Fact::Ref{id, type_, Fact::Clause::fromKey(key.bytes())};
+      } else {
+        [[maybe_unused]] auto found = db_->lookupById(id, slice_);
+        assert(found);
+        return decomposeFact(id, slice_);
+      }
+    } else {
+      return Fact::Ref::invalid();
+    }
+  }
+
+  std::optional<Id> lower_bound() override {
+    return std::nullopt;
+  }
+  std::optional<Id> upper_bound() override {
+    return std::nullopt;
+  }
+
+  const std::vector<unsigned char> upper_bound_;
+  const rocksdb::Slice upper_bound_slice_;
+  const Pid type_;
+  rocksdb::ReadOptions options_;
+  std::unique_ptr<rocksdb::Iterator> iter_;
+  const DatabaseImpl* db_;
+  rocksdb::PinnableSlice slice_;
+};
+
+} // namespace
+
+std::unique_ptr<rts::FactIterator>
+DatabaseImpl::seek(Pid type, folly::ByteRange start, size_t prefix_size) {
+  assert(prefix_size <= start.size());
+  if (count(type).high() == 0) {
+    return std::make_unique<EmptyIterator>();
+  }
+
+  container_.requireOpen();
+  binary::Output out;
+  out.fixed(type);
+  const auto type_size = out.size();
+  out.put(start);
+  return std::make_unique<SeekIterator>(
+      out.bytes(), type_size + prefix_size, type, this);
+}
+
+std::unique_ptr<rts::FactIterator> DatabaseImpl::seekWithinSection(
+    Pid type,
+    folly::ByteRange start,
+    size_t prefix_size,
+    Id from,
+    Id upto) {
+  if (upto <= startingId() || firstFreeId() <= from) {
+    return std::make_unique<EmptyIterator>();
+  }
+
+  return Section(this, from, upto).seek(type, start, prefix_size);
+}
+
+namespace {
+
+template <typename Direction>
+struct EnumerateIterator final : rts::FactIterator {
+  static std::vector<char> encode(Id id) {
+    std::vector<char> v(rts::MAX_NAT_SIZE);
+    const auto n =
+        rts::storeNat(reinterpret_cast<unsigned char*>(v.data()), id.toWord());
+    v.resize(n);
+    return v;
+  }
+
+  explicit EnumerateIterator(Id start, Id bound, const DatabaseImpl* db)
+      : bound_(encode(bound)), bound_slice_(bound_.data(), bound_.size()) {
+    // both the slice and options_ need to be alive for the duration
+    // of the iteration
+    options_.*Direction::iterate_bound = &bound_slice_;
+    iter_.reset(db->container_.db->NewIterator(
+        options_, db->container_.family(Family::entities)));
+
+    auto st = encode(start);
+    if (iter_) {
+      (iter_.get()->*Direction::seek)({st.data(), st.size()});
+    } else {
+      rts::error("rocksdb: couldn't allocate iterator");
+    }
+  }
+
+  void next() override {
+    (iter_.get()->*Direction::next)();
+    auto s = iter_->status();
+    if (!s.IsNotFound()) {
+      check(s);
+    }
+  }
+
+  Fact::Ref get(Demand /*unused*/) override {
+    return iter_->Valid()
+        ? decomposeFact(
+              Id::fromWord(
+                  loadTrustedNat(reinterpret_cast<const unsigned char*>(
+                                     iter_->key().data()))
+                      .first),
+              iter_->value())
+        : Fact::Ref::invalid();
+  }
+
+  std::optional<Id> lower_bound() override {
+    return std::nullopt;
+  }
+  std::optional<Id> upper_bound() override {
+    return std::nullopt;
+  }
+
+  const std::vector<char> bound_;
+  const rocksdb::Slice bound_slice_;
+  rocksdb::ReadOptions options_;
+  std::unique_ptr<rocksdb::Iterator> iter_;
+};
+
+struct Forward {
+  static std::pair<Id, Id>
+  bounds(Id from, Id upto, Id starting_id, Id next_id) {
+    if (from >= next_id || (upto && upto <= starting_id)) {
+      return {Id::invalid(), Id::invalid()};
+    } else {
+      return {
+          std::max(from, starting_id),
+          upto && upto <= next_id ? upto : next_id};
+    }
+  }
+
+  static inline constexpr auto iterate_bound =
+      &rocksdb::ReadOptions::iterate_upper_bound;
+  static inline constexpr auto seek = &rocksdb::Iterator::Seek;
+  static inline constexpr auto next = &rocksdb::Iterator::Next;
+};
+
+struct Backward {
+  static std::pair<Id, Id>
+  bounds(Id from, Id downto, Id starting_id, Id next_id) {
+    if (downto >= next_id || (from && from <= starting_id)) {
+      return {Id::invalid(), Id::invalid()};
+    } else {
+      return {
+          (from && from <= next_id ? from : next_id) - 1,
+          std::max(downto, starting_id)};
+    }
+  }
+
+  static inline constexpr auto iterate_bound =
+      &rocksdb::ReadOptions::iterate_lower_bound;
+  static inline constexpr auto seek = &rocksdb::Iterator::SeekForPrev;
+  static inline constexpr auto next = &rocksdb::Iterator::Prev;
+};
+
+} // namespace
+
+template <typename Direction>
+std::unique_ptr<rts::FactIterator>
+makeEnumerateIterator(DatabaseImpl* db, Id from, Id to) {
+  db->container_.requireOpen();
+  const auto [start, bound] =
+      Direction::bounds(from, to, db->startingId(), db->firstFreeId());
+  if (!start) {
+    return std::make_unique<rts::EmptyIterator>();
+  } else {
+    return std::make_unique<EnumerateIterator<Direction>>(start, bound, db);
+  }
+}
+
+std::unique_ptr<rts::FactIterator> DatabaseImpl::enumerate(Id from, Id upto) {
+  return makeEnumerateIterator<Forward>(this, from, upto);
+}
+
+std::unique_ptr<rts::FactIterator> DatabaseImpl::enumerateBack(
+    Id from,
+    Id downto) {
+  return makeEnumerateIterator<Backward>(this, from, downto);
+}
+
+void DatabaseImpl::commit(rts::FactSet& facts) {
+  container_.requireOpen();
+
+  if (facts.empty()) {
+    return;
+  }
+
+  if (facts.startingId() < next_id) {
+    rts::error(
+        "batch inserted out of sequence ({} < {})",
+        facts.startingId(),
+        next_id);
+  }
+
+  rocksdb::WriteBatch batch;
+
+  // NOTE: We do *not* support concurrent writes so we don't need to protect
+  // stats_ here because nothing should be able to replace it while we're
+  // running
+  const auto& old_stats = stats_.unprotected();
+  PredicateStats new_stats(old_stats);
+
+  for (auto iter = facts.enumerate(); auto fact = iter->get(); iter->next()) {
+    assert(fact.id >= next_id);
+
+    uint64_t mem = 0;
+    auto put = [&](auto family, const auto& key, const auto& value) {
+      check(batch.Put(family, key, value));
+      mem += key.size();
+      mem += value.size();
+    };
+
+    {
+      binary::Output k;
+      k.nat(fact.id.toWord());
+      binary::Output v;
+      v.packed(fact.type);
+      v.packed(fact.clause.key_size);
+      v.put({fact.clause.data, fact.clause.size()});
+
+      put(container_.family(Family::entities), slice(k), slice(v));
+    }
+
+    {
+      binary::Output k;
+      k.fixed(fact.type);
+      k.put(fact.key());
+      binary::Output v;
+      v.fixed(fact.id);
+
+      put(container_.family(Family::keys), slice(k), slice(v));
+    }
+
+    new_stats[fact.type] += MemoryStats::one(mem);
+  }
+
+  const auto first_free_id = facts.firstFreeId();
+  check(batch.Put(
+      container_.family(Family::admin),
+      toSlice(AdminId::NEXT_ID),
+      toSlice(first_free_id)));
+
+  for (const auto& x : new_stats) {
+    if (x.second != old_stats.get(x.first)) {
+      check(batch.Put(
+          container_.family(Family::stats),
+          toSlice(x.first.toWord()),
+          toSlice(x.second)));
+    }
+  }
+
+  check(container_.db->Write(container_.writeOptions, &batch));
+  next_id = first_free_id;
+
+  stats_.set(std::move(new_stats));
+}
+
+} // namespace impl
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/database-impl.h b/glean/rocksdb/database-impl.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/database-impl.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/container/F14Map.h>
+
+#include "glean/rts/ownership/uset.h"
+
+#include "glean/rocksdb/container-impl.h"
+#include "glean/rocksdb/rocksdb.h"
+#include "glean/rocksdb/stats.h"
+#include "glean/rocksdb/util.h"
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+enum class AdminId : uint32_t {
+  NEXT_ID,
+  VERSION,
+  STARTING_ID,
+  FIRST_UNIT_ID,
+  NEXT_UNIT_ID,
+  ORPHAN_FACTS,
+};
+
+struct DatabaseImpl final : Database {
+  int64_t db_version;
+  ContainerImpl container_;
+  Id starting_id;
+  Id next_id;
+  rts::UnitId first_unit_id;
+  rts::UsetId next_uset_id; // also next UnitId, since they share a namespace
+  AtomicPredicateStats stats_;
+  std::vector<size_t> ownership_unit_counters;
+  folly::F14FastMap<uint64_t, size_t> ownership_derived_counters;
+
+  // Cached ownership sets, only used when writing.
+  // Note: must only be accessed under the write lock
+  std::unique_ptr<rts::Usets> usets_;
+
+  explicit DatabaseImpl(
+      ContainerImpl c,
+      Id start,
+      rts::UsetId first_unit_id,
+      int64_t version);
+
+  DatabaseImpl(const DatabaseImpl&) = delete;
+  DatabaseImpl& operator=(const DatabaseImpl&) = delete;
+  DatabaseImpl(DatabaseImpl&&) = delete;
+  DatabaseImpl& operator=(DatabaseImpl&&) = delete;
+
+  Container& container() noexcept override {
+    return container_;
+  }
+
+  void commit(rts::FactSet& facts) override;
+
+  /// Lookup implementation
+
+  Id idByKey(Pid type, folly::ByteRange key) override;
+  Pid typeById(Id id) override;
+  bool factById(Id id, std::function<void(Pid, rts::Fact::Clause)> f) override;
+
+  rts::Id startingId() const override {
+    return starting_id;
+  }
+
+  rts::Id firstFreeId() const override {
+    return next_id;
+  }
+
+  rts::Interval count(Pid pid) const override {
+    return stats_.count(pid);
+  }
+
+  std::unique_ptr<rts::FactIterator> enumerate(Id from, Id upto) override;
+  std::unique_ptr<rts::FactIterator> enumerateBack(Id from, Id downto) override;
+  std::unique_ptr<rts::FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) override;
+  std::unique_ptr<rts::FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id upto) override;
+
+  rts::UsetId getOwner(Id id) override;
+
+  /// stats
+
+  rts::PredicateStats loadStats();
+
+  rts::PredicateStats predicateStats() const override {
+    return stats_.get();
+  }
+
+  bool lookupById(Id id, rocksdb::PinnableSlice& val) const;
+
+  std::vector<size_t> loadOwnershipUnitCounters();
+  folly::F14FastMap<uint64_t, size_t> loadOwnershipDerivedCounters();
+  std::unique_ptr<rts::Usets> loadOwnershipSets();
+
+  /// Ownership
+
+  folly::Optional<uint32_t> getUnitId(folly::ByteRange unit) override;
+  folly::Optional<std::string> getUnit(uint32_t unit_id) override;
+
+  void addOwnership(const std::vector<OwnershipSet>& ownership) override;
+
+  std::unique_ptr<rts::DerivedFactOwnershipIterator>
+  getDerivedFactOwnershipIterator(Pid pid) override;
+
+  std::unique_ptr<rts::OwnershipUnitIterator> getOwnershipUnitIterator()
+      override;
+
+  void storeOwnership(rts::ComputedOwnership& ownership) override;
+
+  std::unique_ptr<rts::Ownership> getOwnership() override;
+
+  void addDefineOwnership(rts::DefineOwnership& define) override;
+
+  // Cache for getOwner(Id)
+  //
+  // We start with an interval map stored in the factOwners column family. This
+  // is translated into a more efficient representation in factOwnerPages when
+  // the DB is finalized,
+  //
+  // The cache is split into pages each covering 2^PAGE_BITS Ids.
+  // The prefix of a page is Id >> PAGE_BITS.
+  //
+  // We're trying to trade-off:
+  //    - space overhead in the DB: group data into pages, and don't create
+  //      DB entries for empty pages.
+  //    - time to open a DB: the cache is populated lazily from the DB
+  //    - latency when the cache is cold: just one Get() to fetch a page
+  //    - as few DB lookups as possible: each lookup populates a whole page
+  //
+  // PageIndex
+  //    - stored as one blob in the DB, factOwnerPages["INDEX"]
+  //    - maps prefix -> maybe UsetId
+  //      - UsetId => all Ids in this page map to the same UsetId, which might
+  //      be INVALID_USET
+  //      - nothing => fetch the page
+  //    - the purpose of the index is to support the sparse interval maps we
+  //    will have in
+  //      stacked DBs. Otherwise we would need 250k entries in the PageStore for
+  //      a stacked DB where the base has 1B facts. With the index we just need
+  //      a 1MB index blob where a few of the pages will be populated.
+  //
+  // PageStore
+  //    - stored as prefix -> Page in the DB
+  //    - Each page is a table of intervals [(id1,set1), (id2,set2), ...],
+  //      split into two arrays because the IDs are 16 bits and we want that
+  //      array to be as compact as possible. See "struct Page" below.
+  //
+  // To find the UsetId for a given Id:
+  //    - look up the prefix in the index
+  //    - if the index contains a UsetId, that's the result
+  //    - otherwise fetch the Page for this prefix
+  //    - binary-search in the Page to find the correct interval
+
+  /// Enable the fact owner cache. This should only be called when the
+  // DB is read-only, and only after prepareFactOwnerCache().
+  void cacheOwnership() override;
+
+  /// Translate the data in factOwners into factOwnerPages. Do not call
+  // prepareFactOwnerCache() until the DB is complete.
+  void prepareFactOwnerCache() override;
+
+  struct FactOwnerCache {
+    static void prepare(ContainerImpl& container);
+    void enable(ContainerImpl& container);
+
+    // Lookup in the cache. Returns none if the cache is not enabled
+    std::optional<rts::UsetId> getOwner(ContainerImpl& container, Id id);
+
+   private:
+    struct Page {
+      std::vector<uint16_t> factIds;
+      std::vector<rts::UsetId> setIds;
+    };
+    static rts::UsetId lookup(const Page& page, Id id);
+    static std::unique_ptr<Page> readPage(
+        ContainerImpl& container,
+        uint64_t prefix);
+
+    struct Cache {
+      std::vector<rts::UsetId> index;
+      std::vector<std::unique_ptr<Page>> pages;
+
+      // tracks the memory usage of the cache
+      size_t size_;
+    };
+
+    // nullptr means the cache is disabled (while the DB is writable)
+    folly::Synchronized<std::unique_ptr<Cache>> cache_;
+  };
+
+  FactOwnerCache factOwnerCache_;
+};
+
+extern const char* admin_names[];
+
+template <typename T>
+folly::Optional<T> readAdminValue(ContainerImpl& container_, AdminId id) {
+  container_.requireOpen();
+  rocksdb::PinnableSlice val;
+  binary::Output key;
+  key.fixed(id);
+  auto s = container_.db->Get(
+      rocksdb::ReadOptions(),
+      container_.family(Family::admin),
+      slice(key),
+      &val);
+  if (!s.IsNotFound()) {
+    check(s);
+    binary::Input value = input(val);
+    auto result = value.fixed<T>();
+    if (!value.empty()) {
+      rts::error(
+          "corrupt database - invalid {}",
+          admin_names[static_cast<uint32_t>(id)]);
+    }
+    return result;
+  } else {
+    return {};
+  };
+}
+
+} // namespace impl
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/ffi.cpp b/glean/rocksdb/ffi.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/ffi.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/rocksdb/ffi.h"
+#include "glean/rocksdb/rocksdb.h"
+
+using namespace facebook::hs;
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace c {
+extern "C" {
+
+struct SharedCache {
+  std::shared_ptr<facebook::glean::rocks::Cache> value;
+};
+
+const char* glean_rocksdb_new_cache(size_t capacity, SharedCache** cache) {
+  return ffi::wrap(
+      [=] { *cache = new SharedCache{rocks::newCache(capacity)}; });
+}
+
+void glean_rocksdb_free_cache(SharedCache* cache) {
+  ffi::free_(cache);
+}
+
+void glean_rocksdb_container_close(Container* container) {
+  container->close();
+}
+
+const char* glean_rocksdb_container_write_data(
+    Container* container,
+    const void* key,
+    size_t key_size,
+    const void* value,
+    size_t value_size) {
+  return ffi::wrap([=] {
+    container->writeData(
+        {static_cast<const unsigned char*>(key), key_size},
+        {static_cast<const unsigned char*>(value), value_size});
+  });
+}
+
+const char* glean_rocksdb_container_read_data(
+    Container* container,
+    const void* key,
+    size_t key_size,
+    void** value,
+    size_t* value_size,
+    unsigned char* found) {
+  return ffi::wrap([=] {
+    *found = container->readData(
+                 {static_cast<const unsigned char*>(key), key_size},
+                 [=](folly::ByteRange val) {
+                   auto bytes = ffi::clone_bytes(val);
+                   *value_size = bytes.size();
+                   *value = bytes.release();
+                 })
+        ? 1
+        : 0;
+  });
+}
+
+const char* glean_rocksdb_container_optimize(
+    Container* container,
+    bool compact) {
+  return ffi::wrap([=] { container->optimize(compact); });
+}
+
+const char* glean_rocksdb_container_backup(
+    Container* container,
+    const char* path) {
+  return ffi::wrap([=] { container->backup(path); });
+}
+
+const char* glean_rocksdb_container_open(
+    const char* path,
+    int mode,
+    bool cache_index_and_filter_blocks,
+    SharedCache* cache,
+    Container** container) {
+  return ffi::wrap([=] {
+    folly::Optional<std::shared_ptr<rocks::Cache>> cache_ptr;
+    if (cache) {
+      cache_ptr = cache->value;
+    }
+    *container = rocks::open(
+                     path,
+                     static_cast<rocks::Mode>(mode),
+                     cache_index_and_filter_blocks,
+                     std::move(cache_ptr))
+                     .release();
+  });
+}
+void glean_rocksdb_container_free(Container* container) {
+  ffi::free_(container);
+}
+
+const char* glean_rocksdb_container_open_database(
+    Container* container,
+    glean_fact_id_t start,
+    uint32_t first_unit_id,
+    int64_t version,
+    Database** database) {
+  return ffi::wrap([=] {
+    *database = std::move(*container)
+                    .openDatabase(Id::fromThrift(start), first_unit_id, version)
+                    .release();
+  });
+}
+void glean_rocksdb_database_free(Database* db) {
+  ffi::free_(db);
+}
+
+Container* glean_rocksdb_database_container(Database* db) {
+  return &(db->container());
+}
+
+Lookup* glean_rocksdb_database_lookup(Database* db) {
+  return db;
+}
+
+const char* glean_rocksdb_commit(Database* db, FactSet* facts) {
+  return ffi::wrap([=] { db->commit(*facts); });
+}
+
+const char* glean_rocksdb_add_ownership(
+    Database* db,
+    size_t count,
+    const void** units,
+    const size_t* unit_sizes,
+    const int64_t** ids,
+    const size_t* id_sizes) {
+  return ffi::wrap([=] {
+    std::vector<Database::OwnershipSet> v;
+    v.reserve(count);
+    for (size_t i = 0; i < count; ++i) {
+      v.push_back(
+          {{static_cast<const unsigned char*>(units[i]), unit_sizes[i]},
+           {ids[i], id_sizes[i]}});
+    }
+    db->addOwnership(v);
+  });
+}
+
+const char* glean_rocksdb_get_ownership_unit_iterator(
+    Database* db,
+    OwnershipUnitIterator** iter) {
+  return ffi::wrap([=] { *iter = db->getOwnershipUnitIterator().release(); });
+}
+
+const char* glean_rocksdb_get_unit_id(
+    Database* db,
+    void* unit,
+    size_t unit_size,
+    uint64_t* unit_id) {
+  return ffi::wrap([=] {
+    auto res = db->getUnitId(folly::ByteRange(
+        reinterpret_cast<const unsigned char*>(unit), unit_size));
+    if (res.hasValue()) {
+      *unit_id = *res;
+    } else {
+      *unit_id = UINT64_MAX;
+    }
+  });
+}
+
+const char* glean_rocksdb_get_unit(
+    Database* db,
+    uint32_t unit_id,
+    void** unit,
+    size_t* unit_size) {
+  return ffi::wrap([=] {
+    auto res = db->getUnit(unit_id);
+    if (res.hasValue()) {
+      ffi::clone_bytes(*res).release_to(unit, unit_size);
+    } else {
+      *unit = nullptr;
+      *unit_size = 0;
+    }
+  });
+}
+
+const char* glean_rocksdb_database_predicateStats(
+    Database* db,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes) {
+  return ffi::wrap(
+      [=] { rts::marshal(db->predicateStats(), count, ids, counts, sizes); });
+}
+
+const char* glean_rocksdb_restore(const char* target, const char* source) {
+  return ffi::wrap([=] { facebook::glean::rocks::restore(target, source); });
+}
+
+const char* glean_rocksdb_store_ownership(
+    Database* db,
+    ComputedOwnership* ownership) {
+  return ffi::wrap([=] { db->storeOwnership(*ownership); });
+}
+
+const char* glean_rocksdb_get_ownership(Database* db, Ownership** ownership) {
+  return ffi::wrap([=] { *ownership = db->getOwnership().release(); });
+}
+
+const char* glean_rocksdb_add_define_ownership(
+    Database* db,
+    DefineOwnership* define) {
+  return ffi::wrap([=] { db->addDefineOwnership(*define); });
+}
+
+const char* glean_rocksdb_get_derived_fact_ownership_iterator(
+    Database* db,
+    uint64_t pid,
+    DerivedFactOwnershipIterator** iter) {
+  return ffi::wrap([=] {
+    *iter = db->getDerivedFactOwnershipIterator(Pid::fromWord(pid)).release();
+  });
+}
+
+const char* glean_rocksdb_cache_ownership(Database* db) {
+  return ffi::wrap([=] { db->cacheOwnership(); });
+}
+
+const char* glean_rocksdb_prepare_fact_owner_cache(Database* db) {
+  return ffi::wrap([=] { db->prepareFactOwnerCache(); });
+}
+}
+} // namespace c
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/ffi.h b/glean/rocksdb/ffi.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/ffi.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/ffi.h"
+
+#ifdef __cplusplus
+namespace facebook {
+namespace glean {
+namespace rocks {
+#endif
+
+typedef struct Container Container;
+typedef struct Database Database;
+
+#ifdef __cplusplus
+}
+}
+}
+#endif
+
+#ifdef __cplusplus
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace c {
+using namespace facebook::glean::rts;
+using namespace facebook::glean::rts::c;
+
+extern "C" {
+#endif
+
+typedef struct SharedCache SharedCache;
+
+const char* glean_rocksdb_new_cache(size_t capacity, SharedCache** cache);
+void glean_rocksdb_free_cache(SharedCache* cache);
+
+void glean_rocksdb_container_close(Container* container);
+
+const char* glean_rocksdb_container_write_data(
+    Container* container,
+    const void* key,
+    size_t key_size,
+    const void* value,
+    size_t value_size);
+
+const char* glean_rocksdb_container_read_data(
+    Container* container,
+    const void* key,
+    size_t key_size,
+    void** value,
+    size_t* value_size,
+    unsigned char* found);
+
+const char* glean_rocksdb_container_optimize(Container* db, bool compact);
+
+const char* glean_rocksdb_container_backup(Container* db, const char* path);
+
+const char* glean_rocksdb_container_open(
+    const char* path,
+    int mode,
+    bool cache_index_and_filter_blocks,
+    SharedCache* cache,
+    Container** container);
+void glean_rocksdb_container_free(Container* container);
+
+const char* glean_rocksdb_container_open_database(
+    Container* container,
+    glean_fact_id_t start,
+    uint32_t first_unit_id,
+    int64_t version,
+    Database** db);
+void glean_rocksdb_database_free(Database* db);
+
+Container* glean_rocksdb_database_container(Database* db);
+
+Lookup* glean_rocksdb_database_lookup(Database* db);
+
+const char* glean_rocksdb_commit(Database* db, FactSet* facts);
+
+const char* glean_rocksdb_add_ownership(
+    Database* db,
+    size_t count,
+    const void** units,
+    const size_t* unit_sizes,
+    const int64_t** ids,
+    const size_t* id_sizes);
+
+const char* glean_rocksdb_get_ownership_unit_iterator(
+    Database* db,
+    OwnershipUnitIterator** iter);
+
+const char* glean_rocksdb_get_unit_id(
+    Database* db,
+    void* unit,
+    size_t unit_size,
+    uint64_t* unit_id);
+
+const char* glean_rocksdb_get_unit(
+    Database* db,
+    uint32_t unit_id,
+    void** unit,
+    size_t* unit_size);
+
+const char* glean_rocksdb_database_predicateStats(
+    Database* db,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes);
+
+const char* glean_rocksdb_restore(const char* target, const char* source);
+
+const char* glean_rocksdb_store_ownership(
+    Database* db,
+    ComputedOwnership* ownership);
+
+const char* glean_rocksdb_get_ownership(Database* db, Ownership** ownership);
+
+const char* glean_rocksdb_add_define_ownership(
+    Database* db,
+    DefineOwnership* define);
+
+const char* glean_rocksdb_get_derived_fact_ownership_iterator(
+    Database* db,
+    uint64_t pid,
+    DerivedFactOwnershipIterator** iter);
+
+const char* glean_rocksdb_database_cache_ownership(Database* db);
+
+const char* glean_rocksdb_prepare_fact_owner_cache(Database* db);
+
+#ifdef __cplusplus
+}
+}
+}
+}
+}
+#endif
diff --git a/glean/rocksdb/ownership.cpp b/glean/rocksdb/ownership.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/ownership.cpp
@@ -0,0 +1,1045 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#else
+#include "common/hs/util/cpp/memory.h"
+#endif
+#include <glean/rts/ownership/uset.h>
+#include "glean/rocksdb/database-impl.h"
+#include "glean/rts/timer.h"
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+using namespace rts;
+
+std::vector<size_t> DatabaseImpl::loadOwnershipUnitCounters() {
+  container_.requireOpen();
+  std::vector<size_t> result;
+
+  std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+      rocksdb::ReadOptions(), container_.family(Family::ownershipRaw)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate iterator");
+  }
+
+  for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
+    binary::Input key(byteRange(iter->key()));
+    auto id = key.trustedNat();
+    if (id == first_unit_id + result.size()) {
+      result.push_back(1);
+    } else if (id + 1 == first_unit_id + result.size()) {
+      ++result.back();
+    } else {
+      rts::error("rocksdb: invalid ownershipUnits {} {}", id, result.size());
+    }
+  }
+
+  return result;
+}
+
+folly::F14FastMap<uint64_t, size_t>
+DatabaseImpl::loadOwnershipDerivedCounters() {
+  container_.requireOpen();
+  folly::F14FastMap<uint64_t, size_t> result;
+
+  std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+      rocksdb::ReadOptions(), container_.family(Family::ownershipDerivedRaw)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate iterator");
+  }
+
+  for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
+    binary::Input key(byteRange(iter->key()));
+    auto pid = key.trustedNat();
+    const auto [i, _] = result.insert({pid, 0});
+    ++i->second;
+  }
+
+  VLOG(1) << "derived fact owners for " << result.size() << " pids";
+  return result;
+}
+
+namespace {
+
+void putOwnerSet(
+    ContainerImpl& container,
+    rocksdb::WriteBatch& batch,
+    UsetId id,
+    SetOp op,
+    const OwnerSet& set) {
+  binary::Output key;
+  key.nat(id);
+  binary::Output value;
+  value.nat(op);
+  serializeEliasFano(value, set);
+  check(batch.Put(
+      container.family(Family::ownershipSets), slice(key), slice(value)));
+}
+
+std::unique_ptr<rts::OwnershipSetIterator> getSetIterator(DatabaseImpl& db) {
+  struct SetIterator : rts::OwnershipSetIterator {
+    explicit SetIterator(
+        size_t first,
+        size_t size,
+        std::unique_ptr<rocksdb::Iterator> i)
+        : first_(first), size_(size), iter(std::move(i)) {}
+
+    folly::Optional<std::pair<UsetId, SetExpr<const OwnerSet*>>> get()
+        override {
+      if (!initial) {
+        iter->Next();
+      } else {
+        initial = false;
+      }
+      if (iter->Valid()) {
+        binary::Input key(byteRange(iter->key()));
+        auto usetid = key.trustedNat();
+        // EliasFano needs to be able to read 8 bytes past the end of
+        // the data, so we have to copy the bytes to add padding.
+        const size_t pad = 8;
+        bytes = hs::ffi::clone_array<uint8_t>(
+            reinterpret_cast<const uint8_t*>(iter->value().data()),
+            iter->value().size(),
+            pad);
+        binary::Input val(bytes.get(), iter->value().size());
+        exp.op = static_cast<SetOp>(val.trustedNat());
+        exp.set = deserializeEliasFano(val);
+        return std::pair<uint32_t, SetExpr<const OwnerSet*>>(
+            usetid, {exp.op, &exp.set});
+      } else {
+        return folly::none;
+      }
+    }
+
+    std::pair<size_t, size_t> sizes() const override {
+      return {first_, size_};
+    }
+
+    hs::ffi::malloced_array<uint8_t> bytes;
+    bool initial = true;
+    SetExpr<OwnerSet> exp;
+    size_t first_, size_;
+    std::unique_ptr<rocksdb::Iterator> iter;
+  };
+
+  std::unique_ptr<rocksdb::Iterator> iter(db.container_.db->NewIterator(
+      rocksdb::ReadOptions(), db.container_.family(Family::ownershipSets)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate ownership set iterator");
+  }
+
+  size_t first, last, size;
+
+  iter->SeekToLast();
+  if (!iter->Valid()) {
+    last = 0;
+  } else {
+    binary::Input key(byteRange(iter->key()));
+    last = key.trustedNat();
+  }
+
+  iter->SeekToFirst();
+  if (!iter->Valid()) {
+    first = db.next_uset_id;
+    size = 0;
+  } else {
+    binary::Input key(byteRange(iter->key()));
+    first = key.trustedNat();
+    size = last - first + 1;
+  }
+
+  return std::make_unique<SetIterator>(first, size, std::move(iter));
+}
+
+} // namespace
+
+std::unique_ptr<Usets> DatabaseImpl::loadOwnershipSets() {
+  auto t = makeAutoTimer("loadOwnershipSets");
+
+  auto iter = getSetIterator(*this);
+  auto pair = iter->sizes();
+  auto first = pair.first;
+  auto size = pair.second;
+
+  auto usets = std::make_unique<Usets>(first + size);
+
+  while (const auto pair = iter->get()) {
+    auto set = SetU32::fromEliasFano(*pair->second.set);
+    // paranoia: check the set contents make sense
+    set.foreach([first, size](UsetId id) {
+      if (id >= first + size) {
+        rts::error(
+            "invalid ownershipSets: id out of range: {} {} {}",
+            id,
+            first,
+            size);
+      }
+    });
+    auto p = usets->add(std::move(set), 0);
+    p->id = pair->first;
+  }
+  auto stats = usets->statistics();
+
+  LOG(INFO) << "loadOwnershipSets loaded " << stats.adds << " sets, "
+            << stats.bytes << " bytes";
+
+  return usets;
+}
+
+folly::Optional<uint32_t> DatabaseImpl::getUnitId(folly::ByteRange unit) {
+  rocksdb::PinnableSlice val;
+  auto s = container_.db->Get(
+      rocksdb::ReadOptions(),
+      container_.family(Family::ownershipUnits),
+      slice(unit),
+      &val);
+  if (!s.IsNotFound()) {
+    check(s);
+    assert(val.size() == sizeof(uint32_t));
+    return folly::loadUnaligned<uint32_t>(val.data());
+  } else {
+    return folly::none;
+  }
+}
+
+folly::Optional<std::string> DatabaseImpl::getUnit(uint32_t unit_id) {
+  rocksdb::PinnableSlice val;
+  EncodedNat key(unit_id);
+  auto s = container_.db->Get(
+      rocksdb::ReadOptions(),
+      container_.family(Family::ownershipUnitIds),
+      slice(key.byteRange()),
+      &val);
+  if (!s.IsNotFound()) {
+    check(s);
+    return val.ToString();
+  } else {
+    return folly::none;
+  }
+}
+
+// Called once per batch inside Store.commit.
+// Only function that can add new UnitIds to the DB.
+// Adds to
+//   - Family::ownershipUnits
+//   - Family::ownershipUnitIds
+//   - Family::ownershipRaw
+//   - Family::admin
+void DatabaseImpl::addOwnership(const std::vector<OwnershipSet>& ownership) {
+  container_.requireOpen();
+
+  if (ownership.empty()) {
+    return;
+  }
+
+  size_t new_count = 0;
+  std::vector<size_t> touched;
+  rocksdb::WriteBatch batch;
+
+  for (const auto& set : ownership) {
+    uint32_t unit_id;
+    auto res = getUnitId(set.unit);
+    if (res.hasValue()) {
+      unit_id = *res;
+      if (unit_id >= first_unit_id + ownership_unit_counters.size()) {
+        rts::error("inconsistent unit id {}", unit_id);
+      }
+      touched.push_back(unit_id);
+    } else {
+      unit_id = first_unit_id + ownership_unit_counters.size() + new_count;
+      check(batch.Put(
+          container_.family(Family::ownershipUnits),
+          slice(set.unit),
+          toSlice(unit_id)));
+      EncodedNat key(unit_id);
+      check(batch.Put(
+          container_.family(Family::ownershipUnitIds),
+          slice(key.byteRange()),
+          slice(set.unit)));
+      ++new_count;
+    }
+
+    binary::Output key;
+    key.nat(unit_id);
+    key.nat(
+        unit_id < first_unit_id + ownership_unit_counters.size()
+            ? ownership_unit_counters[unit_id - first_unit_id]
+            : 0);
+    check(batch.Put(
+        container_.family(Family::ownershipRaw),
+        slice(key),
+        rocksdb::Slice(
+            reinterpret_cast<const char*>(set.ids.data()),
+            set.ids.size() * sizeof(int64_t))));
+  }
+
+  if (new_count > 0) {
+    next_uset_id += new_count;
+    check(batch.Put(
+        container_.family(Family::admin),
+        toSlice(AdminId::NEXT_UNIT_ID),
+        toSlice(next_uset_id)));
+  }
+
+  check(container_.db->Write(container_.writeOptions, &batch));
+
+  for (auto i : touched) {
+    CHECK_LT(i, first_unit_id + ownership_unit_counters.size());
+    ++ownership_unit_counters[i - first_unit_id];
+  }
+  ownership_unit_counters.insert(ownership_unit_counters.end(), new_count, 1);
+  CHECK_EQ(next_uset_id, ownership_unit_counters.size() + first_unit_id);
+}
+
+std::unique_ptr<rts::DerivedFactOwnershipIterator>
+DatabaseImpl::getDerivedFactOwnershipIterator(Pid pid) {
+  struct DerivedFactIterator : rts::DerivedFactOwnershipIterator {
+    explicit DerivedFactIterator(Pid pid, std::unique_ptr<rocksdb::Iterator> i)
+        : pid_(pid), iter(std::move(i)) {}
+
+    folly::Optional<DerivedFactOwnership> get() override {
+      if (iter->Valid()) {
+        binary::Input key(byteRange(iter->key()));
+        auto pid = key.trustedNat();
+        if (pid != pid_.toWord()) {
+          return {};
+        }
+        const auto val = iter->value();
+        const size_t elts = val.size() / (sizeof(uint32_t) + sizeof(uint64_t));
+        const Id* ids = reinterpret_cast<const Id*>(val.data());
+        const UsetId* owners = reinterpret_cast<const UsetId*>(
+            val.data() + elts * sizeof(uint64_t));
+        iter->Next();
+        return rts::DerivedFactOwnership{{ids, elts}, {owners, elts}};
+      } else {
+        return folly::none;
+      }
+    }
+
+    Pid pid_;
+    std::unique_ptr<rocksdb::Iterator> iter;
+  };
+
+  std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+      rocksdb::ReadOptions(), container_.family(Family::ownershipDerivedRaw)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate derived ownership iterator");
+  }
+
+  EncodedNat key(pid.toWord());
+  iter->Seek(slice(key.byteRange()));
+  return std::make_unique<DerivedFactIterator>(pid, std::move(iter));
+}
+
+std::unique_ptr<rts::OwnershipUnitIterator>
+DatabaseImpl::getOwnershipUnitIterator() {
+  struct UnitIterator : rts::OwnershipUnitIterator {
+    explicit UnitIterator(std::unique_ptr<rocksdb::Iterator> i)
+        : iter(std::move(i)) {}
+
+    folly::Optional<rts::OwnershipUnit> get() override {
+      if (iter->Valid()) {
+        binary::Input key(byteRange(iter->key()));
+        auto unit = key.trustedNat();
+        const auto val = iter->value();
+        iter->Next();
+        return rts::OwnershipUnit{
+            static_cast<uint32_t>(unit),
+            {reinterpret_cast<const OwnershipUnit::Ids*>(val.data()),
+             val.size() / sizeof(OwnershipUnit::Ids)}};
+      } else {
+        return {};
+      }
+    }
+
+    std::unique_ptr<rocksdb::Iterator> iter;
+  };
+  std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+      rocksdb::ReadOptions(), container_.family(Family::ownershipRaw)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate ownership unit iterator");
+  }
+
+  iter->SeekToFirst();
+  return std::make_unique<UnitIterator>(std::move(iter));
+}
+
+void DatabaseImpl::storeOwnership(ComputedOwnership& ownership) {
+  container_.requireOpen();
+
+  if (ownership.sets_.size() > 0) {
+    auto t = makeAutoTimer("storeOwnership(sets)");
+    rocksdb::WriteBatch batch;
+
+    auto upper = ownership.sets_.getFirstId() + ownership.sets_.size();
+
+    auto serialized = ownership.sets_.toEliasFano(upper);
+    uint32_t id = ownership.sets_.getFirstId();
+    CHECK_GE(id, next_uset_id);
+
+    for (auto& exp : serialized) {
+      if ((id % 1000000) == 0) {
+        VLOG(1) << "storeOwnership: " << id;
+      }
+      putOwnerSet(container_, batch, id, exp.op, exp.set);
+      exp.set.free();
+      id++;
+    }
+
+    next_uset_id = upper;
+    check(batch.Put(
+        container_.family(Family::admin),
+        toSlice(AdminId::NEXT_UNIT_ID),
+        toSlice(next_uset_id)));
+
+    VLOG(1) << "storeOwnership: writing sets (" << ownership.sets_.size()
+            << ")";
+    check(container_.db->Write(container_.writeOptions, &batch));
+
+    if (usets_->size() == 0) {
+      // If usets_ is empty, then it will not have the correct firstId yet
+      usets_ = std::make_unique<Usets>(ownership.sets_.getFirstId());
+    }
+    usets_->append(std::move(ownership.sets_));
+  }
+
+  CHECK(usets_->size() == 0 || usets_->getNextId() == next_uset_id);
+  // TODO: better not add new units after storing sets, we should fail if that
+  // happens
+
+  if (ownership.facts_.size() > 0) {
+    auto t = makeAutoTimer("storeOwnership(facts)");
+
+    auto hasOwner = [&](EncodedNat key) -> bool {
+      rocksdb::PinnableSlice val;
+      auto s = container_.db->Get(
+          rocksdb::ReadOptions(),
+          container_.family(Family::factOwners),
+          slice(key.byteRange()),
+          &val);
+      if (!s.IsNotFound()) {
+        check(s);
+        return true;
+      } else {
+        return false;
+      }
+    };
+
+    rocksdb::WriteBatch batch;
+    for (uint64_t i = 0; i < ownership.facts_.size(); i++) {
+      auto id = ownership.facts_[i].first;
+      auto usetid = ownership.facts_[i].second;
+      EncodedNat key(id.toWord());
+      if (usetid != INVALID_USET || !hasOwner(key)) {
+        if (usetid != INVALID_USET) {
+          CHECK_LT(usetid, next_uset_id);
+        }
+        // This is an interval map, and we might be writing multiple sparse sets
+        // of intervals where the gaps are indicated by INVALID_USET. Therefore
+        // don't overwrite an existing owner with INVALID_USET.
+        EncodedNat val(usetid);
+        check(batch.Put(
+            container_.family(Family::factOwners),
+            slice(key.byteRange()),
+            slice(val.byteRange())));
+      }
+    }
+    VLOG(1) << "storeOwnership: writing facts: " << ownership.facts_.size()
+            << " intervals";
+    check(container_.db->Write(container_.writeOptions, &batch));
+  }
+}
+
+namespace {
+
+//
+// Wrapper around DatabaseImpl. Doesn't hold any extra data of its own.
+//
+struct StoredOwnership : Ownership {
+  explicit StoredOwnership(DatabaseImpl* db) : db_(db) {}
+
+  UsetId nextSetId() override {
+    return db_->next_uset_id;
+  }
+
+  UsetId lookupSet(Uset* uset) override {
+    if (!db_->usets_) {
+      rts::error("rocksdb: lookupSet on read-only DB");
+    } else {
+      auto existing = db_->usets_->lookup(uset);
+      if (existing) {
+        return existing->id;
+      } else {
+        return INVALID_USET;
+      }
+    }
+  }
+
+  folly::Optional<SetExpr<SetU32>> getUset(UsetId id) override {
+    rocksdb::PinnableSlice val;
+    EncodedNat key(id);
+    auto s = db_->container_.db->Get(
+        rocksdb::ReadOptions(),
+        db_->container_.family(Family::ownershipSets),
+        slice(key.byteRange()),
+        &val);
+    binary::Input inp(byteRange(val));
+    if (!s.IsNotFound()) {
+      check(s);
+      SetExpr<SetU32> exp;
+      exp.op = static_cast<SetOp>(inp.trustedNat());
+      exp.set = SetU32::fromEliasFano(deserializeEliasFano(inp));
+      return exp;
+    } else {
+      return folly::none;
+    }
+  }
+
+  std::unique_ptr<rts::OwnershipSetIterator> getSetIterator() override {
+    return impl::getSetIterator(*db_);
+  }
+
+  folly::Optional<UnitId> getUnitId(folly::ByteRange unit) override {
+    return db_->getUnitId(unit);
+  }
+
+  UnitId nextUnitId() {
+    std::unique_ptr<rocksdb::Iterator> iter(db_->container_.db->NewIterator(
+        rocksdb::ReadOptions(),
+        db_->container_.family(Family::ownershipUnitIds)));
+
+    if (!iter) {
+      rts::error("rocksdb: couldn't allocate ownershipUnitIds iterator");
+    }
+
+    size_t max_unit_id;
+
+    iter->SeekToLast();
+    if (!iter->Valid()) {
+      max_unit_id = db_->first_unit_id;
+    } else {
+      binary::Input key(byteRange(iter->key()));
+      max_unit_id = key.trustedNat();
+    }
+
+    return max_unit_id;
+  }
+
+  OwnershipStats getStats() override {
+    rocksdb::Range range(toSlice(""), toSlice("\xff"));
+    uint64_t units_size, unit_ids_size, sets_size, owners_size, num_owners,
+        owner_pages_size, num_owner_pages;
+    auto& db = db_->container_.db;
+    rocksdb::FlushOptions opts;
+    db->Flush(
+        opts,
+        {db_->container_.family(Family::ownershipUnits),
+         db_->container_.family(Family::ownershipUnitIds),
+         db_->container_.family(Family::ownershipSets),
+         db_->container_.family(Family::factOwners),
+         db_->container_.family(Family::factOwnerPages)});
+    check(db->GetApproximateSizes(
+        db_->container_.family(Family::ownershipUnits),
+        &range,
+        1,
+        &units_size));
+    check(db->GetApproximateSizes(
+        db_->container_.family(Family::ownershipUnitIds),
+        &range,
+        1,
+        &unit_ids_size));
+    check(db->GetApproximateSizes(
+        db_->container_.family(Family::ownershipSets), &range, 1, &sets_size));
+    db->GetIntProperty(
+        db_->container_.family(Family::factOwners),
+        "rocksdb.estimate-num-keys",
+        &num_owners);
+    check(db->GetApproximateSizes(
+        db_->container_.family(Family::factOwners), &range, 1, &owners_size));
+    db->GetIntProperty(
+        db_->container_.family(Family::factOwnerPages),
+        "rocksdb.estimate-num-keys",
+        &num_owner_pages);
+    check(db->GetApproximateSizes(
+        db_->container_.family(Family::factOwnerPages),
+        &range,
+        1,
+        &owner_pages_size));
+
+    OwnershipStats stats;
+    stats.num_units = nextUnitId() - db_->first_unit_id; // accurate
+    stats.units_size = units_size + unit_ids_size; // estimate
+    stats.num_sets = db_->next_uset_id - stats.num_units; // accurate
+    stats.sets_size = sets_size; // estimate
+    stats.num_owner_entries = num_owners + num_owner_pages; // estimate
+    stats.owners_size = owners_size + owner_pages_size; // estimate
+
+    auto orphans =
+        readAdminValue<int64_t>(db_->container_, AdminId::ORPHAN_FACTS);
+    stats.num_orphan_facts = orphans ? *orphans : -1;
+
+    return stats;
+  }
+
+ private:
+  DatabaseImpl* db_;
+};
+
+} // namespace
+
+std::unique_ptr<rts::Ownership> DatabaseImpl::getOwnership() {
+  container_.requireOpen();
+  return std::make_unique<StoredOwnership>(this);
+}
+
+void DatabaseImpl::cacheOwnership() {
+  factOwnerCache_.enable(container_);
+}
+
+void DatabaseImpl::prepareFactOwnerCache() {
+  FactOwnerCache::prepare(container_);
+}
+
+UsetId DatabaseImpl::getOwner(Id id) {
+  auto cached = factOwnerCache_.getOwner(container_, id);
+
+  if (cached) {
+    return cached.value();
+  } else {
+    // cache is not enabled; fall back to reading from the DB.
+    std::unique_ptr<rocksdb::Iterator> iter(container_.db->NewIterator(
+        rocksdb::ReadOptions(), container_.family(Family::factOwners)));
+
+    EncodedNat key(id.toWord());
+    iter->SeekForPrev(slice(key.byteRange()));
+    if (iter->Valid()) {
+      binary::Input val(byteRange(iter->value()));
+      return val.trustedNat();
+    } else {
+      return INVALID_USET;
+    }
+  }
+}
+
+namespace {
+// key in factOwnerPages where we store the index
+static const std::string INDEX_KEY = "INDEX";
+
+// sentinel value in the index indicating that this prefix has a page in
+// factOwnerPages
+static const UsetId HAS_PAGE = SPECIAL_USET;
+
+// Note: this constant affects the data in the DB, so it can't be changed.
+static const size_t PAGE_BITS = 12;
+static const uint64_t PAGE_MASK = (1 << PAGE_BITS) - 1;
+} // namespace
+
+void DatabaseImpl::FactOwnerCache::enable(ContainerImpl& container) {
+  auto cache = cache_.ulock();
+  if (*cache) {
+    return;
+  }
+
+  rocksdb::PinnableSlice val;
+  auto s = container.db->Get(
+      rocksdb::ReadOptions(),
+      container.family(Family::factOwnerPages),
+      INDEX_KEY,
+      &val);
+  if (s.IsNotFound()) {
+    LOG(WARNING) << "cannot enable cache; missing INDEX";
+    // assume this is an old DB without factOwnerPages, we'll fall back
+    // to using factOwners.
+    return;
+  }
+
+  check(s);
+  CHECK_EQ(val.size() % sizeof(UsetId), 0);
+  size_t num = val.size() / sizeof(UsetId);
+  std::vector<UsetId> index(num);
+  const UsetId* start = reinterpret_cast<const UsetId*>(val.data());
+  std::copy(start, start + num, index.data());
+  size_t size = index.size() * sizeof(UsetId);
+  Cache content{
+      .index = std::move(index),
+      .pages = {},
+      .size_ = size,
+  };
+
+  VLOG(1) << folly::sformat("owner cache index: {} entries", num);
+
+  auto wcache = cache.moveFromUpgradeToWrite();
+  *wcache = std::make_unique<Cache>(std::move(content));
+}
+
+std::unique_ptr<DatabaseImpl::FactOwnerCache::Page>
+DatabaseImpl::FactOwnerCache::readPage(
+    ContainerImpl& container,
+    uint64_t prefix) {
+  rocksdb::PinnableSlice val;
+  auto s = container.db->Get(
+      rocksdb::ReadOptions(),
+      container.family(Family::factOwnerPages),
+      toSlice(prefix),
+      &val);
+  if (s.IsNotFound()) {
+    rts::error("missing page: {}", prefix);
+  } else {
+    check(s);
+  }
+
+  auto p = std::make_unique<FactOwnerCache::Page>();
+  size_t num = val.size() / (sizeof(int16_t) + sizeof(UsetId));
+  p->factIds.resize(num);
+  p->setIds.resize(num);
+  const uint16_t* ids = reinterpret_cast<const uint16_t*>(val.data());
+  const UsetId* sets =
+      reinterpret_cast<const UsetId*>(val.data() + num * sizeof(uint16_t));
+  std::copy(ids, ids + num, p->factIds.data());
+  std::copy(sets, sets + num, p->setIds.data());
+
+  return p;
+}
+
+UsetId DatabaseImpl::FactOwnerCache::lookup(
+    const DatabaseImpl::FactOwnerCache::Page& page,
+    Id id) {
+  // next binary-search on the content of the page to find the
+  // interval containing the desired fact ID.
+  uint32_t low, high, mid;
+  uint16_t ix = id.toWord() & PAGE_MASK;
+
+  low = 0;
+  high = page.factIds.size();
+
+  if (high == 0) {
+    rts::error("empty page");
+  }
+
+  // low is inclusive, high is exclusive
+  // low..high always contains an element that is <= id, if there is one
+  while (high - low > 1) {
+    mid = (high + low) / 2;
+    auto x = page.factIds[mid];
+    if (x == ix) {
+      return page.setIds[mid];
+    }
+    if (x < ix) {
+      low = mid;
+    } else {
+      high = mid;
+    }
+  }
+
+  if (page.factIds[low] <= ix) {
+    return page.setIds[low];
+  } else {
+    rts::error(
+        "missing lower bound, ix={} low={} prefix={}",
+        ix,
+        low,
+        id.toWord() >> PAGE_BITS);
+  }
+}
+
+std::optional<UsetId> DatabaseImpl::FactOwnerCache::getOwner(
+    ContainerImpl& container,
+    Id id) {
+  auto cachePtr = cache_.rlock();
+  auto cache = cachePtr->get();
+
+  if (!cache) {
+    return {};
+  }
+
+  // first find the right page
+  auto prefix = id.toWord() >> PAGE_BITS;
+
+  if (prefix >= cache->index.size()) {
+    // The DB may have no or partial ownership information, leading to a
+    // smaller than expected index, in which case the missing entries
+    // are facts with no ownership.
+    return INVALID_USET;
+  }
+  UsetId pageval = cache->index[prefix];
+  if (pageval != HAS_PAGE) {
+    return pageval;
+  }
+
+  const FactOwnerCache::Page* page;
+
+  // grab the Page from the cache, or read it from the DB
+  if (prefix < cache->pages.size() && cache->pages[prefix]) {
+    page = cache->pages[prefix].get();
+    cachePtr.unlock();
+  } else {
+    cachePtr.unlock();
+
+    auto p = FactOwnerCache::readPage(container, prefix);
+    auto wlock = cache_.wlock();
+    auto wcache = wlock->get();
+    auto size = wcache->size_;
+
+    if (prefix >= wcache->pages.size()) {
+      wcache->pages.resize(prefix + 1);
+    }
+    if (!wcache->pages[prefix]) {
+      wcache->size_ += p->factIds.size() * sizeof(uint16_t) +
+          p->setIds.size() * sizeof(UsetId) + sizeof(*p);
+      wcache->pages[prefix] = std::move(p);
+    }
+
+    VLOG(2) << "new page(" << prefix
+            << ") size = " << folly::prettyPrint(size, folly::PRETTY_BYTES_IEC);
+    page = wcache->pages[prefix].get();
+  }
+
+  return FactOwnerCache::lookup(*page, id);
+}
+
+void DatabaseImpl::FactOwnerCache::prepare(ContainerImpl& container) {
+  auto t = makeAutoTimer("prepareFactOwnerCache");
+
+  std::unique_ptr<rocksdb::Iterator> iter(container.db->NewIterator(
+      rocksdb::ReadOptions(), container.family(Family::factOwners)));
+
+  if (!iter) {
+    rts::error("rocksdb: couldn't allocate iterator");
+  }
+
+  iter->SeekToFirst();
+
+  std::vector<UsetId> index; // indexed by prefix
+  uint64_t prefix = 0; // prefix of the current page
+  UsetId set = INVALID_USET; // always the last set we saw
+  std::vector<uint16_t> ids; // in the current page
+  std::vector<UsetId> sets; // in the current page
+  size_t populated = 0; // for stats
+  int64_t orphaned = 0; // counts the orphan facts
+  rocksdb::WriteBatch batch;
+
+  auto writePage = [&]() {
+    if (ids.size() == 0) {
+      index.push_back(set);
+    } else {
+      index.push_back(HAS_PAGE);
+      binary::Output out;
+      out.bytes(ids.data(), ids.size() * sizeof(uint16_t));
+      out.bytes(sets.data(), sets.size() * sizeof(UsetId));
+      batch.Put(
+          container.family(Family::factOwnerPages),
+          toSlice(prefix),
+          slice(out));
+      ids.clear();
+      sets.clear();
+      populated++;
+    };
+  };
+
+  uint64_t prev = Id::lowest().toWord();
+  for (; iter->Valid(); iter->Next()) {
+    binary::Input key(byteRange(iter->key()));
+    uint64_t id = key.trustedNat();
+
+    uint64_t this_prefix = id >> PAGE_BITS;
+    uint16_t this_offset = id & PAGE_MASK;
+
+    if (this_prefix != prefix) {
+      for (; prefix < this_prefix; prefix++) {
+        writePage();
+      }
+    }
+    if (this_offset != 0 && ids.size() == 0) {
+      // fill in the lower bound with the previous set
+      ids.push_back(0);
+      sets.push_back(set);
+    }
+    if (set == INVALID_USET && id > prev) {
+      // track the number of orphaned facts
+      orphaned += id - prev;
+      VLOG(2) << folly::sformat("orphaned fact(s) {}-{}", prev, id - 1);
+    }
+
+    binary::Input val(byteRange(iter->value()));
+    set = val.trustedNat();
+    ids.push_back(this_offset);
+    sets.push_back(set);
+
+    prev = id;
+  }
+
+  // write the last page
+  writePage();
+
+  batch.Put(
+      container.family(Family::factOwnerPages),
+      INDEX_KEY,
+      slice(folly::ByteRange(
+          reinterpret_cast<const uint8_t*>(index.data()),
+          index.size() * sizeof(UsetId))));
+
+  t.logFormat(
+      "{} index entries, {} populated, {} orphans",
+      index.size(),
+      populated,
+      orphaned);
+
+  // record the number of orphaned facts, this will be fetched by ownershipStats
+  batch.Put(
+      container.family(Family::admin),
+      toSlice(AdminId::ORPHAN_FACTS),
+      toSlice(orphaned));
+
+  check(container.db->Write(container.writeOptions, &batch));
+}
+
+// Called once per batch. Can't be run in parallel.
+// Will add data into:
+// - Family::ownershipSets
+// - Family::ownershipDerivedRaw
+// - Family::admin
+void DatabaseImpl::addDefineOwnership(DefineOwnership& def) {
+  auto t = makeAutoTimer("addDefineOwnership");
+  container_.requireOpen();
+
+  VLOG(1) << "addDefineOwnership: " << def.usets_.size() << " sets";
+
+  // add new owner sets
+  if (def.newSets_.size() > 0) {
+    folly::F14FastMap<UsetId, UsetId> substitution;
+    auto subst = [&](uint32_t old) -> uint32_t {
+      auto n = substitution.find(old);
+      if (n == substitution.end()) {
+        return old;
+      } else {
+        return n->second;
+      }
+    };
+
+    rocksdb::WriteBatch batch;
+    size_t numNewSets = 0;
+
+    for (auto uset : def.newSets_) {
+      std::set<UsetId> s;
+      uset->exp.set.foreach([&](uint32_t elt) {
+        UsetId newelt = subst(elt);
+        if (newelt >= next_uset_id) {
+          rts::error(
+              "set id out of range: {} {} {}", newelt, next_uset_id, elt);
+        }
+        s.insert(newelt);
+      });
+      SetU32 set = SetU32::from(s);
+
+      auto newUset = std::make_unique<Uset>(std::move(set), uset->exp.op, 0);
+      auto p = newUset.get();
+      auto oldId = uset->id;
+      auto q = usets_->add(std::move(newUset));
+      if (p == q) {
+        usets_->promote(p);
+        assert(next_uset_id == p->id);
+        next_uset_id++;
+        auto ownerset = p->toEliasFano(next_uset_id);
+        putOwnerSet(container_, batch, p->id, ownerset.op, ownerset.set);
+        ownerset.set.free();
+        numNewSets++;
+      }
+      VLOG(2) << "rebased set " << oldId << " -> " << q->id;
+      substitution[oldId] = q->id;
+    }
+
+    if (numNewSets > 0) {
+      check(batch.Put(
+          container_.family(Family::admin),
+          toSlice(AdminId::NEXT_UNIT_ID),
+          toSlice(next_uset_id)));
+    }
+
+    VLOG(1) << "addDefineOwnership: writing sets (" << numNewSets << ")";
+    check(container_.db->Write(container_.writeOptions, &batch));
+
+    for (auto& [_, pred] : def.defines_) {
+      for (auto& owner : pred.owners_) {
+        owner = subst(owner);
+      }
+
+      for (auto& owner : pred.new_owners_) {
+        owner = subst(owner);
+      }
+    }
+  }
+
+  for (const auto& [pid, pred] : def) {
+    VLOG(1) << "addDefineOwnership: "
+            << pred.owners_.size() + pred.new_owners_.size()
+            << " owners, for pid " << pid.toWord();
+
+    // ownershipDerivedRaw :: (Pid,nat) -> vector<int64_t>
+    //
+    // Similarly to ownershipRaw, this is basically just an
+    // append-only log. The nat in the key is a per-Pid counter that
+    // we bump by one each time we add another batch of data for a
+    // Pid.
+
+    binary::Output key;
+    key.nat(pid.toWord());
+    const auto [it, _] = ownership_derived_counters.insert({pid.toWord(), 0});
+    key.nat(it->second++);
+
+    rocksdb::WriteBatch batch;
+
+    binary::Output val;
+
+    val.bytes(
+        pred.ids_.data(),
+        pred.ids_.size() *
+            sizeof(
+                std::remove_reference<decltype(pred.ids_)>::type::value_type));
+    val.bytes(
+        pred.new_ids_.data(),
+        pred.new_ids_.size() *
+            sizeof(std::remove_reference<
+                   decltype(pred.new_ids_)>::type::value_type));
+    val.bytes(
+        pred.owners_.data(),
+        pred.owners_.size() *
+            sizeof(std::remove_reference<
+                   decltype(pred.owners_)>::type::value_type));
+    val.bytes(
+        pred.new_owners_.data(),
+        pred.new_owners_.size() *
+            sizeof(std::remove_reference<
+                   decltype(pred.new_owners_)>::type::value_type));
+
+    check(batch.Put(
+        container_.family(Family::ownershipDerivedRaw),
+        slice(key),
+        slice(val)));
+
+    check(container_.db->Write(container_.writeOptions, &batch));
+
+    VLOG(1) << "addDefineOwnership wrote "
+            << pred.ids_.size() + pred.new_ids_.size() << " entries for pid "
+            << pid.toWord();
+  }
+}
+
+} // namespace impl
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/rocksdb.cpp b/glean/rocksdb/rocksdb.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/rocksdb.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rocksdb/rocksdb.h"
+#include "glean/rocksdb/container-impl.h"
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+
+std::shared_ptr<Cache> newCache(size_t capacity) {
+  return rocksdb::NewLRUCache(capacity);
+}
+
+std::unique_ptr<Container> open(
+    const std::string& path,
+    Mode mode,
+    bool cache_index_and_filter_blocks,
+    folly::Optional<std::shared_ptr<Cache>> cache) {
+  return std::make_unique<impl::ContainerImpl>(
+      path, mode, cache_index_and_filter_blocks, std::move(cache));
+}
+
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/rocksdb.h b/glean/rocksdb/rocksdb.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/rocksdb.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/densemap.h"
+#include "glean/rts/factset.h"
+#include "glean/rts/lookup.h"
+#include "glean/rts/ownership.h"
+#include "glean/rts/ownership/derived.h"
+#include "glean/rts/stats.h"
+#include "glean/rts/store.h"
+
+namespace rocksdb {
+class Cache;
+class Iterator;
+} // namespace rocksdb
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+
+using rts::Id;
+using rts::Pid;
+
+using Cache = ::rocksdb::Cache;
+
+std::shared_ptr<Cache> newCache(size_t capacity);
+
+struct Database;
+
+/// A rocksdb container for storing facts
+struct Container {
+  virtual ~Container() {}
+
+  /// Close the 'Container' - accessing it afterwards isn't allowed.
+  virtual void close() noexcept = 0;
+
+  /// Write a key/value pair to the Container metadata.
+  virtual void writeData(folly::ByteRange key, folly::ByteRange value) = 0;
+
+  /// Lookup a key in the Container metadata.
+  virtual bool readData(
+      folly::ByteRange key,
+      std::function<void(folly::ByteRange)> f) = 0;
+
+  /// Optimise the container for reading
+  virtual void optimize(bool compact) = 0;
+
+  /// Backup the Container to the specified directory.
+  virtual void backup(const std::string& path) = 0;
+
+  /// Convert the Container to a full fact Database with the given
+  /// representation version - accessing the original Container afterwards isn't
+  /// allowed. If the database is being created, start is the starting fact id.
+  ///
+  /// The base Ownership passed in (if any) must not be destructed before the
+  /// Database.
+  virtual std::unique_ptr<Database>
+  openDatabase(Id start, rts::UsetId first_unit_id, int32_t version) && = 0;
+};
+
+enum class Mode { ReadOnly = 0, ReadWrite = 1, Create = 2 };
+
+std::unique_ptr<Container> open(
+    const std::string& path,
+    Mode mode,
+    bool cache_index_and_filter_blocks,
+    folly::Optional<std::shared_ptr<Cache>> cache);
+
+/// A rocksdb-based fact database
+struct Database : rts::Lookup {
+  virtual Container& container() noexcept = 0;
+
+  virtual rts::PredicateStats predicateStats() const = 0;
+
+  struct OwnershipSet {
+    folly::ByteRange unit;
+    folly::Range<const int64_t*> ids;
+    // This is a list of intervals [x1,x2, y1,y2, ...]
+    // representing the inclusive ranges x1..x2, y1..y2, ...
+  };
+
+  virtual void commit(rts::FactSet& facts) = 0;
+
+  virtual void addOwnership(const std::vector<OwnershipSet>& ownership) = 0;
+  virtual std::unique_ptr<rts::OwnershipUnitIterator>
+  getOwnershipUnitIterator() = 0;
+
+  virtual void addDefineOwnership(rts::DefineOwnership& def) = 0;
+  virtual std::unique_ptr<rts::DerivedFactOwnershipIterator>
+  getDerivedFactOwnershipIterator(Pid pid) = 0;
+
+  virtual folly::Optional<uint32_t> getUnitId(folly::ByteRange) = 0;
+  virtual folly::Optional<std::string> getUnit(uint32_t) = 0;
+
+  virtual void storeOwnership(rts::ComputedOwnership& ownership) = 0;
+  virtual std::unique_ptr<rts::Ownership> getOwnership() = 0;
+
+  virtual void cacheOwnership() = 0;
+  virtual void prepareFactOwnerCache() = 0;
+};
+
+void restore(const std::string& target, const std::string& source);
+
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/stats.cpp b/glean/rocksdb/stats.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/stats.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rocksdb/stats.h"
+
+#include <folly/synchronization/Hazptr.h>
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+
+struct AtomicPredicateStats::Impl {
+  // This needs to be protected by a hazard poiter for access. We support reads
+  // concurrent to a write but not concurrent writes and a write replaces the
+  // entire object so a hazptr is sufficient.
+  struct Holder : folly::hazptr_obj_base<Holder> {
+    PredicateStats stats;
+
+    explicit Holder(PredicateStats s) : stats(std::move(s)) {}
+  };
+
+  std::atomic<Holder*> holder = new Holder({});
+
+  // We have a separate cohort for each DB - the stats objects we create
+  // are local to the DB so they should be destroyed when the DB object is
+  // destroyed at the latest.
+  folly::hazptr_obj_cohort<> cohort;
+};
+
+AtomicPredicateStats::AtomicPredicateStats() : impl(std::make_unique<Impl>()) {}
+
+AtomicPredicateStats::~AtomicPredicateStats() {
+  delete impl->holder.load();
+}
+
+void AtomicPredicateStats::set(PredicateStats stats) {
+  auto p = new Impl::Holder(std::move(stats));
+  p->set_cohort_tag(&impl->cohort);
+  p = impl->holder.exchange(p);
+  if (p) {
+    p->retire();
+  }
+}
+
+const PredicateStats& AtomicPredicateStats::unprotected() const {
+  return impl->holder.load()->stats;
+}
+
+PredicateStats AtomicPredicateStats::get() const {
+  folly::hazptr_local<1> hptr;
+  return hptr[0].protect(impl->holder)->stats;
+}
+
+size_t AtomicPredicateStats::count(rts::Pid pid) const {
+  folly::hazptr_local<1> hptr;
+  if (auto stat = hptr[0].protect(impl->holder)->stats.get(pid)) {
+    return stat->count;
+  } else {
+    return {};
+  }
+}
+
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/stats.h b/glean/rocksdb/stats.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/stats.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/densemap.h"
+#include "glean/rts/id.h"
+#include "glean/rts/stats.h"
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+
+using PredicateStats = rts::DenseMap<rts::Pid, rts::MemoryStats>;
+
+/// Atomic access to predicate stats. This is completely encapsulated here
+/// mostly because including Hazptr.h needs RTTI, but we have to compile the
+/// rest of rocksdb.cpp with -fno-rtti because some pre-compiled RocksDB
+/// packages are compiled with -fno-rtti and otherwise we get linker errors.
+class AtomicPredicateStats {
+ public:
+  AtomicPredicateStats();
+  ~AtomicPredicateStats();
+
+  void set(PredicateStats stats);
+  PredicateStats get() const;
+  size_t count(rts::Pid pid) const;
+
+  const PredicateStats& unprotected() const;
+
+ private:
+  struct Impl;
+  std::unique_ptr<Impl> impl;
+};
+
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rocksdb/util.h b/glean/rocksdb/util.h
new file mode 100644
--- /dev/null
+++ b/glean/rocksdb/util.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+#include "glean/rts/error.h"
+
+#include <rocksdb/db.h>
+
+namespace facebook {
+namespace glean {
+namespace rocks {
+namespace impl {
+
+[[noreturn]] inline void error(const rocksdb::Status& s) {
+  rts::error("rocksdb: " + s.ToString());
+}
+
+inline void check(const rocksdb::Status& status) {
+  if (!status.ok()) {
+    error(status);
+  }
+}
+
+inline folly::ByteRange byteRange(const rocksdb::Slice& slice) {
+  return folly::ByteRange(
+      reinterpret_cast<const unsigned char*>(slice.data()), slice.size());
+}
+
+inline rocksdb::Slice slice(const folly::ByteRange& range) {
+  return rocksdb::Slice(
+      reinterpret_cast<const char*>(range.data()), range.size());
+}
+
+inline rocksdb::Slice slice(binary::Output& output) {
+  return slice(output.bytes());
+}
+
+template <typename T>
+inline rocksdb::Slice toSlice(const T& x) {
+  return rocksdb::Slice(reinterpret_cast<const char*>(&x), sizeof(x));
+}
+
+template <typename T>
+inline T fromSlice(const rocksdb::Slice& slice) {
+  assert(slice.size() == sizeof(T));
+  T x;
+  std::memcpy(&x, slice.data(), slice.size());
+  return x;
+}
+
+inline binary::Input input(const rocksdb::Slice& slice) {
+  return binary::Input(byteRange(slice));
+}
+
+} // namespace impl
+} // namespace rocks
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/benchmarking/factblock.cpp b/glean/rts/benchmarking/factblock.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/benchmarking/factblock.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/benchmarking/factblock.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+namespace benchmarking {
+
+FactBlock FactBlock::create(FactIterator& iter) {
+  FactBlock block;
+  auto fact = iter.get();
+  if (!fact) {
+    block.starting_id = Id::fromWord(1024);
+    return block;
+  }
+
+  block.starting_id = fact.id;
+  auto expected = fact.id;
+
+  while (fact && fact.id == expected) {
+    const auto offset = block.data.size();
+    block.data.insert(
+        block.data.end(),
+        fact.clause.data,
+        fact.clause.data + fact.clause.size());
+    block.refs.push_back(
+        Ref{fact.type, offset, fact.clause.key_size, fact.clause.value_size});
+    ++expected;
+    iter.next();
+    fact = iter.get();
+  }
+
+  return block;
+}
+
+bool FactBlock::defineEach(Define& def) const {
+  auto expected = starting_id;
+  const auto buf = data.data();
+  for (const auto& ref : refs) {
+    const auto k = def.define(
+        ref.type, Fact::Clause{buf + ref.offset, ref.key_size, ref.value_size});
+    if (k != expected) {
+      return false;
+    }
+    ++expected;
+  }
+  return true;
+}
+
+bool FactBlock::lookupEachType(Lookup& lookup) const {
+  for (const auto& fact : *this) {
+    const auto type = lookup.typeById(fact.id);
+    if (type != fact.type) {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool FactBlock::lookupEachById(Lookup& lookup, bool compare) const {
+  bool result = true;
+  for (const auto& fact : *this) {
+    const auto found = lookup.factById(fact.id, [&](auto type, auto clause) {
+      if (type != fact.type || (!compare || clause.key() != fact.key())) {
+        result = false;
+      }
+    });
+    if (!found || !result) {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool FactBlock::lookupEachByKey(Lookup& lookup) const {
+  for (const auto& fact : *this) {
+    const auto id = lookup.idByKey(fact.type, fact.key());
+    if (id != fact.id) {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool FactBlock::seekToEach(Lookup& lookup) const {
+  for (const auto fact : *this) {
+    auto iter = lookup.seek(fact.type, fact.key(), 0);
+    auto ref = iter->get(FactIterator::Demand::KeyOnly);
+    if (ref.id != fact.id) {
+      return false;
+    }
+  }
+  return true;
+}
+
+} // namespace benchmarking
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/benchmarking/factblock.h b/glean/rts/benchmarking/factblock.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/benchmarking/factblock.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/define.h"
+
+#include <boost/iterator/transform_iterator.hpp>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+namespace benchmarking {
+
+struct FactBlock {
+  Id starting_id;
+
+  struct Ref {
+    Pid type;
+    size_t offset;
+    uint32_t key_size;
+    uint32_t value_size;
+  };
+
+  std::vector<Ref> refs;
+  std::vector<unsigned char> data;
+
+  static FactBlock create(FactIterator& iterator);
+
+  // std::unique_ptr<FactIterator> enumerate() const;
+
+  struct deref {
+    Id starting_id;
+    const Ref* refs;
+    const unsigned char* data;
+    const size_t count;
+    Fact::Ref operator()(const FactBlock::Ref& r) const {
+      assert(&r >= refs && &r < refs + count);
+      return Fact::Ref{
+          starting_id + (&r - refs),
+          r.type,
+          Fact::Clause{data + r.offset, r.key_size, r.value_size}};
+    }
+  };
+
+  using const_iterator =
+      boost::transform_iterator<deref, std::vector<Ref>::const_iterator>;
+
+  const_iterator iterator(std::vector<Ref>::const_iterator base) const {
+    return boost::make_transform_iterator(
+        base, deref{starting_id, refs.data(), data.data(), refs.size()});
+  }
+
+  const_iterator begin() const {
+    return iterator(refs.begin());
+  }
+
+  const_iterator end() const {
+    return iterator(refs.end());
+  }
+
+  size_t size() const {
+    return refs.size();
+  }
+
+  size_t dataSize() const {
+    return data.size();
+  }
+
+  bool defineEach(Define& def) const;
+
+  bool lookupEachType(Lookup& lookup) const;
+  bool lookupEachById(Lookup& lookup, bool compare) const;
+  bool lookupEachByKey(Lookup& lookup) const;
+  bool seekToEach(Lookup& lookup) const;
+};
+
+} // namespace benchmarking
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/benchmarking/ffi.cpp b/glean/rts/benchmarking/ffi.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/benchmarking/ffi.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#include <common/hs/util/cpp/wrap.h>
+#endif
+
+#include "glean/rts/benchmarking/factblock.h"
+#include "glean/rts/benchmarking/ffi.h"
+#include "glean/rts/factset.h"
+
+using namespace facebook::hs;
+
+namespace facebook::glean::rts::benchmarking::c {
+
+const char* glean_benchmarking_factblock_create(
+    Lookup* lookup,
+    FactBlock** block) {
+  return ffi::wrap([=] {
+    *block = new FactBlock(FactBlock::create(*(lookup->enumerate())));
+  });
+}
+
+void glean_benchmarking_factblock_free(FactBlock* block) {
+  ffi::free_(block);
+}
+
+size_t glean_benchmarking_factblock_fact_count(FactBlock* block) {
+  return block->size();
+}
+
+size_t glean_benchmarking_factblock_fact_memory(FactBlock* block) {
+  return block->dataSize();
+}
+
+const char*
+glean_benchmarking_define_each(Define* define, FactBlock* block, bool* result) {
+  return ffi::wrap([=] { *result = block->defineEach(*define); });
+}
+
+const char* glean_benchmarking_lookup_each_type(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result) {
+  return ffi::wrap([=] { *result = block->lookupEachType(*lookup); });
+}
+
+const char* glean_benchmarking_lookup_each_by_id(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result) {
+  return ffi::wrap([=] { *result = block->lookupEachById(*lookup, true); });
+}
+
+const char* glean_benchmarking_lookup_each_by_key(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result) {
+  return ffi::wrap([=] { *result = block->lookupEachByKey(*lookup); });
+}
+
+const char* glean_benchmarking_seek_to_each(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result) {
+  return ffi::wrap([=] { *result = block->seekToEach(*lookup); });
+}
+
+const char* glean_benchmarking_seek_count(
+    Lookup* lookup,
+    const int64_t* pids,
+    size_t pids_count,
+    size_t* count) {
+  return ffi::wrap([=] {
+    size_t n = 0;
+    for (size_t i = 0; i < pids_count; ++i) {
+      auto iter = lookup->seek(Pid::fromThrift(pids[i]), {}, 0);
+      while (auto ref = iter->get(FactIterator::Demand::KeyOnly)) {
+        ++n;
+        iter->next();
+      }
+    }
+    *count = n;
+  });
+}
+
+} // namespace facebook::glean::rts::benchmarking::c
diff --git a/glean/rts/benchmarking/ffi.h b/glean/rts/benchmarking/ffi.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/benchmarking/ffi.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/ffi.h"
+
+#ifdef __cplusplus
+namespace facebook::glean::rts::benchmarking {
+#endif
+
+// @lint-ignore-every CLANGTIDY facebook-hte-Typedef
+typedef struct FactBlock FactBlock;
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+namespace facebook::glean::rts::benchmarking::c {
+extern "C" {
+#endif
+
+const char* glean_benchmarking_factblock_create(
+    Lookup* lookup,
+    FactBlock** block);
+
+void glean_benchmarking_factblock_free(FactBlock* block);
+
+size_t glean_benchmarking_factblock_fact_count(FactBlock* block);
+
+size_t glean_benchmarking_factblock_fact_memory(FactBlock* block);
+
+const char*
+glean_benchmarking_define_each(Define* define, FactBlock* block, bool* result);
+
+const char* glean_benchmarking_lookup_each_type(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result);
+
+const char* glean_benchmarking_lookup_each_by_id(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result);
+
+const char* glean_benchmarking_lookup_each_by_key(
+    Lookup* lookup,
+    FactBlock* block,
+    bool* result);
+
+const char*
+glean_benchmarking_seek_to_each(Lookup* lookup, FactBlock* block, bool* result);
+
+const char* glean_benchmarking_seek_count(
+    Lookup* lookup,
+    const int64_t* pids,
+    size_t pids_count,
+    size_t* count);
+
+#ifdef __cplusplus
+}
+}
+#endif
diff --git a/glean/rts/binary.cpp b/glean/rts/binary.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/binary.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/binary.h"
+
+namespace facebook {
+namespace glean {
+namespace binary {
+
+std::vector<unsigned char> lexicographicallyNext(folly::ByteRange range) {
+  const auto end = std::make_reverse_iterator(range.begin());
+  auto pos = std::make_reverse_iterator(range.end());
+  while (pos != end && *pos == 0xFF) {
+    ++pos;
+  }
+  std::vector<unsigned char> bytes(range.begin(), pos.base());
+  if (!bytes.empty()) {
+    ++bytes.back();
+  }
+  return bytes;
+}
+
+void Output::realloc(size_t n) {
+  // Just grow by 2x - the first dynamic allocation will be at least 2*SMALL_CAP
+  const size_t k = capacity() + std::max(capacity(), n);
+  const auto wanted = folly::goodMallocSize(k);
+  if (isMalloced()) {
+    large.data =
+        static_cast<unsigned char*>(folly::checkedRealloc(large.data, wanted));
+  } else {
+    const auto p = static_cast<unsigned char*>(folly::checkedMalloc(wanted));
+    std::memcpy(p, data(), size());
+    large.data = p;
+    large.size = (size() << TAG_BITS) | LARGE_BIT | MALLOC_BIT;
+  }
+  large.cap = wanted;
+}
+
+hs::ffi::malloced_array<uint8_t> Output::moveBytes() {
+  folly::SysBufferUniquePtr p;
+  const auto len = size();
+  if (isMalloced()) {
+    p = folly::SysBufferUniquePtr(large.data, {});
+  } else {
+    p = folly::allocate_sys_buffer(len);
+    std::memcpy(p.get(), data(), len);
+  }
+  markEmpty();
+  return hs::ffi::malloced_array<uint8_t>(std::move(p), len);
+}
+
+folly::fbstring Output::moveToFbString() {
+  if (isMalloced()) {
+    // fbstring requires the data to be NUL-terminated. The terminator isn't
+    // included in the size.
+    *alloc(1) = 0;
+    const auto d = mutableData();
+    const auto s = size();
+    const auto c = large.cap;
+    markEmpty();
+    return folly::fbstring(
+        reinterpret_cast<char*>(d), s, c, folly::AcquireMallocatedString());
+  } else {
+    return folly::fbstring(data(), data() + size());
+  }
+}
+
+} // namespace binary
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/binary.h b/glean/rts/binary.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/binary.h
@@ -0,0 +1,525 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/FBString.h>
+#include <folly/Range.h>
+#include <folly/Varint.h>
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#endif
+#include "glean/rts/error.h"
+#include "glean/rts/id.h"
+#include "glean/rts/nat.h"
+#include "glean/rts/string.h"
+
+namespace facebook {
+namespace glean {
+namespace binary {
+
+inline folly::ByteRange byteRange(const std::vector<unsigned char>& s) {
+  return folly::ByteRange(s.data(), s.size());
+}
+
+inline folly::ByteRange byteRange(const std::string& s) {
+  return folly::ByteRange(
+      reinterpret_cast<const unsigned char*>(s.data()), s.size());
+}
+
+inline folly::ByteRange byteRange(const folly::fbstring& s) {
+  return folly::ByteRange(
+      reinterpret_cast<const unsigned char*>(s.data()), s.size());
+}
+
+inline folly::ByteRange stringRange(const char* s) {
+  return folly::ByteRange(reinterpret_cast<const unsigned char*>(s), strlen(s));
+}
+
+inline std::string mkString(folly::ByteRange r) {
+  return std::string(reinterpret_cast<const char*>(r.data()), r.size());
+}
+
+inline folly::fbstring mkFbstring(folly::ByteRange r) {
+  return folly::fbstring(reinterpret_cast<const char*>(r.data()), r.size());
+}
+
+/// Return the smallest sequence of bytes that is lexicographically larger than
+/// and sequence with the prefix 'range' or the empty sequence if no such
+/// sequence exists. Example:
+///
+/// lexicographicallyNext({0x25, 0x42, 0xFF, 0xFF}) == {0x25, 0x43}
+/// lexicographicallyNext({0xFF}) = {}
+std::vector<unsigned char> lexicographicallyNext(folly::ByteRange range);
+
+namespace detail {
+
+template <typename T, typename = void>
+struct word_traits;
+
+template <typename T>
+struct word_traits<
+    T,
+    typename std::enable_if_t<
+        std::is_integral<std::remove_const_t<T>>::value ||
+        std::is_enum<std::remove_const_t<T>>::value>> {
+  using word_type = T;
+  static T fromWord(word_type x) {
+    return x;
+  }
+  static word_type toWord(T x) {
+    return x;
+  }
+};
+
+template <typename T>
+struct word_traits<rts::WordId<T>> {
+  using word_type = typename rts::WordId<T>::word_type;
+  static rts::WordId<T> fromWord(word_type x) {
+    return rts::WordId<T>::fromWord(x);
+  }
+  static word_type toWord(rts::WordId<T> x) {
+    return x.toWord();
+  }
+};
+
+} // namespace detail
+
+struct Output;
+
+/**
+ * A binary buffer which can be read from.
+ *
+ * NOTE: It does not own the memory!
+ *
+ */
+struct Input {
+  folly::ByteRange buf;
+
+  Input() {}
+  explicit Input(const folly::ByteRange& b) : buf(b) {}
+  explicit Input(const std::string* s)
+      : buf(reinterpret_cast<const unsigned char*>(s->data()), s->size()) {}
+  explicit Input(const folly::fbstring* s)
+      : buf(reinterpret_cast<const unsigned char*>(s->data()), s->size()) {}
+  Input(const void* p, size_t n)
+      : buf(static_cast<const unsigned char*>(p), n) {}
+  Input(const void* start, const void* finish)
+      : buf(static_cast<const unsigned char*>(start),
+            static_cast<const unsigned char*>(finish)) {}
+
+  [[noreturn]] void wantError(size_t n) const {
+    rts::error("truncated input: expected {} bytes, got {}", n, buf.size());
+  }
+
+  /// Ensure that there are at least n bytes left
+  inline void want(size_t n) const {
+    if (buf.size() < n) {
+      wantError(n);
+    }
+  }
+
+  bool empty() const {
+    return buf.empty();
+  }
+
+  /// Read a fixed width number.
+  template <typename T>
+  T fixed() {
+    using word_type = typename detail::word_traits<T>::word_type;
+    const auto n = sizeof(word_type);
+    want(n);
+    const void* p = buf.data();
+    buf.uncheckedAdvance(n);
+    return detail::word_traits<T>::fromWord(folly::loadUnaligned<word_type>(p));
+  }
+
+  /// Read a packed unsigned number
+  template <typename T>
+  inline T packed() {
+    auto temp = buf;
+    if (auto r = folly::tryDecodeVarint(temp)) {
+      buf = temp;
+      return detail::word_traits<T>::fromWord(
+          static_cast<typename detail::word_traits<T>::word_type>(r.value()));
+    } else {
+      rts::error("invalid packed value");
+    }
+  }
+
+  /// Validate and read an encoded nat
+  inline uint64_t untrustedNat() {
+    auto r = rts::loadUntrustedNat(buf.begin(), buf.end());
+    if (r.second != nullptr) {
+      buf = {r.second, buf.end()};
+      return r.first;
+    } else {
+      rts::error("invalid nat");
+    }
+  }
+
+  /// Read an encoded nat without any checks
+  inline uint64_t trustedNat() {
+    auto r = rts::loadTrustedNat(buf.begin());
+    assert(r.second <= buf.end());
+    buf = {r.second, buf.end()};
+    return r.first;
+  }
+
+  /// Validate and skip over an encoded nat
+  inline void skipUntrustedNat() {
+    auto p = rts::skipUntrustedNat(buf.begin(), buf.end());
+    if (p != nullptr) {
+      buf = {p, buf.end()};
+    } else {
+      rts::error("invalid nat");
+    }
+  }
+
+  /// Skip over an encoded nat without any checks
+  inline void skipTrustedNat() {
+    auto p = rts::skipTrustedNat(buf.begin());
+    buf = {p, buf.end()};
+  }
+
+  uint8_t byte() {
+    want(1);
+    auto c = *buf.data();
+    buf.uncheckedAdvance(1);
+    return c;
+  }
+
+  /// Read n bytes
+  folly::ByteRange bytes(size_t n) {
+    want(n);
+    auto p = buf.data();
+    buf.uncheckedAdvance(n);
+    return folly::ByteRange(p, n);
+  }
+
+  /// Read the rest of the input
+  folly::ByteRange bytes() {
+    return bytes(buf.size());
+  }
+
+  const unsigned char* data() const {
+    return buf.data();
+  }
+
+  const unsigned char* end() const {
+    return buf.end();
+  }
+
+  size_t size() const {
+    return buf.size();
+  }
+
+  /// Validate and skip over a mangled UTF-8 string.
+  void skipUntrustedString() {
+    buf.uncheckedAdvance(rts::validateUntrustedString(buf));
+  }
+
+  /// Validate and skip over a mangled string, writing its demangled
+  /// representation into the Output
+  void demangleUntrustedString(Output& output) {
+    buf.uncheckedAdvance(rts::demangleUntrustedString(buf, output));
+  }
+
+  /// Skip over a trusted mangled string and return its *demangled* size.
+  size_t skipTrustedString() {
+    auto r = rts::skipTrustedString(buf);
+    buf.uncheckedAdvance(r.first);
+    return r.second;
+  }
+
+  template <typename T>
+  T generic_string(size_t n) {
+    folly::ByteRange r = bytes(n);
+    return T(reinterpret_cast<const char*>(r.data()), r.size());
+  }
+
+  folly::fbstring fbstring(size_t n) {
+    return generic_string<folly::fbstring>(n);
+  }
+
+  folly::fbstring fbstring() {
+    return fbstring(buf.size());
+  }
+
+  std::string string(size_t n) {
+    return generic_string<std::string>(n);
+  }
+
+  std::string string() {
+    return string(buf.size());
+  }
+
+  bool shift(folly::ByteRange pat) {
+    auto n = pat.size();
+    if (buf.size() >= n && !std::memcmp(buf.data(), pat.data(), n)) {
+      buf.uncheckedAdvance(n);
+      return true;
+    } else {
+      return false;
+    }
+  }
+}; // namespace binary
+
+/**
+ *
+ * A binary buffer which can be written to.
+ *
+ */
+struct Output {
+  Output() noexcept {
+    markEmpty();
+  }
+
+  Output(Output&& other) noexcept {
+    std::memcpy(this, &other, sizeof(Output));
+    other.markEmpty();
+  }
+
+  /// Indicates that the buffer should reference an existing memory block rather
+  /// than allocate its own. The buffer will still allocate when it needs to
+  /// grow.
+  struct RefMem {};
+
+  /// Create a buffer that references an existing memory block
+  Output(void* data, size_t size, RefMem) {
+    assert(data != nullptr || size == 0);
+
+    if (size == 0) {
+      markEmpty();
+    } else if (size <= SMALL_CAP) {
+      small[0] = static_cast<unsigned char>(size) << TAG_BITS;
+      std::memcpy(small + 1, data, size);
+    } else {
+      large.data = static_cast<unsigned char*>(data);
+      large.size = (size << TAG_BITS) | LARGE_BIT;
+      large.cap = size;
+    }
+  }
+
+  /// Create a buffer that references the memory of a string
+  Output(std::string& s, RefMem) : Output(s.data(), s.size(), RefMem()) {}
+
+  Output& operator=(Output&& other) noexcept {
+    if (this != &other) {
+      dealloc();
+      std::memcpy(this, &other, sizeof(Output));
+      other.markEmpty();
+    }
+    return *this;
+  }
+
+  ~Output() noexcept {
+    dealloc();
+  }
+
+  Output(const Output&) = delete;
+  void operator=(const Output&) = delete;
+
+  size_t size() const noexcept {
+    return (isSmall() ? large.size & 0xFF : large.size) >> TAG_BITS;
+  }
+
+  /// Return a pointer to the underlying memory. This is guaranteed to never
+  /// be null, not even for empty buffers.
+  const unsigned char* data() const noexcept {
+    return isSmall() ? small + 1 : large.data;
+  }
+
+  size_t capacity() const noexcept {
+    return isSmall() ? SMALL_CAP : large.cap;
+  }
+
+  /// Write a packed unsigned number
+  template <typename T>
+  void packed(T x) {
+    auto p = alloc(folly::kMaxVarintLength64);
+    auto n = folly::encodeVarint(
+        static_cast<uint64_t>(detail::word_traits<T>::toWord(x)), p);
+    use(n);
+  }
+
+  /// Write an encoded nat
+  inline void nat(uint64_t x) {
+    auto p = alloc(rts::MAX_NAT_SIZE);
+    auto n = rts::storeNat(p, x);
+    use(n);
+  }
+
+  // Write a fixed width number
+  template <typename T>
+  void fixed(T x) {
+    const auto w = detail::word_traits<T>::toWord(x);
+    bytes(&w, sizeof(w));
+  }
+
+  void put(folly::ByteRange bytes) {
+    this->bytes(bytes.begin(), bytes.size());
+  }
+
+  void bytes(const void* data, size_t size) {
+    if (size > 0) {
+      auto b = grab(size);
+      std::memcpy(b, data, size);
+    }
+  }
+
+  void expect(size_t n) {
+    (void)alloc(n);
+  }
+
+  /// Store the mangled representation of a UTF-8 string. The validity of the
+  /// string isn't checked.
+  void mangleString(folly::ByteRange r) {
+    rts::mangleString(r, *this);
+  }
+
+  void reverseString(folly::ByteRange r) {
+    this->bytes(r.data(), r.size());
+    rts::reverseTrustedString(this->mutableData(), this->size());
+  }
+
+  folly::ByteRange bytes() const& noexcept {
+    return to<folly::ByteRange>();
+  }
+
+  folly::fbstring fbstring() const {
+    return to<folly::fbstring>();
+  }
+
+  std::string string() const {
+    return to<std::string>();
+  }
+
+  /// Transfer ownership of the underlying memory to a malloced_array.
+  hs::ffi::malloced_array<uint8_t> moveBytes();
+
+  /// Transfer ownership of the underlying memory to a folly::fbstring.
+  folly::fbstring moveToFbString();
+
+ private:
+  static_assert(
+      folly::kIsLittleEndian,
+      "support for big endian in binary::Output not implemented");
+
+  /// Number of tag bits in the respresentation
+  static constexpr size_t TAG_BITS = 2;
+
+  /// Bit which distinguishes small buffers from large ones
+  static constexpr size_t LARGE_BIT = 1;
+
+  // Bit which indicates whether we have malloced memory ourselves
+  static constexpr size_t MALLOC_BIT = 2;
+
+  // An implementation of a growable buffer which avoids dynamic allocation
+  // for small (< SMALL_CAP) data sizes.
+  //
+  // A large buffer is made up of 3 words: size of stored data, capacity and a
+  // pointer to the heap-allocated data. The `size` field stores the size
+  // shifted left by TAG_BITS and the LARGE_BIT is always set.
+  //
+  // A small buffer reuses the 3 words to store the actual data. The first byte
+  // stores the length of the data (0 ... SMALL_CAP-1), again shifted left by
+  // TAG_BITS, with LARGE_BIT always *unset*.
+  //
+  // Since the first byte in `small` (with LARGE_BIT unset) occupies the same
+  // space as the lowest byte in `size` (with LARGE_BIT set) we can distinguish
+  // between the two representations by testing that bit. Quite importantly,
+  // a zero-initialised buffer is a valid, empty small buffer.
+
+  /// State of a large buffer
+  struct Large {
+    size_t size;
+    size_t cap;
+    unsigned char* data;
+  };
+
+  /// Maximum capacity of a small buffer
+  static constexpr size_t SMALL_CAP = sizeof(Large) - 1;
+
+  /// The actual representation
+  union {
+    Large large;
+    unsigned char small[SMALL_CAP + 1];
+  };
+
+  /// Is this a small buffer
+  bool isSmall() const noexcept {
+    return (small[0] & LARGE_BIT) == 0;
+  }
+
+  bool isMalloced() const noexcept {
+    return (small[0] & MALLOC_BIT) != 0;
+  }
+
+  /// Turn this into an empty buffer (without deallocating memory)
+  void markEmpty() noexcept {
+    small[0] = 0;
+  }
+
+  unsigned char* mutableData() noexcept {
+    return isSmall() ? small + 1 : large.data;
+  }
+
+  /// Return a pointer to enough space for n bytes. This reserves memory but
+  /// doesn't increase the size - this can be done via 'use' afterwards.
+  unsigned char* alloc(size_t n) {
+    if (n > capacity() - size()) {
+      realloc(n);
+      assert(!isSmall());
+      // Clang doesn't assume the asserted condition so tell it directly - this
+      // results in slightly better code.
+      folly::assume((small[0] & LARGE_BIT) != 0);
+    }
+    return mutableData() + size();
+  }
+
+  /// Grow the buffer by at least `n` bytes. This changes capacity but not size.
+  void realloc(size_t n);
+
+  /// Deallocate memory held by the buffer
+  void dealloc() noexcept {
+    if (isMalloced()) {
+      std::free(large.data);
+    }
+  }
+
+  /// Increase the size of the buffer. This doesn't reserve memory so the
+  /// new size must be <= capacity.
+  void use(size_t n) noexcept {
+    assert(size() + n <= capacity());
+    // This is always correct, we don't have to distinguish between small and
+    // large buffers here.
+    large.size += (n << TAG_BITS);
+  }
+
+  /// Grow the buffer size by at least n bytes, increase its size accordingly
+  /// and return a pointer to the new memory.
+  unsigned char* grab(size_t n) {
+    const auto p = alloc(n);
+    use(n);
+    return p;
+  }
+
+  /// Create a container
+  template <typename C>
+  C to() const {
+    return C(data(), data() + size());
+  }
+};
+
+} // namespace binary
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/bytecode/subroutine.cpp b/glean/rts/bytecode/subroutine.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/bytecode/subroutine.cpp
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <glog/logging.h>
+
+#include "glean/rts/binary.h"
+#include "glean/rts/bytecode/subroutine.h"
+#include "glean/rts/bytecode/syscall.h"
+#include "glean/rts/prim.h"
+#include "glean/rts/serialize.h"
+#include "glean/rts/string.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+struct Eval {
+  const std::string* literals;
+  const uint64_t* code;
+  const uint64_t* pc;
+  void* context;
+  uint64_t* frame;
+
+#include "glean/bytecode/evaluate.h"
+
+  FOLLY_ALWAYS_INLINE void execute(InputNat a) {
+    binary::Input input{*a.begin, a.end};
+    a.dst << input.packed<uint64_t>();
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputByte a) {
+    binary::Input input{*a.begin, a.end};
+    a.dst << input.fixed<unsigned char>();
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputBytes a) {
+    binary::Input input{*a.begin, a.end};
+    input.bytes(a.size);
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputSkipUntrustedString a) {
+    binary::Input input{*a.begin, a.end};
+    input.skipUntrustedString();
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputShiftLit a) {
+    binary::Input input{*a.begin, a.end};
+    a.match << input.shift(binary::byteRange(*a.lit));
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputShiftBytes a) {
+    binary::Input input{*a.begin, a.end};
+    a.match << input.shift(folly::ByteRange(a.ptr, a.ptrend));
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputSkipNat a) {
+    binary::Input input{*a.begin, a.end};
+    input.packed<uint64_t>();
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(InputSkipTrustedString a) {
+    binary::Input input{*a.begin, a.end};
+    input.skipTrustedString();
+    a.begin << input.data();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputStringToLower a) {
+    toLowerTrustedString({a.begin, a.end}, *a.dst);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputRelToAbsByteSpans a) {
+    relToAbsByteSpans({a.begin, a.end}, *a.dst);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputUnpackByteSpans a) {
+    unpackByteSpans({a.begin, a.end}, *a.dst);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputStringReverse a) {
+    a.dst->reverseString({a.begin, a.end});
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(ResetOutput a) {
+    *a.output = binary::Output();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputByte a) {
+    a.output->fixed<unsigned char>(static_cast<unsigned char>(a.src));
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputByteImm a) {
+    a.output->fixed<unsigned char>(static_cast<unsigned char>(a.src));
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputNat a) {
+    a.output->packed(a.src);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputNatImm a) {
+    a.output->packed(a.src);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(OutputBytes a) {
+    a.output->bytes(a.ptr, a.end - a.ptr);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(GetOutput a) {
+    a.ptr << a.output->bytes().data();
+    a.end << a.output->bytes().end();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(GetOutputSize a) {
+    a.dst << a.output->size();
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(LoadConst a) {
+    a.dst << a.imm;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(LoadLiteral a) {
+    a.ptr << reinterpret_cast<const unsigned char*>(a.lit->data());
+    a.end << reinterpret_cast<const unsigned char*>(
+        a.lit->data() + a.lit->size());
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Move a) {
+    a.dst << a.src;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(SubConst a) {
+    a.dst << *a.dst - a.imm;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(AddConst a) {
+    a.dst << *a.dst + a.imm;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Sub a) {
+    a.dst << *a.dst - a.src;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Add a) {
+    a.dst << *a.dst + a.src;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(PtrDiff a) {
+    a.dst << a.src2 - a.src1;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(LoadLabel a) {
+    a.dst << static_cast<uint64_t>(pc - code + std::ptrdiff_t(a.lbl));
+    // turn relative into absolute offset
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Jump a) {
+    pc += std::ptrdiff_t(a.tgt);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpReg a) {
+    pc = code + a.tgt;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIf0 a) {
+    if (a.reg == 0) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfNot0 a) {
+    if (a.reg != 0) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfEq a) {
+    if (a.reg1 == a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfNe a) {
+    if (a.reg1 != a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfGt a) {
+    if (a.reg1 > a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfGe a) {
+    if (a.reg1 >= a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfLt a) {
+    if (a.reg1 < a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(JumpIfLe a) {
+    if (a.reg1 <= a.reg2) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(DecrAndJumpIfNot0 a) {
+    a.reg << *a.reg - 1;
+    if (*a.reg != 0) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(DecrAndJumpIf0 a) {
+    a.reg << *a.reg - 1;
+    if (*a.reg == 0) {
+      pc += std::ptrdiff_t(a.tgt);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_0_1 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_0_2 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_1_1 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_1_0 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_2_0 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_3_0 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_4_0 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_2_1 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_2_2 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_2_5 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_3_1 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_5_0 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(CallFun_5_1 a) {
+    (*a.fun)(context, frame, a.args, a.args_arity);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Select a) {
+    if (a.sel < a.tgts_size) {
+      pc += std::ptrdiff_t(a.tgts[a.sel]);
+    }
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Raise a) {
+    rts::error(*a.msg);
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(Trace a) {
+    LOG(INFO) << *a.msg;
+  }
+
+  FOLLY_ALWAYS_INLINE void execute(TraceReg a) {
+    LOG(INFO) << *a.msg << ": " << folly::to<std::string>(a.reg);
+  }
+
+  FOLLY_ALWAYS_INLINE const uint64_t* execute(Suspend a) {
+    return pc + std::ptrdiff_t(a.cont);
+  }
+
+  FOLLY_ALWAYS_INLINE const uint64_t* FOLLY_NULLABLE execute(Ret) {
+    return nullptr;
+  }
+};
+
+} // namespace
+
+#define USE_SWITCH 1
+
+void Subroutine::Activation::execute() {
+  pc = Eval{sub.literals.data(), sub.code.data(), pc, context, frame()}.
+#if USE_SWITCH
+       evalSwitch();
+#else
+       evalIndirect();
+#endif
+}
+
+bool Subroutine::operator==(const Subroutine& other) const {
+  return this == &other ||
+      (code == other.code && inputs == other.inputs &&
+       outputs == other.outputs && locals == other.locals &&
+       constants == other.constants && literals == other.literals);
+}
+
+size_t Subroutine::size() const {
+  size_t litsz = 0;
+  for (auto& lit : literals) {
+    litsz += lit.size();
+  }
+  return litsz + sizeof(this) + code.size() * sizeof(uint64_t) +
+      constants.size() * sizeof(uint64_t);
+}
+
+namespace {
+template <typename T, typename U>
+std::vector<T> copy_as(const std::vector<U>& xs) {
+  std::vector<T> ys;
+  ys.reserve(xs.size());
+  for (const auto& x : xs) {
+    ys.push_back(static_cast<T>(x));
+  }
+  return ys;
+}
+} // namespace
+
+void Subroutine::put(binary::Output& out, const Subroutine& sub) {
+  serialize::put(out, sub.code, serialize::AsBytes{});
+  serialize::put(out, sub.inputs);
+  serialize::put(out, sub.outputs);
+  serialize::put(out, sub.locals);
+  serialize::put(out, sub.constants);
+  serialize::put(out, sub.literals);
+}
+
+void Subroutine::get(binary::Input& in, Subroutine& sub) {
+  serialize::get(in, sub.code, serialize::AsBytes{});
+  serialize::get(in, sub.inputs);
+  serialize::get(in, sub.outputs);
+  serialize::get(in, sub.locals);
+  serialize::get(in, sub.constants);
+  serialize::get(in, sub.literals);
+}
+
+/// Serialize an Activation. The Activation is notionally
+///   Subroutine + current PC + locals + outputs
+/// but we don't use the standard Subroutine serialization
+/// because we can do it slightly more efficiently by
+/// serializing just the bits we need.
+void Subroutine::Activation::put(binary::Output& out) const {
+  serialize::put(out, sub.code, serialize::AsBytes{});
+  serialize::put(out, (uint64_t)(pc - sub.code.data()));
+  serialize::put(out, sub.literals);
+  const folly::Range<const uint64_t*> locals{frame() + sub.inputs, sub.locals};
+  serialize::put(out, locals);
+  serialize::put(out, sub.inputs);
+  const folly::Range<const binary::Output*> outputs{
+      reinterpret_cast<const binary::Output*>(this + 1), sub.outputs};
+  serialize::put(out, outputs);
+}
+
+std::pair<Subroutine, Subroutine::Activation::State>
+Subroutine::Activation::get(binary::Input& in) {
+  uint64_t pc;
+  std::vector<uint64_t> code;
+  size_t inputs;
+  std::vector<uint64_t> locals;
+  std::vector<std::string> literals;
+  std::vector<binary::Output> outputs;
+
+  serialize::get(in, code, serialize::AsBytes{});
+  serialize::get(in, pc);
+  serialize::get(in, literals);
+  serialize::get(in, locals);
+  serialize::get(in, inputs);
+  serialize::get(in, outputs);
+
+  auto sub = Subroutine(
+      std::move(code),
+      inputs,
+      outputs.size(),
+      locals.size(),
+      std::vector<uint64_t>(), // no constants, they're already on the stack
+      std::move(literals));
+
+  Subroutine::Activation::State state{
+      pc, std::move(locals), std::move(outputs)};
+  return {std::move(sub), std::move(state)};
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/bytecode/subroutine.h b/glean/rts/bytecode/subroutine.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/bytecode/subroutine.h
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "glean/bytecode/instruction.h"
+#include "glean/rts/binary.h"
+#include "glean/rts/serialize.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// A bytecode subroutine which can be execute via 'execute'.
+struct Subroutine {
+  /// Instructions
+  std::vector<uint64_t> code;
+
+  /// Number of input words (available in registers [0,inputs-1])
+  size_t inputs;
+
+  /// Number of input words that are binary::Output*. This is not used
+  /// by the bytecode evaluator itself, but is useful for code that
+  /// invokes it to know how many binary::Output objects to allocate.
+  size_t outputs;
+
+  /// Number of local registers (in [inputs,inputs+locals-1])
+  size_t locals;
+
+  std::vector<uint64_t> constants;
+
+  /// Array of literal which can be accessed via their index from some
+  /// instructions.
+  std::vector<std::string> literals;
+
+  Subroutine() = default;
+  Subroutine(
+      std::vector<uint64_t> code0,
+      size_t inputs0,
+      size_t outputs0,
+      size_t locals0,
+      std::vector<uint64_t> constants0,
+      std::vector<std::string> literals0)
+      : code(std::move(code0)),
+        inputs(inputs0),
+        outputs(outputs0),
+        locals(locals0),
+        constants(std::move(constants0)),
+        literals(std::move(literals0)) {}
+
+  /// Size of the subroutine's frame in words
+  size_t frameSize() const {
+    return inputs + locals;
+  }
+
+  /// Serialize a Subroutine
+  static void put(binary::Output& out, const Subroutine& sub);
+
+  /// Deserialize a Subroutine
+  static void get(binary::Input& in, Subroutine& s);
+
+  /// A subroutine activation record which can be 'execute'd after supplying
+  /// arguments. The activation requires a pointer to a preallocated frame but
+  /// doesn't own it. This is mostly because we want to be able to avoid having
+  /// to 'malloc' the frame for each execution.
+  class Activation final {
+   public:
+    Activation(const Activation&) = delete;
+    Activation(Activation&&) = delete;
+    Activation& operator=(const Activation&) = delete;
+    Activation& operator=(Activation&&) = delete;
+
+    /// Allocate an activation on the stack and pass it to the supplied function
+    /// which needs to 'start' or 'restart' it, initialise its 'args' and then
+    /// 'execute' it. Note that the Subroutine must remain alive throughout the
+    /// lifetime of the activation.
+    template <typename F>
+    static auto with(const Subroutine& sub, void* context, F&& f) {
+      alignas(Activation) unsigned char buf[byteSize(sub)];
+      struct Guard {
+        Activation* ptr;
+        ~Guard() {
+          ptr->~Activation();
+        }
+      };
+      Guard guard{new (buf) Activation(sub, context)};
+      return std::forward<F>(f)(*guard.ptr);
+    }
+
+    /// Set up the activation to start executing the subroutine.
+    void start() {
+      restart(0, sub.constants.begin(), sub.constants.end());
+    }
+
+    /// Set up the activation to restart execution from a previously suspended
+    /// state.
+    template <typename Iter>
+    void restart(uint64_t entry, Iter locals_begin, Iter locals_end) {
+      pc = sub.code.data() + entry;
+      auto reg = frame() + sub.inputs - sub.outputs;
+      for (auto& out : outputs()) {
+        *reg++ = reinterpret_cast<uint64_t>(&out);
+      }
+      std::copy(locals_begin, locals_end, frame() + sub.inputs);
+    }
+
+    using arg_insert_iterator = uint64_t*;
+
+    /// Get an inserter for supplying args to the subroutine
+    arg_insert_iterator args() {
+      return frame();
+    }
+
+    using Outputs = folly::Range<binary::Output*>;
+
+    Outputs outputs() {
+      return {reinterpret_cast<binary::Output*>(this + 1), sub.outputs};
+    }
+
+    binary::Output& output(size_t i) {
+      return outputs()[i];
+    }
+
+    /// Registers in which a subroutine returns its results
+    folly::Range<const uint64_t*> results() const {
+      return {
+          frame() + sub.inputs + sub.constants.size(),
+          frame() + sub.frameSize()};
+    }
+
+    /// Execute the activation. If 'suspended' is true after the call, execution
+    /// can be resumed by another call to 'execute'.
+    void execute();
+
+    void run(std::initializer_list<uint64_t> arguments) {
+      start();
+      std::copy(arguments.begin(), arguments.end(), args());
+      execute();
+      assert(!suspended());
+    }
+
+    /// Check if the subroutine has been suspended.
+    bool suspended() const {
+      return pc != nullptr;
+    }
+
+    /// Serialize an Activation.
+    void put(binary::Output& out) const;
+
+    static void put(binary::Output& out, const Subroutine::Activation& act) {
+      act.put(out);
+    }
+
+    /// Deserialize an Activation, producing a Subroutine and
+    /// a State. To continue execution, do something like:
+    ///
+    ///    auto [sub, state] = get(input);
+    ///    Activation::with(sub, context, [](Activation& act) {
+    ///       act.resume(std::move(state));
+    ///       ...
+    ///       act.execute();
+    ///    }
+    struct State {
+      uint64_t pc;
+      std::vector<uint64_t> locals;
+      std::vector<binary::Output> outputs;
+    };
+    static std::pair<Subroutine, State> get(binary::Input& in);
+
+    /// Set up the Activation from a previously serialized State
+    void resume(State s) {
+      restart(s.pc, s.locals.begin(), s.locals.end());
+      auto buf = s.outputs.begin();
+      for (auto& out : outputs()) {
+        out = std::move(*buf);
+        buf++;
+      }
+    }
+
+   private:
+    explicit Activation(const Subroutine& sub, void* context)
+        : sub(sub), context(context) {
+      for (auto& output : outputs()) {
+        new (&output) binary::Output;
+      }
+    }
+
+    ~Activation() noexcept {
+      for (auto& output : outputs()) {
+        output.binary::Output::~Output();
+      }
+    }
+
+    /// We place the outputs and then the frame right after the Activation
+    /// object.
+    static size_t byteSize(const Subroutine& sub) {
+      return sizeof(Activation) + sub.outputs * sizeof(binary::Output) +
+          sub.frameSize() * sizeof(uint64_t);
+    }
+
+    uint64_t* frame() {
+      return reinterpret_cast<uint64_t*>(outputs().end());
+    }
+
+    const uint64_t* frame() const {
+      return const_cast<Activation*>(this)->frame();
+    }
+
+    const Subroutine& sub;
+    void* context;
+
+    // null if the activation has finished executing
+    const uint64_t* FOLLY_NULLABLE pc;
+  };
+
+  bool operator==(const Subroutine& other) const;
+  bool operator!=(const Subroutine& other) const {
+    return !(*this == other);
+  }
+
+  /// Return the size of this bytecode routine in bytes, including the
+  /// code, literals and constants.
+  size_t size() const;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/bytecode/syscall.h b/glean/rts/bytecode/syscall.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/bytecode/syscall.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+#include "glean/rts/id.h"
+#include "glean/rts/set.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// Type of functions which can be called from bytecode
+using SysFun = void (*)(
+    void* context,
+    uint64_t* frame,
+    const uint64_t* regs,
+    uint64_t nregs);
+
+/// A typed bytecode register which can be read from and written to
+template <typename T>
+struct Reg {
+  uint64_t* ptr;
+
+  explicit Reg(uint64_t* ptr = nullptr) : ptr(ptr) {}
+
+  T get() const {
+    T x;
+    fromWord(x, *ptr);
+    return x;
+  }
+
+  T operator*() const {
+    return get();
+  }
+
+  void set(T x) {
+    *ptr = toWord(x);
+  }
+
+  // This is ugly but not having an operator for this is uglier.
+  void operator<<(T x) {
+    set(x);
+  }
+
+ private:
+  // Marshalling values from bytecode registers to C++ values and back
+
+  // Everything that is implicitly convertible to and from uint64_t
+  template <typename U>
+  static std::enable_if_t<std::is_convertible_v<uint64_t, U>, void> fromWord(
+      U& x,
+      uint64_t w) {
+    x = w;
+  }
+
+  template <typename U>
+  static std::enable_if_t<std::is_convertible_v<U, uint64_t>, uint64_t> toWord(
+      U x) {
+    return x;
+  }
+
+  // Id and Pid
+  template <typename Tag>
+  static void fromWord(WordId<Tag>& x, uint64_t w) {
+    x = WordId<Tag>::fromWord(w);
+  }
+
+  template <typename Tag>
+  static uint64_t toWord(WordId<Tag> x) {
+    return x.toWord();
+  }
+
+  // data pointers
+  static void fromWord(const unsigned char*& x, uint64_t w) {
+    x = reinterpret_cast<const unsigned char*>(w);
+  }
+
+  static uint64_t toWord(const unsigned char* x) {
+    return reinterpret_cast<uint64_t>(x);
+  }
+
+  // Outputs
+  static void fromWord(binary::Output*& x, uint64_t w) {
+    x = reinterpret_cast<binary::Output*>(w);
+  }
+
+  static void fromWord(const binary::Output*& x, uint64_t w) {
+    x = reinterpret_cast<binary::Output*>(w);
+  }
+
+  static uint64_t toWord(binary::Output* x) {
+    return reinterpret_cast<uint64_t>(x);
+  }
+
+  static uint64_t toWord(const binary::Output* x) {
+    return reinterpret_cast<uint64_t>(x);
+  }
+
+  // SysFun
+  static void fromWord(SysFun& x, uint64_t w) {
+    x = reinterpret_cast<SysFun>(w);
+  }
+
+  static uint64_t toWord(SysFun x) {
+    return reinterpret_cast<uint64_t>(x);
+  }
+
+  // Sets
+  static void fromWord(BytestringSet*& x, uint64_t w) {
+    x = reinterpret_cast<BytestringSet*>(w);
+  }
+
+  static void fromWord(const BytestringSet*& x, uint64_t w) {
+    x = reinterpret_cast<const BytestringSet*>(w);
+  }
+};
+
+template <typename T>
+inline std::ostream& operator<<(std::ostream& os, const Reg<T>& reg) {
+  return (os << reg.get());
+}
+
+/// Arguments to syscalls.
+///
+/// The primary template handles inputs which are passed by value
+template <typename T>
+struct SysArg {
+  using type = T;
+  static T arg(uint64_t* ptr) {
+    return Reg<T>(ptr).get();
+  }
+};
+
+// Outputs, i.e., registers which can be written to
+template <typename T>
+struct SysArg<Reg<T>> {
+  using type = Reg<T>;
+  static Reg<T> arg(uint64_t* ptr) {
+    return Reg<T>(ptr);
+  }
+};
+
+/// Typed wrapper over a function which can be invoked from bytecode
+template <typename... Args>
+struct SysCall {
+  static constexpr size_t arity = sizeof...(Args);
+};
+
+/// Utility class for constructing 'SysCall's from an object and a method.
+template <typename C, auto F, typename R, typename... Args>
+struct SysHandlerMethod {
+  using syscall_t = std::conditional_t<
+      std::is_void_v<R>,
+      SysCall<Args...>,
+      SysCall<Args..., Reg<R>>>;
+
+  static void
+  call(void* context, uint64_t* frame, const uint64_t* regs, uint64_t nregs) {
+    assert(nregs == syscall_t::arity);
+
+    // Here, we invoke `f` with the marshalled arguments and if it returns a
+    // result, marshal it back. These are the steps.
+    //
+    //   * Build an `std::tuple` of all arguments to `F`, i.e., a pointer to the
+    //     context and all the marshalled args. We do via a tuple mostly because
+    //     we need to know the index for each arg and this seems easiest.
+    //
+    //   * Use 'std::apply' to apply `F` to the arg tuple.
+    //
+    //   * If `F` isn't void, stored its result in the result register.
+
+    // Brace initialisation guarantees that individual components are
+    // evaluated from left to right (as opposed to function arguments)
+    // - meaning that the multiple increments of `regs` are well defined.
+    std::tuple<C&, Args...> args{
+        *static_cast<std::remove_reference_t<C>*>(context),
+        SysArg<Args>::arg(&frame[*regs++])...};
+
+    if constexpr (std::is_void_v<R>) {
+      std::apply(F, args);
+    } else {
+      Reg<R>(&frame[*regs]).set(std::apply(F, args));
+    }
+  }
+};
+
+template <typename C, auto F>
+struct SysHandler;
+
+template <
+    typename C,
+    typename D,
+    typename R,
+    typename... Args,
+    R (D::*F)(Args...)>
+struct SysHandler<C, F> : SysHandlerMethod<C, F, R, Args...> {};
+
+template <
+    typename C,
+    typename D,
+    typename R,
+    typename... Args,
+    R (D::*F)(Args...) const>
+struct SysHandler<C, F> : SysHandlerMethod<C, F, R, Args...> {};
+
+/// A collection of system call handlers
+template <typename Context, typename... Handlers>
+class SysCalls {
+ public:
+  SysCalls(Context&& context, const uint64_t* handlers)
+      : context(std::forward<Context>(context)), handlers(handlers) {}
+
+  void* contextptr() const {
+    return const_cast<void*>(static_cast<const void*>(&context));
+  }
+
+  const uint64_t* handlers_begin() const {
+    return handlers;
+  }
+
+  const uint64_t* handlers_end() const {
+    return handlers + sizeof...(Handlers);
+  }
+
+ private:
+  Context context;
+  const uint64_t* handlers;
+};
+
+/// Construct a 'SysCall' from an object and a method. The object can be passed
+/// either by value/move reference (in which case it is captured in the
+/// 'SysCall' object) or by reference (in which case it must be alive when the
+/// 'SysCall' is invoked).
+template <auto... Calls, typename Context>
+SysCalls<Context, typename SysHandler<Context, Calls>::syscall_t...> syscalls(
+    Context&& context) {
+  // Note that this is static so we don't reconstruct it on each call.
+  static const uint64_t handlers[sizeof...(Calls)] = {
+      reinterpret_cast<uint64_t>(&SysHandler<Context, Calls>::call)...};
+  return SysCalls<Context, typename SysHandler<Context, Calls>::syscall_t...>(
+      std::forward<Context>(context), handlers);
+}
+
+/// Construct a 'SysCall' from a functional object. The object can be passed
+/// either by value/move reference (in which case it is captured in the
+/// 'SysCall' object) or by reference (in which case it must be alive when the
+/// 'SysCall' is invoked).
+template <typename Context>
+auto syscall(Context&& context) {
+  return syscalls<&std::remove_reference_t<Context>::operator()>(
+      std::forward<Context>(context));
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/cache.cpp b/glean/rts/cache.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/cache.cpp
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/cache.h"
+
+#include <folly/concurrency/CacheLocality.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+std::vector<uint64_t> LookupCache::Stats::read() {
+  std::vector<uint64_t> buffer(COUNT);
+  for (size_t i = 0; i < COUNT; ++i) {
+    buffer[i] = values[i].readFull();
+  }
+  return buffer;
+}
+
+std::vector<uint64_t> LookupCache::Stats::readAndResetCounters() {
+  std::vector<uint64_t> buffer(COUNT);
+  for (size_t i = 0; i < FIRST_NON_COUNTER; ++i) {
+    buffer[i] = values[i].readFullAndReset();
+  }
+  for (size_t i = FIRST_NON_COUNTER; i < COUNT; ++i) {
+    buffer[i] = values[i].readFull();
+  }
+  return buffer;
+}
+
+LookupCache::Storage::~Storage() {
+  facts.erase_and_dispose(facts.begin(), facts.end(), Fact::destroy);
+}
+
+const Fact* LookupCache::Storage::push_back(Fact::unique_ptr fact) {
+  facts.push_back(*fact);
+  bytes += fact->size();
+  ++count;
+  return fact.release();
+}
+
+Fact::unique_ptr LookupCache::Storage::release(const Fact* fact) {
+  assert(bytes >= fact->size());
+  assert(count > 0);
+  bytes -= fact->size();
+  --count;
+  facts.erase(facts.iterator_to(*fact));
+  return Fact::unique_ptr(const_cast<Fact*>(fact));
+}
+
+void LookupCache::Storage::splice_to(
+    Fact::intrusive_list& list,
+    Fact::intrusive_list::iterator pos,
+    LookupCache::Storage::Range range) {
+  assert(bytes >= range.bytes);
+  assert(count >= range.count);
+  list.splice(pos, facts, range.start, range.pos);
+  bytes -= range.bytes;
+  count -= range.count;
+}
+
+void LookupCache::Storage::touch(const Fact* fact) {
+  facts.erase(facts.iterator_to(*fact));
+  facts.push_back(const_cast<Fact&>(*fact));
+}
+
+namespace {
+
+/// We use the tag field of Fact to indicate how much data the fact has.
+enum Tag : unsigned int {
+  TYPE = 0, // type only (not key or value)
+  KEY = 1, // type and key only (not value)
+  FULL = 2 // everything
+};
+
+} // namespace
+
+LookupCache::LookupCache(
+    const Options& opts,
+    std::shared_ptr<LookupCache::Stats> s)
+    : options(opts), touched(opts.shards), stats(std::move(s)) {
+  for (auto& t : touched) {
+    t.facts = std::make_unique<std::atomic<const Fact*>[]>(
+        options.touched_buffer_size);
+  }
+}
+
+LookupCache::~LookupCache() {
+  if (stats) {
+    storage.withLock([&](auto& wstorage) {
+      stats->values[Stats::factBytes] -= wstorage.factBytes();
+      stats->values[Stats::factCount] -= wstorage.factCount();
+    });
+  }
+}
+
+void LookupCache::clear() {
+  storage.withLock([&](const auto& rstorage) {
+    // NOTE: we don't seem to be able to this in the destructor because
+    // something in ThreadCachedInt triggers ASAN
+    stats->values[Stats::factBytes] -= rstorage.factBytes();
+    stats->values[Stats::factCount] -= rstorage.factCount();
+    // TODO
+    // *this = LookupCache(base, capacity, stats);
+  });
+}
+
+Id LookupCache::Anchor::idByKey(Pid type, folly::ByteRange key) {
+  const auto cached = cache->index.withRLockPtr([&](auto rindex) {
+    const auto i = rindex->keys.find(FactByKey::value_type{type, key});
+    if (i != rindex->keys.end()) {
+      const auto fact = *i;
+      const auto id = fact->id();
+      if (replacementPolicy == ReplacementPolicy::LRU) {
+        cache->touch(std::move(rindex), fact);
+      }
+      return id;
+    } else {
+      return Id::invalid();
+    }
+  });
+
+  if (cached) {
+    ++cache->stats->values[Stats::idByKey_hits];
+    return cached;
+  }
+
+  if (const auto id = base->idByKey(type, key)) {
+    ++cache->stats->values[Stats::idByKey_misses];
+    cache->insert(Fact::create({id, type, Fact::Clause::fromKey(key)}, KEY));
+    return id;
+  } else {
+    ++cache->stats->values[Stats::idByKey_failures];
+    return Id::invalid();
+  }
+}
+
+Pid LookupCache::Anchor::typeById(Id id) {
+  const auto cached = cache->index.withRLockPtr([&](auto rindex) {
+    const auto i = rindex->ids.find(id);
+    if (i != rindex->ids.end()) {
+      const auto fact = *i;
+      const auto ty = fact->type();
+      if (replacementPolicy == ReplacementPolicy::LRU) {
+        cache->touch(std::move(rindex), fact);
+      }
+      return ty;
+    } else {
+      return Pid::invalid();
+    }
+  });
+
+  if (cached) {
+    ++cache->stats->values[Stats::typeById_hits];
+    return cached;
+  } else if (auto type = base->typeById(id)) {
+    ++cache->stats->values[Stats::typeById_misses];
+    cache->insert(Fact::create({id, type, {}}, TYPE));
+    return type;
+  } else {
+    ++cache->stats->values[Stats::typeById_failures];
+    return Pid::invalid();
+  }
+}
+
+bool LookupCache::Anchor::factById(
+    Id id,
+    std::function<void(Pid, Fact::Clause)> f) {
+  const auto cached = cache->index.withRLockPtr([&](auto rindex) {
+    const auto i = rindex->ids.find(id);
+    if (i != rindex->ids.end() && (*i)->tag() == FULL) {
+      const auto fact = *i;
+      // It is imporant to call f after we (i.e., touch) have released the read
+      // lock (since f might use the cache). However, fact needs to exist until
+      // after we've called f. Grabbing a read lock for delete_lock makes sure
+      // no facts will be deleted until we're done.
+      //
+      // We might consider finer-grained locking if this becomes an issue.
+      std::shared_lock dont_delete(rindex->delete_lock);
+      if (replacementPolicy == ReplacementPolicy::LRU) {
+        cache->touch(std::move(rindex), fact);
+      } else {
+        rindex.unlock();
+      }
+      f(fact->type(), fact->clause());
+      return true;
+    } else {
+      return false;
+    }
+  });
+
+  if (cached) {
+    ++cache->stats->values[Stats::factById_hits];
+    return true;
+  }
+
+  Fact::unique_ptr fact;
+  base->factById(id, [&](auto type, auto clause) {
+    fact = Fact::create({id, type, clause}, FULL);
+  });
+  if (fact) {
+    ++cache->stats->values[Stats::factById_misses];
+    f(fact->type(), fact->clause());
+    // FIXME: probably do this before f
+    cache->insert(std::move(fact));
+    return true;
+  } else {
+    ++cache->stats->values[Stats::factById_failures];
+    return false;
+  }
+}
+
+std::unique_ptr<FactIterator> LookupCache::Anchor::enumerate(Id from, Id upto) {
+  return base->enumerate(from, upto);
+}
+
+std::unique_ptr<FactIterator> LookupCache::Anchor::enumerateBack(
+    Id from,
+    Id downto) {
+  return base->enumerateBack(from, downto);
+}
+
+std::unique_ptr<FactIterator> LookupCache::Anchor::seek(
+    Pid type,
+    folly::ByteRange start,
+    size_t prefix_size) {
+  return base->seek(type, start, prefix_size);
+}
+
+std::unique_ptr<FactIterator> LookupCache::Anchor::seekWithinSection(
+    Pid type,
+    folly::ByteRange start,
+    size_t prefix_size,
+    Id from,
+    Id to) {
+  return base->seekWithinSection(type, start, prefix_size, from, to);
+}
+
+void LookupCache::insert(Fact::unique_ptr owned) {
+  std::unique_lock<folly::SharedMutex> delete_write;
+  Fact::intrusive_list dead;
+  performUpdate([&](Index& index, Storage& storage) {
+    insertOne(index, storage, std::move(owned), dead);
+    if (!dead.empty()) {
+      delete_write = std::unique_lock(index.delete_lock);
+    }
+  });
+  // Perform the actual deletions after we've released all locks on the index
+  // and storage.
+  if (!dead.empty()) {
+    dead.erase_and_dispose(dead.begin(), dead.end(), Fact::destroy);
+  }
+}
+
+void LookupCache::insertOne(
+    Index& index,
+    Storage& storage,
+    Fact::unique_ptr owned,
+    Fact::intrusive_list& dead) {
+  const auto size = owned->size();
+
+  if (size > options.capacity) {
+    return;
+  }
+
+  // check if we already have a fact with this id in the cache
+  const Fact* existing = nullptr;
+  {
+    auto o = index.ids.find(owned->id());
+    if (o != index.ids.end()) {
+      existing = *o;
+    }
+  }
+
+  if (existing && existing->tag() >= owned->tag()) {
+    // the cached fact has same or more data than we are trying to insert
+    return;
+  }
+
+  if (existing || storage.factBytes() + size > options.capacity) {
+    // Do deferred LRU operations if we're going to evict or replace. We need
+    // to do this even when replacing because the hit buffers might reference
+    // the fact we're going to delete.
+    //
+    // NOTE: drain is "lossy" but in this case, we're running under a
+    // write lock for the index so there will be no concurrent drainers
+    // and we'll have had a memory barrier before - so drain isn't
+    // actually lossy here.
+    //
+    // This doesn't preserve LRU order as we process shards one by one,
+    // i.e., hits within one shard a processes in chronological order
+    // but we lose ordering across shards. It possible to fix this at the cost
+    // of some performance but probably not worth doing.
+    for (auto& t : touched) {
+      drain(storage, t);
+    }
+
+    if (existing) {
+      if (owned->tag() == KEY) {
+        ++stats->values[Stats::idByKey_deletes];
+      } else {
+        ++stats->values[Stats::factById_deletes];
+      }
+      deleteFromIndex(index, existing);
+      // TODO: defer this, see comments in evict
+      auto fact = storage.release(existing);
+      dead.push_back(*fact);
+      // dead assumed ownership of the fact
+      (void)fact.release();
+    }
+
+    if (storage.factBytes() + size > options.capacity) {
+      // shrink cache to ~90% of capacity
+      const auto wanted =
+          options.capacity * 0.9 > size ? options.capacity * 0.9 - size : 0;
+      evict(index, storage, wanted, dead);
+    }
+  }
+
+  const auto fact = storage.push_back(std::move(owned));
+
+  // For 'insert' (but not 'BulkStorage') we could unlock the storage here. It
+  // doesn't matter, though, since nothing will really use it without getting a
+  // lock for index first.
+
+  index.ids.insert(fact);
+  if (fact->tag() != TYPE) {
+    index.keys.insert(fact);
+  }
+}
+
+void LookupCache::deleteFromIndex(Index& index, const Fact* fact) {
+  index.ids.erase(fact);
+  if (fact->tag() > TYPE) {
+    index.keys.erase(fact);
+  }
+}
+
+void LookupCache::evict(
+    LookupCache::Index& index,
+    LookupCache::Storage& storage,
+    size_t target,
+    Fact::intrusive_list& dead) {
+  auto range = storage.start();
+  while (storage.factBytes() - range.factBytes() > target && !range.empty()) {
+    deleteFromIndex(index, range.next());
+  }
+  storage.splice_to(dead, dead.end(), range);
+}
+
+void LookupCache::touch(
+    LookupCache::SyncIndex::RLockedPtr rindex,
+    const Fact* fact) {
+  if (options.shards > 0) {
+    auto& t = touched[folly::AccessSpreader<>::cachedCurrent(options.shards)];
+
+    // This is intentionally very lossy
+    auto k = t.next.load(std::memory_order_acquire);
+    if (k < options.touched_buffer_size) {
+      // yes, we might overwrite a previous store
+      t.facts[k].store(fact, std::memory_order_release);
+      // yes, there might have been other stores here in the meantime
+      t.next.store(k + 1, std::memory_order_release);
+    } else {
+      rindex.unlock();
+      if (auto wstorage = storage.tryLock()) {
+        // Only drain our shard - as in 'insert', this loses LRU ordering across
+        // shards.
+        drain(*wstorage, t);
+      }
+    }
+  } else {
+    storage.withLock([&](auto& wstorage) { wstorage.touch(fact); });
+  }
+}
+
+void LookupCache::drain(Storage& storage, Touched& t) {
+  // There might be calls to touch (but not to drain!) running concurrently to
+  // this. It's ok to lose those. The only invariant we rely on is that the
+  // Touched buffer has been filled up to n.
+  const auto n = t.next.load(std::memory_order_acquire);
+  for (size_t i = 0; i < n; ++i) {
+    storage.touch(t.facts[i].load(std::memory_order_acquire));
+  }
+  // yes, we might lose recorded hits here
+  t.next.store(0, std::memory_order_release);
+}
+
+void LookupCache::Inserter::insert(Fact::Ref fact) {
+  Fact::intrusive_list dead;
+  cache.insertOne(index, storage, Fact::create(fact, FULL), dead);
+  if (!dead.empty()) {
+    std::unique_lock delete_write(index.delete_lock);
+    dead.erase_and_dispose(dead.begin(), dead.end(), Fact::destroy);
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/cache.h b/glean/rts/cache.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/cache.h
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/SharedMutex.h>
+#include <folly/Synchronized.h>
+#include <folly/ThreadCachedInt.h>
+#include <vector>
+
+#include "glean/rts/factset.h"
+#include "glean/rts/lookup.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// An LRU fact cache for speeding up point lookups (and only those) during
+/// writes. It only loads as much data as has been requested by the client which
+/// means that for any given fact, it can store either only its type (via
+/// typeById), its type and key (via idByKey) or everything (via factById).
+///
+/// The cache itself doesn't implement Lookup. To actually look things up, it
+/// must be pair with a base Lookup via 'anchor'. This allows the cache to not
+/// be tied to the lifetime of one specific Lookup instance. It is the user's
+/// responsibility that the Lookups it is paired with are morally the same
+/// throughout its lifetime (such as the same database opened multiple times).
+///
+/// The cache can be used concurrently by multiple threads and is supposed to
+/// scale at least a little bit for hits. The hash maps are guarded by
+/// a read-write, write-priority lock and the LRU list by a mutex. Crucially,
+/// we don't update the LRU list on every access. Rather, we record all
+/// accesses in append-only, lossy buffers sharded by threads (cf. the Touched
+/// structure below). These get drained (in a not-really-LRU order) when we
+/// need to evict or when they become full. This (hopefully) minimises
+/// contention for read-only accesses. This is quite similar to what, e.g.,
+/// Java's Caffeine library does.
+///
+/// TODO: Switch to a variant of the Clock algorithm or something similar which
+///       lets us avoid a doubly linked list (which costs 2 pointers per fact).
+/// TODO: We probably want to remove facts which haven't been used for some time
+///       even if the cache isn't full.
+/// TODO: Say we cache the result of idByKey but then only ever do typeById
+///       afterwards. This will keep the cache entry alive and we will never
+///       get rid of the key even though it's not needed. We'll see how much
+///       of a problem this is.
+/// TODO: We want to share one capacity between all db caches.
+struct LookupCache {
+ public:
+  // A Stats object can be shared between different caches which will accumulate
+  // their statistics into it.
+  //
+  // xxx_hits = cache hits by lookup function xxx
+  // xxx_misses = true misses (i.e., fact isn't cached but exists in the Lookup)
+  // xxx_failures = fact doesn't exist in the Lookup
+  // xxx_deletes = fact existed in the cache but had too little information
+  //               (e.g., only the type but xxx also needed the key)
+  //
+  // NOTE: This must be kept in sync with the Counter type in
+  // Glean.RTS.Foreign.LookupCache
+  struct Stats {
+    enum Stat : size_t {
+      FIRST_COUNTER,
+
+      idByKey_hits = FIRST_COUNTER,
+      idByKey_misses,
+      idByKey_failures,
+      idByKey_deletes,
+      typeById_hits,
+      typeById_misses,
+      typeById_failures,
+      factById_hits,
+      factById_misses,
+      factById_failures,
+      factById_deletes,
+
+      FIRST_NON_COUNTER,
+
+      factBytes = FIRST_NON_COUNTER,
+      factCount,
+
+      COUNT
+    };
+
+    folly::ThreadCachedInt<uint64_t> values[COUNT];
+
+    /// Obtain an approximate snapshot of the values in 'Stats'.
+    std::vector<uint64_t> read();
+
+    /// Obtain an approximate snapshot of the values in 'Stats' and reset all
+    /// counters to 0 (but not sums like total cache size).
+    std::vector<uint64_t> readAndResetCounters();
+  };
+
+  struct Options {
+    /// Max capacity
+    size_t capacity;
+
+    /// Number of shards for Touched buffer - should typically be number of
+    /// threads.
+    size_t shards = std::thread::hardware_concurrency();
+
+    /// How many hits to record locally before draining them to global buffer.
+    size_t touched_buffer_size = 64 * 1024;
+  };
+
+  LookupCache(const Options& opts, std::shared_ptr<Stats> s);
+
+  LookupCache(const LookupCache&) = delete;
+  LookupCache(LookupCache&&) = delete;
+  LookupCache& operator=(const LookupCache&) = delete;
+  LookupCache& operator=(LookupCache&&) = delete;
+
+  // Clear statistics
+  void clear();
+
+  // LookupCache paired with a base Lookup for looking up facts
+  struct Anchor : Lookup {
+    enum class ReplacementPolicy {
+      LRU, // evict least-recently-used entries
+      FIFO // evict the oldest entries. Faster with many concurrent clients.
+    };
+    Anchor(
+        Lookup* b,
+        LookupCache* c,
+        ReplacementPolicy replacementPolicy = ReplacementPolicy::LRU)
+        : base(b), cache(c), replacementPolicy(replacementPolicy) {}
+
+    Id idByKey(Pid type, folly::ByteRange key) override;
+    Pid typeById(Id id) override;
+    bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) override;
+
+    virtual Id startingId() const override {
+      return base->startingId();
+    }
+    virtual Id firstFreeId() const override {
+      return base->firstFreeId();
+    }
+
+    std::unique_ptr<FactIterator> enumerate(Id from, Id upto) override;
+    std::unique_ptr<FactIterator> enumerateBack(Id from, Id downto) override;
+
+    Interval count(Pid pid) const override {
+      return base->count(pid);
+    }
+
+    std::unique_ptr<FactIterator>
+    seek(Pid type, folly::ByteRange start, size_t prefix_size) override;
+
+    std::unique_ptr<FactIterator> seekWithinSection(
+        Pid type,
+        folly::ByteRange start,
+        size_t prefix_size,
+        Id from,
+        Id to) override;
+
+    UsetId getOwner(Id id) override {
+      return base->getOwner(id);
+    }
+
+    Lookup* base;
+    LookupCache* cache;
+    const ReplacementPolicy replacementPolicy;
+  };
+
+  friend struct Anchor;
+
+  Anchor anchor(
+      Lookup* base,
+      Anchor::ReplacementPolicy replacementPolicy =
+          Anchor::ReplacementPolicy::LRU) {
+    return Anchor(base, this, replacementPolicy);
+  }
+
+  // Execute a bulk loading function which takes a 'Store&' argument. The cache
+  // will be locked during the execution so any lookups will cause a deadlock.
+  template <typename F>
+  inline void withBulkStore(F&& f) {
+    performUpdate([&](auto& windex, auto& wstorage) {
+      Inserter inserter(*this, windex, wstorage);
+      f(static_cast<Store&>(inserter));
+    });
+  }
+
+  ~LookupCache();
+
+ private:
+  Options options;
+
+  struct Index {
+    FastSetBy<const Fact*, FactById> ids; // id -> fact
+    FastSetBy<const Fact*, FactByKey> keys; // (type,key) -> fact
+
+    // Only delete (as in free) facts while holding this lock exclusively. By
+    // construction, it can only be acquired when holding a lock for the Index.
+    mutable folly::SharedMutex delete_lock;
+  };
+  using SyncIndex = folly::Synchronized<Index, folly::SharedMutex>;
+  SyncIndex index; // index guarded by r/w lock
+
+  class Storage {
+   public:
+    Storage() {}
+    Storage(Storage&&) = default;
+    Storage(const Storage&) = delete;
+    Storage& operator=(Storage&&) = default;
+    Storage& operator=(const Storage&) = delete;
+    ~Storage();
+
+    using iterator = Fact::intrusive_list::iterator;
+
+    iterator begin() {
+      return facts.begin();
+    }
+    iterator end() {
+      return facts.end();
+    }
+
+    size_t factBytes() const {
+      return bytes;
+    }
+    size_t factCount() const {
+      return count;
+    }
+
+    const Fact* push_back(Fact::unique_ptr fact);
+    Fact::unique_ptr release(const Fact* fact);
+    void touch(const Fact* fact);
+
+    class Range {
+     public:
+      const Fact* FOLLY_NULLABLE next() {
+        if (pos != finish) {
+          const auto fact = &*pos;
+          bytes += fact->size();
+          ++count;
+          ++pos;
+          return fact;
+        } else {
+          return nullptr;
+        }
+      }
+
+      bool empty() const {
+        return pos == finish;
+      }
+
+      size_t factBytes() const {
+        return bytes;
+      }
+      size_t factCount() const {
+        return count;
+      }
+
+     private:
+      Range(iterator s, iterator e)
+          : start(s), pos(s), finish(e), bytes(0), count(0) {}
+
+      friend class Storage;
+
+      iterator start;
+      iterator pos;
+      iterator finish;
+      size_t bytes;
+      size_t count;
+    };
+
+    Range start() {
+      return Range(begin(), end());
+    }
+
+    void splice_to(
+        Fact::intrusive_list& list,
+        Fact::intrusive_list::iterator pos,
+        Range range);
+
+   private:
+    Fact::intrusive_list facts;
+    size_t bytes = 0;
+    size_t count = 0;
+  };
+  using SyncStorage = folly::Synchronized<Storage, std::mutex>;
+  SyncStorage storage; // fact storage guarded by mutex
+
+  // NOTE: locking order is always Index then Storage, never the other way
+  // round.
+
+  // Container for recording cache hits. This is intentionally very lossy as it
+  // can be written to by multiple threads without synchronisation.
+  struct alignas(folly::hardware_destructive_interference_size) Touched {
+    // Make things atomic for the unlikely case we're ever going to be running
+    // on something other than x86_64.
+    std::unique_ptr<std::atomic<const Fact*>[]> facts;
+    std::atomic<size_t> next{0};
+  };
+  std::vector<Touched> touched; // cache hits sharded by thread
+
+  std::shared_ptr<Stats> stats; // statistics
+
+  // Execute a function which updates the cache and updates statistics.
+  template <typename F>
+  inline void performUpdate(F&& f) {
+    // We actually rely on wrap-around for underflow for these two. Initialise
+    // to make Infer happy.
+    uint64_t bytes_diff = 0;
+    uint64_t count_diff = 0;
+
+    index.withWLock([&](auto& windex) {
+      storage.withLock([&](auto& wstorage) {
+        const auto initial_bytes = wstorage.factBytes();
+        const auto initial_count = wstorage.factCount();
+        f(windex, wstorage);
+        bytes_diff = wstorage.factBytes() - initial_bytes;
+        count_diff = wstorage.factCount() - initial_count;
+      });
+    });
+
+    stats->values[Stats::factBytes] += bytes_diff;
+    stats->values[Stats::factCount] += count_diff;
+  }
+
+  // Insert a new fact into the cache.
+  void insert(Fact::unique_ptr);
+
+  // Insert a new fact into the locked cache and move all evicted facts into
+  // 'dead'.
+  void insertOne(
+      Index& index,
+      Storage& storage,
+      Fact::unique_ptr,
+      Fact::intrusive_list& dead);
+
+  // Delete a fact from the locked index but not from the storage
+  static void deleteFromIndex(Index& index, const Fact* fact);
+
+  // Record a hit on a particular fact. Note that the ownership of the read
+  // lock is passed to touch which will release it.
+  void touch(SyncIndex::RLockedPtr, const Fact*);
+
+  // Evict facts from the cache until we've freed up at least target bytes and
+  // move evicted facts into 'dead'.
+  static void evict(
+      Index& index,
+      Storage& storage,
+      size_t target,
+      Fact::intrusive_list& dead);
+
+  // Drain hits recorded in 'touched', updating the storage as necessary.
+  static void drain(Storage& storage, Touched& touched);
+
+  struct Inserter : Store {
+    LookupCache& cache;
+    Index& index;
+    Storage& storage;
+
+    Inserter(LookupCache& c, Index& i, Storage& s)
+        : cache(c), index(i), storage(s) {}
+
+    void insert(Fact::Ref fact) override;
+  };
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/define.cpp b/glean/rts/define.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/define.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/define.h"
+
+#include <folly/MapUtil.h>
+#include <folly/container/F14Map.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// Define all new facts in a Batch. The substition is used and updated
+/// with the new facts. The facts are typechecked based on the inventory.
+Substitution defineBatch(
+    Define& def,
+    const Inventory& inventory,
+    Id first,
+    const Id* FOLLY_NULLABLE ids, // nullptr if there are no named facts
+    size_t count,
+    folly::ByteRange batch,
+    bool trustRefs,
+    bool ignoreRedef) {
+  if (first < Id::lowest()) {
+    error("invalid base id {} in batch", first);
+  }
+
+  MutableSubstitution subst(first, count);
+
+  folly::F14FastMap<Id, Id, folly::Hash> idmap;
+
+  binary::Input input(batch);
+
+  Id max_ref;
+  auto rename = Predicate::Rename([&](Id id, Pid type) {
+    const auto real_id = subst.subst(folly::get_default(idmap, id, id));
+    // If this is a trusted batch, the previous run (deduplication) should
+    // have already performed the validation. Don't call typeById().
+    if (trustRefs) {
+      if (real_id > max_ref) {
+        max_ref = real_id;
+      }
+      return real_id;
+    }
+
+    auto real_type = def.typeById(real_id);
+    if (real_type == type) {
+      if (real_id > max_ref) {
+        max_ref = real_id;
+      }
+      return real_id;
+    } else {
+      auto pred = inventory.lookupPredicate(type);
+      CHECK_NOTNULL(pred);
+      if (!real_type) {
+        error(
+            "unknown fact {}, expecting a fact of predicate {}.{}",
+            id,
+            pred->name,
+            pred->version);
+      } else {
+        auto real_pred = inventory.lookupPredicate(real_type);
+        CHECK_NOTNULL(real_pred);
+        error(
+            "invalid reference to fact {}: expected {}.{}, got {}.{}",
+            id,
+            pred->name,
+            pred->version,
+            real_pred->name,
+            real_pred->version);
+      }
+    }
+  });
+
+  for (size_t i = 0; i < count; ++i) {
+    Pid ty;
+    Fact::Clause clause;
+    Fact::deserialize(input, ty, clause);
+
+    if (const auto* predicate = inventory.lookupPredicate(ty)) {
+      max_ref = Id::invalid();
+
+      binary::Output out;
+      uint64_t key_size;
+      predicate->typecheck(rename, clause, out, key_size);
+      const auto clause = Fact::Clause::from(out.bytes(), key_size);
+      auto id = def.define(ty, clause, max_ref);
+
+      if (!id) {
+        const auto real_id = def.idByKey(ty, clause.key());
+        if (ignoreRedef) {
+          id = real_id;
+        } else {
+          error(
+              "invalid fact redefinition of ${} : {}",
+              real_id,
+              predicate->name);
+        }
+      }
+
+      subst.setAt(i, id);
+
+      if (ids && ids[i]) {
+        idmap[ids[i]] = id;
+      }
+    } else {
+      error("invalid predicate id {}", ty);
+    }
+  }
+  return subst.freeze();
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/define.h b/glean/rts/define.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/define.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/inventory.h"
+#include "glean/rts/lookup.h"
+#include "glean/rts/substitution.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// A set of facts which new facts can be added to.
+struct Define : Lookup {
+  /// Add a fact to the set and return its id. This can be an existing id
+  /// if the fact is already in the set, a new id if it's a new fact and
+  /// Id::INVALID if the set contains a fact with the same type and key but a
+  /// different value.
+  ///
+  /// The optional 'max_ref' parameter contains the max fact id referenced by
+  /// the clause. This can be used for optimisations by some implementations.
+  /// Not setting it or setting it to Id::invalid() is always safe.
+  virtual Id
+  define(Pid type, Fact::Clause clause, Id max_ref = Id::invalid()) = 0;
+};
+
+/// Define all new facts in a batch, returning the resulting substitution. The
+/// facts are typechecked based on the inventory.
+Substitution defineBatch(
+    Define& define,
+    const Inventory& inventory,
+    Id first,
+    const Id* FOLLY_NULLABLE ids, // nullptr if there are no named facts
+    size_t count,
+    folly::ByteRange batch,
+    bool trustRefs = false,
+    bool ignoreRedef = false);
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/densemap.h b/glean/rts/densemap.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/densemap.h
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Optional.h>
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// A map from number-like keys to values with O(1) access but
+/// O(highest key - lowest key) space. This is a very basic implementation, it
+/// can be vastly improved.
+///
+/// The interesting operations are operator[] (which dynamically grows the map
+/// to cover a particular key) and merge.
+template <typename Key, typename Value>
+class DenseMap {
+ public:
+  using key_type = Key;
+  using mapped_type = Value;
+
+  DenseMap() {}
+
+  void swap(DenseMap& other) {
+    std::swap(start, other.start);
+    data.swap(other.data);
+  }
+
+  bool empty() const {
+    return count == 0;
+  }
+
+  size_t size() const {
+    return count;
+  }
+
+  key_type low_bound() const {
+    return start;
+  }
+
+  key_type high_bound() const {
+    return start + data.size();
+  }
+
+ private:
+  template <typename Val, typename Base>
+  struct Iter {
+    using value_type = std::pair<const key_type, Val>;
+    using reference = std::pair<const key_type, Val&>;
+    using difference_type = std::ptrdiff_t;
+    using iterator_category = std::forward_iterator_tag;
+
+    using base_iterator_type = Base;
+
+    Iter() {}
+    Iter(key_type k, base_iterator_type b, base_iterator_type end)
+        : key_(std::move(k)), base_(std::move(b)), end_(std::move(end)) {
+      // There is no need to advance to the first available key since we assume
+      // that the first and the last one in data are always available
+    }
+
+    Iter& operator++() {
+      do {
+        ++key_;
+        ++base_;
+      } while (base_ != end_ && !base_->hasValue());
+      return *this;
+    }
+
+    Iter operator++(int) {
+      auto tmp = *this;
+      ++*this;
+      return tmp;
+    }
+
+    reference operator*() const {
+      return {key_, base_->value()};
+    }
+
+    struct pointer {
+      const reference* operator->() const {
+        return &ref;
+      }
+      reference ref;
+    };
+
+    pointer operator->() const {
+      return pointer{{key_, base_->value()}};
+    }
+
+    bool operator==(const Iter& other) const {
+      return key_ == other.key_ && base_ == other.base_ && end_ == other.end_;
+    }
+
+    bool operator!=(const Iter& other) const {
+      return !(*this == other);
+    }
+
+    key_type key_;
+    base_iterator_type base_;
+    base_iterator_type end_;
+  };
+
+  using repr_type = std::vector<folly::Optional<mapped_type>>;
+
+ public:
+  using iterator = Iter<mapped_type, typename repr_type::iterator>;
+  using const_iterator =
+      Iter<const mapped_type, typename repr_type::const_iterator>;
+
+  const_iterator begin() const {
+    return const_iterator(start, data.begin(), data.end());
+  }
+
+  const_iterator end() const {
+    return const_iterator(start + data.size(), data.end(), data.end());
+  }
+
+  iterator begin() {
+    return iterator(start, data.begin(), data.end());
+  }
+
+  iterator end() {
+    return iterator(start + data.size(), data.end(), data.end());
+  }
+
+  // Reserve space to cover all keys from low up to but not including high
+  void reserve(key_type from, key_type upto) {
+    if (data.empty()) {
+      start = from;
+      data.resize(upto - from);
+    } else if (from < start) {
+      // Jump through some hoops to avoid requiring a copy constructor
+      const auto sz = std::max(upto, start + data.size()) - from;
+      repr_type xs;
+      xs.reserve(sz);
+      xs.resize(start - from);
+      xs.insert(
+          xs.end(),
+          std::make_move_iterator(data.begin()),
+          std::make_move_iterator(data.end()));
+      xs.resize(sz);
+      data = std::move(xs);
+      start = from;
+    } else if (upto - start > data.size()) {
+      data.resize(upto - start);
+    }
+  }
+
+  mapped_type& operator[](key_type key) {
+    reserve(key, key + 1);
+    const auto i = key - start;
+    if (!data[i].hasValue()) {
+      data[i] = mapped_type();
+      ++count;
+    }
+    return data[i].value();
+  }
+
+  folly::Optional<mapped_type> get(key_type key) const {
+    if (key >= start) {
+      const auto i = key - start;
+      if (i < data.size()) {
+        return data[i];
+      }
+    }
+    return folly::none;
+  }
+
+  mapped_type* FOLLY_NULLABLE lookup(key_type key) {
+    if (key >= start) {
+      const auto i = key - start;
+      if (i < data.size()) {
+        return data[i].get_pointer();
+      }
+    }
+    return nullptr;
+  }
+
+  const mapped_type* FOLLY_NULLABLE lookup(key_type key) const {
+    if (key >= start) {
+      const auto i = key - start;
+      if (i < data.size()) {
+        return data[i].get_pointer();
+      }
+    }
+    return nullptr;
+  }
+
+  /// Merge two maps using a combining function of type void(Value&, Value)
+  template <typename F>
+  void merge(DenseMap other, F&& f) {
+    if (!other.data.empty()) {
+      if (data.empty()) {
+        *this = std::move(other);
+      } else {
+        reserve(
+            std::min(start, other.start),
+            std::max(start + data.size(), other.start + other.data.size()));
+        auto i = data.begin() + (other.start - start);
+        for (auto&& x : other.data) {
+          if (x.hasValue()) {
+            if (i->hasValue()) {
+              f(i->value(), std::move(x.value()));
+            } else {
+              *i = std::move(x);
+              ++count;
+            }
+          }
+          ++i;
+        }
+      }
+    }
+  }
+
+  size_t allocatedMemory() const noexcept {
+    return data.capacity() * sizeof(data[0]);
+  }
+
+ private:
+  // invariants:
+  //
+  // !empty() => data.front.hasValue()
+  // !empty() => data.back.hasValue()
+  key_type start;
+  repr_type data;
+  size_t count = 0;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/error.cpp b/glean/rts/error.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/error.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/error.h"
+
+#include <sstream>
+#include <vector>
+
+#ifndef UNW_LOCAL_ONLY
+#define UNW_LOCAL_ONLY
+#endif
+#include <folly/Demangle.h>
+#include <libunwind.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+[[noreturn]] void raiseError(const std::string& msg) {
+  // NOTE: we can't use folly::symbolizer here, see T40546255
+  std::ostringstream out;
+  out << msg;
+
+  std::vector<char> buffer(256);
+  unw_context_t context;
+  unw_cursor_t cursor;
+  if (unw_getcontext(&context) == 0 && unw_init_local(&cursor, &context) == 0) {
+    size_t n = 0;
+
+    out << "\nStack trace:\n";
+
+    do {
+      unw_word_t dummy;
+      if (unw_get_proc_name(&cursor, buffer.data(), buffer.size(), &dummy) !=
+          0) {
+        break;
+      }
+      out << "  " << folly::demangle(buffer.data()) << '\n';
+      ++n;
+    } while (n < 10 && unw_step(&cursor) > 0);
+    if (n == 10) {
+      out << "  ...";
+    }
+  } else {
+    out << "\nStack trace unavailable";
+  }
+
+  throw std::runtime_error(out.str());
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/error.h b/glean/rts/error.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/error.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Format.h>
+#include <string>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+[[noreturn]] void raiseError(const std::string& msg);
+
+template <class... Args>
+[[noreturn]]
+inline std::string error(folly::StringPiece fmt, Args&&... args) {
+  raiseError(folly::sformat(fmt, std::forward<Args>(args)...));
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/fact.cpp b/glean/rts/fact.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/fact.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/fact.h"
+
+#include <folly/String.h>
+#include <sstream>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+void Fact::serialize(binary::Output& output, Pid type, Fact::Clause clause) {
+  output.packed(type);
+  output.packed(clause.key_size);
+  output.packed(clause.value_size);
+  output.put(clause.bytes());
+}
+
+void Fact::deserialize(binary::Input& input, Pid& type, Fact::Clause& clause) {
+  type = input.packed<Pid>();
+  const auto key_size = input.packed<uint32_t>();
+  const auto value_size = input.packed<uint32_t>();
+  const auto data = input.bytes(key_size + value_size).data();
+  clause = {data, key_size, value_size};
+}
+
+std::string Fact::dump() const {
+  std::ostringstream os;
+
+  auto bytes = [](std::ostream& os, folly::ByteRange bs) {
+    if (std::all_of(
+            bs.begin(), bs.end(), [](auto c) { return c >= 32 && c < 127; })) {
+      os << '"' << std::string(bs.begin(), bs.end()) << '"';
+    } else {
+      os << folly::hexlify(bs);
+    }
+  };
+
+  os << '{' << id().toWord() << "} {" << type().toWord() << "} ";
+  bytes(os, key());
+  os << ' ';
+  bytes(os, value());
+
+  return os.str();
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/fact.h b/glean/rts/fact.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/fact.h
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+#include "glean/rts/id.h"
+
+#include <boost/intrusive/list.hpp>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/**
+ * A Glean fact
+ *
+ * Facts use a compact memory layout: a fact occupies one memory block where
+ * statically sized data (class Fact) is followed by the key and the value:
+ *
+ *   +------+-----+-------+
+ *   | Fact | key | value |
+ *   +------+-----+-------+
+ *
+ */
+class Fact {
+ public:
+  static constexpr uint32_t MAX_KEY_SIZE = 0xFFFFFFF;
+
+  struct Clause {
+    const unsigned char* data = nullptr;
+    uint32_t key_size = 0;
+    uint32_t value_size = 0;
+
+    folly::ByteRange key() const {
+      return {data, key_size};
+    }
+
+    folly::ByteRange value() const {
+      return {data + key_size, value_size};
+    }
+
+    size_t size() const {
+      return key_size + value_size;
+    }
+
+    folly::ByteRange bytes() const {
+      return {data, size()};
+    }
+
+    static Clause from(folly::ByteRange bytes, size_t key_size) {
+      assert(key_size <= MAX_KEY_SIZE);
+      const size_t value_size = bytes.size() - key_size;
+      assert(value_size <= 0xFFFFFFFF);
+      return {
+          bytes.data(),
+          static_cast<uint32_t>(key_size),
+          static_cast<uint32_t>(value_size)};
+    }
+
+    static Clause fromKey(folly::ByteRange bytes) {
+      const size_t key_size = bytes.size();
+      assert(key_size <= MAX_KEY_SIZE);
+      return {bytes.data(), static_cast<uint32_t>(key_size), 0};
+    }
+  };
+
+  static void serialize(binary::Output& output, Pid type, Clause clause);
+
+  struct Ref {
+    Id id = Id::invalid();
+    Pid type = Pid::invalid();
+    Clause clause;
+
+    static Ref invalid() {
+      return {};
+    }
+
+    explicit operator bool() const {
+      return bool(id);
+    }
+
+    folly::ByteRange key() const {
+      return clause.key();
+    }
+
+    folly::ByteRange value() const {
+      return clause.value();
+    }
+
+    void serialize(binary::Output& output) const {
+      Fact::serialize(output, type, clause);
+    }
+  };
+
+  Id id() const {
+    return id_;
+  }
+
+  Pid type() const {
+    return type_;
+  }
+
+  Clause clause() const {
+    return {
+        reinterpret_cast<const unsigned char*>(this + 1), key_size, value_size};
+  }
+
+  Ref ref() const {
+    return Ref{id(), type(), clause()};
+  }
+
+  folly::ByteRange key() const {
+    return clause().key();
+  }
+
+  folly::ByteRange value() const {
+    return clause().value();
+  }
+
+  unsigned int tag() const {
+    return tag_;
+  }
+
+  bool operator==(const Fact& other) const {
+    return id_ == other.id_ && type_ == other.type_ &&
+        key_size == other.key_size && value_size == other.value_size &&
+        key() == other.key() && value() == other.value() &&
+        tag() == other.tag();
+  }
+
+  bool operator!=(const Fact& other) const {
+    return !(*this == other);
+  }
+
+  static size_t size(size_t key_size, size_t value_size) {
+    return sizeof(Fact) + key_size + value_size;
+  }
+
+  size_t size() const {
+    return size(key_size, value_size);
+  }
+
+  void serialize(binary::Output& output) const {
+    serialize(output, type(), clause());
+  }
+
+  static void deserialize(binary::Input& input, Pid& type, Clause& clause);
+
+  std::string dump() const;
+
+  static void destroy(const Fact* fact) {
+    if (fact) {
+      fact->Fact::~Fact();
+      ::operator delete(const_cast<Fact*>(fact));
+    }
+  }
+
+  struct deleter {
+    void operator()(const Fact* fact) const {
+      Fact::destroy(fact);
+    }
+  };
+
+  using unique_ptr = std::unique_ptr<Fact, deleter>;
+
+  static unique_ptr create(Ref ref, unsigned int tag = 0) {
+    // this should be checked earlier hence just an assert here
+    assert(ref.clause.key_size <= 0xFFFFFFF);
+    const auto size = ref.clause.size();
+    Fact* fact = static_cast<Fact*>(::operator new(sizeof(Fact) + size));
+    new (fact) Fact();
+    fact->id_ = ref.id;
+    fact->type_ = ref.type;
+    fact->key_size = ref.clause.key_size;
+    fact->tag_ = tag;
+    fact->value_size = ref.clause.value_size;
+    // memcpy(p, 0, 0) is undefined behaviour according to the C standard,
+    // apparently, and this gets flagged in debug mode
+    if (size > 0) {
+      memcpy(reinterpret_cast<unsigned char*>(fact + 1), ref.clause.data, size);
+    }
+    return unique_ptr(fact);
+  }
+
+ private:
+  Fact() {}
+  ~Fact() {}
+
+  Fact(const Fact&) = delete;
+  Fact(Fact&&) = delete;
+  Fact& operator=(const Fact&) = delete;
+  Fact& operator=(Fact&&) = delete;
+
+  boost::intrusive::list_member_hook<> list_hook;
+  Id id_;
+  Pid type_;
+  struct {
+    unsigned int tag_ : 4;
+    unsigned int key_size : 28;
+  };
+  uint32_t value_size;
+
+ public:
+  using intrusive_list = boost::intrusive::list<
+      Fact,
+      boost::intrusive::member_hook<
+          Fact,
+          boost::intrusive::list_member_hook<>,
+          &Fact::list_hook>>;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/factset.cpp b/glean/rts/factset.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/factset.cpp
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/factset.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct FactSet::Index {
+  /// Type of index maps
+  using map_t = std::map<folly::ByteRange, const Fact*>;
+
+  /// Type of index maps with synchronised access
+  using entry_t = folly::Synchronized<map_t>;
+
+  entry_t& operator[](Pid pid) {
+    auto ulock = index.ulock();
+    if (const auto p = ulock->lookup(pid)) {
+      return **p;
+    } else {
+      auto wlock = ulock.moveFromUpgradeToWrite();
+      auto q = new entry_t;
+      (*wlock)[pid].reset(q);
+      return *q;
+    }
+  }
+
+  folly::Synchronized<DenseMap<Pid, std::unique_ptr<entry_t>>> index;
+};
+
+FactSet::FactSet(Id start) : facts(start) {}
+FactSet::FactSet(FactSet&&) noexcept = default;
+FactSet& FactSet::operator=(FactSet&&) = default;
+FactSet::~FactSet() noexcept = default;
+
+size_t FactSet::allocatedMemory() const noexcept {
+  size_t n = facts.allocatedMemory() + keys.allocatedMemory();
+  for (const auto& k : keys) {
+    n += k.second.getAllocatedMemorySize();
+  }
+  return n;
+}
+
+size_t FactSet::Facts::allocatedMemory() const noexcept {
+  size_t n = facts.capacity() * sizeof(facts[0]);
+  for (const auto& fact : facts) {
+    n += fact->size();
+  }
+  return n;
+}
+
+struct FactSet::CachedPredicateStats {
+  struct Data {
+    /// Cached stats
+    PredicateStats stats;
+
+    /// Index in 'facts' up to which we've computed the stats so far. Since
+    /// FactSet is append-only, 'stats' are out of date if we have more than
+    /// 'upto' facts and we only need to add the new facts to be up to date
+    /// again
+    size_t upto = 0;
+  };
+  folly::Synchronized<Data> data;
+};
+
+PredicateStats FactSet::predicateStats() const {
+  auto ulock = predicate_stats.value().data.ulock();
+  if (ulock->upto < facts.size()) {
+    auto wlock = ulock.moveFromUpgradeToWrite();
+    wlock->stats.reserve(keys.low_bound(), keys.high_bound());
+    for (const auto& fact :
+         folly::range(facts.begin() + wlock->upto, facts.end())) {
+      wlock->stats[fact.type] += MemoryStats::one(fact.clause.size());
+    }
+    wlock->upto = facts.size();
+    return wlock->stats;
+  } else {
+    return ulock->stats;
+  }
+}
+
+Id FactSet::idByKey(Pid type, folly::ByteRange key) {
+  if (const auto p = keys.lookup(type)) {
+    const auto i = p->find(key);
+    if (i != p->end()) {
+      return (*i)->id();
+    }
+  }
+  return Id::invalid();
+}
+
+Pid FactSet::typeById(Id id) {
+  if (id >= facts.startingId()) {
+    const auto i = distance(facts.startingId(), id);
+    if (i < facts.size()) {
+      return facts[i].type;
+    }
+  }
+  return Pid::invalid();
+}
+
+bool FactSet::factById(Id id, std::function<void(Pid, Fact::Clause)> f) {
+  if (id >= facts.startingId()) {
+    const auto i = distance(facts.startingId(), id);
+    if (i < facts.size()) {
+      f(facts[i].type, facts[i].clause);
+      return true;
+    }
+  }
+  return false;
+}
+
+Interval FactSet::count(Pid pid) const {
+  const auto p = keys.lookup(pid);
+  return p ? p->size() : 0;
+}
+
+std::unique_ptr<FactIterator> FactSet::enumerate(Id from, Id upto) {
+  struct Iterator final : FactIterator {
+    using iter_t = FactSet::const_iterator;
+    iter_t pos;
+    const iter_t end;
+
+    Iterator(iter_t p, iter_t e) : pos(p), end(e) {}
+
+    void next() override {
+      assert(pos != end);
+      ++pos;
+    }
+
+    Fact::Ref get(Demand) override {
+      return pos != end ? *pos : Fact::Ref::invalid();
+    }
+
+    std::optional<Id> lower_bound() override {
+      return std::nullopt;
+    }
+    std::optional<Id> upper_bound() override {
+      return std::nullopt;
+    }
+  };
+
+  return std::make_unique<Iterator>(
+      lower_bound(from), upto ? lower_bound(upto) : end());
+}
+
+std::unique_ptr<FactIterator> FactSet::enumerateBack(Id from, Id downto) {
+  struct BackIterator final : FactIterator {
+    using iter_t = FactSet::const_iterator;
+    iter_t pos;
+    const iter_t end;
+
+    BackIterator(iter_t p, iter_t e) : pos(p), end(e) {}
+
+    void next() override {
+      assert(pos != end);
+      --pos;
+    }
+
+    Fact::Ref get(Demand) override {
+      if (pos != end) {
+        auto i = pos;
+        --i;
+        return *i;
+      } else {
+        return Fact::Ref::invalid();
+      }
+    }
+
+    std::optional<Id> lower_bound() override {
+      return std::nullopt;
+    }
+    std::optional<Id> upper_bound() override {
+      return std::nullopt;
+    }
+  };
+
+  return std::make_unique<BackIterator>(
+      from ? lower_bound(from) : end(), lower_bound(downto));
+}
+
+std::unique_ptr<FactIterator>
+FactSet::seek(Pid type, folly::ByteRange start, size_t prefix_size) {
+  struct SeekIterator : FactIterator {
+    explicit SeekIterator(Index::map_t::iterator b, Index::map_t::iterator e)
+        : current(b), end(e) {}
+
+    void next() override {
+      assert(current != end);
+      ++current;
+    }
+
+    Fact::Ref get(Demand) override {
+      return current != end ? current->second->ref() : Fact::Ref::invalid();
+    }
+
+    std::optional<Id> lower_bound() override {
+      return std::nullopt;
+    }
+    std::optional<Id> upper_bound() override {
+      return std::nullopt;
+    }
+
+    Index::map_t::const_iterator current;
+    const Index::map_t::const_iterator end;
+  };
+
+  assert(prefix_size <= start.size());
+
+  if (const auto p = keys.lookup(type)) {
+    auto& entry = index.value()[type];
+    // Check if the entry is up to date (i.e., has the same number of items as
+    // the key hashmap). If it doesn't, fill it.
+    if (!entry.withRLock([&](auto& map) { return map.size() == p->size(); })) {
+      entry.withWLock([&](auto& map) {
+        if (map.size() != p->size()) {
+          map.clear();
+          for (const Fact* fact : *p) {
+            map.insert({fact->key(), fact});
+          }
+        }
+      });
+    }
+    // The map for a pid is only created once so this is safe. We are *not*
+    // thread safe with respect to concurrent modifications of the FactSet
+    // as per spec.
+    auto& map = entry.unsafeGetUnlocked();
+
+    const auto next =
+        binary::lexicographicallyNext({start.data(), prefix_size});
+    return std::make_unique<SeekIterator>(
+        map.lower_bound(start),
+        next.empty() ? map.end() : map.lower_bound(binary::byteRange(next)));
+  } else {
+    return std::make_unique<EmptyIterator>();
+  }
+}
+
+std::unique_ptr<FactIterator> FactSet::seekWithinSection(
+    Pid type,
+    folly::ByteRange start,
+    size_t prefix_size,
+    Id from,
+    Id to) {
+  if (from <= startingId() && firstFreeId() <= to) {
+    return seek(type, start, prefix_size);
+  }
+
+  // We have no use case for actually performing a bounded
+  // seek of a FactSet, therefore we would rather know if
+  // anything tries to trigger it.
+  error("FactSet::seekWithinSection: bounds too narrow");
+}
+
+Id FactSet::define(Pid type, Fact::Clause clause, Id) {
+  if (clause.key_size > Fact::MAX_KEY_SIZE) {
+    error("key too large: {}", clause.key_size);
+  }
+  const auto next_id = firstFreeId();
+  auto fact = facts.alloc(next_id, type, clause);
+  auto& key_map = keys[type];
+  const auto r = key_map.insert(fact.get());
+  if (r.second) {
+    facts.commit(std::move(fact));
+    return next_id;
+  } else {
+    return fact->value() == (*r.first)->value() ? (*r.first)->id()
+                                                : Id::invalid();
+  }
+}
+
+FactSet::Serialized FactSet::serialize() const {
+  binary::Output output;
+  for (auto fact : *this) {
+    fact.serialize(output);
+  }
+  return {startingId(), size(), std::move(output)};
+}
+
+///
+// Serialize facts in the order given by the input range. Preconditions:
+//
+// * The order must mention only fact IDs in this set.
+// * The facts in the set cannot refer to each other (because then we
+//   would need to substitute in addition to reordering)
+//
+// The ordering can omit facts. This is useful for filtering a FactSet,
+// see Glean/Query/UserQuery.hs.
+//
+FactSet::Serialized FactSet::serializeReorder(
+    folly::Range<const uint64_t*> order) const {
+  binary::Output output;
+  for (auto i : order) {
+    assert(
+        i >= startingId().toWord() && i - startingId().toWord() < facts.size());
+    facts[i - startingId().toWord()].serialize(output);
+  }
+
+  return {startingId(), order.size(), std::move(output)};
+}
+
+namespace {
+
+template <typename F>
+std::pair<binary::Output, size_t> substituteFact(
+    const Inventory& inventory,
+    Predicate::Rename<F>& substitute,
+    Fact::Ref fact) {
+  auto predicate = inventory.lookupPredicate(fact.type);
+  CHECK_NOTNULL(predicate);
+  binary::Output clause;
+  uint64_t key_size;
+  predicate->substitute(substitute, fact.clause, clause, key_size);
+  return {std::move(clause), key_size};
+}
+
+} // namespace
+
+/*
+  How rebasing works:
+
+              |----------batch-----------|
+   ...........|---global---|----local----|.......... ---> increasing fact IDs
+             /              \             \
+            /     subst      \             \
+           /    maps these    \             \
+          /                    \             \
+   ......|----------------------|--new batch--|......
+                        -->|    |<--
+                           offset
+
+  After applying a substitution to "batch", we have
+    - global facts that are mapped by the substitution. We no longer
+      have to keep those.
+    - local facts that might now refer to global facts
+
+  Local facts must be adjusted by "offset" so they don't overlap with
+  global facts.
+*/
+
+std::pair<FactSet, Substitution> FactSet::rebase(
+    const Inventory& inventory,
+    const Substitution& subst,
+    Store& global) const {
+  const auto new_start = subst.firstFreeId();
+  auto substitute =
+      Predicate::Rename([&subst](Id id, Pid) { return subst.subst(id); });
+
+  const auto split = lower_bound(subst.finish());
+
+  for (auto fact : folly::range(begin(), split)) {
+    auto r = substituteFact(inventory, substitute, fact);
+    global.insert(
+        {subst.subst(fact.id),
+         fact.type,
+         Fact::Clause::from(r.first.bytes(), r.second)});
+  }
+
+  // build a substitution that covers the whole of the FactSet,
+  // by copying the original substitution into the lower part
+  // and then filling the upper part as we add facts below.
+  const auto subst_end = firstFreeId();
+
+  std::vector<Id> rebase_ids(distance(subst.start(), subst_end));
+  subst.with([&](Id base, const std::vector<Id>& items) {
+    std::copy(items.begin(), items.end(), rebase_ids.begin());
+  });
+  MutableSubstitution localSubst(subst.start(), rebase_ids);
+
+  auto substituteLocal = Predicate::Rename(
+      [&localSubst](Id id, Pid) { return localSubst.subst(id); });
+
+  FactSet local(new_start);
+  for (auto fact : folly::range(split, end())) {
+    auto r = substituteFact(inventory, substituteLocal, fact);
+
+    const auto clause = Fact::Clause::from(r.first.bytes(), r.second);
+    const auto old_id = fact.id;
+    auto new_id = local.define(fact.type, clause);
+
+    // in case of same key, but different values after substitution
+    // we ignore the later definition.
+    if (!new_id) {
+      new_id = local.idByKey(fact.type, clause.key());
+    }
+
+    localSubst.set(old_id, new_id);
+  }
+
+  return std::make_pair<FactSet, Substitution>(
+      std::move(local), localSubst.freeze());
+}
+
+void FactSet::append(FactSet other) {
+  assert(appendable(other));
+
+  facts.append(std::move(other.facts));
+
+  keys.merge(std::move(other.keys), [](auto& left, const auto& right) {
+    left.insert(right.begin(), right.end());
+  });
+}
+
+bool FactSet::appendable(const FactSet& other) const {
+  if (empty() || other.empty()) {
+    return true;
+  }
+
+  if (firstFreeId() != other.startingId()) {
+    return false;
+  }
+
+  for (const auto& k : other.keys) {
+    if (const auto* p = keys.lookup(k.first)) {
+      for (auto i = k.second.begin(); i != k.second.end(); ++i) {
+        if (p->contains((*i)->key())) {
+          return false;
+        }
+      }
+    }
+  }
+
+  return true;
+}
+
+bool FactSet::sanityCheck() const {
+  // TODO: implement
+  return true;
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/factset.h b/glean/rts/factset.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/factset.h
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/define.h"
+#include "glean/rts/densemap.h"
+#include "glean/rts/fact.h"
+#include "glean/rts/inventory.h"
+#include "glean/rts/ondemand.h"
+#include "glean/rts/stats.h"
+#include "glean/rts/store.h"
+#include "glean/rts/substitution.h"
+
+#include <boost/intrusive/list.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <folly/Synchronized.h>
+#include <folly/container/F14Set.h>
+#include <atomic>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+// We used to have maps Id -> Fact* and pair<Id,ByteRange> -> Fact* here but
+// this used quite a bit of memory (almost exactly as much as the facts
+// themselves). Sets with folly's heterogenous key comparisons should use a
+// lot less memory per fact.
+
+struct FactById {
+  using value_type = Id;
+
+  static value_type get(const Fact* fact) {
+    return fact->id();
+  }
+
+  static value_type get(const Fact::unique_ptr& p) {
+    return get(p.get());
+  }
+
+  static value_type get(const value_type& x) {
+    return x;
+  }
+};
+
+struct FactByKey {
+  using value_type = std::pair<Pid, folly::ByteRange>;
+
+  static value_type get(const Fact* fact) {
+    return {fact->type(), fact->key()};
+  }
+
+  static value_type get(const Fact::unique_ptr& p) {
+    return get(p.get());
+  }
+
+  static value_type get(const value_type& x) {
+    return x;
+  }
+};
+
+struct FactByKeyOnly {
+  using value_type = folly::ByteRange;
+
+  static value_type get(const Fact* fact) {
+    return fact->key();
+  }
+
+  static value_type get(const Fact::unique_ptr& p) {
+    return get(p.get());
+  }
+
+  static value_type get(const value_type& x) {
+    return x;
+  }
+};
+
+template <typename By>
+struct EqualBy {
+  template <typename T, typename U>
+  bool operator()(const T& x, const U& y) const {
+    return By::get(x) == By::get(y);
+  }
+};
+
+template <typename By>
+struct HashBy {
+  template <typename T>
+  uint64_t operator()(const T& x) const {
+    return folly::Hash()(By::get(x));
+  }
+};
+
+template <typename T, typename By>
+using FastSetBy = folly::F14FastSet<
+    T,
+    folly::transparent<HashBy<By>>,
+    folly::transparent<EqualBy<By>>>;
+
+/**
+ * A set of facts which can be looked up by id or by key.
+ *
+ * Iteration through the set happens in the order in which facts have been
+ * first inserted.
+ *
+ */
+struct FactSet final : public Define {
+ private:
+  class Facts final {
+   public:
+    explicit Facts(Id start) noexcept : starting_id(start) {}
+    Facts(Facts&& other) noexcept
+        : starting_id(other.starting_id),
+          facts(std::move(other.facts)),
+          fact_memory(other.fact_memory) {}
+    Facts& operator=(Facts&& other) noexcept {
+      starting_id = other.starting_id;
+      facts = std::move(other.facts);
+      fact_memory = other.fact_memory;
+      return *this;
+    }
+
+    bool empty() const {
+      return facts.empty();
+    }
+
+    size_t size() const {
+      return facts.size();
+    }
+
+    Id startingId() const {
+      return starting_id;
+    }
+
+    struct deref {
+      Fact::Ref operator()(const Fact::unique_ptr& p) const {
+        return p->ref();
+      }
+    };
+
+    using const_iterator = boost::transform_iterator<
+        deref,
+        std::vector<Fact::unique_ptr>::const_iterator>;
+
+    const_iterator begin() const {
+      return boost::make_transform_iterator(facts.begin(), deref());
+    }
+
+    const_iterator end() const {
+      return boost::make_transform_iterator(facts.end(), deref());
+    }
+
+    Fact::Ref operator[](size_t i) const {
+      assert(i < facts.size());
+      return facts[i]->ref();
+    }
+
+    void clear() {
+      facts.clear();
+      fact_memory = 0;
+    }
+
+    using Token = Fact::unique_ptr;
+
+    Token alloc(Id id, Pid type, Fact::Clause clause) {
+      return Fact::create({id, type, clause});
+    }
+
+    void commit(Token token) {
+      fact_memory += token->size();
+      facts.push_back(std::move(token));
+    }
+
+    void append(Facts other) {
+      facts.insert(
+          facts.end(),
+          std::make_move_iterator(other.facts.begin()),
+          std::make_move_iterator(other.facts.end()));
+      fact_memory += other.fact_memory;
+    }
+
+    /// Return the number of bytes occupied by facts.
+    size_t factMemory() const noexcept {
+      return fact_memory;
+    }
+
+    /// Return (approximately) the total number of bytes allocated by the
+    /// FactSet. This currently does *not* include the memory allocated by seek
+    /// indices.
+    size_t allocatedMemory() const noexcept;
+
+   private:
+    Id starting_id;
+    std::vector<Fact::unique_ptr> facts;
+    size_t fact_memory = 0;
+  };
+
+ public:
+  explicit FactSet(Id start);
+  FactSet(FactSet&&) noexcept;
+  FactSet& operator=(FactSet&&);
+  ~FactSet() noexcept;
+
+  FactSet(const FactSet&) = delete;
+  FactSet& operator=(const FactSet&) = delete;
+
+  size_t size() const noexcept {
+    return facts.size();
+  }
+
+  bool empty() const noexcept {
+    return facts.empty();
+  }
+
+  using const_iterator = Facts::const_iterator;
+
+  const_iterator begin() const {
+    return facts.begin();
+  }
+
+  const_iterator end() const {
+    return facts.end();
+  }
+
+  /// Return iterator to the first fact with an id that's not less than the
+  /// given id (or end() if no such fact exists).
+  const_iterator lower_bound(Id id) const {
+    return begin() +
+        (id <= facts.startingId()
+             ? 0
+             : std::min(distance(facts.startingId(), id), facts.size()));
+  }
+
+  const_iterator upper_bound(Id id) const {
+    return begin() +
+        (id < facts.startingId()
+             ? 0
+             : std::min(distance(facts.startingId(), id) + 1, facts.size()));
+  }
+
+  /// Return the number of bytes occupied by facts.
+  size_t factMemory() const noexcept {
+    return facts.factMemory();
+  }
+
+  size_t allocatedMemory() const noexcept;
+
+  PredicateStats predicateStats() const;
+
+  // Lookup implementation
+
+  Id idByKey(Pid type, folly::ByteRange key) override;
+
+  Pid typeById(Id id) override;
+
+  bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) override;
+
+  Id startingId() const override {
+    return facts.startingId();
+  }
+
+  Id firstFreeId() const override {
+    return facts.startingId() + facts.size();
+  }
+
+  Interval count(Pid pid) const override;
+
+  std::unique_ptr<FactIterator> enumerate(
+      Id from = Id::invalid(),
+      Id upto = Id::invalid()) override;
+  std::unique_ptr<FactIterator> enumerateBack(
+      Id from = Id::invalid(),
+      Id downto = Id::invalid()) override;
+
+  /// Prefix seeks. This function can be called from multiple threads but prefix
+  /// seeks can *not* be interleaved with modifying the FactSet.
+  ///
+  /// WARNING: This is currently not intended for production use as it is very
+  /// slow. The first call for each predicate will be especially slow as it will
+  /// need to create an index.
+  std::unique_ptr<FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) override;
+
+  std::unique_ptr<FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id to) override;
+
+  UsetId getOwner(Id) override {
+    return INVALID_USET;
+  }
+
+  // Define implementation
+
+  Id define(Pid type, Fact::Clause, Id max_ref = Id::invalid()) override;
+
+  struct Serialized {
+    Id first;
+    size_t count;
+    binary::Output facts;
+  };
+  Serialized serialize() const;
+
+  Serialized serializeReorder(folly::Range<const uint64_t*> order) const;
+
+  // Substitute all facts in the set and split it into a global and a local part
+  // based on the substitution. Facts with Ids that are in the range of the
+  // substitution go into the global part - they are moved from the set
+  // to the global Store. Facts that are beyond that range (i.e., those with
+  // id >= subst.finish()) are assigned new Ids which don't clash with the
+  // domain of the substitution and are added to the local part which is
+  // returned by the function.
+  std::pair<FactSet, Substitution> rebase(
+      const Inventory& inventory,
+      const Substitution& subst,
+      Store& global) const;
+
+  /// Append a set of facts. This operation is only well defined under the
+  /// following conditions.
+  ///
+  ///   * other.startingId() == this->firstFreeId() unless one of the FactSets
+  ///     is empty
+  ///   * the fact sets are disjoint, i.e., there are no facts that exist in
+  ///     both sets
+  ///
+  void append(FactSet other);
+
+  /// Checks if appending a particular fact set would be well defined.
+  bool appendable(const FactSet& other) const;
+
+  bool sanityCheck() const;
+
+ private:
+  Facts facts;
+  DenseMap<Pid, FastSetBy<const Fact*, FactByKeyOnly>> keys;
+
+  /// Cached predicate stats. We create these on-demand rather than maintain
+  /// them throughout because most FactSets don't need them.
+  struct CachedPredicateStats;
+  mutable OnDemand<CachedPredicateStats> predicate_stats;
+
+  /// Index for prefix seeks. It is lazily initialised and slow as we typically
+  /// don't do seeks on FactSets.
+  struct Index;
+  OnDemand<Index> index;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ffi.cpp b/glean/rts/ffi.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ffi.cpp
@@ -0,0 +1,1158 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/rts/bytecode/subroutine.h"
+#include "glean/rts/cache.h"
+#include "glean/rts/ffi.h"
+#include "glean/rts/id.h"
+#include "glean/rts/lookup.h"
+#include "glean/rts/ownership.h"
+#include "glean/rts/ownership/slice.h"
+#include "glean/rts/query.h"
+#include "glean/rts/sanity.h"
+#include "glean/rts/stacked.h"
+#include "glean/rts/string.h"
+#include "glean/rts/substitution.h"
+#include "glean/rts/validate.h"
+
+#include <folly/Exception.h>
+#include <algorithm>
+#include <vector>
+
+#ifdef OSS
+#include <cpp/HsStruct.h> // @manual
+#else
+#include <common/hs/util/cpp/HsStruct.h>
+#endif
+
+using namespace facebook::hs;
+
+namespace facebook {
+namespace glean {
+namespace rts {
+namespace c {
+
+struct SharedLookupCacheStats {
+  std::shared_ptr<facebook::glean::rts::LookupCache::Stats> value;
+};
+
+struct SharedSubroutine {
+  std::shared_ptr<facebook::glean::rts::Subroutine> value;
+};
+
+namespace {
+
+template <typename F>
+const char* pop_value(const void** start, const void* end, F f) {
+  return ffi::wrap([=]() {
+    binary::Input input(*start, end);
+    f(input);
+    *start = input.data();
+  });
+}
+
+} // namespace
+
+extern "C" {
+
+const char* glean_inventory_new(
+    size_t count,
+    const int64_t* ids,
+    const void* const* name_ptrs,
+    const size_t* name_sizes,
+    const int32_t* versions,
+    SharedSubroutine* const* typecheckers,
+    SharedSubroutine* const* traversals,
+    Inventory** inventory) {
+  return ffi::wrap([=] {
+    std::vector<rts::Predicate> predicates;
+    predicates.reserve(count);
+    for (size_t i = 0; i < count; ++i) {
+      predicates.push_back(rts::Predicate{
+          Pid::fromThrift(ids[i]),
+          std::string(static_cast<const char*>(name_ptrs[i]), name_sizes[i]),
+          versions[i],
+          typecheckers[i]->value,
+          traversals[i]->value});
+    }
+    *inventory = new Inventory(std::move(predicates));
+  });
+}
+
+void glean_inventory_free(Inventory* inventory) {
+  ffi::free_(inventory);
+}
+
+const char* glean_inventory_predicates(
+    Inventory* inventory,
+    size_t* count,
+    const Predicate*** predicates) {
+  return ffi::wrap([=] {
+    const auto preds = inventory->predicates();
+    const auto n = preds.size();
+    *count = n;
+    *predicates = ffi::clone_array(preds.data(), preds.size()).release();
+  });
+}
+
+const char* glean_inventory_serialize(
+    Inventory* inventory,
+    const void** data,
+    size_t* size) {
+  return ffi::wrap(
+      [=] { ffi::clone_bytes(inventory->serialize()).release_to(data, size); });
+}
+
+const char* glean_inventory_deserialize(
+    const void* data,
+    size_t size,
+    Inventory** inventory) {
+  return ffi::wrap([=] {
+    *inventory = new Inventory(Inventory::deserialize(
+        {reinterpret_cast<const unsigned char*>(data), size}));
+  });
+}
+
+const char* glean_predicate_unpack(
+    Predicate* predicate,
+    int64_t* id,
+    const void** name,
+    size_t* name_size,
+    int32_t* version) {
+  return ffi::wrap([=] {
+    *id = predicate->id.toThrift();
+    *name = predicate->name.data();
+    *name_size = predicate->name.size();
+    *version = predicate->version;
+  });
+}
+
+const char* glean_inventory_equal(
+    const Inventory* first,
+    const Inventory* second,
+    bool* result) {
+  return ffi::wrap([=] { *result = *first == *second; });
+}
+
+const char*
+glean_snapshot_new(Lookup* base, int64_t boundary, Lookup** snapshot_) {
+  return ffi::wrap([=] {
+    std::unique_ptr<Lookup> s = snapshot(base, Id::fromThrift(boundary));
+    *snapshot_ = s.release();
+  });
+}
+
+const char* glean_lookupcache_stats_new(SharedLookupCacheStats** stats) {
+  return ffi::wrap([=] {
+    *stats = new SharedLookupCacheStats{std::make_shared<LookupCache::Stats>()};
+  });
+}
+
+void glean_lookupcache_stats_free(SharedLookupCacheStats* stats) {
+  ffi::free_(stats);
+}
+
+void glean_lookupcache_stats_read_and_reset_counters(
+    SharedLookupCacheStats* stats,
+    uint64_t* values,
+    size_t size) {
+  auto buffer = stats->value->readAndResetCounters();
+  if (size == buffer.size()) {
+    std::copy(buffer.begin(), buffer.end(), values);
+  } else {
+    LOG(ERROR)
+        << "glean_lookupcache_stats_read_and_reset_counters: invalid size";
+    std::fill(values, values + size, 0);
+  }
+}
+
+const char* glean_lookupcache_new(
+    size_t capacity,
+    size_t shards,
+    SharedLookupCacheStats* stats,
+    LookupCache** cache) {
+  return ffi::wrap([=] {
+    *cache =
+        new LookupCache(LookupCache::Options{capacity, shards}, stats->value);
+  });
+}
+
+void glean_lookupcache_free(LookupCache* cache) {
+  ffi::free_(cache);
+}
+
+const char* glean_lookupcache_clear(LookupCache* cache) {
+  return ffi::wrap([=] { cache->clear(); });
+}
+
+const char* glean_lookupcache_anchor_new(
+    Lookup* base,
+    LookupCache* cache,
+    int replacementPolicy,
+    Lookup** anchor) {
+  return ffi::wrap([=] {
+    *anchor = new LookupCache::Anchor(cache->anchor(
+        base,
+        static_cast<LookupCache::Anchor::ReplacementPolicy>(
+            replacementPolicy)));
+  });
+}
+
+void glean_lookupcache_anchor_free(Lookup* anchor) {
+  ffi::free_(anchor);
+}
+
+void glean_interrupt_running_queries() {
+  interruptRunningQueries();
+}
+
+const char* glean_query_execute_compiled(
+    Inventory* inventory,
+    Define* facts,
+    DefineOwnership* ownership,
+    SharedSubroutine* sub,
+    uint64_t pid,
+    SharedSubroutine* traverse,
+    uint64_t max_results,
+    uint64_t max_bytes,
+    uint64_t max_time_ms,
+    uint64_t max_set_size,
+    uint64_t depth,
+    uint64_t* expand_pids,
+    uint64_t num_expand_pids,
+    uint64_t want_stats,
+    QueryResults** presults) {
+  return ffi::wrap([=]() {
+    std::unordered_set<Pid, folly::hasher<Pid>> expandPids;
+    if (expand_pids) {
+      expandPids = std::unordered_set<Pid, folly::hasher<Pid>>(
+          reinterpret_cast<Pid*>(expand_pids),
+          reinterpret_cast<Pid*>(expand_pids) + num_expand_pids);
+    }
+    *presults =
+        executeQuery(
+            *inventory,
+            *facts,
+            ownership,
+            *(sub->value),
+            Pid::fromWord(pid),
+            traverse ? traverse->value : nullptr,
+            max_results == 0 ? folly::none
+                             : folly::Optional<uint64_t>(max_results),
+            max_bytes == 0 ? folly::none : folly::Optional<uint64_t>(max_bytes),
+            max_time_ms == 0 ? folly::none
+                             : folly::Optional<uint64_t>(max_time_ms),
+            max_set_size == 0 ? folly::none
+                              : folly::Optional<uint64_t>(max_set_size),
+            static_cast<Depth>(depth),
+            expandPids,
+            want_stats)
+            .release();
+  });
+}
+
+const char* glean_query_restart_compiled(
+    Inventory* inventory,
+    Define* facts,
+    DefineOwnership* ownership,
+    void* cont,
+    int64_t cont_size,
+    uint64_t max_results,
+    uint64_t max_bytes,
+    uint64_t max_time_ms,
+    uint64_t max_set_size,
+    uint64_t depth,
+    uint64_t* expand_pids,
+    uint64_t num_expand_pids,
+    uint64_t want_stats,
+    QueryResults** presults) {
+  return ffi::wrap([=]() {
+    std::unordered_set<Pid, folly::hasher<Pid>> expandPids;
+    if (expand_pids) {
+      expandPids = std::unordered_set<Pid, folly::hasher<Pid>>(
+          reinterpret_cast<Pid*>(expand_pids),
+          reinterpret_cast<Pid*>(expand_pids) + num_expand_pids);
+    }
+    *presults =
+        restartQuery(
+            *inventory,
+            *facts,
+            ownership,
+            max_results == 0 ? folly::none
+                             : folly::Optional<uint64_t>(max_results),
+            max_bytes == 0 ? folly::none : folly::Optional<uint64_t>(max_bytes),
+            max_time_ms == 0 ? folly::none
+                             : folly::Optional<uint64_t>(max_time_ms),
+            max_set_size == 0 ? folly::none
+                              : folly::Optional<uint64_t>(max_set_size),
+            static_cast<Depth>(depth),
+            expandPids,
+            want_stats,
+            cont,
+            cont_size)
+            .release();
+  });
+}
+
+void glean_lookup_free(Lookup* lookup) {
+  ffi::free_(lookup);
+}
+
+const char* glean_lookup_empty(Lookup** lookup) {
+  return ffi::wrap([=] { *lookup = new EmptyLookup(); });
+}
+
+const char* glean_lookup_starting_id(Lookup* lookup, int64_t* id) {
+  return ffi::wrap([=] { *id = lookup->startingId().toThrift(); });
+}
+
+const char* glean_lookup_first_free_id(Lookup* lookup, int64_t* id) {
+  return ffi::wrap([=] { *id = lookup->firstFreeId().toThrift(); });
+}
+
+const char* glean_lookup_fact(
+    Lookup* lookup,
+    int64_t id,
+    int64_t* type,
+    void** key,
+    size_t* key_size,
+    void** value,
+    size_t* value_size) {
+  return ffi::wrap([=]() {
+    ffi::malloced_array<uint8_t> key_bytes;
+    ffi::malloced_array<uint8_t> value_bytes;
+    auto found =
+        lookup->factById(Id::fromThrift(id), [&](auto ty, auto clause) {
+          *type = ty.toThrift();
+          key_bytes = ffi::clone_bytes(clause.key());
+          value_bytes = ffi::clone_bytes(clause.value());
+          return true;
+        });
+    if (!found) {
+      *type = 0;
+    }
+    key_bytes.release_to(key, key_size);
+    value_bytes.release_to(value, value_size);
+  });
+}
+
+const char* glean_define_fact(
+    Define* facts,
+    glean_predicate_id_t predicate,
+    Output* clause,
+    size_t key_size,
+    glean_fact_id_t* id) {
+  return ffi::wrap([=] {
+    assert(key_size <= clause->size());
+    *id = facts
+              ->define(
+                  Pid::fromThrift(predicate),
+                  Fact::Clause::from(clause->bytes(), key_size))
+              .toThrift();
+  });
+}
+
+const char* glean_define_batch(
+    Define* facts,
+    Inventory* inventory,
+    int64_t batch_first_id,
+    const int64_t* ids,
+    size_t batch_count,
+    const void* batch_facts_data,
+    size_t batch_facts_size,
+    bool trust_refs,
+    bool ignore_redefs,
+    Substitution** subst) {
+  return ffi::wrap([=] {
+    *subst = new Substitution(defineBatch(
+        *facts,
+        *inventory,
+        Id::fromThrift(batch_first_id),
+        reinterpret_cast<const Id*>(ids),
+        batch_count,
+        folly::ByteRange(
+            static_cast<const unsigned char*>(batch_facts_data),
+            batch_facts_size),
+        trust_refs,
+        ignore_redefs));
+  });
+}
+
+const char* glean_new_subst(int64_t first, size_t size, Substitution** subst) {
+  return ffi::wrap(
+      [=]() { *subst = new Substitution(Id::fromThrift(first), size); });
+}
+void glean_free_subst(Substitution* subst) {
+  ffi::free_(subst);
+}
+
+const char* glean_subst_compose(
+    const Substitution* first,
+    const Substitution* second,
+    Substitution** result) {
+  return ffi::wrap([=] {
+    *result = new Substitution(Substitution::compose(*first, *second));
+  });
+}
+
+const char* glean_serialize_subst(
+    const Substitution* subst,
+    int64_t* firstId,
+    size_t* count,
+    int64_t** ids) {
+  return ffi::wrap([=]() {
+    subst->with([=](Id base, const std::vector<Id>& items) {
+      *firstId = base.toWord();
+      *count = items.size();
+      *ids = ffi::clone_array(
+                 reinterpret_cast<const int64_t*>(items.data()), *count)
+                 .release();
+    });
+  });
+}
+
+const char* glean_subst_intervals(
+    const Substitution* subst,
+    const glean_fact_id_t* ins,
+    size_t ins_size,
+    glean_fact_id_t** outs,
+    size_t* outs_size) {
+  return ffi::wrap([=] {
+    std::vector<Id> ids;
+    ids.reserve(ins_size);
+    std::transform(
+        ins, ins + ins_size, std::back_inserter(ids), Id::fromThrift);
+    auto res = subst->substIntervals(ids);
+    auto fres = ffi::malloc_array<glean_fact_id_t>(res.size());
+    std::transform(res.begin(), res.end(), fres.get(), [](auto id) {
+      return id.toThrift();
+    });
+    fres.release_to(outs, outs_size);
+  });
+}
+
+const char* glean_subst_subst(
+    const Substitution* subst,
+    const glean_fact_id_t id,
+    glean_fact_id_t* res) {
+  return ffi::wrap([=] { *res = subst->subst(Id::fromThrift(id)).toThrift(); });
+}
+
+const char* glean_subst_vector(
+    const Substitution* subst,
+    const glean_fact_id_t* ins,
+    size_t ins_size,
+    glean_fact_id_t** outs,
+    size_t* outs_size) {
+  return ffi::wrap([=] {
+    auto res = ffi::malloc_array<glean_fact_id_t>(ins_size);
+    std::transform(ins, ins + ins_size, res.get(), [subst](auto id) {
+      return subst->subst(Id::fromThrift(id)).toThrift();
+    });
+    res.release_to(outs, outs_size);
+  });
+}
+
+uint64_t glean_subst_offset(const Substitution* subst) {
+  return distance(subst->finish(), subst->firstFreeId());
+}
+
+const char* glean_factset_new(int64_t first_id, FactSet** facts) {
+  return ffi::wrap([=] { *facts = new FactSet(Id::fromThrift(first_id)); });
+}
+
+void glean_factset_free(FactSet* facts) {
+  ffi::free_(facts);
+}
+
+size_t glean_factset_fact_count(FactSet* facts) {
+  return facts->size();
+}
+
+size_t glean_factset_fact_memory(FactSet* facts) {
+  return facts->factMemory();
+}
+
+size_t glean_factset_allocated_memory(FactSet* facts) {
+  return sizeof(FactSet) + facts->allocatedMemory();
+}
+
+const char* glean_factset_predicateStats(
+    FactSet* facts,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes) {
+  return ffi::wrap(
+      [=] { marshal(facts->predicateStats(), count, ids, counts, sizes); });
+}
+
+int64_t glean_factset_first_free_id(FactSet* facts) {
+  return facts->firstFreeId().toThrift();
+}
+
+Lookup* glean_factset_lookup(FactSet* facts) {
+  return facts;
+}
+
+Define* glean_factset_define(FactSet* facts) {
+  return facts;
+}
+
+const char* glean_factset_serialize(
+    FactSet* facts,
+    int64_t* first_id,
+    size_t* count,
+    void** facts_data,
+    size_t* facts_size) {
+  return ffi::wrap([=] {
+    auto s = facts->serialize();
+    *first_id = s.first.toWord();
+    *count = s.count;
+    s.facts.moveBytes().release_to(facts_data, facts_size);
+  });
+}
+
+const char* glean_factset_serializeReorder(
+    FactSet* facts,
+    uint64_t* order,
+    size_t order_size,
+    int64_t* first_id,
+    size_t* count,
+    void** facts_data,
+    size_t* facts_size) {
+  return ffi::wrap([=] {
+    auto s = facts->serializeReorder(
+        folly::Range<const uint64_t*>(order, order_size));
+    *first_id = s.first.toWord();
+    *count = s.count;
+    s.facts.moveBytes().release_to(facts_data, facts_size);
+  });
+}
+
+const char* glean_subst_deserialize(
+    int64_t firstId,
+    size_t count,
+    int64_t* ids,
+    Substitution** result) {
+  return ffi::wrap([=] {
+    auto subst_vec = std::vector<Id>(count);
+    std::transform(ids, ids + count, subst_vec.begin(), Id::fromWord);
+    *result = new Substitution(Id::fromWord(firstId), std::move(subst_vec));
+  });
+}
+
+const char* glean_factset_rebase(
+    FactSet* facts,
+    const Inventory* inventory,
+    const Substitution* subst,
+    LookupCache* cache,
+    FactSet** result,
+    Substitution** out_subst) {
+  return ffi::wrap([=] {
+    GLEAN_SANITY_CHECK(subst->sanityCheck(false));
+    *result = nullptr;
+    cache->withBulkStore([&](auto& store) {
+      GLEAN_SANITY_CHECK(facts->sanityCheck());
+      auto [factset, local_subst] = facts->rebase(*inventory, *subst, store);
+      *result = new FactSet(std::move(factset));
+      *out_subst = new Substitution(std::move(local_subst));
+      GLEAN_SANITY_CHECK((*result)->sanityCheck());
+    });
+  });
+}
+
+const char* glean_factset_append(FactSet* target, FactSet* source) {
+  return ffi::wrap([=] { target->append(std::move(*source)); });
+}
+
+const char* glean_rtsset_new(BytestringSet** set) {
+  return ffi::wrap([=] { *set = new BytestringSet(); });
+}
+
+const char* glean_rtsset_insert(BytestringSet* set, Output* out) {
+  return ffi::wrap([=] { set->insert(out->moveToFbString()); });
+}
+
+const char* glean_rtsset_build(BytestringSet* set, Output* out) {
+  return ffi::wrap([=] {
+    out->packed(set->size());
+    for (const auto& v : *set) {
+      out->bytes(v.data(), v.size());
+    }
+  });
+}
+
+void glean_rtsset_free(BytestringSet* set) {
+  return ffi::free_(set);
+}
+
+const char* glean_wordrtsset_new(WordSet** set) {
+  return ffi::wrap([=] { *set = new WordSet(); });
+}
+
+const char* glean_wordrtsset_insert(WordSet* set, uint64_t value) {
+  return ffi::wrap([=] { set->insert(value); });
+}
+
+const char*
+glean_wordrtsset_insert_bytes(WordSet* set, const uint8_t* data, size_t size) {
+  return ffi::wrap([=] {
+    for (auto i = 0; i < size; i++) {
+      set->insert(data[i]);
+    }
+  });
+}
+
+const char* glean_wordrtsset_build(WordSet* set, Output* out) {
+  return ffi::wrap([=] {
+    out->packed(set->size());
+    for (const auto& v : *set) {
+      out->packed(v);
+    }
+  });
+}
+
+const char* glean_wordrtsset_build_bytes(WordSet* set, Output* out) {
+  return ffi::wrap([=] {
+    out->packed(set->size());
+    for (const auto& v : *set) {
+      out->fixed<uint8_t>(v);
+    }
+  });
+}
+
+void glean_wordrtsset_free(WordSet* set) {
+  return ffi::free_(set);
+}
+
+const char*
+glean_stacked_lookup_new(Lookup* base, Lookup* added, Lookup** stacked) {
+  return ffi::wrap([=] { *stacked = new Stacked<Lookup>(base, added); });
+}
+
+const char*
+glean_stacked_define_new(Lookup* base, Define* added, Define** stacked) {
+  return ffi::wrap([=] { *stacked = new Stacked<Define>(base, added); });
+}
+
+void glean_stacked_define_free(Define* stacked) {
+  return ffi::free_(stacked);
+}
+
+const char* glean_new_builder(Output** builder) {
+  return ffi::wrap([=]() { *builder = new Output; });
+}
+
+void glean_free_builder(Output* builder) {
+  ffi::free_(builder);
+}
+
+size_t glean_builder_size(Output* builder) {
+  return builder->size();
+}
+
+const char* glean_finish_builder(Output* builder, void** data, size_t* size) {
+  return ffi::wrap(
+      [=]() { ffi::clone_bytes(builder->bytes()).release_to(data, size); });
+}
+
+const char* glean_reset_builder(Output* builder) {
+  return ffi::wrap([=]() { *builder = binary::Output(); });
+}
+
+const char* glean_push_value_byte(Output* builder, unsigned char val) {
+  return ffi::wrap([=]() { builder->fixed<unsigned char>(val); });
+}
+
+const char*
+glean_push_value_bytes(Output* builder, const void* data, size_t size) {
+  return ffi::wrap([=]() { builder->bytes(data, size); });
+}
+
+const char* glean_push_value_nat(Output* builder, uint64_t val) {
+  return ffi::wrap([=]() { builder->packed(val); });
+}
+
+const char* glean_push_value_array(Output* builder, size_t size) {
+  return ffi::wrap([=]() { builder->packed(size); });
+}
+
+const char* glean_push_value_set(Output* builder, size_t size) {
+  return ffi::wrap([=]() { builder->packed(size); });
+}
+
+const char* glean_push_value_selector(Output* builder, size_t selector) {
+  return ffi::wrap([=]() { builder->packed(selector); });
+}
+
+const char*
+glean_push_value_string(Output* builder, const void* data, size_t size) {
+  return ffi::wrap([=]() {
+    builder->mangleString(
+        folly::ByteRange(static_cast<const unsigned char*>(data), size));
+  });
+}
+
+const char* glean_push_value_fact(Output* builder, glean_fact_id_t fact) {
+  return ffi::wrap([=]() { builder->packed(Id::fromThrift(fact)); });
+}
+
+const char*
+glean_pop_value_byte(const void** start, const void* end, uint8_t* byte) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *byte = input.fixed<uint8_t>();
+  });
+}
+
+const char*
+glean_pop_value_nat(const void** start, const void* end, uint64_t* nat) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *nat = input.packed<uint64_t>();
+  });
+}
+
+const char*
+glean_pop_value_array(const void** start, const void* end, size_t* size) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *size = input.packed<size_t>();
+  });
+}
+
+const char*
+glean_pop_value_set(const void** start, const void* end, size_t* size) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *size = input.packed<size_t>();
+  });
+}
+
+const char* glean_pop_value_bytes_ref(
+    const void** start,
+    const void* end,
+    size_t size,
+    const void** bytes) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *bytes = input.bytes(size).data();
+  });
+}
+
+const char* glean_pop_value_bytes(
+    const void** start,
+    const void* end,
+    size_t size,
+    void** bytes) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *bytes = ffi::clone_bytes(input.bytes(size).data(), size).release();
+  });
+}
+
+const char* glean_pop_value_selector(
+    const void** start,
+    const void* end,
+    size_t* selector) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *selector = input.packed<size_t>();
+  });
+}
+
+const char* glean_pop_value_string(
+    const void** start,
+    const void* end,
+    void** bytes,
+    size_t* size) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    binary::Output output;
+    input.demangleUntrustedString(output);
+    output.moveBytes().release_to(bytes, size);
+  });
+}
+
+size_t glean_pop_value_trusted_string_ref(const void** start, const void* end) {
+  const auto p = static_cast<const unsigned char*>(*start);
+  auto r = skipTrustedString({p, static_cast<const unsigned char*>(end)});
+  *start = p + r.first;
+  return r.second;
+}
+
+const char* glean_pop_value_fact(
+    const void** start,
+    const void* end,
+    glean_fact_id_t* fact) {
+  return pop_value(start, end, [=](binary::Input& input) {
+    *fact = input.packed<Id>().toThrift();
+  });
+}
+
+const char*
+glean_push_fact(Output* builder, int64_t pid, Output* clause, size_t key_size) {
+  return ffi::wrap([=] {
+    CHECK_GE(clause->size(), key_size);
+    Fact::serialize(
+        *builder,
+        Pid::fromThrift(pid),
+        Fact::Clause::from(clause->bytes(), key_size));
+  });
+}
+
+size_t glean_string_demangle_trusted(
+    const uint8_t* start,
+    size_t size,
+    uint8_t* buffer) {
+  return demangleTrustedString({start, size}, buffer);
+}
+
+void glean_free_query_results(QueryResults* results) {
+  ffi::free_(results);
+}
+
+const char* glean_subroutine_new(
+    const uint64_t* code,
+    size_t code_size,
+    size_t inputs,
+    size_t outputs,
+    size_t locals,
+    const uint64_t* constants_ptr,
+    size_t constants_size,
+    const void* const* literal_ptrs,
+    const size_t* literal_sizes,
+    size_t literal_count,
+    SharedSubroutine** sub) {
+  return ffi::wrap([=] {
+    std::vector<uint64_t> constants(
+        constants_ptr, constants_ptr + constants_size);
+    std::vector<std::string> literals;
+    literals.reserve(literal_count);
+    for (size_t i = 0; i < literal_count; ++i) {
+      literals.push_back(std::string(
+          static_cast<const char*>(literal_ptrs[i]), literal_sizes[i]));
+    }
+    *sub = new SharedSubroutine{std::make_shared<Subroutine>(Subroutine{
+        std::vector<uint64_t>(code, code + code_size),
+        inputs,
+        outputs,
+        locals,
+        std::move(constants),
+        std::move(literals)})};
+  });
+}
+void glean_subroutine_free(SharedSubroutine* sub) {
+  ffi::free_(sub);
+}
+
+void glean_subroutine_inspect(
+    SharedSubroutine* sub,
+    const uint64_t** code,
+    size_t* code_size,
+    size_t* inputs,
+    size_t* outputs,
+    size_t* locals,
+    const uint64_t** constants,
+    size_t* constants_size,
+    size_t* lit_count) {
+  *code = sub->value->code.data();
+  *code_size = sub->value->code.size();
+  *inputs = sub->value->inputs;
+  *outputs = sub->value->outputs;
+  *locals = sub->value->locals;
+  *constants = sub->value->constants.data();
+  *constants_size = sub->value->constants.size();
+  *lit_count = sub->value->literals.size();
+}
+
+size_t glean_subroutine_size(SharedSubroutine* sub) {
+  return sub->value->size();
+}
+
+void glean_subroutine_literal(
+    SharedSubroutine* sub,
+    size_t index,
+    const void** ptr,
+    size_t* size) {
+  if (index < sub->value->literals.size()) {
+    *ptr = sub->value->literals[index].data();
+    *size = sub->value->literals[index].size();
+  } else {
+    *ptr = nullptr;
+    *size = 0;
+  }
+}
+
+const char* glean_invoke_typechecker(
+    const SharedSubroutine* typechecker,
+    const void* input,
+    size_t input_size,
+    void** output,
+    size_t* output_size) {
+  return ffi::wrap([=] {
+    binary::Output out;
+    uint64_t dummy;
+    auto rename = Predicate::Rename([](Id id, Pid) { return id; });
+    Predicate::runTypecheck(
+        *typechecker->value,
+        rename,
+        Fact::Clause::fromKey(
+            {static_cast<const unsigned char*>(input), input_size}),
+        out,
+        dummy);
+    ffi::clone_bytes(out.bytes()).release_to(output, output_size);
+  });
+}
+
+const char* glean_validate(
+    const Inventory* inventory,
+    char typecheck,
+    char keys,
+    size_t limit,
+    Lookup* lookup) {
+  return ffi::wrap([=] {
+    Validate v;
+    v.typecheck = typecheck != 0;
+    v.keys = keys != 0;
+    v.limit = limit;
+    validate(*inventory, v, *lookup);
+  });
+}
+
+void glean_ownership_unit_iterator_free(OwnershipUnitIterator* iter) {
+  ffi::free_(iter);
+}
+
+void glean_derived_fact_ownership_iterator_free(
+    DerivedFactOwnershipIterator* iter) {
+  ffi::free_(iter);
+}
+
+const char* glean_ownership_compute(
+    Inventory* inventory,
+    Lookup* lookup,
+    OwnershipUnitIterator* iter,
+    Lookup* base_lookup,
+    ComputedOwnership** result) {
+  return ffi::wrap([=] {
+    *result =
+        computeOwnership(*inventory, *lookup, base_lookup, iter).release();
+  });
+}
+
+void glean_ownership_free(Ownership* own) {
+  ffi::free_(own);
+}
+
+void glean_computed_ownership_free(ComputedOwnership* own) {
+  ffi::free_(own);
+}
+
+const char* glean_ownership_next_set_id(
+    Ownership* ownership,
+    uint32_t* result) {
+  return ffi::wrap([=] { *result = ownership->nextSetId(); });
+}
+
+const char*
+glean_get_fact_owner(Lookup* lookup, glean_fact_id_t fact, uint32_t* uset_id) {
+  return ffi::wrap([=] { *uset_id = lookup->getOwner(Id::fromWord(fact)); });
+}
+
+const char* glean_get_ownership_set(
+    Ownership* ownership,
+    uint32_t uset_id,
+    int* op,
+    OwnershipSet** result) {
+  return ffi::wrap([=] {
+    auto exp = ownership->getUset(uset_id);
+    if (!exp.hasValue()) {
+      *result = nullptr;
+    } else {
+      std::vector<uint32_t> elts;
+      exp->set.foreach([&](UsetId setid) { elts.push_back(setid); });
+      *op = exp->op;
+      *result = new HsArray(std::move(elts));
+    };
+  });
+}
+
+const char* glean_slice_compute(
+    Ownership* ownership,
+    uint32_t* unit_ids,
+    size_t unit_ids_size,
+    int exclude,
+    Slice** bases,
+    size_t num_bases,
+    Slice** result) {
+  return ffi::wrap([=] {
+    auto vec = std::vector<uint32_t>(unit_ids, unit_ids + unit_ids_size);
+    std::sort(vec.begin(), vec.end());
+    std::vector<const Slice*> slices(bases, bases + num_bases);
+    *result = slice(*ownership, Slices(std::move(slices)), vec, exclude != 0)
+                  .release();
+  });
+}
+
+const char*
+glean_slice_serialize(Slice* slice, const void** data, size_t* size) {
+  return ffi::wrap([=] {
+    binary::Output bytes;
+    slice->serialize(bytes);
+    ffi::clone_bytes(bytes.bytes()).release_to(data, size);
+  });
+}
+
+const char*
+glean_slice_deserialize(const void* data, size_t size, Slice** slice) {
+  return ffi::wrap([=] {
+    binary::Input bytes(data, size);
+    *slice = Slice::deserialize(bytes).release();
+  });
+}
+
+void glean_slice_free(Slice* slice) {
+  ffi::free_(slice);
+}
+
+const char* glean_make_sliced_stack(
+    Lookup* lookup,
+    size_t count,
+    Slice** slices,
+    SlicedStack** sliced) {
+  return ffi::wrap([=] {
+    std::vector<const Slice*> list(slices, slices + count);
+    *sliced = new Sliced<Slices>(lookup, Slices(std::move(list)));
+  });
+}
+
+void glean_sliced_stack_free(SlicedStack* sliced) {
+  ffi::free_(sliced);
+};
+
+const char* glean_new_define_ownership(
+    Ownership* own,
+    int64_t first_id,
+    DefineOwnership** result) {
+  return ffi::wrap(
+      [=] { *result = new DefineOwnership(own, Id::fromWord(first_id)); });
+}
+
+const char* glean_define_ownership_subst(
+    DefineOwnership* define,
+    const Substitution* subst) {
+  return ffi::wrap([=] { define->subst(*subst); });
+}
+
+const char* glean_define_ownership_sort_by_owner(
+    DefineOwnership* define,
+    uint64_t facts,
+    int64_t* order,
+    size_t size,
+    HsArray<int64_t>* result) {
+  return ffi::wrap([=] {
+    std::vector<int64_t> vec(order, order + size);
+    define->sortByOwner(facts, vec);
+    *result = vec;
+  });
+}
+
+namespace {
+struct DependencyIterator : DerivedDependencyIterator {
+  DependencyIterator(
+      size_t size_,
+      uint64_t** facts_lists,
+      size_t* facts_lists_sizes,
+      uint64_t** deps_lists,
+      size_t* deps_lists_sizes)
+      : size_(size_),
+        facts_lists(facts_lists),
+        facts_lists_sizes(facts_lists_sizes),
+        deps_lists(deps_lists),
+        deps_lists_sizes(deps_lists_sizes),
+        ix(0) {}
+
+  folly::Optional<std::pair<std::vector<Id>, std::vector<Id>>> get() override {
+    if (ix < size_) {
+      std::vector<Id> facts;
+      const auto facts_size = facts_lists_sizes[ix];
+      facts.reserve(facts_size);
+      std::transform(
+          facts_lists[ix],
+          facts_lists[ix] + facts_size,
+          std::back_inserter(facts),
+          Id::fromThrift);
+      std::vector<Id> deps;
+      const auto dep_size = deps_lists_sizes[ix];
+      deps.reserve(dep_size);
+      std::transform(
+          deps_lists[ix],
+          deps_lists[ix] + dep_size,
+          std::back_inserter(deps),
+          Id::fromThrift);
+
+      ix++;
+      return std::pair(std::move(facts), std::move(deps));
+    }
+    return folly::none;
+  }
+
+ private:
+  size_t size_;
+  uint64_t** facts_lists;
+  size_t* facts_lists_sizes;
+  uint64_t** deps_lists;
+  size_t* deps_lists_sizes;
+  size_t ix;
+};
+
+} // namespace
+
+const char* glean_define_ownership_add_derived(
+    Lookup* lookup,
+    DefineOwnership* define,
+    uint64_t pid_raw,
+    size_t fids_size,
+    uint64_t** facts_lists,
+    size_t* facts_lists_sizes,
+    uint64_t** deps_lists,
+    size_t* deps_lists_sizes) {
+  return ffi::wrap([=] {
+    auto it = DependencyIterator(
+        fids_size,
+        facts_lists,
+        facts_lists_sizes,
+        deps_lists,
+        deps_lists_sizes);
+    addDerived(lookup, define, Pid::fromThrift(pid_raw), &it);
+  });
+}
+
+void glean_define_ownership_free(DefineOwnership* def) {
+  ffi::free_(def);
+}
+
+const char* glean_derived_ownership_compute(
+    Ownership* own,
+    Lookup* base_lookup,
+    DerivedFactOwnershipIterator* iter,
+    ComputedOwnership** result) {
+  return ffi::wrap([=] {
+    *result = computeDerivedOwnership(*own, base_lookup, iter).release();
+  });
+}
+
+const char* glean_get_ownership_stats(Ownership* own, OwnershipStats* result) {
+  return ffi::wrap([=] { *result = own->getStats(); });
+}
+}
+} // namespace c
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ffi.h b/glean/rts/ffi.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ffi.h
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+template <typename T>
+#ifdef __HSC2HS__
+struct HsArray;
+#else
+class HsArray;
+#endif
+#endif
+
+#ifdef __cplusplus
+namespace facebook {
+namespace glean {
+namespace binary {
+#endif
+
+typedef struct Output Output;
+
+#ifdef __cplusplus
+}
+}
+}
+#endif
+
+#ifdef __cplusplus
+namespace facebook {
+namespace glean {
+namespace rts {
+#endif
+
+// @lint-ignore-every CLANGTIDY facebook-hte-Typedef
+typedef struct Lookup Lookup;
+typedef struct Define Define;
+typedef struct FactSet FactSet;
+typedef struct Inventory Inventory;
+typedef struct LookupCache LookupCache;
+typedef struct Predicate Predicate;
+typedef struct Substitution Substitution;
+typedef struct QueryResults QueryResults;
+typedef struct OwnershipUnitIterator OwnershipUnitIterator;
+typedef struct DerivedFactOwnershipIterator DerivedFactOwnershipIterator;
+typedef struct Ownership Ownership;
+typedef struct OwnershipStats OwnershipStats;
+typedef struct DefineOwnership DefineOwnership;
+typedef struct ComputedOwnership ComputedOwnership;
+typedef struct Slice Slice;
+typedef struct Slices Slices;
+
+#ifdef __cplusplus
+template <typename Slice>
+struct Sliced;
+using SlicedStack = Sliced<Slices>;
+#else
+typedef void SlicedStack;
+#endif
+
+#ifdef __cplusplus
+}
+}
+}
+#endif
+
+#ifdef __cplusplus
+namespace facebook {
+namespace glean {
+namespace rts {
+namespace c {
+
+using binary::Output;
+#endif
+
+typedef struct SharedLookupCacheStats SharedLookupCacheStats;
+typedef struct SharedSubroutine SharedSubroutine;
+
+typedef struct FactCount {
+  uint64_t pid;
+  uint64_t count;
+} FactCount;
+
+#ifdef __cplusplus
+using FactOrder = HsArray<int64_t>;
+using OwnershipSet = HsArray<uint32_t>;
+#else
+typedef void FactOrder;
+typedef void OwnershipSet;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int64_t glean_fact_id_t;
+typedef int64_t glean_predicate_id_t;
+
+const char* glean_inventory_new(
+    size_t count,
+    const int64_t* ids,
+    const void* const* name_ptrs,
+    const size_t* name_sizes,
+    const int32_t* versions,
+    SharedSubroutine* const* typecheckers,
+    SharedSubroutine* const* traversals,
+    Inventory** inventory);
+void glean_inventory_free(Inventory* inventory);
+
+const char* glean_inventory_predicates(
+    Inventory* inventory,
+    size_t* count,
+    const Predicate*** predicates);
+
+const char* glean_inventory_serialize(
+    Inventory* inventory,
+    const void** data,
+    size_t* size);
+
+const char* glean_inventory_deserialize(
+    const void* data,
+    size_t size,
+    Inventory** inventory);
+
+const char* glean_inventory_equal(
+    const Inventory* first,
+    const Inventory* second,
+    bool* result);
+
+const char* glean_predicate_unpack(
+    Predicate* predicate,
+    int64_t* id,
+    const void** name,
+    size_t* name_size,
+    int32_t* version);
+
+const char*
+glean_snapshot_new(Lookup* base, int64_t boundary, Lookup** snapshot);
+
+const char* glean_lookupcache_stats_new(SharedLookupCacheStats** stats);
+void glean_lookupcache_stats_free(SharedLookupCacheStats* stats);
+void glean_lookupcache_stats_read_and_reset_counters(
+    SharedLookupCacheStats* stats,
+    uint64_t* values,
+    size_t size);
+
+const char* glean_lookupcache_new(
+    size_t capacity,
+    size_t shards,
+    SharedLookupCacheStats* stats,
+    LookupCache** cache);
+void glean_lookupcache_free(LookupCache* cache);
+const char* glean_lookupcache_clear(LookupCache* cache);
+
+const char* glean_lookupcache_anchor_new(
+    Lookup* base,
+    LookupCache* cache,
+    int replacementPolicy,
+    Lookup** anchor);
+void glean_lookupcache_anchor_free(Lookup* anchor);
+
+const char* glean_query_execute_compiled(
+    Inventory* inventory,
+    Define* facts,
+    DefineOwnership* ownership,
+    SharedSubroutine* sub,
+    uint64_t pid,
+    SharedSubroutine* traverse,
+    uint64_t max_results,
+    uint64_t max_bytes,
+    uint64_t max_time_ms,
+    uint64_t max_set_size,
+    uint64_t recursive,
+    uint64_t* expand_pids,
+    uint64_t num_expand_pids,
+    uint64_t want_stats,
+    QueryResults** presults);
+
+const char* glean_query_restart_compiled(
+    Inventory* inventory,
+    Define* facts,
+    DefineOwnership* ownership,
+    void* cont,
+    int64_t cont_size,
+    uint64_t max_results,
+    uint64_t max_bytes,
+    uint64_t max_time_ms,
+    uint64_t max_set_size,
+    uint64_t recursive,
+    uint64_t* expand_pids,
+    uint64_t num_expand_pids,
+    uint64_t want_stats,
+    QueryResults** results);
+
+void glean_lookup_free(Lookup* lookup);
+
+const char* glean_lookup_starting_id(Lookup* lookup, int64_t* id);
+const char* glean_lookup_first_free_id(Lookup* lookup, int64_t* id);
+
+const char* glean_lookup_fact(
+    Lookup* lookup,
+    int64_t id,
+    int64_t* type,
+    void** key,
+    size_t* key_size,
+    void** value,
+    size_t* value_size);
+
+const char* glean_define_fact(
+    Define* facts,
+    glean_predicate_id_t predicate,
+    Output* clause,
+    size_t key_size,
+    glean_fact_id_t* id);
+
+const char* glean_define_batch(
+    Define* facts,
+    Inventory* inventory,
+    int64_t batch_first_id,
+    const int64_t* ids,
+    size_t batch_count,
+    const void* batch_facts_data,
+    size_t batch_facts_size,
+    bool trust_refs,
+    bool ignore_redefs,
+    Substitution** subst);
+
+const char* glean_new_subst(int64_t first, size_t size, Substitution** subst);
+void glean_free_subst(Substitution* subst);
+const char* glean_subst_compose(
+    const Substitution* first,
+    const Substitution* second,
+    Substitution** result);
+const char* glean_serialize_subst(
+    const Substitution* subst,
+    int64_t* firstId,
+    size_t* count,
+    int64_t** ids);
+const char* glean_subst_deserialize(
+    int64_t firstId,
+    size_t count,
+    int64_t* ids,
+    Substitution** result);
+
+const char* glean_subst_intervals(
+    const Substitution* subst,
+    const glean_fact_id_t* ins,
+    size_t ins_size,
+    glean_fact_id_t** outs,
+    size_t* outs_size);
+
+const char* glean_subst_subst(
+    const Substitution* subst,
+    const glean_fact_id_t id,
+    glean_fact_id_t* res);
+
+uint64_t glean_subst_offset(const Substitution* subst);
+
+const char* glean_factset_new(int64_t first_id, FactSet** facts);
+void glean_factset_free(FactSet* facts);
+
+size_t glean_factset_fact_count(FactSet* facts);
+
+size_t glean_factset_fact_memory(FactSet* facts);
+
+size_t glean_factset_allocated_memory(FactSet* facts);
+
+const char* glean_factset_predicateStats(
+    FactSet* facts,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes);
+
+Lookup* glean_factset_lookup(FactSet* facts);
+Define* glean_factset_define(FactSet* define);
+
+const char* glean_factset_serialize(
+    FactSet* facts,
+    int64_t* first_id,
+    size_t* count,
+    void** facts_data,
+    size_t* facts_size);
+
+const char* glean_factset_serializeReorder(
+    FactSet* facts,
+    uint64_t* order,
+    size_t order_size,
+    int64_t* first_id,
+    size_t* count,
+    void** facts_data,
+    size_t* facts_size);
+
+const char* glean_factset_append(FactSet* target, FactSet* source);
+
+const char* glean_factset_rebase(
+    FactSet* facts,
+    const Inventory* inventory,
+    const Substitution* subst,
+    LookupCache* cache,
+    FactSet** result,
+    Substitution** out_subst);
+
+const char*
+glean_stacked_lookup_new(Lookup* base, Lookup* added, Lookup** stacked);
+
+const char*
+glean_stacked_define_new(Lookup* base, Define* added, Define** stacked);
+void glean_stacked_define_free(Define* stacked);
+
+const char* glean_new_builder(Output** builder);
+void glean_free_builder(Output* builder);
+
+size_t glean_builder_size(Output* builder);
+
+const char* glean_finish_builder(Output* builder, void** data, size_t* size);
+
+const char* glean_reset_builder(Output* builder);
+
+const char* glean_push_value_byte(Output* builder, unsigned char val);
+const char*
+glean_push_value_bytes(Output* builder, const void* data, size_t size);
+const char* glean_push_value_nat(Output* builder, uint64_t val);
+const char* glean_push_value_array(Output* builder, size_t size);
+const char* glean_push_value_set(Output* builder, size_t size);
+const char* glean_push_value_selector(Output* builder, size_t selector);
+const char*
+glean_push_value_string(Output* builder, const void* data, size_t size);
+const char* glean_push_value_fact(Output* builder, glean_fact_id_t fact);
+
+const char*
+glean_pop_value_byte(const void** start, const void* end, uint8_t* byte);
+const char*
+glean_pop_value_nat(const void** start, const void* end, uint64_t* nat);
+const char*
+glean_pop_value_array(const void** start, const void* end, size_t* size);
+const char*
+glean_pop_value_set(const void** start, const void* end, size_t* size);
+const char* glean_pop_value_bytes_ref(
+    const void** start,
+    const void* end,
+    size_t size,
+    const void** bytes);
+const char* glean_pop_value_bytes(
+    const void** start,
+    const void* end,
+    size_t size,
+    void** bytes);
+const char*
+glean_pop_value_selector(const void** start, const void* end, size_t* selector);
+size_t glean_pop_value_trusted_string_ref(const void** start, const void* end);
+const char* glean_pop_value_string(
+    const void** start,
+    const void* end,
+    void** bytes,
+    size_t* size);
+const char* glean_pop_value_fact(
+    const void** start,
+    const void* end,
+    glean_fact_id_t* fact);
+
+const char*
+glean_push_fact(Output* builder, int64_t pid, Output* data, size_t key_size);
+
+size_t glean_string_demangle_trusted(
+    const uint8_t* start,
+    size_t size,
+    uint8_t* buffer);
+
+void glean_free_query_results(QueryResults* results);
+
+const char* glean_subroutine_new(
+    const uint64_t* code,
+    size_t code_size,
+    size_t inputs,
+    size_t outputs,
+    size_t locals,
+    const uint64_t* constants_ptr,
+    size_t constants_size,
+    const void* const* literal_ptrs,
+    const size_t* literal_sizes,
+    size_t literal_count,
+    SharedSubroutine** sub);
+
+void glean_subroutine_free(SharedSubroutine* sub);
+
+void glean_subroutine_inspect(
+    SharedSubroutine* sub,
+    const uint64_t** code,
+    size_t* code_size,
+    size_t* inputs,
+    size_t* outputs,
+    size_t* locals,
+    const uint64_t** constants,
+    size_t* constants_size,
+    size_t* lit_count);
+
+size_t glean_subroutine_size(SharedSubroutine* sub);
+
+void glean_subroutine_literal(
+    SharedSubroutine* sub,
+    size_t index,
+    const void** ptr,
+    size_t* size);
+
+const char* glean_invoke_typechecker(
+    const SharedSubroutine* typechecker,
+    const void* input,
+    size_t input_size,
+    void** output,
+    size_t* output_size);
+
+const char* glean_validate(
+    const Inventory* inventory,
+    char typecheck,
+    char keys,
+    size_t limit,
+    Lookup* lookup);
+
+void glean_ownership_unit_iterator_free(OwnershipUnitIterator*);
+
+void glean_derived_fact_ownership_iterator_free(DerivedFactOwnershipIterator*);
+
+const char* glean_ownership_compute(
+    Inventory* inventory,
+    Lookup* lookup,
+    OwnershipUnitIterator* iter,
+    Lookup* base_lookup,
+    ComputedOwnership** ownership);
+
+void glean_ownership_free(Ownership* own);
+
+void glean_computed_ownership_free(ComputedOwnership* own);
+
+const char* glean_ownership_next_set_id(Ownership* ownership, uint32_t* result);
+
+const char* glean_get_ownership_set(
+    Ownership* ownership,
+    uint32_t uset_id,
+    int* op,
+    OwnershipSet** result);
+
+const char*
+glean_get_fact_owner(Lookup* lookup, glean_fact_id_t fact, uint32_t* uset_id);
+
+const char* glean_slice_compute(
+    Ownership* ownership,
+    uint32_t* unit_ids,
+    size_t unit_ids_size,
+    int exclude,
+    Slice** bases,
+    size_t num_bases,
+    Slice** result);
+
+const char*
+glean_slice_serialize(Slice* slice, const void** data, size_t* size);
+
+const char*
+glean_slice_deserialize(const void* data, size_t size, Slice** slice);
+
+void glean_slice_free(Slice* slice);
+
+const char* glean_make_sliced_stack(
+    Lookup* lookup,
+    size_t count,
+    Slice** slices,
+    SlicedStack** sliced);
+
+void glean_sliced_stack_free(SlicedStack* sliced);
+
+const char* glean_new_define_ownership(
+    Ownership* own,
+    int64_t first_id,
+    DefineOwnership** result);
+
+const char* glean_define_ownership_subst(
+    DefineOwnership* define,
+    const Substitution* subst);
+
+const char* glean_define_ownership_sort_by_owner(
+    DefineOwnership* define,
+    uint64_t facts,
+    int64_t* order,
+    size_t size,
+    FactOrder* result);
+
+const char* glean_define_ownership_add_derived(
+    Lookup* lookup,
+    DefineOwnership* define,
+    uint64_t pid_,
+    size_t fids_size,
+    uint64_t** facts_lists,
+    size_t* facts_lists_sizes,
+    uint64_t** deps_lists,
+    size_t* deps_lists_sizes);
+
+void glean_define_ownership_free(DefineOwnership* def);
+
+const char* glean_derived_ownership_compute(
+    Ownership* own,
+    Lookup* base_lookup,
+    DerivedFactOwnershipIterator* iter,
+    ComputedOwnership** result);
+
+const char* glean_get_ownership_stats(Ownership* own, OwnershipStats* result);
+
+#ifdef __cplusplus
+}
+}
+}
+}
+}
+#endif
diff --git a/glean/rts/id.h b/glean/rts/id.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/id.h
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Format.h>
+#include <folly/Hash.h>
+#include <folly/container/HeterogeneousAccess.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+const uint64_t FIRST_FREE_ID = 1024;
+const uint64_t INVALID_ID = 0;
+
+template <typename Tag>
+struct WordId {
+  // We might use uint32_t for pids in the future
+  using word_type = uint64_t;
+
+  // The FFI interface uses signed integers, because we need
+  // to send data over Thrift which doesn't have unsigned types
+  // and it's easier to convert at the FFI boundary.
+  using thrift_word_type = int64_t;
+
+  WordId() : val(0) {}
+
+  WordId(const WordId&) = default;
+  WordId& operator=(const WordId&) = default;
+
+  static constexpr WordId invalid() {
+    return WordId(INVALID_ID);
+  }
+
+  static constexpr WordId lowest() {
+    return WordId(FIRST_FREE_ID);
+  }
+
+  explicit operator bool() const {
+    return val != INVALID_ID;
+  }
+
+  bool operator==(const WordId& other) const {
+    return val == other.val;
+  }
+
+  bool operator!=(const WordId& other) const {
+    return val != other.val;
+  }
+
+  bool operator<=(const WordId& other) const {
+    return val <= other.val;
+  }
+
+  bool operator<(const WordId& other) const {
+    return val < other.val;
+  }
+
+  bool operator>=(const WordId& other) const {
+    return val >= other.val;
+  }
+
+  bool operator>(const WordId& other) const {
+    return val > other.val;
+  }
+
+  WordId operator+(word_type i) const {
+    return WordId(val + i);
+  }
+
+  WordId& operator+=(word_type i) {
+    val += i;
+    return *this;
+  }
+
+  WordId& operator++() {
+    ++val;
+    return *this;
+  }
+
+  WordId operator++(int) {
+    return WordId(val++);
+  }
+
+  WordId operator-(word_type i) const {
+    assert(val > i);
+    return WordId(val - i);
+  }
+
+  WordId& operator-=(word_type i) {
+    assert(val > i);
+    val -= i;
+    return *this;
+  }
+
+  word_type operator-(WordId other) const {
+    assert(val >= other.val);
+    return val - other.val;
+  }
+
+  WordId& operator--() {
+    assert(val > 1);
+    --val;
+    return *this;
+  }
+
+  WordId operator--(int) {
+    assert(val > 1);
+    return WordId(val--);
+  }
+
+  constexpr word_type toWord() const {
+    return val;
+  }
+
+  static constexpr WordId fromWord(word_type x) {
+    return WordId(x);
+  }
+
+  constexpr thrift_word_type toThrift() const {
+    return static_cast<thrift_word_type>(val);
+  }
+
+  static constexpr WordId fromThrift(thrift_word_type id) {
+    return WordId(id);
+  }
+
+ private:
+  explicit constexpr WordId(word_type x) : val(x) {}
+
+  word_type val = static_cast<word_type>(0);
+};
+
+template <typename Tag>
+inline typename WordId<Tag>::word_type distance(
+    WordId<Tag> from,
+    WordId<Tag> to) {
+  assert(from <= to);
+  return to.toWord() - from.toWord();
+}
+
+struct Pid_tag;
+struct Fid_tag;
+
+using Pid = WordId<Pid_tag>;
+using Id = WordId<Fid_tag>;
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
+
+namespace folly {
+
+template <typename T>
+class FormatValue<facebook::glean::rts::WordId<T>> {
+ public:
+  facebook::glean::rts::WordId<T> id;
+
+  explicit FormatValue(facebook::glean::rts::WordId<T> i) : id(i) {}
+
+  template <class Callback>
+  void format(FormatArg& arg, Callback& cb) const {
+    return FormatValue<typename facebook::glean::rts::WordId<T>::word_type>(
+               id.toWord())
+        .format(arg, cb);
+  }
+};
+
+template <typename T>
+struct hasher<facebook::glean::rts::WordId<T>> {
+  using word_hasher =
+      hasher<typename facebook::glean::rts::WordId<T>::word_type>;
+  using folly_is_avalanching = typename word_hasher::folly_is_avalanching;
+
+  size_t operator()(facebook::glean::rts::WordId<T> id) const noexcept {
+    return Hash()(id.toWord());
+  }
+};
+
+template <typename T>
+struct HeterogeneousAccessHash<facebook::glean::rts::WordId<T>>
+    : hasher<facebook::glean::rts::WordId<T>> {
+  using is_transparent = void;
+};
+
+} // namespace folly
diff --git a/glean/rts/inventory.cpp b/glean/rts/inventory.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/inventory.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/inventory.h"
+#include "glean/rts/bytecode/subroutine.h"
+#include "glean/rts/serialize.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+bool Predicate::operator==(const Predicate& other) const {
+  return id == other.id &&
+      (id == id.invalid() ||
+       (name == other.name && version == other.version &&
+        *typechecker == *other.typechecker && *traverser == *other.traverser));
+}
+
+Inventory::Inventory() : first_id(Pid::lowest()) {}
+
+Inventory::Inventory(std::vector<Predicate> ps) {
+  first_id = Pid::invalid();
+  auto last_id = Pid::lowest();
+  for (const auto& p : ps) {
+    assert(p.id);
+    if (!first_id) {
+      first_id = p.id;
+    } else {
+      first_id = std::min(first_id, p.id);
+    }
+    last_id = std::max(last_id, p.id + 1);
+  }
+
+  preds = std::vector<Predicate>(
+      distance(first_id ? first_id : Pid::lowest(), last_id),
+      Predicate{Pid::invalid(), {}, 0, {}});
+  for (auto& p : ps) {
+    const auto i = distance(first_id, p.id);
+    preds[i] = std::move(p);
+  }
+}
+
+const Predicate* FOLLY_NULLABLE Inventory::lookupPredicate(Pid id) const& {
+  if (id >= firstId()) {
+    const auto i = distance(firstId(), id);
+    return i < preds.size() && preds[i].id ? &preds[i] : nullptr;
+  } else {
+    return nullptr;
+  }
+}
+
+std::vector<const Predicate*> Inventory::predicates() const {
+  std::vector<const Predicate*> ps;
+  ps.reserve(preds.size());
+  for (const auto& p : preds) {
+    if (p.id) {
+      ps.push_back(&p);
+    }
+  }
+  return ps;
+}
+
+std::string Inventory::serialize() const {
+  binary::Output out;
+  using namespace serialize;
+  put(out, preds.size());
+  for (const auto& p : preds) {
+    put(out, p.id);
+    if (p.id) {
+      put(out, p.name);
+      put(out, p.version);
+      put(out, *p.typechecker);
+      put(out, *p.traverser);
+    }
+  }
+  return out.string();
+}
+
+Inventory Inventory::deserialize(folly::ByteRange bytes) {
+  binary::Input in(bytes);
+  std::vector<Predicate> preds;
+  size_t count;
+  using namespace serialize;
+  get(in, count);
+  for (size_t i = 0; i < count; i++) {
+    Predicate p;
+    get(in, p.id);
+    if (p.id) {
+      get(in, p.name);
+      get(in, p.version);
+      p.typechecker = std::make_shared<Subroutine>();
+      p.traverser = std::make_shared<Subroutine>();
+      serialize::get(in, *p.typechecker);
+      serialize::get(in, *p.traverser);
+      preds.push_back(std::move(p));
+    }
+  }
+  return Inventory(std::move(preds));
+}
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/inventory.h b/glean/rts/inventory.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/inventory.h
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/bytecode/subroutine.h"
+#include "glean/rts/bytecode/syscall.h"
+#include "glean/rts/fact.h"
+#include "glean/rts/id.h"
+#include "glean/rts/set.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+// NOTE: Any changes here should also be propagated to the internal.thrift
+// types and serialize and deserialize should be updated accordingly.
+//
+// We aren't using the Thrift types here because it isn't clear if those will
+// be needed in the long term and it's nice to be able to have methods.
+
+/// Information about a predicate in an open DB.
+struct Predicate {
+  Pid id;
+  std::string name;
+  int32_t version;
+
+  // This adds an indirection to the rename call, which is not ideal.
+  template <typename F>
+  struct Rename : SetOps {
+    explicit Rename(F&& rename_fun) : rename_fun(rename_fun) {}
+
+    Id rename(Id id, Pid type) const {
+      return rename_fun(id, type);
+    }
+
+    F rename_fun;
+  };
+
+  template <typename Context>
+  using Descend = SysCalls<Context, SysCall<Id, Pid>>;
+
+  /// Typechecker for clauses. It should take the following arguments:
+  ///
+  /// std::function<Id(Id id, Id type)> - fact substitution
+  /// Set syscalls
+  /// const void * - begin of clause/key
+  /// const void * - end of key/begin of value
+  /// const void * - end of clause/value
+  /// binary::Output * - substituted clause
+  ///
+  /// Returns size of substituted key in first result register
+  std::shared_ptr<Subroutine> typechecker;
+
+  /// Generic fact traversal. Takes these arguments:
+  ///
+  /// std::function<void(Id id, Pid type)> - called for each fact ID
+  /// const void * - begin of clause/key
+  /// const void * - end of key/begin of value
+  /// const void * - end of clause/value
+  std::shared_ptr<Subroutine> traverser;
+
+  bool operator==(const Predicate& other) const;
+  bool operator!=(const Predicate& other) const {
+    return !(*this == other);
+  }
+
+  template <typename F>
+  void typecheck(
+      Rename<F>& rename,
+      Fact::Clause clause,
+      binary::Output& output,
+      uint64_t& key_size) const {
+    runTypecheck(*typechecker, rename, clause, output, key_size);
+  }
+
+  template <typename F>
+  void substitute(
+      Rename<F>& rename,
+      Fact::Clause clause,
+      binary::Output& output,
+      uint64_t& key_size) const {
+    // TODO: We implement substitution via the typechecker for now but it we
+    // might want to generate a more efficient subroutine just for substitution.
+    typecheck(rename, clause, output, key_size);
+  }
+
+  template <typename F>
+  static void runTypecheck(
+      const Subroutine& sub,
+      Rename<F>& rename,
+      Fact::Clause clause,
+      binary::Output& output,
+      uint64_t& key_size) {
+    const auto context_ = syscalls<
+        &Rename<F>::rename,
+        &Rename<F>::newSet,
+        &Rename<F>::insertOutputSet,
+        &Rename<F>::setToArray,
+        &Rename<F>::freeSet,
+        &Rename<F>::newWordSet,
+        &Rename<F>::insertBytesWordSet,
+        &Rename<F>::wordSetToArray,
+        &Rename<F>::byteSetToByteArray,
+        &Rename<F>::freeWordSet>(rename);
+
+    Subroutine::Activation::with(
+        sub, context_.contextptr(), [&](auto& activation) {
+          activation.start();
+          auto args = activation.args();
+          args = std::copy(
+              context_.handlers_begin(), context_.handlers_end(), args);
+          *args++ = reinterpret_cast<uint64_t>(clause.data);
+          *args++ = reinterpret_cast<uint64_t>(clause.data + clause.key_size);
+          *args++ = reinterpret_cast<uint64_t>(clause.data + clause.size());
+
+          activation.execute();
+          assert(!activation.suspended());
+
+          output = std::move(activation.output(0));
+          key_size = activation.results()[0];
+        });
+  }
+
+  template <typename Context>
+  void traverse(const Descend<Context>& descend, Fact::Clause clause) const {
+    runTraverse(*traverser, descend, clause);
+  }
+
+  template <typename Context>
+  static void runTraverse(
+      const Subroutine& sub,
+      const Descend<Context>& descend,
+      Fact::Clause clause) {
+    Subroutine::Activation::with(
+        sub, descend.contextptr(), [&](auto& activation) {
+          activation.run(
+              {*descend.handlers_begin(),
+               reinterpret_cast<uint64_t>(clause.data),
+               reinterpret_cast<uint64_t>(clause.data + clause.key_size),
+               reinterpret_cast<uint64_t>(clause.data + clause.size())});
+        });
+  }
+};
+
+/// Information about predicates in an open DB.
+struct Inventory {
+ public:
+  Inventory();
+
+  // The ids in 'predicates' are expected to be mostly dense (gaps are ok for
+  // now but the Inventory will use O(max_id - min_id) space.
+  explicit Inventory(std::vector<Predicate> predicates);
+
+  const Predicate* FOLLY_NULLABLE lookupPredicate(Pid id) const&;
+
+  Pid firstId() const {
+    return first_id;
+  }
+
+  Pid firstFreeId() const {
+    return firstId() + preds.size();
+  }
+
+  // TEMPORARY
+  std::vector<const Predicate*> predicates() const;
+
+  std::string serialize() const;
+  static Inventory deserialize(folly::ByteRange);
+
+  bool operator==(const Inventory& other) const {
+    return first_id == other.first_id && preds == other.preds;
+  }
+  bool operator!=(const Inventory& other) const {
+    return !(*this == other);
+  }
+
+ private:
+  Pid first_id;
+  std::vector<Predicate> preds;
+  // an INVALID Predicate::id means there is no predicate with that id
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/json.cpp b/glean/rts/json.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/json.cpp
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/rts/json.h"
+
+#include <folly/json/dynamic.h>
+#include <folly/json/json.h>
+#include <folly/lang/ToAscii.h>
+
+using namespace facebook::hs;
+
+namespace {
+
+const folly::dynamic* todyn(glean_json_value_t* value) {
+  return reinterpret_cast<folly::dynamic*>(value);
+}
+
+glean_json_value_t* fromdyn(const folly::dynamic* dyn) {
+  return reinterpret_cast<glean_json_value_t*>(
+      const_cast<folly::dynamic*>(dyn));
+}
+
+// JSON escaping
+
+constexpr char K = 0; // keep character as is
+constexpr char Z = 1; // NUL - hex-escape but treat specially in mangled repr
+constexpr char X = 2; // hex-escape
+
+using EscapeTable = std::array<char, 256>;
+
+// JSON escape table: hescape all control characters, quotes and backslash
+constexpr EscapeTable regularEscapes = {
+    X,   X,   X,   X, X,    X,   X, X, // 0
+    'b', 't', 'n', X, 'f',  'r', X, X, // 8
+    X,   X,   X,   X, X,    X,   X, X, // 16
+    X,   X,   X,   X, X,    X,   X, X, // 24
+    K,   K,   '"', K, K,    K,   K, K, // 32
+    K,   K,   K,   K, K,    K,   K, K, // 40
+    K,   K,   K,   K, K,    K,   K, K, // 48
+    K,   K,   K,   K, K,    K,   K, K, // 56
+    K,   K,   K,   K, K,    K,   K, K, // 64
+    K,   K,   K,   K, K,    K,   K, K, // 72
+    K,   K,   K,   K, K,    K,   K, K, // 80
+    K,   K,   K,   K, '\\', K,   K, K, // 88
+    K,   K,   K,   K, K,    K,   K, K, // 96
+    K,   K,   K,   K, K,    K,   K, K, // 104
+    K,   K,   K,   K, K,    K,   K, K, // 112
+    K,   K,   K,   K, K,    K,   K, K, // 120
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K,
+};
+
+// Same as regularEscapes except that NUL is treated specially
+constexpr EscapeTable mangledEscapes = {
+    Z,   X,   X,   X, X,    X,   X, X, // 0
+    'b', 't', 'n', X, 'f',  'r', X, X, // 8
+    X,   X,   X,   X, X,    X,   X, X, // 16
+    X,   X,   X,   X, X,    X,   X, X, // 24
+    K,   K,   '"', K, K,    K,   K, K, // 32
+    K,   K,   K,   K, K,    K,   K, K, // 40
+    K,   K,   K,   K, K,    K,   K, K, // 48
+    K,   K,   K,   K, K,    K,   K, K, // 56
+    K,   K,   K,   K, K,    K,   K, K, // 64
+    K,   K,   K,   K, K,    K,   K, K, // 72
+    K,   K,   K,   K, K,    K,   K, K, // 80
+    K,   K,   K,   K, '\\', K,   K, K, // 88
+    K,   K,   K,   K, K,    K,   K, K, // 96
+    K,   K,   K,   K, K,    K,   K, K, // 104
+    K,   K,   K,   K, K,    K,   K, K, // 112
+    K,   K,   K,   K, K,    K,   K, K, // 120
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K,
+    K,   K,   K,   K, K,    K,   K, K, K, K, K, K, K, K, K, K, K, K,
+};
+
+size_t escaped_size(
+    const EscapeTable& escapes,
+    const uint8_t* text,
+    size_t text_size) noexcept {
+  size_t size = 0;
+  for (size_t i = 0; i < text_size; ++i) {
+    switch (escapes[text[i]]) {
+      case K:
+        ++size;
+        break;
+
+      case Z:
+        // \0 is represented as \0 \1 in the mangled representation
+        assert(i < text_size);
+        ++i;
+        [[fallthrough]];
+
+      case X:
+        size += 6;
+        break;
+
+      default:
+        size += 2;
+        break;
+    }
+  }
+  return size;
+}
+
+char hex(uint8_t c) {
+  return c + (c < 10 ? '0' : 'a' - 10);
+}
+
+void escape(
+    const EscapeTable& escapes,
+    const uint8_t* text,
+    size_t text_size,
+    char* out,
+    size_t escaped_size) noexcept {
+  assert(escaped_size >= text_size);
+  if (escaped_size == text_size) {
+    if (text_size != 0) {
+      memcpy(out, text, text_size);
+    }
+  } else {
+    size_t o = 0;
+    for (size_t i = 0; i < text_size; ++i) {
+      const auto c = text[i];
+      switch (escapes[c]) {
+        case K:
+          out[o++] = c;
+          break;
+
+        case Z:
+          // \0 is represented as \0 \1 in the mangled representation
+          assert(i < text_size);
+          ++i;
+          [[fallthrough]];
+
+        case X:
+          out[o++] = '\\';
+          out[o++] = 'u';
+          out[o++] = '0';
+          out[o++] = '0';
+          out[o++] = hex(c >> 4);
+          out[o++] = hex(c & 0x0F);
+          break;
+
+        default:
+          out[o++] = '\\';
+          out[o++] = escapes[c];
+          break;
+      }
+      assert(o <= escaped_size);
+    }
+    assert(o == escaped_size);
+  }
+}
+
+} // namespace
+
+extern "C" {
+
+struct glean_json_document_t {
+  folly::dynamic root;
+};
+
+const char* glean_json_parse(
+    const char* text,
+    size_t size,
+    size_t rec_limit,
+    glean_json_document_t** document) {
+  return ffi::wrap([=] {
+    folly::json::serialization_opts opts;
+    opts.recursion_limit = rec_limit;
+    auto dyn = folly::parseJson({text, size}, opts);
+    *document = new glean_json_document_t{std::move(dyn)};
+  });
+}
+
+void glean_json_document_free(glean_json_document_t* document) {
+  ffi::free_(document);
+}
+
+glean_json_value_t* glean_json_document_root(glean_json_document_t* document) {
+  return fromdyn(&document->root);
+}
+
+int glean_json_value_type(glean_json_value_t* value) {
+  return todyn(value)->type();
+}
+
+int64_t glean_json_value_get_int(glean_json_value_t* value) {
+  return todyn(value)->getInt();
+}
+
+int glean_json_value_get_bool(glean_json_value_t* value) {
+  return todyn(value)->getBool();
+}
+
+void glean_json_value_get_string(
+    glean_json_value_t* value,
+    const char** text,
+    size_t* size) {
+  *text = todyn(value)->c_str();
+  *size = todyn(value)->size();
+}
+
+size_t glean_json_value_get_size(glean_json_value_t* value) {
+  return todyn(value)->size();
+}
+
+glean_json_value_t* glean_json_value_get_array_element(
+    glean_json_value_t* value,
+    size_t index) {
+  return fromdyn(&(*todyn(value))[index]);
+}
+
+glean_json_value_t* glean_json_value_get_object_field(
+    glean_json_value_t* value,
+    const char* key_name,
+    size_t key_size) {
+  return fromdyn(todyn(value)->get_ptr(folly::StringPiece(key_name, key_size)));
+}
+
+const char*
+glean_json_encode(glean_json_value_t* value, char** out, size_t* size) {
+  return ffi::wrap([=] {
+    ffi::clone_string(folly::toJson(*todyn(value))).release_to(out, size);
+  });
+}
+
+size_t glean_json_encode_number(int64_t number, char* out) {
+  if (number < 0) {
+    *out++ = '-';
+    auto unumber = ~static_cast<uint64_t>(number) + 1;
+    auto len = folly::to_ascii_size_decimal(unumber);
+    return 1 + folly::to_ascii_decimal(out, out + len, unumber);
+  } else {
+    auto unumber = static_cast<uint64_t>(number);
+    auto len = folly::to_ascii_size_decimal(unumber);
+    return folly::to_ascii_decimal(out, out + len, unumber);
+  }
+}
+
+size_t glean_json_string_escaped_size(const uint8_t* text, size_t text_size) {
+  return escaped_size(regularEscapes, text, text_size);
+}
+
+void glean_json_string_escape(
+    const uint8_t* text,
+    size_t text_size,
+    char* out,
+    size_t escaped_size) {
+  return escape(regularEscapes, text, text_size, out, escaped_size);
+}
+
+size_t glean_json_mangled_string_escaped_size(
+    const uint8_t* text,
+    size_t text_size) {
+  assert(text_size >= 2);
+  return escaped_size(mangledEscapes, text, text_size - 2);
+}
+
+void glean_json_mangled_string_escape(
+    const uint8_t* text,
+    size_t text_size,
+    char* out,
+    size_t escaped_size) {
+  assert(text_size >= 2);
+  return escape(mangledEscapes, text, text_size - 2, out, escaped_size);
+}
+}
diff --git a/glean/rts/json.h b/glean/rts/json.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/json.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct glean_json_document_t glean_json_document_t;
+typedef struct glean_json_value_t glean_json_value_t;
+
+const char* glean_json_parse(
+    const char* text,
+    size_t size,
+    size_t rec_limit,
+    glean_json_document_t** document);
+void glean_json_document_free(glean_json_document_t*);
+
+glean_json_value_t* glean_json_document_root(glean_json_document_t*);
+
+int glean_json_value_type(glean_json_value_t*);
+
+int64_t glean_json_value_get_int(glean_json_value_t* value);
+int glean_json_value_get_bool(glean_json_value_t* value);
+void glean_json_value_get_string(
+    glean_json_value_t* value,
+    const char** text,
+    size_t* size);
+size_t glean_json_value_get_size(glean_json_value_t* value);
+glean_json_value_t* glean_json_value_get_array_element(
+    glean_json_value_t* value,
+    size_t index);
+glean_json_value_t* glean_json_value_get_object_field(
+    glean_json_value_t* value,
+    const char* key_name,
+    size_t key_size);
+void glean_json_value_index_object_field(
+    glean_json_value_t* value,
+    char** key_name,
+    size_t* key_size,
+    glean_json_value_t** field);
+
+const char*
+glean_json_encode(glean_json_value_t* value, char** out, size_t* size);
+const char* glean_json_encode_string(
+    const char* text,
+    size_t text_size,
+    char** out,
+    size_t* out_size);
+
+size_t glean_json_encode_number(int64_t number, char* out);
+
+size_t glean_json_string_escaped_size(const uint8_t* text, size_t text_size);
+void glean_json_string_escape(
+    const uint8_t* text,
+    size_t text_size,
+    char* out,
+    size_t escaped_size);
+size_t glean_json_mangled_string_escaped_size(
+    const uint8_t* text,
+    size_t text_size);
+void glean_json_mangled_string_escape(
+    const uint8_t* text,
+    size_t text_size,
+    char* out,
+    size_t escaped_size);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/glean/rts/lookup.cpp b/glean/rts/lookup.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/lookup.cpp
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/lookup.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+EmptyLookup& EmptyLookup::instance() {
+  static EmptyLookup object;
+  return object;
+}
+
+namespace {
+
+struct MergeIterator final : public FactIterator {
+  MergeIterator(
+      std::unique_ptr<FactIterator> l,
+      std::unique_ptr<FactIterator> r,
+      size_t pfxsize)
+      : left(std::move(l)),
+        right(std::move(r)),
+        current(nullptr),
+        prefix_size(pfxsize) {}
+
+  void next() override {
+    if (!current) {
+      get(KeyOnly);
+    }
+    current->next();
+    current = nullptr;
+  }
+
+  Fact::Ref get(Demand demand) override {
+    if (current) {
+      return current->get(demand);
+    } else {
+      auto l = tryGet(left, demand);
+      auto r = tryGet(right, demand);
+      if (l) {
+        if (r && suffix(r) < suffix(l)) {
+          current = right.get();
+          return r;
+        } else {
+          current = left.get();
+          return l;
+        }
+      } else {
+        current = right.get();
+        return r;
+      }
+    }
+  }
+
+  std::optional<Id> lower_bound() override {
+    auto l = left ? left->lower_bound() : std::nullopt;
+    auto r = right ? right->lower_bound() : std::nullopt;
+    if (!l) {
+      return r;
+    }
+    return r ? std::min(*l, *r) : l;
+  }
+
+  std::optional<Id> upper_bound() override {
+    auto l = left ? left->upper_bound() : std::nullopt;
+    auto r = right ? right->upper_bound() : std::nullopt;
+    if (!l) {
+      return r;
+    }
+    return r ? std::max(*l, *r) : l;
+  }
+
+  static Fact::Ref tryGet(std::unique_ptr<FactIterator>& iter, Demand demand) {
+    Fact::Ref ref;
+    if (iter) {
+      ref = iter->get(demand);
+      if (!ref) {
+        iter.reset();
+      }
+    }
+    return ref;
+  }
+
+  folly::ByteRange suffix(Fact::Ref ref) {
+    assert(prefix_size <= ref.key().size());
+    return {ref.key().begin() + prefix_size, ref.key().end()};
+  }
+
+  std::unique_ptr<FactIterator> left;
+  std::unique_ptr<FactIterator> right;
+  FactIterator* FOLLY_NULLABLE current;
+  const size_t prefix_size;
+};
+
+} // namespace
+
+std::unique_ptr<FactIterator> FactIterator::merge(
+    std::unique_ptr<FactIterator> left,
+    std::unique_ptr<FactIterator> right,
+    size_t prefix_size) {
+  if (left->get(Demand::KeyOnly)) {
+    return right->get(Demand::KeyOnly)
+        ? std::make_unique<MergeIterator>(
+              std::move(left), std::move(right), prefix_size)
+        : std::move(left);
+  } else {
+    return right;
+  }
+}
+
+std::unique_ptr<FactIterator> Section::enumerate(Id from, Id upto) {
+  if (upto <= lowBoundary() || highBoundary() <= from) {
+    return std::make_unique<EmptyIterator>();
+  } else {
+    return base()->enumerate(
+        std::max(from, lowBoundary()),
+        upto ? std::min(upto, highBoundary()) : highBoundary());
+  }
+}
+
+std::unique_ptr<FactIterator> Section::enumerateBack(Id from, Id downto) {
+  if (from <= lowBoundary() || highBoundary() <= downto) {
+    return std::make_unique<EmptyIterator>();
+  } else {
+    return base()->enumerate(
+        from ? std::min(from, highBoundary()) : highBoundary(),
+        std::max(downto, lowBoundary()));
+  }
+}
+
+std::unique_ptr<FactIterator>
+Section::seek(Pid type, folly::ByteRange start, size_t prefix_size) {
+  struct Iterator final : FactIterator {
+    Iterator(std::unique_ptr<FactIterator> base, Id upto, Id from)
+        : base_(std::move(base)), high_boundary_(upto), low_boundary_(from) {}
+
+    void next() override {
+      base_->next();
+    }
+
+    Fact::Ref get(Demand demand) override {
+      auto r = base_->get(demand);
+
+      while (r && !isWithinBounds(r.id)) {
+        r = base_->get(demand);
+      }
+
+      return r;
+    }
+
+    std::optional<Id> lower_bound() override {
+      return low_boundary_;
+    }
+    std::optional<Id> upper_bound() override {
+      return high_boundary_;
+    }
+
+    bool isWithinBounds(Id id) {
+      return low_boundary_ <= id && id < high_boundary_;
+    }
+
+    std::unique_ptr<FactIterator> base_;
+    Id high_boundary_;
+    Id low_boundary_;
+  };
+  return std::make_unique<Iterator>(
+      base()->seek(type, start, prefix_size), highBoundary(), lowBoundary());
+}
+
+std::unique_ptr<FactIterator> Section::seekWithinSection(
+    Pid type,
+    folly::ByteRange start,
+    size_t prefix_size,
+    Id from,
+    Id upto) {
+  if (from <= lowBoundary() && highBoundary() <= upto) {
+    return seek(type, start, prefix_size);
+  } else {
+    return Section(base_, from, upto).seek(type, start, prefix_size);
+  }
+}
+
+namespace {
+
+struct AppendIterator final : FactIterator {
+  AppendIterator(
+      std::unique_ptr<FactIterator> l,
+      std::unique_ptr<FactIterator> r)
+      : current(std::move(l)), other(std::move(r)), checked(false) {}
+
+  void next() override {
+    if (!checked) {
+      get(KeyOnly);
+    }
+    current->next();
+    checked = false;
+  }
+
+  Fact::Ref get(Demand demand) override {
+    checked = true;
+    auto r = current->get();
+    if (!r && other) {
+      std::swap(current, other);
+      other.reset();
+      r = current->get();
+    }
+    return r;
+  }
+
+  std::optional<Id> lower_bound() override {
+    return std::nullopt;
+  }
+  std::optional<Id> upper_bound() override {
+    return std::nullopt;
+  }
+  std::unique_ptr<FactIterator> current;
+  std::unique_ptr<FactIterator> other;
+  bool checked;
+};
+
+} // namespace
+
+std::unique_ptr<FactIterator> FactIterator::append(
+    std::unique_ptr<FactIterator> left,
+    std::unique_ptr<FactIterator> right) {
+  return std::make_unique<AppendIterator>(std::move(left), std::move(right));
+}
+
+namespace {
+
+struct FilterIterator final : FactIterator {
+  FilterIterator(
+      std::unique_ptr<FactIterator> base,
+      std::function<bool(Id id)> visible)
+      : base_(std::move(base)), visible_(std::move(visible)) {}
+
+  void next() override {
+    base_->next();
+  }
+
+  Fact::Ref get(Demand demand) override {
+    // TODO: If we're doing a prefix seek and demand requires values, this
+    // will do 2 DB lookups (to get the value) even for facts that we
+    // skip which can be pretty significant. One possibility to avoid
+    // this is to do a KeyOnly lookup first, check the fact id and do
+    // a KeyValue lookup (if necessary) only if we want the
+    // fact. Another is to push the filtering all the way down into
+    // the individual iterators (ugly).
+    auto r = base_->get(demand);
+    while (r.id != Id::invalid() && !visible_(r.id)) {
+      base_->next();
+      r = base_->get(demand);
+    }
+    return r;
+  }
+
+  std::optional<Id> lower_bound() override {
+    return base_->lower_bound();
+  }
+  std::optional<Id> upper_bound() override {
+    return base_->upper_bound();
+  }
+  std::unique_ptr<FactIterator> base_;
+  std::function<bool(Id id)> visible_;
+};
+
+} // namespace
+
+std::unique_ptr<FactIterator> FactIterator::filter(
+    std::unique_ptr<FactIterator> base,
+    std::function<bool(Id id)> visible) {
+  return std::make_unique<FilterIterator>(std::move(base), std::move(visible));
+}
+
+std::unique_ptr<Lookup> snapshot(Lookup* b, Id upto) {
+  return std::make_unique<Section>(Section(b, Id::invalid(), upto));
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/lookup.h b/glean/rts/lookup.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/lookup.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/fact.h"
+#include "glean/rts/id.h"
+#include "glean/rts/ownership/uset.h"
+#include "glean/rts/stats.h"
+
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/**
+ * An iterator for facts.
+ *
+ */
+struct FactIterator {
+  enum Demand { KeyOnly, KeyValue };
+
+  // Advance the iterator to the next fact. Calling this after get() returned
+  // Fact::Ref::invalid() is not allowed.
+  virtual void next() = 0;
+
+  // Get the current fact. Demand says whether to include its value which might
+  // be more expensive (rocksdb will do an additional lookup).
+  virtual Fact::Ref get(Demand demand = KeyValue) = 0;
+
+  virtual ~FactIterator() {}
+
+  // Get the bounds of the iterator, if they exist
+  virtual std::optional<Id> lower_bound() = 0;
+  virtual std::optional<Id> upper_bound() = 0;
+
+  static std::unique_ptr<FactIterator> merge(
+      std::unique_ptr<FactIterator> left,
+      std::unique_ptr<FactIterator> right,
+      size_t prefix_size);
+
+  static std::unique_ptr<FactIterator> append(
+      std::unique_ptr<FactIterator> left,
+      std::unique_ptr<FactIterator> right);
+
+  // Filter the facts of the underlying DB according to the provided
+  // visibility function. It is the responsibility of the caller to
+  // ensure that the resulting set of facts is valid (has no dangling
+  // fact IDs).
+  static std::unique_ptr<FactIterator> filter(
+      std::unique_ptr<FactIterator> base,
+      std::function<bool(Id id)> visible);
+};
+
+/**
+ * An iterator which never returns any facts.
+ *
+ */
+struct EmptyIterator final : FactIterator {
+  void next() override {}
+  Fact::Ref get(Demand) override {
+    return Fact::Ref::invalid();
+  }
+  std::optional<Id> lower_bound() override {
+    return std::nullopt;
+  }
+  std::optional<Id> upper_bound() override {
+    return std::nullopt;
+  }
+};
+
+/**
+ * Interface for looking up fact definitions.
+ *
+ */
+struct Lookup {
+  virtual ~Lookup() {}
+
+  // Lookup the Id of a fact by its type and key. Returns Id::INVALID if not
+  // found.
+  virtual Id idByKey(Pid type, folly::ByteRange key) = 0;
+
+  // Lookup the type of a fact by its id. Returns Id::INVALID if not found.
+  virtual Pid typeById(Id id) = 0;
+
+  // Apply the function to the type, key and value of the fact with the given id
+  // if it exists. Return value indicates whether the fact has been found.
+  // If a type is supplied only facts with this type will be found.
+  virtual bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) = 0;
+
+  /// Return a fact id such that no facts in the Enumerate have an id below it.
+  /// There is no guarantee that a fact with this particular id exists but fact
+  /// ids are supposed to be dense between startingId and firstFreeId.
+  virtual Id startingId() const = 0;
+
+  /// Return a fact id such that no facts in the Enumerate have an id equal to
+  /// or greater than it. See comments on startingId.
+  virtual Id firstFreeId() const = 0;
+
+  /// Return bounds on how many facts for a particular predicate the Lookup has.
+  virtual Interval count(Pid pid) const = 0;
+
+  /// Return a FactIterator that enumerates all facts in increasing order of
+  /// their ids, starting with 'from' and up to, but not including, 'upto'.
+  /// Passing `Id::invalid` for either means starting with the first/finishing
+  /// with the last fact.
+  virtual std::unique_ptr<FactIterator> enumerate(
+      Id from = Id::invalid(),
+      Id upto = Id::invalid()) = 0;
+
+  /// Return a FactIterator that enumerates all facts in descreasing order of
+  /// their ids, starting from the first fact before 'from' and down to and
+  /// including 'downto'. Passing `Id::invalid` for either means starting with
+  /// the last/finishing with the first fact.
+  ///
+  /// Note that `from` is typically the fact id *one past* the first fact
+  /// returned by the iterator and `downto` the fact id of the last fact
+  /// returned by the iterator. This means that `enumerateBack(b,a)` produces
+  /// exactly the same facts as `enumerate(a,b)`, just in reverse order.
+  virtual std::unique_ptr<FactIterator> enumerateBack(
+      Id from = Id::invalid(),
+      Id downto = Id::invalid()) = 0;
+
+  // Obtain a  prefix iterator for the given predicate. The iterator covers keys
+  // which begin with the first 'prefix_size' bytes of 'start', starting with
+  // the first key not lexicographically less than 'start', and produces facts
+  // in lexicographic order. In particular, setting 'prefix_size' to
+  // 'start.size()' iterates over all keys with the prefix 'start'.
+  virtual std::unique_ptr<FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) = 0;
+
+  // Perform a seek on a section of the Lookup.
+  // Results will have Ids within the range [from, utpto).
+  // Facts can reference Ids outside of the specified range.
+  virtual std::unique_ptr<FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id to) = 0;
+
+  virtual UsetId getOwner(Id id) = 0;
+};
+
+/**
+ * An implementation of Lookup which doesn't find any facts.
+ *
+ */
+struct EmptyLookup final : Lookup {
+  Id idByKey(Pid, folly::ByteRange) override {
+    return Id::invalid();
+  }
+
+  Pid typeById(Id) override {
+    return Pid::invalid();
+  }
+
+  bool factById(Id, std::function<void(Pid, Fact::Clause)>) override {
+    return false;
+  }
+
+  Id startingId() const override {
+    return Id::lowest();
+  }
+  Id firstFreeId() const override {
+    return Id::lowest();
+  }
+
+  Interval count(Pid) const override {
+    return 0;
+  }
+
+  std::unique_ptr<FactIterator> enumerate(Id, Id) override {
+    return std::make_unique<EmptyIterator>();
+  }
+  std::unique_ptr<FactIterator> enumerateBack(Id, Id) override {
+    return std::make_unique<EmptyIterator>();
+  }
+
+  std::unique_ptr<FactIterator> seek(Pid, folly::ByteRange, size_t) override {
+    return std::make_unique<EmptyIterator>();
+  }
+
+  std::unique_ptr<FactIterator>
+  seekWithinSection(Pid, folly::ByteRange, size_t, Id, Id) override {
+    return std::make_unique<EmptyIterator>();
+  }
+
+  UsetId getOwner(Id) override {
+    return INVALID_USET;
+  }
+
+  static EmptyLookup& instance();
+};
+
+/**
+ * A Lookup which ignores all facts with Ids outside of the range [from, to).
+ * Returned facts may reference Ids lower than 'from'.
+ *
+ */
+struct Section : Lookup {
+  Section(Lookup* b, Id from, Id to)
+      : base_(b), low_boundary_(from), high_boundary_(to) {}
+
+  Id idByKey(Pid type, folly::ByteRange key) override {
+    auto id = base()->idByKey(type, key);
+    return isWithinBounds(id) ? id : Id::invalid();
+  }
+
+  Pid typeById(Id id) override {
+    return isWithinBounds(id) ? base()->typeById(id) : Pid::invalid();
+  }
+
+  bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) override {
+    return isWithinBounds(id) && base()->factById(id, std::move(f));
+  }
+
+  Id startingId() const override {
+    return std::max(
+        lowBoundary(), std::min(highBoundary(), base()->startingId()));
+  }
+
+  Id firstFreeId() const override {
+    return std::max(
+        lowBoundary(), std::min(highBoundary(), base()->firstFreeId()));
+  }
+
+  Interval count(Pid pid) const override {
+    return base_->count(pid).asHigh();
+  }
+
+  std::unique_ptr<FactIterator> enumerate(Id from, Id upto) override;
+  std::unique_ptr<FactIterator> enumerateBack(Id from, Id downto) override;
+
+  std::unique_ptr<FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) override;
+
+  std::unique_ptr<FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id to) override;
+
+  UsetId getOwner(Id id) override {
+    return isWithinBounds(id) ? base()->getOwner(id) : INVALID_USET;
+  }
+
+  Lookup* base() const {
+    return base_;
+  }
+
+  Id lowBoundary() const {
+    return low_boundary_;
+  }
+
+  Id highBoundary() const {
+    return high_boundary_;
+  }
+
+  bool isWithinBounds(Id id) const {
+    return lowBoundary() <= id && id < highBoundary();
+  }
+
+ private:
+  Lookup* base_;
+  Id low_boundary_;
+  Id high_boundary_;
+};
+
+/**
+ * A Lookup which ignores all facts with Ids from the given one up. Since we
+ * assign Ids sequentially, this effectively implements a snapshot of the
+ * database.
+ *
+ */
+std::unique_ptr<Lookup> snapshot(Lookup* b, Id to);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/nat.cpp b/glean/rts/nat.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/nat.cpp
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/nat.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+const unsigned char* FOLLY_NULLABLE
+skipUntrustedNat(const unsigned char* p, const unsigned char* e) {
+  if (LIKELY(p != e)) {
+    auto size = natSize(*p);
+    if (LIKELY(
+            e - p >= size &&
+            (size < 9 ||
+             folly::Endian::swap(*reinterpret_cast<const uint64_t*>(p + 1)) <=
+                 0xFEFDFBF7EFDFBF7FUl))) {
+      return p + size;
+    }
+  }
+  return nullptr;
+}
+
+namespace {
+template <int n>
+uint64_t load(unsigned char b0, const unsigned char* p);
+
+template <>
+inline uint64_t load<2>(unsigned char b0, const unsigned char* p) {
+  return (uint64_t(b0 & 0x3F) << 8) + p[1] + 0x80;
+}
+
+template <>
+inline uint64_t load<3>(unsigned char b0, const unsigned char* p) {
+  return (uint64_t(b0 & 0x1F) << 16) +
+      folly::Endian::big(folly::loadUnaligned<uint16_t>(p + 1)) + 0x4080;
+}
+
+template <>
+inline uint64_t load<4>(unsigned char b0, const unsigned char* p) {
+  return (folly::Endian::big(folly::loadUnaligned<uint32_t>(p)) & 0x0FFFFFFF) +
+      0x204080Ul;
+}
+
+template <>
+inline uint64_t load<5>(unsigned char b0, const unsigned char* p) {
+  return (uint64_t(b0 & 0x7) << 32) +
+      folly::Endian::big(folly::loadUnaligned<uint32_t>(p + 1)) + 0x10204080Ul;
+}
+
+template <>
+inline uint64_t load<6>(unsigned char b0, const unsigned char* p) {
+  return (uint64_t(b0 & 0x3) << 40) + (uint64_t(p[1]) << 32) +
+      folly::Endian::big(folly::loadUnaligned<uint32_t>(p + 2)) +
+      0x0810204080Ul;
+}
+
+template <>
+inline uint64_t load<7>(unsigned char b0, const unsigned char* p) {
+  return (uint64_t(b0 & 0x1) << 48) +
+      (uint64_t(folly::Endian::big(folly::loadUnaligned<uint16_t>(p + 1)))
+       << 32) +
+      (folly::Endian::big(folly::loadUnaligned<uint32_t>(p + 3))) +
+      0x040810204080Ul;
+}
+
+template <>
+inline uint64_t load<8>(unsigned char b0, const unsigned char* p) {
+  return (folly::Endian::big(folly::loadUnaligned<uint64_t>(p)) &
+          0xFFFFFFFFFFFFFF) +
+      0x02040810204080Ul;
+}
+
+template <>
+inline uint64_t load<9>(unsigned char b0, const unsigned char* p) {
+  return folly::Endian::big(folly::loadUnaligned<uint64_t>(p + 1)) +
+      0x0102040810204080Ul;
+}
+
+template <int n>
+inline std::pair<uint64_t, const unsigned char*> decode(
+    unsigned char b0,
+    const unsigned char* p) {
+  return {load<n>(b0, p), p + n};
+}
+
+template <int n>
+inline std::pair<uint64_t, const unsigned char*>
+decodeCheck(unsigned char b0, const unsigned char* p, const unsigned char* e) {
+  if (LIKELY(e - p >= n)) {
+    auto r = decode<n>(b0, p);
+    // We've already added 0x0102040810204080 to the number so invalid bit
+    // patterns will have overflown.
+    if (n != 9 || LIKELY(r.first >= 0x0102040810204080Ul)) {
+      return r;
+    }
+  }
+  return {0, nullptr};
+}
+
+} // namespace
+
+// We use computed gotos, keyed on the first byte. This seems to be massively
+// faster than anything else.
+#define DECODER_LABELS(decoder)                                         \
+  static const void* decoder[256] = {                                   \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, &&decode1, \
+      &&decode1, &&decode1,                                             \
+                                                                        \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, &&decode2, \
+      &&decode2, &&decode2, &&decode2, &&decode2,                       \
+                                                                        \
+      &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, \
+      &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, \
+      &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, \
+      &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, \
+      &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, &&decode3, \
+      &&decode3, &&decode3,                                             \
+                                                                        \
+      &&decode4, &&decode4, &&decode4, &&decode4, &&decode4, &&decode4, \
+      &&decode4, &&decode4, &&decode4, &&decode4, &&decode4, &&decode4, \
+      &&decode4, &&decode4, &&decode4, &&decode4,                       \
+                                                                        \
+      &&decode5, &&decode5, &&decode5, &&decode5, &&decode5, &&decode5, \
+      &&decode5, &&decode5,                                             \
+                                                                        \
+      &&decode6, &&decode6, &&decode6, &&decode6, &&decode7, &&decode7, \
+      &&decode8, &&decode9,                                             \
+  }
+
+std::pair<uint64_t, const unsigned char*> loadTrustedNat(
+    const unsigned char* p) {
+  DECODER_LABELS(decoder);
+  const unsigned char b0 = *p;
+  goto* decoder[b0];
+
+decode1:
+  return {uint64_t(b0), p + 1};
+
+decode2:
+  return decode<2>(b0, p);
+
+decode3:
+  return decode<3>(b0, p);
+
+decode4:
+  return decode<4>(b0, p);
+
+decode5:
+  return decode<5>(b0, p);
+
+decode6:
+  return decode<6>(b0, p);
+
+decode7:
+  return decode<7>(b0, p);
+
+decode8:
+  return decode<8>(b0, p);
+
+decode9:
+  return decode<9>(b0, p);
+}
+
+std::pair<uint64_t, const unsigned char * FOLLY_NULLABLE> loadUntrustedNat(
+    const unsigned char* p,
+    const unsigned char* e) {
+  DECODER_LABELS(decoder);
+  if (UNLIKELY(p >= e)) {
+    return {0, nullptr};
+  }
+  const unsigned char b0 = *p;
+  goto* decoder[b0];
+
+decode1:
+  return {uint64_t(b0), p + 1};
+
+decode2:
+  return decodeCheck<2>(b0, p, e);
+
+decode3:
+  return decodeCheck<3>(b0, p, e);
+
+decode4:
+  return decodeCheck<4>(b0, p, e);
+
+decode5:
+  return decodeCheck<5>(b0, p, e);
+
+decode6:
+  return decodeCheck<6>(b0, p, e);
+
+decode7:
+  return decodeCheck<7>(b0, p, e);
+
+decode8:
+  return decodeCheck<8>(b0, p, e);
+
+decode9:
+  return decodeCheck<9>(b0, p, e);
+}
+
+size_t storeNat(unsigned char* out, uint64_t val) {
+  // There is probably ample room for improvement here.
+  if (val < 0x80) {
+    *out = static_cast<unsigned char>(val);
+    return 1;
+  } else if (val < 0x4080) {
+    folly::storeUnaligned<uint16_t>(
+        out, folly::Endian::big(static_cast<uint16_t>(val - 0x80)) | 0x80);
+    return 2;
+  } else if (val < 0x204080) {
+    val -= 0x4080;
+    out[0] = 0xC0 | static_cast<unsigned char>(val >> 16);
+    folly::storeUnaligned<uint16_t>(
+        out + 1, folly::Endian::big(static_cast<uint16_t>(val)));
+    return 3;
+  } else if (val < 0x10204080) {
+    val -= 0x204080;
+    folly::storeUnaligned<uint32_t>(
+        out, folly::Endian::big(static_cast<uint32_t>(val | 0xE0000000)));
+    return 4;
+  } else if (val < 0x0810204080) {
+    val -= 0x10204080;
+    out[0] = 0xF0 | static_cast<unsigned char>(val >> 32);
+    folly::storeUnaligned<uint32_t>(
+        out + 1, folly::Endian::big(static_cast<uint32_t>(val)));
+    return 5;
+  } else if (val < 0x040810204080) {
+    val -= 0x0810204080;
+    folly::storeUnaligned<uint16_t>(
+        out, folly::Endian::big(static_cast<uint16_t>((val >> 32) | 0xF800)));
+    folly::storeUnaligned<uint32_t>(
+        out + 2, folly::Endian::big(static_cast<uint32_t>(val)));
+    return 6;
+  } else if (val < 0x02040810204080) {
+    val -= 0x040810204080;
+    out[0] = 0xFC | static_cast<unsigned char>(val >> 48);
+    folly::storeUnaligned<uint16_t>(
+        out + 1, folly::Endian::big(static_cast<uint16_t>(val >> 32)));
+    folly::storeUnaligned<uint32_t>(
+        out + 3, folly::Endian::big(static_cast<uint32_t>(val)));
+    return 7;
+  } else if (val < 0x0102040810204080) {
+    val -= 0x02040810204080;
+    folly::storeUnaligned<uint64_t>(
+        out, folly::Endian::big(val | 0xFE00000000000000Ul));
+    return 8;
+  } else {
+    val -= 0x0102040810204080;
+    out[0] = 0xFF;
+    folly::storeUnaligned<uint64_t>(out + 1, folly::Endian::big(val));
+    return 9;
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/nat.h b/glean/rts/nat.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/nat.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Bits.h>
+#include <folly/CppAttributes.h>
+#include <folly/Likely.h>
+#include <folly/Range.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+// Packed natural numbers
+//
+// This module provides a packed representation of unsigned 64-bit numbers
+// with the following properties (in order of importance).
+//
+// - Packed numbers compare lexicographically (i.e., memcmp can be used to
+//   to compare two numbers).
+// - As a collorary, every 64-bit number has exacly one packed representation
+//   (some other compact encodings don't necessarily guarantee this).
+// - They are very compact (max. 9 bytes for a 64-bit number compared to max
+//   10 for varints).
+// - They are quite fast to encode/decode.
+//
+// This encoding is a variant of prefix varints, albeit not one I've seen
+// before. The first byte of an encoded number indicates how many bytes the
+// number takes up and contains some data.
+//
+//   First byte    Bytes     Bits    Range
+//   0nnnnnnn        1         7     0 - 0x7F
+//   10nnnnnn        2        14     0x80 - 0x407F
+//   110nnnnn        3        21     0x4080 - 0x20407F
+//   1110nnnn        4        28     0x204080 - 0x1020407F
+//   11110nnn        5        35     0x10204080 - 0x081020407F
+//   111110nn        6        42     0x0810204080 - 0x04081020407F
+//   1111110n        7        49     0x040810204080 - 0x0204081020407F
+//   11111110        8        56     0x02040810204080 - 0x010204081020407F
+//   11111111        9        64     0x010204081020407F - 0xFFFFFFFFFFFFFFFF
+//
+// Numbers are stored in big endian format. Here is how 0x123456 is stored:
+//
+//  11010001 11110011 11010110
+//  +--+----------------------+
+//    |           |
+//    |           +- 21 significant bits storing 0x11F3D6, i.e.,
+//    |              0x123456 - 0x4080 (which is the start of the range)
+//    |
+//    +- prefix indicates 3 byte representation
+//
+// Subtracting the start of the range from the number rather than just storing
+// the bit pattern as is has two advantages. Firstly, this ensures that every
+// number has exactly one packed representation without us having to do any
+// checks. There is one exception: for 9 bytes encodings, the bit patterns
+// above 0xFEFDFBF7EFDFBF7F are invalid - but this is an easy check which will
+// will almost never be done because the vast majority of numbers are encoded
+// in fewer than 9 bytes. Secondly, this is slightly more compact.
+
+/// Compute the total number of bytes used to encode a number from the first
+/// byte of the encoding.
+inline size_t natSize(unsigned char b0) {
+  static constexpr unsigned char natSizes[] = {
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      1, 1, 1, 1, 1, 1, 1, 1, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      2, 2, 2, 2, 2, 2, 2, 2, //
+      3, 3, 3, 3, 3, 3, 3, 3, //
+      3, 3, 3, 3, 3, 3, 3, 3, //
+      3, 3, 3, 3, 3, 3, 3, 3, //
+      3, 3, 3, 3, 3, 3, 3, 3, //
+      4, 4, 4, 4, 4, 4, 4, 4, //
+      4, 4, 4, 4, 4, 4, 4, 4, //
+      5, 5, 5, 5, 5, 5, 5, 5, //
+      6, 6, 6, 6, 7, 7, 8, 9, //
+  };
+
+  // NOTE: For smaller numbers, this benchmarks as significantly faster than
+  // just
+  //   return natSizes[b0]
+  // I'm actually not entirely sure why.
+  if (b0 < 0x80) {
+    return 1;
+  } else if (b0 < 0xC0) {
+    return 2;
+  } else if (b0 < 0xE0) {
+    return 3;
+  } else if (b0 < 0xF0) {
+    return 4;
+  } else if (b0 < 0xF8) {
+    return 5;
+  } else {
+    return natSizes[b0];
+  }
+}
+
+/// Skip over an encoded nat but check it for validity. Return a pointer to the
+/// first byte after the nat or NULL if the encoding is invalid or the buffer
+/// is too short.
+const unsigned char* FOLLY_NULLABLE skipUntrustedNat(
+    const unsigned char* p, // pointer to first byte
+    const unsigned char* e // pointer to end of buffer
+);
+
+/// Skip over an encoded nat without any checks. Return a pointer to the first
+/// byte after the nat.
+inline const unsigned char* skipTrustedNat(const unsigned char* p) {
+  return p + natSize(*p);
+}
+
+/// Check and decode an encoded nat and return the decoded number and a pointer
+/// to the first byte after the nat. The pointer will be NULL is the number is
+/// invalid of the buffer is too short.
+std::pair<uint64_t, const unsigned char * FOLLY_NULLABLE> loadUntrustedNat(
+    const unsigned char* p, // pointer to first byte
+    const unsigned char* e // pointer to end of buffer
+);
+
+/// Decode an encoded nat without any checks. Return the decoded number and a
+/// pointer to the first byte after the nat.
+std::pair<uint64_t, const unsigned char*> loadTrustedNat(const unsigned char*);
+
+/// Max number of bytes that an encoded nat can take up.
+inline constexpr size_t MAX_NAT_SIZE = 9;
+
+/// Encode and store a number in the buffer and return the number of bytes
+/// taken up by the encoding. This assumes that the buffer has enough space.
+size_t storeNat(unsigned char* out, uint64_t val);
+
+/// A stack-allocated encoded nat
+struct EncodedNat {
+  explicit EncodedNat(uint64_t val) {
+    encoded_size = storeNat(buf, val);
+  }
+  folly::ByteRange byteRange() {
+    return folly::ByteRange(buf, buf + encoded_size);
+  }
+
+ private:
+  uint8_t buf[rts::MAX_NAT_SIZE];
+  size_t encoded_size;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ondemand.h b/glean/rts/ondemand.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ondemand.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <atomic>
+#include <memory>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// Values which are created once when needed. OnDemand is thread safe and
+/// always returns the same value. However, it might speculatively create (and
+/// then destroy) additional values.
+template <typename T>
+class OnDemand final {
+ public:
+  /// Create an empty OnDemand
+  OnDemand() noexcept : ptr_(nullptr) {}
+
+  OnDemand(OnDemand&& other) noexcept
+      : ptr_(other.ptr_.exchange(nullptr, std::memory_order_acq_rel)) {}
+
+  OnDemand& operator=(OnDemand&& other) noexcept {
+    auto p = other.ptr_.exchange(nullptr, std::memory_order_acq_rel);
+    p = ptr_.exchange(p, std::memory_order_release);
+    delete p;
+    return *this;
+  }
+
+  ~OnDemand() noexcept {
+    delete ptr_.load(std::memory_order_relaxed);
+  }
+
+  OnDemand(const OnDemand&) = delete;
+  OnDemand& operator=(const OnDemand&) = delete;
+
+  /// Get the value, creating it if necessary.
+  T& value() {
+    auto p = ptr_.load(std::memory_order_relaxed);
+    if (p == nullptr) {
+      auto k = new T();
+      if (ptr_.compare_exchange_strong(p, k, std::memory_order_acq_rel)) {
+        p = k;
+      } else {
+        delete k;
+      }
+    }
+    return *p;
+  }
+
+  const T& value() const {
+    return const_cast<OnDemand*>(this)->value();
+  }
+
+ private:
+  mutable std::atomic<T*> ptr_;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership.cpp b/glean/rts/ownership.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership.cpp
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/ownership.h"
+#include "glean/rts/factset.h"
+#include "glean/rts/inventory.h"
+#include "glean/rts/lookup.h"
+#include "glean/rts/ownership/setu32.h"
+#include "glean/rts/ownership/triearray.h"
+#include "glean/rts/ownership/uset.h"
+#include "glean/rts/timer.h"
+
+#if __x86_64__ // AVX required
+#include <immintrin.h>
+#else
+#include "glean/rts/ownership/fallbackavx.h"
+#endif
+
+#include <folly/MPMCQueue.h>
+#include <folly/container/F14Map.h>
+#include <folly/container/F14Set.h>
+#include <folly/executors/GlobalExecutor.h>
+#include <folly/futures/Future.h>
+
+#include <algorithm>
+#include <initializer_list>
+#include <limits>
+#include <type_traits>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+void serializeEliasFano(binary::Output& out, const OwnerSet& set) {
+  out.nat(set.size);
+  out.nat(set.numLowerBits);
+  out.nat(set.upperSizeBytes);
+  out.nat(set.skipPointers - set.data.begin());
+  out.nat(set.forwardPointers - set.data.begin());
+  out.nat(set.lower - set.data.begin());
+  out.nat(set.upper - set.data.begin());
+  out.put(set.data);
+}
+
+/// Deserialize an OwnerSet from a binary::Input. Note that the
+// OwnerSet points to the contents of the binary::Input, so that
+// must remain alive as long as the OwnerSet is needed.
+OwnerSet deserializeEliasFano(binary::Input& in) {
+  OwnerSet set;
+  set.size = in.trustedNat();
+  set.numLowerBits = in.trustedNat();
+  set.upperSizeBytes = in.trustedNat();
+  auto skipPointers = in.trustedNat();
+  auto forwardPointers = in.trustedNat();
+  auto lower = in.trustedNat();
+  auto upper = in.trustedNat();
+  set.data = in.bytes();
+  set.skipPointers = set.data.begin() + skipPointers;
+  set.forwardPointers = set.data.begin() + forwardPointers;
+  set.lower = set.data.begin() + lower;
+  set.upper = set.data.begin() + upper;
+  return set;
+}
+
+namespace {
+
+/**
+ * Fill ownership data from an iterator
+ *
+ * Takes the Unit -> FactId mapping provided by the
+ * OwnershipUnitIterator and populates the TrieArray with it, making
+ * a FactId -> Set(Unit) mapping.
+ */
+FOLLY_NOINLINE std::unique_ptr<TrieArray<Uset>> fillOwnership(
+    OwnershipUnitIterator* iter,
+    uint32_t& firstSetId) {
+  struct Stats {
+    size_t units = 0;
+    size_t intervals = 0;
+
+    void bump(size_t curUnits, size_t is) {
+      units = curUnits;
+      const auto old_intervals = intervals;
+      intervals += is;
+      if ((old_intervals / 5000000) != (intervals / 5000000)) {
+        dump();
+      }
+    }
+
+    void dump() {
+      VLOG(1) << units << " units, " << intervals << " intervals";
+    }
+  };
+
+  // A replacement for OwnershipUnit that owns the memory
+  struct OwnershipUnitCopy {
+    UnitId unit;
+    std::vector<OwnershipUnit::Ids> ids;
+  };
+
+  using Queue =
+      folly::MPMCQueue<folly::Optional<OwnershipUnitCopy>, std::atomic, false>;
+  Queue queue(100);
+  auto executor = folly::getGlobalCPUExecutor();
+
+  folly::Future<folly::Unit> fetcher = folly::via(executor, [&]() {
+    while (const auto d = iter->get()) {
+      OwnershipUnitCopy c{d->unit, {d->ids.begin(), d->ids.end()}};
+      queue.blockingWrite(std::move(c));
+    }
+    queue.blockingWrite(folly::none);
+  });
+
+  auto utrie = std::make_unique<TrieArray<Uset>>();
+  uint32_t last_unit = 0;
+  uint32_t max_unit = 0;
+  Stats stats;
+  folly::Optional<OwnershipUnitCopy> d;
+  for (queue.blockingRead(d); d; queue.blockingRead(d)) {
+    const auto& data = d.value();
+    CHECK_GE(data.unit, last_unit);
+
+    utrie->insert(
+        data.ids.data(),
+        data.ids.data() + data.ids.size(),
+        [&](Uset* FOLLY_NULLABLE prev, uint32_t refs) {
+          if (prev != nullptr) {
+            if (prev->refs == refs) {
+              // Do an in-place append if possible (determined via reference
+              // count).
+              prev->exp.set.append(data.unit);
+              return prev;
+            } else {
+              auto entry = std::make_unique<Uset>(
+                  SetU32(prev->exp.set, SetU32::copy_capacity), refs);
+              entry->exp.set.append(data.unit);
+              prev->refs -= refs;
+              return entry.release();
+            }
+          } else {
+            auto entry = std::make_unique<Uset>(SetU32(), refs);
+            entry->exp.set.append(data.unit);
+            return entry.release();
+          }
+        });
+
+    max_unit = std::max(data.unit, max_unit);
+    stats.bump(max_unit, data.ids.size());
+    last_unit = data.unit;
+  }
+
+  stats.dump();
+
+  firstSetId = max_unit + 1;
+  return utrie;
+}
+
+/** Move the sets from the trie to `Usets`. */
+FOLLY_NOINLINE Usets
+collectUsets(uint32_t firstUsetId, TrieArray<Uset>& utrie) {
+  Usets usets(firstUsetId);
+  size_t visits = 0;
+  utrie.foreach([&](Uset* entry) -> Uset* {
+    ++visits;
+
+    // entry->link() caches usets.add(entry) below
+    Uset* p = static_cast<Uset*>(entry->link());
+
+    // visited this Uset before?
+    if (p == nullptr) {
+      p = usets.add(entry);
+      entry->link(p);
+    }
+
+    // duplicate set? Update the Trie to point to the canonical one.
+    if (p != entry) {
+      entry->drop();
+      return p;
+    } else {
+      return nullptr;
+    }
+  });
+
+  usets.foreach([](Uset* entry) { entry->link(nullptr); });
+
+  VLOG(1) << visits << " visits, " << usets.size() << " usets";
+  return usets;
+}
+
+/** Transitively complete `Usets` by assigning an ownership unit to facts which
+ * are transitively referenced by a fact already belonging to that unit.
+ *
+ * The resulting `Usets` will contain exactly those sets (the "promoted" ones)
+ * which describe the ownership of at least one fact.
+ */
+FOLLY_NOINLINE void completeOwnership(
+    std::vector<Uset*>& facts,
+    folly::F14FastMap<uint64_t, Uset*>& sparse,
+    Usets& usets,
+    const Inventory& inventory,
+    Lookup& lookup,
+    Lookup* base_lookup) {
+  struct Stats {
+    Usets& usets;
+    size_t local_facts = 0;
+    size_t base_facts = 0;
+    size_t owned_facts = 0;
+
+    void bumpLocal() {
+      ++local_facts;
+    }
+
+    void bumpBase() {
+      ++base_facts;
+    }
+
+    void bumpOwned() {
+      ++owned_facts;
+      if (owned_facts % 1000000 == 0) {
+        dump();
+      }
+    }
+
+    void dump() {
+      auto ustats = usets.statistics();
+      VLOG(1) << folly::sformat(
+          "{} of {} facts ({} visited in base DBs), {} usets, {} promoted, {} bytes, {} adds, {} dups",
+          owned_facts,
+          local_facts + base_facts,
+          base_facts,
+          usets.size(),
+          ustats.promoted,
+          ustats.bytes,
+          ustats.adds,
+          ustats.dups);
+    }
+  };
+
+  Stats stats{usets};
+
+  std::vector<Id> refs;
+  const auto tracker = syscall([&refs](Id id, Pid) { refs.push_back(id); });
+
+  if (facts.size() == 0) {
+    return;
+  }
+
+  // Iterate over facts backwards - this ensures that we get all dependencies.
+  const auto min_id = lookup.startingId();
+  const auto owner = [&](Id id) -> Uset*& {
+    if (id < min_id) {
+      return sparse[id.toWord()];
+    } else {
+      return facts[id.toWord() - min_id.toWord()];
+    }
+  };
+
+  auto processFact = [&, min_id](Fact::Ref fact) {
+    // `set == nullptr` means that the fact doesn't have an ownership set - we
+    // might want to make that an error eventually?
+    if (auto set = owner(fact.id)) {
+      // If the fact is in a base DB, then we record its owner as (set || X)
+      // where X is the existing owner of the fact. We only propagate `set`,
+      // not `X`, to the facts it refers to.
+      if (fact.id < min_id) {
+        auto base_owner = base_lookup->getOwner(fact.id);
+        if (base_owner != INVALID_USET) {
+          auto merged = usets.merge(SetU32::from({base_owner}), set);
+          usets.promote(merged);
+          owner(fact.id) = merged;
+        }
+      }
+
+      usets.promote(set);
+
+      // Collect all references to facts
+      const auto* predicate = inventory.lookupPredicate(fact.type);
+      assert(predicate);
+      predicate->traverse(tracker, fact.clause);
+
+      // For each fact we reference, add our ownership set to what we've
+      // computed for it so far. Use the `link` field to avoid computing the
+      // same set union multiple times.
+      //
+      // TODO: Try adding a fixed-size LRU (or LFU?) cache for set unions?
+      std::vector<Uset*> touched;
+      for (const auto id : refs) {
+        auto& me = owner(id);
+        if (me == nullptr) {
+          // The fact didn't have ownership info before, assign the set to it.
+          me = set;
+          usets.use(me, 1);
+        } else if (const auto added = static_cast<Uset*>(me->link())) {
+          // The fact did have ownership info and we've already computed the
+          // union for that particular set.
+          usets.use(added);
+          usets.drop(me);
+          me = added;
+        } else {
+          // Compute the union.
+          const auto p = usets.merge(me, set);
+          me->link(p);
+          touched.push_back(me);
+          me = p;
+        }
+      }
+
+      // Reset the link fields. Note that we always add 1 refcount for sets we
+      // store in `touched` (to avoid having dangling references there) so drop
+      // it here.
+      for (const auto p : touched) {
+        p->link(nullptr);
+        usets.drop(p);
+      }
+
+      touched.clear();
+      // TODO: We can drop the current's fact ownership info here - could shrink
+      // the vector.
+      // facts.shrink(fact.id);
+      stats.bumpOwned();
+    }
+  };
+
+  // We process facts in reverse order, so that we only process each fact
+  // once. We fetch the facts in parallel with processing them,
+  // which speeds up the whole process by about 2x. It should be possible
+  // to speed it up further by parallelising the processing.
+
+  using FactPage = std::vector<Fact::unique_ptr>;
+  auto fetchPage = [&](Id min_id, Id max_id) -> FactPage {
+    FactPage page;
+    for (auto iter = lookup.enumerate(min_id, max_id); auto fact = iter->get();
+         iter->next()) {
+      page.emplace_back(Fact::create(iter->get()));
+    }
+    return page;
+  };
+
+  auto processPage = [&](FactPage& page) {
+    Fact::unique_ptr f;
+    auto it = page.end();
+    while (it != page.begin()) {
+      --it;
+      stats.bumpLocal();
+      processFact((*it)->ref());
+      refs.clear();
+    }
+  };
+
+  const uint32_t pageSize = 1024 * 1024;
+
+  using Queue = folly::MPMCQueue<folly::Optional<FactPage>, std::atomic, false>;
+  Queue queue(10);
+  auto executor = folly::getGlobalCPUExecutor();
+
+  folly::Future<folly::Unit> fetcher = folly::via(executor, [&]() {
+    auto pageOf = [](Id id) {
+      return Id::fromWord((id.toWord() / pageSize) * pageSize);
+    };
+    Id last = pageOf(lookup.firstFreeId() - 1);
+    Id first = pageOf(lookup.startingId());
+    for (Id id = last;; id -= pageSize) {
+      VLOG(1) << folly::sformat("fetching page: {}", id.toWord());
+      queue.blockingWrite(fetchPage(id, id + pageSize));
+      if (id == first) {
+        break;
+      }
+    }
+    queue.blockingWrite(folly::none);
+  });
+
+  folly::Optional<FactPage> page;
+  do {
+    queue.blockingRead(page);
+    if (page) {
+      processPage(page.value());
+    }
+  } while (page);
+
+  fetcher.wait();
+  stats.dump();
+
+  // Propagate ownership sets through facts in the base DB(s), using a priority
+  // queue to process facts in descending order. Note there might be multiple
+  // entries in the queue for a given fact ID.
+  std::priority_queue<Id> order;
+  for (auto [id, uset] : sparse) {
+    order.push(Id::fromWord(id));
+  }
+  Id prev = Id::invalid();
+  for (; !order.empty(); order.pop()) {
+    auto id = order.top();
+    if (id == prev) {
+      continue;
+    } else {
+      prev = id;
+    }
+    base_lookup->factById(id, [&](Pid type, Fact::Clause clause) {
+      stats.bumpBase();
+      processFact({id, type, clause});
+      for (const auto ref : refs) {
+        order.push(ref);
+      }
+      refs.clear();
+    });
+  }
+
+  stats.dump();
+}
+} // namespace
+
+/* Note [stacked incremental DBs]
+
+A stacked DB might induce changes to the ownership of facts in DBs
+below it in the stack. So we have to propagate ownership from facts in
+the stacked DB to facts in the base DB(s).  The basic approach is
+
+  * Each DB stores ownership information about its own facts and
+    potentially facts in base DB(s).
+
+  * getOwner() in a stacked DB traverses the stack downwards,
+    returning the first owner found.
+
+  * Therefore, if a fact F has owner A in the base DB and a new owner B
+    in the stacked DB, we have to assign it owner A || B.
+
+  * Thus, an owner set in a stacked DB (A || B) may refer to owner
+    sets in a base DB (A).
+
+  * A derived fact in the stacked DB will be given the correct owner,
+    because its ownership is determined by calling getOwner() on each of
+    the facts that it was derived from, even if some of those are in
+    a base DB.
+*/
+
+std::unique_ptr<ComputedOwnership> computeOwnership(
+    const Inventory& inventory,
+    Lookup& lookup, // the current DB, *not* stacked
+    Lookup* base_lookup, // the base DB stack, if this is a stack
+    OwnershipUnitIterator* iter) {
+  uint32_t firstUsetId;
+  auto t = makeAutoTimer("computeOwnership");
+  VLOG(1) << "computing ownership";
+
+  const auto min_id = lookup.startingId();
+  const auto max_id = lookup.firstFreeId();
+
+  auto utrie = fillOwnership(iter, firstUsetId);
+  t.log("fillOwnership");
+  auto usets = collectUsets(firstUsetId, *utrie);
+  t.log("collectUsets");
+  // TODO: Should `completeOwnership` work with the trie rather than a
+  // flat vector?
+
+  auto flattened = utrie->flatten(min_id.toWord(), max_id.toWord());
+
+  // The trie is no longer required, so free it
+  utrie.reset();
+
+  const auto owner = [&](Id id) -> Uset*& {
+    return flattened.dense[id.toWord() - min_id.toWord()];
+  };
+
+  completeOwnership(
+      flattened.dense, flattened.sparse, usets, inventory, lookup, base_lookup);
+  t.log("completeOwnership");
+
+  std::vector<std::pair<Id, UsetId>> factOwners;
+
+  // Collect fact ownership for facts in the base DB(s). This data is sparse,
+  // but we currently store it as intervals in factOwners because that's the
+  // only way to store fact ownership currently. This is a terrible
+  // representation since there are typically almost no adjacent facts with the
+  // same owner in this dataset.
+  //
+  // TODO: use a more suitable representation for the sparse ownership
+  std::vector<std::pair<uint64_t, Uset*>> order;
+  for (auto& pr : flattened.sparse) {
+    order.push_back(pr);
+  }
+  std::sort(order.begin(), order.end());
+  Id prev = Id::lowest() - 1;
+  UsetId current = INVALID_USET;
+  for (auto& pr : order) {
+    auto id = Id::fromWord(pr.first);
+    auto usetid = pr.second->id;
+    VLOG(5) << folly::sformat("sparse owner: {} -> {}", id.toWord(), usetid);
+    if (id != prev + 1 || current != usetid) {
+      if (id != prev + 1) {
+        factOwners.emplace_back(prev + 1, INVALID_USET);
+      }
+      factOwners.emplace_back(id, usetid);
+      current = usetid;
+    }
+    prev = id;
+  }
+  // fill the gap between the sparse and dense mappings with INVALID_USET
+  if (prev + 1 < min_id) {
+    factOwners.emplace_back(prev + 1, INVALID_USET);
+    current = INVALID_USET;
+  }
+
+  Id id = min_id;
+  for (; id < min_id + flattened.dense.size(); id++) {
+    auto& set = owner(id);
+    auto usetid = set ? set->id : INVALID_USET;
+    if (usetid != current) {
+      factOwners.emplace_back(id, usetid);
+      current = usetid;
+    }
+  }
+  // if dense didn't cover the whole Id range, add a final interval of
+  // INVALID_USET
+  if (id < max_id - 1 && current != INVALID_USET) {
+    factOwners.emplace_back(id, INVALID_USET);
+  }
+
+  return std::make_unique<ComputedOwnership>(
+      std::move(usets), std::move(factOwners));
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership.h b/glean/rts/ownership.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+#include "glean/rts/id.h"
+#include "glean/rts/ownership/uset.h"
+
+#include <folly/Optional.h>
+#include <folly/Range.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+using UnitId = uint32_t;
+
+using MutableOwnerSet = folly::compression::MutableEliasFanoCompressedList;
+using OwnerSet = folly::compression::EliasFanoCompressedList;
+
+void serializeEliasFano(binary::Output& out, const OwnerSet& set);
+
+/// Deserialize an OwnerSet from a binary::Input. Note that the
+// OwnerSet points to the contents of the binary::Input, so that
+// must remain alive as long as the OwnerSet is needed.
+OwnerSet deserializeEliasFano(binary::Input& in);
+
+struct OwnershipSetIterator {
+  virtual ~OwnershipSetIterator() {}
+  virtual std::pair<size_t, size_t> sizes() const = 0;
+  virtual folly::Optional<std::pair<UsetId, SetExpr<const OwnerSet*>>>
+  get() = 0;
+};
+
+struct OwnershipStats {
+  uint64_t num_units;
+  size_t units_size;
+
+  uint64_t num_sets;
+  size_t sets_size;
+
+  uint64_t num_owner_entries;
+  size_t owners_size;
+
+  int64_t num_orphan_facts; // <0 means "don't know yet"
+};
+
+///
+// Interface for reading ownership data.
+//
+struct Ownership {
+  virtual ~Ownership() {}
+
+  // Iterate through all the ownership expressions
+  virtual std::unique_ptr<OwnershipSetIterator> getSetIterator() = 0;
+
+  // Next unused set ID
+  virtual UsetId nextSetId() = 0;
+
+  // Look up a set, can return INVALID_USET if it doesn't exist
+  virtual UsetId lookupSet(Uset*) = 0;
+
+  // Fetch the set corresponding to a UsetId. This is used for
+  // introspection only.
+  virtual folly::Optional<SetExpr<SetU32>> getUset(UsetId) = 0;
+
+  // Look up the UnitId for a unit
+  virtual folly::Optional<UnitId> getUnitId(folly::ByteRange unit) = 0;
+
+  // Return stats about the ownership data
+  virtual OwnershipStats getStats() = 0;
+};
+
+///
+// Computed ownership data stored in memory.
+// Holds data about multiple predicates.
+// Contains the canonical 'UsetId's that will be added to the database.
+//
+struct ComputedOwnership {
+  ComputedOwnership(Usets&& sets, std::vector<std::pair<Id, UsetId>>&& facts)
+      : sets_(std::move(sets)), facts_(std::move(facts)) {}
+
+  // Sets, indexed by UsetId starting at firstId_
+  Usets sets_;
+
+  // Maps fact Ids to owner sets, represented as intervals
+  std::vector<std::pair<Id, UsetId>> facts_;
+};
+
+/**
+ * Raw ownership data (facts -> unit)
+ */
+struct OwnershipUnit {
+  /** Id range */
+  struct Ids {
+    /** First id in range */
+    Id start;
+
+    /** Last id in range */
+    Id finish;
+  };
+
+  /** The ownership unit that the facts belong to. */
+  UnitId unit;
+
+  /** Fact ids owner by the unit. */
+  folly::Range<const Ids*> ids;
+};
+
+struct OwnershipUnitIterator {
+  virtual ~OwnershipUnitIterator() {}
+
+  // `OwnershipUnit`s are expected to be produced in strictly
+  // ascending order of `unit`.
+  virtual folly::Optional<OwnershipUnit> get() = 0;
+};
+
+struct Inventory;
+struct Lookup;
+
+/**
+ * Compute ownership data for non-derived facts
+ */
+std::unique_ptr<ComputedOwnership> computeOwnership(
+    const Inventory& inventory,
+    Lookup& lookup,
+    Lookup* base_lookup,
+    OwnershipUnitIterator* iter);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/derived.cpp b/glean/rts/ownership/derived.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/derived.cpp
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <folly/container/F14Map.h>
+#include <numeric>
+
+#include "glean/rts/lookup.h"
+#include "glean/rts/ownership/derived.h"
+#include "glean/rts/timer.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+void DefineOwnership::derivedFrom(
+    Pid pid,
+    Id id,
+    const std::set<UsetId>& deps) {
+  if (deps.size() == 0) {
+    return;
+  }
+
+  const auto [it, _] = defines_.insert({pid, PerPredicate()});
+  PerPredicate& pred = it->second;
+
+  SetU32 set = SetU32::from(deps);
+  size_t size = set.size();
+
+  UsetId usetid;
+  if (size == 1) {
+    usetid = *deps.begin();
+  } else {
+    auto uset = std::make_unique<Uset>(std::move(set), And, 0);
+    // If this set already exists in the DB, it will be de-duplicated
+    // when we write these sets in addDefineOwnership().
+    auto q = uset.get();
+    auto p = usets_.add(std::move(uset));
+    if (p == q) {
+      usets_.promote(p);
+      usetid = p->id;
+      newSets_.push_back(p);
+      VLOG(2) << "new set: " << usetid << ", size = " << size;
+    } else {
+      usetid = p->id;
+      VLOG(2) << "existing set in batch: " << usetid;
+    }
+  }
+
+  if (id >= first_id_) {
+    pred.new_ids_.push_back(id);
+    pred.new_owners_.push_back(usetid);
+  } else {
+    pred.ids_.push_back(id);
+    pred.owners_.push_back(usetid);
+  }
+}
+
+void DefineOwnership::sortByOwner(uint64_t facts, std::vector<int64_t>& order) {
+  // We have a set of facts in the batch with Ids [first_id, first_id+1, ..]
+  // We want to group these facts by owner, so that facts with the same
+  // owner are adjacent.
+  //
+  // We're going to rearrange the facts and give them new IDs.
+  //
+  // 0. we start with
+  //       ids =    [ 0, 1, 2, 3, 0 ]
+  //       owners = [ C, B, A, B, A ]
+  //  Note that we may have recorded multiple owners for some facts.
+  //
+  // 1. make a vector of owners, indexed by fact ID:
+  //          [ X, B, A, B ]
+  // for a fact that has multiple owners, we'll make up a temporary
+  // new set Id. These are only for sorting purposes, they're not real
+  // set Ids - the real ones are created later in
+  // computeDerivedOwnership().
+  //
+  // e.g. we need a new set ID (let's use X) to represent the owner of
+  // fact 0, because it has multiple owners assigned (C and A).
+
+  std::vector<UsetId> owners(facts, INVALID_USET);
+
+  auto tmpset = usets_.getNextId();
+  for (auto& [_, pred] : defines_) {
+    for (size_t i = 0; i < pred.new_ids_.size(); i++) {
+      auto ix = pred.new_ids_[i] - first_id_;
+      if (owners[ix] == INVALID_USET) {
+        owners[ix] = pred.new_owners_[i];
+      } else {
+        // this fact has multiple owners, use a new temporary UsetId.
+        owners[ix] = tmpset++;
+      }
+    }
+  }
+
+  // 2. order is some permutation of [0..facts-1]. sort by owner = [ 2, 1, 3, 0
+  // ]
+  //
+  // This is the order in which we will serialize the facts, which
+  // essentially renumbers them. Hence the facts will be renumbered
+  //    2 -> 0
+  //    1 -> 1
+  //    3 -> 2
+  //    0 -> 3
+
+  sort(order.begin(), order.end(), [&](uint64_t a, uint64_t b) {
+    return owners[a - first_id_.toWord()] < owners[b - first_id_.toWord()];
+  });
+
+  // 3. produce a mapping from old fact Ids to new fact Ids
+
+  std::vector<Id> idmap(facts, Id::invalid());
+  for (size_t i = 0; i < order.size(); i++) {
+    idmap[order[i] - first_id_.toWord()] = Id::fromWord(i + first_id_.toWord());
+  }
+
+  // 4. substitute fact IDs in new_ids
+
+  for (auto& [_, pred] : defines_) {
+    for (size_t i = 0; i < pred.new_ids_.size(); i++) {
+      pred.new_ids_[i] = idmap[pred.new_ids_[i] - first_id_];
+    }
+  }
+
+  // At this point we must serialize the batch using
+  // serializeReorder(order) so that the facts agree with the IDs used
+  // in this DefineOwnership.
+}
+
+void DefineOwnership::subst(const Substitution& subst) {
+  for (auto& [_, pred] : defines_) {
+    for (auto& id : pred.ids_) {
+      id = subst.subst(id);
+    }
+    for (auto& id : pred.new_ids_) {
+      id = subst.subst(id);
+    }
+  }
+}
+
+std::unique_ptr<ComputedOwnership> computeDerivedOwnership(
+    Ownership& ownership,
+    Lookup* base, // Lookup for the base DB, if there is one
+    DerivedFactOwnershipIterator* iter) {
+  auto t = makeAutoTimer("computeDerivedOwnership");
+  VLOG(1) << "computing derived ownership";
+
+  // Here we are identifying facts that were derived multiple
+  // different ways.  e.g. if a fact was derived twice with owners A
+  // and B, then its final ownership set will be A || B. That is, the
+  // fact will be visibile (derivable) if either A or B are visible.
+
+  std::map<uint64_t, UsetId> factOwners;
+  folly::F14FastMap<uint64_t, std::set<UsetId>> factOwnerSets;
+
+  auto min_id = base ? base->firstFreeId() : Id::lowest();
+
+  while (const auto owners = iter->get()) {
+    for (uint32_t i = 0; i < owners->ids.size(); i++) {
+      auto id = owners->ids[i].toWord();
+      auto owner = owners->owners[i];
+      bool is_base_fact = base && id < min_id.toWord();
+      const auto [it, inserted] = factOwners.insert({id, owner});
+      if (!inserted || is_base_fact) {
+        // The second time we see a fact, create an entry in factOwnerSets
+        const auto [it2, _] = factOwnerSets.insert({id, {it->second}});
+        it2->second.insert(owner);
+        if (inserted && is_base_fact) {
+          // If this is a fact in the base DB, we need to OR the new owners with
+          // the existing owner, creating a new set. This owner set will
+          // then override the ownership of the fact in the base DB.
+          auto baseOwner = base->getOwner(Id::fromWord(id));
+          VLOG(2) << "baseOwner: " << baseOwner;
+          if (baseOwner != INVALID_USET) {
+            it2->second.insert(baseOwner);
+          }
+        }
+      }
+    }
+  }
+
+  // Create all the new sets
+  //   we are under the write lock here, so we can create canonical
+  //   sets, no need to rebase them later.
+
+  Usets usets(ownership.nextSetId());
+
+  for (auto& pair : factOwnerSets) {
+    if (pair.second.size() > 1) {
+      SetU32 set = SetU32::from(pair.second);
+      auto uset = std::make_unique<Uset>(std::move(set), Or, 0);
+      auto usetid = ownership.lookupSet(uset.get());
+      if (usetid == INVALID_USET) {
+        auto p = usets.add(std::move(uset));
+        usets.promote(p);
+        usetid = p->id;
+        VLOG(2) << "new set: " << usetid;
+      } else {
+        VLOG(2) << "existing set: " << usetid;
+      }
+      factOwners[pair.first] = usetid;
+    }
+  }
+
+  // convert factOwners into a vector of intervals. factOwners may be sparse,
+  // because we may have derived facts that already existed in a base DB, so we
+  // have to be careful to fill in gaps in the interval map with INVALID_USET
+  std::vector<std::pair<Id, UsetId>> intervals;
+  intervals.reserve(factOwners.size());
+  UsetId current = INVALID_USET;
+  Id prev = Id::lowest() - 1;
+  for (auto& pair : factOwners) {
+    auto id = Id::fromWord(pair.first);
+    auto usetid = pair.second;
+    if (id != prev + 1 || usetid != current) {
+      if (id != prev + 1) {
+        intervals.emplace_back(prev + 1, INVALID_USET);
+      }
+      intervals.emplace_back(id, usetid);
+      current = usetid;
+    }
+    prev = id;
+  }
+  if (!intervals.empty()) {
+    intervals.emplace_back(prev + 1, INVALID_USET);
+  }
+
+  VLOG(1) << "computing derived ownership: " << intervals.size()
+          << " intervals";
+
+  // Now build a ComputedOwnership that we can return
+  return std::make_unique<ComputedOwnership>(
+      std::move(usets), std::move(intervals));
+}
+
+void addDerived(
+    Lookup* lookup,
+    DefineOwnership* define,
+    Pid pid,
+    DerivedDependencyIterator* it) {
+  while (auto v = it->get()) {
+    auto& facts = v->first;
+    auto& deps = v->second;
+    std::set<UsetId> owners;
+    for (auto dep : deps) {
+      auto owner = lookup->getOwner(dep);
+      if (owner == INVALID_USET) {
+        VLOG(1) << "fact " << dep.toWord() << " has no owner";
+      } else {
+        owners.insert(owner);
+      }
+    }
+
+    if (owners.size() > 0) {
+      for (auto id : facts) {
+        define->derivedFrom(pid, id, owners);
+      }
+    }
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/derived.h b/glean/rts/ownership/derived.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/derived.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/ownership.h"
+#include "glean/rts/substitution.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+// Ownership data for all derived predicates in a batch.
+struct DefineOwnership {
+  DefineOwnership(Ownership* ownership, Id first_id)
+      : first_id_(first_id),
+        ownership_(ownership),
+        defines_(),
+        usets_(ownership->nextSetId()),
+        newSets_() {}
+
+  // record that a fact was derived from some other facts
+  void derivedFrom(Pid pid, Id id, const std::set<UsetId>& deps);
+
+  // Apply a substitution to the Ids
+  void subst(const Substitution& subst);
+
+  void sortByOwner(uint64_t facts, std::vector<int64_t>& order);
+
+  struct PerPredicate {
+    // new owners for exsiting facts (< first_id)
+    std::vector<Id> ids_;
+    std::vector<UsetId> owners_;
+
+    // owners for new facts in this batch
+    std::vector<Id> new_ids_;
+    std::vector<UsetId> new_owners_;
+  };
+
+  using const_iterator = std::map<Pid, PerPredicate>::const_iterator;
+  const_iterator begin() {
+    return defines_.begin();
+  }
+  const_iterator end() {
+    return defines_.end();
+  }
+
+  // first fact Id in the current batch
+  Id first_id_;
+  Ownership* ownership_;
+  std::map<Pid, PerPredicate> defines_;
+
+  Usets usets_;
+
+  // new sets in order of creation, needed for rebasing the sets against
+  // the DB later.
+  std::vector<Uset*> newSets_;
+};
+
+struct DerivedFactOwnership {
+  folly::Range<const Id*> ids;
+  folly::Range<const UsetId*> owners;
+};
+
+struct DerivedFactOwnershipIterator {
+  virtual ~DerivedFactOwnershipIterator() {}
+
+  // Note: the result is only valid until the next call to get()
+  virtual folly::Optional<DerivedFactOwnership> get() = 0;
+};
+
+///
+// Compute ownership data for derived facts
+//
+std::unique_ptr<ComputedOwnership> computeDerivedOwnership(
+    Ownership& ownership,
+    Lookup* base,
+    DerivedFactOwnershipIterator* iter);
+
+struct DerivedDependencyIterator {
+  virtual ~DerivedDependencyIterator() {}
+  virtual folly::Optional<std::pair<std::vector<Id>, std::vector<Id>>>
+  get() = 0;
+};
+
+///
+// Add ownership data for externally derived facts
+//
+void addDerived(
+    Lookup* lookup,
+    DefineOwnership* define,
+    Pid pid,
+    DerivedDependencyIterator* it);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/fallbackavx.h b/glean/rts/ownership/fallbackavx.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/fallbackavx.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+/*
+ * Stubbed API for AVX instruction dependencies
+ */
+
+#pragma once
+
+#include <glog/logging.h>
+
+#include <stdint.h>
+
+#include <folly/Range.h>
+#include <folly/compression/Instructions.h>
+
+/*
+ * Stub of EliasFanoCoding.h API used by Glean
+ */
+namespace folly {
+namespace compression {
+
+template <class Pointer>
+struct EliasFanoCompressedListBase {
+  EliasFanoCompressedListBase() = default;
+
+  template <class OtherPointer>
+  EliasFanoCompressedListBase(
+      const EliasFanoCompressedListBase<OtherPointer>& other)
+      : size(other.size),
+        numLowerBits(other.numLowerBits),
+        upperSizeBytes(other.upperSizeBytes),
+        data(other.data),
+        skipPointers(reinterpret_cast<Pointer>(other.skipPointers)),
+        forwardPointers(reinterpret_cast<Pointer>(other.forwardPointers)),
+        lower(reinterpret_cast<Pointer>(other.lower)),
+        upper(reinterpret_cast<Pointer>(other.upper)) {}
+
+  void free(void) {
+    return;
+  }
+  size_t size = 0;
+  uint8_t numLowerBits = 0;
+  size_t upperSizeBytes = 0;
+  Range<Pointer> data;
+  Pointer skipPointers = nullptr;
+  Pointer forwardPointers = nullptr;
+  Pointer lower = nullptr;
+  Pointer upper = nullptr;
+};
+
+using EliasFanoCompressedList = EliasFanoCompressedListBase<const uint8_t*>;
+using MutableEliasFanoCompressedList = EliasFanoCompressedListBase<uint8_t*>;
+
+template <
+    class Value,
+    class SkipValue = uint64_t,
+    size_t kSkipQuantum = 0, // 0 = disabled
+    size_t kForwardQuantum = 0, // 0 = disabled
+    bool kUpperFirst = false>
+struct EliasFanoEncoder {
+  using CompressedList = EliasFanoCompressedList;
+  using MutableCompressedList = MutableEliasFanoCompressedList;
+
+  using ValueType = Value;
+  using SkipValueType = SkipValue;
+
+  EliasFanoEncoder(size_t size_, ValueType upperBound) : size(size_) {}
+
+  void add(ValueType value) {
+    return;
+  }
+
+  const MutableCompressedList& finish() {
+    return result_;
+  }
+
+  size_t size = 0;
+  MutableCompressedList result_;
+};
+
+template <
+    class Encoder,
+    class Instructions = instructions::Default,
+    bool kUnchecked = false,
+    class SizeT = typename Encoder::SkipValueType>
+class EliasFanoReader {
+ public:
+  using EncoderType = Encoder;
+  using ValueType = typename Encoder::ValueType;
+  using SizeType = SizeT;
+
+  EliasFanoReader(const typename Encoder::CompressedList& list)
+      : numLowerBits_(list.numLowerBits) {}
+
+  bool previous() {
+    return false;
+  }
+  bool next() {
+    return false;
+  }
+
+  ValueType value() const {
+    return value_;
+  }
+
+  template <bool kCanBeAtValue = true>
+  bool skipTo(ValueType value) {
+    return true;
+  }
+
+  bool valid() const {
+    return true;
+  }
+
+ private:
+  ValueType value_;
+  const uint8_t numLowerBits_;
+};
+
+} // namespace compression
+} // namespace folly
diff --git a/glean/rts/ownership/pool.h b/glean/rts/ownership/pool.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/pool.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+template <typename T>
+struct Pool {
+  static_assert(std::is_trivially_destructible_v<T>, "invalid T");
+  std::vector<char*> pages;
+  size_t page_size;
+  size_t filled;
+
+  Pool() noexcept {
+    page_size = folly::goodMallocSize(1000000) / sizeof(T);
+    filled = page_size;
+  }
+
+  ~Pool() noexcept {
+    clear();
+  }
+
+  Pool(const Pool&) = delete;
+  Pool(Pool&&) noexcept = default;
+
+  Pool& operator=(const Pool&) = delete;
+  Pool& operator=(Pool&&) noexcept = default;
+
+  void swap(Pool& other) {
+    pages.swap(other.pages);
+    std::swap(page_size, other.page_size);
+    std::swap(filled, other.filled);
+  }
+
+  void clear() {
+    for (auto p : pages) {
+      free(p);
+    }
+    pages.clear();
+    filled = page_size;
+  }
+
+  void* next() {
+    if (filled == page_size) {
+      pages.push_back(static_cast<char*>(malloc(sizeof(T) * page_size)));
+      filled = 0;
+    }
+    const auto p = pages.back() + filled * sizeof(T);
+    ++filled;
+    return p;
+  }
+
+  template <typename... Args>
+  T* alloc(Args&&... args) {
+    return new (next()) T(std::forward<Args>(args)...);
+  }
+
+  size_t count() const {
+    return pages.size() * page_size + filled - page_size;
+  }
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/setu32.cpp b/glean/rts/ownership/setu32.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/setu32.cpp
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/ownership/setu32.h"
+
+#include <folly/lang/Assume.h>
+
+#include <xxhash.h>
+
+using namespace folly::compression;
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+template <typename T>
+bool vec_eq(const std::vector<T>& x, const std::vector<T>& y) {
+  const auto n = x.size();
+  return n == y.size() &&
+      (n == 0 || std::memcmp(x.data(), y.data(), n * sizeof(x[0])) == 0);
+}
+
+template <typename T>
+static uint64_t vec_hash(const std::vector<T>& x, uint64_t seed = 0) {
+  return XXH64(x.data(), x.size() * sizeof(x[0]), seed);
+}
+
+template <typename T>
+static size_t vec_bytes(const std::vector<T>& x) {
+  return x.size() * sizeof(x[0]);
+}
+
+} // namespace
+
+bool SetU32::Block::operator==(const SetU32::Block& other) const {
+  if (hdr != other.hdr) {
+    return false;
+  }
+  switch (hdr.type()) {
+    case SetU32::Hdr::Sparse:
+      return std::memcmp(&*sparse, &*other.sparse, hdr.sparseLen()) == 0;
+    case SetU32::Hdr::Dense:
+      return *dense == *other.dense;
+    case SetU32::Hdr::Full:
+      return true;
+  }
+  folly::assume_unreachable();
+}
+
+bool SetU32::Block::includes(const SetU32::Block& other) const {
+  if (hdr.id() != other.hdr.id()) {
+    return false;
+  }
+
+  switch (hdr.type()) {
+    case SetU32::Hdr::Sparse:
+      return other.hdr.type() == SetU32::Hdr::Sparse &&
+          std::includes(
+                 sparse,
+                 sparse + hdr.sparseLen(),
+                 other.sparse,
+                 other.sparse + other.hdr.sparseLen());
+
+    case SetU32::Hdr::Dense:
+      switch (other.hdr.type()) {
+        case SetU32::Hdr::Sparse: {
+          const auto v = *dense;
+          for (auto i = 0; i < other.hdr.sparseLen(); ++i) {
+            if (!v.contains(other.sparse[i])) {
+              return false;
+            }
+          }
+          return true;
+        }
+
+        case SetU32::Hdr::Dense: {
+          return dense->includes(*other.dense);
+        }
+
+        case SetU32::Hdr::Full:
+          return false;
+      }
+      break;
+
+    case SetU32::Hdr::Full:
+      return true;
+  }
+
+  folly::assume_unreachable();
+}
+
+SetU32::SetU32(const SetU32& other, SetU32::copy_capacity_tag) {
+  reserve(other.capacities());
+  hdrs.insert(hdrs.begin(), other.hdrs.begin(), other.hdrs.end());
+  dense.insert(dense.begin(), other.dense.begin(), other.dense.end());
+  sparse.insert(sparse.begin(), other.sparse.begin(), other.sparse.end());
+}
+
+bool SetU32::operator==(const SetU32& other) const {
+  return vec_eq(hdrs, other.hdrs) && vec_eq(dense, other.dense) &&
+      vec_eq(sparse, other.sparse);
+}
+
+uint64_t SetU32::hash(uint64_t seed) const {
+  return vec_hash(sparse, vec_hash(dense, vec_hash(hdrs, seed)));
+}
+
+SetU32::Sizes SetU32::sizes() const {
+  return {hdrs.size(), dense.size(), sparse.size()};
+}
+
+SetU32::Sizes SetU32::capacities() const {
+  return {hdrs.capacity(), dense.capacity(), sparse.capacity()};
+}
+
+size_t SetU32::bytes() const {
+  return vec_bytes(hdrs) + vec_bytes(dense) + vec_bytes(sparse);
+}
+
+SetU32::const_iterator SetU32::lower_bound(
+    SetU32::const_iterator start,
+    SetU32::const_iterator finish,
+    uint32_t id) {
+  struct Local {
+    static std::pair<uint32_t, uint32_t> lengths(
+        std::vector<Hdr>::const_iterator first,
+        std::vector<Hdr>::const_iterator last) {
+      uint32_t dense = 0;
+      uint32_t sparse = 0;
+      while (first != last) {
+        dense += first->denseLen();
+        sparse += first->sparseLen();
+        ++first;
+      }
+      return {dense, sparse};
+    }
+  };
+
+  auto pos = std::lower_bound(start.hdrs, finish.hdrs, id, [](auto x, auto id) {
+    return x.before(id);
+  });
+  const auto l = pos - start.hdrs;
+  const auto r = finish.hdrs - pos;
+  if (l <= r) {
+    const auto [d, s] = Local::lengths(start.hdrs, pos);
+    return {pos, start.block.dense + d, start.block.sparse + s};
+  } else {
+    const auto [d, s] = Local::lengths(pos, finish.hdrs);
+    return {pos, finish.block.dense - d, finish.block.sparse - s};
+  }
+}
+
+void SetU32::reserve(Sizes sizes) {
+  hdrs.reserve(sizes.hdrs);
+  dense.reserve(sizes.dense);
+  sparse.reserve(sizes.sparse);
+}
+
+void SetU32::shrink_to_fit() {
+  hdrs.shrink_to_fit();
+  dense.shrink_to_fit();
+  sparse.shrink_to_fit();
+}
+
+size_t SetU32::size() const {
+  size_t s = 0;
+  for (auto& block : *this) {
+    switch (block.hdr.type()) {
+      case Hdr::Sparse: {
+        s += block.hdr.sparseLen();
+        break;
+      }
+      case Hdr::Dense: {
+        s += block.dense->count();
+        break;
+      }
+      case Hdr::Full: {
+        s += 256;
+        break;
+      }
+    }
+  }
+  return s;
+}
+
+uint32_t SetU32::upper() const {
+  auto& hdr = this->hdrs.back();
+  auto id = hdr.id() << 8;
+  switch (hdr.type()) {
+    case Hdr::Sparse: {
+      return id | this->sparse.back();
+    }
+    case Hdr::Dense: {
+      return id | this->dense.back().upper();
+    }
+    case Hdr::Full: {
+      return id | 255;
+    }
+  }
+  folly::assume_unreachable();
+}
+
+void SetU32::append(uint32_t value) {
+  const auto block = value / 256;
+  const auto bit = value % 256;
+  if (!hdrs.empty() && hdrs.back().id() == block) {
+    auto& hdr = hdrs.back();
+    switch (hdr.type()) {
+      case Hdr::Sparse:
+        assert(bit >= sparse.back());
+        if (bit != sparse.back()) {
+          const auto len = hdr.sparseLen();
+          if (fitsSparse(len, 1)) {
+            hdr.addSparseLen(1);
+            sparse.push_back(bit);
+          } else {
+            dense.push_back(
+                Bits256(&*(sparse.end() - len), len) | Bits256::single(bit));
+            sparse.resize(sparse.size() - len);
+            hdr = Hdr::dense(block);
+          }
+        }
+        break;
+      case Hdr::Dense:
+        dense.back() |= Bits256::single(bit);
+        if (dense.back() == Bits256::all()) {
+          dense.pop_back();
+          hdr = Hdr::full(block);
+        }
+        break;
+
+      case Hdr::Full:
+        assert(bit == 255);
+    }
+  } else {
+    hdrs.push_back(Hdr::sparse(block, 1));
+    sparse.push_back(bit);
+  }
+}
+
+void SetU32::append(const_iterator start, const_iterator finish) {
+  hdrs.insert(hdrs.end(), start.hdrs, finish.hdrs);
+  dense.insert(dense.end(), start.block.dense, finish.block.dense);
+  sparse.insert(sparse.end(), start.block.sparse, finish.block.sparse);
+}
+
+namespace {
+
+enum Which { Left, Right };
+
+std::tuple<
+    const SetU32*,
+    const SetU32*,
+    SetU32::const_iterator,
+    SetU32::const_iterator>
+skipSubset(const SetU32* l, const SetU32* r) {
+  auto left = l->begin();
+  auto left_end = l->end();
+  auto right = r->begin();
+  auto right_end = r->end();
+
+  while (left != left_end && right != right_end && *left == *right) {
+    ++left;
+    ++right;
+  }
+
+  bool swapit = false;
+  if (right != right_end) {
+    if (left == left_end || right.hdrs->id() < left.hdrs->id()) {
+      swapit = true;
+    } else if (right->includes(*left)) {
+      ++left;
+      ++right;
+      swapit = true;
+    }
+  }
+
+  if (swapit) {
+    std::swap(l, r);
+    std::swap(left, right);
+    std::swap(left_end, right_end);
+  }
+
+  while (left != left_end && right != right_end) {
+    if (left.hdrs->id() < right.hdrs->id()) {
+      left = SetU32::lower_bound(left, left_end, right.hdrs->id());
+    } else if (left->includes(*right)) {
+      ++left;
+      ++right;
+    } else {
+      break;
+    }
+  }
+  return {l, r, left, right};
+}
+
+} // namespace
+
+void SetU32::append(uint32_t id, Bits256 w) {
+  if (w == Bits256::all()) {
+    hdrs.push_back(Hdr::full(id));
+  } else {
+    hdrs.push_back(Hdr::dense(id));
+    dense.push_back(w);
+  }
+}
+
+void SetU32::appendMerge(SetU32::Block left, SetU32::Block right) {
+  struct Local {
+    static void mergeSparse(
+        SetU32& set,
+        uint32_t id,
+        std::vector<uint8_t>::const_iterator ls,
+        uint8_t ln,
+        std::vector<uint8_t>::const_iterator rs,
+        uint8_t rn) {
+      uint8_t n = 0;
+      while (ln != 0 && rn != 0 && fitsSparse(n, 1)) {
+        const auto l = *ls;
+        const auto r = *rs;
+        set.sparse.push_back(l <= r ? l : r);
+        ++n;
+        if (l <= r) {
+          ++ls;
+          --ln;
+        }
+        if (r <= l) {
+          ++rs;
+          --rn;
+        }
+      }
+      if (fitsSparse(n, ln + rn)) {
+        set.hdrs.push_back(Hdr::sparse(id, n + ln + rn));
+        set.sparse.insert(set.sparse.end(), ls, ls + ln);
+        set.sparse.insert(set.sparse.end(), rs, rs + rn);
+      } else {
+        const auto dense =
+            Bits256(&*(set.sparse.end() - n), n).with(&*ls, ln).with(&*rs, rn);
+        set.hdrs.push_back(Hdr::dense(id));
+        set.dense.push_back(dense);
+        set.sparse.resize(set.sparse.size() - n);
+      }
+    }
+  };
+
+  switch (left.hdr.type()) {
+    case SetU32::Hdr::Sparse:
+      switch (right.hdr.type()) {
+        case SetU32::Hdr::Sparse:
+          Local::mergeSparse(
+              *this,
+              left.hdr.id(),
+              left.sparse,
+              left.hdr.sparseLen(),
+              right.sparse,
+              right.hdr.sparseLen());
+          break;
+
+        case SetU32::Hdr::Dense:
+          append(
+              left.hdr.id(),
+              right.dense->with(&*left.sparse, left.hdr.sparseLen()));
+          break;
+
+        case SetU32::Hdr::Full:
+          hdrs.push_back(right.hdr);
+          break;
+      }
+      break;
+
+    case SetU32::Hdr::Dense:
+      switch (right.hdr.type()) {
+        case SetU32::Hdr::Sparse:
+          append(
+              left.hdr.id(),
+              left.dense->with(&*right.sparse, right.hdr.sparseLen()));
+          break;
+
+        case SetU32::Hdr::Dense:
+          append(left.hdr.id(), *left.dense | *right.dense);
+          break;
+
+        case SetU32::Hdr::Full:
+          hdrs.push_back(right.hdr);
+          break;
+      }
+      break;
+
+    case SetU32::Hdr::Full:
+      hdrs.push_back(left.hdr);
+      break;
+  }
+}
+
+void SetU32::appendMerge(
+    SetU32::const_iterator left,
+    SetU32::const_iterator left_end,
+    SetU32::const_iterator right,
+    SetU32::const_iterator right_end) {
+  while (left != left_end && right != right_end) {
+    if (left.hdrs->id() < right.hdrs->id()) {
+      const auto prev = left;
+      left = SetU32::lower_bound(left, left_end, right.hdrs->id());
+      append(prev, left);
+    } else if (right.hdrs->id() < left.hdrs->id()) {
+      const auto prev = right;
+      right = SetU32::lower_bound(right, right_end, left.hdrs->id());
+      append(prev, right);
+    } else {
+      appendMerge(*left, *right);
+      ++left;
+      ++right;
+    }
+  }
+  append(left, left_end);
+  append(right, right_end);
+}
+
+const SetU32*
+SetU32::merge(SetU32& result, const SetU32& left, const SetU32& right) {
+  if (&left == &right) {
+    return &left;
+  } else {
+    auto [super, sub, super_s, sub_s] = skipSubset(&left, &right);
+    if (sub_s == sub->end()) {
+      return super;
+    } else {
+      result.reserve(left.sizes() + right.sizes());
+      result.append(super->begin(), super_s);
+      result.appendMerge(super_s, super->end(), sub_s, sub->end());
+      return &result;
+    }
+  }
+}
+
+SetU32::MutableEliasFanoList SetU32::toEliasFano(uint32_t upperBound) const {
+  auto max = this->upper();
+  // upperBound is a check only, to catch garbage before we store it
+  CHECK_LT(max, upperBound);
+  size_t size = this->size();
+  folly::compression::EliasFanoEncoder<uint32_t, uint32_t> encoder(size, max);
+
+  VLOG(5) << "upper=" << upperBound << ", size=" << size;
+  foreach([&](uint32_t elt) { encoder.add(elt); });
+  return encoder.finish();
+}
+
+SetU32 SetU32::fromEliasFano(const EliasFanoList& list) {
+  SetU32 set;
+  auto reader =
+      EliasFanoReader<folly::compression::EliasFanoEncoder<uint32_t, uint32_t>>(
+          list);
+  while (reader.next()) {
+    set.append(reader.value());
+  }
+  return set;
+}
+
+void SetU32::dump(SetU32& set) {
+  for (auto& block : set) {
+    auto id = block.hdr.id() << 8;
+    switch (block.hdr.type()) {
+      case SetU32::Hdr::Sparse: {
+        for (uint32_t i = 0; i < block.hdr.sparseLen(); i++) {
+          LOG(INFO) << "sparse: " << (id | block.sparse[i]);
+        }
+        break;
+      }
+      case SetU32::Hdr::Dense: {
+        for (uint32_t i = 0; i < 256; i++) {
+          if (block.dense->contains(i)) {
+            LOG(INFO) << "dense: " << (id | i);
+          }
+        }
+        break;
+      }
+      case SetU32::Hdr::Full: {
+        for (uint32_t i = 0; i < 256; i++) {
+          LOG(INFO) << "full: " << (id | i);
+        }
+        break;
+      }
+    }
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/setu32.h b/glean/rts/ownership/setu32.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/setu32.h
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Optional.h>
+#include <stdint.h>
+#include <algorithm>
+#include <cassert>
+#include <cstring>
+#include <set>
+#include <tuple>
+#include <vector>
+
+#if __x86_64__ // AVX required
+#include <folly/compression/elias_fano/EliasFanoCoding.h>
+#include <immintrin.h>
+#else
+#include "glean/rts/ownership/fallbackavx.h"
+#endif
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+#if !__x86_64__
+typedef uint32_t __m256i __attribute__((vector_size(32)));
+#endif
+
+/**
+ * An implementation of 256-bit bitsets. This uses AVX2, most probably
+ * unnecessarily.
+ */
+
+namespace impl {
+
+#if __x86_64__ // use AVX
+
+inline bool empty(__m256i value) {
+  return _mm256_testz_si256(value, value);
+}
+
+inline __m256i none() {
+  return _mm256_setzero_si256();
+}
+
+inline __m256i all() {
+  return _mm256_set1_epi32(-1);
+}
+
+inline __m256i single(uint8_t n) {
+  return _mm256_sllv_epi32(
+      _mm256_set1_epi32(1),
+      _mm256_sub_epi32(
+          _mm256_set1_epi32(n),
+          _mm256_set_epi32(224, 192, 160, 128, 96, 64, 32, 0)));
+}
+
+inline bool includes(__m256i value, __m256i other) {
+  return _mm256_testc_si256(value, other);
+}
+
+inline size_t count(__m256i value) {
+  const uint64_t* p = reinterpret_cast<const uint64_t*>(&value);
+  // _mm256_popcnt instructions require AVX512
+  return _mm_popcnt_u64(p[0]) + _mm_popcnt_u64(p[1]) + _mm_popcnt_u64(p[2]) +
+      _mm_popcnt_u64(p[3]);
+}
+
+inline uint32_t upper(__m256i value) {
+  const uint64_t* p = reinterpret_cast<const uint64_t*>(&value);
+  auto a = _lzcnt_u64(p[3]);
+  if (a < 64) {
+    return 255 - a;
+  }
+  a = _lzcnt_u64(p[2]);
+  if (a < 64) {
+    return 191 - a;
+  }
+  a = _lzcnt_u64(p[1]);
+  if (a < 64) {
+    return 127 - a;
+  }
+  return (63 - _lzcnt_u64(p[0]));
+}
+
+inline __m256i or_(__m256i value, __m256i other) {
+  return _mm256_or_si256(value, other);
+}
+
+inline __m256i and_(__m256i value, __m256i other) {
+  return _mm256_and_si256(value, other);
+}
+
+inline __m256i xor_(__m256i value, __m256i other) {
+  return _mm256_xor_si256(value, other);
+}
+
+#else // not x86_64
+
+inline bool empty(__m256i value) {
+  return !(
+      value[0] || value[1] || value[2] || value[3] || value[4] || value[5] ||
+      value[6] || value[7]);
+}
+
+inline __m256i none() {
+  __m256i v = {0, 0, 0, 0, 0, 0, 0, 0};
+  return v;
+}
+
+inline __m256i all() {
+  __m256i v = {0, 0, 0, 0, 0, 0, 0, 0};
+  return ~v;
+}
+
+inline __m256i single(uint8_t n) {
+  __m256i v0 = {224, 192, 160, 128, 96, 64, 32, 0},
+          v1 = {1, 1, 1, 1, 1, 1, 1, 1};
+  return v1 << (v0 - n);
+}
+
+inline bool includes(__m256i value, __m256i other) {
+  return empty(~value & other);
+}
+
+inline size_t count(__m256i value) {
+  const uint64_t* p = reinterpret_cast<const uint64_t*>(&value);
+  return __builtin_popcountl(p[0]) + __builtin_popcountl(p[1]) +
+      __builtin_popcountl(p[2]) + __builtin_popcountl(p[3]);
+}
+
+inline uint32_t upper(__m256i value) {
+  const uint64_t* p = reinterpret_cast<const uint64_t*>(&value);
+  if (p[3]) {
+    return 255 - __builtin_clzl(p[3]);
+  }
+  if (p[2]) {
+    return 191 - __builtin_clzl(p[2]);
+  }
+  if (p[1]) {
+    return 127 - __builtin_clzl(p[1]);
+  }
+  if (p[0]) {
+    return 63 - __builtin_clzl(p[0]);
+  }
+  return 0; // undefined
+}
+
+inline __m256i or_(__m256i value, __m256i other) {
+  return value | other;
+}
+
+inline __m256i and_(__m256i value, __m256i other) {
+  return value & other;
+}
+
+inline __m256i xor_(__m256i value, __m256i other) {
+  return value ^ other;
+}
+
+#endif
+
+} // namespace impl
+
+struct Bits256 {
+  __m256i value;
+
+  Bits256() = default;
+  explicit Bits256(__m256i v) : value(v) {}
+
+  Bits256(const uint8_t* vals, uint8_t len) {
+    *this = none().with(vals, len);
+  }
+
+  /// Check if this set is a superset of the other set
+  bool includes(Bits256 other) const {
+    return impl::includes(value, other.value);
+  }
+
+  bool contains(uint8_t n) const {
+    return !(*this & single(n)).empty();
+  }
+
+  bool empty() const {
+    return impl::empty(value);
+  }
+
+  bool operator==(Bits256 other) const {
+    return (*this ^ other).empty();
+  }
+
+  bool operator!=(Bits256 other) const {
+    return !(*this == other);
+  }
+
+  static Bits256 none() {
+    return Bits256(impl::none());
+  }
+
+  static Bits256 all() {
+    return Bits256(impl::all());
+  }
+
+  static Bits256 single(uint8_t n) {
+    return Bits256(impl::single(n));
+  }
+
+  size_t count() const {
+    return impl::count(value);
+  }
+
+  uint32_t upper() const {
+    return impl::upper(value);
+  }
+
+  Bits256 with(const uint8_t* vals, uint8_t len) const {
+    // TODO: try to vectorise and/or use lookup table
+    auto x = *this;
+
+    for (uint8_t i = 0; i < len; ++i) {
+      x |= single(vals[i]);
+    }
+
+    return x;
+  }
+
+  Bits256 operator|(Bits256 other) const {
+    return Bits256(impl::or_(value, other.value));
+  }
+
+  Bits256& operator|=(Bits256 other) {
+    *this = *this | other;
+    return *this;
+  }
+
+  Bits256 operator&(Bits256 other) const {
+    return Bits256(impl::and_(value, other.value));
+  }
+
+  Bits256& operator&=(Bits256 other) {
+    *this = *this & other;
+    return *this;
+  }
+
+  Bits256 operator^(Bits256 other) const {
+    return Bits256(impl::xor_(value, other.value));
+  }
+
+  Bits256& operator^=(Bits256 other) {
+    *this = *this ^ other;
+    return *this;
+  }
+};
+
+/**
+ * A memory-efficient representation of sets of uint32_t. This is quite similar
+ * to Roaring Bitmaps but with a different branching factor. It's not clear what
+ * effect this has - I came up with this independently and didn't have time to
+ * measure.
+ *
+ * We split the uint32_t key space into blocks of 256 values - the upper 24
+ * bits determine the block number and the lower 8 bits the index within the
+ * block. Each block can be empty, sparse, dense or full. For each non-empty
+ * block, we store a 32-bit block header in the the header array. The header
+ * contain the 24-bit block id and an 8-bit control byte (`Hdr`) which says what
+ * kind of block it is. The header array is sorted by block ids.
+ *
+ * Empty blocks are not stored in the set. Blocks with less than 32 elements are
+ * sparse and are stored as sorted arrays of 8-bit indices (in the `sparse`
+ * vector). Blocks with more than 31 but less than 256 elements are dense and
+ * are stored as 256-bit bitsets in the `dense` vector. Blocks with 256 elements
+ * are full - these blocks are marked separately in the control byte and no
+ * additional data is stored.
+ *
+ * The only two operations on sets that we need are appending a value (which is
+ * guaranteed to be >= the largest value in the set) and set union. In
+ * particular, we don't need random access which allow us to keep the
+ * representation simple.
+ */
+class SetU32 {
+ public:
+  /**
+   * Header control words. This is morally equivalent to
+   *
+   *   struct Hdr {
+   *     unsigned int id: 24;    // block id
+   *     unsigned int len: 6;    // number of elements in a sparse block or 0 if
+   *                             // this block isn't sparse
+   *     unsigned int type: 2;   // type = sparse, dense or full
+   *   };
+   *
+   * However, we do our own bit fiddling since we can do certain things faster.
+   * In particular, we try to avoid conditional branches as much as possible.
+   */
+  struct Hdr {
+    enum Type { Sparse = 0, Dense = 1, Full = 2 };
+
+    Hdr() = default;
+
+    static Hdr null() {
+      return {0, 0, Sparse};
+    }
+
+    static Hdr sparse(uint32_t id, uint8_t len) {
+      return {id, len, Sparse};
+    }
+
+    static Hdr dense(uint32_t id) {
+      return {id, 0, Dense};
+    }
+
+    static Hdr full(uint32_t id) {
+      return {id, 0, Full};
+    }
+
+    uint32_t id() const {
+      return value >> 8;
+    }
+
+    Type type() const {
+      return static_cast<Type>(value & 3);
+    }
+
+    /// sparseLen can be called on non-sparse blocks and will be 0 for them
+    uint32_t sparseLen() const {
+      return (value >> 2) & 63;
+    }
+
+    void addSparseLen(uint8_t n) {
+      assert(sparseLen() + n < 64);
+      value += n << 2;
+    }
+
+    /// Number of Bits256 blocks - 1 for dense blocks, 0 otherwise.
+    size_t denseLen() const {
+      return value & 1;
+    }
+
+    bool operator==(Hdr other) const {
+      return value == other.value;
+    }
+
+    bool operator!=(Hdr other) const {
+      return value != other.value;
+    }
+
+    bool before(uint32_t id) const {
+      return value < (id << 8);
+    }
+
+   private:
+    Hdr(uint32_t id, uint8_t len, Type type) {
+      value = (id << 8) | (uint32_t(len) << 2) | static_cast<uint32_t>(type);
+    }
+
+    uint32_t value;
+  };
+
+  struct Sizes {
+    size_t hdrs = 0;
+    size_t dense = 0;
+    size_t sparse = 0;
+
+    static Sizes max(const Sizes& x, const Sizes& y) {
+      return {
+          std::max(x.hdrs, y.hdrs),
+          std::max(x.dense, y.dense),
+          std::max(x.sparse, y.sparse)};
+    }
+
+    Sizes operator+(const Sizes& other) const {
+      return {hdrs + other.hdrs, dense + other.dense, sparse + other.sparse};
+    }
+  };
+
+  SetU32() = default;
+
+  struct copy_capacity_tag {};
+  static constexpr copy_capacity_tag copy_capacity{};
+
+  SetU32(const SetU32& other, copy_capacity_tag);
+
+  bool operator==(const SetU32& other) const;
+  bool operator!=(const SetU32& other) const {
+    return !(*this == other);
+  }
+
+  uint64_t hash(uint64_t seed) const;
+
+  Sizes sizes() const;
+  Sizes capacities() const;
+  size_t bytes() const;
+  size_t size() const;
+  uint32_t upper() const;
+
+  struct Block {
+    Hdr hdr;
+    std::vector<Bits256>::const_iterator dense;
+    std::vector<uint8_t>::const_iterator sparse;
+
+    bool operator==(const Block& other) const;
+    bool operator!=(const Block& other) const {
+      return !(*this == other);
+    }
+
+    bool includes(const Block& other) const;
+  };
+
+  struct const_iterator {
+    std::vector<Hdr>::const_iterator hdrs;
+    Block block;
+
+    const_iterator(
+        std::vector<Hdr>::const_iterator hdrs,
+        std::vector<Bits256>::const_iterator dense,
+        std::vector<uint8_t>::const_iterator sparse)
+        : hdrs(hdrs), block{Hdr::null(), dense, sparse} {}
+
+    const Block& operator*() const {
+      const_cast<Hdr&>(block.hdr) = *hdrs;
+      return block;
+    }
+
+    const Block* operator->() const {
+      return &operator*();
+    }
+
+    const_iterator& operator++() {
+      block.sparse += hdrs->sparseLen();
+      block.dense += hdrs->denseLen();
+      ++hdrs;
+      return *this;
+    }
+
+    const_iterator operator++(int) {
+      const auto x = *this;
+      ++*this;
+      return x;
+    }
+
+    bool operator==(const const_iterator& other) const {
+      return hdrs == other.hdrs;
+    }
+
+    bool operator!=(const const_iterator& other) const {
+      return hdrs != other.hdrs;
+    }
+  };
+
+  const_iterator begin() const {
+    return {hdrs.begin(), dense.begin(), sparse.begin()};
+  }
+
+  const_iterator end() const {
+    return {hdrs.end(), dense.end(), sparse.end()};
+  }
+
+  static const_iterator
+  lower_bound(const_iterator start, const_iterator finish, uint32_t id);
+
+  void reserve(Sizes sizes);
+  void shrink_to_fit();
+  void clear();
+
+  /// Append a new value which must be >= the largest value in the set
+  void append(uint32_t value);
+
+  static SetU32 from(const std::set<uint32_t>& set) {
+    SetU32 setu32;
+    for (auto elt : set) {
+      setu32.append(elt);
+    }
+    return setu32;
+  }
+
+  /**
+   * Merge two sets. If `right` is a subset of `left` or vice versa, returns a
+   * pointer to the superset. Otherwise, stores the result in `result` and
+   * returns a pointer to it.
+   */
+  static const SetU32*
+  merge(SetU32& result, const SetU32& left, const SetU32& right);
+
+  template <typename F>
+  void foreach(F&& f) const {
+    for (auto& block : *this) {
+      auto id = block.hdr.id() << 8;
+      switch (block.hdr.type()) {
+        case SetU32::Hdr::Sparse: {
+          for (uint32_t i = 0; i < block.hdr.sparseLen(); i++) {
+            f(id | block.sparse[i]);
+          }
+          break;
+        }
+        case SetU32::Hdr::Dense: {
+          for (uint32_t i = 0; i < 256; i++) {
+            if (block.dense->contains(i)) {
+              f(id | i);
+            }
+          }
+          break;
+        }
+        case SetU32::Hdr::Full: {
+          for (uint32_t i = 0; i < 256; i++) {
+            f(id | i);
+          }
+          break;
+        }
+      }
+    }
+  }
+
+  static std::set<uint32_t> to(const SetU32& set) {
+    std::set<uint32_t> out;
+    set.foreach([&](uint32_t elt) { out.insert(elt); });
+    return out;
+  }
+
+  using MutableEliasFanoList =
+      folly::compression::MutableEliasFanoCompressedList;
+  using EliasFanoList = folly::compression::EliasFanoCompressedList;
+  MutableEliasFanoList toEliasFano(uint32_t upper) const;
+  static SetU32 fromEliasFano(const EliasFanoList& list);
+
+  static void dump(SetU32&);
+
+ private:
+  static bool fitsSparse(uint8_t m, uint8_t n) {
+    return int(m) + n < 32;
+  }
+
+  void append(const_iterator start, const_iterator finish);
+  void append(uint32_t id, Bits256 w);
+
+  void appendMerge(
+      const_iterator left,
+      const_iterator left_end,
+      const_iterator right,
+      const_iterator right_end);
+  void appendMerge(Block left, Block right);
+
+  std::vector<Hdr> hdrs;
+  std::vector<Bits256> dense;
+  std::vector<uint8_t> sparse;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/slice.cpp b/glean/rts/ownership/slice.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/slice.cpp
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <boost/dynamic_bitset.hpp>
+#include <algorithm>
+
+#include "glean/rts/ownership/slice.h"
+#include "glean/rts/timer.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+using namespace folly::compression;
+
+// The ownership set contains
+//
+//    base.first()...base.end()  references to ownership sets for base DB(s)
+//    base.end()..first          units in this DB
+//    first...first+size         sets in this DB
+
+std::unique_ptr<Slice> slice(
+    Ownership& ownership,
+    const Slices& base,
+    const std::vector<UsetId>& units,
+    bool exclude) {
+  auto t = makeAutoTimer("slice");
+
+  auto iter = ownership.getSetIterator();
+  using Reader = EliasFanoReader<EliasFanoEncoder<uint32_t, uint32_t>>;
+
+  auto p = iter->sizes();
+  auto first = p.first, size = p.second;
+  VLOG(1) << folly::sformat(
+      "slice: first={}, size={}, base.first={}, base.end={}, units.size={}",
+      first,
+      size,
+      base.first(),
+      base.end(),
+      units.size());
+
+  if (size == 0) {
+    return std::make_unique<Slice>(
+        base.end(), boost::dynamic_bitset<uint64_t>());
+  }
+
+  assert(base.empty() || first >= base.end());
+
+  boost::dynamic_bitset<uint64_t> members(size, false);
+
+  // true if reader is a subset of units
+  auto isSubset = [&, first](Reader& reader) {
+    if (!reader.valid() || reader.value() >= first) {
+      return true;
+    }
+    auto it = units.begin();
+    do {
+      it = std::lower_bound(it, units.end(), reader.value());
+      if (it == units.end() || reader.value() != *it) {
+        VLOG(5) << folly::sformat("isSubset: {} not in set", reader.value());
+        // owned by a unit not in the set
+        return false;
+      }
+      VLOG(5) << folly::sformat("isSubset: {} in set", reader.value());
+      // reader.value() == *it; advance both
+      it++;
+    } while (reader.next() && reader.value() < first);
+    return true; // checked all values, so this is a subset
+  };
+
+  // true if the intersection of reader and units is empty
+  auto emptyIntersection = [&](Reader& reader) {
+    if (!reader.valid() || units.empty()) {
+      return true;
+    }
+    auto it = units.begin();
+    do {
+      auto unit = *it;
+      if (unit < reader.value()) {
+        it = std::lower_bound(it, units.end(), reader.value());
+        if (it == units.end()) {
+          return true;
+        }
+      } else {
+        if (!reader.skipTo(unit)) {
+          return true;
+        }
+      }
+      if (reader.value() == unit) {
+        VLOG(5) << folly::sformat(
+            "emptyIntersection: {} in set", reader.value());
+        return false;
+      }
+      VLOG(5) << folly::sformat(
+          "emptyIntersection: {} not in set", reader.value());
+    } while (reader.value() < first);
+    return true;
+  };
+
+  auto orVisibleBase = [&](Reader& reader) {
+    if (!reader.valid() || base.empty()) {
+      return false;
+    }
+    if (reader.value() < base.first()) {
+      if (!reader.skipTo(base.first())) {
+        return false;
+      }
+    }
+    do {
+      if (reader.value() >= base.end()) {
+        return false;
+      }
+      if (base.visible(reader.value())) {
+        VLOG(5) << folly::sformat("orVisibleBase: visible({})", reader.value());
+        return true;
+      }
+      VLOG(5) << folly::sformat("orVisibleBase: invisible({})", reader.value());
+    } while (reader.next());
+    return false;
+  };
+
+  auto orVisible = [&, first](Reader& reader) {
+    if (!reader.valid()) {
+      return false;
+    }
+    if (reader.value() < first) {
+      if (!reader.skipTo(first)) {
+        return false;
+      }
+    }
+    do {
+      if (members[reader.value() - first]) {
+        VLOG(5) << folly::sformat("orVisible: visible({})", reader.value());
+        return true;
+      }
+      VLOG(5) << folly::sformat("orVisible: invisible({})", reader.value());
+    } while (reader.next());
+    return false;
+  };
+
+  auto andVisibleBase = [&](Reader& reader) {
+    if (!reader.valid() || base.empty()) {
+      return true;
+    }
+    if (reader.value() < base.first()) {
+      if (!reader.skipTo(base.first())) {
+        return true;
+      }
+    }
+    do {
+      if (reader.value() >= base.end()) {
+        return true;
+      }
+      if (!base.visible(reader.value())) {
+        VLOG(5) << folly::sformat(
+            "andVisibleBase: invisible({})", reader.value());
+        return false;
+      }
+      VLOG(5) << folly::sformat("andVisibleBase: visible({})", reader.value());
+    } while (reader.next());
+    return true;
+  };
+
+  auto andVisible = [&](Reader& reader) {
+    if (!reader.valid()) {
+      return true;
+    }
+    if (reader.value() < first) {
+      if (!reader.skipTo(first)) {
+        return true;
+      }
+    }
+    do {
+      if (!members[reader.value() - first]) {
+        VLOG(5) << folly::sformat("andVisible: invisible({})", reader.value());
+        return false;
+      }
+      VLOG(5) << folly::sformat("andVisible: visible({})", reader.value());
+    } while (reader.next());
+    return true;
+  };
+
+  while (auto pair = iter->get()) {
+    auto i = pair->first;
+
+    auto reader = Reader(*pair->second.set);
+    reader.next();
+    bool visible;
+    switch (pair->second.op) {
+      case Or:
+        if (exclude) {
+          // invisible if all entries are excluded
+          visible =
+              orVisibleBase(reader) || !isSubset(reader) || orVisible(reader);
+        } else {
+          // visible if any entry is included
+          visible = orVisibleBase(reader) || !emptyIntersection(reader) ||
+              orVisible(reader);
+        }
+        break;
+
+      case And:
+        if (exclude) {
+          // visible if none of the entries are excluded
+          visible = andVisibleBase(reader) && emptyIntersection(reader) &&
+              andVisible(reader);
+        } else {
+          // visible if all entries are included
+          visible =
+              andVisibleBase(reader) && isSubset(reader) && andVisible(reader);
+        }
+        break;
+    }
+    members[i - first] = visible;
+    VLOG(5) << "slice set: " << i << " " << (visible ? "visible" : "invisible");
+  }
+
+  return std::make_unique<Slice>(first, std::move(members));
+}
+
+void Slice::serialize(binary::Output& o) const {
+  serialize::put(o, first_);
+  std::vector<uint64_t> words(set_.num_blocks());
+  to_block_range(set_, words.begin());
+  serialize::put(o, words, serialize::AsBytes());
+}
+
+std::unique_ptr<Slice> Slice::deserialize(binary::Input& i) {
+  UsetId first;
+  serialize::get(i, first);
+  std::vector<uint64_t> words;
+  serialize::get(i, words, serialize::AsBytes());
+  boost::dynamic_bitset<uint64_t> set(words.size() * 64);
+  from_block_range(words.begin(), words.end(), set);
+  return std::make_unique<Slice>(first, std::move(set));
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/slice.h b/glean/rts/ownership/slice.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/slice.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <boost/dynamic_bitset.hpp>
+
+#include "glean/rts/fact.h"
+#include "glean/rts/lookup.h"
+#include "glean/rts/ownership.h"
+#include "glean/rts/serialize.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+///
+// A Slice is a bitmap, with one bit for each Uset, to indicate
+// whether facts with that Uset should be visible or not.
+//
+// A Slice only makes sense in the context of a particular DB.
+//
+struct Slice {
+  explicit Slice(UsetId first, boost::dynamic_bitset<uint64_t> set)
+      : first_(first), set_(std::move(set)) {}
+
+  bool visible(UsetId uset) const {
+    assert(
+        uset != INVALID_USET && uset >= first_ && uset - first_ < set_.size());
+    return set_[uset - first_];
+  }
+
+  bool inRange(UsetId usetid) const {
+    return usetid >= first() && usetid < end();
+  }
+
+  UsetId first() const {
+    return first_;
+  }
+  UsetId end() const {
+    return first_ + set_.size();
+  }
+  bool empty() const {
+    return set_.empty();
+  }
+
+  void serialize(binary::Output& o) const;
+  static std::unique_ptr<Slice> deserialize(binary::Input& i);
+
+ private:
+  const UsetId first_;
+  const boost::dynamic_bitset<uint64_t> set_;
+};
+
+///
+// A set of slices that can be treated as a single Slice
+//
+struct Slices {
+  explicit Slices(std::vector<const Slice*> slices)
+      : slices_(std::move(slices)) {
+    UsetId first = 0, end = 0;
+    for (auto slice : slices_) {
+      if (first == 0 || slice->first() < first) {
+        first = slice->first();
+        end = std::max(end, slice->end());
+      }
+    }
+    first_ = first;
+    end_ = end;
+  }
+
+  bool visible(UsetId usetid) const {
+    if (usetid == INVALID_USET) {
+      return false;
+    }
+    for (auto slice : slices_) {
+      if (slice->inRange(usetid)) {
+        auto visible = slice->visible(usetid);
+        return visible;
+      }
+    }
+    return false;
+  }
+
+  UsetId first() const {
+    return first_;
+  }
+  UsetId end() const {
+    return end_;
+  }
+  bool empty() const {
+    return first_ == end_;
+  }
+
+  bool inRange(UsetId usetid) const {
+    return usetid >= first_ && usetid < end_;
+  }
+
+ private:
+  UsetId first_;
+  UsetId end_;
+  const std::vector<const Slice*> slices_;
+};
+
+///
+// construct a Slice for the given Ownership, given a set of Units
+// that should be included/excluded.
+//
+std::unique_ptr<Slice> slice(
+    Ownership& ownership,
+    const Slices& base,
+    const std::vector<UnitId>& units, // must be sorted
+    bool exclude);
+
+///
+// A "slice" of a Lookup, restricted to returning only those facts
+// visible in the given Slice. When the Lookup is a stack, the
+// Slice should cover all the UsetIds used in the stack, which
+// means it will probably be a Slices containing a Slice for
+// each Lookup in the stack.
+//
+template <typename Slice>
+struct Sliced : Lookup {
+  ~Sliced() override {}
+
+  Sliced(Lookup* base, Slice slice) : base_(base), slice_(std::move(slice)) {}
+
+  Id idByKey(Pid type, folly::ByteRange key) override {
+    auto id = base_->idByKey(type, key);
+    if (id && slice_.visible(base_->getOwner(id))) {
+      return id;
+    } else {
+      return Id::invalid();
+    }
+  }
+
+  Pid typeById(Id id) override {
+    return base_->typeById(id);
+  }
+
+  bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) override {
+    return base_->factById(id, std::move(f));
+  }
+
+  Id startingId() const override {
+    return base_->startingId();
+  }
+
+  Id firstFreeId() const override {
+    return base_->firstFreeId();
+  }
+
+  Interval count(Pid pid) const override {
+    // TODO: this is wrong
+    return base_->count(pid);
+  }
+
+  std::unique_ptr<FactIterator> enumerate(Id from, Id upto) override {
+    return FactIterator::filter(base_->enumerate(from, upto), [&](Id id) {
+      return slice_.visible(base_->getOwner(id));
+    });
+  }
+
+  std::unique_ptr<FactIterator> enumerateBack(Id from, Id downto) override {
+    return FactIterator::filter(base_->enumerate(from, downto), [&](Id id) {
+      return slice_.visible(base_->getOwner(id));
+    });
+  }
+
+  std::unique_ptr<FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) override {
+    return FactIterator::filter(
+        base_->seek(type, start, prefix_size),
+        [&](Id id) { return slice_.visible(base_->getOwner(id)); });
+  }
+
+  std::unique_ptr<FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id to) override {
+    return FactIterator::filter(
+        base_->seekWithinSection(type, start, prefix_size, from, to),
+        [&](Id id) { return slice_.visible(base_->getOwner(id)); });
+  }
+
+  UsetId getOwner(Id id) override {
+    // Like factById(), we can assume that if the caller has an Id then the Id
+    // is visible, so we don't have to check
+    return base_->getOwner(id);
+  }
+
+ private:
+  Lookup* base_;
+  Slice slice_;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/triearray.h b/glean/rts/ownership/triearray.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/triearray.h
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/container/F14Map.h>
+#include <glog/logging.h>
+#include "glean/rts/error.h"
+#include "glean/rts/ownership.h"
+#include "glean/rts/ownership/pool.h"
+
+#include <cstdint>
+#include <queue>
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/**
+ * A datastructure which maps ranges of Ids to values. The current
+ * implementation is a hack which only supports Ids which fit in 32 bits.
+ *
+ * The implementation is a bit trie with a large initial fanout (64k) and then a
+ * smaller inner fanout (16), giving a maximum depth of 4 (for 32-bit values).
+ *
+ * This should most likely be switched to some form of Patricia tree.
+ */
+template <typename T>
+class TrieArray {
+ public:
+  TrieArray() : trees_(new ForestN<FANOUT_TOP>(Tree::null())) {}
+
+  /**
+   * Insert a sorted sequence of non-overlapping Id ranges by combining the
+   * previously stored values via `get`.
+   *
+   * This tries to split the tree as little as possible. We also guarantee to
+   * call `get` exactly once for each previous value (including `nullptr` for
+   * "no previous value").
+   *
+   * The trie maintains reference counts for each value, by calling
+   *    value->use(uint_t)
+   *
+   * get(T* old_value, uint_t ref) -> T*
+   *   `ref` references to `old_value` are being updated.
+   *   get() is responsible for updating the refcount of the old value,
+   *   and for releasing (or reusing) it to avoid leaking memory if
+   *   its refcount would fall to zero.
+   */
+  template <typename Get>
+  void insert(
+      const OwnershipUnit::Ids* start,
+      const OwnershipUnit::Ids* finish,
+      Get&& get) {
+    if (start == finish) {
+      return;
+    }
+
+    minkey_ = std::min(minkey_, start->start.toWord());
+    maxkey_ = std::max(maxkey_, finish[-1].finish.toWord());
+
+    // only 32-bit keys are supported; this property is assumed later
+    CHECK(maxkey_ <= std::numeric_limits<uint32_t>::max());
+
+    // During insertion if we are replacing all references of an existing value,
+    // we want to do that in a single operation so that get() can reuse
+    // the memory for the old value.
+    //
+    // Algorithm:
+    //
+    // - Collect previously existing values in `values`.
+    // - When we see a value for the first time, set its `link` field to point
+    //   to the first `Tree` that contains it and add it to `values`.
+    // - When we see a value again, temporarily make the current `Tree` point
+    //   to the previous tree that contained the value (from the value's `link`)
+    //   and update the value's `link` to point to the current tree. This
+    //   effectively maintains a linked list of trees which contain a value,
+    //   with the value's `link` being the root.
+    // - Do the same for newly inserted trees which don't have a previous value
+    //   via `null_link`.
+    // - Once we've collected everything, for each value in `values` compute the
+    //   new value via `get` and then traverse the linked list of trees, storing
+    //   a pointer to the new value in each one.
+    // - Do the same for `null_link`.
+    std::vector<T*> values;
+    Tree* null_link = nullptr;
+
+    while (start != finish) {
+      const auto [first_id, last_id] = *start++;
+      if (first_id <= last_id) {
+        traverse(
+            first_id.toWord(),
+            last_id.toWord() - first_id.toWord() + 1,
+            [&](Tree& tree, uint64_t key, uint64_t size, size_t block) {
+              if (size == block) {
+                if (const auto value = tree.value()) {
+                  const auto prev = static_cast<Tree*>(value->link());
+                  value->link(&tree);
+                  tree = Tree::link(prev);
+                  if (prev == nullptr) {
+                    values.push_back(value);
+                  } else {
+                    value->use(-1); // we dropped the ref from the trie
+                  }
+                } else {
+                  tree = Tree::link(null_link);
+                  null_link = &tree;
+                }
+              } else {
+                if (auto value = tree.value()) {
+                  value->use(FANOUT - 1);
+                }
+                tree = Tree::forest(pool_.alloc(tree));
+              }
+            });
+      }
+    }
+
+    const auto unlink = [&](Tree* tree, T* FOLLY_NULLABLE value) {
+      // If we are updating *all* references to this value, then the
+      // refcount for the old value will be 1 here, and get() can do
+      // an in-place update.
+      auto upd = get(value, 1);
+      uint32_t refs = 0;
+      while (tree != nullptr) {
+        auto next = tree->link();
+        *tree = Tree::value(upd);
+        tree = next;
+        ++refs;
+      }
+      upd->use(refs - 1);
+    };
+
+    if (null_link) {
+      unlink(null_link, nullptr);
+    }
+
+    for (auto value : values) {
+      Tree* tree = static_cast<Tree*>(value->link());
+      value->link(nullptr);
+      unlink(tree, value);
+    }
+  }
+
+  template <typename F>
+  void foreach(F&& f) {
+    traverse(
+        [&](Tree& tree, uint64_t key, uint64_t size, uint64_t /* block */) {
+          if (auto* value = tree.value()) {
+            if (auto new_value = f(value)) {
+              tree = Tree::value(new_value);
+            }
+          }
+        });
+  }
+
+  struct Flattened {
+    folly::F14FastMap<uint64_t, T*> sparse;
+    std::vector<T*> dense;
+  };
+
+  /// Flatten the trie into:
+  ///    - a dense array between start-end (end > maxkey_)
+  ///    - a sparse mapping for elements less than start
+  Flattened flatten(uint64_t start, uint64_t end) {
+    if (end <= maxkey_) {
+      error(
+          "flatten: invalid bounds ({},{}) ({},{})",
+          start,
+          end,
+          minkey_,
+          maxkey_);
+    }
+    VLOG(1) << folly::sformat(
+        "flatten: ({},{}) ({},{})", start, end, minkey_, maxkey_);
+
+    // If there's no data in the tree, just return an empty result instead of
+    // allocating an array of nullptr.
+    if (maxkey_ <= minkey_) {
+      return {};
+    }
+
+    folly::F14FastMap<uint64_t, T*> sparse;
+    std::vector<T*> vec(end - start, nullptr);
+
+    traverse(
+        [&, start](
+            const Tree& tree, uint64_t key, uint64_t size, uint64_t block) {
+          auto* value = tree.value();
+          if (value) {
+            for (uint64_t i = key; i < std::min(key + size, start); i++) {
+              sparse.insert({i, value});
+            }
+          }
+          if (key + size > start) {
+            const uint64_t left = key >= start ? key - start : 0;
+            const uint64_t right = (key + size) - start;
+            std::fill(vec.begin() + left, vec.begin() + right, value);
+          }
+          if (value) {
+            value->use(size - 1);
+          }
+        });
+
+    return {std::move(sparse), std::move(vec)};
+  }
+
+ private:
+  static constexpr size_t FANOUT_TOP = 65536;
+  static constexpr size_t FANOUT = 16;
+  static constexpr size_t BLOCK =
+      (size_t(std::numeric_limits<uint32_t>::max()) + 1) / FANOUT_TOP;
+
+  static constexpr size_t blockSize(uint8_t level) {
+    auto size = BLOCK;
+    while (level != 0) {
+      size /= FANOUT;
+      --level;
+    }
+    return size;
+  }
+
+  template <uint32_t N>
+  struct ForestN;
+  using Forest = ForestN<FANOUT>;
+
+  // A tagged pointer based sum of nothing (`nullptr`), a non-null pointer to a
+  // value and a pointer to a forest.
+  struct Tree {
+    uintptr_t ptr;
+
+    static Tree null() {
+      Tree t;
+      t.ptr = 0;
+      return t;
+    }
+
+    static Tree value(T* x) {
+      Tree t;
+      t.ptr = reinterpret_cast<uintptr_t>(x);
+      assert((t.ptr & 1) == 0);
+      assert(t.ptr != 0);
+      return t;
+    }
+
+    static Tree forest(Forest* forest) {
+      Tree t;
+      t.ptr = reinterpret_cast<uintptr_t>(forest);
+      assert((t.ptr & 1) == 0);
+      t.ptr |= 1;
+      return t;
+    }
+
+    static Tree link(Tree* x) {
+      Tree t;
+      t.ptr = reinterpret_cast<uintptr_t>(x);
+      return t;
+    }
+
+    bool empty() const {
+      return ptr == 0;
+    }
+
+    T* FOLLY_NULLABLE value() const {
+      return (ptr & 1) == 0 ? reinterpret_cast<T*>(ptr) : nullptr;
+    }
+
+    Forest* FOLLY_NULLABLE forest() {
+      return (ptr & 1) == 1 ? reinterpret_cast<Forest*>(ptr - 1) : nullptr;
+    }
+
+    Tree* link() const {
+      return reinterpret_cast<Tree*>(ptr);
+    }
+
+    bool isForest() const {
+      return (ptr & 1) == 1;
+    }
+  };
+
+  template <uint32_t N>
+  struct ForestN {
+    Tree trees_[N];
+
+    explicit ForestN(Tree tree) {
+      std::fill(trees_, trees_ + N, tree);
+    }
+
+    Tree& at(uint32_t i) {
+      return trees_[i];
+    }
+
+    Tree at(uint32_t i) const {
+      return trees_[i];
+    }
+  };
+
+  static std::pair<uint64_t, uint64_t> location(uint64_t key) {
+    assert(key <= std::numeric_limits<uint32_t>::max());
+    return {key / BLOCK, key % BLOCK};
+  }
+
+  template <typename F>
+  void traverse(F&& f) {
+    if (minkey_ <= maxkey_) {
+      traverse(minkey_, maxkey_ - minkey_ + 1, f);
+    }
+  }
+
+  // NOTE: We traverse the tree via type-level recursion rather than a runtime
+  // loop since there is a very small, statically knows bound on its depth.
+  //
+  // `F` gets called for each leaf tree (with or without a value). It can modify
+  // the tree to become a forest in which case `traverse` will descend into it.
+  template <typename F>
+  void traverse(uint64_t start, uint64_t size, F&& f) {
+    auto [first_block, first_index] = location(start);
+    auto [last_block, last_index] = location(start + (size - 1));
+
+    uint64_t key = start;
+    while (first_block < last_block) {
+      const auto n = BLOCK - first_index;
+      traverse<0>(trees_->at(first_block), key, first_index, n, f);
+      key += n;
+      ++first_block;
+      first_index = 0;
+    }
+    traverse<0>(
+        trees_->at(first_block),
+        key,
+        first_index,
+        last_index - first_index + 1,
+        f);
+  }
+
+  template <size_t level, typename F>
+  static void
+  traverse(Tree& tree, uint64_t key, uint64_t start, uint64_t size, F& f) {
+    if (!tree.isForest()) {
+      f(tree, key, size, blockSize(level));
+    }
+    if (auto forest = tree.forest()) {
+      constexpr auto block = blockSize(level + 1);
+      if constexpr (block != 0) {
+        auto t = start / block;
+        auto i = start % block;
+        while (size != 0) {
+          const auto n = std::min(size, block - i);
+          traverse<level + 1>(forest->at(t), key, i, n, f);
+          i = 0;
+          key += n;
+          size -= n;
+          ++t;
+        }
+      }
+    }
+  }
+
+  std::unique_ptr<ForestN<FANOUT_TOP>> trees_;
+  Pool<Forest> pool_;
+  uint64_t minkey_ = std::numeric_limits<uint64_t>::max();
+  uint64_t maxkey_ = 0;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/uset.cpp b/glean/rts/ownership/uset.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/uset.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/ownership/uset.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+SetExpr<Usets::MutableEliasFanoList> Uset::toEliasFano(UsetId max) const {
+  return {exp.op, exp.set.toEliasFano(max)};
+}
+
+std::vector<SetExpr<Usets::MutableEliasFanoList>> Usets::toEliasFano(
+    UsetId max) {
+  std::vector<SetExpr<Usets::MutableEliasFanoList>> sets(stats.promoted);
+  for (auto uset : usets) {
+    if (uset->promoted()) {
+      VLOG(5) << "exporting: " << uset->id;
+      sets[uset->id - firstId] = uset->toEliasFano(max);
+    }
+  }
+  return sets;
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/ownership/uset.h b/glean/rts/ownership/uset.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/ownership/uset.h
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/ownership/setu32.h"
+
+#include <folly/Hash.h>
+#include <folly/container/F14Set.h>
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+using UsetId = uint32_t;
+constexpr UsetId INVALID_USET = 0xffffffff;
+constexpr UsetId SPECIAL_USET = 0xfffffffe; // special value as a sentinel
+
+enum SetOp { Or, And };
+
+/**
+ * A set expression
+ *
+ * Elements of the set are
+ *    0 ... MAX_UNIT_ID   : units
+ *    MAX_UNIT_ID+1 ...   : sets
+ *
+ * facts with this owner set are visible if and only if:
+ *     Or => any of the members of the set are visible
+ *     And => all the members of the set are visible
+ */
+template <typename Set>
+struct SetExpr {
+  SetOp op;
+  Set set;
+
+  bool operator==(const SetExpr<Set>& other) const& {
+    return op == other.op && set == other.set;
+  }
+};
+
+/**
+ * A "unique" set stored by `Usets` below. This is a `SetU32` with a memoized
+ * hash, a ref count and some administrative data used by the ownership
+ * algorithms. It should probably be given a more sane interface.
+ */
+struct Uset {
+  explicit Uset(SetU32 s, uint32_t r = 0) : exp({Or, std::move(s)}), refs(r) {}
+  explicit Uset(SetU32 s, SetOp op = Or, uint32_t r = 0)
+      : exp({op, std::move(s)}), refs(r) {}
+
+  void rehash() {
+    hash = exp.set.hash(exp.op); // don't forget to include op in the hash
+  }
+
+  void use(int32_t n) {
+    refs += n;
+  }
+
+  void drop() {
+    if (--refs == 0) {
+      delete this;
+    }
+  }
+
+  void* link() const {
+    return ptr;
+  }
+
+  void link(void* p) {
+    ptr = p;
+  }
+
+  /** The set */
+  SetExpr<SetU32> exp;
+
+  /** The set's hash which must be memoized explicitly via `rehash`. */
+  size_t hash;
+
+  /** Reference count */
+  uint32_t refs;
+
+  /**
+   * Once a set is promoted to the DB (i.e. it is the ownership set of
+   * at least one fact), we assign it a 32-bit ID. Before it is promoted,
+   * id is INVALID_USET.
+   */
+  UsetId id = INVALID_USET;
+
+  bool promoted() const {
+    return id != INVALID_USET;
+  }
+
+  /**
+   * Generic pointer used temporarily for a variety of things - it is much
+   * faster than a F14FastMap<Uset *, T>.
+   */
+  void* ptr = nullptr;
+
+  struct Eq {
+    bool operator()(const Uset* x, const Uset* y) const {
+      return x == y || x->exp == y->exp;
+    }
+  };
+
+  struct Hash {
+    using folly_is_avalanching = std::true_type;
+    size_t operator()(const Uset* x) const {
+      return x->hash;
+    }
+  };
+
+  using MutableEliasFanoList = SetU32::MutableEliasFanoList;
+  SetExpr<MutableEliasFanoList> toEliasFano(UsetId max) const;
+};
+
+/**
+ * Container for `Usets` which guarantees to store each set exactly once.
+ */
+struct Usets {
+  explicit Usets(uint32_t firstId) : firstId(firstId), nextId(firstId) {}
+
+  Usets(Usets&& other) noexcept : firstId(other.firstId), nextId(other.nextId) {
+    std::swap(usets, other.usets);
+    stats = other.stats;
+  }
+
+  ~Usets() {
+    // We can't delete the Usets before destroying the `usets` map because
+    // the latter might access hashes in its destructor.
+    std::vector<Uset*> refs;
+    refs.reserve(usets.size());
+    refs.insert(refs.end(), usets.begin(), usets.end());
+    usets.clear();
+    for (auto ref : refs) {
+      delete ref;
+    }
+  }
+
+  template <typename F>
+  void foreach(F&& f) {
+    for (auto entry : usets) {
+      f(entry);
+    }
+  }
+
+  Uset* add(Uset* entry) {
+    entry->rehash();
+    const auto [p, added] = usets.insert(entry);
+    if (added) {
+      entry->exp.set.shrink_to_fit();
+      ++stats.adds;
+      stats.bytes += entry->exp.set.bytes();
+      return entry;
+    } else {
+      ++stats.dups;
+      use(*p, entry->refs);
+      return *p;
+    }
+  }
+
+  Uset* add(std::unique_ptr<Uset> entry) {
+    auto p = add(entry.get());
+    if (p == entry.get()) {
+      entry.release();
+    }
+    return p;
+  }
+
+  Uset* add(SetU32 set, uint32_t refs = 0) {
+    return add(std::unique_ptr<Uset>(new Uset(std::move(set), refs)));
+  }
+
+  Uset* lookup(Uset* entry) const {
+    entry->rehash();
+    auto it = usets.find(entry);
+    if (it != usets.end()) {
+      return *it;
+    } else {
+      return nullptr;
+    }
+  }
+
+  // only when both sets have the same op
+  Uset* merge(Uset* left, Uset* right) {
+    SetU32 set;
+    assert(left->exp.op == right->exp.op);
+    auto res = SetU32::merge(set, left->exp.set, right->exp.set);
+    if (res == &set) {
+      return add(std::move(set), 1);
+    } else {
+      auto& r = res == &left->exp.set ? left : right;
+      use(r, 1);
+      return r;
+    }
+  }
+
+  // merge a SetU32 directly. Op is assumed to be Or.
+  Uset* merge(SetU32 left, Uset* right) {
+    SetU32 set;
+    assert(right->exp.op == Or);
+    auto res = SetU32::merge(set, left, right->exp.set);
+    if (res == &set) {
+      return add(std::move(set), 1);
+    } else {
+      if (res == &right->exp.set) {
+        use(right, 1);
+        return right;
+      } else {
+        return add(std::move(left), 1);
+      }
+    }
+  }
+
+  void use(Uset* set, uint32_t refs = 1) {
+    set->refs += refs;
+  }
+
+  void drop(Uset* uset) {
+    assert(uset->refs != 0);
+    --uset->refs;
+    if (uset->refs == 0) {
+      assert(!uset->promoted());
+      usets.erase(uset);
+      stats.bytes -= uset->exp.set.bytes();
+      delete uset;
+    }
+  }
+
+  void promote(Uset* uset) {
+    if (!uset->promoted()) {
+      uset->id = nextId++;
+      ++uset->refs;
+      ++stats.promoted;
+    }
+  }
+
+  size_t size() const {
+    return usets.size();
+  }
+
+  struct Stats {
+    size_t bytes = 0;
+    size_t promoted = 0;
+
+    size_t adds = 0;
+    size_t dups = 0;
+  };
+
+  const Stats& statistics() const {
+    return stats;
+  }
+
+  UsetId getFirstId() const {
+    return firstId;
+  }
+
+  UsetId getNextId() const {
+    return nextId;
+  }
+
+  // Merge another Usets into this one. The other Usets must be
+  // disjoint and using sets numbered from nextId onwards.
+  void append(Usets&& other) {
+    CHECK_EQ(other.firstId, nextId);
+    CHECK_EQ(other.nextId, nextId + other.usets.size());
+    other.foreach([&](Uset* uset) {
+      auto p = add(uset);
+      CHECK(p == uset); // we should have added it
+    });
+    other.usets
+        .clear(); // ownership of the underlying sets has been transferred
+    nextId = other.nextId;
+  }
+
+  using MutableEliasFanoList = SetU32::MutableEliasFanoList;
+  std::vector<SetExpr<MutableEliasFanoList>> toEliasFano(UsetId max);
+
+ private:
+  folly::F14FastSet<Uset*, Uset::Hash, Uset::Eq> usets;
+  Stats stats;
+  const UsetId firstId;
+  UsetId nextId;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/prim.cpp b/glean/rts/prim.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/prim.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <utility>
+#include <vector>
+
+#include "glean/rts/binary.h"
+#include "glean/rts/prim.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+void relToAbsByteSpans(folly::ByteRange range, binary::Output& output) {
+  auto input = binary::Input(range);
+
+  // Read the length of the given array of relative byte spans and write it to
+  // the output
+  const uint64_t length = input.packed<uint64_t>();
+  output.packed(length);
+
+  // Read the packed relative byte spans and write the absolute spans
+  // The first relative byte span contains the start position
+  uint64_t start = 0;
+  for (auto i = 0; i < length; i++) {
+    auto offset = input.packed<uint64_t>();
+    start += offset;
+    output.packed(start);
+    output.packed(input.packed<uint64_t>());
+  }
+}
+
+void unpackByteSpans(folly::ByteRange range, binary::Output& output) {
+  std::vector<std::pair<uint64_t, uint64_t>> result;
+  {
+    auto input = binary::Input(range);
+    // Read the packed relative byte spans and write the absolute spans
+    // The first relative byte span contains the start position
+    uint64_t start = 0;
+    const uint64_t size = input.packed<uint64_t>();
+    for (auto i = 0; i < size; ++i) {
+      const uint64_t length = input.packed<uint64_t>();
+      const uint64_t group_size = input.packed<uint64_t>();
+      for (auto j = 0; j < group_size; ++j) {
+        start += input.packed<uint64_t>();
+        result.emplace_back(start, length);
+      }
+    }
+  }
+  output.packed<uint64_t>(result.size());
+  for (const auto& [start, length] : result) {
+    output.packed<uint64_t>(start);
+    output.packed<uint64_t>(length);
+  }
+}
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/prim.h b/glean/rts/prim.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/prim.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+
+#include <folly/Range.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/// Converting relative byte spans to absolute bytespans
+void relToAbsByteSpans(folly::ByteRange, binary::Output&);
+
+/// Converting packed byte spans to absolute bytespans
+void unpackByteSpans(folly::ByteRange range, binary::Output& output);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/query.cpp b/glean/rts/query.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/query.cpp
@@ -0,0 +1,784 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <atomic>
+#include <chrono>
+
+#include <folly/Chrono.h>
+#include <folly/stop_watch.h>
+
+#include "glean/rts/bytecode/syscall.h"
+#include "glean/rts/query.h"
+#include "glean/rts/serialize.h"
+#include "glean/rts/set.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+// check for timeout in 1% of all next() calls, because Clock::now()
+// is not cheap.
+static constexpr uint32_t CHECK_TIMEOUT_INTERVAL = 100;
+
+using Clock = folly::chrono::coarse_steady_clock;
+
+// all queries started before the last interrupt will be aborted.
+std::atomic<std::chrono::time_point<Clock>> last_interrupt =
+    folly::chrono::coarse_steady_clock::time_point::min();
+
+struct QueryExecutor : SetOps {
+  // The following methods are all invoked from the compiled query
+  // subroutine to access the DB and record results.
+
+  // A live fact iterator
+  using IterToken = uint64_t;
+
+  // iterators
+  struct Iter {
+    std::unique_ptr<rts::FactIterator> iter;
+    // remember the type and current key so that we can capture the
+    // state of this iterator for a continuation.
+    Pid type;
+    Id id;
+    size_t prefix_size;
+    bool first;
+  };
+
+  QueryExecutor(
+      Inventory& inventory,
+      Define& facts,
+      DefineOwnership* ownership,
+      Subroutine& sub,
+      Pid pid,
+      std::shared_ptr<Subroutine> traverse,
+      Depth depth,
+      std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+      bool wantStats,
+      std::vector<Iter> iters,
+      uint64_t max_set_size)
+      : SetOps(max_set_size),
+        inventory(inventory),
+        facts(facts),
+        ownership(ownership),
+        sub(sub),
+        pid(pid),
+        traverse(traverse),
+        depth(depth),
+        expandPids(expandPids),
+        wantStats(wantStats),
+        iters(std::move(iters)) {}
+
+  //
+  // Initiate a traversal of facts for a particular predicate and
+  // key prefix. Returns a token that can be passed to next() to
+  // fetch the next fact.
+  //
+  IterToken
+  seek(Pid type, const unsigned char* key_begin, const unsigned char* key_end);
+
+  IterToken seekWithinSection(
+      Pid type,
+      const unsigned char* key_begin,
+      const unsigned char* key_end,
+      Id from,
+      Id upto);
+
+  //
+  // Returns the current seek token, so that the state can be reset in
+  // the future using endSeek(). This is used for implementing
+  // non-local jumps in the generated code.
+  //
+  IterToken currentSeek();
+
+  //
+  // Release the state associated with a previous seek() call.
+  //
+  void endSeek(IterToken token);
+
+  //
+  // Get the next fact in a traversal initiated by seek().  Returns 0
+  // if there are no more facts.
+  //
+  // Fact::Ref next(IterToken token, FactIterator::Demand demand);
+
+  void next(
+      uint64_t token,
+      uint64_t demand,
+      Reg<uint64_t> ok,
+      Reg<const unsigned char*> clause_begin,
+      Reg<const unsigned char*> key_end,
+      Reg<const unsigned char*> clause_end,
+      Reg<Id> id);
+
+  //
+  // Look up a fact with id fid, and copy its key into kout and value
+  // into vout.
+  //
+  // If kout is null, then don't copy the key (respectively vout/value).
+  //
+  // If kout is non-null, then it is reset to empty before copying the
+  // key. This is to avoid the caller needing to remember to
+  // ResetOutput() every time.
+  //
+  Pid lookupKeyValue(Id fid, binary::Output* kout, binary::Output* vout);
+
+  //
+  // Define a new derived fact, and return its fact ID.
+  //
+  Id newDerivedFact(Pid type, binary::Output* clause, size_t keySize);
+
+  //
+  // Record a nested fact that we visited during traversal, see
+  // resultWithPid()
+  //
+  void nestedFact(Id id, Pid pid);
+
+  //
+  // Record a query result and return the total number of bytes produced.
+  //
+  size_t recordResult(
+      Id id,
+      binary::Output* key,
+      binary::Output* val,
+      Pid pid,
+      bool rec);
+
+  //
+  // Wrapper around recordResult() which ignores the return value.
+  //
+  void resultWithPid(
+      Id id,
+      binary::Output* key,
+      binary::Output* val,
+      Pid pid,
+      bool rec) {
+    recordResult(id, key, val, pid, rec);
+  }
+
+  //
+  // First free id of the underlying Define.
+  //
+  Id firstFreeId() {
+    return facts.firstFreeId();
+  }
+
+  //
+  // wrapper around resultWithPid() used by ordinary queries where we
+  // want the prevailing pid and recursive values.
+  //
+  // Result is:
+  //   0   if this fact ID was already in the result set
+  //   >0  if this fact ID is new (result is the size in bytes of the
+  //       fact and all its recursively nested facts that were expanded)
+  //
+  size_t result(Id id, binary::Output* key, binary::Output* val) {
+    auto added = results_added.insert(id.toWord());
+    if (added.second) {
+      return recordResult(id, key, val, pid, 0);
+    } else {
+      DVLOG(5) << "result skipped dup (" << id.toWord() << ")";
+      return 0;
+    }
+  }
+
+  using SerializedCont = binary::Output;
+
+  //
+  // Produce a query continuation
+  //
+  SerializedCont queryCont(Subroutine::Activation& act) const;
+
+  //
+  // Done; collect and return the final results
+  //
+  std::unique_ptr<QueryResults> finish(folly::Optional<SerializedCont> cont);
+
+  // ------------------------------------------------------------
+  // Below here: query state
+
+  // Timeouts
+  folly::stop_watch<std::chrono::nanoseconds> watch;
+  std::chrono::time_point<Clock> timeout;
+  uint64_t check_timeout;
+
+  bool timeExpired() {
+    if (--check_timeout == 0) {
+      if (Clock::now() > timeout) {
+        return true;
+      } else {
+        check_timeout = CHECK_TIMEOUT_INTERVAL;
+      }
+    }
+    return false;
+  }
+
+  std::chrono::time_point<Clock> start_time;
+  inline bool interrupted() {
+    auto last = last_interrupt.load(std::memory_order_relaxed);
+    return last > start_time;
+  }
+
+  Inventory& inventory;
+  Define& facts;
+  DefineOwnership* ownership;
+  // if null, don't compute ownership of derived facts
+  Subroutine& sub;
+  Pid pid;
+  // expanding nested facts
+  std::shared_ptr<Subroutine> traverse;
+  Depth depth;
+  std::unordered_set<Pid, folly::hasher<Pid>>& expandPids;
+
+  // results so far
+  folly::F14FastSet<uint64_t, folly::Hash> results_added;
+  std::vector<uint64_t> result_ids;
+  std::vector<uint64_t> result_pids;
+  std::vector<HsString> result_keys;
+  std::vector<HsString> result_values;
+
+  // nested result facts
+  folly::F14FastSet<uint64_t, folly::Hash> nested_results_added;
+  std::vector<uint64_t> nested_result_ids;
+  std::vector<uint64_t> nested_result_pids;
+  std::vector<HsString> nested_result_keys;
+  std::vector<HsString> nested_result_values;
+  std::vector<Id> nested_result_pending;
+
+  // query stats
+  folly::F14FastMap<uint64_t, uint64_t> stats;
+  bool wantStats;
+  uint64_t result_bytes;
+
+  std::vector<Iter> iters;
+};
+
+uint64_t QueryExecutor::seek(
+    Pid type,
+    const unsigned char* key_begin,
+    const unsigned char* key_end) {
+  const folly::ByteRange key(key_begin, key_end);
+  auto token = iters.size();
+  DVLOG(5) << "seek(" << type.toWord() << ") = " << token;
+  iters.emplace_back(Iter{
+      facts.seek(type, key, key.size()),
+      type,
+      Id::invalid(),
+      key.size(),
+      true});
+  return static_cast<uint64_t>(token);
+};
+
+uint64_t QueryExecutor::seekWithinSection(
+    Pid type,
+    const unsigned char* key_begin,
+    const unsigned char* key_end,
+    Id from,
+    Id upto) {
+  const folly::ByteRange key(key_begin, key_end);
+  auto token = iters.size();
+  DVLOG(5) << "seekWithinSection(" << type.toWord() << ") = " << token;
+  iters.emplace_back(Iter{
+      facts.seekWithinSection(type, key, key.size(), from, upto),
+      type,
+      Id::invalid(),
+      key.size(),
+      true});
+  return static_cast<uint64_t>(token);
+};
+
+uint64_t QueryExecutor::currentSeek() {
+  return iters.size();
+}
+
+void QueryExecutor::endSeek(uint64_t token) {
+  DVLOG(5) << "endSeek(" << token << ")";
+  while (iters.size() > token) {
+    iters.pop_back();
+  }
+};
+
+void QueryExecutor::next(
+    uint64_t token,
+    uint64_t demand,
+    Reg<uint64_t> ok,
+    Reg<const unsigned char*> clause_begin,
+    Reg<const unsigned char*> key_end,
+    Reg<const unsigned char*> clause_end,
+    Reg<Id> id) {
+  if (timeExpired()) {
+    ok.set(2);
+    return;
+  }
+  if (interrupted()) {
+    ok.set(2);
+    return;
+  }
+
+  assert(token == iters.size() - 1);
+  if (iters[token].first) {
+    iters[token].first = false;
+  } else {
+    iters[token].iter->next();
+  }
+  auto res = iters[token].iter->get(
+      demand != 0 ? FactIterator::KeyValue : FactIterator::KeyOnly);
+  if (res) {
+    iters[token].id = res.id;
+    if (wantStats) {
+      stats[iters[token].type.toWord()]++;
+    }
+  }
+  DVLOG(5) << "next(" << token << ") = " << (res ? res.id.toWord() : 0);
+
+  if (!res) {
+    ok.set(0);
+    return;
+  }
+
+  id.set(res.id);
+  clause_begin.set(res.clause.bytes().data());
+  key_end.set(res.clause.key().end());
+  clause_end.set(res.clause.bytes().end());
+  ok.set(1);
+};
+
+Pid QueryExecutor::lookupKeyValue(
+    Id fid,
+    binary::Output* kout,
+    binary::Output* vout) {
+  DVLOG(5) << "lookupKeyValue(" << fid.toWord() << ")";
+  Pid pid;
+  facts.factById(fid, [&](Pid pid_, auto clause) {
+    pid = pid_;
+    if (kout) {
+      *kout = binary::Output();
+      kout->put(clause.key());
+    }
+    if (vout) {
+      *vout = binary::Output();
+      vout->put(clause.value());
+    }
+  });
+  return pid;
+};
+
+Id QueryExecutor::newDerivedFact(
+    Pid type,
+    binary::Output* key,
+    size_t keySize) {
+  Fact::Clause clause = Fact::Clause::from(key->bytes(), keySize);
+  auto id = facts.define(type, clause);
+  if (id == Id::invalid()) {
+    if (auto predicate = inventory.lookupPredicate(type)) {
+      error(
+          "query for {} produced facts with identical keys "
+          "but different values",
+          predicate->name);
+    } else {
+      error("unknown pid: {}", type.toWord());
+    }
+  }
+
+  // If we are going to store this derived fact in the DB, we need to
+  // know its ownership set, which is determined by the facts it was
+  // derived from.
+  if (ownership) {
+    std::set<UsetId> owners;
+
+    // The Ids can only be facts that we already have computed owners for.
+    for (const auto& iter : iters) {
+      if (iter.id != Id::invalid()) {
+        auto owner = facts.getOwner(iter.id);
+        if (owner == INVALID_USET) {
+          VLOG(1) << "fact " << iter.id.toWord() << " has no owner";
+        } else {
+          owners.insert(owner);
+        }
+      }
+    }
+    if (owners.size() > 0) {
+      ownership->derivedFrom(type, id, owners);
+    }
+  }
+
+  return id;
+};
+
+void put(binary::Output& out, const QueryExecutor::Iter& iter) {
+  if (auto fact = iter.iter->get(FactIterator::KeyOnly)) {
+    serialize::put(out, fact.id);
+    serialize::put(out, iter.type);
+    serialize::put(out, static_cast<uint64_t>(iter.prefix_size));
+    serialize::put(out, iter.first);
+    serialize::put(out, iter.iter->lower_bound());
+    serialize::put(out, iter.iter->upper_bound());
+  } else {
+    serialize::put(out, Id::invalid().toWord());
+    serialize::put(out, Pid::invalid().toWord());
+  }
+}
+
+using SerializedCont = binary::Output;
+
+SerializedCont QueryExecutor::queryCont(Subroutine::Activation& act) const {
+  binary::Output out;
+
+  serialize::put(out, iters);
+  serialize::put(out, act);
+  serialize::put(out, pid);
+  serialize::put(out, traverse);
+
+  return out;
+};
+
+void QueryExecutor::nestedFact(Id id, Pid pid) {
+  DVLOG(5) << "nestedFact: " << id.toWord();
+  if (depth == Depth::ExpandPartial &&
+      expandPids.find(pid) == expandPids.end()) {
+    return;
+  }
+  auto added = nested_results_added.insert(id.toWord());
+  if (added.second) {
+    nested_result_pending.emplace_back(id);
+  }
+};
+
+size_t QueryExecutor::recordResult(
+    Id id,
+    binary::Output* key,
+    binary::Output* val,
+    Pid pid,
+    bool rec) {
+  assert(id != Id::invalid());
+  result_ids.emplace_back(id.toWord());
+  result_pids.emplace_back(pid.toWord());
+  result_keys.emplace_back(key ? key->string() : "");
+  result_values.emplace_back(val ? val->string() : "");
+  DVLOG(5) << "result added (" << id.toWord() << ")";
+  auto key_size = key ? key->size() : 0;
+  auto val_size = val ? val->size() : 0;
+  size_t bytes = sizeof(Id) + key_size + val_size;
+  if (rec || depth != Depth::ResultsOnly) {
+    {
+      binary::Output bin;
+      bin.expect(key_size + val_size);
+      if (key) {
+        bin.put(key->bytes());
+      }
+      if (val) {
+        bin.put(val->bytes());
+      }
+      auto clause = Fact::Clause::from(bin.bytes(), key_size);
+      if (traverse) {
+        Predicate::runTraverse(
+            *traverse, syscalls<&QueryExecutor::nestedFact>(*this), clause);
+        ;
+      } else {
+        auto predicate = inventory.lookupPredicate(pid);
+        if (!predicate) {
+          error("unknown pid: {}", pid.toWord());
+        }
+        predicate->traverse(
+            syscalls<&QueryExecutor::nestedFact>(*this), clause);
+      }
+    }
+    while (nested_result_pending.size() > 0) {
+      auto id = nested_result_pending[nested_result_pending.size() - 1];
+      nested_result_pending.pop_back();
+      facts.factById(id, [&](Pid pid_, auto clause) {
+        inventory.lookupPredicate(pid_)->traverse(
+            syscalls<&QueryExecutor::nestedFact>(*this), clause);
+        nested_result_ids.emplace_back(id.toWord());
+        nested_result_pids.emplace_back(pid_.toWord());
+        auto key = binary::mkString(clause.key());
+        auto val = binary::mkString(clause.value());
+        bytes += sizeof(Id) + key.size() + val.size();
+        nested_result_keys.emplace_back(std::move(key));
+        nested_result_values.emplace_back(std::move(val));
+      });
+    }
+  }
+  return bytes;
+};
+
+std::unique_ptr<QueryResults> QueryExecutor::finish(
+    folly::Optional<SerializedCont> cont) {
+  auto res = std::make_unique<QueryResults>();
+  res->fact_ids = std::move(result_ids);
+  res->fact_pids = std::move(result_pids);
+  res->fact_keys = std::move(result_keys);
+  res->fact_values = std::move(result_values);
+  res->nested_fact_ids = std::move(nested_result_ids);
+  res->nested_fact_pids = std::move(nested_result_pids);
+  res->nested_fact_keys = std::move(nested_result_keys);
+  res->nested_fact_values = std::move(nested_result_values);
+  res->result_bytes = result_bytes;
+
+  if (cont.hasValue()) {
+    res->continuation = cont->string();
+  };
+
+  if (wantStats) {
+    res->stats = std::move(stats);
+  }
+  res->elapsed_ns = watch.elapsed().count();
+  return res;
+}
+
+std::unique_ptr<QueryResults> executeQuery(
+    Inventory& inventory,
+    Define& facts,
+    DefineOwnership* ownership,
+    Subroutine& sub,
+    Pid pid,
+    std::shared_ptr<Subroutine> traverse,
+    folly::Optional<uint64_t> maxResults,
+    folly::Optional<uint64_t> maxBytes,
+    folly::Optional<uint64_t> maxTime,
+    folly::Optional<uint64_t> maxSetSize,
+    Depth depth,
+    std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+    bool wantStats,
+    std::vector<QueryExecutor::Iter> iters,
+    std::optional<Subroutine::Activation::State> restart) {
+  QueryExecutor q(
+      inventory,
+      facts,
+      ownership,
+      sub,
+      pid,
+      traverse,
+      depth,
+      expandPids,
+      wantStats,
+      std::move(iters),
+      maxSetSize ? *maxSetSize : UINT64_MAX);
+
+  // coarse_steady_clock is around 1ms granularity which is enough for us.
+  q.timeout = Clock::now();
+  q.start_time = Clock::now();
+  if (maxTime) {
+    q.timeout += std::chrono::milliseconds{*maxTime};
+    q.check_timeout = CHECK_TIMEOUT_INTERVAL;
+  } else {
+    q.check_timeout = UINT64_MAX;
+  }
+
+  auto max_results = maxResults ? *maxResults : UINT64_MAX;
+  auto max_bytes = maxBytes ? *maxBytes : UINT64_MAX;
+
+  // IF YOU BREAK BACKWARD COMPATIBILITY HERE, BUMP version IN
+  // Glean.Bytecode.Generate.Instruction
+  //
+  // IF YOU ALSO BREAK FORWARD COMPATIBILITY, BUMP lowestSupportedVersion AS
+  // WELL
+
+  const auto context_ = syscalls<
+      &QueryExecutor::seek,
+      &QueryExecutor::seekWithinSection,
+      &QueryExecutor::currentSeek,
+      &QueryExecutor::endSeek,
+      &QueryExecutor::next,
+      &QueryExecutor::lookupKeyValue,
+      &QueryExecutor::result,
+      &QueryExecutor::resultWithPid,
+      &QueryExecutor::newDerivedFact,
+      &QueryExecutor::firstFreeId,
+      &QueryExecutor::newSet,
+      &QueryExecutor::insertOutputSet,
+      &QueryExecutor::setToArray,
+      &QueryExecutor::freeSet,
+      &QueryExecutor::newWordSet,
+      &QueryExecutor::insertWordSet,
+      &QueryExecutor::wordSetToArray,
+      &QueryExecutor::byteSetToByteArray,
+      &QueryExecutor::freeWordSet>(q);
+
+  folly::Optional<SerializedCont> cont;
+  Subroutine::Activation::with(
+      sub, context_.contextptr(), [&](Subroutine::Activation& activation) {
+        if (restart.has_value()) {
+          activation.resume(std::move(*restart));
+        } else {
+          activation.start();
+        }
+
+        auto args = activation.args();
+        args =
+            std::copy(context_.handlers_begin(), context_.handlers_end(), args);
+        *args++ = 0; // unused
+        *args++ = reinterpret_cast<uint64_t>(max_results);
+        uint64_t* max_bytes_p = args;
+        *args++ = reinterpret_cast<uint64_t>(max_bytes);
+
+        activation.execute();
+        if (activation.suspended()) {
+          cont = q.queryCont(activation);
+        }
+
+        q.result_bytes = max_bytes - *max_bytes_p;
+      });
+
+  return q.finish(std::move(cont));
+}
+} // namespace
+
+void interruptRunningQueries() {
+  last_interrupt = Clock::now();
+}
+
+std::unique_ptr<QueryResults> restartQuery(
+    Inventory& inventory,
+    Define& facts,
+    DefineOwnership* ownership,
+    folly::Optional<uint64_t> maxResults,
+    folly::Optional<uint64_t> maxBytes,
+    folly::Optional<uint64_t> maxTime,
+    folly::Optional<uint64_t> maxSetSize,
+    Depth depth,
+    std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+    bool wantStats,
+    void* serializedCont,
+    uint64_t serializedContLen) {
+  binary::Input in{serializedCont, serializedContLen};
+
+  std::shared_ptr<Subroutine> traverse;
+  Pid pid;
+
+  struct DeserializeIter {
+    Define& facts;
+
+    void get(binary::Input& in, QueryExecutor::Iter& result) {
+      std::unique_ptr<FactIterator> iter;
+      Id id;
+      Pid type;
+      serialize::get(in, id);
+      serialize::get(in, type);
+
+      if (type) {
+        uint64_t prefixSize;
+        bool first;
+        std::optional<Id> lower_bound;
+        std::optional<Id> upper_bound;
+        serialize::get(in, prefixSize);
+        serialize::get(in, first);
+        serialize::get(in, lower_bound);
+        serialize::get(in, upper_bound);
+
+        std::string keyBuf;
+        bool found = facts.factById(id, [&](auto pid, Fact::Clause clause) {
+          if (pid != type) {
+            error("restart iter fact has wrong type");
+          }
+          keyBuf = binary::mkString(clause.key());
+        });
+        if (!found) {
+          error("restart iter fact not found");
+        }
+        const auto key = binary::byteRange(keyBuf);
+        if (lower_bound.has_value() && upper_bound.has_value()) {
+          auto from = lower_bound.value();
+          auto to = upper_bound.value();
+          iter = facts.seekWithinSection(type, key, prefixSize, from, to);
+        } else {
+          iter = facts.seek(type, key, prefixSize);
+        }
+        auto res = iter->get(FactIterator::KeyOnly);
+        if (!res || res.key() != key) {
+          error("restart iter didn't find a key");
+        }
+        id = res.id;
+        result.prefix_size = prefixSize;
+        result.first = first;
+      } else {
+        // We serialized a finished iterator
+        iter = std::make_unique<EmptyIterator>();
+        id = Id::invalid();
+      }
+      result.iter = std::move(iter);
+      result.type = type;
+      result.id = id;
+    }
+
+    std::vector<QueryExecutor::Iter> getIters(binary::Input& in) {
+      // I can't figure out how to use the generic serialize::get for vectors
+      // here, so expanding it inline
+      size_t count;
+      serialize::get(in, count);
+      std::vector<QueryExecutor::Iter> iters = {};
+      for (size_t n = 0; n < count; n++) {
+        QueryExecutor::Iter elt;
+        get(in, elt);
+        iters.push_back(std::move(elt));
+      }
+      return iters;
+    }
+  };
+
+  DeserializeIter di{facts};
+  auto iters = di.getIters(in);
+
+  auto [sub, state] = Subroutine::Activation::get(in);
+  serialize::get(in, pid);
+  serialize::get(in, traverse);
+
+  return executeQuery(
+      inventory,
+      facts,
+      ownership,
+      sub,
+      pid,
+      traverse,
+      maxResults,
+      maxBytes,
+      maxTime,
+      maxSetSize,
+      depth,
+      expandPids,
+      wantStats,
+      std::move(iters),
+      std::move(state));
+}
+
+std::unique_ptr<QueryResults> executeQuery(
+    Inventory& inventory,
+    Define& facts,
+    DefineOwnership* ownership,
+    Subroutine& sub,
+    Pid pid,
+    std::shared_ptr<Subroutine> traverse,
+    folly::Optional<uint64_t> maxResults,
+    folly::Optional<uint64_t> maxBytes,
+    folly::Optional<uint64_t> maxTime,
+    folly::Optional<uint64_t> maxSetSize,
+    Depth depth,
+    std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+    bool wantStats) {
+  return executeQuery(
+      inventory,
+      facts,
+      ownership,
+      sub,
+      pid,
+      traverse,
+      maxResults,
+      maxBytes,
+      maxTime,
+      maxSetSize,
+      depth,
+      expandPids,
+      wantStats,
+      {},
+      {});
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/query.h b/glean/rts/query.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/query.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/container/F14Map.h>
+
+#include "glean/rts/factset.h"
+#include "glean/rts/inventory.h"
+#include "glean/rts/ownership/derived.h"
+
+#ifdef OSS
+#include <cpp/HsStruct.h> // @manual
+#else
+#include <common/hs/util/cpp/HsStruct.h>
+#endif
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct QueryResults {
+  HsArray<uint64_t> fact_ids;
+  HsArray<uint64_t> fact_pids;
+  HsArray<HsString> fact_keys;
+  HsArray<HsString> fact_values;
+  HsArray<uint64_t> nested_fact_ids;
+  HsArray<uint64_t> nested_fact_pids;
+  HsArray<HsString> nested_fact_keys;
+  HsArray<HsString> nested_fact_values;
+  HsMap<uint64_t, uint64_t> stats;
+  uint64_t elapsed_ns;
+  HsString continuation;
+  uint64_t result_bytes;
+};
+
+enum class Depth { ResultsOnly, ExpandRecursive, ExpandPartial };
+
+std::unique_ptr<QueryResults> executeQuery(
+    Inventory& inventory,
+    Define& facts,
+    DefineOwnership* ownership,
+    Subroutine& sub,
+    Pid pid,
+    std::shared_ptr<Subroutine> traverse,
+    folly::Optional<uint64_t> maxResults,
+    folly::Optional<uint64_t> maxBytes,
+    folly::Optional<uint64_t> maxTime,
+    folly::Optional<uint64_t> maxSetSize,
+    Depth depth,
+    std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+    bool wantStats);
+
+std::unique_ptr<QueryResults> restartQuery(
+    Inventory& inventory,
+    Define& facts,
+    DefineOwnership* ownership,
+    folly::Optional<uint64_t> maxResults,
+    folly::Optional<uint64_t> maxBytes,
+    folly::Optional<uint64_t> maxTime,
+    folly::Optional<uint64_t> maxSetSize,
+    Depth depth,
+    std::unordered_set<Pid, folly::hasher<Pid>>& expandPids,
+    bool wantStats,
+    void* serializedCont,
+    uint64_t serializedContLen);
+
+void interruptRunningQueries();
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/sanity.cpp b/glean/rts/sanity.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/sanity.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/sanity.h"
+#include <gflags/gflags.h>
+
+DEFINE_bool(sanity_checks, false, "perform sanity checkes (slow)");
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+bool Sanity::enabled = FLAGS_sanity_checks;
+
+}
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/sanity.h b/glean/rts/sanity.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/sanity.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glog/logging.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct Sanity {
+  static bool enabled;
+};
+
+#define GLEAN_SANITY_CHECK(expr)                      \
+  if (!::facebook::glean::rts::Sanity::enabled) {     \
+  } else {                                            \
+    if (!(expr)) {                                    \
+      LOG(FATAL) << "sanity check '" #expr "'failed"; \
+    }                                                 \
+  }
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/serialize.h b/glean/rts/serialize.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/serialize.h
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <glog/logging.h>
+#include <variant>
+#include "glean/rts/binary.h"
+#include "glean/rts/id.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace serialize {
+
+inline void put(binary::Output& o, uint64_t i) {
+  o.nat(i);
+}
+inline void put(binary::Output& o, uint32_t i) {
+  o.nat(i);
+}
+inline void put(binary::Output& o, int32_t i) {
+  o.nat(i);
+}
+inline void put(binary::Output& o, bool b) {
+  o.fixed(uint8_t{b});
+}
+inline void put(binary::Output& o, Id p) {
+  put(o, p.toWord());
+}
+inline void put(binary::Output& o, Pid p) {
+  put(o, p.toWord());
+}
+inline void put(binary::Output& o, const std::string& s) {
+  put(o, s.size());
+  o.put(binary::byteRange(s));
+}
+inline void put(binary::Output& o, const binary::Output& out) {
+  put(o, out.size());
+  o.put(out.bytes());
+}
+
+template <typename T>
+void put(binary::Output& o, const T* p) {
+  put(o, *p);
+}
+
+// We can specify type-specific serialization by defining a static method
+//   T::put(binary::Output&, T&)
+// and then serializing a std::vector<T> or std::optional<T> will work.
+template <typename T>
+void put(binary::Output& o, const T& p) {
+  T::put(o, p);
+}
+
+template <typename T>
+void put(binary::Output& o, const folly::Range<T*>& r) {
+  put(o, r.size());
+  for (auto& i : r) {
+    put(o, i);
+  }
+}
+
+template <typename T>
+void put(binary::Output& o, const std::vector<T>& vec) {
+  put(o, folly::Range<const T*>(vec.data(), vec.size()));
+}
+
+struct AsBytes {};
+
+// put(out, vec, AsBytes{})
+//   serialize a vector of integrals as a binary blob
+template <typename T, typename = std::enable_if<std::is_integral_v<T>>>
+void put(binary::Output& o, const std::vector<T>& vec, AsBytes) {
+  put(o, vec.size());
+  o.bytes(reinterpret_cast<const uint8_t*>(vec.data()), vec.size() * sizeof(T));
+}
+
+template <typename T>
+void put(binary::Output& o, const std::optional<T>& opt) {
+  if (opt.has_value()) {
+    o.fixed(uint8_t{1});
+    put(o, *opt);
+  } else {
+    o.fixed(uint8_t{0});
+  }
+}
+
+template <typename T>
+void put(binary::Output& o, const std::shared_ptr<T>& s) {
+  if (s) {
+    o.fixed(uint8_t{1});
+    put(o, *s);
+  } else {
+    o.fixed(uint8_t{0});
+  }
+}
+
+inline void get(binary::Input& i, uint64_t& r) {
+  r = i.untrustedNat();
+}
+inline void get(binary::Input& i, uint32_t& r) {
+  r = i.untrustedNat();
+}
+inline void get(binary::Input& i, int32_t& r) {
+  r = i.untrustedNat();
+}
+inline void get(binary::Input& i, bool& r) {
+  r = i.byte();
+}
+inline void get(binary::Input& i, Id& p) {
+  uint64_t w;
+  get(i, w);
+  p = Id::fromWord(w);
+}
+inline void get(binary::Input& i, Pid& p) {
+  uint64_t w;
+  get(i, w);
+  p = Pid::fromWord(w);
+}
+inline void get(binary::Input& i, std::string& s) {
+  size_t n;
+  get(i, n);
+  auto r = i.bytes(n);
+  s = binary::mkString(r);
+}
+inline void get(binary::Input& i, binary::Output& out) {
+  size_t n;
+  get(i, n);
+  out.put(i.bytes(n));
+}
+
+template <typename T>
+void get(binary::Input& i, T& p) {
+  T::get(i, p);
+}
+
+template <typename T>
+void get(binary::Input& i, std::vector<T>& vec) {
+  size_t count;
+  get(i, count);
+  vec.reserve(count);
+  vec.resize(0);
+  for (size_t n = 0; n < count; n++) {
+    T elt;
+    get(i, elt);
+    vec.push_back(std::move(elt));
+  }
+}
+
+template <typename T, typename = std::enable_if<std::is_integral_v<T>>>
+void get(binary::Input& i, std::vector<T>& vec, AsBytes) {
+  size_t count;
+  get(i, count);
+  vec.resize(count);
+  folly::ByteRange bytes = i.bytes(count * sizeof(T));
+  std::copy(bytes.begin(), bytes.end(), reinterpret_cast<uint8_t*>(vec.data()));
+}
+
+template <typename T>
+void get(binary::Input& i, std::optional<T>& opt) {
+  auto x = i.byte();
+  if (x) {
+    T y;
+    get(i, y);
+    opt = std::move(y);
+  } else {
+    opt = {};
+  }
+}
+
+template <typename T>
+void get(binary::Input& i, std::shared_ptr<T>& p) {
+  auto x = i.byte();
+  if (x) {
+    p = std::make_shared<T>();
+    get(i, *p);
+  } else {
+    p = nullptr;
+  }
+}
+
+/// A Thrift compact serializer that only supports a very
+// small subset of the types.
+namespace thriftcompact {
+
+using Nat = int64_t;
+using Binary = folly::ByteRange;
+using String = std::string;
+using List = std::vector<Nat>; // TODO: generalise
+using Map = std::map<String, List>; // TODO: generalise
+
+using Field = std::variant<Nat, Binary, Map, String>;
+using Object = std::vector<std::pair<uint32_t, Field>>;
+
+enum Type : uint32_t {
+  NatTy = 6,
+  BinaryTy = 8,
+  StringTy = 8,
+  ListTy = 9,
+  MapTy = 11,
+};
+
+template <typename T>
+static Type typeOf();
+template <>
+Type typeOf<Nat>() {
+  return NatTy;
+}
+template <>
+Type typeOf<Binary>() {
+  return BinaryTy;
+}
+template <>
+Type typeOf<String>() {
+  return StringTy;
+}
+template <>
+Type typeOf<std::vector<Nat>>() {
+  return ListTy;
+}
+
+inline void put(binary::Output& out, Nat x) {
+  out.packed(folly::encodeZigZag(x));
+}
+
+inline void put(binary::Output& out, Binary b) {
+  out.packed(b.size());
+  out.bytes(b.data(), b.size());
+}
+
+inline void put(binary::Output& out, const String& s) {
+  out.packed(s.size());
+  out.put(binary::byteRange(s));
+}
+
+template <typename T>
+void put(binary::Output& out, const std::vector<T>& v) {
+  if (v.size() < 15) {
+    out.fixed(uint8_t((v.size() << 4) | typeOf<T>()));
+  } else {
+    out.fixed(uint8_t(0xF0 | typeOf<T>()));
+    out.packed(v.size());
+  }
+  for (const T& i : v) {
+    put(out, i);
+  }
+}
+
+template <typename K, typename V>
+void put(binary::Output& out, const std::map<K, V>& m) {
+  if (m.size() == 0) {
+    out.fixed(uint8_t(0));
+  } else {
+    out.packed(m.size());
+    out.fixed(uint8_t((typeOf<K>() << 4) | typeOf<V>()));
+    for (const auto& pair : m) {
+      put(out, pair.first);
+      put(out, pair.second);
+    }
+  }
+}
+
+inline void put(binary::Output& out, const Object& obj) {
+  uint32_t prev = 0;
+  auto field = [&](Type ty, uint32_t num) {
+    auto delta = num - prev;
+    if (delta < 16) {
+      out.fixed(uint8_t(ty + (delta << 4)));
+    } else {
+      out.fixed(uint8_t(ty));
+      out.packed(num);
+    }
+    prev = num;
+  };
+  for (const auto& [num, val] : obj) {
+    if (std::holds_alternative<Nat>(val)) {
+      field(NatTy, num);
+      put(out, std::get<Nat>(val));
+    } else if (std::holds_alternative<Binary>(val)) {
+      field(BinaryTy, num);
+      put(out, std::get<Binary>(val));
+    } else if (std::holds_alternative<Map>(val)) {
+      field(MapTy, num);
+      put(out, std::get<Map>(val));
+    }
+  }
+  out.fixed(uint8_t(0)); // object terminator
+}
+
+} // namespace thriftcompact
+
+} // namespace serialize
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/set.cpp b/glean/rts/set.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/set.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include <glog/logging.h>
+
+#include <folly/FBString.h>
+#include <set>
+
+#include "glean/rts/binary.h"
+#include "glean/rts/set.h"
+
+#include <stdexcept>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+SetOps::SetToken SetOps::newSet() {
+  sets.emplace_back(BytestringSet());
+  set_sizes.emplace_back(0);
+  return sets.size() - 1;
+}
+
+void SetOps::insertOutputSet(SetOps::SetToken token, binary::Output* out) {
+  auto& s = sets[token];
+  auto size = out->size();
+  if (set_sizes[token] + size <= max_set_size) {
+    s.insert(out->moveToFbString());
+    set_sizes[token] += size;
+  } else {
+    rts::error(
+        "Set size limit exceeded for standard set. Max size: {}. Size: {}",
+        max_set_size,
+        set_sizes[token] + size);
+  }
+}
+
+void SetOps::setToArray(SetOps::SetToken token, binary::Output* out) {
+  auto& s = sets[token];
+  out->packed(s.size());
+  for (const auto& v : s) {
+    out->bytes(v.data(), v.size());
+  }
+}
+
+void SetOps::freeSet(SetOps::SetToken token) {
+  sets.erase(sets.begin() + token);
+  set_sizes.erase(set_sizes.begin() + token);
+}
+
+SetOps::SetToken SetOps::newWordSet() {
+  wordsets.emplace_back(WordSet());
+  return wordsets.size() - 1;
+}
+
+void SetOps::insertWordSet(SetOps::SetToken token, uint64_t value) {
+  auto& set = wordsets[token];
+  if ((set.size() + 1) * sizeof(uint64_t) <= max_set_size) {
+    set.insert(value);
+  } else {
+    rts::error(
+        "Set size limit exceeded for nat set. Max size: {}. Size: {}",
+        max_set_size,
+        set.size() + sizeof(uint64_t));
+  }
+}
+
+void SetOps::insertBytesWordSet(
+    SetToken token,
+    const unsigned char* start,
+    const unsigned char* end) {
+  auto& set = wordsets[token];
+  if (set.size() * sizeof(uint64_t) + (end - start) <= max_set_size) {
+    for (const unsigned char* p = start; p < end; p++) {
+      set.insert(*p);
+    }
+  } else {
+    rts::error(
+        "Set size limit exceeded for byte set. Max size: {}. Size: {}",
+        max_set_size,
+        set.size() + (end - start));
+  }
+}
+
+void SetOps::wordSetToArray(SetOps::SetToken token, binary::Output* out) {
+  auto& s = wordsets[token];
+  out->packed(s.size());
+  for (const auto& v : s) {
+    out->packed(v);
+  }
+}
+
+void SetOps::byteSetToByteArray(SetOps::SetToken token, binary::Output* out) {
+  auto& s = wordsets[token];
+  out->packed(s.size());
+  for (const auto& v : s) {
+    out->fixed<uint8_t>(v);
+  }
+}
+
+void SetOps::freeWordSet(SetOps::SetToken token) {
+  wordsets.erase(wordsets.begin() + token);
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/set.h b/glean/rts/set.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/set.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/FBString.h>
+#include <set>
+
+#include "glean/rts/binary.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct CmpSet {
+  bool operator()(const folly::fbstring& lhs, const folly::fbstring& rhs)
+      const {
+    return std::lexicographical_compare(
+        lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
+  }
+};
+
+using BytestringSet = std::set<folly::fbstring, CmpSet>;
+
+using WordSet = std::set<uint64_t>;
+
+struct SetOps {
+  using SetToken = uint64_t;
+
+  explicit SetOps(uint64_t max_set_size = UINT64_MAX)
+      : max_set_size(max_set_size) {}
+
+  SetToken newSet();
+
+  void insertOutputSet(SetToken token, binary::Output* out);
+
+  void setToArray(SetToken token, binary::Output* out);
+
+  void freeSet(SetToken token);
+
+  SetToken newWordSet();
+
+  void insertWordSet(SetToken token, uint64_t out);
+
+  void insertBytesWordSet(
+      SetToken token,
+      const unsigned char* start,
+      const unsigned char* end);
+
+  void wordSetToArray(SetToken token, binary::Output* out);
+
+  void byteSetToByteArray(SetToken token, binary::Output* out);
+
+  void freeWordSet(SetToken token);
+
+  std::vector<BytestringSet> sets = {};
+  std::vector<WordSet> wordsets = {};
+  std::vector<uint64_t> set_sizes = {};
+  uint64_t max_set_size = UINT64_MAX;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/stacked.h b/glean/rts/stacked.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/stacked.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/binary.h"
+#include "glean/rts/factset.h"
+#include "glean/rts/inventory.h"
+#include "glean/rts/substitution.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+template <typename Iface>
+struct StackedBase : Iface {
+  StackedBase(Lookup* b, Iface* s)
+      : base(b), stacked(s), mid(stacked->startingId()) {}
+
+  // Lookup implementation
+
+  Id idByKey(Pid type, folly::ByteRange key) override {
+    if (auto id = stacked->idByKey(type, key)) {
+      return id;
+    } else {
+      auto bid = base->idByKey(type, key);
+      return bid < mid ? bid : Id::invalid();
+    }
+  }
+
+  Pid typeById(Id id) override {
+    return id < mid ? base->typeById(id) : stacked->typeById(id);
+  }
+
+  bool factById(Id id, std::function<void(Pid, Fact::Clause)> f) override {
+    return id < mid ? base->factById(id, std::move(f))
+                    : stacked->factById(id, std::move(f));
+  }
+
+  Id startingId() const override {
+    return base->startingId();
+  }
+  Id firstFreeId() const override {
+    return stacked->firstFreeId();
+  }
+
+  Interval count(Pid pid) const override {
+    return base->count(pid) + stacked->count(pid);
+  }
+
+  std::unique_ptr<FactIterator> enumerate(Id from, Id upto) override {
+    if (from < mid) {
+      if (upto && upto <= mid) {
+        return base->enumerate(from, upto);
+      } else {
+        return FactIterator::append(
+            base->enumerate(from, mid), stacked->enumerate(mid, upto));
+      }
+    } else {
+      return stacked->enumerate(from, upto);
+    }
+  }
+
+  std::unique_ptr<FactIterator> enumerateBack(Id from, Id downto) override {
+    if (from && from <= mid) {
+      return base->enumerateBack(from, downto);
+    } else if (downto >= mid) {
+      return stacked->enumerateBack(from, downto);
+    } else {
+      return FactIterator::append(
+          stacked->enumerateBack(from, mid), base->enumerateBack(mid, downto));
+    }
+  }
+
+  std::unique_ptr<FactIterator>
+  seek(Pid type, folly::ByteRange start, size_t prefix_size) override {
+    return FactIterator::merge(
+        base->seekWithinSection(type, start, prefix_size, Id::invalid(), mid),
+        stacked->seek(type, start, prefix_size),
+        prefix_size);
+  }
+
+  std::unique_ptr<FactIterator> seekWithinSection(
+      Pid type,
+      folly::ByteRange start,
+      size_t prefix_size,
+      Id from,
+      Id to) override {
+    if (to <= mid) {
+      return base->seekWithinSection(type, start, prefix_size, from, to);
+    } else if (mid <= from) {
+      return stacked->seekWithinSection(type, start, prefix_size, from, to);
+    } else {
+      return FactIterator::merge(
+          base->seekWithinSection(type, start, prefix_size, from, mid),
+          stacked->seekWithinSection(type, start, prefix_size, mid, to),
+          prefix_size);
+    }
+  }
+
+  UsetId getOwner(Id id) override {
+    // The stacked DB may specify the owner for a fact in the base DB
+    // due to propagation of ownership from facts in the stacked DB,
+    // so we have to check the stacked DB first.
+    auto set = stacked->getOwner(id);
+    if (set != INVALID_USET) {
+      return set;
+    } else {
+      return id < mid ? base->getOwner(id) : INVALID_USET;
+    }
+  }
+
+ protected:
+  Lookup* base;
+  Iface* stacked;
+  Id mid;
+};
+
+/**
+ * A Stacked stacks a Lookup or Define on top of a base Lookup, allowing facts
+ * to be looked up in both and new facts added to the stacked object if
+ * supported. The stacked object's starting id determines the boundary between
+ * the two - any facts in the base Lookup with an id >= that will be ignored.
+ *
+ *
+ * This is an attempt to model the corresponding Haskell hierarchy in C++.
+ */
+template <typename Iface>
+struct Stacked;
+
+template <>
+struct Stacked<Lookup> final : StackedBase<Lookup> {
+  using StackedBase<Lookup>::StackedBase;
+};
+
+template <>
+struct Stacked<Define> final : StackedBase<Define> {
+  using StackedBase<Define>::StackedBase;
+
+  // Define implementation
+
+  Id define(Pid type, Fact::Clause clause, Id max_ref = Id::invalid())
+      override {
+    // TODO: We probably want to look up in stacked first but the current
+    // interface doesn't support doing that without two lookups.
+
+    // If the clause references a local fact then it can't possibly exist in the
+    // global Lookup so don't bother looking it up there.
+    if (max_ref < mid) {
+      auto id = base->idByKey(type, clause.key());
+      if (id && id < mid) {
+        // NOTE: We assume that 'value' has been typechecked. If it is empty
+        // then
+        //       it must be the only inhabitant of its type (which must be () or
+        //       similar). This means that there is no need to check against the
+        //       value stored in the database as that must be empty, too.
+        if (clause.value_size != 0) {
+          [[maybe_unused]] bool found =
+              base->factById(id, [&](auto, auto found) {
+                if (clause.value() != found.value()) {
+                  id = Id::invalid();
+                }
+              });
+          assert(found);
+        }
+        return id;
+      }
+    }
+    return stacked->define(type, clause, max_ref);
+  }
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/stats.cpp b/glean/rts/stats.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/stats.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/memory.h> // @manual
+#else
+#include <common/hs/util/cpp/memory.h>
+#endif
+
+#include "glean/rts/stats.h"
+
+using namespace facebook::hs;
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+void marshal(
+    const PredicateStats& stats,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes) {
+  const auto n = stats.size();
+  auto ids_arr = ffi::malloc_array<int64_t>(n);
+  auto counts_arr = ffi::malloc_array<uint64_t>(n);
+  auto sizes_arr = ffi::malloc_array<uint64_t>(n);
+  size_t i = 0;
+  for (const auto x : stats) {
+    if (x.second.count) {
+      ids_arr[i] = x.first.toThrift();
+      counts_arr[i] = x.second.count;
+      sizes_arr[i] = x.second.memory;
+      ++i;
+    }
+  }
+  *count = i;
+  *ids = ids_arr.release();
+  *counts = counts_arr.release();
+  *sizes = sizes_arr.release();
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/stats.h b/glean/rts/stats.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/stats.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <cstdlib>
+#include <limits>
+
+#include "glean/rts/densemap.h"
+#include "glean/rts/id.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+/** A Interval is a size_t interval with a lower and an upper bound */
+struct Interval {
+  Interval(size_t n = 0) : lo(n), hi(n) {}
+
+  constexpr bool exact() const {
+    return lo == hi;
+  }
+  constexpr size_t low() const {
+    return lo;
+  }
+  constexpr size_t high() const {
+    return hi;
+  }
+
+  static Interval atLeast(size_t n) {
+    return Interval(n, std::numeric_limits<size_t>::max());
+  }
+
+  static Interval atMost(size_t n) {
+    return Interval(0, n);
+  }
+
+  Interval& operator+=(const Interval& other) {
+    lo = sat_add(lo, other.lo);
+    hi = sat_add(hi, other.hi);
+    return *this;
+  }
+
+  Interval asHigh() const {
+    return Interval(0, hi);
+  }
+
+  Interval asLow() const {
+    return Interval(lo, std::numeric_limits<size_t>::max());
+  }
+
+ private:
+  Interval(size_t low, size_t high) : lo(low), hi(high) {}
+
+  static size_t sat_add(size_t x, size_t y) {
+    return std::numeric_limits<size_t>::max() - x < y
+        ? std::numeric_limits<size_t>::max()
+        : x + y;
+  }
+
+  size_t lo;
+  size_t hi;
+};
+
+inline constexpr bool operator==(const Interval& x, const Interval& y) {
+  return x.low() == y.low() && x.high() == y.high();
+}
+
+inline constexpr bool operator!=(const Interval& x, const Interval& y) {
+  return !(x == y);
+}
+
+inline Interval operator+(const Interval& x, const Interval& y) {
+  Interval r(x);
+  r += y;
+  return r;
+}
+
+struct MemoryStats {
+  /// Number of items
+  size_t count;
+
+  /// Memory used
+  size_t memory;
+
+  MemoryStats() : count(0), memory(0) {}
+  MemoryStats(size_t n, size_t mem) : count(n), memory(mem) {}
+
+  static MemoryStats one(size_t mem) {
+    return MemoryStats(1, mem);
+  }
+
+  MemoryStats& operator+=(const MemoryStats& other) {
+    count += other.count;
+    memory += other.memory;
+    return *this;
+  }
+
+  MemoryStats operator+(const MemoryStats& other) const {
+    MemoryStats s(*this);
+    s += other;
+    return s;
+  }
+
+  bool operator==(const MemoryStats& other) const {
+    return count == other.count && memory == other.memory;
+  }
+
+  bool operator!=(const MemoryStats& other) const {
+    return !(*this == other);
+  }
+};
+
+using PredicateStats = DenseMap<Pid, MemoryStats>;
+
+void marshal(
+    const PredicateStats& stats,
+    size_t* count,
+    int64_t** ids,
+    uint64_t** counts,
+    uint64_t** sizes);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/store.h b/glean/rts/store.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/store.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/fact.h"
+#include "glean/rts/lookup.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct Store {
+  /// Insert a new fact into the set if it doesn't conflict with existing
+  /// facts. The return value indicates whether the fact was new.
+  ///
+  /// PRECONDITION: The new fact doesn't conflict with an existing one.
+  /// A conflict occurs in two cases.
+  ///   - There is a fact with the same id but different type, key or value.
+  ///   - There is a fact with the same type and key but different id.
+  ///
+  /// Inserting the same fact twice is fine.
+  virtual void insert(Fact::Ref fact) = 0;
+
+  virtual ~Store() {}
+};
+
+inline void copyFacts(Store& store, Lookup& lookup) {
+  for (auto iter = lookup.enumerate(); auto fact = iter->get(); iter->next()) {
+    store.insert(fact);
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/string.cpp b/glean/rts/string.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/string.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/string.h"
+#include <glog/logging.h>
+#include <unicode/uchar.h>
+#include <unicode/utf8.h>
+#include <cassert>
+#include <cstring>
+#include "glean/rts/binary.h"
+#include "glean/rts/error.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+/// Iterate over chunks of a mangled string, delimited by NULs, and call
+/// Chunk for each chunk except the last and Last for the last one, passing
+/// a pointer one past the end of the chunk (including delimiters). Examples:
+///
+/// mangled string         calls
+///
+/// abc\0\0                last(q)
+/// p      q
+///
+/// abc\0\1def\0\1gh\0\0   chunk(p), chunk(q), chunk(r), last(s)
+/// p      q      r     s
+///
+template <typename Chunk>
+FOLLY_ALWAYS_INLINE size_t
+untrustedChunks(folly::ByteRange range, Chunk&& chunk) {
+  const unsigned char* const p = range.data();
+  const size_t size = range.size();
+
+  assert(p != nullptr);
+
+  int i;
+  for (i = 0; i < size && p[i] > 0 && p[i] < 0x80; ++i) {
+  }
+  if (i + 1 < size && p[i] == 0 && p[i + 1] == 0) {
+    chunk(p, i);
+    return i + 2;
+  }
+
+  int k = 0;
+  while (true) {
+    UChar32 c;
+    // NOTE: U8_NEXT returns c<0 on overlong (invalid) points so this doesn't
+    // transcode (and we don't have to worry about, say, overlong \NUL).
+    U8_NEXT(p, i, size, c);
+    if (c == 0) {
+      if (i < size) {
+        switch (p[i]) {
+          case 0:
+            chunk(p + k, i - k - 1);
+            return i + 1;
+
+          case 1:
+            chunk(p + k, i - k);
+            ++i;
+            k = i;
+            break;
+
+          default:
+            rts::error("invalid NUL in mangled string");
+        }
+      } else {
+        rts::error("truncated terminator in mangled string");
+      }
+    } else if (c < 0) {
+      rts::error("invalid UTF-8 string");
+    }
+  }
+}
+
+} // namespace
+
+size_t validateUntrustedString(folly::ByteRange range) {
+  return untrustedChunks(range, [](auto, auto) {});
+}
+
+size_t demangleUntrustedString(folly::ByteRange range, binary::Output& output) {
+  return untrustedChunks(range, [&](auto p, auto n) { output.bytes(p, n); });
+}
+
+namespace {
+
+template <typename Chunk>
+FOLLY_ALWAYS_INLINE size_t
+trustedChunks(folly::ByteRange range, Chunk&& chunk) noexcept {
+  const auto end = range.end();
+  auto p = range.begin();
+  while (true) {
+    auto q = static_cast<const unsigned char*>(std::memchr(p, 0, end - p));
+    CHECK(q && q + 1 < end);
+    if (q[1] == 0) {
+      chunk(p, q - p);
+      return q - range.begin() + 2;
+    } else {
+      chunk(p, q - p + 1);
+      p = q + 2;
+    }
+  }
+}
+
+} // namespace
+
+std::pair<size_t, size_t> skipTrustedString(folly::ByteRange range) noexcept {
+  size_t nuls = 0;
+  auto size = trustedChunks(range, [&](auto, auto) { ++nuls; });
+  assert(nuls > 0);
+  assert(size >= nuls * 2);
+  return std::make_pair(size, size - nuls - 1);
+}
+
+size_t demangleTrustedString(folly::ByteRange range, uint8_t* buffer) noexcept {
+  auto out = buffer;
+  trustedChunks(range, [&](auto p, auto n) {
+    std::memcpy(out, p, n);
+    out += n;
+  });
+  return out - buffer;
+}
+
+void mangleString(folly::ByteRange range, binary::Output& output) {
+  if (!range.empty()) {
+    auto p = range.begin();
+    while (auto q = static_cast<const unsigned char*>(
+               std::memchr(p, 0, range.end() - p))) {
+      ++q;
+      output.put({p, q});
+      output.fixed<uint8_t>(1);
+      p = q;
+    }
+    output.put({p, range.end()});
+  }
+  const unsigned char terminator[2] = {0, 0};
+  output.bytes(terminator, 2);
+}
+
+void toLowerTrustedString(folly::ByteRange range, binary::Output& output) {
+  output.expect(range.size());
+  for (int32_t i = 0; i < range.size();) {
+    unsigned char b = static_cast<unsigned char>(range[i]);
+    if (b < 0x80) {
+      // This will also ignore \0 and \1 in the mangled string
+      if (b >= 'A' && b <= 'Z') {
+        b = b - 'A' + 'a';
+      }
+      output.fixed(b);
+      i++;
+    } else {
+      UChar32 c;
+      U8_NEXT_UNSAFE(range.data(), i, c);
+      c = u_tolower(c);
+      uint8_t buf[4];
+      auto j = 0;
+      U8_APPEND_UNSAFE(buf, j, c);
+      output.bytes(buf, j);
+    }
+  }
+}
+
+void reverseTrustedString(unsigned char* p, size_t size) {
+  // Don't reverse the last two bytes, which are the terminators
+  std::reverse(p, p + size - 2);
+
+  // Fix non-ASCII characters
+  size -= 2;
+  while (size > 0) {
+    auto* leadcharptr = &p[size - 1];
+    auto nBytes = 1;
+    if ((*leadcharptr & 0xe0) == 0xc0) {
+      nBytes = 2;
+    } else if ((*leadcharptr & 0xf0) == 0xe0) {
+      nBytes = 3;
+    } else if ((*leadcharptr & 0xf8) == 0xf0) {
+      nBytes = 4;
+    }
+    std::reverse(leadcharptr - nBytes + 1, leadcharptr + 1);
+    size -= nBytes;
+  }
+}
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/string.h b/glean/rts/string.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/string.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/Range.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <utility>
+
+// UTF-8 string representation
+//
+// We use a slightly mangled representation for UTF-8 strings. A string is
+// terminated by the two bytes 0x00 0x00. Any embedded \NUL characters are
+// converted to the sequence 0x00 0x01. All other character are left untouched.
+// This encoding has the following properties.
+//
+//   1. Prefix search and compression works properly.
+//   2. memcmp sorts strings as expected (esp. for prefixes).
+//   3. Embedded \NUL is supported.
+//   4. No mangling happens in the common case (no embedded \NUL).
+
+namespace facebook {
+namespace glean {
+
+namespace binary {
+struct Output;
+}
+
+namespace rts {
+
+/// Validate an untrusted mangled string and return its size, including the
+/// terminator.
+size_t validateUntrustedString(folly::ByteRange);
+
+/// Demangle an untrusted mangled string into an Output and return its mangled
+/// size, including the terminator.
+size_t demangleUntrustedString(folly::ByteRange, binary::Output&);
+
+/// Return the mangled and demangled sizes of a trusted string.
+std::pair<size_t, size_t> skipTrustedString(folly::ByteRange) noexcept;
+
+/// Demangle a trusted mangled string into a buffer and return its mangled size.
+/// The buffer must have enough space.
+size_t demangleTrustedString(folly::ByteRange, uint8_t*) noexcept;
+
+/// Mangle a UTF-8 string into the Output.
+void mangleString(folly::ByteRange, binary::Output&);
+
+/// Tolower a mangled string
+void toLowerTrustedString(folly::ByteRange, binary::Output&);
+
+void reverseTrustedString(unsigned char* p, size_t size);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/substitution.cpp b/glean/rts/substitution.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/substitution.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/substitution.h"
+#include "glean/rts/error.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+Substitution::Substitution(Id first, size_t size)
+    : base(first), items(size, Id::invalid()) {}
+
+Substitution::Substitution(Id first, std::vector<Id> ids)
+    : base(first), items(std::move(ids)) {}
+
+Id Substitution::firstFreeId() const {
+  if (!firstFreeId_) {
+    const auto i = std::max_element(items.begin(), items.end());
+    firstFreeId_ = i != items.end() ? std::max(*i + 1, finish()) : finish();
+  }
+  return firstFreeId_;
+}
+
+std::vector<Id> Substitution::substIntervals(
+    const std::vector<Id>& intervals) const {
+  CHECK_EQ(intervals.size() % 2, 0);
+  closed_interval_set<Id> is;
+
+  auto add = [&](Id start, Id end) {
+    if (end >= finish()) {
+      error(
+          "interval out of range: {}-{} base={} finish={}",
+          start.toWord(),
+          end.toWord(),
+          base.toWord(),
+          finish().toWord());
+    }
+    if (end < base) {
+      is.add({start, end});
+    } else {
+      if (start < base) {
+        is.add({start, base - 1});
+      }
+      for (Id id = std::max(start, base); id <= end; ++id) {
+        is.add(subst(id));
+      }
+    }
+  };
+
+  auto i = intervals.begin();
+  const auto e = intervals.end();
+
+  while (i != e) {
+    const auto start = i[0];
+    const auto end = i[1];
+    CHECK(start <= end);
+    add(start, end);
+    i += 2;
+  }
+  std::vector<Id> results;
+  results.reserve(is.iterative_size() * 2);
+  for (const auto& p : is) {
+    results.push_back(p.lower());
+    results.push_back(p.upper());
+  }
+  return results;
+}
+
+closed_interval_set<Id> Substitution::substIntervals(
+    const closed_interval_set<Id>& intervals) const {
+  closed_interval_set<Id> result;
+  for (auto ival : intervals) {
+    if (ival.upper() < base) {
+      result.add(ival);
+    } else {
+      for (Id id = ival.lower(); id <= ival.upper(); ++id) {
+        result.add(subst(id));
+      }
+    }
+  }
+  return result;
+}
+
+Substitution Substitution::compose(
+    const Substitution& first,
+    const Substitution& second) {
+  std::vector<Id> ids;
+  ids.reserve(first.items.size());
+  for (auto id : first.items) {
+    ids.push_back(id < second.finish() ? second.subst(id) : id);
+  }
+  return Substitution(first.base, std::move(ids));
+}
+
+bool Substitution::sanityCheck(bool incomplete) const {
+  if (base == Id::invalid()) {
+    if (!items.empty()) {
+      LOG(ERROR) << "substitution with base 0 and size " << items.size();
+      return false;
+    }
+  } else {
+    if (base < Id::lowest()) {
+      LOG(ERROR) << "substitution with base " << base.toWord();
+      return false;
+    }
+    for (auto id : items) {
+      if (id < Id::lowest() && !(incomplete && !id)) {
+        LOG(ERROR) << "substitution with invalid id " << id.toWord();
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/substitution.h b/glean/rts/substitution.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/substitution.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <boost/icl/interval_set.hpp>
+#include <glog/logging.h>
+#include <vector>
+
+#include "glean/rts/id.h"
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+template <typename T>
+using closed_interval_set =
+    boost::icl::interval_set<T, std::less, boost::icl::closed_interval<T>>;
+
+/**
+ * Substitutions for blocks of consecutive Ids.
+ *
+ * A substitution implements a mapping Id -> Id for its range from
+ * start() up to but not including finish(). Ids outside of this range are
+ * mapped to themselves.
+ *
+ */
+struct Substitution {
+ public:
+  Substitution(Id first, size_t size);
+
+  Substitution(Id first, std::vector<Id> ids);
+
+  ~Substitution() = default;
+
+  Id subst(Id id) const {
+    return id >= start() && id < finish() ? items[distance(start(), id)] : id;
+  }
+
+  // Apply the Substitution to a set of fact ID ranges.
+  //
+  // Input/output: a list of ranges, [x1,x2, y1,y2, ...]
+  //
+  // The input doesn't need to be sorted or non-overlapping, but the
+  // output will be non-overlapping and sorted in ascending order.
+  //
+  // It is an error if a range extends beyond finish(); that is, the
+  // ranges can only cover Ids included in the substitution and below.
+  std::vector<Id> substIntervals(const std::vector<Id>& intervals) const;
+
+  // This is just like substIntervals but returns a boost::icl::interval_set<Id>
+  // instead of a std::vector<Id>.
+  closed_interval_set<Id> substIntervals(
+      const closed_interval_set<Id>& intervals) const;
+
+  Id start() const {
+    return base;
+  }
+
+  Id finish() const {
+    return base + items.size();
+  }
+
+  Id firstFreeId() const;
+
+  static Substitution compose(
+      const Substitution& first,
+      const Substitution& second);
+
+  bool operator==(const Substitution& other) const {
+    return base == other.base && items == other.items;
+  }
+
+  bool operator!=(const Substitution& other) const {
+    return !(*this == other);
+  }
+
+  void with(const std::function<void(Id base, const std::vector<Id>& items)>&
+                fun) const {
+    fun(base, items);
+  }
+
+  bool sanityCheck(bool incomplete) const;
+
+ private:
+  Id base;
+  std::vector<Id> items;
+  mutable Id firstFreeId_ = Id::invalid(); // lazy cached firstFreeId()
+  friend class MutableSubstitution;
+};
+
+class MutableSubstitution {
+ public:
+  MutableSubstitution(Id first, size_t size) : subst_(first, size) {}
+  MutableSubstitution(Id first, std::vector<Id> ids)
+      : subst_(first, std::move(ids)) {}
+
+  void set(Id pos, Id id) {
+    CHECK(pos >= subst_.start() && pos < subst_.finish());
+    subst_.items[distance(subst_.start(), pos)] = id;
+  }
+
+  void setAt(size_t index, Id id) {
+    subst_.items[index] = id;
+  }
+
+  Id subst(Id id) const {
+    return subst_.subst(id);
+  }
+
+  Substitution freeze() {
+    return std::move(subst_);
+  }
+
+ private:
+  Substitution subst_;
+};
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/tests/BinaryTest.cpp b/glean/rts/tests/BinaryTest.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/tests/BinaryTest.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/binary.h"
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+#include <string>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+void roundtripString(const std::string& s) {
+  binary::Output original;
+  original.mangleString(binary::byteRange(s));
+  binary::Input inp(original.bytes());
+  binary::Output demangled;
+  inp.demangleUntrustedString(demangled);
+  CHECK_EQ(s, binary::mkString(demangled.bytes()));
+}
+
+} // namespace
+
+using namespace std::string_literals;
+
+TEST(BinaryTest, utf8String) {
+  roundtripString(""s);
+  roundtripString("abcd"s);
+  roundtripString("\0"s);
+  roundtripString("abc\0def"s);
+  roundtripString("abc\0\0");
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/tests/LookupInvariants.cpp b/glean/rts/tests/LookupInvariants.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/tests/LookupInvariants.cpp
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#ifdef OSS
+#include <cpp/wrap.h> // @manual
+#else
+#include <common/hs/util/cpp/wrap.h>
+#endif
+#include "glean/rts/fact.h"
+#include "glean/rts/lookup.h"
+
+#include <ostream>
+
+using namespace facebook::hs;
+using namespace facebook::glean;
+using namespace facebook::glean::rts;
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+std::ostream& operator<<(std::ostream& os, Id id) {
+  return os << '{' << id.toWord() << '}';
+}
+
+std::ostream& operator<<(std::ostream& os, Pid id) {
+  return os << '{' << id.toWord() << '}';
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
+
+namespace {
+
+void checkLookupInvariants(Lookup& lookup) {
+  const auto start = lookup.startingId();
+  const auto finish = lookup.firstFreeId();
+
+  std::vector<Fact::unique_ptr> facts(finish - start);
+  std::map<Pid, std::map<folly::ByteRange, std::pair<Id, folly::ByteRange>>>
+      keys;
+
+  /***********************************************************************
+   * load all facts
+   ***********************************************************************/
+  Id expected_id = start;
+  for (auto i = lookup.enumerate(); auto ref = i->get(); i->next()) {
+    CHECK_GE(ref.id, start);
+    CHECK_LT(ref.id, finish);
+    // NOTE: This assumes it's a dense fact set
+    CHECK_EQ(ref.id, expected_id);
+    ++expected_id;
+
+    auto fact = Fact::create(ref);
+
+    auto [_, added] =
+        keys[fact->type()].insert({fact->key(), {fact->id(), fact->value()}});
+    CHECK(added);
+
+    facts[ref.id - start] = std::move(fact);
+  }
+  // NOTE: This assumes it's a dense fact set
+  CHECK_EQ(expected_id, finish);
+
+  /***********************************************************************
+   * typeById and factById
+   ***********************************************************************/
+  for (const auto& fact : facts) {
+    const auto ty = lookup.typeById(fact->id());
+    CHECK_EQ(ty, fact->type());
+
+    const auto found = lookup.factById(fact->id(), [&](auto ty, auto clause) {
+      CHECK_EQ(ty, fact->type());
+      CHECK_EQ(clause.key().str(), fact->key().str());
+      CHECK_EQ(clause.value().str(), fact->value().str());
+    });
+    CHECK(found);
+  }
+
+  /***********************************************************************
+   * facts outside of the range don't exist
+   ***********************************************************************/
+  CHECK_EQ(lookup.typeById(start - 1), Pid::invalid());
+  CHECK(!lookup.factById(start - 1, [](auto, auto) {}));
+  CHECK_EQ(lookup.typeById(finish), Pid::invalid());
+  CHECK(!lookup.factById(finish, [](auto, auto) {}));
+
+  /***********************************************************************
+   * idByKey
+   ***********************************************************************/
+  for (const auto& p : keys) {
+    for (const auto& q : p.second) {
+      const auto id = lookup.idByKey(p.first, q.first);
+      CHECK_EQ(id, q.second.first);
+    }
+  }
+
+  /***********************************************************************
+   * enumerate
+   ***********************************************************************/
+  for (auto id = start; id < finish; ++id) {
+    CHECK_EQ(lookup.enumerate(id)->get().id, id);
+  }
+  CHECK_EQ(lookup.enumerate(start - 1)->get().id, start);
+  CHECK_EQ(lookup.enumerate(finish)->get().id, Id::invalid());
+  CHECK_EQ(lookup.enumerate(finish + 1)->get().id, Id::invalid());
+
+  for (auto id = start + 1; id < finish; ++id) {
+    CHECK_EQ(lookup.enumerate(Id::invalid(), id)->get().id, start);
+  }
+  CHECK_EQ(lookup.enumerate(Id::invalid(), start)->get().id, Id::invalid());
+
+  for (auto id = start; id < finish - 2; ++id) {
+    auto iter = lookup.enumerate(id, id + 2);
+    CHECK_EQ(iter->get().id, id);
+    iter->next();
+    CHECK_EQ(iter->get().id, id + 1);
+    iter->next();
+    CHECK_EQ(iter->get().id, Id::invalid());
+  }
+
+  // check that calling next without calling get beforehand works
+  for (auto id = start; id < finish - 3; ++id) {
+    auto iter = lookup.enumerate(id, id + 3);
+    iter->next();
+    CHECK_EQ(iter->get().id, id + 1);
+    iter->next();
+    iter->next();
+    CHECK_EQ(iter->get().id, Id::invalid());
+  }
+
+  /***********************************************************************
+   * enumerateBack
+   ***********************************************************************/
+  expected_id = finish;
+  for (auto iter = lookup.enumerateBack(); auto ref = iter->get();
+       iter->next()) {
+    // NOTE: This assumes it's a dense fact set
+    CHECK_EQ(ref.id, expected_id - 1);
+    CHECK_GE(ref.id, start);
+    --expected_id;
+  }
+  // NOTE: This assumes it's a dense fact set
+  CHECK_EQ(expected_id, start);
+
+  CHECK_EQ(lookup.enumerateBack(finish)->get().id, finish - 1);
+  CHECK_EQ(lookup.enumerateBack(start)->get().id, Id::invalid());
+
+  for (auto id = start; id < finish; ++id) {
+    CHECK_EQ(lookup.enumerateBack(Id::invalid(), id)->get().id, finish - 1);
+  }
+  CHECK_EQ(
+      lookup.enumerateBack(Id::invalid(), finish)->get().id, Id::invalid());
+
+  for (auto id = start; id < finish - 1; ++id) {
+    auto iter = lookup.enumerateBack(id + 2, id);
+    CHECK_EQ(iter->get().id, id + 1);
+    iter->next();
+    CHECK_EQ(iter->get().id, id);
+    iter->next();
+    CHECK_EQ(iter->get().id, Id::invalid());
+  }
+
+  // check that calling next without calling get beforehand works
+  for (auto id = start; id < finish - 3; ++id) {
+    auto iter = lookup.enumerateBack(id + 3, id);
+    iter->next();
+    CHECK_EQ(iter->get().id, id + 1);
+    iter->next();
+    iter->next();
+    CHECK_EQ(iter->get().id, Id::invalid());
+  }
+
+  /***********************************************************************
+   * seek
+   ***********************************************************************/
+  for (const auto& p : keys) {
+    const auto type = p.first;
+    auto s = p.second.begin();
+    const auto e = p.second.end();
+    for (auto iter = lookup.seek(type, {}, 0); auto ref = iter->get();
+         iter->next()) {
+      CHECK(s != e);
+      CHECK_EQ(ref.type, type);
+      CHECK_EQ(ref.id, s->second.first);
+      CHECK_EQ(ref.key().str(), s->first.str());
+      CHECK_EQ(ref.value().str(), s->second.second.str());
+      // check that resuming seeks works
+      CHECK_EQ(lookup.seek(type, ref.key(), 0)->get().id, ref.id);
+      ++s;
+    }
+    CHECK(s == e);
+  }
+
+  // TODO: prefix seeks
+}
+
+extern "C" {
+const char* glean_check_lookup_invariants(Lookup* lookup) {
+  return ffi::wrap([=] { checkLookupInvariants(*lookup); });
+}
+}
+
+} // namespace
diff --git a/glean/rts/tests/arbitrary.h b/glean/rts/tests/arbitrary.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/tests/arbitrary.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/id.h"
+
+#include <rapidcheck.h>
+#include <iostream>
+
+namespace rc {
+
+template <typename T>
+struct Arbitrary<facebook::glean::rts::WordId<T>> {
+  static Gen<facebook::glean::rts::WordId<T>> arbitrary() {
+    return gen::map(
+        gen::inRange(
+            facebook::glean::rts::WordId<T>::lowest().toWord(),
+            typename facebook::glean::rts::WordId<T>::word_type(0xFFFF)),
+        facebook::glean::rts::WordId<T>::fromWord);
+  }
+};
+
+} // namespace rc
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+template <typename T>
+std::ostream& operator<<(std::ostream& out, WordId<T> id) {
+  return out << '$' << id.toWord();
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/tests/uniform.h b/glean/rts/tests/uniform.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/tests/uniform.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+#include <cstdint>
+
+constexpr uint64_t uniform64(uint64_t x) {
+  return x * 11400714819323198485lu;
+}
+
+constexpr uint64_t uniform28(uint64_t x) {
+  return uniform64(x) & 0x0FFFFFFF;
+}
+
+constexpr uint64_t uniform14(uint64_t x) {
+  return uniform64(x) & 0x3FFF;
+}
+
+constexpr uint64_t uniform7(uint64_t x) {
+  return uniform64(x) & 0x7F;
+}
diff --git a/glean/rts/thrift.cpp b/glean/rts/thrift.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/thrift.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/thrift.h"
+
+#include <folly/Varint.h>
+
+extern "C" {
+
+size_t glean_thrift_encode_zigzag(int64_t value, uint8_t* buffer) {
+  return folly::encodeVarint(folly::encodeZigZag(value), buffer);
+}
+
+size_t glean_thrift_encode_varint(uint64_t value, uint8_t* buffer) {
+  return folly::encodeVarint(value, buffer);
+}
+}
diff --git a/glean/rts/thrift.h b/glean/rts/thrift.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/thrift.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+size_t glean_thrift_encode_zigzag(int64_t value, uint8_t* buffer);
+size_t glean_thrift_encode_varint(uint64_t value, uint8_t* buffer);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/glean/rts/timer.cpp b/glean/rts/timer.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/timer.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/timer.h"
+
+namespace facebook::glean::rts {
+
+void TimerLogger::operator()(
+    folly::StringPiece msg,
+    const std::chrono::duration<double>& sec) const {
+  VLOG(1) << msg << " in "
+          << prettyPrint(sec.count(), folly::PrettyType::PRETTY_TIME);
+}
+
+folly::AutoTimer<TimerLogger> makeAutoTimer(std::string&& msg) {
+  return folly::makeAutoTimer<TimerLogger>(std::move(msg));
+}
+
+} // namespace facebook::glean::rts
diff --git a/glean/rts/timer.h b/glean/rts/timer.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/timer.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include <folly/logging/AutoTimer.h>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct TimerLogger {
+  void operator()(
+      folly::StringPiece msg,
+      const std::chrono::duration<double>& sec) const;
+};
+
+folly::AutoTimer<TimerLogger> makeAutoTimer(std::string&& msg);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/validate.cpp b/glean/rts/validate.cpp
new file mode 100644
--- /dev/null
+++ b/glean/rts/validate.cpp
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#include "glean/rts/validate.h"
+#include "glean/rts/binary.h"
+
+#include <future>
+#include <mutex>
+#include <vector>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+namespace {
+
+struct Fail {
+  std::atomic<bool> has_err = false;
+
+  template <class... Args>
+  void operator()(std::string fmt, Args&&... args) {
+    has_err.store(true);
+    rts::error(fmt, std::forward<Args>(args)...);
+  }
+
+  operator bool() {
+    return has_err.load();
+  }
+};
+
+} // namespace
+
+std::string predicateRefName(const Inventory& inventory, Pid type) {
+  const Predicate* pred = inventory.lookupPredicate(type);
+  if (pred == nullptr) {
+    return "invalid Pid";
+  } else {
+    return pred->name + "." + std::to_string(pred->version);
+  }
+}
+
+// Validates facts from startingId until firstFreeId until all items have been
+// validated or the validation limit is reached.
+void validate(const Inventory& inventory, const Validate& val, Lookup& facts) {
+  const auto starting_id = facts.startingId();
+  const auto first_free = facts.firstFreeId();
+
+  const auto end_id = val.limit < first_free - starting_id
+      ? starting_id + val.limit
+      : first_free;
+  size_t elems = distance(starting_id, end_id);
+
+  size_t max_shard_size = 10000;
+  size_t lock_shard_size = std::min(elems, max_shard_size);
+  std::vector<std::mutex> locks((elems / lock_shard_size) + 1);
+  std::vector<Pid> types(elems, Pid::invalid());
+
+  Fail fail;
+
+  // thread-safe type cache check
+  auto expect_type = Predicate::Rename([&](Id id, Pid type) {
+    if (id < starting_id || id >= end_id) {
+      fail("id {} out of range, expecting id of type {}", id, type);
+    }
+    auto ix = distance(starting_id, id);
+    size_t lock_ix = ix / lock_shard_size;
+    const std::lock_guard<std::mutex> lock(locks.at(lock_ix));
+
+    if (types.at(ix) == Pid::invalid()) {
+      types[ix] = type;
+    }
+
+    auto real_type = types.at(ix);
+    if (type != real_type) {
+      fail(
+          "fact type mismatch. Expected {} to be of type {} (Pid {}) but got {} (Pid {}).",
+          id,
+          predicateRefName(inventory, type),
+          type,
+          predicateRefName(inventory, real_type),
+          real_type);
+    }
+    return id;
+  });
+
+  std::atomic<size_t> count = 0;
+
+  size_t last_percent = 0;
+  std::mutex percent_lock;
+  auto report_progress([&]() {
+    const std::lock_guard<std::mutex> lock(percent_lock);
+    size_t percent = (100 * count.load()) / elems;
+    if (percent != last_percent) {
+      last_percent = percent;
+      VLOG(1) << percent << "%";
+    }
+  });
+
+  auto validate_section([&](Id from, Id to) {
+    auto allowed_id = from;
+
+    for (auto i = facts.enumerate(from, to); auto fact = i->get(); i->next()) {
+      if (fail) {
+        break;
+      }
+      ++count;
+
+      VLOG(3) << "[" << fact.id.toWord() << "]";
+
+      if (fact.id < allowed_id) {
+        fail("enumeration out of order");
+      }
+      if (fact.id >= end_id) {
+        fail("fact id out of bounds");
+      }
+
+      if (val.typecheck) {
+        const auto* predicate = inventory.lookupPredicate(fact.type);
+        if (predicate == nullptr) {
+          fail("invalid predicate");
+        }
+
+        binary::Output out;
+        uint64_t key_size;
+
+        auto rename = Predicate::Rename(expect_type);
+        predicate->typecheck(rename, fact.clause, out, key_size);
+
+        if (fact.clause.bytes() != out.bytes()) {
+          fail("invalid fact");
+        }
+        if (fact.clause.key_size != key_size) {
+          fail("key size mismatch");
+        }
+      }
+
+      if (val.keys && facts.idByKey(fact.type, fact.key()) != fact.id) {
+        fail("idByKey mismatch");
+      }
+
+      allowed_id = fact.id + 1;
+
+      expect_type.rename(fact.id, fact.type);
+    }
+  });
+
+  const auto max_parallel = 10;
+  size_t min_ids_per_section = 100000;
+  auto ids_per_section = std::min(min_ids_per_section, elems / max_parallel);
+  std::atomic<int> section_no = 0;
+  auto get_next_section_starting_id([&]() {
+    int section = section_no++;
+    return starting_id + section * ids_per_section;
+  });
+
+  // validate multiple sections
+  auto worker([&]() {
+    while (true) {
+      Id from = get_next_section_starting_id();
+      Id to = std::min(from + ids_per_section, end_id);
+      VLOG(2) << "worker: " << from.toWord() << "-" << to.toWord();
+
+      if (from >= end_id || fail) {
+        break;
+      }
+
+      validate_section(from, to);
+      report_progress();
+    }
+  });
+
+  std::vector<std::future<void>> workers(max_parallel);
+  // start workers
+  for (auto i = 0; i < max_parallel; i++) {
+    workers[i] = std::async(worker);
+  }
+
+  for (auto& w : workers) {
+    w.get();
+  }
+}
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/rts/validate.h b/glean/rts/validate.h
new file mode 100644
--- /dev/null
+++ b/glean/rts/validate.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+#pragma once
+
+#include "glean/rts/inventory.h"
+#include "glean/rts/lookup.h"
+
+#include <limits>
+
+namespace facebook {
+namespace glean {
+namespace rts {
+
+struct Validate {
+  bool typecheck = true;
+  bool keys = true;
+  size_t limit = std::numeric_limits<size_t>::max();
+};
+
+void validate(const Inventory& inventory, const Validate& val, Lookup& facts);
+
+} // namespace rts
+} // namespace glean
+} // namespace facebook
diff --git a/glean/schema/gen/Glean/Schema/Gen/Cpp.hs b/glean/schema/gen/Glean/Schema/Gen/Cpp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Cpp.hs
@@ -0,0 +1,553 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Generate C++ client types from the Glean schema
+
+{-# LANGUAGE OverloadedStrings #-}
+module Glean.Schema.Gen.Cpp
+  ( genSchemaCpp
+  ) where
+
+import Control.Monad
+import Control.Monad.Reader
+import Control.Monad.State
+import Data.List (intercalate)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import TextShow
+
+import Glean.Schema.Gen.Utils hiding (pushDefs, popDefs)
+import Glean.Angle.Types hiding (schemaName)
+import Glean.Schema.Types
+import Glean.Types (SchemaId(..))
+
+
+genSchemaCpp
+  :: SchemaId
+  -> Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath,Text)]
+genSchemaCpp hash version preddefs typedefs _ =
+  [("", leading <> newline <> newline <> body)]
+  where
+    namePolicy = mkNamePolicy preddefs typedefs
+    someDecls = map PredicateDecl preddefs ++
+      map (\TypeDef{..} -> TypeDecl typeDefRef typeDefType) typedefs
+    ordered = orderDecls someDecls
+    ((ds,schema), extra) = runM [] namePolicy typedefs $ do
+      ds <- mapM genDecl ordered
+      sc <- defineSchema ordered hash
+      return (ds, sc)
+    decls = concat ds ++ reverse extra
+    pieces = withNS $
+      [(schemaNamespace, "constexpr int version = " <> showt version <> ";")]
+      ++ forwardDeclare decls
+      ++ [(schemaNamespace, schema)]
+
+    body = Text.intercalate (newline <> newline) pieces
+
+-- Check against hardcoded list of what glean.h provides
+provided :: (NameSpaces, Text) -> Maybe ResolvedType
+provided (_,ident) = Map.lookup ident known
+  where known = Map.fromList [("Unit", unitT)]
+
+leading :: Text
+leading = Text.unlines
+  ["#pragma once"
+  ,"// \x40generated"
+  ,"// Glean.Schema.Gen.Cpp definitions for fbcode/glean/lang/clang/schema.h"
+  ,"// by //glean/hs:predicates using --cpp"
+  ,""
+  ,"#include <tuple>"
+  ,"#include <boost/variant.hpp>"
+  ,"#include \"glean/cpp/glean.h\""
+  ,""
+  ]
+
+forwardDeclare
+  :: [(NameSpaces, (Text,Text))]
+  -> [(NameSpaces, Text)]
+forwardDeclare xs =
+  declarations xs
+  ++ definitions xs
+  where
+    declarations = filter (not . Text.null . snd) . map (fmap fst)
+    definitions = map (fmap snd)
+
+defineSchema :: [SomeDecl] -> SchemaId -> CppGen Text
+defineSchema ds hash = do
+  let preds = [ p | PredicateDecl p <- ds ]
+  pnames <- forM preds $ \PredicateDef{..} -> do
+    cppNameIn schemaNamespace . schemaName <$> predicateName predicateDefRef
+  return $ Text.unlines $ concat
+    [ ["struct SCHEMA {"]
+    , indentLines [
+        "template<typename P> struct index;",
+        "static constexpr size_t count = "
+          <> Text.pack (show $ length pnames)
+          <> ";",
+        "static constexpr char schemaId[] = \"" <> unSchemaId hash <> "\";",
+        "template<size_t i> struct predicate;"
+      ]
+    , ["};"]
+    , [""]
+    {-
+       we would like to do:
+
+         struct SCHEMA {
+           template<typename P> struct index;
+
+           template<> struct index<Predicate> { ... }
+         }
+
+       but declaring a template specialisation inside a struct is
+       not currently supported by gcc, see
+          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282
+
+       so instead we declare the specialisation outside the struct:
+
+         template<> struct SCHEMA::index<Predicate> { ... }
+    -}
+    , ["template<> struct SCHEMA::index<"
+        <> p
+        <> "> { static constexpr size_t value = "
+        <> Text.pack (show i)
+        <> "; };" | (i,p) <- zip [0::Int ..] pnames]
+    , [""]
+    , ["template<> struct SCHEMA::predicate<"
+        <> Text.pack (show i)
+        <> "> { using type = "
+        <> p
+        <> "; };" | (i,p) <- zip [0::Int ..] pnames]
+    ]
+
+-- Insert all the namespace opening and closing around declaration regions
+withNS :: [(NameSpaces, Text)] -> [Text]
+withNS [] = []
+withNS (h@(start, _):t) = catMaybes (transNS [] start : addNS h t)
+  where addNS (end, x) [] = [ Just x, transNS end [] ]
+        addNS (ns, x) (h'@(ns', _): t') =
+          Just x : transNS ns ns' : addNS h' t'
+
+        transNS :: NameSpaces -> NameSpaces -> Maybe Text
+        transNS xs ys =
+          let common = length . takeWhile (True==) $ zipWith (==) xs ys
+              toClose = reverse (drop common xs)
+              toOpen = drop common ys
+              close t = "} // namespace " <> t
+              open t = "namespace " <> t <> " {"
+              pieces = map close toClose ++ map open toOpen
+          in if null pieces then Nothing
+              else Just $ Text.intercalate (newline <> newline) pieces
+
+withExtra
+  :: CppGen [(NameSpaces, (Text, Text))]
+  -> CppGen [(NameSpaces, (Text, Text))]
+withExtra act = do
+  most <- act
+  extra <- popDefs
+  return (extra ++ most)
+
+
+-- ----------------------------------------------------------------------------
+-- Naming & namespaces
+
+-- safety pass looking for bad characters, etc
+safe :: Text -> Text
+safe s
+  | s `elem` keywords = s <> "_"
+  | otherwise = s
+  where
+    keywords = [
+       "asm", "auto", "bool", "break", "case", "catch", "char", "class",
+       "const", "const_cast", "continue", "default", "delete", "do",
+       "double", "dynamic_cast", "else", "enum", "explicit", "export",
+       "extern", "false", "float", "for", "friend", "goto", "if",
+       "inline", "int", "long", "mutable", "namespace", "new", "operator",
+       "private", "protected", "public", "register", "reinterpret_cast",
+       "return", "short", "signed", "sizeof", "static", "static_cast",
+       "struct", "switch", "template", "this", "throw", "true", "try",
+       "typedef", "typeid", "typename", "union", "unsigned", "using",
+       "virtual", "void", "volatile", "wchar_t", "while",
+
+       -- avoid clashing with glean.h types
+       "Alt",
+       "Array",
+       "Bool",
+       "Byte",
+       "Enum",
+       "Maybe",
+       "Nat",
+       "Predicate",
+       "Repr",
+       "Sum",
+       "Tuple"
+     ]
+
+
+
+-- Upper-case the namespaces. We could change this.
+schemaName :: (NameSpaces,Text) -> (NameSpaces,Text)
+schemaName (spaces,ident) = (schemaNamespace ++ map cap1 spaces, ident)
+
+builtinName :: Text -> (NameSpaces,Text)
+builtinName name = (builtinNamespace, snd $ splitDot name)
+
+schemaNamespace :: NameSpaces
+schemaNamespace = ["facebook", "glean", "cpp", "schema"]
+
+-- The namespace within which we must declare Repr<T> specializations
+reprNamespace :: NameSpaces
+reprNamespace = builtinNamespace
+
+builtinNamespace :: NameSpaces
+builtinNamespace = ["facebook", "glean", "cpp"]
+
+cppIdent :: Text -> Text
+cppIdent = safe
+
+-- | Glue the cpp names together. We qualify everything except things in the
+-- same namespace. Here's why:
+--
+-- namespace foo {
+--   struct A {...};
+--   namespace bar {
+--     struct A {...};
+--     struct B { foo::A x; };
+--   }
+-- }
+--
+-- FIXME: What we're currently doing still isn't enough. Consider this:
+--
+-- namespace foo {
+--   struct A {...};
+--   namespace bar {
+--     namespace foo {
+--       struct A {...};
+--     }
+--     struct B { foo::A x; /* should have been ::foo::A */ };
+--   }
+-- }
+--
+-- So we need to fully qualify things but for that, we need to know which
+-- namespace(s) the generated code is wrapped in and we aren't threading that
+-- information at the moment.
+cppNameIn :: NameSpaces -> (NameSpaces, Text) -> Text
+cppNameIn here (ns, t)
+  | here == ns = cppIdent t
+  | otherwise = cppName (ns, t)
+  where
+    -- | Glue the cpp names together
+    cppName :: (NameSpaces, Text) -> Text
+    cppName (ns, t) = Text.intercalate "::" (map cppIdent (ns ++ [t]))
+
+
+-- ----------------------------------------------------------------------------
+-- Monad
+
+type CppGen a = ReaderT Env (State [(NameSpaces, (Text,Text))]) a
+
+pushDefs :: [(NameSpaces, (Text,Text))] -> CppGen ()
+pushDefs defs = modify (defs++)
+
+popDefs :: CppGen [(NameSpaces, (Text,Text))]
+popDefs = state $ \s -> (reverse s, [])
+
+-- ----------------------------------------------------------------------------
+-- Types
+
+-- | Generate a representation type
+reprTy :: NameSpaces -> ResolvedType -> CppGen Text
+reprTy here t = case t of
+  -- Leaves
+  ByteTy{} -> return "Byte" -- glean.h hardcoded here
+  NatTy{} -> return "Nat"   -- glean.h hardcoded here
+  BooleanTy{} -> return "Bool"
+  StringTy{} -> return "String"
+  -- Containers
+  ArrayTy ty -> do
+    rTy <- reprTy here ty
+    return $ "Array<" <> rTy <> ">"
+  RecordTy fields -> do
+    ts <- mapM (reprTy here . fieldDefType) fields
+    return $ "Tuple<" <> Text.intercalate ", " ts <> ">"
+  SumTy fields -> do
+    ts <- mapM (reprTy here . fieldDefType) fields
+    return $ "Sum<" <> Text.intercalate ", " ts <> ">"
+  SetTy ty -> do
+    rTy <- reprTy here ty
+    return $ "Set<" <> rTy <> ">"
+  MaybeTy ty -> do
+    rTy <- reprTy here ty
+    return $ "Maybe<" <> rTy <> ">"
+  -- References
+  PredicateTy _ pref -> do
+    name <- schemaName <$> predicateName pref
+    return (cppNameIn here name)
+  NamedTy _ tref -> do
+    name <- schemaName <$> typeName tref
+    if isJust (provided name)
+      then return $ cppNameIn here (builtinName (snd name))
+      else return $ "Repr<" <> cppNameIn here name <> ">"
+  EnumeratedTy elts -> return $ "Enum<" <> showt (length elts) <> ">"
+  TyVar{} -> error "reprTy: TyVar"
+  HasTy{} -> error "reprTy: HasTy"
+  HasKey{} -> error "reprTy: HasKey"
+  ElementsOf{} -> error "reprTy: ElementsOf"
+
+shareTypeDef :: NameSpaces -> ResolvedType -> CppGen Text
+shareTypeDef here t = do
+  (no, name) <- nameThisType t
+  case no of
+    Old -> return ()
+    New -> do
+      -- getting the namespace for the generated type right is a bit of a hack,
+      -- because we've already mangled the namespace that we're passing around.
+      let qname = joinDot (drop (length schemaNamespace) here, name)
+          tref = TypeRef qname 0
+      pushDefs =<< genDecl (TypeDecl tref t)
+  return name
+
+-- | Generate a value type
+valueTy :: NameSpaces -> ResolvedType -> CppGen Text
+valueTy here t = case t of
+  -- Leaves
+  ByteTy{} -> return "uint8_t" -- glean.h hardcoded here
+  NatTy{} -> return "uint64_t" -- glean.h hardcoded here
+  BooleanTy{} -> return "bool" -- glean.h hardcoded here
+  StringTy{} -> return "std::string"
+  -- Containers
+  ArrayTy ty -> do
+    vTy <- valueTy here ty
+    return $ "std::vector<" <> vTy <> ">"
+  RecordTy fields -> do
+    ts <- mapM (valueTy here . fieldDefType) fields
+    return $ "std::tuple<" <> Text.intercalate ", " ts <> ">"
+  SumTy fields -> do
+    ts <- mapM (valueTy here .fieldDefType) fields
+    return $ "boost::variant<" <> Text.intercalate ", " (altsOf ts) <> ">"
+  SetTy ty -> do
+    vTy <- valueTy here ty
+    return $ "std::set<" <> vTy <> ">"
+  MaybeTy ty ->
+    valueTy here $ SumTy
+      [ FieldDef "^Nothing^" unitT
+      , FieldDef "^Just^" ty ]
+  EnumeratedTy{} -> shareTypeDef here t
+  -- References, Fact is a phantom-typed Id
+  PredicateTy _ pref -> do
+    name <- schemaName <$> predicateName pref
+    return $ "Fact<" <> cppNameIn here name <> ">"
+  NamedTy _ tref -> do
+    name <- schemaName <$> typeName tref
+    case provided name of
+      Just ty -> valueTy here ty
+      Nothing -> return (cppNameIn here name)
+  TyVar{} -> error "valueTy: TyVar"
+  HasTy{} -> error "valueTy: HasTy"
+  HasKey{} -> error "valueTy: HasKey"
+  ElementsOf{} -> error "valueTy: ElementsOf"
+
+
+-- ----------------------------------------------------------------------------
+-- Definitions
+
+genDecl :: SomeDecl -> CppGen [(NameSpaces, (Text,Text))]
+genDecl (PredicateDecl PredicateDef{..}) = withExtra $ do
+  (spaces,name) <- schemaName <$> predicateName predicateDefRef
+  withPredicateDefHint name $ do
+  kTy <- valueTy spaces predicateDefKeyType
+  vTy <- valueTy spaces predicateDefValueType
+  let
+    ident = cppIdent name
+    value'
+      | predicateDefValueType == unitT = ""
+      | otherwise = ", " <> vTy
+    declare = "struct " <> ident <> ";"
+    define = myUnlines
+      [ "struct " <> ident <> " : Predicate<" <> kTy
+                                             <> value' <> "> {"
+      , "  static const char* GLEAN_name() {"
+      , "    return \"" <> predicateRef_name predicateDefRef <> "\";"
+      , "  }"
+      , ""
+      , "  static constexpr size_t GLEAN_version() {"
+      ,"     return " <> showt (predicateRef_version predicateDefRef) <> ";"
+      , "  }"
+      , "}; // struct " <> ident
+      ]
+  return [(spaces, (declare, define))]
+genDecl (TypeDecl tref ty) = withExtra $ do
+  name@(_,base) <- schemaName <$> typeName tref
+  withTypeDefHint base $ do
+  if isJust (provided name)
+    then return []
+    else do
+      case ty of
+        RecordTy fields -> recordDef name fields
+        SumTy fields -> unionDef name fields
+        EnumeratedTy vals -> enumDef name vals
+        _other -> aliasDef name ty
+
+
+aliasDef :: (NameSpaces,Text) -> ResolvedType -> CppGen [(NameSpaces, (Text, Text))]
+aliasDef name@(spaces,ident) aTy
+  | isJust (provided name) = return []
+  | otherwise = do
+  cppTy <- valueTy spaces aTy
+  let define = "using " <> ident <> " = " <> cppTy <> ";"
+  return [(spaces, ("", define))]
+
+mkAlt :: Int -> Text -> Text
+mkAlt i t = "Alt<" <> showt i <> ", " <> t <> ">"
+
+altsOf :: [Text] -> [Text]
+altsOf = zipWith mkAlt [0..]
+
+indentLines :: [Text] -> [Text]
+indentLines = map (\t -> if Text.null t then t else "  " <> t)
+
+relops :: Text -> [Text] -> [Text]
+relops name fields = concatMap relop ["==","!=","<","<=",">",">="]
+  where
+    relop op = concat
+      [ ["bool operator" <> op <> "(const " <> name <> "& other) const {"]
+      , indentLines
+          ["return " <> tie fields
+          ,"         " <> op <> " " <> tie (map ("other."<>) fields) <> ";"]
+      , ["}"] ]
+    tie xs = "std::tie(" <> Text.intercalate "," xs <> ")"
+
+mkReprDecl :: (NameSpaces,Text) -> ResolvedType -> CppGen (NameSpaces, (Text,Text))
+mkReprDecl name typ = do
+  rTy <- reprTy reprNamespace typ
+  let
+    decl = Text.unlines
+      [ "template<> struct Repr_<" <> cppNameIn reprNamespace name <> "> {"
+      , "  using Type = " <> rTy <> ";"
+      , "};"
+      ]
+  return (reprNamespace, ("", decl))
+
+recordDef
+  :: (NameSpaces, Text)
+  -> [ResolvedFieldDef]
+  -> CppGen [(NameSpaces, (Text, Text))]
+recordDef (spaces,name) fields = do
+  rDecl <- mkReprDecl (spaces,name) (RecordTy fields)
+  fieldTys <- mapM field fields
+  return [rDecl, (spaces, (declare, define fieldTys))]
+  where
+    ident = cppIdent name
+    field (FieldDef param t) = do
+      vTy <- withRecordFieldHint param $ valueTy spaces t
+      return $ vTy <> " " <> cppIdent param <> ";"
+    field_names = map (cppIdent . fieldDefName) fields
+    names = Text.intercalate ", " field_names
+    outputRepr =
+      [ "void outputRepr(Output<Repr<" <> ident <> ">> out) const {"
+      , "  outputValue(out, std::make_tuple(" <> names <> "));"
+      , "}"
+      ]
+    declare = "struct " <> ident <> ";"
+    define fieldTys = myUnlines $ concat
+      [ [ "struct " <> ident <> " {" ]
+      , indentLines $ concat
+          [ fieldTys
+          , [""]
+          , relops ident field_names
+          , outputRepr ]
+      , [ "}; // struct " <> ident ]
+      ]
+
+
+-- Would really prefer std::variant from later C++ standard
+unionDef
+  :: (NameSpaces,Text)
+  -> [ResolvedFieldDef]
+  -> CppGen [(NameSpaces, (Text, Text))]
+unionDef (spaces,name) fields = do
+  let
+    ident = cppIdent name
+
+    makeFieldTy (FieldDef param t) =
+      withUnionFieldHint param $ valueTy spaces t
+
+  theTypes <- mapM makeFieldTy fields
+  let
+    theTs = map fieldDefType fields
+    theAlts = altsOf theTypes :: [Text]
+    variant = "boost::variant<" <> Text.intercalate ", " theAlts <> ">"
+    field = variant <> " GLEAN_value;"
+
+    static_constructor (field, ty, altTy) = do
+      let
+        tuple fields = do
+          let
+            doField ty param = do
+              vTy <- valueTy spaces ty
+              return $ "const " <> vTy <> "& " <> cppIdent param
+          tys <- sequence [ doField ty param | FieldDef param ty <- fields ]
+          return
+            ( Text.intercalate ", " tys
+            , "std::make_tuple("
+                <> Text.intercalate ", " (map (cppIdent . fieldDefName) fields)
+                <> ")")
+      (args, ret) <- case ty of
+          -- special case, Unit is not a concrete type
+        NamedTy _ (TypeRef "builtin.Unit" _) -> tuple []
+        RecordTy fields -> tuple fields
+        _ -> do
+          vTy <- valueTy spaces ty
+          return ("const " <> vTy <> "& a", "a")
+      return
+        [ "static " <> ident <> " " <> field <> "(" <> args <> ") {"
+         , "  return " <> ident <> "{" <> altTy <> "(" <> ret <> ")};"
+         , "}"]
+
+    field_names = map (cppIdent . fieldDefName) fields
+
+  static_constructors <-
+    concat <$> mapM static_constructor (zip3 field_names theTs theAlts)
+  rDecl <- mkReprDecl (spaces,name) (SumTy fields)
+  let
+    outputRepr =
+      [ "void outputRepr(Output<Repr<" <> ident <> ">> out) const {"
+      , "  outputValue(out, GLEAN_value);"
+      , "}" ]
+
+    declare = "struct " <> ident <> ";"
+    define = myUnlines $ concat
+      [ [ "struct " <> ident <> " {" ]
+      , indentLines $ intercalate [""]
+          [ [field]
+          , static_constructors
+          , relops ident ["GLEAN_value"]
+          , outputRepr ]
+      , [ "}; // struct " <> ident ]
+      ]
+
+  return [ rDecl, (spaces, (declare, define)) ]
+
+
+enumDef
+  :: (NameSpaces,Text)
+  -> [Name]
+  -> CppGen [(NameSpaces, (Text, Text))]
+enumDef (spaces,name) eVals = do
+  rDecl <- mkReprDecl (spaces,name) (EnumeratedTy eVals)
+  return  [ rDecl, (spaces, (declare, define)) ]
+  where
+    ident = cppIdent name
+    declare = "enum class " <> ident <> ";"
+    define = "enum class " <> ident <> " { "
+      <> Text.intercalate ", " (map cppIdent eVals) <> " };"
diff --git a/glean/schema/gen/Glean/Schema/Gen/HackJson.hs b/glean/schema/gen/Glean/Schema/Gen/HackJson.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/HackJson.hs
@@ -0,0 +1,437 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+{-# LANGUAGE CPP #-}
+module Glean.Schema.Gen.HackJson
+  ( genSchemaHackJson
+  ) where
+
+import Control.Monad.Reader
+import Control.Monad.Writer.Strict
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Encode.Pretty as Aeson
+import qualified Data.Char as Char
+import Data.Graph
+import Data.Hashable
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Lazy as Text.Lazy
+import qualified Data.Text.Lazy.Builder as TextBuilder
+import GHC.Generics
+import Glean.Schema.Gen.Utils (Oncall)
+
+import Util.Text (textShow)
+
+import Glean.Angle.Types hiding (Struct, KeyValue)
+import Glean.Schema.Types
+
+data HackGenData = HackGenData
+  { generated :: Text
+  , namespace :: Text
+  , genTypes :: HashMap Text GenType
+  , enums :: HashMap Text [(Text, Text)]
+  } deriving (Generic)
+
+instance Aeson.ToJSON HackGenData where
+
+data GenType
+  = ClassType ClassGenType
+  | EnumType [Text]
+  | AliasType AngleTypeRepr
+  deriving (Generic)
+
+instance Aeson.ToJSON GenType where
+
+data ReferenceTag
+  = PredicateReference
+  | TypeReference
+  deriving (Generic,Eq)
+
+instance Hashable ReferenceTag where
+instance Aeson.ToJSON ReferenceTag where
+
+data VersionedReference
+  = Reference
+    { refTag :: ReferenceTag
+    , refName :: Text
+    , refVersion :: Version
+    , refLatest :: Bool
+    } deriving (Generic,Eq)
+
+instance Aeson.ToJSON VersionedReference where
+instance Hashable VersionedReference where
+
+data ClassGenType
+  = Struct ClassGenTypeData
+  | Union ClassGenTypeData
+  | Wrapper ClassGenTypeData
+  | KeyValue ClassGenTypeData
+  deriving (Generic)
+
+instance Aeson.ToJSON ClassGenType where
+
+data ClassGenTypeData = ClassGenTypeData
+  { classGenReference :: VersionedReference
+  , classGenHasCycles :: Bool
+  , classGenFieldInfos :: [FieldInfo]
+  } deriving (Generic)
+instance Aeson.ToJSON ClassGenTypeData where
+
+data FieldInfo = FieldInfo
+  { fieldInfoName :: Text
+  , fieldInfoType :: AngleTypeRepr
+  } deriving (Generic)
+
+instance Aeson.ToJSON FieldInfo where
+
+data Context = Context
+  { contextCycles :: HashMap VersionedReference Bool
+  , contextPredMap :: HashMap PredicateRef ResolvedPredicateDef
+  , contextTypeMap :: HashMap TypeRef ResolvedTypeDef
+  , contextPredLatest :: HashMap Text Version
+  , contextTypeLatest :: HashMap Text Version
+  }
+
+type HackEnum = (Text, [(Text, Text)])
+
+genSchemaHackJson
+  :: Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath,Text)]
+genSchemaHackJson _version preddefs typedefs _ = HashMap.toList files
+  where
+    predMap = HashMap.fromList $ map (\p -> (predicateDefRef p, p)) preddefs
+    typeMap = HashMap.fromList $ map (\t -> (typeDefRef t, t)) typedefs
+    predLatest = HashMap.fromListWith max $
+      flip map preddefs $
+        \PredicateDef{predicateDefRef=PredicateRef{..}} ->
+          (predicateRef_name , predicateRef_version)
+    typeLatest = HashMap.fromListWith max $
+      flip map typedefs $
+        \TypeDef{typeDefRef=TypeRef{..}} ->
+          (typeRef_name, typeRef_version)
+    cyclesMap = HashMap.fromList $ cyclesInDefs ctx allDefs
+    ctx = Context
+      { contextCycles = cyclesMap
+      , contextPredMap = predMap
+      , contextTypeMap = typeMap
+      , contextPredLatest = predLatest
+      , contextTypeLatest = typeLatest
+      }
+    allDefs = (++)
+      [Left preddef | preddef <- preddefs ]
+      [Right typedef | typedef <- typedefs ]
+    fileDefs = HashMap.fromListWith (++) $
+      map (\def -> (defFile def, [def])) allDefs
+    files = HashMap.mapWithKey f fileDefs
+    f file defs = Text.Lazy.toStrict $ TextBuilder.toLazyText $
+      Aeson.encodePrettyToTextBuilder genData
+      where
+        (genTypes, enums) = runWriter $ mapM (genTypeOfDef ctx) defs
+        genData = HackGenData
+          { generated = generatedMessage
+          , namespace = namespaceFor file
+          , genTypes = HashMap.fromList genTypes
+          , enums = HashMap.fromList enums
+          }
+    generatedMessage =
+      "\0064generated" <>
+        " - To regenerate this file run fbcode//glean/schema/gen/sync-www"
+
+genTypeOfDef
+  :: Context
+  -> Either ResolvedPredicateDef ResolvedTypeDef
+  -> Writer [HackEnum] (Text, GenType)
+genTypeOfDef ctx def@(Left PredicateDef{..}) = (,) (refClassname ref) <$>
+  case (predicateDefKeyType, predicateDefValueType) of
+    (RecordTy fields, RecordTy[]) -> ClassType . Struct . ClassGenTypeData
+      ref cycles <$> mapM (fieldInfoFor (refClassname ref) ctx) fields
+    (SumTy fields, RecordTy[]) -> ClassType . Union . ClassGenTypeData
+      ref cycles <$> mapM (fieldInfoFor (refClassname ref) ctx) fields
+    (ty, RecordTy[]) -> ClassType . Wrapper . ClassGenTypeData
+      ref cycles <$> mapM (fieldInfoFor (refClassname ref) ctx)
+        [FieldDef "key" ty]
+    (tyKey, tyValue) -> ClassType . KeyValue . ClassGenTypeData
+      ref cycles <$> mapM (fieldInfoFor (refClassname ref) ctx)
+        [FieldDef "key" tyKey, FieldDef "value" tyValue]
+  where
+    ref = defRef ctx def
+    cycles = HashMap.lookupDefault True ref $ contextCycles ctx
+genTypeOfDef ctx def@(Right TypeDef{..}) = (,) (refClassname ref) <$>
+  case typeDefType of
+    RecordTy fields ->
+      ClassType . Struct . ClassGenTypeData ref cycles <$>
+        mapM (fieldInfoFor (refClassname ref) ctx) fields
+    SumTy fields ->
+      ClassType . Union . ClassGenTypeData ref cycles <$>
+        mapM (fieldInfoFor (refClassname ref) ctx) fields
+    EnumeratedTy alts -> return $ EnumType alts
+    ty -> AliasType . fieldInfoType <$>
+      fieldInfoFor (refClassname ref) ctx (FieldDef "value" ty)
+  where
+    ref = defRef ctx def
+    cycles = HashMap.lookupDefault True ref $ contextCycles ctx
+
+fieldInfoFor
+  :: Text
+  -> Context
+  -> ResolvedFieldDef
+  -> Writer [HackEnum] FieldInfo
+fieldInfoFor className Context{..} FieldDef{..} = do
+  angleTypeRepr <- runReaderT (angleTypeReprFor fieldDefType) angleTypeReprCtx
+  return FieldInfo
+    { fieldInfoName = fieldDefName
+    , fieldInfoType = angleTypeRepr
+    }
+  where
+    angleTypeReprCtx = AngleTypeReprContext
+      { ctxClassName=className
+      , ctxFieldName=fieldDefName
+      , ctxPredMap=contextPredMap
+      , ctxTypeMap=contextTypeMap
+      , ctxPredLatest=contextPredLatest
+      , ctxTypeLatest=contextTypeLatest
+      }
+
+data AngleTypeReprContext = AngleTypeReprContext
+  { ctxClassName :: Text
+  , ctxFieldName :: Text
+  , ctxPredMap :: HashMap PredicateRef ResolvedPredicateDef
+  , ctxTypeMap :: HashMap TypeRef ResolvedTypeDef
+  , ctxPredLatest :: HashMap Text Version
+  , ctxTypeLatest :: HashMap Text Version
+  }
+
+-- There is not a simple relationship between the Angle type and
+-- what type is used to represent it in Hack. Both Bytes and Nats are
+-- represented as Ints. Predicates can be represented by both a Class
+-- and a primitive (for simple predicates). Most named types are stored
+-- as a class apart from Enumerations which get a Hack enum. This type
+-- contains information on both the Hack type and the Angle type
+data AngleTypeRepr
+  = ByteTInt
+  | NatTInt
+  | StringTString
+  | EnumeratedTEnum {alts::[Name], classname::Text}
+  | BooleanTBool
+  | ArrayTVec {inner::AngleTypeRepr}
+  | SetTVec {inner::AngleTypeRepr}
+  | RecordTShape {fields::[(Text, AngleTypeRepr)]}
+  | SumTShape {fields::[(Text, AngleTypeRepr)]}
+  | PredicateTKeyValue {pref::PredicateRef, classname::Text}
+  | PredicateTNamed {pref::PredicateRef, classname::Text}
+  | PredicateT {pref::PredicateRef, classname::Text, inner::AngleTypeRepr}
+  | NamedTypeTNamed {tref::TypeRef, classname::Text}
+  | NamedTypeTAlias {tref::TypeRef, classname::Text, inner::AngleTypeRepr}
+  | NamedTypeTEnum {alts::[Name], tref::TypeRef, classname::Text}
+  | MaybeTOption {inner::AngleTypeRepr}
+  deriving (Generic, Show)
+
+instance Aeson.ToJSON AngleTypeRepr where
+
+-- Generating a class for Angle types that hold an Enumeration requires
+-- creating a definition for that enum which is what the state holds
+angleTypeReprFor
+  :: ResolvedType
+  -> ReaderT AngleTypeReprContext (Writer [HackEnum]) AngleTypeRepr
+angleTypeReprFor (PredicateTy _ ref) = do
+  ctx <- ask
+  case lookupPredDefKeyValue ctx ref of
+    -- If the predicate has value of type {} and the key is a String
+    -- avoid wrapping it in a class. This makes writing queries more
+    -- concise
+    Just (StringTy, RecordTy []) ->
+      PredicateT ref (classname ctx) <$> angleTypeInnerReprFor StringTy
+    _ -> angleTypeInnerReprFor (PredicateTy () ref)
+    where
+      lookupPredDefKeyValue ctx pref = do
+        PredicateDef{..} <- HashMap.lookup pref $ ctxPredMap ctx
+        return (predicateDefKeyType, predicateDefValueType)
+      classname AngleTypeReprContext{..} =
+        refClassname $ prefVref ctxPredLatest ref
+angleTypeReprFor ty = angleTypeInnerReprFor ty
+
+angleTypeInnerReprFor
+  :: ResolvedType' s
+  -> ReaderT AngleTypeReprContext (Writer [HackEnum]) AngleTypeRepr
+angleTypeInnerReprFor ByteTy = return ByteTInt
+angleTypeInnerReprFor NatTy = return NatTInt
+angleTypeInnerReprFor StringTy = return StringTString
+angleTypeInnerReprFor (ArrayTy ty) = ArrayTVec <$> angleTypeInnerReprFor ty
+angleTypeInnerReprFor (RecordTy fields) =
+  RecordTShape <$> mapM f fields
+  where
+    f FieldDef{..} =
+      (,) fieldDefName <$> angleTypeInnerReprFor fieldDefType
+angleTypeInnerReprFor (SumTy fields) =
+  SumTShape <$> mapM f fields
+  where
+    f FieldDef{..} =
+      (,) fieldDefName <$> angleTypeInnerReprFor fieldDefType
+angleTypeInnerReprFor (SetTy ty) = SetTVec <$> angleTypeInnerReprFor ty
+angleTypeInnerReprFor (PredicateTy _ ref) = do
+  ctx <- ask
+  case lookupPredDefKeyValue ctx ref of
+    Nothing -> return $
+      PredicateTNamed ref $ classname ctx
+    Just (_k, RecordTy []) -> return $
+      PredicateTNamed ref $ classname ctx
+    Just (_k, _v) -> return $
+      PredicateTKeyValue ref $ classname ctx
+    where
+      lookupPredDefKeyValue ctx pref = do
+        PredicateDef{..} <- HashMap.lookup pref $ ctxPredMap ctx
+        return (predicateDefKeyType, predicateDefValueType)
+      classname AngleTypeReprContext{..} =
+        refClassname $ prefVref ctxPredLatest ref
+angleTypeInnerReprFor (NamedTy _ ref) = do
+  ctx <- ask
+  case lookupTypeDefType ctx ref of
+    Just (EnumeratedTy alts) ->
+      return $ NamedTypeTEnum alts ref $ classname ctx
+    Nothing -> return $ NamedTypeTNamed ref $ classname ctx
+    Just RecordTy{} -> return $ NamedTypeTNamed ref $ classname ctx
+    Just SumTy{} -> return $ NamedTypeTNamed ref $ classname ctx
+    Just t ->
+      NamedTypeTAlias ref (classname ctx) <$>
+        angleTypeInnerReprFor t
+  where
+    lookupTypeDefType ctx tref = typeDefType <$>
+      HashMap.lookup tref (ctxTypeMap ctx)
+    classname AngleTypeReprContext{..} =
+      refClassname $ trefVref ctxTypeLatest ref
+angleTypeInnerReprFor (MaybeTy t) = MaybeTOption <$> angleTypeInnerReprFor t
+angleTypeInnerReprFor (EnumeratedTy alts) = do
+  AngleTypeReprContext{..} <- ask
+  let
+    enumName =
+      ctxClassName <> "EnumFor_" <> ctxFieldName
+    enum = (enumName, map f alts)
+    f name = (name, name)
+  tell [enum]
+  return $ EnumeratedTEnum alts enumName
+angleTypeInnerReprFor BooleanTy = return BooleanTBool
+angleTypeInnerReprFor TyVar{} = error "angleTypeInnerReprFor: TyVar"
+angleTypeInnerReprFor HasTy{} = error "angleTypeInnerReprFor: HasTy"
+angleTypeInnerReprFor HasKey{} = error "angleTypeInnerReprFor: HasKey"
+angleTypeInnerReprFor ElementsOf{} = error "angleTypeInnerReprFor: ElementsOf"
+
+defFile :: Either ResolvedPredicateDef ResolvedTypeDef -> FilePath
+defFile (Left p) = fileFor $ predicateDefName p
+defFile (Right t) = fileFor $ typeDefName t
+
+refClassname :: VersionedReference -> Text
+refClassname Reference{..} | refLatest = "GS" <> hackCase refName
+refClassname Reference{..} =
+  "GS" <> hackCase refName <> "_DEPRECATED" <> textShow refVersion
+
+defRef
+  :: Context
+  -> Either ResolvedPredicateDef ResolvedTypeDef
+  -> VersionedReference
+defRef Context{..} (Left PredicateDef{..}) =
+  prefVref contextPredLatest predicateDefRef
+defRef Context{..} (Right TypeDef{..}) =
+  trefVref contextTypeLatest typeDefRef
+
+prefVref :: HashMap Text Version -> PredicateRef -> VersionedReference
+prefVref ctxPredLatest PredicateRef{..} = Reference
+  { refTag = PredicateReference
+  , refName = predicateRef_name
+  , refVersion = predicateRef_version
+  , refLatest =
+      HashMap.lookup predicateRef_name ctxPredLatest ==
+        Just predicateRef_version
+  }
+
+trefVref :: HashMap Text Version -> TypeRef -> VersionedReference
+trefVref ctxTypeLatest TypeRef{..} = Reference
+  { refTag = TypeReference
+  , refName = typeRef_name
+  , refVersion = typeRef_version
+  , refLatest =
+      HashMap.lookup typeRef_name ctxTypeLatest == Just typeRef_version
+  }
+
+predicateDefName :: ResolvedPredicateDef -> Text
+predicateDefName = predicateRef_name . predicateDefRef
+
+typeDefName :: ResolvedTypeDef -> Text
+typeDefName = typeRef_name . typeDefRef
+
+hackCase :: Text -> Text
+hackCase s =
+  Text.pack $ concatMap (pascalCase . Text.unpack) $ Text.splitOn "." s
+  where
+    pascalCase (x:xs) = Char.toUpper x : xs
+    pascalCase [] = []
+
+fileFor :: Text -> FilePath
+fileFor s = Text.unpack file <> ".json"
+  where file = Text.intercalate "-" $ init $ Text.splitOn "." s
+
+namespaceFor :: FilePath -> Text
+namespaceFor file = (<>) "GS" $
+  hackCase $
+  Text.intercalate "." $
+  Text.splitOn "-" $
+  Text.pack $
+  takeWhile ('.' /=) file
+
+-- What counts as a cycle here is Hack specific. We report anything that
+-- would cause a recursive shape to be generated (these are not allowed in Hack)
+cyclesInDefs
+  :: Context
+  -> [Either ResolvedPredicateDef ResolvedTypeDef]
+  -> [(VersionedReference, Bool)]
+cyclesInDefs ctx defs = concatMap hasCycles sccs
+ where
+  hasCycles (AcyclicSCC one) = [(defRef ctx one, False)]
+  hasCycles (CyclicSCC defs) = map (\def -> (defRef ctx def, True)) defs
+
+  sccs = stronglyConnComp
+    [ (def, defNode def, outEdges def) | def <- defs ]
+
+  defNode :: Either ResolvedPredicateDef ResolvedTypeDef -> (Name,Version)
+  defNode (Left PredicateDef{..}) =
+    (predicateRef_name predicateDefRef, predicateRef_version predicateDefRef)
+  defNode (Right TypeDef{..}) =
+    (typeRef_name typeDefRef, typeRef_version typeDefRef)
+
+  outEdges :: Either ResolvedPredicateDef ResolvedTypeDef -> [(Name,Version)]
+  outEdges d = case d of
+    Left PredicateDef{..} ->
+      outEdgesTs [predicateDefKeyType, predicateDefValueType]
+    Right TypeDef{..} ->
+      outEdgesT typeDefType
+
+  outEdgesTs = concatMap outEdgesT
+  outEdgesFields fields = outEdgesTs [ ty | FieldDef _ ty <- fields ]
+
+  outEdgesT :: ResolvedType -> [(Name,Version)]
+  outEdgesT ByteTy{} = []
+  outEdgesT NatTy{} = []
+  outEdgesT BooleanTy{} = []
+  outEdgesT StringTy{} = []
+  outEdgesT (ArrayTy ty) = outEdgesT ty
+  outEdgesT (MaybeTy ty) = outEdgesT ty
+  outEdgesT (RecordTy fields)  = outEdgesFields fields
+  outEdgesT (SumTy fields)  = outEdgesFields fields
+  outEdgesT (SetTy ty) = outEdgesT ty
+  outEdgesT (NamedTy _ (TypeRef name ver)) = [(name,ver)]
+  outEdgesT (PredicateTy _ (PredicateRef name ver)) = [(name,ver)]
+  outEdgesT EnumeratedTy{} = []
+  outEdgesT TyVar{} = error "outEdgesT: TyVar"
+  outEdgesT HasTy{} = error "outEdgesT: HasTy"
+  outEdgesT HasKey{} = error "outEdgesT: HasKey"
+  outEdgesT ElementsOf{} = error "outEdgesT: ElementsOf"
diff --git a/glean/schema/gen/Glean/Schema/Gen/Haskell.hs b/glean/schema/gen/Glean/Schema/Gen/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Haskell.hs
@@ -0,0 +1,531 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+-- | Generate "Glean.Schema"
+module Glean.Schema.Gen.Haskell
+  ( genSchemaHS
+  ) where
+
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import GHC.Stack (HasCallStack)
+import System.FilePath
+import TextShow
+
+import Glean.Schema.Gen.Utils
+import Glean.Angle.Types
+import Glean.Schema.Types
+
+genSchemaHS
+  :: Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath,Text)]
+genSchemaHS _version preddefs typedefs oncall =
+  ("hs" </> "TARGETS", genTargets declsPerNamespace oncall) :
+  [ ("thrift" </> Text.unpack (underscored namespaces) <> "_include" <.> "hs",
+      Text.intercalate (newline <> newline)
+        (header namespaces deps : doGen preds types))
+  | (namespaces, (deps, preds, types)) <- schemas
+  ] ++
+  [ ("hs" </> "Glean" </> "Schema" </>
+      Text.unpack (Text.concat (map cap1 namespaces)) <.> "hs",
+    genAllPredicates namespaces preds)
+  | (namespaces, (_deps, preds, _types)) <- schemas
+  ]
+  where
+    schemas = HashMap.toList declsPerNamespace
+    declsPerNamespace =
+      addNamespaceDependencies $ sortDeclsByNamespace preddefs typedefs
+
+    namePolicy = mkNamePolicy preddefs typedefs
+
+    doGen
+      :: [ResolvedPredicateDef]
+      -> [ResolvedTypeDef]
+      -> [Text]
+    doGen preds types = concat gen ++ reverse extra
+      where
+      (gen :: [[Text]], extra :: [Text]) = runM [] namePolicy typedefs $ do
+         ps <- mapM genPredicate preds
+         ts <- mapM (\TypeDef{..} -> genType typeDefRef typeDefType) types
+         return (ps ++ ts)
+
+genTargets
+  :: HashMap NameSpaces ([NameSpaces], [ResolvedPredicateDef], [ResolvedTypeDef])
+  -> Maybe Oncall
+  -> Text
+genTargets info oncall =
+  Text.unlines $
+     [ "# \x40generated"
+     , "# to regenerate: ./glean/schema/sync"
+     , "load(\"@fbcode_macros//build_defs:haskell_library.bzl\", " <>
+       "\"haskell_library\")"
+     , buckOncallAnnotation oncall
+     , "" ] ++
+     concatMap genTarget (HashMap.keys info)
+  where
+  genTarget ns =
+    let
+      namespace = underscored ns
+    in
+    -- mini Haskell library for the module containing allPredicates
+    [ "haskell_library("
+    , "  name = \"" <> namespace <> "\","
+    , "  srcs = [\"Glean/Schema/" <> Text.concat (map cap1 ns) <>
+        ".hs\"],"
+    , "  deps = [\"//glean/if:glean-hs2\"]"
+    , ")"
+    , ""
+    ]
+
+
+genAllPredicates
+  :: NameSpaces
+  -> [ResolvedPredicateDef]
+  -> Text
+genAllPredicates namespace preds = Text.unlines $
+  [ "-- @" <> "generated"
+  , "module Glean.Schema." <>
+    Text.concat (map cap1 namespace) <> " (allPredicates) where"
+  , ""
+  , "import Glean.Types"
+  , ""
+  , "allPredicates :: [PredicateRef]"
+  , "allPredicates ="
+  ] ++
+  indentLines (encsep "[ " ", " "]"
+    [ "(PredicateRef \"" <> predicateRef_name ref <> "\" " <>
+         showt (predicateRef_version ref) <> ")"
+    | pred <- preds
+    , let ref = predicateDefRef pred
+    ])
+  where
+    encsep start _ end [] = [start <> end]
+    encsep start mid end xs =
+      zipWith (<>) (start : repeat mid) xs ++ [end]
+
+header :: NameSpaces -> [NameSpaces] -> Text
+header here deps = Text.unlines $
+  [ "-- @" <> "generated"
+  , "{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}"
+  , "{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}"
+  , "{-# LANGUAGE UndecidableInstances #-}"
+    -- UndecidableInstances is needed for the RecordFields type instances
+  , "import qualified Data.ByteString"
+  , "import qualified Data.Default"
+  , "import qualified Data.Text"
+  , ""
+    -- we should use qualified imports as far as possible to avoid
+    -- clashing with Thrift-generated code
+  , "import qualified Glean.Types as Glean"
+  , "import qualified Glean.Typed as Glean"
+  , "import qualified Glean.Query.Angle as Angle"
+  , "import qualified Glean.Angle.Types as Angle"
+  , ""
+  ] ++
+  -- import dependencies
+  map importSchema deps ++
+  -- inject this instance into the Builtin schema, because there's no
+  -- other good place to put it.
+  (case here of
+    ["builtin"] ->
+      [ ""
+      , "type instance Angle.SumFields (Prelude.Maybe t) ="
+      , "  'Angle.TField \"nothing\" Unit ("
+      , "  'Angle.TField \"just\" t"
+      , "  'Angle.TNoFields)"
+      ]
+    _ -> [])
+
+
+importSchema :: NameSpaces -> Text
+importSchema ns =
+  "import qualified Glean.Schema." <> upperSquashNS <> ".Types"
+  where
+  upperSquashNS = Text.concat (map cap1 ns)
+
+
+-- Check against hardcoded list of what glean.h provides
+provided :: Text -> Bool
+provided = (`elem` known)
+  where known = []
+
+-- -----------------------------------------------------------------------------
+
+indent :: Text -> Text
+indent t = if Text.null t then t else "  " <> t
+
+indentLines :: [Text] -> [Text]
+indentLines = map indent
+
+-- | These names are for predicates/struct/union of Maybe-tree
+haskellTypeName :: (NameSpaces, Text) -> Text
+haskellTypeName (ns, x) = haskellThriftName (ns, cap1 x)
+
+fieldName :: (NameSpaces, Text) -> Text
+fieldName (ns, x) = haskellThriftName (ns, low1 x)
+
+-- | apply stupid and wrong heuristic
+paren :: Text -> Text
+paren inner =
+  let needsParen = Text.any (' ' ==) inner
+                   && (Text.take 1 inner `notElem` [ "(", "[" ])
+  in if needsParen then "(" <> inner <> ")"
+                   else inner
+
+-- | Slightly pretty breaking of long lines at "="
+(=@) :: Text -> Text -> Text
+(=@) lhs rhs = if Text.length lhs + Text.length rhs + 3 + 4 <= 80
+               then lhs <> " = " <> rhs
+               else let pre = Text.takeWhile (' '==) lhs
+                    in lhs <> " =\n  " <> pre <> indent rhs
+infixr 5 =@
+
+optionalize :: Text -> Text
+optionalize name =
+  let inner = fromMaybe name (Text.stripPrefix "inner " name)
+  in "Prelude.Maybe" <>! inner
+
+die :: HasCallStack => String -> String -> a
+die x y = error ("Error in genSchemaHS in " <> x <> " : " <> y)
+
+(<>!) :: Text -> Text -> Text
+(<>!) a b = a <> " " <> paren b
+
+infixr 6 <>!
+
+genericParamNames :: Text -> Int -> [Text]
+genericParamNames base n = map mk [1..n]
+  where mk i = base <> Text.pack (show i)
+
+localOrExternal :: NameSpaces -> Text -> (NameSpaces, Text)
+localOrExternal here name = if null ns then (here,x) else (ns,x)
+  where (ns,x) = splitDot name
+
+shareTypeDef :: Bool -> NameSpaces -> ResolvedType' s -> M Text
+shareTypeDef genSub here t = do
+  (no, name) <- nameThisType t
+  case no of
+    New | genSub -> do
+      let tref = TypeRef (joinDot (here,name)) 0
+      pushDefs =<< genType tref t
+    _otherwise -> return ()
+  return (haskellTypeName (localOrExternal here name))
+
+haskellTy :: NameSpaces -> ResolvedType' s -> M Text
+haskellTy = haskellTy_ PredName True
+
+-- | how to render predicate types in haskellTy
+data PredTy = PredName | PredKey
+
+haskellTy_
+  :: PredTy
+  -> Bool -- ^ generate nested type definitions
+  -> NameSpaces
+  -> ResolvedType' s
+  -> M Text
+haskellTy_ withId genSub here t = case t of
+  -- Leafs
+  ByteTy{} -> return "Glean.Byte"
+  NatTy{} -> return "Glean.Nat"
+  BooleanTy{} -> return "Prelude.Bool"
+  StringTy{} -> return "Data.Text.Text"
+  ArrayTy ByteTy -> return "Data.ByteString.ByteString"
+  ArrayTy tInner -> do
+    inner <- haskellTy_ PredName genSub here tInner
+    return $ "[" <> inner <> "]"
+  RecordTy{} -> shareTypeDef genSub here t
+  SumTy{} -> shareTypeDef genSub here t
+  SetTy tInner -> do
+    inner <- haskellTy_ PredName genSub here tInner
+    return $ "[" <> inner <> "]"
+  MaybeTy ty -> do
+    inner <- haskellTy_ PredName genSub here ty
+    return (optionalize inner)
+  -- References
+  PredicateTy _ pred -> do
+    let wrap = case withId of
+          PredName -> id
+          PredKey -> ("Glean.KeyType " <>)
+    wrap . haskellTypeName <$> predicateName pred
+
+  NamedTy _ typeRef ->
+    haskellTypeName <$> typeName typeRef
+  EnumeratedTy _ -> shareTypeDef genSub here t
+  TyVar{} -> error "haskellTy_: TyVar"
+  HasTy{} -> error "haskellTy_: HasTy"
+  HasKey{} -> error "haskellTy_: HasKey"
+  ElementsOf{} -> error "haskellTy_: ElementsOf"
+
+
+genPredicate :: ResolvedPredicateDef -> M [Text]
+genPredicate PredicateDef{..}
+  | provided (predicateRef_name predicateDefRef) = return []
+  | otherwise = do
+    pName <- predicateName predicateDefRef
+    let
+      here = fst pName
+      name = haskellTypeName pName -- e.g. Clang_File
+
+    withPredicateDefHint (snd pName) $ do
+    let
+      appendName suffix = let (ns, x) = pName in (ns, x <> suffix)
+      glean_name = predicateRef_name predicateDefRef -- e.g. clang.File
+      has_value = predicateDefValueType /= unitT
+      field_id = fieldName $ appendName "_id" -- field name for Id
+      name_key = appendName "_key" -- type of Key
+      name_value = appendName "_value" -- type of Value
+
+    (type_key, define_key) <-
+      if shouldNameKeyType predicateDefKeyType then
+        define_kt here predicateDefKeyType name_key
+      else do
+        ty <- haskellTy_ PredName True here predicateDefKeyType
+        return (ty, [])
+
+    (type_value, define_value) <-
+      if not has_value then return ("Unit", []) else do
+        define_kt here predicateDefValueType name_value
+
+    let extra = define_key ++ define_value
+    let ver = predicateRef_version predicateDefRef
+        inst cls body =
+          "instance " <> cls <> " " <> name <> " where"
+          : indentLines body
+        def_Predicate = inst "Glean.Predicate" $
+          ["type KeyType " <> name =@ type_key]
+          ++
+          ["type ValueType " <> name =@ type_value | has_value]
+          ++
+          [ "getName _proxy " =@ "Glean.PredicateRef " <>
+                Text.pack (show glean_name) <> -- adds quotes, does escaping
+                showt ver
+          , "getId = Glean.IdOf . Glean.Fid . " <> field_id
+          , "mkFact (Glean.IdOf (Glean.Fid x)) k "
+              <> (if has_value then "v" else "_")
+              <> " = " <> name <> " x k"
+              <> (if has_value then " v" else "")
+          , "getFactKey = " <> fieldName name_key
+          , if has_value
+              then "getFactValue = " <> fieldName name_value
+              else "getFactValue _ = Prelude.Just ()"
+          ]
+
+        def_Type = inst "Glean.Type"
+          [ "buildRtsValue b = Glean.buildRtsValue b . Glean.getId"
+          , "decodeRtsValue = Glean.decodeRef"
+          , "decodeAsFact = Glean.decodeFact"
+          , "sourceType = Glean.predicateSourceType"
+          ]
+
+    return $ extra ++ map myUnlines [def_Predicate, def_Type]
+
+
+-- Make the thriftTy type text, and the needed [Text] blocks
+define_kt
+  :: HasCallStack
+  => NameSpaces
+  -> ResolvedType
+  -> (NameSpaces, Text)
+  -> M (Text, [Text])
+define_kt here typ name_kt = case typ of
+  ByteTy{} -> leaf
+  NatTy{} -> leaf
+  StringTy{} -> leaf
+  RecordTy [] -> leaf
+  RecordTy _fields -> alias typ
+  ArrayTy{} -> alias typ
+  SetTy{} -> alias typ
+  SumTy [] -> leaf
+  SumTy _fields -> alias typ
+  MaybeTy{} -> alias typ
+  PredicateTy{} -> leaf
+  NamedTy{} -> alias typ
+  BooleanTy{} -> leaf
+  _other -> die "define_kt" (show typ)
+ where
+   gname = joinDot name_kt
+
+   leaf = (,) <$> return (haskellTypeName name_kt) <*> return []
+
+   alias t = do
+    ref <- haskellTy here (NamedTy () (TypeRef gname 0))
+    def <- genType (TypeRef gname 0) t
+    return (ref,def)
+
+genType :: TypeRef -> ResolvedType' s -> M [Text]
+genType TypeRef{..} ty
+  | provided typeRef_name = return []
+  | otherwise =
+  case ty of
+    RecordTy fields -> structDef typeRef_name typeRef_version fields
+    SumTy fields -> unionDef typeRef_name typeRef_version fields
+    EnumeratedTy vals -> enumDef typeRef_name typeRef_version vals
+    _ -> return []
+
+structDef :: Name -> Version -> [ResolvedFieldDef' s] -> M [Text]
+structDef ident ver fields = do
+  let typeRef = TypeRef ident ver
+  sName@(here,root) <- typeName typeRef
+  let name = haskellTypeName sName
+
+  withTypeDefHint root $ do
+  let
+    fieldParamNames = genericParamNames "x" (length fields)
+    makeTypeName (FieldDef p tField) =
+      withRecordFieldHint p (haskellTy_ PredKey True here tField)
+    spaced = Text.intercalate " " fieldParamNames
+    nameAndParams = if null fieldParamNames then name
+                    else name <> " " <> spaced
+    encodeMe = case length fields of
+      0 -> [ "buildRtsValue _b " <> name <> " = Prelude.return ()" ]
+      _ -> ("buildRtsValue b " <> paren nameAndParams <> " = do")
+            : indentLines (map ("Glean.buildRtsValue b " <>) fieldParamNames)
+    decodeMe = case length fields of
+      0 -> [ "decodeRtsValue = Prelude.pure " <> name]
+      n -> "decodeRtsValue = " <> name
+           : indent "<$> Glean.decodeRtsValue"
+           : indentLines (replicate (pred n) "<*> Glean.decodeRtsValue")
+
+  tys <- mapM makeTypeName fields
+  let def_Type =
+        "instance Glean.Type " <> name <> " where"
+        : indentLines
+        ( encodeMe
+        <> decodeMe
+        <> [sourceTypeDef ident ver]
+        )
+
+      def_RecordFields =
+        [ emitFieldTypes "Angle.RecordFields" name (zip fields tys) ]
+
+  return $ map myUnlines [def_Type, def_RecordFields]
+
+
+unionDef :: Name -> Version -> [ResolvedFieldDef' s] -> M [Text]
+unionDef ident ver fields = do
+  let typeRef = TypeRef ident ver
+  uName@(here,root) <- typeName typeRef
+  let name = haskellTypeName uName
+  withTypeDefHint root $ do
+  let
+    shortConNames = map fieldDefName fields
+    conNames = map toConName shortConNames
+    toConName shortName = cap1 (prefix <> shortName)
+      where prefix = name <> "_"
+    makeTypeName pred gen (FieldDef p tField) =
+      withUnionFieldHint p (haskellTy_ pred gen here tField)
+
+  -- walk over the fields to generate nested types first
+  mapM_ (makeTypeName PredName True) fields
+
+  keyTypeNames <- mapM (makeTypeName PredKey False) fields
+
+  let def_Type = case conNames of
+        [] ->
+          "instance Glean.Type " <> name <> " where" : indentLines
+            [ "buildRtsValue _ _ = Prelude.return ()"
+            , "decodeRtsValue = Prelude.error $ \"decodeRtsValue\" <> " <> name
+            ]
+        _ ->
+          let emptyCon = toConName "EMPTY"
+              builds =
+                  mkBuildEmpty conNames emptyCon ++
+                  concat (zipWith mkBuild [0..] conNames)
+              decodes =
+                "decodeRtsValue = Glean.sumD" :
+                indentLines
+                  ( "(Prelude.pure " <> emptyCon <> ")"
+                  : asArray (map mkDecode conNames)
+                  )
+          in concat
+            [ ["instance Glean.Type " <> name <> " where"]
+            , indentLines builds
+            , indentLines decodes
+            , indentLines [sourceTypeDef ident ver]
+            ]
+
+      def_SumFields =
+        [ emitFieldTypes "Angle.SumFields" name (zip fields keyTypeNames) ]
+
+  return $ map myUnlines $ [def_Type, def_SumFields]
+  where
+    mkBuildEmpty constructors emptyCon =
+      let index = length constructors in
+      "buildRtsValue b " <> emptyCon <> "=" : indentLines
+        [ "Glean.buildRtsSelector b " <> Text.pack (show index) ]
+
+    mkBuild :: Int -> Text -> [Text]
+    mkBuild i c =
+      "buildRtsValue b (" <> c <> " x) = do" : indentLines
+        [ "Glean.buildRtsSelector b " <> Text.pack (show i)
+        , "Glean.buildRtsValue b x" ]
+
+    mkDecode :: Text -> Text
+    mkDecode c = "Glean.mapD " <> c
+
+    asArray :: [Text] -> [Text]
+    asArray = \case
+      [] -> ["[]"]
+      (x:xs) -> concat
+        [ ["[ " <> x]
+        , [", " <> e | e <- xs]
+        , ["]"]
+        ]
+
+enumDef :: Name -> Version -> [Name] -> M [Text]
+enumDef ident ver eVals = do
+  let typeRef = TypeRef ident ver
+  eName@(_,root) <- typeName typeRef
+  let name = haskellTypeName eName
+
+  withTypeDefHint root $ do
+  let
+    def_Type = "instance Glean.Type " <> name <> " where"
+            : indentLines [ "buildRtsValue = Glean.thriftEnum_buildRtsValue "
+                          , "decodeRtsValue = Glean.thriftEnumD "
+                          , sourceTypeDef ident ver
+                          ]
+    def_SumFields =
+       [ emitFieldTypes "Angle.SumFields" name
+           [ (FieldDef n unitT, "Glean.Schema.Builtin.Types.Unit")
+           | n <- eVals ]
+       ]
+
+    def_AngleEnum =
+      "instance Angle.AngleEnum " <> name <> " where": indentLines
+        [ "type AngleEnumTy " <> name <> " = " <> name
+        , "enumName v = Text.pack (Prelude.drop " <>
+            showt (Text.length root + 1) <> " (Prelude.show v))"]
+
+  return $ map myUnlines [def_Type, def_SumFields, def_AngleEnum]
+
+sourceTypeDef :: Name -> Version -> Text
+sourceTypeDef name version =
+  "sourceType _ = Angle.NamedTy () " <> paren sourceRef
+  where
+    sourceRef = Text.unwords
+      [ "Angle.SourceRef"
+      , Text.pack (show name)
+      , paren ("Prelude.Just " <> showt version)
+      ]
+
+
+emitFieldTypes :: Text -> Text -> [(ResolvedFieldDef' s, Text)] -> Text
+emitFieldTypes family name fields =
+  "type instance " <> family <> " " <> name <> " = " <> go fields
+  where
+    go [] = "'Angle.TNoFields"
+    go ((FieldDef name _, ty) : rest) =
+       "'Angle.TField \"" <> name <> "\" (" <> ty <> ") (" <> go rest <> ")"
diff --git a/glean/schema/gen/Glean/Schema/Gen/Main.hs b/glean/schema/gen/Glean/Schema/Gen/Main.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Main.hs
@@ -0,0 +1,498 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- | Generate thrift/Haskell/C++/Python headers from a Glean schema
+
+This script is run automatically via Buck custom_rule()s, see
+glean/schema/TARGETS.
+
+buck run @mode/opt //glean/schema/gen:gen-schema -- --help
+
+Usage: gen-schema ([--cpp ARG] | [--thrift ARG] | [--hs ARG] | [--py ARG])
+                  (-i|--input FILE) [-d|--install_dir DIR]
+
+Available options:
+  -i,--input FILE          materialized JSON input file
+  -h,--help                Show this help text
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Schema.Gen.Main
+  ( main
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.Except
+import Data.Bifoldable (bifoldMap)
+import qualified Data.ByteString.Char8 as BC
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.IntMap.Strict as IntMap
+import Data.Graph
+import Data.List
+import qualified Data.Map.Strict as Map
+import Data.Map.Strict (Map)
+import Data.Maybe
+import qualified Data.Set as Set
+import Data.Text (Text, splitOn)
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import qualified Data.Tree as Tree
+import Options.Applicative
+import System.Directory
+import System.FilePath
+import System.IO
+import qualified Text.Fuzzy as Fuzzy
+import Text.Printf
+
+import Thrift.Util
+import Util.IO
+import Util.Timing
+import Util.OptParse (commandParser)
+
+import Glean.Query.Typecheck (tcQueryDeps)
+import Glean.Query.Codegen.Types (QueryWithInfo(..))
+import Glean.Angle.Types
+import Glean.Angle.Parser
+import Glean.Database.Config hiding (options)
+import Glean.Database.Schema
+import Glean.Database.Schema.ComputeIds
+import Glean.Database.Schema.Types
+import Glean.Display
+import qualified Glean.Internal.Types as Internal
+import Glean.RTS.Types (PidRef(..), ExpandedType(..))
+import Glean.Schema.Resolve (resolveSchemaRefs)
+import Glean.Schema.Util (showRef)
+import Glean.Schema.Gen.Thrift
+import Glean.Schema.Gen.Cpp ( genSchemaCpp )
+import Glean.Schema.Gen.HackJson ( genSchemaHackJson )
+import Glean.Schema.Gen.Haskell ( genSchemaHS )
+import Glean.Schema.Gen.Python ( genSchemaPy )
+import Glean.Schema.Gen.OCaml ( genSchemaOCaml )
+import Glean.Schema.Gen.Rust ( genSchemaRust )
+import Glean.Schema.Gen.Utils ( NameSpaces, Oncall )
+
+import Glean.Schema.Types
+import Glean.Types (SchemaId(..))
+
+data Options = Options
+  { input :: Either FilePath FilePath
+  , omitArchive :: Bool
+  , actOptions :: Either GraphOptions GenOptions
+  }
+
+data GraphOptions = GraphOptions
+  { target :: Maybe Text
+  , maxDepth :: Maybe Int
+  , reverseDeps :: Bool
+  , topologicalSort :: Bool
+  , graphType :: GraphType
+  , ignoreDerivations :: Bool
+  }
+
+data GraphType = SchemaGraph | PredicateGraph
+
+data GenOptions =  GenOptions
+  { thrift :: Maybe FilePath
+  , cpp :: Maybe FilePath
+  , hackjson :: Maybe FilePath
+  , hs :: Maybe FilePath
+  , py :: Maybe FilePath
+  , ocaml :: Maybe FilePath
+  , rust :: Maybe FilePath
+  , source :: Maybe FilePath
+  , updateIndex :: Maybe FilePath
+  , install_dir :: FilePath
+  , restrictSchemas :: Maybe [NameSpaces]
+  , oncall :: Maybe Oncall
+  }
+
+toNameSpaces :: [Text] -> [NameSpaces]
+toNameSpaces names = splitOn "." <$> names
+
+optSchemas :: Parser (Maybe [NameSpaces])
+optSchemas = optional ( toNameSpaces . splitOn "," <$> strOption
+        ( long "schemas"
+        <> metavar "SCHEMAS"
+        <> help "Restrict schemas to generate" ))
+
+options :: Parser Options
+options = do
+  omitArchive <- switch $
+    long "omit-archive" <>
+    help ("ignore .angle files under archive/ directories. " <>
+      "Non-archived schemas should not depend on archived schemas; this " <>
+      "flag is for testing that that property holds.")
+  let
+    dir = strOption (long "dir" <> metavar "DIR")
+    oneFile = strOption (long "input" <> metavar "FILE")
+  input <- (Left <$> oneFile) <|> (Right <$> dir)
+  actOptions <-
+    fmap Left graphOptions <|>
+    fmap Right genOptions
+  return Options{..}
+  where
+    graphOptions = do
+      commandParser "graph"
+        (progDesc "View the dependency graph of a local schema") $ do
+        reverseDeps <- switch
+          (  long "reverse-deps"
+          <> help "view reverse dependencies instead"
+          )
+        topologicalSort <- switch
+          (  long "topsort"
+          <> help "print a topologically sorted list of dependencies"
+          )
+        target <- optional $ strOption
+          (  long "root"
+          <> metavar "NODE"
+          <> help "reference schema/predicate"
+          )
+        maxDepth <- optional $ option auto
+          (  long "depth"
+          <> metavar "INT"
+          <> help "restrict how many levels deep the tree should go"
+          )
+        graphType <- flag SchemaGraph PredicateGraph
+          (  long "predicates"
+          <> help "show a graph of predicates rather than of schemas"
+          )
+        ignoreDerivations <- switch
+          ( long "ignore-derivations"
+          <> help "in a predicate graph ignore dependencies \
+              \from derivation queries."
+          )
+
+        return GraphOptions{..}
+
+    genOptions = do
+      thrift <- optional $ strOption $
+        long "thrift" <> metavar "FILE"
+      cpp <- optional $ strOption $
+        long "cpp" <> metavar "FILE"
+      hackjson <- optional $ strOption $
+        long "hackjson" <> metavar "FILE"
+      hs <- optional $ strOption $
+        long "hs" <> metavar "FILE"
+      py <- optional $ strOption $
+        long "py" <> metavar "FILE"
+      ocaml <- optional $ strOption $
+        long "ocaml" <> metavar "FILE"
+      rust <- optional $ strOption $
+        long "rust" <> metavar "FILE"
+      source <- optional $ strOption $
+        long "source" <> metavar "FILE"
+      updateIndex <- optional $ strOption $
+        long "update-index" <> metavar "FILE" <>
+        help ("Add the schema to the index at FILE, making it the new " <>
+          "current schema")
+      install_dir <- strOption $
+        long "install_dir" <> short 'd' <> metavar "DIR" <> value ""
+      oncall <- optional $ strOption
+        ( long "oncall"
+          <> value ""
+          <> metavar "NAME"
+          <> help "Adds oncall annotation with oncall NAME to generated files "
+        )
+
+      restrictSchemas <- optSchemas
+      return GenOptions{..}
+
+main :: IO ()
+main = do
+  Options{..} <- execParser (info (options <**> helper) fullDesc)
+  (src, schema, dbschema) <-
+    reportTime "parse/resolve/typecheck" $ do
+    str <- case input of
+      Left one -> BC.readFile one
+      Right dir -> do
+        files <- listDirectoryRecursive dir
+        catSchemaFiles $
+          if omitArchive
+            then filter (not . ("/archive/" `isInfixOf`)) files
+            else files
+    schema <- case processSchema Nothing str of
+      Left err -> throwIO $ ErrorCall err
+      Right schema -> return schema
+
+    -- Just check that parseSchemaCached works, because the server
+    -- will be using it.
+    case processSchemaCached Nothing HashMap.empty str of
+      Left err -> throwIO $ ErrorCall $ err
+      Right{} -> return ()
+
+    -- for typechecking
+    dbschema <- newDbSchema Nothing (SchemaIndex schema [])
+      LatestSchema readWriteContent def
+    return (str, schema, dbschema)
+
+  let ProcessedSchema sourceSchemas resolved _ = schema
+
+  reportTime "checking schema roundtrip" $ do
+    let pp = show (displayDefault sourceSchemas)
+    case parseSchema (BC.pack pp) of
+      Left err -> throwIO $ ErrorCall $ "schema roundtrip error: " <> err
+         ++ "\n" ++ pp
+      Right schemasRoundTrip ->
+        when (rmLocSchemas sourceSchemas /= rmLocSchemas schemasRoundTrip) $
+          throwIO $ ErrorCall "schema did not roundtrip successfully"
+
+  refsResolved <- either (die 1 . Text.unpack) return $
+    runExcept $ resolveSchemaRefs sourceSchemas
+
+  let
+    -- We have to ensure the types and predicates exported by each
+    -- "all" schema is transitively closed, otherwise either the code
+    -- generator will fail, or the generated code will fail to compile.
+    allSchemas =
+      [ schema {
+          resolvedSchemaReExportedPredicates = preds,
+          resolvedSchemaReExportedTypes = types
+        }
+      | schema <- schemasResolved resolved
+      , resolvedSchemaName schema == "all"
+      , let
+          deps :: [ResolvedSchemaRef]
+          deps =
+            [ s
+            | Just v <- [toVertex (schemaSrcRef (schemaRef schema))]
+            , (_, n, _) <- reachableFrom v
+            , Just s <- [HashMap.lookup n schemaMap]
+            ]
+          types = HashMap.unions (map resolvedSchemaTypes deps)
+          preds = HashMap.unions (map resolvedSchemaPredicates deps)
+      ]
+
+    schemaSrcRef (SchemaRef n v) = SourceRef n (Just v)
+
+    (depGraph, fromVertex, toVertex) = graphFromEdges edges
+
+    reachableFrom v = map fromVertex $
+      concatMap Tree.flatten (dfs depGraph [v])
+
+    edges =
+      [ (schema, schemaName schema, schemaDependencies schema)
+      | schema <- srcSchemas refsResolved ]
+
+    schemaMap = HashMap.fromList
+      [ (schemaSrcRef (schemaRef s), s) | s <- schemasResolved resolved ]
+
+    findVersion v = listToMaybe
+      [ s | s@ResolvedSchema{..} <- allSchemas
+      , resolvedSchemaVersion == v
+      ]
+
+  versions <-
+    case schemasHighestVersion resolved of
+      Just ver
+        | Just schema <- findVersion ver, ver == schemaAllVersion dbschema ->
+          return [(ver, schemaId dbschema, schema, Nothing)]
+      _otherwise -> fail "missing 'all' schema"
+
+  case actOptions of
+    Left opts -> graph opts dbschema refsResolved [ v | (v,_,_,_) <- versions ]
+    Right opts -> do
+      forM_ (source opts) $ \f -> BC.writeFile f src
+      forM_ (updateIndex opts) (doUpdateIndex src schema)
+      reportTime "gen" $ gen opts versions
+
+graph :: GraphOptions -> DbSchema -> SourceSchemas -> [Version] -> IO ()
+graph opts dbschema sourceSchemas versions =
+  Text.putStrLn $ drawGraph opts graph roots
+  where
+    predicatesGraph = predicateGraph (ignoreDerivations opts) dbschema
+    (roots, graph) = case graphType opts of
+      PredicateGraph ->
+        case target opts of
+          Nothing -> (Map.keys predicatesGraph, predicatesGraph)
+          Just t -> case Map.lookup t predicatesGraph of
+            Nothing
+              | cand:_ <- Fuzzy.simpleFilter t (Map.keys predicatesGraph)
+              -> errorWithoutStackTrace $ Text.unpack $
+                "did you mean " <> cand <> " ?"
+            Nothing
+              -> errorWithoutStackTrace $ Text.unpack $
+                "predicate not found in graph: " <> t
+            Just _
+              -> (pure t, predicatesGraph)
+      SchemaGraph ->
+        let everyAllSchema  = map (\v -> "all." <> Text.pack (show v)) versions
+            roots = maybe everyAllSchema pure (target opts)
+        in (roots, schemaGraph sourceSchemas)
+
+schemaGraph :: SourceSchemas -> Map Text [Text]
+schemaGraph sourceSchemas = Map.fromList
+  [ (showRef (schemaName s), map showRef (schemaDependencies s))
+  | s <- srcSchemas sourceSchemas ]
+
+schemaDependencies :: SourceSchema -> [SourceRef]
+schemaDependencies SourceSchema{..} =
+  schemaInherits ++ [ name | SourceImport name _ <- schemaDecls ]
+
+predicateGraph :: Bool -> DbSchema -> Map Text [Text]
+predicateGraph ignoreDerivations dbschema = Map.fromList
+  [ (ref, deps)
+  | details <- IntMap.elems (predicatesByPid dbschema)
+  , let ref = showRef (predicateRef details)
+        deps = showRef <$> Set.toList (dependencies details)
+  ]
+  where
+    dependencies details = asRefs $ keyValueDeps <> derivationDeps
+      where
+        keyValueDeps =
+          typeDeps (predicateKeyType details) <>
+          typeDeps (predicateValueType details)
+        derivationDeps
+          | not ignoreDerivations
+          , Derive _ (QueryWithInfo query _ _ _) <- predicateDeriving details
+          = tcQueryDeps query
+          | otherwise
+          = mempty
+    typeDeps = bifoldMap overPidRef overExpanded
+      where
+        overExpanded (ExpandedType _ ty) = typeDeps ty
+        overPidRef (PidRef _ ref) = Set.singleton ref
+
+    asRefs = Set.fromList . fmap predicateIdRef . Set.toList
+
+drawGraph :: GraphOptions -> Map Text [Text] -> [Text] -> Text
+drawGraph GraphOptions{..} deps' roots =
+  Text.unlines $ if topologicalSort
+    then topsort forest
+    else drawTree <$> forest
+  where
+    forest = map (mkTree deps mempty 1) roots
+    deps
+      | reverseDeps =
+          Map.fromListWith (<>) $ concatMap (\(s,ss) -> (,[s]) <$> ss) $
+            Map.toList deps'
+      | otherwise = deps'
+    mkTree graph seen depth root = Tree.Node root subtree
+      where
+        subtree = map (mkTree graph (Set.insert root seen) (depth + 1)) children
+        continue = notRecursing && canGoDeeper
+          where notRecursing  = not (root `Set.member` seen)
+                canGoDeeper = maybe True (depth <=) maxDepth
+        children
+          | continue = Map.findWithDefault [] root graph
+          | otherwise = []
+
+    drawTree :: Tree Text -> Text
+    drawTree (Node root children) = Text.unlines $ root : draw children
+      where
+      draw [] = []
+      draw (x:xs) = drawNode (null xs) x <> draw xs
+      drawNode isLast (Node name children) =
+        (pre <> name) : map (spacer <>) (draw children)
+        where
+          (spacer, pre) = if isLast
+            then ("    ", "└── ")
+            else ("│   ", "├── ")
+
+    topsort :: Ord a => [Tree a] -> [a]
+    topsort forest = reverse postorder
+      where
+        postorder = go mempty forest (const [])
+          where
+            go seen [] cont = cont seen
+            go seen (Node node children : rest) cont
+              | node `Set.member` seen = go seen rest cont
+              | otherwise = go (Set.insert node seen) children $
+                 \seen' -> node : go seen' rest cont
+
+gen
+  :: GenOptions
+  -> [(Version, SchemaId, ResolvedSchemaRef, Maybe FilePath)]
+  -> IO ()
+gen GenOptions{..} versions =
+  mapM_ genFor versions
+  where
+  genFor :: (Version, SchemaId, ResolvedSchemaRef, Maybe FilePath) -> IO ()
+  genFor (_, hash, ResolvedSchema{..}, dir) = do
+      let
+        ts = HashMap.elems resolvedSchemaReExportedTypes
+        ps = HashMap.elems resolvedSchemaReExportedPredicates
+
+        doGen _ Nothing = return ()
+        doGen gen (Just output) = do
+          let odir = install_dir </> fromMaybe "" dir </> output
+          forM_ (gen resolvedSchemaVersion ps ts oncall) $ \(file,text) -> do
+            let path = odir </> file
+            createDirectoryIfMissing True (takeDirectory path)
+            Text.writeFile path (text <> "\n")
+      doGen (genSchemaCpp hash) cpp
+      doGen genSchemaHackJson hackjson
+      doGen genSchemaHS hs
+      doGen genSchemaPy py
+      doGen (genSchemaOCaml restrictSchemas) ocaml
+      doGen (genSchemaRust hash) rust
+      doGen (genSchemaThrift dir hash) thrift
+
+-- -----------------------------------------------------------------------------
+-- Working with the SchemaIndex
+
+-- | Add a new schema to an existing SchemaIndex.
+doUpdateIndex :: BC.ByteString -> ProcessedSchema -> FilePath -> IO ()
+doUpdateIndex src new@(ProcessedSchema _ _ hashed) indexFile = do
+  hPutStrLn stderr $ "Updating index in " <> indexFile
+
+  -- check that the new schema instance is compatible with the
+  -- existing ones
+  exists <- doesFileExist indexFile
+  when exists $ do
+    current <- parseSchemaIndex indexFile
+    validateNewSchemaInstance $ current {
+      schemaIndexCurrent = new,
+      schemaIndexOlder =
+        schemaIndexCurrent current : schemaIndexOlder current }
+
+  let
+    -- store the new schema in the file "instance/<schemaid>" relative
+    -- to the index file, where <schemaid> is the SchemaId of the
+    -- latest "all" schema
+    file = "instance/" <> unSchemaId (hashedSchemaId hashed)
+
+    versions = Map.fromList [(
+        unSchemaId (hashedSchemaId hashed),
+        fromIntegral (hashedSchemaAllVersion hashed)
+      )]
+
+    baseIndex = def {
+        Internal.schemaIndex_current = def {
+          Internal.schemaInstance_versions = versions,
+          Internal.schemaInstance_file = file }
+      }
+
+  -- If this exact schema is present already (perhaps as an older
+  -- instance) then promote it to be the current schema. If the new
+  -- schema is identical to the current one, this will leave
+  -- everything as it was.
+  newIndex <- do
+    exists <- doesFileExist indexFile
+    if exists
+      then do
+        oldIndex <- loadJSON indexFile
+        let
+          existingInstances =
+            filter (((/=) versions) . Internal.schemaInstance_versions) $
+              Internal.schemaIndex_current oldIndex :
+              Internal.schemaIndex_older oldIndex
+        hPutStrLn stderr $ printf "Old index contains %d instance(s)"
+          (1 + length (Internal.schemaIndex_older oldIndex))
+        return baseIndex { Internal.schemaIndex_older = existingInstances }
+      else
+        return baseIndex
+
+  hPutStrLn stderr $ printf "New index contains %d instance(s)"
+    (1 + length (Internal.schemaIndex_older newIndex))
+
+  saveJSON indexFile newIndex
+  let fileToWrite = takeDirectory indexFile </> Text.unpack file
+  createDirectoryIfMissing True (takeDirectory fileToWrite)
+  BC.writeFile fileToWrite src
diff --git a/glean/schema/gen/Glean/Schema/Gen/OCaml.hs b/glean/schema/gen/Glean/Schema/Gen/OCaml.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/OCaml.hs
@@ -0,0 +1,567 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Generate "Glean.Schema"
+module Glean.Schema.Gen.OCaml
+  ( genSchemaOCaml
+  ) where
+
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import Data.List (partition)
+import qualified Data.Text as Text
+import Control.Monad.State
+
+import Glean.Schema.Gen.Utils
+    ( NameSpaces,
+      NamePolicy(predNames, typeNames),
+      sortDeclsByNamespace,
+      newline,
+      cap1,
+      mkNamePolicy,
+      addNamespaceDependencies,
+      Oncall, buckOncallAnnotation )
+import Glean.Angle.Types
+    ( PredicateRef,
+      TypeRef,
+      Version,
+      PredicateDef_(predicateDefRef, predicateDefKeyType,
+                    predicateDefValueType),
+      TypeDef_(typeDefRef, typeDefType),
+      FieldDef_(fieldDefType, fieldDefName),
+      Type_(..) )
+import Glean.Schema.Types
+    ( ResolvedPredicateDef, ResolvedTypeDef, ResolvedType )
+import Data.Char (isUpper, toLower)
+
+generated :: Text
+generated = Text.concat
+  [ "regenerate: buck2 run fbcode//glean/schema/gen:gen-schema  "
+  , "-- --ocaml fbcode/hphp/hack/src/typing/write_symbol_info/schema "
+  , "--dir DEST_DIR"
+  ]
+
+dune :: [Text] -> Text
+dune modules = Text.unlines
+  [ "; \x40generated"
+  , "; " <> generated
+  ,  "(library"
+  , " (name glean_schema)"
+  , " (wrapped false)"
+  , "(modules"
+  , " " <> Text.intercalate "\n " modules <> ")"
+  , "(libraries"
+  , " utils_core"
+  , " core"
+  , " base64)"
+  , "(preprocess"
+  , " (pps ppx_deriving.std)))"
+  ]
+
+-- disable warning for "unused module imports" and "unused rec".
+-- Not all generated files use it.
+ocamlHeaderGen :: [Text] -> Text
+ocamlHeaderGen imports = Text.unlines $
+  [ "(*"
+  , " * Copyright (c) Meta Platforms, Inc. and affiliates."
+  , " * All rights reserved."
+  , " *"
+  , " * This source code is licensed under the BSD-style license found in the"
+  , " * LICENSE file in the root directory of this source tree."
+  , " *)"
+  , ""
+  , "(* \x40generated"
+  , "   " <> generated <> " *)"
+  , ""
+  , "[@@@warning \"-33-39\"]"
+  ] ++ (("open " <>) <$> imports) ++ [ "" ]
+
+ocamlHeader :: Text
+ocamlHeader =  ocamlHeaderGen ["Hh_json", "Core"]
+
+ocamlHeader' :: Text
+ocamlHeader' =  ocamlHeaderGen ["Hh_json"]
+
+-- TODO use "Core.Map"
+factIdMl :: Text
+factIdMl = ocamlHeader' <> Text.unlines
+  [ ""
+  , "type t = int [@@deriving ord]"
+  , ""
+  , "let next ="
+  , "  let x = ref 1 in"
+  , "  fun () ->"
+  , "    let r = !x in"
+  , "    x := !x + 1;"
+  , "    r"
+  , ""
+  , "let to_json_number i = JSON_Number (string_of_int i)"
+  , ""
+  , "module Map = Map.Make (struct"
+  , "  type t = int"
+ , ""
+ , "  let compare = Int.compare"
+ , "end)"
+ , ""
+  ]
+
+utilMl :: Text
+utilMl = ocamlHeader <> Text.unlines
+  [ ""
+  , "let key v = JSON_Object [(\"key\", v)]"
+  , ""
+  , "let id fact_id = JSON_Object [(\"id\", Fact_id.to_json_number fact_id)]"
+  , ""
+  ]
+
+targetsHeader :: Maybe Oncall -> Text
+targetsHeader oncall = Text.unlines
+  [ "# \x40generated"
+  , "# " <> generated
+  , "load(\"@fbcode_macros//build_defs:ocaml_library.bzl\", \"ocaml_library\")"
+  , buckOncallAnnotation oncall
+  , ""
+  ]
+
+targetsLib :: Text -> [Text] -> [Text] -> Text
+targetsLib name srcs deps = Text.unlines
+  [ "ocaml_library("
+  , "  name = \"" <> name <> "\","
+  , "  srcs = ["
+  , Text.intercalate "\n" (buckItem <$> srcs)
+  , "  ],"
+  , "  deps = ["
+  , Text.intercalate "\n" (buckItem <$> deps)
+  , "  ],"
+  , "  preprocess = ["
+  , "    \"ppx_deriving.show\","
+  , "    \"ppx_deriving.eq\","
+  , "    \"ppx_deriving.ord\","
+  , "    \"ppx_deriving.enum\""
+  , "  ],"
+  , "  external_deps = ["
+  , "    (\"supercaml\", None, \"base64\"),"
+  , "    (\"supercaml\", None, \"core\")"
+  , "  ]"
+  , ")"
+  , ""
+  ]
+  where buckItem x = "    \"" <> x <> "\","
+
+moduleDecl :: Int -> Text
+moduleDecl 0 = "module rec "
+moduleDecl _ = "and "
+
+type GenTypeName = Text
+type GenFunName = Text
+type GenVars = Text
+type GenCode = Text
+type GenType = Text
+
+-- all the text generated from an angle type/pred
+-- we pick pieces of this to generate the OCaml modules
+-- signature and implementation
+type GenEntity = (GenTypeName, GenFunName, GenType, GenVars, GenCode)
+
+displayList :: Text -> Text -> Text -> [Text] -> Text
+displayList first second sep texts =
+    Text.intercalate sep $ zipWith (<>) prefixes texts
+  where
+     prefixes = first : repeat second
+
+typeDecl :: GenEntity -> Text
+typeDecl (name, _fun_name, type_, _var, _code ) =
+  mconcat [name, " = ", type_, "\n  [@@deriving ord]"]
+
+toJsonDecl :: GenEntity -> Text
+toJsonDecl (name, fun_name, _type, _var, _code ) =
+  mconcat ["  val ", fun_name, ": ", name, " -> json"]
+
+toJsonImpl :: GenEntity -> Text
+toJsonImpl (_name, fun_name, _type, var, code ) =
+  mconcat [fun_name, " ", var, " = ", code]
+
+genModuleType :: Int -> Text -> [GenEntity] -> Text
+genModuleType decl name types = Text.unlines
+    [ moduleDecl decl <> name <> ": sig"
+    , displayList "  type " "  and " "\n" (typeDecl <$> types)
+    , ""
+    , "  val to_json : t -> json"
+    , "end = struct"
+    , displayList "  type " "  and " "\n" (typeDecl <$> types)
+    , ""
+    , displayList "  let rec " "  and " "\n" (toJsonImpl <$> types)
+    , "end"
+    ]
+
+genModulePred :: Int -> Text -> [GenEntity] -> Text
+genModulePred decl name types = Text.unlines
+  [ moduleDecl decl <> name <> ": sig"
+  , "  type t ="
+  , "    | Id of Fact_id.t"
+  , "    | Key of key"
+  , "  [@@deriving ord]"
+  , ""
+  , displayList "  and " "  and " "\n" (typeDecl <$> types)
+  , ""
+  , "  val to_json: t -> json"
+  , ""
+  , Text.intercalate "\n" (toJsonDecl <$> types)
+  , ""
+  , "end = struct"
+  , "  type t ="
+  , "    | Id of Fact_id.t"
+  , "    | Key of key"
+  , "  [@@deriving ord]"
+  , ""
+  , displayList "  and " "  and " "\n" (typeDecl <$> types)
+  , ""
+  , "  let rec to_json = function"
+  , "    | Id f -> Util.id f"
+  , "    | Key t -> Util.key (to_json_key t)"
+  , ""
+  , displayList "  and " "  and " "\n" (toJsonImpl <$> types)
+  , "end"
+  ]
+
+-- Extra state used in generation function to store generated
+-- code/type for anonymous datatypes we can't translate directly
+-- in OCaml
+type GenAnonTypes = [(GenTypeName, GenType)]
+type GenAnonTypesCode = [(GenTypeName, GenVars, GenCode)]
+
+data FieldKind = Sum | Record
+
+-- | Generate the type representing a predicate or type
+genOCamlType
+  :: NameSpaces -> NamePolicy -> ResolvedType -> State GenAnonTypes GenType
+genOCamlType ns namePolicy t = case t of
+  ByteTy -> return "char"
+  NatTy -> return "int"
+  StringTy -> return "string"
+  ArrayTy ByteTy -> return "string list"
+  ArrayTy ty -> do
+    t <- genOCamlType ns namePolicy ty
+    return $ t <> " list"
+  RecordTy [] -> return "unit"
+  RecordTy fields -> do
+    f <- mapM (genField Record) fields
+    return $ "{\n" <> Text.unlines f <> "  }"
+  SumTy fields -> do
+    f <- mapM (genField Sum) fields
+    return $ "\n" <> Text.intercalate "\n" f
+  SetTy ty -> do
+    t <- genOCamlType ns namePolicy ty
+    return $ t <> " list" -- Suboptimal but sets in OCaml is such a pain
+  PredicateTy _ pred -> return $ predToModule ns pred namePolicy <> ".t"
+  NamedTy _ tref -> return $ typeToModule ns tref namePolicy <> ".t"
+  MaybeTy ty -> do
+    t <- genOCamlType ns namePolicy ty
+    return $ t <> " option"
+  EnumeratedTy names ->
+    return $ "\n" <> Text.unlines (("    | " <>) . nameToConstructor <$> names)
+  BooleanTy -> return "bool"
+  TyVar{} -> error "genOCamlType: TyVar"
+  HasTy{} -> error "genOCamlType: HasTy"
+  HasKey{} -> error "genOCamlType: HasKey"
+  ElementsOf{} -> error "genOCamlType: ElementsOf"
+  where
+    genField fieldKind field = do
+      ty <- genOCamlTypeFromField field ns namePolicy (fieldDefType field)
+      case fieldKind of
+        Record -> return $ "    " <> fieldToVar field <> ": " <> ty <> ";"
+        Sum -> return $ "     | " <> fieldToConstructor field <> " of " <> ty
+
+genOCamlTypeFromField
+  :: FieldDef_ s PredicateRef TypeRef
+  -> NameSpaces
+  -> NamePolicy
+  -> ResolvedType
+  -> State GenAnonTypes GenType
+genOCamlTypeFromField field ns namePolicy t = do
+  let typeName = fieldToTypeName field
+  type_ <- genOCamlType ns namePolicy t
+  st <- get
+  case t of
+    RecordTy (_ : _) -> do
+      put $ (typeName, type_) : st
+      return typeName
+    SumTy _ -> do
+      put $ (typeName, type_) : st
+      return typeName
+    EnumeratedTy _ -> do
+      put $ (typeName, type_) : st
+      return typeName
+    _ -> return type_
+
+genOCamlToJson
+  :: GenVars -> NameSpaces -> NamePolicy -> ResolvedType
+  -> State GenAnonTypesCode (GenVars, GenCode)
+genOCamlToJson var ns namePolicy t = case t of
+  ByteTy ->
+    return (var, "JSON_Number (string_of_int (int_of_char " <> var <> "))")
+  NatTy -> return (var, "JSON_Number (string_of_int " <> var <> ")")
+  StringTy -> return (var, "JSON_String " <> var)
+  ArrayTy ByteTy ->
+    return (var, "JSON_String (List.map ~f:Base64.encode_string " <> var
+    <> "|> String.concat ~sep:\"\")")
+  ArrayTy ty -> do
+    (_, code) <- genOCamlToJson "x" ns namePolicy ty
+    return (var, "JSON_Array (List.map ~f:(fun x -> " <> code  <> ") "
+       <> var <> ")")
+  RecordTy [] ->
+    return ("_", "JSON_Object []")
+  RecordTy fields -> do
+    let fieldNames = fieldToVar <$> fields
+        vars = "{" <> Text.intercalate "; " fieldNames <> "}"
+        fieldToVarPair field = do
+          let camlVar = fieldToVar field
+              jsonKey = fieldToJSONKey field
+              type_ = fieldDefType field
+          (_, camlType) <-
+            genOCamlToJsonFromField field camlVar ns namePolicy type_
+          let isOpt = case type_ of
+                MaybeTy _ -> True
+                _ -> False
+              camlPair = "(\"" <> jsonKey <> "\", " <> camlType <> ")"
+          return (camlVar, camlPair, isOpt)
+    fields_ <- mapM fieldToVarPair fields
+    let (optFields, reqFields) = partition (\(_, _, isOpt) -> isOpt) fields_
+        reqFieldsDefs = Text.unlines (
+          let toRegString  (_, pair, _) = "      " <> pair <> ";" in
+          [ "    let fields = [" ] <>
+          (toRegString <$> reqFields) <>
+          [ "    ] in" ])
+        optFieldsDefs =
+          let toOptFieldDef (var, pair, _) = Text.unlines
+                [ "    let fields =",
+                  "      match " <> var <> " with",
+                  "      | None -> fields",
+                  "      | Some " <> var <> " -> " <> pair <>  " :: fields in" ]
+          in
+          Text.concat $ toOptFieldDef <$> optFields
+    return (vars, "\n" <> reqFieldsDefs <> optFieldsDefs
+     <> "    JSON_Object fields\n")
+  SumTy fields -> do
+    let typeSumField field = do
+          let var = fieldToVar field
+          (_, genType) <-
+            genOCamlToJsonFromField field var ns namePolicy (fieldDefType field)
+          let key = fieldToJSONKey field
+          let constr = fieldToConstructor field
+          return $ Text.concat [ "     | ", constr, " ", var,
+                        " -> JSON_Object [(\"", key, "\", ", genType, ")]"]
+    fields <- mapM typeSumField fields
+    return ("", "function\n" <> Text.unlines fields)
+  SetTy ty -> do
+    (_, code) <- genOCamlToJson "x" ns namePolicy ty
+    return (var, "JSON_Array (List.map ~f:(fun x -> " <> code  <> ") "
+       <> var <> ")")
+  PredicateTy _ pred ->
+    let moduleName = predToModule ns pred namePolicy in
+        return (var, moduleName <> ".to_json " <> var)
+  NamedTy _ tref ->
+    let moduleName = typeToModule ns tref namePolicy in
+        return (var, moduleName <> ".to_json " <> var)
+  MaybeTy ty -> do
+    (_, genTy) <- genOCamlToJson "x" ns namePolicy ty
+    return (var, "Option.map ~f:(fun x -> " <> genTy <> ") " <> var)
+  EnumeratedTy names ->
+    let enumNames = zipWith (\idx val -> (idx, val)) [(0::Int)..] names in
+    let enumCase (num, name) =
+          Text.concat
+            ["     | ", nameToConstructor name,
+             " -> JSON_Number (string_of_int ", Text.pack $ show num, ")"] in
+    let handleEnumCases = enumCase <$> enumNames in
+        return ("", "function\n" <> Text.unlines handleEnumCases)
+  BooleanTy -> return (var, "JSON_Bool " <> var)
+  TyVar{} -> error "genOCamlToJson: TyVar"
+  HasTy{} -> error "genOCamlToJson: HasTy"
+  HasKey{} -> error "genOCamlToJson: HasKey"
+  ElementsOf{} -> error "genOCamlToJson: ElementsOf"
+
+genOCamlToJsonFromField
+  :: FieldDef_ s PredicateRef TypeRef -> GenVars -> NameSpaces -> NamePolicy
+  -> ResolvedType -> State GenAnonTypesCode (GenVars, GenCode)
+genOCamlToJsonFromField field var ns namePolicy t = do
+  let typeName = fieldToTypeName field
+      res = (var, typeName <> "_to_json " <> var)
+  st <- get
+  (var0, code) <- genOCamlToJson var ns namePolicy t
+  case t of
+   RecordTy [] -> do
+     return (var, "(ignore " <>  var <> "; JSON_Object [])")
+   RecordTy _ -> do
+     put $ (typeName, var0, code) : st
+     return res
+   SumTy _ -> do
+     put $ (typeName, var0, code) : st
+     return res
+   EnumeratedTy _ -> do
+     put $ (typeName, var0, code) : st
+     return res
+   MaybeTy ty -> genOCamlToJsonFromField field var ns namePolicy ty
+   _ -> return (var0, code)
+
+
+refToModule :: NameSpaces -> Maybe (NameSpaces, Text) -> Text
+refToModule curNs ref =
+  case ref of
+    Just (ns :: NameSpaces, x) ->
+      let toplevelMod = if ns == curNs then
+             ""
+           else
+             cap1 $ Text.intercalate "_" ns <> "." in
+       toplevelMod <> cap1 x
+    _ -> error $ "OCamlName: " ++ show ref
+
+typeToModule :: NameSpaces -> TypeRef -> NamePolicy -> Text
+typeToModule curNs ref namePolicy =
+  let map = typeNames namePolicy in
+  refToModule curNs (HashMap.lookup ref map)
+
+predToModule :: NameSpaces -> PredicateRef -> NamePolicy -> Text
+predToModule curNs ref namePolicy =
+  let map = predNames namePolicy in
+  refToModule curNs (HashMap.lookup ref map)
+
+-- used for anonymous types, we reuse the field name
+-- e.g. angle: type t = { a : { ...} }
+--      ocaml: type a = ...
+-- TODO: handle naming conflict, use path of fields
+fieldToTypeName :: FieldDef_ s PredicateRef TypeRef -> GenTypeName
+fieldToTypeName = fieldDefName
+
+nameToConstructor :: Text -> Text
+nameToConstructor = cap1
+
+fieldToJSONKey :: FieldDef_ s PredicateRef TypeRef -> Text
+fieldToJSONKey field = fieldDefName field
+
+fieldToConstructor :: FieldDef_ s PredicateRef TypeRef -> Text
+fieldToConstructor field = cap1 (fieldDefName field)
+
+fieldToVar :: FieldDef_ s PredicateRef TypeRef -> Text
+fieldToVar field =
+  from_ (camelToUnderscore (fieldDefName field))
+  where
+    from_ name
+      | Text.unpack name `elem` keywords = name <> "_"
+      | otherwise = name
+      where
+        keywords = ["begin", "end", "method", "type", "module", "to", "val",
+                    "object"]
+
+    camelToUnderscore = Text.pack . go . Text.unpack
+      where
+        go [] = []
+        go (x:xs)
+          | isUpper x = '_' : toLower x : go xs
+          | otherwise = x : go xs
+
+nsToTarget :: NameSpaces -> Text
+nsToTarget n = Text.intercalate "_" n
+
+nsToFileName :: NameSpaces -> Text
+nsToFileName n = nsToTarget n <> ".ml"
+
+genSchema
+ :: NameSpaces
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> NamePolicy
+  -> Text
+genSchema namespaces preds types namePolicy =
+      Text.intercalate newline [ocamlHeader, predModules, typeModules]
+    where
+      predModules =
+        Text.unlines [genModuleP num namespaces namePolicy pred |
+          (num, pred) <- zipWith (\idx val -> (idx, val)) [0..]  preds]
+      typeModules =
+        let startValue = length preds in
+        Text.unlines [genModuleT num namespaces namePolicy type_ |
+          (num, type_) <- zipWith (\idx val -> (idx, val)) [startValue..] types]
+      genModuleP (num :: Int) ns namePolicy pred =
+        let ref = predicateDefRef pred
+            key = predicateDefKeyType pred
+            value = predicateDefValueType pred
+            name = predToModule ns ref namePolicy
+        in case value of
+              RecordTy [] ->
+                genModulePred num name
+                  (typeToGenEntity "key" "to_json_key" ns namePolicy key)
+              _ ->
+                genModulePred num name
+                  (typeToGenEntity "key" "to_json_key" ns namePolicy key ++
+                   typeToGenEntity "value" "to_json_value" ns namePolicy value)
+      genModuleT (num :: Int) ns namePolicy type_ =
+          genModuleType num name
+            (typeToGenEntity "t" "to_json" ns namePolicy key)
+        where
+          ref = typeDefRef type_
+          key = typeDefType type_
+          name = typeToModule ns ref namePolicy
+
+      typeToGenEntity
+        :: GenTypeName -> GenFunName -> NameSpaces -> NamePolicy -> ResolvedType
+        -> [GenEntity]
+      typeToGenEntity typeName funName ns namePolicy x  =
+        let ((var, code), otherCode) =
+              runState (genOCamlToJson "x" ns namePolicy x) []
+            (kTy, otherTypes) =
+              runState (genOCamlType ns namePolicy x) []
+            others = [(name, name <> "_to_json", kTy, var, code) |
+              (name, kTy) <- otherTypes,
+              (name', var, code) <- otherCode, name == name']
+        in
+          (typeName, funName, kTy, var, code) : others
+
+genTargets :: [(NameSpaces, [NameSpaces])] -> Maybe Oncall -> Text
+genTargets deps oncall =
+  targetsHeader oncall
+  <> targetsLib "common" ["util.ml", "fact_id.ml"] [jsonDep]
+  <> Text.concat (genTarget <$> deps)
+  where
+  jsonDep = "//hphp/hack/src/utils/hh_json:hh_json"
+  genTarget (ns, imports) =
+    let
+      extra = (":" <>) . nsToTarget <$> imports
+      name = nsToTarget ns
+      file = nsToFileName ns
+      targetDeps = [ ":common", jsonDep ] ++ extra in
+    targetsLib name [file] targetDeps
+
+-- entry point
+-- generate all files, possibly restricted to schemas in [NameSpaces]
+genSchemaOCaml
+  :: Maybe [NameSpaces]
+  -> Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath,Text)]
+genSchemaOCaml onlySchemas _version preddefs typedefs oncall =
+  ( "dune", dune modules) :
+  ( "TARGETS", genTargets deps oncall) :
+  ( "fact_id.ml", factIdMl) :
+  ( "util.ml", utilMl) :
+  [ (Text.unpack (nsToFileName namespaces),
+    genSchema namespaces preds types namePolicy)
+    | (namespaces, (_, preds, types)) <- schemas
+  ]
+  where
+    filter = case onlySchemas of
+      Nothing -> \_ _ -> True
+      Just schemas -> (\x _ -> elem x schemas)
+    declsPerNamespace = HashMap.filterWithKey filter (
+      addNamespaceDependencies $ sortDeclsByNamespace preddefs typedefs)
+    schemas = HashMap.toList declsPerNamespace
+    deps = (\(x, (y, _, _)) -> (x, y)) <$> schemas
+    namePolicy = mkNamePolicy preddefs typedefs
+    modules' = nsToTarget . fst <$> deps
+    modules = ["util", "fact_id"] ++ modules'
diff --git a/glean/schema/gen/Glean/Schema/Gen/Python.hs b/glean/schema/gen/Glean/Schema/Gen/Python.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Python.hs
@@ -0,0 +1,443 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Generate "Glean.Schema"
+module Glean.Schema.Gen.Python
+  ( genSchemaPy
+  ) where
+
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import qualified Data.Text as Text
+import System.FilePath
+import TextShow
+import Data.Set (toList, fromList)
+import qualified Data.Maybe
+
+import Glean.Schema.Gen.Utils
+import Glean.Angle.Types
+import Glean.Schema.Types
+import Glean.Types (TypeName)
+
+
+genSchemaPy
+  :: Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath,Text)]
+genSchemaPy _version preddefs typedefs oncall =
+  ( "py" </> "TARGETS", genTargets declsPerNamespace extraImports oncall):
+  ( "py" </> "glean_schema_predicate.py", -- base class shared between schemas
+  Text.unlines
+  [ "# \x40generated"
+  , "# To regenerate this file run fbcode//glean/schema/gen/sync"
+  , "from typing import Generic, Optional, TypeVar"
+  , "from thrift.py3.types import Struct"
+  , ""
+  , "# Pyre expects a Fact to be bound to a Struct in GleanClient. For our " <>
+    "API, we expect a GleanSchemaPredicate as the result. To meet both " <>
+    "conditions, GleanSchemaPredicate extends a Struct."
+  , "class GleanSchemaPredicate(Struct):"
+  , "  " <> "@staticmethod"
+  , "  " <> "def angle_query(*, arg: str) -> \"GleanSchemaPredicate\":"
+  , "    " <> "raise Exception" <>
+    "(\"this function can only be called from @angle_query\")"
+  , ""
+  , "class InnerGleanSchemaPredicate:"
+  , "  " <> "@staticmethod"
+  , "  " <> "def angle_query(*, arg: str) -> \"InnerGleanSchemaPredicate\":"
+  , "    " <> "raise Exception" <> "(\"this function can only be called as" <>
+    " a parameter of a GleanSchemaPredicate\")"
+  , ""
+  , "T = TypeVar(\"T\")"
+  , ""
+  , "class Just(Generic[T]):"
+  , "  " <> "just: T | None = None"
+  , "  " <> "def __init__(self, just: T | None = None) -> None:"
+  , "    " <> "self.just = just"
+  , "  " <> "def get(self) -> Optional[T]:"
+  , "    " <> "return self.just"
+  ]) :
+  [ ("py" </>
+      Text.unpack (Text.concat namespaces) <.> "py",
+      Text.intercalate (newline <> newline)
+        ( header namespaces namePolicy allPreds :
+          genPredicateImports namespaces allPreds :
+          genAllPredicates AngleQuery namespaces namePolicy
+            "GleanSchemaPredicate" preds :
+          -- InnerGleanSchemaPredicate hides Named Types from the user's outer
+          -- query. InnerGleanSchemaPredicates cannot be called directly by an
+          -- Angle query, they must be used only as inner query fields.
+          genAllPredicates AngleQuery namespaces namePolicy
+            "InnerGleanSchemaPredicate" (predsFromTypes preds types) :
+          genNamedTypesAliases namePolicy types
+        )
+    )
+  | (namespaces, (_, preds, types)) <- schemas,
+    let allPreds = preds ++ predsFromTypes preds types
+  ]
+  where
+    schemas = HashMap.toList declsPerNamespace
+    predsFromTypes preds types = genNamedTypesClasses (head preds) types
+    namePolicy = mkNamePolicy preddefs typedefs
+    declsPerNamespace =
+      addNamespaceDependencies $ sortDeclsByNamespace preddefs typedefs
+    genPredicateImports namespaces preds = Text.unlines $
+      ("from glean.schema." <> namespaceToFileName namespaces <> ".types import (") :
+      [ "    " <> return_class_name <> ","
+          | pred <- preds
+          , let ref = predicateDefRef pred
+                predicateName = predicateRef_name ref
+                return_class_name = returnPythonClassName predicateName
+      ] ++
+      [")"]
+    extraImports = [
+      (Text.concat namespaces,
+      addBuckImportsForKeys namespaces namePolicy allPreds) |
+        (namespaces, (_, preds, types)) <- schemas,
+        let allPreds = preds ++ predsFromTypes preds types]
+
+-- To handle SumTypes inner fields, the API creates dummy predicates as a
+-- form of syntactic sugar for the user. The dummy queries created through them
+-- do not correspond to any Angle query.
+data PredicateMode = AngleQuery | DummyQuery
+
+genAllPredicates
+  :: PredicateMode
+  -> NameSpaces
+  -> NamePolicy
+  -> Text
+  -> [ResolvedPredicateDef]
+  -> Text
+genAllPredicates predicateMode _ namePolicy parent preds = Text.unlines $
+  [ Text.unlines $ case key of
+    EnumeratedTy vals -> "class " <> class_name <> "(Enum):" :
+      zipWith mkEnumerator [0..] vals
+    -- handle GleanSchemaPredicates with no key (ex: builtin.Unit.1)
+    RecordTy [] -> [class_name <> " = Tuple[()]"]
+    _ ->
+      [ "class " <> class_name <> "(" <> parent <> "):"
+      , "  " <> "@staticmethod"
+      , "  " <> "def build_angle(__env: Dict[str, R]" <> buildAngleTypes <>
+        ") -> Tuple[str, Struct]:"
+      , "    " <> "query_fields = " <> angleForTypes
+      , "    " <> "return f\"" <> anglePredicateAndVersion <>
+        " { " <> queryFields <> " if query_fields else '_' }" <>
+        "\", " <> return_class_name
+      , ""
+      , addClientMethods class_name kTy namePolicy key
+      , addSumTypes
+      ]
+    | pred <- preds
+    , let ref = predicateDefRef pred
+          key = predicateDefKeyType pred
+          kTy = valueTy class_name APIValues namePolicy key
+          queryFields = Text.pack $ case key of
+            SumTy{} ->  "('{ ' + query_fields + ' }')"
+            RecordTy{} -> "('{ ' + query_fields + ' }')"
+            _ -> "query_fields"
+          angleForTypes = case buildAngleTypes of
+            "" -> " " <> "_"
+            _ -> valueTy class_name AngleForValues namePolicy key
+          predicateName = predicateRef_name ref
+          class_name = pythonClassName predicateName
+          return_class_name = returnPythonClassName predicateName
+          addSumTypes = genAllPredicates DummyQuery [Text.empty] namePolicy
+            parent $ unionDummyPreds key pred class_name
+          anglePredicateAndVersion = case predicateMode of
+            AngleQuery -> predicateName <> "." <>
+              showt (predicateRef_version ref)
+            _ -> Text.empty
+          buildAngleTypes = case buildAngleTypes_ of
+            "" -> Text.empty
+            _ -> ", " <> buildAngleTypes_
+            where
+              buildAngleTypes_ = valueTy class_name ASTValues namePolicy key
+          mkEnumerator (i :: Int) val = "  " <> val <> " = " <> showt i
+  ]
+
+genNamedTypesClasses
+  :: ResolvedPredicateDef
+  -> [ResolvedTypeDef]
+  -> [ResolvedPredicateDef]
+genNamedTypesClasses pred types = map genTypePred $
+  filter (\(_, t, _) -> shouldGenClass t) $ map genType types
+  where
+    genTypePred (n, t, v) = PredicateDef (PredicateRef n v) t t
+      (predicateDefDeriving pred) (predicateDefSrcSpan pred)
+
+
+genNamedTypesAliases :: NamePolicy -> [ResolvedTypeDef] -> [Text]
+genNamedTypesAliases namePolicy types = map genTypeAlias $
+  filter (\(_, t, _) -> shouldGenAlias t) $ map genType types
+  where
+    genTypeAlias (n, t, _) = pythonClassName n <> " = " <> baseTy Text.empty namePolicy t
+
+
+shouldGenClass :: Type_ st pref tref -> Bool
+shouldGenClass t = case t of
+  RecordTy{} -> True
+  SumTy{} -> True
+  EnumeratedTy{} -> True
+  _ -> False
+
+shouldGenAlias :: Type_ st pref tref -> Bool
+shouldGenAlias t = not $ shouldGenClass t
+
+genType :: ResolvedTypeDef -> (TypeName, ResolvedType, Version)
+genType TypeDef{typeDefRef = TypeRef{..}, ..} =
+  (typeRef_name, typeDefType, typeRef_version)
+
+unionDummyPreds :: Type_ st PredicateRef tref
+  -> PredicateDef_ s st PredicateRef tref
+  -> Text
+  -> [PredicateDef_ s st PredicateRef tref]
+unionDummyPreds key pred class_name = map
+  (\(n, t) -> PredicateDef (predRef n) t t
+    (predicateDefDeriving pred) (predicateDefSrcSpan pred))
+  dummyPredicateGens
+  where
+    predRef n = PredicateRef (class_name <> "_" <> n) 0
+    dummyPredicateGens = case key of
+      RecordTy fields ->
+        concatMap (\f -> handleFields (fieldName f) (fieldDefType f)) fields
+      SumTy fields ->
+        concatMap (\f -> handleFields (fieldName f) (fieldDefType f)) fields
+      _ -> []
+      where
+        handleFields n t = case t of
+          SumTy fields ->
+            (n, SumTy fields) : concatMap extraRecords fields
+          RecordTy fields ->
+            (n, RecordTy fields) : concatMap extraRecords fields
+          _ -> []
+          where
+            extraRecords t = case fieldDefType t of
+              RecordTy fields ->
+                (n, RecordTy fields) : handleFields n (RecordTy fields)
+              SumTy fields -> handleFields n (SumTy fields)
+              _ -> []
+
+addClientMethods :: Text -> Text -> NamePolicy -> ResolvedType -> Text
+addClientMethods class_name kTy namePolicy key = methods
+  where
+    methods = case key of
+      SumTy fields ->Text.unlines $ map createMethodWrapper (unionFields fields)
+      _ -> createMethod Text.empty kTy
+    unionFields fields = map handleField fields
+    handleField f = (fieldName f,
+      (baseTy (class_name <> "_" <> fieldName f) namePolicy . fieldDefType) f)
+    createMethodWrapper (name, type_) =
+      createMethod ("_" <> name) (name <> ": " <> wrapOptionalArg type_)
+    createMethod method_name args = Text.unlines
+      [ "  " <> "@staticmethod"
+      , "  " <> "def angle_query" <> method_name <> "(*, " <> args <>
+        ") -> \"" <> class_name <> "\":"
+      , "    " <> "raise Exception" <>
+        "(\"this function can only be called from @angle_query\")"
+      ]
+
+header :: NameSpaces -> NamePolicy -> [ResolvedPredicateDef] -> Text
+header namespaces namePolicy preds = Text.unlines $
+  [ "# \x40generated"
+  , "# To regenerate this file run fbcode//glean/schema/gen/sync"
+  , "from typing import Optional, Tuple, Union, List, Dict, TypeVar"
+  , "from thrift.py3 import Struct"
+  , "from enum import Enum"
+  , "import ast"
+  , "from glean.schema.py.glean_schema_predicate import GleanSchemaPredicate"<>
+    " , Just, InnerGleanSchemaPredicate"
+  , "from glean.client.py3.angle_query import angle_for, R"
+  ] ++ addPythonImportsForKeys namespaces namePolicy preds
+
+pythonClassName :: Text -> Text
+pythonClassName c = Text.intercalate "" $ map cap1 $ Text.split (== '.') c
+
+returnPythonClassName :: Text -> Text
+returnPythonClassName c = last $ Text.split (== '.') c
+
+filenameToNamespace :: Text -> Text
+filenameToNamespace n = Text.concat $ Text.split (=='_') n
+
+namespaceToFileName :: [Text] -> Text
+namespaceToFileName n = Text.intercalate "_" n
+
+genTargets
+  :: HashMap NameSpaces ([NameSpaces], [ResolvedPredicateDef], [ResolvedTypeDef])
+  -> [(Text, [Text])]
+  -> Maybe Oncall
+  -> Text
+genTargets info extraImports oncall =
+  Text.unlines $
+     [ "# \x40generated"
+     , "# to regenerate: ./glean/schema/sync"
+     , "load(\"@fbcode_macros//build_defs:python_library.bzl\", " <>
+       "\"python_library\")"
+     , buckOncallAnnotation oncall
+     , ""
+     ] ++
+     [ "python_library("
+     , "  name = \"glean_schema_predicate\","
+     , "  srcs = [\"glean_schema_predicate.py\"],"
+     , "  deps = [\"//thrift/lib/py3:types\"],"
+     , ")"
+     , ""
+     ] ++
+     concatMap genTarget (HashMap.keys info)
+  where
+  genTarget ns =
+    let
+      namespace = underscored ns
+      extra = Data.Maybe.fromMaybe [""] (lookup (Text.concat ns) extraImports)
+    in
+    -- mini Python library for the module containing allPredicates
+    [ "python_library("
+    , "  name = \"" <> namespace <> "\","
+    , "  srcs = [\"" <> Text.concat ns <> ".py\"],"
+    , "  deps = ["
+    , "    " <> "\"//glean/schema/py:glean_schema_predicate\","
+    , "    " <> "\"//glean/schema/thrift:" <> namespace <> "-py3-types\","
+    , "    " <> "\"//thrift/lib/py3:types\","
+    , "    " <> "\"//glean/client/py3:angle_query\","
+    ] ++ extra ++
+    [ "  ]"
+    , ")"
+    , ""
+    ]
+
+data ValueTy = APIValues | ASTValues | AngleForValues
+  deriving (Eq, Show)
+
+-- | Generate a value type
+valueTy :: Text -> ValueTy -> NamePolicy -> ResolvedType -> Text
+valueTy predName mode namePolicy t = case t of
+  RecordTy fields -> handleFields fields
+  SumTy fields -> handleFields fields
+  _ -> if mode  == APIValues then defaultFieldName <> ": " <>
+        wrapOptionalArg (baseTy predName namePolicy t)
+       else if mode == ASTValues then defaultFieldName <> ": ast.Expr"
+       else " angle_for(__env, " <> defaultFieldName <> ", None" <> ")"
+
+  where
+    handleFields fields = case mode of
+      AngleForValues -> intercalatedFieldsWithBrackets
+      _ -> intercalatedFields
+      where
+        queryFields = map (createQueryField mode) fields
+        intercalatedFields = intercalateQueryFields queryFields
+        intercalatedFieldsWithBrackets = " \', \'.join(filter" <>
+         "(lambda x: x != '', [" <> intercalatedFields <> "]))"
+    createQueryField mode field = case mode of
+      APIValues -> appendType $ (wrapOptionalArg .
+        baseTy (predName <> "_" <> pythonVarName) namePolicy . fieldDefType)
+        field
+      ASTValues -> appendType "ast.Expr"
+      AngleForValues -> "angle_for(__env, " <> pythonVarName <> ", \'" <>
+       name <> "\')"
+      where
+          name = fieldDefName field
+          pythonVarName = from_ name
+          appendType t = pythonVarName <> ": " <> t
+    defaultFieldName = Text.pack "arg"
+
+from_ :: Text -> Text
+from_ name -- avoid Python keywords
+  | Text.unpack name `elem` pythonKeywords = "_" <> name
+  | otherwise = name
+  where
+    pythonKeywords = ["from", "str"]
+
+
+baseTy :: Text -> NamePolicy -> ResolvedType -> Text
+baseTy typeName namePolicy t = Text.pack $ case t of
+  NatTy{} -> "int"
+  BooleanTy{} -> "bool"
+  StringTy{} -> "str"
+  ByteTy{} -> "bytes"
+  PredicateTy _ pred -> nameLookup pred predNames namePolicy "predicate"
+  NamedTy _ typeRef -> nameLookup typeRef typeNames namePolicy "named"
+  ArrayTy field -> Text.unpack $ if type_ == "bytes"
+    then type_
+    else "List[" <> type_ <> "]"
+    where
+      type_ = baseTy typeName namePolicy field
+  MaybeTy field -> Text.unpack $
+    "Union[Just[" <> baseTy typeName namePolicy field <> "], Just[None]]"
+  _ -> Text.unpack $ "\'" <> typeName <> "\'"
+  where
+    nameLookup type_ names namePolicy errMessage =
+      case HashMap.lookup type_ (names namePolicy) of
+        Just (ns, x) -> Text.unpack $
+          "\"" <> Text.concat (map cap1 ns ++ [x]) <> "\""
+        _ -> error $ errMessage ++ "PythonName: " ++ show type_
+
+addPythonImportsForKeys
+  :: NameSpaces
+  -> NamePolicy
+  -> [ResolvedPredicateDef]
+  -> [Text]
+addPythonImportsForKeys namespaces namePolicy preds = map addImport $
+  predicateImports namespaces namePolicy preds
+
+  where
+    addImport :: Text -> Text
+    addImport imp =
+      "from glean.schema.py." <> filenameToNamespace imp <> " import *"
+
+addBuckImportsForKeys
+  :: NameSpaces
+  -> NamePolicy
+  -> [ResolvedPredicateDef]
+  -> [Text]
+addBuckImportsForKeys namespaces namePolicy preds = map addImport $
+  predicateImports namespaces namePolicy preds
+
+  where
+    addImport :: Text -> Text
+    addImport imp = "    " <> "\"//glean/schema/py:" <> imp <> "\","
+
+predicateImports :: NameSpaces -> NamePolicy -> [ResolvedPredicateDef] -> [Text]
+predicateImports namespaces namePolicy preds = filter
+  (\imp -> imp /= "" && imp /= current_namespace) $
+  mkUniq $ concatMap extractImports preds
+
+  where
+    current_namespace :: Text
+    current_namespace = namespaceToFileName namespaces
+
+    extractImports :: ResolvedPredicateDef -> [Text]
+    extractImports = extractPredicateImport namePolicy . predicateDefKeyType
+
+    extractPredicateImport :: NamePolicy -> ResolvedType  -> [Text]
+    extractPredicateImport namePolicy t = case t of
+      RecordTy fields -> map (extractImport namePolicy . fieldDefType) fields
+      SumTy fields -> map (extractImport namePolicy . fieldDefType) fields
+      _ -> [extractImport namePolicy t]
+      where
+        extractImport namePolicy t = Text.pack $ case t of
+          PredicateTy _ pred -> nameLookup pred predNames namePolicy "predicate"
+          NamedTy _ typeRef -> nameLookup typeRef typeNames namePolicy "named"
+          _ -> ""
+        nameLookup type_ names namePolicy errMessage =
+          case HashMap.lookup type_ (names namePolicy) of
+            Just (ns, _) -> Text.unpack $ namespaceToFileName ns
+            _ -> error $ errMessage ++ "PythonName: " ++ show type_
+
+fieldName :: FieldDef_ s PredicateRef tref -> Text
+fieldName = from_ . fieldDefName
+
+intercalateQueryFields :: [Text] -> Text
+intercalateQueryFields fields = Text.intercalate ", " fields
+
+wrapOptionalArg :: Text -> Text
+wrapOptionalArg arg = "Optional[" <> arg <> "] = None"
+
+mkUniq :: Ord a => [a] -> [a]
+mkUniq = toList . fromList
diff --git a/glean/schema/gen/Glean/Schema/Gen/Rust.hs b/glean/schema/gen/Glean/Schema/Gen/Rust.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Rust.hs
@@ -0,0 +1,363 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+-- | Glean's Rust schema generation
+--
+module Glean.Schema.Gen.Rust
+  ( genSchemaRust
+  ) where
+
+import Control.Monad
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import System.FilePath
+import TextShow
+
+import Glean.Schema.Gen.Utils
+import Glean.Angle.Types
+import Glean.Schema.Types
+import Glean.Types (SchemaId(..))
+import Data.List.Extra (nubOrd)
+
+genSchemaRust
+  :: SchemaId
+  -> Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath, Text)]
+genSchemaRust hash version preddefs typedefs _ =
+  [ ( dir </> Text.unpack (underscored namespaces) ++ ".rs"
+    , genNamespace namespaces version
+        hash namePolicy preds types)
+  | (namespaces, (_deps, preds, types)) <- HashMap.toList declsPerNamespace ]
+  where
+  dir = "schema"
+  namePolicy = mkNamePolicy preddefs typedefs
+  declsPerNamespace =
+    addNamespaceDependencies $ sortDeclsByNamespace preddefs typedefs
+
+{- -----------------------------------------------------------------------------
+
+We're going to generate:
+
+   python.rs
+   src.rs
+   builtin.rs
+   etc.
+
+-}
+
+genNamespace
+  :: NameSpaces
+  -> Version
+  -> SchemaId
+  -> NamePolicy
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Text
+genNamespace namespaces version
+    hash namePolicy preddefs typedefs
+ = Text.intercalate newline $
+    header : [Text.intercalate (newline <> newline) pieces]
+ where
+  someDecls = map PredicateDecl preddefs ++
+    map (\TypeDef{..} -> TypeDecl typeDefRef typeDefType) typedefs
+  ordered = orderDecls someDecls
+  (gen :: [[Text]], extra :: [Text]) = runM [] namePolicy typedefs $ do
+     ps <- mapM (genDecl namespaces) ordered
+     return (map fst ps ++ map snd ps)
+  pieces = concat gen ++ reverse extra
+
+  genDecl :: NameSpaces -> SomeDecl -> M ([Text],[Text])
+  genDecl ns (PredicateDecl p) = genPred ns p
+  genDecl ns (TypeDecl tref ty) = ([],) <$> genType ns tref ty
+
+  namespace = dotted namespaces
+
+  header = Text.unlines $
+    [ "/*"
+    , " * Copyright (c) Meta Platforms, Inc. and affiliates."
+    , " *"
+    , " * This source code is licensed under the MIT license found in the"
+    , " * LICENSE file in the root directory of this source tree."
+    , " *"
+    , " * \x40generated"
+    , " * Regenerate with glean/schema/gen/Glean/Schema/Gen/Rust.hs"
+    , " *  buck2 run glean/schema/gen:gen-schema -- --dir glean/schema/source --rust pyrefly/pyrefly/lib/report/glean"
+    , " */"
+    , ""
+    , "#![allow(warnings)]"
+    , "use serde::Deserialize;"
+    , "use serde::Serialize;"
+    , "use serde_json::Value;"
+    , ""
+    , "use crate::report::glean::schema::*;"
+    ] ++
+    -- builtin only
+    if namespace /= "builtin" then [] else
+    [ "// Schema version"
+    , "pub const VERSION: i64 = " <> showt version <> ";"
+    , "pub const SCHEMA_ID: &str = \"" <> unSchemaId hash <> "\";"
+    ]
+
+-- -----------------------------------------------------------------------------
+
+addExtraDecls :: M [Text] -> M [Text]
+addExtraDecls act = do
+  most <- act
+  extra <- popDefs
+  return (nubOrd (extra ++ most))
+
+indentLines :: [Text] -> [Text]
+indentLines = map (\t -> if Text.null t then t else "    " <> t)
+
+addIndent :: Int -> Text
+addIndent n = Text.replicate n "    "
+
+optionalize :: Text -> Text
+optionalize name = "Option<" <> safe name <> ">"
+
+box :: Text -> Text
+box name = "Box<" <> safe name <> ">"
+
+safe :: Text -> Text
+safe name
+  | name `elem`
+      [ "type", "super", "crate", "self", "as", "mut", "mod", "box"
+      , "ref", "const", "dyn", "use", "extern", "unsafe", "trait"
+      , "macro", "Value"
+      ]
+      = name <> "_"
+  | otherwise = if name == "builtin.Unit" then "builtin::Unit" else name
+
+shareTypeDef :: NameSpaces -> ResolvedType' s ->  M Text
+shareTypeDef here t = do
+  (no, name) <- nameThisType t
+  case no of
+    Old -> return ()
+    New -> do
+      let tref = TypeRef name 0
+      pushDefs =<< genType here tref t
+  return name
+
+rustTy :: NameSpaces -> ResolvedType' s -> M Text
+rustTy here t = case t of
+  -- Basic types
+  ByteTy{} -> return "u8"
+  NatTy{} -> return "u64"
+  BooleanTy{} -> return "bool"
+  StringTy{} -> return "String"
+  -- Containers
+  ArrayTy ByteTy -> return "Vec<u8>"
+  ArrayTy ty -> do
+    inner <- rustTy here ty
+    return $ "Vec<" <> inner  <> ">"
+  RecordTy{} -> shareTypeDef here t
+  SumTy{} -> shareTypeDef here t
+  SetTy ty -> do
+    inner <- rustTy here ty
+    return $ "Vec<" <> inner <> ">"
+  MaybeTy tInner -> do
+    inner <- rustTy here tInner
+    return (optionalize inner)
+  -- References
+  PredicateTy _ pred ->
+    rustName here <$> predicateName pred
+  NamedTy _ typeRef -> do
+    rustName here <$> typeName typeRef
+  EnumeratedTy _ -> shareTypeDef here t
+  TyVar{} -> error "rustTy: TyVar"
+  HasTy{} -> error "rustTy: HasTy"
+  HasKey{} -> error "rustTy: HasKey"
+  ElementsOf{} -> error "rustTy: ElementsOf"
+
+rustName :: NameSpaces -> (NameSpaces, Text) -> Text
+rustName here (ns, name)
+  | ns == here = safe name
+  | null ns = safe name
+  | Text.null (underscored ns) = safe name
+  | otherwise = underscored ns <> "::" <> safe name
+
+
+annotation :: Text
+annotation = "#[derive(Clone, Debug, Deserialize, Eq, Hash, "
+    <> "PartialEq, Serialize)]"
+
+wrapInBoxIf :: Bool -> Text -> Text
+wrapInBoxIf useBox text =
+  if useBox
+    then "Box::new(" <> text <> ")"
+    else text
+
+-- Returns a tuple of the param string and the construction string
+getFieldsForConstructor :: NameSpaces -> ResolvedType' s -> Text -> Text -> Bool
+                        -> M ([Text], Text)
+getFieldsForConstructor here ty typeName defaultParamName useBox = case ty of
+  RecordTy fields -> do
+      params <- forM fields $ \(FieldDef nm fieldTy) -> do
+        tyName <- withRecordFieldHint nm (rustTy here fieldTy)
+        return $ safe nm <> ": " <> tyName
+      let fieldAssignments = map (\(FieldDef nm _) -> safe nm) fields
+          construction = typeName <> " {"
+                          <>  "\n" <> addIndent 4
+                          <> Text.intercalate
+                              (",\n" <> addIndent 4)
+                              fieldAssignments <>
+                              "\n" <> addIndent 3 <> "}"
+      return (params, wrapInBoxIf useBox construction)
+
+  _ -> do
+    let param = defaultParamName <> ": " <> typeName
+    return ([param], wrapInBoxIf useBox defaultParamName)
+
+genPred :: NameSpaces -> ResolvedPredicateDef -> M ([Text], [Text])
+genPred here PredicateDef{..} = do
+  pName <- predicateName predicateDefRef
+  let
+    name = rustName here pName
+    type_id = "u64"
+
+  withPredicateDefHint (snd pName) $ do
+
+  let
+    appendName suffix = case pName of (ns, x) -> (ns, x <> suffix)
+    name_key = appendName "_key"
+    name_value = appendName "_value"
+    has_value = predicateDefValueType /= unitT
+
+
+  (type_key, define_key) <-
+    if shouldNameKeyType predicateDefKeyType
+      then define_kt here predicateDefKeyType name_key
+      else do
+        keyTy <- rustTy here predicateDefKeyType
+        return (keyTy, [])
+
+  -- Define a type for the value, only if it's not Unit
+  (type_value, define_value) <-
+    if not has_value
+        then return ("()", [])
+        else do
+            define_kt here predicateDefValueType name_value
+  -- Generate the new() function parameters and construction
+  (keyParams, keyConstruction) <-
+    getFieldsForConstructor here predicateDefKeyType type_key "key" True
+  (valueParams, valueConstruction) <-
+    if has_value
+      then getFieldsForConstructor here predicateDefValueType type_value "value" False
+      else return ([], "")
+  let allParams = keyParams ++ valueParams
+      paramList = Text.intercalate ", " allParams
+
+  let
+    -- Predicate struct definition
+    define = (:[]) $ myUnlines $ concat
+        [ [ annotation ]
+        , [ "pub struct " <> name <> " {" ]
+        , indentLines $ catMaybes
+          [ Just $ "pub id: " <> type_id <> ","
+          , Just $ "pub key: " <> box type_key <> ","
+          , if has_value
+            then Just $ "pub value: " <> type_value <> ","
+            else Nothing
+          ]
+        , [ "}" ]
+        , [ ""]
+        , [ "impl " <> name <> " {" ]
+        , indentLines
+            [ "pub fn GLEAN_name() -> String {"
+            , addIndent 1
+              <> "String::from(\""
+              <> predicateRef_name predicateDefRef
+              <> "."
+              <> showt (predicateRef_version predicateDefRef)
+              <> "\")"
+            , "}"
+            , ""
+            , "pub fn new(" <> paramList <> ") -> Self {"
+            , addIndent 1 <> name <> " {"
+            , addIndent 2 <> "id: 0,"
+            , addIndent 2 <> "key: " <> keyConstruction <> ","
+            ] ++
+            [addIndent 3
+              <> "value: " <> valueConstruction
+              <> ","
+            | has_value] ++
+            [ addIndent 2 <> "}"
+            , addIndent 1 <> "}"
+            ]
+        , [ "}" ]
+        ]
+  extra <- popDefs
+  return (define,  nubOrd (extra ++ define_key ++ define_value))
+
+define_kt ::
+  NameSpaces -> ResolvedType -> (NameSpaces, Text) -> M (Text, [Text])
+define_kt here typ name_kt = do
+  let gname = joinDot name_kt
+      tref = TypeRef gname 0
+  ref <- rustTy here (NamedTy () (TypeRef gname 0))
+  def <- genType here tref typ
+  return (ref,def)
+
+makeEnum :: Text -> [Name] -> M [Text]
+makeEnum name vals = do
+  let
+    variants = Text.unlines $ indentLines (map (<> ",") vals)
+    declare = annotation <> newline
+      <> "pub enum " <> name <> " {" <> newline <> variants <> "}"
+  return [declare]
+
+
+genType :: NameSpaces -> TypeRef -> ResolvedType' s -> M [Text]
+genType here tref ty = addExtraDecls $ do
+  tName@(_, root) <- typeName tref
+  let name = rustName here tName
+
+  withTypeDefHint root $ do
+  case ty of
+    RecordTy fields -> do
+        fieldTexts <- forM fields $ \(FieldDef nm ty) -> do
+          tyName <- withRecordFieldHint nm (rustTy here ty)
+          return $ "pub " <> safe nm <> ": " <> tyName <> ","
+        let
+          define | null fields =
+            annotation <> newline <>
+            "pub struct " <> name <> " {}"
+                | otherwise = myUnlines $ concat
+            [ [ annotation ]
+            , [ "pub struct " <> name <> " {" ]
+            , indentLines fieldTexts
+            , [ "}" ]
+            ]
+        return [define]
+    SumTy fields -> do
+        variantTexts <- forM fields $ \(FieldDef nm ty) -> do
+          tyName <- withUnionFieldHint nm (rustTy here ty)
+          return $ safe nm <> "(" <> safe tyName <> "),"
+        let
+          define | null fields =
+            annotation <> newline <>
+            "pub enum " <> name <> " {}"
+                 | otherwise = myUnlines $ concat
+            [ [ annotation ]
+            , [ "pub enum " <> name <> " {" ]
+            , indentLines variantTexts
+            , [ "}" ]
+            ]
+        return [define]
+
+    EnumeratedTy vals -> makeEnum name vals
+
+    _other_ty -> do
+      t <- rustTy here ty
+      return ["pub type " <> name <> " = " <> t <> ";"]
diff --git a/glean/schema/gen/Glean/Schema/Gen/Thrift.hs b/glean/schema/gen/Glean/Schema/Gen/Thrift.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Thrift.hs
@@ -0,0 +1,544 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE OverloadedStrings #-}
+-- | Glean's first auto-generation attempt
+--
+-- Run with
+--
+-- >  ./buck-out/opt/gen/glean/hs/predicates --thrift=predicates.thrift
+--
+-- Create fbcode/glean/if/predicates.thrift
+--
+module Glean.Schema.Gen.Thrift
+  ( genSchemaThrift
+  ) where
+
+import Control.Monad
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import System.FilePath
+import TextShow
+
+import Glean.Schema.Gen.Utils
+import Glean.Angle.Types
+import Glean.Schema.Types
+import Glean.Types (SchemaId(..))
+
+genSchemaThrift
+  :: Maybe String
+  -> SchemaId
+  -> Version
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Maybe Oncall
+  -> [(FilePath, Text)]
+genSchemaThrift versionDir hash version preddefs typedefs oncall =
+  (dir </> "TARGETS",
+    genTargets slashVn declsPerNamespace oncall) :
+  [ ( dir </> Text.unpack (underscored namespaces) ++ ".thrift"
+    , genNamespace slashVn namespaces version
+        hash namePolicy deps preds types)
+  | (namespaces, (deps, preds, types)) <- HashMap.toList declsPerNamespace ]
+  where
+  dir = "thrift"
+
+  slashVn = case versionDir of
+    Nothing -> ""
+    Just str -> "/" <> Text.pack str
+  namePolicy = mkNamePolicy preddefs typedefs
+  declsPerNamespace =
+    addNamespaceDependencies $ sortDeclsByNamespace preddefs typedefs
+
+
+genTargets
+  :: Text   -- "/v1" or ""
+  -> HashMap NameSpaces
+    ([NameSpaces], [ResolvedPredicateDef], [ResolvedTypeDef])
+  -> Maybe Oncall
+  -> Text
+genTargets slashVn info oncall =
+  Text.unlines
+     ([ "# \x40generated"
+     , "# to regenerate: ./glean/schema/sync"
+     , "load(\"@fbcode_macros//build_defs:custom_rule.bzl\", \"custom_rule\")"
+     , "load(\"@fbcode_macros//build_defs:thrift_library.bzl\", \"thrift_library\")"
+     , buckOncallAnnotation oncall
+     , "" ] ++
+     concatMap genTarget (HashMap.toList info))
+  where
+  genTarget (ns, (deps, nsPredicates, _)) =
+    let
+      namespace = underscored ns
+      cppSplits = showt $ min 20 (max 1 (length nsPredicates))
+    in
+    [ "thrift_library("
+    , "  name = \"" <> namespace <> "\","
+    , "  hs_namespace = \"" <> hsNamespace <> "\","
+    , "  py3_namespace = \"" <> py3Namespace <> "\","
+    , "  py_base_module = \"" <> pyBaseModule <> "\","
+    ] ++
+    [ "  hs_includes = [\"" <> namespace <> "_include.hs\"]," ] ++
+    [ "  thrift_rust_options = ["
+    , "    \"serde\","
+    , "    \"skip_none_serialization\","
+    , "    \"deprecated_default_enum_min_i32\","
+    , "],"
+    , "  thrift_cpp2_options = [" <> Text.intercalate ", " [
+      "\"json\"",
+      "\"types_cpp_splits=" <> cppSplits <> "\""
+      ] <> "],"
+    , "  thrift_py_options = \"utf8strings\","
+    , "  languages = [" <> Text.intercalate ", " langs <> "],"
+    , "  thrift_srcs = { \"" <> namespace <> ".thrift\" : [] },"
+    , "  deps = [" <> Text.intercalate ","
+      ( "\"//glean/if:glean\"" : depTargets ) <>
+      ", \"//thrift/annotation:rust\"" <>
+      ", \"//thrift/annotation:thrift\"],"
+    , "  hs2_deps = ["
+    , "    \"//glean/hs:angle\","
+    , "    \"//glean/hs:typed\","
+    , "    \"//glean/hs:query-angle\","
+    , "    \"//glean/if:glean-hs2\","
+    ] ++
+    [ "  ],"
+    , ")"
+    ]
+    where
+    depTargets =
+      [ "\"//" <> thriftDir slashVn <> ":" <> underscored dep <> "\""
+      | dep <- deps ]
+
+    langs :: [Text]
+    langs = map (\x -> "\"" <> x <> "\"") [
+        "hs2",
+        "py-deprecated",
+        "py3-deprecated",
+        "python",
+        "java-swift",
+        "rust",
+        "cpp2"
+        ]
+
+thriftDir :: Text -> Text
+thriftDir slashVn = "glean/schema" <> slashVn <> "/thrift"
+
+package :: Text
+package = "facebook.com/glean/schema"
+
+hsNamespace :: Text
+hsNamespace = "Glean.Schema"
+
+cpp2Namespace :: Text
+cpp2Namespace = "facebook.glean.schema"
+
+phpNamespace :: Text
+phpNamespace = "glean_schema"
+
+pyBaseModule :: Text
+pyBaseModule = "glean.schema"
+
+py3Namespace :: Text
+py3Namespace = "glean.schema"
+
+javaBaseModule :: Text
+javaBaseModule = "com.facebook.glean.schema"
+
+rustBaseModule :: Text
+rustBaseModule = "glean_schema"
+
+{- -----------------------------------------------------------------------------
+Namespaces
+
+We're going to generate:
+
+   sys.thrift
+   cxx.thrift
+   buck.thrift
+   clang.thrift
+   clang_pp.thrift
+   etc.
+
+inside cxx.thrift we will have
+
+  import clang.thrift -- refer to things in here as clang.Foo
+
+  namespace hs Glean.Schema  -- module will be Glean.Schema.Cxx
+  namespace py glean.schema.cxx -- module will be glean.schema.cxx
+  namespace php glean_schema
+
+  struct RecordDeclaration {
+    1: clang.Class name;
+    ...
+  }
+-}
+
+genNamespace
+  :: Text                               -- "/v1" or ""
+  -> NameSpaces
+  -> Version
+  -> SchemaId
+  -> NamePolicy
+  -> [NameSpaces]
+  -> [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> Text
+genNamespace slashVn namespaces version
+    hash namePolicy deps preddefs typedefs
+ = Text.intercalate (newline <> newline) (header : pieces)
+ where
+  someDecls = map PredicateDecl preddefs ++
+    map (\TypeDef{..} -> TypeDecl typeDefRef typeDefType) typedefs
+  ordered = orderDecls someDecls
+  (gen :: [[Text]], extra :: [Text]) = runM [] namePolicy typedefs $ do
+     ps <- mapM (genDecl namespaces) ordered
+     return (map fst ps ++ map snd ps)
+  pieces = concat gen ++ reverse extra
+
+  genDecl :: NameSpaces -> SomeDecl -> M ([Text],[Text])
+  genDecl ns (PredicateDecl p) = genPred ns p
+  genDecl ns (TypeDecl tref ty) = ([],) <$> genType ns tref ty
+
+  namespace = dotted namespaces
+
+  preddefToVersionPair :: ResolvedPredicateDef -> M Text
+  preddefToVersionPair PredicateDef{..} = do
+    (_, name) <- predicateName predicateDefRef
+    let ver = showt (predicateRef_version predicateDefRef)
+      in return $ "\"" <> name <> "\": " <> ver <> ","
+
+  predicateVersionPairs = fst $
+    runM [] namePolicy typedefs (mapM preddefToVersionPair preddefs)
+
+  predicateVersionMap =
+    [ "const map<string, i64> PREDICATE_VERSIONS = {" ] ++
+    indentLines predicateVersionPairs ++
+    [ "}" ]
+
+  header = Text.unlines $
+    [ "// To re-generate this file:"
+    , "//"
+    , "//   ./glean/schema/sync"
+    , "//"
+    , "// \x40generated"
+    , "// @" <> "nolint"
+    , ""
+    , "include \"glean/if/glean.thrift\""
+    , "include \"thrift/annotation/rust.thrift\""] ++
+    [ "include \"" <> thriftDir slashVn <> "/" <> underscored dep
+        <> ".thrift\""
+    | dep <- deps ] ++
+    [ "include \"thrift/annotation/thrift.thrift\""
+    , ""
+    , allowReservedFilenameAnnotation (underscored namespaces)
+    <> "package \"" <> package <> "/" <> underscored namespaces <> "\""
+    ] ++
+    [ ""
+    , "namespace cpp2 " <> cpp2Namespace <> "." <> dotted namespaces
+    , "namespace hs " <> hsNamespace
+    , "namespace php " <> phpNamespace <> "_" <> underscored namespaces
+    , "namespace py " <> pyBaseModule <> "." <> underscored namespaces
+    , "namespace py3 " <> py3Namespace
+    , "namespace java.swift " <> javaBaseModule <> "."
+      <> underscored namespaces
+    , "namespace rust " <> rustBaseModule <> "_" <> underscored namespaces
+    , ""
+    ] ++
+    [ "hs_include \"glean/schema" <> slashVn
+      <> "/thrift/"
+      <>  underscored namespaces <> "_include.hs\""
+    ] ++
+    predicateVersionMap ++
+    -- builtin only
+    if namespace /= "builtin" then [] else
+    [ "// Schema version"
+    , "const i64 version = " <> showt version
+    , "const glean.SchemaId schema_id = " <> Text.pack (show (unSchemaId hash))
+    ]
+
+
+
+-- -----------------------------------------------------------------------------
+
+allowReservedFilenameAnnotation :: Text -> Text
+allowReservedFilenameAnnotation = allowReservedIdentifier "Filename"
+
+allowReservedIdentifierAnnotation :: Text -> Text
+allowReservedIdentifierAnnotation = allowReservedIdentifier "Identifier"
+
+allowReservedIdentifier :: Text -> Text -> Text
+allowReservedIdentifier annotation identifier
+    | "fbthrift"
+      == Text.toLower (Text.take (Text.length "fbthrift") (Text.dropWhile (=='_') identifier))
+        = "@thrift.AllowReserved" <> annotation <> " "
+    | otherwise = ""
+
+
+addExtraDecls :: M [Text] -> M [Text]
+addExtraDecls act = do
+  most <- act
+  extra <- popDefs
+  return (extra ++ most)
+
+indentLines :: [Text] -> [Text]
+indentLines = map (\t -> if Text.null t then t else "  " <> t)
+
+-- The schema validator has assumed that we don't have any problematic
+-- identifiers, so we can just use the name directly.
+
+optionalize :: Text -> Text
+optionalize name = "optional " <> name
+
+shareTypeDef :: NameSpaces -> ResolvedType' s -> M Text
+shareTypeDef here t = do
+  (no, name) <- nameThisType t
+  case no of
+    Old -> return ()
+    New -> do
+      let tref = TypeRef name 0
+      pushDefs =<< genType here tref t
+  return name
+
+
+thriftTy :: NameSpaces -> ResolvedType' s -> M Text
+thriftTy here t = case t of
+  -- Basic types
+  ByteTy{} -> return "glean.Byte"
+  NatTy{} -> return "glean.Nat"
+  BooleanTy{} -> return "bool"
+  StringTy{} -> return "string"
+  -- Containers
+  ArrayTy ByteTy -> return "binary"
+  ArrayTy ty -> do
+    inner <- thriftTy here ty
+    return $ "list<" <> inner  <> ">"
+  RecordTy{} -> shareTypeDef here t
+  SumTy{} -> shareTypeDef here t
+  SetTy ty -> do
+    inner <- thriftTy here ty
+    return $ "list<" <> inner <> ">"
+  MaybeTy tInner -> do
+    inner <- thriftTy here tInner
+    return (optionalize inner)
+  -- References
+  PredicateTy _ pred ->
+    thriftName here <$> predicateName pred
+  NamedTy _ typeRef -> do
+    thriftName here <$> typeName typeRef
+  EnumeratedTy _ -> shareTypeDef here t
+  TyVar{} -> error "thriftTy: TyVar"
+  HasTy{} -> error "thriftTy: HasTy"
+  HasKey{} -> error "thriftTy: HasKey"
+  ElementsOf{} -> error "thriftTy: ElementsOf"
+
+mkField :: [Text] -> [Text] -> Text -> Int -> Name -> Text -> Text
+mkField structuredAnnots unstructuredAnnots structOrUnion i p t =
+  structuredAnnotText <> allowReservedIdentifierAnnotation p
+    <> showt i <> ": " <> t <> " " <> p <> unstructuredAnnotText <> ";"
+  where
+  structuredAnnotText =
+    Text.concat $ map (\annot -> annot <> newline <> "  ") structuredAnnots
+
+  -- The java.swift codegen likes to strip underscores from the end of
+  -- names for some reason.
+  javaUnstructuredAnnot
+    | "_" `Text.isSuffixOf` p = ["java.swift.name = \"" <> p <> "\""]
+    | otherwise = []
+
+  py3UnstructuredAnnot
+    | p == "from" = ["py3.name = \"from_\""]
+    | p == "type" && structOrUnion == "union"  = ["py3.name = \"type_\""]
+    | p == "name" && structOrUnion == "union" = ["py3.name = \"name_\""]
+    | p == "value" && structOrUnion == "union" = ["py3.name = \"value_\""]
+    | otherwise = []
+
+  allUnstructuredAnnots =
+    javaUnstructuredAnnot ++ py3UnstructuredAnnot ++ unstructuredAnnots
+
+  unstructuredAnnotText
+    | null allUnstructuredAnnots = ""
+    | otherwise = " (" <> Text.intercalate ", " allUnstructuredAnnots <> ")"
+
+makeField :: Text -> Int -> Name -> Text -> Text
+makeField = mkField [] []
+
+makeRefField :: Text -> Int -> Name -> Text -> Text
+makeRefField = mkField
+  [ "@rust.Box" ]
+  [ "cpp.ref = \"true\""
+  , "cpp2.ref = \"true\""
+  , "swift.recursive_reference = \"true\""
+  ]
+
+genPred :: NameSpaces -> ResolvedPredicateDef -> M ([Text], [Text])
+genPred here PredicateDef{..} = do
+  let structOrUnion = "struct"
+
+  pName <- predicateName predicateDefRef
+  let name = thriftName here pName
+
+  withPredicateDefHint (snd pName) $ do
+
+  keyNeedsRef <- needsRefType predicateDefKeyType
+  valNeedsRef <- needsRefType predicateDefValueType
+
+  let
+    appendName suffix = case pName of (ns, x) -> (ns, x <> suffix)
+
+    name_id = appendName "_id"
+    name_key = appendName "_key"
+    name_value = appendName "_value"
+    has_value = predicateDefValueType /= unitT
+
+    -- key and value are optional
+    maybeOpt = optionalize
+    maybeRef needed
+      | needed = makeRefField structOrUnion
+      | otherwise = makeField structOrUnion
+
+  -- generate
+  --   typedef Foo_id = glean.Id
+  -- These aren't very useful except for documentation purposes, so that
+  -- you can refer to an Id by its typeref name in APIs.
+  (type_id, define_id) <- do
+    let target_type = NamedTy () (TypeRef "glean.Id" 0)
+    type_id <- thriftTy here target_type
+    new_alias <- thriftTy here (NamedTy () (TypeRef (joinDot name_id) 0))
+    let name = thriftName here name_id
+        d = allowReservedIdentifierAnnotation name <> "typedef "
+          <> type_id <> " " <> name
+    return (new_alias, d)
+
+  (type_key, define_key) <-
+    if shouldNameKeyType predicateDefKeyType
+      then define_kt here predicateDefKeyType name_key
+      else do
+        keyTy <- thriftTy here predicateDefKeyType
+        return (keyTy, [])
+
+  -- Define a type for the value, only if it's not Unit
+  (type_value, define_value) <-
+    if not has_value then return ("^", []) else do
+      define_kt here predicateDefValueType name_value
+  let
+    annotation = myUnlines
+      [ "@glean.PredicateAnnotation" <> "{"
+      , myUnlines . indentLines $
+        [ "name=\"" <> predicateRef_name predicateDefRef <> "\";"
+        , "version=" <> showt (predicateRef_version predicateDefRef)  <> ";"
+        ]
+      , "}"
+      , "@rust.Ord"
+      ]
+
+    -- Predicate types can be recursive so those need to be refs in C++.
+    key i = Just $ maybeRef keyNeedsRef i "key" (maybeOpt type_key)
+    val i
+      | has_value = Just $ maybeRef valNeedsRef i "value" (maybeOpt type_value)
+      | otherwise = Nothing
+    define = (:[]) $ myUnlines . concat $
+      [ [ annotation ]
+      , [ allowReservedIdentifierAnnotation name
+        <> structOrUnion <> " " <> name <> " {" ]
+      , indentLines . catMaybes . zipWith (flip ($)) [1..] $
+        [ \i -> Just $ mkField [] ["hs.strict"] structOrUnion i "id" type_id
+        , key, val ]
+      , [ "}" ]
+      ]
+  extra <- popDefs
+  return (define_id : define,  extra ++ define_key ++ define_value)
+
+needsRefType :: ResolvedType -> M Bool
+needsRefType t = do
+  realType <- repType t
+  case realType of
+    Nothing ->
+      -- type not found in this module or known imported environment,
+      -- so no recusive loop, so we do not need a ref type
+      return False
+    Just rep -> case rep of
+      RecordTy{} -> return True
+      SumTy{} -> return True
+      PredicateTy{} -> return True
+      ArrayTy t -> needsRefType t
+      MaybeTy t -> needsRefType t
+      _ -> return False
+
+-- Make the thriftTy type text, and the [Text] declaration block
+define_kt ::
+  NameSpaces -> ResolvedType -> (NameSpaces, Text) -> M (Text, [Text])
+define_kt here typ name_kt = do
+  let gname = joinDot name_kt
+      tref = TypeRef gname 0
+  ref <- thriftTy here (NamedTy () (TypeRef gname 0))
+  def <- genType here tref typ
+  return (ref,def)
+
+makeEnumerated :: Text -> [Name] -> M [Text]
+makeEnumerated name vals = do
+  let
+    pieces = Text.intercalate "," (zipWith mkEnumerator [0..] vals)
+    declare = allowReservedIdentifierAnnotation name
+      <> "enum " <> name <> " {" <> pieces <> "\n}"
+  return [declare]
+  where
+    mkEnumerator (i :: Int) val = "\n  "
+      <> allowReservedIdentifierAnnotation val
+      <> val <> " = " <> showt i <> annotText
+      where
+        -- I do not think we need py3.name for type to type_ here
+        py3Annot
+          | val == "name" = ["py3.name = \"name_\""]
+          | val == "value" = ["py3.name = \"value_\""]
+          | otherwise = []
+        annotText
+          | null py3Annot = ""
+          | otherwise = " (" <> Text.intercalate ", " py3Annot <> ")"
+
+genType :: NameSpaces -> TypeRef -> ResolvedType' s -> M [Text]
+genType here tref ty = addExtraDecls $ do
+  tName@(_, root) <- typeName tref
+  let name = thriftName here tName
+
+  withTypeDefHint root $ do
+
+  let
+    structLike structOrUnion fields withFieldHint extraFields = do
+      fieldTexts <- forM (zip [1..] fields) $ \(ix, FieldDef nm ty) -> do
+         tyName <- withFieldHint nm (thriftTy here ty)
+         return $ makeField structOrUnion ix nm tyName
+      let
+        define | null fields =
+          "@rust.Ord\n" <>
+          allowReservedIdentifierAnnotation name
+          <> "struct " <> name <> " {}"
+               | otherwise = myUnlines $ concat
+          [ [ "@rust.Ord\n"
+            <> allowReservedIdentifierAnnotation name
+            <> structOrUnion <> " " <> name <> " {" ]
+          , indentLines (fieldTexts ++ extraFields)
+          , [ "}" ]
+          ]
+      return [define]
+
+  case ty of
+    RecordTy fields -> structLike "struct" fields withRecordFieldHint []
+    SumTy fields -> structLike structOrUnion fields withUnionFieldHint anyField
+      where
+        structOrUnion = "union"
+        anyField = []
+
+    EnumeratedTy vals -> makeEnumerated name vals
+
+    _other_ty -> do
+      t <- thriftTy here ty
+      return [allowReservedIdentifierAnnotation name
+        <> "typedef " <> t <> " " <> name]
diff --git a/glean/schema/gen/Glean/Schema/Gen/Utils.hs b/glean/schema/gen/Glean/Schema/Gen/Utils.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/gen/Glean/Schema/Gen/Utils.hs
@@ -0,0 +1,486 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Schema.Gen.Utils
+  ( -- * Types
+    unitT
+  , isByt
+  , shouldNameKeyType
+    -- * Dependency analysis
+  , SomeDecl(..)
+  , orderDecls
+    -- * Names and namespaces
+  , NameSpaces
+  , splitDot
+  , joinDot
+  , dotted
+  , underscored
+  , sortDeclsByNamespace
+    -- * Text utils
+  , myUnlines
+  , newline
+  , cap1
+  , low1
+    -- * Monad for code generation
+  , M
+  , Env
+  , NamePolicy(..)
+  , mkNamePolicy
+  , runM
+  , typeDef
+  , repType
+  , NewOrOld(..)
+  , nameThisType
+  , withPredicateDefHint
+  , withRecordFieldHint
+  , withUnionFieldHint
+  , withTypeDefHint
+  , withTopLevelHint
+  , pushDefs
+  , popDefs
+  , predicateName
+  , typeName
+  , thriftName
+  , haskellThriftName
+  , addNamespaceDependencies
+  , buckOncallAnnotation
+  , Oncall
+  ) where
+
+import Control.Monad.Reader
+import Control.Monad.State
+import Data.Graph
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import qualified Data.Text as Text
+import TextShow
+
+import Util.List
+
+import Glean.Angle.Types
+import Glean.Schema.Types
+import Glean.Schema.Util
+
+
+-- -----------------------------------------------------------------------------
+-- Types
+
+unitT :: ResolvedType
+unitT = RecordTy []
+
+isByt :: ResolvedType -> Bool
+isByt ByteTy = True
+isByt _ = False
+
+-- | Return 'True' if we should generate a new type in Thrift for a
+-- predicate key type.  If the type is a base type or is already a
+-- typedef, there's no need to generate a new named type.
+shouldNameKeyType :: ResolvedType -> Bool
+shouldNameKeyType RecordTy{} = True
+shouldNameKeyType SumTy{} = True
+shouldNameKeyType _ = False
+
+-- -----------------------------------------------------------------------------
+-- Dependency analysis of decls
+
+data SomeDecl
+  = PredicateDecl ResolvedPredicateDef
+  | TypeDecl TypeRef ResolvedType
+
+type Node = (Name,Version)
+
+-- | Sort the declarations to keep C++ Happy.
+orderDecls :: [SomeDecl] -> [SomeDecl]
+orderDecls decls = map betterNotBeAnyCyclesIn sccs
+ where
+  betterNotBeAnyCyclesIn (AcyclicSCC one) = one
+  betterNotBeAnyCyclesIn (CyclicSCC defs) =
+    error $ "cycle: " ++ unwords (map (show . declNode) defs)
+
+  sccs = stronglyConnComp
+    [ (decl, declNode decl, outEdges decl) | decl <- decls ]
+
+  declNode :: SomeDecl -> (Name,Version)
+  declNode (PredicateDecl PredicateDef{..}) =
+    (predicateRef_name predicateDefRef, predicateRef_version predicateDefRef)
+  declNode (TypeDecl tref _) =
+    (typeRef_name tref, typeRef_version tref)
+
+  outEdges :: SomeDecl -> [Node]
+  outEdges d = case d of
+    PredicateDecl PredicateDef{..} ->
+      outEdgesTs [predicateDefKeyType, predicateDefValueType]
+    TypeDecl _ ty ->
+      outEdgesT ty
+
+  outEdgesTs = concatMap outEdgesT
+  outEdgesFields fields = outEdgesTs [ ty | FieldDef _ ty <- fields ]
+
+  outEdgesT :: ResolvedType -> [Node]
+  outEdgesT ByteTy{} = []
+  outEdgesT NatTy{} = []
+  outEdgesT BooleanTy{} = []
+  outEdgesT StringTy{} = []
+  outEdgesT (ArrayTy ty) = outEdgesT ty
+  outEdgesT (MaybeTy ty) = outEdgesT ty
+  outEdgesT (RecordTy fields)  = outEdgesFields fields
+  outEdgesT (SumTy fields)  = outEdgesFields fields
+  outEdgesT (SetTy ty) = outEdgesT ty
+  outEdgesT (NamedTy _ (TypeRef name ver)) = [(name,ver)]
+  outEdgesT PredicateTy{} = [] -- See Note [predicate type references]
+  outEdgesT EnumeratedTy{} = []
+  outEdgesT TyVar{} = error "outEdgesT: TyVar"
+  outEdgesT HasTy{} = error "outEdgesT: HasTy"
+  outEdgesT HasKey{} = error "outEdgesT: HasKey"
+  outEdgesT ElementsOf{} = error "outEdgesT: ElementsOf"
+
+{- Note [predicate type references]
+
+In a struct definition, references to predicates look like this:
+
+  struct SrcLoc {
+    Fact<File> file;
+    ...
+  }
+
+The structure of Fact<P> doesn't depend on the full definition of
+P, it's enough to have a "struct P;" declaration, which we have for
+all predicates.
+
+In a predicate definition, references to other predicates are like this:
+
+  struct Target : Predicate<Sys::Blob> {..}
+
+And Predicate<> contains types only, so this also doesn't need the
+full definition of Sys::Blob.
+
+Therefore, we conclude that predicate references do not constitute a
+dependency for the purposes of ordering definitions, and this enables
+us to break all cycles involving predicates.  There can of course be
+no cycles between typedefs; these will cause an error.
+-}
+
+-- -----------------------------------------------------------------------------
+-- Names and namespaces
+
+-- Convenience to split a name
+
+joinDot :: (NameSpaces, Text) -> Text
+joinDot (ns,t) = Text.intercalate "." (ns ++ [t])
+
+dotted :: NameSpaces -> Text
+dotted = Text.intercalate "."
+
+underscored :: NameSpaces -> Text
+underscored = Text.intercalate "_"
+
+sortDeclsByNamespace
+  :: [ResolvedPredicateDef]
+  -> [ResolvedTypeDef]
+  -> HashMap NameSpaces ([ResolvedPredicateDef], [ResolvedTypeDef])
+sortDeclsByNamespace preds types =
+  HashMap.fromListWith combine $
+    [ (namespace, ([pred],[]))
+    | pred@PredicateDef{..} <- preds
+    , let (namespace,_) = splitDot (predicateRef_name predicateDefRef) ] ++
+    [ (namespace, ([],[tdef]))
+    | tdef@TypeDef{..} <- types
+    , let (namespace,_) = splitDot (typeRef_name typeDefRef)  ]
+  where
+    combine (as,bs) (cs,ds) = (as++cs, bs++ds)
+
+-- -----------------------------------------------------------------------------
+-- Text Utils
+
+-- | Better than Text.unlines for codegen purposes
+myUnlines :: [Text] -> Text
+myUnlines = Text.intercalate newline
+          . map Text.stripEnd
+          . dropWhile Text.null . dropWhileEnd Text.null
+  where
+    dropWhileEnd :: (a -> Bool) -> [a] -> [a]
+    dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) []
+
+newline :: Text
+newline = Text.pack "\n"
+
+cap1 :: Text -> Text
+cap1 tIn = if Text.null tIn then tIn else
+  let (h, t) = Text.splitAt 1 tIn
+  in Text.toUpper h <> t
+
+low1 :: Text -> Text
+low1 tIn = if Text.null tIn then tIn else
+  let (h, t) = Text.splitAt 1 tIn
+  in Text.toLower h <> t
+
+-- -----------------------------------------------------------------------------
+
+-- | Thrift must turn tuples into named structures.  Solve the hard
+-- problem of naming inside monad M
+type M = ReaderT Env (State ExtraDefs)
+
+type ExtraDefs = [Text]
+
+data Env = Env
+  { nameHint :: [Text]
+      -- ^ stack of "hints": name components that will be used to
+      -- to name an anonymous type from the schema. The hint at
+      -- any given point is unique: a type generated from this name
+      -- will not clash with anything else.
+      --
+      -- Note: the 'Text' are sometimes 'Safe' and sometimes not 'Safe'
+  , namePolicy :: NamePolicy
+  , typeEnv :: HashMap (Name, Version) ResolvedTypeDef
+  }
+
+data NamePolicy = NamePolicy
+  { predNames :: HashMap PredicateRef (NameSpaces,Text)
+  , typeNames :: HashMap TypeRef (NameSpaces,Text)
+  }
+
+mkNamePolicy :: [ResolvedPredicateDef] -> [ResolvedTypeDef] -> NamePolicy
+mkNamePolicy preds types = NamePolicy{..}
+  where
+  nameMap = HashMap.fromListWith (++) $
+    [ (predicateRef_name predicateDefRef,
+       [predicateRef_version predicateDefRef])
+    | PredicateDef{..} <- preds ] ++
+    [ (typeRef_name typeDefRef, [typeRef_version typeDefRef])
+    | TypeDef{..} <- types ]
+
+  -- Figure out how we're going to name each predicate. The most
+  -- recent version of P gets to be called P, all the older versions
+  -- are called P_v.
+  predNames = HashMap.fromList
+    [ let
+        (ns, name) = splitDot predicateRef_name
+      in
+      if predicateRef_version == maximum versions
+        then (predicateDefRef, (ns, name))
+        else (predicateDefRef, (ns, name <> "_" <> showt predicateRef_version))
+    | PredicateDef{..} <- preds
+    , let PredicateRef{..} = predicateDefRef
+    , Just versions <- [HashMap.lookup predicateRef_name nameMap] ]
+
+  -- Similarly for type names.
+  typeNames = HashMap.fromList
+    [ let
+        (ns, name) = splitDot typeRef_name
+      in
+      if typeRef_version == maximum versions
+        then (typeDefRef, (ns, name))
+        else (typeDefRef, (ns, name <> "_" <> showt typeRef_version))
+    | TypeDef{..} <- types
+    , let TypeRef{..} = typeDefRef
+    , Just versions <- [HashMap.lookup typeRef_name nameMap] ]
+
+
+-- | Look up the name to use for a predicate, taking into account versions
+predicateName :: Monad m => PredicateRef -> ReaderT Env m (NameSpaces, Text)
+predicateName pred = do
+  Env{..} <- ask
+  case HashMap.lookup pred (predNames namePolicy) of
+    Just (ns,x) -> return (ns,x)
+    _ -> error $ "predicateThriftName: " ++ show pred
+
+-- | Look up the name to use for a type, taking into account versions
+typeName :: Monad m => TypeRef -> ReaderT Env m (NameSpaces, Text)
+typeName typeref = do
+  Env{..} <- ask
+  case HashMap.lookup typeref (typeNames namePolicy) of
+    Just (ns,x) -> return (ns,x)
+    Nothing ->
+      -- it's one we invented, the name should be unique
+      return (splitDot (typeRef_name typeref))
+
+-- | The textual name to use for an entity relative to the current namespace
+thriftName :: NameSpaces -> (NameSpaces, Text) -> Text
+thriftName here (ns, x)
+  | here == ns = getSafe $ safeThrift x
+  | otherwise = getSafe $ case ns of
+    [] -> checkSafe ("thriftName " ++ show (here,(ns,x))) x
+    _  -> Safe $ underscored ns <> "." <> getSafe (safeThrift x)
+
+-- | Witness that the name is fully mangled (see 'safeThrift' for the
+-- defining smart constructor)
+newtype Safe x = Safe { getSafe :: x }
+
+-- | This asserts the input already qualifies as 'Safe' and that 'safeThift'
+-- would not transform it.  If 'safeThift' would transform the input then
+-- this throws an error.
+checkSafe :: String -> Text -> Safe Text
+checkSafe msg x =
+  let safe = safeThrift x
+  in if x == getSafe safe
+        then safe
+        else error $ msg <> " : " <> show x <> " not really Safe in checkSafe"
+
+safeThrift :: Text -> Safe Text
+safeThrift x = Safe x
+
+-- The name of the Thrift type as it appears in Haskell
+haskellThriftName :: (NameSpaces, Text) -> Text
+haskellThriftName (ns, x) =
+  dotted $
+    prefix ++
+    [ Text.concat (map cap1 ns), "Types", getSafe $ safeThrift x ]
+  where
+  prefix = ["Glean", "Schema"]
+
+runM
+  :: s
+  -> NamePolicy
+  -> [ResolvedTypeDef]
+  -> ReaderT Env (State s) a
+  -> (a, s)
+
+runM initState namePolicy types act = (result, finalState)
+  where
+    (result, finalState) = runState (runReaderT act env) initState
+    env = Env
+      { namePolicy = namePolicy
+      , nameHint = mempty
+      , typeEnv = HashMap.fromList
+          [ ((typeRef_name typeDefRef, typeRef_version typeDefRef), typedef)
+          | typedef@TypeDef{..} <- types ]
+      }
+
+
+-- | Returned by 'nameThisType'
+data NewOrOld = New | Old
+  deriving (Eq, Ord)
+
+-- Make a name for a type. The returned name is assumed to be in the
+-- current namespace.
+nameThisType :: Monad m => ResolvedType' s -> ReaderT Env m (NewOrOld, Text)
+nameThisType (RecordTy []) = return (Old, "builtin.Unit")
+nameThisType _ = do
+  Env{..} <- ask
+  let
+    name = Text.intercalate "_" $ case reverse nameHint of
+      (h:hs) -> cap1 h : hs
+      [] -> error "nameThisType: empty hint"
+  return (New, name)
+
+repType :: Monad m => ResolvedType -> ReaderT Env m (Maybe ResolvedType)
+repType (NamedTy _ tr) = do
+  maybeTy <- typeDef tr
+  case maybeTy of
+    Nothing -> return Nothing
+    Just ty -> repType ty
+repType t = return (Just t)
+
+typeDef :: Monad m => TypeRef -> ReaderT Env m (Maybe ResolvedType)
+typeDef TypeRef{..} = do
+  te <- typeEnv <$> ask
+  case HashMap.lookup (typeRef_name, typeRef_version) te of
+    Just TypeDef{..} -> return (Just typeDefType)
+    Nothing -> return Nothing -- we don't know
+
+
+-- | set the 'hint' (in a nested scope) for 'nameThisType' while running 'act'
+withHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withHint hint = local pushHint
+  where pushHint s = s{ nameHint = hint : nameHint s }
+
+-- | For a typedef, we only add this as a hint component if we're at
+-- the top level and therefore generating a user-supplied
+-- typedef. Otherwise we will get the names of generated typedefs as
+-- hints themselves.
+withTypeDefHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withTypeDefHint hint = local pushHint
+  where
+  pushHint s = s{ nameHint = if null (nameHint s) then [hint] else nameHint s }
+
+withTopLevelHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withTopLevelHint hint = local $ \s -> s { nameHint = [hint] }
+
+withPredicateDefHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withPredicateDefHint = withHint
+
+withRecordFieldHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withRecordFieldHint = withHint
+
+{- |
+For a union field, there's a potential clash to avoid:
+
+> union T {
+>    T_x x;
+> }
+>
+> struct T_x {  // generated type
+>   ...
+> }
+
+We cannot use T_x for the name of the generated type, because it
+clashes with the T_x constructor that the hs2 thrift compiler
+generates for the field x of T.
+
+So, we add another underscore to the hint for a union field, giving us
+T_x_.
+-}
+withUnionFieldHint :: Monad m => Text -> ReaderT Env m a -> ReaderT Env m a
+withUnionFieldHint p = withHint (p <> "_")
+
+pushDefs :: [Text] -> M ()
+pushDefs ts = modify (reverse ts ++)
+
+popDefs :: M [Text]
+popDefs = state $ \ s -> (reverse s, mempty)
+
+
+addNamespaceDependencies
+  :: HashMap NameSpaces ([ResolvedPredicateDef], [ResolvedTypeDef])
+  -> HashMap NameSpaces
+    ([NameSpaces], [ResolvedPredicateDef], [ResolvedTypeDef])
+addNamespaceDependencies nss =
+  HashMap.fromList
+    [ (ns, (outEdges ns preds types, preds, types))
+    | (ns, (preds, types)) <- HashMap.toList nss
+    ]
+  where
+  outEdges ns preds types =
+    uniq $ filter (/= ns) $
+      ["builtin"] :  -- builtin is always a dep, so we can get builtin.Unit
+      concat (map outEdgesPred preds ++ map outEdgesTypeDef types)
+
+  outEdgesPred :: ResolvedPredicateDef -> [NameSpaces]
+  outEdgesPred PredicateDef{..} =
+    outEdgesTs [predicateDefKeyType, predicateDefValueType]
+
+  outEdgesTypeDef :: ResolvedTypeDef -> [NameSpaces]
+  outEdgesTypeDef TypeDef{..} = outEdgesT typeDefType
+
+  outEdgesTs = concatMap outEdgesT
+  outEdgesFields fields = outEdgesTs [ ty | FieldDef _ ty <- fields ]
+
+  outEdgesT :: ResolvedType -> [NameSpaces]
+  outEdgesT ByteTy{} = []
+  outEdgesT NatTy{} = []
+  outEdgesT BooleanTy{} = []
+  outEdgesT StringTy{} = []
+  outEdgesT (ArrayTy ty) = outEdgesT ty
+  outEdgesT (MaybeTy ty) = outEdgesT ty
+  outEdgesT (RecordTy fields)  = outEdgesFields fields
+  outEdgesT (SumTy fields)  = outEdgesFields fields
+  outEdgesT (SetTy ty) = outEdgesT ty
+  outEdgesT (NamedTy _ (TypeRef name _)) = [fst (splitDot name)]
+  outEdgesT (PredicateTy _ (PredicateRef name _)) = [fst (splitDot name)]
+  outEdgesT EnumeratedTy{} = []
+  outEdgesT TyVar{} = error "outEdgesT: TyVar"
+  outEdgesT HasTy{} = error "outEdgesT: HasTy"
+  outEdgesT HasKey{} = error "outEdgesT: HasKey"
+  outEdgesT ElementsOf{} = error "outEdgesT: ELementsOf"
+
+type Oncall = Text
+buckOncallAnnotation :: Maybe Oncall -> Text
+buckOncallAnnotation name = case name of
+  Just oncall -> "\noncall(\"" <> oncall <> "\")"
+  Nothing -> ""
diff --git a/glean/schema/hs/Glean/Schema/Anglelang.hs b/glean/schema/hs/Glean/Schema/Anglelang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Anglelang.hs
@@ -0,0 +1,20 @@
+-- @generated
+module Glean.Schema.Anglelang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "anglelang.Type" 1)
+  , (PredicateRef "anglelang.TypeDecl" 1)
+  , (PredicateRef "anglelang.Name" 1)
+  , (PredicateRef "anglelang.SchemaDecl" 1)
+  , (PredicateRef "anglelang.FileXRefs" 1)
+  , (PredicateRef "anglelang.PredicateDecl" 1)
+  , (PredicateRef "anglelang.TargetUses" 1)
+  , (PredicateRef "anglelang.DeclarationLocation" 1)
+  , (PredicateRef "anglelang.DeclarationToName" 1)
+  , (PredicateRef "anglelang.DerivingDecl" 1)
+  , (PredicateRef "anglelang.EvolveDecl" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Buck.hs b/glean/schema/hs/Glean/Schema/Buck.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Buck.hs
@@ -0,0 +1,62 @@
+-- @generated
+module Glean.Schema.Buck (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "buck.CallArgument" 4)
+  , (PredicateRef "buck.RuleKey" 4)
+  , (PredicateRef "buck.Label" 4)
+  , (PredicateRef "buck.SearchByLocalName" 4)
+  , (PredicateRef "buck.TargetIndexerName" 4)
+  , (PredicateRef "buck.TargetCallByCallExpr" 4)
+  , (PredicateRef "buck.OutsTarget" 4)
+  , (PredicateRef "buck.LocalNameLowerCase" 4)
+  , (PredicateRef "buck.LocalName" 4)
+  , (PredicateRef "buck.FileTarget" 4)
+  , (PredicateRef "buck.Labels" 4)
+  , (PredicateRef "buck.TargetLocation" 4)
+  , (PredicateRef "buck.FileDefinition" 4)
+  , (PredicateRef "buck.LocatorReverseDep" 4)
+  , (PredicateRef "buck.FileEntity" 4)
+  , (PredicateRef "buck.Locator" 4)
+  , (PredicateRef "buck.DefinitionLocation" 4)
+  , (PredicateRef "buck.CallExpr" 4)
+  , (PredicateRef "buck.TargetIndexer" 4)
+  , (PredicateRef "buck.TargetUses" 4)
+  , (PredicateRef "buck.Platform" 4)
+  , (PredicateRef "buck.Consumer" 4)
+  , (PredicateRef "buck.TargetLinkWhole" 4)
+  , (PredicateRef "buck.DestinationUses" 4)
+  , (PredicateRef "buck.SourceFileLocation" 4)
+  , (PredicateRef "buck.TargetSourcesBaseModule" 4)
+  , (PredicateRef "buck.ArgumentValue" 4)
+  , (PredicateRef "buck.IndexFailureX" 4)
+  , (PredicateRef "buck.TargetOut" 4)
+  , (PredicateRef "buck.FileToTarget" 4)
+  , (PredicateRef "buck.FileXRefs" 4)
+  , (PredicateRef "buck.File" 4)
+  , (PredicateRef "buck.FileResolved" 4)
+  , (PredicateRef "buck.Type" 4)
+  , (PredicateRef "buck.OutputLabel" 4)
+  , (PredicateRef "buck.Definition" 4)
+  , (PredicateRef "buck.TargetByType" 4)
+  , (PredicateRef "buck.AttributeName" 4)
+  , (PredicateRef "buck.OutTarget" 4)
+  , (PredicateRef "buck.AttributeValue" 4)
+  , (PredicateRef "buck.TargetAttribute" 4)
+  , (PredicateRef "buck.TargetCall" 4)
+  , (PredicateRef "buck.Target" 4)
+  , (PredicateRef "buck.TargetMode" 4)
+  , (PredicateRef "buck.TargetHash" 4)
+  , (PredicateRef "buck.Owner" 4)
+  , (PredicateRef "buck.TargetDependencies" 4)
+  , (PredicateRef "buck.TargetOuts" 4)
+  , (PredicateRef "buck.LocatorReverseDeps" 4)
+  , (PredicateRef "buck.TargetSources" 4)
+  , (PredicateRef "buck.LocatorWithLabel" 4)
+  , (PredicateRef "buck.IndexerName" 4)
+  , (PredicateRef "buck.TranslationUnit" 4)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Builtin.hs b/glean/schema/hs/Glean/Schema/Builtin.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Builtin.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.Builtin (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/Code.hs b/glean/schema/hs/Glean/Schema/Code.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Code.hs
@@ -0,0 +1,12 @@
+-- @generated
+module Glean.Schema.Code (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "code.EntityLanguageSCIP" 24)
+  , (PredicateRef "code.EntityLanguage" 24)
+  , (PredicateRef "code.EntityLanguageLSIF" 24)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeAnglelang.hs b/glean/schema/hs/Glean/Schema/CodeAnglelang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeAnglelang.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeAnglelang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeBuck.hs b/glean/schema/hs/Glean/Schema/CodeBuck.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeBuck.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeBuck (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeCsharp.hs b/glean/schema/hs/Glean/Schema/CodeCsharp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeCsharp.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeCsharp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeCxx.hs b/glean/schema/hs/Glean/Schema/CodeCxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeCxx.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.CodeCxx (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "code.cxx.DeclToDef" 4)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeDataswarm.hs b/glean/schema/hs/Glean/Schema/CodeDataswarm.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeDataswarm.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeDataswarm (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeErlang.hs b/glean/schema/hs/Glean/Schema/CodeErlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeErlang.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeErlang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeGraphql.hs b/glean/schema/hs/Glean/Schema/CodeGraphql.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeGraphql.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeGraphql (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeHack.hs b/glean/schema/hs/Glean/Schema/CodeHack.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeHack.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeHack (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeHs.hs b/glean/schema/hs/Glean/Schema/CodeHs.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeHs.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeHs (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeJava.hs b/glean/schema/hs/Glean/Schema/CodeJava.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeJava.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeJava (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeKotlin.hs b/glean/schema/hs/Glean/Schema/CodeKotlin.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeKotlin.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeKotlin (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodeLsif.hs b/glean/schema/hs/Glean/Schema/CodeLsif.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodeLsif.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodeLsif (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodePp.hs b/glean/schema/hs/Glean/Schema/CodePp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodePp.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodePp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodePython.hs b/glean/schema/hs/Glean/Schema/CodePython.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodePython.hs
@@ -0,0 +1,9 @@
+-- @generated
+module Glean.Schema.CodePython (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ ]
+
diff --git a/glean/schema/hs/Glean/Schema/Codemarkup.hs b/glean/schema/hs/Glean/Schema/Codemarkup.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Codemarkup.hs
@@ -0,0 +1,45 @@
+-- @generated
+module Glean.Schema.Codemarkup (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.ExtendsChildEntity" 30)
+  , (PredicateRef "codemarkup.ExtendsParentEntityConcise" 30)
+  , (PredicateRef "codemarkup.FileCall" 30)
+  , (PredicateRef "codemarkup.GeneratedEntityToIdlEntity" 30)
+  , (PredicateRef "codemarkup.SearchInheritedEntities" 30)
+  , (PredicateRef "codemarkup.ResolveLocation" 30)
+  , (PredicateRef "codemarkup.EntityModifiers" 30)
+  , (PredicateRef "codemarkup.SymbolToEntity" 30)
+  , (PredicateRef "codemarkup.SearchRelatedEntities" 30)
+  , (PredicateRef "codemarkup.ReferencingEntity" 30)
+  , (PredicateRef "codemarkup.ContainsChildEntity" 30)
+  , (PredicateRef "codemarkup.ExtendsParentEntity" 30)
+  , (PredicateRef "codemarkup.IndexedFile" 30)
+  , (PredicateRef "codemarkup.EntityInfo" 30)
+  , (PredicateRef "codemarkup.EntitySource" 30)
+  , (PredicateRef "codemarkup.FileEntityXRefKinds" 30)
+  , (PredicateRef "codemarkup.EntityUses" 30)
+  , (PredicateRef "codemarkup.FileEntityXRefInfos" 30)
+  , (PredicateRef "codemarkup.EntityToAnnotations" 30)
+  , (PredicateRef "codemarkup.EntityReferences" 30)
+  , (PredicateRef "codemarkup.FileEntityLocations" 30)
+  , (PredicateRef "codemarkup.EntityModuleName" 30)
+  , (PredicateRef "codemarkup.ContainsParentEntity" 30)
+  , (PredicateRef "codemarkup.EntityLocation" 30)
+  , (PredicateRef "codemarkup.EntityComments" 30)
+  , (PredicateRef "codemarkup.EntityKind" 30)
+  , (PredicateRef "codemarkup.FileEntityKinds" 30)
+  , (PredicateRef "codemarkup.EntityVisibility" 30)
+  , (PredicateRef "codemarkup.FileEntityXRefRangeSpans" 30)
+  , (PredicateRef "codemarkup.FileEntityDigest" 30)
+  , (PredicateRef "codemarkup.EntityIsDefinition" 30)
+  , (PredicateRef "codemarkup.FileEntityXRefLocations" 30)
+  , (PredicateRef "codemarkup.FileEntityInfos" 30)
+  , (PredicateRef "codemarkup.FileXRefsGenericEntities" 30)
+  , (PredicateRef "codemarkup.FindEntityDefinition" 30)
+  , (PredicateRef "codemarkup.EntityDataAvailable" 30)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupAnglelang.hs b/glean/schema/hs/Glean/Schema/CodemarkupAnglelang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupAnglelang.hs
@@ -0,0 +1,13 @@
+-- @generated
+module Glean.Schema.CodemarkupAnglelang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.anglelang.AngleFileEntityXRefLocations" 1)
+  , (PredicateRef "codemarkup.anglelang.AngleEntityLocation" 1)
+  , (PredicateRef "codemarkup.anglelang.AngleResolveLocation" 1)
+  , (PredicateRef "codemarkup.anglelang.AngleEntityUses" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupBuck.hs b/glean/schema/hs/Glean/Schema/CodemarkupBuck.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupBuck.hs
@@ -0,0 +1,14 @@
+-- @generated
+module Glean.Schema.CodemarkupBuck (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.buck.BuckEntityKind" 2)
+  , (PredicateRef "codemarkup.buck.BuckFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.buck.BuckEntityUses" 2)
+  , (PredicateRef "codemarkup.buck.BuckResolveLocation" 2)
+  , (PredicateRef "codemarkup.buck.BuckEntityLocation" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupCsharp.hs b/glean/schema/hs/Glean/Schema/CodemarkupCsharp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupCsharp.hs
@@ -0,0 +1,14 @@
+-- @generated
+module Glean.Schema.CodemarkupCsharp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.csharp.CSharpEntityLocation" 1)
+  , (PredicateRef "codemarkup.csharp.CSharpEntityUses" 1)
+  , (PredicateRef "codemarkup.csharp.CSharpResolveLocation" 1)
+  , (PredicateRef "codemarkup.csharp.CSharpEntityKind" 1)
+  , (PredicateRef "codemarkup.csharp.CSharpFileEntityXRefLocations" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupCxx.hs b/glean/schema/hs/Glean/Schema/CodemarkupCxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupCxx.hs
@@ -0,0 +1,62 @@
+-- @generated
+module Glean.Schema.CodemarkupCxx (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.cxx.CxxDeclarationExtendsChild" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefinitionModifiers" 4)
+  , (PredicateRef "codemarkup.cxx.CxxResolveDeclarationToEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxVisibility" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityTraceDeclToDefXRefLocations" 4)
+  , (PredicateRef "codemarkup.cxx.SymbolToEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclarationSource" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntitySource" 4)
+  , (PredicateRef "codemarkup.cxx.CxxExtendsParentEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclInfo" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityIdl" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclarationContainsChild" 4)
+  , (PredicateRef "codemarkup.cxx.CxxContainsParentEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityXMapFixedXRefLocations" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclLocations" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityInfo" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclToDefs" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclarationContainsParent" 4)
+  , (PredicateRef "codemarkup.cxx.XRefTargetToEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxIdlEntityUses" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefinitionContainsParent" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityKind" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityMangledNameHash" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityUSR" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefinitionExtendsChild" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntityXRefLocations" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefnVisibility" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclarationExtendsParent" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefinitionContainsChild" 4)
+  , (PredicateRef "codemarkup.cxx.CxxXRefTargetLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclVisibility" 4)
+  , (PredicateRef "codemarkup.cxx.FromCxxVisibility" 4)
+  , (PredicateRef "codemarkup.cxx.CxxAnnotation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxResolveTraceLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityUses" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFileEntitySpellingXRefLocations" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclarationModifiers" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityDefinitionBase" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclKind" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDataAvailable" 4)
+  , (PredicateRef "codemarkup.cxx.CxxExtendsChildEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefToDeclFamilyXRefTargetLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxNamespaceDeclarationContainsChild" 4)
+  , (PredicateRef "codemarkup.cxx.CxxFindDefinitionOfEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxResolveLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxModifiers" 4)
+  , (PredicateRef "codemarkup.cxx.CxxContainsChildEntity" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityIdl" 4)
+  , (PredicateRef "codemarkup.cxx.EntityToXRefTarget" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDeclToDefXRefTargetLocation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxEntityDocumentation" 4)
+  , (PredicateRef "codemarkup.cxx.CxxDefinitionExtendsParent" 4)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupDataswarm.hs b/glean/schema/hs/Glean/Schema/CodemarkupDataswarm.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupDataswarm.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.CodemarkupDataswarm (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.dataswarm.DataswarmFileEntityXRefLocations" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupErlang.hs b/glean/schema/hs/Glean/Schema/CodemarkupErlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupErlang.hs
@@ -0,0 +1,16 @@
+-- @generated
+module Glean.Schema.CodemarkupErlang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.erlang.ErlangResolveLocation" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangEntityKind" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangEntityLocation" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangEntityInfo" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangEntityUses" 2)
+  , (PredicateRef "codemarkup.erlang.ErlangEntityDocumentation" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupFlow.hs b/glean/schema/hs/Glean/Schema/CodemarkupFlow.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupFlow.hs
@@ -0,0 +1,22 @@
+-- @generated
+module Glean.Schema.CodemarkupFlow (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.flow.FlowEntityDocumentation" 2)
+  , (PredicateRef "codemarkup.flow.FlowFileReferenceEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.flow.FlowFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.flow.FlowEntityLocation" 2)
+  , (PredicateRef "codemarkup.flow.FlowResolveLocation" 2)
+  , (PredicateRef "codemarkup.flow.FlowEntityModuleName" 2)
+  , (PredicateRef "codemarkup.flow.FlowContainsChildEntity" 2)
+  , (PredicateRef "codemarkup.flow.FlowDeclarationDocumentation" 2)
+  , (PredicateRef "codemarkup.flow.FlowEntityKind" 2)
+  , (PredicateRef "codemarkup.flow.FlowEntityUses" 2)
+  , (PredicateRef "codemarkup.flow.FlowDocumentationSpan" 2)
+  , (PredicateRef "codemarkup.flow.FlowFileImportDeclEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.flow.FlowContainsParentEntity" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupGraphql.hs b/glean/schema/hs/Glean/Schema/CodemarkupGraphql.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupGraphql.hs
@@ -0,0 +1,14 @@
+-- @generated
+module Glean.Schema.CodemarkupGraphql (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.graphql.GraphQLEntityKind" 1)
+  , (PredicateRef "codemarkup.graphql.GraphQLEntityLocation" 1)
+  , (PredicateRef "codemarkup.graphql.GraphQLResolveLocation" 1)
+  , (PredicateRef "codemarkup.graphql.GraphQLEntityUses" 1)
+  , (PredicateRef "codemarkup.graphql.GraphQLFileEntityXRefLocations" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupHack.hs b/glean/schema/hs/Glean/Schema/CodemarkupHack.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupHack.hs
@@ -0,0 +1,41 @@
+-- @generated
+module Glean.Schema.CodemarkupHack (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.hack.HackEntityIdl" 2)
+  , (PredicateRef "codemarkup.hack.HackEnumInheritedMembers" 2)
+  , (PredicateRef "codemarkup.hack.HackExtendsParentEntity" 2)
+  , (PredicateRef "codemarkup.hack.ConvertCallee" 2)
+  , (PredicateRef "codemarkup.hack.HackFileCall" 2)
+  , (PredicateRef "codemarkup.hack.HackExtendsParentEntityConcise" 2)
+  , (PredicateRef "codemarkup.hack.HackVisibility" 2)
+  , (PredicateRef "codemarkup.hack.HackResolveLocation" 2)
+  , (PredicateRef "codemarkup.hack.HackEntitySource" 2)
+  , (PredicateRef "codemarkup.hack.ConvertArgument" 2)
+  , (PredicateRef "codemarkup.hack.HackInheritedEntities" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityInfo" 2)
+  , (PredicateRef "codemarkup.hack.ConvertMaybeCallArguments" 2)
+  , (PredicateRef "codemarkup.hack.HackIdlEntityUses" 2)
+  , (PredicateRef "codemarkup.hack.ConvertCallArguments" 2)
+  , (PredicateRef "codemarkup.hack.ConvertCalleeForFileCall" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityModuleName" 2)
+  , (PredicateRef "codemarkup.hack.HackRequiredConstraint" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityDocumentation" 2)
+  , (PredicateRef "codemarkup.hack.HackExtendsChildEntity" 2)
+  , (PredicateRef "codemarkup.hack.HackModifiers" 2)
+  , (PredicateRef "codemarkup.hack.EntityHasHideFromDocsAttr" 2)
+  , (PredicateRef "codemarkup.hack.FromHackVisibility" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityLocation" 2)
+  , (PredicateRef "codemarkup.hack.HackContainsParentEntity" 2)
+  , (PredicateRef "codemarkup.hack.ConvertStaticType" 2)
+  , (PredicateRef "codemarkup.hack.HackFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityUses" 2)
+  , (PredicateRef "codemarkup.hack.HackAnnotation" 2)
+  , (PredicateRef "codemarkup.hack.HackFileEntityXRefSpans" 2)
+  , (PredicateRef "codemarkup.hack.HackEntityKind" 2)
+  , (PredicateRef "codemarkup.hack.HackContainsChildEntity" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupHaskell.hs b/glean/schema/hs/Glean/Schema/CodemarkupHaskell.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupHaskell.hs
@@ -0,0 +1,15 @@
+-- @generated
+module Glean.Schema.CodemarkupHaskell (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.haskell.HaskellContainsChildEntity" 2)
+  , (PredicateRef "codemarkup.haskell.HaskellContainsParentEntity" 2)
+  , (PredicateRef "codemarkup.haskell.HaskellEntityUses" 2)
+  , (PredicateRef "codemarkup.haskell.HaskellFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.haskell.HaskellResolveLocation" 2)
+  , (PredicateRef "codemarkup.haskell.HaskellEntityLocation" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupLsif.hs b/glean/schema/hs/Glean/Schema/CodemarkupLsif.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupLsif.hs
@@ -0,0 +1,16 @@
+-- @generated
+module Glean.Schema.CodemarkupLsif (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.lsif.LsifEntityModuleName" 3)
+  , (PredicateRef "codemarkup.lsif.LsifResolveLocation" 3)
+  , (PredicateRef "codemarkup.lsif.LsifEntityUses" 3)
+  , (PredicateRef "codemarkup.lsif.LsifEntityLocation" 3)
+  , (PredicateRef "codemarkup.lsif.LsifKindToKind" 3)
+  , (PredicateRef "codemarkup.lsif.LsifFileEntityXRefLocations" 3)
+  , (PredicateRef "codemarkup.lsif.EntityInfo" 3)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupPp.hs b/glean/schema/hs/Glean/Schema/CodemarkupPp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupPp.hs
@@ -0,0 +1,18 @@
+-- @generated
+module Glean.Schema.CodemarkupPp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.pp.PpEntityTraceXRefLocations" 3)
+  , (PredicateRef "codemarkup.pp.PPEntityLocation" 3)
+  , (PredicateRef "codemarkup.pp.PpIncludeXRefLocations" 3)
+  , (PredicateRef "codemarkup.pp.PpEntityKind" 3)
+  , (PredicateRef "codemarkup.pp.PpEntityInfo" 3)
+  , (PredicateRef "codemarkup.pp.PpEntityUses" 3)
+  , (PredicateRef "codemarkup.pp.PpFileEntityXRefLocations" 3)
+  , (PredicateRef "codemarkup.pp.PpResolveLocation" 3)
+  , (PredicateRef "codemarkup.pp.PpResolveTraceLocation" 3)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupPython.hs b/glean/schema/hs/Glean/Schema/CodemarkupPython.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupPython.hs
@@ -0,0 +1,30 @@
+-- @generated
+module Glean.Schema.CodemarkupPython (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.python.PythonContainsParentEntity" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityKind" 2)
+  , (PredicateRef "codemarkup.python.NonImportPythonDeclarationKind" 2)
+  , (PredicateRef "codemarkup.python.PythonExtendsChildEntity" 2)
+  , (PredicateRef "codemarkup.python.PythonModifiers" 2)
+  , (PredicateRef "codemarkup.python.PythonResolveLocation" 2)
+  , (PredicateRef "codemarkup.python.ConvertLabel" 2)
+  , (PredicateRef "codemarkup.python.PythonFileEntityXRefLocations" 2)
+  , (PredicateRef "codemarkup.python.ConvertArgument" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityLocation" 2)
+  , (PredicateRef "codemarkup.python.ConvertCallArguments" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityInfo" 2)
+  , (PredicateRef "codemarkup.python.PythonAnnotation" 2)
+  , (PredicateRef "codemarkup.python.PythonContainsChildEntity" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityComments" 2)
+  , (PredicateRef "codemarkup.python.PythonFileCall" 2)
+  , (PredicateRef "codemarkup.python.PythonExtendsParentEntity" 2)
+  , (PredicateRef "codemarkup.python.PythonVisibility" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityModuleName" 2)
+  , (PredicateRef "codemarkup.python.NonImportPythonDeclarationInfo" 2)
+  , (PredicateRef "codemarkup.python.PythonEntityUses" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupScip.hs b/glean/schema/hs/Glean/Schema/CodemarkupScip.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupScip.hs
@@ -0,0 +1,17 @@
+-- @generated
+module Glean.Schema.CodemarkupScip (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.scip.ScipFileEntityXRefLocations" 1)
+  , (PredicateRef "codemarkup.scip.FileXLangSymbolRefs" 1)
+  , (PredicateRef "codemarkup.scip.LsifKindToKind" 1)
+  , (PredicateRef "codemarkup.scip.EntityInfo" 1)
+  , (PredicateRef "codemarkup.scip.ScipEntityDocumentation" 1)
+  , (PredicateRef "codemarkup.scip.ScipResolveLocation" 1)
+  , (PredicateRef "codemarkup.scip.ScipEntityLocation" 1)
+  , (PredicateRef "codemarkup.scip.ScipEntityUses" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupSearch.hs b/glean/schema/hs/Glean/Schema/CodemarkupSearch.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupSearch.hs
@@ -0,0 +1,12 @@
+-- @generated
+module Glean.Schema.CodemarkupSearch (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.search.EntityLocationAndKind" 1)
+  , (PredicateRef "codemarkup.search.SearchByName" 1)
+  , (PredicateRef "codemarkup.search.SearchByScope" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/CodemarkupTypes.hs b/glean/schema/hs/Glean/Schema/CodemarkupTypes.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/CodemarkupTypes.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.CodemarkupTypes (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "codemarkup.types.RangeSpanContains" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Csharp.hs b/glean/schema/hs/Glean/Schema/Csharp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Csharp.hs
@@ -0,0 +1,46 @@
+-- @generated
+module Glean.Schema.Csharp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "csharp.UnityPackageToProject" 1)
+  , (PredicateRef "csharp.FileDefinitions" 1)
+  , (PredicateRef "csharp.ObjectCreationLocation" 1)
+  , (PredicateRef "csharp.Method" 1)
+  , (PredicateRef "csharp.DefinitionLocationName" 1)
+  , (PredicateRef "csharp.ProjectToSolution" 1)
+  , (PredicateRef "csharp.Local" 1)
+  , (PredicateRef "csharp.MSBuildProjectSource" 1)
+  , (PredicateRef "csharp.Implements" 1)
+  , (PredicateRef "csharp.Namespace" 1)
+  , (PredicateRef "csharp.Name" 1)
+  , (PredicateRef "csharp.SearchByName" 1)
+  , (PredicateRef "csharp.Project" 1)
+  , (PredicateRef "csharp.Solution" 1)
+  , (PredicateRef "csharp.Property" 1)
+  , (PredicateRef "csharp.FileEntityXRefs" 1)
+  , (PredicateRef "csharp.ProjectToSourceFile" 1)
+  , (PredicateRef "csharp.UnityPackage" 1)
+  , (PredicateRef "csharp.TypeParameter" 1)
+  , (PredicateRef "csharp.NameLowerCase" 1)
+  , (PredicateRef "csharp.FunctionPointerType" 1)
+  , (PredicateRef "csharp.Interface" 1)
+  , (PredicateRef "csharp.PointerType" 1)
+  , (PredicateRef "csharp.Record" 1)
+  , (PredicateRef "csharp.Struct" 1)
+  , (PredicateRef "csharp.DefinitionLocation" 1)
+  , (PredicateRef "csharp.Parameter" 1)
+  , (PredicateRef "csharp.Field" 1)
+  , (PredicateRef "csharp.TypeLocation" 1)
+  , (PredicateRef "csharp.MethodInvocationLocation" 1)
+  , (PredicateRef "csharp.UnityProjectSource" 1)
+  , (PredicateRef "csharp.SolutionToProject" 1)
+  , (PredicateRef "csharp.Class" 1)
+  , (PredicateRef "csharp.MemberAccessLocation" 1)
+  , (PredicateRef "csharp.ArrayType" 1)
+  , (PredicateRef "csharp.FullName" 1)
+  , (PredicateRef "csharp.SourceFileToProject" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Cxx1.hs b/glean/schema/hs/Glean/Schema/Cxx1.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Cxx1.hs
@@ -0,0 +1,115 @@
+-- @generated
+module Glean.Schema.Cxx1 (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "cxx1.Declarations" 5)
+  , (PredicateRef "cxx1.FunctionDeclarationName" 5)
+  , (PredicateRef "cxx1.FunctionQName" 5)
+  , (PredicateRef "cxx1.DeclToFamily" 5)
+  , (PredicateRef "cxx1.FunctionDeclAttribute" 5)
+  , (PredicateRef "cxx1.EnumeratorInEnum" 5)
+  , (PredicateRef "cxx1.FunctionLowerCase" 5)
+  , (PredicateRef "cxx1.DeclarationSources" 5)
+  , (PredicateRef "cxx1.TypeAliasDeclarationByName" 5)
+  , (PredicateRef "cxx1.ObjcMethodDeclaration" 5)
+  , (PredicateRef "cxx1.FilePPTraceXRefs" 5)
+  , (PredicateRef "cxx1.FunctionDeclarationByNameScope" 5)
+  , (PredicateRef "cxx1.MethodOverrides" 5)
+  , (PredicateRef "cxx1.VariableDeclaration" 5)
+  , (PredicateRef "cxx1.IncludeTree" 5)
+  , (PredicateRef "cxx1.ObjcImplements" 5)
+  , (PredicateRef "cxx1.MethodOverridden" 5)
+  , (PredicateRef "cxx1.FilePPUseXRefs" 5)
+  , (PredicateRef "cxx1.Name" 5)
+  , (PredicateRef "cxx1.ObjContainerIdName" 5)
+  , (PredicateRef "cxx1.XRefTargets" 5)
+  , (PredicateRef "cxx1.USRToDeclaration" 5)
+  , (PredicateRef "cxx1.TypeAliasDeclaration" 5)
+  , (PredicateRef "cxx1.DeclarationLocationName" 5)
+  , (PredicateRef "cxx1.ObjcSelector" 5)
+  , (PredicateRef "cxx1.DeclarationSrcRange" 5)
+  , (PredicateRef "cxx1.DeclarationInTrace" 5)
+  , (PredicateRef "cxx1.TargetUses" 5)
+  , (PredicateRef "cxx1.NamespaceDeclarationName" 5)
+  , (PredicateRef "cxx1.QName" 5)
+  , (PredicateRef "cxx1.SpellingXRef" 5)
+  , (PredicateRef "cxx1.ThriftToCxx" 5)
+  , (PredicateRef "cxx1.RecordDefinition" 5)
+  , (PredicateRef "cxx1.CxxToThrift" 5)
+  , (PredicateRef "cxx1.DeclarationToUSR" 5)
+  , (PredicateRef "cxx1.PPTrace" 5)
+  , (PredicateRef "cxx1.DefToBaseDecl" 5)
+  , (PredicateRef "cxx1.Signature" 5)
+  , (PredicateRef "cxx1.Same" 5)
+  , (PredicateRef "cxx1.RecordClassLowerCase" 5)
+  , (PredicateRef "cxx1.NamespaceAliasDeclaration" 5)
+  , (PredicateRef "cxx1.DeclarationNameSpan" 5)
+  , (PredicateRef "cxx1.EnumDeclaration" 5)
+  , (PredicateRef "cxx1.RecordUnionLowerCase" 5)
+  , (PredicateRef "cxx1.EnumeratorByName" 5)
+  , (PredicateRef "cxx1.TranslationUnitTrace" 5)
+  , (PredicateRef "cxx1.ObjcPropertyIVar" 5)
+  , (PredicateRef "cxx1.ObjcContainerInheritance" 5)
+  , (PredicateRef "cxx1.Attribute" 5)
+  , (PredicateRef "cxx1.ObjcMethodDeclarationName" 5)
+  , (PredicateRef "cxx1.DeclFamily" 5)
+  , (PredicateRef "cxx1.ObjcPropertyImplementation" 5)
+  , (PredicateRef "cxx1.ObjcContainerDefinition" 5)
+  , (PredicateRef "cxx1.VariableDeclarationNonLocalByName" 5)
+  , (PredicateRef "cxx1.NamespaceDeclaration" 5)
+  , (PredicateRef "cxx1.RecordDeclarationStruct" 5)
+  , (PredicateRef "cxx1.DeclFamilyOf" 5)
+  , (PredicateRef "cxx1.DeclInObjcContainer" 5)
+  , (PredicateRef "cxx1.TranslationUnitXRefs" 5)
+  , (PredicateRef "cxx1.EnumDefinition" 5)
+  , (PredicateRef "cxx1.NamespaceDefinition" 5)
+  , (PredicateRef "cxx1.DeclarationTargets" 5)
+  , (PredicateRef "cxx1.UsingDirective" 5)
+  , (PredicateRef "cxx1.XRefIndirectTarget" 5)
+  , (PredicateRef "cxx1.ObjcContainerDeclaration" 5)
+  , (PredicateRef "cxx1.MangledNameHashToDeclaration" 5)
+  , (PredicateRef "cxx1.Type" 5)
+  , (PredicateRef "cxx1.ObjcContainerInterfaceLowerCase" 5)
+  , (PredicateRef "cxx1.FunctionName" 5)
+  , (PredicateRef "cxx1.ObjcContainerDeclarationInterface" 5)
+  , (PredicateRef "cxx1.FileXRefs" 5)
+  , (PredicateRef "cxx1.DeclarationLocationNameSpan" 5)
+  , (PredicateRef "cxx1.NamespaceDeclarationByName" 5)
+  , (PredicateRef "cxx1.TranslationUnitIncludeTree" 5)
+  , (PredicateRef "cxx1.FileXRefMap" 5)
+  , (PredicateRef "cxx1.IncludeTreeTranslationUnit" 5)
+  , (PredicateRef "cxx1.DefnInRecord" 5)
+  , (PredicateRef "cxx1.Enumerator" 5)
+  , (PredicateRef "cxx1.EnumeratorLowerCase" 5)
+  , (PredicateRef "cxx1.IncludeTreeParent" 5)
+  , (PredicateRef "cxx1.DeclInRecord" 5)
+  , (PredicateRef "cxx1.RecordStructLowerCase" 5)
+  , (PredicateRef "cxx1.ObjcMethodDefinition" 5)
+  , (PredicateRef "cxx1.ObjcContainerBase" 5)
+  , (PredicateRef "cxx1.VariableLowerCase" 5)
+  , (PredicateRef "cxx1.FunctionDeclaration" 5)
+  , (PredicateRef "cxx1.RecordDerived" 5)
+  , (PredicateRef "cxx1.UsingDeclaration" 5)
+  , (PredicateRef "cxx1.RecordDeclaration" 5)
+  , (PredicateRef "cxx1.FunctionDeclarationNameString" 5)
+  , (PredicateRef "cxx1.RecordDeclarationUnion" 5)
+  , (PredicateRef "cxx1.RecordDeclarationClass" 5)
+  , (PredicateRef "cxx1.ObjcInterfaceToImplementation" 5)
+  , (PredicateRef "cxx1.PPDefineLocation" 5)
+  , (PredicateRef "cxx1.DeclarationScope" 5)
+  , (PredicateRef "cxx1.DeclarationComment" 5)
+  , (PredicateRef "cxx1.NamespaceLowerCase" 5)
+  , (PredicateRef "cxx1.NamespaceQName" 5)
+  , (PredicateRef "cxx1.FilePPUseTraceXRefs" 5)
+  , (PredicateRef "cxx1.EnumDeclarationByName" 5)
+  , (PredicateRef "cxx1.ObjcPropertyDeclaration" 5)
+  , (PredicateRef "cxx1.EnumLowerCase" 5)
+  , (PredicateRef "cxx1.TypeAliasLowerCase" 5)
+  , (PredicateRef "cxx1.FunctionAttribute" 5)
+  , (PredicateRef "cxx1.Trace" 5)
+  , (PredicateRef "cxx1.FunctionDefinition" 5)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Dataswarm.hs b/glean/schema/hs/Glean/Schema/Dataswarm.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Dataswarm.hs
@@ -0,0 +1,17 @@
+-- @generated
+module Glean.Schema.Dataswarm (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "dataswarm.SubqueryDeclaration" 1)
+  , (PredicateRef "dataswarm.MacroDeclaration" 1)
+  , (PredicateRef "dataswarm.TableDeclaration" 1)
+  , (PredicateRef "dataswarm.SubqueryColumnDeclaration" 1)
+  , (PredicateRef "dataswarm.DeclarationName" 1)
+  , (PredicateRef "dataswarm.TableColumnDeclaration" 1)
+  , (PredicateRef "dataswarm.DeclarationLocation" 1)
+  , (PredicateRef "dataswarm.XRefsByFile" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Digest.hs b/glean/schema/hs/Glean/Schema/Digest.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Digest.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.Digest (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "digest.FileDigest" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Erlang.hs b/glean/schema/hs/Glean/Schema/Erlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Erlang.hs
@@ -0,0 +1,20 @@
+-- @generated
+module Glean.Schema.Erlang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "erlang.DeclarationComment" 1)
+  , (PredicateRef "erlang.NameLowerCase" 1)
+  , (PredicateRef "erlang.DeclarationsByFile" 1)
+  , (PredicateRef "erlang.DeclarationReference" 1)
+  , (PredicateRef "erlang.DeclarationLocation" 1)
+  , (PredicateRef "erlang.DeclarationWithFqn" 1)
+  , (PredicateRef "erlang.FunctionDeclaration" 1)
+  , (PredicateRef "erlang.XRefsViaFqnByFile" 1)
+  , (PredicateRef "erlang.DeclarationToFqn" 1)
+  , (PredicateRef "erlang.DeclarationUses" 1)
+  , (PredicateRef "erlang.SearchByName" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Flow.hs b/glean/schema/hs/Glean/Schema/Flow.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Flow.hs
@@ -0,0 +1,69 @@
+-- @generated
+module Glean.Schema.Flow (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "flow.SearchModuleByLowerCaseName" 3)
+  , (PredicateRef "flow.TypeDeclarationReference" 3)
+  , (PredicateRef "flow.FlowTypeEntityImportUses" 3)
+  , (PredicateRef "flow.MemberDeclarationInfo" 3)
+  , (PredicateRef "flow.TypeExport" 3)
+  , (PredicateRef "flow.Export" 3)
+  , (PredicateRef "flow.FlowCompatibleExport" 3)
+  , (PredicateRef "flow.DeclarationUses" 3)
+  , (PredicateRef "flow.SearchDeclarationByName" 3)
+  , (PredicateRef "flow.FileXRef" 3)
+  , (PredicateRef "flow.TypeImportDeclaration" 3)
+  , (PredicateRef "flow.SearchByNameModule" 3)
+  , (PredicateRef "flow.FlowXRefDeclInfo" 3)
+  , (PredicateRef "flow.Range" 3)
+  , (PredicateRef "flow.SearchByModule" 3)
+  , (PredicateRef "flow.SearchTypeDeclarationByLowerCaseName" 3)
+  , (PredicateRef "flow.DeclarationSignature" 3)
+  , (PredicateRef "flow.SearchTypeByModuleExport" 3)
+  , (PredicateRef "flow.ModuleComments" 3)
+  , (PredicateRef "flow.FlowExportLocation" 3)
+  , (PredicateRef "flow.FlowTypeExportLocation" 3)
+  , (PredicateRef "flow.Type" 3)
+  , (PredicateRef "flow.SearchMemberDeclarationByLowerCaseName" 3)
+  , (PredicateRef "flow.ModuleLocationByFile" 3)
+  , (PredicateRef "flow.SearchByFileModule" 3)
+  , (PredicateRef "flow.Documentation" 3)
+  , (PredicateRef "flow.FlowSameModule" 3)
+  , (PredicateRef "flow.ModuleContains" 3)
+  , (PredicateRef "flow.ImportDeclaration" 3)
+  , (PredicateRef "flow.FlowModuleNamespaceXRef" 3)
+  , (PredicateRef "flow.FlowTypeImportXRef" 3)
+  , (PredicateRef "flow.FlowImportXRef" 3)
+  , (PredicateRef "flow.SourceOfTypeExport" 3)
+  , (PredicateRef "flow.TypeDeclarationInfo" 3)
+  , (PredicateRef "flow.DeclarationNameSpan" 3)
+  , (PredicateRef "flow.DeclarationLocation" 3)
+  , (PredicateRef "flow.MemberDeclaration" 3)
+  , (PredicateRef "flow.FlowEntityImportUses" 3)
+  , (PredicateRef "flow.SearchTypeDeclarationByName" 3)
+  , (PredicateRef "flow.DeclarationInfo" 3)
+  , (PredicateRef "flow.SearchDeclarationByLowerCaseName" 3)
+  , (PredicateRef "flow.ModuleTypeExport" 3)
+  , (PredicateRef "flow.Module" 3)
+  , (PredicateRef "flow.ModuleNameLowerCase" 3)
+  , (PredicateRef "flow.ModuleExport" 3)
+  , (PredicateRef "flow.Name" 3)
+  , (PredicateRef "flow.FileOfStringModule" 3)
+  , (PredicateRef "flow.SearchByModuleName" 3)
+  , (PredicateRef "flow.StringToFileModule" 3)
+  , (PredicateRef "flow.ModuleDoc" 3)
+  , (PredicateRef "flow.FlowEntityUsesAll" 3)
+  , (PredicateRef "flow.Declaration" 3)
+  , (PredicateRef "flow.ModuleLocation" 3)
+  , (PredicateRef "flow.SearchMemberDeclarationByName" 3)
+  , (PredicateRef "flow.FileDeclaration" 3)
+  , (PredicateRef "flow.MemberDeclarationReference" 3)
+  , (PredicateRef "flow.LocalDeclarationReference" 3)
+  , (PredicateRef "flow.SearchByName" 3)
+  , (PredicateRef "flow.TypeDeclaration" 3)
+  , (PredicateRef "flow.SourceOfExport" 3)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Glass.hs b/glean/schema/hs/Glean/Schema/Glass.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Glass.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.Glass (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "glass.FileInfo" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/GleanTest.hs b/glean/schema/hs/Glean/Schema/GleanTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/GleanTest.hs
@@ -0,0 +1,57 @@
+-- @generated
+module Glean.Schema.GleanTest (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "glean.test.StoredRevStringPairSum" 6)
+  , (PredicateRef "glean.test.MatchOneAlt" 6)
+  , (PredicateRef "glean.test.DerivedKeyValue" 6)
+  , (PredicateRef "glean.test.ViaStringPair" 6)
+  , (PredicateRef "glean.test.Predicate" 6)
+  , (PredicateRef "glean.test.EmptyPred" 6)
+  , (PredicateRef "glean.test.Node" 6)
+  , (PredicateRef "glean.test.EdgeWrapper" 6)
+  , (PredicateRef "glean.test.Unbound" 6)
+  , (PredicateRef "glean.test.TreeToTree" 6)
+  , (PredicateRef "glean.test.StoredRevStringPairWithA" 6)
+  , (PredicateRef "glean.test.RevRevStringPair" 6)
+  , (PredicateRef "glean.test.Bar" 6)
+  , (PredicateRef "glean.test.KeyValue" 6)
+  , (PredicateRef "glean.test.RevStringPairs" 6)
+  , (PredicateRef "glean.test.LeftOr" 6)
+  , (PredicateRef "glean.test.IsGlean" 6)
+  , (PredicateRef "glean.test.StoredDualStringPair" 6)
+  , (PredicateRef "glean.test.SkipRevEdge" 6)
+  , (PredicateRef "glean.test.DualStringPair" 6)
+  , (PredicateRef "glean.test.Foo" 6)
+  , (PredicateRef "glean.test.Predicate" 0)
+  , (PredicateRef "glean.test.RevStringPair" 6)
+  , (PredicateRef "glean.test.StringPairBox" 6)
+  , (PredicateRef "glean.test.IsParent" 6)
+  , (PredicateRef "glean.test.IsThree" 6)
+  , (PredicateRef "glean.test.FooToFoo" 6)
+  , (PredicateRef "glean.test.RevStringPairRec" 6)
+  , (PredicateRef "glean.test.nothingTest" 6)
+  , (PredicateRef "glean.test.RefRef" 6)
+  , (PredicateRef "glean.test.Qux" 6)
+  , (PredicateRef "glean.test.StoredRevStringPair" 6)
+  , (PredicateRef "glean.test.EmptyStoredStringPair" 6)
+  , (PredicateRef "glean.test.Ref" 6)
+  , (PredicateRef "glean.test.StringPair" 6)
+  , (PredicateRef "glean.test.DerivedKeyValue2" 6)
+  , (PredicateRef "glean.test.NodePair" 6)
+  , (PredicateRef "glean.test.ReflStringPair" 6)
+  , (PredicateRef "glean.test.LeftOr2" 6)
+  , (PredicateRef "glean.test.Expr" 6)
+  , (PredicateRef "glean.test.EdgeFromNotA" 6)
+  , (PredicateRef "glean.test.Unbound2" 6)
+  , (PredicateRef "glean.test.StoredRevStringPairWithRev" 6)
+  , (PredicateRef "glean.test.RevEdge" 6)
+  , (PredicateRef "glean.test.Edge" 6)
+  , (PredicateRef "glean.test.Name" 6)
+  , (PredicateRef "glean.test.SameString" 6)
+  , (PredicateRef "glean.test.Tree" 6)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Graphql.hs b/glean/schema/hs/Glean/Schema/Graphql.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Graphql.hs
@@ -0,0 +1,36 @@
+-- @generated
+module Glean.Schema.Graphql (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "graphql.FieldDef" 3)
+  , (PredicateRef "graphql.SearchByName" 3)
+  , (PredicateRef "graphql.FileDeclarations" 3)
+  , (PredicateRef "graphql.Value" 3)
+  , (PredicateRef "graphql.Directive" 3)
+  , (PredicateRef "graphql.Field" 3)
+  , (PredicateRef "graphql.NameLowerCase" 3)
+  , (PredicateRef "graphql.Operation" 3)
+  , (PredicateRef "graphql.Argument" 3)
+  , (PredicateRef "graphql.InterfaceTypeDef" 3)
+  , (PredicateRef "graphql.DeclHasName" 3)
+  , (PredicateRef "graphql.InputValueDef" 3)
+  , (PredicateRef "graphql.BelongToConfig" 3)
+  , (PredicateRef "graphql.FileXRefs" 3)
+  , (PredicateRef "graphql.FragmentSpread" 3)
+  , (PredicateRef "graphql.UnionTypeDef" 3)
+  , (PredicateRef "graphql.InputObjectTypeDef" 3)
+  , (PredicateRef "graphql.VariableDef" 3)
+  , (PredicateRef "graphql.InlineFragment" 3)
+  , (PredicateRef "graphql.DeclarationUses" 3)
+  , (PredicateRef "graphql.EnumTypeDef" 3)
+  , (PredicateRef "graphql.ObjectTypeDef" 3)
+  , (PredicateRef "graphql.Fragment" 3)
+  , (PredicateRef "graphql.ScalarTypeDef" 3)
+  , (PredicateRef "graphql.DeclarationName" 3)
+  , (PredicateRef "graphql.DirectiveDef" 3)
+  , (PredicateRef "graphql.DeclarationLocation" 3)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Hack.hs b/glean/schema/hs/Glean/Schema/Hack.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Hack.hs
@@ -0,0 +1,104 @@
+-- @generated
+module Glean.Schema.Hack (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "hack.TargetUsesAbs" 6)
+  , (PredicateRef "hack.ClassConstDeclaration" 6)
+  , (PredicateRef "hack.NamespaceQName" 6)
+  , (PredicateRef "hack.TypedefDefinition" 6)
+  , (PredicateRef "hack.SearchClassConstByName" 6)
+  , (PredicateRef "hack.InterfaceDefinition" 6)
+  , (PredicateRef "hack.SearchGlobalConstByLowerCaseName" 6)
+  , (PredicateRef "hack.FunctionDeclaration" 6)
+  , (PredicateRef "hack.SearchTraitByLowerCaseName" 6)
+  , (PredicateRef "hack.EnumDefinition" 6)
+  , (PredicateRef "hack.SearchEnumeratorByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchMethodByName" 6)
+  , (PredicateRef "hack.FileDeclarations" 6)
+  , (PredicateRef "hack.MethodDefinition" 6)
+  , (PredicateRef "hack.InterfaceDeclaration" 6)
+  , (PredicateRef "hack.SearchEnumByName" 6)
+  , (PredicateRef "hack.MethodOverrides" 6)
+  , (PredicateRef "hack.Signature" 6)
+  , (PredicateRef "hack.TraitDefinition" 6)
+  , (PredicateRef "hack.TargetUses" 6)
+  , (PredicateRef "hack.SearchClassByName" 6)
+  , (PredicateRef "hack.SearchInterfaceByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchFunctionByName" 6)
+  , (PredicateRef "hack.ClassDefinition" 6)
+  , (PredicateRef "hack.NamespaceDeclaration" 6)
+  , (PredicateRef "hack.Enumerator" 6)
+  , (PredicateRef "hack.SearchNamespaceByName" 6)
+  , (PredicateRef "hack.NameLowerCase" 6)
+  , (PredicateRef "hack.StringLiteral" 6)
+  , (PredicateRef "hack.GlobalNamespaceAlias" 6)
+  , (PredicateRef "hack.SearchInterfaceByName" 6)
+  , (PredicateRef "hack.SearchClassByLowerCaseName" 6)
+  , (PredicateRef "hack.ContainerDeclarationQName" 6)
+  , (PredicateRef "hack.UserAttribute" 6)
+  , (PredicateRef "hack.SearchPropertyByName" 6)
+  , (PredicateRef "hack.DeclarationNamespace" 6)
+  , (PredicateRef "hack.ModuleDeclaration" 6)
+  , (PredicateRef "hack.NamespaceMember" 6)
+  , (PredicateRef "hack.PropertyDefinition" 6)
+  , (PredicateRef "hack.FunctionDefinition" 6)
+  , (PredicateRef "hack.SearchPropertyByLowerCaseName" 6)
+  , (PredicateRef "hack.GlobalConstDeclaration" 6)
+  , (PredicateRef "hack.SearchGlobalConstByName" 6)
+  , (PredicateRef "hack.DeclarationSpan" 6)
+  , (PredicateRef "hack.FileCall" 6)
+  , (PredicateRef "hack.QName" 6)
+  , (PredicateRef "hack.HackToThrift" 6)
+  , (PredicateRef "hack.TypedefDeclaration" 6)
+  , (PredicateRef "hack.ModuleParent" 6)
+  , (PredicateRef "hack.ModuleChild" 6)
+  , (PredicateRef "hack.DeclarationLocation" 6)
+  , (PredicateRef "hack.DeclarationSource" 6)
+  , (PredicateRef "hack.MethodOccurrence" 6)
+  , (PredicateRef "hack.MemberCluster" 6)
+  , (PredicateRef "hack.SearchClassConstByLowerCaseName" 6)
+  , (PredicateRef "hack.FileXRefs" 6)
+  , (PredicateRef "hack.TypeConstDeclaration" 6)
+  , (PredicateRef "hack.DeclarationName" 6)
+  , (PredicateRef "hack.MethodOverridden" 6)
+  , (PredicateRef "hack.DeclarationTarget" 6)
+  , (PredicateRef "hack.Name" 6)
+  , (PredicateRef "hack.MethodDeclaration" 6)
+  , (PredicateRef "hack.TraitDeclaration" 6)
+  , (PredicateRef "hack.SearchTypeConstByName" 6)
+  , (PredicateRef "hack.ClassDeclaration" 6)
+  , (PredicateRef "hack.SearchTypedefByName" 6)
+  , (PredicateRef "hack.IndexerInputsHash" 6)
+  , (PredicateRef "hack.SearchFunctionByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchModuleByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchNamespaceByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchMethodByLowerCaseName" 6)
+  , (PredicateRef "hack.ModuleDefinition" 6)
+  , (PredicateRef "hack.AttributeToDefinition" 6)
+  , (PredicateRef "hack.Hint" 6)
+  , (PredicateRef "hack.EnumDeclaration" 6)
+  , (PredicateRef "hack.ThriftToHack" 6)
+  , (PredicateRef "hack.TypeInfo" 6)
+  , (PredicateRef "hack.InheritedMembers" 6)
+  , (PredicateRef "hack.ContainerChild" 6)
+  , (PredicateRef "hack.TypeConstDefinition" 6)
+  , (PredicateRef "hack.SearchEnumByLowerCaseName" 6)
+  , (PredicateRef "hack.AttributeHasParameter" 6)
+  , (PredicateRef "hack.ContainerParent" 6)
+  , (PredicateRef "hack.SearchTypeConstByLowerCaseName" 6)
+  , (PredicateRef "hack.SearchTraitByName" 6)
+  , (PredicateRef "hack.DeclarationComment" 6)
+  , (PredicateRef "hack.AttributeToDeclaration" 6)
+  , (PredicateRef "hack.SearchModuleByName" 6)
+  , (PredicateRef "hack.Type" 6)
+  , (PredicateRef "hack.ClassConstDefinition" 6)
+  , (PredicateRef "hack.GlobalConstDefinition" 6)
+  , (PredicateRef "hack.SearchEnumeratorByName" 6)
+  , (PredicateRef "hack.PropertyDeclaration" 6)
+  , (PredicateRef "hack.SearchTypedefByLowerCaseName" 6)
+  , (PredicateRef "hack.Context_" 6)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Hs.hs b/glean/schema/hs/Glean/Schema/Hs.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Hs.hs
@@ -0,0 +1,41 @@
+-- @generated
+module Glean.Schema.Hs (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "hs.TyCon" 3)
+  , (PredicateRef "hs.InstanceBindToDecl" 3)
+  , (PredicateRef "hs.Type" 3)
+  , (PredicateRef "hs.ModuleSource" 3)
+  , (PredicateRef "hs.ModuleName" 3)
+  , (PredicateRef "hs.TypeFamilyDecl" 3)
+  , (PredicateRef "hs.MethDecl" 3)
+  , (PredicateRef "hs.TyVarBind" 3)
+  , (PredicateRef "hs.InstanceBind" 3)
+  , (PredicateRef "hs.LitType" 3)
+  , (PredicateRef "hs.ClassDecl" 3)
+  , (PredicateRef "hs.ConstrDecl" 3)
+  , (PredicateRef "hs.Name" 3)
+  , (PredicateRef "hs.OccName" 3)
+  , (PredicateRef "hs.ModuleDeclarations" 3)
+  , (PredicateRef "hs.SourceModule" 3)
+  , (PredicateRef "hs.DeclarationLocation" 3)
+  , (PredicateRef "hs.TypeSynDecl" 3)
+  , (PredicateRef "hs.SigDecl" 3)
+  , (PredicateRef "hs.DeclarationOfName" 3)
+  , (PredicateRef "hs.DeclarationSpan" 3)
+  , (PredicateRef "hs.InstDecl" 3)
+  , (PredicateRef "hs.XRef" 3)
+  , (PredicateRef "hs.ValBind" 3)
+  , (PredicateRef "hs.RecordFieldDecl" 3)
+  , (PredicateRef "hs.PatBind" 3)
+  , (PredicateRef "hs.DataDecl" 3)
+  , (PredicateRef "hs.UnitName" 3)
+  , (PredicateRef "hs.FileXRefs" 3)
+  , (PredicateRef "hs.OccNameLowerCase" 3)
+  , (PredicateRef "hs.Module" 3)
+  , (PredicateRef "hs.PatSynDecl" 3)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/JavakotlinAlpha.hs b/glean/schema/hs/Glean/Schema/JavakotlinAlpha.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/JavakotlinAlpha.hs
@@ -0,0 +1,15 @@
+-- @generated
+module Glean.Schema.JavakotlinAlpha (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "javakotlin.alpha.Name" 1)
+  , (PredicateRef "javakotlin.alpha.MethodName" 1)
+  , (PredicateRef "javakotlin.alpha.NameLowerCase" 1)
+  , (PredicateRef "javakotlin.alpha.Type" 1)
+  , (PredicateRef "javakotlin.alpha.QName" 1)
+  , (PredicateRef "javakotlin.alpha.Path" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/KotlinAlpha.hs b/glean/schema/hs/Glean/Schema/KotlinAlpha.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/KotlinAlpha.hs
@@ -0,0 +1,22 @@
+-- @generated
+module Glean.Schema.KotlinAlpha (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "kotlin.alpha.ClassMember" 2)
+  , (PredicateRef "kotlin.alpha.FileDeclarations" 2)
+  , (PredicateRef "kotlin.alpha.ExtendsDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.MethodDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.TypeArg" 2)
+  , (PredicateRef "kotlin.alpha.VariableDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.VariableParent" 2)
+  , (PredicateRef "kotlin.alpha.ParentDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.DeclarationFileLocation" 2)
+  , (PredicateRef "kotlin.alpha.Type" 2)
+  , (PredicateRef "kotlin.alpha.ClassDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.ContainsDeclaration" 2)
+  , (PredicateRef "kotlin.alpha.DeclarationLocation" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Lsif.hs b/glean/schema/hs/Glean/Schema/Lsif.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Lsif.hs
@@ -0,0 +1,45 @@
+-- @generated
+module Glean.Schema.Lsif (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "lsif.SearchByExactLocationAndName" 2)
+  , (PredicateRef "lsif.SearchByExactLocation" 2)
+  , (PredicateRef "lsif.NameDefinition" 2)
+  , (PredicateRef "lsif.MonikerId" 2)
+  , (PredicateRef "lsif.SearchNonLocalByLocation" 2)
+  , (PredicateRef "lsif.NameLowerCase" 2)
+  , (PredicateRef "lsif.ProjectDocument" 2)
+  , (PredicateRef "lsif.Metadata" 2)
+  , (PredicateRef "lsif.DefinitionHover" 2)
+  , (PredicateRef "lsif.Reference" 2)
+  , (PredicateRef "lsif.Range" 2)
+  , (PredicateRef "lsif.DefinitionLocation" 2)
+  , (PredicateRef "lsif.Name" 2)
+  , (PredicateRef "lsif.MonikerSymbolKind" 2)
+  , (PredicateRef "lsif.DefinitionKind" 2)
+  , (PredicateRef "lsif.DefinitionUse" 2)
+  , (PredicateRef "lsif.DefinitionMoniker" 2)
+  , (PredicateRef "lsif.SearchByMoniker" 2)
+  , (PredicateRef "lsif.SearchByName" 2)
+  , (PredicateRef "lsif.EntityDefinition" 2)
+  , (PredicateRef "lsif.EntityKind" 2)
+  , (PredicateRef "lsif.TagDefinition" 2)
+  , (PredicateRef "lsif.Project" 2)
+  , (PredicateRef "lsif.FileEntityXRefLocation" 2)
+  , (PredicateRef "lsif.EntityLocation" 2)
+  , (PredicateRef "lsif.Moniker" 2)
+  , (PredicateRef "lsif.MonikerScheme" 2)
+  , (PredicateRef "lsif.Document" 2)
+  , (PredicateRef "lsif.ResolveLocation" 2)
+  , (PredicateRef "lsif.PackageInformation" 2)
+  , (PredicateRef "lsif.HoverText" 2)
+  , (PredicateRef "lsif.Definition" 2)
+  , (PredicateRef "lsif.HoverContent" 2)
+  , (PredicateRef "lsif.EntityUses" 2)
+  , (PredicateRef "lsif.Declaration" 2)
+  , (PredicateRef "lsif.MonikerDefinition" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Pp1.hs b/glean/schema/hs/Glean/Schema/Pp1.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Pp1.hs
@@ -0,0 +1,16 @@
+-- @generated
+module Glean.Schema.Pp1 (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "pp1.Macro" 1)
+  , (PredicateRef "pp1.DefineLowerCase" 1)
+  , (PredicateRef "pp1.DefineUse" 1)
+  , (PredicateRef "pp1.Include" 1)
+  , (PredicateRef "pp1.Define" 1)
+  , (PredicateRef "pp1.Use" 1)
+  , (PredicateRef "pp1.Undef" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Python.hs b/glean/schema/hs/Glean/Schema/Python.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Python.hs
@@ -0,0 +1,78 @@
+-- @generated
+module Glean.Schema.Python (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "python.NonImportDeclaration" 4)
+  , (PredicateRef "python.DeclarationDefinition" 4)
+  , (PredicateRef "python.DeclarationWithSName" 4)
+  , (PredicateRef "python.DeclarationWithLocalName" 4)
+  , (PredicateRef "python.DefinitionDeclaration" 4)
+  , (PredicateRef "python.ClassBySName" 4)
+  , (PredicateRef "python.DeclarationUses" 4)
+  , (PredicateRef "python.CalleeToCaller" 4)
+  , (PredicateRef "python.ClassDefinition" 4)
+  , (PredicateRef "python.Type" 4)
+  , (PredicateRef "python.DerivedClassToBase" 4)
+  , (PredicateRef "python.IsAbstract" 4)
+  , (PredicateRef "python.SNameWithDeclaration" 4)
+  , (PredicateRef "python.BaseClassToDerived" 4)
+  , (PredicateRef "python.DefinitionsByFile" 4)
+  , (PredicateRef "python.Module" 4)
+  , (PredicateRef "python.DeclarationReference" 4)
+  , (PredicateRef "python.ModuleDefinition" 4)
+  , (PredicateRef "python.ImportStatement" 4)
+  , (PredicateRef "python.SearchMethodByName" 4)
+  , (PredicateRef "python.ContainedByTopLevelDeclaration" 4)
+  , (PredicateRef "python.ModuleBySName" 4)
+  , (PredicateRef "python.XRefsViaNameByFile" 4)
+  , (PredicateRef "python.ClassDeclaration" 4)
+  , (PredicateRef "python.IsTopLevelDefinition" 4)
+  , (PredicateRef "python.ImportStarStatement" 4)
+  , (PredicateRef "python.MethodOverrides" 4)
+  , (PredicateRef "python.SearchClassByName" 4)
+  , (PredicateRef "python.MethodByLocalNameStr" 4)
+  , (PredicateRef "python.VariableDeclaration" 4)
+  , (PredicateRef "python.SearchFunctionByLowerCaseName" 4)
+  , (PredicateRef "python.VariableBySName" 4)
+  , (PredicateRef "python.ImportStarsByFile" 4)
+  , (PredicateRef "python.FileCall" 4)
+  , (PredicateRef "python.ImportStarLocation" 4)
+  , (PredicateRef "python.SNameToName" 4)
+  , (PredicateRef "python.DeclarationToName" 4)
+  , (PredicateRef "python.SearchModuleByLowerCaseName" 4)
+  , (PredicateRef "python.ImportStatementByAsSName" 4)
+  , (PredicateRef "python.Contains" 4)
+  , (PredicateRef "python.IsTopLevelDeclaration" 4)
+  , (PredicateRef "python.FunctionDefinition" 4)
+  , (PredicateRef "python.ContainedBy" 4)
+  , (PredicateRef "python.ResolveOriginalName" 4)
+  , (PredicateRef "python.MethodOverriden" 4)
+  , (PredicateRef "python.DeclarationWithName" 4)
+  , (PredicateRef "python.SearchVariableByLowerCaseName" 4)
+  , (PredicateRef "python.DeclarationDocstring" 4)
+  , (PredicateRef "python.StringLiteral" 4)
+  , (PredicateRef "python.ImportStatementByAsName" 4)
+  , (PredicateRef "python.SearchFunctionByName" 4)
+  , (PredicateRef "python.FunctionDeclaration" 4)
+  , (PredicateRef "python.ContainingTopLevelDeclaration" 4)
+  , (PredicateRef "python.SearchClassByLowerCaseName" 4)
+  , (PredicateRef "python.SName" 4)
+  , (PredicateRef "python.DeclarationLocation" 4)
+  , (PredicateRef "python.SearchVariableByName" 4)
+  , (PredicateRef "python.VariableDefinition" 4)
+  , (PredicateRef "python.SearchFieldByName" 4)
+  , (PredicateRef "python.SearchFieldByLowerCaseName" 4)
+  , (PredicateRef "python.DirectXRefsByFile" 4)
+  , (PredicateRef "python.DeclarationsByFile" 4)
+  , (PredicateRef "python.NameToSName" 4)
+  , (PredicateRef "python.FunctionBySName" 4)
+  , (PredicateRef "python.XRefsViaNameByTarget" 4)
+  , (PredicateRef "python.SearchModuleByName" 4)
+  , (PredicateRef "python.SearchMethodByLowerCaseName" 4)
+  , (PredicateRef "python.Name" 4)
+  , (PredicateRef "python.DefinitionLocation" 4)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchAnglelang.hs b/glean/schema/hs/Glean/Schema/SearchAnglelang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchAnglelang.hs
@@ -0,0 +1,11 @@
+-- @generated
+module Glean.Schema.SearchAnglelang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.anglelang.NameLowerCase" 1)
+  , (PredicateRef "search.anglelang.SearchByName" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchBuck.hs b/glean/schema/hs/Glean/Schema/SearchBuck.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchBuck.hs
@@ -0,0 +1,12 @@
+-- @generated
+module Glean.Schema.SearchBuck (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.buck.SearchFile" 1)
+  , (PredicateRef "search.buck.SearchDefinition" 1)
+  , (PredicateRef "search.buck.SearchByFQN" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchCode.hs b/glean/schema/hs/Glean/Schema/SearchCode.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchCode.hs
@@ -0,0 +1,74 @@
+-- @generated
+module Glean.Schema.SearchCode (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.code.BuckSearchByName" 16)
+  , (PredicateRef "search.code.BuckSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.HackSearchByNameKindWithNamespace" 16)
+  , (PredicateRef "search.code.CxxNameLowerCase" 16)
+  , (PredicateRef "search.code.JavaSearchByScope" 16)
+  , (PredicateRef "search.code.KotlinSearchByNameWithFact" 16)
+  , (PredicateRef "search.code.KotlinSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.PythonSearchByLowerCaseScopeAndKind" 16)
+  , (PredicateRef "search.code.KotlinSearchByScopeWithName" 16)
+  , (PredicateRef "search.code.BuckSearchByLocalNameFact" 16)
+  , (PredicateRef "search.code.SearchByLowerCaseScopeAndKind" 16)
+  , (PredicateRef "search.code.HackSearchByNameKindWithQName" 16)
+  , (PredicateRef "search.code.FlowSearchByLowerCaseScopeAndKind" 16)
+  , (PredicateRef "search.code.PythonSearchByScopeAndKind" 16)
+  , (PredicateRef "search.code.HsSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.CxxPreferDefinitions" 16)
+  , (PredicateRef "search.code.KotlinSearchByScope" 16)
+  , (PredicateRef "search.code.AngleSearchByName" 16)
+  , (PredicateRef "search.code.SearchByScope" 16)
+  , (PredicateRef "search.code.CxxSearchByScopeAndKind" 16)
+  , (PredicateRef "search.code.CSharpSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.LsifSearchByName" 16)
+  , (PredicateRef "search.code.HackNameLowerCase" 16)
+  , (PredicateRef "search.code.FlowSearchByScopeAndKind" 16)
+  , (PredicateRef "search.code.CSharpSearchByName" 16)
+  , (PredicateRef "search.code.ThriftSearchByName" 16)
+  , (PredicateRef "search.code.JavaSearchByScopeWithName" 16)
+  , (PredicateRef "search.code.CxxSearchByLowerCaseNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.HackSearchByNameAndKind" 16)
+  , (PredicateRef "search.code.FbthriftSearchByNameFact" 16)
+  , (PredicateRef "search.code.ErlangSearchByName" 16)
+  , (PredicateRef "search.code.SearchByNameKindAndLanguage" 16)
+  , (PredicateRef "search.code.HackSearchByScopeAndKind" 16)
+  , (PredicateRef "search.code.CxxSearchByLowerCaseScopeAndKind" 16)
+  , (PredicateRef "search.code.PpSearchByLowerCaseNameKind" 16)
+  , (PredicateRef "search.code.SearchByLowerCaseNameAndLanguage" 16)
+  , (PredicateRef "search.code.KotlinSearchByName" 16)
+  , (PredicateRef "search.code.AngleSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.KotlinSearchByLowerCaseScope" 16)
+  , (PredicateRef "search.code.JavaSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.LsifSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.SearchByScopeAndKind" 16)
+  , (PredicateRef "search.code.SearchByLowerCaseNameKindAndLanguage" 16)
+  , (PredicateRef "search.code.FlowNameLowerCase" 16)
+  , (PredicateRef "search.code.HackSearchByScopeWithNameKinds" 16)
+  , (PredicateRef "search.code.HsSearchByName" 16)
+  , (PredicateRef "search.code.HackSearchByLowerCaseScopeAndKind" 16)
+  , (PredicateRef "search.code.SearchByNameAndLanguage" 16)
+  , (PredicateRef "search.code.FlowSearchByNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.PythonSearchByLowerCaseNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.CxxSearchByNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.FlowSearchByLowerCaseNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.RustSearchByNameAndKind" 16)
+  , (PredicateRef "search.code.PythonNameLowerCase" 16)
+  , (PredicateRef "search.code.JavaSearchByNameWithFact" 16)
+  , (PredicateRef "search.code.JavaSearchByLowerCaseScope" 16)
+  , (PredicateRef "search.code.SearchByLowerCaseScope" 16)
+  , (PredicateRef "search.code.HackSearchByLowerCaseNameAndKind" 16)
+  , (PredicateRef "search.code.PpSearchByNameKind" 16)
+  , (PredicateRef "search.code.JavaSearchByName" 16)
+  , (PredicateRef "search.code.ThriftSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.GraphQLSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.ErlangSearchByLowerCaseName" 16)
+  , (PredicateRef "search.code.PythonSearchByNameKindAndScopeFact" 16)
+  , (PredicateRef "search.code.GraphQLSearchByName" 16)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchCxx.hs b/glean/schema/hs/Glean/Schema/SearchCxx.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchCxx.hs
@@ -0,0 +1,15 @@
+-- @generated
+module Glean.Schema.SearchCxx (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.cxx.QueryToNSQNameCase" 5)
+  , (PredicateRef "search.cxx.QueryToQNameCase" 5)
+  , (PredicateRef "search.cxx.CxxRecordCase" 5)
+  , (PredicateRef "search.cxx.QueryToScopeCase" 5)
+  , (PredicateRef "search.cxx.DeclIsDefn" 5)
+  , (PredicateRef "search.cxx.CxxNamespaceCase" 5)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchErlang.hs b/glean/schema/hs/Glean/Schema/SearchErlang.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchErlang.hs
@@ -0,0 +1,11 @@
+-- @generated
+module Glean.Schema.SearchErlang (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.erlang.SearchByName" 4)
+  , (PredicateRef "search.erlang.SearchByFQN" 4)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchHack.hs b/glean/schema/hs/Glean/Schema/SearchHack.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchHack.hs
@@ -0,0 +1,26 @@
+-- @generated
+module Glean.Schema.SearchHack (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.hack.HackInAutoImportedNamespace" 7)
+  , (PredicateRef "search.hack.SearchInContainer" 7)
+  , (PredicateRef "search.hack.SearchNamespacedDecl" 7)
+  , (PredicateRef "search.hack.SearchNamespace" 7)
+  , (PredicateRef "search.hack.HackNameCase" 7)
+  , (PredicateRef "search.hack.SearchInContainerOrEnum" 7)
+  , (PredicateRef "search.hack.SearchTypeInNamespace" 7)
+  , (PredicateRef "search.hack.SearchInEnum" 7)
+  , (PredicateRef "search.hack.QueryToScopeCase" 7)
+  , (PredicateRef "search.hack.SearchPropertyInContainer" 7)
+  , (PredicateRef "search.hack.SearchModule" 7)
+  , (PredicateRef "search.hack.SearchInNamespace" 7)
+  , (PredicateRef "search.hack.SearchByName" 7)
+  , (PredicateRef "search.hack.SearchGlobalConstInNamespace" 7)
+  , (PredicateRef "search.hack.SearchInContainerOrEnumNoProperty" 7)
+  , (PredicateRef "search.hack.SearchInContainerNoProperty" 7)
+  , (PredicateRef "search.hack.SearchFunctionInNamespace" 7)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchHs.hs b/glean/schema/hs/Glean/Schema/SearchHs.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchHs.hs
@@ -0,0 +1,11 @@
+-- @generated
+module Glean.Schema.SearchHs (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.hs.SearchByName" 9)
+  , (PredicateRef "search.hs.SearchByLowerCaseName" 9)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/SearchPp.hs b/glean/schema/hs/Glean/Schema/SearchPp.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/SearchPp.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.SearchPp (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "search.pp.SearchByName" 2)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Src.hs b/glean/schema/hs/Glean/Schema/Src.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Src.hs
@@ -0,0 +1,16 @@
+-- @generated
+module Glean.Schema.Src (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "src.File" 1)
+  , (PredicateRef "src.FileDigest" 1)
+  , (PredicateRef "src.FileLines" 1)
+  , (PredicateRef "src.IndexFailure" 1)
+  , (PredicateRef "src.RangeContains" 1)
+  , (PredicateRef "src.ByteSpanContains" 1)
+  , (PredicateRef "src.FileLanguage" 1)
+  ]
+
diff --git a/glean/schema/hs/Glean/Schema/Sys.hs b/glean/schema/hs/Glean/Schema/Sys.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/hs/Glean/Schema/Sys.hs
@@ -0,0 +1,10 @@
+-- @generated
+module Glean.Schema.Sys (allPredicates) where
+
+import Glean.Types
+
+allPredicates :: [PredicateRef]
+allPredicates =
+  [ (PredicateRef "sys.Blob" 1)
+  ]
+
diff --git a/glean/schema/source/anglelang.angle b/glean/schema/source/anglelang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/anglelang.angle
@@ -0,0 +1,111 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates
+
+schema anglelang.1 {
+import src
+
+predicate Name : string
+
+type Field = {
+  name : Name,
+  ty : Type
+}
+
+predicate Type : {
+  boolean_ |
+  byte_ |
+  nat_ |
+  string_ |
+  array_ : Type |
+  set_ : Type  |
+  maybe_ : Type |
+  record_ : [ Field ] |
+  sum_ : [ Field ] |
+  predicate_ : Name |
+  named_ : Name |
+  enum_ : [ Name ]
+}
+
+predicate FileXRefs:
+  {
+    file : src.File,
+    xrefs : [XRef],
+  }
+
+type XRef =
+  {
+    target : XRefTarget,
+    span : [src.ByteSpan],
+  }
+
+type XRefTarget = {
+  ref : Declaration
+}
+
+predicate TargetUses :
+  {
+    target : XRefTarget,
+    file : src.File,
+    uses : [src.ByteSpan],
+  }
+  stored
+  { T, File, Span } where
+  anglelang.FileXRefs { file = File, xrefs = XRefs };
+  anglelang.XRef { target = T, span = Span } = XRefs[..]
+
+
+# ----- DECLARATIONS ------
+type ImportStmt = Name
+type DeriveInfo = enum { NoDeriving | OnDemand | Stored | IfEmpty}
+
+predicate DerivingDecl : {
+  name : Name,
+  derive_ : DeriveInfo
+}
+
+# Entities
+type Declaration = {
+  pred : PredicateDecl |
+  ty : TypeDecl |
+  schema : SchemaDecl |
+  imp : ImportStmt |
+  evolve : EvolveDecl |
+  derive_ : DerivingDecl
+}
+
+predicate EvolveDecl : {
+  new_ : Name,
+  old_ : Name
+}
+
+predicate SchemaDecl : {
+  name : Name,
+  declarations : [Declaration]
+}
+
+predicate PredicateDecl : {
+  name : Name,
+  keyTy : Type,
+  valTy : Type,
+  derived : DeriveInfo
+}
+
+predicate TypeDecl : {
+    name : Name,
+    ty : Type
+}
+
+predicate DeclarationLocation : {
+  decl : Declaration,
+  file: src.File,
+  span: src.ByteSpan
+}
+
+predicate DeclarationToName: Declaration -> Name
+  D -> N where
+    ({pred = { name = N }} = D) |
+    ({ty = { name = N }} = D) |
+    ({schema = { name = N }} = D) |
+    ({imp = N} = D) |
+    ({evolve = { new_ = N }} = D) |
+    ({derive_ = { name = N }} = D)
+}
diff --git a/glean/schema/source/buck.angle b/glean/schema/source/buck.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/buck.angle
@@ -0,0 +1,541 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema buck.4 {
+import src
+
+# A target locator (subdir//path:name), subdir can be empty
+# 'subdir' is actually a buck cell name.
+predicate Locator :
+  {
+    subdir : maybe string,
+    path : string,
+    name : string,
+  }
+
+# Buck target type (cxx_libary, cxx_binary, ...)
+predicate Type : string
+
+# Buck platform (fbsource specific)
+predicate Platform : string
+
+# Buck label
+predicate Label : string
+
+# A set of Buck labels
+predicate Labels : [Label]
+
+# Buck target
+predicate Target :
+  {
+    locator : Locator,
+    type_ : Type,
+    defaultPlatform : maybe Platform,
+    labels : Labels,
+  }
+
+# Efficiently lookup by type. Useful for selecting a subset of all
+# targets without enumerating all locators first (e.g. "rust_binary")
+predicate TargetByType:
+  {
+    type_ : Type,
+    target : buck.Target
+  } stored { Type, Target } where Target = buck.Target { type_ = Type }
+
+# Named output use OutputLabel as the key, the 'baz' in the form:
+# //foo:bar[baz]
+predicate OutputLabel : string
+
+# The named output use locators that end with an extra optional key, e.g.
+# 'baz' in //foo:bar[baz]
+predicate LocatorWithLabel :
+  {
+    locator : Locator,
+    label : OutputLabel
+  }
+
+# Buck target output, indexed by target. These are present if the named outputs
+# (the "outs" in buck query) are present.
+#
+# The "default_outs" attribute is represented by Nothing as the outputLabel.
+# If TargetOuts exists for a Target then there ought to be
+# an outputLabel = nothing as well.
+# The file with (outputLabel = nothing) may or may not
+# be present with (outputLabel = just _), the default file can be distinct from
+# the files of all labeled outputs.
+#
+# The target and outputLabel *should* uniquely determine the file,
+# but that invariant isn't enforced by the Buck output which returns
+# the file as a singleton list, so to be on the safe side this
+# predicate allows for the possibility of multiple files per
+# (target,outputLabel).
+
+predicate TargetOuts :
+  {
+    target : Target,
+    outputLabel : maybe OutputLabel,  # Nothing means the default_output
+    file : src.File
+  }
+
+# derived predicate, reverse of TargetOuts. The same file may have duplicate
+# OutsTarget facts. In particular the outputLabel of nothing
+# ("default_outs" attribute) may overlap with a just value.
+predicate OutsTarget :
+  {
+    file : src.File,
+    target: Target,
+    outputLabel : maybe OutputLabel
+  }
+  stored
+  {SF, T, OL} where TargetOuts {T, OL, SF}
+
+# A source file reference (either from the repo or generated during build)
+predicate File :
+  {
+    source : src.File |
+    generated : Locator |
+    generatedLabel : LocatorWithLabel
+  }
+
+# Resolve source and generated files to the src.File itself.
+predicate FileResolved :
+  {
+    buckFile : File,
+    srcFile : src.File
+  }
+  {BF, SF} where
+  SF =
+    (SF1 where File { source = SF1 } = BF) ++
+    (SF2 where
+      File { generated = Loc } = BF;
+      buck.TargetOuts{target = {locator = Loc},
+        outputLabel = nothing, file = SF2}) ++
+    (SF3 where
+      File {generatedLabel = LocatorWithLabel{locator = Loc, label = Lab}} = BF;
+      buck.TargetOuts{target = {locator = Loc},
+        outputLabel = {just = Lab}, file = SF3});
+
+# New versions of predicates that now depend on File
+
+# Buck target sources
+predicate TargetSources :
+  {
+    target : Target,
+    headers : [File],
+    exportedHeaders : [File],
+    srcs : [File],
+  }
+
+# Which targets mention a file in headers, exportedHeaders, or srcs.
+# (Making the TargetSources a direct owner of the file).
+#
+# For indirect mentions, via locators, see the Consumer predicate.
+predicate Owner :
+  {
+    source : src.File,  # unique key
+    owner : TargetSources,
+  }
+  stored
+  {Src, Owner} where
+    Owner = TargetSources
+    {
+      headers = Headers,
+      exportedHeaders = Exported,
+      srcs = Srcs
+    };
+    File { source = Src } = Headers[..] | Exported[..] | Srcs [..];
+
+# Which targets mention a file in headers, exportedHeaders, or srcs.
+# This predicate is just like Owner but returns only the Locator of the owner
+# not the whole TargetSources.
+predicate FileToTarget :
+  {
+    source : src.File,
+    locator : Locator,
+  }
+  {Src, BuckLocator} where
+    Owner
+    {
+      source = Src,
+      owner = TargetSources  {
+        target = {
+          locator = BuckLocator
+        }
+      }
+    }
+
+# New predicate that depends on File
+
+# Which targets consume a (possibly named) output of another rule.
+# (Making the TargetSources a consumer of the file).
+predicate Consumer :
+  {
+    source : src.File,  # unique key
+    consumer : TargetSources,
+  }
+  stored
+  {Src, Consumer} where
+    Consumer = TargetSources
+    {
+      headers = Headers,
+      exportedHeaders = Exported,
+      srcs = Srcs
+    };
+    BF = Headers[..] | Exported[..] | Srcs [..];
+    FileResolved{buckFile = BF, srcFile= Src}
+
+# Name for TargetIndexer, indicating which indexing pass created the target
+predicate TargetIndexerName : string
+
+# Associate a Target with a group, useful for identifying which indexing
+# pass is planned
+predicate TargetIndexer :
+  {
+    name : TargetIndexerName,
+    target : Target
+  }
+
+# The name of an attribute. Allows for enumerating all supported attributes
+predicate AttributeName : string
+
+# Represents a single key -> value mapping in a dictionary-like attribute.
+# {"a": "b"} is represented with
+# AttributeMapping { "a", {str = "b"} }
+# {"a": ["b", "c"]} maps to
+# AttributeMapping { "a", {sequence = [{str = "b"}, {str = "c"}] }
+# {"a": {"b": "c"}} maps to
+# AttributeMapping { "a", {mapping = {"b", {str = "c"}}} }
+type AttributeMapping =
+  {
+    key : string,
+    value : AttributeValue,
+  }
+
+predicate AttributeValue :
+  {
+    str : string |
+    sequence : [AttributeValue] |
+    mapping : [AttributeMapping] |
+  }
+
+# Maps a target and an attribute name to its value
+predicate TargetAttribute :
+  {
+    target : Target,
+    attribute : AttributeName,
+    value : AttributeValue,
+  }
+
+# Returns all sources and their base_module in a target.
+predicate TargetSourcesBaseModule:
+  {
+    locator: Target,
+    srcs: [File],
+    baseModule: maybe AttributeValue,
+  }
+  { Tgt, Srcs, BM } where
+    TargetSources { target = Tgt, srcs = Srcs };
+    Attr = AttributeName "base_module";
+    (
+      TargetAttribute { Tgt, Attr, V };
+      BM = {just = V};
+    ) | (
+      ! TargetAttribute { target = Tgt, attribute = Attr };
+      BM = (nothing : maybe AttributeValue);
+    )
+
+# The following predicates and types, add locations
+# to Targets and define cross references.
+#
+# The terminology is a bit inconsistent w.r.t the buck doc.
+# A Target is called a "build rule" in the doc, and a
+# a Locator is called a "build target".
+#
+# To be clear, the following is a Target.
+#
+# cpp_library(
+#     name = "cpp",
+#     srcs = [
+#         "glean.cpp",
+#         "sender.cpp",
+#     ],
+# )
+#
+# The span goes from `c` to `)`
+#
+
+predicate Definition : {
+  module : src.File,
+  name : string,
+}
+
+predicate DefinitionLocation:
+{
+  definition : Definition,
+  file: src.File,  # redundant with Definition.module
+  span: src.ByteSpan,
+}
+
+predicate TargetLocation:
+{
+  locator : Locator,
+  file: src.File,
+  span: src.ByteSpan,
+}
+
+predicate SourceFileLocation:
+{
+  file: src.File,
+  span: src.ByteSpan,
+}
+
+# Locators of targets defined in a file
+# Deprecated: replaced by more general FileEntity
+predicate FileTarget:
+{
+    file : src.File,
+    locator : Locator,
+}
+
+predicate FileEntity:
+{
+    file : src.File,
+    entity : XRefDestination,
+}
+
+predicate FileDefinition:
+{
+    file : src.File,
+    definition : Definition,
+}
+
+# Entities which can be referenced elsewhere
+type XRefDestination = {
+  locator : Locator |
+  file : src.File |
+  definition : Definition |
+}
+
+type XRef =
+  {
+    destination : XRefDestination,
+    ranges : [src.ByteSpan],
+  }
+
+# Cross-references to a target within a file.
+predicate FileXRefs:
+  {
+    file : src.File,
+    xrefs : [XRef],
+  }
+
+# Uses of a Buck target (inverse of xrefs)
+# deprecated, replaced by DestinationUses
+predicate TargetUses:
+  {
+    locator: Locator,
+    file: src.File,
+    spans: [src.ByteSpan],
+  } stored
+  { Locator, File, Spans } where
+    FileXRefs { File, XRefs };
+    { { locator = Locator }, Spans } = XRefs[..];
+
+predicate DestinationUses:
+  {
+    destination: XRefDestination,
+    file: src.File,
+    spans: [src.ByteSpan],
+  } stored
+  { Destination, File, Spans } where
+    FileXRefs { File, XRefs };
+    { Destination, Spans } = XRefs[..];
+
+type Dependency =
+  {
+    target : Locator,
+    explicit_ : bool,  # is it in deps in fbsource?
+    exported : bool,  # is it in exported_deps in fbsource?
+  }
+
+# Buck target dependencies
+predicate TargetDependencies :
+  {
+    target : Target,
+    dependencies : [Dependency],
+  }
+
+# Reverse of the TargetDependencies relationship
+predicate LocatorReverseDep :
+  {
+    locator : Locator,
+    rdep : Locator,
+  }
+  stored
+  { Parent, Child } where
+    TargetDependencies { target = { locator = Parent }, dependencies = Deps };
+    { target = Child } = Deps[..];
+
+type FailureReason = enum {
+  # config was intentionally skipped
+  Skipped |
+  # config was manually blocked
+  Blocked |
+  # Compilation database for this target is empty
+  EmptyCdb |
+  # Failed to create Compilation database
+  FailedCdb |
+  # Failed to run a buck query on this target
+  QueryFailed |
+  Unclassified
+}
+
+predicate IndexerName: string
+
+# The original definition of 'IndexFailure' was not evolvable, so we lost
+# this nice name
+predicate IndexFailureX :
+  {
+    # Source of the error
+    source : {locator: Locator | buildFile: src.File },
+    # Any string to identify an Indexer which added this predicate
+    indexer : IndexerName,
+    # Predefined classification of errors
+    reason: FailureReason,
+    # Additional details, we can still group by it
+    details: string,
+    # Repro command if available
+    repro: maybe string,
+  }
+
+ type ArgumentMapping =
+  {
+    key: string,
+    value: ArgumentValue,
+  }
+
+ predicate ArgumentValue:
+  {
+    lit: string |
+    sequence: [ArgumentValue] |
+    mapping: [ArgumentMapping]
+  }
+
+predicate CallArgument: {
+    label: maybe string,
+    value: ArgumentValue,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+
+# Names used in a build rule, for example
+# "thrift_library", or "cxx_binary". If available,
+# we also store the module defining the name.
+type CallName = {
+  prim : string |
+  definition : Definition
+}
+
+# Function used in a build rule. For example
+# thrift_library or fbpkg.build
+predicate CallExpr : {
+  name : CallName |
+  accessor : { name : CallExpr, field : string }
+}
+
+predicate TargetCall:
+  {
+    locator: Locator,
+    arguments: [CallArgument],
+    file: src.File,
+    span: src.ByteSpan,
+    callExpr : maybe CallExpr,
+  }
+
+predicate TargetCallByCallExpr :
+  {
+    callExpr : CallExpr,
+    target : TargetCall,
+  } stored { CE, T } where T = buck.TargetCall { callExpr = { just = CE } }
+
+# A translation unit (source file and target)
+predicate TranslationUnit :
+  {
+    file : src.File,
+    target : Locator,
+    platform : maybe Platform,
+  }
+
+# Reverse locator dependencies derived from buck.TargetDependencies
+predicate LocatorReverseDeps :
+  {
+    locator : Locator,  # unique key
+    rdeps : [Locator],
+  }
+
+# Buck target output, indexed by file
+predicate OutTarget :
+  {
+    file : src.File,
+    target : Target,
+  }
+  stored {F,T} where TargetOut {T,F}
+
+# From buck targets --show-rulekey
+predicate RuleKey :
+  {
+    locator : Locator,  # unique key
+    ruleKey : string,
+  }
+
+# From buck targets --show-target-hash
+predicate TargetHash :
+  {
+    locator : Locator,  # unique key
+    targetHash : string,
+  }
+
+# Buck target link_whole flag
+predicate TargetLinkWhole : Target
+
+# Buck target output, indexed by target
+predicate TargetOut :
+  {
+    target : Target,
+    file : src.File,
+  }
+
+# Buck target mode
+predicate TargetMode :
+  {
+    target : Target,
+    mode : string,
+  }
+
+#
+# Efficient searching
+#
+
+predicate LocalName: string
+  stored NameStr where
+    buck.Locator { name = NameStr } | buck.Definition { name = NameStr }
+
+# Pair the lower case normalized form with the case sensitive form
+predicate LocalNameLowerCase:
+  {
+    lowercase : string,
+    name : LocalName,
+  }
+  stored { prim.toLower NameStr, Name } where Name = buck.LocalName NameStr
+
+# And just the declarations we need
+predicate SearchByLocalName:
+  {
+    name : LocalName,
+    decl : XRefDestination
+  }
+  stored { L, Decl } where
+    ( LDecl = buck.Locator { name = NameStr }; { locator = LDecl } = Decl) |
+    ( DDecl = buck.Definition { name = NameStr }; { definition = DDecl } = Decl);
+    L = buck.LocalName NameStr
+
+} # end schema buck.4
diff --git a/glean/schema/source/builtin.angle b/glean/schema/source/builtin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/builtin.angle
@@ -0,0 +1,16 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema builtin.1 {
+
+# The empty record type
+type Unit = {}
+
+}
+
+schema sys.1 {
+
+# DEPRECATED: use string and/or your own predicate.
+# (Used as name storage, usually utf8 encoded text)
+predicate Blob : [byte]
+
+}
diff --git a/glean/schema/source/code.angle b/glean/schema/source/code.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.angle
@@ -0,0 +1,157 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.24 {
+import src
+import code.anglelang
+import code.buck
+import code.csharp
+import code.cxx
+import code.dataswarm
+import code.erlang
+import code.fbthrift
+import code.flow
+import code.graphql
+import code.hack
+import code.hs
+import code.java
+import code.kotlin
+import code.lsif
+import code.pp
+import code.python
+import code.scip.1
+import codemarkup.types
+
+type Entity =
+  {
+    cxx : code.cxx.Entity |
+    pp : code.pp.Entity |
+    java : code.java.Entity |
+    kotlin : code.kotlin.Entity |
+    hs : code.hs.Entity |
+    python : code.python.Entity |
+    hack : code.hack.Entity |
+    flow : code.flow.Entity |
+    fbthrift : code.fbthrift.Entity |
+    buck : code.buck.Entity |
+    erlang : code.erlang.Entity |
+    lsif : code.lsif.Entity |
+    scip : code.scip.Entity |
+    csharp : code.csharp.Entity |
+    graphql : code.graphql.Entity |
+    dataswarm: code.dataswarm.Entity |
+    angle: code.anglelang.Entity |
+  }
+
+type SymbolId =
+  {
+    scip : code.scip.SymbolId |
+    cxx : code.cxx.SymbolId |
+  }
+
+# language enum values for exactly the set of entity tags (including LSIF)
+#
+# n.b. flow => javascript, javascript is the user-facing language
+#
+type Language =
+  enum {
+    Cpp | PreProcessor | Java | Haskell | Python | Hack | JavaScript | Rust |
+    Thrift | Buck | Erlang | FSharp | Go | Kotlin | OCaml | Scala | Swift |
+    TypeScript | CSharp | GraphQL | Dataswarm | Yaml | Angle |
+  }
+
+# entity tag to language id
+predicate EntityLanguage:
+  {
+    entity: Entity,
+    language: Language
+  }
+  { Entity, Language } where
+    ( { cxx = _ } = Entity; Cpp = Language ) |
+    ( { pp = _ } = Entity; PreProcessor = Language ) |
+    ( { java = _ } = Entity; Java = Language ) |
+    ( { kotlin = _ } = Entity; Kotlin = Language ) |
+    ( { hs = _ } = Entity; Haskell = Language ) |
+    ( { python = _ } = Entity; Python = Language ) |
+    ( { hack = _ } = Entity; Hack = Language ) |
+    ( { flow = _ } = Entity; JavaScript = Language ) |
+    ( { fbthrift = _ } = Entity; Thrift = Language ) |
+    ( { buck = _ } = Entity; Buck = Language ) |
+    ( { erlang = _ } = Entity; Erlang = Language ) |
+    ( { csharp = _ } = Entity; CSharp = Language ) |
+    ( { graphql = _ } = Entity; GraphQL = Language ) |
+    ( { dataswarm = _ } = Entity; Dataswarm = Language ) |
+    ( { angle = _ } = Entity; Angle = Language ) |
+    ( { lsif = LSIF }  = Entity; EntityLanguageLSIF { LSIF, Language } ) |
+    ( { scip = SCIP }  = Entity; EntityLanguageSCIP { SCIP, Language } );
+
+# (private) helper for the LSIF subset
+predicate EntityLanguageLSIF:
+  {
+    entity: code.lsif.Entity,
+    language: Language
+  }
+  { LSIF, Language } where
+    ( { erlang = _ } = LSIF; Erlang = Language ) |
+    ( { fsharp = _ } = LSIF; FSharp = Language ) |
+    ( { go = _ } = LSIF; Go = Language ) |
+    ( { haskell = _ } = LSIF; Haskell = Language ) |
+    ( { java = _ } = LSIF; Java = Language ) |
+    ( { kotlin = _ } = LSIF; Kotlin = Language ) |
+    ( { ocaml = _ } = LSIF; OCaml = Language ) |
+    ( { python = _ } = LSIF; Python = Language ) |
+    ( { scala = _ } = LSIF; Scala = Language ) |
+    ( { swift = _ } = LSIF; Swift = Language ) |
+    ( { typescript = _ } = LSIF; TypeScript = Language );
+
+# (private) helper for the SCIP subset
+predicate EntityLanguageSCIP:
+  {
+    entity: code.scip.Entity,
+    language: Language
+  }
+  { SCIP, Language } where
+    { rust = _ } = SCIP; Rust : Language = Language;
+
+type Annotations =
+  {
+    cxx : code.cxx.Annotations |
+    java : code.java.Annotations |
+    python : code.python.Annotations |
+    hack : code.hack.Annotations |
+    fbthrift : code.fbthrift.Annotations |
+  }
+
+type Argument =
+  {
+    lit: string |
+    xref: Entity
+  }
+
+type CallArgument =
+  { label : maybe string
+  , span : src.ByteSpan
+  , argument : maybe Argument
+  }
+
+# An IdlEntity is used to represent xrefs to
+# cross-language/cross-dbs entities. Location for these
+# entities is usually defined in a different db than
+# the one containing the source spans.
+#
+# Example: a thrift declaration defined in a Thrift db, while
+# but referred to in a C++ db.
+#
+# "IdlEntity" is a misnomer (initially only IDL like thrift
+# were supported)
+#
+# location and entity are optional in case we're unable to
+# generate them from the referring db but still want to
+# produce some type of navigation info (jump to target file)
+#
+type IdlEntity =
+  { lang : Language
+  , file : src.File
+  , entity : maybe code.Entity
+  , range : maybe src.Range
+  }
+}
diff --git a/glean/schema/source/code.anglelang.angle b/glean/schema/source/code.anglelang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.anglelang.angle
@@ -0,0 +1,11 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates
+
+schema code.anglelang.1 {
+import anglelang
+
+type Entity =
+  {
+    decl : anglelang.Declaration
+  }
+
+}
diff --git a/glean/schema/source/code.buck.angle b/glean/schema/source/code.buck.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.buck.angle
@@ -0,0 +1,13 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.buck.1 {
+import buck.4
+import src
+
+type Entity =
+  {
+    locator : buck.Locator |
+    file : src.File |
+    definition : buck.Definition |
+  }
+}
diff --git a/glean/schema/source/code.csharp.angle b/glean/schema/source/code.csharp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.csharp.angle
@@ -0,0 +1,12 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.csharp.1 {
+
+import csharp
+
+type Entity =
+  {
+    decl : csharp.Definition |
+  }
+
+}
diff --git a/glean/schema/source/code.cxx.angle b/glean/schema/source/code.cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.cxx.angle
@@ -0,0 +1,90 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.cxx.4 {
+import cxx1
+
+type Entity =
+  {
+    decl : cxx1.Declaration |
+    defn : Definition |
+    enumerator : cxx1.Enumerator |
+    objcSelectorSlot : ObjcSelectorSlotEntity |
+  }
+
+type SymbolId = cxx1.USR
+
+type Definition =
+  {
+    record_ : cxx1.RecordDefinition |
+    function_ : cxx1.FunctionDefinition |
+    enum_ : cxx1.EnumDefinition |
+    objcMethod : cxx1.ObjcMethodDefinition |
+    objcContainer : cxx1.ObjcContainerDefinition |
+    variable : cxx1.VariableDeclaration |
+    namespace_ : cxx1.NamespaceDefinition |
+  }
+
+type ObjcMethodEntity =
+  {
+    decl : cxx1.ObjcMethodDeclaration |
+    defn : cxx1.ObjcMethodDefinition |
+  }
+
+type ObjcSelectorSlotEntity =
+  {
+    objcMethod : ObjcMethodEntity,
+    index : nat,
+  }
+
+# Map from any declaration to its definition(s), either through its
+# DeclFamily or directly from itself.
+#
+# For 'decl' of type VariableDeclaration this contains only 'def' only with
+# VariableKind @GlobalVariable@ with @definition = true@ (from the 'decl' or
+# its family). Thus this predicate does not contain any VariableKind of
+# {field : Field} or {ivar : ObjcIVar}.
+predicate DeclToDef :
+  {
+    decl : cxx1.Declaration,
+    defn : Definition,
+  }
+  {Decl, Def}
+  where
+  cxx1.DeclFamilyOf { Decl, FamDecl };
+  (
+    Decl.record_?;
+    FamDecl.record_? = DD;
+    Def.record_?.declaration = DD;
+  ) | (
+    Decl.function_?;
+    FamDecl.function_? = DD;
+    Def.function_?.declaration = DD;
+  ) | (
+    Decl.enum_?;
+    FamDecl.enum_? = DD;
+    Def.enum_?.declaration = DD;
+  ) | (
+    Decl.objcMethod?;
+    FamDecl.objcMethod? = DD;
+    Def.objcMethod? = cxx1.ObjcMethodDefinition DD;
+  ) | (
+    Decl.objcContainer?;
+    FamDecl.objcContainer? = DD;
+    Def.objcContainer?.declaration = DD;
+  ) | (
+    Decl.namespace_?;
+    FamDecl.namespace_? = DD;
+    Def.namespace_?.declaration = DD;
+  ) | (
+    Decl.variable?;
+    FamDecl.variable? = DD;
+    Def.variable? = DD;
+    DD.kind.global_?.definition = true;
+  )
+
+type Annotations =
+  {
+    attributes: [cxx1.Attribute] |
+  }
+
+} # end schema
diff --git a/glean/schema/source/code.dataswarm.angle b/glean/schema/source/code.dataswarm.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.dataswarm.angle
@@ -0,0 +1,11 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+# For Glass integration
+schema code.dataswarm.1 {
+    import dataswarm
+
+    type Entity =
+    {
+        decl : dataswarm.Declaration
+    }
+}
diff --git a/glean/schema/source/code.erlang.angle b/glean/schema/source/code.erlang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.erlang.angle
@@ -0,0 +1,11 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.erlang.1 {
+import erlang
+
+type Entity =
+  {
+    decl : erlang.Declaration |
+  }
+
+}
diff --git a/glean/schema/source/code.fbthrift.angle b/glean/schema/source/code.fbthrift.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.fbthrift.angle
@@ -0,0 +1,15 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.fbthrift.1 {
+import fbthrift
+
+type Entity =
+  {
+    decl : fbthrift.Declaration |
+  }
+
+type Annotations =
+  {
+    annotations : [fbthrift.StructuredAnnotation] |
+  }
+}
diff --git a/glean/schema/source/code.flow.angle b/glean/schema/source/code.flow.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.flow.angle
@@ -0,0 +1,11 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.flow.2 {
+import flow
+
+type Entity =
+  {
+    decl : flow.SomeDeclaration |
+    module_ : flow.Module |
+  }
+}
diff --git a/glean/schema/source/code.graphql.angle b/glean/schema/source/code.graphql.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.graphql.angle
@@ -0,0 +1,12 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.graphql.1 {
+
+import graphql
+
+type Entity =
+  {
+    decl : graphql.Declaration |
+  }
+
+}
diff --git a/glean/schema/source/code.hack.angle b/glean/schema/source/code.hack.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.hack.angle
@@ -0,0 +1,17 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.hack.4 {
+import hack
+
+type Entity =
+  {
+    decl : hack.Declaration |
+  }
+
+type Annotations =
+  {
+    attributes: [hack.UserAttribute] |
+  }
+
+type CallArgument = hack.CallArgument
+}
diff --git a/glean/schema/source/code.hs.angle b/glean/schema/source/code.hs.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.hs.angle
@@ -0,0 +1,12 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.hs.2 {
+import hs
+
+type Entity =
+  {
+    name: hs.Name |
+    mod: hs.Module |
+  }
+
+}
diff --git a/glean/schema/source/code.java.angle b/glean/schema/source/code.java.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.java.angle
@@ -0,0 +1,17 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.java.5 {
+
+import java.alpha
+
+type Entity =
+  {
+    decl : java.alpha.Declaration |
+  }
+
+ type Annotations =
+  {
+    annotations : [java.alpha.Annotation] |
+  }
+
+}
diff --git a/glean/schema/source/code.kotlin.angle b/glean/schema/source/code.kotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.kotlin.angle
@@ -0,0 +1,12 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.kotlin.1 {
+
+import kotlin.alpha
+
+type Entity =
+  {
+    decl : kotlin.alpha.Declaration |
+  }
+
+}
diff --git a/glean/schema/source/code.lsif.angle b/glean/schema/source/code.lsif.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.lsif.angle
@@ -0,0 +1,22 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.lsif.2 {
+import lsif
+
+type Entity =
+  {
+    erlang : lsif.SomeEntity |
+    fsharp : lsif.SomeEntity |
+    go : lsif.SomeEntity |
+    haskell : lsif.SomeEntity |
+    java : lsif.SomeEntity |
+    kotlin : lsif.SomeEntity |
+    ocaml : lsif.SomeEntity |
+    python : lsif.SomeEntity |
+    rust : lsif.SomeEntity |
+    scala : lsif.SomeEntity |
+    swift : lsif.SomeEntity |
+    typescript : lsif.SomeEntity |
+  }
+
+}
diff --git a/glean/schema/source/code.pp.angle b/glean/schema/source/code.pp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.pp.angle
@@ -0,0 +1,14 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.pp.1 {
+import pp1
+import src
+
+type Entity =
+  {
+    define : pp1.Define | # referred to by pp1.Use facts
+    undef : pp1.Undef |
+    include_ : src.File | # referred to by pp1.Include facts
+  }
+
+}
diff --git a/glean/schema/source/code.python.angle b/glean/schema/source/code.python.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.python.angle
@@ -0,0 +1,18 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.python.1 {
+import python
+
+type Entity =
+  {
+    decl : python.Declaration |
+  }
+
+type Annotations =
+  {
+    decorators : [python.Decorator] |
+  }
+
+type CallArgument = python.CallArgument
+
+}
diff --git a/glean/schema/source/code.scip.angle b/glean/schema/source/code.scip.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/code.scip.angle
@@ -0,0 +1,18 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema code.scip.1 {
+import scip
+
+type Entity =
+  {
+    rust : scip.SomeEntity |
+    go : scip.SomeEntity |
+    typescript : scip.SomeEntity |
+    java : scip.SomeEntity |
+    kotlin : scip.SomeEntity |
+    swift: scip.SomeEntity |
+  }
+
+type SymbolId = scip.Symbol
+
+}
diff --git a/glean/schema/source/codelens.angle b/glean/schema/source/codelens.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codelens.angle
@@ -0,0 +1,46 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codelens.1 {
+
+import src
+
+# This schema powers the Meta-internal "codelens" implementation shared across clients like VSCode
+# and CodeHub. It closely follows the LSP specification from Microsoft, with slight deviations to
+# help power a single source-of-truth for cross-client CodeLens
+
+# ==== COMMANDS ====
+# Represent "actions" that can be taken.
+#
+# Official specification:
+# https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command
+#
+# The implementation herein deviates slightly from the LSP specification from Microsoft in that we
+# have a fixed set of explicitly typed commands, that are explicitly supported by the CodeLens clients.
+
+type CodeLensOpenFileCommand =
+{
+    title: string,
+    file_path: src.File,
+}
+
+type CodeLensOpenURLCommand =
+  {
+    title: string,
+    url: string,
+  }
+
+type CodeLensCommand =
+  {
+    open_file: CodeLensOpenFileCommand | open_url: CodeLensOpenURLCommand
+  }
+
+
+# A code lens represents a command that should be shown along with source text, like the number of references, a way to run tests, etc.
+# Official specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens
+predicate CodeLens :
+  {
+    command: CodeLensCommand,
+    range: src.Range,
+    file: src.File,
+  }
+}
diff --git a/glean/schema/source/codemarkup.angle b/glean/schema/source/codemarkup.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.angle
@@ -0,0 +1,959 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.30 {
+import src
+import code.24
+import codemarkup.buck
+import codemarkup.csharp
+import codemarkup.cxx
+import codemarkup.dataswarm
+import codemarkup.yaml
+import codemarkup.erlang
+import codemarkup.fbthrift
+import codemarkup.flow
+import codemarkup.graphql.1
+import codemarkup.hack
+import codemarkup.haskell
+import codemarkup.java
+import codemarkup.kotlin
+import codemarkup.lsif
+import codemarkup.pp
+import codemarkup.python
+import codemarkup.scip
+import codemarkup.types
+import codemarkup.anglelang
+
+# one direct use of python.Declaration, flow.Declaration
+import python
+import flow
+
+#
+# Public API
+#
+
+# Public language-agnostic API
+
+# Associates an entity with a symbol kind.
+# Note: available for partial indices where EntityInfo is incomplete.
+# this is used directly by Glass in Query.searchByLocalName
+predicate EntityKind:
+  {
+    entity: code.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { Entity, Kind } where
+    (codemarkup.python.PythonEntityKind { E, Kind }; { python = E } = Entity) |
+    (codemarkup.cxx.CxxEntityKind { E, Kind }; { cxx = E } = Entity) |
+    (codemarkup.pp.PpEntityKind { E, Kind }; { pp = E } = Entity) |
+    (codemarkup.hack.HackEntityKind { E, Kind }; { hack = E } = Entity) |
+    (codemarkup.erlang.ErlangEntityKind { E, Kind }; { erlang = E } = Entity) |
+    (codemarkup.lsif.EntityInfo { E, { kind = Kind }}; { lsif = E } = Entity) |
+    (codemarkup.scip.EntityInfo { E, { kind = Kind }}; { scip = E } = Entity) |
+    (codemarkup.flow.FlowEntityKind { E, Kind }; { flow = E } = Entity) |
+    (codemarkup.java.JavaEntityKind { E, Kind }; { java = E } = Entity) |
+    (codemarkup.kotlin.KotlinEntityKind { E, Kind }; { kotlin = E } = Entity) |
+    (codemarkup.fbthrift.ThriftEntityKind { E, Kind }; { fbthrift = E } = Entity) |
+    (codemarkup.buck.BuckEntityKind { E, Kind }; { buck = E } = Entity) |
+    (codemarkup.csharp.CSharpEntityKind { E, Kind }; { csharp = E } = Entity) |
+    (codemarkup.graphql.GraphQLEntityKind { E, Kind }; { graphql = E } = Entity) ;
+
+# Retrieve information about an entity
+predicate EntityInfo:
+  {
+    entity: code.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { Entity, Info } where
+    ( { kind = Kind, isAbstract = false } = Info;
+      ((codemarkup.python.PythonEntityKind { E, Kind };
+        { python = E } = Entity) |
+       (codemarkup.pp.PpEntityKind { E, Kind };
+        { pp = E } = Entity) |
+       (codemarkup.erlang.ErlangEntityKind { E, Kind };
+        { erlang = E } = Entity) |
+       (codemarkup.flow.FlowEntityKind { E, Kind };
+        { flow = E } = Entity) |
+       (codemarkup.java.JavaEntityKind { E, Kind };
+        { java = E } = Entity) |
+       (codemarkup.kotlin.KotlinEntityKind { E, Kind };
+        { kotlin = E } = Entity) |
+       (codemarkup.buck.BuckEntityKind { E, Kind };
+        { buck = E } = Entity) |
+       (codemarkup.csharp.CSharpEntityKind { E, Kind };
+        { csharp = E } = Entity) |
+       (codemarkup.graphql.GraphQLEntityKind { E, Kind };
+        { graphql = E } = Entity);
+      )
+    ) |
+    (codemarkup.cxx.CxxEntityInfo { E, Info }; { cxx = E } = Entity) |
+    (codemarkup.hack.HackEntityInfo { E, Info }; { hack = E } = Entity) |
+    (codemarkup.lsif.EntityInfo { E, Info }; { lsif = E } = Entity) |
+    (codemarkup.scip.EntityInfo { E, Info }; { scip = E } = Entity);
+
+# Source code digests produced by unspecified hash function
+predicate FileEntityDigest:
+  { file: src.File
+  , entity: code.Entity,
+  } -> string
+
+# All entities defined in a src.File and their locations
+predicate FileEntityLocations:
+  {
+    file: src.File,
+    location: codemarkup.types.Location,
+    entity: code.Entity,
+  }
+  { File, Location, Entity } where
+    codemarkup.types.Location { file = File } = Location;
+    ResolveLocation { Location, Entity };
+
+# All entities defined in a src.File, and their kinds
+predicate FileEntityKinds:
+  {
+    file: src.File,
+    entity: code.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { File, Entity, Kind } where
+    FileEntityLocations { File, _, Entity };
+    EntityKind { Entity, Kind };
+
+predicate FileEntityInfos:
+  {
+    file: src.File,
+    entity: code.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { File, Entity, Info } where
+    FileEntityLocations { File, _, Entity };
+    EntityInfo { Entity, Info };
+
+# Map a location to the Entity declared there
+predicate ResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.Entity,
+  }
+  { Location, Entity } where
+    (codemarkup.hack.HackResolveLocation { Location, E };
+     { hack = E } = Entity) |
+    (codemarkup.python.PythonResolveLocation { Location, E };
+     { python = E } = Entity) |
+    (codemarkup.flow.FlowResolveLocation { Location, E };
+     { flow = E } = Entity) |
+    (codemarkup.cxx.CxxResolveLocation { Location, E };
+     { cxx = E } = Entity) |
+    (codemarkup.pp.PpResolveLocation { Location, E };
+     { pp = E } = Entity) |
+    (codemarkup.haskell.HaskellResolveLocation { Location, E };
+     { hs = E } = Entity) |
+    (codemarkup.buck.BuckResolveLocation { Location, E };
+     { buck = E } = Entity) |
+    (codemarkup.fbthrift.ThriftResolveLocation { Location, E };
+     { fbthrift = E } = Entity) |
+    (codemarkup.erlang.ErlangResolveLocation { Location, E };
+     { erlang = E } = Entity) |
+    (codemarkup.lsif.LsifResolveLocation { Location, E };
+     { lsif = E } = Entity) |
+    (codemarkup.scip.ScipResolveLocation { Location, E };
+     { scip = E } = Entity) |
+    (codemarkup.java.JavaResolveLocation { Location, E };
+     { java = E } = Entity) |
+    (codemarkup.kotlin.KotlinResolveLocation { Location, E };
+     { kotlin = E } = Entity) |
+    (codemarkup.csharp.CSharpResolveLocation { Location, E };
+     { csharp = E } = Entity) |
+    (codemarkup.graphql.GraphQLResolveLocation { Location, E };
+     { graphql = E } = Entity) |
+    (codemarkup.anglelang.AngleResolveLocation { Location, E };
+     { angle = E } = Entity);
+
+predicate EntityLocation:
+  {
+    entity: code.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, Location } where
+    (codemarkup.hack.HackEntityLocation { E, Location };
+     { hack = E } = Entity) |
+    (codemarkup.python.PythonEntityLocation { E, Location };
+     { python = E } = Entity) |
+    (codemarkup.flow.FlowEntityLocation { E, Location };
+     { flow = E } = Entity) |
+    (codemarkup.cxx.CxxEntityLocation { E, Location };
+     { cxx = E } = Entity) |
+    (codemarkup.pp.PPEntityLocation { E, Location };
+     { pp = E } = Entity) |
+    (codemarkup.haskell.HaskellEntityLocation { E, Location };
+     { hs = E } = Entity) |
+    (codemarkup.buck.BuckEntityLocation { E, Location };
+     { buck = E } = Entity) |
+    (codemarkup.fbthrift.ThriftEntityLocation { E, Location };
+     { fbthrift = E } = Entity) |
+    (codemarkup.erlang.ErlangEntityLocation { E, Location };
+     { erlang = E } = Entity) |
+    (codemarkup.lsif.LsifEntityLocation { E, Location };
+     { lsif = E } = Entity) |
+    (codemarkup.scip.ScipEntityLocation { E, Location };
+     { scip = E } = Entity) |
+    (codemarkup.java.JavaEntityLocation { E, Location };
+     { java = E } = Entity) |
+    (codemarkup.kotlin.KotlinEntityLocation { E, Location };
+     { kotlin = E } = Entity) |
+    (codemarkup.csharp.CSharpEntityLocation { E, Location };
+     { csharp = E } = Entity) |
+    (codemarkup.graphql.GraphQLEntityLocation { E, Location };
+     { graphql = E } = Entity) |
+    (codemarkup.anglelang.AngleEntityLocation { E, Location };
+     { angle = E } = Entity);
+
+# Maps a generated entity to its source definition
+predicate GeneratedEntityToIdlEntity:
+  {
+    entity: code.Entity,
+    idlEntity: code.IdlEntity,
+  }
+  { Entity, IdlEntity } where
+    (codemarkup.hack.HackEntityIdl { E, IdlEntity };
+     { hack = E } = Entity) |
+    (codemarkup.cxx.CxxEntityIdl { E, IdlEntity };
+     { cxx = E } = Entity)
+
+# generic entities are either
+#  - plainEntity: regular entities within the same db as the source file
+#  - xlang entities for which target location may not be known (need to be
+#    resolved client side)
+type GenericEntity = {
+  plainEntity: { xref: codemarkup.types.XRefLocation, entity : code.Entity } |
+  xlangEntity: { source : codemarkup.types.RangeSpan, entity : code.IdlEntity } |
+  xlangSymbol: { source : codemarkup.types.RangeSpan, symbol : code.SymbolId }
+}
+
+# Finding xrefs to generic entities. Same thing as
+# FileEntityXRefLocations, but allows references to cross-language entities
+# for which we can't compute # the target span directly (see code.IdlEntity)
+predicate FileXRefsGenericEntities: {
+    file: src.File,
+    genEntity: GenericEntity
+} { File, GenEntity } where
+  (codemarkup.hack.HackFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { hack = E } } } = GenEntity ) |
+  (codemarkup.hack.HackFileEntityXRefLocations { File, { source = Source }, E };
+   codemarkup.hack.HackEntityIdl { E, IdlEntity };
+   { xlangEntity = { source = Source, entity = IdlEntity } } = GenEntity ) |
+  (codemarkup.flow.FlowFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { flow = E } } } = GenEntity ) |
+  (codemarkup.python.PythonFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { python = E } } } = GenEntity ) |
+  (codemarkup.cxx.CxxFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { cxx = E } } }  = GenEntity ) |
+  (codemarkup.pp.PpFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { pp = E } } } = GenEntity ) |
+  (codemarkup.haskell.HaskellFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { hs = E } } } = GenEntity ) |
+  (codemarkup.buck.BuckFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { buck = E } } } = GenEntity) |
+  (codemarkup.fbthrift.ThriftFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { fbthrift = E } } } = GenEntity) |
+  (codemarkup.erlang.ErlangFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { erlang = E } } } = GenEntity) |
+  (codemarkup.lsif.LsifFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { lsif = E } } } = GenEntity)
+  | ( codemarkup.scip.ScipFileEntityXRefLocations { File, XRef, E }
+      ; { plainEntity = { xref = XRef, entity = { scip = E } } } = GenEntity )
+  | ( codemarkup.scip.FileXLangSymbolRefs { File, Source, Symbol }
+      ; { xlangSymbol = { source = Source, symbol = { scip = Symbol } } } = GenEntity )
+  |
+  (codemarkup.java.JavalFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { java = E } } } = GenEntity) |
+  (codemarkup.kotlin.KotlinFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { kotlin = E } } } = GenEntity) |
+  (codemarkup.csharp.CSharpFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { csharp = E } } } = GenEntity) |
+  (codemarkup.graphql.GraphQLFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { graphql = E } } } = GenEntity) |
+  (codemarkup.dataswarm.DataswarmFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { dataswarm = E } } } = GenEntity) |
+  (codemarkup.yaml.YamlFileEntityXLangXRefLocations { File, Source, E };
+  { xlangEntity = { source = Source, entity = E } } = GenEntity) |
+  (codemarkup.anglelang.AngleFileEntityXRefLocations { File, XRef, E };
+  { plainEntity = { xref = XRef, entity = { angle = E } } } = GenEntity)
+
+predicate SymbolToEntity:
+  {
+    symbol: code.SymbolId,
+    entity: code.Entity,
+  }
+  { Symbol, Entity } where
+  { cxx = CxxSymbol } = Symbol
+    ; codemarkup.cxx.SymbolToEntity { CxxSymbol, CxxEntity }
+    ; { cxx = CxxEntity } = Entity;
+
+# Finding xrefs. All references in a file and their targets
+predicate FileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.Entity,
+  }
+  { File, XRef, Entity } where
+    (codemarkup.hack.HackFileEntityXRefLocations { File, XRef, E };
+     { hack = E } = Entity) |
+    (codemarkup.flow.FlowFileEntityXRefLocations { File, XRef, E };
+     { flow = E } = Entity) |
+    (codemarkup.python.PythonFileEntityXRefLocations { File, XRef, E };
+     { python = E } = Entity) |
+    (codemarkup.cxx.CxxFileEntityXRefLocations { File, XRef, E };
+     { cxx = E } = Entity) |
+    (codemarkup.pp.PpFileEntityXRefLocations { File, XRef, E };
+     { pp = E } = Entity) |
+    (codemarkup.haskell.HaskellFileEntityXRefLocations { File, XRef, E };
+     { hs = E } = Entity) |
+    (codemarkup.buck.BuckFileEntityXRefLocations { File, XRef, E };
+     { buck = E } = Entity) |
+    (codemarkup.fbthrift.ThriftFileEntityXRefLocations { File, XRef, E };
+     { fbthrift = E } = Entity) |
+    (codemarkup.erlang.ErlangFileEntityXRefLocations { File, XRef, E };
+     { erlang = E } = Entity) |
+    (codemarkup.lsif.LsifFileEntityXRefLocations { File, XRef, E };
+     { lsif = E } = Entity) |
+    (codemarkup.scip.ScipFileEntityXRefLocations { File, XRef, E };
+     { scip = E } = Entity) |
+    (codemarkup.java.JavalFileEntityXRefLocations { File, XRef, E };
+     { java = E } = Entity) |
+    (codemarkup.kotlin.KotlinFileEntityXRefLocations { File, XRef, E };
+     { kotlin = E } = Entity) |
+    (codemarkup.csharp.CSharpFileEntityXRefLocations { File, XRef, E };
+     { csharp = E } = Entity) |
+    (codemarkup.graphql.GraphQLFileEntityXRefLocations { File, XRef, E };
+     { graphql = E } = Entity) |
+    (codemarkup.dataswarm.DataswarmFileEntityXRefLocations { File, XRef, E };
+     { dataswarm = E } = Entity) |
+     (codemarkup.anglelang.AngleFileEntityXRefLocations { File, XRef, E };
+     { angle = E } = Entity);
+
+# Xrefs without the target location. This can be useful in cases
+# where we don't have a target location, but we don't need it. This
+# happens when indexing a subset of Hack files in a repo, for example.
+predicate FileEntityXRefRangeSpans:
+  {
+    file: src.File,
+    location: codemarkup.types.RangeSpan,
+    entity: code.Entity,
+  }
+  { File, RangeSpan, Entity } where
+    ( codemarkup.hack.HackFileEntityXRefSpans { File, Span, E };
+      { hack = E } = Entity;
+      { span = Span } = RangeSpan) |
+    (
+      (codemarkup.flow.FlowFileEntityXRefLocations { File, XRef, E };
+       { flow = E } = Entity) |
+      (codemarkup.python.PythonFileEntityXRefLocations { File, XRef, E };
+       { python = E } = Entity) |
+      (codemarkup.cxx.CxxFileEntityXRefLocations { File, XRef, E };
+       { cxx = E } = Entity) |
+      (codemarkup.haskell.HaskellFileEntityXRefLocations { File, XRef, E };
+       { hs = E } = Entity) |
+      (codemarkup.buck.BuckFileEntityXRefLocations { File, XRef, E };
+       { buck = E } = Entity) |
+      (codemarkup.fbthrift.ThriftFileEntityXRefLocations { File, XRef, E };
+       { fbthrift = E } = Entity) |
+      (codemarkup.erlang.ErlangFileEntityXRefLocations { File, XRef, E };
+       { erlang = E } = Entity) |
+      (codemarkup.lsif.LsifFileEntityXRefLocations { File, XRef, E };
+       { lsif = E } = Entity) |
+      (codemarkup.scip.ScipFileEntityXRefLocations { File, XRef, E };
+       { scip = E } = Entity) |
+      (codemarkup.java.JavalFileEntityXRefLocations { File, XRef, E };
+       { java = E } = Entity) |
+      (codemarkup.kotlin.KotlinFileEntityXRefLocations { File, XRef, E };
+       { kotlin = E } = Entity) |
+      (codemarkup.csharp.CSharpFileEntityXRefLocations { File, XRef, E };
+       { csharp = E } = Entity);
+      { source = RangeSpan} = XRef
+    )
+
+# Finding xrefs. All references in a file, and their kinds
+predicate FileEntityXRefKinds:
+  {
+    file: src.File,
+    entity: code.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { File, Entity, Kind } where
+    FileEntityXRefLocations { File, _, Entity };
+    EntityKind { Entity, Kind };
+
+predicate FileEntityXRefInfos:
+  {
+    file: src.File,
+    entity: code.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { File, Entity, Info } where
+    FileEntityXRefLocations { File, _, Entity };
+    EntityInfo { Entity, Info };
+
+# Find references to a language entity
+# (deprecated in favor of more general codemarkup.EntityReferences)
+predicate EntityUses:
+  {
+    target: code.Entity,
+    file: src.File,
+    span: src.ByteSpan
+  }
+  {Entity, File, Span} where
+    codemarkup.EntityReferences { Entity, File, { span = Span }}
+
+# Find references to a language entity (same as EntityUses but with RangeSpans)
+predicate EntityReferences:
+  {
+    target: code.Entity,
+    file: src.File,
+    range: codemarkup.types.RangeSpan
+  }
+  {Entity, File, RangeSpan} where
+  (
+    (codemarkup.hack.HackEntityUses { E, File, Span };
+     { hack = E } = Entity) |
+    (codemarkup.flow.FlowEntityUses { E, File, Span };
+     { flow = E } = Entity) |
+    (codemarkup.python.PythonEntityUses { E, File, Span };
+     { python = E } = Entity) |
+    (codemarkup.cxx.CxxEntityUses { E, File, Span };
+     { cxx = E } = Entity) |
+    (codemarkup.haskell.HaskellEntityUses { E, File, Span };
+     { hs = E } = Entity) |
+    (codemarkup.buck.BuckEntityUses { E, File, Span };
+     { buck = E } = Entity) |
+    (codemarkup.erlang.ErlangEntityUses { E, File, Span };
+     { erlang = E } = Entity) |
+    (codemarkup.java.JavaEntityUses { E, File, Span };
+     { java = E } = Entity) |
+    (codemarkup.kotlin.KotlinEntityUses { E, File, Span };
+     { kotlin = E } = Entity) |
+    (codemarkup.pp.PpEntityUses { E, File, Span };
+     { pp = E } = Entity) |
+    (codemarkup.graphql.GraphQLEntityUses { E, File, Span };
+    { graphql = E } = Entity);
+    { span = Span } = RangeSpan;
+  ) | (
+    codemarkup.lsif.LsifEntityUses { E, File, Range };
+    { lsif = E } = Entity;
+    { range = Range } = RangeSpan;
+  ) | (
+    codemarkup.scip.ScipEntityUses { E, File, Range };
+    { scip = E } = Entity;
+    { range = Range } = RangeSpan;
+  ) | (
+    codemarkup.fbthrift.FbthriftEntityUses { E, File, Range };
+    { fbthrift = E } = Entity;
+    { range = Range } = RangeSpan;
+  ) | (
+    codemarkup.anglelang.AngleEntityUses { E, File, Span };
+    { span = Span } = RangeSpan;
+    { angle = E } = Entity;
+  ) | (
+    codemarkup.hack.HackIdlEntityUses { Entity, File, Span };
+    { span = Span } = RangeSpan;
+  ) | (
+    codemarkup.cxx.CxxIdlEntityUses { Entity, File, Span };
+    { span = Span } = RangeSpan;
+  );
+
+# Information for all calls, organized by file and callee_span
+predicate FileCall :
+  {
+    file: src.File,
+    span: src.ByteSpan,
+    arguments: [code.CallArgument],
+    callee_xref: maybe code.Entity,
+    dispatch_arg: maybe code.CallArgument,
+    receiver_type: maybe code.Entity,
+  } {File, Span, CodeArgs, Callee, DispatchArg, StaticType} where
+  ( (codemarkup.python.PythonFileCall{File, Span, CodeArgs};
+     nothing = Callee;
+     nothing = DispatchArg;
+     nothing = StaticType)
+  | codemarkup.hack.HackFileCall{File, Span, CodeArgs, Callee, DispatchArg, StaticType}
+  )
+
+
+# Look up entities that reference the given target.
+# This can be used, for example, to find calling functions
+# (by narrowing the results using `FileEntityKinds`).
+predicate ReferencingEntity :
+  {
+    target: code.Entity,
+    referrer: code.Entity,
+    reference_file: src.File,
+    reference_range: codemarkup.types.RangeSpan,
+    referrer_location: codemarkup.types.Location,
+  }
+  { Target, Referrer, File, Span, RLocation } where
+    EntityReferences { Target, File, Span };
+    FileEntityLocations { File, RLocation, Referrer };
+    { location = RSpan } = RLocation;
+    codemarkup.types.RangeSpanContains { RSpan, Span }
+
+# Lookup entities referring to the given target
+# Less general version of ReferencingEntity that omits the reference range
+predicate EntitySource:
+  {
+    target: code.Entity,
+    source: code.Entity,
+  }
+  { Target, Referrer} where
+    ( {cxx = CxxTarget} = Target ;
+      codemarkup.cxx.CxxEntitySource { CxxTarget, CxxReferrer};
+      {cxx = CxxReferrer} = Referrer
+    ) | (
+      {hack = HackTarget} = Target ;
+      codemarkup.hack.HackEntitySource { HackTarget, HackReferrer};
+      {hack = HackReferrer} = Referrer
+
+    )
+
+
+#
+# Annotations. decorates, attributes or other symbols/strings associated with
+# symbols. e.g. @nullsafe or <<__Memoize>>
+#
+
+predicate EntityToAnnotations :
+  {
+    entity: code.Entity,
+    annotations : code.Annotations,
+  }
+  { Entity, Annotations } where
+    ( { cxx = Ent } = Entity;
+      codemarkup.cxx.CxxAnnotation { Ent, Anns };
+      { cxx = Anns } = Annotations
+    ) | (
+      { hack = Ent } = Entity;
+      codemarkup.hack.HackAnnotation { Ent, Anns };
+      { hack = Anns } = Annotations
+    ) | (
+      { python = Ent } = Entity;
+      codemarkup.python.PythonAnnotation { Ent, Anns };
+      { python = Anns } = Annotations
+    ) | (
+      { java = Ent } = Entity;
+      codemarkup.java.JavaAnnotation { Ent, Anns };
+      { java = Anns } = Annotations
+    );
+
+#
+# Visibility and other keywords
+#
+
+predicate EntityVisibility : code.Entity -> codemarkup.types.Visibility
+  Entity -> Visibility where
+    ( { cxx = E } = Entity;
+      codemarkup.cxx.CxxVisibility { E, Visibility }
+    ) | (
+      { hack = E } = Entity;
+      codemarkup.hack.HackVisibility { E, Visibility }
+    ) | (
+      { python = E } = Entity;
+      codemarkup.python.PythonVisibility { E, Visibility }
+    ) | (
+      { java = E } = Entity;
+      codemarkup.java.JavaVisibility { E, Visibility }
+    )
+
+# Language keywords like `static` or `final`, or `mutable` ..
+predicate EntityModifiers:
+  {
+    entity: code.Entity,
+    modifiers: codemarkup.types.Modifiers
+  } { Entity, Modifiers } where
+    ( { hack = E } = Entity;
+      codemarkup.hack.HackModifiers { E, Modifiers }
+    ) | (
+      { cxx = E } = Entity;
+      codemarkup.cxx.CxxModifiers { E, Modifiers }
+    ) | (
+      { python = E } = Entity;
+      codemarkup.python.PythonModifiers { E, Modifiers }
+    ) | (
+      { java = E } = Entity;
+      codemarkup.java.JavaModifiers { E, Modifiers }
+    );
+
+# Entities that represent the canonical definition of the thing. Does
+# not hold for declarations in C++, imports in Python, or imports in JS
+predicate EntityIsDefinition: code.Entity
+  ({ cxx = D } where { defn = _ } = D) |
+  ({ python = { decl = D }} where D : python.Declaration; !({ imp = _ } = D)) |
+  ({ hack = _ }) |
+  ({ pp = _ }) |
+  ({ erlang = _ }) |
+  ({ lsif = _ }) |
+  ({ scip = _ }) |
+  ({ flow = { decl = { localDecl = D }}} where
+     D : flow.Declaration;
+     !(flow.ImportDeclaration { declaration = D })) |
+  ({ buck = _ }) |
+  ({ java = _ }) |
+  ({ fbthrift = _ }) |
+  ({ kotlin = _ })
+
+# If an entity is a declaration, try to find its definition, which
+# might be in a different file. There can be multiple definitions.
+# If `entity` has no separate definition, `definition == entity`.
+predicate FindEntityDefinition:
+  {
+    entity: code.Entity,
+    definition: code.Entity
+  }
+  { Decl, Defn } where
+    if (
+      { cxx = E } = Decl;
+    ) then (
+      codemarkup.cxx.CxxFindDefinitionOfEntity { E, CxxDefn };
+      { cxx = CxxDefn } = Defn
+    ) else (
+      Decl = Defn
+    )
+
+#
+# Relations todo to code.search.*
+#
+
+# A child `extends` a parent
+predicate ExtendsParentEntity :
+  {
+    child: code.Entity,
+    parent: code.Entity
+  }
+  { Child, Parent } where
+    ( { hack = C } = Child;
+      codemarkup.hack.HackExtendsParentEntity { C, P };
+      { hack = P } = Parent
+    ) | (
+      { cxx = C } = Child;
+      codemarkup.cxx.CxxExtendsParentEntity { C, P };
+      { cxx = P } = Parent
+    ) | (
+      { python = C } = Child;
+      codemarkup.python.PythonExtendsParentEntity { C, P };
+      { python = P } = Parent
+    ) | (
+      { fbthrift = C } = Child;
+      codemarkup.fbthrift.ThriftExtendsParentEntity { C, P };
+      { fbthrift = P } = Parent
+    ) | (
+      { java = C } = Child;
+      codemarkup.java.JavaExtendsParentEntity { C, P };
+      { java = P } = Parent
+    ) | (
+      { kotlin = C } = Child;
+      codemarkup.kotlin.KotlinExtendsParentEntity { C, P };
+      { kotlin = P } = Parent
+    )
+
+# This implements the ExtendsParentEntity relation, but for "interesting"
+# parents only. I.e. with this you are allowed to implement server-side
+# filtering of containers we wouldn't include as they are boring. E.g. because
+# they are tests, code gen'd or verbose.
+predicate ExtendsParentEntityConcise :
+  {
+    child: code.Entity,
+    parent: code.Entity
+  }
+  { Child, Parent } where
+    if ( { hack = C } = Child )
+    then (
+      codemarkup.hack.HackExtendsParentEntityConcise { C, P };
+      { hack = P } = Parent;
+    ) else ( # generic implementation
+      ExtendsParentEntity { Child, Parent };
+    )
+
+# A parent `is extended by` a child
+predicate ExtendsChildEntity :
+  {
+    parent: code.Entity,
+    child: code.Entity
+  }
+  { Parent, Child } where
+    ( { hack = P } = Parent;
+      codemarkup.hack.HackExtendsChildEntity { P, C };
+      { hack = C } = Child
+    ) | (
+      { cxx = P } = Parent;
+      codemarkup.cxx.CxxExtendsChildEntity { P, C };
+      { cxx = C } = Child
+    ) | (
+      { python = P } = Parent;
+      codemarkup.python.PythonExtendsChildEntity { P, C };
+      { python = C } = Child
+    ) | (
+      { fbthrift = P } = Parent;
+      codemarkup.fbthrift.ThriftExtendsChildEntity { P, C };
+      { fbthrift = C } = Child
+    ) | (
+      { java = P } = Parent;
+      codemarkup.java.JavaExtendsChildEntity { P, C };
+      { java = C } = Child
+    )
+
+# A child `is contained by` a parent
+predicate ContainsParentEntity :
+  {
+    child: code.Entity,
+    parent: code.Entity,
+  }
+  { Child, Parent } where
+    ( { hack = C } = Child;
+      codemarkup.hack.HackContainsParentEntity { C, P };
+      { hack = P } = Parent
+    ) | (
+      { cxx = C } = Child;
+      codemarkup.cxx.CxxContainsParentEntity { C, P };
+      { cxx = P } = Parent
+    ) | (
+      { python = C } = Child;
+      codemarkup.python.PythonContainsParentEntity { C, P };
+      { python = P } = Parent
+    ) | (
+      { flow = C } = Child;
+      codemarkup.flow.FlowContainsParentEntity { C, P };
+      { flow = P } = Parent
+    ) | (
+      { fbthrift = C } = Child;
+      codemarkup.fbthrift.ThriftContainsParentEntity { C, P };
+      { fbthrift = P } = Parent
+    ) | (
+      { java = C } = Child;
+      codemarkup.java.JavaContainsParentEntity { C, P };
+      { java = P } = Parent
+    ) | (
+      { kotlin = C } = Child;
+      codemarkup.kotlin.KotlinContainsParentEntity { C, P };
+      { kotlin = P } = Parent
+    ) | (
+      { hs = C } = Child;
+      codemarkup.haskell.HaskellContainsParentEntity { C, P };
+      { hs = P } = Parent
+    )
+
+# A parent `contains` a child
+predicate ContainsChildEntity :
+  {
+    parent: code.Entity,
+    child: code.Entity
+  }
+  { Parent, Child } where
+    ( { hack = P } = Parent;
+      codemarkup.hack.HackContainsChildEntity { P, C };
+      { hack = C } = Child
+    ) | (
+      {cxx = P} = Parent;
+      codemarkup.cxx.CxxContainsChildEntity { P, C };
+      { cxx = C } = Child
+    ) | (
+      { python = P } = Parent;
+      codemarkup.python.PythonContainsChildEntity { P, C };
+      { python = C } = Child
+    ) | (
+      { flow = P } = Parent;
+      codemarkup.flow.FlowContainsChildEntity { P, C };
+      { flow = C } = Child
+    ) | (
+      { fbthrift = P } = Parent;
+      codemarkup.fbthrift.ThriftContainsChildEntity { P, C };
+      { fbthrift = C } = Child
+    ) | (
+      { java = P } = Parent;
+      codemarkup.java.JavaContainsChildEntity { P, C };
+      { java = C } = Child
+    ) | (
+      { kotlin = P } = Parent;
+      codemarkup.kotlin.KotlinContainsChildEntity { P, C };
+      { kotlin = C } = Child
+    ) | (
+      { hs = P } = Parent;
+      codemarkup.haskell.HaskellContainsChildEntity { P, C };
+      { hs = C } = Child
+    )
+
+#
+# Generic relational search API, so you can call different searches
+# in a uniform way
+#
+
+# useful newtypes for a bit of client-side type safety in relational queries
+type ParentEntity = {
+  parent: code.Entity,
+  location: codemarkup.types.Location
+}
+type ChildEntity = {
+  child: code.Entity,
+  location: codemarkup.types.Location
+}
+# hide different relation types and directions under a search flag
+type RelationType = enum {
+  ExtendsParentOfChild |
+  ExtendsChildOfParent |
+  ContainsChildOfParent |
+  ContainsParentOfChild |
+  # Trait And Interface Requirements, Hack specific
+  # https://docs.hhvm.com/hack/traits-and-interfaces/trait-and-interface-requirements
+  RequireExtendsParentOfChild |
+  RequireImplementsParentOfChild |
+  RequireClassParentOfChild |
+}
+
+# we can prune some of the relationships by hiding "uninteresting" results
+type SearchStyle = enum {
+  ShowAll |
+  HideUninteresting | # perhaps us to drop language specific uninteresting cases
+}
+
+
+# given a container entity, get all its (located) inherited member, including origin location,
+predicate SearchInheritedEntities:
+  {
+      base: code.Entity,
+      parent: ParentEntity,
+      child: ChildEntity,
+      style: SearchStyle, # all results or hide uninteresting
+  }
+   { CE, { parent = PE, location = PELoc } , { child = ME, location = MELoc }, Style } where
+    codemarkup.hack.HackInheritedEntities { container = HCD, member = HD };
+    { hack = { decl = { container = HCD } } } = CE : code.Entity;
+    { hack = { decl = HD } } = ME : code.Entity;
+    codemarkup.hack.HackContainsParentEntity { child = { decl = HD }, parent = Parent };
+    { hack = Parent } = PE : code.Entity;
+    codemarkup.EntityLocation {PE, PELoc};
+    codemarkup.EntityLocation {ME, MELoc};
+    ( ( HideUninteresting = Style;
+      !(codemarkup.hack.EntityHasHideFromDocsAttr Parent)
+      ) | (
+        ShowAll = Style
+      ) )
+
+# find parent/child semantic relationships
+predicate SearchRelatedEntities:
+  {
+    query: RelationType, # extends or contains, parent or child direction
+    parent: ParentEntity,
+    child: ChildEntity,
+    style: SearchStyle, # all results or hide uninteresting
+  }
+  { Query, {parent = P, location = PLoc}, {child = C, location = CLoc}, Style } where
+    ( ShowAll = Style;
+      ( ExtendsParentOfChild = Query;
+        ExtendsParentEntity { C, P }) | # child key
+      ( ExtendsChildOfParent = Query;
+        ExtendsChildEntity { P, C } ) | # parent key
+      ( ContainsParentOfChild = Query;
+        ContainsParentEntity { C, P }) | # child key
+      ( ContainsChildOfParent = Query;
+        ContainsChildEntity { P, C }) | # parent key
+      ( RequireExtendsParentOfChild = Query;
+        { hack = HC } = C;
+        { hack = HP } = P;
+        codemarkup.hack.HackRequiredConstraint { HC, extends_, HP }) |
+      ( RequireImplementsParentOfChild = Query;
+        { hack = HC } = C;
+        { hack = HP } = P;
+        codemarkup.hack.HackRequiredConstraint { HC, implements_, HP }) |
+      ( RequireClassParentOfChild = Query;
+        { hack = HC } = C;
+        { hack = HP } = P;
+        codemarkup.hack.HackRequiredConstraint { HC, class_, HP });
+    ) | (
+      HideUninteresting = Style; # only one hide unteresting relation style atm
+      ExtendsParentOfChild = Query;
+      ExtendsParentEntityConcise { C, P }
+    );
+    codemarkup.EntityLocation {C, CLoc};
+    codemarkup.EntityLocation {P, PLoc};
+
+#
+# Expanded version of codemarkup.EntityDocumentation that knows about
+# docs stored in the index itself. Indexers are still required to support
+# the span/file format. Optionally, they may provide pre-rendered comments in
+# markdown format
+#
+predicate EntityComments:
+  {
+    entity : code.Entity,
+    file : src.File,
+    span : src.ByteSpan,
+    text : maybe string,
+  }
+  { Entity, File, Span, Text } where
+    ( { cxx = Decl } = Entity;
+      codemarkup.cxx.CxxEntityDocumentation { Decl, File, Span };
+      nothing = Text
+    ) | (
+      { hack = Decl } = Entity;
+      codemarkup.hack.HackEntityDocumentation { Decl, File, Span };
+      nothing = Text
+    ) | (
+      { flow = Decl } = Entity;
+      codemarkup.flow.FlowEntityDocumentation { Decl, File, Span };
+      nothing = Text
+    ) | (
+      { python = Decl } = Entity;
+      codemarkup.python.PythonEntityComments { Decl, File, Span, Text }
+    ) | (
+      { java = Decl } = Entity;
+      codemarkup.java.JavaEntityDocumentation { Decl, File, Span };
+      nothing = Text
+    ) | (
+      { erlang = Decl } = Entity;
+      codemarkup.erlang.ErlangEntityDocumentation { Decl, File, Span, Text}
+    ) | (
+      { fbthrift = Decl } = Entity;
+      codemarkup.fbthrift.FbthriftEntityDocumentation { Decl, File, Span };
+      nothing = Text
+    )
+
+# Find module name as string given entity.
+# No result if the entity is a non-module.
+predicate EntityModuleName:
+  {
+    entity: code.Entity,
+    name: string,
+  }
+  { Entity, Name } where
+    ( { hack = Decl } = Entity;
+      codemarkup.hack.HackEntityModuleName { Decl, Name }
+    ) | (
+      { flow = Decl } = Entity;
+      codemarkup.flow.FlowEntityModuleName { Decl, Name }
+    ) | (
+      { python = Decl } = Entity;
+      codemarkup.python.PythonEntityModuleName { Decl, Name }
+    ) | (
+      { lsif = Decl } = Entity;
+      codemarkup.lsif.LsifEntityModuleName { Decl, Name }
+    )
+
+# Identifies indexed files
+predicate IndexedFile: src.File
+   File where
+    codemarkup.cxx.CxxDataAvailable File |
+    codemarkup.EntityDataAvailable File |
+    # All Yaml files are indexable, even though they don't
+    # contain entities
+    codemarkup.yaml.YamlDataAvailable File
+
+# Identifies files with indexed entities.
+# You should not use this, instead use codemarkup.IndexedFile
+predicate EntityDataAvailable:  src.File
+    File where
+      src.File _ = File; # bind File as demanded by the schema consistency check
+      # double negation is used to check for existence
+      # (even if the Angle compiler could notice and optimize)
+      !(!(codemarkup.FileEntityLocations { file = File } |
+          codemarkup.FileEntityXRefRangeSpans {file = File }
+        ))
+
+# end
+}
diff --git a/glean/schema/source/codemarkup.anglelang.angle b/glean/schema/source/codemarkup.anglelang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.anglelang.angle
@@ -0,0 +1,52 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates
+
+schema codemarkup.anglelang.1 {
+    import src
+    import anglelang
+    import code
+    import code.anglelang
+    import codemarkup.types
+
+predicate AngleFileEntityXRefLocations :
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.anglelang.Entity,
+  }
+  {File, {{Name,TargetFile,{span = TargetSpan}, nothing},{span = RefSpan}},{decl = D}} where
+  anglelang.FileXRefs {File, XRefs};
+  anglelang.XRef {{ref = D}, RefSpans} = XRefs[..];
+  RefSpan = RefSpans[..];
+  anglelang.DeclarationLocation {D,TargetFile,TargetSpan };
+  anglelang.DeclarationToName D -> (Name : string);
+
+predicate AngleEntityLocation:
+  {
+    entity: code.anglelang.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { decl = D }, { Name, File, { span = Span }, nothing } } where
+    anglelang.DeclarationToName D -> (anglelang.Name Name);
+    anglelang.DeclarationLocation { decl = D, file = File, span = Span }
+
+
+predicate AngleResolveLocation :
+  {
+    location: codemarkup.types.Location,
+    entity: code.anglelang.Entity,
+  }
+  { { Name, TargetFile, {span= TargetSpan}, nothing }, {decl = Decl} } where
+  anglelang.DeclarationLocation { Decl, TargetFile, TargetSpan };
+  anglelang.DeclarationToName Decl -> (Name : string);
+
+
+predicate AngleEntityUses :
+  {
+    target: code.anglelang.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  {{decl = Decl}, File, Span} where
+  anglelang.TargetUses {{ref = Decl},  File, Spans};
+  Span = Spans[..];
+}
diff --git a/glean/schema/source/codemarkup.buck.angle b/glean/schema/source/codemarkup.buck.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.buck.angle
@@ -0,0 +1,117 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.buck.2 {
+import src
+import buck.4
+import code.buck
+import codemarkup.types
+
+#
+# Resolving locations to entities
+#
+
+predicate BuckResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.buck.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, Entity } where
+    buck.FileEntity { File, BuckEntity }; (
+      BuckEntity = { locator = Locator} : buck.XRefDestination;
+      buck.TargetLocation { Locator, File, Span };
+      Locator = buck.Locator { name = Name };
+      Entity = { locator = Locator } : code.buck.Entity;
+    ) | (
+      BuckEntity = { definition = Definition} : buck.XRefDestination ;
+      buck.DefinitionLocation { Definition, File, Span };
+      Definition = buck.Definition { name = Name };
+      Entity = { definition = Definition } : code.buck.Entity;
+    ) | (
+      { File, Span } : buck.SourceFileLocation ;
+      src.File Name = File;
+      Entity = { file = File } : code.buck.Entity;
+    )
+
+#
+# Finding entities' locations
+#
+
+predicate BuckEntityLocation:
+  {
+    entity: code.buck.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { span = Span }, nothing } } where
+    ( buck.TargetLocation { L, File, Span };
+      { name = Name } = L;
+      { locator = L } = Entity
+    ) | (
+      buck.DefinitionLocation { D, File, Span };
+      { name = Name } = D;
+      { definition = D } = Entity
+    ) | (
+      buck.SourceFileLocation { File, Span };
+      src.File Name = File;
+      { file = File } = Entity
+    )
+
+#
+# Finding references in a file
+#
+
+predicate BuckFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.buck.Entity,
+  }
+  { File, { Location, { span = SrcSpan } }, Entity } where
+      buck.FileXRefs { File, XRefs };
+      { XRefDestination, SrcSpans } = XRefs[..];
+      SrcSpan = SrcSpans[..];
+      ( { locator = Locator } = XRefDestination;
+        { name = Name } = Locator;
+        buck.TargetLocation { Locator, TargetFile, LocatorSpan };
+        { Name, TargetFile, { span = LocatorSpan }, nothing } = Location;
+        Entity = { locator = Locator } : code.buck.Entity;
+      ) | (
+        { definition = Definition } = XRefDestination;
+        { name = Name } = Definition ;
+        buck.DefinitionLocation { Definition, DefinitionFile, DefinitionSpan };
+        { Name, DefinitionFile, { span = DefinitionSpan }, nothing } = Location;
+        Entity = { definition = Definition } : code.buck.Entity;
+      ) | (
+        { file = SrcFile } = XRefDestination;
+        SrcFile = src.File Name;
+        # we always refer to the beginning of the file
+        { Name, SrcFile, { range = {SrcFile, 1, 1, 1, 1} }, nothing } = Location;
+        Entity = { file = SrcFile } : code.buck.Entity;
+      )
+#
+# Language entity uses
+#
+
+predicate BuckEntityUses:
+  {
+    target: code.buck.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { Destination, File, Span } where
+    buck.DestinationUses { Destination, File, Spans };
+    Span = Spans[..];
+
+#
+# Kinds.
+#
+predicate BuckEntityKind:
+  {
+    entity: code.buck.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind } where
+    ( { locator = _ } = Entity; Macro = Kind) |
+    ( { file = _ } = Entity; File = Kind) |
+    ( { definition = _ } = Entity; Value = Kind);
+
+}
diff --git a/glean/schema/source/codemarkup.csharp.angle b/glean/schema/source/codemarkup.csharp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.csharp.angle
@@ -0,0 +1,81 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.csharp.1 {
+
+import src
+import code.csharp
+import codemarkup.types
+import csharp
+
+#
+# Resolving locations to entities
+#
+
+# knowing a location, find entities
+predicate CSharpResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.csharp.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Defn } } where
+    csharp.FileDefinitions { File, Defn };
+    csharp.DefinitionLocationName { Defn, File, Span, Name };
+
+# knowing an entity, find locations
+predicate CSharpEntityLocation:
+  {
+    entity : code.csharp.Entity,
+    location : codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { span = Span }, nothing } } where
+    { decl = Defn } = Entity;
+    csharp.DefinitionLocationName { Defn, File, Span, Name };
+
+# XRefs : not supported by the CSharp schema yet
+predicate CSharpFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.csharp.Entity,
+  }
+  { File, XRef, { decl = Defn } } where
+    csharp.FileEntityXRefs { File, SrcSpan, Defn };
+    csharp.DefinitionLocationName { Defn, TargetFile, TargetSpan, Name };
+    TargetLoc = { Name, TargetFile, { span = TargetSpan }, nothing }
+      : codemarkup.types.Location;
+    { target = TargetLoc, source = { span = SrcSpan }} = XRef
+      : codemarkup.types.XRefLocation
+
+# find-refs: no implementation
+predicate CSharpEntityUses:
+  {
+    target: code.csharp.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  } # no implementation
+
+# kinds and symbol info
+predicate CSharpEntityKind:
+  {
+    entity: code.csharp.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind} where
+    { decl = Defn } = Entity;
+    ( { type = TDefn } = Defn;
+      { namedType = NDefn } = TDefn;
+      ( { class_ = _ } = NDefn; Class_ = Kind ) |
+      ( { interface_ = _ } = NDefn; Interface = Kind ) |
+      ( { record_ = _ } = NDefn; Struct = Kind ) |
+      ( { struct_ = _ } = NDefn; Struct = Kind );
+    ) | (
+      { method = _ } = Defn; Method = Kind
+    ) | (
+      { field = _ } = Defn; Field = Kind
+    ) | (
+      { typeParameter = _ } = Defn; TypeParameter = Kind
+    ) | (
+      { property = _ } = Defn; Property = Kind
+    );
+
+}
diff --git a/glean/schema/source/codemarkup.cxx.angle b/glean/schema/source/codemarkup.cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.cxx.angle
@@ -0,0 +1,1040 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.cxx.4 {
+import src
+import code.cxx
+import codemarkup.types
+import cxx1
+import fbthrift
+import code.24
+
+# Resolving locations to entities
+
+# Resolve locations for all traces in a Cxx file
+predicate CxxResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.cxx.Entity,
+  }
+  { { Str, File, Range, Destination }, Entity } where
+    Trace = cxx1.Trace { file = File };
+    CxxResolveTraceLocation { Trace, { Str, File, Range, Destination }, Entity };
+
+# Resolve locations for Cxx, but for only a specific trace
+# We'll need to pick the trace on the client
+predicate CxxResolveTraceLocation:
+  {
+    trace : cxx1.Trace,
+    location: codemarkup.types.Location,
+    entity: code.cxx.Entity,
+  }
+  { Trace, Location, Entity } where
+    Trace = cxx1.Trace { file = File, declarations = cxx1.Declarations Decls };
+    Decl = Decls[..];
+    # most declarations (their definition if present)
+    (
+      if ( cxx1.DeclarationLocationNameSpan { Decl, Range, Str, NameFile, NameSpan } )
+        then ( # if we have a 'destination' name span
+          Destination = { just = { NameFile, NameSpan } };
+          Location = codemarkup.types.Location { Str, File, { range = Range }, Destination }
+        ) else (
+          # use the entity span only (usingDirectives, usingDeclarations)
+          cxx1.DeclarationLocationName { Decl, Range, Str };
+          Location = codemarkup.types.Location { Str, File, { range = Range }, nothing }
+        );
+      CxxResolveDeclarationToEntity { Decl, Entity };
+
+    # and find some extra enumerators: extracted from the enum decl
+    ) | (
+      { enum_ = EnumDecl } = Decl;
+      cxx1.EnumDefinition { declaration = EnumDecl, enumerators = Es };
+      Enumerator = Es[..];
+      { cxx1.Name Name, _, Range } = Enumerator;
+      { file = File } = Range;
+      Location = codemarkup.types.Location { Name, File, { range = Range }, nothing };
+      { enumerator = Enumerator } = Entity;
+    )
+
+# For a given declaration, match to proper code.cxx.Entity. It will be
+# a definition entity if the given declaration points to a definition.
+predicate CxxResolveDeclarationToEntity:
+  {
+    decl: cxx1.Declaration,
+    entity: code.cxx.Entity,
+  }
+  { Decl, Entity } where
+    if (
+      { function_ = FunctionDecl } = Decl;
+      FunctionDefn = cxx1.FunctionDefinition { declaration = FunctionDecl }
+    ) then (
+      { defn = { function_ = FunctionDefn } } = Entity
+    ) else if (
+      { record_ = RecordDecl } = Decl;
+      RecordDefn = cxx1.RecordDefinition { declaration = RecordDecl }
+    ) then (
+      { defn = { record_ = RecordDefn } } = Entity
+    ) else if (
+      { enum_ = EnumDecl } = Decl;
+      EnumDefn = cxx1.EnumDefinition { declaration = EnumDecl }
+    ) then (
+      { defn = { enum_ = EnumDefn } } = Entity
+    ) else if (
+      { namespace_ = NamespaceDecl } = Decl;
+      NamespaceDefn = cxx1.NamespaceDefinition { declaration = NamespaceDecl }
+    ) then (
+      { defn = { namespace_ = NamespaceDefn } } = Entity
+    ) else if (
+      { objcContainer = ContDecl } = Decl;
+      ContainerDefn = cxx1.ObjcContainerDefinition { declaration = ContDecl }
+    ) then (
+      { defn = { objcContainer = ContainerDefn } } = Entity
+    ) else if (
+      { objcMethod = MethDecl } = Decl;
+      MethDefn = cxx1.ObjcMethodDefinition MethDecl
+    ) then (
+      { defn = { objcMethod = MethDefn } } = Entity
+    ) else (
+      { decl = Decl } = Entity
+    )
+
+# If an entity is a declaration, try to find its definition, which
+# might be in a different file. There might be multiple definitions
+# (but presumably not linked in the same binary, because that would
+# violate the One Definition Rule).
+predicate CxxFindDefinitionOfEntity:
+  {
+    entity: code.cxx.Entity,
+    definition: code.cxx.Entity,
+  }
+  ( { { defn = A }, { defn = B } } where A = B )
+  |
+   (
+     { { decl = D }, DefEnt }
+     where
+      if (
+        code.cxx.DeclToDef { D, Defn };
+      ) then (
+        { defn = Defn } = DefEnt;
+      ) else (
+        { decl = D } = DefEnt;
+      )
+   )
+
+# Finding entities' locations
+
+predicate CxxEntityLocation:
+  {
+    entity: code.cxx.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity , { Name, File, { range = Range }, Destination } } where
+    ( { decl = Decl } = Entity;
+      cxx1.DeclarationLocationNameSpan { Decl, Range, Name, NameFile, NameSpan };
+      { file = File } = Range;
+      { just = { NameFile, NameSpan } } = Destination;
+    ) | (
+      { defn = Defn } = Entity;
+      cxx1.DefToBaseDecl { Defn, Decl };
+      cxx1.DeclarationLocationNameSpan { Decl, Range, Name, NameFile, NameSpan };
+      { file = File } = Range;
+      { just = { NameFile, NameSpan } } = Destination;
+    ) | (
+      { enumerator = { name = cxx1.Name Name, source = Range } } = Entity;
+      { file = File } = Range;
+      nothing = Destination; # we only have the range for enumerators
+    );
+
+# Finding references in a file
+
+# n.b. limited support for finding C++ xrefs by file, as the types are
+# generally too complex to flatten in Angle. We only provide local-to-file
+# xrefs via this path. To do the full set see glass Query/Cxx.hs
+#
+predicate CxxFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.cxx.Entity,
+  }
+  { File, XRef, Entity } where
+    (
+      Trace = cxx1.FileXRefs { xmap = { file = File } };
+      CxxFileEntityXMapFixedXRefLocations { Trace, XRef, Entity }
+    ) | (
+      CxxFileEntitySpellingXRefLocations { File, XRef, Entity }
+    )
+
+# Fixed C++ xrefs, keyed by a specific cxx1.FileXRefs fact
+# We will expand any targets as best we can
+predicate CxxFileEntityXMapFixedXRefLocations:
+  {
+    trace: cxx1.FileXRefs,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.cxx.Entity,
+  }
+  { Trace, XRef, Entity } where
+    cxx1.FileXRefs { xmap = { fixed = Fixeds } } = Trace;
+    cxx1.FixedXRef { XRefTarget, From } = Fixeds[..];
+    CxxXRefTargetLocation { XRefTarget, Entity, Location };
+    { spans = PackedSpans, spellings = PackedSpellings } = From;
+    Spans = prim.unpackByteSpans PackedSpans;
+    Spellings = prim.unpackByteSpans PackedSpellings;
+    Span = (Spans | Spellings)[..];
+    { Location, { span = Span } } = XRef;
+
+predicate CxxFileEntitySpellingXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.cxx.Entity,
+  }
+  { File, XRef, Entity } where
+    cxx1.SpellingXRef { { File, Span }, XRefTarget };
+    CxxXRefTargetLocation { XRefTarget, Entity, Location };
+    { Location, { span = Span } } = XRef;
+
+# Helper to (partially) process XRefTargets to entities and xrefs
+predicate CxxXRefTargetLocation:
+  {
+    target: cxx1.XRefTarget,
+    entity: code.cxx.Entity,
+    location: codemarkup.types.Location,
+  }
+  { XRefTarget, Entity, Location } where
+    # fixed declaration entities
+    ( { declaration = Decl } = XRefTarget;
+      cxx1.DeclarationLocationNameSpan { Decl, Range, Name, NameFile, NameSpan };
+      { file = TargetFile } = Range;
+      Destination = { just = { NameFile, NameSpan } };
+      { Name, TargetFile, { range = Range }, Destination } = Location;
+      CxxResolveDeclarationToEntity { Decl, Entity };
+    ) | (
+    # or jump through the decl sometimes to a def
+      { declaration = Decl } = XRefTarget;
+      CxxDeclToDefXRefTargetLocation { Decl, Entity, Location };
+    ) | (
+    # fixed enumerator entities
+      { enumerator = Enum } = XRefTarget;
+      { cxx1.Name Name, _, Range } = Enum;
+      { file = TargetFile } = Range;
+      { Name, TargetFile, { range = Range }, nothing } = Location;
+      { enumerator = Enum } = Entity;
+    )
+    # objcSelector -- not an entity type
+    # objcSelectorSlot -- can't implement due to array indexing
+    # unknown -- just a file and a point in the file tbd
+    # indirect -- can't implement due to recursion
+
+#
+# Find xrefs associated with decls in this file / trace
+#
+# For decls, compute unique xrefs to defns
+# For defns, compute unique xrefs to decls (decl families)
+#
+predicate CxxFileEntityTraceDeclToDefXRefLocations:
+  {
+    file: src.File,
+    trace: cxx1.Trace,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.cxx.Entity,
+  }
+  { File, Trace, XRef, Entity } where
+    Trace = cxx1.Trace { File, cxx1.Declarations Decls, _ };
+    Decl = Decls[..];
+    cxx1.DeclarationNameSpan { Decl, _, Span };
+    # Get xrefs from decl to defn ,and defn back to decl family
+    ({ Entity, Location } where
+      CxxDeclToDefXRefTargetLocation { Decl, Entity, Location } |
+      CxxDefToDeclFamilyXRefTargetLocation { Decl, Entity, Location }
+    );
+    { Location, { span = Span }} = XRef;
+
+# For a given Decl, it might have a base Defn, build an entity for that
+# Iff the target is not the same as the source Decl
+predicate CxxDeclToDefXRefTargetLocation:
+  {
+    decl: cxx1.Declaration,
+    entity: code.cxx.Entity,
+    location: codemarkup.types.Location
+  }
+  { Decl1, Entity, Location } where
+    CxxResolveDeclarationToEntity { Decl1, { decl = _ } };
+    code.cxx.DeclToDef { Decl1, Defn };
+    cxx1.DefToBaseDecl { Defn , Decl2 };
+    Decl1 != Decl2; # Filter out (many) self refs
+    cxx1.DeclarationLocationNameSpan { Decl2, Range, Name, NameFile, NameSpan };
+    { file = TargetFile } = Range;
+    Destination = { just = { NameFile, NameSpan } };
+    { Name, TargetFile, { range = Range }, Destination } = Location;
+    { defn = Defn } = Entity;
+
+# For a given Decl, find any DeclFamily entries
+# We will turn these into xrefs
+predicate CxxDefToDeclFamilyXRefTargetLocation:
+  {
+    decl: cxx1.Declaration,
+    entity: code.cxx.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Decl1, Entity, Location } where
+    CxxResolveDeclarationToEntity { Decl1, { defn = _ } };
+    cxx1.DeclFamilyOf { decl = Decl1, family = Decl2 };
+    Decl1 != Decl2; # filter out many self-refs
+    cxx1.DeclarationLocationNameSpan { Decl2, Range, Name, NameFile, NameSpan };
+    { file = TargetFile } = Range;
+    Destination = { just = { NameFile, NameSpan } };
+    { Name, TargetFile, { range = Range }, Destination } = Location;
+    { decl = Decl2 } = Entity;
+
+# Bulk fetch any declaration locations associated with the xref targets
+# Rather than O(n) calls to map over the external target xrefs,
+# we can bulk-fetch all locations in one go, saving a lot of calls
+predicate CxxFileEntityXMapVariableXRefDeclLocations:
+  {
+    trace: cxx1.FileXRefs,
+    source: cxx1.Declaration, # used to identify the source
+    location: codemarkup.types.Location,
+  }
+  { Trace, Decl, Location } where
+    cxx1.FileXRefs { targets = Ts } = Trace;
+    cxx1.XRefTargets Targets = Ts[..];
+    { declaration = Decl } = Targets[..];
+    cxx1.DeclarationLocationNameSpan { Decl, Range, Name, NameFile, NameSpan };
+    { file = TargetFile } = Range;
+    Destination = { just = { NameFile, NameSpan } };
+    { Name, TargetFile, { range = Range }, Destination } = Location;
+
+predicate XRefTargetToEntity:
+  {
+    xrefTarget: cxx1.XRefTarget,
+    ent: code.cxx.Entity
+  }
+  { X, E } where
+    ({ declaration = D } = X; { decl = D } = E) |
+    ({ enumerator = En } = X; { enumerator = En } = E) | (
+      { indirect = { target = X2 } } = X; (
+        ({ declaration = D2 } = X2; { decl = D2 } = E) |
+        ({ enumerator = En2 } = X2; { enumerator = En2 } = E)
+      )
+    )
+
+predicate EntityToXRefTarget:
+  {
+    ent: code.cxx.Entity,
+    xrefTarget: cxx1.XRefTarget
+  }
+  { E, X } where
+    ({ decl = D } = E; { declaration = D } = X) |
+    ({ enumerator = En } = E; { enumerator = En } = X)
+
+predicate CxxEntityIdl:
+  {
+    ent: code.cxx.Entity,
+    idlEnt: code.IdlEntity,
+  }
+  { E, I } where
+    EntityToXRefTarget { E, XRefTarget };
+    cxx1.CxxToThrift { from = XRefTarget, to = Thrift };
+    fbthrift.DeclarationFile { Thrift, fbthrift.File F };
+    { lang = Thrift,
+      file = F,
+      entity = { just = { fbthrift = { decl = Thrift } } },
+      range = nothing } = I
+
+# Bulk fetch any idl entities associated with the xref in the filexrefs
+predicate CxxFileEntityIdl:
+  {
+    trace: cxx1.FileXRefs,
+    ent: code.Entity,
+    idlEnt: code.IdlEntity,
+  }
+  { Trace, { cxx = Entity }, Idl } where
+    cxx1.FileXRefs { xmap = { fixed = Fs }, targets = Ts } = Trace;
+    (
+      cxx1.XRefTargets Targets = Ts[..];
+      XRefTarget = Targets[..];
+      XRefTargetToEntity { XRefTarget, Entity };
+      CxxEntityIdl { ent = Entity, idlEnt = Idl }
+    ) | (
+       { target = XRefTarget } = Fs[..];
+       XRefTargetToEntity { XRefTarget, Entity };
+       CxxEntityIdl { ent = Entity, idlEnt = Idl };
+    )
+
+# Bulk fetch any definitions associated with the external decls in the filexrefs
+predicate CxxFileEntityXMapVariableXRefDeclToDefs:
+  {
+    trace: cxx1.FileXRefs,
+    source: cxx1.Declaration, # used to identify the source
+    entity: code.cxx.Entity, # enough stuff to build a xreflocation
+    location: codemarkup.types.Location,
+  }
+  { Trace, Decl, Entity, Location } where
+    cxx1.FileXRefs { targets = Ts } = Trace;
+    cxx1.XRefTargets Targets = Ts[..];
+    # decls
+    # todo:  more cases: recursion: indirect xrefs could be decls too
+    { declaration = Decl } = Targets[..];
+    CxxDeclToDefXRefTargetLocation { Decl, Entity, Location };
+
+#
+# Language entity uses
+#
+
+predicate CxxIdlEntityUses:
+  {
+    target: code.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+{ Target, File, Span} where
+  { fbthrift = { decl = Thrift } } = Target;
+  cxx1.ThriftToCxx { Thrift, { declaration = CxxDecl } };
+  CxxEntityUses { { decl = CxxDecl }, File, Span }
+
+predicate CxxEntityUses:
+  {
+    target: code.cxx.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  ({ { decl = Decl }, File, Span } where
+    cxx1.DeclFamilyOf { Decl, D };
+    cxx1.TargetUses { { declaration = D }, File, From };
+    { spans = PackedSpans, spellings = PackedSpellings } = From;
+    Spans = prim.unpackByteSpans PackedSpans;
+    Spellings = prim.unpackByteSpans PackedSpellings;
+    Span = (Spans | Spellings)[..]) |
+  ({ { defn = Defn }, File, Span } where
+    CxxEntityDefinitionBase { Defn, DeclBase };
+    cxx1.DeclFamilyOf { DeclBase, D };
+    cxx1.TargetUses { { declaration = D }, File, From };
+    { spans = PackedSpans, spellings = PackedSpellings } = From;
+    Spans = prim.unpackByteSpans PackedSpans;
+    Spellings = prim.unpackByteSpans PackedSpellings;
+    Span = (Spans | Spellings)[..]) |
+  ({ { enumerator = E }, File, Span } where
+    cxx1.TargetUses { { enumerator = E }, File, From };
+    { spans = PackedSpans, spellings = PackedSpellings } = From;
+    Spans = prim.unpackByteSpans PackedSpans;
+    Spellings = prim.unpackByteSpans PackedSpellings;
+    Span = (Spans | Spellings)[..])
+
+# For definitions, we find uses of the underlying declaration
+# For classes and anything else with ctors and dtors we also include uses
+# of the ctor and dtors
+predicate CxxEntityDefinitionBase:
+  {
+    target : code.cxx.Definition,
+    base: cxx1.Declaration
+  }
+  { Defn, Decl } where
+    # case 1: the base decl
+    cxx1.DefToBaseDecl { Defn, Decl } |
+    # case 2: for records, their ctors and dtors, a subset of functions
+    ( cxx1.DefinitionEntity Defn;
+      { record_ = RecordDefn } = Defn;
+      cxx1.RecordDefinition { members = cxx1.Declarations Decls } = RecordDefn;
+      Decl = Decls[..];
+      { function_ = { name = FQName } } = Decl;
+      { name = { constructor = _ } | { destructor = _ } } = FQName;
+    )
+
+#
+# Language-specific symbol info
+#
+
+predicate CxxEntityKind:
+  {
+    entity: code.cxx.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { CxxD, Kind } where
+    ({ decl = Decl } = CxxD;
+     CxxDeclKind { Decl, Kind }) |
+    ({ enumerator = _ } = CxxD; Enumerator = Kind) |
+    ({ defn = Defn } = CxxD;
+     cxx1.DefToBaseDecl { Defn, Decl };
+     CxxDeclKind { Decl, Kind } )
+
+predicate CxxDeclKind:
+  {
+    decl: cxx1.Declaration,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { Decl, Kind } where
+    ({ function_ = { name = FQN, method = MM } } = Decl;
+      { name = FN } = FQN;
+      ( { constructor = _ } = FN; Constructor = Kind ) |
+      ( { destructor = _ } = FN; Constructor = Kind ) |
+      ( { operator_ = _ } = FN; Operator = Kind ) |
+      ( { literalOperator = _ } = FN; Operator = Kind ) |
+      ( { conversionOperator = _ } = FN; Operator = Kind ) |
+      ( { name = _ } = FN;
+        ( { just = _ } = MM; Method = Kind ) |
+        ( nothing = MM; Function = Kind )
+      )
+    ) | (
+      ({ enum_ = _ } = Decl; Enum_ = Kind ) |
+      ({ namespace_ = _ } = Decl; Namespace = Kind ) |
+      ({ objcMethod = _ } = Decl; Method = Kind ) |
+      ({ objcProperty = _ } = Decl; Property = Kind ) |
+      ({ typeAlias = _ } = Decl; Type = Kind ) | # typedef or using
+      ({ usingDeclaration = _ } = Decl; Namespace = Kind ) |
+      ({ variable = _ } = Decl; Variable = Kind ) |
+      # TODO: more objc containers, using directives
+      ({ objcContainer = { id = ObjcId } } = Decl;
+        ({ interface_ = _ } |
+        { categoryInterface = _ } |
+        { extensionInterface = _ }) = ObjcId; Interface = Kind;
+      ) | (
+        { record_ = R } = Decl;
+        ({ kind = { struct_ = _ } } = R; Struct = Kind ) |
+        ({ kind = { class_ = _ } } = R; Class_ = Kind ) |
+        ({ kind = { union_ = _ } } = R; Union = Kind )
+      )
+    )
+
+predicate CxxEntityInfo:
+  {
+    entity: code.cxx.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { CxxD, Info } where
+    ({ decl = Decl } = CxxD;
+     CxxDeclInfo { Decl, Info }) |
+    ({ enumerator = _ } = CxxD;
+     { kind = Enumerator, isAbstract = false } = Info) |
+    ({ defn = Defn } = CxxD;
+     cxx1.DefToBaseDecl { Defn, Decl };
+     CxxDeclInfo { Decl, Info }; )
+
+predicate CxxDeclInfo:
+  {
+    decl: cxx1.Declaration,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { Decl, { kind = Kind, isAbstract = Abs } } where
+    CxxDeclKind { decl = Decl, kind = Kind };
+    if (Method = Kind) then (
+      ({ function_ = { method = { just = M }}} = Decl;
+         { isVirtual = Abs } = M
+      ) |
+      (
+        { objcMethod = _ } = Decl;
+        false = Abs;
+      )
+    ) else (
+      false = Abs
+    )
+
+#
+# Annotations
+#
+
+predicate CxxAnnotation:
+  {
+    entity: code.cxx.Entity,
+    anns: code.cxx.Annotations,
+  }
+  {{ decl = Decl }, { attributes = As }} where
+    { function_ = F } = Decl;
+    if (cxx1.FunctionDeclAttribute { F, A })
+      then (As=[A])
+      else (As=[]:[cxx1.Attribute]);
+#
+# Visibility and modifiers
+#
+
+predicate CxxVisibility:
+  {
+    entity: code.cxx.Entity,
+    visibility: codemarkup.types.Visibility,
+  }
+  { Entity, Visibility } where
+    ( { decl = Decl } = Entity;
+      CxxDeclVisibility { Decl, Visibility }
+    ) | (
+      { defn = Defn } = Entity;
+      CxxDefnVisibility { Defn, Visibility }
+    );
+
+predicate CxxDeclVisibility:
+  {
+    decl: cxx1.Declaration,
+    visibility: codemarkup.types.Visibility
+  }
+  { Decl, Visibility } where
+    Decl : cxx1.Declaration;
+    if cxx1.DeclarationScope { Decl, Scope } then
+      (
+        { recordWithAccess = { access = Access } } = Scope;
+        FromCxxVisibility { Access, Visibility }
+      )
+    else
+      # Objc things don't have Scope
+      (
+        { objcMethod = _ } |
+          { objcProperty = _ } |
+          { objcContainer = _ } = Decl;
+        Public = Visibility
+      )
+
+predicate CxxDefnVisibility:
+  {
+    decl: code.cxx.Definition,
+    visibility: codemarkup.types.Visibility
+  }
+  { Defn, Visibility } where
+    cxx1.DefToBaseDecl { Defn, Decl };
+    CxxDeclVisibility { Decl, Visibility }
+
+# helper from C++ visibility to the codemarkup.types version
+predicate FromCxxVisibility:
+  { cxx : cxx1.Access,
+    out : codemarkup.types.Visibility
+  }
+  { In, Out } where
+    ( Public = In; Public ) |
+    ( Private = In; Private ) |
+    ( Protected = In; Protected ) = Out;
+
+# Sets of modifier keywords on a symbol
+predicate CxxModifiers:
+  {
+    entity: code.cxx.Entity,
+    keywords: codemarkup.types.Modifiers
+  }
+  { Entity, Modifiers } where
+    ( { defn = Defn } = Entity; CxxDefinitionModifiers { Defn, Modifiers }) |
+    ( { decl = Decl } = Entity; CxxDeclarationModifiers { Decl, Modifiers });
+
+predicate CxxDefinitionModifiers:
+  {
+    entity: code.cxx.Definition,
+    keywords: codemarkup.types.Modifiers
+  }
+  { Defn, Modifiers } where
+    ( { function_ = FunDefn } = Defn;
+      { declaration = FunDecl, isInline = Inline } = FunDefn;
+      CxxDeclarationModifiers { { function_ = FunDecl } , ModifiersBase };
+      { _, _, _, _, _, Const, _, Volatile, Virtual, _ } = ModifiersBase;
+      { false, false, false, false, false,
+        Const, false, Volatile, Virtual, Inline } = Modifiers;
+    ) | (
+      { objcMethod = M : cxx1.ObjcMethodDeclaration } = Defn;
+      CxxDeclarationModifiers { { objcMethod = M }, Modifiers };
+    ) | (
+      { variable = VarDecl } = Defn;
+      CxxDeclarationModifiers { { variable = VarDecl } , Modifiers };
+    );
+
+predicate CxxDeclarationModifiers:
+  {
+    entity: cxx1.Declaration,
+    keywords: codemarkup.types.Modifiers
+  }
+  { Decl, Modifiers } where
+    ( { function_ = { method = MSig, name = { scope = Scope } } } = Decl;
+      if ( { just = { isVirtual = V, isConst = C, isVolatile = Vol } } = MSig )
+        then ( Virtual = V; Const = C; Volatile = Vol )
+        else ( Virtual = false; Const = false; Volatile = false );
+      Static = if (nothing = MSig; { recordWithAccess = _ } = Scope)
+        then true
+        else false;
+      Inline = false; Readonly = false; Static = Static; Mutable = false;
+    ) | (
+      { objcProperty = { isReadOnly = Readonly, isInstance = Instance } } = Decl;
+      Const = false; Volatile = false; Virtual = false; Inline = false;
+      Static = (if (Instance = true) then false else true); Mutable = true;
+    ) | (
+      { objcMethod = { isInstance = Instance } } = Decl;
+      Readonly = false;
+      Const = false; Volatile = false; Virtual = false; Inline = false;
+      Static = (if (Instance = true) then false else true); Mutable = true;
+    ) | (
+      { variable = { kind = Kind } } = Decl;
+      ( { global_ = { VKind, Attr, _ } } = Kind;
+        Static = if ( StaticVariable | StaticMember = VKind )
+          then ( true ) else ( false );
+        Inline = if ( Inline = Attr ) then ( true ) else ( false );
+        Const = if ( Constexpr = Attr ) then ( true ) else ( false );
+        Volatile = false; Virtual = false; Readonly = false; Mutable = false;
+      ) | (
+        { local = { LKind, Attr } } = Kind;
+        Static = if ( StaticVariable = LKind ) then ( true ) else ( false );
+        Const = if ( Constexpr = Attr ) then ( true ) else ( false );
+        Volatile = false; Virtual = false; Readonly = false; Inline = false;
+        Mutable = false;
+      ) | (
+        { field = { mutable_ = Mutable } } = Kind;
+        Static = false; Readonly = false; Const = false;
+        Volatile = false; Virtual = false; Readonly = false; Inline = false;
+      );
+    );
+    { false, false, false, Static, Readonly, Const, Mutable,
+        Volatile, Virtual, Inline } = Modifiers;
+
+#
+# Relations
+#
+
+# The child `extends` parent relationship
+predicate CxxExtendsParentEntity :
+  {
+    child : code.cxx.Entity,
+    parent : code.cxx.Entity
+  }
+  { Child, Parent } where
+    ( { decl = Decl } = Child;
+      CxxDeclarationExtendsParent { Decl, Parent }
+    ) | (
+      { defn = Defn } = Child;
+      CxxDefinitionExtendsParent { Defn, Parent }
+    )
+
+# child extends parent for definitions
+#
+# - records (structs, classses)
+# - methods
+# - objC things
+#
+predicate CxxDefinitionExtendsParent:
+  {
+    child : code.cxx.Definition,
+    parent : code.cxx.Entity
+  }
+  { Child, Parent } where
+    ( { record_ = C } = Child;
+      cxx1.RecordDefinition { bases = BS } = C;
+      cxx1.RecordBase { base = P } = BS[..];
+      CxxResolveDeclarationToEntity { { record_ = P }, Parent }
+    ) | (
+      { objcContainer = { declaration = C }} = Child;
+      cxx1.ObjcImplements { C, P } | cxx1.ObjcContainerBase{ C, P };
+      CxxResolveDeclarationToEntity { { objcContainer = P }, Parent }
+    )
+
+predicate CxxDeclarationExtendsParent:
+  {
+    child : cxx1.Declaration,
+    parent : code.cxx.Entity
+  }
+  { Child, Parent } where
+    ( { record_ = _ } = Child;
+      code.cxx.DeclToDef { Child, Defn };
+      CxxDefinitionExtendsParent { Defn, Parent }
+    ) | (
+      { function_ = C } = Child;
+      cxx1.MethodOverrides { C, P };
+      CxxResolveDeclarationToEntity { { function_ = P }, Parent }
+    ) | (
+      { objcContainer = C } = Child;
+      cxx1.ObjcImplements { C, P } | cxx1.ObjcContainerBase{ C, P };
+      CxxResolveDeclarationToEntity { { objcContainer = P }, Parent }
+    )
+
+# The parent `extended by` child relationship
+predicate CxxExtendsChildEntity :
+  {
+    parent: code.cxx.Entity,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    ( { decl = Decl } = Parent;
+      CxxDeclarationExtendsChild { Decl, Child }
+    ) | (
+      { defn = Defn } = Parent;
+      CxxDefinitionExtendsChild { Defn, Child }
+    )
+
+predicate CxxDefinitionExtendsChild:
+  {
+    parent: code.cxx.Definition,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    cxx1.DefToBaseDecl { Parent, Decl };
+    CxxDeclarationExtendsChild { Decl, Child }
+
+predicate CxxDeclarationExtendsChild:
+  {
+    parent: cxx1.Declaration,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    ( { record_ = P } = Parent;
+      cxx1.RecordDerived { P, C };
+      CxxResolveDeclarationToEntity { { record_ = C }, Child }
+    ) | (
+      { function_ = P } = Parent;
+      cxx1.MethodOverridden { P, C };
+      CxxResolveDeclarationToEntity { { function_ = C }, Child }
+    ) | (
+      { objcContainer = P } = Parent;
+      cxx1.ObjcContainerInheritance { P, C };
+      CxxResolveDeclarationToEntity { { objcContainer = C }, Child }
+    )
+
+# The child of parent relationship
+#
+# works for only some things
+#
+# - enumerators -> enum
+# - nested records/unions/structs
+# - methods -> container classes
+#
+predicate CxxContainsParentEntity :
+  {
+    child: code.cxx.Entity,
+    parent: code.cxx.Entity
+  }
+  { Child, Parent } where
+    ( { decl = Decl } = Child;
+      CxxDeclarationContainsParent { Decl, Parent };
+    ) | (
+      { defn = Defn } = Child;
+      CxxDefinitionContainsParent { Defn, Parent }
+    ) | (
+     { enumerator = E } = Child;
+     cxx1.EnumeratorInEnum { E, Enum };
+     { defn = { enum_ = Enum } } = Parent
+    )
+
+# Definition to parent container, efficiently
+predicate CxxDefinitionContainsParent:
+  {
+    child : code.cxx.Definition,
+    parent : code.cxx.Entity
+  }
+  { Child, Parent } where
+    # most C++ things: functions, records, variables:
+    { record_ = _ } |
+    { function_ = _ } |
+    { enum_ = _ } |
+    { variable = _ } = Child;
+    cxx1.DefnInRecord { Child, P }; # find the precise parent set
+    { defn = { record_ = P } } = Parent
+
+#
+# we can find parents via the cxx1.Scope of the child
+# this works ok for definition types, where we restrict by membership filters
+# we can't do this for namespaces yet, without enumerating traces or all decls
+#
+predicate CxxDeclarationContainsParent:
+  {
+    child: cxx1.Declaration,
+    parent: code.cxx.Entity
+  }
+  { Child, Parent } where
+    # most C++ things: functions, records, variables:
+    { usingDeclaration = _ } |
+    { usingDirective = _ } |
+    { record_ = _ } |
+    { enum_ = _ } |
+    { function_ = _ } |
+    { variable = _ } |
+    { typeAlias = _ } = Child;
+    cxx1.DeclInRecord { Child, P }; # find the precise parent set
+    { defn = { record_ = P } } = Parent
+
+    #  | (
+    #  { objcMethod = _ } | { objcProperty = _ } = Child;
+    #  cxx1.DeclInObjcContainer { Child, P };
+    #  { defn = { objcContainer = P } } = Parent
+    #)
+
+#
+# The parent `contains` child relationship
+#
+predicate CxxContainsChildEntity :
+  {
+    parent: code.cxx.Entity,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    ( { decl = Decl} = Parent;
+      CxxDeclarationContainsChild { Decl, Child }
+    ) | (
+      { defn = Defn } = Parent;
+      CxxDefinitionContainsChild { Defn, Child }
+    )
+
+# Lookup container child for definition occurences
+#
+# - records
+# - objc containers
+# - namespaces
+# - enums
+#
+predicate CxxDefinitionContainsChild:
+  {
+    parent: code.cxx.Definition,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    ( { record_ = Defn } = Parent;
+      cxx1.RecordDefinition { members = cxx1.Declarations Decls } = Defn;
+      Decl = Decls[..];
+      CxxResolveDeclarationToEntity { Decl, Child }
+    ) | (
+      { objcContainer = Defn } = Parent;
+      cxx1.ObjcContainerDefinition { members = cxx1.Declarations Decls } = Defn;
+      Decl = Decls[..];
+      CxxResolveDeclarationToEntity { Decl, Child }
+    ) | (
+      # namespace member facts are all empty, so instead lookup by scope
+      { namespace_ = Defn } = Parent;
+      cxx1.NamespaceDefinition { declaration = Decl } = Defn;
+      CxxNamespaceDeclarationContainsChild { Decl, Child }
+    ) | (
+      { enum_ = Defn } = Parent;
+      cxx1.EnumDefinition { enumerators = Es } = Defn;
+      E = Es[..];
+      { enumerator = E } = Child
+    )
+      # we could add params of methods and functions
+      # { function_ = Defn } = Container;
+      # ( { objcMethod = Defn } = Container ) |
+
+      # these do not have children
+      # ( { variable = Defn } = Container ) |
+
+# Lookup container children via decl goes via its definition
+predicate CxxDeclarationContainsChild:
+  {
+    parent: cxx1.Declaration,
+    child: code.cxx.Entity
+  }
+  { Parent, Child } where
+    ( { namespace_ = Decl } = Parent;
+      CxxNamespaceDeclarationContainsChild { Decl, Child }
+    ) | (
+      ({ record_ = _ } | { objcContainer = _ } | { enum_ = _ } ) = Parent;
+      code.cxx.DeclToDef { Parent, Defn };
+      CxxDefinitionContainsChild { Defn, Child }
+    )
+
+# Namespaces contain children with the namespace as its scope
+# these can be quite large for common namespaces shared widely
+predicate CxxNamespaceDeclarationContainsChild:
+  {
+    parent: cxx1.NamespaceDeclaration,
+    child: code.cxx.Entity
+  }
+  { Decl, Child } where
+    { name = NSQName } = Decl;
+    Scope = cxx1.Scope { namespace_ = NSQName };
+    ( Q = cxx1.QName { name = _, scope = Scope }; # n.b. not left prefixed!
+        (
+          code.cxx.Entity { decl = { record_ = { name = Q }}}  |
+          code.cxx.Entity { decl = { variable = { name = Q }}} |
+          code.cxx.Entity { decl = { typeAlias = { name = Q }}} |
+          code.cxx.Entity { decl = { enum_ = { name = Q }}}
+        )
+    ) | (
+        D = cxx1.FunctionDeclaration { name = { scope = Scope } };
+        code.cxx.Entity { decl = { function_ = D } }
+    ) = Child;
+
+# comment blocks across declaration families
+predicate CxxEntityDocumentation :
+  {
+    entity : code.cxx.Entity,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+  { E, F, S } where
+    ( { decl = Decl } = E;
+      cxx1.DeclarationComment{ declaration = Decl, file = F, span = S }
+    ) | (
+      { defn = Defn } = E;
+      cxx1.DefToBaseDecl { Defn, DeclBase };
+      cxx1.DeclarationComment{ declaration = DeclBase, file = F, span = S }
+    )
+
+predicate CxxDataAvailable : src.File
+  F where
+    src.File _ = F;
+      # double negation is used to check for existence
+      # (even if the Angle compiler could notice and optimize)
+    !(!(cxx1.Trace {file = F}))
+
+predicate CxxEntityUSR :
+  {
+    entity : code.cxx.Entity,
+    usr : cxx1.USR,
+  }
+  { E, U } where
+    (  { defn = Defn } = E;
+        cxx1.DefToBaseDecl { Defn, DeclBase };
+        cxx1.DeclFamilyOf { DeclBase, Decl };
+        cxx1.DeclarationToUSR { Decl,  U };
+    ) | (
+      { decl = Decl } = E;
+      cxx1.DeclFamilyOf { Decl, DeclFam };
+      cxx1.DeclarationToUSR { DeclFam, U };
+    )
+
+# TODO: do we have to care about decl families? (see CxxEntityUSR above)
+predicate SymbolToEntity:
+  {
+    usr: code.cxx.SymbolId,
+    entity: code.cxx.Entity,
+  }
+  { Symbol, Entity } where
+  cxx1.USRToDeclaration { hash = Symbol, declaration = Decl };
+  Decl = cxx1.Declaration D;
+  ( (D = { objcContainer = { id =
+    { protocol = _ }
+    | { interface_ = _ }
+    | { categoryInterface = _ }
+    | { extensionInterface = _ } } })
+  | (D = { objcMethod = { container =
+    { protocol = _ }
+    | { implementation = _ }
+    | { categoryImplementation = _ }
+    | { extensionInterface = _ } } })
+  | !(D = { objcContainer = _ } | { objcMethod = _ }) );
+  Entity = { decl = Decl };
+
+predicate CxxEntityMangledNameHash :
+  {
+    entity : code.cxx.Entity,
+    hash : cxx1.MangledNameHash,
+  }
+  { E, H } where
+    (  { defn = Defn } = E;
+        cxx1.DefToBaseDecl { Defn, DeclBase };
+        cxx1.DeclFamilyOf { DeclBase, Decl };
+        cxx1.MangledNameHashToDeclaration { H,  Decl };
+    ) | (
+      { decl = Decl } = E;
+      cxx1.DeclFamilyOf { Decl, DeclFam };
+      cxx1.MangledNameHashToDeclaration { H,  DeclFam };
+    )
+
+predicate CxxDeclarationSource:
+  {
+    target: cxx1.Declaration,
+    referrer: code.cxx.Entity,
+  }
+  { Target, Referrer} where
+    cxx1.DeclarationSources { target = Target, sources = Sources };
+    Source = Sources[..];
+    { decl = Source } = Referrer;
+
+predicate CxxEntitySource:
+  {
+    target: code.cxx.Entity,
+    source: code.cxx.Entity,
+  }
+  { Target, Referrer} where
+    ( {decl = Decl} = Target ;
+      CxxDeclarationSource { Decl, Referrer}
+    ) | (
+      {defn = Def } = Target;
+      cxx1.DefToBaseDecl { Def, Decl };
+      CxxDeclarationSource{ Decl, Referrer}
+    )
+}
diff --git a/glean/schema/source/codemarkup.dataswarm.angle b/glean/schema/source/codemarkup.dataswarm.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.dataswarm.angle
@@ -0,0 +1,23 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.dataswarm.1 {
+    import src
+    import code.24
+    import code.dataswarm
+    import codemarkup.types
+    import dataswarm
+
+    # derived predicate to find references in a file (to support Glass/Codehub integration)
+    predicate DataswarmFileEntityXRefLocations:
+    {
+        file: src.File,
+        xref: codemarkup.types.XRefLocation,
+        entity: code.dataswarm.Entity,
+    }
+    {File, {Location, { span = SrcSpan }}, { decl = Decl } } where
+    dataswarm.XRefsByFile { file = File, xrefs = XRefs };
+    dataswarm.XRef { target = Decl, source = SrcSpan } = XRefs[..];
+    dataswarm.DeclarationLocation { declaration = Decl, file = TargetFile, span = TargetSpan};
+    dataswarm.DeclarationName { declaration = Decl, name = DeclName};
+    Location = codemarkup.types.Location { DeclName, TargetFile, { span = TargetSpan }, nothing };
+}
diff --git a/glean/schema/source/codemarkup.erlang.angle b/glean/schema/source/codemarkup.erlang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.erlang.angle
@@ -0,0 +1,106 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.erlang.2 {
+import src
+import code.erlang
+import codemarkup.types
+import erlang
+
+#
+# Resolving locations to entities
+#
+
+predicate ErlangResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.erlang.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Declaration } } where
+    # Location.name is weird but we aren't using it for anything yet.
+    # Weirdness is that distinct fucntions foo/1 and foo/2 have same Location.name ("foo").
+    # Use `Name = Fqn.name + str(Fqn.arity)` when primops available so names are "foo/1" and "foo/2"
+    Declaration = erlang.Declaration { func = { fqn = {name = Name}, file = File, span = Span } };
+
+#
+# Finding entities' locations
+#
+
+predicate ErlangEntityLocation:
+  {
+    entity: code.erlang.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { decl = D }, { Name, File, { span = Span }, nothing } } where
+    erlang.DeclarationLocation { declaration = D, file = File, span = Span };
+    # Location.name here is weird, see ErlangResolveLocation comment
+    { func = erlang.FunctionDeclaration { fqn = {name = Name } , file = _, span = _} } = D;
+
+#
+# Finding references in a file
+#
+
+predicate ErlangFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.erlang.Entity,
+  }
+  {
+     File,
+     { target = TargetLocation, source = { span = Span } },
+     { decl = Decl }
+  }
+  where
+  erlang.XRefsViaFqnByFile { file = File, xrefs = XRefs };
+  { target = Fqn, source = Span } = XRefs[..];
+  erlang.DeclarationWithFqn { fqn = Fqn, declaration = Decl };
+  # Location.name here is weird, see ErlangResolveLocation comment
+  { func = { fqn = { name = Name }, file = TargetFile, span = TargetSpan } } = Decl;
+  { Name, TargetFile, { span = TargetSpan }, nothing } = TargetLocation;
+
+#
+# Language entity uses
+#
+
+predicate ErlangEntityUses:
+  {
+    target: code.erlang.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { { decl = D }, File, Span } where
+  erlang.DeclarationUses { declaration = D, file = File, span = Span}
+
+#
+# Language-specific symbol info
+#
+
+predicate ErlangEntityKind:
+  {
+    entity: code.erlang.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { { decl = { func = D } }, Function } where
+  erlang.FunctionDeclaration {} = D
+
+# For backward compatibility:
+predicate ErlangEntityInfo:
+  {
+    entity: code.erlang.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { E, { kind = K, isAbstract = false } } where
+  ErlangEntityKind { E, K }
+
+  predicate ErlangEntityDocumentation :
+  {
+    entity : code.erlang.Entity,
+    file : src.File,
+    span : src.ByteSpan,
+    text : maybe string,
+  }
+  { Entity, File, Span, Text } where
+  { decl = Decl } = Entity;
+  erlang.DeclarationComment { Decl1, File, Span, Text };
+  erlang.Declaration { func = Decl1 } = Decl
+}
diff --git a/glean/schema/source/codemarkup.fbthrift.angle b/glean/schema/source/codemarkup.fbthrift.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.fbthrift.angle
@@ -0,0 +1,205 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.fbthrift.1 {
+
+import code.fbthrift
+import codemarkup.types
+import src
+import fbthrift
+
+#
+# Resolving locations to entities
+#
+
+predicate ThriftResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.fbthrift.Entity,
+  }
+  { { Name, FileS, { range = Range }, nothing }, { decl = Decl } } where
+    FileT = fbthrift.File FileS;
+    fbthrift.FileDeclaration { FileT, Decl };
+    fbthrift.DeclarationNameSpan { Decl, Identifier, FileT, {LB, CB, LE, CE} };
+    Identifier = fbthrift.Identifier Name;
+    { file = FileS, lineBegin = LB, columnBegin = CB, lineEnd = LE, columnEnd = CE } = Range;
+
+#
+# Finding entities' locations
+#
+
+predicate ThriftEntityLocation:
+  {
+    entity: code.fbthrift.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { decl = Decl }, { Name, File, RangeSpan, nothing } } where
+    ( fbthrift.DeclarationNameSpan { Decl, Ident, fbthrift.File File, Loc };
+      fbthrift.Identifier Name = Ident;
+      { LB, CB, LE, CE } = Loc;
+      { range = { File, LB, CB, LE, CE } } = RangeSpan;
+    ) | (
+      { include_ = fbthrift.File File } = Decl;
+      src.File Name = File;
+      { span = {0,0} } = RangeSpan;
+    )
+
+#
+# Finding references in a file
+#
+
+predicate ThriftFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.fbthrift.Entity,
+  }
+ {
+   File,
+   { target = TargetLocation, source = { range = SourceRange } },
+   { decl = XRefTarget }
+  }
+  where
+  FileT = fbthrift.File File;
+  fbthrift.FileXRefs { file = FileT, xrefs = XRefs };
+  { { startLine = LB, startCol = CB, endLine = LE, endCol = CE }  , XRefTarget } = XRefs[..];
+  { file = File, lineBegin = LB, columnBegin = CB, lineEnd = LE, columnEnd = CE } = SourceRange;
+  fbthrift.DeclarationNameSpan { decl = XRefTarget,
+                               name = fbthrift.Identifier Name,
+                               file = TargetFileT,
+                               span = { TLB, TCB, TLE, TCE } };
+  TargetFileT = fbthrift.File TargetFile;
+  TargetRange = {TargetFile, TLB, TCB, TLE, TCE };
+  { Name, TargetFile, { range = TargetRange }, nothing } = TargetLocation;
+
+#
+# Kinds and annotations
+#
+
+predicate ThriftEntityKind:
+  {
+    entity: code.fbthrift.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { { decl = Decl }, Kind } where
+    ({ include_ = _ } = Decl; File = Kind) |
+    ({ function_ = _ } = Decl; Function = Kind) |
+    ({ enumValue = _ } = Decl; Enumerator = Kind) |
+    ({ constant = _ } = Decl; Constant = Kind) |
+    ({ named = { name = { kind = typedef_ } } } = Decl; Type = Kind) |
+    ({ named = { name = { kind = enum_ } } } = Decl; Enum_ = Kind) |
+    ({ named = { name = { kind = struct_ } } } = Decl; Struct = Kind) |
+    ({ named = { name = { kind = union_ } } } = Decl; Union = Kind) |
+    ({ field = _ } = Decl; Field = Kind ) |
+    # we don't have a great symbol kinds for thesse
+    ({ exception_ = _ } = Decl; Value = Kind) |
+    ({ service_ = _ } = Decl; Class_ = Kind)
+
+
+#
+# Extends relationships
+#
+
+predicate ThriftContainsChildEntity :
+  {
+    parent: code.fbthrift.Entity,
+    child: code.fbthrift.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+    ( { service_ = P } = Parent;
+      F = fbthrift.FunctionName { service_ = P };
+      { function_ = F } = Child
+    ) | (
+      { include_ = F } = Parent;
+      QN = fbthrift.QualName { file = F };
+      fbthrift.DeclarationName { qname = QN, decl = Child }
+    ) | (
+      { exception_ = { name = QN } } = Parent;
+      { field = { qname = QN, kind = exception_ } } = Child
+    ) | (
+      { named = { name = { name = QN, kind = struct_ } } } = Parent;
+      { field = { qname = QN, kind = struct_ } } = Child
+    ) | (
+      { named = { name = { name = QN, kind = union_ } } } = Parent;
+      { field = { qname = QN, kind = union_ } } = Child
+    ) | (
+      { named = { name = { name = QN, kind = enum_ } } } = Parent;
+      { enumValue = { enum_ = { name = QN, kind = enum_ } } } = Child
+    )
+
+predicate ThriftContainsParentEntity :
+  {
+    child: code.fbthrift.Entity,
+    parent: code.fbthrift.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    ( { function_ = F } = Child;
+      fbthrift.FunctionName { service_ = P } = F;
+      { service_ = P } = Parent
+    ) | (
+      ( { exception_ = { name = QName } } ) |
+      ( { service_ = { name = QName } } ) |
+      ( { constant = { name = QName } } ) |
+      ( { named = { name = { name = QName } } } ) = Child;
+      { file = File } = QName;
+      { include_ = File } = Parent
+    ) | (
+      { field = { qname = QN, kind = exception_ } } = Child;
+      { exception_ = { name = QN } } = Parent
+    ) | (
+      { field = { qname = QN, kind = struct_ } } = Child;
+      { named = { name = { name = QN, kind = struct_ } } } = Parent
+    ) | (
+      { field = { qname = QN, kind = union_ } } = Child;
+      { named = { name = { name = QN, kind = union_ } } } = Parent
+    ) | (
+      { enumValue = { enum_ = { name = QN, kind = enum_ } } } = Child;
+      { named = { name = { name = QN, kind = enum_ } } } = Parent
+    )
+
+predicate ThriftExtendsChildEntity :
+  {
+    parent: code.fbthrift.Entity,
+    child: code.fbthrift.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+    { service_ = P } = Parent;
+    fbthrift.ServiceChild { parent = P, child = C };
+    { service_ = C } = Child
+
+predicate ThriftExtendsParentEntity :
+  {
+    child: code.fbthrift.Entity,
+    parent: code.fbthrift.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    { service_ = C } = Child ;
+    fbthrift.ServiceParent { child = C, parent = P };
+    { service_ = P } = Parent
+
+predicate FbthriftEntityDocumentation :
+  {
+    entity : code.fbthrift.Entity,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Entity, File, Span } where
+    { decl = Decl } = Entity;
+    fbthrift.DeclarationComment { Decl, File, Span }
+
+predicate FbthriftEntityUses:
+  {
+    target: code.fbthrift.Entity,
+    file: src.File,
+    range: src.Range,
+  }
+  { { decl = Decl }, File, Range } where
+    fbthrift.DeclarationUses { Decl, File, Loc };
+    { LB, CB, LE, CE } = Loc;
+    { file = File,
+      lineBegin = LB,
+      columnBegin = CB,
+      lineEnd = LE,
+      columnEnd = CE
+    } = Range;
+
+}
diff --git a/glean/schema/source/codemarkup.flow.angle b/glean/schema/source/codemarkup.flow.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.flow.angle
@@ -0,0 +1,242 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.flow.2 {
+import src
+import code.flow
+import codemarkup.types
+import flow
+
+# Resolving locations to entities
+
+predicate FlowResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.flow.Entity,
+  }
+  { { NameStr, File, { span = Span }, nothing }, Entity } where
+    ( { decl = Decl } = Entity;
+      flow.FileDeclaration { File, Decl };
+      flow.DeclarationNameSpan { Decl, Name, Span };
+      Name = flow.Name NameStr
+    ) | (
+      flow.ModuleLocationByFile { File, Mod, Span, NameStr };
+      { module_ = Mod } = Entity
+    )
+
+# Finding entities' locations
+
+predicate FlowEntityLocation:
+  {
+    entity: code.flow.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { NameStr, File, { span = Span }, nothing } } where
+    ( { decl = D } = Entity;
+      flow.DeclarationLocation { decl = D, file = File, span = Span };
+      flow.DeclarationNameSpan { decl = D, name = Name };
+      Name = flow.Name NameStr;
+    ) | (
+      { module_ = Mod } = Entity;
+      flow.ModuleLocation { Mod, File, Span, NameStr }
+    )
+
+predicate FlowFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.flow.Entity,
+  }
+  { File, XRef, Entity } where
+    FlowFileReferenceEntityXRefLocations { File, XRef, Entity } |
+    FlowFileImportDeclEntityXRefLocations { File, XRef, Entity }
+
+# Flow cross-references from occurrences.
+#
+# References in the Flow index point to the local import declaration
+# in the file.  To resolve these to the remote reference:
+#
+#  * For each reference in the file (flow.FileXRef)
+#  * emit a DirectXRef to its target
+#  * also, if the target is a flow.ImportDeclaration
+#  * find the source of the import, and emit a DirectXRef to that
+#
+# And do the same for type declarations.
+#
+# This will result in two DirectXRefs for each non-local reference,
+# one pointing to the import declaration and another to the non-local
+# target. The client can decide which one(s) it wants.
+#
+predicate FlowFileReferenceEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.flow.Entity,
+  }
+  { File, {Location, { span = Src }}, Entity } where
+    flow.FileXRef { file = File, ref = XRef };
+    flow.FlowXRefDeclInfo { XRef, SrcLoc, Name, TargetLoc, D };
+    Name = flow.Name Str;
+    { span = Src } = SrcLoc;
+    (
+      # TODO: should be able to inline M, but the optimiser got it wrong
+      { module = M, span = TargetSpan } = TargetLoc;
+      { file = TargetFile } = M;
+      { decl = D } = Entity;
+    ) | (
+      { localRef = { declaration = LocalD } } = XRef;
+      flow.FlowImportXRef { LocalD, Entity, TargetFile, TargetSpan };
+    ) | (
+      { typeRef = { typeDeclaration = T } } = XRef;
+      flow.FlowTypeImportXRef { T, Entity, TargetFile, TargetSpan };
+    );
+    Location = codemarkup.types.Location { Str, TargetFile, { span = TargetSpan }, nothing }
+
+# Flow cross-references from import declarations.
+#
+# We want to hyperlink the identifiers in an import declaration to the
+# source of the import:
+#
+# * For each declaration in the file (flow.FileDeclaration)
+# * If it is an import declaraiton, find the source (reusing FlowImportXRef)
+#
+# and do the same for type declarations (FlowTypeImportXRef).
+#
+predicate FlowFileImportDeclEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.flow.Entity,
+  }
+  { File, { Location, { span = Src } }, Entity } where
+    flow.FileDeclaration { File, D };
+    (
+      { localDecl = LocalD } = D;
+      flow.FlowImportXRef { LocalD, Entity, TargetFile, TargetSpan };
+      { name = Name, loc = SrcLoc } = LocalD;
+    ) | (
+      { typeDecl = TypeD } = D;
+      flow.FlowTypeImportXRef { TypeD, Entity, TargetFile, TargetSpan };
+      { name = Name, loc = SrcLoc } = TypeD;
+    );
+    Location = codemarkup.types.Location { Str, TargetFile, { span = TargetSpan }, nothing };
+    Name = flow.Name Str;
+    { span = Src } = SrcLoc;
+
+#
+# Language entity uses
+#
+
+predicate FlowEntityUses:
+  {
+    target: code.flow.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { Entity, File, Span } where
+    flow.FlowEntityUsesAll { Entity, File, Span };
+
+#
+# relations
+#
+
+predicate FlowContainsParentEntity :
+  {
+    child: code.flow.Entity,
+    parent: code.flow.Entity
+  }
+  { { decl = Child }, { module_ = Parent } } where
+    ( { localDecl = Decl } = Child;
+      { loc = { module = Parent } } = Decl;
+    ) | (
+      { memberDecl = Decl } = Child;
+      { loc = { module = Parent } } = Decl;
+    ) | (
+      { typeDecl = Decl } = Child;
+      { loc = { module = Parent } } = Decl;
+    )
+
+predicate FlowContainsChildEntity :
+  {
+    parent: code.flow.Entity,
+    child: code.flow.Entity
+  }
+  { { module_ = Parent }, { decl = Child } } where
+    flow.ModuleContains { Parent, Child }
+
+# kinds and symbol info
+predicate FlowEntityKind:
+  {
+    entity: code.flow.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind} where
+    ( { decl = Decl } = Entity;
+      ( { localDecl = _ } = Decl;
+        Object_ = Kind # not true
+      ) | (
+        { memberDecl = _ } = Decl;
+        Property = Kind # not true either
+      ) | (
+        { typeDecl = _ } = Decl;
+        Type = Kind
+      )
+    ) | (
+      { module_ = _ } = Entity;
+      Module = Kind
+    )
+
+# documentation spans in flow are attached to declarations only
+predicate FlowEntityDocumentation :
+  {
+    entity : code.flow.Entity,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Entity, File, Span } where
+    ( { decl = Decl } = Entity;
+      FlowDeclarationDocumentation { Decl, File, Span }
+    ) | (
+      { module_ = Module } = Entity;
+      flow.ModuleComments { Module, File, Span }
+    )
+
+predicate FlowDeclarationDocumentation :
+  {
+    decl : flow.SomeDeclaration,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Decl, File, Span } where
+    ( { localDecl = D } = Decl;
+      flow.DeclarationInfo { D, _, { just = Docs }, _ }
+    ) | (
+      { memberDecl = D } = Decl;
+      flow.MemberDeclarationInfo { D, _, { just = Docs }, _ }
+    ) | (
+      { typeDecl = D } = Decl;
+      flow.TypeDeclarationInfo { D, _, { just = Docs }, _ }
+    );
+    FlowDocumentationSpan { Docs, File, Span }
+
+predicate FlowDocumentationSpan :
+  {
+    doc : flow.Documentation,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Docs, File, Span } where
+    { module = M , span = Span } = Docs;
+    ( { file = File } = M ) |
+    ( { string_ = Str } = M; flow.StringToFileModule { Str , File } )
+
+predicate FlowEntityModuleName :
+  {
+    entity : code.flow.Entity,
+    name : string
+  }
+  { { module_ = Module }, Name } where
+    flow.ModuleLocation { module_ = Module, name = Name };
+
+}
+
+
diff --git a/glean/schema/source/codemarkup.graphql.angle b/glean/schema/source/codemarkup.graphql.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.graphql.angle
@@ -0,0 +1,77 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.graphql.1 {
+
+import src
+import code.graphql
+import codemarkup.types
+import graphql
+
+#
+# Resolving locations to entities
+#
+
+predicate GraphQLResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.graphql.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Decl } } where
+    graphql.FileDeclarations { File, Span, Decl };
+    graphql.DeclHasName { Decl, graphql.Value Name };
+
+#
+# Finding entities' locations
+#
+
+predicate GraphQLEntityLocation:
+  {
+    entity: code.graphql.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { span = Span }, nothing } } where
+    { decl = Decl } = Entity;
+    graphql.DeclarationLocation { Decl, File, Span };
+    graphql.DeclHasName { Decl, graphql.Value Name };
+
+#
+# Finding references in a file
+#
+
+predicate GraphQLFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.graphql.Entity,
+  }
+  { File, { Location, { span = SrcSpan } }, { decl = Decl } } where
+    graphql.FileXRefs { File, { Decl, SrcSpan } };
+    graphql.DeclarationLocation { Decl, DstFile, DstSpan };
+    graphql.DeclHasName { Decl, graphql.Value Name };
+    { Name, DstFile, { span = DstSpan }, nothing } = Location;
+
+#
+# Language entity uses
+#
+
+predicate GraphQLEntityUses:
+  {
+    target: code.graphql.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { { decl = Decl }, File, Span } where
+    graphql.DeclarationUses { Decl, File, Span }
+
+# kinds and symbol info
+predicate GraphQLEntityKind:
+  {
+    entity: code.graphql.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind } where
+    { decl = Decl } = Entity;
+    ({ fragment_ = _ } = Decl; Fragment = Kind ) |
+    ({ operation_ = _ } = Decl; Operation = Kind );
+
+}
diff --git a/glean/schema/source/codemarkup.hack.angle b/glean/schema/source/codemarkup.hack.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.hack.angle
@@ -0,0 +1,991 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.hack.2 {
+import src
+import code.24
+import code.hack
+import hack
+import codemarkup.types
+import fbthrift
+
+predicate HackResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.hack.Entity,
+  }
+  { { Name, File, { span = Span }, {just = {file = File, span = NameSpan}}}, { decl = Decl } } where
+    hack.FileDeclarations { file = File, declarations = Ds };
+    Decl = Ds[..];
+    hack.DeclarationName Decl -> (hack.Name Name);
+    hack.DeclarationSpan { declaration = Decl, file = File, span = Span };
+    hack.DeclarationLocation { declaration = Decl, file = File, span = NameSpan };
+
+# Finding entities' locations
+
+predicate HackEntityLocation:
+  {
+    entity: code.hack.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { decl = D }, { Name, File, { span = Span }, nothing } } where
+    hack.DeclarationName D -> (hack.Name Name);
+    hack.DeclarationSpan { declaration = D, file = File, span = Span }
+
+# Finding references in a file
+
+predicate HackFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.hack.Entity,
+  }
+  { File, { Location, { span = Src } }, { decl = D } } where
+    hack.FileXRefs { file = File, xrefs = XRefs };
+    hack.XRef { target = { declaration = D }, ranges = Uses } = elements XRefs;
+    hack.DeclarationName D -> (hack.Name TargetName);
+    hack.DeclarationLocation { declaration = D, file = TargetFile, span = TargetSpan };
+    Location = codemarkup.types.Location { TargetName, TargetFile, { span = TargetSpan }, nothing };
+    Sources = prim.relToAbsByteSpans Uses;
+    Src = Sources[..];
+
+predicate HackFileEntityXRefSpans:
+  {
+    file: src.File,
+    span: src.ByteSpan,
+    entity: code.hack.Entity,
+  }
+  { File, Src, { decl = D } } where
+    hack.FileXRefs { file = File, xrefs = XRefs };
+    hack.XRef { target = { declaration = D }, ranges = Uses } = elements XRefs;
+    Sources = prim.relToAbsByteSpans Uses;
+    Src = Sources[..]
+
+#
+# Language entity uses
+#
+
+predicate HackIdlEntityUses:
+  {
+    target: code.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+{ Target, File, Span} where
+  { fbthrift = { decl = Thrift } } = Target;
+  hack.ThriftToHack { Thrift, Hack };
+  HackEntityUses { { decl = Hack }, File, Span }
+
+predicate HackEntityUses:
+  {
+    target: code.hack.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { { decl = D }, File, Span } where
+    hack.TargetUses { target = { declaration = D }, file = File, uses = Uses };
+    Spans = prim.relToAbsByteSpans Uses;
+    Span = Spans[..];
+
+predicate HackEntityKind:
+  {
+    entity: code.hack.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { {decl = Decl}, Kind } where
+    ({ classConst = _ } = Decl; Constant = Kind) |
+    ({ container = C } = Decl;
+      ({ class_ = _ } = C; Class_ = Kind) |
+      ({ enum_ = _ } = C; Enum_ = Kind) |
+      ({ interface_ = _ } = C; Interface = Kind) |
+      ({ trait = _ } = C; Trait = Kind)
+    ) |
+    ({ enumerator = _ } = Decl; Field = Kind) |
+    ({ function_ = _ } = Decl; Function = Kind) |
+    ({ globalConst = _ } = Decl; Constant = Kind) |
+    ({ method = _ } = Decl; Method = Kind) |
+    ({ namespace_ = _ } = Decl; Namespace = Kind) |
+    ({ property_ = _ } = Decl; Property = Kind) |
+    ({ typeConst = _ } = Decl; Type = Kind) |
+    ({ typedef_ = _ } = Decl; Type = Kind) |
+    ({ module = _ } = Decl; Module = Kind)
+
+predicate HackEntityInfo:
+  {
+    entity: code.hack.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { {decl = Decl}, { kind = Kind, isAbstract = Abs } } where
+    HackEntityKind { {decl = Decl}, Kind };
+    ( Method = Kind;
+      { method = M } = Decl;
+      hack.MethodDefinition { declaration = M, isAbstract = Abs }
+    ) |
+    ( Property = Kind;
+      { property_ = P } = Decl;
+      hack.PropertyDefinition { declaration = P, isAbstract = Abs }
+    ) |
+    ( Constant = Kind;
+      { classConst = C } = Decl;
+      hack.ClassConstDefinition { declaration = C, value = V };
+      ( nothing = V; true = Abs ) | ( { just = _ } = V; false = Abs )
+    ) |
+    ( Type = Kind;
+      { typeConst = T } = Decl;
+      hack.TypeConstDefinition { declaration = T, kind = TCKind };
+      ( Concrete = TCKind; false = Abs ) |
+      ( Abstract = TCKind; true = Abs) |
+      ( PartiallyAbstract = TCKind; true = Abs)
+    ) |
+    ( false = Abs;
+      (Class_ = Kind) |
+      (Constant = Kind; { globalConst = _ } = Decl) |
+      (Enum_ = Kind) |
+      (Interface = Kind) |
+      (Trait = Kind) |
+      (Function = Kind) |
+      (Namespace = Kind) |
+      (Type = Kind; { typedef_ = _ } = Decl) |
+      (Module = Kind) |
+      (Field = Kind)
+    )
+
+#
+# Annotations
+#
+
+predicate HackAnnotation :
+  {
+    entity: code.hack.Entity,
+    anns: code.hack.Annotations,
+  }
+  { { decl = D }, { attributes = A }} where
+    ( { container = C } = D;
+      ( { class_ = Decl } = C;
+        hack.ClassDefinition { declaration = Decl, attributes = A }
+      ) | (
+        { enum_ = Decl } = C;
+        hack.EnumDefinition { declaration = Decl, attributes = A }
+      ) | (
+        { interface_ = Decl } = C;
+        hack.InterfaceDefinition { declaration = Decl, attributes = A }
+      ) | (
+        { trait = Decl } = C;
+        hack.TraitDefinition { declaration = Decl, attributes = A }
+      )
+    ) | (
+      { method = Decl } = D;
+      hack.MethodDefinition { declaration = Decl, attributes = A }
+    ) | (
+      { function_ = Decl } = D;
+      hack.FunctionDefinition { declaration = Decl, attributes = A }
+    ) | (
+      { property_ = Decl } = D;
+      hack.PropertyDefinition  {declaration = Decl, attributes = A }
+    ) | (
+      { typeConst = Decl } = D;
+      hack.TypeConstDefinition { declaration = Decl, attributes=A }
+    ) | (
+      { typedef_ = Decl } = D;
+      hack.TypedefDefinition { declaration = Decl, attributes = A }
+    ) | (
+      { module = Decl } = D;
+      hack.ModuleDefinition { declaration = Decl, attributes = A }
+    )
+
+#
+# Visibility
+#
+
+# just the visibility attributes
+predicate HackVisibility :
+  {
+    entity: code.hack.Entity,
+    visibility: codemarkup.types.Visibility,
+  }
+  { { decl = D }, V } where
+    ( { method = Decl } = D;
+      hack.MethodDefinition { declaration = Decl, visibility = Vis}
+    ) | (
+      { property_ = Decl } = D;
+      hack.PropertyDefinition { declaration = Decl, visibility = Vis}
+    ) | (
+      # optional `internal` modifier on things that are contained by a module
+      ( { function_ = Decl } = D;
+        hack.FunctionDefinition { declaration = Decl, module_ = M } ) |
+      ( { typedef_ = Decl } = D;
+        hack.TypedefDefinition { declaration = Decl, module_ = M }
+      ) | (
+        { container = Decl } = D;
+        ( { class_ = CDecl } = Decl;
+          hack.ClassDefinition { declaration = CDecl, module_ = M } ) |
+        ( { enum_ = CDecl } = Decl;
+          hack.EnumDefinition { declaration = CDecl, module_ = M } ) |
+        ( { interface_ = CDecl } = Decl;
+          hack.InterfaceDefinition { declaration = CDecl, module_ = M } ) |
+        ( { trait = CDecl } = Decl;
+          hack.TraitDefinition { declaration = CDecl, module_ = M } )
+      );
+      { just = { internal = true } } = M;
+      Internal = Vis;
+    ) | (
+      { classConst = _ } = D;
+      Public = Vis;
+    ) | (
+      { typeConst = _ } = D;
+      Public = Vis;
+    );
+
+    FromHackVisibility { Vis, V };
+
+# helper from Hack visibility to the codemarkup.types version
+predicate FromHackVisibility:
+  { hack : hack.Visibility,
+    out : codemarkup.types.Visibility
+  }
+  { In, Out } where
+    ( Public = In; Public ) |
+    ( Private = In; Private ) |
+    ( Protected = In; Protected ) |
+    ( Internal = In; Internal ) = Out;
+
+# Sets of modifier keywords on a symbol
+predicate HackModifiers:
+  {
+    entity: code.hack.Entity,
+    modifiers: codemarkup.types.Modifiers
+  }
+  { { decl = Decl }, Modifiers } where
+    ( { method = Method } = Decl;
+      hack.MethodDefinition { declaration = Method,
+        isAbstract = Abstract, isFinal = Final,
+        isAsync = Async, isStatic = Static };
+        Readonly = false; Const = false;
+    ) | (
+      { property_ = Property } = Decl;
+      hack.PropertyDefinition { declaration = Property,
+        isAbstract = Abstract, isFinal = Final, isStatic = Static };
+      Async = false; Readonly = false; Const = false;
+    ) | (
+      { function_ = Func } = Decl;
+      hack.FunctionDefinition { declaration = Func, isAsync = Async };
+        Abstract = false; Final = false; Static = false; Readonly = false;
+        Const = false;
+    ) | (
+      { container = { class_ = Class } } = Decl;
+      hack.ClassDefinition { declaration = Class,
+        isAbstract = Abstract, isFinal = Final };
+      Async = false; Static = false; Readonly = false; Const = false;
+    ) | (
+      { classConst = _ } = Decl;
+      Async = false; Static = false; Abstract = false; Final = false;
+      Const = true;
+    ) | (
+      { typeConst = _ } = Decl;
+      Async = false; Static = false; Abstract = false; Final = false;
+      Const = true;
+    ) | (
+      { globalConst = _ } = Decl;
+      Async = false; Static = true; Abstract = false; Final = false;
+      Const = true;
+    );
+    Volatile = false; Virtual = false; Inline = false;
+     Readonly = false; Mutable = false;
+    { Abstract, Final, Async, Static, Readonly, Const, Mutable,
+       Volatile, Virtual, Inline } = Modifiers;
+
+#
+# Relations
+#
+
+# child `contained by` parent
+#
+# - classConst, method, property, typeConst -> container
+# - enumerator (field) -> enum
+# - direct member of any namespace -> namespace
+#
+predicate HackContainsParentEntity :
+  {
+    child: code.hack.Entity,
+    parent: code.hack.Entity,
+  }
+  { { decl = Child }, { decl = Parent } } where
+    ( ( { classConst = Decl } = Child;
+        hack.ClassConstDeclaration { container = Container } = Decl;
+      ) | (
+        { method = Decl } = Child;
+        hack.MethodDeclaration { container = Container } = Decl;
+      ) | (
+        { property_ = Decl } = Child;
+        hack.PropertyDeclaration { container = Container } = Decl;
+      ) | (
+        { typeConst = Decl } = Child;
+        hack.TypeConstDeclaration { container = Container } = Decl;
+      );
+      Parent = hack.Declaration { container = Container }
+    ) | (
+      { enumerator = { enumeration = Enumeration } } = Child;
+      Parent = hack.Declaration { container = {enum_ = Enumeration} }
+    ) | (
+      hack.DeclarationNamespace { decl = Child, namespace_ = Name };
+      Parent = hack.Declaration { namespace_ = {name = Name }}
+    ) | (
+      hack.ModuleParent { Child, Module };
+      { module = Module } = Parent
+    )
+
+# parent contains child
+# Enums inherits from HH\builtinEnum
+predicate HackContainsChildEntity :
+  {
+    parent: code.hack.Entity,
+    child: code.hack.Entity
+  }
+  { { decl = Container }, { decl = Member } } where
+    ( ( { container = { class_ = Class }} = Container;
+        hack.ClassDefinition { declaration = Class, members = Members };
+      ) | (
+        { container = { interface_ = Interface }} = Container;
+        hack.InterfaceDefinition { declaration = Interface, members = Members };
+      ) | (
+        { container = { trait = Trait }} = Container;
+        hack.TraitDefinition { declaration = Trait, members = Members };
+      );
+      Member = Members[..]
+    ) | (
+      { container = { enum_ = EnumDecl }} = Container;
+      hack.EnumDefinition { declaration = EnumDecl, enumerators = Enumerators };
+      Enumerator = Enumerators[..];
+      Member = hack.Declaration {enumerator = Enumerator}
+    ) | (
+      { namespace_ = {name=Name} } = Container;
+      hack.NamespaceMember { namespace_ = Name, decl = Member}
+    ) | (
+      { module = Module } = Container;
+      hack.ModuleChild { Module, Member };
+    )
+
+# parent extended by child
+predicate HackExtendsChildEntity :
+  {
+    parent : code.hack.Entity,
+    child : code.hack.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+  (
+    { container = P } = Parent;
+    hack.ContainerChild { container = P, child = C };
+    { container = C } = Child;
+  ) |
+  (
+    hack.MethodOverridden{base=P, derived=C};
+    { method = P } = Parent;
+    { method = C } = Child
+  ) |
+  ( { container =
+      { class_ =
+          { name = { name = "BuiltinEnum",  namespace_ = { just = { name = "HH" } } } }
+      }
+    } = Parent;
+    { container = { enum_ = _ } } = Child
+  )
+
+# child extends parent
+predicate HackExtendsParentEntity :
+  {
+    child : code.hack.Entity,
+    parent : code.hack.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    ( { container = C } = Child;
+      hack.ContainerParent { C, P };
+      { container = P } = Parent
+    ) | (
+      hack.MethodOverrides { derived=C, base=P };
+      { method = C } = Child;
+      { method = P } = Parent
+    ) | (
+      { container = { enum_ = _ } } = Child;
+      { container =
+        { class_ =
+            { name = { name = "BuiltinEnum",  namespace_ = { just = { name = "HH" } } } }
+        }
+      } = Parent
+  )
+
+# All method in HH\builtinEnum which are inherited by enum types
+predicate HackEnumInheritedMembers :
+{
+  member_ : hack.MethodDeclaration
+} { member_ = Md } where
+  C : hack.ClassDefinition;
+  C.declaration.name.name = "BuiltinEnum";
+  C.declaration.name.namespace_.just?.name = "HH";
+  C.members = Ms;
+  { method = Md } = Ms[..]
+
+# Inherited parents but drop those with "HideFromDocs" annotations
+# Used to reduce the search space to "interesting" containers only
+predicate HackExtendsParentEntityConcise:
+  {
+    child : code.hack.Entity,
+    parent : code.hack.Entity
+  }
+  { Child, Parent } where
+    HackExtendsParentEntity { Child, Parent };
+    !(EntityHasHideFromDocsAttr Parent)
+
+# Asserts the entity has the "HideFromDocs" attribute
+# (this is an example of where efficient set membership would be useful)
+predicate EntityHasHideFromDocsAttr: code.hack.Entity
+  Entity where
+    HackAnnotation { Entity, { attributes = As } };
+    hack.UserAttribute { name = "HideFromDocs" } = As[..]
+
+# documentation spans
+predicate HackEntityDocumentation :
+  {
+    entity : code.hack.Entity,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+  { E, F, S } where
+    { decl = D } = E;
+    ( hack.DeclarationComment{ D, F, S } ) |
+    # if this is a method, also check for docs on the base of any override
+    ( { method = Derived } = D;
+      hack.MethodOverrides { Derived, Base, _ };
+      hack.DeclarationComment { { method = Base }, F, S }
+    )
+
+predicate HackFileCall :
+  {
+    file: src.File,
+    callee_span: src.ByteSpan,
+    call_args: [code.CallArgument],
+    callee_xref: maybe code.Entity,
+    dispatch_arg: maybe code.CallArgument,
+    receiver_type: maybe code.Entity,
+  } {File, Span, CodeArgs, CalleeEntity, DispatchArg, StaticType } where
+  (
+    hack.FileCall { File, Span, HackArgs, CalleeXRef, HackDispatchArg, HackStaticType, _ };
+    ConvertCallArguments { HackArgs, CodeArgs};
+    ConvertMaybeCallArguments { HackDispatchArg, DispatchArg };
+    ConvertCalleeForFileCall { File, Span, CalleeXRef, CalleeEntity };
+    ConvertStaticType { HackStaticType, StaticType };
+  )
+
+# (internal) helper predicate for CallArgument
+# Manually unrolled to lists of <=6 arguments
+predicate ConvertCallArguments :
+  { hackCallArguments: [hack.CallArgument],
+    codeCallArguments: [code.CallArgument]
+  } {HackArgs, CodeArgs} where
+  (
+    (
+      [] = HackArgs; [] = CodeArgs
+    ) |
+    (
+      [hack.CallArgument{Span_rel, Argument}] = HackArgs;
+      ConvertArgument{Argument, CodeArgument};
+      [Span] = prim.relToAbsByteSpans [Span_rel];
+      CodeArgs = [code.CallArgument{nothing, Span, CodeArgument}]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2}
+      ] = HackArgs;
+      [Span, Span2] = prim.relToAbsByteSpans [Span_rel, Span2_rel];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3}
+      ] = HackArgs;
+      [Span, Span2, Span3] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6},
+        hack.CallArgument{Span7_rel, Argument7}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6, Span7] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel,
+          Span7_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6},
+        code.CallArgument{nothing, Span7, CodeArgument7}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6},
+        hack.CallArgument{Span7_rel, Argument7},
+        hack.CallArgument{Span8_rel, Argument8}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6, Span7, Span8] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel,
+          Span7_rel,
+          Span8_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6},
+        code.CallArgument{nothing, Span7, CodeArgument7},
+        code.CallArgument{nothing, Span8, CodeArgument8}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6},
+        hack.CallArgument{Span7_rel, Argument7},
+        hack.CallArgument{Span8_rel, Argument8},
+        hack.CallArgument{Span9_rel, Argument9}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6, Span7, Span8, Span9] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel,
+          Span7_rel,
+          Span8_rel,
+          Span9_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6},
+        code.CallArgument{nothing, Span7, CodeArgument7},
+        code.CallArgument{nothing, Span8, CodeArgument8},
+        code.CallArgument{nothing, Span9, CodeArgument9}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6},
+        hack.CallArgument{Span7_rel, Argument7},
+        hack.CallArgument{Span8_rel, Argument8},
+        hack.CallArgument{Span9_rel, Argument9},
+        hack.CallArgument{Span10_rel, Argument10}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6, Span7, Span8, Span9, Span10] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel,
+          Span7_rel,
+          Span8_rel,
+          Span9_rel,
+          Span10_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      ConvertArgument{Argument10, CodeArgument10};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6},
+        code.CallArgument{nothing, Span7, CodeArgument7},
+        code.CallArgument{nothing, Span8, CodeArgument8},
+        code.CallArgument{nothing, Span9, CodeArgument9},
+        code.CallArgument{nothing, Span10, CodeArgument10}
+        ]
+    ) |
+    (
+      [
+        hack.CallArgument{Span_rel, Argument},
+        hack.CallArgument{Span2_rel, Argument2},
+        hack.CallArgument{Span3_rel, Argument3},
+        hack.CallArgument{Span4_rel, Argument4},
+        hack.CallArgument{Span5_rel, Argument5},
+        hack.CallArgument{Span6_rel, Argument6},
+        hack.CallArgument{Span7_rel, Argument7},
+        hack.CallArgument{Span8_rel, Argument8},
+        hack.CallArgument{Span9_rel, Argument9},
+        hack.CallArgument{Span10_rel, Argument10},
+        hack.CallArgument{Span11_rel, Argument11}
+      ] = HackArgs;
+      [Span, Span2, Span3, Span4, Span5, Span6, Span7, Span8, Span9, Span10, Span11] = prim.relToAbsByteSpans
+        [ Span_rel,
+          Span2_rel,
+          Span3_rel,
+          Span4_rel,
+          Span5_rel,
+          Span6_rel,
+          Span7_rel,
+          Span8_rel,
+          Span9_rel,
+          Span10_rel,
+          Span11_rel
+        ];
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      ConvertArgument{Argument10, CodeArgument10};
+      ConvertArgument{Argument11, CodeArgument11};
+      CodeArgs = [
+        code.CallArgument{nothing, Span, CodeArgument},
+        code.CallArgument{nothing, Span2, CodeArgument2},
+        code.CallArgument{nothing, Span3, CodeArgument3},
+        code.CallArgument{nothing, Span4, CodeArgument4},
+        code.CallArgument{nothing, Span5, CodeArgument5},
+        code.CallArgument{nothing, Span6, CodeArgument6},
+        code.CallArgument{nothing, Span7, CodeArgument7},
+        code.CallArgument{nothing, Span8, CodeArgument8},
+        code.CallArgument{nothing, Span9, CodeArgument9},
+        code.CallArgument{nothing, Span10, CodeArgument10},
+        code.CallArgument{nothing, Span11, CodeArgument11}
+        ]
+    )
+  )
+
+
+predicate ConvertArgument :
+  { hackArgument : maybe hack.Argument
+  , codeArgument : maybe code.Argument
+  } {Hack, Code} where
+  (
+    { just = { lit = hack.StringLiteral L } } = Hack;
+    { just = { lit = L } } = Code;
+  ) | (
+    { just = { xref = { declaration = L  } } } = Hack;
+    { just = { xref = { hack = code.hack.Entity { decl = L } } } } = Code;
+  ) | (
+    { just = { xref = { occurrence = _ } } } = Hack;
+    nothing = Code;
+  ) | (
+    nothing = Hack ; nothing = Code;
+  )
+
+predicate ConvertMaybeCallArguments : {
+    hackArgument : maybe hack.CallArgument
+  , codeArgument : maybe code.CallArgument
+ }
+ { Hack, Code } where
+ (
+    {just = {Span_rel, HArgument}} = Hack;
+    [Span] = prim.relToAbsByteSpans [Span_rel];
+    ConvertArgument{HArgument, CArgument};
+    {just = {nothing, Span, CArgument}} = Code;
+ ) | (
+    nothing = Hack; nothing = Code;
+ )
+
+predicate ConvertCallee :
+  { hackCallee : maybe hack.XRefTarget
+  , codeCallee : maybe code.Entity
+  }
+  (D : hack.Declaration; {
+    { just = { declaration = D } },
+    { just = { hack = { decl = D } } }
+  }) |
+  {
+     nothing,
+     nothing
+  }
+
+# T157708437: Unresolved calls with matching resolved entities
+# **Don't use this predicate as it will go away.**
+predicate ConvertCalleeForFileCall :
+  { file: src.File,
+    callee_span: src.ByteSpan,
+    hackCallee : maybe hack.XRefTarget
+  , codeCallee : maybe code.Entity
+  }
+  { File, Span, HackCallee, CodeCallee } where
+  ({ just = { declaration = D } } = HackCallee;
+   hack.FileCall { File, Span, _, HackCallee, _, _, _ };
+   { just = { hack = { decl = D } } } = CodeCallee ) |
+  ({ just = O } = HackCallee;
+   { occurrence = {method = {name = N} } } = O;
+   hack.FileXRefs { File, XRefs };
+   # Look for resolved occurrences with the same method name in the call
+   { target = {declaration = D }, ranges = Uses } = elements XRefs;
+   { method = { name = N } } = D;
+   Sources = prim.relToAbsByteSpans Uses;
+   S = Sources[..];
+   src.ByteSpanContains { Span, S };
+   # Match them with the unresolved occurrence
+   { target = O, ranges = OUses } = elements XRefs;
+   OSources = prim.relToAbsByteSpans OUses;
+   S = OSources[..];
+   { just = { hack = { decl = D } } } = CodeCallee ) |
+  (
+     nothing = HackCallee;
+     hack.FileCall { File, Span, _, nothing, _, _, _};
+     nothing = CodeCallee
+  )
+
+predicate ConvertStaticType :
+  { hackCallee : maybe hack.Declaration
+  , codeCallee : maybe code.Entity
+  }
+  (
+    D : hack.Declaration; {{ just = D },
+    { just = { hack = { decl = D } } }
+  }) | {
+     nothing,
+     nothing
+  }
+
+predicate HackEntitySource:
+  {
+    target: code.hack.Entity,
+    source: code.hack.Entity,
+  }
+  { {decl=Decl}, {decl=Source}} where
+    hack.DeclarationSource { Decl, Source };
+
+
+type RequiredRelation =
+  enum {
+    implements_ | extends_ | class_
+  }
+
+predicate HackRequiredConstraint:
+  {
+    entity : code.hack.Entity,
+    requiredRelation : RequiredRelation,
+    required_ : code.hack.Entity
+  } { E, Rel, R } where
+  (
+    Rel = extends_;
+    RE[..] = R.decl?.container?.class_?;
+    hack.InterfaceDefinition { declaration = E.decl?.container?.interface_?, requireExtends = RE }
+  ) | (
+    Rel = extends_;
+    RE[..] = R.decl?.container?.class_?;
+    hack.TraitDefinition { declaration = E.decl?.container?.trait?, requireExtends = RE }
+  ) | (
+    Rel = implements_;
+    RE[..] = R.decl?.container?.interface_?;
+    hack.TraitDefinition { declaration = E.decl?.container?.trait?, requireImplements = RE }
+  ) | (
+    Rel = class_;
+    RE[..] = R.decl?.container?.class_?;
+    hack.TraitDefinition { declaration = E.decl?.container?.trait?, requireClass = { just = RE } }
+  )
+
+predicate HackEntityModuleName:
+  {
+    entity : code.hack.Entity,
+    name : string
+  }
+  { Decl, Name } where Decl.decl?.module?.name = hack.Name Name
+
+predicate HackEntityIdl:
+  {
+    ent : code.hack.Entity,
+    idlEnt : code.IdlEntity,
+  }
+  { E, I } where
+  hack.HackToThrift { from = Hack, to = Thrift };
+  fbthrift.DeclarationFile { Thrift, fbthrift.File F };
+    { lang = Thrift,
+    file = F,
+    entity = { just = { fbthrift = { decl = Thrift } } },
+    range = nothing } = I;
+  { decl = Hack } = E
+
+  predicate HackInheritedEntities : {
+    container : hack.ContainerDeclaration,
+    member : hack.Declaration,
+  } { Container, Member } where
+    hack.InheritedMembers {
+        container = Container,
+        inheritedMembers = InheritedMembers
+    };
+    { members = Cluster } = InheritedMembers[..];
+    Member = Cluster[..]
+
+}
diff --git a/glean/schema/source/codemarkup.haskell.angle b/glean/schema/source/codemarkup.haskell.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.haskell.angle
@@ -0,0 +1,135 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.haskell.2 {
+
+import src
+import code.hs
+import codemarkup.types
+import hs
+
+#
+# Resolving locations to entities
+#
+
+# Resolve Haskell locations
+predicate HaskellResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.hs.Entity,
+  }
+  { { Ent.occ.name, File, { span = Span }, nothing }, { name = Ent } } where
+    hs.SourceModule { File, Mod };
+    hs.ModuleDeclarations { module = Mod, names = Names };
+    Ent = Names[..];
+    hs.DeclarationLocation { name = Ent, span = Span };
+
+#
+# Finding entities' locations
+#
+
+predicate HaskellEntityLocation:
+  {
+    entity: code.hs.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { name = D }, { D.occ.name, File, { span = Span }, nothing } } where
+    hs.DeclarationLocation { D, File, Span };
+
+#
+# Finding references in a file
+#
+
+# XRefs in Haskell
+predicate HaskellFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.hs.Entity,
+  }
+  { File, { Location, { span = Span } }, Entity } where
+    hs.FileXRefs { file = File, xrefs = XRefs };
+    { target = Target, refs = Spans } = XRefs[..];
+    (
+      Target = { name = Name };
+      Entity = { name = Name };
+      hs.DeclarationLocation { name = Name, file = TargetFile, span = TargetSpan };
+      Location = codemarkup.types.Location
+        {
+          name = Name.occ.name,
+          file = TargetFile,
+          location = { span = TargetSpan },
+          destination = nothing
+        };
+    ) | (
+      Target = { modName = ModuleName };
+      Module = hs.Module { name = ModuleName };
+      Entity = { mod = Module };
+      hs.ModuleSource { mod = Module, file = TargetFile };
+      Location = codemarkup.types.Location
+        {
+          name = ModuleName.*,
+          file = TargetFile,
+          location = { range = { TargetFile, 1, 1, 1, 1 }},
+          destination = nothing
+        };
+    );
+    Span = (Spans[..]).span;
+
+#
+# Language entity uses
+#
+
+predicate HaskellEntityUses:
+  {
+    target: code.hs.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { Ent, File, (Spans[..]).span } where
+    (
+      Ent = { name = Name };
+      Target = { name = Name };
+    ) | (
+      Ent = { mod = Module };
+      Target = { modName = Module.name };
+    );
+    hs.XRef { target = Target, file = File, refs = Spans }
+
+
+#
+# Contains
+#
+
+predicate HaskellContainsParentEntity:
+  {
+    child: code.hs.Entity,
+    parent: code.hs.Entity
+  }
+  { { name = ChildName }, { name = ParentName } }
+  where
+  hs.DeclarationOfName { name = ChildName, decl = ChildDecl };
+  (
+    ChildDecl.con?.data_ = ParentName
+  ) | (
+    ChildDecl.field?.con = ParentName
+  ) | (
+    ChildDecl.method?.class_ = ParentName
+  )
+
+predicate HaskellContainsChildEntity:
+  {
+    parent: code.hs.Entity,
+    child: code.hs.Entity
+  }
+  { { name = ParentName }, { name = ChildName } }
+  where
+  hs.DeclarationOfName { name = ParentName, decl = ParentDecl };
+  (
+    (ParentDecl.class_?.methods[..]).name = ChildName
+  ) | (
+    (ParentDecl.data?.constrs[..]).name = ChildName
+  ) | (
+    (ParentDecl.con?.fields[..]).name = ChildName
+  )
+
+}
diff --git a/glean/schema/source/codemarkup.java.angle b/glean/schema/source/codemarkup.java.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.java.angle
@@ -0,0 +1,217 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.java.1 {
+
+import src
+import code.java
+import codemarkup.types
+import java.alpha
+
+#
+# Resolving locations to entities
+#
+
+predicate JavaResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.java.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Decl } } where
+    java.alpha.FileDeclarations { File, Decl };
+    java.alpha.DeclarationLocation { Decl, Name, File, Span }
+
+#
+# Finding entities' locations
+#
+
+predicate JavaEntityLocation:
+  {
+    entity: code.java.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { span = Span }, nothing } } where
+    { decl = Decl } = Entity;
+    java.alpha.DeclarationLocation { Decl, Name, File, Span };
+
+#
+# Finding references in a file
+#
+
+# XRefs
+predicate JavalFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.java.Entity,
+  }
+  { File, { Location, { span = SrcSpan } }, { decl = Decl } } where
+    ( # "regular" xrefs in the body of code
+      java.alpha.FileXRefs { File, XRefs };
+      { XRef, Spans } = XRefs[..];
+      SrcSpan = Spans[..];
+      java.alpha.XRefTargetDeclaration { XRef, Decl };
+      java.alpha.DeclarationLocation { Decl, Name, TargetFile, TargetSpan };
+      if ( File = TargetFile ) # work around T158599862 self-xrefs
+      then ( SrcSpan != TargetSpan )
+      else ( _ = true );
+      Location = codemarkup.types.Location
+        { Name, TargetFile, { span = TargetSpan }, nothing };
+
+      # xrefs in type signatures and other signature components
+    ) | (
+      java.alpha.FileDeclarations { File, SrcDecl };
+      java.alpha.DeclarationType { SrcDecl, Type };
+      java.alpha.XRefOfType { Type, Decl, SrcSpan };
+      java.alpha.DeclarationLocation { Decl, Name, TargetFile, TargetSpan };
+      Location = codemarkup.types.Location
+        { Name, TargetFile, { span = TargetSpan }, nothing };
+    )
+
+#
+# Language entity uses
+#
+
+predicate JavaEntityUses:
+  {
+    target: code.java.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { { decl = Decl }, File, Span } where
+    java.alpha.DeclarationUses { Decl, File, Spans };
+    Span = Spans[..]
+
+#
+# Modififiers, visibility and kinds
+#
+
+predicate JavaVisibility:
+  {
+    entity: code.java.Entity,
+    visibility: codemarkup.types.Visibility
+  }
+  { { decl = Decl } , Visibility } where
+    ( { param = PDecl } = Decl; { modifier = Ms } = PDecl ) |
+    ( { local = LDecl } = Decl; { modifier = Ms } = LDecl ) |
+    ( { field = FDecl } = Decl; { modifiers = Ms } = FDecl ) |
+    ( { ctor = CDecl } = Decl; { modifiers = Ms } = CDecl ) |
+    ( { method = MDecl } = Decl; { modifiers = Ms } = MDecl ) |
+    ( { interface_ = IDecl } = Decl; { modifiers = Ms } = IDecl ) |
+    ( { class_ = CDecl } = Decl; { modifiers = Ms } = CDecl ) |
+    ( { enum_ = EDecl } = Decl; { modifiers = Ms } = EDecl );
+    M = Ms[..];
+    ( java.alpha.Modifier private_ = M ; Private ) |
+    ( java.alpha.Modifier protected_ = M ; Protected ) |
+    ( java.alpha.Modifier public_ = M ; Public ) = Visibility;
+
+predicate JavaModifiers:
+  {
+    entity: code.java.Entity,
+    modifiers: codemarkup.types.Modifiers
+  }
+  { { decl = Decl }, Modifiers } where
+
+    ( { param = PDecl } = Decl; { modifier = Ms } = PDecl ) |
+    ( { local = LDecl } = Decl; { modifier = Ms } = LDecl ) |
+    ( { field = FDecl } = Decl; { modifiers = Ms } = FDecl ) |
+    ( { ctor = CDecl } = Decl; { modifiers = Ms } = CDecl ) |
+    ( { method = MDecl } = Decl; { modifiers = Ms } = MDecl ) |
+    ( { interface_ = IDecl } = Decl; { modifiers = Ms } = IDecl ) |
+    ( { class_ = CDecl } = Decl; { modifiers = Ms } = CDecl ) |
+    ( { enum_ = EDecl } = Decl; { modifiers = Ms } = EDecl );
+    _ = Ms; # defeat binds check
+    IsAbstract = if ( Ms[..] = java.alpha.Modifier abstract_ )
+      then (true) else (false);
+    IsFinal = if ( Ms[..] = java.alpha.Modifier final_ )
+      then (true) else (false);
+    IsStatic = if ( Ms[..] = java.alpha.Modifier static_ )
+      then (true) else (false);
+    IsVolatile =
+      if ( Ms[..] = java.alpha.Modifier volatile_ )
+        then (true) else (false);
+    # also: default, native, strictfp, synchronized, transient
+    { isAbstract = IsAbstract,
+      isFinal = IsFinal,
+      isAsync = false,
+      isStatic = IsStatic,
+      isReadonly = false,
+      isConst = false,
+      isMutable = false,
+      isVolatile = IsVolatile,
+      isVirtual = false,
+      isInline = false } = Modifiers;
+
+# kinds and symbol info
+predicate JavaEntityKind:
+  {
+    entity: code.java.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind} where
+    { decl = Decl } = Entity;
+    ( { param = _ } = Decl; Variable = Kind ) |
+    ( { field = _ } = Decl; Field = Kind ) |
+    ( { local = _ } = Decl; Variable = Kind ) |
+    ( { ctor = _ } = Decl; Constructor = Kind ) |
+    ( { method = _ } = Decl; Method = Kind ) |
+    ( { interface_ = _ } = Decl; Interface = Kind ) |
+    ( { class_ = _ } = Decl; Class_ = Kind ) |
+    ( { enum_ = _ } = Decl; Enum_ = Kind );
+
+# annotations and attributes
+predicate JavaAnnotation :
+  {
+    entity: code.java.Entity,
+    anns: code.java.Annotations,
+  }
+  { { decl = Decl }, { annotations = Anns } } where
+    java.alpha.DeclarationAnnotations { Decl, Anns };
+    Anns != []; # filter out all the empty results. no match implies empty
+
+#
+# Relationships
+#
+
+predicate JavaContainsParentEntity:
+  {
+    child: code.java.Entity,
+    parent: code.java.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    java.alpha.ParentDeclaration { Child, Parent };
+
+predicate JavaContainsChildEntity:
+  {
+    parent: code.java.Entity,
+    child: code.java.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+    java.alpha.ContainsDeclaration { Parent, Child };
+
+predicate JavaExtendsParentEntity:
+  {
+    child: code.java.Entity,
+    parent: code.java.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    java.alpha.ExtendsDeclaration { Child, Parent };
+
+predicate JavaExtendsChildEntity:
+  {
+    child: code.java.Entity,
+    parent: code.java.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+    java.alpha.ExtendedByDeclaration { Parent, Child };
+
+predicate JavaEntityDocumentation :
+  {
+    entity : code.java.Entity,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Entity, File, Span } where
+    { decl = Decl } = Entity;
+    java.alpha.DeclarationComment { Decl, File, Span }
+
+}
diff --git a/glean/schema/source/codemarkup.kotlin.angle b/glean/schema/source/codemarkup.kotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.kotlin.angle
@@ -0,0 +1,89 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.kotlin.1 {
+
+import src
+import code.kotlin
+import codemarkup.types
+import kotlin.alpha
+
+#
+# Resolving locations to entities
+#
+
+predicate KotlinResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.kotlin.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Decl } } where
+    kotlin.alpha.FileDeclarations { File, Decl };
+    kotlin.alpha.DeclarationFileLocation { Decl, File, Span, Name };
+
+predicate KotlinEntityLocation:
+  {
+    entity: code.kotlin.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { span = Span }, nothing } } where
+    { decl = Decl } = Entity;
+    kotlin.alpha.DeclarationFileLocation { Decl, File, Span, Name };
+
+# XRefs : not supported by the Kotlin schema yet
+predicate KotlinFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.kotlin.Entity,
+  } # no implementation
+
+# find-refs: no implementation
+predicate KotlinEntityUses:
+  {
+    target: code.kotlin.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  } # no implementation
+
+# kinds and symbol info
+predicate KotlinEntityKind:
+  {
+    entity: code.kotlin.Entity,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Entity, Kind} where
+    { decl = Decl } = Entity;
+    ( { method = _ } = Decl; Method = Kind ) |
+    ( { class_ = _ } = Decl; Class_ = Kind ) |
+    ( { variable = _ } = Decl; Variable = Kind );
+
+#
+# Relationships
+#
+
+predicate KotlinContainsParentEntity:
+  {
+    child: code.kotlin.Entity,
+    parent: code.kotlin.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    kotlin.alpha.ParentDeclaration { Child, Parent };
+
+predicate KotlinContainsChildEntity:
+  {
+    parent: code.kotlin.Entity,
+    child: code.kotlin.Entity
+  }
+  { { decl = Parent }, { decl = Child } } where
+    kotlin.alpha.ContainsDeclaration { Parent, Child };
+
+predicate KotlinExtendsParentEntity:
+  {
+    child: code.kotlin.Entity,
+    parent: code.kotlin.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    kotlin.alpha.ExtendsDeclaration { Child, Parent };
+
+
+}
diff --git a/glean/schema/source/codemarkup.lsif.angle b/glean/schema/source/codemarkup.lsif.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.lsif.angle
@@ -0,0 +1,124 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.lsif.3 {
+import src
+import code.lsif
+import codemarkup.types
+import lsif
+import lsif.types.1
+
+#
+# Resolving locations to entities
+#
+
+predicate LsifResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.lsif.Entity,
+  }
+  { { Name, File, { range = Range }, nothing }, Entity } where
+    lsif.ResolveLocation { { Name, File, Range }, Entity };
+
+#
+# Finding entities' locations
+#
+
+predicate LsifEntityLocation:
+  {
+    entity: code.lsif.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { range = Range }, nothing } } where
+    lsif.EntityLocation { Entity, { Name, File, Range } };
+
+#
+# Finding references in a file
+#
+
+predicate LsifFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.lsif.Entity,
+  }
+  { File, XRefLocation, Entity } where
+    lsif.FileEntityXRefLocation { File, SrcRange, TargetLocation, Entity };
+    { Name, TargetFile, TargetRange } = TargetLocation;
+    { { Name, TargetFile, { range = TargetRange }, nothing },
+      { range = SrcRange }} = XRefLocation;
+
+#
+# Language entity uses
+#
+
+predicate LsifEntityUses:
+  {
+    target: code.lsif.Entity,
+    file: src.File,
+    range: src.Range, # n.b src.Range
+  }
+  { E, File, Range } where
+  lsif.EntityUses { E, File, Range }
+
+#
+# symbol kinds
+#
+
+predicate EntityInfo:
+  {
+    entity: code.lsif.Entity,
+    info: codemarkup.types.SymbolInfo
+  }
+  { Entity, { kind = Kind, isAbstract = false } } where
+    lsif.EntityKind { Entity, Lsif };
+    LsifKindToKind { Lsif, Kind };
+
+# maps vscode lsp kinds to codemarkup kinds, which use different enums
+predicate LsifKindToKind:
+  {
+    lsif: lsif.types.SymbolKind,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Lsif, Kind } where
+    ( File = Lsif; File = Kind ) |
+    ( Module = Lsif; Module = Kind ) |
+    ( Namespace = Lsif; Namespace = Kind ) |
+    ( Package = Lsif; Package = Kind ) |
+    ( Class_ = Lsif; Class_ = Kind ) |
+    ( Method = Lsif; Method = Kind ) |
+    ( Property = Lsif; Property = Kind ) |
+    ( Field = Lsif; Field = Kind ) |
+    ( Constructor = Lsif; Constructor = Kind ) |
+    ( Enum_ = Lsif; Enum_ = Kind ) |
+    ( Interface = Lsif; Interface = Kind ) |
+    ( Function = Lsif; Function = Kind ) |
+    ( Variable = Lsif; Variable = Kind ) |
+    ( Constant = Lsif; Constant = Kind ) |
+    ( String = Lsif; String = Kind  ) |
+    ( Number = Lsif; Number = Kind ) |
+    ( Boolean = Lsif; Boolean = Kind ) |
+    ( Array = Lsif; Array = Kind ) |
+    ( Object_ = Lsif; Object_ = Kind ) |
+    ( Key = Lsif; Key = Kind ) |
+    ( Null = Lsif; Null = Kind ) |
+    ( EnumMember = Lsif; Enumerator = Kind ) | # n.b different names
+    ( Struct = Lsif; Struct = Kind ) |
+    ( Event = Lsif; Event = Kind ) |
+    ( Operator = Lsif; Operator = Kind ) |
+    ( TypeParameter = Lsif; TypeParameter = Kind );
+    # no Unknown, and can't distinguish Union, Macro or Trait
+
+#
+# Entity Module name for codemarkup.EntityModuleName
+#
+
+predicate LsifEntityModuleName:
+  {
+    lsif: code.lsif.Entity,
+    name: string
+  }
+  { Entity, Name } where
+    lsif.EntityKind { Entity, Module };
+    lsif.EntityLocation { Entity, { name = Name }};
+
+}
diff --git a/glean/schema/source/codemarkup.pp.angle b/glean/schema/source/codemarkup.pp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.pp.angle
@@ -0,0 +1,141 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.pp.3 {
+import src
+import code.pp
+import codemarkup.types
+import cxx1
+import pp1
+
+#
+# Finding entities' locations
+#
+
+predicate PPEntityLocation:
+  {
+    entity: code.pp.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, Location } where
+    # the pp Entity might be a #define, find by name
+    ( { define = Define } = Entity;
+      { pp1.Macro Name, Range } = Define;
+      { file = File } = Range;
+      { Name, File, { range = Range }, nothing } = Location) |
+    # or it could be a #include, but, subtly, only if mentioned in pp.Include
+    ( { include_ = File } = Entity;
+      !(!pp1.Include { file = File }); # perf-sensitive existence check
+      src.File Name = File;
+      { Name, File, { span = {0,0} }, nothing } = Location;
+    );
+
+predicate PpResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.pp.Entity,
+  }
+  { { Str, File, Range, Destination }, Entity } where
+    Trace = cxx1.Trace { file = File };
+    PpResolveTraceLocation { Trace, { Str, File, Range, Destination }, Entity };
+
+# Keyed by trace, find all locations and entities tied to that (file) trace
+# just #defines definitions at the moment
+predicate PpResolveTraceLocation:
+  {
+    trace : cxx1.Trace,
+    location: codemarkup.types.Location,
+    entity: code.pp.Entity,
+  }
+  { Trace, Location, Entity } where
+    Trace = cxx1.Trace { File, _, { events = PPDecls } };
+    ## preprocessor #defines
+    { define = Define } = PPDecls[..];
+    cxx1.PPDefineLocation { Define, Str, _, Range };
+    Location = codemarkup.types.Location { Str, File, { range = Range }, nothing };
+    { define = Define } = Entity;
+
+# C preprocessor uses of #defines as xrefs
+# (deprecated)
+predicate PpFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.pp.Entity,
+  }
+  { File, XRef, Entity } where
+    Trace = cxx1.Trace { file = File };
+    PpEntityTraceXRefLocations { Trace, XRef, Entity }
+
+# C preprocessor uses of #defines and #includes.
+# N.B. uses are keyed by traces, not xmaps, for PP
+predicate PpEntityTraceXRefLocations:
+  {
+    trace: cxx1.Trace,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.pp.Entity,
+  }
+  { Trace, XRef, Entity } where
+    { file = File } = Trace;
+    cxx1.FilePPTraceXRefs { File, Trace, SrcRange, Entity, SrcSpan };
+    PPEntityLocation { Entity, Location };
+    ( { Location, { span = SrcSpan } } = XRef;
+      { define = _ } = Entity ) |
+    ( { Location, { range = SrcRange } } = XRef;
+      { include_ = _ } = Entity ) |
+    ( { Location, { range = SrcRange } } = XRef;
+      { undef = _ } = Entity; )
+
+#
+# Language-specific symbol info
+#
+
+predicate PpEntityKind:
+  {
+    entity: code.pp.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { Decl, Kind } where
+    ({ define = _ } = Decl; Macro = Kind ) |
+    ({ undef = _ } = Decl; Macro = Kind ) |
+    ({ include_ = _ } = Decl; File = Kind )
+
+# For backward compatibility:
+predicate PpEntityInfo:
+  {
+    entity: code.pp.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { E, { kind = K, isAbstract = false } } where
+  PpEntityKind { E, K }
+
+#
+# Use a cxx1.Trace to resolve #include xref target files efficiently
+# We use this as a global cache of #includes to their target for clangd
+#
+predicate PpIncludeXRefLocations:
+  {
+    trace : cxx1.PPTrace, # source file traces to consider
+    range : src.Range, # at this source line/col span
+    target : src.File, # has a #include to this file
+  }
+  { Trace, Range, Target } where
+    { events = Events } = Trace;
+    { include_ = { include_ = Include } } = Events[..];
+    { file = Target, source = Range } = Include;
+
+#
+# Uses
+#
+predicate PpEntityUses:
+  {
+    entity: code.pp.Entity,
+    file: src.File,
+    span: src.ByteSpan
+  }
+  { Entity, File, Span } where
+    { define = D } = Entity;
+    pp1.DefineUse { D, Use };
+    { source = { file = File }, nameSpan = Span } = Use;
+
+
+}
diff --git a/glean/schema/source/codemarkup.python.angle b/glean/schema/source/codemarkup.python.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.python.angle
@@ -0,0 +1,646 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.python.2 {
+import src
+import code.24
+import code.python
+import codemarkup.types
+import python
+import python.branches
+
+# Resolving locations to entities
+
+predicate PythonResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.python.Entity,
+  }
+  { { Name, File, { span = Span }, nothing }, { decl = Decl } } where
+    python.DeclarationsByFile { File, Span, Decl };
+    python.DeclarationToName Decl -> (Name : string);
+
+# Finding entities' locations
+
+predicate PythonEntityLocation:
+  {
+    entity: code.python.Entity,
+    location: codemarkup.types.Location,
+  }
+  { { decl = D }, { Name, File, { span = Span }, nothing } } where
+    if (
+      { imp = ImportStmt } = D;
+    ) then (
+      # for imports just return import location
+      python.DeclarationLocation { declaration = D, file = File, span = Span };
+      { from_name = python.Name Name } = ImportStmt;
+    ) else if (
+      python.DeclarationDefinition {D, _};
+    ) then (
+      # if an entity has definition, just return its location
+      # this should handle imports overriden with locally definded entities
+      python.DeclarationLocation { declaration = D, file = File, span = Span };
+      python.DeclarationToName D -> (python.Name Name);
+    ) else (
+      # for others trying to resolve original name to handle indirect imports
+      python.DeclarationToName D -> SrcName;
+      python.ResolveOriginalName { SrcName, OriginalName };
+      python.DeclarationWithName { OriginalName, OriginalDecl };
+      python.DeclarationLocation { declaration = OriginalDecl, file = File, span = Span };
+      OriginalName = python.Name Name;
+    )
+
+
+predicate PythonFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.python.Entity,
+  }
+  {File, {Location , { span = Src } }, { decl = Decl }} where
+  if (python.branches.FileToRoot { file = File }) then (
+    python.branches.DirectXRefByFile { File, {Decl, DeclFile, DeclSpan}, Src };
+    python.DeclarationToName Decl -> (python.Name Name);
+    codemarkup.types.Location { Name, DeclFile, { span = DeclSpan }, nothing } = Location;
+  ) else (
+    python.DirectXRefsByFile {File, { Decl, Src }};
+    PythonEntityLocation {{ decl = Decl }, Location};
+  )
+
+#
+# Language entity uses
+#
+
+predicate PythonEntityUses:
+  {
+    target: code.python.Entity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { { decl = D }, File, Span } where
+  python.DeclarationUses { declaration = D, file = File, span = Span}
+
+#
+# Language-specific symbol info
+#
+
+predicate NonImportPythonDeclarationKind:
+  {
+    declaration: python.Declaration,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { D, Kind } where
+    ({cls = _} = D; Class_ = Kind ) |
+    ({module = _} = D; Module = Kind ) |
+    ({func = _} = D;
+      python.ContainingTopLevelDeclaration { D, C };
+      ({module = _} = C; Function = Kind ) |
+      ({cls = _} = C; Method = Kind ) |
+      ({func = _} = C; Function = Kind )) |  # these are locals
+    ({variable = _} = D;
+      python.ContainingTopLevelDeclaration { D, C };
+      ({module = _} = C; Variable = Kind ) |
+      ({cls = _} = C; Field = Kind ) |
+      ({func = _} = C; Variable = Kind ))  # these are locals
+
+# For backward compatibility:
+predicate NonImportPythonDeclarationInfo:
+  {
+    declaration: python.Declaration,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { D, { kind = K, isAbstract = IsAbstract }} where
+    IsAbstract = if (python.IsAbstract D) then (true) else (false);
+    NonImportPythonDeclarationKind { D, K }
+
+predicate PythonEntityKind:
+  {
+    entity: code.python.Entity,
+    kind: codemarkup.types.SymbolKind,
+  }
+  { { decl = D }, Kind } where
+    NonImportPythonDeclarationKind { D, Kind } |
+    ({imp = {from_name = FN}} = D;
+      python.DeclarationWithName { FN, Imported };
+      NonImportPythonDeclarationKind { Imported, Kind }
+    )
+
+#
+# Annotations
+#
+
+predicate PythonAnnotation :
+  {
+    entity: code.python.Entity,
+    anns: code.python.Annotations,
+  }
+  { { decl = Decl }, { decorators = Decorators }} where
+    (
+      { cls = Cls } = Decl;
+      python.ClassDefinition { declaration = Cls, decorators = { just = Decorators }};
+    ) | (
+      { func = Func } = Decl;
+      python.FunctionDefinition { declaration = Func, decorators = { just = Decorators }};
+    )
+
+# Just the visibility attributes
+# A single underscore indicates the intent that the symbol should be protected
+# A double underscore indicates the intent that the symbol should be private
+predicate PythonVisibility :
+  {
+    entity: code.python.Entity,
+    visibility: codemarkup.types.Visibility,
+  }
+  { { decl = Decl }, Visibility } where
+    python.DeclarationToName Decl -> Name;
+    python.NameToSName Name -> { local_name = python.Name NameStr };
+    ( if ( NameStr = "__".. )
+      then ( Private )
+      else if ( NameStr = "_".. )
+      then ( Protected )
+      else ( Public ) ) = Visibility;
+
+# We expect to have at least static, async
+predicate PythonModifiers:
+  {
+    entity: code.python.Entity,
+    modifiers: codemarkup.types.Modifiers
+  }
+  { { decl = Decl }, Modifiers } where
+    (
+      { func = D } = Decl;
+      python.FunctionDefinition { declaration = D, is_async = Async, decorators = MaybeDecorators };
+      IsStatic = if (
+        { just = Decorators } = MaybeDecorators;
+        Decorators[..] = "@staticmethod" | "@classmethod";
+      ) then (true) else (false);
+    ) | (
+      { variable = D } = Decl;
+      IsStatic = if (
+        python.VariableDefinition { declaration = D, typeInfo = { just = { xrefs = Xrefs } } };
+        { target = "typing.ClassVar"} = Xrefs[..];
+      ) then (true) else (false);
+      Async = false;
+    ) | (
+      { cls = _ } = Decl;
+      IsStatic = false;
+      Async = false;
+    );
+
+    IsAbstract = if (python.IsAbstract Decl) then (true) else (false);
+    { isAbstract = IsAbstract,
+      isFinal = false,
+      isAsync = Async,
+      isStatic = IsStatic,
+      isReadonly = false,
+      isConst = false,
+      isMutable = false,
+      isVolatile = false,
+      isVirtual = false,
+      isInline = false } = Modifiers;
+
+# For backward compatibility:
+predicate PythonEntityInfo:
+  {
+    entity: code.python.Entity,
+    info: codemarkup.types.SymbolInfo,
+  }
+  { E, { kind = K, isAbstract = IsAbstract }} where
+    { decl = Decl } = E;
+    IsAbstract = if (python.IsAbstract Decl) then (true) else (false);
+    PythonEntityKind { entity = E, kind = K }
+
+# All cases where we have a docstring span we also have a pretty docstring
+# span, so we can rely on python.DeclarationDocstring entirely for comments
+predicate PythonEntityComments:
+  {
+    entity : code.python.Entity,
+    file : src.File,
+    span : src.ByteSpan,
+    text : maybe string
+  }
+  { { decl = Decl }, File, Span, { just = Text } } where
+    python.DeclarationDocstring { Decl, Span, Text };
+    # should be second as not all decls have text
+    python.DeclarationLocation { declaration = Decl, file = File }
+
+#
+# Relations
+#
+
+# Parent contains child by scope
+predicate PythonContainsChildEntity :
+  {
+    parent: code.python.Entity,
+    child: code.python.Entity
+  }
+  { { decl = Container }, { decl = Member } } where
+  !({ func = _ } = Container); # don't show content of functions
+  python.Contains { Container, Member };
+
+# Child is contained in scope of parent
+predicate PythonContainsParentEntity :
+  {
+    child: code.python.Entity,
+    parent: code.python.Entity
+  }
+  { { decl = Child }, { decl = Parent } } where
+    python.ContainedBy { Child, Parent };
+
+# Child extends parent by an inheritance relationship
+predicate PythonExtendsParentEntity :
+  {
+    child : code.python.Entity,
+    parent : code.python.Entity
+  }
+  { Child, Parent } where
+    { decl = { cls = ChildClassDecl } } = Child;
+    python.DerivedClassToBase { ChildClassDecl, ParentClassDecl };
+    { decl = { cls = ParentClassDecl } } = Parent;
+
+predicate PythonExtendsChildEntity :
+  {
+    parent: code.python.Entity,
+    child: code.python.Entity
+  }
+  { Parent, Child } where
+    { decl = {cls = ParentClassDecl} } = Parent;
+    python.BaseClassToDerived { base = ParentClassDecl, derived = ChildClassDecl };
+    { decl = { cls = ChildClassDecl } } = Child;
+
+predicate PythonEntityModuleName :
+  {
+    entity: code.python.Entity,
+    name: string
+  }
+  { { decl = { module = { name = python.Name Name } } }, Name }
+
+#
+# file call processing
+#
+
+predicate PythonFileCall :
+  {
+    file: src.File,
+    callee_span: src.ByteSpan,
+    call_args: [code.CallArgument],
+  } {File, Span, CodeArgs} where
+  (
+    python.FileCall { File, Span, PythonArgs};
+    ConvertCallArguments { PythonArgs, CodeArgs};
+  )
+
+# (internal) helper predicate for CallArgument
+# Manually unrolled to lists of <=6 arguments
+predicate ConvertCallArguments :
+  { pythonCallArguments: [python.CallArgument],
+    codeCallArguments: [code.CallArgument]
+  } {PythonArgs, CodeArgs} where
+  (
+    ( [] = PythonArgs; [] = CodeArgs
+    ) |
+    (
+      [python.CallArgument{Label, Span, Argument}] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertLabel{Label, CodeLabel};
+      CodeArgs = [code.CallArgument{CodeLabel, Span, CodeArgument}]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6},
+        python.CallArgument{Label7, Span7, Argument7}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      ConvertLabel{Label7, CodeLabel7};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6},
+        code.CallArgument{CodeLabel7, Span7, CodeArgument7}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6},
+        python.CallArgument{Label7, Span7, Argument7},
+        python.CallArgument{Label8, Span8, Argument8}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      ConvertLabel{Label7, CodeLabel7};
+      ConvertLabel{Label8, CodeLabel8};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6},
+        code.CallArgument{CodeLabel7, Span7, CodeArgument7},
+        code.CallArgument{CodeLabel8, Span8, CodeArgument8}
+      ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6},
+        python.CallArgument{Label7, Span7, Argument7},
+        python.CallArgument{Label8, Span8, Argument8},
+        python.CallArgument{Label9, Span9, Argument9}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      ConvertLabel{Label7, CodeLabel7};
+      ConvertLabel{Label8, CodeLabel8};
+      ConvertLabel{Label9, CodeLabel9};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6},
+        code.CallArgument{CodeLabel7, Span7, CodeArgument7},
+        code.CallArgument{CodeLabel8, Span8, CodeArgument8},
+        code.CallArgument{CodeLabel9, Span9, CodeArgument9}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6},
+        python.CallArgument{Label7, Span7, Argument7},
+        python.CallArgument{Label8, Span8, Argument8},
+        python.CallArgument{Label9, Span9, Argument9},
+        python.CallArgument{Label10, Span10, Argument10}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      ConvertArgument{Argument10, CodeArgument10};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      ConvertLabel{Label7, CodeLabel7};
+      ConvertLabel{Label8, CodeLabel8};
+      ConvertLabel{Label9, CodeLabel9};
+      ConvertLabel{Label10, CodeLabel10};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6},
+        code.CallArgument{CodeLabel7, Span7, CodeArgument7},
+        code.CallArgument{CodeLabel8, Span8, CodeArgument8},
+        code.CallArgument{CodeLabel9, Span9, CodeArgument9},
+        code.CallArgument{CodeLabel10, Span10, CodeArgument10}
+        ]
+    ) |
+    (
+      [
+        python.CallArgument{Label, Span, Argument},
+        python.CallArgument{Label2, Span2, Argument2},
+        python.CallArgument{Label3, Span3, Argument3},
+        python.CallArgument{Label4, Span4, Argument4},
+        python.CallArgument{Label5, Span5, Argument5},
+        python.CallArgument{Label6, Span6, Argument6},
+        python.CallArgument{Label7, Span7, Argument7},
+        python.CallArgument{Label8, Span8, Argument8},
+        python.CallArgument{Label9, Span9, Argument9},
+        python.CallArgument{Label10, Span10, Argument10},
+        python.CallArgument{Label11, Span11, Argument11}
+      ] = PythonArgs;
+      ConvertArgument{Argument, CodeArgument};
+      ConvertArgument{Argument2, CodeArgument2};
+      ConvertArgument{Argument3, CodeArgument3};
+      ConvertArgument{Argument4, CodeArgument4};
+      ConvertArgument{Argument5, CodeArgument5};
+      ConvertArgument{Argument6, CodeArgument6};
+      ConvertArgument{Argument7, CodeArgument7};
+      ConvertArgument{Argument8, CodeArgument8};
+      ConvertArgument{Argument9, CodeArgument9};
+      ConvertArgument{Argument10, CodeArgument10};
+      ConvertArgument{Argument11, CodeArgument11};
+      ConvertLabel{Label, CodeLabel};
+      ConvertLabel{Label2, CodeLabel2};
+      ConvertLabel{Label3, CodeLabel3};
+      ConvertLabel{Label4, CodeLabel4};
+      ConvertLabel{Label5, CodeLabel5};
+      ConvertLabel{Label6, CodeLabel6};
+      ConvertLabel{Label7, CodeLabel7};
+      ConvertLabel{Label8, CodeLabel8};
+      ConvertLabel{Label9, CodeLabel9};
+      ConvertLabel{Label10, CodeLabel10};
+      ConvertLabel{Label11, CodeLabel11};
+      CodeArgs = [
+        code.CallArgument{CodeLabel, Span, CodeArgument},
+        code.CallArgument{CodeLabel2, Span2, CodeArgument2},
+        code.CallArgument{CodeLabel3, Span3, CodeArgument3},
+        code.CallArgument{CodeLabel4, Span4, CodeArgument4},
+        code.CallArgument{CodeLabel5, Span5, CodeArgument5},
+        code.CallArgument{CodeLabel6, Span6, CodeArgument6},
+        code.CallArgument{CodeLabel7, Span7, CodeArgument7},
+        code.CallArgument{CodeLabel8, Span8, CodeArgument8},
+        code.CallArgument{CodeLabel9, Span9, CodeArgument9},
+        code.CallArgument{CodeLabel10, Span10, CodeArgument10},
+        code.CallArgument{CodeLabel11, Span11, CodeArgument11}
+        ]
+    )
+  )
+
+predicate ConvertArgument :
+  { pythonArgument : maybe python.Argument
+  , codeArgument : maybe code.Argument
+  } {Python, Code} where
+  (
+    { just = { lit = python.StringLiteral L } } = Python;
+    { just = { lit = L } } = Code;
+  ) | (
+    nothing = Python ; nothing = Code;
+  )
+
+predicate ConvertLabel :
+  { python : maybe python.Name
+  , code : maybe string
+  } {Python, Code} where
+  ( nothing = Python; nothing = Code)
+  | (Python = {just = python.Name N}; Code = {just = N})
+}
diff --git a/glean/schema/source/codemarkup.scip.angle b/glean/schema/source/codemarkup.scip.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.scip.angle
@@ -0,0 +1,129 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.scip.1 {
+import src
+import code.scip
+import codemarkup.types
+import scip
+import lsif.types
+
+#
+# Resolving locations to entities
+#
+
+predicate ScipResolveLocation:
+  {
+    location: codemarkup.types.Location,
+    entity: code.scip.Entity,
+  }
+  { { Name, File, { range = Range }, nothing }, Entity } where
+    scip.ResolveLocation { { File, Range, Name }, Entity };
+
+#
+# Finding entities' locations
+#
+
+predicate ScipEntityLocation:
+  {
+    entity: code.scip.Entity,
+    location: codemarkup.types.Location,
+  }
+  { Entity, { Name, File, { range = Range }, nothing } } where
+    scip.EntityLocation { Entity, { File, Range, Name } };
+
+#
+# Finding references in a file
+#
+
+predicate ScipFileEntityXRefLocations:
+  {
+    file: src.File,
+    xref: codemarkup.types.XRefLocation,
+    entity: code.scip.Entity,
+  }
+  { File, XRefLocation, Entity } where
+    scip.FileEntityXRefLocation { File, SrcRange, TargetLocation, Entity };
+    { TargetFile, TargetRange, Name } = TargetLocation;
+    { { Name, TargetFile, { range = TargetRange }, nothing },
+      { range = SrcRange } } = XRefLocation;
+
+predicate FileXLangSymbolRefs:
+  {
+    file: src.File,
+    source: codemarkup.types.RangeSpan,
+    symbol: scip.Symbol,
+  }
+  { File, { range = SrcRange }, Symbol } where
+  scip.FileXLangSymbolRef { File, LsifRange, Symbol };
+  lsif.types.ToSrcRange { File, LsifRange, SrcRange };
+
+#
+# Language entity uses (find-references)
+#
+
+predicate ScipEntityUses:
+  {
+    target: code.scip.Entity,
+    file: src.File,
+    range: src.Range, # n.b src.Range
+  }
+  { Entity, File, Range } where scip.EntityUses { Entity, File, Range }
+
+#
+# symbol kinds
+#
+
+predicate EntityInfo:
+  {
+    entity: code.scip.Entity,
+    info: codemarkup.types.SymbolInfo
+  }
+  { Entity, { kind = Kind, isAbstract = false } } where
+    scip.EntityKind { Entity, LsifKind };
+    LsifKindToKind { LsifKind, Kind };
+
+# maps vscode lsp kinds to codemarkup kinds, which use different enums
+predicate LsifKindToKind:
+  {
+    lsif: lsif.types.SymbolKind,
+    kind: codemarkup.types.SymbolKind
+  }
+  { Lsif, Kind } where
+    ( File = Lsif; File = Kind ) |
+    ( Module = Lsif; Module = Kind ) |
+    ( Namespace = Lsif; Namespace = Kind ) |
+    ( Package = Lsif; Package = Kind ) |
+    ( Class_ = Lsif; Class_ = Kind ) |
+    ( Method = Lsif; Method = Kind ) |
+    ( Property = Lsif; Property = Kind ) |
+    ( Field = Lsif; Field = Kind ) |
+    ( Constructor = Lsif; Constructor = Kind ) |
+    ( Enum_ = Lsif; Enum_ = Kind ) |
+    ( Interface = Lsif; Interface = Kind ) |
+    ( Function = Lsif; Function = Kind ) |
+    ( Variable = Lsif; Variable = Kind ) |
+    ( Constant = Lsif; Constant = Kind ) |
+    ( String = Lsif; String = Kind  ) |
+    ( Number = Lsif; Number = Kind ) |
+    ( Boolean = Lsif; Boolean = Kind ) |
+    ( Array = Lsif; Array = Kind ) |
+    ( Object_ = Lsif; Object_ = Kind ) |
+    ( Key = Lsif; Key = Kind ) |
+    ( Null = Lsif; Null = Kind ) |
+    ( EnumMember = Lsif; Enumerator = Kind ) | # n.b different names
+    ( Struct = Lsif; Struct = Kind ) |
+    ( Event = Lsif; Event = Kind ) |
+    ( Operator = Lsif; Operator = Kind ) |
+    ( TypeParameter = Lsif; TypeParameter = Kind );
+    # no Unknown, and can't distinguish Union, Macro or Trait
+
+predicate ScipEntityDocumentation:
+  {
+    entity : code.scip.Entity,
+    documentation : scip.Documentation,
+  }
+  { Entity, Docs } where
+    scip.EntityDefinition { Entity, Defn };
+    scip.DefinitionDocumentation { Defn, Docs }
+
+}
diff --git a/glean/schema/source/codemarkup.search.angle b/glean/schema/source/codemarkup.search.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.search.angle
@@ -0,0 +1,91 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.search.1 {
+
+import code.24
+import codemarkup
+import codemarkup.types
+import search.code
+
+#
+# Public API
+#
+
+# Note the Insensitive case implies you did toLower on the argument
+type SearchCase = enum { Sensitive | Insensitive }
+
+#
+# search for entities by identifier name, either case insensitive or not
+# with optional symbol kind and language filter constraints
+#
+predicate SearchByName:
+  {
+    searchcase: SearchCase,
+    name: string,
+    entity: code.Entity,
+    location: codemarkup.types.Location,
+    kind: maybe codemarkup.types.SymbolKind,
+    language: code.Language # optional language filter, could be wild
+  }
+  { SearchCase, Name, Entity, Location, Kind, Language } where
+    if (Insensitive = SearchCase)
+    then (
+      ( search.code.SearchByLowerCaseNameKindAndLanguage { Name, Language, Kind, Entity };
+        codemarkup.EntityLocation { Entity, Location }
+      ) | ( # old form
+        search.code.SearchByLowerCaseNameAndLanguage { Name, Language, Entity };
+        EntityLocationAndKind { Entity, Location, Kind }
+      )
+    ) else ( # case sensitive, either kinded or not
+      ( search.code.SearchByNameKindAndLanguage { Name, Language, Kind, Entity };
+        codemarkup.EntityLocation { Entity, Location }
+      ) | ( # old form
+        search.code.SearchByNameAndLanguage { Name, Language, Entity };
+        EntityLocationAndKind { Entity, Location, Kind } )
+    );
+
+#
+# search by name and scope, with language and kind filters.
+#
+predicate SearchByScope:
+  {
+    searchcase: SearchCase,
+    name: string,
+    scope: [string],
+    entity: code.Entity,
+    location: codemarkup.types.Location,
+    kind: maybe codemarkup.types.SymbolKind,
+    language: code.Language
+  }
+  { SearchCase, Name, Scope, Entity, Location, Kind, Language } where
+    if (Insensitive = SearchCase)
+    then (
+      ( search.code.SearchByLowerCaseScopeAndKind { Name, Scope, Language, Kind, Entity };
+        codemarkup.EntityLocation { Entity, Location }
+      ) | ( # old form
+        search.code.SearchByLowerCaseScope { Name, Scope, Language, Entity };
+        EntityLocationAndKind { Entity, Location, Kind }
+      )
+    ) else (
+      ( search.code.SearchByScopeAndKind { Name, Scope, Language, Kind, Entity };
+        codemarkup.EntityLocation { Entity, Location }
+      ) | ( # old form
+        search.code.SearchByScope { Name, Scope, Language, Entity };
+        EntityLocationAndKind { Entity, Location, Kind };
+      )
+    );
+
+# Symbol kind of entity, where kind is optional.
+# We can avoid this post-query filter with kind-optimized lookups
+predicate EntityLocationAndKind:
+  {
+    entity: code.Entity,
+    location: codemarkup.types.Location,
+    kind: maybe codemarkup.types.SymbolKind
+  }
+  { Entity, Location, MKind } where
+    codemarkup.EntityLocation { Entity, Location };
+    (if codemarkup.EntityKind { Entity, Kind }
+      then { just = Kind } else nothing) = MKind;
+
+}
diff --git a/glean/schema/source/codemarkup.types.angle b/glean/schema/source/codemarkup.types.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.types.angle
@@ -0,0 +1,105 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.types.1 {
+
+import src
+
+# Public types
+
+# Within a file, the type of symbol locations.
+# range is used for compatibility with cxx/thrift indexer
+# but new indexers should use the `bytespan` representation.
+# (and should also generate `src.FileLines` fact).
+type RangeSpan =
+  {
+    span : src.ByteSpan |
+    range : src.Range # cxx and lsif compat
+  }
+
+predicate RangeSpanContains :
+  {
+    rangeSpan : RangeSpan,
+    contains : RangeSpan
+  }
+  { RS1, RS2 } where
+    ({ span = S1 } = RS1;
+     { span = S2 } = RS2;
+     src.ByteSpanContains { S1, S2 }) |
+    ({ range = R1 } = RS1;
+     { range = R2 } = RS2;
+     src.RangeContains { R1, R2 })
+
+# XRefs from source to target declaration or definition
+type XRefLocation =
+  {
+    target: Location,
+    source: RangeSpan
+  }
+
+# Tags for entities, so clients can distinguish them.
+type SymbolKind =
+  enum {
+    Package | Type | Value | File | Module | Namespace | Class_ | Method | Property |
+    Field | Constructor | Enum_ | Interface | Function | Variable | Constant | String |
+    Number | Boolean | Array | Object_ | Key | Null | Enumerator | Struct | Event |
+    Operator | TypeParameter | Union | Macro | Trait | Fragment | Operation | Directive |
+  }
+
+type SymbolInfo =
+  {
+    kind: SymbolKind,
+    isAbstract: bool,  # typically applies to methods, fields, and classes
+  }
+
+# Symbol locations within a repo
+type Location =
+  {
+    name: string,
+    file: src.File,
+    location : RangeSpan,
+
+    # An optional destination of the location rather than the entire entity.
+    # This is commonly the name of a declaration, potentially in a different
+    # file in the case where the declaration is within a macro definition.
+    destination: maybe src.FileLocation,
+  }
+
+# Symbols have visibility attributes
+type Visibility = enum { Public | Protected | Private | Internal }
+
+# Set of language-generic modifiers that distinguish flavors of symbol kinds
+# While there are many modifiers, this is a common set significant enough
+# to be worth filtering on or searching by, across 1 or more languages
+#
+# e.g. public static method foo() or unsafe bar()
+#
+# For arbitrary string decorations on symbols use the Annotations type
+#
+
+# Modifiers on symbols, to partition symbol kinds with additional attributes
+# These are intended to capture well known, common modifiers rather than all
+# possible modifiers in all languages.
+type Modifier =
+  enum {
+    Abstract | Final | Async | Static | Readonly | Const | Mutable | Volatile |
+    Virtual | Inline
+  }
+
+# Bit set of which modifiers are present on a symbol
+# (n.b. we use an exhaustive set here, as its very hard at the moment to build
+# set or list facts dynamcially)
+type Modifiers =
+  {
+    isAbstract: bool,
+    isFinal: bool,
+    isAsync: bool,
+    isStatic: bool,
+    isReadonly: bool,
+    isConst: bool,
+    isMutable: bool,
+    isVolatile: bool,
+    isVirtual: bool,
+    isInline: bool,
+  }
+
+}
diff --git a/glean/schema/source/codemarkup.yaml.angle b/glean/schema/source/codemarkup.yaml.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemarkup.yaml.angle
@@ -0,0 +1,29 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemarkup.yaml.1 {
+    import src
+    import code.24
+    import codemarkup.types
+    import yaml
+    import python
+
+    # derived predicate to find references in a file (to support Glass/Codehub integration)
+    predicate YamlFileEntityXLangXRefLocations:
+    {
+        file: src.File,
+        source : codemarkup.types.RangeSpan,
+        entity : code.IdlEntity,
+    }
+    {
+        File,
+        { span = S },
+        IdlEntity
+    } where
+    IdlEntity = { lang = Python, file = File, entity = { just = { python = { decl = D } } }, range = nothing } : code.IdlEntity;
+    yaml.XRefsByFile { file = File, xrefs = XRefs };
+    yaml.XRefViaName { source = S , decl = { just = D } } = XRefs[..];
+
+    predicate YamlDataAvailable : src.File
+      F where yaml.XRefsByFile {file = F}
+
+}
diff --git a/glean/schema/source/codemetrics.angle b/glean/schema/source/codemetrics.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/codemetrics.angle
@@ -0,0 +1,207 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema codemetrics.1 {
+
+import cxx1
+import code.24
+import code.cxx
+import code.hack
+import codemarkup.hack
+import hack
+
+#
+# 'target' is referenced in the definition of 'source'
+#
+# Note that this is the dual of codemarkup.EntitySource, which finds
+# references *to* an entity.
+#
+predicate ReferencesFrom : {
+  source : code.Entity,
+  target : code.Entity
+}
+  (
+    { { cxx = S }, { cxx = T } } where CxxReferencesFrom { S, T }
+  ) | (
+    { { hack = S }, { hack = T } } where HackReferencesFrom { S, T }
+  )
+
+#
+# For cxx we want to use cxx1.DeclarationTargets which efficiently
+# maps declarations to references, and we also want to account for
+# out-of-line parts of the definition (methods, in particular).
+#
+predicate CxxReferencesFrom : {
+  source : code.cxx.Entity,
+  target : code.cxx.Entity
+}
+  (
+    { { defn = { record_ = R }}, { decl = T } }
+      where CxxRecordReference { R, T }
+  ) | (
+    { { defn = { objcContainer = C }}, { decl = T } }
+      where CxxObjcContainerReference { C, T }
+  )
+
+predicate CxxObjcContainerReference : {
+  source : cxx1.ObjcContainerDefinition,
+  target : cxx1.Declaration
+}
+  { { declaration = Decl, members = Members : [cxx1.Declaration] }, D }
+  where
+    # Include references from:
+    #  - the definition itself
+    #  - the members
+    #  - members in the implementation
+    DeclOrMember =
+      ( {objcContainer = Decl} : cxx1.Declaration
+      | Members[..]
+      | (
+          cxx1.ObjcInterfaceToImplementation { Decl, Impl };
+          cxx1.ObjcContainerDefinition {
+            declaration = Impl,
+            members = ImplMembers : [cxx1.Declaration] };
+          ImplMembers[..]
+        )
+     );
+
+    cxx1.DeclarationTargets { source = DeclOrMember, targets = T };
+    D = T[..];
+
+    # We don't care about references to namespaces
+    !({ namespace_ = _ } = D);
+
+    # We don't care about references to things in this class
+    { id = Id } = Decl;
+    !({ objcMethod = { container = Id } } = D);
+    !({ objcProperty = { container = Id } } = D);
+
+    # We don't care about references to the class itself
+    !({ objcContainer = Decl } = D);
+
+
+predicate CxxRecordReference : {
+  source : cxx1.RecordDefinition,
+  target : cxx1.Declaration
+}
+  { Source, D } where
+    cxx1.DefToBaseDecl { defn = { record_ = Source }, decl = { record_ = Decl } };
+    { name = QName } = Decl;
+    { members = Members : [cxx1.Declaration] } = Source;
+
+    # Look at the declaration itself and the members, because some of
+    # them might be out-of-line
+    DeclOrMember = ({record_ = Decl} : cxx1.Declaration | Members[..]);
+
+    # Targets for each declaration
+    cxx1.DeclarationTargets { source = DeclOrMember, targets = T };
+    D = T[..];
+
+    # We don't care about references to namespaces
+    !({ namespace_ = _ } = D);
+
+    # We don't care about references to things in this class
+    cxx1.DeclarationScope { decl = D, scope = Scope };
+    !({ recordWithAccess = { record = QName }} = Scope);
+
+    # We don't care about references to the class itself
+    !({ record_ = Decl } = D);
+
+predicate HackReferencesFrom : {
+  source : code.hack.Entity,
+  target : code.hack.Entity
+}
+  { { decl = Decl }, { decl = T } } where
+    { container = { class_ = C } } = Decl;
+    hack.DeclarationTarget { Decl, T };
+
+    # Filter out references to this class
+    !(T = Decl);
+
+    # Filter out references to members of this class
+    !(codemarkup.hack.HackContainsParentEntity {
+        child = { decl = T },
+        parent = { decl = Parent }
+      };
+      { container = { class_ = C } } = Parent
+     )
+
+predicate ReferencesTo : {
+  target : code.Entity,
+  source : code.Entity
+}
+  (
+    { { cxx = T }, { cxx = S } } where CxxReferencesTo { T, S }
+  ) | (
+    { { hack = T }, { hack = S } } where HackReferencesTo { T, S }
+  )
+
+predicate CxxReferencesTo : {
+  target : code.cxx.Entity,
+  source : code.cxx.Entity
+}
+  (
+    { { defn = { record_ = R }}, { decl = S } }
+      where CxxRecordReferenceTo { R, S }
+  ) | (
+    { { defn = { objcContainer = R }}, { decl = S } }
+      where CxxObjcReferencesTo { R, S }
+  )
+
+predicate CxxRecordReferenceTo : {
+  target : cxx1.RecordDefinition,
+  source : cxx1.Declaration,
+}
+  { Target, D } where
+    cxx1.DefToBaseDecl { defn = { record_ = Target }, decl = { record_ = Decl } };
+    { name = QName } = Decl;
+
+    cxx1.DeclarationSources { target = { record_ = Decl }, sources = S };
+    D = S[..];
+
+    # We don't care about references from things in this class
+    cxx1.DeclarationScope { decl = D, scope = Scope };
+    !({ recordWithAccess = { record = QName }} = Scope);
+
+    # We don't care about references from the class itself
+    !({ record_ = Decl } = D);
+
+predicate CxxObjcReferencesTo : {
+  target : cxx1.ObjcContainerDefinition,
+  source : cxx1.Declaration,
+}
+  { Target, D } where
+    { declaration = Decl } = Target;
+    cxx1.DeclarationSources { target = { objcContainer = Decl }, sources = S };
+    D = S[..];
+
+    # We don't care about references from things in this class
+    { id = Id } = Decl;
+    !({ objcMethod = { container = Id } } = D);
+    !({ objcProperty = { container = Id } } = D);
+
+    # We don't care about references from the class itself
+    !({ objcContainer = Decl } = D);
+
+predicate HackReferencesTo : {
+  target : code.hack.Entity,
+  source : code.hack.Entity
+}
+  { { decl = Decl }, { decl = S } } where
+    { container = { class_ = C } } = Decl;
+    hack.DeclarationSource { Decl, S };
+
+    # Filter out references from this class
+    !(S = Decl);
+
+    # Filter out references from members of this class
+    !(codemarkup.hack.HackContainsParentEntity {
+        child = { decl = S },
+        parent = { decl = Parent }
+      };
+      { container = { class_ = C } } = Parent
+     );
+
+    # Ignore references from methods, because they are already
+    # counted as references from the enclosing class
+    !({ method = _ } = S);
+}
diff --git a/glean/schema/source/csharp.angle b/glean/schema/source/csharp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/csharp.angle
@@ -0,0 +1,510 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema csharp.1 {
+
+import src
+
+predicate Name: string
+
+# Lower case normalized names (for case-insensive search)
+predicate NameLowerCase:
+  { nameLowercase: string
+  , name: Name,
+  } stored { prim.toLower Str, N } where N = Name Str
+
+predicate FullName:
+  { name: Name
+  , containingNamespace: Namespace
+  }
+
+predicate Namespace:
+  { name: Name
+  , containingNamespace: maybe Namespace
+  }
+
+# Represents a symbol (namespace, class, method, parameter, etc.) exposed by the
+# compiler (https://fburl.com/g1qzaga9)
+type Definition =
+  { type: AType
+  | method: Method
+  | field: Field
+  | parameter: Parameter
+  | typeParameter: TypeParameter
+  | local: Local
+  | property: Property
+  }
+
+# Represents a type (https://fburl.com/c0eftyms)
+type AType =
+  { arrayType: ArrayType
+  | namedType: NamedType
+  | functionPointerType: FunctionPointerType
+  | pointerType: PointerType
+  | typeParameter: TypeParameter
+  }
+
+# Represents a type other than an array, a pointer, a type parameter
+# (https://fburl.com/9sh8231c)
+type NamedType =
+  { class_: Class
+  | interface_: Interface
+  | record_: Record
+  | struct_: Struct
+  }
+
+predicate Class:
+  { name: FullName
+  , baseType: maybe Class
+  , typeParameters: [TypeParameter]
+  , containingType: maybe NamedType
+  , declaredAccessibility: Accessibility
+  , isAbstract: bool
+  , isStatic: bool
+  , isSealed: bool
+  }
+
+predicate Interface:
+  { name: FullName
+  , typeParameters: [TypeParameter]
+  , containingType: maybe NamedType
+  , declaredAccessibility: Accessibility
+  , isStatic: bool
+  }
+
+predicate Implements:
+  { type: NamedType
+  , interface_: Interface
+  }
+
+predicate Record:
+  { name: FullName
+  , baseType: maybe Record
+  , typeParameters: [TypeParameter]
+  , containingType: maybe NamedType
+  , declaredAccessibility: Accessibility
+  , isAbstract: bool
+  , isSealed: bool
+  }
+
+predicate Struct:
+  { name: FullName
+  , typeParameters: [TypeParameter]
+  , containingType: maybe NamedType
+  , declaredAccessibility: Accessibility
+  }
+
+# Enumeration for common accessibility combinations (https://fburl.com/bu2zzj2k)
+type Accessibility = enum
+  { Friend
+  | Internal
+  | NotApplicable
+  | Private
+  | Protected
+  | ProtectedAndFriend
+  | ProtectedAndInternal
+  | ProtectedOrFriend
+  | ProtectedOrInternal
+  | Public
+  }
+
+# Represents a method or method-like symbol (including constructor, destructor,
+# operator, or property/event accessor) (https://fburl.com/n0hrd48z)
+predicate Method:
+  { name: Name
+  , containingType: NamedType
+  , typeParameters: [TypeParameter]
+  , parameters: [Parameter]
+  , isStatic: bool
+  , returnType: AType
+  , declaredAccessibility: Accessibility
+  }
+
+# Enumeration for possible kinds of method symbols
+# (https://fburl.com/yiw81ctn)
+type MethodKind = enum
+  { AnonymousFunction
+  | BuiltinOperator
+  | Constructor
+  | Conversion
+  | DeclareMethod
+  | DelegateInvoke
+  | Destructor
+  | EventAdd
+  | EventRaise
+  | EventRemove
+  | ExplicitInterfaceImplementation
+  | FunctionPointerSignature
+  | LambdaMethod
+  | LocalFunction
+  | Ordinary
+  | PropertyGet
+  | PropertySet
+  | ReducedExtension
+  | SharedConstructor
+  | StaticConstructor
+  | UserDefinedOperator
+  }
+
+# Represents a parameter of a method or property (https://fburl.com/1vhc37sw)
+predicate Parameter:
+  { name: Name
+  , type: AType
+  , refKind: RefKind
+  , isThis: bool
+  , isParams: bool
+  , isOptional: bool
+  }
+
+# Denotes the kind of reference (https://fburl.com/t5jo5fe2)
+type RefKind = enum
+  { In
+  | None_
+  | Out
+  | Ref
+  | RefReadOnly
+  }
+
+# An enumeration declaring the kinds of variance supported for generic type parameters (https://fburl.com/op4cyu1z)
+type Variance = enum
+  { In
+  | None_
+  | Out
+  }
+
+# Represents a field in a class, struct or enum (https://fburl.com/s0t65fue)
+predicate Field:
+  { name: Name
+  , type: AType
+  , containingType: NamedType
+  , declaredAccessibility: Accessibility
+  , isConst: bool
+  , isReadonly: bool
+  , isVirtual: bool
+  }
+
+# Represents an array (https://fburl.com/u86l8jp9)
+predicate ArrayType:
+  { elementType: AType
+  , rank: byte
+  }
+
+# Represents a pointer type such as "int *". Pointer types are used only in
+# unsafe code (https://fburl.com/rwnza2j5)
+predicate PointerType:
+  { pointedAtType: AType
+  }
+
+# Represents a function pointer type such as "delegate*<void>"
+# (https://fburl.com/kx4v0t2w)
+predicate FunctionPointerType:
+  { name: FullName
+  , signature: Method
+  }
+
+# Represents a type parameter in a generic type or generic method
+# (https://fburl.com/pt267xpp)
+predicate TypeParameter:
+  { name: Name
+  , variance: maybe Variance
+  , hasNotNullConstraint: bool
+  , hasReferenceTypeConstraint: bool
+  , hasValueTypeConstraint: bool
+  }
+
+# Represents a local variable in method body (https://fburl.com/ebmq9edn)
+predicate Local:
+  { name: Name
+  , type: AType
+  , containingMethod: Method
+  , refKind: RefKind
+  , isConst: bool
+  }
+
+# Represents a property or indexer (https://fburl.com/051tvt5t)
+predicate Property:
+  { name: Name
+  , containingType: NamedType
+  , type: AType
+  , parameters: [Parameter]
+  , getMethod: maybe Method
+  , setMethod: maybe Method
+  , isStatic: bool
+  , isIndexer: bool
+  }
+
+type Location =
+  { fileLocation: src.FileLocation
+  , fileLines: src.FileLines
+  }
+
+predicate DefinitionLocation:
+  { definition: Definition
+  , location: Location
+  }
+
+predicate ObjectCreationLocation:
+  { type: AType
+  , constructor: Method
+  , location: Location
+  }
+
+predicate MethodInvocationLocation:
+  { method: Method
+  , location: Location
+  , expression: maybe MethodInvocationExpression
+  }
+
+type MethodInvocationExpression =
+  { memberAccess: MemberAccessLocation
+  }
+
+predicate MemberAccessLocation:
+  { expression: MemberAccessExpression
+  , location: Location
+  }
+
+type MemberAccessExpression =
+  { local: Local
+  | parameter: Parameter
+  | field: Field
+  | property: Property
+  | method: Method
+  }
+
+predicate TypeLocation:
+  { type: AType
+  , location: Location
+  }
+
+# A Horizon Unity platform package, e.g. apps/horizon
+# C# class: https://fburl.com/code/qwzlquxw
+# Wiki: https://fburl.com/wiki/bho3z437
+predicate UnityPackage:
+  { type: UnityPackageType
+  , name: string
+  }
+
+# Horizon Unity platform package type
+# C# PackageType enum: https://fburl.com/code/6bmqh86k
+# Wiki: https://fburl.com/wiki/bho3z437
+type UnityPackageType = enum
+  { Undefined
+  | ThirdParty
+  | Core
+  | Runtime
+  | Modules
+  | Worlds
+  | Apps
+  | Clones
+  | TestPackages
+  }
+
+# FAST project-generator assembly-definition (asmdef) type
+# C# AssemblyDefinition.Type enum: https://fburl.com/code/d6jyrwd4
+# Wiki: https://fburl.com/wiki/f4ju7ntu
+type UnityAssemblyType = enum
+  { Package
+  | Editor
+  | Tests
+  | TestsEditor
+  | UnitTests
+  | Internal
+  | AllApis
+  }
+
+# Uniquely identifies one of the projects generated by a given configuration of the FAST project-generator.
+#
+# One configuration of the project-generator (i.e. {package, assemblyType, projectTemplate}) may generate multiple
+# projects, i.e. there may be multiple facts for this predicate that differ only by projectBasename.
+#
+# The FAST project-generator ensures that the generated project's filenames are unique, so the information recorded
+# by this predicate is sufficient to both reconstruct the configuration of the project-generator, and to
+# single out one of the generated projects.
+predicate UnityProjectSource:
+  { projectBasename: string # The basename (filename and extension) of the generated project
+  , unityPackage: UnityPackage # Horizon Unity platform package type
+  , assemblyType: UnityAssemblyType # FAST project-generator asmdef type
+  , projectTemplate: src.File # A template file that exists in the repository
+  }
+
+# An MSBuild project file (.csproj) that exists in the repository
+predicate MSBuildProjectSource:
+  { src: src.File
+  }
+
+# The information required to locate or generate an MSBuild project
+type ProjectSource =
+  { unityProjectSource: UnityProjectSource
+  | msbuildProjectSource: MSBuildProjectSource
+  }
+
+# A "design time" MSBuild project, i.e. one that has been evaluated by MSBuild
+# for a given configuration, on a given host platform, with all conditions evaluated,
+# and imported projects expanded.
+predicate Project:
+  { source: ProjectSource
+  , platformTarget: maybe string
+  , targetFramework: maybe string
+  , sdk: maybe string
+  , outputType: maybe string
+  , assemblyName: maybe string
+  , rootNamespace: maybe string
+  }
+
+predicate UnityPackageToProject:
+  { unityPackage: UnityPackage
+  , project: Project
+  }
+  stored
+  { Pkg, Proj } where
+    Project { source = { unityProjectSource = { unityPackage = Pkg } } } = Proj;
+
+# Records that a given (fully-evaluated) MSBuild project included a given C# source file
+predicate ProjectToSourceFile:
+  { project: Project
+  , src: src.File
+  }
+
+predicate SourceFileToProject:
+  { src: src.File
+  , project: Project
+  }
+  stored
+  { Src, Proj } where
+    ProjectToSourceFile { project = Proj, src = Src };
+
+# An MSBuild solution file (.sln) that exists in the repository
+predicate Solution:
+  { src: src.File
+  }
+
+# Records that a given solution file includes a given project. We don't currently generate
+# any solution files
+predicate SolutionToProject:
+  { solution: Solution
+  , project: Project
+  }
+
+predicate ProjectToSolution:
+  { project: Project
+  , solution: Solution
+  }
+  stored
+  { Proj, Sln } where
+    SolutionToProject { solution = Sln, project = Proj };
+
+#
+# codemarkup compatibility layer
+#
+
+# some aliases for shorter names
+
+#
+# Re-index for file lookup
+#
+
+# file -> defn
+predicate FileDefinitions:
+  {
+    file: src.File,
+    defn: Definition
+  }
+  stored
+  { File, Defn } where
+    DefinitionLocation { Defn, { fileLocation = Loc } };
+    { file = File } = Loc;
+
+# defn -> file, span , name
+predicate DefinitionLocationName:
+  {
+    decl: Definition,
+    file: src.File,
+    span: src.ByteSpan,
+    name: string,
+  }
+  { Defn, File, Span, NameStr } where
+    ( { type = TDefn } = Defn;
+      { namedType = ADefn } = TDefn; # not all things have names yet
+      ( { class_ = { name = FullName } } |
+        { interface_ = { name = FullName } } |
+        { record_ = { name = FullName } } |
+        { struct_ = { name = FullName } } ) = ADefn;
+      { name = Name } = FullName
+    ) | (
+      ( { method = MDefn } = Defn; { name = Name } = MDefn ) |
+      ( { field = FDefn } = Defn; { name = Name } = FDefn ) |
+      ( { parameter = PDefn } = Defn; { name = Name } = PDefn ) |
+      ( { typeParameter = PDefn } = Defn; { name = Name } = PDefn ) |
+      ( { local = LDefn } = Defn; { name = Name } = LDefn ) |
+      ( { property = PDefn } = Defn; { name = Name } = PDefn );
+    );
+    csharp.Name NameStr = Name;
+    DefinitionLocation { Defn, { fileLocation = { File, Span }} };
+
+# xrefs
+
+predicate FileEntityXRefs:
+  {
+    file: src.File,
+    use: src.ByteSpan,
+    target: csharp.Definition
+  }
+  stored
+  { File, Span, Defn } where
+    ( MethodInvocationLocation { MDefn, { fileLocation = SrcLoc }, _ };
+      { method = MDefn } = Defn;
+    ) | (
+      ObjectCreationLocation { AType, _, { fileLocation = { File, Span }} };
+      { type = AType } = Defn;
+    ) | (
+      MemberAccessLocation { expression = Expr, location = { fileLocation = SrcLoc } };
+      ( { local = Local } = Expr; { local = Local } = Defn
+      ) | (
+        { parameter = Param } = Expr; { parameter = Param } = Defn
+      ) | (
+        { field = Field } = Expr; { field = Field } = Defn
+      ) | (
+        { property = Prop } = Expr; { property = Prop } = Defn
+      ) | (
+        { method = Method } = Expr; { method = Method } = Defn
+      );
+    ) | (
+      TypeLocation { AType, { fileLocation = { File, Span }} };
+      { type = AType } = Defn;
+    );
+    { File, Span } = SrcLoc;
+
+# search
+
+# find definitions knowing the local identifier name
+predicate SearchByName:
+  {
+    name: Name,
+    defn: Definition
+  }
+  { Name, Defn } where
+    # things that use FullNames
+    ( QName = csharp.FullName { name = Name };
+      TDefn = (
+        CDefn = Class { name = QName }; { class_ = CDefn } : NamedType ) | (
+        IDefn = Interface { name = QName }; { interface_ = IDefn } ) | (
+        RDefn = Record { name = QName }; { record_ = RDefn } ) | (
+        SDefn = Struct { name = QName }; { struct_ = SDefn }
+      );
+      { type = { namedType = TDefn } } = Defn;
+    # things that use Name only
+    ) | (
+      MDefn = Method { name = Name }; { method = MDefn } = Defn
+    ) | (
+      PDefn = Parameter { name = Name }; { parameter = PDefn } = Defn
+    ) | (
+      FDefn = Field { name = Name }; { field = FDefn } = Defn
+    ) | (
+      TDefn = TypeParameter { name = Name }; { typeParameter = TDefn } = Defn
+    ) | (
+      LDefn = Local { name = Name }; { local = LDefn } = Defn
+    ) | (
+      PDefn = Property { name = Name }; { property = PDefn } = Defn
+    )
+
+}
diff --git a/glean/schema/source/cxx.angle b/glean/schema/source/cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/cxx.angle
@@ -0,0 +1,1523 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema cxx1.5 {
+import buck.4
+import builtin.1
+import pp1
+import src
+import fbthrift
+
+# A name (identifier)
+predicate Name : string
+
+# Types are their textual representations for now
+predicate Type : string
+
+# Named parameter
+type Parameter =
+  {
+    name : Name,
+    type : Type,
+  }
+
+# Type signature of function or method (without name or scope)
+predicate Signature :
+  {
+    returns : Type,
+    parameters : [Parameter],
+  }
+
+# -----------------------------------------------------------------------------
+# Scopes and qualified names
+
+# Fully qualified C++ namespace name (or anonymous)
+predicate NamespaceQName :
+  {
+    name : maybe Name,
+    parent : maybe NamespaceQName,
+  }
+
+# Access scope for C++ declaration
+type Access = enum { Public | Protected | Private }
+
+# Scope (still somewhat incomplete)
+type Scope =
+  {
+    global_ : builtin.Unit |
+    namespace_ : NamespaceQName |
+    recordWithAccess :
+      {
+        record : QName,
+        access : Access
+      } |
+    local : FunctionQName
+  }
+
+# Fully qualified name
+predicate QName :
+  {
+    name : Name,
+    scope : Scope,
+  }
+
+# C++ operator name
+type Operator = string
+
+# C++ literal operator name
+type LiteralOperator = string
+
+# Describe a function or method name (without parameters or scope)
+predicate FunctionName :
+  {
+    name : Name |                         # ordinary name
+    operator_ : Operator |                # C++ operator
+    literalOperator : LiteralOperator |   # C++ literator operator (\"\"_x)
+    constructor : builtin.Unit |
+    destructor : builtin.Unit |
+    conversionOperator : Type
+  }
+
+# Fully qualified function name
+predicate FunctionQName :
+  {
+    name : FunctionName,
+    scope : Scope,
+  }
+
+# -----------------------------------------------------------------------------
+# Declarations
+
+# A namespace declaration
+predicate NamespaceDeclaration :
+  {
+    name : NamespaceQName,
+    source : src.Range,
+  }
+
+# C++ record kind - struct/class/union
+type RecordKind =
+   {
+     struct_ : builtin.Unit |
+     class_ : builtin.Unit |
+     union_ : builtin.Unit
+   }
+
+# Record declaration
+predicate RecordDeclaration :
+  {
+    name : QName,
+    kind : RecordKind,
+    source : src.Range,
+  }
+
+# Enum declaration
+predicate EnumDeclaration :
+  {
+    name : QName,
+    isScoped : bool,
+    type : maybe Type,
+    source : src.Range,
+  }
+
+# C++ method ref qualifier
+type RefQualifier = enum { None_ | LValue | RValue }
+
+# Method signature
+type MethodSignature =
+  {
+    isVirtual : bool,
+    isConst : bool,
+    isVolatile : bool,
+    refQualifier : RefQualifier,
+  }
+
+# Function declaration
+predicate FunctionDeclaration :
+  {
+    name : FunctionQName,
+    signature : Signature,
+    method : maybe MethodSignature,
+    source : src.Range,
+  }
+
+# C++ method override
+predicate MethodOverrides :
+  {
+    derived : FunctionDeclaration,
+    base : FunctionDeclaration,
+  }
+
+# Objective C category identifier
+type ObjcCategoryId =
+  {
+    className : Name,
+    categoryName : Name,
+  }
+
+# Objective C container identifier
+type ObjcContainerId =
+  {
+    protocol : Name |
+    interface_ : Name |
+    categoryInterface : ObjcCategoryId |
+    extensionInterface : Name |
+    implementation : Name |
+    categoryImplementation : ObjcCategoryId |
+  }
+
+# Objective C container (protocol, interface etc.) declaration
+predicate ObjcContainerDeclaration :
+  {
+    id : ObjcContainerId,
+    source : src.Range,
+  }
+
+# Objective C selector
+#
+# T166420010: This is not fully correct. Specifically, ObjC selectors
+# `method` and `method:` are different, but isn't distinguished here.
+predicate ObjcSelector : [string]
+
+# Objective C method declaration
+predicate ObjcMethodDeclaration :
+  {
+    selector : ObjcSelector,
+    # Locations of the slots of the selector.
+    # These correspond to the `selector` entries.
+    locations : [src.FileLocation],
+    container : ObjcContainerId,
+    signature : Signature,
+    isInstance : bool,
+    isOptional : bool,
+    isAccessor : bool,
+    source : src.Range,
+  }
+
+# The full name of an ObjC method declaration.
+#
+# If the method has no parameters, the name is the method name. e.g., `foo`
+# If the method has 1 parameter, the name ends with a colon. e.g., `foo:`
+# If the method has multiple parameters, the parameter names are
+# concatenated with a colon. e.g., `foo:bar:`
+#
+# Parameters may have no name, in which case they are omitted. e.g., `foo::`
+#
+# NOTE: Even with `ObjcSelector` not being sufficient in fully capturing
+# the name, we can deduce this name for a method since we have the `signature`.
+# That is, `parameters = []` is `method`, and `parameters = [_]` is `method:`.
+# However, Angle currently isn't powerful enough for us to perform string join
+# operations. As such, we produce these in the indexer and store them for now.
+predicate ObjcMethodDeclarationName :
+  {
+    decl : ObjcMethodDeclaration,
+    name : Name,
+  }
+
+# Objective C property declaration
+predicate ObjcPropertyDeclaration :
+  {
+    name : Name,
+    container : ObjcContainerId,
+    type : Type,
+    isInstance : bool,
+    isOptional : bool,
+    isReadOnly : bool,
+    isAtomic : bool,
+    source : src.Range,
+  }
+
+# Objective C property implementation kind
+type ObjcPropertyKind = enum { Synthesize | Dynamic }
+
+# Objective C property implementation
+predicate ObjcPropertyImplementation :
+  {
+    declaration : ObjcPropertyDeclaration,
+    kind : ObjcPropertyKind,
+    ivar : maybe Name,
+    source : src.Range,
+  }
+
+# C++ record base
+type RecordBase =
+  {
+    base : RecordDeclaration,
+    access : Access,
+    isVirtual : bool,
+  }
+
+# Enumerator declaration (constant in an enum)
+predicate Enumerator :
+  {
+    name : Name,
+    enumeration : EnumDeclaration,   # TODO: qname?
+    source : src.Range,
+  }
+
+# Enum definition
+predicate EnumDefinition :
+  {
+    declaration : EnumDeclaration,
+    enumerators : [Enumerator]
+  }
+
+# C++ function definition
+# Will also have a body eventually
+predicate FunctionDefinition :
+  {
+    declaration : FunctionDeclaration,
+    isInline : bool,
+  }
+
+# Unified Symbol Resolution (USR) hash for function
+type USR = string
+predicate USRToDeclaration:
+  {
+    hash : USR,
+    declaration : Declaration,
+  }
+
+
+# For quicker lookup of Entity -> USR
+predicate DeclarationToUSR :
+  {
+    declaration : Declaration,
+    usr : USR
+  }
+  stored { D, U } where USRToDeclaration { U, D }
+
+
+# Hash of the function's mangled name
+type MangledNameHash = string
+predicate MangledNameHashToDeclaration:
+  {
+    hash : MangledNameHash,
+    declaration : Declaration,
+  }
+
+# Objective C interface-implementation relationship
+predicate ObjcImplements :
+  {
+    implementation : ObjcContainerDeclaration,
+    interface_ : ObjcContainerDeclaration,
+  }
+
+# Reverse of ObjcImplements; efficiently look up implementations
+predicate ObjcInterfaceToImplementation :
+  {
+    interface_ : ObjcContainerDeclaration,
+    implementation : ObjcContainerDeclaration,
+  }
+  stored { If, Im } where ObjcImplements { Im, If }
+
+# Objective C method definition
+# Will also have a body eventually
+predicate ObjcMethodDefinition : ObjcMethodDeclaration
+
+predicate Declarations : [Declaration]
+
+# Two declarations refer to the same entity
+predicate Same :
+  {
+    declaration1 : Declaration,
+    declaration2 : Declaration,
+  }
+
+# Definitions
+
+# Part of a namespace definition
+predicate NamespaceDefinition :
+  {
+    declaration : NamespaceDeclaration,
+    members : Declarations,
+  }
+
+predicate RecordDefinition :
+  {
+    declaration : RecordDeclaration,
+    bases : [RecordBase],
+    members : Declarations,
+  }
+
+# Objective C interface definition
+predicate ObjcContainerDefinition :
+  {
+    declaration : ObjcContainerDeclaration,
+    protocols : [ObjcContainerDeclaration],
+    members : Declarations,
+  }
+
+# C++ preprocessor include trace
+type IncludeTrace =
+  {
+    include_ : pp1.Include,
+    trace : maybe Trace,  # deprecated; always nothing. See IncludeTree.
+  }
+
+# A C++ preprocessor event
+type PPEvent =
+  {
+    include_ : IncludeTrace |
+    define : pp1.Define |
+    undef : pp1.Undef |
+    use : pp1.Use |
+  }
+
+# A trace of preprocessor events in a C++ file
+predicate PPTrace :
+  {
+    file : src.File,
+    events : [PPEvent]
+  }
+
+# A trace of all interesting things in a C++ file
+predicate Trace :
+  {
+    file : src.File,
+    declarations : Declarations,
+    preprocessor : PPTrace,
+  }
+
+type MaybeIncludeTree =
+  {
+    tree : maybe IncludeTree
+  }
+
+predicate IncludeTree :
+  {
+    trace : Trace,
+    # The elements in this list map 1:1 to the `IncludeTrace` in `PPTrace`.
+    children : [MaybeIncludeTree],
+  }
+
+predicate IncludeTreeParent :
+  {
+    tree : IncludeTree,
+    parent : IncludeTree
+  }
+  stored { Child , Parent } where
+    Parent = IncludeTree { _, Children };
+    { tree = { just = Child }} = Children[..]
+
+# C++ type alias kind
+type TypeAliasKind = enum { Typedef | Using }
+
+# Type alias declaration (typedef or using)
+predicate TypeAliasDeclaration :
+  {
+    name : QName,
+    type : Type,
+    kind : TypeAliasKind,
+    source : src.Range,
+  }
+
+type NamespaceTarget =
+  {
+    namespace_ : NamespaceDeclaration |
+    namespaceAlias : NamespaceAliasDeclaration |
+  }
+
+predicate NamespaceAliasDeclaration :
+  {
+    name : NamespaceQName,
+    target : NamespaceTarget,
+    source : src.Range,
+  }
+
+# Using declaration
+predicate UsingDeclaration :
+  {
+    name : FunctionQName,
+    source : src.Range,
+  }
+
+# Using directive
+predicate UsingDirective :
+  {
+    name : QName,
+    source : src.Range,
+  }
+
+# Kind of global variable
+type GlobalVariableKind =
+  enum {
+    SimpleVariable |
+    StaticVariable |
+    StaticMember
+  }
+
+# Kind of local variable
+type LocalVariableKind =
+  enum {
+    SimpleVariable |
+    StaticVariable |
+    Parameter
+  }
+
+# Global variable attributes
+type GlobalVariableAttribute =
+  enum {
+    Plain |
+    Inline |
+    Constexpr
+  }
+
+# Local variable attributes
+type LocalVariableAttribute =
+  enum {
+    Plain |
+    Constexpr
+  }
+
+# Global variable description
+type GlobalVariable =
+  {
+    kind : GlobalVariableKind,
+    attribute : GlobalVariableAttribute,
+    definition : bool,  # is this a declaration or a definition
+  }
+
+# Local variable description
+type LocalVariable =
+  {
+    kind : LocalVariableKind,
+    attribute : LocalVariableAttribute,
+  }
+
+# Attributes of non-static member variables
+type Field =
+  {
+    mutable_ : bool,
+    bitsize : maybe nat,
+  }
+
+# Attributes of Objective C ivars
+type ObjcIVar =
+  {
+    synthesize : bool,
+    bitsize : maybe nat,
+  }
+
+# Kinds of variables
+type VariableKind =
+  {
+    global_ : GlobalVariable |
+    local : LocalVariable |
+    field : Field |
+    ivar : ObjcIVar |
+  }
+
+# Variable declaration
+predicate VariableDeclaration :
+  {
+    name : QName,
+    type : Type,
+    kind : VariableKind,
+    source : src.Range,
+  }
+
+# Sum type of all declarations
+type Declaration =
+  {
+    namespace_ : NamespaceDeclaration |
+    usingDeclaration : UsingDeclaration |
+    usingDirective : UsingDirective |
+    record_ : RecordDeclaration |
+    enum_ : EnumDeclaration |
+    function_ : FunctionDeclaration |
+    variable : VariableDeclaration |
+    objcContainer : ObjcContainerDeclaration |
+    objcMethod : ObjcMethodDeclaration |
+    objcProperty : ObjcPropertyDeclaration |
+    typeAlias : TypeAliasDeclaration |
+    namespaceAlias : NamespaceAliasDeclaration |
+  }
+
+# A specific slot of an ObjC selector. The `index` field is the position
+# within the `selector` and `locations` field of `ObjCMethodDeclaration`.
+#
+# This construction of declaration accompanied by an index enables
+# representing the relationship of (decl <-> defn) + index.
+type ObjcSelectorSlot =
+  {
+    objcMethod : ObjcMethodDeclaration,
+    index : nat,
+  }
+
+# What indirect xrefs can go through
+type XRefVia =
+  {
+    usingDeclaration : UsingDeclaration |
+    usingDirective : UsingDirective |
+    macro : pp1.Use |
+  }
+
+# C++ cross-reference target
+type XRefTarget =
+  {
+    declaration : Declaration |
+    enumerator : Enumerator |
+    objcSelector : ObjcSelector |
+    objcSelectorSlot : ObjcSelectorSlot |
+    unknown : src.Loc |
+    indirect : XRefIndirectTarget |
+  }
+
+# Cross-reference that goes through something (macro or using)
+predicate XRefIndirectTarget :
+  {
+    via : XRefVia,
+    target : XRefTarget,
+  }
+
+predicate XRefTargets : [XRefTarget]
+
+# Uses of XRefs
+#
+# There are 3 different sources of uses: file, expansion, and spelling.
+# Here's an example for an overview:
+#
+#   void foo() {}
+#
+#   #define FOO foo
+#               ^^^ spelling (1)
+#
+#   #define REF(x) x
+#
+#   void f() {
+#     foo();
+#     ^^^ file (2)
+#
+#     FOO();
+#     ^^^ expansion (3)
+#
+#     REF(foo)();
+#         ^^^  spelling (4)
+#     ^^^^^^^^ expansion (5)
+#   }
+#
+# The "file" uses are non-macro uses such as (2). "expansion" uses are xrefs
+# formed within macro expansions such as (3) and (5). The "spelling" uses are
+# the actual spelled out source location of the "expansion" uses. There are two
+# cases of this, one where the spelling is inside the macro body such as (1),
+# and where the spelling is the macro argument such as (4).
+#
+# An extra wrinkle here is that this predicate captures uses from a single file.
+# Refer to the `SpellingXRef` predicate for further details.
+type From =
+  {
+    spans : src.PackedByteSpans,
+    expansions : src.PackedByteSpans,
+    spellings : src.PackedByteSpans,
+  }
+
+# Cross-references to a known target
+type FixedXRef =
+  {
+    target : XRefTarget,
+    from : From,
+  }
+
+# Note that "froms" corresponds to many "targets" in FileXRefs
+# Cross-references in a file
+predicate FileXRefMap :
+  {
+    file : src.File,
+    fixed : [FixedXRef],
+    froms : [From],
+  }
+
+# Note that "targets" entries correspond to "froms" entries (in the "xmap").
+# Instantiation of a FileXRefMap with set of external references
+predicate FileXRefs :
+  {
+    xmap : FileXRefMap,
+    targets : [XRefTargets],
+  }
+
+# Captures the spelling xrefs discovered from different files.
+#
+# In general, we discover xrefs within a file while we're indexing that file.
+# Macros are special in that we can discover xrefs for a file from another.
+#
+# Consider the following silly example:
+#
+#   // foo.h
+#   void foo(int) {}
+#   #define FOO foo(42)
+#               ^^^ spelling (1)
+#
+#   // a.cpp
+#   #include "foo.h"
+#   void f() { FOO; }
+#              ^^^ expansion (2)
+#
+# The AST of `foo.h` does not contain any xrefs, since macro definitions do not
+# carry any semantics. We discover the spelling xref from (1) at the use at (2)
+# during the indexing of `a.cpp`.
+#
+# This predicate is used for this type of "external spelling xref" cases.
+#
+# NOTE: We don't group these by file because if we did, we can easily run into
+#       a combinatorial explosion of these facts. For example, consider if
+#       the `foo.h` above contained N macro definitions. Different files can
+#       include `foo.h` and each use an arbitrary subset of the macros. We can
+#       then end up with 2^N of these facts. Indexing per file location should
+#       help to deduplicate the spelling xrefs to absolute targets.
+predicate SpellingXRef :
+  {
+    source : src.FileLocation,
+    target : XRefTarget,
+  }
+
+# Uses
+
+# Note that ("target", "file") makes a unique key for these facts
+# All uses of a declaration in a file
+predicate TargetUses :
+  {
+    target : XRefTarget,
+    file : src.File,
+    from : From,
+  }
+
+# These are all disjoint equivalence classes.  Constructors within an array
+# guaranteed identical. Array length is at least 2.
+# All the declarations for a given entity.
+predicate DeclFamily : [Declaration]
+
+# These "decl" is a unique key here.  "decl" are only present iff they are
+# in a cxx1.Same, otherwise they are implicitly in a singleton family.
+# Map a declaration to its family.
+predicate DeclToFamily :
+  {
+    decl : Declaration,
+    family : DeclFamily,
+  }
+
+# Location of the name of a declaration
+#
+# The corresponding declaration may be declared within normal code, or it may
+# be within a macro expansion. If it's a normal declaration, the name span
+# refers to the name portion of the declaration. Otherwise, the name span
+# refers to the spelling location of the name.
+#
+# Example of declaration in normal code
+#
+#   void foo() {}
+#        ^^^ name span
+#   ^^^^^^^^^^^^^ decl range
+#
+# Example of declaration in macro expansion
+#
+#   #define FOO void foo() {}
+#                    ^^^ name span
+#
+#   FOO
+#   ^^^ decl range
+#
+# The name span is commonly the destination for Code Navigation.
+predicate DeclarationNameSpan :
+  {
+    decl : Declaration,
+    file : src.File,
+    span : src.ByteSpan
+  }
+
+# Generalization of Function call facts, which handles references between
+# any kinds of declarations.
+
+# Declarations referenced from a given declaration. This can be used
+# for constructing call graphs, for example.
+#
+# Notes:
+#   - source is limited to RecordDeclaration, FunctionDeclaration,
+#     ObjcContainerDeclaration, ObjcPropertyDeclaration, ObjcMethodDeclaration
+#
+#   - Each reference in the source is attributed to exactly one
+#     declaration. So for example, a reference inside a method is
+#     attributed to the method, but not the enclosing class declaration.
+#
+#   - The order of the declarations in the list is non-deterministic,
+#     but there are no duplicates (it should be a set, really)
+#
+predicate DeclarationTargets :
+  {
+    source : Declaration,
+    targets : [Declaration],
+  }
+
+# Declarations referring to a given declaration. The inverse of DeclarationTargets.
+predicate DeclarationSources :
+  {
+    target : Declaration,
+    sources : [Declaration],
+  }
+
+# Comment referring to a given declaration
+predicate DeclarationComment :
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+# A trace of a translation unit
+predicate TranslationUnitTrace :
+  {
+    tunit : buck.TranslationUnit,
+    trace : Trace,
+  }
+
+# An include tree of a translation unit
+predicate TranslationUnitIncludeTree :
+  {
+    tunit : buck.TranslationUnit,
+    tree : IncludeTree,
+  }
+
+predicate IncludeTreeTranslationUnit :
+  {
+    tree : IncludeTree,
+    tunit : buck.TranslationUnit,
+  }
+  stored { T, U } where TranslationUnitIncludeTree { U, T }
+
+# The fileXRefs corresponding to a particular translation unit
+predicate TranslationUnitXRefs :  # 2 is already used in cxx1
+  {
+    tunit : buck.TranslationUnit,
+    xrefs : [FileXRefs]
+  }
+
+# The backing ivar of a property
+predicate ObjcPropertyIVar :
+  {
+    property : ObjcPropertyDeclaration,
+    ivar : VariableDeclaration,
+  }
+
+# Derived Predicates
+
+# Lots of entities have a Scope-indexed parent
+# This just abstracts out the lookup of the Scope component
+predicate DeclarationScope :
+  {
+    decl : cxx1.Declaration,
+    scope : cxx1.Scope
+  }
+  { Decl, Scope } where
+    # these share FunctionQName scopes
+    ( FQN = Decl.function_?.name | Decl.usingDeclaration?.name;
+      Scope = FQN.scope
+    # vanilla QName scopes
+    ) | (
+      QN =
+         Decl.record_?.name |
+         Decl.variable?.name |
+         Decl.typeAlias?.name |
+         Decl.enum_?.name |
+         Decl.usingDirective?.name;
+      Scope = QN.scope
+    # NamespaceQName scopes
+    ) | (
+      NQN = Decl.namespace_?.name | Decl.namespaceAlias?.name;
+      Scope.namespace_? = NQN
+    )
+
+# src.Range of an arbitrary Declaration.
+predicate DeclarationSrcRange :
+  {
+    decl : Declaration,
+    source : src.Range,
+  }
+  { D, R } where
+     ( { namespace_ = X } = D;
+       X = NamespaceDeclaration { source = R }) |
+     ( { usingDeclaration = X } = D;
+       X = UsingDeclaration { source = R }) |
+     ( { usingDirective = X } = D;
+       X = UsingDirective { source = R }) |
+     ( { record_ = X } = D;
+       X = RecordDeclaration { source = R }) |
+     ( { enum_ = X } = D;
+       X = EnumDeclaration { source = R }) |
+     ( { function_ = X } = D;
+       X = FunctionDeclaration { source = R }) |
+     ( { variable = X } = D;
+       X = VariableDeclaration { source = R }) |
+     ( { objcContainer = X } = D;
+       X = ObjcContainerDeclaration { source = R }) |
+     ( { objcMethod = X } = D;
+       X = ObjcMethodDeclaration { source = R }) |
+     ( { objcProperty = X } = D;
+       X = ObjcPropertyDeclaration { source = R }) |
+     ( { typeAlias = X } = D;
+       X = TypeAliasDeclaration { source = R }) |
+     ( { namespaceAlias = X } = D;
+       X = NamespaceAliasDeclaration { source = R })
+
+# cxx1.RecordDefinition can lookup from Child to Parent. Reverse this
+# here to lookup from Parent to Child.
+predicate RecordDerived :
+  {
+    base : RecordDeclaration,
+    derived : RecordDeclaration,
+  }
+  stored
+  {Base, Derived}
+  where
+   cxx1.RecordDefinition{ declaration = Derived, bases = BS };
+   cxx1.RecordBase { base = Base } = BS[..]
+
+# cxx1.MethodsOverrides can lookup from Derived to Base. Reverse this
+# here to lookup from Base to Derived.
+predicate MethodOverridden :
+  {
+    base : FunctionDeclaration,
+    derived : FunctionDeclaration,
+  }
+  stored
+  {Base, Derived}
+  where
+    cxx1.MethodOverrides{derived = Derived, base = Base}
+
+#
+# Searching for declarations by name. One per kind
+#
+
+# For search, index just those with non-empty namespace local names
+predicate NamespaceDeclarationByName :
+  {
+    name : string,
+    parent: maybe NamespaceQName,
+    decl : NamespaceDeclaration
+  } stored { NameStr, Parent, Decl } where
+    Name = cxx1.Name NameStr;
+    NamespaceDeclaration { name = { { just = Name }, Parent } } = Decl
+
+predicate NamespaceLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    NamespaceQName { name = { just = Name NameStr }}
+
+# Derived predicates to distinguish records by kind, to avoid enumerating all
+# records when searching. We flatten the QName so that the Name key is left most,
+# avoiding the need to enumerate QNames to find things.
+predicate RecordDeclarationStruct :
+  {
+    name : string,
+    scope: Scope,
+    decl : RecordDeclaration
+  } stored { NameStr, Scope, Decl } where
+    Name = cxx1.Name NameStr;
+    RecordDeclaration { name = { Name, Scope }, kind = { struct_ = _ } } = Decl
+
+predicate RecordStructLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    RecordDeclaration { name = { name = Name NameStr }, kind = { struct_ = _ } };
+
+# Derived
+predicate RecordDeclarationClass :
+  {
+    name : string,
+    scope: Scope,
+    decl : RecordDeclaration
+  } stored { NameStr, Scope, Decl } where
+    Name = cxx1.Name NameStr;
+    RecordDeclaration { name = { Name, Scope }, kind = { class_ = _ } } = Decl
+
+predicate RecordClassLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    RecordDeclaration { name = { name = Name NameStr }, kind = { class_ = _ } };
+
+# Derived
+predicate RecordDeclarationUnion :
+  {
+    name : string,
+    scope: Scope,
+    decl : RecordDeclaration
+  } stored { NameStr, Scope, Decl } where
+    Name = cxx1.Name NameStr;
+    RecordDeclaration { name = { Name, Scope }, kind = { union_ = _ } } = Decl
+
+predicate RecordUnionLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    RecordDeclaration { name = { name = Name NameStr }, kind = { union_ = _ } };
+
+# Re-index left-keyed by cxx1.Name fact to avoid QName scans
+predicate EnumDeclarationByName :
+  { name : string,
+    scope : Scope,
+    decl : EnumDeclaration
+  } stored { NameStr, Scope, Decl } where
+    EnumDeclaration { name = { Name, Scope } } = Decl;
+    Name = cxx1.Name NameStr;
+
+predicate EnumLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    EnumDeclaration { name = { name = Name NameStr } };
+
+# Search: functions with real names only, to restrict to scope use the FQName
+predicate FunctionDeclarationByNameScope :
+  {
+    name: string,
+    scope: Scope,
+    decl: FunctionDeclaration
+  } stored { NameStr, Scope, Decl } where
+    FName = FunctionName { name = Name };
+    FQName = FunctionQName { name = FName, scope = Scope };
+    cxx1.Name NameStr = Name;
+    cxx1.FunctionDeclaration { name = FQName } = Decl;
+
+predicate FunctionLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    FunctionDeclaration { name = FQName };
+    FQName = FunctionQName { name = FName };
+    FName = FunctionName { name = Name NameStr }
+
+# searching for ObjcContainers. We need to split these up by kind
+predicate ObjcContainerDeclarationInterface :
+  {
+    name: string,
+    decl: ObjcContainerDeclaration
+  } stored { NameStr, Decl } where
+    cxx1.ObjcContainerDeclaration { id = ObjcId } = Decl;
+    ObjcId =
+      { interface_ = Name } |
+      { categoryInterface = { className = Name } } |
+      { extensionInterface = Name };
+    cxx1.Name NameStr = Name
+
+predicate ObjcContainerInterfaceLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    cxx1.ObjcContainerDeclaration { id = ObjcId };
+    ObjcId =
+      { interface_ = Name } |
+      { categoryInterface = { className = Name } } |
+      { extensionInterface = Name };
+    cxx1.Name NameStr = Name
+
+# Search enumerators by name
+predicate EnumeratorByName :
+  {
+    name: string,
+    decl: cxx1.Enumerator
+  } stored { NameStr, Decl } where
+    cxx1.Enumerator { name = cxx1.Name NameStr } = Decl
+
+predicate EnumeratorLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    Enumerator { name = cxx1.Name NameStr }
+
+# type alias search by name
+predicate TypeAliasDeclarationByName :
+  {
+    name : string,
+    scope : Scope,
+    decl : cxx1.TypeAliasDeclaration
+  } stored { NameStr, Scope, Decl } where
+    cxx1.TypeAliasDeclaration { name = { cxx1.Name NameStr, Scope } } = Decl
+
+predicate TypeAliasLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    TypeAliasDeclaration { name = { name = Name NameStr } }
+
+# Variable search by name. Let's not include locals since they're too numerous
+predicate VariableDeclarationNonLocalByName :
+  {
+    name : string,
+    scope: Scope,
+    decl : VariableDeclaration
+  } stored { NameStr, Decl.name.scope, Decl } where
+    Decl.name.name = cxx1.Name NameStr;
+    Decl.kind.global_? | Decl.kind.field? | Decl.kind.ivar?;
+
+predicate VariableLowerCase :
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    VariableDeclaration { name = QName, kind = Kind };
+    Kind.global_? | Kind.field? | Kind.ivar?;
+    QName.name = Name NameStr;
+
+#
+# Searching for declarations by case-insensitive name or prefix
+# We have tried a few things here:
+#   lowercase name to decl
+#   lowercase name to kind and upper name
+#
+# We want to use kind-partitioned tables so that kind-filtered searches work well,
+# leading to the current design with one predicate per kind
+
+# Use this derived predicate to handle declarations without a family in
+# a uniform way as declarations with a family.
+predicate DeclFamilyOf :
+  {
+    decl : Declaration,
+    family : Declaration,
+  }
+  {Decl, FamDecl}
+  where
+    FamDecl = Decl |
+    ( D where
+      cxx1.DeclToFamily{decl=Decl, family=DF};
+      DF=cxx1.DeclFamily F;
+      D=F[..]
+    )
+
+# Maps from a declaration to a RecordDefinition that has
+# (a family member of) the declaration as a member.
+
+# With no care for the space use we could make a stored derived predicated from
+# reversing the RecordDefinitions members, but since we care about space
+# let's perform this search on the fly.
+#
+# This is quite an elaborate search, for the following reasons:
+#
+# - We have a Declaration R::F
+# - A corresponding RecordDefinition can be found by searching for
+#   RecordDefinition { declaration = { name = R }}
+# - But there might be multiple of these (due to CPP, templates etc.),
+#   and some of them might not even contain R::F, so we have to find a
+#   correct one by searching for our R::F amongst the members.
+# - Furthermore, since the members might not contain our R::F but another
+#   decl in the same DeclFamily, we have to look up the family of R::F too.
+#
+# See T68843402 for progress on each declaration type.
+#
+# It might be worth swapping the order of the DeclFamilyOf and
+# RecordDefinition queries, but to do that we would need to prove
+# that all decl D in a family share an identical scope.
+
+predicate DeclInRecord :
+  {
+    decl : Declaration,
+    record : RecordDefinition,
+  }
+  { DeclIn, Record } where
+    # Declaration{namespace} cannot be in a record
+    # Declaration{objcContainer} cannot be in a record
+    # Declaration{ObjcMethodDeclaration} cannot be in a record
+    # Declaration{ObjcPropertyDeclaration} cannot be in a record
+    DeclFamilyOf { DeclIn, Decl };
+    cxx1.DeclarationScope { Decl, Scope };
+    { recordWithAccess = { record = QName } } = Scope;
+    DeclOut = cxx1.RecordDeclaration { name = QName }; # find the parent record
+    Record = cxx1.RecordDefinition{ declaration = DeclOut, members = Decls };
+    Decls = cxx1.Declarations DS;
+    DeclIn = DS[..]; # verify in decl is a member
+
+# Like DeclInRecord but exploit the fact we already have the base decl/defn
+predicate DefnInRecord :
+  {
+    defn : DefinitionEntity,
+    record : RecordDefinition
+  }
+  { DefnIn, Record} where
+    cxx1.DefToBaseDecl { DefnIn, DeclIn };
+    cxx1.DeclarationScope { DeclIn, Scope };
+    { recordWithAccess = { record = QName } } = Scope;
+    DeclOut = cxx1.RecordDeclaration { name = QName }; # find the parent record
+    Record = cxx1.RecordDefinition{ declaration = DeclOut, members = Decls };
+    Decls = cxx1.Declarations DS;
+    DeclIn = DS[..]; # verify in decl is a member
+
+# This allows going from a objc method or property declaration
+# to a definition that contains a family member of the declaration.
+#
+# If we could prove all decl D in a family share an
+# identical container id then we could change the order
+# of the queries for the DeclFamilyOf and ObjcContainerDefinition.
+#
+#  With no care for the space use we could make a stored derived predicated from
+# reversing the RecordDefinitions members.  Since we care about space we can
+# narrow the search space and then check the members.
+predicate DeclInObjcContainer :
+  {
+    decl : Declaration,
+    record : ObjcContainerDefinition,
+  }
+  {DeclIn, Container}
+  where
+  DeclFamilyOf{decl=DeclIn, family=Decl};
+
+  CId =
+    (
+      CId where { objcMethod = X } = Decl;
+      ObjcMethodDeclaration{container = CId} = X;
+    ) | (
+      CId where { objcProperty = X } = Decl;
+      ObjcPropertyDeclaration{container = CId} = X;
+    );
+  Container = ObjcContainerDefinition{declaration={id = CId}, members=Decls};
+  Decls = Declarations DS;
+  Decl = DS[..];
+
+# This allows going from an enumerator to the enum definition(s) that
+# contain the enumerator.
+#
+#  With no care for the space use we could make a stored derived predicated from
+# reversing the RecordDefinitions members.  Since we care about space we can
+# narrow the search space and then check the enmerators list.
+predicate EnumeratorInEnum :
+  {
+    enumerator : Enumerator,
+    enum_ : EnumDefinition
+  }
+  {EnumeratorIn, EnumDefOut}
+  where
+    Enumerator{enumeration = Decl} = EnumeratorIn;
+    EnumDefOut = EnumDefinition{declaration = Decl, enumerators = Enums};
+    EnumeratorIn = Enums[..]
+
+# Given a Declaration (in some file), find the Trace(s) (in that file) that
+# contain the Declaration. Very useful for looking up members of a namespace.
+predicate DeclarationInTrace :
+  {
+    decl : Declaration,
+    trace : Trace
+  }
+  {Decl, T}
+  where
+  DeclarationSrcRange{decl = Decl, source = {file = F}};
+  T = Trace{file = F, declarations = Decls};
+  Decls = Declarations DS;
+  Decl = DS[..]
+
+predicate ObjcContainerBase :
+    {
+        declaration : ObjcContainerDeclaration,
+        base : ObjcContainerDeclaration,
+    }
+
+predicate ObjcContainerInheritance :
+    {
+        base : ObjcContainerDeclaration,
+        declaration : ObjcContainerDeclaration,
+    }
+    stored
+    { Base, Decl }
+    where
+      ObjcContainerBase { Decl, Base }
+
+predicate Attribute : string
+
+# Lookup functions with a particular attribute
+predicate FunctionAttribute :
+  {
+    attr : Attribute,
+    declaration : FunctionDeclaration,
+  }
+
+# Inverse of FunctionAttribute. Lookup attributes using function decls as keys
+predicate FunctionDeclAttribute :
+  {
+    decl : FunctionDeclaration,
+    attr : Attribute,
+  } stored
+  { Decl, Attr } where cxx1.FunctionAttribute { Attr, Decl }
+
+# ObjCContainerId to Name
+predicate ObjContainerIdName :
+  {
+    id : ObjcContainerId,
+    name : Name,
+  }
+  { Id, Name } where
+    ( { protocol = Name } = Id) |
+    ( { interface_ = Name } = Id) |
+    ( { categoryInterface = { categoryName = Name } } = Id) |
+    ( { extensionInterface = Name } = Id) |
+    ( { implementation = Name } = Id) |
+    ( { categoryImplementation = { categoryName = Name  } } = Id)
+
+# General purpose Declaration to shortname Name
+predicate DeclarationLocationName :
+  {
+    decl : Declaration,
+    source : src.Range,
+    name : string,
+  }
+  { Decl, Range, NameStr } where
+    (
+      ( { namespace_ = X } = Decl;
+        X = NamespaceDeclaration { source = Range, name = QName };
+        NamespaceDeclarationName { QName, Name }) |
+      ( { usingDeclaration = X } = Decl;
+        X = UsingDeclaration { source = Range, name = QName };
+        QName = FunctionQName { name = { name = Name }}) |
+      ( { usingDirective = X } = Decl;
+        X = UsingDirective { source = Range, name = { name = Name }}) |
+      ( { record_ = X } = Decl;
+        X = RecordDeclaration { source = Range, name = { name = Name }}) |
+      ( { enum_ = X } = Decl;
+        X = EnumDeclaration { source = Range, name = { name = Name }}) |
+      ( { variable = X } = Decl;
+        X = VariableDeclaration {
+          source = Range,
+          name = { name = Name}}) |
+      ( { objcContainer = X } = Decl;
+        X = ObjcContainerDeclaration { source = Range, id = Id };
+        ObjContainerIdName { Id, Name }) |
+      ( { objcMethod = X } = Decl;
+        X = ObjcMethodDeclaration { source = Range };
+        ObjcMethodDeclarationName { X, Name }) |
+      ( { objcProperty = X } = Decl;
+        X = ObjcPropertyDeclaration { source = Range, name = Name }) |
+      ( { typeAlias = X } = Decl;
+        X = TypeAliasDeclaration { source = Range, name = { name = Name }}) |
+      ( { namespaceAlias = X } = Decl;
+        X = NamespaceAliasDeclaration { source = Range, name = QName };
+        NamespaceDeclarationName { QName, Name });
+      Name = Name NameStr
+    ) | (
+      { function_ = X } = Decl;
+      FunctionDeclaration { source = Range, name = { FName, _ } } = X;
+      FunctionDeclarationNameString { FName, NameStr }
+    )
+
+# short name for function declarations
+predicate FunctionDeclarationName:
+  { fname : FunctionName
+  , name : Name
+  }
+  { FName, Name } where
+     # common case, ordinary names
+    ( { name = Name } = FName ) |
+    ( { operator_ = OpNameStr } = FName;
+      Name = Name OpNameStr; ) |
+    ( { literalOperator = OpNameStr } = FName;
+      Name = Name OpNameStr; ) |
+    ( { constructor = _ } = FName;
+      Name = Name "constructor"; ) |
+    ( { destructor = _ } = FName;
+      Name = Name "destructor"; ) |
+    ( { conversionOperator = Type TypeStr } = FName;
+      Name = Name TypeStr; )
+
+predicate FunctionDeclarationNameString:
+  { fname : FunctionName
+  , name : string
+  }
+  { FName, Name } where
+     # common case, ordinary names
+    ( { name = Name : string } = FName ) |
+    ( { operator_ = Name } = FName; ) |
+    ( { literalOperator = Name } = FName; ) |
+    ( { constructor = _ } = FName;
+      Name = "constructor"; ) |
+    ( { destructor = _ } = FName;
+      Name = "destructor"; ) |
+    ( { conversionOperator = Type Name } = FName; )
+
+# short name for namespace declarations
+predicate NamespaceDeclarationName:
+  { qname : NamespaceQName
+  , name : Name
+  }
+  { QName, Name } where
+    ( NamespaceQName { name = { just = Name }} = QName ) |
+    ( NamespaceQName { name = nothing } = QName; Name = Name "anonymous" )
+
+predicate DeclarationLocationNameSpan :
+  {
+    decl : Declaration,
+    source : src.Range,
+    name : string,
+    file: src.File,
+    span : src.ByteSpan,
+  }
+  { Decl, Range, NameStr, File, Span } where
+    (
+      ( { namespace_ = X } = Decl;
+        X = NamespaceDeclaration { name = QName, source = Range };
+        NamespaceDeclarationName { QName, Name }) |
+      ( { usingDeclaration = X } = Decl;
+        X = UsingDeclaration { name = QName, source = Range };
+        QName = FunctionQName { name = { name = Name }}) |
+      ( { usingDirective = X } = Decl;
+        X = UsingDirective { name = { name = Name }, source = Range}) |
+      ( { record_ = X } = Decl;
+        X = RecordDeclaration { name = { name = Name }, source = Range }) |
+      ( { enum_ = X } = Decl;
+        X = EnumDeclaration { name = { name = Name }, source = Range }) |
+      ( { variable = X } = Decl;
+        X = VariableDeclaration { name = { name = Name }, source = Range }) |
+      ( { objcContainer = X } = Decl;
+        X = ObjcContainerDeclaration { id = Id, source = Range };
+        ObjContainerIdName { Id, Name }) |
+      ( { objcMethod = X } = Decl;
+        X = ObjcMethodDeclaration { source = Range };
+        ObjcMethodDeclarationName { X, Name }) |
+      ( { objcProperty = X } = Decl;
+        X = ObjcPropertyDeclaration { name = Name, source = Range }) |
+      ( { typeAlias = X } = Decl;
+        X = TypeAliasDeclaration { name = { name = Name }, source = Range }) |
+      ( { namespaceAlias = X } = Decl;
+        X = NamespaceAliasDeclaration { name = QName, source = Range };
+        NamespaceDeclarationName { QName, Name });
+      Name = Name NameStr
+    ) | (
+      { function_ = X } = Decl;
+      FunctionDeclaration { name = { FName, _ }, source = Range } = X;
+      FunctionDeclarationNameString { FName, NameStr }
+    );
+    DeclarationNameSpan { Decl, File, Span }
+
+# Mirror of type in code.cxx.angle
+type DefinitionEntity =
+  {
+    record_ : cxx1.RecordDefinition |
+    function_ : cxx1.FunctionDefinition |
+    enum_ : cxx1.EnumDefinition |
+    objcMethod : cxx1.ObjcMethodDefinition |
+    objcContainer : cxx1.ObjcContainerDefinition |
+    variable : cxx1.VariableDeclaration |
+    namespace_ : cxx1.NamespaceDefinition |
+  }
+
+# Short name and location of a definition (via its embedded declaration)
+# N.B. This isn't the inverse of DeclToDef (use DeclFamily for that), this
+# just unwraps a Definition to get at its root declaration value
+predicate DefToBaseDecl:
+  {
+    defn : DefinitionEntity,
+    decl : Declaration,
+  }
+  { Defn, Decl } where
+    ( { record_ = { declaration = X } } = Defn;
+      Decl = Declaration { record_ = X } ) |
+    ( { function_ = { declaration = X } } = Defn;
+      Decl = Declaration { function_ = X } ) |
+    ( { enum_ = { declaration = X } } = Defn;
+      Decl = Declaration { enum_ = X } ) |
+    ( { objcMethod = ObjcMethodDefinition X } = Defn;
+      Decl = Declaration { objcMethod = X } ) |
+    ( { objcContainer = { declaration = X } } = Defn;
+      Decl = Declaration { objcContainer = X } ) |
+    ( { variable = X } = Defn;
+      Decl = Declaration { variable = X } ) |
+    ( { namespace_ = { declaration = X } } = Defn;
+      Decl = Declaration { namespace_ = X } )
+
+# All uses of preprocessor #defines in a file, as xrefs
+predicate FilePPUseXRefs:
+  {
+    file: src.File,
+    source: src.Range,
+    define: pp1.Define,
+  }
+  { File, SrcRange, Define } where
+    Trace = cxx1.Trace { file = File };
+    FilePPUseTraceXRefs { File, Trace, SrcRange, Define };
+
+# All uses of preprocessor #defines in a file, as xrefs, for a specific trace
+# (deprecated)
+predicate FilePPUseTraceXRefs:
+  {
+    file: src.File,
+    trace: cxx1.Trace,
+    source: src.Range,
+    define: pp1.Define,
+  }
+  { File, Trace, SrcRange, Define } where
+    Trace = cxx1.Trace { file = File, preprocessor = { events = PPEvents } };
+    PPEvent = PPEvents[..];
+    { use = Use } = PPEvent;
+    { macro = Macro, definition = { just = { file = TargetFile }}, source = SrcRange } = Use;
+
+    # Search for the macro define, since 'definition' isn't a range xref
+    Define = pp1.Define { macro = Macro, source = { file = TargetFile } };
+
+# Definition location for a pp1.Define
+# (deprecated)
+predicate PPDefineLocation :
+  {
+    define : pp1.Define,
+    name : string,
+    file : src.File,
+    range : src.Range,
+  }
+  { Define, Name, File, Range } where
+    { pp1.Macro Name , Range } = Define;
+    { file = File } = Range;
+
+# Type of targets of pp xrefs (shape of code.pp.angle:Entity)
+type PpEntity =
+  {
+    define : pp1.Define |
+    undef : pp1.Undef |
+    include_ : src.File |
+  }
+
+# C preprocessor entities xrefs in this file
+predicate FilePPTraceXRefs:
+  {
+    file: src.File,
+    trace: cxx1.Trace,
+    source: src.Range,
+    ppEntity: PpEntity,
+    span: src.ByteSpan,
+  }
+  { File, Trace, SrcRange, Entity, SrcSpan } where
+    Trace = cxx1.Trace { file = File, preprocessor = { events = PPEvents } };
+    PPEvent = PPEvents[..];
+    # Uses are xrefs to #define entities
+    ( { SrcRange, Entity, SrcSpan } where
+      { use = Use } = PPEvent;
+      { Macro, { just = { file = TargetFile }}, _, SrcRange, SrcSpan } = Use;
+      Define = pp1.Define { Macro, { file = TargetFile } };
+      { define = Define } = Entity ) |
+
+    # #includes are xrefs to src.Files
+    ( { SrcRange, Entity, SrcSpan } where
+      { include_ = { include_ = Include } } = PPEvent;
+      { TargetFile, SrcRange, SrcSpan } = Include;
+      { include_ = TargetFile } = Entity; )
+
+# This maps generated Cxx entities
+# to their defining Thrift declaration
+# currently limited to functions
+predicate CxxToThrift:
+  {
+    from: cxx1.XRefTarget,
+    to: fbthrift.Declaration
+  }
+
+predicate ThriftToCxx:
+  {
+    to: fbthrift.Declaration,
+    from: cxx1.XRefTarget
+  }
+  stored { To, From }
+    where cxx1.CxxToThrift { From, To }
+
+}
diff --git a/glean/schema/source/dataswarm.angle b/glean/schema/source/dataswarm.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/dataswarm.angle
@@ -0,0 +1,85 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema dataswarm.1 {
+    import builtin.1
+    import src
+
+    # records that a Dataswarm macro exists with a given globally unique name
+    predicate MacroDeclaration: {
+        # eg: di.my_pipeline.my_task
+        task_id: string,
+        # local name in the task
+        name: string
+    }
+
+    # records that a Hive table is created within a Dataswarm pipeline
+    predicate TableDeclaration: {
+        table_name: string,
+        table_namespace: string
+    }
+
+    # records that a subquery/CTE is declared within a SQL query
+    predicate SubqueryDeclaration: {
+        # eg: di.my_pipeline.my_task
+        task_id: string,
+        # local name in the SQL query
+        name: string
+    }
+
+    # records that a column is declared in the SELECT clause of a SQL subquery/CTE
+    predicate SubqueryColumnDeclaration: {
+        # eg: di.my_pipeline.my_task
+        task_id: string,
+        subquery_name: string,
+        # this is the aliased column name, eg "bar" in "SELECT foo AS bar"
+        column_name: string
+    }
+
+    # records that a column is declared in the top-level SELECT clause of a Dataswarm SQL operator
+    predicate TableColumnDeclaration: {
+        table_name: string,
+        table_namespace: string,
+        column_name: string
+    }
+
+    type Declaration = {
+        macro: MacroDeclaration |
+        table: TableDeclaration |
+        subquery: SubqueryDeclaration |
+        table_column: TableColumnDeclaration |
+        subquery_column: SubqueryColumnDeclaration |
+    }
+
+    # a symbol declaration along with its unique location in the repo
+    predicate DeclarationLocation: {
+        declaration: Declaration,
+        file: src.File,
+        span: src.ByteSpan,
+    }
+
+    # a reference to another symbol (which may be declared in another file)
+    type XRef = {
+        target: Declaration,
+        # the place where the symbol is referenced
+        source: src.ByteSpan
+    }
+
+    # Collects all reference to names in a single file.
+    # There is only one fact of this predicate per source file in the repo.
+    predicate XRefsByFile: {
+        file: src.File,
+        xrefs: [XRef],
+    }
+
+    # derive a name predicate for each declaration (used by dataswarm.codemarkup)
+    predicate DeclarationName: {
+        declaration : Declaration,
+        name : string
+    }
+    {Decl, Name} where
+    Decl = (Declaration { macro = { name = Name } }) |
+        (Declaration { table = { table_name = Name } }) |
+        (Declaration { subquery = { name = Name } }) |
+        (Declaration { table_column = { column_name = Name } }) |
+        (Declaration { subquery_column = { column_name = Name } })
+}
diff --git a/glean/schema/source/digest.angle b/glean/schema/source/digest.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/digest.angle
@@ -0,0 +1,19 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema digest.1 {
+
+import src
+
+# type of CAS digest keys
+type Digest = {
+  hash: string,
+  size: nat
+}
+
+# Associate a file path with its content digest
+predicate FileDigest: {
+  file: src.File,
+  digest: Digest,
+}
+
+}
diff --git a/glean/schema/source/dyn.angle b/glean/schema/source/dyn.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/dyn.angle
@@ -0,0 +1,53 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+# Language-agnostic schema for modelling dynamic dispatch. This is useful for capturing
+# usages or references of symbols that can't be inferred via static analysis.
+schema dyn.6 {
+import code.24
+import src
+
+type Usage = enum {
+    # The entity was provably unused
+    Unused |
+    # The entity was possibly used but there is no guarantee
+    Enumerated |
+    # The entity was provably used
+    Used |
+}
+
+# A string describing where did we observe the usage
+predicate Environment: string
+
+predicate ObserverIdentifier: string
+
+# A dynamic usage can happen potentially in multiple ways (a callback might be
+# registered in multiple notification frameworks). This Observer type helps distinguish
+# between different ways an entity can be used.
+type Observer = {
+  # Interpret ObserverIdentifier as a symbol ID
+  symbol: ObserverIdentifier |
+  # Don't interpret ObserverIdentifier
+  other: ObserverIdentifier |
+}
+
+# Records the usage of a code entity
+predicate EntityUsage:
+  {
+    # The entity being used
+    entity: code.Entity,
+    # The thing observing this usage
+    observer: Observer,
+    usage: Usage,
+    environment: maybe Environment,
+  }
+
+predicate EntityDynamicReference:
+  {
+    # The entity being referenced
+    usage: EntityUsage,
+    # Usage site's file name
+    file: src.File,
+    # Usage site's location within `file`
+    span: src.ByteSpan,
+  }
+}
diff --git a/glean/schema/source/erlang.angle b/glean/schema/source/erlang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/erlang.angle
@@ -0,0 +1,136 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+# much of this schema is cargo-culted from ./python.angle
+
+schema erlang.1 {
+import src
+
+# Collects all reference to names in a single file.
+# There is only one fact of this predicate per source file in the repo.
+predicate XRefsViaFqnByFile :
+  {
+    file : src.File,
+    xrefs : [XRefViaFqn],
+  }
+
+predicate FunctionDeclaration :
+  {
+    fqn : Fqn,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+predicate DeclarationComment:
+  {
+    declaration : FunctionDeclaration,
+    file : src.File,
+    span : src.ByteSpan,
+    text : maybe string,
+  }
+
+## types
+
+type Declaration =
+  {
+    func : FunctionDeclaration |
+  }
+
+# fully-qualified name
+type Fqn =
+  {
+    module : string,
+    name : string,
+    arity : nat,
+  }
+
+# A cross reference, or access to a symbol
+type XRefViaFqn =
+  {
+    target : Fqn,
+    source : src.ByteSpan,
+  }
+
+## derived predicates
+
+predicate DeclarationWithFqn :
+  {
+    fqn : Fqn,
+    declaration : Declaration
+  }
+  {F, D} where
+  D = (
+    Declaration { func = { fqn = F } }
+  )
+
+predicate DeclarationToFqn: Declaration -> Fqn
+D -> Fqn where
+{func = { fqn = Fqn }} = D
+
+# All uses of a declaration in a particular file.
+# This predicate does not follow references, so if a symbol is used through
+# a chain of imports, only the first hop will be present as a fact.
+# Querying this predicate by declaration is an efficient way to find immediate
+# references
+predicate DeclarationUses :
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+  stored {Decl, File, Span} where
+  XRefsViaFqnByFile { File, XRefs };
+  { target = Fqn, source = Span } = XRefs[..];
+  DeclarationWithFqn { fqn = Fqn, declaration = Decl };
+
+predicate DeclarationsByFile :
+  {
+  file : src.File,
+  span : src.ByteSpan,
+  declaration : Declaration,
+  }
+  stored {File, Span, D} where
+  D = (
+    Declaration { func = { file = File, span = Span } }
+  )
+
+predicate DeclarationLocation :
+  {
+  declaration : Declaration,
+  file : src.File,
+  span : src.ByteSpan,
+  }
+  {D, File, Span} where
+  D = (
+    Declaration { func = { file = File, span = Span } }
+  )
+
+predicate DeclarationReference :
+  {
+    target : Declaration,
+    source : Declaration
+  }
+  { target = T, source = S } where
+  DeclarationUses {declaration=T, file=F, span=LittleSpan};
+  DeclarationsByFile {declaration=S, file=F, span=BigSpan};
+  src.ByteSpanContains {byteSpan=BigSpan, contains=LittleSpan}
+
+predicate NameLowerCase :
+  {
+    nameLowercase : string,
+    name : string,
+  }
+  stored
+  { prim.toLower Str, N } where
+   erlang.FunctionDeclaration { fqn = { name = N }};
+   N = Str
+
+# identifier to decl index for fast search, makes the name a prefix
+predicate SearchByName:
+  {
+    name : string, # local identifier
+    func : Declaration
+  } stored
+  { Name, { func = Decl } } where
+    Decl = erlang.FunctionDeclaration { fqn = { name = Name } };
+
+}
diff --git a/glean/schema/source/fbthrift.angle b/glean/schema/source/fbthrift.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/fbthrift.angle
@@ -0,0 +1,535 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema fbthrift.1 {
+import builtin.1
+import src
+
+# Primitives
+
+# First parameter of namespace directive:
+# cpp2, d, erl, go, hack, php, php_path, java, java.swift, hs,
+# py, py.asyncio, py.twisted, py3, rust, cocoa, csharp, c_glib
+predicate NamespaceName : string
+
+# Actual namespace from thrift file (optional quotes removed)
+predicate NamespaceValue : string
+
+# User defined Identifiers in Thrift
+predicate Identifier : string
+
+# Location where row and column are 1-based, or all zero for missing info
+type Loc =
+  {
+    startLine : nat,
+    startCol : nat,
+    endLine : nat,
+    endCol : nat,
+  }
+
+predicate PackageName : string
+
+# Example path: "fbcode/glean/shiny/if/shiny.thrift"
+# Pathname to a file, also used to qualify thrift identifiers
+predicate File : src.File
+
+# ##############################################################################
+# Thrift File Indexing pieces
+
+# Fully qualified thrift name resolved to thrift file scope
+predicate QualName : { file : File, name : Identifier }
+
+# Namespace header, quoted namespaces are indicated by bool value of true:
+# namespace "hs" My.Module  # name:"hs", namespace_:"My.Module", quoted:false
+# namespace "py" "Blue"     # name:"py", namepsace_:"Blue", quoted:true
+# namespace "java.swift" 'com.service'  # quoted:true, could be single quotes
+# Thrift namespace header, as hint to code generation
+predicate Namespace :
+  {
+    target : File,
+    name : NamespaceName,
+    namespace_ : NamespaceValue,
+    quoted : bool,
+  }
+
+# The different kinds of named type declarations in type specifications
+type NamedKind = enum { typedef_ | enum_ | struct_ | union_ }
+
+# Thrift Named type, part of a type specification
+#
+# User declared type identifier, along with resolved kind
+# Note: This cannot refer to an Exception (not part of NamedKind)
+type NamedType = { name : QualName, kind : NamedKind }
+
+predicate Package :
+  {
+    target : File,
+    name : PackageName,
+  }
+
+################################################################################
+# Thrift declarations as Glean predicates
+#
+# Note for queries: If we recusively expand the first parameter's
+# definition they all actually start with the *.thrift filepath.
+
+# Named type declaration, always at a particular location
+# could become (union of) separate full definitions
+predicate NamedDecl : { name : NamedType }
+
+# Declared exception, always at a particular location
+# could become a full definition or reference to struct definition
+predicate ExceptionName : { name : QualName }
+
+# Declared service name, always at a particular location
+# could become a full definition
+predicate ServiceName : { name : QualName }
+
+# Find the parent of a given service
+predicate ServiceParent : { child : ServiceName, parent : ServiceName }
+
+predicate ServiceChild :
+  {
+    parent : ServiceName,
+    child : ServiceName
+  }
+  stored
+  { Parent, Child } where
+  ServiceParent { child = Child, parent = Parent }
+
+# no internal thrift references to this
+# Declared function name, scoped to a service name
+predicate FunctionName :
+  {
+    service_ : ServiceName,
+    name : Identifier,
+  }
+
+# Declared constant name, always at a particular location
+predicate Constant : { name : QualName }
+
+predicate ConstantDefinition : { constant : Constant, definition : TypedConstT }
+
+# Declared enum value name, scoped to an enum name
+# could become a full definition
+predicate EnumValue : { enum_ : NamedType, name : Identifier }
+
+type FieldKind = enum { struct_ | union_ | exception_ }
+
+predicate FieldDecl : { qname : QualName, kind: FieldKind, name : Identifier }
+
+################################################################################
+# Cross-references
+
+# Thrift internal cross-reference target predicates, organized by kind
+# This is the type of thrift "Declarations"
+# The top level declarations in a file are struct, union, enum, typedef, const
+# members are fields, enum values and functions
+type XRefTarget =
+  {
+    include_ : File |
+    named : NamedDecl |  # struct, enum, union, typedef
+    exception_ : ExceptionName |
+    service_ : ServiceName |
+    constant : Constant |
+    enumValue : EnumValue |
+    function_ : FunctionName |
+    field : FieldDecl |
+  }
+
+# Thrift internal cross-reference target in a file
+# see FileXRefs for file context
+type Target = { target : XRefTarget }
+
+# Thrift internal cross-reference from locRef in a file to target
+# see FileXRefs for file context
+type XRef = { locRef : Loc, target : XRefTarget }
+
+# Collection of internal thrift cross-reference information for a file
+predicate FileXRefs :
+  {
+    file : File,
+    xrefs : [XRef],
+  }
+
+predicate DeclarationUses:
+  {
+    target: Declaration,
+    file: src.File,
+    range: Loc,
+  } stored
+  { Decl, File, Range }
+  where
+    FileXRefs { ThriftFile, XRefs };
+    ThriftFile = fbthrift.File File;
+    XRef = XRefs[..];
+    { Range, Decl } = XRef
+
+# ##############################################################################
+# Thrift types, recusive definition through predicate TypeSpecification
+# https://www.internalfb.com/intern/wiki/Thrift/IDL-Reference/
+
+type PrimitiveType = enum {
+  bool_ | byte_ | i16_ | i32_ | i64_ | float_ | double_ | binary_ | string_
+}
+
+type MapType = {
+  key_ : TypeSpecification,
+  value : TypeSpecification
+}
+
+type ContainerType = {
+  list_ : TypeSpecification |
+  set_ : TypeSpecification |
+  map_ : MapType
+}
+
+predicate TypeSpecification : {
+  primitive : PrimitiveType |
+  container : ContainerType |
+  named : NamedType
+}
+
+# ##############################################################################
+# Thrift fields
+
+# (true, 7) is +7, (false, 7) is -7.  Zero will be (true, 0)
+type IntegerLiteral = {
+  isNonNegative : bool,
+  absValue : nat
+}
+
+# Usually in the range of 1 through 65535. But sometimes 0 or negative.
+type FieldId = IntegerLiteral
+
+type Qualifier = enum { default_ | optional_ | required_ }
+
+# Use more precise UnqualField type that the canonical IDL,
+# where this is folded into FieldSpecification. Function arguments
+# and Union alternatives do not have a Qualifier.
+type UnqualField = {
+  id : FieldId,
+  type_ : TypeSpecification,
+  name : Identifier,
+  structuredAnnotations : [StructuredAnnotation]
+}
+
+# ##############################################################################
+# Function and Service definitions
+
+type ExceptionSpecName = {
+  simple : ExceptionName |  # key for ExceptionType
+  typedef_ : TypeDefException
+}
+
+# Make typedefs of exceptions separate from the normal TypeDefType
+predicate TypeDefException : {
+  alias : NamedDecl,
+  type_ : ExceptionSpecName
+}
+
+# Use more precise ExceptionSpecification type that the canonical IDL,
+# where this is folded into FieldSpecification
+type ExceptionSpecification = {
+  id : FieldId,
+  type_ : ExceptionSpecName,
+  name : Identifier,
+  structuredAnnotations : [StructuredAnnotation]
+}
+
+##############################################################################
+# Function and Service definitions
+
+# Some fancy streams are in use, making a complicated result type.
+# codeseach bunnylol: cs stream< repo:fbcode file:thrift$
+type ResultStream = {
+  response : maybe TypeSpecification,
+  stream_ : TypeSpecification,
+  throws_ : [ExceptionSpecification]
+}
+
+type ResultSink = {
+  type_ : TypeSpecification,
+  firstResponse : maybe TypeSpecification,
+  finalResponse : maybe TypeSpecification
+}
+
+# Thrift RPC calls can have several kinds of results:
+#
+# * oneway_ : function call does not wait for return, just sends message
+# * void_ : function call waits for return (or exception), no result value
+# * result : function waits for return value (or exception)
+# * stream_ : function call starts stream of results from server
+# * service_ : function call returns a service
+# * sink : function call starts sink of results from client
+type ResultType = {
+  oneway_ : builtin.Unit |
+  void_ : builtin.Unit |
+  result : TypeSpecification |
+  stream_ : ResultStream |
+  service_ : ServiceName |
+  sink_ :  ResultSink
+}
+
+predicate FunctionSpecification : {
+  name : FunctionName,
+  result : ResultType,
+  arguments : [UnqualField],
+  throws_ : [ExceptionSpecification],
+  structuredAnnotations : [StructuredAnnotation]
+}
+
+predicate ServiceDefinition : {
+  name : ServiceName,
+  functions : [FunctionSpecification],
+  structuredAnnotations : [StructuredAnnotation],
+  interactions : [InteractionName]
+}
+
+#
+# Support for file-indexed navigation in codemarkup
+#
+type Declaration = XRefTarget
+
+predicate DeclarationFile :
+  {
+    declaration : Declaration,
+    file : File,
+  }
+  { D, F } where
+    ({ include_ = F } = D) |
+    ({ named = { name = { name = { file = F } } } } = D) |
+    ({ exception_ = { name = { file = F } } } = D) |
+    ({ service_ = { name = { file = F } } } = D) |
+    ({ constant = { name = { file = F } } } = D) |
+    ({ enumValue = { enum_ = { name = { file = F } } } } = D) |
+    ({ function_ = { service_ = { name = { file = F } } } } = D) |
+    ({ field = { qname = { file = F } } } = D)
+
+# All declarations in a thrift file
+predicate FileDeclaration :
+  {
+    file: File,
+    decl: Declaration,
+  }
+  stored
+  { File, Decl } where
+  DeclarationNameSpan { decl = Decl, file = File }
+
+# Identifying name of a declaration
+predicate DeclarationNameSpan :
+  {
+    decl: Declaration,
+    name: Identifier,
+    file: File,
+    span: Loc,
+  }
+
+# Maps a qualified name to a declaration
+predicate DeclarationName:
+  {
+    qname: QualName,
+    decl: Declaration
+  }
+  { QName, Decl } where
+     ( N = NamedDecl { name = { name = QName } }; { named = N } = Decl )
+   | ( E = ExceptionName { name = QName }; { exception_ = E } = Decl )
+   | ( C = Constant { name = QName }; { constant = C } = Decl )
+   | ( S = ServiceName { name = QName }; { service_ = S } = Decl )
+
+# Maps a member name to a declaration
+predicate DeclarationMember:
+  {
+    qname: QualName,
+    member: Identifier,
+    decl: Declaration
+  }
+  { QName, Name, Decl } where
+     ( F = FieldDecl { qname = QName, name = Name };
+       { field = F } = Decl )
+   | ( Fun = FunctionName { service_ = { name = QName }, name = Name };
+       { function_ = Fun } = Decl )
+   | ( E = EnumValue { enum_ = { name = QName }, name = Name };
+       { enumValue = E } = Decl )
+
+predicate StructType : {
+  name : QualName,
+  fields : [FieldSpecification],
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate ExceptionType : {
+  name : QualName,  # key for ExceptionName
+  fields : [FieldSpecification],
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate UnionType : {
+  name : QualName,
+  alts : [UnqualField],
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate EnumerationType : {
+  name : QualName,
+  value : [EnumValueDef],
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate TypeDefType : {
+  alias : QualName,
+  type_ : TypeSpecification,
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate EnumValueDef : {
+  name : EnumValue,
+  value : IntegerLiteral,
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+type FieldSpecification = {
+  id : FieldId,
+  qualifier : Qualifier,
+  type_ : TypeSpecification,
+  name : Identifier,
+  value : maybe TypedConst,
+  structuredAnnotations : [StructuredAnnotation],
+}
+
+predicate StructuredAnnotation : {
+  type_ : TypeSpecification,
+  value : StructVal,
+}
+
+predicate StructVal : {
+  fields : [StructFieldVal]
+}
+
+predicate ExceptionVal : StructVal
+
+predicate UnionVal : {
+  field : UnionFieldVal,
+}
+
+predicate EnumVal : {
+  name : QualName,
+}
+
+type StructFieldValValue = {
+  val : TypedConstT |
+  default_ : TypeSpecification  |
+  just : TypedConstT |
+  nothing : {} |
+}
+
+type StructFieldVal = {
+  name : Identifier,
+  value : StructFieldValValue,
+}
+
+type UnionFieldVal = {
+  name : Identifier,
+  value : TypedConstT,
+}
+
+type TypedConstT = {
+  const_ : TypedConst,
+  type_ : TypeSpecification
+}
+
+type TypedConst = {
+  literal : Literal |
+  identifier : Constant
+}
+
+type FloatLiteral = {
+  isNaN : bool,
+  isPositive : bool,
+  exponent : nat,
+  significand : nat,
+}
+
+type KeyValue = {
+  key: TypedConst,
+  value: TypedConst,
+}
+
+predicate Literal : {
+  byte_ : IntegerLiteral |
+  i16_ : IntegerLiteral |
+  i32_ : IntegerLiteral |
+  i64_ : IntegerLiteral |
+
+  float_ : FloatLiteral |
+  double_ : FloatLiteral |
+
+  bool_ : bool |
+  string_ : string |
+  binary_ : [byte] |
+
+  set_ : [TypedConst] |
+  # hashSet_ : [TypedConst] | Deprecated - not exported by fbthrift
+  list_ : [TypedConst] |
+  map_ : [KeyValue] |
+  # hashMap_ : [KeyValue] | Deprecated - not exported by fbthrift
+
+  newtype_ : Literal |
+
+  struct_ : StructVal |
+  exception_ : ExceptionVal |
+  union_ : UnionVal |
+
+  enum_ : EnumVal |
+}
+
+# lookup qualnames by identifier
+predicate SearchByName:
+  {
+    name: Identifier,
+    qname: QualName,
+  } stored { Name, QName } where QName = fbthrift.QualName { name = Name }
+
+# lower case name map
+predicate NameLowerCase:
+  {
+    nameStr: string,
+    name: Identifier
+  } stored { prim.toLower NameStr, Name } where Name = fbthrift.Identifier NameStr
+
+# Lookup function declaration by full qname of service + identifier
+predicate FunctionDeclarationName:
+  {
+    qname: QualName,
+    name: Identifier,
+    decl: Declaration
+  }
+  { QName, Ident, { function_ = FN }} where
+    SN = ServiceName { name = QName };
+    FN = FunctionName { service_ = SN, name = Ident }
+
+predicate DeclarationComment:
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+  predicate InteractionName : { name : QualName }
+
+  predicate InteractionDefinition : {
+    name : InteractionName,
+    functions : [FunctionSpecification],
+    structuredAnnotations : [StructuredAnnotation]
+  }
+
+  predicate ServiceInteractionFunctions : {
+    name : ServiceName,
+    function_ : FunctionSpecification
+  }
+  {N, F} where
+    fbthrift.ServiceDefinition { name = N, interactions = I };
+    IntName = I[..];
+    fbthrift.InteractionDefinition { name = IntName, functions = Fs };
+    F = Fs[..]
+
+}
diff --git a/glean/schema/source/flow.angle b/glean/schema/source/flow.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/flow.angle
@@ -0,0 +1,762 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema flow.3 {
+import src
+
+predicate Module: {
+  file: src.File |
+  builtin |
+  lib: string |
+  noSource |
+  string_: string |
+}
+
+predicate FileOfStringModule: {
+  file: src.File,
+  string_: string,
+}
+
+predicate StringToFileModule: {
+  string_: string,
+  file: src.File,
+}
+  stored { S, F } where FileOfStringModule { F, S }
+
+# pairs of modules and identifier ranges. Associated with declarations
+predicate Range: {
+  module : Module,
+  span: src.ByteSpan,
+}
+
+predicate Name: string
+
+predicate Type: string
+predicate Documentation: Range
+
+predicate Declaration: {
+  name: Name,
+  loc: Range,
+}
+
+predicate DeclarationInfo: {
+  declaration: Declaration,
+  type: Type,
+  documentation: maybe Documentation,
+  span: maybe Range,
+}
+
+# connects a variable to its declaration within the same file
+predicate LocalDeclarationReference: {
+  declaration: Declaration,
+  loc: Range,
+}
+
+predicate MemberDeclaration: {
+  name: Name,
+  loc: Range,
+}
+
+predicate MemberDeclarationReference: {
+  memberDeclaration: MemberDeclaration,
+  loc: Range,
+}
+
+predicate MemberDeclarationInfo: {
+  memberDeclaration: MemberDeclaration,
+  type: Type,
+  documentation: maybe Documentation,
+  span: maybe Range,
+}
+
+predicate Export: {
+  commonJS |              # module.exports
+  commonJSMember: Name |  # module.exports.foo
+  named: Name |           # export { foo }
+  default_ |              # export default
+  star: Module |          # export * from 'module'
+}
+predicate ModuleExport: {
+  module: Module,
+  export_: Export,
+}
+
+predicate ModuleDoc: {
+  documentation: Documentation,
+  file: src.File,
+}
+
+# Re-index ModuleDoc so it is left-most keyed by module fact for O(1) lookup
+predicate ModuleComments: {
+  module: flow.Module,
+  file: src.File,
+  span: src.ByteSpan
+} stored { Module, File, Span } where
+  ( { file = F } = Module;
+    Mod = Module
+  ) | (
+    { string_ = S } = Module;
+    flow.StringToFileModule { string_ = S, file = F };
+    Mod = flow.Module { file = F }
+  );
+  Range = flow.Range { module = Mod, span = Span };
+  Doc = flow.Documentation Range;
+  flow.ModuleDoc { documentation = Doc, file = File };
+
+# indicates that a declaration is an import statement
+predicate ImportDeclaration: {
+  declaration: Declaration,
+  import_: {
+    moduleExport: ModuleExport |
+    moduleNamespace: Module |
+  }
+}
+
+# associates an exported symbol with where in the module the symbol was declared
+predicate SourceOfExport: {
+  moduleExport: ModuleExport,
+  source: {
+    declaration: Declaration |
+    memberDeclaration: MemberDeclaration |
+    moduleExport: ModuleExport |
+    moduleNamespace: Module |
+  },
+}
+
+predicate TypeDeclaration: {
+  name: Name,
+  loc: Range,
+}
+
+predicate TypeDeclarationReference: {
+  typeDeclaration: TypeDeclaration,
+  loc: Range,
+}
+
+predicate TypeDeclarationInfo: {
+  typeDeclaration: TypeDeclaration,
+  type: Type,
+  documentation: maybe Documentation,
+  span: maybe Range,
+}
+
+predicate TypeExport: {
+  named: Name |   # export type
+  star: Module |  # export
+}
+predicate ModuleTypeExport: {
+  module: Module,
+  typeExport: TypeExport,
+}
+
+predicate TypeImportDeclaration: {
+  typeDeclaration: TypeDeclaration,
+  import_: {
+    type: ModuleTypeExport |
+    typeof_: ModuleExport |
+    moduleTypeof: Module |
+  }
+}
+
+predicate SourceOfTypeExport: {
+  moduleTypeExport: ModuleTypeExport,
+  source: {
+    typeDeclaration: TypeDeclaration |
+    moduleTypeExport: ModuleTypeExport |
+    moduleNamespace: Module |
+  }
+}
+
+# Maps a src.File to the references within it. This is derived
+# automatically from the other references, and is used to provide
+# language-neutral reference info via the codemarkup schema.
+predicate FileXRef : {
+  file : src.File,
+  ref : XRef
+}
+  stored
+  ( { F, { localRef = L }} where
+    L = LocalDeclarationReference { loc = Loc };
+    { module = Mod } = Loc;
+    { file = F } = Mod ) |
+  ( { F, { memberRef = M }} where
+    M = MemberDeclarationReference { loc = Loc } ;
+    { module = Mod } = Loc;
+    { file = F } = Mod ) |
+  ( { F, { typeRef = T }} where
+    T = TypeDeclarationReference { loc = Loc };
+    { module = Mod } = Loc;
+    { file = F } = Mod )
+
+type XRef = {
+  localRef : LocalDeclarationReference |
+  memberRef : MemberDeclarationReference |
+  typeRef : TypeDeclarationReference |
+}
+
+# Reverse XRefs: local find-references for a declaration
+predicate DeclarationUses :
+  {
+    target : flow.SomeDeclaration,
+    file : src.File,
+    use : src.ByteSpan
+  }
+  ( { target = { localDecl = D }, file = F, use = Span } where
+    LocalDeclarationReference { declaration = D, loc = Range };
+    { module = { file = F } , span = Span } = Range ) |
+  ( { target = { memberDecl = D }, file = F, use = Span } where
+    MemberDeclarationReference { memberDeclaration = D, loc = Range };
+    { module = { file = F }, span = Span } = Range ) |
+  ( { target = { typeDecl = D }, file = F, use = Span } where
+    TypeDeclarationReference { typeDeclaration = D, loc = Range };
+    { module = { file = F }, span = Span } = Range )
+
+# Maps a src.File to the declarations it contains. This is derived
+# automatically from the declarations, and is used to provide
+# language-neutral declaration info via the codemarkup schema.
+predicate FileDeclaration: {
+  file : src.File,
+  declaration : SomeDeclaration
+}
+  stored
+  ( { F, { localDecl = D } } where
+    D = Declaration { loc = Loc };
+    { module = Mod } = Loc;
+    { file = F }  = Mod ) |
+  ( { F, { memberDecl = D } } where
+    D = MemberDeclaration { loc = Loc };
+    { module = Mod } = Loc;
+    { file = F }  = Mod ) |
+  ( { F, { typeDecl = D } } where
+    D = TypeDeclaration { loc = Loc };
+    { module = Mod } = Loc;
+    { file = F }  = Mod )
+
+# Find declarations contained in a parent module
+predicate ModuleContains:
+  {
+    module : Module,
+    member : SomeDeclaration,
+  }
+  stored
+  { Parent, Child } where
+    ( Decl = flow.Declaration { loc = Loc };
+      { localDecl = Decl } = Child
+    ) | (
+      Decl = flow.MemberDeclaration { loc = Loc };
+      { memberDecl = Decl } = Child
+    ) | (
+      Decl = flow.TypeDeclaration { loc = Loc };
+      { typeDecl = Decl } = Child
+    );
+    { module = Mod } = Loc;
+    # There are only file and lib modules in the xref table
+    # build an index here for string modules too
+    ( { file = File } = Mod;
+      FileOfStringModule { File, ModString };
+      Module { string_ = ModString } = Parent
+    ) | (
+      Mod = Parent;
+    )
+
+# tagged declaration types used for entities, see also flow.Module
+type SomeDeclaration = {
+  localDecl : Declaration |
+  memberDecl : MemberDeclaration |
+  typeDecl : TypeDeclaration |
+}
+
+#
+# Modern search, avoid the overly wide flow.Name type and use kinds
+# and rather than filtering on module container after the fact, include scope in
+# search
+#
+
+# local declarations (that are not import declarations, but we can't specify that here?)
+predicate SearchDeclarationByName:
+  {
+    name: string,
+    parent: Module, # there's always a module but it might be noSource or builtin
+    decl: Declaration
+  } stored { NameStr, Parent, Decl } where
+    Declaration { name = Name NameStr, loc = { module = Parent } } = Decl;
+    # would need a non-import table to avoid the negation
+    # !flow.ImportDeclaration { declaration = Decl }
+
+predicate SearchDeclarationByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    Declaration { name = Name NameStr }
+
+# member declarations
+predicate SearchMemberDeclarationByName:
+  {
+    name: string,
+    parent: Module,
+    decl: MemberDeclaration
+  } stored { NameStr, Parent, Decl } where
+    MemberDeclaration { name = Name NameStr, loc = { module = Parent } } = Decl;
+
+predicate SearchMemberDeclarationByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    MemberDeclaration { name = Name NameStr }
+
+# type declarations (that are not type import declarations, should be removed)
+predicate SearchTypeDeclarationByName:
+  {
+    name: string,
+    parent: Module,
+    decl: TypeDeclaration
+  } stored { NameStr, Parent, Decl } where
+    TypeDeclaration { name = Name NameStr, loc = { module = Parent } } = Decl;
+
+predicate SearchTypeDeclarationByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    TypeDeclaration { name = Name NameStr }
+
+# see flow.SearchByModuleName for module name sensitive case, not stored.
+
+predicate SearchModuleByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string,
+  } stored { prim.toLower NameStr, NameStr } where
+    (
+      Module { string_ = NameStr } | Module { lib = NameStr }
+    ) | (
+      Module { file = F } ; FileOfStringModule { F, NameStr }
+    )
+
+# deprecated
+# Search for decl by strings, precisely
+predicate SearchByName :
+  {
+    name : flow.Name,
+    decl : flow.SomeDeclaration
+  }
+  ({ name = N, decl = { localDecl = D } } where
+    D = flow.Declaration { name = N };
+  ) |
+  ({ name = N, decl = { memberDecl = D } } where
+    D = flow.MemberDeclaration { name = N };
+  ) |
+  ({ name = N, decl = { typeDecl = D } } where
+    D = flow.TypeDeclaration { name = N };
+  )
+
+# Search for Module entities by name
+# Does not consider StringOfFileModule cases
+predicate SearchByNameModule:
+  {
+    name: string,
+    module: Module
+  }
+  { Str, Mod } where
+    ( Module { string_ = Str } |
+      Module { lib = Str } |
+      ( F = src.File Str; Module { file = F } ) ) = Mod;
+      # [perf note] search files first and then modules
+
+# Search for Module entities by name, string of file name or file path
+# We have overlapping sets for string modules and string of file module
+# but some modules only show up in one set. So we'll try from most
+# convenient to least. Used to resolved symbol ids for modules.
+predicate SearchByModuleName:
+  {
+    name: string,
+    module: Module
+  }
+  { Str, Mod } where
+   # its conventional encoding of file or lib or string
+   if ( Module { string_ = Str } | Module { lib = Str } = Mod )
+   then ( Mod )
+   # or its a string for a file module
+   else if ( StringToFileModule { Str, F } )
+   then ( Module { file = F } = Mod )
+   # else, worst case, full file path
+   else (
+    F = src.File Str;
+    Module { file = F } = Mod
+   )
+
+# Lower case form of module name search
+# Slightly unusual as we have object names and module names indexed separately
+predicate ModuleNameLowerCase:
+  {
+    nameLowerCase: string,
+    name: Module
+  } stored { prim.toLower Str, Mod } where
+    SearchByNameModule { Str, Mod } |
+    ( StringToFileModule { Str, F }; Module { file = F } = Mod )
+
+# Search by Name and string code for the Module
+predicate SearchByModule :
+  {
+    string_: string,
+    name : flow.Name,
+    decl : flow.SomeDeclaration
+  }
+  { S, N, D } where
+    StringToFileModule { S, F };
+    FileDeclaration { F, D };
+    ({ localDecl = { name = N } } |
+     { memberDecl = { name = N } } |
+     { typeDecl = { name = N }}) = D;
+
+# Lookup a declaration knowing its name and its file
+# Please key by file fact. T
+predicate SearchByFileModule :
+  {
+    file : src.File,
+    name : flow.Name,
+    decl : flow.SomeDeclaration
+  }
+  { file = F, name = N, decl = D } where
+    FileDeclaration { F, D };
+    ({ localDecl = { name = N } } |
+     { memberDecl = { name = N } } |
+     { typeDecl = { name = N }}) = D;
+
+# For types exported from .flow files the Haste short name is mapped to the
+# .flow file via the ModuleTypeExport facts
+predicate SearchTypeByModuleExport :
+  {
+    string_: string,
+    name : flow.Name,
+    decl : flow.SomeDeclaration
+  }
+  { S, N, { typeDecl = D } } where
+    StringToFileModule { S, F };
+    MTE = ModuleTypeExport { module = { file = F } };
+    SourceOfTypeExport { MTE, { typeDeclaration = D } };
+    { name = N } = D;
+
+# Location of a SomeDeclaration
+# Some local declarations don't have a DeclarationInfo
+# We fallback on Declaration for them
+predicate DeclarationLocation :
+  {
+    decl: SomeDeclaration,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  ( { decl = { localDecl = D }, file = F, span = S } where
+      ( DeclarationInfo { declaration = D, span = { just = Range } };
+        Range = flow.Range { module = { file = F }, span = S }
+      ) | (
+        ! DeclarationInfo { declaration = D, span = { just = Range } };
+        Declaration { loc = { module = { file = F }, span = S } } = D
+      )
+  ) | (
+    { decl = { memberDecl = D }, file = F, span = S } where
+      ( MemberDeclarationInfo { memberDeclaration = D, span = { just = Range } };
+        Range = flow.Range { module = { file = F }, span = S }
+      ) | (
+        ! MemberDeclarationInfo { memberDeclaration = D, span = { just = Range } };
+        MemberDeclaration { loc = { module = { file = F }, span = S } } = D
+      )
+  ) | (
+    { decl = { typeDecl = D }, file = F, span = S } where
+      ( TypeDeclarationInfo { typeDeclaration = D, span = { just = Range } };
+        Range = flow.Range { module = { file = F }, span = S }
+      ) | (
+        ! TypeDeclarationInfo { typeDeclaration = D, span = { just = _ } };
+        TypeDeclaration { loc = { module = { file = F }, span = S } } = D
+      )
+  )
+
+# Location/span/name of a Module. Note that we don't have the module span yet
+predicate ModuleLocation:
+  {
+    module_: Module,
+    file: src.File,
+    span: src.ByteSpan,
+    name: string
+  }
+  { Mod, File, Span, Name } where
+    ( { string_ = Name } = Mod;
+      flow.StringToFileModule { Name, File };
+      { 0, 0 } = Span;
+    ) | (
+      { file = File } = Mod;
+      src.File Name = File;
+      { 0, 0 } = Span;
+    )
+
+predicate ModuleLocationByFile :
+  {
+    file: src.File,
+    module_: Module,
+    span: src.ByteSpan,
+    name: string
+  }
+  { File, Mod, Span, Name } where
+    ( flow.FileOfStringModule { File, Name };
+      { string_ = Name } = Mod;
+      { 0, 0 } = Span;
+    ) | (
+      Mod = flow.Module { file = File };
+      src.File Name = File;
+      { 0, 0 } = Span;
+    )
+
+#
+# Working across module import/export boundaries
+#
+
+predicate FlowXRefDeclInfo :
+  {
+    ref : XRef,
+    srcLoc : Range,
+    name : Name,
+    targetLoc : Range,
+    entity : SomeDeclaration,
+  }
+  { XRef, SrcLoc, Name, TargetLoc, Decl }
+  where
+  (
+    { localRef = { declaration = D, loc = SrcLoc }} = XRef;
+    { name = Name, loc = TargetLoc } = D;
+    Decl = SomeDeclaration { localDecl = D };
+  ) | (
+    { memberRef = { memberDeclaration = D, loc = SrcLoc }} = XRef;
+    { name = Name, loc = TargetLoc } = D;
+    Decl = SomeDeclaration { memberDecl = D };
+  ) | (
+    { typeRef = { typeDeclaration = D, loc = SrcLoc }} = XRef;
+    { name = Name, loc = TargetLoc } = D;
+    Decl = SomeDeclaration { typeDecl = D };
+  );
+
+predicate FlowSameModule :
+  {
+    left : flow.Module,
+    right : flow.Module
+  }
+  { Left, Right } where
+    ( { string_ = S } = Left;
+      StringToFileModule { string_ = S, file = F };
+      Right = flow.Module { file = F } ) |
+    ( { file = F } = Left;
+      flow.FileOfStringModule { file = F, string_ = S };
+      Right = flow.Module { string_ = S } )
+
+# Map a declaration to a module namespace entity
+predicate FlowModuleNamespaceXRef :
+  {
+    local : Declaration,
+    entity : SomeEntity,
+    file : src.File
+  }
+  { Local, { module_ = FileMod }, File }
+  where
+    ImportDeclaration {
+      declaration = Local,
+      import_ = { moduleNamespace = M } };
+    (
+      FileMod = M;
+      FileMod = { file = File };
+    ) | (
+      FlowSameModule { M, FileMod };
+      FileMod = { file = File };
+    );
+
+# Mostly we need declarations, but occasionally we need modules
+# Synonym for code.flow.Entity
+type SomeEntity =
+  {
+    decl : flow.SomeDeclaration |
+    module_ : flow.Module |
+  }
+
+#
+# If a local declaration is an import, find the corresponding
+# flow.SourceOfExport
+#
+predicate FlowExportLocation :
+  {
+    module : Module,
+    export_ : Export,
+    entity : SomeEntity,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { M, E, Entity, File, Span }
+  where
+    Mod = M | (N where FlowSameModule { M, N });
+    SourceOfExport {
+      moduleExport = { module = Mod, export_ = E },
+      source = Source };
+    (
+      { declaration = D } = Source;
+      { loc = Loc } = D;
+      { decl = { localDecl = D } } = Entity
+    ) | (
+      { memberDeclaration = D } = Source;
+      { loc = Loc } = D;
+      { decl = { memberDecl = D } } = Entity
+    );
+    { span = Span, module = { file = File } } = Loc;
+    # TODO: moduleExport, moduleNamespace
+
+predicate FlowTypeExportLocation :
+  {
+    moduleTypeExport : ModuleTypeExport,
+    entity : SomeEntity,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { ModuleTypeExport, { decl = { typeDecl = D }}, File, Span } where
+    { module = M, typeExport = TE } = ModuleTypeExport;
+    Mod = M | (N where FlowSameModule { M, N });
+    SourceOfTypeExport {
+      moduleTypeExport = { module = Mod, typeExport = TE },
+      source = { typeDeclaration = D }};
+    { loc = Loc } = D;
+    { span = Span, module = { file = File } } = Loc;
+
+predicate FlowCompatibleExport :
+  {
+    left : Export,
+    right : Export
+  }
+  { { commonJS = {} }, { default_ = {} } } |
+  { { default_ = {} }, { commonJS = {} } } |
+  { { named = Name }, { commonJSMember = Name } } |
+  { { commonJSMember = Name }, { named = Name } }
+
+#
+# Map an import declaration to the location of its original definition
+# Grab the target definition file and span while we're here
+#
+predicate FlowImportXRef :
+  {
+    local : Declaration,
+    entity : SomeEntity,
+    targetFile : src.File,
+    targetSpan : src.ByteSpan
+  }
+  { Local, Entity, TargetFile, TargetSpan } where
+    (
+      ImportDeclaration {
+        declaration = Local,
+        import_ = { moduleExport = ME } };
+      { module = M, export_ = E } = ME;
+      Export = E | (F where FlowCompatibleExport { E, F });
+      FlowExportLocation { M, Export, Entity, TargetFile, TargetSpan };
+    ) | (
+      FlowModuleNamespaceXRef { Local, Entity, TargetFile };
+      TargetSpan = { 0, 0 }
+    );
+
+# Map an import type declaration to the location of its original definition
+predicate FlowTypeImportXRef :
+  {
+    local : TypeDeclaration,
+    entity : SomeEntity,
+    targetFile : src.File,
+    targetSpan : src.ByteSpan
+  }
+  { TypeDecl, Entity, TargetFile, TargetSpan } where
+    TypeImportDeclaration {
+      typeDeclaration = TypeDecl,
+      import_ = Import
+    };
+    (
+      { type = MTE } = Import;
+      FlowTypeExportLocation { MTE, Entity, TargetFile, TargetSpan };
+    ) | (
+      { typeof_ = ModuleExport } = Import;
+      { module = M, export_ = E } = ModuleExport;
+      FlowExportLocation { M, E, Entity, TargetFile, TargetSpan };
+    ) | (
+      { type = ModuleExport } = Import;
+      { module = M, typeExport = { named = "default" } } = ModuleExport;
+      FlowExportLocation { M, { default_ = {} }, Entity, TargetFile, TargetSpan };
+    )
+
+# Inverse map of definition entities to their import declarations
+# Useful for fast lookup of import decl occurences of an exported value
+predicate FlowEntityImportUses :
+  {
+    target: SomeEntity,
+    local: Declaration,
+  }
+  stored
+  { TargetDecl , Decl } where
+    FlowImportXRef { local = Decl, entity = TargetDecl };
+
+# Inverse map of type definition entities to their import declarations
+predicate FlowTypeEntityImportUses :
+  {
+    target: SomeEntity,
+    local: TypeDeclaration,
+  }
+  stored
+  { TargetDecl, TypeDecl } where
+    FlowTypeImportXRef { local = TypeDecl, entity = TargetDecl };
+
+# Associate entities with all their refernces:
+# - local references
+# - remote import declarations
+# - remote references to those import declarations
+predicate FlowEntityUsesAll :
+  {
+    target: SomeEntity,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  # local uses in same file as definition including members
+  ({ { decl = D }, File, Span } where
+    DeclarationUses { target = D, file = File, use = Span }) |
+  # type imports and references to them
+  ({ Entity, File, Span } where
+    FlowTypeEntityImportUses { Entity, Import };
+    ({ File, Span } where
+      DeclarationLocation { { typeDecl = Import }, File, Span } |
+      DeclarationUses { { typeDecl = Import }, File, Span }
+    )) |
+  # or value imports and their references
+  ({ Entity, File, Span } where
+    FlowEntityImportUses { Entity, Import };
+    ({ File, Span } where
+      DeclarationLocation { { localDecl = Import }, File, Span } |
+      DeclarationUses { { localDecl = Import }, File, Span }
+    ))
+
+# Useful lookup from declaration to name and span. See also DeclarationLocation
+predicate DeclarationNameSpan:
+  {
+    decl: flow.SomeDeclaration,
+    name: flow.Name,
+    span: src.ByteSpan
+  }
+  { { localDecl = { name = Name, loc = { span = Span }}}, Name, Span } |
+  { { memberDecl = { name = Name, loc = { span = Span }}}, Name, Span } |
+  { { typeDecl = { name = Name, loc = { span = Span }}}, Name, Span }
+
+# convenience wrapper for extracting the signature from each decl
+predicate DeclarationSignature:
+  {
+    decl : flow.SomeDeclaration,
+    signature : string
+  }
+  { Decl, Sig } where
+    ( { localDecl = D } = Decl;
+      flow.DeclarationInfo { declaration = D, type = flow.Type Sig }
+    ) | (
+      { memberDecl = D } = Decl;
+      flow.MemberDeclarationInfo { memberDeclaration = D, type = flow.Type Sig }
+    ) | (
+      { typeDecl = D } = Decl;
+      flow.TypeDeclarationInfo { typeDeclaration = D, type = flow.Type Sig }
+    )
+
+}
diff --git a/glean/schema/source/gencode.angle b/glean/schema/source/gencode.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/gencode.angle
@@ -0,0 +1,41 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+# Schema to store GenCode information for a file
+schema gencode.1 {
+import src
+
+type GenCodeVariant = enum {
+  # File containing generated code entirely
+  Full |
+  # File containing gencode partially
+  Partial
+}
+
+predicate GenCodeCommand : string
+
+predicate GenCodeClass : string
+
+predicate GenCodeSignature : string
+
+# This fact contains information whether or not the file is a gencode
+predicate GenCode : {
+  file : src.File,
+  variant : GenCodeVariant,
+  # source for gencode
+  source : maybe src.File,
+  # command used for gencode
+  command : maybe GenCodeCommand,
+  # class for gencode
+  class_ : maybe GenCodeClass,
+  # whether the gencode is signed
+  signature : maybe GenCodeSignature,
+}
+
+# This fact contains mapping from the file which generated the gencode
+predicate GenCodeBySource : {
+  source : src.File,
+  gencode : src.File,
+}
+stored {SourceFile, GenCodeFile} where
+  GenCode { file = GenCodeFile, source = { just = SourceFile } }
+}
diff --git a/glean/schema/source/github/schema.angle b/glean/schema/source/github/schema.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/github/schema.angle
@@ -0,0 +1,72 @@
+# Copyright (c) Facebook, Inc. and its affiliates.
+
+schema all.1 :
+  builtin,
+  code,
+  code.anglelang,
+  code.buck,
+  code.csharp,
+  code.cxx,
+  code.erlang,
+  code.flow,
+  code.hack,
+  code.hs,
+  code.java,
+  code.kotlin,
+  code.lsif,
+  code.pp,
+  code.python,
+  codemarkup,
+  codemarkup.anglelang,
+  codemarkup.buck,
+  codemarkup.csharp,
+  codemarkup.cxx,
+  codemarkup.erlang,
+  codemarkup.flow,
+  codemarkup.hack,
+  codemarkup.haskell,
+  codemarkup.java,
+  codemarkup.kotlin,
+  codemarkup.lsif,
+  codemarkup.pp,
+  codemarkup.python,
+  codemarkup.scip,
+  codemarkup.search,
+  codemarkup.types,
+  csharp,
+  cxx1,
+  digest,
+  dyn,
+  erlang,
+  flow,
+  gencode,
+  glass,
+  glean.test.6,
+  graphql,
+  hack,
+  hs,
+  code.kotlin,
+  kotlin.alpha,
+  lsif,
+  lsif.types,
+  pp1,
+  python,
+  scip,
+  search.anglelang,
+  search.buck,
+  search.code,
+  search.cxx,
+  search.erlang,
+  search.hack,
+  search.java,
+  search.kind.cxx,
+  search.kotlin,
+  search.hs,
+  search.pp,
+  src,
+  symbolid.cxx,
+  symbolid.java,
+  symbolid.kotlin,
+  sys,
+  indexer
+{}
diff --git a/glean/schema/source/glass.angle b/glean/schema/source/glass.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/glass.angle
@@ -0,0 +1,40 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema glass.1 {
+
+import src
+import digest
+import codemarkup
+
+# Everything we need to initialize a file info for querying in Glass
+type FileMetadata = {
+  indexed: bool,
+  offsets: maybe src.FileLines,
+  digest: maybe digest.Digest,
+  indexFailure: maybe src.IndexFailure
+}
+
+# Key by filepath to get blob of metadata back.
+# This is how src.File facts and their related data are introduced into Glass
+predicate FileInfo:
+  {
+    file: src.File,
+    info: FileMetadata
+  }
+  { File, { Indexed, MOffsets, MDigest, MFailure } } where
+    src.File _ = File; # binding occurence
+    MOffsets =
+      if (Offsets = src.FileLines { file = File } )
+      then ( { just = Offsets } )
+      else ( nothing );
+    MDigest =
+      if (digest.FileDigest { File, Digest })
+      then ( { just = Digest } )
+      else ( nothing );
+    Indexed = if (codemarkup.IndexedFile File) then (true) else (false);
+    MFailure =
+      if (F = src.IndexFailure { file = File } )
+      then ( { just = F } )
+      else ( nothing );
+
+}
diff --git a/glean/schema/source/graphql.angle b/glean/schema/source/graphql.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/graphql.angle
@@ -0,0 +1,306 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema graphql.3 {
+import src
+
+# Core graphql predicates built from the graphql IR
+
+# https://spec.graphql.org/October2021/#sec-Language.Arguments
+predicate Argument :
+  {
+    name: Value,
+    value: Value,
+  }
+
+predicate Directive :
+  {
+    name: Value,
+    arguments: [Argument],
+  }
+
+predicate DirectiveDef :
+  {
+    name: Value,
+    argumentDefs: [InputValueDef],
+    locations: [DirectiveDefLocation],
+  }
+
+type DirectiveDefLocation =
+  enum {
+    QUERY  |
+    MUTATION |
+    SUBSCRIPTION |
+    FIELD |
+    FRAGMENT_DEFINITION |
+    FRAGMENT_SPREAD |
+    INLINE_FRAGMENT |
+    SCHEMA |
+    SCALAR |
+    OBJECT |
+    FIELD_DEFINITION |
+    ARGUMENT_DEFINITION |
+    INTERFACE |
+    UNION |
+    ENUM |
+    ENUM_VALUE |
+    INPUT_OBJECT |
+    INPUT_FIELD_DEFINITION |
+  }
+
+predicate EnumTypeDef :
+  {
+    name: Value,
+    values: [Value],
+    directives: [Directive],
+  }
+
+predicate Fragment :
+  {
+    name: Value,
+    typeCondition: Value,
+    variableDefs: [VariableDef],
+    directives: [Directive],
+    selectionSet: SelectionSet,
+    loc: src.FileLocation,
+  }
+
+predicate FragmentSpread :
+  {
+    name: Value,
+    loc: src.FileLocation,
+    arguments: [Argument],
+    directives: [Directive],
+  }
+
+# https://spec.graphql.org/October2021/#sec-Language.Fields
+predicate Field :
+  {
+    type: Value,
+    name: Value,
+    directives: [Directive],
+    selectionSet: SelectionSet,
+    arguments: [Argument],
+    alias: maybe Value,
+    loc: src.FileLocation,
+  }
+
+predicate FieldDef :
+  {
+    name: Value,
+    type: Value,
+    argumentDefs: [InputValueDef],
+    directives: [Directive],
+  }
+
+predicate InlineFragment :
+  {
+    inferredTypeCondition: Value,
+    directives: [Directive],
+    selectionSet: SelectionSet,
+    typeCondition: maybe Value,
+  }
+
+predicate InputValueDef :
+  {
+    name: Value,
+    type: Value,
+    directives: [Directive],
+    defaultValue: maybe Value,
+  }
+
+predicate InputObjectTypeDef :
+  {
+    name: Value,
+    fields: [InputValueDef],
+    directives: [Directive],
+  }
+
+predicate InterfaceTypeDef :
+  {
+    name: Value,
+    fields: [FieldDef],
+    directives: [Directive],
+  }
+
+predicate ObjectTypeDef :
+  {
+    name: Value,
+    interfaces: [Value],
+    fields: [FieldDef],
+    directives: [Directive],
+  }
+
+type OperationKind =
+  enum {
+    QUERY  |
+    MUTATION |
+    SUBSCRIPTION
+  }
+
+# https://spec.graphql.org/October2021/#sec-Language.Operations
+predicate Operation :
+  {
+    name: Value,
+    kind: OperationKind,
+    directives: [Directive],
+    variableDefs: [VariableDef],
+    selectionSet: SelectionSet,
+    loc: src.FileLocation,
+  }
+
+predicate BelongToConfig:
+{
+  file: src.File,
+  buildConfig: Value,
+  schema: maybe Value,
+}
+
+predicate ScalarTypeDef :
+  {
+    name: Value,
+    directives: [Directive],
+  }
+
+type SelectionSet =
+  {
+    fields: [Field],
+    inlineFragments: [InlineFragment],
+    fragmentSpreads: [FragmentSpread],
+  }
+
+predicate UnionTypeDef :
+  {
+    name: Value,
+    types: [Value],
+    directives: [Directive],
+  }
+
+# used in queries / fragments
+predicate VariableDef :
+  {
+    name: Value,
+    type: Value,
+    directives: [Directive],
+    defaultValue: maybe Value,
+  }
+
+# All names found in any identifiers
+predicate Value : string
+
+#
+# codemarkup-layer abstractions for navigation and search
+# see use in codemarkup.graphql.angle, code.graphql.angle
+#
+
+type Declaration =
+  {
+    operation_ : Operation |
+    fragment_ : Fragment |
+    field_ : FieldDef |
+    enum_ : EnumTypeDef |
+    directive_ : DirectiveDef
+  }
+
+predicate DeclarationLocation :
+  {
+    declaration: Declaration,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  { Decl, File, Span} where
+    ({ operation_ = Q } = Decl;
+     Q = Operation { loc = { file = File, span = Span} }
+    ) | (
+    { fragment_ = F } = Decl;
+      F = Fragment { loc = { file = File, span = Span} }
+    );
+    # TODO (calebtho): add support for declarations located in the schema
+
+# All declarations by file
+predicate FileDeclarations :
+  {
+    file : src.File,
+    span: src.ByteSpan,
+    declaration : Declaration,
+  }
+  stored {File, Span, Decl} where
+    DeclarationLocation { Decl, File, Span};
+
+# (deprecated) As it isn't sound (it isn't a functional relationship)
+predicate DeclarationName: Declaration -> Value
+  D -> Value where
+    Value =
+      (N where { operation_ = X} = D; { name = N } = X) |
+      (N where { fragment_ = X } = D; { name = N } = X);
+
+# Declarations in GraphQL are name:Value-indexed, so lookup is simple
+predicate DeclHasName:
+  {
+    decl: Declaration,
+    name: Value,
+  }
+  { Decl, Name } where
+    ({ operation_ = { name = Name }} = Decl) |
+    ({ fragment_ = { name = Name }} = Decl);
+
+# Cross-references.
+# Fragment spreads -> fragments
+
+# Type of xref occurences
+type XRef =
+  {
+    decl  : Declaration,
+    span : src.ByteSpan,
+  }
+
+# Like FileDeclarations but stored for cross-references keyed by file
+predicate FileXRefs:
+  {
+    file : src.File,
+    xref : XRef,
+  } stored
+  { SrcFile, { Decl, Span }} where
+    # case one: FragmentSpread -> Fragment
+    FragmentSpread { name = FName, loc = { file = SrcFile, span = Span } };
+    FDecl = Fragment { name = FName, loc = { file = DstFile } };
+    # Confirm the two files are in the same config
+    BelongToConfig { file = SrcFile, buildConfig = SrcConfig };
+    BelongToConfig { file = DstFile, buildConfig = DstConfig };
+    SrcConfig = DstConfig;
+    { fragment_ = FDecl } = Decl : Declaration
+
+# Inverse of FileXRefs, goes from entity to its use
+# Derived by inverting FileXRefs.
+predicate DeclarationUses:
+  {
+    target: Declaration,
+    file: src.File,
+    span: src.ByteSpan,
+  } stored
+  { Decl, File, Span } where FileXRefs { File, { Decl, Span } }
+
+# Search
+
+# Rather than use "Value" which covers all strings in the index
+# Derive an actual name table
+
+type Name = Value
+
+predicate NameLowerCase:
+  {
+    lowercase: string,
+    name: Name
+  }
+  stored { prim.toLower NameStr, Name } where Name = Value NameStr
+
+# Inverted form of DeclarationName to key by the name for search
+predicate SearchByName:
+  {
+    name: Name,
+    decl: Declaration,
+  }
+  { Name, Decl } where
+    ( O = Operation { name = Name }; { operation_ = O }) |
+    ( F = Fragment { name = Name }; { fragment_ = F }) = Decl;
+
+}
diff --git a/glean/schema/source/hack.angle b/glean/schema/source/hack.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/hack.angle
@@ -0,0 +1,1107 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema hack.6 {
+import src
+import fbthrift
+
+# Name (identifier)
+predicate Name : string
+
+# Qualified namespace name
+predicate NamespaceQName :
+  {
+    name : Name,
+    parent : maybe NamespaceQName,
+  }
+
+# Qualified identifier
+predicate QName :
+  {
+    name : Name,
+    namespace_ : maybe NamespaceQName,
+  }
+
+# Type and contexts are represented as strings.
+# Qualified names use "\\" as separator, don't start with a leading "\\".
+# The most common types don't start with HH https://fburl.com/code/uavv841q
+#
+# Example: fully qualified name -> representation in DB
+# \\HH\\Contexts\\throws<\\FooException> -> HH\\Contexts\\throws<FooException>
+# \\HH\\Awaitable -> Awaitable
+# \\HH\\Contexts\\defaults -> HH\\Contexts\\defaults
+# \\HH\\Traversable -> Traversable
+predicate Type : string
+
+predicate Context_ : string
+
+# Hint predicate follow closely the Hack hint AST (Aast_defs.hint)
+
+#  QName uniquely defines a container, the kind (class, trait...) isn't
+#  needed.
+type FieldClassConst = { container : QName, name : Name }
+
+type ShapeKV = {
+  key: {
+    sf_regex_group : string |
+    sf_lit_string : string |
+    sf_class_const : FieldClassConst
+  },
+  value: Hint,
+  opt: bool,
+}
+
+# follow the structure of Aast_defs.hint
+predicate Hint : {
+  apply : { class_name : QName, values : [Hint] } |
+  option : Hint |
+  like : Hint |
+  tuple : { req: [ Hint ], opt: [ Hint ], variadic : maybe Hint }  |
+  class_args : Hint |
+  shape :  { open_ : bool, map_ : [ShapeKV] } |
+  soft : Hint |
+  intersection : [ Hint ] |
+  union_ : [ Hint ] |
+  vect_or_dict : { maybe_key : maybe Hint, value_ : Hint } |
+  prim : Type |
+  var_ : string |
+  fun_context : string |
+  mixed |
+  wildcard |
+  nonnull |
+  this_ |
+  dynamic |
+  nothing |
+  other : Type | # fall back to pretty-printed type for non implemented types
+}
+
+# End Hints
+
+predicate TypeInfo : {
+  displayType : Type, # human friendly textual representation
+  xrefs : [XRef], # spans are relative to the "displayType" field content
+  hint : maybe Hint, # structured representation of the type
+}
+
+# Named parameter
+type Parameter =
+  {
+    name : Name,
+    type : maybe Type, # deprecated, replaced by TypeInfo
+    isInout : bool,
+    isVariadic : bool,
+    defaultValue : maybe string,
+    attributes : [UserAttribute],
+    typeInfo : maybe TypeInfo,
+    readonly : maybe ReadonlyKind,
+  }
+
+# Type signature of function or method
+predicate Signature :
+  {
+    returns : maybe Type, # deprecated, replaced by returnsTypeInfo
+    parameters : [Parameter],
+    contexts : maybe [Context_],
+    returnsTypeInfo : maybe TypeInfo,
+  }
+
+# Visibility scope of declaration
+type Visibility = enum { Private | Protected | Public | Internal }
+
+# Variance (subtyping)
+type Variance = enum { Contravariant | Covariant | Invariant }
+
+# Reification kinds
+#
+# c.f. https://docs.hhvm.com/hack/reified-generics
+#
+# N.B. Missing __Warn T138109774
+#
+type ReifyKind = enum { Erased | Reified | SoftReified }
+
+# Contrant kinds
+type ConstraintKind = enum { As | Equal | Super }
+
+# Constraint
+type Constraint =
+  {
+    constraintKind : ConstraintKind,
+    type: Type,  # deprecated, replaced by TypeInfo
+    typeInfo: maybe TypeInfo
+  }
+
+type ReadonlyKind = enum { Readonly }
+
+# User-defined attribute
+predicate UserAttribute :
+  {
+    name : Name,
+    parameters : [string],
+    qname : maybe QName,
+  }
+
+# Hack type parameter
+type TypeParameter =
+  {
+    name : Name,
+    variance : Variance,
+    reifyKind : ReifyKind,
+    constraints : [Constraint],
+    attributes : [UserAttribute],
+  }
+
+# Hack namespace
+predicate NamespaceDeclaration : { name : NamespaceQName }
+
+# Declaration/Definition of a Hack module
+# generated from "new module" constructs)
+predicate ModuleDeclaration : { name : Name }
+
+# Declaration of a Hack class
+predicate ClassDeclaration : { name : QName }
+
+# Declaration of a Hack interface
+predicate InterfaceDeclaration : { name : QName }
+
+# Declaration of a Hack trait
+predicate TraitDeclaration : { name : QName }
+
+# Declaration of a Hack enum
+predicate EnumDeclaration : { name : QName }
+
+# Declaration of a container, which may be a parent or child of another
+type ContainerDeclaration =
+  {
+    class_ : ClassDeclaration |
+    enum_ : EnumDeclaration |
+    interface_ : InterfaceDeclaration |
+    trait : TraitDeclaration |
+  }
+
+# Declaration of a Hack typedef (type alias)
+predicate TypedefDeclaration : { name : QName }
+
+# Declaration of a global constant (top-level)
+predicate GlobalConstDeclaration : { name : QName }
+
+# Declaration of a Hack function, which could be top-level or inline
+predicate FunctionDeclaration : { name : QName }
+
+# Enumerator declaration (constant in an enum)
+predicate Enumerator :
+  {
+    name : Name,
+    enumeration : EnumDeclaration,
+  }
+
+# Declaration of a class constant (member constant)
+predicate ClassConstDeclaration :
+  {
+    name : Name,
+    container : ContainerDeclaration,
+  }
+
+# Declaration of a type constant (container member type constant)
+predicate TypeConstDeclaration :
+  {
+    name : Name,
+    container : ContainerDeclaration,
+  }
+
+# Declaration of a Hack method (member function)
+predicate MethodDeclaration :
+  {
+    name : Name,
+    container : ContainerDeclaration,
+  }
+
+# Declaration of a Hack property (container member variable)
+predicate PropertyDeclaration :
+  {
+    name : Name,
+    container : ContainerDeclaration,
+  }
+
+# Types of declarations in Hack
+type Declaration =
+  {
+    classConst : ClassConstDeclaration |
+    container : ContainerDeclaration |
+    enumerator : Enumerator |
+    function_ : FunctionDeclaration |
+    globalConst : GlobalConstDeclaration |
+    namespace_ : NamespaceDeclaration |
+    method : MethodDeclaration |
+    property_ : PropertyDeclaration |
+    typeConst : TypeConstDeclaration |
+    typedef_ : TypedefDeclaration |
+    module : ModuleDeclaration |
+  }
+
+# The location of a declaration, spanning the name declared only
+predicate DeclarationLocation :
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+# The location of a declaration and any accompanying definition (the same source
+# location in Hack), spanning the whole declaration/definition construct.
+#
+# Known quirk: the spans in the Hack AST include leading attributes/types for
+# most constructs, but these are excluded from the span location for container
+# properties, eg: the span of class property `protected string $foo = "bar";`
+# starts at `$foo` rather than `protected`.
+#
+# For modules, the span is the whole "new module Foo {}" expression
+predicate DeclarationSpan :
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+# For efficient queries across all declarations in a given file.
+predicate FileDeclarations :
+  {
+    file : src.File,
+    declarations : [Declaration],
+  }
+
+# Documentation comment for a given declaration
+predicate DeclarationComment :
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+type ModuleMembership = { declaration: ModuleDeclaration, internal: bool}
+
+# Infos related to a hack module
+predicate ModuleDefinition :
+  {
+    declaration : ModuleDeclaration,
+    attributes : [UserAttribute],
+  }
+
+predicate MemberCluster :
+  {
+    members : [Declaration]
+  }
+
+# All declarations in a container coming from a parent class (recursively)
+# or a trait. Doesn't include the declarations that directly defined
+# in the container. Members are grouped in clusters for storage efficiency.
+predicate InheritedMembers :
+  {
+    container : ContainerDeclaration,
+    inheritedMembers : [MemberCluster],
+  }
+
+# Definition of a Hack class
+predicate ClassDefinition :
+  {
+    declaration : ClassDeclaration,
+    isAbstract : bool,
+    isFinal : bool,
+    members : [Declaration],
+    extends_ : maybe ClassDeclaration,
+    implements_ : [InterfaceDeclaration],
+    uses : [TraitDeclaration],
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    module_ : maybe ModuleMembership,
+  }
+
+# Definition of a Hack interface
+predicate InterfaceDefinition :
+  {
+    declaration : InterfaceDeclaration,
+    members : [Declaration],
+    extends_ : [InterfaceDeclaration],
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    requireExtends : [ClassDeclaration],
+    module_ : maybe ModuleMembership,
+  }
+
+# Definition of a Hack trait
+predicate TraitDefinition :
+  {
+    declaration : TraitDeclaration,
+    members : [Declaration],
+    implements_ : [InterfaceDeclaration],
+    uses : [TraitDeclaration],
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    requireExtends : [ClassDeclaration],
+    requireImplements : [InterfaceDeclaration],
+    module_ : maybe ModuleMembership,
+    requireClass : maybe [ClassDeclaration],
+  }
+
+# Definition of a Hack enum
+predicate EnumDefinition :
+  {
+    declaration : EnumDeclaration,
+    enumBase: Type,  # deprecated, replaced by TypeInfo
+    enumBaseTypeInfo: maybe TypeInfo,
+    # 'as' type; always nothing for enum classes
+    enumConstraint: maybe Type,
+    enumConstraintTypeInfo: maybe TypeInfo,
+    enumerators : [Enumerator],
+    attributes : [UserAttribute],
+    # uses for normal enums, and extends for enum classes
+    includes : [EnumDeclaration],
+    isEnumClass : bool,
+    module_ : maybe ModuleMembership,
+  }
+
+# Definition of a Hack typedef/alias
+predicate TypedefDefinition :
+  {
+    declaration : TypedefDeclaration,
+    isTransparent : bool,
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    module_ : maybe ModuleMembership,
+  }
+
+# Definition of a Hack method (member function)
+predicate MethodDefinition :
+  {
+    declaration: MethodDeclaration,
+    signature : Signature,
+    visibility : Visibility,
+    isAbstract : bool,
+    isAsync : bool,
+    isFinal : bool,
+    isStatic : bool,
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    isReadonlyThis : maybe bool,
+    readonlyRet : maybe ReadonlyKind,
+  }
+
+# Definition of a Hack property (container member variable)
+predicate PropertyDefinition :
+  {
+    declaration: PropertyDeclaration,
+    type : maybe Type,
+    visibility : Visibility,
+    isFinal : bool,
+    isAbstract : bool,
+    isStatic : bool,
+    attributes : [UserAttribute],
+    typeInfo: maybe TypeInfo
+  }
+
+# Definition of a Hack global (top-level) constant
+predicate GlobalConstDefinition :
+  {
+    declaration : GlobalConstDeclaration,
+    type : maybe Type,
+    value : string,
+    typeInfo: maybe TypeInfo,
+  }
+
+# Definition of a member constant
+predicate ClassConstDefinition :
+  {
+    declaration : ClassConstDeclaration,
+    type : maybe Type,
+    # A none/nothing value indicates an abstract const
+    value : maybe string,
+    typeInfo: maybe TypeInfo
+  }
+
+type TypeConstKind = enum { Abstract | Concrete | PartiallyAbstract }
+
+# Definition of a member type constant
+predicate TypeConstDefinition :
+  {
+    declaration: TypeConstDeclaration,
+    type : maybe Type,
+    kind : TypeConstKind,
+    attributes : [UserAttribute],
+    typeInfo: maybe TypeInfo
+  }
+
+# Definition of a Hack function
+predicate FunctionDefinition :
+  {
+    declaration : FunctionDeclaration,
+    signature : Signature,
+    isAsync : bool,
+    attributes : [UserAttribute],
+    typeParams : [TypeParameter],
+    module_ : maybe ModuleMembership,
+    readonlyRet : maybe ReadonlyKind,
+  }
+
+# Types of definitions in Hack
+type Definition =
+  {
+    class_ : ClassDefinition |
+    classConst : ClassConstDefinition |
+    enum_ : EnumDefinition |
+    function_ : FunctionDefinition |
+    globalConst : GlobalConstDefinition |
+    interface_ : InterfaceDefinition |
+    trait : TraitDefinition |
+    method : MethodDefinition |
+    property_ : PropertyDefinition |
+    typeConst : TypeConstDefinition |
+    typedef_ : TypedefDefinition |
+    module : ModuleDefinition |
+  }
+
+# Occurrences are symbols referenced where the class definition could not
+# be found. Expect the class name to be a special name like
+# HH_FIXME\MISSING_TYPE_IN_HIERARCHY
+predicate MethodOccurrence :
+  {
+    name: Name,
+    className: maybe Name,
+  }
+
+# Where possible we will store references to MethodDefinitions. However
+# if a method is dynamically invoked then we only know the method name
+# not the container so we will store it as an occurrence
+type Occurrence =
+  {
+    method : MethodOccurrence |
+  }
+
+# String literals that occur in expression context, rather than as the
+# definition of a top-level or class constant.  These must be escaped
+# if they are not valid UTF-8.
+predicate StringLiteral : string
+
+# Code that is referenced elsewhere
+type XRefTarget =
+  {
+    declaration : Declaration |
+    occurrence : Occurrence |
+  }
+
+# References to target code
+type XRef =
+  {
+    target : XRefTarget,
+    ranges : [src.RelByteSpan],
+  }
+
+# Cross-references to a target within a file. Note that the bytespan offsets
+# are relative to each other, not the start of the file, for efficiency.
+predicate FileXRefs :
+  {
+    file : src.File,
+    xrefs : set XRef,
+  }
+
+# Context-free information about an expression argument
+type Argument =
+  {
+    lit: StringLiteral |
+    xref: XRefTarget
+  }
+
+# An argument to a particular call.
+type CallArgument =
+  {
+    span: src.RelByteSpan,
+    argument: maybe Argument,
+  }
+
+# Information for all calls, organized by file and callee_span, which
+# should match an entry in FileXRefs.
+# callee_xref points to the called method/function.
+# dispatch_arg represents the implicit argument
+predicate FileCall :
+  {
+    file: src.File,
+    callee_span: src.ByteSpan,
+    call_args: [CallArgument],
+    callee_xref: maybe XRefTarget,  # deprecated in favor of callee_xrefs
+    dispatch_arg: maybe CallArgument,
+    receiver_type: maybe Declaration,
+    callee_xrefs: set XRefTarget,
+  }
+
+# All uses of a declaration in a file. Note that the bytespan offsets are
+# relative to each other, not the start of the file.
+predicate TargetUses :
+  {
+    target : hack.XRefTarget,
+    file : src.File,
+    uses : [src.RelByteSpan],
+  }
+  stored
+  { T, File, Uses } where
+  hack.FileXRefs { file = File, xrefs = XRefs };
+  hack.XRef { target = T, ranges = Uses } = elements XRefs
+
+# A version of 'TargetUses' with the bytespans converted from relative to
+# absolute offset format for convenience.
+predicate TargetUsesAbs :
+  {
+    target : hack.XRefTarget,
+    file : src.File,
+    uses : [src.ByteSpan],
+  }
+  { T, F, prim.relToAbsByteSpans U } where
+  hack.TargetUses { target = T, file = F, uses = U }
+
+predicate DeclarationTarget :
+  {
+    source: Declaration,
+    target: Declaration,
+  }
+
+predicate DeclarationSource :
+  {
+    target: Declaration,
+    source: Declaration,
+  }
+  stored
+  {T, S} where DeclarationTarget {S, T}
+
+# Maps lower-case strings to Name, for case-insensitive search
+predicate NameLowerCase :
+  {
+    nameLowercase : string,
+    name : Name,
+  }
+  stored
+  { prim.toLower Str, N } where N = Name Str
+
+# Definitions that contain an attribute
+predicate AttributeToDefinition :
+  {
+    attribute : UserAttribute,
+    definition : Definition,
+  }
+  stored
+  { AS[..], { class_ = { attributes = AS }}} |
+  { AS[..], { enum_ = { attributes = AS }}} |
+  { AS[..], { function_ = { attributes = AS }}} |
+  { AS[..], { interface_ = { attributes = AS }}} |
+  { AS[..], { trait = { attributes = AS }}} |
+  { AS[..], { method = { attributes = AS }}} |
+  { AS[..], { property_ = { attributes = AS }}} |
+  { AS[..], { typeConst = { attributes = AS }}} |
+  { AS[..], { module = { attributes = AS }}} |
+  { AS[..], { typedef_ = { attributes = AS }}}
+
+predicate AttributeHasParameter :
+  {
+    name : Name,
+    parameter : string,
+    attribute : UserAttribute,
+  }
+  stored
+  { N, PS[..], UserAttribute { N, PS, _ }}
+
+# Declarations within a namespace
+predicate NamespaceMember :
+  {
+    namespace_ : hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  stored
+  { NS, Decl } where DeclarationNamespace { Decl, NS }
+
+predicate DeclarationNamespace :
+  {
+    decl : hack.Declaration,
+    namespace_ : hack.NamespaceQName
+  }
+  { Decl, NS } where
+    Decl : hack.Declaration;
+    (
+      Decl.container?.class_?.name.namespace_.just? = NS
+    ) | (
+      Decl.container?.enum_?.name.namespace_.just? = NS
+    ) | (
+      Decl.container?.interface_?.name.namespace_.just? = NS
+    ) | (
+      Decl.container?.trait?.name.namespace_.just? = NS
+    ) | (
+      Decl.function_?.name.namespace_.just? = NS
+    ) | (
+      Decl.globalConst?.name.namespace_.just? = NS
+    ) | (
+      Decl.namespace_?.name.parent.just? = NS
+    ) | (
+      Decl.typedef_?.name.namespace_.just? = NS
+    )
+
+# Base name for a declaration (no namespace or container prefix)
+predicate DeclarationName : Declaration -> Name
+  D -> N where
+    (
+      D.classConst?.name = N
+    ) | (
+      D.container?.class_?.name.name = N
+    ) | (
+      D.container?.enum_?.name.name = N
+    ) | (
+      D.container?.interface_?.name.name = N
+    ) | (
+      D.container?.trait?.name.name = N
+    ) | (
+      D.enumerator?.name = N
+    ) | (
+      D.function_?.name.name = N
+    ) | (
+      D.globalConst?.name.name = N
+    ) | (
+      D.namespace_?.name.name = N
+    ) | (
+      D.method?.name = N
+    ) | (
+      D.property_?.name = N
+    ) | (
+      D.typeConst?.name = N
+    ) | (
+      D.module?.name = N
+    ) | (
+      D.typedef_?.name.name = N
+    )
+
+predicate ContainerDeclarationQName : ContainerDeclaration -> QName
+  D -> QName where
+    (
+      D.class_?.name = QName
+    ) | (
+      D.enum_?.name = QName
+    ) | (
+      D.interface_?.name = QName
+    ) | (
+      D.trait?.name = QName
+    )
+
+# Container that a given container directly inherits from
+# (via extends, implements, use)
+predicate ContainerParent :
+  {
+    container : hack.ContainerDeclaration,
+    parent : hack.ContainerDeclaration,
+  }
+  stored
+  { Child, Parent } where
+    (
+      hack.ClassDefinition C;
+      C.declaration = Child.class_?;
+      (
+        C.extends_.just? = Parent.class_?;
+      ) | (
+        C.uses[..] = Parent.trait?;
+      ) | (
+        C.implements_[..] = Parent.interface_?;
+      )
+    ) | (
+      hack.TraitDefinition T;
+      T.declaration = Child.trait?;
+      (
+        T.uses[..] = Parent.trait?;
+      ) | (
+        T.implements_[..] = Parent.interface_?;
+      )
+    ) | (
+      hack.InterfaceDefinition I;
+      I.declaration = Child.interface_?;
+      I.extends_[..] = Parent.interface_?;
+    ) | (
+      hack.EnumDefinition E;
+      E.declaration = Child.enum_?;
+      E.includes[..] = Parent.enum_?;
+    )
+
+predicate ContainerChild:
+  {
+    container : hack.ContainerDeclaration,
+    child : hack.ContainerDeclaration,
+  }
+  stored { Parent, Child }
+    where hack.ContainerParent { container=Child, parent=Parent }
+
+# parent module of any declaration
+predicate ModuleParent:
+  {
+    decl: hack.Declaration,
+    module: hack.ModuleDeclaration
+  }
+  { Decl, M.just?.declaration } where
+    (
+      hack.FunctionDefinition D;
+      Decl.function_? = D.declaration;
+      M = D.module_;
+    ) | (
+      hack.TypedefDefinition D;
+      Decl.typedef_? = D.declaration;
+      M = D.module_;
+    ) | (
+      Decl.container? = Container;
+      ( Container.class_? = CDecl;
+        hack.ClassDefinition D;
+        D.declaration = CDecl;
+        D.module_ = M;
+      ) | (
+        Container.enum_? = CDecl;
+        hack.EnumDefinition D;
+        D.declaration = CDecl;
+        D.module_ = M;
+      ) | (
+        Container.interface_? = CDecl;
+        hack.InterfaceDefinition I;
+        I.declaration = CDecl;
+        I.module_ = M;
+      ) | (
+        Container.trait? = CDecl;
+        hack.TraitDefinition T;
+        T.declaration = CDecl;
+        T.module_ = M;
+      )
+    )
+
+# derive children decls that are members of a parent module
+predicate ModuleChild:
+  {
+    module: hack.ModuleDeclaration,
+    decl : hack.Declaration
+  } stored { Module, Decl } where hack.ModuleParent { Decl, Module }
+
+#  Generally, method "derived" overrides "base", if "derived" would have been inherited
+#  in case where "base" wasn't defined.
+#  Note that class methods implementing interface aren't considered as override, but
+#  trait methods can override interface methods.
+predicate MethodOverrides :
+  {
+    derived : MethodDeclaration,
+    base : MethodDeclaration,
+    annotation : maybe bool,
+  }
+
+# hack.MethodsOverrides can look up from derived to base; reverse this
+# here to look up from base to derived
+predicate MethodOverridden :
+  {
+    base : MethodDeclaration,
+    derived : MethodDeclaration,
+    annotation : maybe bool,
+  }
+  stored
+  {Base, Derived, Annotation}
+  where
+    hack.MethodOverrides{
+      derived = Derived,
+      base = Base,
+      annotation = Annotation
+    }
+
+# Maps an attribute to its defining class, and file where the class is defined
+predicate AttributeToDeclaration :
+  {
+    attribute : UserAttribute,
+    declaration : Declaration,
+    file : src.File
+  }
+  stored
+  { Attr, Decl, File } where
+    Attr.name = Decl.container?.class_?.name.name;
+    DeclarationLocation { declaration = Decl, file = File };
+
+    # TODO qname for attributes aren't filled by the indexer yet
+    # See T111862540. Also this should be a stored predicate
+    # In the meantime, we just use the name. It'll work as
+    # attribute names are never qualified in the codebase.
+    # The correct version is below
+    # { qname = { just = Q } } = A;
+    # { container = { class_ = { name = Q } } } = D
+
+# Store arrays of Md5 hashes which characterize indexer inputs.
+# This is used for incremental indexing to avoid regenerating
+# existing facts.
+#
+# Hash is specified by the indexer, roughly defined as
+# md5(filename||symbols_def). It characterizes the "external"
+# symbols within a hack file.
+#
+# The key string is the name of the batch of files used to
+# generate the array.
+#
+# This is experimental and may change in the future
+predicate IndexerInputsHash : string -> [byte]
+
+# Generated from `auto_namespace_map` in .hhconfig
+predicate GlobalNamespaceAlias : { from: Name, to: NamespaceQName }
+
+predicate HackToThrift:
+  {
+    from: hack.Declaration,
+    to: fbthrift.Declaration
+  }
+
+predicate ThriftToHack:
+  {
+    to: fbthrift.Declaration,
+    from: hack.Declaration
+  }
+  stored { To, From }
+    where hack.HackToThrift { From, To }
+
+#
+# kind-oriented search. We have one table for string to decl for each kind,
+# and one table of lowercase name to normal name for each kind. the keys to the
+# decl form are always the local namestr and parent scope.
+#
+# no more searching through all hack.Name facts.
+#
+
+predicate SearchClassConstByName:
+  {
+    name: string,
+    parent: QName, # parent container
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.ClassConstDeclaration { Name NameStr, C };
+    ContainerDeclarationQName C -> Parent;
+    { classConst = D } = Decl
+
+predicate SearchClassConstByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.ClassConstDeclaration { name = Name NameStr }
+
+predicate SearchEnumeratorByName:
+  {
+    name: string,
+    parent: QName, # parent container
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.Enumerator { Name NameStr, { name = Parent } };
+    { enumerator = D } = Decl
+
+predicate SearchEnumeratorByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.Enumerator { name = Name NameStr }
+
+predicate SearchMethodByName:
+  {
+    name: string,
+    parent: QName, # parent container
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.MethodDeclaration { Name NameStr, C };
+    ContainerDeclarationQName C -> Parent;
+    { method = D } = Decl
+
+predicate SearchMethodByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.MethodDeclaration { name = Name NameStr }
+
+predicate SearchPropertyByName:
+  {
+    name: string,
+    parent: QName, # parent container
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.PropertyDeclaration { Name NameStr, C };
+    ContainerDeclarationQName C -> Parent;
+    { property_ = D } = Decl
+
+predicate SearchPropertyByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.PropertyDeclaration { name = Name NameStr }
+
+predicate SearchTypeConstByName:
+  {
+    name: string,
+    parent: QName, # parent container
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.TypeConstDeclaration { Name NameStr, C };
+    ContainerDeclarationQName C -> Parent;
+    { typeConst = D } = Decl
+
+predicate SearchTypeConstByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.TypeConstDeclaration { name = Name NameStr }
+
+predicate SearchModuleByName:
+  {
+    name: string,
+    decl: hack.Declaration
+  } stored { NameStr, Decl } where
+    D = hack.ModuleDeclaration { name = Name NameStr };
+    { module = D } = Decl
+
+predicate SearchModuleByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.ModuleDeclaration { name = Name NameStr }
+
+predicate SearchClassByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.ClassDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { container = { class_ = D } } = Decl
+
+predicate SearchClassByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.ClassDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchInterfaceByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.InterfaceDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { container = { interface_ = D } } = Decl
+
+predicate SearchInterfaceByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.InterfaceDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchTraitByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.TraitDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { container = { trait = D } } = Decl
+
+predicate SearchTraitByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.TraitDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchEnumByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.EnumDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { container = { enum_ = D } } = Decl
+
+predicate SearchEnumByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.EnumDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchFunctionByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.FunctionDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { function_ = D } = Decl
+
+predicate SearchFunctionByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.FunctionDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchGlobalConstByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.GlobalConstDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { globalConst = D } = Decl
+
+predicate SearchGlobalConstByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.GlobalConstDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchTypedefByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.TypedefDeclaration { name = QName };
+    { Name NameStr, Parent } = QName;
+    { typedef_ = D } = Decl
+
+predicate SearchTypedefByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.TypedefDeclaration { name = QName };
+    { name = Name NameStr } = QName
+
+predicate SearchNamespaceByName:
+  {
+    name: string,
+    parent: maybe NamespaceQName,
+    decl: hack.Declaration
+  } stored { NameStr, Parent, Decl } where
+    D = hack.NamespaceDeclaration { name = NSQName };
+    { Name NameStr, Parent } = NSQName;
+    { namespace_ = D } = Decl
+
+predicate SearchNamespaceByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    hack.NamespaceDeclaration { name = NSQName };
+    { name = Name NameStr } = NSQName
+
+} # end hack.angle
diff --git a/glean/schema/source/hs.angle b/glean/schema/source/hs.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/hs.angle
@@ -0,0 +1,336 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema hs.3 {
+import src
+
+predicate ModuleName : string
+
+type Namespace = enum { var_ | datacon | tyvar | tycon }
+
+predicate UnitName : string
+
+predicate Module:
+  {
+    name: ModuleName,
+    unit: UnitName,
+  }
+
+predicate ModuleSource:
+  {
+    mod: Module,
+    file: src.File,
+  }
+
+predicate SourceModule:
+  {
+    file: src.File,
+    mod: Module,
+  }
+  stored { File, Mod } where ModuleSource { Mod, File }
+
+predicate OccName:
+  {
+    name: string,
+    namespace_: Namespace,
+  }
+
+type NameSort =
+  {
+    external: {} |
+      # An exported entity, uniquely identified by its OccName and Module.
+    internal: src.ByteSpan |
+      # A local binder, e.g. bound by a pattern-match, let. or where,
+      # or a non-exported entity. These are uniquely identified by
+      # the OccName, Module and ByteSpan.
+  }
+
+# Name: a unique key for an entity
+predicate Name:
+  {
+    occ: OccName,
+    mod: Module,
+    sort: NameSort,
+  }
+
+# Types
+
+type TupleSort = enum { boxed | unboxed | constraint }
+
+type TyConSort =
+  {
+    normal: {} |
+    tuple: { arity: nat, sort: TupleSort } |
+    sum: { arity: nat } |
+    equality: {} |
+  }
+
+predicate TyCon:
+  {
+    name: Name,
+    sort: TyConSort,
+    promoted: bool,
+  }
+
+type ArgFlag =
+  {
+    invisible: Specificity |
+    requird: {}
+  }
+
+type Specificity = enum { inferred | specified }
+
+predicate LitType:
+  {
+    num: nat |
+    str: string |
+    chr: nat |
+  }
+
+type TypeArg =
+  {
+    visible: bool,
+    ty: Type,
+  }
+
+type TyVar = string
+
+# Type variables
+#
+# In HieType a type variable is a Name. But these are always internal
+# names, and they don't have a binding SrcSpan so we can't use sort =
+# { internal = { span = .. }}. I considered adding a new NameSort: {
+# unique: string }, but we don't really want to index uniques (they're
+# too non-deterministic). Interestingly, when a HieType is rendered,
+# we convert to IfaceType and we use only the OccName of the tyvars,
+# discarding the uniques. This is probably wrong, strictly speaking,
+# because there could be name clashes, but using a string here leaves
+# room to rename the tyvars to disambiguate later.
+
+predicate Type:
+  {
+    tyvar: TyVar |
+    app: { fun: Type, args_: [TypeArg] } |
+    tyconapp: { tycon: TyCon, args_: [TypeArg] } |
+    forall: { name: TyVar, kind: Type, flag: ArgFlag, inner: Type } |
+    fun: { mult: Type, arg: Type, res: Type } |
+    qual: { pred: Type, res: Type } |
+    lit: LitType |
+    cast: Type |
+    coercion: {}
+  }
+
+# Declarations / definitions
+
+# A declaration, which may or may not define a Name.
+type Declaration =
+  {
+    val: ValBind |
+    typeFamily: TypeFamilyDecl |
+    type_: TypeSynDecl |
+    data: DataDecl |
+    con: ConstrDecl |
+    patSyn: PatSynDecl |
+    class_: ClassDecl |
+    method: MethDecl |
+    instance: InstDecl |
+    patBind: PatBind |
+    tyVarBind: TyVarBind |
+    field: RecordFieldDecl |
+    sig: SigDecl |
+  }
+
+# Go from a Name to its definition, or vice versa.
+predicate DeclarationOfName:
+  {
+    name: Name,
+    decl: Declaration,
+  }
+  { N, { val = { name = N }}} |
+  { N, { typeFamily = { name = N }}} |
+  { N, { type_ = { name = N }}} |
+  { N, { data = { name = N }}} |
+  { N, { con = { name = N }}} |
+  { N, { patSyn = { name = N }}} |
+  { N, { class_ = { name = N }}} |
+  { N, { method = { name = N }}} |
+  { N, { patBind = { name = N }}} |
+  { N, { tyVarBind = { name = N }}} |
+  { N, { field = { name = N }}}
+
+predicate ValBind:
+  {
+    name: Name,
+    ty: maybe Type,
+    # fixity
+    sig: maybe SigDecl
+  }
+
+predicate InstanceBind:
+  {
+    name: Name,
+    # ty: maybe Type,
+    loc: src.FileLocation,
+  }
+
+# Maps an InstanceBind back to its containing decl
+predicate InstanceBindToDecl:
+  {
+    bind: InstanceBind,
+    decl: { inst: InstDecl | class_: ClassDecl }
+  }
+
+predicate SigDecl:
+  {
+    name: Name,
+    loc: src.FileLocation,
+  }
+
+predicate TypeFamilyDecl:
+  {
+    name: Name,
+  }
+
+predicate TypeSynDecl:
+  {
+    name: Name,
+  }
+
+predicate DataDecl:
+  {
+    name: Name,
+    constrs: [ConstrDecl]
+  }
+
+predicate ConstrDecl:
+  {
+    name: Name,
+    data_: Name,  # the Name of the DataDecl
+    fields: [RecordFieldDecl],  # empty if this is not a record
+  }
+
+predicate PatSynDecl:
+  {
+    name: Name,
+  }
+
+predicate ClassDecl:
+  {
+    name: Name,
+    methods: [MethDecl],
+    # superclass constraints
+    defaults: [InstanceBind],
+    # associated types / datatypes
+    # associated type defaults
+  }
+
+predicate MethDecl:
+  {
+    name: Name,
+    class_: Name,
+    # type
+    # default decl
+  }
+
+predicate InstDecl:
+  {
+    # class
+    # parameters etc.
+    methods: [InstanceBind],
+    loc: src.FileLocation,
+  }
+
+predicate PatBind:
+  {
+    name: Name,
+    ty: maybe Type,
+  }
+
+predicate TyVarBind:
+  {
+    name: Name,
+  }
+
+predicate RecordFieldDecl:
+  {
+    name: Name,
+    con: Name,
+    # type
+  }
+
+# From a Name to the location of its defining declaration
+predicate DeclarationLocation:
+  {
+    name: Name,
+    file: src.File,
+    span: src.ByteSpan
+  }
+
+# From a Declaration to its location
+predicate DeclarationSpan:
+  {
+    decl: Declaration,
+    loc: src.FileLocation,
+  }
+  { Decl, Loc } where
+    # it's either a definition, or it has a location
+    (
+      DeclarationOfName { Name, Decl };
+      DeclarationLocation { Name, File, Span };
+      Loc = { File, Span };
+    ) | (
+      Decl.sig?.loc = Loc;
+    )
+
+predicate ModuleDeclarations:
+  {
+    module: Module,
+    names: set Name,
+    # TODO: decls: [Declaration],
+    exports: set Name,
+  }
+
+# References
+
+type RefSpan =
+  {
+    kind: RefKind,
+    span: src.ByteSpan,
+  }
+
+# It's useful to be able to distinguish import/export refs from code refs,
+# because e.g. dead code can still have import/export refs.
+type RefKind = enum { importref | exportref | coderef | tydecl | instbind }
+
+type RefTarget =
+  {
+    name: Name |
+    modName: ModuleName |
+    # We would much prefer Module for the xref from an import
+    # declaration, but the HieAST only provides ModuleName. We'll try
+    # to resolve this to a Module in the codemarkup layer later.
+  }
+
+# Note that references are indexed by Name, so this supports
+# find-references. Go-to-def is provided by FileXRefs, which gives all
+# the references for a file.
+predicate XRef:
+  {
+    target: RefTarget,
+    file: src.File,
+    refs: [RefSpan],
+  }
+
+predicate FileXRefs :
+  {
+    file : src.File,
+    xrefs : [XRef],
+  }
+
+predicate OccNameLowerCase:
+  {
+    nameLowerCase: string,
+    occName: OccName,
+  }
+  stored { prim.toLower Str, N } where N = OccName { name = Str }
+
+}
diff --git a/glean/schema/source/indexer.angle b/glean/schema/source/indexer.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/indexer.angle
@@ -0,0 +1,8 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema indexer.1 {
+
+# Records configuration metadata for the indexer(s) that produced a DB
+predicate Config: string -> string
+
+}
diff --git a/glean/schema/source/java.alpha.angle b/glean/schema/source/java.alpha.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/java.alpha.angle
@@ -0,0 +1,666 @@
+#
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+#
+#
+# Schema for Java that interops with Kotlin.
+# Intentionally a breaking change from java.6
+#
+schema java.alpha.1 {
+  import src
+  import javakotlin.alpha
+
+type Modifier =
+  enum {
+    abstract_ |
+    default_ |
+    final_ |
+    native_ |
+    private_ |
+    protected_ |
+    public_ |
+    static_ |
+    strictfp_ |
+    synchronized_ |
+    transient_ |
+    volatile_ |
+  }
+
+predicate PrimitiveType :
+  {
+    type : string,
+  }
+
+predicate TypeVar :
+  {
+    type : javakotlin.alpha.Name,
+    span : src.ByteSpan,
+  }
+
+predicate ObjectType :
+  {
+    type : javakotlin.alpha.QName,
+    span : src.ByteSpan,
+  }
+
+predicate ArrayType :
+  {
+    contents : Type,
+    span : src.ByteSpan,
+  }
+
+# Giving a type structure
+type BaseType =
+  {
+    object : ObjectType |
+    primitive : PrimitiveType |
+    variable : TypeVar |
+    array : ArrayType |
+  }
+
+predicate Type :
+  {
+    baseType : BaseType,
+    typeArgs : [TypeArg],
+    interopType : javakotlin.alpha.Type,
+    span : src.ByteSpan,
+  }
+
+predicate TypeArg :
+  {
+    type: Type |
+    wildcard: Wildcard |
+  }
+
+# https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.5.1
+type Wildcard =
+  {
+    extends_: Type |
+    super_: Type |
+    unbounded: bool |
+  }
+
+predicate TypeParam :
+  {
+    name: javakotlin.alpha.Name,
+    extends_: [Type],
+    span : src.ByteSpan,
+  }
+
+predicate Annotation :
+  {
+    name : javakotlin.alpha.QName,
+    constructor : javakotlin.alpha.MethodName,
+    constant : maybe string,
+    span : src.ByteSpan,
+  }
+
+predicate ParameterDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    type: Type,
+    annotations: [Annotation],
+    modifier : [Modifier],
+    span : src.ByteSpan,
+  }
+
+# A local variable, not parameter
+predicate LocalDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    type: Type,
+    annotations : [Annotation],
+    # Maybe get a restricted set here
+    modifier : [Modifier],
+    container : ExecutableDefinition,
+    span : src.ByteSpan,
+  }
+
+predicate FieldDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    type : Type,
+    annotations : [Annotation],
+    modifiers : [Modifier],
+    container : Definition,
+    span : src.ByteSpan,
+  }
+
+# Will add a type combining Local and Field later
+
+# A constructor declaration
+predicate ConstructorDeclaration :
+  {
+    name: javakotlin.alpha.MethodName,
+    parameters : [ParameterDeclaration],
+    annotations : [Annotation],
+    modifiers : [Modifier],
+    typeParams: [TypeParam],
+    throws_ : [Type],
+    container : Definition,
+    span : src.ByteSpan,
+  }
+
+# A method declaration
+predicate MethodDeclaration :
+  {
+    name : javakotlin.alpha.MethodName,
+    parameters : [ParameterDeclaration],
+    returnType : Type,
+    annotations : [Annotation],
+    modifiers : [Modifier],
+    typeParams: [TypeParam],
+    throws_ : [Type],
+    container : Definition,
+    span : src.ByteSpan,
+  }
+
+# An interface declaration
+predicate InterfaceDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    annotations : [Annotation],
+    modifiers : [Modifier],
+    extends_ : [Type],
+    container : maybe Definition,
+    typeParams: [TypeParam],
+    span : src.ByteSpan,
+    file : src.File,
+  }
+
+# A class declaration
+predicate ClassDeclaration :
+  {
+    name : javakotlin.alpha.QName,
+    modifiers : [Modifier],
+    extends_ : maybe Type,
+    implements_ : [Type],
+    annotations : [Annotation],
+    container : maybe Definition,
+    typeParams: [TypeParam],
+    span : src.ByteSpan,
+    file : src.File,
+  }
+
+predicate EnumDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    annotations : [Annotation],
+    modifiers : [Modifier],
+    implements_ : [Type],
+    container : maybe Definition,
+    span : src.ByteSpan,
+    file : src.File,
+  }
+
+# just container definitions
+type Definition =
+  {
+    class_ : ClassDeclaration |
+    interface_ : InterfaceDeclaration |
+    enum_ : EnumDeclaration |
+  }
+
+type ExecutableDefinition =
+  {
+    constructor : ConstructorDeclaration |
+    method : MethodDeclaration |
+  }
+
+# helper for unwrapping the container Definition type
+predicate DeclOfDefn:
+  {
+    defn: Definition,
+    decl: Declaration
+  }
+  { Defn, Decl } where
+    ( { class_ = CDecl } = Defn; { class_ = CDecl } = Decl ) |
+    ( { enum_ = CDecl } = Defn; { enum_ = CDecl } = Decl ) |
+    ( { interface_ = CDecl } = Defn; { interface_ = CDecl } = Decl );
+
+# helper for unwrapping the container ExecutableDefinition type
+predicate DeclOfExecutableDefn:
+  {
+    defn: ExecutableDefinition,
+    decl: Declaration
+  }
+  { Defn, Decl } where
+    ( { constructor = CDecl } = Defn; { ctor = CDecl } = Decl ) |
+    ( { method = MDecl } = Defn; { method = MDecl } = Decl );
+
+# An import, whether specific, an entire package, or static
+predicate ImportDeclaration :
+  {
+    name : javakotlin.alpha.Name,
+    import_on_demand : bool,
+    static_member : maybe string,
+    path : javakotlin.alpha.Path,
+    location: src.ByteSpan,
+  }
+
+# The package specification for a file
+predicate PackageDeclaration :
+  {
+    name : javakotlin.alpha.Name,
+    annotation: [Annotation],
+    # Path is not required in a package
+    path : maybe javakotlin.alpha.Path,
+    location : src.ByteSpan,
+  }
+
+#
+# Handling xrefs and uses
+#
+
+# Code that is referenced elsewhere, including by an import
+# Note: params and locals aren't yet xref-able
+# These are the unique QName/MethodName compoennt of a Declaration.
+type XRefTarget =
+  {
+    definition_: javakotlin.alpha.QName |
+    ctor_: javakotlin.alpha.MethodName |
+    method_: javakotlin.alpha.MethodName |
+    field_: javakotlin.alpha.QName |
+  }
+
+# Lookup the xref entity by its qname and kind
+predicate XRefTargetDeclaration:
+  {
+    xref: XRefTarget,
+    decl : Declaration
+  }
+  { XRef, Decl } where
+    ( { definition_ = QName } = XRef;
+      QNameToDefinition { QName, Decl }
+    ) | (
+      { ctor_ = MName } = XRef;
+      CDecl = ConstructorDeclaration { name = MName };
+      { ctor = CDecl } = Decl
+    ) | (
+      { method_ = MName } = XRef;
+      MDecl = MethodDeclaration { name = MName };
+      { method = MDecl } = Decl
+    ) | (
+      { field_ = QName } = XRef;
+      FDecl = FieldDeclaration { name = QName };
+      { field = FDecl } = Decl
+    )
+
+# Given a declaration extract its XRefTarget key
+# Reverses the XRefTargetDeclaration mapping
+predicate DeclarationXRefTarget:
+  {
+    decl : Declaration,
+    xref: XRefTarget
+  }
+  { Decl, XRef } where
+    ( { field = { name = QName }} = Decl;
+      { field_ = QName } = XRef ) |
+    ( { ctor = { name = MName } } = Decl;
+      { ctor_ = MName } = XRef ) |
+    ( { method = { name = MName }  } = Decl;
+      { method_ = MName } = XRef ) |
+    ( { interface_ = { name = QName } } = Decl;
+      { definition_ = QName } = XRef ) |
+    ( { enum_ = { name = QName } } = Decl;
+      { definition_ = QName } = XRef ) |
+    ( { class_ = { name = QName } } = Decl;
+      { definition_ = QName } = XRef );
+
+predicate QNameToDefinition:
+  {
+    name : javakotlin.alpha.QName,
+    defn : java.alpha.Declaration
+  }
+  { QName, Decl } where
+    ( CDecl = ClassDeclaration { name = QName };
+      { class_ = CDecl } = Decl
+    ) | (
+      IDecl = InterfaceDeclaration { name = QName };
+      { interface_ = IDecl } = Decl
+    ) | (
+      EDecl = EnumDeclaration { name = QName };
+      { enum_ = EDecl } = Decl
+    );
+
+# References to target code
+predicate XRef :
+  {
+    target: XRefTarget,
+    ranges: [src.ByteSpan],
+  }
+
+# Cross-references to a target within a file
+predicate FileXRefs :
+  {
+    file : src.File,
+    xrefs : [XRef],
+  }
+
+predicate XRefFile :
+  {
+    xref: XRef,
+    file: src.File,
+  }
+    stored {Xref, File} where
+      FileXRefs {file = File, xrefs = Xs};
+      Xref = Xs[..];
+
+#
+# Extracting xref uses and targets from type signature components
+#
+predicate XRefOfType:
+  {
+    type: Type,
+    decl: Declaration,
+    use: src.ByteSpan,
+  }
+  { Type, Decl, Span } where
+    { baseType = Base, typeArgs = _ } = Type;
+    { object = ObjType } = Base;
+    { type = QName , span = Span } = ObjType;
+    QNameToDefinition { QName, Decl }
+
+# If you have a Type, it may also have types contained.
+# Extract all the types in a typeArgs
+predicate TypeOfTypeArgs:
+  {
+    typeWithArgs : Type,
+    type: Type
+  }
+  { TypeWithArgs, Type } where
+     { typeArgs = Tys } = TypeWithArgs;
+     ArgTy = Tys[..];
+     ( { type = Type } = ArgTy ) |
+       ( { wildcard = Wild } = ArgTy;
+       ( { extends_ = Type } ) | ( { super_ = Type } ) = Wild;
+     );
+
+#
+# Extract type components of declarations. These are all uses (i.e. xrefs)
+#
+predicate DeclarationType:
+  {
+    decl: Declaration,
+    type: Type
+  }
+  { Decl, Type } where
+    ( { param = PDecl } = Decl;
+      { type = Ty } = PDecl;
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } )
+    ) | (
+      { local = LDecl } = Decl;
+      { type = Ty } = LDecl;
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } )
+    ) | (
+      { field = FDecl } = Decl;
+      { type = Ty } = FDecl;
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } )
+    ) | (
+      { ctor = CDecl } = Decl;
+      { parameters = PDecls, throws_ = TTypes } = CDecl;
+      Ty = ( { type = T } = PDecls[..]; T ) | ( T = TTypes[..]; T );
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } );
+    ) | (
+      { method = MDecl } = Decl;
+      { parameters = PDecls, returnType = RType, throws_ = TTypes } = MDecl;
+      Ty = ( { type = T } = PDecls[..]; T) | ( RType ) | ( T = TTypes[..]; T );
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } );
+    ) | (
+      { interface_ = IDecl } = Decl;
+      { extends_ = Types } = IDecl;
+      Ty = Types[..];
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } );
+    ) | (
+      { class_ = CDecl } = Decl;
+      { extends_ =  { just = ETy }, implements_ = ITys } = CDecl;
+      Ty = ( ETy ) | ( ITys[..] );
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } );
+    ) | (
+      { enum_ = EDecl } = Decl;
+      { implements_ = ITys } = EDecl;
+      Ty = ITys[..];
+      ( Ty = Type ) | ( TypeOfTypeArgs { Ty, Type } );
+    );
+
+# Uses
+predicate DeclarationUses :
+  {
+    target : Declaration,
+    file : src.File,
+    uses : [src.ByteSpan],
+  }
+  { Decl, File, Spans } where
+    DeclarationXRefTarget { Decl, XRefTarget };
+    XRef = XRef { XRefTarget, Spans }; # all xrefs that mention this target
+    XRefFile { XRef, File };
+
+predicate AnnotatedClass :
+  {
+    annotation : Annotation,
+    class_ : ClassDeclaration,
+  } stored { Annotation, Class_ } where
+      Class_ = ClassDeclaration { annotations = As };
+      Annotation = As[..]
+
+# base type has subclass
+predicate Inheritance :
+  {
+    base: Type,
+    subclass: ClassDeclaration,
+  }
+  stored { Base, Subclass } where
+    Subclass = ClassDeclaration { extends_ = { just = Base } }
+
+# interface type has these implemented classes
+predicate InterfaceInheritance :
+  {
+    interface_name: Type,
+    subclass: ClassDeclaration,
+  }
+  stored { InterfaceName, Subclass } where
+    Subclass = ClassDeclaration { implements_ = Implements_ };
+    InterfaceName = Implements_[..];
+
+# generic scope "contains" relationship.
+# e.g. a class contains methods or inner clases
+predicate ContainsDeclaration:
+  {
+    container: Declaration,
+    member: Declaration
+  } stored { Container, Member } where
+    ( { method = { container = Defn } } ) |
+    ( { ctor = { container = Defn } } ) |
+    ( { field = { container = Defn } } ) |
+    ( { interface_ = { container = { just = Defn } } } ) |
+    ( { enum_ = { container = { just = Defn } } } ) |
+    ( { class_ = { container = { just = Defn } } } ) = Member;
+    DeclOfDefn { Defn, Container }
+
+#
+# codemarkup/glass APIs
+#
+
+# All entities that we expose to navigation or search
+type Declaration =
+  {
+    param : ParameterDeclaration |
+    local : LocalDeclaration |
+    field : FieldDeclaration |
+    ctor : ConstructorDeclaration |
+    method : MethodDeclaration |
+    interface_ : InterfaceDeclaration |
+    class_ : ClassDeclaration |
+    enum_ : EnumDeclaration
+  }
+
+predicate DeclarationAnnotations:
+  {
+    decl : java.alpha.Declaration,
+    annotations : [Annotation]
+  }
+  { Decl, Anns } where
+    ( { param = PDecl } = Decl; { annotations = Anns } = PDecl ) |
+    ( { local = LDecl } = Decl; { annotations = Anns } = LDecl ) |
+    ( { field = FDecl } = Decl; { annotations = Anns } = FDecl ) |
+    ( { ctor = CDecl } = Decl; { annotations = Anns } = CDecl ) |
+    ( { method = MDecl } = Decl; { annotations = Anns } = MDecl ) |
+    ( { interface_ = IDecl } = Decl; { annotations = Anns } = IDecl ) |
+    ( { class_ = CDecl } = Decl; { annotations = Anns } = CDecl ) |
+    ( { enum_ = EDecl } = Decl; { annotations = Anns } = EDecl );
+
+predicate DefinitionLocation:
+  {
+    defn : Definition,
+    name : string,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { Defn, NameStr, File, Span } where
+    ( { interface_ = IDecl } = Defn;
+      { name = QName, span = Span, file = File } = IDecl;
+    ) | (
+      { class_ = CDecl } = Defn;
+      { name = QName, span = Span, file = File } = CDecl;
+    ) | (
+      { enum_ = EDecl } = Defn;
+      { name = QName, span = Span, file = File } = EDecl;
+    );
+    { name = javakotlin.alpha.Name NameStr } = QName;
+
+# Comment(s) that appears at the first of a Declaration
+predicate DeclarationComment:
+  {
+    declaration : Declaration,
+    file : src.File,
+    span : src.ByteSpan,
+  }
+
+predicate DeclarationLocation:
+  {
+    decl : Declaration,
+    name : string,
+    file : src.File,
+    span : src.ByteSpan,
+  } { Decl, NameStr, File, Span } where
+    ( (
+        { interface_ = IDecl } = Decl;
+        DefinitionLocation { { interface_ = IDecl }, NameStr, File, Span }
+      ) | (
+        { class_ = CDecl } = Decl;
+        DefinitionLocation { { class_ = CDecl }, NameStr, File, Span }
+      ) | (
+        { enum_ = EDecl } = Decl;
+        DefinitionLocation { { enum_ = EDecl }, NameStr, File, Span }
+      )
+    ) | (
+      ( { method = MDecl } = Decl;
+        Defn = ExecutableDefinition { method = MDecl };
+      ) | (
+        { ctor = CDecl } = Decl;
+        Defn = ExecutableDefinition { constructor = CDecl };
+      );
+      ExecutableDefnLocation { Defn, NameStr, File, Span }
+
+    ) | (
+      { local = LDecl } = Decl;
+      { name = QName, container = EDefn, span = Span } = LDecl;
+      { name = javakotlin.alpha.Name NameStr } = QName;
+      ExecutableDefnLocation { defn = EDefn, file = File }
+    ) | (
+      { field = FDecl } = Decl;
+      { name = QName, container = Defn, span = Span } = FDecl;
+      { name = javakotlin.alpha.Name NameStr } = QName;
+      DefinitionLocation { defn = Defn, file = File }
+    )
+
+# src.File of a method or constructor is the src.File of its parent container
+predicate ExecutableDefnLocation:
+  {
+    defn : ExecutableDefinition,
+    name : string,
+    file : src.File,
+    span : src.ByteSpan
+  }
+  { EDefn, NameStr, File, Span } where
+    ( { method = MDecl } = EDefn;
+      { name = MName, span = Span, container = Defn } = MDecl;
+    ) | (
+      { constructor = CDecl } = EDefn;
+      { name = MName, span = Span, container = Defn } = CDecl;
+    );
+    DefinitionLocation { defn = Defn, file = File };
+    javakotlin.alpha.MethodName { name = QName } = MName;
+    { name = javakotlin.alpha.Name NameStr } = QName
+
+# decls keyed by file (i.e. file entities)
+predicate FileDeclarations:
+  {
+    file : src.File,
+    decl : Declaration
+  } stored { File, Decl } where DeclarationLocation { decl = Decl, file = File }
+
+#
+# container relationships
+#
+
+# Container parent (by scope)
+predicate ParentDeclaration:
+  {
+    child: Declaration,
+    parent: Declaration
+  }
+  { Child, Parent } where
+    # can't do param parents yet
+    ( { local = LDecl } = Child;
+      { container = Defn } = LDecl;
+      DeclOfExecutableDefn { Defn, Parent }
+    ) | (
+      ( ( { field = FDecl } = Child; { container = Defn } = FDecl ) |
+        ( { ctor = CDecl } = Child; { container = Defn } = CDecl ) |
+        ( { method = MDecl } = Child; { container = Defn } = MDecl ) |
+        ( { class_ = CDecl } = Child; { container = { just = Defn }} = CDecl) |
+        ( { enum_ = CDecl } = Child; { container = { just = Defn }} = CDecl ) |
+        ( { interface_ = CDecl} = Child; { container = { just = Defn}} = CDecl);
+      );
+      DeclOfDefn { Defn, Parent }
+    )
+
+# extends parent (by inheritance)
+predicate ExtendsDeclaration:
+  {
+    child: Declaration,
+    parent: Declaration
+  }
+  { Child, Parent } where
+    ( { class_ = CDecl } = Child;
+      ( { extends_ = { just = T } } = CDecl ) |
+      ( { implements_ = Ts } = CDecl; T = Ts[..]);
+    ) | (
+      { interface_ = IDecl } = Child;
+      ( { extends_ = Ts } = IDecl; T = Ts[..]);
+    ) | (
+      { enum_ = EDecl } = Child;
+      ( { implements_ = Ts } = EDecl; T = Ts[..]);
+    );
+    Type { baseType = { object = { type = QName } } } = T;
+    QNameToDefinition { QName, Parent }
+
+# extended by child (inheritance)
+predicate ExtendedByDeclaration:
+  {
+    parent: Declaration,
+    child: Declaration
+  }
+  { Parent, Child } where
+    ( { class_ = { name = QName } } = Parent;
+    ) | (
+      { interface_ = { name = QName } } = Parent;
+    ) | (
+      { enum_ = { name = QName } } = Parent;
+    );
+    T = Type { baseType = { object = { type = QName } } };
+    Inheritance { base = T, subclass = CDecl } |
+    InterfaceInheritance { interface_name = T, subclass = CDecl };
+    { class_ = CDecl } = Child
+
+} # schema
diff --git a/glean/schema/source/javakotlin.angle b/glean/schema/source/javakotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/javakotlin.angle
@@ -0,0 +1,41 @@
+
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+#
+# common predicates between java and kotlin used for interoperability
+#
+schema javakotlin.alpha.1 {
+
+import src
+
+predicate Name : string
+
+# Lower case normalized names (for case-insensive search)
+predicate NameLowerCase:
+  {
+    nameLowercase : string,
+    name : Name,
+  } stored { prim.toLower Str, N } where N = Name Str
+
+predicate Path : {
+  base : Name,
+  container : maybe Path,
+}
+
+predicate Type : {
+  primitive: string |
+  object: Path |
+  array: Type |
+}
+
+predicate QName : {
+  name: Name,
+  context: Path,
+}
+
+predicate MethodName : {
+  name: QName,
+  signature: [Type]
+}
+
+}
diff --git a/glean/schema/source/kotlin.angle b/glean/schema/source/kotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/kotlin.angle
@@ -0,0 +1,166 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+# common predicates between java and kotlin used for interopobility
+schema kotlin.alpha.2 {
+  import javakotlin.alpha
+  import src
+
+predicate DeclarationLocation :
+  {
+    file : src.File,
+    span : src.ByteSpan
+  }
+
+predicate Type :
+  {
+    type : javakotlin.alpha.Type,
+    location : maybe DeclarationLocation,
+    typeArgs: [TypeArg],
+    isNullable: bool
+  }
+
+predicate TypeArg:
+  {
+    type: Type
+  }
+
+  # A variable declaration
+predicate VariableDeclaration :
+  {
+    name: javakotlin.alpha.QName,
+    type : Type,
+    location : DeclarationLocation,
+  }
+
+# A method declaration
+predicate MethodDeclaration :
+  {
+    name : javakotlin.alpha.MethodName,
+    parameters : [VariableDeclaration],
+    returnType : maybe Type,
+    loc : src.Loc, # deprecated. unused
+    location: maybe DeclarationLocation,
+    container: maybe Declaration
+  }
+
+predicate ClassDeclaration :
+  {
+    name : javakotlin.alpha.QName,
+    implements_ : [javakotlin.alpha.QName],
+    location : DeclarationLocation,
+  }
+
+# Parent of variables that are methods. I.e. method contains the variable
+predicate VariableParent:
+  {
+    child: VariableDeclaration,
+    parent: MethodDeclaration,
+  } stored { Child, Parent } where
+    Parent = MethodDeclaration { parameters = Ps };
+    Child = Ps[..];
+
+# Inverse table of method members of classes
+predicate ClassMember:
+  {
+    parent: ClassDeclaration,
+    child: MethodDeclaration
+  } stored { Parent, Child } where
+    Child = MethodDeclaration { container = { just = { class_ = Parent } } }
+
+# The type of Kotlin symbol entities
+type Declaration =
+  {
+    class_ : ClassDeclaration |
+    method : MethodDeclaration |
+    variable : VariableDeclaration |
+  }
+
+#
+# Re-indexing by file for codemarkup use
+#
+
+predicate FileDeclarations:
+  {
+    file: src.File,
+    decl: Declaration
+  } stored { File, Decl } where
+    ( CDecl = ClassDeclaration { location = Loc };
+      { class_ = CDecl }  = Decl;
+    ) | (
+      VDecl = VariableDeclaration { location = Loc };
+      { variable = VDecl } = Decl;
+    ) | (
+      MDecl = MethodDeclaration { location = { just = Loc } };
+     { method = MDecl } = Decl;
+    );
+    { file = File } = Loc;
+
+predicate DeclarationFileLocation:
+  {
+    decl: Declaration,
+    file: src.File,
+    span: src.ByteSpan,
+    name: string,
+  }
+  { Decl, File, Span, NameStr } where
+    ( { class_ = CDecl }  = Decl;
+      ClassDeclaration { location = Location, name = QName } = CDecl;
+    ) | (
+      { variable = VDecl } = Decl;
+      VariableDeclaration { location = Location, name = QName } = VDecl;
+    ) | (
+      { method = MDecl } = Decl;
+      MethodDeclaration { location = { just = Location }, name = MName} = MDecl;
+      { name = QName } = MName;
+    );
+    { File, Span } = Location;
+    { name = javakotlin.alpha.Name NameStr } = QName
+
+# entity relationships
+
+# Container parent (by scope)
+predicate ParentDeclaration:
+  {
+    child: Declaration,
+    parent: Declaration
+  }
+  { Child, Parent } where
+    ( { method = MDecl } = Child;
+      { container = { just = Parent } } = MDecl
+    ) | (
+      { variable = VDecl } = Child;
+      VariableParent { VDecl, MDecl };
+      { method = MDecl } = Parent
+    )
+
+# Inverse relationship: parent contains child (e.g. class -> method)
+predicate ContainsDeclaration:
+  {
+    parent: Declaration,
+    child: Declaration
+  } { Parent, Child } where
+    ( { method = MDecl } = Parent;
+      { parameters = VDecls } = MDecl;
+      VDecl = VDecls[..];
+      { variable = VDecl } = Child
+    ) | (
+      { class_ = CDecl } = Parent;
+      ClassMember { CDecl, MDecl };
+      { method = MDecl } = Child
+    )
+
+# extends parent (classes `implement` interfaces, but we don't have
+# InterfaceDecls currently). So this isn't very useful yet
+predicate ExtendsDeclaration:
+  {
+    child: Declaration,
+    parent: Declaration
+  }
+  { Child, Parent } where
+    { class_ = CDecl } = Child;
+    { implements_ = QNames } = CDecl;
+    QName = QNames[..];
+    PDecl = ClassDeclaration { name = QName }; # don't think this matches
+    { class_ = PDecl } = Parent
+
+}
diff --git a/glean/schema/source/lsif.angle b/glean/schema/source/lsif.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/lsif.angle
@@ -0,0 +1,404 @@
+# Copyright (c) Meta, Inc. and affiliates.
+
+schema lsif.2 {
+
+import src
+import lsif.types.1
+
+# Opaque identifiers
+predicate Name: string
+
+# Maps lower-case strings to Name, for case-insensitive search
+predicate NameLowerCase:
+  {
+    nameLowerCase: string,
+    name: lsif.Name,
+  } stored
+  { prim.toLower Str, N } where N = lsif.Name Str
+
+# Markdown hover text
+predicate HoverText: string
+
+# LSIF documents, use this to find language of a file (or entity)
+# In mixed-language repos, symbols are keyed to Document instead of src.File
+# so we can track language tags of symbols
+predicate Document:
+  {
+    file: src.File,
+    language: lsif.types.LanguageId
+  }
+
+# LSIF hover cards in markdown
+predicate HoverContent:
+  {
+    text : lsif.HoverText,
+    language : lsif.types.LanguageId
+  }
+
+predicate Metadata:
+  {
+    lsifVersion: string,
+    positionEncoding: string,
+    toolInfo: maybe lsif.types.ToolInfo,
+  }
+
+predicate PackageInformation:
+  {
+    name: string,
+    manager: string,
+    version: string
+  }
+
+predicate Project:
+  {
+    kind: lsif.types.LanguageId
+  }
+
+# which project is a file a member of
+predicate ProjectDocument:
+  {
+    file: lsif.Document,
+    project: lsif.Project,
+  }
+
+# LSIF ranges. Raw range facts. They correspond to navigation targets
+predicate Range:
+  {
+    range: lsif.types.RangeSpan,
+    fullRange: maybe lsif.types.RangeSpan,
+    text: lsif.Name,
+  }
+
+# LSIF monikers are symbol identifier components. They have a type
+# identicating what scope the moniker fragment binds
+type MonikerKind =
+  enum {
+    Export | Local | Import | Implementation |
+  }
+
+# Moniker schemes describe which type of moniker protocol is used
+predicate MonikerScheme: string
+
+# In LSIF, this is the text fragment of the Moniker.
+# In SCIP, this is the globally unique "symbol" identifier
+predicate MonikerId: string
+
+# Monikers are scoped unique symbol identifiers, similar to Glass symbol ids
+predicate Moniker:
+  {
+    kind: lsif.MonikerKind,
+    scheme: lsif.MonikerScheme,
+    ident: lsif.MonikerId
+  }
+
+predicate Definition:
+  {
+    file: lsif.Document,
+    range: lsif.Range
+  }
+
+predicate Declaration:
+  {
+    file: lsif.Document,
+    range: lsif.Range
+  }
+
+# just xrefs to defns for now
+predicate Reference:
+  {
+    file: lsif.Document,
+    range: lsif.Range,
+    target: lsif.Definition
+  }
+
+ # Associate a hover content with the anchor definition
+ predicate DefinitionHover:
+  {
+    defn: lsif.Definition,
+    hover: lsif.HoverContent
+  }
+
+# Associate a moniker with its anchor definition
+# guaranteed to be one for every definition, so suitable as an entity key
+predicate DefinitionMoniker:
+  {
+    defn: lsif.Definition,
+    moniker: maybe lsif.Moniker,
+  }
+
+# reverse index from monikers to their defn (for search)
+predicate MonikerDefinition:
+  {
+    ident: lsif.MonikerId,
+    moniker: lsif.Moniker,
+    defn: lsif.Definition,
+  } stored
+  { Ident, Moniker, Defn } where
+    lsif.DefinitionMoniker { Defn, { just = Moniker }};
+    { ident = Ident } = Moniker;
+
+# some monikers have enough structure to record symbol kinds
+predicate MonikerSymbolKind:
+  {
+    moniker : lsif.Moniker,
+    kind : lsif.types.SymbolKind
+  }
+
+# reverse index from identifer to defn (for search)
+predicate NameDefinition:
+  {
+    name: lsif.Name,
+    defn: lsif.DefinitionMoniker,
+  } stored
+  { Name, Defn } where
+    Defn = lsif.DefinitionMoniker { defn = { range = { text = Name }}};
+    lsif.Name NameStr = Name;
+    NameStr != ""
+
+# Associate symbol kinds with some definitions and declarations
+predicate DefinitionKind:
+  {
+    defn: lsif.Definition,
+    kind: lsif.types.SymbolKind
+  }
+
+# Uses of definitions and declarations (inverse of xrefs)
+predicate DefinitionUse:
+  {
+    target: lsif.Definition,
+    file: lsif.Document,
+    range: lsif.Range,
+  }
+
+#
+# Generic codemarkup.angle provider layer
+#
+
+# Symbol locations within a repo. Analog of codemarkup:Location, non-LSIF types
+type Location =
+  {
+    name : string,
+    file : src.File,
+    location : src.Range,
+    # not attempting to do full ranges yet
+    # span: maybe src.Range,
+}
+
+# Tagged entity by language. Tags should match shape of code.lsif.angle
+# We use the lsif.types.LanguageId tag associated with lsif.Document (provided
+# by the indexer) to work out the language of the entity. List is known active
+# indexers and generic lsif that people might plausibly try to load
+type Entity =
+  {
+    erlang : lsif.SomeEntity |
+    fsharp : lsif.SomeEntity |
+    go : lsif.SomeEntity |
+    haskell : lsif.SomeEntity |
+    java : lsif.SomeEntity |
+    kotlin : lsif.SomeEntity |
+    ocaml : lsif.SomeEntity |
+    python : lsif.SomeEntity |
+    rust : lsif.SomeEntity |
+    scala : lsif.SomeEntity |
+    swift : lsif.SomeEntity |
+    typescript : lsif.SomeEntity |
+  }
+
+# Base entities in LSIF are definitions and declartions
+type SomeEntity =
+  {
+    decl : lsif.Declaration |
+    defn : lsif.DefinitionMoniker |
+  }
+
+# analog of codemarkup.ResolveLocation, flattens locations and converts spans
+# Since we can return multiple language symbols in lsif, add a tag for what we
+# think the language is. This is used in codemarkup to get the lsif.code lang
+predicate ResolveLocation:
+  {
+    location: lsif.Location,
+    entity: lsif.Entity,
+  }
+  { { NameStr, File, SrcRange }, Entity } where
+    Defn = lsif.DefinitionMoniker { defn = { { File, Language }, Range }};
+    { range = RangeSpan, text = Name NameStr } = Range;
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+    lsif.TagDefinition { Language, Defn, Entity };
+
+# unwrap language tag and lookup the decl/defn directly
+predicate EntityLocation:
+  {
+    entity: lsif.Entity,
+    location: lsif.Location,
+  }
+  { Entity, Location } where
+    lsif.EntityDefinition { Entity, { defn = Defn }} ;
+    lsif.DefinitionLocation { Defn, Location };
+
+# analog of codemarkup equivalent
+predicate FileEntityXRefLocation:
+  {
+    file: src.File,
+    source: src.Range,
+    target: lsif.Location,
+    entity: lsif.Entity,
+  }
+  { File, SrcRange, Location, Entity } where
+    lsif.Reference { { file = File }, { range = RangeSpan }, BaseDefn };
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+    lsif.DefinitionLocation { BaseDefn, Location };
+    Defn = lsif.DefinitionMoniker { defn = BaseDefn };
+    { file = { language = Language } } = BaseDefn;
+    lsif.TagDefinition { Language, Defn, Entity };
+
+# analog of codemarkup.EntityUses
+predicate EntityUses:
+  {
+    target: lsif.Entity,
+    file: src.File,
+    range: src.Range,
+  }
+  { Entity, File, SrcRange } where
+    lsif.EntityDefinition { Entity, { defn = Defn }};
+    lsif.DefinitionUse { Defn, { file = File }, { range = Range } };
+    lsif.types.ToSrcRange { File, Range, SrcRange };
+
+# and for codemarkup.EntityKind
+# either the kind was recorded in the DefinitionKind table, or the Moniker was
+# used to construct a kind.
+predicate EntityKind:
+  {
+    entity: lsif.Entity,
+    kind: lsif.types.SymbolKind,
+  }
+  { Entity, Kind } where
+    lsif.EntityDefinition { Entity, { Defn, Moniker }};
+    if lsif.DefinitionKind { Defn, Kind }
+      then ( Kind = Kind )
+      else ( { just = M } = Moniker; lsif.MonikerSymbolKind { M, Kind });
+
+#
+# Helpers for working with language tags and entities
+#
+
+# introduce entity tags
+predicate TagDefinition:
+  {
+    language: lsif.types.LanguageId,
+    defn: lsif.DefinitionMoniker,
+    entity: lsif.Entity,
+  }
+  { Language, Defn, Entity } where
+    { defn = Defn }  = SE : lsif.SomeEntity;
+    ( Erlang = Language; { erlang = SE }) |
+    ( FSharp = Language; { fsharp = SE }) |
+    ( Go = Language; { go = SE }) |
+    ( Haskell = Language; { haskell = SE }) |
+    ( Java = Language; { java = SE }) |
+    ( Kotlin = Language; { kotlin = SE }) |
+    ( OCaml = Language; { ocaml = SE }) |
+    ( Python = Language; { python = SE }) |
+    ( Rust = Language; { rust = SE }) |
+    ( Scala = Language; { scala = SE }) |
+    ( Swift = Language; { swift = SE }) |
+    ( TypeScript = Language; { typescript = SE }) = Entity;
+
+# eliminate entity tags. inverse of TagDefinition
+predicate EntityDefinition:
+  {
+    entity : lsif.Entity,
+    defn : lsif.DefinitionMoniker,
+  }
+  { Entity, Defn } where
+    ({ erlang = SE }) |
+    ({ fsharp = SE }) |
+    ({ go = SE }) |
+    ({ haskell = SE }) |
+    ({ java = SE }) |
+    ({ kotlin = SE }) |
+    ({ ocaml = SE }) |
+    ({ python = SE }) |
+    ({ rust = SE }) |
+    ({ scala = SE }) |
+    ({ swift = SE }) |
+    ({ typescript = SE }) = Entity;
+    { defn = Defn } = SE;
+
+# Just need to elaborate lsif.types.RangeSpan with a File key
+predicate DefinitionLocation:
+  {
+    defn: lsif.Definition,
+    location: lsif.Location,
+  }
+  { Defn, Location } where
+    { { file = File }, { RangeSpan, _, Name NameStr } } = Defn;
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+    { NameStr, File, SrcRange } = Location;
+
+
+
+# entity search, recovering entities from symbol ids
+
+# if we have just the file and identifier we can probably find it (non-locals
+# only). O(defn in file)
+predicate SearchNonLocalByLocation:
+  {
+    file : src.File,
+    name : lsif.Name,
+    entity : lsif.Entity,
+  }
+  { File, Name, Entity } where
+    D = lsif.Definition { { File, Language } , { text = Name } };
+    DM = lsif.DefinitionMoniker { D, { just = { kind = K } } };
+    Import|Export|Implementation = K;
+    lsif.TagDefinition { Language, DM, Entity };
+
+# if we have file, identifier and position, search for exact location of a local
+predicate SearchByExactLocationAndName:
+  {
+    file : src.File,
+    name : lsif.Name,
+    span : lsif.types.RangeSpan,
+    entity : lsif.Entity,
+  }
+  { File, Name, Range, Entity } where
+    D = lsif.Definition { { File, Language } , { text = Name, range = Range } };
+    DM = lsif.DefinitionMoniker { defn = D };
+    lsif.TagDefinition { Language, DM, Entity };
+
+# Just search by exact location
+predicate SearchByExactLocation:
+  {
+    file : src.File,
+    span : lsif.types.RangeSpan,
+    entity : lsif.Entity,
+  }
+  { File, Range, Entity } where
+    D = lsif.Definition { { File, Language } , { range = Range } };
+    DM = lsif.DefinitionMoniker { defn = D };
+    lsif.TagDefinition { Language, DM, Entity };
+
+# if we only have the moniker, we can probably still find it
+# O(1) via moniker definition table
+predicate SearchByMoniker:
+  {
+    ident : lsif.MonikerId,
+    entity : lsif.Entity,
+  }
+  { Ident, Entity } where
+    lsif.MonikerDefinition { Ident, Moniker, Defn };
+    { file = { language = Language }} = Defn;
+    lsif.TagDefinition { Language, { Defn, { just = Moniker }}, Entity };
+
+# global search by name fragments
+predicate SearchByName:
+  {
+    name: lsif.Name,
+    entity: lsif.Entity
+  }
+  { Name, Entity } where
+    lsif.NameDefinition { Name, DM };
+    { defn = { file = { language = Language } } } = DM;
+    lsif.TagDefinition { Language, DM, Entity };
+
+}
diff --git a/glean/schema/source/lsif.types.angle b/glean/schema/source/lsif.types.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/lsif.types.angle
@@ -0,0 +1,79 @@
+# Copyright (c) Meta, Inc. and affiliates.
+
+schema lsif.types.1 {
+
+import src
+
+# Indexer tool metadata
+type ToolInfo =
+  {
+    toolName: string,
+    toolArgs: [string],
+    version: maybe string,
+  }
+
+# Tags for entities, so clients can distinguish them.
+# Exactly from https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind
+# should match exactly LSIF.JSON.SymbolKind
+#
+# Note: this is not the same as codemarkup.SymbolKind's enum
+#
+type SymbolKind =
+  enum {
+    File | Module | Namespace | Package | Class_ | Method | Property |
+    Field | Constructor | Enum_ | Interface | Function | Variable | Constant | String |
+    Number | Boolean | Array | Object_ | Key | Null | EnumMember | Struct | Event |
+    Operator | TypeParameter | Unknown
+  }
+
+# Language Identifiers
+# from https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem
+# Text documents have a text language identifier associated with filenames, to
+# identify a document on the server side when it handles more than one language
+# to avoid re-interpreting the file extension
+type LanguageId =
+  enum {
+    ABAP | WindowsBat | BibTeX | Clojure | Coffeescript | C | Cpp | CSharp |
+    CSS | Diff | Dart | Dockerfile | Elixir | Erlang | FSharp | Git | Go |
+    Groovy | Handlebars | Haskell | HTML | Ini | Java | JavaScript |
+    JavaScriptReact | JSON | LaTeX | Less | Lua | Makefile | Markdown |
+    ObjectiveC | ObjectiveCpp | Perl | Perl6 | PHP | Powershell | Pug | Python |
+    R | Razor | Ruby | Rust | SCSS | Scala | ShaderLab | Shell | SQL | Swift |
+    TypeScript | TypeScriptReact | TeX | VisualBasic | XML | XSL | YAML |
+    UnknownLanguage |
+# extend the specification with things
+    Kotlin | OCaml
+  }
+
+# In LSIF range spans are not keyed by file, we index them separately.
+# Having this as a type compresses better than as a predicate
+# Note: these are 1-indexed, like src.Range, while LSIF native is 0-indexed.
+# The conversion happens in the indexer.
+type RangeSpan =
+  {
+    lineBegin : nat,
+    columnBegin : nat,
+    lineEnd : nat,
+    columnEnd : nat,
+  }
+
+# convenience to convert between lsif.RangeSpan and src.Range
+# These are both 1-indexed range types, but lsif doesn't have a File
+predicate ToSrcRange:
+  {
+    file: src.File,
+    lsif: RangeSpan,
+    range: src.Range,
+  }
+  { File, { A, B, C, D }, SrcRange } where SrcRange = { File, A, B, C, D }
+
+# Inverse direction of ToSrcRange. Breaks apart the src.Range structure
+predicate FromSrcRange:
+  {
+    range: src.Range,
+    file: src.File,
+    lsif: RangeSpan,
+  }
+  { SrcRange, File, { A, B, C, D } } where SrcRange = { File, A, B, C, D }
+
+  }
diff --git a/glean/schema/source/pp.angle b/glean/schema/source/pp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/pp.angle
@@ -0,0 +1,62 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema pp1.1 {
+import src
+
+# Preprocessor #include occurences. Each occurence of a #include
+# Note that there may be many such facts for a given src.File
+predicate Include :
+  {
+    file : src.File,        # file being included
+    source : src.Range,     # where #include statement occurs
+    pathSpan : src.ByteSpan # span of the file path in the source
+  }
+
+# Preprocessor macro
+predicate Macro : string
+
+# Preprocessor #define
+predicate Define :
+  {
+    macro : Macro,
+    source : src.Range,
+  }
+
+# For case insensitive, kind search. Derive lower name to decl directly
+predicate DefineLowerCase:
+  {
+    name_lowercase: string,
+    decl: Define,
+  } stored { prim.toLower NameStr, Define} where Define = Define { macro = Macro NameStr }
+
+# Preprocessor #undef
+predicate Undef :
+  {
+    macro : Macro,
+    source : src.Range,
+  }
+
+# Preprocessor macro use
+predicate Use :
+  {
+    macro : Macro,
+    definition : maybe src.Loc,  # xref to the macro definition
+    expand : bool,               # expansion or defined check?
+    source : src.Range,          # entire term including args
+    nameSpan : src.ByteSpan      # macro name at use site
+  }
+
+# for historical reasons pp1.Define and pp1.Use/Undefs are keyed by macro
+# rather than a more unique pp1.Define or similar fact. All similar named
+# macros collide. We can disambiguate uses by definition (though this means
+# no nested macro uses will be found)
+predicate DefineUse:
+  {
+    define: pp1.Define,
+    use: pp1.Use
+  }
+  { Def, Use } where
+    { macro = M, source = { file = F } } = Def;
+    Use = pp1.Use { macro = M, definition = { just = { file = F } } }
+
+}
diff --git a/glean/schema/source/python.angle b/glean/schema/source/python.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/python.angle
@@ -0,0 +1,898 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema python.4 {
+import builtin.1
+import src
+
+predicate Name: string
+predicate Type: string
+
+# Records that a class exists with the given fully qualified name.
+predicate ClassDeclaration:
+  {
+    name: Name,
+    bases: maybe [Name],  # unused, see ClassDefinition below
+  }
+# Records that a function exists with the given fully qualified name.
+# The function can be a global, local, or a class method.
+predicate FunctionDeclaration: { name: Name }
+# Records that a variable exists with the given fully qualified name.
+# This variable can be global, or scoped to a class.
+predicate VariableDeclaration: { name: Name }
+# Records that a Python module exists with a given fully qualified name.
+predicate Module: { name: Name }
+
+# A structured name.
+predicate SName:
+  {
+    local_name: Name,
+    parent: maybe SName,
+  }
+
+# Unstructured dotted qualified names to structured names
+predicate NameToSName: Name -> SName
+
+predicate SNameToName: SName -> Name
+  stored SN -> N where NameToSName N -> SN
+
+# Allows efficient queries for modules by structured name.
+predicate ModuleBySName: SName -> Module
+  stored SN -> M where Module {name = N} = M; NameToSName N -> SN
+
+predicate ModuleDefinition:
+  {
+    module: Module,
+  }
+
+# Allows efficient queries for classes by structured name
+predicate ClassBySName: SName -> ClassDeclaration
+  stored SN -> C where ClassDeclaration {name = N} = C; NameToSName N -> SN
+
+# Represents details about a class with a particular name.
+predicate ClassDefinition:
+  {
+    declaration: ClassDeclaration,
+    # nothing means the indexer doesn't support detecting these features
+    bases: maybe [ClassDeclaration],
+    keywords: maybe [Parameter],  # metaclass parameters
+    decorators: maybe [Decorator],
+    container: maybe DeclarationContainer,
+  }
+
+predicate DerivedClassToBase:
+  {
+    derived: ClassDeclaration,
+    base: ClassDeclaration,
+  }
+  {Derived, Base} where
+    ClassDefinition { declaration = Derived, bases = { just = Bases } };
+    Bases[..] = Base;
+
+predicate BaseClassToDerived:
+  {
+    base: ClassDeclaration,
+    derived: ClassDeclaration,
+  }
+  stored {Base, Derived} where
+    DerivedClassToBase { Derived, Base};
+
+# Allows efficient queries for functions by structured name.
+predicate FunctionBySName: SName -> FunctionDeclaration
+  stored SN -> F where FunctionDeclaration {name = N} = F; NameToSName N -> SN
+
+# Represents details about a function with a particular name.
+predicate FunctionDefinition:
+  {
+    declaration: FunctionDeclaration,
+    is_async: bool,
+    returnsInfo: maybe TypeInfo,
+    params: [Parameter],  # "regular" parameters (can be pos or kwarg)
+    # nothing means the indexer doesn't support detecting these features
+    posonly_params: maybe [Parameter],
+    kwonly_params: maybe [Parameter],
+    star_arg: maybe Parameter,  # *args
+    star_kwarg: maybe Parameter,  # **kwargs
+    decorators: maybe [Decorator],
+    container: maybe DeclarationContainer,
+  }
+
+# Allows efficient queries for variables by structured name.
+predicate VariableBySName: SName -> VariableDeclaration
+  stored SN -> V where VariableDeclaration {name = N} = V; NameToSName N -> SN;
+
+# Represents details about a variable.
+predicate VariableDefinition:
+  {
+    declaration: VariableDeclaration,
+    typeInfo: maybe TypeInfo,
+    container: maybe DeclarationContainer,
+  }
+
+type DeclarationContainer =
+  {
+    module: Module |
+    cls: ClassDeclaration |
+    func: FunctionDeclaration
+  }
+
+type Parameter =
+  {
+    name: Name,
+    typeInfo: maybe TypeInfo,
+    # value is filled out for:
+    # - metaclass parameters (see the `keywords` field in `ClassDefinition`)
+    # - default values of function parameters (see `FunctionDefinition`)
+    value: maybe string,
+  }
+
+type TypeInfo =
+  {
+    displayType: Type,
+    xrefs: [XRefViaName],
+  }
+
+# Decorators can be arbitrary expressions, this just records their string
+# representation.
+type Decorator = string
+
+predicate DeclarationDocstring:
+  {
+    declaration: Declaration,
+    location: src.ByteSpan, # raw docstring location
+    pretty_text: string, # pretty printed docstring
+  }
+
+# A concrete symbol being imported.
+# A single import statement that pulls in multiple names generates multiple
+# facts of this predicate. Star imports are not represented.
+predicate ImportStatement:
+  {
+    # fully qualified name of the imported symbol
+    from_name: Name,
+    # fully qualified name that is the effect of the import statement
+    as_name: Name,
+  }
+
+type Declaration =
+  {
+    cls: ClassDeclaration |
+    func: FunctionDeclaration |
+    variable: VariableDeclaration |
+    imp: ImportStatement |
+    module: Module |
+  }
+
+# The location of a Declaration relative to the repo root.
+predicate DeclarationLocation:
+  {
+    declaration: Declaration,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+
+# A cross reference, or access to a symbol.
+# This type captures a variable access with the LOAD expression
+# context in the Python AST. This type is only valid in the context
+# of a FileXRefs predicate. `target` is a fully qualified name.
+type XRefViaName =
+    {
+        target: Name,
+        source: src.ByteSpan,
+    }
+
+# Collects all reference to names in a single file.
+# There is only one fact of this predicate per source file in the repo.
+predicate XRefsViaNameByFile:
+    {
+        file: src.File,
+        xrefs: [XRefViaName],
+    }
+
+# Uses of a reference via name in a particular file.
+predicate XRefsViaNameByTarget:
+    {
+        target: Name,
+        file: src.File,
+        spans: [src.ByteSpan],
+    }
+
+# All uses of a declaration in a particular file.
+# This predicate does not follow references, so if a symbol is used through
+# a chain of imports, only the first hop will be present as a fact.
+# Querying this predicate by declaration is an efficient way to find immediate
+# references to
+predicate DeclarationUses:
+  {
+    declaration: Declaration,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+  {Decl, File, Span} where
+  DeclarationToName Decl -> Name;
+  XRefsViaNameByTarget {Name, File, Spans};
+  Span = Spans[..];
+
+
+predicate DirectXRefsByFile:
+  {
+    file: src.File,
+    xref: DirectXRef,
+  }
+  {File, XRef} where
+  XRefsViaNameByFile { File, XRefsViaName };
+  { target = Name, source = Source } = XRefsViaName[..];
+  DeclarationWithName {Name, Decl};
+  XRef = DirectXRef {target = Decl, source = Source};
+
+type DirectXRef =
+  {
+    target: Declaration,
+    source: src.ByteSpan,
+  }
+
+# String literals that occur in expression context, rather than as the
+# definition of a top-level or class constant.  These must be escaped
+# if they are not valid UTF-8.
+predicate StringLiteral : string
+
+# Context-free information about an expression argument
+type Argument =
+  {
+    # the indexer may choose to include only a prefix of the string literal
+    lit: StringLiteral |
+    # xrefs: [XRefViaName]  # FUTURE WORK
+  }
+
+# An argument to a particular call.
+type CallArgument =
+  {
+    label: maybe Name,
+    span: src.ByteSpan,
+    argument: maybe Argument,
+  }
+
+# Information for all calls, organized by file and callee_span
+predicate FileCall :
+  {
+    file: src.File,
+    callee_span: src.ByteSpan,
+    call_args: [CallArgument],
+  }
+
+# Callee function to caller function
+predicate CalleeToCaller :
+  {
+    callee: Name,
+    caller: Name,
+  }
+
+predicate DeclarationToName: Declaration -> Name
+  D -> N where
+    ({cls = { name = N }} = D) |
+    ({func = { name = N }} = D) |
+    ({variable = { name = N }} = D) |
+    ({imp = { as_name = N }} = D) |
+    ({module = { name = N }} = D)
+
+
+# This is a variant of DeclarationLocation. It allows for efficient queries
+# by file.
+predicate DeclarationsByFile:
+  {
+    file: src.File,
+    span: src.ByteSpan,
+    declaration: Declaration,
+  }
+  stored {File, Span, Declaration} where
+  DeclarationLocation { Declaration, File, Span }
+
+# Search for a declaration by (fully qualified) name.
+predicate DeclarationWithName:
+  {
+    name: Name,
+    declaration: Declaration,
+  }
+  {N, D} where
+  D = (
+    Declaration { cls = { name = N }}
+  ) | (
+    Declaration { func = { name = N }}
+  ) | (
+    Declaration { variable = { name = N }}
+  ) | (
+    ImportStatementByAsName { name = N, import_ = I };
+    Declaration { imp = I }
+  ) | (
+    Declaration { module = { name = N }}
+  )
+
+# Used to filter out imp decls when looking for definition occurences
+predicate NonImportDeclaration: Declaration
+  D where
+  { cls = _ } |
+  { func = _ } |
+  { variable = _ } |
+  { module = _ } = D
+
+
+# This is the inverse of ImportStatement. It allows for efficient queries
+# by alias. Note that multiple ImportStatements might have the same
+# alias, so this must be a record and not Name -> ImportStatement.
+predicate ImportStatementByAsName:
+  {
+    name: Name,
+    import_: ImportStatement
+  } stored { Name, I } where
+  ImportStatement { as_name = Name } = I
+
+# Same as ImportStatementByAsName, but for structured names.
+predicate ImportStatementByAsSName:
+  {
+     sname: SName,
+     import_: ImportStatement
+  }
+  { AsSName, I } where
+  SNameToName AsSName -> AsName;
+  ImportStatementByAsName { AsName, I }
+
+# Look up declarations with exact SNames
+predicate DeclarationWithSName:
+  {
+    sname: SName,
+    declaration: Declaration,
+  }
+  { SName, Decl } where
+    SNameToName SName -> Name;
+    DeclarationWithName { Name, Decl };
+
+# Look up SNames using Declarations
+predicate SNameWithDeclaration:
+  {
+    declaration: Declaration,
+    sname: SName,
+  }
+  { Decl, SName } where
+    python.DeclarationToName Decl -> Name;
+    python.NameToSName Name -> SName
+
+# map from a declaration to the closest top level declaration
+# useful as we operate a lot of analysis on the top level declarations
+predicate ContainingTopLevelDeclaration:
+  {
+    declaration: Declaration,
+    container: Declaration,
+  }
+
+# Reverse containment mapping
+predicate ContainedByTopLevelDeclaration:
+  {
+    container: Declaration,
+    declaration: Declaration,
+  }
+  stored { container = C, declaration = D} where
+  python.ContainingTopLevelDeclaration {
+    declaration = D,
+    container = C
+  }
+
+# Quickly find declarations defined at the module level
+# The dead code automation operates at this level
+predicate IsTopLevelDeclaration: Declaration
+  D where
+    ContainingTopLevelDeclaration {D, C};
+    {module = _} = C;
+
+# Find which  declaration references declaration
+predicate DeclarationReference:
+  {
+    target : Declaration,
+    source : Declaration
+  }
+  { target = T, source = S } where
+    python.DeclarationUses {declaration=T, file=F, span=LittleSpan};
+    DeclarationsByFile {declaration=S, file=F, span=BigSpan};
+    src.ByteSpanContains {byteSpan=BigSpan, contains=LittleSpan}
+
+predicate DeclarationWithLocalName:
+  {
+    local_name: Name,
+    declaration: Declaration,
+  }
+  {LN, D} where
+  SN = SName {local_name = LN};
+  DeclarationWithSName {SN, D};
+
+type Definition =
+  {
+    cls: ClassDefinition |
+    func: FunctionDefinition |
+    variable: VariableDefinition |
+    module: ModuleDefinition |
+  }
+
+# The location of a Definition relative to the repo root.
+# The span here includes the body and the decorators (if present)
+predicate DefinitionLocation:
+  {
+    definition: Definition,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+
+# This is a variant of DefinitionLocation. It allows for efficient queries
+# by file.
+predicate DefinitionsByFile:
+  {
+    file: src.File,
+    span: src.ByteSpan,
+    definition: Definition,
+  }
+  stored {File, Span, Definition} where
+  DefinitionLocation { Definition, File, Span }
+
+# Map from a Definition to the corresponding Declaration
+predicate DefinitionDeclaration:
+  {
+    definition: Definition,
+    declaration: Declaration,
+  }
+  {Def, Decl} where
+  ({ cls = { declaration = CD } } = Def; Decl = python.Declaration { cls = CD }) |
+  ({ func = { declaration = FD } } = Def; Decl = python.Declaration { func = FD }) |
+  ({ module = { module = MD } } = Def; Decl = python.Declaration { module = MD }) |
+  ({ variable = { declaration = VD } } = Def; Decl = python.Declaration { variable = VD });
+
+# Inverse of DefinitionDeclaration, maps the Declaration to a corresponding Definition
+predicate DeclarationDefinition:
+  {
+    declaration: Declaration,
+    definition: Definition,
+  }
+  stored { Decl, Def } where
+  python.DefinitionDeclaration { Def, Decl };
+
+# Quickly find definitions defined at the module level
+# The dead code automation operates at this level
+predicate IsTopLevelDefinition: Definition
+  D where
+    python.DefinitionDeclaration {D, Decl};
+    python.IsTopLevelDeclaration Decl;
+
+predicate ImportStarStatement:
+  {
+    from_name: Name,
+    into_module: Module,
+  }
+
+predicate ImportStarLocation:
+  {
+    import_star: ImportStarStatement,
+    file: src.File,
+    span: src.ByteSpan,
+  }
+
+# This is the variant of ImportStarLocation which allows us for querying by file.
+predicate ImportStarsByFile:
+  {
+    file: src.File,
+    span: src.ByteSpan,
+    declaration: ImportStarStatement,
+  }
+  stored {File, Span, ImportStarStatement} where
+  ImportStarLocation { ImportStarStatement, File, Span };
+
+#
+# Even more efficient searching, names and scopes
+# We have to do a bit of work to get dotted names in to searchable prefix form
+#
+# This duplicates some of the work in ClassBySName since we can't rely on
+# constructing SNames in search being cheap
+#
+predicate SearchClassByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl : ClassDeclaration
+  } stored { NameStr, Parent, Decl } where
+    ClassDeclaration { name = N } = Decl;
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchClassByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    ClassDeclaration { name = N };
+    NameToSName N -> { local_name = Name NameStr }
+
+predicate SearchModuleByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl: Module
+  } stored  { NameStr, Parent, Decl } where
+    Module { name = N } = Decl;
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchModuleByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    Module { name = N };
+    NameToSName N -> { local_name = Name NameStr }
+
+# free or local functions are those functions not contained by a class
+predicate SearchFunctionByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl : FunctionDeclaration
+  } stored { NameStr, Parent, Decl } where
+    FunctionDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { func = Decl }, Container };
+    ( { module = _ } | { func = _ } ) = Container; # check container for kind "function"
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchFunctionByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    FunctionDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { func = Decl }, Container };
+    ( { module = _ } | { func = _ } ) = Container;
+    NameToSName N -> { local_name = Name NameStr }
+
+# class-contained function declarations are "methods"
+predicate SearchMethodByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl : FunctionDeclaration
+  } stored { NameStr, Parent, Decl } where
+    FunctionDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { func = Decl }, { cls = _ } };
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchMethodByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    FunctionDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { func = Decl }, { cls = _ } };
+    NameToSName N -> { local_name = Name NameStr }
+
+# similar to functions, variables can be distinguished by kind using the parent
+predicate SearchFieldByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl: VariableDeclaration
+  } stored { NameStr, Parent, Decl } where
+    VariableDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { variable = Decl }, { cls = _ } };
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchFieldByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    VariableDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { variable = Decl }, { cls = _ } };
+    NameToSName N -> { local_name = Name NameStr }
+
+# similar to functions, variables can be distinguished by kind using the parent
+predicate SearchVariableByName:
+  {
+    name: string,
+    parent: maybe SName,
+    decl: VariableDeclaration
+  } stored { NameStr, Parent, Decl } where
+    VariableDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { variable = Decl }, Container };
+    { module = _ } = Container; # exclude local variables, whose parent is a function, from search
+    NameToSName N -> { Name NameStr, Parent }
+
+predicate SearchVariableByLowerCaseName:
+  {
+    name_lowercase: string,
+    name: string
+  } stored { prim.toLower NameStr, NameStr } where
+    VariableDeclaration { name = N } = Decl;
+    ContainingTopLevelDeclaration { { variable = Decl }, { module = _ } };
+    NameToSName N -> { local_name = Name NameStr }
+
+# Mapping between declarations and their **immediate** containers.
+# - a module is the container for everything declared at module level and submodules
+# - a class is the container for its methods, variables and inner classes
+# - a function is the container for variables, functions and classes
+  predicate ContainedBy:
+    {
+      containee: Declaration,
+      container: Declaration,
+    }
+    {ContaineeDecl, ContainerDecl} where
+      (
+        # we don't have definitions for empty modules in the module chain,
+        # but we can define relations between them using names
+        { module = _ } = ContaineeDecl;
+        python.SNameWithDeclaration { ContaineeDecl, { parent = { just = SName } } };
+        python.DeclarationWithSName { SName, ContainerDecl };
+        { module = _ } = ContainerDecl;
+      ) | (
+        (
+          { cls = ClassDecl } = ContaineeDecl;
+          python.ClassDefinition { declaration = ClassDecl, container = { just = Container } };
+        ) | (
+          { func = FuncDecl } = ContaineeDecl;
+          python.FunctionDefinition { declaration = FuncDecl, container = { just = Container } };
+        ) | (
+          { variable = VarDecl } = ContaineeDecl;
+          python.VariableDefinition { declaration = VarDecl, container = { just = Container } };
+        );
+        Container = Container; # hack to make this variable available inside or patterns below
+        (
+          { module = ModuleDecl } = Container;
+          { module = ModuleDecl } = ContainerDecl;
+        ) | (
+          { cls = ClassDecl } = Container ;
+          { cls = ClassDecl } = ContainerDecl;
+        ) | (
+          { func = FuncDecl } = Container;
+          { func = FuncDecl } = ContainerDecl;
+        );
+      );
+
+# Reverse mapping of ContainedBy
+  predicate Contains:
+    {
+      container: Declaration,
+      containee: Declaration,
+    }
+    stored {ContainerDecl, ContaineeDecl} where
+      ContainedBy { ContaineeDecl, ContainerDecl}
+
+
+predicate IsAbstract: Declaration
+  Decl where
+  (
+    { cls = ClassDecl } = Decl;
+    # A class is abstract if it was based on "abc.ABC"
+    DerivedClassToBase { ClassDecl, Base };
+    { name = "abc.ABC" } = Base;
+    # ABCMeta is not supported, because doesn't have this data
+    # (perf note): find the base classes first and then check to see
+    # whether the name is "abc.ABC", don't find all the "abc.ABC"
+    # classes first.
+  ) | (
+    { func = FuncDecl } = Decl;
+    python.FunctionDefinition { declaration = FuncDecl, decorators = { just = Decorators } };
+    # decorators are plain text, so we have to guess how they were imported
+    Decorators[..] = "@abc.abstractmethod" | "@abstractmethod";
+  )
+
+# manually traverse 10 layers of inheritance
+predicate MethodOverrides :
+  {
+    derived: FunctionDeclaration,
+    base: FunctionDeclaration,
+  }
+  { DerivedMethodDecl, BaseMethodDecl } where
+    # find class where method is defined
+    ContainedBy { { func = DerivedMethodDecl }, { cls = DerivedClassDecl } };
+    # find local name of method {module_name}.{class_name}.{method_local_name}
+    SNameWithDeclaration { { func = DerivedMethodDecl}, { local_name = python.Name MethodNameStr } };
+
+    DerivedClassToBase { DerivedClassDecl, BaseClassDeclL1 };
+    MaybeBaseMethodDecl = if (
+      MethodByLocalNameStr { BaseClassDeclL1, MethodNameStr, BaseMethodDeclL1 };
+    ) then (
+      { just = BaseMethodDeclL1 }
+    ) else (
+      DerivedClassToBase { BaseClassDeclL1, BaseClassDeclL2 };
+      if (
+        MethodByLocalNameStr { BaseClassDeclL2, MethodNameStr, BaseMethodDeclL2 };
+      ) then (
+        { just = BaseMethodDeclL2 }
+      ) else (
+        DerivedClassToBase { BaseClassDeclL2, BaseClassDeclL3 };
+        if (
+          MethodByLocalNameStr { BaseClassDeclL3, MethodNameStr, BaseMethodDeclL3 };
+        ) then (
+          { just = BaseMethodDeclL3 }
+        ) else (
+          DerivedClassToBase { BaseClassDeclL3, BaseClassDeclL4 };
+          if (
+            MethodByLocalNameStr { BaseClassDeclL4, MethodNameStr, BaseMethodDeclL4 };
+          ) then (
+            { just = BaseMethodDeclL4 }
+          ) else (
+            DerivedClassToBase { BaseClassDeclL4, BaseClassDeclL5 };
+            if (
+              MethodByLocalNameStr { BaseClassDeclL5, MethodNameStr, BaseMethodDeclL5 };
+            ) then (
+              { just = BaseMethodDeclL5 }
+            ) else (
+              DerivedClassToBase { BaseClassDeclL5, BaseClassDeclL6 };
+              if (
+                MethodByLocalNameStr { BaseClassDeclL6, MethodNameStr, BaseMethodDeclL6 };
+              ) then (
+                { just = BaseMethodDeclL6 }
+              ) else (
+                DerivedClassToBase { BaseClassDeclL6, BaseClassDeclL7 };
+                if (
+                  MethodByLocalNameStr { BaseClassDeclL7, MethodNameStr, BaseMethodDeclL7 };
+                ) then (
+                  { just = BaseMethodDeclL7 }
+                ) else (
+                  DerivedClassToBase { BaseClassDeclL7, BaseClassDeclL8 };
+                  if (
+                    MethodByLocalNameStr { BaseClassDeclL8, MethodNameStr, BaseMethodDeclL8 };
+                  ) then (
+                    { just = BaseMethodDeclL8 }
+                  ) else (
+                    DerivedClassToBase { BaseClassDeclL8, BaseClassDeclL9 };
+                    if (
+                      MethodByLocalNameStr { BaseClassDeclL9, MethodNameStr, BaseMethodDeclL9 };
+                    ) then (
+                      { just = BaseMethodDeclL9 }
+                    ) else (
+                      DerivedClassToBase { BaseClassDeclL9, BaseClassDeclL10 };
+                      if (
+                        MethodByLocalNameStr { BaseClassDeclL10, MethodNameStr, BaseMethodDeclL10 };
+                      ) then (
+                        { just = BaseMethodDeclL10 }
+                      ) else (
+                        { nothing = {} }
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    );
+    MaybeBaseMethodDecl = { just = BaseMethodDecl };
+
+# manually traverse 10 layers of inheritance
+predicate MethodOverriden:
+  {
+    base: FunctionDeclaration,
+    derived: FunctionDeclaration,
+  }
+  { BaseMethodDecl, DerivedMethodDecl } where
+    # find class where method is defined
+    ContainedBy { { func = BaseMethodDecl }, { cls = BaseClassDecl } };
+    # find local name of method {module_name}.{class_name}.{method_local_name}
+    SNameWithDeclaration { { func = BaseMethodDecl}, { local_name = LocalName } };
+    LocalName = python.Name MethodNameStr;
+
+    BaseClassToDerived { BaseClassDecl, DerivedClassDeclL1 };
+    MaybeDerivedMethodDecl = if (
+      MethodByLocalNameStr { DerivedClassDeclL1, MethodNameStr, DerivedMethodDeclL1 };
+    ) then (
+      { just = DerivedMethodDeclL1 }
+    ) else (
+      BaseClassToDerived { DerivedClassDeclL1, DerivedClassDeclL2 };
+      if (
+        MethodByLocalNameStr { DerivedClassDeclL2, MethodNameStr, DerivedMethodDeclL2 };
+      ) then (
+        { just = DerivedMethodDeclL2 }
+      ) else (
+        BaseClassToDerived { DerivedClassDeclL2, DerivedClassDeclL3 };
+        if (
+          MethodByLocalNameStr { DerivedClassDeclL3, MethodNameStr, DerivedMethodDeclL3 };
+        ) then (
+          { just = DerivedMethodDeclL3 }
+        ) else (
+          BaseClassToDerived { DerivedClassDeclL3, DerivedClassDeclL4 };
+          if (
+            MethodByLocalNameStr { DerivedClassDeclL4, MethodNameStr, DerivedMethodDeclL4 };
+          ) then (
+            { just = DerivedMethodDeclL4 }
+          ) else (
+            BaseClassToDerived { DerivedClassDeclL4, DerivedClassDeclL5 };
+            if (
+              MethodByLocalNameStr { DerivedClassDeclL5, MethodNameStr, DerivedMethodDeclL5 };
+            ) then (
+              { just = DerivedMethodDeclL5 }
+            ) else (
+              BaseClassToDerived { DerivedClassDeclL5, DerivedClassDeclL6 };
+              if (
+                MethodByLocalNameStr { DerivedClassDeclL6, MethodNameStr, DerivedMethodDeclL6 };
+              ) then (
+                { just = DerivedMethodDeclL6 }
+              ) else (
+                BaseClassToDerived { DerivedClassDeclL6, DerivedClassDeclL7 };
+                if (
+                  MethodByLocalNameStr { DerivedClassDeclL7, MethodNameStr, DerivedMethodDeclL7 };
+                ) then (
+                  { just = DerivedMethodDeclL7 }
+                ) else (
+                  BaseClassToDerived { DerivedClassDeclL7, DerivedClassDeclL8 };
+                  if (
+                    MethodByLocalNameStr { DerivedClassDeclL8, MethodNameStr, DerivedMethodDeclL8 };
+                  ) then (
+                    { just = DerivedMethodDeclL8 }
+                  ) else (
+                    BaseClassToDerived { DerivedClassDeclL8, DerivedClassDeclL9 };
+                    if (
+                      MethodByLocalNameStr { DerivedClassDeclL9, MethodNameStr, DerivedMethodDeclL9 };
+                    ) then (
+                      { just = DerivedMethodDeclL9 }
+                    ) else (
+                      BaseClassToDerived { DerivedClassDeclL9, DerivedClassDeclL10 };
+                      if (
+                        MethodByLocalNameStr { DerivedClassDeclL10, MethodNameStr, DerivedMethodDeclL10 };
+                      ) then (
+                        { just = DerivedMethodDeclL10 }
+                      ) else (
+                        { nothing = {} }
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    );
+    MaybeDerivedMethodDecl = { just = DerivedMethodDecl };
+
+# (internal) helper for MethodOverrides
+predicate MethodByLocalNameStr:
+  {
+    cls: ClassDeclaration,
+    method_local_name: string,
+    method: FunctionDeclaration,
+  }
+  { ClassDecl, NameStr, MethodDecl } where
+    Contains { { cls = ClassDecl }, { func = MethodDecl } };
+    SearchMethodByName { name = NameStr, parent = _, decl = MethodDecl }; # we specifically don't know the parent yet
+
+# Let's imagine:
+# module A has function Foo
+# module B imports Foo from A
+# module C imports Foo from B
+#
+# Q: How to find out what Foo is?
+# A: Resolve its original name and Find it by its original name
+#
+# This is the "Resolve" part of the job
+#
+# manually traverse 5 layers of imports
+predicate ResolveOriginalName:
+  {
+    name: Name,
+    original_name: Name,
+  }
+  { Name, OriginalName } where
+    OriginalName = if (
+      ImportStatementByAsName{ Name, { from_name = Name1 } };
+    ) then (
+      if (
+        ImportStatementByAsName{ Name1, { from_name = Name2 } };
+      ) then (
+        if (
+          ImportStatementByAsName{ Name2, { from_name = Name3 } };
+        ) then (
+          if (
+            ImportStatementByAsName{ Name3, { from_name = Name4 } };
+          ) then (
+            if (
+              ImportStatementByAsName{ Name4, { from_name = Name5 } };
+            ) then (
+              Name5 # returns name 5 even if there are other imports
+            ) else ( Name4 )
+          ) else ( Name3 )
+        ) else ( Name2 )
+      ) else ( Name1 )
+    ) else ( Name );
+
+} # python.4
diff --git a/glean/schema/source/python.branches.angle b/glean/schema/source/python.branches.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/python.branches.angle
@@ -0,0 +1,29 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema python.branches.1 {
+import builtin.1
+import python.4
+import src
+
+predicate Root: string
+
+predicate FileToRoot:
+  {
+    file: src.File,
+    root: Root,
+  }
+
+predicate DirectXRefByFile:
+  {
+    file: src.File,
+    target: python.DeclarationLocation,
+    source: src.ByteSpan,
+  }
+  stored { File, Target, Span } where
+  python.XRefsViaNameByFile { File, XRefs };
+  { target = TargetName, source = Span } = XRefs[..];
+  python.DeclarationWithName { TargetName, Decl };
+  Target = python.DeclarationLocation { declaration = Decl, file = SourceFile };
+  FileToRoot { file = SourceFile, root = Root };
+  FileToRoot { file = File, root = Root };
+}
diff --git a/glean/schema/source/scip.angle b/glean/schema/source/scip.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/scip.angle
@@ -0,0 +1,350 @@
+# Copyright (c) Meta, Inc. and affiliates.
+
+schema scip.1 {
+
+import src
+import lsif.types.1
+
+# scip.proto:ProtocolVersion
+type ProtocolVersion = enum {
+  UnspecifiedProtocolVersion
+}
+
+# Text encoding of the source files on disk that are referenced from
+# `Document.relative_path`.
+type TextEncoding = enum { UnspecifiedTextEncoding | UTF8 | UTF16 }
+
+# scip.proto:Metadata
+predicate Metadata:
+  {
+    version: ProtocolVersion,
+    toolInfo: maybe lsif.types.ToolInfo,
+    projectRoot: string,
+    textEncoding: TextEncoding,
+  }
+
+# Track SCIP file language
+predicate FileLanguage:
+  {
+    file: src.File,
+    language: lsif.types.LanguageId
+  }
+
+# Occurences in files
+predicate FileRange:
+  {
+    file: src.File,
+    range: lsif.types.RangeSpan,
+  }
+
+# Symbols in SCIP. Globally unique identifiers.
+#
+# Local symbols (e.g., "local 0") are made globally unique by prefixing a
+# document path (e.g., "fbcode/foo/bar/baz.rs/local 0").
+#
+# These are similar in intent to qualified names in Python, or
+# symbol ids in Glass.
+#
+predicate Symbol: string
+
+predicate DisplayName: string
+
+predicate DisplayNameSymbol:
+  {
+    displayName: DisplayName,
+    symbol: Symbol
+  }
+
+predicate SymbolDisplayName:
+  {
+    symbol: Symbol,
+    displayName: DisplayName
+  } stored { Symbol, DisplayName } where
+    scip.DisplayNameSymbol { DisplayName, Symbol }
+
+# These correspond to SCIP occurrences with symbol_role = `Definition`
+predicate Definition:
+  {
+    symbol: Symbol,
+    location: FileRange
+  }
+
+# derive index from locations to definitions
+predicate DefinitionLocation:
+  {
+    file : src.File,
+    range : lsif.types.RangeSpan,
+    defn : Definition
+  } stored { File, Range, Defn } where
+    Defn = scip.Definition { location = FileRange };
+    scip.FileRange { File, Range } = FileRange;
+
+# Uses (xref occurences)
+predicate Reference:
+  {
+    symbol: Symbol,
+    location: FileRange
+  }
+
+predicate ReferenceLocation:
+  {
+    file : src.File,
+    range : lsif.types.RangeSpan,
+    xref : Reference,
+  } stored { File, Range, Use } where
+    Use = scip.Reference { location = FileRange };
+    scip.FileRange { File, Range } = FileRange;
+
+# where we know the definition target of a free xref
+# don't think we even need to store these?
+predicate ReferenceTarget:
+  {
+    xref: Reference,
+    target: Definition
+  } { XRef, Defn } where
+    { symbol = Symbol } = XRef;
+    Defn = scip.Definition { symbol = Symbol }
+
+# find-refs table: inverse of ReferenceTarget
+# don't think we even need to store these?
+predicate DefinitionUses:
+  {
+    target: Definition,
+    xref: Reference
+  } { Defn, XRef} where
+    { symbol = Symbol } = Defn;
+    XRef = scip.Reference { symbol = Symbol }
+
+# Documentation facts (including type signatures)
+predicate Documentation: string
+
+################################################################
+# `SymbolInformation`
+#
+# The following predicates corresponds to fields of SCIP's `SymbolInformation`
+################################################################
+
+predicate SymbolDocumentation:
+  {
+    symbol: Symbol,
+    docs: Documentation
+  }
+
+predicate DefinitionDocumentation:
+  {
+    defn: Definition,
+    docs: Documentation
+  }
+  { Defn, Docs } where
+    { symbol = Symbol } = Defn; # be careful not to inline to the head
+    scip.SymbolDocumentation { Symbol, Docs }
+
+# Symbol kinds from the `Symbol` semantic encoding
+predicate SymbolKind:
+  {
+    symbol: Symbol,
+    kind: lsif.types.SymbolKind
+  }
+
+# Parse the "scip.Symbol" to get a local name
+predicate LocalName: string
+
+predicate SymbolName:
+  {
+    symbol: Symbol,
+    name: LocalName
+  }
+
+# Symbol relationships
+
+predicate IsImplementation:
+  {
+    symbol: Symbol,
+    implemented: Symbol,
+  }
+
+predicate IsImplemented:
+  {
+    implemented: Symbol,
+    symbol: Symbol,
+  } stored { Implemented, Symbol } where
+    scip.IsImplementation { Symbol, Implemented }
+
+# TODO is_reference, is_definition, is_type_definition relationships
+
+################################################################
+# All the derived predicates
+################################################################
+
+predicate DefinitionName:
+  {
+    defn: Definition,
+    docs: LocalName
+  }
+  { Defn, Name } where
+    { symbol = Symbol } = Defn; # be careful not to inline in to the head
+    scip.SymbolName { Symbol, Name }
+
+# codemarkup compatibility. Same shape as code.scip.Entity
+type Entity =
+  {
+    rust: SomeEntity |
+    go: SomeEntity |
+    typescript: SomeEntity |
+    java: SomeEntity |
+    kotlin: SomeEntity |
+    swift: SomeEntity |
+  }
+
+# entities are scip.Definitions
+type SomeEntity =
+  {
+    defn: scip.Definition
+  }
+
+# introduce or eliminate the language tag on the generic scip definition
+predicate TagDefinition:
+  {
+    language: lsif.types.LanguageId,
+    defn: scip.Definition,
+    entity: scip.Entity,
+  }
+  { Language, Defn, Entity } where
+    SomeEntity = scip.SomeEntity { defn = Defn };
+    ( Rust = Language; { rust = SomeEntity }) |
+    ( Go = Language; { go = SomeEntity }) |
+    ( TypeScript = Language; { typescript = SomeEntity }) |
+    ( Swift = Language; { swift = SomeEntity }) |
+    ( Java = Language; { java = SomeEntity }) |
+    ( Kotlin = Language; { kotlin = SomeEntity }) = Entity;
+
+# eliminate entity language tags. inverse of TagDefinition
+predicate EntityDefinition:
+  {
+    entity : scip.Entity,
+    defn : scip.Definition
+  }
+  { Entity, Defn } where
+    ({ rust = SomeEntity }) |
+    ({ go = SomeEntity }) |
+    ({ typescript = SomeEntity }) |
+    ({ swift = SomeEntity }) |
+    ({ java = SomeEntity }) |
+    ({ kotlin = SomeEntity }) = Entity;
+    { defn = Defn } = SomeEntity
+
+# Symbol locations type. Analog of codemarkup:Location
+type Location =
+  {
+    file : src.File,
+    location : src.Range,
+    name : string,
+}
+
+# analog of codemarkup.ResolveLocation, flattens locations and converts spans
+predicate ResolveLocation:
+  {
+    location: scip.Location,
+    entity: scip.Entity,
+  }
+  { Location, Entity } where
+    scip.FileLanguage { File, Language };
+    { File, SrcRange, Name } = Location;
+    lsif.types.FromSrcRange { SrcRange, File, RangeSpan };
+    scip.DefinitionLocation { File, RangeSpan, Defn };
+    scip.TagDefinition { Language, Defn, Entity };
+    scip.DefinitionName { Defn, LocalName };
+    scip.LocalName Name = LocalName
+
+# unwrap language tag and lookup the decl/defn directly
+predicate EntityLocation:
+  {
+    entity: scip.Entity,
+    location: scip.Location,
+  }
+  { Entity, { File, SrcRange, Name } } where
+    scip.EntityDefinition { Entity, Defn };
+    { location = { File, RangeSpan } } = Defn;
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+    scip.DefinitionName { Defn, LocalName };
+    scip.LocalName Name = LocalName
+
+# xref occurences in a file
+predicate FileEntityXRefLocation:
+  {
+    file: src.File,
+    source: src.Range,
+    target: scip.Location,
+    entity: scip.Entity,
+  }
+  { File, SrcRange, { TargetFile, TargetRange, Name }, Entity } where
+    scip.ReferenceLocation { File, RangeSpan, XRef };
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+    scip.ReferenceTarget { XRef, Defn }; # only those with valid Defns
+    { location = { TargetFile, TargetRangeSpan } } = Defn;
+    scip.FileLanguage { TargetFile, Language };
+    lsif.types.ToSrcRange { TargetFile, TargetRangeSpan, TargetRange };
+    scip.DefinitionName { Defn, LocalName };
+    scip.LocalName Name = LocalName;
+    scip.TagDefinition { Language, Defn, Entity };
+
+# find-refs
+predicate EntityUses:
+  {
+    target: scip.Entity,
+    file: src.File,
+    range: src.Range,
+  }
+  { Entity, File, SrcRange } where
+    scip.EntityDefinition { Entity, Defn };
+    scip.DefinitionUses { Defn, XRef };
+    { location = { File, RangeSpan } } = XRef;
+    lsif.types.ToSrcRange { File, RangeSpan, SrcRange };
+
+# and for codemarkup.EntityKind
+# we use the kind information from the scip.Symbol tag
+# it would be better if kinds were structured in scip.proto
+predicate EntityKind:
+  {
+    entity: scip.Entity,
+    kind: lsif.types.SymbolKind,
+  }
+  { Entity, Kind } where
+    scip.EntityDefinition { Entity, Defn };
+    { symbol = Symbol } = Defn;
+    scip.SymbolKind { Symbol, Kind }
+
+# symbol lookup. O(1) via symbol definition key
+predicate SearchBySymbol:
+  {
+    symbol : scip.Symbol,
+    entity : scip.Entity,
+  }
+  { Symbol, Entity } where
+    Defn = scip.Definition { symbol = Symbol };
+    { location = { file = File } } = Defn;
+    scip.FileLanguage { File, Language };
+    scip.TagDefinition { Language, Defn, Entity }
+
+predicate FileXLangSymbolRef:
+  {
+    file: src.File,
+    range: lsif.types.RangeSpan,
+    target: scip.Symbol,
+  }
+  { File, Range, Symbol } where
+  scip.FileLanguage { file = File, language = Swift };
+  scip.ReferenceLocation { File, Range, { symbol = Symbol } };
+  Symbol = "c:objc"..;
+
+predicate SearchByNameKind:
+  {
+    name : string,
+    kind : maybe lsif.types.SymbolKind,
+    entity : scip.Entity,
+  }
+  { Name, Kind, Entity } where
+    scip.DisplayNameSymbol { DisplayName Name, Symbol };
+    Kind = ( if (scip.SymbolKind { Symbol, K }) then { just = K } else nothing );
+    scip.SearchBySymbol { Symbol, Entity }
+}
diff --git a/glean/schema/source/search.anglelang.angle b/glean/schema/source/search.anglelang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.anglelang.angle
@@ -0,0 +1,23 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.anglelang.1 {
+  import code.anglelang
+  import anglelang
+
+  predicate SearchByName:
+    {
+      name: anglelang.Name,
+      entity: code.anglelang.Entity,
+    } { N , Entity } where
+    anglelang.DeclarationLocation {decl = D};
+    anglelang.DeclarationToName D -> N;
+    Entity = {decl = D}
+
+predicate NameLowerCase:
+  {
+    nameLowerCase: string,
+    name: anglelang.Name,
+  } stored
+  { prim.toLower Str, N } where N = anglelang.Name Str
+
+}
diff --git a/glean/schema/source/search.buck.angle b/glean/schema/source/search.buck.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.buck.angle
@@ -0,0 +1,31 @@
+# Copyright (c) Meta, Inc. and affiliates.
+
+schema search.buck.1 {
+  import code.buck
+  import src
+
+  predicate SearchByFQN:
+    {
+      subdir: maybe string,
+      path: string,
+      name: string,
+      entity: code.buck.Entity,
+    } {S, P, N, E} where
+    E = code.buck.Entity { locator = { subdir = S, path = P, name = N }}
+
+  predicate SearchFile:
+    {
+      file: src.File,
+      entity: code.buck.Entity,
+    } {F, E} where
+    E = code.buck.Entity { file = F }
+
+  predicate SearchDefinition:
+    {
+      module: src.File,
+      name: string,
+      entity: code.buck.Entity,
+    } {M, N, E} where
+    E = code.buck.Entity { definition = { module = M, name = N} }
+
+}
diff --git a/glean/schema/source/search.code.angle b/glean/schema/source/search.code.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.code.angle
@@ -0,0 +1,1086 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.code.16 {
+
+import buck.4
+import code
+import code.cxx
+import code.hack
+import code.java
+import code.python
+import codemarkup.lsif
+import codemarkup.types
+import csharp
+import cxx1
+import erlang
+import fbthrift
+import flow
+import graphql
+import hack
+import hs
+import javakotlin.alpha
+import lsif
+import pp1
+import python
+import search.anglelang
+import search.cxx
+import search.erlang
+import search.flow
+import search.hack
+import search.hs
+import search.java
+import search.kind.cxx
+import search.kotlin
+import search.python
+import scip
+
+#
+# public API
+#
+
+# global symbol search with language constraint
+# migrate these to kind-based search so that the union of them covers each
+# language once
+predicate SearchByNameAndLanguage:
+  {
+    name: string,
+    language: code.Language,
+    entity: code.Entity,
+  }
+  { Name, Language, Entity } where
+  # see SearchByNameKindAndLanguage for C++, PreProcessor, Python, Hack
+    ( Java = Language; JavaSearchByName { Name, Entity } ) |
+    ( Kotlin = Language; KotlinSearchByName { Name, Entity } ) |
+    ( Haskell = Language; HsSearchByName { Name, Entity } ) |
+    ( Erlang = Language; ErlangSearchByName { Name, Entity } ) |
+    ( Thrift = Language; ThriftSearchByName { Name, Entity } ) |
+    ( Buck = Language; BuckSearchByName { Name, Entity } ) |
+    ( CSharp = Language; CSharpSearchByName { Name, Entity } ) |
+    ( GraphQL = Language; GraphQLSearchByName { Name, Entity } ) |
+    ( Angle = Language; AngleSearchByName { Name, Entity } );
+    code.EntityLanguage { Entity, Language }; # double check the entity lang
+
+# global symbol search normalized to lower case
+predicate SearchByLowerCaseNameAndLanguage:
+  {
+    name: string,
+    language: code.Language,
+    entity: code.Entity,
+  }
+  { Name, Language, Entity } where
+ # See SearchByLowerCaseNameKindAndLanguage
+    ( Java = Language; JavaSearchByLowerCaseName { Name, Entity } ) |
+    ( Kotlin = Language; KotlinSearchByLowerCaseName { Name, Entity } ) |
+    ( Haskell = Language; HsSearchByLowerCaseName { Name, Entity } ) |
+    ( Erlang = Language; ErlangSearchByLowerCaseName { Name, Entity } ) |
+    ( Thrift = Language; ThriftSearchByLowerCaseName { Name, Entity } ) |
+    ( Buck = Language; BuckSearchByLowerCaseName { Name, Entity } ) |
+    ( CSharp = Language; CSharpSearchByLowerCaseName { Name, Entity } ) |
+    ( GraphQL = Language; GraphQLSearchByLowerCaseName { Name, Entity } ) |
+    ( Angle = Language; AngleSearchByLowerCaseName { Name, Entity } );
+    code.EntityLanguage { Entity, Language }; # double check the entity lang
+
+# Kind-optimized search.
+predicate SearchByNameKindAndLanguage:
+  {
+    name: string,
+    language: code.Language,
+    kinds: maybe codemarkup.types.SymbolKind, # `nothing` indicates unknown kind
+    entity: code.Entity
+  }
+  { NameStr, Language, Kinds, Entity } where
+    ( Cpp = Language;
+      CxxSearchByNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      PreProcessor = Language;
+      PpSearchByNameKind { NameStr, Kinds, Entity }
+    ) | (
+      Python = Language;
+      PythonSearchByNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      JavaScript = Language;
+      FlowSearchByNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      Hack = Language;
+      HackSearchByNameAndKind { NameStr, Kinds, Entity }
+    ) | (
+      Rust = Language;
+      RustSearchByNameAndKind { NameStr, Kinds, Entity }
+    )
+
+# Kind-optimized search, case insensitive.
+predicate SearchByLowerCaseNameKindAndLanguage:
+  {
+    name: string,
+    language: code.Language,
+    kinds: maybe codemarkup.types.SymbolKind, # `nothing` indicates unknown kind
+    entity: code.Entity
+  }
+  { NameStr, Language, Kinds, Entity } where
+    ( Cpp = Language;
+      CxxSearchByLowerCaseNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      PreProcessor = Language;
+      PpSearchByLowerCaseNameKind { NameStr, Kinds, Entity }
+    ) | (
+      Python = Language;
+      PythonSearchByLowerCaseNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      JavaScript = Language;
+      FlowSearchByLowerCaseNameKindAndScopeFact { NameStr, _, Kinds, Entity }
+    ) | (
+      Hack = Language;
+      HackSearchByLowerCaseNameAndKind { NameStr, Kinds, Entity }
+    )
+
+# scoped search
+
+predicate SearchByScope:
+  {
+    name: string,
+    scope: [string],
+    language: code.Language,
+    entity: code.Entity,
+  }
+  { Name, Scope, Language, Entity } where
+# See SearchByScopeAndKind for C++
+    ( Java = Language; JavaSearchByScope { Name, Scope, Entity } ) |
+    ( Kotlin = Language; KotlinSearchByScope { Name, Scope, Entity } );
+    code.EntityLanguage { Entity, Language };
+
+# lower case by scope
+predicate SearchByLowerCaseScope:
+  {
+    name: string,
+    scope: [string],
+    language: code.Language,
+    entity: code.Entity,
+  }
+  { Name, Scope, Language, Entity } where
+# See SearchByLowerCaseScopeAndKind for C++
+    ( Java = Language; JavaSearchByLowerCaseScope { Name, Scope, Entity}) |
+    ( Kotlin = Language; KotlinSearchByLowerCaseScope { Name, Scope, Entity});
+    code.EntityLanguage { Entity, Language };
+
+# name and scope search, kind-optimized
+predicate SearchByScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    language: code.Language,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { Name, Scope, Language, Kinds, Entity } where
+    ( Cpp = Language;
+      CxxSearchByScopeAndKind { Name, Scope, Kinds, Entity };
+    ) | (
+      Python = Language;
+      PythonSearchByScopeAndKind { Name, Scope, Kinds, Entity };
+    ) | (
+      JavaScript = Language;
+      FlowSearchByScopeAndKind { Name, Scope, Kinds, Entity };
+    ) | (
+      Hack = Language;
+      HackSearchByScopeAndKind { Name, Scope, Kinds, Entity }
+    )
+
+# lower case by scope
+predicate SearchByLowerCaseScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    language: code.Language,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { Name, Scope, Language, Kinds, Entity } where
+    (
+      Cpp = Language;
+      CxxSearchByLowerCaseScopeAndKind { Name, Scope, Kinds, Entity }
+    ) | (
+      Python = Language;
+      PythonSearchByLowerCaseScopeAndKind { Name, Scope, Kinds, Entity };
+    ) | (
+      JavaScript = Language;
+      FlowSearchByLowerCaseScopeAndKind { Name, Scope, Kinds, Entity }
+    ) | (
+      Hack = Language;
+      HackSearchByLowerCaseScopeAndKind { Name, Scope, Kinds, Entity }
+    )
+
+#
+# Language-specific identifier search
+#
+
+predicate HackSearchByScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity } where
+    Insensitive = false;
+    HackSearchByScopeWithNameKinds { NameStr, Insensitive, Query, Kinds, Entity }
+
+predicate HackSearchByLowerCaseScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity} where
+    HackNameLowerCase { NameStr, Kinds, Name };
+    Insensitive = true;
+    HackSearchByScopeWithNameKinds { Name, Insensitive, Query, Kinds, Entity }
+
+#
+# by always using the matched namespace we make prevent scope wildcards
+# e.g. C\count won't match Test\C\count
+# we could try to interpret prefix mode this way though
+#
+predicate HackSearchByScopeWithNameKinds:
+  {
+    name: string,
+    insensitive : bool,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Insensitive, Scope, Kinds, Entity } where
+    if ( [] = Scope; true | false = Insensitive )
+      then (
+        ( # exactly and specifically global declarations
+          # these will get ranked higher by glass
+          HackSearchByNameKindWithNamespace { NameStr, nothing, Kinds, Entity }
+        ) | (
+          # or global namespace alias children ("FlibSL\Vec" or "C" work)
+          { just = Namespace } = Kinds;
+          hack.GlobalNamespaceAlias { hack.Name NameStr, NSQName };
+          hack.NamespaceDeclaration { name = NSQName } = NSDecl;
+          { hack = { decl = { namespace_ = NSDecl } } } = Entity
+        ) | (
+          { just = Module } = Kinds;
+          hack.SearchModuleByName { NameStr, Decl };
+          { hack = { decl = Decl } } = Entity
+        ) | (
+          # and check if NameStr is something in HH (i.e. auto-imported). Equiv
+          # to having the HH namespace as parent. And specifically not another
+          # namespace under HH. Has to be direct child of HH
+          HH = hack.NamespaceQName { name = hack.Name "HH", parent = nothing };
+          HackSearchByNameKindWithNamespace { NameStr, { just = HH }, Kinds, Entity }
+        )
+      )
+      else (
+        # search within specific context
+        search.hack.QueryToScopeCase { Scope, Insensitive, ScopeName, ScopeNS };
+        HackSearchByNameKindWithQName { NameStr, ScopeName, ScopeNS, Kinds, Entity } |
+          HackSearchByNameKindWithNamespace { NameStr, { just = { ScopeName, ScopeNS } }, Kinds, Entity };
+      );
+
+#
+# string-based search
+#
+
+predicate RustSearchByNameAndKind:
+  {
+    name: string,
+    kind: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Kinds, Entity } where
+  scip.SearchByNameKind { NameStr, Ks, { rust = { defn = D } } };
+  Kinds =
+    if (Ks = { just = K }) then
+      (codemarkup.lsif.LsifKindToKind { K, Kind }; { just = Kind })
+    else nothing;
+  { scip = { rust = { defn = D } } } = Entity
+
+predicate HackSearchByNameAndKind:
+  {
+    name: string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Kinds, Entity } where
+    HackSearchByNameKindWithQName { NameStr, _, _, Kinds, Entity } |
+    HackSearchByNameKindWithNamespace { NameStr, _, Kinds, Entity } |
+      # module is special as it has no scope term ever
+      ( { just = Module } = Kinds;
+        hack.SearchModuleByName { NameStr, Decl };
+        { hack = { decl = Decl } } = Entity )
+
+predicate HackSearchByLowerCaseNameAndKind:
+  {
+    name: string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Kinds, Entity } where
+    HackNameLowerCase { NameStr, Kinds, Name };
+    HackSearchByNameAndKind { Name, Kinds, Entity }
+
+# arity-2 scope. Those that require a parent and an optional namespace. i.e. at
+# least one non-empty scope term or all empty
+predicate HackSearchByNameKindWithQName:
+  {
+    name: string,
+    scope : hack.Name,
+    scopeNamespace : maybe hack.NamespaceQName,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Scope, ScopeNS, Kinds, Entity } where
+    { just = Kind } = Kinds;
+    (
+      Method = Kind;
+      hack.SearchMethodByName { NameStr, { Scope, ScopeNS }, Decl }
+    ) | (
+      Property = Kind;
+      hack.SearchPropertyByName { NameStr, { Scope, ScopeNS }, Decl }
+    ) | (
+      Field = Kind;
+      hack.SearchEnumeratorByName { NameStr, { Scope, ScopeNS }, Decl }
+    ) | (
+      Constant = Kind;
+      hack.SearchClassConstByName { NameStr, { Scope, ScopeNS }, Decl }
+    ) | (
+      Type = Kind;
+      hack.SearchTypeConstByName { NameStr, { Scope, ScopeNS }, Decl }
+    );
+    { hack = { decl = Decl } } = Entity
+
+# arity-1 scope: those that require a maybe namespace scope term
+#
+# With namespace_ of nothing, this searches for top-level declarations (global
+# items without a context)
+#
+predicate HackSearchByNameKindWithNamespace:
+  {
+    name: string,
+    scope: maybe hack.NamespaceQName,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    { just = Kind } = Kinds;
+    (
+      Class_ = Kind;
+      hack.SearchClassByName { NameStr, Scope, Decl }
+    ) | (
+      Interface = Kind;
+      hack.SearchInterfaceByName { NameStr, Scope, Decl }
+    ) | (
+      Trait = Kind;
+      hack.SearchTraitByName { NameStr, Scope, Decl }
+    ) | (
+      Enum_ = Kind;
+      hack.SearchEnumByName { NameStr, Scope, Decl }
+    ) | (
+      Namespace = Kind;
+      hack.SearchNamespaceByName { NameStr, Scope, Decl }
+    ) | (
+      Function = Kind;
+      hack.SearchFunctionByName { NameStr, Scope, Decl }
+    ) | (
+      Constant = Kind;
+      hack.SearchGlobalConstByName { NameStr, Scope, Decl }
+    ) | (
+      Type = Kind;
+      hack.SearchTypedefByName { NameStr, Scope, Decl }
+    );
+    { hack = { decl = Decl } } = Entity
+
+predicate HackNameLowerCase :
+  {
+    nameLowercase : string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    name : string,
+  }
+  { NameStr, Kinds, Name } where
+    { just = Kind } = Kinds;
+    (
+      Class_ = Kind;
+      hack.SearchClassByLowerCaseName { NameStr, Name }
+    ) | (
+      Interface = Kind;
+      hack.SearchInterfaceByLowerCaseName { NameStr, Name }
+    ) | (
+      Trait = Kind;
+      hack.SearchTraitByLowerCaseName { NameStr, Name }
+    ) | (
+      Enum_ = Kind;
+      hack.SearchEnumByLowerCaseName { NameStr, Name }
+    ) | (
+      Namespace = Kind;
+      hack.SearchNamespaceByLowerCaseName { NameStr, Name }
+    ) | (
+      Function = Kind;
+      hack.SearchFunctionByLowerCaseName { NameStr, Name }
+    ) | (
+      Method = Kind;
+      hack.SearchMethodByLowerCaseName { NameStr, Name }
+    ) | (
+      Constant = Kind;
+      hack.SearchClassConstByLowerCaseName { NameStr, Name } |
+        hack.SearchGlobalConstByLowerCaseName { NameStr, Name }
+    ) | (
+      Property = Kind;
+      hack.SearchPropertyByLowerCaseName { NameStr, Name }
+    ) | (
+      Field = Kind;
+      hack.SearchEnumeratorByLowerCaseName { NameStr, Name }
+    ) | (
+      Type = Kind;
+      hack.SearchTypeConstByLowerCaseName { NameStr, Name } |
+        hack.SearchTypedefByLowerCaseName { NameStr, Name }
+    ) | (
+      Module = Kind;
+      hack.SearchModuleByLowerCaseName { NameStr, Name }
+    );
+
+
+predicate PythonSearchByScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    Insensitive = false;
+    search.python.QueryToScopeCase { Scope, Insensitive, MSName };
+    PythonSearchByNameKindAndScopeFact { NameStr, MSName, Kinds, Entity }
+
+predicate PythonSearchByLowerCaseScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    Insensitive = true;
+    search.python.QueryToScopeCase { Scope, Insensitive, MSName };
+    PythonSearchByLowerCaseNameKindAndScopeFact { NameStr, MSName, Kinds, Entity }
+
+predicate PythonSearchByLowerCaseNameKindAndScopeFact:
+  {
+    name: string,
+    scope: maybe python.SName,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    PythonNameLowerCase { NameStr, Kinds, Name };
+    PythonSearchByNameKindAndScopeFact { Name, Scope, Kinds, Entity }
+
+# with a bare string name and a known scope, search by kind
+predicate PythonSearchByNameKindAndScopeFact:
+  {
+    name: string,
+    scope: maybe python.SName,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    # n.b no un-kinded entities in Python, so we ignore the `nothing` case
+    { just = Kind } = Kinds;
+    (
+      Class_ = Kind;
+      python.SearchClassByName { NameStr, Scope, CDecl };
+      { cls = CDecl } = Decl
+    ) | (
+      Module = Kind;
+      python.SearchModuleByName { NameStr, Scope, MDecl };
+      { module = MDecl } = Decl
+    ) | (
+      Function = Kind;
+      python.SearchFunctionByName { NameStr, Scope, FDecl };
+      { func = FDecl } = Decl
+    ) | (
+      Method = Kind;
+      python.SearchMethodByName { NameStr, Scope, MDecl };
+      { func = MDecl } = Decl
+    ) | (
+      Field = Kind;
+      python.SearchFieldByName { NameStr, Scope, FDecl };
+      { variable = FDecl } = Decl
+    ) | (
+      Variable = Kind;
+      python.SearchVariableByName { NameStr, Scope, VDecl };
+      { variable = VDecl } = Decl
+    );
+    { python = { decl = Decl } } = Entity
+
+predicate PythonNameLowerCase :
+  {
+    nameLowercase : string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    name : string,
+  }
+  { NameLower, Kinds, Name } where
+    { just = Kind } = Kinds;
+    ( Class_ = Kind;
+      python.SearchClassByLowerCaseName { NameLower, Name }
+    ) | (
+      Module = Kind;
+      python.SearchModuleByLowerCaseName { NameLower, Name }
+    ) | (
+      Function = Kind;
+      python.SearchFunctionByLowerCaseName { NameLower, Name }
+    ) | (
+      Method = Kind;
+      python.SearchMethodByLowerCaseName { NameLower, Name };
+    ) | (
+      Field = Kind;
+      python.SearchFieldByLowerCaseName { NameLower, Name }
+    ) | (
+      Variable = Kind;
+      python.SearchVariableByLowerCaseName { NameLower, Name }
+    );
+
+predicate FlowSearchByScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity } where
+    Insensitive = false;
+    search.flow.QueryToScopeCase { Query, Insensitive, Scope };
+    FlowSearchByNameKindAndScopeFact { NameStr, Scope, Kinds, Entity }
+
+predicate FlowSearchByLowerCaseScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity } where
+    Insensitive = true;
+    search.flow.QueryToScopeCase { Query, Insensitive, Scope };
+    FlowSearchByLowerCaseNameKindAndScopeFact { NameStr, Scope, Kinds, Entity };
+
+predicate FlowSearchByLowerCaseNameKindAndScopeFact:
+  {
+    name: string,
+    scope: maybe flow.Module,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    FlowNameLowerCase { NameStr, Kinds, Name };
+    FlowSearchByNameKindAndScopeFact { Name, Scope, Kinds, Entity }
+
+# with a bare string name and a known scope, search by kind
+predicate FlowSearchByNameKindAndScopeFact:
+  {
+    name: string,
+    scope: maybe flow.Module,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, MScope, Kinds, Entity } where
+    # n.b no un-kinded entities in Flow, so we ignore the `nothing` case
+    # the kinds are a bit inaccurate (i.e. no classes, all values are objects)
+    { just = Kind } = Kinds;
+    (
+      { just = Scope } = MScope; # nothing would imply these are global
+      (
+        Object_ = Kind;
+        flow.SearchDeclarationByName { NameStr, Scope, ODecl };
+        # we need to carefully remove import occurences as they're spammy
+        !flow.ImportDeclaration { declaration = ODecl };
+        { localDecl = ODecl } = Decl;
+      ) | (
+        Property = Kind;
+        flow.SearchMemberDeclarationByName { NameStr, Scope, MDecl };
+        { memberDecl = MDecl } = Decl
+      ) | (
+        Type = Kind;
+        flow.SearchTypeDeclarationByName { NameStr, Scope, TDecl };
+        # and filter out forms of type import declarations
+        !flow.TypeImportDeclaration { typeDeclaration = TDecl };
+        !(search.flow.TypeDeclarationAsDeclaration { TDecl, DeclImport };
+            flow.ImportDeclaration { declaration = DeclImport });
+        { typeDecl = TDecl } = Decl
+      );
+      { flow = { decl = Decl } } = Entity
+    ) | (
+      Module = Kind;
+      nothing = MScope; # check its not scoped
+      flow.SearchByModuleName { NameStr, Mod };
+      { flow = { module_ = Mod } } = Entity
+    )
+
+# Maps lower-case strings to normal Names, for case-insensitive search
+predicate FlowNameLowerCase :
+  {
+    nameLowercase : string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    name : string,
+  }
+  { NameStr, Kinds, Name } where
+    { just = Kind } = Kinds;
+    ( Object_ = Kind;
+      flow.SearchDeclarationByLowerCaseName { NameStr, Name }
+    ) | (
+      Property = Kind;
+      flow.SearchMemberDeclarationByLowerCaseName { NameStr, Name }
+    ) | (
+      Type = Kind;
+      flow.SearchTypeDeclarationByLowerCaseName { NameStr, Name }
+    ) | (
+      Module = Kind;
+      flow.SearchModuleByLowerCaseName { NameStr, Name }
+    )
+
+predicate JavaSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    Name = javakotlin.alpha.Name NameStr;
+    QName = javakotlin.alpha.QName { name = Name };
+    JavaSearchByNameWithFact { QName, Entity }
+
+predicate JavaSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    javakotlin.alpha.NameLowerCase { NameStr, Name };
+    QName = javakotlin.alpha.QName { name = Name };
+    JavaSearchByNameWithFact { QName, Entity }
+
+predicate JavaSearchByNameWithFact:
+  {
+    name: javakotlin.alpha.QName,
+    entity: code.Entity
+  }
+  { QName, { java = { decl = Decl } } } where
+    search.java.SearchByQName { QName, Decl };
+
+predicate JavaSearchByScope:
+  {
+    name: string,
+    scope: [string],
+    entity: code.Entity
+  }
+  { NameStr, Query, Entity } where
+    Name = javakotlin.alpha.Name NameStr;
+    Insensitive = false;
+    JavaSearchByScopeWithName { Name, Insensitive, Query, Entity }
+
+predicate JavaSearchByLowerCaseScope:
+  {
+    name: string,
+    scope: [string],
+    entity: code.Entity,
+  }
+  { NameStr, Query, Entity } where
+    javakotlin.alpha.NameLowerCase { NameStr, Name };
+    Insensitive = true;
+    JavaSearchByScopeWithName { Name, Insensitive, Query, Entity }
+
+predicate JavaSearchByScopeWithName:
+  {
+    name: javakotlin.alpha.Name,
+    insensitive : bool,
+    scope: [string],
+    entity: code.Entity,
+  }
+  { Name, Insensitive, Query, Entity } where
+    search.java.QueryToScopeCase { Query, Insensitive, Path };
+    QName = javakotlin.alpha.QName { name = Name, context = Path };
+    search.java.SearchByQName { QName, Decl };
+    { java = { decl = Decl } } = Entity;
+
+predicate KotlinSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    Name = javakotlin.alpha.Name NameStr;
+    QName = javakotlin.alpha.QName { name = Name };
+    KotlinSearchByNameWithFact { QName, Entity }
+
+predicate KotlinSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    javakotlin.alpha.NameLowerCase { NameStr, Name };
+    QName = javakotlin.alpha.QName { name = Name };
+    KotlinSearchByNameWithFact { QName, Entity }
+
+predicate KotlinSearchByNameWithFact:
+  {
+    name: javakotlin.alpha.QName,
+    entity: code.Entity
+  }
+  { QName, { kotlin = { decl = Decl } } } where
+    search.kotlin.SearchByQName { QName, Decl };
+
+predicate KotlinSearchByScope:
+  {
+    name: string,
+    scope: [string],
+    entity: code.Entity
+  }
+  { NameStr, Query, Entity } where
+    Name = javakotlin.alpha.Name NameStr;
+    Insensitive = false;
+    KotlinSearchByScopeWithName { Name, Insensitive, Query, Entity }
+
+predicate KotlinSearchByLowerCaseScope:
+  {
+    name: string,
+    scope: [string],
+    entity: code.Entity,
+  }
+  { NameStr, Query, Entity } where
+    javakotlin.alpha.NameLowerCase { NameStr, Name };
+    Insensitive = true;
+    KotlinSearchByScopeWithName { Name, Insensitive, Query, Entity }
+
+predicate KotlinSearchByScopeWithName:
+  {
+    name: javakotlin.alpha.Name,
+    insensitive : bool,
+    scope: [string],
+    entity: code.Entity,
+  }
+  { Name, Insensitive, Query, Entity } where
+    search.java.QueryToScopeCase { Query, Insensitive, Path }; # n.b. java
+    QName = javakotlin.alpha.QName { name = Name, context = Path };
+    search.kotlin.SearchByQName { QName, Decl };
+    { kotlin = { decl = Decl } } = Entity;
+
+predicate CSharpSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    Name = csharp.Name NameStr;
+    csharp.SearchByName { Name, Defn };
+    { csharp = { decl = Defn } } = Entity
+
+predicate CSharpSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    csharp.NameLowerCase { NameStr, Name };
+    csharp.SearchByName { Name, Defn };
+    { csharp = { decl = Defn } } = Entity
+
+predicate CxxSearchByScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity } where
+    search.cxx.QueryToScopeCase { Query, false, Scope };
+    CxxSearchByNameKindAndScopeFact { NameStr, Scope, Kinds, Entity }
+
+predicate CxxSearchByLowerCaseScopeAndKind:
+  {
+    name: string,
+    scope: [string],
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity,
+  }
+  { NameStr, Query, Kinds, Entity } where
+    search.cxx.QueryToScopeCase { Query, true, Scope };
+    CxxSearchByLowerCaseNameKindAndScopeFact { NameStr, Scope, Kinds, Entity };
+
+# Maps lower-case strings to normal Names, for case-insensitive search
+predicate CxxNameLowerCase :
+  {
+    nameLowercase : string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    name : string,
+  }
+  { NameLower, Kinds, Name } where
+    { just = Kind } = Kinds;
+    ( Namespace = Kind;
+      cxx1.NamespaceLowerCase { NameLower, Name }
+    ) | (
+      Class_ = Kind;
+      cxx1.RecordClassLowerCase { NameLower, Name }
+    ) | (
+      Struct = Kind;
+      cxx1.RecordStructLowerCase { NameLower, Name }
+    ) | (
+      Union = Kind;
+      cxx1.RecordUnionLowerCase { NameLower, Name }
+    ) | (
+      Enum_ = Kind;
+      cxx1.EnumLowerCase { NameLower, Name }
+    ) | (
+      Function = Kind;
+      cxx1.FunctionLowerCase { NameLower, Name }
+    ) | (
+      Variable = Kind;
+      cxx1.VariableLowerCase { NameLower, Name };
+    ) | (
+      Enumerator = Kind;
+      cxx1.EnumeratorLowerCase { NameLower, Name };
+    ) | (
+      Type = Kind;
+      cxx1.TypeAliasLowerCase { NameLower, Name };
+    ) | (
+      Interface = Kind;
+      cxx1.ObjcContainerInterfaceLowerCase { NameLower, Name };
+    );
+
+# with a bare string name and a known scope, search by kind
+predicate CxxSearchByNameKindAndScopeFact:
+  {
+    name: string,
+    scope : cxx1.Scope,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    # n.b no un-kinded entities in C++, so we ignore the `nothing` case
+    { just = Kind } = Kinds;
+    (
+      Namespace = Kind;
+      search.kind.cxx.SearchNamespace { NameStr, Scope, Ent };
+    ) | (
+      Class_ = Kind;
+      search.kind.cxx.SearchClass { NameStr, Scope, Ent };
+    ) | (
+      Struct = Kind;
+      search.kind.cxx.SearchStruct { NameStr, Scope, Ent };
+    ) | (
+      Union = Kind;
+      search.kind.cxx.SearchUnion { NameStr, Scope, Ent };
+    ) | (
+      Enum_ = Kind;
+      search.kind.cxx.SearchEnum { NameStr, Scope, Ent };
+    ) | (
+      Function = Kind;
+      search.kind.cxx.SearchFunction { NameStr, Scope, Ent };
+    ) | (
+      Variable = Kind;
+      search.kind.cxx.SearchVariable { NameStr, Scope, Ent };
+    ) | (
+      Enumerator = Kind;
+      search.kind.cxx.SearchEnumerator { NameStr, Scope, Ent };
+    ) | (
+      Type = Kind; # type alias or using decl is a "Type" kind
+      search.kind.cxx.SearchTypeAlias { NameStr, Scope, Ent };
+    ) | (
+      Interface = Kind;
+      { global_ = {} } = Scope; # objc containers have global scope
+      search.kind.cxx.SearchObjcInterface { NameStr, Ent };
+    );
+    CxxPreferDefinitions { Ent, OutEnt };
+    { cxx = OutEnt } = Entity;
+
+# lower case form
+predicate CxxSearchByLowerCaseNameKindAndScopeFact:
+  {
+    name: string,
+    scope : cxx1.Scope,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Scope, Kinds, Entity } where
+    CxxNameLowerCase { NameStr, Kinds, Name };
+    CxxSearchByNameKindAndScopeFact { Name, Scope, Kinds, Entity }
+
+# Helper for C++ to prefer definitions over declaration spam
+predicate CxxPreferDefinitions:
+  { from: code.cxx.Entity
+  , to : code.cxx.Entity
+  }
+  { InEnt, OutEnt } where
+    if ({ decl = Decl } = InEnt)
+      then (
+        # avoid returning all members of decl families
+        if (search.cxx.DeclIsDefn { Decl, Defn })
+          then ({ defn = Defn } = OutEnt)
+          else ({ decl = Decl } = OutEnt)
+        )
+      else ( InEnt = OutEnt ); # already a defn (or enumerator)
+
+predicate PpSearchByNameKind:
+  {
+    name: string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Kinds, { pp = { define = Define } } } where
+    { just = Macro } = Kinds; # this avoids unnecessary #define searches
+    pp1.Macro NameStr = Macro;
+    pp1.Define { macro = Macro } = Define
+
+predicate PpSearchByLowerCaseNameKind:
+  {
+    name: string,
+    kinds: maybe codemarkup.types.SymbolKind,
+    entity: code.Entity
+  }
+  { NameStr, Kinds, { pp = { define = Define } } } where
+    { just = Macro } = Kinds; # this avoids unnecessary #define searches
+    pp1.DefineLowerCase { NameStr, Define }
+
+predicate ThriftSearchByName:
+  {
+    name: string,
+    entity: code.Entity
+  }
+  { Name, Entity } where
+    ( Ident = fbthrift.Identifier Name;
+      FbthriftSearchByNameFact { Ident, Entity } )
+
+predicate ThriftSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity
+  }
+  { NameStr, Entity } where
+    ( fbthrift.NameLowerCase { NameStr, Ident };
+      FbthriftSearchByNameFact { Ident, Entity } )
+
+predicate FbthriftSearchByNameFact:
+  {
+    name: fbthrift.Identifier,
+    entity: code.Entity
+  }
+  { Ident, { fbthrift = { decl = Decl } }} where
+    fbthrift.SearchByName { Ident, QName };
+    fbthrift.DeclarationName { QName, Decl }
+
+predicate BuckSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    LocalName = buck.LocalName NameStr;
+    BuckSearchByLocalNameFact { LocalName, Entity }
+
+predicate BuckSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    buck.LocalNameLowerCase { NameStr, LocalName };
+    BuckSearchByLocalNameFact { LocalName, Entity }
+
+# helper to avoid repeatedly doing string search
+predicate BuckSearchByLocalNameFact:
+  {
+    name: buck.LocalName,
+    entity: code.Entity,
+  }
+  { LocalName, { buck = Decl }} where
+    buck.SearchByLocalName { LocalName, Decl }
+
+predicate AngleSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { angle = E } } where
+  search.anglelang.SearchByName { name = Name : string, entity = E }
+
+  predicate AngleSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { angle = Entity } } where
+  search.anglelang.NameLowerCase { Name, NameCase };
+  search.anglelang.SearchByName { NameCase, Entity }
+
+predicate HsSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { hs = E } } where
+  search.hs.SearchByName { name = Name, entity = E }
+
+predicate HsSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { hs = E } } where
+  search.hs.SearchByLowerCaseName { name = Name, entity = E }
+
+predicate ErlangSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { erlang = E } } where
+  search.erlang.SearchByName { name = Name, entity = E }
+
+predicate ErlangSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, Entity } where
+  erlang.NameLowerCase { Name, NameCase };
+  ErlangSearchByName { NameCase, Entity }
+
+predicate LsifSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { lsif = Entity } } where
+  lsif.SearchByName { lsif.Name Name, Entity }
+
+predicate LsifSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { Name, { lsif = Entity } } where
+  lsif.NameLowerCase { Name, NameCase };
+  lsif.SearchByName { NameCase, Entity }
+
+predicate GraphQLSearchByName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    Name = graphql.Value NameStr;
+    graphql.SearchByName { Name, Decl };
+    { graphql = { decl = Decl } } = Entity
+
+predicate GraphQLSearchByLowerCaseName:
+  {
+    name: string,
+    entity: code.Entity,
+  }
+  { NameStr, Entity } where
+    graphql.NameLowerCase { NameStr, Name };
+    graphql.SearchByName { Name, Decl };
+    { graphql = { decl = Decl } } = Entity
+
+}
diff --git a/glean/schema/source/search.cxx.angle b/glean/schema/source/search.cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.cxx.angle
@@ -0,0 +1,358 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.cxx.5 {
+import cxx1
+import code.cxx
+
+# Find direct definition entities for various declaration types
+predicate DeclIsDefn :
+  {
+    decl : cxx1.Declaration,
+    defn : code.cxx.Definition
+  }
+  { Decl, Defn } where
+    ({ record_ = D } = Decl;
+     { record_ = cxx1.RecordDefinition { declaration = D } } = Defn ) |
+    ({ function_ = D } = Decl;
+     { function_ = cxx1.FunctionDefinition { declaration = D } } = Defn) |
+    ({ enum_ = D } = Decl;
+     { enum_ = cxx1.EnumDefinition { declaration = D } } = Defn) |
+    # variable definitions are considered "definitions" if they're global
+    ({ variable = D } = Decl;
+     cxx1.VariableDeclaration { kind = { global_ = { definition = true }}} = D;
+     { variable = D } = Defn) |
+    ({ namespace_ = D } = Decl;
+      { namespace_ = cxx1.NamespaceDefinition { declaration = D } } = Defn) |
+    ({ objcMethod = D } = Decl;
+     { objcMethod = cxx1.ObjcMethodDefinition D } = Defn ) |
+    ({ objcContainer = D } = Decl;
+     { objcContainer = cxx1.ObjcContainerDefinition { declaration = D }} = Defn)
+
+#
+# Generating scope values for queries
+#
+# We could play games with holes in the namespace query, or anonymous
+# segments
+#
+
+# Compile search query tuples into scope facts
+predicate QueryToScopeCase :
+  {
+    query : [string],
+    insensitive: bool, # if true, search insensitive throughout scope term
+    scope : cxx1.Scope
+  }
+  { Query, Case, Scope } where
+    # global fixed global_
+    ( [] = Query; true | false = Case; { global_ = _ }
+    # namespace scope
+    ) | (
+      QueryToNSQNameCase { Query, Case, NSQName };
+      { namespace_ = NSQName }
+    # struct/record scope
+    ) | (
+      QueryToQNameCase { Query, Case, QName };
+      { recordWithAccess = { record = QName, # this is tricky as its a subset of all qnames
+          access = Public | Protected | Private } } # avoid wild card bind error
+    ) = Scope;
+
+# compile to generic scoped qname _to slot into cxx1.Scope { recordWithAccess _ } only
+# the problem is cxx1.Scope is a type that just lets any cxx1.QName inhabit it, but
+# actually quite restricted. It's always namespace* . record* (once you hit a
+# namsspace scope, its can't be inside a record again)
+# terminal node is often global_{}
+predicate QueryToQNameCase:
+  {
+    query : [string],
+    insensitive: bool,
+    scope : cxx1.QName
+  }
+  { Query, Case, QName } where
+    # zero tuple
+    ( [] = Query; true | false = Case;
+      cxx1.QName { name = "", scope = { global_ = {} } } ) |
+    # one tuple
+    ( [A] = Query;
+      CxxRecordCase { Case, A, AName };
+      { name = AName } ) |
+    # two tuple. parent might be either record or namespace
+    ( [B,A] = Query;
+      CxxRecordCase { Case, A, AName };
+      ( CxxNamespaceCase { Case, B, BNameNS };
+        { name = AName, scope =
+          { namespace_ = { name = { just = BNameNS } } } }
+      ) | (
+        CxxRecordCase { Case, B, BNameR };
+        { name = AName, scope =
+          { recordWithAccess = { record = { name = BNameR } } } }
+      )
+    ) |
+    # three tuple
+    ( [C,B,A] = Query;
+      CxxRecordCase { Case, A, AName };
+      # simple case, `B` is a ns, `C` must be too
+      ( CxxNamespaceCase { Case, B, BNameNS };
+        CxxNamespaceCase { Case, C, CNameNS };
+        { name = AName,
+          scope = { namespace_ = {
+            name = { just = BNameNS },
+            parent = { just = { name = { just = CNameNS } } }
+          } } }
+      # or `B is a record, then ( C is ns or record )
+      ) | (
+        CxxRecordCase { Case, B, BNameR };
+        ( CxxNamespaceCase { Case, C, CNameNS };
+          { name = AName, scope =
+              { recordWithAccess = { record = { name = BNameR,
+                scope = { namespace_ = { name = { just = CNameNS } } } } }
+              }
+          }
+        ) | (
+          CxxRecordCase { Case, C, CNameR };
+          { name = AName, scope =
+              { recordWithAccess = { record = { name = BNameR,
+                scope = { recordWithAccess = { record = { name = CNameR } } } } }
+              }
+          }
+        )
+      )
+    ) |
+    # four tuple. e.g. 4, 3, 2 or 1 records under 0 - 3 namespaces
+    ( [D,C,B,A] = Query;
+      CxxRecordCase { Case, A, AName };
+      # simplest case, `B` is a ns, `C` and `D` must be too
+      ( CxxNamespaceCase { Case, B, BNameNS };
+        CxxNamespaceCase { Case, C, CNameNS };
+        CxxNamespaceCase { Case, D, DNameNS };
+        { name = AName,
+          scope = { namespace_ = { name = { just = BNameNS },
+            parent = { just = { name = { just = CNameNS },
+              parent = { just = { name = { just = DNameNS } } }
+          } } } }
+        }
+      # or `B` is a record
+      ) | (
+        # case 1: C (and thus D) are namespaces
+        CxxRecordCase { Case, B, BNameR };
+        ( CxxNamespaceCase { Case, C, CNameNS };
+          CxxNamespaceCase { Case, D, DNameNS };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { namespace_ = { name = { just = CNameNS },
+                parent = { just = { name = { just = DNameNS } } } }
+              } } }
+            }
+          }
+        ) | (
+        # case 2: C is a record and D is a namespaces
+          CxxRecordCase { Case, C, CNameR };
+          CxxNamespaceCase { Case, D, DNameNS };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { recordWithAccess = { record = { name = CNameR,
+                scope = { namespace_ = { name = { just = DNameNS } } }
+              } } }
+            } } }
+          }
+        ) | (
+        # case 3: C is a record and D is record
+          CxxRecordCase { Case, C, CNameR };
+          CxxRecordCase { Case, D, DNameR };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { recordWithAccess = { record = { name = CNameR,
+                scope = { recordWithAccess = { record = { name = DNameR } } }
+              } } }
+            } } }
+          }
+        )
+      )
+    ) | (
+      # five tuple. we give up on expanding this and allow the outer term `E` to be a namespace only
+      [E,D,C,B,A] = Query;
+      CxxRecordCase { Case, A, AName };
+      # simplest case, `B` is a ns, `C` and `D` must be too
+      ( CxxNamespaceCase { Case, B, BNameNS };
+        CxxNamespaceCase { Case, C, CNameNS };
+        CxxNamespaceCase { Case, D, DNameNS };
+        CxxNamespaceCase { Case, E, ENameNS };
+        { name = AName,
+          scope = { namespace_ = { name = { just = BNameNS },
+            parent = { just = { name = { just = CNameNS },
+              parent = { just = { name = { just = DNameNS },
+                parent = { just = { name = { just = ENameNS } } } } }
+          } } } }
+        }
+      # or `B` is a record
+      ) | (
+        # case 1: C (and thus D and E) are namespaces
+        CxxRecordCase { Case, B, BNameR };
+        ( CxxNamespaceCase { Case, C, CNameNS };
+          CxxNamespaceCase { Case, D, DNameNS };
+          CxxNamespaceCase { Case, E, ENameNS };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { namespace_ = { name = { just = CNameNS },
+                parent = { just = { name = { just = DNameNS },
+                  parent = { just = { name = { just = ENameNS } } }
+              } } } }
+            } }
+          } }
+        ) | (
+        # case 2: C is a record and D and E are namespaces
+          CxxRecordCase { Case, C, CNameR };
+          CxxNamespaceCase { Case, D, DNameNS };
+          CxxNamespaceCase { Case, E, ENameNS };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { recordWithAccess = { record = { name = CNameR,
+                scope = { namespace_ = { name = { just = DNameNS } } }
+              } } }
+            } } }
+          }
+        ) | (
+        # case 3: C is a record and D is record, and E is a namespace
+          CxxRecordCase { Case, C, CNameR };
+          CxxRecordCase { Case, D, DNameR };
+          CxxNamespaceCase { Case, E, ENameNS };
+          { name = AName, scope =
+            { recordWithAccess = { record = { name = BNameR,
+              scope = { recordWithAccess = { record = { name = CNameR,
+                scope = { recordWithAccess = { record = { name = DNameR,
+                  scope = { namespace_ = { name = { just = ENameNS } } } } } }
+              } } }
+            } } }
+          }
+        )
+      )
+    ) = QName;
+
+# compile to namespace qname, case aware
+predicate QueryToNSQNameCase:
+  {
+    query : [string],
+    insensitive: bool,
+    scope : cxx1.NamespaceQName
+  }
+  { Query, Case, NSQName } where
+    # zero tuple
+    if ( [] = Query )
+    then ( true | false = Case; { nothing, nothing } = NSQName )
+    # one tuple
+    else if ( [A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      { name = { just = AName }} = NSQName) # n.b. parent wild
+    # two tuple
+    else if ( [B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      B_Par = { name = { just = BName } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    # three tuple
+    else if ( [C,B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      CxxNamespaceCase { Case, C, CName };
+      C_Par = { name = { just = CName } };
+      B_Par = { { just = BName }, { just = C_Par } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    # four tuple
+    else if ( [D,C,B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      CxxNamespaceCase { Case, C, CName };
+      CxxNamespaceCase { Case, D, DName };
+      D_Par = { name = { just = DName } };
+      C_Par = { { just = CName }, { just = D_Par } };
+      B_Par = { { just = BName }, { just = C_Par } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    # five tuple
+    else if ( [E,D,C,B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      CxxNamespaceCase { Case, C, CName };
+      CxxNamespaceCase { Case, D, DName };
+      CxxNamespaceCase { Case, E, EName };
+      E_Par = { name = { just = EName } };
+      D_Par = { { just = DName }, { just = E_Par } };
+      C_Par = { { just = CName }, { just = D_Par } };
+      B_Par = { { just = BName }, { just = C_Par } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    # six tuple
+    else if ( [F,E,D,C,B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      CxxNamespaceCase { Case, C, CName };
+      CxxNamespaceCase { Case, D, DName };
+      CxxNamespaceCase { Case, E, EName };
+      CxxNamespaceCase { Case, F, FName };
+      F_Par = { name = { just = FName } };
+      E_Par = { { just = EName }, { just = F_Par } };
+      D_Par = { { just = DName }, { just = E_Par } };
+      C_Par = { { just = CName }, { just = D_Par } };
+      B_Par = { { just = BName }, { just = C_Par } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    # seven
+    else if ( [G,F,E,D,C,B,A] = Query )
+    then (
+      CxxNamespaceCase { Case, A, AName };
+      CxxNamespaceCase { Case, B, BName };
+      CxxNamespaceCase { Case, C, CName };
+      CxxNamespaceCase { Case, D, DName };
+      CxxNamespaceCase { Case, E, EName };
+      CxxNamespaceCase { Case, F, FName };
+      CxxNamespaceCase { Case, G, GName };
+      G_Par = { name = { just = GName } };
+      F_Par = { { just = FName }, { just = G_Par } };
+      E_Par = { { just = EName }, { just = F_Par } };
+      D_Par = { { just = DName }, { just = E_Par } };
+      C_Par = { { just = CName }, { just = D_Par } };
+      B_Par = { { just = BName }, { just = C_Par } };
+      { { just = AName }, { just = B_Par } } = NSQName )
+    else
+      ( never = NSQName )
+
+# Instead of searching cxx1.Name, use the fact we know we're building NamespaceQName
+# to directly look up each element and its parents
+
+predicate CxxNamespaceCase:
+  {
+    insensitive: bool,
+    namestr: string,
+    name: cxx1.Name,
+  }
+  { Insensitive, NameStr, Name } where
+    ( true = Insensitive;
+      cxx1.NamespaceLowerCase { NameStr, NameNormal };
+      Name = cxx1.Name NameNormal
+    ) | (
+      false = Insensitive;
+      Name = cxx1.Name NameStr
+    )
+
+# Or if its a record-scoped thing it has to be in one of the Record declaration names
+
+predicate CxxRecordCase:
+  {
+    insensitive: bool,
+    namestr: string,
+    name: cxx1.Name,
+  }
+  { Insensitive, NameStr, Name } where
+    ( true = Insensitive;
+      cxx1.RecordStructLowerCase { NameStr, NameNormal } |
+       cxx1.RecordClassLowerCase { NameStr, NameNormal } |
+        cxx1.RecordUnionLowerCase { NameStr, NameNormal };
+      Name = cxx1.Name NameNormal
+    ) | (
+      false = Insensitive;
+      Name = cxx1.Name NameStr
+    )
+
+}
diff --git a/glean/schema/source/search.erlang.angle b/glean/schema/source/search.erlang.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.erlang.angle
@@ -0,0 +1,24 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.erlang.4 {
+  import code.erlang
+  import erlang
+
+  predicate SearchByName:
+    {
+      name: string,
+      entity: code.erlang.Entity,
+    } { Name, Entity } where
+    erlang.SearchByName { Name, Decl };
+    Entity = code.erlang.Entity { decl = Decl };
+
+  predicate SearchByFQN:
+    {
+      module: string,
+      name: string,
+      arity: nat,
+      entity: code.erlang.Entity,
+    } {M, N, A, E} where
+    E = code.erlang.Entity { decl = {func = { fqn = { module = M, name = N, arity = A } } } }
+
+}
diff --git a/glean/schema/source/search.flow.angle b/glean/schema/source/search.flow.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.flow.angle
@@ -0,0 +1,75 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.flow.1 {
+import flow
+
+#
+# Various sorts of Flow scopes
+#
+
+predicate QueryToScopeCase:
+  {
+    query: [string],
+    insensitive : bool, # if true, search insensitive
+    scopeName : maybe flow.Module
+  }
+  { Query, Case, Module } where
+    ( [] = Query; true | false = Case;
+      Module = nothing : maybe flow.Module) |
+    # one module deep
+    ( [A] = Query;
+      FlowModuleNameCase { Case, A, AModule };
+      Module = { just = AModule }
+    )
+
+# Helper to lookup flow.Module name based on case sensitivity
+predicate FlowModuleNameCase:
+  {
+    insensitive: bool,
+    namestr : string,
+    name : flow.Module
+  }
+  { Insensitive, NameStr, Module } where
+    ( true = Insensitive;
+      flow.ModuleNameLowerCase { NameStr, Module };
+    ) | (
+      false = Insensitive;
+      flow.SearchByNameModule { NameStr, Module };
+    );
+    # I don't think we want src.File names here
+    { string_ = _ } | { lib = _ } = Module;
+
+# Helper to remove import declarations consistently
+predicate FlowSearchByNameNonImport:
+  {
+    name: flow.Name,
+    decl : flow.SomeDeclaration
+  }
+  { Name, Decl } where
+    flow.SearchByName { Name, Decl };
+    ({ localDecl = LocalDecl } = Decl;
+     !flow.ImportDeclaration { declaration = LocalDecl }
+    ) | (
+     # for type declarations, we filter our `import type` occurences
+     # and also any remnant `import` occurences.
+     { typeDecl = TypeDecl } = Decl;
+     !flow.TypeImportDeclaration { typeDeclaration = TypeDecl };
+     !(TypeDeclarationAsDeclaration { TypeDecl, DeclImport };
+       flow.ImportDeclaration { declaration = DeclImport })
+    ) | (
+     { memberDecl = _ } = Decl;
+    )
+
+# Sometimes types are imported without the `import type` syntax,
+# so are not captured. If this is true, the type decl is also captured
+# as possibly an `import` occurence
+predicate TypeDeclarationAsDeclaration:
+  {
+    typeDecl : flow.TypeDeclaration,
+    decl : flow.Declaration
+  }
+  { TypeDecl, Decl } where
+    { Name, Range } = TypeDecl;
+    flow.Declaration { Name, Range } = Decl
+
+}
diff --git a/glean/schema/source/search.hack.angle b/glean/schema/source/search.hack.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.hack.angle
@@ -0,0 +1,438 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.hack.7 {
+import hack
+
+# SearchByName can be used to search for symbols in any context (wildcard
+# context).
+#
+# This can be combined with hack.NameLowerCase for case-insensitive search.
+predicate SearchByName :
+  {
+    name : hack.Name,
+    decl : hack.Declaration
+  }
+  { Name, Decl } where
+    ( D = hack.ClassConstDeclaration { name = Name };
+      { classConst = D } = Decl ) |
+    ( D = hack.Enumerator { name = Name };
+      { enumerator = D } = Decl ) |
+    ( D = hack.MethodDeclaration { name = Name };
+      { method = D } = Decl ) |
+    ( D = hack.PropertyDeclaration { name = Name };
+      { property_ = D } = Decl ) |
+    ( D = hack.TypeConstDeclaration { name = Name };
+      { typeConst = D } = Decl ) |
+    ( D = hack.ModuleDeclaration { name = Name };
+      { module = D } = Decl
+    ) | (
+      QName = hack.QName { name = Name };
+      ( D = hack.ClassDeclaration { name = QName };
+        { container = { class_ = D } } = Decl ) |
+      ( D = hack.InterfaceDeclaration { name = QName };
+        { container = { interface_ = D } } = Decl ) |
+      ( D = hack.TraitDeclaration { name = QName };
+        { container = { trait = D } } = Decl ) |
+      ( D = hack.EnumDeclaration { name = QName };
+        { container = { enum_ = D } } = Decl ) |
+      ( D = hack.FunctionDeclaration { name = QName };
+        { function_ = D } = Decl ) |
+      ( D = hack.GlobalConstDeclaration { name = QName };
+        { globalConst = D } = Decl ) |
+      ( D = hack.TypedefDeclaration { name = QName };
+        { typedef_ = D } = Decl )
+    ) | (
+      NSQName = hack.NamespaceQName { name = Name };
+      D = hack.NamespaceDeclaration { name = NSQName };
+      { namespace_ = D } = Decl
+    )
+
+# SearchInNamespace can find containers (class_, interface_, trait_),
+# enum_, function_, globalConst, and typedef_ in a NamespaceQName
+#
+# With namespace_ of nothing, this searches for top-level declarations (global
+# items without a context)
+#
+# Also helps SearchInContext to find declarations in non-empty namespace
+# contexts.
+predicate SearchInNamespace :
+  {
+    name : hack.Name,
+    namespace_ : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, NS, Decl } where
+  Decl = (
+    QN = hack.QName { name = N, namespace_ = NS };
+    hack.Declaration { container = { class_ = { name = QN }}} |
+    hack.Declaration { container = { interface_ = { name = QN }}} |
+    hack.Declaration { container = { trait = { name = QN }}} |
+    hack.Declaration { container = { enum_ = { name = QN }}} |
+    hack.Declaration { function_ = { name = QN }} |
+    hack.Declaration { globalConst = { name = QN }} |
+    hack.Declaration { typedef_ = { name = QN }}
+  ) | (
+    # modules are always at the global scope, so should be found with NS=nothing
+    nothing = NS : maybe hack.NamespaceQName;
+    hack.Declaration { module = { name = N } };
+  )
+
+# SearchXXXInNamespace are specialized versions of SearchInNamespace.
+# Used to restrict search to hack top-level namespaces
+
+predicate SearchTypeInNamespace :
+  {
+    name : hack.Name,
+    namespace_ : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, NS, Decl } where
+  Decl = (
+    QN = hack.QName { name = N, namespace_ = NS };
+    hack.Declaration { container = { class_ = { name = QN }}} |
+    hack.Declaration { container = { interface_ = { name = QN }}} |
+    hack.Declaration { container = { trait = { name = QN }}} |
+    hack.Declaration { container = { enum_ = { name = QN }}} |
+    hack.Declaration { typedef_ = { name = QN }}
+  )
+
+predicate SearchFunctionInNamespace :
+  {
+    name : hack.Name,
+    namespace_ : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, NS, Decl } where
+  Decl = (
+    QN = hack.QName { name = N, namespace_ = NS };
+    hack.Declaration { function_ = { name = QN }}
+  )
+
+predicate SearchGlobalConstInNamespace :
+  {
+    name : hack.Name,
+    namespace_ : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, NS, Decl } where
+  Decl = (
+    QN = hack.QName { name = N, namespace_ = NS };
+    hack.Declaration { globalConst = { name = QN }}
+  )
+
+predicate SearchModule :
+{
+  name : hack.Name,
+  decl : hack.Declaration
+}
+{ Name, Decl } where
+  M = hack.ModuleDeclaration { name = Name };
+  hack.Declaration { module = M } = Decl
+
+predicate SearchNamespace :
+{
+  name : hack.Name,
+  namespace_ : maybe hack.NamespaceQName,
+  decl : hack.Declaration
+}
+{ Name, Parent, Decl } where
+  NSQ = hack.NamespaceQName { Name, Parent };
+  NS = hack.NamespaceDeclaration { name = NSQ };
+  hack.Declaration { namespace_ = NS } = Decl
+
+# Find property in a parent container (class or trait)
+#
+predicate SearchPropertyInContainer :
+  {
+    name : hack.Name,
+    containerName : hack.Name,
+    containerNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, D } where
+  ParentQName = hack.QName {name = ParentName, namespace_ = ParentNamespace};
+  hack.ClassDefinition { declaration = { name = ParentQName }, members = Mems} |
+  hack.TraitDefinition { declaration = { name = ParentQName }, members = Mems};
+  D = Mems[..];
+  D = { property_ = { name = N }} : hack.Declaration;
+
+# Find classConst, method, and typeConst in any parent container
+# (class, interface, or trait)
+predicate SearchInContainerNoProperty :
+  {
+    name : hack.Name,
+    containerName : hack.Name,
+    containerNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, D } where
+  ParentQName = hack.QName {name = ParentName, namespace_ = ParentNamespace};
+  hack.ClassDefinition { declaration = { name = ParentQName }, members = Mems} |
+  hack.InterfaceDefinition { declaration = { name = ParentQName }, members = Mems} |
+  hack.TraitDefinition { declaration = { name = ParentQName }, members = Mems};
+  D = Mems[..];
+  D = (
+    { classConst = { name = N }} |
+    { method = {name = N}} |
+    {typeConst = {name = N}}
+  ) : hack.Declaration;
+
+predicate SearchInContainerOrEnumNoProperty :
+  {
+    name : hack.Name,
+    contextName : hack.Name,
+    contextNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, Decl } where
+    Decl = (
+      hack.QName { name = ParentName, namespace_ = ParentNamespace};
+      ( SearchInContainerNoProperty { N, ParentName, ParentNamespace, D }; D) |
+      ( SearchInEnum { N, ParentName, ParentNamespace, D}; D)
+    )
+
+# Either a namespace or a decl in a namespace
+predicate SearchNamespacedDecl :
+{
+  name : hack.Name,
+  namespace_ : maybe hack.NamespaceQName,
+  decl : hack.Declaration
+}
+{ Name, Parent, Decl } where
+  SearchNamespace { Name, Parent, Decl } |
+  SearchInNamespace { Name, Parent, Decl }
+
+# Find classConst, method, property_, and typeConst in any parent container
+# (class, interface, or trait)
+#
+# Helps SearchInContainerOrEnum to find declarations in container contexts
+predicate SearchInContainer :
+  {
+    name : hack.Name,
+    containerName : hack.Name,
+    containerNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, D } where
+  ParentQName = hack.QName {name = ParentName, namespace_ = ParentNamespace};
+  hack.ClassDefinition { declaration = { name = ParentQName }, members = Mems} |
+  hack.InterfaceDefinition { declaration = { name = ParentQName }, members = Mems} |
+  hack.TraitDefinition { declaration = { name = ParentQName }, members = Mems};
+  D = Mems[..];
+  D = (
+    { classConst = { name = N }} |
+    { method = {name = N}} |
+    { property_ = { name = N }} |
+    {typeConst = {name = N}}
+  ) : hack.Declaration;
+
+# Find an Enumerator in a Enum
+#
+# Although enums are containers, this predicate is distinct from 'SearchInContainer'
+# because there the child types can belong to any of the other three container types,
+# while Enumerators can only have EnumDeclaration as parent, and Enums cannot contain
+# the other child types
+#
+# Helps SearchInContainerOrEnum to find declarations in enum contexts
+predicate SearchInEnum :
+  {
+    name : hack.Name,
+    enumName : hack.Name,
+    enumNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, E } where
+  ParentQName = hack.QName {name = ParentName, namespace_ = ParentNamespace};
+  ParentEnum = hack.EnumDeclaration { name = ParentQName };
+  E = hack.Declaration { enumerator = { name = N, enumeration = ParentEnum }};
+
+# This can be used to search for concrete syntax like
+#
+# \NamespaceFoo\ClassBar::MethodBaz
+# or
+# \NamespaceFoo\EnumBar::EnumeratorBaz
+#
+# Also helps SearchInContext to find declarations in container and enum contexts
+predicate SearchInContainerOrEnum :
+  {
+    name : hack.Name,
+    contextName : hack.Name,
+    contextNamespace : maybe hack.NamespaceQName,
+    decl : hack.Declaration
+  }
+  { N, ParentName, ParentNamespace, Decl } where
+    Decl = (
+      hack.QName { name = ParentName, namespace_ = ParentNamespace};
+      ( SearchInContainer { N, ParentName, ParentNamespace, D }; D) |
+      ( SearchInEnum { N, ParentName, ParentNamespace, D}; D)
+    )
+
+#
+# Generating qnames and namespace qnames. We don't have recursion but we'd
+# like to compile the namespace tokens into a recursive QName type so we unroll
+#
+# We use the naming "Scope" to be consistent with the cxx implementation
+#
+# We specifically only search in non-empty namespaces, relying on
+# SearchByName for the global namespace search or wild cards. So
+# these won't match global constants or un-namespaced symbols. This might be
+# too restrictive.
+#
+# This doesn't check that the names are valid QNames or NamespaceQNames,
+# that's done on the query side (e.g. SearchInContext). We don't permit
+# wild card parents. so "Dict","fb" won't match "Readonly","Dict","fb"
+#
+predicate QueryToScopeCase:
+  {
+    query : [string],
+    insensitive : bool, # if true , search insensitive
+    scopeName : hack.Name,
+    scopeNamespace : maybe hack.NamespaceQName
+  }
+  { Query, Case, Name, QName } where
+    # zero tuple, can't do much with it. We don't have empty scopes
+    ( [] = Query; never = Case; never = Name;
+      QName = nothing : maybe hack.NamespaceQName ) |
+    # one tuple, could be global alias
+    ( [A] = Query;
+      HackNameCase { Case, A, AName };
+      # three cases: either
+      # - a global alias
+      # - or its a top level class. e.g. Str
+      # - or its a class imported from an auto-imported ns (like HH)
+      if hack.GlobalNamespaceAlias { AName, { AliasName, AliasQName }}
+      then ( ( Name = AliasName; QName = AliasQName ) |
+              ( Name = AName; nothing = QName ) )
+      # else maybe its from HH
+      else if ( HackInAutoImportedNamespace { AName, AQName } )
+      then ( ( Name = AName; AQName = QName ) |
+             ( Name = AName; nothing = QName ) )
+      # global name, parent is nothing.
+      else ( Name = AName; nothing = QName ) ) |
+    # two tuple
+    ( [B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      if hack.GlobalNamespaceAlias { BName, AliasQName }
+      then ( { just = AliasQName } = QName )
+      # e.g Readonly\Shapes::idx -> HH\Readonly\Shapes::idx
+      else if ( HackInAutoImportedNamespace { BName, BQName } )
+      then ( ( { just = { name = BName, parent = BQName } } = QName ) |
+             ( { just = { name = BName, parent = nothing } } = QName ) )
+      else ( { just = { name = BName,
+                parent = nothing } } = QName ) ) |
+    # three tuple
+    ( [C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = nothing }} } }  = QName ) |
+    # four tuple
+    ( [D,C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      HackNameCase { Case, D, DName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = { just = { name = DName,
+        parent = nothing }} }} } }  = QName ) |
+    # five tuple, are there any? yes there are many
+    ( [E,D,C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      HackNameCase { Case, D, DName };
+      HackNameCase { Case, E, EName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = { just = { name = DName,
+        parent = { just = { name = EName,
+        parent = nothing }} }} }} } }  = QName ) |
+    # six tuple
+    ( [F,E,D,C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      HackNameCase { Case, D, DName };
+      HackNameCase { Case, E, EName };
+      HackNameCase { Case, F, FName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = { just = { name = DName,
+        parent = { just = { name = EName,
+        parent = { just = { name = FName,
+        parent = nothing }} }} }} }} } }  = QName ) |
+    # seven tuple
+    ( [G,F,E,D,C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      HackNameCase { Case, D, DName };
+      HackNameCase { Case, E, EName };
+      HackNameCase { Case, F, FName };
+      HackNameCase { Case, G, GName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = { just = { name = DName,
+        parent = { just = { name = EName,
+        parent = { just = { name = FName,
+        parent = { just = { name = GName,
+        parent = nothing }} }} }} }} }} } }  = QName ) |
+    # eight tuple
+    ( [H,G,F,E,D,C,B,A] = Query;
+      HackNameCase { Case, A, Name };
+      HackNameCase { Case, B, BName };
+      HackNameCase { Case, C, CName };
+      HackNameCase { Case, D, DName };
+      HackNameCase { Case, E, EName };
+      HackNameCase { Case, F, FName };
+      HackNameCase { Case, G, GName };
+      HackNameCase { Case, H, HName };
+      { just = { name = BName,
+        parent = { just = { name = CName,
+        parent = { just = { name = DName,
+        parent = { just = { name = EName,
+        parent = { just = { name = FName,
+        parent = { just = { name = GName,
+        parent = { just = { name = HName,
+        parent = nothing }} }} }} }} }} }} } }  = QName );
+
+# Helper to lookup hack.Name based on case sensitivity
+predicate HackNameCase:
+  {
+    insensitive: bool,
+    namestr : string,
+    name : hack.Name
+  }
+  { Insensitive, NameStr, Name } where
+    ( true = Insensitive; hack.NameLowerCase { NameStr, Name } ) |
+    ( false = Insensitive; hack.Name NameStr = Name );
+
+# Handle auto-imported namespace rules (turn things like Shapes into HH\Shapes)
+# See fbsource/fbcode/hphp/hack/src/parser/hh_autoimport.rs
+#
+# We need to check this so that things like Shapes::idx or Vector::shuffle work
+# even though the parent of Vector and Shapes is not "nothing".
+#
+# Readonly\Shapes => HH\Readonly\Shapes
+#
+# name might be either a container-scope or a namespace itself
+predicate HackInAutoImportedNamespace:
+  {
+    name: hack.Name, # name of something that might be in an auto-imported ns
+    parent: maybe hack.NamespaceQName
+  }
+  { Name, Namespace } where
+    # Exactly the "HH" namespace.
+    # This is a hack to simulate indexing the auto-import list
+    HH = hack.NamespaceQName { name = hack.Name "HH", parent = nothing };
+    # Then we have auto-imported this Name from HH
+    { just = HH } = Namespace;
+    # Check that HH\Name is true (either class or namespace)
+    hack.QName { name = Name, namespace_ = Namespace } |
+      hack.NamespaceQName { name = Name, parent = Namespace };
+
+}
diff --git a/glean/schema/source/search.hs.angle b/glean/schema/source/search.hs.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.hs.angle
@@ -0,0 +1,21 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.hs.9 {
+  import code.hs
+  import hs
+
+  predicate SearchByName:
+    {
+      name: string,
+      entity: code.hs.Entity,
+    } { Name, { name = Entity } } where Entity.occ.name = Name;
+
+  predicate SearchByLowerCaseName:
+    {
+      name: string,
+      entity: code.hs.Entity,
+    } { Name, { name = Entity } } where
+      hs.OccNameLowerCase { Name, Occ };
+      Entity.occ = Occ;
+
+}
diff --git a/glean/schema/source/search.java.angle b/glean/schema/source/search.java.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.java.angle
@@ -0,0 +1,840 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.java.1 {
+
+import javakotlin.alpha
+import java.alpha
+
+# SearchByName can be used to search for symbols in any context (wildcard
+# context).
+predicate SearchByQName:
+  {
+    name : javakotlin.alpha.QName,
+    defn : java.alpha.Declaration
+  }
+  { QName, Decl } where
+    ( CDecl = java.alpha.ClassDeclaration { name = QName };
+      { class_ = CDecl } = Decl
+    ) | (
+      IDecl = java.alpha.InterfaceDeclaration { name = QName };
+      { interface_ = IDecl } = Decl
+    ) | (
+      EDecl = java.alpha.EnumDeclaration { name = QName };
+      { enum_ = EDecl } = Decl
+    ) | (
+      FDecl = java.alpha.FieldDeclaration { name = QName };
+      { field = FDecl } = Decl
+    ) | (
+      PDecl = java.alpha.ParameterDeclaration { name = QName };
+      { param = PDecl } = Decl
+    ) | (
+      MName = javakotlin.alpha.MethodName { name = QName };
+      MDecl = java.alpha.MethodDeclaration { name = MName };
+      { method = MDecl } = Decl
+    )
+
+# Helper to lookup javakotlin.Name based on case sensitivity
+predicate NameCase:
+  {
+    insensitive: bool,
+    namestr : string,
+    name : javakotlin.alpha.Name
+  }
+  { Insensitive, NameStr, Name } where
+    ( true = Insensitive; javakotlin.alpha.NameLowerCase { NameStr, Name } ) |
+    ( false = Insensitive; javakotlin.alpha.Name NameStr = Name );
+
+# Compile a qname query array to a Path
+predicate QueryToScopeCase:
+  {
+    query : [string],
+    insensitive : bool, # if true , search insensitive
+    scopeName : javakotlin.alpha.Path,
+  }
+  { Query, Case, Path } where
+    # zero tuple, can't do much with it. We don't have empty scopes
+    ( [] = Query; true | false = Case; never = Path : javakotlin.alpha.Path ) |
+    # one tuple
+    ( [A] = Query;
+      NameCase { Case, A, AName };
+      Path = javakotlin.alpha.Path { base = AName } ) |
+    # two tuple
+    ( [B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      CPath = javakotlin.alpha.Path { base = BName };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # three tuple
+    ( [C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      CPath = javakotlin.alpha.Path { base = CName };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # four tuple
+    ( [D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      DPath = javakotlin.alpha.Path { base = DName };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } }) |
+    # five tuple
+    ( [E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      EPath = javakotlin.alpha.Path { base = EName };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # six tuple
+    ( [F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      FPath = javakotlin.alpha.Path { base = FName };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # seven tuple
+    ( [G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      GPath = javakotlin.alpha.Path { base = GName };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # eight tuple
+    ( [H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      HPath = javakotlin.alpha.Path { base = HName };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # nine tuple
+    ( [I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      IPath = javakotlin.alpha.Path { base = IName };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # ten tuple
+    ( [J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      JPath = javakotlin.alpha.Path { base = JName };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # eleven tuple
+    ( [K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      KPath = javakotlin.alpha.Path { base = KName };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 12 tuple
+    ( [L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      LPath = javakotlin.alpha.Path { base = LName };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 13 tuple
+    ( [M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      MPath = javakotlin.alpha.Path { base = MName };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 14 tuple
+    ( [N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NPath = javakotlin.alpha.Path { base = NName };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 15 tuple
+    ( [O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      OPath = javakotlin.alpha.Path { base = OName };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 16 tuple
+    ( [P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      PPath = javakotlin.alpha.Path { base = PName };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 17 tuple
+    ( [Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      QPath = javakotlin.alpha.Path { base = QName };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 18 tuple
+    ( [R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      NameCase { Case, R, RName };
+      RPath = javakotlin.alpha.Path { base = RName };
+      QPath = javakotlin.alpha.Path
+        { base = QName, container = { just = RPath } };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 19 tuple
+    ( [S, R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      NameCase { Case, R, RName };
+      NameCase { Case, S, SName };
+      SPath = javakotlin.alpha.Path { base = SName };
+      RPath = javakotlin.alpha.Path
+        { base = RName, container = { just = SPath } };
+      QPath = javakotlin.alpha.Path
+        { base = QName, container = { just = RPath } };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 20 tuple
+    ( [T, S, R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      NameCase { Case, R, RName };
+      NameCase { Case, S, SName };
+      NameCase { Case, T, TName };
+      TPath = javakotlin.alpha.Path { base = TName };
+      SPath = javakotlin.alpha.Path
+        { base = SName, container = { just = TPath } };
+      RPath = javakotlin.alpha.Path
+        { base = RName, container = { just = SPath } };
+      QPath = javakotlin.alpha.Path
+        { base = QName, container = { just = RPath } };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 21 tuple
+    ( [U, T, S, R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      NameCase { Case, R, RName };
+      NameCase { Case, S, SName };
+      NameCase { Case, T, TName };
+      NameCase { Case, U, UName };
+      UPath = javakotlin.alpha.Path { base = UName };
+      TPath = javakotlin.alpha.Path
+        { base = TName, container = { just = UPath } };
+      SPath = javakotlin.alpha.Path
+        { base = SName, container = { just = TPath } };
+      RPath = javakotlin.alpha.Path
+        { base = RName, container = { just = SPath } };
+      QPath = javakotlin.alpha.Path
+        { base = QName, container = { just = RPath } };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } } ) |
+    # 22 tuple, there are no larger...
+    ( [V, U, T, S, R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A] = Query;
+      NameCase { Case, A, AName };
+      NameCase { Case, B, BName };
+      NameCase { Case, C, CName };
+      NameCase { Case, D, DName };
+      NameCase { Case, E, EName };
+      NameCase { Case, F, FName };
+      NameCase { Case, G, GName };
+      NameCase { Case, H, HName };
+      NameCase { Case, I, IName };
+      NameCase { Case, J, JName };
+      NameCase { Case, K, KName };
+      NameCase { Case, L, LName };
+      NameCase { Case, M, MName };
+      NameCase { Case, N, NName };
+      NameCase { Case, O, OName };
+      NameCase { Case, P, PName };
+      NameCase { Case, Q, QName };
+      NameCase { Case, R, RName };
+      NameCase { Case, S, SName };
+      NameCase { Case, T, TName };
+      NameCase { Case, U, UName };
+      NameCase { Case, V, VName };
+      VPath = javakotlin.alpha.Path { base = VName };
+      UPath = javakotlin.alpha.Path
+        { base = UName, container = { just = VPath } };
+      TPath = javakotlin.alpha.Path
+        { base = TName, container = { just = UPath } };
+      SPath = javakotlin.alpha.Path
+        { base = SName, container = { just = TPath } };
+      RPath = javakotlin.alpha.Path
+        { base = RName, container = { just = SPath } };
+      QPath = javakotlin.alpha.Path
+        { base = QName, container = { just = RPath } };
+      PPath = javakotlin.alpha.Path
+        { base = PName, container = { just = QPath } };
+      OPath = javakotlin.alpha.Path
+        { base = OName, container = { just = PPath } };
+      NPath = javakotlin.alpha.Path
+        { base = NName, container = { just = OPath } };
+      MPath = javakotlin.alpha.Path
+        { base = MName, container = { just = NPath } };
+      LPath = javakotlin.alpha.Path
+        { base = LName, container = { just = MPath } };
+      KPath = javakotlin.alpha.Path
+        { base = KName, container = { just = LPath } };
+      JPath = javakotlin.alpha.Path
+        { base = JName, container = { just = KPath } };
+      IPath = javakotlin.alpha.Path
+        { base = IName, container = { just = JPath } };
+      HPath = javakotlin.alpha.Path
+        { base = HName, container = { just = IPath } };
+      GPath = javakotlin.alpha.Path
+        { base = GName, container = { just = HPath } };
+      FPath = javakotlin.alpha.Path
+        { base = FName, container = { just = GPath } };
+      EPath = javakotlin.alpha.Path
+        { base = EName, container = { just = FPath } };
+      DPath = javakotlin.alpha.Path
+        { base = DName, container = { just = EPath } };
+      CPath = javakotlin.alpha.Path
+        { base = CName, container = { just = DPath } };
+      BPath = javakotlin.alpha.Path
+        { base = BName, container = { just = CPath } };
+      Path = javakotlin.alpha.Path
+        { base = AName, container = { just = BPath } };
+    )
+
+}
diff --git a/glean/schema/source/search.kind.cxx.angle b/glean/schema/source/search.kind.cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.kind.cxx.angle
@@ -0,0 +1,137 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.kind.cxx.1 {
+
+import cxx1
+import code.cxx
+
+#
+# Kind-partitioned name tables
+#
+# When kind filters are present want to lookup only the relevant kind names (as
+# opposed to finding all matches then filtering by kind).
+#
+# To do this we create a name lookup predicate per codemarkup.kind for each
+# language, and dispatch based on presence of kind flags
+#
+
+# Namespaces. Note: we don't look for using declarations as they're not super
+# interesting, even though they do have the kind: Namespace
+#
+predicate SearchNamespace :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.NamespaceDeclarationByName { NameStr, NSScope, Decl };
+  # we want to only restrict on scope after finding the specific names
+  # scope is either a specific parent namespace
+  # or re-interpret the null case (global_ as a namespace root)
+  # to find namespaces at the top level (e.g. "folly")
+    ( { namespace_ = NS } = Scope; NSScope = { just = NS } ) |
+    ( { global_ = {} } = Scope; NSScope = nothing );
+    { decl = { namespace_ = Decl } } = Entity;
+
+# class, struct, union all share decl kind `record`
+# for search performance we might store separate predicates for these,
+# as it means annoying repeated search in case of (Class|Struct|Union)
+
+predicate SearchClass :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.RecordDeclarationClass { NameStr, Scope, Decl };
+    { decl = { record_ = Decl }} = Entity
+
+predicate SearchStruct :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.RecordDeclarationStruct { NameStr, Scope, Decl };
+    { decl = { record_ = Decl }} = Entity
+
+predicate SearchUnion :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.RecordDeclarationUnion { NameStr, Scope, Decl };
+    { decl = { record_ = Decl }} = Entity
+
+# keyed by QName, so we risk redundantly enumerating all matching QNames
+predicate SearchEnum :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.EnumDeclarationByName { NameStr, Scope, Decl };
+    { decl = { enum_ = Decl }} = Entity
+
+predicate SearchFunction :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.FunctionDeclarationByNameScope { NameStr, Scope, Decl };
+    { decl = { function_ = Decl } } = Entity
+
+predicate SearchVariable :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.VariableDeclarationNonLocalByName { NameStr, Scope, Decl };
+    { decl = { variable = Decl } } = Entity
+
+predicate SearchEnumerator :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.EnumeratorByName { NameStr, Decl };
+    { enumeration = T } = Decl;
+    { name = QName, isScoped = Scoped } = T;
+    if ( false = Scoped )
+    then ( { scope = Scope } = QName)
+    else ( { recordWithAccess = { record = QName, access = Public }} = Scope);
+    { enumerator = Decl } = Entity
+
+predicate SearchTypeAlias :
+  {
+    name: string,
+    scope: cxx1.Scope,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Scope, Entity } where
+    cxx1.TypeAliasDeclarationByName { NameStr, Scope, Decl };
+    { decl = { typeAlias = Decl } } = Entity
+
+# subset of ObjC containers that are interfaces
+predicate SearchObjcInterface :
+  {
+    name: string,
+    entity: code.cxx.Entity
+  }
+  { NameStr, Entity } where
+    cxx1.ObjcContainerDeclarationInterface { NameStr, Decl };
+    { decl = { objcContainer = Decl } } = Entity
+
+}
diff --git a/glean/schema/source/search.kotlin.angle b/glean/schema/source/search.kotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.kotlin.angle
@@ -0,0 +1,25 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.kotlin.1 {
+
+import javakotlin.alpha
+import kotlin.alpha
+
+# SearchByQName can be used to search for symbols in any context
+predicate SearchByQName:
+  {
+    name : javakotlin.alpha.QName,
+    defn : kotlin.alpha.Declaration
+  }
+  { QName, Decl } where
+    ( CDecl = kotlin.alpha.ClassDeclaration { name = QName };
+      { class_ = CDecl } = Decl
+    ) | ( VDecl = kotlin.alpha.VariableDeclaration { name = QName };
+      { variable = VDecl } = Decl
+    ) | (
+      MName = javakotlin.alpha.MethodName { name = QName };
+      MDecl = kotlin.alpha.MethodDeclaration { name = MName };
+      { method = MDecl } = Decl
+    )
+
+}
diff --git a/glean/schema/source/search.pp.angle b/glean/schema/source/search.pp.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.pp.angle
@@ -0,0 +1,14 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.pp.2 {
+import pp1
+
+predicate SearchByName :
+  {
+    macro : pp1.Macro,
+    entity : pp1.Define,
+  }
+  { Macro, Entity }
+  where
+  Entity = pp1.Define { macro = Macro }
+}
diff --git a/glean/schema/source/search.python.angle b/glean/schema/source/search.python.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/search.python.angle
@@ -0,0 +1,205 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema search.python.1 {
+import python
+
+#
+# Generating SNames from an array of string fragments
+#
+# Python SNames can be really long so we support wildcard matches
+# on parent parts of the SName (unlike in Hack)
+#
+predicate QueryToScopeCase:
+  {
+    query : [string],
+    insensitive : bool, # if true , search insensitive
+    scopeName : maybe python.SName,
+  }
+  { Query, Case, SName } where
+    if ( [] = Query )
+    then (
+      true | false = Case;
+      SName = nothing : maybe python.SName
+     # one tuple
+    ) else if ( [A] = Query )
+    then (
+       PythonNameCase { Case, A, AName };
+       SN = { local_name = AName };
+       { just = SN } = SName
+     # two tuple
+    ) else if ( [B,A] = Query )
+    then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       SN_B = { local_name = BName };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # three tuple
+    ) else if ( [C,B,A] = Query )
+    then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       SN_C = { local_name = CName };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # four tuple
+    ) else if ( [D,C,B,A] = Query )
+    then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       SN_D = { local_name = DName };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # five tuple, are there any? yes there are many
+     ) else if ( [E,D,C,B,A] = Query )
+     then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       # nb. quite sensitive to ordering. we want to do the outermost first
+       SN_E = { local_name = EName };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+      # six tuple
+      ) else if ( [F,E,D,C,B,A] = Query )
+      then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       PythonNameCase { Case, F, FName };
+       SN_F = { local_name = FName };
+       SN_E = { EName, { just = SN_F } };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+
+     # seven tuple
+      ) else if ( [G,F,E,D,C,B,A] = Query )
+      then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       PythonNameCase { Case, F, FName };
+       PythonNameCase { Case, G, GName };
+       SN_G = { local_name = GName };
+       SN_F = { FName, { just = SN_G } };
+       SN_E = { EName, { just = SN_F } };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # eight tuple
+      ) else if ( [H,G,F,E,D,C,B,A] = Query )
+      then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       PythonNameCase { Case, F, FName };
+       PythonNameCase { Case, G, GName };
+       PythonNameCase { Case, H, HName };
+       SN_H = { local_name = HName };
+       SN_G = { GName, { just = SN_H } };
+       SN_F = { FName, { just = SN_G } };
+       SN_E = { EName, { just = SN_F } };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # nine tuple
+      ) else if ( [I,H,G,F,E,D,C,B,A] = Query )
+      then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       PythonNameCase { Case, F, FName };
+       PythonNameCase { Case, G, GName };
+       PythonNameCase { Case, H, HName };
+       PythonNameCase { Case, I, IName };
+       SN_I = { local_name = IName };
+       SN_H = { HName, { just = SN_I } };
+       SN_G = { GName, { just = SN_H } };
+       SN_F = { FName, { just = SN_G } };
+       SN_E = { EName, { just = SN_F } };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+     # ten tuple
+      ) else if ( [J,I,H,G,F,E,D,C,B,A] = Query )
+      then (
+       PythonNameCase { Case, A, AName };
+       PythonNameCase { Case, B, BName };
+       PythonNameCase { Case, C, CName };
+       PythonNameCase { Case, D, DName };
+       PythonNameCase { Case, E, EName };
+       PythonNameCase { Case, F, FName };
+       PythonNameCase { Case, G, GName };
+       PythonNameCase { Case, H, HName };
+       PythonNameCase { Case, I, IName };
+       PythonNameCase { Case, J, JName };
+       SN_J = { local_name = JName };
+       SN_I = { IName, { just = SN_J } };
+       SN_H = { HName, { just = SN_I } };
+       SN_G = { GName, { just = SN_H } };
+       SN_F = { FName, { just = SN_G } };
+       SN_E = { EName, { just = SN_F } };
+       SN_D = { DName, { just = SN_E } };
+       SN_C = { CName, { just = SN_D } };
+       SN_B = { BName, { just = SN_C } };
+       SN_A = { AName, { just = SN_B } };
+       { just = SN_A } = SName
+      ) else
+       ( SName = never : maybe python.SName )
+
+# Helper to lookup python.Name based on case sensitivity
+predicate PythonNameCase:
+  {
+    insensitive: bool,
+    namestr : string,
+    name : python.Name
+  }
+  { Insensitive, NameStr, Name } where
+    ( true = Insensitive;
+      # we only need to know if it is in one of these. please short circuit
+      if ( python.SearchClassByLowerCaseName { NameStr, LocalNameStr } )
+      then ( LocalNameStr )
+      else if ( python.SearchModuleByLowerCaseName { NameStr, LocalNameStr } )
+      then ( LocalNameStr )
+      else if ( python.SearchFunctionByLowerCaseName { NameStr, LocalNameStr } )
+      then ( LocalNameStr )
+      else ( never: string );
+      Name = python.Name LocalNameStr
+    ) | (
+      false = Insensitive;
+      # double negation to check for existence
+      !(!(python.SearchClassByName { name = NameStr } |
+           python.SearchModuleByName { name = NameStr } |
+            python.SearchFunctionByName { name = NameStr } ));
+      Name = python.Name NameStr
+    )
+
+}
diff --git a/glean/schema/source/src.angle b/glean/schema/source/src.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/src.angle
@@ -0,0 +1,155 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema src.1 {
+
+# Path to the source file relative to the repository root
+predicate File : string
+
+# Source code digests produced by unspecified hash function
+predicate FileDigest : File -> string
+
+# Common source code location type
+type Loc = {
+  file : File,
+  line : nat,
+  column : nat,
+   # Each Unicode code point occupies one column, even if it spans multiple
+   # bytes. Combining characters are not taken into account.
+   # A tab character occupies a single column.
+}
+
+# Common source code range type
+# Expect: 1-based line and column numbers, Begin and End are inclusive.
+type Range = {
+  file : File,
+  lineBegin : nat,
+  columnBegin : nat,
+  lineEnd : nat,
+  columnEnd : nat,
+}
+
+# DEPRECATED
+type ByteRange = {
+  begin : nat,
+  end : nat,
+}
+
+predicate FileLines : {
+  file : File,
+  lengths : [nat],
+    # length in bytes of each line, including the terminating newline (if any)
+    # NOTE: we store length rather than offset because it is shorter;
+    # offsets can be recovered via scanl' (+) 0
+  endsInNewline : bool,
+    # does the last line end in a newline?
+  hasUnicodeOrTabs : bool,
+    # does the file have any multibyte UTF-8 code points or tabs
+    # i.e. char > 0x7F || c == '\t'
+}
+
+# A span of bytes within a file
+# NB. Byte spans don't assume any conversion of the source code, so CRLF counts
+# as two bytes
+type ByteSpan = {
+  start : nat,
+  length : nat,
+}
+
+# A span of bytes where the start is given as an offset from the start of
+# the previous span
+type RelByteSpan = {
+  offset : nat,
+  length : nat,
+}
+
+# Predicate to check if one bytespan contains another. This includes
+# if the two spans are equal
+predicate ByteSpanContains :
+  {
+    byteSpan: ByteSpan,
+    contains: ByteSpan
+  }
+  {S1, S2} where
+    {Start1, Len1} = S1;
+    {Start2, Len2} = S2;
+    End1=Start1+Len1;
+    End2=Start2+Len2;
+    Start1<=Start2;
+    End2<=End1
+
+predicate RangeContains :
+  {
+    fileLines : Range,
+    contains: Range
+  }
+  {S1, S2} where
+    {F, LB1, CB1, LE1, CE1} = S1;
+    {F, LB2, CB2, LE2, CE2} = S2;
+    LB1 <= LB2;
+    LE2 <= LE1;
+    (LB1 < LB2 | CB1 <= CB2);
+    (LE2 < LE1 | CE2 <= CE1)
+
+# Packed representation for a list of byte spans
+#
+# This is represented as a list of relative offsets grouped by length.
+# Each group represents a sequence of byte spans of the same length.
+#
+# Offsets are relative to the previous offset, to the last offset of
+# the previous group if this is the first offset of a group, or to
+# the start of the file if this is the first offset of the first group.
+#
+# Note that we can only group spans of the same length if they are adjacent
+# in the sequence; each span that differs in length from the previous span
+# will result in a new group.
+#
+# For example, given a list of offsets like:
+#
+#   [
+#     { length: 2, offsets: [1] },
+#     { length: 3, offsets: [3, 5] },
+#     { length: 2, offsets: [4] },
+#   ]
+#
+# The full, expanded list of (absolute offset, length) is:
+#
+#   [ (1, 2), (4, 3), (9, 3), (13, 2) ]
+#
+# Use the primitive `prim.unpackByteSpans` to convert this to `[ByteSpan]`.
+type PackedByteSpansGroup = { length : nat, offsets : [nat], }
+type PackedByteSpans = [PackedByteSpansGroup]
+
+# Kind of language supported by Glean
+type Language = enum {
+  Buck | C | Cpp | Hack | Haskell  |
+  ObjC | ObjCpp | Python | Thrift | Java | GraphQL
+}
+
+# Maps a file into the kind of language
+predicate FileLanguage : {
+  file : File,
+  language : Language
+}
+
+type FileLocation = {
+  file : File,
+  span : ByteSpan,
+}
+
+# Why didn't Glean Indexer index a particular file?
+type IndexFailureReason = enum {
+  CompileError |
+  BuildSystemError |
+  Unclassified |
+  DiscoveryError
+}
+
+# It is a good practice to add all errors directly into db
+# so it is easy to classify and investigate errors in future
+predicate IndexFailure : {
+  file : File,
+  reason : IndexFailureReason,
+  details : string,
+}
+
+}
diff --git a/glean/schema/source/symbolid.cxx.angle b/glean/schema/source/symbolid.cxx.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/symbolid.cxx.angle
@@ -0,0 +1,210 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema symbolid.cxx.1 {
+import src
+import code.cxx
+import codemarkup.types
+import cxx1
+
+# Decoding C++ symbolids to entities is challenging
+#
+# Unlike search.code.searchByScope we need to be able to resolve all entities, including exotic
+# things, and separately restrict results to defn, defs or enums
+#
+# Unlike codemarkup.cxx.*resolve* we do want to mingle defn and decl (and enum) types, but rather
+# explicitly choose
+#
+# So this "decoder" does all the decl and def lookups for all entity types, exposing a comprehensive
+# symbol id lookup layer to glass
+#
+predicate LookupDefinition:
+  {
+    name : cxx1.Name,
+    scope : cxx1.Scope,
+    entity : code.cxx.Entity
+  }
+  { Name, Scope, Defn } where
+    LookupDeclaration { Name, Scope, Decl };
+    DefinitionOfDecl { Decl, Defn };
+
+predicate LookupFunctionDefinition:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    entity : code.cxx.Entity
+  }
+  { Name, Scope, Defn } where
+    LookupFunctionDeclaration { Name, Scope, Decl };
+    DefinitionOfDecl { Decl, Defn }
+
+# Like LookupFunctionDefinition but take an additional signature term
+predicate LookupFunctionSignatureDefinition:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    signature : cxx1.Signature,
+    entity : code.cxx.Entity
+  }
+  { Name, Scope, Sig, Defn } where
+    LookupFunctionSignatureDeclaration { Name, Scope, Sig, Decl };
+    DefinitionOfDecl { Decl, Defn }
+
+# Like LookupFunctionDefinition but take an additional signature term
+predicate LookupFunctionSignatureQualifierDefinition:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    signature : cxx1.Signature,
+    qualifiers : maybe cxx1.MethodSignature,
+    entity : code.cxx.Entity
+  }
+  { Name, Scope, Sig, Quals, Defn } where
+    LookupFunctionSignatureQualifierDeclaration {Name, Scope, Sig, Quals, Decl};
+    DefinitionOfDecl { Decl, Defn }
+
+predicate LookupNamespaceDefinition:
+  {
+    name : maybe cxx1.Name,
+    parent : maybe cxx1.NamespaceQName,
+    entity : code.cxx.Entity
+  }
+  { Name, Parent, Defn } where
+    LookupNamespaceDeclaration { Name, Parent, Decl };
+    DefinitionOfDecl { Decl, Defn }
+
+#
+# Actually finding things. C++ is indexed decl-first. So lookup is via decls
+#
+
+#
+# By cxx1.Name and cxx1.Scope fact (as cxx1.QName)
+#
+# Many things are found this way. (Records are structs, classes or unions).
+#
+predicate LookupDeclaration:
+  {
+    name : cxx1.Name,
+    scope : cxx1.Scope,
+    decl : cxx1.Declaration
+  }
+  { Name, Scope, Decl } where
+  # records, variables, enums, type aliases
+  Q = cxx1.QName { Name, Scope };
+  ( D = cxx1.RecordDeclaration { name = Q }; { record_ = D } ) |
+  ( D = cxx1.VariableDeclaration { name = Q }; { variable = D } ) |
+  ( D = cxx1.EnumDeclaration { name = Q }; { enum_ = D } ) |
+  ( D = cxx1.TypeAliasDeclaration { name = Q }; { typeAlias = D } ) |
+  ( D = cxx1.UsingDirective { name = Q }; { usingDirective = D } ) = Decl
+
+#
+# By cxx1.FunctionName and cxx1.Scope fact
+#
+# Function declarations are keyed by the FunctionName predicate.
+# UsingDeclarations are also here.
+#
+# Unlike cxx1.Name to find operators, constructors, etc you need a
+# cxx1.FunctionName search
+#
+predicate LookupFunctionDeclaration:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    decl : cxx1.Declaration
+  }
+  { Name, Scope, Decl } where
+    FQN = cxx1.FunctionQName { Name, Scope };
+    ( D = cxx1.FunctionDeclaration { name = FQN }; { function_ = D }) | (
+      D = cxx1.UsingDeclaration { name = FQN }; { usingDeclaration = D }
+    ) = Decl
+
+#
+# By cxx1.FunctionName and cxx1.Scope fact and signature
+#
+# Like LookupFunctionDeclaration but you can provide a signature
+# query as well to choose between overloaded functions/constructors
+#
+predicate LookupFunctionSignatureDeclaration:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    signature : cxx1.Signature,
+    decl : cxx1.Declaration
+  }
+  { Name, Scope, Sig, Decl } where
+    FQN = cxx1.FunctionQName { Name, Scope };
+    ( D = cxx1.FunctionDeclaration { name = FQN, signature = Sig };
+      { function_ = D }
+    ) = Decl
+
+#
+# Like LookupFunctionSignature Declaration but you can provide a set of
+# method qualifiers (e.g. cv or ref qualifiers) to help choose between even
+# more overloaded things
+#
+predicate LookupFunctionSignatureQualifierDeclaration:
+  {
+    name : cxx1.FunctionName,
+    scope : cxx1.Scope,
+    signature : cxx1.Signature,
+    qualifiers : maybe cxx1.MethodSignature,
+    decl : cxx1.Declaration
+  }
+  { Name, Scope, Sig, Quals, Decl } where
+    FQN = cxx1.FunctionQName { Name, Scope };
+    ( D = cxx1.FunctionDeclaration
+            { name = FQN, signature = Sig, method = Quals };
+      { function_ = D }
+    ) = Decl
+
+# Namespace QNames are also a bit tricky as they can be anonymous
+# so there are `nothing` holes in the patterns.
+#
+predicate LookupNamespaceDeclaration:
+  {
+    name : maybe cxx1.Name, # n.b can be anonymous
+    parent : maybe cxx1.NamespaceQName,
+    decl : cxx1.Declaration
+  }
+  { Name, Parent, Decl } where
+    NSN = cxx1.NamespaceQName { Name, Parent };
+    D = cxx1.NamespaceDeclaration { name = NSN };
+    { namespace_ = D } = Decl
+
+# enumerators, fields of enums, keyed by the field and the parent enum qname
+predicate LookupEnumerator:
+  {
+    name : cxx1.Name,
+    parent : cxx1.Name,
+    scope : cxx1.Scope,
+    decl : cxx1.Enumerator
+  }
+  { Name, Parent, Scope, Enum } where
+    Q = cxx1.QName { Parent, Scope };
+    Decl = cxx1.EnumDeclaration { name = Q };
+    cxx1.Enumerator { name = Name, enumeration = Decl } = Enum
+
+# todo : Objective-C things are another kettle of fish
+
+#
+# Internal helpers
+#
+
+#
+# Find direct definition entities for various declaration types
+# If its not in the set we ignore it. We only want to return actual definitions
+#
+# Definitions narrow down the decl space to anchor or base declarations that
+# are usually what you want to know things about.
+#
+# Unlike search.cxx.DeclIsDefn, this should find _all_ definitions, via the
+# decl family.
+#
+predicate DefinitionOfDecl:
+  {
+    decl : cxx1.Declaration,
+    entity : code.cxx.Entity
+  }
+  { Decl, { defn = Defn } } where
+    code.cxx.DeclToDef { Decl, Defn }; # its a def if code.cxx.DeclToDef decides
+
+}
diff --git a/glean/schema/source/symbolid.java.angle b/glean/schema/source/symbolid.java.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/symbolid.java.angle
@@ -0,0 +1,51 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema symbolid.java.1 {
+
+import src
+import code.java
+import codemarkup.types
+import java.alpha
+import javakotlin.alpha
+
+# You can find everything other than methods and ctors via a qname alone
+predicate LookupDeclaration:
+  {
+    qname: javakotlin.alpha.QName,
+    decl : java.alpha.Declaration
+  }
+  { QName, Decl } where
+    ( CDecl = java.alpha.ClassDeclaration { name = QName };
+      { class_ = CDecl } = Decl
+    ) | (
+      IDecl = java.alpha.InterfaceDeclaration { name = QName };
+      { interface_ = IDecl } = Decl
+    ) | (
+      EDecl = java.alpha.EnumDeclaration { name = QName };
+      { enum_ = EDecl } = Decl
+    ) | (
+      FDecl = java.alpha.FieldDeclaration { name = QName };
+      { field = FDecl } = Decl
+    ) | (
+      LDecl = java.alpha.LocalDeclaration { name = QName };
+      { local = LDecl } = Decl
+    ) | (
+      PDecl = java.alpha.ParameterDeclaration { name = QName };
+      { param = PDecl } = Decl
+    );
+
+# Otherwise fetch a method or a ctor.
+predicate LookupMethodDeclaration:
+  {
+    mname: javakotlin.alpha.MethodName,
+    decl : java.alpha.Declaration
+  }
+  { MName, Decl } where
+    ( MDecl = java.alpha.MethodDeclaration { name = MName };
+      { method = MDecl } = Decl
+    ) | (
+      CDecl = java.alpha.ConstructorDeclaration { name = MName };
+      { ctor = CDecl } = Decl
+    );
+
+}
diff --git a/glean/schema/source/symbolid.kotlin.angle b/glean/schema/source/symbolid.kotlin.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/symbolid.kotlin.angle
@@ -0,0 +1,35 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema symbolid.kotlin.1 {
+
+import src
+import code.kotlin
+import codemarkup.types
+import kotlin.alpha
+import javakotlin.alpha
+
+# You can find everything other than methods and ctors via a qname alone
+predicate LookupDeclaration:
+  {
+    qname: javakotlin.alpha.QName,
+    decl : kotlin.alpha.Declaration
+  }
+  { QName, Decl } where
+    ( CDecl = kotlin.alpha.ClassDeclaration { name = QName };
+      { class_ = CDecl } = Decl
+    ) | (
+      VDecl = kotlin.alpha.VariableDeclaration { name = QName };
+      { variable = VDecl } = Decl
+    );
+
+# Otherwise fetch a method or a ctor.
+predicate LookupMethodDeclaration:
+  {
+    mname: javakotlin.alpha.MethodName,
+    decl : kotlin.alpha.Declaration
+  }
+  { MName, Decl } where
+    MDecl = kotlin.alpha.MethodDeclaration { name = MName };
+    { method = MDecl } = Decl
+
+}
diff --git a/glean/schema/source/test.angle b/glean/schema/source/test.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/test.angle
@@ -0,0 +1,284 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates
+
+# An old version, just so that we can test versions
+schema glean.test.0 {
+
+predicate Predicate : string
+
+}
+
+schema glean.test.6 : glean.test.0 {
+import sys
+import code.cxx   # for Entity
+import pp1        # for Entity
+
+# Named enumerated type for testing
+type Enum_ = enum { red | green | blue }
+
+# Named sum type for testing
+type Sum =
+  {
+    mon : byte |
+    tue : nat |
+    wed : bool |
+  }
+
+# Named record type for testing
+type Rec =
+  {
+    alpha : Enum_,
+    beta : Sum,
+  }
+
+type ArrayByte = [byte]
+type ArrayNat = [nat]
+type ArrayBool = [bool]
+type ArrayString = [string]
+
+# A pair of strings
+predicate StringPair : { fst : string, snd : string }
+
+# Reverse glean.test.StringPair
+predicate RevStringPair : { fst : string, snd : string }
+  {A,B} where StringPair {B,A}
+
+# Stored version of RevStringPair
+predicate StoredRevStringPair : { fst : string, snd : string }
+  stored {A,B} where StringPair {B,A}
+
+predicate StoredRevStringPairWithA : { fst: string, snd: string }
+  stored {A,B} where A="a"; StoredRevStringPair {B,A}
+
+# stored predicate depending on non-stored one
+predicate StoredRevStringPairWithRev : { fst: string, snd: string }
+  stored {A,B} where RevStringPair {B,A}
+
+# Stored predicate with query statement containing an alternative
+predicate StoredRevStringPairSum : { fst: string, snd: string }
+  stored { A, A } where
+  (StoredRevStringPair{A,_}) | (StoredRevStringPairWithA{A,_})
+
+# Reverse glean.test.StringPair
+predicate RevStringPairRec : { fst : string, snd : string }
+  { fst = A, snd = B } where StringPair { fst = B, snd = A }
+
+# Reverse glean.test.StringPair twice
+predicate RevRevStringPair : { fst : string, snd : string }
+  {A,B} where RevStringPair {B,A}
+
+# find a dual pair of StringPairs
+predicate DualStringPair : { fst : StringPair, snd : StringPair }
+  {P,Q} where
+    P = StringPair {A,B};
+    Q = StringPair {B,A}
+
+# stored version of DualStringPair
+predicate StoredDualStringPair : { fst : StringPair, snd : StringPair }
+  stored {P,Q} where
+    P = StringPair {A,B};
+    Q = StringPair {B,A}
+
+# StringPair with identical fields
+predicate ReflStringPair : string
+  A where StringPair {A,A}
+
+# find a sequence of two StringPair edges from A to B via C
+predicate ViaStringPair : { fst : string, snd : string }
+  {A,B} where StringPair {A,C}; StringPair {C,B}
+
+# Nested derived predicate
+predicate RevStringPairs : { x : string, r : RevStringPair }
+  {X,R} where R = RevStringPair {_,X}
+
+# A union of string pairs
+type WrappedStringPair = { wrapped : StringPair }
+
+# First of either side of EitherStringPair
+ predicate StringPairBox :
+   {
+     box: StringPair,
+   }
+   { box=X } where
+     # A statement with multiple unbound variables on both sides
+     [{wrapped = X }:WrappedStringPair, {wrapped = Y }:WrappedStringPair] = [P:WrappedStringPair, Q];
+     X=Y;
+     P=Q
+
+# A stored predicate with no facts
+predicate EmptyStoredStringPair : { fst: string, snd: string }
+  stored
+  {C,D} where
+    A = StringPair {"a",_};
+    B = StringPair {"b",_};
+    A = B;
+    A = StringPair {C,D};
+
+# If Y is bound, then it is matched against "a", but if Y is unbound
+# then it will become bound to "a".
+predicate Unbound : { x : string, y : string }
+  {X,Y} where "a" = Y; RevStringPair {X,Y}
+
+# A query that requires either X or Y to be bound
+predicate Unbound2 : { x : string, y : string }
+  {X,Y} where X = Y; RevStringPair {X,Y}
+
+predicate IsThree : nat
+  3
+
+predicate IsGlean : string
+  "glean"
+
+# sum type in a derived predicate head
+predicate MatchOneAlt : { x : Sum, y : nat }
+  { { tue = N }, N } where N = 3
+
+predicate LeftOr : { x : string, y : nat }
+  { X, Y } where
+  { X, Y } =
+    ( ({ X, (1 where X = "cat")} ) |
+    ({ X, (2 where X = "dog")} )
+    where
+    _ = 3
+    )
+
+predicate LeftOr2 : { x : string, y : nat }
+  ( ({ X, (1 where X = "cat")} ) |
+    ({ X, (2 where X = "dog")} )
+    where
+    _ = 3
+  )
+
+predicate SameString : { x : string, y : string }
+  { X, X } where X = [ "a", "b", "c" ] [..]
+
+# A variable name
+predicate Name : string
+
+predicate Expr :
+  {
+    var_ : Name |
+    lit : nat |
+    prim : Name |
+    ap : { fun : Expr, arg : Expr } |
+    lam : { var_ : Name, body : Expr } |
+  }
+
+# A key-value pair
+predicate KeyValue :
+  { kstring : string, knat : nat }
+  -> { vnat : nat, vstring : string }
+
+# Derived from a key-value predicate
+predicate DerivedKeyValue :
+  { kstring : string, knat : nat, vnat : nat, vstring : string }
+  {KS,KN,VN,VS} where KeyValue {KS,KN} -> {VN,VS}
+
+# And back again
+predicate DerivedKeyValue2 :
+  { kstring : string, knat : nat } -> { vnat : nat, vstring : string }
+  {KS,KN} -> {VN,VS} where DerivedKeyValue {KS,KN,VN,VS}
+
+# Type for testing all the different Glean types
+type KitchenSink =
+  {
+    byt : byte,
+    nat : nat,
+    bool_ : bool,
+    string_ : string,
+    pred : sys.Blob,
+    maybe_ : maybe {},
+    record_ : { a : byte, b : nat },
+    sum_ : {
+      c : Predicate |  # recursive predicate reference
+      d : sys.Blob
+    },
+    enum_ : enum { e | f | g },
+    named_record_ : Rec,
+    named_sum_ : Sum,
+    named_enum_ : Enum_,
+    array_of_byte : [byte],
+    array_of_nat : [nat],
+    array_of_bool : [bool],
+    array_of_string : [string],
+    array_of_pred : [Predicate],
+    array_of_named_record : [Rec],
+    array_of_named_sum : [Sum],
+    array_of_named_enum : [Enum_],
+    # FIXME: we currently don't support directly nested arrays (T60313773)
+    array2_of_byte : [ArrayByte],
+    array2_of_nat : [ArrayNat],
+    array2_of_bool : [ArrayBool],
+    array2_of_string : [ArrayString],
+    set_of_nat : set nat,
+    set_of_string : set string,
+    set_of_pred : set Predicate,
+   }
+
+predicate Predicate : KitchenSink
+
+# Test direct ref to another fact
+predicate Ref : Predicate
+predicate RefRef : Ref
+
+# Simple graph types
+predicate Node : { label : string }
+predicate Edge : { parent : Node, child : Node }
+
+# For testing derived predicate ownership:
+predicate RevEdge : { child : Node, parent : Node }
+  stored { A, B } where Edge { B, A }
+
+predicate SkipRevEdge : { child : Node, grandparent : Node }
+  stored { A, C } where RevEdge { A, B }; RevEdge { B, C }
+
+predicate NodePair : { fst : Node, snd : Node }
+  stored { X, Y } where X = Node _; Y = Node _; X != Y
+
+predicate IsParent : Node
+  stored P where Edge { parent = P }
+
+predicate EdgeFromNotA : Edge
+  stored E where E = Edge { A, _ }; A = { label = N }; N != "a"
+
+# Recursive binary tree (DAG) type
+predicate Tree :
+  {
+    node : Node,
+    left : maybe Tree,
+    right : maybe Tree
+  }
+
+# Predicates to test reordering of nested structures
+predicate EdgeWrapper : { edge : Edge }
+
+type EdgeSum = {
+    fst : EdgeWrapper |
+    snd : EdgeWrapper |
+  }
+
+# Make a partial verion of code.Entity to test SymId encode/decode
+type Entity =
+  {
+    cxx : code.cxx.Entity |
+    pp : pp1.Define |
+  }
+
+predicate nothingTest : { a: maybe string, b: nat }
+  { nothing, 3 }
+
+# Predicates to test recursive expansion of nested keys
+predicate TreeToTree : Tree -> Tree
+
+# Predicates to test recursive expansion of nested values
+predicate Foo : string -> Bar
+
+predicate Bar : string -> Qux
+
+predicate Qux : string
+
+predicate FooToFoo : Foo -> Foo
+
+# To test predicates without facts
+predicate EmptyPred : string
+
+}
diff --git a/glean/schema/source/yaml.angle b/glean/schema/source/yaml.angle
new file mode 100644
--- /dev/null
+++ b/glean/schema/source/yaml.angle
@@ -0,0 +1,19 @@
+# Copyright (c) Meta Platforms, Inc. and affiliates.
+
+schema yaml.1 {
+    import builtin.1
+    import src
+    import python
+
+    type XRefViaName = {
+        target: python.Name,
+        source: src.ByteSpan,
+        decl: maybe python.Declaration,
+    }
+
+    # There is only one fact of this predicate per source file in the repo.
+    predicate XRefsByFile: {
+        file: src.File,
+        xrefs: [XRefViaName],
+    }
+}
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Anglelang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Anglelang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Anglelang/Types.hs
@@ -0,0 +1,2871 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/anglelang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/anglelang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/anglelang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Anglelang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Anglelang.Types
+       (pREDICATE_VERSIONS, TypeDecl_id,
+        TypeDecl(TypeDecl, typeDecl_id, typeDecl_key), Name_id,
+        Name(Name, name_id, name_key), Type_id,
+        Type(Type, type_id, type_key), EvolveDecl_id,
+        EvolveDecl(EvolveDecl, evolveDecl_id, evolveDecl_key),
+        DerivingDecl_id,
+        DerivingDecl(DerivingDecl, derivingDecl_id, derivingDecl_key),
+        PredicateDecl_id,
+        PredicateDecl(PredicateDecl, predicateDecl_id, predicateDecl_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationToName_id,
+        DeclarationToName(DeclarationToName, declarationToName_id,
+                          declarationToName_key, declarationToName_value),
+        SchemaDecl_id,
+        SchemaDecl(SchemaDecl, schemaDecl_id, schemaDecl_key),
+        TargetUses_id,
+        TargetUses(TargetUses, targetUses_id, targetUses_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        TypeDecl_key(TypeDecl_key, typeDecl_key_name, typeDecl_key_ty),
+        ImportStmt, Field(Field, field_name, field_ty),
+        Type_key(Type_key_EMPTY, Type_key_boolean_, Type_key_byte_,
+                 Type_key_nat_, Type_key_string_, Type_key_array_, Type_key_set_,
+                 Type_key_maybe_, Type_key_record_, Type_key_sum_,
+                 Type_key_predicate_, Type_key_named_, Type_key_enum_),
+        EvolveDecl_key(EvolveDecl_key, evolveDecl_key_new_,
+                       evolveDecl_key_old_),
+        DeriveInfo(DeriveInfo_NoDeriving, DeriveInfo_OnDemand,
+                   DeriveInfo_Stored, DeriveInfo_IfEmpty, DeriveInfo__UNKNOWN),
+        DerivingDecl_key(DerivingDecl_key, derivingDecl_key_name,
+                         derivingDecl_key_derive_),
+        PredicateDecl_key(PredicateDecl_key, predicateDecl_key_name,
+                          predicateDecl_key_keyTy, predicateDecl_key_valTy,
+                          predicateDecl_key_derived),
+        Declaration(Declaration_EMPTY, Declaration_pred, Declaration_ty,
+                    Declaration_schema, Declaration_imp, Declaration_evolve,
+                    Declaration_derive_),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_decl, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationToName_value,
+        SchemaDecl_key(SchemaDecl_key, schemaDecl_key_name,
+                       schemaDecl_key_declarations),
+        XRefTarget(XRefTarget, xRefTarget_ref),
+        TargetUses_key(TargetUses_key, targetUses_key_target,
+                       targetUses_key_file, targetUses_key_uses),
+        XRef(XRef, xRef_target, xRef_span),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/anglelang_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 127 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Anglelang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("Type", 1), ("TypeDecl", 1), ("Name", 1), ("SchemaDecl", 1),
+       ("FileXRefs", 1), ("PredicateDecl", 1), ("TargetUses", 1),
+       ("DeclarationLocation", 1), ("DeclarationToName", 1),
+       ("DerivingDecl", 1), ("EvolveDecl", 1)]
+
+type TypeDecl_id = Glean.Id
+
+data TypeDecl = TypeDecl{typeDecl_id ::
+                         {-# UNPACK #-} !TypeDecl_id,
+                         typeDecl_key :: Prelude.Maybe TypeDecl_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDecl where
+  toJSON (TypeDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDecl where
+  buildStruct _proxy (TypeDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDecl where
+  rnf (TypeDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDecl where
+  def = TypeDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDecl where
+  hashWithSalt __salt (TypeDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Type_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EvolveDecl_id = Glean.Id
+
+data EvolveDecl = EvolveDecl{evolveDecl_id ::
+                             {-# UNPACK #-} !EvolveDecl_id,
+                             evolveDecl_key :: Prelude.Maybe EvolveDecl_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EvolveDecl where
+  toJSON (EvolveDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EvolveDecl where
+  buildStruct _proxy (EvolveDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EvolveDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EvolveDecl where
+  rnf (EvolveDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EvolveDecl where
+  def = EvolveDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable EvolveDecl where
+  hashWithSalt __salt (EvolveDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DerivingDecl_id = Glean.Id
+
+data DerivingDecl = DerivingDecl{derivingDecl_id ::
+                                 {-# UNPACK #-} !DerivingDecl_id,
+                                 derivingDecl_key :: Prelude.Maybe DerivingDecl_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivingDecl where
+  toJSON (DerivingDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivingDecl where
+  buildStruct _proxy (DerivingDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DerivingDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivingDecl where
+  rnf (DerivingDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DerivingDecl where
+  def = DerivingDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable DerivingDecl where
+  hashWithSalt __salt (DerivingDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PredicateDecl_id = Glean.Id
+
+data PredicateDecl = PredicateDecl{predicateDecl_id ::
+                                   {-# UNPACK #-} !PredicateDecl_id,
+                                   predicateDecl_key :: Prelude.Maybe PredicateDecl_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateDecl where
+  toJSON (PredicateDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateDecl where
+  buildStruct _proxy (PredicateDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PredicateDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateDecl where
+  rnf (PredicateDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PredicateDecl where
+  def = PredicateDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable PredicateDecl where
+  hashWithSalt __salt (PredicateDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationToName_id = Glean.Id
+
+data DeclarationToName = DeclarationToName{declarationToName_id ::
+                                           {-# UNPACK #-} !DeclarationToName_id,
+                                           declarationToName_key :: Prelude.Maybe Declaration,
+                                           declarationToName_value ::
+                                           Prelude.Maybe DeclarationToName_value}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationToName where
+  toJSON (DeclarationToName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationToName where
+  buildStruct _proxy
+    (DeclarationToName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DeclarationToName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationToName where
+  rnf (DeclarationToName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DeclarationToName where
+  def = DeclarationToName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DeclarationToName where
+  hashWithSalt __salt (DeclarationToName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type SchemaDecl_id = Glean.Id
+
+data SchemaDecl = SchemaDecl{schemaDecl_id ::
+                             {-# UNPACK #-} !SchemaDecl_id,
+                             schemaDecl_key :: Prelude.Maybe SchemaDecl_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaDecl where
+  toJSON (SchemaDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SchemaDecl where
+  buildStruct _proxy (SchemaDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SchemaDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SchemaDecl where
+  rnf (SchemaDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SchemaDecl where
+  def = SchemaDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable SchemaDecl where
+  hashWithSalt __salt (SchemaDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetUses_id = Glean.Id
+
+data TargetUses = TargetUses{targetUses_id ::
+                             {-# UNPACK #-} !TargetUses_id,
+                             targetUses_key :: Prelude.Maybe TargetUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses where
+  toJSON (TargetUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses where
+  buildStruct _proxy (TargetUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses where
+  rnf (TargetUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetUses where
+  def = TargetUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetUses where
+  hashWithSalt __salt (TargetUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data TypeDecl_key = TypeDecl_key{typeDecl_key_name :: Name,
+                                 typeDecl_key_ty :: Type}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDecl_key where
+  toJSON (TypeDecl_key __field__name __field__ty)
+    = Aeson.object
+        ("name" .= __field__name : "ty" .= __field__ty : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDecl_key where
+  buildStruct _proxy (TypeDecl_key __field__name __field__ty)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "ty" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ty)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__ty <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ty
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__ty <- ST.readSTRef __field__ty
+                                             Prelude.pure (TypeDecl_key __val__name __val__ty)
+              _idMap = HashMap.fromList [("name", 1), ("ty", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDecl_key where
+  rnf (TypeDecl_key __field__name __field__ty)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__ty `Prelude.seq` ()
+
+instance Default.Default TypeDecl_key where
+  def = TypeDecl_key Default.def Default.def
+
+instance Hashable.Hashable TypeDecl_key where
+  hashWithSalt __salt (TypeDecl_key _name _ty)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _ty
+
+type ImportStmt = Name
+
+data Field = Field{field_name :: Name, field_ty :: Type}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field where
+  toJSON (Field __field__name __field__ty)
+    = Aeson.object
+        ("name" .= __field__name : "ty" .= __field__ty : Prelude.mempty)
+
+instance Thrift.ThriftStruct Field where
+  buildStruct _proxy (Field __field__name __field__ty)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "ty" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ty)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__ty <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ty
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__ty <- ST.readSTRef __field__ty
+                                             Prelude.pure (Field __val__name __val__ty)
+              _idMap = HashMap.fromList [("name", 1), ("ty", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Field where
+  rnf (Field __field__name __field__ty)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__ty `Prelude.seq` ()
+
+instance Default.Default Field where
+  def = Field Default.def Default.def
+
+instance Hashable.Hashable Field where
+  hashWithSalt __salt (Field _name _ty)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _ty
+
+data Type_key = Type_key_boolean_ Glean.Schema.Builtin.Unit
+              | Type_key_byte_ Glean.Schema.Builtin.Unit
+              | Type_key_nat_ Glean.Schema.Builtin.Unit
+              | Type_key_string_ Glean.Schema.Builtin.Unit
+              | Type_key_array_ Type
+              | Type_key_set_ Type
+              | Type_key_maybe_ Type
+              | Type_key_record_ [Field]
+              | Type_key_sum_ [Field]
+              | Type_key_predicate_ Name
+              | Type_key_named_ Name
+              | Type_key_enum_ [Name]
+              | Type_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_key where
+  toJSON (Type_key_boolean_ __boolean_)
+    = Aeson.object ["boolean_" .= __boolean_]
+  toJSON (Type_key_byte_ __byte_) = Aeson.object ["byte_" .= __byte_]
+  toJSON (Type_key_nat_ __nat_) = Aeson.object ["nat_" .= __nat_]
+  toJSON (Type_key_string_ __string_)
+    = Aeson.object ["string_" .= __string_]
+  toJSON (Type_key_array_ __array_)
+    = Aeson.object ["array_" .= __array_]
+  toJSON (Type_key_set_ __set_) = Aeson.object ["set_" .= __set_]
+  toJSON (Type_key_maybe_ __maybe_)
+    = Aeson.object ["maybe_" .= __maybe_]
+  toJSON (Type_key_record_ __record_)
+    = Aeson.object ["record_" .= __record_]
+  toJSON (Type_key_sum_ __sum_) = Aeson.object ["sum_" .= __sum_]
+  toJSON (Type_key_predicate_ __predicate_)
+    = Aeson.object ["predicate_" .= __predicate_]
+  toJSON (Type_key_named_ __named_)
+    = Aeson.object ["named_" .= __named_]
+  toJSON (Type_key_enum_ __enum_) = Aeson.object ["enum_" .= __enum_]
+  toJSON Type_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Type_key where
+  buildStruct _proxy (Type_key_boolean_ __boolean_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "boolean_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __boolean_)]
+  buildStruct _proxy (Type_key_byte_ __byte_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "byte_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __byte_)]
+  buildStruct _proxy (Type_key_nat_ __nat_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "nat_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __nat_)]
+  buildStruct _proxy (Type_key_string_ __string_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "string_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __string_)]
+  buildStruct _proxy (Type_key_array_ __array_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "array_" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __array_)]
+  buildStruct _proxy (Type_key_set_ __set_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "set_" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __set_)]
+  buildStruct _proxy (Type_key_maybe_ __maybe_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "maybe_" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __maybe_)]
+  buildStruct _proxy (Type_key_record_ __record_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "record_" (Thrift.getListType _proxy) 8 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __record_)]
+  buildStruct _proxy (Type_key_sum_ __sum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sum_" (Thrift.getListType _proxy) 9 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __sum_)]
+  buildStruct _proxy (Type_key_predicate_ __predicate_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "predicate_" (Thrift.getStructType _proxy)
+           10
+           0
+           (Thrift.buildStruct _proxy __predicate_)]
+  buildStruct _proxy (Type_key_named_ __named_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "named_" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __named_)]
+  buildStruct _proxy (Type_key_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getListType _proxy) 12 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __enum_)]
+  buildStruct _proxy Type_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_boolean_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_byte_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_nat_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_string_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_array_ _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_set_ _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_maybe_ _val)
+                                                     8 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_record_ _val)
+                                                     9 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_sum_ _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Type_key_predicate_ _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Type_key_named_ _val)
+                                                     12 | _type == Thrift.getListType _proxy ->
+                                                          do _val <- Prelude.snd <$>
+                                                                       Thrift.parseList _proxy
+                                                                         (Thrift.parseStruct _proxy)
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Type_key_enum_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Type_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Type_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("boolean_", 1), ("byte_", 2), ("nat_", 3), ("string_", 4),
+             ("array_", 5), ("set_", 6), ("maybe_", 7), ("record_", 8),
+             ("sum_", 9), ("predicate_", 10), ("named_", 11), ("enum_", 12)]
+
+instance DeepSeq.NFData Type_key where
+  rnf (Type_key_boolean_ __boolean_) = DeepSeq.rnf __boolean_
+  rnf (Type_key_byte_ __byte_) = DeepSeq.rnf __byte_
+  rnf (Type_key_nat_ __nat_) = DeepSeq.rnf __nat_
+  rnf (Type_key_string_ __string_) = DeepSeq.rnf __string_
+  rnf (Type_key_array_ __array_) = DeepSeq.rnf __array_
+  rnf (Type_key_set_ __set_) = DeepSeq.rnf __set_
+  rnf (Type_key_maybe_ __maybe_) = DeepSeq.rnf __maybe_
+  rnf (Type_key_record_ __record_) = DeepSeq.rnf __record_
+  rnf (Type_key_sum_ __sum_) = DeepSeq.rnf __sum_
+  rnf (Type_key_predicate_ __predicate_) = DeepSeq.rnf __predicate_
+  rnf (Type_key_named_ __named_) = DeepSeq.rnf __named_
+  rnf (Type_key_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf Type_key_EMPTY = ()
+
+instance Default.Default Type_key where
+  def = Type_key_EMPTY
+
+instance Hashable.Hashable Type_key where
+  hashWithSalt __salt (Type_key_boolean_ _boolean_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _boolean_)
+  hashWithSalt __salt (Type_key_byte_ _byte_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _byte_)
+  hashWithSalt __salt (Type_key_nat_ _nat_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _nat_)
+  hashWithSalt __salt (Type_key_string_ _string_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _string_)
+  hashWithSalt __salt (Type_key_array_ _array_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _array_)
+  hashWithSalt __salt (Type_key_set_ _set_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _set_)
+  hashWithSalt __salt (Type_key_maybe_ _maybe_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _maybe_)
+  hashWithSalt __salt (Type_key_record_ _record_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _record_)
+  hashWithSalt __salt (Type_key_sum_ _sum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _sum_)
+  hashWithSalt __salt (Type_key_predicate_ _predicate_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 10 _predicate_)
+  hashWithSalt __salt (Type_key_named_ _named_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _named_)
+  hashWithSalt __salt (Type_key_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _enum_)
+  hashWithSalt __salt Type_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EvolveDecl_key = EvolveDecl_key{evolveDecl_key_new_ :: Name,
+                                     evolveDecl_key_old_ :: Name}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EvolveDecl_key where
+  toJSON (EvolveDecl_key __field__new_ __field__old_)
+    = Aeson.object
+        ("new_" .= __field__new_ :
+           "old_" .= __field__old_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct EvolveDecl_key where
+  buildStruct _proxy (EvolveDecl_key __field__new_ __field__old_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "new_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__new_)
+           :
+           Thrift.genField _proxy "old_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__old_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__new_ <- ST.newSTRef Default.def
+            __field__old_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__new_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__old_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__new_ <- ST.readSTRef __field__new_
+                                             !__val__old_ <- ST.readSTRef __field__old_
+                                             Prelude.pure (EvolveDecl_key __val__new_ __val__old_)
+              _idMap = HashMap.fromList [("new_", 1), ("old_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EvolveDecl_key where
+  rnf (EvolveDecl_key __field__new_ __field__old_)
+    = DeepSeq.rnf __field__new_ `Prelude.seq`
+        DeepSeq.rnf __field__old_ `Prelude.seq` ()
+
+instance Default.Default EvolveDecl_key where
+  def = EvolveDecl_key Default.def Default.def
+
+instance Hashable.Hashable EvolveDecl_key where
+  hashWithSalt __salt (EvolveDecl_key _new_ _old_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _new_) _old_
+
+data DeriveInfo = DeriveInfo_NoDeriving
+                | DeriveInfo_OnDemand
+                | DeriveInfo_Stored
+                | DeriveInfo_IfEmpty
+                | DeriveInfo__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeriveInfo where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData DeriveInfo where
+  rnf __DeriveInfo = Prelude.seq __DeriveInfo ()
+
+instance Default.Default DeriveInfo where
+  def = DeriveInfo_NoDeriving
+
+instance Hashable.Hashable DeriveInfo where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum DeriveInfo where
+  toThriftEnum 0 = DeriveInfo_NoDeriving
+  toThriftEnum 1 = DeriveInfo_OnDemand
+  toThriftEnum 2 = DeriveInfo_Stored
+  toThriftEnum 3 = DeriveInfo_IfEmpty
+  toThriftEnum val = DeriveInfo__UNKNOWN val
+  fromThriftEnum DeriveInfo_NoDeriving = 0
+  fromThriftEnum DeriveInfo_OnDemand = 1
+  fromThriftEnum DeriveInfo_Stored = 2
+  fromThriftEnum DeriveInfo_IfEmpty = 3
+  fromThriftEnum (DeriveInfo__UNKNOWN val) = val
+  allThriftEnumValues
+    = [DeriveInfo_NoDeriving, DeriveInfo_OnDemand, DeriveInfo_Stored,
+       DeriveInfo_IfEmpty]
+  toThriftEnumEither 0 = Prelude.Right DeriveInfo_NoDeriving
+  toThriftEnumEither 1 = Prelude.Right DeriveInfo_OnDemand
+  toThriftEnumEither 2 = Prelude.Right DeriveInfo_Stored
+  toThriftEnumEither 3 = Prelude.Right DeriveInfo_IfEmpty
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum DeriveInfo: "
+           ++ Prelude.show val)
+
+data DerivingDecl_key = DerivingDecl_key{derivingDecl_key_name ::
+                                         Name,
+                                         derivingDecl_key_derive_ :: DeriveInfo}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivingDecl_key where
+  toJSON (DerivingDecl_key __field__name __field__derive_)
+    = Aeson.object
+        ("name" .= __field__name :
+           "derive_" .= __field__derive_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivingDecl_key where
+  buildStruct _proxy
+    (DerivingDecl_key __field__name __field__derive_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "derive_" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__derive_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__derive_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "DeriveInfo")
+                                                                        ST.writeSTRef
+                                                                          __field__derive_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__derive_ <- ST.readSTRef __field__derive_
+                                             Prelude.pure
+                                               (DerivingDecl_key __val__name __val__derive_)
+              _idMap = HashMap.fromList [("name", 1), ("derive_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivingDecl_key where
+  rnf (DerivingDecl_key __field__name __field__derive_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__derive_ `Prelude.seq` ()
+
+instance Default.Default DerivingDecl_key where
+  def = DerivingDecl_key Default.def Default.def
+
+instance Hashable.Hashable DerivingDecl_key where
+  hashWithSalt __salt (DerivingDecl_key _name _derive_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _derive_
+
+data PredicateDecl_key = PredicateDecl_key{predicateDecl_key_name
+                                           :: Name,
+                                           predicateDecl_key_keyTy :: Type,
+                                           predicateDecl_key_valTy :: Type,
+                                           predicateDecl_key_derived :: DeriveInfo}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PredicateDecl_key where
+  toJSON
+    (PredicateDecl_key __field__name __field__keyTy __field__valTy
+       __field__derived)
+    = Aeson.object
+        ("name" .= __field__name :
+           "keyTy" .= __field__keyTy :
+             "valTy" .= __field__valTy :
+               "derived" .= __field__derived : Prelude.mempty)
+
+instance Thrift.ThriftStruct PredicateDecl_key where
+  buildStruct _proxy
+    (PredicateDecl_key __field__name __field__keyTy __field__valTy
+       __field__derived)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "keyTy" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__keyTy)
+             :
+             Thrift.genField _proxy "valTy" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__valTy)
+               :
+               Thrift.genField _proxy "derived" (Thrift.getI32Type _proxy) 4 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__derived)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__keyTy <- ST.newSTRef Default.def
+            __field__valTy <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__keyTy
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__valTy
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "DeriveInfo")
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__keyTy <- ST.readSTRef __field__keyTy
+                                             !__val__valTy <- ST.readSTRef __field__valTy
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             Prelude.pure
+                                               (PredicateDecl_key __val__name __val__keyTy
+                                                  __val__valTy
+                                                  __val__derived)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("keyTy", 2), ("valTy", 3), ("derived", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PredicateDecl_key where
+  rnf
+    (PredicateDecl_key __field__name __field__keyTy __field__valTy
+       __field__derived)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__keyTy `Prelude.seq`
+          DeepSeq.rnf __field__valTy `Prelude.seq`
+            DeepSeq.rnf __field__derived `Prelude.seq` ()
+
+instance Default.Default PredicateDecl_key where
+  def
+    = PredicateDecl_key Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable PredicateDecl_key where
+  hashWithSalt __salt
+    (PredicateDecl_key _name _keyTy _valTy _derived)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _keyTy)
+           _valTy)
+        _derived
+
+data Declaration = Declaration_pred PredicateDecl
+                 | Declaration_ty TypeDecl
+                 | Declaration_schema SchemaDecl
+                 | Declaration_imp ImportStmt
+                 | Declaration_evolve EvolveDecl
+                 | Declaration_derive_ DerivingDecl
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_pred __pred) = Aeson.object ["pred" .= __pred]
+  toJSON (Declaration_ty __ty) = Aeson.object ["ty" .= __ty]
+  toJSON (Declaration_schema __schema)
+    = Aeson.object ["schema" .= __schema]
+  toJSON (Declaration_imp __imp) = Aeson.object ["imp" .= __imp]
+  toJSON (Declaration_evolve __evolve)
+    = Aeson.object ["evolve" .= __evolve]
+  toJSON (Declaration_derive_ __derive_)
+    = Aeson.object ["derive_" .= __derive_]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_pred __pred)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "pred" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __pred)]
+  buildStruct _proxy (Declaration_ty __ty)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ty" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __ty)]
+  buildStruct _proxy (Declaration_schema __schema)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "schema" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __schema)]
+  buildStruct _proxy (Declaration_imp __imp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "imp" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __imp)]
+  buildStruct _proxy (Declaration_evolve __evolve)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "evolve" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __evolve)]
+  buildStruct _proxy (Declaration_derive_ __derive_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "derive_" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __derive_)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_pred _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_ty _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_schema _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_imp _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_evolve _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_derive_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("pred", 1), ("ty", 2), ("schema", 3), ("imp", 4), ("evolve", 5),
+             ("derive_", 6)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_pred __pred) = DeepSeq.rnf __pred
+  rnf (Declaration_ty __ty) = DeepSeq.rnf __ty
+  rnf (Declaration_schema __schema) = DeepSeq.rnf __schema
+  rnf (Declaration_imp __imp) = DeepSeq.rnf __imp
+  rnf (Declaration_evolve __evolve) = DeepSeq.rnf __evolve
+  rnf (Declaration_derive_ __derive_) = DeepSeq.rnf __derive_
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_pred _pred)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _pred)
+  hashWithSalt __salt (Declaration_ty _ty)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _ty)
+  hashWithSalt __salt (Declaration_schema _schema)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _schema)
+  hashWithSalt __salt (Declaration_imp _imp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _imp)
+  hashWithSalt __salt (Declaration_evolve _evolve)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _evolve)
+  hashWithSalt __salt (Declaration_derive_ _derive_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _derive_)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_decl
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__decl __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt (DeclarationLocation_key _decl _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+        _span
+
+type DeclarationToName_value = Name
+
+data SchemaDecl_key = SchemaDecl_key{schemaDecl_key_name :: Name,
+                                     schemaDecl_key_declarations :: [Declaration]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SchemaDecl_key where
+  toJSON (SchemaDecl_key __field__name __field__declarations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "declarations" .= __field__declarations : Prelude.mempty)
+
+instance Thrift.ThriftStruct SchemaDecl_key where
+  buildStruct _proxy
+    (SchemaDecl_key __field__name __field__declarations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "declarations" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__declarations)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__declarations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__declarations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__declarations <- ST.readSTRef
+                                                                       __field__declarations
+                                             Prelude.pure
+                                               (SchemaDecl_key __val__name __val__declarations)
+              _idMap = HashMap.fromList [("name", 1), ("declarations", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SchemaDecl_key where
+  rnf (SchemaDecl_key __field__name __field__declarations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__declarations `Prelude.seq` ()
+
+instance Default.Default SchemaDecl_key where
+  def = SchemaDecl_key Default.def Default.def
+
+instance Hashable.Hashable SchemaDecl_key where
+  hashWithSalt __salt (SchemaDecl_key _name _declarations)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _declarations
+
+newtype XRefTarget = XRefTarget{xRefTarget_ref :: Declaration}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTarget where
+  toJSON (XRefTarget __field__ref)
+    = Aeson.object ("ref" .= __field__ref : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTarget where
+  buildStruct _proxy (XRefTarget __field__ref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ref)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ref <- ST.readSTRef __field__ref
+                                             Prelude.pure (XRefTarget __val__ref)
+              _idMap = HashMap.fromList [("ref", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTarget where
+  rnf (XRefTarget __field__ref)
+    = DeepSeq.rnf __field__ref `Prelude.seq` ()
+
+instance Default.Default XRefTarget where
+  def = XRefTarget Default.def
+
+instance Hashable.Hashable XRefTarget where
+  hashWithSalt __salt (XRefTarget _ref)
+    = Hashable.hashWithSalt __salt _ref
+
+data TargetUses_key = TargetUses_key{targetUses_key_target ::
+                                     XRefTarget,
+                                     targetUses_key_file :: Glean.Schema.Src.File,
+                                     targetUses_key_uses :: [Glean.Schema.Src.ByteSpan]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses_key where
+  toJSON (TargetUses_key __field__target __field__file __field__uses)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "uses" .= __field__uses : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses_key where
+  buildStruct _proxy
+    (TargetUses_key __field__target __field__file __field__uses)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__uses)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             Prelude.pure
+                                               (TargetUses_key __val__target __val__file
+                                                  __val__uses)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("uses", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses_key where
+  rnf (TargetUses_key __field__target __field__file __field__uses)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__uses `Prelude.seq` ()
+
+instance Default.Default TargetUses_key where
+  def = TargetUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetUses_key where
+  hashWithSalt __salt (TargetUses_key _target _file _uses)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _uses
+
+data XRef = XRef{xRef_target :: XRefTarget,
+                 xRef_span :: [Glean.Schema.Src.ByteSpan]}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__target __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__target __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "span" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (XRef __val__target __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__target __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _target _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _span
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+{-# LINE 18 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.Type_key where
+  buildRtsValue b Glean.Schema.Anglelang.Types.Type_key_EMPTY
+    = Glean.buildRtsSelector b 12
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_boolean_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_byte_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_nat_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_string_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_array_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_set_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_maybe_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_record_ x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_sum_ x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.Type_key_predicate_ x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_named_ x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Type_key_enum_ x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Anglelang.Types.Type_key_EMPTY)
+        [Glean.mapD Glean.Schema.Anglelang.Types.Type_key_boolean_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_byte_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_nat_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_string_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_array_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_set_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_maybe_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_record_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_sum_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_predicate_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_named_,
+         Glean.mapD Glean.Schema.Anglelang.Types.Type_key_enum_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.Type_key" (Prelude.Just 0))
+{-# LINE 74 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Anglelang.Types.Type_key
+     =
+     'Angle.TField "boolean_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "byte_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "nat_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "string_" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "array_"
+                   (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+                   ('Angle.TField "set_"
+                      (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+                      ('Angle.TField "maybe_"
+                         (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+                         ('Angle.TField "record_" ([Glean.Schema.Anglelang.Types.Field])
+                            ('Angle.TField "sum_" ([Glean.Schema.Anglelang.Types.Field])
+                               ('Angle.TField "predicate_"
+                                  (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+                                  ('Angle.TField "named_"
+                                     (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+                                     ('Angle.TField "enum_" ([Glean.Schema.Anglelang.Types.Name])
+                                        ('Angle.TNoFields))))))))))))
+{-# LINE 76 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.Type where
+  type KeyType Glean.Schema.Anglelang.Types.Type =
+       Glean.Schema.Anglelang.Types.Type_key
+  getName _proxy = Glean.PredicateRef "anglelang.Type" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Anglelang.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.Type x k
+  getFactKey = Glean.Schema.Anglelang.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 85 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 91 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.TypeDecl_key where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.TypeDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.TypeDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.TypeDecl_key" (Prelude.Just 0))
+{-# LINE 100 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.TypeDecl_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "ty"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 102 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.TypeDecl
+         where
+  type KeyType Glean.Schema.Anglelang.Types.TypeDecl =
+       Glean.Schema.Anglelang.Types.TypeDecl_key
+  getName _proxy = Glean.PredicateRef "anglelang.TypeDecl" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Anglelang.Types.typeDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.TypeDecl x k
+  getFactKey = Glean.Schema.Anglelang.Types.typeDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 111 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.TypeDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 117 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.Name where
+  type KeyType Glean.Schema.Anglelang.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "anglelang.Name" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Anglelang.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.Name x k
+  getFactKey = Glean.Schema.Anglelang.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.SchemaDecl_key
+         where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.SchemaDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.SchemaDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.SchemaDecl_key" (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.SchemaDecl_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "declarations"
+          ([Glean.Schema.Anglelang.Types.Declaration])
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.SchemaDecl
+         where
+  type KeyType Glean.Schema.Anglelang.Types.SchemaDecl =
+       Glean.Schema.Anglelang.Types.SchemaDecl_key
+  getName _proxy = Glean.PredicateRef "anglelang.SchemaDecl" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.schemaDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.SchemaDecl x k
+  getFactKey = Glean.Schema.Anglelang.Types.schemaDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.SchemaDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 157 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.FileXRefs_key
+         where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.FileXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 166 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Anglelang.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 168 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.FileXRefs
+         where
+  type KeyType Glean.Schema.Anglelang.Types.FileXRefs =
+       Glean.Schema.Anglelang.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "anglelang.FileXRefs" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Anglelang.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 177 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 183 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.PredicateDecl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.PredicateDecl_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.PredicateDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.PredicateDecl_key" (Prelude.Just 0))
+{-# LINE 196 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.PredicateDecl_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "keyTy"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+          ('Angle.TField "valTy"
+             (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+             ('Angle.TField "derived" (Glean.Schema.Anglelang.Types.DeriveInfo)
+                ('Angle.TNoFields))))
+{-# LINE 198 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.PredicateDecl
+         where
+  type KeyType Glean.Schema.Anglelang.Types.PredicateDecl =
+       Glean.Schema.Anglelang.Types.PredicateDecl_key
+  getName _proxy = Glean.PredicateRef "anglelang.PredicateDecl" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.predicateDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.PredicateDecl x k
+  getFactKey = Glean.Schema.Anglelang.Types.predicateDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 207 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.PredicateDecl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 213 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.TargetUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.TargetUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.TargetUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.TargetUses_key" (Prelude.Just 0))
+{-# LINE 224 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.TargetUses_key =
+     'Angle.TField "target" (Glean.Schema.Anglelang.Types.XRefTarget)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "uses" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 226 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.TargetUses
+         where
+  type KeyType Glean.Schema.Anglelang.Types.TargetUses =
+       Glean.Schema.Anglelang.Types.TargetUses_key
+  getName _proxy = Glean.PredicateRef "anglelang.TargetUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.targetUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.TargetUses x k
+  getFactKey = Glean.Schema.Anglelang.Types.targetUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 235 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.TargetUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 241 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Anglelang.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.DeclarationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 252 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Anglelang.Types.DeclarationLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Anglelang.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 254 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Anglelang.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Anglelang.Types.DeclarationLocation =
+       Glean.Schema.Anglelang.Types.DeclarationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "anglelang.DeclarationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Anglelang.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 263 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Anglelang.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 269 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Anglelang.Types.DeclarationToName
+         where
+  type KeyType Glean.Schema.Anglelang.Types.DeclarationToName =
+       Glean.Schema.Anglelang.Types.Declaration
+  type ValueType Glean.Schema.Anglelang.Types.DeclarationToName =
+       Glean.Schema.Anglelang.Types.DeclarationToName_value
+  getName _proxy = Glean.PredicateRef "anglelang.DeclarationToName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.declarationToName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Anglelang.Types.DeclarationToName x k v
+  getFactKey = Glean.Schema.Anglelang.Types.declarationToName_key
+  getFactValue = Glean.Schema.Anglelang.Types.declarationToName_value
+{-# LINE 280 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.DeclarationToName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 286 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.DerivingDecl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.DerivingDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.DerivingDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.DerivingDecl_key" (Prelude.Just 0))
+{-# LINE 295 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.DerivingDecl_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "derive_" (Glean.Schema.Anglelang.Types.DeriveInfo)
+          ('Angle.TNoFields))
+{-# LINE 297 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.DerivingDecl
+         where
+  type KeyType Glean.Schema.Anglelang.Types.DerivingDecl =
+       Glean.Schema.Anglelang.Types.DerivingDecl_key
+  getName _proxy = Glean.PredicateRef "anglelang.DerivingDecl" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.derivingDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.DerivingDecl x k
+  getFactKey = Glean.Schema.Anglelang.Types.derivingDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 306 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.DerivingDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 312 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.EvolveDecl_key
+         where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.EvolveDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.EvolveDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.EvolveDecl_key" (Prelude.Just 0))
+{-# LINE 321 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.EvolveDecl_key =
+     'Angle.TField "new_"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "old_"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 323 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Anglelang.Types.EvolveDecl
+         where
+  type KeyType Glean.Schema.Anglelang.Types.EvolveDecl =
+       Glean.Schema.Anglelang.Types.EvolveDecl_key
+  getName _proxy = Glean.PredicateRef "anglelang.EvolveDecl" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Anglelang.Types.evolveDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Anglelang.Types.EvolveDecl x k
+  getFactKey = Glean.Schema.Anglelang.Types.evolveDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 332 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.EvolveDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 338 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.Declaration where
+  buildRtsValue b Glean.Schema.Anglelang.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Declaration_pred x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Declaration_ty x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Declaration_schema x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Declaration_imp x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Declaration_evolve x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Anglelang.Types.Declaration_derive_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Anglelang.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Anglelang.Types.Declaration_pred,
+         Glean.mapD Glean.Schema.Anglelang.Types.Declaration_ty,
+         Glean.mapD Glean.Schema.Anglelang.Types.Declaration_schema,
+         Glean.mapD Glean.Schema.Anglelang.Types.Declaration_imp,
+         Glean.mapD Glean.Schema.Anglelang.Types.Declaration_evolve,
+         Glean.mapD Glean.Schema.Anglelang.Types.Declaration_derive_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.Declaration" (Prelude.Just 1))
+{-# LINE 370 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Anglelang.Types.Declaration =
+     'Angle.TField "pred"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.PredicateDecl)
+       ('Angle.TField "ty"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.TypeDecl)
+          ('Angle.TField "schema"
+             (Glean.KeyType Glean.Schema.Anglelang.Types.SchemaDecl)
+             ('Angle.TField "imp" (Glean.Schema.Anglelang.Types.ImportStmt)
+                ('Angle.TField "evolve"
+                   (Glean.KeyType Glean.Schema.Anglelang.Types.EvolveDecl)
+                   ('Angle.TField "derive_"
+                      (Glean.KeyType Glean.Schema.Anglelang.Types.DerivingDecl)
+                      ('Angle.TNoFields))))))
+{-# LINE 372 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.DeriveInfo where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.DeriveInfo" (Prelude.Just 1))
+{-# LINE 377 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Anglelang.Types.DeriveInfo =
+     'Angle.TField "NoDeriving" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "OnDemand" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Stored" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "IfEmpty" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 379 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Anglelang.Types.DeriveInfo
+         where
+  type AngleEnumTy Glean.Schema.Anglelang.Types.DeriveInfo =
+       Glean.Schema.Anglelang.Types.DeriveInfo
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 383 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.XRefTarget where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.XRefTarget x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.XRefTarget <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.XRefTarget" (Prelude.Just 1))
+{-# LINE 390 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Anglelang.Types.XRefTarget =
+     'Angle.TField "ref" (Glean.Schema.Anglelang.Types.Declaration)
+       ('Angle.TNoFields)
+{-# LINE 392 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.Field where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.Field x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.Field <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.Field" (Prelude.Just 1))
+{-# LINE 401 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Anglelang.Types.Field
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "ty"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 403 "glean/schema/thrift/anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.Anglelang.Types.XRef where
+  buildRtsValue b (Glean.Schema.Anglelang.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Anglelang.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "anglelang.XRef" (Prelude.Just 1))
+{-# LINE 412 "glean/schema/thrift/anglelang_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Anglelang.Types.XRef
+     =
+     'Angle.TField "target" (Glean.Schema.Anglelang.Types.XRefTarget)
+       ('Angle.TField "span" ([Glean.Schema.Src.Types.ByteSpan])
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Buck/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Buck/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Buck/Types.hs
@@ -0,0 +1,11085 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/buck_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/buck_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/buck_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Buck/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Buck.Types
+       (pREDICATE_VERSIONS, Type_id, Type(Type, type_id, type_key),
+        TranslationUnit_id,
+        TranslationUnit(TranslationUnit, translationUnit_id,
+                        translationUnit_key),
+        TargetUses_id,
+        TargetUses(TargetUses, targetUses_id, targetUses_key),
+        TargetSourcesBaseModule_id,
+        TargetSourcesBaseModule(TargetSourcesBaseModule,
+                                targetSourcesBaseModule_id, targetSourcesBaseModule_key),
+        TargetSources_id,
+        TargetSources(TargetSources, targetSources_id, targetSources_key),
+        TargetOuts_id,
+        TargetOuts(TargetOuts, targetOuts_id, targetOuts_key),
+        TargetOut_id, TargetOut(TargetOut, targetOut_id, targetOut_key),
+        TargetMode_id,
+        TargetMode(TargetMode, targetMode_id, targetMode_key),
+        TargetLocation_id,
+        TargetLocation(TargetLocation, targetLocation_id,
+                       targetLocation_key),
+        TargetLinkWhole_id,
+        TargetLinkWhole(TargetLinkWhole, targetLinkWhole_id,
+                        targetLinkWhole_key),
+        TargetIndexerName_id,
+        TargetIndexerName(TargetIndexerName, targetIndexerName_id,
+                          targetIndexerName_key),
+        TargetIndexer_id,
+        TargetIndexer(TargetIndexer, targetIndexer_id, targetIndexer_key),
+        TargetHash_id,
+        TargetHash(TargetHash, targetHash_id, targetHash_key),
+        TargetCallByCallExpr_id,
+        TargetCallByCallExpr(TargetCallByCallExpr, targetCallByCallExpr_id,
+                             targetCallByCallExpr_key),
+        TargetCall_id,
+        TargetCall(TargetCall, targetCall_id, targetCall_key),
+        TargetByType_id,
+        TargetByType(TargetByType, targetByType_id, targetByType_key),
+        TargetAttribute_id,
+        TargetAttribute(TargetAttribute, targetAttribute_id,
+                        targetAttribute_key),
+        Target_id, Target(Target, target_id, target_key),
+        SourceFileLocation_id,
+        SourceFileLocation(SourceFileLocation, sourceFileLocation_id,
+                           sourceFileLocation_key),
+        SearchByLocalName_id,
+        SearchByLocalName(SearchByLocalName, searchByLocalName_id,
+                          searchByLocalName_key),
+        RuleKey_id, RuleKey(RuleKey, ruleKey_id, ruleKey_key), Platform_id,
+        Platform(Platform, platform_id, platform_key), Owner_id,
+        Owner(Owner, owner_id, owner_key), OutsTarget_id,
+        OutsTarget(OutsTarget, outsTarget_id, outsTarget_key),
+        OutputLabel_id,
+        OutputLabel(OutputLabel, outputLabel_id, outputLabel_key),
+        OutTarget_id, OutTarget(OutTarget, outTarget_id, outTarget_key),
+        LocatorWithLabel_id,
+        LocatorWithLabel(LocatorWithLabel, locatorWithLabel_id,
+                         locatorWithLabel_key),
+        LocatorReverseDeps_id,
+        LocatorReverseDeps(LocatorReverseDeps, locatorReverseDeps_id,
+                           locatorReverseDeps_key),
+        LocatorReverseDep_id,
+        LocatorReverseDep(LocatorReverseDep, locatorReverseDep_id,
+                          locatorReverseDep_key),
+        Locator_id, Locator(Locator, locator_id, locator_key),
+        LocalNameLowerCase_id,
+        LocalNameLowerCase(LocalNameLowerCase, localNameLowerCase_id,
+                           localNameLowerCase_key),
+        LocalName_id, LocalName(LocalName, localName_id, localName_key),
+        Labels_id, Labels(Labels, labels_id, labels_key), Label_id,
+        Label(Label, label_id, label_key), IndexerName_id,
+        IndexerName(IndexerName, indexerName_id, indexerName_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        FileToTarget_id,
+        FileToTarget(FileToTarget, fileToTarget_id, fileToTarget_key),
+        FileTarget_id,
+        FileTarget(FileTarget, fileTarget_id, fileTarget_key),
+        FileResolved_id,
+        FileResolved(FileResolved, fileResolved_id, fileResolved_key),
+        FileEntity_id,
+        FileEntity(FileEntity, fileEntity_id, fileEntity_key),
+        FileDefinition_id,
+        FileDefinition(FileDefinition, fileDefinition_id,
+                       fileDefinition_key),
+        File_id, File(File, file_id, file_key), IndexFailureX_id,
+        IndexFailureX(IndexFailureX, indexFailureX_id, indexFailureX_key),
+        DestinationUses_id,
+        DestinationUses(DestinationUses, destinationUses_id,
+                        destinationUses_key),
+        TargetDependencies_id,
+        TargetDependencies(TargetDependencies, targetDependencies_id,
+                           targetDependencies_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        Definition_id,
+        Definition(Definition, definition_id, definition_key), Consumer_id,
+        Consumer(Consumer, consumer_id, consumer_key), CallExpr_id,
+        CallExpr(CallExpr, callExpr_id, callExpr_key), CallArgument_id,
+        CallArgument(CallArgument, callArgument_id, callArgument_key),
+        AttributeName_id,
+        AttributeName(AttributeName, attributeName_id, attributeName_key),
+        AttributeValue_id,
+        AttributeValue(AttributeValue, attributeValue_id,
+                       attributeValue_key),
+        ArgumentValue_id,
+        ArgumentValue(ArgumentValue, argumentValue_id, argumentValue_key),
+        XRefDestination(XRefDestination_EMPTY, XRefDestination_locator,
+                        XRefDestination_file, XRefDestination_definition),
+        XRef(XRef, xRef_destination, xRef_ranges),
+        TranslationUnit_key(TranslationUnit_key, translationUnit_key_file,
+                            translationUnit_key_target, translationUnit_key_platform),
+        TargetUses_key(TargetUses_key, targetUses_key_locator,
+                       targetUses_key_file, targetUses_key_spans),
+        TargetSourcesBaseModule_key(TargetSourcesBaseModule_key,
+                                    targetSourcesBaseModule_key_locator,
+                                    targetSourcesBaseModule_key_srcs,
+                                    targetSourcesBaseModule_key_baseModule),
+        TargetSources_key(TargetSources_key, targetSources_key_target,
+                          targetSources_key_headers, targetSources_key_exportedHeaders,
+                          targetSources_key_srcs),
+        TargetOuts_key(TargetOuts_key, targetOuts_key_target,
+                       targetOuts_key_outputLabel, targetOuts_key_file),
+        TargetOut_key(TargetOut_key, targetOut_key_target,
+                      targetOut_key_file),
+        TargetMode_key(TargetMode_key, targetMode_key_target,
+                       targetMode_key_mode),
+        TargetLocation_key(TargetLocation_key, targetLocation_key_locator,
+                           targetLocation_key_file, targetLocation_key_span),
+        TargetIndexer_key(TargetIndexer_key, targetIndexer_key_name,
+                          targetIndexer_key_target),
+        TargetHash_key(TargetHash_key, targetHash_key_locator,
+                       targetHash_key_targetHash),
+        TargetCallByCallExpr_key(TargetCallByCallExpr_key,
+                                 targetCallByCallExpr_key_callExpr,
+                                 targetCallByCallExpr_key_target),
+        TargetCall_key(TargetCall_key, targetCall_key_locator,
+                       targetCall_key_arguments, targetCall_key_file, targetCall_key_span,
+                       targetCall_key_callExpr),
+        TargetByType_key(TargetByType_key, targetByType_key_type_,
+                         targetByType_key_target),
+        TargetAttribute_key(TargetAttribute_key,
+                            targetAttribute_key_target, targetAttribute_key_attribute,
+                            targetAttribute_key_value),
+        Target_key(Target_key, target_key_locator, target_key_type_,
+                   target_key_defaultPlatform, target_key_labels),
+        SourceFileLocation_key(SourceFileLocation_key,
+                               sourceFileLocation_key_file, sourceFileLocation_key_span),
+        SearchByLocalName_key(SearchByLocalName_key,
+                              searchByLocalName_key_name, searchByLocalName_key_decl),
+        RuleKey_key(RuleKey_key, ruleKey_key_locator, ruleKey_key_ruleKey),
+        Owner_key(Owner_key, owner_key_source, owner_key_owner),
+        OutsTarget_key(OutsTarget_key, outsTarget_key_file,
+                       outsTarget_key_target, outsTarget_key_outputLabel),
+        OutTarget_key(OutTarget_key, outTarget_key_file,
+                      outTarget_key_target),
+        LocatorWithLabel_key(LocatorWithLabel_key,
+                             locatorWithLabel_key_locator, locatorWithLabel_key_label),
+        LocatorReverseDeps_key(LocatorReverseDeps_key,
+                               locatorReverseDeps_key_locator, locatorReverseDeps_key_rdeps),
+        LocatorReverseDep_key(LocatorReverseDep_key,
+                              locatorReverseDep_key_locator, locatorReverseDep_key_rdep),
+        Locator_key(Locator_key, locator_key_subdir, locator_key_path,
+                    locator_key_name),
+        LocalNameLowerCase_key(LocalNameLowerCase_key,
+                               localNameLowerCase_key_lowercase, localNameLowerCase_key_name),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs),
+        FileToTarget_key(FileToTarget_key, fileToTarget_key_source,
+                         fileToTarget_key_locator),
+        FileTarget_key(FileTarget_key, fileTarget_key_file,
+                       fileTarget_key_locator),
+        FileResolved_key(FileResolved_key, fileResolved_key_buckFile,
+                         fileResolved_key_srcFile),
+        FileEntity_key(FileEntity_key, fileEntity_key_file,
+                       fileEntity_key_entity),
+        FileDefinition_key(FileDefinition_key, fileDefinition_key_file,
+                           fileDefinition_key_definition),
+        File_key(File_key_EMPTY, File_key_source, File_key_generated,
+                 File_key_generatedLabel),
+        FailureReason(FailureReason_Skipped, FailureReason_Blocked,
+                      FailureReason_EmptyCdb, FailureReason_FailedCdb,
+                      FailureReason_QueryFailed, FailureReason_Unclassified,
+                      FailureReason__UNKNOWN),
+        IndexFailureX_source(IndexFailureX_source_EMPTY,
+                             IndexFailureX_source_locator, IndexFailureX_source_buildFile),
+        IndexFailureX_key(IndexFailureX_key, indexFailureX_key_source,
+                          indexFailureX_key_indexer, indexFailureX_key_reason,
+                          indexFailureX_key_details, indexFailureX_key_repro),
+        DestinationUses_key(DestinationUses_key,
+                            destinationUses_key_destination, destinationUses_key_file,
+                            destinationUses_key_spans),
+        Dependency(Dependency, dependency_target, dependency_explicit_,
+                   dependency_exported),
+        TargetDependencies_key(TargetDependencies_key,
+                               targetDependencies_key_target,
+                               targetDependencies_key_dependencies),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_definition, definitionLocation_key_file,
+                               definitionLocation_key_span),
+        Definition_key(Definition_key, definition_key_module,
+                       definition_key_name),
+        Consumer_key(Consumer_key, consumer_key_source,
+                     consumer_key_consumer),
+        CallName(CallName_EMPTY, CallName_prim, CallName_definition),
+        CallExpr_accessor_(CallExpr_accessor_, callExpr_accessor__name,
+                           callExpr_accessor__field),
+        CallExpr_key(CallExpr_key_EMPTY, CallExpr_key_name,
+                     CallExpr_key_accessor),
+        CallArgument_key(CallArgument_key, callArgument_key_label,
+                         callArgument_key_value, callArgument_key_file,
+                         callArgument_key_span),
+        AttributeMapping(AttributeMapping, attributeMapping_key,
+                         attributeMapping_value),
+        AttributeValue_key(AttributeValue_key_EMPTY,
+                           AttributeValue_key_str, AttributeValue_key_sequence,
+                           AttributeValue_key_mapping),
+        ArgumentMapping(ArgumentMapping, argumentMapping_key,
+                        argumentMapping_value),
+        ArgumentValue_key(ArgumentValue_key_EMPTY, ArgumentValue_key_lit,
+                          ArgumentValue_key_sequence, ArgumentValue_key_mapping))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/buck_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 296 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Buck/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("CallArgument", 4), ("RuleKey", 4), ("Label", 4),
+       ("SearchByLocalName", 4), ("TargetIndexerName", 4),
+       ("TargetCallByCallExpr", 4), ("OutsTarget", 4),
+       ("LocalNameLowerCase", 4), ("LocalName", 4), ("FileTarget", 4),
+       ("Labels", 4), ("TargetLocation", 4), ("FileDefinition", 4),
+       ("LocatorReverseDep", 4), ("FileEntity", 4), ("Locator", 4),
+       ("DefinitionLocation", 4), ("CallExpr", 4), ("TargetIndexer", 4),
+       ("TargetUses", 4), ("Platform", 4), ("Consumer", 4),
+       ("TargetLinkWhole", 4), ("DestinationUses", 4),
+       ("SourceFileLocation", 4), ("TargetSourcesBaseModule", 4),
+       ("ArgumentValue", 4), ("IndexFailureX", 4), ("TargetOut", 4),
+       ("FileToTarget", 4), ("FileXRefs", 4), ("File", 4),
+       ("FileResolved", 4), ("Type", 4), ("OutputLabel", 4),
+       ("Definition", 4), ("TargetByType", 4), ("AttributeName", 4),
+       ("OutTarget", 4), ("AttributeValue", 4), ("TargetAttribute", 4),
+       ("TargetCall", 4), ("Target", 4), ("TargetMode", 4),
+       ("TargetHash", 4), ("Owner", 4), ("TargetDependencies", 4),
+       ("TargetOuts", 4), ("LocatorReverseDeps", 4), ("TargetSources", 4),
+       ("LocatorWithLabel", 4), ("IndexerName", 4),
+       ("TranslationUnit", 4)]
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TranslationUnit_id = Glean.Id
+
+data TranslationUnit = TranslationUnit{translationUnit_id ::
+                                       {-# UNPACK #-} !TranslationUnit_id,
+                                       translationUnit_key :: Prelude.Maybe TranslationUnit_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnit where
+  toJSON (TranslationUnit __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnit where
+  buildStruct _proxy (TranslationUnit __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TranslationUnit __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnit where
+  rnf (TranslationUnit __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TranslationUnit where
+  def = TranslationUnit Default.def Prelude.Nothing
+
+instance Hashable.Hashable TranslationUnit where
+  hashWithSalt __salt (TranslationUnit _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetUses_id = Glean.Id
+
+data TargetUses = TargetUses{targetUses_id ::
+                             {-# UNPACK #-} !TargetUses_id,
+                             targetUses_key :: Prelude.Maybe TargetUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses where
+  toJSON (TargetUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses where
+  buildStruct _proxy (TargetUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses where
+  rnf (TargetUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetUses where
+  def = TargetUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetUses where
+  hashWithSalt __salt (TargetUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetSourcesBaseModule_id = Glean.Id
+
+data TargetSourcesBaseModule = TargetSourcesBaseModule{targetSourcesBaseModule_id
+                                                       ::
+                                                       {-# UNPACK #-} !TargetSourcesBaseModule_id,
+                                                       targetSourcesBaseModule_key ::
+                                                       Prelude.Maybe TargetSourcesBaseModule_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetSourcesBaseModule where
+  toJSON (TargetSourcesBaseModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetSourcesBaseModule where
+  buildStruct _proxy
+    (TargetSourcesBaseModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TargetSourcesBaseModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetSourcesBaseModule where
+  rnf (TargetSourcesBaseModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetSourcesBaseModule where
+  def = TargetSourcesBaseModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetSourcesBaseModule where
+  hashWithSalt __salt (TargetSourcesBaseModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetSources_id = Glean.Id
+
+data TargetSources = TargetSources{targetSources_id ::
+                                   {-# UNPACK #-} !TargetSources_id,
+                                   targetSources_key :: Prelude.Maybe TargetSources_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetSources where
+  toJSON (TargetSources __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetSources where
+  buildStruct _proxy (TargetSources __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetSources __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetSources where
+  rnf (TargetSources __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetSources where
+  def = TargetSources Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetSources where
+  hashWithSalt __salt (TargetSources _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetOuts_id = Glean.Id
+
+data TargetOuts = TargetOuts{targetOuts_id ::
+                             {-# UNPACK #-} !TargetOuts_id,
+                             targetOuts_key :: Prelude.Maybe TargetOuts_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetOuts where
+  toJSON (TargetOuts __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetOuts where
+  buildStruct _proxy (TargetOuts __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetOuts __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetOuts where
+  rnf (TargetOuts __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetOuts where
+  def = TargetOuts Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetOuts where
+  hashWithSalt __salt (TargetOuts _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetOut_id = Glean.Id
+
+data TargetOut = TargetOut{targetOut_id ::
+                           {-# UNPACK #-} !TargetOut_id,
+                           targetOut_key :: Prelude.Maybe TargetOut_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetOut where
+  toJSON (TargetOut __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetOut where
+  buildStruct _proxy (TargetOut __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetOut __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetOut where
+  rnf (TargetOut __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetOut where
+  def = TargetOut Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetOut where
+  hashWithSalt __salt (TargetOut _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetMode_id = Glean.Id
+
+data TargetMode = TargetMode{targetMode_id ::
+                             {-# UNPACK #-} !TargetMode_id,
+                             targetMode_key :: Prelude.Maybe TargetMode_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetMode where
+  toJSON (TargetMode __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetMode where
+  buildStruct _proxy (TargetMode __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetMode __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetMode where
+  rnf (TargetMode __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetMode where
+  def = TargetMode Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetMode where
+  hashWithSalt __salt (TargetMode _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetLocation_id = Glean.Id
+
+data TargetLocation = TargetLocation{targetLocation_id ::
+                                     {-# UNPACK #-} !TargetLocation_id,
+                                     targetLocation_key :: Prelude.Maybe TargetLocation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetLocation where
+  toJSON (TargetLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetLocation where
+  buildStruct _proxy (TargetLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetLocation where
+  rnf (TargetLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetLocation where
+  def = TargetLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetLocation where
+  hashWithSalt __salt (TargetLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetLinkWhole_id = Glean.Id
+
+data TargetLinkWhole = TargetLinkWhole{targetLinkWhole_id ::
+                                       {-# UNPACK #-} !TargetLinkWhole_id,
+                                       targetLinkWhole_key :: Prelude.Maybe Target}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetLinkWhole where
+  toJSON (TargetLinkWhole __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetLinkWhole where
+  buildStruct _proxy (TargetLinkWhole __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetLinkWhole __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetLinkWhole where
+  rnf (TargetLinkWhole __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetLinkWhole where
+  def = TargetLinkWhole Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetLinkWhole where
+  hashWithSalt __salt (TargetLinkWhole _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetIndexerName_id = Glean.Id
+
+data TargetIndexerName = TargetIndexerName{targetIndexerName_id ::
+                                           {-# UNPACK #-} !TargetIndexerName_id,
+                                           targetIndexerName_key :: Prelude.Maybe Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetIndexerName where
+  toJSON (TargetIndexerName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetIndexerName where
+  buildStruct _proxy (TargetIndexerName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetIndexerName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetIndexerName where
+  rnf (TargetIndexerName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetIndexerName where
+  def = TargetIndexerName Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetIndexerName where
+  hashWithSalt __salt (TargetIndexerName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetIndexer_id = Glean.Id
+
+data TargetIndexer = TargetIndexer{targetIndexer_id ::
+                                   {-# UNPACK #-} !TargetIndexer_id,
+                                   targetIndexer_key :: Prelude.Maybe TargetIndexer_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetIndexer where
+  toJSON (TargetIndexer __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetIndexer where
+  buildStruct _proxy (TargetIndexer __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetIndexer __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetIndexer where
+  rnf (TargetIndexer __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetIndexer where
+  def = TargetIndexer Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetIndexer where
+  hashWithSalt __salt (TargetIndexer _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetHash_id = Glean.Id
+
+data TargetHash = TargetHash{targetHash_id ::
+                             {-# UNPACK #-} !TargetHash_id,
+                             targetHash_key :: Prelude.Maybe TargetHash_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetHash where
+  toJSON (TargetHash __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetHash where
+  buildStruct _proxy (TargetHash __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetHash __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetHash where
+  rnf (TargetHash __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetHash where
+  def = TargetHash Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetHash where
+  hashWithSalt __salt (TargetHash _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetCallByCallExpr_id = Glean.Id
+
+data TargetCallByCallExpr = TargetCallByCallExpr{targetCallByCallExpr_id
+                                                 :: {-# UNPACK #-} !TargetCallByCallExpr_id,
+                                                 targetCallByCallExpr_key ::
+                                                 Prelude.Maybe TargetCallByCallExpr_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetCallByCallExpr where
+  toJSON (TargetCallByCallExpr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetCallByCallExpr where
+  buildStruct _proxy (TargetCallByCallExpr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TargetCallByCallExpr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetCallByCallExpr where
+  rnf (TargetCallByCallExpr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetCallByCallExpr where
+  def = TargetCallByCallExpr Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetCallByCallExpr where
+  hashWithSalt __salt (TargetCallByCallExpr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetCall_id = Glean.Id
+
+data TargetCall = TargetCall{targetCall_id ::
+                             {-# UNPACK #-} !TargetCall_id,
+                             targetCall_key :: Prelude.Maybe TargetCall_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetCall where
+  toJSON (TargetCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetCall where
+  buildStruct _proxy (TargetCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetCall where
+  rnf (TargetCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetCall where
+  def = TargetCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetCall where
+  hashWithSalt __salt (TargetCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetByType_id = Glean.Id
+
+data TargetByType = TargetByType{targetByType_id ::
+                                 {-# UNPACK #-} !TargetByType_id,
+                                 targetByType_key :: Prelude.Maybe TargetByType_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetByType where
+  toJSON (TargetByType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetByType where
+  buildStruct _proxy (TargetByType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetByType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetByType where
+  rnf (TargetByType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetByType where
+  def = TargetByType Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetByType where
+  hashWithSalt __salt (TargetByType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetAttribute_id = Glean.Id
+
+data TargetAttribute = TargetAttribute{targetAttribute_id ::
+                                       {-# UNPACK #-} !TargetAttribute_id,
+                                       targetAttribute_key :: Prelude.Maybe TargetAttribute_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetAttribute where
+  toJSON (TargetAttribute __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetAttribute where
+  buildStruct _proxy (TargetAttribute __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetAttribute __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetAttribute where
+  rnf (TargetAttribute __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetAttribute where
+  def = TargetAttribute Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetAttribute where
+  hashWithSalt __salt (TargetAttribute _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Target_id = Glean.Id
+
+data Target = Target{target_id :: {-# UNPACK #-} !Target_id,
+                     target_key :: Prelude.Maybe Target_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Target where
+  toJSON (Target __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Target where
+  buildStruct _proxy (Target __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Target __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Target where
+  rnf (Target __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Target where
+  def = Target Default.def Prelude.Nothing
+
+instance Hashable.Hashable Target where
+  hashWithSalt __salt (Target _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SourceFileLocation_id = Glean.Id
+
+data SourceFileLocation = SourceFileLocation{sourceFileLocation_id
+                                             :: {-# UNPACK #-} !SourceFileLocation_id,
+                                             sourceFileLocation_key ::
+                                             Prelude.Maybe SourceFileLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceFileLocation where
+  toJSON (SourceFileLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceFileLocation where
+  buildStruct _proxy (SourceFileLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SourceFileLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceFileLocation where
+  rnf (SourceFileLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SourceFileLocation where
+  def = SourceFileLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable SourceFileLocation where
+  hashWithSalt __salt (SourceFileLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLocalName_id = Glean.Id
+
+data SearchByLocalName = SearchByLocalName{searchByLocalName_id ::
+                                           {-# UNPACK #-} !SearchByLocalName_id,
+                                           searchByLocalName_key ::
+                                           Prelude.Maybe SearchByLocalName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLocalName where
+  toJSON (SearchByLocalName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLocalName where
+  buildStruct _proxy (SearchByLocalName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByLocalName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLocalName where
+  rnf (SearchByLocalName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLocalName where
+  def = SearchByLocalName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLocalName where
+  hashWithSalt __salt (SearchByLocalName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RuleKey_id = Glean.Id
+
+data RuleKey = RuleKey{ruleKey_id :: {-# UNPACK #-} !RuleKey_id,
+                       ruleKey_key :: Prelude.Maybe RuleKey_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RuleKey where
+  toJSON (RuleKey __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RuleKey where
+  buildStruct _proxy (RuleKey __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RuleKey __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RuleKey where
+  rnf (RuleKey __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RuleKey where
+  def = RuleKey Default.def Prelude.Nothing
+
+instance Hashable.Hashable RuleKey where
+  hashWithSalt __salt (RuleKey _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Platform_id = Glean.Id
+
+data Platform = Platform{platform_id ::
+                         {-# UNPACK #-} !Platform_id,
+                         platform_key :: Prelude.Maybe Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Platform where
+  toJSON (Platform __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Platform where
+  buildStruct _proxy (Platform __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Platform __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Platform where
+  rnf (Platform __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Platform where
+  def = Platform Default.def Prelude.Nothing
+
+instance Hashable.Hashable Platform where
+  hashWithSalt __salt (Platform _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Owner_id = Glean.Id
+
+data Owner = Owner{owner_id :: {-# UNPACK #-} !Owner_id,
+                   owner_key :: Prelude.Maybe Owner_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Owner where
+  toJSON (Owner __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Owner where
+  buildStruct _proxy (Owner __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Owner __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Owner where
+  rnf (Owner __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Owner where
+  def = Owner Default.def Prelude.Nothing
+
+instance Hashable.Hashable Owner where
+  hashWithSalt __salt (Owner _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type OutsTarget_id = Glean.Id
+
+data OutsTarget = OutsTarget{outsTarget_id ::
+                             {-# UNPACK #-} !OutsTarget_id,
+                             outsTarget_key :: Prelude.Maybe OutsTarget_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OutsTarget where
+  toJSON (OutsTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct OutsTarget where
+  buildStruct _proxy (OutsTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (OutsTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OutsTarget where
+  rnf (OutsTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default OutsTarget where
+  def = OutsTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable OutsTarget where
+  hashWithSalt __salt (OutsTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type OutputLabel_id = Glean.Id
+
+data OutputLabel = OutputLabel{outputLabel_id ::
+                               {-# UNPACK #-} !OutputLabel_id,
+                               outputLabel_key :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OutputLabel where
+  toJSON (OutputLabel __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct OutputLabel where
+  buildStruct _proxy (OutputLabel __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (OutputLabel __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OutputLabel where
+  rnf (OutputLabel __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default OutputLabel where
+  def = OutputLabel Default.def Prelude.Nothing
+
+instance Hashable.Hashable OutputLabel where
+  hashWithSalt __salt (OutputLabel _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type OutTarget_id = Glean.Id
+
+data OutTarget = OutTarget{outTarget_id ::
+                           {-# UNPACK #-} !OutTarget_id,
+                           outTarget_key :: Prelude.Maybe OutTarget_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OutTarget where
+  toJSON (OutTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct OutTarget where
+  buildStruct _proxy (OutTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (OutTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OutTarget where
+  rnf (OutTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default OutTarget where
+  def = OutTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable OutTarget where
+  hashWithSalt __salt (OutTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocatorWithLabel_id = Glean.Id
+
+data LocatorWithLabel = LocatorWithLabel{locatorWithLabel_id ::
+                                         {-# UNPACK #-} !LocatorWithLabel_id,
+                                         locatorWithLabel_key :: Prelude.Maybe LocatorWithLabel_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorWithLabel where
+  toJSON (LocatorWithLabel __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorWithLabel where
+  buildStruct _proxy (LocatorWithLabel __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocatorWithLabel __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorWithLabel where
+  rnf (LocatorWithLabel __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocatorWithLabel where
+  def = LocatorWithLabel Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocatorWithLabel where
+  hashWithSalt __salt (LocatorWithLabel _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocatorReverseDeps_id = Glean.Id
+
+data LocatorReverseDeps = LocatorReverseDeps{locatorReverseDeps_id
+                                             :: {-# UNPACK #-} !LocatorReverseDeps_id,
+                                             locatorReverseDeps_key ::
+                                             Prelude.Maybe LocatorReverseDeps_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorReverseDeps where
+  toJSON (LocatorReverseDeps __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorReverseDeps where
+  buildStruct _proxy (LocatorReverseDeps __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocatorReverseDeps __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorReverseDeps where
+  rnf (LocatorReverseDeps __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocatorReverseDeps where
+  def = LocatorReverseDeps Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocatorReverseDeps where
+  hashWithSalt __salt (LocatorReverseDeps _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocatorReverseDep_id = Glean.Id
+
+data LocatorReverseDep = LocatorReverseDep{locatorReverseDep_id ::
+                                           {-# UNPACK #-} !LocatorReverseDep_id,
+                                           locatorReverseDep_key ::
+                                           Prelude.Maybe LocatorReverseDep_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorReverseDep where
+  toJSON (LocatorReverseDep __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorReverseDep where
+  buildStruct _proxy (LocatorReverseDep __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocatorReverseDep __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorReverseDep where
+  rnf (LocatorReverseDep __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocatorReverseDep where
+  def = LocatorReverseDep Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocatorReverseDep where
+  hashWithSalt __salt (LocatorReverseDep _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Locator_id = Glean.Id
+
+data Locator = Locator{locator_id :: {-# UNPACK #-} !Locator_id,
+                       locator_key :: Prelude.Maybe Locator_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Locator where
+  toJSON (Locator __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Locator where
+  buildStruct _proxy (Locator __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Locator __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Locator where
+  rnf (Locator __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Locator where
+  def = Locator Default.def Prelude.Nothing
+
+instance Hashable.Hashable Locator where
+  hashWithSalt __salt (Locator _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocalNameLowerCase_id = Glean.Id
+
+data LocalNameLowerCase = LocalNameLowerCase{localNameLowerCase_id
+                                             :: {-# UNPACK #-} !LocalNameLowerCase_id,
+                                             localNameLowerCase_key ::
+                                             Prelude.Maybe LocalNameLowerCase_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalNameLowerCase where
+  toJSON (LocalNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalNameLowerCase where
+  buildStruct _proxy (LocalNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocalNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalNameLowerCase where
+  rnf (LocalNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocalNameLowerCase where
+  def = LocalNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocalNameLowerCase where
+  hashWithSalt __salt (LocalNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocalName_id = Glean.Id
+
+data LocalName = LocalName{localName_id ::
+                           {-# UNPACK #-} !LocalName_id,
+                           localName_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalName where
+  toJSON (LocalName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalName where
+  buildStruct _proxy (LocalName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocalName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalName where
+  rnf (LocalName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocalName where
+  def = LocalName Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocalName where
+  hashWithSalt __salt (LocalName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Labels_id = Glean.Id
+
+data Labels = Labels{labels_id :: {-# UNPACK #-} !Labels_id,
+                     labels_key :: Prelude.Maybe [Label]}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Labels where
+  toJSON (Labels __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Labels where
+  buildStruct _proxy (Labels __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                       (Thrift.buildStruct _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Labels __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Labels where
+  rnf (Labels __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Labels where
+  def = Labels Default.def Prelude.Nothing
+
+instance Hashable.Hashable Labels where
+  hashWithSalt __salt (Labels _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Label_id = Glean.Id
+
+data Label = Label{label_id :: {-# UNPACK #-} !Label_id,
+                   label_key :: Prelude.Maybe Text.Text}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Label where
+  toJSON (Label __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Label where
+  buildStruct _proxy (Label __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Label __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Label where
+  rnf (Label __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Label where
+  def = Label Default.def Prelude.Nothing
+
+instance Hashable.Hashable Label where
+  hashWithSalt __salt (Label _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IndexerName_id = Glean.Id
+
+data IndexerName = IndexerName{indexerName_id ::
+                               {-# UNPACK #-} !IndexerName_id,
+                               indexerName_key :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexerName where
+  toJSON (IndexerName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexerName where
+  buildStruct _proxy (IndexerName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IndexerName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexerName where
+  rnf (IndexerName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IndexerName where
+  def = IndexerName Default.def Prelude.Nothing
+
+instance Hashable.Hashable IndexerName where
+  hashWithSalt __salt (IndexerName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileToTarget_id = Glean.Id
+
+data FileToTarget = FileToTarget{fileToTarget_id ::
+                                 {-# UNPACK #-} !FileToTarget_id,
+                                 fileToTarget_key :: Prelude.Maybe FileToTarget_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileToTarget where
+  toJSON (FileToTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileToTarget where
+  buildStruct _proxy (FileToTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileToTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileToTarget where
+  rnf (FileToTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileToTarget where
+  def = FileToTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileToTarget where
+  hashWithSalt __salt (FileToTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileTarget_id = Glean.Id
+
+data FileTarget = FileTarget{fileTarget_id ::
+                             {-# UNPACK #-} !FileTarget_id,
+                             fileTarget_key :: Prelude.Maybe FileTarget_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileTarget where
+  toJSON (FileTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileTarget where
+  buildStruct _proxy (FileTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileTarget where
+  rnf (FileTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileTarget where
+  def = FileTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileTarget where
+  hashWithSalt __salt (FileTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileResolved_id = Glean.Id
+
+data FileResolved = FileResolved{fileResolved_id ::
+                                 {-# UNPACK #-} !FileResolved_id,
+                                 fileResolved_key :: Prelude.Maybe FileResolved_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileResolved where
+  toJSON (FileResolved __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileResolved where
+  buildStruct _proxy (FileResolved __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileResolved __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileResolved where
+  rnf (FileResolved __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileResolved where
+  def = FileResolved Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileResolved where
+  hashWithSalt __salt (FileResolved _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntity_id = Glean.Id
+
+data FileEntity = FileEntity{fileEntity_id ::
+                             {-# UNPACK #-} !FileEntity_id,
+                             fileEntity_key :: Prelude.Maybe FileEntity_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntity where
+  toJSON (FileEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntity where
+  buildStruct _proxy (FileEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntity where
+  rnf (FileEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntity where
+  def = FileEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntity where
+  hashWithSalt __salt (FileEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDefinition_id = Glean.Id
+
+data FileDefinition = FileDefinition{fileDefinition_id ::
+                                     {-# UNPACK #-} !FileDefinition_id,
+                                     fileDefinition_key :: Prelude.Maybe FileDefinition_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDefinition where
+  toJSON (FileDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDefinition where
+  buildStruct _proxy (FileDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDefinition where
+  rnf (FileDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDefinition where
+  def = FileDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDefinition where
+  hashWithSalt __salt (FileDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type File_id = Glean.Id
+
+data File = File{file_id :: {-# UNPACK #-} !File_id,
+                 file_key :: Prelude.Maybe File_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON File where
+  toJSON (File __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct File where
+  buildStruct _proxy (File __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (File __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData File where
+  rnf (File __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default File where
+  def = File Default.def Prelude.Nothing
+
+instance Hashable.Hashable File where
+  hashWithSalt __salt (File _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IndexFailureX_id = Glean.Id
+
+data IndexFailureX = IndexFailureX{indexFailureX_id ::
+                                   {-# UNPACK #-} !IndexFailureX_id,
+                                   indexFailureX_key :: Prelude.Maybe IndexFailureX_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailureX where
+  toJSON (IndexFailureX __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexFailureX where
+  buildStruct _proxy (IndexFailureX __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IndexFailureX __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexFailureX where
+  rnf (IndexFailureX __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IndexFailureX where
+  def = IndexFailureX Default.def Prelude.Nothing
+
+instance Hashable.Hashable IndexFailureX where
+  hashWithSalt __salt (IndexFailureX _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DestinationUses_id = Glean.Id
+
+data DestinationUses = DestinationUses{destinationUses_id ::
+                                       {-# UNPACK #-} !DestinationUses_id,
+                                       destinationUses_key :: Prelude.Maybe DestinationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DestinationUses where
+  toJSON (DestinationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DestinationUses where
+  buildStruct _proxy (DestinationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DestinationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DestinationUses where
+  rnf (DestinationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DestinationUses where
+  def = DestinationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DestinationUses where
+  hashWithSalt __salt (DestinationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetDependencies_id = Glean.Id
+
+data TargetDependencies = TargetDependencies{targetDependencies_id
+                                             :: {-# UNPACK #-} !TargetDependencies_id,
+                                             targetDependencies_key ::
+                                             Prelude.Maybe TargetDependencies_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetDependencies where
+  toJSON (TargetDependencies __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetDependencies where
+  buildStruct _proxy (TargetDependencies __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetDependencies __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetDependencies where
+  rnf (TargetDependencies __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetDependencies where
+  def = TargetDependencies Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetDependencies where
+  hashWithSalt __salt (TargetDependencies _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Definition_id = Glean.Id
+
+data Definition = Definition{definition_id ::
+                             {-# UNPACK #-} !Definition_id,
+                             definition_key :: Prelude.Maybe Definition_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Definition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Definition where
+  def = Definition Default.def Prelude.Nothing
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Consumer_id = Glean.Id
+
+data Consumer = Consumer{consumer_id ::
+                         {-# UNPACK #-} !Consumer_id,
+                         consumer_key :: Prelude.Maybe Consumer_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Consumer where
+  toJSON (Consumer __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Consumer where
+  buildStruct _proxy (Consumer __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Consumer __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Consumer where
+  rnf (Consumer __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Consumer where
+  def = Consumer Default.def Prelude.Nothing
+
+instance Hashable.Hashable Consumer where
+  hashWithSalt __salt (Consumer _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CallExpr_id = Glean.Id
+
+data CallExpr = CallExpr{callExpr_id ::
+                         {-# UNPACK #-} !CallExpr_id,
+                         callExpr_key :: Prelude.Maybe CallExpr_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallExpr where
+  toJSON (CallExpr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CallExpr where
+  buildStruct _proxy (CallExpr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CallExpr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CallExpr where
+  rnf (CallExpr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CallExpr where
+  def = CallExpr Default.def Prelude.Nothing
+
+instance Hashable.Hashable CallExpr where
+  hashWithSalt __salt (CallExpr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CallArgument_id = Glean.Id
+
+data CallArgument = CallArgument{callArgument_id ::
+                                 {-# UNPACK #-} !CallArgument_id,
+                                 callArgument_key :: Prelude.Maybe CallArgument_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallArgument where
+  toJSON (CallArgument __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CallArgument where
+  buildStruct _proxy (CallArgument __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CallArgument __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CallArgument where
+  rnf (CallArgument __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CallArgument where
+  def = CallArgument Default.def Prelude.Nothing
+
+instance Hashable.Hashable CallArgument where
+  hashWithSalt __salt (CallArgument _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AttributeName_id = Glean.Id
+
+data AttributeName = AttributeName{attributeName_id ::
+                                   {-# UNPACK #-} !AttributeName_id,
+                                   attributeName_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeName where
+  toJSON (AttributeName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeName where
+  buildStruct _proxy (AttributeName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AttributeName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeName where
+  rnf (AttributeName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AttributeName where
+  def = AttributeName Default.def Prelude.Nothing
+
+instance Hashable.Hashable AttributeName where
+  hashWithSalt __salt (AttributeName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AttributeValue_id = Glean.Id
+
+data AttributeValue = AttributeValue{attributeValue_id ::
+                                     {-# UNPACK #-} !AttributeValue_id,
+                                     attributeValue_key :: Prelude.Maybe AttributeValue_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeValue where
+  toJSON (AttributeValue __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeValue where
+  buildStruct _proxy (AttributeValue __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AttributeValue __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeValue where
+  rnf (AttributeValue __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AttributeValue where
+  def = AttributeValue Default.def Prelude.Nothing
+
+instance Hashable.Hashable AttributeValue where
+  hashWithSalt __salt (AttributeValue _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ArgumentValue_id = Glean.Id
+
+data ArgumentValue = ArgumentValue{argumentValue_id ::
+                                   {-# UNPACK #-} !ArgumentValue_id,
+                                   argumentValue_key :: Prelude.Maybe ArgumentValue_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArgumentValue where
+  toJSON (ArgumentValue __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ArgumentValue where
+  buildStruct _proxy (ArgumentValue __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ArgumentValue __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArgumentValue where
+  rnf (ArgumentValue __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ArgumentValue where
+  def = ArgumentValue Default.def Prelude.Nothing
+
+instance Hashable.Hashable ArgumentValue where
+  hashWithSalt __salt (ArgumentValue _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefDestination = XRefDestination_locator Locator
+                     | XRefDestination_file Glean.Schema.Src.File
+                     | XRefDestination_definition Definition
+                     | XRefDestination_EMPTY
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefDestination where
+  toJSON (XRefDestination_locator __locator)
+    = Aeson.object ["locator" .= __locator]
+  toJSON (XRefDestination_file __file)
+    = Aeson.object ["file" .= __file]
+  toJSON (XRefDestination_definition __definition)
+    = Aeson.object ["definition" .= __definition]
+  toJSON XRefDestination_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefDestination where
+  buildStruct _proxy (XRefDestination_locator __locator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __locator)]
+  buildStruct _proxy (XRefDestination_file __file)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __file)]
+  buildStruct _proxy (XRefDestination_definition __definition)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __definition)]
+  buildStruct _proxy XRefDestination_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefDestination_locator _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefDestination_file _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefDestination_definition _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefDestination_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefDestination_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("locator", 1), ("file", 2), ("definition", 3)]
+
+instance DeepSeq.NFData XRefDestination where
+  rnf (XRefDestination_locator __locator) = DeepSeq.rnf __locator
+  rnf (XRefDestination_file __file) = DeepSeq.rnf __file
+  rnf (XRefDestination_definition __definition)
+    = DeepSeq.rnf __definition
+  rnf XRefDestination_EMPTY = ()
+
+instance Default.Default XRefDestination where
+  def = XRefDestination_EMPTY
+
+instance Hashable.Hashable XRefDestination where
+  hashWithSalt __salt (XRefDestination_locator _locator)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _locator)
+  hashWithSalt __salt (XRefDestination_file _file)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _file)
+  hashWithSalt __salt (XRefDestination_definition _definition)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _definition)
+  hashWithSalt __salt XRefDestination_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data XRef = XRef{xRef_destination :: XRefDestination,
+                 xRef_ranges :: [Glean.Schema.Src.ByteSpan]}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__destination __field__ranges)
+    = Aeson.object
+        ("destination" .= __field__destination :
+           "ranges" .= __field__ranges : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__destination __field__ranges)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "destination" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__destination)
+           :
+           Thrift.genField _proxy "ranges" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__ranges)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__destination <- ST.newSTRef Default.def
+            __field__ranges <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__destination
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__ranges
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__destination <- ST.readSTRef
+                                                                      __field__destination
+                                             !__val__ranges <- ST.readSTRef __field__ranges
+                                             Prelude.pure (XRef __val__destination __val__ranges)
+              _idMap = HashMap.fromList [("destination", 1), ("ranges", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__destination __field__ranges)
+    = DeepSeq.rnf __field__destination `Prelude.seq`
+        DeepSeq.rnf __field__ranges `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _destination _ranges)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _destination)
+        _ranges
+
+data TranslationUnit_key = TranslationUnit_key{translationUnit_key_file
+                                               :: Glean.Schema.Src.File,
+                                               translationUnit_key_target :: Locator,
+                                               translationUnit_key_platform ::
+                                               Prelude.Maybe Platform}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnit_key where
+  toJSON
+    (TranslationUnit_key __field__file __field__target
+       __field__platform)
+    = Aeson.object
+        ("file" .= __field__file :
+           "target" .= __field__target :
+             Prelude.maybe Prelude.id ((:) . ("platform" .=)) __field__platform
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnit_key where
+  buildStruct _proxy
+    (TranslationUnit_key __field__file __field__target
+       __field__platform)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             :
+             case __field__platform of
+               Prelude.Just _val -> Thrift.genField _proxy "platform"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__platform <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__platform
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__platform <- ST.readSTRef __field__platform
+                                             Prelude.pure
+                                               (TranslationUnit_key __val__file __val__target
+                                                  __val__platform)
+              _idMap
+                = HashMap.fromList [("file", 1), ("target", 2), ("platform", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnit_key where
+  rnf
+    (TranslationUnit_key __field__file __field__target
+       __field__platform)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq`
+          DeepSeq.rnf __field__platform `Prelude.seq` ()
+
+instance Default.Default TranslationUnit_key where
+  def = TranslationUnit_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable TranslationUnit_key where
+  hashWithSalt __salt (TranslationUnit_key _file _target _platform)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _target)
+        _platform
+
+data TargetUses_key = TargetUses_key{targetUses_key_locator ::
+                                     Locator,
+                                     targetUses_key_file :: Glean.Schema.Src.File,
+                                     targetUses_key_spans :: [Glean.Schema.Src.ByteSpan]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses_key where
+  toJSON
+    (TargetUses_key __field__locator __field__file __field__spans)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "file" .= __field__file :
+             "spans" .= __field__spans : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses_key where
+  buildStruct _proxy
+    (TargetUses_key __field__locator __field__file __field__spans)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "spans" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__spans)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__spans <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__spans
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__spans <- ST.readSTRef __field__spans
+                                             Prelude.pure
+                                               (TargetUses_key __val__locator __val__file
+                                                  __val__spans)
+              _idMap
+                = HashMap.fromList [("locator", 1), ("file", 2), ("spans", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses_key where
+  rnf (TargetUses_key __field__locator __field__file __field__spans)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__spans `Prelude.seq` ()
+
+instance Default.Default TargetUses_key where
+  def = TargetUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetUses_key where
+  hashWithSalt __salt (TargetUses_key _locator _file _spans)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+           _file)
+        _spans
+
+data TargetSourcesBaseModule_key = TargetSourcesBaseModule_key{targetSourcesBaseModule_key_locator
+                                                               :: Target,
+                                                               targetSourcesBaseModule_key_srcs ::
+                                                               [File],
+                                                               targetSourcesBaseModule_key_baseModule
+                                                               :: Prelude.Maybe AttributeValue}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetSourcesBaseModule_key where
+  toJSON
+    (TargetSourcesBaseModule_key __field__locator __field__srcs
+       __field__baseModule)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "srcs" .= __field__srcs :
+             Prelude.maybe Prelude.id ((:) . ("baseModule" .=))
+               __field__baseModule
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetSourcesBaseModule_key where
+  buildStruct _proxy
+    (TargetSourcesBaseModule_key __field__locator __field__srcs
+       __field__baseModule)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "srcs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__srcs)
+             :
+             case __field__baseModule of
+               Prelude.Just _val -> Thrift.genField _proxy "baseModule"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__srcs <- ST.newSTRef Default.def
+            __field__baseModule <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__srcs
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__baseModule
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__srcs <- ST.readSTRef __field__srcs
+                                             !__val__baseModule <- ST.readSTRef __field__baseModule
+                                             Prelude.pure
+                                               (TargetSourcesBaseModule_key __val__locator
+                                                  __val__srcs
+                                                  __val__baseModule)
+              _idMap
+                = HashMap.fromList [("locator", 1), ("srcs", 2), ("baseModule", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetSourcesBaseModule_key where
+  rnf
+    (TargetSourcesBaseModule_key __field__locator __field__srcs
+       __field__baseModule)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__srcs `Prelude.seq`
+          DeepSeq.rnf __field__baseModule `Prelude.seq` ()
+
+instance Default.Default TargetSourcesBaseModule_key where
+  def
+    = TargetSourcesBaseModule_key Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable TargetSourcesBaseModule_key where
+  hashWithSalt __salt
+    (TargetSourcesBaseModule_key _locator _srcs _baseModule)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+           _srcs)
+        _baseModule
+
+data TargetSources_key = TargetSources_key{targetSources_key_target
+                                           :: Target,
+                                           targetSources_key_headers :: [File],
+                                           targetSources_key_exportedHeaders :: [File],
+                                           targetSources_key_srcs :: [File]}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetSources_key where
+  toJSON
+    (TargetSources_key __field__target __field__headers
+       __field__exportedHeaders __field__srcs)
+    = Aeson.object
+        ("target" .= __field__target :
+           "headers" .= __field__headers :
+             "exportedHeaders" .= __field__exportedHeaders :
+               "srcs" .= __field__srcs : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetSources_key where
+  buildStruct _proxy
+    (TargetSources_key __field__target __field__headers
+       __field__exportedHeaders __field__srcs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "headers" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__headers)
+             :
+             Thrift.genField _proxy "exportedHeaders"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__exportedHeaders)
+               :
+               Thrift.genField _proxy "srcs" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__srcs)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__headers <- ST.newSTRef Default.def
+            __field__exportedHeaders <- ST.newSTRef Default.def
+            __field__srcs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__headers
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__exportedHeaders
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__srcs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__headers <- ST.readSTRef __field__headers
+                                             !__val__exportedHeaders <- ST.readSTRef
+                                                                          __field__exportedHeaders
+                                             !__val__srcs <- ST.readSTRef __field__srcs
+                                             Prelude.pure
+                                               (TargetSources_key __val__target __val__headers
+                                                  __val__exportedHeaders
+                                                  __val__srcs)
+              _idMap
+                = HashMap.fromList
+                    [("target", 1), ("headers", 2), ("exportedHeaders", 3),
+                     ("srcs", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetSources_key where
+  rnf
+    (TargetSources_key __field__target __field__headers
+       __field__exportedHeaders __field__srcs)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__headers `Prelude.seq`
+          DeepSeq.rnf __field__exportedHeaders `Prelude.seq`
+            DeepSeq.rnf __field__srcs `Prelude.seq` ()
+
+instance Default.Default TargetSources_key where
+  def
+    = TargetSources_key Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetSources_key where
+  hashWithSalt __salt
+    (TargetSources_key _target _headers _exportedHeaders _srcs)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+              _headers)
+           _exportedHeaders)
+        _srcs
+
+data TargetOuts_key = TargetOuts_key{targetOuts_key_target ::
+                                     Target,
+                                     targetOuts_key_outputLabel :: Prelude.Maybe OutputLabel,
+                                     targetOuts_key_file :: Glean.Schema.Src.File}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetOuts_key where
+  toJSON
+    (TargetOuts_key __field__target __field__outputLabel __field__file)
+    = Aeson.object
+        ("target" .= __field__target :
+           Prelude.maybe Prelude.id ((:) . ("outputLabel" .=))
+             __field__outputLabel
+             ("file" .= __field__file : Prelude.mempty))
+
+instance Thrift.ThriftStruct TargetOuts_key where
+  buildStruct _proxy
+    (TargetOuts_key __field__target __field__outputLabel __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           let (__cereal__outputLabel, __id__outputLabel)
+                 = case __field__outputLabel of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "outputLabel"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__outputLabel
+               (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3
+                  __id__outputLabel
+                  (Thrift.buildStruct _proxy __field__file)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__outputLabel <- ST.newSTRef Prelude.Nothing
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__outputLabel
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__outputLabel <- ST.readSTRef
+                                                                      __field__outputLabel
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (TargetOuts_key __val__target __val__outputLabel
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList [("target", 1), ("outputLabel", 2), ("file", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetOuts_key where
+  rnf
+    (TargetOuts_key __field__target __field__outputLabel __field__file)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__outputLabel `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default TargetOuts_key where
+  def = TargetOuts_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable TargetOuts_key where
+  hashWithSalt __salt (TargetOuts_key _target _outputLabel _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _outputLabel)
+        _file
+
+data TargetOut_key = TargetOut_key{targetOut_key_target :: Target,
+                                   targetOut_key_file :: Glean.Schema.Src.File}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetOut_key where
+  toJSON (TargetOut_key __field__target __field__file)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetOut_key where
+  buildStruct _proxy (TargetOut_key __field__target __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure (TargetOut_key __val__target __val__file)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetOut_key where
+  rnf (TargetOut_key __field__target __field__file)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default TargetOut_key where
+  def = TargetOut_key Default.def Default.def
+
+instance Hashable.Hashable TargetOut_key where
+  hashWithSalt __salt (TargetOut_key _target _file)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _file
+
+data TargetMode_key = TargetMode_key{targetMode_key_target ::
+                                     Target,
+                                     targetMode_key_mode :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetMode_key where
+  toJSON (TargetMode_key __field__target __field__mode)
+    = Aeson.object
+        ("target" .= __field__target :
+           "mode" .= __field__mode : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetMode_key where
+  buildStruct _proxy (TargetMode_key __field__target __field__mode)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "mode" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__mode)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__mode <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mode
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__mode <- ST.readSTRef __field__mode
+                                             Prelude.pure (TargetMode_key __val__target __val__mode)
+              _idMap = HashMap.fromList [("target", 1), ("mode", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetMode_key where
+  rnf (TargetMode_key __field__target __field__mode)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__mode `Prelude.seq` ()
+
+instance Default.Default TargetMode_key where
+  def = TargetMode_key Default.def ""
+
+instance Hashable.Hashable TargetMode_key where
+  hashWithSalt __salt (TargetMode_key _target _mode)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _mode
+
+data TargetLocation_key = TargetLocation_key{targetLocation_key_locator
+                                             :: Locator,
+                                             targetLocation_key_file :: Glean.Schema.Src.File,
+                                             targetLocation_key_span :: Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetLocation_key where
+  toJSON
+    (TargetLocation_key __field__locator __field__file __field__span)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetLocation_key where
+  buildStruct _proxy
+    (TargetLocation_key __field__locator __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (TargetLocation_key __val__locator __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("locator", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetLocation_key where
+  rnf
+    (TargetLocation_key __field__locator __field__file __field__span)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default TargetLocation_key where
+  def = TargetLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetLocation_key where
+  hashWithSalt __salt (TargetLocation_key _locator _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+           _file)
+        _span
+
+data TargetIndexer_key = TargetIndexer_key{targetIndexer_key_name
+                                           :: TargetIndexerName,
+                                           targetIndexer_key_target :: Target}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetIndexer_key where
+  toJSON (TargetIndexer_key __field__name __field__target)
+    = Aeson.object
+        ("name" .= __field__name :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetIndexer_key where
+  buildStruct _proxy
+    (TargetIndexer_key __field__name __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (TargetIndexer_key __val__name __val__target)
+              _idMap = HashMap.fromList [("name", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetIndexer_key where
+  rnf (TargetIndexer_key __field__name __field__target)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default TargetIndexer_key where
+  def = TargetIndexer_key Default.def Default.def
+
+instance Hashable.Hashable TargetIndexer_key where
+  hashWithSalt __salt (TargetIndexer_key _name _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _target
+
+data TargetHash_key = TargetHash_key{targetHash_key_locator ::
+                                     Locator,
+                                     targetHash_key_targetHash :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetHash_key where
+  toJSON (TargetHash_key __field__locator __field__targetHash)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "targetHash" .= __field__targetHash : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetHash_key where
+  buildStruct _proxy
+    (TargetHash_key __field__locator __field__targetHash)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "targetHash" (Thrift.getStringType _proxy) 2
+             1
+             (Thrift.genText _proxy __field__targetHash)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__targetHash <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetHash
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__targetHash <- ST.readSTRef __field__targetHash
+                                             Prelude.pure
+                                               (TargetHash_key __val__locator __val__targetHash)
+              _idMap = HashMap.fromList [("locator", 1), ("targetHash", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetHash_key where
+  rnf (TargetHash_key __field__locator __field__targetHash)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__targetHash `Prelude.seq` ()
+
+instance Default.Default TargetHash_key where
+  def = TargetHash_key Default.def ""
+
+instance Hashable.Hashable TargetHash_key where
+  hashWithSalt __salt (TargetHash_key _locator _targetHash)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+        _targetHash
+
+data TargetCallByCallExpr_key = TargetCallByCallExpr_key{targetCallByCallExpr_key_callExpr
+                                                         :: CallExpr,
+                                                         targetCallByCallExpr_key_target ::
+                                                         TargetCall}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetCallByCallExpr_key where
+  toJSON (TargetCallByCallExpr_key __field__callExpr __field__target)
+    = Aeson.object
+        ("callExpr" .= __field__callExpr :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetCallByCallExpr_key where
+  buildStruct _proxy
+    (TargetCallByCallExpr_key __field__callExpr __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "callExpr" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__callExpr)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__callExpr <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callExpr
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__callExpr <- ST.readSTRef
+                                                                   __field__callExpr
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (TargetCallByCallExpr_key __val__callExpr
+                                                  __val__target)
+              _idMap = HashMap.fromList [("callExpr", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetCallByCallExpr_key where
+  rnf (TargetCallByCallExpr_key __field__callExpr __field__target)
+    = DeepSeq.rnf __field__callExpr `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default TargetCallByCallExpr_key where
+  def = TargetCallByCallExpr_key Default.def Default.def
+
+instance Hashable.Hashable TargetCallByCallExpr_key where
+  hashWithSalt __salt (TargetCallByCallExpr_key _callExpr _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _callExpr)
+        _target
+
+data TargetCall_key = TargetCall_key{targetCall_key_locator ::
+                                     Locator,
+                                     targetCall_key_arguments :: [CallArgument],
+                                     targetCall_key_file :: Glean.Schema.Src.File,
+                                     targetCall_key_span :: Glean.Schema.Src.ByteSpan,
+                                     targetCall_key_callExpr :: Prelude.Maybe CallExpr}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetCall_key where
+  toJSON
+    (TargetCall_key __field__locator __field__arguments __field__file
+       __field__span __field__callExpr)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "arguments" .= __field__arguments :
+             "file" .= __field__file :
+               "span" .= __field__span :
+                 Prelude.maybe Prelude.id ((:) . ("callExpr" .=)) __field__callExpr
+                   Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetCall_key where
+  buildStruct _proxy
+    (TargetCall_key __field__locator __field__arguments __field__file
+       __field__span __field__callExpr)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__arguments)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 :
+                 case __field__callExpr of
+                   Prelude.Just _val -> Thrift.genField _proxy "callExpr"
+                                          (Thrift.getStructType _proxy)
+                                          5
+                                          4
+                                          (Thrift.buildStruct _proxy _val)
+                                          : []
+                   Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__callExpr <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callExpr
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__callExpr <- ST.readSTRef __field__callExpr
+                                             Prelude.pure
+                                               (TargetCall_key __val__locator __val__arguments
+                                                  __val__file
+                                                  __val__span
+                                                  __val__callExpr)
+              _idMap
+                = HashMap.fromList
+                    [("locator", 1), ("arguments", 2), ("file", 3), ("span", 4),
+                     ("callExpr", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetCall_key where
+  rnf
+    (TargetCall_key __field__locator __field__arguments __field__file
+       __field__span __field__callExpr)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__arguments `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq`
+              DeepSeq.rnf __field__callExpr `Prelude.seq` ()
+
+instance Default.Default TargetCall_key where
+  def
+    = TargetCall_key Default.def Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable TargetCall_key where
+  hashWithSalt __salt
+    (TargetCall_key _locator _arguments _file _span _callExpr)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+                 _arguments)
+              _file)
+           _span)
+        _callExpr
+
+data TargetByType_key = TargetByType_key{targetByType_key_type_ ::
+                                         Type,
+                                         targetByType_key_target :: Target}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetByType_key where
+  toJSON (TargetByType_key __field__type_ __field__target)
+    = Aeson.object
+        ("type_" .= __field__type_ :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetByType_key where
+  buildStruct _proxy
+    (TargetByType_key __field__type_ __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type_)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type_ <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (TargetByType_key __val__type_ __val__target)
+              _idMap = HashMap.fromList [("type_", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetByType_key where
+  rnf (TargetByType_key __field__type_ __field__target)
+    = DeepSeq.rnf __field__type_ `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default TargetByType_key where
+  def = TargetByType_key Default.def Default.def
+
+instance Hashable.Hashable TargetByType_key where
+  hashWithSalt __salt (TargetByType_key _type_ _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type_)
+        _target
+
+data TargetAttribute_key = TargetAttribute_key{targetAttribute_key_target
+                                               :: Target,
+                                               targetAttribute_key_attribute :: AttributeName,
+                                               targetAttribute_key_value :: AttributeValue}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetAttribute_key where
+  toJSON
+    (TargetAttribute_key __field__target __field__attribute
+       __field__value)
+    = Aeson.object
+        ("target" .= __field__target :
+           "attribute" .= __field__attribute :
+             "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetAttribute_key where
+  buildStruct _proxy
+    (TargetAttribute_key __field__target __field__attribute
+       __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "attribute" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__attribute)
+             :
+             Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__value)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__attribute <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__attribute <- ST.readSTRef __field__attribute
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (TargetAttribute_key __val__target __val__attribute
+                                                  __val__value)
+              _idMap
+                = HashMap.fromList [("target", 1), ("attribute", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetAttribute_key where
+  rnf
+    (TargetAttribute_key __field__target __field__attribute
+       __field__value)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__attribute `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default TargetAttribute_key where
+  def = TargetAttribute_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetAttribute_key where
+  hashWithSalt __salt (TargetAttribute_key _target _attribute _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _attribute)
+        _value
+
+data Target_key = Target_key{target_key_locator :: Locator,
+                             target_key_type_ :: Type,
+                             target_key_defaultPlatform :: Prelude.Maybe Platform,
+                             target_key_labels :: Labels}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Target_key where
+  toJSON
+    (Target_key __field__locator __field__type_
+       __field__defaultPlatform __field__labels)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "type_" .= __field__type_ :
+             Prelude.maybe Prelude.id ((:) . ("defaultPlatform" .=))
+               __field__defaultPlatform
+               ("labels" .= __field__labels : Prelude.mempty))
+
+instance Thrift.ThriftStruct Target_key where
+  buildStruct _proxy
+    (Target_key __field__locator __field__type_
+       __field__defaultPlatform __field__labels)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             :
+             let (__cereal__defaultPlatform, __id__defaultPlatform)
+                   = case __field__defaultPlatform of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "defaultPlatform"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__defaultPlatform
+                 (Thrift.genField _proxy "labels" (Thrift.getStructType _proxy) 4
+                    __id__defaultPlatform
+                    (Thrift.buildStruct _proxy __field__labels)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            __field__defaultPlatform <- ST.newSTRef Prelude.Nothing
+            __field__labels <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__defaultPlatform
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__labels
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__defaultPlatform <- ST.readSTRef
+                                                                          __field__defaultPlatform
+                                             !__val__labels <- ST.readSTRef __field__labels
+                                             Prelude.pure
+                                               (Target_key __val__locator __val__type_
+                                                  __val__defaultPlatform
+                                                  __val__labels)
+              _idMap
+                = HashMap.fromList
+                    [("locator", 1), ("type_", 2), ("defaultPlatform", 3),
+                     ("labels", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Target_key where
+  rnf
+    (Target_key __field__locator __field__type_
+       __field__defaultPlatform __field__labels)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq`
+          DeepSeq.rnf __field__defaultPlatform `Prelude.seq`
+            DeepSeq.rnf __field__labels `Prelude.seq` ()
+
+instance Default.Default Target_key where
+  def
+    = Target_key Default.def Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable Target_key where
+  hashWithSalt __salt
+    (Target_key _locator _type_ _defaultPlatform _labels)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+              _type_)
+           _defaultPlatform)
+        _labels
+
+data SourceFileLocation_key = SourceFileLocation_key{sourceFileLocation_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     sourceFileLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceFileLocation_key where
+  toJSON (SourceFileLocation_key __field__file __field__span)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceFileLocation_key where
+  buildStruct _proxy
+    (SourceFileLocation_key __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (SourceFileLocation_key __val__file __val__span)
+              _idMap = HashMap.fromList [("file", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceFileLocation_key where
+  rnf (SourceFileLocation_key __field__file __field__span)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default SourceFileLocation_key where
+  def = SourceFileLocation_key Default.def Default.def
+
+instance Hashable.Hashable SourceFileLocation_key where
+  hashWithSalt __salt (SourceFileLocation_key _file _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span
+
+data SearchByLocalName_key = SearchByLocalName_key{searchByLocalName_key_name
+                                                   :: LocalName,
+                                                   searchByLocalName_key_decl :: XRefDestination}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLocalName_key where
+  toJSON (SearchByLocalName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLocalName_key where
+  buildStruct _proxy
+    (SearchByLocalName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchByLocalName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLocalName_key where
+  rnf (SearchByLocalName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByLocalName_key where
+  def = SearchByLocalName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByLocalName_key where
+  hashWithSalt __salt (SearchByLocalName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data RuleKey_key = RuleKey_key{ruleKey_key_locator :: Locator,
+                               ruleKey_key_ruleKey :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RuleKey_key where
+  toJSON (RuleKey_key __field__locator __field__ruleKey)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "ruleKey" .= __field__ruleKey : Prelude.mempty)
+
+instance Thrift.ThriftStruct RuleKey_key where
+  buildStruct _proxy (RuleKey_key __field__locator __field__ruleKey)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "ruleKey" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__ruleKey)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__ruleKey <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__ruleKey
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__ruleKey <- ST.readSTRef __field__ruleKey
+                                             Prelude.pure
+                                               (RuleKey_key __val__locator __val__ruleKey)
+              _idMap = HashMap.fromList [("locator", 1), ("ruleKey", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RuleKey_key where
+  rnf (RuleKey_key __field__locator __field__ruleKey)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__ruleKey `Prelude.seq` ()
+
+instance Default.Default RuleKey_key where
+  def = RuleKey_key Default.def ""
+
+instance Hashable.Hashable RuleKey_key where
+  hashWithSalt __salt (RuleKey_key _locator _ruleKey)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+        _ruleKey
+
+data Owner_key = Owner_key{owner_key_source ::
+                           Glean.Schema.Src.File,
+                           owner_key_owner :: TargetSources}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Owner_key where
+  toJSON (Owner_key __field__source __field__owner)
+    = Aeson.object
+        ("source" .= __field__source :
+           "owner" .= __field__owner : Prelude.mempty)
+
+instance Thrift.ThriftStruct Owner_key where
+  buildStruct _proxy (Owner_key __field__source __field__owner)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "owner" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__owner)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__owner <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__owner
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__owner <- ST.readSTRef __field__owner
+                                             Prelude.pure (Owner_key __val__source __val__owner)
+              _idMap = HashMap.fromList [("source", 1), ("owner", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Owner_key where
+  rnf (Owner_key __field__source __field__owner)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__owner `Prelude.seq` ()
+
+instance Default.Default Owner_key where
+  def = Owner_key Default.def Default.def
+
+instance Hashable.Hashable Owner_key where
+  hashWithSalt __salt (Owner_key _source _owner)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _owner
+
+data OutsTarget_key = OutsTarget_key{outsTarget_key_file ::
+                                     Glean.Schema.Src.File,
+                                     outsTarget_key_target :: Target,
+                                     outsTarget_key_outputLabel :: Prelude.Maybe OutputLabel}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OutsTarget_key where
+  toJSON
+    (OutsTarget_key __field__file __field__target __field__outputLabel)
+    = Aeson.object
+        ("file" .= __field__file :
+           "target" .= __field__target :
+             Prelude.maybe Prelude.id ((:) . ("outputLabel" .=))
+               __field__outputLabel
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct OutsTarget_key where
+  buildStruct _proxy
+    (OutsTarget_key __field__file __field__target __field__outputLabel)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             :
+             case __field__outputLabel of
+               Prelude.Just _val -> Thrift.genField _proxy "outputLabel"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__outputLabel <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__outputLabel
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__outputLabel <- ST.readSTRef
+                                                                      __field__outputLabel
+                                             Prelude.pure
+                                               (OutsTarget_key __val__file __val__target
+                                                  __val__outputLabel)
+              _idMap
+                = HashMap.fromList [("file", 1), ("target", 2), ("outputLabel", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData OutsTarget_key where
+  rnf
+    (OutsTarget_key __field__file __field__target __field__outputLabel)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq`
+          DeepSeq.rnf __field__outputLabel `Prelude.seq` ()
+
+instance Default.Default OutsTarget_key where
+  def = OutsTarget_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable OutsTarget_key where
+  hashWithSalt __salt (OutsTarget_key _file _target _outputLabel)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _target)
+        _outputLabel
+
+data OutTarget_key = OutTarget_key{outTarget_key_file ::
+                                   Glean.Schema.Src.File,
+                                   outTarget_key_target :: Target}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OutTarget_key where
+  toJSON (OutTarget_key __field__file __field__target)
+    = Aeson.object
+        ("file" .= __field__file :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct OutTarget_key where
+  buildStruct _proxy (OutTarget_key __field__file __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure (OutTarget_key __val__file __val__target)
+              _idMap = HashMap.fromList [("file", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OutTarget_key where
+  rnf (OutTarget_key __field__file __field__target)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default OutTarget_key where
+  def = OutTarget_key Default.def Default.def
+
+instance Hashable.Hashable OutTarget_key where
+  hashWithSalt __salt (OutTarget_key _file _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _target
+
+data LocatorWithLabel_key = LocatorWithLabel_key{locatorWithLabel_key_locator
+                                                 :: Locator,
+                                                 locatorWithLabel_key_label :: OutputLabel}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorWithLabel_key where
+  toJSON (LocatorWithLabel_key __field__locator __field__label)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "label" .= __field__label : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorWithLabel_key where
+  buildStruct _proxy
+    (LocatorWithLabel_key __field__locator __field__label)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "label" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__label)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__label <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__label
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__label <- ST.readSTRef __field__label
+                                             Prelude.pure
+                                               (LocatorWithLabel_key __val__locator __val__label)
+              _idMap = HashMap.fromList [("locator", 1), ("label", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorWithLabel_key where
+  rnf (LocatorWithLabel_key __field__locator __field__label)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__label `Prelude.seq` ()
+
+instance Default.Default LocatorWithLabel_key where
+  def = LocatorWithLabel_key Default.def Default.def
+
+instance Hashable.Hashable LocatorWithLabel_key where
+  hashWithSalt __salt (LocatorWithLabel_key _locator _label)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+        _label
+
+data LocatorReverseDeps_key = LocatorReverseDeps_key{locatorReverseDeps_key_locator
+                                                     :: Locator,
+                                                     locatorReverseDeps_key_rdeps :: [Locator]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorReverseDeps_key where
+  toJSON (LocatorReverseDeps_key __field__locator __field__rdeps)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "rdeps" .= __field__rdeps : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorReverseDeps_key where
+  buildStruct _proxy
+    (LocatorReverseDeps_key __field__locator __field__rdeps)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "rdeps" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__rdeps)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__rdeps <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__rdeps
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__rdeps <- ST.readSTRef __field__rdeps
+                                             Prelude.pure
+                                               (LocatorReverseDeps_key __val__locator __val__rdeps)
+              _idMap = HashMap.fromList [("locator", 1), ("rdeps", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorReverseDeps_key where
+  rnf (LocatorReverseDeps_key __field__locator __field__rdeps)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__rdeps `Prelude.seq` ()
+
+instance Default.Default LocatorReverseDeps_key where
+  def = LocatorReverseDeps_key Default.def Default.def
+
+instance Hashable.Hashable LocatorReverseDeps_key where
+  hashWithSalt __salt (LocatorReverseDeps_key _locator _rdeps)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+        _rdeps
+
+data LocatorReverseDep_key = LocatorReverseDep_key{locatorReverseDep_key_locator
+                                                   :: Locator,
+                                                   locatorReverseDep_key_rdep :: Locator}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocatorReverseDep_key where
+  toJSON (LocatorReverseDep_key __field__locator __field__rdep)
+    = Aeson.object
+        ("locator" .= __field__locator :
+           "rdep" .= __field__rdep : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocatorReverseDep_key where
+  buildStruct _proxy
+    (LocatorReverseDep_key __field__locator __field__rdep)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locator)
+           :
+           Thrift.genField _proxy "rdep" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__rdep)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locator <- ST.newSTRef Default.def
+            __field__rdep <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__rdep
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locator <- ST.readSTRef
+                                                                  __field__locator
+                                             !__val__rdep <- ST.readSTRef __field__rdep
+                                             Prelude.pure
+                                               (LocatorReverseDep_key __val__locator __val__rdep)
+              _idMap = HashMap.fromList [("locator", 1), ("rdep", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocatorReverseDep_key where
+  rnf (LocatorReverseDep_key __field__locator __field__rdep)
+    = DeepSeq.rnf __field__locator `Prelude.seq`
+        DeepSeq.rnf __field__rdep `Prelude.seq` ()
+
+instance Default.Default LocatorReverseDep_key where
+  def = LocatorReverseDep_key Default.def Default.def
+
+instance Hashable.Hashable LocatorReverseDep_key where
+  hashWithSalt __salt (LocatorReverseDep_key _locator _rdep)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locator)
+        _rdep
+
+data Locator_key = Locator_key{locator_key_subdir ::
+                               Prelude.Maybe Text.Text,
+                               locator_key_path :: Text.Text, locator_key_name :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Locator_key where
+  toJSON (Locator_key __field__subdir __field__path __field__name)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("subdir" .=)) __field__subdir
+           ("path" .= __field__path :
+              "name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct Locator_key where
+  buildStruct _proxy
+    (Locator_key __field__subdir __field__path __field__name)
+    = Thrift.genStruct _proxy
+        (let (__cereal__subdir, __id__subdir)
+               = case __field__subdir of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "subdir"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              (Thrift.genText _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__subdir
+             (Thrift.genField _proxy "path" (Thrift.getStringType _proxy) 2
+                __id__subdir
+                (Thrift.genText _proxy __field__path)
+                :
+                Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3 2
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__subdir <- ST.newSTRef Prelude.Nothing
+            __field__path <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__subdir
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__path
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__subdir <- ST.readSTRef
+                                                                 __field__subdir
+                                             !__val__path <- ST.readSTRef __field__path
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (Locator_key __val__subdir __val__path __val__name)
+              _idMap = HashMap.fromList [("subdir", 1), ("path", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Locator_key where
+  rnf (Locator_key __field__subdir __field__path __field__name)
+    = DeepSeq.rnf __field__subdir `Prelude.seq`
+        DeepSeq.rnf __field__path `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Locator_key where
+  def = Locator_key Prelude.Nothing "" ""
+
+instance Hashable.Hashable Locator_key where
+  hashWithSalt __salt (Locator_key _subdir _path _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _subdir)
+           _path)
+        _name
+
+data LocalNameLowerCase_key = LocalNameLowerCase_key{localNameLowerCase_key_lowercase
+                                                     :: Text.Text,
+                                                     localNameLowerCase_key_name :: LocalName}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalNameLowerCase_key where
+  toJSON (LocalNameLowerCase_key __field__lowercase __field__name)
+    = Aeson.object
+        ("lowercase" .= __field__lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalNameLowerCase_key where
+  buildStruct _proxy
+    (LocalNameLowerCase_key __field__lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lowercase" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lowercase <- ST.readSTRef
+                                                                    __field__lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (LocalNameLowerCase_key __val__lowercase __val__name)
+              _idMap = HashMap.fromList [("lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalNameLowerCase_key where
+  rnf (LocalNameLowerCase_key __field__lowercase __field__name)
+    = DeepSeq.rnf __field__lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default LocalNameLowerCase_key where
+  def = LocalNameLowerCase_key "" Default.def
+
+instance Hashable.Hashable LocalNameLowerCase_key where
+  hashWithSalt __salt (LocalNameLowerCase_key _lowercase _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lowercase)
+        _name
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data FileToTarget_key = FileToTarget_key{fileToTarget_key_source ::
+                                         Glean.Schema.Src.File,
+                                         fileToTarget_key_locator :: Locator}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileToTarget_key where
+  toJSON (FileToTarget_key __field__source __field__locator)
+    = Aeson.object
+        ("source" .= __field__source :
+           "locator" .= __field__locator : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileToTarget_key where
+  buildStruct _proxy
+    (FileToTarget_key __field__source __field__locator)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__locator)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__locator <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__locator <- ST.readSTRef __field__locator
+                                             Prelude.pure
+                                               (FileToTarget_key __val__source __val__locator)
+              _idMap = HashMap.fromList [("source", 1), ("locator", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileToTarget_key where
+  rnf (FileToTarget_key __field__source __field__locator)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__locator `Prelude.seq` ()
+
+instance Default.Default FileToTarget_key where
+  def = FileToTarget_key Default.def Default.def
+
+instance Hashable.Hashable FileToTarget_key where
+  hashWithSalt __salt (FileToTarget_key _source _locator)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _locator
+
+data FileTarget_key = FileTarget_key{fileTarget_key_file ::
+                                     Glean.Schema.Src.File,
+                                     fileTarget_key_locator :: Locator}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileTarget_key where
+  toJSON (FileTarget_key __field__file __field__locator)
+    = Aeson.object
+        ("file" .= __field__file :
+           "locator" .= __field__locator : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileTarget_key where
+  buildStruct _proxy (FileTarget_key __field__file __field__locator)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__locator)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__locator <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locator
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__locator <- ST.readSTRef __field__locator
+                                             Prelude.pure
+                                               (FileTarget_key __val__file __val__locator)
+              _idMap = HashMap.fromList [("file", 1), ("locator", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileTarget_key where
+  rnf (FileTarget_key __field__file __field__locator)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__locator `Prelude.seq` ()
+
+instance Default.Default FileTarget_key where
+  def = FileTarget_key Default.def Default.def
+
+instance Hashable.Hashable FileTarget_key where
+  hashWithSalt __salt (FileTarget_key _file _locator)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _locator
+
+data FileResolved_key = FileResolved_key{fileResolved_key_buckFile
+                                         :: File,
+                                         fileResolved_key_srcFile :: Glean.Schema.Src.File}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileResolved_key where
+  toJSON (FileResolved_key __field__buckFile __field__srcFile)
+    = Aeson.object
+        ("buckFile" .= __field__buckFile :
+           "srcFile" .= __field__srcFile : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileResolved_key where
+  buildStruct _proxy
+    (FileResolved_key __field__buckFile __field__srcFile)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "buckFile" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__buckFile)
+           :
+           Thrift.genField _proxy "srcFile" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__srcFile)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__buckFile <- ST.newSTRef Default.def
+            __field__srcFile <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__buckFile
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__srcFile
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__buckFile <- ST.readSTRef
+                                                                   __field__buckFile
+                                             !__val__srcFile <- ST.readSTRef __field__srcFile
+                                             Prelude.pure
+                                               (FileResolved_key __val__buckFile __val__srcFile)
+              _idMap = HashMap.fromList [("buckFile", 1), ("srcFile", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileResolved_key where
+  rnf (FileResolved_key __field__buckFile __field__srcFile)
+    = DeepSeq.rnf __field__buckFile `Prelude.seq`
+        DeepSeq.rnf __field__srcFile `Prelude.seq` ()
+
+instance Default.Default FileResolved_key where
+  def = FileResolved_key Default.def Default.def
+
+instance Hashable.Hashable FileResolved_key where
+  hashWithSalt __salt (FileResolved_key _buckFile _srcFile)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _buckFile)
+        _srcFile
+
+data FileEntity_key = FileEntity_key{fileEntity_key_file ::
+                                     Glean.Schema.Src.File,
+                                     fileEntity_key_entity :: XRefDestination}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntity_key where
+  toJSON (FileEntity_key __field__file __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntity_key where
+  buildStruct _proxy (FileEntity_key __field__file __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure (FileEntity_key __val__file __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntity_key where
+  rnf (FileEntity_key __field__file __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntity_key where
+  def = FileEntity_key Default.def Default.def
+
+instance Hashable.Hashable FileEntity_key where
+  hashWithSalt __salt (FileEntity_key _file _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _entity
+
+data FileDefinition_key = FileDefinition_key{fileDefinition_key_file
+                                             :: Glean.Schema.Src.File,
+                                             fileDefinition_key_definition :: Definition}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDefinition_key where
+  toJSON (FileDefinition_key __field__file __field__definition)
+    = Aeson.object
+        ("file" .= __field__file :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDefinition_key where
+  buildStruct _proxy
+    (FileDefinition_key __field__file __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (FileDefinition_key __val__file __val__definition)
+              _idMap = HashMap.fromList [("file", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDefinition_key where
+  rnf (FileDefinition_key __field__file __field__definition)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default FileDefinition_key where
+  def = FileDefinition_key Default.def Default.def
+
+instance Hashable.Hashable FileDefinition_key where
+  hashWithSalt __salt (FileDefinition_key _file _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _definition
+
+data File_key = File_key_source Glean.Schema.Src.File
+              | File_key_generated Locator
+              | File_key_generatedLabel LocatorWithLabel
+              | File_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON File_key where
+  toJSON (File_key_source __source)
+    = Aeson.object ["source" .= __source]
+  toJSON (File_key_generated __generated)
+    = Aeson.object ["generated" .= __generated]
+  toJSON (File_key_generatedLabel __generatedLabel)
+    = Aeson.object ["generatedLabel" .= __generatedLabel]
+  toJSON File_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct File_key where
+  buildStruct _proxy (File_key_source __source)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __source)]
+  buildStruct _proxy (File_key_generated __generated)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "generated" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __generated)]
+  buildStruct _proxy (File_key_generatedLabel __generatedLabel)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "generatedLabel"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __generatedLabel)]
+  buildStruct _proxy File_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (File_key_source _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (File_key_generated _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (File_key_generatedLabel _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return File_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return File_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("source", 1), ("generated", 2), ("generatedLabel", 3)]
+
+instance DeepSeq.NFData File_key where
+  rnf (File_key_source __source) = DeepSeq.rnf __source
+  rnf (File_key_generated __generated) = DeepSeq.rnf __generated
+  rnf (File_key_generatedLabel __generatedLabel)
+    = DeepSeq.rnf __generatedLabel
+  rnf File_key_EMPTY = ()
+
+instance Default.Default File_key where
+  def = File_key_EMPTY
+
+instance Hashable.Hashable File_key where
+  hashWithSalt __salt (File_key_source _source)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _source)
+  hashWithSalt __salt (File_key_generated _generated)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _generated)
+  hashWithSalt __salt (File_key_generatedLabel _generatedLabel)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _generatedLabel)
+  hashWithSalt __salt File_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FailureReason = FailureReason_Skipped
+                   | FailureReason_Blocked
+                   | FailureReason_EmptyCdb
+                   | FailureReason_FailedCdb
+                   | FailureReason_QueryFailed
+                   | FailureReason_Unclassified
+                   | FailureReason__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FailureReason where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData FailureReason where
+  rnf __FailureReason = Prelude.seq __FailureReason ()
+
+instance Default.Default FailureReason where
+  def = FailureReason_Skipped
+
+instance Hashable.Hashable FailureReason where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum FailureReason where
+  toThriftEnum 0 = FailureReason_Skipped
+  toThriftEnum 1 = FailureReason_Blocked
+  toThriftEnum 2 = FailureReason_EmptyCdb
+  toThriftEnum 3 = FailureReason_FailedCdb
+  toThriftEnum 4 = FailureReason_QueryFailed
+  toThriftEnum 5 = FailureReason_Unclassified
+  toThriftEnum val = FailureReason__UNKNOWN val
+  fromThriftEnum FailureReason_Skipped = 0
+  fromThriftEnum FailureReason_Blocked = 1
+  fromThriftEnum FailureReason_EmptyCdb = 2
+  fromThriftEnum FailureReason_FailedCdb = 3
+  fromThriftEnum FailureReason_QueryFailed = 4
+  fromThriftEnum FailureReason_Unclassified = 5
+  fromThriftEnum (FailureReason__UNKNOWN val) = val
+  allThriftEnumValues
+    = [FailureReason_Skipped, FailureReason_Blocked,
+       FailureReason_EmptyCdb, FailureReason_FailedCdb,
+       FailureReason_QueryFailed, FailureReason_Unclassified]
+  toThriftEnumEither 0 = Prelude.Right FailureReason_Skipped
+  toThriftEnumEither 1 = Prelude.Right FailureReason_Blocked
+  toThriftEnumEither 2 = Prelude.Right FailureReason_EmptyCdb
+  toThriftEnumEither 3 = Prelude.Right FailureReason_FailedCdb
+  toThriftEnumEither 4 = Prelude.Right FailureReason_QueryFailed
+  toThriftEnumEither 5 = Prelude.Right FailureReason_Unclassified
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum FailureReason: "
+           ++ Prelude.show val)
+
+data IndexFailureX_source = IndexFailureX_source_locator Locator
+                          | IndexFailureX_source_buildFile Glean.Schema.Src.File
+                          | IndexFailureX_source_EMPTY
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailureX_source where
+  toJSON (IndexFailureX_source_locator __locator)
+    = Aeson.object ["locator" .= __locator]
+  toJSON (IndexFailureX_source_buildFile __buildFile)
+    = Aeson.object ["buildFile" .= __buildFile]
+  toJSON IndexFailureX_source_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct IndexFailureX_source where
+  buildStruct _proxy (IndexFailureX_source_locator __locator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __locator)]
+  buildStruct _proxy (IndexFailureX_source_buildFile __buildFile)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "buildFile" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __buildFile)]
+  buildStruct _proxy IndexFailureX_source_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (IndexFailureX_source_locator _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (IndexFailureX_source_buildFile _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               IndexFailureX_source_EMPTY
+           Thrift.FieldEnd -> Prelude.return IndexFailureX_source_EMPTY
+    where
+      _idMap = HashMap.fromList [("locator", 1), ("buildFile", 2)]
+
+instance DeepSeq.NFData IndexFailureX_source where
+  rnf (IndexFailureX_source_locator __locator)
+    = DeepSeq.rnf __locator
+  rnf (IndexFailureX_source_buildFile __buildFile)
+    = DeepSeq.rnf __buildFile
+  rnf IndexFailureX_source_EMPTY = ()
+
+instance Default.Default IndexFailureX_source where
+  def = IndexFailureX_source_EMPTY
+
+instance Hashable.Hashable IndexFailureX_source where
+  hashWithSalt __salt (IndexFailureX_source_locator _locator)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _locator)
+  hashWithSalt __salt (IndexFailureX_source_buildFile _buildFile)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _buildFile)
+  hashWithSalt __salt IndexFailureX_source_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data IndexFailureX_key = IndexFailureX_key{indexFailureX_key_source
+                                           :: IndexFailureX_source,
+                                           indexFailureX_key_indexer :: IndexerName,
+                                           indexFailureX_key_reason :: FailureReason,
+                                           indexFailureX_key_details :: Text.Text,
+                                           indexFailureX_key_repro :: Prelude.Maybe Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailureX_key where
+  toJSON
+    (IndexFailureX_key __field__source __field__indexer __field__reason
+       __field__details __field__repro)
+    = Aeson.object
+        ("source" .= __field__source :
+           "indexer" .= __field__indexer :
+             "reason" .= __field__reason :
+               "details" .= __field__details :
+                 Prelude.maybe Prelude.id ((:) . ("repro" .=)) __field__repro
+                   Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexFailureX_key where
+  buildStruct _proxy
+    (IndexFailureX_key __field__source __field__indexer __field__reason
+       __field__details __field__repro)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "indexer" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__indexer)
+             :
+             Thrift.genField _proxy "reason" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__reason)
+               :
+               Thrift.genField _proxy "details" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__details)
+                 :
+                 case __field__repro of
+                   Prelude.Just _val -> Thrift.genField _proxy "repro"
+                                          (Thrift.getStringType _proxy)
+                                          5
+                                          4
+                                          (Thrift.genText _proxy _val)
+                                          : []
+                   Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__indexer <- ST.newSTRef Default.def
+            __field__reason <- ST.newSTRef Default.def
+            __field__details <- ST.newSTRef ""
+            __field__repro <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__indexer
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "FailureReason")
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__details
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__repro
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__indexer <- ST.readSTRef __field__indexer
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             !__val__details <- ST.readSTRef __field__details
+                                             !__val__repro <- ST.readSTRef __field__repro
+                                             Prelude.pure
+                                               (IndexFailureX_key __val__source __val__indexer
+                                                  __val__reason
+                                                  __val__details
+                                                  __val__repro)
+              _idMap
+                = HashMap.fromList
+                    [("source", 1), ("indexer", 2), ("reason", 3), ("details", 4),
+                     ("repro", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexFailureX_key where
+  rnf
+    (IndexFailureX_key __field__source __field__indexer __field__reason
+       __field__details __field__repro)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__indexer `Prelude.seq`
+          DeepSeq.rnf __field__reason `Prelude.seq`
+            DeepSeq.rnf __field__details `Prelude.seq`
+              DeepSeq.rnf __field__repro `Prelude.seq` ()
+
+instance Default.Default IndexFailureX_key where
+  def
+    = IndexFailureX_key Default.def Default.def Default.def ""
+        Prelude.Nothing
+
+instance Hashable.Hashable IndexFailureX_key where
+  hashWithSalt __salt
+    (IndexFailureX_key _source _indexer _reason _details _repro)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+                 _indexer)
+              _reason)
+           _details)
+        _repro
+
+data DestinationUses_key = DestinationUses_key{destinationUses_key_destination
+                                               :: XRefDestination,
+                                               destinationUses_key_file :: Glean.Schema.Src.File,
+                                               destinationUses_key_spans ::
+                                               [Glean.Schema.Src.ByteSpan]}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DestinationUses_key where
+  toJSON
+    (DestinationUses_key __field__destination __field__file
+       __field__spans)
+    = Aeson.object
+        ("destination" .= __field__destination :
+           "file" .= __field__file :
+             "spans" .= __field__spans : Prelude.mempty)
+
+instance Thrift.ThriftStruct DestinationUses_key where
+  buildStruct _proxy
+    (DestinationUses_key __field__destination __field__file
+       __field__spans)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "destination" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__destination)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "spans" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__spans)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__destination <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__spans <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__destination
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__spans
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__destination <- ST.readSTRef
+                                                                      __field__destination
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__spans <- ST.readSTRef __field__spans
+                                             Prelude.pure
+                                               (DestinationUses_key __val__destination __val__file
+                                                  __val__spans)
+              _idMap
+                = HashMap.fromList [("destination", 1), ("file", 2), ("spans", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DestinationUses_key where
+  rnf
+    (DestinationUses_key __field__destination __field__file
+       __field__spans)
+    = DeepSeq.rnf __field__destination `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__spans `Prelude.seq` ()
+
+instance Default.Default DestinationUses_key where
+  def = DestinationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DestinationUses_key where
+  hashWithSalt __salt (DestinationUses_key _destination _file _spans)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _destination)
+           _file)
+        _spans
+
+data Dependency = Dependency{dependency_target :: Locator,
+                             dependency_explicit_ :: Prelude.Bool,
+                             dependency_exported :: Prelude.Bool}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Dependency where
+  toJSON
+    (Dependency __field__target __field__explicit_ __field__exported)
+    = Aeson.object
+        ("target" .= __field__target :
+           "explicit_" .= __field__explicit_ :
+             "exported" .= __field__exported : Prelude.mempty)
+
+instance Thrift.ThriftStruct Dependency where
+  buildStruct _proxy
+    (Dependency __field__target __field__explicit_ __field__exported)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genFieldBool _proxy "explicit_" 2 1 __field__explicit_ :
+             Thrift.genFieldBool _proxy "exported" 3 2 __field__exported : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__explicit_ <- ST.newSTRef Prelude.False
+            __field__exported <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__explicit_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__exported
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__explicit_ <- ST.readSTRef __field__explicit_
+                                             !__val__exported <- ST.readSTRef __field__exported
+                                             Prelude.pure
+                                               (Dependency __val__target __val__explicit_
+                                                  __val__exported)
+              _idMap
+                = HashMap.fromList
+                    [("target", 1), ("explicit_", 2), ("exported", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Dependency where
+  rnf
+    (Dependency __field__target __field__explicit_ __field__exported)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__explicit_ `Prelude.seq`
+          DeepSeq.rnf __field__exported `Prelude.seq` ()
+
+instance Default.Default Dependency where
+  def = Dependency Default.def Prelude.False Prelude.False
+
+instance Hashable.Hashable Dependency where
+  hashWithSalt __salt (Dependency _target _explicit_ _exported)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _explicit_)
+        _exported
+
+data TargetDependencies_key = TargetDependencies_key{targetDependencies_key_target
+                                                     :: Target,
+                                                     targetDependencies_key_dependencies ::
+                                                     [Dependency]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetDependencies_key where
+  toJSON
+    (TargetDependencies_key __field__target __field__dependencies)
+    = Aeson.object
+        ("target" .= __field__target :
+           "dependencies" .= __field__dependencies : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetDependencies_key where
+  buildStruct _proxy
+    (TargetDependencies_key __field__target __field__dependencies)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "dependencies" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__dependencies)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__dependencies <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__dependencies
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__dependencies <- ST.readSTRef
+                                                                       __field__dependencies
+                                             Prelude.pure
+                                               (TargetDependencies_key __val__target
+                                                  __val__dependencies)
+              _idMap = HashMap.fromList [("target", 1), ("dependencies", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetDependencies_key where
+  rnf (TargetDependencies_key __field__target __field__dependencies)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__dependencies `Prelude.seq` ()
+
+instance Default.Default TargetDependencies_key where
+  def = TargetDependencies_key Default.def Default.def
+
+instance Hashable.Hashable TargetDependencies_key where
+  hashWithSalt __salt (TargetDependencies_key _target _dependencies)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _dependencies
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_definition
+                                                     :: Definition,
+                                                     definitionLocation_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     definitionLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = Aeson.object
+        ("definition" .= __field__definition :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__definition)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__definition <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__definition <- ST.readSTRef
+                                                                     __field__definition
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__definition __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("definition", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = DeepSeq.rnf __field__definition `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt
+    (DefinitionLocation_key _definition _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _definition)
+           _file)
+        _span
+
+data Definition_key = Definition_key{definition_key_module ::
+                                     Glean.Schema.Src.File,
+                                     definition_key_name :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition_key where
+  toJSON (Definition_key __field__module __field__name)
+    = Aeson.object
+        ("module" .= __field__module :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition_key where
+  buildStruct _proxy (Definition_key __field__module __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Definition_key __val__module __val__name)
+              _idMap = HashMap.fromList [("module", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition_key where
+  rnf (Definition_key __field__module __field__name)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Definition_key where
+  def = Definition_key Default.def ""
+
+instance Hashable.Hashable Definition_key where
+  hashWithSalt __salt (Definition_key _module _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _name
+
+data Consumer_key = Consumer_key{consumer_key_source ::
+                                 Glean.Schema.Src.File,
+                                 consumer_key_consumer :: TargetSources}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Consumer_key where
+  toJSON (Consumer_key __field__source __field__consumer)
+    = Aeson.object
+        ("source" .= __field__source :
+           "consumer" .= __field__consumer : Prelude.mempty)
+
+instance Thrift.ThriftStruct Consumer_key where
+  buildStruct _proxy (Consumer_key __field__source __field__consumer)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "consumer" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__consumer)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__consumer <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__consumer
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__consumer <- ST.readSTRef __field__consumer
+                                             Prelude.pure
+                                               (Consumer_key __val__source __val__consumer)
+              _idMap = HashMap.fromList [("source", 1), ("consumer", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Consumer_key where
+  rnf (Consumer_key __field__source __field__consumer)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__consumer `Prelude.seq` ()
+
+instance Default.Default Consumer_key where
+  def = Consumer_key Default.def Default.def
+
+instance Hashable.Hashable Consumer_key where
+  hashWithSalt __salt (Consumer_key _source _consumer)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _consumer
+
+data CallName = CallName_prim Text.Text
+              | CallName_definition Definition
+              | CallName_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallName where
+  toJSON (CallName_prim __prim) = Aeson.object ["prim" .= __prim]
+  toJSON (CallName_definition __definition)
+    = Aeson.object ["definition" .= __definition]
+  toJSON CallName_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct CallName where
+  buildStruct _proxy (CallName_prim __prim)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "prim" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __prim)]
+  buildStruct _proxy (CallName_definition __definition)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __definition)]
+  buildStruct _proxy CallName_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (CallName_prim _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (CallName_definition _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return CallName_EMPTY
+           Thrift.FieldEnd -> Prelude.return CallName_EMPTY
+    where
+      _idMap = HashMap.fromList [("prim", 1), ("definition", 2)]
+
+instance DeepSeq.NFData CallName where
+  rnf (CallName_prim __prim) = DeepSeq.rnf __prim
+  rnf (CallName_definition __definition) = DeepSeq.rnf __definition
+  rnf CallName_EMPTY = ()
+
+instance Default.Default CallName where
+  def = CallName_EMPTY
+
+instance Hashable.Hashable CallName where
+  hashWithSalt __salt (CallName_prim _prim)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _prim)
+  hashWithSalt __salt (CallName_definition _definition)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _definition)
+  hashWithSalt __salt CallName_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data CallExpr_accessor_ = CallExpr_accessor_{callExpr_accessor__name
+                                             :: CallExpr,
+                                             callExpr_accessor__field :: Text.Text}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallExpr_accessor_ where
+  toJSON (CallExpr_accessor_ __field__name __field__field)
+    = Aeson.object
+        ("name" .= __field__name :
+           "field" .= __field__field : Prelude.mempty)
+
+instance Thrift.ThriftStruct CallExpr_accessor_ where
+  buildStruct _proxy
+    (CallExpr_accessor_ __field__name __field__field)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "field" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__field)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__field <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__field
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__field <- ST.readSTRef __field__field
+                                             Prelude.pure
+                                               (CallExpr_accessor_ __val__name __val__field)
+              _idMap = HashMap.fromList [("name", 1), ("field", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CallExpr_accessor_ where
+  rnf (CallExpr_accessor_ __field__name __field__field)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__field `Prelude.seq` ()
+
+instance Default.Default CallExpr_accessor_ where
+  def = CallExpr_accessor_ Default.def ""
+
+instance Hashable.Hashable CallExpr_accessor_ where
+  hashWithSalt __salt (CallExpr_accessor_ _name _field)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _field
+
+data CallExpr_key = CallExpr_key_name CallName
+                  | CallExpr_key_accessor CallExpr_accessor_
+                  | CallExpr_key_EMPTY
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallExpr_key where
+  toJSON (CallExpr_key_name __name) = Aeson.object ["name" .= __name]
+  toJSON (CallExpr_key_accessor __accessor)
+    = Aeson.object ["accessor" .= __accessor]
+  toJSON CallExpr_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct CallExpr_key where
+  buildStruct _proxy (CallExpr_key_name __name)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __name)]
+  buildStruct _proxy (CallExpr_key_accessor __accessor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "accessor" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __accessor)]
+  buildStruct _proxy CallExpr_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (CallExpr_key_name _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (CallExpr_key_accessor _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return CallExpr_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return CallExpr_key_EMPTY
+    where
+      _idMap = HashMap.fromList [("name", 1), ("accessor", 2)]
+
+instance DeepSeq.NFData CallExpr_key where
+  rnf (CallExpr_key_name __name) = DeepSeq.rnf __name
+  rnf (CallExpr_key_accessor __accessor) = DeepSeq.rnf __accessor
+  rnf CallExpr_key_EMPTY = ()
+
+instance Default.Default CallExpr_key where
+  def = CallExpr_key_EMPTY
+
+instance Hashable.Hashable CallExpr_key where
+  hashWithSalt __salt (CallExpr_key_name _name)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _name)
+  hashWithSalt __salt (CallExpr_key_accessor _accessor)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _accessor)
+  hashWithSalt __salt CallExpr_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data CallArgument_key = CallArgument_key{callArgument_key_label ::
+                                         Prelude.Maybe Text.Text,
+                                         callArgument_key_value :: ArgumentValue,
+                                         callArgument_key_file :: Glean.Schema.Src.File,
+                                         callArgument_key_span :: Glean.Schema.Src.ByteSpan}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallArgument_key where
+  toJSON
+    (CallArgument_key __field__label __field__value __field__file
+       __field__span)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("label" .=)) __field__label
+           ("value" .= __field__value :
+              "file" .= __field__file :
+                "span" .= __field__span : Prelude.mempty))
+
+instance Thrift.ThriftStruct CallArgument_key where
+  buildStruct _proxy
+    (CallArgument_key __field__label __field__value __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (let (__cereal__label, __id__label)
+               = case __field__label of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "label"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              (Thrift.genText _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__label
+             (Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2
+                __id__label
+                (Thrift.buildStruct _proxy __field__value)
+                :
+                Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+                  (Thrift.buildStruct _proxy __field__file)
+                  :
+                  Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                    (Thrift.buildStruct _proxy __field__span)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__label <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__label
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__label <- ST.readSTRef __field__label
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (CallArgument_key __val__label __val__value
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("label", 1), ("value", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData CallArgument_key where
+  rnf
+    (CallArgument_key __field__label __field__value __field__file
+       __field__span)
+    = DeepSeq.rnf __field__label `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default CallArgument_key where
+  def
+    = CallArgument_key Prelude.Nothing Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CallArgument_key where
+  hashWithSalt __salt (CallArgument_key _label _value _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _label)
+              _value)
+           _file)
+        _span
+
+data AttributeMapping = AttributeMapping{attributeMapping_key ::
+                                         Text.Text,
+                                         attributeMapping_value :: AttributeValue}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeMapping where
+  toJSON (AttributeMapping __field__key __field__value)
+    = Aeson.object
+        ("key" .= __field__key :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeMapping where
+  buildStruct _proxy (AttributeMapping __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__key)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key <- ST.newSTRef ""
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (AttributeMapping __val__key __val__value)
+              _idMap = HashMap.fromList [("key", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeMapping where
+  rnf (AttributeMapping __field__key __field__value)
+    = DeepSeq.rnf __field__key `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default AttributeMapping where
+  def = AttributeMapping "" Default.def
+
+instance Hashable.Hashable AttributeMapping where
+  hashWithSalt __salt (AttributeMapping _key _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key) _value
+
+data AttributeValue_key = AttributeValue_key_str Text.Text
+                        | AttributeValue_key_sequence [AttributeValue]
+                        | AttributeValue_key_mapping [AttributeMapping]
+                        | AttributeValue_key_EMPTY
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeValue_key where
+  toJSON (AttributeValue_key_str __str)
+    = Aeson.object ["str" .= __str]
+  toJSON (AttributeValue_key_sequence __sequence)
+    = Aeson.object ["sequence" .= __sequence]
+  toJSON (AttributeValue_key_mapping __mapping)
+    = Aeson.object ["mapping" .= __mapping]
+  toJSON AttributeValue_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct AttributeValue_key where
+  buildStruct _proxy (AttributeValue_key_str __str)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "str" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __str)]
+  buildStruct _proxy (AttributeValue_key_sequence __sequence)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sequence" (Thrift.getListType _proxy) 2 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __sequence)]
+  buildStruct _proxy (AttributeValue_key_mapping __mapping)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "mapping" (Thrift.getListType _proxy) 3 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __mapping)]
+  buildStruct _proxy AttributeValue_key_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (AttributeValue_key_str _val)
+                                                     2 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (AttributeValue_key_sequence _val)
+                                                     3 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (AttributeValue_key_mapping _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return AttributeValue_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return AttributeValue_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("str", 1), ("sequence", 2), ("mapping", 3)]
+
+instance DeepSeq.NFData AttributeValue_key where
+  rnf (AttributeValue_key_str __str) = DeepSeq.rnf __str
+  rnf (AttributeValue_key_sequence __sequence)
+    = DeepSeq.rnf __sequence
+  rnf (AttributeValue_key_mapping __mapping) = DeepSeq.rnf __mapping
+  rnf AttributeValue_key_EMPTY = ()
+
+instance Default.Default AttributeValue_key where
+  def = AttributeValue_key_EMPTY
+
+instance Hashable.Hashable AttributeValue_key where
+  hashWithSalt __salt (AttributeValue_key_str _str)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _str)
+  hashWithSalt __salt (AttributeValue_key_sequence _sequence)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _sequence)
+  hashWithSalt __salt (AttributeValue_key_mapping _mapping)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _mapping)
+  hashWithSalt __salt AttributeValue_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ArgumentMapping = ArgumentMapping{argumentMapping_key ::
+                                       Text.Text,
+                                       argumentMapping_value :: ArgumentValue}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArgumentMapping where
+  toJSON (ArgumentMapping __field__key __field__value)
+    = Aeson.object
+        ("key" .= __field__key :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct ArgumentMapping where
+  buildStruct _proxy (ArgumentMapping __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__key)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key <- ST.newSTRef ""
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (ArgumentMapping __val__key __val__value)
+              _idMap = HashMap.fromList [("key", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArgumentMapping where
+  rnf (ArgumentMapping __field__key __field__value)
+    = DeepSeq.rnf __field__key `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default ArgumentMapping where
+  def = ArgumentMapping "" Default.def
+
+instance Hashable.Hashable ArgumentMapping where
+  hashWithSalt __salt (ArgumentMapping _key _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key) _value
+
+data ArgumentValue_key = ArgumentValue_key_lit Text.Text
+                       | ArgumentValue_key_sequence [ArgumentValue]
+                       | ArgumentValue_key_mapping [ArgumentMapping]
+                       | ArgumentValue_key_EMPTY
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArgumentValue_key where
+  toJSON (ArgumentValue_key_lit __lit)
+    = Aeson.object ["lit" .= __lit]
+  toJSON (ArgumentValue_key_sequence __sequence)
+    = Aeson.object ["sequence" .= __sequence]
+  toJSON (ArgumentValue_key_mapping __mapping)
+    = Aeson.object ["mapping" .= __mapping]
+  toJSON ArgumentValue_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ArgumentValue_key where
+  buildStruct _proxy (ArgumentValue_key_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __lit)]
+  buildStruct _proxy (ArgumentValue_key_sequence __sequence)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sequence" (Thrift.getListType _proxy) 2 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __sequence)]
+  buildStruct _proxy (ArgumentValue_key_mapping __mapping)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "mapping" (Thrift.getListType _proxy) 3 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __mapping)]
+  buildStruct _proxy ArgumentValue_key_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ArgumentValue_key_lit _val)
+                                                     2 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ArgumentValue_key_sequence _val)
+                                                     3 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ArgumentValue_key_mapping _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ArgumentValue_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return ArgumentValue_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("lit", 1), ("sequence", 2), ("mapping", 3)]
+
+instance DeepSeq.NFData ArgumentValue_key where
+  rnf (ArgumentValue_key_lit __lit) = DeepSeq.rnf __lit
+  rnf (ArgumentValue_key_sequence __sequence)
+    = DeepSeq.rnf __sequence
+  rnf (ArgumentValue_key_mapping __mapping) = DeepSeq.rnf __mapping
+  rnf ArgumentValue_key_EMPTY = ()
+
+instance Default.Default ArgumentValue_key where
+  def = ArgumentValue_key_EMPTY
+
+instance Hashable.Hashable ArgumentValue_key where
+  hashWithSalt __salt (ArgumentValue_key_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _lit)
+  hashWithSalt __salt (ArgumentValue_key_sequence _sequence)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _sequence)
+  hashWithSalt __salt (ArgumentValue_key_mapping _mapping)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _mapping)
+  hashWithSalt __salt ArgumentValue_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallArgument_key where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.CallArgument_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.CallArgument_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.CallArgument_key" (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.CallArgument_key =
+     'Angle.TField "label" (Prelude.Maybe Data.Text.Text)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Buck.Types.ArgumentValue)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 33 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.CallArgument where
+  type KeyType Glean.Schema.Buck.Types.CallArgument =
+       Glean.Schema.Buck.Types.CallArgument_key
+  getName _proxy = Glean.PredicateRef "buck.CallArgument" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.callArgument_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.CallArgument x k
+  getFactKey = Glean.Schema.Buck.Types.callArgument_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 42 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallArgument where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 48 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.RuleKey_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.RuleKey_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.RuleKey_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.RuleKey_key" (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.RuleKey_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "ruleKey" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 59 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.RuleKey where
+  type KeyType Glean.Schema.Buck.Types.RuleKey =
+       Glean.Schema.Buck.Types.RuleKey_key
+  getName _proxy = Glean.PredicateRef "buck.RuleKey" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.ruleKey_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.RuleKey x k
+  getFactKey = Glean.Schema.Buck.Types.ruleKey_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.RuleKey where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 74 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Label where
+  type KeyType Glean.Schema.Buck.Types.Label = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.Label" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.label_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Label x k
+  getFactKey = Glean.Schema.Buck.Types.label_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 82 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Label where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 88 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.SearchByLocalName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.SearchByLocalName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.SearchByLocalName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.SearchByLocalName_key" (Prelude.Just 0))
+{-# LINE 97 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.SearchByLocalName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Buck.Types.LocalName)
+       ('Angle.TField "decl" (Glean.Schema.Buck.Types.XRefDestination)
+          ('Angle.TNoFields))
+{-# LINE 99 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.SearchByLocalName
+         where
+  type KeyType Glean.Schema.Buck.Types.SearchByLocalName =
+       Glean.Schema.Buck.Types.SearchByLocalName_key
+  getName _proxy = Glean.PredicateRef "buck.SearchByLocalName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.searchByLocalName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.SearchByLocalName x k
+  getFactKey = Glean.Schema.Buck.Types.searchByLocalName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 108 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.SearchByLocalName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 114 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetIndexerName
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetIndexerName =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.TargetIndexerName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetIndexerName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetIndexerName x k
+  getFactKey = Glean.Schema.Buck.Types.targetIndexerName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 122 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetIndexerName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 128 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Buck.Types.TargetCallByCallExpr_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetCallByCallExpr_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetCallByCallExpr_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetCallByCallExpr_key" (Prelude.Just 0))
+{-# LINE 137 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetCallByCallExpr_key
+     =
+     'Angle.TField "callExpr"
+       (Glean.KeyType Glean.Schema.Buck.Types.CallExpr)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.TargetCall)
+          ('Angle.TNoFields))
+{-# LINE 139 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Buck.Types.TargetCallByCallExpr
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetCallByCallExpr =
+       Glean.Schema.Buck.Types.TargetCallByCallExpr_key
+  getName _proxy = Glean.PredicateRef "buck.TargetCallByCallExpr" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetCallByCallExpr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetCallByCallExpr x k
+  getFactKey = Glean.Schema.Buck.Types.targetCallByCallExpr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 148 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetCallByCallExpr
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 154 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.OutsTarget_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.OutsTarget_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.OutsTarget_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.OutsTarget_key" (Prelude.Just 0))
+{-# LINE 165 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.OutsTarget_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.Target)
+          ('Angle.TField "outputLabel"
+             (Prelude.Maybe Glean.Schema.Buck.Types.OutputLabel)
+             ('Angle.TNoFields)))
+{-# LINE 167 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.OutsTarget where
+  type KeyType Glean.Schema.Buck.Types.OutsTarget =
+       Glean.Schema.Buck.Types.OutsTarget_key
+  getName _proxy = Glean.PredicateRef "buck.OutsTarget" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.outsTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.OutsTarget x k
+  getFactKey = Glean.Schema.Buck.Types.outsTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 176 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.OutsTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 182 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocalNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.LocalNameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.LocalNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.LocalNameLowerCase_key" (Prelude.Just 0))
+{-# LINE 191 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.LocalNameLowerCase_key =
+     'Angle.TField "lowercase" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Buck.Types.LocalName)
+          ('Angle.TNoFields))
+{-# LINE 193 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.LocalNameLowerCase
+         where
+  type KeyType Glean.Schema.Buck.Types.LocalNameLowerCase =
+       Glean.Schema.Buck.Types.LocalNameLowerCase_key
+  getName _proxy = Glean.PredicateRef "buck.LocalNameLowerCase" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.localNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.LocalNameLowerCase x k
+  getFactKey = Glean.Schema.Buck.Types.localNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 202 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocalNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 208 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.LocalName where
+  type KeyType Glean.Schema.Buck.Types.LocalName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.LocalName" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.localName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.LocalName x k
+  getFactKey = Glean.Schema.Buck.Types.localName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 216 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocalName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 222 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileTarget_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileTarget_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileTarget_key" (Prelude.Just 0))
+{-# LINE 231 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileTarget_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "locator"
+          (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+          ('Angle.TNoFields))
+{-# LINE 233 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileTarget where
+  type KeyType Glean.Schema.Buck.Types.FileTarget =
+       Glean.Schema.Buck.Types.FileTarget_key
+  getName _proxy = Glean.PredicateRef "buck.FileTarget" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.fileTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileTarget x k
+  getFactKey = Glean.Schema.Buck.Types.fileTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 242 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 248 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Labels where
+  type KeyType Glean.Schema.Buck.Types.Labels =
+       [Glean.Schema.Buck.Types.Label]
+  getName _proxy = Glean.PredicateRef "buck.Labels" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.labels_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Labels x k
+  getFactKey = Glean.Schema.Buck.Types.labels_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 257 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Labels where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 263 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetLocation_key" (Prelude.Just 0))
+{-# LINE 274 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetLocation_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 276 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetLocation
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetLocation =
+       Glean.Schema.Buck.Types.TargetLocation_key
+  getName _proxy = Glean.PredicateRef "buck.TargetLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetLocation x k
+  getFactKey = Glean.Schema.Buck.Types.targetLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 285 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 291 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileDefinition_key
+         where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileDefinition_key" (Prelude.Just 0))
+{-# LINE 300 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileDefinition_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "definition"
+          (Glean.KeyType Glean.Schema.Buck.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 302 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileDefinition
+         where
+  type KeyType Glean.Schema.Buck.Types.FileDefinition =
+       Glean.Schema.Buck.Types.FileDefinition_key
+  getName _proxy = Glean.PredicateRef "buck.FileDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.fileDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileDefinition x k
+  getFactKey = Glean.Schema.Buck.Types.fileDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 311 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 317 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorReverseDep_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.LocatorReverseDep_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.LocatorReverseDep_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.LocatorReverseDep_key" (Prelude.Just 0))
+{-# LINE 326 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.LocatorReverseDep_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "rdep"
+          (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+          ('Angle.TNoFields))
+{-# LINE 328 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.LocatorReverseDep
+         where
+  type KeyType Glean.Schema.Buck.Types.LocatorReverseDep =
+       Glean.Schema.Buck.Types.LocatorReverseDep_key
+  getName _proxy = Glean.PredicateRef "buck.LocatorReverseDep" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.locatorReverseDep_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.LocatorReverseDep x k
+  getFactKey = Glean.Schema.Buck.Types.locatorReverseDep_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 337 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorReverseDep where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 343 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileEntity_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileEntity_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileEntity_key" (Prelude.Just 0))
+{-# LINE 352 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileEntity_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Buck.Types.XRefDestination)
+          ('Angle.TNoFields))
+{-# LINE 354 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileEntity where
+  type KeyType Glean.Schema.Buck.Types.FileEntity =
+       Glean.Schema.Buck.Types.FileEntity_key
+  getName _proxy = Glean.PredicateRef "buck.FileEntity" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.fileEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileEntity x k
+  getFactKey = Glean.Schema.Buck.Types.fileEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 363 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileEntity where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 369 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Locator_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.Locator_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Locator_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Locator_key" (Prelude.Just 0))
+{-# LINE 380 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.Locator_key =
+     'Angle.TField "subdir" (Prelude.Maybe Data.Text.Text)
+       ('Angle.TField "path" (Data.Text.Text)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 382 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Locator where
+  type KeyType Glean.Schema.Buck.Types.Locator =
+       Glean.Schema.Buck.Types.Locator_key
+  getName _proxy = Glean.PredicateRef "buck.Locator" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.locator_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Locator x k
+  getFactKey = Glean.Schema.Buck.Types.locator_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 391 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Locator where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 397 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.DefinitionLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.DefinitionLocation_key" (Prelude.Just 0))
+{-# LINE 408 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.DefinitionLocation_key =
+     'Angle.TField "definition"
+       (Glean.KeyType Glean.Schema.Buck.Types.Definition)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 410 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.Buck.Types.DefinitionLocation =
+       Glean.Schema.Buck.Types.DefinitionLocation_key
+  getName _proxy = Glean.PredicateRef "buck.DefinitionLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.Buck.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 419 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 425 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallExpr_key where
+  buildRtsValue b Glean.Schema.Buck.Types.CallExpr_key_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Buck.Types.CallExpr_key_name x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Buck.Types.CallExpr_key_accessor x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Buck.Types.CallExpr_key_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.CallExpr_key_name,
+         Glean.mapD Glean.Schema.Buck.Types.CallExpr_key_accessor]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.CallExpr_key" (Prelude.Just 0))
+{-# LINE 441 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Buck.Types.CallExpr_key
+     =
+     'Angle.TField "name" (Glean.Schema.Buck.Types.CallName)
+       ('Angle.TField "accessor"
+          (Glean.Schema.Buck.Types.CallExpr_accessor_)
+          ('Angle.TNoFields))
+{-# LINE 443 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.CallExpr where
+  type KeyType Glean.Schema.Buck.Types.CallExpr =
+       Glean.Schema.Buck.Types.CallExpr_key
+  getName _proxy = Glean.PredicateRef "buck.CallExpr" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.callExpr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.CallExpr x k
+  getFactKey = Glean.Schema.Buck.Types.callExpr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 452 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallExpr where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 458 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetIndexer_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetIndexer_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetIndexer_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetIndexer_key" (Prelude.Just 0))
+{-# LINE 467 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetIndexer_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Buck.Types.TargetIndexerName)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.Target)
+          ('Angle.TNoFields))
+{-# LINE 469 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetIndexer
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetIndexer =
+       Glean.Schema.Buck.Types.TargetIndexer_key
+  getName _proxy = Glean.PredicateRef "buck.TargetIndexer" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetIndexer_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetIndexer x k
+  getFactKey = Glean.Schema.Buck.Types.targetIndexer_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 478 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetIndexer where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 484 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetUses_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetUses_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetUses_key" (Prelude.Just 0))
+{-# LINE 495 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetUses_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "spans" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 497 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetUses where
+  type KeyType Glean.Schema.Buck.Types.TargetUses =
+       Glean.Schema.Buck.Types.TargetUses_key
+  getName _proxy = Glean.PredicateRef "buck.TargetUses" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetUses x k
+  getFactKey = Glean.Schema.Buck.Types.targetUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 506 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 512 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Platform where
+  type KeyType Glean.Schema.Buck.Types.Platform = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.Platform" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.platform_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Platform x k
+  getFactKey = Glean.Schema.Buck.Types.platform_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 520 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Platform where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 526 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Consumer_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.Consumer_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Consumer_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Consumer_key" (Prelude.Just 0))
+{-# LINE 535 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.Consumer_key =
+     'Angle.TField "source" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "consumer"
+          (Glean.KeyType Glean.Schema.Buck.Types.TargetSources)
+          ('Angle.TNoFields))
+{-# LINE 537 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Consumer where
+  type KeyType Glean.Schema.Buck.Types.Consumer =
+       Glean.Schema.Buck.Types.Consumer_key
+  getName _proxy = Glean.PredicateRef "buck.Consumer" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.consumer_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Consumer x k
+  getFactKey = Glean.Schema.Buck.Types.consumer_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 546 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Consumer where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 552 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetLinkWhole
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetLinkWhole =
+       Glean.Schema.Buck.Types.Target
+  getName _proxy = Glean.PredicateRef "buck.TargetLinkWhole" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetLinkWhole_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetLinkWhole x k
+  getFactKey = Glean.Schema.Buck.Types.targetLinkWhole_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 561 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetLinkWhole where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 567 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.DestinationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.DestinationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.DestinationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.DestinationUses_key" (Prelude.Just 0))
+{-# LINE 578 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.DestinationUses_key =
+     'Angle.TField "destination"
+       (Glean.Schema.Buck.Types.XRefDestination)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "spans" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 580 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.DestinationUses
+         where
+  type KeyType Glean.Schema.Buck.Types.DestinationUses =
+       Glean.Schema.Buck.Types.DestinationUses_key
+  getName _proxy = Glean.PredicateRef "buck.DestinationUses" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.destinationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.DestinationUses x k
+  getFactKey = Glean.Schema.Buck.Types.destinationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 589 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.DestinationUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 595 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.SourceFileLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.SourceFileLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.SourceFileLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.SourceFileLocation_key" (Prelude.Just 0))
+{-# LINE 604 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.SourceFileLocation_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 606 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.SourceFileLocation
+         where
+  type KeyType Glean.Schema.Buck.Types.SourceFileLocation =
+       Glean.Schema.Buck.Types.SourceFileLocation_key
+  getName _proxy = Glean.PredicateRef "buck.SourceFileLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.sourceFileLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.SourceFileLocation x k
+  getFactKey = Glean.Schema.Buck.Types.sourceFileLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 615 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.SourceFileLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 621 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Buck.Types.TargetSourcesBaseModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetSourcesBaseModule_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetSourcesBaseModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetSourcesBaseModule_key"
+           (Prelude.Just 0))
+{-# LINE 632 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Buck.Types.TargetSourcesBaseModule_key
+     =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "srcs" ([Glean.Schema.Buck.Types.File])
+          ('Angle.TField "baseModule"
+             (Prelude.Maybe Glean.Schema.Buck.Types.AttributeValue)
+             ('Angle.TNoFields)))
+{-# LINE 634 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Buck.Types.TargetSourcesBaseModule
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetSourcesBaseModule =
+       Glean.Schema.Buck.Types.TargetSourcesBaseModule_key
+  getName _proxy
+    = Glean.PredicateRef "buck.TargetSourcesBaseModule" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetSourcesBaseModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetSourcesBaseModule x k
+  getFactKey = Glean.Schema.Buck.Types.targetSourcesBaseModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 643 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetSourcesBaseModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 649 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.ArgumentValue_key where
+  buildRtsValue b Glean.Schema.Buck.Types.ArgumentValue_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Buck.Types.ArgumentValue_key_lit x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.ArgumentValue_key_sequence x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.ArgumentValue_key_mapping x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Buck.Types.ArgumentValue_key_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.ArgumentValue_key_lit,
+         Glean.mapD Glean.Schema.Buck.Types.ArgumentValue_key_sequence,
+         Glean.mapD Glean.Schema.Buck.Types.ArgumentValue_key_mapping]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.ArgumentValue_key" (Prelude.Just 0))
+{-# LINE 669 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Buck.Types.ArgumentValue_key =
+     'Angle.TField "lit" (Data.Text.Text)
+       ('Angle.TField "sequence" ([Glean.Schema.Buck.Types.ArgumentValue])
+          ('Angle.TField "mapping"
+             ([Glean.Schema.Buck.Types.ArgumentMapping])
+             ('Angle.TNoFields)))
+{-# LINE 671 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.ArgumentValue
+         where
+  type KeyType Glean.Schema.Buck.Types.ArgumentValue =
+       Glean.Schema.Buck.Types.ArgumentValue_key
+  getName _proxy = Glean.PredicateRef "buck.ArgumentValue" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.argumentValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.ArgumentValue x k
+  getFactKey = Glean.Schema.Buck.Types.argumentValue_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 680 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.ArgumentValue where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 686 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.IndexFailureX_key where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.IndexFailureX_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.IndexFailureX_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.IndexFailureX_key" (Prelude.Just 0))
+{-# LINE 701 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.IndexFailureX_key =
+     'Angle.TField "source"
+       (Glean.Schema.Buck.Types.IndexFailureX_source)
+       ('Angle.TField "indexer"
+          (Glean.KeyType Glean.Schema.Buck.Types.IndexerName)
+          ('Angle.TField "reason" (Glean.Schema.Buck.Types.FailureReason)
+             ('Angle.TField "details" (Data.Text.Text)
+                ('Angle.TField "repro" (Prelude.Maybe Data.Text.Text)
+                   ('Angle.TNoFields)))))
+{-# LINE 703 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.IndexFailureX
+         where
+  type KeyType Glean.Schema.Buck.Types.IndexFailureX =
+       Glean.Schema.Buck.Types.IndexFailureX_key
+  getName _proxy = Glean.PredicateRef "buck.IndexFailureX" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.indexFailureX_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.IndexFailureX x k
+  getFactKey = Glean.Schema.Buck.Types.indexFailureX_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 712 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.IndexFailureX where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 718 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetOut_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetOut_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetOut_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetOut_key" (Prelude.Just 0))
+{-# LINE 727 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetOut_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 729 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetOut where
+  type KeyType Glean.Schema.Buck.Types.TargetOut =
+       Glean.Schema.Buck.Types.TargetOut_key
+  getName _proxy = Glean.PredicateRef "buck.TargetOut" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetOut_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetOut x k
+  getFactKey = Glean.Schema.Buck.Types.targetOut_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 738 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetOut where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 744 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileToTarget_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileToTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileToTarget_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileToTarget_key" (Prelude.Just 0))
+{-# LINE 753 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileToTarget_key =
+     'Angle.TField "source" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "locator"
+          (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+          ('Angle.TNoFields))
+{-# LINE 755 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileToTarget where
+  type KeyType Glean.Schema.Buck.Types.FileToTarget =
+       Glean.Schema.Buck.Types.FileToTarget_key
+  getName _proxy = Glean.PredicateRef "buck.FileToTarget" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.fileToTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileToTarget x k
+  getFactKey = Glean.Schema.Buck.Types.fileToTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 764 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileToTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 770 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileXRefs_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 779 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Buck.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 781 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileXRefs where
+  type KeyType Glean.Schema.Buck.Types.FileXRefs =
+       Glean.Schema.Buck.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "buck.FileXRefs" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Buck.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 790 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 796 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.File_key where
+  buildRtsValue b Glean.Schema.Buck.Types.File_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Buck.Types.File_key_source x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Buck.Types.File_key_generated x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Buck.Types.File_key_generatedLabel x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Buck.Types.File_key_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.File_key_source,
+         Glean.mapD Glean.Schema.Buck.Types.File_key_generated,
+         Glean.mapD Glean.Schema.Buck.Types.File_key_generatedLabel]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.File_key" (Prelude.Just 0))
+{-# LINE 816 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Buck.Types.File_key =
+     'Angle.TField "source" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "generated"
+          (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+          ('Angle.TField "generatedLabel"
+             (Glean.KeyType Glean.Schema.Buck.Types.LocatorWithLabel)
+             ('Angle.TNoFields)))
+{-# LINE 818 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.File where
+  type KeyType Glean.Schema.Buck.Types.File =
+       Glean.Schema.Buck.Types.File_key
+  getName _proxy = Glean.PredicateRef "buck.File" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.file_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.File x k
+  getFactKey = Glean.Schema.Buck.Types.file_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 826 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.File where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 832 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileResolved_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.FileResolved_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.FileResolved_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FileResolved_key" (Prelude.Just 0))
+{-# LINE 841 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.FileResolved_key =
+     'Angle.TField "buckFile"
+       (Glean.KeyType Glean.Schema.Buck.Types.File)
+       ('Angle.TField "srcFile"
+          (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 843 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.FileResolved where
+  type KeyType Glean.Schema.Buck.Types.FileResolved =
+       Glean.Schema.Buck.Types.FileResolved_key
+  getName _proxy = Glean.PredicateRef "buck.FileResolved" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.fileResolved_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.FileResolved x k
+  getFactKey = Glean.Schema.Buck.Types.fileResolved_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 852 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FileResolved where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 858 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Type where
+  type KeyType Glean.Schema.Buck.Types.Type = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.Type" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Type x k
+  getFactKey = Glean.Schema.Buck.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 866 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 872 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.OutputLabel where
+  type KeyType Glean.Schema.Buck.Types.OutputLabel = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.OutputLabel" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.outputLabel_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.OutputLabel x k
+  getFactKey = Glean.Schema.Buck.Types.outputLabel_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 880 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.OutputLabel where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 886 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Definition_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.Definition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Definition_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Definition_key" (Prelude.Just 0))
+{-# LINE 895 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.Definition_key =
+     'Angle.TField "module" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 897 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Definition where
+  type KeyType Glean.Schema.Buck.Types.Definition =
+       Glean.Schema.Buck.Types.Definition_key
+  getName _proxy = Glean.PredicateRef "buck.Definition" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.definition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Definition x k
+  getFactKey = Glean.Schema.Buck.Types.definition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 906 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Definition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 912 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetByType_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetByType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetByType_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetByType_key" (Prelude.Just 0))
+{-# LINE 921 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetByType_key =
+     'Angle.TField "type_" (Glean.KeyType Glean.Schema.Buck.Types.Type)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.Target)
+          ('Angle.TNoFields))
+{-# LINE 923 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetByType where
+  type KeyType Glean.Schema.Buck.Types.TargetByType =
+       Glean.Schema.Buck.Types.TargetByType_key
+  getName _proxy = Glean.PredicateRef "buck.TargetByType" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetByType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetByType x k
+  getFactKey = Glean.Schema.Buck.Types.targetByType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 932 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetByType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 938 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.AttributeName
+         where
+  type KeyType Glean.Schema.Buck.Types.AttributeName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.AttributeName" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.attributeName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.AttributeName x k
+  getFactKey = Glean.Schema.Buck.Types.attributeName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 946 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.AttributeName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 952 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.OutTarget_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.OutTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.OutTarget_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.OutTarget_key" (Prelude.Just 0))
+{-# LINE 961 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.OutTarget_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.Target)
+          ('Angle.TNoFields))
+{-# LINE 963 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.OutTarget where
+  type KeyType Glean.Schema.Buck.Types.OutTarget =
+       Glean.Schema.Buck.Types.OutTarget_key
+  getName _proxy = Glean.PredicateRef "buck.OutTarget" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.outTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.OutTarget x k
+  getFactKey = Glean.Schema.Buck.Types.outTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 972 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.OutTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 978 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.AttributeValue_key
+         where
+  buildRtsValue b Glean.Schema.Buck.Types.AttributeValue_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Buck.Types.AttributeValue_key_str x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.AttributeValue_key_sequence x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.AttributeValue_key_mapping x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Buck.Types.AttributeValue_key_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.AttributeValue_key_str,
+         Glean.mapD Glean.Schema.Buck.Types.AttributeValue_key_sequence,
+         Glean.mapD Glean.Schema.Buck.Types.AttributeValue_key_mapping]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.AttributeValue_key" (Prelude.Just 0))
+{-# LINE 998 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Buck.Types.AttributeValue_key =
+     'Angle.TField "str" (Data.Text.Text)
+       ('Angle.TField "sequence"
+          ([Glean.Schema.Buck.Types.AttributeValue])
+          ('Angle.TField "mapping"
+             ([Glean.Schema.Buck.Types.AttributeMapping])
+             ('Angle.TNoFields)))
+{-# LINE 1000 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.AttributeValue
+         where
+  type KeyType Glean.Schema.Buck.Types.AttributeValue =
+       Glean.Schema.Buck.Types.AttributeValue_key
+  getName _proxy = Glean.PredicateRef "buck.AttributeValue" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.attributeValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.AttributeValue x k
+  getFactKey = Glean.Schema.Buck.Types.attributeValue_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1009 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.AttributeValue where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1015 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetAttribute_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetAttribute_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetAttribute_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetAttribute_key" (Prelude.Just 0))
+{-# LINE 1026 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetAttribute_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "attribute"
+          (Glean.KeyType Glean.Schema.Buck.Types.AttributeName)
+          ('Angle.TField "value"
+             (Glean.KeyType Glean.Schema.Buck.Types.AttributeValue)
+             ('Angle.TNoFields)))
+{-# LINE 1028 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetAttribute
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetAttribute =
+       Glean.Schema.Buck.Types.TargetAttribute_key
+  getName _proxy = Glean.PredicateRef "buck.TargetAttribute" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetAttribute_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetAttribute x k
+  getFactKey = Glean.Schema.Buck.Types.targetAttribute_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1037 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetAttribute where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1043 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetCall_key where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetCall_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetCall_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetCall_key" (Prelude.Just 0))
+{-# LINE 1058 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetCall_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "arguments" ([Glean.Schema.Buck.Types.CallArgument])
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TField "callExpr"
+                   (Prelude.Maybe Glean.Schema.Buck.Types.CallExpr)
+                   ('Angle.TNoFields)))))
+{-# LINE 1060 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetCall where
+  type KeyType Glean.Schema.Buck.Types.TargetCall =
+       Glean.Schema.Buck.Types.TargetCall_key
+  getName _proxy = Glean.PredicateRef "buck.TargetCall" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetCall x k
+  getFactKey = Glean.Schema.Buck.Types.targetCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1069 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetCall where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1075 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Target_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.Target_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Target_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Target_key" (Prelude.Just 0))
+{-# LINE 1088 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Buck.Types.Target_key
+     =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "type_" (Glean.KeyType Glean.Schema.Buck.Types.Type)
+          ('Angle.TField "defaultPlatform"
+             (Prelude.Maybe Glean.Schema.Buck.Types.Platform)
+             ('Angle.TField "labels"
+                (Glean.KeyType Glean.Schema.Buck.Types.Labels)
+                ('Angle.TNoFields))))
+{-# LINE 1090 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Target where
+  type KeyType Glean.Schema.Buck.Types.Target =
+       Glean.Schema.Buck.Types.Target_key
+  getName _proxy = Glean.PredicateRef "buck.Target" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.target_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Target x k
+  getFactKey = Glean.Schema.Buck.Types.target_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1099 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Target where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1105 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetMode_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetMode_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetMode_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetMode_key" (Prelude.Just 0))
+{-# LINE 1114 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetMode_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "mode" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1116 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetMode where
+  type KeyType Glean.Schema.Buck.Types.TargetMode =
+       Glean.Schema.Buck.Types.TargetMode_key
+  getName _proxy = Glean.PredicateRef "buck.TargetMode" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetMode_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetMode x k
+  getFactKey = Glean.Schema.Buck.Types.targetMode_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1125 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetMode where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1131 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetHash_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetHash_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetHash_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetHash_key" (Prelude.Just 0))
+{-# LINE 1140 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetHash_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "targetHash" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1142 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetHash where
+  type KeyType Glean.Schema.Buck.Types.TargetHash =
+       Glean.Schema.Buck.Types.TargetHash_key
+  getName _proxy = Glean.PredicateRef "buck.TargetHash" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetHash_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetHash x k
+  getFactKey = Glean.Schema.Buck.Types.targetHash_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1151 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetHash where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1157 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Owner_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.Owner_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Owner_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Owner_key" (Prelude.Just 0))
+{-# LINE 1166 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Buck.Types.Owner_key
+     =
+     'Angle.TField "source" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "owner"
+          (Glean.KeyType Glean.Schema.Buck.Types.TargetSources)
+          ('Angle.TNoFields))
+{-# LINE 1168 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.Owner where
+  type KeyType Glean.Schema.Buck.Types.Owner =
+       Glean.Schema.Buck.Types.Owner_key
+  getName _proxy = Glean.PredicateRef "buck.Owner" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.owner_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.Owner x k
+  getFactKey = Glean.Schema.Buck.Types.owner_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1177 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Owner where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1183 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetDependencies_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetDependencies_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetDependencies_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetDependencies_key" (Prelude.Just 0))
+{-# LINE 1192 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetDependencies_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "dependencies"
+          ([Glean.Schema.Buck.Types.Dependency])
+          ('Angle.TNoFields))
+{-# LINE 1194 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetDependencies
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetDependencies =
+       Glean.Schema.Buck.Types.TargetDependencies_key
+  getName _proxy = Glean.PredicateRef "buck.TargetDependencies" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.targetDependencies_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetDependencies x k
+  getFactKey = Glean.Schema.Buck.Types.targetDependencies_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1203 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetDependencies
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1209 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetOuts_key where
+  buildRtsValue b (Glean.Schema.Buck.Types.TargetOuts_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetOuts_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetOuts_key" (Prelude.Just 0))
+{-# LINE 1220 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetOuts_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "outputLabel"
+          (Prelude.Maybe Glean.Schema.Buck.Types.OutputLabel)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
+{-# LINE 1222 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetOuts where
+  type KeyType Glean.Schema.Buck.Types.TargetOuts =
+       Glean.Schema.Buck.Types.TargetOuts_key
+  getName _proxy = Glean.PredicateRef "buck.TargetOuts" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetOuts_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetOuts x k
+  getFactKey = Glean.Schema.Buck.Types.targetOuts_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1231 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetOuts where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1237 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorReverseDeps_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.LocatorReverseDeps_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.LocatorReverseDeps_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.LocatorReverseDeps_key" (Prelude.Just 0))
+{-# LINE 1246 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.LocatorReverseDeps_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "rdeps" ([Glean.Schema.Buck.Types.Locator])
+          ('Angle.TNoFields))
+{-# LINE 1248 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.LocatorReverseDeps
+         where
+  type KeyType Glean.Schema.Buck.Types.LocatorReverseDeps =
+       Glean.Schema.Buck.Types.LocatorReverseDeps_key
+  getName _proxy = Glean.PredicateRef "buck.LocatorReverseDeps" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.locatorReverseDeps_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.LocatorReverseDeps x k
+  getFactKey = Glean.Schema.Buck.Types.locatorReverseDeps_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1257 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorReverseDeps
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1263 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetSources_key where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TargetSources_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TargetSources_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TargetSources_key" (Prelude.Just 0))
+{-# LINE 1276 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TargetSources_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Target)
+       ('Angle.TField "headers" ([Glean.Schema.Buck.Types.File])
+          ('Angle.TField "exportedHeaders" ([Glean.Schema.Buck.Types.File])
+             ('Angle.TField "srcs" ([Glean.Schema.Buck.Types.File])
+                ('Angle.TNoFields))))
+{-# LINE 1278 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TargetSources
+         where
+  type KeyType Glean.Schema.Buck.Types.TargetSources =
+       Glean.Schema.Buck.Types.TargetSources_key
+  getName _proxy = Glean.PredicateRef "buck.TargetSources" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.targetSources_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TargetSources x k
+  getFactKey = Glean.Schema.Buck.Types.targetSources_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1287 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TargetSources where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1293 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorWithLabel_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.LocatorWithLabel_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.LocatorWithLabel_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.LocatorWithLabel_key" (Prelude.Just 0))
+{-# LINE 1302 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.LocatorWithLabel_key =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "label"
+          (Glean.KeyType Glean.Schema.Buck.Types.OutputLabel)
+          ('Angle.TNoFields))
+{-# LINE 1304 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.LocatorWithLabel
+         where
+  type KeyType Glean.Schema.Buck.Types.LocatorWithLabel =
+       Glean.Schema.Buck.Types.LocatorWithLabel_key
+  getName _proxy = Glean.PredicateRef "buck.LocatorWithLabel" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.locatorWithLabel_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.LocatorWithLabel x k
+  getFactKey = Glean.Schema.Buck.Types.locatorWithLabel_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1313 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.LocatorWithLabel where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1319 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.IndexerName where
+  type KeyType Glean.Schema.Buck.Types.IndexerName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "buck.IndexerName" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Buck.Types.indexerName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.IndexerName x k
+  getFactKey = Glean.Schema.Buck.Types.indexerName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1327 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.IndexerName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1333 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TranslationUnit_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.TranslationUnit_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.TranslationUnit_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.TranslationUnit_key" (Prelude.Just 0))
+{-# LINE 1344 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.TranslationUnit_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+          ('Angle.TField "platform"
+             (Prelude.Maybe Glean.Schema.Buck.Types.Platform)
+             ('Angle.TNoFields)))
+{-# LINE 1346 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Buck.Types.TranslationUnit
+         where
+  type KeyType Glean.Schema.Buck.Types.TranslationUnit =
+       Glean.Schema.Buck.Types.TranslationUnit_key
+  getName _proxy = Glean.PredicateRef "buck.TranslationUnit" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Buck.Types.translationUnit_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Buck.Types.TranslationUnit x k
+  getFactKey = Glean.Schema.Buck.Types.translationUnit_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1355 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.TranslationUnit where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1361 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.AttributeMapping where
+  buildRtsValue b (Glean.Schema.Buck.Types.AttributeMapping x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.AttributeMapping <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.AttributeMapping" (Prelude.Just 4))
+{-# LINE 1370 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.AttributeMapping =
+     'Angle.TField "key" (Data.Text.Text)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Buck.Types.AttributeValue)
+          ('Angle.TNoFields))
+{-# LINE 1372 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.ArgumentMapping where
+  buildRtsValue b (Glean.Schema.Buck.Types.ArgumentMapping x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.ArgumentMapping <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.ArgumentMapping" (Prelude.Just 4))
+{-# LINE 1381 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.ArgumentMapping =
+     'Angle.TField "key" (Data.Text.Text)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Buck.Types.ArgumentValue)
+          ('Angle.TNoFields))
+{-# LINE 1383 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.XRefDestination where
+  buildRtsValue b Glean.Schema.Buck.Types.XRefDestination_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Buck.Types.XRefDestination_locator x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Buck.Types.XRefDestination_file x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.XRefDestination_definition x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Buck.Types.XRefDestination_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.XRefDestination_locator,
+         Glean.mapD Glean.Schema.Buck.Types.XRefDestination_file,
+         Glean.mapD Glean.Schema.Buck.Types.XRefDestination_definition]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.XRefDestination" (Prelude.Just 4))
+{-# LINE 1403 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Buck.Types.XRefDestination =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "definition"
+             (Glean.KeyType Glean.Schema.Buck.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 1405 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallName where
+  buildRtsValue b Glean.Schema.Buck.Types.CallName_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Buck.Types.CallName_prim x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Buck.Types.CallName_definition x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Buck.Types.CallName_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.CallName_prim,
+         Glean.mapD Glean.Schema.Buck.Types.CallName_definition]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.CallName" (Prelude.Just 4))
+{-# LINE 1421 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Buck.Types.CallName =
+     'Angle.TField "prim" (Data.Text.Text)
+       ('Angle.TField "definition"
+          (Glean.KeyType Glean.Schema.Buck.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 1423 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.FailureReason where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.FailureReason" (Prelude.Just 4))
+{-# LINE 1428 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Buck.Types.FailureReason
+     =
+     'Angle.TField "Skipped" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Blocked" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "EmptyCdb" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "FailedCdb" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "QueryFailed" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Unclassified" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TNoFields))))))
+{-# LINE 1430 "glean/schema/thrift/buck_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Buck.Types.FailureReason
+         where
+  type AngleEnumTy Glean.Schema.Buck.Types.FailureReason =
+       Glean.Schema.Buck.Types.FailureReason
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 1434 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.XRef where
+  buildRtsValue b (Glean.Schema.Buck.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "buck.XRef" (Prelude.Just 4))
+{-# LINE 1443 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Buck.Types.XRef =
+     'Angle.TField "destination"
+       (Glean.Schema.Buck.Types.XRefDestination)
+       ('Angle.TField "ranges" ([Glean.Schema.Src.Types.ByteSpan])
+          ('Angle.TNoFields))
+{-# LINE 1445 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.Dependency where
+  buildRtsValue b (Glean.Schema.Buck.Types.Dependency x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.Dependency <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.Dependency" (Prelude.Just 4))
+{-# LINE 1456 "glean/schema/thrift/buck_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Buck.Types.Dependency
+     =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "explicit_" (Prelude.Bool)
+          ('Angle.TField "exported" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 1458 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.CallExpr_accessor_
+         where
+  buildRtsValue b (Glean.Schema.Buck.Types.CallExpr_accessor_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Buck.Types.CallExpr_accessor_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.CallExpr_accessor_" (Prelude.Just 0))
+{-# LINE 1467 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Buck.Types.CallExpr_accessor_ =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Buck.Types.CallExpr)
+       ('Angle.TField "field" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1469 "glean/schema/thrift/buck_include.hs" #-}
+instance Glean.Type Glean.Schema.Buck.Types.IndexFailureX_source
+         where
+  buildRtsValue b Glean.Schema.Buck.Types.IndexFailureX_source_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.IndexFailureX_source_locator x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Buck.Types.IndexFailureX_source_buildFile x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Buck.Types.IndexFailureX_source_EMPTY)
+        [Glean.mapD Glean.Schema.Buck.Types.IndexFailureX_source_locator,
+         Glean.mapD Glean.Schema.Buck.Types.IndexFailureX_source_buildFile]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "buck.IndexFailureX_source" (Prelude.Just 0))
+{-# LINE 1485 "glean/schema/thrift/buck_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Buck.Types.IndexFailureX_source =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "buildFile"
+          (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Builtin/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Builtin/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Builtin/Types.hs
@@ -0,0 +1,123 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/builtin_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/builtin_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/builtin_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Builtin/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Builtin.Types
+       (pREDICATE_VERSIONS, version, schema_id, Unit(Unit)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/builtin_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 65 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Builtin/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+version :: Int.Int64
+version = 1
+
+schema_id :: Glean.SchemaId
+schema_id = Glean.SchemaId "344b23f7820658f9b2eca6304246a029"
+
+data Unit = Unit{}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Unit where
+  toJSON Unit = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Unit where
+  buildStruct _proxy Unit = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Unit)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Unit where
+  rnf Unit = ()
+
+instance Default.Default Unit where
+  def = Unit
+
+instance Hashable.Hashable Unit where
+  hashWithSalt __salt Unit = __salt
+{-# LINE 15 "glean/schema/thrift/builtin_include.hs" #-}
+type instance Angle.SumFields (Prelude.Maybe t) =
+     'Angle.TField "nothing" Unit
+       ('Angle.TField "just" t 'Angle.TNoFields)
+{-# LINE 21 "glean/schema/thrift/builtin_include.hs" #-}
+instance Glean.Type Glean.Schema.Builtin.Types.Unit where
+  buildRtsValue _b Glean.Schema.Builtin.Types.Unit
+    = Prelude.return ()
+  decodeRtsValue = Prelude.pure Glean.Schema.Builtin.Types.Unit
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "builtin.Unit" (Prelude.Just 1))
+{-# LINE 26 "glean/schema/thrift/builtin_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Builtin.Types.Unit =
+     'Angle.TNoFields
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Code/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Code/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Code/Types.hs
@@ -0,0 +1,1903 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Code/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Code.Types
+       (pREDICATE_VERSIONS, EntityLanguageSCIP_id,
+        EntityLanguageSCIP(EntityLanguageSCIP, entityLanguageSCIP_id,
+                           entityLanguageSCIP_key),
+        EntityLanguageLSIF_id,
+        EntityLanguageLSIF(EntityLanguageLSIF, entityLanguageLSIF_id,
+                           entityLanguageLSIF_key),
+        EntityLanguage_id,
+        EntityLanguage(EntityLanguage, entityLanguage_id,
+                       entityLanguage_key),
+        SymbolId(SymbolId_EMPTY, SymbolId_scip, SymbolId_cxx),
+        Language(Language_Cpp, Language_PreProcessor, Language_Java,
+                 Language_Haskell, Language_Python, Language_Hack,
+                 Language_JavaScript, Language_Rust, Language_Thrift, Language_Buck,
+                 Language_Erlang, Language_FSharp, Language_Go, Language_Kotlin,
+                 Language_OCaml, Language_Scala, Language_Swift,
+                 Language_TypeScript, Language_CSharp, Language_GraphQL,
+                 Language_Dataswarm, Language_Yaml, Language_Angle,
+                 Language__UNKNOWN),
+        EntityLanguageSCIP_key(EntityLanguageSCIP_key,
+                               entityLanguageSCIP_key_entity, entityLanguageSCIP_key_language),
+        EntityLanguageLSIF_key(EntityLanguageLSIF_key,
+                               entityLanguageLSIF_key_entity, entityLanguageLSIF_key_language),
+        Entity(Entity_EMPTY, Entity_cxx, Entity_pp, Entity_java,
+               Entity_kotlin, Entity_hs, Entity_python, Entity_hack, Entity_flow,
+               Entity_fbthrift, Entity_buck, Entity_erlang, Entity_lsif,
+               Entity_scip, Entity_csharp, Entity_graphql, Entity_dataswarm,
+               Entity_angle),
+        EntityLanguage_key(EntityLanguage_key, entityLanguage_key_entity,
+                           entityLanguage_key_language),
+        IdlEntity(IdlEntity, idlEntity_lang, idlEntity_file,
+                  idlEntity_entity, idlEntity_range),
+        Argument(Argument_EMPTY, Argument_lit, Argument_xref),
+        CallArgument(CallArgument, callArgument_label, callArgument_span,
+                     callArgument_argument),
+        Annotations(Annotations_EMPTY, Annotations_cxx, Annotations_java,
+                    Annotations_python, Annotations_hack, Annotations_fbthrift))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeAnglelang.Types
+       as Glean.Schema.CodeAnglelang
+import qualified Glean.Schema.CodeBuck.Types
+       as Glean.Schema.CodeBuck
+import qualified Glean.Schema.CodeCsharp.Types
+       as Glean.Schema.CodeCsharp
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.CodeDataswarm.Types
+       as Glean.Schema.CodeDataswarm
+import qualified Glean.Schema.CodeErlang.Types
+       as Glean.Schema.CodeErlang
+import qualified Glean.Schema.CodeFbthrift.Types
+       as Glean.Schema.CodeFbthrift
+import qualified Glean.Schema.CodeFlow.Types
+       as Glean.Schema.CodeFlow
+import qualified Glean.Schema.CodeGraphql.Types
+       as Glean.Schema.CodeGraphql
+import qualified Glean.Schema.CodeHack.Types
+       as Glean.Schema.CodeHack
+import qualified Glean.Schema.CodeHs.Types as Glean.Schema.CodeHs
+import qualified Glean.Schema.CodeJava.Types
+       as Glean.Schema.CodeJava
+import qualified Glean.Schema.CodeKotlin.Types
+       as Glean.Schema.CodeKotlin
+import qualified Glean.Schema.CodeLsif.Types
+       as Glean.Schema.CodeLsif
+import qualified Glean.Schema.CodePp.Types as Glean.Schema.CodePp
+import qualified Glean.Schema.CodePython.Types
+       as Glean.Schema.CodePython
+import qualified Glean.Schema.CodeScip.Types
+       as Glean.Schema.CodeScip
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/code_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeAnglelang.Types
+{-# LINE 16 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeBuck.Types
+{-# LINE 17 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeCsharp.Types
+{-# LINE 18 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 19 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeDataswarm.Types
+{-# LINE 20 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeErlang.Types
+{-# LINE 21 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeFbthrift.Types
+{-# LINE 22 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeFlow.Types
+{-# LINE 23 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeGraphql.Types
+{-# LINE 24 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeHack.Types
+{-# LINE 25 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeHs.Types
+{-# LINE 26 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeJava.Types
+{-# LINE 27 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeKotlin.Types
+{-# LINE 28 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeLsif.Types
+{-# LINE 29 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodePp.Types
+{-# LINE 30 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodePython.Types
+{-# LINE 31 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.CodeScip.Types
+{-# LINE 32 "glean/schema/thrift/code_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 178 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Code/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("EntityLanguageSCIP", 24), ("EntityLanguage", 24),
+       ("EntityLanguageLSIF", 24)]
+
+type EntityLanguageSCIP_id = Glean.Id
+
+data EntityLanguageSCIP = EntityLanguageSCIP{entityLanguageSCIP_id
+                                             :: {-# UNPACK #-} !EntityLanguageSCIP_id,
+                                             entityLanguageSCIP_key ::
+                                             Prelude.Maybe EntityLanguageSCIP_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguageSCIP where
+  toJSON (EntityLanguageSCIP __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguageSCIP where
+  buildStruct _proxy (EntityLanguageSCIP __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLanguageSCIP __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguageSCIP where
+  rnf (EntityLanguageSCIP __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLanguageSCIP where
+  def = EntityLanguageSCIP Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLanguageSCIP where
+  hashWithSalt __salt (EntityLanguageSCIP _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLanguageLSIF_id = Glean.Id
+
+data EntityLanguageLSIF = EntityLanguageLSIF{entityLanguageLSIF_id
+                                             :: {-# UNPACK #-} !EntityLanguageLSIF_id,
+                                             entityLanguageLSIF_key ::
+                                             Prelude.Maybe EntityLanguageLSIF_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguageLSIF where
+  toJSON (EntityLanguageLSIF __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguageLSIF where
+  buildStruct _proxy (EntityLanguageLSIF __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLanguageLSIF __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguageLSIF where
+  rnf (EntityLanguageLSIF __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLanguageLSIF where
+  def = EntityLanguageLSIF Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLanguageLSIF where
+  hashWithSalt __salt (EntityLanguageLSIF _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLanguage_id = Glean.Id
+
+data EntityLanguage = EntityLanguage{entityLanguage_id ::
+                                     {-# UNPACK #-} !EntityLanguage_id,
+                                     entityLanguage_key :: Prelude.Maybe EntityLanguage_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguage where
+  toJSON (EntityLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguage where
+  buildStruct _proxy (EntityLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLanguage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguage where
+  rnf (EntityLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLanguage where
+  def = EntityLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLanguage where
+  hashWithSalt __salt (EntityLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SymbolId = SymbolId_scip Glean.Schema.CodeScip.SymbolId
+              | SymbolId_cxx Glean.Schema.CodeCxx.SymbolId
+              | SymbolId_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolId where
+  toJSON (SymbolId_scip __scip) = Aeson.object ["scip" .= __scip]
+  toJSON (SymbolId_cxx __cxx) = Aeson.object ["cxx" .= __cxx]
+  toJSON SymbolId_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SymbolId where
+  buildStruct _proxy (SymbolId_scip __scip)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "scip" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __scip)]
+  buildStruct _proxy (SymbolId_cxx __cxx)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cxx" (Thrift.getStringType _proxy) 2 0
+           (Thrift.genText _proxy __cxx)]
+  buildStruct _proxy SymbolId_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SymbolId_scip _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SymbolId_cxx _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SymbolId_EMPTY
+           Thrift.FieldEnd -> Prelude.return SymbolId_EMPTY
+    where
+      _idMap = HashMap.fromList [("scip", 1), ("cxx", 2)]
+
+instance DeepSeq.NFData SymbolId where
+  rnf (SymbolId_scip __scip) = DeepSeq.rnf __scip
+  rnf (SymbolId_cxx __cxx) = DeepSeq.rnf __cxx
+  rnf SymbolId_EMPTY = ()
+
+instance Default.Default SymbolId where
+  def = SymbolId_EMPTY
+
+instance Hashable.Hashable SymbolId where
+  hashWithSalt __salt (SymbolId_scip _scip)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _scip)
+  hashWithSalt __salt (SymbolId_cxx _cxx)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _cxx)
+  hashWithSalt __salt SymbolId_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Language = Language_Cpp
+              | Language_PreProcessor
+              | Language_Java
+              | Language_Haskell
+              | Language_Python
+              | Language_Hack
+              | Language_JavaScript
+              | Language_Rust
+              | Language_Thrift
+              | Language_Buck
+              | Language_Erlang
+              | Language_FSharp
+              | Language_Go
+              | Language_Kotlin
+              | Language_OCaml
+              | Language_Scala
+              | Language_Swift
+              | Language_TypeScript
+              | Language_CSharp
+              | Language_GraphQL
+              | Language_Dataswarm
+              | Language_Yaml
+              | Language_Angle
+              | Language__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Language where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Language where
+  rnf __Language = Prelude.seq __Language ()
+
+instance Default.Default Language where
+  def = Language_Cpp
+
+instance Hashable.Hashable Language where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Language where
+  toThriftEnum 0 = Language_Cpp
+  toThriftEnum 1 = Language_PreProcessor
+  toThriftEnum 2 = Language_Java
+  toThriftEnum 3 = Language_Haskell
+  toThriftEnum 4 = Language_Python
+  toThriftEnum 5 = Language_Hack
+  toThriftEnum 6 = Language_JavaScript
+  toThriftEnum 7 = Language_Rust
+  toThriftEnum 8 = Language_Thrift
+  toThriftEnum 9 = Language_Buck
+  toThriftEnum 10 = Language_Erlang
+  toThriftEnum 11 = Language_FSharp
+  toThriftEnum 12 = Language_Go
+  toThriftEnum 13 = Language_Kotlin
+  toThriftEnum 14 = Language_OCaml
+  toThriftEnum 15 = Language_Scala
+  toThriftEnum 16 = Language_Swift
+  toThriftEnum 17 = Language_TypeScript
+  toThriftEnum 18 = Language_CSharp
+  toThriftEnum 19 = Language_GraphQL
+  toThriftEnum 20 = Language_Dataswarm
+  toThriftEnum 21 = Language_Yaml
+  toThriftEnum 22 = Language_Angle
+  toThriftEnum val = Language__UNKNOWN val
+  fromThriftEnum Language_Cpp = 0
+  fromThriftEnum Language_PreProcessor = 1
+  fromThriftEnum Language_Java = 2
+  fromThriftEnum Language_Haskell = 3
+  fromThriftEnum Language_Python = 4
+  fromThriftEnum Language_Hack = 5
+  fromThriftEnum Language_JavaScript = 6
+  fromThriftEnum Language_Rust = 7
+  fromThriftEnum Language_Thrift = 8
+  fromThriftEnum Language_Buck = 9
+  fromThriftEnum Language_Erlang = 10
+  fromThriftEnum Language_FSharp = 11
+  fromThriftEnum Language_Go = 12
+  fromThriftEnum Language_Kotlin = 13
+  fromThriftEnum Language_OCaml = 14
+  fromThriftEnum Language_Scala = 15
+  fromThriftEnum Language_Swift = 16
+  fromThriftEnum Language_TypeScript = 17
+  fromThriftEnum Language_CSharp = 18
+  fromThriftEnum Language_GraphQL = 19
+  fromThriftEnum Language_Dataswarm = 20
+  fromThriftEnum Language_Yaml = 21
+  fromThriftEnum Language_Angle = 22
+  fromThriftEnum (Language__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Language_Cpp, Language_PreProcessor, Language_Java,
+       Language_Haskell, Language_Python, Language_Hack,
+       Language_JavaScript, Language_Rust, Language_Thrift, Language_Buck,
+       Language_Erlang, Language_FSharp, Language_Go, Language_Kotlin,
+       Language_OCaml, Language_Scala, Language_Swift,
+       Language_TypeScript, Language_CSharp, Language_GraphQL,
+       Language_Dataswarm, Language_Yaml, Language_Angle]
+  toThriftEnumEither 0 = Prelude.Right Language_Cpp
+  toThriftEnumEither 1 = Prelude.Right Language_PreProcessor
+  toThriftEnumEither 2 = Prelude.Right Language_Java
+  toThriftEnumEither 3 = Prelude.Right Language_Haskell
+  toThriftEnumEither 4 = Prelude.Right Language_Python
+  toThriftEnumEither 5 = Prelude.Right Language_Hack
+  toThriftEnumEither 6 = Prelude.Right Language_JavaScript
+  toThriftEnumEither 7 = Prelude.Right Language_Rust
+  toThriftEnumEither 8 = Prelude.Right Language_Thrift
+  toThriftEnumEither 9 = Prelude.Right Language_Buck
+  toThriftEnumEither 10 = Prelude.Right Language_Erlang
+  toThriftEnumEither 11 = Prelude.Right Language_FSharp
+  toThriftEnumEither 12 = Prelude.Right Language_Go
+  toThriftEnumEither 13 = Prelude.Right Language_Kotlin
+  toThriftEnumEither 14 = Prelude.Right Language_OCaml
+  toThriftEnumEither 15 = Prelude.Right Language_Scala
+  toThriftEnumEither 16 = Prelude.Right Language_Swift
+  toThriftEnumEither 17 = Prelude.Right Language_TypeScript
+  toThriftEnumEither 18 = Prelude.Right Language_CSharp
+  toThriftEnumEither 19 = Prelude.Right Language_GraphQL
+  toThriftEnumEither 20 = Prelude.Right Language_Dataswarm
+  toThriftEnumEither 21 = Prelude.Right Language_Yaml
+  toThriftEnumEither 22 = Prelude.Right Language_Angle
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Language: "
+           ++ Prelude.show val)
+
+data EntityLanguageSCIP_key = EntityLanguageSCIP_key{entityLanguageSCIP_key_entity
+                                                     :: Glean.Schema.CodeScip.Entity,
+                                                     entityLanguageSCIP_key_language :: Language}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguageSCIP_key where
+  toJSON (EntityLanguageSCIP_key __field__entity __field__language)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguageSCIP_key where
+  buildStruct _proxy
+    (EntityLanguageSCIP_key __field__entity __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (EntityLanguageSCIP_key __val__entity
+                                                  __val__language)
+              _idMap = HashMap.fromList [("entity", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguageSCIP_key where
+  rnf (EntityLanguageSCIP_key __field__entity __field__language)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default EntityLanguageSCIP_key where
+  def = EntityLanguageSCIP_key Default.def Default.def
+
+instance Hashable.Hashable EntityLanguageSCIP_key where
+  hashWithSalt __salt (EntityLanguageSCIP_key _entity _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _language
+
+data EntityLanguageLSIF_key = EntityLanguageLSIF_key{entityLanguageLSIF_key_entity
+                                                     :: Glean.Schema.CodeLsif.Entity,
+                                                     entityLanguageLSIF_key_language :: Language}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguageLSIF_key where
+  toJSON (EntityLanguageLSIF_key __field__entity __field__language)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguageLSIF_key where
+  buildStruct _proxy
+    (EntityLanguageLSIF_key __field__entity __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (EntityLanguageLSIF_key __val__entity
+                                                  __val__language)
+              _idMap = HashMap.fromList [("entity", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguageLSIF_key where
+  rnf (EntityLanguageLSIF_key __field__entity __field__language)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default EntityLanguageLSIF_key where
+  def = EntityLanguageLSIF_key Default.def Default.def
+
+instance Hashable.Hashable EntityLanguageLSIF_key where
+  hashWithSalt __salt (EntityLanguageLSIF_key _entity _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _language
+
+data Entity = Entity_cxx Glean.Schema.CodeCxx.Entity
+            | Entity_pp Glean.Schema.CodePp.Entity
+            | Entity_java Glean.Schema.CodeJava.Entity
+            | Entity_kotlin Glean.Schema.CodeKotlin.Entity
+            | Entity_hs Glean.Schema.CodeHs.Entity
+            | Entity_python Glean.Schema.CodePython.Entity
+            | Entity_hack Glean.Schema.CodeHack.Entity
+            | Entity_flow Glean.Schema.CodeFlow.Entity
+            | Entity_fbthrift Glean.Schema.CodeFbthrift.Entity
+            | Entity_buck Glean.Schema.CodeBuck.Entity
+            | Entity_erlang Glean.Schema.CodeErlang.Entity
+            | Entity_lsif Glean.Schema.CodeLsif.Entity
+            | Entity_scip Glean.Schema.CodeScip.Entity
+            | Entity_csharp Glean.Schema.CodeCsharp.Entity
+            | Entity_graphql Glean.Schema.CodeGraphql.Entity
+            | Entity_dataswarm Glean.Schema.CodeDataswarm.Entity
+            | Entity_angle Glean.Schema.CodeAnglelang.Entity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_cxx __cxx) = Aeson.object ["cxx" .= __cxx]
+  toJSON (Entity_pp __pp) = Aeson.object ["pp" .= __pp]
+  toJSON (Entity_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Entity_kotlin __kotlin)
+    = Aeson.object ["kotlin" .= __kotlin]
+  toJSON (Entity_hs __hs) = Aeson.object ["hs" .= __hs]
+  toJSON (Entity_python __python)
+    = Aeson.object ["python" .= __python]
+  toJSON (Entity_hack __hack) = Aeson.object ["hack" .= __hack]
+  toJSON (Entity_flow __flow) = Aeson.object ["flow" .= __flow]
+  toJSON (Entity_fbthrift __fbthrift)
+    = Aeson.object ["fbthrift" .= __fbthrift]
+  toJSON (Entity_buck __buck) = Aeson.object ["buck" .= __buck]
+  toJSON (Entity_erlang __erlang)
+    = Aeson.object ["erlang" .= __erlang]
+  toJSON (Entity_lsif __lsif) = Aeson.object ["lsif" .= __lsif]
+  toJSON (Entity_scip __scip) = Aeson.object ["scip" .= __scip]
+  toJSON (Entity_csharp __csharp)
+    = Aeson.object ["csharp" .= __csharp]
+  toJSON (Entity_graphql __graphql)
+    = Aeson.object ["graphql" .= __graphql]
+  toJSON (Entity_dataswarm __dataswarm)
+    = Aeson.object ["dataswarm" .= __dataswarm]
+  toJSON (Entity_angle __angle) = Aeson.object ["angle" .= __angle]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_cxx __cxx)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cxx" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __cxx)]
+  buildStruct _proxy (Entity_pp __pp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "pp" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __pp)]
+  buildStruct _proxy (Entity_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Entity_kotlin __kotlin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "kotlin" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __kotlin)]
+  buildStruct _proxy (Entity_hs __hs)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "hs" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __hs)]
+  buildStruct _proxy (Entity_python __python)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "python" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __python)]
+  buildStruct _proxy (Entity_hack __hack)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "hack" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __hack)]
+  buildStruct _proxy (Entity_flow __flow)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "flow" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __flow)]
+  buildStruct _proxy (Entity_fbthrift __fbthrift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fbthrift" (Thrift.getStructType _proxy) 9
+           0
+           (Thrift.buildStruct _proxy __fbthrift)]
+  buildStruct _proxy (Entity_buck __buck)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "buck" (Thrift.getStructType _proxy) 10 0
+           (Thrift.buildStruct _proxy __buck)]
+  buildStruct _proxy (Entity_erlang __erlang)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "erlang" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __erlang)]
+  buildStruct _proxy (Entity_lsif __lsif)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lsif" (Thrift.getStructType _proxy) 12 0
+           (Thrift.buildStruct _proxy __lsif)]
+  buildStruct _proxy (Entity_scip __scip)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "scip" (Thrift.getStructType _proxy) 13 0
+           (Thrift.buildStruct _proxy __scip)]
+  buildStruct _proxy (Entity_csharp __csharp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "csharp" (Thrift.getStructType _proxy) 14 0
+           (Thrift.buildStruct _proxy __csharp)]
+  buildStruct _proxy (Entity_graphql __graphql)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "graphql" (Thrift.getStructType _proxy) 15
+           0
+           (Thrift.buildStruct _proxy __graphql)]
+  buildStruct _proxy (Entity_dataswarm __dataswarm)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "dataswarm" (Thrift.getStructType _proxy)
+           16
+           0
+           (Thrift.buildStruct _proxy __dataswarm)]
+  buildStruct _proxy (Entity_angle __angle)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "angle" (Thrift.getStructType _proxy) 17 0
+           (Thrift.buildStruct _proxy __angle)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_cxx _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_pp _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_java _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_kotlin _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_hs _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_python _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_hack _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_flow _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_fbthrift _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_buck _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_erlang _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_lsif _val)
+                                                     13 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_scip _val)
+                                                     14 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_csharp _val)
+                                                     15 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_graphql _val)
+                                                     16 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_dataswarm _val)
+                                                     17 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_angle _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("cxx", 1), ("pp", 2), ("java", 3), ("kotlin", 4), ("hs", 5),
+             ("python", 6), ("hack", 7), ("flow", 8), ("fbthrift", 9),
+             ("buck", 10), ("erlang", 11), ("lsif", 12), ("scip", 13),
+             ("csharp", 14), ("graphql", 15), ("dataswarm", 16), ("angle", 17)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_cxx __cxx) = DeepSeq.rnf __cxx
+  rnf (Entity_pp __pp) = DeepSeq.rnf __pp
+  rnf (Entity_java __java) = DeepSeq.rnf __java
+  rnf (Entity_kotlin __kotlin) = DeepSeq.rnf __kotlin
+  rnf (Entity_hs __hs) = DeepSeq.rnf __hs
+  rnf (Entity_python __python) = DeepSeq.rnf __python
+  rnf (Entity_hack __hack) = DeepSeq.rnf __hack
+  rnf (Entity_flow __flow) = DeepSeq.rnf __flow
+  rnf (Entity_fbthrift __fbthrift) = DeepSeq.rnf __fbthrift
+  rnf (Entity_buck __buck) = DeepSeq.rnf __buck
+  rnf (Entity_erlang __erlang) = DeepSeq.rnf __erlang
+  rnf (Entity_lsif __lsif) = DeepSeq.rnf __lsif
+  rnf (Entity_scip __scip) = DeepSeq.rnf __scip
+  rnf (Entity_csharp __csharp) = DeepSeq.rnf __csharp
+  rnf (Entity_graphql __graphql) = DeepSeq.rnf __graphql
+  rnf (Entity_dataswarm __dataswarm) = DeepSeq.rnf __dataswarm
+  rnf (Entity_angle __angle) = DeepSeq.rnf __angle
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_cxx _cxx)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _cxx)
+  hashWithSalt __salt (Entity_pp _pp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _pp)
+  hashWithSalt __salt (Entity_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _java)
+  hashWithSalt __salt (Entity_kotlin _kotlin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _kotlin)
+  hashWithSalt __salt (Entity_hs _hs)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _hs)
+  hashWithSalt __salt (Entity_python _python)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _python)
+  hashWithSalt __salt (Entity_hack _hack)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _hack)
+  hashWithSalt __salt (Entity_flow _flow)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _flow)
+  hashWithSalt __salt (Entity_fbthrift _fbthrift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _fbthrift)
+  hashWithSalt __salt (Entity_buck _buck)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _buck)
+  hashWithSalt __salt (Entity_erlang _erlang)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _erlang)
+  hashWithSalt __salt (Entity_lsif _lsif)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _lsif)
+  hashWithSalt __salt (Entity_scip _scip)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 13 _scip)
+  hashWithSalt __salt (Entity_csharp _csharp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 14 _csharp)
+  hashWithSalt __salt (Entity_graphql _graphql)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 15 _graphql)
+  hashWithSalt __salt (Entity_dataswarm _dataswarm)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 16 _dataswarm)
+  hashWithSalt __salt (Entity_angle _angle)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 17 _angle)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EntityLanguage_key = EntityLanguage_key{entityLanguage_key_entity
+                                             :: Entity,
+                                             entityLanguage_key_language :: Language}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLanguage_key where
+  toJSON (EntityLanguage_key __field__entity __field__language)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLanguage_key where
+  buildStruct _proxy
+    (EntityLanguage_key __field__entity __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (EntityLanguage_key __val__entity __val__language)
+              _idMap = HashMap.fromList [("entity", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLanguage_key where
+  rnf (EntityLanguage_key __field__entity __field__language)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default EntityLanguage_key where
+  def = EntityLanguage_key Default.def Default.def
+
+instance Hashable.Hashable EntityLanguage_key where
+  hashWithSalt __salt (EntityLanguage_key _entity _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _language
+
+data IdlEntity = IdlEntity{idlEntity_lang :: Language,
+                           idlEntity_file :: Glean.Schema.Src.File,
+                           idlEntity_entity :: Prelude.Maybe Entity,
+                           idlEntity_range :: Prelude.Maybe Glean.Schema.Src.Range}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IdlEntity where
+  toJSON
+    (IdlEntity __field__lang __field__file __field__entity
+       __field__range)
+    = Aeson.object
+        ("lang" .= __field__lang :
+           "file" .= __field__file :
+             Prelude.maybe Prelude.id ((:) . ("entity" .=)) __field__entity
+               (Prelude.maybe Prelude.id ((:) . ("range" .=)) __field__range
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct IdlEntity where
+  buildStruct _proxy
+    (IdlEntity __field__lang __field__file __field__entity
+       __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lang" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__lang)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             let (__cereal__entity, __id__entity)
+                   = case __field__entity of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "entity"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__entity
+                 (case __field__range of
+                    Prelude.Just _val -> Thrift.genField _proxy "range"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           __id__entity
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lang <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Prelude.Nothing
+            __field__range <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef __field__lang
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lang <- ST.readSTRef __field__lang
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (IdlEntity __val__lang __val__file __val__entity
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList
+                    [("lang", 1), ("file", 2), ("entity", 3), ("range", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData IdlEntity where
+  rnf
+    (IdlEntity __field__lang __field__file __field__entity
+       __field__range)
+    = DeepSeq.rnf __field__lang `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq`
+            DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default IdlEntity where
+  def
+    = IdlEntity Default.def Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable IdlEntity where
+  hashWithSalt __salt (IdlEntity _lang _file _entity _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lang) _file)
+           _entity)
+        _range
+
+data Argument = Argument_lit Text.Text
+              | Argument_xref Entity
+              | Argument_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Argument where
+  toJSON (Argument_lit __lit) = Aeson.object ["lit" .= __lit]
+  toJSON (Argument_xref __xref) = Aeson.object ["xref" .= __xref]
+  toJSON Argument_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Argument where
+  buildStruct _proxy (Argument_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __lit)]
+  buildStruct _proxy (Argument_xref __xref)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __xref)]
+  buildStruct _proxy Argument_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Argument_lit _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Argument_xref _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Argument_EMPTY
+           Thrift.FieldEnd -> Prelude.return Argument_EMPTY
+    where
+      _idMap = HashMap.fromList [("lit", 1), ("xref", 2)]
+
+instance DeepSeq.NFData Argument where
+  rnf (Argument_lit __lit) = DeepSeq.rnf __lit
+  rnf (Argument_xref __xref) = DeepSeq.rnf __xref
+  rnf Argument_EMPTY = ()
+
+instance Default.Default Argument where
+  def = Argument_EMPTY
+
+instance Hashable.Hashable Argument where
+  hashWithSalt __salt (Argument_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _lit)
+  hashWithSalt __salt (Argument_xref _xref)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _xref)
+  hashWithSalt __salt Argument_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data CallArgument = CallArgument{callArgument_label ::
+                                 Prelude.Maybe Text.Text,
+                                 callArgument_span :: Glean.Schema.Src.ByteSpan,
+                                 callArgument_argument :: Prelude.Maybe Argument}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallArgument where
+  toJSON
+    (CallArgument __field__label __field__span __field__argument)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("label" .=)) __field__label
+           ("span" .= __field__span :
+              Prelude.maybe Prelude.id ((:) . ("argument" .=)) __field__argument
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct CallArgument where
+  buildStruct _proxy
+    (CallArgument __field__label __field__span __field__argument)
+    = Thrift.genStruct _proxy
+        (let (__cereal__label, __id__label)
+               = case __field__label of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "label"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              (Thrift.genText _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__label
+             (Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2
+                __id__label
+                (Thrift.buildStruct _proxy __field__span)
+                :
+                case __field__argument of
+                  Prelude.Just _val -> Thrift.genField _proxy "argument"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         2
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__label <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Default.def
+            __field__argument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__label
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__argument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__label <- ST.readSTRef __field__label
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__argument <- ST.readSTRef __field__argument
+                                             Prelude.pure
+                                               (CallArgument __val__label __val__span
+                                                  __val__argument)
+              _idMap
+                = HashMap.fromList [("label", 1), ("span", 2), ("argument", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CallArgument where
+  rnf (CallArgument __field__label __field__span __field__argument)
+    = DeepSeq.rnf __field__label `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__argument `Prelude.seq` ()
+
+instance Default.Default CallArgument where
+  def = CallArgument Prelude.Nothing Default.def Prelude.Nothing
+
+instance Hashable.Hashable CallArgument where
+  hashWithSalt __salt (CallArgument _label _span _argument)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _label) _span)
+        _argument
+
+data Annotations = Annotations_cxx Glean.Schema.CodeCxx.Annotations
+                 | Annotations_java Glean.Schema.CodeJava.Annotations
+                 | Annotations_python Glean.Schema.CodePython.Annotations
+                 | Annotations_hack Glean.Schema.CodeHack.Annotations
+                 | Annotations_fbthrift Glean.Schema.CodeFbthrift.Annotations
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_cxx __cxx) = Aeson.object ["cxx" .= __cxx]
+  toJSON (Annotations_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Annotations_python __python)
+    = Aeson.object ["python" .= __python]
+  toJSON (Annotations_hack __hack) = Aeson.object ["hack" .= __hack]
+  toJSON (Annotations_fbthrift __fbthrift)
+    = Aeson.object ["fbthrift" .= __fbthrift]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_cxx __cxx)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cxx" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __cxx)]
+  buildStruct _proxy (Annotations_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Annotations_python __python)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "python" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __python)]
+  buildStruct _proxy (Annotations_hack __hack)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "hack" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __hack)]
+  buildStruct _proxy (Annotations_fbthrift __fbthrift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fbthrift" (Thrift.getStructType _proxy) 5
+           0
+           (Thrift.buildStruct _proxy __fbthrift)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Annotations_cxx _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Annotations_java _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Annotations_python _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Annotations_hack _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_fbthrift _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("cxx", 1), ("java", 2), ("python", 3), ("hack", 4),
+             ("fbthrift", 5)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_cxx __cxx) = DeepSeq.rnf __cxx
+  rnf (Annotations_java __java) = DeepSeq.rnf __java
+  rnf (Annotations_python __python) = DeepSeq.rnf __python
+  rnf (Annotations_hack __hack) = DeepSeq.rnf __hack
+  rnf (Annotations_fbthrift __fbthrift) = DeepSeq.rnf __fbthrift
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_cxx _cxx)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _cxx)
+  hashWithSalt __salt (Annotations_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _java)
+  hashWithSalt __salt (Annotations_python _python)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _python)
+  hashWithSalt __salt (Annotations_hack _hack)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _hack)
+  hashWithSalt __salt (Annotations_fbthrift _fbthrift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _fbthrift)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 35 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguageSCIP_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Code.Types.EntityLanguageSCIP_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Code.Types.EntityLanguageSCIP_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.EntityLanguageSCIP_key" (Prelude.Just 0))
+{-# LINE 44 "glean/schema/thrift/code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Code.Types.EntityLanguageSCIP_key =
+     'Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TNoFields))
+{-# LINE 46 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Code.Types.EntityLanguageSCIP
+         where
+  type KeyType Glean.Schema.Code.Types.EntityLanguageSCIP =
+       Glean.Schema.Code.Types.EntityLanguageSCIP_key
+  getName _proxy = Glean.PredicateRef "code.EntityLanguageSCIP" 24
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Code.Types.entityLanguageSCIP_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Code.Types.EntityLanguageSCIP x k
+  getFactKey = Glean.Schema.Code.Types.entityLanguageSCIP_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 55 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguageSCIP
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 61 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguage_key
+         where
+  buildRtsValue b (Glean.Schema.Code.Types.EntityLanguage_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Code.Types.EntityLanguage_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.EntityLanguage_key" (Prelude.Just 0))
+{-# LINE 70 "glean/schema/thrift/code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Code.Types.EntityLanguage_key =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TNoFields))
+{-# LINE 72 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Code.Types.EntityLanguage
+         where
+  type KeyType Glean.Schema.Code.Types.EntityLanguage =
+       Glean.Schema.Code.Types.EntityLanguage_key
+  getName _proxy = Glean.PredicateRef "code.EntityLanguage" 24
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Code.Types.entityLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Code.Types.EntityLanguage x k
+  getFactKey = Glean.Schema.Code.Types.entityLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 81 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguage where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 87 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguageLSIF_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Code.Types.EntityLanguageLSIF_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Code.Types.EntityLanguageLSIF_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.EntityLanguageLSIF_key" (Prelude.Just 0))
+{-# LINE 96 "glean/schema/thrift/code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Code.Types.EntityLanguageLSIF_key =
+     'Angle.TField "entity" (Glean.Schema.CodeLsif.Types.Entity)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TNoFields))
+{-# LINE 98 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Code.Types.EntityLanguageLSIF
+         where
+  type KeyType Glean.Schema.Code.Types.EntityLanguageLSIF =
+       Glean.Schema.Code.Types.EntityLanguageLSIF_key
+  getName _proxy = Glean.PredicateRef "code.EntityLanguageLSIF" 24
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Code.Types.entityLanguageLSIF_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Code.Types.EntityLanguageLSIF x k
+  getFactKey = Glean.Schema.Code.Types.entityLanguageLSIF_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 107 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.EntityLanguageLSIF
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 113 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.Entity where
+  buildRtsValue b Glean.Schema.Code.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 17
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_cxx x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_pp x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_java x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_kotlin x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_hs x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_python x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_hack x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_flow x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_fbthrift x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_buck x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_erlang x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_lsif x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_scip x)
+    = do Glean.buildRtsSelector b 12
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_csharp x)
+    = do Glean.buildRtsSelector b 13
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_graphql x)
+    = do Glean.buildRtsSelector b 14
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_dataswarm x)
+    = do Glean.buildRtsSelector b 15
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Entity_angle x)
+    = do Glean.buildRtsSelector b 16
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Code.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.Code.Types.Entity_cxx,
+         Glean.mapD Glean.Schema.Code.Types.Entity_pp,
+         Glean.mapD Glean.Schema.Code.Types.Entity_java,
+         Glean.mapD Glean.Schema.Code.Types.Entity_kotlin,
+         Glean.mapD Glean.Schema.Code.Types.Entity_hs,
+         Glean.mapD Glean.Schema.Code.Types.Entity_python,
+         Glean.mapD Glean.Schema.Code.Types.Entity_hack,
+         Glean.mapD Glean.Schema.Code.Types.Entity_flow,
+         Glean.mapD Glean.Schema.Code.Types.Entity_fbthrift,
+         Glean.mapD Glean.Schema.Code.Types.Entity_buck,
+         Glean.mapD Glean.Schema.Code.Types.Entity_erlang,
+         Glean.mapD Glean.Schema.Code.Types.Entity_lsif,
+         Glean.mapD Glean.Schema.Code.Types.Entity_scip,
+         Glean.mapD Glean.Schema.Code.Types.Entity_csharp,
+         Glean.mapD Glean.Schema.Code.Types.Entity_graphql,
+         Glean.mapD Glean.Schema.Code.Types.Entity_dataswarm,
+         Glean.mapD Glean.Schema.Code.Types.Entity_angle]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.Entity" (Prelude.Just 24))
+{-# LINE 189 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Code.Types.Entity =
+     'Angle.TField "cxx" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "pp" (Glean.Schema.CodePp.Types.Entity)
+          ('Angle.TField "java" (Glean.Schema.CodeJava.Types.Entity)
+             ('Angle.TField "kotlin" (Glean.Schema.CodeKotlin.Types.Entity)
+                ('Angle.TField "hs" (Glean.Schema.CodeHs.Types.Entity)
+                   ('Angle.TField "python" (Glean.Schema.CodePython.Types.Entity)
+                      ('Angle.TField "hack" (Glean.Schema.CodeHack.Types.Entity)
+                         ('Angle.TField "flow" (Glean.Schema.CodeFlow.Types.Entity)
+                            ('Angle.TField "fbthrift" (Glean.Schema.CodeFbthrift.Types.Entity)
+                               ('Angle.TField "buck" (Glean.Schema.CodeBuck.Types.Entity)
+                                  ('Angle.TField "erlang" (Glean.Schema.CodeErlang.Types.Entity)
+                                     ('Angle.TField "lsif" (Glean.Schema.CodeLsif.Types.Entity)
+                                        ('Angle.TField "scip" (Glean.Schema.CodeScip.Types.Entity)
+                                           ('Angle.TField "csharp"
+                                              (Glean.Schema.CodeCsharp.Types.Entity)
+                                              ('Angle.TField "graphql"
+                                                 (Glean.Schema.CodeGraphql.Types.Entity)
+                                                 ('Angle.TField "dataswarm"
+                                                    (Glean.Schema.CodeDataswarm.Types.Entity)
+                                                    ('Angle.TField "angle"
+                                                       (Glean.Schema.CodeAnglelang.Types.Entity)
+                                                       ('Angle.TNoFields)))))))))))))))))
+{-# LINE 191 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.Argument where
+  buildRtsValue b Glean.Schema.Code.Types.Argument_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Code.Types.Argument_lit x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Argument_xref x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Code.Types.Argument_EMPTY)
+        [Glean.mapD Glean.Schema.Code.Types.Argument_lit,
+         Glean.mapD Glean.Schema.Code.Types.Argument_xref]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.Argument" (Prelude.Just 24))
+{-# LINE 207 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Code.Types.Argument =
+     'Angle.TField "lit" (Data.Text.Text)
+       ('Angle.TField "xref" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 209 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.Language where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.Language" (Prelude.Just 24))
+{-# LINE 214 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Code.Types.Language =
+     'Angle.TField "Cpp" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "PreProcessor" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Java" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Haskell" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Python" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Hack" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "JavaScript" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Rust" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "Thrift" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Buck" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "Erlang" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "FSharp" (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "Go" (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "Kotlin" (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "OCaml"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "Scala"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "Swift"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "TypeScript"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "CSharp"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "GraphQL"
+                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                ('Angle.TField "Dataswarm"
+                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                   ('Angle.TField "Yaml"
+                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                      ('Angle.TField "Angle"
+                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                         ('Angle.TNoFields)))))))))))))))))))))))
+{-# LINE 216 "glean/schema/thrift/code_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Code.Types.Language where
+  type AngleEnumTy Glean.Schema.Code.Types.Language =
+       Glean.Schema.Code.Types.Language
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 220 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.SymbolId where
+  buildRtsValue b Glean.Schema.Code.Types.SymbolId_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Code.Types.SymbolId_scip x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.SymbolId_cxx x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Code.Types.SymbolId_EMPTY)
+        [Glean.mapD Glean.Schema.Code.Types.SymbolId_scip,
+         Glean.mapD Glean.Schema.Code.Types.SymbolId_cxx]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.SymbolId" (Prelude.Just 24))
+{-# LINE 236 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Code.Types.SymbolId =
+     'Angle.TField "scip" (Glean.Schema.CodeScip.Types.SymbolId)
+       ('Angle.TField "cxx" (Glean.Schema.CodeCxx.Types.SymbolId)
+          ('Angle.TNoFields))
+{-# LINE 238 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.CallArgument where
+  buildRtsValue b (Glean.Schema.Code.Types.CallArgument x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Code.Types.CallArgument <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.CallArgument" (Prelude.Just 24))
+{-# LINE 249 "glean/schema/thrift/code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Code.Types.CallArgument =
+     'Angle.TField "label" (Prelude.Maybe Data.Text.Text)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "argument"
+             (Prelude.Maybe Glean.Schema.Code.Types.Argument)
+             ('Angle.TNoFields)))
+{-# LINE 251 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.IdlEntity where
+  buildRtsValue b (Glean.Schema.Code.Types.IdlEntity x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Code.Types.IdlEntity <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.IdlEntity" (Prelude.Just 24))
+{-# LINE 264 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Code.Types.IdlEntity
+     =
+     'Angle.TField "lang" (Glean.Schema.Code.Types.Language)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "entity"
+             (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+             ('Angle.TField "range" (Prelude.Maybe Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 266 "glean/schema/thrift/code_include.hs" #-}
+instance Glean.Type Glean.Schema.Code.Types.Annotations where
+  buildRtsValue b Glean.Schema.Code.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Code.Types.Annotations_cxx x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Annotations_java x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Annotations_python x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Annotations_hack x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Code.Types.Annotations_fbthrift x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Code.Types.Annotations_EMPTY)
+        [Glean.mapD Glean.Schema.Code.Types.Annotations_cxx,
+         Glean.mapD Glean.Schema.Code.Types.Annotations_java,
+         Glean.mapD Glean.Schema.Code.Types.Annotations_python,
+         Glean.mapD Glean.Schema.Code.Types.Annotations_hack,
+         Glean.mapD Glean.Schema.Code.Types.Annotations_fbthrift]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.Annotations" (Prelude.Just 24))
+{-# LINE 294 "glean/schema/thrift/code_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Code.Types.Annotations =
+     'Angle.TField "cxx" (Glean.Schema.CodeCxx.Types.Annotations)
+       ('Angle.TField "java" (Glean.Schema.CodeJava.Types.Annotations)
+          ('Angle.TField "python" (Glean.Schema.CodePython.Types.Annotations)
+             ('Angle.TField "hack" (Glean.Schema.CodeHack.Types.Annotations)
+                ('Angle.TField "fbthrift"
+                   (Glean.Schema.CodeFbthrift.Types.Annotations)
+                   ('Angle.TNoFields)))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeAnglelang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeAnglelang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeAnglelang/Types.hs
@@ -0,0 +1,141 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_anglelang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_anglelang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_anglelang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeAnglelang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeAnglelang.Types
+       (pREDICATE_VERSIONS, Entity(Entity, entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Anglelang.Types
+       as Glean.Schema.Anglelang
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Schema.Anglelang.Types
+{-# LINE 15 "glean/schema/thrift/code_anglelang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 72 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeAnglelang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+newtype Entity = Entity{entity_decl ::
+                        Glean.Schema.Anglelang.Declaration}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity __field__decl)
+    = Aeson.object ("decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (Entity __val__decl)
+              _idMap = HashMap.fromList [("decl", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity __field__decl)
+    = DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default Entity where
+  def = Entity Default.def
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity _decl)
+    = Hashable.hashWithSalt __salt _decl
+{-# LINE 18 "glean/schema/thrift/code_anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeAnglelang.Types.Entity where
+  buildRtsValue b (Glean.Schema.CodeAnglelang.Types.Entity x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.CodeAnglelang.Types.Entity <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.anglelang.Entity" (Prelude.Just 1))
+{-# LINE 25 "glean/schema/thrift/code_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodeAnglelang.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Anglelang.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeBuck/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeBuck/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeBuck/Types.hs
@@ -0,0 +1,180 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_buck_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_buck_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_buck_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeBuck/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeBuck.Types
+       (pREDICATE_VERSIONS,
+        Entity(Entity_EMPTY, Entity_locator, Entity_file,
+               Entity_definition))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Buck.Types as Glean.Schema.Buck
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Schema.Buck.Types
+{-# LINE 15 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 16 "glean/schema/thrift/code_buck_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 73 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeBuck/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_locator Glean.Schema.Buck.Locator
+            | Entity_file Glean.Schema.Src.File
+            | Entity_definition Glean.Schema.Buck.Definition
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_locator __locator)
+    = Aeson.object ["locator" .= __locator]
+  toJSON (Entity_file __file) = Aeson.object ["file" .= __file]
+  toJSON (Entity_definition __definition)
+    = Aeson.object ["definition" .= __definition]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_locator __locator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "locator" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __locator)]
+  buildStruct _proxy (Entity_file __file)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __file)]
+  buildStruct _proxy (Entity_definition __definition)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __definition)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_locator _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_file _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_definition _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("locator", 1), ("file", 2), ("definition", 3)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_locator __locator) = DeepSeq.rnf __locator
+  rnf (Entity_file __file) = DeepSeq.rnf __file
+  rnf (Entity_definition __definition) = DeepSeq.rnf __definition
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_locator _locator)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _locator)
+  hashWithSalt __salt (Entity_file _file)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _file)
+  hashWithSalt __salt (Entity_definition _definition)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _definition)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 19 "glean/schema/thrift/code_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeBuck.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeBuck.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.CodeBuck.Types.Entity_locator x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeBuck.Types.Entity_file x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeBuck.Types.Entity_definition x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeBuck.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeBuck.Types.Entity_locator,
+         Glean.mapD Glean.Schema.CodeBuck.Types.Entity_file,
+         Glean.mapD Glean.Schema.CodeBuck.Types.Entity_definition]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.buck.Entity" (Prelude.Just 1))
+{-# LINE 39 "glean/schema/thrift/code_buck_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeBuck.Types.Entity =
+     'Angle.TField "locator"
+       (Glean.KeyType Glean.Schema.Buck.Types.Locator)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "definition"
+             (Glean.KeyType Glean.Schema.Buck.Types.Definition)
+             ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCsharp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCsharp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCsharp/Types.hs
@@ -0,0 +1,131 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_csharp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_csharp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_csharp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCsharp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeCsharp.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Csharp.Types as Glean.Schema.Csharp
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_csharp_include.hs" #-}
+import qualified Glean.Schema.Csharp.Types
+{-# LINE 67 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCsharp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Csharp.Definition
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCsharp.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeCsharp.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeCsharp.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeCsharp.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeCsharp.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.csharp.Entity" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeCsharp.Types.Entity
+     =
+     'Angle.TField "decl" (Glean.Schema.Csharp.Types.Definition)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCxx/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCxx/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCxx/Types.hs
@@ -0,0 +1,880 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_cxx_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_cxx_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_cxx_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCxx/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeCxx.Types
+       (pREDICATE_VERSIONS, DeclToDef_id,
+        DeclToDef(DeclToDef, declToDef_id, declToDef_key), SymbolId,
+        ObjcMethodEntity(ObjcMethodEntity_EMPTY, ObjcMethodEntity_decl,
+                         ObjcMethodEntity_defn),
+        ObjcSelectorSlotEntity(ObjcSelectorSlotEntity,
+                               objcSelectorSlotEntity_objcMethod, objcSelectorSlotEntity_index),
+        Definition(Definition_EMPTY, Definition_record_,
+                   Definition_function_, Definition_enum_, Definition_objcMethod,
+                   Definition_objcContainer, Definition_variable,
+                   Definition_namespace_),
+        Entity(Entity_EMPTY, Entity_decl, Entity_defn, Entity_enumerator,
+               Entity_objcSelectorSlot),
+        DeclToDef_key(DeclToDef_key, declToDef_key_decl,
+                      declToDef_key_defn),
+        Annotations(Annotations_EMPTY, Annotations_attributes))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_cxx_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 89 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeCxx/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("DeclToDef", 4)]
+
+type DeclToDef_id = Glean.Id
+
+data DeclToDef = DeclToDef{declToDef_id ::
+                           {-# UNPACK #-} !DeclToDef_id,
+                           declToDef_key :: Prelude.Maybe DeclToDef_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclToDef where
+  toJSON (DeclToDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclToDef where
+  buildStruct _proxy (DeclToDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclToDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclToDef where
+  rnf (DeclToDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclToDef where
+  def = DeclToDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclToDef where
+  hashWithSalt __salt (DeclToDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SymbolId = Glean.Schema.Cxx1.USR
+
+data ObjcMethodEntity = ObjcMethodEntity_decl Glean.Schema.Cxx1.ObjcMethodDeclaration
+                      | ObjcMethodEntity_defn Glean.Schema.Cxx1.ObjcMethodDefinition
+                      | ObjcMethodEntity_EMPTY
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodEntity where
+  toJSON (ObjcMethodEntity_decl __decl)
+    = Aeson.object ["decl" .= __decl]
+  toJSON (ObjcMethodEntity_defn __defn)
+    = Aeson.object ["defn" .= __defn]
+  toJSON ObjcMethodEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ObjcMethodEntity where
+  buildStruct _proxy (ObjcMethodEntity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy (ObjcMethodEntity_defn __defn)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __defn)]
+  buildStruct _proxy ObjcMethodEntity_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcMethodEntity_decl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcMethodEntity_defn _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ObjcMethodEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return ObjcMethodEntity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1), ("defn", 2)]
+
+instance DeepSeq.NFData ObjcMethodEntity where
+  rnf (ObjcMethodEntity_decl __decl) = DeepSeq.rnf __decl
+  rnf (ObjcMethodEntity_defn __defn) = DeepSeq.rnf __defn
+  rnf ObjcMethodEntity_EMPTY = ()
+
+instance Default.Default ObjcMethodEntity where
+  def = ObjcMethodEntity_EMPTY
+
+instance Hashable.Hashable ObjcMethodEntity where
+  hashWithSalt __salt (ObjcMethodEntity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt (ObjcMethodEntity_defn _defn)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _defn)
+  hashWithSalt __salt ObjcMethodEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ObjcSelectorSlotEntity = ObjcSelectorSlotEntity{objcSelectorSlotEntity_objcMethod
+                                                     :: ObjcMethodEntity,
+                                                     objcSelectorSlotEntity_index :: Glean.Nat}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcSelectorSlotEntity where
+  toJSON (ObjcSelectorSlotEntity __field__objcMethod __field__index)
+    = Aeson.object
+        ("objcMethod" .= __field__objcMethod :
+           "index" .= Glean.unNat __field__index : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcSelectorSlotEntity where
+  buildStruct _proxy
+    (ObjcSelectorSlotEntity __field__objcMethod __field__index)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "objcMethod" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__objcMethod)
+           :
+           Thrift.genField _proxy "index" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__index)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__objcMethod <- ST.newSTRef Default.def
+            __field__index <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__objcMethod
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__index
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__objcMethod <- ST.readSTRef
+                                                                     __field__objcMethod
+                                             !__val__index <- ST.readSTRef __field__index
+                                             Prelude.pure
+                                               (ObjcSelectorSlotEntity __val__objcMethod
+                                                  __val__index)
+              _idMap = HashMap.fromList [("objcMethod", 1), ("index", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcSelectorSlotEntity where
+  rnf (ObjcSelectorSlotEntity __field__objcMethod __field__index)
+    = DeepSeq.rnf __field__objcMethod `Prelude.seq`
+        DeepSeq.rnf __field__index `Prelude.seq` ()
+
+instance Default.Default ObjcSelectorSlotEntity where
+  def = ObjcSelectorSlotEntity Default.def (Glean.Nat Default.def)
+
+instance Hashable.Hashable ObjcSelectorSlotEntity where
+  hashWithSalt __salt (ObjcSelectorSlotEntity _objcMethod _index)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _objcMethod)
+        _index
+
+data Definition = Definition_record_ Glean.Schema.Cxx1.RecordDefinition
+                | Definition_function_ Glean.Schema.Cxx1.FunctionDefinition
+                | Definition_enum_ Glean.Schema.Cxx1.EnumDefinition
+                | Definition_objcMethod Glean.Schema.Cxx1.ObjcMethodDefinition
+                | Definition_objcContainer Glean.Schema.Cxx1.ObjcContainerDefinition
+                | Definition_variable Glean.Schema.Cxx1.VariableDeclaration
+                | Definition_namespace_ Glean.Schema.Cxx1.NamespaceDefinition
+                | Definition_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition_record_ __record_)
+    = Aeson.object ["record_" .= __record_]
+  toJSON (Definition_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (Definition_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (Definition_objcMethod __objcMethod)
+    = Aeson.object ["objcMethod" .= __objcMethod]
+  toJSON (Definition_objcContainer __objcContainer)
+    = Aeson.object ["objcContainer" .= __objcContainer]
+  toJSON (Definition_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (Definition_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON Definition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition_record_ __record_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "record_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __record_)]
+  buildStruct _proxy (Definition_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (Definition_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (Definition_objcMethod __objcMethod)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcMethod" (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __objcMethod)]
+  buildStruct _proxy (Definition_objcContainer __objcContainer)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcContainer"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __objcContainer)]
+  buildStruct _proxy (Definition_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 6
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (Definition_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           7
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy Definition_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_record_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_function_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_enum_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_objcMethod _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_objcContainer _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_variable _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_namespace_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Definition_EMPTY
+           Thrift.FieldEnd -> Prelude.return Definition_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("record_", 1), ("function_", 2), ("enum_", 3), ("objcMethod", 4),
+             ("objcContainer", 5), ("variable", 6), ("namespace_", 7)]
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition_record_ __record_) = DeepSeq.rnf __record_
+  rnf (Definition_function_ __function_) = DeepSeq.rnf __function_
+  rnf (Definition_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (Definition_objcMethod __objcMethod) = DeepSeq.rnf __objcMethod
+  rnf (Definition_objcContainer __objcContainer)
+    = DeepSeq.rnf __objcContainer
+  rnf (Definition_variable __variable) = DeepSeq.rnf __variable
+  rnf (Definition_namespace_ __namespace_) = DeepSeq.rnf __namespace_
+  rnf Definition_EMPTY = ()
+
+instance Default.Default Definition where
+  def = Definition_EMPTY
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition_record_ _record_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _record_)
+  hashWithSalt __salt (Definition_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _function_)
+  hashWithSalt __salt (Definition_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _enum_)
+  hashWithSalt __salt (Definition_objcMethod _objcMethod)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _objcMethod)
+  hashWithSalt __salt (Definition_objcContainer _objcContainer)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _objcContainer)
+  hashWithSalt __salt (Definition_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _variable)
+  hashWithSalt __salt (Definition_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 7 _namespace_)
+  hashWithSalt __salt Definition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Entity = Entity_decl Glean.Schema.Cxx1.Declaration
+            | Entity_defn Definition
+            | Entity_enumerator Glean.Schema.Cxx1.Enumerator
+            | Entity_objcSelectorSlot ObjcSelectorSlotEntity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON (Entity_defn __defn) = Aeson.object ["defn" .= __defn]
+  toJSON (Entity_enumerator __enumerator)
+    = Aeson.object ["enumerator" .= __enumerator]
+  toJSON (Entity_objcSelectorSlot __objcSelectorSlot)
+    = Aeson.object ["objcSelectorSlot" .= __objcSelectorSlot]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy (Entity_defn __defn)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __defn)]
+  buildStruct _proxy (Entity_enumerator __enumerator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enumerator" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __enumerator)]
+  buildStruct _proxy (Entity_objcSelectorSlot __objcSelectorSlot)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcSelectorSlot"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __objcSelectorSlot)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_defn _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_enumerator _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Entity_objcSelectorSlot _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("decl", 1), ("defn", 2), ("enumerator", 3),
+             ("objcSelectorSlot", 4)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf (Entity_defn __defn) = DeepSeq.rnf __defn
+  rnf (Entity_enumerator __enumerator) = DeepSeq.rnf __enumerator
+  rnf (Entity_objcSelectorSlot __objcSelectorSlot)
+    = DeepSeq.rnf __objcSelectorSlot
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt (Entity_defn _defn)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _defn)
+  hashWithSalt __salt (Entity_enumerator _enumerator)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _enumerator)
+  hashWithSalt __salt (Entity_objcSelectorSlot _objcSelectorSlot)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _objcSelectorSlot)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclToDef_key = DeclToDef_key{declToDef_key_decl ::
+                                   Glean.Schema.Cxx1.Declaration,
+                                   declToDef_key_defn :: Definition}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclToDef_key where
+  toJSON (DeclToDef_key __field__decl __field__defn)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclToDef_key where
+  buildStruct _proxy (DeclToDef_key __field__decl __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure (DeclToDef_key __val__decl __val__defn)
+              _idMap = HashMap.fromList [("decl", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclToDef_key where
+  rnf (DeclToDef_key __field__decl __field__defn)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default DeclToDef_key where
+  def = DeclToDef_key Default.def Default.def
+
+instance Hashable.Hashable DeclToDef_key where
+  hashWithSalt __salt (DeclToDef_key _decl _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _defn
+
+data Annotations = Annotations_attributes [Glean.Schema.Cxx1.Attribute]
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_attributes __attributes)
+    = Aeson.object ["attributes" .= __attributes]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_attributes __attributes)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __attributes)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_attributes _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap = HashMap.fromList [("attributes", 1)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_attributes __attributes)
+    = DeepSeq.rnf __attributes
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_attributes _attributes)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _attributes)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.DeclToDef_key where
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.DeclToDef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodeCxx.Types.DeclToDef_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.DeclToDef_key" (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodeCxx.Types.DeclToDef_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "defn" (Glean.Schema.CodeCxx.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Predicate Glean.Schema.CodeCxx.Types.DeclToDef where
+  type KeyType Glean.Schema.CodeCxx.Types.DeclToDef =
+       Glean.Schema.CodeCxx.Types.DeclToDef_key
+  getName _proxy = Glean.PredicateRef "code.cxx.DeclToDef" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.CodeCxx.Types.declToDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodeCxx.Types.DeclToDef x k
+  getFactKey = Glean.Schema.CodeCxx.Types.declToDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.DeclToDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.ObjcMethodEntity
+         where
+  buildRtsValue b Glean.Schema.CodeCxx.Types.ObjcMethodEntity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.ObjcMethodEntity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.ObjcMethodEntity_defn x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeCxx.Types.ObjcMethodEntity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeCxx.Types.ObjcMethodEntity_decl,
+         Glean.mapD Glean.Schema.CodeCxx.Types.ObjcMethodEntity_defn]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.ObjcMethodEntity" (Prelude.Just 4))
+{-# LINE 60 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeCxx.Types.ObjcMethodEntity =
+     'Angle.TField "decl"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclaration)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDefinition)
+          ('Angle.TNoFields))
+{-# LINE 62 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.Annotations where
+  buildRtsValue b Glean.Schema.CodeCxx.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.Annotations_attributes x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeCxx.Types.Annotations_EMPTY)
+        [Glean.mapD Glean.Schema.CodeCxx.Types.Annotations_attributes]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.Annotations" (Prelude.Just 4))
+{-# LINE 74 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeCxx.Types.Annotations =
+     'Angle.TField "attributes" ([Glean.Schema.Cxx1.Types.Attribute])
+       ('Angle.TNoFields)
+{-# LINE 76 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodeCxx.Types.ObjcSelectorSlotEntity
+         where
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.ObjcSelectorSlotEntity x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodeCxx.Types.ObjcSelectorSlotEntity <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.ObjcSelectorSlotEntity"
+           (Prelude.Just 4))
+{-# LINE 85 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodeCxx.Types.ObjcSelectorSlotEntity
+     =
+     'Angle.TField "objcMethod"
+       (Glean.Schema.CodeCxx.Types.ObjcMethodEntity)
+       ('Angle.TField "index" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 87 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeCxx.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Entity_defn x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Entity_enumerator x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.Entity_objcSelectorSlot x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.CodeCxx.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeCxx.Types.Entity_decl,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Entity_defn,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Entity_enumerator,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Entity_objcSelectorSlot]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.Entity" (Prelude.Just 4))
+{-# LINE 111 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeCxx.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "defn" (Glean.Schema.CodeCxx.Types.Definition)
+          ('Angle.TField "enumerator"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Enumerator)
+             ('Angle.TField "objcSelectorSlot"
+                (Glean.Schema.CodeCxx.Types.ObjcSelectorSlotEntity)
+                ('Angle.TNoFields))))
+{-# LINE 113 "glean/schema/thrift/code_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeCxx.Types.Definition where
+  buildRtsValue b Glean.Schema.CodeCxx.Types.Definition_EMPTY
+    = Glean.buildRtsSelector b 7
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Definition_record_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Definition_function_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Definition_enum_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.Definition_objcMethod x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.Definition_objcContainer x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeCxx.Types.Definition_variable x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodeCxx.Types.Definition_namespace_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeCxx.Types.Definition_EMPTY)
+        [Glean.mapD Glean.Schema.CodeCxx.Types.Definition_record_,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_function_,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_enum_,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_objcMethod,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_objcContainer,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_variable,
+         Glean.mapD Glean.Schema.CodeCxx.Types.Definition_namespace_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.cxx.Definition" (Prelude.Just 4))
+{-# LINE 149 "glean/schema/thrift/code_cxx_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeCxx.Types.Definition
+     =
+     'Angle.TField "record_"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDefinition)
+       ('Angle.TField "function_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDefinition)
+          ('Angle.TField "enum_"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDefinition)
+             ('Angle.TField "objcMethod"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDefinition)
+                ('Angle.TField "objcContainer"
+                   (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDefinition)
+                   ('Angle.TField "variable"
+                      (Glean.KeyType Glean.Schema.Cxx1.Types.VariableDeclaration)
+                      ('Angle.TField "namespace_"
+                         (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDefinition)
+                         ('Angle.TNoFields)))))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeDataswarm/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeDataswarm/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeDataswarm/Types.hs
@@ -0,0 +1,141 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeDataswarm/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeDataswarm.Types
+       (pREDICATE_VERSIONS, Entity(Entity, entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Dataswarm.Types
+       as Glean.Schema.Dataswarm
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+import qualified Glean.Schema.Dataswarm.Types
+{-# LINE 72 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeDataswarm/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+newtype Entity = Entity{entity_decl ::
+                        Glean.Schema.Dataswarm.Declaration}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity __field__decl)
+    = Aeson.object ("decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (Entity __val__decl)
+              _idMap = HashMap.fromList [("decl", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity __field__decl)
+    = DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default Entity where
+  def = Entity Default.def
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity _decl)
+    = Hashable.hashWithSalt __salt _decl
+{-# LINE 18 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeDataswarm.Types.Entity where
+  buildRtsValue b (Glean.Schema.CodeDataswarm.Types.Entity x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.CodeDataswarm.Types.Entity <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.dataswarm.Entity" (Prelude.Just 1))
+{-# LINE 25 "glean/schema/thrift/code_dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodeDataswarm.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Dataswarm.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeErlang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeErlang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeErlang/Types.hs
@@ -0,0 +1,131 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_erlang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_erlang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_erlang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeErlang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeErlang.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Erlang.Types as Glean.Schema.Erlang
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_erlang_include.hs" #-}
+import qualified Glean.Schema.Erlang.Types
+{-# LINE 67 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeErlang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Erlang.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeErlang.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeErlang.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeErlang.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeErlang.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeErlang.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.erlang.Entity" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_erlang_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeErlang.Types.Entity
+     =
+     'Angle.TField "decl" (Glean.Schema.Erlang.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFbthrift/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFbthrift/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFbthrift/Types.hs
@@ -0,0 +1,209 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFbthrift/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeFbthrift.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl),
+        Annotations(Annotations_EMPTY, Annotations_annotations))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Fbthrift.Types
+       as Glean.Schema.Fbthrift
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+import qualified Glean.Schema.Fbthrift.Types
+{-# LINE 70 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFbthrift/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Fbthrift.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Annotations = Annotations_annotations [Glean.Schema.Fbthrift.StructuredAnnotation]
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_annotations __annotations)
+    = Aeson.object ["annotations" .= __annotations]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_annotations __annotations)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __annotations)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_annotations _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap = HashMap.fromList [("annotations", 1)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_annotations __annotations)
+    = DeepSeq.rnf __annotations
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_annotations _annotations)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _annotations)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeFbthrift.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeFbthrift.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeFbthrift.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeFbthrift.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeFbthrift.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.fbthrift.Entity" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeFbthrift.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TNoFields)
+{-# LINE 32 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeFbthrift.Types.Annotations
+         where
+  buildRtsValue b Glean.Schema.CodeFbthrift.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b
+    (Glean.Schema.CodeFbthrift.Types.Annotations_annotations x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeFbthrift.Types.Annotations_EMPTY)
+        [Glean.mapD
+           Glean.Schema.CodeFbthrift.Types.Annotations_annotations]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.fbthrift.Annotations" (Prelude.Just 1))
+{-# LINE 44 "glean/schema/thrift/code_fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeFbthrift.Types.Annotations =
+     'Angle.TField "annotations"
+       ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFlow/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFlow/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFlow/Types.hs
@@ -0,0 +1,152 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_flow_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_flow_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_flow_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFlow/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeFlow.Types
+       (pREDICATE_VERSIONS,
+        Entity(Entity_EMPTY, Entity_decl, Entity_module_))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Flow.Types as Glean.Schema.Flow
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_flow_include.hs" #-}
+import qualified Glean.Schema.Flow.Types
+{-# LINE 69 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeFlow/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Flow.SomeDeclaration
+            | Entity_module_ Glean.Schema.Flow.Module
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON (Entity_module_ __module_)
+    = Aeson.object ["module_" .= __module_]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy (Entity_module_ __module_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __module_)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_module_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1), ("module_", 2)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf (Entity_module_ __module_) = DeepSeq.rnf __module_
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt (Entity_module_ _module_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _module_)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_flow_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeFlow.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeFlow.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.CodeFlow.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeFlow.Types.Entity_module_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeFlow.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeFlow.Types.Entity_decl,
+         Glean.mapD Glean.Schema.CodeFlow.Types.Entity_module_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.flow.Entity" (Prelude.Just 2))
+{-# LINE 34 "glean/schema/thrift/code_flow_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeFlow.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "module_"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeGraphql/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeGraphql/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeGraphql/Types.hs
@@ -0,0 +1,131 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_graphql_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_graphql_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_graphql_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeGraphql/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeGraphql.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Graphql.Types as Glean.Schema.Graphql
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_graphql_include.hs" #-}
+import qualified Glean.Schema.Graphql.Types
+{-# LINE 67 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeGraphql/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Graphql.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeGraphql.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeGraphql.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeGraphql.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeGraphql.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeGraphql.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.graphql.Entity" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_graphql_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeGraphql.Types.Entity
+     =
+     'Angle.TField "decl" (Glean.Schema.Graphql.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHack/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHack/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHack/Types.hs
@@ -0,0 +1,208 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_hack_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_hack_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_hack_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHack/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeHack.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl),
+        CallArgument,
+        Annotations(Annotations_EMPTY, Annotations_attributes))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Hack.Types as Glean.Schema.Hack
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_hack_include.hs" #-}
+import qualified Glean.Schema.Hack.Types
+{-# LINE 70 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHack/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Hack.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+type CallArgument = Glean.Schema.Hack.CallArgument
+
+data Annotations = Annotations_attributes [Glean.Schema.Hack.UserAttribute]
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_attributes __attributes)
+    = Aeson.object ["attributes" .= __attributes]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_attributes __attributes)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __attributes)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_attributes _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap = HashMap.fromList [("attributes", 1)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_attributes __attributes)
+    = DeepSeq.rnf __attributes
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_attributes _attributes)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _attributes)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeHack.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeHack.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeHack.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeHack.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeHack.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.hack.Entity" (Prelude.Just 4))
+{-# LINE 30 "glean/schema/thrift/code_hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeHack.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TNoFields)
+{-# LINE 32 "glean/schema/thrift/code_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeHack.Types.Annotations where
+  buildRtsValue b Glean.Schema.CodeHack.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b
+    (Glean.Schema.CodeHack.Types.Annotations_attributes x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeHack.Types.Annotations_EMPTY)
+        [Glean.mapD Glean.Schema.CodeHack.Types.Annotations_attributes]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.hack.Annotations" (Prelude.Just 4))
+{-# LINE 44 "glean/schema/thrift/code_hack_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeHack.Types.Annotations =
+     'Angle.TField "attributes"
+       ([Glean.Schema.Hack.Types.UserAttribute])
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHs/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHs/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHs/Types.hs
@@ -0,0 +1,148 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_hs_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_hs_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_hs_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHs/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeHs.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_name, Entity_mod))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Hs.Types as Glean.Schema.Hs
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_hs_include.hs" #-}
+import qualified Glean.Schema.Hs.Types
+{-# LINE 68 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeHs/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_name Glean.Schema.Hs.Name
+            | Entity_mod Glean.Schema.Hs.Module
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_name __name) = Aeson.object ["name" .= __name]
+  toJSON (Entity_mod __mod) = Aeson.object ["mod" .= __mod]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_name __name)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __name)]
+  buildStruct _proxy (Entity_mod __mod)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "mod" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __mod)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_name _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_mod _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("name", 1), ("mod", 2)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_name __name) = DeepSeq.rnf __name
+  rnf (Entity_mod __mod) = DeepSeq.rnf __mod
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_name _name)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _name)
+  hashWithSalt __salt (Entity_mod _mod)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _mod)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_hs_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeHs.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeHs.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.CodeHs.Types.Entity_name x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeHs.Types.Entity_mod x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.CodeHs.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeHs.Types.Entity_name,
+         Glean.mapD Glean.Schema.CodeHs.Types.Entity_mod]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.hs.Entity" (Prelude.Just 2))
+{-# LINE 34 "glean/schema/thrift/code_hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeHs.Types.Entity =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "mod" (Glean.KeyType Glean.Schema.Hs.Types.Module)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeJava/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeJava/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeJava/Types.hs
@@ -0,0 +1,206 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_java_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_java_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_java_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeJava/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeJava.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl),
+        Annotations(Annotations_EMPTY, Annotations_annotations))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.JavaAlpha.Types
+       as Glean.Schema.JavaAlpha
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_java_include.hs" #-}
+import qualified Glean.Schema.JavaAlpha.Types
+{-# LINE 70 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeJava/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.JavaAlpha.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Annotations = Annotations_annotations [Glean.Schema.JavaAlpha.Annotation]
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_annotations __annotations)
+    = Aeson.object ["annotations" .= __annotations]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_annotations __annotations)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __annotations)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_annotations _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap = HashMap.fromList [("annotations", 1)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_annotations __annotations)
+    = DeepSeq.rnf __annotations
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_annotations _annotations)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _annotations)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_java_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeJava.Types.Annotations where
+  buildRtsValue b Glean.Schema.CodeJava.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b
+    (Glean.Schema.CodeJava.Types.Annotations_annotations x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeJava.Types.Annotations_EMPTY)
+        [Glean.mapD Glean.Schema.CodeJava.Types.Annotations_annotations]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.java.Annotations" (Prelude.Just 5))
+{-# LINE 30 "glean/schema/thrift/code_java_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodeJava.Types.Annotations =
+     'Angle.TField "annotations"
+       ([Glean.Schema.JavaAlpha.Types.Annotation])
+       ('Angle.TNoFields)
+{-# LINE 32 "glean/schema/thrift/code_java_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeJava.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeJava.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeJava.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeJava.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeJava.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.java.Entity" (Prelude.Just 5))
+{-# LINE 44 "glean/schema/thrift/code_java_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeJava.Types.Entity =
+     'Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeKotlin/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeKotlin/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeKotlin/Types.hs
@@ -0,0 +1,132 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_kotlin_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_kotlin_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_kotlin_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeKotlin/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeKotlin.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.KotlinAlpha.Types
+       as Glean.Schema.KotlinAlpha
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_kotlin_include.hs" #-}
+import qualified Glean.Schema.KotlinAlpha.Types
+{-# LINE 68 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeKotlin/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.KotlinAlpha.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_kotlin_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeKotlin.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeKotlin.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodeKotlin.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeKotlin.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeKotlin.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.kotlin.Entity" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_kotlin_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeKotlin.Types.Entity
+     =
+     'Angle.TField "decl" (Glean.Schema.KotlinAlpha.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeLsif/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeLsif/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeLsif/Types.hs
@@ -0,0 +1,347 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_lsif_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_lsif_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_lsif_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeLsif/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeLsif.Types
+       (pREDICATE_VERSIONS,
+        Entity(Entity_EMPTY, Entity_erlang, Entity_fsharp, Entity_go,
+               Entity_haskell, Entity_java, Entity_kotlin, Entity_ocaml,
+               Entity_python, Entity_rust, Entity_scala, Entity_swift,
+               Entity_typescript))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Lsif.Types as Glean.Schema.Lsif
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_lsif_include.hs" #-}
+import qualified Glean.Schema.Lsif.Types
+{-# LINE 72 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeLsif/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_erlang Glean.Schema.Lsif.SomeEntity
+            | Entity_fsharp Glean.Schema.Lsif.SomeEntity
+            | Entity_go Glean.Schema.Lsif.SomeEntity
+            | Entity_haskell Glean.Schema.Lsif.SomeEntity
+            | Entity_java Glean.Schema.Lsif.SomeEntity
+            | Entity_kotlin Glean.Schema.Lsif.SomeEntity
+            | Entity_ocaml Glean.Schema.Lsif.SomeEntity
+            | Entity_python Glean.Schema.Lsif.SomeEntity
+            | Entity_rust Glean.Schema.Lsif.SomeEntity
+            | Entity_scala Glean.Schema.Lsif.SomeEntity
+            | Entity_swift Glean.Schema.Lsif.SomeEntity
+            | Entity_typescript Glean.Schema.Lsif.SomeEntity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_erlang __erlang)
+    = Aeson.object ["erlang" .= __erlang]
+  toJSON (Entity_fsharp __fsharp)
+    = Aeson.object ["fsharp" .= __fsharp]
+  toJSON (Entity_go __go) = Aeson.object ["go" .= __go]
+  toJSON (Entity_haskell __haskell)
+    = Aeson.object ["haskell" .= __haskell]
+  toJSON (Entity_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Entity_kotlin __kotlin)
+    = Aeson.object ["kotlin" .= __kotlin]
+  toJSON (Entity_ocaml __ocaml) = Aeson.object ["ocaml" .= __ocaml]
+  toJSON (Entity_python __python)
+    = Aeson.object ["python" .= __python]
+  toJSON (Entity_rust __rust) = Aeson.object ["rust" .= __rust]
+  toJSON (Entity_scala __scala) = Aeson.object ["scala" .= __scala]
+  toJSON (Entity_swift __swift) = Aeson.object ["swift" .= __swift]
+  toJSON (Entity_typescript __typescript)
+    = Aeson.object ["typescript" .= __typescript]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_erlang __erlang)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "erlang" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __erlang)]
+  buildStruct _proxy (Entity_fsharp __fsharp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fsharp" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __fsharp)]
+  buildStruct _proxy (Entity_go __go)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "go" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __go)]
+  buildStruct _proxy (Entity_haskell __haskell)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "haskell" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __haskell)]
+  buildStruct _proxy (Entity_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Entity_kotlin __kotlin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "kotlin" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __kotlin)]
+  buildStruct _proxy (Entity_ocaml __ocaml)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ocaml" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __ocaml)]
+  buildStruct _proxy (Entity_python __python)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "python" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __python)]
+  buildStruct _proxy (Entity_rust __rust)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "rust" (Thrift.getStructType _proxy) 9 0
+           (Thrift.buildStruct _proxy __rust)]
+  buildStruct _proxy (Entity_scala __scala)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "scala" (Thrift.getStructType _proxy) 10 0
+           (Thrift.buildStruct _proxy __scala)]
+  buildStruct _proxy (Entity_swift __swift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "swift" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __swift)]
+  buildStruct _proxy (Entity_typescript __typescript)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typescript" (Thrift.getStructType _proxy)
+           12
+           0
+           (Thrift.buildStruct _proxy __typescript)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_erlang _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_fsharp _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_go _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_haskell _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_java _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_kotlin _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_ocaml _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_python _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_rust _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_scala _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_swift _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_typescript _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("erlang", 1), ("fsharp", 2), ("go", 3), ("haskell", 4),
+             ("java", 5), ("kotlin", 6), ("ocaml", 7), ("python", 8),
+             ("rust", 9), ("scala", 10), ("swift", 11), ("typescript", 12)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_erlang __erlang) = DeepSeq.rnf __erlang
+  rnf (Entity_fsharp __fsharp) = DeepSeq.rnf __fsharp
+  rnf (Entity_go __go) = DeepSeq.rnf __go
+  rnf (Entity_haskell __haskell) = DeepSeq.rnf __haskell
+  rnf (Entity_java __java) = DeepSeq.rnf __java
+  rnf (Entity_kotlin __kotlin) = DeepSeq.rnf __kotlin
+  rnf (Entity_ocaml __ocaml) = DeepSeq.rnf __ocaml
+  rnf (Entity_python __python) = DeepSeq.rnf __python
+  rnf (Entity_rust __rust) = DeepSeq.rnf __rust
+  rnf (Entity_scala __scala) = DeepSeq.rnf __scala
+  rnf (Entity_swift __swift) = DeepSeq.rnf __swift
+  rnf (Entity_typescript __typescript) = DeepSeq.rnf __typescript
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_erlang _erlang)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _erlang)
+  hashWithSalt __salt (Entity_fsharp _fsharp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _fsharp)
+  hashWithSalt __salt (Entity_go _go)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _go)
+  hashWithSalt __salt (Entity_haskell _haskell)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _haskell)
+  hashWithSalt __salt (Entity_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _java)
+  hashWithSalt __salt (Entity_kotlin _kotlin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _kotlin)
+  hashWithSalt __salt (Entity_ocaml _ocaml)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _ocaml)
+  hashWithSalt __salt (Entity_python _python)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _python)
+  hashWithSalt __salt (Entity_rust _rust)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _rust)
+  hashWithSalt __salt (Entity_scala _scala)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _scala)
+  hashWithSalt __salt (Entity_swift _swift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _swift)
+  hashWithSalt __salt (Entity_typescript _typescript)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 12 _typescript)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeLsif.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeLsif.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 12
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_erlang x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_fsharp x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_go x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_haskell x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_java x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_kotlin x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_ocaml x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_python x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_rust x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_scala x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_swift x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeLsif.Types.Entity_typescript x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeLsif.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeLsif.Types.Entity_erlang,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_fsharp,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_go,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_haskell,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_java,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_kotlin,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_ocaml,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_python,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_rust,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_scala,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_swift,
+         Glean.mapD Glean.Schema.CodeLsif.Types.Entity_typescript]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.lsif.Entity" (Prelude.Just 2))
+{-# LINE 74 "glean/schema/thrift/code_lsif_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeLsif.Types.Entity =
+     'Angle.TField "erlang" (Glean.Schema.Lsif.Types.SomeEntity)
+       ('Angle.TField "fsharp" (Glean.Schema.Lsif.Types.SomeEntity)
+          ('Angle.TField "go" (Glean.Schema.Lsif.Types.SomeEntity)
+             ('Angle.TField "haskell" (Glean.Schema.Lsif.Types.SomeEntity)
+                ('Angle.TField "java" (Glean.Schema.Lsif.Types.SomeEntity)
+                   ('Angle.TField "kotlin" (Glean.Schema.Lsif.Types.SomeEntity)
+                      ('Angle.TField "ocaml" (Glean.Schema.Lsif.Types.SomeEntity)
+                         ('Angle.TField "python" (Glean.Schema.Lsif.Types.SomeEntity)
+                            ('Angle.TField "rust" (Glean.Schema.Lsif.Types.SomeEntity)
+                               ('Angle.TField "scala" (Glean.Schema.Lsif.Types.SomeEntity)
+                                  ('Angle.TField "swift" (Glean.Schema.Lsif.Types.SomeEntity)
+                                     ('Angle.TField "typescript"
+                                        (Glean.Schema.Lsif.Types.SomeEntity)
+                                        ('Angle.TNoFields))))))))))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodePp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodePp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodePp/Types.hs
@@ -0,0 +1,176 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_pp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_pp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_pp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodePp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodePp.Types
+       (pREDICATE_VERSIONS,
+        Entity(Entity_EMPTY, Entity_define, Entity_undef, Entity_include_))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Pp1.Types as Glean.Schema.Pp1
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Schema.Pp1.Types
+{-# LINE 16 "glean/schema/thrift/code_pp_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 72 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodePp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_define Glean.Schema.Pp1.Define
+            | Entity_undef Glean.Schema.Pp1.Undef
+            | Entity_include_ Glean.Schema.Src.File
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_define __define)
+    = Aeson.object ["define" .= __define]
+  toJSON (Entity_undef __undef) = Aeson.object ["undef" .= __undef]
+  toJSON (Entity_include_ __include_)
+    = Aeson.object ["include_" .= __include_]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_define __define)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __define)]
+  buildStruct _proxy (Entity_undef __undef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "undef" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __undef)]
+  buildStruct _proxy (Entity_include_ __include_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "include_" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __include_)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_define _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_undef _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_include_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("define", 1), ("undef", 2), ("include_", 3)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_define __define) = DeepSeq.rnf __define
+  rnf (Entity_undef __undef) = DeepSeq.rnf __undef
+  rnf (Entity_include_ __include_) = DeepSeq.rnf __include_
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_define _define)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _define)
+  hashWithSalt __salt (Entity_undef _undef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _undef)
+  hashWithSalt __salt (Entity_include_ _include_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _include_)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 19 "glean/schema/thrift/code_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.CodePp.Types.Entity where
+  buildRtsValue b Glean.Schema.CodePp.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.CodePp.Types.Entity_define x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodePp.Types.Entity_undef x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodePp.Types.Entity_include_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.CodePp.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodePp.Types.Entity_define,
+         Glean.mapD Glean.Schema.CodePp.Types.Entity_undef,
+         Glean.mapD Glean.Schema.CodePp.Types.Entity_include_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.pp.Entity" (Prelude.Just 1))
+{-# LINE 39 "glean/schema/thrift/code_pp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodePp.Types.Entity =
+     'Angle.TField "define"
+       (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+       ('Angle.TField "undef" (Glean.KeyType Glean.Schema.Pp1.Types.Undef)
+          ('Angle.TField "include_"
+             (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodePython/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodePython/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodePython/Types.hs
@@ -0,0 +1,208 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_python_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_python_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_python_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodePython/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodePython.Types
+       (pREDICATE_VERSIONS, Entity(Entity_EMPTY, Entity_decl),
+        CallArgument,
+        Annotations(Annotations_EMPTY, Annotations_decorators))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Python.Types as Glean.Schema.Python
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_python_include.hs" #-}
+import qualified Glean.Schema.Python.Types
+{-# LINE 70 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodePython/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+data Entity = Entity_decl Glean.Schema.Python.Declaration
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_decl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_decl __decl) = DeepSeq.rnf __decl
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+type CallArgument = Glean.Schema.Python.CallArgument
+
+data Annotations = Annotations_decorators [Glean.Schema.Python.Decorator]
+                 | Annotations_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotations where
+  toJSON (Annotations_decorators __decorators)
+    = Aeson.object ["decorators" .= __decorators]
+  toJSON Annotations_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Annotations where
+  buildStruct _proxy (Annotations_decorators __decorators)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decorators" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __decorators)]
+  buildStruct _proxy Annotations_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseText _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Annotations_decorators _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Annotations_EMPTY
+           Thrift.FieldEnd -> Prelude.return Annotations_EMPTY
+    where
+      _idMap = HashMap.fromList [("decorators", 1)]
+
+instance DeepSeq.NFData Annotations where
+  rnf (Annotations_decorators __decorators)
+    = DeepSeq.rnf __decorators
+  rnf Annotations_EMPTY = ()
+
+instance Default.Default Annotations where
+  def = Annotations_EMPTY
+
+instance Hashable.Hashable Annotations where
+  hashWithSalt __salt (Annotations_decorators _decorators)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _decorators)
+  hashWithSalt __salt Annotations_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_python_include.hs" #-}
+instance Glean.Type Glean.Schema.CodePython.Types.Annotations where
+  buildRtsValue b Glean.Schema.CodePython.Types.Annotations_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b
+    (Glean.Schema.CodePython.Types.Annotations_decorators x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodePython.Types.Annotations_EMPTY)
+        [Glean.mapD Glean.Schema.CodePython.Types.Annotations_decorators]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.python.Annotations" (Prelude.Just 1))
+{-# LINE 30 "glean/schema/thrift/code_python_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodePython.Types.Annotations =
+     'Angle.TField "decorators" ([Glean.Schema.Python.Types.Decorator])
+       ('Angle.TNoFields)
+{-# LINE 32 "glean/schema/thrift/code_python_include.hs" #-}
+instance Glean.Type Glean.Schema.CodePython.Types.Entity where
+  buildRtsValue b Glean.Schema.CodePython.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.CodePython.Types.Entity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodePython.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodePython.Types.Entity_decl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.python.Entity" (Prelude.Just 1))
+{-# LINE 44 "glean/schema/thrift/code_python_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodePython.Types.Entity
+     =
+     'Angle.TField "decl" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodeScip/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeScip/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodeScip/Types.hs
@@ -0,0 +1,233 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/code_scip_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/code_scip_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/code_scip_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeScip/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodeScip.Types
+       (pREDICATE_VERSIONS, SymbolId,
+        Entity(Entity_EMPTY, Entity_rust, Entity_go, Entity_typescript,
+               Entity_java, Entity_kotlin, Entity_swift))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Scip.Types as Glean.Schema.Scip
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+{-# LINE 5 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/code_scip_include.hs" #-}
+import qualified Glean.Schema.Scip.Types
+{-# LINE 70 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodeScip/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList []
+
+type SymbolId = Glean.Schema.Scip.Symbol
+
+data Entity = Entity_rust Glean.Schema.Scip.SomeEntity
+            | Entity_go Glean.Schema.Scip.SomeEntity
+            | Entity_typescript Glean.Schema.Scip.SomeEntity
+            | Entity_java Glean.Schema.Scip.SomeEntity
+            | Entity_kotlin Glean.Schema.Scip.SomeEntity
+            | Entity_swift Glean.Schema.Scip.SomeEntity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_rust __rust) = Aeson.object ["rust" .= __rust]
+  toJSON (Entity_go __go) = Aeson.object ["go" .= __go]
+  toJSON (Entity_typescript __typescript)
+    = Aeson.object ["typescript" .= __typescript]
+  toJSON (Entity_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Entity_kotlin __kotlin)
+    = Aeson.object ["kotlin" .= __kotlin]
+  toJSON (Entity_swift __swift) = Aeson.object ["swift" .= __swift]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_rust __rust)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "rust" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __rust)]
+  buildStruct _proxy (Entity_go __go)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "go" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __go)]
+  buildStruct _proxy (Entity_typescript __typescript)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typescript" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __typescript)]
+  buildStruct _proxy (Entity_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Entity_kotlin __kotlin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "kotlin" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __kotlin)]
+  buildStruct _proxy (Entity_swift __swift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "swift" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __swift)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_rust _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_go _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_typescript _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_java _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_kotlin _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_swift _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("rust", 1), ("go", 2), ("typescript", 3), ("java", 4),
+             ("kotlin", 5), ("swift", 6)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_rust __rust) = DeepSeq.rnf __rust
+  rnf (Entity_go __go) = DeepSeq.rnf __go
+  rnf (Entity_typescript __typescript) = DeepSeq.rnf __typescript
+  rnf (Entity_java __java) = DeepSeq.rnf __java
+  rnf (Entity_kotlin __kotlin) = DeepSeq.rnf __kotlin
+  rnf (Entity_swift __swift) = DeepSeq.rnf __swift
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_rust _rust)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _rust)
+  hashWithSalt __salt (Entity_go _go)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _go)
+  hashWithSalt __salt (Entity_typescript _typescript)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _typescript)
+  hashWithSalt __salt (Entity_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _java)
+  hashWithSalt __salt (Entity_kotlin _kotlin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _kotlin)
+  hashWithSalt __salt (Entity_swift _swift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _swift)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/code_scip_include.hs" #-}
+instance Glean.Type Glean.Schema.CodeScip.Types.Entity where
+  buildRtsValue b Glean.Schema.CodeScip.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_rust x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_go x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_typescript x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_java x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_kotlin x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.CodeScip.Types.Entity_swift x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodeScip.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.CodeScip.Types.Entity_rust,
+         Glean.mapD Glean.Schema.CodeScip.Types.Entity_go,
+         Glean.mapD Glean.Schema.CodeScip.Types.Entity_typescript,
+         Glean.mapD Glean.Schema.CodeScip.Types.Entity_java,
+         Glean.mapD Glean.Schema.CodeScip.Types.Entity_kotlin,
+         Glean.mapD Glean.Schema.CodeScip.Types.Entity_swift]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "code.scip.Entity" (Prelude.Just 1))
+{-# LINE 50 "glean/schema/thrift/code_scip_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.CodeScip.Types.Entity =
+     'Angle.TField "rust" (Glean.Schema.Scip.Types.SomeEntity)
+       ('Angle.TField "go" (Glean.Schema.Scip.Types.SomeEntity)
+          ('Angle.TField "typescript" (Glean.Schema.Scip.Types.SomeEntity)
+             ('Angle.TField "java" (Glean.Schema.Scip.Types.SomeEntity)
+                ('Angle.TField "kotlin" (Glean.Schema.Scip.Types.SomeEntity)
+                   ('Angle.TField "swift" (Glean.Schema.Scip.Types.SomeEntity)
+                      ('Angle.TNoFields))))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Codemarkup/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Codemarkup/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Codemarkup/Types.hs
@@ -0,0 +1,8691 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Codemarkup/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Codemarkup.Types
+       (pREDICATE_VERSIONS, SymbolToEntity_id,
+        SymbolToEntity(SymbolToEntity, symbolToEntity_id,
+                       symbolToEntity_key),
+        ResolveLocation_id,
+        ResolveLocation(ResolveLocation, resolveLocation_id,
+                        resolveLocation_key),
+        ReferencingEntity_id,
+        ReferencingEntity(ReferencingEntity, referencingEntity_id,
+                          referencingEntity_key),
+        IndexedFile_id,
+        IndexedFile(IndexedFile, indexedFile_id, indexedFile_key),
+        GeneratedEntityToIdlEntity_id,
+        GeneratedEntityToIdlEntity(GeneratedEntityToIdlEntity,
+                                   generatedEntityToIdlEntity_id, generatedEntityToIdlEntity_key),
+        FindEntityDefinition_id,
+        FindEntityDefinition(FindEntityDefinition, findEntityDefinition_id,
+                             findEntityDefinition_key),
+        FileXRefsGenericEntities_id,
+        FileXRefsGenericEntities(FileXRefsGenericEntities,
+                                 fileXRefsGenericEntities_id, fileXRefsGenericEntities_key),
+        FileEntityXRefRangeSpans_id,
+        FileEntityXRefRangeSpans(FileEntityXRefRangeSpans,
+                                 fileEntityXRefRangeSpans_id, fileEntityXRefRangeSpans_key),
+        FileEntityXRefLocations_id,
+        FileEntityXRefLocations(FileEntityXRefLocations,
+                                fileEntityXRefLocations_id, fileEntityXRefLocations_key),
+        FileEntityXRefKinds_id,
+        FileEntityXRefKinds(FileEntityXRefKinds, fileEntityXRefKinds_id,
+                            fileEntityXRefKinds_key),
+        FileEntityXRefInfos_id,
+        FileEntityXRefInfos(FileEntityXRefInfos, fileEntityXRefInfos_id,
+                            fileEntityXRefInfos_key),
+        FileEntityLocations_id,
+        FileEntityLocations(FileEntityLocations, fileEntityLocations_id,
+                            fileEntityLocations_key),
+        FileEntityKinds_id,
+        FileEntityKinds(FileEntityKinds, fileEntityKinds_id,
+                        fileEntityKinds_key),
+        FileEntityInfos_id,
+        FileEntityInfos(FileEntityInfos, fileEntityInfos_id,
+                        fileEntityInfos_key),
+        FileEntityDigest_id,
+        FileEntityDigest(FileEntityDigest, fileEntityDigest_id,
+                         fileEntityDigest_key, fileEntityDigest_value),
+        FileCall_id, FileCall(FileCall, fileCall_id, fileCall_key),
+        ExtendsParentEntityConcise_id,
+        ExtendsParentEntityConcise(ExtendsParentEntityConcise,
+                                   extendsParentEntityConcise_id, extendsParentEntityConcise_key),
+        ExtendsParentEntity_id,
+        ExtendsParentEntity(ExtendsParentEntity, extendsParentEntity_id,
+                            extendsParentEntity_key),
+        ExtendsChildEntity_id,
+        ExtendsChildEntity(ExtendsChildEntity, extendsChildEntity_id,
+                           extendsChildEntity_key),
+        EntityVisibility_id,
+        EntityVisibility(EntityVisibility, entityVisibility_id,
+                         entityVisibility_key, entityVisibility_value),
+        EntityUses_id,
+        EntityUses(EntityUses, entityUses_id, entityUses_key),
+        EntityToAnnotations_id,
+        EntityToAnnotations(EntityToAnnotations, entityToAnnotations_id,
+                            entityToAnnotations_key),
+        EntitySource_id,
+        EntitySource(EntitySource, entitySource_id, entitySource_key),
+        EntityReferences_id,
+        EntityReferences(EntityReferences, entityReferences_id,
+                         entityReferences_key),
+        EntityModuleName_id,
+        EntityModuleName(EntityModuleName, entityModuleName_id,
+                         entityModuleName_key),
+        EntityModifiers_id,
+        EntityModifiers(EntityModifiers, entityModifiers_id,
+                        entityModifiers_key),
+        EntityLocation_id,
+        EntityLocation(EntityLocation, entityLocation_id,
+                       entityLocation_key),
+        EntityKind_id,
+        EntityKind(EntityKind, entityKind_id, entityKind_key),
+        EntityIsDefinition_id,
+        EntityIsDefinition(EntityIsDefinition, entityIsDefinition_id,
+                           entityIsDefinition_key),
+        EntityInfo_id,
+        EntityInfo(EntityInfo, entityInfo_id, entityInfo_key),
+        EntityDataAvailable_id,
+        EntityDataAvailable(EntityDataAvailable, entityDataAvailable_id,
+                            entityDataAvailable_key),
+        EntityComments_id,
+        EntityComments(EntityComments, entityComments_id,
+                       entityComments_key),
+        ContainsParentEntity_id,
+        ContainsParentEntity(ContainsParentEntity, containsParentEntity_id,
+                             containsParentEntity_key),
+        ContainsChildEntity_id,
+        ContainsChildEntity(ContainsChildEntity, containsChildEntity_id,
+                            containsChildEntity_key),
+        SearchInheritedEntities_id,
+        SearchInheritedEntities(SearchInheritedEntities,
+                                searchInheritedEntities_id, searchInheritedEntities_key),
+        SearchRelatedEntities_id,
+        SearchRelatedEntities(SearchRelatedEntities,
+                              searchRelatedEntities_id, searchRelatedEntities_key),
+        SymbolToEntity_key(SymbolToEntity_key, symbolToEntity_key_symbol,
+                           symbolToEntity_key_entity),
+        SearchStyle(SearchStyle_ShowAll, SearchStyle_HideUninteresting,
+                    SearchStyle__UNKNOWN),
+        ResolveLocation_key(ResolveLocation_key,
+                            resolveLocation_key_location, resolveLocation_key_entity),
+        RelationType(RelationType_ExtendsParentOfChild,
+                     RelationType_ExtendsChildOfParent,
+                     RelationType_ContainsChildOfParent,
+                     RelationType_ContainsParentOfChild,
+                     RelationType_RequireExtendsParentOfChild,
+                     RelationType_RequireImplementsParentOfChild,
+                     RelationType_RequireClassParentOfChild, RelationType__UNKNOWN),
+        ReferencingEntity_key(ReferencingEntity_key,
+                              referencingEntity_key_target, referencingEntity_key_referrer,
+                              referencingEntity_key_reference_file,
+                              referencingEntity_key_reference_range,
+                              referencingEntity_key_referrer_location),
+        ParentEntity(ParentEntity, parentEntity_parent,
+                     parentEntity_location),
+        GenericEntity_plainEntity_(GenericEntity_plainEntity_,
+                                   genericEntity_plainEntity__xref,
+                                   genericEntity_plainEntity__entity),
+        GenericEntity_xlangEntity_(GenericEntity_xlangEntity_,
+                                   genericEntity_xlangEntity__source,
+                                   genericEntity_xlangEntity__entity),
+        GenericEntity_xlangSymbol_(GenericEntity_xlangSymbol_,
+                                   genericEntity_xlangSymbol__source,
+                                   genericEntity_xlangSymbol__symbol),
+        GenericEntity(GenericEntity_EMPTY, GenericEntity_plainEntity,
+                      GenericEntity_xlangEntity, GenericEntity_xlangSymbol),
+        GeneratedEntityToIdlEntity_key(GeneratedEntityToIdlEntity_key,
+                                       generatedEntityToIdlEntity_key_entity,
+                                       generatedEntityToIdlEntity_key_idlEntity),
+        FindEntityDefinition_key(FindEntityDefinition_key,
+                                 findEntityDefinition_key_entity,
+                                 findEntityDefinition_key_definition),
+        FileXRefsGenericEntities_key(FileXRefsGenericEntities_key,
+                                     fileXRefsGenericEntities_key_file,
+                                     fileXRefsGenericEntities_key_genEntity),
+        FileEntityXRefRangeSpans_key(FileEntityXRefRangeSpans_key,
+                                     fileEntityXRefRangeSpans_key_file,
+                                     fileEntityXRefRangeSpans_key_location,
+                                     fileEntityXRefRangeSpans_key_entity),
+        FileEntityXRefLocations_key(FileEntityXRefLocations_key,
+                                    fileEntityXRefLocations_key_file,
+                                    fileEntityXRefLocations_key_xref,
+                                    fileEntityXRefLocations_key_entity),
+        FileEntityXRefKinds_key(FileEntityXRefKinds_key,
+                                fileEntityXRefKinds_key_file, fileEntityXRefKinds_key_entity,
+                                fileEntityXRefKinds_key_kind),
+        FileEntityXRefInfos_key(FileEntityXRefInfos_key,
+                                fileEntityXRefInfos_key_file, fileEntityXRefInfos_key_entity,
+                                fileEntityXRefInfos_key_info),
+        FileEntityLocations_key(FileEntityLocations_key,
+                                fileEntityLocations_key_file, fileEntityLocations_key_location,
+                                fileEntityLocations_key_entity),
+        FileEntityKinds_key(FileEntityKinds_key, fileEntityKinds_key_file,
+                            fileEntityKinds_key_entity, fileEntityKinds_key_kind),
+        FileEntityInfos_key(FileEntityInfos_key, fileEntityInfos_key_file,
+                            fileEntityInfos_key_entity, fileEntityInfos_key_info),
+        FileEntityDigest_key(FileEntityDigest_key,
+                             fileEntityDigest_key_file, fileEntityDigest_key_entity),
+        FileEntityDigest_value,
+        FileCall_key(FileCall_key, fileCall_key_file, fileCall_key_span,
+                     fileCall_key_arguments, fileCall_key_callee_xref,
+                     fileCall_key_dispatch_arg, fileCall_key_receiver_type),
+        ExtendsParentEntityConcise_key(ExtendsParentEntityConcise_key,
+                                       extendsParentEntityConcise_key_child,
+                                       extendsParentEntityConcise_key_parent),
+        ExtendsParentEntity_key(ExtendsParentEntity_key,
+                                extendsParentEntity_key_child, extendsParentEntity_key_parent),
+        ExtendsChildEntity_key(ExtendsChildEntity_key,
+                               extendsChildEntity_key_parent, extendsChildEntity_key_child),
+        EntityVisibility_value,
+        EntityUses_key(EntityUses_key, entityUses_key_target,
+                       entityUses_key_file, entityUses_key_span),
+        EntityToAnnotations_key(EntityToAnnotations_key,
+                                entityToAnnotations_key_entity,
+                                entityToAnnotations_key_annotations),
+        EntitySource_key(EntitySource_key, entitySource_key_target,
+                         entitySource_key_source),
+        EntityReferences_key(EntityReferences_key,
+                             entityReferences_key_target, entityReferences_key_file,
+                             entityReferences_key_range),
+        EntityModuleName_key(EntityModuleName_key,
+                             entityModuleName_key_entity, entityModuleName_key_name),
+        EntityModifiers_key(EntityModifiers_key,
+                            entityModifiers_key_entity, entityModifiers_key_modifiers),
+        EntityLocation_key(EntityLocation_key, entityLocation_key_entity,
+                           entityLocation_key_location),
+        EntityKind_key(EntityKind_key, entityKind_key_entity,
+                       entityKind_key_kind),
+        EntityInfo_key(EntityInfo_key, entityInfo_key_entity,
+                       entityInfo_key_info),
+        EntityComments_key(EntityComments_key, entityComments_key_entity,
+                           entityComments_key_file, entityComments_key_span,
+                           entityComments_key_text),
+        ContainsParentEntity_key(ContainsParentEntity_key,
+                                 containsParentEntity_key_child, containsParentEntity_key_parent),
+        ContainsChildEntity_key(ContainsChildEntity_key,
+                                containsChildEntity_key_parent, containsChildEntity_key_child),
+        ChildEntity(ChildEntity, childEntity_child, childEntity_location),
+        SearchInheritedEntities_key(SearchInheritedEntities_key,
+                                    searchInheritedEntities_key_base,
+                                    searchInheritedEntities_key_parent,
+                                    searchInheritedEntities_key_child,
+                                    searchInheritedEntities_key_style),
+        SearchRelatedEntities_key(SearchRelatedEntities_key,
+                                  searchRelatedEntities_key_query, searchRelatedEntities_key_parent,
+                                  searchRelatedEntities_key_child, searchRelatedEntities_key_style))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 296 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Codemarkup/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("ExtendsChildEntity", 30), ("ExtendsParentEntityConcise", 30),
+       ("FileCall", 30), ("GeneratedEntityToIdlEntity", 30),
+       ("SearchInheritedEntities", 30), ("ResolveLocation", 30),
+       ("EntityModifiers", 30), ("SymbolToEntity", 30),
+       ("SearchRelatedEntities", 30), ("ReferencingEntity", 30),
+       ("ContainsChildEntity", 30), ("ExtendsParentEntity", 30),
+       ("IndexedFile", 30), ("EntityInfo", 30), ("EntitySource", 30),
+       ("FileEntityXRefKinds", 30), ("EntityUses", 30),
+       ("FileEntityXRefInfos", 30), ("EntityToAnnotations", 30),
+       ("EntityReferences", 30), ("FileEntityLocations", 30),
+       ("EntityModuleName", 30), ("ContainsParentEntity", 30),
+       ("EntityLocation", 30), ("EntityComments", 30), ("EntityKind", 30),
+       ("FileEntityKinds", 30), ("EntityVisibility", 30),
+       ("FileEntityXRefRangeSpans", 30), ("FileEntityDigest", 30),
+       ("EntityIsDefinition", 30), ("FileEntityXRefLocations", 30),
+       ("FileEntityInfos", 30), ("FileXRefsGenericEntities", 30),
+       ("FindEntityDefinition", 30), ("EntityDataAvailable", 30)]
+
+type SymbolToEntity_id = Glean.Id
+
+data SymbolToEntity = SymbolToEntity{symbolToEntity_id ::
+                                     {-# UNPACK #-} !SymbolToEntity_id,
+                                     symbolToEntity_key :: Prelude.Maybe SymbolToEntity_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolToEntity where
+  toJSON (SymbolToEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolToEntity where
+  buildStruct _proxy (SymbolToEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolToEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolToEntity where
+  rnf (SymbolToEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolToEntity where
+  def = SymbolToEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolToEntity where
+  hashWithSalt __salt (SymbolToEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ResolveLocation_id = Glean.Id
+
+data ResolveLocation = ResolveLocation{resolveLocation_id ::
+                                       {-# UNPACK #-} !ResolveLocation_id,
+                                       resolveLocation_key :: Prelude.Maybe ResolveLocation_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation where
+  toJSON (ResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation where
+  buildStruct _proxy (ResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation where
+  rnf (ResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ResolveLocation where
+  def = ResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ResolveLocation where
+  hashWithSalt __salt (ResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ReferencingEntity_id = Glean.Id
+
+data ReferencingEntity = ReferencingEntity{referencingEntity_id ::
+                                           {-# UNPACK #-} !ReferencingEntity_id,
+                                           referencingEntity_key ::
+                                           Prelude.Maybe ReferencingEntity_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferencingEntity where
+  toJSON (ReferencingEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferencingEntity where
+  buildStruct _proxy (ReferencingEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ReferencingEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferencingEntity where
+  rnf (ReferencingEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ReferencingEntity where
+  def = ReferencingEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable ReferencingEntity where
+  hashWithSalt __salt (ReferencingEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IndexedFile_id = Glean.Id
+
+data IndexedFile = IndexedFile{indexedFile_id ::
+                               {-# UNPACK #-} !IndexedFile_id,
+                               indexedFile_key :: Prelude.Maybe Glean.Schema.Src.File}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexedFile where
+  toJSON (IndexedFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexedFile where
+  buildStruct _proxy (IndexedFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IndexedFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexedFile where
+  rnf (IndexedFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IndexedFile where
+  def = IndexedFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable IndexedFile where
+  hashWithSalt __salt (IndexedFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GeneratedEntityToIdlEntity_id = Glean.Id
+
+data GeneratedEntityToIdlEntity = GeneratedEntityToIdlEntity{generatedEntityToIdlEntity_id
+                                                             ::
+                                                             {-# UNPACK #-} !GeneratedEntityToIdlEntity_id,
+                                                             generatedEntityToIdlEntity_key ::
+                                                             Prelude.Maybe
+                                                               GeneratedEntityToIdlEntity_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GeneratedEntityToIdlEntity where
+  toJSON (GeneratedEntityToIdlEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GeneratedEntityToIdlEntity where
+  buildStruct _proxy
+    (GeneratedEntityToIdlEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GeneratedEntityToIdlEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GeneratedEntityToIdlEntity where
+  rnf (GeneratedEntityToIdlEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GeneratedEntityToIdlEntity where
+  def = GeneratedEntityToIdlEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable GeneratedEntityToIdlEntity where
+  hashWithSalt __salt (GeneratedEntityToIdlEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FindEntityDefinition_id = Glean.Id
+
+data FindEntityDefinition = FindEntityDefinition{findEntityDefinition_id
+                                                 :: {-# UNPACK #-} !FindEntityDefinition_id,
+                                                 findEntityDefinition_key ::
+                                                 Prelude.Maybe FindEntityDefinition_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FindEntityDefinition where
+  toJSON (FindEntityDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FindEntityDefinition where
+  buildStruct _proxy (FindEntityDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FindEntityDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FindEntityDefinition where
+  rnf (FindEntityDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FindEntityDefinition where
+  def = FindEntityDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable FindEntityDefinition where
+  hashWithSalt __salt (FindEntityDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefsGenericEntities_id = Glean.Id
+
+data FileXRefsGenericEntities = FileXRefsGenericEntities{fileXRefsGenericEntities_id
+                                                         ::
+                                                         {-# UNPACK #-} !FileXRefsGenericEntities_id,
+                                                         fileXRefsGenericEntities_key ::
+                                                         Prelude.Maybe FileXRefsGenericEntities_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefsGenericEntities where
+  toJSON (FileXRefsGenericEntities __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefsGenericEntities where
+  buildStruct _proxy
+    (FileXRefsGenericEntities __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FileXRefsGenericEntities __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefsGenericEntities where
+  rnf (FileXRefsGenericEntities __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefsGenericEntities where
+  def = FileXRefsGenericEntities Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefsGenericEntities where
+  hashWithSalt __salt (FileXRefsGenericEntities _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefRangeSpans_id = Glean.Id
+
+data FileEntityXRefRangeSpans = FileEntityXRefRangeSpans{fileEntityXRefRangeSpans_id
+                                                         ::
+                                                         {-# UNPACK #-} !FileEntityXRefRangeSpans_id,
+                                                         fileEntityXRefRangeSpans_key ::
+                                                         Prelude.Maybe FileEntityXRefRangeSpans_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefRangeSpans where
+  toJSON (FileEntityXRefRangeSpans __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefRangeSpans where
+  buildStruct _proxy
+    (FileEntityXRefRangeSpans __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FileEntityXRefRangeSpans __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefRangeSpans where
+  rnf (FileEntityXRefRangeSpans __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefRangeSpans where
+  def = FileEntityXRefRangeSpans Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefRangeSpans where
+  hashWithSalt __salt (FileEntityXRefRangeSpans _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefLocations_id = Glean.Id
+
+data FileEntityXRefLocations = FileEntityXRefLocations{fileEntityXRefLocations_id
+                                                       ::
+                                                       {-# UNPACK #-} !FileEntityXRefLocations_id,
+                                                       fileEntityXRefLocations_key ::
+                                                       Prelude.Maybe FileEntityXRefLocations_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocations where
+  toJSON (FileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocations where
+  buildStruct _proxy
+    (FileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocations where
+  rnf (FileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocations where
+  def = FileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefLocations where
+  hashWithSalt __salt (FileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefKinds_id = Glean.Id
+
+data FileEntityXRefKinds = FileEntityXRefKinds{fileEntityXRefKinds_id
+                                               :: {-# UNPACK #-} !FileEntityXRefKinds_id,
+                                               fileEntityXRefKinds_key ::
+                                               Prelude.Maybe FileEntityXRefKinds_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefKinds where
+  toJSON (FileEntityXRefKinds __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefKinds where
+  buildStruct _proxy (FileEntityXRefKinds __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityXRefKinds __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefKinds where
+  rnf (FileEntityXRefKinds __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefKinds where
+  def = FileEntityXRefKinds Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefKinds where
+  hashWithSalt __salt (FileEntityXRefKinds _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefInfos_id = Glean.Id
+
+data FileEntityXRefInfos = FileEntityXRefInfos{fileEntityXRefInfos_id
+                                               :: {-# UNPACK #-} !FileEntityXRefInfos_id,
+                                               fileEntityXRefInfos_key ::
+                                               Prelude.Maybe FileEntityXRefInfos_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefInfos where
+  toJSON (FileEntityXRefInfos __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefInfos where
+  buildStruct _proxy (FileEntityXRefInfos __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityXRefInfos __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefInfos where
+  rnf (FileEntityXRefInfos __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefInfos where
+  def = FileEntityXRefInfos Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefInfos where
+  hashWithSalt __salt (FileEntityXRefInfos _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityLocations_id = Glean.Id
+
+data FileEntityLocations = FileEntityLocations{fileEntityLocations_id
+                                               :: {-# UNPACK #-} !FileEntityLocations_id,
+                                               fileEntityLocations_key ::
+                                               Prelude.Maybe FileEntityLocations_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityLocations where
+  toJSON (FileEntityLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityLocations where
+  buildStruct _proxy (FileEntityLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityLocations where
+  rnf (FileEntityLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityLocations where
+  def = FileEntityLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityLocations where
+  hashWithSalt __salt (FileEntityLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityKinds_id = Glean.Id
+
+data FileEntityKinds = FileEntityKinds{fileEntityKinds_id ::
+                                       {-# UNPACK #-} !FileEntityKinds_id,
+                                       fileEntityKinds_key :: Prelude.Maybe FileEntityKinds_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityKinds where
+  toJSON (FileEntityKinds __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityKinds where
+  buildStruct _proxy (FileEntityKinds __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityKinds __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityKinds where
+  rnf (FileEntityKinds __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityKinds where
+  def = FileEntityKinds Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityKinds where
+  hashWithSalt __salt (FileEntityKinds _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityInfos_id = Glean.Id
+
+data FileEntityInfos = FileEntityInfos{fileEntityInfos_id ::
+                                       {-# UNPACK #-} !FileEntityInfos_id,
+                                       fileEntityInfos_key :: Prelude.Maybe FileEntityInfos_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityInfos where
+  toJSON (FileEntityInfos __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityInfos where
+  buildStruct _proxy (FileEntityInfos __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityInfos __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityInfos where
+  rnf (FileEntityInfos __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityInfos where
+  def = FileEntityInfos Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityInfos where
+  hashWithSalt __salt (FileEntityInfos _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityDigest_id = Glean.Id
+
+data FileEntityDigest = FileEntityDigest{fileEntityDigest_id ::
+                                         {-# UNPACK #-} !FileEntityDigest_id,
+                                         fileEntityDigest_key :: Prelude.Maybe FileEntityDigest_key,
+                                         fileEntityDigest_value ::
+                                         Prelude.Maybe FileEntityDigest_value}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityDigest where
+  toJSON (FileEntityDigest __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct FileEntityDigest where
+  buildStruct _proxy
+    (FileEntityDigest __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStringType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.genText _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (FileEntityDigest __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityDigest where
+  rnf (FileEntityDigest __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default FileEntityDigest where
+  def = FileEntityDigest Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable FileEntityDigest where
+  hashWithSalt __salt (FileEntityDigest _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type FileCall_id = Glean.Id
+
+data FileCall = FileCall{fileCall_id ::
+                         {-# UNPACK #-} !FileCall_id,
+                         fileCall_key :: Prelude.Maybe FileCall_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall where
+  toJSON (FileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileCall where
+  buildStruct _proxy (FileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall where
+  rnf (FileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileCall where
+  def = FileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileCall where
+  hashWithSalt __salt (FileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendsParentEntityConcise_id = Glean.Id
+
+data ExtendsParentEntityConcise = ExtendsParentEntityConcise{extendsParentEntityConcise_id
+                                                             ::
+                                                             {-# UNPACK #-} !ExtendsParentEntityConcise_id,
+                                                             extendsParentEntityConcise_key ::
+                                                             Prelude.Maybe
+                                                               ExtendsParentEntityConcise_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsParentEntityConcise where
+  toJSON (ExtendsParentEntityConcise __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsParentEntityConcise where
+  buildStruct _proxy
+    (ExtendsParentEntityConcise __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ExtendsParentEntityConcise __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsParentEntityConcise where
+  rnf (ExtendsParentEntityConcise __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendsParentEntityConcise where
+  def = ExtendsParentEntityConcise Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendsParentEntityConcise where
+  hashWithSalt __salt (ExtendsParentEntityConcise _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendsParentEntity_id = Glean.Id
+
+data ExtendsParentEntity = ExtendsParentEntity{extendsParentEntity_id
+                                               :: {-# UNPACK #-} !ExtendsParentEntity_id,
+                                               extendsParentEntity_key ::
+                                               Prelude.Maybe ExtendsParentEntity_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsParentEntity where
+  toJSON (ExtendsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsParentEntity where
+  buildStruct _proxy (ExtendsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExtendsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsParentEntity where
+  rnf (ExtendsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendsParentEntity where
+  def = ExtendsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendsParentEntity where
+  hashWithSalt __salt (ExtendsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendsChildEntity_id = Glean.Id
+
+data ExtendsChildEntity = ExtendsChildEntity{extendsChildEntity_id
+                                             :: {-# UNPACK #-} !ExtendsChildEntity_id,
+                                             extendsChildEntity_key ::
+                                             Prelude.Maybe ExtendsChildEntity_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsChildEntity where
+  toJSON (ExtendsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsChildEntity where
+  buildStruct _proxy (ExtendsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExtendsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsChildEntity where
+  rnf (ExtendsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendsChildEntity where
+  def = ExtendsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendsChildEntity where
+  hashWithSalt __salt (ExtendsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityVisibility_id = Glean.Id
+
+data EntityVisibility = EntityVisibility{entityVisibility_id ::
+                                         {-# UNPACK #-} !EntityVisibility_id,
+                                         entityVisibility_key ::
+                                         Prelude.Maybe Glean.Schema.Code.Entity,
+                                         entityVisibility_value ::
+                                         Prelude.Maybe EntityVisibility_value}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityVisibility where
+  toJSON (EntityVisibility __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct EntityVisibility where
+  buildStruct _proxy
+    (EntityVisibility __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getI32Type _proxy)
+                                         3
+                                         __id__key
+                                         ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                             Thrift.fromThriftEnum)
+                                            _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (EntityVisibility __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityVisibility where
+  rnf (EntityVisibility __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default EntityVisibility where
+  def = EntityVisibility Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable EntityVisibility where
+  hashWithSalt __salt (EntityVisibility _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type EntityUses_id = Glean.Id
+
+data EntityUses = EntityUses{entityUses_id ::
+                             {-# UNPACK #-} !EntityUses_id,
+                             entityUses_key :: Prelude.Maybe EntityUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses where
+  toJSON (EntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses where
+  buildStruct _proxy (EntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses where
+  rnf (EntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityUses where
+  def = EntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityUses where
+  hashWithSalt __salt (EntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityToAnnotations_id = Glean.Id
+
+data EntityToAnnotations = EntityToAnnotations{entityToAnnotations_id
+                                               :: {-# UNPACK #-} !EntityToAnnotations_id,
+                                               entityToAnnotations_key ::
+                                               Prelude.Maybe EntityToAnnotations_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityToAnnotations where
+  toJSON (EntityToAnnotations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityToAnnotations where
+  buildStruct _proxy (EntityToAnnotations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityToAnnotations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityToAnnotations where
+  rnf (EntityToAnnotations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityToAnnotations where
+  def = EntityToAnnotations Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityToAnnotations where
+  hashWithSalt __salt (EntityToAnnotations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntitySource_id = Glean.Id
+
+data EntitySource = EntitySource{entitySource_id ::
+                                 {-# UNPACK #-} !EntitySource_id,
+                                 entitySource_key :: Prelude.Maybe EntitySource_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntitySource where
+  toJSON (EntitySource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntitySource where
+  buildStruct _proxy (EntitySource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntitySource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntitySource where
+  rnf (EntitySource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntitySource where
+  def = EntitySource Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntitySource where
+  hashWithSalt __salt (EntitySource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityReferences_id = Glean.Id
+
+data EntityReferences = EntityReferences{entityReferences_id ::
+                                         {-# UNPACK #-} !EntityReferences_id,
+                                         entityReferences_key :: Prelude.Maybe EntityReferences_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityReferences where
+  toJSON (EntityReferences __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityReferences where
+  buildStruct _proxy (EntityReferences __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityReferences __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityReferences where
+  rnf (EntityReferences __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityReferences where
+  def = EntityReferences Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityReferences where
+  hashWithSalt __salt (EntityReferences _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityModuleName_id = Glean.Id
+
+data EntityModuleName = EntityModuleName{entityModuleName_id ::
+                                         {-# UNPACK #-} !EntityModuleName_id,
+                                         entityModuleName_key :: Prelude.Maybe EntityModuleName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityModuleName where
+  toJSON (EntityModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityModuleName where
+  buildStruct _proxy (EntityModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityModuleName where
+  rnf (EntityModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityModuleName where
+  def = EntityModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityModuleName where
+  hashWithSalt __salt (EntityModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityModifiers_id = Glean.Id
+
+data EntityModifiers = EntityModifiers{entityModifiers_id ::
+                                       {-# UNPACK #-} !EntityModifiers_id,
+                                       entityModifiers_key :: Prelude.Maybe EntityModifiers_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityModifiers where
+  toJSON (EntityModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityModifiers where
+  buildStruct _proxy (EntityModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityModifiers where
+  rnf (EntityModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityModifiers where
+  def = EntityModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityModifiers where
+  hashWithSalt __salt (EntityModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLocation_id = Glean.Id
+
+data EntityLocation = EntityLocation{entityLocation_id ::
+                                     {-# UNPACK #-} !EntityLocation_id,
+                                     entityLocation_key :: Prelude.Maybe EntityLocation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation where
+  toJSON (EntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation where
+  buildStruct _proxy (EntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation where
+  rnf (EntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLocation where
+  def = EntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLocation where
+  hashWithSalt __salt (EntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityKind_id = Glean.Id
+
+data EntityKind = EntityKind{entityKind_id ::
+                             {-# UNPACK #-} !EntityKind_id,
+                             entityKind_key :: Prelude.Maybe EntityKind_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind where
+  toJSON (EntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind where
+  buildStruct _proxy (EntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind where
+  rnf (EntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityKind where
+  def = EntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityKind where
+  hashWithSalt __salt (EntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityIsDefinition_id = Glean.Id
+
+data EntityIsDefinition = EntityIsDefinition{entityIsDefinition_id
+                                             :: {-# UNPACK #-} !EntityIsDefinition_id,
+                                             entityIsDefinition_key ::
+                                             Prelude.Maybe Glean.Schema.Code.Entity}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityIsDefinition where
+  toJSON (EntityIsDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityIsDefinition where
+  buildStruct _proxy (EntityIsDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityIsDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityIsDefinition where
+  rnf (EntityIsDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityIsDefinition where
+  def = EntityIsDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityIsDefinition where
+  hashWithSalt __salt (EntityIsDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityInfo_id = Glean.Id
+
+data EntityInfo = EntityInfo{entityInfo_id ::
+                             {-# UNPACK #-} !EntityInfo_id,
+                             entityInfo_key :: Prelude.Maybe EntityInfo_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo where
+  toJSON (EntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo where
+  buildStruct _proxy (EntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo where
+  rnf (EntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityInfo where
+  def = EntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityInfo where
+  hashWithSalt __salt (EntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityDataAvailable_id = Glean.Id
+
+data EntityDataAvailable = EntityDataAvailable{entityDataAvailable_id
+                                               :: {-# UNPACK #-} !EntityDataAvailable_id,
+                                               entityDataAvailable_key ::
+                                               Prelude.Maybe Glean.Schema.Src.File}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityDataAvailable where
+  toJSON (EntityDataAvailable __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityDataAvailable where
+  buildStruct _proxy (EntityDataAvailable __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityDataAvailable __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityDataAvailable where
+  rnf (EntityDataAvailable __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityDataAvailable where
+  def = EntityDataAvailable Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityDataAvailable where
+  hashWithSalt __salt (EntityDataAvailable _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityComments_id = Glean.Id
+
+data EntityComments = EntityComments{entityComments_id ::
+                                     {-# UNPACK #-} !EntityComments_id,
+                                     entityComments_key :: Prelude.Maybe EntityComments_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityComments where
+  toJSON (EntityComments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityComments where
+  buildStruct _proxy (EntityComments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityComments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityComments where
+  rnf (EntityComments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityComments where
+  def = EntityComments Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityComments where
+  hashWithSalt __salt (EntityComments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainsParentEntity_id = Glean.Id
+
+data ContainsParentEntity = ContainsParentEntity{containsParentEntity_id
+                                                 :: {-# UNPACK #-} !ContainsParentEntity_id,
+                                                 containsParentEntity_key ::
+                                                 Prelude.Maybe ContainsParentEntity_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsParentEntity where
+  toJSON (ContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsParentEntity where
+  buildStruct _proxy (ContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsParentEntity where
+  rnf (ContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainsParentEntity where
+  def = ContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainsParentEntity where
+  hashWithSalt __salt (ContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainsChildEntity_id = Glean.Id
+
+data ContainsChildEntity = ContainsChildEntity{containsChildEntity_id
+                                               :: {-# UNPACK #-} !ContainsChildEntity_id,
+                                               containsChildEntity_key ::
+                                               Prelude.Maybe ContainsChildEntity_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsChildEntity where
+  toJSON (ContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsChildEntity where
+  buildStruct _proxy (ContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsChildEntity where
+  rnf (ContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainsChildEntity where
+  def = ContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainsChildEntity where
+  hashWithSalt __salt (ContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInheritedEntities_id = Glean.Id
+
+data SearchInheritedEntities = SearchInheritedEntities{searchInheritedEntities_id
+                                                       ::
+                                                       {-# UNPACK #-} !SearchInheritedEntities_id,
+                                                       searchInheritedEntities_key ::
+                                                       Prelude.Maybe SearchInheritedEntities_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInheritedEntities where
+  toJSON (SearchInheritedEntities __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInheritedEntities where
+  buildStruct _proxy
+    (SearchInheritedEntities __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInheritedEntities __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInheritedEntities where
+  rnf (SearchInheritedEntities __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInheritedEntities where
+  def = SearchInheritedEntities Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInheritedEntities where
+  hashWithSalt __salt (SearchInheritedEntities _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchRelatedEntities_id = Glean.Id
+
+data SearchRelatedEntities = SearchRelatedEntities{searchRelatedEntities_id
+                                                   :: {-# UNPACK #-} !SearchRelatedEntities_id,
+                                                   searchRelatedEntities_key ::
+                                                   Prelude.Maybe SearchRelatedEntities_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchRelatedEntities where
+  toJSON (SearchRelatedEntities __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchRelatedEntities where
+  buildStruct _proxy (SearchRelatedEntities __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchRelatedEntities __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchRelatedEntities where
+  rnf (SearchRelatedEntities __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchRelatedEntities where
+  def = SearchRelatedEntities Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchRelatedEntities where
+  hashWithSalt __salt (SearchRelatedEntities _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SymbolToEntity_key = SymbolToEntity_key{symbolToEntity_key_symbol
+                                             :: Glean.Schema.Code.SymbolId,
+                                             symbolToEntity_key_entity :: Glean.Schema.Code.Entity}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolToEntity_key where
+  toJSON (SymbolToEntity_key __field__symbol __field__entity)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolToEntity_key where
+  buildStruct _proxy
+    (SymbolToEntity_key __field__symbol __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SymbolToEntity_key __val__symbol __val__entity)
+              _idMap = HashMap.fromList [("symbol", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolToEntity_key where
+  rnf (SymbolToEntity_key __field__symbol __field__entity)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SymbolToEntity_key where
+  def = SymbolToEntity_key Default.def Default.def
+
+instance Hashable.Hashable SymbolToEntity_key where
+  hashWithSalt __salt (SymbolToEntity_key _symbol _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _entity
+
+data SearchStyle = SearchStyle_ShowAll
+                 | SearchStyle_HideUninteresting
+                 | SearchStyle__UNKNOWN Prelude.Int
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchStyle where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData SearchStyle where
+  rnf __SearchStyle = Prelude.seq __SearchStyle ()
+
+instance Default.Default SearchStyle where
+  def = SearchStyle_ShowAll
+
+instance Hashable.Hashable SearchStyle where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum SearchStyle where
+  toThriftEnum 0 = SearchStyle_ShowAll
+  toThriftEnum 1 = SearchStyle_HideUninteresting
+  toThriftEnum val = SearchStyle__UNKNOWN val
+  fromThriftEnum SearchStyle_ShowAll = 0
+  fromThriftEnum SearchStyle_HideUninteresting = 1
+  fromThriftEnum (SearchStyle__UNKNOWN val) = val
+  allThriftEnumValues
+    = [SearchStyle_ShowAll, SearchStyle_HideUninteresting]
+  toThriftEnumEither 0 = Prelude.Right SearchStyle_ShowAll
+  toThriftEnumEither 1 = Prelude.Right SearchStyle_HideUninteresting
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum SearchStyle: "
+           ++ Prelude.show val)
+
+data ResolveLocation_key = ResolveLocation_key{resolveLocation_key_location
+                                               :: Glean.Schema.CodemarkupTypes.Location,
+                                               resolveLocation_key_entity ::
+                                               Glean.Schema.Code.Entity}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation_key where
+  toJSON (ResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation_key where
+  buildStruct _proxy
+    (ResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ResolveLocation_key __val__location __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation_key where
+  rnf (ResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ResolveLocation_key where
+  def = ResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable ResolveLocation_key where
+  hashWithSalt __salt (ResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data RelationType = RelationType_ExtendsParentOfChild
+                  | RelationType_ExtendsChildOfParent
+                  | RelationType_ContainsChildOfParent
+                  | RelationType_ContainsParentOfChild
+                  | RelationType_RequireExtendsParentOfChild
+                  | RelationType_RequireImplementsParentOfChild
+                  | RelationType_RequireClassParentOfChild
+                  | RelationType__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelationType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RelationType where
+  rnf __RelationType = Prelude.seq __RelationType ()
+
+instance Default.Default RelationType where
+  def = RelationType_ExtendsParentOfChild
+
+instance Hashable.Hashable RelationType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RelationType where
+  toThriftEnum 0 = RelationType_ExtendsParentOfChild
+  toThriftEnum 1 = RelationType_ExtendsChildOfParent
+  toThriftEnum 2 = RelationType_ContainsChildOfParent
+  toThriftEnum 3 = RelationType_ContainsParentOfChild
+  toThriftEnum 4 = RelationType_RequireExtendsParentOfChild
+  toThriftEnum 5 = RelationType_RequireImplementsParentOfChild
+  toThriftEnum 6 = RelationType_RequireClassParentOfChild
+  toThriftEnum val = RelationType__UNKNOWN val
+  fromThriftEnum RelationType_ExtendsParentOfChild = 0
+  fromThriftEnum RelationType_ExtendsChildOfParent = 1
+  fromThriftEnum RelationType_ContainsChildOfParent = 2
+  fromThriftEnum RelationType_ContainsParentOfChild = 3
+  fromThriftEnum RelationType_RequireExtendsParentOfChild = 4
+  fromThriftEnum RelationType_RequireImplementsParentOfChild = 5
+  fromThriftEnum RelationType_RequireClassParentOfChild = 6
+  fromThriftEnum (RelationType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RelationType_ExtendsParentOfChild,
+       RelationType_ExtendsChildOfParent,
+       RelationType_ContainsChildOfParent,
+       RelationType_ContainsParentOfChild,
+       RelationType_RequireExtendsParentOfChild,
+       RelationType_RequireImplementsParentOfChild,
+       RelationType_RequireClassParentOfChild]
+  toThriftEnumEither 0
+    = Prelude.Right RelationType_ExtendsParentOfChild
+  toThriftEnumEither 1
+    = Prelude.Right RelationType_ExtendsChildOfParent
+  toThriftEnumEither 2
+    = Prelude.Right RelationType_ContainsChildOfParent
+  toThriftEnumEither 3
+    = Prelude.Right RelationType_ContainsParentOfChild
+  toThriftEnumEither 4
+    = Prelude.Right RelationType_RequireExtendsParentOfChild
+  toThriftEnumEither 5
+    = Prelude.Right RelationType_RequireImplementsParentOfChild
+  toThriftEnumEither 6
+    = Prelude.Right RelationType_RequireClassParentOfChild
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RelationType: "
+           ++ Prelude.show val)
+
+data ReferencingEntity_key = ReferencingEntity_key{referencingEntity_key_target
+                                                   :: Glean.Schema.Code.Entity,
+                                                   referencingEntity_key_referrer ::
+                                                   Glean.Schema.Code.Entity,
+                                                   referencingEntity_key_reference_file ::
+                                                   Glean.Schema.Src.File,
+                                                   referencingEntity_key_reference_range ::
+                                                   Glean.Schema.CodemarkupTypes.RangeSpan,
+                                                   referencingEntity_key_referrer_location ::
+                                                   Glean.Schema.CodemarkupTypes.Location}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferencingEntity_key where
+  toJSON
+    (ReferencingEntity_key __field__target __field__referrer
+       __field__reference_file __field__reference_range
+       __field__referrer_location)
+    = Aeson.object
+        ("target" .= __field__target :
+           "referrer" .= __field__referrer :
+             "reference_file" .= __field__reference_file :
+               "reference_range" .= __field__reference_range :
+                 "referrer_location" .= __field__referrer_location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferencingEntity_key where
+  buildStruct _proxy
+    (ReferencingEntity_key __field__target __field__referrer
+       __field__reference_file __field__reference_range
+       __field__referrer_location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "referrer" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__referrer)
+             :
+             Thrift.genField _proxy "reference_file"
+               (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__reference_file)
+               :
+               Thrift.genField _proxy "reference_range"
+                 (Thrift.getStructType _proxy)
+                 4
+                 3
+                 (Thrift.buildStruct _proxy __field__reference_range)
+                 :
+                 Thrift.genField _proxy "referrer_location"
+                   (Thrift.getStructType _proxy)
+                   5
+                   4
+                   (Thrift.buildStruct _proxy __field__referrer_location)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__referrer <- ST.newSTRef Default.def
+            __field__reference_file <- ST.newSTRef Default.def
+            __field__reference_range <- ST.newSTRef Default.def
+            __field__referrer_location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__referrer
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reference_file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reference_range
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__referrer_location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__referrer <- ST.readSTRef __field__referrer
+                                             !__val__reference_file <- ST.readSTRef
+                                                                         __field__reference_file
+                                             !__val__reference_range <- ST.readSTRef
+                                                                          __field__reference_range
+                                             !__val__referrer_location <- ST.readSTRef
+                                                                            __field__referrer_location
+                                             Prelude.pure
+                                               (ReferencingEntity_key __val__target __val__referrer
+                                                  __val__reference_file
+                                                  __val__reference_range
+                                                  __val__referrer_location)
+              _idMap
+                = HashMap.fromList
+                    [("target", 1), ("referrer", 2), ("reference_file", 3),
+                     ("reference_range", 4), ("referrer_location", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferencingEntity_key where
+  rnf
+    (ReferencingEntity_key __field__target __field__referrer
+       __field__reference_file __field__reference_range
+       __field__referrer_location)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__referrer `Prelude.seq`
+          DeepSeq.rnf __field__reference_file `Prelude.seq`
+            DeepSeq.rnf __field__reference_range `Prelude.seq`
+              DeepSeq.rnf __field__referrer_location `Prelude.seq` ()
+
+instance Default.Default ReferencingEntity_key where
+  def
+    = ReferencingEntity_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable ReferencingEntity_key where
+  hashWithSalt __salt
+    (ReferencingEntity_key _target _referrer _reference_file
+       _reference_range _referrer_location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+                 _referrer)
+              _reference_file)
+           _reference_range)
+        _referrer_location
+
+data ParentEntity = ParentEntity{parentEntity_parent ::
+                                 Glean.Schema.Code.Entity,
+                                 parentEntity_location :: Glean.Schema.CodemarkupTypes.Location}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParentEntity where
+  toJSON (ParentEntity __field__parent __field__location)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ParentEntity where
+  buildStruct _proxy (ParentEntity __field__parent __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ParentEntity __val__parent __val__location)
+              _idMap = HashMap.fromList [("parent", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParentEntity where
+  rnf (ParentEntity __field__parent __field__location)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ParentEntity where
+  def = ParentEntity Default.def Default.def
+
+instance Hashable.Hashable ParentEntity where
+  hashWithSalt __salt (ParentEntity _parent _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _location
+
+data GenericEntity_plainEntity_ = GenericEntity_plainEntity_{genericEntity_plainEntity__xref
+                                                             ::
+                                                             Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                             genericEntity_plainEntity__entity ::
+                                                             Glean.Schema.Code.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenericEntity_plainEntity_ where
+  toJSON (GenericEntity_plainEntity_ __field__xref __field__entity)
+    = Aeson.object
+        ("xref" .= __field__xref :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GenericEntity_plainEntity_ where
+  buildStruct _proxy
+    (GenericEntity_plainEntity_ __field__xref __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__xref)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GenericEntity_plainEntity_ __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("xref", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GenericEntity_plainEntity_ where
+  rnf (GenericEntity_plainEntity_ __field__xref __field__entity)
+    = DeepSeq.rnf __field__xref `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GenericEntity_plainEntity_ where
+  def = GenericEntity_plainEntity_ Default.def Default.def
+
+instance Hashable.Hashable GenericEntity_plainEntity_ where
+  hashWithSalt __salt (GenericEntity_plainEntity_ _xref _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xref)
+        _entity
+
+data GenericEntity_xlangEntity_ = GenericEntity_xlangEntity_{genericEntity_xlangEntity__source
+                                                             ::
+                                                             Glean.Schema.CodemarkupTypes.RangeSpan,
+                                                             genericEntity_xlangEntity__entity ::
+                                                             Glean.Schema.Code.IdlEntity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenericEntity_xlangEntity_ where
+  toJSON (GenericEntity_xlangEntity_ __field__source __field__entity)
+    = Aeson.object
+        ("source" .= __field__source :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GenericEntity_xlangEntity_ where
+  buildStruct _proxy
+    (GenericEntity_xlangEntity_ __field__source __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GenericEntity_xlangEntity_ __val__source
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("source", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GenericEntity_xlangEntity_ where
+  rnf (GenericEntity_xlangEntity_ __field__source __field__entity)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GenericEntity_xlangEntity_ where
+  def = GenericEntity_xlangEntity_ Default.def Default.def
+
+instance Hashable.Hashable GenericEntity_xlangEntity_ where
+  hashWithSalt __salt (GenericEntity_xlangEntity_ _source _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _entity
+
+data GenericEntity_xlangSymbol_ = GenericEntity_xlangSymbol_{genericEntity_xlangSymbol__source
+                                                             ::
+                                                             Glean.Schema.CodemarkupTypes.RangeSpan,
+                                                             genericEntity_xlangSymbol__symbol ::
+                                                             Glean.Schema.Code.SymbolId}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenericEntity_xlangSymbol_ where
+  toJSON (GenericEntity_xlangSymbol_ __field__source __field__symbol)
+    = Aeson.object
+        ("source" .= __field__source :
+           "symbol" .= __field__symbol : Prelude.mempty)
+
+instance Thrift.ThriftStruct GenericEntity_xlangSymbol_ where
+  buildStruct _proxy
+    (GenericEntity_xlangSymbol_ __field__source __field__symbol)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__symbol)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__symbol <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__symbol <- ST.readSTRef __field__symbol
+                                             Prelude.pure
+                                               (GenericEntity_xlangSymbol_ __val__source
+                                                  __val__symbol)
+              _idMap = HashMap.fromList [("source", 1), ("symbol", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GenericEntity_xlangSymbol_ where
+  rnf (GenericEntity_xlangSymbol_ __field__source __field__symbol)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__symbol `Prelude.seq` ()
+
+instance Default.Default GenericEntity_xlangSymbol_ where
+  def = GenericEntity_xlangSymbol_ Default.def Default.def
+
+instance Hashable.Hashable GenericEntity_xlangSymbol_ where
+  hashWithSalt __salt (GenericEntity_xlangSymbol_ _source _symbol)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _symbol
+
+data GenericEntity = GenericEntity_plainEntity GenericEntity_plainEntity_
+                   | GenericEntity_xlangEntity GenericEntity_xlangEntity_
+                   | GenericEntity_xlangSymbol GenericEntity_xlangSymbol_
+                   | GenericEntity_EMPTY
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenericEntity where
+  toJSON (GenericEntity_plainEntity __plainEntity)
+    = Aeson.object ["plainEntity" .= __plainEntity]
+  toJSON (GenericEntity_xlangEntity __xlangEntity)
+    = Aeson.object ["xlangEntity" .= __xlangEntity]
+  toJSON (GenericEntity_xlangSymbol __xlangSymbol)
+    = Aeson.object ["xlangSymbol" .= __xlangSymbol]
+  toJSON GenericEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct GenericEntity where
+  buildStruct _proxy (GenericEntity_plainEntity __plainEntity)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "plainEntity" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __plainEntity)]
+  buildStruct _proxy (GenericEntity_xlangEntity __xlangEntity)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "xlangEntity" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __xlangEntity)]
+  buildStruct _proxy (GenericEntity_xlangSymbol __xlangSymbol)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "xlangSymbol" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __xlangSymbol)]
+  buildStruct _proxy GenericEntity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GenericEntity_plainEntity _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GenericEntity_xlangEntity _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (GenericEntity_xlangSymbol _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return GenericEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return GenericEntity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("plainEntity", 1), ("xlangEntity", 2), ("xlangSymbol", 3)]
+
+instance DeepSeq.NFData GenericEntity where
+  rnf (GenericEntity_plainEntity __plainEntity)
+    = DeepSeq.rnf __plainEntity
+  rnf (GenericEntity_xlangEntity __xlangEntity)
+    = DeepSeq.rnf __xlangEntity
+  rnf (GenericEntity_xlangSymbol __xlangSymbol)
+    = DeepSeq.rnf __xlangSymbol
+  rnf GenericEntity_EMPTY = ()
+
+instance Default.Default GenericEntity where
+  def = GenericEntity_EMPTY
+
+instance Hashable.Hashable GenericEntity where
+  hashWithSalt __salt (GenericEntity_plainEntity _plainEntity)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _plainEntity)
+  hashWithSalt __salt (GenericEntity_xlangEntity _xlangEntity)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _xlangEntity)
+  hashWithSalt __salt (GenericEntity_xlangSymbol _xlangSymbol)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _xlangSymbol)
+  hashWithSalt __salt GenericEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data GeneratedEntityToIdlEntity_key = GeneratedEntityToIdlEntity_key{generatedEntityToIdlEntity_key_entity
+                                                                     :: Glean.Schema.Code.Entity,
+                                                                     generatedEntityToIdlEntity_key_idlEntity
+                                                                     :: Glean.Schema.Code.IdlEntity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GeneratedEntityToIdlEntity_key where
+  toJSON
+    (GeneratedEntityToIdlEntity_key __field__entity __field__idlEntity)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "idlEntity" .= __field__idlEntity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GeneratedEntityToIdlEntity_key where
+  buildStruct _proxy
+    (GeneratedEntityToIdlEntity_key __field__entity __field__idlEntity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "idlEntity" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__idlEntity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__idlEntity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__idlEntity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__idlEntity <- ST.readSTRef __field__idlEntity
+                                             Prelude.pure
+                                               (GeneratedEntityToIdlEntity_key __val__entity
+                                                  __val__idlEntity)
+              _idMap = HashMap.fromList [("entity", 1), ("idlEntity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GeneratedEntityToIdlEntity_key where
+  rnf
+    (GeneratedEntityToIdlEntity_key __field__entity __field__idlEntity)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__idlEntity `Prelude.seq` ()
+
+instance Default.Default GeneratedEntityToIdlEntity_key where
+  def = GeneratedEntityToIdlEntity_key Default.def Default.def
+
+instance Hashable.Hashable GeneratedEntityToIdlEntity_key where
+  hashWithSalt __salt
+    (GeneratedEntityToIdlEntity_key _entity _idlEntity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _idlEntity
+
+data FindEntityDefinition_key = FindEntityDefinition_key{findEntityDefinition_key_entity
+                                                         :: Glean.Schema.Code.Entity,
+                                                         findEntityDefinition_key_definition ::
+                                                         Glean.Schema.Code.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FindEntityDefinition_key where
+  toJSON
+    (FindEntityDefinition_key __field__entity __field__definition)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct FindEntityDefinition_key where
+  buildStruct _proxy
+    (FindEntityDefinition_key __field__entity __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (FindEntityDefinition_key __val__entity
+                                                  __val__definition)
+              _idMap = HashMap.fromList [("entity", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FindEntityDefinition_key where
+  rnf (FindEntityDefinition_key __field__entity __field__definition)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default FindEntityDefinition_key where
+  def = FindEntityDefinition_key Default.def Default.def
+
+instance Hashable.Hashable FindEntityDefinition_key where
+  hashWithSalt __salt (FindEntityDefinition_key _entity _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _definition
+
+data FileXRefsGenericEntities_key = FileXRefsGenericEntities_key{fileXRefsGenericEntities_key_file
+                                                                 :: Glean.Schema.Src.File,
+                                                                 fileXRefsGenericEntities_key_genEntity
+                                                                 :: GenericEntity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefsGenericEntities_key where
+  toJSON
+    (FileXRefsGenericEntities_key __field__file __field__genEntity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "genEntity" .= __field__genEntity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefsGenericEntities_key where
+  buildStruct _proxy
+    (FileXRefsGenericEntities_key __field__file __field__genEntity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "genEntity" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__genEntity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__genEntity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__genEntity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__genEntity <- ST.readSTRef __field__genEntity
+                                             Prelude.pure
+                                               (FileXRefsGenericEntities_key __val__file
+                                                  __val__genEntity)
+              _idMap = HashMap.fromList [("file", 1), ("genEntity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefsGenericEntities_key where
+  rnf (FileXRefsGenericEntities_key __field__file __field__genEntity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__genEntity `Prelude.seq` ()
+
+instance Default.Default FileXRefsGenericEntities_key where
+  def = FileXRefsGenericEntities_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefsGenericEntities_key where
+  hashWithSalt __salt (FileXRefsGenericEntities_key _file _genEntity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _genEntity
+
+data FileEntityXRefRangeSpans_key = FileEntityXRefRangeSpans_key{fileEntityXRefRangeSpans_key_file
+                                                                 :: Glean.Schema.Src.File,
+                                                                 fileEntityXRefRangeSpans_key_location
+                                                                 ::
+                                                                 Glean.Schema.CodemarkupTypes.RangeSpan,
+                                                                 fileEntityXRefRangeSpans_key_entity
+                                                                 :: Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefRangeSpans_key where
+  toJSON
+    (FileEntityXRefRangeSpans_key __field__file __field__location
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "location" .= __field__location :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefRangeSpans_key where
+  buildStruct _proxy
+    (FileEntityXRefRangeSpans_key __field__file __field__location
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityXRefRangeSpans_key __val__file
+                                                  __val__location
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("file", 1), ("location", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefRangeSpans_key where
+  rnf
+    (FileEntityXRefRangeSpans_key __field__file __field__location
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefRangeSpans_key where
+  def
+    = FileEntityXRefRangeSpans_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityXRefRangeSpans_key where
+  hashWithSalt __salt
+    (FileEntityXRefRangeSpans_key _file _location _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _location)
+        _entity
+
+data FileEntityXRefLocations_key = FileEntityXRefLocations_key{fileEntityXRefLocations_key_file
+                                                               :: Glean.Schema.Src.File,
+                                                               fileEntityXRefLocations_key_xref ::
+                                                               Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                               fileEntityXRefLocations_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocations_key where
+  toJSON
+    (FileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocations_key where
+  buildStruct _proxy
+    (FileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityXRefLocations_key __val__file __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocations_key where
+  rnf
+    (FileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocations_key where
+  def
+    = FileEntityXRefLocations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (FileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data FileEntityXRefKinds_key = FileEntityXRefKinds_key{fileEntityXRefKinds_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       fileEntityXRefKinds_key_entity ::
+                                                       Glean.Schema.Code.Entity,
+                                                       fileEntityXRefKinds_key_kind ::
+                                                       Glean.Schema.CodemarkupTypes.SymbolKind}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefKinds_key where
+  toJSON
+    (FileEntityXRefKinds_key __field__file __field__entity
+       __field__kind)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity :
+             "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefKinds_key where
+  buildStruct _proxy
+    (FileEntityXRefKinds_key __field__file __field__entity
+       __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__kind)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (FileEntityXRefKinds_key __val__file __val__entity
+                                                  __val__kind)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2), ("kind", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefKinds_key where
+  rnf
+    (FileEntityXRefKinds_key __field__file __field__entity
+       __field__kind)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefKinds_key where
+  def = FileEntityXRefKinds_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityXRefKinds_key where
+  hashWithSalt __salt (FileEntityXRefKinds_key _file _entity _kind)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _entity)
+        _kind
+
+data FileEntityXRefInfos_key = FileEntityXRefInfos_key{fileEntityXRefInfos_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       fileEntityXRefInfos_key_entity ::
+                                                       Glean.Schema.Code.Entity,
+                                                       fileEntityXRefInfos_key_info ::
+                                                       Glean.Schema.CodemarkupTypes.SymbolInfo}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefInfos_key where
+  toJSON
+    (FileEntityXRefInfos_key __field__file __field__entity
+       __field__info)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity :
+             "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefInfos_key where
+  buildStruct _proxy
+    (FileEntityXRefInfos_key __field__file __field__entity
+       __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__info)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (FileEntityXRefInfos_key __val__file __val__entity
+                                                  __val__info)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2), ("info", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefInfos_key where
+  rnf
+    (FileEntityXRefInfos_key __field__file __field__entity
+       __field__info)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefInfos_key where
+  def = FileEntityXRefInfos_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityXRefInfos_key where
+  hashWithSalt __salt (FileEntityXRefInfos_key _file _entity _info)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _entity)
+        _info
+
+data FileEntityLocations_key = FileEntityLocations_key{fileEntityLocations_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       fileEntityLocations_key_location ::
+                                                       Glean.Schema.CodemarkupTypes.Location,
+                                                       fileEntityLocations_key_entity ::
+                                                       Glean.Schema.Code.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityLocations_key where
+  toJSON
+    (FileEntityLocations_key __field__file __field__location
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "location" .= __field__location :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityLocations_key where
+  buildStruct _proxy
+    (FileEntityLocations_key __field__file __field__location
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityLocations_key __val__file __val__location
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("file", 1), ("location", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityLocations_key where
+  rnf
+    (FileEntityLocations_key __field__file __field__location
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityLocations_key where
+  def = FileEntityLocations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityLocations_key where
+  hashWithSalt __salt
+    (FileEntityLocations_key _file _location _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _location)
+        _entity
+
+data FileEntityKinds_key = FileEntityKinds_key{fileEntityKinds_key_file
+                                               :: Glean.Schema.Src.File,
+                                               fileEntityKinds_key_entity ::
+                                               Glean.Schema.Code.Entity,
+                                               fileEntityKinds_key_kind ::
+                                               Glean.Schema.CodemarkupTypes.SymbolKind}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityKinds_key where
+  toJSON
+    (FileEntityKinds_key __field__file __field__entity __field__kind)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity :
+             "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityKinds_key where
+  buildStruct _proxy
+    (FileEntityKinds_key __field__file __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__kind)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (FileEntityKinds_key __val__file __val__entity
+                                                  __val__kind)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2), ("kind", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityKinds_key where
+  rnf
+    (FileEntityKinds_key __field__file __field__entity __field__kind)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default FileEntityKinds_key where
+  def = FileEntityKinds_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityKinds_key where
+  hashWithSalt __salt (FileEntityKinds_key _file _entity _kind)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _entity)
+        _kind
+
+data FileEntityInfos_key = FileEntityInfos_key{fileEntityInfos_key_file
+                                               :: Glean.Schema.Src.File,
+                                               fileEntityInfos_key_entity ::
+                                               Glean.Schema.Code.Entity,
+                                               fileEntityInfos_key_info ::
+                                               Glean.Schema.CodemarkupTypes.SymbolInfo}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityInfos_key where
+  toJSON
+    (FileEntityInfos_key __field__file __field__entity __field__info)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity :
+             "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityInfos_key where
+  buildStruct _proxy
+    (FileEntityInfos_key __field__file __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__info)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (FileEntityInfos_key __val__file __val__entity
+                                                  __val__info)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2), ("info", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityInfos_key where
+  rnf
+    (FileEntityInfos_key __field__file __field__entity __field__info)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default FileEntityInfos_key where
+  def = FileEntityInfos_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityInfos_key where
+  hashWithSalt __salt (FileEntityInfos_key _file _entity _info)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _entity)
+        _info
+
+data FileEntityDigest_key = FileEntityDigest_key{fileEntityDigest_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 fileEntityDigest_key_entity ::
+                                                 Glean.Schema.Code.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityDigest_key where
+  toJSON (FileEntityDigest_key __field__file __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityDigest_key where
+  buildStruct _proxy
+    (FileEntityDigest_key __field__file __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityDigest_key __val__file __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityDigest_key where
+  rnf (FileEntityDigest_key __field__file __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityDigest_key where
+  def = FileEntityDigest_key Default.def Default.def
+
+instance Hashable.Hashable FileEntityDigest_key where
+  hashWithSalt __salt (FileEntityDigest_key _file _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _entity
+
+type FileEntityDigest_value = Text.Text
+
+data FileCall_key = FileCall_key{fileCall_key_file ::
+                                 Glean.Schema.Src.File,
+                                 fileCall_key_span :: Glean.Schema.Src.ByteSpan,
+                                 fileCall_key_arguments :: [Glean.Schema.Code.CallArgument],
+                                 fileCall_key_callee_xref :: Prelude.Maybe Glean.Schema.Code.Entity,
+                                 fileCall_key_dispatch_arg ::
+                                 Prelude.Maybe Glean.Schema.Code.CallArgument,
+                                 fileCall_key_receiver_type ::
+                                 Prelude.Maybe Glean.Schema.Code.Entity}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall_key where
+  toJSON
+    (FileCall_key __field__file __field__span __field__arguments
+       __field__callee_xref __field__dispatch_arg __field__receiver_type)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "arguments" .= __field__arguments :
+               Prelude.maybe Prelude.id ((:) . ("callee_xref" .=))
+                 __field__callee_xref
+                 (Prelude.maybe Prelude.id ((:) . ("dispatch_arg" .=))
+                    __field__dispatch_arg
+                    (Prelude.maybe Prelude.id ((:) . ("receiver_type" .=))
+                       __field__receiver_type
+                       Prelude.mempty)))
+
+instance Thrift.ThriftStruct FileCall_key where
+  buildStruct _proxy
+    (FileCall_key __field__file __field__span __field__arguments
+       __field__callee_xref __field__dispatch_arg __field__receiver_type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__arguments)
+               :
+               let (__cereal__callee_xref, __id__callee_xref)
+                     = case __field__callee_xref of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "callee_xref"
+                                                    (Thrift.getStructType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.buildStruct _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__callee_xref
+                   (let (__cereal__dispatch_arg, __id__dispatch_arg)
+                          = case __field__dispatch_arg of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "dispatch_arg"
+                                                         (Thrift.getStructType _proxy)
+                                                         5
+                                                         __id__callee_xref
+                                                         (Thrift.buildStruct _proxy _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, __id__callee_xref)
+                      in
+                      __cereal__dispatch_arg
+                        (case __field__receiver_type of
+                           Prelude.Just _val -> Thrift.genField _proxy "receiver_type"
+                                                  (Thrift.getStructType _proxy)
+                                                  6
+                                                  __id__dispatch_arg
+                                                  (Thrift.buildStruct _proxy _val)
+                                                  : []
+                           Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            __field__callee_xref <- ST.newSTRef Prelude.Nothing
+            __field__dispatch_arg <- ST.newSTRef Prelude.Nothing
+            __field__receiver_type <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_xref
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__dispatch_arg
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__receiver_type
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             !__val__callee_xref <- ST.readSTRef
+                                                                      __field__callee_xref
+                                             !__val__dispatch_arg <- ST.readSTRef
+                                                                       __field__dispatch_arg
+                                             !__val__receiver_type <- ST.readSTRef
+                                                                        __field__receiver_type
+                                             Prelude.pure
+                                               (FileCall_key __val__file __val__span
+                                                  __val__arguments
+                                                  __val__callee_xref
+                                                  __val__dispatch_arg
+                                                  __val__receiver_type)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("span", 2), ("arguments", 3), ("callee_xref", 4),
+                     ("dispatch_arg", 5), ("receiver_type", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall_key where
+  rnf
+    (FileCall_key __field__file __field__span __field__arguments
+       __field__callee_xref __field__dispatch_arg __field__receiver_type)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__arguments `Prelude.seq`
+            DeepSeq.rnf __field__callee_xref `Prelude.seq`
+              DeepSeq.rnf __field__dispatch_arg `Prelude.seq`
+                DeepSeq.rnf __field__receiver_type `Prelude.seq` ()
+
+instance Default.Default FileCall_key where
+  def
+    = FileCall_key Default.def Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable FileCall_key where
+  hashWithSalt __salt
+    (FileCall_key _file _span _arguments _callee_xref _dispatch_arg
+       _receiver_type)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+                 _arguments)
+              _callee_xref)
+           _dispatch_arg)
+        _receiver_type
+
+data ExtendsParentEntityConcise_key = ExtendsParentEntityConcise_key{extendsParentEntityConcise_key_child
+                                                                     :: Glean.Schema.Code.Entity,
+                                                                     extendsParentEntityConcise_key_parent
+                                                                     :: Glean.Schema.Code.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsParentEntityConcise_key where
+  toJSON
+    (ExtendsParentEntityConcise_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsParentEntityConcise_key where
+  buildStruct _proxy
+    (ExtendsParentEntityConcise_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ExtendsParentEntityConcise_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsParentEntityConcise_key where
+  rnf (ExtendsParentEntityConcise_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ExtendsParentEntityConcise_key where
+  def = ExtendsParentEntityConcise_key Default.def Default.def
+
+instance Hashable.Hashable ExtendsParentEntityConcise_key where
+  hashWithSalt __salt (ExtendsParentEntityConcise_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data ExtendsParentEntity_key = ExtendsParentEntity_key{extendsParentEntity_key_child
+                                                       :: Glean.Schema.Code.Entity,
+                                                       extendsParentEntity_key_parent ::
+                                                       Glean.Schema.Code.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsParentEntity_key where
+  toJSON (ExtendsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsParentEntity_key where
+  buildStruct _proxy
+    (ExtendsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ExtendsParentEntity_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsParentEntity_key where
+  rnf (ExtendsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ExtendsParentEntity_key where
+  def = ExtendsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable ExtendsParentEntity_key where
+  hashWithSalt __salt (ExtendsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data ExtendsChildEntity_key = ExtendsChildEntity_key{extendsChildEntity_key_parent
+                                                     :: Glean.Schema.Code.Entity,
+                                                     extendsChildEntity_key_child ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsChildEntity_key where
+  toJSON (ExtendsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsChildEntity_key where
+  buildStruct _proxy
+    (ExtendsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ExtendsChildEntity_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsChildEntity_key where
+  rnf (ExtendsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ExtendsChildEntity_key where
+  def = ExtendsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable ExtendsChildEntity_key where
+  hashWithSalt __salt (ExtendsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+type EntityVisibility_value =
+     Glean.Schema.CodemarkupTypes.Visibility
+
+data EntityUses_key = EntityUses_key{entityUses_key_target ::
+                                     Glean.Schema.Code.Entity,
+                                     entityUses_key_file :: Glean.Schema.Src.File,
+                                     entityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses_key where
+  toJSON (EntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses_key where
+  buildStruct _proxy
+    (EntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (EntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses_key where
+  rnf (EntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default EntityUses_key where
+  def = EntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EntityUses_key where
+  hashWithSalt __salt (EntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data EntityToAnnotations_key = EntityToAnnotations_key{entityToAnnotations_key_entity
+                                                       :: Glean.Schema.Code.Entity,
+                                                       entityToAnnotations_key_annotations ::
+                                                       Glean.Schema.Code.Annotations}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityToAnnotations_key where
+  toJSON
+    (EntityToAnnotations_key __field__entity __field__annotations)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "annotations" .= __field__annotations : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityToAnnotations_key where
+  buildStruct _proxy
+    (EntityToAnnotations_key __field__entity __field__annotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "annotations" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__annotations)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             Prelude.pure
+                                               (EntityToAnnotations_key __val__entity
+                                                  __val__annotations)
+              _idMap = HashMap.fromList [("entity", 1), ("annotations", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityToAnnotations_key where
+  rnf (EntityToAnnotations_key __field__entity __field__annotations)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__annotations `Prelude.seq` ()
+
+instance Default.Default EntityToAnnotations_key where
+  def = EntityToAnnotations_key Default.def Default.def
+
+instance Hashable.Hashable EntityToAnnotations_key where
+  hashWithSalt __salt (EntityToAnnotations_key _entity _annotations)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _annotations
+
+data EntitySource_key = EntitySource_key{entitySource_key_target ::
+                                         Glean.Schema.Code.Entity,
+                                         entitySource_key_source :: Glean.Schema.Code.Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntitySource_key where
+  toJSON (EntitySource_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntitySource_key where
+  buildStruct _proxy
+    (EntitySource_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (EntitySource_key __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntitySource_key where
+  rnf (EntitySource_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default EntitySource_key where
+  def = EntitySource_key Default.def Default.def
+
+instance Hashable.Hashable EntitySource_key where
+  hashWithSalt __salt (EntitySource_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data EntityReferences_key = EntityReferences_key{entityReferences_key_target
+                                                 :: Glean.Schema.Code.Entity,
+                                                 entityReferences_key_file :: Glean.Schema.Src.File,
+                                                 entityReferences_key_range ::
+                                                 Glean.Schema.CodemarkupTypes.RangeSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityReferences_key where
+  toJSON
+    (EntityReferences_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityReferences_key where
+  buildStruct _proxy
+    (EntityReferences_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (EntityReferences_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityReferences_key where
+  rnf
+    (EntityReferences_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default EntityReferences_key where
+  def = EntityReferences_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EntityReferences_key where
+  hashWithSalt __salt (EntityReferences_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data EntityModuleName_key = EntityModuleName_key{entityModuleName_key_entity
+                                                 :: Glean.Schema.Code.Entity,
+                                                 entityModuleName_key_name :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityModuleName_key where
+  toJSON (EntityModuleName_key __field__entity __field__name)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityModuleName_key where
+  buildStruct _proxy
+    (EntityModuleName_key __field__entity __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (EntityModuleName_key __val__entity __val__name)
+              _idMap = HashMap.fromList [("entity", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityModuleName_key where
+  rnf (EntityModuleName_key __field__entity __field__name)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EntityModuleName_key where
+  def = EntityModuleName_key Default.def ""
+
+instance Hashable.Hashable EntityModuleName_key where
+  hashWithSalt __salt (EntityModuleName_key _entity _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _name
+
+data EntityModifiers_key = EntityModifiers_key{entityModifiers_key_entity
+                                               :: Glean.Schema.Code.Entity,
+                                               entityModifiers_key_modifiers ::
+                                               Glean.Schema.CodemarkupTypes.Modifiers}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityModifiers_key where
+  toJSON (EntityModifiers_key __field__entity __field__modifiers)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "modifiers" .= __field__modifiers : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityModifiers_key where
+  buildStruct _proxy
+    (EntityModifiers_key __field__entity __field__modifiers)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "modifiers" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__modifiers)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             Prelude.pure
+                                               (EntityModifiers_key __val__entity __val__modifiers)
+              _idMap = HashMap.fromList [("entity", 1), ("modifiers", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityModifiers_key where
+  rnf (EntityModifiers_key __field__entity __field__modifiers)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__modifiers `Prelude.seq` ()
+
+instance Default.Default EntityModifiers_key where
+  def = EntityModifiers_key Default.def Default.def
+
+instance Hashable.Hashable EntityModifiers_key where
+  hashWithSalt __salt (EntityModifiers_key _entity _modifiers)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _modifiers
+
+data EntityLocation_key = EntityLocation_key{entityLocation_key_entity
+                                             :: Glean.Schema.Code.Entity,
+                                             entityLocation_key_location ::
+                                             Glean.Schema.CodemarkupTypes.Location}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation_key where
+  toJSON (EntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation_key where
+  buildStruct _proxy
+    (EntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (EntityLocation_key __val__entity __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation_key where
+  rnf (EntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default EntityLocation_key where
+  def = EntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable EntityLocation_key where
+  hashWithSalt __salt (EntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data EntityKind_key = EntityKind_key{entityKind_key_entity ::
+                                     Glean.Schema.Code.Entity,
+                                     entityKind_key_kind :: Glean.Schema.CodemarkupTypes.SymbolKind}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind_key where
+  toJSON (EntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind_key where
+  buildStruct _proxy (EntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (EntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind_key where
+  rnf (EntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default EntityKind_key where
+  def = EntityKind_key Default.def Default.def
+
+instance Hashable.Hashable EntityKind_key where
+  hashWithSalt __salt (EntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data EntityInfo_key = EntityInfo_key{entityInfo_key_entity ::
+                                     Glean.Schema.Code.Entity,
+                                     entityInfo_key_info :: Glean.Schema.CodemarkupTypes.SymbolInfo}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo_key where
+  toJSON (EntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo_key where
+  buildStruct _proxy (EntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure (EntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo_key where
+  rnf (EntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default EntityInfo_key where
+  def = EntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable EntityInfo_key where
+  hashWithSalt __salt (EntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data EntityComments_key = EntityComments_key{entityComments_key_entity
+                                             :: Glean.Schema.Code.Entity,
+                                             entityComments_key_file :: Glean.Schema.Src.File,
+                                             entityComments_key_span :: Glean.Schema.Src.ByteSpan,
+                                             entityComments_key_text :: Prelude.Maybe Text.Text}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityComments_key where
+  toJSON
+    (EntityComments_key __field__entity __field__file __field__span
+       __field__text)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file :
+             "span" .= __field__span :
+               Prelude.maybe Prelude.id ((:) . ("text" .=)) __field__text
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityComments_key where
+  buildStruct _proxy
+    (EntityComments_key __field__entity __field__file __field__span
+       __field__text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               case __field__text of
+                 Prelude.Just _val -> Thrift.genField _proxy "text"
+                                        (Thrift.getStringType _proxy)
+                                        4
+                                        3
+                                        (Thrift.genText _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__text <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__text <- ST.readSTRef __field__text
+                                             Prelude.pure
+                                               (EntityComments_key __val__entity __val__file
+                                                  __val__span
+                                                  __val__text)
+              _idMap
+                = HashMap.fromList
+                    [("entity", 1), ("file", 2), ("span", 3), ("text", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityComments_key where
+  rnf
+    (EntityComments_key __field__entity __field__file __field__span
+       __field__text)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__text `Prelude.seq` ()
+
+instance Default.Default EntityComments_key where
+  def
+    = EntityComments_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable EntityComments_key where
+  hashWithSalt __salt (EntityComments_key _entity _file _span _text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+              _file)
+           _span)
+        _text
+
+data ContainsParentEntity_key = ContainsParentEntity_key{containsParentEntity_key_child
+                                                         :: Glean.Schema.Code.Entity,
+                                                         containsParentEntity_key_parent ::
+                                                         Glean.Schema.Code.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsParentEntity_key where
+  toJSON (ContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsParentEntity_key where
+  buildStruct _proxy
+    (ContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ContainsParentEntity_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsParentEntity_key where
+  rnf (ContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ContainsParentEntity_key where
+  def = ContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable ContainsParentEntity_key where
+  hashWithSalt __salt (ContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data ContainsChildEntity_key = ContainsChildEntity_key{containsChildEntity_key_parent
+                                                       :: Glean.Schema.Code.Entity,
+                                                       containsChildEntity_key_child ::
+                                                       Glean.Schema.Code.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsChildEntity_key where
+  toJSON (ContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsChildEntity_key where
+  buildStruct _proxy
+    (ContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ContainsChildEntity_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsChildEntity_key where
+  rnf (ContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ContainsChildEntity_key where
+  def = ContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable ContainsChildEntity_key where
+  hashWithSalt __salt (ContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data ChildEntity = ChildEntity{childEntity_child ::
+                               Glean.Schema.Code.Entity,
+                               childEntity_location :: Glean.Schema.CodemarkupTypes.Location}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ChildEntity where
+  toJSON (ChildEntity __field__child __field__location)
+    = Aeson.object
+        ("child" .= __field__child :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ChildEntity where
+  buildStruct _proxy (ChildEntity __field__child __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure (ChildEntity __val__child __val__location)
+              _idMap = HashMap.fromList [("child", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ChildEntity where
+  rnf (ChildEntity __field__child __field__location)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ChildEntity where
+  def = ChildEntity Default.def Default.def
+
+instance Hashable.Hashable ChildEntity where
+  hashWithSalt __salt (ChildEntity _child _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _location
+
+data SearchInheritedEntities_key = SearchInheritedEntities_key{searchInheritedEntities_key_base
+                                                               :: Glean.Schema.Code.Entity,
+                                                               searchInheritedEntities_key_parent ::
+                                                               ParentEntity,
+                                                               searchInheritedEntities_key_child ::
+                                                               ChildEntity,
+                                                               searchInheritedEntities_key_style ::
+                                                               SearchStyle}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInheritedEntities_key where
+  toJSON
+    (SearchInheritedEntities_key __field__base __field__parent
+       __field__child __field__style)
+    = Aeson.object
+        ("base" .= __field__base :
+           "parent" .= __field__parent :
+             "child" .= __field__child :
+               "style" .= __field__style : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInheritedEntities_key where
+  buildStruct _proxy
+    (SearchInheritedEntities_key __field__base __field__parent
+       __field__child __field__style)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__child)
+               :
+               Thrift.genField _proxy "style" (Thrift.getI32Type _proxy) 4 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__style)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            __field__style <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SearchStyle")
+                                                                        ST.writeSTRef __field__style
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             !__val__style <- ST.readSTRef __field__style
+                                             Prelude.pure
+                                               (SearchInheritedEntities_key __val__base
+                                                  __val__parent
+                                                  __val__child
+                                                  __val__style)
+              _idMap
+                = HashMap.fromList
+                    [("base", 1), ("parent", 2), ("child", 3), ("style", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInheritedEntities_key where
+  rnf
+    (SearchInheritedEntities_key __field__base __field__parent
+       __field__child __field__style)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__child `Prelude.seq`
+            DeepSeq.rnf __field__style `Prelude.seq` ()
+
+instance Default.Default SearchInheritedEntities_key where
+  def
+    = SearchInheritedEntities_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable SearchInheritedEntities_key where
+  hashWithSalt __salt
+    (SearchInheritedEntities_key _base _parent _child _style)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+              _parent)
+           _child)
+        _style
+
+data SearchRelatedEntities_key = SearchRelatedEntities_key{searchRelatedEntities_key_query
+                                                           :: RelationType,
+                                                           searchRelatedEntities_key_parent ::
+                                                           ParentEntity,
+                                                           searchRelatedEntities_key_child ::
+                                                           ChildEntity,
+                                                           searchRelatedEntities_key_style ::
+                                                           SearchStyle}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchRelatedEntities_key where
+  toJSON
+    (SearchRelatedEntities_key __field__query __field__parent
+       __field__child __field__style)
+    = Aeson.object
+        ("query" .= __field__query :
+           "parent" .= __field__parent :
+             "child" .= __field__child :
+               "style" .= __field__style : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchRelatedEntities_key where
+  buildStruct _proxy
+    (SearchRelatedEntities_key __field__query __field__parent
+       __field__child __field__style)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "query" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__query)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__child)
+               :
+               Thrift.genField _proxy "style" (Thrift.getI32Type _proxy) 4 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__style)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__query <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            __field__style <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RelationType")
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SearchStyle")
+                                                                        ST.writeSTRef __field__style
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__query <- ST.readSTRef __field__query
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             !__val__style <- ST.readSTRef __field__style
+                                             Prelude.pure
+                                               (SearchRelatedEntities_key __val__query __val__parent
+                                                  __val__child
+                                                  __val__style)
+              _idMap
+                = HashMap.fromList
+                    [("query", 1), ("parent", 2), ("child", 3), ("style", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchRelatedEntities_key where
+  rnf
+    (SearchRelatedEntities_key __field__query __field__parent
+       __field__child __field__style)
+    = DeepSeq.rnf __field__query `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__child `Prelude.seq`
+            DeepSeq.rnf __field__style `Prelude.seq` ()
+
+instance Default.Default SearchRelatedEntities_key where
+  def
+    = SearchRelatedEntities_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable SearchRelatedEntities_key where
+  hashWithSalt __salt
+    (SearchRelatedEntities_key _query _parent _child _style)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _query)
+              _parent)
+           _child)
+        _style
+{-# LINE 20 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ExtendsChildEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ExtendsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ExtendsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ExtendsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ExtendsChildEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ExtendsChildEntity =
+       Glean.Schema.Codemarkup.Types.ExtendsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ExtendsChildEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.extendsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ExtendsChildEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.extendsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ExtendsParentEntityConcise_key"
+           (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise_key
+     =
+     'Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 57 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise
+         where
+  type KeyType
+         Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise
+       = Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ExtendsParentEntityConcise" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.extendsParentEntityConcise_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.extendsParentEntityConcise_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntityConcise
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.FileCall_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileCall_key x1 x2 x3 x4 x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileCall_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileCall_key" (Prelude.Just 0))
+{-# LINE 90 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.FileCall_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "arguments" ([Glean.Schema.Code.Types.CallArgument])
+             ('Angle.TField "callee_xref"
+                (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+                ('Angle.TField "dispatch_arg"
+                   (Prelude.Maybe Glean.Schema.Code.Types.CallArgument)
+                   ('Angle.TField "receiver_type"
+                      (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+                      ('Angle.TNoFields))))))
+{-# LINE 92 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.FileCall
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileCall =
+       Glean.Schema.Codemarkup.Types.FileCall_key
+  getName _proxy = Glean.PredicateRef "codemarkup.FileCall" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileCall x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 101 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.FileCall where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 107 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.GeneratedEntityToIdlEntity_key"
+           (Prelude.Just 0))
+{-# LINE 116 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "idlEntity" (Glean.Schema.Code.Types.IdlEntity)
+          ('Angle.TNoFields))
+{-# LINE 118 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity
+         where
+  type KeyType
+         Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity
+       = Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.GeneratedEntityToIdlEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.generatedEntityToIdlEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.generatedEntityToIdlEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 128 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.GeneratedEntityToIdlEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 134 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.SearchInheritedEntities_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.SearchInheritedEntities_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.SearchInheritedEntities_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.SearchInheritedEntities_key"
+           (Prelude.Just 0))
+{-# LINE 147 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.SearchInheritedEntities_key
+     =
+     'Angle.TField "base" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "parent"
+          (Glean.Schema.Codemarkup.Types.ParentEntity)
+          ('Angle.TField "child" (Glean.Schema.Codemarkup.Types.ChildEntity)
+             ('Angle.TField "style" (Glean.Schema.Codemarkup.Types.SearchStyle)
+                ('Angle.TNoFields))))
+{-# LINE 149 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.SearchInheritedEntities
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.SearchInheritedEntities
+       = Glean.Schema.Codemarkup.Types.SearchInheritedEntities_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.SearchInheritedEntities" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.searchInheritedEntities_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.SearchInheritedEntities x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.searchInheritedEntities_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 158 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.SearchInheritedEntities
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 164 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ResolveLocation_key" (Prelude.Just 0))
+{-# LINE 173 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 175 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ResolveLocation
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ResolveLocation =
+       Glean.Schema.Codemarkup.Types.ResolveLocation_key
+  getName _proxy = Glean.PredicateRef "codemarkup.ResolveLocation" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.resolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ResolveLocation x k
+  getFactKey = Glean.Schema.Codemarkup.Types.resolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 184 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.ResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 190 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityModifiers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityModifiers_key" (Prelude.Just 0))
+{-# LINE 199 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.EntityModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "modifiers"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 201 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityModifiers
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityModifiers =
+       Glean.Schema.Codemarkup.Types.EntityModifiers_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityModifiers" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityModifiers x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 210 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 216 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.SymbolToEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.SymbolToEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.SymbolToEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.SymbolToEntity_key" (Prelude.Just 0))
+{-# LINE 225 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.SymbolToEntity_key
+     =
+     'Angle.TField "symbol" (Glean.Schema.Code.Types.SymbolId)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 227 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.SymbolToEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.SymbolToEntity =
+       Glean.Schema.Codemarkup.Types.SymbolToEntity_key
+  getName _proxy = Glean.PredicateRef "codemarkup.SymbolToEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.symbolToEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.SymbolToEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.symbolToEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 236 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.SymbolToEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 242 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.SearchRelatedEntities_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.SearchRelatedEntities_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.SearchRelatedEntities_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.SearchRelatedEntities_key"
+           (Prelude.Just 0))
+{-# LINE 255 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.SearchRelatedEntities_key
+     =
+     'Angle.TField "query" (Glean.Schema.Codemarkup.Types.RelationType)
+       ('Angle.TField "parent"
+          (Glean.Schema.Codemarkup.Types.ParentEntity)
+          ('Angle.TField "child" (Glean.Schema.Codemarkup.Types.ChildEntity)
+             ('Angle.TField "style" (Glean.Schema.Codemarkup.Types.SearchStyle)
+                ('Angle.TNoFields))))
+{-# LINE 257 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.SearchRelatedEntities
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.SearchRelatedEntities =
+       Glean.Schema.Codemarkup.Types.SearchRelatedEntities_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.SearchRelatedEntities" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.searchRelatedEntities_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.SearchRelatedEntities x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.searchRelatedEntities_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 266 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.SearchRelatedEntities
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 272 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ReferencingEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ReferencingEntity_key x1 x2 x3 x4
+       x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ReferencingEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ReferencingEntity_key"
+           (Prelude.Just 0))
+{-# LINE 287 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ReferencingEntity_key
+     =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "referrer" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "reference_file"
+             (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "reference_range"
+                (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+                ('Angle.TField "referrer_location"
+                   (Glean.Schema.CodemarkupTypes.Types.Location)
+                   ('Angle.TNoFields)))))
+{-# LINE 289 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ReferencingEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ReferencingEntity =
+       Glean.Schema.Codemarkup.Types.ReferencingEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ReferencingEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.referencingEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ReferencingEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.referencingEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 298 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.ReferencingEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 304 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ContainsChildEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ContainsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 313 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 315 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ContainsChildEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ContainsChildEntity =
+       Glean.Schema.Codemarkup.Types.ContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ContainsChildEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.containsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ContainsChildEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.containsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 324 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 330 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ExtendsParentEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ExtendsParentEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ExtendsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 339 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ExtendsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 341 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ExtendsParentEntity =
+       Glean.Schema.Codemarkup.Types.ExtendsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ExtendsParentEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.extendsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ExtendsParentEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.extendsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 350 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ExtendsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 356 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.IndexedFile
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.IndexedFile =
+       Glean.Schema.Src.Types.File
+  getName _proxy = Glean.PredicateRef "codemarkup.IndexedFile" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.indexedFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.IndexedFile x k
+  getFactKey = Glean.Schema.Codemarkup.Types.indexedFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 365 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.IndexedFile where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 371 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityInfo_key" (Prelude.Just 0))
+{-# LINE 380 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntityInfo_key =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 382 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.EntityInfo
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityInfo =
+       Glean.Schema.Codemarkup.Types.EntityInfo_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityInfo" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityInfo x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 391 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityInfo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 397 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntitySource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntitySource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntitySource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntitySource_key" (Prelude.Just 0))
+{-# LINE 406 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntitySource_key =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "source" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 408 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.EntitySource
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntitySource =
+       Glean.Schema.Codemarkup.Types.EntitySource_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntitySource" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entitySource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntitySource x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entitySource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 417 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntitySource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 423 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefKinds_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityXRefKinds_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefKinds_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityXRefKinds_key"
+           (Prelude.Just 0))
+{-# LINE 434 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityXRefKinds_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "kind"
+             (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TNoFields)))
+{-# LINE 436 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityXRefKinds
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityXRefKinds =
+       Glean.Schema.Codemarkup.Types.FileEntityXRefKinds_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityXRefKinds" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityXRefKinds_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefKinds x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityXRefKinds_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 445 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefKinds
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 451 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityUses_key" (Prelude.Just 0))
+{-# LINE 462 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntityUses_key =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 464 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.EntityUses
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityUses =
+       Glean.Schema.Codemarkup.Types.EntityUses_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityUses" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityUses x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 473 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 479 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefInfos_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityXRefInfos_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefInfos_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityXRefInfos_key"
+           (Prelude.Just 0))
+{-# LINE 490 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityXRefInfos_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "info"
+             (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+             ('Angle.TNoFields)))
+{-# LINE 492 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityXRefInfos
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityXRefInfos =
+       Glean.Schema.Codemarkup.Types.FileEntityXRefInfos_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityXRefInfos" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityXRefInfos_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefInfos x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityXRefInfos_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 501 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefInfos
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 507 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityToAnnotations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityToAnnotations_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityToAnnotations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityToAnnotations_key"
+           (Prelude.Just 0))
+{-# LINE 516 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.EntityToAnnotations_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "annotations" (Glean.Schema.Code.Types.Annotations)
+          ('Angle.TNoFields))
+{-# LINE 518 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityToAnnotations
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityToAnnotations =
+       Glean.Schema.Codemarkup.Types.EntityToAnnotations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityToAnnotations" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityToAnnotations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityToAnnotations x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityToAnnotations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 527 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityToAnnotations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 533 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityReferences_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityReferences_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityReferences_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityReferences_key"
+           (Prelude.Just 0))
+{-# LINE 544 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.EntityReferences_key
+     =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range"
+             (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+             ('Angle.TNoFields)))
+{-# LINE 546 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityReferences
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityReferences =
+       Glean.Schema.Codemarkup.Types.EntityReferences_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityReferences" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityReferences_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityReferences x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityReferences_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 555 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityReferences
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 561 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityLocations_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityLocations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityLocations_key"
+           (Prelude.Just 0))
+{-# LINE 572 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 574 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityLocations
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityLocations =
+       Glean.Schema.Codemarkup.Types.FileEntityLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityLocations" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityLocations x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 583 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 589 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityModuleName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityModuleName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityModuleName_key"
+           (Prelude.Just 0))
+{-# LINE 598 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.EntityModuleName_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 600 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityModuleName
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityModuleName =
+       Glean.Schema.Codemarkup.Types.EntityModuleName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityModuleName" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityModuleName x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 609 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 615 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.ContainsParentEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ContainsParentEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 624 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.ContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 626 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.ContainsParentEntity
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.ContainsParentEntity =
+       Glean.Schema.Codemarkup.Types.ContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.ContainsParentEntity" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.containsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.ContainsParentEntity x k
+  getFactKey = Glean.Schema.Codemarkup.Types.containsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 635 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.ContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 641 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityLocation_key" (Prelude.Just 0))
+{-# LINE 650 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 652 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityLocation
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityLocation =
+       Glean.Schema.Codemarkup.Types.EntityLocation_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityLocation" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityLocation x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 661 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 667 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityComments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityComments_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityComments_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityComments_key" (Prelude.Just 0))
+{-# LINE 680 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntityComments_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "text" (Prelude.Maybe Data.Text.Text)
+                ('Angle.TNoFields))))
+{-# LINE 682 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityComments
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityComments =
+       Glean.Schema.Codemarkup.Types.EntityComments_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityComments" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityComments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityComments x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityComments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 691 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityComments
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 697 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.EntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.EntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.EntityKind_key" (Prelude.Just 0))
+{-# LINE 706 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.EntityKind_key =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 708 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Codemarkup.Types.EntityKind
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityKind =
+       Glean.Schema.Codemarkup.Types.EntityKind_key
+  getName _proxy = Glean.PredicateRef "codemarkup.EntityKind" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityKind x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 717 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 723 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityKinds_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityKinds_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityKinds_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityKinds_key" (Prelude.Just 0))
+{-# LINE 734 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityKinds_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "kind"
+             (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TNoFields)))
+{-# LINE 736 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityKinds
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityKinds =
+       Glean.Schema.Codemarkup.Types.FileEntityKinds_key
+  getName _proxy = Glean.PredicateRef "codemarkup.FileEntityKinds" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityKinds_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityKinds x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityKinds_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 745 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.FileEntityKinds
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 751 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityVisibility
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityVisibility =
+       Glean.Schema.Code.Types.Entity
+  type ValueType Glean.Schema.Codemarkup.Types.EntityVisibility =
+       Glean.Schema.Codemarkup.Types.EntityVisibility_value
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityVisibility" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Codemarkup.Types.EntityVisibility x k v
+  getFactKey = Glean.Schema.Codemarkup.Types.entityVisibility_key
+  getFactValue = Glean.Schema.Codemarkup.Types.entityVisibility_value
+{-# LINE 762 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.EntityVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 768 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityXRefRangeSpans_key"
+           (Prelude.Just 0))
+{-# LINE 779 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 781 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans
+       = Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityXRefRangeSpans" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.fileEntityXRefRangeSpans_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.fileEntityXRefRangeSpans_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 790 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefRangeSpans
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 796 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityDigest_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityDigest_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityDigest_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityDigest_key"
+           (Prelude.Just 0))
+{-# LINE 805 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityDigest_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 807 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityDigest
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityDigest =
+       Glean.Schema.Codemarkup.Types.FileEntityDigest_key
+  type ValueType Glean.Schema.Codemarkup.Types.FileEntityDigest =
+       Glean.Schema.Codemarkup.Types.FileEntityDigest_value
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityDigest" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityDigest_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Codemarkup.Types.FileEntityDigest x k v
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityDigest_key
+  getFactValue = Glean.Schema.Codemarkup.Types.fileEntityDigest_value
+{-# LINE 818 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.FileEntityDigest
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 824 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityIsDefinition
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityIsDefinition =
+       Glean.Schema.Code.Types.Entity
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityIsDefinition" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityIsDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityIsDefinition x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityIsDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 833 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityIsDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 839 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityXRefLocations_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefLocations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 850 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 852 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityXRefLocations
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityXRefLocations
+       = Glean.Schema.Codemarkup.Types.FileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileEntityXRefLocations" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.fileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.fileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 861 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 867 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileEntityInfos_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileEntityInfos_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileEntityInfos_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileEntityInfos_key" (Prelude.Just 0))
+{-# LINE 878 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileEntityInfos_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "info"
+             (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+             ('Angle.TNoFields)))
+{-# LINE 880 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileEntityInfos
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileEntityInfos =
+       Glean.Schema.Codemarkup.Types.FileEntityInfos_key
+  getName _proxy = Glean.PredicateRef "codemarkup.FileEntityInfos" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.fileEntityInfos_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileEntityInfos x k
+  getFactKey = Glean.Schema.Codemarkup.Types.fileEntityInfos_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 889 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.FileEntityInfos
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 895 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FileXRefsGenericEntities_key"
+           (Prelude.Just 0))
+{-# LINE 904 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "genEntity"
+          (Glean.Schema.Codemarkup.Types.GenericEntity)
+          ('Angle.TNoFields))
+{-# LINE 906 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities
+       = Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FileXRefsGenericEntities" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Codemarkup.Types.fileXRefsGenericEntities_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities x k
+  getFactKey
+    = Glean.Schema.Codemarkup.Types.fileXRefsGenericEntities_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 915 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FileXRefsGenericEntities
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 921 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FindEntityDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.FindEntityDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.FindEntityDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.FindEntityDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 930 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.FindEntityDefinition_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "definition" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 932 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.FindEntityDefinition
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.FindEntityDefinition =
+       Glean.Schema.Codemarkup.Types.FindEntityDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.FindEntityDefinition" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.findEntityDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.FindEntityDefinition x k
+  getFactKey = Glean.Schema.Codemarkup.Types.findEntityDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 941 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.FindEntityDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 947 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Codemarkup.Types.EntityDataAvailable
+         where
+  type KeyType Glean.Schema.Codemarkup.Types.EntityDataAvailable =
+       Glean.Schema.Src.Types.File
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.EntityDataAvailable" 30
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Codemarkup.Types.entityDataAvailable_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Codemarkup.Types.EntityDataAvailable x k
+  getFactKey = Glean.Schema.Codemarkup.Types.entityDataAvailable_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 956 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.EntityDataAvailable
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 962 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.ChildEntity where
+  buildRtsValue b (Glean.Schema.Codemarkup.Types.ChildEntity x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ChildEntity <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ChildEntity" (Prelude.Just 30))
+{-# LINE 971 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.ChildEntity =
+     'Angle.TField "child" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 973 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.ParentEntity
+         where
+  buildRtsValue b (Glean.Schema.Codemarkup.Types.ParentEntity x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.ParentEntity <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.ParentEntity" (Prelude.Just 30))
+{-# LINE 982 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Codemarkup.Types.ParentEntity =
+     'Angle.TField "parent" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 984 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.RelationType
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.RelationType" (Prelude.Just 30))
+{-# LINE 989 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Codemarkup.Types.RelationType =
+     'Angle.TField "ExtendsParentOfChild"
+       (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "ExtendsChildOfParent"
+          (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "ContainsChildOfParent"
+             (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "ContainsParentOfChild"
+                (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "RequireExtendsParentOfChild"
+                   (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "RequireImplementsParentOfChild"
+                      (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "RequireClassParentOfChild"
+                         (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TNoFields)))))))
+{-# LINE 991 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Codemarkup.Types.RelationType
+         where
+  type AngleEnumTy Glean.Schema.Codemarkup.Types.RelationType =
+       Glean.Schema.Codemarkup.Types.RelationType
+  enumName v = Text.pack (Prelude.drop 13 (Prelude.show v))
+{-# LINE 995 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.SearchStyle where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.SearchStyle" (Prelude.Just 30))
+{-# LINE 1000 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Codemarkup.Types.SearchStyle =
+     'Angle.TField "ShowAll" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "HideUninteresting"
+          (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 1002 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Codemarkup.Types.SearchStyle
+         where
+  type AngleEnumTy Glean.Schema.Codemarkup.Types.SearchStyle =
+       Glean.Schema.Codemarkup.Types.SearchStyle
+  enumName v = Text.pack (Prelude.drop 12 (Prelude.show v))
+{-# LINE 1006 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type Glean.Schema.Codemarkup.Types.GenericEntity
+         where
+  buildRtsValue b Glean.Schema.Codemarkup.Types.GenericEntity_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Codemarkup.Types.GenericEntity_EMPTY)
+        [Glean.mapD
+           Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity,
+         Glean.mapD Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity,
+         Glean.mapD Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.GenericEntity" (Prelude.Just 30))
+{-# LINE 1026 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Codemarkup.Types.GenericEntity =
+     'Angle.TField "plainEntity"
+       (Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity_)
+       ('Angle.TField "xlangEntity"
+          (Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity_)
+          ('Angle.TField "xlangSymbol"
+             (Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol_)
+             ('Angle.TNoFields)))
+{-# LINE 1028 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity_
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.GenericEntity_plainEntity_"
+           (Prelude.Just 0))
+{-# LINE 1037 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.GenericEntity_plainEntity_
+     =
+     'Angle.TField "xref"
+       (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1039 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity_
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.GenericEntity_xlangEntity_"
+           (Prelude.Just 0))
+{-# LINE 1048 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.GenericEntity_xlangEntity_
+     =
+     'Angle.TField "source"
+       (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.IdlEntity)
+          ('Angle.TNoFields))
+{-# LINE 1050 "glean/schema/thrift/codemarkup_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol_
+         where
+  buildRtsValue b
+    (Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.GenericEntity_xlangSymbol_"
+           (Prelude.Just 0))
+{-# LINE 1059 "glean/schema/thrift/codemarkup_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Codemarkup.Types.GenericEntity_xlangSymbol_
+     =
+     'Angle.TField "source"
+       (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+       ('Angle.TField "symbol" (Glean.Schema.Code.Types.SymbolId)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupAnglelang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupAnglelang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupAnglelang/Types.hs
@@ -0,0 +1,1005 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupAnglelang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupAnglelang.Types
+       (pREDICATE_VERSIONS, AngleResolveLocation_id,
+        AngleResolveLocation(AngleResolveLocation, angleResolveLocation_id,
+                             angleResolveLocation_key),
+        AngleFileEntityXRefLocations_id,
+        AngleFileEntityXRefLocations(AngleFileEntityXRefLocations,
+                                     angleFileEntityXRefLocations_id,
+                                     angleFileEntityXRefLocations_key),
+        AngleEntityUses_id,
+        AngleEntityUses(AngleEntityUses, angleEntityUses_id,
+                        angleEntityUses_key),
+        AngleEntityLocation_id,
+        AngleEntityLocation(AngleEntityLocation, angleEntityLocation_id,
+                            angleEntityLocation_key),
+        AngleResolveLocation_key(AngleResolveLocation_key,
+                                 angleResolveLocation_key_location,
+                                 angleResolveLocation_key_entity),
+        AngleFileEntityXRefLocations_key(AngleFileEntityXRefLocations_key,
+                                         angleFileEntityXRefLocations_key_file,
+                                         angleFileEntityXRefLocations_key_xref,
+                                         angleFileEntityXRefLocations_key_entity),
+        AngleEntityUses_key(AngleEntityUses_key,
+                            angleEntityUses_key_target, angleEntityUses_key_file,
+                            angleEntityUses_key_span),
+        AngleEntityLocation_key(AngleEntityLocation_key,
+                                angleEntityLocation_key_entity, angleEntityLocation_key_location))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeAnglelang.Types
+       as Glean.Schema.CodeAnglelang
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Schema.CodeAnglelang.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 104 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupAnglelang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("AngleFileEntityXRefLocations", 1), ("AngleEntityLocation", 1),
+       ("AngleResolveLocation", 1), ("AngleEntityUses", 1)]
+
+type AngleResolveLocation_id = Glean.Id
+
+data AngleResolveLocation = AngleResolveLocation{angleResolveLocation_id
+                                                 :: {-# UNPACK #-} !AngleResolveLocation_id,
+                                                 angleResolveLocation_key ::
+                                                 Prelude.Maybe AngleResolveLocation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleResolveLocation where
+  toJSON (AngleResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleResolveLocation where
+  buildStruct _proxy (AngleResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AngleResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleResolveLocation where
+  rnf (AngleResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleResolveLocation where
+  def = AngleResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleResolveLocation where
+  hashWithSalt __salt (AngleResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AngleFileEntityXRefLocations_id = Glean.Id
+
+data AngleFileEntityXRefLocations = AngleFileEntityXRefLocations{angleFileEntityXRefLocations_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !AngleFileEntityXRefLocations_id,
+                                                                 angleFileEntityXRefLocations_key ::
+                                                                 Prelude.Maybe
+                                                                   AngleFileEntityXRefLocations_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleFileEntityXRefLocations where
+  toJSON (AngleFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleFileEntityXRefLocations where
+  buildStruct _proxy
+    (AngleFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AngleFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleFileEntityXRefLocations where
+  rnf (AngleFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleFileEntityXRefLocations where
+  def = AngleFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleFileEntityXRefLocations where
+  hashWithSalt __salt (AngleFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AngleEntityUses_id = Glean.Id
+
+data AngleEntityUses = AngleEntityUses{angleEntityUses_id ::
+                                       {-# UNPACK #-} !AngleEntityUses_id,
+                                       angleEntityUses_key :: Prelude.Maybe AngleEntityUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleEntityUses where
+  toJSON (AngleEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleEntityUses where
+  buildStruct _proxy (AngleEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AngleEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleEntityUses where
+  rnf (AngleEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleEntityUses where
+  def = AngleEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleEntityUses where
+  hashWithSalt __salt (AngleEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AngleEntityLocation_id = Glean.Id
+
+data AngleEntityLocation = AngleEntityLocation{angleEntityLocation_id
+                                               :: {-# UNPACK #-} !AngleEntityLocation_id,
+                                               angleEntityLocation_key ::
+                                               Prelude.Maybe AngleEntityLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleEntityLocation where
+  toJSON (AngleEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleEntityLocation where
+  buildStruct _proxy (AngleEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AngleEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleEntityLocation where
+  rnf (AngleEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleEntityLocation where
+  def = AngleEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleEntityLocation where
+  hashWithSalt __salt (AngleEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data AngleResolveLocation_key = AngleResolveLocation_key{angleResolveLocation_key_location
+                                                         :: Glean.Schema.CodemarkupTypes.Location,
+                                                         angleResolveLocation_key_entity ::
+                                                         Glean.Schema.CodeAnglelang.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleResolveLocation_key where
+  toJSON (AngleResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleResolveLocation_key where
+  buildStruct _proxy
+    (AngleResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (AngleResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleResolveLocation_key where
+  rnf (AngleResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default AngleResolveLocation_key where
+  def = AngleResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable AngleResolveLocation_key where
+  hashWithSalt __salt (AngleResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data AngleFileEntityXRefLocations_key = AngleFileEntityXRefLocations_key{angleFileEntityXRefLocations_key_file
+                                                                         :: Glean.Schema.Src.File,
+                                                                         angleFileEntityXRefLocations_key_xref
+                                                                         ::
+                                                                         Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                         angleFileEntityXRefLocations_key_entity
+                                                                         ::
+                                                                         Glean.Schema.CodeAnglelang.Entity}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleFileEntityXRefLocations_key where
+  toJSON
+    (AngleFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (AngleFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (AngleFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleFileEntityXRefLocations_key where
+  rnf
+    (AngleFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default AngleFileEntityXRefLocations_key where
+  def
+    = AngleFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable AngleFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (AngleFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data AngleEntityUses_key = AngleEntityUses_key{angleEntityUses_key_target
+                                               :: Glean.Schema.CodeAnglelang.Entity,
+                                               angleEntityUses_key_file :: Glean.Schema.Src.File,
+                                               angleEntityUses_key_span ::
+                                               Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleEntityUses_key where
+  toJSON
+    (AngleEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleEntityUses_key where
+  buildStruct _proxy
+    (AngleEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (AngleEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleEntityUses_key where
+  rnf
+    (AngleEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default AngleEntityUses_key where
+  def = AngleEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable AngleEntityUses_key where
+  hashWithSalt __salt (AngleEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data AngleEntityLocation_key = AngleEntityLocation_key{angleEntityLocation_key_entity
+                                                       :: Glean.Schema.CodeAnglelang.Entity,
+                                                       angleEntityLocation_key_location ::
+                                                       Glean.Schema.CodemarkupTypes.Location}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleEntityLocation_key where
+  toJSON (AngleEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleEntityLocation_key where
+  buildStruct _proxy
+    (AngleEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (AngleEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleEntityLocation_key where
+  rnf (AngleEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default AngleEntityLocation_key where
+  def = AngleEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable AngleEntityLocation_key where
+  hashWithSalt __salt (AngleEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+{-# LINE 20 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.anglelang.AngleFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeAnglelang.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 33 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.anglelang.AngleFileEntityXRefLocations"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupAnglelang.Types.angleFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupAnglelang.Types.angleFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 49 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.anglelang.AngleEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeAnglelang.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 60 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation
+       = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.anglelang.AngleEntityLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupAnglelang.Types.angleEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupAnglelang.Types.angleEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 70 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 76 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.anglelang.AngleResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeAnglelang.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 87 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation
+       = Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.anglelang.AngleResolveLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupAnglelang.Types.angleResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupAnglelang.Types.angleResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.anglelang.AngleEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeAnglelang.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 116 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses
+       = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.anglelang.AngleEntityUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupAnglelang.Types.angleEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupAnglelang.Types.angleEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/codemarkup_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupAnglelang.Types.AngleEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupBuck/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupBuck/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupBuck/Types.hs
@@ -0,0 +1,1199 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupBuck/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupBuck.Types
+       (pREDICATE_VERSIONS, BuckResolveLocation_id,
+        BuckResolveLocation(BuckResolveLocation, buckResolveLocation_id,
+                            buckResolveLocation_key),
+        BuckFileEntityXRefLocations_id,
+        BuckFileEntityXRefLocations(BuckFileEntityXRefLocations,
+                                    buckFileEntityXRefLocations_id,
+                                    buckFileEntityXRefLocations_key),
+        BuckEntityUses_id,
+        BuckEntityUses(BuckEntityUses, buckEntityUses_id,
+                       buckEntityUses_key),
+        BuckEntityLocation_id,
+        BuckEntityLocation(BuckEntityLocation, buckEntityLocation_id,
+                           buckEntityLocation_key),
+        BuckEntityKind_id,
+        BuckEntityKind(BuckEntityKind, buckEntityKind_id,
+                       buckEntityKind_key),
+        BuckResolveLocation_key(BuckResolveLocation_key,
+                                buckResolveLocation_key_location, buckResolveLocation_key_entity),
+        BuckFileEntityXRefLocations_key(BuckFileEntityXRefLocations_key,
+                                        buckFileEntityXRefLocations_key_file,
+                                        buckFileEntityXRefLocations_key_xref,
+                                        buckFileEntityXRefLocations_key_entity),
+        BuckEntityUses_key(BuckEntityUses_key, buckEntityUses_key_target,
+                           buckEntityUses_key_file, buckEntityUses_key_span),
+        BuckEntityLocation_key(BuckEntityLocation_key,
+                               buckEntityLocation_key_entity, buckEntityLocation_key_location),
+        BuckEntityKind_key(BuckEntityKind_key, buckEntityKind_key_entity,
+                           buckEntityKind_key_kind))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeBuck.Types
+       as Glean.Schema.CodeBuck
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Schema.CodeBuck.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 107 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupBuck/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("BuckEntityKind", 2), ("BuckFileEntityXRefLocations", 2),
+       ("BuckEntityUses", 2), ("BuckResolveLocation", 2),
+       ("BuckEntityLocation", 2)]
+
+type BuckResolveLocation_id = Glean.Id
+
+data BuckResolveLocation = BuckResolveLocation{buckResolveLocation_id
+                                               :: {-# UNPACK #-} !BuckResolveLocation_id,
+                                               buckResolveLocation_key ::
+                                               Prelude.Maybe BuckResolveLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckResolveLocation where
+  toJSON (BuckResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckResolveLocation where
+  buildStruct _proxy (BuckResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BuckResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckResolveLocation where
+  rnf (BuckResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckResolveLocation where
+  def = BuckResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckResolveLocation where
+  hashWithSalt __salt (BuckResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckFileEntityXRefLocations_id = Glean.Id
+
+data BuckFileEntityXRefLocations = BuckFileEntityXRefLocations{buckFileEntityXRefLocations_id
+                                                               ::
+                                                               {-# UNPACK #-} !BuckFileEntityXRefLocations_id,
+                                                               buckFileEntityXRefLocations_key ::
+                                                               Prelude.Maybe
+                                                                 BuckFileEntityXRefLocations_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckFileEntityXRefLocations where
+  toJSON (BuckFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckFileEntityXRefLocations where
+  buildStruct _proxy
+    (BuckFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (BuckFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckFileEntityXRefLocations where
+  rnf (BuckFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckFileEntityXRefLocations where
+  def = BuckFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckFileEntityXRefLocations where
+  hashWithSalt __salt (BuckFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckEntityUses_id = Glean.Id
+
+data BuckEntityUses = BuckEntityUses{buckEntityUses_id ::
+                                     {-# UNPACK #-} !BuckEntityUses_id,
+                                     buckEntityUses_key :: Prelude.Maybe BuckEntityUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityUses where
+  toJSON (BuckEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityUses where
+  buildStruct _proxy (BuckEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BuckEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityUses where
+  rnf (BuckEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckEntityUses where
+  def = BuckEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckEntityUses where
+  hashWithSalt __salt (BuckEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckEntityLocation_id = Glean.Id
+
+data BuckEntityLocation = BuckEntityLocation{buckEntityLocation_id
+                                             :: {-# UNPACK #-} !BuckEntityLocation_id,
+                                             buckEntityLocation_key ::
+                                             Prelude.Maybe BuckEntityLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityLocation where
+  toJSON (BuckEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityLocation where
+  buildStruct _proxy (BuckEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BuckEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityLocation where
+  rnf (BuckEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckEntityLocation where
+  def = BuckEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckEntityLocation where
+  hashWithSalt __salt (BuckEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckEntityKind_id = Glean.Id
+
+data BuckEntityKind = BuckEntityKind{buckEntityKind_id ::
+                                     {-# UNPACK #-} !BuckEntityKind_id,
+                                     buckEntityKind_key :: Prelude.Maybe BuckEntityKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityKind where
+  toJSON (BuckEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityKind where
+  buildStruct _proxy (BuckEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BuckEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityKind where
+  rnf (BuckEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckEntityKind where
+  def = BuckEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckEntityKind where
+  hashWithSalt __salt (BuckEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data BuckResolveLocation_key = BuckResolveLocation_key{buckResolveLocation_key_location
+                                                       :: Glean.Schema.CodemarkupTypes.Location,
+                                                       buckResolveLocation_key_entity ::
+                                                       Glean.Schema.CodeBuck.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckResolveLocation_key where
+  toJSON (BuckResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckResolveLocation_key where
+  buildStruct _proxy
+    (BuckResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (BuckResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckResolveLocation_key where
+  rnf (BuckResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default BuckResolveLocation_key where
+  def = BuckResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable BuckResolveLocation_key where
+  hashWithSalt __salt (BuckResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data BuckFileEntityXRefLocations_key = BuckFileEntityXRefLocations_key{buckFileEntityXRefLocations_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       buckFileEntityXRefLocations_key_xref
+                                                                       ::
+                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                       buckFileEntityXRefLocations_key_entity
+                                                                       ::
+                                                                       Glean.Schema.CodeBuck.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckFileEntityXRefLocations_key where
+  toJSON
+    (BuckFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (BuckFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (BuckFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckFileEntityXRefLocations_key where
+  rnf
+    (BuckFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default BuckFileEntityXRefLocations_key where
+  def
+    = BuckFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable BuckFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (BuckFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data BuckEntityUses_key = BuckEntityUses_key{buckEntityUses_key_target
+                                             :: Glean.Schema.CodeBuck.Entity,
+                                             buckEntityUses_key_file :: Glean.Schema.Src.File,
+                                             buckEntityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityUses_key where
+  toJSON
+    (BuckEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityUses_key where
+  buildStruct _proxy
+    (BuckEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (BuckEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityUses_key where
+  rnf
+    (BuckEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default BuckEntityUses_key where
+  def = BuckEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable BuckEntityUses_key where
+  hashWithSalt __salt (BuckEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data BuckEntityLocation_key = BuckEntityLocation_key{buckEntityLocation_key_entity
+                                                     :: Glean.Schema.CodeBuck.Entity,
+                                                     buckEntityLocation_key_location ::
+                                                     Glean.Schema.CodemarkupTypes.Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityLocation_key where
+  toJSON (BuckEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityLocation_key where
+  buildStruct _proxy
+    (BuckEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (BuckEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityLocation_key where
+  rnf (BuckEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default BuckEntityLocation_key where
+  def = BuckEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable BuckEntityLocation_key where
+  hashWithSalt __salt (BuckEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data BuckEntityKind_key = BuckEntityKind_key{buckEntityKind_key_entity
+                                             :: Glean.Schema.CodeBuck.Entity,
+                                             buckEntityKind_key_kind ::
+                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckEntityKind_key where
+  toJSON (BuckEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckEntityKind_key where
+  buildStruct _proxy
+    (BuckEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (BuckEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckEntityKind_key where
+  rnf (BuckEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default BuckEntityKind_key where
+  def = BuckEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable BuckEntityKind_key where
+  hashWithSalt __salt (BuckEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+{-# LINE 20 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupBuck.Types.BuckEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.buck.BuckEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupBuck.Types.BuckEntityKind =
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.buck.BuckEntityKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupBuck.Types.buckEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityKind x k
+  getFactKey = Glean.Schema.CodemarkupBuck.Types.buckEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.buck.BuckFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 59 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations
+       = Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.buck.BuckFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupBuck.Types.buckFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupBuck.Types.buckFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 69 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 75 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupBuck.Types.BuckEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.buck.BuckEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 86 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeBuck.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 88 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupBuck.Types.BuckEntityUses =
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.buck.BuckEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupBuck.Types.buckEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupBuck.Types.buckEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.buck.BuckResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 112 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 114 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation
+       = Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.buck.BuckResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupBuck.Types.buckResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupBuck.Types.buckResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 123 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 129 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.buck.BuckEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 138 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 140 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation =
+       Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.buck.BuckEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupBuck.Types.buckEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupBuck.Types.buckEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 149 "glean/schema/thrift/codemarkup_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupBuck.Types.BuckEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCsharp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCsharp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCsharp/Types.hs
@@ -0,0 +1,1220 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCsharp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupCsharp.Types
+       (pREDICATE_VERSIONS, CSharpResolveLocation_id,
+        CSharpResolveLocation(CSharpResolveLocation,
+                              cSharpResolveLocation_id, cSharpResolveLocation_key),
+        CSharpFileEntityXRefLocations_id,
+        CSharpFileEntityXRefLocations(CSharpFileEntityXRefLocations,
+                                      cSharpFileEntityXRefLocations_id,
+                                      cSharpFileEntityXRefLocations_key),
+        CSharpEntityUses_id,
+        CSharpEntityUses(CSharpEntityUses, cSharpEntityUses_id,
+                         cSharpEntityUses_key),
+        CSharpEntityLocation_id,
+        CSharpEntityLocation(CSharpEntityLocation, cSharpEntityLocation_id,
+                             cSharpEntityLocation_key),
+        CSharpEntityKind_id,
+        CSharpEntityKind(CSharpEntityKind, cSharpEntityKind_id,
+                         cSharpEntityKind_key),
+        CSharpResolveLocation_key(CSharpResolveLocation_key,
+                                  cSharpResolveLocation_key_location,
+                                  cSharpResolveLocation_key_entity),
+        CSharpFileEntityXRefLocations_key(CSharpFileEntityXRefLocations_key,
+                                          cSharpFileEntityXRefLocations_key_file,
+                                          cSharpFileEntityXRefLocations_key_xref,
+                                          cSharpFileEntityXRefLocations_key_entity),
+        CSharpEntityUses_key(CSharpEntityUses_key,
+                             cSharpEntityUses_key_target, cSharpEntityUses_key_file,
+                             cSharpEntityUses_key_span),
+        CSharpEntityLocation_key(CSharpEntityLocation_key,
+                                 cSharpEntityLocation_key_entity,
+                                 cSharpEntityLocation_key_location),
+        CSharpEntityKind_key(CSharpEntityKind_key,
+                             cSharpEntityKind_key_entity, cSharpEntityKind_key_kind))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeCsharp.Types
+       as Glean.Schema.CodeCsharp
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Schema.CodeCsharp.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 110 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCsharp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("CSharpEntityLocation", 1), ("CSharpEntityUses", 1),
+       ("CSharpResolveLocation", 1), ("CSharpEntityKind", 1),
+       ("CSharpFileEntityXRefLocations", 1)]
+
+type CSharpResolveLocation_id = Glean.Id
+
+data CSharpResolveLocation = CSharpResolveLocation{cSharpResolveLocation_id
+                                                   :: {-# UNPACK #-} !CSharpResolveLocation_id,
+                                                   cSharpResolveLocation_key ::
+                                                   Prelude.Maybe CSharpResolveLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpResolveLocation where
+  toJSON (CSharpResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpResolveLocation where
+  buildStruct _proxy (CSharpResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CSharpResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpResolveLocation where
+  rnf (CSharpResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpResolveLocation where
+  def = CSharpResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpResolveLocation where
+  hashWithSalt __salt (CSharpResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpFileEntityXRefLocations_id = Glean.Id
+
+data CSharpFileEntityXRefLocations = CSharpFileEntityXRefLocations{cSharpFileEntityXRefLocations_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !CSharpFileEntityXRefLocations_id,
+                                                                   cSharpFileEntityXRefLocations_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     CSharpFileEntityXRefLocations_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpFileEntityXRefLocations where
+  toJSON (CSharpFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpFileEntityXRefLocations where
+  buildStruct _proxy
+    (CSharpFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CSharpFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpFileEntityXRefLocations where
+  rnf (CSharpFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpFileEntityXRefLocations where
+  def = CSharpFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpFileEntityXRefLocations where
+  hashWithSalt __salt (CSharpFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpEntityUses_id = Glean.Id
+
+data CSharpEntityUses = CSharpEntityUses{cSharpEntityUses_id ::
+                                         {-# UNPACK #-} !CSharpEntityUses_id,
+                                         cSharpEntityUses_key :: Prelude.Maybe CSharpEntityUses_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityUses where
+  toJSON (CSharpEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityUses where
+  buildStruct _proxy (CSharpEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CSharpEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityUses where
+  rnf (CSharpEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpEntityUses where
+  def = CSharpEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpEntityUses where
+  hashWithSalt __salt (CSharpEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpEntityLocation_id = Glean.Id
+
+data CSharpEntityLocation = CSharpEntityLocation{cSharpEntityLocation_id
+                                                 :: {-# UNPACK #-} !CSharpEntityLocation_id,
+                                                 cSharpEntityLocation_key ::
+                                                 Prelude.Maybe CSharpEntityLocation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityLocation where
+  toJSON (CSharpEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityLocation where
+  buildStruct _proxy (CSharpEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CSharpEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityLocation where
+  rnf (CSharpEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpEntityLocation where
+  def = CSharpEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpEntityLocation where
+  hashWithSalt __salt (CSharpEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpEntityKind_id = Glean.Id
+
+data CSharpEntityKind = CSharpEntityKind{cSharpEntityKind_id ::
+                                         {-# UNPACK #-} !CSharpEntityKind_id,
+                                         cSharpEntityKind_key :: Prelude.Maybe CSharpEntityKind_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityKind where
+  toJSON (CSharpEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityKind where
+  buildStruct _proxy (CSharpEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CSharpEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityKind where
+  rnf (CSharpEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpEntityKind where
+  def = CSharpEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpEntityKind where
+  hashWithSalt __salt (CSharpEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data CSharpResolveLocation_key = CSharpResolveLocation_key{cSharpResolveLocation_key_location
+                                                           :: Glean.Schema.CodemarkupTypes.Location,
+                                                           cSharpResolveLocation_key_entity ::
+                                                           Glean.Schema.CodeCsharp.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpResolveLocation_key where
+  toJSON
+    (CSharpResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpResolveLocation_key where
+  buildStruct _proxy
+    (CSharpResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CSharpResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpResolveLocation_key where
+  rnf (CSharpResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CSharpResolveLocation_key where
+  def = CSharpResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable CSharpResolveLocation_key where
+  hashWithSalt __salt (CSharpResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data CSharpFileEntityXRefLocations_key = CSharpFileEntityXRefLocations_key{cSharpFileEntityXRefLocations_key_file
+                                                                           :: Glean.Schema.Src.File,
+                                                                           cSharpFileEntityXRefLocations_key_xref
+                                                                           ::
+                                                                           Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                           cSharpFileEntityXRefLocations_key_entity
+                                                                           ::
+                                                                           Glean.Schema.CodeCsharp.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpFileEntityXRefLocations_key where
+  toJSON
+    (CSharpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (CSharpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CSharpFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpFileEntityXRefLocations_key where
+  rnf
+    (CSharpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CSharpFileEntityXRefLocations_key where
+  def
+    = CSharpFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CSharpFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (CSharpFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data CSharpEntityUses_key = CSharpEntityUses_key{cSharpEntityUses_key_target
+                                                 :: Glean.Schema.CodeCsharp.Entity,
+                                                 cSharpEntityUses_key_file :: Glean.Schema.Src.File,
+                                                 cSharpEntityUses_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityUses_key where
+  toJSON
+    (CSharpEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityUses_key where
+  buildStruct _proxy
+    (CSharpEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (CSharpEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityUses_key where
+  rnf
+    (CSharpEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default CSharpEntityUses_key where
+  def = CSharpEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CSharpEntityUses_key where
+  hashWithSalt __salt (CSharpEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data CSharpEntityLocation_key = CSharpEntityLocation_key{cSharpEntityLocation_key_entity
+                                                         :: Glean.Schema.CodeCsharp.Entity,
+                                                         cSharpEntityLocation_key_location ::
+                                                         Glean.Schema.CodemarkupTypes.Location}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityLocation_key where
+  toJSON (CSharpEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityLocation_key where
+  buildStruct _proxy
+    (CSharpEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CSharpEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityLocation_key where
+  rnf (CSharpEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default CSharpEntityLocation_key where
+  def = CSharpEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable CSharpEntityLocation_key where
+  hashWithSalt __salt (CSharpEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data CSharpEntityKind_key = CSharpEntityKind_key{cSharpEntityKind_key_entity
+                                                 :: Glean.Schema.CodeCsharp.Entity,
+                                                 cSharpEntityKind_key_kind ::
+                                                 Glean.Schema.CodemarkupTypes.SymbolKind}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpEntityKind_key where
+  toJSON (CSharpEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpEntityKind_key where
+  buildStruct _proxy
+    (CSharpEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (CSharpEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpEntityKind_key where
+  rnf (CSharpEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default CSharpEntityKind_key where
+  def = CSharpEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable CSharpEntityKind_key where
+  hashWithSalt __salt (CSharpEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+{-# LINE 20 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.csharp.CSharpEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCsharp.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation
+       = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.csharp.CSharpEntityLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCsharp.Types.cSharpEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCsharp.Types.cSharpEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.csharp.CSharpEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeCsharp.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 60 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses =
+       Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.csharp.CSharpEntityUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCsharp.Types.cSharpEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupCsharp.Types.cSharpEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 69 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 75 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.csharp.CSharpResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 84 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeCsharp.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 86 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation
+       = Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.csharp.CSharpResolveLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCsharp.Types.cSharpResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCsharp.Types.cSharpResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.csharp.CSharpEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 111 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCsharp.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 113 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind =
+       Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.csharp.CSharpEntityKind" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCsharp.Types.cSharpEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind x k
+  getFactKey
+    = Glean.Schema.CodemarkupCsharp.Types.cSharpEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 122 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 128 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.csharp.CSharpFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 139 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeCsharp.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 141 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.csharp.CSharpFileEntityXRefLocations"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCsharp.Types.cSharpFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCsharp.Types.cSharpFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/codemarkup_csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCsharp.Types.CSharpFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCxx/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCxx/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCxx/Types.hs
@@ -0,0 +1,11995 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCxx/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupCxx.Types
+       (pREDICATE_VERSIONS, XRefTargetToEntity_id,
+        XRefTargetToEntity(XRefTargetToEntity, xRefTargetToEntity_id,
+                           xRefTargetToEntity_key),
+        SymbolToEntity_id,
+        SymbolToEntity(SymbolToEntity, symbolToEntity_id,
+                       symbolToEntity_key),
+        FromCxxVisibility_id,
+        FromCxxVisibility(FromCxxVisibility, fromCxxVisibility_id,
+                          fromCxxVisibility_key),
+        EntityToXRefTarget_id,
+        EntityToXRefTarget(EntityToXRefTarget, entityToXRefTarget_id,
+                           entityToXRefTarget_key),
+        CxxXRefTargetLocation_id,
+        CxxXRefTargetLocation(CxxXRefTargetLocation,
+                              cxxXRefTargetLocation_id, cxxXRefTargetLocation_key),
+        CxxVisibility_id,
+        CxxVisibility(CxxVisibility, cxxVisibility_id, cxxVisibility_key),
+        CxxResolveTraceLocation_id,
+        CxxResolveTraceLocation(CxxResolveTraceLocation,
+                                cxxResolveTraceLocation_id, cxxResolveTraceLocation_key),
+        CxxResolveLocation_id,
+        CxxResolveLocation(CxxResolveLocation, cxxResolveLocation_id,
+                           cxxResolveLocation_key),
+        CxxResolveDeclarationToEntity_id,
+        CxxResolveDeclarationToEntity(CxxResolveDeclarationToEntity,
+                                      cxxResolveDeclarationToEntity_id,
+                                      cxxResolveDeclarationToEntity_key),
+        CxxNamespaceDeclarationContainsChild_id,
+        CxxNamespaceDeclarationContainsChild(CxxNamespaceDeclarationContainsChild,
+                                             cxxNamespaceDeclarationContainsChild_id,
+                                             cxxNamespaceDeclarationContainsChild_key),
+        CxxModifiers_id,
+        CxxModifiers(CxxModifiers, cxxModifiers_id, cxxModifiers_key),
+        CxxIdlEntityUses_id,
+        CxxIdlEntityUses(CxxIdlEntityUses, cxxIdlEntityUses_id,
+                         cxxIdlEntityUses_key),
+        CxxFindDefinitionOfEntity_id,
+        CxxFindDefinitionOfEntity(CxxFindDefinitionOfEntity,
+                                  cxxFindDefinitionOfEntity_id, cxxFindDefinitionOfEntity_key),
+        CxxFileEntityXRefLocations_id,
+        CxxFileEntityXRefLocations(CxxFileEntityXRefLocations,
+                                   cxxFileEntityXRefLocations_id, cxxFileEntityXRefLocations_key),
+        CxxFileEntityXMapVariableXRefDeclToDefs_id,
+        CxxFileEntityXMapVariableXRefDeclToDefs(CxxFileEntityXMapVariableXRefDeclToDefs,
+                                                cxxFileEntityXMapVariableXRefDeclToDefs_id,
+                                                cxxFileEntityXMapVariableXRefDeclToDefs_key),
+        CxxFileEntityXMapVariableXRefDeclLocations_id,
+        CxxFileEntityXMapVariableXRefDeclLocations(CxxFileEntityXMapVariableXRefDeclLocations,
+                                                   cxxFileEntityXMapVariableXRefDeclLocations_id,
+                                                   cxxFileEntityXMapVariableXRefDeclLocations_key),
+        CxxFileEntityXMapFixedXRefLocations_id,
+        CxxFileEntityXMapFixedXRefLocations(CxxFileEntityXMapFixedXRefLocations,
+                                            cxxFileEntityXMapFixedXRefLocations_id,
+                                            cxxFileEntityXMapFixedXRefLocations_key),
+        CxxFileEntityTraceDeclToDefXRefLocations_id,
+        CxxFileEntityTraceDeclToDefXRefLocations(CxxFileEntityTraceDeclToDefXRefLocations,
+                                                 cxxFileEntityTraceDeclToDefXRefLocations_id,
+                                                 cxxFileEntityTraceDeclToDefXRefLocations_key),
+        CxxFileEntitySpellingXRefLocations_id,
+        CxxFileEntitySpellingXRefLocations(CxxFileEntitySpellingXRefLocations,
+                                           cxxFileEntitySpellingXRefLocations_id,
+                                           cxxFileEntitySpellingXRefLocations_key),
+        CxxFileEntityIdl_id,
+        CxxFileEntityIdl(CxxFileEntityIdl, cxxFileEntityIdl_id,
+                         cxxFileEntityIdl_key),
+        CxxExtendsParentEntity_id,
+        CxxExtendsParentEntity(CxxExtendsParentEntity,
+                               cxxExtendsParentEntity_id, cxxExtendsParentEntity_key),
+        CxxExtendsChildEntity_id,
+        CxxExtendsChildEntity(CxxExtendsChildEntity,
+                              cxxExtendsChildEntity_id, cxxExtendsChildEntity_key),
+        CxxEntityUses_id,
+        CxxEntityUses(CxxEntityUses, cxxEntityUses_id, cxxEntityUses_key),
+        CxxEntityUSR_id,
+        CxxEntityUSR(CxxEntityUSR, cxxEntityUSR_id, cxxEntityUSR_key),
+        CxxEntitySource_id,
+        CxxEntitySource(CxxEntitySource, cxxEntitySource_id,
+                        cxxEntitySource_key),
+        CxxEntityMangledNameHash_id,
+        CxxEntityMangledNameHash(CxxEntityMangledNameHash,
+                                 cxxEntityMangledNameHash_id, cxxEntityMangledNameHash_key),
+        CxxEntityLocation_id,
+        CxxEntityLocation(CxxEntityLocation, cxxEntityLocation_id,
+                          cxxEntityLocation_key),
+        CxxEntityKind_id,
+        CxxEntityKind(CxxEntityKind, cxxEntityKind_id, cxxEntityKind_key),
+        CxxEntityInfo_id,
+        CxxEntityInfo(CxxEntityInfo, cxxEntityInfo_id, cxxEntityInfo_key),
+        CxxEntityIdl_id,
+        CxxEntityIdl(CxxEntityIdl, cxxEntityIdl_id, cxxEntityIdl_key),
+        CxxEntityDocumentation_id,
+        CxxEntityDocumentation(CxxEntityDocumentation,
+                               cxxEntityDocumentation_id, cxxEntityDocumentation_key),
+        CxxEntityDefinitionBase_id,
+        CxxEntityDefinitionBase(CxxEntityDefinitionBase,
+                                cxxEntityDefinitionBase_id, cxxEntityDefinitionBase_key),
+        CxxDefnVisibility_id,
+        CxxDefnVisibility(CxxDefnVisibility, cxxDefnVisibility_id,
+                          cxxDefnVisibility_key),
+        CxxDefinitionModifiers_id,
+        CxxDefinitionModifiers(CxxDefinitionModifiers,
+                               cxxDefinitionModifiers_id, cxxDefinitionModifiers_key),
+        CxxDefinitionExtendsParent_id,
+        CxxDefinitionExtendsParent(CxxDefinitionExtendsParent,
+                                   cxxDefinitionExtendsParent_id, cxxDefinitionExtendsParent_key),
+        CxxDefinitionExtendsChild_id,
+        CxxDefinitionExtendsChild(CxxDefinitionExtendsChild,
+                                  cxxDefinitionExtendsChild_id, cxxDefinitionExtendsChild_key),
+        CxxDefinitionContainsParent_id,
+        CxxDefinitionContainsParent(CxxDefinitionContainsParent,
+                                    cxxDefinitionContainsParent_id,
+                                    cxxDefinitionContainsParent_key),
+        CxxDefinitionContainsChild_id,
+        CxxDefinitionContainsChild(CxxDefinitionContainsChild,
+                                   cxxDefinitionContainsChild_id, cxxDefinitionContainsChild_key),
+        CxxDefToDeclFamilyXRefTargetLocation_id,
+        CxxDefToDeclFamilyXRefTargetLocation(CxxDefToDeclFamilyXRefTargetLocation,
+                                             cxxDefToDeclFamilyXRefTargetLocation_id,
+                                             cxxDefToDeclFamilyXRefTargetLocation_key),
+        CxxDeclarationSource_id,
+        CxxDeclarationSource(CxxDeclarationSource, cxxDeclarationSource_id,
+                             cxxDeclarationSource_key),
+        CxxDeclarationModifiers_id,
+        CxxDeclarationModifiers(CxxDeclarationModifiers,
+                                cxxDeclarationModifiers_id, cxxDeclarationModifiers_key),
+        CxxDeclarationExtendsParent_id,
+        CxxDeclarationExtendsParent(CxxDeclarationExtendsParent,
+                                    cxxDeclarationExtendsParent_id,
+                                    cxxDeclarationExtendsParent_key),
+        CxxDeclarationExtendsChild_id,
+        CxxDeclarationExtendsChild(CxxDeclarationExtendsChild,
+                                   cxxDeclarationExtendsChild_id, cxxDeclarationExtendsChild_key),
+        CxxDeclarationContainsParent_id,
+        CxxDeclarationContainsParent(CxxDeclarationContainsParent,
+                                     cxxDeclarationContainsParent_id,
+                                     cxxDeclarationContainsParent_key),
+        CxxDeclarationContainsChild_id,
+        CxxDeclarationContainsChild(CxxDeclarationContainsChild,
+                                    cxxDeclarationContainsChild_id,
+                                    cxxDeclarationContainsChild_key),
+        CxxDeclVisibility_id,
+        CxxDeclVisibility(CxxDeclVisibility, cxxDeclVisibility_id,
+                          cxxDeclVisibility_key),
+        CxxDeclToDefXRefTargetLocation_id,
+        CxxDeclToDefXRefTargetLocation(CxxDeclToDefXRefTargetLocation,
+                                       cxxDeclToDefXRefTargetLocation_id,
+                                       cxxDeclToDefXRefTargetLocation_key),
+        CxxDeclKind_id,
+        CxxDeclKind(CxxDeclKind, cxxDeclKind_id, cxxDeclKind_key),
+        CxxDeclInfo_id,
+        CxxDeclInfo(CxxDeclInfo, cxxDeclInfo_id, cxxDeclInfo_key),
+        CxxDataAvailable_id,
+        CxxDataAvailable(CxxDataAvailable, cxxDataAvailable_id,
+                         cxxDataAvailable_key),
+        CxxContainsParentEntity_id,
+        CxxContainsParentEntity(CxxContainsParentEntity,
+                                cxxContainsParentEntity_id, cxxContainsParentEntity_key),
+        CxxContainsChildEntity_id,
+        CxxContainsChildEntity(CxxContainsChildEntity,
+                               cxxContainsChildEntity_id, cxxContainsChildEntity_key),
+        CxxAnnotation_id,
+        CxxAnnotation(CxxAnnotation, cxxAnnotation_id, cxxAnnotation_key),
+        XRefTargetToEntity_key(XRefTargetToEntity_key,
+                               xRefTargetToEntity_key_xrefTarget, xRefTargetToEntity_key_ent),
+        SymbolToEntity_key(SymbolToEntity_key, symbolToEntity_key_usr,
+                           symbolToEntity_key_entity),
+        FromCxxVisibility_key(FromCxxVisibility_key,
+                              fromCxxVisibility_key_cxx, fromCxxVisibility_key_out),
+        EntityToXRefTarget_key(EntityToXRefTarget_key,
+                               entityToXRefTarget_key_ent, entityToXRefTarget_key_xrefTarget),
+        CxxXRefTargetLocation_key(CxxXRefTargetLocation_key,
+                                  cxxXRefTargetLocation_key_target,
+                                  cxxXRefTargetLocation_key_entity,
+                                  cxxXRefTargetLocation_key_location),
+        CxxVisibility_key(CxxVisibility_key, cxxVisibility_key_entity,
+                          cxxVisibility_key_visibility),
+        CxxResolveTraceLocation_key(CxxResolveTraceLocation_key,
+                                    cxxResolveTraceLocation_key_trace,
+                                    cxxResolveTraceLocation_key_location,
+                                    cxxResolveTraceLocation_key_entity),
+        CxxResolveLocation_key(CxxResolveLocation_key,
+                               cxxResolveLocation_key_location, cxxResolveLocation_key_entity),
+        CxxResolveDeclarationToEntity_key(CxxResolveDeclarationToEntity_key,
+                                          cxxResolveDeclarationToEntity_key_decl,
+                                          cxxResolveDeclarationToEntity_key_entity),
+        CxxNamespaceDeclarationContainsChild_key(CxxNamespaceDeclarationContainsChild_key,
+                                                 cxxNamespaceDeclarationContainsChild_key_parent,
+                                                 cxxNamespaceDeclarationContainsChild_key_child),
+        CxxModifiers_key(CxxModifiers_key, cxxModifiers_key_entity,
+                         cxxModifiers_key_keywords),
+        CxxIdlEntityUses_key(CxxIdlEntityUses_key,
+                             cxxIdlEntityUses_key_target, cxxIdlEntityUses_key_file,
+                             cxxIdlEntityUses_key_span),
+        CxxFindDefinitionOfEntity_key(CxxFindDefinitionOfEntity_key,
+                                      cxxFindDefinitionOfEntity_key_entity,
+                                      cxxFindDefinitionOfEntity_key_definition),
+        CxxFileEntityXRefLocations_key(CxxFileEntityXRefLocations_key,
+                                       cxxFileEntityXRefLocations_key_file,
+                                       cxxFileEntityXRefLocations_key_xref,
+                                       cxxFileEntityXRefLocations_key_entity),
+        CxxFileEntityXMapVariableXRefDeclToDefs_key(CxxFileEntityXMapVariableXRefDeclToDefs_key,
+                                                    cxxFileEntityXMapVariableXRefDeclToDefs_key_trace,
+                                                    cxxFileEntityXMapVariableXRefDeclToDefs_key_source,
+                                                    cxxFileEntityXMapVariableXRefDeclToDefs_key_entity,
+                                                    cxxFileEntityXMapVariableXRefDeclToDefs_key_location),
+        CxxFileEntityXMapVariableXRefDeclLocations_key(CxxFileEntityXMapVariableXRefDeclLocations_key,
+                                                       cxxFileEntityXMapVariableXRefDeclLocations_key_trace,
+                                                       cxxFileEntityXMapVariableXRefDeclLocations_key_source,
+                                                       cxxFileEntityXMapVariableXRefDeclLocations_key_location),
+        CxxFileEntityXMapFixedXRefLocations_key(CxxFileEntityXMapFixedXRefLocations_key,
+                                                cxxFileEntityXMapFixedXRefLocations_key_trace,
+                                                cxxFileEntityXMapFixedXRefLocations_key_xref,
+                                                cxxFileEntityXMapFixedXRefLocations_key_entity),
+        CxxFileEntityTraceDeclToDefXRefLocations_key(CxxFileEntityTraceDeclToDefXRefLocations_key,
+                                                     cxxFileEntityTraceDeclToDefXRefLocations_key_file,
+                                                     cxxFileEntityTraceDeclToDefXRefLocations_key_trace,
+                                                     cxxFileEntityTraceDeclToDefXRefLocations_key_xref,
+                                                     cxxFileEntityTraceDeclToDefXRefLocations_key_entity),
+        CxxFileEntitySpellingXRefLocations_key(CxxFileEntitySpellingXRefLocations_key,
+                                               cxxFileEntitySpellingXRefLocations_key_file,
+                                               cxxFileEntitySpellingXRefLocations_key_xref,
+                                               cxxFileEntitySpellingXRefLocations_key_entity),
+        CxxFileEntityIdl_key(CxxFileEntityIdl_key,
+                             cxxFileEntityIdl_key_trace, cxxFileEntityIdl_key_ent,
+                             cxxFileEntityIdl_key_idlEnt),
+        CxxExtendsParentEntity_key(CxxExtendsParentEntity_key,
+                                   cxxExtendsParentEntity_key_child,
+                                   cxxExtendsParentEntity_key_parent),
+        CxxExtendsChildEntity_key(CxxExtendsChildEntity_key,
+                                  cxxExtendsChildEntity_key_parent,
+                                  cxxExtendsChildEntity_key_child),
+        CxxEntityUses_key(CxxEntityUses_key, cxxEntityUses_key_target,
+                          cxxEntityUses_key_file, cxxEntityUses_key_span),
+        CxxEntityUSR_key(CxxEntityUSR_key, cxxEntityUSR_key_entity,
+                         cxxEntityUSR_key_usr),
+        CxxEntitySource_key(CxxEntitySource_key,
+                            cxxEntitySource_key_target, cxxEntitySource_key_source),
+        CxxEntityMangledNameHash_key(CxxEntityMangledNameHash_key,
+                                     cxxEntityMangledNameHash_key_entity,
+                                     cxxEntityMangledNameHash_key_hash),
+        CxxEntityLocation_key(CxxEntityLocation_key,
+                              cxxEntityLocation_key_entity, cxxEntityLocation_key_location),
+        CxxEntityKind_key(CxxEntityKind_key, cxxEntityKind_key_entity,
+                          cxxEntityKind_key_kind),
+        CxxEntityInfo_key(CxxEntityInfo_key, cxxEntityInfo_key_entity,
+                          cxxEntityInfo_key_info),
+        CxxEntityIdl_key(CxxEntityIdl_key, cxxEntityIdl_key_ent,
+                         cxxEntityIdl_key_idlEnt),
+        CxxEntityDocumentation_key(CxxEntityDocumentation_key,
+                                   cxxEntityDocumentation_key_entity,
+                                   cxxEntityDocumentation_key_file,
+                                   cxxEntityDocumentation_key_span),
+        CxxEntityDefinitionBase_key(CxxEntityDefinitionBase_key,
+                                    cxxEntityDefinitionBase_key_target,
+                                    cxxEntityDefinitionBase_key_base),
+        CxxDefnVisibility_key(CxxDefnVisibility_key,
+                              cxxDefnVisibility_key_decl, cxxDefnVisibility_key_visibility),
+        CxxDefinitionModifiers_key(CxxDefinitionModifiers_key,
+                                   cxxDefinitionModifiers_key_entity,
+                                   cxxDefinitionModifiers_key_keywords),
+        CxxDefinitionExtendsParent_key(CxxDefinitionExtendsParent_key,
+                                       cxxDefinitionExtendsParent_key_child,
+                                       cxxDefinitionExtendsParent_key_parent),
+        CxxDefinitionExtendsChild_key(CxxDefinitionExtendsChild_key,
+                                      cxxDefinitionExtendsChild_key_parent,
+                                      cxxDefinitionExtendsChild_key_child),
+        CxxDefinitionContainsParent_key(CxxDefinitionContainsParent_key,
+                                        cxxDefinitionContainsParent_key_child,
+                                        cxxDefinitionContainsParent_key_parent),
+        CxxDefinitionContainsChild_key(CxxDefinitionContainsChild_key,
+                                       cxxDefinitionContainsChild_key_parent,
+                                       cxxDefinitionContainsChild_key_child),
+        CxxDefToDeclFamilyXRefTargetLocation_key(CxxDefToDeclFamilyXRefTargetLocation_key,
+                                                 cxxDefToDeclFamilyXRefTargetLocation_key_decl,
+                                                 cxxDefToDeclFamilyXRefTargetLocation_key_entity,
+                                                 cxxDefToDeclFamilyXRefTargetLocation_key_location),
+        CxxDeclarationSource_key(CxxDeclarationSource_key,
+                                 cxxDeclarationSource_key_target,
+                                 cxxDeclarationSource_key_referrer),
+        CxxDeclarationModifiers_key(CxxDeclarationModifiers_key,
+                                    cxxDeclarationModifiers_key_entity,
+                                    cxxDeclarationModifiers_key_keywords),
+        CxxDeclarationExtendsParent_key(CxxDeclarationExtendsParent_key,
+                                        cxxDeclarationExtendsParent_key_child,
+                                        cxxDeclarationExtendsParent_key_parent),
+        CxxDeclarationExtendsChild_key(CxxDeclarationExtendsChild_key,
+                                       cxxDeclarationExtendsChild_key_parent,
+                                       cxxDeclarationExtendsChild_key_child),
+        CxxDeclarationContainsParent_key(CxxDeclarationContainsParent_key,
+                                         cxxDeclarationContainsParent_key_child,
+                                         cxxDeclarationContainsParent_key_parent),
+        CxxDeclarationContainsChild_key(CxxDeclarationContainsChild_key,
+                                        cxxDeclarationContainsChild_key_parent,
+                                        cxxDeclarationContainsChild_key_child),
+        CxxDeclVisibility_key(CxxDeclVisibility_key,
+                              cxxDeclVisibility_key_decl, cxxDeclVisibility_key_visibility),
+        CxxDeclToDefXRefTargetLocation_key(CxxDeclToDefXRefTargetLocation_key,
+                                           cxxDeclToDefXRefTargetLocation_key_decl,
+                                           cxxDeclToDefXRefTargetLocation_key_entity,
+                                           cxxDeclToDefXRefTargetLocation_key_location),
+        CxxDeclKind_key(CxxDeclKind_key, cxxDeclKind_key_decl,
+                        cxxDeclKind_key_kind),
+        CxxDeclInfo_key(CxxDeclInfo_key, cxxDeclInfo_key_decl,
+                        cxxDeclInfo_key_info),
+        CxxContainsParentEntity_key(CxxContainsParentEntity_key,
+                                    cxxContainsParentEntity_key_child,
+                                    cxxContainsParentEntity_key_parent),
+        CxxContainsChildEntity_key(CxxContainsChildEntity_key,
+                                   cxxContainsChildEntity_key_parent,
+                                   cxxContainsChildEntity_key_child),
+        CxxAnnotation_key(CxxAnnotation_key, cxxAnnotation_key_entity,
+                          cxxAnnotation_key_anns))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 19 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 396 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupCxx/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("CxxDeclarationExtendsChild", 4), ("CxxDefinitionModifiers", 4),
+       ("CxxResolveDeclarationToEntity", 4), ("CxxVisibility", 4),
+       ("CxxFileEntityTraceDeclToDefXRefLocations", 4),
+       ("SymbolToEntity", 4), ("CxxDeclarationSource", 4),
+       ("CxxEntitySource", 4), ("CxxExtendsParentEntity", 4),
+       ("CxxDeclInfo", 4), ("CxxFileEntityIdl", 4),
+       ("CxxEntityLocation", 4), ("CxxDeclarationContainsChild", 4),
+       ("CxxContainsParentEntity", 4),
+       ("CxxFileEntityXMapFixedXRefLocations", 4),
+       ("CxxFileEntityXMapVariableXRefDeclLocations", 4),
+       ("CxxEntityInfo", 4),
+       ("CxxFileEntityXMapVariableXRefDeclToDefs", 4),
+       ("CxxDeclarationContainsParent", 4), ("XRefTargetToEntity", 4),
+       ("CxxIdlEntityUses", 4), ("CxxDefinitionContainsParent", 4),
+       ("CxxEntityKind", 4), ("CxxEntityMangledNameHash", 4),
+       ("CxxEntityUSR", 4), ("CxxDefinitionExtendsChild", 4),
+       ("CxxFileEntityXRefLocations", 4), ("CxxDefnVisibility", 4),
+       ("CxxDeclarationExtendsParent", 4),
+       ("CxxDefinitionContainsChild", 4), ("CxxXRefTargetLocation", 4),
+       ("CxxDeclVisibility", 4), ("FromCxxVisibility", 4),
+       ("CxxAnnotation", 4), ("CxxResolveTraceLocation", 4),
+       ("CxxEntityUses", 4), ("CxxFileEntitySpellingXRefLocations", 4),
+       ("CxxDeclarationModifiers", 4), ("CxxEntityDefinitionBase", 4),
+       ("CxxDeclKind", 4), ("CxxDataAvailable", 4),
+       ("CxxExtendsChildEntity", 4),
+       ("CxxDefToDeclFamilyXRefTargetLocation", 4),
+       ("CxxNamespaceDeclarationContainsChild", 4),
+       ("CxxFindDefinitionOfEntity", 4), ("CxxResolveLocation", 4),
+       ("CxxModifiers", 4), ("CxxContainsChildEntity", 4),
+       ("CxxEntityIdl", 4), ("EntityToXRefTarget", 4),
+       ("CxxDeclToDefXRefTargetLocation", 4),
+       ("CxxEntityDocumentation", 4), ("CxxDefinitionExtendsParent", 4)]
+
+type XRefTargetToEntity_id = Glean.Id
+
+data XRefTargetToEntity = XRefTargetToEntity{xRefTargetToEntity_id
+                                             :: {-# UNPACK #-} !XRefTargetToEntity_id,
+                                             xRefTargetToEntity_key ::
+                                             Prelude.Maybe XRefTargetToEntity_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTargetToEntity where
+  toJSON (XRefTargetToEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTargetToEntity where
+  buildStruct _proxy (XRefTargetToEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefTargetToEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTargetToEntity where
+  rnf (XRefTargetToEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefTargetToEntity where
+  def = XRefTargetToEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefTargetToEntity where
+  hashWithSalt __salt (XRefTargetToEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SymbolToEntity_id = Glean.Id
+
+data SymbolToEntity = SymbolToEntity{symbolToEntity_id ::
+                                     {-# UNPACK #-} !SymbolToEntity_id,
+                                     symbolToEntity_key :: Prelude.Maybe SymbolToEntity_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolToEntity where
+  toJSON (SymbolToEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolToEntity where
+  buildStruct _proxy (SymbolToEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolToEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolToEntity where
+  rnf (SymbolToEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolToEntity where
+  def = SymbolToEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolToEntity where
+  hashWithSalt __salt (SymbolToEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FromCxxVisibility_id = Glean.Id
+
+data FromCxxVisibility = FromCxxVisibility{fromCxxVisibility_id ::
+                                           {-# UNPACK #-} !FromCxxVisibility_id,
+                                           fromCxxVisibility_key ::
+                                           Prelude.Maybe FromCxxVisibility_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromCxxVisibility where
+  toJSON (FromCxxVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FromCxxVisibility where
+  buildStruct _proxy (FromCxxVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FromCxxVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FromCxxVisibility where
+  rnf (FromCxxVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FromCxxVisibility where
+  def = FromCxxVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable FromCxxVisibility where
+  hashWithSalt __salt (FromCxxVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityToXRefTarget_id = Glean.Id
+
+data EntityToXRefTarget = EntityToXRefTarget{entityToXRefTarget_id
+                                             :: {-# UNPACK #-} !EntityToXRefTarget_id,
+                                             entityToXRefTarget_key ::
+                                             Prelude.Maybe EntityToXRefTarget_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityToXRefTarget where
+  toJSON (EntityToXRefTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityToXRefTarget where
+  buildStruct _proxy (EntityToXRefTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityToXRefTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityToXRefTarget where
+  rnf (EntityToXRefTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityToXRefTarget where
+  def = EntityToXRefTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityToXRefTarget where
+  hashWithSalt __salt (EntityToXRefTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxXRefTargetLocation_id = Glean.Id
+
+data CxxXRefTargetLocation = CxxXRefTargetLocation{cxxXRefTargetLocation_id
+                                                   :: {-# UNPACK #-} !CxxXRefTargetLocation_id,
+                                                   cxxXRefTargetLocation_key ::
+                                                   Prelude.Maybe CxxXRefTargetLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxXRefTargetLocation where
+  toJSON (CxxXRefTargetLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxXRefTargetLocation where
+  buildStruct _proxy (CxxXRefTargetLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxXRefTargetLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxXRefTargetLocation where
+  rnf (CxxXRefTargetLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxXRefTargetLocation where
+  def = CxxXRefTargetLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxXRefTargetLocation where
+  hashWithSalt __salt (CxxXRefTargetLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxVisibility_id = Glean.Id
+
+data CxxVisibility = CxxVisibility{cxxVisibility_id ::
+                                   {-# UNPACK #-} !CxxVisibility_id,
+                                   cxxVisibility_key :: Prelude.Maybe CxxVisibility_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxVisibility where
+  toJSON (CxxVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxVisibility where
+  buildStruct _proxy (CxxVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxVisibility where
+  rnf (CxxVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxVisibility where
+  def = CxxVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxVisibility where
+  hashWithSalt __salt (CxxVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxResolveTraceLocation_id = Glean.Id
+
+data CxxResolveTraceLocation = CxxResolveTraceLocation{cxxResolveTraceLocation_id
+                                                       ::
+                                                       {-# UNPACK #-} !CxxResolveTraceLocation_id,
+                                                       cxxResolveTraceLocation_key ::
+                                                       Prelude.Maybe CxxResolveTraceLocation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveTraceLocation where
+  toJSON (CxxResolveTraceLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveTraceLocation where
+  buildStruct _proxy
+    (CxxResolveTraceLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxResolveTraceLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveTraceLocation where
+  rnf (CxxResolveTraceLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxResolveTraceLocation where
+  def = CxxResolveTraceLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxResolveTraceLocation where
+  hashWithSalt __salt (CxxResolveTraceLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxResolveLocation_id = Glean.Id
+
+data CxxResolveLocation = CxxResolveLocation{cxxResolveLocation_id
+                                             :: {-# UNPACK #-} !CxxResolveLocation_id,
+                                             cxxResolveLocation_key ::
+                                             Prelude.Maybe CxxResolveLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveLocation where
+  toJSON (CxxResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveLocation where
+  buildStruct _proxy (CxxResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveLocation where
+  rnf (CxxResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxResolveLocation where
+  def = CxxResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxResolveLocation where
+  hashWithSalt __salt (CxxResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxResolveDeclarationToEntity_id = Glean.Id
+
+data CxxResolveDeclarationToEntity = CxxResolveDeclarationToEntity{cxxResolveDeclarationToEntity_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !CxxResolveDeclarationToEntity_id,
+                                                                   cxxResolveDeclarationToEntity_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     CxxResolveDeclarationToEntity_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveDeclarationToEntity where
+  toJSON (CxxResolveDeclarationToEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveDeclarationToEntity where
+  buildStruct _proxy
+    (CxxResolveDeclarationToEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxResolveDeclarationToEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveDeclarationToEntity where
+  rnf (CxxResolveDeclarationToEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxResolveDeclarationToEntity where
+  def = CxxResolveDeclarationToEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxResolveDeclarationToEntity where
+  hashWithSalt __salt (CxxResolveDeclarationToEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxNamespaceDeclarationContainsChild_id = Glean.Id
+
+data CxxNamespaceDeclarationContainsChild = CxxNamespaceDeclarationContainsChild{cxxNamespaceDeclarationContainsChild_id
+                                                                                 ::
+                                                                                 {-# UNPACK #-} !CxxNamespaceDeclarationContainsChild_id,
+                                                                                 cxxNamespaceDeclarationContainsChild_key
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   CxxNamespaceDeclarationContainsChild_key}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNamespaceDeclarationContainsChild where
+  toJSON
+    (CxxNamespaceDeclarationContainsChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxNamespaceDeclarationContainsChild
+         where
+  buildStruct _proxy
+    (CxxNamespaceDeclarationContainsChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxNamespaceDeclarationContainsChild __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNamespaceDeclarationContainsChild where
+  rnf (CxxNamespaceDeclarationContainsChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxNamespaceDeclarationContainsChild where
+  def
+    = CxxNamespaceDeclarationContainsChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxNamespaceDeclarationContainsChild
+         where
+  hashWithSalt __salt (CxxNamespaceDeclarationContainsChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxModifiers_id = Glean.Id
+
+data CxxModifiers = CxxModifiers{cxxModifiers_id ::
+                                 {-# UNPACK #-} !CxxModifiers_id,
+                                 cxxModifiers_key :: Prelude.Maybe CxxModifiers_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxModifiers where
+  toJSON (CxxModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxModifiers where
+  buildStruct _proxy (CxxModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxModifiers where
+  rnf (CxxModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxModifiers where
+  def = CxxModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxModifiers where
+  hashWithSalt __salt (CxxModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxIdlEntityUses_id = Glean.Id
+
+data CxxIdlEntityUses = CxxIdlEntityUses{cxxIdlEntityUses_id ::
+                                         {-# UNPACK #-} !CxxIdlEntityUses_id,
+                                         cxxIdlEntityUses_key :: Prelude.Maybe CxxIdlEntityUses_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxIdlEntityUses where
+  toJSON (CxxIdlEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxIdlEntityUses where
+  buildStruct _proxy (CxxIdlEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxIdlEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxIdlEntityUses where
+  rnf (CxxIdlEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxIdlEntityUses where
+  def = CxxIdlEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxIdlEntityUses where
+  hashWithSalt __salt (CxxIdlEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFindDefinitionOfEntity_id = Glean.Id
+
+data CxxFindDefinitionOfEntity = CxxFindDefinitionOfEntity{cxxFindDefinitionOfEntity_id
+                                                           ::
+                                                           {-# UNPACK #-} !CxxFindDefinitionOfEntity_id,
+                                                           cxxFindDefinitionOfEntity_key ::
+                                                           Prelude.Maybe
+                                                             CxxFindDefinitionOfEntity_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFindDefinitionOfEntity where
+  toJSON (CxxFindDefinitionOfEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFindDefinitionOfEntity where
+  buildStruct _proxy
+    (CxxFindDefinitionOfEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFindDefinitionOfEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFindDefinitionOfEntity where
+  rnf (CxxFindDefinitionOfEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFindDefinitionOfEntity where
+  def = CxxFindDefinitionOfEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxFindDefinitionOfEntity where
+  hashWithSalt __salt (CxxFindDefinitionOfEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityXRefLocations_id = Glean.Id
+
+data CxxFileEntityXRefLocations = CxxFileEntityXRefLocations{cxxFileEntityXRefLocations_id
+                                                             ::
+                                                             {-# UNPACK #-} !CxxFileEntityXRefLocations_id,
+                                                             cxxFileEntityXRefLocations_key ::
+                                                             Prelude.Maybe
+                                                               CxxFileEntityXRefLocations_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXRefLocations where
+  toJSON (CxxFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntityXRefLocations where
+  buildStruct _proxy
+    (CxxFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXRefLocations where
+  rnf (CxxFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXRefLocations where
+  def = CxxFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntityXRefLocations where
+  hashWithSalt __salt (CxxFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityXMapVariableXRefDeclToDefs_id = Glean.Id
+
+data CxxFileEntityXMapVariableXRefDeclToDefs = CxxFileEntityXMapVariableXRefDeclToDefs{cxxFileEntityXMapVariableXRefDeclToDefs_id
+                                                                                       ::
+                                                                                       {-# UNPACK #-} !CxxFileEntityXMapVariableXRefDeclToDefs_id,
+                                                                                       cxxFileEntityXMapVariableXRefDeclToDefs_key
+                                                                                       ::
+                                                                                       Prelude.Maybe
+                                                                                         CxxFileEntityXMapVariableXRefDeclToDefs_key}
+                                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXMapVariableXRefDeclToDefs where
+  toJSON
+    (CxxFileEntityXMapVariableXRefDeclToDefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapVariableXRefDeclToDefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntityXMapVariableXRefDeclToDefs __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  rnf
+    (CxxFileEntityXMapVariableXRefDeclToDefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  def
+    = CxxFileEntityXMapVariableXRefDeclToDefs Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  hashWithSalt __salt
+    (CxxFileEntityXMapVariableXRefDeclToDefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityXMapVariableXRefDeclLocations_id = Glean.Id
+
+data CxxFileEntityXMapVariableXRefDeclLocations = CxxFileEntityXMapVariableXRefDeclLocations{cxxFileEntityXMapVariableXRefDeclLocations_id
+                                                                                             ::
+                                                                                             {-# UNPACK #-} !CxxFileEntityXMapVariableXRefDeclLocations_id,
+                                                                                             cxxFileEntityXMapVariableXRefDeclLocations_key
+                                                                                             ::
+                                                                                             Prelude.Maybe
+                                                                                               CxxFileEntityXMapVariableXRefDeclLocations_key}
+                                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  toJSON
+    (CxxFileEntityXMapVariableXRefDeclLocations __field__id
+       __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapVariableXRefDeclLocations __field__id
+       __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntityXMapVariableXRefDeclLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  rnf
+    (CxxFileEntityXMapVariableXRefDeclLocations __field__id
+       __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  def
+    = CxxFileEntityXMapVariableXRefDeclLocations Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable
+           CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  hashWithSalt __salt
+    (CxxFileEntityXMapVariableXRefDeclLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityXMapFixedXRefLocations_id = Glean.Id
+
+data CxxFileEntityXMapFixedXRefLocations = CxxFileEntityXMapFixedXRefLocations{cxxFileEntityXMapFixedXRefLocations_id
+                                                                               ::
+                                                                               {-# UNPACK #-} !CxxFileEntityXMapFixedXRefLocations_id,
+                                                                               cxxFileEntityXMapFixedXRefLocations_key
+                                                                               ::
+                                                                               Prelude.Maybe
+                                                                                 CxxFileEntityXMapFixedXRefLocations_key}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXMapFixedXRefLocations where
+  toJSON
+    (CxxFileEntityXMapFixedXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntityXMapFixedXRefLocations
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapFixedXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntityXMapFixedXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXMapFixedXRefLocations where
+  rnf (CxxFileEntityXMapFixedXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXMapFixedXRefLocations where
+  def
+    = CxxFileEntityXMapFixedXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntityXMapFixedXRefLocations
+         where
+  hashWithSalt __salt (CxxFileEntityXMapFixedXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityTraceDeclToDefXRefLocations_id = Glean.Id
+
+data CxxFileEntityTraceDeclToDefXRefLocations = CxxFileEntityTraceDeclToDefXRefLocations{cxxFileEntityTraceDeclToDefXRefLocations_id
+                                                                                         ::
+                                                                                         {-# UNPACK #-} !CxxFileEntityTraceDeclToDefXRefLocations_id,
+                                                                                         cxxFileEntityTraceDeclToDefXRefLocations_key
+                                                                                         ::
+                                                                                         Prelude.Maybe
+                                                                                           CxxFileEntityTraceDeclToDefXRefLocations_key}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  toJSON
+    (CxxFileEntityTraceDeclToDefXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  buildStruct _proxy
+    (CxxFileEntityTraceDeclToDefXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntityTraceDeclToDefXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  rnf
+    (CxxFileEntityTraceDeclToDefXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  def
+    = CxxFileEntityTraceDeclToDefXRefLocations Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  hashWithSalt __salt
+    (CxxFileEntityTraceDeclToDefXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntitySpellingXRefLocations_id = Glean.Id
+
+data CxxFileEntitySpellingXRefLocations = CxxFileEntitySpellingXRefLocations{cxxFileEntitySpellingXRefLocations_id
+                                                                             ::
+                                                                             {-# UNPACK #-} !CxxFileEntitySpellingXRefLocations_id,
+                                                                             cxxFileEntitySpellingXRefLocations_key
+                                                                             ::
+                                                                             Prelude.Maybe
+                                                                               CxxFileEntitySpellingXRefLocations_key}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntitySpellingXRefLocations where
+  toJSON
+    (CxxFileEntitySpellingXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntitySpellingXRefLocations
+         where
+  buildStruct _proxy
+    (CxxFileEntitySpellingXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxFileEntitySpellingXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntitySpellingXRefLocations where
+  rnf (CxxFileEntitySpellingXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntitySpellingXRefLocations where
+  def
+    = CxxFileEntitySpellingXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntitySpellingXRefLocations where
+  hashWithSalt __salt (CxxFileEntitySpellingXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxFileEntityIdl_id = Glean.Id
+
+data CxxFileEntityIdl = CxxFileEntityIdl{cxxFileEntityIdl_id ::
+                                         {-# UNPACK #-} !CxxFileEntityIdl_id,
+                                         cxxFileEntityIdl_key :: Prelude.Maybe CxxFileEntityIdl_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityIdl where
+  toJSON (CxxFileEntityIdl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntityIdl where
+  buildStruct _proxy (CxxFileEntityIdl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxFileEntityIdl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityIdl where
+  rnf (CxxFileEntityIdl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityIdl where
+  def = CxxFileEntityIdl Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxFileEntityIdl where
+  hashWithSalt __salt (CxxFileEntityIdl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxExtendsParentEntity_id = Glean.Id
+
+data CxxExtendsParentEntity = CxxExtendsParentEntity{cxxExtendsParentEntity_id
+                                                     :: {-# UNPACK #-} !CxxExtendsParentEntity_id,
+                                                     cxxExtendsParentEntity_key ::
+                                                     Prelude.Maybe CxxExtendsParentEntity_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxExtendsParentEntity where
+  toJSON (CxxExtendsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxExtendsParentEntity where
+  buildStruct _proxy
+    (CxxExtendsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxExtendsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxExtendsParentEntity where
+  rnf (CxxExtendsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxExtendsParentEntity where
+  def = CxxExtendsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxExtendsParentEntity where
+  hashWithSalt __salt (CxxExtendsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxExtendsChildEntity_id = Glean.Id
+
+data CxxExtendsChildEntity = CxxExtendsChildEntity{cxxExtendsChildEntity_id
+                                                   :: {-# UNPACK #-} !CxxExtendsChildEntity_id,
+                                                   cxxExtendsChildEntity_key ::
+                                                   Prelude.Maybe CxxExtendsChildEntity_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxExtendsChildEntity where
+  toJSON (CxxExtendsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxExtendsChildEntity where
+  buildStruct _proxy (CxxExtendsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxExtendsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxExtendsChildEntity where
+  rnf (CxxExtendsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxExtendsChildEntity where
+  def = CxxExtendsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxExtendsChildEntity where
+  hashWithSalt __salt (CxxExtendsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityUses_id = Glean.Id
+
+data CxxEntityUses = CxxEntityUses{cxxEntityUses_id ::
+                                   {-# UNPACK #-} !CxxEntityUses_id,
+                                   cxxEntityUses_key :: Prelude.Maybe CxxEntityUses_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityUses where
+  toJSON (CxxEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityUses where
+  buildStruct _proxy (CxxEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityUses where
+  rnf (CxxEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityUses where
+  def = CxxEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityUses where
+  hashWithSalt __salt (CxxEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityUSR_id = Glean.Id
+
+data CxxEntityUSR = CxxEntityUSR{cxxEntityUSR_id ::
+                                 {-# UNPACK #-} !CxxEntityUSR_id,
+                                 cxxEntityUSR_key :: Prelude.Maybe CxxEntityUSR_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityUSR where
+  toJSON (CxxEntityUSR __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityUSR where
+  buildStruct _proxy (CxxEntityUSR __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityUSR __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityUSR where
+  rnf (CxxEntityUSR __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityUSR where
+  def = CxxEntityUSR Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityUSR where
+  hashWithSalt __salt (CxxEntityUSR _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntitySource_id = Glean.Id
+
+data CxxEntitySource = CxxEntitySource{cxxEntitySource_id ::
+                                       {-# UNPACK #-} !CxxEntitySource_id,
+                                       cxxEntitySource_key :: Prelude.Maybe CxxEntitySource_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntitySource where
+  toJSON (CxxEntitySource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntitySource where
+  buildStruct _proxy (CxxEntitySource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntitySource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntitySource where
+  rnf (CxxEntitySource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntitySource where
+  def = CxxEntitySource Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntitySource where
+  hashWithSalt __salt (CxxEntitySource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityMangledNameHash_id = Glean.Id
+
+data CxxEntityMangledNameHash = CxxEntityMangledNameHash{cxxEntityMangledNameHash_id
+                                                         ::
+                                                         {-# UNPACK #-} !CxxEntityMangledNameHash_id,
+                                                         cxxEntityMangledNameHash_key ::
+                                                         Prelude.Maybe CxxEntityMangledNameHash_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityMangledNameHash where
+  toJSON (CxxEntityMangledNameHash __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityMangledNameHash where
+  buildStruct _proxy
+    (CxxEntityMangledNameHash __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxEntityMangledNameHash __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityMangledNameHash where
+  rnf (CxxEntityMangledNameHash __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityMangledNameHash where
+  def = CxxEntityMangledNameHash Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityMangledNameHash where
+  hashWithSalt __salt (CxxEntityMangledNameHash _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityLocation_id = Glean.Id
+
+data CxxEntityLocation = CxxEntityLocation{cxxEntityLocation_id ::
+                                           {-# UNPACK #-} !CxxEntityLocation_id,
+                                           cxxEntityLocation_key ::
+                                           Prelude.Maybe CxxEntityLocation_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityLocation where
+  toJSON (CxxEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityLocation where
+  buildStruct _proxy (CxxEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityLocation where
+  rnf (CxxEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityLocation where
+  def = CxxEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityLocation where
+  hashWithSalt __salt (CxxEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityKind_id = Glean.Id
+
+data CxxEntityKind = CxxEntityKind{cxxEntityKind_id ::
+                                   {-# UNPACK #-} !CxxEntityKind_id,
+                                   cxxEntityKind_key :: Prelude.Maybe CxxEntityKind_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityKind where
+  toJSON (CxxEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityKind where
+  buildStruct _proxy (CxxEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityKind where
+  rnf (CxxEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityKind where
+  def = CxxEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityKind where
+  hashWithSalt __salt (CxxEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityInfo_id = Glean.Id
+
+data CxxEntityInfo = CxxEntityInfo{cxxEntityInfo_id ::
+                                   {-# UNPACK #-} !CxxEntityInfo_id,
+                                   cxxEntityInfo_key :: Prelude.Maybe CxxEntityInfo_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityInfo where
+  toJSON (CxxEntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityInfo where
+  buildStruct _proxy (CxxEntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityInfo where
+  rnf (CxxEntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityInfo where
+  def = CxxEntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityInfo where
+  hashWithSalt __salt (CxxEntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityIdl_id = Glean.Id
+
+data CxxEntityIdl = CxxEntityIdl{cxxEntityIdl_id ::
+                                 {-# UNPACK #-} !CxxEntityIdl_id,
+                                 cxxEntityIdl_key :: Prelude.Maybe CxxEntityIdl_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityIdl where
+  toJSON (CxxEntityIdl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityIdl where
+  buildStruct _proxy (CxxEntityIdl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxEntityIdl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityIdl where
+  rnf (CxxEntityIdl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityIdl where
+  def = CxxEntityIdl Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityIdl where
+  hashWithSalt __salt (CxxEntityIdl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityDocumentation_id = Glean.Id
+
+data CxxEntityDocumentation = CxxEntityDocumentation{cxxEntityDocumentation_id
+                                                     :: {-# UNPACK #-} !CxxEntityDocumentation_id,
+                                                     cxxEntityDocumentation_key ::
+                                                     Prelude.Maybe CxxEntityDocumentation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityDocumentation where
+  toJSON (CxxEntityDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityDocumentation where
+  buildStruct _proxy
+    (CxxEntityDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxEntityDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityDocumentation where
+  rnf (CxxEntityDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityDocumentation where
+  def = CxxEntityDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityDocumentation where
+  hashWithSalt __salt (CxxEntityDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxEntityDefinitionBase_id = Glean.Id
+
+data CxxEntityDefinitionBase = CxxEntityDefinitionBase{cxxEntityDefinitionBase_id
+                                                       ::
+                                                       {-# UNPACK #-} !CxxEntityDefinitionBase_id,
+                                                       cxxEntityDefinitionBase_key ::
+                                                       Prelude.Maybe CxxEntityDefinitionBase_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityDefinitionBase where
+  toJSON (CxxEntityDefinitionBase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityDefinitionBase where
+  buildStruct _proxy
+    (CxxEntityDefinitionBase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxEntityDefinitionBase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityDefinitionBase where
+  rnf (CxxEntityDefinitionBase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxEntityDefinitionBase where
+  def = CxxEntityDefinitionBase Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxEntityDefinitionBase where
+  hashWithSalt __salt (CxxEntityDefinitionBase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefnVisibility_id = Glean.Id
+
+data CxxDefnVisibility = CxxDefnVisibility{cxxDefnVisibility_id ::
+                                           {-# UNPACK #-} !CxxDefnVisibility_id,
+                                           cxxDefnVisibility_key ::
+                                           Prelude.Maybe CxxDefnVisibility_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefnVisibility where
+  toJSON (CxxDefnVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefnVisibility where
+  buildStruct _proxy (CxxDefnVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxDefnVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefnVisibility where
+  rnf (CxxDefnVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefnVisibility where
+  def = CxxDefnVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefnVisibility where
+  hashWithSalt __salt (CxxDefnVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefinitionModifiers_id = Glean.Id
+
+data CxxDefinitionModifiers = CxxDefinitionModifiers{cxxDefinitionModifiers_id
+                                                     :: {-# UNPACK #-} !CxxDefinitionModifiers_id,
+                                                     cxxDefinitionModifiers_key ::
+                                                     Prelude.Maybe CxxDefinitionModifiers_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionModifiers where
+  toJSON (CxxDefinitionModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionModifiers where
+  buildStruct _proxy
+    (CxxDefinitionModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefinitionModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionModifiers where
+  rnf (CxxDefinitionModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionModifiers where
+  def = CxxDefinitionModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefinitionModifiers where
+  hashWithSalt __salt (CxxDefinitionModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefinitionExtendsParent_id = Glean.Id
+
+data CxxDefinitionExtendsParent = CxxDefinitionExtendsParent{cxxDefinitionExtendsParent_id
+                                                             ::
+                                                             {-# UNPACK #-} !CxxDefinitionExtendsParent_id,
+                                                             cxxDefinitionExtendsParent_key ::
+                                                             Prelude.Maybe
+                                                               CxxDefinitionExtendsParent_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionExtendsParent where
+  toJSON (CxxDefinitionExtendsParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionExtendsParent where
+  buildStruct _proxy
+    (CxxDefinitionExtendsParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefinitionExtendsParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionExtendsParent where
+  rnf (CxxDefinitionExtendsParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionExtendsParent where
+  def = CxxDefinitionExtendsParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefinitionExtendsParent where
+  hashWithSalt __salt (CxxDefinitionExtendsParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefinitionExtendsChild_id = Glean.Id
+
+data CxxDefinitionExtendsChild = CxxDefinitionExtendsChild{cxxDefinitionExtendsChild_id
+                                                           ::
+                                                           {-# UNPACK #-} !CxxDefinitionExtendsChild_id,
+                                                           cxxDefinitionExtendsChild_key ::
+                                                           Prelude.Maybe
+                                                             CxxDefinitionExtendsChild_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionExtendsChild where
+  toJSON (CxxDefinitionExtendsChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionExtendsChild where
+  buildStruct _proxy
+    (CxxDefinitionExtendsChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefinitionExtendsChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionExtendsChild where
+  rnf (CxxDefinitionExtendsChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionExtendsChild where
+  def = CxxDefinitionExtendsChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefinitionExtendsChild where
+  hashWithSalt __salt (CxxDefinitionExtendsChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefinitionContainsParent_id = Glean.Id
+
+data CxxDefinitionContainsParent = CxxDefinitionContainsParent{cxxDefinitionContainsParent_id
+                                                               ::
+                                                               {-# UNPACK #-} !CxxDefinitionContainsParent_id,
+                                                               cxxDefinitionContainsParent_key ::
+                                                               Prelude.Maybe
+                                                                 CxxDefinitionContainsParent_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionContainsParent where
+  toJSON (CxxDefinitionContainsParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionContainsParent where
+  buildStruct _proxy
+    (CxxDefinitionContainsParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefinitionContainsParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionContainsParent where
+  rnf (CxxDefinitionContainsParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionContainsParent where
+  def = CxxDefinitionContainsParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefinitionContainsParent where
+  hashWithSalt __salt (CxxDefinitionContainsParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefinitionContainsChild_id = Glean.Id
+
+data CxxDefinitionContainsChild = CxxDefinitionContainsChild{cxxDefinitionContainsChild_id
+                                                             ::
+                                                             {-# UNPACK #-} !CxxDefinitionContainsChild_id,
+                                                             cxxDefinitionContainsChild_key ::
+                                                             Prelude.Maybe
+                                                               CxxDefinitionContainsChild_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionContainsChild where
+  toJSON (CxxDefinitionContainsChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionContainsChild where
+  buildStruct _proxy
+    (CxxDefinitionContainsChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefinitionContainsChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionContainsChild where
+  rnf (CxxDefinitionContainsChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionContainsChild where
+  def = CxxDefinitionContainsChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefinitionContainsChild where
+  hashWithSalt __salt (CxxDefinitionContainsChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDefToDeclFamilyXRefTargetLocation_id = Glean.Id
+
+data CxxDefToDeclFamilyXRefTargetLocation = CxxDefToDeclFamilyXRefTargetLocation{cxxDefToDeclFamilyXRefTargetLocation_id
+                                                                                 ::
+                                                                                 {-# UNPACK #-} !CxxDefToDeclFamilyXRefTargetLocation_id,
+                                                                                 cxxDefToDeclFamilyXRefTargetLocation_key
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   CxxDefToDeclFamilyXRefTargetLocation_key}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefToDeclFamilyXRefTargetLocation where
+  toJSON
+    (CxxDefToDeclFamilyXRefTargetLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefToDeclFamilyXRefTargetLocation
+         where
+  buildStruct _proxy
+    (CxxDefToDeclFamilyXRefTargetLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDefToDeclFamilyXRefTargetLocation __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefToDeclFamilyXRefTargetLocation where
+  rnf (CxxDefToDeclFamilyXRefTargetLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDefToDeclFamilyXRefTargetLocation where
+  def
+    = CxxDefToDeclFamilyXRefTargetLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDefToDeclFamilyXRefTargetLocation
+         where
+  hashWithSalt __salt (CxxDefToDeclFamilyXRefTargetLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationSource_id = Glean.Id
+
+data CxxDeclarationSource = CxxDeclarationSource{cxxDeclarationSource_id
+                                                 :: {-# UNPACK #-} !CxxDeclarationSource_id,
+                                                 cxxDeclarationSource_key ::
+                                                 Prelude.Maybe CxxDeclarationSource_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationSource where
+  toJSON (CxxDeclarationSource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationSource where
+  buildStruct _proxy (CxxDeclarationSource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationSource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationSource where
+  rnf (CxxDeclarationSource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationSource where
+  def = CxxDeclarationSource Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationSource where
+  hashWithSalt __salt (CxxDeclarationSource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationModifiers_id = Glean.Id
+
+data CxxDeclarationModifiers = CxxDeclarationModifiers{cxxDeclarationModifiers_id
+                                                       ::
+                                                       {-# UNPACK #-} !CxxDeclarationModifiers_id,
+                                                       cxxDeclarationModifiers_key ::
+                                                       Prelude.Maybe CxxDeclarationModifiers_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationModifiers where
+  toJSON (CxxDeclarationModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationModifiers where
+  buildStruct _proxy
+    (CxxDeclarationModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationModifiers where
+  rnf (CxxDeclarationModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationModifiers where
+  def = CxxDeclarationModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationModifiers where
+  hashWithSalt __salt (CxxDeclarationModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationExtendsParent_id = Glean.Id
+
+data CxxDeclarationExtendsParent = CxxDeclarationExtendsParent{cxxDeclarationExtendsParent_id
+                                                               ::
+                                                               {-# UNPACK #-} !CxxDeclarationExtendsParent_id,
+                                                               cxxDeclarationExtendsParent_key ::
+                                                               Prelude.Maybe
+                                                                 CxxDeclarationExtendsParent_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationExtendsParent where
+  toJSON (CxxDeclarationExtendsParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationExtendsParent where
+  buildStruct _proxy
+    (CxxDeclarationExtendsParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationExtendsParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationExtendsParent where
+  rnf (CxxDeclarationExtendsParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationExtendsParent where
+  def = CxxDeclarationExtendsParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationExtendsParent where
+  hashWithSalt __salt (CxxDeclarationExtendsParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationExtendsChild_id = Glean.Id
+
+data CxxDeclarationExtendsChild = CxxDeclarationExtendsChild{cxxDeclarationExtendsChild_id
+                                                             ::
+                                                             {-# UNPACK #-} !CxxDeclarationExtendsChild_id,
+                                                             cxxDeclarationExtendsChild_key ::
+                                                             Prelude.Maybe
+                                                               CxxDeclarationExtendsChild_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationExtendsChild where
+  toJSON (CxxDeclarationExtendsChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationExtendsChild where
+  buildStruct _proxy
+    (CxxDeclarationExtendsChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationExtendsChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationExtendsChild where
+  rnf (CxxDeclarationExtendsChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationExtendsChild where
+  def = CxxDeclarationExtendsChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationExtendsChild where
+  hashWithSalt __salt (CxxDeclarationExtendsChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationContainsParent_id = Glean.Id
+
+data CxxDeclarationContainsParent = CxxDeclarationContainsParent{cxxDeclarationContainsParent_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !CxxDeclarationContainsParent_id,
+                                                                 cxxDeclarationContainsParent_key ::
+                                                                 Prelude.Maybe
+                                                                   CxxDeclarationContainsParent_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationContainsParent where
+  toJSON (CxxDeclarationContainsParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationContainsParent where
+  buildStruct _proxy
+    (CxxDeclarationContainsParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationContainsParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationContainsParent where
+  rnf (CxxDeclarationContainsParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationContainsParent where
+  def = CxxDeclarationContainsParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationContainsParent where
+  hashWithSalt __salt (CxxDeclarationContainsParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclarationContainsChild_id = Glean.Id
+
+data CxxDeclarationContainsChild = CxxDeclarationContainsChild{cxxDeclarationContainsChild_id
+                                                               ::
+                                                               {-# UNPACK #-} !CxxDeclarationContainsChild_id,
+                                                               cxxDeclarationContainsChild_key ::
+                                                               Prelude.Maybe
+                                                                 CxxDeclarationContainsChild_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationContainsChild where
+  toJSON (CxxDeclarationContainsChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationContainsChild where
+  buildStruct _proxy
+    (CxxDeclarationContainsChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclarationContainsChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationContainsChild where
+  rnf (CxxDeclarationContainsChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationContainsChild where
+  def = CxxDeclarationContainsChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclarationContainsChild where
+  hashWithSalt __salt (CxxDeclarationContainsChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclVisibility_id = Glean.Id
+
+data CxxDeclVisibility = CxxDeclVisibility{cxxDeclVisibility_id ::
+                                           {-# UNPACK #-} !CxxDeclVisibility_id,
+                                           cxxDeclVisibility_key ::
+                                           Prelude.Maybe CxxDeclVisibility_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclVisibility where
+  toJSON (CxxDeclVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclVisibility where
+  buildStruct _proxy (CxxDeclVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxDeclVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclVisibility where
+  rnf (CxxDeclVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclVisibility where
+  def = CxxDeclVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclVisibility where
+  hashWithSalt __salt (CxxDeclVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclToDefXRefTargetLocation_id = Glean.Id
+
+data CxxDeclToDefXRefTargetLocation = CxxDeclToDefXRefTargetLocation{cxxDeclToDefXRefTargetLocation_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !CxxDeclToDefXRefTargetLocation_id,
+                                                                     cxxDeclToDefXRefTargetLocation_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       CxxDeclToDefXRefTargetLocation_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclToDefXRefTargetLocation where
+  toJSON (CxxDeclToDefXRefTargetLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclToDefXRefTargetLocation where
+  buildStruct _proxy
+    (CxxDeclToDefXRefTargetLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxDeclToDefXRefTargetLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclToDefXRefTargetLocation where
+  rnf (CxxDeclToDefXRefTargetLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclToDefXRefTargetLocation where
+  def = CxxDeclToDefXRefTargetLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclToDefXRefTargetLocation where
+  hashWithSalt __salt (CxxDeclToDefXRefTargetLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclKind_id = Glean.Id
+
+data CxxDeclKind = CxxDeclKind{cxxDeclKind_id ::
+                               {-# UNPACK #-} !CxxDeclKind_id,
+                               cxxDeclKind_key :: Prelude.Maybe CxxDeclKind_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclKind where
+  toJSON (CxxDeclKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclKind where
+  buildStruct _proxy (CxxDeclKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxDeclKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclKind where
+  rnf (CxxDeclKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclKind where
+  def = CxxDeclKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclKind where
+  hashWithSalt __salt (CxxDeclKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDeclInfo_id = Glean.Id
+
+data CxxDeclInfo = CxxDeclInfo{cxxDeclInfo_id ::
+                               {-# UNPACK #-} !CxxDeclInfo_id,
+                               cxxDeclInfo_key :: Prelude.Maybe CxxDeclInfo_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclInfo where
+  toJSON (CxxDeclInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclInfo where
+  buildStruct _proxy (CxxDeclInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxDeclInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclInfo where
+  rnf (CxxDeclInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDeclInfo where
+  def = CxxDeclInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDeclInfo where
+  hashWithSalt __salt (CxxDeclInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxDataAvailable_id = Glean.Id
+
+data CxxDataAvailable = CxxDataAvailable{cxxDataAvailable_id ::
+                                         {-# UNPACK #-} !CxxDataAvailable_id,
+                                         cxxDataAvailable_key ::
+                                         Prelude.Maybe Glean.Schema.Src.File}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDataAvailable where
+  toJSON (CxxDataAvailable __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDataAvailable where
+  buildStruct _proxy (CxxDataAvailable __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxDataAvailable __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDataAvailable where
+  rnf (CxxDataAvailable __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxDataAvailable where
+  def = CxxDataAvailable Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxDataAvailable where
+  hashWithSalt __salt (CxxDataAvailable _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxContainsParentEntity_id = Glean.Id
+
+data CxxContainsParentEntity = CxxContainsParentEntity{cxxContainsParentEntity_id
+                                                       ::
+                                                       {-# UNPACK #-} !CxxContainsParentEntity_id,
+                                                       cxxContainsParentEntity_key ::
+                                                       Prelude.Maybe CxxContainsParentEntity_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxContainsParentEntity where
+  toJSON (CxxContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxContainsParentEntity where
+  buildStruct _proxy
+    (CxxContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxContainsParentEntity where
+  rnf (CxxContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxContainsParentEntity where
+  def = CxxContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxContainsParentEntity where
+  hashWithSalt __salt (CxxContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxContainsChildEntity_id = Glean.Id
+
+data CxxContainsChildEntity = CxxContainsChildEntity{cxxContainsChildEntity_id
+                                                     :: {-# UNPACK #-} !CxxContainsChildEntity_id,
+                                                     cxxContainsChildEntity_key ::
+                                                     Prelude.Maybe CxxContainsChildEntity_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxContainsChildEntity where
+  toJSON (CxxContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxContainsChildEntity where
+  buildStruct _proxy
+    (CxxContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxContainsChildEntity where
+  rnf (CxxContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxContainsChildEntity where
+  def = CxxContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxContainsChildEntity where
+  hashWithSalt __salt (CxxContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxAnnotation_id = Glean.Id
+
+data CxxAnnotation = CxxAnnotation{cxxAnnotation_id ::
+                                   {-# UNPACK #-} !CxxAnnotation_id,
+                                   cxxAnnotation_key :: Prelude.Maybe CxxAnnotation_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxAnnotation where
+  toJSON (CxxAnnotation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxAnnotation where
+  buildStruct _proxy (CxxAnnotation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxAnnotation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxAnnotation where
+  rnf (CxxAnnotation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxAnnotation where
+  def = CxxAnnotation Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxAnnotation where
+  hashWithSalt __salt (CxxAnnotation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefTargetToEntity_key = XRefTargetToEntity_key{xRefTargetToEntity_key_xrefTarget
+                                                     :: Glean.Schema.Cxx1.XRefTarget,
+                                                     xRefTargetToEntity_key_ent ::
+                                                     Glean.Schema.CodeCxx.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTargetToEntity_key where
+  toJSON (XRefTargetToEntity_key __field__xrefTarget __field__ent)
+    = Aeson.object
+        ("xrefTarget" .= __field__xrefTarget :
+           "ent" .= __field__ent : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTargetToEntity_key where
+  buildStruct _proxy
+    (XRefTargetToEntity_key __field__xrefTarget __field__ent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xrefTarget" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__xrefTarget)
+           :
+           Thrift.genField _proxy "ent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xrefTarget <- ST.newSTRef Default.def
+            __field__ent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__xrefTarget
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xrefTarget <- ST.readSTRef
+                                                                     __field__xrefTarget
+                                             !__val__ent <- ST.readSTRef __field__ent
+                                             Prelude.pure
+                                               (XRefTargetToEntity_key __val__xrefTarget __val__ent)
+              _idMap = HashMap.fromList [("xrefTarget", 1), ("ent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTargetToEntity_key where
+  rnf (XRefTargetToEntity_key __field__xrefTarget __field__ent)
+    = DeepSeq.rnf __field__xrefTarget `Prelude.seq`
+        DeepSeq.rnf __field__ent `Prelude.seq` ()
+
+instance Default.Default XRefTargetToEntity_key where
+  def = XRefTargetToEntity_key Default.def Default.def
+
+instance Hashable.Hashable XRefTargetToEntity_key where
+  hashWithSalt __salt (XRefTargetToEntity_key _xrefTarget _ent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xrefTarget)
+        _ent
+
+data SymbolToEntity_key = SymbolToEntity_key{symbolToEntity_key_usr
+                                             :: Glean.Schema.CodeCxx.SymbolId,
+                                             symbolToEntity_key_entity ::
+                                             Glean.Schema.CodeCxx.Entity}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolToEntity_key where
+  toJSON (SymbolToEntity_key __field__usr __field__entity)
+    = Aeson.object
+        ("usr" .= __field__usr :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolToEntity_key where
+  buildStruct _proxy
+    (SymbolToEntity_key __field__usr __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "usr" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__usr)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__usr <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__usr
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__usr <- ST.readSTRef __field__usr
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SymbolToEntity_key __val__usr __val__entity)
+              _idMap = HashMap.fromList [("usr", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolToEntity_key where
+  rnf (SymbolToEntity_key __field__usr __field__entity)
+    = DeepSeq.rnf __field__usr `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SymbolToEntity_key where
+  def = SymbolToEntity_key "" Default.def
+
+instance Hashable.Hashable SymbolToEntity_key where
+  hashWithSalt __salt (SymbolToEntity_key _usr _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _usr) _entity
+
+data FromCxxVisibility_key = FromCxxVisibility_key{fromCxxVisibility_key_cxx
+                                                   :: Glean.Schema.Cxx1.Access,
+                                                   fromCxxVisibility_key_out ::
+                                                   Glean.Schema.CodemarkupTypes.Visibility}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromCxxVisibility_key where
+  toJSON (FromCxxVisibility_key __field__cxx __field__out)
+    = Aeson.object
+        ("cxx" .= __field__cxx : "out" .= __field__out : Prelude.mempty)
+
+instance Thrift.ThriftStruct FromCxxVisibility_key where
+  buildStruct _proxy
+    (FromCxxVisibility_key __field__cxx __field__out)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "cxx" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__cxx)
+           :
+           Thrift.genField _proxy "out" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__out)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__cxx <- ST.newSTRef Default.def
+            __field__out <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Access")
+                                                                        ST.writeSTRef __field__cxx
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef __field__out
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__cxx <- ST.readSTRef __field__cxx
+                                             !__val__out <- ST.readSTRef __field__out
+                                             Prelude.pure
+                                               (FromCxxVisibility_key __val__cxx __val__out)
+              _idMap = HashMap.fromList [("cxx", 1), ("out", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FromCxxVisibility_key where
+  rnf (FromCxxVisibility_key __field__cxx __field__out)
+    = DeepSeq.rnf __field__cxx `Prelude.seq`
+        DeepSeq.rnf __field__out `Prelude.seq` ()
+
+instance Default.Default FromCxxVisibility_key where
+  def = FromCxxVisibility_key Default.def Default.def
+
+instance Hashable.Hashable FromCxxVisibility_key where
+  hashWithSalt __salt (FromCxxVisibility_key _cxx _out)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _cxx) _out
+
+data EntityToXRefTarget_key = EntityToXRefTarget_key{entityToXRefTarget_key_ent
+                                                     :: Glean.Schema.CodeCxx.Entity,
+                                                     entityToXRefTarget_key_xrefTarget ::
+                                                     Glean.Schema.Cxx1.XRefTarget}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityToXRefTarget_key where
+  toJSON (EntityToXRefTarget_key __field__ent __field__xrefTarget)
+    = Aeson.object
+        ("ent" .= __field__ent :
+           "xrefTarget" .= __field__xrefTarget : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityToXRefTarget_key where
+  buildStruct _proxy
+    (EntityToXRefTarget_key __field__ent __field__xrefTarget)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ent)
+           :
+           Thrift.genField _proxy "xrefTarget" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__xrefTarget)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ent <- ST.newSTRef Default.def
+            __field__xrefTarget <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__xrefTarget
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ent <- ST.readSTRef __field__ent
+                                             !__val__xrefTarget <- ST.readSTRef __field__xrefTarget
+                                             Prelude.pure
+                                               (EntityToXRefTarget_key __val__ent __val__xrefTarget)
+              _idMap = HashMap.fromList [("ent", 1), ("xrefTarget", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityToXRefTarget_key where
+  rnf (EntityToXRefTarget_key __field__ent __field__xrefTarget)
+    = DeepSeq.rnf __field__ent `Prelude.seq`
+        DeepSeq.rnf __field__xrefTarget `Prelude.seq` ()
+
+instance Default.Default EntityToXRefTarget_key where
+  def = EntityToXRefTarget_key Default.def Default.def
+
+instance Hashable.Hashable EntityToXRefTarget_key where
+  hashWithSalt __salt (EntityToXRefTarget_key _ent _xrefTarget)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ent)
+        _xrefTarget
+
+data CxxXRefTargetLocation_key = CxxXRefTargetLocation_key{cxxXRefTargetLocation_key_target
+                                                           :: Glean.Schema.Cxx1.XRefTarget,
+                                                           cxxXRefTargetLocation_key_entity ::
+                                                           Glean.Schema.CodeCxx.Entity,
+                                                           cxxXRefTargetLocation_key_location ::
+                                                           Glean.Schema.CodemarkupTypes.Location}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxXRefTargetLocation_key where
+  toJSON
+    (CxxXRefTargetLocation_key __field__target __field__entity
+       __field__location)
+    = Aeson.object
+        ("target" .= __field__target :
+           "entity" .= __field__entity :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxXRefTargetLocation_key where
+  buildStruct _proxy
+    (CxxXRefTargetLocation_key __field__target __field__entity
+       __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxXRefTargetLocation_key __val__target
+                                                  __val__entity
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList [("target", 1), ("entity", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxXRefTargetLocation_key where
+  rnf
+    (CxxXRefTargetLocation_key __field__target __field__entity
+       __field__location)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default CxxXRefTargetLocation_key where
+  def = CxxXRefTargetLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxXRefTargetLocation_key where
+  hashWithSalt __salt
+    (CxxXRefTargetLocation_key _target _entity _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _entity)
+        _location
+
+data CxxVisibility_key = CxxVisibility_key{cxxVisibility_key_entity
+                                           :: Glean.Schema.CodeCxx.Entity,
+                                           cxxVisibility_key_visibility ::
+                                           Glean.Schema.CodemarkupTypes.Visibility}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxVisibility_key where
+  toJSON (CxxVisibility_key __field__entity __field__visibility)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "visibility" .= __field__visibility : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxVisibility_key where
+  buildStruct _proxy
+    (CxxVisibility_key __field__entity __field__visibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__visibility)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             Prelude.pure
+                                               (CxxVisibility_key __val__entity __val__visibility)
+              _idMap = HashMap.fromList [("entity", 1), ("visibility", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxVisibility_key where
+  rnf (CxxVisibility_key __field__entity __field__visibility)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__visibility `Prelude.seq` ()
+
+instance Default.Default CxxVisibility_key where
+  def = CxxVisibility_key Default.def Default.def
+
+instance Hashable.Hashable CxxVisibility_key where
+  hashWithSalt __salt (CxxVisibility_key _entity _visibility)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _visibility
+
+data CxxResolveTraceLocation_key = CxxResolveTraceLocation_key{cxxResolveTraceLocation_key_trace
+                                                               :: Glean.Schema.Cxx1.Trace,
+                                                               cxxResolveTraceLocation_key_location
+                                                               ::
+                                                               Glean.Schema.CodemarkupTypes.Location,
+                                                               cxxResolveTraceLocation_key_entity ::
+                                                               Glean.Schema.CodeCxx.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveTraceLocation_key where
+  toJSON
+    (CxxResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "location" .= __field__location :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveTraceLocation_key where
+  buildStruct _proxy
+    (CxxResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxResolveTraceLocation_key __val__trace
+                                                  __val__location
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("location", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveTraceLocation_key where
+  rnf
+    (CxxResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxResolveTraceLocation_key where
+  def
+    = CxxResolveTraceLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxResolveTraceLocation_key where
+  hashWithSalt __salt
+    (CxxResolveTraceLocation_key _trace _location _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+           _location)
+        _entity
+
+data CxxResolveLocation_key = CxxResolveLocation_key{cxxResolveLocation_key_location
+                                                     :: Glean.Schema.CodemarkupTypes.Location,
+                                                     cxxResolveLocation_key_entity ::
+                                                     Glean.Schema.CodeCxx.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveLocation_key where
+  toJSON (CxxResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveLocation_key where
+  buildStruct _proxy
+    (CxxResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveLocation_key where
+  rnf (CxxResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxResolveLocation_key where
+  def = CxxResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable CxxResolveLocation_key where
+  hashWithSalt __salt (CxxResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data CxxResolveDeclarationToEntity_key = CxxResolveDeclarationToEntity_key{cxxResolveDeclarationToEntity_key_decl
+                                                                           ::
+                                                                           Glean.Schema.Cxx1.Declaration,
+                                                                           cxxResolveDeclarationToEntity_key_entity
+                                                                           ::
+                                                                           Glean.Schema.CodeCxx.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxResolveDeclarationToEntity_key where
+  toJSON
+    (CxxResolveDeclarationToEntity_key __field__decl __field__entity)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxResolveDeclarationToEntity_key
+         where
+  buildStruct _proxy
+    (CxxResolveDeclarationToEntity_key __field__decl __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxResolveDeclarationToEntity_key __val__decl
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("decl", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxResolveDeclarationToEntity_key where
+  rnf
+    (CxxResolveDeclarationToEntity_key __field__decl __field__entity)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxResolveDeclarationToEntity_key where
+  def = CxxResolveDeclarationToEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxResolveDeclarationToEntity_key where
+  hashWithSalt __salt
+    (CxxResolveDeclarationToEntity_key _decl _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _entity
+
+data CxxNamespaceDeclarationContainsChild_key = CxxNamespaceDeclarationContainsChild_key{cxxNamespaceDeclarationContainsChild_key_parent
+                                                                                         ::
+                                                                                         Glean.Schema.Cxx1.NamespaceDeclaration,
+                                                                                         cxxNamespaceDeclarationContainsChild_key_child
+                                                                                         ::
+                                                                                         Glean.Schema.CodeCxx.Entity}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNamespaceDeclarationContainsChild_key
+         where
+  toJSON
+    (CxxNamespaceDeclarationContainsChild_key __field__parent
+       __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxNamespaceDeclarationContainsChild_key
+         where
+  buildStruct _proxy
+    (CxxNamespaceDeclarationContainsChild_key __field__parent
+       __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxNamespaceDeclarationContainsChild_key
+                                                  __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNamespaceDeclarationContainsChild_key
+         where
+  rnf
+    (CxxNamespaceDeclarationContainsChild_key __field__parent
+       __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxNamespaceDeclarationContainsChild_key
+         where
+  def
+    = CxxNamespaceDeclarationContainsChild_key Default.def Default.def
+
+instance Hashable.Hashable CxxNamespaceDeclarationContainsChild_key
+         where
+  hashWithSalt __salt
+    (CxxNamespaceDeclarationContainsChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxModifiers_key = CxxModifiers_key{cxxModifiers_key_entity ::
+                                         Glean.Schema.CodeCxx.Entity,
+                                         cxxModifiers_key_keywords ::
+                                         Glean.Schema.CodemarkupTypes.Modifiers}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxModifiers_key where
+  toJSON (CxxModifiers_key __field__entity __field__keywords)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "keywords" .= __field__keywords : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxModifiers_key where
+  buildStruct _proxy
+    (CxxModifiers_key __field__entity __field__keywords)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "keywords" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__keywords)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__keywords <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__keywords
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__keywords <- ST.readSTRef __field__keywords
+                                             Prelude.pure
+                                               (CxxModifiers_key __val__entity __val__keywords)
+              _idMap = HashMap.fromList [("entity", 1), ("keywords", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxModifiers_key where
+  rnf (CxxModifiers_key __field__entity __field__keywords)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__keywords `Prelude.seq` ()
+
+instance Default.Default CxxModifiers_key where
+  def = CxxModifiers_key Default.def Default.def
+
+instance Hashable.Hashable CxxModifiers_key where
+  hashWithSalt __salt (CxxModifiers_key _entity _keywords)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _keywords
+
+data CxxIdlEntityUses_key = CxxIdlEntityUses_key{cxxIdlEntityUses_key_target
+                                                 :: Glean.Schema.Code.Entity,
+                                                 cxxIdlEntityUses_key_file :: Glean.Schema.Src.File,
+                                                 cxxIdlEntityUses_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxIdlEntityUses_key where
+  toJSON
+    (CxxIdlEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxIdlEntityUses_key where
+  buildStruct _proxy
+    (CxxIdlEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (CxxIdlEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxIdlEntityUses_key where
+  rnf
+    (CxxIdlEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default CxxIdlEntityUses_key where
+  def = CxxIdlEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxIdlEntityUses_key where
+  hashWithSalt __salt (CxxIdlEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data CxxFindDefinitionOfEntity_key = CxxFindDefinitionOfEntity_key{cxxFindDefinitionOfEntity_key_entity
+                                                                   :: Glean.Schema.CodeCxx.Entity,
+                                                                   cxxFindDefinitionOfEntity_key_definition
+                                                                   :: Glean.Schema.CodeCxx.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFindDefinitionOfEntity_key where
+  toJSON
+    (CxxFindDefinitionOfEntity_key __field__entity __field__definition)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFindDefinitionOfEntity_key where
+  buildStruct _proxy
+    (CxxFindDefinitionOfEntity_key __field__entity __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (CxxFindDefinitionOfEntity_key __val__entity
+                                                  __val__definition)
+              _idMap = HashMap.fromList [("entity", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFindDefinitionOfEntity_key where
+  rnf
+    (CxxFindDefinitionOfEntity_key __field__entity __field__definition)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default CxxFindDefinitionOfEntity_key where
+  def = CxxFindDefinitionOfEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxFindDefinitionOfEntity_key where
+  hashWithSalt __salt
+    (CxxFindDefinitionOfEntity_key _entity _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _definition
+
+data CxxFileEntityXRefLocations_key = CxxFileEntityXRefLocations_key{cxxFileEntityXRefLocations_key_file
+                                                                     :: Glean.Schema.Src.File,
+                                                                     cxxFileEntityXRefLocations_key_xref
+                                                                     ::
+                                                                     Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                     cxxFileEntityXRefLocations_key_entity
+                                                                     :: Glean.Schema.CodeCxx.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXRefLocations_key where
+  toJSON
+    (CxxFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (CxxFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXRefLocations_key where
+  rnf
+    (CxxFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXRefLocations_key where
+  def
+    = CxxFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CxxFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (CxxFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data CxxFileEntityXMapVariableXRefDeclToDefs_key = CxxFileEntityXMapVariableXRefDeclToDefs_key{cxxFileEntityXMapVariableXRefDeclToDefs_key_trace
+                                                                                               ::
+                                                                                               Glean.Schema.Cxx1.FileXRefs,
+                                                                                               cxxFileEntityXMapVariableXRefDeclToDefs_key_source
+                                                                                               ::
+                                                                                               Glean.Schema.Cxx1.Declaration,
+                                                                                               cxxFileEntityXMapVariableXRefDeclToDefs_key_entity
+                                                                                               ::
+                                                                                               Glean.Schema.CodeCxx.Entity,
+                                                                                               cxxFileEntityXMapVariableXRefDeclToDefs_key_location
+                                                                                               ::
+                                                                                               Glean.Schema.CodemarkupTypes.Location}
+                                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  toJSON
+    (CxxFileEntityXMapVariableXRefDeclToDefs_key __field__trace
+       __field__source __field__entity __field__location)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "source" .= __field__source :
+             "entity" .= __field__entity :
+               "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapVariableXRefDeclToDefs_key __field__trace
+       __field__source __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               :
+               Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__location)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxFileEntityXMapVariableXRefDeclToDefs_key
+                                                  __val__trace
+                                                  __val__source
+                                                  __val__entity
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList
+                    [("trace", 1), ("source", 2), ("entity", 3), ("location", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  rnf
+    (CxxFileEntityXMapVariableXRefDeclToDefs_key __field__trace
+       __field__source __field__entity __field__location)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq`
+            DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default
+           CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  def
+    = CxxFileEntityXMapVariableXRefDeclToDefs_key Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable
+           CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  hashWithSalt __salt
+    (CxxFileEntityXMapVariableXRefDeclToDefs_key _trace _source _entity
+       _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+              _source)
+           _entity)
+        _location
+
+data CxxFileEntityXMapVariableXRefDeclLocations_key = CxxFileEntityXMapVariableXRefDeclLocations_key{cxxFileEntityXMapVariableXRefDeclLocations_key_trace
+                                                                                                     ::
+                                                                                                     Glean.Schema.Cxx1.FileXRefs,
+                                                                                                     cxxFileEntityXMapVariableXRefDeclLocations_key_source
+                                                                                                     ::
+                                                                                                     Glean.Schema.Cxx1.Declaration,
+                                                                                                     cxxFileEntityXMapVariableXRefDeclLocations_key_location
+                                                                                                     ::
+                                                                                                     Glean.Schema.CodemarkupTypes.Location}
+                                                      deriving (Prelude.Eq, Prelude.Show,
+                                                                Prelude.Ord)
+
+instance Aeson.ToJSON
+           CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  toJSON
+    (CxxFileEntityXMapVariableXRefDeclLocations_key __field__trace
+       __field__source __field__location)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "source" .= __field__source :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapVariableXRefDeclLocations_key __field__trace
+       __field__source __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxFileEntityXMapVariableXRefDeclLocations_key
+                                                  __val__trace
+                                                  __val__source
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("source", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  rnf
+    (CxxFileEntityXMapVariableXRefDeclLocations_key __field__trace
+       __field__source __field__location)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default
+           CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  def
+    = CxxFileEntityXMapVariableXRefDeclLocations_key Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable
+           CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  hashWithSalt __salt
+    (CxxFileEntityXMapVariableXRefDeclLocations_key _trace _source
+       _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+           _source)
+        _location
+
+data CxxFileEntityXMapFixedXRefLocations_key = CxxFileEntityXMapFixedXRefLocations_key{cxxFileEntityXMapFixedXRefLocations_key_trace
+                                                                                       ::
+                                                                                       Glean.Schema.Cxx1.FileXRefs,
+                                                                                       cxxFileEntityXMapFixedXRefLocations_key_xref
+                                                                                       ::
+                                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                       cxxFileEntityXMapFixedXRefLocations_key_entity
+                                                                                       ::
+                                                                                       Glean.Schema.CodeCxx.Entity}
+                                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityXMapFixedXRefLocations_key where
+  toJSON
+    (CxxFileEntityXMapFixedXRefLocations_key __field__trace
+       __field__xref __field__entity)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityXMapFixedXRefLocations_key
+         where
+  buildStruct _proxy
+    (CxxFileEntityXMapFixedXRefLocations_key __field__trace
+       __field__xref __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxFileEntityXMapFixedXRefLocations_key __val__trace
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityXMapFixedXRefLocations_key
+         where
+  rnf
+    (CxxFileEntityXMapFixedXRefLocations_key __field__trace
+       __field__xref __field__entity)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityXMapFixedXRefLocations_key
+         where
+  def
+    = CxxFileEntityXMapFixedXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CxxFileEntityXMapFixedXRefLocations_key
+         where
+  hashWithSalt __salt
+    (CxxFileEntityXMapFixedXRefLocations_key _trace _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace) _xref)
+        _entity
+
+data CxxFileEntityTraceDeclToDefXRefLocations_key = CxxFileEntityTraceDeclToDefXRefLocations_key{cxxFileEntityTraceDeclToDefXRefLocations_key_file
+                                                                                                 ::
+                                                                                                 Glean.Schema.Src.File,
+                                                                                                 cxxFileEntityTraceDeclToDefXRefLocations_key_trace
+                                                                                                 ::
+                                                                                                 Glean.Schema.Cxx1.Trace,
+                                                                                                 cxxFileEntityTraceDeclToDefXRefLocations_key_xref
+                                                                                                 ::
+                                                                                                 Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                                 cxxFileEntityTraceDeclToDefXRefLocations_key_entity
+                                                                                                 ::
+                                                                                                 Glean.Schema.CodeCxx.Entity}
+                                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  toJSON
+    (CxxFileEntityTraceDeclToDefXRefLocations_key __field__file
+       __field__trace __field__xref __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "trace" .= __field__trace :
+             "xref" .= __field__xref :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  buildStruct _proxy
+    (CxxFileEntityTraceDeclToDefXRefLocations_key __field__file
+       __field__trace __field__xref __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__trace)
+             :
+             Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__xref)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxFileEntityTraceDeclToDefXRefLocations_key
+                                                  __val__file
+                                                  __val__trace
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("trace", 2), ("xref", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  rnf
+    (CxxFileEntityTraceDeclToDefXRefLocations_key __field__file
+       __field__trace __field__xref __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq`
+          DeepSeq.rnf __field__xref `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default
+           CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  def
+    = CxxFileEntityTraceDeclToDefXRefLocations_key Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable
+           CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  hashWithSalt __salt
+    (CxxFileEntityTraceDeclToDefXRefLocations_key _file _trace _xref
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _trace)
+           _xref)
+        _entity
+
+data CxxFileEntitySpellingXRefLocations_key = CxxFileEntitySpellingXRefLocations_key{cxxFileEntitySpellingXRefLocations_key_file
+                                                                                     ::
+                                                                                     Glean.Schema.Src.File,
+                                                                                     cxxFileEntitySpellingXRefLocations_key_xref
+                                                                                     ::
+                                                                                     Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                     cxxFileEntitySpellingXRefLocations_key_entity
+                                                                                     ::
+                                                                                     Glean.Schema.CodeCxx.Entity}
+                                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntitySpellingXRefLocations_key where
+  toJSON
+    (CxxFileEntitySpellingXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntitySpellingXRefLocations_key
+         where
+  buildStruct _proxy
+    (CxxFileEntitySpellingXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxFileEntitySpellingXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntitySpellingXRefLocations_key
+         where
+  rnf
+    (CxxFileEntitySpellingXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxFileEntitySpellingXRefLocations_key
+         where
+  def
+    = CxxFileEntitySpellingXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CxxFileEntitySpellingXRefLocations_key
+         where
+  hashWithSalt __salt
+    (CxxFileEntitySpellingXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data CxxFileEntityIdl_key = CxxFileEntityIdl_key{cxxFileEntityIdl_key_trace
+                                                 :: Glean.Schema.Cxx1.FileXRefs,
+                                                 cxxFileEntityIdl_key_ent ::
+                                                 Glean.Schema.Code.Entity,
+                                                 cxxFileEntityIdl_key_idlEnt ::
+                                                 Glean.Schema.Code.IdlEntity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxFileEntityIdl_key where
+  toJSON
+    (CxxFileEntityIdl_key __field__trace __field__ent __field__idlEnt)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "ent" .= __field__ent :
+             "idlEnt" .= __field__idlEnt : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxFileEntityIdl_key where
+  buildStruct _proxy
+    (CxxFileEntityIdl_key __field__trace __field__ent __field__idlEnt)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "ent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ent)
+             :
+             Thrift.genField _proxy "idlEnt" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__idlEnt)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__ent <- ST.newSTRef Default.def
+            __field__idlEnt <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__idlEnt
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__ent <- ST.readSTRef __field__ent
+                                             !__val__idlEnt <- ST.readSTRef __field__idlEnt
+                                             Prelude.pure
+                                               (CxxFileEntityIdl_key __val__trace __val__ent
+                                                  __val__idlEnt)
+              _idMap = HashMap.fromList [("trace", 1), ("ent", 2), ("idlEnt", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxFileEntityIdl_key where
+  rnf
+    (CxxFileEntityIdl_key __field__trace __field__ent __field__idlEnt)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__ent `Prelude.seq`
+          DeepSeq.rnf __field__idlEnt `Prelude.seq` ()
+
+instance Default.Default CxxFileEntityIdl_key where
+  def = CxxFileEntityIdl_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxFileEntityIdl_key where
+  hashWithSalt __salt (CxxFileEntityIdl_key _trace _ent _idlEnt)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace) _ent)
+        _idlEnt
+
+data CxxExtendsParentEntity_key = CxxExtendsParentEntity_key{cxxExtendsParentEntity_key_child
+                                                             :: Glean.Schema.CodeCxx.Entity,
+                                                             cxxExtendsParentEntity_key_parent ::
+                                                             Glean.Schema.CodeCxx.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxExtendsParentEntity_key where
+  toJSON (CxxExtendsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxExtendsParentEntity_key where
+  buildStruct _proxy
+    (CxxExtendsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxExtendsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxExtendsParentEntity_key where
+  rnf (CxxExtendsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxExtendsParentEntity_key where
+  def = CxxExtendsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxExtendsParentEntity_key where
+  hashWithSalt __salt (CxxExtendsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxExtendsChildEntity_key = CxxExtendsChildEntity_key{cxxExtendsChildEntity_key_parent
+                                                           :: Glean.Schema.CodeCxx.Entity,
+                                                           cxxExtendsChildEntity_key_child ::
+                                                           Glean.Schema.CodeCxx.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxExtendsChildEntity_key where
+  toJSON (CxxExtendsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxExtendsChildEntity_key where
+  buildStruct _proxy
+    (CxxExtendsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxExtendsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxExtendsChildEntity_key where
+  rnf (CxxExtendsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxExtendsChildEntity_key where
+  def = CxxExtendsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxExtendsChildEntity_key where
+  hashWithSalt __salt (CxxExtendsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxEntityUses_key = CxxEntityUses_key{cxxEntityUses_key_target
+                                           :: Glean.Schema.CodeCxx.Entity,
+                                           cxxEntityUses_key_file :: Glean.Schema.Src.File,
+                                           cxxEntityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityUses_key where
+  toJSON
+    (CxxEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityUses_key where
+  buildStruct _proxy
+    (CxxEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (CxxEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityUses_key where
+  rnf (CxxEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default CxxEntityUses_key where
+  def = CxxEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxEntityUses_key where
+  hashWithSalt __salt (CxxEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data CxxEntityUSR_key = CxxEntityUSR_key{cxxEntityUSR_key_entity ::
+                                         Glean.Schema.CodeCxx.Entity,
+                                         cxxEntityUSR_key_usr :: Glean.Schema.Cxx1.USR}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityUSR_key where
+  toJSON (CxxEntityUSR_key __field__entity __field__usr)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "usr" .= __field__usr : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityUSR_key where
+  buildStruct _proxy (CxxEntityUSR_key __field__entity __field__usr)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "usr" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__usr)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__usr <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__usr
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__usr <- ST.readSTRef __field__usr
+                                             Prelude.pure
+                                               (CxxEntityUSR_key __val__entity __val__usr)
+              _idMap = HashMap.fromList [("entity", 1), ("usr", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityUSR_key where
+  rnf (CxxEntityUSR_key __field__entity __field__usr)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__usr `Prelude.seq` ()
+
+instance Default.Default CxxEntityUSR_key where
+  def = CxxEntityUSR_key Default.def ""
+
+instance Hashable.Hashable CxxEntityUSR_key where
+  hashWithSalt __salt (CxxEntityUSR_key _entity _usr)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity) _usr
+
+data CxxEntitySource_key = CxxEntitySource_key{cxxEntitySource_key_target
+                                               :: Glean.Schema.CodeCxx.Entity,
+                                               cxxEntitySource_key_source ::
+                                               Glean.Schema.CodeCxx.Entity}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntitySource_key where
+  toJSON (CxxEntitySource_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntitySource_key where
+  buildStruct _proxy
+    (CxxEntitySource_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (CxxEntitySource_key __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntitySource_key where
+  rnf (CxxEntitySource_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default CxxEntitySource_key where
+  def = CxxEntitySource_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntitySource_key where
+  hashWithSalt __salt (CxxEntitySource_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data CxxEntityMangledNameHash_key = CxxEntityMangledNameHash_key{cxxEntityMangledNameHash_key_entity
+                                                                 :: Glean.Schema.CodeCxx.Entity,
+                                                                 cxxEntityMangledNameHash_key_hash
+                                                                 ::
+                                                                 Glean.Schema.Cxx1.MangledNameHash}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityMangledNameHash_key where
+  toJSON (CxxEntityMangledNameHash_key __field__entity __field__hash)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "hash" .= __field__hash : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityMangledNameHash_key where
+  buildStruct _proxy
+    (CxxEntityMangledNameHash_key __field__entity __field__hash)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__hash)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__hash <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__hash <- ST.readSTRef __field__hash
+                                             Prelude.pure
+                                               (CxxEntityMangledNameHash_key __val__entity
+                                                  __val__hash)
+              _idMap = HashMap.fromList [("entity", 1), ("hash", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityMangledNameHash_key where
+  rnf (CxxEntityMangledNameHash_key __field__entity __field__hash)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__hash `Prelude.seq` ()
+
+instance Default.Default CxxEntityMangledNameHash_key where
+  def = CxxEntityMangledNameHash_key Default.def ""
+
+instance Hashable.Hashable CxxEntityMangledNameHash_key where
+  hashWithSalt __salt (CxxEntityMangledNameHash_key _entity _hash)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _hash
+
+data CxxEntityLocation_key = CxxEntityLocation_key{cxxEntityLocation_key_entity
+                                                   :: Glean.Schema.CodeCxx.Entity,
+                                                   cxxEntityLocation_key_location ::
+                                                   Glean.Schema.CodemarkupTypes.Location}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityLocation_key where
+  toJSON (CxxEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityLocation_key where
+  buildStruct _proxy
+    (CxxEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxEntityLocation_key __val__entity __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityLocation_key where
+  rnf (CxxEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default CxxEntityLocation_key where
+  def = CxxEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntityLocation_key where
+  hashWithSalt __salt (CxxEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data CxxEntityKind_key = CxxEntityKind_key{cxxEntityKind_key_entity
+                                           :: Glean.Schema.CodeCxx.Entity,
+                                           cxxEntityKind_key_kind ::
+                                           Glean.Schema.CodemarkupTypes.SymbolKind}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityKind_key where
+  toJSON (CxxEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityKind_key where
+  buildStruct _proxy
+    (CxxEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (CxxEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityKind_key where
+  rnf (CxxEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default CxxEntityKind_key where
+  def = CxxEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntityKind_key where
+  hashWithSalt __salt (CxxEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data CxxEntityInfo_key = CxxEntityInfo_key{cxxEntityInfo_key_entity
+                                           :: Glean.Schema.CodeCxx.Entity,
+                                           cxxEntityInfo_key_info ::
+                                           Glean.Schema.CodemarkupTypes.SymbolInfo}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityInfo_key where
+  toJSON (CxxEntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityInfo_key where
+  buildStruct _proxy
+    (CxxEntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (CxxEntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityInfo_key where
+  rnf (CxxEntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default CxxEntityInfo_key where
+  def = CxxEntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntityInfo_key where
+  hashWithSalt __salt (CxxEntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data CxxEntityIdl_key = CxxEntityIdl_key{cxxEntityIdl_key_ent ::
+                                         Glean.Schema.CodeCxx.Entity,
+                                         cxxEntityIdl_key_idlEnt :: Glean.Schema.Code.IdlEntity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityIdl_key where
+  toJSON (CxxEntityIdl_key __field__ent __field__idlEnt)
+    = Aeson.object
+        ("ent" .= __field__ent :
+           "idlEnt" .= __field__idlEnt : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityIdl_key where
+  buildStruct _proxy (CxxEntityIdl_key __field__ent __field__idlEnt)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ent)
+           :
+           Thrift.genField _proxy "idlEnt" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__idlEnt)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ent <- ST.newSTRef Default.def
+            __field__idlEnt <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__idlEnt
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ent <- ST.readSTRef __field__ent
+                                             !__val__idlEnt <- ST.readSTRef __field__idlEnt
+                                             Prelude.pure
+                                               (CxxEntityIdl_key __val__ent __val__idlEnt)
+              _idMap = HashMap.fromList [("ent", 1), ("idlEnt", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityIdl_key where
+  rnf (CxxEntityIdl_key __field__ent __field__idlEnt)
+    = DeepSeq.rnf __field__ent `Prelude.seq`
+        DeepSeq.rnf __field__idlEnt `Prelude.seq` ()
+
+instance Default.Default CxxEntityIdl_key where
+  def = CxxEntityIdl_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntityIdl_key where
+  hashWithSalt __salt (CxxEntityIdl_key _ent _idlEnt)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ent) _idlEnt
+
+data CxxEntityDocumentation_key = CxxEntityDocumentation_key{cxxEntityDocumentation_key_entity
+                                                             :: Glean.Schema.CodeCxx.Entity,
+                                                             cxxEntityDocumentation_key_file ::
+                                                             Glean.Schema.Src.File,
+                                                             cxxEntityDocumentation_key_span ::
+                                                             Glean.Schema.Src.ByteSpan}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityDocumentation_key where
+  toJSON
+    (CxxEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityDocumentation_key where
+  buildStruct _proxy
+    (CxxEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (CxxEntityDocumentation_key __val__entity __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("entity", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityDocumentation_key where
+  rnf
+    (CxxEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default CxxEntityDocumentation_key where
+  def
+    = CxxEntityDocumentation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable CxxEntityDocumentation_key where
+  hashWithSalt __salt
+    (CxxEntityDocumentation_key _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _file)
+        _span
+
+data CxxEntityDefinitionBase_key = CxxEntityDefinitionBase_key{cxxEntityDefinitionBase_key_target
+                                                               :: Glean.Schema.CodeCxx.Definition,
+                                                               cxxEntityDefinitionBase_key_base ::
+                                                               Glean.Schema.Cxx1.Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxEntityDefinitionBase_key where
+  toJSON (CxxEntityDefinitionBase_key __field__target __field__base)
+    = Aeson.object
+        ("target" .= __field__target :
+           "base" .= __field__base : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxEntityDefinitionBase_key where
+  buildStruct _proxy
+    (CxxEntityDefinitionBase_key __field__target __field__base)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__base <- ST.readSTRef __field__base
+                                             Prelude.pure
+                                               (CxxEntityDefinitionBase_key __val__target
+                                                  __val__base)
+              _idMap = HashMap.fromList [("target", 1), ("base", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxEntityDefinitionBase_key where
+  rnf (CxxEntityDefinitionBase_key __field__target __field__base)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq` ()
+
+instance Default.Default CxxEntityDefinitionBase_key where
+  def = CxxEntityDefinitionBase_key Default.def Default.def
+
+instance Hashable.Hashable CxxEntityDefinitionBase_key where
+  hashWithSalt __salt (CxxEntityDefinitionBase_key _target _base)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _base
+
+data CxxDefnVisibility_key = CxxDefnVisibility_key{cxxDefnVisibility_key_decl
+                                                   :: Glean.Schema.CodeCxx.Definition,
+                                                   cxxDefnVisibility_key_visibility ::
+                                                   Glean.Schema.CodemarkupTypes.Visibility}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefnVisibility_key where
+  toJSON (CxxDefnVisibility_key __field__decl __field__visibility)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "visibility" .= __field__visibility : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefnVisibility_key where
+  buildStruct _proxy
+    (CxxDefnVisibility_key __field__decl __field__visibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__visibility)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             Prelude.pure
+                                               (CxxDefnVisibility_key __val__decl __val__visibility)
+              _idMap = HashMap.fromList [("decl", 1), ("visibility", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefnVisibility_key where
+  rnf (CxxDefnVisibility_key __field__decl __field__visibility)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__visibility `Prelude.seq` ()
+
+instance Default.Default CxxDefnVisibility_key where
+  def = CxxDefnVisibility_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefnVisibility_key where
+  hashWithSalt __salt (CxxDefnVisibility_key _decl _visibility)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _visibility
+
+data CxxDefinitionModifiers_key = CxxDefinitionModifiers_key{cxxDefinitionModifiers_key_entity
+                                                             :: Glean.Schema.CodeCxx.Definition,
+                                                             cxxDefinitionModifiers_key_keywords ::
+                                                             Glean.Schema.CodemarkupTypes.Modifiers}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionModifiers_key where
+  toJSON
+    (CxxDefinitionModifiers_key __field__entity __field__keywords)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "keywords" .= __field__keywords : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionModifiers_key where
+  buildStruct _proxy
+    (CxxDefinitionModifiers_key __field__entity __field__keywords)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "keywords" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__keywords)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__keywords <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__keywords
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__keywords <- ST.readSTRef __field__keywords
+                                             Prelude.pure
+                                               (CxxDefinitionModifiers_key __val__entity
+                                                  __val__keywords)
+              _idMap = HashMap.fromList [("entity", 1), ("keywords", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionModifiers_key where
+  rnf (CxxDefinitionModifiers_key __field__entity __field__keywords)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__keywords `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionModifiers_key where
+  def = CxxDefinitionModifiers_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefinitionModifiers_key where
+  hashWithSalt __salt (CxxDefinitionModifiers_key _entity _keywords)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _keywords
+
+data CxxDefinitionExtendsParent_key = CxxDefinitionExtendsParent_key{cxxDefinitionExtendsParent_key_child
+                                                                     ::
+                                                                     Glean.Schema.CodeCxx.Definition,
+                                                                     cxxDefinitionExtendsParent_key_parent
+                                                                     :: Glean.Schema.CodeCxx.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionExtendsParent_key where
+  toJSON
+    (CxxDefinitionExtendsParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionExtendsParent_key where
+  buildStruct _proxy
+    (CxxDefinitionExtendsParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxDefinitionExtendsParent_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionExtendsParent_key where
+  rnf (CxxDefinitionExtendsParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionExtendsParent_key where
+  def = CxxDefinitionExtendsParent_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefinitionExtendsParent_key where
+  hashWithSalt __salt (CxxDefinitionExtendsParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxDefinitionExtendsChild_key = CxxDefinitionExtendsChild_key{cxxDefinitionExtendsChild_key_parent
+                                                                   ::
+                                                                   Glean.Schema.CodeCxx.Definition,
+                                                                   cxxDefinitionExtendsChild_key_child
+                                                                   :: Glean.Schema.CodeCxx.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionExtendsChild_key where
+  toJSON
+    (CxxDefinitionExtendsChild_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionExtendsChild_key where
+  buildStruct _proxy
+    (CxxDefinitionExtendsChild_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxDefinitionExtendsChild_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionExtendsChild_key where
+  rnf (CxxDefinitionExtendsChild_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionExtendsChild_key where
+  def = CxxDefinitionExtendsChild_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefinitionExtendsChild_key where
+  hashWithSalt __salt (CxxDefinitionExtendsChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxDefinitionContainsParent_key = CxxDefinitionContainsParent_key{cxxDefinitionContainsParent_key_child
+                                                                       ::
+                                                                       Glean.Schema.CodeCxx.Definition,
+                                                                       cxxDefinitionContainsParent_key_parent
+                                                                       ::
+                                                                       Glean.Schema.CodeCxx.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionContainsParent_key where
+  toJSON
+    (CxxDefinitionContainsParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionContainsParent_key where
+  buildStruct _proxy
+    (CxxDefinitionContainsParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxDefinitionContainsParent_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionContainsParent_key where
+  rnf
+    (CxxDefinitionContainsParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionContainsParent_key where
+  def = CxxDefinitionContainsParent_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefinitionContainsParent_key where
+  hashWithSalt __salt
+    (CxxDefinitionContainsParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxDefinitionContainsChild_key = CxxDefinitionContainsChild_key{cxxDefinitionContainsChild_key_parent
+                                                                     ::
+                                                                     Glean.Schema.CodeCxx.Definition,
+                                                                     cxxDefinitionContainsChild_key_child
+                                                                     :: Glean.Schema.CodeCxx.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefinitionContainsChild_key where
+  toJSON
+    (CxxDefinitionContainsChild_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDefinitionContainsChild_key where
+  buildStruct _proxy
+    (CxxDefinitionContainsChild_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxDefinitionContainsChild_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefinitionContainsChild_key where
+  rnf (CxxDefinitionContainsChild_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxDefinitionContainsChild_key where
+  def = CxxDefinitionContainsChild_key Default.def Default.def
+
+instance Hashable.Hashable CxxDefinitionContainsChild_key where
+  hashWithSalt __salt (CxxDefinitionContainsChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxDefToDeclFamilyXRefTargetLocation_key = CxxDefToDeclFamilyXRefTargetLocation_key{cxxDefToDeclFamilyXRefTargetLocation_key_decl
+                                                                                         ::
+                                                                                         Glean.Schema.Cxx1.Declaration,
+                                                                                         cxxDefToDeclFamilyXRefTargetLocation_key_entity
+                                                                                         ::
+                                                                                         Glean.Schema.CodeCxx.Entity,
+                                                                                         cxxDefToDeclFamilyXRefTargetLocation_key_location
+                                                                                         ::
+                                                                                         Glean.Schema.CodemarkupTypes.Location}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  toJSON
+    (CxxDefToDeclFamilyXRefTargetLocation_key __field__decl
+       __field__entity __field__location)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "entity" .= __field__entity :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  buildStruct _proxy
+    (CxxDefToDeclFamilyXRefTargetLocation_key __field__decl
+       __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxDefToDeclFamilyXRefTargetLocation_key __val__decl
+                                                  __val__entity
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList [("decl", 1), ("entity", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  rnf
+    (CxxDefToDeclFamilyXRefTargetLocation_key __field__decl
+       __field__entity __field__location)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  def
+    = CxxDefToDeclFamilyXRefTargetLocation_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  hashWithSalt __salt
+    (CxxDefToDeclFamilyXRefTargetLocation_key _decl _entity _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+           _entity)
+        _location
+
+data CxxDeclarationSource_key = CxxDeclarationSource_key{cxxDeclarationSource_key_target
+                                                         :: Glean.Schema.Cxx1.Declaration,
+                                                         cxxDeclarationSource_key_referrer ::
+                                                         Glean.Schema.CodeCxx.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationSource_key where
+  toJSON (CxxDeclarationSource_key __field__target __field__referrer)
+    = Aeson.object
+        ("target" .= __field__target :
+           "referrer" .= __field__referrer : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationSource_key where
+  buildStruct _proxy
+    (CxxDeclarationSource_key __field__target __field__referrer)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "referrer" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__referrer)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__referrer <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__referrer
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__referrer <- ST.readSTRef __field__referrer
+                                             Prelude.pure
+                                               (CxxDeclarationSource_key __val__target
+                                                  __val__referrer)
+              _idMap = HashMap.fromList [("target", 1), ("referrer", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationSource_key where
+  rnf (CxxDeclarationSource_key __field__target __field__referrer)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__referrer `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationSource_key where
+  def = CxxDeclarationSource_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationSource_key where
+  hashWithSalt __salt (CxxDeclarationSource_key _target _referrer)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _referrer
+
+data CxxDeclarationModifiers_key = CxxDeclarationModifiers_key{cxxDeclarationModifiers_key_entity
+                                                               :: Glean.Schema.Cxx1.Declaration,
+                                                               cxxDeclarationModifiers_key_keywords
+                                                               ::
+                                                               Glean.Schema.CodemarkupTypes.Modifiers}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationModifiers_key where
+  toJSON
+    (CxxDeclarationModifiers_key __field__entity __field__keywords)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "keywords" .= __field__keywords : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationModifiers_key where
+  buildStruct _proxy
+    (CxxDeclarationModifiers_key __field__entity __field__keywords)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "keywords" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__keywords)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__keywords <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__keywords
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__keywords <- ST.readSTRef __field__keywords
+                                             Prelude.pure
+                                               (CxxDeclarationModifiers_key __val__entity
+                                                  __val__keywords)
+              _idMap = HashMap.fromList [("entity", 1), ("keywords", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationModifiers_key where
+  rnf (CxxDeclarationModifiers_key __field__entity __field__keywords)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__keywords `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationModifiers_key where
+  def = CxxDeclarationModifiers_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationModifiers_key where
+  hashWithSalt __salt (CxxDeclarationModifiers_key _entity _keywords)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _keywords
+
+data CxxDeclarationExtendsParent_key = CxxDeclarationExtendsParent_key{cxxDeclarationExtendsParent_key_child
+                                                                       ::
+                                                                       Glean.Schema.Cxx1.Declaration,
+                                                                       cxxDeclarationExtendsParent_key_parent
+                                                                       ::
+                                                                       Glean.Schema.CodeCxx.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationExtendsParent_key where
+  toJSON
+    (CxxDeclarationExtendsParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationExtendsParent_key where
+  buildStruct _proxy
+    (CxxDeclarationExtendsParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxDeclarationExtendsParent_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationExtendsParent_key where
+  rnf
+    (CxxDeclarationExtendsParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationExtendsParent_key where
+  def = CxxDeclarationExtendsParent_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationExtendsParent_key where
+  hashWithSalt __salt
+    (CxxDeclarationExtendsParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxDeclarationExtendsChild_key = CxxDeclarationExtendsChild_key{cxxDeclarationExtendsChild_key_parent
+                                                                     ::
+                                                                     Glean.Schema.Cxx1.Declaration,
+                                                                     cxxDeclarationExtendsChild_key_child
+                                                                     :: Glean.Schema.CodeCxx.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationExtendsChild_key where
+  toJSON
+    (CxxDeclarationExtendsChild_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationExtendsChild_key where
+  buildStruct _proxy
+    (CxxDeclarationExtendsChild_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxDeclarationExtendsChild_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationExtendsChild_key where
+  rnf (CxxDeclarationExtendsChild_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationExtendsChild_key where
+  def = CxxDeclarationExtendsChild_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationExtendsChild_key where
+  hashWithSalt __salt (CxxDeclarationExtendsChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxDeclarationContainsParent_key = CxxDeclarationContainsParent_key{cxxDeclarationContainsParent_key_child
+                                                                         ::
+                                                                         Glean.Schema.Cxx1.Declaration,
+                                                                         cxxDeclarationContainsParent_key_parent
+                                                                         ::
+                                                                         Glean.Schema.CodeCxx.Entity}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationContainsParent_key where
+  toJSON
+    (CxxDeclarationContainsParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationContainsParent_key where
+  buildStruct _proxy
+    (CxxDeclarationContainsParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxDeclarationContainsParent_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationContainsParent_key where
+  rnf
+    (CxxDeclarationContainsParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationContainsParent_key where
+  def = CxxDeclarationContainsParent_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationContainsParent_key where
+  hashWithSalt __salt
+    (CxxDeclarationContainsParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxDeclarationContainsChild_key = CxxDeclarationContainsChild_key{cxxDeclarationContainsChild_key_parent
+                                                                       ::
+                                                                       Glean.Schema.Cxx1.Declaration,
+                                                                       cxxDeclarationContainsChild_key_child
+                                                                       ::
+                                                                       Glean.Schema.CodeCxx.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclarationContainsChild_key where
+  toJSON
+    (CxxDeclarationContainsChild_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclarationContainsChild_key where
+  buildStruct _proxy
+    (CxxDeclarationContainsChild_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxDeclarationContainsChild_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclarationContainsChild_key where
+  rnf
+    (CxxDeclarationContainsChild_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxDeclarationContainsChild_key where
+  def = CxxDeclarationContainsChild_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclarationContainsChild_key where
+  hashWithSalt __salt
+    (CxxDeclarationContainsChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxDeclVisibility_key = CxxDeclVisibility_key{cxxDeclVisibility_key_decl
+                                                   :: Glean.Schema.Cxx1.Declaration,
+                                                   cxxDeclVisibility_key_visibility ::
+                                                   Glean.Schema.CodemarkupTypes.Visibility}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclVisibility_key where
+  toJSON (CxxDeclVisibility_key __field__decl __field__visibility)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "visibility" .= __field__visibility : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclVisibility_key where
+  buildStruct _proxy
+    (CxxDeclVisibility_key __field__decl __field__visibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__visibility)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             Prelude.pure
+                                               (CxxDeclVisibility_key __val__decl __val__visibility)
+              _idMap = HashMap.fromList [("decl", 1), ("visibility", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclVisibility_key where
+  rnf (CxxDeclVisibility_key __field__decl __field__visibility)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__visibility `Prelude.seq` ()
+
+instance Default.Default CxxDeclVisibility_key where
+  def = CxxDeclVisibility_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclVisibility_key where
+  hashWithSalt __salt (CxxDeclVisibility_key _decl _visibility)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _visibility
+
+data CxxDeclToDefXRefTargetLocation_key = CxxDeclToDefXRefTargetLocation_key{cxxDeclToDefXRefTargetLocation_key_decl
+                                                                             ::
+                                                                             Glean.Schema.Cxx1.Declaration,
+                                                                             cxxDeclToDefXRefTargetLocation_key_entity
+                                                                             ::
+                                                                             Glean.Schema.CodeCxx.Entity,
+                                                                             cxxDeclToDefXRefTargetLocation_key_location
+                                                                             ::
+                                                                             Glean.Schema.CodemarkupTypes.Location}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclToDefXRefTargetLocation_key where
+  toJSON
+    (CxxDeclToDefXRefTargetLocation_key __field__decl __field__entity
+       __field__location)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "entity" .= __field__entity :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclToDefXRefTargetLocation_key
+         where
+  buildStruct _proxy
+    (CxxDeclToDefXRefTargetLocation_key __field__decl __field__entity
+       __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (CxxDeclToDefXRefTargetLocation_key __val__decl
+                                                  __val__entity
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList [("decl", 1), ("entity", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclToDefXRefTargetLocation_key where
+  rnf
+    (CxxDeclToDefXRefTargetLocation_key __field__decl __field__entity
+       __field__location)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default CxxDeclToDefXRefTargetLocation_key where
+  def
+    = CxxDeclToDefXRefTargetLocation_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable CxxDeclToDefXRefTargetLocation_key where
+  hashWithSalt __salt
+    (CxxDeclToDefXRefTargetLocation_key _decl _entity _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+           _entity)
+        _location
+
+data CxxDeclKind_key = CxxDeclKind_key{cxxDeclKind_key_decl ::
+                                       Glean.Schema.Cxx1.Declaration,
+                                       cxxDeclKind_key_kind ::
+                                       Glean.Schema.CodemarkupTypes.SymbolKind}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclKind_key where
+  toJSON (CxxDeclKind_key __field__decl __field__kind)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclKind_key where
+  buildStruct _proxy (CxxDeclKind_key __field__decl __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (CxxDeclKind_key __val__decl __val__kind)
+              _idMap = HashMap.fromList [("decl", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclKind_key where
+  rnf (CxxDeclKind_key __field__decl __field__kind)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default CxxDeclKind_key where
+  def = CxxDeclKind_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclKind_key where
+  hashWithSalt __salt (CxxDeclKind_key _decl _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _kind
+
+data CxxDeclInfo_key = CxxDeclInfo_key{cxxDeclInfo_key_decl ::
+                                       Glean.Schema.Cxx1.Declaration,
+                                       cxxDeclInfo_key_info ::
+                                       Glean.Schema.CodemarkupTypes.SymbolInfo}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxDeclInfo_key where
+  toJSON (CxxDeclInfo_key __field__decl __field__info)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxDeclInfo_key where
+  buildStruct _proxy (CxxDeclInfo_key __field__decl __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure (CxxDeclInfo_key __val__decl __val__info)
+              _idMap = HashMap.fromList [("decl", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxDeclInfo_key where
+  rnf (CxxDeclInfo_key __field__decl __field__info)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default CxxDeclInfo_key where
+  def = CxxDeclInfo_key Default.def Default.def
+
+instance Hashable.Hashable CxxDeclInfo_key where
+  hashWithSalt __salt (CxxDeclInfo_key _decl _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _info
+
+data CxxContainsParentEntity_key = CxxContainsParentEntity_key{cxxContainsParentEntity_key_child
+                                                               :: Glean.Schema.CodeCxx.Entity,
+                                                               cxxContainsParentEntity_key_parent ::
+                                                               Glean.Schema.CodeCxx.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxContainsParentEntity_key where
+  toJSON (CxxContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxContainsParentEntity_key where
+  buildStruct _proxy
+    (CxxContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (CxxContainsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxContainsParentEntity_key where
+  rnf (CxxContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default CxxContainsParentEntity_key where
+  def = CxxContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxContainsParentEntity_key where
+  hashWithSalt __salt (CxxContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data CxxContainsChildEntity_key = CxxContainsChildEntity_key{cxxContainsChildEntity_key_parent
+                                                             :: Glean.Schema.CodeCxx.Entity,
+                                                             cxxContainsChildEntity_key_child ::
+                                                             Glean.Schema.CodeCxx.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxContainsChildEntity_key where
+  toJSON (CxxContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxContainsChildEntity_key where
+  buildStruct _proxy
+    (CxxContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (CxxContainsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxContainsChildEntity_key where
+  rnf (CxxContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default CxxContainsChildEntity_key where
+  def = CxxContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable CxxContainsChildEntity_key where
+  hashWithSalt __salt (CxxContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data CxxAnnotation_key = CxxAnnotation_key{cxxAnnotation_key_entity
+                                           :: Glean.Schema.CodeCxx.Entity,
+                                           cxxAnnotation_key_anns ::
+                                           Glean.Schema.CodeCxx.Annotations}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxAnnotation_key where
+  toJSON (CxxAnnotation_key __field__entity __field__anns)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "anns" .= __field__anns : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxAnnotation_key where
+  buildStruct _proxy
+    (CxxAnnotation_key __field__entity __field__anns)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "anns" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__anns)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__anns <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__anns
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__anns <- ST.readSTRef __field__anns
+                                             Prelude.pure
+                                               (CxxAnnotation_key __val__entity __val__anns)
+              _idMap = HashMap.fromList [("entity", 1), ("anns", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxAnnotation_key where
+  rnf (CxxAnnotation_key __field__entity __field__anns)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__anns `Prelude.seq` ()
+
+instance Default.Default CxxAnnotation_key where
+  def = CxxAnnotation_key Default.def Default.def
+
+instance Hashable.Hashable CxxAnnotation_key where
+  hashWithSalt __salt (CxxAnnotation_key _entity _anns)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _anns
+{-# LINE 22 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationExtendsChild_key"
+           (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild_key
+     =
+     'Angle.TField "parent" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 33 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationExtendsChild" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationExtendsChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationExtendsChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsChild
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 49 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefinitionModifiers_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "keywords"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 60 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers
+       = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefinitionModifiers" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefinitionModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefinitionModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 70 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 76 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxResolveDeclarationToEntity_key"
+           (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 87 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxResolveDeclarationToEntity"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxResolveDeclarationToEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxResolveDeclarationToEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveDeclarationToEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 112 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxVisibility_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "visibility"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 114 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxVisibility =
+       Glean.Schema.CodemarkupCxx.Types.CxxVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxVisibility" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxVisibility x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 123 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 129 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxFileEntityTraceDeclToDefXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 142 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "trace"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TField "xref"
+             (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+             ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 144 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxFileEntityTraceDeclToDefXRefLocations"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntityTraceDeclToDefXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityTraceDeclToDefXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 154 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityTraceDeclToDefXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 160 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.SymbolToEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.SymbolToEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.SymbolToEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.SymbolToEntity_key"
+           (Prelude.Just 0))
+{-# LINE 169 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.SymbolToEntity_key
+     =
+     'Angle.TField "usr" (Glean.Schema.CodeCxx.Types.SymbolId)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 171 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.SymbolToEntity
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.SymbolToEntity =
+       Glean.Schema.CodemarkupCxx.Types.SymbolToEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.SymbolToEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.symbolToEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.SymbolToEntity x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.symbolToEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 180 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.SymbolToEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 186 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationSource_key"
+           (Prelude.Just 0))
+{-# LINE 195 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource_key
+     =
+     'Angle.TField "target" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "referrer" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 197 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationSource" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationSource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationSource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 206 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationSource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 212 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntitySource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntitySource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntitySource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntitySource_key"
+           (Prelude.Just 0))
+{-# LINE 221 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntitySource_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "source" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 223 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntitySource
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntitySource =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntitySource_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntitySource" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntitySource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntitySource x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntitySource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 232 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntitySource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 238 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxExtendsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 247 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 249 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity
+       = Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxExtendsParentEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxExtendsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxExtendsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 259 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 265 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclInfo_key" (Prelude.Just 0))
+{-# LINE 274 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 276 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo =
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo_key
+  getName _proxy = Glean.PredicateRef "codemarkup.cxx.CxxDeclInfo" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxDeclInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxDeclInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 285 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxDeclInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 291 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxFileEntityIdl_key"
+           (Prelude.Just 0))
+{-# LINE 302 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl_key
+     =
+     'Angle.TField "trace"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FileXRefs)
+       ('Angle.TField "ent" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TField "idlEnt" (Glean.Schema.Code.Types.IdlEntity)
+             ('Angle.TNoFields)))
+{-# LINE 304 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxFileEntityIdl" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxFileEntityIdl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityIdl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 313 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityIdl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 319 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 328 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 330 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 339 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 345 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationContainsChild_key"
+           (Prelude.Just 0))
+{-# LINE 354 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild_key
+     =
+     'Angle.TField "parent" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 356 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationContainsChild" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationContainsChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationContainsChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 366 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsChild
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 372 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 381 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 383 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity
+       = Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxContainsParentEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxContainsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxContainsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 393 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 399 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxFileEntityXMapFixedXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 410 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations_key
+     =
+     'Angle.TField "trace"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FileXRefs)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 412 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxFileEntityXMapFixedXRefLocations"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapFixedXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapFixedXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 422 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapFixedXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 428 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclLocations_key"
+           (Prelude.Just 0))
+{-# LINE 439 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations_key
+     =
+     'Angle.TField "trace"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FileXRefs)
+       ('Angle.TField "source" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TField "location"
+             (Glean.Schema.CodemarkupTypes.Types.Location)
+             ('Angle.TNoFields)))
+{-# LINE 441 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclLocations"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapVariableXRefDeclLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapVariableXRefDeclLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 451 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 457 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityInfo_key"
+           (Prelude.Just 0))
+{-# LINE 466 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 468 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityInfo" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 477 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxEntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 483 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclToDefs_key"
+           (Prelude.Just 0))
+{-# LINE 496 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs_key
+     =
+     'Angle.TField "trace"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FileXRefs)
+       ('Angle.TField "source" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TField "location"
+                (Glean.Schema.CodemarkupTypes.Types.Location)
+                ('Angle.TNoFields))))
+{-# LINE 498 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxFileEntityXMapVariableXRefDeclToDefs"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapVariableXRefDeclToDefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXMapVariableXRefDeclToDefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 508 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXMapVariableXRefDeclToDefs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 514 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationContainsParent_key"
+           (Prelude.Just 0))
+{-# LINE 523 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent_key
+     =
+     'Angle.TField "child" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 525 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationContainsParent"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationContainsParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationContainsParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 535 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationContainsParent
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 541 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.XRefTargetToEntity_key"
+           (Prelude.Just 0))
+{-# LINE 550 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity_key
+     =
+     'Angle.TField "xrefTarget" (Glean.Schema.Cxx1.Types.XRefTarget)
+       ('Angle.TField "ent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 552 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity =
+       Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.XRefTargetToEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.xRefTargetToEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.xRefTargetToEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 561 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.XRefTargetToEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 567 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxIdlEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 578 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 580 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses =
+       Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxIdlEntityUses" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxIdlEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxIdlEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 589 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxIdlEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 595 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefinitionContainsParent_key"
+           (Prelude.Just 0))
+{-# LINE 604 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 606 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent
+       = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefinitionContainsParent" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefinitionContainsParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefinitionContainsParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 616 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsParent
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 622 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 631 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 633 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityKind =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityKind" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityKind x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 642 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 648 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityMangledNameHash_key"
+           (Prelude.Just 0))
+{-# LINE 657 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "hash" (Glean.Schema.Cxx1.Types.MangledNameHash)
+          ('Angle.TNoFields))
+{-# LINE 659 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash
+       = Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityMangledNameHash" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxEntityMangledNameHash_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxEntityMangledNameHash_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 669 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityMangledNameHash
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 675 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityUSR_key"
+           (Prelude.Just 0))
+{-# LINE 684 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "usr" (Glean.Schema.Cxx1.Types.USR)
+          ('Angle.TNoFields))
+{-# LINE 686 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR_key
+  getName _proxy = Glean.PredicateRef "codemarkup.cxx.CxxEntityUSR" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityUSR_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityUSR_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 695 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxEntityUSR
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 701 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefinitionExtendsChild_key"
+           (Prelude.Just 0))
+{-# LINE 710 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 712 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild
+       = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefinitionExtendsChild" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefinitionExtendsChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefinitionExtendsChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 722 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsChild
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 728 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 739 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 741 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations
+       = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxFileEntityXRefLocations" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 751 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 757 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefnVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 766 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility_key
+     =
+     'Angle.TField "decl" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "visibility"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 768 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility =
+       Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefnVisibility" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxDefnVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxDefnVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 777 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefnVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 783 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationExtendsParent_key"
+           (Prelude.Just 0))
+{-# LINE 792 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent_key
+     =
+     'Angle.TField "child" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 794 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationExtendsParent" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationExtendsParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationExtendsParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 804 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationExtendsParent
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 810 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefinitionContainsChild_key"
+           (Prelude.Just 0))
+{-# LINE 819 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 821 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild
+       = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefinitionContainsChild" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefinitionContainsChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefinitionContainsChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 831 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionContainsChild
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 837 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxXRefTargetLocation_key"
+           (Prelude.Just 0))
+{-# LINE 848 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation_key
+     =
+     'Angle.TField "target" (Glean.Schema.Cxx1.Types.XRefTarget)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TField "location"
+             (Glean.Schema.CodemarkupTypes.Types.Location)
+             ('Angle.TNoFields)))
+{-# LINE 850 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation
+       = Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxXRefTargetLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxXRefTargetLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxXRefTargetLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 859 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxXRefTargetLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 865 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 874 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "visibility"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 876 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility =
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclVisibility" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxDeclVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxDeclVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 885 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 891 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.FromCxxVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 900 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility_key
+     =
+     'Angle.TField "cxx" (Glean.Schema.Cxx1.Types.Access)
+       ('Angle.TField "out"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 902 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility =
+       Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.FromCxxVisibility" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.fromCxxVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.fromCxxVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 911 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.FromCxxVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 917 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxAnnotation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxAnnotation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxAnnotation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxAnnotation_key"
+           (Prelude.Just 0))
+{-# LINE 926 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxAnnotation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "anns" (Glean.Schema.CodeCxx.Types.Annotations)
+          ('Angle.TNoFields))
+{-# LINE 928 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxAnnotation
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxAnnotation =
+       Glean.Schema.CodemarkupCxx.Types.CxxAnnotation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxAnnotation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxAnnotation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxAnnotation x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxAnnotation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 937 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxAnnotation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 943 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxResolveTraceLocation_key"
+           (Prelude.Just 0))
+{-# LINE 954 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation_key
+     =
+     'Angle.TField "trace" (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 956 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation
+       = Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxResolveTraceLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxResolveTraceLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxResolveTraceLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 966 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveTraceLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 972 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 983 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 985 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityUses =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityUses" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 994 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1000 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxFileEntitySpellingXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 1011 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1013 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxFileEntitySpellingXRefLocations"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFileEntitySpellingXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFileEntitySpellingXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1023 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFileEntitySpellingXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1029 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclarationModifiers_key"
+           (Prelude.Just 0))
+{-# LINE 1038 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "keywords"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 1040 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers
+       = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDeclarationModifiers" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclarationModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclarationModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1050 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclarationModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1056 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityDefinitionBase_key"
+           (Prelude.Just 0))
+{-# LINE 1065 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "base" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1067 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase
+       = Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityDefinitionBase" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxEntityDefinitionBase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxEntityDefinitionBase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1077 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDefinitionBase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1083 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDeclKind_key" (Prelude.Just 0))
+{-# LINE 1092 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupCxx.Types.CxxDeclKind_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 1094 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclKind
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDeclKind =
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclKind_key
+  getName _proxy = Glean.PredicateRef "codemarkup.cxx.CxxDeclKind" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxDeclKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclKind x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxDeclKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1103 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxDeclKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1109 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDataAvailable
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxDataAvailable =
+       Glean.Schema.Src.Types.File
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDataAvailable" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxDataAvailable_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDataAvailable x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxDataAvailable_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1118 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDataAvailable
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1124 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxExtendsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 1133 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1135 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity
+       = Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxExtendsChildEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxExtendsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxExtendsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1144 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxExtendsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1150 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxDefToDeclFamilyXRefTargetLocation_key"
+           (Prelude.Just 0))
+{-# LINE 1161 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TField "location"
+             (Glean.Schema.CodemarkupTypes.Types.Location)
+             ('Angle.TNoFields)))
+{-# LINE 1163 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxDefToDeclFamilyXRefTargetLocation"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefToDeclFamilyXRefTargetLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefToDeclFamilyXRefTargetLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1173 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefToDeclFamilyXRefTargetLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1179 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxNamespaceDeclarationContainsChild_key"
+           (Prelude.Just 0))
+{-# LINE 1188 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild_key
+     =
+     'Angle.TField "parent"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1190 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxNamespaceDeclarationContainsChild"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxNamespaceDeclarationContainsChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxNamespaceDeclarationContainsChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1200 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxNamespaceDeclarationContainsChild
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1206 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxFindDefinitionOfEntity_key"
+           (Prelude.Just 0))
+{-# LINE 1215 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "definition" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1217 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity
+       = Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxFindDefinitionOfEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxFindDefinitionOfEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxFindDefinitionOfEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1227 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxFindDefinitionOfEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1233 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 1242 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1244 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation =
+       Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxResolveLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1253 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1259 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxModifiers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxModifiers_key"
+           (Prelude.Just 0))
+{-# LINE 1268 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "keywords"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 1270 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxModifiers
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxModifiers =
+       Glean.Schema.CodemarkupCxx.Types.CxxModifiers_key
+  getName _proxy = Glean.PredicateRef "codemarkup.cxx.CxxModifiers" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxModifiers x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1279 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1285 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 1294 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1296 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity
+       = Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxContainsChildEntity" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxContainsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxContainsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1306 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1312 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityIdl_key"
+           (Prelude.Just 0))
+{-# LINE 1321 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl_key
+     =
+     'Angle.TField "ent" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "idlEnt" (Glean.Schema.Code.Types.IdlEntity)
+          ('Angle.TNoFields))
+{-# LINE 1323 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl =
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl_key
+  getName _proxy = Glean.PredicateRef "codemarkup.cxx.CxxEntityIdl" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.cxxEntityIdl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl x k
+  getFactKey = Glean.Schema.CodemarkupCxx.Types.cxxEntityIdl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1332 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupCxx.Types.CxxEntityIdl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1338 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.EntityToXRefTarget_key"
+           (Prelude.Just 0))
+{-# LINE 1347 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget_key
+     =
+     'Angle.TField "ent" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "xrefTarget" (Glean.Schema.Cxx1.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 1349 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget
+         where
+  type KeyType Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget =
+       Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.EntityToXRefTarget" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupCxx.Types.entityToXRefTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.entityToXRefTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1358 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.EntityToXRefTarget
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1364 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.cxx.CxxDeclToDefXRefTargetLocation_key"
+           (Prelude.Just 0))
+{-# LINE 1375 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TField "location"
+             (Glean.Schema.CodemarkupTypes.Types.Location)
+             ('Angle.TNoFields)))
+{-# LINE 1377 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation
+       =
+       Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.cxx.CxxDeclToDefXRefTargetLocation"
+        4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDeclToDefXRefTargetLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDeclToDefXRefTargetLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1387 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDeclToDefXRefTargetLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1393 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxEntityDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 1404 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1406 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation
+       = Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxEntityDocumentation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxEntityDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxEntityDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1416 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxEntityDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1422 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.cxx.CxxDefinitionExtendsParent_key"
+           (Prelude.Just 0))
+{-# LINE 1431 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeCxx.Types.Definition)
+       ('Angle.TField "parent" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1433 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent
+         where
+  type KeyType
+         Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent
+       = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.cxx.CxxDefinitionExtendsParent" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupCxx.Types.cxxDefinitionExtendsParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent x k
+  getFactKey
+    = Glean.Schema.CodemarkupCxx.Types.cxxDefinitionExtendsParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1443 "glean/schema/thrift/codemarkup_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupCxx.Types.CxxDefinitionExtendsParent
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupDataswarm/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupDataswarm/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupDataswarm/Types.hs
@@ -0,0 +1,344 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupDataswarm/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupDataswarm.Types
+       (pREDICATE_VERSIONS, DataswarmFileEntityXRefLocations_id,
+        DataswarmFileEntityXRefLocations(DataswarmFileEntityXRefLocations,
+                                         dataswarmFileEntityXRefLocations_id,
+                                         dataswarmFileEntityXRefLocations_key),
+        DataswarmFileEntityXRefLocations_key(DataswarmFileEntityXRefLocations_key,
+                                             dataswarmFileEntityXRefLocations_key_file,
+                                             dataswarmFileEntityXRefLocations_key_xref,
+                                             dataswarmFileEntityXRefLocations_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeDataswarm.Types
+       as Glean.Schema.CodeDataswarm
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Schema.CodeDataswarm.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 87 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupDataswarm/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList [("DataswarmFileEntityXRefLocations", 1)]
+
+type DataswarmFileEntityXRefLocations_id = Glean.Id
+
+data DataswarmFileEntityXRefLocations = DataswarmFileEntityXRefLocations{dataswarmFileEntityXRefLocations_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !DataswarmFileEntityXRefLocations_id,
+                                                                         dataswarmFileEntityXRefLocations_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           DataswarmFileEntityXRefLocations_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DataswarmFileEntityXRefLocations where
+  toJSON (DataswarmFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DataswarmFileEntityXRefLocations where
+  buildStruct _proxy
+    (DataswarmFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DataswarmFileEntityXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DataswarmFileEntityXRefLocations where
+  rnf (DataswarmFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DataswarmFileEntityXRefLocations where
+  def = DataswarmFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable DataswarmFileEntityXRefLocations where
+  hashWithSalt __salt (DataswarmFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data DataswarmFileEntityXRefLocations_key = DataswarmFileEntityXRefLocations_key{dataswarmFileEntityXRefLocations_key_file
+                                                                                 ::
+                                                                                 Glean.Schema.Src.File,
+                                                                                 dataswarmFileEntityXRefLocations_key_xref
+                                                                                 ::
+                                                                                 Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                 dataswarmFileEntityXRefLocations_key_entity
+                                                                                 ::
+                                                                                 Glean.Schema.CodeDataswarm.Entity}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DataswarmFileEntityXRefLocations_key where
+  toJSON
+    (DataswarmFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct DataswarmFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (DataswarmFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (DataswarmFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DataswarmFileEntityXRefLocations_key where
+  rnf
+    (DataswarmFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default DataswarmFileEntityXRefLocations_key where
+  def
+    = DataswarmFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable DataswarmFileEntityXRefLocations_key
+         where
+  hashWithSalt __salt
+    (DataswarmFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+{-# LINE 20 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.dataswarm.DataswarmFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeDataswarm.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 33 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.dataswarm.DataswarmFileEntityXRefLocations"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupDataswarm.Types.dataswarmFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupDataswarm.Types.dataswarmFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/codemarkup_dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupDataswarm.Types.DataswarmFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupErlang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupErlang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupErlang/Types.hs
@@ -0,0 +1,1712 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupErlang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupErlang.Types
+       (pREDICATE_VERSIONS, ErlangResolveLocation_id,
+        ErlangResolveLocation(ErlangResolveLocation,
+                              erlangResolveLocation_id, erlangResolveLocation_key),
+        ErlangFileEntityXRefLocations_id,
+        ErlangFileEntityXRefLocations(ErlangFileEntityXRefLocations,
+                                      erlangFileEntityXRefLocations_id,
+                                      erlangFileEntityXRefLocations_key),
+        ErlangEntityUses_id,
+        ErlangEntityUses(ErlangEntityUses, erlangEntityUses_id,
+                         erlangEntityUses_key),
+        ErlangEntityLocation_id,
+        ErlangEntityLocation(ErlangEntityLocation, erlangEntityLocation_id,
+                             erlangEntityLocation_key),
+        ErlangEntityKind_id,
+        ErlangEntityKind(ErlangEntityKind, erlangEntityKind_id,
+                         erlangEntityKind_key),
+        ErlangEntityInfo_id,
+        ErlangEntityInfo(ErlangEntityInfo, erlangEntityInfo_id,
+                         erlangEntityInfo_key),
+        ErlangEntityDocumentation_id,
+        ErlangEntityDocumentation(ErlangEntityDocumentation,
+                                  erlangEntityDocumentation_id, erlangEntityDocumentation_key),
+        ErlangResolveLocation_key(ErlangResolveLocation_key,
+                                  erlangResolveLocation_key_location,
+                                  erlangResolveLocation_key_entity),
+        ErlangFileEntityXRefLocations_key(ErlangFileEntityXRefLocations_key,
+                                          erlangFileEntityXRefLocations_key_file,
+                                          erlangFileEntityXRefLocations_key_xref,
+                                          erlangFileEntityXRefLocations_key_entity),
+        ErlangEntityUses_key(ErlangEntityUses_key,
+                             erlangEntityUses_key_target, erlangEntityUses_key_file,
+                             erlangEntityUses_key_span),
+        ErlangEntityLocation_key(ErlangEntityLocation_key,
+                                 erlangEntityLocation_key_entity,
+                                 erlangEntityLocation_key_location),
+        ErlangEntityKind_key(ErlangEntityKind_key,
+                             erlangEntityKind_key_entity, erlangEntityKind_key_kind),
+        ErlangEntityInfo_key(ErlangEntityInfo_key,
+                             erlangEntityInfo_key_entity, erlangEntityInfo_key_info),
+        ErlangEntityDocumentation_key(ErlangEntityDocumentation_key,
+                                      erlangEntityDocumentation_key_entity,
+                                      erlangEntityDocumentation_key_file,
+                                      erlangEntityDocumentation_key_span,
+                                      erlangEntityDocumentation_key_text))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeErlang.Types
+       as Glean.Schema.CodeErlang
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Schema.CodeErlang.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 123 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupErlang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("ErlangResolveLocation", 2), ("ErlangEntityKind", 2),
+       ("ErlangEntityLocation", 2), ("ErlangEntityInfo", 2),
+       ("ErlangFileEntityXRefLocations", 2), ("ErlangEntityUses", 2),
+       ("ErlangEntityDocumentation", 2)]
+
+type ErlangResolveLocation_id = Glean.Id
+
+data ErlangResolveLocation = ErlangResolveLocation{erlangResolveLocation_id
+                                                   :: {-# UNPACK #-} !ErlangResolveLocation_id,
+                                                   erlangResolveLocation_key ::
+                                                   Prelude.Maybe ErlangResolveLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangResolveLocation where
+  toJSON (ErlangResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangResolveLocation where
+  buildStruct _proxy (ErlangResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ErlangResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangResolveLocation where
+  rnf (ErlangResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangResolveLocation where
+  def = ErlangResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangResolveLocation where
+  hashWithSalt __salt (ErlangResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangFileEntityXRefLocations_id = Glean.Id
+
+data ErlangFileEntityXRefLocations = ErlangFileEntityXRefLocations{erlangFileEntityXRefLocations_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !ErlangFileEntityXRefLocations_id,
+                                                                   erlangFileEntityXRefLocations_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     ErlangFileEntityXRefLocations_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangFileEntityXRefLocations where
+  toJSON (ErlangFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangFileEntityXRefLocations where
+  buildStruct _proxy
+    (ErlangFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ErlangFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangFileEntityXRefLocations where
+  rnf (ErlangFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangFileEntityXRefLocations where
+  def = ErlangFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangFileEntityXRefLocations where
+  hashWithSalt __salt (ErlangFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangEntityUses_id = Glean.Id
+
+data ErlangEntityUses = ErlangEntityUses{erlangEntityUses_id ::
+                                         {-# UNPACK #-} !ErlangEntityUses_id,
+                                         erlangEntityUses_key :: Prelude.Maybe ErlangEntityUses_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityUses where
+  toJSON (ErlangEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityUses where
+  buildStruct _proxy (ErlangEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ErlangEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityUses where
+  rnf (ErlangEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangEntityUses where
+  def = ErlangEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityUses where
+  hashWithSalt __salt (ErlangEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangEntityLocation_id = Glean.Id
+
+data ErlangEntityLocation = ErlangEntityLocation{erlangEntityLocation_id
+                                                 :: {-# UNPACK #-} !ErlangEntityLocation_id,
+                                                 erlangEntityLocation_key ::
+                                                 Prelude.Maybe ErlangEntityLocation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityLocation where
+  toJSON (ErlangEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityLocation where
+  buildStruct _proxy (ErlangEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ErlangEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityLocation where
+  rnf (ErlangEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangEntityLocation where
+  def = ErlangEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityLocation where
+  hashWithSalt __salt (ErlangEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangEntityKind_id = Glean.Id
+
+data ErlangEntityKind = ErlangEntityKind{erlangEntityKind_id ::
+                                         {-# UNPACK #-} !ErlangEntityKind_id,
+                                         erlangEntityKind_key :: Prelude.Maybe ErlangEntityKind_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityKind where
+  toJSON (ErlangEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityKind where
+  buildStruct _proxy (ErlangEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ErlangEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityKind where
+  rnf (ErlangEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangEntityKind where
+  def = ErlangEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityKind where
+  hashWithSalt __salt (ErlangEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangEntityInfo_id = Glean.Id
+
+data ErlangEntityInfo = ErlangEntityInfo{erlangEntityInfo_id ::
+                                         {-# UNPACK #-} !ErlangEntityInfo_id,
+                                         erlangEntityInfo_key :: Prelude.Maybe ErlangEntityInfo_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityInfo where
+  toJSON (ErlangEntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityInfo where
+  buildStruct _proxy (ErlangEntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ErlangEntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityInfo where
+  rnf (ErlangEntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangEntityInfo where
+  def = ErlangEntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityInfo where
+  hashWithSalt __salt (ErlangEntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangEntityDocumentation_id = Glean.Id
+
+data ErlangEntityDocumentation = ErlangEntityDocumentation{erlangEntityDocumentation_id
+                                                           ::
+                                                           {-# UNPACK #-} !ErlangEntityDocumentation_id,
+                                                           erlangEntityDocumentation_key ::
+                                                           Prelude.Maybe
+                                                             ErlangEntityDocumentation_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityDocumentation where
+  toJSON (ErlangEntityDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityDocumentation where
+  buildStruct _proxy
+    (ErlangEntityDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ErlangEntityDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityDocumentation where
+  rnf (ErlangEntityDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangEntityDocumentation where
+  def = ErlangEntityDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityDocumentation where
+  hashWithSalt __salt (ErlangEntityDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data ErlangResolveLocation_key = ErlangResolveLocation_key{erlangResolveLocation_key_location
+                                                           :: Glean.Schema.CodemarkupTypes.Location,
+                                                           erlangResolveLocation_key_entity ::
+                                                           Glean.Schema.CodeErlang.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangResolveLocation_key where
+  toJSON
+    (ErlangResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangResolveLocation_key where
+  buildStruct _proxy
+    (ErlangResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ErlangResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangResolveLocation_key where
+  rnf (ErlangResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ErlangResolveLocation_key where
+  def = ErlangResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable ErlangResolveLocation_key where
+  hashWithSalt __salt (ErlangResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data ErlangFileEntityXRefLocations_key = ErlangFileEntityXRefLocations_key{erlangFileEntityXRefLocations_key_file
+                                                                           :: Glean.Schema.Src.File,
+                                                                           erlangFileEntityXRefLocations_key_xref
+                                                                           ::
+                                                                           Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                           erlangFileEntityXRefLocations_key_entity
+                                                                           ::
+                                                                           Glean.Schema.CodeErlang.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangFileEntityXRefLocations_key where
+  toJSON
+    (ErlangFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (ErlangFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ErlangFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangFileEntityXRefLocations_key where
+  rnf
+    (ErlangFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ErlangFileEntityXRefLocations_key where
+  def
+    = ErlangFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable ErlangFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (ErlangFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data ErlangEntityUses_key = ErlangEntityUses_key{erlangEntityUses_key_target
+                                                 :: Glean.Schema.CodeErlang.Entity,
+                                                 erlangEntityUses_key_file :: Glean.Schema.Src.File,
+                                                 erlangEntityUses_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityUses_key where
+  toJSON
+    (ErlangEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityUses_key where
+  buildStruct _proxy
+    (ErlangEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ErlangEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityUses_key where
+  rnf
+    (ErlangEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ErlangEntityUses_key where
+  def = ErlangEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ErlangEntityUses_key where
+  hashWithSalt __salt (ErlangEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data ErlangEntityLocation_key = ErlangEntityLocation_key{erlangEntityLocation_key_entity
+                                                         :: Glean.Schema.CodeErlang.Entity,
+                                                         erlangEntityLocation_key_location ::
+                                                         Glean.Schema.CodemarkupTypes.Location}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityLocation_key where
+  toJSON (ErlangEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityLocation_key where
+  buildStruct _proxy
+    (ErlangEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ErlangEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityLocation_key where
+  rnf (ErlangEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ErlangEntityLocation_key where
+  def = ErlangEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable ErlangEntityLocation_key where
+  hashWithSalt __salt (ErlangEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data ErlangEntityKind_key = ErlangEntityKind_key{erlangEntityKind_key_entity
+                                                 :: Glean.Schema.CodeErlang.Entity,
+                                                 erlangEntityKind_key_kind ::
+                                                 Glean.Schema.CodemarkupTypes.SymbolKind}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityKind_key where
+  toJSON (ErlangEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityKind_key where
+  buildStruct _proxy
+    (ErlangEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (ErlangEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityKind_key where
+  rnf (ErlangEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default ErlangEntityKind_key where
+  def = ErlangEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable ErlangEntityKind_key where
+  hashWithSalt __salt (ErlangEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data ErlangEntityInfo_key = ErlangEntityInfo_key{erlangEntityInfo_key_entity
+                                                 :: Glean.Schema.CodeErlang.Entity,
+                                                 erlangEntityInfo_key_info ::
+                                                 Glean.Schema.CodemarkupTypes.SymbolInfo}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityInfo_key where
+  toJSON (ErlangEntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityInfo_key where
+  buildStruct _proxy
+    (ErlangEntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (ErlangEntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityInfo_key where
+  rnf (ErlangEntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default ErlangEntityInfo_key where
+  def = ErlangEntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable ErlangEntityInfo_key where
+  hashWithSalt __salt (ErlangEntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data ErlangEntityDocumentation_key = ErlangEntityDocumentation_key{erlangEntityDocumentation_key_entity
+                                                                   ::
+                                                                   Glean.Schema.CodeErlang.Entity,
+                                                                   erlangEntityDocumentation_key_file
+                                                                   :: Glean.Schema.Src.File,
+                                                                   erlangEntityDocumentation_key_span
+                                                                   :: Glean.Schema.Src.ByteSpan,
+                                                                   erlangEntityDocumentation_key_text
+                                                                   :: Prelude.Maybe Text.Text}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangEntityDocumentation_key where
+  toJSON
+    (ErlangEntityDocumentation_key __field__entity __field__file
+       __field__span __field__text)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file :
+             "span" .= __field__span :
+               Prelude.maybe Prelude.id ((:) . ("text" .=)) __field__text
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangEntityDocumentation_key where
+  buildStruct _proxy
+    (ErlangEntityDocumentation_key __field__entity __field__file
+       __field__span __field__text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               case __field__text of
+                 Prelude.Just _val -> Thrift.genField _proxy "text"
+                                        (Thrift.getStringType _proxy)
+                                        4
+                                        3
+                                        (Thrift.genText _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__text <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__text <- ST.readSTRef __field__text
+                                             Prelude.pure
+                                               (ErlangEntityDocumentation_key __val__entity
+                                                  __val__file
+                                                  __val__span
+                                                  __val__text)
+              _idMap
+                = HashMap.fromList
+                    [("entity", 1), ("file", 2), ("span", 3), ("text", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangEntityDocumentation_key where
+  rnf
+    (ErlangEntityDocumentation_key __field__entity __field__file
+       __field__span __field__text)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__text `Prelude.seq` ()
+
+instance Default.Default ErlangEntityDocumentation_key where
+  def
+    = ErlangEntityDocumentation_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable ErlangEntityDocumentation_key where
+  hashWithSalt __salt
+    (ErlangEntityDocumentation_key _entity _file _span _text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+              _file)
+           _span)
+        _text
+{-# LINE 20 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation
+       = Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupErlang.Types.erlangResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 56 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 58 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind =
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangEntityKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupErlang.Types.erlangEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 82 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 84 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation
+       = Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupErlang.Types.erlangEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 94 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 100 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangEntityInfo_key"
+           (Prelude.Just 0))
+{-# LINE 109 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 111 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo =
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangEntityInfo" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupErlang.Types.erlangEntityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangEntityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 120 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 126 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.erlang.ErlangFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 137 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 139 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.erlang.ErlangFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupErlang.Types.erlangFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 149 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 155 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 166 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeErlang.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 168 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses =
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupErlang.Types.erlangEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 177 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 183 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.erlang.ErlangEntityDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 196 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "text" (Prelude.Maybe Data.Text.Text)
+                ('Angle.TNoFields))))
+{-# LINE 198 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation
+       = Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.erlang.ErlangEntityDocumentation"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupErlang.Types.erlangEntityDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation x k
+  getFactKey
+    = Glean.Schema.CodemarkupErlang.Types.erlangEntityDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 208 "glean/schema/thrift/codemarkup_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupErlang.Types.ErlangEntityDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupFlow/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupFlow/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupFlow/Types.hs
@@ -0,0 +1,3128 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupFlow/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupFlow.Types
+       (pREDICATE_VERSIONS, FlowResolveLocation_id,
+        FlowResolveLocation(FlowResolveLocation, flowResolveLocation_id,
+                            flowResolveLocation_key),
+        FlowFileReferenceEntityXRefLocations_id,
+        FlowFileReferenceEntityXRefLocations(FlowFileReferenceEntityXRefLocations,
+                                             flowFileReferenceEntityXRefLocations_id,
+                                             flowFileReferenceEntityXRefLocations_key),
+        FlowFileImportDeclEntityXRefLocations_id,
+        FlowFileImportDeclEntityXRefLocations(FlowFileImportDeclEntityXRefLocations,
+                                              flowFileImportDeclEntityXRefLocations_id,
+                                              flowFileImportDeclEntityXRefLocations_key),
+        FlowFileEntityXRefLocations_id,
+        FlowFileEntityXRefLocations(FlowFileEntityXRefLocations,
+                                    flowFileEntityXRefLocations_id,
+                                    flowFileEntityXRefLocations_key),
+        FlowEntityUses_id,
+        FlowEntityUses(FlowEntityUses, flowEntityUses_id,
+                       flowEntityUses_key),
+        FlowEntityModuleName_id,
+        FlowEntityModuleName(FlowEntityModuleName, flowEntityModuleName_id,
+                             flowEntityModuleName_key),
+        FlowEntityLocation_id,
+        FlowEntityLocation(FlowEntityLocation, flowEntityLocation_id,
+                           flowEntityLocation_key),
+        FlowEntityKind_id,
+        FlowEntityKind(FlowEntityKind, flowEntityKind_id,
+                       flowEntityKind_key),
+        FlowEntityDocumentation_id,
+        FlowEntityDocumentation(FlowEntityDocumentation,
+                                flowEntityDocumentation_id, flowEntityDocumentation_key),
+        FlowDocumentationSpan_id,
+        FlowDocumentationSpan(FlowDocumentationSpan,
+                              flowDocumentationSpan_id, flowDocumentationSpan_key),
+        FlowDeclarationDocumentation_id,
+        FlowDeclarationDocumentation(FlowDeclarationDocumentation,
+                                     flowDeclarationDocumentation_id,
+                                     flowDeclarationDocumentation_key),
+        FlowContainsParentEntity_id,
+        FlowContainsParentEntity(FlowContainsParentEntity,
+                                 flowContainsParentEntity_id, flowContainsParentEntity_key),
+        FlowContainsChildEntity_id,
+        FlowContainsChildEntity(FlowContainsChildEntity,
+                                flowContainsChildEntity_id, flowContainsChildEntity_key),
+        FlowResolveLocation_key(FlowResolveLocation_key,
+                                flowResolveLocation_key_location, flowResolveLocation_key_entity),
+        FlowFileReferenceEntityXRefLocations_key(FlowFileReferenceEntityXRefLocations_key,
+                                                 flowFileReferenceEntityXRefLocations_key_file,
+                                                 flowFileReferenceEntityXRefLocations_key_xref,
+                                                 flowFileReferenceEntityXRefLocations_key_entity),
+        FlowFileImportDeclEntityXRefLocations_key(FlowFileImportDeclEntityXRefLocations_key,
+                                                  flowFileImportDeclEntityXRefLocations_key_file,
+                                                  flowFileImportDeclEntityXRefLocations_key_xref,
+                                                  flowFileImportDeclEntityXRefLocations_key_entity),
+        FlowFileEntityXRefLocations_key(FlowFileEntityXRefLocations_key,
+                                        flowFileEntityXRefLocations_key_file,
+                                        flowFileEntityXRefLocations_key_xref,
+                                        flowFileEntityXRefLocations_key_entity),
+        FlowEntityUses_key(FlowEntityUses_key, flowEntityUses_key_target,
+                           flowEntityUses_key_file, flowEntityUses_key_span),
+        FlowEntityModuleName_key(FlowEntityModuleName_key,
+                                 flowEntityModuleName_key_entity, flowEntityModuleName_key_name),
+        FlowEntityLocation_key(FlowEntityLocation_key,
+                               flowEntityLocation_key_entity, flowEntityLocation_key_location),
+        FlowEntityKind_key(FlowEntityKind_key, flowEntityKind_key_entity,
+                           flowEntityKind_key_kind),
+        FlowEntityDocumentation_key(FlowEntityDocumentation_key,
+                                    flowEntityDocumentation_key_entity,
+                                    flowEntityDocumentation_key_file,
+                                    flowEntityDocumentation_key_span),
+        FlowDocumentationSpan_key(FlowDocumentationSpan_key,
+                                  flowDocumentationSpan_key_doc, flowDocumentationSpan_key_file,
+                                  flowDocumentationSpan_key_span),
+        FlowDeclarationDocumentation_key(FlowDeclarationDocumentation_key,
+                                         flowDeclarationDocumentation_key_decl,
+                                         flowDeclarationDocumentation_key_file,
+                                         flowDeclarationDocumentation_key_span),
+        FlowContainsParentEntity_key(FlowContainsParentEntity_key,
+                                     flowContainsParentEntity_key_child,
+                                     flowContainsParentEntity_key_parent),
+        FlowContainsChildEntity_key(FlowContainsChildEntity_key,
+                                    flowContainsChildEntity_key_parent,
+                                    flowContainsChildEntity_key_child))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeFlow.Types
+       as Glean.Schema.CodeFlow
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Flow.Types as Glean.Schema.Flow
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Schema.CodeFlow.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Schema.Flow.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 164 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupFlow/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("FlowEntityDocumentation", 2),
+       ("FlowFileReferenceEntityXRefLocations", 2),
+       ("FlowFileEntityXRefLocations", 2), ("FlowEntityLocation", 2),
+       ("FlowResolveLocation", 2), ("FlowEntityModuleName", 2),
+       ("FlowContainsChildEntity", 2),
+       ("FlowDeclarationDocumentation", 2), ("FlowEntityKind", 2),
+       ("FlowEntityUses", 2), ("FlowDocumentationSpan", 2),
+       ("FlowFileImportDeclEntityXRefLocations", 2),
+       ("FlowContainsParentEntity", 2)]
+
+type FlowResolveLocation_id = Glean.Id
+
+data FlowResolveLocation = FlowResolveLocation{flowResolveLocation_id
+                                               :: {-# UNPACK #-} !FlowResolveLocation_id,
+                                               flowResolveLocation_key ::
+                                               Prelude.Maybe FlowResolveLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowResolveLocation where
+  toJSON (FlowResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowResolveLocation where
+  buildStruct _proxy (FlowResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowResolveLocation where
+  rnf (FlowResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowResolveLocation where
+  def = FlowResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowResolveLocation where
+  hashWithSalt __salt (FlowResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowFileReferenceEntityXRefLocations_id = Glean.Id
+
+data FlowFileReferenceEntityXRefLocations = FlowFileReferenceEntityXRefLocations{flowFileReferenceEntityXRefLocations_id
+                                                                                 ::
+                                                                                 {-# UNPACK #-} !FlowFileReferenceEntityXRefLocations_id,
+                                                                                 flowFileReferenceEntityXRefLocations_key
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   FlowFileReferenceEntityXRefLocations_key}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileReferenceEntityXRefLocations where
+  toJSON
+    (FlowFileReferenceEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowFileReferenceEntityXRefLocations
+         where
+  buildStruct _proxy
+    (FlowFileReferenceEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowFileReferenceEntityXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileReferenceEntityXRefLocations where
+  rnf (FlowFileReferenceEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowFileReferenceEntityXRefLocations where
+  def
+    = FlowFileReferenceEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowFileReferenceEntityXRefLocations
+         where
+  hashWithSalt __salt (FlowFileReferenceEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowFileImportDeclEntityXRefLocations_id = Glean.Id
+
+data FlowFileImportDeclEntityXRefLocations = FlowFileImportDeclEntityXRefLocations{flowFileImportDeclEntityXRefLocations_id
+                                                                                   ::
+                                                                                   {-# UNPACK #-} !FlowFileImportDeclEntityXRefLocations_id,
+                                                                                   flowFileImportDeclEntityXRefLocations_key
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     FlowFileImportDeclEntityXRefLocations_key}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileImportDeclEntityXRefLocations where
+  toJSON
+    (FlowFileImportDeclEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowFileImportDeclEntityXRefLocations
+         where
+  buildStruct _proxy
+    (FlowFileImportDeclEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowFileImportDeclEntityXRefLocations __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileImportDeclEntityXRefLocations where
+  rnf
+    (FlowFileImportDeclEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowFileImportDeclEntityXRefLocations
+         where
+  def
+    = FlowFileImportDeclEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowFileImportDeclEntityXRefLocations
+         where
+  hashWithSalt __salt
+    (FlowFileImportDeclEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowFileEntityXRefLocations_id = Glean.Id
+
+data FlowFileEntityXRefLocations = FlowFileEntityXRefLocations{flowFileEntityXRefLocations_id
+                                                               ::
+                                                               {-# UNPACK #-} !FlowFileEntityXRefLocations_id,
+                                                               flowFileEntityXRefLocations_key ::
+                                                               Prelude.Maybe
+                                                                 FlowFileEntityXRefLocations_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileEntityXRefLocations where
+  toJSON (FlowFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowFileEntityXRefLocations where
+  buildStruct _proxy
+    (FlowFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileEntityXRefLocations where
+  rnf (FlowFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowFileEntityXRefLocations where
+  def = FlowFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowFileEntityXRefLocations where
+  hashWithSalt __salt (FlowFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityUses_id = Glean.Id
+
+data FlowEntityUses = FlowEntityUses{flowEntityUses_id ::
+                                     {-# UNPACK #-} !FlowEntityUses_id,
+                                     flowEntityUses_key :: Prelude.Maybe FlowEntityUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityUses where
+  toJSON (FlowEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityUses where
+  buildStruct _proxy (FlowEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityUses where
+  rnf (FlowEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityUses where
+  def = FlowEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityUses where
+  hashWithSalt __salt (FlowEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityModuleName_id = Glean.Id
+
+data FlowEntityModuleName = FlowEntityModuleName{flowEntityModuleName_id
+                                                 :: {-# UNPACK #-} !FlowEntityModuleName_id,
+                                                 flowEntityModuleName_key ::
+                                                 Prelude.Maybe FlowEntityModuleName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityModuleName where
+  toJSON (FlowEntityModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityModuleName where
+  buildStruct _proxy (FlowEntityModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowEntityModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityModuleName where
+  rnf (FlowEntityModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityModuleName where
+  def = FlowEntityModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityModuleName where
+  hashWithSalt __salt (FlowEntityModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityLocation_id = Glean.Id
+
+data FlowEntityLocation = FlowEntityLocation{flowEntityLocation_id
+                                             :: {-# UNPACK #-} !FlowEntityLocation_id,
+                                             flowEntityLocation_key ::
+                                             Prelude.Maybe FlowEntityLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityLocation where
+  toJSON (FlowEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityLocation where
+  buildStruct _proxy (FlowEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityLocation where
+  rnf (FlowEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityLocation where
+  def = FlowEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityLocation where
+  hashWithSalt __salt (FlowEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityKind_id = Glean.Id
+
+data FlowEntityKind = FlowEntityKind{flowEntityKind_id ::
+                                     {-# UNPACK #-} !FlowEntityKind_id,
+                                     flowEntityKind_key :: Prelude.Maybe FlowEntityKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityKind where
+  toJSON (FlowEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityKind where
+  buildStruct _proxy (FlowEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityKind where
+  rnf (FlowEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityKind where
+  def = FlowEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityKind where
+  hashWithSalt __salt (FlowEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityDocumentation_id = Glean.Id
+
+data FlowEntityDocumentation = FlowEntityDocumentation{flowEntityDocumentation_id
+                                                       ::
+                                                       {-# UNPACK #-} !FlowEntityDocumentation_id,
+                                                       flowEntityDocumentation_key ::
+                                                       Prelude.Maybe FlowEntityDocumentation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityDocumentation where
+  toJSON (FlowEntityDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityDocumentation where
+  buildStruct _proxy
+    (FlowEntityDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowEntityDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityDocumentation where
+  rnf (FlowEntityDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityDocumentation where
+  def = FlowEntityDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityDocumentation where
+  hashWithSalt __salt (FlowEntityDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowDocumentationSpan_id = Glean.Id
+
+data FlowDocumentationSpan = FlowDocumentationSpan{flowDocumentationSpan_id
+                                                   :: {-# UNPACK #-} !FlowDocumentationSpan_id,
+                                                   flowDocumentationSpan_key ::
+                                                   Prelude.Maybe FlowDocumentationSpan_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowDocumentationSpan where
+  toJSON (FlowDocumentationSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowDocumentationSpan where
+  buildStruct _proxy (FlowDocumentationSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowDocumentationSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowDocumentationSpan where
+  rnf (FlowDocumentationSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowDocumentationSpan where
+  def = FlowDocumentationSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowDocumentationSpan where
+  hashWithSalt __salt (FlowDocumentationSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowDeclarationDocumentation_id = Glean.Id
+
+data FlowDeclarationDocumentation = FlowDeclarationDocumentation{flowDeclarationDocumentation_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !FlowDeclarationDocumentation_id,
+                                                                 flowDeclarationDocumentation_key ::
+                                                                 Prelude.Maybe
+                                                                   FlowDeclarationDocumentation_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowDeclarationDocumentation where
+  toJSON (FlowDeclarationDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowDeclarationDocumentation where
+  buildStruct _proxy
+    (FlowDeclarationDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowDeclarationDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowDeclarationDocumentation where
+  rnf (FlowDeclarationDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowDeclarationDocumentation where
+  def = FlowDeclarationDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowDeclarationDocumentation where
+  hashWithSalt __salt (FlowDeclarationDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowContainsParentEntity_id = Glean.Id
+
+data FlowContainsParentEntity = FlowContainsParentEntity{flowContainsParentEntity_id
+                                                         ::
+                                                         {-# UNPACK #-} !FlowContainsParentEntity_id,
+                                                         flowContainsParentEntity_key ::
+                                                         Prelude.Maybe FlowContainsParentEntity_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowContainsParentEntity where
+  toJSON (FlowContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowContainsParentEntity where
+  buildStruct _proxy
+    (FlowContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowContainsParentEntity where
+  rnf (FlowContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowContainsParentEntity where
+  def = FlowContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowContainsParentEntity where
+  hashWithSalt __salt (FlowContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowContainsChildEntity_id = Glean.Id
+
+data FlowContainsChildEntity = FlowContainsChildEntity{flowContainsChildEntity_id
+                                                       ::
+                                                       {-# UNPACK #-} !FlowContainsChildEntity_id,
+                                                       flowContainsChildEntity_key ::
+                                                       Prelude.Maybe FlowContainsChildEntity_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowContainsChildEntity where
+  toJSON (FlowContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowContainsChildEntity where
+  buildStruct _proxy
+    (FlowContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowContainsChildEntity where
+  rnf (FlowContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowContainsChildEntity where
+  def = FlowContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowContainsChildEntity where
+  hashWithSalt __salt (FlowContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data FlowResolveLocation_key = FlowResolveLocation_key{flowResolveLocation_key_location
+                                                       :: Glean.Schema.CodemarkupTypes.Location,
+                                                       flowResolveLocation_key_entity ::
+                                                       Glean.Schema.CodeFlow.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowResolveLocation_key where
+  toJSON (FlowResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowResolveLocation_key where
+  buildStruct _proxy
+    (FlowResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowResolveLocation_key where
+  rnf (FlowResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowResolveLocation_key where
+  def = FlowResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable FlowResolveLocation_key where
+  hashWithSalt __salt (FlowResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data FlowFileReferenceEntityXRefLocations_key = FlowFileReferenceEntityXRefLocations_key{flowFileReferenceEntityXRefLocations_key_file
+                                                                                         ::
+                                                                                         Glean.Schema.Src.File,
+                                                                                         flowFileReferenceEntityXRefLocations_key_xref
+                                                                                         ::
+                                                                                         Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                         flowFileReferenceEntityXRefLocations_key_entity
+                                                                                         ::
+                                                                                         Glean.Schema.CodeFlow.Entity}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileReferenceEntityXRefLocations_key
+         where
+  toJSON
+    (FlowFileReferenceEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           FlowFileReferenceEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (FlowFileReferenceEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowFileReferenceEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileReferenceEntityXRefLocations_key
+         where
+  rnf
+    (FlowFileReferenceEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowFileReferenceEntityXRefLocations_key
+         where
+  def
+    = FlowFileReferenceEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowFileReferenceEntityXRefLocations_key
+         where
+  hashWithSalt __salt
+    (FlowFileReferenceEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data FlowFileImportDeclEntityXRefLocations_key = FlowFileImportDeclEntityXRefLocations_key{flowFileImportDeclEntityXRefLocations_key_file
+                                                                                           ::
+                                                                                           Glean.Schema.Src.File,
+                                                                                           flowFileImportDeclEntityXRefLocations_key_xref
+                                                                                           ::
+                                                                                           Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                                           flowFileImportDeclEntityXRefLocations_key_entity
+                                                                                           ::
+                                                                                           Glean.Schema.CodeFlow.Entity}
+                                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileImportDeclEntityXRefLocations_key
+         where
+  toJSON
+    (FlowFileImportDeclEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           FlowFileImportDeclEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (FlowFileImportDeclEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowFileImportDeclEntityXRefLocations_key
+                                                  __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileImportDeclEntityXRefLocations_key
+         where
+  rnf
+    (FlowFileImportDeclEntityXRefLocations_key __field__file
+       __field__xref __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowFileImportDeclEntityXRefLocations_key
+         where
+  def
+    = FlowFileImportDeclEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable
+           FlowFileImportDeclEntityXRefLocations_key
+         where
+  hashWithSalt __salt
+    (FlowFileImportDeclEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data FlowFileEntityXRefLocations_key = FlowFileEntityXRefLocations_key{flowFileEntityXRefLocations_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       flowFileEntityXRefLocations_key_xref
+                                                                       ::
+                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                       flowFileEntityXRefLocations_key_entity
+                                                                       ::
+                                                                       Glean.Schema.CodeFlow.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowFileEntityXRefLocations_key where
+  toJSON
+    (FlowFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (FlowFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowFileEntityXRefLocations_key where
+  rnf
+    (FlowFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowFileEntityXRefLocations_key where
+  def
+    = FlowFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (FlowFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data FlowEntityUses_key = FlowEntityUses_key{flowEntityUses_key_target
+                                             :: Glean.Schema.CodeFlow.Entity,
+                                             flowEntityUses_key_file :: Glean.Schema.Src.File,
+                                             flowEntityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityUses_key where
+  toJSON
+    (FlowEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityUses_key where
+  buildStruct _proxy
+    (FlowEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityUses_key where
+  rnf
+    (FlowEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowEntityUses_key where
+  def = FlowEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FlowEntityUses_key where
+  hashWithSalt __salt (FlowEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data FlowEntityModuleName_key = FlowEntityModuleName_key{flowEntityModuleName_key_entity
+                                                         :: Glean.Schema.CodeFlow.Entity,
+                                                         flowEntityModuleName_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityModuleName_key where
+  toJSON (FlowEntityModuleName_key __field__entity __field__name)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityModuleName_key where
+  buildStruct _proxy
+    (FlowEntityModuleName_key __field__entity __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FlowEntityModuleName_key __val__entity __val__name)
+              _idMap = HashMap.fromList [("entity", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityModuleName_key where
+  rnf (FlowEntityModuleName_key __field__entity __field__name)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FlowEntityModuleName_key where
+  def = FlowEntityModuleName_key Default.def ""
+
+instance Hashable.Hashable FlowEntityModuleName_key where
+  hashWithSalt __salt (FlowEntityModuleName_key _entity _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _name
+
+data FlowEntityLocation_key = FlowEntityLocation_key{flowEntityLocation_key_entity
+                                                     :: Glean.Schema.CodeFlow.Entity,
+                                                     flowEntityLocation_key_location ::
+                                                     Glean.Schema.CodemarkupTypes.Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityLocation_key where
+  toJSON (FlowEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityLocation_key where
+  buildStruct _proxy
+    (FlowEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (FlowEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityLocation_key where
+  rnf (FlowEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default FlowEntityLocation_key where
+  def = FlowEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable FlowEntityLocation_key where
+  hashWithSalt __salt (FlowEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data FlowEntityKind_key = FlowEntityKind_key{flowEntityKind_key_entity
+                                             :: Glean.Schema.CodeFlow.Entity,
+                                             flowEntityKind_key_kind ::
+                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityKind_key where
+  toJSON (FlowEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityKind_key where
+  buildStruct _proxy
+    (FlowEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (FlowEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityKind_key where
+  rnf (FlowEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default FlowEntityKind_key where
+  def = FlowEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable FlowEntityKind_key where
+  hashWithSalt __salt (FlowEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data FlowEntityDocumentation_key = FlowEntityDocumentation_key{flowEntityDocumentation_key_entity
+                                                               :: Glean.Schema.CodeFlow.Entity,
+                                                               flowEntityDocumentation_key_file ::
+                                                               Glean.Schema.Src.File,
+                                                               flowEntityDocumentation_key_span ::
+                                                               Glean.Schema.Src.ByteSpan}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityDocumentation_key where
+  toJSON
+    (FlowEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityDocumentation_key where
+  buildStruct _proxy
+    (FlowEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowEntityDocumentation_key __val__entity
+                                                  __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("entity", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityDocumentation_key where
+  rnf
+    (FlowEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowEntityDocumentation_key where
+  def
+    = FlowEntityDocumentation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FlowEntityDocumentation_key where
+  hashWithSalt __salt
+    (FlowEntityDocumentation_key _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _file)
+        _span
+
+data FlowDocumentationSpan_key = FlowDocumentationSpan_key{flowDocumentationSpan_key_doc
+                                                           :: Glean.Schema.Flow.Documentation,
+                                                           flowDocumentationSpan_key_file ::
+                                                           Glean.Schema.Src.File,
+                                                           flowDocumentationSpan_key_span ::
+                                                           Glean.Schema.Src.ByteSpan}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowDocumentationSpan_key where
+  toJSON
+    (FlowDocumentationSpan_key __field__doc __field__file
+       __field__span)
+    = Aeson.object
+        ("doc" .= __field__doc :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowDocumentationSpan_key where
+  buildStruct _proxy
+    (FlowDocumentationSpan_key __field__doc __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "doc" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__doc)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__doc <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__doc
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__doc <- ST.readSTRef __field__doc
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowDocumentationSpan_key __val__doc __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("doc", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowDocumentationSpan_key where
+  rnf
+    (FlowDocumentationSpan_key __field__doc __field__file
+       __field__span)
+    = DeepSeq.rnf __field__doc `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowDocumentationSpan_key where
+  def = FlowDocumentationSpan_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FlowDocumentationSpan_key where
+  hashWithSalt __salt (FlowDocumentationSpan_key _doc _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _doc) _file)
+        _span
+
+data FlowDeclarationDocumentation_key = FlowDeclarationDocumentation_key{flowDeclarationDocumentation_key_decl
+                                                                         ::
+                                                                         Glean.Schema.Flow.SomeDeclaration,
+                                                                         flowDeclarationDocumentation_key_file
+                                                                         :: Glean.Schema.Src.File,
+                                                                         flowDeclarationDocumentation_key_span
+                                                                         ::
+                                                                         Glean.Schema.Src.ByteSpan}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowDeclarationDocumentation_key where
+  toJSON
+    (FlowDeclarationDocumentation_key __field__decl __field__file
+       __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowDeclarationDocumentation_key where
+  buildStruct _proxy
+    (FlowDeclarationDocumentation_key __field__decl __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowDeclarationDocumentation_key __val__decl
+                                                  __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowDeclarationDocumentation_key where
+  rnf
+    (FlowDeclarationDocumentation_key __field__decl __field__file
+       __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowDeclarationDocumentation_key where
+  def
+    = FlowDeclarationDocumentation_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowDeclarationDocumentation_key where
+  hashWithSalt __salt
+    (FlowDeclarationDocumentation_key _decl _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+        _span
+
+data FlowContainsParentEntity_key = FlowContainsParentEntity_key{flowContainsParentEntity_key_child
+                                                                 :: Glean.Schema.CodeFlow.Entity,
+                                                                 flowContainsParentEntity_key_parent
+                                                                 :: Glean.Schema.CodeFlow.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowContainsParentEntity_key where
+  toJSON
+    (FlowContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowContainsParentEntity_key where
+  buildStruct _proxy
+    (FlowContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (FlowContainsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowContainsParentEntity_key where
+  rnf (FlowContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default FlowContainsParentEntity_key where
+  def = FlowContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable FlowContainsParentEntity_key where
+  hashWithSalt __salt (FlowContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data FlowContainsChildEntity_key = FlowContainsChildEntity_key{flowContainsChildEntity_key_parent
+                                                               :: Glean.Schema.CodeFlow.Entity,
+                                                               flowContainsChildEntity_key_child ::
+                                                               Glean.Schema.CodeFlow.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowContainsChildEntity_key where
+  toJSON (FlowContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowContainsChildEntity_key where
+  buildStruct _proxy
+    (FlowContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (FlowContainsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowContainsChildEntity_key where
+  rnf (FlowContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default FlowContainsChildEntity_key where
+  def = FlowContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable FlowContainsChildEntity_key where
+  hashWithSalt __salt (FlowContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+{-# LINE 21 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowEntityDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 32 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 34 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation
+       = Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowEntityDocumentation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowEntityDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowEntityDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 44 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 50 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.flow.FlowFileReferenceEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 61 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 63 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.flow.FlowFileReferenceEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowFileReferenceEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowFileReferenceEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 73 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileReferenceEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 79 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 90 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 92 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations
+       = Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 102 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 108 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 117 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 119 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation =
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupFlow.Types.flowEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 128 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 134 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 143 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 145 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation
+       = Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 154 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 160 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowEntityModuleName_key"
+           (Prelude.Just 0))
+{-# LINE 169 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 171 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName
+         where
+  type KeyType Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName
+       = Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowEntityModuleName" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowEntityModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowEntityModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 180 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 186 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 195 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeFlow.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 197 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity
+       = Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowContainsChildEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowContainsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowContainsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 207 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 213 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowDeclarationDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 224 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 226 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation
+       =
+       Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowDeclarationDocumentation"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowDeclarationDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowDeclarationDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 236 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowDeclarationDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 242 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 251 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 253 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupFlow.Types.FlowEntityKind =
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowEntityKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupFlow.Types.flowEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityKind x k
+  getFactKey = Glean.Schema.CodemarkupFlow.Types.flowEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 262 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 268 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 279 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 281 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupFlow.Types.FlowEntityUses =
+       Glean.Schema.CodemarkupFlow.Types.FlowEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupFlow.Types.flowEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupFlow.Types.flowEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 290 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 296 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowDocumentationSpan_key"
+           (Prelude.Just 0))
+{-# LINE 307 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan_key
+     =
+     'Angle.TField "doc"
+       (Glean.KeyType Glean.Schema.Flow.Types.Documentation)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 309 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan
+       = Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowDocumentationSpan" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowDocumentationSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowDocumentationSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 319 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowDocumentationSpan
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 325 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.flow.FlowFileImportDeclEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 336 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeFlow.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 338 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.flow.FlowFileImportDeclEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowFileImportDeclEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowFileImportDeclEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 348 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowFileImportDeclEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 354 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.flow.FlowContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 363 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeFlow.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeFlow.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 365 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity
+       = Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.flow.FlowContainsParentEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupFlow.Types.flowContainsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupFlow.Types.flowContainsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 375 "glean/schema/thrift/codemarkup_flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupFlow.Types.FlowContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupGraphql/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupGraphql/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupGraphql/Types.hs
@@ -0,0 +1,1230 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupGraphql/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupGraphql.Types
+       (pREDICATE_VERSIONS, GraphQLResolveLocation_id,
+        GraphQLResolveLocation(GraphQLResolveLocation,
+                               graphQLResolveLocation_id, graphQLResolveLocation_key),
+        GraphQLFileEntityXRefLocations_id,
+        GraphQLFileEntityXRefLocations(GraphQLFileEntityXRefLocations,
+                                       graphQLFileEntityXRefLocations_id,
+                                       graphQLFileEntityXRefLocations_key),
+        GraphQLEntityUses_id,
+        GraphQLEntityUses(GraphQLEntityUses, graphQLEntityUses_id,
+                          graphQLEntityUses_key),
+        GraphQLEntityLocation_id,
+        GraphQLEntityLocation(GraphQLEntityLocation,
+                              graphQLEntityLocation_id, graphQLEntityLocation_key),
+        GraphQLEntityKind_id,
+        GraphQLEntityKind(GraphQLEntityKind, graphQLEntityKind_id,
+                          graphQLEntityKind_key),
+        GraphQLResolveLocation_key(GraphQLResolveLocation_key,
+                                   graphQLResolveLocation_key_location,
+                                   graphQLResolveLocation_key_entity),
+        GraphQLFileEntityXRefLocations_key(GraphQLFileEntityXRefLocations_key,
+                                           graphQLFileEntityXRefLocations_key_file,
+                                           graphQLFileEntityXRefLocations_key_xref,
+                                           graphQLFileEntityXRefLocations_key_entity),
+        GraphQLEntityUses_key(GraphQLEntityUses_key,
+                              graphQLEntityUses_key_target, graphQLEntityUses_key_file,
+                              graphQLEntityUses_key_span),
+        GraphQLEntityLocation_key(GraphQLEntityLocation_key,
+                                  graphQLEntityLocation_key_entity,
+                                  graphQLEntityLocation_key_location),
+        GraphQLEntityKind_key(GraphQLEntityKind_key,
+                              graphQLEntityKind_key_entity, graphQLEntityKind_key_kind))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeGraphql.Types
+       as Glean.Schema.CodeGraphql
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Schema.CodeGraphql.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 110 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupGraphql/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("GraphQLEntityKind", 1), ("GraphQLEntityLocation", 1),
+       ("GraphQLResolveLocation", 1), ("GraphQLEntityUses", 1),
+       ("GraphQLFileEntityXRefLocations", 1)]
+
+type GraphQLResolveLocation_id = Glean.Id
+
+data GraphQLResolveLocation = GraphQLResolveLocation{graphQLResolveLocation_id
+                                                     :: {-# UNPACK #-} !GraphQLResolveLocation_id,
+                                                     graphQLResolveLocation_key ::
+                                                     Prelude.Maybe GraphQLResolveLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLResolveLocation where
+  toJSON (GraphQLResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLResolveLocation where
+  buildStruct _proxy
+    (GraphQLResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GraphQLResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLResolveLocation where
+  rnf (GraphQLResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLResolveLocation where
+  def = GraphQLResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLResolveLocation where
+  hashWithSalt __salt (GraphQLResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLFileEntityXRefLocations_id = Glean.Id
+
+data GraphQLFileEntityXRefLocations = GraphQLFileEntityXRefLocations{graphQLFileEntityXRefLocations_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !GraphQLFileEntityXRefLocations_id,
+                                                                     graphQLFileEntityXRefLocations_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       GraphQLFileEntityXRefLocations_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLFileEntityXRefLocations where
+  toJSON (GraphQLFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLFileEntityXRefLocations where
+  buildStruct _proxy
+    (GraphQLFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GraphQLFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLFileEntityXRefLocations where
+  rnf (GraphQLFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLFileEntityXRefLocations where
+  def = GraphQLFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLFileEntityXRefLocations where
+  hashWithSalt __salt (GraphQLFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLEntityUses_id = Glean.Id
+
+data GraphQLEntityUses = GraphQLEntityUses{graphQLEntityUses_id ::
+                                           {-# UNPACK #-} !GraphQLEntityUses_id,
+                                           graphQLEntityUses_key ::
+                                           Prelude.Maybe GraphQLEntityUses_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityUses where
+  toJSON (GraphQLEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityUses where
+  buildStruct _proxy (GraphQLEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (GraphQLEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityUses where
+  rnf (GraphQLEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityUses where
+  def = GraphQLEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLEntityUses where
+  hashWithSalt __salt (GraphQLEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLEntityLocation_id = Glean.Id
+
+data GraphQLEntityLocation = GraphQLEntityLocation{graphQLEntityLocation_id
+                                                   :: {-# UNPACK #-} !GraphQLEntityLocation_id,
+                                                   graphQLEntityLocation_key ::
+                                                   Prelude.Maybe GraphQLEntityLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityLocation where
+  toJSON (GraphQLEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityLocation where
+  buildStruct _proxy (GraphQLEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GraphQLEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityLocation where
+  rnf (GraphQLEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityLocation where
+  def = GraphQLEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLEntityLocation where
+  hashWithSalt __salt (GraphQLEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLEntityKind_id = Glean.Id
+
+data GraphQLEntityKind = GraphQLEntityKind{graphQLEntityKind_id ::
+                                           {-# UNPACK #-} !GraphQLEntityKind_id,
+                                           graphQLEntityKind_key ::
+                                           Prelude.Maybe GraphQLEntityKind_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityKind where
+  toJSON (GraphQLEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityKind where
+  buildStruct _proxy (GraphQLEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (GraphQLEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityKind where
+  rnf (GraphQLEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityKind where
+  def = GraphQLEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLEntityKind where
+  hashWithSalt __salt (GraphQLEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data GraphQLResolveLocation_key = GraphQLResolveLocation_key{graphQLResolveLocation_key_location
+                                                             ::
+                                                             Glean.Schema.CodemarkupTypes.Location,
+                                                             graphQLResolveLocation_key_entity ::
+                                                             Glean.Schema.CodeGraphql.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLResolveLocation_key where
+  toJSON
+    (GraphQLResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLResolveLocation_key where
+  buildStruct _proxy
+    (GraphQLResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GraphQLResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLResolveLocation_key where
+  rnf (GraphQLResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GraphQLResolveLocation_key where
+  def = GraphQLResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable GraphQLResolveLocation_key where
+  hashWithSalt __salt (GraphQLResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data GraphQLFileEntityXRefLocations_key = GraphQLFileEntityXRefLocations_key{graphQLFileEntityXRefLocations_key_file
+                                                                             ::
+                                                                             Glean.Schema.Src.File,
+                                                                             graphQLFileEntityXRefLocations_key_xref
+                                                                             ::
+                                                                             Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                             graphQLFileEntityXRefLocations_key_entity
+                                                                             ::
+                                                                             Glean.Schema.CodeGraphql.Entity}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLFileEntityXRefLocations_key where
+  toJSON
+    (GraphQLFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (GraphQLFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GraphQLFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLFileEntityXRefLocations_key where
+  rnf
+    (GraphQLFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GraphQLFileEntityXRefLocations_key where
+  def
+    = GraphQLFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable GraphQLFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (GraphQLFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data GraphQLEntityUses_key = GraphQLEntityUses_key{graphQLEntityUses_key_target
+                                                   :: Glean.Schema.CodeGraphql.Entity,
+                                                   graphQLEntityUses_key_file ::
+                                                   Glean.Schema.Src.File,
+                                                   graphQLEntityUses_key_span ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityUses_key where
+  toJSON
+    (GraphQLEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityUses_key where
+  buildStruct _proxy
+    (GraphQLEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (GraphQLEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityUses_key where
+  rnf
+    (GraphQLEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityUses_key where
+  def = GraphQLEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable GraphQLEntityUses_key where
+  hashWithSalt __salt (GraphQLEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data GraphQLEntityLocation_key = GraphQLEntityLocation_key{graphQLEntityLocation_key_entity
+                                                           :: Glean.Schema.CodeGraphql.Entity,
+                                                           graphQLEntityLocation_key_location ::
+                                                           Glean.Schema.CodemarkupTypes.Location}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityLocation_key where
+  toJSON
+    (GraphQLEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityLocation_key where
+  buildStruct _proxy
+    (GraphQLEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (GraphQLEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityLocation_key where
+  rnf (GraphQLEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityLocation_key where
+  def = GraphQLEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable GraphQLEntityLocation_key where
+  hashWithSalt __salt (GraphQLEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data GraphQLEntityKind_key = GraphQLEntityKind_key{graphQLEntityKind_key_entity
+                                                   :: Glean.Schema.CodeGraphql.Entity,
+                                                   graphQLEntityKind_key_kind ::
+                                                   Glean.Schema.CodemarkupTypes.SymbolKind}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLEntityKind_key where
+  toJSON (GraphQLEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLEntityKind_key where
+  buildStruct _proxy
+    (GraphQLEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (GraphQLEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLEntityKind_key where
+  rnf (GraphQLEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default GraphQLEntityKind_key where
+  def = GraphQLEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable GraphQLEntityKind_key where
+  hashWithSalt __salt (GraphQLEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+{-# LINE 20 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.graphql.GraphQLEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeGraphql.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind
+       = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.graphql.GraphQLEntityKind" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupGraphql.Types.graphQLEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind x k
+  getFactKey
+    = Glean.Schema.CodemarkupGraphql.Types.graphQLEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.graphql.GraphQLEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeGraphql.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 57 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation
+       = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.graphql.GraphQLEntityLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupGraphql.Types.graphQLEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupGraphql.Types.graphQLEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.graphql.GraphQLResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 82 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeGraphql.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 84 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation
+       = Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.graphql.GraphQLResolveLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupGraphql.Types.graphQLResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupGraphql.Types.graphQLResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 94 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 100 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.graphql.GraphQLEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 111 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeGraphql.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 113 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses
+       = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.graphql.GraphQLEntityUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupGraphql.Types.graphQLEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupGraphql.Types.graphQLEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 122 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 128 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.graphql.GraphQLFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 139 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeGraphql.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 141 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.graphql.GraphQLFileEntityXRefLocations"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupGraphql.Types.graphQLFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupGraphql.Types.graphQLFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/codemarkup_graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupGraphql.Types.GraphQLFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHack/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHack/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHack/Types.hs
@@ -0,0 +1,7386 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHack/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupHack.Types
+       (pREDICATE_VERSIONS, HackVisibility_id,
+        HackVisibility(HackVisibility, hackVisibility_id,
+                       hackVisibility_key),
+        HackResolveLocation_id,
+        HackResolveLocation(HackResolveLocation, hackResolveLocation_id,
+                            hackResolveLocation_key),
+        HackRequiredConstraint_id,
+        HackRequiredConstraint(HackRequiredConstraint,
+                               hackRequiredConstraint_id, hackRequiredConstraint_key),
+        HackModifiers_id,
+        HackModifiers(HackModifiers, hackModifiers_id, hackModifiers_key),
+        HackInheritedEntities_id,
+        HackInheritedEntities(HackInheritedEntities,
+                              hackInheritedEntities_id, hackInheritedEntities_key),
+        HackIdlEntityUses_id,
+        HackIdlEntityUses(HackIdlEntityUses, hackIdlEntityUses_id,
+                          hackIdlEntityUses_key),
+        HackFileEntityXRefSpans_id,
+        HackFileEntityXRefSpans(HackFileEntityXRefSpans,
+                                hackFileEntityXRefSpans_id, hackFileEntityXRefSpans_key),
+        HackFileEntityXRefLocations_id,
+        HackFileEntityXRefLocations(HackFileEntityXRefLocations,
+                                    hackFileEntityXRefLocations_id,
+                                    hackFileEntityXRefLocations_key),
+        HackFileCall_id,
+        HackFileCall(HackFileCall, hackFileCall_id, hackFileCall_key),
+        HackExtendsParentEntityConcise_id,
+        HackExtendsParentEntityConcise(HackExtendsParentEntityConcise,
+                                       hackExtendsParentEntityConcise_id,
+                                       hackExtendsParentEntityConcise_key),
+        HackExtendsParentEntity_id,
+        HackExtendsParentEntity(HackExtendsParentEntity,
+                                hackExtendsParentEntity_id, hackExtendsParentEntity_key),
+        HackExtendsChildEntity_id,
+        HackExtendsChildEntity(HackExtendsChildEntity,
+                               hackExtendsChildEntity_id, hackExtendsChildEntity_key),
+        HackEnumInheritedMembers_id,
+        HackEnumInheritedMembers(HackEnumInheritedMembers,
+                                 hackEnumInheritedMembers_id, hackEnumInheritedMembers_key),
+        HackEntityUses_id,
+        HackEntityUses(HackEntityUses, hackEntityUses_id,
+                       hackEntityUses_key),
+        HackEntitySource_id,
+        HackEntitySource(HackEntitySource, hackEntitySource_id,
+                         hackEntitySource_key),
+        HackEntityModuleName_id,
+        HackEntityModuleName(HackEntityModuleName, hackEntityModuleName_id,
+                             hackEntityModuleName_key),
+        HackEntityLocation_id,
+        HackEntityLocation(HackEntityLocation, hackEntityLocation_id,
+                           hackEntityLocation_key),
+        HackEntityKind_id,
+        HackEntityKind(HackEntityKind, hackEntityKind_id,
+                       hackEntityKind_key),
+        HackEntityInfo_id,
+        HackEntityInfo(HackEntityInfo, hackEntityInfo_id,
+                       hackEntityInfo_key),
+        HackEntityIdl_id,
+        HackEntityIdl(HackEntityIdl, hackEntityIdl_id, hackEntityIdl_key),
+        HackEntityDocumentation_id,
+        HackEntityDocumentation(HackEntityDocumentation,
+                                hackEntityDocumentation_id, hackEntityDocumentation_key),
+        HackContainsParentEntity_id,
+        HackContainsParentEntity(HackContainsParentEntity,
+                                 hackContainsParentEntity_id, hackContainsParentEntity_key),
+        HackContainsChildEntity_id,
+        HackContainsChildEntity(HackContainsChildEntity,
+                                hackContainsChildEntity_id, hackContainsChildEntity_key),
+        HackAnnotation_id,
+        HackAnnotation(HackAnnotation, hackAnnotation_id,
+                       hackAnnotation_key),
+        FromHackVisibility_id,
+        FromHackVisibility(FromHackVisibility, fromHackVisibility_id,
+                           fromHackVisibility_key),
+        EntityHasHideFromDocsAttr_id,
+        EntityHasHideFromDocsAttr(EntityHasHideFromDocsAttr,
+                                  entityHasHideFromDocsAttr_id, entityHasHideFromDocsAttr_key),
+        ConvertStaticType_id,
+        ConvertStaticType(ConvertStaticType, convertStaticType_id,
+                          convertStaticType_key),
+        ConvertMaybeCallArguments_id,
+        ConvertMaybeCallArguments(ConvertMaybeCallArguments,
+                                  convertMaybeCallArguments_id, convertMaybeCallArguments_key),
+        ConvertCalleeForFileCall_id,
+        ConvertCalleeForFileCall(ConvertCalleeForFileCall,
+                                 convertCalleeForFileCall_id, convertCalleeForFileCall_key),
+        ConvertCallee_id,
+        ConvertCallee(ConvertCallee, convertCallee_id, convertCallee_key),
+        ConvertCallArguments_id,
+        ConvertCallArguments(ConvertCallArguments, convertCallArguments_id,
+                             convertCallArguments_key),
+        ConvertArgument_id,
+        ConvertArgument(ConvertArgument, convertArgument_id,
+                        convertArgument_key),
+        RequiredRelation(RequiredRelation_implements_,
+                         RequiredRelation_extends_, RequiredRelation_class_,
+                         RequiredRelation__UNKNOWN),
+        HackVisibility_key(HackVisibility_key, hackVisibility_key_entity,
+                           hackVisibility_key_visibility),
+        HackResolveLocation_key(HackResolveLocation_key,
+                                hackResolveLocation_key_location, hackResolveLocation_key_entity),
+        HackRequiredConstraint_key(HackRequiredConstraint_key,
+                                   hackRequiredConstraint_key_entity,
+                                   hackRequiredConstraint_key_requiredRelation,
+                                   hackRequiredConstraint_key_required_),
+        HackModifiers_key(HackModifiers_key, hackModifiers_key_entity,
+                          hackModifiers_key_modifiers),
+        HackInheritedEntities_key(HackInheritedEntities_key,
+                                  hackInheritedEntities_key_container,
+                                  hackInheritedEntities_key_member),
+        HackIdlEntityUses_key(HackIdlEntityUses_key,
+                              hackIdlEntityUses_key_target, hackIdlEntityUses_key_file,
+                              hackIdlEntityUses_key_span),
+        HackFileEntityXRefSpans_key(HackFileEntityXRefSpans_key,
+                                    hackFileEntityXRefSpans_key_file,
+                                    hackFileEntityXRefSpans_key_span,
+                                    hackFileEntityXRefSpans_key_entity),
+        HackFileEntityXRefLocations_key(HackFileEntityXRefLocations_key,
+                                        hackFileEntityXRefLocations_key_file,
+                                        hackFileEntityXRefLocations_key_xref,
+                                        hackFileEntityXRefLocations_key_entity),
+        HackFileCall_key(HackFileCall_key, hackFileCall_key_file,
+                         hackFileCall_key_callee_span, hackFileCall_key_call_args,
+                         hackFileCall_key_callee_xref, hackFileCall_key_dispatch_arg,
+                         hackFileCall_key_receiver_type),
+        HackExtendsParentEntityConcise_key(HackExtendsParentEntityConcise_key,
+                                           hackExtendsParentEntityConcise_key_child,
+                                           hackExtendsParentEntityConcise_key_parent),
+        HackExtendsParentEntity_key(HackExtendsParentEntity_key,
+                                    hackExtendsParentEntity_key_child,
+                                    hackExtendsParentEntity_key_parent),
+        HackExtendsChildEntity_key(HackExtendsChildEntity_key,
+                                   hackExtendsChildEntity_key_parent,
+                                   hackExtendsChildEntity_key_child),
+        HackEnumInheritedMembers_key(HackEnumInheritedMembers_key,
+                                     hackEnumInheritedMembers_key_member_),
+        HackEntityUses_key(HackEntityUses_key, hackEntityUses_key_target,
+                           hackEntityUses_key_file, hackEntityUses_key_span),
+        HackEntitySource_key(HackEntitySource_key,
+                             hackEntitySource_key_target, hackEntitySource_key_source),
+        HackEntityModuleName_key(HackEntityModuleName_key,
+                                 hackEntityModuleName_key_entity, hackEntityModuleName_key_name),
+        HackEntityLocation_key(HackEntityLocation_key,
+                               hackEntityLocation_key_entity, hackEntityLocation_key_location),
+        HackEntityKind_key(HackEntityKind_key, hackEntityKind_key_entity,
+                           hackEntityKind_key_kind),
+        HackEntityInfo_key(HackEntityInfo_key, hackEntityInfo_key_entity,
+                           hackEntityInfo_key_info),
+        HackEntityIdl_key(HackEntityIdl_key, hackEntityIdl_key_ent,
+                          hackEntityIdl_key_idlEnt),
+        HackEntityDocumentation_key(HackEntityDocumentation_key,
+                                    hackEntityDocumentation_key_entity,
+                                    hackEntityDocumentation_key_file,
+                                    hackEntityDocumentation_key_span),
+        HackContainsParentEntity_key(HackContainsParentEntity_key,
+                                     hackContainsParentEntity_key_child,
+                                     hackContainsParentEntity_key_parent),
+        HackContainsChildEntity_key(HackContainsChildEntity_key,
+                                    hackContainsChildEntity_key_parent,
+                                    hackContainsChildEntity_key_child),
+        HackAnnotation_key(HackAnnotation_key, hackAnnotation_key_entity,
+                           hackAnnotation_key_anns),
+        FromHackVisibility_key(FromHackVisibility_key,
+                               fromHackVisibility_key_hack, fromHackVisibility_key_out),
+        ConvertStaticType_key(ConvertStaticType_key,
+                              convertStaticType_key_hackCallee,
+                              convertStaticType_key_codeCallee),
+        ConvertMaybeCallArguments_key(ConvertMaybeCallArguments_key,
+                                      convertMaybeCallArguments_key_hackArgument,
+                                      convertMaybeCallArguments_key_codeArgument),
+        ConvertCalleeForFileCall_key(ConvertCalleeForFileCall_key,
+                                     convertCalleeForFileCall_key_file,
+                                     convertCalleeForFileCall_key_callee_span,
+                                     convertCalleeForFileCall_key_hackCallee,
+                                     convertCalleeForFileCall_key_codeCallee),
+        ConvertCallee_key(ConvertCallee_key, convertCallee_key_hackCallee,
+                          convertCallee_key_codeCallee),
+        ConvertCallArguments_key(ConvertCallArguments_key,
+                                 convertCallArguments_key_hackCallArguments,
+                                 convertCallArguments_key_codeCallArguments),
+        ConvertArgument_key(ConvertArgument_key,
+                            convertArgument_key_hackArgument,
+                            convertArgument_key_codeArgument))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodeHack.Types
+       as Glean.Schema.CodeHack
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Hack.Types as Glean.Schema.Hack
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.CodeHack.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.Hack.Types
+{-# LINE 19 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 272 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHack/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("HackEntityIdl", 2), ("HackEnumInheritedMembers", 2),
+       ("HackExtendsParentEntity", 2), ("ConvertCallee", 2),
+       ("HackFileCall", 2), ("HackExtendsParentEntityConcise", 2),
+       ("HackVisibility", 2), ("HackResolveLocation", 2),
+       ("HackEntitySource", 2), ("ConvertArgument", 2),
+       ("HackInheritedEntities", 2), ("HackEntityInfo", 2),
+       ("ConvertMaybeCallArguments", 2), ("HackIdlEntityUses", 2),
+       ("ConvertCallArguments", 2), ("ConvertCalleeForFileCall", 2),
+       ("HackEntityModuleName", 2), ("HackRequiredConstraint", 2),
+       ("HackEntityDocumentation", 2), ("HackExtendsChildEntity", 2),
+       ("HackModifiers", 2), ("EntityHasHideFromDocsAttr", 2),
+       ("FromHackVisibility", 2), ("HackEntityLocation", 2),
+       ("HackContainsParentEntity", 2), ("ConvertStaticType", 2),
+       ("HackFileEntityXRefLocations", 2), ("HackEntityUses", 2),
+       ("HackAnnotation", 2), ("HackFileEntityXRefSpans", 2),
+       ("HackEntityKind", 2), ("HackContainsChildEntity", 2)]
+
+type HackVisibility_id = Glean.Id
+
+data HackVisibility = HackVisibility{hackVisibility_id ::
+                                     {-# UNPACK #-} !HackVisibility_id,
+                                     hackVisibility_key :: Prelude.Maybe HackVisibility_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackVisibility where
+  toJSON (HackVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackVisibility where
+  buildStruct _proxy (HackVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackVisibility where
+  rnf (HackVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackVisibility where
+  def = HackVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackVisibility where
+  hashWithSalt __salt (HackVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackResolveLocation_id = Glean.Id
+
+data HackResolveLocation = HackResolveLocation{hackResolveLocation_id
+                                               :: {-# UNPACK #-} !HackResolveLocation_id,
+                                               hackResolveLocation_key ::
+                                               Prelude.Maybe HackResolveLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackResolveLocation where
+  toJSON (HackResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackResolveLocation where
+  buildStruct _proxy (HackResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackResolveLocation where
+  rnf (HackResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackResolveLocation where
+  def = HackResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackResolveLocation where
+  hashWithSalt __salt (HackResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackRequiredConstraint_id = Glean.Id
+
+data HackRequiredConstraint = HackRequiredConstraint{hackRequiredConstraint_id
+                                                     :: {-# UNPACK #-} !HackRequiredConstraint_id,
+                                                     hackRequiredConstraint_key ::
+                                                     Prelude.Maybe HackRequiredConstraint_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackRequiredConstraint where
+  toJSON (HackRequiredConstraint __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackRequiredConstraint where
+  buildStruct _proxy
+    (HackRequiredConstraint __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackRequiredConstraint __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackRequiredConstraint where
+  rnf (HackRequiredConstraint __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackRequiredConstraint where
+  def = HackRequiredConstraint Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackRequiredConstraint where
+  hashWithSalt __salt (HackRequiredConstraint _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackModifiers_id = Glean.Id
+
+data HackModifiers = HackModifiers{hackModifiers_id ::
+                                   {-# UNPACK #-} !HackModifiers_id,
+                                   hackModifiers_key :: Prelude.Maybe HackModifiers_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackModifiers where
+  toJSON (HackModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackModifiers where
+  buildStruct _proxy (HackModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackModifiers where
+  rnf (HackModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackModifiers where
+  def = HackModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackModifiers where
+  hashWithSalt __salt (HackModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackInheritedEntities_id = Glean.Id
+
+data HackInheritedEntities = HackInheritedEntities{hackInheritedEntities_id
+                                                   :: {-# UNPACK #-} !HackInheritedEntities_id,
+                                                   hackInheritedEntities_key ::
+                                                   Prelude.Maybe HackInheritedEntities_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackInheritedEntities where
+  toJSON (HackInheritedEntities __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackInheritedEntities where
+  buildStruct _proxy (HackInheritedEntities __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackInheritedEntities __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackInheritedEntities where
+  rnf (HackInheritedEntities __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackInheritedEntities where
+  def = HackInheritedEntities Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackInheritedEntities where
+  hashWithSalt __salt (HackInheritedEntities _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackIdlEntityUses_id = Glean.Id
+
+data HackIdlEntityUses = HackIdlEntityUses{hackIdlEntityUses_id ::
+                                           {-# UNPACK #-} !HackIdlEntityUses_id,
+                                           hackIdlEntityUses_key ::
+                                           Prelude.Maybe HackIdlEntityUses_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackIdlEntityUses where
+  toJSON (HackIdlEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackIdlEntityUses where
+  buildStruct _proxy (HackIdlEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackIdlEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackIdlEntityUses where
+  rnf (HackIdlEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackIdlEntityUses where
+  def = HackIdlEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackIdlEntityUses where
+  hashWithSalt __salt (HackIdlEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackFileEntityXRefSpans_id = Glean.Id
+
+data HackFileEntityXRefSpans = HackFileEntityXRefSpans{hackFileEntityXRefSpans_id
+                                                       ::
+                                                       {-# UNPACK #-} !HackFileEntityXRefSpans_id,
+                                                       hackFileEntityXRefSpans_key ::
+                                                       Prelude.Maybe HackFileEntityXRefSpans_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileEntityXRefSpans where
+  toJSON (HackFileEntityXRefSpans __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackFileEntityXRefSpans where
+  buildStruct _proxy
+    (HackFileEntityXRefSpans __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackFileEntityXRefSpans __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileEntityXRefSpans where
+  rnf (HackFileEntityXRefSpans __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackFileEntityXRefSpans where
+  def = HackFileEntityXRefSpans Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackFileEntityXRefSpans where
+  hashWithSalt __salt (HackFileEntityXRefSpans _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackFileEntityXRefLocations_id = Glean.Id
+
+data HackFileEntityXRefLocations = HackFileEntityXRefLocations{hackFileEntityXRefLocations_id
+                                                               ::
+                                                               {-# UNPACK #-} !HackFileEntityXRefLocations_id,
+                                                               hackFileEntityXRefLocations_key ::
+                                                               Prelude.Maybe
+                                                                 HackFileEntityXRefLocations_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileEntityXRefLocations where
+  toJSON (HackFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackFileEntityXRefLocations where
+  buildStruct _proxy
+    (HackFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileEntityXRefLocations where
+  rnf (HackFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackFileEntityXRefLocations where
+  def = HackFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackFileEntityXRefLocations where
+  hashWithSalt __salt (HackFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackFileCall_id = Glean.Id
+
+data HackFileCall = HackFileCall{hackFileCall_id ::
+                                 {-# UNPACK #-} !HackFileCall_id,
+                                 hackFileCall_key :: Prelude.Maybe HackFileCall_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileCall where
+  toJSON (HackFileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackFileCall where
+  buildStruct _proxy (HackFileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackFileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileCall where
+  rnf (HackFileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackFileCall where
+  def = HackFileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackFileCall where
+  hashWithSalt __salt (HackFileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackExtendsParentEntityConcise_id = Glean.Id
+
+data HackExtendsParentEntityConcise = HackExtendsParentEntityConcise{hackExtendsParentEntityConcise_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !HackExtendsParentEntityConcise_id,
+                                                                     hackExtendsParentEntityConcise_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       HackExtendsParentEntityConcise_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsParentEntityConcise where
+  toJSON (HackExtendsParentEntityConcise __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsParentEntityConcise where
+  buildStruct _proxy
+    (HackExtendsParentEntityConcise __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackExtendsParentEntityConcise __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsParentEntityConcise where
+  rnf (HackExtendsParentEntityConcise __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackExtendsParentEntityConcise where
+  def = HackExtendsParentEntityConcise Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackExtendsParentEntityConcise where
+  hashWithSalt __salt (HackExtendsParentEntityConcise _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackExtendsParentEntity_id = Glean.Id
+
+data HackExtendsParentEntity = HackExtendsParentEntity{hackExtendsParentEntity_id
+                                                       ::
+                                                       {-# UNPACK #-} !HackExtendsParentEntity_id,
+                                                       hackExtendsParentEntity_key ::
+                                                       Prelude.Maybe HackExtendsParentEntity_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsParentEntity where
+  toJSON (HackExtendsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsParentEntity where
+  buildStruct _proxy
+    (HackExtendsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackExtendsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsParentEntity where
+  rnf (HackExtendsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackExtendsParentEntity where
+  def = HackExtendsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackExtendsParentEntity where
+  hashWithSalt __salt (HackExtendsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackExtendsChildEntity_id = Glean.Id
+
+data HackExtendsChildEntity = HackExtendsChildEntity{hackExtendsChildEntity_id
+                                                     :: {-# UNPACK #-} !HackExtendsChildEntity_id,
+                                                     hackExtendsChildEntity_key ::
+                                                     Prelude.Maybe HackExtendsChildEntity_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsChildEntity where
+  toJSON (HackExtendsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsChildEntity where
+  buildStruct _proxy
+    (HackExtendsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackExtendsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsChildEntity where
+  rnf (HackExtendsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackExtendsChildEntity where
+  def = HackExtendsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackExtendsChildEntity where
+  hashWithSalt __salt (HackExtendsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEnumInheritedMembers_id = Glean.Id
+
+data HackEnumInheritedMembers = HackEnumInheritedMembers{hackEnumInheritedMembers_id
+                                                         ::
+                                                         {-# UNPACK #-} !HackEnumInheritedMembers_id,
+                                                         hackEnumInheritedMembers_key ::
+                                                         Prelude.Maybe HackEnumInheritedMembers_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEnumInheritedMembers where
+  toJSON (HackEnumInheritedMembers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEnumInheritedMembers where
+  buildStruct _proxy
+    (HackEnumInheritedMembers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackEnumInheritedMembers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEnumInheritedMembers where
+  rnf (HackEnumInheritedMembers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEnumInheritedMembers where
+  def = HackEnumInheritedMembers Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEnumInheritedMembers where
+  hashWithSalt __salt (HackEnumInheritedMembers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityUses_id = Glean.Id
+
+data HackEntityUses = HackEntityUses{hackEntityUses_id ::
+                                     {-# UNPACK #-} !HackEntityUses_id,
+                                     hackEntityUses_key :: Prelude.Maybe HackEntityUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityUses where
+  toJSON (HackEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityUses where
+  buildStruct _proxy (HackEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityUses where
+  rnf (HackEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityUses where
+  def = HackEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityUses where
+  hashWithSalt __salt (HackEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntitySource_id = Glean.Id
+
+data HackEntitySource = HackEntitySource{hackEntitySource_id ::
+                                         {-# UNPACK #-} !HackEntitySource_id,
+                                         hackEntitySource_key :: Prelude.Maybe HackEntitySource_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntitySource where
+  toJSON (HackEntitySource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntitySource where
+  buildStruct _proxy (HackEntitySource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntitySource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntitySource where
+  rnf (HackEntitySource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntitySource where
+  def = HackEntitySource Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntitySource where
+  hashWithSalt __salt (HackEntitySource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityModuleName_id = Glean.Id
+
+data HackEntityModuleName = HackEntityModuleName{hackEntityModuleName_id
+                                                 :: {-# UNPACK #-} !HackEntityModuleName_id,
+                                                 hackEntityModuleName_key ::
+                                                 Prelude.Maybe HackEntityModuleName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityModuleName where
+  toJSON (HackEntityModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityModuleName where
+  buildStruct _proxy (HackEntityModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackEntityModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityModuleName where
+  rnf (HackEntityModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityModuleName where
+  def = HackEntityModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityModuleName where
+  hashWithSalt __salt (HackEntityModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityLocation_id = Glean.Id
+
+data HackEntityLocation = HackEntityLocation{hackEntityLocation_id
+                                             :: {-# UNPACK #-} !HackEntityLocation_id,
+                                             hackEntityLocation_key ::
+                                             Prelude.Maybe HackEntityLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityLocation where
+  toJSON (HackEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityLocation where
+  buildStruct _proxy (HackEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityLocation where
+  rnf (HackEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityLocation where
+  def = HackEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityLocation where
+  hashWithSalt __salt (HackEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityKind_id = Glean.Id
+
+data HackEntityKind = HackEntityKind{hackEntityKind_id ::
+                                     {-# UNPACK #-} !HackEntityKind_id,
+                                     hackEntityKind_key :: Prelude.Maybe HackEntityKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityKind where
+  toJSON (HackEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityKind where
+  buildStruct _proxy (HackEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityKind where
+  rnf (HackEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityKind where
+  def = HackEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityKind where
+  hashWithSalt __salt (HackEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityInfo_id = Glean.Id
+
+data HackEntityInfo = HackEntityInfo{hackEntityInfo_id ::
+                                     {-# UNPACK #-} !HackEntityInfo_id,
+                                     hackEntityInfo_key :: Prelude.Maybe HackEntityInfo_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityInfo where
+  toJSON (HackEntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityInfo where
+  buildStruct _proxy (HackEntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityInfo where
+  rnf (HackEntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityInfo where
+  def = HackEntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityInfo where
+  hashWithSalt __salt (HackEntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityIdl_id = Glean.Id
+
+data HackEntityIdl = HackEntityIdl{hackEntityIdl_id ::
+                                   {-# UNPACK #-} !HackEntityIdl_id,
+                                   hackEntityIdl_key :: Prelude.Maybe HackEntityIdl_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityIdl where
+  toJSON (HackEntityIdl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityIdl where
+  buildStruct _proxy (HackEntityIdl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackEntityIdl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityIdl where
+  rnf (HackEntityIdl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityIdl where
+  def = HackEntityIdl Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityIdl where
+  hashWithSalt __salt (HackEntityIdl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackEntityDocumentation_id = Glean.Id
+
+data HackEntityDocumentation = HackEntityDocumentation{hackEntityDocumentation_id
+                                                       ::
+                                                       {-# UNPACK #-} !HackEntityDocumentation_id,
+                                                       hackEntityDocumentation_key ::
+                                                       Prelude.Maybe HackEntityDocumentation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityDocumentation where
+  toJSON (HackEntityDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityDocumentation where
+  buildStruct _proxy
+    (HackEntityDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackEntityDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityDocumentation where
+  rnf (HackEntityDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackEntityDocumentation where
+  def = HackEntityDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackEntityDocumentation where
+  hashWithSalt __salt (HackEntityDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackContainsParentEntity_id = Glean.Id
+
+data HackContainsParentEntity = HackContainsParentEntity{hackContainsParentEntity_id
+                                                         ::
+                                                         {-# UNPACK #-} !HackContainsParentEntity_id,
+                                                         hackContainsParentEntity_key ::
+                                                         Prelude.Maybe HackContainsParentEntity_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackContainsParentEntity where
+  toJSON (HackContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackContainsParentEntity where
+  buildStruct _proxy
+    (HackContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackContainsParentEntity where
+  rnf (HackContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackContainsParentEntity where
+  def = HackContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackContainsParentEntity where
+  hashWithSalt __salt (HackContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackContainsChildEntity_id = Glean.Id
+
+data HackContainsChildEntity = HackContainsChildEntity{hackContainsChildEntity_id
+                                                       ::
+                                                       {-# UNPACK #-} !HackContainsChildEntity_id,
+                                                       hackContainsChildEntity_key ::
+                                                       Prelude.Maybe HackContainsChildEntity_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackContainsChildEntity where
+  toJSON (HackContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackContainsChildEntity where
+  buildStruct _proxy
+    (HackContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackContainsChildEntity where
+  rnf (HackContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackContainsChildEntity where
+  def = HackContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackContainsChildEntity where
+  hashWithSalt __salt (HackContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackAnnotation_id = Glean.Id
+
+data HackAnnotation = HackAnnotation{hackAnnotation_id ::
+                                     {-# UNPACK #-} !HackAnnotation_id,
+                                     hackAnnotation_key :: Prelude.Maybe HackAnnotation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackAnnotation where
+  toJSON (HackAnnotation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackAnnotation where
+  buildStruct _proxy (HackAnnotation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackAnnotation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackAnnotation where
+  rnf (HackAnnotation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackAnnotation where
+  def = HackAnnotation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackAnnotation where
+  hashWithSalt __salt (HackAnnotation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FromHackVisibility_id = Glean.Id
+
+data FromHackVisibility = FromHackVisibility{fromHackVisibility_id
+                                             :: {-# UNPACK #-} !FromHackVisibility_id,
+                                             fromHackVisibility_key ::
+                                             Prelude.Maybe FromHackVisibility_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromHackVisibility where
+  toJSON (FromHackVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FromHackVisibility where
+  buildStruct _proxy (FromHackVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FromHackVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FromHackVisibility where
+  rnf (FromHackVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FromHackVisibility where
+  def = FromHackVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable FromHackVisibility where
+  hashWithSalt __salt (FromHackVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityHasHideFromDocsAttr_id = Glean.Id
+
+data EntityHasHideFromDocsAttr = EntityHasHideFromDocsAttr{entityHasHideFromDocsAttr_id
+                                                           ::
+                                                           {-# UNPACK #-} !EntityHasHideFromDocsAttr_id,
+                                                           entityHasHideFromDocsAttr_key ::
+                                                           Prelude.Maybe
+                                                             Glean.Schema.CodeHack.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityHasHideFromDocsAttr where
+  toJSON (EntityHasHideFromDocsAttr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityHasHideFromDocsAttr where
+  buildStruct _proxy
+    (EntityHasHideFromDocsAttr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (EntityHasHideFromDocsAttr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityHasHideFromDocsAttr where
+  rnf (EntityHasHideFromDocsAttr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityHasHideFromDocsAttr where
+  def = EntityHasHideFromDocsAttr Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityHasHideFromDocsAttr where
+  hashWithSalt __salt (EntityHasHideFromDocsAttr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertStaticType_id = Glean.Id
+
+data ConvertStaticType = ConvertStaticType{convertStaticType_id ::
+                                           {-# UNPACK #-} !ConvertStaticType_id,
+                                           convertStaticType_key ::
+                                           Prelude.Maybe ConvertStaticType_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertStaticType where
+  toJSON (ConvertStaticType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertStaticType where
+  buildStruct _proxy (ConvertStaticType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConvertStaticType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertStaticType where
+  rnf (ConvertStaticType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertStaticType where
+  def = ConvertStaticType Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertStaticType where
+  hashWithSalt __salt (ConvertStaticType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertMaybeCallArguments_id = Glean.Id
+
+data ConvertMaybeCallArguments = ConvertMaybeCallArguments{convertMaybeCallArguments_id
+                                                           ::
+                                                           {-# UNPACK #-} !ConvertMaybeCallArguments_id,
+                                                           convertMaybeCallArguments_key ::
+                                                           Prelude.Maybe
+                                                             ConvertMaybeCallArguments_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertMaybeCallArguments where
+  toJSON (ConvertMaybeCallArguments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertMaybeCallArguments where
+  buildStruct _proxy
+    (ConvertMaybeCallArguments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ConvertMaybeCallArguments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertMaybeCallArguments where
+  rnf (ConvertMaybeCallArguments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertMaybeCallArguments where
+  def = ConvertMaybeCallArguments Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertMaybeCallArguments where
+  hashWithSalt __salt (ConvertMaybeCallArguments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertCalleeForFileCall_id = Glean.Id
+
+data ConvertCalleeForFileCall = ConvertCalleeForFileCall{convertCalleeForFileCall_id
+                                                         ::
+                                                         {-# UNPACK #-} !ConvertCalleeForFileCall_id,
+                                                         convertCalleeForFileCall_key ::
+                                                         Prelude.Maybe ConvertCalleeForFileCall_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCalleeForFileCall where
+  toJSON (ConvertCalleeForFileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCalleeForFileCall where
+  buildStruct _proxy
+    (ConvertCalleeForFileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ConvertCalleeForFileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCalleeForFileCall where
+  rnf (ConvertCalleeForFileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertCalleeForFileCall where
+  def = ConvertCalleeForFileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertCalleeForFileCall where
+  hashWithSalt __salt (ConvertCalleeForFileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertCallee_id = Glean.Id
+
+data ConvertCallee = ConvertCallee{convertCallee_id ::
+                                   {-# UNPACK #-} !ConvertCallee_id,
+                                   convertCallee_key :: Prelude.Maybe ConvertCallee_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallee where
+  toJSON (ConvertCallee __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCallee where
+  buildStruct _proxy (ConvertCallee __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConvertCallee __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallee where
+  rnf (ConvertCallee __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertCallee where
+  def = ConvertCallee Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertCallee where
+  hashWithSalt __salt (ConvertCallee _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertCallArguments_id = Glean.Id
+
+data ConvertCallArguments = ConvertCallArguments{convertCallArguments_id
+                                                 :: {-# UNPACK #-} !ConvertCallArguments_id,
+                                                 convertCallArguments_key ::
+                                                 Prelude.Maybe ConvertCallArguments_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallArguments where
+  toJSON (ConvertCallArguments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCallArguments where
+  buildStruct _proxy (ConvertCallArguments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ConvertCallArguments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallArguments where
+  rnf (ConvertCallArguments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertCallArguments where
+  def = ConvertCallArguments Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertCallArguments where
+  hashWithSalt __salt (ConvertCallArguments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertArgument_id = Glean.Id
+
+data ConvertArgument = ConvertArgument{convertArgument_id ::
+                                       {-# UNPACK #-} !ConvertArgument_id,
+                                       convertArgument_key :: Prelude.Maybe ConvertArgument_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertArgument where
+  toJSON (ConvertArgument __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertArgument where
+  buildStruct _proxy (ConvertArgument __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConvertArgument __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertArgument where
+  rnf (ConvertArgument __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertArgument where
+  def = ConvertArgument Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertArgument where
+  hashWithSalt __salt (ConvertArgument _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data RequiredRelation = RequiredRelation_implements_
+                      | RequiredRelation_extends_
+                      | RequiredRelation_class_
+                      | RequiredRelation__UNKNOWN Prelude.Int
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RequiredRelation where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RequiredRelation where
+  rnf __RequiredRelation = Prelude.seq __RequiredRelation ()
+
+instance Default.Default RequiredRelation where
+  def = RequiredRelation_implements_
+
+instance Hashable.Hashable RequiredRelation where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RequiredRelation where
+  toThriftEnum 0 = RequiredRelation_implements_
+  toThriftEnum 1 = RequiredRelation_extends_
+  toThriftEnum 2 = RequiredRelation_class_
+  toThriftEnum val = RequiredRelation__UNKNOWN val
+  fromThriftEnum RequiredRelation_implements_ = 0
+  fromThriftEnum RequiredRelation_extends_ = 1
+  fromThriftEnum RequiredRelation_class_ = 2
+  fromThriftEnum (RequiredRelation__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RequiredRelation_implements_, RequiredRelation_extends_,
+       RequiredRelation_class_]
+  toThriftEnumEither 0 = Prelude.Right RequiredRelation_implements_
+  toThriftEnumEither 1 = Prelude.Right RequiredRelation_extends_
+  toThriftEnumEither 2 = Prelude.Right RequiredRelation_class_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RequiredRelation: "
+           ++ Prelude.show val)
+
+data HackVisibility_key = HackVisibility_key{hackVisibility_key_entity
+                                             :: Glean.Schema.CodeHack.Entity,
+                                             hackVisibility_key_visibility ::
+                                             Glean.Schema.CodemarkupTypes.Visibility}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackVisibility_key where
+  toJSON (HackVisibility_key __field__entity __field__visibility)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "visibility" .= __field__visibility : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackVisibility_key where
+  buildStruct _proxy
+    (HackVisibility_key __field__entity __field__visibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__visibility)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             Prelude.pure
+                                               (HackVisibility_key __val__entity __val__visibility)
+              _idMap = HashMap.fromList [("entity", 1), ("visibility", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackVisibility_key where
+  rnf (HackVisibility_key __field__entity __field__visibility)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__visibility `Prelude.seq` ()
+
+instance Default.Default HackVisibility_key where
+  def = HackVisibility_key Default.def Default.def
+
+instance Hashable.Hashable HackVisibility_key where
+  hashWithSalt __salt (HackVisibility_key _entity _visibility)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _visibility
+
+data HackResolveLocation_key = HackResolveLocation_key{hackResolveLocation_key_location
+                                                       :: Glean.Schema.CodemarkupTypes.Location,
+                                                       hackResolveLocation_key_entity ::
+                                                       Glean.Schema.CodeHack.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackResolveLocation_key where
+  toJSON (HackResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackResolveLocation_key where
+  buildStruct _proxy
+    (HackResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackResolveLocation_key where
+  rnf (HackResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackResolveLocation_key where
+  def = HackResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable HackResolveLocation_key where
+  hashWithSalt __salt (HackResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data HackRequiredConstraint_key = HackRequiredConstraint_key{hackRequiredConstraint_key_entity
+                                                             :: Glean.Schema.CodeHack.Entity,
+                                                             hackRequiredConstraint_key_requiredRelation
+                                                             :: RequiredRelation,
+                                                             hackRequiredConstraint_key_required_ ::
+                                                             Glean.Schema.CodeHack.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackRequiredConstraint_key where
+  toJSON
+    (HackRequiredConstraint_key __field__entity
+       __field__requiredRelation __field__required_)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "requiredRelation" .= __field__requiredRelation :
+             "required_" .= __field__required_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackRequiredConstraint_key where
+  buildStruct _proxy
+    (HackRequiredConstraint_key __field__entity
+       __field__requiredRelation __field__required_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "requiredRelation"
+             (Thrift.getI32Type _proxy)
+             2
+             1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__requiredRelation)
+             :
+             Thrift.genField _proxy "required_" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__required_)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__requiredRelation <- ST.newSTRef Default.def
+            __field__required_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RequiredRelation")
+                                                                        ST.writeSTRef
+                                                                          __field__requiredRelation
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__required_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__requiredRelation <- ST.readSTRef
+                                                                           __field__requiredRelation
+                                             !__val__required_ <- ST.readSTRef __field__required_
+                                             Prelude.pure
+                                               (HackRequiredConstraint_key __val__entity
+                                                  __val__requiredRelation
+                                                  __val__required_)
+              _idMap
+                = HashMap.fromList
+                    [("entity", 1), ("requiredRelation", 2), ("required_", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackRequiredConstraint_key where
+  rnf
+    (HackRequiredConstraint_key __field__entity
+       __field__requiredRelation __field__required_)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__requiredRelation `Prelude.seq`
+          DeepSeq.rnf __field__required_ `Prelude.seq` ()
+
+instance Default.Default HackRequiredConstraint_key where
+  def
+    = HackRequiredConstraint_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HackRequiredConstraint_key where
+  hashWithSalt __salt
+    (HackRequiredConstraint_key _entity _requiredRelation _required_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _requiredRelation)
+        _required_
+
+data HackModifiers_key = HackModifiers_key{hackModifiers_key_entity
+                                           :: Glean.Schema.CodeHack.Entity,
+                                           hackModifiers_key_modifiers ::
+                                           Glean.Schema.CodemarkupTypes.Modifiers}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackModifiers_key where
+  toJSON (HackModifiers_key __field__entity __field__modifiers)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "modifiers" .= __field__modifiers : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackModifiers_key where
+  buildStruct _proxy
+    (HackModifiers_key __field__entity __field__modifiers)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "modifiers" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__modifiers)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             Prelude.pure
+                                               (HackModifiers_key __val__entity __val__modifiers)
+              _idMap = HashMap.fromList [("entity", 1), ("modifiers", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackModifiers_key where
+  rnf (HackModifiers_key __field__entity __field__modifiers)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__modifiers `Prelude.seq` ()
+
+instance Default.Default HackModifiers_key where
+  def = HackModifiers_key Default.def Default.def
+
+instance Hashable.Hashable HackModifiers_key where
+  hashWithSalt __salt (HackModifiers_key _entity _modifiers)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _modifiers
+
+data HackInheritedEntities_key = HackInheritedEntities_key{hackInheritedEntities_key_container
+                                                           ::
+                                                           Glean.Schema.Hack.ContainerDeclaration,
+                                                           hackInheritedEntities_key_member ::
+                                                           Glean.Schema.Hack.Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackInheritedEntities_key where
+  toJSON
+    (HackInheritedEntities_key __field__container __field__member)
+    = Aeson.object
+        ("container" .= __field__container :
+           "member" .= __field__member : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackInheritedEntities_key where
+  buildStruct _proxy
+    (HackInheritedEntities_key __field__container __field__member)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "member" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__member)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__member <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__member
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__member <- ST.readSTRef __field__member
+                                             Prelude.pure
+                                               (HackInheritedEntities_key __val__container
+                                                  __val__member)
+              _idMap = HashMap.fromList [("container", 1), ("member", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackInheritedEntities_key where
+  rnf (HackInheritedEntities_key __field__container __field__member)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__member `Prelude.seq` ()
+
+instance Default.Default HackInheritedEntities_key where
+  def = HackInheritedEntities_key Default.def Default.def
+
+instance Hashable.Hashable HackInheritedEntities_key where
+  hashWithSalt __salt (HackInheritedEntities_key _container _member)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _member
+
+data HackIdlEntityUses_key = HackIdlEntityUses_key{hackIdlEntityUses_key_target
+                                                   :: Glean.Schema.Code.Entity,
+                                                   hackIdlEntityUses_key_file ::
+                                                   Glean.Schema.Src.File,
+                                                   hackIdlEntityUses_key_span ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackIdlEntityUses_key where
+  toJSON
+    (HackIdlEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackIdlEntityUses_key where
+  buildStruct _proxy
+    (HackIdlEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (HackIdlEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackIdlEntityUses_key where
+  rnf
+    (HackIdlEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default HackIdlEntityUses_key where
+  def = HackIdlEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HackIdlEntityUses_key where
+  hashWithSalt __salt (HackIdlEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data HackFileEntityXRefSpans_key = HackFileEntityXRefSpans_key{hackFileEntityXRefSpans_key_file
+                                                               :: Glean.Schema.Src.File,
+                                                               hackFileEntityXRefSpans_key_span ::
+                                                               Glean.Schema.Src.ByteSpan,
+                                                               hackFileEntityXRefSpans_key_entity ::
+                                                               Glean.Schema.CodeHack.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileEntityXRefSpans_key where
+  toJSON
+    (HackFileEntityXRefSpans_key __field__file __field__span
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackFileEntityXRefSpans_key where
+  buildStruct _proxy
+    (HackFileEntityXRefSpans_key __field__file __field__span
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackFileEntityXRefSpans_key __val__file __val__span
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("span", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileEntityXRefSpans_key where
+  rnf
+    (HackFileEntityXRefSpans_key __field__file __field__span
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackFileEntityXRefSpans_key where
+  def
+    = HackFileEntityXRefSpans_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HackFileEntityXRefSpans_key where
+  hashWithSalt __salt
+    (HackFileEntityXRefSpans_key _file _span _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _entity
+
+data HackFileEntityXRefLocations_key = HackFileEntityXRefLocations_key{hackFileEntityXRefLocations_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       hackFileEntityXRefLocations_key_xref
+                                                                       ::
+                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                       hackFileEntityXRefLocations_key_entity
+                                                                       ::
+                                                                       Glean.Schema.CodeHack.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileEntityXRefLocations_key where
+  toJSON
+    (HackFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (HackFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileEntityXRefLocations_key where
+  rnf
+    (HackFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackFileEntityXRefLocations_key where
+  def
+    = HackFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable HackFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (HackFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data HackFileCall_key = HackFileCall_key{hackFileCall_key_file ::
+                                         Glean.Schema.Src.File,
+                                         hackFileCall_key_callee_span :: Glean.Schema.Src.ByteSpan,
+                                         hackFileCall_key_call_args ::
+                                         [Glean.Schema.Code.CallArgument],
+                                         hackFileCall_key_callee_xref ::
+                                         Prelude.Maybe Glean.Schema.Code.Entity,
+                                         hackFileCall_key_dispatch_arg ::
+                                         Prelude.Maybe Glean.Schema.Code.CallArgument,
+                                         hackFileCall_key_receiver_type ::
+                                         Prelude.Maybe Glean.Schema.Code.Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackFileCall_key where
+  toJSON
+    (HackFileCall_key __field__file __field__callee_span
+       __field__call_args __field__callee_xref __field__dispatch_arg
+       __field__receiver_type)
+    = Aeson.object
+        ("file" .= __field__file :
+           "callee_span" .= __field__callee_span :
+             "call_args" .= __field__call_args :
+               Prelude.maybe Prelude.id ((:) . ("callee_xref" .=))
+                 __field__callee_xref
+                 (Prelude.maybe Prelude.id ((:) . ("dispatch_arg" .=))
+                    __field__dispatch_arg
+                    (Prelude.maybe Prelude.id ((:) . ("receiver_type" .=))
+                       __field__receiver_type
+                       Prelude.mempty)))
+
+instance Thrift.ThriftStruct HackFileCall_key where
+  buildStruct _proxy
+    (HackFileCall_key __field__file __field__callee_span
+       __field__call_args __field__callee_xref __field__dispatch_arg
+       __field__receiver_type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "callee_span" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__callee_span)
+             :
+             Thrift.genField _proxy "call_args" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__call_args)
+               :
+               let (__cereal__callee_xref, __id__callee_xref)
+                     = case __field__callee_xref of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "callee_xref"
+                                                    (Thrift.getStructType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.buildStruct _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__callee_xref
+                   (let (__cereal__dispatch_arg, __id__dispatch_arg)
+                          = case __field__dispatch_arg of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "dispatch_arg"
+                                                         (Thrift.getStructType _proxy)
+                                                         5
+                                                         __id__callee_xref
+                                                         (Thrift.buildStruct _proxy _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, __id__callee_xref)
+                      in
+                      __cereal__dispatch_arg
+                        (case __field__receiver_type of
+                           Prelude.Just _val -> Thrift.genField _proxy "receiver_type"
+                                                  (Thrift.getStructType _proxy)
+                                                  6
+                                                  __id__dispatch_arg
+                                                  (Thrift.buildStruct _proxy _val)
+                                                  : []
+                           Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__callee_span <- ST.newSTRef Default.def
+            __field__call_args <- ST.newSTRef Default.def
+            __field__callee_xref <- ST.newSTRef Prelude.Nothing
+            __field__dispatch_arg <- ST.newSTRef Prelude.Nothing
+            __field__receiver_type <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__call_args
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_xref
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__dispatch_arg
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__receiver_type
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__callee_span <- ST.readSTRef
+                                                                      __field__callee_span
+                                             !__val__call_args <- ST.readSTRef __field__call_args
+                                             !__val__callee_xref <- ST.readSTRef
+                                                                      __field__callee_xref
+                                             !__val__dispatch_arg <- ST.readSTRef
+                                                                       __field__dispatch_arg
+                                             !__val__receiver_type <- ST.readSTRef
+                                                                        __field__receiver_type
+                                             Prelude.pure
+                                               (HackFileCall_key __val__file __val__callee_span
+                                                  __val__call_args
+                                                  __val__callee_xref
+                                                  __val__dispatch_arg
+                                                  __val__receiver_type)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("callee_span", 2), ("call_args", 3),
+                     ("callee_xref", 4), ("dispatch_arg", 5), ("receiver_type", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData HackFileCall_key where
+  rnf
+    (HackFileCall_key __field__file __field__callee_span
+       __field__call_args __field__callee_xref __field__dispatch_arg
+       __field__receiver_type)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__callee_span `Prelude.seq`
+          DeepSeq.rnf __field__call_args `Prelude.seq`
+            DeepSeq.rnf __field__callee_xref `Prelude.seq`
+              DeepSeq.rnf __field__dispatch_arg `Prelude.seq`
+                DeepSeq.rnf __field__receiver_type `Prelude.seq` ()
+
+instance Default.Default HackFileCall_key where
+  def
+    = HackFileCall_key Default.def Default.def Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable HackFileCall_key where
+  hashWithSalt __salt
+    (HackFileCall_key _file _callee_span _call_args _callee_xref
+       _dispatch_arg _receiver_type)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+                    _callee_span)
+                 _call_args)
+              _callee_xref)
+           _dispatch_arg)
+        _receiver_type
+
+data HackExtendsParentEntityConcise_key = HackExtendsParentEntityConcise_key{hackExtendsParentEntityConcise_key_child
+                                                                             ::
+                                                                             Glean.Schema.CodeHack.Entity,
+                                                                             hackExtendsParentEntityConcise_key_parent
+                                                                             ::
+                                                                             Glean.Schema.CodeHack.Entity}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsParentEntityConcise_key where
+  toJSON
+    (HackExtendsParentEntityConcise_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsParentEntityConcise_key
+         where
+  buildStruct _proxy
+    (HackExtendsParentEntityConcise_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (HackExtendsParentEntityConcise_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsParentEntityConcise_key where
+  rnf
+    (HackExtendsParentEntityConcise_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default HackExtendsParentEntityConcise_key where
+  def = HackExtendsParentEntityConcise_key Default.def Default.def
+
+instance Hashable.Hashable HackExtendsParentEntityConcise_key where
+  hashWithSalt __salt
+    (HackExtendsParentEntityConcise_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data HackExtendsParentEntity_key = HackExtendsParentEntity_key{hackExtendsParentEntity_key_child
+                                                               :: Glean.Schema.CodeHack.Entity,
+                                                               hackExtendsParentEntity_key_parent ::
+                                                               Glean.Schema.CodeHack.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsParentEntity_key where
+  toJSON (HackExtendsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsParentEntity_key where
+  buildStruct _proxy
+    (HackExtendsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (HackExtendsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsParentEntity_key where
+  rnf (HackExtendsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default HackExtendsParentEntity_key where
+  def = HackExtendsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable HackExtendsParentEntity_key where
+  hashWithSalt __salt (HackExtendsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data HackExtendsChildEntity_key = HackExtendsChildEntity_key{hackExtendsChildEntity_key_parent
+                                                             :: Glean.Schema.CodeHack.Entity,
+                                                             hackExtendsChildEntity_key_child ::
+                                                             Glean.Schema.CodeHack.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackExtendsChildEntity_key where
+  toJSON (HackExtendsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackExtendsChildEntity_key where
+  buildStruct _proxy
+    (HackExtendsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (HackExtendsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackExtendsChildEntity_key where
+  rnf (HackExtendsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default HackExtendsChildEntity_key where
+  def = HackExtendsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable HackExtendsChildEntity_key where
+  hashWithSalt __salt (HackExtendsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+newtype HackEnumInheritedMembers_key = HackEnumInheritedMembers_key{hackEnumInheritedMembers_key_member_
+                                                                    ::
+                                                                    Glean.Schema.Hack.MethodDeclaration}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEnumInheritedMembers_key where
+  toJSON (HackEnumInheritedMembers_key __field__member_)
+    = Aeson.object ("member_" .= __field__member_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEnumInheritedMembers_key where
+  buildStruct _proxy (HackEnumInheritedMembers_key __field__member_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "member_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__member_)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__member_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__member_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__member_ <- ST.readSTRef
+                                                                  __field__member_
+                                             Prelude.pure
+                                               (HackEnumInheritedMembers_key __val__member_)
+              _idMap = HashMap.fromList [("member_", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEnumInheritedMembers_key where
+  rnf (HackEnumInheritedMembers_key __field__member_)
+    = DeepSeq.rnf __field__member_ `Prelude.seq` ()
+
+instance Default.Default HackEnumInheritedMembers_key where
+  def = HackEnumInheritedMembers_key Default.def
+
+instance Hashable.Hashable HackEnumInheritedMembers_key where
+  hashWithSalt __salt (HackEnumInheritedMembers_key _member_)
+    = Hashable.hashWithSalt __salt _member_
+
+data HackEntityUses_key = HackEntityUses_key{hackEntityUses_key_target
+                                             :: Glean.Schema.CodeHack.Entity,
+                                             hackEntityUses_key_file :: Glean.Schema.Src.File,
+                                             hackEntityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityUses_key where
+  toJSON
+    (HackEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityUses_key where
+  buildStruct _proxy
+    (HackEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (HackEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityUses_key where
+  rnf
+    (HackEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default HackEntityUses_key where
+  def = HackEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HackEntityUses_key where
+  hashWithSalt __salt (HackEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data HackEntitySource_key = HackEntitySource_key{hackEntitySource_key_target
+                                                 :: Glean.Schema.CodeHack.Entity,
+                                                 hackEntitySource_key_source ::
+                                                 Glean.Schema.CodeHack.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntitySource_key where
+  toJSON (HackEntitySource_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntitySource_key where
+  buildStruct _proxy
+    (HackEntitySource_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (HackEntitySource_key __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntitySource_key where
+  rnf (HackEntitySource_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default HackEntitySource_key where
+  def = HackEntitySource_key Default.def Default.def
+
+instance Hashable.Hashable HackEntitySource_key where
+  hashWithSalt __salt (HackEntitySource_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data HackEntityModuleName_key = HackEntityModuleName_key{hackEntityModuleName_key_entity
+                                                         :: Glean.Schema.CodeHack.Entity,
+                                                         hackEntityModuleName_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityModuleName_key where
+  toJSON (HackEntityModuleName_key __field__entity __field__name)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityModuleName_key where
+  buildStruct _proxy
+    (HackEntityModuleName_key __field__entity __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (HackEntityModuleName_key __val__entity __val__name)
+              _idMap = HashMap.fromList [("entity", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityModuleName_key where
+  rnf (HackEntityModuleName_key __field__entity __field__name)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default HackEntityModuleName_key where
+  def = HackEntityModuleName_key Default.def ""
+
+instance Hashable.Hashable HackEntityModuleName_key where
+  hashWithSalt __salt (HackEntityModuleName_key _entity _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _name
+
+data HackEntityLocation_key = HackEntityLocation_key{hackEntityLocation_key_entity
+                                                     :: Glean.Schema.CodeHack.Entity,
+                                                     hackEntityLocation_key_location ::
+                                                     Glean.Schema.CodemarkupTypes.Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityLocation_key where
+  toJSON (HackEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityLocation_key where
+  buildStruct _proxy
+    (HackEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (HackEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityLocation_key where
+  rnf (HackEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default HackEntityLocation_key where
+  def = HackEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable HackEntityLocation_key where
+  hashWithSalt __salt (HackEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data HackEntityKind_key = HackEntityKind_key{hackEntityKind_key_entity
+                                             :: Glean.Schema.CodeHack.Entity,
+                                             hackEntityKind_key_kind ::
+                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityKind_key where
+  toJSON (HackEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityKind_key where
+  buildStruct _proxy
+    (HackEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (HackEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityKind_key where
+  rnf (HackEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default HackEntityKind_key where
+  def = HackEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable HackEntityKind_key where
+  hashWithSalt __salt (HackEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data HackEntityInfo_key = HackEntityInfo_key{hackEntityInfo_key_entity
+                                             :: Glean.Schema.CodeHack.Entity,
+                                             hackEntityInfo_key_info ::
+                                             Glean.Schema.CodemarkupTypes.SymbolInfo}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityInfo_key where
+  toJSON (HackEntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityInfo_key where
+  buildStruct _proxy
+    (HackEntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (HackEntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityInfo_key where
+  rnf (HackEntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default HackEntityInfo_key where
+  def = HackEntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable HackEntityInfo_key where
+  hashWithSalt __salt (HackEntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data HackEntityIdl_key = HackEntityIdl_key{hackEntityIdl_key_ent ::
+                                           Glean.Schema.CodeHack.Entity,
+                                           hackEntityIdl_key_idlEnt :: Glean.Schema.Code.IdlEntity}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityIdl_key where
+  toJSON (HackEntityIdl_key __field__ent __field__idlEnt)
+    = Aeson.object
+        ("ent" .= __field__ent :
+           "idlEnt" .= __field__idlEnt : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityIdl_key where
+  buildStruct _proxy (HackEntityIdl_key __field__ent __field__idlEnt)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ent)
+           :
+           Thrift.genField _proxy "idlEnt" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__idlEnt)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ent <- ST.newSTRef Default.def
+            __field__idlEnt <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__idlEnt
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ent <- ST.readSTRef __field__ent
+                                             !__val__idlEnt <- ST.readSTRef __field__idlEnt
+                                             Prelude.pure
+                                               (HackEntityIdl_key __val__ent __val__idlEnt)
+              _idMap = HashMap.fromList [("ent", 1), ("idlEnt", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityIdl_key where
+  rnf (HackEntityIdl_key __field__ent __field__idlEnt)
+    = DeepSeq.rnf __field__ent `Prelude.seq`
+        DeepSeq.rnf __field__idlEnt `Prelude.seq` ()
+
+instance Default.Default HackEntityIdl_key where
+  def = HackEntityIdl_key Default.def Default.def
+
+instance Hashable.Hashable HackEntityIdl_key where
+  hashWithSalt __salt (HackEntityIdl_key _ent _idlEnt)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ent) _idlEnt
+
+data HackEntityDocumentation_key = HackEntityDocumentation_key{hackEntityDocumentation_key_entity
+                                                               :: Glean.Schema.CodeHack.Entity,
+                                                               hackEntityDocumentation_key_file ::
+                                                               Glean.Schema.Src.File,
+                                                               hackEntityDocumentation_key_span ::
+                                                               Glean.Schema.Src.ByteSpan}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackEntityDocumentation_key where
+  toJSON
+    (HackEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackEntityDocumentation_key where
+  buildStruct _proxy
+    (HackEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (HackEntityDocumentation_key __val__entity
+                                                  __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("entity", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackEntityDocumentation_key where
+  rnf
+    (HackEntityDocumentation_key __field__entity __field__file
+       __field__span)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default HackEntityDocumentation_key where
+  def
+    = HackEntityDocumentation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HackEntityDocumentation_key where
+  hashWithSalt __salt
+    (HackEntityDocumentation_key _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _file)
+        _span
+
+data HackContainsParentEntity_key = HackContainsParentEntity_key{hackContainsParentEntity_key_child
+                                                                 :: Glean.Schema.CodeHack.Entity,
+                                                                 hackContainsParentEntity_key_parent
+                                                                 :: Glean.Schema.CodeHack.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackContainsParentEntity_key where
+  toJSON
+    (HackContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackContainsParentEntity_key where
+  buildStruct _proxy
+    (HackContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (HackContainsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackContainsParentEntity_key where
+  rnf (HackContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default HackContainsParentEntity_key where
+  def = HackContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable HackContainsParentEntity_key where
+  hashWithSalt __salt (HackContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data HackContainsChildEntity_key = HackContainsChildEntity_key{hackContainsChildEntity_key_parent
+                                                               :: Glean.Schema.CodeHack.Entity,
+                                                               hackContainsChildEntity_key_child ::
+                                                               Glean.Schema.CodeHack.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackContainsChildEntity_key where
+  toJSON (HackContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackContainsChildEntity_key where
+  buildStruct _proxy
+    (HackContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (HackContainsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackContainsChildEntity_key where
+  rnf (HackContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default HackContainsChildEntity_key where
+  def = HackContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable HackContainsChildEntity_key where
+  hashWithSalt __salt (HackContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data HackAnnotation_key = HackAnnotation_key{hackAnnotation_key_entity
+                                             :: Glean.Schema.CodeHack.Entity,
+                                             hackAnnotation_key_anns ::
+                                             Glean.Schema.CodeHack.Annotations}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackAnnotation_key where
+  toJSON (HackAnnotation_key __field__entity __field__anns)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "anns" .= __field__anns : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackAnnotation_key where
+  buildStruct _proxy
+    (HackAnnotation_key __field__entity __field__anns)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "anns" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__anns)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__anns <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__anns
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__anns <- ST.readSTRef __field__anns
+                                             Prelude.pure
+                                               (HackAnnotation_key __val__entity __val__anns)
+              _idMap = HashMap.fromList [("entity", 1), ("anns", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackAnnotation_key where
+  rnf (HackAnnotation_key __field__entity __field__anns)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__anns `Prelude.seq` ()
+
+instance Default.Default HackAnnotation_key where
+  def = HackAnnotation_key Default.def Default.def
+
+instance Hashable.Hashable HackAnnotation_key where
+  hashWithSalt __salt (HackAnnotation_key _entity _anns)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _anns
+
+data FromHackVisibility_key = FromHackVisibility_key{fromHackVisibility_key_hack
+                                                     :: Glean.Schema.Hack.Visibility,
+                                                     fromHackVisibility_key_out ::
+                                                     Glean.Schema.CodemarkupTypes.Visibility}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromHackVisibility_key where
+  toJSON (FromHackVisibility_key __field__hack __field__out)
+    = Aeson.object
+        ("hack" .= __field__hack : "out" .= __field__out : Prelude.mempty)
+
+instance Thrift.ThriftStruct FromHackVisibility_key where
+  buildStruct _proxy
+    (FromHackVisibility_key __field__hack __field__out)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hack" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__hack)
+           :
+           Thrift.genField _proxy "out" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__out)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hack <- ST.newSTRef Default.def
+            __field__out <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef __field__hack
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef __field__out
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hack <- ST.readSTRef __field__hack
+                                             !__val__out <- ST.readSTRef __field__out
+                                             Prelude.pure
+                                               (FromHackVisibility_key __val__hack __val__out)
+              _idMap = HashMap.fromList [("hack", 1), ("out", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FromHackVisibility_key where
+  rnf (FromHackVisibility_key __field__hack __field__out)
+    = DeepSeq.rnf __field__hack `Prelude.seq`
+        DeepSeq.rnf __field__out `Prelude.seq` ()
+
+instance Default.Default FromHackVisibility_key where
+  def = FromHackVisibility_key Default.def Default.def
+
+instance Hashable.Hashable FromHackVisibility_key where
+  hashWithSalt __salt (FromHackVisibility_key _hack _out)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hack) _out
+
+data ConvertStaticType_key = ConvertStaticType_key{convertStaticType_key_hackCallee
+                                                   :: Prelude.Maybe Glean.Schema.Hack.Declaration,
+                                                   convertStaticType_key_codeCallee ::
+                                                   Prelude.Maybe Glean.Schema.Code.Entity}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertStaticType_key where
+  toJSON
+    (ConvertStaticType_key __field__hackCallee __field__codeCallee)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("hackCallee" .=))
+           __field__hackCallee
+           (Prelude.maybe Prelude.id ((:) . ("codeCallee" .=))
+              __field__codeCallee
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertStaticType_key where
+  buildStruct _proxy
+    (ConvertStaticType_key __field__hackCallee __field__codeCallee)
+    = Thrift.genStruct _proxy
+        (let (__cereal__hackCallee, __id__hackCallee)
+               = case __field__hackCallee of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "hackCallee"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__hackCallee
+             (case __field__codeCallee of
+                Prelude.Just _val -> Thrift.genField _proxy "codeCallee"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__hackCallee
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hackCallee <- ST.newSTRef Prelude.Nothing
+            __field__codeCallee <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__hackCallee
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeCallee
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hackCallee <- ST.readSTRef
+                                                                     __field__hackCallee
+                                             !__val__codeCallee <- ST.readSTRef __field__codeCallee
+                                             Prelude.pure
+                                               (ConvertStaticType_key __val__hackCallee
+                                                  __val__codeCallee)
+              _idMap = HashMap.fromList [("hackCallee", 1), ("codeCallee", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertStaticType_key where
+  rnf (ConvertStaticType_key __field__hackCallee __field__codeCallee)
+    = DeepSeq.rnf __field__hackCallee `Prelude.seq`
+        DeepSeq.rnf __field__codeCallee `Prelude.seq` ()
+
+instance Default.Default ConvertStaticType_key where
+  def = ConvertStaticType_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertStaticType_key where
+  hashWithSalt __salt (ConvertStaticType_key _hackCallee _codeCallee)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hackCallee)
+        _codeCallee
+
+data ConvertMaybeCallArguments_key = ConvertMaybeCallArguments_key{convertMaybeCallArguments_key_hackArgument
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Hack.CallArgument,
+                                                                   convertMaybeCallArguments_key_codeArgument
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Code.CallArgument}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertMaybeCallArguments_key where
+  toJSON
+    (ConvertMaybeCallArguments_key __field__hackArgument
+       __field__codeArgument)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("hackArgument" .=))
+           __field__hackArgument
+           (Prelude.maybe Prelude.id ((:) . ("codeArgument" .=))
+              __field__codeArgument
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertMaybeCallArguments_key where
+  buildStruct _proxy
+    (ConvertMaybeCallArguments_key __field__hackArgument
+       __field__codeArgument)
+    = Thrift.genStruct _proxy
+        (let (__cereal__hackArgument, __id__hackArgument)
+               = case __field__hackArgument of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "hackArgument"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__hackArgument
+             (case __field__codeArgument of
+                Prelude.Just _val -> Thrift.genField _proxy "codeArgument"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__hackArgument
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hackArgument <- ST.newSTRef Prelude.Nothing
+            __field__codeArgument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__hackArgument
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeArgument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hackArgument <- ST.readSTRef
+                                                                       __field__hackArgument
+                                             !__val__codeArgument <- ST.readSTRef
+                                                                       __field__codeArgument
+                                             Prelude.pure
+                                               (ConvertMaybeCallArguments_key __val__hackArgument
+                                                  __val__codeArgument)
+              _idMap
+                = HashMap.fromList [("hackArgument", 1), ("codeArgument", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertMaybeCallArguments_key where
+  rnf
+    (ConvertMaybeCallArguments_key __field__hackArgument
+       __field__codeArgument)
+    = DeepSeq.rnf __field__hackArgument `Prelude.seq`
+        DeepSeq.rnf __field__codeArgument `Prelude.seq` ()
+
+instance Default.Default ConvertMaybeCallArguments_key where
+  def = ConvertMaybeCallArguments_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertMaybeCallArguments_key where
+  hashWithSalt __salt
+    (ConvertMaybeCallArguments_key _hackArgument _codeArgument)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _hackArgument)
+        _codeArgument
+
+data ConvertCalleeForFileCall_key = ConvertCalleeForFileCall_key{convertCalleeForFileCall_key_file
+                                                                 :: Glean.Schema.Src.File,
+                                                                 convertCalleeForFileCall_key_callee_span
+                                                                 :: Glean.Schema.Src.ByteSpan,
+                                                                 convertCalleeForFileCall_key_hackCallee
+                                                                 ::
+                                                                 Prelude.Maybe
+                                                                   Glean.Schema.Hack.XRefTarget,
+                                                                 convertCalleeForFileCall_key_codeCallee
+                                                                 ::
+                                                                 Prelude.Maybe
+                                                                   Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCalleeForFileCall_key where
+  toJSON
+    (ConvertCalleeForFileCall_key __field__file __field__callee_span
+       __field__hackCallee __field__codeCallee)
+    = Aeson.object
+        ("file" .= __field__file :
+           "callee_span" .= __field__callee_span :
+             Prelude.maybe Prelude.id ((:) . ("hackCallee" .=))
+               __field__hackCallee
+               (Prelude.maybe Prelude.id ((:) . ("codeCallee" .=))
+                  __field__codeCallee
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertCalleeForFileCall_key where
+  buildStruct _proxy
+    (ConvertCalleeForFileCall_key __field__file __field__callee_span
+       __field__hackCallee __field__codeCallee)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "callee_span" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__callee_span)
+             :
+             let (__cereal__hackCallee, __id__hackCallee)
+                   = case __field__hackCallee of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "hackCallee"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__hackCallee
+                 (case __field__codeCallee of
+                    Prelude.Just _val -> Thrift.genField _proxy "codeCallee"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           __id__hackCallee
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__callee_span <- ST.newSTRef Default.def
+            __field__hackCallee <- ST.newSTRef Prelude.Nothing
+            __field__codeCallee <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__hackCallee
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeCallee
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__callee_span <- ST.readSTRef
+                                                                      __field__callee_span
+                                             !__val__hackCallee <- ST.readSTRef __field__hackCallee
+                                             !__val__codeCallee <- ST.readSTRef __field__codeCallee
+                                             Prelude.pure
+                                               (ConvertCalleeForFileCall_key __val__file
+                                                  __val__callee_span
+                                                  __val__hackCallee
+                                                  __val__codeCallee)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("callee_span", 2), ("hackCallee", 3),
+                     ("codeCallee", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCalleeForFileCall_key where
+  rnf
+    (ConvertCalleeForFileCall_key __field__file __field__callee_span
+       __field__hackCallee __field__codeCallee)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__callee_span `Prelude.seq`
+          DeepSeq.rnf __field__hackCallee `Prelude.seq`
+            DeepSeq.rnf __field__codeCallee `Prelude.seq` ()
+
+instance Default.Default ConvertCalleeForFileCall_key where
+  def
+    = ConvertCalleeForFileCall_key Default.def Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable ConvertCalleeForFileCall_key where
+  hashWithSalt __salt
+    (ConvertCalleeForFileCall_key _file _callee_span _hackCallee
+       _codeCallee)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+              _callee_span)
+           _hackCallee)
+        _codeCallee
+
+data ConvertCallee_key = ConvertCallee_key{convertCallee_key_hackCallee
+                                           :: Prelude.Maybe Glean.Schema.Hack.XRefTarget,
+                                           convertCallee_key_codeCallee ::
+                                           Prelude.Maybe Glean.Schema.Code.Entity}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallee_key where
+  toJSON (ConvertCallee_key __field__hackCallee __field__codeCallee)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("hackCallee" .=))
+           __field__hackCallee
+           (Prelude.maybe Prelude.id ((:) . ("codeCallee" .=))
+              __field__codeCallee
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertCallee_key where
+  buildStruct _proxy
+    (ConvertCallee_key __field__hackCallee __field__codeCallee)
+    = Thrift.genStruct _proxy
+        (let (__cereal__hackCallee, __id__hackCallee)
+               = case __field__hackCallee of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "hackCallee"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__hackCallee
+             (case __field__codeCallee of
+                Prelude.Just _val -> Thrift.genField _proxy "codeCallee"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__hackCallee
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hackCallee <- ST.newSTRef Prelude.Nothing
+            __field__codeCallee <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__hackCallee
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeCallee
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hackCallee <- ST.readSTRef
+                                                                     __field__hackCallee
+                                             !__val__codeCallee <- ST.readSTRef __field__codeCallee
+                                             Prelude.pure
+                                               (ConvertCallee_key __val__hackCallee
+                                                  __val__codeCallee)
+              _idMap = HashMap.fromList [("hackCallee", 1), ("codeCallee", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallee_key where
+  rnf (ConvertCallee_key __field__hackCallee __field__codeCallee)
+    = DeepSeq.rnf __field__hackCallee `Prelude.seq`
+        DeepSeq.rnf __field__codeCallee `Prelude.seq` ()
+
+instance Default.Default ConvertCallee_key where
+  def = ConvertCallee_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertCallee_key where
+  hashWithSalt __salt (ConvertCallee_key _hackCallee _codeCallee)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hackCallee)
+        _codeCallee
+
+data ConvertCallArguments_key = ConvertCallArguments_key{convertCallArguments_key_hackCallArguments
+                                                         :: [Glean.Schema.Hack.CallArgument],
+                                                         convertCallArguments_key_codeCallArguments
+                                                         :: [Glean.Schema.Code.CallArgument]}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallArguments_key where
+  toJSON
+    (ConvertCallArguments_key __field__hackCallArguments
+       __field__codeCallArguments)
+    = Aeson.object
+        ("hackCallArguments" .= __field__hackCallArguments :
+           "codeCallArguments" .= __field__codeCallArguments : Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCallArguments_key where
+  buildStruct _proxy
+    (ConvertCallArguments_key __field__hackCallArguments
+       __field__codeCallArguments)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hackCallArguments"
+           (Thrift.getListType _proxy)
+           1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__hackCallArguments)
+           :
+           Thrift.genField _proxy "codeCallArguments"
+             (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__codeCallArguments)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hackCallArguments <- ST.newSTRef Default.def
+            __field__codeCallArguments <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__hackCallArguments
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__codeCallArguments
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hackCallArguments <- ST.readSTRef
+                                                                            __field__hackCallArguments
+                                             !__val__codeCallArguments <- ST.readSTRef
+                                                                            __field__codeCallArguments
+                                             Prelude.pure
+                                               (ConvertCallArguments_key __val__hackCallArguments
+                                                  __val__codeCallArguments)
+              _idMap
+                = HashMap.fromList
+                    [("hackCallArguments", 1), ("codeCallArguments", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallArguments_key where
+  rnf
+    (ConvertCallArguments_key __field__hackCallArguments
+       __field__codeCallArguments)
+    = DeepSeq.rnf __field__hackCallArguments `Prelude.seq`
+        DeepSeq.rnf __field__codeCallArguments `Prelude.seq` ()
+
+instance Default.Default ConvertCallArguments_key where
+  def = ConvertCallArguments_key Default.def Default.def
+
+instance Hashable.Hashable ConvertCallArguments_key where
+  hashWithSalt __salt
+    (ConvertCallArguments_key _hackCallArguments _codeCallArguments)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _hackCallArguments)
+        _codeCallArguments
+
+data ConvertArgument_key = ConvertArgument_key{convertArgument_key_hackArgument
+                                               :: Prelude.Maybe Glean.Schema.Hack.Argument,
+                                               convertArgument_key_codeArgument ::
+                                               Prelude.Maybe Glean.Schema.Code.Argument}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertArgument_key where
+  toJSON
+    (ConvertArgument_key __field__hackArgument __field__codeArgument)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("hackArgument" .=))
+           __field__hackArgument
+           (Prelude.maybe Prelude.id ((:) . ("codeArgument" .=))
+              __field__codeArgument
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertArgument_key where
+  buildStruct _proxy
+    (ConvertArgument_key __field__hackArgument __field__codeArgument)
+    = Thrift.genStruct _proxy
+        (let (__cereal__hackArgument, __id__hackArgument)
+               = case __field__hackArgument of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "hackArgument"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__hackArgument
+             (case __field__codeArgument of
+                Prelude.Just _val -> Thrift.genField _proxy "codeArgument"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__hackArgument
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hackArgument <- ST.newSTRef Prelude.Nothing
+            __field__codeArgument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__hackArgument
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeArgument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hackArgument <- ST.readSTRef
+                                                                       __field__hackArgument
+                                             !__val__codeArgument <- ST.readSTRef
+                                                                       __field__codeArgument
+                                             Prelude.pure
+                                               (ConvertArgument_key __val__hackArgument
+                                                  __val__codeArgument)
+              _idMap
+                = HashMap.fromList [("hackArgument", 1), ("codeArgument", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertArgument_key where
+  rnf
+    (ConvertArgument_key __field__hackArgument __field__codeArgument)
+    = DeepSeq.rnf __field__hackArgument `Prelude.seq`
+        DeepSeq.rnf __field__codeArgument `Prelude.seq` ()
+
+instance Default.Default ConvertArgument_key where
+  def = ConvertArgument_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertArgument_key where
+  hashWithSalt __salt
+    (ConvertArgument_key _hackArgument _codeArgument)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _hackArgument)
+        _codeArgument
+{-# LINE 22 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityIdl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityIdl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityIdl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityIdl_key"
+           (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityIdl_key
+     =
+     'Angle.TField "ent" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "idlEnt" (Glean.Schema.Code.Types.IdlEntity)
+          ('Angle.TNoFields))
+{-# LINE 33 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityIdl
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityIdl =
+       Glean.Schema.CodemarkupHack.Types.HackEntityIdl_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityIdl" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntityIdl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityIdl x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackEntityIdl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 42 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupHack.Types.HackEntityIdl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 48 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers_key
+        <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEnumInheritedMembers_key"
+           (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers_key
+     =
+     'Angle.TField "member_"
+       (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+       ('Angle.TNoFields)
+{-# LINE 57 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers
+       = Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEnumInheritedMembers" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackEnumInheritedMembers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackEnumInheritedMembers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEnumInheritedMembers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackExtendsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 82 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 84 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity
+       = Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackExtendsParentEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackExtendsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackExtendsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 94 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 100 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertCallee_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertCallee_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertCallee_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertCallee_key"
+           (Prelude.Just 0))
+{-# LINE 109 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertCallee_key
+     =
+     'Angle.TField "hackCallee"
+       (Prelude.Maybe Glean.Schema.Hack.Types.XRefTarget)
+       ('Angle.TField "codeCallee"
+          (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 111 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertCallee
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.ConvertCallee =
+       Glean.Schema.CodemarkupHack.Types.ConvertCallee_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertCallee" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.convertCallee_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertCallee x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.convertCallee_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 120 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupHack.Types.ConvertCallee
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 126 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackFileCall_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackFileCall_key x1 x2 x3 x4 x5
+       x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackFileCall_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackFileCall_key"
+           (Prelude.Just 0))
+{-# LINE 143 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackFileCall_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "callee_span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "call_args" ([Glean.Schema.Code.Types.CallArgument])
+             ('Angle.TField "callee_xref"
+                (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+                ('Angle.TField "dispatch_arg"
+                   (Prelude.Maybe Glean.Schema.Code.Types.CallArgument)
+                   ('Angle.TField "receiver_type"
+                      (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+                      ('Angle.TNoFields))))))
+{-# LINE 145 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackFileCall
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackFileCall =
+       Glean.Schema.CodemarkupHack.Types.HackFileCall_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackFileCall" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackFileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackFileCall x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackFileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 154 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupHack.Types.HackFileCall
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 160 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.hack.HackExtendsParentEntityConcise_key"
+           (Prelude.Just 0))
+{-# LINE 169 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 171 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise
+       =
+       Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.hack.HackExtendsParentEntityConcise"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackExtendsParentEntityConcise_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackExtendsParentEntityConcise_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 181 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsParentEntityConcise
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 187 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 196 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackVisibility_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "visibility"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 198 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackVisibility =
+       Glean.Schema.CodemarkupHack.Types.HackVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackVisibility" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackVisibility x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 207 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 213 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 222 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 224 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackResolveLocation
+       = Glean.Schema.CodemarkupHack.Types.HackResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 233 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 239 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntitySource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntitySource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntitySource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntitySource_key"
+           (Prelude.Just 0))
+{-# LINE 248 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntitySource_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "source" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 250 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntitySource
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntitySource =
+       Glean.Schema.CodemarkupHack.Types.HackEntitySource_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntitySource" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntitySource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntitySource x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackEntitySource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 259 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntitySource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 265 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertArgument_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertArgument_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertArgument_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertArgument_key"
+           (Prelude.Just 0))
+{-# LINE 274 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertArgument_key
+     =
+     'Angle.TField "hackArgument"
+       (Prelude.Maybe Glean.Schema.Hack.Types.Argument)
+       ('Angle.TField "codeArgument"
+          (Prelude.Maybe Glean.Schema.Code.Types.Argument)
+          ('Angle.TNoFields))
+{-# LINE 276 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertArgument
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.ConvertArgument =
+       Glean.Schema.CodemarkupHack.Types.ConvertArgument_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertArgument" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.convertArgument_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertArgument x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.convertArgument_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 285 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertArgument
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 291 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackInheritedEntities_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackInheritedEntities_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackInheritedEntities_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackInheritedEntities_key"
+           (Prelude.Just 0))
+{-# LINE 300 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackInheritedEntities_key
+     =
+     'Angle.TField "container"
+       (Glean.Schema.Hack.Types.ContainerDeclaration)
+       ('Angle.TField "member" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 302 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackInheritedEntities
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackInheritedEntities
+       = Glean.Schema.CodemarkupHack.Types.HackInheritedEntities_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackInheritedEntities" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackInheritedEntities_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackInheritedEntities x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackInheritedEntities_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 312 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackInheritedEntities
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 318 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityInfo_key"
+           (Prelude.Just 0))
+{-# LINE 327 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 329 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityInfo =
+       Glean.Schema.CodemarkupHack.Types.HackEntityInfo_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityInfo" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityInfo x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackEntityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 338 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 344 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertMaybeCallArguments_key"
+           (Prelude.Just 0))
+{-# LINE 353 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments_key
+     =
+     'Angle.TField "hackArgument"
+       (Prelude.Maybe Glean.Schema.Hack.Types.CallArgument)
+       ('Angle.TField "codeArgument"
+          (Prelude.Maybe Glean.Schema.Code.Types.CallArgument)
+          ('Angle.TNoFields))
+{-# LINE 355 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments
+       = Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertMaybeCallArguments" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.convertMaybeCallArguments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.convertMaybeCallArguments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 365 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertMaybeCallArguments
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 371 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackIdlEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 382 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 384 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses =
+       Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackIdlEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackIdlEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackIdlEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 393 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackIdlEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 399 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertCallArguments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertCallArguments_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertCallArguments_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertCallArguments_key"
+           (Prelude.Just 0))
+{-# LINE 408 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertCallArguments_key
+     =
+     'Angle.TField "hackCallArguments"
+       ([Glean.Schema.Hack.Types.CallArgument])
+       ('Angle.TField "codeCallArguments"
+          ([Glean.Schema.Code.Types.CallArgument])
+          ('Angle.TNoFields))
+{-# LINE 410 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertCallArguments
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.ConvertCallArguments
+       = Glean.Schema.CodemarkupHack.Types.ConvertCallArguments_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertCallArguments" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.convertCallArguments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertCallArguments x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.convertCallArguments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 419 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertCallArguments
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 425 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall_key x1
+       x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertCalleeForFileCall_key"
+           (Prelude.Just 0))
+{-# LINE 438 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "callee_span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "hackCallee"
+             (Prelude.Maybe Glean.Schema.Hack.Types.XRefTarget)
+             ('Angle.TField "codeCallee"
+                (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 440 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall
+       = Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertCalleeForFileCall" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.convertCalleeForFileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.convertCalleeForFileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 450 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertCalleeForFileCall
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 456 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityModuleName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityModuleName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityModuleName_key"
+           (Prelude.Just 0))
+{-# LINE 465 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityModuleName_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 467 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityModuleName
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityModuleName
+       = Glean.Schema.CodemarkupHack.Types.HackEntityModuleName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityModuleName" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackEntityModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityModuleName x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackEntityModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 476 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 482 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackRequiredConstraint_key"
+           (Prelude.Just 0))
+{-# LINE 493 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "requiredRelation"
+          (Glean.Schema.CodemarkupHack.Types.RequiredRelation)
+          ('Angle.TField "required_" (Glean.Schema.CodeHack.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 495 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint
+       = Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackRequiredConstraint" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackRequiredConstraint_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackRequiredConstraint_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 505 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackRequiredConstraint
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 511 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 522 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 524 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation
+       = Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityDocumentation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackEntityDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackEntityDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 534 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 540 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackExtendsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 549 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 551 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity
+       = Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackExtendsChildEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackExtendsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackExtendsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 561 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackExtendsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 567 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackModifiers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackModifiers_key"
+           (Prelude.Just 0))
+{-# LINE 576 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "modifiers"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 578 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackModifiers
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackModifiers =
+       Glean.Schema.CodemarkupHack.Types.HackModifiers_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackModifiers" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackModifiers x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 587 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupHack.Types.HackModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 593 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.EntityHasHideFromDocsAttr
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.EntityHasHideFromDocsAttr
+       = Glean.Schema.CodeHack.Types.Entity
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.EntityHasHideFromDocsAttr" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.entityHasHideFromDocsAttr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.EntityHasHideFromDocsAttr x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.entityHasHideFromDocsAttr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 603 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.EntityHasHideFromDocsAttr
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 609 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.FromHackVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.FromHackVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.FromHackVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.FromHackVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 618 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.FromHackVisibility_key
+     =
+     'Angle.TField "hack" (Glean.Schema.Hack.Types.Visibility)
+       ('Angle.TField "out"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 620 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.FromHackVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.FromHackVisibility =
+       Glean.Schema.CodemarkupHack.Types.FromHackVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.FromHackVisibility" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.fromHackVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.FromHackVisibility x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.fromHackVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 629 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.FromHackVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 635 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 644 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 646 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityLocation =
+       Glean.Schema.CodemarkupHack.Types.HackEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 655 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 661 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 670 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 672 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity
+       = Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackContainsParentEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackContainsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackContainsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 682 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 688 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertStaticType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.ConvertStaticType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.ConvertStaticType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.ConvertStaticType_key"
+           (Prelude.Just 0))
+{-# LINE 697 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.ConvertStaticType_key
+     =
+     'Angle.TField "hackCallee"
+       (Prelude.Maybe Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "codeCallee"
+          (Prelude.Maybe Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 699 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.ConvertStaticType
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.ConvertStaticType =
+       Glean.Schema.CodemarkupHack.Types.ConvertStaticType_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.ConvertStaticType" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.convertStaticType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.ConvertStaticType x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.convertStaticType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 708 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.ConvertStaticType
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 714 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 725 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 727 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations
+       = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 737 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 743 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 754 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 756 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityUses =
+       Glean.Schema.CodemarkupHack.Types.HackEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 765 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 771 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackAnnotation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackAnnotation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackAnnotation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackAnnotation_key"
+           (Prelude.Just 0))
+{-# LINE 780 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackAnnotation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "anns" (Glean.Schema.CodeHack.Types.Annotations)
+          ('Angle.TNoFields))
+{-# LINE 782 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackAnnotation
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackAnnotation =
+       Glean.Schema.CodemarkupHack.Types.HackAnnotation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackAnnotation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackAnnotation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackAnnotation x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackAnnotation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 791 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackAnnotation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 797 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackFileEntityXRefSpans_key"
+           (Prelude.Just 0))
+{-# LINE 808 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 810 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans
+       = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackFileEntityXRefSpans" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackFileEntityXRefSpans_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackFileEntityXRefSpans_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 820 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackFileEntityXRefSpans
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 826 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 835 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 837 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupHack.Types.HackEntityKind =
+       Glean.Schema.CodemarkupHack.Types.HackEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackEntityKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupHack.Types.hackEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackEntityKind x k
+  getFactKey = Glean.Schema.CodemarkupHack.Types.hackEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 846 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 852 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.HackContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 861 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeHack.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeHack.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 863 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity
+       = Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.hack.HackContainsChildEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHack.Types.hackContainsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupHack.Types.hackContainsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 873 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.HackContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 879 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHack.Types.RequiredRelation
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.hack.RequiredRelation"
+           (Prelude.Just 2))
+{-# LINE 884 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupHack.Types.RequiredRelation
+     =
+     'Angle.TField "implements_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "extends_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "class_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 886 "glean/schema/thrift/codemarkup_hack_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.CodemarkupHack.Types.RequiredRelation
+         where
+  type AngleEnumTy Glean.Schema.CodemarkupHack.Types.RequiredRelation
+       = Glean.Schema.CodemarkupHack.Types.RequiredRelation
+  enumName v = Text.pack (Prelude.drop 17 (Prelude.show v))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHaskell/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHaskell/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHaskell/Types.hs
@@ -0,0 +1,1468 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHaskell/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupHaskell.Types
+       (pREDICATE_VERSIONS, HaskellResolveLocation_id,
+        HaskellResolveLocation(HaskellResolveLocation,
+                               haskellResolveLocation_id, haskellResolveLocation_key),
+        HaskellFileEntityXRefLocations_id,
+        HaskellFileEntityXRefLocations(HaskellFileEntityXRefLocations,
+                                       haskellFileEntityXRefLocations_id,
+                                       haskellFileEntityXRefLocations_key),
+        HaskellEntityUses_id,
+        HaskellEntityUses(HaskellEntityUses, haskellEntityUses_id,
+                          haskellEntityUses_key),
+        HaskellEntityLocation_id,
+        HaskellEntityLocation(HaskellEntityLocation,
+                              haskellEntityLocation_id, haskellEntityLocation_key),
+        HaskellContainsParentEntity_id,
+        HaskellContainsParentEntity(HaskellContainsParentEntity,
+                                    haskellContainsParentEntity_id,
+                                    haskellContainsParentEntity_key),
+        HaskellContainsChildEntity_id,
+        HaskellContainsChildEntity(HaskellContainsChildEntity,
+                                   haskellContainsChildEntity_id, haskellContainsChildEntity_key),
+        HaskellResolveLocation_key(HaskellResolveLocation_key,
+                                   haskellResolveLocation_key_location,
+                                   haskellResolveLocation_key_entity),
+        HaskellFileEntityXRefLocations_key(HaskellFileEntityXRefLocations_key,
+                                           haskellFileEntityXRefLocations_key_file,
+                                           haskellFileEntityXRefLocations_key_xref,
+                                           haskellFileEntityXRefLocations_key_entity),
+        HaskellEntityUses_key(HaskellEntityUses_key,
+                              haskellEntityUses_key_target, haskellEntityUses_key_file,
+                              haskellEntityUses_key_span),
+        HaskellEntityLocation_key(HaskellEntityLocation_key,
+                                  haskellEntityLocation_key_entity,
+                                  haskellEntityLocation_key_location),
+        HaskellContainsParentEntity_key(HaskellContainsParentEntity_key,
+                                        haskellContainsParentEntity_key_child,
+                                        haskellContainsParentEntity_key_parent),
+        HaskellContainsChildEntity_key(HaskellContainsChildEntity_key,
+                                       haskellContainsChildEntity_key_parent,
+                                       haskellContainsChildEntity_key_child))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeHs.Types as Glean.Schema.CodeHs
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Schema.CodeHs.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 117 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupHaskell/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("HaskellContainsChildEntity", 2),
+       ("HaskellContainsParentEntity", 2), ("HaskellEntityUses", 2),
+       ("HaskellFileEntityXRefLocations", 2),
+       ("HaskellResolveLocation", 2), ("HaskellEntityLocation", 2)]
+
+type HaskellResolveLocation_id = Glean.Id
+
+data HaskellResolveLocation = HaskellResolveLocation{haskellResolveLocation_id
+                                                     :: {-# UNPACK #-} !HaskellResolveLocation_id,
+                                                     haskellResolveLocation_key ::
+                                                     Prelude.Maybe HaskellResolveLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellResolveLocation where
+  toJSON (HaskellResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellResolveLocation where
+  buildStruct _proxy
+    (HaskellResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HaskellResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellResolveLocation where
+  rnf (HaskellResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellResolveLocation where
+  def = HaskellResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellResolveLocation where
+  hashWithSalt __salt (HaskellResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HaskellFileEntityXRefLocations_id = Glean.Id
+
+data HaskellFileEntityXRefLocations = HaskellFileEntityXRefLocations{haskellFileEntityXRefLocations_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !HaskellFileEntityXRefLocations_id,
+                                                                     haskellFileEntityXRefLocations_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       HaskellFileEntityXRefLocations_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellFileEntityXRefLocations where
+  toJSON (HaskellFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellFileEntityXRefLocations where
+  buildStruct _proxy
+    (HaskellFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HaskellFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellFileEntityXRefLocations where
+  rnf (HaskellFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellFileEntityXRefLocations where
+  def = HaskellFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellFileEntityXRefLocations where
+  hashWithSalt __salt (HaskellFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HaskellEntityUses_id = Glean.Id
+
+data HaskellEntityUses = HaskellEntityUses{haskellEntityUses_id ::
+                                           {-# UNPACK #-} !HaskellEntityUses_id,
+                                           haskellEntityUses_key ::
+                                           Prelude.Maybe HaskellEntityUses_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellEntityUses where
+  toJSON (HaskellEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellEntityUses where
+  buildStruct _proxy (HaskellEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HaskellEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellEntityUses where
+  rnf (HaskellEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellEntityUses where
+  def = HaskellEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellEntityUses where
+  hashWithSalt __salt (HaskellEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HaskellEntityLocation_id = Glean.Id
+
+data HaskellEntityLocation = HaskellEntityLocation{haskellEntityLocation_id
+                                                   :: {-# UNPACK #-} !HaskellEntityLocation_id,
+                                                   haskellEntityLocation_key ::
+                                                   Prelude.Maybe HaskellEntityLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellEntityLocation where
+  toJSON (HaskellEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellEntityLocation where
+  buildStruct _proxy (HaskellEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HaskellEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellEntityLocation where
+  rnf (HaskellEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellEntityLocation where
+  def = HaskellEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellEntityLocation where
+  hashWithSalt __salt (HaskellEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HaskellContainsParentEntity_id = Glean.Id
+
+data HaskellContainsParentEntity = HaskellContainsParentEntity{haskellContainsParentEntity_id
+                                                               ::
+                                                               {-# UNPACK #-} !HaskellContainsParentEntity_id,
+                                                               haskellContainsParentEntity_key ::
+                                                               Prelude.Maybe
+                                                                 HaskellContainsParentEntity_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellContainsParentEntity where
+  toJSON (HaskellContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellContainsParentEntity where
+  buildStruct _proxy
+    (HaskellContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HaskellContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellContainsParentEntity where
+  rnf (HaskellContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellContainsParentEntity where
+  def = HaskellContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellContainsParentEntity where
+  hashWithSalt __salt (HaskellContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HaskellContainsChildEntity_id = Glean.Id
+
+data HaskellContainsChildEntity = HaskellContainsChildEntity{haskellContainsChildEntity_id
+                                                             ::
+                                                             {-# UNPACK #-} !HaskellContainsChildEntity_id,
+                                                             haskellContainsChildEntity_key ::
+                                                             Prelude.Maybe
+                                                               HaskellContainsChildEntity_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellContainsChildEntity where
+  toJSON (HaskellContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellContainsChildEntity where
+  buildStruct _proxy
+    (HaskellContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HaskellContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellContainsChildEntity where
+  rnf (HaskellContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HaskellContainsChildEntity where
+  def = HaskellContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable HaskellContainsChildEntity where
+  hashWithSalt __salt (HaskellContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data HaskellResolveLocation_key = HaskellResolveLocation_key{haskellResolveLocation_key_location
+                                                             ::
+                                                             Glean.Schema.CodemarkupTypes.Location,
+                                                             haskellResolveLocation_key_entity ::
+                                                             Glean.Schema.CodeHs.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellResolveLocation_key where
+  toJSON
+    (HaskellResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellResolveLocation_key where
+  buildStruct _proxy
+    (HaskellResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HaskellResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellResolveLocation_key where
+  rnf (HaskellResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HaskellResolveLocation_key where
+  def = HaskellResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable HaskellResolveLocation_key where
+  hashWithSalt __salt (HaskellResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data HaskellFileEntityXRefLocations_key = HaskellFileEntityXRefLocations_key{haskellFileEntityXRefLocations_key_file
+                                                                             ::
+                                                                             Glean.Schema.Src.File,
+                                                                             haskellFileEntityXRefLocations_key_xref
+                                                                             ::
+                                                                             Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                             haskellFileEntityXRefLocations_key_entity
+                                                                             ::
+                                                                             Glean.Schema.CodeHs.Entity}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellFileEntityXRefLocations_key where
+  toJSON
+    (HaskellFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (HaskellFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HaskellFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellFileEntityXRefLocations_key where
+  rnf
+    (HaskellFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HaskellFileEntityXRefLocations_key where
+  def
+    = HaskellFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable HaskellFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (HaskellFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data HaskellEntityUses_key = HaskellEntityUses_key{haskellEntityUses_key_target
+                                                   :: Glean.Schema.CodeHs.Entity,
+                                                   haskellEntityUses_key_file ::
+                                                   Glean.Schema.Src.File,
+                                                   haskellEntityUses_key_span ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellEntityUses_key where
+  toJSON
+    (HaskellEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellEntityUses_key where
+  buildStruct _proxy
+    (HaskellEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (HaskellEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellEntityUses_key where
+  rnf
+    (HaskellEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default HaskellEntityUses_key where
+  def = HaskellEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable HaskellEntityUses_key where
+  hashWithSalt __salt (HaskellEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data HaskellEntityLocation_key = HaskellEntityLocation_key{haskellEntityLocation_key_entity
+                                                           :: Glean.Schema.CodeHs.Entity,
+                                                           haskellEntityLocation_key_location ::
+                                                           Glean.Schema.CodemarkupTypes.Location}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellEntityLocation_key where
+  toJSON
+    (HaskellEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellEntityLocation_key where
+  buildStruct _proxy
+    (HaskellEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (HaskellEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellEntityLocation_key where
+  rnf (HaskellEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default HaskellEntityLocation_key where
+  def = HaskellEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable HaskellEntityLocation_key where
+  hashWithSalt __salt (HaskellEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data HaskellContainsParentEntity_key = HaskellContainsParentEntity_key{haskellContainsParentEntity_key_child
+                                                                       ::
+                                                                       Glean.Schema.CodeHs.Entity,
+                                                                       haskellContainsParentEntity_key_parent
+                                                                       ::
+                                                                       Glean.Schema.CodeHs.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellContainsParentEntity_key where
+  toJSON
+    (HaskellContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellContainsParentEntity_key where
+  buildStruct _proxy
+    (HaskellContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (HaskellContainsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellContainsParentEntity_key where
+  rnf
+    (HaskellContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default HaskellContainsParentEntity_key where
+  def = HaskellContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable HaskellContainsParentEntity_key where
+  hashWithSalt __salt
+    (HaskellContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data HaskellContainsChildEntity_key = HaskellContainsChildEntity_key{haskellContainsChildEntity_key_parent
+                                                                     :: Glean.Schema.CodeHs.Entity,
+                                                                     haskellContainsChildEntity_key_child
+                                                                     :: Glean.Schema.CodeHs.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HaskellContainsChildEntity_key where
+  toJSON
+    (HaskellContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct HaskellContainsChildEntity_key where
+  buildStruct _proxy
+    (HaskellContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (HaskellContainsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HaskellContainsChildEntity_key where
+  rnf (HaskellContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default HaskellContainsChildEntity_key where
+  def = HaskellContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable HaskellContainsChildEntity_key where
+  hashWithSalt __salt (HaskellContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+{-# LINE 20 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.haskell.HaskellContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodeHs.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodeHs.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity
+       =
+       Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.haskell.HaskellContainsChildEntity"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellContainsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellContainsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.haskell.HaskellContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 56 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodeHs.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodeHs.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 58 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity
+       =
+       Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.haskell.HaskellContainsParentEntity"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellContainsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellContainsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 74 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.haskell.HaskellEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeHs.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 87 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses
+       = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.haskell.HaskellEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.haskell.HaskellFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 113 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeHs.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 115 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.haskell.HaskellFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.haskell.HaskellResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeHs.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation
+       = Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.haskell.HaskellResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 152 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 158 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.haskell.HaskellEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 167 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeHs.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 169 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation
+       = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.haskell.HaskellEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupHaskell.Types.haskellEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupHaskell.Types.haskellEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 179 "glean/schema/thrift/codemarkup_haskell_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupHaskell.Types.HaskellEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupLsif/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupLsif/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupLsif/Types.hs
@@ -0,0 +1,1609 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupLsif/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupLsif.Types
+       (pREDICATE_VERSIONS, LsifResolveLocation_id,
+        LsifResolveLocation(LsifResolveLocation, lsifResolveLocation_id,
+                            lsifResolveLocation_key),
+        LsifKindToKind_id,
+        LsifKindToKind(LsifKindToKind, lsifKindToKind_id,
+                       lsifKindToKind_key),
+        LsifFileEntityXRefLocations_id,
+        LsifFileEntityXRefLocations(LsifFileEntityXRefLocations,
+                                    lsifFileEntityXRefLocations_id,
+                                    lsifFileEntityXRefLocations_key),
+        LsifEntityUses_id,
+        LsifEntityUses(LsifEntityUses, lsifEntityUses_id,
+                       lsifEntityUses_key),
+        LsifEntityModuleName_id,
+        LsifEntityModuleName(LsifEntityModuleName, lsifEntityModuleName_id,
+                             lsifEntityModuleName_key),
+        LsifEntityLocation_id,
+        LsifEntityLocation(LsifEntityLocation, lsifEntityLocation_id,
+                           lsifEntityLocation_key),
+        EntityInfo_id,
+        EntityInfo(EntityInfo, entityInfo_id, entityInfo_key),
+        LsifResolveLocation_key(LsifResolveLocation_key,
+                                lsifResolveLocation_key_location, lsifResolveLocation_key_entity),
+        LsifKindToKind_key(LsifKindToKind_key, lsifKindToKind_key_lsif,
+                           lsifKindToKind_key_kind),
+        LsifFileEntityXRefLocations_key(LsifFileEntityXRefLocations_key,
+                                        lsifFileEntityXRefLocations_key_file,
+                                        lsifFileEntityXRefLocations_key_xref,
+                                        lsifFileEntityXRefLocations_key_entity),
+        LsifEntityUses_key(LsifEntityUses_key, lsifEntityUses_key_target,
+                           lsifEntityUses_key_file, lsifEntityUses_key_range),
+        LsifEntityModuleName_key(LsifEntityModuleName_key,
+                                 lsifEntityModuleName_key_lsif, lsifEntityModuleName_key_name),
+        LsifEntityLocation_key(LsifEntityLocation_key,
+                               lsifEntityLocation_key_entity, lsifEntityLocation_key_location),
+        EntityInfo_key(EntityInfo_key, entityInfo_key_entity,
+                       entityInfo_key_info))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeLsif.Types
+       as Glean.Schema.CodeLsif
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.LsifTypes.Types
+       as Glean.Schema.LsifTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Schema.CodeLsif.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Schema.LsifTypes.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 120 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupLsif/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("LsifEntityModuleName", 3), ("LsifResolveLocation", 3),
+       ("LsifEntityUses", 3), ("LsifEntityLocation", 3),
+       ("LsifKindToKind", 3), ("LsifFileEntityXRefLocations", 3),
+       ("EntityInfo", 3)]
+
+type LsifResolveLocation_id = Glean.Id
+
+data LsifResolveLocation = LsifResolveLocation{lsifResolveLocation_id
+                                               :: {-# UNPACK #-} !LsifResolveLocation_id,
+                                               lsifResolveLocation_key ::
+                                               Prelude.Maybe LsifResolveLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifResolveLocation where
+  toJSON (LsifResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifResolveLocation where
+  buildStruct _proxy (LsifResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifResolveLocation where
+  rnf (LsifResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifResolveLocation where
+  def = LsifResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifResolveLocation where
+  hashWithSalt __salt (LsifResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifKindToKind_id = Glean.Id
+
+data LsifKindToKind = LsifKindToKind{lsifKindToKind_id ::
+                                     {-# UNPACK #-} !LsifKindToKind_id,
+                                     lsifKindToKind_key :: Prelude.Maybe LsifKindToKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifKindToKind where
+  toJSON (LsifKindToKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifKindToKind where
+  buildStruct _proxy (LsifKindToKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifKindToKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifKindToKind where
+  rnf (LsifKindToKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifKindToKind where
+  def = LsifKindToKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifKindToKind where
+  hashWithSalt __salt (LsifKindToKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifFileEntityXRefLocations_id = Glean.Id
+
+data LsifFileEntityXRefLocations = LsifFileEntityXRefLocations{lsifFileEntityXRefLocations_id
+                                                               ::
+                                                               {-# UNPACK #-} !LsifFileEntityXRefLocations_id,
+                                                               lsifFileEntityXRefLocations_key ::
+                                                               Prelude.Maybe
+                                                                 LsifFileEntityXRefLocations_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifFileEntityXRefLocations where
+  toJSON (LsifFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifFileEntityXRefLocations where
+  buildStruct _proxy
+    (LsifFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LsifFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifFileEntityXRefLocations where
+  rnf (LsifFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifFileEntityXRefLocations where
+  def = LsifFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifFileEntityXRefLocations where
+  hashWithSalt __salt (LsifFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifEntityUses_id = Glean.Id
+
+data LsifEntityUses = LsifEntityUses{lsifEntityUses_id ::
+                                     {-# UNPACK #-} !LsifEntityUses_id,
+                                     lsifEntityUses_key :: Prelude.Maybe LsifEntityUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityUses where
+  toJSON (LsifEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityUses where
+  buildStruct _proxy (LsifEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityUses where
+  rnf (LsifEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifEntityUses where
+  def = LsifEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifEntityUses where
+  hashWithSalt __salt (LsifEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifEntityModuleName_id = Glean.Id
+
+data LsifEntityModuleName = LsifEntityModuleName{lsifEntityModuleName_id
+                                                 :: {-# UNPACK #-} !LsifEntityModuleName_id,
+                                                 lsifEntityModuleName_key ::
+                                                 Prelude.Maybe LsifEntityModuleName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityModuleName where
+  toJSON (LsifEntityModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityModuleName where
+  buildStruct _proxy (LsifEntityModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LsifEntityModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityModuleName where
+  rnf (LsifEntityModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifEntityModuleName where
+  def = LsifEntityModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifEntityModuleName where
+  hashWithSalt __salt (LsifEntityModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifEntityLocation_id = Glean.Id
+
+data LsifEntityLocation = LsifEntityLocation{lsifEntityLocation_id
+                                             :: {-# UNPACK #-} !LsifEntityLocation_id,
+                                             lsifEntityLocation_key ::
+                                             Prelude.Maybe LsifEntityLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityLocation where
+  toJSON (LsifEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityLocation where
+  buildStruct _proxy (LsifEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityLocation where
+  rnf (LsifEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifEntityLocation where
+  def = LsifEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifEntityLocation where
+  hashWithSalt __salt (LsifEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityInfo_id = Glean.Id
+
+data EntityInfo = EntityInfo{entityInfo_id ::
+                             {-# UNPACK #-} !EntityInfo_id,
+                             entityInfo_key :: Prelude.Maybe EntityInfo_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo where
+  toJSON (EntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo where
+  buildStruct _proxy (EntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo where
+  rnf (EntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityInfo where
+  def = EntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityInfo where
+  hashWithSalt __salt (EntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data LsifResolveLocation_key = LsifResolveLocation_key{lsifResolveLocation_key_location
+                                                       :: Glean.Schema.CodemarkupTypes.Location,
+                                                       lsifResolveLocation_key_entity ::
+                                                       Glean.Schema.CodeLsif.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifResolveLocation_key where
+  toJSON (LsifResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifResolveLocation_key where
+  buildStruct _proxy
+    (LsifResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LsifResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifResolveLocation_key where
+  rnf (LsifResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LsifResolveLocation_key where
+  def = LsifResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable LsifResolveLocation_key where
+  hashWithSalt __salt (LsifResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data LsifKindToKind_key = LsifKindToKind_key{lsifKindToKind_key_lsif
+                                             :: Glean.Schema.LsifTypes.SymbolKind,
+                                             lsifKindToKind_key_kind ::
+                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifKindToKind_key where
+  toJSON (LsifKindToKind_key __field__lsif __field__kind)
+    = Aeson.object
+        ("lsif" .= __field__lsif :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifKindToKind_key where
+  buildStruct _proxy (LsifKindToKind_key __field__lsif __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lsif" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__lsif)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lsif <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__lsif
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lsif <- ST.readSTRef __field__lsif
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (LsifKindToKind_key __val__lsif __val__kind)
+              _idMap = HashMap.fromList [("lsif", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifKindToKind_key where
+  rnf (LsifKindToKind_key __field__lsif __field__kind)
+    = DeepSeq.rnf __field__lsif `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default LsifKindToKind_key where
+  def = LsifKindToKind_key Default.def Default.def
+
+instance Hashable.Hashable LsifKindToKind_key where
+  hashWithSalt __salt (LsifKindToKind_key _lsif _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lsif) _kind
+
+data LsifFileEntityXRefLocations_key = LsifFileEntityXRefLocations_key{lsifFileEntityXRefLocations_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       lsifFileEntityXRefLocations_key_xref
+                                                                       ::
+                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                       lsifFileEntityXRefLocations_key_entity
+                                                                       ::
+                                                                       Glean.Schema.CodeLsif.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifFileEntityXRefLocations_key where
+  toJSON
+    (LsifFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (LsifFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LsifFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifFileEntityXRefLocations_key where
+  rnf
+    (LsifFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LsifFileEntityXRefLocations_key where
+  def
+    = LsifFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable LsifFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (LsifFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data LsifEntityUses_key = LsifEntityUses_key{lsifEntityUses_key_target
+                                             :: Glean.Schema.CodeLsif.Entity,
+                                             lsifEntityUses_key_file :: Glean.Schema.Src.File,
+                                             lsifEntityUses_key_range :: Glean.Schema.Src.Range}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityUses_key where
+  toJSON
+    (LsifEntityUses_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityUses_key where
+  buildStruct _proxy
+    (LsifEntityUses_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (LsifEntityUses_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityUses_key where
+  rnf
+    (LsifEntityUses_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default LsifEntityUses_key where
+  def = LsifEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable LsifEntityUses_key where
+  hashWithSalt __salt (LsifEntityUses_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data LsifEntityModuleName_key = LsifEntityModuleName_key{lsifEntityModuleName_key_lsif
+                                                         :: Glean.Schema.CodeLsif.Entity,
+                                                         lsifEntityModuleName_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityModuleName_key where
+  toJSON (LsifEntityModuleName_key __field__lsif __field__name)
+    = Aeson.object
+        ("lsif" .= __field__lsif :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityModuleName_key where
+  buildStruct _proxy
+    (LsifEntityModuleName_key __field__lsif __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lsif" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__lsif)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lsif <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__lsif
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lsif <- ST.readSTRef __field__lsif
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (LsifEntityModuleName_key __val__lsif __val__name)
+              _idMap = HashMap.fromList [("lsif", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityModuleName_key where
+  rnf (LsifEntityModuleName_key __field__lsif __field__name)
+    = DeepSeq.rnf __field__lsif `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default LsifEntityModuleName_key where
+  def = LsifEntityModuleName_key Default.def ""
+
+instance Hashable.Hashable LsifEntityModuleName_key where
+  hashWithSalt __salt (LsifEntityModuleName_key _lsif _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lsif) _name
+
+data LsifEntityLocation_key = LsifEntityLocation_key{lsifEntityLocation_key_entity
+                                                     :: Glean.Schema.CodeLsif.Entity,
+                                                     lsifEntityLocation_key_location ::
+                                                     Glean.Schema.CodemarkupTypes.Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifEntityLocation_key where
+  toJSON (LsifEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifEntityLocation_key where
+  buildStruct _proxy
+    (LsifEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (LsifEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifEntityLocation_key where
+  rnf (LsifEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default LsifEntityLocation_key where
+  def = LsifEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable LsifEntityLocation_key where
+  hashWithSalt __salt (LsifEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data EntityInfo_key = EntityInfo_key{entityInfo_key_entity ::
+                                     Glean.Schema.CodeLsif.Entity,
+                                     entityInfo_key_info :: Glean.Schema.CodemarkupTypes.SymbolInfo}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo_key where
+  toJSON (EntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo_key where
+  buildStruct _proxy (EntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure (EntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo_key where
+  rnf (EntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default EntityInfo_key where
+  def = EntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable EntityInfo_key where
+  hashWithSalt __salt (EntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+{-# LINE 21 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifEntityModuleName_key"
+           (Prelude.Just 0))
+{-# LINE 30 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName_key
+     =
+     'Angle.TField "lsif" (Glean.Schema.CodeLsif.Types.Entity)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 32 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName
+       = Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifEntityModuleName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupLsif.Types.lsifEntityModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName x k
+  getFactKey
+    = Glean.Schema.CodemarkupLsif.Types.lsifEntityModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 56 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeLsif.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 58 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation
+       = Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifResolveLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupLsif.Types.lsifResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupLsif.Types.lsifResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 84 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeLsif.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 86 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.LsifEntityUses =
+       Glean.Schema.CodemarkupLsif.Types.LsifEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifEntityUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupLsif.Types.lsifEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupLsif.Types.lsifEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 95 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 101 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 110 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeLsif.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 112 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation =
+       Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifEntityLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupLsif.Types.lsifEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupLsif.Types.lsifEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 121 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 127 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifKindToKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifKindToKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifKindToKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifKindToKind_key"
+           (Prelude.Just 0))
+{-# LINE 136 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifKindToKind_key
+     =
+     'Angle.TField "lsif" (Glean.Schema.LsifTypes.Types.SymbolKind)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 138 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifKindToKind
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.LsifKindToKind =
+       Glean.Schema.CodemarkupLsif.Types.LsifKindToKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifKindToKind" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupLsif.Types.lsifKindToKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifKindToKind x k
+  getFactKey = Glean.Schema.CodemarkupLsif.Types.lsifKindToKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 147 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifKindToKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 153 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.LsifFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 164 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeLsif.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 166 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations
+       = Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.lsif.LsifFileEntityXRefLocations"
+        3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupLsif.Types.lsifFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupLsif.Types.lsifFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 176 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.LsifFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 182 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupLsif.Types.EntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupLsif.Types.EntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupLsif.Types.EntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.lsif.EntityInfo_key" (Prelude.Just 0))
+{-# LINE 191 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupLsif.Types.EntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeLsif.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 193 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupLsif.Types.EntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupLsif.Types.EntityInfo =
+       Glean.Schema.CodemarkupLsif.Types.EntityInfo_key
+  getName _proxy = Glean.PredicateRef "codemarkup.lsif.EntityInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupLsif.Types.entityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupLsif.Types.EntityInfo x k
+  getFactKey = Glean.Schema.CodemarkupLsif.Types.entityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 202 "glean/schema/thrift/codemarkup_lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupLsif.Types.EntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPp/Types.hs
@@ -0,0 +1,2124 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupPp.Types
+       (pREDICATE_VERSIONS, PpResolveTraceLocation_id,
+        PpResolveTraceLocation(PpResolveTraceLocation,
+                               ppResolveTraceLocation_id, ppResolveTraceLocation_key),
+        PpResolveLocation_id,
+        PpResolveLocation(PpResolveLocation, ppResolveLocation_id,
+                          ppResolveLocation_key),
+        PpIncludeXRefLocations_id,
+        PpIncludeXRefLocations(PpIncludeXRefLocations,
+                               ppIncludeXRefLocations_id, ppIncludeXRefLocations_key),
+        PpFileEntityXRefLocations_id,
+        PpFileEntityXRefLocations(PpFileEntityXRefLocations,
+                                  ppFileEntityXRefLocations_id, ppFileEntityXRefLocations_key),
+        PpEntityUses_id,
+        PpEntityUses(PpEntityUses, ppEntityUses_id, ppEntityUses_key),
+        PpEntityTraceXRefLocations_id,
+        PpEntityTraceXRefLocations(PpEntityTraceXRefLocations,
+                                   ppEntityTraceXRefLocations_id, ppEntityTraceXRefLocations_key),
+        PpEntityKind_id,
+        PpEntityKind(PpEntityKind, ppEntityKind_id, ppEntityKind_key),
+        PpEntityInfo_id,
+        PpEntityInfo(PpEntityInfo, ppEntityInfo_id, ppEntityInfo_key),
+        PPEntityLocation_id,
+        PPEntityLocation(PPEntityLocation, pPEntityLocation_id,
+                         pPEntityLocation_key),
+        PpResolveTraceLocation_key(PpResolveTraceLocation_key,
+                                   ppResolveTraceLocation_key_trace,
+                                   ppResolveTraceLocation_key_location,
+                                   ppResolveTraceLocation_key_entity),
+        PpResolveLocation_key(PpResolveLocation_key,
+                              ppResolveLocation_key_location, ppResolveLocation_key_entity),
+        PpIncludeXRefLocations_key(PpIncludeXRefLocations_key,
+                                   ppIncludeXRefLocations_key_trace,
+                                   ppIncludeXRefLocations_key_range,
+                                   ppIncludeXRefLocations_key_target),
+        PpFileEntityXRefLocations_key(PpFileEntityXRefLocations_key,
+                                      ppFileEntityXRefLocations_key_file,
+                                      ppFileEntityXRefLocations_key_xref,
+                                      ppFileEntityXRefLocations_key_entity),
+        PpEntityUses_key(PpEntityUses_key, ppEntityUses_key_entity,
+                         ppEntityUses_key_file, ppEntityUses_key_span),
+        PpEntityTraceXRefLocations_key(PpEntityTraceXRefLocations_key,
+                                       ppEntityTraceXRefLocations_key_trace,
+                                       ppEntityTraceXRefLocations_key_xref,
+                                       ppEntityTraceXRefLocations_key_entity),
+        PpEntityKind_key(PpEntityKind_key, ppEntityKind_key_entity,
+                         ppEntityKind_key_kind),
+        PpEntityInfo_key(PpEntityInfo_key, ppEntityInfo_key_entity,
+                         ppEntityInfo_key_info),
+        PPEntityLocation_key(PPEntityLocation_key,
+                             pPEntityLocation_key_entity, pPEntityLocation_key_location))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodePp.Types as Glean.Schema.CodePp
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Schema.CodePp.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 131 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("PpEntityTraceXRefLocations", 3), ("PPEntityLocation", 3),
+       ("PpIncludeXRefLocations", 3), ("PpEntityKind", 3),
+       ("PpEntityInfo", 3), ("PpEntityUses", 3),
+       ("PpFileEntityXRefLocations", 3), ("PpResolveLocation", 3),
+       ("PpResolveTraceLocation", 3)]
+
+type PpResolveTraceLocation_id = Glean.Id
+
+data PpResolveTraceLocation = PpResolveTraceLocation{ppResolveTraceLocation_id
+                                                     :: {-# UNPACK #-} !PpResolveTraceLocation_id,
+                                                     ppResolveTraceLocation_key ::
+                                                     Prelude.Maybe PpResolveTraceLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpResolveTraceLocation where
+  toJSON (PpResolveTraceLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpResolveTraceLocation where
+  buildStruct _proxy
+    (PpResolveTraceLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PpResolveTraceLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpResolveTraceLocation where
+  rnf (PpResolveTraceLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpResolveTraceLocation where
+  def = PpResolveTraceLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpResolveTraceLocation where
+  hashWithSalt __salt (PpResolveTraceLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpResolveLocation_id = Glean.Id
+
+data PpResolveLocation = PpResolveLocation{ppResolveLocation_id ::
+                                           {-# UNPACK #-} !PpResolveLocation_id,
+                                           ppResolveLocation_key ::
+                                           Prelude.Maybe PpResolveLocation_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpResolveLocation where
+  toJSON (PpResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpResolveLocation where
+  buildStruct _proxy (PpResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PpResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpResolveLocation where
+  rnf (PpResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpResolveLocation where
+  def = PpResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpResolveLocation where
+  hashWithSalt __salt (PpResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpIncludeXRefLocations_id = Glean.Id
+
+data PpIncludeXRefLocations = PpIncludeXRefLocations{ppIncludeXRefLocations_id
+                                                     :: {-# UNPACK #-} !PpIncludeXRefLocations_id,
+                                                     ppIncludeXRefLocations_key ::
+                                                     Prelude.Maybe PpIncludeXRefLocations_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpIncludeXRefLocations where
+  toJSON (PpIncludeXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpIncludeXRefLocations where
+  buildStruct _proxy
+    (PpIncludeXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PpIncludeXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpIncludeXRefLocations where
+  rnf (PpIncludeXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpIncludeXRefLocations where
+  def = PpIncludeXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpIncludeXRefLocations where
+  hashWithSalt __salt (PpIncludeXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpFileEntityXRefLocations_id = Glean.Id
+
+data PpFileEntityXRefLocations = PpFileEntityXRefLocations{ppFileEntityXRefLocations_id
+                                                           ::
+                                                           {-# UNPACK #-} !PpFileEntityXRefLocations_id,
+                                                           ppFileEntityXRefLocations_key ::
+                                                           Prelude.Maybe
+                                                             PpFileEntityXRefLocations_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpFileEntityXRefLocations where
+  toJSON (PpFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpFileEntityXRefLocations where
+  buildStruct _proxy
+    (PpFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PpFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpFileEntityXRefLocations where
+  rnf (PpFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpFileEntityXRefLocations where
+  def = PpFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpFileEntityXRefLocations where
+  hashWithSalt __salt (PpFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpEntityUses_id = Glean.Id
+
+data PpEntityUses = PpEntityUses{ppEntityUses_id ::
+                                 {-# UNPACK #-} !PpEntityUses_id,
+                                 ppEntityUses_key :: Prelude.Maybe PpEntityUses_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityUses where
+  toJSON (PpEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityUses where
+  buildStruct _proxy (PpEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PpEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityUses where
+  rnf (PpEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpEntityUses where
+  def = PpEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpEntityUses where
+  hashWithSalt __salt (PpEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpEntityTraceXRefLocations_id = Glean.Id
+
+data PpEntityTraceXRefLocations = PpEntityTraceXRefLocations{ppEntityTraceXRefLocations_id
+                                                             ::
+                                                             {-# UNPACK #-} !PpEntityTraceXRefLocations_id,
+                                                             ppEntityTraceXRefLocations_key ::
+                                                             Prelude.Maybe
+                                                               PpEntityTraceXRefLocations_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityTraceXRefLocations where
+  toJSON (PpEntityTraceXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityTraceXRefLocations where
+  buildStruct _proxy
+    (PpEntityTraceXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PpEntityTraceXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityTraceXRefLocations where
+  rnf (PpEntityTraceXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpEntityTraceXRefLocations where
+  def = PpEntityTraceXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpEntityTraceXRefLocations where
+  hashWithSalt __salt (PpEntityTraceXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpEntityKind_id = Glean.Id
+
+data PpEntityKind = PpEntityKind{ppEntityKind_id ::
+                                 {-# UNPACK #-} !PpEntityKind_id,
+                                 ppEntityKind_key :: Prelude.Maybe PpEntityKind_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityKind where
+  toJSON (PpEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityKind where
+  buildStruct _proxy (PpEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PpEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityKind where
+  rnf (PpEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpEntityKind where
+  def = PpEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpEntityKind where
+  hashWithSalt __salt (PpEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpEntityInfo_id = Glean.Id
+
+data PpEntityInfo = PpEntityInfo{ppEntityInfo_id ::
+                                 {-# UNPACK #-} !PpEntityInfo_id,
+                                 ppEntityInfo_key :: Prelude.Maybe PpEntityInfo_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityInfo where
+  toJSON (PpEntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityInfo where
+  buildStruct _proxy (PpEntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PpEntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityInfo where
+  rnf (PpEntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpEntityInfo where
+  def = PpEntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpEntityInfo where
+  hashWithSalt __salt (PpEntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PPEntityLocation_id = Glean.Id
+
+data PPEntityLocation = PPEntityLocation{pPEntityLocation_id ::
+                                         {-# UNPACK #-} !PPEntityLocation_id,
+                                         pPEntityLocation_key :: Prelude.Maybe PPEntityLocation_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPEntityLocation where
+  toJSON (PPEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PPEntityLocation where
+  buildStruct _proxy (PPEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PPEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PPEntityLocation where
+  rnf (PPEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PPEntityLocation where
+  def = PPEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PPEntityLocation where
+  hashWithSalt __salt (PPEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data PpResolveTraceLocation_key = PpResolveTraceLocation_key{ppResolveTraceLocation_key_trace
+                                                             :: Glean.Schema.Cxx1.Trace,
+                                                             ppResolveTraceLocation_key_location ::
+                                                             Glean.Schema.CodemarkupTypes.Location,
+                                                             ppResolveTraceLocation_key_entity ::
+                                                             Glean.Schema.CodePp.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpResolveTraceLocation_key where
+  toJSON
+    (PpResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "location" .= __field__location :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpResolveTraceLocation_key where
+  buildStruct _proxy
+    (PpResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpResolveTraceLocation_key __val__trace
+                                                  __val__location
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("location", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpResolveTraceLocation_key where
+  rnf
+    (PpResolveTraceLocation_key __field__trace __field__location
+       __field__entity)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpResolveTraceLocation_key where
+  def
+    = PpResolveTraceLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PpResolveTraceLocation_key where
+  hashWithSalt __salt
+    (PpResolveTraceLocation_key _trace _location _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+           _location)
+        _entity
+
+data PpResolveLocation_key = PpResolveLocation_key{ppResolveLocation_key_location
+                                                   :: Glean.Schema.CodemarkupTypes.Location,
+                                                   ppResolveLocation_key_entity ::
+                                                   Glean.Schema.CodePp.Entity}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpResolveLocation_key where
+  toJSON (PpResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpResolveLocation_key where
+  buildStruct _proxy
+    (PpResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpResolveLocation_key __val__location __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpResolveLocation_key where
+  rnf (PpResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpResolveLocation_key where
+  def = PpResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable PpResolveLocation_key where
+  hashWithSalt __salt (PpResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data PpIncludeXRefLocations_key = PpIncludeXRefLocations_key{ppIncludeXRefLocations_key_trace
+                                                             :: Glean.Schema.Cxx1.PPTrace,
+                                                             ppIncludeXRefLocations_key_range ::
+                                                             Glean.Schema.Src.Range,
+                                                             ppIncludeXRefLocations_key_target ::
+                                                             Glean.Schema.Src.File}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpIncludeXRefLocations_key where
+  toJSON
+    (PpIncludeXRefLocations_key __field__trace __field__range
+       __field__target)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "range" .= __field__range :
+             "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpIncludeXRefLocations_key where
+  buildStruct _proxy
+    (PpIncludeXRefLocations_key __field__trace __field__range
+       __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (PpIncludeXRefLocations_key __val__trace __val__range
+                                                  __val__target)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("range", 2), ("target", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpIncludeXRefLocations_key where
+  rnf
+    (PpIncludeXRefLocations_key __field__trace __field__range
+       __field__target)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default PpIncludeXRefLocations_key where
+  def
+    = PpIncludeXRefLocations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PpIncludeXRefLocations_key where
+  hashWithSalt __salt
+    (PpIncludeXRefLocations_key _trace _range _target)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+           _range)
+        _target
+
+data PpFileEntityXRefLocations_key = PpFileEntityXRefLocations_key{ppFileEntityXRefLocations_key_file
+                                                                   :: Glean.Schema.Src.File,
+                                                                   ppFileEntityXRefLocations_key_xref
+                                                                   ::
+                                                                   Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                   ppFileEntityXRefLocations_key_entity
+                                                                   :: Glean.Schema.CodePp.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpFileEntityXRefLocations_key where
+  toJSON
+    (PpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (PpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpFileEntityXRefLocations_key where
+  rnf
+    (PpFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpFileEntityXRefLocations_key where
+  def
+    = PpFileEntityXRefLocations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PpFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (PpFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data PpEntityUses_key = PpEntityUses_key{ppEntityUses_key_entity ::
+                                         Glean.Schema.CodePp.Entity,
+                                         ppEntityUses_key_file :: Glean.Schema.Src.File,
+                                         ppEntityUses_key_span :: Glean.Schema.Src.ByteSpan}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityUses_key where
+  toJSON
+    (PpEntityUses_key __field__entity __field__file __field__span)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityUses_key where
+  buildStruct _proxy
+    (PpEntityUses_key __field__entity __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (PpEntityUses_key __val__entity __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("entity", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityUses_key where
+  rnf (PpEntityUses_key __field__entity __field__file __field__span)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default PpEntityUses_key where
+  def = PpEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PpEntityUses_key where
+  hashWithSalt __salt (PpEntityUses_key _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _file)
+        _span
+
+data PpEntityTraceXRefLocations_key = PpEntityTraceXRefLocations_key{ppEntityTraceXRefLocations_key_trace
+                                                                     :: Glean.Schema.Cxx1.Trace,
+                                                                     ppEntityTraceXRefLocations_key_xref
+                                                                     ::
+                                                                     Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                     ppEntityTraceXRefLocations_key_entity
+                                                                     :: Glean.Schema.CodePp.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityTraceXRefLocations_key where
+  toJSON
+    (PpEntityTraceXRefLocations_key __field__trace __field__xref
+       __field__entity)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityTraceXRefLocations_key where
+  buildStruct _proxy
+    (PpEntityTraceXRefLocations_key __field__trace __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpEntityTraceXRefLocations_key __val__trace
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("trace", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityTraceXRefLocations_key where
+  rnf
+    (PpEntityTraceXRefLocations_key __field__trace __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpEntityTraceXRefLocations_key where
+  def
+    = PpEntityTraceXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable PpEntityTraceXRefLocations_key where
+  hashWithSalt __salt
+    (PpEntityTraceXRefLocations_key _trace _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace) _xref)
+        _entity
+
+data PpEntityKind_key = PpEntityKind_key{ppEntityKind_key_entity ::
+                                         Glean.Schema.CodePp.Entity,
+                                         ppEntityKind_key_kind ::
+                                         Glean.Schema.CodemarkupTypes.SymbolKind}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityKind_key where
+  toJSON (PpEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityKind_key where
+  buildStruct _proxy (PpEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (PpEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityKind_key where
+  rnf (PpEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default PpEntityKind_key where
+  def = PpEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable PpEntityKind_key where
+  hashWithSalt __salt (PpEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data PpEntityInfo_key = PpEntityInfo_key{ppEntityInfo_key_entity ::
+                                         Glean.Schema.CodePp.Entity,
+                                         ppEntityInfo_key_info ::
+                                         Glean.Schema.CodemarkupTypes.SymbolInfo}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntityInfo_key where
+  toJSON (PpEntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct PpEntityInfo_key where
+  buildStruct _proxy (PpEntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (PpEntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpEntityInfo_key where
+  rnf (PpEntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default PpEntityInfo_key where
+  def = PpEntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable PpEntityInfo_key where
+  hashWithSalt __salt (PpEntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data PPEntityLocation_key = PPEntityLocation_key{pPEntityLocation_key_entity
+                                                 :: Glean.Schema.CodePp.Entity,
+                                                 pPEntityLocation_key_location ::
+                                                 Glean.Schema.CodemarkupTypes.Location}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPEntityLocation_key where
+  toJSON (PPEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct PPEntityLocation_key where
+  buildStruct _proxy
+    (PPEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (PPEntityLocation_key __val__entity __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PPEntityLocation_key where
+  rnf (PPEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default PPEntityLocation_key where
+  def = PPEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable PPEntityLocation_key where
+  hashWithSalt __salt (PPEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+{-# LINE 21 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpEntityTraceXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 32 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations_key
+     =
+     'Angle.TField "trace" (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 34 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations
+       = Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PpEntityTraceXRefLocations" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPp.Types.ppEntityTraceXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupPp.Types.ppEntityTraceXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 44 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpEntityTraceXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 50 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PPEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PPEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PPEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PPEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 59 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PPEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 61 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PPEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PPEntityLocation =
+       Glean.Schema.CodemarkupPp.Types.PPEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PPEntityLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPp.Types.pPEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PPEntityLocation x k
+  getFactKey = Glean.Schema.CodemarkupPp.Types.pPEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 70 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PPEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 76 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpIncludeXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 87 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations_key
+     =
+     'Angle.TField "trace"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.PPTrace)
+       ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "target" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
+{-# LINE 89 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations
+       = Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PpIncludeXRefLocations" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPp.Types.ppIncludeXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupPp.Types.ppIncludeXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 98 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpIncludeXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 104 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpEntityKind_key" (Prelude.Just 0))
+{-# LINE 113 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupPp.Types.PpEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 115 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpEntityKind =
+       Glean.Schema.CodemarkupPp.Types.PpEntityKind_key
+  getName _proxy = Glean.PredicateRef "codemarkup.pp.PpEntityKind" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPp.Types.ppEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpEntityKind x k
+  getFactKey = Glean.Schema.CodemarkupPp.Types.ppEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 124 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupPp.Types.PpEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 130 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpEntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpEntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpEntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpEntityInfo_key" (Prelude.Just 0))
+{-# LINE 139 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupPp.Types.PpEntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 141 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpEntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpEntityInfo =
+       Glean.Schema.CodemarkupPp.Types.PpEntityInfo_key
+  getName _proxy = Glean.PredicateRef "codemarkup.pp.PpEntityInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPp.Types.ppEntityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpEntityInfo x k
+  getFactKey = Glean.Schema.CodemarkupPp.Types.ppEntityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 150 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupPp.Types.PpEntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 156 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpEntityUses_key" (Prelude.Just 0))
+{-# LINE 167 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupPp.Types.PpEntityUses_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 169 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpEntityUses =
+       Glean.Schema.CodemarkupPp.Types.PpEntityUses_key
+  getName _proxy = Glean.PredicateRef "codemarkup.pp.PpEntityUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPp.Types.ppEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupPp.Types.ppEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 178 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupPp.Types.PpEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 184 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 195 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 197 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations
+       = Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PpFileEntityXRefLocations" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPp.Types.ppFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupPp.Types.ppFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 207 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 213 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 222 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PpResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 224 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpResolveLocation =
+       Glean.Schema.CodemarkupPp.Types.PpResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PpResolveLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPp.Types.ppResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpResolveLocation x k
+  getFactKey = Glean.Schema.CodemarkupPp.Types.ppResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 233 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 239 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.pp.PpResolveTraceLocation_key"
+           (Prelude.Just 0))
+{-# LINE 250 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation_key
+     =
+     'Angle.TField "trace" (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TField "entity" (Glean.Schema.CodePp.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 252 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation
+         where
+  type KeyType Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation
+       = Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.pp.PpResolveTraceLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPp.Types.ppResolveTraceLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupPp.Types.ppResolveTraceLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 261 "glean/schema/thrift/codemarkup_pp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPp.Types.PpResolveTraceLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPython/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPython/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPython/Types.hs
@@ -0,0 +1,4862 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPython/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupPython.Types
+       (pREDICATE_VERSIONS, PythonVisibility_id,
+        PythonVisibility(PythonVisibility, pythonVisibility_id,
+                         pythonVisibility_key),
+        PythonResolveLocation_id,
+        PythonResolveLocation(PythonResolveLocation,
+                              pythonResolveLocation_id, pythonResolveLocation_key),
+        PythonModifiers_id,
+        PythonModifiers(PythonModifiers, pythonModifiers_id,
+                        pythonModifiers_key),
+        PythonFileEntityXRefLocations_id,
+        PythonFileEntityXRefLocations(PythonFileEntityXRefLocations,
+                                      pythonFileEntityXRefLocations_id,
+                                      pythonFileEntityXRefLocations_key),
+        PythonFileCall_id,
+        PythonFileCall(PythonFileCall, pythonFileCall_id,
+                       pythonFileCall_key),
+        PythonExtendsParentEntity_id,
+        PythonExtendsParentEntity(PythonExtendsParentEntity,
+                                  pythonExtendsParentEntity_id, pythonExtendsParentEntity_key),
+        PythonExtendsChildEntity_id,
+        PythonExtendsChildEntity(PythonExtendsChildEntity,
+                                 pythonExtendsChildEntity_id, pythonExtendsChildEntity_key),
+        PythonEntityUses_id,
+        PythonEntityUses(PythonEntityUses, pythonEntityUses_id,
+                         pythonEntityUses_key),
+        PythonEntityModuleName_id,
+        PythonEntityModuleName(PythonEntityModuleName,
+                               pythonEntityModuleName_id, pythonEntityModuleName_key),
+        PythonEntityLocation_id,
+        PythonEntityLocation(PythonEntityLocation, pythonEntityLocation_id,
+                             pythonEntityLocation_key),
+        PythonEntityKind_id,
+        PythonEntityKind(PythonEntityKind, pythonEntityKind_id,
+                         pythonEntityKind_key),
+        PythonEntityInfo_id,
+        PythonEntityInfo(PythonEntityInfo, pythonEntityInfo_id,
+                         pythonEntityInfo_key),
+        PythonEntityComments_id,
+        PythonEntityComments(PythonEntityComments, pythonEntityComments_id,
+                             pythonEntityComments_key),
+        PythonContainsParentEntity_id,
+        PythonContainsParentEntity(PythonContainsParentEntity,
+                                   pythonContainsParentEntity_id, pythonContainsParentEntity_key),
+        PythonContainsChildEntity_id,
+        PythonContainsChildEntity(PythonContainsChildEntity,
+                                  pythonContainsChildEntity_id, pythonContainsChildEntity_key),
+        PythonAnnotation_id,
+        PythonAnnotation(PythonAnnotation, pythonAnnotation_id,
+                         pythonAnnotation_key),
+        NonImportPythonDeclarationKind_id,
+        NonImportPythonDeclarationKind(NonImportPythonDeclarationKind,
+                                       nonImportPythonDeclarationKind_id,
+                                       nonImportPythonDeclarationKind_key),
+        NonImportPythonDeclarationInfo_id,
+        NonImportPythonDeclarationInfo(NonImportPythonDeclarationInfo,
+                                       nonImportPythonDeclarationInfo_id,
+                                       nonImportPythonDeclarationInfo_key),
+        ConvertLabel_id,
+        ConvertLabel(ConvertLabel, convertLabel_id, convertLabel_key),
+        ConvertCallArguments_id,
+        ConvertCallArguments(ConvertCallArguments, convertCallArguments_id,
+                             convertCallArguments_key),
+        ConvertArgument_id,
+        ConvertArgument(ConvertArgument, convertArgument_id,
+                        convertArgument_key),
+        PythonVisibility_key(PythonVisibility_key,
+                             pythonVisibility_key_entity, pythonVisibility_key_visibility),
+        PythonResolveLocation_key(PythonResolveLocation_key,
+                                  pythonResolveLocation_key_location,
+                                  pythonResolveLocation_key_entity),
+        PythonModifiers_key(PythonModifiers_key,
+                            pythonModifiers_key_entity, pythonModifiers_key_modifiers),
+        PythonFileEntityXRefLocations_key(PythonFileEntityXRefLocations_key,
+                                          pythonFileEntityXRefLocations_key_file,
+                                          pythonFileEntityXRefLocations_key_xref,
+                                          pythonFileEntityXRefLocations_key_entity),
+        PythonFileCall_key(PythonFileCall_key, pythonFileCall_key_file,
+                           pythonFileCall_key_callee_span, pythonFileCall_key_call_args),
+        PythonExtendsParentEntity_key(PythonExtendsParentEntity_key,
+                                      pythonExtendsParentEntity_key_child,
+                                      pythonExtendsParentEntity_key_parent),
+        PythonExtendsChildEntity_key(PythonExtendsChildEntity_key,
+                                     pythonExtendsChildEntity_key_parent,
+                                     pythonExtendsChildEntity_key_child),
+        PythonEntityUses_key(PythonEntityUses_key,
+                             pythonEntityUses_key_target, pythonEntityUses_key_file,
+                             pythonEntityUses_key_span),
+        PythonEntityModuleName_key(PythonEntityModuleName_key,
+                                   pythonEntityModuleName_key_entity,
+                                   pythonEntityModuleName_key_name),
+        PythonEntityLocation_key(PythonEntityLocation_key,
+                                 pythonEntityLocation_key_entity,
+                                 pythonEntityLocation_key_location),
+        PythonEntityKind_key(PythonEntityKind_key,
+                             pythonEntityKind_key_entity, pythonEntityKind_key_kind),
+        PythonEntityInfo_key(PythonEntityInfo_key,
+                             pythonEntityInfo_key_entity, pythonEntityInfo_key_info),
+        PythonEntityComments_key(PythonEntityComments_key,
+                                 pythonEntityComments_key_entity, pythonEntityComments_key_file,
+                                 pythonEntityComments_key_span, pythonEntityComments_key_text),
+        PythonContainsParentEntity_key(PythonContainsParentEntity_key,
+                                       pythonContainsParentEntity_key_child,
+                                       pythonContainsParentEntity_key_parent),
+        PythonContainsChildEntity_key(PythonContainsChildEntity_key,
+                                      pythonContainsChildEntity_key_parent,
+                                      pythonContainsChildEntity_key_child),
+        PythonAnnotation_key(PythonAnnotation_key,
+                             pythonAnnotation_key_entity, pythonAnnotation_key_anns),
+        NonImportPythonDeclarationKind_key(NonImportPythonDeclarationKind_key,
+                                           nonImportPythonDeclarationKind_key_declaration,
+                                           nonImportPythonDeclarationKind_key_kind),
+        NonImportPythonDeclarationInfo_key(NonImportPythonDeclarationInfo_key,
+                                           nonImportPythonDeclarationInfo_key_declaration,
+                                           nonImportPythonDeclarationInfo_key_info),
+        ConvertLabel_key(ConvertLabel_key, convertLabel_key_python,
+                         convertLabel_key_code),
+        ConvertCallArguments_key(ConvertCallArguments_key,
+                                 convertCallArguments_key_pythonCallArguments,
+                                 convertCallArguments_key_codeCallArguments),
+        ConvertArgument_key(ConvertArgument_key,
+                            convertArgument_key_pythonArgument,
+                            convertArgument_key_codeArgument))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodePython.Types
+       as Glean.Schema.CodePython
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Python.Types as Glean.Schema.Python
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.CodePython.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.Python.Types
+{-# LINE 19 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 207 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupPython/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("PythonContainsParentEntity", 2), ("PythonEntityKind", 2),
+       ("NonImportPythonDeclarationKind", 2),
+       ("PythonExtendsChildEntity", 2), ("PythonModifiers", 2),
+       ("PythonResolveLocation", 2), ("ConvertLabel", 2),
+       ("PythonFileEntityXRefLocations", 2), ("ConvertArgument", 2),
+       ("PythonEntityLocation", 2), ("ConvertCallArguments", 2),
+       ("PythonEntityInfo", 2), ("PythonAnnotation", 2),
+       ("PythonContainsChildEntity", 2), ("PythonEntityComments", 2),
+       ("PythonFileCall", 2), ("PythonExtendsParentEntity", 2),
+       ("PythonVisibility", 2), ("PythonEntityModuleName", 2),
+       ("NonImportPythonDeclarationInfo", 2), ("PythonEntityUses", 2)]
+
+type PythonVisibility_id = Glean.Id
+
+data PythonVisibility = PythonVisibility{pythonVisibility_id ::
+                                         {-# UNPACK #-} !PythonVisibility_id,
+                                         pythonVisibility_key :: Prelude.Maybe PythonVisibility_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonVisibility where
+  toJSON (PythonVisibility __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonVisibility where
+  buildStruct _proxy (PythonVisibility __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonVisibility __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonVisibility where
+  rnf (PythonVisibility __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonVisibility where
+  def = PythonVisibility Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonVisibility where
+  hashWithSalt __salt (PythonVisibility _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonResolveLocation_id = Glean.Id
+
+data PythonResolveLocation = PythonResolveLocation{pythonResolveLocation_id
+                                                   :: {-# UNPACK #-} !PythonResolveLocation_id,
+                                                   pythonResolveLocation_key ::
+                                                   Prelude.Maybe PythonResolveLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonResolveLocation where
+  toJSON (PythonResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonResolveLocation where
+  buildStruct _proxy (PythonResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonResolveLocation where
+  rnf (PythonResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonResolveLocation where
+  def = PythonResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonResolveLocation where
+  hashWithSalt __salt (PythonResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonModifiers_id = Glean.Id
+
+data PythonModifiers = PythonModifiers{pythonModifiers_id ::
+                                       {-# UNPACK #-} !PythonModifiers_id,
+                                       pythonModifiers_key :: Prelude.Maybe PythonModifiers_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonModifiers where
+  toJSON (PythonModifiers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonModifiers where
+  buildStruct _proxy (PythonModifiers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonModifiers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonModifiers where
+  rnf (PythonModifiers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonModifiers where
+  def = PythonModifiers Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonModifiers where
+  hashWithSalt __salt (PythonModifiers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonFileEntityXRefLocations_id = Glean.Id
+
+data PythonFileEntityXRefLocations = PythonFileEntityXRefLocations{pythonFileEntityXRefLocations_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !PythonFileEntityXRefLocations_id,
+                                                                   pythonFileEntityXRefLocations_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     PythonFileEntityXRefLocations_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonFileEntityXRefLocations where
+  toJSON (PythonFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonFileEntityXRefLocations where
+  buildStruct _proxy
+    (PythonFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonFileEntityXRefLocations where
+  rnf (PythonFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonFileEntityXRefLocations where
+  def = PythonFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonFileEntityXRefLocations where
+  hashWithSalt __salt (PythonFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonFileCall_id = Glean.Id
+
+data PythonFileCall = PythonFileCall{pythonFileCall_id ::
+                                     {-# UNPACK #-} !PythonFileCall_id,
+                                     pythonFileCall_key :: Prelude.Maybe PythonFileCall_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonFileCall where
+  toJSON (PythonFileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonFileCall where
+  buildStruct _proxy (PythonFileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonFileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonFileCall where
+  rnf (PythonFileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonFileCall where
+  def = PythonFileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonFileCall where
+  hashWithSalt __salt (PythonFileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonExtendsParentEntity_id = Glean.Id
+
+data PythonExtendsParentEntity = PythonExtendsParentEntity{pythonExtendsParentEntity_id
+                                                           ::
+                                                           {-# UNPACK #-} !PythonExtendsParentEntity_id,
+                                                           pythonExtendsParentEntity_key ::
+                                                           Prelude.Maybe
+                                                             PythonExtendsParentEntity_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonExtendsParentEntity where
+  toJSON (PythonExtendsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonExtendsParentEntity where
+  buildStruct _proxy
+    (PythonExtendsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonExtendsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonExtendsParentEntity where
+  rnf (PythonExtendsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonExtendsParentEntity where
+  def = PythonExtendsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonExtendsParentEntity where
+  hashWithSalt __salt (PythonExtendsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonExtendsChildEntity_id = Glean.Id
+
+data PythonExtendsChildEntity = PythonExtendsChildEntity{pythonExtendsChildEntity_id
+                                                         ::
+                                                         {-# UNPACK #-} !PythonExtendsChildEntity_id,
+                                                         pythonExtendsChildEntity_key ::
+                                                         Prelude.Maybe PythonExtendsChildEntity_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonExtendsChildEntity where
+  toJSON (PythonExtendsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonExtendsChildEntity where
+  buildStruct _proxy
+    (PythonExtendsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonExtendsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonExtendsChildEntity where
+  rnf (PythonExtendsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonExtendsChildEntity where
+  def = PythonExtendsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonExtendsChildEntity where
+  hashWithSalt __salt (PythonExtendsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityUses_id = Glean.Id
+
+data PythonEntityUses = PythonEntityUses{pythonEntityUses_id ::
+                                         {-# UNPACK #-} !PythonEntityUses_id,
+                                         pythonEntityUses_key :: Prelude.Maybe PythonEntityUses_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityUses where
+  toJSON (PythonEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityUses where
+  buildStruct _proxy (PythonEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityUses where
+  rnf (PythonEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityUses where
+  def = PythonEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityUses where
+  hashWithSalt __salt (PythonEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityModuleName_id = Glean.Id
+
+data PythonEntityModuleName = PythonEntityModuleName{pythonEntityModuleName_id
+                                                     :: {-# UNPACK #-} !PythonEntityModuleName_id,
+                                                     pythonEntityModuleName_key ::
+                                                     Prelude.Maybe PythonEntityModuleName_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityModuleName where
+  toJSON (PythonEntityModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityModuleName where
+  buildStruct _proxy
+    (PythonEntityModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonEntityModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityModuleName where
+  rnf (PythonEntityModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityModuleName where
+  def = PythonEntityModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityModuleName where
+  hashWithSalt __salt (PythonEntityModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityLocation_id = Glean.Id
+
+data PythonEntityLocation = PythonEntityLocation{pythonEntityLocation_id
+                                                 :: {-# UNPACK #-} !PythonEntityLocation_id,
+                                                 pythonEntityLocation_key ::
+                                                 Prelude.Maybe PythonEntityLocation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityLocation where
+  toJSON (PythonEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityLocation where
+  buildStruct _proxy (PythonEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityLocation where
+  rnf (PythonEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityLocation where
+  def = PythonEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityLocation where
+  hashWithSalt __salt (PythonEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityKind_id = Glean.Id
+
+data PythonEntityKind = PythonEntityKind{pythonEntityKind_id ::
+                                         {-# UNPACK #-} !PythonEntityKind_id,
+                                         pythonEntityKind_key :: Prelude.Maybe PythonEntityKind_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityKind where
+  toJSON (PythonEntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityKind where
+  buildStruct _proxy (PythonEntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonEntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityKind where
+  rnf (PythonEntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityKind where
+  def = PythonEntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityKind where
+  hashWithSalt __salt (PythonEntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityInfo_id = Glean.Id
+
+data PythonEntityInfo = PythonEntityInfo{pythonEntityInfo_id ::
+                                         {-# UNPACK #-} !PythonEntityInfo_id,
+                                         pythonEntityInfo_key :: Prelude.Maybe PythonEntityInfo_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityInfo where
+  toJSON (PythonEntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityInfo where
+  buildStruct _proxy (PythonEntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonEntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityInfo where
+  rnf (PythonEntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityInfo where
+  def = PythonEntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityInfo where
+  hashWithSalt __salt (PythonEntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonEntityComments_id = Glean.Id
+
+data PythonEntityComments = PythonEntityComments{pythonEntityComments_id
+                                                 :: {-# UNPACK #-} !PythonEntityComments_id,
+                                                 pythonEntityComments_key ::
+                                                 Prelude.Maybe PythonEntityComments_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityComments where
+  toJSON (PythonEntityComments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityComments where
+  buildStruct _proxy (PythonEntityComments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonEntityComments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityComments where
+  rnf (PythonEntityComments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonEntityComments where
+  def = PythonEntityComments Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityComments where
+  hashWithSalt __salt (PythonEntityComments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonContainsParentEntity_id = Glean.Id
+
+data PythonContainsParentEntity = PythonContainsParentEntity{pythonContainsParentEntity_id
+                                                             ::
+                                                             {-# UNPACK #-} !PythonContainsParentEntity_id,
+                                                             pythonContainsParentEntity_key ::
+                                                             Prelude.Maybe
+                                                               PythonContainsParentEntity_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonContainsParentEntity where
+  toJSON (PythonContainsParentEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonContainsParentEntity where
+  buildStruct _proxy
+    (PythonContainsParentEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonContainsParentEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonContainsParentEntity where
+  rnf (PythonContainsParentEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonContainsParentEntity where
+  def = PythonContainsParentEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonContainsParentEntity where
+  hashWithSalt __salt (PythonContainsParentEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonContainsChildEntity_id = Glean.Id
+
+data PythonContainsChildEntity = PythonContainsChildEntity{pythonContainsChildEntity_id
+                                                           ::
+                                                           {-# UNPACK #-} !PythonContainsChildEntity_id,
+                                                           pythonContainsChildEntity_key ::
+                                                           Prelude.Maybe
+                                                             PythonContainsChildEntity_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonContainsChildEntity where
+  toJSON (PythonContainsChildEntity __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonContainsChildEntity where
+  buildStruct _proxy
+    (PythonContainsChildEntity __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonContainsChildEntity __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonContainsChildEntity where
+  rnf (PythonContainsChildEntity __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonContainsChildEntity where
+  def = PythonContainsChildEntity Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonContainsChildEntity where
+  hashWithSalt __salt (PythonContainsChildEntity _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonAnnotation_id = Glean.Id
+
+data PythonAnnotation = PythonAnnotation{pythonAnnotation_id ::
+                                         {-# UNPACK #-} !PythonAnnotation_id,
+                                         pythonAnnotation_key :: Prelude.Maybe PythonAnnotation_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonAnnotation where
+  toJSON (PythonAnnotation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonAnnotation where
+  buildStruct _proxy (PythonAnnotation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonAnnotation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonAnnotation where
+  rnf (PythonAnnotation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonAnnotation where
+  def = PythonAnnotation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonAnnotation where
+  hashWithSalt __salt (PythonAnnotation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NonImportPythonDeclarationKind_id = Glean.Id
+
+data NonImportPythonDeclarationKind = NonImportPythonDeclarationKind{nonImportPythonDeclarationKind_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !NonImportPythonDeclarationKind_id,
+                                                                     nonImportPythonDeclarationKind_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       NonImportPythonDeclarationKind_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NonImportPythonDeclarationKind where
+  toJSON (NonImportPythonDeclarationKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NonImportPythonDeclarationKind where
+  buildStruct _proxy
+    (NonImportPythonDeclarationKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NonImportPythonDeclarationKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NonImportPythonDeclarationKind where
+  rnf (NonImportPythonDeclarationKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NonImportPythonDeclarationKind where
+  def = NonImportPythonDeclarationKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable NonImportPythonDeclarationKind where
+  hashWithSalt __salt (NonImportPythonDeclarationKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NonImportPythonDeclarationInfo_id = Glean.Id
+
+data NonImportPythonDeclarationInfo = NonImportPythonDeclarationInfo{nonImportPythonDeclarationInfo_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !NonImportPythonDeclarationInfo_id,
+                                                                     nonImportPythonDeclarationInfo_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       NonImportPythonDeclarationInfo_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NonImportPythonDeclarationInfo where
+  toJSON (NonImportPythonDeclarationInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NonImportPythonDeclarationInfo where
+  buildStruct _proxy
+    (NonImportPythonDeclarationInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NonImportPythonDeclarationInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NonImportPythonDeclarationInfo where
+  rnf (NonImportPythonDeclarationInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NonImportPythonDeclarationInfo where
+  def = NonImportPythonDeclarationInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable NonImportPythonDeclarationInfo where
+  hashWithSalt __salt (NonImportPythonDeclarationInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertLabel_id = Glean.Id
+
+data ConvertLabel = ConvertLabel{convertLabel_id ::
+                                 {-# UNPACK #-} !ConvertLabel_id,
+                                 convertLabel_key :: Prelude.Maybe ConvertLabel_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertLabel where
+  toJSON (ConvertLabel __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertLabel where
+  buildStruct _proxy (ConvertLabel __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConvertLabel __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertLabel where
+  rnf (ConvertLabel __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertLabel where
+  def = ConvertLabel Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertLabel where
+  hashWithSalt __salt (ConvertLabel _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertCallArguments_id = Glean.Id
+
+data ConvertCallArguments = ConvertCallArguments{convertCallArguments_id
+                                                 :: {-# UNPACK #-} !ConvertCallArguments_id,
+                                                 convertCallArguments_key ::
+                                                 Prelude.Maybe ConvertCallArguments_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallArguments where
+  toJSON (ConvertCallArguments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCallArguments where
+  buildStruct _proxy (ConvertCallArguments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ConvertCallArguments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallArguments where
+  rnf (ConvertCallArguments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertCallArguments where
+  def = ConvertCallArguments Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertCallArguments where
+  hashWithSalt __salt (ConvertCallArguments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConvertArgument_id = Glean.Id
+
+data ConvertArgument = ConvertArgument{convertArgument_id ::
+                                       {-# UNPACK #-} !ConvertArgument_id,
+                                       convertArgument_key :: Prelude.Maybe ConvertArgument_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertArgument where
+  toJSON (ConvertArgument __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertArgument where
+  buildStruct _proxy (ConvertArgument __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConvertArgument __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertArgument where
+  rnf (ConvertArgument __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConvertArgument where
+  def = ConvertArgument Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConvertArgument where
+  hashWithSalt __salt (ConvertArgument _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data PythonVisibility_key = PythonVisibility_key{pythonVisibility_key_entity
+                                                 :: Glean.Schema.CodePython.Entity,
+                                                 pythonVisibility_key_visibility ::
+                                                 Glean.Schema.CodemarkupTypes.Visibility}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonVisibility_key where
+  toJSON (PythonVisibility_key __field__entity __field__visibility)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "visibility" .= __field__visibility : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonVisibility_key where
+  buildStruct _proxy
+    (PythonVisibility_key __field__entity __field__visibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__visibility)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             Prelude.pure
+                                               (PythonVisibility_key __val__entity
+                                                  __val__visibility)
+              _idMap = HashMap.fromList [("entity", 1), ("visibility", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonVisibility_key where
+  rnf (PythonVisibility_key __field__entity __field__visibility)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__visibility `Prelude.seq` ()
+
+instance Default.Default PythonVisibility_key where
+  def = PythonVisibility_key Default.def Default.def
+
+instance Hashable.Hashable PythonVisibility_key where
+  hashWithSalt __salt (PythonVisibility_key _entity _visibility)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _visibility
+
+data PythonResolveLocation_key = PythonResolveLocation_key{pythonResolveLocation_key_location
+                                                           :: Glean.Schema.CodemarkupTypes.Location,
+                                                           pythonResolveLocation_key_entity ::
+                                                           Glean.Schema.CodePython.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonResolveLocation_key where
+  toJSON
+    (PythonResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonResolveLocation_key where
+  buildStruct _proxy
+    (PythonResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonResolveLocation_key where
+  rnf (PythonResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PythonResolveLocation_key where
+  def = PythonResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable PythonResolveLocation_key where
+  hashWithSalt __salt (PythonResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data PythonModifiers_key = PythonModifiers_key{pythonModifiers_key_entity
+                                               :: Glean.Schema.CodePython.Entity,
+                                               pythonModifiers_key_modifiers ::
+                                               Glean.Schema.CodemarkupTypes.Modifiers}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonModifiers_key where
+  toJSON (PythonModifiers_key __field__entity __field__modifiers)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "modifiers" .= __field__modifiers : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonModifiers_key where
+  buildStruct _proxy
+    (PythonModifiers_key __field__entity __field__modifiers)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "modifiers" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__modifiers)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             Prelude.pure
+                                               (PythonModifiers_key __val__entity __val__modifiers)
+              _idMap = HashMap.fromList [("entity", 1), ("modifiers", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonModifiers_key where
+  rnf (PythonModifiers_key __field__entity __field__modifiers)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__modifiers `Prelude.seq` ()
+
+instance Default.Default PythonModifiers_key where
+  def = PythonModifiers_key Default.def Default.def
+
+instance Hashable.Hashable PythonModifiers_key where
+  hashWithSalt __salt (PythonModifiers_key _entity _modifiers)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _modifiers
+
+data PythonFileEntityXRefLocations_key = PythonFileEntityXRefLocations_key{pythonFileEntityXRefLocations_key_file
+                                                                           :: Glean.Schema.Src.File,
+                                                                           pythonFileEntityXRefLocations_key_xref
+                                                                           ::
+                                                                           Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                           pythonFileEntityXRefLocations_key_entity
+                                                                           ::
+                                                                           Glean.Schema.CodePython.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonFileEntityXRefLocations_key where
+  toJSON
+    (PythonFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonFileEntityXRefLocations_key
+         where
+  buildStruct _proxy
+    (PythonFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonFileEntityXRefLocations_key where
+  rnf
+    (PythonFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PythonFileEntityXRefLocations_key where
+  def
+    = PythonFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable PythonFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (PythonFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data PythonFileCall_key = PythonFileCall_key{pythonFileCall_key_file
+                                             :: Glean.Schema.Src.File,
+                                             pythonFileCall_key_callee_span ::
+                                             Glean.Schema.Src.ByteSpan,
+                                             pythonFileCall_key_call_args ::
+                                             [Glean.Schema.Code.CallArgument]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonFileCall_key where
+  toJSON
+    (PythonFileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = Aeson.object
+        ("file" .= __field__file :
+           "callee_span" .= __field__callee_span :
+             "call_args" .= __field__call_args : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonFileCall_key where
+  buildStruct _proxy
+    (PythonFileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "callee_span" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__callee_span)
+             :
+             Thrift.genField _proxy "call_args" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__call_args)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__callee_span <- ST.newSTRef Default.def
+            __field__call_args <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__call_args
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__callee_span <- ST.readSTRef
+                                                                      __field__callee_span
+                                             !__val__call_args <- ST.readSTRef __field__call_args
+                                             Prelude.pure
+                                               (PythonFileCall_key __val__file __val__callee_span
+                                                  __val__call_args)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("callee_span", 2), ("call_args", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonFileCall_key where
+  rnf
+    (PythonFileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__callee_span `Prelude.seq`
+          DeepSeq.rnf __field__call_args `Prelude.seq` ()
+
+instance Default.Default PythonFileCall_key where
+  def = PythonFileCall_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PythonFileCall_key where
+  hashWithSalt __salt
+    (PythonFileCall_key _file _callee_span _call_args)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _callee_span)
+        _call_args
+
+data PythonExtendsParentEntity_key = PythonExtendsParentEntity_key{pythonExtendsParentEntity_key_child
+                                                                   ::
+                                                                   Glean.Schema.CodePython.Entity,
+                                                                   pythonExtendsParentEntity_key_parent
+                                                                   ::
+                                                                   Glean.Schema.CodePython.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonExtendsParentEntity_key where
+  toJSON
+    (PythonExtendsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonExtendsParentEntity_key where
+  buildStruct _proxy
+    (PythonExtendsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (PythonExtendsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonExtendsParentEntity_key where
+  rnf (PythonExtendsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default PythonExtendsParentEntity_key where
+  def = PythonExtendsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable PythonExtendsParentEntity_key where
+  hashWithSalt __salt (PythonExtendsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data PythonExtendsChildEntity_key = PythonExtendsChildEntity_key{pythonExtendsChildEntity_key_parent
+                                                                 :: Glean.Schema.CodePython.Entity,
+                                                                 pythonExtendsChildEntity_key_child
+                                                                 :: Glean.Schema.CodePython.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonExtendsChildEntity_key where
+  toJSON
+    (PythonExtendsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonExtendsChildEntity_key where
+  buildStruct _proxy
+    (PythonExtendsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (PythonExtendsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonExtendsChildEntity_key where
+  rnf (PythonExtendsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default PythonExtendsChildEntity_key where
+  def = PythonExtendsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable PythonExtendsChildEntity_key where
+  hashWithSalt __salt (PythonExtendsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data PythonEntityUses_key = PythonEntityUses_key{pythonEntityUses_key_target
+                                                 :: Glean.Schema.CodePython.Entity,
+                                                 pythonEntityUses_key_file :: Glean.Schema.Src.File,
+                                                 pythonEntityUses_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityUses_key where
+  toJSON
+    (PythonEntityUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityUses_key where
+  buildStruct _proxy
+    (PythonEntityUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (PythonEntityUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityUses_key where
+  rnf
+    (PythonEntityUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default PythonEntityUses_key where
+  def = PythonEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable PythonEntityUses_key where
+  hashWithSalt __salt (PythonEntityUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data PythonEntityModuleName_key = PythonEntityModuleName_key{pythonEntityModuleName_key_entity
+                                                             :: Glean.Schema.CodePython.Entity,
+                                                             pythonEntityModuleName_key_name ::
+                                                             Text.Text}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityModuleName_key where
+  toJSON (PythonEntityModuleName_key __field__entity __field__name)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityModuleName_key where
+  buildStruct _proxy
+    (PythonEntityModuleName_key __field__entity __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (PythonEntityModuleName_key __val__entity
+                                                  __val__name)
+              _idMap = HashMap.fromList [("entity", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityModuleName_key where
+  rnf (PythonEntityModuleName_key __field__entity __field__name)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default PythonEntityModuleName_key where
+  def = PythonEntityModuleName_key Default.def ""
+
+instance Hashable.Hashable PythonEntityModuleName_key where
+  hashWithSalt __salt (PythonEntityModuleName_key _entity _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _name
+
+data PythonEntityLocation_key = PythonEntityLocation_key{pythonEntityLocation_key_entity
+                                                         :: Glean.Schema.CodePython.Entity,
+                                                         pythonEntityLocation_key_location ::
+                                                         Glean.Schema.CodemarkupTypes.Location}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityLocation_key where
+  toJSON (PythonEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityLocation_key where
+  buildStruct _proxy
+    (PythonEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (PythonEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityLocation_key where
+  rnf (PythonEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default PythonEntityLocation_key where
+  def = PythonEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable PythonEntityLocation_key where
+  hashWithSalt __salt (PythonEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data PythonEntityKind_key = PythonEntityKind_key{pythonEntityKind_key_entity
+                                                 :: Glean.Schema.CodePython.Entity,
+                                                 pythonEntityKind_key_kind ::
+                                                 Glean.Schema.CodemarkupTypes.SymbolKind}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityKind_key where
+  toJSON (PythonEntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityKind_key where
+  buildStruct _proxy
+    (PythonEntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (PythonEntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityKind_key where
+  rnf (PythonEntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default PythonEntityKind_key where
+  def = PythonEntityKind_key Default.def Default.def
+
+instance Hashable.Hashable PythonEntityKind_key where
+  hashWithSalt __salt (PythonEntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data PythonEntityInfo_key = PythonEntityInfo_key{pythonEntityInfo_key_entity
+                                                 :: Glean.Schema.CodePython.Entity,
+                                                 pythonEntityInfo_key_info ::
+                                                 Glean.Schema.CodemarkupTypes.SymbolInfo}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityInfo_key where
+  toJSON (PythonEntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityInfo_key where
+  buildStruct _proxy
+    (PythonEntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (PythonEntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityInfo_key where
+  rnf (PythonEntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default PythonEntityInfo_key where
+  def = PythonEntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable PythonEntityInfo_key where
+  hashWithSalt __salt (PythonEntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+
+data PythonEntityComments_key = PythonEntityComments_key{pythonEntityComments_key_entity
+                                                         :: Glean.Schema.CodePython.Entity,
+                                                         pythonEntityComments_key_file ::
+                                                         Glean.Schema.Src.File,
+                                                         pythonEntityComments_key_span ::
+                                                         Glean.Schema.Src.ByteSpan,
+                                                         pythonEntityComments_key_text ::
+                                                         Prelude.Maybe Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonEntityComments_key where
+  toJSON
+    (PythonEntityComments_key __field__entity __field__file
+       __field__span __field__text)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "file" .= __field__file :
+             "span" .= __field__span :
+               Prelude.maybe Prelude.id ((:) . ("text" .=)) __field__text
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonEntityComments_key where
+  buildStruct _proxy
+    (PythonEntityComments_key __field__entity __field__file
+       __field__span __field__text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               case __field__text of
+                 Prelude.Just _val -> Thrift.genField _proxy "text"
+                                        (Thrift.getStringType _proxy)
+                                        4
+                                        3
+                                        (Thrift.genText _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__text <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__text <- ST.readSTRef __field__text
+                                             Prelude.pure
+                                               (PythonEntityComments_key __val__entity __val__file
+                                                  __val__span
+                                                  __val__text)
+              _idMap
+                = HashMap.fromList
+                    [("entity", 1), ("file", 2), ("span", 3), ("text", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonEntityComments_key where
+  rnf
+    (PythonEntityComments_key __field__entity __field__file
+       __field__span __field__text)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__text `Prelude.seq` ()
+
+instance Default.Default PythonEntityComments_key where
+  def
+    = PythonEntityComments_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable PythonEntityComments_key where
+  hashWithSalt __salt
+    (PythonEntityComments_key _entity _file _span _text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+              _file)
+           _span)
+        _text
+
+data PythonContainsParentEntity_key = PythonContainsParentEntity_key{pythonContainsParentEntity_key_child
+                                                                     ::
+                                                                     Glean.Schema.CodePython.Entity,
+                                                                     pythonContainsParentEntity_key_parent
+                                                                     ::
+                                                                     Glean.Schema.CodePython.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonContainsParentEntity_key where
+  toJSON
+    (PythonContainsParentEntity_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonContainsParentEntity_key where
+  buildStruct _proxy
+    (PythonContainsParentEntity_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (PythonContainsParentEntity_key __val__child
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonContainsParentEntity_key where
+  rnf (PythonContainsParentEntity_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default PythonContainsParentEntity_key where
+  def = PythonContainsParentEntity_key Default.def Default.def
+
+instance Hashable.Hashable PythonContainsParentEntity_key where
+  hashWithSalt __salt (PythonContainsParentEntity_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data PythonContainsChildEntity_key = PythonContainsChildEntity_key{pythonContainsChildEntity_key_parent
+                                                                   ::
+                                                                   Glean.Schema.CodePython.Entity,
+                                                                   pythonContainsChildEntity_key_child
+                                                                   ::
+                                                                   Glean.Schema.CodePython.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonContainsChildEntity_key where
+  toJSON
+    (PythonContainsChildEntity_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonContainsChildEntity_key where
+  buildStruct _proxy
+    (PythonContainsChildEntity_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (PythonContainsChildEntity_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonContainsChildEntity_key where
+  rnf (PythonContainsChildEntity_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default PythonContainsChildEntity_key where
+  def = PythonContainsChildEntity_key Default.def Default.def
+
+instance Hashable.Hashable PythonContainsChildEntity_key where
+  hashWithSalt __salt (PythonContainsChildEntity_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data PythonAnnotation_key = PythonAnnotation_key{pythonAnnotation_key_entity
+                                                 :: Glean.Schema.CodePython.Entity,
+                                                 pythonAnnotation_key_anns ::
+                                                 Glean.Schema.CodePython.Annotations}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonAnnotation_key where
+  toJSON (PythonAnnotation_key __field__entity __field__anns)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "anns" .= __field__anns : Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonAnnotation_key where
+  buildStruct _proxy
+    (PythonAnnotation_key __field__entity __field__anns)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "anns" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__anns)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__anns <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__anns
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__anns <- ST.readSTRef __field__anns
+                                             Prelude.pure
+                                               (PythonAnnotation_key __val__entity __val__anns)
+              _idMap = HashMap.fromList [("entity", 1), ("anns", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonAnnotation_key where
+  rnf (PythonAnnotation_key __field__entity __field__anns)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__anns `Prelude.seq` ()
+
+instance Default.Default PythonAnnotation_key where
+  def = PythonAnnotation_key Default.def Default.def
+
+instance Hashable.Hashable PythonAnnotation_key where
+  hashWithSalt __salt (PythonAnnotation_key _entity _anns)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _anns
+
+data NonImportPythonDeclarationKind_key = NonImportPythonDeclarationKind_key{nonImportPythonDeclarationKind_key_declaration
+                                                                             ::
+                                                                             Glean.Schema.Python.Declaration,
+                                                                             nonImportPythonDeclarationKind_key_kind
+                                                                             ::
+                                                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NonImportPythonDeclarationKind_key where
+  toJSON
+    (NonImportPythonDeclarationKind_key __field__declaration
+       __field__kind)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct NonImportPythonDeclarationKind_key
+         where
+  buildStruct _proxy
+    (NonImportPythonDeclarationKind_key __field__declaration
+       __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (NonImportPythonDeclarationKind_key
+                                                  __val__declaration
+                                                  __val__kind)
+              _idMap = HashMap.fromList [("declaration", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NonImportPythonDeclarationKind_key where
+  rnf
+    (NonImportPythonDeclarationKind_key __field__declaration
+       __field__kind)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default NonImportPythonDeclarationKind_key where
+  def = NonImportPythonDeclarationKind_key Default.def Default.def
+
+instance Hashable.Hashable NonImportPythonDeclarationKind_key where
+  hashWithSalt __salt
+    (NonImportPythonDeclarationKind_key _declaration _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _kind
+
+data NonImportPythonDeclarationInfo_key = NonImportPythonDeclarationInfo_key{nonImportPythonDeclarationInfo_key_declaration
+                                                                             ::
+                                                                             Glean.Schema.Python.Declaration,
+                                                                             nonImportPythonDeclarationInfo_key_info
+                                                                             ::
+                                                                             Glean.Schema.CodemarkupTypes.SymbolInfo}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NonImportPythonDeclarationInfo_key where
+  toJSON
+    (NonImportPythonDeclarationInfo_key __field__declaration
+       __field__info)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct NonImportPythonDeclarationInfo_key
+         where
+  buildStruct _proxy
+    (NonImportPythonDeclarationInfo_key __field__declaration
+       __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure
+                                               (NonImportPythonDeclarationInfo_key
+                                                  __val__declaration
+                                                  __val__info)
+              _idMap = HashMap.fromList [("declaration", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NonImportPythonDeclarationInfo_key where
+  rnf
+    (NonImportPythonDeclarationInfo_key __field__declaration
+       __field__info)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default NonImportPythonDeclarationInfo_key where
+  def = NonImportPythonDeclarationInfo_key Default.def Default.def
+
+instance Hashable.Hashable NonImportPythonDeclarationInfo_key where
+  hashWithSalt __salt
+    (NonImportPythonDeclarationInfo_key _declaration _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _info
+
+data ConvertLabel_key = ConvertLabel_key{convertLabel_key_python ::
+                                         Prelude.Maybe Glean.Schema.Python.Name,
+                                         convertLabel_key_code :: Prelude.Maybe Text.Text}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertLabel_key where
+  toJSON (ConvertLabel_key __field__python __field__code)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("python" .=)) __field__python
+           (Prelude.maybe Prelude.id ((:) . ("code" .=)) __field__code
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertLabel_key where
+  buildStruct _proxy (ConvertLabel_key __field__python __field__code)
+    = Thrift.genStruct _proxy
+        (let (__cereal__python, __id__python)
+               = case __field__python of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "python"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__python
+             (case __field__code of
+                Prelude.Just _val -> Thrift.genField _proxy "code"
+                                       (Thrift.getStringType _proxy)
+                                       2
+                                       __id__python
+                                       (Thrift.genText _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__python <- ST.newSTRef Prelude.Nothing
+            __field__code <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__python
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__code
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__python <- ST.readSTRef
+                                                                 __field__python
+                                             !__val__code <- ST.readSTRef __field__code
+                                             Prelude.pure
+                                               (ConvertLabel_key __val__python __val__code)
+              _idMap = HashMap.fromList [("python", 1), ("code", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertLabel_key where
+  rnf (ConvertLabel_key __field__python __field__code)
+    = DeepSeq.rnf __field__python `Prelude.seq`
+        DeepSeq.rnf __field__code `Prelude.seq` ()
+
+instance Default.Default ConvertLabel_key where
+  def = ConvertLabel_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertLabel_key where
+  hashWithSalt __salt (ConvertLabel_key _python _code)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _python)
+        _code
+
+data ConvertCallArguments_key = ConvertCallArguments_key{convertCallArguments_key_pythonCallArguments
+                                                         :: [Glean.Schema.Python.CallArgument],
+                                                         convertCallArguments_key_codeCallArguments
+                                                         :: [Glean.Schema.Code.CallArgument]}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertCallArguments_key where
+  toJSON
+    (ConvertCallArguments_key __field__pythonCallArguments
+       __field__codeCallArguments)
+    = Aeson.object
+        ("pythonCallArguments" .= __field__pythonCallArguments :
+           "codeCallArguments" .= __field__codeCallArguments : Prelude.mempty)
+
+instance Thrift.ThriftStruct ConvertCallArguments_key where
+  buildStruct _proxy
+    (ConvertCallArguments_key __field__pythonCallArguments
+       __field__codeCallArguments)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "pythonCallArguments"
+           (Thrift.getListType _proxy)
+           1
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__pythonCallArguments)
+           :
+           Thrift.genField _proxy "codeCallArguments"
+             (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__codeCallArguments)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__pythonCallArguments <- ST.newSTRef Default.def
+            __field__codeCallArguments <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__pythonCallArguments
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__codeCallArguments
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__pythonCallArguments <- ST.readSTRef
+                                                                              __field__pythonCallArguments
+                                             !__val__codeCallArguments <- ST.readSTRef
+                                                                            __field__codeCallArguments
+                                             Prelude.pure
+                                               (ConvertCallArguments_key __val__pythonCallArguments
+                                                  __val__codeCallArguments)
+              _idMap
+                = HashMap.fromList
+                    [("pythonCallArguments", 1), ("codeCallArguments", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertCallArguments_key where
+  rnf
+    (ConvertCallArguments_key __field__pythonCallArguments
+       __field__codeCallArguments)
+    = DeepSeq.rnf __field__pythonCallArguments `Prelude.seq`
+        DeepSeq.rnf __field__codeCallArguments `Prelude.seq` ()
+
+instance Default.Default ConvertCallArguments_key where
+  def = ConvertCallArguments_key Default.def Default.def
+
+instance Hashable.Hashable ConvertCallArguments_key where
+  hashWithSalt __salt
+    (ConvertCallArguments_key _pythonCallArguments _codeCallArguments)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _pythonCallArguments)
+        _codeCallArguments
+
+data ConvertArgument_key = ConvertArgument_key{convertArgument_key_pythonArgument
+                                               :: Prelude.Maybe Glean.Schema.Python.Argument,
+                                               convertArgument_key_codeArgument ::
+                                               Prelude.Maybe Glean.Schema.Code.Argument}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConvertArgument_key where
+  toJSON
+    (ConvertArgument_key __field__pythonArgument __field__codeArgument)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("pythonArgument" .=))
+           __field__pythonArgument
+           (Prelude.maybe Prelude.id ((:) . ("codeArgument" .=))
+              __field__codeArgument
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct ConvertArgument_key where
+  buildStruct _proxy
+    (ConvertArgument_key __field__pythonArgument __field__codeArgument)
+    = Thrift.genStruct _proxy
+        (let (__cereal__pythonArgument, __id__pythonArgument)
+               = case __field__pythonArgument of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "pythonArgument"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__pythonArgument
+             (case __field__codeArgument of
+                Prelude.Just _val -> Thrift.genField _proxy "codeArgument"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__pythonArgument
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__pythonArgument <- ST.newSTRef Prelude.Nothing
+            __field__codeArgument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__pythonArgument
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__codeArgument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__pythonArgument <- ST.readSTRef
+                                                                         __field__pythonArgument
+                                             !__val__codeArgument <- ST.readSTRef
+                                                                       __field__codeArgument
+                                             Prelude.pure
+                                               (ConvertArgument_key __val__pythonArgument
+                                                  __val__codeArgument)
+              _idMap
+                = HashMap.fromList [("pythonArgument", 1), ("codeArgument", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConvertArgument_key where
+  rnf
+    (ConvertArgument_key __field__pythonArgument __field__codeArgument)
+    = DeepSeq.rnf __field__pythonArgument `Prelude.seq`
+        DeepSeq.rnf __field__codeArgument `Prelude.seq` ()
+
+instance Default.Default ConvertArgument_key where
+  def = ConvertArgument_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ConvertArgument_key where
+  hashWithSalt __salt
+    (ConvertArgument_key _pythonArgument _codeArgument)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _pythonArgument)
+        _codeArgument
+{-# LINE 22 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonContainsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodePython.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 33 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity
+       =
+       Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonContainsParentEntity"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonContainsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonContainsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonContainsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 49 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityKind_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 60 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityKind
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonEntityKind =
+       Glean.Schema.CodemarkupPython.Types.PythonEntityKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonEntityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityKind x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 69 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 75 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.python.NonImportPythonDeclarationKind_key"
+           (Prelude.Just 0))
+{-# LINE 84 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 86 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind
+       =
+       Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.python.NonImportPythonDeclarationKind"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.nonImportPythonDeclarationKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.nonImportPythonDeclarationKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonExtendsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 111 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodePython.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 113 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity
+       = Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonExtendsChildEntity" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonExtendsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonExtendsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 123 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 129 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonModifiers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonModifiers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonModifiers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonModifiers_key"
+           (Prelude.Just 0))
+{-# LINE 138 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonModifiers_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "modifiers"
+          (Glean.Schema.CodemarkupTypes.Types.Modifiers)
+          ('Angle.TNoFields))
+{-# LINE 140 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonModifiers
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonModifiers =
+       Glean.Schema.CodemarkupPython.Types.PythonModifiers_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonModifiers" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonModifiers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonModifiers x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonModifiers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 149 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonModifiers
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 155 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonResolveLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 164 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 166 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonResolveLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonResolveLocation
+       = Glean.Schema.CodemarkupPython.Types.PythonResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 176 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 182 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertLabel_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.ConvertLabel_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.ConvertLabel_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.ConvertLabel_key"
+           (Prelude.Just 0))
+{-# LINE 191 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.ConvertLabel_key
+     =
+     'Angle.TField "python"
+       (Prelude.Maybe Glean.Schema.Python.Types.Name)
+       ('Angle.TField "code" (Prelude.Maybe Data.Text.Text)
+          ('Angle.TNoFields))
+{-# LINE 193 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.ConvertLabel
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.ConvertLabel =
+       Glean.Schema.CodemarkupPython.Types.ConvertLabel_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.ConvertLabel" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.convertLabel_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.ConvertLabel x k
+  getFactKey = Glean.Schema.CodemarkupPython.Types.convertLabel_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 202 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertLabel
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 208 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.python.PythonFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 219 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 221 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations
+       =
+       Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.python.PythonFileEntityXRefLocations"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 231 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 237 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertArgument_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.ConvertArgument_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.ConvertArgument_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.ConvertArgument_key"
+           (Prelude.Just 0))
+{-# LINE 246 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.ConvertArgument_key
+     =
+     'Angle.TField "pythonArgument"
+       (Prelude.Maybe Glean.Schema.Python.Types.Argument)
+       ('Angle.TField "codeArgument"
+          (Prelude.Maybe Glean.Schema.Code.Types.Argument)
+          ('Angle.TNoFields))
+{-# LINE 248 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.ConvertArgument
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.ConvertArgument =
+       Glean.Schema.CodemarkupPython.Types.ConvertArgument_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.ConvertArgument" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.convertArgument_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.ConvertArgument x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.convertArgument_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 257 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertArgument
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 263 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityLocation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 272 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 274 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityLocation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonEntityLocation
+       = Glean.Schema.CodemarkupPython.Types.PythonEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 284 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 290 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertCallArguments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.ConvertCallArguments_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.ConvertCallArguments_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.ConvertCallArguments_key"
+           (Prelude.Just 0))
+{-# LINE 299 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.ConvertCallArguments_key
+     =
+     'Angle.TField "pythonCallArguments"
+       ([Glean.Schema.Python.Types.CallArgument])
+       ('Angle.TField "codeCallArguments"
+          ([Glean.Schema.Code.Types.CallArgument])
+          ('Angle.TNoFields))
+{-# LINE 301 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.ConvertCallArguments
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.ConvertCallArguments
+       = Glean.Schema.CodemarkupPython.Types.ConvertCallArguments_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.ConvertCallArguments" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.convertCallArguments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.ConvertCallArguments x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.convertCallArguments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 311 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.ConvertCallArguments
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 317 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityInfo_key"
+           (Prelude.Just 0))
+{-# LINE 326 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 328 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonEntityInfo =
+       Glean.Schema.CodemarkupPython.Types.PythonEntityInfo_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityInfo" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonEntityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityInfo x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 337 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 343 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonAnnotation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonAnnotation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonAnnotation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonAnnotation_key"
+           (Prelude.Just 0))
+{-# LINE 352 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonAnnotation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "anns" (Glean.Schema.CodePython.Types.Annotations)
+          ('Angle.TNoFields))
+{-# LINE 354 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonAnnotation
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonAnnotation =
+       Glean.Schema.CodemarkupPython.Types.PythonAnnotation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonAnnotation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonAnnotation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonAnnotation x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonAnnotation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 363 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonAnnotation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 369 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonContainsChildEntity_key"
+           (Prelude.Just 0))
+{-# LINE 378 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity_key
+     =
+     'Angle.TField "parent" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "child" (Glean.Schema.CodePython.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 380 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity
+       = Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonContainsChildEntity"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonContainsChildEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonContainsChildEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 390 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonContainsChildEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 396 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityComments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityComments_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityComments_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityComments_key"
+           (Prelude.Just 0))
+{-# LINE 409 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityComments_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "text" (Prelude.Maybe Data.Text.Text)
+                ('Angle.TNoFields))))
+{-# LINE 411 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityComments
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonEntityComments
+       = Glean.Schema.CodemarkupPython.Types.PythonEntityComments_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityComments" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonEntityComments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityComments x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityComments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 421 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityComments
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 427 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonFileCall_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonFileCall_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonFileCall_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonFileCall_key"
+           (Prelude.Just 0))
+{-# LINE 438 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonFileCall_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "callee_span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "call_args" ([Glean.Schema.Code.Types.CallArgument])
+             ('Angle.TNoFields)))
+{-# LINE 440 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonFileCall
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonFileCall =
+       Glean.Schema.CodemarkupPython.Types.PythonFileCall_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonFileCall" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonFileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonFileCall x k
+  getFactKey = Glean.Schema.CodemarkupPython.Types.pythonFileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 449 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonFileCall
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 455 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonExtendsParentEntity_key"
+           (Prelude.Just 0))
+{-# LINE 464 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity_key
+     =
+     'Angle.TField "child" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "parent" (Glean.Schema.CodePython.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 466 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity
+       = Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonExtendsParentEntity"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonExtendsParentEntity_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonExtendsParentEntity_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 476 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonExtendsParentEntity
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 482 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonVisibility_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonVisibility_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonVisibility_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonVisibility_key"
+           (Prelude.Just 0))
+{-# LINE 491 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonVisibility_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "visibility"
+          (Glean.Schema.CodemarkupTypes.Types.Visibility)
+          ('Angle.TNoFields))
+{-# LINE 493 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonVisibility
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonVisibility =
+       Glean.Schema.CodemarkupPython.Types.PythonVisibility_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonVisibility" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonVisibility_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonVisibility x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonVisibility_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 502 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonVisibility
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 508 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityModuleName_key"
+           (Prelude.Just 0))
+{-# LINE 517 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 519 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName
+       = Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityModuleName" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.pythonEntityModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 529 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 535 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "codemarkup.python.NonImportPythonDeclarationInfo_key"
+           (Prelude.Just 0))
+{-# LINE 544 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 546 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo
+         where
+  type KeyType
+         Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo
+       =
+       Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo_key
+  getName _proxy
+    = Glean.PredicateRef
+        "codemarkup.python.NonImportPythonDeclarationInfo"
+        2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupPython.Types.nonImportPythonDeclarationInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo
+        x
+        k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.nonImportPythonDeclarationInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 556 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.NonImportPythonDeclarationInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 562 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupPython.Types.PythonEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.python.PythonEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 573 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupPython.Types.PythonEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodePython.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 575 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupPython.Types.PythonEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupPython.Types.PythonEntityUses =
+       Glean.Schema.CodemarkupPython.Types.PythonEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.python.PythonEntityUses" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupPython.Types.pythonEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupPython.Types.PythonEntityUses x k
+  getFactKey
+    = Glean.Schema.CodemarkupPython.Types.pythonEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 584 "glean/schema/thrift/codemarkup_python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupPython.Types.PythonEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupScip/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupScip/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupScip/Types.hs
@@ -0,0 +1,1877 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupScip/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupScip.Types
+       (pREDICATE_VERSIONS, ScipResolveLocation_id,
+        ScipResolveLocation(ScipResolveLocation, scipResolveLocation_id,
+                            scipResolveLocation_key),
+        ScipFileEntityXRefLocations_id,
+        ScipFileEntityXRefLocations(ScipFileEntityXRefLocations,
+                                    scipFileEntityXRefLocations_id,
+                                    scipFileEntityXRefLocations_key),
+        ScipEntityUses_id,
+        ScipEntityUses(ScipEntityUses, scipEntityUses_id,
+                       scipEntityUses_key),
+        ScipEntityLocation_id,
+        ScipEntityLocation(ScipEntityLocation, scipEntityLocation_id,
+                           scipEntityLocation_key),
+        ScipEntityDocumentation_id,
+        ScipEntityDocumentation(ScipEntityDocumentation,
+                                scipEntityDocumentation_id, scipEntityDocumentation_key),
+        LsifKindToKind_id,
+        LsifKindToKind(LsifKindToKind, lsifKindToKind_id,
+                       lsifKindToKind_key),
+        FileXLangSymbolRefs_id,
+        FileXLangSymbolRefs(FileXLangSymbolRefs, fileXLangSymbolRefs_id,
+                            fileXLangSymbolRefs_key),
+        EntityInfo_id,
+        EntityInfo(EntityInfo, entityInfo_id, entityInfo_key),
+        ScipResolveLocation_key(ScipResolveLocation_key,
+                                scipResolveLocation_key_location, scipResolveLocation_key_entity),
+        ScipFileEntityXRefLocations_key(ScipFileEntityXRefLocations_key,
+                                        scipFileEntityXRefLocations_key_file,
+                                        scipFileEntityXRefLocations_key_xref,
+                                        scipFileEntityXRefLocations_key_entity),
+        ScipEntityUses_key(ScipEntityUses_key, scipEntityUses_key_target,
+                           scipEntityUses_key_file, scipEntityUses_key_range),
+        ScipEntityLocation_key(ScipEntityLocation_key,
+                               scipEntityLocation_key_entity, scipEntityLocation_key_location),
+        ScipEntityDocumentation_key(ScipEntityDocumentation_key,
+                                    scipEntityDocumentation_key_entity,
+                                    scipEntityDocumentation_key_documentation),
+        LsifKindToKind_key(LsifKindToKind_key, lsifKindToKind_key_lsif,
+                           lsifKindToKind_key_kind),
+        FileXLangSymbolRefs_key(FileXLangSymbolRefs_key,
+                                fileXLangSymbolRefs_key_file, fileXLangSymbolRefs_key_source,
+                                fileXLangSymbolRefs_key_symbol),
+        EntityInfo_key(EntityInfo_key, entityInfo_key_entity,
+                       entityInfo_key_info))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeScip.Types
+       as Glean.Schema.CodeScip
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.LsifTypes.Types
+       as Glean.Schema.LsifTypes
+import qualified Glean.Schema.Scip.Types as Glean.Schema.Scip
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.CodeScip.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 17 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.LsifTypes.Types
+{-# LINE 18 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.Scip.Types
+{-# LINE 19 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 130 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupScip/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("ScipFileEntityXRefLocations", 1), ("FileXLangSymbolRefs", 1),
+       ("LsifKindToKind", 1), ("EntityInfo", 1),
+       ("ScipEntityDocumentation", 1), ("ScipResolveLocation", 1),
+       ("ScipEntityLocation", 1), ("ScipEntityUses", 1)]
+
+type ScipResolveLocation_id = Glean.Id
+
+data ScipResolveLocation = ScipResolveLocation{scipResolveLocation_id
+                                               :: {-# UNPACK #-} !ScipResolveLocation_id,
+                                               scipResolveLocation_key ::
+                                               Prelude.Maybe ScipResolveLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipResolveLocation where
+  toJSON (ScipResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipResolveLocation where
+  buildStruct _proxy (ScipResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ScipResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipResolveLocation where
+  rnf (ScipResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScipResolveLocation where
+  def = ScipResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScipResolveLocation where
+  hashWithSalt __salt (ScipResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ScipFileEntityXRefLocations_id = Glean.Id
+
+data ScipFileEntityXRefLocations = ScipFileEntityXRefLocations{scipFileEntityXRefLocations_id
+                                                               ::
+                                                               {-# UNPACK #-} !ScipFileEntityXRefLocations_id,
+                                                               scipFileEntityXRefLocations_key ::
+                                                               Prelude.Maybe
+                                                                 ScipFileEntityXRefLocations_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipFileEntityXRefLocations where
+  toJSON (ScipFileEntityXRefLocations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipFileEntityXRefLocations where
+  buildStruct _proxy
+    (ScipFileEntityXRefLocations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ScipFileEntityXRefLocations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipFileEntityXRefLocations where
+  rnf (ScipFileEntityXRefLocations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScipFileEntityXRefLocations where
+  def = ScipFileEntityXRefLocations Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScipFileEntityXRefLocations where
+  hashWithSalt __salt (ScipFileEntityXRefLocations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ScipEntityUses_id = Glean.Id
+
+data ScipEntityUses = ScipEntityUses{scipEntityUses_id ::
+                                     {-# UNPACK #-} !ScipEntityUses_id,
+                                     scipEntityUses_key :: Prelude.Maybe ScipEntityUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityUses where
+  toJSON (ScipEntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityUses where
+  buildStruct _proxy (ScipEntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ScipEntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityUses where
+  rnf (ScipEntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScipEntityUses where
+  def = ScipEntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScipEntityUses where
+  hashWithSalt __salt (ScipEntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ScipEntityLocation_id = Glean.Id
+
+data ScipEntityLocation = ScipEntityLocation{scipEntityLocation_id
+                                             :: {-# UNPACK #-} !ScipEntityLocation_id,
+                                             scipEntityLocation_key ::
+                                             Prelude.Maybe ScipEntityLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityLocation where
+  toJSON (ScipEntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityLocation where
+  buildStruct _proxy (ScipEntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ScipEntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityLocation where
+  rnf (ScipEntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScipEntityLocation where
+  def = ScipEntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScipEntityLocation where
+  hashWithSalt __salt (ScipEntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ScipEntityDocumentation_id = Glean.Id
+
+data ScipEntityDocumentation = ScipEntityDocumentation{scipEntityDocumentation_id
+                                                       ::
+                                                       {-# UNPACK #-} !ScipEntityDocumentation_id,
+                                                       scipEntityDocumentation_key ::
+                                                       Prelude.Maybe ScipEntityDocumentation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityDocumentation where
+  toJSON (ScipEntityDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityDocumentation where
+  buildStruct _proxy
+    (ScipEntityDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ScipEntityDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityDocumentation where
+  rnf (ScipEntityDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScipEntityDocumentation where
+  def = ScipEntityDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScipEntityDocumentation where
+  hashWithSalt __salt (ScipEntityDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifKindToKind_id = Glean.Id
+
+data LsifKindToKind = LsifKindToKind{lsifKindToKind_id ::
+                                     {-# UNPACK #-} !LsifKindToKind_id,
+                                     lsifKindToKind_key :: Prelude.Maybe LsifKindToKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifKindToKind where
+  toJSON (LsifKindToKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifKindToKind where
+  buildStruct _proxy (LsifKindToKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifKindToKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifKindToKind where
+  rnf (LsifKindToKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifKindToKind where
+  def = LsifKindToKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifKindToKind where
+  hashWithSalt __salt (LsifKindToKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXLangSymbolRefs_id = Glean.Id
+
+data FileXLangSymbolRefs = FileXLangSymbolRefs{fileXLangSymbolRefs_id
+                                               :: {-# UNPACK #-} !FileXLangSymbolRefs_id,
+                                               fileXLangSymbolRefs_key ::
+                                               Prelude.Maybe FileXLangSymbolRefs_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXLangSymbolRefs where
+  toJSON (FileXLangSymbolRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXLangSymbolRefs where
+  buildStruct _proxy (FileXLangSymbolRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXLangSymbolRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXLangSymbolRefs where
+  rnf (FileXLangSymbolRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXLangSymbolRefs where
+  def = FileXLangSymbolRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXLangSymbolRefs where
+  hashWithSalt __salt (FileXLangSymbolRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityInfo_id = Glean.Id
+
+data EntityInfo = EntityInfo{entityInfo_id ::
+                             {-# UNPACK #-} !EntityInfo_id,
+                             entityInfo_key :: Prelude.Maybe EntityInfo_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo where
+  toJSON (EntityInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo where
+  buildStruct _proxy (EntityInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo where
+  rnf (EntityInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityInfo where
+  def = EntityInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityInfo where
+  hashWithSalt __salt (EntityInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data ScipResolveLocation_key = ScipResolveLocation_key{scipResolveLocation_key_location
+                                                       :: Glean.Schema.CodemarkupTypes.Location,
+                                                       scipResolveLocation_key_entity ::
+                                                       Glean.Schema.CodeScip.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipResolveLocation_key where
+  toJSON (ScipResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipResolveLocation_key where
+  buildStruct _proxy
+    (ScipResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ScipResolveLocation_key __val__location
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipResolveLocation_key where
+  rnf (ScipResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ScipResolveLocation_key where
+  def = ScipResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable ScipResolveLocation_key where
+  hashWithSalt __salt (ScipResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data ScipFileEntityXRefLocations_key = ScipFileEntityXRefLocations_key{scipFileEntityXRefLocations_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       scipFileEntityXRefLocations_key_xref
+                                                                       ::
+                                                                       Glean.Schema.CodemarkupTypes.XRefLocation,
+                                                                       scipFileEntityXRefLocations_key_entity
+                                                                       ::
+                                                                       Glean.Schema.CodeScip.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipFileEntityXRefLocations_key where
+  toJSON
+    (ScipFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipFileEntityXRefLocations_key where
+  buildStruct _proxy
+    (ScipFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ScipFileEntityXRefLocations_key __val__file
+                                                  __val__xref
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipFileEntityXRefLocations_key where
+  rnf
+    (ScipFileEntityXRefLocations_key __field__file __field__xref
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ScipFileEntityXRefLocations_key where
+  def
+    = ScipFileEntityXRefLocations_key Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable ScipFileEntityXRefLocations_key where
+  hashWithSalt __salt
+    (ScipFileEntityXRefLocations_key _file _xref _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref)
+        _entity
+
+data ScipEntityUses_key = ScipEntityUses_key{scipEntityUses_key_target
+                                             :: Glean.Schema.CodeScip.Entity,
+                                             scipEntityUses_key_file :: Glean.Schema.Src.File,
+                                             scipEntityUses_key_range :: Glean.Schema.Src.Range}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityUses_key where
+  toJSON
+    (ScipEntityUses_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityUses_key where
+  buildStruct _proxy
+    (ScipEntityUses_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (ScipEntityUses_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityUses_key where
+  rnf
+    (ScipEntityUses_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default ScipEntityUses_key where
+  def = ScipEntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ScipEntityUses_key where
+  hashWithSalt __salt (ScipEntityUses_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data ScipEntityLocation_key = ScipEntityLocation_key{scipEntityLocation_key_entity
+                                                     :: Glean.Schema.CodeScip.Entity,
+                                                     scipEntityLocation_key_location ::
+                                                     Glean.Schema.CodemarkupTypes.Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityLocation_key where
+  toJSON (ScipEntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityLocation_key where
+  buildStruct _proxy
+    (ScipEntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ScipEntityLocation_key __val__entity
+                                                  __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityLocation_key where
+  rnf (ScipEntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ScipEntityLocation_key where
+  def = ScipEntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable ScipEntityLocation_key where
+  hashWithSalt __salt (ScipEntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data ScipEntityDocumentation_key = ScipEntityDocumentation_key{scipEntityDocumentation_key_entity
+                                                               :: Glean.Schema.CodeScip.Entity,
+                                                               scipEntityDocumentation_key_documentation
+                                                               :: Glean.Schema.Scip.Documentation}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScipEntityDocumentation_key where
+  toJSON
+    (ScipEntityDocumentation_key __field__entity
+       __field__documentation)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "documentation" .= __field__documentation : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScipEntityDocumentation_key where
+  buildStruct _proxy
+    (ScipEntityDocumentation_key __field__entity
+       __field__documentation)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "documentation"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__documentation)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__documentation <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__documentation
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__documentation <- ST.readSTRef
+                                                                        __field__documentation
+                                             Prelude.pure
+                                               (ScipEntityDocumentation_key __val__entity
+                                                  __val__documentation)
+              _idMap = HashMap.fromList [("entity", 1), ("documentation", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScipEntityDocumentation_key where
+  rnf
+    (ScipEntityDocumentation_key __field__entity
+       __field__documentation)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__documentation `Prelude.seq` ()
+
+instance Default.Default ScipEntityDocumentation_key where
+  def = ScipEntityDocumentation_key Default.def Default.def
+
+instance Hashable.Hashable ScipEntityDocumentation_key where
+  hashWithSalt __salt
+    (ScipEntityDocumentation_key _entity _documentation)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _documentation
+
+data LsifKindToKind_key = LsifKindToKind_key{lsifKindToKind_key_lsif
+                                             :: Glean.Schema.LsifTypes.SymbolKind,
+                                             lsifKindToKind_key_kind ::
+                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifKindToKind_key where
+  toJSON (LsifKindToKind_key __field__lsif __field__kind)
+    = Aeson.object
+        ("lsif" .= __field__lsif :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifKindToKind_key where
+  buildStruct _proxy (LsifKindToKind_key __field__lsif __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lsif" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__lsif)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lsif <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__lsif
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lsif <- ST.readSTRef __field__lsif
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (LsifKindToKind_key __val__lsif __val__kind)
+              _idMap = HashMap.fromList [("lsif", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifKindToKind_key where
+  rnf (LsifKindToKind_key __field__lsif __field__kind)
+    = DeepSeq.rnf __field__lsif `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default LsifKindToKind_key where
+  def = LsifKindToKind_key Default.def Default.def
+
+instance Hashable.Hashable LsifKindToKind_key where
+  hashWithSalt __salt (LsifKindToKind_key _lsif _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lsif) _kind
+
+data FileXLangSymbolRefs_key = FileXLangSymbolRefs_key{fileXLangSymbolRefs_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       fileXLangSymbolRefs_key_source ::
+                                                       Glean.Schema.CodemarkupTypes.RangeSpan,
+                                                       fileXLangSymbolRefs_key_symbol ::
+                                                       Glean.Schema.Scip.Symbol}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXLangSymbolRefs_key where
+  toJSON
+    (FileXLangSymbolRefs_key __field__file __field__source
+       __field__symbol)
+    = Aeson.object
+        ("file" .= __field__file :
+           "source" .= __field__source :
+             "symbol" .= __field__symbol : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXLangSymbolRefs_key where
+  buildStruct _proxy
+    (FileXLangSymbolRefs_key __field__file __field__source
+       __field__symbol)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__symbol)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__symbol <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__symbol <- ST.readSTRef __field__symbol
+                                             Prelude.pure
+                                               (FileXLangSymbolRefs_key __val__file __val__source
+                                                  __val__symbol)
+              _idMap
+                = HashMap.fromList [("file", 1), ("source", 2), ("symbol", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXLangSymbolRefs_key where
+  rnf
+    (FileXLangSymbolRefs_key __field__file __field__source
+       __field__symbol)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__symbol `Prelude.seq` ()
+
+instance Default.Default FileXLangSymbolRefs_key where
+  def = FileXLangSymbolRefs_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileXLangSymbolRefs_key where
+  hashWithSalt __salt (FileXLangSymbolRefs_key _file _source _symbol)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _source)
+        _symbol
+
+data EntityInfo_key = EntityInfo_key{entityInfo_key_entity ::
+                                     Glean.Schema.CodeScip.Entity,
+                                     entityInfo_key_info :: Glean.Schema.CodemarkupTypes.SymbolInfo}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityInfo_key where
+  toJSON (EntityInfo_key __field__entity __field__info)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityInfo_key where
+  buildStruct _proxy (EntityInfo_key __field__entity __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure (EntityInfo_key __val__entity __val__info)
+              _idMap = HashMap.fromList [("entity", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityInfo_key where
+  rnf (EntityInfo_key __field__entity __field__info)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default EntityInfo_key where
+  def = EntityInfo_key Default.def Default.def
+
+instance Hashable.Hashable EntityInfo_key where
+  hashWithSalt __salt (EntityInfo_key _entity _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _info
+{-# LINE 22 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.ScipFileEntityXRefLocations_key"
+           (Prelude.Just 0))
+{-# LINE 33 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref"
+          (Glean.Schema.CodemarkupTypes.Types.XRefLocation)
+          ('Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 35 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations
+         where
+  type KeyType
+         Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations
+       = Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.ScipFileEntityXRefLocations"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupScip.Types.scipFileEntityXRefLocations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations x k
+  getFactKey
+    = Glean.Schema.CodemarkupScip.Types.scipFileEntityXRefLocations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 45 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipFileEntityXRefLocations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 51 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.FileXLangSymbolRefs_key"
+           (Prelude.Just 0))
+{-# LINE 62 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "source"
+          (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+          ('Angle.TField "symbol"
+             (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+             ('Angle.TNoFields)))
+{-# LINE 64 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs
+       = Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.FileXLangSymbolRefs" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupScip.Types.fileXLangSymbolRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs x k
+  getFactKey
+    = Glean.Schema.CodemarkupScip.Types.fileXLangSymbolRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 73 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.FileXLangSymbolRefs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 79 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.LsifKindToKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.LsifKindToKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.LsifKindToKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.LsifKindToKind_key"
+           (Prelude.Just 0))
+{-# LINE 88 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.LsifKindToKind_key
+     =
+     'Angle.TField "lsif" (Glean.Schema.LsifTypes.Types.SymbolKind)
+       ('Angle.TField "kind"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 90 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.LsifKindToKind
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.LsifKindToKind =
+       Glean.Schema.CodemarkupScip.Types.LsifKindToKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.LsifKindToKind" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupScip.Types.lsifKindToKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.LsifKindToKind x k
+  getFactKey = Glean.Schema.CodemarkupScip.Types.lsifKindToKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 99 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.LsifKindToKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 105 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.EntityInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.EntityInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.EntityInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.EntityInfo_key" (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupScip.Types.EntityInfo_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+       ('Angle.TField "info"
+          (Glean.Schema.CodemarkupTypes.Types.SymbolInfo)
+          ('Angle.TNoFields))
+{-# LINE 116 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.EntityInfo
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.EntityInfo =
+       Glean.Schema.CodemarkupScip.Types.EntityInfo_key
+  getName _proxy = Glean.PredicateRef "codemarkup.scip.EntityInfo" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupScip.Types.entityInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.EntityInfo x k
+  getFactKey = Glean.Schema.CodemarkupScip.Types.entityInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupScip.Types.EntityInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.ScipEntityDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+       ('Angle.TField "documentation"
+          (Glean.KeyType Glean.Schema.Scip.Types.Documentation)
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation
+         where
+  type KeyType
+         Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation
+       = Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.ScipEntityDocumentation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupScip.Types.scipEntityDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation x k
+  getFactKey
+    = Glean.Schema.CodemarkupScip.Types.scipEntityDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 152 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 158 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipResolveLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.ScipResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.ScipResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.ScipResolveLocation_key"
+           (Prelude.Just 0))
+{-# LINE 167 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.ScipResolveLocation_key
+     =
+     'Angle.TField "location"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 169 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.ScipResolveLocation
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.ScipResolveLocation
+       = Glean.Schema.CodemarkupScip.Types.ScipResolveLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.ScipResolveLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupScip.Types.scipResolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.ScipResolveLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupScip.Types.scipResolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 178 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipResolveLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 184 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.ScipEntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.ScipEntityLocation_key"
+           (Prelude.Just 0))
+{-# LINE 193 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.ScipEntityLocation_key
+     =
+     'Angle.TField "entity" (Glean.Schema.CodeScip.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 195 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.ScipEntityLocation
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.ScipEntityLocation =
+       Glean.Schema.CodemarkupScip.Types.ScipEntityLocation_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.ScipEntityLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupScip.Types.scipEntityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityLocation x k
+  getFactKey
+    = Glean.Schema.CodemarkupScip.Types.scipEntityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 204 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 210 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupScip.Types.ScipEntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.scip.ScipEntityUses_key"
+           (Prelude.Just 0))
+{-# LINE 221 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupScip.Types.ScipEntityUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.CodeScip.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 223 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupScip.Types.ScipEntityUses
+         where
+  type KeyType Glean.Schema.CodemarkupScip.Types.ScipEntityUses =
+       Glean.Schema.CodemarkupScip.Types.ScipEntityUses_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.scip.ScipEntityUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupScip.Types.scipEntityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupScip.Types.ScipEntityUses x k
+  getFactKey = Glean.Schema.CodemarkupScip.Types.scipEntityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 232 "glean/schema/thrift/codemarkup_scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupScip.Types.ScipEntityUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupSearch/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupSearch/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupSearch/Types.hs
@@ -0,0 +1,1099 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupSearch/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupSearch.Types
+       (pREDICATE_VERSIONS, SearchByScope_id,
+        SearchByScope(SearchByScope, searchByScope_id, searchByScope_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        EntityLocationAndKind_id,
+        EntityLocationAndKind(EntityLocationAndKind,
+                              entityLocationAndKind_id, entityLocationAndKind_key),
+        SearchCase(SearchCase_Sensitive, SearchCase_Insensitive,
+                   SearchCase__UNKNOWN),
+        SearchByScope_key(SearchByScope_key, searchByScope_key_searchcase,
+                          searchByScope_key_name, searchByScope_key_scope,
+                          searchByScope_key_entity, searchByScope_key_location,
+                          searchByScope_key_kind, searchByScope_key_language),
+        SearchByName_key(SearchByName_key, searchByName_key_searchcase,
+                         searchByName_key_name, searchByName_key_entity,
+                         searchByName_key_location, searchByName_key_kind,
+                         searchByName_key_language),
+        EntityLocationAndKind_key(EntityLocationAndKind_key,
+                                  entityLocationAndKind_key_entity,
+                                  entityLocationAndKind_key_location,
+                                  entityLocationAndKind_key_kind))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 16 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 100 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupSearch/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("EntityLocationAndKind", 1), ("SearchByName", 1),
+       ("SearchByScope", 1)]
+
+type SearchByScope_id = Glean.Id
+
+data SearchByScope = SearchByScope{searchByScope_id ::
+                                   {-# UNPACK #-} !SearchByScope_id,
+                                   searchByScope_key :: Prelude.Maybe SearchByScope_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScope where
+  toJSON (SearchByScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByScope where
+  buildStruct _proxy (SearchByScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScope where
+  rnf (SearchByScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByScope where
+  def = SearchByScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByScope where
+  hashWithSalt __salt (SearchByScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLocationAndKind_id = Glean.Id
+
+data EntityLocationAndKind = EntityLocationAndKind{entityLocationAndKind_id
+                                                   :: {-# UNPACK #-} !EntityLocationAndKind_id,
+                                                   entityLocationAndKind_key ::
+                                                   Prelude.Maybe EntityLocationAndKind_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocationAndKind where
+  toJSON (EntityLocationAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocationAndKind where
+  buildStruct _proxy (EntityLocationAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (EntityLocationAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocationAndKind where
+  rnf (EntityLocationAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLocationAndKind where
+  def = EntityLocationAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLocationAndKind where
+  hashWithSalt __salt (EntityLocationAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchCase = SearchCase_Sensitive
+                | SearchCase_Insensitive
+                | SearchCase__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchCase where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData SearchCase where
+  rnf __SearchCase = Prelude.seq __SearchCase ()
+
+instance Default.Default SearchCase where
+  def = SearchCase_Sensitive
+
+instance Hashable.Hashable SearchCase where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum SearchCase where
+  toThriftEnum 0 = SearchCase_Sensitive
+  toThriftEnum 1 = SearchCase_Insensitive
+  toThriftEnum val = SearchCase__UNKNOWN val
+  fromThriftEnum SearchCase_Sensitive = 0
+  fromThriftEnum SearchCase_Insensitive = 1
+  fromThriftEnum (SearchCase__UNKNOWN val) = val
+  allThriftEnumValues
+    = [SearchCase_Sensitive, SearchCase_Insensitive]
+  toThriftEnumEither 0 = Prelude.Right SearchCase_Sensitive
+  toThriftEnumEither 1 = Prelude.Right SearchCase_Insensitive
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum SearchCase: "
+           ++ Prelude.show val)
+
+data SearchByScope_key = SearchByScope_key{searchByScope_key_searchcase
+                                           :: SearchCase,
+                                           searchByScope_key_name :: Text.Text,
+                                           searchByScope_key_scope :: [Text.Text],
+                                           searchByScope_key_entity :: Glean.Schema.Code.Entity,
+                                           searchByScope_key_location ::
+                                           Glean.Schema.CodemarkupTypes.Location,
+                                           searchByScope_key_kind ::
+                                           Prelude.Maybe Glean.Schema.CodemarkupTypes.SymbolKind,
+                                           searchByScope_key_language :: Glean.Schema.Code.Language}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScope_key where
+  toJSON
+    (SearchByScope_key __field__searchcase __field__name __field__scope
+       __field__entity __field__location __field__kind __field__language)
+    = Aeson.object
+        ("searchcase" .= __field__searchcase :
+           "name" .= __field__name :
+             "scope" .= __field__scope :
+               "entity" .= __field__entity :
+                 "location" .= __field__location :
+                   Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+                     ("language" .= __field__language : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByScope_key where
+  buildStruct _proxy
+    (SearchByScope_key __field__searchcase __field__name __field__scope
+       __field__entity __field__location __field__kind __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "searchcase" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__searchcase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__scope)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 :
+                 Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__location)
+                   :
+                   let (__cereal__kind, __id__kind)
+                         = case __field__kind of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genField _proxy "kind"
+                                                        (Thrift.getI32Type _proxy)
+                                                        6
+                                                        5
+                                                        ((Thrift.genI32 _proxy .
+                                                            Prelude.fromIntegral
+                                                            . Thrift.fromThriftEnum)
+                                                           _val)),
+                                                   6)
+                             Prelude.Nothing -> (Prelude.id, 5)
+                     in
+                     __cereal__kind
+                       (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 7
+                          __id__kind
+                          ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                              Thrift.fromThriftEnum)
+                             __field__language)
+                          : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__searchcase <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SearchCase")
+                                                                        ST.writeSTRef
+                                                                          __field__searchcase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__searchcase <- ST.readSTRef
+                                                                     __field__searchcase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (SearchByScope_key __val__searchcase __val__name
+                                                  __val__scope
+                                                  __val__entity
+                                                  __val__location
+                                                  __val__kind
+                                                  __val__language)
+              _idMap
+                = HashMap.fromList
+                    [("searchcase", 1), ("name", 2), ("scope", 3), ("entity", 4),
+                     ("location", 5), ("kind", 6), ("language", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScope_key where
+  rnf
+    (SearchByScope_key __field__searchcase __field__name __field__scope
+       __field__entity __field__location __field__kind __field__language)
+    = DeepSeq.rnf __field__searchcase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq`
+              DeepSeq.rnf __field__location `Prelude.seq`
+                DeepSeq.rnf __field__kind `Prelude.seq`
+                  DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default SearchByScope_key where
+  def
+    = SearchByScope_key Default.def "" Default.def Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByScope_key where
+  hashWithSalt __salt
+    (SearchByScope_key _searchcase _name _scope _entity _location _kind
+       _language)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _searchcase)
+                       _name)
+                    _scope)
+                 _entity)
+              _location)
+           _kind)
+        _language
+
+data SearchByName_key = SearchByName_key{searchByName_key_searchcase
+                                         :: SearchCase,
+                                         searchByName_key_name :: Text.Text,
+                                         searchByName_key_entity :: Glean.Schema.Code.Entity,
+                                         searchByName_key_location ::
+                                         Glean.Schema.CodemarkupTypes.Location,
+                                         searchByName_key_kind ::
+                                         Prelude.Maybe Glean.Schema.CodemarkupTypes.SymbolKind,
+                                         searchByName_key_language :: Glean.Schema.Code.Language}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON
+    (SearchByName_key __field__searchcase __field__name __field__entity
+       __field__location __field__kind __field__language)
+    = Aeson.object
+        ("searchcase" .= __field__searchcase :
+           "name" .= __field__name :
+             "entity" .= __field__entity :
+               "location" .= __field__location :
+                 Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+                   ("language" .= __field__language : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy
+    (SearchByName_key __field__searchcase __field__name __field__entity
+       __field__location __field__kind __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "searchcase" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__searchcase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               :
+               Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__location)
+                 :
+                 let (__cereal__kind, __id__kind)
+                       = case __field__kind of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "kind"
+                                                      (Thrift.getI32Type _proxy)
+                                                      5
+                                                      4
+                                                      ((Thrift.genI32 _proxy . Prelude.fromIntegral
+                                                          . Thrift.fromThriftEnum)
+                                                         _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__kind
+                     (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 6
+                        __id__kind
+                        ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                            Thrift.fromThriftEnum)
+                           __field__language)
+                        : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__searchcase <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SearchCase")
+                                                                        ST.writeSTRef
+                                                                          __field__searchcase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__searchcase <- ST.readSTRef
+                                                                     __field__searchcase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (SearchByName_key __val__searchcase __val__name
+                                                  __val__entity
+                                                  __val__location
+                                                  __val__kind
+                                                  __val__language)
+              _idMap
+                = HashMap.fromList
+                    [("searchcase", 1), ("name", 2), ("entity", 3), ("location", 4),
+                     ("kind", 5), ("language", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf
+    (SearchByName_key __field__searchcase __field__name __field__entity
+       __field__location __field__kind __field__language)
+    = DeepSeq.rnf __field__searchcase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq`
+            DeepSeq.rnf __field__location `Prelude.seq`
+              DeepSeq.rnf __field__kind `Prelude.seq`
+                DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def
+    = SearchByName_key Default.def "" Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt
+    (SearchByName_key _searchcase _name _entity _location _kind
+       _language)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _searchcase)
+                    _name)
+                 _entity)
+              _location)
+           _kind)
+        _language
+
+data EntityLocationAndKind_key = EntityLocationAndKind_key{entityLocationAndKind_key_entity
+                                                           :: Glean.Schema.Code.Entity,
+                                                           entityLocationAndKind_key_location ::
+                                                           Glean.Schema.CodemarkupTypes.Location,
+                                                           entityLocationAndKind_key_kind ::
+                                                           Prelude.Maybe
+                                                             Glean.Schema.CodemarkupTypes.SymbolKind}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocationAndKind_key where
+  toJSON
+    (EntityLocationAndKind_key __field__entity __field__location
+       __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location :
+             Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocationAndKind_key where
+  buildStruct _proxy
+    (EntityLocationAndKind_key __field__entity __field__location
+       __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             case __field__kind of
+               Prelude.Just _val -> Thrift.genField _proxy "kind"
+                                      (Thrift.getI32Type _proxy)
+                                      3
+                                      2
+                                      ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                          Thrift.fromThriftEnum)
+                                         _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (EntityLocationAndKind_key __val__entity
+                                                  __val__location
+                                                  __val__kind)
+              _idMap
+                = HashMap.fromList [("entity", 1), ("location", 2), ("kind", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocationAndKind_key where
+  rnf
+    (EntityLocationAndKind_key __field__entity __field__location
+       __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default EntityLocationAndKind_key where
+  def
+    = EntityLocationAndKind_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLocationAndKind_key where
+  hashWithSalt __salt
+    (EntityLocationAndKind_key _entity _location _kind)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+           _location)
+        _kind
+{-# LINE 19 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.search.EntityLocationAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 30 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind_key
+     =
+     'Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+       ('Angle.TField "location"
+          (Glean.Schema.CodemarkupTypes.Types.Location)
+          ('Angle.TField "kind"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TNoFields)))
+{-# LINE 32 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind
+         where
+  type KeyType
+         Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind
+       = Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.search.EntityLocationAndKind" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.CodemarkupSearch.Types.entityLocationAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind x k
+  getFactKey
+    = Glean.Schema.CodemarkupSearch.Types.entityLocationAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 42 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.EntityLocationAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 48 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupSearch.Types.SearchByName_key x1 x2 x3 x4
+       x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.CodemarkupSearch.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.search.SearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 65 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupSearch.Types.SearchByName_key
+     =
+     'Angle.TField "searchcase"
+       (Glean.Schema.CodemarkupSearch.Types.SearchCase)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TField "location"
+                (Glean.Schema.CodemarkupTypes.Types.Location)
+                ('Angle.TField "kind"
+                   (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                   ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+                      ('Angle.TNoFields))))))
+{-# LINE 67 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupSearch.Types.SearchByName
+         where
+  type KeyType Glean.Schema.CodemarkupSearch.Types.SearchByName =
+       Glean.Schema.CodemarkupSearch.Types.SearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.search.SearchByName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupSearch.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupSearch.Types.SearchByName x k
+  getFactKey = Glean.Schema.CodemarkupSearch.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 76 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.SearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 82 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.SearchByScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupSearch.Types.SearchByScope_key x1 x2 x3 x4
+       x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.CodemarkupSearch.Types.SearchByScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.search.SearchByScope_key"
+           (Prelude.Just 0))
+{-# LINE 101 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupSearch.Types.SearchByScope_key
+     =
+     'Angle.TField "searchcase"
+       (Glean.Schema.CodemarkupSearch.Types.SearchCase)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "scope" ([Data.Text.Text])
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TField "location"
+                   (Glean.Schema.CodemarkupTypes.Types.Location)
+                   ('Angle.TField "kind"
+                      (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                      ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+                         ('Angle.TNoFields)))))))
+{-# LINE 103 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupSearch.Types.SearchByScope
+         where
+  type KeyType Glean.Schema.CodemarkupSearch.Types.SearchByScope =
+       Glean.Schema.CodemarkupSearch.Types.SearchByScope_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.search.SearchByScope" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupSearch.Types.searchByScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupSearch.Types.SearchByScope x k
+  getFactKey = Glean.Schema.CodemarkupSearch.Types.searchByScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 112 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupSearch.Types.SearchByScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 118 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupSearch.Types.SearchCase
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.search.SearchCase" (Prelude.Just 1))
+{-# LINE 123 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupSearch.Types.SearchCase =
+     'Angle.TField "Sensitive" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Insensitive" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 125 "glean/schema/thrift/codemarkup_search_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.CodemarkupSearch.Types.SearchCase
+         where
+  type AngleEnumTy Glean.Schema.CodemarkupSearch.Types.SearchCase =
+       Glean.Schema.CodemarkupSearch.Types.SearchCase
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupTypes/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupTypes/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupTypes/Types.hs
@@ -0,0 +1,1462 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupTypes/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.CodemarkupTypes.Types
+       (pREDICATE_VERSIONS, RangeSpanContains_id,
+        RangeSpanContains(RangeSpanContains, rangeSpanContains_id,
+                          rangeSpanContains_key),
+        Visibility(Visibility_Public, Visibility_Protected,
+                   Visibility_Private, Visibility_Internal, Visibility__UNKNOWN),
+        SymbolKind(SymbolKind_Package, SymbolKind_Type, SymbolKind_Value,
+                   SymbolKind_File, SymbolKind_Module, SymbolKind_Namespace,
+                   SymbolKind_Class_, SymbolKind_Method, SymbolKind_Property,
+                   SymbolKind_Field, SymbolKind_Constructor, SymbolKind_Enum_,
+                   SymbolKind_Interface, SymbolKind_Function, SymbolKind_Variable,
+                   SymbolKind_Constant, SymbolKind_String, SymbolKind_Number,
+                   SymbolKind_Boolean, SymbolKind_Array, SymbolKind_Object_,
+                   SymbolKind_Key, SymbolKind_Null, SymbolKind_Enumerator,
+                   SymbolKind_Struct, SymbolKind_Event, SymbolKind_Operator,
+                   SymbolKind_TypeParameter, SymbolKind_Union, SymbolKind_Macro,
+                   SymbolKind_Trait, SymbolKind_Fragment, SymbolKind_Operation,
+                   SymbolKind_Directive, SymbolKind__UNKNOWN),
+        SymbolInfo(SymbolInfo, symbolInfo_kind, symbolInfo_isAbstract),
+        RangeSpan(RangeSpan_EMPTY, RangeSpan_span, RangeSpan_range),
+        RangeSpanContains_key(RangeSpanContains_key,
+                              rangeSpanContains_key_rangeSpan, rangeSpanContains_key_contains),
+        Modifiers(Modifiers, modifiers_isAbstract, modifiers_isFinal,
+                  modifiers_isAsync, modifiers_isStatic, modifiers_isReadonly,
+                  modifiers_isConst, modifiers_isMutable, modifiers_isVolatile,
+                  modifiers_isVirtual, modifiers_isInline),
+        Modifier(Modifier_Abstract, Modifier_Final, Modifier_Async,
+                 Modifier_Static, Modifier_Readonly, Modifier_Const,
+                 Modifier_Mutable, Modifier_Volatile, Modifier_Virtual,
+                 Modifier_Inline, Modifier__UNKNOWN),
+        Location(Location, location_name, location_file, location_location,
+                 location_destination),
+        XRefLocation(XRefLocation, xRefLocation_target,
+                     xRefLocation_source))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 110 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/CodemarkupTypes/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("RangeSpanContains", 1)]
+
+type RangeSpanContains_id = Glean.Id
+
+data RangeSpanContains = RangeSpanContains{rangeSpanContains_id ::
+                                           {-# UNPACK #-} !RangeSpanContains_id,
+                                           rangeSpanContains_key ::
+                                           Prelude.Maybe RangeSpanContains_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeSpanContains where
+  toJSON (RangeSpanContains __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RangeSpanContains where
+  buildStruct _proxy (RangeSpanContains __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RangeSpanContains __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RangeSpanContains where
+  rnf (RangeSpanContains __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RangeSpanContains where
+  def = RangeSpanContains Default.def Prelude.Nothing
+
+instance Hashable.Hashable RangeSpanContains where
+  hashWithSalt __salt (RangeSpanContains _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Visibility = Visibility_Public
+                | Visibility_Protected
+                | Visibility_Private
+                | Visibility_Internal
+                | Visibility__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Visibility where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Visibility where
+  rnf __Visibility = Prelude.seq __Visibility ()
+
+instance Default.Default Visibility where
+  def = Visibility_Public
+
+instance Hashable.Hashable Visibility where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Visibility where
+  toThriftEnum 0 = Visibility_Public
+  toThriftEnum 1 = Visibility_Protected
+  toThriftEnum 2 = Visibility_Private
+  toThriftEnum 3 = Visibility_Internal
+  toThriftEnum val = Visibility__UNKNOWN val
+  fromThriftEnum Visibility_Public = 0
+  fromThriftEnum Visibility_Protected = 1
+  fromThriftEnum Visibility_Private = 2
+  fromThriftEnum Visibility_Internal = 3
+  fromThriftEnum (Visibility__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Visibility_Public, Visibility_Protected, Visibility_Private,
+       Visibility_Internal]
+  toThriftEnumEither 0 = Prelude.Right Visibility_Public
+  toThriftEnumEither 1 = Prelude.Right Visibility_Protected
+  toThriftEnumEither 2 = Prelude.Right Visibility_Private
+  toThriftEnumEither 3 = Prelude.Right Visibility_Internal
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Visibility: "
+           ++ Prelude.show val)
+
+data SymbolKind = SymbolKind_Package
+                | SymbolKind_Type
+                | SymbolKind_Value
+                | SymbolKind_File
+                | SymbolKind_Module
+                | SymbolKind_Namespace
+                | SymbolKind_Class_
+                | SymbolKind_Method
+                | SymbolKind_Property
+                | SymbolKind_Field
+                | SymbolKind_Constructor
+                | SymbolKind_Enum_
+                | SymbolKind_Interface
+                | SymbolKind_Function
+                | SymbolKind_Variable
+                | SymbolKind_Constant
+                | SymbolKind_String
+                | SymbolKind_Number
+                | SymbolKind_Boolean
+                | SymbolKind_Array
+                | SymbolKind_Object_
+                | SymbolKind_Key
+                | SymbolKind_Null
+                | SymbolKind_Enumerator
+                | SymbolKind_Struct
+                | SymbolKind_Event
+                | SymbolKind_Operator
+                | SymbolKind_TypeParameter
+                | SymbolKind_Union
+                | SymbolKind_Macro
+                | SymbolKind_Trait
+                | SymbolKind_Fragment
+                | SymbolKind_Operation
+                | SymbolKind_Directive
+                | SymbolKind__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData SymbolKind where
+  rnf __SymbolKind = Prelude.seq __SymbolKind ()
+
+instance Default.Default SymbolKind where
+  def = SymbolKind_Package
+
+instance Hashable.Hashable SymbolKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum SymbolKind where
+  toThriftEnum 0 = SymbolKind_Package
+  toThriftEnum 1 = SymbolKind_Type
+  toThriftEnum 2 = SymbolKind_Value
+  toThriftEnum 3 = SymbolKind_File
+  toThriftEnum 4 = SymbolKind_Module
+  toThriftEnum 5 = SymbolKind_Namespace
+  toThriftEnum 6 = SymbolKind_Class_
+  toThriftEnum 7 = SymbolKind_Method
+  toThriftEnum 8 = SymbolKind_Property
+  toThriftEnum 9 = SymbolKind_Field
+  toThriftEnum 10 = SymbolKind_Constructor
+  toThriftEnum 11 = SymbolKind_Enum_
+  toThriftEnum 12 = SymbolKind_Interface
+  toThriftEnum 13 = SymbolKind_Function
+  toThriftEnum 14 = SymbolKind_Variable
+  toThriftEnum 15 = SymbolKind_Constant
+  toThriftEnum 16 = SymbolKind_String
+  toThriftEnum 17 = SymbolKind_Number
+  toThriftEnum 18 = SymbolKind_Boolean
+  toThriftEnum 19 = SymbolKind_Array
+  toThriftEnum 20 = SymbolKind_Object_
+  toThriftEnum 21 = SymbolKind_Key
+  toThriftEnum 22 = SymbolKind_Null
+  toThriftEnum 23 = SymbolKind_Enumerator
+  toThriftEnum 24 = SymbolKind_Struct
+  toThriftEnum 25 = SymbolKind_Event
+  toThriftEnum 26 = SymbolKind_Operator
+  toThriftEnum 27 = SymbolKind_TypeParameter
+  toThriftEnum 28 = SymbolKind_Union
+  toThriftEnum 29 = SymbolKind_Macro
+  toThriftEnum 30 = SymbolKind_Trait
+  toThriftEnum 31 = SymbolKind_Fragment
+  toThriftEnum 32 = SymbolKind_Operation
+  toThriftEnum 33 = SymbolKind_Directive
+  toThriftEnum val = SymbolKind__UNKNOWN val
+  fromThriftEnum SymbolKind_Package = 0
+  fromThriftEnum SymbolKind_Type = 1
+  fromThriftEnum SymbolKind_Value = 2
+  fromThriftEnum SymbolKind_File = 3
+  fromThriftEnum SymbolKind_Module = 4
+  fromThriftEnum SymbolKind_Namespace = 5
+  fromThriftEnum SymbolKind_Class_ = 6
+  fromThriftEnum SymbolKind_Method = 7
+  fromThriftEnum SymbolKind_Property = 8
+  fromThriftEnum SymbolKind_Field = 9
+  fromThriftEnum SymbolKind_Constructor = 10
+  fromThriftEnum SymbolKind_Enum_ = 11
+  fromThriftEnum SymbolKind_Interface = 12
+  fromThriftEnum SymbolKind_Function = 13
+  fromThriftEnum SymbolKind_Variable = 14
+  fromThriftEnum SymbolKind_Constant = 15
+  fromThriftEnum SymbolKind_String = 16
+  fromThriftEnum SymbolKind_Number = 17
+  fromThriftEnum SymbolKind_Boolean = 18
+  fromThriftEnum SymbolKind_Array = 19
+  fromThriftEnum SymbolKind_Object_ = 20
+  fromThriftEnum SymbolKind_Key = 21
+  fromThriftEnum SymbolKind_Null = 22
+  fromThriftEnum SymbolKind_Enumerator = 23
+  fromThriftEnum SymbolKind_Struct = 24
+  fromThriftEnum SymbolKind_Event = 25
+  fromThriftEnum SymbolKind_Operator = 26
+  fromThriftEnum SymbolKind_TypeParameter = 27
+  fromThriftEnum SymbolKind_Union = 28
+  fromThriftEnum SymbolKind_Macro = 29
+  fromThriftEnum SymbolKind_Trait = 30
+  fromThriftEnum SymbolKind_Fragment = 31
+  fromThriftEnum SymbolKind_Operation = 32
+  fromThriftEnum SymbolKind_Directive = 33
+  fromThriftEnum (SymbolKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [SymbolKind_Package, SymbolKind_Type, SymbolKind_Value,
+       SymbolKind_File, SymbolKind_Module, SymbolKind_Namespace,
+       SymbolKind_Class_, SymbolKind_Method, SymbolKind_Property,
+       SymbolKind_Field, SymbolKind_Constructor, SymbolKind_Enum_,
+       SymbolKind_Interface, SymbolKind_Function, SymbolKind_Variable,
+       SymbolKind_Constant, SymbolKind_String, SymbolKind_Number,
+       SymbolKind_Boolean, SymbolKind_Array, SymbolKind_Object_,
+       SymbolKind_Key, SymbolKind_Null, SymbolKind_Enumerator,
+       SymbolKind_Struct, SymbolKind_Event, SymbolKind_Operator,
+       SymbolKind_TypeParameter, SymbolKind_Union, SymbolKind_Macro,
+       SymbolKind_Trait, SymbolKind_Fragment, SymbolKind_Operation,
+       SymbolKind_Directive]
+  toThriftEnumEither 0 = Prelude.Right SymbolKind_Package
+  toThriftEnumEither 1 = Prelude.Right SymbolKind_Type
+  toThriftEnumEither 2 = Prelude.Right SymbolKind_Value
+  toThriftEnumEither 3 = Prelude.Right SymbolKind_File
+  toThriftEnumEither 4 = Prelude.Right SymbolKind_Module
+  toThriftEnumEither 5 = Prelude.Right SymbolKind_Namespace
+  toThriftEnumEither 6 = Prelude.Right SymbolKind_Class_
+  toThriftEnumEither 7 = Prelude.Right SymbolKind_Method
+  toThriftEnumEither 8 = Prelude.Right SymbolKind_Property
+  toThriftEnumEither 9 = Prelude.Right SymbolKind_Field
+  toThriftEnumEither 10 = Prelude.Right SymbolKind_Constructor
+  toThriftEnumEither 11 = Prelude.Right SymbolKind_Enum_
+  toThriftEnumEither 12 = Prelude.Right SymbolKind_Interface
+  toThriftEnumEither 13 = Prelude.Right SymbolKind_Function
+  toThriftEnumEither 14 = Prelude.Right SymbolKind_Variable
+  toThriftEnumEither 15 = Prelude.Right SymbolKind_Constant
+  toThriftEnumEither 16 = Prelude.Right SymbolKind_String
+  toThriftEnumEither 17 = Prelude.Right SymbolKind_Number
+  toThriftEnumEither 18 = Prelude.Right SymbolKind_Boolean
+  toThriftEnumEither 19 = Prelude.Right SymbolKind_Array
+  toThriftEnumEither 20 = Prelude.Right SymbolKind_Object_
+  toThriftEnumEither 21 = Prelude.Right SymbolKind_Key
+  toThriftEnumEither 22 = Prelude.Right SymbolKind_Null
+  toThriftEnumEither 23 = Prelude.Right SymbolKind_Enumerator
+  toThriftEnumEither 24 = Prelude.Right SymbolKind_Struct
+  toThriftEnumEither 25 = Prelude.Right SymbolKind_Event
+  toThriftEnumEither 26 = Prelude.Right SymbolKind_Operator
+  toThriftEnumEither 27 = Prelude.Right SymbolKind_TypeParameter
+  toThriftEnumEither 28 = Prelude.Right SymbolKind_Union
+  toThriftEnumEither 29 = Prelude.Right SymbolKind_Macro
+  toThriftEnumEither 30 = Prelude.Right SymbolKind_Trait
+  toThriftEnumEither 31 = Prelude.Right SymbolKind_Fragment
+  toThriftEnumEither 32 = Prelude.Right SymbolKind_Operation
+  toThriftEnumEither 33 = Prelude.Right SymbolKind_Directive
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum SymbolKind: "
+           ++ Prelude.show val)
+
+data SymbolInfo = SymbolInfo{symbolInfo_kind :: SymbolKind,
+                             symbolInfo_isAbstract :: Prelude.Bool}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolInfo where
+  toJSON (SymbolInfo __field__kind __field__isAbstract)
+    = Aeson.object
+        ("kind" .= __field__kind :
+           "isAbstract" .= __field__isAbstract : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolInfo where
+  buildStruct _proxy (SymbolInfo __field__kind __field__isAbstract)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           :
+           Thrift.genFieldBool _proxy "isAbstract" 2 1 __field__isAbstract :
+             [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             Prelude.pure (SymbolInfo __val__kind __val__isAbstract)
+              _idMap = HashMap.fromList [("kind", 1), ("isAbstract", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolInfo where
+  rnf (SymbolInfo __field__kind __field__isAbstract)
+    = DeepSeq.rnf __field__kind `Prelude.seq`
+        DeepSeq.rnf __field__isAbstract `Prelude.seq` ()
+
+instance Default.Default SymbolInfo where
+  def = SymbolInfo Default.def Prelude.False
+
+instance Hashable.Hashable SymbolInfo where
+  hashWithSalt __salt (SymbolInfo _kind _isAbstract)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kind)
+        _isAbstract
+
+data RangeSpan = RangeSpan_span Glean.Schema.Src.ByteSpan
+               | RangeSpan_range Glean.Schema.Src.Range
+               | RangeSpan_EMPTY
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeSpan where
+  toJSON (RangeSpan_span __span) = Aeson.object ["span" .= __span]
+  toJSON (RangeSpan_range __range)
+    = Aeson.object ["range" .= __range]
+  toJSON RangeSpan_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct RangeSpan where
+  buildStruct _proxy (RangeSpan_span __span)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __span)]
+  buildStruct _proxy (RangeSpan_range __range)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __range)]
+  buildStruct _proxy RangeSpan_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RangeSpan_span _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RangeSpan_range _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return RangeSpan_EMPTY
+           Thrift.FieldEnd -> Prelude.return RangeSpan_EMPTY
+    where
+      _idMap = HashMap.fromList [("span", 1), ("range", 2)]
+
+instance DeepSeq.NFData RangeSpan where
+  rnf (RangeSpan_span __span) = DeepSeq.rnf __span
+  rnf (RangeSpan_range __range) = DeepSeq.rnf __range
+  rnf RangeSpan_EMPTY = ()
+
+instance Default.Default RangeSpan where
+  def = RangeSpan_EMPTY
+
+instance Hashable.Hashable RangeSpan where
+  hashWithSalt __salt (RangeSpan_span _span)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _span)
+  hashWithSalt __salt (RangeSpan_range _range)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _range)
+  hashWithSalt __salt RangeSpan_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data RangeSpanContains_key = RangeSpanContains_key{rangeSpanContains_key_rangeSpan
+                                                   :: RangeSpan,
+                                                   rangeSpanContains_key_contains :: RangeSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeSpanContains_key where
+  toJSON (RangeSpanContains_key __field__rangeSpan __field__contains)
+    = Aeson.object
+        ("rangeSpan" .= __field__rangeSpan :
+           "contains" .= __field__contains : Prelude.mempty)
+
+instance Thrift.ThriftStruct RangeSpanContains_key where
+  buildStruct _proxy
+    (RangeSpanContains_key __field__rangeSpan __field__contains)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "rangeSpan" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__rangeSpan)
+           :
+           Thrift.genField _proxy "contains" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__contains)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__rangeSpan <- ST.newSTRef Default.def
+            __field__contains <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__rangeSpan
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contains
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__rangeSpan <- ST.readSTRef
+                                                                    __field__rangeSpan
+                                             !__val__contains <- ST.readSTRef __field__contains
+                                             Prelude.pure
+                                               (RangeSpanContains_key __val__rangeSpan
+                                                  __val__contains)
+              _idMap = HashMap.fromList [("rangeSpan", 1), ("contains", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RangeSpanContains_key where
+  rnf (RangeSpanContains_key __field__rangeSpan __field__contains)
+    = DeepSeq.rnf __field__rangeSpan `Prelude.seq`
+        DeepSeq.rnf __field__contains `Prelude.seq` ()
+
+instance Default.Default RangeSpanContains_key where
+  def = RangeSpanContains_key Default.def Default.def
+
+instance Hashable.Hashable RangeSpanContains_key where
+  hashWithSalt __salt (RangeSpanContains_key _rangeSpan _contains)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _rangeSpan)
+        _contains
+
+data Modifiers = Modifiers{modifiers_isAbstract :: Prelude.Bool,
+                           modifiers_isFinal :: Prelude.Bool,
+                           modifiers_isAsync :: Prelude.Bool,
+                           modifiers_isStatic :: Prelude.Bool,
+                           modifiers_isReadonly :: Prelude.Bool,
+                           modifiers_isConst :: Prelude.Bool,
+                           modifiers_isMutable :: Prelude.Bool,
+                           modifiers_isVolatile :: Prelude.Bool,
+                           modifiers_isVirtual :: Prelude.Bool,
+                           modifiers_isInline :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Modifiers where
+  toJSON
+    (Modifiers __field__isAbstract __field__isFinal __field__isAsync
+       __field__isStatic __field__isReadonly __field__isConst
+       __field__isMutable __field__isVolatile __field__isVirtual
+       __field__isInline)
+    = Aeson.object
+        ("isAbstract" .= __field__isAbstract :
+           "isFinal" .= __field__isFinal :
+             "isAsync" .= __field__isAsync :
+               "isStatic" .= __field__isStatic :
+                 "isReadonly" .= __field__isReadonly :
+                   "isConst" .= __field__isConst :
+                     "isMutable" .= __field__isMutable :
+                       "isVolatile" .= __field__isVolatile :
+                         "isVirtual" .= __field__isVirtual :
+                           "isInline" .= __field__isInline : Prelude.mempty)
+
+instance Thrift.ThriftStruct Modifiers where
+  buildStruct _proxy
+    (Modifiers __field__isAbstract __field__isFinal __field__isAsync
+       __field__isStatic __field__isReadonly __field__isConst
+       __field__isMutable __field__isVolatile __field__isVirtual
+       __field__isInline)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "isAbstract" 1 0 __field__isAbstract :
+           Thrift.genFieldBool _proxy "isFinal" 2 1 __field__isFinal :
+             Thrift.genFieldBool _proxy "isAsync" 3 2 __field__isAsync :
+               Thrift.genFieldBool _proxy "isStatic" 4 3 __field__isStatic :
+                 Thrift.genFieldBool _proxy "isReadonly" 5 4 __field__isReadonly :
+                   Thrift.genFieldBool _proxy "isConst" 6 5 __field__isConst :
+                     Thrift.genFieldBool _proxy "isMutable" 7 6 __field__isMutable :
+                       Thrift.genFieldBool _proxy "isVolatile" 8 7 __field__isVolatile :
+                         Thrift.genFieldBool _proxy "isVirtual" 9 8 __field__isVirtual :
+                           Thrift.genFieldBool _proxy "isInline" 10 9 __field__isInline : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isFinal <- ST.newSTRef Prelude.False
+            __field__isAsync <- ST.newSTRef Prelude.False
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__isReadonly <- ST.newSTRef Prelude.False
+            __field__isConst <- ST.newSTRef Prelude.False
+            __field__isMutable <- ST.newSTRef Prelude.False
+            __field__isVolatile <- ST.newSTRef Prelude.False
+            __field__isVirtual <- ST.newSTRef Prelude.False
+            __field__isInline <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isFinal
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAsync
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isReadonly
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isConst
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isMutable
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVolatile
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVirtual
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__isInline
+                                                                           _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__isAbstract <- ST.readSTRef
+                                                                     __field__isAbstract
+                                             !__val__isFinal <- ST.readSTRef __field__isFinal
+                                             !__val__isAsync <- ST.readSTRef __field__isAsync
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__isReadonly <- ST.readSTRef __field__isReadonly
+                                             !__val__isConst <- ST.readSTRef __field__isConst
+                                             !__val__isMutable <- ST.readSTRef __field__isMutable
+                                             !__val__isVolatile <- ST.readSTRef __field__isVolatile
+                                             !__val__isVirtual <- ST.readSTRef __field__isVirtual
+                                             !__val__isInline <- ST.readSTRef __field__isInline
+                                             Prelude.pure
+                                               (Modifiers __val__isAbstract __val__isFinal
+                                                  __val__isAsync
+                                                  __val__isStatic
+                                                  __val__isReadonly
+                                                  __val__isConst
+                                                  __val__isMutable
+                                                  __val__isVolatile
+                                                  __val__isVirtual
+                                                  __val__isInline)
+              _idMap
+                = HashMap.fromList
+                    [("isAbstract", 1), ("isFinal", 2), ("isAsync", 3),
+                     ("isStatic", 4), ("isReadonly", 5), ("isConst", 6),
+                     ("isMutable", 7), ("isVolatile", 8), ("isVirtual", 9),
+                     ("isInline", 10)]
+            _parse 0)
+
+instance DeepSeq.NFData Modifiers where
+  rnf
+    (Modifiers __field__isAbstract __field__isFinal __field__isAsync
+       __field__isStatic __field__isReadonly __field__isConst
+       __field__isMutable __field__isVolatile __field__isVirtual
+       __field__isInline)
+    = DeepSeq.rnf __field__isAbstract `Prelude.seq`
+        DeepSeq.rnf __field__isFinal `Prelude.seq`
+          DeepSeq.rnf __field__isAsync `Prelude.seq`
+            DeepSeq.rnf __field__isStatic `Prelude.seq`
+              DeepSeq.rnf __field__isReadonly `Prelude.seq`
+                DeepSeq.rnf __field__isConst `Prelude.seq`
+                  DeepSeq.rnf __field__isMutable `Prelude.seq`
+                    DeepSeq.rnf __field__isVolatile `Prelude.seq`
+                      DeepSeq.rnf __field__isVirtual `Prelude.seq`
+                        DeepSeq.rnf __field__isInline `Prelude.seq` ()
+
+instance Default.Default Modifiers where
+  def
+    = Modifiers Prelude.False Prelude.False Prelude.False Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Modifiers where
+  hashWithSalt __salt
+    (Modifiers _isAbstract _isFinal _isAsync _isStatic _isReadonly
+       _isConst _isMutable _isVolatile _isVirtual _isInline)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _isAbstract)
+                                _isFinal)
+                             _isAsync)
+                          _isStatic)
+                       _isReadonly)
+                    _isConst)
+                 _isMutable)
+              _isVolatile)
+           _isVirtual)
+        _isInline
+
+data Modifier = Modifier_Abstract
+              | Modifier_Final
+              | Modifier_Async
+              | Modifier_Static
+              | Modifier_Readonly
+              | Modifier_Const
+              | Modifier_Mutable
+              | Modifier_Volatile
+              | Modifier_Virtual
+              | Modifier_Inline
+              | Modifier__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Modifier where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Modifier where
+  rnf __Modifier = Prelude.seq __Modifier ()
+
+instance Default.Default Modifier where
+  def = Modifier_Abstract
+
+instance Hashable.Hashable Modifier where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Modifier where
+  toThriftEnum 0 = Modifier_Abstract
+  toThriftEnum 1 = Modifier_Final
+  toThriftEnum 2 = Modifier_Async
+  toThriftEnum 3 = Modifier_Static
+  toThriftEnum 4 = Modifier_Readonly
+  toThriftEnum 5 = Modifier_Const
+  toThriftEnum 6 = Modifier_Mutable
+  toThriftEnum 7 = Modifier_Volatile
+  toThriftEnum 8 = Modifier_Virtual
+  toThriftEnum 9 = Modifier_Inline
+  toThriftEnum val = Modifier__UNKNOWN val
+  fromThriftEnum Modifier_Abstract = 0
+  fromThriftEnum Modifier_Final = 1
+  fromThriftEnum Modifier_Async = 2
+  fromThriftEnum Modifier_Static = 3
+  fromThriftEnum Modifier_Readonly = 4
+  fromThriftEnum Modifier_Const = 5
+  fromThriftEnum Modifier_Mutable = 6
+  fromThriftEnum Modifier_Volatile = 7
+  fromThriftEnum Modifier_Virtual = 8
+  fromThriftEnum Modifier_Inline = 9
+  fromThriftEnum (Modifier__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Modifier_Abstract, Modifier_Final, Modifier_Async,
+       Modifier_Static, Modifier_Readonly, Modifier_Const,
+       Modifier_Mutable, Modifier_Volatile, Modifier_Virtual,
+       Modifier_Inline]
+  toThriftEnumEither 0 = Prelude.Right Modifier_Abstract
+  toThriftEnumEither 1 = Prelude.Right Modifier_Final
+  toThriftEnumEither 2 = Prelude.Right Modifier_Async
+  toThriftEnumEither 3 = Prelude.Right Modifier_Static
+  toThriftEnumEither 4 = Prelude.Right Modifier_Readonly
+  toThriftEnumEither 5 = Prelude.Right Modifier_Const
+  toThriftEnumEither 6 = Prelude.Right Modifier_Mutable
+  toThriftEnumEither 7 = Prelude.Right Modifier_Volatile
+  toThriftEnumEither 8 = Prelude.Right Modifier_Virtual
+  toThriftEnumEither 9 = Prelude.Right Modifier_Inline
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Modifier: "
+           ++ Prelude.show val)
+
+data Location = Location{location_name :: Text.Text,
+                         location_file :: Glean.Schema.Src.File,
+                         location_location :: RangeSpan,
+                         location_destination ::
+                         Prelude.Maybe Glean.Schema.Src.FileLocation}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Location where
+  toJSON
+    (Location __field__name __field__file __field__location
+       __field__destination)
+    = Aeson.object
+        ("name" .= __field__name :
+           "file" .= __field__file :
+             "location" .= __field__location :
+               Prelude.maybe Prelude.id ((:) . ("destination" .=))
+                 __field__destination
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct Location where
+  buildStruct _proxy
+    (Location __field__name __field__file __field__location
+       __field__destination)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               :
+               case __field__destination of
+                 Prelude.Just _val -> Thrift.genField _proxy "destination"
+                                        (Thrift.getStructType _proxy)
+                                        4
+                                        3
+                                        (Thrift.buildStruct _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__destination <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__destination
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__destination <- ST.readSTRef
+                                                                      __field__destination
+                                             Prelude.pure
+                                               (Location __val__name __val__file __val__location
+                                                  __val__destination)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("file", 2), ("location", 3), ("destination", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Location where
+  rnf
+    (Location __field__name __field__file __field__location
+       __field__destination)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq`
+            DeepSeq.rnf __field__destination `Prelude.seq` ()
+
+instance Default.Default Location where
+  def = Location "" Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable Location where
+  hashWithSalt __salt (Location _name _file _location _destination)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _file)
+           _location)
+        _destination
+
+data XRefLocation = XRefLocation{xRefLocation_target :: Location,
+                                 xRefLocation_source :: RangeSpan}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefLocation where
+  toJSON (XRefLocation __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefLocation where
+  buildStruct _proxy (XRefLocation __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (XRefLocation __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefLocation where
+  rnf (XRefLocation __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default XRefLocation where
+  def = XRefLocation Default.def Default.def
+
+instance Hashable.Hashable XRefLocation where
+  hashWithSalt __salt (XRefLocation _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+{-# LINE 18 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupTypes.Types.RangeSpanContains_key
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.RangeSpanContains_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupTypes.Types.RangeSpanContains_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.RangeSpanContains_key"
+           (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.CodemarkupTypes.Types.RangeSpanContains_key
+     =
+     'Angle.TField "rangeSpan"
+       (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+       ('Angle.TField "contains"
+          (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.CodemarkupTypes.Types.RangeSpanContains
+         where
+  type KeyType Glean.Schema.CodemarkupTypes.Types.RangeSpanContains =
+       Glean.Schema.CodemarkupTypes.Types.RangeSpanContains_key
+  getName _proxy
+    = Glean.PredicateRef "codemarkup.types.RangeSpanContains" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.CodemarkupTypes.Types.rangeSpanContains_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.CodemarkupTypes.Types.RangeSpanContains x k
+  getFactKey
+    = Glean.Schema.CodemarkupTypes.Types.rangeSpanContains_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.CodemarkupTypes.Types.RangeSpanContains
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.XRefLocation
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.XRefLocation x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupTypes.Types.XRefLocation <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.XRefLocation" (Prelude.Just 1))
+{-# LINE 53 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupTypes.Types.XRefLocation
+     =
+     'Angle.TField "target"
+       (Glean.Schema.CodemarkupTypes.Types.Location)
+       ('Angle.TField "source"
+          (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+          ('Angle.TNoFields))
+{-# LINE 55 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.RangeSpan
+         where
+  buildRtsValue b Glean.Schema.CodemarkupTypes.Types.RangeSpan_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.RangeSpan_span x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.RangeSpan_range x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.CodemarkupTypes.Types.RangeSpan_EMPTY)
+        [Glean.mapD Glean.Schema.CodemarkupTypes.Types.RangeSpan_span,
+         Glean.mapD Glean.Schema.CodemarkupTypes.Types.RangeSpan_range]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.RangeSpan" (Prelude.Just 1))
+{-# LINE 71 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupTypes.Types.RangeSpan =
+     'Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+       ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 73 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.SymbolKind
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.SymbolKind" (Prelude.Just 1))
+{-# LINE 78 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupTypes.Types.SymbolKind =
+     'Angle.TField "Package" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Type" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Value" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "File" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Module" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Namespace" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Class_" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Method" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "Property" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Field" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "Constructor" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "Enum_" (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "Interface" (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "Function"
+                                              (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "Variable"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "Constant"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "String"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "Number"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "Boolean"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "Array"
+                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                ('Angle.TField "Object_"
+                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                   ('Angle.TField "Key"
+                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                      ('Angle.TField "Null"
+                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                         ('Angle.TField "Enumerator"
+                                                                            (Glean.Schema.Builtin.Types.Unit)
+                                                                            ('Angle.TField "Struct"
+                                                                               (Glean.Schema.Builtin.Types.Unit)
+                                                                               ('Angle.TField
+                                                                                  "Event"
+                                                                                  (Glean.Schema.Builtin.Types.Unit)
+                                                                                  ('Angle.TField
+                                                                                     "Operator"
+                                                                                     (Glean.Schema.Builtin.Types.Unit)
+                                                                                     ('Angle.TField
+                                                                                        "TypeParameter"
+                                                                                        (Glean.Schema.Builtin.Types.Unit)
+                                                                                        ('Angle.TField
+                                                                                           "Union"
+                                                                                           (Glean.Schema.Builtin.Types.Unit)
+                                                                                           ('Angle.TField
+                                                                                              "Macro"
+                                                                                              (Glean.Schema.Builtin.Types.Unit)
+                                                                                              ('Angle.TField
+                                                                                                 "Trait"
+                                                                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                                                                 ('Angle.TField
+                                                                                                    "Fragment"
+                                                                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                                                                    ('Angle.TField
+                                                                                                       "Operation"
+                                                                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                                                                       ('Angle.TField
+                                                                                                          "Directive"
+                                                                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                                                                          ('Angle.TNoFields))))))))))))))))))))))))))))))))))
+{-# LINE 80 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.CodemarkupTypes.Types.SymbolKind
+         where
+  type AngleEnumTy Glean.Schema.CodemarkupTypes.Types.SymbolKind =
+       Glean.Schema.CodemarkupTypes.Types.SymbolKind
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 84 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.Visibility
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.Visibility" (Prelude.Just 1))
+{-# LINE 89 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupTypes.Types.Visibility =
+     'Angle.TField "Public" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Protected" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Private" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Internal" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 91 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.CodemarkupTypes.Types.Visibility
+         where
+  type AngleEnumTy Glean.Schema.CodemarkupTypes.Types.Visibility =
+       Glean.Schema.CodemarkupTypes.Types.Visibility
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 95 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.Modifier
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.Modifier" (Prelude.Just 1))
+{-# LINE 100 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.CodemarkupTypes.Types.Modifier =
+     'Angle.TField "Abstract" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Final" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Async" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Static" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Readonly" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Const" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Mutable" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Volatile" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "Virtual" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Inline" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 102 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.CodemarkupTypes.Types.Modifier
+         where
+  type AngleEnumTy Glean.Schema.CodemarkupTypes.Types.Modifier =
+       Glean.Schema.CodemarkupTypes.Types.Modifier
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 106 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.Modifiers
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.Modifiers x1 x2 x3 x4 x5 x6 x7
+       x8 x9 x10)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+  decodeRtsValue
+    = Glean.Schema.CodemarkupTypes.Types.Modifiers <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.Modifiers" (Prelude.Just 1))
+{-# LINE 131 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupTypes.Types.Modifiers =
+     'Angle.TField "isAbstract" (Prelude.Bool)
+       ('Angle.TField "isFinal" (Prelude.Bool)
+          ('Angle.TField "isAsync" (Prelude.Bool)
+             ('Angle.TField "isStatic" (Prelude.Bool)
+                ('Angle.TField "isReadonly" (Prelude.Bool)
+                   ('Angle.TField "isConst" (Prelude.Bool)
+                      ('Angle.TField "isMutable" (Prelude.Bool)
+                         ('Angle.TField "isVolatile" (Prelude.Bool)
+                            ('Angle.TField "isVirtual" (Prelude.Bool)
+                               ('Angle.TField "isInline" (Prelude.Bool)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 133 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.SymbolInfo
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.SymbolInfo x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.CodemarkupTypes.Types.SymbolInfo <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.SymbolInfo" (Prelude.Just 1))
+{-# LINE 142 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupTypes.Types.SymbolInfo =
+     'Angle.TField "kind"
+       (Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+       ('Angle.TField "isAbstract" (Prelude.Bool) ('Angle.TNoFields))
+{-# LINE 144 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+instance Glean.Type Glean.Schema.CodemarkupTypes.Types.Location
+         where
+  buildRtsValue b
+    (Glean.Schema.CodemarkupTypes.Types.Location x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.CodemarkupTypes.Types.Location <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "codemarkup.types.Location" (Prelude.Just 1))
+{-# LINE 157 "glean/schema/thrift/codemarkup_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.CodemarkupTypes.Types.Location =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "location"
+             (Glean.Schema.CodemarkupTypes.Types.RangeSpan)
+             ('Angle.TField "destination"
+                (Prelude.Maybe Glean.Schema.Src.Types.FileLocation)
+                ('Angle.TNoFields))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Csharp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Csharp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Csharp/Types.hs
@@ -0,0 +1,10593 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/csharp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/csharp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/csharp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Csharp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Csharp.Types
+       (pREDICATE_VERSIONS, UnityPackageToProject_id,
+        UnityPackageToProject(UnityPackageToProject,
+                              unityPackageToProject_id, unityPackageToProject_key),
+        UnityPackage_id,
+        UnityPackage(UnityPackage, unityPackage_id, unityPackage_key),
+        UnityProjectSource_id,
+        UnityProjectSource(UnityProjectSource, unityProjectSource_id,
+                           unityProjectSource_key),
+        TypeParameter_id,
+        TypeParameter(TypeParameter, typeParameter_id, typeParameter_key),
+        SourceFileToProject_id,
+        SourceFileToProject(SourceFileToProject, sourceFileToProject_id,
+                            sourceFileToProject_key),
+        SolutionToProject_id,
+        SolutionToProject(SolutionToProject, solutionToProject_id,
+                          solutionToProject_key),
+        Solution_id, Solution(Solution, solution_id, solution_key),
+        ProjectToSourceFile_id,
+        ProjectToSourceFile(ProjectToSourceFile, projectToSourceFile_id,
+                            projectToSourceFile_key),
+        ProjectToSolution_id,
+        ProjectToSolution(ProjectToSolution, projectToSolution_id,
+                          projectToSolution_key),
+        Project_id, Project(Project, project_id, project_key),
+        Namespace_id, Namespace(Namespace, namespace_id, namespace_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        Name_id, Name(Name, name_id, name_key), MSBuildProjectSource_id,
+        MSBuildProjectSource(MSBuildProjectSource, mSBuildProjectSource_id,
+                             mSBuildProjectSource_key),
+        MemberAccessLocation_id,
+        MemberAccessLocation(MemberAccessLocation, memberAccessLocation_id,
+                             memberAccessLocation_key),
+        MethodInvocationLocation_id,
+        MethodInvocationLocation(MethodInvocationLocation,
+                                 methodInvocationLocation_id, methodInvocationLocation_key),
+        Implements_id,
+        Implements(Implements, implements_id, implements_key),
+        FunctionPointerType_id,
+        FunctionPointerType(FunctionPointerType, functionPointerType_id,
+                            functionPointerType_key),
+        FullName_id, FullName(FullName, fullName_id, fullName_key),
+        Class_id, Class(Class, class_id, class_key), Interface_id,
+        Interface(Interface, interface_id, interface_key), Record_id,
+        Record(Record, record_id, record_key), Struct_id,
+        Struct(Struct, struct_id, struct_key), ArrayType_id,
+        ArrayType(ArrayType, arrayType_id, arrayType_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        DefinitionLocationName_id,
+        DefinitionLocationName(DefinitionLocationName,
+                               definitionLocationName_id, definitionLocationName_key),
+        FileDefinitions_id,
+        FileDefinitions(FileDefinitions, fileDefinitions_id,
+                        fileDefinitions_key),
+        FileEntityXRefs_id,
+        FileEntityXRefs(FileEntityXRefs, fileEntityXRefs_id,
+                        fileEntityXRefs_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        Field_id, Field(Field, field_id, field_key), Local_id,
+        Local(Local, local_id, local_key), Method_id,
+        Method(Method, method_id, method_key), ObjectCreationLocation_id,
+        ObjectCreationLocation(ObjectCreationLocation,
+                               objectCreationLocation_id, objectCreationLocation_key),
+        Parameter_id, Parameter(Parameter, parameter_id, parameter_key),
+        PointerType_id,
+        PointerType(PointerType, pointerType_id, pointerType_key),
+        Property_id, Property(Property, property_id, property_key),
+        TypeLocation_id,
+        TypeLocation(TypeLocation, typeLocation_id, typeLocation_key),
+        Variance(Variance_In, Variance_None_, Variance_Out,
+                 Variance__UNKNOWN),
+        UnityPackageType(UnityPackageType_Undefined,
+                         UnityPackageType_ThirdParty, UnityPackageType_Core,
+                         UnityPackageType_Runtime, UnityPackageType_Modules,
+                         UnityPackageType_Worlds, UnityPackageType_Apps,
+                         UnityPackageType_Clones, UnityPackageType_TestPackages,
+                         UnityPackageType__UNKNOWN),
+        UnityPackageToProject_key(UnityPackageToProject_key,
+                                  unityPackageToProject_key_unityPackage,
+                                  unityPackageToProject_key_project),
+        UnityPackage_key(UnityPackage_key, unityPackage_key_type,
+                         unityPackage_key_name),
+        UnityAssemblyType(UnityAssemblyType_Package,
+                          UnityAssemblyType_Editor, UnityAssemblyType_Tests,
+                          UnityAssemblyType_TestsEditor, UnityAssemblyType_UnitTests,
+                          UnityAssemblyType_Internal, UnityAssemblyType_AllApis,
+                          UnityAssemblyType__UNKNOWN),
+        UnityProjectSource_key(UnityProjectSource_key,
+                               unityProjectSource_key_projectBasename,
+                               unityProjectSource_key_unityPackage,
+                               unityProjectSource_key_assemblyType,
+                               unityProjectSource_key_projectTemplate),
+        TypeParameter_key(TypeParameter_key, typeParameter_key_name,
+                          typeParameter_key_variance, typeParameter_key_hasNotNullConstraint,
+                          typeParameter_key_hasReferenceTypeConstraint,
+                          typeParameter_key_hasValueTypeConstraint),
+        SourceFileToProject_key(SourceFileToProject_key,
+                                sourceFileToProject_key_src, sourceFileToProject_key_project),
+        SolutionToProject_key(SolutionToProject_key,
+                              solutionToProject_key_solution, solutionToProject_key_project),
+        Solution_key(Solution_key, solution_key_src),
+        RefKind(RefKind_In, RefKind_None_, RefKind_Out, RefKind_Ref,
+                RefKind_RefReadOnly, RefKind__UNKNOWN),
+        ProjectToSourceFile_key(ProjectToSourceFile_key,
+                                projectToSourceFile_key_project, projectToSourceFile_key_src),
+        ProjectToSolution_key(ProjectToSolution_key,
+                              projectToSolution_key_project, projectToSolution_key_solution),
+        ProjectSource(ProjectSource_EMPTY,
+                      ProjectSource_unityProjectSource,
+                      ProjectSource_msbuildProjectSource),
+        Project_key(Project_key, project_key_source,
+                    project_key_platformTarget, project_key_targetFramework,
+                    project_key_sdk, project_key_outputType, project_key_assemblyName,
+                    project_key_rootNamespace),
+        Namespace_key(Namespace_key, namespace_key_name,
+                      namespace_key_containingNamespace),
+        NamedType(NamedType_EMPTY, NamedType_class_, NamedType_interface_,
+                  NamedType_record_, NamedType_struct_),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowercase, nameLowerCase_key_name),
+        MethodKind(MethodKind_AnonymousFunction,
+                   MethodKind_BuiltinOperator, MethodKind_Constructor,
+                   MethodKind_Conversion, MethodKind_DeclareMethod,
+                   MethodKind_DelegateInvoke, MethodKind_Destructor,
+                   MethodKind_EventAdd, MethodKind_EventRaise, MethodKind_EventRemove,
+                   MethodKind_ExplicitInterfaceImplementation,
+                   MethodKind_FunctionPointerSignature, MethodKind_LambdaMethod,
+                   MethodKind_LocalFunction, MethodKind_Ordinary,
+                   MethodKind_PropertyGet, MethodKind_PropertySet,
+                   MethodKind_ReducedExtension, MethodKind_SharedConstructor,
+                   MethodKind_StaticConstructor, MethodKind_UserDefinedOperator,
+                   MethodKind__UNKNOWN),
+        MethodInvocationExpression(MethodInvocationExpression,
+                                   methodInvocationExpression_memberAccess),
+        MemberAccessExpression(MemberAccessExpression_EMPTY,
+                               MemberAccessExpression_local, MemberAccessExpression_parameter,
+                               MemberAccessExpression_field, MemberAccessExpression_property,
+                               MemberAccessExpression_method),
+        MSBuildProjectSource_key(MSBuildProjectSource_key,
+                                 mSBuildProjectSource_key_src),
+        Location(Location, location_fileLocation, location_fileLines),
+        MemberAccessLocation_key(MemberAccessLocation_key,
+                                 memberAccessLocation_key_expression,
+                                 memberAccessLocation_key_location),
+        MethodInvocationLocation_key(MethodInvocationLocation_key,
+                                     methodInvocationLocation_key_method,
+                                     methodInvocationLocation_key_location,
+                                     methodInvocationLocation_key_expression),
+        Implements_key(Implements_key, implements_key_type,
+                       implements_key_interface_),
+        FunctionPointerType_key(FunctionPointerType_key,
+                                functionPointerType_key_name, functionPointerType_key_signature),
+        FullName_key(FullName_key, fullName_key_name,
+                     fullName_key_containingNamespace),
+        Accessibility(Accessibility_Friend, Accessibility_Internal,
+                      Accessibility_NotApplicable, Accessibility_Private,
+                      Accessibility_Protected, Accessibility_ProtectedAndFriend,
+                      Accessibility_ProtectedAndInternal,
+                      Accessibility_ProtectedOrFriend, Accessibility_ProtectedOrInternal,
+                      Accessibility_Public, Accessibility__UNKNOWN),
+        Class_key(Class_key, class_key_name, class_key_baseType,
+                  class_key_typeParameters, class_key_containingType,
+                  class_key_declaredAccessibility, class_key_isAbstract,
+                  class_key_isStatic, class_key_isSealed),
+        Interface_key(Interface_key, interface_key_name,
+                      interface_key_typeParameters, interface_key_containingType,
+                      interface_key_declaredAccessibility, interface_key_isStatic),
+        Record_key(Record_key, record_key_name, record_key_baseType,
+                   record_key_typeParameters, record_key_containingType,
+                   record_key_declaredAccessibility, record_key_isAbstract,
+                   record_key_isSealed),
+        Struct_key(Struct_key, struct_key_name, struct_key_typeParameters,
+                   struct_key_containingType, struct_key_declaredAccessibility),
+        AType(AType_EMPTY, AType_arrayType, AType_namedType,
+              AType_functionPointerType, AType_pointerType, AType_typeParameter),
+        ArrayType_key(ArrayType_key, arrayType_key_elementType,
+                      arrayType_key_rank),
+        Definition(Definition_EMPTY, Definition_type, Definition_method,
+                   Definition_field, Definition_parameter, Definition_typeParameter,
+                   Definition_local, Definition_property),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_definition,
+                               definitionLocation_key_location),
+        DefinitionLocationName_key(DefinitionLocationName_key,
+                                   definitionLocationName_key_decl, definitionLocationName_key_file,
+                                   definitionLocationName_key_span,
+                                   definitionLocationName_key_name),
+        FileDefinitions_key(FileDefinitions_key, fileDefinitions_key_file,
+                            fileDefinitions_key_defn),
+        FileEntityXRefs_key(FileEntityXRefs_key, fileEntityXRefs_key_file,
+                            fileEntityXRefs_key_use, fileEntityXRefs_key_target),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_defn),
+        Field_key(Field_key, field_key_name, field_key_type,
+                  field_key_containingType, field_key_declaredAccessibility,
+                  field_key_isConst, field_key_isReadonly, field_key_isVirtual),
+        Local_key(Local_key, local_key_name, local_key_type,
+                  local_key_containingMethod, local_key_refKind, local_key_isConst),
+        Method_key(Method_key, method_key_name, method_key_containingType,
+                   method_key_typeParameters, method_key_parameters,
+                   method_key_isStatic, method_key_returnType,
+                   method_key_declaredAccessibility),
+        ObjectCreationLocation_key(ObjectCreationLocation_key,
+                                   objectCreationLocation_key_type,
+                                   objectCreationLocation_key_constructor,
+                                   objectCreationLocation_key_location),
+        Parameter_key(Parameter_key, parameter_key_name,
+                      parameter_key_type, parameter_key_refKind, parameter_key_isThis,
+                      parameter_key_isParams, parameter_key_isOptional),
+        PointerType_key(PointerType_key, pointerType_key_pointedAtType),
+        Property_key(Property_key, property_key_name,
+                     property_key_containingType, property_key_type,
+                     property_key_parameters, property_key_getMethod,
+                     property_key_setMethod, property_key_isStatic,
+                     property_key_isIndexer),
+        TypeLocation_key(TypeLocation_key, typeLocation_key_type,
+                         typeLocation_key_location))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/csharp_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 297 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Csharp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("UnityPackageToProject", 1), ("FileDefinitions", 1),
+       ("ObjectCreationLocation", 1), ("Method", 1),
+       ("DefinitionLocationName", 1), ("ProjectToSolution", 1),
+       ("Local", 1), ("MSBuildProjectSource", 1), ("Implements", 1),
+       ("Namespace", 1), ("Name", 1), ("SearchByName", 1), ("Project", 1),
+       ("Solution", 1), ("Property", 1), ("FileEntityXRefs", 1),
+       ("ProjectToSourceFile", 1), ("UnityPackage", 1),
+       ("TypeParameter", 1), ("NameLowerCase", 1),
+       ("FunctionPointerType", 1), ("Interface", 1), ("PointerType", 1),
+       ("Record", 1), ("Struct", 1), ("DefinitionLocation", 1),
+       ("Parameter", 1), ("Field", 1), ("TypeLocation", 1),
+       ("MethodInvocationLocation", 1), ("UnityProjectSource", 1),
+       ("SolutionToProject", 1), ("Class", 1),
+       ("MemberAccessLocation", 1), ("ArrayType", 1), ("FullName", 1),
+       ("SourceFileToProject", 1)]
+
+type UnityPackageToProject_id = Glean.Id
+
+data UnityPackageToProject = UnityPackageToProject{unityPackageToProject_id
+                                                   :: {-# UNPACK #-} !UnityPackageToProject_id,
+                                                   unityPackageToProject_key ::
+                                                   Prelude.Maybe UnityPackageToProject_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityPackageToProject where
+  toJSON (UnityPackageToProject __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityPackageToProject where
+  buildStruct _proxy (UnityPackageToProject __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (UnityPackageToProject __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityPackageToProject where
+  rnf (UnityPackageToProject __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnityPackageToProject where
+  def = UnityPackageToProject Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnityPackageToProject where
+  hashWithSalt __salt (UnityPackageToProject _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UnityPackage_id = Glean.Id
+
+data UnityPackage = UnityPackage{unityPackage_id ::
+                                 {-# UNPACK #-} !UnityPackage_id,
+                                 unityPackage_key :: Prelude.Maybe UnityPackage_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityPackage where
+  toJSON (UnityPackage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityPackage where
+  buildStruct _proxy (UnityPackage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnityPackage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityPackage where
+  rnf (UnityPackage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnityPackage where
+  def = UnityPackage Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnityPackage where
+  hashWithSalt __salt (UnityPackage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UnityProjectSource_id = Glean.Id
+
+data UnityProjectSource = UnityProjectSource{unityProjectSource_id
+                                             :: {-# UNPACK #-} !UnityProjectSource_id,
+                                             unityProjectSource_key ::
+                                             Prelude.Maybe UnityProjectSource_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityProjectSource where
+  toJSON (UnityProjectSource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityProjectSource where
+  buildStruct _proxy (UnityProjectSource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnityProjectSource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityProjectSource where
+  rnf (UnityProjectSource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnityProjectSource where
+  def = UnityProjectSource Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnityProjectSource where
+  hashWithSalt __salt (UnityProjectSource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeParameter_id = Glean.Id
+
+data TypeParameter = TypeParameter{typeParameter_id ::
+                                   {-# UNPACK #-} !TypeParameter_id,
+                                   typeParameter_key :: Prelude.Maybe TypeParameter_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeParameter where
+  toJSON (TypeParameter __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeParameter where
+  buildStruct _proxy (TypeParameter __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeParameter __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeParameter where
+  rnf (TypeParameter __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeParameter where
+  def = TypeParameter Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeParameter where
+  hashWithSalt __salt (TypeParameter _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SourceFileToProject_id = Glean.Id
+
+data SourceFileToProject = SourceFileToProject{sourceFileToProject_id
+                                               :: {-# UNPACK #-} !SourceFileToProject_id,
+                                               sourceFileToProject_key ::
+                                               Prelude.Maybe SourceFileToProject_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceFileToProject where
+  toJSON (SourceFileToProject __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceFileToProject where
+  buildStruct _proxy (SourceFileToProject __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SourceFileToProject __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceFileToProject where
+  rnf (SourceFileToProject __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SourceFileToProject where
+  def = SourceFileToProject Default.def Prelude.Nothing
+
+instance Hashable.Hashable SourceFileToProject where
+  hashWithSalt __salt (SourceFileToProject _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SolutionToProject_id = Glean.Id
+
+data SolutionToProject = SolutionToProject{solutionToProject_id ::
+                                           {-# UNPACK #-} !SolutionToProject_id,
+                                           solutionToProject_key ::
+                                           Prelude.Maybe SolutionToProject_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SolutionToProject where
+  toJSON (SolutionToProject __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SolutionToProject where
+  buildStruct _proxy (SolutionToProject __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SolutionToProject __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SolutionToProject where
+  rnf (SolutionToProject __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SolutionToProject where
+  def = SolutionToProject Default.def Prelude.Nothing
+
+instance Hashable.Hashable SolutionToProject where
+  hashWithSalt __salt (SolutionToProject _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Solution_id = Glean.Id
+
+data Solution = Solution{solution_id ::
+                         {-# UNPACK #-} !Solution_id,
+                         solution_key :: Prelude.Maybe Solution_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Solution where
+  toJSON (Solution __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Solution where
+  buildStruct _proxy (Solution __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Solution __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Solution where
+  rnf (Solution __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Solution where
+  def = Solution Default.def Prelude.Nothing
+
+instance Hashable.Hashable Solution where
+  hashWithSalt __salt (Solution _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ProjectToSourceFile_id = Glean.Id
+
+data ProjectToSourceFile = ProjectToSourceFile{projectToSourceFile_id
+                                               :: {-# UNPACK #-} !ProjectToSourceFile_id,
+                                               projectToSourceFile_key ::
+                                               Prelude.Maybe ProjectToSourceFile_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectToSourceFile where
+  toJSON (ProjectToSourceFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectToSourceFile where
+  buildStruct _proxy (ProjectToSourceFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ProjectToSourceFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectToSourceFile where
+  rnf (ProjectToSourceFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ProjectToSourceFile where
+  def = ProjectToSourceFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable ProjectToSourceFile where
+  hashWithSalt __salt (ProjectToSourceFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ProjectToSolution_id = Glean.Id
+
+data ProjectToSolution = ProjectToSolution{projectToSolution_id ::
+                                           {-# UNPACK #-} !ProjectToSolution_id,
+                                           projectToSolution_key ::
+                                           Prelude.Maybe ProjectToSolution_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectToSolution where
+  toJSON (ProjectToSolution __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectToSolution where
+  buildStruct _proxy (ProjectToSolution __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ProjectToSolution __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectToSolution where
+  rnf (ProjectToSolution __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ProjectToSolution where
+  def = ProjectToSolution Default.def Prelude.Nothing
+
+instance Hashable.Hashable ProjectToSolution where
+  hashWithSalt __salt (ProjectToSolution _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Project_id = Glean.Id
+
+data Project = Project{project_id :: {-# UNPACK #-} !Project_id,
+                       project_key :: Prelude.Maybe Project_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Project where
+  toJSON (Project __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Project where
+  buildStruct _proxy (Project __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Project __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Project where
+  rnf (Project __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Project where
+  def = Project Default.def Prelude.Nothing
+
+instance Hashable.Hashable Project where
+  hashWithSalt __salt (Project _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Namespace_id = Glean.Id
+
+data Namespace = Namespace{namespace_id ::
+                           {-# UNPACK #-} !Namespace_id,
+                           namespace_key :: Prelude.Maybe Namespace_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Namespace where
+  toJSON (Namespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Namespace where
+  buildStruct _proxy (Namespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Namespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Namespace where
+  rnf (Namespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Namespace where
+  def = Namespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable Namespace where
+  hashWithSalt __salt (Namespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MSBuildProjectSource_id = Glean.Id
+
+data MSBuildProjectSource = MSBuildProjectSource{mSBuildProjectSource_id
+                                                 :: {-# UNPACK #-} !MSBuildProjectSource_id,
+                                                 mSBuildProjectSource_key ::
+                                                 Prelude.Maybe MSBuildProjectSource_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MSBuildProjectSource where
+  toJSON (MSBuildProjectSource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MSBuildProjectSource where
+  buildStruct _proxy (MSBuildProjectSource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MSBuildProjectSource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MSBuildProjectSource where
+  rnf (MSBuildProjectSource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MSBuildProjectSource where
+  def = MSBuildProjectSource Default.def Prelude.Nothing
+
+instance Hashable.Hashable MSBuildProjectSource where
+  hashWithSalt __salt (MSBuildProjectSource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MemberAccessLocation_id = Glean.Id
+
+data MemberAccessLocation = MemberAccessLocation{memberAccessLocation_id
+                                                 :: {-# UNPACK #-} !MemberAccessLocation_id,
+                                                 memberAccessLocation_key ::
+                                                 Prelude.Maybe MemberAccessLocation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberAccessLocation where
+  toJSON (MemberAccessLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberAccessLocation where
+  buildStruct _proxy (MemberAccessLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MemberAccessLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberAccessLocation where
+  rnf (MemberAccessLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MemberAccessLocation where
+  def = MemberAccessLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable MemberAccessLocation where
+  hashWithSalt __salt (MemberAccessLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodInvocationLocation_id = Glean.Id
+
+data MethodInvocationLocation = MethodInvocationLocation{methodInvocationLocation_id
+                                                         ::
+                                                         {-# UNPACK #-} !MethodInvocationLocation_id,
+                                                         methodInvocationLocation_key ::
+                                                         Prelude.Maybe MethodInvocationLocation_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodInvocationLocation where
+  toJSON (MethodInvocationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodInvocationLocation where
+  buildStruct _proxy
+    (MethodInvocationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MethodInvocationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodInvocationLocation where
+  rnf (MethodInvocationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodInvocationLocation where
+  def = MethodInvocationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodInvocationLocation where
+  hashWithSalt __salt (MethodInvocationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Implements_id = Glean.Id
+
+data Implements = Implements{implements_id ::
+                             {-# UNPACK #-} !Implements_id,
+                             implements_key :: Prelude.Maybe Implements_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Implements where
+  toJSON (Implements __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Implements where
+  buildStruct _proxy (Implements __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Implements __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Implements where
+  rnf (Implements __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Implements where
+  def = Implements Default.def Prelude.Nothing
+
+instance Hashable.Hashable Implements where
+  hashWithSalt __salt (Implements _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionPointerType_id = Glean.Id
+
+data FunctionPointerType = FunctionPointerType{functionPointerType_id
+                                               :: {-# UNPACK #-} !FunctionPointerType_id,
+                                               functionPointerType_key ::
+                                               Prelude.Maybe FunctionPointerType_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionPointerType where
+  toJSON (FunctionPointerType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionPointerType where
+  buildStruct _proxy (FunctionPointerType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionPointerType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionPointerType where
+  rnf (FunctionPointerType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionPointerType where
+  def = FunctionPointerType Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionPointerType where
+  hashWithSalt __salt (FunctionPointerType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FullName_id = Glean.Id
+
+data FullName = FullName{fullName_id ::
+                         {-# UNPACK #-} !FullName_id,
+                         fullName_key :: Prelude.Maybe FullName_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FullName where
+  toJSON (FullName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FullName where
+  buildStruct _proxy (FullName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FullName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FullName where
+  rnf (FullName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FullName where
+  def = FullName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FullName where
+  hashWithSalt __salt (FullName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Class_id = Glean.Id
+
+data Class = Class{class_id :: {-# UNPACK #-} !Class_id,
+                   class_key :: Prelude.Maybe Class_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Class where
+  toJSON (Class __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Class where
+  buildStruct _proxy (Class __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Class __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Class where
+  rnf (Class __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Class where
+  def = Class Default.def Prelude.Nothing
+
+instance Hashable.Hashable Class where
+  hashWithSalt __salt (Class _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Interface_id = Glean.Id
+
+data Interface = Interface{interface_id ::
+                           {-# UNPACK #-} !Interface_id,
+                           interface_key :: Prelude.Maybe Interface_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Interface where
+  toJSON (Interface __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Interface where
+  buildStruct _proxy (Interface __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Interface __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Interface where
+  rnf (Interface __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Interface where
+  def = Interface Default.def Prelude.Nothing
+
+instance Hashable.Hashable Interface where
+  hashWithSalt __salt (Interface _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Record_id = Glean.Id
+
+data Record = Record{record_id :: {-# UNPACK #-} !Record_id,
+                     record_key :: Prelude.Maybe Record_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Record where
+  toJSON (Record __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Record where
+  buildStruct _proxy (Record __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Record __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Record where
+  rnf (Record __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Record where
+  def = Record Default.def Prelude.Nothing
+
+instance Hashable.Hashable Record where
+  hashWithSalt __salt (Record _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Struct_id = Glean.Id
+
+data Struct = Struct{struct_id :: {-# UNPACK #-} !Struct_id,
+                     struct_key :: Prelude.Maybe Struct_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Struct where
+  toJSON (Struct __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Struct where
+  buildStruct _proxy (Struct __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Struct __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Struct where
+  rnf (Struct __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Struct where
+  def = Struct Default.def Prelude.Nothing
+
+instance Hashable.Hashable Struct where
+  hashWithSalt __salt (Struct _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ArrayType_id = Glean.Id
+
+data ArrayType = ArrayType{arrayType_id ::
+                           {-# UNPACK #-} !ArrayType_id,
+                           arrayType_key :: Prelude.Maybe ArrayType_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArrayType where
+  toJSON (ArrayType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ArrayType where
+  buildStruct _proxy (ArrayType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ArrayType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArrayType where
+  rnf (ArrayType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ArrayType where
+  def = ArrayType Default.def Prelude.Nothing
+
+instance Hashable.Hashable ArrayType where
+  hashWithSalt __salt (ArrayType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocationName_id = Glean.Id
+
+data DefinitionLocationName = DefinitionLocationName{definitionLocationName_id
+                                                     :: {-# UNPACK #-} !DefinitionLocationName_id,
+                                                     definitionLocationName_key ::
+                                                     Prelude.Maybe DefinitionLocationName_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocationName where
+  toJSON (DefinitionLocationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocationName where
+  buildStruct _proxy
+    (DefinitionLocationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DefinitionLocationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocationName where
+  rnf (DefinitionLocationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocationName where
+  def = DefinitionLocationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocationName where
+  hashWithSalt __salt (DefinitionLocationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDefinitions_id = Glean.Id
+
+data FileDefinitions = FileDefinitions{fileDefinitions_id ::
+                                       {-# UNPACK #-} !FileDefinitions_id,
+                                       fileDefinitions_key :: Prelude.Maybe FileDefinitions_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDefinitions where
+  toJSON (FileDefinitions __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDefinitions where
+  buildStruct _proxy (FileDefinitions __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDefinitions __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDefinitions where
+  rnf (FileDefinitions __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDefinitions where
+  def = FileDefinitions Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDefinitions where
+  hashWithSalt __salt (FileDefinitions _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefs_id = Glean.Id
+
+data FileEntityXRefs = FileEntityXRefs{fileEntityXRefs_id ::
+                                       {-# UNPACK #-} !FileEntityXRefs_id,
+                                       fileEntityXRefs_key :: Prelude.Maybe FileEntityXRefs_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefs where
+  toJSON (FileEntityXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefs where
+  buildStruct _proxy (FileEntityXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileEntityXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefs where
+  rnf (FileEntityXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefs where
+  def = FileEntityXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefs where
+  hashWithSalt __salt (FileEntityXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Field_id = Glean.Id
+
+data Field = Field{field_id :: {-# UNPACK #-} !Field_id,
+                   field_key :: Prelude.Maybe Field_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field where
+  toJSON (Field __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Field where
+  buildStruct _proxy (Field __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Field __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Field where
+  rnf (Field __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Field where
+  def = Field Default.def Prelude.Nothing
+
+instance Hashable.Hashable Field where
+  hashWithSalt __salt (Field _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Local_id = Glean.Id
+
+data Local = Local{local_id :: {-# UNPACK #-} !Local_id,
+                   local_key :: Prelude.Maybe Local_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Local where
+  toJSON (Local __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Local where
+  buildStruct _proxy (Local __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Local __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Local where
+  rnf (Local __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Local where
+  def = Local Default.def Prelude.Nothing
+
+instance Hashable.Hashable Local where
+  hashWithSalt __salt (Local _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Method_id = Glean.Id
+
+data Method = Method{method_id :: {-# UNPACK #-} !Method_id,
+                     method_key :: Prelude.Maybe Method_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Method where
+  toJSON (Method __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Method where
+  buildStruct _proxy (Method __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Method __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Method where
+  rnf (Method __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Method where
+  def = Method Default.def Prelude.Nothing
+
+instance Hashable.Hashable Method where
+  hashWithSalt __salt (Method _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjectCreationLocation_id = Glean.Id
+
+data ObjectCreationLocation = ObjectCreationLocation{objectCreationLocation_id
+                                                     :: {-# UNPACK #-} !ObjectCreationLocation_id,
+                                                     objectCreationLocation_key ::
+                                                     Prelude.Maybe ObjectCreationLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectCreationLocation where
+  toJSON (ObjectCreationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectCreationLocation where
+  buildStruct _proxy
+    (ObjectCreationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjectCreationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectCreationLocation where
+  rnf (ObjectCreationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjectCreationLocation where
+  def = ObjectCreationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjectCreationLocation where
+  hashWithSalt __salt (ObjectCreationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Parameter_id = Glean.Id
+
+data Parameter = Parameter{parameter_id ::
+                           {-# UNPACK #-} !Parameter_id,
+                           parameter_key :: Prelude.Maybe Parameter_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Parameter where
+  toJSON (Parameter __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Parameter where
+  buildStruct _proxy (Parameter __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Parameter __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Parameter where
+  rnf (Parameter __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Parameter where
+  def = Parameter Default.def Prelude.Nothing
+
+instance Hashable.Hashable Parameter where
+  hashWithSalt __salt (Parameter _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PointerType_id = Glean.Id
+
+data PointerType = PointerType{pointerType_id ::
+                               {-# UNPACK #-} !PointerType_id,
+                               pointerType_key :: Prelude.Maybe PointerType_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PointerType where
+  toJSON (PointerType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PointerType where
+  buildStruct _proxy (PointerType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PointerType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PointerType where
+  rnf (PointerType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PointerType where
+  def = PointerType Default.def Prelude.Nothing
+
+instance Hashable.Hashable PointerType where
+  hashWithSalt __salt (PointerType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Property_id = Glean.Id
+
+data Property = Property{property_id ::
+                         {-# UNPACK #-} !Property_id,
+                         property_key :: Prelude.Maybe Property_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Property where
+  toJSON (Property __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Property where
+  buildStruct _proxy (Property __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Property __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Property where
+  rnf (Property __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Property where
+  def = Property Default.def Prelude.Nothing
+
+instance Hashable.Hashable Property where
+  hashWithSalt __salt (Property _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeLocation_id = Glean.Id
+
+data TypeLocation = TypeLocation{typeLocation_id ::
+                                 {-# UNPACK #-} !TypeLocation_id,
+                                 typeLocation_key :: Prelude.Maybe TypeLocation_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeLocation where
+  toJSON (TypeLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeLocation where
+  buildStruct _proxy (TypeLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeLocation where
+  rnf (TypeLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeLocation where
+  def = TypeLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeLocation where
+  hashWithSalt __salt (TypeLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Variance = Variance_In
+              | Variance_None_
+              | Variance_Out
+              | Variance__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Variance where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Variance where
+  rnf __Variance = Prelude.seq __Variance ()
+
+instance Default.Default Variance where
+  def = Variance_In
+
+instance Hashable.Hashable Variance where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Variance where
+  toThriftEnum 0 = Variance_In
+  toThriftEnum 1 = Variance_None_
+  toThriftEnum 2 = Variance_Out
+  toThriftEnum val = Variance__UNKNOWN val
+  fromThriftEnum Variance_In = 0
+  fromThriftEnum Variance_None_ = 1
+  fromThriftEnum Variance_Out = 2
+  fromThriftEnum (Variance__UNKNOWN val) = val
+  allThriftEnumValues = [Variance_In, Variance_None_, Variance_Out]
+  toThriftEnumEither 0 = Prelude.Right Variance_In
+  toThriftEnumEither 1 = Prelude.Right Variance_None_
+  toThriftEnumEither 2 = Prelude.Right Variance_Out
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Variance: "
+           ++ Prelude.show val)
+
+data UnityPackageType = UnityPackageType_Undefined
+                      | UnityPackageType_ThirdParty
+                      | UnityPackageType_Core
+                      | UnityPackageType_Runtime
+                      | UnityPackageType_Modules
+                      | UnityPackageType_Worlds
+                      | UnityPackageType_Apps
+                      | UnityPackageType_Clones
+                      | UnityPackageType_TestPackages
+                      | UnityPackageType__UNKNOWN Prelude.Int
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityPackageType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData UnityPackageType where
+  rnf __UnityPackageType = Prelude.seq __UnityPackageType ()
+
+instance Default.Default UnityPackageType where
+  def = UnityPackageType_Undefined
+
+instance Hashable.Hashable UnityPackageType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum UnityPackageType where
+  toThriftEnum 0 = UnityPackageType_Undefined
+  toThriftEnum 1 = UnityPackageType_ThirdParty
+  toThriftEnum 2 = UnityPackageType_Core
+  toThriftEnum 3 = UnityPackageType_Runtime
+  toThriftEnum 4 = UnityPackageType_Modules
+  toThriftEnum 5 = UnityPackageType_Worlds
+  toThriftEnum 6 = UnityPackageType_Apps
+  toThriftEnum 7 = UnityPackageType_Clones
+  toThriftEnum 8 = UnityPackageType_TestPackages
+  toThriftEnum val = UnityPackageType__UNKNOWN val
+  fromThriftEnum UnityPackageType_Undefined = 0
+  fromThriftEnum UnityPackageType_ThirdParty = 1
+  fromThriftEnum UnityPackageType_Core = 2
+  fromThriftEnum UnityPackageType_Runtime = 3
+  fromThriftEnum UnityPackageType_Modules = 4
+  fromThriftEnum UnityPackageType_Worlds = 5
+  fromThriftEnum UnityPackageType_Apps = 6
+  fromThriftEnum UnityPackageType_Clones = 7
+  fromThriftEnum UnityPackageType_TestPackages = 8
+  fromThriftEnum (UnityPackageType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [UnityPackageType_Undefined, UnityPackageType_ThirdParty,
+       UnityPackageType_Core, UnityPackageType_Runtime,
+       UnityPackageType_Modules, UnityPackageType_Worlds,
+       UnityPackageType_Apps, UnityPackageType_Clones,
+       UnityPackageType_TestPackages]
+  toThriftEnumEither 0 = Prelude.Right UnityPackageType_Undefined
+  toThriftEnumEither 1 = Prelude.Right UnityPackageType_ThirdParty
+  toThriftEnumEither 2 = Prelude.Right UnityPackageType_Core
+  toThriftEnumEither 3 = Prelude.Right UnityPackageType_Runtime
+  toThriftEnumEither 4 = Prelude.Right UnityPackageType_Modules
+  toThriftEnumEither 5 = Prelude.Right UnityPackageType_Worlds
+  toThriftEnumEither 6 = Prelude.Right UnityPackageType_Apps
+  toThriftEnumEither 7 = Prelude.Right UnityPackageType_Clones
+  toThriftEnumEither 8 = Prelude.Right UnityPackageType_TestPackages
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum UnityPackageType: "
+           ++ Prelude.show val)
+
+data UnityPackageToProject_key = UnityPackageToProject_key{unityPackageToProject_key_unityPackage
+                                                           :: UnityPackage,
+                                                           unityPackageToProject_key_project ::
+                                                           Project}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityPackageToProject_key where
+  toJSON
+    (UnityPackageToProject_key __field__unityPackage __field__project)
+    = Aeson.object
+        ("unityPackage" .= __field__unityPackage :
+           "project" .= __field__project : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityPackageToProject_key where
+  buildStruct _proxy
+    (UnityPackageToProject_key __field__unityPackage __field__project)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "unityPackage"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__unityPackage)
+           :
+           Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__project)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__unityPackage <- ST.newSTRef Default.def
+            __field__project <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__unityPackage
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__unityPackage <- ST.readSTRef
+                                                                       __field__unityPackage
+                                             !__val__project <- ST.readSTRef __field__project
+                                             Prelude.pure
+                                               (UnityPackageToProject_key __val__unityPackage
+                                                  __val__project)
+              _idMap = HashMap.fromList [("unityPackage", 1), ("project", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityPackageToProject_key where
+  rnf
+    (UnityPackageToProject_key __field__unityPackage __field__project)
+    = DeepSeq.rnf __field__unityPackage `Prelude.seq`
+        DeepSeq.rnf __field__project `Prelude.seq` ()
+
+instance Default.Default UnityPackageToProject_key where
+  def = UnityPackageToProject_key Default.def Default.def
+
+instance Hashable.Hashable UnityPackageToProject_key where
+  hashWithSalt __salt
+    (UnityPackageToProject_key _unityPackage _project)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _unityPackage)
+        _project
+
+data UnityPackage_key = UnityPackage_key{unityPackage_key_type ::
+                                         UnityPackageType,
+                                         unityPackage_key_name :: Text.Text}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityPackage_key where
+  toJSON (UnityPackage_key __field__type __field__name)
+    = Aeson.object
+        ("type" .= __field__type :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityPackage_key where
+  buildStruct _proxy (UnityPackage_key __field__type __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__type)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "UnityPackageType")
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (UnityPackage_key __val__type __val__name)
+              _idMap = HashMap.fromList [("type", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityPackage_key where
+  rnf (UnityPackage_key __field__type __field__name)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default UnityPackage_key where
+  def = UnityPackage_key Default.def ""
+
+instance Hashable.Hashable UnityPackage_key where
+  hashWithSalt __salt (UnityPackage_key _type _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _name
+
+data UnityAssemblyType = UnityAssemblyType_Package
+                       | UnityAssemblyType_Editor
+                       | UnityAssemblyType_Tests
+                       | UnityAssemblyType_TestsEditor
+                       | UnityAssemblyType_UnitTests
+                       | UnityAssemblyType_Internal
+                       | UnityAssemblyType_AllApis
+                       | UnityAssemblyType__UNKNOWN Prelude.Int
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityAssemblyType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData UnityAssemblyType where
+  rnf __UnityAssemblyType = Prelude.seq __UnityAssemblyType ()
+
+instance Default.Default UnityAssemblyType where
+  def = UnityAssemblyType_Package
+
+instance Hashable.Hashable UnityAssemblyType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum UnityAssemblyType where
+  toThriftEnum 0 = UnityAssemblyType_Package
+  toThriftEnum 1 = UnityAssemblyType_Editor
+  toThriftEnum 2 = UnityAssemblyType_Tests
+  toThriftEnum 3 = UnityAssemblyType_TestsEditor
+  toThriftEnum 4 = UnityAssemblyType_UnitTests
+  toThriftEnum 5 = UnityAssemblyType_Internal
+  toThriftEnum 6 = UnityAssemblyType_AllApis
+  toThriftEnum val = UnityAssemblyType__UNKNOWN val
+  fromThriftEnum UnityAssemblyType_Package = 0
+  fromThriftEnum UnityAssemblyType_Editor = 1
+  fromThriftEnum UnityAssemblyType_Tests = 2
+  fromThriftEnum UnityAssemblyType_TestsEditor = 3
+  fromThriftEnum UnityAssemblyType_UnitTests = 4
+  fromThriftEnum UnityAssemblyType_Internal = 5
+  fromThriftEnum UnityAssemblyType_AllApis = 6
+  fromThriftEnum (UnityAssemblyType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [UnityAssemblyType_Package, UnityAssemblyType_Editor,
+       UnityAssemblyType_Tests, UnityAssemblyType_TestsEditor,
+       UnityAssemblyType_UnitTests, UnityAssemblyType_Internal,
+       UnityAssemblyType_AllApis]
+  toThriftEnumEither 0 = Prelude.Right UnityAssemblyType_Package
+  toThriftEnumEither 1 = Prelude.Right UnityAssemblyType_Editor
+  toThriftEnumEither 2 = Prelude.Right UnityAssemblyType_Tests
+  toThriftEnumEither 3 = Prelude.Right UnityAssemblyType_TestsEditor
+  toThriftEnumEither 4 = Prelude.Right UnityAssemblyType_UnitTests
+  toThriftEnumEither 5 = Prelude.Right UnityAssemblyType_Internal
+  toThriftEnumEither 6 = Prelude.Right UnityAssemblyType_AllApis
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum UnityAssemblyType: "
+           ++ Prelude.show val)
+
+data UnityProjectSource_key = UnityProjectSource_key{unityProjectSource_key_projectBasename
+                                                     :: Text.Text,
+                                                     unityProjectSource_key_unityPackage ::
+                                                     UnityPackage,
+                                                     unityProjectSource_key_assemblyType ::
+                                                     UnityAssemblyType,
+                                                     unityProjectSource_key_projectTemplate ::
+                                                     Glean.Schema.Src.File}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnityProjectSource_key where
+  toJSON
+    (UnityProjectSource_key __field__projectBasename
+       __field__unityPackage __field__assemblyType
+       __field__projectTemplate)
+    = Aeson.object
+        ("projectBasename" .= __field__projectBasename :
+           "unityPackage" .= __field__unityPackage :
+             "assemblyType" .= __field__assemblyType :
+               "projectTemplate" .= __field__projectTemplate : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnityProjectSource_key where
+  buildStruct _proxy
+    (UnityProjectSource_key __field__projectBasename
+       __field__unityPackage __field__assemblyType
+       __field__projectTemplate)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "projectBasename"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__projectBasename)
+           :
+           Thrift.genField _proxy "unityPackage" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__unityPackage)
+             :
+             Thrift.genField _proxy "assemblyType" (Thrift.getI32Type _proxy) 3
+               2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__assemblyType)
+               :
+               Thrift.genField _proxy "projectTemplate"
+                 (Thrift.getStructType _proxy)
+                 4
+                 3
+                 (Thrift.buildStruct _proxy __field__projectTemplate)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__projectBasename <- ST.newSTRef ""
+            __field__unityPackage <- ST.newSTRef Default.def
+            __field__assemblyType <- ST.newSTRef Default.def
+            __field__projectTemplate <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__projectBasename
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__unityPackage
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "UnityAssemblyType")
+                                                                        ST.writeSTRef
+                                                                          __field__assemblyType
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__projectTemplate
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__projectBasename <- ST.readSTRef
+                                                                          __field__projectBasename
+                                             !__val__unityPackage <- ST.readSTRef
+                                                                       __field__unityPackage
+                                             !__val__assemblyType <- ST.readSTRef
+                                                                       __field__assemblyType
+                                             !__val__projectTemplate <- ST.readSTRef
+                                                                          __field__projectTemplate
+                                             Prelude.pure
+                                               (UnityProjectSource_key __val__projectBasename
+                                                  __val__unityPackage
+                                                  __val__assemblyType
+                                                  __val__projectTemplate)
+              _idMap
+                = HashMap.fromList
+                    [("projectBasename", 1), ("unityPackage", 2), ("assemblyType", 3),
+                     ("projectTemplate", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData UnityProjectSource_key where
+  rnf
+    (UnityProjectSource_key __field__projectBasename
+       __field__unityPackage __field__assemblyType
+       __field__projectTemplate)
+    = DeepSeq.rnf __field__projectBasename `Prelude.seq`
+        DeepSeq.rnf __field__unityPackage `Prelude.seq`
+          DeepSeq.rnf __field__assemblyType `Prelude.seq`
+            DeepSeq.rnf __field__projectTemplate `Prelude.seq` ()
+
+instance Default.Default UnityProjectSource_key where
+  def = UnityProjectSource_key "" Default.def Default.def Default.def
+
+instance Hashable.Hashable UnityProjectSource_key where
+  hashWithSalt __salt
+    (UnityProjectSource_key _projectBasename _unityPackage
+       _assemblyType _projectTemplate)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _projectBasename)
+              _unityPackage)
+           _assemblyType)
+        _projectTemplate
+
+data TypeParameter_key = TypeParameter_key{typeParameter_key_name
+                                           :: Name,
+                                           typeParameter_key_variance :: Prelude.Maybe Variance,
+                                           typeParameter_key_hasNotNullConstraint :: Prelude.Bool,
+                                           typeParameter_key_hasReferenceTypeConstraint ::
+                                           Prelude.Bool,
+                                           typeParameter_key_hasValueTypeConstraint :: Prelude.Bool}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeParameter_key where
+  toJSON
+    (TypeParameter_key __field__name __field__variance
+       __field__hasNotNullConstraint __field__hasReferenceTypeConstraint
+       __field__hasValueTypeConstraint)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("variance" .=)) __field__variance
+             ("hasNotNullConstraint" .= __field__hasNotNullConstraint :
+                "hasReferenceTypeConstraint" .= __field__hasReferenceTypeConstraint
+                  :
+                  "hasValueTypeConstraint" .= __field__hasValueTypeConstraint :
+                    Prelude.mempty))
+
+instance Thrift.ThriftStruct TypeParameter_key where
+  buildStruct _proxy
+    (TypeParameter_key __field__name __field__variance
+       __field__hasNotNullConstraint __field__hasReferenceTypeConstraint
+       __field__hasValueTypeConstraint)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__variance, __id__variance)
+                 = case __field__variance of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "variance"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__variance
+               (Thrift.genFieldBool _proxy "hasNotNullConstraint" 3 __id__variance
+                  __field__hasNotNullConstraint
+                  :
+                  Thrift.genFieldBool _proxy "hasReferenceTypeConstraint" 4 3
+                    __field__hasReferenceTypeConstraint
+                    :
+                    Thrift.genFieldBool _proxy "hasValueTypeConstraint" 5 4
+                      __field__hasValueTypeConstraint
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__variance <- ST.newSTRef Prelude.Nothing
+            __field__hasNotNullConstraint <- ST.newSTRef Prelude.False
+            __field__hasReferenceTypeConstraint <- ST.newSTRef Prelude.False
+            __field__hasValueTypeConstraint <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Variance")
+                                                                        ST.writeSTRef
+                                                                          __field__variance
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasNotNullConstraint
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasReferenceTypeConstraint
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasValueTypeConstraint
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__variance <- ST.readSTRef __field__variance
+                                             !__val__hasNotNullConstraint <- ST.readSTRef
+                                                                               __field__hasNotNullConstraint
+                                             !__val__hasReferenceTypeConstraint <- ST.readSTRef
+                                                                                     __field__hasReferenceTypeConstraint
+                                             !__val__hasValueTypeConstraint <- ST.readSTRef
+                                                                                 __field__hasValueTypeConstraint
+                                             Prelude.pure
+                                               (TypeParameter_key __val__name __val__variance
+                                                  __val__hasNotNullConstraint
+                                                  __val__hasReferenceTypeConstraint
+                                                  __val__hasValueTypeConstraint)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("variance", 2), ("hasNotNullConstraint", 3),
+                     ("hasReferenceTypeConstraint", 4), ("hasValueTypeConstraint", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeParameter_key where
+  rnf
+    (TypeParameter_key __field__name __field__variance
+       __field__hasNotNullConstraint __field__hasReferenceTypeConstraint
+       __field__hasValueTypeConstraint)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__variance `Prelude.seq`
+          DeepSeq.rnf __field__hasNotNullConstraint `Prelude.seq`
+            DeepSeq.rnf __field__hasReferenceTypeConstraint `Prelude.seq`
+              DeepSeq.rnf __field__hasValueTypeConstraint `Prelude.seq` ()
+
+instance Default.Default TypeParameter_key where
+  def
+    = TypeParameter_key Default.def Prelude.Nothing Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable TypeParameter_key where
+  hashWithSalt __salt
+    (TypeParameter_key _name _variance _hasNotNullConstraint
+       _hasReferenceTypeConstraint _hasValueTypeConstraint)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _variance)
+              _hasNotNullConstraint)
+           _hasReferenceTypeConstraint)
+        _hasValueTypeConstraint
+
+data SourceFileToProject_key = SourceFileToProject_key{sourceFileToProject_key_src
+                                                       :: Glean.Schema.Src.File,
+                                                       sourceFileToProject_key_project :: Project}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceFileToProject_key where
+  toJSON (SourceFileToProject_key __field__src __field__project)
+    = Aeson.object
+        ("src" .= __field__src :
+           "project" .= __field__project : Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceFileToProject_key where
+  buildStruct _proxy
+    (SourceFileToProject_key __field__src __field__project)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "src" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__src)
+           :
+           Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__project)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__src <- ST.newSTRef Default.def
+            __field__project <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__src
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__src <- ST.readSTRef __field__src
+                                             !__val__project <- ST.readSTRef __field__project
+                                             Prelude.pure
+                                               (SourceFileToProject_key __val__src __val__project)
+              _idMap = HashMap.fromList [("src", 1), ("project", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceFileToProject_key where
+  rnf (SourceFileToProject_key __field__src __field__project)
+    = DeepSeq.rnf __field__src `Prelude.seq`
+        DeepSeq.rnf __field__project `Prelude.seq` ()
+
+instance Default.Default SourceFileToProject_key where
+  def = SourceFileToProject_key Default.def Default.def
+
+instance Hashable.Hashable SourceFileToProject_key where
+  hashWithSalt __salt (SourceFileToProject_key _src _project)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _src)
+        _project
+
+data SolutionToProject_key = SolutionToProject_key{solutionToProject_key_solution
+                                                   :: Solution,
+                                                   solutionToProject_key_project :: Project}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SolutionToProject_key where
+  toJSON (SolutionToProject_key __field__solution __field__project)
+    = Aeson.object
+        ("solution" .= __field__solution :
+           "project" .= __field__project : Prelude.mempty)
+
+instance Thrift.ThriftStruct SolutionToProject_key where
+  buildStruct _proxy
+    (SolutionToProject_key __field__solution __field__project)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "solution" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__solution)
+           :
+           Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__project)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__solution <- ST.newSTRef Default.def
+            __field__project <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__solution
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__solution <- ST.readSTRef
+                                                                   __field__solution
+                                             !__val__project <- ST.readSTRef __field__project
+                                             Prelude.pure
+                                               (SolutionToProject_key __val__solution
+                                                  __val__project)
+              _idMap = HashMap.fromList [("solution", 1), ("project", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SolutionToProject_key where
+  rnf (SolutionToProject_key __field__solution __field__project)
+    = DeepSeq.rnf __field__solution `Prelude.seq`
+        DeepSeq.rnf __field__project `Prelude.seq` ()
+
+instance Default.Default SolutionToProject_key where
+  def = SolutionToProject_key Default.def Default.def
+
+instance Hashable.Hashable SolutionToProject_key where
+  hashWithSalt __salt (SolutionToProject_key _solution _project)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _solution)
+        _project
+
+newtype Solution_key = Solution_key{solution_key_src ::
+                                    Glean.Schema.Src.File}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Solution_key where
+  toJSON (Solution_key __field__src)
+    = Aeson.object ("src" .= __field__src : Prelude.mempty)
+
+instance Thrift.ThriftStruct Solution_key where
+  buildStruct _proxy (Solution_key __field__src)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "src" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__src)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__src <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__src
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__src <- ST.readSTRef __field__src
+                                             Prelude.pure (Solution_key __val__src)
+              _idMap = HashMap.fromList [("src", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Solution_key where
+  rnf (Solution_key __field__src)
+    = DeepSeq.rnf __field__src `Prelude.seq` ()
+
+instance Default.Default Solution_key where
+  def = Solution_key Default.def
+
+instance Hashable.Hashable Solution_key where
+  hashWithSalt __salt (Solution_key _src)
+    = Hashable.hashWithSalt __salt _src
+
+data RefKind = RefKind_In
+             | RefKind_None_
+             | RefKind_Out
+             | RefKind_Ref
+             | RefKind_RefReadOnly
+             | RefKind__UNKNOWN Prelude.Int
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RefKind where
+  rnf __RefKind = Prelude.seq __RefKind ()
+
+instance Default.Default RefKind where
+  def = RefKind_In
+
+instance Hashable.Hashable RefKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RefKind where
+  toThriftEnum 0 = RefKind_In
+  toThriftEnum 1 = RefKind_None_
+  toThriftEnum 2 = RefKind_Out
+  toThriftEnum 3 = RefKind_Ref
+  toThriftEnum 4 = RefKind_RefReadOnly
+  toThriftEnum val = RefKind__UNKNOWN val
+  fromThriftEnum RefKind_In = 0
+  fromThriftEnum RefKind_None_ = 1
+  fromThriftEnum RefKind_Out = 2
+  fromThriftEnum RefKind_Ref = 3
+  fromThriftEnum RefKind_RefReadOnly = 4
+  fromThriftEnum (RefKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RefKind_In, RefKind_None_, RefKind_Out, RefKind_Ref,
+       RefKind_RefReadOnly]
+  toThriftEnumEither 0 = Prelude.Right RefKind_In
+  toThriftEnumEither 1 = Prelude.Right RefKind_None_
+  toThriftEnumEither 2 = Prelude.Right RefKind_Out
+  toThriftEnumEither 3 = Prelude.Right RefKind_Ref
+  toThriftEnumEither 4 = Prelude.Right RefKind_RefReadOnly
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RefKind: " ++
+           Prelude.show val)
+
+data ProjectToSourceFile_key = ProjectToSourceFile_key{projectToSourceFile_key_project
+                                                       :: Project,
+                                                       projectToSourceFile_key_src ::
+                                                       Glean.Schema.Src.File}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectToSourceFile_key where
+  toJSON (ProjectToSourceFile_key __field__project __field__src)
+    = Aeson.object
+        ("project" .= __field__project :
+           "src" .= __field__src : Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectToSourceFile_key where
+  buildStruct _proxy
+    (ProjectToSourceFile_key __field__project __field__src)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__project)
+           :
+           Thrift.genField _proxy "src" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__src)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__project <- ST.newSTRef Default.def
+            __field__src <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__src
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__project <- ST.readSTRef
+                                                                  __field__project
+                                             !__val__src <- ST.readSTRef __field__src
+                                             Prelude.pure
+                                               (ProjectToSourceFile_key __val__project __val__src)
+              _idMap = HashMap.fromList [("project", 1), ("src", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectToSourceFile_key where
+  rnf (ProjectToSourceFile_key __field__project __field__src)
+    = DeepSeq.rnf __field__project `Prelude.seq`
+        DeepSeq.rnf __field__src `Prelude.seq` ()
+
+instance Default.Default ProjectToSourceFile_key where
+  def = ProjectToSourceFile_key Default.def Default.def
+
+instance Hashable.Hashable ProjectToSourceFile_key where
+  hashWithSalt __salt (ProjectToSourceFile_key _project _src)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _project)
+        _src
+
+data ProjectToSolution_key = ProjectToSolution_key{projectToSolution_key_project
+                                                   :: Project,
+                                                   projectToSolution_key_solution :: Solution}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectToSolution_key where
+  toJSON (ProjectToSolution_key __field__project __field__solution)
+    = Aeson.object
+        ("project" .= __field__project :
+           "solution" .= __field__solution : Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectToSolution_key where
+  buildStruct _proxy
+    (ProjectToSolution_key __field__project __field__solution)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__project)
+           :
+           Thrift.genField _proxy "solution" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__solution)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__project <- ST.newSTRef Default.def
+            __field__solution <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__solution
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__project <- ST.readSTRef
+                                                                  __field__project
+                                             !__val__solution <- ST.readSTRef __field__solution
+                                             Prelude.pure
+                                               (ProjectToSolution_key __val__project
+                                                  __val__solution)
+              _idMap = HashMap.fromList [("project", 1), ("solution", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectToSolution_key where
+  rnf (ProjectToSolution_key __field__project __field__solution)
+    = DeepSeq.rnf __field__project `Prelude.seq`
+        DeepSeq.rnf __field__solution `Prelude.seq` ()
+
+instance Default.Default ProjectToSolution_key where
+  def = ProjectToSolution_key Default.def Default.def
+
+instance Hashable.Hashable ProjectToSolution_key where
+  hashWithSalt __salt (ProjectToSolution_key _project _solution)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _project)
+        _solution
+
+data ProjectSource = ProjectSource_unityProjectSource UnityProjectSource
+                   | ProjectSource_msbuildProjectSource MSBuildProjectSource
+                   | ProjectSource_EMPTY
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectSource where
+  toJSON (ProjectSource_unityProjectSource __unityProjectSource)
+    = Aeson.object ["unityProjectSource" .= __unityProjectSource]
+  toJSON (ProjectSource_msbuildProjectSource __msbuildProjectSource)
+    = Aeson.object ["msbuildProjectSource" .= __msbuildProjectSource]
+  toJSON ProjectSource_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ProjectSource where
+  buildStruct _proxy
+    (ProjectSource_unityProjectSource __unityProjectSource)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "unityProjectSource"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __unityProjectSource)]
+  buildStruct _proxy
+    (ProjectSource_msbuildProjectSource __msbuildProjectSource)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "msbuildProjectSource"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __msbuildProjectSource)]
+  buildStruct _proxy ProjectSource_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ProjectSource_unityProjectSource
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ProjectSource_msbuildProjectSource
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ProjectSource_EMPTY
+           Thrift.FieldEnd -> Prelude.return ProjectSource_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("unityProjectSource", 1), ("msbuildProjectSource", 2)]
+
+instance DeepSeq.NFData ProjectSource where
+  rnf (ProjectSource_unityProjectSource __unityProjectSource)
+    = DeepSeq.rnf __unityProjectSource
+  rnf (ProjectSource_msbuildProjectSource __msbuildProjectSource)
+    = DeepSeq.rnf __msbuildProjectSource
+  rnf ProjectSource_EMPTY = ()
+
+instance Default.Default ProjectSource where
+  def = ProjectSource_EMPTY
+
+instance Hashable.Hashable ProjectSource where
+  hashWithSalt __salt
+    (ProjectSource_unityProjectSource _unityProjectSource)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _unityProjectSource)
+  hashWithSalt __salt
+    (ProjectSource_msbuildProjectSource _msbuildProjectSource)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _msbuildProjectSource)
+  hashWithSalt __salt ProjectSource_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Project_key = Project_key{project_key_source :: ProjectSource,
+                               project_key_platformTarget :: Prelude.Maybe Text.Text,
+                               project_key_targetFramework :: Prelude.Maybe Text.Text,
+                               project_key_sdk :: Prelude.Maybe Text.Text,
+                               project_key_outputType :: Prelude.Maybe Text.Text,
+                               project_key_assemblyName :: Prelude.Maybe Text.Text,
+                               project_key_rootNamespace :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Project_key where
+  toJSON
+    (Project_key __field__source __field__platformTarget
+       __field__targetFramework __field__sdk __field__outputType
+       __field__assemblyName __field__rootNamespace)
+    = Aeson.object
+        ("source" .= __field__source :
+           Prelude.maybe Prelude.id ((:) . ("platformTarget" .=))
+             __field__platformTarget
+             (Prelude.maybe Prelude.id ((:) . ("targetFramework" .=))
+                __field__targetFramework
+                (Prelude.maybe Prelude.id ((:) . ("sdk" .=)) __field__sdk
+                   (Prelude.maybe Prelude.id ((:) . ("outputType" .=))
+                      __field__outputType
+                      (Prelude.maybe Prelude.id ((:) . ("assemblyName" .=))
+                         __field__assemblyName
+                         (Prelude.maybe Prelude.id ((:) . ("rootNamespace" .=))
+                            __field__rootNamespace
+                            Prelude.mempty))))))
+
+instance Thrift.ThriftStruct Project_key where
+  buildStruct _proxy
+    (Project_key __field__source __field__platformTarget
+       __field__targetFramework __field__sdk __field__outputType
+       __field__assemblyName __field__rootNamespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           let (__cereal__platformTarget, __id__platformTarget)
+                 = case __field__platformTarget of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "platformTarget"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genText _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__platformTarget
+               (let (__cereal__targetFramework, __id__targetFramework)
+                      = case __field__targetFramework of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "targetFramework"
+                                                     (Thrift.getStringType _proxy)
+                                                     3
+                                                     __id__platformTarget
+                                                     (Thrift.genText _proxy _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__platformTarget)
+                  in
+                  __cereal__targetFramework
+                    (let (__cereal__sdk, __id__sdk)
+                           = case __field__sdk of
+                               Prelude.Just _val -> ((:)
+                                                       (Thrift.genField _proxy "sdk"
+                                                          (Thrift.getStringType _proxy)
+                                                          4
+                                                          __id__targetFramework
+                                                          (Thrift.genText _proxy _val)),
+                                                     4)
+                               Prelude.Nothing -> (Prelude.id, __id__targetFramework)
+                       in
+                       __cereal__sdk
+                         (let (__cereal__outputType, __id__outputType)
+                                = case __field__outputType of
+                                    Prelude.Just _val -> ((:)
+                                                            (Thrift.genField _proxy "outputType"
+                                                               (Thrift.getStringType _proxy)
+                                                               5
+                                                               __id__sdk
+                                                               (Thrift.genText _proxy _val)),
+                                                          5)
+                                    Prelude.Nothing -> (Prelude.id, __id__sdk)
+                            in
+                            __cereal__outputType
+                              (let (__cereal__assemblyName, __id__assemblyName)
+                                     = case __field__assemblyName of
+                                         Prelude.Just _val -> ((:)
+                                                                 (Thrift.genField _proxy
+                                                                    "assemblyName"
+                                                                    (Thrift.getStringType _proxy)
+                                                                    6
+                                                                    __id__outputType
+                                                                    (Thrift.genText _proxy _val)),
+                                                               6)
+                                         Prelude.Nothing -> (Prelude.id, __id__outputType)
+                                 in
+                                 __cereal__assemblyName
+                                   (case __field__rootNamespace of
+                                      Prelude.Just _val -> Thrift.genField _proxy "rootNamespace"
+                                                             (Thrift.getStringType _proxy)
+                                                             7
+                                                             __id__assemblyName
+                                                             (Thrift.genText _proxy _val)
+                                                             : []
+                                      Prelude.Nothing -> []))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__platformTarget <- ST.newSTRef Prelude.Nothing
+            __field__targetFramework <- ST.newSTRef Prelude.Nothing
+            __field__sdk <- ST.newSTRef Prelude.Nothing
+            __field__outputType <- ST.newSTRef Prelude.Nothing
+            __field__assemblyName <- ST.newSTRef Prelude.Nothing
+            __field__rootNamespace <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__platformTarget
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetFramework
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sdk
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__outputType
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__assemblyName
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__rootNamespace
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__platformTarget <- ST.readSTRef
+                                                                         __field__platformTarget
+                                             !__val__targetFramework <- ST.readSTRef
+                                                                          __field__targetFramework
+                                             !__val__sdk <- ST.readSTRef __field__sdk
+                                             !__val__outputType <- ST.readSTRef __field__outputType
+                                             !__val__assemblyName <- ST.readSTRef
+                                                                       __field__assemblyName
+                                             !__val__rootNamespace <- ST.readSTRef
+                                                                        __field__rootNamespace
+                                             Prelude.pure
+                                               (Project_key __val__source __val__platformTarget
+                                                  __val__targetFramework
+                                                  __val__sdk
+                                                  __val__outputType
+                                                  __val__assemblyName
+                                                  __val__rootNamespace)
+              _idMap
+                = HashMap.fromList
+                    [("source", 1), ("platformTarget", 2), ("targetFramework", 3),
+                     ("sdk", 4), ("outputType", 5), ("assemblyName", 6),
+                     ("rootNamespace", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Project_key where
+  rnf
+    (Project_key __field__source __field__platformTarget
+       __field__targetFramework __field__sdk __field__outputType
+       __field__assemblyName __field__rootNamespace)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__platformTarget `Prelude.seq`
+          DeepSeq.rnf __field__targetFramework `Prelude.seq`
+            DeepSeq.rnf __field__sdk `Prelude.seq`
+              DeepSeq.rnf __field__outputType `Prelude.seq`
+                DeepSeq.rnf __field__assemblyName `Prelude.seq`
+                  DeepSeq.rnf __field__rootNamespace `Prelude.seq` ()
+
+instance Default.Default Project_key where
+  def
+    = Project_key Default.def Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable Project_key where
+  hashWithSalt __salt
+    (Project_key _source _platformTarget _targetFramework _sdk
+       _outputType _assemblyName _rootNamespace)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+                       _platformTarget)
+                    _targetFramework)
+                 _sdk)
+              _outputType)
+           _assemblyName)
+        _rootNamespace
+
+data Namespace_key = Namespace_key{namespace_key_name :: Name,
+                                   namespace_key_containingNamespace :: Prelude.Maybe Namespace}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Namespace_key where
+  toJSON (Namespace_key __field__name __field__containingNamespace)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("containingNamespace" .=))
+             __field__containingNamespace
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Namespace_key where
+  buildStruct _proxy
+    (Namespace_key __field__name __field__containingNamespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__containingNamespace of
+             Prelude.Just _val -> Thrift.genField _proxy "containingNamespace"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containingNamespace <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingNamespace
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containingNamespace <- ST.readSTRef
+                                                                              __field__containingNamespace
+                                             Prelude.pure
+                                               (Namespace_key __val__name
+                                                  __val__containingNamespace)
+              _idMap = HashMap.fromList [("name", 1), ("containingNamespace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Namespace_key where
+  rnf (Namespace_key __field__name __field__containingNamespace)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containingNamespace `Prelude.seq` ()
+
+instance Default.Default Namespace_key where
+  def = Namespace_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable Namespace_key where
+  hashWithSalt __salt (Namespace_key _name _containingNamespace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _containingNamespace
+
+data NamedType = NamedType_class_ Class
+               | NamedType_interface_ Interface
+               | NamedType_record_ Record
+               | NamedType_struct_ Struct
+               | NamedType_EMPTY
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamedType where
+  toJSON (NamedType_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (NamedType_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (NamedType_record_ __record_)
+    = Aeson.object ["record_" .= __record_]
+  toJSON (NamedType_struct_ __struct_)
+    = Aeson.object ["struct_" .= __struct_]
+  toJSON NamedType_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct NamedType where
+  buildStruct _proxy (NamedType_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (NamedType_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy (NamedType_record_ __record_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "record_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __record_)]
+  buildStruct _proxy (NamedType_struct_ __struct_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "struct_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __struct_)]
+  buildStruct _proxy NamedType_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (NamedType_class_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (NamedType_interface_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (NamedType_record_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (NamedType_struct_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return NamedType_EMPTY
+           Thrift.FieldEnd -> Prelude.return NamedType_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("class_", 1), ("interface_", 2), ("record_", 3), ("struct_", 4)]
+
+instance DeepSeq.NFData NamedType where
+  rnf (NamedType_class_ __class_) = DeepSeq.rnf __class_
+  rnf (NamedType_interface_ __interface_) = DeepSeq.rnf __interface_
+  rnf (NamedType_record_ __record_) = DeepSeq.rnf __record_
+  rnf (NamedType_struct_ __struct_) = DeepSeq.rnf __struct_
+  rnf NamedType_EMPTY = ()
+
+instance Default.Default NamedType where
+  def = NamedType_EMPTY
+
+instance Hashable.Hashable NamedType where
+  hashWithSalt __salt (NamedType_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _class_)
+  hashWithSalt __salt (NamedType_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _interface_)
+  hashWithSalt __salt (NamedType_record_ _record_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _record_)
+  hashWithSalt __salt (NamedType_struct_ _struct_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _struct_)
+  hashWithSalt __salt NamedType_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowercase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowercase __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowercase __val__name)
+              _idMap = HashMap.fromList [("nameLowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowercase __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowercase)
+        _name
+
+data MethodKind = MethodKind_AnonymousFunction
+                | MethodKind_BuiltinOperator
+                | MethodKind_Constructor
+                | MethodKind_Conversion
+                | MethodKind_DeclareMethod
+                | MethodKind_DelegateInvoke
+                | MethodKind_Destructor
+                | MethodKind_EventAdd
+                | MethodKind_EventRaise
+                | MethodKind_EventRemove
+                | MethodKind_ExplicitInterfaceImplementation
+                | MethodKind_FunctionPointerSignature
+                | MethodKind_LambdaMethod
+                | MethodKind_LocalFunction
+                | MethodKind_Ordinary
+                | MethodKind_PropertyGet
+                | MethodKind_PropertySet
+                | MethodKind_ReducedExtension
+                | MethodKind_SharedConstructor
+                | MethodKind_StaticConstructor
+                | MethodKind_UserDefinedOperator
+                | MethodKind__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData MethodKind where
+  rnf __MethodKind = Prelude.seq __MethodKind ()
+
+instance Default.Default MethodKind where
+  def = MethodKind_AnonymousFunction
+
+instance Hashable.Hashable MethodKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum MethodKind where
+  toThriftEnum 0 = MethodKind_AnonymousFunction
+  toThriftEnum 1 = MethodKind_BuiltinOperator
+  toThriftEnum 2 = MethodKind_Constructor
+  toThriftEnum 3 = MethodKind_Conversion
+  toThriftEnum 4 = MethodKind_DeclareMethod
+  toThriftEnum 5 = MethodKind_DelegateInvoke
+  toThriftEnum 6 = MethodKind_Destructor
+  toThriftEnum 7 = MethodKind_EventAdd
+  toThriftEnum 8 = MethodKind_EventRaise
+  toThriftEnum 9 = MethodKind_EventRemove
+  toThriftEnum 10 = MethodKind_ExplicitInterfaceImplementation
+  toThriftEnum 11 = MethodKind_FunctionPointerSignature
+  toThriftEnum 12 = MethodKind_LambdaMethod
+  toThriftEnum 13 = MethodKind_LocalFunction
+  toThriftEnum 14 = MethodKind_Ordinary
+  toThriftEnum 15 = MethodKind_PropertyGet
+  toThriftEnum 16 = MethodKind_PropertySet
+  toThriftEnum 17 = MethodKind_ReducedExtension
+  toThriftEnum 18 = MethodKind_SharedConstructor
+  toThriftEnum 19 = MethodKind_StaticConstructor
+  toThriftEnum 20 = MethodKind_UserDefinedOperator
+  toThriftEnum val = MethodKind__UNKNOWN val
+  fromThriftEnum MethodKind_AnonymousFunction = 0
+  fromThriftEnum MethodKind_BuiltinOperator = 1
+  fromThriftEnum MethodKind_Constructor = 2
+  fromThriftEnum MethodKind_Conversion = 3
+  fromThriftEnum MethodKind_DeclareMethod = 4
+  fromThriftEnum MethodKind_DelegateInvoke = 5
+  fromThriftEnum MethodKind_Destructor = 6
+  fromThriftEnum MethodKind_EventAdd = 7
+  fromThriftEnum MethodKind_EventRaise = 8
+  fromThriftEnum MethodKind_EventRemove = 9
+  fromThriftEnum MethodKind_ExplicitInterfaceImplementation = 10
+  fromThriftEnum MethodKind_FunctionPointerSignature = 11
+  fromThriftEnum MethodKind_LambdaMethod = 12
+  fromThriftEnum MethodKind_LocalFunction = 13
+  fromThriftEnum MethodKind_Ordinary = 14
+  fromThriftEnum MethodKind_PropertyGet = 15
+  fromThriftEnum MethodKind_PropertySet = 16
+  fromThriftEnum MethodKind_ReducedExtension = 17
+  fromThriftEnum MethodKind_SharedConstructor = 18
+  fromThriftEnum MethodKind_StaticConstructor = 19
+  fromThriftEnum MethodKind_UserDefinedOperator = 20
+  fromThriftEnum (MethodKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [MethodKind_AnonymousFunction, MethodKind_BuiltinOperator,
+       MethodKind_Constructor, MethodKind_Conversion,
+       MethodKind_DeclareMethod, MethodKind_DelegateInvoke,
+       MethodKind_Destructor, MethodKind_EventAdd, MethodKind_EventRaise,
+       MethodKind_EventRemove, MethodKind_ExplicitInterfaceImplementation,
+       MethodKind_FunctionPointerSignature, MethodKind_LambdaMethod,
+       MethodKind_LocalFunction, MethodKind_Ordinary,
+       MethodKind_PropertyGet, MethodKind_PropertySet,
+       MethodKind_ReducedExtension, MethodKind_SharedConstructor,
+       MethodKind_StaticConstructor, MethodKind_UserDefinedOperator]
+  toThriftEnumEither 0 = Prelude.Right MethodKind_AnonymousFunction
+  toThriftEnumEither 1 = Prelude.Right MethodKind_BuiltinOperator
+  toThriftEnumEither 2 = Prelude.Right MethodKind_Constructor
+  toThriftEnumEither 3 = Prelude.Right MethodKind_Conversion
+  toThriftEnumEither 4 = Prelude.Right MethodKind_DeclareMethod
+  toThriftEnumEither 5 = Prelude.Right MethodKind_DelegateInvoke
+  toThriftEnumEither 6 = Prelude.Right MethodKind_Destructor
+  toThriftEnumEither 7 = Prelude.Right MethodKind_EventAdd
+  toThriftEnumEither 8 = Prelude.Right MethodKind_EventRaise
+  toThriftEnumEither 9 = Prelude.Right MethodKind_EventRemove
+  toThriftEnumEither 10
+    = Prelude.Right MethodKind_ExplicitInterfaceImplementation
+  toThriftEnumEither 11
+    = Prelude.Right MethodKind_FunctionPointerSignature
+  toThriftEnumEither 12 = Prelude.Right MethodKind_LambdaMethod
+  toThriftEnumEither 13 = Prelude.Right MethodKind_LocalFunction
+  toThriftEnumEither 14 = Prelude.Right MethodKind_Ordinary
+  toThriftEnumEither 15 = Prelude.Right MethodKind_PropertyGet
+  toThriftEnumEither 16 = Prelude.Right MethodKind_PropertySet
+  toThriftEnumEither 17 = Prelude.Right MethodKind_ReducedExtension
+  toThriftEnumEither 18 = Prelude.Right MethodKind_SharedConstructor
+  toThriftEnumEither 19 = Prelude.Right MethodKind_StaticConstructor
+  toThriftEnumEither 20
+    = Prelude.Right MethodKind_UserDefinedOperator
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum MethodKind: "
+           ++ Prelude.show val)
+
+newtype MethodInvocationExpression = MethodInvocationExpression{methodInvocationExpression_memberAccess
+                                                                :: MemberAccessLocation}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodInvocationExpression where
+  toJSON (MethodInvocationExpression __field__memberAccess)
+    = Aeson.object
+        ("memberAccess" .= __field__memberAccess : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodInvocationExpression where
+  buildStruct _proxy
+    (MethodInvocationExpression __field__memberAccess)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "memberAccess"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__memberAccess)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__memberAccess <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__memberAccess
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__memberAccess <- ST.readSTRef
+                                                                       __field__memberAccess
+                                             Prelude.pure
+                                               (MethodInvocationExpression __val__memberAccess)
+              _idMap = HashMap.fromList [("memberAccess", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodInvocationExpression where
+  rnf (MethodInvocationExpression __field__memberAccess)
+    = DeepSeq.rnf __field__memberAccess `Prelude.seq` ()
+
+instance Default.Default MethodInvocationExpression where
+  def = MethodInvocationExpression Default.def
+
+instance Hashable.Hashable MethodInvocationExpression where
+  hashWithSalt __salt (MethodInvocationExpression _memberAccess)
+    = Hashable.hashWithSalt __salt _memberAccess
+
+data MemberAccessExpression = MemberAccessExpression_local Local
+                            | MemberAccessExpression_parameter Parameter
+                            | MemberAccessExpression_field Field
+                            | MemberAccessExpression_property Property
+                            | MemberAccessExpression_method Method
+                            | MemberAccessExpression_EMPTY
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberAccessExpression where
+  toJSON (MemberAccessExpression_local __local)
+    = Aeson.object ["local" .= __local]
+  toJSON (MemberAccessExpression_parameter __parameter)
+    = Aeson.object ["parameter" .= __parameter]
+  toJSON (MemberAccessExpression_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON (MemberAccessExpression_property __property)
+    = Aeson.object ["property" .= __property]
+  toJSON (MemberAccessExpression_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON MemberAccessExpression_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct MemberAccessExpression where
+  buildStruct _proxy (MemberAccessExpression_local __local)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __local)]
+  buildStruct _proxy (MemberAccessExpression_parameter __parameter)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "parameter" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __parameter)]
+  buildStruct _proxy (MemberAccessExpression_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy (MemberAccessExpression_property __property)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "property" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __property)]
+  buildStruct _proxy (MemberAccessExpression_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy MemberAccessExpression_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (MemberAccessExpression_local _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (MemberAccessExpression_parameter
+                                                                 _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (MemberAccessExpression_field _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (MemberAccessExpression_property _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (MemberAccessExpression_method _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               MemberAccessExpression_EMPTY
+           Thrift.FieldEnd -> Prelude.return MemberAccessExpression_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("local", 1), ("parameter", 2), ("field", 3), ("property", 4),
+             ("method", 5)]
+
+instance DeepSeq.NFData MemberAccessExpression where
+  rnf (MemberAccessExpression_local __local) = DeepSeq.rnf __local
+  rnf (MemberAccessExpression_parameter __parameter)
+    = DeepSeq.rnf __parameter
+  rnf (MemberAccessExpression_field __field) = DeepSeq.rnf __field
+  rnf (MemberAccessExpression_property __property)
+    = DeepSeq.rnf __property
+  rnf (MemberAccessExpression_method __method) = DeepSeq.rnf __method
+  rnf MemberAccessExpression_EMPTY = ()
+
+instance Default.Default MemberAccessExpression where
+  def = MemberAccessExpression_EMPTY
+
+instance Hashable.Hashable MemberAccessExpression where
+  hashWithSalt __salt (MemberAccessExpression_local _local)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _local)
+  hashWithSalt __salt (MemberAccessExpression_parameter _parameter)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _parameter)
+  hashWithSalt __salt (MemberAccessExpression_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _field)
+  hashWithSalt __salt (MemberAccessExpression_property _property)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _property)
+  hashWithSalt __salt (MemberAccessExpression_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _method)
+  hashWithSalt __salt MemberAccessExpression_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+newtype MSBuildProjectSource_key = MSBuildProjectSource_key{mSBuildProjectSource_key_src
+                                                            :: Glean.Schema.Src.File}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MSBuildProjectSource_key where
+  toJSON (MSBuildProjectSource_key __field__src)
+    = Aeson.object ("src" .= __field__src : Prelude.mempty)
+
+instance Thrift.ThriftStruct MSBuildProjectSource_key where
+  buildStruct _proxy (MSBuildProjectSource_key __field__src)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "src" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__src)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__src <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__src
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__src <- ST.readSTRef __field__src
+                                             Prelude.pure (MSBuildProjectSource_key __val__src)
+              _idMap = HashMap.fromList [("src", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData MSBuildProjectSource_key where
+  rnf (MSBuildProjectSource_key __field__src)
+    = DeepSeq.rnf __field__src `Prelude.seq` ()
+
+instance Default.Default MSBuildProjectSource_key where
+  def = MSBuildProjectSource_key Default.def
+
+instance Hashable.Hashable MSBuildProjectSource_key where
+  hashWithSalt __salt (MSBuildProjectSource_key _src)
+    = Hashable.hashWithSalt __salt _src
+
+data Location = Location{location_fileLocation ::
+                         Glean.Schema.Src.FileLocation,
+                         location_fileLines :: Glean.Schema.Src.FileLines}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Location where
+  toJSON (Location __field__fileLocation __field__fileLines)
+    = Aeson.object
+        ("fileLocation" .= __field__fileLocation :
+           "fileLines" .= __field__fileLines : Prelude.mempty)
+
+instance Thrift.ThriftStruct Location where
+  buildStruct _proxy
+    (Location __field__fileLocation __field__fileLines)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fileLocation"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__fileLocation)
+           :
+           Thrift.genField _proxy "fileLines" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__fileLines)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fileLocation <- ST.newSTRef Default.def
+            __field__fileLines <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__fileLocation
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__fileLines
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fileLocation <- ST.readSTRef
+                                                                       __field__fileLocation
+                                             !__val__fileLines <- ST.readSTRef __field__fileLines
+                                             Prelude.pure
+                                               (Location __val__fileLocation __val__fileLines)
+              _idMap = HashMap.fromList [("fileLocation", 1), ("fileLines", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Location where
+  rnf (Location __field__fileLocation __field__fileLines)
+    = DeepSeq.rnf __field__fileLocation `Prelude.seq`
+        DeepSeq.rnf __field__fileLines `Prelude.seq` ()
+
+instance Default.Default Location where
+  def = Location Default.def Default.def
+
+instance Hashable.Hashable Location where
+  hashWithSalt __salt (Location _fileLocation _fileLines)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _fileLocation)
+        _fileLines
+
+data MemberAccessLocation_key = MemberAccessLocation_key{memberAccessLocation_key_expression
+                                                         :: MemberAccessExpression,
+                                                         memberAccessLocation_key_location ::
+                                                         Location}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberAccessLocation_key where
+  toJSON
+    (MemberAccessLocation_key __field__expression __field__location)
+    = Aeson.object
+        ("expression" .= __field__expression :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberAccessLocation_key where
+  buildStruct _proxy
+    (MemberAccessLocation_key __field__expression __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "expression" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__expression)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__expression <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__expression
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__expression <- ST.readSTRef
+                                                                     __field__expression
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (MemberAccessLocation_key __val__expression
+                                                  __val__location)
+              _idMap = HashMap.fromList [("expression", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberAccessLocation_key where
+  rnf
+    (MemberAccessLocation_key __field__expression __field__location)
+    = DeepSeq.rnf __field__expression `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default MemberAccessLocation_key where
+  def = MemberAccessLocation_key Default.def Default.def
+
+instance Hashable.Hashable MemberAccessLocation_key where
+  hashWithSalt __salt
+    (MemberAccessLocation_key _expression _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _expression)
+        _location
+
+data MethodInvocationLocation_key = MethodInvocationLocation_key{methodInvocationLocation_key_method
+                                                                 :: Method,
+                                                                 methodInvocationLocation_key_location
+                                                                 :: Location,
+                                                                 methodInvocationLocation_key_expression
+                                                                 ::
+                                                                 Prelude.Maybe
+                                                                   MethodInvocationExpression}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodInvocationLocation_key where
+  toJSON
+    (MethodInvocationLocation_key __field__method __field__location
+       __field__expression)
+    = Aeson.object
+        ("method" .= __field__method :
+           "location" .= __field__location :
+             Prelude.maybe Prelude.id ((:) . ("expression" .=))
+               __field__expression
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodInvocationLocation_key where
+  buildStruct _proxy
+    (MethodInvocationLocation_key __field__method __field__location
+       __field__expression)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__method)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             case __field__expression of
+               Prelude.Just _val -> Thrift.genField _proxy "expression"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__method <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__expression <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__method
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__expression
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__method <- ST.readSTRef
+                                                                 __field__method
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__expression <- ST.readSTRef __field__expression
+                                             Prelude.pure
+                                               (MethodInvocationLocation_key __val__method
+                                                  __val__location
+                                                  __val__expression)
+              _idMap
+                = HashMap.fromList
+                    [("method", 1), ("location", 2), ("expression", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodInvocationLocation_key where
+  rnf
+    (MethodInvocationLocation_key __field__method __field__location
+       __field__expression)
+    = DeepSeq.rnf __field__method `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__expression `Prelude.seq` ()
+
+instance Default.Default MethodInvocationLocation_key where
+  def
+    = MethodInvocationLocation_key Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable MethodInvocationLocation_key where
+  hashWithSalt __salt
+    (MethodInvocationLocation_key _method _location _expression)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _method)
+           _location)
+        _expression
+
+data Implements_key = Implements_key{implements_key_type ::
+                                     NamedType,
+                                     implements_key_interface_ :: Interface}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Implements_key where
+  toJSON (Implements_key __field__type __field__interface_)
+    = Aeson.object
+        ("type" .= __field__type :
+           "interface_" .= __field__interface_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct Implements_key where
+  buildStruct _proxy
+    (Implements_key __field__type __field__interface_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__interface_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__interface_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__interface_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__interface_ <- ST.readSTRef __field__interface_
+                                             Prelude.pure
+                                               (Implements_key __val__type __val__interface_)
+              _idMap = HashMap.fromList [("type", 1), ("interface_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Implements_key where
+  rnf (Implements_key __field__type __field__interface_)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__interface_ `Prelude.seq` ()
+
+instance Default.Default Implements_key where
+  def = Implements_key Default.def Default.def
+
+instance Hashable.Hashable Implements_key where
+  hashWithSalt __salt (Implements_key _type _interface_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type)
+        _interface_
+
+data FunctionPointerType_key = FunctionPointerType_key{functionPointerType_key_name
+                                                       :: FullName,
+                                                       functionPointerType_key_signature :: Method}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionPointerType_key where
+  toJSON (FunctionPointerType_key __field__name __field__signature)
+    = Aeson.object
+        ("name" .= __field__name :
+           "signature" .= __field__signature : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionPointerType_key where
+  buildStruct _proxy
+    (FunctionPointerType_key __field__name __field__signature)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__signature)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             Prelude.pure
+                                               (FunctionPointerType_key __val__name
+                                                  __val__signature)
+              _idMap = HashMap.fromList [("name", 1), ("signature", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionPointerType_key where
+  rnf (FunctionPointerType_key __field__name __field__signature)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq` ()
+
+instance Default.Default FunctionPointerType_key where
+  def = FunctionPointerType_key Default.def Default.def
+
+instance Hashable.Hashable FunctionPointerType_key where
+  hashWithSalt __salt (FunctionPointerType_key _name _signature)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _signature
+
+data FullName_key = FullName_key{fullName_key_name :: Name,
+                                 fullName_key_containingNamespace :: Namespace}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FullName_key where
+  toJSON (FullName_key __field__name __field__containingNamespace)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containingNamespace" .= __field__containingNamespace :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FullName_key where
+  buildStruct _proxy
+    (FullName_key __field__name __field__containingNamespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containingNamespace"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containingNamespace)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containingNamespace <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingNamespace
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containingNamespace <- ST.readSTRef
+                                                                              __field__containingNamespace
+                                             Prelude.pure
+                                               (FullName_key __val__name __val__containingNamespace)
+              _idMap = HashMap.fromList [("name", 1), ("containingNamespace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FullName_key where
+  rnf (FullName_key __field__name __field__containingNamespace)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containingNamespace `Prelude.seq` ()
+
+instance Default.Default FullName_key where
+  def = FullName_key Default.def Default.def
+
+instance Hashable.Hashable FullName_key where
+  hashWithSalt __salt (FullName_key _name _containingNamespace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _containingNamespace
+
+data Accessibility = Accessibility_Friend
+                   | Accessibility_Internal
+                   | Accessibility_NotApplicable
+                   | Accessibility_Private
+                   | Accessibility_Protected
+                   | Accessibility_ProtectedAndFriend
+                   | Accessibility_ProtectedAndInternal
+                   | Accessibility_ProtectedOrFriend
+                   | Accessibility_ProtectedOrInternal
+                   | Accessibility_Public
+                   | Accessibility__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Accessibility where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Accessibility where
+  rnf __Accessibility = Prelude.seq __Accessibility ()
+
+instance Default.Default Accessibility where
+  def = Accessibility_Friend
+
+instance Hashable.Hashable Accessibility where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Accessibility where
+  toThriftEnum 0 = Accessibility_Friend
+  toThriftEnum 1 = Accessibility_Internal
+  toThriftEnum 2 = Accessibility_NotApplicable
+  toThriftEnum 3 = Accessibility_Private
+  toThriftEnum 4 = Accessibility_Protected
+  toThriftEnum 5 = Accessibility_ProtectedAndFriend
+  toThriftEnum 6 = Accessibility_ProtectedAndInternal
+  toThriftEnum 7 = Accessibility_ProtectedOrFriend
+  toThriftEnum 8 = Accessibility_ProtectedOrInternal
+  toThriftEnum 9 = Accessibility_Public
+  toThriftEnum val = Accessibility__UNKNOWN val
+  fromThriftEnum Accessibility_Friend = 0
+  fromThriftEnum Accessibility_Internal = 1
+  fromThriftEnum Accessibility_NotApplicable = 2
+  fromThriftEnum Accessibility_Private = 3
+  fromThriftEnum Accessibility_Protected = 4
+  fromThriftEnum Accessibility_ProtectedAndFriend = 5
+  fromThriftEnum Accessibility_ProtectedAndInternal = 6
+  fromThriftEnum Accessibility_ProtectedOrFriend = 7
+  fromThriftEnum Accessibility_ProtectedOrInternal = 8
+  fromThriftEnum Accessibility_Public = 9
+  fromThriftEnum (Accessibility__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Accessibility_Friend, Accessibility_Internal,
+       Accessibility_NotApplicable, Accessibility_Private,
+       Accessibility_Protected, Accessibility_ProtectedAndFriend,
+       Accessibility_ProtectedAndInternal,
+       Accessibility_ProtectedOrFriend, Accessibility_ProtectedOrInternal,
+       Accessibility_Public]
+  toThriftEnumEither 0 = Prelude.Right Accessibility_Friend
+  toThriftEnumEither 1 = Prelude.Right Accessibility_Internal
+  toThriftEnumEither 2 = Prelude.Right Accessibility_NotApplicable
+  toThriftEnumEither 3 = Prelude.Right Accessibility_Private
+  toThriftEnumEither 4 = Prelude.Right Accessibility_Protected
+  toThriftEnumEither 5
+    = Prelude.Right Accessibility_ProtectedAndFriend
+  toThriftEnumEither 6
+    = Prelude.Right Accessibility_ProtectedAndInternal
+  toThriftEnumEither 7
+    = Prelude.Right Accessibility_ProtectedOrFriend
+  toThriftEnumEither 8
+    = Prelude.Right Accessibility_ProtectedOrInternal
+  toThriftEnumEither 9 = Prelude.Right Accessibility_Public
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Accessibility: "
+           ++ Prelude.show val)
+
+data Class_key = Class_key{class_key_name :: FullName,
+                           class_key_baseType :: Prelude.Maybe Class,
+                           class_key_typeParameters :: [TypeParameter],
+                           class_key_containingType :: Prelude.Maybe NamedType,
+                           class_key_declaredAccessibility :: Accessibility,
+                           class_key_isAbstract :: Prelude.Bool,
+                           class_key_isStatic :: Prelude.Bool,
+                           class_key_isSealed :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Class_key where
+  toJSON
+    (Class_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isStatic __field__isSealed)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("baseType" .=)) __field__baseType
+             ("typeParameters" .= __field__typeParameters :
+                Prelude.maybe Prelude.id ((:) . ("containingType" .=))
+                  __field__containingType
+                  ("declaredAccessibility" .= __field__declaredAccessibility :
+                     "isAbstract" .= __field__isAbstract :
+                       "isStatic" .= __field__isStatic :
+                         "isSealed" .= __field__isSealed : Prelude.mempty)))
+
+instance Thrift.ThriftStruct Class_key where
+  buildStruct _proxy
+    (Class_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isStatic __field__isSealed)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__baseType, __id__baseType)
+                 = case __field__baseType of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "baseType"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__baseType
+               (Thrift.genField _proxy "typeParameters"
+                  (Thrift.getListType _proxy)
+                  3
+                  __id__baseType
+                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     __field__typeParameters)
+                  :
+                  let (__cereal__containingType, __id__containingType)
+                        = case __field__containingType of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "containingType"
+                                                       (Thrift.getStructType _proxy)
+                                                       4
+                                                       3
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  4)
+                            Prelude.Nothing -> (Prelude.id, 3)
+                    in
+                    __cereal__containingType
+                      (Thrift.genField _proxy "declaredAccessibility"
+                         (Thrift.getI32Type _proxy)
+                         5
+                         __id__containingType
+                         ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                             Thrift.fromThriftEnum)
+                            __field__declaredAccessibility)
+                         :
+                         Thrift.genFieldBool _proxy "isAbstract" 6 5 __field__isAbstract :
+                           Thrift.genFieldBool _proxy "isStatic" 7 6 __field__isStatic :
+                             Thrift.genFieldBool _proxy "isSealed" 8 7 __field__isSealed : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__baseType <- ST.newSTRef Prelude.Nothing
+            __field__typeParameters <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Prelude.Nothing
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__isSealed <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__baseType
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParameters
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isSealed
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__baseType <- ST.readSTRef __field__baseType
+                                             !__val__typeParameters <- ST.readSTRef
+                                                                         __field__typeParameters
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__isSealed <- ST.readSTRef __field__isSealed
+                                             Prelude.pure
+                                               (Class_key __val__name __val__baseType
+                                                  __val__typeParameters
+                                                  __val__containingType
+                                                  __val__declaredAccessibility
+                                                  __val__isAbstract
+                                                  __val__isStatic
+                                                  __val__isSealed)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("baseType", 2), ("typeParameters", 3),
+                     ("containingType", 4), ("declaredAccessibility", 5),
+                     ("isAbstract", 6), ("isStatic", 7), ("isSealed", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData Class_key where
+  rnf
+    (Class_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isStatic __field__isSealed)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__baseType `Prelude.seq`
+          DeepSeq.rnf __field__typeParameters `Prelude.seq`
+            DeepSeq.rnf __field__containingType `Prelude.seq`
+              DeepSeq.rnf __field__declaredAccessibility `Prelude.seq`
+                DeepSeq.rnf __field__isAbstract `Prelude.seq`
+                  DeepSeq.rnf __field__isStatic `Prelude.seq`
+                    DeepSeq.rnf __field__isSealed `Prelude.seq` ()
+
+instance Default.Default Class_key where
+  def
+    = Class_key Default.def Prelude.Nothing Default.def Prelude.Nothing
+        Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Class_key where
+  hashWithSalt __salt
+    (Class_key _name _baseType _typeParameters _containingType
+       _declaredAccessibility _isAbstract _isStatic _isSealed)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                          _baseType)
+                       _typeParameters)
+                    _containingType)
+                 _declaredAccessibility)
+              _isAbstract)
+           _isStatic)
+        _isSealed
+
+data Interface_key = Interface_key{interface_key_name :: FullName,
+                                   interface_key_typeParameters :: [TypeParameter],
+                                   interface_key_containingType :: Prelude.Maybe NamedType,
+                                   interface_key_declaredAccessibility :: Accessibility,
+                                   interface_key_isStatic :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Interface_key where
+  toJSON
+    (Interface_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isStatic)
+    = Aeson.object
+        ("name" .= __field__name :
+           "typeParameters" .= __field__typeParameters :
+             Prelude.maybe Prelude.id ((:) . ("containingType" .=))
+               __field__containingType
+               ("declaredAccessibility" .= __field__declaredAccessibility :
+                  "isStatic" .= __field__isStatic : Prelude.mempty))
+
+instance Thrift.ThriftStruct Interface_key where
+  buildStruct _proxy
+    (Interface_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isStatic)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "typeParameters" (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__typeParameters)
+             :
+             let (__cereal__containingType, __id__containingType)
+                   = case __field__containingType of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "containingType"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__containingType
+                 (Thrift.genField _proxy "declaredAccessibility"
+                    (Thrift.getI32Type _proxy)
+                    4
+                    __id__containingType
+                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                        Thrift.fromThriftEnum)
+                       __field__declaredAccessibility)
+                    :
+                    Thrift.genFieldBool _proxy "isStatic" 5 4 __field__isStatic : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__typeParameters <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Prelude.Nothing
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            __field__isStatic <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__typeParameters <- ST.readSTRef
+                                                                         __field__typeParameters
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             Prelude.pure
+                                               (Interface_key __val__name __val__typeParameters
+                                                  __val__containingType
+                                                  __val__declaredAccessibility
+                                                  __val__isStatic)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("typeParameters", 2), ("containingType", 3),
+                     ("declaredAccessibility", 4), ("isStatic", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData Interface_key where
+  rnf
+    (Interface_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isStatic)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__typeParameters `Prelude.seq`
+          DeepSeq.rnf __field__containingType `Prelude.seq`
+            DeepSeq.rnf __field__declaredAccessibility `Prelude.seq`
+              DeepSeq.rnf __field__isStatic `Prelude.seq` ()
+
+instance Default.Default Interface_key where
+  def
+    = Interface_key Default.def Default.def Prelude.Nothing Default.def
+        Prelude.False
+
+instance Hashable.Hashable Interface_key where
+  hashWithSalt __salt
+    (Interface_key _name _typeParameters _containingType
+       _declaredAccessibility _isStatic)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _typeParameters)
+              _containingType)
+           _declaredAccessibility)
+        _isStatic
+
+data Record_key = Record_key{record_key_name :: FullName,
+                             record_key_baseType :: Prelude.Maybe Record,
+                             record_key_typeParameters :: [TypeParameter],
+                             record_key_containingType :: Prelude.Maybe NamedType,
+                             record_key_declaredAccessibility :: Accessibility,
+                             record_key_isAbstract :: Prelude.Bool,
+                             record_key_isSealed :: Prelude.Bool}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Record_key where
+  toJSON
+    (Record_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isSealed)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("baseType" .=)) __field__baseType
+             ("typeParameters" .= __field__typeParameters :
+                Prelude.maybe Prelude.id ((:) . ("containingType" .=))
+                  __field__containingType
+                  ("declaredAccessibility" .= __field__declaredAccessibility :
+                     "isAbstract" .= __field__isAbstract :
+                       "isSealed" .= __field__isSealed : Prelude.mempty)))
+
+instance Thrift.ThriftStruct Record_key where
+  buildStruct _proxy
+    (Record_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isSealed)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__baseType, __id__baseType)
+                 = case __field__baseType of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "baseType"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__baseType
+               (Thrift.genField _proxy "typeParameters"
+                  (Thrift.getListType _proxy)
+                  3
+                  __id__baseType
+                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     __field__typeParameters)
+                  :
+                  let (__cereal__containingType, __id__containingType)
+                        = case __field__containingType of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "containingType"
+                                                       (Thrift.getStructType _proxy)
+                                                       4
+                                                       3
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  4)
+                            Prelude.Nothing -> (Prelude.id, 3)
+                    in
+                    __cereal__containingType
+                      (Thrift.genField _proxy "declaredAccessibility"
+                         (Thrift.getI32Type _proxy)
+                         5
+                         __id__containingType
+                         ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                             Thrift.fromThriftEnum)
+                            __field__declaredAccessibility)
+                         :
+                         Thrift.genFieldBool _proxy "isAbstract" 6 5 __field__isAbstract :
+                           Thrift.genFieldBool _proxy "isSealed" 7 6 __field__isSealed : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__baseType <- ST.newSTRef Prelude.Nothing
+            __field__typeParameters <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Prelude.Nothing
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isSealed <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__baseType
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParameters
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isSealed
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__baseType <- ST.readSTRef __field__baseType
+                                             !__val__typeParameters <- ST.readSTRef
+                                                                         __field__typeParameters
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             !__val__isSealed <- ST.readSTRef __field__isSealed
+                                             Prelude.pure
+                                               (Record_key __val__name __val__baseType
+                                                  __val__typeParameters
+                                                  __val__containingType
+                                                  __val__declaredAccessibility
+                                                  __val__isAbstract
+                                                  __val__isSealed)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("baseType", 2), ("typeParameters", 3),
+                     ("containingType", 4), ("declaredAccessibility", 5),
+                     ("isAbstract", 6), ("isSealed", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Record_key where
+  rnf
+    (Record_key __field__name __field__baseType __field__typeParameters
+       __field__containingType __field__declaredAccessibility
+       __field__isAbstract __field__isSealed)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__baseType `Prelude.seq`
+          DeepSeq.rnf __field__typeParameters `Prelude.seq`
+            DeepSeq.rnf __field__containingType `Prelude.seq`
+              DeepSeq.rnf __field__declaredAccessibility `Prelude.seq`
+                DeepSeq.rnf __field__isAbstract `Prelude.seq`
+                  DeepSeq.rnf __field__isSealed `Prelude.seq` ()
+
+instance Default.Default Record_key where
+  def
+    = Record_key Default.def Prelude.Nothing Default.def
+        Prelude.Nothing
+        Default.def
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Record_key where
+  hashWithSalt __salt
+    (Record_key _name _baseType _typeParameters _containingType
+       _declaredAccessibility _isAbstract _isSealed)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                       _baseType)
+                    _typeParameters)
+                 _containingType)
+              _declaredAccessibility)
+           _isAbstract)
+        _isSealed
+
+data Struct_key = Struct_key{struct_key_name :: FullName,
+                             struct_key_typeParameters :: [TypeParameter],
+                             struct_key_containingType :: Prelude.Maybe NamedType,
+                             struct_key_declaredAccessibility :: Accessibility}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Struct_key where
+  toJSON
+    (Struct_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility)
+    = Aeson.object
+        ("name" .= __field__name :
+           "typeParameters" .= __field__typeParameters :
+             Prelude.maybe Prelude.id ((:) . ("containingType" .=))
+               __field__containingType
+               ("declaredAccessibility" .= __field__declaredAccessibility :
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct Struct_key where
+  buildStruct _proxy
+    (Struct_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "typeParameters" (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__typeParameters)
+             :
+             let (__cereal__containingType, __id__containingType)
+                   = case __field__containingType of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "containingType"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__containingType
+                 (Thrift.genField _proxy "declaredAccessibility"
+                    (Thrift.getI32Type _proxy)
+                    4
+                    __id__containingType
+                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                        Thrift.fromThriftEnum)
+                       __field__declaredAccessibility)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__typeParameters <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Prelude.Nothing
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__typeParameters <- ST.readSTRef
+                                                                         __field__typeParameters
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             Prelude.pure
+                                               (Struct_key __val__name __val__typeParameters
+                                                  __val__containingType
+                                                  __val__declaredAccessibility)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("typeParameters", 2), ("containingType", 3),
+                     ("declaredAccessibility", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Struct_key where
+  rnf
+    (Struct_key __field__name __field__typeParameters
+       __field__containingType __field__declaredAccessibility)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__typeParameters `Prelude.seq`
+          DeepSeq.rnf __field__containingType `Prelude.seq`
+            DeepSeq.rnf __field__declaredAccessibility `Prelude.seq` ()
+
+instance Default.Default Struct_key where
+  def
+    = Struct_key Default.def Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable Struct_key where
+  hashWithSalt __salt
+    (Struct_key _name _typeParameters _containingType
+       _declaredAccessibility)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _typeParameters)
+           _containingType)
+        _declaredAccessibility
+
+data AType = AType_arrayType ArrayType
+           | AType_namedType NamedType
+           | AType_functionPointerType FunctionPointerType
+           | AType_pointerType PointerType
+           | AType_typeParameter TypeParameter
+           | AType_EMPTY
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AType where
+  toJSON (AType_arrayType __arrayType)
+    = Aeson.object ["arrayType" .= __arrayType]
+  toJSON (AType_namedType __namedType)
+    = Aeson.object ["namedType" .= __namedType]
+  toJSON (AType_functionPointerType __functionPointerType)
+    = Aeson.object ["functionPointerType" .= __functionPointerType]
+  toJSON (AType_pointerType __pointerType)
+    = Aeson.object ["pointerType" .= __pointerType]
+  toJSON (AType_typeParameter __typeParameter)
+    = Aeson.object ["typeParameter" .= __typeParameter]
+  toJSON AType_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct AType where
+  buildStruct _proxy (AType_arrayType __arrayType)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "arrayType" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __arrayType)]
+  buildStruct _proxy (AType_namedType __namedType)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namedType" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __namedType)]
+  buildStruct _proxy
+    (AType_functionPointerType __functionPointerType)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "functionPointerType"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __functionPointerType)]
+  buildStruct _proxy (AType_pointerType __pointerType)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "pointerType" (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __pointerType)]
+  buildStruct _proxy (AType_typeParameter __typeParameter)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeParameter"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __typeParameter)]
+  buildStruct _proxy AType_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (AType_arrayType _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (AType_namedType _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (AType_functionPointerType _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (AType_pointerType _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (AType_typeParameter _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return AType_EMPTY
+           Thrift.FieldEnd -> Prelude.return AType_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("arrayType", 1), ("namedType", 2), ("functionPointerType", 3),
+             ("pointerType", 4), ("typeParameter", 5)]
+
+instance DeepSeq.NFData AType where
+  rnf (AType_arrayType __arrayType) = DeepSeq.rnf __arrayType
+  rnf (AType_namedType __namedType) = DeepSeq.rnf __namedType
+  rnf (AType_functionPointerType __functionPointerType)
+    = DeepSeq.rnf __functionPointerType
+  rnf (AType_pointerType __pointerType) = DeepSeq.rnf __pointerType
+  rnf (AType_typeParameter __typeParameter)
+    = DeepSeq.rnf __typeParameter
+  rnf AType_EMPTY = ()
+
+instance Default.Default AType where
+  def = AType_EMPTY
+
+instance Hashable.Hashable AType where
+  hashWithSalt __salt (AType_arrayType _arrayType)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _arrayType)
+  hashWithSalt __salt (AType_namedType _namedType)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _namedType)
+  hashWithSalt __salt
+    (AType_functionPointerType _functionPointerType)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _functionPointerType)
+  hashWithSalt __salt (AType_pointerType _pointerType)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _pointerType)
+  hashWithSalt __salt (AType_typeParameter _typeParameter)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _typeParameter)
+  hashWithSalt __salt AType_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ArrayType_key = ArrayType_key{arrayType_key_elementType ::
+                                   AType,
+                                   arrayType_key_rank :: Glean.Byte}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArrayType_key where
+  toJSON (ArrayType_key __field__elementType __field__rank)
+    = Aeson.object
+        ("elementType" .= __field__elementType :
+           "rank" .= Glean.unByte __field__rank : Prelude.mempty)
+
+instance Thrift.ThriftStruct ArrayType_key where
+  buildStruct _proxy
+    (ArrayType_key __field__elementType __field__rank)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "elementType" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__elementType)
+           :
+           Thrift.genField _proxy "rank" (Thrift.getByteType _proxy) 2 1
+             ((Thrift.genByte _proxy . Glean.unByte) __field__rank)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__elementType <- ST.newSTRef Default.def
+            __field__rank <- ST.newSTRef (Glean.Byte Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__elementType
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getByteType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Byte
+                                                                                      (Thrift.parseByte
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__rank
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__elementType <- ST.readSTRef
+                                                                      __field__elementType
+                                             !__val__rank <- ST.readSTRef __field__rank
+                                             Prelude.pure
+                                               (ArrayType_key __val__elementType __val__rank)
+              _idMap = HashMap.fromList [("elementType", 1), ("rank", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArrayType_key where
+  rnf (ArrayType_key __field__elementType __field__rank)
+    = DeepSeq.rnf __field__elementType `Prelude.seq`
+        DeepSeq.rnf __field__rank `Prelude.seq` ()
+
+instance Default.Default ArrayType_key where
+  def = ArrayType_key Default.def (Glean.Byte Default.def)
+
+instance Hashable.Hashable ArrayType_key where
+  hashWithSalt __salt (ArrayType_key _elementType _rank)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _elementType)
+        _rank
+
+data Definition = Definition_type AType
+                | Definition_method Method
+                | Definition_field Field
+                | Definition_parameter Parameter
+                | Definition_typeParameter TypeParameter
+                | Definition_local Local
+                | Definition_property Property
+                | Definition_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition_type __type) = Aeson.object ["type" .= __type]
+  toJSON (Definition_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Definition_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON (Definition_parameter __parameter)
+    = Aeson.object ["parameter" .= __parameter]
+  toJSON (Definition_typeParameter __typeParameter)
+    = Aeson.object ["typeParameter" .= __typeParameter]
+  toJSON (Definition_local __local)
+    = Aeson.object ["local" .= __local]
+  toJSON (Definition_property __property)
+    = Aeson.object ["property" .= __property]
+  toJSON Definition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition_type __type)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __type)]
+  buildStruct _proxy (Definition_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Definition_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy (Definition_parameter __parameter)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "parameter" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __parameter)]
+  buildStruct _proxy (Definition_typeParameter __typeParameter)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeParameter"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __typeParameter)]
+  buildStruct _proxy (Definition_local __local)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __local)]
+  buildStruct _proxy (Definition_property __property)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "property" (Thrift.getStructType _proxy) 7
+           0
+           (Thrift.buildStruct _proxy __property)]
+  buildStruct _proxy Definition_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_type _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_method _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_field _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_parameter _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_typeParameter _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_local _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_property _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Definition_EMPTY
+           Thrift.FieldEnd -> Prelude.return Definition_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("type", 1), ("method", 2), ("field", 3), ("parameter", 4),
+             ("typeParameter", 5), ("local", 6), ("property", 7)]
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition_type __type) = DeepSeq.rnf __type
+  rnf (Definition_method __method) = DeepSeq.rnf __method
+  rnf (Definition_field __field) = DeepSeq.rnf __field
+  rnf (Definition_parameter __parameter) = DeepSeq.rnf __parameter
+  rnf (Definition_typeParameter __typeParameter)
+    = DeepSeq.rnf __typeParameter
+  rnf (Definition_local __local) = DeepSeq.rnf __local
+  rnf (Definition_property __property) = DeepSeq.rnf __property
+  rnf Definition_EMPTY = ()
+
+instance Default.Default Definition where
+  def = Definition_EMPTY
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition_type _type)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _type)
+  hashWithSalt __salt (Definition_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _method)
+  hashWithSalt __salt (Definition_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _field)
+  hashWithSalt __salt (Definition_parameter _parameter)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _parameter)
+  hashWithSalt __salt (Definition_typeParameter _typeParameter)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _typeParameter)
+  hashWithSalt __salt (Definition_local _local)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _local)
+  hashWithSalt __salt (Definition_property _property)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _property)
+  hashWithSalt __salt Definition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_definition
+                                                     :: Definition,
+                                                     definitionLocation_key_location :: Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON
+    (DefinitionLocation_key __field__definition __field__location)
+    = Aeson.object
+        ("definition" .= __field__definition :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__definition __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__definition)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__definition <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__definition <- ST.readSTRef
+                                                                     __field__definition
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__definition
+                                                  __val__location)
+              _idMap = HashMap.fromList [("definition", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf (DefinitionLocation_key __field__definition __field__location)
+    = DeepSeq.rnf __field__definition `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt (DefinitionLocation_key _definition _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _definition)
+        _location
+
+data DefinitionLocationName_key = DefinitionLocationName_key{definitionLocationName_key_decl
+                                                             :: Definition,
+                                                             definitionLocationName_key_file ::
+                                                             Glean.Schema.Src.File,
+                                                             definitionLocationName_key_span ::
+                                                             Glean.Schema.Src.ByteSpan,
+                                                             definitionLocationName_key_name ::
+                                                             Text.Text}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocationName_key where
+  toJSON
+    (DefinitionLocationName_key __field__decl __field__file
+       __field__span __field__name)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file :
+             "span" .= __field__span : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocationName_key where
+  buildStruct _proxy
+    (DefinitionLocationName_key __field__decl __field__file
+       __field__span __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__name)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (DefinitionLocationName_key __val__decl __val__file
+                                                  __val__span
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("decl", 1), ("file", 2), ("span", 3), ("name", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocationName_key where
+  rnf
+    (DefinitionLocationName_key __field__decl __field__file
+       __field__span __field__name)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default DefinitionLocationName_key where
+  def
+    = DefinitionLocationName_key Default.def Default.def Default.def ""
+
+instance Hashable.Hashable DefinitionLocationName_key where
+  hashWithSalt __salt
+    (DefinitionLocationName_key _decl _file _span _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+           _span)
+        _name
+
+data FileDefinitions_key = FileDefinitions_key{fileDefinitions_key_file
+                                               :: Glean.Schema.Src.File,
+                                               fileDefinitions_key_defn :: Definition}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDefinitions_key where
+  toJSON (FileDefinitions_key __field__file __field__defn)
+    = Aeson.object
+        ("file" .= __field__file :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDefinitions_key where
+  buildStruct _proxy
+    (FileDefinitions_key __field__file __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (FileDefinitions_key __val__file __val__defn)
+              _idMap = HashMap.fromList [("file", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDefinitions_key where
+  rnf (FileDefinitions_key __field__file __field__defn)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default FileDefinitions_key where
+  def = FileDefinitions_key Default.def Default.def
+
+instance Hashable.Hashable FileDefinitions_key where
+  hashWithSalt __salt (FileDefinitions_key _file _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _defn
+
+data FileEntityXRefs_key = FileEntityXRefs_key{fileEntityXRefs_key_file
+                                               :: Glean.Schema.Src.File,
+                                               fileEntityXRefs_key_use :: Glean.Schema.Src.ByteSpan,
+                                               fileEntityXRefs_key_target :: Definition}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefs_key where
+  toJSON
+    (FileEntityXRefs_key __field__file __field__use __field__target)
+    = Aeson.object
+        ("file" .= __field__file :
+           "use" .= __field__use :
+             "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefs_key where
+  buildStruct _proxy
+    (FileEntityXRefs_key __field__file __field__use __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "use" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__use)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__use <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__use
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__use <- ST.readSTRef __field__use
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (FileEntityXRefs_key __val__file __val__use
+                                                  __val__target)
+              _idMap = HashMap.fromList [("file", 1), ("use", 2), ("target", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefs_key where
+  rnf
+    (FileEntityXRefs_key __field__file __field__use __field__target)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__use `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefs_key where
+  def = FileEntityXRefs_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileEntityXRefs_key where
+  hashWithSalt __salt (FileEntityXRefs_key _file _use _target)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _use)
+        _target
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Name,
+                                         searchByName_key_defn :: Definition}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__defn)
+    = Aeson.object
+        ("name" .= __field__name :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure (SearchByName_key __val__name __val__defn)
+              _idMap = HashMap.fromList [("name", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__defn)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _defn
+
+data Field_key = Field_key{field_key_name :: Name,
+                           field_key_type :: AType, field_key_containingType :: NamedType,
+                           field_key_declaredAccessibility :: Accessibility,
+                           field_key_isConst :: Prelude.Bool,
+                           field_key_isReadonly :: Prelude.Bool,
+                           field_key_isVirtual :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field_key where
+  toJSON
+    (Field_key __field__name __field__type __field__containingType
+       __field__declaredAccessibility __field__isConst __field__isReadonly
+       __field__isVirtual)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "containingType" .= __field__containingType :
+               "declaredAccessibility" .= __field__declaredAccessibility :
+                 "isConst" .= __field__isConst :
+                   "isReadonly" .= __field__isReadonly :
+                     "isVirtual" .= __field__isVirtual : Prelude.mempty)
+
+instance Thrift.ThriftStruct Field_key where
+  buildStruct _proxy
+    (Field_key __field__name __field__type __field__containingType
+       __field__declaredAccessibility __field__isConst __field__isReadonly
+       __field__isVirtual)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "containingType"
+               (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__containingType)
+               :
+               Thrift.genField _proxy "declaredAccessibility"
+                 (Thrift.getI32Type _proxy)
+                 4
+                 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__declaredAccessibility)
+                 :
+                 Thrift.genFieldBool _proxy "isConst" 5 4 __field__isConst :
+                   Thrift.genFieldBool _proxy "isReadonly" 6 5 __field__isReadonly :
+                     Thrift.genFieldBool _proxy "isVirtual" 7 6 __field__isVirtual : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Default.def
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            __field__isConst <- ST.newSTRef Prelude.False
+            __field__isReadonly <- ST.newSTRef Prelude.False
+            __field__isVirtual <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isConst
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isReadonly
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVirtual
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             !__val__isConst <- ST.readSTRef __field__isConst
+                                             !__val__isReadonly <- ST.readSTRef __field__isReadonly
+                                             !__val__isVirtual <- ST.readSTRef __field__isVirtual
+                                             Prelude.pure
+                                               (Field_key __val__name __val__type
+                                                  __val__containingType
+                                                  __val__declaredAccessibility
+                                                  __val__isConst
+                                                  __val__isReadonly
+                                                  __val__isVirtual)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("containingType", 3),
+                     ("declaredAccessibility", 4), ("isConst", 5), ("isReadonly", 6),
+                     ("isVirtual", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Field_key where
+  rnf
+    (Field_key __field__name __field__type __field__containingType
+       __field__declaredAccessibility __field__isConst __field__isReadonly
+       __field__isVirtual)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__containingType `Prelude.seq`
+            DeepSeq.rnf __field__declaredAccessibility `Prelude.seq`
+              DeepSeq.rnf __field__isConst `Prelude.seq`
+                DeepSeq.rnf __field__isReadonly `Prelude.seq`
+                  DeepSeq.rnf __field__isVirtual `Prelude.seq` ()
+
+instance Default.Default Field_key where
+  def
+    = Field_key Default.def Default.def Default.def Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Field_key where
+  hashWithSalt __salt
+    (Field_key _name _type _containingType _declaredAccessibility
+       _isConst _isReadonly _isVirtual)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+                    _containingType)
+                 _declaredAccessibility)
+              _isConst)
+           _isReadonly)
+        _isVirtual
+
+data Local_key = Local_key{local_key_name :: Name,
+                           local_key_type :: AType, local_key_containingMethod :: Method,
+                           local_key_refKind :: RefKind, local_key_isConst :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Local_key where
+  toJSON
+    (Local_key __field__name __field__type __field__containingMethod
+       __field__refKind __field__isConst)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "containingMethod" .= __field__containingMethod :
+               "refKind" .= __field__refKind :
+                 "isConst" .= __field__isConst : Prelude.mempty)
+
+instance Thrift.ThriftStruct Local_key where
+  buildStruct _proxy
+    (Local_key __field__name __field__type __field__containingMethod
+       __field__refKind __field__isConst)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "containingMethod"
+               (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__containingMethod)
+               :
+               Thrift.genField _proxy "refKind" (Thrift.getI32Type _proxy) 4 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__refKind)
+                 : Thrift.genFieldBool _proxy "isConst" 5 4 __field__isConst : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__containingMethod <- ST.newSTRef Default.def
+            __field__refKind <- ST.newSTRef Default.def
+            __field__isConst <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingMethod
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RefKind")
+                                                                        ST.writeSTRef
+                                                                          __field__refKind
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isConst
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__containingMethod <- ST.readSTRef
+                                                                           __field__containingMethod
+                                             !__val__refKind <- ST.readSTRef __field__refKind
+                                             !__val__isConst <- ST.readSTRef __field__isConst
+                                             Prelude.pure
+                                               (Local_key __val__name __val__type
+                                                  __val__containingMethod
+                                                  __val__refKind
+                                                  __val__isConst)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("containingMethod", 3), ("refKind", 4),
+                     ("isConst", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData Local_key where
+  rnf
+    (Local_key __field__name __field__type __field__containingMethod
+       __field__refKind __field__isConst)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__containingMethod `Prelude.seq`
+            DeepSeq.rnf __field__refKind `Prelude.seq`
+              DeepSeq.rnf __field__isConst `Prelude.seq` ()
+
+instance Default.Default Local_key where
+  def
+    = Local_key Default.def Default.def Default.def Default.def
+        Prelude.False
+
+instance Hashable.Hashable Local_key where
+  hashWithSalt __salt
+    (Local_key _name _type _containingMethod _refKind _isConst)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+              _containingMethod)
+           _refKind)
+        _isConst
+
+data Method_key = Method_key{method_key_name :: Name,
+                             method_key_containingType :: NamedType,
+                             method_key_typeParameters :: [TypeParameter],
+                             method_key_parameters :: [Parameter],
+                             method_key_isStatic :: Prelude.Bool,
+                             method_key_returnType :: AType,
+                             method_key_declaredAccessibility :: Accessibility}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Method_key where
+  toJSON
+    (Method_key __field__name __field__containingType
+       __field__typeParameters __field__parameters __field__isStatic
+       __field__returnType __field__declaredAccessibility)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containingType" .= __field__containingType :
+             "typeParameters" .= __field__typeParameters :
+               "parameters" .= __field__parameters :
+                 "isStatic" .= __field__isStatic :
+                   "returnType" .= __field__returnType :
+                     "declaredAccessibility" .= __field__declaredAccessibility :
+                       Prelude.mempty)
+
+instance Thrift.ThriftStruct Method_key where
+  buildStruct _proxy
+    (Method_key __field__name __field__containingType
+       __field__typeParameters __field__parameters __field__isStatic
+       __field__returnType __field__declaredAccessibility)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containingType"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containingType)
+             :
+             Thrift.genField _proxy "typeParameters" (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__typeParameters)
+               :
+               Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__parameters)
+                 :
+                 Thrift.genFieldBool _proxy "isStatic" 5 4 __field__isStatic :
+                   Thrift.genField _proxy "returnType" (Thrift.getStructType _proxy) 6
+                     5
+                     (Thrift.buildStruct _proxy __field__returnType)
+                     :
+                     Thrift.genField _proxy "declaredAccessibility"
+                       (Thrift.getI32Type _proxy)
+                       7
+                       6
+                       ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                           Thrift.fromThriftEnum)
+                          __field__declaredAccessibility)
+                       : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Default.def
+            __field__typeParameters <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__returnType <- ST.newSTRef Default.def
+            __field__declaredAccessibility <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParameters
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnType
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Accessibility")
+                                                                        ST.writeSTRef
+                                                                          __field__declaredAccessibility
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__typeParameters <- ST.readSTRef
+                                                                         __field__typeParameters
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__returnType <- ST.readSTRef __field__returnType
+                                             !__val__declaredAccessibility <- ST.readSTRef
+                                                                                __field__declaredAccessibility
+                                             Prelude.pure
+                                               (Method_key __val__name __val__containingType
+                                                  __val__typeParameters
+                                                  __val__parameters
+                                                  __val__isStatic
+                                                  __val__returnType
+                                                  __val__declaredAccessibility)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("containingType", 2), ("typeParameters", 3),
+                     ("parameters", 4), ("isStatic", 5), ("returnType", 6),
+                     ("declaredAccessibility", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Method_key where
+  rnf
+    (Method_key __field__name __field__containingType
+       __field__typeParameters __field__parameters __field__isStatic
+       __field__returnType __field__declaredAccessibility)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containingType `Prelude.seq`
+          DeepSeq.rnf __field__typeParameters `Prelude.seq`
+            DeepSeq.rnf __field__parameters `Prelude.seq`
+              DeepSeq.rnf __field__isStatic `Prelude.seq`
+                DeepSeq.rnf __field__returnType `Prelude.seq`
+                  DeepSeq.rnf __field__declaredAccessibility `Prelude.seq` ()
+
+instance Default.Default Method_key where
+  def
+    = Method_key Default.def Default.def Default.def Default.def
+        Prelude.False
+        Default.def
+        Default.def
+
+instance Hashable.Hashable Method_key where
+  hashWithSalt __salt
+    (Method_key _name _containingType _typeParameters _parameters
+       _isStatic _returnType _declaredAccessibility)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                       _containingType)
+                    _typeParameters)
+                 _parameters)
+              _isStatic)
+           _returnType)
+        _declaredAccessibility
+
+data ObjectCreationLocation_key = ObjectCreationLocation_key{objectCreationLocation_key_type
+                                                             :: AType,
+                                                             objectCreationLocation_key_constructor
+                                                             :: Method,
+                                                             objectCreationLocation_key_location ::
+                                                             Location}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectCreationLocation_key where
+  toJSON
+    (ObjectCreationLocation_key __field__type __field__constructor
+       __field__location)
+    = Aeson.object
+        ("type" .= __field__type :
+           "constructor" .= __field__constructor :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectCreationLocation_key where
+  buildStruct _proxy
+    (ObjectCreationLocation_key __field__type __field__constructor
+       __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "constructor" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__constructor)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__constructor <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__constructor
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__constructor <- ST.readSTRef
+                                                                      __field__constructor
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ObjectCreationLocation_key __val__type
+                                                  __val__constructor
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList
+                    [("type", 1), ("constructor", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectCreationLocation_key where
+  rnf
+    (ObjectCreationLocation_key __field__type __field__constructor
+       __field__location)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__constructor `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ObjectCreationLocation_key where
+  def
+    = ObjectCreationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ObjectCreationLocation_key where
+  hashWithSalt __salt
+    (ObjectCreationLocation_key _type _constructor _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type)
+           _constructor)
+        _location
+
+data Parameter_key = Parameter_key{parameter_key_name :: Name,
+                                   parameter_key_type :: AType, parameter_key_refKind :: RefKind,
+                                   parameter_key_isThis :: Prelude.Bool,
+                                   parameter_key_isParams :: Prelude.Bool,
+                                   parameter_key_isOptional :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Parameter_key where
+  toJSON
+    (Parameter_key __field__name __field__type __field__refKind
+       __field__isThis __field__isParams __field__isOptional)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "refKind" .= __field__refKind :
+               "isThis" .= __field__isThis :
+                 "isParams" .= __field__isParams :
+                   "isOptional" .= __field__isOptional : Prelude.mempty)
+
+instance Thrift.ThriftStruct Parameter_key where
+  buildStruct _proxy
+    (Parameter_key __field__name __field__type __field__refKind
+       __field__isThis __field__isParams __field__isOptional)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "refKind" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__refKind)
+               :
+               Thrift.genFieldBool _proxy "isThis" 4 3 __field__isThis :
+                 Thrift.genFieldBool _proxy "isParams" 5 4 __field__isParams :
+                   Thrift.genFieldBool _proxy "isOptional" 6 5 __field__isOptional :
+                     [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__refKind <- ST.newSTRef Default.def
+            __field__isThis <- ST.newSTRef Prelude.False
+            __field__isParams <- ST.newSTRef Prelude.False
+            __field__isOptional <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RefKind")
+                                                                        ST.writeSTRef
+                                                                          __field__refKind
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isThis
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isParams
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isOptional
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__refKind <- ST.readSTRef __field__refKind
+                                             !__val__isThis <- ST.readSTRef __field__isThis
+                                             !__val__isParams <- ST.readSTRef __field__isParams
+                                             !__val__isOptional <- ST.readSTRef __field__isOptional
+                                             Prelude.pure
+                                               (Parameter_key __val__name __val__type __val__refKind
+                                                  __val__isThis
+                                                  __val__isParams
+                                                  __val__isOptional)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("refKind", 3), ("isThis", 4),
+                     ("isParams", 5), ("isOptional", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData Parameter_key where
+  rnf
+    (Parameter_key __field__name __field__type __field__refKind
+       __field__isThis __field__isParams __field__isOptional)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__refKind `Prelude.seq`
+            DeepSeq.rnf __field__isThis `Prelude.seq`
+              DeepSeq.rnf __field__isParams `Prelude.seq`
+                DeepSeq.rnf __field__isOptional `Prelude.seq` ()
+
+instance Default.Default Parameter_key where
+  def
+    = Parameter_key Default.def Default.def Default.def Prelude.False
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Parameter_key where
+  hashWithSalt __salt
+    (Parameter_key _name _type _refKind _isThis _isParams _isOptional)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+                 _refKind)
+              _isThis)
+           _isParams)
+        _isOptional
+
+newtype PointerType_key = PointerType_key{pointerType_key_pointedAtType
+                                          :: AType}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PointerType_key where
+  toJSON (PointerType_key __field__pointedAtType)
+    = Aeson.object
+        ("pointedAtType" .= __field__pointedAtType : Prelude.mempty)
+
+instance Thrift.ThriftStruct PointerType_key where
+  buildStruct _proxy (PointerType_key __field__pointedAtType)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "pointedAtType"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__pointedAtType)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__pointedAtType <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__pointedAtType
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__pointedAtType <- ST.readSTRef
+                                                                        __field__pointedAtType
+                                             Prelude.pure (PointerType_key __val__pointedAtType)
+              _idMap = HashMap.fromList [("pointedAtType", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PointerType_key where
+  rnf (PointerType_key __field__pointedAtType)
+    = DeepSeq.rnf __field__pointedAtType `Prelude.seq` ()
+
+instance Default.Default PointerType_key where
+  def = PointerType_key Default.def
+
+instance Hashable.Hashable PointerType_key where
+  hashWithSalt __salt (PointerType_key _pointedAtType)
+    = Hashable.hashWithSalt __salt _pointedAtType
+
+data Property_key = Property_key{property_key_name :: Name,
+                                 property_key_containingType :: NamedType,
+                                 property_key_type :: AType, property_key_parameters :: [Parameter],
+                                 property_key_getMethod :: Prelude.Maybe Method,
+                                 property_key_setMethod :: Prelude.Maybe Method,
+                                 property_key_isStatic :: Prelude.Bool,
+                                 property_key_isIndexer :: Prelude.Bool}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Property_key where
+  toJSON
+    (Property_key __field__name __field__containingType __field__type
+       __field__parameters __field__getMethod __field__setMethod
+       __field__isStatic __field__isIndexer)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containingType" .= __field__containingType :
+             "type" .= __field__type :
+               "parameters" .= __field__parameters :
+                 Prelude.maybe Prelude.id ((:) . ("getMethod" .=))
+                   __field__getMethod
+                   (Prelude.maybe Prelude.id ((:) . ("setMethod" .=))
+                      __field__setMethod
+                      ("isStatic" .= __field__isStatic :
+                         "isIndexer" .= __field__isIndexer : Prelude.mempty)))
+
+instance Thrift.ThriftStruct Property_key where
+  buildStruct _proxy
+    (Property_key __field__name __field__containingType __field__type
+       __field__parameters __field__getMethod __field__setMethod
+       __field__isStatic __field__isIndexer)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containingType"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containingType)
+             :
+             Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__type)
+               :
+               Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__parameters)
+                 :
+                 let (__cereal__getMethod, __id__getMethod)
+                       = case __field__getMethod of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "getMethod"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__getMethod
+                     (let (__cereal__setMethod, __id__setMethod)
+                            = case __field__setMethod of
+                                Prelude.Just _val -> ((:)
+                                                        (Thrift.genField _proxy "setMethod"
+                                                           (Thrift.getStructType _proxy)
+                                                           6
+                                                           __id__getMethod
+                                                           (Thrift.buildStruct _proxy _val)),
+                                                      6)
+                                Prelude.Nothing -> (Prelude.id, __id__getMethod)
+                        in
+                        __cereal__setMethod
+                          (Thrift.genFieldBool _proxy "isStatic" 7 __id__setMethod
+                             __field__isStatic
+                             :
+                             Thrift.genFieldBool _proxy "isIndexer" 8 7 __field__isIndexer :
+                               [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containingType <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__getMethod <- ST.newSTRef Prelude.Nothing
+            __field__setMethod <- ST.newSTRef Prelude.Nothing
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__isIndexer <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containingType
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__getMethod
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__setMethod
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isIndexer
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containingType <- ST.readSTRef
+                                                                         __field__containingType
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__getMethod <- ST.readSTRef __field__getMethod
+                                             !__val__setMethod <- ST.readSTRef __field__setMethod
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__isIndexer <- ST.readSTRef __field__isIndexer
+                                             Prelude.pure
+                                               (Property_key __val__name __val__containingType
+                                                  __val__type
+                                                  __val__parameters
+                                                  __val__getMethod
+                                                  __val__setMethod
+                                                  __val__isStatic
+                                                  __val__isIndexer)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("containingType", 2), ("type", 3),
+                     ("parameters", 4), ("getMethod", 5), ("setMethod", 6),
+                     ("isStatic", 7), ("isIndexer", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData Property_key where
+  rnf
+    (Property_key __field__name __field__containingType __field__type
+       __field__parameters __field__getMethod __field__setMethod
+       __field__isStatic __field__isIndexer)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containingType `Prelude.seq`
+          DeepSeq.rnf __field__type `Prelude.seq`
+            DeepSeq.rnf __field__parameters `Prelude.seq`
+              DeepSeq.rnf __field__getMethod `Prelude.seq`
+                DeepSeq.rnf __field__setMethod `Prelude.seq`
+                  DeepSeq.rnf __field__isStatic `Prelude.seq`
+                    DeepSeq.rnf __field__isIndexer `Prelude.seq` ()
+
+instance Default.Default Property_key where
+  def
+    = Property_key Default.def Default.def Default.def Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.False
+        Prelude.False
+
+instance Hashable.Hashable Property_key where
+  hashWithSalt __salt
+    (Property_key _name _containingType _type _parameters _getMethod
+       _setMethod _isStatic _isIndexer)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                          _containingType)
+                       _type)
+                    _parameters)
+                 _getMethod)
+              _setMethod)
+           _isStatic)
+        _isIndexer
+
+data TypeLocation_key = TypeLocation_key{typeLocation_key_type ::
+                                         AType,
+                                         typeLocation_key_location :: Location}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeLocation_key where
+  toJSON (TypeLocation_key __field__type __field__location)
+    = Aeson.object
+        ("type" .= __field__type :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeLocation_key where
+  buildStruct _proxy
+    (TypeLocation_key __field__type __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (TypeLocation_key __val__type __val__location)
+              _idMap = HashMap.fromList [("type", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeLocation_key where
+  rnf (TypeLocation_key __field__type __field__location)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default TypeLocation_key where
+  def = TypeLocation_key Default.def Default.def
+
+instance Hashable.Hashable TypeLocation_key where
+  hashWithSalt __salt (TypeLocation_key _type _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type)
+        _location
+{-# LINE 18 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.UnityPackageToProject_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.UnityPackageToProject_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.UnityPackageToProject_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.UnityPackageToProject_key"
+           (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.UnityPackageToProject_key
+     =
+     'Angle.TField "unityPackage"
+       (Glean.KeyType Glean.Schema.Csharp.Types.UnityPackage)
+       ('Angle.TField "project"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Project)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.UnityPackageToProject
+         where
+  type KeyType Glean.Schema.Csharp.Types.UnityPackageToProject =
+       Glean.Schema.Csharp.Types.UnityPackageToProject_key
+  getName _proxy
+    = Glean.PredicateRef "csharp.UnityPackageToProject" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.unityPackageToProject_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.UnityPackageToProject x k
+  getFactKey = Glean.Schema.Csharp.Types.unityPackageToProject_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityPackageToProject
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FileDefinitions_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.FileDefinitions_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.FileDefinitions_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.FileDefinitions_key" (Prelude.Just 0))
+{-# LINE 53 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.FileDefinitions_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "defn" (Glean.Schema.Csharp.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 55 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.FileDefinitions
+         where
+  type KeyType Glean.Schema.Csharp.Types.FileDefinitions =
+       Glean.Schema.Csharp.Types.FileDefinitions_key
+  getName _proxy = Glean.PredicateRef "csharp.FileDefinitions" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.fileDefinitions_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.FileDefinitions x k
+  getFactKey = Glean.Schema.Csharp.Types.fileDefinitions_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 64 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FileDefinitions where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 70 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.ObjectCreationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.ObjectCreationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.ObjectCreationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.ObjectCreationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 81 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.ObjectCreationLocation_key
+     =
+     'Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+       ('Angle.TField "constructor"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+          ('Angle.TField "location" (Glean.Schema.Csharp.Types.Location)
+             ('Angle.TNoFields)))
+{-# LINE 83 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.ObjectCreationLocation
+         where
+  type KeyType Glean.Schema.Csharp.Types.ObjectCreationLocation =
+       Glean.Schema.Csharp.Types.ObjectCreationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "csharp.ObjectCreationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.objectCreationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.ObjectCreationLocation x k
+  getFactKey = Glean.Schema.Csharp.Types.objectCreationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 92 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.ObjectCreationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 98 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Method_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Method_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Method_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Method_key" (Prelude.Just 0))
+{-# LINE 117 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Method_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "containingType"
+          (Glean.Schema.Csharp.Types.NamedType)
+          ('Angle.TField "typeParameters"
+             ([Glean.Schema.Csharp.Types.TypeParameter])
+             ('Angle.TField "parameters" ([Glean.Schema.Csharp.Types.Parameter])
+                ('Angle.TField "isStatic" (Prelude.Bool)
+                   ('Angle.TField "returnType" (Glean.Schema.Csharp.Types.AType)
+                      ('Angle.TField "declaredAccessibility"
+                         (Glean.Schema.Csharp.Types.Accessibility)
+                         ('Angle.TNoFields)))))))
+{-# LINE 119 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Method where
+  type KeyType Glean.Schema.Csharp.Types.Method =
+       Glean.Schema.Csharp.Types.Method_key
+  getName _proxy = Glean.PredicateRef "csharp.Method" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.method_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Method x k
+  getFactKey = Glean.Schema.Csharp.Types.method_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 128 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Method where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 134 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.DefinitionLocationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.DefinitionLocationName_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.DefinitionLocationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.DefinitionLocationName_key"
+           (Prelude.Just 0))
+{-# LINE 147 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.DefinitionLocationName_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Csharp.Types.Definition)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))))
+{-# LINE 149 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.DefinitionLocationName
+         where
+  type KeyType Glean.Schema.Csharp.Types.DefinitionLocationName =
+       Glean.Schema.Csharp.Types.DefinitionLocationName_key
+  getName _proxy
+    = Glean.PredicateRef "csharp.DefinitionLocationName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.definitionLocationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.DefinitionLocationName x k
+  getFactKey = Glean.Schema.Csharp.Types.definitionLocationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 158 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.DefinitionLocationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 164 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ProjectToSolution_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.ProjectToSolution_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.ProjectToSolution_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.ProjectToSolution_key" (Prelude.Just 0))
+{-# LINE 173 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.ProjectToSolution_key
+     =
+     'Angle.TField "project"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Project)
+       ('Angle.TField "solution"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Solution)
+          ('Angle.TNoFields))
+{-# LINE 175 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.ProjectToSolution
+         where
+  type KeyType Glean.Schema.Csharp.Types.ProjectToSolution =
+       Glean.Schema.Csharp.Types.ProjectToSolution_key
+  getName _proxy = Glean.PredicateRef "csharp.ProjectToSolution" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.projectToSolution_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.ProjectToSolution x k
+  getFactKey = Glean.Schema.Csharp.Types.projectToSolution_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 184 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ProjectToSolution
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 190 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Local_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Local_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Local_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Local_key" (Prelude.Just 0))
+{-# LINE 205 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Local_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+          ('Angle.TField "containingMethod"
+             (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+             ('Angle.TField "refKind" (Glean.Schema.Csharp.Types.RefKind)
+                ('Angle.TField "isConst" (Prelude.Bool) ('Angle.TNoFields)))))
+{-# LINE 207 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Local where
+  type KeyType Glean.Schema.Csharp.Types.Local =
+       Glean.Schema.Csharp.Types.Local_key
+  getName _proxy = Glean.PredicateRef "csharp.Local" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.local_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Local x k
+  getFactKey = Glean.Schema.Csharp.Types.local_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 216 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Local where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 222 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MSBuildProjectSource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MSBuildProjectSource_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.MSBuildProjectSource_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MSBuildProjectSource_key"
+           (Prelude.Just 0))
+{-# LINE 229 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.MSBuildProjectSource_key
+     =
+     'Angle.TField "src" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TNoFields)
+{-# LINE 231 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.MSBuildProjectSource
+         where
+  type KeyType Glean.Schema.Csharp.Types.MSBuildProjectSource =
+       Glean.Schema.Csharp.Types.MSBuildProjectSource_key
+  getName _proxy = Glean.PredicateRef "csharp.MSBuildProjectSource" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.mSBuildProjectSource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.MSBuildProjectSource x k
+  getFactKey = Glean.Schema.Csharp.Types.mSBuildProjectSource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 240 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.MSBuildProjectSource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 246 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Implements_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.Implements_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Implements_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Implements_key" (Prelude.Just 0))
+{-# LINE 255 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Implements_key =
+     'Angle.TField "type" (Glean.Schema.Csharp.Types.NamedType)
+       ('Angle.TField "interface_"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Interface)
+          ('Angle.TNoFields))
+{-# LINE 257 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Implements where
+  type KeyType Glean.Schema.Csharp.Types.Implements =
+       Glean.Schema.Csharp.Types.Implements_key
+  getName _proxy = Glean.PredicateRef "csharp.Implements" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.implements_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Implements x k
+  getFactKey = Glean.Schema.Csharp.Types.implements_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 266 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Implements where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 272 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Namespace_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.Namespace_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Namespace_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Namespace_key" (Prelude.Just 0))
+{-# LINE 281 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Namespace_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "containingNamespace"
+          (Prelude.Maybe Glean.Schema.Csharp.Types.Namespace)
+          ('Angle.TNoFields))
+{-# LINE 283 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Namespace where
+  type KeyType Glean.Schema.Csharp.Types.Namespace =
+       Glean.Schema.Csharp.Types.Namespace_key
+  getName _proxy = Glean.PredicateRef "csharp.Namespace" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.namespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Namespace x k
+  getFactKey = Glean.Schema.Csharp.Types.namespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 292 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Namespace where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 298 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Name where
+  type KeyType Glean.Schema.Csharp.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "csharp.Name" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Name x k
+  getFactKey = Glean.Schema.Csharp.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 306 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 312 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.SearchByName_key
+         where
+  buildRtsValue b (Glean.Schema.Csharp.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.SearchByName_key" (Prelude.Just 0))
+{-# LINE 321 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.SearchByName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "defn" (Glean.Schema.Csharp.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 323 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.SearchByName
+         where
+  type KeyType Glean.Schema.Csharp.Types.SearchByName =
+       Glean.Schema.Csharp.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "csharp.SearchByName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.SearchByName x k
+  getFactKey = Glean.Schema.Csharp.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 332 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 338 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Project_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Project_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Project_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Project_key" (Prelude.Just 0))
+{-# LINE 357 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Project_key =
+     'Angle.TField "source" (Glean.Schema.Csharp.Types.ProjectSource)
+       ('Angle.TField "platformTarget" (Prelude.Maybe Data.Text.Text)
+          ('Angle.TField "targetFramework" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TField "sdk" (Prelude.Maybe Data.Text.Text)
+                ('Angle.TField "outputType" (Prelude.Maybe Data.Text.Text)
+                   ('Angle.TField "assemblyName" (Prelude.Maybe Data.Text.Text)
+                      ('Angle.TField "rootNamespace" (Prelude.Maybe Data.Text.Text)
+                         ('Angle.TNoFields)))))))
+{-# LINE 359 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Project where
+  type KeyType Glean.Schema.Csharp.Types.Project =
+       Glean.Schema.Csharp.Types.Project_key
+  getName _proxy = Glean.PredicateRef "csharp.Project" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.project_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Project x k
+  getFactKey = Glean.Schema.Csharp.Types.project_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 368 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Project where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 374 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Solution_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.Solution_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Solution_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Solution_key" (Prelude.Just 0))
+{-# LINE 381 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Solution_key =
+     'Angle.TField "src" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TNoFields)
+{-# LINE 383 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Solution where
+  type KeyType Glean.Schema.Csharp.Types.Solution =
+       Glean.Schema.Csharp.Types.Solution_key
+  getName _proxy = Glean.PredicateRef "csharp.Solution" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.solution_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Solution x k
+  getFactKey = Glean.Schema.Csharp.Types.solution_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 392 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Solution where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 398 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Property_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Property_key x1 x2 x3 x4 x5 x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Property_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Property_key" (Prelude.Just 0))
+{-# LINE 419 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Property_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "containingType"
+          (Glean.Schema.Csharp.Types.NamedType)
+          ('Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+             ('Angle.TField "parameters" ([Glean.Schema.Csharp.Types.Parameter])
+                ('Angle.TField "getMethod"
+                   (Prelude.Maybe Glean.Schema.Csharp.Types.Method)
+                   ('Angle.TField "setMethod"
+                      (Prelude.Maybe Glean.Schema.Csharp.Types.Method)
+                      ('Angle.TField "isStatic" (Prelude.Bool)
+                         ('Angle.TField "isIndexer" (Prelude.Bool) ('Angle.TNoFields))))))))
+{-# LINE 421 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Property where
+  type KeyType Glean.Schema.Csharp.Types.Property =
+       Glean.Schema.Csharp.Types.Property_key
+  getName _proxy = Glean.PredicateRef "csharp.Property" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.property_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Property x k
+  getFactKey = Glean.Schema.Csharp.Types.property_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 430 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Property where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 436 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FileEntityXRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.FileEntityXRefs_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.FileEntityXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.FileEntityXRefs_key" (Prelude.Just 0))
+{-# LINE 447 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.FileEntityXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "use" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "target" (Glean.Schema.Csharp.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 449 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.FileEntityXRefs
+         where
+  type KeyType Glean.Schema.Csharp.Types.FileEntityXRefs =
+       Glean.Schema.Csharp.Types.FileEntityXRefs_key
+  getName _proxy = Glean.PredicateRef "csharp.FileEntityXRefs" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.fileEntityXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.FileEntityXRefs x k
+  getFactKey = Glean.Schema.Csharp.Types.fileEntityXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 458 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FileEntityXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 464 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.ProjectToSourceFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.ProjectToSourceFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.ProjectToSourceFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.ProjectToSourceFile_key" (Prelude.Just 0))
+{-# LINE 473 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.ProjectToSourceFile_key
+     =
+     'Angle.TField "project"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Project)
+       ('Angle.TField "src" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 475 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.ProjectToSourceFile
+         where
+  type KeyType Glean.Schema.Csharp.Types.ProjectToSourceFile =
+       Glean.Schema.Csharp.Types.ProjectToSourceFile_key
+  getName _proxy = Glean.PredicateRef "csharp.ProjectToSourceFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.projectToSourceFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.ProjectToSourceFile x k
+  getFactKey = Glean.Schema.Csharp.Types.projectToSourceFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 484 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ProjectToSourceFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 490 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityPackage_key
+         where
+  buildRtsValue b (Glean.Schema.Csharp.Types.UnityPackage_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.UnityPackage_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.UnityPackage_key" (Prelude.Just 0))
+{-# LINE 499 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.UnityPackage_key =
+     'Angle.TField "type" (Glean.Schema.Csharp.Types.UnityPackageType)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 501 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.UnityPackage
+         where
+  type KeyType Glean.Schema.Csharp.Types.UnityPackage =
+       Glean.Schema.Csharp.Types.UnityPackage_key
+  getName _proxy = Glean.PredicateRef "csharp.UnityPackage" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.unityPackage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.UnityPackage x k
+  getFactKey = Glean.Schema.Csharp.Types.unityPackage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 510 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityPackage where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 516 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.TypeParameter_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.TypeParameter_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.TypeParameter_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.TypeParameter_key" (Prelude.Just 0))
+{-# LINE 531 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.TypeParameter_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "variance"
+          (Prelude.Maybe Glean.Schema.Csharp.Types.Variance)
+          ('Angle.TField "hasNotNullConstraint" (Prelude.Bool)
+             ('Angle.TField "hasReferenceTypeConstraint" (Prelude.Bool)
+                ('Angle.TField "hasValueTypeConstraint" (Prelude.Bool)
+                   ('Angle.TNoFields)))))
+{-# LINE 533 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.TypeParameter
+         where
+  type KeyType Glean.Schema.Csharp.Types.TypeParameter =
+       Glean.Schema.Csharp.Types.TypeParameter_key
+  getName _proxy = Glean.PredicateRef "csharp.TypeParameter" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.typeParameter_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.TypeParameter x k
+  getFactKey = Glean.Schema.Csharp.Types.typeParameter_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 542 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.TypeParameter where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 548 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.NameLowerCase_key
+         where
+  buildRtsValue b (Glean.Schema.Csharp.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 557 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.NameLowerCase_key =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 559 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Csharp.Types.NameLowerCase =
+       Glean.Schema.Csharp.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "csharp.NameLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Csharp.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 568 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 574 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.FunctionPointerType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.FunctionPointerType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.FunctionPointerType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.FunctionPointerType_key" (Prelude.Just 0))
+{-# LINE 583 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.FunctionPointerType_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Csharp.Types.FullName)
+       ('Angle.TField "signature"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+          ('Angle.TNoFields))
+{-# LINE 585 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.FunctionPointerType
+         where
+  type KeyType Glean.Schema.Csharp.Types.FunctionPointerType =
+       Glean.Schema.Csharp.Types.FunctionPointerType_key
+  getName _proxy = Glean.PredicateRef "csharp.FunctionPointerType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.functionPointerType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.FunctionPointerType x k
+  getFactKey = Glean.Schema.Csharp.Types.functionPointerType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 594 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FunctionPointerType
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 600 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Interface_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Interface_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Interface_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Interface_key" (Prelude.Just 0))
+{-# LINE 615 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Interface_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Csharp.Types.FullName)
+       ('Angle.TField "typeParameters"
+          ([Glean.Schema.Csharp.Types.TypeParameter])
+          ('Angle.TField "containingType"
+             (Prelude.Maybe Glean.Schema.Csharp.Types.NamedType)
+             ('Angle.TField "declaredAccessibility"
+                (Glean.Schema.Csharp.Types.Accessibility)
+                ('Angle.TField "isStatic" (Prelude.Bool) ('Angle.TNoFields)))))
+{-# LINE 617 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Interface where
+  type KeyType Glean.Schema.Csharp.Types.Interface =
+       Glean.Schema.Csharp.Types.Interface_key
+  getName _proxy = Glean.PredicateRef "csharp.Interface" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.interface_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Interface x k
+  getFactKey = Glean.Schema.Csharp.Types.interface_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 626 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Interface where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 632 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.PointerType_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.PointerType_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.PointerType_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.PointerType_key" (Prelude.Just 0))
+{-# LINE 639 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.PointerType_key =
+     'Angle.TField "pointedAtType" (Glean.Schema.Csharp.Types.AType)
+       ('Angle.TNoFields)
+{-# LINE 641 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.PointerType
+         where
+  type KeyType Glean.Schema.Csharp.Types.PointerType =
+       Glean.Schema.Csharp.Types.PointerType_key
+  getName _proxy = Glean.PredicateRef "csharp.PointerType" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.pointerType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.PointerType x k
+  getFactKey = Glean.Schema.Csharp.Types.pointerType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 650 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.PointerType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 656 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Record_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Record_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Record_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Record_key" (Prelude.Just 0))
+{-# LINE 675 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Record_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Csharp.Types.FullName)
+       ('Angle.TField "baseType"
+          (Prelude.Maybe Glean.Schema.Csharp.Types.Record)
+          ('Angle.TField "typeParameters"
+             ([Glean.Schema.Csharp.Types.TypeParameter])
+             ('Angle.TField "containingType"
+                (Prelude.Maybe Glean.Schema.Csharp.Types.NamedType)
+                ('Angle.TField "declaredAccessibility"
+                   (Glean.Schema.Csharp.Types.Accessibility)
+                   ('Angle.TField "isAbstract" (Prelude.Bool)
+                      ('Angle.TField "isSealed" (Prelude.Bool) ('Angle.TNoFields)))))))
+{-# LINE 677 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Record where
+  type KeyType Glean.Schema.Csharp.Types.Record =
+       Glean.Schema.Csharp.Types.Record_key
+  getName _proxy = Glean.PredicateRef "csharp.Record" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.record_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Record x k
+  getFactKey = Glean.Schema.Csharp.Types.record_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 686 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Record where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 692 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Struct_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.Struct_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Struct_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Struct_key" (Prelude.Just 0))
+{-# LINE 705 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Struct_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Csharp.Types.FullName)
+       ('Angle.TField "typeParameters"
+          ([Glean.Schema.Csharp.Types.TypeParameter])
+          ('Angle.TField "containingType"
+             (Prelude.Maybe Glean.Schema.Csharp.Types.NamedType)
+             ('Angle.TField "declaredAccessibility"
+                (Glean.Schema.Csharp.Types.Accessibility)
+                ('Angle.TNoFields))))
+{-# LINE 707 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Struct where
+  type KeyType Glean.Schema.Csharp.Types.Struct =
+       Glean.Schema.Csharp.Types.Struct_key
+  getName _proxy = Glean.PredicateRef "csharp.Struct" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.struct_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Struct x k
+  getFactKey = Glean.Schema.Csharp.Types.struct_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 716 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Struct where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 722 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.DefinitionLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.DefinitionLocation_key" (Prelude.Just 0))
+{-# LINE 731 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.DefinitionLocation_key
+     =
+     'Angle.TField "definition" (Glean.Schema.Csharp.Types.Definition)
+       ('Angle.TField "location" (Glean.Schema.Csharp.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 733 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.Csharp.Types.DefinitionLocation =
+       Glean.Schema.Csharp.Types.DefinitionLocation_key
+  getName _proxy = Glean.PredicateRef "csharp.DefinitionLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.Csharp.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 742 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 748 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Parameter_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Parameter_key x1 x2 x3 x4 x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Parameter_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Parameter_key" (Prelude.Just 0))
+{-# LINE 765 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Parameter_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+          ('Angle.TField "refKind" (Glean.Schema.Csharp.Types.RefKind)
+             ('Angle.TField "isThis" (Prelude.Bool)
+                ('Angle.TField "isParams" (Prelude.Bool)
+                   ('Angle.TField "isOptional" (Prelude.Bool) ('Angle.TNoFields))))))
+{-# LINE 767 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Parameter where
+  type KeyType Glean.Schema.Csharp.Types.Parameter =
+       Glean.Schema.Csharp.Types.Parameter_key
+  getName _proxy = Glean.PredicateRef "csharp.Parameter" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.parameter_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Parameter x k
+  getFactKey = Glean.Schema.Csharp.Types.parameter_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 776 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Parameter where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 782 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Field_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Field_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Field_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Field_key" (Prelude.Just 0))
+{-# LINE 801 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Field_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+          ('Angle.TField "containingType"
+             (Glean.Schema.Csharp.Types.NamedType)
+             ('Angle.TField "declaredAccessibility"
+                (Glean.Schema.Csharp.Types.Accessibility)
+                ('Angle.TField "isConst" (Prelude.Bool)
+                   ('Angle.TField "isReadonly" (Prelude.Bool)
+                      ('Angle.TField "isVirtual" (Prelude.Bool) ('Angle.TNoFields)))))))
+{-# LINE 803 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Field where
+  type KeyType Glean.Schema.Csharp.Types.Field =
+       Glean.Schema.Csharp.Types.Field_key
+  getName _proxy = Glean.PredicateRef "csharp.Field" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.field_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Field x k
+  getFactKey = Glean.Schema.Csharp.Types.field_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 812 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Field where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 818 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.TypeLocation_key
+         where
+  buildRtsValue b (Glean.Schema.Csharp.Types.TypeLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.TypeLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.TypeLocation_key" (Prelude.Just 0))
+{-# LINE 827 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.TypeLocation_key =
+     'Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+       ('Angle.TField "location" (Glean.Schema.Csharp.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 829 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.TypeLocation
+         where
+  type KeyType Glean.Schema.Csharp.Types.TypeLocation =
+       Glean.Schema.Csharp.Types.TypeLocation_key
+  getName _proxy = Glean.PredicateRef "csharp.TypeLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.typeLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.TypeLocation x k
+  getFactKey = Glean.Schema.Csharp.Types.typeLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 838 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.TypeLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 844 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MethodInvocationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MethodInvocationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.MethodInvocationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MethodInvocationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 855 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.MethodInvocationLocation_key
+     =
+     'Angle.TField "method"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+       ('Angle.TField "location" (Glean.Schema.Csharp.Types.Location)
+          ('Angle.TField "expression"
+             (Prelude.Maybe
+                Glean.Schema.Csharp.Types.MethodInvocationExpression)
+             ('Angle.TNoFields)))
+{-# LINE 857 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.MethodInvocationLocation
+         where
+  type KeyType Glean.Schema.Csharp.Types.MethodInvocationLocation =
+       Glean.Schema.Csharp.Types.MethodInvocationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "csharp.MethodInvocationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.methodInvocationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.MethodInvocationLocation x k
+  getFactKey = Glean.Schema.Csharp.Types.methodInvocationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 866 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MethodInvocationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 872 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.UnityProjectSource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.UnityProjectSource_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.UnityProjectSource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.UnityProjectSource_key" (Prelude.Just 0))
+{-# LINE 885 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.UnityProjectSource_key
+     =
+     'Angle.TField "projectBasename" (Data.Text.Text)
+       ('Angle.TField "unityPackage"
+          (Glean.KeyType Glean.Schema.Csharp.Types.UnityPackage)
+          ('Angle.TField "assemblyType"
+             (Glean.Schema.Csharp.Types.UnityAssemblyType)
+             ('Angle.TField "projectTemplate"
+                (Glean.KeyType Glean.Schema.Src.Types.File)
+                ('Angle.TNoFields))))
+{-# LINE 887 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.UnityProjectSource
+         where
+  type KeyType Glean.Schema.Csharp.Types.UnityProjectSource =
+       Glean.Schema.Csharp.Types.UnityProjectSource_key
+  getName _proxy = Glean.PredicateRef "csharp.UnityProjectSource" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.unityProjectSource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.UnityProjectSource x k
+  getFactKey = Glean.Schema.Csharp.Types.unityProjectSource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 896 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityProjectSource
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 902 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.SolutionToProject_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.SolutionToProject_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.SolutionToProject_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.SolutionToProject_key" (Prelude.Just 0))
+{-# LINE 911 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.SolutionToProject_key
+     =
+     'Angle.TField "solution"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Solution)
+       ('Angle.TField "project"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Project)
+          ('Angle.TNoFields))
+{-# LINE 913 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.SolutionToProject
+         where
+  type KeyType Glean.Schema.Csharp.Types.SolutionToProject =
+       Glean.Schema.Csharp.Types.SolutionToProject_key
+  getName _proxy = Glean.PredicateRef "csharp.SolutionToProject" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.solutionToProject_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.SolutionToProject x k
+  getFactKey = Glean.Schema.Csharp.Types.solutionToProject_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 922 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.SolutionToProject
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 928 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Class_key where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Class_key x1 x2 x3 x4 x5 x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Class_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Class_key" (Prelude.Just 0))
+{-# LINE 949 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.Class_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Csharp.Types.FullName)
+       ('Angle.TField "baseType"
+          (Prelude.Maybe Glean.Schema.Csharp.Types.Class)
+          ('Angle.TField "typeParameters"
+             ([Glean.Schema.Csharp.Types.TypeParameter])
+             ('Angle.TField "containingType"
+                (Prelude.Maybe Glean.Schema.Csharp.Types.NamedType)
+                ('Angle.TField "declaredAccessibility"
+                   (Glean.Schema.Csharp.Types.Accessibility)
+                   ('Angle.TField "isAbstract" (Prelude.Bool)
+                      ('Angle.TField "isStatic" (Prelude.Bool)
+                         ('Angle.TField "isSealed" (Prelude.Bool) ('Angle.TNoFields))))))))
+{-# LINE 951 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.Class where
+  type KeyType Glean.Schema.Csharp.Types.Class =
+       Glean.Schema.Csharp.Types.Class_key
+  getName _proxy = Glean.PredicateRef "csharp.Class" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.class_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.Class x k
+  getFactKey = Glean.Schema.Csharp.Types.class_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 960 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Class where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 966 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MemberAccessLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.MemberAccessLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MemberAccessLocation_key"
+           (Prelude.Just 0))
+{-# LINE 975 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.MemberAccessLocation_key
+     =
+     'Angle.TField "expression"
+       (Glean.Schema.Csharp.Types.MemberAccessExpression)
+       ('Angle.TField "location" (Glean.Schema.Csharp.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 977 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.MemberAccessLocation
+         where
+  type KeyType Glean.Schema.Csharp.Types.MemberAccessLocation =
+       Glean.Schema.Csharp.Types.MemberAccessLocation_key
+  getName _proxy = Glean.PredicateRef "csharp.MemberAccessLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.memberAccessLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.MemberAccessLocation x k
+  getFactKey = Glean.Schema.Csharp.Types.memberAccessLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 986 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.MemberAccessLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 992 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ArrayType_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.ArrayType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.ArrayType_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.ArrayType_key" (Prelude.Just 0))
+{-# LINE 1001 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.ArrayType_key =
+     'Angle.TField "elementType" (Glean.Schema.Csharp.Types.AType)
+       ('Angle.TField "rank" (Glean.Byte) ('Angle.TNoFields))
+{-# LINE 1003 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.ArrayType where
+  type KeyType Glean.Schema.Csharp.Types.ArrayType =
+       Glean.Schema.Csharp.Types.ArrayType_key
+  getName _proxy = Glean.PredicateRef "csharp.ArrayType" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.arrayType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.ArrayType x k
+  getFactKey = Glean.Schema.Csharp.Types.arrayType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1012 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ArrayType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1018 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FullName_key where
+  buildRtsValue b (Glean.Schema.Csharp.Types.FullName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.FullName_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.FullName_key" (Prelude.Just 0))
+{-# LINE 1027 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Csharp.Types.FullName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Csharp.Types.Name)
+       ('Angle.TField "containingNamespace"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Namespace)
+          ('Angle.TNoFields))
+{-# LINE 1029 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Csharp.Types.FullName where
+  type KeyType Glean.Schema.Csharp.Types.FullName =
+       Glean.Schema.Csharp.Types.FullName_key
+  getName _proxy = Glean.PredicateRef "csharp.FullName" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Csharp.Types.fullName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.FullName x k
+  getFactKey = Glean.Schema.Csharp.Types.fullName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1038 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.FullName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1044 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.SourceFileToProject_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.SourceFileToProject_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.SourceFileToProject_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.SourceFileToProject_key" (Prelude.Just 0))
+{-# LINE 1053 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.SourceFileToProject_key
+     =
+     'Angle.TField "src" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "project"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Project)
+          ('Angle.TNoFields))
+{-# LINE 1055 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Csharp.Types.SourceFileToProject
+         where
+  type KeyType Glean.Schema.Csharp.Types.SourceFileToProject =
+       Glean.Schema.Csharp.Types.SourceFileToProject_key
+  getName _proxy = Glean.PredicateRef "csharp.SourceFileToProject" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Csharp.Types.sourceFileToProject_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Csharp.Types.SourceFileToProject x k
+  getFactKey = Glean.Schema.Csharp.Types.sourceFileToProject_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1064 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.SourceFileToProject
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1070 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Location where
+  buildRtsValue b (Glean.Schema.Csharp.Types.Location x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.Location <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Location" (Prelude.Just 1))
+{-# LINE 1079 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Csharp.Types.Location
+     =
+     'Angle.TField "fileLocation" (Glean.Schema.Src.Types.FileLocation)
+       ('Angle.TField "fileLines"
+          (Glean.KeyType Glean.Schema.Src.Types.FileLines)
+          ('Angle.TNoFields))
+{-# LINE 1081 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MethodInvocationExpression
+         where
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MethodInvocationExpression x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Csharp.Types.MethodInvocationExpression <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MethodInvocationExpression"
+           (Prelude.Just 1))
+{-# LINE 1088 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Csharp.Types.MethodInvocationExpression
+     =
+     'Angle.TField "memberAccess"
+       (Glean.KeyType Glean.Schema.Csharp.Types.MemberAccessLocation)
+       ('Angle.TNoFields)
+{-# LINE 1090 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Variance where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Variance" (Prelude.Just 1))
+{-# LINE 1095 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.Variance =
+     'Angle.TField "In" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "None_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Out" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 1097 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Csharp.Types.Variance where
+  type AngleEnumTy Glean.Schema.Csharp.Types.Variance =
+       Glean.Schema.Csharp.Types.Variance
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 1101 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityPackageType
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.UnityPackageType" (Prelude.Just 1))
+{-# LINE 1106 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Csharp.Types.UnityPackageType =
+     'Angle.TField "Undefined" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "ThirdParty" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Core" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Runtime" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Modules" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Worlds" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Apps" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Clones" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "TestPackages" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TNoFields)))))))))
+{-# LINE 1108 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Csharp.Types.UnityPackageType
+         where
+  type AngleEnumTy Glean.Schema.Csharp.Types.UnityPackageType =
+       Glean.Schema.Csharp.Types.UnityPackageType
+  enumName v = Text.pack (Prelude.drop 17 (Prelude.show v))
+{-# LINE 1112 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.NamedType where
+  buildRtsValue b Glean.Schema.Csharp.Types.NamedType_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Csharp.Types.NamedType_class_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.NamedType_interface_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.NamedType_record_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.NamedType_struct_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Csharp.Types.NamedType_EMPTY)
+        [Glean.mapD Glean.Schema.Csharp.Types.NamedType_class_,
+         Glean.mapD Glean.Schema.Csharp.Types.NamedType_interface_,
+         Glean.mapD Glean.Schema.Csharp.Types.NamedType_record_,
+         Glean.mapD Glean.Schema.Csharp.Types.NamedType_struct_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.NamedType" (Prelude.Just 1))
+{-# LINE 1136 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.NamedType =
+     'Angle.TField "class_"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Class)
+       ('Angle.TField "interface_"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Interface)
+          ('Angle.TField "record_"
+             (Glean.KeyType Glean.Schema.Csharp.Types.Record)
+             ('Angle.TField "struct_"
+                (Glean.KeyType Glean.Schema.Csharp.Types.Struct)
+                ('Angle.TNoFields))))
+{-# LINE 1138 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.UnityAssemblyType
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.UnityAssemblyType" (Prelude.Just 1))
+{-# LINE 1143 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Csharp.Types.UnityAssemblyType =
+     'Angle.TField "Package" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Editor" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Tests" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "TestsEditor" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "UnitTests" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Internal" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "AllApis" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TNoFields)))))))
+{-# LINE 1145 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.Csharp.Types.UnityAssemblyType
+         where
+  type AngleEnumTy Glean.Schema.Csharp.Types.UnityAssemblyType =
+       Glean.Schema.Csharp.Types.UnityAssemblyType
+  enumName v = Text.pack (Prelude.drop 18 (Prelude.show v))
+{-# LINE 1149 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Definition where
+  buildRtsValue b Glean.Schema.Csharp.Types.Definition_EMPTY
+    = Glean.buildRtsSelector b 7
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_type x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_method x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_field x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_parameter x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.Definition_typeParameter x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_local x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.Definition_property x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Csharp.Types.Definition_EMPTY)
+        [Glean.mapD Glean.Schema.Csharp.Types.Definition_type,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_method,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_field,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_parameter,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_typeParameter,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_local,
+         Glean.mapD Glean.Schema.Csharp.Types.Definition_property]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Definition" (Prelude.Just 1))
+{-# LINE 1185 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.Definition
+     =
+     'Angle.TField "type" (Glean.Schema.Csharp.Types.AType)
+       ('Angle.TField "method"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+          ('Angle.TField "field"
+             (Glean.KeyType Glean.Schema.Csharp.Types.Field)
+             ('Angle.TField "parameter"
+                (Glean.KeyType Glean.Schema.Csharp.Types.Parameter)
+                ('Angle.TField "typeParameter"
+                   (Glean.KeyType Glean.Schema.Csharp.Types.TypeParameter)
+                   ('Angle.TField "local"
+                      (Glean.KeyType Glean.Schema.Csharp.Types.Local)
+                      ('Angle.TField "property"
+                         (Glean.KeyType Glean.Schema.Csharp.Types.Property)
+                         ('Angle.TNoFields)))))))
+{-# LINE 1187 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.AType where
+  buildRtsValue b Glean.Schema.Csharp.Types.AType_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Csharp.Types.AType_arrayType x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.AType_namedType x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.AType_functionPointerType x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.AType_pointerType x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Csharp.Types.AType_typeParameter x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Csharp.Types.AType_EMPTY)
+        [Glean.mapD Glean.Schema.Csharp.Types.AType_arrayType,
+         Glean.mapD Glean.Schema.Csharp.Types.AType_namedType,
+         Glean.mapD Glean.Schema.Csharp.Types.AType_functionPointerType,
+         Glean.mapD Glean.Schema.Csharp.Types.AType_pointerType,
+         Glean.mapD Glean.Schema.Csharp.Types.AType_typeParameter]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.AType" (Prelude.Just 1))
+{-# LINE 1215 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.AType =
+     'Angle.TField "arrayType"
+       (Glean.KeyType Glean.Schema.Csharp.Types.ArrayType)
+       ('Angle.TField "namedType" (Glean.Schema.Csharp.Types.NamedType)
+          ('Angle.TField "functionPointerType"
+             (Glean.KeyType Glean.Schema.Csharp.Types.FunctionPointerType)
+             ('Angle.TField "pointerType"
+                (Glean.KeyType Glean.Schema.Csharp.Types.PointerType)
+                ('Angle.TField "typeParameter"
+                   (Glean.KeyType Glean.Schema.Csharp.Types.TypeParameter)
+                   ('Angle.TNoFields)))))
+{-# LINE 1217 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.Accessibility where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.Accessibility" (Prelude.Just 1))
+{-# LINE 1222 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Csharp.Types.Accessibility =
+     'Angle.TField "Friend" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Internal" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "NotApplicable" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Private" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Protected" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "ProtectedAndFriend"
+                      (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "ProtectedAndInternal"
+                         (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "ProtectedOrFriend"
+                            (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "ProtectedOrInternal"
+                               (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Public" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 1224 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Csharp.Types.Accessibility
+         where
+  type AngleEnumTy Glean.Schema.Csharp.Types.Accessibility =
+       Glean.Schema.Csharp.Types.Accessibility
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 1228 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.ProjectSource where
+  buildRtsValue b Glean.Schema.Csharp.Types.ProjectSource_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.ProjectSource_unityProjectSource x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.ProjectSource_msbuildProjectSource x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Csharp.Types.ProjectSource_EMPTY)
+        [Glean.mapD
+           Glean.Schema.Csharp.Types.ProjectSource_unityProjectSource,
+         Glean.mapD
+           Glean.Schema.Csharp.Types.ProjectSource_msbuildProjectSource]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.ProjectSource" (Prelude.Just 1))
+{-# LINE 1244 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Csharp.Types.ProjectSource =
+     'Angle.TField "unityProjectSource"
+       (Glean.KeyType Glean.Schema.Csharp.Types.UnityProjectSource)
+       ('Angle.TField "msbuildProjectSource"
+          (Glean.KeyType Glean.Schema.Csharp.Types.MSBuildProjectSource)
+          ('Angle.TNoFields))
+{-# LINE 1246 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.RefKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.RefKind" (Prelude.Just 1))
+{-# LINE 1251 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.RefKind =
+     'Angle.TField "In" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "None_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Out" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Ref" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "RefReadOnly" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TNoFields)))))
+{-# LINE 1253 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Csharp.Types.RefKind where
+  type AngleEnumTy Glean.Schema.Csharp.Types.RefKind =
+       Glean.Schema.Csharp.Types.RefKind
+  enumName v = Text.pack (Prelude.drop 8 (Prelude.show v))
+{-# LINE 1257 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type Glean.Schema.Csharp.Types.MethodKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MethodKind" (Prelude.Just 1))
+{-# LINE 1262 "glean/schema/thrift/csharp_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Csharp.Types.MethodKind
+     =
+     'Angle.TField "AnonymousFunction" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "BuiltinOperator" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Constructor" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Conversion" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "DeclareMethod" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "DelegateInvoke" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Destructor" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "EventAdd" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "EventRaise" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "EventRemove" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "ExplicitInterfaceImplementation"
+                                     (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "FunctionPointerSignature"
+                                        (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "LambdaMethod"
+                                           (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "LocalFunction"
+                                              (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "Ordinary"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "PropertyGet"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "PropertySet"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "ReducedExtension"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "SharedConstructor"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "StaticConstructor"
+                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                ('Angle.TField "UserDefinedOperator"
+                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                   ('Angle.TNoFields)))))))))))))))))))))
+{-# LINE 1264 "glean/schema/thrift/csharp_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Csharp.Types.MethodKind where
+  type AngleEnumTy Glean.Schema.Csharp.Types.MethodKind =
+       Glean.Schema.Csharp.Types.MethodKind
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 1268 "glean/schema/thrift/csharp_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Csharp.Types.MemberAccessExpression
+         where
+  buildRtsValue b
+    Glean.Schema.Csharp.Types.MemberAccessExpression_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessExpression_local x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessExpression_parameter x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessExpression_field x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessExpression_property x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Csharp.Types.MemberAccessExpression_method x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Csharp.Types.MemberAccessExpression_EMPTY)
+        [Glean.mapD Glean.Schema.Csharp.Types.MemberAccessExpression_local,
+         Glean.mapD
+           Glean.Schema.Csharp.Types.MemberAccessExpression_parameter,
+         Glean.mapD Glean.Schema.Csharp.Types.MemberAccessExpression_field,
+         Glean.mapD
+           Glean.Schema.Csharp.Types.MemberAccessExpression_property,
+         Glean.mapD Glean.Schema.Csharp.Types.MemberAccessExpression_method]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "csharp.MemberAccessExpression" (Prelude.Just 1))
+{-# LINE 1296 "glean/schema/thrift/csharp_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Csharp.Types.MemberAccessExpression =
+     'Angle.TField "local"
+       (Glean.KeyType Glean.Schema.Csharp.Types.Local)
+       ('Angle.TField "parameter"
+          (Glean.KeyType Glean.Schema.Csharp.Types.Parameter)
+          ('Angle.TField "field"
+             (Glean.KeyType Glean.Schema.Csharp.Types.Field)
+             ('Angle.TField "property"
+                (Glean.KeyType Glean.Schema.Csharp.Types.Property)
+                ('Angle.TField "method"
+                   (Glean.KeyType Glean.Schema.Csharp.Types.Method)
+                   ('Angle.TNoFields)))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Cxx1/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Cxx1/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Cxx1/Types.hs
@@ -0,0 +1,26269 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/cxx1_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/cxx1_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/cxx1_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Cxx1/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Cxx1.Types
+       (pREDICATE_VERSIONS, VariableLowerCase_id,
+        VariableLowerCase(VariableLowerCase, variableLowerCase_id,
+                          variableLowerCase_key),
+        UsingDirective_id,
+        UsingDirective(UsingDirective, usingDirective_id,
+                       usingDirective_key),
+        UsingDeclaration_id,
+        UsingDeclaration(UsingDeclaration, usingDeclaration_id,
+                         usingDeclaration_key),
+        TypeAliasLowerCase_id,
+        TypeAliasLowerCase(TypeAliasLowerCase, typeAliasLowerCase_id,
+                           typeAliasLowerCase_key),
+        TypeAliasDeclaration_id,
+        TypeAliasDeclaration(TypeAliasDeclaration, typeAliasDeclaration_id,
+                             typeAliasDeclaration_key),
+        Type_id, Type(Type, type_id, type_key), TranslationUnitXRefs_id,
+        TranslationUnitXRefs(TranslationUnitXRefs, translationUnitXRefs_id,
+                             translationUnitXRefs_key),
+        TranslationUnitTrace_id,
+        TranslationUnitTrace(TranslationUnitTrace, translationUnitTrace_id,
+                             translationUnitTrace_key),
+        TranslationUnitIncludeTree_id,
+        TranslationUnitIncludeTree(TranslationUnitIncludeTree,
+                                   translationUnitIncludeTree_id, translationUnitIncludeTree_key),
+        Trace_id, Trace(Trace, trace_id, trace_key),
+        RecordUnionLowerCase_id,
+        RecordUnionLowerCase(RecordUnionLowerCase, recordUnionLowerCase_id,
+                             recordUnionLowerCase_key),
+        RecordStructLowerCase_id,
+        RecordStructLowerCase(RecordStructLowerCase,
+                              recordStructLowerCase_id, recordStructLowerCase_key),
+        RecordDerived_id,
+        RecordDerived(RecordDerived, recordDerived_id, recordDerived_key),
+        RecordDeclaration_id,
+        RecordDeclaration(RecordDeclaration, recordDeclaration_id,
+                          recordDeclaration_key),
+        RecordClassLowerCase_id,
+        RecordClassLowerCase(RecordClassLowerCase, recordClassLowerCase_id,
+                             recordClassLowerCase_key),
+        Signature_id, Signature(Signature, signature_id, signature_key),
+        PPDefineLocation_id,
+        PPDefineLocation(PPDefineLocation, pPDefineLocation_id,
+                         pPDefineLocation_key),
+        ObjcSelector_id,
+        ObjcSelector(ObjcSelector, objcSelector_id, objcSelector_key),
+        ObjcPropertyImplementation_id,
+        ObjcPropertyImplementation(ObjcPropertyImplementation,
+                                   objcPropertyImplementation_id, objcPropertyImplementation_key),
+        ObjcPropertyIVar_id,
+        ObjcPropertyIVar(ObjcPropertyIVar, objcPropertyIVar_id,
+                         objcPropertyIVar_key),
+        ObjcMethodDefinition_id,
+        ObjcMethodDefinition(ObjcMethodDefinition, objcMethodDefinition_id,
+                             objcMethodDefinition_key),
+        ObjcMethodDeclarationName_id,
+        ObjcMethodDeclarationName(ObjcMethodDeclarationName,
+                                  objcMethodDeclarationName_id, objcMethodDeclarationName_key),
+        ObjcInterfaceToImplementation_id,
+        ObjcInterfaceToImplementation(ObjcInterfaceToImplementation,
+                                      objcInterfaceToImplementation_id,
+                                      objcInterfaceToImplementation_key),
+        ObjcImplements_id,
+        ObjcImplements(ObjcImplements, objcImplements_id,
+                       objcImplements_key),
+        ObjcContainerInterfaceLowerCase_id,
+        ObjcContainerInterfaceLowerCase(ObjcContainerInterfaceLowerCase,
+                                        objcContainerInterfaceLowerCase_id,
+                                        objcContainerInterfaceLowerCase_key),
+        ObjcContainerInheritance_id,
+        ObjcContainerInheritance(ObjcContainerInheritance,
+                                 objcContainerInheritance_id, objcContainerInheritance_key),
+        ObjcContainerDefinition_id,
+        ObjcContainerDefinition(ObjcContainerDefinition,
+                                objcContainerDefinition_id, objcContainerDefinition_key),
+        ObjcContainerDeclarationInterface_id,
+        ObjcContainerDeclarationInterface(ObjcContainerDeclarationInterface,
+                                          objcContainerDeclarationInterface_id,
+                                          objcContainerDeclarationInterface_key),
+        ObjcContainerBase_id,
+        ObjcContainerBase(ObjcContainerBase, objcContainerBase_id,
+                          objcContainerBase_key),
+        ObjcContainerDeclaration_id,
+        ObjcContainerDeclaration(ObjcContainerDeclaration,
+                                 objcContainerDeclaration_id, objcContainerDeclaration_key),
+        ObjcMethodDeclaration_id,
+        ObjcMethodDeclaration(ObjcMethodDeclaration,
+                              objcMethodDeclaration_id, objcMethodDeclaration_key),
+        ObjcPropertyDeclaration_id,
+        ObjcPropertyDeclaration(ObjcPropertyDeclaration,
+                                objcPropertyDeclaration_id, objcPropertyDeclaration_key),
+        ObjContainerIdName_id,
+        ObjContainerIdName(ObjContainerIdName, objContainerIdName_id,
+                           objContainerIdName_key),
+        NamespaceQName_id,
+        NamespaceQName(NamespaceQName, namespaceQName_id,
+                       namespaceQName_key),
+        NamespaceLowerCase_id,
+        NamespaceLowerCase(NamespaceLowerCase, namespaceLowerCase_id,
+                           namespaceLowerCase_key),
+        NamespaceDefinition_id,
+        NamespaceDefinition(NamespaceDefinition, namespaceDefinition_id,
+                            namespaceDefinition_key),
+        NamespaceDeclarationName_id,
+        NamespaceDeclarationName(NamespaceDeclarationName,
+                                 namespaceDeclarationName_id, namespaceDeclarationName_key),
+        NamespaceDeclarationByName_id,
+        NamespaceDeclarationByName(NamespaceDeclarationByName,
+                                   namespaceDeclarationByName_id, namespaceDeclarationByName_key),
+        NamespaceDeclaration_id,
+        NamespaceDeclaration(NamespaceDeclaration, namespaceDeclaration_id,
+                             namespaceDeclaration_key),
+        NamespaceAliasDeclaration_id,
+        NamespaceAliasDeclaration(NamespaceAliasDeclaration,
+                                  namespaceAliasDeclaration_id, namespaceAliasDeclaration_key),
+        Name_id, Name(Name, name_id, name_key), MethodOverrides_id,
+        MethodOverrides(MethodOverrides, methodOverrides_id,
+                        methodOverrides_key),
+        MethodOverridden_id,
+        MethodOverridden(MethodOverridden, methodOverridden_id,
+                         methodOverridden_key),
+        IncludeTreeTranslationUnit_id,
+        IncludeTreeTranslationUnit(IncludeTreeTranslationUnit,
+                                   includeTreeTranslationUnit_id, includeTreeTranslationUnit_key),
+        IncludeTreeParent_id,
+        IncludeTreeParent(IncludeTreeParent, includeTreeParent_id,
+                          includeTreeParent_key),
+        IncludeTree_id,
+        IncludeTree(IncludeTree, includeTree_id, includeTree_key),
+        PPTrace_id, PPTrace(PPTrace, pPTrace_id, pPTrace_key),
+        FunctionName_id,
+        FunctionName(FunctionName, functionName_id, functionName_key),
+        FunctionLowerCase_id,
+        FunctionLowerCase(FunctionLowerCase, functionLowerCase_id,
+                          functionLowerCase_key),
+        FunctionDefinition_id,
+        FunctionDefinition(FunctionDefinition, functionDefinition_id,
+                           functionDefinition_key),
+        FunctionDeclarationNameString_id,
+        FunctionDeclarationNameString(FunctionDeclarationNameString,
+                                      functionDeclarationNameString_id,
+                                      functionDeclarationNameString_key),
+        FunctionDeclarationName_id,
+        FunctionDeclarationName(FunctionDeclarationName,
+                                functionDeclarationName_id, functionDeclarationName_key),
+        FunctionDeclaration_id,
+        FunctionDeclaration(FunctionDeclaration, functionDeclaration_id,
+                            functionDeclaration_key),
+        FunctionDeclAttribute_id,
+        FunctionDeclAttribute(FunctionDeclAttribute,
+                              functionDeclAttribute_id, functionDeclAttribute_key),
+        FunctionAttribute_id,
+        FunctionAttribute(FunctionAttribute, functionAttribute_id,
+                          functionAttribute_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        FilePPUseXRefs_id,
+        FilePPUseXRefs(FilePPUseXRefs, filePPUseXRefs_id,
+                       filePPUseXRefs_key),
+        FilePPUseTraceXRefs_id,
+        FilePPUseTraceXRefs(FilePPUseTraceXRefs, filePPUseTraceXRefs_id,
+                            filePPUseTraceXRefs_key),
+        FilePPTraceXRefs_id,
+        FilePPTraceXRefs(FilePPTraceXRefs, filePPTraceXRefs_id,
+                         filePPTraceXRefs_key),
+        VariableDeclaration_id,
+        VariableDeclaration(VariableDeclaration, variableDeclaration_id,
+                            variableDeclaration_key),
+        EnumeratorLowerCase_id,
+        EnumeratorLowerCase(EnumeratorLowerCase, enumeratorLowerCase_id,
+                            enumeratorLowerCase_key),
+        EnumeratorInEnum_id,
+        EnumeratorInEnum(EnumeratorInEnum, enumeratorInEnum_id,
+                         enumeratorInEnum_key),
+        EnumeratorByName_id,
+        EnumeratorByName(EnumeratorByName, enumeratorByName_id,
+                         enumeratorByName_key),
+        Enumerator_id,
+        Enumerator(Enumerator, enumerator_id, enumerator_key),
+        EnumLowerCase_id,
+        EnumLowerCase(EnumLowerCase, enumLowerCase_id, enumLowerCase_key),
+        EnumDefinition_id,
+        EnumDefinition(EnumDefinition, enumDefinition_id,
+                       enumDefinition_key),
+        EnumDeclaration_id,
+        EnumDeclaration(EnumDeclaration, enumDeclaration_id,
+                        enumDeclaration_key),
+        DefnInRecord_id,
+        DefnInRecord(DefnInRecord, defnInRecord_id, defnInRecord_key),
+        DeclarationComment_id,
+        DeclarationComment(DeclarationComment, declarationComment_id,
+                           declarationComment_key),
+        DeclarationInTrace_id,
+        DeclarationInTrace(DeclarationInTrace, declarationInTrace_id,
+                           declarationInTrace_key),
+        DeclarationLocationName_id,
+        DeclarationLocationName(DeclarationLocationName,
+                                declarationLocationName_id, declarationLocationName_key),
+        DeclarationLocationNameSpan_id,
+        DeclarationLocationNameSpan(DeclarationLocationNameSpan,
+                                    declarationLocationNameSpan_id,
+                                    declarationLocationNameSpan_key),
+        DeclarationNameSpan_id,
+        DeclarationNameSpan(DeclarationNameSpan, declarationNameSpan_id,
+                            declarationNameSpan_key),
+        DeclarationSources_id,
+        DeclarationSources(DeclarationSources, declarationSources_id,
+                           declarationSources_key),
+        DeclarationSrcRange_id,
+        DeclarationSrcRange(DeclarationSrcRange, declarationSrcRange_id,
+                            declarationSrcRange_key),
+        DeclarationTargets_id,
+        DeclarationTargets(DeclarationTargets, declarationTargets_id,
+                           declarationTargets_key),
+        DeclarationToUSR_id,
+        DeclarationToUSR(DeclarationToUSR, declarationToUSR_id,
+                         declarationToUSR_key),
+        Declarations_id,
+        Declarations(Declarations, declarations_id, declarations_key),
+        DefToBaseDecl_id,
+        DefToBaseDecl(DefToBaseDecl, defToBaseDecl_id, defToBaseDecl_key),
+        MangledNameHashToDeclaration_id,
+        MangledNameHashToDeclaration(MangledNameHashToDeclaration,
+                                     mangledNameHashToDeclaration_id,
+                                     mangledNameHashToDeclaration_key),
+        Same_id, Same(Same, same_id, same_key), USRToDeclaration_id,
+        USRToDeclaration(USRToDeclaration, uSRToDeclaration_id,
+                         uSRToDeclaration_key),
+        FileXRefMap_id,
+        FileXRefMap(FileXRefMap, fileXRefMap_id, fileXRefMap_key),
+        SpellingXRef_id,
+        SpellingXRef(SpellingXRef, spellingXRef_id, spellingXRef_key),
+        TargetUses_id,
+        TargetUses(TargetUses, targetUses_id, targetUses_key),
+        ThriftToCxx_id,
+        ThriftToCxx(ThriftToCxx, thriftToCxx_id, thriftToCxx_key),
+        XRefIndirectTarget_id,
+        XRefIndirectTarget(XRefIndirectTarget, xRefIndirectTarget_id,
+                           xRefIndirectTarget_key),
+        XRefTargets_id,
+        XRefTargets(XRefTargets, xRefTargets_id, xRefTargets_key),
+        DeclToFamily_id,
+        DeclToFamily(DeclToFamily, declToFamily_id, declToFamily_key),
+        DeclInRecord_id,
+        DeclInRecord(DeclInRecord, declInRecord_id, declInRecord_key),
+        DeclInObjcContainer_id,
+        DeclInObjcContainer(DeclInObjcContainer, declInObjcContainer_id,
+                            declInObjcContainer_key),
+        DeclFamilyOf_id,
+        DeclFamilyOf(DeclFamilyOf, declFamilyOf_id, declFamilyOf_key),
+        DeclFamily_id,
+        DeclFamily(DeclFamily, declFamily_id, declFamily_key),
+        CxxToThrift_id,
+        CxxToThrift(CxxToThrift, cxxToThrift_id, cxxToThrift_key),
+        Attribute_id, Attribute(Attribute, attribute_id, attribute_key),
+        RecordDefinition_id,
+        RecordDefinition(RecordDefinition, recordDefinition_id,
+                         recordDefinition_key),
+        DeclarationScope_id,
+        DeclarationScope(DeclarationScope, declarationScope_id,
+                         declarationScope_key),
+        EnumDeclarationByName_id,
+        EnumDeclarationByName(EnumDeclarationByName,
+                              enumDeclarationByName_id, enumDeclarationByName_key),
+        FunctionDeclarationByNameScope_id,
+        FunctionDeclarationByNameScope(FunctionDeclarationByNameScope,
+                                       functionDeclarationByNameScope_id,
+                                       functionDeclarationByNameScope_key),
+        FunctionQName_id,
+        FunctionQName(FunctionQName, functionQName_id, functionQName_key),
+        QName_id, QName(QName, qName_id, qName_key),
+        RecordDeclarationClass_id,
+        RecordDeclarationClass(RecordDeclarationClass,
+                               recordDeclarationClass_id, recordDeclarationClass_key),
+        RecordDeclarationStruct_id,
+        RecordDeclarationStruct(RecordDeclarationStruct,
+                                recordDeclarationStruct_id, recordDeclarationStruct_key),
+        RecordDeclarationUnion_id,
+        RecordDeclarationUnion(RecordDeclarationUnion,
+                               recordDeclarationUnion_id, recordDeclarationUnion_key),
+        TypeAliasDeclarationByName_id,
+        TypeAliasDeclarationByName(TypeAliasDeclarationByName,
+                                   typeAliasDeclarationByName_id, typeAliasDeclarationByName_key),
+        VariableDeclarationNonLocalByName_id,
+        VariableDeclarationNonLocalByName(VariableDeclarationNonLocalByName,
+                                          variableDeclarationNonLocalByName_id,
+                                          variableDeclarationNonLocalByName_key),
+        XRefVia(XRefVia_EMPTY, XRefVia_usingDeclaration,
+                XRefVia_usingDirective, XRefVia_macro),
+        VariableLowerCase_key(VariableLowerCase_key,
+                              variableLowerCase_key_name_lowercase, variableLowerCase_key_name),
+        UsingDirective_key(UsingDirective_key, usingDirective_key_name,
+                           usingDirective_key_source),
+        UsingDeclaration_key(UsingDeclaration_key,
+                             usingDeclaration_key_name, usingDeclaration_key_source),
+        USR,
+        TypeAliasLowerCase_key(TypeAliasLowerCase_key,
+                               typeAliasLowerCase_key_name_lowercase,
+                               typeAliasLowerCase_key_name),
+        TypeAliasKind(TypeAliasKind_Typedef, TypeAliasKind_Using,
+                      TypeAliasKind__UNKNOWN),
+        TypeAliasDeclaration_key(TypeAliasDeclaration_key,
+                                 typeAliasDeclaration_key_name, typeAliasDeclaration_key_type,
+                                 typeAliasDeclaration_key_kind, typeAliasDeclaration_key_source),
+        TranslationUnitXRefs_key(TranslationUnitXRefs_key,
+                                 translationUnitXRefs_key_tunit, translationUnitXRefs_key_xrefs),
+        TranslationUnitTrace_key(TranslationUnitTrace_key,
+                                 translationUnitTrace_key_tunit, translationUnitTrace_key_trace),
+        TranslationUnitIncludeTree_key(TranslationUnitIncludeTree_key,
+                                       translationUnitIncludeTree_key_tunit,
+                                       translationUnitIncludeTree_key_tree),
+        Trace_key(Trace_key, trace_key_file, trace_key_declarations,
+                  trace_key_preprocessor),
+        RefQualifier(RefQualifier_None_, RefQualifier_LValue,
+                     RefQualifier_RValue, RefQualifier__UNKNOWN),
+        RecordUnionLowerCase_key(RecordUnionLowerCase_key,
+                                 recordUnionLowerCase_key_name_lowercase,
+                                 recordUnionLowerCase_key_name),
+        RecordStructLowerCase_key(RecordStructLowerCase_key,
+                                  recordStructLowerCase_key_name_lowercase,
+                                  recordStructLowerCase_key_name),
+        RecordKind(RecordKind_EMPTY, RecordKind_struct_, RecordKind_class_,
+                   RecordKind_union_),
+        RecordDerived_key(RecordDerived_key, recordDerived_key_base,
+                          recordDerived_key_derived),
+        RecordDeclaration_key(RecordDeclaration_key,
+                              recordDeclaration_key_name, recordDeclaration_key_kind,
+                              recordDeclaration_key_source),
+        RecordClassLowerCase_key(RecordClassLowerCase_key,
+                                 recordClassLowerCase_key_name_lowercase,
+                                 recordClassLowerCase_key_name),
+        PpEntity(PpEntity_EMPTY, PpEntity_define, PpEntity_undef,
+                 PpEntity_include_),
+        Parameter(Parameter, parameter_name, parameter_type),
+        Signature_key(Signature_key, signature_key_returns,
+                      signature_key_parameters),
+        PPDefineLocation_key(PPDefineLocation_key,
+                             pPDefineLocation_key_define, pPDefineLocation_key_name,
+                             pPDefineLocation_key_file, pPDefineLocation_key_range),
+        Operator,
+        ObjcSelectorSlot(ObjcSelectorSlot, objcSelectorSlot_objcMethod,
+                         objcSelectorSlot_index),
+        ObjcPropertyKind(ObjcPropertyKind_Synthesize,
+                         ObjcPropertyKind_Dynamic, ObjcPropertyKind__UNKNOWN),
+        ObjcPropertyImplementation_key(ObjcPropertyImplementation_key,
+                                       objcPropertyImplementation_key_declaration,
+                                       objcPropertyImplementation_key_kind,
+                                       objcPropertyImplementation_key_ivar,
+                                       objcPropertyImplementation_key_source),
+        ObjcPropertyIVar_key(ObjcPropertyIVar_key,
+                             objcPropertyIVar_key_property, objcPropertyIVar_key_ivar),
+        ObjcMethodDeclarationName_key(ObjcMethodDeclarationName_key,
+                                      objcMethodDeclarationName_key_decl,
+                                      objcMethodDeclarationName_key_name),
+        ObjcInterfaceToImplementation_key(ObjcInterfaceToImplementation_key,
+                                          objcInterfaceToImplementation_key_interface_,
+                                          objcInterfaceToImplementation_key_implementation),
+        ObjcImplements_key(ObjcImplements_key,
+                           objcImplements_key_implementation, objcImplements_key_interface_),
+        ObjcIVar(ObjcIVar, objcIVar_synthesize, objcIVar_bitsize),
+        ObjcContainerInterfaceLowerCase_key(ObjcContainerInterfaceLowerCase_key,
+                                            objcContainerInterfaceLowerCase_key_name_lowercase,
+                                            objcContainerInterfaceLowerCase_key_name),
+        ObjcContainerInheritance_key(ObjcContainerInheritance_key,
+                                     objcContainerInheritance_key_base,
+                                     objcContainerInheritance_key_declaration),
+        ObjcContainerDefinition_key(ObjcContainerDefinition_key,
+                                    objcContainerDefinition_key_declaration,
+                                    objcContainerDefinition_key_protocols,
+                                    objcContainerDefinition_key_members),
+        ObjcContainerDeclarationInterface_key(ObjcContainerDeclarationInterface_key,
+                                              objcContainerDeclarationInterface_key_name,
+                                              objcContainerDeclarationInterface_key_decl),
+        ObjcContainerBase_key(ObjcContainerBase_key,
+                              objcContainerBase_key_declaration, objcContainerBase_key_base),
+        ObjcCategoryId(ObjcCategoryId, objcCategoryId_className,
+                       objcCategoryId_categoryName),
+        ObjcContainerId(ObjcContainerId_EMPTY, ObjcContainerId_protocol,
+                        ObjcContainerId_interface_, ObjcContainerId_categoryInterface,
+                        ObjcContainerId_extensionInterface, ObjcContainerId_implementation,
+                        ObjcContainerId_categoryImplementation),
+        ObjcContainerDeclaration_key(ObjcContainerDeclaration_key,
+                                     objcContainerDeclaration_key_id,
+                                     objcContainerDeclaration_key_source),
+        ObjcMethodDeclaration_key(ObjcMethodDeclaration_key,
+                                  objcMethodDeclaration_key_selector,
+                                  objcMethodDeclaration_key_locations,
+                                  objcMethodDeclaration_key_container,
+                                  objcMethodDeclaration_key_signature,
+                                  objcMethodDeclaration_key_isInstance,
+                                  objcMethodDeclaration_key_isOptional,
+                                  objcMethodDeclaration_key_isAccessor,
+                                  objcMethodDeclaration_key_source),
+        ObjcPropertyDeclaration_key(ObjcPropertyDeclaration_key,
+                                    objcPropertyDeclaration_key_name,
+                                    objcPropertyDeclaration_key_container,
+                                    objcPropertyDeclaration_key_type,
+                                    objcPropertyDeclaration_key_isInstance,
+                                    objcPropertyDeclaration_key_isOptional,
+                                    objcPropertyDeclaration_key_isReadOnly,
+                                    objcPropertyDeclaration_key_isAtomic,
+                                    objcPropertyDeclaration_key_source),
+        ObjContainerIdName_key(ObjContainerIdName_key,
+                               objContainerIdName_key_id, objContainerIdName_key_name),
+        NamespaceTarget(NamespaceTarget_EMPTY, NamespaceTarget_namespace_,
+                        NamespaceTarget_namespaceAlias),
+        NamespaceQName_key(NamespaceQName_key, namespaceQName_key_name,
+                           namespaceQName_key_parent),
+        NamespaceLowerCase_key(NamespaceLowerCase_key,
+                               namespaceLowerCase_key_name_lowercase,
+                               namespaceLowerCase_key_name),
+        NamespaceDefinition_key(NamespaceDefinition_key,
+                                namespaceDefinition_key_declaration,
+                                namespaceDefinition_key_members),
+        NamespaceDeclarationName_key(NamespaceDeclarationName_key,
+                                     namespaceDeclarationName_key_qname,
+                                     namespaceDeclarationName_key_name),
+        NamespaceDeclarationByName_key(NamespaceDeclarationByName_key,
+                                       namespaceDeclarationByName_key_name,
+                                       namespaceDeclarationByName_key_parent,
+                                       namespaceDeclarationByName_key_decl),
+        NamespaceDeclaration_key(NamespaceDeclaration_key,
+                                 namespaceDeclaration_key_name, namespaceDeclaration_key_source),
+        NamespaceAliasDeclaration_key(NamespaceAliasDeclaration_key,
+                                      namespaceAliasDeclaration_key_name,
+                                      namespaceAliasDeclaration_key_target,
+                                      namespaceAliasDeclaration_key_source),
+        MethodSignature(MethodSignature, methodSignature_isVirtual,
+                        methodSignature_isConst, methodSignature_isVolatile,
+                        methodSignature_refQualifier),
+        MethodOverrides_key(MethodOverrides_key,
+                            methodOverrides_key_derived, methodOverrides_key_base),
+        MethodOverridden_key(MethodOverridden_key,
+                             methodOverridden_key_base, methodOverridden_key_derived),
+        MaybeIncludeTree(MaybeIncludeTree, maybeIncludeTree_tree),
+        MangledNameHash,
+        LocalVariableKind(LocalVariableKind_SimpleVariable,
+                          LocalVariableKind_StaticVariable, LocalVariableKind_Parameter,
+                          LocalVariableKind__UNKNOWN),
+        LocalVariableAttribute(LocalVariableAttribute_Plain,
+                               LocalVariableAttribute_Constexpr, LocalVariableAttribute__UNKNOWN),
+        LocalVariable(LocalVariable, localVariable_kind,
+                      localVariable_attribute),
+        LiteralOperator,
+        IncludeTreeTranslationUnit_key(IncludeTreeTranslationUnit_key,
+                                       includeTreeTranslationUnit_key_tree,
+                                       includeTreeTranslationUnit_key_tunit),
+        IncludeTreeParent_key(IncludeTreeParent_key,
+                              includeTreeParent_key_tree, includeTreeParent_key_parent),
+        IncludeTree_key(IncludeTree_key, includeTree_key_trace,
+                        includeTree_key_children),
+        IncludeTrace(IncludeTrace, includeTrace_include_,
+                     includeTrace_trace),
+        PPEvent(PPEvent_EMPTY, PPEvent_include_, PPEvent_define,
+                PPEvent_undef, PPEvent_use),
+        PPTrace_key(PPTrace_key, pPTrace_key_file, pPTrace_key_events),
+        GlobalVariableKind(GlobalVariableKind_SimpleVariable,
+                           GlobalVariableKind_StaticVariable, GlobalVariableKind_StaticMember,
+                           GlobalVariableKind__UNKNOWN),
+        GlobalVariableAttribute(GlobalVariableAttribute_Plain,
+                                GlobalVariableAttribute_Inline, GlobalVariableAttribute_Constexpr,
+                                GlobalVariableAttribute__UNKNOWN),
+        GlobalVariable(GlobalVariable, globalVariable_kind,
+                       globalVariable_attribute, globalVariable_definition),
+        FunctionName_key(FunctionName_key_EMPTY, FunctionName_key_name,
+                         FunctionName_key_operator_, FunctionName_key_literalOperator,
+                         FunctionName_key_constructor, FunctionName_key_destructor,
+                         FunctionName_key_conversionOperator),
+        FunctionLowerCase_key(FunctionLowerCase_key,
+                              functionLowerCase_key_name_lowercase, functionLowerCase_key_name),
+        FunctionDefinition_key(FunctionDefinition_key,
+                               functionDefinition_key_declaration,
+                               functionDefinition_key_isInline),
+        FunctionDeclarationNameString_key(FunctionDeclarationNameString_key,
+                                          functionDeclarationNameString_key_fname,
+                                          functionDeclarationNameString_key_name),
+        FunctionDeclarationName_key(FunctionDeclarationName_key,
+                                    functionDeclarationName_key_fname,
+                                    functionDeclarationName_key_name),
+        FunctionDeclaration_key(FunctionDeclaration_key,
+                                functionDeclaration_key_name, functionDeclaration_key_signature,
+                                functionDeclaration_key_method, functionDeclaration_key_source),
+        FunctionDeclAttribute_key(FunctionDeclAttribute_key,
+                                  functionDeclAttribute_key_decl, functionDeclAttribute_key_attr),
+        FunctionAttribute_key(FunctionAttribute_key,
+                              functionAttribute_key_attr, functionAttribute_key_declaration),
+        From(From, from_spans, from_expansions, from_spellings),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_xmap,
+                      fileXRefs_key_targets),
+        FilePPUseXRefs_key(FilePPUseXRefs_key, filePPUseXRefs_key_file,
+                           filePPUseXRefs_key_source, filePPUseXRefs_key_define),
+        FilePPUseTraceXRefs_key(FilePPUseTraceXRefs_key,
+                                filePPUseTraceXRefs_key_file, filePPUseTraceXRefs_key_trace,
+                                filePPUseTraceXRefs_key_source, filePPUseTraceXRefs_key_define),
+        FilePPTraceXRefs_key(FilePPTraceXRefs_key,
+                             filePPTraceXRefs_key_file, filePPTraceXRefs_key_trace,
+                             filePPTraceXRefs_key_source, filePPTraceXRefs_key_ppEntity,
+                             filePPTraceXRefs_key_span),
+        Field(Field, field_mutable_, field_bitsize),
+        VariableKind(VariableKind_EMPTY, VariableKind_global_,
+                     VariableKind_local, VariableKind_field, VariableKind_ivar),
+        VariableDeclaration_key(VariableDeclaration_key,
+                                variableDeclaration_key_name, variableDeclaration_key_type,
+                                variableDeclaration_key_kind, variableDeclaration_key_source),
+        EnumeratorLowerCase_key(EnumeratorLowerCase_key,
+                                enumeratorLowerCase_key_name_lowercase,
+                                enumeratorLowerCase_key_name),
+        EnumeratorInEnum_key(EnumeratorInEnum_key,
+                             enumeratorInEnum_key_enumerator, enumeratorInEnum_key_enum_),
+        EnumeratorByName_key(EnumeratorByName_key,
+                             enumeratorByName_key_name, enumeratorByName_key_decl),
+        Enumerator_key(Enumerator_key, enumerator_key_name,
+                       enumerator_key_enumeration, enumerator_key_source),
+        EnumLowerCase_key(EnumLowerCase_key,
+                          enumLowerCase_key_name_lowercase, enumLowerCase_key_name),
+        EnumDefinition_key(EnumDefinition_key,
+                           enumDefinition_key_declaration, enumDefinition_key_enumerators),
+        EnumDeclaration_key(EnumDeclaration_key, enumDeclaration_key_name,
+                            enumDeclaration_key_isScoped, enumDeclaration_key_type,
+                            enumDeclaration_key_source),
+        DefinitionEntity(DefinitionEntity_EMPTY, DefinitionEntity_record_,
+                         DefinitionEntity_function_, DefinitionEntity_enum_,
+                         DefinitionEntity_objcMethod, DefinitionEntity_objcContainer,
+                         DefinitionEntity_variable, DefinitionEntity_namespace_),
+        DefnInRecord_key(DefnInRecord_key, defnInRecord_key_defn,
+                         defnInRecord_key_record),
+        Declaration(Declaration_EMPTY, Declaration_namespace_,
+                    Declaration_usingDeclaration, Declaration_usingDirective,
+                    Declaration_record_, Declaration_enum_, Declaration_function_,
+                    Declaration_variable, Declaration_objcContainer,
+                    Declaration_objcMethod, Declaration_objcProperty,
+                    Declaration_typeAlias, Declaration_namespaceAlias),
+        DeclarationComment_key(DeclarationComment_key,
+                               declarationComment_key_declaration, declarationComment_key_file,
+                               declarationComment_key_span),
+        DeclarationInTrace_key(DeclarationInTrace_key,
+                               declarationInTrace_key_decl, declarationInTrace_key_trace),
+        DeclarationLocationName_key(DeclarationLocationName_key,
+                                    declarationLocationName_key_decl,
+                                    declarationLocationName_key_source,
+                                    declarationLocationName_key_name),
+        DeclarationLocationNameSpan_key(DeclarationLocationNameSpan_key,
+                                        declarationLocationNameSpan_key_decl,
+                                        declarationLocationNameSpan_key_source,
+                                        declarationLocationNameSpan_key_name,
+                                        declarationLocationNameSpan_key_file,
+                                        declarationLocationNameSpan_key_span),
+        DeclarationNameSpan_key(DeclarationNameSpan_key,
+                                declarationNameSpan_key_decl, declarationNameSpan_key_file,
+                                declarationNameSpan_key_span),
+        DeclarationSources_key(DeclarationSources_key,
+                               declarationSources_key_target, declarationSources_key_sources),
+        DeclarationSrcRange_key(DeclarationSrcRange_key,
+                                declarationSrcRange_key_decl, declarationSrcRange_key_source),
+        DeclarationTargets_key(DeclarationTargets_key,
+                               declarationTargets_key_source, declarationTargets_key_targets),
+        DeclarationToUSR_key(DeclarationToUSR_key,
+                             declarationToUSR_key_declaration, declarationToUSR_key_usr),
+        DefToBaseDecl_key(DefToBaseDecl_key, defToBaseDecl_key_defn,
+                          defToBaseDecl_key_decl),
+        MangledNameHashToDeclaration_key(MangledNameHashToDeclaration_key,
+                                         mangledNameHashToDeclaration_key_hash,
+                                         mangledNameHashToDeclaration_key_declaration),
+        Same_key(Same_key, same_key_declaration1, same_key_declaration2),
+        USRToDeclaration_key(USRToDeclaration_key,
+                             uSRToDeclaration_key_hash, uSRToDeclaration_key_declaration),
+        XRefTarget(XRefTarget_EMPTY, XRefTarget_declaration,
+                   XRefTarget_enumerator, XRefTarget_objcSelector,
+                   XRefTarget_objcSelectorSlot, XRefTarget_unknown,
+                   XRefTarget_indirect),
+        FixedXRef(FixedXRef, fixedXRef_target, fixedXRef_from),
+        FileXRefMap_key(FileXRefMap_key, fileXRefMap_key_file,
+                        fileXRefMap_key_fixed, fileXRefMap_key_froms),
+        SpellingXRef_key(SpellingXRef_key, spellingXRef_key_source,
+                         spellingXRef_key_target),
+        TargetUses_key(TargetUses_key, targetUses_key_target,
+                       targetUses_key_file, targetUses_key_from),
+        ThriftToCxx_key(ThriftToCxx_key, thriftToCxx_key_to,
+                        thriftToCxx_key_from),
+        XRefIndirectTarget_key(XRefIndirectTarget_key,
+                               xRefIndirectTarget_key_via, xRefIndirectTarget_key_target),
+        DeclToFamily_key(DeclToFamily_key, declToFamily_key_decl,
+                         declToFamily_key_family),
+        DeclInRecord_key(DeclInRecord_key, declInRecord_key_decl,
+                         declInRecord_key_record),
+        DeclInObjcContainer_key(DeclInObjcContainer_key,
+                                declInObjcContainer_key_decl, declInObjcContainer_key_record),
+        DeclFamilyOf_key(DeclFamilyOf_key, declFamilyOf_key_decl,
+                         declFamilyOf_key_family),
+        CxxToThrift_key(CxxToThrift_key, cxxToThrift_key_from,
+                        cxxToThrift_key_to),
+        Access(Access_Public, Access_Protected, Access_Private,
+               Access__UNKNOWN),
+        RecordBase(RecordBase, recordBase_base, recordBase_access,
+                   recordBase_isVirtual),
+        RecordDefinition_key(RecordDefinition_key,
+                             recordDefinition_key_declaration, recordDefinition_key_bases,
+                             recordDefinition_key_members),
+        Scope_recordWithAccess_(Scope_recordWithAccess_,
+                                scope_recordWithAccess__record, scope_recordWithAccess__access),
+        Scope(Scope_EMPTY, Scope_global_, Scope_namespace_,
+              Scope_recordWithAccess, Scope_local),
+        DeclarationScope_key(DeclarationScope_key,
+                             declarationScope_key_decl, declarationScope_key_scope),
+        EnumDeclarationByName_key(EnumDeclarationByName_key,
+                                  enumDeclarationByName_key_name, enumDeclarationByName_key_scope,
+                                  enumDeclarationByName_key_decl),
+        FunctionDeclarationByNameScope_key(FunctionDeclarationByNameScope_key,
+                                           functionDeclarationByNameScope_key_name,
+                                           functionDeclarationByNameScope_key_scope,
+                                           functionDeclarationByNameScope_key_decl),
+        FunctionQName_key(FunctionQName_key, functionQName_key_name,
+                          functionQName_key_scope),
+        QName_key(QName_key, qName_key_name, qName_key_scope),
+        RecordDeclarationClass_key(RecordDeclarationClass_key,
+                                   recordDeclarationClass_key_name,
+                                   recordDeclarationClass_key_scope,
+                                   recordDeclarationClass_key_decl),
+        RecordDeclarationStruct_key(RecordDeclarationStruct_key,
+                                    recordDeclarationStruct_key_name,
+                                    recordDeclarationStruct_key_scope,
+                                    recordDeclarationStruct_key_decl),
+        RecordDeclarationUnion_key(RecordDeclarationUnion_key,
+                                   recordDeclarationUnion_key_name,
+                                   recordDeclarationUnion_key_scope,
+                                   recordDeclarationUnion_key_decl),
+        TypeAliasDeclarationByName_key(TypeAliasDeclarationByName_key,
+                                       typeAliasDeclarationByName_key_name,
+                                       typeAliasDeclarationByName_key_scope,
+                                       typeAliasDeclarationByName_key_decl),
+        VariableDeclarationNonLocalByName_key(VariableDeclarationNonLocalByName_key,
+                                              variableDeclarationNonLocalByName_key_name,
+                                              variableDeclarationNonLocalByName_key_scope,
+                                              variableDeclarationNonLocalByName_key_decl))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Buck.Types as Glean.Schema.Buck
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Fbthrift.Types
+       as Glean.Schema.Fbthrift
+import qualified Glean.Schema.Pp1.Types as Glean.Schema.Pp1
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Schema.Buck.Types
+{-# LINE 15 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 16 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Schema.Fbthrift.Types
+{-# LINE 17 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Schema.Pp1.Types
+{-# LINE 18 "glean/schema/thrift/cxx1_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 719 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Cxx1/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("Declarations", 5), ("FunctionDeclarationName", 5),
+       ("FunctionQName", 5), ("DeclToFamily", 5),
+       ("FunctionDeclAttribute", 5), ("EnumeratorInEnum", 5),
+       ("FunctionLowerCase", 5), ("DeclarationSources", 5),
+       ("TypeAliasDeclarationByName", 5), ("ObjcMethodDeclaration", 5),
+       ("FilePPTraceXRefs", 5), ("FunctionDeclarationByNameScope", 5),
+       ("MethodOverrides", 5), ("VariableDeclaration", 5),
+       ("IncludeTree", 5), ("ObjcImplements", 5), ("MethodOverridden", 5),
+       ("FilePPUseXRefs", 5), ("Name", 5), ("ObjContainerIdName", 5),
+       ("XRefTargets", 5), ("USRToDeclaration", 5),
+       ("TypeAliasDeclaration", 5), ("DeclarationLocationName", 5),
+       ("ObjcSelector", 5), ("DeclarationSrcRange", 5),
+       ("DeclarationInTrace", 5), ("TargetUses", 5),
+       ("NamespaceDeclarationName", 5), ("QName", 5), ("SpellingXRef", 5),
+       ("ThriftToCxx", 5), ("RecordDefinition", 5), ("CxxToThrift", 5),
+       ("DeclarationToUSR", 5), ("PPTrace", 5), ("DefToBaseDecl", 5),
+       ("Signature", 5), ("Same", 5), ("RecordClassLowerCase", 5),
+       ("NamespaceAliasDeclaration", 5), ("DeclarationNameSpan", 5),
+       ("EnumDeclaration", 5), ("RecordUnionLowerCase", 5),
+       ("EnumeratorByName", 5), ("TranslationUnitTrace", 5),
+       ("ObjcPropertyIVar", 5), ("ObjcContainerInheritance", 5),
+       ("Attribute", 5), ("ObjcMethodDeclarationName", 5),
+       ("DeclFamily", 5), ("ObjcPropertyImplementation", 5),
+       ("ObjcContainerDefinition", 5),
+       ("VariableDeclarationNonLocalByName", 5),
+       ("NamespaceDeclaration", 5), ("RecordDeclarationStruct", 5),
+       ("DeclFamilyOf", 5), ("DeclInObjcContainer", 5),
+       ("TranslationUnitXRefs", 5), ("EnumDefinition", 5),
+       ("NamespaceDefinition", 5), ("DeclarationTargets", 5),
+       ("UsingDirective", 5), ("XRefIndirectTarget", 5),
+       ("ObjcContainerDeclaration", 5),
+       ("MangledNameHashToDeclaration", 5), ("Type", 5),
+       ("ObjcContainerInterfaceLowerCase", 5), ("FunctionName", 5),
+       ("ObjcContainerDeclarationInterface", 5), ("FileXRefs", 5),
+       ("DeclarationLocationNameSpan", 5),
+       ("NamespaceDeclarationByName", 5),
+       ("TranslationUnitIncludeTree", 5), ("FileXRefMap", 5),
+       ("IncludeTreeTranslationUnit", 5), ("DefnInRecord", 5),
+       ("Enumerator", 5), ("EnumeratorLowerCase", 5),
+       ("IncludeTreeParent", 5), ("DeclInRecord", 5),
+       ("RecordStructLowerCase", 5), ("ObjcMethodDefinition", 5),
+       ("ObjcContainerBase", 5), ("VariableLowerCase", 5),
+       ("FunctionDeclaration", 5), ("RecordDerived", 5),
+       ("UsingDeclaration", 5), ("RecordDeclaration", 5),
+       ("FunctionDeclarationNameString", 5),
+       ("RecordDeclarationUnion", 5), ("RecordDeclarationClass", 5),
+       ("ObjcInterfaceToImplementation", 5), ("PPDefineLocation", 5),
+       ("DeclarationScope", 5), ("DeclarationComment", 5),
+       ("NamespaceLowerCase", 5), ("NamespaceQName", 5),
+       ("FilePPUseTraceXRefs", 5), ("EnumDeclarationByName", 5),
+       ("ObjcPropertyDeclaration", 5), ("EnumLowerCase", 5),
+       ("TypeAliasLowerCase", 5), ("FunctionAttribute", 5), ("Trace", 5),
+       ("FunctionDefinition", 5)]
+
+type VariableLowerCase_id = Glean.Id
+
+data VariableLowerCase = VariableLowerCase{variableLowerCase_id ::
+                                           {-# UNPACK #-} !VariableLowerCase_id,
+                                           variableLowerCase_key ::
+                                           Prelude.Maybe VariableLowerCase_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableLowerCase where
+  toJSON (VariableLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableLowerCase where
+  buildStruct _proxy (VariableLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableLowerCase where
+  rnf (VariableLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableLowerCase where
+  def = VariableLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableLowerCase where
+  hashWithSalt __salt (VariableLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UsingDirective_id = Glean.Id
+
+data UsingDirective = UsingDirective{usingDirective_id ::
+                                     {-# UNPACK #-} !UsingDirective_id,
+                                     usingDirective_key :: Prelude.Maybe UsingDirective_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UsingDirective where
+  toJSON (UsingDirective __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UsingDirective where
+  buildStruct _proxy (UsingDirective __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UsingDirective __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UsingDirective where
+  rnf (UsingDirective __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UsingDirective where
+  def = UsingDirective Default.def Prelude.Nothing
+
+instance Hashable.Hashable UsingDirective where
+  hashWithSalt __salt (UsingDirective _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UsingDeclaration_id = Glean.Id
+
+data UsingDeclaration = UsingDeclaration{usingDeclaration_id ::
+                                         {-# UNPACK #-} !UsingDeclaration_id,
+                                         usingDeclaration_key :: Prelude.Maybe UsingDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UsingDeclaration where
+  toJSON (UsingDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UsingDeclaration where
+  buildStruct _proxy (UsingDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UsingDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UsingDeclaration where
+  rnf (UsingDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UsingDeclaration where
+  def = UsingDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable UsingDeclaration where
+  hashWithSalt __salt (UsingDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeAliasLowerCase_id = Glean.Id
+
+data TypeAliasLowerCase = TypeAliasLowerCase{typeAliasLowerCase_id
+                                             :: {-# UNPACK #-} !TypeAliasLowerCase_id,
+                                             typeAliasLowerCase_key ::
+                                             Prelude.Maybe TypeAliasLowerCase_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasLowerCase where
+  toJSON (TypeAliasLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasLowerCase where
+  buildStruct _proxy (TypeAliasLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeAliasLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasLowerCase where
+  rnf (TypeAliasLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeAliasLowerCase where
+  def = TypeAliasLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeAliasLowerCase where
+  hashWithSalt __salt (TypeAliasLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeAliasDeclaration_id = Glean.Id
+
+data TypeAliasDeclaration = TypeAliasDeclaration{typeAliasDeclaration_id
+                                                 :: {-# UNPACK #-} !TypeAliasDeclaration_id,
+                                                 typeAliasDeclaration_key ::
+                                                 Prelude.Maybe TypeAliasDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasDeclaration where
+  toJSON (TypeAliasDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasDeclaration where
+  buildStruct _proxy (TypeAliasDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TypeAliasDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasDeclaration where
+  rnf (TypeAliasDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeAliasDeclaration where
+  def = TypeAliasDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeAliasDeclaration where
+  hashWithSalt __salt (TypeAliasDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TranslationUnitXRefs_id = Glean.Id
+
+data TranslationUnitXRefs = TranslationUnitXRefs{translationUnitXRefs_id
+                                                 :: {-# UNPACK #-} !TranslationUnitXRefs_id,
+                                                 translationUnitXRefs_key ::
+                                                 Prelude.Maybe TranslationUnitXRefs_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitXRefs where
+  toJSON (TranslationUnitXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitXRefs where
+  buildStruct _proxy (TranslationUnitXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TranslationUnitXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitXRefs where
+  rnf (TranslationUnitXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TranslationUnitXRefs where
+  def = TranslationUnitXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable TranslationUnitXRefs where
+  hashWithSalt __salt (TranslationUnitXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TranslationUnitTrace_id = Glean.Id
+
+data TranslationUnitTrace = TranslationUnitTrace{translationUnitTrace_id
+                                                 :: {-# UNPACK #-} !TranslationUnitTrace_id,
+                                                 translationUnitTrace_key ::
+                                                 Prelude.Maybe TranslationUnitTrace_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitTrace where
+  toJSON (TranslationUnitTrace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitTrace where
+  buildStruct _proxy (TranslationUnitTrace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TranslationUnitTrace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitTrace where
+  rnf (TranslationUnitTrace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TranslationUnitTrace where
+  def = TranslationUnitTrace Default.def Prelude.Nothing
+
+instance Hashable.Hashable TranslationUnitTrace where
+  hashWithSalt __salt (TranslationUnitTrace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TranslationUnitIncludeTree_id = Glean.Id
+
+data TranslationUnitIncludeTree = TranslationUnitIncludeTree{translationUnitIncludeTree_id
+                                                             ::
+                                                             {-# UNPACK #-} !TranslationUnitIncludeTree_id,
+                                                             translationUnitIncludeTree_key ::
+                                                             Prelude.Maybe
+                                                               TranslationUnitIncludeTree_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitIncludeTree where
+  toJSON (TranslationUnitIncludeTree __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitIncludeTree where
+  buildStruct _proxy
+    (TranslationUnitIncludeTree __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TranslationUnitIncludeTree __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitIncludeTree where
+  rnf (TranslationUnitIncludeTree __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TranslationUnitIncludeTree where
+  def = TranslationUnitIncludeTree Default.def Prelude.Nothing
+
+instance Hashable.Hashable TranslationUnitIncludeTree where
+  hashWithSalt __salt (TranslationUnitIncludeTree _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Trace_id = Glean.Id
+
+data Trace = Trace{trace_id :: {-# UNPACK #-} !Trace_id,
+                   trace_key :: Prelude.Maybe Trace_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Trace where
+  toJSON (Trace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Trace where
+  buildStruct _proxy (Trace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Trace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Trace where
+  rnf (Trace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Trace where
+  def = Trace Default.def Prelude.Nothing
+
+instance Hashable.Hashable Trace where
+  hashWithSalt __salt (Trace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordUnionLowerCase_id = Glean.Id
+
+data RecordUnionLowerCase = RecordUnionLowerCase{recordUnionLowerCase_id
+                                                 :: {-# UNPACK #-} !RecordUnionLowerCase_id,
+                                                 recordUnionLowerCase_key ::
+                                                 Prelude.Maybe RecordUnionLowerCase_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordUnionLowerCase where
+  toJSON (RecordUnionLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordUnionLowerCase where
+  buildStruct _proxy (RecordUnionLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordUnionLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordUnionLowerCase where
+  rnf (RecordUnionLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordUnionLowerCase where
+  def = RecordUnionLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordUnionLowerCase where
+  hashWithSalt __salt (RecordUnionLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordStructLowerCase_id = Glean.Id
+
+data RecordStructLowerCase = RecordStructLowerCase{recordStructLowerCase_id
+                                                   :: {-# UNPACK #-} !RecordStructLowerCase_id,
+                                                   recordStructLowerCase_key ::
+                                                   Prelude.Maybe RecordStructLowerCase_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordStructLowerCase where
+  toJSON (RecordStructLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordStructLowerCase where
+  buildStruct _proxy (RecordStructLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordStructLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordStructLowerCase where
+  rnf (RecordStructLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordStructLowerCase where
+  def = RecordStructLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordStructLowerCase where
+  hashWithSalt __salt (RecordStructLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDerived_id = Glean.Id
+
+data RecordDerived = RecordDerived{recordDerived_id ::
+                                   {-# UNPACK #-} !RecordDerived_id,
+                                   recordDerived_key :: Prelude.Maybe RecordDerived_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDerived where
+  toJSON (RecordDerived __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDerived where
+  buildStruct _proxy (RecordDerived __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RecordDerived __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDerived where
+  rnf (RecordDerived __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDerived where
+  def = RecordDerived Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDerived where
+  hashWithSalt __salt (RecordDerived _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDeclaration_id = Glean.Id
+
+data RecordDeclaration = RecordDeclaration{recordDeclaration_id ::
+                                           {-# UNPACK #-} !RecordDeclaration_id,
+                                           recordDeclaration_key ::
+                                           Prelude.Maybe RecordDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclaration where
+  toJSON (RecordDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclaration where
+  buildStruct _proxy (RecordDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RecordDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclaration where
+  rnf (RecordDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDeclaration where
+  def = RecordDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDeclaration where
+  hashWithSalt __salt (RecordDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordClassLowerCase_id = Glean.Id
+
+data RecordClassLowerCase = RecordClassLowerCase{recordClassLowerCase_id
+                                                 :: {-# UNPACK #-} !RecordClassLowerCase_id,
+                                                 recordClassLowerCase_key ::
+                                                 Prelude.Maybe RecordClassLowerCase_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordClassLowerCase where
+  toJSON (RecordClassLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordClassLowerCase where
+  buildStruct _proxy (RecordClassLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordClassLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordClassLowerCase where
+  rnf (RecordClassLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordClassLowerCase where
+  def = RecordClassLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordClassLowerCase where
+  hashWithSalt __salt (RecordClassLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Signature_id = Glean.Id
+
+data Signature = Signature{signature_id ::
+                           {-# UNPACK #-} !Signature_id,
+                           signature_key :: Prelude.Maybe Signature_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Signature where
+  toJSON (Signature __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Signature where
+  buildStruct _proxy (Signature __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Signature __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Signature where
+  rnf (Signature __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Signature where
+  def = Signature Default.def Prelude.Nothing
+
+instance Hashable.Hashable Signature where
+  hashWithSalt __salt (Signature _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PPDefineLocation_id = Glean.Id
+
+data PPDefineLocation = PPDefineLocation{pPDefineLocation_id ::
+                                         {-# UNPACK #-} !PPDefineLocation_id,
+                                         pPDefineLocation_key :: Prelude.Maybe PPDefineLocation_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPDefineLocation where
+  toJSON (PPDefineLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PPDefineLocation where
+  buildStruct _proxy (PPDefineLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PPDefineLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PPDefineLocation where
+  rnf (PPDefineLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PPDefineLocation where
+  def = PPDefineLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PPDefineLocation where
+  hashWithSalt __salt (PPDefineLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcSelector_id = Glean.Id
+
+data ObjcSelector = ObjcSelector{objcSelector_id ::
+                                 {-# UNPACK #-} !ObjcSelector_id,
+                                 objcSelector_key :: Prelude.Maybe [Text.Text]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcSelector where
+  toJSON (ObjcSelector __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcSelector where
+  buildStruct _proxy (ObjcSelector __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                                       (Thrift.genText _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjcSelector __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcSelector where
+  rnf (ObjcSelector __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcSelector where
+  def = ObjcSelector Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcSelector where
+  hashWithSalt __salt (ObjcSelector _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcPropertyImplementation_id = Glean.Id
+
+data ObjcPropertyImplementation = ObjcPropertyImplementation{objcPropertyImplementation_id
+                                                             ::
+                                                             {-# UNPACK #-} !ObjcPropertyImplementation_id,
+                                                             objcPropertyImplementation_key ::
+                                                             Prelude.Maybe
+                                                               ObjcPropertyImplementation_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyImplementation where
+  toJSON (ObjcPropertyImplementation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcPropertyImplementation where
+  buildStruct _proxy
+    (ObjcPropertyImplementation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcPropertyImplementation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyImplementation where
+  rnf (ObjcPropertyImplementation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyImplementation where
+  def = ObjcPropertyImplementation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcPropertyImplementation where
+  hashWithSalt __salt (ObjcPropertyImplementation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcPropertyIVar_id = Glean.Id
+
+data ObjcPropertyIVar = ObjcPropertyIVar{objcPropertyIVar_id ::
+                                         {-# UNPACK #-} !ObjcPropertyIVar_id,
+                                         objcPropertyIVar_key :: Prelude.Maybe ObjcPropertyIVar_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyIVar where
+  toJSON (ObjcPropertyIVar __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcPropertyIVar where
+  buildStruct _proxy (ObjcPropertyIVar __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjcPropertyIVar __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyIVar where
+  rnf (ObjcPropertyIVar __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyIVar where
+  def = ObjcPropertyIVar Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcPropertyIVar where
+  hashWithSalt __salt (ObjcPropertyIVar _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcMethodDefinition_id = Glean.Id
+
+data ObjcMethodDefinition = ObjcMethodDefinition{objcMethodDefinition_id
+                                                 :: {-# UNPACK #-} !ObjcMethodDefinition_id,
+                                                 objcMethodDefinition_key ::
+                                                 Prelude.Maybe ObjcMethodDeclaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodDefinition where
+  toJSON (ObjcMethodDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcMethodDefinition where
+  buildStruct _proxy (ObjcMethodDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcMethodDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcMethodDefinition where
+  rnf (ObjcMethodDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcMethodDefinition where
+  def = ObjcMethodDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcMethodDefinition where
+  hashWithSalt __salt (ObjcMethodDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcMethodDeclarationName_id = Glean.Id
+
+data ObjcMethodDeclarationName = ObjcMethodDeclarationName{objcMethodDeclarationName_id
+                                                           ::
+                                                           {-# UNPACK #-} !ObjcMethodDeclarationName_id,
+                                                           objcMethodDeclarationName_key ::
+                                                           Prelude.Maybe
+                                                             ObjcMethodDeclarationName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodDeclarationName where
+  toJSON (ObjcMethodDeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcMethodDeclarationName where
+  buildStruct _proxy
+    (ObjcMethodDeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcMethodDeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcMethodDeclarationName where
+  rnf (ObjcMethodDeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcMethodDeclarationName where
+  def = ObjcMethodDeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcMethodDeclarationName where
+  hashWithSalt __salt (ObjcMethodDeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcInterfaceToImplementation_id = Glean.Id
+
+data ObjcInterfaceToImplementation = ObjcInterfaceToImplementation{objcInterfaceToImplementation_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !ObjcInterfaceToImplementation_id,
+                                                                   objcInterfaceToImplementation_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     ObjcInterfaceToImplementation_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcInterfaceToImplementation where
+  toJSON (ObjcInterfaceToImplementation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcInterfaceToImplementation where
+  buildStruct _proxy
+    (ObjcInterfaceToImplementation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcInterfaceToImplementation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcInterfaceToImplementation where
+  rnf (ObjcInterfaceToImplementation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcInterfaceToImplementation where
+  def = ObjcInterfaceToImplementation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcInterfaceToImplementation where
+  hashWithSalt __salt (ObjcInterfaceToImplementation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcImplements_id = Glean.Id
+
+data ObjcImplements = ObjcImplements{objcImplements_id ::
+                                     {-# UNPACK #-} !ObjcImplements_id,
+                                     objcImplements_key :: Prelude.Maybe ObjcImplements_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcImplements where
+  toJSON (ObjcImplements __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcImplements where
+  buildStruct _proxy (ObjcImplements __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjcImplements __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcImplements where
+  rnf (ObjcImplements __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcImplements where
+  def = ObjcImplements Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcImplements where
+  hashWithSalt __salt (ObjcImplements _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerInterfaceLowerCase_id = Glean.Id
+
+data ObjcContainerInterfaceLowerCase = ObjcContainerInterfaceLowerCase{objcContainerInterfaceLowerCase_id
+                                                                       ::
+                                                                       {-# UNPACK #-} !ObjcContainerInterfaceLowerCase_id,
+                                                                       objcContainerInterfaceLowerCase_key
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         ObjcContainerInterfaceLowerCase_key}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerInterfaceLowerCase where
+  toJSON (ObjcContainerInterfaceLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerInterfaceLowerCase where
+  buildStruct _proxy
+    (ObjcContainerInterfaceLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcContainerInterfaceLowerCase __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerInterfaceLowerCase where
+  rnf (ObjcContainerInterfaceLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerInterfaceLowerCase where
+  def = ObjcContainerInterfaceLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerInterfaceLowerCase where
+  hashWithSalt __salt (ObjcContainerInterfaceLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerInheritance_id = Glean.Id
+
+data ObjcContainerInheritance = ObjcContainerInheritance{objcContainerInheritance_id
+                                                         ::
+                                                         {-# UNPACK #-} !ObjcContainerInheritance_id,
+                                                         objcContainerInheritance_key ::
+                                                         Prelude.Maybe ObjcContainerInheritance_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerInheritance where
+  toJSON (ObjcContainerInheritance __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerInheritance where
+  buildStruct _proxy
+    (ObjcContainerInheritance __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcContainerInheritance __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerInheritance where
+  rnf (ObjcContainerInheritance __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerInheritance where
+  def = ObjcContainerInheritance Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerInheritance where
+  hashWithSalt __salt (ObjcContainerInheritance _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerDefinition_id = Glean.Id
+
+data ObjcContainerDefinition = ObjcContainerDefinition{objcContainerDefinition_id
+                                                       ::
+                                                       {-# UNPACK #-} !ObjcContainerDefinition_id,
+                                                       objcContainerDefinition_key ::
+                                                       Prelude.Maybe ObjcContainerDefinition_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDefinition where
+  toJSON (ObjcContainerDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDefinition where
+  buildStruct _proxy
+    (ObjcContainerDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcContainerDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDefinition where
+  rnf (ObjcContainerDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDefinition where
+  def = ObjcContainerDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerDefinition where
+  hashWithSalt __salt (ObjcContainerDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerDeclarationInterface_id = Glean.Id
+
+data ObjcContainerDeclarationInterface = ObjcContainerDeclarationInterface{objcContainerDeclarationInterface_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !ObjcContainerDeclarationInterface_id,
+                                                                           objcContainerDeclarationInterface_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             ObjcContainerDeclarationInterface_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDeclarationInterface where
+  toJSON (ObjcContainerDeclarationInterface __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDeclarationInterface
+         where
+  buildStruct _proxy
+    (ObjcContainerDeclarationInterface __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcContainerDeclarationInterface __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDeclarationInterface where
+  rnf (ObjcContainerDeclarationInterface __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDeclarationInterface where
+  def = ObjcContainerDeclarationInterface Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerDeclarationInterface where
+  hashWithSalt __salt (ObjcContainerDeclarationInterface _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerBase_id = Glean.Id
+
+data ObjcContainerBase = ObjcContainerBase{objcContainerBase_id ::
+                                           {-# UNPACK #-} !ObjcContainerBase_id,
+                                           objcContainerBase_key ::
+                                           Prelude.Maybe ObjcContainerBase_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerBase where
+  toJSON (ObjcContainerBase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerBase where
+  buildStruct _proxy (ObjcContainerBase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjcContainerBase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerBase where
+  rnf (ObjcContainerBase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerBase where
+  def = ObjcContainerBase Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerBase where
+  hashWithSalt __salt (ObjcContainerBase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcContainerDeclaration_id = Glean.Id
+
+data ObjcContainerDeclaration = ObjcContainerDeclaration{objcContainerDeclaration_id
+                                                         ::
+                                                         {-# UNPACK #-} !ObjcContainerDeclaration_id,
+                                                         objcContainerDeclaration_key ::
+                                                         Prelude.Maybe ObjcContainerDeclaration_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDeclaration where
+  toJSON (ObjcContainerDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDeclaration where
+  buildStruct _proxy
+    (ObjcContainerDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcContainerDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDeclaration where
+  rnf (ObjcContainerDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDeclaration where
+  def = ObjcContainerDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcContainerDeclaration where
+  hashWithSalt __salt (ObjcContainerDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcMethodDeclaration_id = Glean.Id
+
+data ObjcMethodDeclaration = ObjcMethodDeclaration{objcMethodDeclaration_id
+                                                   :: {-# UNPACK #-} !ObjcMethodDeclaration_id,
+                                                   objcMethodDeclaration_key ::
+                                                   Prelude.Maybe ObjcMethodDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodDeclaration where
+  toJSON (ObjcMethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcMethodDeclaration where
+  buildStruct _proxy (ObjcMethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcMethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcMethodDeclaration where
+  rnf (ObjcMethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcMethodDeclaration where
+  def = ObjcMethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcMethodDeclaration where
+  hashWithSalt __salt (ObjcMethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjcPropertyDeclaration_id = Glean.Id
+
+data ObjcPropertyDeclaration = ObjcPropertyDeclaration{objcPropertyDeclaration_id
+                                                       ::
+                                                       {-# UNPACK #-} !ObjcPropertyDeclaration_id,
+                                                       objcPropertyDeclaration_key ::
+                                                       Prelude.Maybe ObjcPropertyDeclaration_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyDeclaration where
+  toJSON (ObjcPropertyDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcPropertyDeclaration where
+  buildStruct _proxy
+    (ObjcPropertyDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ObjcPropertyDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyDeclaration where
+  rnf (ObjcPropertyDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyDeclaration where
+  def = ObjcPropertyDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjcPropertyDeclaration where
+  hashWithSalt __salt (ObjcPropertyDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjContainerIdName_id = Glean.Id
+
+data ObjContainerIdName = ObjContainerIdName{objContainerIdName_id
+                                             :: {-# UNPACK #-} !ObjContainerIdName_id,
+                                             objContainerIdName_key ::
+                                             Prelude.Maybe ObjContainerIdName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjContainerIdName where
+  toJSON (ObjContainerIdName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjContainerIdName where
+  buildStruct _proxy (ObjContainerIdName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjContainerIdName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjContainerIdName where
+  rnf (ObjContainerIdName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjContainerIdName where
+  def = ObjContainerIdName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjContainerIdName where
+  hashWithSalt __salt (ObjContainerIdName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceQName_id = Glean.Id
+
+data NamespaceQName = NamespaceQName{namespaceQName_id ::
+                                     {-# UNPACK #-} !NamespaceQName_id,
+                                     namespaceQName_key :: Prelude.Maybe NamespaceQName_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceQName where
+  toJSON (NamespaceQName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceQName where
+  buildStruct _proxy (NamespaceQName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceQName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceQName where
+  rnf (NamespaceQName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceQName where
+  def = NamespaceQName Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceQName where
+  hashWithSalt __salt (NamespaceQName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceLowerCase_id = Glean.Id
+
+data NamespaceLowerCase = NamespaceLowerCase{namespaceLowerCase_id
+                                             :: {-# UNPACK #-} !NamespaceLowerCase_id,
+                                             namespaceLowerCase_key ::
+                                             Prelude.Maybe NamespaceLowerCase_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceLowerCase where
+  toJSON (NamespaceLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceLowerCase where
+  buildStruct _proxy (NamespaceLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceLowerCase where
+  rnf (NamespaceLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceLowerCase where
+  def = NamespaceLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceLowerCase where
+  hashWithSalt __salt (NamespaceLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceDefinition_id = Glean.Id
+
+data NamespaceDefinition = NamespaceDefinition{namespaceDefinition_id
+                                               :: {-# UNPACK #-} !NamespaceDefinition_id,
+                                               namespaceDefinition_key ::
+                                               Prelude.Maybe NamespaceDefinition_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDefinition where
+  toJSON (NamespaceDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDefinition where
+  buildStruct _proxy (NamespaceDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDefinition where
+  rnf (NamespaceDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceDefinition where
+  def = NamespaceDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceDefinition where
+  hashWithSalt __salt (NamespaceDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceDeclarationName_id = Glean.Id
+
+data NamespaceDeclarationName = NamespaceDeclarationName{namespaceDeclarationName_id
+                                                         ::
+                                                         {-# UNPACK #-} !NamespaceDeclarationName_id,
+                                                         namespaceDeclarationName_key ::
+                                                         Prelude.Maybe NamespaceDeclarationName_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclarationName where
+  toJSON (NamespaceDeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclarationName where
+  buildStruct _proxy
+    (NamespaceDeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NamespaceDeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclarationName where
+  rnf (NamespaceDeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclarationName where
+  def = NamespaceDeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceDeclarationName where
+  hashWithSalt __salt (NamespaceDeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceDeclarationByName_id = Glean.Id
+
+data NamespaceDeclarationByName = NamespaceDeclarationByName{namespaceDeclarationByName_id
+                                                             ::
+                                                             {-# UNPACK #-} !NamespaceDeclarationByName_id,
+                                                             namespaceDeclarationByName_key ::
+                                                             Prelude.Maybe
+                                                               NamespaceDeclarationByName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclarationByName where
+  toJSON (NamespaceDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclarationByName where
+  buildStruct _proxy
+    (NamespaceDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NamespaceDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclarationByName where
+  rnf (NamespaceDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclarationByName where
+  def = NamespaceDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceDeclarationByName where
+  hashWithSalt __salt (NamespaceDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceDeclaration_id = Glean.Id
+
+data NamespaceDeclaration = NamespaceDeclaration{namespaceDeclaration_id
+                                                 :: {-# UNPACK #-} !NamespaceDeclaration_id,
+                                                 namespaceDeclaration_key ::
+                                                 Prelude.Maybe NamespaceDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclaration where
+  toJSON (NamespaceDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclaration where
+  buildStruct _proxy (NamespaceDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NamespaceDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclaration where
+  rnf (NamespaceDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclaration where
+  def = NamespaceDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceDeclaration where
+  hashWithSalt __salt (NamespaceDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceAliasDeclaration_id = Glean.Id
+
+data NamespaceAliasDeclaration = NamespaceAliasDeclaration{namespaceAliasDeclaration_id
+                                                           ::
+                                                           {-# UNPACK #-} !NamespaceAliasDeclaration_id,
+                                                           namespaceAliasDeclaration_key ::
+                                                           Prelude.Maybe
+                                                             NamespaceAliasDeclaration_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceAliasDeclaration where
+  toJSON (NamespaceAliasDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceAliasDeclaration where
+  buildStruct _proxy
+    (NamespaceAliasDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NamespaceAliasDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceAliasDeclaration where
+  rnf (NamespaceAliasDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceAliasDeclaration where
+  def = NamespaceAliasDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceAliasDeclaration where
+  hashWithSalt __salt (NamespaceAliasDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverrides_id = Glean.Id
+
+data MethodOverrides = MethodOverrides{methodOverrides_id ::
+                                       {-# UNPACK #-} !MethodOverrides_id,
+                                       methodOverrides_key :: Prelude.Maybe MethodOverrides_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides where
+  toJSON (MethodOverrides __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides where
+  buildStruct _proxy (MethodOverrides __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverrides __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides where
+  rnf (MethodOverrides __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverrides where
+  def = MethodOverrides Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverrides where
+  hashWithSalt __salt (MethodOverrides _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverridden_id = Glean.Id
+
+data MethodOverridden = MethodOverridden{methodOverridden_id ::
+                                         {-# UNPACK #-} !MethodOverridden_id,
+                                         methodOverridden_key :: Prelude.Maybe MethodOverridden_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverridden where
+  toJSON (MethodOverridden __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverridden where
+  buildStruct _proxy (MethodOverridden __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverridden __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverridden where
+  rnf (MethodOverridden __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverridden where
+  def = MethodOverridden Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverridden where
+  hashWithSalt __salt (MethodOverridden _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IncludeTreeTranslationUnit_id = Glean.Id
+
+data IncludeTreeTranslationUnit = IncludeTreeTranslationUnit{includeTreeTranslationUnit_id
+                                                             ::
+                                                             {-# UNPACK #-} !IncludeTreeTranslationUnit_id,
+                                                             includeTreeTranslationUnit_key ::
+                                                             Prelude.Maybe
+                                                               IncludeTreeTranslationUnit_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTreeTranslationUnit where
+  toJSON (IncludeTreeTranslationUnit __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTreeTranslationUnit where
+  buildStruct _proxy
+    (IncludeTreeTranslationUnit __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (IncludeTreeTranslationUnit __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTreeTranslationUnit where
+  rnf (IncludeTreeTranslationUnit __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IncludeTreeTranslationUnit where
+  def = IncludeTreeTranslationUnit Default.def Prelude.Nothing
+
+instance Hashable.Hashable IncludeTreeTranslationUnit where
+  hashWithSalt __salt (IncludeTreeTranslationUnit _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IncludeTreeParent_id = Glean.Id
+
+data IncludeTreeParent = IncludeTreeParent{includeTreeParent_id ::
+                                           {-# UNPACK #-} !IncludeTreeParent_id,
+                                           includeTreeParent_key ::
+                                           Prelude.Maybe IncludeTreeParent_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTreeParent where
+  toJSON (IncludeTreeParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTreeParent where
+  buildStruct _proxy (IncludeTreeParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IncludeTreeParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTreeParent where
+  rnf (IncludeTreeParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IncludeTreeParent where
+  def = IncludeTreeParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable IncludeTreeParent where
+  hashWithSalt __salt (IncludeTreeParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IncludeTree_id = Glean.Id
+
+data IncludeTree = IncludeTree{includeTree_id ::
+                               {-# UNPACK #-} !IncludeTree_id,
+                               includeTree_key :: Prelude.Maybe IncludeTree_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTree where
+  toJSON (IncludeTree __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTree where
+  buildStruct _proxy (IncludeTree __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IncludeTree __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTree where
+  rnf (IncludeTree __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IncludeTree where
+  def = IncludeTree Default.def Prelude.Nothing
+
+instance Hashable.Hashable IncludeTree where
+  hashWithSalt __salt (IncludeTree _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PPTrace_id = Glean.Id
+
+data PPTrace = PPTrace{pPTrace_id :: {-# UNPACK #-} !PPTrace_id,
+                       pPTrace_key :: Prelude.Maybe PPTrace_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPTrace where
+  toJSON (PPTrace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PPTrace where
+  buildStruct _proxy (PPTrace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PPTrace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PPTrace where
+  rnf (PPTrace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PPTrace where
+  def = PPTrace Default.def Prelude.Nothing
+
+instance Hashable.Hashable PPTrace where
+  hashWithSalt __salt (PPTrace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionName_id = Glean.Id
+
+data FunctionName = FunctionName{functionName_id ::
+                                 {-# UNPACK #-} !FunctionName_id,
+                                 functionName_key :: Prelude.Maybe FunctionName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionName where
+  toJSON (FunctionName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionName where
+  buildStruct _proxy (FunctionName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionName where
+  rnf (FunctionName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionName where
+  def = FunctionName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionName where
+  hashWithSalt __salt (FunctionName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionLowerCase_id = Glean.Id
+
+data FunctionLowerCase = FunctionLowerCase{functionLowerCase_id ::
+                                           {-# UNPACK #-} !FunctionLowerCase_id,
+                                           functionLowerCase_key ::
+                                           Prelude.Maybe FunctionLowerCase_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionLowerCase where
+  toJSON (FunctionLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionLowerCase where
+  buildStruct _proxy (FunctionLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionLowerCase where
+  rnf (FunctionLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionLowerCase where
+  def = FunctionLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionLowerCase where
+  hashWithSalt __salt (FunctionLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDefinition_id = Glean.Id
+
+data FunctionDefinition = FunctionDefinition{functionDefinition_id
+                                             :: {-# UNPACK #-} !FunctionDefinition_id,
+                                             functionDefinition_key ::
+                                             Prelude.Maybe FunctionDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition where
+  toJSON (FunctionDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDefinition where
+  buildStruct _proxy (FunctionDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition where
+  rnf (FunctionDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition where
+  def = FunctionDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDefinition where
+  hashWithSalt __salt (FunctionDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclarationNameString_id = Glean.Id
+
+data FunctionDeclarationNameString = FunctionDeclarationNameString{functionDeclarationNameString_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !FunctionDeclarationNameString_id,
+                                                                   functionDeclarationNameString_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     FunctionDeclarationNameString_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationNameString where
+  toJSON (FunctionDeclarationNameString __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationNameString where
+  buildStruct _proxy
+    (FunctionDeclarationNameString __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionDeclarationNameString __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationNameString where
+  rnf (FunctionDeclarationNameString __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationNameString where
+  def = FunctionDeclarationNameString Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclarationNameString where
+  hashWithSalt __salt (FunctionDeclarationNameString _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclarationName_id = Glean.Id
+
+data FunctionDeclarationName = FunctionDeclarationName{functionDeclarationName_id
+                                                       ::
+                                                       {-# UNPACK #-} !FunctionDeclarationName_id,
+                                                       functionDeclarationName_key ::
+                                                       Prelude.Maybe FunctionDeclarationName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationName where
+  toJSON (FunctionDeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationName where
+  buildStruct _proxy
+    (FunctionDeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionDeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationName where
+  rnf (FunctionDeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationName where
+  def = FunctionDeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclarationName where
+  hashWithSalt __salt (FunctionDeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclaration_id = Glean.Id
+
+data FunctionDeclaration = FunctionDeclaration{functionDeclaration_id
+                                               :: {-# UNPACK #-} !FunctionDeclaration_id,
+                                               functionDeclaration_key ::
+                                               Prelude.Maybe FunctionDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration where
+  toJSON (FunctionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration where
+  buildStruct _proxy (FunctionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration where
+  rnf (FunctionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration where
+  def = FunctionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclaration where
+  hashWithSalt __salt (FunctionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclAttribute_id = Glean.Id
+
+data FunctionDeclAttribute = FunctionDeclAttribute{functionDeclAttribute_id
+                                                   :: {-# UNPACK #-} !FunctionDeclAttribute_id,
+                                                   functionDeclAttribute_key ::
+                                                   Prelude.Maybe FunctionDeclAttribute_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclAttribute where
+  toJSON (FunctionDeclAttribute __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclAttribute where
+  buildStruct _proxy (FunctionDeclAttribute __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionDeclAttribute __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclAttribute where
+  rnf (FunctionDeclAttribute __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclAttribute where
+  def = FunctionDeclAttribute Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclAttribute where
+  hashWithSalt __salt (FunctionDeclAttribute _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionAttribute_id = Glean.Id
+
+data FunctionAttribute = FunctionAttribute{functionAttribute_id ::
+                                           {-# UNPACK #-} !FunctionAttribute_id,
+                                           functionAttribute_key ::
+                                           Prelude.Maybe FunctionAttribute_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionAttribute where
+  toJSON (FunctionAttribute __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionAttribute where
+  buildStruct _proxy (FunctionAttribute __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionAttribute __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionAttribute where
+  rnf (FunctionAttribute __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionAttribute where
+  def = FunctionAttribute Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionAttribute where
+  hashWithSalt __salt (FunctionAttribute _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FilePPUseXRefs_id = Glean.Id
+
+data FilePPUseXRefs = FilePPUseXRefs{filePPUseXRefs_id ::
+                                     {-# UNPACK #-} !FilePPUseXRefs_id,
+                                     filePPUseXRefs_key :: Prelude.Maybe FilePPUseXRefs_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPUseXRefs where
+  toJSON (FilePPUseXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPUseXRefs where
+  buildStruct _proxy (FilePPUseXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FilePPUseXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPUseXRefs where
+  rnf (FilePPUseXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FilePPUseXRefs where
+  def = FilePPUseXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FilePPUseXRefs where
+  hashWithSalt __salt (FilePPUseXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FilePPUseTraceXRefs_id = Glean.Id
+
+data FilePPUseTraceXRefs = FilePPUseTraceXRefs{filePPUseTraceXRefs_id
+                                               :: {-# UNPACK #-} !FilePPUseTraceXRefs_id,
+                                               filePPUseTraceXRefs_key ::
+                                               Prelude.Maybe FilePPUseTraceXRefs_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPUseTraceXRefs where
+  toJSON (FilePPUseTraceXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPUseTraceXRefs where
+  buildStruct _proxy (FilePPUseTraceXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FilePPUseTraceXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPUseTraceXRefs where
+  rnf (FilePPUseTraceXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FilePPUseTraceXRefs where
+  def = FilePPUseTraceXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FilePPUseTraceXRefs where
+  hashWithSalt __salt (FilePPUseTraceXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FilePPTraceXRefs_id = Glean.Id
+
+data FilePPTraceXRefs = FilePPTraceXRefs{filePPTraceXRefs_id ::
+                                         {-# UNPACK #-} !FilePPTraceXRefs_id,
+                                         filePPTraceXRefs_key :: Prelude.Maybe FilePPTraceXRefs_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPTraceXRefs where
+  toJSON (FilePPTraceXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPTraceXRefs where
+  buildStruct _proxy (FilePPTraceXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FilePPTraceXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPTraceXRefs where
+  rnf (FilePPTraceXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FilePPTraceXRefs where
+  def = FilePPTraceXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FilePPTraceXRefs where
+  hashWithSalt __salt (FilePPTraceXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableDeclaration_id = Glean.Id
+
+data VariableDeclaration = VariableDeclaration{variableDeclaration_id
+                                               :: {-# UNPACK #-} !VariableDeclaration_id,
+                                               variableDeclaration_key ::
+                                               Prelude.Maybe VariableDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration where
+  toJSON (VariableDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration where
+  buildStruct _proxy (VariableDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration where
+  rnf (VariableDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration where
+  def = VariableDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDeclaration where
+  hashWithSalt __salt (VariableDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumeratorLowerCase_id = Glean.Id
+
+data EnumeratorLowerCase = EnumeratorLowerCase{enumeratorLowerCase_id
+                                               :: {-# UNPACK #-} !EnumeratorLowerCase_id,
+                                               enumeratorLowerCase_key ::
+                                               Prelude.Maybe EnumeratorLowerCase_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorLowerCase where
+  toJSON (EnumeratorLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorLowerCase where
+  buildStruct _proxy (EnumeratorLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumeratorLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorLowerCase where
+  rnf (EnumeratorLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumeratorLowerCase where
+  def = EnumeratorLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumeratorLowerCase where
+  hashWithSalt __salt (EnumeratorLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumeratorInEnum_id = Glean.Id
+
+data EnumeratorInEnum = EnumeratorInEnum{enumeratorInEnum_id ::
+                                         {-# UNPACK #-} !EnumeratorInEnum_id,
+                                         enumeratorInEnum_key :: Prelude.Maybe EnumeratorInEnum_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorInEnum where
+  toJSON (EnumeratorInEnum __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorInEnum where
+  buildStruct _proxy (EnumeratorInEnum __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumeratorInEnum __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorInEnum where
+  rnf (EnumeratorInEnum __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumeratorInEnum where
+  def = EnumeratorInEnum Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumeratorInEnum where
+  hashWithSalt __salt (EnumeratorInEnum _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumeratorByName_id = Glean.Id
+
+data EnumeratorByName = EnumeratorByName{enumeratorByName_id ::
+                                         {-# UNPACK #-} !EnumeratorByName_id,
+                                         enumeratorByName_key :: Prelude.Maybe EnumeratorByName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorByName where
+  toJSON (EnumeratorByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorByName where
+  buildStruct _proxy (EnumeratorByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumeratorByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorByName where
+  rnf (EnumeratorByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumeratorByName where
+  def = EnumeratorByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumeratorByName where
+  hashWithSalt __salt (EnumeratorByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Enumerator_id = Glean.Id
+
+data Enumerator = Enumerator{enumerator_id ::
+                             {-# UNPACK #-} !Enumerator_id,
+                             enumerator_key :: Prelude.Maybe Enumerator_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enumerator where
+  toJSON (Enumerator __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Enumerator where
+  buildStruct _proxy (Enumerator __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Enumerator __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Enumerator where
+  rnf (Enumerator __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Enumerator where
+  def = Enumerator Default.def Prelude.Nothing
+
+instance Hashable.Hashable Enumerator where
+  hashWithSalt __salt (Enumerator _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumLowerCase_id = Glean.Id
+
+data EnumLowerCase = EnumLowerCase{enumLowerCase_id ::
+                                   {-# UNPACK #-} !EnumLowerCase_id,
+                                   enumLowerCase_key :: Prelude.Maybe EnumLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumLowerCase where
+  toJSON (EnumLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumLowerCase where
+  buildStruct _proxy (EnumLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumLowerCase where
+  rnf (EnumLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumLowerCase where
+  def = EnumLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumLowerCase where
+  hashWithSalt __salt (EnumLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDefinition_id = Glean.Id
+
+data EnumDefinition = EnumDefinition{enumDefinition_id ::
+                                     {-# UNPACK #-} !EnumDefinition_id,
+                                     enumDefinition_key :: Prelude.Maybe EnumDefinition_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDefinition where
+  toJSON (EnumDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDefinition where
+  buildStruct _proxy (EnumDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDefinition where
+  rnf (EnumDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDefinition where
+  def = EnumDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDefinition where
+  hashWithSalt __salt (EnumDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDeclaration_id = Glean.Id
+
+data EnumDeclaration = EnumDeclaration{enumDeclaration_id ::
+                                       {-# UNPACK #-} !EnumDeclaration_id,
+                                       enumDeclaration_key :: Prelude.Maybe EnumDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration where
+  toJSON (EnumDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclaration where
+  buildStruct _proxy (EnumDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration where
+  rnf (EnumDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration where
+  def = EnumDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDeclaration where
+  hashWithSalt __salt (EnumDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefnInRecord_id = Glean.Id
+
+data DefnInRecord = DefnInRecord{defnInRecord_id ::
+                                 {-# UNPACK #-} !DefnInRecord_id,
+                                 defnInRecord_key :: Prelude.Maybe DefnInRecord_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefnInRecord where
+  toJSON (DefnInRecord __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefnInRecord where
+  buildStruct _proxy (DefnInRecord __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefnInRecord __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefnInRecord where
+  rnf (DefnInRecord __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefnInRecord where
+  def = DefnInRecord Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefnInRecord where
+  hashWithSalt __salt (DefnInRecord _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationComment_id = Glean.Id
+
+data DeclarationComment = DeclarationComment{declarationComment_id
+                                             :: {-# UNPACK #-} !DeclarationComment_id,
+                                             declarationComment_key ::
+                                             Prelude.Maybe DeclarationComment_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment where
+  toJSON (DeclarationComment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment where
+  buildStruct _proxy (DeclarationComment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationComment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment where
+  rnf (DeclarationComment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationComment where
+  def = DeclarationComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment where
+  hashWithSalt __salt (DeclarationComment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationInTrace_id = Glean.Id
+
+data DeclarationInTrace = DeclarationInTrace{declarationInTrace_id
+                                             :: {-# UNPACK #-} !DeclarationInTrace_id,
+                                             declarationInTrace_key ::
+                                             Prelude.Maybe DeclarationInTrace_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationInTrace where
+  toJSON (DeclarationInTrace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationInTrace where
+  buildStruct _proxy (DeclarationInTrace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationInTrace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationInTrace where
+  rnf (DeclarationInTrace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationInTrace where
+  def = DeclarationInTrace Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationInTrace where
+  hashWithSalt __salt (DeclarationInTrace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocationName_id = Glean.Id
+
+data DeclarationLocationName = DeclarationLocationName{declarationLocationName_id
+                                                       ::
+                                                       {-# UNPACK #-} !DeclarationLocationName_id,
+                                                       declarationLocationName_key ::
+                                                       Prelude.Maybe DeclarationLocationName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocationName where
+  toJSON (DeclarationLocationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocationName where
+  buildStruct _proxy
+    (DeclarationLocationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationLocationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocationName where
+  rnf (DeclarationLocationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocationName where
+  def = DeclarationLocationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocationName where
+  hashWithSalt __salt (DeclarationLocationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocationNameSpan_id = Glean.Id
+
+data DeclarationLocationNameSpan = DeclarationLocationNameSpan{declarationLocationNameSpan_id
+                                                               ::
+                                                               {-# UNPACK #-} !DeclarationLocationNameSpan_id,
+                                                               declarationLocationNameSpan_key ::
+                                                               Prelude.Maybe
+                                                                 DeclarationLocationNameSpan_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocationNameSpan where
+  toJSON (DeclarationLocationNameSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocationNameSpan where
+  buildStruct _proxy
+    (DeclarationLocationNameSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationLocationNameSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocationNameSpan where
+  rnf (DeclarationLocationNameSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocationNameSpan where
+  def = DeclarationLocationNameSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocationNameSpan where
+  hashWithSalt __salt (DeclarationLocationNameSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationNameSpan_id = Glean.Id
+
+data DeclarationNameSpan = DeclarationNameSpan{declarationNameSpan_id
+                                               :: {-# UNPACK #-} !DeclarationNameSpan_id,
+                                               declarationNameSpan_key ::
+                                               Prelude.Maybe DeclarationNameSpan_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan where
+  toJSON (DeclarationNameSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan where
+  buildStruct _proxy (DeclarationNameSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationNameSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan where
+  rnf (DeclarationNameSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan where
+  def = DeclarationNameSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationNameSpan where
+  hashWithSalt __salt (DeclarationNameSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSources_id = Glean.Id
+
+data DeclarationSources = DeclarationSources{declarationSources_id
+                                             :: {-# UNPACK #-} !DeclarationSources_id,
+                                             declarationSources_key ::
+                                             Prelude.Maybe DeclarationSources_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSources where
+  toJSON (DeclarationSources __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSources where
+  buildStruct _proxy (DeclarationSources __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationSources __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSources where
+  rnf (DeclarationSources __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSources where
+  def = DeclarationSources Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSources where
+  hashWithSalt __salt (DeclarationSources _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSrcRange_id = Glean.Id
+
+data DeclarationSrcRange = DeclarationSrcRange{declarationSrcRange_id
+                                               :: {-# UNPACK #-} !DeclarationSrcRange_id,
+                                               declarationSrcRange_key ::
+                                               Prelude.Maybe DeclarationSrcRange_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSrcRange where
+  toJSON (DeclarationSrcRange __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSrcRange where
+  buildStruct _proxy (DeclarationSrcRange __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationSrcRange __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSrcRange where
+  rnf (DeclarationSrcRange __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSrcRange where
+  def = DeclarationSrcRange Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSrcRange where
+  hashWithSalt __salt (DeclarationSrcRange _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationTargets_id = Glean.Id
+
+data DeclarationTargets = DeclarationTargets{declarationTargets_id
+                                             :: {-# UNPACK #-} !DeclarationTargets_id,
+                                             declarationTargets_key ::
+                                             Prelude.Maybe DeclarationTargets_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationTargets where
+  toJSON (DeclarationTargets __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationTargets where
+  buildStruct _proxy (DeclarationTargets __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationTargets __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationTargets where
+  rnf (DeclarationTargets __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationTargets where
+  def = DeclarationTargets Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationTargets where
+  hashWithSalt __salt (DeclarationTargets _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationToUSR_id = Glean.Id
+
+data DeclarationToUSR = DeclarationToUSR{declarationToUSR_id ::
+                                         {-# UNPACK #-} !DeclarationToUSR_id,
+                                         declarationToUSR_key :: Prelude.Maybe DeclarationToUSR_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationToUSR where
+  toJSON (DeclarationToUSR __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationToUSR where
+  buildStruct _proxy (DeclarationToUSR __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationToUSR __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationToUSR where
+  rnf (DeclarationToUSR __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationToUSR where
+  def = DeclarationToUSR Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationToUSR where
+  hashWithSalt __salt (DeclarationToUSR _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Declarations_id = Glean.Id
+
+data Declarations = Declarations{declarations_id ::
+                                 {-# UNPACK #-} !Declarations_id,
+                                 declarations_key :: Prelude.Maybe [Declaration]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declarations where
+  toJSON (Declarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Declarations where
+  buildStruct _proxy (Declarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                       (Thrift.buildStruct _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Declarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Declarations where
+  rnf (Declarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Declarations where
+  def = Declarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable Declarations where
+  hashWithSalt __salt (Declarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefToBaseDecl_id = Glean.Id
+
+data DefToBaseDecl = DefToBaseDecl{defToBaseDecl_id ::
+                                   {-# UNPACK #-} !DefToBaseDecl_id,
+                                   defToBaseDecl_key :: Prelude.Maybe DefToBaseDecl_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefToBaseDecl where
+  toJSON (DefToBaseDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefToBaseDecl where
+  buildStruct _proxy (DefToBaseDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefToBaseDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefToBaseDecl where
+  rnf (DefToBaseDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefToBaseDecl where
+  def = DefToBaseDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefToBaseDecl where
+  hashWithSalt __salt (DefToBaseDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MangledNameHashToDeclaration_id = Glean.Id
+
+data MangledNameHashToDeclaration = MangledNameHashToDeclaration{mangledNameHashToDeclaration_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !MangledNameHashToDeclaration_id,
+                                                                 mangledNameHashToDeclaration_key ::
+                                                                 Prelude.Maybe
+                                                                   MangledNameHashToDeclaration_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MangledNameHashToDeclaration where
+  toJSON (MangledNameHashToDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MangledNameHashToDeclaration where
+  buildStruct _proxy
+    (MangledNameHashToDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MangledNameHashToDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MangledNameHashToDeclaration where
+  rnf (MangledNameHashToDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MangledNameHashToDeclaration where
+  def = MangledNameHashToDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MangledNameHashToDeclaration where
+  hashWithSalt __salt (MangledNameHashToDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Same_id = Glean.Id
+
+data Same = Same{same_id :: {-# UNPACK #-} !Same_id,
+                 same_key :: Prelude.Maybe Same_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Same where
+  toJSON (Same __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Same where
+  buildStruct _proxy (Same __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Same __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Same where
+  rnf (Same __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Same where
+  def = Same Default.def Prelude.Nothing
+
+instance Hashable.Hashable Same where
+  hashWithSalt __salt (Same _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type USRToDeclaration_id = Glean.Id
+
+data USRToDeclaration = USRToDeclaration{uSRToDeclaration_id ::
+                                         {-# UNPACK #-} !USRToDeclaration_id,
+                                         uSRToDeclaration_key :: Prelude.Maybe USRToDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON USRToDeclaration where
+  toJSON (USRToDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct USRToDeclaration where
+  buildStruct _proxy (USRToDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (USRToDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData USRToDeclaration where
+  rnf (USRToDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default USRToDeclaration where
+  def = USRToDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable USRToDeclaration where
+  hashWithSalt __salt (USRToDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefMap_id = Glean.Id
+
+data FileXRefMap = FileXRefMap{fileXRefMap_id ::
+                               {-# UNPACK #-} !FileXRefMap_id,
+                               fileXRefMap_key :: Prelude.Maybe FileXRefMap_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefMap where
+  toJSON (FileXRefMap __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefMap where
+  buildStruct _proxy (FileXRefMap __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefMap __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefMap where
+  rnf (FileXRefMap __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefMap where
+  def = FileXRefMap Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefMap where
+  hashWithSalt __salt (FileXRefMap _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SpellingXRef_id = Glean.Id
+
+data SpellingXRef = SpellingXRef{spellingXRef_id ::
+                                 {-# UNPACK #-} !SpellingXRef_id,
+                                 spellingXRef_key :: Prelude.Maybe SpellingXRef_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SpellingXRef where
+  toJSON (SpellingXRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SpellingXRef where
+  buildStruct _proxy (SpellingXRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SpellingXRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SpellingXRef where
+  rnf (SpellingXRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SpellingXRef where
+  def = SpellingXRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable SpellingXRef where
+  hashWithSalt __salt (SpellingXRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetUses_id = Glean.Id
+
+data TargetUses = TargetUses{targetUses_id ::
+                             {-# UNPACK #-} !TargetUses_id,
+                             targetUses_key :: Prelude.Maybe TargetUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses where
+  toJSON (TargetUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses where
+  buildStruct _proxy (TargetUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses where
+  rnf (TargetUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetUses where
+  def = TargetUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetUses where
+  hashWithSalt __salt (TargetUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ThriftToCxx_id = Glean.Id
+
+data ThriftToCxx = ThriftToCxx{thriftToCxx_id ::
+                               {-# UNPACK #-} !ThriftToCxx_id,
+                               thriftToCxx_key :: Prelude.Maybe ThriftToCxx_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftToCxx where
+  toJSON (ThriftToCxx __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftToCxx where
+  buildStruct _proxy (ThriftToCxx __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ThriftToCxx __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftToCxx where
+  rnf (ThriftToCxx __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ThriftToCxx where
+  def = ThriftToCxx Default.def Prelude.Nothing
+
+instance Hashable.Hashable ThriftToCxx where
+  hashWithSalt __salt (ThriftToCxx _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefIndirectTarget_id = Glean.Id
+
+data XRefIndirectTarget = XRefIndirectTarget{xRefIndirectTarget_id
+                                             :: {-# UNPACK #-} !XRefIndirectTarget_id,
+                                             xRefIndirectTarget_key ::
+                                             Prelude.Maybe XRefIndirectTarget_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefIndirectTarget where
+  toJSON (XRefIndirectTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefIndirectTarget where
+  buildStruct _proxy (XRefIndirectTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefIndirectTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefIndirectTarget where
+  rnf (XRefIndirectTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefIndirectTarget where
+  def = XRefIndirectTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefIndirectTarget where
+  hashWithSalt __salt (XRefIndirectTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefTargets_id = Glean.Id
+
+data XRefTargets = XRefTargets{xRefTargets_id ::
+                               {-# UNPACK #-} !XRefTargets_id,
+                               xRefTargets_key :: Prelude.Maybe [XRefTarget]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTargets where
+  toJSON (XRefTargets __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTargets where
+  buildStruct _proxy (XRefTargets __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                       (Thrift.buildStruct _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefTargets __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTargets where
+  rnf (XRefTargets __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefTargets where
+  def = XRefTargets Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefTargets where
+  hashWithSalt __salt (XRefTargets _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclToFamily_id = Glean.Id
+
+data DeclToFamily = DeclToFamily{declToFamily_id ::
+                                 {-# UNPACK #-} !DeclToFamily_id,
+                                 declToFamily_key :: Prelude.Maybe DeclToFamily_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclToFamily where
+  toJSON (DeclToFamily __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclToFamily where
+  buildStruct _proxy (DeclToFamily __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclToFamily __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclToFamily where
+  rnf (DeclToFamily __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclToFamily where
+  def = DeclToFamily Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclToFamily where
+  hashWithSalt __salt (DeclToFamily _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclInRecord_id = Glean.Id
+
+data DeclInRecord = DeclInRecord{declInRecord_id ::
+                                 {-# UNPACK #-} !DeclInRecord_id,
+                                 declInRecord_key :: Prelude.Maybe DeclInRecord_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclInRecord where
+  toJSON (DeclInRecord __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclInRecord where
+  buildStruct _proxy (DeclInRecord __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclInRecord __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclInRecord where
+  rnf (DeclInRecord __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclInRecord where
+  def = DeclInRecord Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclInRecord where
+  hashWithSalt __salt (DeclInRecord _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclInObjcContainer_id = Glean.Id
+
+data DeclInObjcContainer = DeclInObjcContainer{declInObjcContainer_id
+                                               :: {-# UNPACK #-} !DeclInObjcContainer_id,
+                                               declInObjcContainer_key ::
+                                               Prelude.Maybe DeclInObjcContainer_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclInObjcContainer where
+  toJSON (DeclInObjcContainer __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclInObjcContainer where
+  buildStruct _proxy (DeclInObjcContainer __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclInObjcContainer __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclInObjcContainer where
+  rnf (DeclInObjcContainer __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclInObjcContainer where
+  def = DeclInObjcContainer Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclInObjcContainer where
+  hashWithSalt __salt (DeclInObjcContainer _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclFamilyOf_id = Glean.Id
+
+data DeclFamilyOf = DeclFamilyOf{declFamilyOf_id ::
+                                 {-# UNPACK #-} !DeclFamilyOf_id,
+                                 declFamilyOf_key :: Prelude.Maybe DeclFamilyOf_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclFamilyOf where
+  toJSON (DeclFamilyOf __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclFamilyOf where
+  buildStruct _proxy (DeclFamilyOf __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclFamilyOf __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclFamilyOf where
+  rnf (DeclFamilyOf __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclFamilyOf where
+  def = DeclFamilyOf Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclFamilyOf where
+  hashWithSalt __salt (DeclFamilyOf _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclFamily_id = Glean.Id
+
+data DeclFamily = DeclFamily{declFamily_id ::
+                             {-# UNPACK #-} !DeclFamily_id,
+                             declFamily_key :: Prelude.Maybe [Declaration]}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclFamily where
+  toJSON (DeclFamily __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclFamily where
+  buildStruct _proxy (DeclFamily __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                       (Thrift.buildStruct _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclFamily __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclFamily where
+  rnf (DeclFamily __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclFamily where
+  def = DeclFamily Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclFamily where
+  hashWithSalt __salt (DeclFamily _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxToThrift_id = Glean.Id
+
+data CxxToThrift = CxxToThrift{cxxToThrift_id ::
+                               {-# UNPACK #-} !CxxToThrift_id,
+                               cxxToThrift_key :: Prelude.Maybe CxxToThrift_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxToThrift where
+  toJSON (CxxToThrift __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxToThrift where
+  buildStruct _proxy (CxxToThrift __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxToThrift __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxToThrift where
+  rnf (CxxToThrift __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxToThrift where
+  def = CxxToThrift Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxToThrift where
+  hashWithSalt __salt (CxxToThrift _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Attribute_id = Glean.Id
+
+data Attribute = Attribute{attribute_id ::
+                           {-# UNPACK #-} !Attribute_id,
+                           attribute_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Attribute where
+  toJSON (Attribute __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Attribute where
+  buildStruct _proxy (Attribute __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Attribute __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Attribute where
+  rnf (Attribute __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Attribute where
+  def = Attribute Default.def Prelude.Nothing
+
+instance Hashable.Hashable Attribute where
+  hashWithSalt __salt (Attribute _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDefinition_id = Glean.Id
+
+data RecordDefinition = RecordDefinition{recordDefinition_id ::
+                                         {-# UNPACK #-} !RecordDefinition_id,
+                                         recordDefinition_key :: Prelude.Maybe RecordDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDefinition where
+  toJSON (RecordDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDefinition where
+  buildStruct _proxy (RecordDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RecordDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDefinition where
+  rnf (RecordDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDefinition where
+  def = RecordDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDefinition where
+  hashWithSalt __salt (RecordDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationScope_id = Glean.Id
+
+data DeclarationScope = DeclarationScope{declarationScope_id ::
+                                         {-# UNPACK #-} !DeclarationScope_id,
+                                         declarationScope_key :: Prelude.Maybe DeclarationScope_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationScope where
+  toJSON (DeclarationScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationScope where
+  buildStruct _proxy (DeclarationScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationScope where
+  rnf (DeclarationScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationScope where
+  def = DeclarationScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationScope where
+  hashWithSalt __salt (DeclarationScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDeclarationByName_id = Glean.Id
+
+data EnumDeclarationByName = EnumDeclarationByName{enumDeclarationByName_id
+                                                   :: {-# UNPACK #-} !EnumDeclarationByName_id,
+                                                   enumDeclarationByName_key ::
+                                                   Prelude.Maybe EnumDeclarationByName_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclarationByName where
+  toJSON (EnumDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclarationByName where
+  buildStruct _proxy (EnumDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (EnumDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclarationByName where
+  rnf (EnumDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDeclarationByName where
+  def = EnumDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDeclarationByName where
+  hashWithSalt __salt (EnumDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclarationByNameScope_id = Glean.Id
+
+data FunctionDeclarationByNameScope = FunctionDeclarationByNameScope{functionDeclarationByNameScope_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !FunctionDeclarationByNameScope_id,
+                                                                     functionDeclarationByNameScope_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       FunctionDeclarationByNameScope_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationByNameScope where
+  toJSON (FunctionDeclarationByNameScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationByNameScope where
+  buildStruct _proxy
+    (FunctionDeclarationByNameScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionDeclarationByNameScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationByNameScope where
+  rnf (FunctionDeclarationByNameScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationByNameScope where
+  def = FunctionDeclarationByNameScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclarationByNameScope where
+  hashWithSalt __salt (FunctionDeclarationByNameScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionQName_id = Glean.Id
+
+data FunctionQName = FunctionQName{functionQName_id ::
+                                   {-# UNPACK #-} !FunctionQName_id,
+                                   functionQName_key :: Prelude.Maybe FunctionQName_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionQName where
+  toJSON (FunctionQName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionQName where
+  buildStruct _proxy (FunctionQName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionQName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionQName where
+  rnf (FunctionQName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionQName where
+  def = FunctionQName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionQName where
+  hashWithSalt __salt (FunctionQName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QName_id = Glean.Id
+
+data QName = QName{qName_id :: {-# UNPACK #-} !QName_id,
+                   qName_key :: Prelude.Maybe QName_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName where
+  toJSON (QName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QName where
+  buildStruct _proxy (QName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName where
+  rnf (QName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QName where
+  def = QName Default.def Prelude.Nothing
+
+instance Hashable.Hashable QName where
+  hashWithSalt __salt (QName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDeclarationClass_id = Glean.Id
+
+data RecordDeclarationClass = RecordDeclarationClass{recordDeclarationClass_id
+                                                     :: {-# UNPACK #-} !RecordDeclarationClass_id,
+                                                     recordDeclarationClass_key ::
+                                                     Prelude.Maybe RecordDeclarationClass_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationClass where
+  toJSON (RecordDeclarationClass __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationClass where
+  buildStruct _proxy
+    (RecordDeclarationClass __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordDeclarationClass __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationClass where
+  rnf (RecordDeclarationClass __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationClass where
+  def = RecordDeclarationClass Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDeclarationClass where
+  hashWithSalt __salt (RecordDeclarationClass _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDeclarationStruct_id = Glean.Id
+
+data RecordDeclarationStruct = RecordDeclarationStruct{recordDeclarationStruct_id
+                                                       ::
+                                                       {-# UNPACK #-} !RecordDeclarationStruct_id,
+                                                       recordDeclarationStruct_key ::
+                                                       Prelude.Maybe RecordDeclarationStruct_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationStruct where
+  toJSON (RecordDeclarationStruct __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationStruct where
+  buildStruct _proxy
+    (RecordDeclarationStruct __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordDeclarationStruct __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationStruct where
+  rnf (RecordDeclarationStruct __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationStruct where
+  def = RecordDeclarationStruct Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDeclarationStruct where
+  hashWithSalt __salt (RecordDeclarationStruct _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordDeclarationUnion_id = Glean.Id
+
+data RecordDeclarationUnion = RecordDeclarationUnion{recordDeclarationUnion_id
+                                                     :: {-# UNPACK #-} !RecordDeclarationUnion_id,
+                                                     recordDeclarationUnion_key ::
+                                                     Prelude.Maybe RecordDeclarationUnion_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationUnion where
+  toJSON (RecordDeclarationUnion __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationUnion where
+  buildStruct _proxy
+    (RecordDeclarationUnion __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RecordDeclarationUnion __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationUnion where
+  rnf (RecordDeclarationUnion __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationUnion where
+  def = RecordDeclarationUnion Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordDeclarationUnion where
+  hashWithSalt __salt (RecordDeclarationUnion _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeAliasDeclarationByName_id = Glean.Id
+
+data TypeAliasDeclarationByName = TypeAliasDeclarationByName{typeAliasDeclarationByName_id
+                                                             ::
+                                                             {-# UNPACK #-} !TypeAliasDeclarationByName_id,
+                                                             typeAliasDeclarationByName_key ::
+                                                             Prelude.Maybe
+                                                               TypeAliasDeclarationByName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasDeclarationByName where
+  toJSON (TypeAliasDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasDeclarationByName where
+  buildStruct _proxy
+    (TypeAliasDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TypeAliasDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasDeclarationByName where
+  rnf (TypeAliasDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeAliasDeclarationByName where
+  def = TypeAliasDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeAliasDeclarationByName where
+  hashWithSalt __salt (TypeAliasDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableDeclarationNonLocalByName_id = Glean.Id
+
+data VariableDeclarationNonLocalByName = VariableDeclarationNonLocalByName{variableDeclarationNonLocalByName_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !VariableDeclarationNonLocalByName_id,
+                                                                           variableDeclarationNonLocalByName_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             VariableDeclarationNonLocalByName_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclarationNonLocalByName where
+  toJSON (VariableDeclarationNonLocalByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclarationNonLocalByName
+         where
+  buildStruct _proxy
+    (VariableDeclarationNonLocalByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (VariableDeclarationNonLocalByName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclarationNonLocalByName where
+  rnf (VariableDeclarationNonLocalByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDeclarationNonLocalByName where
+  def = VariableDeclarationNonLocalByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDeclarationNonLocalByName where
+  hashWithSalt __salt (VariableDeclarationNonLocalByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefVia = XRefVia_usingDeclaration UsingDeclaration
+             | XRefVia_usingDirective UsingDirective
+             | XRefVia_macro Glean.Schema.Pp1.Use
+             | XRefVia_EMPTY
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefVia where
+  toJSON (XRefVia_usingDeclaration __usingDeclaration)
+    = Aeson.object ["usingDeclaration" .= __usingDeclaration]
+  toJSON (XRefVia_usingDirective __usingDirective)
+    = Aeson.object ["usingDirective" .= __usingDirective]
+  toJSON (XRefVia_macro __macro) = Aeson.object ["macro" .= __macro]
+  toJSON XRefVia_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefVia where
+  buildStruct _proxy (XRefVia_usingDeclaration __usingDeclaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "usingDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __usingDeclaration)]
+  buildStruct _proxy (XRefVia_usingDirective __usingDirective)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "usingDirective"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __usingDirective)]
+  buildStruct _proxy (XRefVia_macro __macro)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __macro)]
+  buildStruct _proxy XRefVia_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefVia_usingDeclaration _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefVia_usingDirective _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefVia_macro _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefVia_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefVia_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("usingDeclaration", 1), ("usingDirective", 2), ("macro", 3)]
+
+instance DeepSeq.NFData XRefVia where
+  rnf (XRefVia_usingDeclaration __usingDeclaration)
+    = DeepSeq.rnf __usingDeclaration
+  rnf (XRefVia_usingDirective __usingDirective)
+    = DeepSeq.rnf __usingDirective
+  rnf (XRefVia_macro __macro) = DeepSeq.rnf __macro
+  rnf XRefVia_EMPTY = ()
+
+instance Default.Default XRefVia where
+  def = XRefVia_EMPTY
+
+instance Hashable.Hashable XRefVia where
+  hashWithSalt __salt (XRefVia_usingDeclaration _usingDeclaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _usingDeclaration)
+  hashWithSalt __salt (XRefVia_usingDirective _usingDirective)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _usingDirective)
+  hashWithSalt __salt (XRefVia_macro _macro)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _macro)
+  hashWithSalt __salt XRefVia_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data VariableLowerCase_key = VariableLowerCase_key{variableLowerCase_key_name_lowercase
+                                                   :: Text.Text,
+                                                   variableLowerCase_key_name :: Text.Text}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableLowerCase_key where
+  toJSON
+    (VariableLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableLowerCase_key where
+  buildStruct _proxy
+    (VariableLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (VariableLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableLowerCase_key where
+  rnf (VariableLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default VariableLowerCase_key where
+  def = VariableLowerCase_key "" ""
+
+instance Hashable.Hashable VariableLowerCase_key where
+  hashWithSalt __salt (VariableLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data UsingDirective_key = UsingDirective_key{usingDirective_key_name
+                                             :: QName,
+                                             usingDirective_key_source :: Glean.Schema.Src.Range}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UsingDirective_key where
+  toJSON (UsingDirective_key __field__name __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct UsingDirective_key where
+  buildStruct _proxy
+    (UsingDirective_key __field__name __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (UsingDirective_key __val__name __val__source)
+              _idMap = HashMap.fromList [("name", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UsingDirective_key where
+  rnf (UsingDirective_key __field__name __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default UsingDirective_key where
+  def = UsingDirective_key Default.def Default.def
+
+instance Hashable.Hashable UsingDirective_key where
+  hashWithSalt __salt (UsingDirective_key _name _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _source
+
+data UsingDeclaration_key = UsingDeclaration_key{usingDeclaration_key_name
+                                                 :: FunctionQName,
+                                                 usingDeclaration_key_source ::
+                                                 Glean.Schema.Src.Range}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UsingDeclaration_key where
+  toJSON (UsingDeclaration_key __field__name __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct UsingDeclaration_key where
+  buildStruct _proxy
+    (UsingDeclaration_key __field__name __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (UsingDeclaration_key __val__name __val__source)
+              _idMap = HashMap.fromList [("name", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UsingDeclaration_key where
+  rnf (UsingDeclaration_key __field__name __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default UsingDeclaration_key where
+  def = UsingDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable UsingDeclaration_key where
+  hashWithSalt __salt (UsingDeclaration_key _name _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _source
+
+type USR = Text.Text
+
+data TypeAliasLowerCase_key = TypeAliasLowerCase_key{typeAliasLowerCase_key_name_lowercase
+                                                     :: Text.Text,
+                                                     typeAliasLowerCase_key_name :: Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasLowerCase_key where
+  toJSON
+    (TypeAliasLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasLowerCase_key where
+  buildStruct _proxy
+    (TypeAliasLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (TypeAliasLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasLowerCase_key where
+  rnf (TypeAliasLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TypeAliasLowerCase_key where
+  def = TypeAliasLowerCase_key "" ""
+
+instance Hashable.Hashable TypeAliasLowerCase_key where
+  hashWithSalt __salt (TypeAliasLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data TypeAliasKind = TypeAliasKind_Typedef
+                   | TypeAliasKind_Using
+                   | TypeAliasKind__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData TypeAliasKind where
+  rnf __TypeAliasKind = Prelude.seq __TypeAliasKind ()
+
+instance Default.Default TypeAliasKind where
+  def = TypeAliasKind_Typedef
+
+instance Hashable.Hashable TypeAliasKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum TypeAliasKind where
+  toThriftEnum 0 = TypeAliasKind_Typedef
+  toThriftEnum 1 = TypeAliasKind_Using
+  toThriftEnum val = TypeAliasKind__UNKNOWN val
+  fromThriftEnum TypeAliasKind_Typedef = 0
+  fromThriftEnum TypeAliasKind_Using = 1
+  fromThriftEnum (TypeAliasKind__UNKNOWN val) = val
+  allThriftEnumValues = [TypeAliasKind_Typedef, TypeAliasKind_Using]
+  toThriftEnumEither 0 = Prelude.Right TypeAliasKind_Typedef
+  toThriftEnumEither 1 = Prelude.Right TypeAliasKind_Using
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum TypeAliasKind: "
+           ++ Prelude.show val)
+
+data TypeAliasDeclaration_key = TypeAliasDeclaration_key{typeAliasDeclaration_key_name
+                                                         :: QName,
+                                                         typeAliasDeclaration_key_type :: Type,
+                                                         typeAliasDeclaration_key_kind ::
+                                                         TypeAliasKind,
+                                                         typeAliasDeclaration_key_source ::
+                                                         Glean.Schema.Src.Range}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasDeclaration_key where
+  toJSON
+    (TypeAliasDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "kind" .= __field__kind :
+               "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasDeclaration_key where
+  buildStruct _proxy
+    (TypeAliasDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__kind)
+               :
+               Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__source)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "TypeAliasKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (TypeAliasDeclaration_key __val__name __val__type
+                                                  __val__kind
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("kind", 3), ("source", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasDeclaration_key where
+  rnf
+    (TypeAliasDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default TypeAliasDeclaration_key where
+  def
+    = TypeAliasDeclaration_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable TypeAliasDeclaration_key where
+  hashWithSalt __salt
+    (TypeAliasDeclaration_key _name _type _kind _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+           _kind)
+        _source
+
+data TranslationUnitXRefs_key = TranslationUnitXRefs_key{translationUnitXRefs_key_tunit
+                                                         :: Glean.Schema.Buck.TranslationUnit,
+                                                         translationUnitXRefs_key_xrefs ::
+                                                         [FileXRefs]}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitXRefs_key where
+  toJSON (TranslationUnitXRefs_key __field__tunit __field__xrefs)
+    = Aeson.object
+        ("tunit" .= __field__tunit :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitXRefs_key where
+  buildStruct _proxy
+    (TranslationUnitXRefs_key __field__tunit __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tunit" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tunit)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tunit <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tunit
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tunit <- ST.readSTRef __field__tunit
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure
+                                               (TranslationUnitXRefs_key __val__tunit __val__xrefs)
+              _idMap = HashMap.fromList [("tunit", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitXRefs_key where
+  rnf (TranslationUnitXRefs_key __field__tunit __field__xrefs)
+    = DeepSeq.rnf __field__tunit `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default TranslationUnitXRefs_key where
+  def = TranslationUnitXRefs_key Default.def Default.def
+
+instance Hashable.Hashable TranslationUnitXRefs_key where
+  hashWithSalt __salt (TranslationUnitXRefs_key _tunit _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tunit)
+        _xrefs
+
+data TranslationUnitTrace_key = TranslationUnitTrace_key{translationUnitTrace_key_tunit
+                                                         :: Glean.Schema.Buck.TranslationUnit,
+                                                         translationUnitTrace_key_trace :: Trace}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitTrace_key where
+  toJSON (TranslationUnitTrace_key __field__tunit __field__trace)
+    = Aeson.object
+        ("tunit" .= __field__tunit :
+           "trace" .= __field__trace : Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitTrace_key where
+  buildStruct _proxy
+    (TranslationUnitTrace_key __field__tunit __field__trace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tunit" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tunit)
+           :
+           Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__trace)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tunit <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tunit
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tunit <- ST.readSTRef __field__tunit
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             Prelude.pure
+                                               (TranslationUnitTrace_key __val__tunit __val__trace)
+              _idMap = HashMap.fromList [("tunit", 1), ("trace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitTrace_key where
+  rnf (TranslationUnitTrace_key __field__tunit __field__trace)
+    = DeepSeq.rnf __field__tunit `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq` ()
+
+instance Default.Default TranslationUnitTrace_key where
+  def = TranslationUnitTrace_key Default.def Default.def
+
+instance Hashable.Hashable TranslationUnitTrace_key where
+  hashWithSalt __salt (TranslationUnitTrace_key _tunit _trace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tunit)
+        _trace
+
+data TranslationUnitIncludeTree_key = TranslationUnitIncludeTree_key{translationUnitIncludeTree_key_tunit
+                                                                     ::
+                                                                     Glean.Schema.Buck.TranslationUnit,
+                                                                     translationUnitIncludeTree_key_tree
+                                                                     :: IncludeTree}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TranslationUnitIncludeTree_key where
+  toJSON
+    (TranslationUnitIncludeTree_key __field__tunit __field__tree)
+    = Aeson.object
+        ("tunit" .= __field__tunit :
+           "tree" .= __field__tree : Prelude.mempty)
+
+instance Thrift.ThriftStruct TranslationUnitIncludeTree_key where
+  buildStruct _proxy
+    (TranslationUnitIncludeTree_key __field__tunit __field__tree)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tunit" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tunit)
+           :
+           Thrift.genField _proxy "tree" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__tree)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tunit <- ST.newSTRef Default.def
+            __field__tree <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tunit
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tree
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tunit <- ST.readSTRef __field__tunit
+                                             !__val__tree <- ST.readSTRef __field__tree
+                                             Prelude.pure
+                                               (TranslationUnitIncludeTree_key __val__tunit
+                                                  __val__tree)
+              _idMap = HashMap.fromList [("tunit", 1), ("tree", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TranslationUnitIncludeTree_key where
+  rnf (TranslationUnitIncludeTree_key __field__tunit __field__tree)
+    = DeepSeq.rnf __field__tunit `Prelude.seq`
+        DeepSeq.rnf __field__tree `Prelude.seq` ()
+
+instance Default.Default TranslationUnitIncludeTree_key where
+  def = TranslationUnitIncludeTree_key Default.def Default.def
+
+instance Hashable.Hashable TranslationUnitIncludeTree_key where
+  hashWithSalt __salt (TranslationUnitIncludeTree_key _tunit _tree)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tunit) _tree
+
+data Trace_key = Trace_key{trace_key_file :: Glean.Schema.Src.File,
+                           trace_key_declarations :: Declarations,
+                           trace_key_preprocessor :: PPTrace}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Trace_key where
+  toJSON
+    (Trace_key __field__file __field__declarations
+       __field__preprocessor)
+    = Aeson.object
+        ("file" .= __field__file :
+           "declarations" .= __field__declarations :
+             "preprocessor" .= __field__preprocessor : Prelude.mempty)
+
+instance Thrift.ThriftStruct Trace_key where
+  buildStruct _proxy
+    (Trace_key __field__file __field__declarations
+       __field__preprocessor)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "declarations" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declarations)
+             :
+             Thrift.genField _proxy "preprocessor" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__preprocessor)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__declarations <- ST.newSTRef Default.def
+            __field__preprocessor <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declarations
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__preprocessor
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__declarations <- ST.readSTRef
+                                                                       __field__declarations
+                                             !__val__preprocessor <- ST.readSTRef
+                                                                       __field__preprocessor
+                                             Prelude.pure
+                                               (Trace_key __val__file __val__declarations
+                                                  __val__preprocessor)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("declarations", 2), ("preprocessor", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Trace_key where
+  rnf
+    (Trace_key __field__file __field__declarations
+       __field__preprocessor)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__declarations `Prelude.seq`
+          DeepSeq.rnf __field__preprocessor `Prelude.seq` ()
+
+instance Default.Default Trace_key where
+  def = Trace_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Trace_key where
+  hashWithSalt __salt (Trace_key _file _declarations _preprocessor)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _declarations)
+        _preprocessor
+
+data RefQualifier = RefQualifier_None_
+                  | RefQualifier_LValue
+                  | RefQualifier_RValue
+                  | RefQualifier__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefQualifier where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RefQualifier where
+  rnf __RefQualifier = Prelude.seq __RefQualifier ()
+
+instance Default.Default RefQualifier where
+  def = RefQualifier_None_
+
+instance Hashable.Hashable RefQualifier where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RefQualifier where
+  toThriftEnum 0 = RefQualifier_None_
+  toThriftEnum 1 = RefQualifier_LValue
+  toThriftEnum 2 = RefQualifier_RValue
+  toThriftEnum val = RefQualifier__UNKNOWN val
+  fromThriftEnum RefQualifier_None_ = 0
+  fromThriftEnum RefQualifier_LValue = 1
+  fromThriftEnum RefQualifier_RValue = 2
+  fromThriftEnum (RefQualifier__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RefQualifier_None_, RefQualifier_LValue, RefQualifier_RValue]
+  toThriftEnumEither 0 = Prelude.Right RefQualifier_None_
+  toThriftEnumEither 1 = Prelude.Right RefQualifier_LValue
+  toThriftEnumEither 2 = Prelude.Right RefQualifier_RValue
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RefQualifier: "
+           ++ Prelude.show val)
+
+data RecordUnionLowerCase_key = RecordUnionLowerCase_key{recordUnionLowerCase_key_name_lowercase
+                                                         :: Text.Text,
+                                                         recordUnionLowerCase_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordUnionLowerCase_key where
+  toJSON
+    (RecordUnionLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordUnionLowerCase_key where
+  buildStruct _proxy
+    (RecordUnionLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (RecordUnionLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordUnionLowerCase_key where
+  rnf
+    (RecordUnionLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default RecordUnionLowerCase_key where
+  def = RecordUnionLowerCase_key "" ""
+
+instance Hashable.Hashable RecordUnionLowerCase_key where
+  hashWithSalt __salt
+    (RecordUnionLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data RecordStructLowerCase_key = RecordStructLowerCase_key{recordStructLowerCase_key_name_lowercase
+                                                           :: Text.Text,
+                                                           recordStructLowerCase_key_name ::
+                                                           Text.Text}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordStructLowerCase_key where
+  toJSON
+    (RecordStructLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordStructLowerCase_key where
+  buildStruct _proxy
+    (RecordStructLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (RecordStructLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordStructLowerCase_key where
+  rnf
+    (RecordStructLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default RecordStructLowerCase_key where
+  def = RecordStructLowerCase_key "" ""
+
+instance Hashable.Hashable RecordStructLowerCase_key where
+  hashWithSalt __salt
+    (RecordStructLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data RecordKind = RecordKind_struct_ Glean.Schema.Builtin.Unit
+                | RecordKind_class_ Glean.Schema.Builtin.Unit
+                | RecordKind_union_ Glean.Schema.Builtin.Unit
+                | RecordKind_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordKind where
+  toJSON (RecordKind_struct_ __struct_)
+    = Aeson.object ["struct_" .= __struct_]
+  toJSON (RecordKind_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (RecordKind_union_ __union_)
+    = Aeson.object ["union_" .= __union_]
+  toJSON RecordKind_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct RecordKind where
+  buildStruct _proxy (RecordKind_struct_ __struct_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "struct_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __struct_)]
+  buildStruct _proxy (RecordKind_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (RecordKind_union_ __union_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "union_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __union_)]
+  buildStruct _proxy RecordKind_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RecordKind_struct_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RecordKind_class_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RecordKind_union_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return RecordKind_EMPTY
+           Thrift.FieldEnd -> Prelude.return RecordKind_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("struct_", 1), ("class_", 2), ("union_", 3)]
+
+instance DeepSeq.NFData RecordKind where
+  rnf (RecordKind_struct_ __struct_) = DeepSeq.rnf __struct_
+  rnf (RecordKind_class_ __class_) = DeepSeq.rnf __class_
+  rnf (RecordKind_union_ __union_) = DeepSeq.rnf __union_
+  rnf RecordKind_EMPTY = ()
+
+instance Default.Default RecordKind where
+  def = RecordKind_EMPTY
+
+instance Hashable.Hashable RecordKind where
+  hashWithSalt __salt (RecordKind_struct_ _struct_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _struct_)
+  hashWithSalt __salt (RecordKind_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _class_)
+  hashWithSalt __salt (RecordKind_union_ _union_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _union_)
+  hashWithSalt __salt RecordKind_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data RecordDerived_key = RecordDerived_key{recordDerived_key_base
+                                           :: RecordDeclaration,
+                                           recordDerived_key_derived :: RecordDeclaration}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDerived_key where
+  toJSON (RecordDerived_key __field__base __field__derived)
+    = Aeson.object
+        ("base" .= __field__base :
+           "derived" .= __field__derived : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDerived_key where
+  buildStruct _proxy
+    (RecordDerived_key __field__base __field__derived)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__derived)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             Prelude.pure
+                                               (RecordDerived_key __val__base __val__derived)
+              _idMap = HashMap.fromList [("base", 1), ("derived", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDerived_key where
+  rnf (RecordDerived_key __field__base __field__derived)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__derived `Prelude.seq` ()
+
+instance Default.Default RecordDerived_key where
+  def = RecordDerived_key Default.def Default.def
+
+instance Hashable.Hashable RecordDerived_key where
+  hashWithSalt __salt (RecordDerived_key _base _derived)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _derived
+
+data RecordDeclaration_key = RecordDeclaration_key{recordDeclaration_key_name
+                                                   :: QName,
+                                                   recordDeclaration_key_kind :: RecordKind,
+                                                   recordDeclaration_key_source ::
+                                                   Glean.Schema.Src.Range}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclaration_key where
+  toJSON
+    (RecordDeclaration_key __field__name __field__kind __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "kind" .= __field__kind :
+             "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclaration_key where
+  buildStruct _proxy
+    (RecordDeclaration_key __field__name __field__kind __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__kind)
+             :
+             Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__source)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (RecordDeclaration_key __val__name __val__kind
+                                                  __val__source)
+              _idMap = HashMap.fromList [("name", 1), ("kind", 2), ("source", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclaration_key where
+  rnf
+    (RecordDeclaration_key __field__name __field__kind __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default RecordDeclaration_key where
+  def = RecordDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable RecordDeclaration_key where
+  hashWithSalt __salt (RecordDeclaration_key _name _kind _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind)
+        _source
+
+data RecordClassLowerCase_key = RecordClassLowerCase_key{recordClassLowerCase_key_name_lowercase
+                                                         :: Text.Text,
+                                                         recordClassLowerCase_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordClassLowerCase_key where
+  toJSON
+    (RecordClassLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordClassLowerCase_key where
+  buildStruct _proxy
+    (RecordClassLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (RecordClassLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordClassLowerCase_key where
+  rnf
+    (RecordClassLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default RecordClassLowerCase_key where
+  def = RecordClassLowerCase_key "" ""
+
+instance Hashable.Hashable RecordClassLowerCase_key where
+  hashWithSalt __salt
+    (RecordClassLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data PpEntity = PpEntity_define Glean.Schema.Pp1.Define
+              | PpEntity_undef Glean.Schema.Pp1.Undef
+              | PpEntity_include_ Glean.Schema.Src.File
+              | PpEntity_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpEntity where
+  toJSON (PpEntity_define __define)
+    = Aeson.object ["define" .= __define]
+  toJSON (PpEntity_undef __undef) = Aeson.object ["undef" .= __undef]
+  toJSON (PpEntity_include_ __include_)
+    = Aeson.object ["include_" .= __include_]
+  toJSON PpEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct PpEntity where
+  buildStruct _proxy (PpEntity_define __define)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __define)]
+  buildStruct _proxy (PpEntity_undef __undef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "undef" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __undef)]
+  buildStruct _proxy (PpEntity_include_ __include_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "include_" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __include_)]
+  buildStruct _proxy PpEntity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PpEntity_define _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PpEntity_undef _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PpEntity_include_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return PpEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return PpEntity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("define", 1), ("undef", 2), ("include_", 3)]
+
+instance DeepSeq.NFData PpEntity where
+  rnf (PpEntity_define __define) = DeepSeq.rnf __define
+  rnf (PpEntity_undef __undef) = DeepSeq.rnf __undef
+  rnf (PpEntity_include_ __include_) = DeepSeq.rnf __include_
+  rnf PpEntity_EMPTY = ()
+
+instance Default.Default PpEntity where
+  def = PpEntity_EMPTY
+
+instance Hashable.Hashable PpEntity where
+  hashWithSalt __salt (PpEntity_define _define)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _define)
+  hashWithSalt __salt (PpEntity_undef _undef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _undef)
+  hashWithSalt __salt (PpEntity_include_ _include_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _include_)
+  hashWithSalt __salt PpEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Parameter = Parameter{parameter_name :: Name,
+                           parameter_type :: Type}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Parameter where
+  toJSON (Parameter __field__name __field__type)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct Parameter where
+  buildStruct _proxy (Parameter __field__name __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure (Parameter __val__name __val__type)
+              _idMap = HashMap.fromList [("name", 1), ("type", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Parameter where
+  rnf (Parameter __field__name __field__type)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default Parameter where
+  def = Parameter Default.def Default.def
+
+instance Hashable.Hashable Parameter where
+  hashWithSalt __salt (Parameter _name _type)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type
+
+data Signature_key = Signature_key{signature_key_returns :: Type,
+                                   signature_key_parameters :: [Parameter]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Signature_key where
+  toJSON (Signature_key __field__returns __field__parameters)
+    = Aeson.object
+        ("returns" .= __field__returns :
+           "parameters" .= __field__parameters : Prelude.mempty)
+
+instance Thrift.ThriftStruct Signature_key where
+  buildStruct _proxy
+    (Signature_key __field__returns __field__parameters)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "returns" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__returns)
+           :
+           Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__parameters)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__returns <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returns
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__returns <- ST.readSTRef
+                                                                  __field__returns
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             Prelude.pure
+                                               (Signature_key __val__returns __val__parameters)
+              _idMap = HashMap.fromList [("returns", 1), ("parameters", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Signature_key where
+  rnf (Signature_key __field__returns __field__parameters)
+    = DeepSeq.rnf __field__returns `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq` ()
+
+instance Default.Default Signature_key where
+  def = Signature_key Default.def Default.def
+
+instance Hashable.Hashable Signature_key where
+  hashWithSalt __salt (Signature_key _returns _parameters)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _returns)
+        _parameters
+
+data PPDefineLocation_key = PPDefineLocation_key{pPDefineLocation_key_define
+                                                 :: Glean.Schema.Pp1.Define,
+                                                 pPDefineLocation_key_name :: Text.Text,
+                                                 pPDefineLocation_key_file :: Glean.Schema.Src.File,
+                                                 pPDefineLocation_key_range ::
+                                                 Glean.Schema.Src.Range}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPDefineLocation_key where
+  toJSON
+    (PPDefineLocation_key __field__define __field__name __field__file
+       __field__range)
+    = Aeson.object
+        ("define" .= __field__define :
+           "name" .= __field__name :
+             "file" .= __field__file :
+               "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct PPDefineLocation_key where
+  buildStruct _proxy
+    (PPDefineLocation_key __field__define __field__name __field__file
+       __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__define)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__range)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__define <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__define
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__define <- ST.readSTRef
+                                                                 __field__define
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (PPDefineLocation_key __val__define __val__name
+                                                  __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList
+                    [("define", 1), ("name", 2), ("file", 3), ("range", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PPDefineLocation_key where
+  rnf
+    (PPDefineLocation_key __field__define __field__name __field__file
+       __field__range)
+    = DeepSeq.rnf __field__define `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default PPDefineLocation_key where
+  def = PPDefineLocation_key Default.def "" Default.def Default.def
+
+instance Hashable.Hashable PPDefineLocation_key where
+  hashWithSalt __salt
+    (PPDefineLocation_key _define _name _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _define)
+              _name)
+           _file)
+        _range
+
+type Operator = Text.Text
+
+data ObjcSelectorSlot = ObjcSelectorSlot{objcSelectorSlot_objcMethod
+                                         :: ObjcMethodDeclaration,
+                                         objcSelectorSlot_index :: Glean.Nat}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcSelectorSlot where
+  toJSON (ObjcSelectorSlot __field__objcMethod __field__index)
+    = Aeson.object
+        ("objcMethod" .= __field__objcMethod :
+           "index" .= Glean.unNat __field__index : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcSelectorSlot where
+  buildStruct _proxy
+    (ObjcSelectorSlot __field__objcMethod __field__index)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "objcMethod" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__objcMethod)
+           :
+           Thrift.genField _proxy "index" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__index)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__objcMethod <- ST.newSTRef Default.def
+            __field__index <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__objcMethod
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__index
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__objcMethod <- ST.readSTRef
+                                                                     __field__objcMethod
+                                             !__val__index <- ST.readSTRef __field__index
+                                             Prelude.pure
+                                               (ObjcSelectorSlot __val__objcMethod __val__index)
+              _idMap = HashMap.fromList [("objcMethod", 1), ("index", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcSelectorSlot where
+  rnf (ObjcSelectorSlot __field__objcMethod __field__index)
+    = DeepSeq.rnf __field__objcMethod `Prelude.seq`
+        DeepSeq.rnf __field__index `Prelude.seq` ()
+
+instance Default.Default ObjcSelectorSlot where
+  def = ObjcSelectorSlot Default.def (Glean.Nat Default.def)
+
+instance Hashable.Hashable ObjcSelectorSlot where
+  hashWithSalt __salt (ObjcSelectorSlot _objcMethod _index)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _objcMethod)
+        _index
+
+data ObjcPropertyKind = ObjcPropertyKind_Synthesize
+                      | ObjcPropertyKind_Dynamic
+                      | ObjcPropertyKind__UNKNOWN Prelude.Int
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData ObjcPropertyKind where
+  rnf __ObjcPropertyKind = Prelude.seq __ObjcPropertyKind ()
+
+instance Default.Default ObjcPropertyKind where
+  def = ObjcPropertyKind_Synthesize
+
+instance Hashable.Hashable ObjcPropertyKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum ObjcPropertyKind where
+  toThriftEnum 0 = ObjcPropertyKind_Synthesize
+  toThriftEnum 1 = ObjcPropertyKind_Dynamic
+  toThriftEnum val = ObjcPropertyKind__UNKNOWN val
+  fromThriftEnum ObjcPropertyKind_Synthesize = 0
+  fromThriftEnum ObjcPropertyKind_Dynamic = 1
+  fromThriftEnum (ObjcPropertyKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [ObjcPropertyKind_Synthesize, ObjcPropertyKind_Dynamic]
+  toThriftEnumEither 0 = Prelude.Right ObjcPropertyKind_Synthesize
+  toThriftEnumEither 1 = Prelude.Right ObjcPropertyKind_Dynamic
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum ObjcPropertyKind: "
+           ++ Prelude.show val)
+
+data ObjcPropertyImplementation_key = ObjcPropertyImplementation_key{objcPropertyImplementation_key_declaration
+                                                                     :: ObjcPropertyDeclaration,
+                                                                     objcPropertyImplementation_key_kind
+                                                                     :: ObjcPropertyKind,
+                                                                     objcPropertyImplementation_key_ivar
+                                                                     :: Prelude.Maybe Name,
+                                                                     objcPropertyImplementation_key_source
+                                                                     :: Glean.Schema.Src.Range}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyImplementation_key where
+  toJSON
+    (ObjcPropertyImplementation_key __field__declaration __field__kind
+       __field__ivar __field__source)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "kind" .= __field__kind :
+             Prelude.maybe Prelude.id ((:) . ("ivar" .=)) __field__ivar
+               ("source" .= __field__source : Prelude.mempty))
+
+instance Thrift.ThriftStruct ObjcPropertyImplementation_key where
+  buildStruct _proxy
+    (ObjcPropertyImplementation_key __field__declaration __field__kind
+       __field__ivar __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             :
+             let (__cereal__ivar, __id__ivar)
+                   = case __field__ivar of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "ivar"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__ivar
+                 (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4
+                    __id__ivar
+                    (Thrift.buildStruct _proxy __field__source)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__ivar <- ST.newSTRef Prelude.Nothing
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ObjcPropertyKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ivar
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__ivar <- ST.readSTRef __field__ivar
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (ObjcPropertyImplementation_key __val__declaration
+                                                  __val__kind
+                                                  __val__ivar
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("kind", 2), ("ivar", 3), ("source", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyImplementation_key where
+  rnf
+    (ObjcPropertyImplementation_key __field__declaration __field__kind
+       __field__ivar __field__source)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__ivar `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyImplementation_key where
+  def
+    = ObjcPropertyImplementation_key Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable ObjcPropertyImplementation_key where
+  hashWithSalt __salt
+    (ObjcPropertyImplementation_key _declaration _kind _ivar _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+              _kind)
+           _ivar)
+        _source
+
+data ObjcPropertyIVar_key = ObjcPropertyIVar_key{objcPropertyIVar_key_property
+                                                 :: ObjcPropertyDeclaration,
+                                                 objcPropertyIVar_key_ivar :: VariableDeclaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyIVar_key where
+  toJSON (ObjcPropertyIVar_key __field__property __field__ivar)
+    = Aeson.object
+        ("property" .= __field__property :
+           "ivar" .= __field__ivar : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcPropertyIVar_key where
+  buildStruct _proxy
+    (ObjcPropertyIVar_key __field__property __field__ivar)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "property" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__property)
+           :
+           Thrift.genField _proxy "ivar" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ivar)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__property <- ST.newSTRef Default.def
+            __field__ivar <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__property
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ivar
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__property <- ST.readSTRef
+                                                                   __field__property
+                                             !__val__ivar <- ST.readSTRef __field__ivar
+                                             Prelude.pure
+                                               (ObjcPropertyIVar_key __val__property __val__ivar)
+              _idMap = HashMap.fromList [("property", 1), ("ivar", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyIVar_key where
+  rnf (ObjcPropertyIVar_key __field__property __field__ivar)
+    = DeepSeq.rnf __field__property `Prelude.seq`
+        DeepSeq.rnf __field__ivar `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyIVar_key where
+  def = ObjcPropertyIVar_key Default.def Default.def
+
+instance Hashable.Hashable ObjcPropertyIVar_key where
+  hashWithSalt __salt (ObjcPropertyIVar_key _property _ivar)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _property)
+        _ivar
+
+data ObjcMethodDeclarationName_key = ObjcMethodDeclarationName_key{objcMethodDeclarationName_key_decl
+                                                                   :: ObjcMethodDeclaration,
+                                                                   objcMethodDeclarationName_key_name
+                                                                   :: Name}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodDeclarationName_key where
+  toJSON (ObjcMethodDeclarationName_key __field__decl __field__name)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcMethodDeclarationName_key where
+  buildStruct _proxy
+    (ObjcMethodDeclarationName_key __field__decl __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ObjcMethodDeclarationName_key __val__decl
+                                                  __val__name)
+              _idMap = HashMap.fromList [("decl", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcMethodDeclarationName_key where
+  rnf (ObjcMethodDeclarationName_key __field__decl __field__name)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ObjcMethodDeclarationName_key where
+  def = ObjcMethodDeclarationName_key Default.def Default.def
+
+instance Hashable.Hashable ObjcMethodDeclarationName_key where
+  hashWithSalt __salt (ObjcMethodDeclarationName_key _decl _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _name
+
+data ObjcInterfaceToImplementation_key = ObjcInterfaceToImplementation_key{objcInterfaceToImplementation_key_interface_
+                                                                           ::
+                                                                           ObjcContainerDeclaration,
+                                                                           objcInterfaceToImplementation_key_implementation
+                                                                           ::
+                                                                           ObjcContainerDeclaration}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcInterfaceToImplementation_key where
+  toJSON
+    (ObjcInterfaceToImplementation_key __field__interface_
+       __field__implementation)
+    = Aeson.object
+        ("interface_" .= __field__interface_ :
+           "implementation" .= __field__implementation : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcInterfaceToImplementation_key
+         where
+  buildStruct _proxy
+    (ObjcInterfaceToImplementation_key __field__interface_
+       __field__implementation)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__interface_)
+           :
+           Thrift.genField _proxy "implementation"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__implementation)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__interface_ <- ST.newSTRef Default.def
+            __field__implementation <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__interface_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__implementation
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__interface_ <- ST.readSTRef
+                                                                     __field__interface_
+                                             !__val__implementation <- ST.readSTRef
+                                                                         __field__implementation
+                                             Prelude.pure
+                                               (ObjcInterfaceToImplementation_key __val__interface_
+                                                  __val__implementation)
+              _idMap
+                = HashMap.fromList [("interface_", 1), ("implementation", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcInterfaceToImplementation_key where
+  rnf
+    (ObjcInterfaceToImplementation_key __field__interface_
+       __field__implementation)
+    = DeepSeq.rnf __field__interface_ `Prelude.seq`
+        DeepSeq.rnf __field__implementation `Prelude.seq` ()
+
+instance Default.Default ObjcInterfaceToImplementation_key where
+  def = ObjcInterfaceToImplementation_key Default.def Default.def
+
+instance Hashable.Hashable ObjcInterfaceToImplementation_key where
+  hashWithSalt __salt
+    (ObjcInterfaceToImplementation_key _interface_ _implementation)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _interface_)
+        _implementation
+
+data ObjcImplements_key = ObjcImplements_key{objcImplements_key_implementation
+                                             :: ObjcContainerDeclaration,
+                                             objcImplements_key_interface_ ::
+                                             ObjcContainerDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcImplements_key where
+  toJSON
+    (ObjcImplements_key __field__implementation __field__interface_)
+    = Aeson.object
+        ("implementation" .= __field__implementation :
+           "interface_" .= __field__interface_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcImplements_key where
+  buildStruct _proxy
+    (ObjcImplements_key __field__implementation __field__interface_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "implementation"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__implementation)
+           :
+           Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__interface_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__implementation <- ST.newSTRef Default.def
+            __field__interface_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__implementation
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__interface_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__implementation <- ST.readSTRef
+                                                                         __field__implementation
+                                             !__val__interface_ <- ST.readSTRef __field__interface_
+                                             Prelude.pure
+                                               (ObjcImplements_key __val__implementation
+                                                  __val__interface_)
+              _idMap
+                = HashMap.fromList [("implementation", 1), ("interface_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcImplements_key where
+  rnf
+    (ObjcImplements_key __field__implementation __field__interface_)
+    = DeepSeq.rnf __field__implementation `Prelude.seq`
+        DeepSeq.rnf __field__interface_ `Prelude.seq` ()
+
+instance Default.Default ObjcImplements_key where
+  def = ObjcImplements_key Default.def Default.def
+
+instance Hashable.Hashable ObjcImplements_key where
+  hashWithSalt __salt
+    (ObjcImplements_key _implementation _interface_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _implementation)
+        _interface_
+
+data ObjcIVar = ObjcIVar{objcIVar_synthesize :: Prelude.Bool,
+                         objcIVar_bitsize :: Prelude.Maybe Glean.Nat}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcIVar where
+  toJSON (ObjcIVar __field__synthesize __field__bitsize)
+    = Aeson.object
+        ("synthesize" .= __field__synthesize :
+           Prelude.maybe Prelude.id ((:) . ("bitsize" .=))
+             (Prelude.fmap Glean.unNat __field__bitsize)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcIVar where
+  buildStruct _proxy (ObjcIVar __field__synthesize __field__bitsize)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "synthesize" 1 0 __field__synthesize :
+           case __field__bitsize of
+             Prelude.Just _val -> Thrift.genField _proxy "bitsize"
+                                    (Thrift.getI64Type _proxy)
+                                    2
+                                    1
+                                    ((Thrift.genI64 _proxy . Glean.unNat) _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__synthesize <- ST.newSTRef Prelude.False
+            __field__bitsize <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__synthesize
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__bitsize
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__synthesize <- ST.readSTRef
+                                                                     __field__synthesize
+                                             !__val__bitsize <- ST.readSTRef __field__bitsize
+                                             Prelude.pure
+                                               (ObjcIVar __val__synthesize __val__bitsize)
+              _idMap = HashMap.fromList [("synthesize", 1), ("bitsize", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcIVar where
+  rnf (ObjcIVar __field__synthesize __field__bitsize)
+    = DeepSeq.rnf __field__synthesize `Prelude.seq`
+        DeepSeq.rnf __field__bitsize `Prelude.seq` ()
+
+instance Default.Default ObjcIVar where
+  def = ObjcIVar Prelude.False Prelude.Nothing
+
+instance Hashable.Hashable ObjcIVar where
+  hashWithSalt __salt (ObjcIVar _synthesize _bitsize)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _synthesize)
+        _bitsize
+
+data ObjcContainerInterfaceLowerCase_key = ObjcContainerInterfaceLowerCase_key{objcContainerInterfaceLowerCase_key_name_lowercase
+                                                                               :: Text.Text,
+                                                                               objcContainerInterfaceLowerCase_key_name
+                                                                               :: Text.Text}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerInterfaceLowerCase_key where
+  toJSON
+    (ObjcContainerInterfaceLowerCase_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerInterfaceLowerCase_key
+         where
+  buildStruct _proxy
+    (ObjcContainerInterfaceLowerCase_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ObjcContainerInterfaceLowerCase_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerInterfaceLowerCase_key where
+  rnf
+    (ObjcContainerInterfaceLowerCase_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ObjcContainerInterfaceLowerCase_key where
+  def = ObjcContainerInterfaceLowerCase_key "" ""
+
+instance Hashable.Hashable ObjcContainerInterfaceLowerCase_key
+         where
+  hashWithSalt __salt
+    (ObjcContainerInterfaceLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data ObjcContainerInheritance_key = ObjcContainerInheritance_key{objcContainerInheritance_key_base
+                                                                 :: ObjcContainerDeclaration,
+                                                                 objcContainerInheritance_key_declaration
+                                                                 :: ObjcContainerDeclaration}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerInheritance_key where
+  toJSON
+    (ObjcContainerInheritance_key __field__base __field__declaration)
+    = Aeson.object
+        ("base" .= __field__base :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerInheritance_key where
+  buildStruct _proxy
+    (ObjcContainerInheritance_key __field__base __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (ObjcContainerInheritance_key __val__base
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("base", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerInheritance_key where
+  rnf
+    (ObjcContainerInheritance_key __field__base __field__declaration)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default ObjcContainerInheritance_key where
+  def = ObjcContainerInheritance_key Default.def Default.def
+
+instance Hashable.Hashable ObjcContainerInheritance_key where
+  hashWithSalt __salt
+    (ObjcContainerInheritance_key _base _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _declaration
+
+data ObjcContainerDefinition_key = ObjcContainerDefinition_key{objcContainerDefinition_key_declaration
+                                                               :: ObjcContainerDeclaration,
+                                                               objcContainerDefinition_key_protocols
+                                                               :: [ObjcContainerDeclaration],
+                                                               objcContainerDefinition_key_members
+                                                               :: Declarations}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDefinition_key where
+  toJSON
+    (ObjcContainerDefinition_key __field__declaration
+       __field__protocols __field__members)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "protocols" .= __field__protocols :
+             "members" .= __field__members : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDefinition_key where
+  buildStruct _proxy
+    (ObjcContainerDefinition_key __field__declaration
+       __field__protocols __field__members)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "protocols" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__protocols)
+             :
+             Thrift.genField _proxy "members" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__members)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__protocols <- ST.newSTRef Default.def
+            __field__members <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__protocols
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__protocols <- ST.readSTRef __field__protocols
+                                             !__val__members <- ST.readSTRef __field__members
+                                             Prelude.pure
+                                               (ObjcContainerDefinition_key __val__declaration
+                                                  __val__protocols
+                                                  __val__members)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("protocols", 2), ("members", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDefinition_key where
+  rnf
+    (ObjcContainerDefinition_key __field__declaration
+       __field__protocols __field__members)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__protocols `Prelude.seq`
+          DeepSeq.rnf __field__members `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDefinition_key where
+  def
+    = ObjcContainerDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ObjcContainerDefinition_key where
+  hashWithSalt __salt
+    (ObjcContainerDefinition_key _declaration _protocols _members)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _protocols)
+        _members
+
+data ObjcContainerDeclarationInterface_key = ObjcContainerDeclarationInterface_key{objcContainerDeclarationInterface_key_name
+                                                                                   :: Text.Text,
+                                                                                   objcContainerDeclarationInterface_key_decl
+                                                                                   ::
+                                                                                   ObjcContainerDeclaration}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDeclarationInterface_key where
+  toJSON
+    (ObjcContainerDeclarationInterface_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDeclarationInterface_key
+         where
+  buildStruct _proxy
+    (ObjcContainerDeclarationInterface_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (ObjcContainerDeclarationInterface_key __val__name
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDeclarationInterface_key where
+  rnf
+    (ObjcContainerDeclarationInterface_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDeclarationInterface_key
+         where
+  def = ObjcContainerDeclarationInterface_key "" Default.def
+
+instance Hashable.Hashable ObjcContainerDeclarationInterface_key
+         where
+  hashWithSalt __salt
+    (ObjcContainerDeclarationInterface_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data ObjcContainerBase_key = ObjcContainerBase_key{objcContainerBase_key_declaration
+                                                   :: ObjcContainerDeclaration,
+                                                   objcContainerBase_key_base ::
+                                                   ObjcContainerDeclaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerBase_key where
+  toJSON (ObjcContainerBase_key __field__declaration __field__base)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "base" .= __field__base : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerBase_key where
+  buildStruct _proxy
+    (ObjcContainerBase_key __field__declaration __field__base)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__base <- ST.readSTRef __field__base
+                                             Prelude.pure
+                                               (ObjcContainerBase_key __val__declaration
+                                                  __val__base)
+              _idMap = HashMap.fromList [("declaration", 1), ("base", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerBase_key where
+  rnf (ObjcContainerBase_key __field__declaration __field__base)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq` ()
+
+instance Default.Default ObjcContainerBase_key where
+  def = ObjcContainerBase_key Default.def Default.def
+
+instance Hashable.Hashable ObjcContainerBase_key where
+  hashWithSalt __salt (ObjcContainerBase_key _declaration _base)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _base
+
+data ObjcCategoryId = ObjcCategoryId{objcCategoryId_className ::
+                                     Name,
+                                     objcCategoryId_categoryName :: Name}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcCategoryId where
+  toJSON (ObjcCategoryId __field__className __field__categoryName)
+    = Aeson.object
+        ("className" .= __field__className :
+           "categoryName" .= __field__categoryName : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcCategoryId where
+  buildStruct _proxy
+    (ObjcCategoryId __field__className __field__categoryName)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "className" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__className)
+           :
+           Thrift.genField _proxy "categoryName" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__categoryName)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__className <- ST.newSTRef Default.def
+            __field__categoryName <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__className
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__categoryName
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__className <- ST.readSTRef
+                                                                    __field__className
+                                             !__val__categoryName <- ST.readSTRef
+                                                                       __field__categoryName
+                                             Prelude.pure
+                                               (ObjcCategoryId __val__className __val__categoryName)
+              _idMap = HashMap.fromList [("className", 1), ("categoryName", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcCategoryId where
+  rnf (ObjcCategoryId __field__className __field__categoryName)
+    = DeepSeq.rnf __field__className `Prelude.seq`
+        DeepSeq.rnf __field__categoryName `Prelude.seq` ()
+
+instance Default.Default ObjcCategoryId where
+  def = ObjcCategoryId Default.def Default.def
+
+instance Hashable.Hashable ObjcCategoryId where
+  hashWithSalt __salt (ObjcCategoryId _className _categoryName)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _className)
+        _categoryName
+
+data ObjcContainerId = ObjcContainerId_protocol Name
+                     | ObjcContainerId_interface_ Name
+                     | ObjcContainerId_categoryInterface ObjcCategoryId
+                     | ObjcContainerId_extensionInterface Name
+                     | ObjcContainerId_implementation Name
+                     | ObjcContainerId_categoryImplementation ObjcCategoryId
+                     | ObjcContainerId_EMPTY
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerId where
+  toJSON (ObjcContainerId_protocol __protocol)
+    = Aeson.object ["protocol" .= __protocol]
+  toJSON (ObjcContainerId_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (ObjcContainerId_categoryInterface __categoryInterface)
+    = Aeson.object ["categoryInterface" .= __categoryInterface]
+  toJSON (ObjcContainerId_extensionInterface __extensionInterface)
+    = Aeson.object ["extensionInterface" .= __extensionInterface]
+  toJSON (ObjcContainerId_implementation __implementation)
+    = Aeson.object ["implementation" .= __implementation]
+  toJSON
+    (ObjcContainerId_categoryImplementation __categoryImplementation)
+    = Aeson.object
+        ["categoryImplementation" .= __categoryImplementation]
+  toJSON ObjcContainerId_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ObjcContainerId where
+  buildStruct _proxy (ObjcContainerId_protocol __protocol)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "protocol" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __protocol)]
+  buildStruct _proxy (ObjcContainerId_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy
+    (ObjcContainerId_categoryInterface __categoryInterface)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "categoryInterface"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __categoryInterface)]
+  buildStruct _proxy
+    (ObjcContainerId_extensionInterface __extensionInterface)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "extensionInterface"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __extensionInterface)]
+  buildStruct _proxy
+    (ObjcContainerId_implementation __implementation)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "implementation"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __implementation)]
+  buildStruct _proxy
+    (ObjcContainerId_categoryImplementation __categoryImplementation)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "categoryImplementation"
+           (Thrift.getStructType _proxy)
+           6
+           0
+           (Thrift.buildStruct _proxy __categoryImplementation)]
+  buildStruct _proxy ObjcContainerId_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_protocol _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_interface_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_categoryInterface
+                                                                 _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_extensionInterface
+                                                                 _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_implementation _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ObjcContainerId_categoryImplementation
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ObjcContainerId_EMPTY
+           Thrift.FieldEnd -> Prelude.return ObjcContainerId_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("protocol", 1), ("interface_", 2), ("categoryInterface", 3),
+             ("extensionInterface", 4), ("implementation", 5),
+             ("categoryImplementation", 6)]
+
+instance DeepSeq.NFData ObjcContainerId where
+  rnf (ObjcContainerId_protocol __protocol) = DeepSeq.rnf __protocol
+  rnf (ObjcContainerId_interface_ __interface_)
+    = DeepSeq.rnf __interface_
+  rnf (ObjcContainerId_categoryInterface __categoryInterface)
+    = DeepSeq.rnf __categoryInterface
+  rnf (ObjcContainerId_extensionInterface __extensionInterface)
+    = DeepSeq.rnf __extensionInterface
+  rnf (ObjcContainerId_implementation __implementation)
+    = DeepSeq.rnf __implementation
+  rnf
+    (ObjcContainerId_categoryImplementation __categoryImplementation)
+    = DeepSeq.rnf __categoryImplementation
+  rnf ObjcContainerId_EMPTY = ()
+
+instance Default.Default ObjcContainerId where
+  def = ObjcContainerId_EMPTY
+
+instance Hashable.Hashable ObjcContainerId where
+  hashWithSalt __salt (ObjcContainerId_protocol _protocol)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _protocol)
+  hashWithSalt __salt (ObjcContainerId_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _interface_)
+  hashWithSalt __salt
+    (ObjcContainerId_categoryInterface _categoryInterface)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _categoryInterface)
+  hashWithSalt __salt
+    (ObjcContainerId_extensionInterface _extensionInterface)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _extensionInterface)
+  hashWithSalt __salt
+    (ObjcContainerId_implementation _implementation)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _implementation)
+  hashWithSalt __salt
+    (ObjcContainerId_categoryImplementation _categoryImplementation)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _categoryImplementation)
+  hashWithSalt __salt ObjcContainerId_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ObjcContainerDeclaration_key = ObjcContainerDeclaration_key{objcContainerDeclaration_key_id
+                                                                 :: ObjcContainerId,
+                                                                 objcContainerDeclaration_key_source
+                                                                 :: Glean.Schema.Src.Range}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcContainerDeclaration_key where
+  toJSON (ObjcContainerDeclaration_key __field__id __field__source)
+    = Aeson.object
+        ("id" .= __field__id :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcContainerDeclaration_key where
+  buildStruct _proxy
+    (ObjcContainerDeclaration_key __field__id __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__id)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (ObjcContainerDeclaration_key __val__id
+                                                  __val__source)
+              _idMap = HashMap.fromList [("id", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcContainerDeclaration_key where
+  rnf (ObjcContainerDeclaration_key __field__id __field__source)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default ObjcContainerDeclaration_key where
+  def = ObjcContainerDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ObjcContainerDeclaration_key where
+  hashWithSalt __salt (ObjcContainerDeclaration_key _id _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _source
+
+data ObjcMethodDeclaration_key = ObjcMethodDeclaration_key{objcMethodDeclaration_key_selector
+                                                           :: ObjcSelector,
+                                                           objcMethodDeclaration_key_locations ::
+                                                           [Glean.Schema.Src.FileLocation],
+                                                           objcMethodDeclaration_key_container ::
+                                                           ObjcContainerId,
+                                                           objcMethodDeclaration_key_signature ::
+                                                           Signature,
+                                                           objcMethodDeclaration_key_isInstance ::
+                                                           Prelude.Bool,
+                                                           objcMethodDeclaration_key_isOptional ::
+                                                           Prelude.Bool,
+                                                           objcMethodDeclaration_key_isAccessor ::
+                                                           Prelude.Bool,
+                                                           objcMethodDeclaration_key_source ::
+                                                           Glean.Schema.Src.Range}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcMethodDeclaration_key where
+  toJSON
+    (ObjcMethodDeclaration_key __field__selector __field__locations
+       __field__container __field__signature __field__isInstance
+       __field__isOptional __field__isAccessor __field__source)
+    = Aeson.object
+        ("selector" .= __field__selector :
+           "locations" .= __field__locations :
+             "container" .= __field__container :
+               "signature" .= __field__signature :
+                 "isInstance" .= __field__isInstance :
+                   "isOptional" .= __field__isOptional :
+                     "isAccessor" .= __field__isAccessor :
+                       "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcMethodDeclaration_key where
+  buildStruct _proxy
+    (ObjcMethodDeclaration_key __field__selector __field__locations
+       __field__container __field__signature __field__isInstance
+       __field__isOptional __field__isAccessor __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "selector" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__selector)
+           :
+           Thrift.genField _proxy "locations" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__locations)
+             :
+             Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__container)
+               :
+               Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 4
+                 3
+                 (Thrift.buildStruct _proxy __field__signature)
+                 :
+                 Thrift.genFieldBool _proxy "isInstance" 5 4 __field__isInstance :
+                   Thrift.genFieldBool _proxy "isOptional" 6 5 __field__isOptional :
+                     Thrift.genFieldBool _proxy "isAccessor" 7 6 __field__isAccessor :
+                       Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 8 7
+                         (Thrift.buildStruct _proxy __field__source)
+                         : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__selector <- ST.newSTRef Default.def
+            __field__locations <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__isInstance <- ST.newSTRef Prelude.False
+            __field__isOptional <- ST.newSTRef Prelude.False
+            __field__isAccessor <- ST.newSTRef Prelude.False
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__selector
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__locations
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isInstance
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isOptional
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAccessor
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__selector <- ST.readSTRef
+                                                                   __field__selector
+                                             !__val__locations <- ST.readSTRef __field__locations
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__isInstance <- ST.readSTRef __field__isInstance
+                                             !__val__isOptional <- ST.readSTRef __field__isOptional
+                                             !__val__isAccessor <- ST.readSTRef __field__isAccessor
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (ObjcMethodDeclaration_key __val__selector
+                                                  __val__locations
+                                                  __val__container
+                                                  __val__signature
+                                                  __val__isInstance
+                                                  __val__isOptional
+                                                  __val__isAccessor
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("selector", 1), ("locations", 2), ("container", 3),
+                     ("signature", 4), ("isInstance", 5), ("isOptional", 6),
+                     ("isAccessor", 7), ("source", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcMethodDeclaration_key where
+  rnf
+    (ObjcMethodDeclaration_key __field__selector __field__locations
+       __field__container __field__signature __field__isInstance
+       __field__isOptional __field__isAccessor __field__source)
+    = DeepSeq.rnf __field__selector `Prelude.seq`
+        DeepSeq.rnf __field__locations `Prelude.seq`
+          DeepSeq.rnf __field__container `Prelude.seq`
+            DeepSeq.rnf __field__signature `Prelude.seq`
+              DeepSeq.rnf __field__isInstance `Prelude.seq`
+                DeepSeq.rnf __field__isOptional `Prelude.seq`
+                  DeepSeq.rnf __field__isAccessor `Prelude.seq`
+                    DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default ObjcMethodDeclaration_key where
+  def
+    = ObjcMethodDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Default.def
+
+instance Hashable.Hashable ObjcMethodDeclaration_key where
+  hashWithSalt __salt
+    (ObjcMethodDeclaration_key _selector _locations _container
+       _signature _isInstance _isOptional _isAccessor _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _selector)
+                          _locations)
+                       _container)
+                    _signature)
+                 _isInstance)
+              _isOptional)
+           _isAccessor)
+        _source
+
+data ObjcPropertyDeclaration_key = ObjcPropertyDeclaration_key{objcPropertyDeclaration_key_name
+                                                               :: Name,
+                                                               objcPropertyDeclaration_key_container
+                                                               :: ObjcContainerId,
+                                                               objcPropertyDeclaration_key_type ::
+                                                               Type,
+                                                               objcPropertyDeclaration_key_isInstance
+                                                               :: Prelude.Bool,
+                                                               objcPropertyDeclaration_key_isOptional
+                                                               :: Prelude.Bool,
+                                                               objcPropertyDeclaration_key_isReadOnly
+                                                               :: Prelude.Bool,
+                                                               objcPropertyDeclaration_key_isAtomic
+                                                               :: Prelude.Bool,
+                                                               objcPropertyDeclaration_key_source ::
+                                                               Glean.Schema.Src.Range}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjcPropertyDeclaration_key where
+  toJSON
+    (ObjcPropertyDeclaration_key __field__name __field__container
+       __field__type __field__isInstance __field__isOptional
+       __field__isReadOnly __field__isAtomic __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "container" .= __field__container :
+             "type" .= __field__type :
+               "isInstance" .= __field__isInstance :
+                 "isOptional" .= __field__isOptional :
+                   "isReadOnly" .= __field__isReadOnly :
+                     "isAtomic" .= __field__isAtomic :
+                       "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjcPropertyDeclaration_key where
+  buildStruct _proxy
+    (ObjcPropertyDeclaration_key __field__name __field__container
+       __field__type __field__isInstance __field__isOptional
+       __field__isReadOnly __field__isAtomic __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             :
+             Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__type)
+               :
+               Thrift.genFieldBool _proxy "isInstance" 4 3 __field__isInstance :
+                 Thrift.genFieldBool _proxy "isOptional" 5 4 __field__isOptional :
+                   Thrift.genFieldBool _proxy "isReadOnly" 6 5 __field__isReadOnly :
+                     Thrift.genFieldBool _proxy "isAtomic" 7 6 __field__isAtomic :
+                       Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 8 7
+                         (Thrift.buildStruct _proxy __field__source)
+                         : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__isInstance <- ST.newSTRef Prelude.False
+            __field__isOptional <- ST.newSTRef Prelude.False
+            __field__isReadOnly <- ST.newSTRef Prelude.False
+            __field__isAtomic <- ST.newSTRef Prelude.False
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isInstance
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isOptional
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isReadOnly
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAtomic
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__isInstance <- ST.readSTRef __field__isInstance
+                                             !__val__isOptional <- ST.readSTRef __field__isOptional
+                                             !__val__isReadOnly <- ST.readSTRef __field__isReadOnly
+                                             !__val__isAtomic <- ST.readSTRef __field__isAtomic
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (ObjcPropertyDeclaration_key __val__name
+                                                  __val__container
+                                                  __val__type
+                                                  __val__isInstance
+                                                  __val__isOptional
+                                                  __val__isReadOnly
+                                                  __val__isAtomic
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("container", 2), ("type", 3), ("isInstance", 4),
+                     ("isOptional", 5), ("isReadOnly", 6), ("isAtomic", 7),
+                     ("source", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjcPropertyDeclaration_key where
+  rnf
+    (ObjcPropertyDeclaration_key __field__name __field__container
+       __field__type __field__isInstance __field__isOptional
+       __field__isReadOnly __field__isAtomic __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq`
+          DeepSeq.rnf __field__type `Prelude.seq`
+            DeepSeq.rnf __field__isInstance `Prelude.seq`
+              DeepSeq.rnf __field__isOptional `Prelude.seq`
+                DeepSeq.rnf __field__isReadOnly `Prelude.seq`
+                  DeepSeq.rnf __field__isAtomic `Prelude.seq`
+                    DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default ObjcPropertyDeclaration_key where
+  def
+    = ObjcPropertyDeclaration_key Default.def Default.def Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Default.def
+
+instance Hashable.Hashable ObjcPropertyDeclaration_key where
+  hashWithSalt __salt
+    (ObjcPropertyDeclaration_key _name _container _type _isInstance
+       _isOptional _isReadOnly _isAtomic _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                          _container)
+                       _type)
+                    _isInstance)
+                 _isOptional)
+              _isReadOnly)
+           _isAtomic)
+        _source
+
+data ObjContainerIdName_key = ObjContainerIdName_key{objContainerIdName_key_id
+                                                     :: ObjcContainerId,
+                                                     objContainerIdName_key_name :: Name}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjContainerIdName_key where
+  toJSON (ObjContainerIdName_key __field__id __field__name)
+    = Aeson.object
+        ("id" .= __field__id : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjContainerIdName_key where
+  buildStruct _proxy
+    (ObjContainerIdName_key __field__id __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__id)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ObjContainerIdName_key __val__id __val__name)
+              _idMap = HashMap.fromList [("id", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjContainerIdName_key where
+  rnf (ObjContainerIdName_key __field__id __field__name)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ObjContainerIdName_key where
+  def = ObjContainerIdName_key Default.def Default.def
+
+instance Hashable.Hashable ObjContainerIdName_key where
+  hashWithSalt __salt (ObjContainerIdName_key _id _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _name
+
+data NamespaceTarget = NamespaceTarget_namespace_ NamespaceDeclaration
+                     | NamespaceTarget_namespaceAlias NamespaceAliasDeclaration
+                     | NamespaceTarget_EMPTY
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceTarget where
+  toJSON (NamespaceTarget_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON (NamespaceTarget_namespaceAlias __namespaceAlias)
+    = Aeson.object ["namespaceAlias" .= __namespaceAlias]
+  toJSON NamespaceTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct NamespaceTarget where
+  buildStruct _proxy (NamespaceTarget_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy
+    (NamespaceTarget_namespaceAlias __namespaceAlias)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespaceAlias"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __namespaceAlias)]
+  buildStruct _proxy NamespaceTarget_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (NamespaceTarget_namespace_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (NamespaceTarget_namespaceAlias _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return NamespaceTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return NamespaceTarget_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("namespace_", 1), ("namespaceAlias", 2)]
+
+instance DeepSeq.NFData NamespaceTarget where
+  rnf (NamespaceTarget_namespace_ __namespace_)
+    = DeepSeq.rnf __namespace_
+  rnf (NamespaceTarget_namespaceAlias __namespaceAlias)
+    = DeepSeq.rnf __namespaceAlias
+  rnf NamespaceTarget_EMPTY = ()
+
+instance Default.Default NamespaceTarget where
+  def = NamespaceTarget_EMPTY
+
+instance Hashable.Hashable NamespaceTarget where
+  hashWithSalt __salt (NamespaceTarget_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _namespace_)
+  hashWithSalt __salt
+    (NamespaceTarget_namespaceAlias _namespaceAlias)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _namespaceAlias)
+  hashWithSalt __salt NamespaceTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data NamespaceQName_key = NamespaceQName_key{namespaceQName_key_name
+                                             :: Prelude.Maybe Name,
+                                             namespaceQName_key_parent ::
+                                             Prelude.Maybe NamespaceQName}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceQName_key where
+  toJSON (NamespaceQName_key __field__name __field__parent)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("name" .=)) __field__name
+           (Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+              Prelude.mempty))
+
+instance Thrift.ThriftStruct NamespaceQName_key where
+  buildStruct _proxy
+    (NamespaceQName_key __field__name __field__parent)
+    = Thrift.genStruct _proxy
+        (let (__cereal__name, __id__name)
+               = case __field__name of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "name"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__name
+             (case __field__parent of
+                Prelude.Just _val -> Thrift.genField _proxy "parent"
+                                       (Thrift.getStructType _proxy)
+                                       2
+                                       __id__name
+                                       (Thrift.buildStruct _proxy _val)
+                                       : []
+                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Prelude.Nothing
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (NamespaceQName_key __val__name __val__parent)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceQName_key where
+  rnf (NamespaceQName_key __field__name __field__parent)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default NamespaceQName_key where
+  def = NamespaceQName_key Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable NamespaceQName_key where
+  hashWithSalt __salt (NamespaceQName_key _name _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _parent
+
+data NamespaceLowerCase_key = NamespaceLowerCase_key{namespaceLowerCase_key_name_lowercase
+                                                     :: Text.Text,
+                                                     namespaceLowerCase_key_name :: Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceLowerCase_key where
+  toJSON
+    (NamespaceLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceLowerCase_key where
+  buildStruct _proxy
+    (NamespaceLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NamespaceLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceLowerCase_key where
+  rnf (NamespaceLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NamespaceLowerCase_key where
+  def = NamespaceLowerCase_key "" ""
+
+instance Hashable.Hashable NamespaceLowerCase_key where
+  hashWithSalt __salt (NamespaceLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data NamespaceDefinition_key = NamespaceDefinition_key{namespaceDefinition_key_declaration
+                                                       :: NamespaceDeclaration,
+                                                       namespaceDefinition_key_members ::
+                                                       Declarations}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDefinition_key where
+  toJSON
+    (NamespaceDefinition_key __field__declaration __field__members)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "members" .= __field__members : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDefinition_key where
+  buildStruct _proxy
+    (NamespaceDefinition_key __field__declaration __field__members)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "members" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__members)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__members <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__members <- ST.readSTRef __field__members
+                                             Prelude.pure
+                                               (NamespaceDefinition_key __val__declaration
+                                                  __val__members)
+              _idMap = HashMap.fromList [("declaration", 1), ("members", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDefinition_key where
+  rnf (NamespaceDefinition_key __field__declaration __field__members)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__members `Prelude.seq` ()
+
+instance Default.Default NamespaceDefinition_key where
+  def = NamespaceDefinition_key Default.def Default.def
+
+instance Hashable.Hashable NamespaceDefinition_key where
+  hashWithSalt __salt (NamespaceDefinition_key _declaration _members)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _members
+
+data NamespaceDeclarationName_key = NamespaceDeclarationName_key{namespaceDeclarationName_key_qname
+                                                                 :: NamespaceQName,
+                                                                 namespaceDeclarationName_key_name
+                                                                 :: Name}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclarationName_key where
+  toJSON (NamespaceDeclarationName_key __field__qname __field__name)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclarationName_key where
+  buildStruct _proxy
+    (NamespaceDeclarationName_key __field__qname __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NamespaceDeclarationName_key __val__qname
+                                                  __val__name)
+              _idMap = HashMap.fromList [("qname", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclarationName_key where
+  rnf (NamespaceDeclarationName_key __field__qname __field__name)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclarationName_key where
+  def = NamespaceDeclarationName_key Default.def Default.def
+
+instance Hashable.Hashable NamespaceDeclarationName_key where
+  hashWithSalt __salt (NamespaceDeclarationName_key _qname _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _name
+
+data NamespaceDeclarationByName_key = NamespaceDeclarationByName_key{namespaceDeclarationByName_key_name
+                                                                     :: Text.Text,
+                                                                     namespaceDeclarationByName_key_parent
+                                                                     ::
+                                                                     Prelude.Maybe NamespaceQName,
+                                                                     namespaceDeclarationByName_key_decl
+                                                                     :: NamespaceDeclaration}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclarationByName_key where
+  toJSON
+    (NamespaceDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct NamespaceDeclarationByName_key where
+  buildStruct _proxy
+    (NamespaceDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (NamespaceDeclarationByName_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclarationByName_key where
+  rnf
+    (NamespaceDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclarationByName_key where
+  def = NamespaceDeclarationByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable NamespaceDeclarationByName_key where
+  hashWithSalt __salt
+    (NamespaceDeclarationByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data NamespaceDeclaration_key = NamespaceDeclaration_key{namespaceDeclaration_key_name
+                                                         :: NamespaceQName,
+                                                         namespaceDeclaration_key_source ::
+                                                         Glean.Schema.Src.Range}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclaration_key where
+  toJSON (NamespaceDeclaration_key __field__name __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclaration_key where
+  buildStruct _proxy
+    (NamespaceDeclaration_key __field__name __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (NamespaceDeclaration_key __val__name __val__source)
+              _idMap = HashMap.fromList [("name", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclaration_key where
+  rnf (NamespaceDeclaration_key __field__name __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclaration_key where
+  def = NamespaceDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable NamespaceDeclaration_key where
+  hashWithSalt __salt (NamespaceDeclaration_key _name _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _source
+
+data NamespaceAliasDeclaration_key = NamespaceAliasDeclaration_key{namespaceAliasDeclaration_key_name
+                                                                   :: NamespaceQName,
+                                                                   namespaceAliasDeclaration_key_target
+                                                                   :: NamespaceTarget,
+                                                                   namespaceAliasDeclaration_key_source
+                                                                   :: Glean.Schema.Src.Range}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceAliasDeclaration_key where
+  toJSON
+    (NamespaceAliasDeclaration_key __field__name __field__target
+       __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "target" .= __field__target :
+             "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceAliasDeclaration_key where
+  buildStruct _proxy
+    (NamespaceAliasDeclaration_key __field__name __field__target
+       __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             :
+             Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__source)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (NamespaceAliasDeclaration_key __val__name
+                                                  __val__target
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList [("name", 1), ("target", 2), ("source", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceAliasDeclaration_key where
+  rnf
+    (NamespaceAliasDeclaration_key __field__name __field__target
+       __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq`
+          DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default NamespaceAliasDeclaration_key where
+  def
+    = NamespaceAliasDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable NamespaceAliasDeclaration_key where
+  hashWithSalt __salt
+    (NamespaceAliasDeclaration_key _name _target _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _target)
+        _source
+
+data MethodSignature = MethodSignature{methodSignature_isVirtual ::
+                                       Prelude.Bool,
+                                       methodSignature_isConst :: Prelude.Bool,
+                                       methodSignature_isVolatile :: Prelude.Bool,
+                                       methodSignature_refQualifier :: RefQualifier}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodSignature where
+  toJSON
+    (MethodSignature __field__isVirtual __field__isConst
+       __field__isVolatile __field__refQualifier)
+    = Aeson.object
+        ("isVirtual" .= __field__isVirtual :
+           "isConst" .= __field__isConst :
+             "isVolatile" .= __field__isVolatile :
+               "refQualifier" .= __field__refQualifier : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodSignature where
+  buildStruct _proxy
+    (MethodSignature __field__isVirtual __field__isConst
+       __field__isVolatile __field__refQualifier)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "isVirtual" 1 0 __field__isVirtual :
+           Thrift.genFieldBool _proxy "isConst" 2 1 __field__isConst :
+             Thrift.genFieldBool _proxy "isVolatile" 3 2 __field__isVolatile :
+               Thrift.genField _proxy "refQualifier" (Thrift.getI32Type _proxy) 4
+                 3
+                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                    __field__refQualifier)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__isVirtual <- ST.newSTRef Prelude.False
+            __field__isConst <- ST.newSTRef Prelude.False
+            __field__isVolatile <- ST.newSTRef Prelude.False
+            __field__refQualifier <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVirtual
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isConst
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVolatile
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RefQualifier")
+                                                                        ST.writeSTRef
+                                                                          __field__refQualifier
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__isVirtual <- ST.readSTRef
+                                                                    __field__isVirtual
+                                             !__val__isConst <- ST.readSTRef __field__isConst
+                                             !__val__isVolatile <- ST.readSTRef __field__isVolatile
+                                             !__val__refQualifier <- ST.readSTRef
+                                                                       __field__refQualifier
+                                             Prelude.pure
+                                               (MethodSignature __val__isVirtual __val__isConst
+                                                  __val__isVolatile
+                                                  __val__refQualifier)
+              _idMap
+                = HashMap.fromList
+                    [("isVirtual", 1), ("isConst", 2), ("isVolatile", 3),
+                     ("refQualifier", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodSignature where
+  rnf
+    (MethodSignature __field__isVirtual __field__isConst
+       __field__isVolatile __field__refQualifier)
+    = DeepSeq.rnf __field__isVirtual `Prelude.seq`
+        DeepSeq.rnf __field__isConst `Prelude.seq`
+          DeepSeq.rnf __field__isVolatile `Prelude.seq`
+            DeepSeq.rnf __field__refQualifier `Prelude.seq` ()
+
+instance Default.Default MethodSignature where
+  def
+    = MethodSignature Prelude.False Prelude.False Prelude.False
+        Default.def
+
+instance Hashable.Hashable MethodSignature where
+  hashWithSalt __salt
+    (MethodSignature _isVirtual _isConst _isVolatile _refQualifier)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _isVirtual)
+              _isConst)
+           _isVolatile)
+        _refQualifier
+
+data MethodOverrides_key = MethodOverrides_key{methodOverrides_key_derived
+                                               :: FunctionDeclaration,
+                                               methodOverrides_key_base :: FunctionDeclaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides_key where
+  toJSON (MethodOverrides_key __field__derived __field__base)
+    = Aeson.object
+        ("derived" .= __field__derived :
+           "base" .= __field__base : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides_key where
+  buildStruct _proxy
+    (MethodOverrides_key __field__derived __field__base)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__derived)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__derived <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__derived <- ST.readSTRef
+                                                                  __field__derived
+                                             !__val__base <- ST.readSTRef __field__base
+                                             Prelude.pure
+                                               (MethodOverrides_key __val__derived __val__base)
+              _idMap = HashMap.fromList [("derived", 1), ("base", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides_key where
+  rnf (MethodOverrides_key __field__derived __field__base)
+    = DeepSeq.rnf __field__derived `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq` ()
+
+instance Default.Default MethodOverrides_key where
+  def = MethodOverrides_key Default.def Default.def
+
+instance Hashable.Hashable MethodOverrides_key where
+  hashWithSalt __salt (MethodOverrides_key _derived _base)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _derived)
+        _base
+
+data MethodOverridden_key = MethodOverridden_key{methodOverridden_key_base
+                                                 :: FunctionDeclaration,
+                                                 methodOverridden_key_derived ::
+                                                 FunctionDeclaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverridden_key where
+  toJSON (MethodOverridden_key __field__base __field__derived)
+    = Aeson.object
+        ("base" .= __field__base :
+           "derived" .= __field__derived : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverridden_key where
+  buildStruct _proxy
+    (MethodOverridden_key __field__base __field__derived)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__derived)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             Prelude.pure
+                                               (MethodOverridden_key __val__base __val__derived)
+              _idMap = HashMap.fromList [("base", 1), ("derived", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverridden_key where
+  rnf (MethodOverridden_key __field__base __field__derived)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__derived `Prelude.seq` ()
+
+instance Default.Default MethodOverridden_key where
+  def = MethodOverridden_key Default.def Default.def
+
+instance Hashable.Hashable MethodOverridden_key where
+  hashWithSalt __salt (MethodOverridden_key _base _derived)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _derived
+
+newtype MaybeIncludeTree = MaybeIncludeTree{maybeIncludeTree_tree
+                                            :: Prelude.Maybe IncludeTree}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MaybeIncludeTree where
+  toJSON (MaybeIncludeTree __field__tree)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("tree" .=)) __field__tree
+           Prelude.mempty)
+
+instance Thrift.ThriftStruct MaybeIncludeTree where
+  buildStruct _proxy (MaybeIncludeTree __field__tree)
+    = Thrift.genStruct _proxy
+        (case __field__tree of
+           Prelude.Just _val -> Thrift.genField _proxy "tree"
+                                  (Thrift.getStructType _proxy)
+                                  1
+                                  0
+                                  (Thrift.buildStruct _proxy _val)
+                                  : []
+           Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tree <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tree
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tree <- ST.readSTRef __field__tree
+                                             Prelude.pure (MaybeIncludeTree __val__tree)
+              _idMap = HashMap.fromList [("tree", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData MaybeIncludeTree where
+  rnf (MaybeIncludeTree __field__tree)
+    = DeepSeq.rnf __field__tree `Prelude.seq` ()
+
+instance Default.Default MaybeIncludeTree where
+  def = MaybeIncludeTree Prelude.Nothing
+
+instance Hashable.Hashable MaybeIncludeTree where
+  hashWithSalt __salt (MaybeIncludeTree _tree)
+    = Hashable.hashWithSalt __salt _tree
+
+type MangledNameHash = Text.Text
+
+data LocalVariableKind = LocalVariableKind_SimpleVariable
+                       | LocalVariableKind_StaticVariable
+                       | LocalVariableKind_Parameter
+                       | LocalVariableKind__UNKNOWN Prelude.Int
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalVariableKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData LocalVariableKind where
+  rnf __LocalVariableKind = Prelude.seq __LocalVariableKind ()
+
+instance Default.Default LocalVariableKind where
+  def = LocalVariableKind_SimpleVariable
+
+instance Hashable.Hashable LocalVariableKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum LocalVariableKind where
+  toThriftEnum 0 = LocalVariableKind_SimpleVariable
+  toThriftEnum 1 = LocalVariableKind_StaticVariable
+  toThriftEnum 2 = LocalVariableKind_Parameter
+  toThriftEnum val = LocalVariableKind__UNKNOWN val
+  fromThriftEnum LocalVariableKind_SimpleVariable = 0
+  fromThriftEnum LocalVariableKind_StaticVariable = 1
+  fromThriftEnum LocalVariableKind_Parameter = 2
+  fromThriftEnum (LocalVariableKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [LocalVariableKind_SimpleVariable,
+       LocalVariableKind_StaticVariable, LocalVariableKind_Parameter]
+  toThriftEnumEither 0
+    = Prelude.Right LocalVariableKind_SimpleVariable
+  toThriftEnumEither 1
+    = Prelude.Right LocalVariableKind_StaticVariable
+  toThriftEnumEither 2 = Prelude.Right LocalVariableKind_Parameter
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum LocalVariableKind: "
+           ++ Prelude.show val)
+
+data LocalVariableAttribute = LocalVariableAttribute_Plain
+                            | LocalVariableAttribute_Constexpr
+                            | LocalVariableAttribute__UNKNOWN Prelude.Int
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalVariableAttribute where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData LocalVariableAttribute where
+  rnf __LocalVariableAttribute
+    = Prelude.seq __LocalVariableAttribute ()
+
+instance Default.Default LocalVariableAttribute where
+  def = LocalVariableAttribute_Plain
+
+instance Hashable.Hashable LocalVariableAttribute where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum LocalVariableAttribute where
+  toThriftEnum 0 = LocalVariableAttribute_Plain
+  toThriftEnum 1 = LocalVariableAttribute_Constexpr
+  toThriftEnum val = LocalVariableAttribute__UNKNOWN val
+  fromThriftEnum LocalVariableAttribute_Plain = 0
+  fromThriftEnum LocalVariableAttribute_Constexpr = 1
+  fromThriftEnum (LocalVariableAttribute__UNKNOWN val) = val
+  allThriftEnumValues
+    = [LocalVariableAttribute_Plain, LocalVariableAttribute_Constexpr]
+  toThriftEnumEither 0 = Prelude.Right LocalVariableAttribute_Plain
+  toThriftEnumEither 1
+    = Prelude.Right LocalVariableAttribute_Constexpr
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum LocalVariableAttribute: "
+           ++ Prelude.show val)
+
+data LocalVariable = LocalVariable{localVariable_kind ::
+                                   LocalVariableKind,
+                                   localVariable_attribute :: LocalVariableAttribute}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalVariable where
+  toJSON (LocalVariable __field__kind __field__attribute)
+    = Aeson.object
+        ("kind" .= __field__kind :
+           "attribute" .= __field__attribute : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalVariable where
+  buildStruct _proxy (LocalVariable __field__kind __field__attribute)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           :
+           Thrift.genField _proxy "attribute" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__attribute)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            __field__attribute <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LocalVariableKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LocalVariableAttribute")
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__attribute <- ST.readSTRef __field__attribute
+                                             Prelude.pure
+                                               (LocalVariable __val__kind __val__attribute)
+              _idMap = HashMap.fromList [("kind", 1), ("attribute", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalVariable where
+  rnf (LocalVariable __field__kind __field__attribute)
+    = DeepSeq.rnf __field__kind `Prelude.seq`
+        DeepSeq.rnf __field__attribute `Prelude.seq` ()
+
+instance Default.Default LocalVariable where
+  def = LocalVariable Default.def Default.def
+
+instance Hashable.Hashable LocalVariable where
+  hashWithSalt __salt (LocalVariable _kind _attribute)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kind)
+        _attribute
+
+type LiteralOperator = Text.Text
+
+data IncludeTreeTranslationUnit_key = IncludeTreeTranslationUnit_key{includeTreeTranslationUnit_key_tree
+                                                                     :: IncludeTree,
+                                                                     includeTreeTranslationUnit_key_tunit
+                                                                     ::
+                                                                     Glean.Schema.Buck.TranslationUnit}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTreeTranslationUnit_key where
+  toJSON
+    (IncludeTreeTranslationUnit_key __field__tree __field__tunit)
+    = Aeson.object
+        ("tree" .= __field__tree :
+           "tunit" .= __field__tunit : Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTreeTranslationUnit_key where
+  buildStruct _proxy
+    (IncludeTreeTranslationUnit_key __field__tree __field__tunit)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tree" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tree)
+           :
+           Thrift.genField _proxy "tunit" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__tunit)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tree <- ST.newSTRef Default.def
+            __field__tunit <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tree
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tunit
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tree <- ST.readSTRef __field__tree
+                                             !__val__tunit <- ST.readSTRef __field__tunit
+                                             Prelude.pure
+                                               (IncludeTreeTranslationUnit_key __val__tree
+                                                  __val__tunit)
+              _idMap = HashMap.fromList [("tree", 1), ("tunit", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTreeTranslationUnit_key where
+  rnf (IncludeTreeTranslationUnit_key __field__tree __field__tunit)
+    = DeepSeq.rnf __field__tree `Prelude.seq`
+        DeepSeq.rnf __field__tunit `Prelude.seq` ()
+
+instance Default.Default IncludeTreeTranslationUnit_key where
+  def = IncludeTreeTranslationUnit_key Default.def Default.def
+
+instance Hashable.Hashable IncludeTreeTranslationUnit_key where
+  hashWithSalt __salt (IncludeTreeTranslationUnit_key _tree _tunit)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tree) _tunit
+
+data IncludeTreeParent_key = IncludeTreeParent_key{includeTreeParent_key_tree
+                                                   :: IncludeTree,
+                                                   includeTreeParent_key_parent :: IncludeTree}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTreeParent_key where
+  toJSON (IncludeTreeParent_key __field__tree __field__parent)
+    = Aeson.object
+        ("tree" .= __field__tree :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTreeParent_key where
+  buildStruct _proxy
+    (IncludeTreeParent_key __field__tree __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tree" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tree)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tree <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tree
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tree <- ST.readSTRef __field__tree
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (IncludeTreeParent_key __val__tree __val__parent)
+              _idMap = HashMap.fromList [("tree", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTreeParent_key where
+  rnf (IncludeTreeParent_key __field__tree __field__parent)
+    = DeepSeq.rnf __field__tree `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default IncludeTreeParent_key where
+  def = IncludeTreeParent_key Default.def Default.def
+
+instance Hashable.Hashable IncludeTreeParent_key where
+  hashWithSalt __salt (IncludeTreeParent_key _tree _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tree)
+        _parent
+
+data IncludeTree_key = IncludeTree_key{includeTree_key_trace ::
+                                       Trace,
+                                       includeTree_key_children :: [MaybeIncludeTree]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTree_key where
+  toJSON (IncludeTree_key __field__trace __field__children)
+    = Aeson.object
+        ("trace" .= __field__trace :
+           "children" .= __field__children : Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTree_key where
+  buildStruct _proxy
+    (IncludeTree_key __field__trace __field__children)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__trace)
+           :
+           Thrift.genField _proxy "children" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__children)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__trace <- ST.newSTRef Default.def
+            __field__children <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__children
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__children <- ST.readSTRef __field__children
+                                             Prelude.pure
+                                               (IncludeTree_key __val__trace __val__children)
+              _idMap = HashMap.fromList [("trace", 1), ("children", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTree_key where
+  rnf (IncludeTree_key __field__trace __field__children)
+    = DeepSeq.rnf __field__trace `Prelude.seq`
+        DeepSeq.rnf __field__children `Prelude.seq` ()
+
+instance Default.Default IncludeTree_key where
+  def = IncludeTree_key Default.def Default.def
+
+instance Hashable.Hashable IncludeTree_key where
+  hashWithSalt __salt (IncludeTree_key _trace _children)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _trace)
+        _children
+
+data IncludeTrace = IncludeTrace{includeTrace_include_ ::
+                                 Glean.Schema.Pp1.Include,
+                                 includeTrace_trace :: Prelude.Maybe Trace}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IncludeTrace where
+  toJSON (IncludeTrace __field__include_ __field__trace)
+    = Aeson.object
+        ("include_" .= __field__include_ :
+           Prelude.maybe Prelude.id ((:) . ("trace" .=)) __field__trace
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IncludeTrace where
+  buildStruct _proxy (IncludeTrace __field__include_ __field__trace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "include_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__include_)
+           :
+           case __field__trace of
+             Prelude.Just _val -> Thrift.genField _proxy "trace"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__include_ <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__include_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__include_ <- ST.readSTRef
+                                                                   __field__include_
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             Prelude.pure
+                                               (IncludeTrace __val__include_ __val__trace)
+              _idMap = HashMap.fromList [("include_", 1), ("trace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IncludeTrace where
+  rnf (IncludeTrace __field__include_ __field__trace)
+    = DeepSeq.rnf __field__include_ `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq` ()
+
+instance Default.Default IncludeTrace where
+  def = IncludeTrace Default.def Prelude.Nothing
+
+instance Hashable.Hashable IncludeTrace where
+  hashWithSalt __salt (IncludeTrace _include_ _trace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _include_)
+        _trace
+
+data PPEvent = PPEvent_include_ IncludeTrace
+             | PPEvent_define Glean.Schema.Pp1.Define
+             | PPEvent_undef Glean.Schema.Pp1.Undef
+             | PPEvent_use Glean.Schema.Pp1.Use
+             | PPEvent_EMPTY
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPEvent where
+  toJSON (PPEvent_include_ __include_)
+    = Aeson.object ["include_" .= __include_]
+  toJSON (PPEvent_define __define)
+    = Aeson.object ["define" .= __define]
+  toJSON (PPEvent_undef __undef) = Aeson.object ["undef" .= __undef]
+  toJSON (PPEvent_use __use) = Aeson.object ["use" .= __use]
+  toJSON PPEvent_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct PPEvent where
+  buildStruct _proxy (PPEvent_include_ __include_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "include_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __include_)]
+  buildStruct _proxy (PPEvent_define __define)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __define)]
+  buildStruct _proxy (PPEvent_undef __undef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "undef" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __undef)]
+  buildStruct _proxy (PPEvent_use __use)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "use" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __use)]
+  buildStruct _proxy PPEvent_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PPEvent_include_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PPEvent_define _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PPEvent_undef _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (PPEvent_use _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return PPEvent_EMPTY
+           Thrift.FieldEnd -> Prelude.return PPEvent_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("include_", 1), ("define", 2), ("undef", 3), ("use", 4)]
+
+instance DeepSeq.NFData PPEvent where
+  rnf (PPEvent_include_ __include_) = DeepSeq.rnf __include_
+  rnf (PPEvent_define __define) = DeepSeq.rnf __define
+  rnf (PPEvent_undef __undef) = DeepSeq.rnf __undef
+  rnf (PPEvent_use __use) = DeepSeq.rnf __use
+  rnf PPEvent_EMPTY = ()
+
+instance Default.Default PPEvent where
+  def = PPEvent_EMPTY
+
+instance Hashable.Hashable PPEvent where
+  hashWithSalt __salt (PPEvent_include_ _include_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _include_)
+  hashWithSalt __salt (PPEvent_define _define)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _define)
+  hashWithSalt __salt (PPEvent_undef _undef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _undef)
+  hashWithSalt __salt (PPEvent_use _use)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _use)
+  hashWithSalt __salt PPEvent_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data PPTrace_key = PPTrace_key{pPTrace_key_file ::
+                               Glean.Schema.Src.File,
+                               pPTrace_key_events :: [PPEvent]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PPTrace_key where
+  toJSON (PPTrace_key __field__file __field__events)
+    = Aeson.object
+        ("file" .= __field__file :
+           "events" .= __field__events : Prelude.mempty)
+
+instance Thrift.ThriftStruct PPTrace_key where
+  buildStruct _proxy (PPTrace_key __field__file __field__events)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "events" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__events)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__events <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__events
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__events <- ST.readSTRef __field__events
+                                             Prelude.pure (PPTrace_key __val__file __val__events)
+              _idMap = HashMap.fromList [("file", 1), ("events", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PPTrace_key where
+  rnf (PPTrace_key __field__file __field__events)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__events `Prelude.seq` ()
+
+instance Default.Default PPTrace_key where
+  def = PPTrace_key Default.def Default.def
+
+instance Hashable.Hashable PPTrace_key where
+  hashWithSalt __salt (PPTrace_key _file _events)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _events
+
+data GlobalVariableKind = GlobalVariableKind_SimpleVariable
+                        | GlobalVariableKind_StaticVariable
+                        | GlobalVariableKind_StaticMember
+                        | GlobalVariableKind__UNKNOWN Prelude.Int
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalVariableKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData GlobalVariableKind where
+  rnf __GlobalVariableKind = Prelude.seq __GlobalVariableKind ()
+
+instance Default.Default GlobalVariableKind where
+  def = GlobalVariableKind_SimpleVariable
+
+instance Hashable.Hashable GlobalVariableKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum GlobalVariableKind where
+  toThriftEnum 0 = GlobalVariableKind_SimpleVariable
+  toThriftEnum 1 = GlobalVariableKind_StaticVariable
+  toThriftEnum 2 = GlobalVariableKind_StaticMember
+  toThriftEnum val = GlobalVariableKind__UNKNOWN val
+  fromThriftEnum GlobalVariableKind_SimpleVariable = 0
+  fromThriftEnum GlobalVariableKind_StaticVariable = 1
+  fromThriftEnum GlobalVariableKind_StaticMember = 2
+  fromThriftEnum (GlobalVariableKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [GlobalVariableKind_SimpleVariable,
+       GlobalVariableKind_StaticVariable, GlobalVariableKind_StaticMember]
+  toThriftEnumEither 0
+    = Prelude.Right GlobalVariableKind_SimpleVariable
+  toThriftEnumEither 1
+    = Prelude.Right GlobalVariableKind_StaticVariable
+  toThriftEnumEither 2
+    = Prelude.Right GlobalVariableKind_StaticMember
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum GlobalVariableKind: "
+           ++ Prelude.show val)
+
+data GlobalVariableAttribute = GlobalVariableAttribute_Plain
+                             | GlobalVariableAttribute_Inline
+                             | GlobalVariableAttribute_Constexpr
+                             | GlobalVariableAttribute__UNKNOWN Prelude.Int
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalVariableAttribute where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData GlobalVariableAttribute where
+  rnf __GlobalVariableAttribute
+    = Prelude.seq __GlobalVariableAttribute ()
+
+instance Default.Default GlobalVariableAttribute where
+  def = GlobalVariableAttribute_Plain
+
+instance Hashable.Hashable GlobalVariableAttribute where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum GlobalVariableAttribute where
+  toThriftEnum 0 = GlobalVariableAttribute_Plain
+  toThriftEnum 1 = GlobalVariableAttribute_Inline
+  toThriftEnum 2 = GlobalVariableAttribute_Constexpr
+  toThriftEnum val = GlobalVariableAttribute__UNKNOWN val
+  fromThriftEnum GlobalVariableAttribute_Plain = 0
+  fromThriftEnum GlobalVariableAttribute_Inline = 1
+  fromThriftEnum GlobalVariableAttribute_Constexpr = 2
+  fromThriftEnum (GlobalVariableAttribute__UNKNOWN val) = val
+  allThriftEnumValues
+    = [GlobalVariableAttribute_Plain, GlobalVariableAttribute_Inline,
+       GlobalVariableAttribute_Constexpr]
+  toThriftEnumEither 0 = Prelude.Right GlobalVariableAttribute_Plain
+  toThriftEnumEither 1 = Prelude.Right GlobalVariableAttribute_Inline
+  toThriftEnumEither 2
+    = Prelude.Right GlobalVariableAttribute_Constexpr
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum GlobalVariableAttribute: "
+           ++ Prelude.show val)
+
+data GlobalVariable = GlobalVariable{globalVariable_kind ::
+                                     GlobalVariableKind,
+                                     globalVariable_attribute :: GlobalVariableAttribute,
+                                     globalVariable_definition :: Prelude.Bool}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalVariable where
+  toJSON
+    (GlobalVariable __field__kind __field__attribute
+       __field__definition)
+    = Aeson.object
+        ("kind" .= __field__kind :
+           "attribute" .= __field__attribute :
+             "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalVariable where
+  buildStruct _proxy
+    (GlobalVariable __field__kind __field__attribute
+       __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           :
+           Thrift.genField _proxy "attribute" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__attribute)
+             :
+             Thrift.genFieldBool _proxy "definition" 3 2 __field__definition :
+               [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            __field__attribute <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "GlobalVariableKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "GlobalVariableAttribute")
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__attribute <- ST.readSTRef __field__attribute
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (GlobalVariable __val__kind __val__attribute
+                                                  __val__definition)
+              _idMap
+                = HashMap.fromList
+                    [("kind", 1), ("attribute", 2), ("definition", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalVariable where
+  rnf
+    (GlobalVariable __field__kind __field__attribute
+       __field__definition)
+    = DeepSeq.rnf __field__kind `Prelude.seq`
+        DeepSeq.rnf __field__attribute `Prelude.seq`
+          DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default GlobalVariable where
+  def = GlobalVariable Default.def Default.def Prelude.False
+
+instance Hashable.Hashable GlobalVariable where
+  hashWithSalt __salt (GlobalVariable _kind _attribute _definition)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kind)
+           _attribute)
+        _definition
+
+data FunctionName_key = FunctionName_key_name Name
+                      | FunctionName_key_operator_ Operator
+                      | FunctionName_key_literalOperator LiteralOperator
+                      | FunctionName_key_constructor Glean.Schema.Builtin.Unit
+                      | FunctionName_key_destructor Glean.Schema.Builtin.Unit
+                      | FunctionName_key_conversionOperator Type
+                      | FunctionName_key_EMPTY
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionName_key where
+  toJSON (FunctionName_key_name __name)
+    = Aeson.object ["name" .= __name]
+  toJSON (FunctionName_key_operator_ __operator_)
+    = Aeson.object ["operator_" .= __operator_]
+  toJSON (FunctionName_key_literalOperator __literalOperator)
+    = Aeson.object ["literalOperator" .= __literalOperator]
+  toJSON (FunctionName_key_constructor __constructor)
+    = Aeson.object ["constructor" .= __constructor]
+  toJSON (FunctionName_key_destructor __destructor)
+    = Aeson.object ["destructor" .= __destructor]
+  toJSON (FunctionName_key_conversionOperator __conversionOperator)
+    = Aeson.object ["conversionOperator" .= __conversionOperator]
+  toJSON FunctionName_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct FunctionName_key where
+  buildStruct _proxy (FunctionName_key_name __name)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __name)]
+  buildStruct _proxy (FunctionName_key_operator_ __operator_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "operator_" (Thrift.getStringType _proxy) 2
+           0
+           (Thrift.genText _proxy __operator_)]
+  buildStruct _proxy
+    (FunctionName_key_literalOperator __literalOperator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "literalOperator"
+           (Thrift.getStringType _proxy)
+           3
+           0
+           (Thrift.genText _proxy __literalOperator)]
+  buildStruct _proxy (FunctionName_key_constructor __constructor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "constructor" (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __constructor)]
+  buildStruct _proxy (FunctionName_key_destructor __destructor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "destructor" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __destructor)]
+  buildStruct _proxy
+    (FunctionName_key_conversionOperator __conversionOperator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "conversionOperator"
+           (Thrift.getStructType _proxy)
+           6
+           0
+           (Thrift.buildStruct _proxy __conversionOperator)]
+  buildStruct _proxy FunctionName_key_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_name _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_operator_ _val)
+                                                     3 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_literalOperator
+                                                                 _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_constructor _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_destructor _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (FunctionName_key_conversionOperator
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return FunctionName_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return FunctionName_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("name", 1), ("operator_", 2), ("literalOperator", 3),
+             ("constructor", 4), ("destructor", 5), ("conversionOperator", 6)]
+
+instance DeepSeq.NFData FunctionName_key where
+  rnf (FunctionName_key_name __name) = DeepSeq.rnf __name
+  rnf (FunctionName_key_operator_ __operator_)
+    = DeepSeq.rnf __operator_
+  rnf (FunctionName_key_literalOperator __literalOperator)
+    = DeepSeq.rnf __literalOperator
+  rnf (FunctionName_key_constructor __constructor)
+    = DeepSeq.rnf __constructor
+  rnf (FunctionName_key_destructor __destructor)
+    = DeepSeq.rnf __destructor
+  rnf (FunctionName_key_conversionOperator __conversionOperator)
+    = DeepSeq.rnf __conversionOperator
+  rnf FunctionName_key_EMPTY = ()
+
+instance Default.Default FunctionName_key where
+  def = FunctionName_key_EMPTY
+
+instance Hashable.Hashable FunctionName_key where
+  hashWithSalt __salt (FunctionName_key_name _name)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _name)
+  hashWithSalt __salt (FunctionName_key_operator_ _operator_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _operator_)
+  hashWithSalt __salt
+    (FunctionName_key_literalOperator _literalOperator)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _literalOperator)
+  hashWithSalt __salt (FunctionName_key_constructor _constructor)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _constructor)
+  hashWithSalt __salt (FunctionName_key_destructor _destructor)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _destructor)
+  hashWithSalt __salt
+    (FunctionName_key_conversionOperator _conversionOperator)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _conversionOperator)
+  hashWithSalt __salt FunctionName_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FunctionLowerCase_key = FunctionLowerCase_key{functionLowerCase_key_name_lowercase
+                                                   :: Text.Text,
+                                                   functionLowerCase_key_name :: Text.Text}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionLowerCase_key where
+  toJSON
+    (FunctionLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionLowerCase_key where
+  buildStruct _proxy
+    (FunctionLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FunctionLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionLowerCase_key where
+  rnf (FunctionLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionLowerCase_key where
+  def = FunctionLowerCase_key "" ""
+
+instance Hashable.Hashable FunctionLowerCase_key where
+  hashWithSalt __salt (FunctionLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data FunctionDefinition_key = FunctionDefinition_key{functionDefinition_key_declaration
+                                                     :: FunctionDeclaration,
+                                                     functionDefinition_key_isInline ::
+                                                     Prelude.Bool}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition_key where
+  toJSON
+    (FunctionDefinition_key __field__declaration __field__isInline)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "isInline" .= __field__isInline : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDefinition_key where
+  buildStruct _proxy
+    (FunctionDefinition_key __field__declaration __field__isInline)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           : Thrift.genFieldBool _proxy "isInline" 2 1 __field__isInline : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__isInline <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isInline
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__isInline <- ST.readSTRef __field__isInline
+                                             Prelude.pure
+                                               (FunctionDefinition_key __val__declaration
+                                                  __val__isInline)
+              _idMap = HashMap.fromList [("declaration", 1), ("isInline", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition_key where
+  rnf (FunctionDefinition_key __field__declaration __field__isInline)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__isInline `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition_key where
+  def = FunctionDefinition_key Default.def Prelude.False
+
+instance Hashable.Hashable FunctionDefinition_key where
+  hashWithSalt __salt (FunctionDefinition_key _declaration _isInline)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _isInline
+
+data FunctionDeclarationNameString_key = FunctionDeclarationNameString_key{functionDeclarationNameString_key_fname
+                                                                           :: FunctionName,
+                                                                           functionDeclarationNameString_key_name
+                                                                           :: Text.Text}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationNameString_key where
+  toJSON
+    (FunctionDeclarationNameString_key __field__fname __field__name)
+    = Aeson.object
+        ("fname" .= __field__fname :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationNameString_key
+         where
+  buildStruct _proxy
+    (FunctionDeclarationNameString_key __field__fname __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fname)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fname <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fname <- ST.readSTRef __field__fname
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FunctionDeclarationNameString_key __val__fname
+                                                  __val__name)
+              _idMap = HashMap.fromList [("fname", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationNameString_key where
+  rnf
+    (FunctionDeclarationNameString_key __field__fname __field__name)
+    = DeepSeq.rnf __field__fname `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationNameString_key where
+  def = FunctionDeclarationNameString_key Default.def ""
+
+instance Hashable.Hashable FunctionDeclarationNameString_key where
+  hashWithSalt __salt
+    (FunctionDeclarationNameString_key _fname _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fname) _name
+
+data FunctionDeclarationName_key = FunctionDeclarationName_key{functionDeclarationName_key_fname
+                                                               :: FunctionName,
+                                                               functionDeclarationName_key_name ::
+                                                               Name}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationName_key where
+  toJSON (FunctionDeclarationName_key __field__fname __field__name)
+    = Aeson.object
+        ("fname" .= __field__fname :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationName_key where
+  buildStruct _proxy
+    (FunctionDeclarationName_key __field__fname __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fname)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fname <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fname <- ST.readSTRef __field__fname
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FunctionDeclarationName_key __val__fname
+                                                  __val__name)
+              _idMap = HashMap.fromList [("fname", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationName_key where
+  rnf (FunctionDeclarationName_key __field__fname __field__name)
+    = DeepSeq.rnf __field__fname `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationName_key where
+  def = FunctionDeclarationName_key Default.def Default.def
+
+instance Hashable.Hashable FunctionDeclarationName_key where
+  hashWithSalt __salt (FunctionDeclarationName_key _fname _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fname) _name
+
+data FunctionDeclaration_key = FunctionDeclaration_key{functionDeclaration_key_name
+                                                       :: FunctionQName,
+                                                       functionDeclaration_key_signature ::
+                                                       Signature,
+                                                       functionDeclaration_key_method ::
+                                                       Prelude.Maybe MethodSignature,
+                                                       functionDeclaration_key_source ::
+                                                       Glean.Schema.Src.Range}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration_key where
+  toJSON
+    (FunctionDeclaration_key __field__name __field__signature
+       __field__method __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "signature" .= __field__signature :
+             Prelude.maybe Prelude.id ((:) . ("method" .=)) __field__method
+               ("source" .= __field__source : Prelude.mempty))
+
+instance Thrift.ThriftStruct FunctionDeclaration_key where
+  buildStruct _proxy
+    (FunctionDeclaration_key __field__name __field__signature
+       __field__method __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__signature)
+             :
+             let (__cereal__method, __id__method)
+                   = case __field__method of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "method"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__method
+                 (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4
+                    __id__method
+                    (Thrift.buildStruct _proxy __field__source)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__method <- ST.newSTRef Prelude.Nothing
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__method
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__method <- ST.readSTRef __field__method
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (FunctionDeclaration_key __val__name __val__signature
+                                                  __val__method
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("signature", 2), ("method", 3), ("source", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration_key where
+  rnf
+    (FunctionDeclaration_key __field__name __field__signature
+       __field__method __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq`
+          DeepSeq.rnf __field__method `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration_key where
+  def
+    = FunctionDeclaration_key Default.def Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FunctionDeclaration_key where
+  hashWithSalt __salt
+    (FunctionDeclaration_key _name _signature _method _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _signature)
+           _method)
+        _source
+
+data FunctionDeclAttribute_key = FunctionDeclAttribute_key{functionDeclAttribute_key_decl
+                                                           :: FunctionDeclaration,
+                                                           functionDeclAttribute_key_attr ::
+                                                           Attribute}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclAttribute_key where
+  toJSON (FunctionDeclAttribute_key __field__decl __field__attr)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "attr" .= __field__attr : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclAttribute_key where
+  buildStruct _proxy
+    (FunctionDeclAttribute_key __field__decl __field__attr)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "attr" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__attr)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__attr <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__attr
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__attr <- ST.readSTRef __field__attr
+                                             Prelude.pure
+                                               (FunctionDeclAttribute_key __val__decl __val__attr)
+              _idMap = HashMap.fromList [("decl", 1), ("attr", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclAttribute_key where
+  rnf (FunctionDeclAttribute_key __field__decl __field__attr)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__attr `Prelude.seq` ()
+
+instance Default.Default FunctionDeclAttribute_key where
+  def = FunctionDeclAttribute_key Default.def Default.def
+
+instance Hashable.Hashable FunctionDeclAttribute_key where
+  hashWithSalt __salt (FunctionDeclAttribute_key _decl _attr)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _attr
+
+data FunctionAttribute_key = FunctionAttribute_key{functionAttribute_key_attr
+                                                   :: Attribute,
+                                                   functionAttribute_key_declaration ::
+                                                   FunctionDeclaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionAttribute_key where
+  toJSON (FunctionAttribute_key __field__attr __field__declaration)
+    = Aeson.object
+        ("attr" .= __field__attr :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionAttribute_key where
+  buildStruct _proxy
+    (FunctionAttribute_key __field__attr __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "attr" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__attr)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__attr <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__attr
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__attr <- ST.readSTRef __field__attr
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (FunctionAttribute_key __val__attr
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("attr", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionAttribute_key where
+  rnf (FunctionAttribute_key __field__attr __field__declaration)
+    = DeepSeq.rnf __field__attr `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default FunctionAttribute_key where
+  def = FunctionAttribute_key Default.def Default.def
+
+instance Hashable.Hashable FunctionAttribute_key where
+  hashWithSalt __salt (FunctionAttribute_key _attr _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _attr)
+        _declaration
+
+data From = From{from_spans :: Glean.Schema.Src.PackedByteSpans,
+                 from_expansions :: Glean.Schema.Src.PackedByteSpans,
+                 from_spellings :: Glean.Schema.Src.PackedByteSpans}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON From where
+  toJSON (From __field__spans __field__expansions __field__spellings)
+    = Aeson.object
+        ("spans" .= __field__spans :
+           "expansions" .= __field__expansions :
+             "spellings" .= __field__spellings : Prelude.mempty)
+
+instance Thrift.ThriftStruct From where
+  buildStruct _proxy
+    (From __field__spans __field__expansions __field__spellings)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "spans" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__spans)
+           :
+           Thrift.genField _proxy "expansions" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__expansions)
+             :
+             Thrift.genField _proxy "spellings" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__spellings)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__spans <- ST.newSTRef Default.def
+            __field__expansions <- ST.newSTRef Default.def
+            __field__spellings <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__spans
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__expansions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__spellings
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__spans <- ST.readSTRef __field__spans
+                                             !__val__expansions <- ST.readSTRef __field__expansions
+                                             !__val__spellings <- ST.readSTRef __field__spellings
+                                             Prelude.pure
+                                               (From __val__spans __val__expansions
+                                                  __val__spellings)
+              _idMap
+                = HashMap.fromList
+                    [("spans", 1), ("expansions", 2), ("spellings", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData From where
+  rnf (From __field__spans __field__expansions __field__spellings)
+    = DeepSeq.rnf __field__spans `Prelude.seq`
+        DeepSeq.rnf __field__expansions `Prelude.seq`
+          DeepSeq.rnf __field__spellings `Prelude.seq` ()
+
+instance Default.Default From where
+  def = From Default.def Default.def Default.def
+
+instance Hashable.Hashable From where
+  hashWithSalt __salt (From _spans _expansions _spellings)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _spans)
+           _expansions)
+        _spellings
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_xmap ::
+                                   FileXRefMap,
+                                   fileXRefs_key_targets :: [XRefTargets]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__xmap __field__targets)
+    = Aeson.object
+        ("xmap" .= __field__xmap :
+           "targets" .= __field__targets : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__xmap __field__targets)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xmap" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__xmap)
+           :
+           Thrift.genField _proxy "targets" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__targets)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xmap <- ST.newSTRef Default.def
+            __field__targets <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xmap
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__targets
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xmap <- ST.readSTRef __field__xmap
+                                             !__val__targets <- ST.readSTRef __field__targets
+                                             Prelude.pure (FileXRefs_key __val__xmap __val__targets)
+              _idMap = HashMap.fromList [("xmap", 1), ("targets", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__xmap __field__targets)
+    = DeepSeq.rnf __field__xmap `Prelude.seq`
+        DeepSeq.rnf __field__targets `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _xmap _targets)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xmap)
+        _targets
+
+data FilePPUseXRefs_key = FilePPUseXRefs_key{filePPUseXRefs_key_file
+                                             :: Glean.Schema.Src.File,
+                                             filePPUseXRefs_key_source :: Glean.Schema.Src.Range,
+                                             filePPUseXRefs_key_define :: Glean.Schema.Pp1.Define}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPUseXRefs_key where
+  toJSON
+    (FilePPUseXRefs_key __field__file __field__source __field__define)
+    = Aeson.object
+        ("file" .= __field__file :
+           "source" .= __field__source :
+             "define" .= __field__define : Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPUseXRefs_key where
+  buildStruct _proxy
+    (FilePPUseXRefs_key __field__file __field__source __field__define)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__define)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__define <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__define
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__define <- ST.readSTRef __field__define
+                                             Prelude.pure
+                                               (FilePPUseXRefs_key __val__file __val__source
+                                                  __val__define)
+              _idMap
+                = HashMap.fromList [("file", 1), ("source", 2), ("define", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPUseXRefs_key where
+  rnf
+    (FilePPUseXRefs_key __field__file __field__source __field__define)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__define `Prelude.seq` ()
+
+instance Default.Default FilePPUseXRefs_key where
+  def = FilePPUseXRefs_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FilePPUseXRefs_key where
+  hashWithSalt __salt (FilePPUseXRefs_key _file _source _define)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _source)
+        _define
+
+data FilePPUseTraceXRefs_key = FilePPUseTraceXRefs_key{filePPUseTraceXRefs_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       filePPUseTraceXRefs_key_trace :: Trace,
+                                                       filePPUseTraceXRefs_key_source ::
+                                                       Glean.Schema.Src.Range,
+                                                       filePPUseTraceXRefs_key_define ::
+                                                       Glean.Schema.Pp1.Define}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPUseTraceXRefs_key where
+  toJSON
+    (FilePPUseTraceXRefs_key __field__file __field__trace
+       __field__source __field__define)
+    = Aeson.object
+        ("file" .= __field__file :
+           "trace" .= __field__trace :
+             "source" .= __field__source :
+               "define" .= __field__define : Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPUseTraceXRefs_key where
+  buildStruct _proxy
+    (FilePPUseTraceXRefs_key __field__file __field__trace
+       __field__source __field__define)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__trace)
+             :
+             Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__source)
+               :
+               Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__define)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__define <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__define
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__define <- ST.readSTRef __field__define
+                                             Prelude.pure
+                                               (FilePPUseTraceXRefs_key __val__file __val__trace
+                                                  __val__source
+                                                  __val__define)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("trace", 2), ("source", 3), ("define", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPUseTraceXRefs_key where
+  rnf
+    (FilePPUseTraceXRefs_key __field__file __field__trace
+       __field__source __field__define)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq`
+          DeepSeq.rnf __field__source `Prelude.seq`
+            DeepSeq.rnf __field__define `Prelude.seq` ()
+
+instance Default.Default FilePPUseTraceXRefs_key where
+  def
+    = FilePPUseTraceXRefs_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FilePPUseTraceXRefs_key where
+  hashWithSalt __salt
+    (FilePPUseTraceXRefs_key _file _trace _source _define)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _trace)
+           _source)
+        _define
+
+data FilePPTraceXRefs_key = FilePPTraceXRefs_key{filePPTraceXRefs_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 filePPTraceXRefs_key_trace :: Trace,
+                                                 filePPTraceXRefs_key_source ::
+                                                 Glean.Schema.Src.Range,
+                                                 filePPTraceXRefs_key_ppEntity :: PpEntity,
+                                                 filePPTraceXRefs_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FilePPTraceXRefs_key where
+  toJSON
+    (FilePPTraceXRefs_key __field__file __field__trace __field__source
+       __field__ppEntity __field__span)
+    = Aeson.object
+        ("file" .= __field__file :
+           "trace" .= __field__trace :
+             "source" .= __field__source :
+               "ppEntity" .= __field__ppEntity :
+                 "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FilePPTraceXRefs_key where
+  buildStruct _proxy
+    (FilePPTraceXRefs_key __field__file __field__trace __field__source
+       __field__ppEntity __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__trace)
+             :
+             Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__source)
+               :
+               Thrift.genField _proxy "ppEntity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__ppEntity)
+                 :
+                 Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__span)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__ppEntity <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__ppEntity
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__ppEntity <- ST.readSTRef __field__ppEntity
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FilePPTraceXRefs_key __val__file __val__trace
+                                                  __val__source
+                                                  __val__ppEntity
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("trace", 2), ("source", 3), ("ppEntity", 4),
+                     ("span", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData FilePPTraceXRefs_key where
+  rnf
+    (FilePPTraceXRefs_key __field__file __field__trace __field__source
+       __field__ppEntity __field__span)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq`
+          DeepSeq.rnf __field__source `Prelude.seq`
+            DeepSeq.rnf __field__ppEntity `Prelude.seq`
+              DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FilePPTraceXRefs_key where
+  def
+    = FilePPTraceXRefs_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable FilePPTraceXRefs_key where
+  hashWithSalt __salt
+    (FilePPTraceXRefs_key _file _trace _source _ppEntity _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _trace)
+              _source)
+           _ppEntity)
+        _span
+
+data Field = Field{field_mutable_ :: Prelude.Bool,
+                   field_bitsize :: Prelude.Maybe Glean.Nat}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field where
+  toJSON (Field __field__mutable_ __field__bitsize)
+    = Aeson.object
+        ("mutable_" .= __field__mutable_ :
+           Prelude.maybe Prelude.id ((:) . ("bitsize" .=))
+             (Prelude.fmap Glean.unNat __field__bitsize)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Field where
+  buildStruct _proxy (Field __field__mutable_ __field__bitsize)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "mutable_" 1 0 __field__mutable_ :
+           case __field__bitsize of
+             Prelude.Just _val -> Thrift.genField _proxy "bitsize"
+                                    (Thrift.getI64Type _proxy)
+                                    2
+                                    1
+                                    ((Thrift.genI64 _proxy . Glean.unNat) _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__mutable_ <- ST.newSTRef Prelude.False
+            __field__bitsize <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__mutable_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__bitsize
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__mutable_ <- ST.readSTRef
+                                                                   __field__mutable_
+                                             !__val__bitsize <- ST.readSTRef __field__bitsize
+                                             Prelude.pure (Field __val__mutable_ __val__bitsize)
+              _idMap = HashMap.fromList [("mutable_", 1), ("bitsize", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Field where
+  rnf (Field __field__mutable_ __field__bitsize)
+    = DeepSeq.rnf __field__mutable_ `Prelude.seq`
+        DeepSeq.rnf __field__bitsize `Prelude.seq` ()
+
+instance Default.Default Field where
+  def = Field Prelude.False Prelude.Nothing
+
+instance Hashable.Hashable Field where
+  hashWithSalt __salt (Field _mutable_ _bitsize)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _mutable_)
+        _bitsize
+
+data VariableKind = VariableKind_global_ GlobalVariable
+                  | VariableKind_local LocalVariable
+                  | VariableKind_field Field
+                  | VariableKind_ivar ObjcIVar
+                  | VariableKind_EMPTY
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableKind where
+  toJSON (VariableKind_global_ __global_)
+    = Aeson.object ["global_" .= __global_]
+  toJSON (VariableKind_local __local)
+    = Aeson.object ["local" .= __local]
+  toJSON (VariableKind_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON (VariableKind_ivar __ivar) = Aeson.object ["ivar" .= __ivar]
+  toJSON VariableKind_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct VariableKind where
+  buildStruct _proxy (VariableKind_global_ __global_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "global_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __global_)]
+  buildStruct _proxy (VariableKind_local __local)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __local)]
+  buildStruct _proxy (VariableKind_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy (VariableKind_ivar __ivar)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ivar" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __ivar)]
+  buildStruct _proxy VariableKind_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (VariableKind_global_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (VariableKind_local _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (VariableKind_field _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (VariableKind_ivar _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return VariableKind_EMPTY
+           Thrift.FieldEnd -> Prelude.return VariableKind_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("global_", 1), ("local", 2), ("field", 3), ("ivar", 4)]
+
+instance DeepSeq.NFData VariableKind where
+  rnf (VariableKind_global_ __global_) = DeepSeq.rnf __global_
+  rnf (VariableKind_local __local) = DeepSeq.rnf __local
+  rnf (VariableKind_field __field) = DeepSeq.rnf __field
+  rnf (VariableKind_ivar __ivar) = DeepSeq.rnf __ivar
+  rnf VariableKind_EMPTY = ()
+
+instance Default.Default VariableKind where
+  def = VariableKind_EMPTY
+
+instance Hashable.Hashable VariableKind where
+  hashWithSalt __salt (VariableKind_global_ _global_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _global_)
+  hashWithSalt __salt (VariableKind_local _local)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _local)
+  hashWithSalt __salt (VariableKind_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _field)
+  hashWithSalt __salt (VariableKind_ivar _ivar)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _ivar)
+  hashWithSalt __salt VariableKind_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data VariableDeclaration_key = VariableDeclaration_key{variableDeclaration_key_name
+                                                       :: QName,
+                                                       variableDeclaration_key_type :: Type,
+                                                       variableDeclaration_key_kind :: VariableKind,
+                                                       variableDeclaration_key_source ::
+                                                       Glean.Schema.Src.Range}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration_key where
+  toJSON
+    (VariableDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "kind" .= __field__kind :
+               "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration_key where
+  buildStruct _proxy
+    (VariableDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "kind" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__kind)
+               :
+               Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__source)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (VariableDeclaration_key __val__name __val__type
+                                                  __val__kind
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("kind", 3), ("source", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration_key where
+  rnf
+    (VariableDeclaration_key __field__name __field__type __field__kind
+       __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration_key where
+  def
+    = VariableDeclaration_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable VariableDeclaration_key where
+  hashWithSalt __salt
+    (VariableDeclaration_key _name _type _kind _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+           _kind)
+        _source
+
+data EnumeratorLowerCase_key = EnumeratorLowerCase_key{enumeratorLowerCase_key_name_lowercase
+                                                       :: Text.Text,
+                                                       enumeratorLowerCase_key_name :: Text.Text}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorLowerCase_key where
+  toJSON
+    (EnumeratorLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorLowerCase_key where
+  buildStruct _proxy
+    (EnumeratorLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (EnumeratorLowerCase_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorLowerCase_key where
+  rnf (EnumeratorLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EnumeratorLowerCase_key where
+  def = EnumeratorLowerCase_key "" ""
+
+instance Hashable.Hashable EnumeratorLowerCase_key where
+  hashWithSalt __salt (EnumeratorLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data EnumeratorInEnum_key = EnumeratorInEnum_key{enumeratorInEnum_key_enumerator
+                                                 :: Enumerator,
+                                                 enumeratorInEnum_key_enum_ :: EnumDefinition}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorInEnum_key where
+  toJSON (EnumeratorInEnum_key __field__enumerator __field__enum_)
+    = Aeson.object
+        ("enumerator" .= __field__enumerator :
+           "enum_" .= __field__enum_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorInEnum_key where
+  buildStruct _proxy
+    (EnumeratorInEnum_key __field__enumerator __field__enum_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "enumerator" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__enumerator)
+           :
+           Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__enum_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__enumerator <- ST.newSTRef Default.def
+            __field__enum_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumerator
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__enum_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__enumerator <- ST.readSTRef
+                                                                     __field__enumerator
+                                             !__val__enum_ <- ST.readSTRef __field__enum_
+                                             Prelude.pure
+                                               (EnumeratorInEnum_key __val__enumerator __val__enum_)
+              _idMap = HashMap.fromList [("enumerator", 1), ("enum_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorInEnum_key where
+  rnf (EnumeratorInEnum_key __field__enumerator __field__enum_)
+    = DeepSeq.rnf __field__enumerator `Prelude.seq`
+        DeepSeq.rnf __field__enum_ `Prelude.seq` ()
+
+instance Default.Default EnumeratorInEnum_key where
+  def = EnumeratorInEnum_key Default.def Default.def
+
+instance Hashable.Hashable EnumeratorInEnum_key where
+  hashWithSalt __salt (EnumeratorInEnum_key _enumerator _enum_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _enumerator)
+        _enum_
+
+data EnumeratorByName_key = EnumeratorByName_key{enumeratorByName_key_name
+                                                 :: Text.Text,
+                                                 enumeratorByName_key_decl :: Enumerator}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumeratorByName_key where
+  toJSON (EnumeratorByName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumeratorByName_key where
+  buildStruct _proxy
+    (EnumeratorByName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (EnumeratorByName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumeratorByName_key where
+  rnf (EnumeratorByName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default EnumeratorByName_key where
+  def = EnumeratorByName_key "" Default.def
+
+instance Hashable.Hashable EnumeratorByName_key where
+  hashWithSalt __salt (EnumeratorByName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data Enumerator_key = Enumerator_key{enumerator_key_name :: Name,
+                                     enumerator_key_enumeration :: EnumDeclaration,
+                                     enumerator_key_source :: Glean.Schema.Src.Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enumerator_key where
+  toJSON
+    (Enumerator_key __field__name __field__enumeration __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "enumeration" .= __field__enumeration :
+             "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct Enumerator_key where
+  buildStruct _proxy
+    (Enumerator_key __field__name __field__enumeration __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "enumeration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__enumeration)
+             :
+             Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__source)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__enumeration <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumeration
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__enumeration <- ST.readSTRef
+                                                                      __field__enumeration
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (Enumerator_key __val__name __val__enumeration
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList [("name", 1), ("enumeration", 2), ("source", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Enumerator_key where
+  rnf
+    (Enumerator_key __field__name __field__enumeration __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__enumeration `Prelude.seq`
+          DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default Enumerator_key where
+  def = Enumerator_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Enumerator_key where
+  hashWithSalt __salt (Enumerator_key _name _enumeration _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _enumeration)
+        _source
+
+data EnumLowerCase_key = EnumLowerCase_key{enumLowerCase_key_name_lowercase
+                                           :: Text.Text,
+                                           enumLowerCase_key_name :: Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumLowerCase_key where
+  toJSON (EnumLowerCase_key __field__name_lowercase __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumLowerCase_key where
+  buildStruct _proxy
+    (EnumLowerCase_key __field__name_lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (EnumLowerCase_key __val__name_lowercase __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumLowerCase_key where
+  rnf (EnumLowerCase_key __field__name_lowercase __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EnumLowerCase_key where
+  def = EnumLowerCase_key "" ""
+
+instance Hashable.Hashable EnumLowerCase_key where
+  hashWithSalt __salt (EnumLowerCase_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data EnumDefinition_key = EnumDefinition_key{enumDefinition_key_declaration
+                                             :: EnumDeclaration,
+                                             enumDefinition_key_enumerators :: [Enumerator]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDefinition_key where
+  toJSON
+    (EnumDefinition_key __field__declaration __field__enumerators)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "enumerators" .= __field__enumerators : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDefinition_key where
+  buildStruct _proxy
+    (EnumDefinition_key __field__declaration __field__enumerators)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "enumerators" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__enumerators)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__enumerators <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__enumerators
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__enumerators <- ST.readSTRef
+                                                                      __field__enumerators
+                                             Prelude.pure
+                                               (EnumDefinition_key __val__declaration
+                                                  __val__enumerators)
+              _idMap = HashMap.fromList [("declaration", 1), ("enumerators", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDefinition_key where
+  rnf (EnumDefinition_key __field__declaration __field__enumerators)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__enumerators `Prelude.seq` ()
+
+instance Default.Default EnumDefinition_key where
+  def = EnumDefinition_key Default.def Default.def
+
+instance Hashable.Hashable EnumDefinition_key where
+  hashWithSalt __salt (EnumDefinition_key _declaration _enumerators)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _enumerators
+
+data EnumDeclaration_key = EnumDeclaration_key{enumDeclaration_key_name
+                                               :: QName,
+                                               enumDeclaration_key_isScoped :: Prelude.Bool,
+                                               enumDeclaration_key_type :: Prelude.Maybe Type,
+                                               enumDeclaration_key_source :: Glean.Schema.Src.Range}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration_key where
+  toJSON
+    (EnumDeclaration_key __field__name __field__isScoped __field__type
+       __field__source)
+    = Aeson.object
+        ("name" .= __field__name :
+           "isScoped" .= __field__isScoped :
+             Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+               ("source" .= __field__source : Prelude.mempty))
+
+instance Thrift.ThriftStruct EnumDeclaration_key where
+  buildStruct _proxy
+    (EnumDeclaration_key __field__name __field__isScoped __field__type
+       __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genFieldBool _proxy "isScoped" 2 1 __field__isScoped :
+             let (__cereal__type, __id__type)
+                   = case __field__type of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "type"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__type
+                 (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4
+                    __id__type
+                    (Thrift.buildStruct _proxy __field__source)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__isScoped <- ST.newSTRef Prelude.False
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isScoped
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__isScoped <- ST.readSTRef __field__isScoped
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (EnumDeclaration_key __val__name __val__isScoped
+                                                  __val__type
+                                                  __val__source)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("isScoped", 2), ("type", 3), ("source", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration_key where
+  rnf
+    (EnumDeclaration_key __field__name __field__isScoped __field__type
+       __field__source)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__isScoped `Prelude.seq`
+          DeepSeq.rnf __field__type `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration_key where
+  def
+    = EnumDeclaration_key Default.def Prelude.False Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable EnumDeclaration_key where
+  hashWithSalt __salt
+    (EnumDeclaration_key _name _isScoped _type _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _isScoped)
+           _type)
+        _source
+
+data DefinitionEntity = DefinitionEntity_record_ RecordDefinition
+                      | DefinitionEntity_function_ FunctionDefinition
+                      | DefinitionEntity_enum_ EnumDefinition
+                      | DefinitionEntity_objcMethod ObjcMethodDefinition
+                      | DefinitionEntity_objcContainer ObjcContainerDefinition
+                      | DefinitionEntity_variable VariableDeclaration
+                      | DefinitionEntity_namespace_ NamespaceDefinition
+                      | DefinitionEntity_EMPTY
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionEntity where
+  toJSON (DefinitionEntity_record_ __record_)
+    = Aeson.object ["record_" .= __record_]
+  toJSON (DefinitionEntity_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (DefinitionEntity_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (DefinitionEntity_objcMethod __objcMethod)
+    = Aeson.object ["objcMethod" .= __objcMethod]
+  toJSON (DefinitionEntity_objcContainer __objcContainer)
+    = Aeson.object ["objcContainer" .= __objcContainer]
+  toJSON (DefinitionEntity_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (DefinitionEntity_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON DefinitionEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct DefinitionEntity where
+  buildStruct _proxy (DefinitionEntity_record_ __record_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "record_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __record_)]
+  buildStruct _proxy (DefinitionEntity_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (DefinitionEntity_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (DefinitionEntity_objcMethod __objcMethod)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcMethod" (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __objcMethod)]
+  buildStruct _proxy (DefinitionEntity_objcContainer __objcContainer)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcContainer"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __objcContainer)]
+  buildStruct _proxy (DefinitionEntity_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 6
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (DefinitionEntity_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           7
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy DefinitionEntity_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_record_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_function_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_enum_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_objcMethod _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_objcContainer _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_variable _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DefinitionEntity_namespace_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return DefinitionEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return DefinitionEntity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("record_", 1), ("function_", 2), ("enum_", 3), ("objcMethod", 4),
+             ("objcContainer", 5), ("variable", 6), ("namespace_", 7)]
+
+instance DeepSeq.NFData DefinitionEntity where
+  rnf (DefinitionEntity_record_ __record_) = DeepSeq.rnf __record_
+  rnf (DefinitionEntity_function_ __function_)
+    = DeepSeq.rnf __function_
+  rnf (DefinitionEntity_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (DefinitionEntity_objcMethod __objcMethod)
+    = DeepSeq.rnf __objcMethod
+  rnf (DefinitionEntity_objcContainer __objcContainer)
+    = DeepSeq.rnf __objcContainer
+  rnf (DefinitionEntity_variable __variable) = DeepSeq.rnf __variable
+  rnf (DefinitionEntity_namespace_ __namespace_)
+    = DeepSeq.rnf __namespace_
+  rnf DefinitionEntity_EMPTY = ()
+
+instance Default.Default DefinitionEntity where
+  def = DefinitionEntity_EMPTY
+
+instance Hashable.Hashable DefinitionEntity where
+  hashWithSalt __salt (DefinitionEntity_record_ _record_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _record_)
+  hashWithSalt __salt (DefinitionEntity_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _function_)
+  hashWithSalt __salt (DefinitionEntity_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _enum_)
+  hashWithSalt __salt (DefinitionEntity_objcMethod _objcMethod)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _objcMethod)
+  hashWithSalt __salt (DefinitionEntity_objcContainer _objcContainer)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _objcContainer)
+  hashWithSalt __salt (DefinitionEntity_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _variable)
+  hashWithSalt __salt (DefinitionEntity_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 7 _namespace_)
+  hashWithSalt __salt DefinitionEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DefnInRecord_key = DefnInRecord_key{defnInRecord_key_defn ::
+                                         DefinitionEntity,
+                                         defnInRecord_key_record :: RecordDefinition}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefnInRecord_key where
+  toJSON (DefnInRecord_key __field__defn __field__record)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "record" .= __field__record : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefnInRecord_key where
+  buildStruct _proxy (DefnInRecord_key __field__defn __field__record)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "record" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__record)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__record <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__record
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__record <- ST.readSTRef __field__record
+                                             Prelude.pure
+                                               (DefnInRecord_key __val__defn __val__record)
+              _idMap = HashMap.fromList [("defn", 1), ("record", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefnInRecord_key where
+  rnf (DefnInRecord_key __field__defn __field__record)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__record `Prelude.seq` ()
+
+instance Default.Default DefnInRecord_key where
+  def = DefnInRecord_key Default.def Default.def
+
+instance Hashable.Hashable DefnInRecord_key where
+  hashWithSalt __salt (DefnInRecord_key _defn _record)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn)
+        _record
+
+data Declaration = Declaration_namespace_ NamespaceDeclaration
+                 | Declaration_usingDeclaration UsingDeclaration
+                 | Declaration_usingDirective UsingDirective
+                 | Declaration_record_ RecordDeclaration
+                 | Declaration_enum_ EnumDeclaration
+                 | Declaration_function_ FunctionDeclaration
+                 | Declaration_variable VariableDeclaration
+                 | Declaration_objcContainer ObjcContainerDeclaration
+                 | Declaration_objcMethod ObjcMethodDeclaration
+                 | Declaration_objcProperty ObjcPropertyDeclaration
+                 | Declaration_typeAlias TypeAliasDeclaration
+                 | Declaration_namespaceAlias NamespaceAliasDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON (Declaration_usingDeclaration __usingDeclaration)
+    = Aeson.object ["usingDeclaration" .= __usingDeclaration]
+  toJSON (Declaration_usingDirective __usingDirective)
+    = Aeson.object ["usingDirective" .= __usingDirective]
+  toJSON (Declaration_record_ __record_)
+    = Aeson.object ["record_" .= __record_]
+  toJSON (Declaration_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (Declaration_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (Declaration_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (Declaration_objcContainer __objcContainer)
+    = Aeson.object ["objcContainer" .= __objcContainer]
+  toJSON (Declaration_objcMethod __objcMethod)
+    = Aeson.object ["objcMethod" .= __objcMethod]
+  toJSON (Declaration_objcProperty __objcProperty)
+    = Aeson.object ["objcProperty" .= __objcProperty]
+  toJSON (Declaration_typeAlias __typeAlias)
+    = Aeson.object ["typeAlias" .= __typeAlias]
+  toJSON (Declaration_namespaceAlias __namespaceAlias)
+    = Aeson.object ["namespaceAlias" .= __namespaceAlias]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy
+    (Declaration_usingDeclaration __usingDeclaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "usingDeclaration"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __usingDeclaration)]
+  buildStruct _proxy (Declaration_usingDirective __usingDirective)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "usingDirective"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __usingDirective)]
+  buildStruct _proxy (Declaration_record_ __record_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "record_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __record_)]
+  buildStruct _proxy (Declaration_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (Declaration_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 6
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (Declaration_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 7
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (Declaration_objcContainer __objcContainer)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcContainer"
+           (Thrift.getStructType _proxy)
+           8
+           0
+           (Thrift.buildStruct _proxy __objcContainer)]
+  buildStruct _proxy (Declaration_objcMethod __objcMethod)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcMethod" (Thrift.getStructType _proxy)
+           9
+           0
+           (Thrift.buildStruct _proxy __objcMethod)]
+  buildStruct _proxy (Declaration_objcProperty __objcProperty)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcProperty"
+           (Thrift.getStructType _proxy)
+           10
+           0
+           (Thrift.buildStruct _proxy __objcProperty)]
+  buildStruct _proxy (Declaration_typeAlias __typeAlias)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeAlias" (Thrift.getStructType _proxy)
+           11
+           0
+           (Thrift.buildStruct _proxy __typeAlias)]
+  buildStruct _proxy (Declaration_namespaceAlias __namespaceAlias)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespaceAlias"
+           (Thrift.getStructType _proxy)
+           12
+           0
+           (Thrift.buildStruct _proxy __namespaceAlias)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_namespace_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_usingDeclaration _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_usingDirective _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_record_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_enum_ _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_function_ _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_variable _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_objcContainer _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_objcMethod _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_objcProperty _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_typeAlias _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_namespaceAlias _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("namespace_", 1), ("usingDeclaration", 2), ("usingDirective", 3),
+             ("record_", 4), ("enum_", 5), ("function_", 6), ("variable", 7),
+             ("objcContainer", 8), ("objcMethod", 9), ("objcProperty", 10),
+             ("typeAlias", 11), ("namespaceAlias", 12)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_namespace_ __namespace_)
+    = DeepSeq.rnf __namespace_
+  rnf (Declaration_usingDeclaration __usingDeclaration)
+    = DeepSeq.rnf __usingDeclaration
+  rnf (Declaration_usingDirective __usingDirective)
+    = DeepSeq.rnf __usingDirective
+  rnf (Declaration_record_ __record_) = DeepSeq.rnf __record_
+  rnf (Declaration_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (Declaration_function_ __function_) = DeepSeq.rnf __function_
+  rnf (Declaration_variable __variable) = DeepSeq.rnf __variable
+  rnf (Declaration_objcContainer __objcContainer)
+    = DeepSeq.rnf __objcContainer
+  rnf (Declaration_objcMethod __objcMethod)
+    = DeepSeq.rnf __objcMethod
+  rnf (Declaration_objcProperty __objcProperty)
+    = DeepSeq.rnf __objcProperty
+  rnf (Declaration_typeAlias __typeAlias) = DeepSeq.rnf __typeAlias
+  rnf (Declaration_namespaceAlias __namespaceAlias)
+    = DeepSeq.rnf __namespaceAlias
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _namespace_)
+  hashWithSalt __salt
+    (Declaration_usingDeclaration _usingDeclaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _usingDeclaration)
+  hashWithSalt __salt (Declaration_usingDirective _usingDirective)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _usingDirective)
+  hashWithSalt __salt (Declaration_record_ _record_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _record_)
+  hashWithSalt __salt (Declaration_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _enum_)
+  hashWithSalt __salt (Declaration_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _function_)
+  hashWithSalt __salt (Declaration_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _variable)
+  hashWithSalt __salt (Declaration_objcContainer _objcContainer)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 8 _objcContainer)
+  hashWithSalt __salt (Declaration_objcMethod _objcMethod)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 9 _objcMethod)
+  hashWithSalt __salt (Declaration_objcProperty _objcProperty)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 10 _objcProperty)
+  hashWithSalt __salt (Declaration_typeAlias _typeAlias)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 11 _typeAlias)
+  hashWithSalt __salt (Declaration_namespaceAlias _namespaceAlias)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 12 _namespaceAlias)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationComment_key = DeclarationComment_key{declarationComment_key_declaration
+                                                     :: Declaration,
+                                                     declarationComment_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     declarationComment_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment_key where
+  toJSON
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment_key where
+  buildStruct _proxy
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationComment_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment_key where
+  rnf
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationComment_key where
+  def = DeclarationComment_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationComment_key where
+  hashWithSalt __salt
+    (DeclarationComment_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationInTrace_key = DeclarationInTrace_key{declarationInTrace_key_decl
+                                                     :: Declaration,
+                                                     declarationInTrace_key_trace :: Trace}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationInTrace_key where
+  toJSON (DeclarationInTrace_key __field__decl __field__trace)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "trace" .= __field__trace : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationInTrace_key where
+  buildStruct _proxy
+    (DeclarationInTrace_key __field__decl __field__trace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "trace" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__trace)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__trace <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__trace
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__trace <- ST.readSTRef __field__trace
+                                             Prelude.pure
+                                               (DeclarationInTrace_key __val__decl __val__trace)
+              _idMap = HashMap.fromList [("decl", 1), ("trace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationInTrace_key where
+  rnf (DeclarationInTrace_key __field__decl __field__trace)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__trace `Prelude.seq` ()
+
+instance Default.Default DeclarationInTrace_key where
+  def = DeclarationInTrace_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationInTrace_key where
+  hashWithSalt __salt (DeclarationInTrace_key _decl _trace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _trace
+
+data DeclarationLocationName_key = DeclarationLocationName_key{declarationLocationName_key_decl
+                                                               :: Declaration,
+                                                               declarationLocationName_key_source ::
+                                                               Glean.Schema.Src.Range,
+                                                               declarationLocationName_key_name ::
+                                                               Text.Text}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocationName_key where
+  toJSON
+    (DeclarationLocationName_key __field__decl __field__source
+       __field__name)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "source" .= __field__source :
+             "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocationName_key where
+  buildStruct _proxy
+    (DeclarationLocationName_key __field__decl __field__source
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (DeclarationLocationName_key __val__decl
+                                                  __val__source
+                                                  __val__name)
+              _idMap = HashMap.fromList [("decl", 1), ("source", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocationName_key where
+  rnf
+    (DeclarationLocationName_key __field__decl __field__source
+       __field__name)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default DeclarationLocationName_key where
+  def = DeclarationLocationName_key Default.def Default.def ""
+
+instance Hashable.Hashable DeclarationLocationName_key where
+  hashWithSalt __salt
+    (DeclarationLocationName_key _decl _source _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+           _source)
+        _name
+
+data DeclarationLocationNameSpan_key = DeclarationLocationNameSpan_key{declarationLocationNameSpan_key_decl
+                                                                       :: Declaration,
+                                                                       declarationLocationNameSpan_key_source
+                                                                       :: Glean.Schema.Src.Range,
+                                                                       declarationLocationNameSpan_key_name
+                                                                       :: Text.Text,
+                                                                       declarationLocationNameSpan_key_file
+                                                                       :: Glean.Schema.Src.File,
+                                                                       declarationLocationNameSpan_key_span
+                                                                       :: Glean.Schema.Src.ByteSpan}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocationNameSpan_key where
+  toJSON
+    (DeclarationLocationNameSpan_key __field__decl __field__source
+       __field__name __field__file __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "source" .= __field__source :
+             "name" .= __field__name :
+               "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocationNameSpan_key where
+  buildStruct _proxy
+    (DeclarationLocationNameSpan_key __field__decl __field__source
+       __field__name __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__name)
+               :
+               Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__file)
+                 :
+                 Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__span)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocationNameSpan_key __val__decl
+                                                  __val__source
+                                                  __val__name
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("decl", 1), ("source", 2), ("name", 3), ("file", 4), ("span", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocationNameSpan_key where
+  rnf
+    (DeclarationLocationNameSpan_key __field__decl __field__source
+       __field__name __field__file __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__file `Prelude.seq`
+              DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocationNameSpan_key where
+  def
+    = DeclarationLocationNameSpan_key Default.def Default.def ""
+        Default.def
+        Default.def
+
+instance Hashable.Hashable DeclarationLocationNameSpan_key where
+  hashWithSalt __salt
+    (DeclarationLocationNameSpan_key _decl _source _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+                 _source)
+              _name)
+           _file)
+        _span
+
+data DeclarationNameSpan_key = DeclarationNameSpan_key{declarationNameSpan_key_decl
+                                                       :: Declaration,
+                                                       declarationNameSpan_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationNameSpan_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan_key where
+  toJSON
+    (DeclarationNameSpan_key __field__decl __field__file __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan_key where
+  buildStruct _proxy
+    (DeclarationNameSpan_key __field__decl __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationNameSpan_key __val__decl __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan_key where
+  rnf
+    (DeclarationNameSpan_key __field__decl __field__file __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan_key where
+  def = DeclarationNameSpan_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationNameSpan_key where
+  hashWithSalt __salt (DeclarationNameSpan_key _decl _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+        _span
+
+data DeclarationSources_key = DeclarationSources_key{declarationSources_key_target
+                                                     :: Declaration,
+                                                     declarationSources_key_sources ::
+                                                     [Declaration]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSources_key where
+  toJSON (DeclarationSources_key __field__target __field__sources)
+    = Aeson.object
+        ("target" .= __field__target :
+           "sources" .= __field__sources : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSources_key where
+  buildStruct _proxy
+    (DeclarationSources_key __field__target __field__sources)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "sources" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__sources)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__sources <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__sources
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__sources <- ST.readSTRef __field__sources
+                                             Prelude.pure
+                                               (DeclarationSources_key __val__target __val__sources)
+              _idMap = HashMap.fromList [("target", 1), ("sources", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSources_key where
+  rnf (DeclarationSources_key __field__target __field__sources)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__sources `Prelude.seq` ()
+
+instance Default.Default DeclarationSources_key where
+  def = DeclarationSources_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationSources_key where
+  hashWithSalt __salt (DeclarationSources_key _target _sources)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _sources
+
+data DeclarationSrcRange_key = DeclarationSrcRange_key{declarationSrcRange_key_decl
+                                                       :: Declaration,
+                                                       declarationSrcRange_key_source ::
+                                                       Glean.Schema.Src.Range}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSrcRange_key where
+  toJSON (DeclarationSrcRange_key __field__decl __field__source)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSrcRange_key where
+  buildStruct _proxy
+    (DeclarationSrcRange_key __field__decl __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (DeclarationSrcRange_key __val__decl __val__source)
+              _idMap = HashMap.fromList [("decl", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSrcRange_key where
+  rnf (DeclarationSrcRange_key __field__decl __field__source)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default DeclarationSrcRange_key where
+  def = DeclarationSrcRange_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationSrcRange_key where
+  hashWithSalt __salt (DeclarationSrcRange_key _decl _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _source
+
+data DeclarationTargets_key = DeclarationTargets_key{declarationTargets_key_source
+                                                     :: Declaration,
+                                                     declarationTargets_key_targets ::
+                                                     [Declaration]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationTargets_key where
+  toJSON (DeclarationTargets_key __field__source __field__targets)
+    = Aeson.object
+        ("source" .= __field__source :
+           "targets" .= __field__targets : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationTargets_key where
+  buildStruct _proxy
+    (DeclarationTargets_key __field__source __field__targets)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "targets" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__targets)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__targets <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__targets
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__targets <- ST.readSTRef __field__targets
+                                             Prelude.pure
+                                               (DeclarationTargets_key __val__source __val__targets)
+              _idMap = HashMap.fromList [("source", 1), ("targets", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationTargets_key where
+  rnf (DeclarationTargets_key __field__source __field__targets)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__targets `Prelude.seq` ()
+
+instance Default.Default DeclarationTargets_key where
+  def = DeclarationTargets_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationTargets_key where
+  hashWithSalt __salt (DeclarationTargets_key _source _targets)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _targets
+
+data DeclarationToUSR_key = DeclarationToUSR_key{declarationToUSR_key_declaration
+                                                 :: Declaration,
+                                                 declarationToUSR_key_usr :: USR}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationToUSR_key where
+  toJSON (DeclarationToUSR_key __field__declaration __field__usr)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "usr" .= __field__usr : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationToUSR_key where
+  buildStruct _proxy
+    (DeclarationToUSR_key __field__declaration __field__usr)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "usr" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__usr)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__usr <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__usr
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__usr <- ST.readSTRef __field__usr
+                                             Prelude.pure
+                                               (DeclarationToUSR_key __val__declaration __val__usr)
+              _idMap = HashMap.fromList [("declaration", 1), ("usr", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationToUSR_key where
+  rnf (DeclarationToUSR_key __field__declaration __field__usr)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__usr `Prelude.seq` ()
+
+instance Default.Default DeclarationToUSR_key where
+  def = DeclarationToUSR_key Default.def ""
+
+instance Hashable.Hashable DeclarationToUSR_key where
+  hashWithSalt __salt (DeclarationToUSR_key _declaration _usr)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _usr
+
+data DefToBaseDecl_key = DefToBaseDecl_key{defToBaseDecl_key_defn
+                                           :: DefinitionEntity,
+                                           defToBaseDecl_key_decl :: Declaration}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefToBaseDecl_key where
+  toJSON (DefToBaseDecl_key __field__defn __field__decl)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefToBaseDecl_key where
+  buildStruct _proxy (DefToBaseDecl_key __field__defn __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DefToBaseDecl_key __val__defn __val__decl)
+              _idMap = HashMap.fromList [("defn", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefToBaseDecl_key where
+  rnf (DefToBaseDecl_key __field__defn __field__decl)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DefToBaseDecl_key where
+  def = DefToBaseDecl_key Default.def Default.def
+
+instance Hashable.Hashable DefToBaseDecl_key where
+  hashWithSalt __salt (DefToBaseDecl_key _defn _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _decl
+
+data MangledNameHashToDeclaration_key = MangledNameHashToDeclaration_key{mangledNameHashToDeclaration_key_hash
+                                                                         :: MangledNameHash,
+                                                                         mangledNameHashToDeclaration_key_declaration
+                                                                         :: Declaration}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MangledNameHashToDeclaration_key where
+  toJSON
+    (MangledNameHashToDeclaration_key __field__hash
+       __field__declaration)
+    = Aeson.object
+        ("hash" .= __field__hash :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct MangledNameHashToDeclaration_key where
+  buildStruct _proxy
+    (MangledNameHashToDeclaration_key __field__hash
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__hash)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hash <- ST.newSTRef ""
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (MangledNameHashToDeclaration_key __val__hash
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("hash", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MangledNameHashToDeclaration_key where
+  rnf
+    (MangledNameHashToDeclaration_key __field__hash
+       __field__declaration)
+    = DeepSeq.rnf __field__hash `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default MangledNameHashToDeclaration_key where
+  def = MangledNameHashToDeclaration_key "" Default.def
+
+instance Hashable.Hashable MangledNameHashToDeclaration_key where
+  hashWithSalt __salt
+    (MangledNameHashToDeclaration_key _hash _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hash)
+        _declaration
+
+data Same_key = Same_key{same_key_declaration1 :: Declaration,
+                         same_key_declaration2 :: Declaration}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Same_key where
+  toJSON (Same_key __field__declaration1 __field__declaration2)
+    = Aeson.object
+        ("declaration1" .= __field__declaration1 :
+           "declaration2" .= __field__declaration2 : Prelude.mempty)
+
+instance Thrift.ThriftStruct Same_key where
+  buildStruct _proxy
+    (Same_key __field__declaration1 __field__declaration2)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration1"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration1)
+           :
+           Thrift.genField _proxy "declaration2" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration2)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration1 <- ST.newSTRef Default.def
+            __field__declaration2 <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration1
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration2
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration1 <- ST.readSTRef
+                                                                       __field__declaration1
+                                             !__val__declaration2 <- ST.readSTRef
+                                                                       __field__declaration2
+                                             Prelude.pure
+                                               (Same_key __val__declaration1 __val__declaration2)
+              _idMap
+                = HashMap.fromList [("declaration1", 1), ("declaration2", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Same_key where
+  rnf (Same_key __field__declaration1 __field__declaration2)
+    = DeepSeq.rnf __field__declaration1 `Prelude.seq`
+        DeepSeq.rnf __field__declaration2 `Prelude.seq` ()
+
+instance Default.Default Same_key where
+  def = Same_key Default.def Default.def
+
+instance Hashable.Hashable Same_key where
+  hashWithSalt __salt (Same_key _declaration1 _declaration2)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _declaration1)
+        _declaration2
+
+data USRToDeclaration_key = USRToDeclaration_key{uSRToDeclaration_key_hash
+                                                 :: USR,
+                                                 uSRToDeclaration_key_declaration :: Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON USRToDeclaration_key where
+  toJSON (USRToDeclaration_key __field__hash __field__declaration)
+    = Aeson.object
+        ("hash" .= __field__hash :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct USRToDeclaration_key where
+  buildStruct _proxy
+    (USRToDeclaration_key __field__hash __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__hash)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hash <- ST.newSTRef ""
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (USRToDeclaration_key __val__hash __val__declaration)
+              _idMap = HashMap.fromList [("hash", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData USRToDeclaration_key where
+  rnf (USRToDeclaration_key __field__hash __field__declaration)
+    = DeepSeq.rnf __field__hash `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default USRToDeclaration_key where
+  def = USRToDeclaration_key "" Default.def
+
+instance Hashable.Hashable USRToDeclaration_key where
+  hashWithSalt __salt (USRToDeclaration_key _hash _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hash)
+        _declaration
+
+data XRefTarget = XRefTarget_declaration Declaration
+                | XRefTarget_enumerator Enumerator
+                | XRefTarget_objcSelector ObjcSelector
+                | XRefTarget_objcSelectorSlot ObjcSelectorSlot
+                | XRefTarget_unknown Glean.Schema.Src.Loc
+                | XRefTarget_indirect XRefIndirectTarget
+                | XRefTarget_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTarget where
+  toJSON (XRefTarget_declaration __declaration)
+    = Aeson.object ["declaration" .= __declaration]
+  toJSON (XRefTarget_enumerator __enumerator)
+    = Aeson.object ["enumerator" .= __enumerator]
+  toJSON (XRefTarget_objcSelector __objcSelector)
+    = Aeson.object ["objcSelector" .= __objcSelector]
+  toJSON (XRefTarget_objcSelectorSlot __objcSelectorSlot)
+    = Aeson.object ["objcSelectorSlot" .= __objcSelectorSlot]
+  toJSON (XRefTarget_unknown __unknown)
+    = Aeson.object ["unknown" .= __unknown]
+  toJSON (XRefTarget_indirect __indirect)
+    = Aeson.object ["indirect" .= __indirect]
+  toJSON XRefTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefTarget where
+  buildStruct _proxy (XRefTarget_declaration __declaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __declaration)]
+  buildStruct _proxy (XRefTarget_enumerator __enumerator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enumerator" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __enumerator)]
+  buildStruct _proxy (XRefTarget_objcSelector __objcSelector)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcSelector"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __objcSelector)]
+  buildStruct _proxy (XRefTarget_objcSelectorSlot __objcSelectorSlot)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "objcSelectorSlot"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __objcSelectorSlot)]
+  buildStruct _proxy (XRefTarget_unknown __unknown)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "unknown" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __unknown)]
+  buildStruct _proxy (XRefTarget_indirect __indirect)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "indirect" (Thrift.getStructType _proxy) 6
+           0
+           (Thrift.buildStruct _proxy __indirect)]
+  buildStruct _proxy XRefTarget_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_declaration _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_enumerator _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_objcSelector _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_objcSelectorSlot _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_unknown _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_indirect _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefTarget_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("declaration", 1), ("enumerator", 2), ("objcSelector", 3),
+             ("objcSelectorSlot", 4), ("unknown", 5), ("indirect", 6)]
+
+instance DeepSeq.NFData XRefTarget where
+  rnf (XRefTarget_declaration __declaration)
+    = DeepSeq.rnf __declaration
+  rnf (XRefTarget_enumerator __enumerator) = DeepSeq.rnf __enumerator
+  rnf (XRefTarget_objcSelector __objcSelector)
+    = DeepSeq.rnf __objcSelector
+  rnf (XRefTarget_objcSelectorSlot __objcSelectorSlot)
+    = DeepSeq.rnf __objcSelectorSlot
+  rnf (XRefTarget_unknown __unknown) = DeepSeq.rnf __unknown
+  rnf (XRefTarget_indirect __indirect) = DeepSeq.rnf __indirect
+  rnf XRefTarget_EMPTY = ()
+
+instance Default.Default XRefTarget where
+  def = XRefTarget_EMPTY
+
+instance Hashable.Hashable XRefTarget where
+  hashWithSalt __salt (XRefTarget_declaration _declaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _declaration)
+  hashWithSalt __salt (XRefTarget_enumerator _enumerator)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _enumerator)
+  hashWithSalt __salt (XRefTarget_objcSelector _objcSelector)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _objcSelector)
+  hashWithSalt __salt (XRefTarget_objcSelectorSlot _objcSelectorSlot)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _objcSelectorSlot)
+  hashWithSalt __salt (XRefTarget_unknown _unknown)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _unknown)
+  hashWithSalt __salt (XRefTarget_indirect _indirect)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _indirect)
+  hashWithSalt __salt XRefTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FixedXRef = FixedXRef{fixedXRef_target :: XRefTarget,
+                           fixedXRef_from :: From}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FixedXRef where
+  toJSON (FixedXRef __field__target __field__from)
+    = Aeson.object
+        ("target" .= __field__target :
+           "from" .= __field__from : Prelude.mempty)
+
+instance Thrift.ThriftStruct FixedXRef where
+  buildStruct _proxy (FixedXRef __field__target __field__from)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__from)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__from <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__from <- ST.readSTRef __field__from
+                                             Prelude.pure (FixedXRef __val__target __val__from)
+              _idMap = HashMap.fromList [("target", 1), ("from", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FixedXRef where
+  rnf (FixedXRef __field__target __field__from)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__from `Prelude.seq` ()
+
+instance Default.Default FixedXRef where
+  def = FixedXRef Default.def Default.def
+
+instance Hashable.Hashable FixedXRef where
+  hashWithSalt __salt (FixedXRef _target _from)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _from
+
+data FileXRefMap_key = FileXRefMap_key{fileXRefMap_key_file ::
+                                       Glean.Schema.Src.File,
+                                       fileXRefMap_key_fixed :: [FixedXRef],
+                                       fileXRefMap_key_froms :: [From]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefMap_key where
+  toJSON
+    (FileXRefMap_key __field__file __field__fixed __field__froms)
+    = Aeson.object
+        ("file" .= __field__file :
+           "fixed" .= __field__fixed :
+             "froms" .= __field__froms : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefMap_key where
+  buildStruct _proxy
+    (FileXRefMap_key __field__file __field__fixed __field__froms)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "fixed" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__fixed)
+             :
+             Thrift.genField _proxy "froms" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__froms)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__fixed <- ST.newSTRef Default.def
+            __field__froms <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__fixed
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__froms
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__fixed <- ST.readSTRef __field__fixed
+                                             !__val__froms <- ST.readSTRef __field__froms
+                                             Prelude.pure
+                                               (FileXRefMap_key __val__file __val__fixed
+                                                  __val__froms)
+              _idMap = HashMap.fromList [("file", 1), ("fixed", 2), ("froms", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefMap_key where
+  rnf (FileXRefMap_key __field__file __field__fixed __field__froms)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__fixed `Prelude.seq`
+          DeepSeq.rnf __field__froms `Prelude.seq` ()
+
+instance Default.Default FileXRefMap_key where
+  def = FileXRefMap_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileXRefMap_key where
+  hashWithSalt __salt (FileXRefMap_key _file _fixed _froms)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _fixed)
+        _froms
+
+data SpellingXRef_key = SpellingXRef_key{spellingXRef_key_source ::
+                                         Glean.Schema.Src.FileLocation,
+                                         spellingXRef_key_target :: XRefTarget}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SpellingXRef_key where
+  toJSON (SpellingXRef_key __field__source __field__target)
+    = Aeson.object
+        ("source" .= __field__source :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct SpellingXRef_key where
+  buildStruct _proxy
+    (SpellingXRef_key __field__source __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (SpellingXRef_key __val__source __val__target)
+              _idMap = HashMap.fromList [("source", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SpellingXRef_key where
+  rnf (SpellingXRef_key __field__source __field__target)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default SpellingXRef_key where
+  def = SpellingXRef_key Default.def Default.def
+
+instance Hashable.Hashable SpellingXRef_key where
+  hashWithSalt __salt (SpellingXRef_key _source _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _target
+
+data TargetUses_key = TargetUses_key{targetUses_key_target ::
+                                     XRefTarget,
+                                     targetUses_key_file :: Glean.Schema.Src.File,
+                                     targetUses_key_from :: From}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses_key where
+  toJSON (TargetUses_key __field__target __field__file __field__from)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "from" .= __field__from : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses_key where
+  buildStruct _proxy
+    (TargetUses_key __field__target __field__file __field__from)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__from)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__from <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__from <- ST.readSTRef __field__from
+                                             Prelude.pure
+                                               (TargetUses_key __val__target __val__file
+                                                  __val__from)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("from", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses_key where
+  rnf (TargetUses_key __field__target __field__file __field__from)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__from `Prelude.seq` ()
+
+instance Default.Default TargetUses_key where
+  def = TargetUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetUses_key where
+  hashWithSalt __salt (TargetUses_key _target _file _from)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _from
+
+data ThriftToCxx_key = ThriftToCxx_key{thriftToCxx_key_to ::
+                                       Glean.Schema.Fbthrift.Declaration,
+                                       thriftToCxx_key_from :: XRefTarget}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftToCxx_key where
+  toJSON (ThriftToCxx_key __field__to __field__from)
+    = Aeson.object
+        ("to" .= __field__to : "from" .= __field__from : Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftToCxx_key where
+  buildStruct _proxy (ThriftToCxx_key __field__to __field__from)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__to)
+           :
+           Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__from)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__to <- ST.newSTRef Default.def
+            __field__from <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__to <- ST.readSTRef __field__to
+                                             !__val__from <- ST.readSTRef __field__from
+                                             Prelude.pure (ThriftToCxx_key __val__to __val__from)
+              _idMap = HashMap.fromList [("to", 1), ("from", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftToCxx_key where
+  rnf (ThriftToCxx_key __field__to __field__from)
+    = DeepSeq.rnf __field__to `Prelude.seq`
+        DeepSeq.rnf __field__from `Prelude.seq` ()
+
+instance Default.Default ThriftToCxx_key where
+  def = ThriftToCxx_key Default.def Default.def
+
+instance Hashable.Hashable ThriftToCxx_key where
+  hashWithSalt __salt (ThriftToCxx_key _to _from)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _to) _from
+
+data XRefIndirectTarget_key = XRefIndirectTarget_key{xRefIndirectTarget_key_via
+                                                     :: XRefVia,
+                                                     xRefIndirectTarget_key_target :: XRefTarget}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefIndirectTarget_key where
+  toJSON (XRefIndirectTarget_key __field__via __field__target)
+    = Aeson.object
+        ("via" .= __field__via :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefIndirectTarget_key where
+  buildStruct _proxy
+    (XRefIndirectTarget_key __field__via __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "via" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__via)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__via <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__via
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__via <- ST.readSTRef __field__via
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (XRefIndirectTarget_key __val__via __val__target)
+              _idMap = HashMap.fromList [("via", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefIndirectTarget_key where
+  rnf (XRefIndirectTarget_key __field__via __field__target)
+    = DeepSeq.rnf __field__via `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default XRefIndirectTarget_key where
+  def = XRefIndirectTarget_key Default.def Default.def
+
+instance Hashable.Hashable XRefIndirectTarget_key where
+  hashWithSalt __salt (XRefIndirectTarget_key _via _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _via) _target
+
+data DeclToFamily_key = DeclToFamily_key{declToFamily_key_decl ::
+                                         Declaration,
+                                         declToFamily_key_family :: DeclFamily}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclToFamily_key where
+  toJSON (DeclToFamily_key __field__decl __field__family)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "family" .= __field__family : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclToFamily_key where
+  buildStruct _proxy (DeclToFamily_key __field__decl __field__family)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "family" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__family)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__family <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__family
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__family <- ST.readSTRef __field__family
+                                             Prelude.pure
+                                               (DeclToFamily_key __val__decl __val__family)
+              _idMap = HashMap.fromList [("decl", 1), ("family", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclToFamily_key where
+  rnf (DeclToFamily_key __field__decl __field__family)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__family `Prelude.seq` ()
+
+instance Default.Default DeclToFamily_key where
+  def = DeclToFamily_key Default.def Default.def
+
+instance Hashable.Hashable DeclToFamily_key where
+  hashWithSalt __salt (DeclToFamily_key _decl _family)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _family
+
+data DeclInRecord_key = DeclInRecord_key{declInRecord_key_decl ::
+                                         Declaration,
+                                         declInRecord_key_record :: RecordDefinition}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclInRecord_key where
+  toJSON (DeclInRecord_key __field__decl __field__record)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "record" .= __field__record : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclInRecord_key where
+  buildStruct _proxy (DeclInRecord_key __field__decl __field__record)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "record" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__record)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__record <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__record
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__record <- ST.readSTRef __field__record
+                                             Prelude.pure
+                                               (DeclInRecord_key __val__decl __val__record)
+              _idMap = HashMap.fromList [("decl", 1), ("record", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclInRecord_key where
+  rnf (DeclInRecord_key __field__decl __field__record)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__record `Prelude.seq` ()
+
+instance Default.Default DeclInRecord_key where
+  def = DeclInRecord_key Default.def Default.def
+
+instance Hashable.Hashable DeclInRecord_key where
+  hashWithSalt __salt (DeclInRecord_key _decl _record)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _record
+
+data DeclInObjcContainer_key = DeclInObjcContainer_key{declInObjcContainer_key_decl
+                                                       :: Declaration,
+                                                       declInObjcContainer_key_record ::
+                                                       ObjcContainerDefinition}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclInObjcContainer_key where
+  toJSON (DeclInObjcContainer_key __field__decl __field__record)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "record" .= __field__record : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclInObjcContainer_key where
+  buildStruct _proxy
+    (DeclInObjcContainer_key __field__decl __field__record)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "record" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__record)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__record <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__record
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__record <- ST.readSTRef __field__record
+                                             Prelude.pure
+                                               (DeclInObjcContainer_key __val__decl __val__record)
+              _idMap = HashMap.fromList [("decl", 1), ("record", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclInObjcContainer_key where
+  rnf (DeclInObjcContainer_key __field__decl __field__record)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__record `Prelude.seq` ()
+
+instance Default.Default DeclInObjcContainer_key where
+  def = DeclInObjcContainer_key Default.def Default.def
+
+instance Hashable.Hashable DeclInObjcContainer_key where
+  hashWithSalt __salt (DeclInObjcContainer_key _decl _record)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _record
+
+data DeclFamilyOf_key = DeclFamilyOf_key{declFamilyOf_key_decl ::
+                                         Declaration,
+                                         declFamilyOf_key_family :: Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclFamilyOf_key where
+  toJSON (DeclFamilyOf_key __field__decl __field__family)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "family" .= __field__family : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclFamilyOf_key where
+  buildStruct _proxy (DeclFamilyOf_key __field__decl __field__family)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "family" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__family)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__family <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__family
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__family <- ST.readSTRef __field__family
+                                             Prelude.pure
+                                               (DeclFamilyOf_key __val__decl __val__family)
+              _idMap = HashMap.fromList [("decl", 1), ("family", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclFamilyOf_key where
+  rnf (DeclFamilyOf_key __field__decl __field__family)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__family `Prelude.seq` ()
+
+instance Default.Default DeclFamilyOf_key where
+  def = DeclFamilyOf_key Default.def Default.def
+
+instance Hashable.Hashable DeclFamilyOf_key where
+  hashWithSalt __salt (DeclFamilyOf_key _decl _family)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _family
+
+data CxxToThrift_key = CxxToThrift_key{cxxToThrift_key_from ::
+                                       XRefTarget,
+                                       cxxToThrift_key_to :: Glean.Schema.Fbthrift.Declaration}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxToThrift_key where
+  toJSON (CxxToThrift_key __field__from __field__to)
+    = Aeson.object
+        ("from" .= __field__from : "to" .= __field__to : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxToThrift_key where
+  buildStruct _proxy (CxxToThrift_key __field__from __field__to)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__from)
+           :
+           Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__to)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from <- ST.newSTRef Default.def
+            __field__to <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from <- ST.readSTRef __field__from
+                                             !__val__to <- ST.readSTRef __field__to
+                                             Prelude.pure (CxxToThrift_key __val__from __val__to)
+              _idMap = HashMap.fromList [("from", 1), ("to", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxToThrift_key where
+  rnf (CxxToThrift_key __field__from __field__to)
+    = DeepSeq.rnf __field__from `Prelude.seq`
+        DeepSeq.rnf __field__to `Prelude.seq` ()
+
+instance Default.Default CxxToThrift_key where
+  def = CxxToThrift_key Default.def Default.def
+
+instance Hashable.Hashable CxxToThrift_key where
+  hashWithSalt __salt (CxxToThrift_key _from _to)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from) _to
+
+data Access = Access_Public
+            | Access_Protected
+            | Access_Private
+            | Access__UNKNOWN Prelude.Int
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Access where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Access where
+  rnf __Access = Prelude.seq __Access ()
+
+instance Default.Default Access where
+  def = Access_Public
+
+instance Hashable.Hashable Access where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Access where
+  toThriftEnum 0 = Access_Public
+  toThriftEnum 1 = Access_Protected
+  toThriftEnum 2 = Access_Private
+  toThriftEnum val = Access__UNKNOWN val
+  fromThriftEnum Access_Public = 0
+  fromThriftEnum Access_Protected = 1
+  fromThriftEnum Access_Private = 2
+  fromThriftEnum (Access__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Access_Public, Access_Protected, Access_Private]
+  toThriftEnumEither 0 = Prelude.Right Access_Public
+  toThriftEnumEither 1 = Prelude.Right Access_Protected
+  toThriftEnumEither 2 = Prelude.Right Access_Private
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Access: " ++
+           Prelude.show val)
+
+data RecordBase = RecordBase{recordBase_base :: RecordDeclaration,
+                             recordBase_access :: Access, recordBase_isVirtual :: Prelude.Bool}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordBase where
+  toJSON
+    (RecordBase __field__base __field__access __field__isVirtual)
+    = Aeson.object
+        ("base" .= __field__base :
+           "access" .= __field__access :
+             "isVirtual" .= __field__isVirtual : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordBase where
+  buildStruct _proxy
+    (RecordBase __field__base __field__access __field__isVirtual)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "access" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__access)
+             :
+             Thrift.genFieldBool _proxy "isVirtual" 3 2 __field__isVirtual : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__access <- ST.newSTRef Default.def
+            __field__isVirtual <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Access")
+                                                                        ST.writeSTRef
+                                                                          __field__access
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVirtual
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__access <- ST.readSTRef __field__access
+                                             !__val__isVirtual <- ST.readSTRef __field__isVirtual
+                                             Prelude.pure
+                                               (RecordBase __val__base __val__access
+                                                  __val__isVirtual)
+              _idMap
+                = HashMap.fromList [("base", 1), ("access", 2), ("isVirtual", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordBase where
+  rnf (RecordBase __field__base __field__access __field__isVirtual)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__access `Prelude.seq`
+          DeepSeq.rnf __field__isVirtual `Prelude.seq` ()
+
+instance Default.Default RecordBase where
+  def = RecordBase Default.def Default.def Prelude.False
+
+instance Hashable.Hashable RecordBase where
+  hashWithSalt __salt (RecordBase _base _access _isVirtual)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+           _access)
+        _isVirtual
+
+data RecordDefinition_key = RecordDefinition_key{recordDefinition_key_declaration
+                                                 :: RecordDeclaration,
+                                                 recordDefinition_key_bases :: [RecordBase],
+                                                 recordDefinition_key_members :: Declarations}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDefinition_key where
+  toJSON
+    (RecordDefinition_key __field__declaration __field__bases
+       __field__members)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "bases" .= __field__bases :
+             "members" .= __field__members : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDefinition_key where
+  buildStruct _proxy
+    (RecordDefinition_key __field__declaration __field__bases
+       __field__members)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "bases" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__bases)
+             :
+             Thrift.genField _proxy "members" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__members)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__bases <- ST.newSTRef Default.def
+            __field__members <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__bases
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__bases <- ST.readSTRef __field__bases
+                                             !__val__members <- ST.readSTRef __field__members
+                                             Prelude.pure
+                                               (RecordDefinition_key __val__declaration __val__bases
+                                                  __val__members)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("bases", 2), ("members", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDefinition_key where
+  rnf
+    (RecordDefinition_key __field__declaration __field__bases
+       __field__members)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__bases `Prelude.seq`
+          DeepSeq.rnf __field__members `Prelude.seq` ()
+
+instance Default.Default RecordDefinition_key where
+  def = RecordDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable RecordDefinition_key where
+  hashWithSalt __salt
+    (RecordDefinition_key _declaration _bases _members)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _bases)
+        _members
+
+data Scope_recordWithAccess_ = Scope_recordWithAccess_{scope_recordWithAccess__record
+                                                       :: QName,
+                                                       scope_recordWithAccess__access :: Access}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Scope_recordWithAccess_ where
+  toJSON (Scope_recordWithAccess_ __field__record __field__access)
+    = Aeson.object
+        ("record" .= __field__record :
+           "access" .= __field__access : Prelude.mempty)
+
+instance Thrift.ThriftStruct Scope_recordWithAccess_ where
+  buildStruct _proxy
+    (Scope_recordWithAccess_ __field__record __field__access)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "record" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__record)
+           :
+           Thrift.genField _proxy "access" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__access)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__record <- ST.newSTRef Default.def
+            __field__access <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__record
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Access")
+                                                                        ST.writeSTRef
+                                                                          __field__access
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__record <- ST.readSTRef
+                                                                 __field__record
+                                             !__val__access <- ST.readSTRef __field__access
+                                             Prelude.pure
+                                               (Scope_recordWithAccess_ __val__record __val__access)
+              _idMap = HashMap.fromList [("record", 1), ("access", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Scope_recordWithAccess_ where
+  rnf (Scope_recordWithAccess_ __field__record __field__access)
+    = DeepSeq.rnf __field__record `Prelude.seq`
+        DeepSeq.rnf __field__access `Prelude.seq` ()
+
+instance Default.Default Scope_recordWithAccess_ where
+  def = Scope_recordWithAccess_ Default.def Default.def
+
+instance Hashable.Hashable Scope_recordWithAccess_ where
+  hashWithSalt __salt (Scope_recordWithAccess_ _record _access)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _record)
+        _access
+
+data Scope = Scope_global_ Glean.Schema.Builtin.Unit
+           | Scope_namespace_ NamespaceQName
+           | Scope_recordWithAccess Scope_recordWithAccess_
+           | Scope_local FunctionQName
+           | Scope_EMPTY
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Scope where
+  toJSON (Scope_global_ __global_)
+    = Aeson.object ["global_" .= __global_]
+  toJSON (Scope_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON (Scope_recordWithAccess __recordWithAccess)
+    = Aeson.object ["recordWithAccess" .= __recordWithAccess]
+  toJSON (Scope_local __local) = Aeson.object ["local" .= __local]
+  toJSON Scope_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Scope where
+  buildStruct _proxy (Scope_global_ __global_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "global_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __global_)]
+  buildStruct _proxy (Scope_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy (Scope_recordWithAccess __recordWithAccess)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "recordWithAccess"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __recordWithAccess)]
+  buildStruct _proxy (Scope_local __local)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __local)]
+  buildStruct _proxy Scope_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Scope_global_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Scope_namespace_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Scope_recordWithAccess _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Scope_local _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Scope_EMPTY
+           Thrift.FieldEnd -> Prelude.return Scope_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("global_", 1), ("namespace_", 2), ("recordWithAccess", 3),
+             ("local", 4)]
+
+instance DeepSeq.NFData Scope where
+  rnf (Scope_global_ __global_) = DeepSeq.rnf __global_
+  rnf (Scope_namespace_ __namespace_) = DeepSeq.rnf __namespace_
+  rnf (Scope_recordWithAccess __recordWithAccess)
+    = DeepSeq.rnf __recordWithAccess
+  rnf (Scope_local __local) = DeepSeq.rnf __local
+  rnf Scope_EMPTY = ()
+
+instance Default.Default Scope where
+  def = Scope_EMPTY
+
+instance Hashable.Hashable Scope where
+  hashWithSalt __salt (Scope_global_ _global_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _global_)
+  hashWithSalt __salt (Scope_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _namespace_)
+  hashWithSalt __salt (Scope_recordWithAccess _recordWithAccess)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _recordWithAccess)
+  hashWithSalt __salt (Scope_local _local)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _local)
+  hashWithSalt __salt Scope_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationScope_key = DeclarationScope_key{declarationScope_key_decl
+                                                 :: Declaration,
+                                                 declarationScope_key_scope :: Scope}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationScope_key where
+  toJSON (DeclarationScope_key __field__decl __field__scope)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationScope_key where
+  buildStruct _proxy
+    (DeclarationScope_key __field__decl __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure
+                                               (DeclarationScope_key __val__decl __val__scope)
+              _idMap = HashMap.fromList [("decl", 1), ("scope", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationScope_key where
+  rnf (DeclarationScope_key __field__decl __field__scope)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default DeclarationScope_key where
+  def = DeclarationScope_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationScope_key where
+  hashWithSalt __salt (DeclarationScope_key _decl _scope)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _scope
+
+data EnumDeclarationByName_key = EnumDeclarationByName_key{enumDeclarationByName_key_name
+                                                           :: Text.Text,
+                                                           enumDeclarationByName_key_scope :: Scope,
+                                                           enumDeclarationByName_key_decl ::
+                                                           EnumDeclaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclarationByName_key where
+  toJSON
+    (EnumDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclarationByName_key where
+  buildStruct _proxy
+    (EnumDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (EnumDeclarationByName_key __val__name __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclarationByName_key where
+  rnf
+    (EnumDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default EnumDeclarationByName_key where
+  def = EnumDeclarationByName_key "" Default.def Default.def
+
+instance Hashable.Hashable EnumDeclarationByName_key where
+  hashWithSalt __salt (EnumDeclarationByName_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data FunctionDeclarationByNameScope_key = FunctionDeclarationByNameScope_key{functionDeclarationByNameScope_key_name
+                                                                             :: Text.Text,
+                                                                             functionDeclarationByNameScope_key_scope
+                                                                             :: Scope,
+                                                                             functionDeclarationByNameScope_key_decl
+                                                                             :: FunctionDeclaration}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationByNameScope_key where
+  toJSON
+    (FunctionDeclarationByNameScope_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationByNameScope_key
+         where
+  buildStruct _proxy
+    (FunctionDeclarationByNameScope_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (FunctionDeclarationByNameScope_key __val__name
+                                                  __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationByNameScope_key where
+  rnf
+    (FunctionDeclarationByNameScope_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationByNameScope_key where
+  def = FunctionDeclarationByNameScope_key "" Default.def Default.def
+
+instance Hashable.Hashable FunctionDeclarationByNameScope_key where
+  hashWithSalt __salt
+    (FunctionDeclarationByNameScope_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data FunctionQName_key = FunctionQName_key{functionQName_key_name
+                                           :: FunctionName,
+                                           functionQName_key_scope :: Scope}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionQName_key where
+  toJSON (FunctionQName_key __field__name __field__scope)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionQName_key where
+  buildStruct _proxy (FunctionQName_key __field__name __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure
+                                               (FunctionQName_key __val__name __val__scope)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionQName_key where
+  rnf (FunctionQName_key __field__name __field__scope)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default FunctionQName_key where
+  def = FunctionQName_key Default.def Default.def
+
+instance Hashable.Hashable FunctionQName_key where
+  hashWithSalt __salt (FunctionQName_key _name _scope)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope
+
+data QName_key = QName_key{qName_key_name :: Name,
+                           qName_key_scope :: Scope}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName_key where
+  toJSON (QName_key __field__name __field__scope)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct QName_key where
+  buildStruct _proxy (QName_key __field__name __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure (QName_key __val__name __val__scope)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName_key where
+  rnf (QName_key __field__name __field__scope)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default QName_key where
+  def = QName_key Default.def Default.def
+
+instance Hashable.Hashable QName_key where
+  hashWithSalt __salt (QName_key _name _scope)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope
+
+data RecordDeclarationClass_key = RecordDeclarationClass_key{recordDeclarationClass_key_name
+                                                             :: Text.Text,
+                                                             recordDeclarationClass_key_scope ::
+                                                             Scope,
+                                                             recordDeclarationClass_key_decl ::
+                                                             RecordDeclaration}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationClass_key where
+  toJSON
+    (RecordDeclarationClass_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationClass_key where
+  buildStruct _proxy
+    (RecordDeclarationClass_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (RecordDeclarationClass_key __val__name __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationClass_key where
+  rnf
+    (RecordDeclarationClass_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationClass_key where
+  def = RecordDeclarationClass_key "" Default.def Default.def
+
+instance Hashable.Hashable RecordDeclarationClass_key where
+  hashWithSalt __salt (RecordDeclarationClass_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data RecordDeclarationStruct_key = RecordDeclarationStruct_key{recordDeclarationStruct_key_name
+                                                               :: Text.Text,
+                                                               recordDeclarationStruct_key_scope ::
+                                                               Scope,
+                                                               recordDeclarationStruct_key_decl ::
+                                                               RecordDeclaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationStruct_key where
+  toJSON
+    (RecordDeclarationStruct_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationStruct_key where
+  buildStruct _proxy
+    (RecordDeclarationStruct_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (RecordDeclarationStruct_key __val__name __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationStruct_key where
+  rnf
+    (RecordDeclarationStruct_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationStruct_key where
+  def = RecordDeclarationStruct_key "" Default.def Default.def
+
+instance Hashable.Hashable RecordDeclarationStruct_key where
+  hashWithSalt __salt
+    (RecordDeclarationStruct_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data RecordDeclarationUnion_key = RecordDeclarationUnion_key{recordDeclarationUnion_key_name
+                                                             :: Text.Text,
+                                                             recordDeclarationUnion_key_scope ::
+                                                             Scope,
+                                                             recordDeclarationUnion_key_decl ::
+                                                             RecordDeclaration}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordDeclarationUnion_key where
+  toJSON
+    (RecordDeclarationUnion_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordDeclarationUnion_key where
+  buildStruct _proxy
+    (RecordDeclarationUnion_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (RecordDeclarationUnion_key __val__name __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordDeclarationUnion_key where
+  rnf
+    (RecordDeclarationUnion_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default RecordDeclarationUnion_key where
+  def = RecordDeclarationUnion_key "" Default.def Default.def
+
+instance Hashable.Hashable RecordDeclarationUnion_key where
+  hashWithSalt __salt (RecordDeclarationUnion_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data TypeAliasDeclarationByName_key = TypeAliasDeclarationByName_key{typeAliasDeclarationByName_key_name
+                                                                     :: Text.Text,
+                                                                     typeAliasDeclarationByName_key_scope
+                                                                     :: Scope,
+                                                                     typeAliasDeclarationByName_key_decl
+                                                                     :: TypeAliasDeclaration}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeAliasDeclarationByName_key where
+  toJSON
+    (TypeAliasDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeAliasDeclarationByName_key where
+  buildStruct _proxy
+    (TypeAliasDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (TypeAliasDeclarationByName_key __val__name
+                                                  __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeAliasDeclarationByName_key where
+  rnf
+    (TypeAliasDeclarationByName_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default TypeAliasDeclarationByName_key where
+  def = TypeAliasDeclarationByName_key "" Default.def Default.def
+
+instance Hashable.Hashable TypeAliasDeclarationByName_key where
+  hashWithSalt __salt
+    (TypeAliasDeclarationByName_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data VariableDeclarationNonLocalByName_key = VariableDeclarationNonLocalByName_key{variableDeclarationNonLocalByName_key_name
+                                                                                   :: Text.Text,
+                                                                                   variableDeclarationNonLocalByName_key_scope
+                                                                                   :: Scope,
+                                                                                   variableDeclarationNonLocalByName_key_decl
+                                                                                   ::
+                                                                                   VariableDeclaration}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclarationNonLocalByName_key where
+  toJSON
+    (VariableDeclarationNonLocalByName_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclarationNonLocalByName_key
+         where
+  buildStruct _proxy
+    (VariableDeclarationNonLocalByName_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (VariableDeclarationNonLocalByName_key __val__name
+                                                  __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclarationNonLocalByName_key where
+  rnf
+    (VariableDeclarationNonLocalByName_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default VariableDeclarationNonLocalByName_key
+         where
+  def
+    = VariableDeclarationNonLocalByName_key "" Default.def Default.def
+
+instance Hashable.Hashable VariableDeclarationNonLocalByName_key
+         where
+  hashWithSalt __salt
+    (VariableDeclarationNonLocalByName_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+{-# LINE 21 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Declarations where
+  type KeyType Glean.Schema.Cxx1.Types.Declarations =
+       [Glean.Schema.Cxx1.Types.Declaration]
+  getName _proxy = Glean.PredicateRef "cxx1.Declarations" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.declarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Declarations x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 30 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Declarations where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 36 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDeclarationName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDeclarationName_key"
+           (Prelude.Just 0))
+{-# LINE 45 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.FunctionDeclarationName_key
+     =
+     'Angle.TField "fname"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 47 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FunctionDeclarationName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDeclarationName =
+       Glean.Schema.Cxx1.Types.FunctionDeclarationName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.FunctionDeclarationName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionDeclarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationName x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionDeclarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 56 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 62 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionQName_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.FunctionQName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionQName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionQName_key" (Prelude.Just 0))
+{-# LINE 71 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FunctionQName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TNoFields))
+{-# LINE 73 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FunctionQName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionQName =
+       Glean.Schema.Cxx1.Types.FunctionQName_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionQName" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.functionQName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionQName x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionQName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 82 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionQName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 88 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclToFamily_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DeclToFamily_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclToFamily_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclToFamily_key" (Prelude.Just 0))
+{-# LINE 97 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclToFamily_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "family"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.DeclFamily)
+          ('Angle.TNoFields))
+{-# LINE 99 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclToFamily where
+  type KeyType Glean.Schema.Cxx1.Types.DeclToFamily =
+       Glean.Schema.Cxx1.Types.DeclToFamily_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclToFamily" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.declToFamily_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclToFamily x k
+  getFactKey = Glean.Schema.Cxx1.Types.declToFamily_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 108 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclToFamily where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 114 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclAttribute_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDeclAttribute_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDeclAttribute_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDeclAttribute_key" (Prelude.Just 0))
+{-# LINE 123 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.FunctionDeclAttribute_key
+     =
+     'Angle.TField "decl"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+       ('Angle.TField "attr"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Attribute)
+          ('Angle.TNoFields))
+{-# LINE 125 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FunctionDeclAttribute
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDeclAttribute =
+       Glean.Schema.Cxx1.Types.FunctionDeclAttribute_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionDeclAttribute" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionDeclAttribute_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDeclAttribute x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionDeclAttribute_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 134 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDeclAttribute
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 140 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorInEnum_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.EnumeratorInEnum_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumeratorInEnum_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumeratorInEnum_key" (Prelude.Just 0))
+{-# LINE 149 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumeratorInEnum_key =
+     'Angle.TField "enumerator"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.Enumerator)
+       ('Angle.TField "enum_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDefinition)
+          ('Angle.TNoFields))
+{-# LINE 151 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.EnumeratorInEnum
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumeratorInEnum =
+       Glean.Schema.Cxx1.Types.EnumeratorInEnum_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumeratorInEnum" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumeratorInEnum_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumeratorInEnum x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumeratorInEnum_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 160 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorInEnum where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 166 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionLowerCase_key" (Prelude.Just 0))
+{-# LINE 175 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FunctionLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 177 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FunctionLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionLowerCase =
+       Glean.Schema.Cxx1.Types.FunctionLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 186 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 192 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationSources_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationSources_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationSources_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationSources_key" (Prelude.Just 0))
+{-# LINE 201 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationSources_key =
+     'Angle.TField "target" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "sources" ([Glean.Schema.Cxx1.Types.Declaration])
+          ('Angle.TNoFields))
+{-# LINE 203 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationSources
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationSources =
+       Glean.Schema.Cxx1.Types.DeclarationSources_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationSources" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationSources_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationSources x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationSources_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 212 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationSources
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 218 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TypeAliasDeclarationByName_key"
+           (Prelude.Just 0))
+{-# LINE 229 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.TypeAliasDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 231 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName =
+       Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.TypeAliasDeclarationByName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.typeAliasDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName x k
+  getFactKey = Glean.Schema.Cxx1.Types.typeAliasDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 240 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TypeAliasDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 246 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcMethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcMethodDeclaration_key x1 x2 x3 x4 x5
+       x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcMethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcMethodDeclaration_key" (Prelude.Just 0))
+{-# LINE 267 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcMethodDeclaration_key
+     =
+     'Angle.TField "selector"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcSelector)
+       ('Angle.TField "locations" ([Glean.Schema.Src.Types.FileLocation])
+          ('Angle.TField "container"
+             (Glean.Schema.Cxx1.Types.ObjcContainerId)
+             ('Angle.TField "signature"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+                ('Angle.TField "isInstance" (Prelude.Bool)
+                   ('Angle.TField "isOptional" (Prelude.Bool)
+                      ('Angle.TField "isAccessor" (Prelude.Bool)
+                         ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                            ('Angle.TNoFields))))))))
+{-# LINE 269 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcMethodDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclaration =
+       Glean.Schema.Cxx1.Types.ObjcMethodDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcMethodDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcMethodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcMethodDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcMethodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 278 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcMethodDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 284 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPTraceXRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FilePPTraceXRefs_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FilePPTraceXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FilePPTraceXRefs_key" (Prelude.Just 0))
+{-# LINE 299 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FilePPTraceXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "trace"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+             ('Angle.TField "ppEntity" (Glean.Schema.Cxx1.Types.PpEntity)
+                ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 301 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FilePPTraceXRefs
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FilePPTraceXRefs =
+       Glean.Schema.Cxx1.Types.FilePPTraceXRefs_key
+  getName _proxy = Glean.PredicateRef "cxx1.FilePPTraceXRefs" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.filePPTraceXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FilePPTraceXRefs x k
+  getFactKey = Glean.Schema.Cxx1.Types.filePPTraceXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 310 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPTraceXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 316 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDeclarationByNameScope_key"
+           (Prelude.Just 0))
+{-# LINE 327 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 329 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope
+       = Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.FunctionDeclarationByNameScope" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.functionDeclarationByNameScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.functionDeclarationByNameScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 338 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclarationByNameScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 344 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MethodOverrides_key
+         where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.MethodOverrides_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.MethodOverrides_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.MethodOverrides_key" (Prelude.Just 0))
+{-# LINE 353 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.MethodOverrides_key =
+     'Angle.TField "derived"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+       ('Angle.TField "base"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 355 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.MethodOverrides
+         where
+  type KeyType Glean.Schema.Cxx1.Types.MethodOverrides =
+       Glean.Schema.Cxx1.Types.MethodOverrides_key
+  getName _proxy = Glean.PredicateRef "cxx1.MethodOverrides" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.methodOverrides_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.MethodOverrides x k
+  getFactKey = Glean.Schema.Cxx1.Types.methodOverrides_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 364 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MethodOverrides where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 370 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.VariableDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.VariableDeclaration_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.VariableDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.VariableDeclaration_key" (Prelude.Just 0))
+{-# LINE 383 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.VariableDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+          ('Angle.TField "kind" (Glean.Schema.Cxx1.Types.VariableKind)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 385 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.VariableDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.VariableDeclaration =
+       Glean.Schema.Cxx1.Types.VariableDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.VariableDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.variableDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.VariableDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.variableDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 394 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.VariableDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 400 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.IncludeTree_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.IncludeTree_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.IncludeTree_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.IncludeTree_key" (Prelude.Just 0))
+{-# LINE 409 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.IncludeTree_key =
+     'Angle.TField "trace" (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+       ('Angle.TField "children"
+          ([Glean.Schema.Cxx1.Types.MaybeIncludeTree])
+          ('Angle.TNoFields))
+{-# LINE 411 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.IncludeTree where
+  type KeyType Glean.Schema.Cxx1.Types.IncludeTree =
+       Glean.Schema.Cxx1.Types.IncludeTree_key
+  getName _proxy = Glean.PredicateRef "cxx1.IncludeTree" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.includeTree_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.IncludeTree x k
+  getFactKey = Glean.Schema.Cxx1.Types.includeTree_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 420 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.IncludeTree where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 426 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcImplements_key
+         where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.ObjcImplements_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcImplements_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcImplements_key" (Prelude.Just 0))
+{-# LINE 435 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcImplements_key =
+     'Angle.TField "implementation"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+       ('Angle.TField "interface_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 437 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ObjcImplements
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcImplements =
+       Glean.Schema.Cxx1.Types.ObjcImplements_key
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcImplements" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcImplements_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcImplements x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcImplements_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 446 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcImplements where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 452 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MethodOverridden_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.MethodOverridden_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.MethodOverridden_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.MethodOverridden_key" (Prelude.Just 0))
+{-# LINE 461 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.MethodOverridden_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+       ('Angle.TField "derived"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 463 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.MethodOverridden
+         where
+  type KeyType Glean.Schema.Cxx1.Types.MethodOverridden =
+       Glean.Schema.Cxx1.Types.MethodOverridden_key
+  getName _proxy = Glean.PredicateRef "cxx1.MethodOverridden" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.methodOverridden_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.MethodOverridden x k
+  getFactKey = Glean.Schema.Cxx1.Types.methodOverridden_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 472 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MethodOverridden where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 478 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPUseXRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FilePPUseXRefs_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FilePPUseXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FilePPUseXRefs_key" (Prelude.Just 0))
+{-# LINE 489 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FilePPUseXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "define"
+             (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+             ('Angle.TNoFields)))
+{-# LINE 491 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FilePPUseXRefs
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FilePPUseXRefs =
+       Glean.Schema.Cxx1.Types.FilePPUseXRefs_key
+  getName _proxy = Glean.PredicateRef "cxx1.FilePPUseXRefs" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.filePPUseXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FilePPUseXRefs x k
+  getFactKey = Glean.Schema.Cxx1.Types.filePPUseXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 500 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPUseXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 506 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Name where
+  type KeyType Glean.Schema.Cxx1.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "cxx1.Name" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Name x k
+  getFactKey = Glean.Schema.Cxx1.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 514 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 520 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjContainerIdName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjContainerIdName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjContainerIdName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjContainerIdName_key" (Prelude.Just 0))
+{-# LINE 529 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjContainerIdName_key =
+     'Angle.TField "id" (Glean.Schema.Cxx1.Types.ObjcContainerId)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 531 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ObjContainerIdName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjContainerIdName =
+       Glean.Schema.Cxx1.Types.ObjContainerIdName_key
+  getName _proxy = Glean.PredicateRef "cxx1.ObjContainerIdName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objContainerIdName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjContainerIdName x k
+  getFactKey = Glean.Schema.Cxx1.Types.objContainerIdName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 540 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjContainerIdName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 546 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.XRefTargets where
+  type KeyType Glean.Schema.Cxx1.Types.XRefTargets =
+       [Glean.Schema.Cxx1.Types.XRefTarget]
+  getName _proxy = Glean.PredicateRef "cxx1.XRefTargets" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.xRefTargets_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.XRefTargets x k
+  getFactKey = Glean.Schema.Cxx1.Types.xRefTargets_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 555 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.XRefTargets where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 561 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.USRToDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.USRToDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.USRToDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.USRToDeclaration_key" (Prelude.Just 0))
+{-# LINE 570 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.USRToDeclaration_key =
+     'Angle.TField "hash" (Glean.Schema.Cxx1.Types.USR)
+       ('Angle.TField "declaration" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 572 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.USRToDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.USRToDeclaration =
+       Glean.Schema.Cxx1.Types.USRToDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.USRToDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.uSRToDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.USRToDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.uSRToDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 581 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.USRToDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 587 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TypeAliasDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TypeAliasDeclaration_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TypeAliasDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TypeAliasDeclaration_key" (Prelude.Just 0))
+{-# LINE 600 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.TypeAliasDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+          ('Angle.TField "kind" (Glean.Schema.Cxx1.Types.TypeAliasKind)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 602 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.TypeAliasDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TypeAliasDeclaration =
+       Glean.Schema.Cxx1.Types.TypeAliasDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.TypeAliasDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.typeAliasDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TypeAliasDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.typeAliasDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 611 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TypeAliasDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 617 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.DeclarationLocationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationLocationName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationLocationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationLocationName_key"
+           (Prelude.Just 0))
+{-# LINE 628 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.DeclarationLocationName_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 630 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.DeclarationLocationName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationLocationName =
+       Glean.Schema.Cxx1.Types.DeclarationLocationName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.DeclarationLocationName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationLocationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationLocationName x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationLocationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 639 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationLocationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 645 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ObjcSelector where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcSelector =
+       [Data.Text.Text]
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcSelector" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.objcSelector_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcSelector x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcSelector_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 653 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcSelector where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 659 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationSrcRange_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationSrcRange_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationSrcRange_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationSrcRange_key" (Prelude.Just 0))
+{-# LINE 668 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationSrcRange_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 670 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.DeclarationSrcRange
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationSrcRange =
+       Glean.Schema.Cxx1.Types.DeclarationSrcRange_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationSrcRange" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationSrcRange_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationSrcRange x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationSrcRange_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 679 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationSrcRange
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 685 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationInTrace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationInTrace_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationInTrace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationInTrace_key" (Prelude.Just 0))
+{-# LINE 694 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationInTrace_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "trace"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TNoFields))
+{-# LINE 696 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationInTrace
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationInTrace =
+       Glean.Schema.Cxx1.Types.DeclarationInTrace_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationInTrace" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationInTrace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationInTrace x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationInTrace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 705 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationInTrace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 711 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TargetUses_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.TargetUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TargetUses_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TargetUses_key" (Prelude.Just 0))
+{-# LINE 722 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.TargetUses_key =
+     'Angle.TField "target" (Glean.Schema.Cxx1.Types.XRefTarget)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "from" (Glean.Schema.Cxx1.Types.From)
+             ('Angle.TNoFields)))
+{-# LINE 724 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.TargetUses where
+  type KeyType Glean.Schema.Cxx1.Types.TargetUses =
+       Glean.Schema.Cxx1.Types.TargetUses_key
+  getName _proxy = Glean.PredicateRef "cxx1.TargetUses" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.targetUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TargetUses x k
+  getFactKey = Glean.Schema.Cxx1.Types.targetUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 733 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TargetUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 739 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceDeclarationName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceDeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceDeclarationName_key"
+           (Prelude.Just 0))
+{-# LINE 748 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.NamespaceDeclarationName_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceQName)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 750 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceDeclarationName =
+       Glean.Schema.Cxx1.Types.NamespaceDeclarationName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.NamespaceDeclarationName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceDeclarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceDeclarationName x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceDeclarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 759 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 765 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.QName_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.QName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.QName_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.QName_key" (Prelude.Just 0))
+{-# LINE 774 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.QName_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TNoFields))
+{-# LINE 776 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.QName where
+  type KeyType Glean.Schema.Cxx1.Types.QName =
+       Glean.Schema.Cxx1.Types.QName_key
+  getName _proxy = Glean.PredicateRef "cxx1.QName" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.qName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.QName x k
+  getFactKey = Glean.Schema.Cxx1.Types.qName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 785 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.QName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 791 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.SpellingXRef_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.SpellingXRef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.SpellingXRef_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.SpellingXRef_key" (Prelude.Just 0))
+{-# LINE 800 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.SpellingXRef_key =
+     'Angle.TField "source" (Glean.Schema.Src.Types.FileLocation)
+       ('Angle.TField "target" (Glean.Schema.Cxx1.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 802 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.SpellingXRef where
+  type KeyType Glean.Schema.Cxx1.Types.SpellingXRef =
+       Glean.Schema.Cxx1.Types.SpellingXRef_key
+  getName _proxy = Glean.PredicateRef "cxx1.SpellingXRef" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.spellingXRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.SpellingXRef x k
+  getFactKey = Glean.Schema.Cxx1.Types.spellingXRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 811 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.SpellingXRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 817 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ThriftToCxx_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.ThriftToCxx_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ThriftToCxx_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ThriftToCxx_key" (Prelude.Just 0))
+{-# LINE 826 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ThriftToCxx_key =
+     'Angle.TField "to" (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "from" (Glean.Schema.Cxx1.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 828 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ThriftToCxx where
+  type KeyType Glean.Schema.Cxx1.Types.ThriftToCxx =
+       Glean.Schema.Cxx1.Types.ThriftToCxx_key
+  getName _proxy = Glean.PredicateRef "cxx1.ThriftToCxx" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.thriftToCxx_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ThriftToCxx x k
+  getFactKey = Glean.Schema.Cxx1.Types.thriftToCxx_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 837 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ThriftToCxx where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 843 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDefinition_key" (Prelude.Just 0))
+{-# LINE 854 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.RecordDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+       ('Angle.TField "bases" ([Glean.Schema.Cxx1.Types.RecordBase])
+          ('Angle.TField "members"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Declarations)
+             ('Angle.TNoFields)))
+{-# LINE 856 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.RecordDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDefinition =
+       Glean.Schema.Cxx1.Types.RecordDefinition_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 865 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 871 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.CxxToThrift_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.CxxToThrift_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.CxxToThrift_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.CxxToThrift_key" (Prelude.Just 0))
+{-# LINE 880 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.CxxToThrift_key =
+     'Angle.TField "from" (Glean.Schema.Cxx1.Types.XRefTarget)
+       ('Angle.TField "to" (Glean.Schema.Fbthrift.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 882 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.CxxToThrift where
+  type KeyType Glean.Schema.Cxx1.Types.CxxToThrift =
+       Glean.Schema.Cxx1.Types.CxxToThrift_key
+  getName _proxy = Glean.PredicateRef "cxx1.CxxToThrift" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.cxxToThrift_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.CxxToThrift x k
+  getFactKey = Glean.Schema.Cxx1.Types.cxxToThrift_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 891 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.CxxToThrift where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 897 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationToUSR_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationToUSR_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationToUSR_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationToUSR_key" (Prelude.Just 0))
+{-# LINE 906 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationToUSR_key =
+     'Angle.TField "declaration" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "usr" (Glean.Schema.Cxx1.Types.USR)
+          ('Angle.TNoFields))
+{-# LINE 908 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationToUSR
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationToUSR =
+       Glean.Schema.Cxx1.Types.DeclarationToUSR_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationToUSR" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationToUSR_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationToUSR x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationToUSR_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 917 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationToUSR where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 923 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PPTrace_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PPTrace_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.PPTrace_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.PPTrace_key" (Prelude.Just 0))
+{-# LINE 932 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.PPTrace_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "events" ([Glean.Schema.Cxx1.Types.PPEvent])
+          ('Angle.TNoFields))
+{-# LINE 934 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.PPTrace where
+  type KeyType Glean.Schema.Cxx1.Types.PPTrace =
+       Glean.Schema.Cxx1.Types.PPTrace_key
+  getName _proxy = Glean.PredicateRef "cxx1.PPTrace" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.pPTrace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.PPTrace x k
+  getFactKey = Glean.Schema.Cxx1.Types.pPTrace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 943 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PPTrace where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 949 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DefToBaseDecl_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DefToBaseDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DefToBaseDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DefToBaseDecl_key" (Prelude.Just 0))
+{-# LINE 958 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DefToBaseDecl_key =
+     'Angle.TField "defn" (Glean.Schema.Cxx1.Types.DefinitionEntity)
+       ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 960 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DefToBaseDecl
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DefToBaseDecl =
+       Glean.Schema.Cxx1.Types.DefToBaseDecl_key
+  getName _proxy = Glean.PredicateRef "cxx1.DefToBaseDecl" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.defToBaseDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DefToBaseDecl x k
+  getFactKey = Glean.Schema.Cxx1.Types.defToBaseDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 969 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DefToBaseDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 975 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Signature_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Signature_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Signature_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Signature_key" (Prelude.Just 0))
+{-# LINE 984 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.Signature_key =
+     'Angle.TField "returns"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+       ('Angle.TField "parameters" ([Glean.Schema.Cxx1.Types.Parameter])
+          ('Angle.TNoFields))
+{-# LINE 986 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Signature where
+  type KeyType Glean.Schema.Cxx1.Types.Signature =
+       Glean.Schema.Cxx1.Types.Signature_key
+  getName _proxy = Glean.PredicateRef "cxx1.Signature" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.signature_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Signature x k
+  getFactKey = Glean.Schema.Cxx1.Types.signature_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 995 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Signature where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1001 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Same_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Same_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Same_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Same_key" (Prelude.Just 0))
+{-# LINE 1010 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.Same_key =
+     'Angle.TField "declaration1" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "declaration2" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1012 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Same where
+  type KeyType Glean.Schema.Cxx1.Types.Same =
+       Glean.Schema.Cxx1.Types.Same_key
+  getName _proxy = Glean.PredicateRef "cxx1.Same" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.same_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Same x k
+  getFactKey = Glean.Schema.Cxx1.Types.same_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1020 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Same where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1026 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordClassLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordClassLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordClassLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordClassLowerCase_key" (Prelude.Just 0))
+{-# LINE 1035 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.RecordClassLowerCase_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1037 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordClassLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordClassLowerCase =
+       Glean.Schema.Cxx1.Types.RecordClassLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordClassLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordClassLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordClassLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordClassLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1046 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordClassLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1052 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceAliasDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1063 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceQName)
+       ('Angle.TField "target" (Glean.Schema.Cxx1.Types.NamespaceTarget)
+          ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 1065 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration =
+       Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.NamespaceAliasDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceAliasDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceAliasDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1074 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1080 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationNameSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationNameSpan_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationNameSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationNameSpan_key" (Prelude.Just 0))
+{-# LINE 1091 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationNameSpan_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1093 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.DeclarationNameSpan
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationNameSpan =
+       Glean.Schema.Cxx1.Types.DeclarationNameSpan_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationNameSpan" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationNameSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationNameSpan x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationNameSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1102 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationNameSpan
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1108 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.EnumDeclaration_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumDeclaration_key" (Prelude.Just 0))
+{-# LINE 1121 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "isScoped" (Prelude.Bool)
+          ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Cxx1.Types.Type)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 1123 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.EnumDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumDeclaration =
+       Glean.Schema.Cxx1.Types.EnumDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1132 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1138 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordUnionLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordUnionLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordUnionLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordUnionLowerCase_key" (Prelude.Just 0))
+{-# LINE 1147 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.RecordUnionLowerCase_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1149 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordUnionLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordUnionLowerCase =
+       Glean.Schema.Cxx1.Types.RecordUnionLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordUnionLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordUnionLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordUnionLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordUnionLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1158 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordUnionLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1164 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.EnumeratorByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumeratorByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumeratorByName_key" (Prelude.Just 0))
+{-# LINE 1173 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumeratorByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "decl"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Enumerator)
+          ('Angle.TNoFields))
+{-# LINE 1175 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.EnumeratorByName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumeratorByName =
+       Glean.Schema.Cxx1.Types.EnumeratorByName_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumeratorByName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumeratorByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumeratorByName x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumeratorByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1184 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1190 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TranslationUnitTrace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TranslationUnitTrace_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TranslationUnitTrace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TranslationUnitTrace_key" (Prelude.Just 0))
+{-# LINE 1199 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.TranslationUnitTrace_key
+     =
+     'Angle.TField "tunit"
+       (Glean.KeyType Glean.Schema.Buck.Types.TranslationUnit)
+       ('Angle.TField "trace"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TNoFields))
+{-# LINE 1201 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.TranslationUnitTrace
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TranslationUnitTrace =
+       Glean.Schema.Cxx1.Types.TranslationUnitTrace_key
+  getName _proxy = Glean.PredicateRef "cxx1.TranslationUnitTrace" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.translationUnitTrace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TranslationUnitTrace x k
+  getFactKey = Glean.Schema.Cxx1.Types.translationUnitTrace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1210 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TranslationUnitTrace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1216 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcPropertyIVar_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcPropertyIVar_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcPropertyIVar_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcPropertyIVar_key" (Prelude.Just 0))
+{-# LINE 1225 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcPropertyIVar_key =
+     'Angle.TField "property"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration)
+       ('Angle.TField "ivar"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.VariableDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1227 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ObjcPropertyIVar
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcPropertyIVar =
+       Glean.Schema.Cxx1.Types.ObjcPropertyIVar_key
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcPropertyIVar" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcPropertyIVar_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcPropertyIVar x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcPropertyIVar_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1236 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcPropertyIVar where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1242 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerInheritance_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerInheritance_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerInheritance_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerInheritance_key"
+           (Prelude.Just 0))
+{-# LINE 1251 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcContainerInheritance_key
+     =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+       ('Angle.TField "declaration"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1253 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcContainerInheritance
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcContainerInheritance =
+       Glean.Schema.Cxx1.Types.ObjcContainerInheritance_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcContainerInheritance" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcContainerInheritance_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerInheritance x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcContainerInheritance_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1262 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerInheritance
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1268 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Attribute where
+  type KeyType Glean.Schema.Cxx1.Types.Attribute = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "cxx1.Attribute" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.attribute_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Attribute x k
+  getFactKey = Glean.Schema.Cxx1.Types.attribute_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1276 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Attribute where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1282 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcMethodDeclarationName_key"
+           (Prelude.Just 0))
+{-# LINE 1291 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName_key
+     =
+     'Angle.TField "decl"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclaration)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 1293 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName =
+       Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcMethodDeclarationName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcMethodDeclarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcMethodDeclarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1302 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcMethodDeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1308 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclFamily where
+  type KeyType Glean.Schema.Cxx1.Types.DeclFamily =
+       [Glean.Schema.Cxx1.Types.Declaration]
+  getName _proxy = Glean.PredicateRef "cxx1.DeclFamily" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.declFamily_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclFamily x k
+  getFactKey = Glean.Schema.Cxx1.Types.declFamily_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1317 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclFamily where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1323 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcPropertyImplementation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcPropertyImplementation_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcPropertyImplementation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcPropertyImplementation_key"
+           (Prelude.Just 0))
+{-# LINE 1336 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcPropertyImplementation_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration)
+       ('Angle.TField "kind" (Glean.Schema.Cxx1.Types.ObjcPropertyKind)
+          ('Angle.TField "ivar" (Prelude.Maybe Glean.Schema.Cxx1.Types.Name)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 1338 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcPropertyImplementation
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcPropertyImplementation =
+       Glean.Schema.Cxx1.Types.ObjcPropertyImplementation_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcPropertyImplementation" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcPropertyImplementation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcPropertyImplementation x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcPropertyImplementation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1347 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcPropertyImplementation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1353 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 1364 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcContainerDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+       ('Angle.TField "protocols"
+          ([Glean.Schema.Cxx1.Types.ObjcContainerDeclaration])
+          ('Angle.TField "members"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Declarations)
+             ('Angle.TNoFields)))
+{-# LINE 1366 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcContainerDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcContainerDefinition =
+       Glean.Schema.Cxx1.Types.ObjcContainerDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcContainerDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcContainerDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcContainerDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1375 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcContainerDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1381 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.VariableDeclarationNonLocalByName_key"
+           (Prelude.Just 0))
+{-# LINE 1392 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.VariableDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1394 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName
+         where
+  type KeyType
+         Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName
+       = Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.VariableDeclarationNonLocalByName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.variableDeclarationNonLocalByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.variableDeclarationNonLocalByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1404 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.VariableDeclarationNonLocalByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1410 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceDeclaration_key" (Prelude.Just 0))
+{-# LINE 1419 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.NamespaceDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceQName)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1421 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.NamespaceDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration =
+       Glean.Schema.Cxx1.Types.NamespaceDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.NamespaceDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1430 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1436 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordDeclarationStruct_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordDeclarationStruct_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDeclarationStruct_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDeclarationStruct_key"
+           (Prelude.Just 0))
+{-# LINE 1447 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.RecordDeclarationStruct_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1449 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordDeclarationStruct
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDeclarationStruct =
+       Glean.Schema.Cxx1.Types.RecordDeclarationStruct_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.RecordDeclarationStruct" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordDeclarationStruct_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDeclarationStruct x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDeclarationStruct_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1458 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDeclarationStruct
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1464 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclFamilyOf_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DeclFamilyOf_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclFamilyOf_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclFamilyOf_key" (Prelude.Just 0))
+{-# LINE 1473 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclFamilyOf_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "family" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1475 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclFamilyOf where
+  type KeyType Glean.Schema.Cxx1.Types.DeclFamilyOf =
+       Glean.Schema.Cxx1.Types.DeclFamilyOf_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclFamilyOf" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.declFamilyOf_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclFamilyOf x k
+  getFactKey = Glean.Schema.Cxx1.Types.declFamilyOf_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1484 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclFamilyOf where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1490 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclInObjcContainer_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclInObjcContainer_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclInObjcContainer_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclInObjcContainer_key" (Prelude.Just 0))
+{-# LINE 1499 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclInObjcContainer_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "record"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDefinition)
+          ('Angle.TNoFields))
+{-# LINE 1501 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.DeclInObjcContainer
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclInObjcContainer =
+       Glean.Schema.Cxx1.Types.DeclInObjcContainer_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclInObjcContainer" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declInObjcContainer_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclInObjcContainer x k
+  getFactKey = Glean.Schema.Cxx1.Types.declInObjcContainer_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1510 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclInObjcContainer
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1516 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TranslationUnitXRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TranslationUnitXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TranslationUnitXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TranslationUnitXRefs_key" (Prelude.Just 0))
+{-# LINE 1525 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.TranslationUnitXRefs_key
+     =
+     'Angle.TField "tunit"
+       (Glean.KeyType Glean.Schema.Buck.Types.TranslationUnit)
+       ('Angle.TField "xrefs" ([Glean.Schema.Cxx1.Types.FileXRefs])
+          ('Angle.TNoFields))
+{-# LINE 1527 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.TranslationUnitXRefs
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TranslationUnitXRefs =
+       Glean.Schema.Cxx1.Types.TranslationUnitXRefs_key
+  getName _proxy = Glean.PredicateRef "cxx1.TranslationUnitXRefs" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.translationUnitXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TranslationUnitXRefs x k
+  getFactKey = Glean.Schema.Cxx1.Types.translationUnitXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1536 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TranslationUnitXRefs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1542 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumDefinition_key
+         where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.EnumDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumDefinition_key" (Prelude.Just 0))
+{-# LINE 1551 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDeclaration)
+       ('Angle.TField "enumerators" ([Glean.Schema.Cxx1.Types.Enumerator])
+          ('Angle.TNoFields))
+{-# LINE 1553 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.EnumDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumDefinition =
+       Glean.Schema.Cxx1.Types.EnumDefinition_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1562 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1568 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceDefinition_key" (Prelude.Just 0))
+{-# LINE 1577 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.NamespaceDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration)
+       ('Angle.TField "members"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Declarations)
+          ('Angle.TNoFields))
+{-# LINE 1579 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.NamespaceDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceDefinition =
+       Glean.Schema.Cxx1.Types.NamespaceDefinition_key
+  getName _proxy = Glean.PredicateRef "cxx1.NamespaceDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1588 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1594 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationTargets_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationTargets_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationTargets_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationTargets_key" (Prelude.Just 0))
+{-# LINE 1603 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationTargets_key =
+     'Angle.TField "source" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "targets" ([Glean.Schema.Cxx1.Types.Declaration])
+          ('Angle.TNoFields))
+{-# LINE 1605 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationTargets
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationTargets =
+       Glean.Schema.Cxx1.Types.DeclarationTargets_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationTargets" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationTargets_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationTargets x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationTargets_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1614 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationTargets
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1620 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.UsingDirective_key
+         where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.UsingDirective_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.UsingDirective_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.UsingDirective_key" (Prelude.Just 0))
+{-# LINE 1629 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.UsingDirective_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1631 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.UsingDirective
+         where
+  type KeyType Glean.Schema.Cxx1.Types.UsingDirective =
+       Glean.Schema.Cxx1.Types.UsingDirective_key
+  getName _proxy = Glean.PredicateRef "cxx1.UsingDirective" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.usingDirective_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.UsingDirective x k
+  getFactKey = Glean.Schema.Cxx1.Types.usingDirective_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1640 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.UsingDirective where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1646 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.XRefIndirectTarget_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.XRefIndirectTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.XRefIndirectTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.XRefIndirectTarget_key" (Prelude.Just 0))
+{-# LINE 1655 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.XRefIndirectTarget_key =
+     'Angle.TField "via" (Glean.Schema.Cxx1.Types.XRefVia)
+       ('Angle.TField "target" (Glean.Schema.Cxx1.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 1657 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.XRefIndirectTarget
+         where
+  type KeyType Glean.Schema.Cxx1.Types.XRefIndirectTarget =
+       Glean.Schema.Cxx1.Types.XRefIndirectTarget_key
+  getName _proxy = Glean.PredicateRef "cxx1.XRefIndirectTarget" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.xRefIndirectTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.XRefIndirectTarget x k
+  getFactKey = Glean.Schema.Cxx1.Types.xRefIndirectTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1666 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.XRefIndirectTarget
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1672 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1681 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcContainerDeclaration_key
+     =
+     'Angle.TField "id" (Glean.Schema.Cxx1.Types.ObjcContainerId)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1683 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration =
+       Glean.Schema.Cxx1.Types.ObjcContainerDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcContainerDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcContainerDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcContainerDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1692 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1698 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.MangledNameHashToDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1707 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration_key
+     =
+     'Angle.TField "hash" (Glean.Schema.Cxx1.Types.MangledNameHash)
+       ('Angle.TField "declaration" (Glean.Schema.Cxx1.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1709 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration =
+       Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.MangledNameHashToDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.mangledNameHashToDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.mangledNameHashToDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1718 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.MangledNameHashToDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1724 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Type where
+  type KeyType Glean.Schema.Cxx1.Types.Type = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "cxx1.Type" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Type x k
+  getFactKey = Glean.Schema.Cxx1.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1732 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1738 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerInterfaceLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 1747 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1749 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase
+         where
+  type KeyType
+         Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase
+       = Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcContainerInterfaceLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.objcContainerInterfaceLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.objcContainerInterfaceLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1758 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerInterfaceLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1764 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionName_key where
+  buildRtsValue b Glean.Schema.Cxx1.Types.FunctionName_key_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.Cxx1.Types.FunctionName_key_name x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionName_key_operator_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionName_key_literalOperator x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionName_key_constructor x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionName_key_destructor x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionName_key_conversionOperator x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.FunctionName_key_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.FunctionName_key_name,
+         Glean.mapD Glean.Schema.Cxx1.Types.FunctionName_key_operator_,
+         Glean.mapD
+           Glean.Schema.Cxx1.Types.FunctionName_key_literalOperator,
+         Glean.mapD Glean.Schema.Cxx1.Types.FunctionName_key_constructor,
+         Glean.mapD Glean.Schema.Cxx1.Types.FunctionName_key_destructor,
+         Glean.mapD
+           Glean.Schema.Cxx1.Types.FunctionName_key_conversionOperator]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionName_key" (Prelude.Just 0))
+{-# LINE 1796 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.FunctionName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "operator_" (Glean.Schema.Cxx1.Types.Operator)
+          ('Angle.TField "literalOperator"
+             (Glean.Schema.Cxx1.Types.LiteralOperator)
+             ('Angle.TField "constructor" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "destructor" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "conversionOperator"
+                      (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+                      ('Angle.TNoFields))))))
+{-# LINE 1798 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FunctionName where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionName =
+       Glean.Schema.Cxx1.Types.FunctionName_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionName" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.functionName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionName x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1807 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1813 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerDeclarationInterface_key"
+           (Prelude.Just 0))
+{-# LINE 1822 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "decl"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1824 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface
+         where
+  type KeyType
+         Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface
+       = Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcContainerDeclarationInterface" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.objcContainerDeclarationInterface_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.objcContainerDeclarationInterface_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1834 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcContainerDeclarationInterface
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1840 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FileXRefs_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 1849 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FileXRefs_key =
+     'Angle.TField "xmap"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FileXRefMap)
+       ('Angle.TField "targets" ([Glean.Schema.Cxx1.Types.XRefTargets])
+          ('Angle.TNoFields))
+{-# LINE 1851 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FileXRefs where
+  type KeyType Glean.Schema.Cxx1.Types.FileXRefs =
+       Glean.Schema.Cxx1.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "cxx1.FileXRefs" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Cxx1.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1860 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1866 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan_key x1 x2 x3
+       x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationLocationNameSpan_key"
+           (Prelude.Just 0))
+{-# LINE 1881 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "name" (Data.Text.Text)
+             ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+                ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 1883 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan =
+       Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.DeclarationLocationNameSpan" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationLocationNameSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.declarationLocationNameSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1892 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.DeclarationLocationNameSpan
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1898 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceDeclarationByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceDeclarationByName_key"
+           (Prelude.Just 0))
+{-# LINE 1909 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.NamespaceDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Cxx1.Types.NamespaceQName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1911 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationByName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceDeclarationByName =
+       Glean.Schema.Cxx1.Types.NamespaceDeclarationByName_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.NamespaceDeclarationByName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceDeclarationByName x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1920 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.NamespaceDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1926 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TranslationUnitIncludeTree_key"
+           (Prelude.Just 0))
+{-# LINE 1935 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree_key
+     =
+     'Angle.TField "tunit"
+       (Glean.KeyType Glean.Schema.Buck.Types.TranslationUnit)
+       ('Angle.TField "tree"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.IncludeTree)
+          ('Angle.TNoFields))
+{-# LINE 1937 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree =
+       Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.TranslationUnitIncludeTree" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.translationUnitIncludeTree_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree x k
+  getFactKey = Glean.Schema.Cxx1.Types.translationUnitIncludeTree_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1946 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.TranslationUnitIncludeTree
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1952 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FileXRefMap_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.FileXRefMap_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FileXRefMap_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FileXRefMap_key" (Prelude.Just 0))
+{-# LINE 1963 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FileXRefMap_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "fixed" ([Glean.Schema.Cxx1.Types.FixedXRef])
+          ('Angle.TField "froms" ([Glean.Schema.Cxx1.Types.From])
+             ('Angle.TNoFields)))
+{-# LINE 1965 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FileXRefMap where
+  type KeyType Glean.Schema.Cxx1.Types.FileXRefMap =
+       Glean.Schema.Cxx1.Types.FileXRefMap_key
+  getName _proxy = Glean.PredicateRef "cxx1.FileXRefMap" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.fileXRefMap_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FileXRefMap x k
+  getFactKey = Glean.Schema.Cxx1.Types.fileXRefMap_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1974 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FileXRefMap where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1980 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.IncludeTreeTranslationUnit_key"
+           (Prelude.Just 0))
+{-# LINE 1989 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit_key
+     =
+     'Angle.TField "tree"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.IncludeTree)
+       ('Angle.TField "tunit"
+          (Glean.KeyType Glean.Schema.Buck.Types.TranslationUnit)
+          ('Angle.TNoFields))
+{-# LINE 1991 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit
+         where
+  type KeyType Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit =
+       Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.IncludeTreeTranslationUnit" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.includeTreeTranslationUnit_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit x k
+  getFactKey = Glean.Schema.Cxx1.Types.includeTreeTranslationUnit_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2000 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.IncludeTreeTranslationUnit
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2006 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DefnInRecord_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DefnInRecord_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DefnInRecord_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DefnInRecord_key" (Prelude.Just 0))
+{-# LINE 2015 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DefnInRecord_key =
+     'Angle.TField "defn" (Glean.Schema.Cxx1.Types.DefinitionEntity)
+       ('Angle.TField "record"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDefinition)
+          ('Angle.TNoFields))
+{-# LINE 2017 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DefnInRecord where
+  type KeyType Glean.Schema.Cxx1.Types.DefnInRecord =
+       Glean.Schema.Cxx1.Types.DefnInRecord_key
+  getName _proxy = Glean.PredicateRef "cxx1.DefnInRecord" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.defnInRecord_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DefnInRecord x k
+  getFactKey = Glean.Schema.Cxx1.Types.defnInRecord_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2026 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DefnInRecord where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2032 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Enumerator_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Enumerator_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Enumerator_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Enumerator_key" (Prelude.Just 0))
+{-# LINE 2043 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.Enumerator_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "enumeration"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDeclaration)
+          ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 2045 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Enumerator where
+  type KeyType Glean.Schema.Cxx1.Types.Enumerator =
+       Glean.Schema.Cxx1.Types.Enumerator_key
+  getName _proxy = Glean.PredicateRef "cxx1.Enumerator" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.enumerator_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Enumerator x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumerator_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2054 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Enumerator where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2060 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.EnumeratorLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumeratorLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumeratorLowerCase_key" (Prelude.Just 0))
+{-# LINE 2069 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumeratorLowerCase_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2071 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.EnumeratorLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumeratorLowerCase =
+       Glean.Schema.Cxx1.Types.EnumeratorLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumeratorLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumeratorLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumeratorLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumeratorLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2080 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumeratorLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2086 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.IncludeTreeParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.IncludeTreeParent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.IncludeTreeParent_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.IncludeTreeParent_key" (Prelude.Just 0))
+{-# LINE 2095 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.IncludeTreeParent_key =
+     'Angle.TField "tree"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.IncludeTree)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.IncludeTree)
+          ('Angle.TNoFields))
+{-# LINE 2097 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.IncludeTreeParent
+         where
+  type KeyType Glean.Schema.Cxx1.Types.IncludeTreeParent =
+       Glean.Schema.Cxx1.Types.IncludeTreeParent_key
+  getName _proxy = Glean.PredicateRef "cxx1.IncludeTreeParent" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.includeTreeParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.IncludeTreeParent x k
+  getFactKey = Glean.Schema.Cxx1.Types.includeTreeParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2106 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.IncludeTreeParent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2112 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclInRecord_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DeclInRecord_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclInRecord_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclInRecord_key" (Prelude.Just 0))
+{-# LINE 2121 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclInRecord_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "record"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDefinition)
+          ('Angle.TNoFields))
+{-# LINE 2123 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclInRecord where
+  type KeyType Glean.Schema.Cxx1.Types.DeclInRecord =
+       Glean.Schema.Cxx1.Types.DeclInRecord_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclInRecord" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.declInRecord_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclInRecord x k
+  getFactKey = Glean.Schema.Cxx1.Types.declInRecord_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2132 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclInRecord where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2138 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordStructLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordStructLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordStructLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordStructLowerCase_key" (Prelude.Just 0))
+{-# LINE 2147 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.RecordStructLowerCase_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2149 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordStructLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordStructLowerCase =
+       Glean.Schema.Cxx1.Types.RecordStructLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordStructLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordStructLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordStructLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordStructLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2158 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordStructLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2164 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcMethodDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcMethodDefinition =
+       Glean.Schema.Cxx1.Types.ObjcMethodDeclaration
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcMethodDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcMethodDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcMethodDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcMethodDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2173 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcMethodDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2179 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcContainerBase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerBase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcContainerBase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerBase_key" (Prelude.Just 0))
+{-# LINE 2188 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcContainerBase_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+       ('Angle.TField "base"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2190 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.ObjcContainerBase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcContainerBase =
+       Glean.Schema.Cxx1.Types.ObjcContainerBase_key
+  getName _proxy = Glean.PredicateRef "cxx1.ObjcContainerBase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcContainerBase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcContainerBase x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcContainerBase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2199 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcContainerBase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2205 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.VariableLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.VariableLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.VariableLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.VariableLowerCase_key" (Prelude.Just 0))
+{-# LINE 2214 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.VariableLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2216 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.VariableLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.VariableLowerCase =
+       Glean.Schema.Cxx1.Types.VariableLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.VariableLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.variableLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.VariableLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.variableLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2225 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.VariableLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2231 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDeclaration_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDeclaration_key" (Prelude.Just 0))
+{-# LINE 2244 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FunctionDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionQName)
+       ('Angle.TField "signature"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+          ('Angle.TField "method"
+             (Prelude.Maybe Glean.Schema.Cxx1.Types.MethodSignature)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 2246 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FunctionDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration =
+       Glean.Schema.Cxx1.Types.FunctionDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2255 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2261 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDerived_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.RecordDerived_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDerived_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDerived_key" (Prelude.Just 0))
+{-# LINE 2270 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.RecordDerived_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+       ('Angle.TField "derived"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2272 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.RecordDerived
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDerived =
+       Glean.Schema.Cxx1.Types.RecordDerived_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordDerived" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.recordDerived_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDerived x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDerived_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2281 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDerived where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2287 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.UsingDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.UsingDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.UsingDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.UsingDeclaration_key" (Prelude.Just 0))
+{-# LINE 2296 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.UsingDeclaration_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionQName)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 2298 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.UsingDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.UsingDeclaration =
+       Glean.Schema.Cxx1.Types.UsingDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.UsingDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.usingDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.UsingDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.usingDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2307 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.UsingDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2313 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDeclaration_key" (Prelude.Just 0))
+{-# LINE 2324 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.RecordDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "kind" (Glean.Schema.Cxx1.Types.RecordKind)
+          ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 2326 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.RecordDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDeclaration =
+       Glean.Schema.Cxx1.Types.RecordDeclaration_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2335 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2341 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclarationNameString_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDeclarationNameString_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationNameString_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDeclarationNameString_key"
+           (Prelude.Just 0))
+{-# LINE 2350 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.FunctionDeclarationNameString_key
+     =
+     'Angle.TField "fname"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2352 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FunctionDeclarationNameString
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDeclarationNameString
+       = Glean.Schema.Cxx1.Types.FunctionDeclarationNameString_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.FunctionDeclarationNameString" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.functionDeclarationNameString_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDeclarationNameString x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.functionDeclarationNameString_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2361 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.FunctionDeclarationNameString
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2367 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordDeclarationUnion_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordDeclarationUnion_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDeclarationUnion_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDeclarationUnion_key"
+           (Prelude.Just 0))
+{-# LINE 2378 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.RecordDeclarationUnion_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 2380 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordDeclarationUnion
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDeclarationUnion =
+       Glean.Schema.Cxx1.Types.RecordDeclarationUnion_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordDeclarationUnion" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordDeclarationUnion_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDeclarationUnion x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDeclarationUnion_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2389 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDeclarationUnion
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2395 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.RecordDeclarationClass_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.RecordDeclarationClass_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordDeclarationClass_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordDeclarationClass_key"
+           (Prelude.Just 0))
+{-# LINE 2406 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.RecordDeclarationClass_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 2408 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.RecordDeclarationClass
+         where
+  type KeyType Glean.Schema.Cxx1.Types.RecordDeclarationClass =
+       Glean.Schema.Cxx1.Types.RecordDeclarationClass_key
+  getName _proxy = Glean.PredicateRef "cxx1.RecordDeclarationClass" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.recordDeclarationClass_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.RecordDeclarationClass x k
+  getFactKey = Glean.Schema.Cxx1.Types.recordDeclarationClass_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2417 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordDeclarationClass
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2423 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcInterfaceToImplementation_key"
+           (Prelude.Just 0))
+{-# LINE 2432 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation_key
+     =
+     'Angle.TField "interface_"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+       ('Angle.TField "implementation"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2434 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation
+       = Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcInterfaceToImplementation" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Cxx1.Types.objcInterfaceToImplementation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation x k
+  getFactKey
+    = Glean.Schema.Cxx1.Types.objcInterfaceToImplementation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2443 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcInterfaceToImplementation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2449 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PPDefineLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.PPDefineLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.PPDefineLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.PPDefineLocation_key" (Prelude.Just 0))
+{-# LINE 2462 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.PPDefineLocation_key =
+     'Angle.TField "define"
+       (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 2464 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.PPDefineLocation
+         where
+  type KeyType Glean.Schema.Cxx1.Types.PPDefineLocation =
+       Glean.Schema.Cxx1.Types.PPDefineLocation_key
+  getName _proxy = Glean.PredicateRef "cxx1.PPDefineLocation" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.pPDefineLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.PPDefineLocation x k
+  getFactKey = Glean.Schema.Cxx1.Types.pPDefineLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2473 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PPDefineLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2479 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationScope_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationScope_key" (Prelude.Just 0))
+{-# LINE 2488 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationScope_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TNoFields))
+{-# LINE 2490 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationScope
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationScope =
+       Glean.Schema.Cxx1.Types.DeclarationScope_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationScope" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationScope x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2499 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationScope where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2505 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationComment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DeclarationComment_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.DeclarationComment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DeclarationComment_key" (Prelude.Just 0))
+{-# LINE 2516 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.DeclarationComment_key =
+     'Angle.TField "declaration" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 2518 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.DeclarationComment
+         where
+  type KeyType Glean.Schema.Cxx1.Types.DeclarationComment =
+       Glean.Schema.Cxx1.Types.DeclarationComment_key
+  getName _proxy = Glean.PredicateRef "cxx1.DeclarationComment" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.declarationComment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.DeclarationComment x k
+  getFactKey = Glean.Schema.Cxx1.Types.declarationComment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2527 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DeclarationComment
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2533 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceLowerCase_key" (Prelude.Just 0))
+{-# LINE 2542 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.NamespaceLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2544 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.NamespaceLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceLowerCase =
+       Glean.Schema.Cxx1.Types.NamespaceLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.NamespaceLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2553 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2559 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceQName_key
+         where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.NamespaceQName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.NamespaceQName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceQName_key" (Prelude.Just 0))
+{-# LINE 2568 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.NamespaceQName_key =
+     'Angle.TField "name" (Prelude.Maybe Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Cxx1.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 2570 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.NamespaceQName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.NamespaceQName =
+       Glean.Schema.Cxx1.Types.NamespaceQName_key
+  getName _proxy = Glean.PredicateRef "cxx1.NamespaceQName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.namespaceQName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.NamespaceQName x k
+  getFactKey = Glean.Schema.Cxx1.Types.namespaceQName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2579 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceQName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2585 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FilePPUseTraceXRefs_key" (Prelude.Just 0))
+{-# LINE 2598 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "trace"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+             ('Angle.TField "define"
+                (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+                ('Angle.TNoFields))))
+{-# LINE 2600 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs =
+       Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs_key
+  getName _proxy = Glean.PredicateRef "cxx1.FilePPUseTraceXRefs" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.filePPUseTraceXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs x k
+  getFactKey = Glean.Schema.Cxx1.Types.filePPUseTraceXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2609 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FilePPUseTraceXRefs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2615 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.EnumDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.EnumDeclarationByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumDeclarationByName_key" (Prelude.Just 0))
+{-# LINE 2626 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.EnumDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 2628 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.EnumDeclarationByName
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumDeclarationByName =
+       Glean.Schema.Cxx1.Types.EnumDeclarationByName_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumDeclarationByName" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.enumDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumDeclarationByName x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2637 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2643 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration_key x1 x2 x3 x4 x5
+       x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcPropertyDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 2664 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "container"
+          (Glean.Schema.Cxx1.Types.ObjcContainerId)
+          ('Angle.TField "type" (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+             ('Angle.TField "isInstance" (Prelude.Bool)
+                ('Angle.TField "isOptional" (Prelude.Bool)
+                   ('Angle.TField "isReadOnly" (Prelude.Bool)
+                      ('Angle.TField "isAtomic" (Prelude.Bool)
+                         ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                            ('Angle.TNoFields))))))))
+{-# LINE 2666 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration
+         where
+  type KeyType Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration =
+       Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "cxx1.ObjcPropertyDeclaration" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.objcPropertyDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration x k
+  getFactKey = Glean.Schema.Cxx1.Types.objcPropertyDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2675 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2681 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumLowerCase_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.EnumLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.EnumLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.EnumLowerCase_key" (Prelude.Just 0))
+{-# LINE 2690 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.EnumLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2692 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.EnumLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.EnumLowerCase =
+       Glean.Schema.Cxx1.Types.EnumLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.EnumLowerCase" 5
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.enumLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.EnumLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.enumLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2701 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.EnumLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2707 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TypeAliasLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.TypeAliasLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.TypeAliasLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TypeAliasLowerCase_key" (Prelude.Just 0))
+{-# LINE 2716 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.TypeAliasLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2718 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.TypeAliasLowerCase
+         where
+  type KeyType Glean.Schema.Cxx1.Types.TypeAliasLowerCase =
+       Glean.Schema.Cxx1.Types.TypeAliasLowerCase_key
+  getName _proxy = Glean.PredicateRef "cxx1.TypeAliasLowerCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.typeAliasLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.TypeAliasLowerCase x k
+  getFactKey = Glean.Schema.Cxx1.Types.typeAliasLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2727 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TypeAliasLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2733 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionAttribute_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionAttribute_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionAttribute_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionAttribute_key" (Prelude.Just 0))
+{-# LINE 2742 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FunctionAttribute_key =
+     'Angle.TField "attr"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.Attribute)
+       ('Angle.TField "declaration"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2744 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FunctionAttribute
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionAttribute =
+       Glean.Schema.Cxx1.Types.FunctionAttribute_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionAttribute" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionAttribute_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionAttribute x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionAttribute_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2753 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionAttribute where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2759 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Trace_key where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Trace_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Trace_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Trace_key" (Prelude.Just 0))
+{-# LINE 2770 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.Trace_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "declarations"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Declarations)
+          ('Angle.TField "preprocessor"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.PPTrace)
+             ('Angle.TNoFields)))
+{-# LINE 2772 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.Trace where
+  type KeyType Glean.Schema.Cxx1.Types.Trace =
+       Glean.Schema.Cxx1.Types.Trace_key
+  getName _proxy = Glean.PredicateRef "cxx1.Trace" 5
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Cxx1.Types.trace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.Trace x k
+  getFactKey = Glean.Schema.Cxx1.Types.trace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2781 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Trace where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2787 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.FunctionDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FunctionDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FunctionDefinition_key" (Prelude.Just 0))
+{-# LINE 2796 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.FunctionDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+       ('Angle.TField "isInline" (Prelude.Bool) ('Angle.TNoFields))
+{-# LINE 2798 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Cxx1.Types.FunctionDefinition
+         where
+  type KeyType Glean.Schema.Cxx1.Types.FunctionDefinition =
+       Glean.Schema.Cxx1.Types.FunctionDefinition_key
+  getName _proxy = Glean.PredicateRef "cxx1.FunctionDefinition" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Cxx1.Types.functionDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Cxx1.Types.FunctionDefinition x k
+  getFactKey = Glean.Schema.Cxx1.Types.functionDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2807 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FunctionDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2813 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.GlobalVariableKind
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.GlobalVariableKind" (Prelude.Just 5))
+{-# LINE 2818 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.GlobalVariableKind =
+     'Angle.TField "SimpleVariable" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "StaticVariable" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "StaticMember" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2820 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.GlobalVariableKind
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.GlobalVariableKind =
+       Glean.Schema.Cxx1.Types.GlobalVariableKind
+  enumName v = Text.pack (Prelude.drop 19 (Prelude.show v))
+{-# LINE 2824 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.IncludeTrace where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.IncludeTrace x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.IncludeTrace <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.IncludeTrace" (Prelude.Just 5))
+{-# LINE 2833 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.IncludeTrace =
+     'Angle.TField "include_"
+       (Glean.KeyType Glean.Schema.Pp1.Types.Include)
+       ('Angle.TField "trace"
+          (Prelude.Maybe Glean.Schema.Cxx1.Types.Trace)
+          ('Angle.TNoFields))
+{-# LINE 2835 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.LocalVariableKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.LocalVariableKind" (Prelude.Just 5))
+{-# LINE 2840 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.LocalVariableKind =
+     'Angle.TField "SimpleVariable" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "StaticVariable" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Parameter" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2842 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.LocalVariableKind
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.LocalVariableKind =
+       Glean.Schema.Cxx1.Types.LocalVariableKind
+  enumName v = Text.pack (Prelude.drop 18 (Prelude.show v))
+{-# LINE 2846 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Scope where
+  buildRtsValue b Glean.Schema.Cxx1.Types.Scope_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Scope_global_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Scope_namespace_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Scope_recordWithAccess x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Scope_local x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Cxx1.Types.Scope_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.Scope_global_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Scope_namespace_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Scope_recordWithAccess,
+         Glean.mapD Glean.Schema.Cxx1.Types.Scope_local]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "cxx1.Scope" (Prelude.Just 5))
+{-# LINE 2870 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.Scope =
+     'Angle.TField "global_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "namespace_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceQName)
+          ('Angle.TField "recordWithAccess"
+             (Glean.Schema.Cxx1.Types.Scope_recordWithAccess_)
+             ('Angle.TField "local"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionQName)
+                ('Angle.TNoFields))))
+{-# LINE 2872 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.XRefVia where
+  buildRtsValue b Glean.Schema.Cxx1.Types.XRefVia_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.XRefVia_usingDeclaration x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefVia_usingDirective x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefVia_macro x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Cxx1.Types.XRefVia_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.XRefVia_usingDeclaration,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefVia_usingDirective,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefVia_macro]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.XRefVia" (Prelude.Just 5))
+{-# LINE 2892 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.XRefVia =
+     'Angle.TField "usingDeclaration"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.UsingDeclaration)
+       ('Angle.TField "usingDirective"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.UsingDirective)
+          ('Angle.TField "macro" (Glean.KeyType Glean.Schema.Pp1.Types.Use)
+             ('Angle.TNoFields)))
+{-# LINE 2894 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordBase where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.RecordBase x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.RecordBase <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordBase" (Prelude.Just 5))
+{-# LINE 2905 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.RecordBase
+     =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+       ('Angle.TField "access" (Glean.Schema.Cxx1.Types.Access)
+          ('Angle.TField "isVirtual" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 2907 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PPEvent where
+  buildRtsValue b Glean.Schema.Cxx1.Types.PPEvent_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PPEvent_include_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PPEvent_define x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PPEvent_undef x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PPEvent_use x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Cxx1.Types.PPEvent_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.PPEvent_include_,
+         Glean.mapD Glean.Schema.Cxx1.Types.PPEvent_define,
+         Glean.mapD Glean.Schema.Cxx1.Types.PPEvent_undef,
+         Glean.mapD Glean.Schema.Cxx1.Types.PPEvent_use]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.PPEvent" (Prelude.Just 5))
+{-# LINE 2931 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.PPEvent =
+     'Angle.TField "include_" (Glean.Schema.Cxx1.Types.IncludeTrace)
+       ('Angle.TField "define"
+          (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+          ('Angle.TField "undef" (Glean.KeyType Glean.Schema.Pp1.Types.Undef)
+             ('Angle.TField "use" (Glean.KeyType Glean.Schema.Pp1.Types.Use)
+                ('Angle.TNoFields))))
+{-# LINE 2933 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.GlobalVariableAttribute
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.GlobalVariableAttribute" (Prelude.Just 5))
+{-# LINE 2938 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.GlobalVariableAttribute =
+     'Angle.TField "Plain" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Inline" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Constexpr" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2940 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.Cxx1.Types.GlobalVariableAttribute
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.GlobalVariableAttribute =
+       Glean.Schema.Cxx1.Types.GlobalVariableAttribute
+  enumName v = Text.pack (Prelude.drop 24 (Prelude.show v))
+{-# LINE 2944 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MaybeIncludeTree where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.MaybeIncludeTree x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.MaybeIncludeTree <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.MaybeIncludeTree" (Prelude.Just 5))
+{-# LINE 2951 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.MaybeIncludeTree =
+     'Angle.TField "tree"
+       (Prelude.Maybe Glean.Schema.Cxx1.Types.IncludeTree)
+       ('Angle.TNoFields)
+{-# LINE 2953 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcContainerId where
+  buildRtsValue b Glean.Schema.Cxx1.Types.ObjcContainerId_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_protocol x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_interface_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_categoryInterface x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_extensionInterface x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_implementation x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.ObjcContainerId_categoryImplementation x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.ObjcContainerId_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.ObjcContainerId_protocol,
+         Glean.mapD Glean.Schema.Cxx1.Types.ObjcContainerId_interface_,
+         Glean.mapD
+           Glean.Schema.Cxx1.Types.ObjcContainerId_categoryInterface,
+         Glean.mapD
+           Glean.Schema.Cxx1.Types.ObjcContainerId_extensionInterface,
+         Glean.mapD Glean.Schema.Cxx1.Types.ObjcContainerId_implementation,
+         Glean.mapD
+           Glean.Schema.Cxx1.Types.ObjcContainerId_categoryImplementation]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcContainerId" (Prelude.Just 5))
+{-# LINE 2985 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.ObjcContainerId =
+     'Angle.TField "protocol"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "interface_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TField "categoryInterface"
+             (Glean.Schema.Cxx1.Types.ObjcCategoryId)
+             ('Angle.TField "extensionInterface"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+                ('Angle.TField "implementation"
+                   (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+                   ('Angle.TField "categoryImplementation"
+                      (Glean.Schema.Cxx1.Types.ObjcCategoryId)
+                      ('Angle.TNoFields))))))
+{-# LINE 2987 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.DefinitionEntity where
+  buildRtsValue b Glean.Schema.Cxx1.Types.DefinitionEntity_EMPTY
+    = Glean.buildRtsSelector b 7
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_record_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_function_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.DefinitionEntity_enum_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_objcMethod x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_objcContainer x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_variable x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.DefinitionEntity_namespace_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.DefinitionEntity_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_record_,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_function_,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_enum_,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_objcMethod,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_objcContainer,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_variable,
+         Glean.mapD Glean.Schema.Cxx1.Types.DefinitionEntity_namespace_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.DefinitionEntity" (Prelude.Just 5))
+{-# LINE 3023 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.DefinitionEntity =
+     'Angle.TField "record_"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDefinition)
+       ('Angle.TField "function_"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDefinition)
+          ('Angle.TField "enum_"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDefinition)
+             ('Angle.TField "objcMethod"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDefinition)
+                ('Angle.TField "objcContainer"
+                   (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDefinition)
+                   ('Angle.TField "variable"
+                      (Glean.KeyType Glean.Schema.Cxx1.Types.VariableDeclaration)
+                      ('Angle.TField "namespace_"
+                         (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDefinition)
+                         ('Angle.TNoFields)))))))
+{-# LINE 3025 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.VariableKind where
+  buildRtsValue b Glean.Schema.Cxx1.Types.VariableKind_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Cxx1.Types.VariableKind_global_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.VariableKind_local x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.VariableKind_field x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.VariableKind_ivar x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.VariableKind_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.VariableKind_global_,
+         Glean.mapD Glean.Schema.Cxx1.Types.VariableKind_local,
+         Glean.mapD Glean.Schema.Cxx1.Types.VariableKind_field,
+         Glean.mapD Glean.Schema.Cxx1.Types.VariableKind_ivar]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.VariableKind" (Prelude.Just 5))
+{-# LINE 3049 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.VariableKind
+     =
+     'Angle.TField "global_" (Glean.Schema.Cxx1.Types.GlobalVariable)
+       ('Angle.TField "local" (Glean.Schema.Cxx1.Types.LocalVariable)
+          ('Angle.TField "field" (Glean.Schema.Cxx1.Types.Field)
+             ('Angle.TField "ivar" (Glean.Schema.Cxx1.Types.ObjcIVar)
+                ('Angle.TNoFields))))
+{-# LINE 3051 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RecordKind where
+  buildRtsValue b Glean.Schema.Cxx1.Types.RecordKind_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Cxx1.Types.RecordKind_struct_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.RecordKind_class_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.RecordKind_union_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.RecordKind_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.RecordKind_struct_,
+         Glean.mapD Glean.Schema.Cxx1.Types.RecordKind_class_,
+         Glean.mapD Glean.Schema.Cxx1.Types.RecordKind_union_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RecordKind" (Prelude.Just 5))
+{-# LINE 3071 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.RecordKind =
+     'Angle.TField "struct_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "class_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "union_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 3073 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.TypeAliasKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.TypeAliasKind" (Prelude.Just 5))
+{-# LINE 3078 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.TypeAliasKind
+     =
+     'Angle.TField "Typedef" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Using" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 3080 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.TypeAliasKind
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.TypeAliasKind =
+       Glean.Schema.Cxx1.Types.TypeAliasKind
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 3084 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Declaration where
+  buildRtsValue b Glean.Schema.Cxx1.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 12
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_namespace_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Declaration_usingDeclaration x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Declaration_usingDirective x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_record_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_enum_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_function_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_variable x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Declaration_objcContainer x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_objcMethod x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Declaration_objcProperty x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Declaration_typeAlias x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Declaration_namespaceAlias x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.Declaration_namespace_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_usingDeclaration,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_usingDirective,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_record_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_enum_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_function_,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_variable,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_objcContainer,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_objcMethod,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_objcProperty,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_typeAlias,
+         Glean.mapD Glean.Schema.Cxx1.Types.Declaration_namespaceAlias]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Declaration" (Prelude.Just 5))
+{-# LINE 3140 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.Declaration =
+     'Angle.TField "namespace_"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration)
+       ('Angle.TField "usingDeclaration"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.UsingDeclaration)
+          ('Angle.TField "usingDirective"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.UsingDirective)
+             ('Angle.TField "record_"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.RecordDeclaration)
+                ('Angle.TField "enum_"
+                   (Glean.KeyType Glean.Schema.Cxx1.Types.EnumDeclaration)
+                   ('Angle.TField "function_"
+                      (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionDeclaration)
+                      ('Angle.TField "variable"
+                         (Glean.KeyType Glean.Schema.Cxx1.Types.VariableDeclaration)
+                         ('Angle.TField "objcContainer"
+                            (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcContainerDeclaration)
+                            ('Angle.TField "objcMethod"
+                               (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclaration)
+                               ('Angle.TField "objcProperty"
+                                  (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcPropertyDeclaration)
+                                  ('Angle.TField "typeAlias"
+                                     (Glean.KeyType Glean.Schema.Cxx1.Types.TypeAliasDeclaration)
+                                     ('Angle.TField "namespaceAlias"
+                                        (Glean.KeyType
+                                           Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration)
+                                        ('Angle.TNoFields))))))))))))
+{-# LINE 3142 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Parameter where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Parameter x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Parameter <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Parameter" (Prelude.Just 5))
+{-# LINE 3151 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.Parameter
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Cxx1.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 3153 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.From where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.From x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.From <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "cxx1.From" (Prelude.Just 5))
+{-# LINE 3164 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.From =
+     'Angle.TField "spans" (Glean.Schema.Src.Types.PackedByteSpans)
+       ('Angle.TField "expansions"
+          (Glean.Schema.Src.Types.PackedByteSpans)
+          ('Angle.TField "spellings" (Glean.Schema.Src.Types.PackedByteSpans)
+             ('Angle.TNoFields)))
+{-# LINE 3166 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcIVar where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.ObjcIVar x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcIVar <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcIVar" (Prelude.Just 5))
+{-# LINE 3175 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcIVar =
+     'Angle.TField "synthesize" (Prelude.Bool)
+       ('Angle.TField "bitsize" (Prelude.Maybe Glean.Nat)
+          ('Angle.TNoFields))
+{-# LINE 3177 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.XRefTarget where
+  buildRtsValue b Glean.Schema.Cxx1.Types.XRefTarget_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefTarget_declaration x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefTarget_enumerator x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefTarget_objcSelector x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.XRefTarget_objcSelectorSlot x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefTarget_unknown x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.XRefTarget_indirect x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.XRefTarget_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_declaration,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_enumerator,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_objcSelector,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_objcSelectorSlot,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_unknown,
+         Glean.mapD Glean.Schema.Cxx1.Types.XRefTarget_indirect]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.XRefTarget" (Prelude.Just 5))
+{-# LINE 3209 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.XRefTarget =
+     'Angle.TField "declaration" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "enumerator"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Enumerator)
+          ('Angle.TField "objcSelector"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcSelector)
+             ('Angle.TField "objcSelectorSlot"
+                (Glean.Schema.Cxx1.Types.ObjcSelectorSlot)
+                ('Angle.TField "unknown" (Glean.Schema.Src.Types.Loc)
+                   ('Angle.TField "indirect"
+                      (Glean.KeyType Glean.Schema.Cxx1.Types.XRefIndirectTarget)
+                      ('Angle.TNoFields))))))
+{-# LINE 3211 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.PpEntity where
+  buildRtsValue b Glean.Schema.Cxx1.Types.PpEntity_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PpEntity_define x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PpEntity_undef x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Cxx1.Types.PpEntity_include_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Cxx1.Types.PpEntity_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.PpEntity_define,
+         Glean.mapD Glean.Schema.Cxx1.Types.PpEntity_undef,
+         Glean.mapD Glean.Schema.Cxx1.Types.PpEntity_include_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.PpEntity" (Prelude.Just 5))
+{-# LINE 3231 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.PpEntity =
+     'Angle.TField "define"
+       (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+       ('Angle.TField "undef" (Glean.KeyType Glean.Schema.Pp1.Types.Undef)
+          ('Angle.TField "include_"
+             (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
+{-# LINE 3233 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.NamespaceTarget where
+  buildRtsValue b Glean.Schema.Cxx1.Types.NamespaceTarget_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceTarget_namespace_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.NamespaceTarget_namespaceAlias x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Cxx1.Types.NamespaceTarget_EMPTY)
+        [Glean.mapD Glean.Schema.Cxx1.Types.NamespaceTarget_namespace_,
+         Glean.mapD Glean.Schema.Cxx1.Types.NamespaceTarget_namespaceAlias]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.NamespaceTarget" (Prelude.Just 5))
+{-# LINE 3249 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.NamespaceTarget =
+     'Angle.TField "namespace_"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceDeclaration)
+       ('Angle.TField "namespaceAlias"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceAliasDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 3251 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.MethodSignature where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.MethodSignature x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.MethodSignature <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.MethodSignature" (Prelude.Just 5))
+{-# LINE 3264 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.MethodSignature =
+     'Angle.TField "isVirtual" (Prelude.Bool)
+       ('Angle.TField "isConst" (Prelude.Bool)
+          ('Angle.TField "isVolatile" (Prelude.Bool)
+             ('Angle.TField "refQualifier"
+                (Glean.Schema.Cxx1.Types.RefQualifier)
+                ('Angle.TNoFields))))
+{-# LINE 3266 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.LocalVariable where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.LocalVariable x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.LocalVariable <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.LocalVariable" (Prelude.Just 5))
+{-# LINE 3275 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.LocalVariable =
+     'Angle.TField "kind" (Glean.Schema.Cxx1.Types.LocalVariableKind)
+       ('Angle.TField "attribute"
+          (Glean.Schema.Cxx1.Types.LocalVariableAttribute)
+          ('Angle.TNoFields))
+{-# LINE 3277 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.LocalVariableAttribute
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.LocalVariableAttribute" (Prelude.Just 5))
+{-# LINE 3282 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.LocalVariableAttribute =
+     'Angle.TField "Plain" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Constexpr" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 3284 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.Cxx1.Types.LocalVariableAttribute
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.LocalVariableAttribute =
+       Glean.Schema.Cxx1.Types.LocalVariableAttribute
+  enumName v = Text.pack (Prelude.drop 23 (Prelude.show v))
+{-# LINE 3288 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.GlobalVariable where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.GlobalVariable x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.GlobalVariable <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.GlobalVariable" (Prelude.Just 5))
+{-# LINE 3299 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.GlobalVariable =
+     'Angle.TField "kind" (Glean.Schema.Cxx1.Types.GlobalVariableKind)
+       ('Angle.TField "attribute"
+          (Glean.Schema.Cxx1.Types.GlobalVariableAttribute)
+          ('Angle.TField "definition" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 3301 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcCategoryId where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.ObjcCategoryId x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcCategoryId <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcCategoryId" (Prelude.Just 5))
+{-# LINE 3310 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcCategoryId =
+     'Angle.TField "className"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "categoryName"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 3312 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcSelectorSlot where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.ObjcSelectorSlot x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.ObjcSelectorSlot <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcSelectorSlot" (Prelude.Just 5))
+{-# LINE 3321 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.ObjcSelectorSlot =
+     'Angle.TField "objcMethod"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.ObjcMethodDeclaration)
+       ('Angle.TField "index" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 3323 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.ObjcPropertyKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.ObjcPropertyKind" (Prelude.Just 5))
+{-# LINE 3328 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Cxx1.Types.ObjcPropertyKind =
+     'Angle.TField "Synthesize" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Dynamic" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 3330 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.ObjcPropertyKind
+         where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.ObjcPropertyKind =
+       Glean.Schema.Cxx1.Types.ObjcPropertyKind
+  enumName v = Text.pack (Prelude.drop 17 (Prelude.show v))
+{-# LINE 3334 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Access where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "cxx1.Access" (Prelude.Just 5))
+{-# LINE 3339 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.Access =
+     'Angle.TField "Public" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Protected" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Private" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 3341 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.Access where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.Access =
+       Glean.Schema.Cxx1.Types.Access
+  enumName v = Text.pack (Prelude.drop 7 (Prelude.show v))
+{-# LINE 3345 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.FixedXRef where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.FixedXRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.FixedXRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.FixedXRef" (Prelude.Just 5))
+{-# LINE 3354 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.FixedXRef
+     =
+     'Angle.TField "target" (Glean.Schema.Cxx1.Types.XRefTarget)
+       ('Angle.TField "from" (Glean.Schema.Cxx1.Types.From)
+          ('Angle.TNoFields))
+{-# LINE 3356 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Field where
+  buildRtsValue b (Glean.Schema.Cxx1.Types.Field x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Field <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "cxx1.Field" (Prelude.Just 5))
+{-# LINE 3365 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Cxx1.Types.Field =
+     'Angle.TField "mutable_" (Prelude.Bool)
+       ('Angle.TField "bitsize" (Prelude.Maybe Glean.Nat)
+          ('Angle.TNoFields))
+{-# LINE 3367 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.RefQualifier where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.RefQualifier" (Prelude.Just 5))
+{-# LINE 3372 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Cxx1.Types.RefQualifier
+     =
+     'Angle.TField "None_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "LValue" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "RValue" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 3374 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Cxx1.Types.RefQualifier where
+  type AngleEnumTy Glean.Schema.Cxx1.Types.RefQualifier =
+       Glean.Schema.Cxx1.Types.RefQualifier
+  enumName v = Text.pack (Prelude.drop 13 (Prelude.show v))
+{-# LINE 3378 "glean/schema/thrift/cxx1_include.hs" #-}
+instance Glean.Type Glean.Schema.Cxx1.Types.Scope_recordWithAccess_
+         where
+  buildRtsValue b
+    (Glean.Schema.Cxx1.Types.Scope_recordWithAccess_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Cxx1.Types.Scope_recordWithAccess_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "cxx1.Scope_recordWithAccess_" (Prelude.Just 0))
+{-# LINE 3387 "glean/schema/thrift/cxx1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Cxx1.Types.Scope_recordWithAccess_
+     =
+     'Angle.TField "record"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+       ('Angle.TField "access" (Glean.Schema.Cxx1.Types.Access)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Dataswarm/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Dataswarm/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Dataswarm/Types.hs
@@ -0,0 +1,2114 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/dataswarm_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/dataswarm_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/dataswarm_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Dataswarm/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Dataswarm.Types
+       (pREDICATE_VERSIONS, TableDeclaration_id,
+        TableDeclaration(TableDeclaration, tableDeclaration_id,
+                         tableDeclaration_key),
+        TableColumnDeclaration_id,
+        TableColumnDeclaration(TableColumnDeclaration,
+                               tableColumnDeclaration_id, tableColumnDeclaration_key),
+        SubqueryDeclaration_id,
+        SubqueryDeclaration(SubqueryDeclaration, subqueryDeclaration_id,
+                            subqueryDeclaration_key),
+        SubqueryColumnDeclaration_id,
+        SubqueryColumnDeclaration(SubqueryColumnDeclaration,
+                                  subqueryColumnDeclaration_id, subqueryColumnDeclaration_key),
+        MacroDeclaration_id,
+        MacroDeclaration(MacroDeclaration, macroDeclaration_id,
+                         macroDeclaration_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationName_id,
+        DeclarationName(DeclarationName, declarationName_id,
+                        declarationName_key),
+        XRefsByFile_id,
+        XRefsByFile(XRefsByFile, xRefsByFile_id, xRefsByFile_key),
+        TableDeclaration_key(TableDeclaration_key,
+                             tableDeclaration_key_table_name,
+                             tableDeclaration_key_table_namespace),
+        TableColumnDeclaration_key(TableColumnDeclaration_key,
+                                   tableColumnDeclaration_key_table_name,
+                                   tableColumnDeclaration_key_table_namespace,
+                                   tableColumnDeclaration_key_column_name),
+        SubqueryDeclaration_key(SubqueryDeclaration_key,
+                                subqueryDeclaration_key_task_id, subqueryDeclaration_key_name),
+        SubqueryColumnDeclaration_key(SubqueryColumnDeclaration_key,
+                                      subqueryColumnDeclaration_key_task_id,
+                                      subqueryColumnDeclaration_key_subquery_name,
+                                      subqueryColumnDeclaration_key_column_name),
+        MacroDeclaration_key(MacroDeclaration_key,
+                             macroDeclaration_key_task_id, macroDeclaration_key_name),
+        Declaration(Declaration_EMPTY, Declaration_macro,
+                    Declaration_table, Declaration_subquery, Declaration_table_column,
+                    Declaration_subquery_column),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_declaration, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationName_key(DeclarationName_key,
+                            declarationName_key_declaration, declarationName_key_name),
+        XRef(XRef, xRef_target, xRef_source),
+        XRefsByFile_key(XRefsByFile_key, xRefsByFile_key_file,
+                        xRefsByFile_key_xrefs))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/dataswarm_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 123 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Dataswarm/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("SubqueryDeclaration", 1), ("MacroDeclaration", 1),
+       ("TableDeclaration", 1), ("SubqueryColumnDeclaration", 1),
+       ("DeclarationName", 1), ("TableColumnDeclaration", 1),
+       ("DeclarationLocation", 1), ("XRefsByFile", 1)]
+
+type TableDeclaration_id = Glean.Id
+
+data TableDeclaration = TableDeclaration{tableDeclaration_id ::
+                                         {-# UNPACK #-} !TableDeclaration_id,
+                                         tableDeclaration_key :: Prelude.Maybe TableDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TableDeclaration where
+  toJSON (TableDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TableDeclaration where
+  buildStruct _proxy (TableDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TableDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TableDeclaration where
+  rnf (TableDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TableDeclaration where
+  def = TableDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TableDeclaration where
+  hashWithSalt __salt (TableDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TableColumnDeclaration_id = Glean.Id
+
+data TableColumnDeclaration = TableColumnDeclaration{tableColumnDeclaration_id
+                                                     :: {-# UNPACK #-} !TableColumnDeclaration_id,
+                                                     tableColumnDeclaration_key ::
+                                                     Prelude.Maybe TableColumnDeclaration_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TableColumnDeclaration where
+  toJSON (TableColumnDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TableColumnDeclaration where
+  buildStruct _proxy
+    (TableColumnDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TableColumnDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TableColumnDeclaration where
+  rnf (TableColumnDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TableColumnDeclaration where
+  def = TableColumnDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TableColumnDeclaration where
+  hashWithSalt __salt (TableColumnDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SubqueryDeclaration_id = Glean.Id
+
+data SubqueryDeclaration = SubqueryDeclaration{subqueryDeclaration_id
+                                               :: {-# UNPACK #-} !SubqueryDeclaration_id,
+                                               subqueryDeclaration_key ::
+                                               Prelude.Maybe SubqueryDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SubqueryDeclaration where
+  toJSON (SubqueryDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SubqueryDeclaration where
+  buildStruct _proxy (SubqueryDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SubqueryDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SubqueryDeclaration where
+  rnf (SubqueryDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SubqueryDeclaration where
+  def = SubqueryDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable SubqueryDeclaration where
+  hashWithSalt __salt (SubqueryDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SubqueryColumnDeclaration_id = Glean.Id
+
+data SubqueryColumnDeclaration = SubqueryColumnDeclaration{subqueryColumnDeclaration_id
+                                                           ::
+                                                           {-# UNPACK #-} !SubqueryColumnDeclaration_id,
+                                                           subqueryColumnDeclaration_key ::
+                                                           Prelude.Maybe
+                                                             SubqueryColumnDeclaration_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SubqueryColumnDeclaration where
+  toJSON (SubqueryColumnDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SubqueryColumnDeclaration where
+  buildStruct _proxy
+    (SubqueryColumnDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SubqueryColumnDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SubqueryColumnDeclaration where
+  rnf (SubqueryColumnDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SubqueryColumnDeclaration where
+  def = SubqueryColumnDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable SubqueryColumnDeclaration where
+  hashWithSalt __salt (SubqueryColumnDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MacroDeclaration_id = Glean.Id
+
+data MacroDeclaration = MacroDeclaration{macroDeclaration_id ::
+                                         {-# UNPACK #-} !MacroDeclaration_id,
+                                         macroDeclaration_key :: Prelude.Maybe MacroDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MacroDeclaration where
+  toJSON (MacroDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MacroDeclaration where
+  buildStruct _proxy (MacroDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MacroDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MacroDeclaration where
+  rnf (MacroDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MacroDeclaration where
+  def = MacroDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MacroDeclaration where
+  hashWithSalt __salt (MacroDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationName_id = Glean.Id
+
+data DeclarationName = DeclarationName{declarationName_id ::
+                                       {-# UNPACK #-} !DeclarationName_id,
+                                       declarationName_key :: Prelude.Maybe DeclarationName_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName where
+  toJSON (DeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationName where
+  buildStruct _proxy (DeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName where
+  rnf (DeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationName where
+  def = DeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationName where
+  hashWithSalt __salt (DeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefsByFile_id = Glean.Id
+
+data XRefsByFile = XRefsByFile{xRefsByFile_id ::
+                               {-# UNPACK #-} !XRefsByFile_id,
+                               xRefsByFile_key :: Prelude.Maybe XRefsByFile_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsByFile where
+  toJSON (XRefsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsByFile where
+  buildStruct _proxy (XRefsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsByFile where
+  rnf (XRefsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefsByFile where
+  def = XRefsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefsByFile where
+  hashWithSalt __salt (XRefsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data TableDeclaration_key = TableDeclaration_key{tableDeclaration_key_table_name
+                                                 :: Text.Text,
+                                                 tableDeclaration_key_table_namespace :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TableDeclaration_key where
+  toJSON
+    (TableDeclaration_key __field__table_name __field__table_namespace)
+    = Aeson.object
+        ("table_name" .= __field__table_name :
+           "table_namespace" .= __field__table_namespace : Prelude.mempty)
+
+instance Thrift.ThriftStruct TableDeclaration_key where
+  buildStruct _proxy
+    (TableDeclaration_key __field__table_name __field__table_namespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "table_name" (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__table_name)
+           :
+           Thrift.genField _proxy "table_namespace"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__table_namespace)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__table_name <- ST.newSTRef ""
+            __field__table_namespace <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__table_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__table_namespace
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__table_name <- ST.readSTRef
+                                                                     __field__table_name
+                                             !__val__table_namespace <- ST.readSTRef
+                                                                          __field__table_namespace
+                                             Prelude.pure
+                                               (TableDeclaration_key __val__table_name
+                                                  __val__table_namespace)
+              _idMap
+                = HashMap.fromList [("table_name", 1), ("table_namespace", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TableDeclaration_key where
+  rnf
+    (TableDeclaration_key __field__table_name __field__table_namespace)
+    = DeepSeq.rnf __field__table_name `Prelude.seq`
+        DeepSeq.rnf __field__table_namespace `Prelude.seq` ()
+
+instance Default.Default TableDeclaration_key where
+  def = TableDeclaration_key "" ""
+
+instance Hashable.Hashable TableDeclaration_key where
+  hashWithSalt __salt
+    (TableDeclaration_key _table_name _table_namespace)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _table_name)
+        _table_namespace
+
+data TableColumnDeclaration_key = TableColumnDeclaration_key{tableColumnDeclaration_key_table_name
+                                                             :: Text.Text,
+                                                             tableColumnDeclaration_key_table_namespace
+                                                             :: Text.Text,
+                                                             tableColumnDeclaration_key_column_name
+                                                             :: Text.Text}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TableColumnDeclaration_key where
+  toJSON
+    (TableColumnDeclaration_key __field__table_name
+       __field__table_namespace __field__column_name)
+    = Aeson.object
+        ("table_name" .= __field__table_name :
+           "table_namespace" .= __field__table_namespace :
+             "column_name" .= __field__column_name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TableColumnDeclaration_key where
+  buildStruct _proxy
+    (TableColumnDeclaration_key __field__table_name
+       __field__table_namespace __field__column_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "table_name" (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__table_name)
+           :
+           Thrift.genField _proxy "table_namespace"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__table_namespace)
+             :
+             Thrift.genField _proxy "column_name" (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__column_name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__table_name <- ST.newSTRef ""
+            __field__table_namespace <- ST.newSTRef ""
+            __field__column_name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__table_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__table_namespace
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__column_name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__table_name <- ST.readSTRef
+                                                                     __field__table_name
+                                             !__val__table_namespace <- ST.readSTRef
+                                                                          __field__table_namespace
+                                             !__val__column_name <- ST.readSTRef
+                                                                      __field__column_name
+                                             Prelude.pure
+                                               (TableColumnDeclaration_key __val__table_name
+                                                  __val__table_namespace
+                                                  __val__column_name)
+              _idMap
+                = HashMap.fromList
+                    [("table_name", 1), ("table_namespace", 2), ("column_name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TableColumnDeclaration_key where
+  rnf
+    (TableColumnDeclaration_key __field__table_name
+       __field__table_namespace __field__column_name)
+    = DeepSeq.rnf __field__table_name `Prelude.seq`
+        DeepSeq.rnf __field__table_namespace `Prelude.seq`
+          DeepSeq.rnf __field__column_name `Prelude.seq` ()
+
+instance Default.Default TableColumnDeclaration_key where
+  def = TableColumnDeclaration_key "" "" ""
+
+instance Hashable.Hashable TableColumnDeclaration_key where
+  hashWithSalt __salt
+    (TableColumnDeclaration_key _table_name _table_namespace
+       _column_name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _table_name)
+           _table_namespace)
+        _column_name
+
+data SubqueryDeclaration_key = SubqueryDeclaration_key{subqueryDeclaration_key_task_id
+                                                       :: Text.Text,
+                                                       subqueryDeclaration_key_name :: Text.Text}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SubqueryDeclaration_key where
+  toJSON (SubqueryDeclaration_key __field__task_id __field__name)
+    = Aeson.object
+        ("task_id" .= __field__task_id :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SubqueryDeclaration_key where
+  buildStruct _proxy
+    (SubqueryDeclaration_key __field__task_id __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "task_id" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__task_id)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__task_id <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__task_id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__task_id <- ST.readSTRef
+                                                                  __field__task_id
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SubqueryDeclaration_key __val__task_id __val__name)
+              _idMap = HashMap.fromList [("task_id", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SubqueryDeclaration_key where
+  rnf (SubqueryDeclaration_key __field__task_id __field__name)
+    = DeepSeq.rnf __field__task_id `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SubqueryDeclaration_key where
+  def = SubqueryDeclaration_key "" ""
+
+instance Hashable.Hashable SubqueryDeclaration_key where
+  hashWithSalt __salt (SubqueryDeclaration_key _task_id _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _task_id)
+        _name
+
+data SubqueryColumnDeclaration_key = SubqueryColumnDeclaration_key{subqueryColumnDeclaration_key_task_id
+                                                                   :: Text.Text,
+                                                                   subqueryColumnDeclaration_key_subquery_name
+                                                                   :: Text.Text,
+                                                                   subqueryColumnDeclaration_key_column_name
+                                                                   :: Text.Text}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SubqueryColumnDeclaration_key where
+  toJSON
+    (SubqueryColumnDeclaration_key __field__task_id
+       __field__subquery_name __field__column_name)
+    = Aeson.object
+        ("task_id" .= __field__task_id :
+           "subquery_name" .= __field__subquery_name :
+             "column_name" .= __field__column_name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SubqueryColumnDeclaration_key where
+  buildStruct _proxy
+    (SubqueryColumnDeclaration_key __field__task_id
+       __field__subquery_name __field__column_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "task_id" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__task_id)
+           :
+           Thrift.genField _proxy "subquery_name"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__subquery_name)
+             :
+             Thrift.genField _proxy "column_name" (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__column_name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__task_id <- ST.newSTRef ""
+            __field__subquery_name <- ST.newSTRef ""
+            __field__column_name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__task_id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__subquery_name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__column_name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__task_id <- ST.readSTRef
+                                                                  __field__task_id
+                                             !__val__subquery_name <- ST.readSTRef
+                                                                        __field__subquery_name
+                                             !__val__column_name <- ST.readSTRef
+                                                                      __field__column_name
+                                             Prelude.pure
+                                               (SubqueryColumnDeclaration_key __val__task_id
+                                                  __val__subquery_name
+                                                  __val__column_name)
+              _idMap
+                = HashMap.fromList
+                    [("task_id", 1), ("subquery_name", 2), ("column_name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SubqueryColumnDeclaration_key where
+  rnf
+    (SubqueryColumnDeclaration_key __field__task_id
+       __field__subquery_name __field__column_name)
+    = DeepSeq.rnf __field__task_id `Prelude.seq`
+        DeepSeq.rnf __field__subquery_name `Prelude.seq`
+          DeepSeq.rnf __field__column_name `Prelude.seq` ()
+
+instance Default.Default SubqueryColumnDeclaration_key where
+  def = SubqueryColumnDeclaration_key "" "" ""
+
+instance Hashable.Hashable SubqueryColumnDeclaration_key where
+  hashWithSalt __salt
+    (SubqueryColumnDeclaration_key _task_id _subquery_name
+       _column_name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _task_id)
+           _subquery_name)
+        _column_name
+
+data MacroDeclaration_key = MacroDeclaration_key{macroDeclaration_key_task_id
+                                                 :: Text.Text,
+                                                 macroDeclaration_key_name :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MacroDeclaration_key where
+  toJSON (MacroDeclaration_key __field__task_id __field__name)
+    = Aeson.object
+        ("task_id" .= __field__task_id :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct MacroDeclaration_key where
+  buildStruct _proxy
+    (MacroDeclaration_key __field__task_id __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "task_id" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__task_id)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__task_id <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__task_id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__task_id <- ST.readSTRef
+                                                                  __field__task_id
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (MacroDeclaration_key __val__task_id __val__name)
+              _idMap = HashMap.fromList [("task_id", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MacroDeclaration_key where
+  rnf (MacroDeclaration_key __field__task_id __field__name)
+    = DeepSeq.rnf __field__task_id `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default MacroDeclaration_key where
+  def = MacroDeclaration_key "" ""
+
+instance Hashable.Hashable MacroDeclaration_key where
+  hashWithSalt __salt (MacroDeclaration_key _task_id _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _task_id)
+        _name
+
+data Declaration = Declaration_macro MacroDeclaration
+                 | Declaration_table TableDeclaration
+                 | Declaration_subquery SubqueryDeclaration
+                 | Declaration_table_column TableColumnDeclaration
+                 | Declaration_subquery_column SubqueryColumnDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_macro __macro)
+    = Aeson.object ["macro" .= __macro]
+  toJSON (Declaration_table __table)
+    = Aeson.object ["table" .= __table]
+  toJSON (Declaration_subquery __subquery)
+    = Aeson.object ["subquery" .= __subquery]
+  toJSON (Declaration_table_column __table_column)
+    = Aeson.object ["table_column" .= __table_column]
+  toJSON (Declaration_subquery_column __subquery_column)
+    = Aeson.object ["subquery_column" .= __subquery_column]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_macro __macro)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __macro)]
+  buildStruct _proxy (Declaration_table __table)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "table" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __table)]
+  buildStruct _proxy (Declaration_subquery __subquery)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "subquery" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __subquery)]
+  buildStruct _proxy (Declaration_table_column __table_column)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "table_column"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __table_column)]
+  buildStruct _proxy (Declaration_subquery_column __subquery_column)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "subquery_column"
+           (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __subquery_column)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_macro _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_table _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_subquery _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_table_column _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_subquery_column _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("macro", 1), ("table", 2), ("subquery", 3), ("table_column", 4),
+             ("subquery_column", 5)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_macro __macro) = DeepSeq.rnf __macro
+  rnf (Declaration_table __table) = DeepSeq.rnf __table
+  rnf (Declaration_subquery __subquery) = DeepSeq.rnf __subquery
+  rnf (Declaration_table_column __table_column)
+    = DeepSeq.rnf __table_column
+  rnf (Declaration_subquery_column __subquery_column)
+    = DeepSeq.rnf __subquery_column
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_macro _macro)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _macro)
+  hashWithSalt __salt (Declaration_table _table)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _table)
+  hashWithSalt __salt (Declaration_subquery _subquery)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _subquery)
+  hashWithSalt __salt (Declaration_table_column _table_column)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _table_column)
+  hashWithSalt __salt (Declaration_subquery_column _subquery_column)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _subquery_column)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_declaration
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationName_key = DeclarationName_key{declarationName_key_declaration
+                                               :: Declaration,
+                                               declarationName_key_name :: Text.Text}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName_key where
+  toJSON (DeclarationName_key __field__declaration __field__name)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationName_key where
+  buildStruct _proxy
+    (DeclarationName_key __field__declaration __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (DeclarationName_key __val__declaration __val__name)
+              _idMap = HashMap.fromList [("declaration", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName_key where
+  rnf (DeclarationName_key __field__declaration __field__name)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default DeclarationName_key where
+  def = DeclarationName_key Default.def ""
+
+instance Hashable.Hashable DeclarationName_key where
+  hashWithSalt __salt (DeclarationName_key _declaration _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _name
+
+data XRef = XRef{xRef_target :: Declaration,
+                 xRef_source :: Glean.Schema.Src.ByteSpan}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (XRef __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data XRefsByFile_key = XRefsByFile_key{xRefsByFile_key_file ::
+                                       Glean.Schema.Src.File,
+                                       xRefsByFile_key_xrefs :: [XRef]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsByFile_key where
+  toJSON (XRefsByFile_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsByFile_key where
+  buildStruct _proxy (XRefsByFile_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (XRefsByFile_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsByFile_key where
+  rnf (XRefsByFile_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default XRefsByFile_key where
+  def = XRefsByFile_key Default.def Default.def
+
+instance Hashable.Hashable XRefsByFile_key where
+  hashWithSalt __salt (XRefsByFile_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+{-# LINE 18 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.SubqueryDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.SubqueryDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.SubqueryDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.SubqueryDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.SubqueryDeclaration_key
+     =
+     'Angle.TField "task_id" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.SubqueryDeclaration
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.SubqueryDeclaration =
+       Glean.Schema.Dataswarm.Types.SubqueryDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "dataswarm.SubqueryDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.subqueryDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.SubqueryDeclaration x k
+  getFactKey = Glean.Schema.Dataswarm.Types.subqueryDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.SubqueryDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.MacroDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.MacroDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.MacroDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.MacroDeclaration_key" (Prelude.Just 0))
+{-# LINE 53 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.MacroDeclaration_key
+     =
+     'Angle.TField "task_id" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 55 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.MacroDeclaration
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.MacroDeclaration =
+       Glean.Schema.Dataswarm.Types.MacroDeclaration_key
+  getName _proxy = Glean.PredicateRef "dataswarm.MacroDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.macroDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.MacroDeclaration x k
+  getFactKey = Glean.Schema.Dataswarm.Types.macroDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 64 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.MacroDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 70 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.TableDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.TableDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.TableDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.TableDeclaration_key" (Prelude.Just 0))
+{-# LINE 79 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.TableDeclaration_key
+     =
+     'Angle.TField "table_name" (Data.Text.Text)
+       ('Angle.TField "table_namespace" (Data.Text.Text)
+          ('Angle.TNoFields))
+{-# LINE 81 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.TableDeclaration
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.TableDeclaration =
+       Glean.Schema.Dataswarm.Types.TableDeclaration_key
+  getName _proxy = Glean.PredicateRef "dataswarm.TableDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.tableDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.TableDeclaration x k
+  getFactKey = Glean.Schema.Dataswarm.Types.tableDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 90 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.TableDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 96 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.SubqueryColumnDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 107 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration_key
+     =
+     'Angle.TField "task_id" (Data.Text.Text)
+       ('Angle.TField "subquery_name" (Data.Text.Text)
+          ('Angle.TField "column_name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 109 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration
+       = Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "dataswarm.SubqueryColumnDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Dataswarm.Types.subqueryColumnDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration x k
+  getFactKey
+    = Glean.Schema.Dataswarm.Types.subqueryColumnDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 118 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 124 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.DeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.DeclarationName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.DeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.DeclarationName_key" (Prelude.Just 0))
+{-# LINE 133 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Dataswarm.Types.DeclarationName_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.Dataswarm.Types.Declaration)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 135 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.DeclarationName
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.DeclarationName =
+       Glean.Schema.Dataswarm.Types.DeclarationName_key
+  getName _proxy = Glean.PredicateRef "dataswarm.DeclarationName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.declarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.DeclarationName x k
+  getFactKey = Glean.Schema.Dataswarm.Types.declarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 144 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.DeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 150 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.TableColumnDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.TableColumnDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.TableColumnDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.TableColumnDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 161 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.TableColumnDeclaration_key
+     =
+     'Angle.TField "table_name" (Data.Text.Text)
+       ('Angle.TField "table_namespace" (Data.Text.Text)
+          ('Angle.TField "column_name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 163 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.TableColumnDeclaration
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.TableColumnDeclaration =
+       Glean.Schema.Dataswarm.Types.TableColumnDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "dataswarm.TableColumnDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.tableColumnDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.TableColumnDeclaration x k
+  getFactKey
+    = Glean.Schema.Dataswarm.Types.tableColumnDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 172 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.TableColumnDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 178 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.DeclarationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 189 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Dataswarm.Types.DeclarationLocation_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.Dataswarm.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 191 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Dataswarm.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.DeclarationLocation =
+       Glean.Schema.Dataswarm.Types.DeclarationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "dataswarm.DeclarationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Dataswarm.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 200 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Dataswarm.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 206 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.XRefsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.XRefsByFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.XRefsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.XRefsByFile_key" (Prelude.Just 0))
+{-# LINE 215 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Dataswarm.Types.XRefsByFile_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Dataswarm.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 217 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Dataswarm.Types.XRefsByFile
+         where
+  type KeyType Glean.Schema.Dataswarm.Types.XRefsByFile =
+       Glean.Schema.Dataswarm.Types.XRefsByFile_key
+  getName _proxy = Glean.PredicateRef "dataswarm.XRefsByFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Dataswarm.Types.xRefsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Dataswarm.Types.XRefsByFile x k
+  getFactKey = Glean.Schema.Dataswarm.Types.xRefsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 226 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.XRefsByFile where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 232 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.Declaration where
+  buildRtsValue b Glean.Schema.Dataswarm.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Dataswarm.Types.Declaration_macro x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Dataswarm.Types.Declaration_table x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.Declaration_subquery x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.Declaration_table_column x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Dataswarm.Types.Declaration_subquery_column x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Dataswarm.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Dataswarm.Types.Declaration_macro,
+         Glean.mapD Glean.Schema.Dataswarm.Types.Declaration_table,
+         Glean.mapD Glean.Schema.Dataswarm.Types.Declaration_subquery,
+         Glean.mapD Glean.Schema.Dataswarm.Types.Declaration_table_column,
+         Glean.mapD
+           Glean.Schema.Dataswarm.Types.Declaration_subquery_column]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.Declaration" (Prelude.Just 1))
+{-# LINE 260 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Dataswarm.Types.Declaration =
+     'Angle.TField "macro"
+       (Glean.KeyType Glean.Schema.Dataswarm.Types.MacroDeclaration)
+       ('Angle.TField "table"
+          (Glean.KeyType Glean.Schema.Dataswarm.Types.TableDeclaration)
+          ('Angle.TField "subquery"
+             (Glean.KeyType Glean.Schema.Dataswarm.Types.SubqueryDeclaration)
+             ('Angle.TField "table_column"
+                (Glean.KeyType Glean.Schema.Dataswarm.Types.TableColumnDeclaration)
+                ('Angle.TField "subquery_column"
+                   (Glean.KeyType
+                      Glean.Schema.Dataswarm.Types.SubqueryColumnDeclaration)
+                   ('Angle.TNoFields)))))
+{-# LINE 262 "glean/schema/thrift/dataswarm_include.hs" #-}
+instance Glean.Type Glean.Schema.Dataswarm.Types.XRef where
+  buildRtsValue b (Glean.Schema.Dataswarm.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Dataswarm.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "dataswarm.XRef" (Prelude.Just 1))
+{-# LINE 271 "glean/schema/thrift/dataswarm_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Dataswarm.Types.XRef
+     =
+     'Angle.TField "target" (Glean.Schema.Dataswarm.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Digest/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Digest/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Digest/Types.hs
@@ -0,0 +1,348 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/digest_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/digest_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/digest_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Digest/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Digest.Types
+       (pREDICATE_VERSIONS, FileDigest_id,
+        FileDigest(FileDigest, fileDigest_id, fileDigest_key),
+        Digest(Digest, digest_hash, digest_size),
+        FileDigest_key(FileDigest_key, fileDigest_key_file,
+                       fileDigest_key_digest))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/digest_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 76 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Digest/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("FileDigest", 1)]
+
+type FileDigest_id = Glean.Id
+
+data FileDigest = FileDigest{fileDigest_id ::
+                             {-# UNPACK #-} !FileDigest_id,
+                             fileDigest_key :: Prelude.Maybe FileDigest_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDigest where
+  toJSON (FileDigest __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDigest where
+  buildStruct _proxy (FileDigest __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDigest __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDigest where
+  rnf (FileDigest __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDigest where
+  def = FileDigest Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDigest where
+  hashWithSalt __salt (FileDigest _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Digest = Digest{digest_hash :: Text.Text,
+                     digest_size :: Glean.Nat}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Digest where
+  toJSON (Digest __field__hash __field__size)
+    = Aeson.object
+        ("hash" .= __field__hash :
+           "size" .= Glean.unNat __field__size : Prelude.mempty)
+
+instance Thrift.ThriftStruct Digest where
+  buildStruct _proxy (Digest __field__hash __field__size)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "hash" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__hash)
+           :
+           Thrift.genField _proxy "size" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__size)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__hash <- ST.newSTRef ""
+            __field__size <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hash
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__size
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__hash <- ST.readSTRef __field__hash
+                                             !__val__size <- ST.readSTRef __field__size
+                                             Prelude.pure (Digest __val__hash __val__size)
+              _idMap = HashMap.fromList [("hash", 1), ("size", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Digest where
+  rnf (Digest __field__hash __field__size)
+    = DeepSeq.rnf __field__hash `Prelude.seq`
+        DeepSeq.rnf __field__size `Prelude.seq` ()
+
+instance Default.Default Digest where
+  def = Digest "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable Digest where
+  hashWithSalt __salt (Digest _hash _size)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _hash) _size
+
+data FileDigest_key = FileDigest_key{fileDigest_key_file ::
+                                     Glean.Schema.Src.File,
+                                     fileDigest_key_digest :: Digest}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDigest_key where
+  toJSON (FileDigest_key __field__file __field__digest)
+    = Aeson.object
+        ("file" .= __field__file :
+           "digest" .= __field__digest : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDigest_key where
+  buildStruct _proxy (FileDigest_key __field__file __field__digest)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "digest" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__digest)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__digest <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__digest
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__digest <- ST.readSTRef __field__digest
+                                             Prelude.pure (FileDigest_key __val__file __val__digest)
+              _idMap = HashMap.fromList [("file", 1), ("digest", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDigest_key where
+  rnf (FileDigest_key __field__file __field__digest)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__digest `Prelude.seq` ()
+
+instance Default.Default FileDigest_key where
+  def = FileDigest_key Default.def Default.def
+
+instance Hashable.Hashable FileDigest_key where
+  hashWithSalt __salt (FileDigest_key _file _digest)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _digest
+{-# LINE 18 "glean/schema/thrift/digest_include.hs" #-}
+instance Glean.Type Glean.Schema.Digest.Types.FileDigest_key where
+  buildRtsValue b (Glean.Schema.Digest.Types.FileDigest_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Digest.Types.FileDigest_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "digest.FileDigest_key" (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/digest_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Digest.Types.FileDigest_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "digest" (Glean.Schema.Digest.Types.Digest)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/digest_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Digest.Types.FileDigest where
+  type KeyType Glean.Schema.Digest.Types.FileDigest =
+       Glean.Schema.Digest.Types.FileDigest_key
+  getName _proxy = Glean.PredicateRef "digest.FileDigest" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Digest.Types.fileDigest_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Digest.Types.FileDigest x k
+  getFactKey = Glean.Schema.Digest.Types.fileDigest_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/digest_include.hs" #-}
+instance Glean.Type Glean.Schema.Digest.Types.FileDigest where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/digest_include.hs" #-}
+instance Glean.Type Glean.Schema.Digest.Types.Digest where
+  buildRtsValue b (Glean.Schema.Digest.Types.Digest x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Digest.Types.Digest <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "digest.Digest" (Prelude.Just 1))
+{-# LINE 53 "glean/schema/thrift/digest_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Digest.Types.Digest =
+     'Angle.TField "hash" (Data.Text.Text)
+       ('Angle.TField "size" (Glean.Nat) ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Erlang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Erlang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Erlang/Types.hs
@@ -0,0 +1,2689 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/erlang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/erlang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/erlang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Erlang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Erlang.Types
+       (pREDICATE_VERSIONS, NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        FunctionDeclaration_id,
+        FunctionDeclaration(FunctionDeclaration, functionDeclaration_id,
+                            functionDeclaration_key),
+        XRefsViaFqnByFile_id,
+        XRefsViaFqnByFile(XRefsViaFqnByFile, xRefsViaFqnByFile_id,
+                          xRefsViaFqnByFile_key),
+        DeclarationComment_id,
+        DeclarationComment(DeclarationComment, declarationComment_id,
+                           declarationComment_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationReference_id,
+        DeclarationReference(DeclarationReference, declarationReference_id,
+                             declarationReference_key),
+        DeclarationToFqn_id,
+        DeclarationToFqn(DeclarationToFqn, declarationToFqn_id,
+                         declarationToFqn_key, declarationToFqn_value),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        DeclarationWithFqn_id,
+        DeclarationWithFqn(DeclarationWithFqn, declarationWithFqn_id,
+                           declarationWithFqn_key),
+        DeclarationsByFile_id,
+        DeclarationsByFile(DeclarationsByFile, declarationsByFile_id,
+                           declarationsByFile_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowercase, nameLowerCase_key_name),
+        Fqn(Fqn, fqn_module, fqn_name, fqn_arity),
+        FunctionDeclaration_key(FunctionDeclaration_key,
+                                functionDeclaration_key_fqn, functionDeclaration_key_file,
+                                functionDeclaration_key_span),
+        XRefViaFqn(XRefViaFqn, xRefViaFqn_target, xRefViaFqn_source),
+        XRefsViaFqnByFile_key(XRefsViaFqnByFile_key,
+                              xRefsViaFqnByFile_key_file, xRefsViaFqnByFile_key_xrefs),
+        DeclarationComment_key(DeclarationComment_key,
+                               declarationComment_key_declaration, declarationComment_key_file,
+                               declarationComment_key_span, declarationComment_key_text),
+        Declaration(Declaration_EMPTY, Declaration_func),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_declaration, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationReference_key(DeclarationReference_key,
+                                 declarationReference_key_target, declarationReference_key_source),
+        DeclarationToFqn_value,
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_declaration, declarationUses_key_file,
+                            declarationUses_key_span),
+        DeclarationWithFqn_key(DeclarationWithFqn_key,
+                               declarationWithFqn_key_fqn, declarationWithFqn_key_declaration),
+        DeclarationsByFile_key(DeclarationsByFile_key,
+                               declarationsByFile_key_file, declarationsByFile_key_span,
+                               declarationsByFile_key_declaration),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_func))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/erlang_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 134 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Erlang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("DeclarationComment", 1), ("NameLowerCase", 1),
+       ("DeclarationsByFile", 1), ("DeclarationReference", 1),
+       ("DeclarationLocation", 1), ("DeclarationWithFqn", 1),
+       ("FunctionDeclaration", 1), ("XRefsViaFqnByFile", 1),
+       ("DeclarationToFqn", 1), ("DeclarationUses", 1),
+       ("SearchByName", 1)]
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclaration_id = Glean.Id
+
+data FunctionDeclaration = FunctionDeclaration{functionDeclaration_id
+                                               :: {-# UNPACK #-} !FunctionDeclaration_id,
+                                               functionDeclaration_key ::
+                                               Prelude.Maybe FunctionDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration where
+  toJSON (FunctionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration where
+  buildStruct _proxy (FunctionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration where
+  rnf (FunctionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration where
+  def = FunctionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclaration where
+  hashWithSalt __salt (FunctionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefsViaFqnByFile_id = Glean.Id
+
+data XRefsViaFqnByFile = XRefsViaFqnByFile{xRefsViaFqnByFile_id ::
+                                           {-# UNPACK #-} !XRefsViaFqnByFile_id,
+                                           xRefsViaFqnByFile_key ::
+                                           Prelude.Maybe XRefsViaFqnByFile_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaFqnByFile where
+  toJSON (XRefsViaFqnByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaFqnByFile where
+  buildStruct _proxy (XRefsViaFqnByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefsViaFqnByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaFqnByFile where
+  rnf (XRefsViaFqnByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefsViaFqnByFile where
+  def = XRefsViaFqnByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefsViaFqnByFile where
+  hashWithSalt __salt (XRefsViaFqnByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationComment_id = Glean.Id
+
+data DeclarationComment = DeclarationComment{declarationComment_id
+                                             :: {-# UNPACK #-} !DeclarationComment_id,
+                                             declarationComment_key ::
+                                             Prelude.Maybe DeclarationComment_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment where
+  toJSON (DeclarationComment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment where
+  buildStruct _proxy (DeclarationComment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationComment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment where
+  rnf (DeclarationComment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationComment where
+  def = DeclarationComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment where
+  hashWithSalt __salt (DeclarationComment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationReference_id = Glean.Id
+
+data DeclarationReference = DeclarationReference{declarationReference_id
+                                                 :: {-# UNPACK #-} !DeclarationReference_id,
+                                                 declarationReference_key ::
+                                                 Prelude.Maybe DeclarationReference_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationReference where
+  toJSON (DeclarationReference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationReference where
+  buildStruct _proxy (DeclarationReference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationReference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationReference where
+  rnf (DeclarationReference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationReference where
+  def = DeclarationReference Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationReference where
+  hashWithSalt __salt (DeclarationReference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationToFqn_id = Glean.Id
+
+data DeclarationToFqn = DeclarationToFqn{declarationToFqn_id ::
+                                         {-# UNPACK #-} !DeclarationToFqn_id,
+                                         declarationToFqn_key :: Prelude.Maybe Declaration,
+                                         declarationToFqn_value ::
+                                         Prelude.Maybe DeclarationToFqn_value}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationToFqn where
+  toJSON (DeclarationToFqn __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationToFqn where
+  buildStruct _proxy
+    (DeclarationToFqn __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DeclarationToFqn __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationToFqn where
+  rnf (DeclarationToFqn __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DeclarationToFqn where
+  def = DeclarationToFqn Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DeclarationToFqn where
+  hashWithSalt __salt (DeclarationToFqn _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationWithFqn_id = Glean.Id
+
+data DeclarationWithFqn = DeclarationWithFqn{declarationWithFqn_id
+                                             :: {-# UNPACK #-} !DeclarationWithFqn_id,
+                                             declarationWithFqn_key ::
+                                             Prelude.Maybe DeclarationWithFqn_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithFqn where
+  toJSON (DeclarationWithFqn __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithFqn where
+  buildStruct _proxy (DeclarationWithFqn __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationWithFqn __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithFqn where
+  rnf (DeclarationWithFqn __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationWithFqn where
+  def = DeclarationWithFqn Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationWithFqn where
+  hashWithSalt __salt (DeclarationWithFqn _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationsByFile_id = Glean.Id
+
+data DeclarationsByFile = DeclarationsByFile{declarationsByFile_id
+                                             :: {-# UNPACK #-} !DeclarationsByFile_id,
+                                             declarationsByFile_key ::
+                                             Prelude.Maybe DeclarationsByFile_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationsByFile where
+  toJSON (DeclarationsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationsByFile where
+  buildStruct _proxy (DeclarationsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationsByFile where
+  rnf (DeclarationsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationsByFile where
+  def = DeclarationsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationsByFile where
+  hashWithSalt __salt (DeclarationsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowercase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowercase __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowercase __val__name)
+              _idMap = HashMap.fromList [("nameLowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowercase __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" ""
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowercase)
+        _name
+
+data Fqn = Fqn{fqn_module :: Text.Text, fqn_name :: Text.Text,
+               fqn_arity :: Glean.Nat}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Fqn where
+  toJSON (Fqn __field__module __field__name __field__arity)
+    = Aeson.object
+        ("module" .= __field__module :
+           "name" .= __field__name :
+             "arity" .= Glean.unNat __field__arity : Prelude.mempty)
+
+instance Thrift.ThriftStruct Fqn where
+  buildStruct _proxy
+    (Fqn __field__module __field__name __field__arity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__module)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "arity" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__arity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            __field__arity <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__arity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__arity <- ST.readSTRef __field__arity
+                                             Prelude.pure
+                                               (Fqn __val__module __val__name __val__arity)
+              _idMap
+                = HashMap.fromList [("module", 1), ("name", 2), ("arity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Fqn where
+  rnf (Fqn __field__module __field__name __field__arity)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__arity `Prelude.seq` ()
+
+instance Default.Default Fqn where
+  def = Fqn "" "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable Fqn where
+  hashWithSalt __salt (Fqn _module _name _arity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+           _name)
+        _arity
+
+data FunctionDeclaration_key = FunctionDeclaration_key{functionDeclaration_key_fqn
+                                                       :: Fqn,
+                                                       functionDeclaration_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       functionDeclaration_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration_key where
+  toJSON
+    (FunctionDeclaration_key __field__fqn __field__file __field__span)
+    = Aeson.object
+        ("fqn" .= __field__fqn :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration_key where
+  buildStruct _proxy
+    (FunctionDeclaration_key __field__fqn __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fqn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fqn)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fqn <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fqn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fqn <- ST.readSTRef __field__fqn
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FunctionDeclaration_key __val__fqn __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("fqn", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration_key where
+  rnf
+    (FunctionDeclaration_key __field__fqn __field__file __field__span)
+    = DeepSeq.rnf __field__fqn `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration_key where
+  def = FunctionDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FunctionDeclaration_key where
+  hashWithSalt __salt (FunctionDeclaration_key _fqn _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fqn) _file)
+        _span
+
+data XRefViaFqn = XRefViaFqn{xRefViaFqn_target :: Fqn,
+                             xRefViaFqn_source :: Glean.Schema.Src.ByteSpan}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefViaFqn where
+  toJSON (XRefViaFqn __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefViaFqn where
+  buildStruct _proxy (XRefViaFqn __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (XRefViaFqn __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefViaFqn where
+  rnf (XRefViaFqn __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default XRefViaFqn where
+  def = XRefViaFqn Default.def Default.def
+
+instance Hashable.Hashable XRefViaFqn where
+  hashWithSalt __salt (XRefViaFqn _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data XRefsViaFqnByFile_key = XRefsViaFqnByFile_key{xRefsViaFqnByFile_key_file
+                                                   :: Glean.Schema.Src.File,
+                                                   xRefsViaFqnByFile_key_xrefs :: [XRefViaFqn]}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaFqnByFile_key where
+  toJSON (XRefsViaFqnByFile_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaFqnByFile_key where
+  buildStruct _proxy
+    (XRefsViaFqnByFile_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure
+                                               (XRefsViaFqnByFile_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaFqnByFile_key where
+  rnf (XRefsViaFqnByFile_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default XRefsViaFqnByFile_key where
+  def = XRefsViaFqnByFile_key Default.def Default.def
+
+instance Hashable.Hashable XRefsViaFqnByFile_key where
+  hashWithSalt __salt (XRefsViaFqnByFile_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data DeclarationComment_key = DeclarationComment_key{declarationComment_key_declaration
+                                                     :: FunctionDeclaration,
+                                                     declarationComment_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     declarationComment_key_span ::
+                                                     Glean.Schema.Src.ByteSpan,
+                                                     declarationComment_key_text ::
+                                                     Prelude.Maybe Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment_key where
+  toJSON
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span __field__text)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file :
+             "span" .= __field__span :
+               Prelude.maybe Prelude.id ((:) . ("text" .=)) __field__text
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment_key where
+  buildStruct _proxy
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span __field__text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               case __field__text of
+                 Prelude.Just _val -> Thrift.genField _proxy "text"
+                                        (Thrift.getStringType _proxy)
+                                        4
+                                        3
+                                        (Thrift.genText _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__text <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__text <- ST.readSTRef __field__text
+                                             Prelude.pure
+                                               (DeclarationComment_key __val__declaration
+                                                  __val__file
+                                                  __val__span
+                                                  __val__text)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("file", 2), ("span", 3), ("text", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment_key where
+  rnf
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span __field__text)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__text `Prelude.seq` ()
+
+instance Default.Default DeclarationComment_key where
+  def
+    = DeclarationComment_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment_key where
+  hashWithSalt __salt
+    (DeclarationComment_key _declaration _file _span _text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+              _file)
+           _span)
+        _text
+
+data Declaration = Declaration_func FunctionDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_func __func) = Aeson.object ["func" .= __func]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_func __func)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "func" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __func)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_func _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap = HashMap.fromList [("func", 1)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_func __func) = DeepSeq.rnf __func
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_func _func)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _func)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_declaration
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationReference_key = DeclarationReference_key{declarationReference_key_target
+                                                         :: Declaration,
+                                                         declarationReference_key_source ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationReference_key where
+  toJSON (DeclarationReference_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationReference_key where
+  buildStruct _proxy
+    (DeclarationReference_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (DeclarationReference_key __val__target
+                                                  __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationReference_key where
+  rnf (DeclarationReference_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default DeclarationReference_key where
+  def = DeclarationReference_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationReference_key where
+  hashWithSalt __salt (DeclarationReference_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+type DeclarationToFqn_value = Fqn
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_declaration
+                                               :: Declaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_span ::
+                                               Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__declaration __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationWithFqn_key = DeclarationWithFqn_key{declarationWithFqn_key_fqn
+                                                     :: Fqn,
+                                                     declarationWithFqn_key_declaration ::
+                                                     Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithFqn_key where
+  toJSON (DeclarationWithFqn_key __field__fqn __field__declaration)
+    = Aeson.object
+        ("fqn" .= __field__fqn :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithFqn_key where
+  buildStruct _proxy
+    (DeclarationWithFqn_key __field__fqn __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fqn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fqn)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fqn <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fqn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fqn <- ST.readSTRef __field__fqn
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationWithFqn_key __val__fqn
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("fqn", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithFqn_key where
+  rnf (DeclarationWithFqn_key __field__fqn __field__declaration)
+    = DeepSeq.rnf __field__fqn `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationWithFqn_key where
+  def = DeclarationWithFqn_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationWithFqn_key where
+  hashWithSalt __salt (DeclarationWithFqn_key _fqn _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fqn)
+        _declaration
+
+data DeclarationsByFile_key = DeclarationsByFile_key{declarationsByFile_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     declarationsByFile_key_span ::
+                                                     Glean.Schema.Src.ByteSpan,
+                                                     declarationsByFile_key_declaration ::
+                                                     Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationsByFile_key where
+  toJSON
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationsByFile_key where
+  buildStruct _proxy
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__declaration)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationsByFile_key __val__file __val__span
+                                                  __val__declaration)
+              _idMap
+                = HashMap.fromList [("file", 1), ("span", 2), ("declaration", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationsByFile_key where
+  rnf
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationsByFile_key where
+  def = DeclarationsByFile_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationsByFile_key where
+  hashWithSalt __salt
+    (DeclarationsByFile_key _file _span _declaration)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _declaration
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Text.Text,
+                                         searchByName_key_func :: Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__func)
+    = Aeson.object
+        ("name" .= __field__name :
+           "func" .= __field__func : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__func)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "func" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__func)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__func <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__func
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__func <- ST.readSTRef __field__func
+                                             Prelude.pure (SearchByName_key __val__name __val__func)
+              _idMap = HashMap.fromList [("name", 1), ("func", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__func)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__func `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key "" Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _func)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _func
+{-# LINE 18 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.DeclarationComment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationComment_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationComment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationComment_key" (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.DeclarationComment_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Erlang.Types.FunctionDeclaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "text" (Prelude.Maybe Data.Text.Text)
+                ('Angle.TNoFields))))
+{-# LINE 33 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.DeclarationComment
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationComment =
+       Glean.Schema.Erlang.Types.DeclarationComment_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationComment" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationComment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationComment x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationComment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 42 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationComment
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 48 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.NameLowerCase_key
+         where
+  buildRtsValue b (Glean.Schema.Erlang.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.NameLowerCase_key =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 59 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Erlang.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Erlang.Types.NameLowerCase =
+       Glean.Schema.Erlang.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "erlang.NameLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Erlang.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 74 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.DeclarationsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationsByFile_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationsByFile_key" (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.DeclarationsByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "declaration"
+             (Glean.Schema.Erlang.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 87 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.DeclarationsByFile
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationsByFile =
+       Glean.Schema.Erlang.Types.DeclarationsByFile_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationsByFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationsByFile x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationsByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.DeclarationReference_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationReference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationReference_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationReference_key"
+           (Prelude.Just 0))
+{-# LINE 111 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Erlang.Types.DeclarationReference_key
+     =
+     'Angle.TField "target" (Glean.Schema.Erlang.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Erlang.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 113 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.DeclarationReference
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationReference =
+       Glean.Schema.Erlang.Types.DeclarationReference_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationReference" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationReference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationReference x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationReference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 122 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationReference
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 128 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationLocation_key" (Prelude.Just 0))
+{-# LINE 139 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Erlang.Types.DeclarationLocation_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Erlang.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 141 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationLocation =
+       Glean.Schema.Erlang.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 150 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 156 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.DeclarationWithFqn_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationWithFqn_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationWithFqn_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationWithFqn_key" (Prelude.Just 0))
+{-# LINE 165 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.DeclarationWithFqn_key
+     =
+     'Angle.TField "fqn" (Glean.Schema.Erlang.Types.Fqn)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Erlang.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 167 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.DeclarationWithFqn
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationWithFqn =
+       Glean.Schema.Erlang.Types.DeclarationWithFqn_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationWithFqn" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationWithFqn_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationWithFqn x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationWithFqn_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 176 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationWithFqn
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 182 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Erlang.Types.FunctionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.FunctionDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.FunctionDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.FunctionDeclaration_key" (Prelude.Just 0))
+{-# LINE 193 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Erlang.Types.FunctionDeclaration_key
+     =
+     'Angle.TField "fqn" (Glean.Schema.Erlang.Types.Fqn)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 195 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.FunctionDeclaration
+         where
+  type KeyType Glean.Schema.Erlang.Types.FunctionDeclaration =
+       Glean.Schema.Erlang.Types.FunctionDeclaration_key
+  getName _proxy = Glean.PredicateRef "erlang.FunctionDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.functionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.FunctionDeclaration x k
+  getFactKey = Glean.Schema.Erlang.Types.functionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 204 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.FunctionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 210 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.XRefsViaFqnByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.XRefsViaFqnByFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.XRefsViaFqnByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.XRefsViaFqnByFile_key" (Prelude.Just 0))
+{-# LINE 219 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.XRefsViaFqnByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Erlang.Types.XRefViaFqn])
+          ('Angle.TNoFields))
+{-# LINE 221 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Erlang.Types.XRefsViaFqnByFile
+         where
+  type KeyType Glean.Schema.Erlang.Types.XRefsViaFqnByFile =
+       Glean.Schema.Erlang.Types.XRefsViaFqnByFile_key
+  getName _proxy = Glean.PredicateRef "erlang.XRefsViaFqnByFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.xRefsViaFqnByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.XRefsViaFqnByFile x k
+  getFactKey = Glean.Schema.Erlang.Types.xRefsViaFqnByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 230 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.XRefsViaFqnByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 236 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Erlang.Types.DeclarationToFqn
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationToFqn =
+       Glean.Schema.Erlang.Types.Declaration
+  type ValueType Glean.Schema.Erlang.Types.DeclarationToFqn =
+       Glean.Schema.Erlang.Types.DeclarationToFqn_value
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationToFqn" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationToFqn_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Erlang.Types.DeclarationToFqn x k v
+  getFactKey = Glean.Schema.Erlang.Types.declarationToFqn_key
+  getFactValue = Glean.Schema.Erlang.Types.declarationToFqn_value
+{-# LINE 247 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationToFqn
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 253 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Erlang.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 264 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.DeclarationUses_key =
+     'Angle.TField "declaration" (Glean.Schema.Erlang.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 266 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Erlang.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.Erlang.Types.DeclarationUses =
+       Glean.Schema.Erlang.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "erlang.DeclarationUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.Erlang.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 275 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.DeclarationUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 281 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.SearchByName_key
+         where
+  buildRtsValue b (Glean.Schema.Erlang.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.SearchByName_key" (Prelude.Just 0))
+{-# LINE 290 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.SearchByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "func" (Glean.Schema.Erlang.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 292 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Erlang.Types.SearchByName
+         where
+  type KeyType Glean.Schema.Erlang.Types.SearchByName =
+       Glean.Schema.Erlang.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "erlang.SearchByName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Erlang.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Erlang.Types.SearchByName x k
+  getFactKey = Glean.Schema.Erlang.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 301 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 307 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.Declaration where
+  buildRtsValue b Glean.Schema.Erlang.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.Erlang.Types.Declaration_func x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Erlang.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Erlang.Types.Declaration_func]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.Declaration" (Prelude.Just 1))
+{-# LINE 319 "glean/schema/thrift/erlang_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Erlang.Types.Declaration
+     =
+     'Angle.TField "func"
+       (Glean.KeyType Glean.Schema.Erlang.Types.FunctionDeclaration)
+       ('Angle.TNoFields)
+{-# LINE 321 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.XRefViaFqn where
+  buildRtsValue b (Glean.Schema.Erlang.Types.XRefViaFqn x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.XRefViaFqn <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "erlang.XRefViaFqn" (Prelude.Just 1))
+{-# LINE 330 "glean/schema/thrift/erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Erlang.Types.XRefViaFqn =
+     'Angle.TField "target" (Glean.Schema.Erlang.Types.Fqn)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 332 "glean/schema/thrift/erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.Erlang.Types.Fqn where
+  buildRtsValue b (Glean.Schema.Erlang.Types.Fqn x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Erlang.Types.Fqn <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "erlang.Fqn" (Prelude.Just 1))
+{-# LINE 343 "glean/schema/thrift/erlang_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Erlang.Types.Fqn =
+     'Angle.TField "module" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "arity" (Glean.Nat) ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Fbthrift/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Fbthrift/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Fbthrift/Types.hs
@@ -0,0 +1,12992 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/fbthrift_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/fbthrift_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/fbthrift_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Fbthrift/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Fbthrift.Types
+       (pREDICATE_VERSIONS, UnionVal_id,
+        UnionVal(UnionVal, unionVal_id, unionVal_key), TypeDefType_id,
+        TypeDefType(TypeDefType, typeDefType_id, typeDefType_key),
+        StructuredAnnotation_id,
+        StructuredAnnotation(StructuredAnnotation, structuredAnnotation_id,
+                             structuredAnnotation_key),
+        StructVal_id, StructVal(StructVal, structVal_id, structVal_key),
+        ServiceParent_id,
+        ServiceParent(ServiceParent, serviceParent_id, serviceParent_key),
+        ServiceName_id,
+        ServiceName(ServiceName, serviceName_id, serviceName_key),
+        ServiceInteractionFunctions_id,
+        ServiceInteractionFunctions(ServiceInteractionFunctions,
+                                    serviceInteractionFunctions_id,
+                                    serviceInteractionFunctions_key),
+        ServiceDefinition_id,
+        ServiceDefinition(ServiceDefinition, serviceDefinition_id,
+                          serviceDefinition_key),
+        ServiceChild_id,
+        ServiceChild(ServiceChild, serviceChild_id, serviceChild_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        QualName_id, QualName(QualName, qualName_id, qualName_key),
+        PackageName_id,
+        PackageName(PackageName, packageName_id, packageName_key),
+        Package_id, Package(Package, package_id, package_key),
+        NamespaceValue_id,
+        NamespaceValue(NamespaceValue, namespaceValue_id,
+                       namespaceValue_key),
+        NamespaceName_id,
+        NamespaceName(NamespaceName, namespaceName_id, namespaceName_key),
+        Namespace_id, Namespace(Namespace, namespace_id, namespace_key),
+        NamedDecl_id, NamedDecl(NamedDecl, namedDecl_id, namedDecl_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        InteractionName_id,
+        InteractionName(InteractionName, interactionName_id,
+                        interactionName_key),
+        InteractionDefinition_id,
+        InteractionDefinition(InteractionDefinition,
+                              interactionDefinition_id, interactionDefinition_key),
+        Identifier_id,
+        Identifier(Identifier, identifier_id, identifier_key),
+        FunctionName_id,
+        FunctionName(FunctionName, functionName_id, functionName_key),
+        Literal_id, Literal(Literal, literal_id, literal_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        File_id, File(File, file_id, file_key), StructType_id,
+        StructType(StructType, structType_id, structType_key),
+        UnionType_id, UnionType(UnionType, unionType_id, unionType_key),
+        FieldDecl_id, FieldDecl(FieldDecl, fieldDecl_id, fieldDecl_key),
+        ExceptionVal_id,
+        ExceptionVal(ExceptionVal, exceptionVal_id, exceptionVal_key),
+        ExceptionType_id,
+        ExceptionType(ExceptionType, exceptionType_id, exceptionType_key),
+        FunctionSpecification_id,
+        FunctionSpecification(FunctionSpecification,
+                              functionSpecification_id, functionSpecification_key),
+        TypeDefException_id,
+        TypeDefException(TypeDefException, typeDefException_id,
+                         typeDefException_key),
+        ExceptionName_id,
+        ExceptionName(ExceptionName, exceptionName_id, exceptionName_key),
+        EnumerationType_id,
+        EnumerationType(EnumerationType, enumerationType_id,
+                        enumerationType_key),
+        EnumValueDef_id,
+        EnumValueDef(EnumValueDef, enumValueDef_id, enumValueDef_key),
+        EnumValue_id, EnumValue(EnumValue, enumValue_id, enumValue_key),
+        EnumVal_id, EnumVal(EnumVal, enumVal_id, enumVal_key),
+        DeclarationComment_id,
+        DeclarationComment(DeclarationComment, declarationComment_id,
+                           declarationComment_key),
+        DeclarationFile_id,
+        DeclarationFile(DeclarationFile, declarationFile_id,
+                        declarationFile_key),
+        DeclarationMember_id,
+        DeclarationMember(DeclarationMember, declarationMember_id,
+                          declarationMember_key),
+        DeclarationName_id,
+        DeclarationName(DeclarationName, declarationName_id,
+                        declarationName_key),
+        DeclarationNameSpan_id,
+        DeclarationNameSpan(DeclarationNameSpan, declarationNameSpan_id,
+                            declarationNameSpan_key),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        FileDeclaration_id,
+        FileDeclaration(FileDeclaration, fileDeclaration_id,
+                        fileDeclaration_key),
+        FunctionDeclarationName_id,
+        FunctionDeclarationName(FunctionDeclarationName,
+                                functionDeclarationName_id, functionDeclarationName_key),
+        TypeSpecification_id,
+        TypeSpecification(TypeSpecification, typeSpecification_id,
+                          typeSpecification_key),
+        ConstantDefinition_id,
+        ConstantDefinition(ConstantDefinition, constantDefinition_id,
+                           constantDefinition_key),
+        Constant_id, Constant(Constant, constant_id, constant_key),
+        XRefTarget(XRefTarget_EMPTY, XRefTarget_include_, XRefTarget_named,
+                   XRefTarget_exception_, XRefTarget_service_, XRefTarget_constant,
+                   XRefTarget_enumValue, XRefTarget_function_, XRefTarget_field),
+        TypedConst(TypedConst_EMPTY, TypedConst_literal,
+                   TypedConst_identifier),
+        TypedConstT(TypedConstT, typedConstT_const_, typedConstT_type_),
+        UnionFieldVal(UnionFieldVal, unionFieldVal_name,
+                      unionFieldVal_value),
+        UnionVal_key(UnionVal_key, unionVal_key_field),
+        TypeDefType_key(TypeDefType_key, typeDefType_key_alias,
+                        typeDefType_key_type_, typeDefType_key_structuredAnnotations),
+        Target(Target, target_target),
+        StructuredAnnotation_key(StructuredAnnotation_key,
+                                 structuredAnnotation_key_type_, structuredAnnotation_key_value),
+        StructFieldValValue(StructFieldValValue_EMPTY,
+                            StructFieldValValue_val, StructFieldValValue_default_,
+                            StructFieldValValue_just, StructFieldValValue_nothing),
+        StructFieldVal(StructFieldVal, structFieldVal_name,
+                       structFieldVal_value),
+        StructVal_key(StructVal_key, structVal_key_fields),
+        ServiceParent_key(ServiceParent_key, serviceParent_key_child,
+                          serviceParent_key_parent),
+        ServiceName_key(ServiceName_key, serviceName_key_name),
+        ServiceInteractionFunctions_key(ServiceInteractionFunctions_key,
+                                        serviceInteractionFunctions_key_name,
+                                        serviceInteractionFunctions_key_function_),
+        ServiceDefinition_key(ServiceDefinition_key,
+                              serviceDefinition_key_name, serviceDefinition_key_functions,
+                              serviceDefinition_key_structuredAnnotations,
+                              serviceDefinition_key_interactions),
+        ServiceChild_key(ServiceChild_key, serviceChild_key_parent,
+                         serviceChild_key_child),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_qname),
+        ResultSink(ResultSink, resultSink_type_, resultSink_firstResponse,
+                   resultSink_finalResponse),
+        Qualifier(Qualifier_default_, Qualifier_optional_,
+                  Qualifier_required_, Qualifier__UNKNOWN),
+        QualName_key(QualName_key, qualName_key_file, qualName_key_name),
+        PrimitiveType(PrimitiveType_bool_, PrimitiveType_byte_,
+                      PrimitiveType_i16_, PrimitiveType_i32_, PrimitiveType_i64_,
+                      PrimitiveType_float_, PrimitiveType_double_, PrimitiveType_binary_,
+                      PrimitiveType_string_, PrimitiveType__UNKNOWN),
+        Package_key(Package_key, package_key_target, package_key_name),
+        Namespace_key(Namespace_key, namespace_key_target,
+                      namespace_key_name, namespace_key_namespace_,
+                      namespace_key_quoted),
+        NamedKind(NamedKind_typedef_, NamedKind_enum_, NamedKind_struct_,
+                  NamedKind_union_, NamedKind__UNKNOWN),
+        NamedType(NamedType, namedType_name, namedType_kind),
+        NamedDecl_key(NamedDecl_key, namedDecl_key_name),
+        NameLowerCase_key(NameLowerCase_key, nameLowerCase_key_nameStr,
+                          nameLowerCase_key_name),
+        MapType(MapType, mapType_key_, mapType_value),
+        Loc(Loc, loc_startLine, loc_startCol, loc_endLine, loc_endCol),
+        XRef(XRef, xRef_locRef, xRef_target),
+        KeyValue(KeyValue, keyValue_key, keyValue_value),
+        InteractionName_key(InteractionName_key, interactionName_key_name),
+        InteractionDefinition_key(InteractionDefinition_key,
+                                  interactionDefinition_key_name,
+                                  interactionDefinition_key_functions,
+                                  interactionDefinition_key_structuredAnnotations),
+        IntegerLiteral(IntegerLiteral, integerLiteral_isNonNegative,
+                       integerLiteral_absValue),
+        FunctionName_key(FunctionName_key, functionName_key_service_,
+                         functionName_key_name),
+        FloatLiteral(FloatLiteral, floatLiteral_isNaN,
+                     floatLiteral_isPositive, floatLiteral_exponent,
+                     floatLiteral_significand),
+        Literal_key(Literal_key_EMPTY, Literal_key_byte_, Literal_key_i16_,
+                    Literal_key_i32_, Literal_key_i64_, Literal_key_float_,
+                    Literal_key_double_, Literal_key_bool_, Literal_key_string_,
+                    Literal_key_binary_, Literal_key_set_, Literal_key_list_,
+                    Literal_key_map_, Literal_key_newtype_, Literal_key_struct_,
+                    Literal_key_exception_, Literal_key_union_, Literal_key_enum_),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs),
+        FieldKind(FieldKind_struct_, FieldKind_union_,
+                  FieldKind_exception_, FieldKind__UNKNOWN),
+        FieldId,
+        FieldSpecification(FieldSpecification, fieldSpecification_id,
+                           fieldSpecification_qualifier, fieldSpecification_type_,
+                           fieldSpecification_name, fieldSpecification_value,
+                           fieldSpecification_structuredAnnotations),
+        StructType_key(StructType_key, structType_key_name,
+                       structType_key_fields, structType_key_structuredAnnotations),
+        UnqualField(UnqualField, unqualField_id, unqualField_type_,
+                    unqualField_name, unqualField_structuredAnnotations),
+        UnionType_key(UnionType_key, unionType_key_name,
+                      unionType_key_alts, unionType_key_structuredAnnotations),
+        FieldDecl_key(FieldDecl_key, fieldDecl_key_qname,
+                      fieldDecl_key_kind, fieldDecl_key_name),
+        ExceptionType_key(ExceptionType_key, exceptionType_key_name,
+                          exceptionType_key_fields, exceptionType_key_structuredAnnotations),
+        ExceptionSpecName(ExceptionSpecName_EMPTY,
+                          ExceptionSpecName_simple, ExceptionSpecName_typedef_),
+        ExceptionSpecification(ExceptionSpecification,
+                               exceptionSpecification_id, exceptionSpecification_type_,
+                               exceptionSpecification_name,
+                               exceptionSpecification_structuredAnnotations),
+        ResultStream(ResultStream, resultStream_response,
+                     resultStream_stream_, resultStream_throws_),
+        ResultType(ResultType_EMPTY, ResultType_oneway_, ResultType_void_,
+                   ResultType_result, ResultType_stream_, ResultType_service_,
+                   ResultType_sink_),
+        FunctionSpecification_key(FunctionSpecification_key,
+                                  functionSpecification_key_name, functionSpecification_key_result,
+                                  functionSpecification_key_arguments,
+                                  functionSpecification_key_throws_,
+                                  functionSpecification_key_structuredAnnotations),
+        TypeDefException_key(TypeDefException_key,
+                             typeDefException_key_alias, typeDefException_key_type_),
+        ExceptionName_key(ExceptionName_key, exceptionName_key_name),
+        EnumerationType_key(EnumerationType_key, enumerationType_key_name,
+                            enumerationType_key_value,
+                            enumerationType_key_structuredAnnotations),
+        EnumValueDef_key(EnumValueDef_key, enumValueDef_key_name,
+                         enumValueDef_key_value, enumValueDef_key_structuredAnnotations),
+        EnumValue_key(EnumValue_key, enumValue_key_enum_,
+                      enumValue_key_name),
+        EnumVal_key(EnumVal_key, enumVal_key_name), Declaration,
+        DeclarationComment_key(DeclarationComment_key,
+                               declarationComment_key_declaration, declarationComment_key_file,
+                               declarationComment_key_span),
+        DeclarationFile_key(DeclarationFile_key,
+                            declarationFile_key_declaration, declarationFile_key_file),
+        DeclarationMember_key(DeclarationMember_key,
+                              declarationMember_key_qname, declarationMember_key_member,
+                              declarationMember_key_decl),
+        DeclarationName_key(DeclarationName_key, declarationName_key_qname,
+                            declarationName_key_decl),
+        DeclarationNameSpan_key(DeclarationNameSpan_key,
+                                declarationNameSpan_key_decl, declarationNameSpan_key_name,
+                                declarationNameSpan_key_file, declarationNameSpan_key_span),
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_target, declarationUses_key_file,
+                            declarationUses_key_range),
+        FileDeclaration_key(FileDeclaration_key, fileDeclaration_key_file,
+                            fileDeclaration_key_decl),
+        FunctionDeclarationName_key(FunctionDeclarationName_key,
+                                    functionDeclarationName_key_qname,
+                                    functionDeclarationName_key_name,
+                                    functionDeclarationName_key_decl),
+        ContainerType(ContainerType_EMPTY, ContainerType_list_,
+                      ContainerType_set_, ContainerType_map_),
+        TypeSpecification_key(TypeSpecification_key_EMPTY,
+                              TypeSpecification_key_primitive, TypeSpecification_key_container,
+                              TypeSpecification_key_named),
+        ConstantDefinition_key(ConstantDefinition_key,
+                               constantDefinition_key_constant,
+                               constantDefinition_key_definition),
+        Constant_key(Constant_key, constant_key_name))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/fbthrift_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 331 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Fbthrift/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("DeclarationUses", 1), ("File", 1), ("ServiceName", 1),
+       ("FunctionDeclarationName", 1), ("ServiceInteractionFunctions", 1),
+       ("ServiceParent", 1), ("ExceptionName", 1), ("DeclarationName", 1),
+       ("TypeSpecification", 1), ("ExceptionVal", 1), ("FieldDecl", 1),
+       ("DeclarationNameSpan", 1), ("QualName", 1),
+       ("InteractionName", 1), ("TypeDefType", 1),
+       ("InteractionDefinition", 1), ("FunctionName", 1), ("UnionVal", 1),
+       ("TypeDefException", 1), ("FileXRefs", 1), ("EnumValue", 1),
+       ("ServiceDefinition", 1), ("DeclarationMember", 1), ("Literal", 1),
+       ("SearchByName", 1), ("StructType", 1), ("FileDeclaration", 1),
+       ("EnumValueDef", 1), ("DeclarationComment", 1),
+       ("NamespaceValue", 1), ("ExceptionType", 1), ("UnionType", 1),
+       ("Identifier", 1), ("StructuredAnnotation", 1),
+       ("EnumerationType", 1), ("StructVal", 1), ("NamespaceName", 1),
+       ("PackageName", 1), ("FunctionSpecification", 1), ("EnumVal", 1),
+       ("DeclarationFile", 1), ("NameLowerCase", 1), ("Constant", 1),
+       ("ConstantDefinition", 1), ("ServiceChild", 1), ("NamedDecl", 1),
+       ("Namespace", 1), ("Package", 1)]
+
+type UnionVal_id = Glean.Id
+
+data UnionVal = UnionVal{unionVal_id ::
+                         {-# UNPACK #-} !UnionVal_id,
+                         unionVal_key :: Prelude.Maybe UnionVal_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionVal where
+  toJSON (UnionVal __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionVal where
+  buildStruct _proxy (UnionVal __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnionVal __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionVal where
+  rnf (UnionVal __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnionVal where
+  def = UnionVal Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnionVal where
+  hashWithSalt __salt (UnionVal _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeDefType_id = Glean.Id
+
+data TypeDefType = TypeDefType{typeDefType_id ::
+                               {-# UNPACK #-} !TypeDefType_id,
+                               typeDefType_key :: Prelude.Maybe TypeDefType_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDefType where
+  toJSON (TypeDefType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDefType where
+  buildStruct _proxy (TypeDefType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeDefType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDefType where
+  rnf (TypeDefType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDefType where
+  def = TypeDefType Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDefType where
+  hashWithSalt __salt (TypeDefType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StructuredAnnotation_id = Glean.Id
+
+data StructuredAnnotation = StructuredAnnotation{structuredAnnotation_id
+                                                 :: {-# UNPACK #-} !StructuredAnnotation_id,
+                                                 structuredAnnotation_key ::
+                                                 Prelude.Maybe StructuredAnnotation_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructuredAnnotation where
+  toJSON (StructuredAnnotation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StructuredAnnotation where
+  buildStruct _proxy (StructuredAnnotation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (StructuredAnnotation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StructuredAnnotation where
+  rnf (StructuredAnnotation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StructuredAnnotation where
+  def = StructuredAnnotation Default.def Prelude.Nothing
+
+instance Hashable.Hashable StructuredAnnotation where
+  hashWithSalt __salt (StructuredAnnotation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StructVal_id = Glean.Id
+
+data StructVal = StructVal{structVal_id ::
+                           {-# UNPACK #-} !StructVal_id,
+                           structVal_key :: Prelude.Maybe StructVal_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructVal where
+  toJSON (StructVal __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StructVal where
+  buildStruct _proxy (StructVal __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StructVal __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StructVal where
+  rnf (StructVal __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StructVal where
+  def = StructVal Default.def Prelude.Nothing
+
+instance Hashable.Hashable StructVal where
+  hashWithSalt __salt (StructVal _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ServiceParent_id = Glean.Id
+
+data ServiceParent = ServiceParent{serviceParent_id ::
+                                   {-# UNPACK #-} !ServiceParent_id,
+                                   serviceParent_key :: Prelude.Maybe ServiceParent_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceParent where
+  toJSON (ServiceParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceParent where
+  buildStruct _proxy (ServiceParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ServiceParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceParent where
+  rnf (ServiceParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ServiceParent where
+  def = ServiceParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable ServiceParent where
+  hashWithSalt __salt (ServiceParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ServiceName_id = Glean.Id
+
+data ServiceName = ServiceName{serviceName_id ::
+                               {-# UNPACK #-} !ServiceName_id,
+                               serviceName_key :: Prelude.Maybe ServiceName_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceName where
+  toJSON (ServiceName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceName where
+  buildStruct _proxy (ServiceName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ServiceName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceName where
+  rnf (ServiceName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ServiceName where
+  def = ServiceName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ServiceName where
+  hashWithSalt __salt (ServiceName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ServiceInteractionFunctions_id = Glean.Id
+
+data ServiceInteractionFunctions = ServiceInteractionFunctions{serviceInteractionFunctions_id
+                                                               ::
+                                                               {-# UNPACK #-} !ServiceInteractionFunctions_id,
+                                                               serviceInteractionFunctions_key ::
+                                                               Prelude.Maybe
+                                                                 ServiceInteractionFunctions_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceInteractionFunctions where
+  toJSON (ServiceInteractionFunctions __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceInteractionFunctions where
+  buildStruct _proxy
+    (ServiceInteractionFunctions __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ServiceInteractionFunctions __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceInteractionFunctions where
+  rnf (ServiceInteractionFunctions __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ServiceInteractionFunctions where
+  def = ServiceInteractionFunctions Default.def Prelude.Nothing
+
+instance Hashable.Hashable ServiceInteractionFunctions where
+  hashWithSalt __salt (ServiceInteractionFunctions _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ServiceDefinition_id = Glean.Id
+
+data ServiceDefinition = ServiceDefinition{serviceDefinition_id ::
+                                           {-# UNPACK #-} !ServiceDefinition_id,
+                                           serviceDefinition_key ::
+                                           Prelude.Maybe ServiceDefinition_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceDefinition where
+  toJSON (ServiceDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceDefinition where
+  buildStruct _proxy (ServiceDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ServiceDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceDefinition where
+  rnf (ServiceDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ServiceDefinition where
+  def = ServiceDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ServiceDefinition where
+  hashWithSalt __salt (ServiceDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ServiceChild_id = Glean.Id
+
+data ServiceChild = ServiceChild{serviceChild_id ::
+                                 {-# UNPACK #-} !ServiceChild_id,
+                                 serviceChild_key :: Prelude.Maybe ServiceChild_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceChild where
+  toJSON (ServiceChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceChild where
+  buildStruct _proxy (ServiceChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ServiceChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceChild where
+  rnf (ServiceChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ServiceChild where
+  def = ServiceChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable ServiceChild where
+  hashWithSalt __salt (ServiceChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QualName_id = Glean.Id
+
+data QualName = QualName{qualName_id ::
+                         {-# UNPACK #-} !QualName_id,
+                         qualName_key :: Prelude.Maybe QualName_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QualName where
+  toJSON (QualName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QualName where
+  buildStruct _proxy (QualName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QualName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QualName where
+  rnf (QualName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QualName where
+  def = QualName Default.def Prelude.Nothing
+
+instance Hashable.Hashable QualName where
+  hashWithSalt __salt (QualName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PackageName_id = Glean.Id
+
+data PackageName = PackageName{packageName_id ::
+                               {-# UNPACK #-} !PackageName_id,
+                               packageName_key :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackageName where
+  toJSON (PackageName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PackageName where
+  buildStruct _proxy (PackageName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PackageName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PackageName where
+  rnf (PackageName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PackageName where
+  def = PackageName Default.def Prelude.Nothing
+
+instance Hashable.Hashable PackageName where
+  hashWithSalt __salt (PackageName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Package_id = Glean.Id
+
+data Package = Package{package_id :: {-# UNPACK #-} !Package_id,
+                       package_key :: Prelude.Maybe Package_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Package where
+  toJSON (Package __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Package where
+  buildStruct _proxy (Package __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Package __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Package where
+  rnf (Package __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Package where
+  def = Package Default.def Prelude.Nothing
+
+instance Hashable.Hashable Package where
+  hashWithSalt __salt (Package _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceValue_id = Glean.Id
+
+data NamespaceValue = NamespaceValue{namespaceValue_id ::
+                                     {-# UNPACK #-} !NamespaceValue_id,
+                                     namespaceValue_key :: Prelude.Maybe Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceValue where
+  toJSON (NamespaceValue __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceValue where
+  buildStruct _proxy (NamespaceValue __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceValue __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceValue where
+  rnf (NamespaceValue __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceValue where
+  def = NamespaceValue Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceValue where
+  hashWithSalt __salt (NamespaceValue _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceName_id = Glean.Id
+
+data NamespaceName = NamespaceName{namespaceName_id ::
+                                   {-# UNPACK #-} !NamespaceName_id,
+                                   namespaceName_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceName where
+  toJSON (NamespaceName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceName where
+  buildStruct _proxy (NamespaceName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceName where
+  rnf (NamespaceName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceName where
+  def = NamespaceName Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceName where
+  hashWithSalt __salt (NamespaceName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Namespace_id = Glean.Id
+
+data Namespace = Namespace{namespace_id ::
+                           {-# UNPACK #-} !Namespace_id,
+                           namespace_key :: Prelude.Maybe Namespace_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Namespace where
+  toJSON (Namespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Namespace where
+  buildStruct _proxy (Namespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Namespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Namespace where
+  rnf (Namespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Namespace where
+  def = Namespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable Namespace where
+  hashWithSalt __salt (Namespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamedDecl_id = Glean.Id
+
+data NamedDecl = NamedDecl{namedDecl_id ::
+                           {-# UNPACK #-} !NamedDecl_id,
+                           namedDecl_key :: Prelude.Maybe NamedDecl_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamedDecl where
+  toJSON (NamedDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamedDecl where
+  buildStruct _proxy (NamedDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamedDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamedDecl where
+  rnf (NamedDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamedDecl where
+  def = NamedDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamedDecl where
+  hashWithSalt __salt (NamedDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InteractionName_id = Glean.Id
+
+data InteractionName = InteractionName{interactionName_id ::
+                                       {-# UNPACK #-} !InteractionName_id,
+                                       interactionName_key :: Prelude.Maybe InteractionName_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InteractionName where
+  toJSON (InteractionName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InteractionName where
+  buildStruct _proxy (InteractionName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InteractionName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InteractionName where
+  rnf (InteractionName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InteractionName where
+  def = InteractionName Default.def Prelude.Nothing
+
+instance Hashable.Hashable InteractionName where
+  hashWithSalt __salt (InteractionName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InteractionDefinition_id = Glean.Id
+
+data InteractionDefinition = InteractionDefinition{interactionDefinition_id
+                                                   :: {-# UNPACK #-} !InteractionDefinition_id,
+                                                   interactionDefinition_key ::
+                                                   Prelude.Maybe InteractionDefinition_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InteractionDefinition where
+  toJSON (InteractionDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InteractionDefinition where
+  buildStruct _proxy (InteractionDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (InteractionDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InteractionDefinition where
+  rnf (InteractionDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InteractionDefinition where
+  def = InteractionDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable InteractionDefinition where
+  hashWithSalt __salt (InteractionDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Identifier_id = Glean.Id
+
+data Identifier = Identifier{identifier_id ::
+                             {-# UNPACK #-} !Identifier_id,
+                             identifier_key :: Prelude.Maybe Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Identifier where
+  toJSON (Identifier __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Identifier where
+  buildStruct _proxy (Identifier __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Identifier __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Identifier where
+  rnf (Identifier __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Identifier where
+  def = Identifier Default.def Prelude.Nothing
+
+instance Hashable.Hashable Identifier where
+  hashWithSalt __salt (Identifier _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionName_id = Glean.Id
+
+data FunctionName = FunctionName{functionName_id ::
+                                 {-# UNPACK #-} !FunctionName_id,
+                                 functionName_key :: Prelude.Maybe FunctionName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionName where
+  toJSON (FunctionName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionName where
+  buildStruct _proxy (FunctionName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionName where
+  rnf (FunctionName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionName where
+  def = FunctionName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionName where
+  hashWithSalt __salt (FunctionName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Literal_id = Glean.Id
+
+data Literal = Literal{literal_id :: {-# UNPACK #-} !Literal_id,
+                       literal_key :: Prelude.Maybe Literal_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Literal where
+  toJSON (Literal __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Literal where
+  buildStruct _proxy (Literal __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Literal __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Literal where
+  rnf (Literal __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Literal where
+  def = Literal Default.def Prelude.Nothing
+
+instance Hashable.Hashable Literal where
+  hashWithSalt __salt (Literal _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type File_id = Glean.Id
+
+data File = File{file_id :: {-# UNPACK #-} !File_id,
+                 file_key :: Prelude.Maybe Glean.Schema.Src.File}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON File where
+  toJSON (File __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct File where
+  buildStruct _proxy (File __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (File __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData File where
+  rnf (File __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default File where
+  def = File Default.def Prelude.Nothing
+
+instance Hashable.Hashable File where
+  hashWithSalt __salt (File _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StructType_id = Glean.Id
+
+data StructType = StructType{structType_id ::
+                             {-# UNPACK #-} !StructType_id,
+                             structType_key :: Prelude.Maybe StructType_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructType where
+  toJSON (StructType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StructType where
+  buildStruct _proxy (StructType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StructType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StructType where
+  rnf (StructType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StructType where
+  def = StructType Default.def Prelude.Nothing
+
+instance Hashable.Hashable StructType where
+  hashWithSalt __salt (StructType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UnionType_id = Glean.Id
+
+data UnionType = UnionType{unionType_id ::
+                           {-# UNPACK #-} !UnionType_id,
+                           unionType_key :: Prelude.Maybe UnionType_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionType where
+  toJSON (UnionType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionType where
+  buildStruct _proxy (UnionType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnionType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionType where
+  rnf (UnionType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnionType where
+  def = UnionType Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnionType where
+  hashWithSalt __salt (UnionType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FieldDecl_id = Glean.Id
+
+data FieldDecl = FieldDecl{fieldDecl_id ::
+                           {-# UNPACK #-} !FieldDecl_id,
+                           fieldDecl_key :: Prelude.Maybe FieldDecl_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDecl where
+  toJSON (FieldDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDecl where
+  buildStruct _proxy (FieldDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FieldDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDecl where
+  rnf (FieldDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FieldDecl where
+  def = FieldDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable FieldDecl where
+  hashWithSalt __salt (FieldDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExceptionVal_id = Glean.Id
+
+data ExceptionVal = ExceptionVal{exceptionVal_id ::
+                                 {-# UNPACK #-} !ExceptionVal_id,
+                                 exceptionVal_key :: Prelude.Maybe StructVal}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionVal where
+  toJSON (ExceptionVal __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionVal where
+  buildStruct _proxy (ExceptionVal __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExceptionVal __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionVal where
+  rnf (ExceptionVal __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExceptionVal where
+  def = ExceptionVal Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExceptionVal where
+  hashWithSalt __salt (ExceptionVal _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExceptionType_id = Glean.Id
+
+data ExceptionType = ExceptionType{exceptionType_id ::
+                                   {-# UNPACK #-} !ExceptionType_id,
+                                   exceptionType_key :: Prelude.Maybe ExceptionType_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionType where
+  toJSON (ExceptionType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionType where
+  buildStruct _proxy (ExceptionType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExceptionType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionType where
+  rnf (ExceptionType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExceptionType where
+  def = ExceptionType Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExceptionType where
+  hashWithSalt __salt (ExceptionType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionSpecification_id = Glean.Id
+
+data FunctionSpecification = FunctionSpecification{functionSpecification_id
+                                                   :: {-# UNPACK #-} !FunctionSpecification_id,
+                                                   functionSpecification_key ::
+                                                   Prelude.Maybe FunctionSpecification_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionSpecification where
+  toJSON (FunctionSpecification __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionSpecification where
+  buildStruct _proxy (FunctionSpecification __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionSpecification __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionSpecification where
+  rnf (FunctionSpecification __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionSpecification where
+  def = FunctionSpecification Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionSpecification where
+  hashWithSalt __salt (FunctionSpecification _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeDefException_id = Glean.Id
+
+data TypeDefException = TypeDefException{typeDefException_id ::
+                                         {-# UNPACK #-} !TypeDefException_id,
+                                         typeDefException_key :: Prelude.Maybe TypeDefException_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDefException where
+  toJSON (TypeDefException __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDefException where
+  buildStruct _proxy (TypeDefException __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeDefException __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDefException where
+  rnf (TypeDefException __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDefException where
+  def = TypeDefException Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDefException where
+  hashWithSalt __salt (TypeDefException _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExceptionName_id = Glean.Id
+
+data ExceptionName = ExceptionName{exceptionName_id ::
+                                   {-# UNPACK #-} !ExceptionName_id,
+                                   exceptionName_key :: Prelude.Maybe ExceptionName_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionName where
+  toJSON (ExceptionName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionName where
+  buildStruct _proxy (ExceptionName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExceptionName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionName where
+  rnf (ExceptionName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExceptionName where
+  def = ExceptionName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExceptionName where
+  hashWithSalt __salt (ExceptionName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumerationType_id = Glean.Id
+
+data EnumerationType = EnumerationType{enumerationType_id ::
+                                       {-# UNPACK #-} !EnumerationType_id,
+                                       enumerationType_key :: Prelude.Maybe EnumerationType_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumerationType where
+  toJSON (EnumerationType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumerationType where
+  buildStruct _proxy (EnumerationType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumerationType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumerationType where
+  rnf (EnumerationType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumerationType where
+  def = EnumerationType Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumerationType where
+  hashWithSalt __salt (EnumerationType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumValueDef_id = Glean.Id
+
+data EnumValueDef = EnumValueDef{enumValueDef_id ::
+                                 {-# UNPACK #-} !EnumValueDef_id,
+                                 enumValueDef_key :: Prelude.Maybe EnumValueDef_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumValueDef where
+  toJSON (EnumValueDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumValueDef where
+  buildStruct _proxy (EnumValueDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumValueDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumValueDef where
+  rnf (EnumValueDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumValueDef where
+  def = EnumValueDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumValueDef where
+  hashWithSalt __salt (EnumValueDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumValue_id = Glean.Id
+
+data EnumValue = EnumValue{enumValue_id ::
+                           {-# UNPACK #-} !EnumValue_id,
+                           enumValue_key :: Prelude.Maybe EnumValue_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumValue where
+  toJSON (EnumValue __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumValue where
+  buildStruct _proxy (EnumValue __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumValue __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumValue where
+  rnf (EnumValue __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumValue where
+  def = EnumValue Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumValue where
+  hashWithSalt __salt (EnumValue _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumVal_id = Glean.Id
+
+data EnumVal = EnumVal{enumVal_id :: {-# UNPACK #-} !EnumVal_id,
+                       enumVal_key :: Prelude.Maybe EnumVal_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumVal where
+  toJSON (EnumVal __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumVal where
+  buildStruct _proxy (EnumVal __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumVal __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumVal where
+  rnf (EnumVal __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumVal where
+  def = EnumVal Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumVal where
+  hashWithSalt __salt (EnumVal _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationComment_id = Glean.Id
+
+data DeclarationComment = DeclarationComment{declarationComment_id
+                                             :: {-# UNPACK #-} !DeclarationComment_id,
+                                             declarationComment_key ::
+                                             Prelude.Maybe DeclarationComment_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment where
+  toJSON (DeclarationComment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment where
+  buildStruct _proxy (DeclarationComment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationComment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment where
+  rnf (DeclarationComment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationComment where
+  def = DeclarationComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment where
+  hashWithSalt __salt (DeclarationComment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationFile_id = Glean.Id
+
+data DeclarationFile = DeclarationFile{declarationFile_id ::
+                                       {-# UNPACK #-} !DeclarationFile_id,
+                                       declarationFile_key :: Prelude.Maybe DeclarationFile_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationFile where
+  toJSON (DeclarationFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationFile where
+  buildStruct _proxy (DeclarationFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationFile where
+  rnf (DeclarationFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationFile where
+  def = DeclarationFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationFile where
+  hashWithSalt __salt (DeclarationFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationMember_id = Glean.Id
+
+data DeclarationMember = DeclarationMember{declarationMember_id ::
+                                           {-# UNPACK #-} !DeclarationMember_id,
+                                           declarationMember_key ::
+                                           Prelude.Maybe DeclarationMember_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationMember where
+  toJSON (DeclarationMember __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationMember where
+  buildStruct _proxy (DeclarationMember __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationMember __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationMember where
+  rnf (DeclarationMember __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationMember where
+  def = DeclarationMember Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationMember where
+  hashWithSalt __salt (DeclarationMember _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationName_id = Glean.Id
+
+data DeclarationName = DeclarationName{declarationName_id ::
+                                       {-# UNPACK #-} !DeclarationName_id,
+                                       declarationName_key :: Prelude.Maybe DeclarationName_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName where
+  toJSON (DeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationName where
+  buildStruct _proxy (DeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName where
+  rnf (DeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationName where
+  def = DeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationName where
+  hashWithSalt __salt (DeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationNameSpan_id = Glean.Id
+
+data DeclarationNameSpan = DeclarationNameSpan{declarationNameSpan_id
+                                               :: {-# UNPACK #-} !DeclarationNameSpan_id,
+                                               declarationNameSpan_key ::
+                                               Prelude.Maybe DeclarationNameSpan_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan where
+  toJSON (DeclarationNameSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan where
+  buildStruct _proxy (DeclarationNameSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationNameSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan where
+  rnf (DeclarationNameSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan where
+  def = DeclarationNameSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationNameSpan where
+  hashWithSalt __salt (DeclarationNameSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclaration_id = Glean.Id
+
+data FileDeclaration = FileDeclaration{fileDeclaration_id ::
+                                       {-# UNPACK #-} !FileDeclaration_id,
+                                       fileDeclaration_key :: Prelude.Maybe FileDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclaration where
+  toJSON (FileDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclaration where
+  buildStruct _proxy (FileDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclaration where
+  rnf (FileDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclaration where
+  def = FileDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclaration where
+  hashWithSalt __salt (FileDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclarationName_id = Glean.Id
+
+data FunctionDeclarationName = FunctionDeclarationName{functionDeclarationName_id
+                                                       ::
+                                                       {-# UNPACK #-} !FunctionDeclarationName_id,
+                                                       functionDeclarationName_key ::
+                                                       Prelude.Maybe FunctionDeclarationName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationName where
+  toJSON (FunctionDeclarationName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationName where
+  buildStruct _proxy
+    (FunctionDeclarationName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FunctionDeclarationName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationName where
+  rnf (FunctionDeclarationName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationName where
+  def = FunctionDeclarationName Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclarationName where
+  hashWithSalt __salt (FunctionDeclarationName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeSpecification_id = Glean.Id
+
+data TypeSpecification = TypeSpecification{typeSpecification_id ::
+                                           {-# UNPACK #-} !TypeSpecification_id,
+                                           typeSpecification_key ::
+                                           Prelude.Maybe TypeSpecification_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeSpecification where
+  toJSON (TypeSpecification __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeSpecification where
+  buildStruct _proxy (TypeSpecification __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeSpecification __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeSpecification where
+  rnf (TypeSpecification __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeSpecification where
+  def = TypeSpecification Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeSpecification where
+  hashWithSalt __salt (TypeSpecification _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConstantDefinition_id = Glean.Id
+
+data ConstantDefinition = ConstantDefinition{constantDefinition_id
+                                             :: {-# UNPACK #-} !ConstantDefinition_id,
+                                             constantDefinition_key ::
+                                             Prelude.Maybe ConstantDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstantDefinition where
+  toJSON (ConstantDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstantDefinition where
+  buildStruct _proxy (ConstantDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConstantDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstantDefinition where
+  rnf (ConstantDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConstantDefinition where
+  def = ConstantDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConstantDefinition where
+  hashWithSalt __salt (ConstantDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Constant_id = Glean.Id
+
+data Constant = Constant{constant_id ::
+                         {-# UNPACK #-} !Constant_id,
+                         constant_key :: Prelude.Maybe Constant_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Constant where
+  toJSON (Constant __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Constant where
+  buildStruct _proxy (Constant __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Constant __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Constant where
+  rnf (Constant __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Constant where
+  def = Constant Default.def Prelude.Nothing
+
+instance Hashable.Hashable Constant where
+  hashWithSalt __salt (Constant _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefTarget = XRefTarget_include_ File
+                | XRefTarget_named NamedDecl
+                | XRefTarget_exception_ ExceptionName
+                | XRefTarget_service_ ServiceName
+                | XRefTarget_constant Constant
+                | XRefTarget_enumValue EnumValue
+                | XRefTarget_function_ FunctionName
+                | XRefTarget_field FieldDecl
+                | XRefTarget_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTarget where
+  toJSON (XRefTarget_include_ __include_)
+    = Aeson.object ["include_" .= __include_]
+  toJSON (XRefTarget_named __named)
+    = Aeson.object ["named" .= __named]
+  toJSON (XRefTarget_exception_ __exception_)
+    = Aeson.object ["exception_" .= __exception_]
+  toJSON (XRefTarget_service_ __service_)
+    = Aeson.object ["service_" .= __service_]
+  toJSON (XRefTarget_constant __constant)
+    = Aeson.object ["constant" .= __constant]
+  toJSON (XRefTarget_enumValue __enumValue)
+    = Aeson.object ["enumValue" .= __enumValue]
+  toJSON (XRefTarget_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (XRefTarget_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON XRefTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefTarget where
+  buildStruct _proxy (XRefTarget_include_ __include_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "include_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __include_)]
+  buildStruct _proxy (XRefTarget_named __named)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "named" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __named)]
+  buildStruct _proxy (XRefTarget_exception_ __exception_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "exception_" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __exception_)]
+  buildStruct _proxy (XRefTarget_service_ __service_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "service_" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __service_)]
+  buildStruct _proxy (XRefTarget_constant __constant)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "constant" (Thrift.getStructType _proxy) 5
+           0
+           (Thrift.buildStruct _proxy __constant)]
+  buildStruct _proxy (XRefTarget_enumValue __enumValue)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enumValue" (Thrift.getStructType _proxy) 6
+           0
+           (Thrift.buildStruct _proxy __enumValue)]
+  buildStruct _proxy (XRefTarget_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 7
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (XRefTarget_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy XRefTarget_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_include_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_named _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_exception_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_service_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_constant _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_enumValue _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_function_ _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_field _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefTarget_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("include_", 1), ("named", 2), ("exception_", 3), ("service_", 4),
+             ("constant", 5), ("enumValue", 6), ("function_", 7), ("field", 8)]
+
+instance DeepSeq.NFData XRefTarget where
+  rnf (XRefTarget_include_ __include_) = DeepSeq.rnf __include_
+  rnf (XRefTarget_named __named) = DeepSeq.rnf __named
+  rnf (XRefTarget_exception_ __exception_) = DeepSeq.rnf __exception_
+  rnf (XRefTarget_service_ __service_) = DeepSeq.rnf __service_
+  rnf (XRefTarget_constant __constant) = DeepSeq.rnf __constant
+  rnf (XRefTarget_enumValue __enumValue) = DeepSeq.rnf __enumValue
+  rnf (XRefTarget_function_ __function_) = DeepSeq.rnf __function_
+  rnf (XRefTarget_field __field) = DeepSeq.rnf __field
+  rnf XRefTarget_EMPTY = ()
+
+instance Default.Default XRefTarget where
+  def = XRefTarget_EMPTY
+
+instance Hashable.Hashable XRefTarget where
+  hashWithSalt __salt (XRefTarget_include_ _include_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _include_)
+  hashWithSalt __salt (XRefTarget_named _named)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _named)
+  hashWithSalt __salt (XRefTarget_exception_ _exception_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _exception_)
+  hashWithSalt __salt (XRefTarget_service_ _service_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _service_)
+  hashWithSalt __salt (XRefTarget_constant _constant)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _constant)
+  hashWithSalt __salt (XRefTarget_enumValue _enumValue)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _enumValue)
+  hashWithSalt __salt (XRefTarget_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _function_)
+  hashWithSalt __salt (XRefTarget_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _field)
+  hashWithSalt __salt XRefTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypedConst = TypedConst_literal Literal
+                | TypedConst_identifier Constant
+                | TypedConst_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedConst where
+  toJSON (TypedConst_literal __literal)
+    = Aeson.object ["literal" .= __literal]
+  toJSON (TypedConst_identifier __identifier)
+    = Aeson.object ["identifier" .= __identifier]
+  toJSON TypedConst_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TypedConst where
+  buildStruct _proxy (TypedConst_literal __literal)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "literal" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __literal)]
+  buildStruct _proxy (TypedConst_identifier __identifier)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "identifier" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __identifier)]
+  buildStruct _proxy TypedConst_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TypedConst_literal _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypedConst_identifier _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return TypedConst_EMPTY
+           Thrift.FieldEnd -> Prelude.return TypedConst_EMPTY
+    where
+      _idMap = HashMap.fromList [("literal", 1), ("identifier", 2)]
+
+instance DeepSeq.NFData TypedConst where
+  rnf (TypedConst_literal __literal) = DeepSeq.rnf __literal
+  rnf (TypedConst_identifier __identifier) = DeepSeq.rnf __identifier
+  rnf TypedConst_EMPTY = ()
+
+instance Default.Default TypedConst where
+  def = TypedConst_EMPTY
+
+instance Hashable.Hashable TypedConst where
+  hashWithSalt __salt (TypedConst_literal _literal)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _literal)
+  hashWithSalt __salt (TypedConst_identifier _identifier)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _identifier)
+  hashWithSalt __salt TypedConst_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypedConstT = TypedConstT{typedConstT_const_ :: TypedConst,
+                               typedConstT_type_ :: TypeSpecification}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedConstT where
+  toJSON (TypedConstT __field__const_ __field__type_)
+    = Aeson.object
+        ("const_" .= __field__const_ :
+           "type_" .= __field__type_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypedConstT where
+  buildStruct _proxy (TypedConstT __field__const_ __field__type_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "const_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__const_)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__const_ <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__const_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__const_ <- ST.readSTRef
+                                                                 __field__const_
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             Prelude.pure (TypedConstT __val__const_ __val__type_)
+              _idMap = HashMap.fromList [("const_", 1), ("type_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypedConstT where
+  rnf (TypedConstT __field__const_ __field__type_)
+    = DeepSeq.rnf __field__const_ `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq` ()
+
+instance Default.Default TypedConstT where
+  def = TypedConstT Default.def Default.def
+
+instance Hashable.Hashable TypedConstT where
+  hashWithSalt __salt (TypedConstT _const_ _type_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _const_)
+        _type_
+
+data UnionFieldVal = UnionFieldVal{unionFieldVal_name ::
+                                   Identifier,
+                                   unionFieldVal_value :: TypedConstT}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionFieldVal where
+  toJSON (UnionFieldVal __field__name __field__value)
+    = Aeson.object
+        ("name" .= __field__name :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionFieldVal where
+  buildStruct _proxy (UnionFieldVal __field__name __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (UnionFieldVal __val__name __val__value)
+              _idMap = HashMap.fromList [("name", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionFieldVal where
+  rnf (UnionFieldVal __field__name __field__value)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default UnionFieldVal where
+  def = UnionFieldVal Default.def Default.def
+
+instance Hashable.Hashable UnionFieldVal where
+  hashWithSalt __salt (UnionFieldVal _name _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _value
+
+newtype UnionVal_key = UnionVal_key{unionVal_key_field ::
+                                    UnionFieldVal}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionVal_key where
+  toJSON (UnionVal_key __field__field)
+    = Aeson.object ("field" .= __field__field : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionVal_key where
+  buildStruct _proxy (UnionVal_key __field__field)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__field)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__field <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__field
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__field <- ST.readSTRef __field__field
+                                             Prelude.pure (UnionVal_key __val__field)
+              _idMap = HashMap.fromList [("field", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionVal_key where
+  rnf (UnionVal_key __field__field)
+    = DeepSeq.rnf __field__field `Prelude.seq` ()
+
+instance Default.Default UnionVal_key where
+  def = UnionVal_key Default.def
+
+instance Hashable.Hashable UnionVal_key where
+  hashWithSalt __salt (UnionVal_key _field)
+    = Hashable.hashWithSalt __salt _field
+
+data TypeDefType_key = TypeDefType_key{typeDefType_key_alias ::
+                                       QualName,
+                                       typeDefType_key_type_ :: TypeSpecification,
+                                       typeDefType_key_structuredAnnotations ::
+                                       [StructuredAnnotation]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDefType_key where
+  toJSON
+    (TypeDefType_key __field__alias __field__type_
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("alias" .= __field__alias :
+           "type_" .= __field__type_ :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDefType_key where
+  buildStruct _proxy
+    (TypeDefType_key __field__alias __field__type_
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "alias" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__alias)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__alias <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__alias
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__alias <- ST.readSTRef __field__alias
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (TypeDefType_key __val__alias __val__type_
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("alias", 1), ("type_", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDefType_key where
+  rnf
+    (TypeDefType_key __field__alias __field__type_
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__alias `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default TypeDefType_key where
+  def = TypeDefType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TypeDefType_key where
+  hashWithSalt __salt
+    (TypeDefType_key _alias _type_ _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _alias)
+           _type_)
+        _structuredAnnotations
+
+newtype Target = Target{target_target :: XRefTarget}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Target where
+  toJSON (Target __field__target)
+    = Aeson.object ("target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct Target where
+  buildStruct _proxy (Target __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             Prelude.pure (Target __val__target)
+              _idMap = HashMap.fromList [("target", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Target where
+  rnf (Target __field__target)
+    = DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default Target where
+  def = Target Default.def
+
+instance Hashable.Hashable Target where
+  hashWithSalt __salt (Target _target)
+    = Hashable.hashWithSalt __salt _target
+
+data StructuredAnnotation_key = StructuredAnnotation_key{structuredAnnotation_key_type_
+                                                         :: TypeSpecification,
+                                                         structuredAnnotation_key_value ::
+                                                         StructVal}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructuredAnnotation_key where
+  toJSON (StructuredAnnotation_key __field__type_ __field__value)
+    = Aeson.object
+        ("type_" .= __field__type_ :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct StructuredAnnotation_key where
+  buildStruct _proxy
+    (StructuredAnnotation_key __field__type_ __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type_)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type_ <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (StructuredAnnotation_key __val__type_ __val__value)
+              _idMap = HashMap.fromList [("type_", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StructuredAnnotation_key where
+  rnf (StructuredAnnotation_key __field__type_ __field__value)
+    = DeepSeq.rnf __field__type_ `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default StructuredAnnotation_key where
+  def = StructuredAnnotation_key Default.def Default.def
+
+instance Hashable.Hashable StructuredAnnotation_key where
+  hashWithSalt __salt (StructuredAnnotation_key _type_ _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type_)
+        _value
+
+data StructFieldValValue = StructFieldValValue_val TypedConstT
+                         | StructFieldValValue_default_ TypeSpecification
+                         | StructFieldValValue_just TypedConstT
+                         | StructFieldValValue_nothing Glean.Schema.Builtin.Unit
+                         | StructFieldValValue_EMPTY
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructFieldValValue where
+  toJSON (StructFieldValValue_val __val)
+    = Aeson.object ["val" .= __val]
+  toJSON (StructFieldValValue_default_ __default_)
+    = Aeson.object ["default_" .= __default_]
+  toJSON (StructFieldValValue_just __just)
+    = Aeson.object ["just" .= __just]
+  toJSON (StructFieldValValue_nothing __nothing)
+    = Aeson.object ["nothing" .= __nothing]
+  toJSON StructFieldValValue_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct StructFieldValValue where
+  buildStruct _proxy (StructFieldValValue_val __val)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "val" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __val)]
+  buildStruct _proxy (StructFieldValValue_default_ __default_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "default_" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __default_)]
+  buildStruct _proxy (StructFieldValValue_just __just)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "just" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __just)]
+  buildStruct _proxy (StructFieldValValue_nothing __nothing)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "nothing" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __nothing)]
+  buildStruct _proxy StructFieldValValue_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (StructFieldValValue_val _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (StructFieldValValue_default_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (StructFieldValValue_just _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (StructFieldValValue_nothing _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               StructFieldValValue_EMPTY
+           Thrift.FieldEnd -> Prelude.return StructFieldValValue_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("val", 1), ("default_", 2), ("just", 3), ("nothing", 4)]
+
+instance DeepSeq.NFData StructFieldValValue where
+  rnf (StructFieldValValue_val __val) = DeepSeq.rnf __val
+  rnf (StructFieldValValue_default_ __default_)
+    = DeepSeq.rnf __default_
+  rnf (StructFieldValValue_just __just) = DeepSeq.rnf __just
+  rnf (StructFieldValValue_nothing __nothing) = DeepSeq.rnf __nothing
+  rnf StructFieldValValue_EMPTY = ()
+
+instance Default.Default StructFieldValValue where
+  def = StructFieldValValue_EMPTY
+
+instance Hashable.Hashable StructFieldValValue where
+  hashWithSalt __salt (StructFieldValValue_val _val)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _val)
+  hashWithSalt __salt (StructFieldValValue_default_ _default_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _default_)
+  hashWithSalt __salt (StructFieldValValue_just _just)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _just)
+  hashWithSalt __salt (StructFieldValValue_nothing _nothing)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _nothing)
+  hashWithSalt __salt StructFieldValValue_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data StructFieldVal = StructFieldVal{structFieldVal_name ::
+                                     Identifier,
+                                     structFieldVal_value :: StructFieldValValue}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructFieldVal where
+  toJSON (StructFieldVal __field__name __field__value)
+    = Aeson.object
+        ("name" .= __field__name :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct StructFieldVal where
+  buildStruct _proxy (StructFieldVal __field__name __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (StructFieldVal __val__name __val__value)
+              _idMap = HashMap.fromList [("name", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StructFieldVal where
+  rnf (StructFieldVal __field__name __field__value)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default StructFieldVal where
+  def = StructFieldVal Default.def Default.def
+
+instance Hashable.Hashable StructFieldVal where
+  hashWithSalt __salt (StructFieldVal _name _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _value
+
+newtype StructVal_key = StructVal_key{structVal_key_fields ::
+                                      [StructFieldVal]}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructVal_key where
+  toJSON (StructVal_key __field__fields)
+    = Aeson.object ("fields" .= __field__fields : Prelude.mempty)
+
+instance Thrift.ThriftStruct StructVal_key where
+  buildStruct _proxy (StructVal_key __field__fields)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__fields)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fields <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fields <- ST.readSTRef
+                                                                 __field__fields
+                                             Prelude.pure (StructVal_key __val__fields)
+              _idMap = HashMap.fromList [("fields", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData StructVal_key where
+  rnf (StructVal_key __field__fields)
+    = DeepSeq.rnf __field__fields `Prelude.seq` ()
+
+instance Default.Default StructVal_key where
+  def = StructVal_key Default.def
+
+instance Hashable.Hashable StructVal_key where
+  hashWithSalt __salt (StructVal_key _fields)
+    = Hashable.hashWithSalt __salt _fields
+
+data ServiceParent_key = ServiceParent_key{serviceParent_key_child
+                                           :: ServiceName,
+                                           serviceParent_key_parent :: ServiceName}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceParent_key where
+  toJSON (ServiceParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceParent_key where
+  buildStruct _proxy
+    (ServiceParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ServiceParent_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceParent_key where
+  rnf (ServiceParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ServiceParent_key where
+  def = ServiceParent_key Default.def Default.def
+
+instance Hashable.Hashable ServiceParent_key where
+  hashWithSalt __salt (ServiceParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+newtype ServiceName_key = ServiceName_key{serviceName_key_name ::
+                                          QualName}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceName_key where
+  toJSON (ServiceName_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceName_key where
+  buildStruct _proxy (ServiceName_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (ServiceName_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceName_key where
+  rnf (ServiceName_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ServiceName_key where
+  def = ServiceName_key Default.def
+
+instance Hashable.Hashable ServiceName_key where
+  hashWithSalt __salt (ServiceName_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data ServiceInteractionFunctions_key = ServiceInteractionFunctions_key{serviceInteractionFunctions_key_name
+                                                                       :: ServiceName,
+                                                                       serviceInteractionFunctions_key_function_
+                                                                       :: FunctionSpecification}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceInteractionFunctions_key where
+  toJSON
+    (ServiceInteractionFunctions_key __field__name __field__function_)
+    = Aeson.object
+        ("name" .= __field__name :
+           "function_" .= __field__function_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceInteractionFunctions_key where
+  buildStruct _proxy
+    (ServiceInteractionFunctions_key __field__name __field__function_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__function_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__function_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__function_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__function_ <- ST.readSTRef __field__function_
+                                             Prelude.pure
+                                               (ServiceInteractionFunctions_key __val__name
+                                                  __val__function_)
+              _idMap = HashMap.fromList [("name", 1), ("function_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceInteractionFunctions_key where
+  rnf
+    (ServiceInteractionFunctions_key __field__name __field__function_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__function_ `Prelude.seq` ()
+
+instance Default.Default ServiceInteractionFunctions_key where
+  def = ServiceInteractionFunctions_key Default.def Default.def
+
+instance Hashable.Hashable ServiceInteractionFunctions_key where
+  hashWithSalt __salt
+    (ServiceInteractionFunctions_key _name _function_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _function_
+
+data ServiceDefinition_key = ServiceDefinition_key{serviceDefinition_key_name
+                                                   :: ServiceName,
+                                                   serviceDefinition_key_functions ::
+                                                   [FunctionSpecification],
+                                                   serviceDefinition_key_structuredAnnotations ::
+                                                   [StructuredAnnotation],
+                                                   serviceDefinition_key_interactions ::
+                                                   [InteractionName]}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceDefinition_key where
+  toJSON
+    (ServiceDefinition_key __field__name __field__functions
+       __field__structuredAnnotations __field__interactions)
+    = Aeson.object
+        ("name" .= __field__name :
+           "functions" .= __field__functions :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               "interactions" .= __field__interactions : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceDefinition_key where
+  buildStruct _proxy
+    (ServiceDefinition_key __field__name __field__functions
+       __field__structuredAnnotations __field__interactions)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "functions" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__functions)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               :
+               Thrift.genField _proxy "interactions" (Thrift.getListType _proxy) 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__interactions)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__functions <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            __field__interactions <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__functions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__interactions
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__functions <- ST.readSTRef __field__functions
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             !__val__interactions <- ST.readSTRef
+                                                                       __field__interactions
+                                             Prelude.pure
+                                               (ServiceDefinition_key __val__name __val__functions
+                                                  __val__structuredAnnotations
+                                                  __val__interactions)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("functions", 2), ("structuredAnnotations", 3),
+                     ("interactions", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceDefinition_key where
+  rnf
+    (ServiceDefinition_key __field__name __field__functions
+       __field__structuredAnnotations __field__interactions)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__functions `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq`
+            DeepSeq.rnf __field__interactions `Prelude.seq` ()
+
+instance Default.Default ServiceDefinition_key where
+  def
+    = ServiceDefinition_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable ServiceDefinition_key where
+  hashWithSalt __salt
+    (ServiceDefinition_key _name _functions _structuredAnnotations
+       _interactions)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _functions)
+           _structuredAnnotations)
+        _interactions
+
+data ServiceChild_key = ServiceChild_key{serviceChild_key_parent ::
+                                         ServiceName,
+                                         serviceChild_key_child :: ServiceName}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceChild_key where
+  toJSON (ServiceChild_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceChild_key where
+  buildStruct _proxy
+    (ServiceChild_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ServiceChild_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceChild_key where
+  rnf (ServiceChild_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ServiceChild_key where
+  def = ServiceChild_key Default.def Default.def
+
+instance Hashable.Hashable ServiceChild_key where
+  hashWithSalt __salt (ServiceChild_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Identifier,
+                                         searchByName_key_qname :: QualName}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__qname)
+    = Aeson.object
+        ("name" .= __field__name :
+           "qname" .= __field__qname : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__qname)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__qname)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__qname <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__qname <- ST.readSTRef __field__qname
+                                             Prelude.pure
+                                               (SearchByName_key __val__name __val__qname)
+              _idMap = HashMap.fromList [("name", 1), ("qname", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__qname)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__qname `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _qname)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _qname
+
+data ResultSink = ResultSink{resultSink_type_ :: TypeSpecification,
+                             resultSink_firstResponse :: Prelude.Maybe TypeSpecification,
+                             resultSink_finalResponse :: Prelude.Maybe TypeSpecification}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResultSink where
+  toJSON
+    (ResultSink __field__type_ __field__firstResponse
+       __field__finalResponse)
+    = Aeson.object
+        ("type_" .= __field__type_ :
+           Prelude.maybe Prelude.id ((:) . ("firstResponse" .=))
+             __field__firstResponse
+             (Prelude.maybe Prelude.id ((:) . ("finalResponse" .=))
+                __field__finalResponse
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct ResultSink where
+  buildStruct _proxy
+    (ResultSink __field__type_ __field__firstResponse
+       __field__finalResponse)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type_)
+           :
+           let (__cereal__firstResponse, __id__firstResponse)
+                 = case __field__firstResponse of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "firstResponse"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__firstResponse
+               (case __field__finalResponse of
+                  Prelude.Just _val -> Thrift.genField _proxy "finalResponse"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__firstResponse
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type_ <- ST.newSTRef Default.def
+            __field__firstResponse <- ST.newSTRef Prelude.Nothing
+            __field__finalResponse <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__firstResponse
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__finalResponse
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__firstResponse <- ST.readSTRef
+                                                                        __field__firstResponse
+                                             !__val__finalResponse <- ST.readSTRef
+                                                                        __field__finalResponse
+                                             Prelude.pure
+                                               (ResultSink __val__type_ __val__firstResponse
+                                                  __val__finalResponse)
+              _idMap
+                = HashMap.fromList
+                    [("type_", 1), ("firstResponse", 2), ("finalResponse", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ResultSink where
+  rnf
+    (ResultSink __field__type_ __field__firstResponse
+       __field__finalResponse)
+    = DeepSeq.rnf __field__type_ `Prelude.seq`
+        DeepSeq.rnf __field__firstResponse `Prelude.seq`
+          DeepSeq.rnf __field__finalResponse `Prelude.seq` ()
+
+instance Default.Default ResultSink where
+  def = ResultSink Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ResultSink where
+  hashWithSalt __salt
+    (ResultSink _type_ _firstResponse _finalResponse)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type_)
+           _firstResponse)
+        _finalResponse
+
+data Qualifier = Qualifier_default_
+               | Qualifier_optional_
+               | Qualifier_required_
+               | Qualifier__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Qualifier where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Qualifier where
+  rnf __Qualifier = Prelude.seq __Qualifier ()
+
+instance Default.Default Qualifier where
+  def = Qualifier_default_
+
+instance Hashable.Hashable Qualifier where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Qualifier where
+  toThriftEnum 0 = Qualifier_default_
+  toThriftEnum 1 = Qualifier_optional_
+  toThriftEnum 2 = Qualifier_required_
+  toThriftEnum val = Qualifier__UNKNOWN val
+  fromThriftEnum Qualifier_default_ = 0
+  fromThriftEnum Qualifier_optional_ = 1
+  fromThriftEnum Qualifier_required_ = 2
+  fromThriftEnum (Qualifier__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Qualifier_default_, Qualifier_optional_, Qualifier_required_]
+  toThriftEnumEither 0 = Prelude.Right Qualifier_default_
+  toThriftEnumEither 1 = Prelude.Right Qualifier_optional_
+  toThriftEnumEither 2 = Prelude.Right Qualifier_required_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Qualifier: "
+           ++ Prelude.show val)
+
+data QualName_key = QualName_key{qualName_key_file :: File,
+                                 qualName_key_name :: Identifier}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QualName_key where
+  toJSON (QualName_key __field__file __field__name)
+    = Aeson.object
+        ("file" .= __field__file :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct QualName_key where
+  buildStruct _proxy (QualName_key __field__file __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (QualName_key __val__file __val__name)
+              _idMap = HashMap.fromList [("file", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QualName_key where
+  rnf (QualName_key __field__file __field__name)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default QualName_key where
+  def = QualName_key Default.def Default.def
+
+instance Hashable.Hashable QualName_key where
+  hashWithSalt __salt (QualName_key _file _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _name
+
+data PrimitiveType = PrimitiveType_bool_
+                   | PrimitiveType_byte_
+                   | PrimitiveType_i16_
+                   | PrimitiveType_i32_
+                   | PrimitiveType_i64_
+                   | PrimitiveType_float_
+                   | PrimitiveType_double_
+                   | PrimitiveType_binary_
+                   | PrimitiveType_string_
+                   | PrimitiveType__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PrimitiveType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData PrimitiveType where
+  rnf __PrimitiveType = Prelude.seq __PrimitiveType ()
+
+instance Default.Default PrimitiveType where
+  def = PrimitiveType_bool_
+
+instance Hashable.Hashable PrimitiveType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum PrimitiveType where
+  toThriftEnum 0 = PrimitiveType_bool_
+  toThriftEnum 1 = PrimitiveType_byte_
+  toThriftEnum 2 = PrimitiveType_i16_
+  toThriftEnum 3 = PrimitiveType_i32_
+  toThriftEnum 4 = PrimitiveType_i64_
+  toThriftEnum 5 = PrimitiveType_float_
+  toThriftEnum 6 = PrimitiveType_double_
+  toThriftEnum 7 = PrimitiveType_binary_
+  toThriftEnum 8 = PrimitiveType_string_
+  toThriftEnum val = PrimitiveType__UNKNOWN val
+  fromThriftEnum PrimitiveType_bool_ = 0
+  fromThriftEnum PrimitiveType_byte_ = 1
+  fromThriftEnum PrimitiveType_i16_ = 2
+  fromThriftEnum PrimitiveType_i32_ = 3
+  fromThriftEnum PrimitiveType_i64_ = 4
+  fromThriftEnum PrimitiveType_float_ = 5
+  fromThriftEnum PrimitiveType_double_ = 6
+  fromThriftEnum PrimitiveType_binary_ = 7
+  fromThriftEnum PrimitiveType_string_ = 8
+  fromThriftEnum (PrimitiveType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [PrimitiveType_bool_, PrimitiveType_byte_, PrimitiveType_i16_,
+       PrimitiveType_i32_, PrimitiveType_i64_, PrimitiveType_float_,
+       PrimitiveType_double_, PrimitiveType_binary_,
+       PrimitiveType_string_]
+  toThriftEnumEither 0 = Prelude.Right PrimitiveType_bool_
+  toThriftEnumEither 1 = Prelude.Right PrimitiveType_byte_
+  toThriftEnumEither 2 = Prelude.Right PrimitiveType_i16_
+  toThriftEnumEither 3 = Prelude.Right PrimitiveType_i32_
+  toThriftEnumEither 4 = Prelude.Right PrimitiveType_i64_
+  toThriftEnumEither 5 = Prelude.Right PrimitiveType_float_
+  toThriftEnumEither 6 = Prelude.Right PrimitiveType_double_
+  toThriftEnumEither 7 = Prelude.Right PrimitiveType_binary_
+  toThriftEnumEither 8 = Prelude.Right PrimitiveType_string_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum PrimitiveType: "
+           ++ Prelude.show val)
+
+data Package_key = Package_key{package_key_target :: File,
+                               package_key_name :: PackageName}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Package_key where
+  toJSON (Package_key __field__target __field__name)
+    = Aeson.object
+        ("target" .= __field__target :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Package_key where
+  buildStruct _proxy (Package_key __field__target __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Package_key __val__target __val__name)
+              _idMap = HashMap.fromList [("target", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Package_key where
+  rnf (Package_key __field__target __field__name)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Package_key where
+  def = Package_key Default.def Default.def
+
+instance Hashable.Hashable Package_key where
+  hashWithSalt __salt (Package_key _target _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _name
+
+data Namespace_key = Namespace_key{namespace_key_target :: File,
+                                   namespace_key_name :: NamespaceName,
+                                   namespace_key_namespace_ :: NamespaceValue,
+                                   namespace_key_quoted :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Namespace_key where
+  toJSON
+    (Namespace_key __field__target __field__name __field__namespace_
+       __field__quoted)
+    = Aeson.object
+        ("target" .= __field__target :
+           "name" .= __field__name :
+             "namespace_" .= __field__namespace_ :
+               "quoted" .= __field__quoted : Prelude.mempty)
+
+instance Thrift.ThriftStruct Namespace_key where
+  buildStruct _proxy
+    (Namespace_key __field__target __field__name __field__namespace_
+       __field__quoted)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__namespace_)
+               : Thrift.genFieldBool _proxy "quoted" 4 3 __field__quoted : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Default.def
+            __field__quoted <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__quoted
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__quoted <- ST.readSTRef __field__quoted
+                                             Prelude.pure
+                                               (Namespace_key __val__target __val__name
+                                                  __val__namespace_
+                                                  __val__quoted)
+              _idMap
+                = HashMap.fromList
+                    [("target", 1), ("name", 2), ("namespace_", 3), ("quoted", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Namespace_key where
+  rnf
+    (Namespace_key __field__target __field__name __field__namespace_
+       __field__quoted)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__namespace_ `Prelude.seq`
+            DeepSeq.rnf __field__quoted `Prelude.seq` ()
+
+instance Default.Default Namespace_key where
+  def
+    = Namespace_key Default.def Default.def Default.def Prelude.False
+
+instance Hashable.Hashable Namespace_key where
+  hashWithSalt __salt
+    (Namespace_key _target _name _namespace_ _quoted)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+              _name)
+           _namespace_)
+        _quoted
+
+data NamedKind = NamedKind_typedef_
+               | NamedKind_enum_
+               | NamedKind_struct_
+               | NamedKind_union_
+               | NamedKind__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamedKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData NamedKind where
+  rnf __NamedKind = Prelude.seq __NamedKind ()
+
+instance Default.Default NamedKind where
+  def = NamedKind_typedef_
+
+instance Hashable.Hashable NamedKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum NamedKind where
+  toThriftEnum 0 = NamedKind_typedef_
+  toThriftEnum 1 = NamedKind_enum_
+  toThriftEnum 2 = NamedKind_struct_
+  toThriftEnum 3 = NamedKind_union_
+  toThriftEnum val = NamedKind__UNKNOWN val
+  fromThriftEnum NamedKind_typedef_ = 0
+  fromThriftEnum NamedKind_enum_ = 1
+  fromThriftEnum NamedKind_struct_ = 2
+  fromThriftEnum NamedKind_union_ = 3
+  fromThriftEnum (NamedKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [NamedKind_typedef_, NamedKind_enum_, NamedKind_struct_,
+       NamedKind_union_]
+  toThriftEnumEither 0 = Prelude.Right NamedKind_typedef_
+  toThriftEnumEither 1 = Prelude.Right NamedKind_enum_
+  toThriftEnumEither 2 = Prelude.Right NamedKind_struct_
+  toThriftEnumEither 3 = Prelude.Right NamedKind_union_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum NamedKind: "
+           ++ Prelude.show val)
+
+data NamedType = NamedType{namedType_name :: QualName,
+                           namedType_kind :: NamedKind}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamedType where
+  toJSON (NamedType __field__name __field__kind)
+    = Aeson.object
+        ("name" .= __field__name :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamedType where
+  buildStruct _proxy (NamedType __field__name __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "NamedKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (NamedType __val__name __val__kind)
+              _idMap = HashMap.fromList [("name", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamedType where
+  rnf (NamedType __field__name __field__kind)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default NamedType where
+  def = NamedType Default.def Default.def
+
+instance Hashable.Hashable NamedType where
+  hashWithSalt __salt (NamedType _name _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind
+
+newtype NamedDecl_key = NamedDecl_key{namedDecl_key_name ::
+                                      NamedType}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamedDecl_key where
+  toJSON (NamedDecl_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamedDecl_key where
+  buildStruct _proxy (NamedDecl_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (NamedDecl_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData NamedDecl_key where
+  rnf (NamedDecl_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NamedDecl_key where
+  def = NamedDecl_key Default.def
+
+instance Hashable.Hashable NamedDecl_key where
+  hashWithSalt __salt (NamedDecl_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameStr
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Identifier}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameStr __field__name)
+    = Aeson.object
+        ("nameStr" .= __field__nameStr :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameStr __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameStr" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__nameStr)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameStr <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameStr
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameStr <- ST.readSTRef
+                                                                  __field__nameStr
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameStr __val__name)
+              _idMap = HashMap.fromList [("nameStr", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameStr __field__name)
+    = DeepSeq.rnf __field__nameStr `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameStr _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _nameStr)
+        _name
+
+data MapType = MapType{mapType_key_ :: TypeSpecification,
+                       mapType_value :: TypeSpecification}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MapType where
+  toJSON (MapType __field__key_ __field__value)
+    = Aeson.object
+        ("key_" .= __field__key_ :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct MapType where
+  buildStruct _proxy (MapType __field__key_ __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__key_)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key_ <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key_ <- ST.readSTRef __field__key_
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (MapType __val__key_ __val__value)
+              _idMap = HashMap.fromList [("key_", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MapType where
+  rnf (MapType __field__key_ __field__value)
+    = DeepSeq.rnf __field__key_ `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default MapType where
+  def = MapType Default.def Default.def
+
+instance Hashable.Hashable MapType where
+  hashWithSalt __salt (MapType _key_ _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key_) _value
+
+data Loc = Loc{loc_startLine :: Glean.Nat,
+               loc_startCol :: Glean.Nat, loc_endLine :: Glean.Nat,
+               loc_endCol :: Glean.Nat}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Loc where
+  toJSON
+    (Loc __field__startLine __field__startCol __field__endLine
+       __field__endCol)
+    = Aeson.object
+        ("startLine" .= Glean.unNat __field__startLine :
+           "startCol" .= Glean.unNat __field__startCol :
+             "endLine" .= Glean.unNat __field__endLine :
+               "endCol" .= Glean.unNat __field__endCol : Prelude.mempty)
+
+instance Thrift.ThriftStruct Loc where
+  buildStruct _proxy
+    (Loc __field__startLine __field__startCol __field__endLine
+       __field__endCol)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "startLine" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__startLine)
+           :
+           Thrift.genField _proxy "startCol" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__startCol)
+             :
+             Thrift.genField _proxy "endLine" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__endLine)
+               :
+               Thrift.genField _proxy "endCol" (Thrift.getI64Type _proxy) 4 3
+                 ((Thrift.genI64 _proxy . Glean.unNat) __field__endCol)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__startLine <- ST.newSTRef (Glean.Nat Default.def)
+            __field__startCol <- ST.newSTRef (Glean.Nat Default.def)
+            __field__endLine <- ST.newSTRef (Glean.Nat Default.def)
+            __field__endCol <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__startLine
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__startCol
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__endLine
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__endCol
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__startLine <- ST.readSTRef
+                                                                    __field__startLine
+                                             !__val__startCol <- ST.readSTRef __field__startCol
+                                             !__val__endLine <- ST.readSTRef __field__endLine
+                                             !__val__endCol <- ST.readSTRef __field__endCol
+                                             Prelude.pure
+                                               (Loc __val__startLine __val__startCol __val__endLine
+                                                  __val__endCol)
+              _idMap
+                = HashMap.fromList
+                    [("startLine", 1), ("startCol", 2), ("endLine", 3), ("endCol", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Loc where
+  rnf
+    (Loc __field__startLine __field__startCol __field__endLine
+       __field__endCol)
+    = DeepSeq.rnf __field__startLine `Prelude.seq`
+        DeepSeq.rnf __field__startCol `Prelude.seq`
+          DeepSeq.rnf __field__endLine `Prelude.seq`
+            DeepSeq.rnf __field__endCol `Prelude.seq` ()
+
+instance Default.Default Loc where
+  def
+    = Loc (Glean.Nat Default.def) (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+
+instance Hashable.Hashable Loc where
+  hashWithSalt __salt (Loc _startLine _startCol _endLine _endCol)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _startLine)
+              _startCol)
+           _endLine)
+        _endCol
+
+data XRef = XRef{xRef_locRef :: Loc, xRef_target :: XRefTarget}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__locRef __field__target)
+    = Aeson.object
+        ("locRef" .= __field__locRef :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__locRef __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "locRef" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__locRef)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__locRef <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__locRef
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__locRef <- ST.readSTRef
+                                                                 __field__locRef
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure (XRef __val__locRef __val__target)
+              _idMap = HashMap.fromList [("locRef", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__locRef __field__target)
+    = DeepSeq.rnf __field__locRef `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _locRef _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _locRef)
+        _target
+
+data KeyValue = KeyValue{keyValue_key :: TypedConst,
+                         keyValue_value :: TypedConst}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KeyValue where
+  toJSON (KeyValue __field__key __field__value)
+    = Aeson.object
+        ("key" .= __field__key :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct KeyValue where
+  buildStruct _proxy (KeyValue __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__key)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (KeyValue __val__key __val__value)
+              _idMap = HashMap.fromList [("key", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KeyValue where
+  rnf (KeyValue __field__key __field__value)
+    = DeepSeq.rnf __field__key `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default KeyValue where
+  def = KeyValue Default.def Default.def
+
+instance Hashable.Hashable KeyValue where
+  hashWithSalt __salt (KeyValue _key _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key) _value
+
+newtype InteractionName_key = InteractionName_key{interactionName_key_name
+                                                  :: QualName}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InteractionName_key where
+  toJSON (InteractionName_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct InteractionName_key where
+  buildStruct _proxy (InteractionName_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (InteractionName_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData InteractionName_key where
+  rnf (InteractionName_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default InteractionName_key where
+  def = InteractionName_key Default.def
+
+instance Hashable.Hashable InteractionName_key where
+  hashWithSalt __salt (InteractionName_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data InteractionDefinition_key = InteractionDefinition_key{interactionDefinition_key_name
+                                                           :: InteractionName,
+                                                           interactionDefinition_key_functions ::
+                                                           [FunctionSpecification],
+                                                           interactionDefinition_key_structuredAnnotations
+                                                           :: [StructuredAnnotation]}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InteractionDefinition_key where
+  toJSON
+    (InteractionDefinition_key __field__name __field__functions
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "functions" .= __field__functions :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct InteractionDefinition_key where
+  buildStruct _proxy
+    (InteractionDefinition_key __field__name __field__functions
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "functions" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__functions)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__functions <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__functions
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__functions <- ST.readSTRef __field__functions
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (InteractionDefinition_key __val__name
+                                                  __val__functions
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("functions", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData InteractionDefinition_key where
+  rnf
+    (InteractionDefinition_key __field__name __field__functions
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__functions `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default InteractionDefinition_key where
+  def = InteractionDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable InteractionDefinition_key where
+  hashWithSalt __salt
+    (InteractionDefinition_key _name _functions _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _functions)
+        _structuredAnnotations
+
+data IntegerLiteral = IntegerLiteral{integerLiteral_isNonNegative
+                                     :: Prelude.Bool,
+                                     integerLiteral_absValue :: Glean.Nat}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IntegerLiteral where
+  toJSON (IntegerLiteral __field__isNonNegative __field__absValue)
+    = Aeson.object
+        ("isNonNegative" .= __field__isNonNegative :
+           "absValue" .= Glean.unNat __field__absValue : Prelude.mempty)
+
+instance Thrift.ThriftStruct IntegerLiteral where
+  buildStruct _proxy
+    (IntegerLiteral __field__isNonNegative __field__absValue)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "isNonNegative" 1 0
+           __field__isNonNegative
+           :
+           Thrift.genField _proxy "absValue" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__absValue)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__isNonNegative <- ST.newSTRef Prelude.False
+            __field__absValue <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isNonNegative
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__absValue
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__isNonNegative <- ST.readSTRef
+                                                                        __field__isNonNegative
+                                             !__val__absValue <- ST.readSTRef __field__absValue
+                                             Prelude.pure
+                                               (IntegerLiteral __val__isNonNegative __val__absValue)
+              _idMap = HashMap.fromList [("isNonNegative", 1), ("absValue", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IntegerLiteral where
+  rnf (IntegerLiteral __field__isNonNegative __field__absValue)
+    = DeepSeq.rnf __field__isNonNegative `Prelude.seq`
+        DeepSeq.rnf __field__absValue `Prelude.seq` ()
+
+instance Default.Default IntegerLiteral where
+  def = IntegerLiteral Prelude.False (Glean.Nat Default.def)
+
+instance Hashable.Hashable IntegerLiteral where
+  hashWithSalt __salt (IntegerLiteral _isNonNegative _absValue)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _isNonNegative)
+        _absValue
+
+data FunctionName_key = FunctionName_key{functionName_key_service_
+                                         :: ServiceName,
+                                         functionName_key_name :: Identifier}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionName_key where
+  toJSON (FunctionName_key __field__service_ __field__name)
+    = Aeson.object
+        ("service_" .= __field__service_ :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionName_key where
+  buildStruct _proxy
+    (FunctionName_key __field__service_ __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "service_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__service_)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__service_ <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__service_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__service_ <- ST.readSTRef
+                                                                   __field__service_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FunctionName_key __val__service_ __val__name)
+              _idMap = HashMap.fromList [("service_", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionName_key where
+  rnf (FunctionName_key __field__service_ __field__name)
+    = DeepSeq.rnf __field__service_ `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionName_key where
+  def = FunctionName_key Default.def Default.def
+
+instance Hashable.Hashable FunctionName_key where
+  hashWithSalt __salt (FunctionName_key _service_ _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _service_)
+        _name
+
+data FloatLiteral = FloatLiteral{floatLiteral_isNaN ::
+                                 Prelude.Bool,
+                                 floatLiteral_isPositive :: Prelude.Bool,
+                                 floatLiteral_exponent :: Glean.Nat,
+                                 floatLiteral_significand :: Glean.Nat}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FloatLiteral where
+  toJSON
+    (FloatLiteral __field__isNaN __field__isPositive __field__exponent
+       __field__significand)
+    = Aeson.object
+        ("isNaN" .= __field__isNaN :
+           "isPositive" .= __field__isPositive :
+             "exponent" .= Glean.unNat __field__exponent :
+               "significand" .= Glean.unNat __field__significand : Prelude.mempty)
+
+instance Thrift.ThriftStruct FloatLiteral where
+  buildStruct _proxy
+    (FloatLiteral __field__isNaN __field__isPositive __field__exponent
+       __field__significand)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "isNaN" 1 0 __field__isNaN :
+           Thrift.genFieldBool _proxy "isPositive" 2 1 __field__isPositive :
+             Thrift.genField _proxy "exponent" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__exponent)
+               :
+               Thrift.genField _proxy "significand" (Thrift.getI64Type _proxy) 4 3
+                 ((Thrift.genI64 _proxy . Glean.unNat) __field__significand)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__isNaN <- ST.newSTRef Prelude.False
+            __field__isPositive <- ST.newSTRef Prelude.False
+            __field__exponent <- ST.newSTRef (Glean.Nat Default.def)
+            __field__significand <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__isNaN
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isPositive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__exponent
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__significand
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__isNaN <- ST.readSTRef __field__isNaN
+                                             !__val__isPositive <- ST.readSTRef __field__isPositive
+                                             !__val__exponent <- ST.readSTRef __field__exponent
+                                             !__val__significand <- ST.readSTRef
+                                                                      __field__significand
+                                             Prelude.pure
+                                               (FloatLiteral __val__isNaN __val__isPositive
+                                                  __val__exponent
+                                                  __val__significand)
+              _idMap
+                = HashMap.fromList
+                    [("isNaN", 1), ("isPositive", 2), ("exponent", 3),
+                     ("significand", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FloatLiteral where
+  rnf
+    (FloatLiteral __field__isNaN __field__isPositive __field__exponent
+       __field__significand)
+    = DeepSeq.rnf __field__isNaN `Prelude.seq`
+        DeepSeq.rnf __field__isPositive `Prelude.seq`
+          DeepSeq.rnf __field__exponent `Prelude.seq`
+            DeepSeq.rnf __field__significand `Prelude.seq` ()
+
+instance Default.Default FloatLiteral where
+  def
+    = FloatLiteral Prelude.False Prelude.False (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+
+instance Hashable.Hashable FloatLiteral where
+  hashWithSalt __salt
+    (FloatLiteral _isNaN _isPositive _exponent _significand)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _isNaN)
+              _isPositive)
+           _exponent)
+        _significand
+
+data Literal_key = Literal_key_byte_ IntegerLiteral
+                 | Literal_key_i16_ IntegerLiteral
+                 | Literal_key_i32_ IntegerLiteral
+                 | Literal_key_i64_ IntegerLiteral
+                 | Literal_key_float_ FloatLiteral
+                 | Literal_key_double_ FloatLiteral
+                 | Literal_key_bool_ Prelude.Bool
+                 | Literal_key_string_ Text.Text
+                 | Literal_key_binary_ ByteString.ByteString
+                 | Literal_key_set_ [TypedConst]
+                 | Literal_key_list_ [TypedConst]
+                 | Literal_key_map_ [KeyValue]
+                 | Literal_key_newtype_ Literal
+                 | Literal_key_struct_ StructVal
+                 | Literal_key_exception_ ExceptionVal
+                 | Literal_key_union_ UnionVal
+                 | Literal_key_enum_ EnumVal
+                 | Literal_key_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Literal_key where
+  toJSON (Literal_key_byte_ __byte_)
+    = Aeson.object ["byte_" .= __byte_]
+  toJSON (Literal_key_i16_ __i16_) = Aeson.object ["i16_" .= __i16_]
+  toJSON (Literal_key_i32_ __i32_) = Aeson.object ["i32_" .= __i32_]
+  toJSON (Literal_key_i64_ __i64_) = Aeson.object ["i64_" .= __i64_]
+  toJSON (Literal_key_float_ __float_)
+    = Aeson.object ["float_" .= __float_]
+  toJSON (Literal_key_double_ __double_)
+    = Aeson.object ["double_" .= __double_]
+  toJSON (Literal_key_bool_ __bool_)
+    = Aeson.object ["bool_" .= __bool_]
+  toJSON (Literal_key_string_ __string_)
+    = Aeson.object ["string_" .= __string_]
+  toJSON (Literal_key_binary_ __binary_)
+    = Aeson.object ["binary_" .= Thrift.encodeBase64Text __binary_]
+  toJSON (Literal_key_set_ __set_) = Aeson.object ["set_" .= __set_]
+  toJSON (Literal_key_list_ __list_)
+    = Aeson.object ["list_" .= __list_]
+  toJSON (Literal_key_map_ __map_) = Aeson.object ["map_" .= __map_]
+  toJSON (Literal_key_newtype_ __newtype_)
+    = Aeson.object ["newtype_" .= __newtype_]
+  toJSON (Literal_key_struct_ __struct_)
+    = Aeson.object ["struct_" .= __struct_]
+  toJSON (Literal_key_exception_ __exception_)
+    = Aeson.object ["exception_" .= __exception_]
+  toJSON (Literal_key_union_ __union_)
+    = Aeson.object ["union_" .= __union_]
+  toJSON (Literal_key_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON Literal_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Literal_key where
+  buildStruct _proxy (Literal_key_byte_ __byte_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "byte_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __byte_)]
+  buildStruct _proxy (Literal_key_i16_ __i16_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "i16_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __i16_)]
+  buildStruct _proxy (Literal_key_i32_ __i32_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "i32_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __i32_)]
+  buildStruct _proxy (Literal_key_i64_ __i64_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "i64_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __i64_)]
+  buildStruct _proxy (Literal_key_float_ __float_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "float_" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __float_)]
+  buildStruct _proxy (Literal_key_double_ __double_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "double_" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __double_)]
+  buildStruct _proxy (Literal_key_bool_ __bool_)
+    = Thrift.genStruct _proxy
+        [Thrift.genFieldBool _proxy "bool_" 7 0 __bool_]
+  buildStruct _proxy (Literal_key_string_ __string_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 8 0
+           (Thrift.genText _proxy __string_)]
+  buildStruct _proxy (Literal_key_binary_ __binary_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "binary_" (Thrift.getStringType _proxy) 9 0
+           (Thrift.genBytes _proxy __binary_)]
+  buildStruct _proxy (Literal_key_set_ __set_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "set_" (Thrift.getListType _proxy) 10 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __set_)]
+  buildStruct _proxy (Literal_key_list_ __list_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "list_" (Thrift.getListType _proxy) 11 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __list_)]
+  buildStruct _proxy (Literal_key_map_ __map_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "map_" (Thrift.getListType _proxy) 12 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __map_)]
+  buildStruct _proxy (Literal_key_newtype_ __newtype_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "newtype_" (Thrift.getStructType _proxy) 13
+           0
+           (Thrift.buildStruct _proxy __newtype_)]
+  buildStruct _proxy (Literal_key_struct_ __struct_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "struct_" (Thrift.getStructType _proxy) 14
+           0
+           (Thrift.buildStruct _proxy __struct_)]
+  buildStruct _proxy (Literal_key_exception_ __exception_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "exception_" (Thrift.getStructType _proxy)
+           15
+           0
+           (Thrift.buildStruct _proxy __exception_)]
+  buildStruct _proxy (Literal_key_union_ __union_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "union_" (Thrift.getStructType _proxy) 16 0
+           (Thrift.buildStruct _proxy __union_)]
+  buildStruct _proxy (Literal_key_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 17 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy Literal_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_byte_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_i16_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_i32_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_i64_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_float_ _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Literal_key_double_ _val)
+                                                     7 | _type == Thrift.getBoolType _proxy ->
+                                                         do _val <- Thrift.parseBoolF _proxy _bool
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Literal_key_bool_ _val)
+                                                     8 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Literal_key_string_ _val)
+                                                     9 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseBytes _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Literal_key_binary_ _val)
+                                                     10 | _type == Thrift.getListType _proxy ->
+                                                          do _val <- Prelude.snd <$>
+                                                                       Thrift.parseList _proxy
+                                                                         (Thrift.parseStruct _proxy)
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Literal_key_set_ _val)
+                                                     11 | _type == Thrift.getListType _proxy ->
+                                                          do _val <- Prelude.snd <$>
+                                                                       Thrift.parseList _proxy
+                                                                         (Thrift.parseStruct _proxy)
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Literal_key_list_ _val)
+                                                     12 | _type == Thrift.getListType _proxy ->
+                                                          do _val <- Prelude.snd <$>
+                                                                       Thrift.parseList _proxy
+                                                                         (Thrift.parseStruct _proxy)
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Literal_key_map_ _val)
+                                                     13 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Literal_key_newtype_ _val)
+                                                     14 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Literal_key_struct_ _val)
+                                                     15 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Literal_key_exception_ _val)
+                                                     16 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Literal_key_union_ _val)
+                                                     17 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Literal_key_enum_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Literal_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Literal_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("byte_", 1), ("i16_", 2), ("i32_", 3), ("i64_", 4),
+             ("float_", 5), ("double_", 6), ("bool_", 7), ("string_", 8),
+             ("binary_", 9), ("set_", 10), ("list_", 11), ("map_", 12),
+             ("newtype_", 13), ("struct_", 14), ("exception_", 15),
+             ("union_", 16), ("enum_", 17)]
+
+instance DeepSeq.NFData Literal_key where
+  rnf (Literal_key_byte_ __byte_) = DeepSeq.rnf __byte_
+  rnf (Literal_key_i16_ __i16_) = DeepSeq.rnf __i16_
+  rnf (Literal_key_i32_ __i32_) = DeepSeq.rnf __i32_
+  rnf (Literal_key_i64_ __i64_) = DeepSeq.rnf __i64_
+  rnf (Literal_key_float_ __float_) = DeepSeq.rnf __float_
+  rnf (Literal_key_double_ __double_) = DeepSeq.rnf __double_
+  rnf (Literal_key_bool_ __bool_) = DeepSeq.rnf __bool_
+  rnf (Literal_key_string_ __string_) = DeepSeq.rnf __string_
+  rnf (Literal_key_binary_ __binary_) = DeepSeq.rnf __binary_
+  rnf (Literal_key_set_ __set_) = DeepSeq.rnf __set_
+  rnf (Literal_key_list_ __list_) = DeepSeq.rnf __list_
+  rnf (Literal_key_map_ __map_) = DeepSeq.rnf __map_
+  rnf (Literal_key_newtype_ __newtype_) = DeepSeq.rnf __newtype_
+  rnf (Literal_key_struct_ __struct_) = DeepSeq.rnf __struct_
+  rnf (Literal_key_exception_ __exception_)
+    = DeepSeq.rnf __exception_
+  rnf (Literal_key_union_ __union_) = DeepSeq.rnf __union_
+  rnf (Literal_key_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf Literal_key_EMPTY = ()
+
+instance Default.Default Literal_key where
+  def = Literal_key_EMPTY
+
+instance Hashable.Hashable Literal_key where
+  hashWithSalt __salt (Literal_key_byte_ _byte_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _byte_)
+  hashWithSalt __salt (Literal_key_i16_ _i16_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _i16_)
+  hashWithSalt __salt (Literal_key_i32_ _i32_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _i32_)
+  hashWithSalt __salt (Literal_key_i64_ _i64_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _i64_)
+  hashWithSalt __salt (Literal_key_float_ _float_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _float_)
+  hashWithSalt __salt (Literal_key_double_ _double_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _double_)
+  hashWithSalt __salt (Literal_key_bool_ _bool_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _bool_)
+  hashWithSalt __salt (Literal_key_string_ _string_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _string_)
+  hashWithSalt __salt (Literal_key_binary_ _binary_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _binary_)
+  hashWithSalt __salt (Literal_key_set_ _set_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _set_)
+  hashWithSalt __salt (Literal_key_list_ _list_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _list_)
+  hashWithSalt __salt (Literal_key_map_ _map_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _map_)
+  hashWithSalt __salt (Literal_key_newtype_ _newtype_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 13 _newtype_)
+  hashWithSalt __salt (Literal_key_struct_ _struct_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 14 _struct_)
+  hashWithSalt __salt (Literal_key_exception_ _exception_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 15 _exception_)
+  hashWithSalt __salt (Literal_key_union_ _union_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 16 _union_)
+  hashWithSalt __salt (Literal_key_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 17 _enum_)
+  hashWithSalt __salt Literal_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file :: File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data FieldKind = FieldKind_struct_
+               | FieldKind_union_
+               | FieldKind_exception_
+               | FieldKind__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData FieldKind where
+  rnf __FieldKind = Prelude.seq __FieldKind ()
+
+instance Default.Default FieldKind where
+  def = FieldKind_struct_
+
+instance Hashable.Hashable FieldKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum FieldKind where
+  toThriftEnum 0 = FieldKind_struct_
+  toThriftEnum 1 = FieldKind_union_
+  toThriftEnum 2 = FieldKind_exception_
+  toThriftEnum val = FieldKind__UNKNOWN val
+  fromThriftEnum FieldKind_struct_ = 0
+  fromThriftEnum FieldKind_union_ = 1
+  fromThriftEnum FieldKind_exception_ = 2
+  fromThriftEnum (FieldKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [FieldKind_struct_, FieldKind_union_, FieldKind_exception_]
+  toThriftEnumEither 0 = Prelude.Right FieldKind_struct_
+  toThriftEnumEither 1 = Prelude.Right FieldKind_union_
+  toThriftEnumEither 2 = Prelude.Right FieldKind_exception_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum FieldKind: "
+           ++ Prelude.show val)
+
+type FieldId = IntegerLiteral
+
+data FieldSpecification = FieldSpecification{fieldSpecification_id
+                                             :: FieldId,
+                                             fieldSpecification_qualifier :: Qualifier,
+                                             fieldSpecification_type_ :: TypeSpecification,
+                                             fieldSpecification_name :: Identifier,
+                                             fieldSpecification_value :: Prelude.Maybe TypedConst,
+                                             fieldSpecification_structuredAnnotations ::
+                                             [StructuredAnnotation]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldSpecification where
+  toJSON
+    (FieldSpecification __field__id __field__qualifier __field__type_
+       __field__name __field__value __field__structuredAnnotations)
+    = Aeson.object
+        ("id" .= __field__id :
+           "qualifier" .= __field__qualifier :
+             "type_" .= __field__type_ :
+               "name" .= __field__name :
+                 Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                   ("structuredAnnotations" .= __field__structuredAnnotations :
+                      Prelude.mempty))
+
+instance Thrift.ThriftStruct FieldSpecification where
+  buildStruct _proxy
+    (FieldSpecification __field__id __field__qualifier __field__type_
+       __field__name __field__value __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__id)
+           :
+           Thrift.genField _proxy "qualifier" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__qualifier)
+             :
+             Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__type_)
+               :
+               Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__name)
+                 :
+                 let (__cereal__value, __id__value)
+                       = case __field__value of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "value"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__value
+                     (Thrift.genField _proxy "structuredAnnotations"
+                        (Thrift.getListType _proxy)
+                        6
+                        __id__value
+                        (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                           (Thrift.buildStruct _proxy)
+                           __field__structuredAnnotations)
+                        : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__qualifier <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Prelude.Nothing
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Qualifier")
+                                                                        ST.writeSTRef
+                                                                          __field__qualifier
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__qualifier <- ST.readSTRef __field__qualifier
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (FieldSpecification __val__id __val__qualifier
+                                                  __val__type_
+                                                  __val__name
+                                                  __val__value
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("id", 1), ("qualifier", 2), ("type_", 3), ("name", 4),
+                     ("value", 5), ("structuredAnnotations", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldSpecification where
+  rnf
+    (FieldSpecification __field__id __field__qualifier __field__type_
+       __field__name __field__value __field__structuredAnnotations)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__qualifier `Prelude.seq`
+          DeepSeq.rnf __field__type_ `Prelude.seq`
+            DeepSeq.rnf __field__name `Prelude.seq`
+              DeepSeq.rnf __field__value `Prelude.seq`
+                DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default FieldSpecification where
+  def
+    = FieldSpecification Default.def Default.def Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FieldSpecification where
+  hashWithSalt __salt
+    (FieldSpecification _id _qualifier _type_ _name _value
+       _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id)
+                    _qualifier)
+                 _type_)
+              _name)
+           _value)
+        _structuredAnnotations
+
+data StructType_key = StructType_key{structType_key_name ::
+                                     QualName,
+                                     structType_key_fields :: [FieldSpecification],
+                                     structType_key_structuredAnnotations :: [StructuredAnnotation]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructType_key where
+  toJSON
+    (StructType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "fields" .= __field__fields :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct StructType_key where
+  buildStruct _proxy
+    (StructType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__fields)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (StructType_key __val__name __val__fields
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("fields", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData StructType_key where
+  rnf
+    (StructType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__fields `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default StructType_key where
+  def = StructType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable StructType_key where
+  hashWithSalt __salt
+    (StructType_key _name _fields _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _fields)
+        _structuredAnnotations
+
+data UnqualField = UnqualField{unqualField_id :: FieldId,
+                               unqualField_type_ :: TypeSpecification,
+                               unqualField_name :: Identifier,
+                               unqualField_structuredAnnotations :: [StructuredAnnotation]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnqualField where
+  toJSON
+    (UnqualField __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("id" .= __field__id :
+           "type_" .= __field__type_ :
+             "name" .= __field__name :
+               "structuredAnnotations" .= __field__structuredAnnotations :
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct UnqualField where
+  buildStruct _proxy
+    (UnqualField __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__id)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               :
+               Thrift.genField _proxy "structuredAnnotations"
+                 (Thrift.getListType _proxy)
+                 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__structuredAnnotations)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (UnqualField __val__id __val__type_ __val__name
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("id", 1), ("type_", 2), ("name", 3),
+                     ("structuredAnnotations", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData UnqualField where
+  rnf
+    (UnqualField __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default UnqualField where
+  def = UnqualField Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable UnqualField where
+  hashWithSalt __salt
+    (UnqualField _id _type_ _name _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _type_)
+           _name)
+        _structuredAnnotations
+
+data UnionType_key = UnionType_key{unionType_key_name :: QualName,
+                                   unionType_key_alts :: [UnqualField],
+                                   unionType_key_structuredAnnotations :: [StructuredAnnotation]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionType_key where
+  toJSON
+    (UnionType_key __field__name __field__alts
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "alts" .= __field__alts :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionType_key where
+  buildStruct _proxy
+    (UnionType_key __field__name __field__alts
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "alts" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__alts)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__alts <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__alts
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__alts <- ST.readSTRef __field__alts
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (UnionType_key __val__name __val__alts
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("alts", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionType_key where
+  rnf
+    (UnionType_key __field__name __field__alts
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__alts `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default UnionType_key where
+  def = UnionType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable UnionType_key where
+  hashWithSalt __salt
+    (UnionType_key _name _alts _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _alts)
+        _structuredAnnotations
+
+data FieldDecl_key = FieldDecl_key{fieldDecl_key_qname :: QualName,
+                                   fieldDecl_key_kind :: FieldKind,
+                                   fieldDecl_key_name :: Identifier}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDecl_key where
+  toJSON (FieldDecl_key __field__qname __field__kind __field__name)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "kind" .= __field__kind : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDecl_key where
+  buildStruct _proxy
+    (FieldDecl_key __field__qname __field__kind __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "FieldKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FieldDecl_key __val__qname __val__kind __val__name)
+              _idMap = HashMap.fromList [("qname", 1), ("kind", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDecl_key where
+  rnf (FieldDecl_key __field__qname __field__kind __field__name)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FieldDecl_key where
+  def = FieldDecl_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FieldDecl_key where
+  hashWithSalt __salt (FieldDecl_key _qname _kind _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _kind)
+        _name
+
+data ExceptionType_key = ExceptionType_key{exceptionType_key_name
+                                           :: QualName,
+                                           exceptionType_key_fields :: [FieldSpecification],
+                                           exceptionType_key_structuredAnnotations ::
+                                           [StructuredAnnotation]}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionType_key where
+  toJSON
+    (ExceptionType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "fields" .= __field__fields :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionType_key where
+  buildStruct _proxy
+    (ExceptionType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__fields)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (ExceptionType_key __val__name __val__fields
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("fields", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionType_key where
+  rnf
+    (ExceptionType_key __field__name __field__fields
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__fields `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default ExceptionType_key where
+  def = ExceptionType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ExceptionType_key where
+  hashWithSalt __salt
+    (ExceptionType_key _name _fields _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _fields)
+        _structuredAnnotations
+
+data ExceptionSpecName = ExceptionSpecName_simple ExceptionName
+                       | ExceptionSpecName_typedef_ TypeDefException
+                       | ExceptionSpecName_EMPTY
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionSpecName where
+  toJSON (ExceptionSpecName_simple __simple)
+    = Aeson.object ["simple" .= __simple]
+  toJSON (ExceptionSpecName_typedef_ __typedef_)
+    = Aeson.object ["typedef_" .= __typedef_]
+  toJSON ExceptionSpecName_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ExceptionSpecName where
+  buildStruct _proxy (ExceptionSpecName_simple __simple)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "simple" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __simple)]
+  buildStruct _proxy (ExceptionSpecName_typedef_ __typedef_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typedef_" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __typedef_)]
+  buildStruct _proxy ExceptionSpecName_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ExceptionSpecName_simple _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ExceptionSpecName_typedef_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ExceptionSpecName_EMPTY
+           Thrift.FieldEnd -> Prelude.return ExceptionSpecName_EMPTY
+    where
+      _idMap = HashMap.fromList [("simple", 1), ("typedef_", 2)]
+
+instance DeepSeq.NFData ExceptionSpecName where
+  rnf (ExceptionSpecName_simple __simple) = DeepSeq.rnf __simple
+  rnf (ExceptionSpecName_typedef_ __typedef_)
+    = DeepSeq.rnf __typedef_
+  rnf ExceptionSpecName_EMPTY = ()
+
+instance Default.Default ExceptionSpecName where
+  def = ExceptionSpecName_EMPTY
+
+instance Hashable.Hashable ExceptionSpecName where
+  hashWithSalt __salt (ExceptionSpecName_simple _simple)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _simple)
+  hashWithSalt __salt (ExceptionSpecName_typedef_ _typedef_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _typedef_)
+  hashWithSalt __salt ExceptionSpecName_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ExceptionSpecification = ExceptionSpecification{exceptionSpecification_id
+                                                     :: FieldId,
+                                                     exceptionSpecification_type_ ::
+                                                     ExceptionSpecName,
+                                                     exceptionSpecification_name :: Identifier,
+                                                     exceptionSpecification_structuredAnnotations ::
+                                                     [StructuredAnnotation]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionSpecification where
+  toJSON
+    (ExceptionSpecification __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("id" .= __field__id :
+           "type_" .= __field__type_ :
+             "name" .= __field__name :
+               "structuredAnnotations" .= __field__structuredAnnotations :
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionSpecification where
+  buildStruct _proxy
+    (ExceptionSpecification __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__id)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               :
+               Thrift.genField _proxy "structuredAnnotations"
+                 (Thrift.getListType _proxy)
+                 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__structuredAnnotations)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (ExceptionSpecification __val__id __val__type_
+                                                  __val__name
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("id", 1), ("type_", 2), ("name", 3),
+                     ("structuredAnnotations", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionSpecification where
+  rnf
+    (ExceptionSpecification __field__id __field__type_ __field__name
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default ExceptionSpecification where
+  def
+    = ExceptionSpecification Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable ExceptionSpecification where
+  hashWithSalt __salt
+    (ExceptionSpecification _id _type_ _name _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _type_)
+           _name)
+        _structuredAnnotations
+
+data ResultStream = ResultStream{resultStream_response ::
+                                 Prelude.Maybe TypeSpecification,
+                                 resultStream_stream_ :: TypeSpecification,
+                                 resultStream_throws_ :: [ExceptionSpecification]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResultStream where
+  toJSON
+    (ResultStream __field__response __field__stream_ __field__throws_)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("response" .=)) __field__response
+           ("stream_" .= __field__stream_ :
+              "throws_" .= __field__throws_ : Prelude.mempty))
+
+instance Thrift.ThriftStruct ResultStream where
+  buildStruct _proxy
+    (ResultStream __field__response __field__stream_ __field__throws_)
+    = Thrift.genStruct _proxy
+        (let (__cereal__response, __id__response)
+               = case __field__response of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "response"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__response
+             (Thrift.genField _proxy "stream_" (Thrift.getStructType _proxy) 2
+                __id__response
+                (Thrift.buildStruct _proxy __field__stream_)
+                :
+                Thrift.genField _proxy "throws_" (Thrift.getListType _proxy) 3 2
+                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     __field__throws_)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__response <- ST.newSTRef Prelude.Nothing
+            __field__stream_ <- ST.newSTRef Default.def
+            __field__throws_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__response
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__stream_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__throws_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__response <- ST.readSTRef
+                                                                   __field__response
+                                             !__val__stream_ <- ST.readSTRef __field__stream_
+                                             !__val__throws_ <- ST.readSTRef __field__throws_
+                                             Prelude.pure
+                                               (ResultStream __val__response __val__stream_
+                                                  __val__throws_)
+              _idMap
+                = HashMap.fromList
+                    [("response", 1), ("stream_", 2), ("throws_", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ResultStream where
+  rnf
+    (ResultStream __field__response __field__stream_ __field__throws_)
+    = DeepSeq.rnf __field__response `Prelude.seq`
+        DeepSeq.rnf __field__stream_ `Prelude.seq`
+          DeepSeq.rnf __field__throws_ `Prelude.seq` ()
+
+instance Default.Default ResultStream where
+  def = ResultStream Prelude.Nothing Default.def Default.def
+
+instance Hashable.Hashable ResultStream where
+  hashWithSalt __salt (ResultStream _response _stream_ _throws_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _response)
+           _stream_)
+        _throws_
+
+data ResultType = ResultType_oneway_ Glean.Schema.Builtin.Unit
+                | ResultType_void_ Glean.Schema.Builtin.Unit
+                | ResultType_result TypeSpecification
+                | ResultType_stream_ ResultStream
+                | ResultType_service_ ServiceName
+                | ResultType_sink_ ResultSink
+                | ResultType_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResultType where
+  toJSON (ResultType_oneway_ __oneway_)
+    = Aeson.object ["oneway_" .= __oneway_]
+  toJSON (ResultType_void_ __void_)
+    = Aeson.object ["void_" .= __void_]
+  toJSON (ResultType_result __result)
+    = Aeson.object ["result" .= __result]
+  toJSON (ResultType_stream_ __stream_)
+    = Aeson.object ["stream_" .= __stream_]
+  toJSON (ResultType_service_ __service_)
+    = Aeson.object ["service_" .= __service_]
+  toJSON (ResultType_sink_ __sink_)
+    = Aeson.object ["sink_" .= __sink_]
+  toJSON ResultType_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ResultType where
+  buildStruct _proxy (ResultType_oneway_ __oneway_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "oneway_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __oneway_)]
+  buildStruct _proxy (ResultType_void_ __void_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "void_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __void_)]
+  buildStruct _proxy (ResultType_result __result)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "result" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __result)]
+  buildStruct _proxy (ResultType_stream_ __stream_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "stream_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __stream_)]
+  buildStruct _proxy (ResultType_service_ __service_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "service_" (Thrift.getStructType _proxy) 5
+           0
+           (Thrift.buildStruct _proxy __service_)]
+  buildStruct _proxy (ResultType_sink_ __sink_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sink_" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __sink_)]
+  buildStruct _proxy ResultType_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ResultType_oneway_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ResultType_void_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ResultType_result _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ResultType_stream_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ResultType_service_ _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ResultType_sink_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ResultType_EMPTY
+           Thrift.FieldEnd -> Prelude.return ResultType_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("oneway_", 1), ("void_", 2), ("result", 3), ("stream_", 4),
+             ("service_", 5), ("sink_", 6)]
+
+instance DeepSeq.NFData ResultType where
+  rnf (ResultType_oneway_ __oneway_) = DeepSeq.rnf __oneway_
+  rnf (ResultType_void_ __void_) = DeepSeq.rnf __void_
+  rnf (ResultType_result __result) = DeepSeq.rnf __result
+  rnf (ResultType_stream_ __stream_) = DeepSeq.rnf __stream_
+  rnf (ResultType_service_ __service_) = DeepSeq.rnf __service_
+  rnf (ResultType_sink_ __sink_) = DeepSeq.rnf __sink_
+  rnf ResultType_EMPTY = ()
+
+instance Default.Default ResultType where
+  def = ResultType_EMPTY
+
+instance Hashable.Hashable ResultType where
+  hashWithSalt __salt (ResultType_oneway_ _oneway_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _oneway_)
+  hashWithSalt __salt (ResultType_void_ _void_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _void_)
+  hashWithSalt __salt (ResultType_result _result)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _result)
+  hashWithSalt __salt (ResultType_stream_ _stream_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _stream_)
+  hashWithSalt __salt (ResultType_service_ _service_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _service_)
+  hashWithSalt __salt (ResultType_sink_ _sink_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _sink_)
+  hashWithSalt __salt ResultType_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FunctionSpecification_key = FunctionSpecification_key{functionSpecification_key_name
+                                                           :: FunctionName,
+                                                           functionSpecification_key_result ::
+                                                           ResultType,
+                                                           functionSpecification_key_arguments ::
+                                                           [UnqualField],
+                                                           functionSpecification_key_throws_ ::
+                                                           [ExceptionSpecification],
+                                                           functionSpecification_key_structuredAnnotations
+                                                           :: [StructuredAnnotation]}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionSpecification_key where
+  toJSON
+    (FunctionSpecification_key __field__name __field__result
+       __field__arguments __field__throws_ __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "result" .= __field__result :
+             "arguments" .= __field__arguments :
+               "throws_" .= __field__throws_ :
+                 "structuredAnnotations" .= __field__structuredAnnotations :
+                   Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionSpecification_key where
+  buildStruct _proxy
+    (FunctionSpecification_key __field__name __field__result
+       __field__arguments __field__throws_ __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "result" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__result)
+             :
+             Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__arguments)
+               :
+               Thrift.genField _proxy "throws_" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__throws_)
+                 :
+                 Thrift.genField _proxy "structuredAnnotations"
+                   (Thrift.getListType _proxy)
+                   5
+                   4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__structuredAnnotations)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__result <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            __field__throws_ <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__result
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__throws_
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__result <- ST.readSTRef __field__result
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             !__val__throws_ <- ST.readSTRef __field__throws_
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (FunctionSpecification_key __val__name __val__result
+                                                  __val__arguments
+                                                  __val__throws_
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("result", 2), ("arguments", 3), ("throws_", 4),
+                     ("structuredAnnotations", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionSpecification_key where
+  rnf
+    (FunctionSpecification_key __field__name __field__result
+       __field__arguments __field__throws_ __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__result `Prelude.seq`
+          DeepSeq.rnf __field__arguments `Prelude.seq`
+            DeepSeq.rnf __field__throws_ `Prelude.seq`
+              DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default FunctionSpecification_key where
+  def
+    = FunctionSpecification_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable FunctionSpecification_key where
+  hashWithSalt __salt
+    (FunctionSpecification_key _name _result _arguments _throws_
+       _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _result)
+              _arguments)
+           _throws_)
+        _structuredAnnotations
+
+data TypeDefException_key = TypeDefException_key{typeDefException_key_alias
+                                                 :: NamedDecl,
+                                                 typeDefException_key_type_ :: ExceptionSpecName}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDefException_key where
+  toJSON (TypeDefException_key __field__alias __field__type_)
+    = Aeson.object
+        ("alias" .= __field__alias :
+           "type_" .= __field__type_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDefException_key where
+  buildStruct _proxy
+    (TypeDefException_key __field__alias __field__type_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "alias" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__alias)
+           :
+           Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__alias <- ST.newSTRef Default.def
+            __field__type_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__alias
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__alias <- ST.readSTRef __field__alias
+                                             !__val__type_ <- ST.readSTRef __field__type_
+                                             Prelude.pure
+                                               (TypeDefException_key __val__alias __val__type_)
+              _idMap = HashMap.fromList [("alias", 1), ("type_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDefException_key where
+  rnf (TypeDefException_key __field__alias __field__type_)
+    = DeepSeq.rnf __field__alias `Prelude.seq`
+        DeepSeq.rnf __field__type_ `Prelude.seq` ()
+
+instance Default.Default TypeDefException_key where
+  def = TypeDefException_key Default.def Default.def
+
+instance Hashable.Hashable TypeDefException_key where
+  hashWithSalt __salt (TypeDefException_key _alias _type_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _alias)
+        _type_
+
+newtype ExceptionName_key = ExceptionName_key{exceptionName_key_name
+                                              :: QualName}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionName_key where
+  toJSON (ExceptionName_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExceptionName_key where
+  buildStruct _proxy (ExceptionName_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (ExceptionName_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionName_key where
+  rnf (ExceptionName_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ExceptionName_key where
+  def = ExceptionName_key Default.def
+
+instance Hashable.Hashable ExceptionName_key where
+  hashWithSalt __salt (ExceptionName_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data EnumerationType_key = EnumerationType_key{enumerationType_key_name
+                                               :: QualName,
+                                               enumerationType_key_value :: [EnumValueDef],
+                                               enumerationType_key_structuredAnnotations ::
+                                               [StructuredAnnotation]}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumerationType_key where
+  toJSON
+    (EnumerationType_key __field__name __field__value
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "value" .= __field__value :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumerationType_key where
+  buildStruct _proxy
+    (EnumerationType_key __field__name __field__value
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "value" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__value)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (EnumerationType_key __val__name __val__value
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("value", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumerationType_key where
+  rnf
+    (EnumerationType_key __field__name __field__value
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default EnumerationType_key where
+  def = EnumerationType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EnumerationType_key where
+  hashWithSalt __salt
+    (EnumerationType_key _name _value _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _value)
+        _structuredAnnotations
+
+data EnumValueDef_key = EnumValueDef_key{enumValueDef_key_name ::
+                                         EnumValue,
+                                         enumValueDef_key_value :: IntegerLiteral,
+                                         enumValueDef_key_structuredAnnotations ::
+                                         [StructuredAnnotation]}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumValueDef_key where
+  toJSON
+    (EnumValueDef_key __field__name __field__value
+       __field__structuredAnnotations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "value" .= __field__value :
+             "structuredAnnotations" .= __field__structuredAnnotations :
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumValueDef_key where
+  buildStruct _proxy
+    (EnumValueDef_key __field__name __field__value
+       __field__structuredAnnotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             :
+             Thrift.genField _proxy "structuredAnnotations"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__structuredAnnotations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            __field__structuredAnnotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__structuredAnnotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__structuredAnnotations <- ST.readSTRef
+                                                                                __field__structuredAnnotations
+                                             Prelude.pure
+                                               (EnumValueDef_key __val__name __val__value
+                                                  __val__structuredAnnotations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("value", 2), ("structuredAnnotations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumValueDef_key where
+  rnf
+    (EnumValueDef_key __field__name __field__value
+       __field__structuredAnnotations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq`
+          DeepSeq.rnf __field__structuredAnnotations `Prelude.seq` ()
+
+instance Default.Default EnumValueDef_key where
+  def = EnumValueDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EnumValueDef_key where
+  hashWithSalt __salt
+    (EnumValueDef_key _name _value _structuredAnnotations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _value)
+        _structuredAnnotations
+
+data EnumValue_key = EnumValue_key{enumValue_key_enum_ ::
+                                   NamedType,
+                                   enumValue_key_name :: Identifier}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumValue_key where
+  toJSON (EnumValue_key __field__enum_ __field__name)
+    = Aeson.object
+        ("enum_" .= __field__enum_ :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumValue_key where
+  buildStruct _proxy (EnumValue_key __field__enum_ __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__enum_)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__enum_ <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__enum_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__enum_ <- ST.readSTRef __field__enum_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (EnumValue_key __val__enum_ __val__name)
+              _idMap = HashMap.fromList [("enum_", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumValue_key where
+  rnf (EnumValue_key __field__enum_ __field__name)
+    = DeepSeq.rnf __field__enum_ `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EnumValue_key where
+  def = EnumValue_key Default.def Default.def
+
+instance Hashable.Hashable EnumValue_key where
+  hashWithSalt __salt (EnumValue_key _enum_ _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _enum_) _name
+
+newtype EnumVal_key = EnumVal_key{enumVal_key_name :: QualName}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumVal_key where
+  toJSON (EnumVal_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumVal_key where
+  buildStruct _proxy (EnumVal_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (EnumVal_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumVal_key where
+  rnf (EnumVal_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EnumVal_key where
+  def = EnumVal_key Default.def
+
+instance Hashable.Hashable EnumVal_key where
+  hashWithSalt __salt (EnumVal_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+type Declaration = XRefTarget
+
+data DeclarationComment_key = DeclarationComment_key{declarationComment_key_declaration
+                                                     :: Declaration,
+                                                     declarationComment_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     declarationComment_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment_key where
+  toJSON
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment_key where
+  buildStruct _proxy
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationComment_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment_key where
+  rnf
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationComment_key where
+  def = DeclarationComment_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationComment_key where
+  hashWithSalt __salt
+    (DeclarationComment_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationFile_key = DeclarationFile_key{declarationFile_key_declaration
+                                               :: Declaration,
+                                               declarationFile_key_file :: File}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationFile_key where
+  toJSON (DeclarationFile_key __field__declaration __field__file)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationFile_key where
+  buildStruct _proxy
+    (DeclarationFile_key __field__declaration __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (DeclarationFile_key __val__declaration __val__file)
+              _idMap = HashMap.fromList [("declaration", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationFile_key where
+  rnf (DeclarationFile_key __field__declaration __field__file)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default DeclarationFile_key where
+  def = DeclarationFile_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationFile_key where
+  hashWithSalt __salt (DeclarationFile_key _declaration _file)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _file
+
+data DeclarationMember_key = DeclarationMember_key{declarationMember_key_qname
+                                                   :: QualName,
+                                                   declarationMember_key_member :: Identifier,
+                                                   declarationMember_key_decl :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationMember_key where
+  toJSON
+    (DeclarationMember_key __field__qname __field__member
+       __field__decl)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "member" .= __field__member :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationMember_key where
+  buildStruct _proxy
+    (DeclarationMember_key __field__qname __field__member
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "member" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__member)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__member <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__member
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__member <- ST.readSTRef __field__member
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DeclarationMember_key __val__qname __val__member
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("qname", 1), ("member", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationMember_key where
+  rnf
+    (DeclarationMember_key __field__qname __field__member
+       __field__decl)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__member `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DeclarationMember_key where
+  def = DeclarationMember_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationMember_key where
+  hashWithSalt __salt (DeclarationMember_key _qname _member _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname)
+           _member)
+        _decl
+
+data DeclarationName_key = DeclarationName_key{declarationName_key_qname
+                                               :: QualName,
+                                               declarationName_key_decl :: Declaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName_key where
+  toJSON (DeclarationName_key __field__qname __field__decl)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationName_key where
+  buildStruct _proxy
+    (DeclarationName_key __field__qname __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DeclarationName_key __val__qname __val__decl)
+              _idMap = HashMap.fromList [("qname", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName_key where
+  rnf (DeclarationName_key __field__qname __field__decl)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DeclarationName_key where
+  def = DeclarationName_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationName_key where
+  hashWithSalt __salt (DeclarationName_key _qname _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _decl
+
+data DeclarationNameSpan_key = DeclarationNameSpan_key{declarationNameSpan_key_decl
+                                                       :: Declaration,
+                                                       declarationNameSpan_key_name :: Identifier,
+                                                       declarationNameSpan_key_file :: File,
+                                                       declarationNameSpan_key_span :: Loc}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan_key where
+  toJSON
+    (DeclarationNameSpan_key __field__decl __field__name __field__file
+       __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "name" .= __field__name :
+             "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan_key where
+  buildStruct _proxy
+    (DeclarationNameSpan_key __field__decl __field__name __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationNameSpan_key __val__decl __val__name
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("decl", 1), ("name", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan_key where
+  rnf
+    (DeclarationNameSpan_key __field__decl __field__name __field__file
+       __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan_key where
+  def
+    = DeclarationNameSpan_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable DeclarationNameSpan_key where
+  hashWithSalt __salt
+    (DeclarationNameSpan_key _decl _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _name)
+           _file)
+        _span
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_target
+                                               :: Declaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_range :: Loc}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data FileDeclaration_key = FileDeclaration_key{fileDeclaration_key_file
+                                               :: File,
+                                               fileDeclaration_key_decl :: Declaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclaration_key where
+  toJSON (FileDeclaration_key __field__file __field__decl)
+    = Aeson.object
+        ("file" .= __field__file :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclaration_key where
+  buildStruct _proxy
+    (FileDeclaration_key __field__file __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (FileDeclaration_key __val__file __val__decl)
+              _idMap = HashMap.fromList [("file", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclaration_key where
+  rnf (FileDeclaration_key __field__file __field__decl)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default FileDeclaration_key where
+  def = FileDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable FileDeclaration_key where
+  hashWithSalt __salt (FileDeclaration_key _file _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _decl
+
+data FunctionDeclarationName_key = FunctionDeclarationName_key{functionDeclarationName_key_qname
+                                                               :: QualName,
+                                                               functionDeclarationName_key_name ::
+                                                               Identifier,
+                                                               functionDeclarationName_key_decl ::
+                                                               Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclarationName_key where
+  toJSON
+    (FunctionDeclarationName_key __field__qname __field__name
+       __field__decl)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "name" .= __field__name : "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclarationName_key where
+  buildStruct _proxy
+    (FunctionDeclarationName_key __field__qname __field__name
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (FunctionDeclarationName_key __val__qname __val__name
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("qname", 1), ("name", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclarationName_key where
+  rnf
+    (FunctionDeclarationName_key __field__qname __field__name
+       __field__decl)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default FunctionDeclarationName_key where
+  def
+    = FunctionDeclarationName_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FunctionDeclarationName_key where
+  hashWithSalt __salt
+    (FunctionDeclarationName_key _qname _name _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _name)
+        _decl
+
+data ContainerType = ContainerType_list_ TypeSpecification
+                   | ContainerType_set_ TypeSpecification
+                   | ContainerType_map_ MapType
+                   | ContainerType_EMPTY
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerType where
+  toJSON (ContainerType_list_ __list_)
+    = Aeson.object ["list_" .= __list_]
+  toJSON (ContainerType_set_ __set_)
+    = Aeson.object ["set_" .= __set_]
+  toJSON (ContainerType_map_ __map_)
+    = Aeson.object ["map_" .= __map_]
+  toJSON ContainerType_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ContainerType where
+  buildStruct _proxy (ContainerType_list_ __list_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "list_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __list_)]
+  buildStruct _proxy (ContainerType_set_ __set_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "set_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __set_)]
+  buildStruct _proxy (ContainerType_map_ __map_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "map_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __map_)]
+  buildStruct _proxy ContainerType_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ContainerType_list_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ContainerType_set_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ContainerType_map_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ContainerType_EMPTY
+           Thrift.FieldEnd -> Prelude.return ContainerType_EMPTY
+    where
+      _idMap = HashMap.fromList [("list_", 1), ("set_", 2), ("map_", 3)]
+
+instance DeepSeq.NFData ContainerType where
+  rnf (ContainerType_list_ __list_) = DeepSeq.rnf __list_
+  rnf (ContainerType_set_ __set_) = DeepSeq.rnf __set_
+  rnf (ContainerType_map_ __map_) = DeepSeq.rnf __map_
+  rnf ContainerType_EMPTY = ()
+
+instance Default.Default ContainerType where
+  def = ContainerType_EMPTY
+
+instance Hashable.Hashable ContainerType where
+  hashWithSalt __salt (ContainerType_list_ _list_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _list_)
+  hashWithSalt __salt (ContainerType_set_ _set_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _set_)
+  hashWithSalt __salt (ContainerType_map_ _map_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _map_)
+  hashWithSalt __salt ContainerType_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypeSpecification_key = TypeSpecification_key_primitive PrimitiveType
+                           | TypeSpecification_key_container ContainerType
+                           | TypeSpecification_key_named NamedType
+                           | TypeSpecification_key_EMPTY
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeSpecification_key where
+  toJSON (TypeSpecification_key_primitive __primitive)
+    = Aeson.object ["primitive" .= __primitive]
+  toJSON (TypeSpecification_key_container __container)
+    = Aeson.object ["container" .= __container]
+  toJSON (TypeSpecification_key_named __named)
+    = Aeson.object ["named" .= __named]
+  toJSON TypeSpecification_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TypeSpecification_key where
+  buildStruct _proxy (TypeSpecification_key_primitive __primitive)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "primitive" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __primitive)]
+  buildStruct _proxy (TypeSpecification_key_container __container)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __container)]
+  buildStruct _proxy (TypeSpecification_key_named __named)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "named" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __named)]
+  buildStruct _proxy TypeSpecification_key_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getI32Type _proxy ->
+                                                         do _val <- Thrift.parseEnum _proxy
+                                                                      "PrimitiveType"
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeSpecification_key_primitive _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeSpecification_key_container _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeSpecification_key_named _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               TypeSpecification_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return TypeSpecification_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("primitive", 1), ("container", 2), ("named", 3)]
+
+instance DeepSeq.NFData TypeSpecification_key where
+  rnf (TypeSpecification_key_primitive __primitive)
+    = DeepSeq.rnf __primitive
+  rnf (TypeSpecification_key_container __container)
+    = DeepSeq.rnf __container
+  rnf (TypeSpecification_key_named __named) = DeepSeq.rnf __named
+  rnf TypeSpecification_key_EMPTY = ()
+
+instance Default.Default TypeSpecification_key where
+  def = TypeSpecification_key_EMPTY
+
+instance Hashable.Hashable TypeSpecification_key where
+  hashWithSalt __salt (TypeSpecification_key_primitive _primitive)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _primitive)
+  hashWithSalt __salt (TypeSpecification_key_container _container)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _container)
+  hashWithSalt __salt (TypeSpecification_key_named _named)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _named)
+  hashWithSalt __salt TypeSpecification_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ConstantDefinition_key = ConstantDefinition_key{constantDefinition_key_constant
+                                                     :: Constant,
+                                                     constantDefinition_key_definition ::
+                                                     TypedConstT}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstantDefinition_key where
+  toJSON
+    (ConstantDefinition_key __field__constant __field__definition)
+    = Aeson.object
+        ("constant" .= __field__constant :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstantDefinition_key where
+  buildStruct _proxy
+    (ConstantDefinition_key __field__constant __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "constant" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__constant)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__constant <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__constant
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__constant <- ST.readSTRef
+                                                                   __field__constant
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (ConstantDefinition_key __val__constant
+                                                  __val__definition)
+              _idMap = HashMap.fromList [("constant", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstantDefinition_key where
+  rnf (ConstantDefinition_key __field__constant __field__definition)
+    = DeepSeq.rnf __field__constant `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default ConstantDefinition_key where
+  def = ConstantDefinition_key Default.def Default.def
+
+instance Hashable.Hashable ConstantDefinition_key where
+  hashWithSalt __salt (ConstantDefinition_key _constant _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _constant)
+        _definition
+
+newtype Constant_key = Constant_key{constant_key_name :: QualName}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Constant_key where
+  toJSON (Constant_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Constant_key where
+  buildStruct _proxy (Constant_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Constant_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Constant_key where
+  rnf (Constant_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Constant_key where
+  def = Constant_key Default.def
+
+instance Hashable.Hashable Constant_key where
+  hashWithSalt __salt (Constant_key _name)
+    = Hashable.hashWithSalt __salt _name
+{-# LINE 18 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.DeclarationUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range" (Glean.Schema.Fbthrift.Types.Loc)
+             ('Angle.TNoFields)))
+{-# LINE 31 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationUses =
+       Glean.Schema.Fbthrift.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "fbthrift.DeclarationUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.File where
+  type KeyType Glean.Schema.Fbthrift.Types.File =
+       Glean.Schema.Src.Types.File
+  getName _proxy = Glean.PredicateRef "fbthrift.File" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.file_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.File x k
+  getFactKey = Glean.Schema.Fbthrift.Types.file_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 54 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.File where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 60 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceName_key
+         where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ServiceName_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ServiceName_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ServiceName_key" (Prelude.Just 0))
+{-# LINE 67 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ServiceName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TNoFields)
+{-# LINE 69 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ServiceName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ServiceName =
+       Glean.Schema.Fbthrift.Types.ServiceName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ServiceName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.serviceName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ServiceName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.serviceName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 78 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 84 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.FunctionDeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FunctionDeclarationName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FunctionDeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FunctionDeclarationName_key"
+           (Prelude.Just 0))
+{-# LINE 95 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.FunctionDeclarationName_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 97 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.FunctionDeclarationName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FunctionDeclarationName =
+       Glean.Schema.Fbthrift.Types.FunctionDeclarationName_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.FunctionDeclarationName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.functionDeclarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FunctionDeclarationName x k
+  getFactKey
+    = Glean.Schema.Fbthrift.Types.functionDeclarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 106 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.FunctionDeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 112 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ServiceInteractionFunctions_key"
+           (Prelude.Just 0))
+{-# LINE 121 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+       ('Angle.TField "function_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.FunctionSpecification)
+          ('Angle.TNoFields))
+{-# LINE 123 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions
+         where
+  type KeyType
+         Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions
+       = Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.ServiceInteractionFunctions" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Fbthrift.Types.serviceInteractionFunctions_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions x k
+  getFactKey
+    = Glean.Schema.Fbthrift.Types.serviceInteractionFunctions_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 132 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.ServiceInteractionFunctions
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 138 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ServiceParent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ServiceParent_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ServiceParent_key" (Prelude.Just 0))
+{-# LINE 147 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ServiceParent_key =
+     'Angle.TField "child"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+          ('Angle.TNoFields))
+{-# LINE 149 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ServiceParent
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ServiceParent =
+       Glean.Schema.Fbthrift.Types.ServiceParent_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ServiceParent" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.serviceParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ServiceParent x k
+  getFactKey = Glean.Schema.Fbthrift.Types.serviceParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 158 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceParent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 164 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionName_key
+         where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ExceptionName_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ExceptionName_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ExceptionName_key" (Prelude.Just 0))
+{-# LINE 171 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ExceptionName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TNoFields)
+{-# LINE 173 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ExceptionName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ExceptionName =
+       Glean.Schema.Fbthrift.Types.ExceptionName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ExceptionName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.exceptionName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ExceptionName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.exceptionName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 182 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 188 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationName_key" (Prelude.Just 0))
+{-# LINE 197 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.DeclarationName_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 199 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationName =
+       Glean.Schema.Fbthrift.Types.DeclarationName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.DeclarationName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 208 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 214 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.TypeSpecification_key
+         where
+  buildRtsValue b
+    Glean.Schema.Fbthrift.Types.TypeSpecification_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypeSpecification_key_primitive x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypeSpecification_key_container x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypeSpecification_key_named x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Fbthrift.Types.TypeSpecification_key_EMPTY)
+        [Glean.mapD
+           Glean.Schema.Fbthrift.Types.TypeSpecification_key_primitive,
+         Glean.mapD
+           Glean.Schema.Fbthrift.Types.TypeSpecification_key_container,
+         Glean.mapD Glean.Schema.Fbthrift.Types.TypeSpecification_key_named]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.TypeSpecification_key" (Prelude.Just 0))
+{-# LINE 234 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.TypeSpecification_key =
+     'Angle.TField "primitive"
+       (Glean.Schema.Fbthrift.Types.PrimitiveType)
+       ('Angle.TField "container"
+          (Glean.Schema.Fbthrift.Types.ContainerType)
+          ('Angle.TField "named" (Glean.Schema.Fbthrift.Types.NamedType)
+             ('Angle.TNoFields)))
+{-# LINE 236 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.TypeSpecification
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.TypeSpecification =
+       Glean.Schema.Fbthrift.Types.TypeSpecification_key
+  getName _proxy = Glean.PredicateRef "fbthrift.TypeSpecification" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.typeSpecification_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.TypeSpecification x k
+  getFactKey = Glean.Schema.Fbthrift.Types.typeSpecification_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 245 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypeSpecification
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 251 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ExceptionVal
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ExceptionVal =
+       Glean.Schema.Fbthrift.Types.StructVal
+  getName _proxy = Glean.PredicateRef "fbthrift.ExceptionVal" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.exceptionVal_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ExceptionVal x k
+  getFactKey = Glean.Schema.Fbthrift.Types.exceptionVal_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 260 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionVal where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 266 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FieldDecl_key where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FieldDecl_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FieldDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FieldDecl_key" (Prelude.Just 0))
+{-# LINE 277 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FieldDecl_key =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "kind" (Glean.Schema.Fbthrift.Types.FieldKind)
+          ('Angle.TField "name"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+             ('Angle.TNoFields)))
+{-# LINE 279 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.FieldDecl
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FieldDecl =
+       Glean.Schema.Fbthrift.Types.FieldDecl_key
+  getName _proxy = Glean.PredicateRef "fbthrift.FieldDecl" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.fieldDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FieldDecl x k
+  getFactKey = Glean.Schema.Fbthrift.Types.fieldDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 288 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FieldDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 294 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.DeclarationNameSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationNameSpan_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationNameSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationNameSpan_key"
+           (Prelude.Just 0))
+{-# LINE 307 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.DeclarationNameSpan_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TField "file"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Fbthrift.Types.Loc)
+                ('Angle.TNoFields))))
+{-# LINE 309 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationNameSpan
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationNameSpan =
+       Glean.Schema.Fbthrift.Types.DeclarationNameSpan_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.DeclarationNameSpan" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationNameSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationNameSpan x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationNameSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 318 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationNameSpan
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 324 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.QualName_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.QualName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.QualName_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.QualName_key" (Prelude.Just 0))
+{-# LINE 333 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.QualName_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TNoFields))
+{-# LINE 335 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.QualName where
+  type KeyType Glean.Schema.Fbthrift.Types.QualName =
+       Glean.Schema.Fbthrift.Types.QualName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.QualName" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.qualName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.QualName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.qualName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 344 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.QualName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 350 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.InteractionName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.InteractionName_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.InteractionName_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.InteractionName_key" (Prelude.Just 0))
+{-# LINE 357 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.InteractionName_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TNoFields)
+{-# LINE 359 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.InteractionName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.InteractionName =
+       Glean.Schema.Fbthrift.Types.InteractionName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.InteractionName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.interactionName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.InteractionName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.interactionName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 368 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.InteractionName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 374 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypeDefType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypeDefType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.TypeDefType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.TypeDefType_key" (Prelude.Just 0))
+{-# LINE 385 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.TypeDefType_key =
+     'Angle.TField "alias"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "type_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 387 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.TypeDefType
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.TypeDefType =
+       Glean.Schema.Fbthrift.Types.TypeDefType_key
+  getName _proxy = Glean.PredicateRef "fbthrift.TypeDefType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.typeDefType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.TypeDefType x k
+  getFactKey = Glean.Schema.Fbthrift.Types.typeDefType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 396 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypeDefType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 402 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.InteractionDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.InteractionDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.InteractionDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.InteractionDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 413 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.InteractionDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.InteractionName)
+       ('Angle.TField "functions"
+          ([Glean.Schema.Fbthrift.Types.FunctionSpecification])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 415 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.InteractionDefinition
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.InteractionDefinition =
+       Glean.Schema.Fbthrift.Types.InteractionDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.InteractionDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.interactionDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.InteractionDefinition x k
+  getFactKey = Glean.Schema.Fbthrift.Types.interactionDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 424 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.InteractionDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 430 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FunctionName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FunctionName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FunctionName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FunctionName_key" (Prelude.Just 0))
+{-# LINE 439 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FunctionName_key =
+     'Angle.TField "service_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TNoFields))
+{-# LINE 441 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.FunctionName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FunctionName =
+       Glean.Schema.Fbthrift.Types.FunctionName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.FunctionName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.functionName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FunctionName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.functionName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 450 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FunctionName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 456 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnionVal_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.UnionVal_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.UnionVal_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.UnionVal_key" (Prelude.Just 0))
+{-# LINE 463 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.UnionVal_key =
+     'Angle.TField "field" (Glean.Schema.Fbthrift.Types.UnionFieldVal)
+       ('Angle.TNoFields)
+{-# LINE 465 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.UnionVal where
+  type KeyType Glean.Schema.Fbthrift.Types.UnionVal =
+       Glean.Schema.Fbthrift.Types.UnionVal_key
+  getName _proxy = Glean.PredicateRef "fbthrift.UnionVal" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.unionVal_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.UnionVal x k
+  getFactKey = Glean.Schema.Fbthrift.Types.unionVal_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 474 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnionVal where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 480 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.TypeDefException_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypeDefException_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.TypeDefException_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.TypeDefException_key" (Prelude.Just 0))
+{-# LINE 489 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.TypeDefException_key
+     =
+     'Angle.TField "alias"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.NamedDecl)
+       ('Angle.TField "type_"
+          (Glean.Schema.Fbthrift.Types.ExceptionSpecName)
+          ('Angle.TNoFields))
+{-# LINE 491 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.TypeDefException
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.TypeDefException =
+       Glean.Schema.Fbthrift.Types.TypeDefException_key
+  getName _proxy = Glean.PredicateRef "fbthrift.TypeDefException" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.typeDefException_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.TypeDefException x k
+  getFactKey = Glean.Schema.Fbthrift.Types.typeDefException_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 500 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypeDefException
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 506 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FileXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 515 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FileXRefs_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Fbthrift.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 517 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.FileXRefs
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FileXRefs =
+       Glean.Schema.Fbthrift.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "fbthrift.FileXRefs" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Fbthrift.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 526 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 532 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumValue_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.EnumValue_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.EnumValue_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.EnumValue_key" (Prelude.Just 0))
+{-# LINE 541 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.EnumValue_key =
+     'Angle.TField "enum_" (Glean.Schema.Fbthrift.Types.NamedType)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TNoFields))
+{-# LINE 543 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.EnumValue
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.EnumValue =
+       Glean.Schema.Fbthrift.Types.EnumValue_key
+  getName _proxy = Glean.PredicateRef "fbthrift.EnumValue" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.enumValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.EnumValue x k
+  getFactKey = Glean.Schema.Fbthrift.Types.enumValue_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 552 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumValue where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 558 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.ServiceDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ServiceDefinition_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ServiceDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ServiceDefinition_key" (Prelude.Just 0))
+{-# LINE 571 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.ServiceDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+       ('Angle.TField "functions"
+          ([Glean.Schema.Fbthrift.Types.FunctionSpecification])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TField "interactions"
+                ([Glean.Schema.Fbthrift.Types.InteractionName])
+                ('Angle.TNoFields))))
+{-# LINE 573 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.ServiceDefinition
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ServiceDefinition =
+       Glean.Schema.Fbthrift.Types.ServiceDefinition_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ServiceDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.serviceDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ServiceDefinition x k
+  getFactKey = Glean.Schema.Fbthrift.Types.serviceDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 582 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 588 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.DeclarationMember_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationMember_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationMember_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationMember_key" (Prelude.Just 0))
+{-# LINE 599 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.DeclarationMember_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "member"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 601 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationMember
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationMember =
+       Glean.Schema.Fbthrift.Types.DeclarationMember_key
+  getName _proxy = Glean.PredicateRef "fbthrift.DeclarationMember" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationMember_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationMember x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationMember_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 610 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationMember
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 616 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Literal_key where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.Literal_key_EMPTY
+    = Glean.buildRtsSelector b 17
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_byte_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_i16_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_i32_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_i64_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_float_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_double_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_bool_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_string_ x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_binary_ x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_set_ x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_list_ x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_map_ x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.Literal_key_newtype_ x)
+    = do Glean.buildRtsSelector b 12
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_struct_ x)
+    = do Glean.buildRtsSelector b 13
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.Literal_key_exception_ x)
+    = do Glean.buildRtsSelector b 14
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_union_ x)
+    = do Glean.buildRtsSelector b 15
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Literal_key_enum_ x)
+    = do Glean.buildRtsSelector b 16
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.Literal_key_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_byte_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_i16_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_i32_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_i64_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_float_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_double_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_bool_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_string_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_binary_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_set_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_list_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_map_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_newtype_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_struct_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_exception_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_union_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.Literal_key_enum_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Literal_key" (Prelude.Just 0))
+{-# LINE 692 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.Literal_key =
+     'Angle.TField "byte_" (Glean.Schema.Fbthrift.Types.IntegerLiteral)
+       ('Angle.TField "i16_" (Glean.Schema.Fbthrift.Types.IntegerLiteral)
+          ('Angle.TField "i32_" (Glean.Schema.Fbthrift.Types.IntegerLiteral)
+             ('Angle.TField "i64_" (Glean.Schema.Fbthrift.Types.IntegerLiteral)
+                ('Angle.TField "float_" (Glean.Schema.Fbthrift.Types.FloatLiteral)
+                   ('Angle.TField "double_" (Glean.Schema.Fbthrift.Types.FloatLiteral)
+                      ('Angle.TField "bool_" (Prelude.Bool)
+                         ('Angle.TField "string_" (Data.Text.Text)
+                            ('Angle.TField "binary_" (Data.ByteString.ByteString)
+                               ('Angle.TField "set_" ([Glean.Schema.Fbthrift.Types.TypedConst])
+                                  ('Angle.TField "list_" ([Glean.Schema.Fbthrift.Types.TypedConst])
+                                     ('Angle.TField "map_" ([Glean.Schema.Fbthrift.Types.KeyValue])
+                                        ('Angle.TField "newtype_"
+                                           (Glean.KeyType Glean.Schema.Fbthrift.Types.Literal)
+                                           ('Angle.TField "struct_"
+                                              (Glean.KeyType Glean.Schema.Fbthrift.Types.StructVal)
+                                              ('Angle.TField "exception_"
+                                                 (Glean.KeyType
+                                                    Glean.Schema.Fbthrift.Types.ExceptionVal)
+                                                 ('Angle.TField "union_"
+                                                    (Glean.KeyType
+                                                       Glean.Schema.Fbthrift.Types.UnionVal)
+                                                    ('Angle.TField "enum_"
+                                                       (Glean.KeyType
+                                                          Glean.Schema.Fbthrift.Types.EnumVal)
+                                                       ('Angle.TNoFields)))))))))))))))))
+{-# LINE 694 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.Literal where
+  type KeyType Glean.Schema.Fbthrift.Types.Literal =
+       Glean.Schema.Fbthrift.Types.Literal_key
+  getName _proxy = Glean.PredicateRef "fbthrift.Literal" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.literal_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.Literal x k
+  getFactKey = Glean.Schema.Fbthrift.Types.literal_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 703 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Literal where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 709 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.SearchByName_key" (Prelude.Just 0))
+{-# LINE 718 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.SearchByName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+       ('Angle.TField "qname"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+          ('Angle.TNoFields))
+{-# LINE 720 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.SearchByName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.SearchByName =
+       Glean.Schema.Fbthrift.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "fbthrift.SearchByName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.SearchByName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 729 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 735 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.StructType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.StructType_key" (Prelude.Just 0))
+{-# LINE 746 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.StructType_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "fields"
+          ([Glean.Schema.Fbthrift.Types.FieldSpecification])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 748 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.StructType
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.StructType =
+       Glean.Schema.Fbthrift.Types.StructType_key
+  getName _proxy = Glean.PredicateRef "fbthrift.StructType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.structType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.StructType x k
+  getFactKey = Glean.Schema.Fbthrift.Types.structType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 757 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 763 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FileDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FileDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FileDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FileDeclaration_key" (Prelude.Just 0))
+{-# LINE 772 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FileDeclaration_key
+     =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "decl" (Glean.Schema.Fbthrift.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 774 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.FileDeclaration
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FileDeclaration =
+       Glean.Schema.Fbthrift.Types.FileDeclaration_key
+  getName _proxy = Glean.PredicateRef "fbthrift.FileDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.fileDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FileDeclaration x k
+  getFactKey = Glean.Schema.Fbthrift.Types.fileDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 783 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FileDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 789 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumValueDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.EnumValueDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.EnumValueDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.EnumValueDef_key" (Prelude.Just 0))
+{-# LINE 800 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.EnumValueDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.EnumValue)
+       ('Angle.TField "value" (Glean.Schema.Fbthrift.Types.IntegerLiteral)
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 802 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.EnumValueDef
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.EnumValueDef =
+       Glean.Schema.Fbthrift.Types.EnumValueDef_key
+  getName _proxy = Glean.PredicateRef "fbthrift.EnumValueDef" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.enumValueDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.EnumValueDef x k
+  getFactKey = Glean.Schema.Fbthrift.Types.enumValueDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 811 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumValueDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 817 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.DeclarationComment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationComment_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationComment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationComment_key"
+           (Prelude.Just 0))
+{-# LINE 828 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.DeclarationComment_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 830 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationComment
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationComment =
+       Glean.Schema.Fbthrift.Types.DeclarationComment_key
+  getName _proxy = Glean.PredicateRef "fbthrift.DeclarationComment" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationComment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationComment x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationComment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 839 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationComment
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 845 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.NamespaceValue
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.NamespaceValue =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "fbthrift.NamespaceValue" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.namespaceValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.NamespaceValue x k
+  getFactKey = Glean.Schema.Fbthrift.Types.namespaceValue_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 853 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamespaceValue
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 859 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ExceptionType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ExceptionType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ExceptionType_key" (Prelude.Just 0))
+{-# LINE 870 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ExceptionType_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "fields"
+          ([Glean.Schema.Fbthrift.Types.FieldSpecification])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 872 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ExceptionType
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ExceptionType =
+       Glean.Schema.Fbthrift.Types.ExceptionType_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ExceptionType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.exceptionType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ExceptionType x k
+  getFactKey = Glean.Schema.Fbthrift.Types.exceptionType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 881 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 887 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnionType_key where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.UnionType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.UnionType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.UnionType_key" (Prelude.Just 0))
+{-# LINE 898 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.UnionType_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "alts" ([Glean.Schema.Fbthrift.Types.UnqualField])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 900 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.UnionType
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.UnionType =
+       Glean.Schema.Fbthrift.Types.UnionType_key
+  getName _proxy = Glean.PredicateRef "fbthrift.UnionType" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.unionType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.UnionType x k
+  getFactKey = Glean.Schema.Fbthrift.Types.unionType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 909 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnionType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 915 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.Identifier
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.Identifier =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "fbthrift.Identifier" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.identifier_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.Identifier x k
+  getFactKey = Glean.Schema.Fbthrift.Types.identifier_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 923 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Identifier where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 929 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.StructuredAnnotation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructuredAnnotation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.StructuredAnnotation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.StructuredAnnotation_key"
+           (Prelude.Just 0))
+{-# LINE 938 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.StructuredAnnotation_key
+     =
+     'Angle.TField "type_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.StructVal)
+          ('Angle.TNoFields))
+{-# LINE 940 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.StructuredAnnotation
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.StructuredAnnotation =
+       Glean.Schema.Fbthrift.Types.StructuredAnnotation_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.StructuredAnnotation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.structuredAnnotation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.StructuredAnnotation x k
+  getFactKey = Glean.Schema.Fbthrift.Types.structuredAnnotation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 949 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.StructuredAnnotation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 955 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumerationType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.EnumerationType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.EnumerationType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.EnumerationType_key" (Prelude.Just 0))
+{-# LINE 966 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.EnumerationType_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "value" ([Glean.Schema.Fbthrift.Types.EnumValueDef])
+          ('Angle.TField "structuredAnnotations"
+             ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+             ('Angle.TNoFields)))
+{-# LINE 968 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.EnumerationType
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.EnumerationType =
+       Glean.Schema.Fbthrift.Types.EnumerationType_key
+  getName _proxy = Glean.PredicateRef "fbthrift.EnumerationType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.enumerationType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.EnumerationType x k
+  getFactKey = Glean.Schema.Fbthrift.Types.enumerationType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 977 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumerationType
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 983 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructVal_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.StructVal_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.StructVal_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.StructVal_key" (Prelude.Just 0))
+{-# LINE 990 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.StructVal_key =
+     'Angle.TField "fields"
+       ([Glean.Schema.Fbthrift.Types.StructFieldVal])
+       ('Angle.TNoFields)
+{-# LINE 992 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.StructVal
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.StructVal =
+       Glean.Schema.Fbthrift.Types.StructVal_key
+  getName _proxy = Glean.PredicateRef "fbthrift.StructVal" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.structVal_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.StructVal x k
+  getFactKey = Glean.Schema.Fbthrift.Types.structVal_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1001 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructVal where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1007 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.NamespaceName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.NamespaceName =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "fbthrift.NamespaceName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.namespaceName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.NamespaceName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.namespaceName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1015 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamespaceName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1021 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.PackageName
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.PackageName =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "fbthrift.PackageName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.packageName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.PackageName x k
+  getFactKey = Glean.Schema.Fbthrift.Types.packageName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1029 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.PackageName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1035 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.FunctionSpecification_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FunctionSpecification_key x1 x2 x3 x4
+       x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FunctionSpecification_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FunctionSpecification_key"
+           (Prelude.Just 0))
+{-# LINE 1050 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.FunctionSpecification_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.FunctionName)
+       ('Angle.TField "result" (Glean.Schema.Fbthrift.Types.ResultType)
+          ('Angle.TField "arguments"
+             ([Glean.Schema.Fbthrift.Types.UnqualField])
+             ('Angle.TField "throws_"
+                ([Glean.Schema.Fbthrift.Types.ExceptionSpecification])
+                ('Angle.TField "structuredAnnotations"
+                   ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+                   ('Angle.TNoFields)))))
+{-# LINE 1052 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.FunctionSpecification
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.FunctionSpecification =
+       Glean.Schema.Fbthrift.Types.FunctionSpecification_key
+  getName _proxy
+    = Glean.PredicateRef "fbthrift.FunctionSpecification" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.functionSpecification_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.FunctionSpecification x k
+  getFactKey = Glean.Schema.Fbthrift.Types.functionSpecification_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1061 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.FunctionSpecification
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1067 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumVal_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.EnumVal_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.EnumVal_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.EnumVal_key" (Prelude.Just 0))
+{-# LINE 1074 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.EnumVal_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TNoFields)
+{-# LINE 1076 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.EnumVal where
+  type KeyType Glean.Schema.Fbthrift.Types.EnumVal =
+       Glean.Schema.Fbthrift.Types.EnumVal_key
+  getName _proxy = Glean.PredicateRef "fbthrift.EnumVal" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.enumVal_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.EnumVal x k
+  getFactKey = Glean.Schema.Fbthrift.Types.enumVal_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1085 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.EnumVal where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1091 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.DeclarationFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.DeclarationFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.DeclarationFile_key" (Prelude.Just 0))
+{-# LINE 1100 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.DeclarationFile_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "file"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 1102 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.DeclarationFile
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.DeclarationFile =
+       Glean.Schema.Fbthrift.Types.DeclarationFile_key
+  getName _proxy = Glean.PredicateRef "fbthrift.DeclarationFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.declarationFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.DeclarationFile x k
+  getFactKey = Glean.Schema.Fbthrift.Types.declarationFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1111 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.DeclarationFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1117 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 1126 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.NameLowerCase_key =
+     'Angle.TField "nameStr" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+          ('Angle.TNoFields))
+{-# LINE 1128 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.NameLowerCase =
+       Glean.Schema.Fbthrift.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "fbthrift.NameLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Fbthrift.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1137 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1143 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Constant_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Constant_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.Constant_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Constant_key" (Prelude.Just 0))
+{-# LINE 1150 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.Constant_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TNoFields)
+{-# LINE 1152 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.Constant where
+  type KeyType Glean.Schema.Fbthrift.Types.Constant =
+       Glean.Schema.Fbthrift.Types.Constant_key
+  getName _proxy = Glean.PredicateRef "fbthrift.Constant" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.constant_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.Constant x k
+  getFactKey = Glean.Schema.Fbthrift.Types.constant_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1161 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Constant where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1167 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.ConstantDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ConstantDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ConstantDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ConstantDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 1176 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.ConstantDefinition_key
+     =
+     'Angle.TField "constant"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Constant)
+       ('Angle.TField "definition"
+          (Glean.Schema.Fbthrift.Types.TypedConstT)
+          ('Angle.TNoFields))
+{-# LINE 1178 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Fbthrift.Types.ConstantDefinition
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ConstantDefinition =
+       Glean.Schema.Fbthrift.Types.ConstantDefinition_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ConstantDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.constantDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ConstantDefinition x k
+  getFactKey = Glean.Schema.Fbthrift.Types.constantDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1187 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ConstantDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1193 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceChild_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ServiceChild_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ServiceChild_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ServiceChild_key" (Prelude.Just 0))
+{-# LINE 1202 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ServiceChild_key =
+     'Angle.TField "parent"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+       ('Angle.TField "child"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+          ('Angle.TNoFields))
+{-# LINE 1204 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.ServiceChild
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.ServiceChild =
+       Glean.Schema.Fbthrift.Types.ServiceChild_key
+  getName _proxy = Glean.PredicateRef "fbthrift.ServiceChild" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Fbthrift.Types.serviceChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.ServiceChild x k
+  getFactKey = Glean.Schema.Fbthrift.Types.serviceChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1213 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ServiceChild where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1219 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamedDecl_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.NamedDecl_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.NamedDecl_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.NamedDecl_key" (Prelude.Just 0))
+{-# LINE 1226 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.NamedDecl_key =
+     'Angle.TField "name" (Glean.Schema.Fbthrift.Types.NamedType)
+       ('Angle.TNoFields)
+{-# LINE 1228 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.NamedDecl
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.NamedDecl =
+       Glean.Schema.Fbthrift.Types.NamedDecl_key
+  getName _proxy = Glean.PredicateRef "fbthrift.NamedDecl" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.namedDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.NamedDecl x k
+  getFactKey = Glean.Schema.Fbthrift.Types.namedDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1237 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamedDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1243 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Namespace_key where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.Namespace_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.Namespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Namespace_key" (Prelude.Just 0))
+{-# LINE 1256 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.Namespace_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.NamespaceName)
+          ('Angle.TField "namespace_"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.NamespaceValue)
+             ('Angle.TField "quoted" (Prelude.Bool) ('Angle.TNoFields))))
+{-# LINE 1258 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.Namespace
+         where
+  type KeyType Glean.Schema.Fbthrift.Types.Namespace =
+       Glean.Schema.Fbthrift.Types.Namespace_key
+  getName _proxy = Glean.PredicateRef "fbthrift.Namespace" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.namespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.Namespace x k
+  getFactKey = Glean.Schema.Fbthrift.Types.namespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1267 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Namespace where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1273 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Package_key where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Package_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.Package_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Package_key" (Prelude.Just 0))
+{-# LINE 1282 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.Package_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.PackageName)
+          ('Angle.TNoFields))
+{-# LINE 1284 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Fbthrift.Types.Package where
+  type KeyType Glean.Schema.Fbthrift.Types.Package =
+       Glean.Schema.Fbthrift.Types.Package_key
+  getName _proxy = Glean.PredicateRef "fbthrift.Package" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Fbthrift.Types.package_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Fbthrift.Types.Package x k
+  getFactKey = Glean.Schema.Fbthrift.Types.package_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1293 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Package where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1299 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructFieldValValue
+         where
+  buildRtsValue b
+    Glean.Schema.Fbthrift.Types.StructFieldValValue_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructFieldValValue_val x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructFieldValValue_default_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructFieldValValue_just x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.StructFieldValValue_nothing x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Fbthrift.Types.StructFieldValValue_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.StructFieldValValue_val,
+         Glean.mapD
+           Glean.Schema.Fbthrift.Types.StructFieldValValue_default_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.StructFieldValValue_just,
+         Glean.mapD Glean.Schema.Fbthrift.Types.StructFieldValValue_nothing]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.StructFieldValValue" (Prelude.Just 1))
+{-# LINE 1323 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.StructFieldValValue =
+     'Angle.TField "val" (Glean.Schema.Fbthrift.Types.TypedConstT)
+       ('Angle.TField "default_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "just" (Glean.Schema.Fbthrift.Types.TypedConstT)
+             ('Angle.TField "nothing" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 1325 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnionFieldVal where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.UnionFieldVal x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.UnionFieldVal <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.UnionFieldVal" (Prelude.Just 1))
+{-# LINE 1334 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.UnionFieldVal =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+       ('Angle.TField "value" (Glean.Schema.Fbthrift.Types.TypedConstT)
+          ('Angle.TNoFields))
+{-# LINE 1336 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.StructFieldVal
+         where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.StructFieldVal x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.StructFieldVal <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.StructFieldVal" (Prelude.Just 1))
+{-# LINE 1345 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.StructFieldVal =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+       ('Angle.TField "value"
+          (Glean.Schema.Fbthrift.Types.StructFieldValValue)
+          ('Angle.TNoFields))
+{-# LINE 1347 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Target where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Target x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.Target <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Target" (Prelude.Just 1))
+{-# LINE 1354 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Fbthrift.Types.Target
+     =
+     'Angle.TField "target" (Glean.Schema.Fbthrift.Types.XRefTarget)
+       ('Angle.TNoFields)
+{-# LINE 1356 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypedConst where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.TypedConst_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.TypedConst_literal x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.TypedConst_identifier x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.TypedConst_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.TypedConst_literal,
+         Glean.mapD Glean.Schema.Fbthrift.Types.TypedConst_identifier]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.TypedConst" (Prelude.Just 1))
+{-# LINE 1372 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.TypedConst =
+     'Angle.TField "literal"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Literal)
+       ('Angle.TField "identifier"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.Constant)
+          ('Angle.TNoFields))
+{-# LINE 1374 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.PrimitiveType where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.PrimitiveType" (Prelude.Just 1))
+{-# LINE 1379 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.PrimitiveType =
+     'Angle.TField "bool_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "byte_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "i16_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "i32_" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "i64_" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "float_" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "double_" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "binary_" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "string_" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TNoFields)))))))))
+{-# LINE 1381 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Fbthrift.Types.PrimitiveType
+         where
+  type AngleEnumTy Glean.Schema.Fbthrift.Types.PrimitiveType =
+       Glean.Schema.Fbthrift.Types.PrimitiveType
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 1385 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.MapType where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.MapType x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.MapType <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.MapType" (Prelude.Just 1))
+{-# LINE 1394 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.MapType =
+     'Angle.TField "key_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TNoFields))
+{-# LINE 1396 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FieldKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FieldKind" (Prelude.Just 1))
+{-# LINE 1401 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Fbthrift.Types.FieldKind
+     =
+     'Angle.TField "struct_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "union_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "exception_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 1403 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Fbthrift.Types.FieldKind
+         where
+  type AngleEnumTy Glean.Schema.Fbthrift.Types.FieldKind =
+       Glean.Schema.Fbthrift.Types.FieldKind
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
+{-# LINE 1407 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.KeyValue where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.KeyValue x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.KeyValue <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.KeyValue" (Prelude.Just 1))
+{-# LINE 1416 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.KeyValue =
+     'Angle.TField "key" (Glean.Schema.Fbthrift.Types.TypedConst)
+       ('Angle.TField "value" (Glean.Schema.Fbthrift.Types.TypedConst)
+          ('Angle.TNoFields))
+{-# LINE 1418 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ContainerType where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.ContainerType_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ContainerType_list_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ContainerType_set_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ContainerType_map_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.ContainerType_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.ContainerType_list_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ContainerType_set_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ContainerType_map_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ContainerType" (Prelude.Just 1))
+{-# LINE 1438 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.ContainerType =
+     'Angle.TField "list_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+       ('Angle.TField "set_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "map_" (Glean.Schema.Fbthrift.Types.MapType)
+             ('Angle.TNoFields)))
+{-# LINE 1440 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ResultStream where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultStream x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ResultStream <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ResultStream" (Prelude.Just 1))
+{-# LINE 1451 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ResultStream =
+     'Angle.TField "response"
+       (Prelude.Maybe Glean.Schema.Fbthrift.Types.TypeSpecification)
+       ('Angle.TField "stream_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "throws_"
+             ([Glean.Schema.Fbthrift.Types.ExceptionSpecification])
+             ('Angle.TNoFields)))
+{-# LINE 1453 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Fbthrift.Types.ExceptionSpecification
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ExceptionSpecification x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ExceptionSpecification <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ExceptionSpecification"
+           (Prelude.Just 1))
+{-# LINE 1466 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Fbthrift.Types.ExceptionSpecification
+     =
+     'Angle.TField "id" (Glean.Schema.Fbthrift.Types.FieldId)
+       ('Angle.TField "type_"
+          (Glean.Schema.Fbthrift.Types.ExceptionSpecName)
+          ('Angle.TField "name"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+             ('Angle.TField "structuredAnnotations"
+                ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+                ('Angle.TNoFields))))
+{-# LINE 1468 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.IntegerLiteral
+         where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.IntegerLiteral x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.IntegerLiteral <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.IntegerLiteral" (Prelude.Just 1))
+{-# LINE 1477 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.IntegerLiteral =
+     'Angle.TField "isNonNegative" (Prelude.Bool)
+       ('Angle.TField "absValue" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 1479 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ResultSink where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultSink x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.ResultSink <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ResultSink" (Prelude.Just 1))
+{-# LINE 1490 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.ResultSink =
+     'Angle.TField "type_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+       ('Angle.TField "firstResponse"
+          (Prelude.Maybe Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "finalResponse"
+             (Prelude.Maybe Glean.Schema.Fbthrift.Types.TypeSpecification)
+             ('Angle.TNoFields)))
+{-# LINE 1492 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FloatLiteral where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FloatLiteral x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FloatLiteral <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FloatLiteral" (Prelude.Just 1))
+{-# LINE 1505 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FloatLiteral =
+     'Angle.TField "isNaN" (Prelude.Bool)
+       ('Angle.TField "isPositive" (Prelude.Bool)
+          ('Angle.TField "exponent" (Glean.Nat)
+             ('Angle.TField "significand" (Glean.Nat) ('Angle.TNoFields))))
+{-# LINE 1507 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Qualifier where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Qualifier" (Prelude.Just 1))
+{-# LINE 1512 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Fbthrift.Types.Qualifier
+     =
+     'Angle.TField "default_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "optional_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "required_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 1514 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Fbthrift.Types.Qualifier
+         where
+  type AngleEnumTy Glean.Schema.Fbthrift.Types.Qualifier =
+       Glean.Schema.Fbthrift.Types.Qualifier
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
+{-# LINE 1518 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.XRefTarget where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.XRefTarget_EMPTY
+    = Glean.buildRtsSelector b 8
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRefTarget_include_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRefTarget_named x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.XRefTarget_exception_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRefTarget_service_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRefTarget_constant x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.XRefTarget_enumValue x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.XRefTarget_function_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRefTarget_field x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.XRefTarget_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_include_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_named,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_exception_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_service_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_constant,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_enumValue,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_function_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.XRefTarget_field]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.XRefTarget" (Prelude.Just 1))
+{-# LINE 1558 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.XRefTarget =
+     'Angle.TField "include_"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.File)
+       ('Angle.TField "named"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.NamedDecl)
+          ('Angle.TField "exception_"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.ExceptionName)
+             ('Angle.TField "service_"
+                (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+                ('Angle.TField "constant"
+                   (Glean.KeyType Glean.Schema.Fbthrift.Types.Constant)
+                   ('Angle.TField "enumValue"
+                      (Glean.KeyType Glean.Schema.Fbthrift.Types.EnumValue)
+                      ('Angle.TField "function_"
+                         (Glean.KeyType Glean.Schema.Fbthrift.Types.FunctionName)
+                         ('Angle.TField "field"
+                            (Glean.KeyType Glean.Schema.Fbthrift.Types.FieldDecl)
+                            ('Angle.TNoFields))))))))
+{-# LINE 1560 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.XRef where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.XRef" (Prelude.Just 1))
+{-# LINE 1569 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Fbthrift.Types.XRef =
+     'Angle.TField "locRef" (Glean.Schema.Fbthrift.Types.Loc)
+       ('Angle.TField "target" (Glean.Schema.Fbthrift.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 1571 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.FieldSpecification
+         where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.FieldSpecification x1 x2 x3 x4 x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.FieldSpecification <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.FieldSpecification" (Prelude.Just 1))
+{-# LINE 1588 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.FieldSpecification =
+     'Angle.TField "id" (Glean.Schema.Fbthrift.Types.FieldId)
+       ('Angle.TField "qualifier" (Glean.Schema.Fbthrift.Types.Qualifier)
+          ('Angle.TField "type_"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+             ('Angle.TField "name"
+                (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+                ('Angle.TField "value"
+                   (Prelude.Maybe Glean.Schema.Fbthrift.Types.TypedConst)
+                   ('Angle.TField "structuredAnnotations"
+                      ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+                      ('Angle.TNoFields))))))
+{-# LINE 1590 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamedType where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.NamedType x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.NamedType <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.NamedType" (Prelude.Just 1))
+{-# LINE 1599 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.NamedType =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.QualName)
+       ('Angle.TField "kind" (Glean.Schema.Fbthrift.Types.NamedKind)
+          ('Angle.TNoFields))
+{-# LINE 1601 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.UnqualField where
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.UnqualField x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.UnqualField <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.UnqualField" (Prelude.Just 1))
+{-# LINE 1614 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.UnqualField =
+     'Angle.TField "id" (Glean.Schema.Fbthrift.Types.FieldId)
+       ('Angle.TField "type_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TField "name"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+             ('Angle.TField "structuredAnnotations"
+                ([Glean.Schema.Fbthrift.Types.StructuredAnnotation])
+                ('Angle.TNoFields))))
+{-# LINE 1616 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ResultType where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.ResultType_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_oneway_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_void_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_result x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_stream_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_service_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.ResultType_sink_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.ResultType_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_oneway_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_void_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_result,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_stream_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_service_,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ResultType_sink_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ResultType" (Prelude.Just 1))
+{-# LINE 1648 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.ResultType =
+     'Angle.TField "oneway_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "void_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "result"
+             (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+             ('Angle.TField "stream_" (Glean.Schema.Fbthrift.Types.ResultStream)
+                ('Angle.TField "service_"
+                   (Glean.KeyType Glean.Schema.Fbthrift.Types.ServiceName)
+                   ('Angle.TField "sink_" (Glean.Schema.Fbthrift.Types.ResultSink)
+                      ('Angle.TNoFields))))))
+{-# LINE 1650 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.Loc where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.Loc x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.Loc <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.Loc" (Prelude.Just 1))
+{-# LINE 1663 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Fbthrift.Types.Loc =
+     'Angle.TField "startLine" (Glean.Nat)
+       ('Angle.TField "startCol" (Glean.Nat)
+          ('Angle.TField "endLine" (Glean.Nat)
+             ('Angle.TField "endCol" (Glean.Nat) ('Angle.TNoFields))))
+{-# LINE 1665 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.TypedConstT where
+  buildRtsValue b (Glean.Schema.Fbthrift.Types.TypedConstT x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Fbthrift.Types.TypedConstT <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.TypedConstT" (Prelude.Just 1))
+{-# LINE 1674 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Fbthrift.Types.TypedConstT =
+     'Angle.TField "const_" (Glean.Schema.Fbthrift.Types.TypedConst)
+       ('Angle.TField "type_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeSpecification)
+          ('Angle.TNoFields))
+{-# LINE 1676 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.ExceptionSpecName
+         where
+  buildRtsValue b Glean.Schema.Fbthrift.Types.ExceptionSpecName_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ExceptionSpecName_simple x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Fbthrift.Types.ExceptionSpecName_typedef_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Fbthrift.Types.ExceptionSpecName_EMPTY)
+        [Glean.mapD Glean.Schema.Fbthrift.Types.ExceptionSpecName_simple,
+         Glean.mapD Glean.Schema.Fbthrift.Types.ExceptionSpecName_typedef_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.ExceptionSpecName" (Prelude.Just 1))
+{-# LINE 1692 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Fbthrift.Types.ExceptionSpecName =
+     'Angle.TField "simple"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.ExceptionName)
+       ('Angle.TField "typedef_"
+          (Glean.KeyType Glean.Schema.Fbthrift.Types.TypeDefException)
+          ('Angle.TNoFields))
+{-# LINE 1694 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Glean.Type Glean.Schema.Fbthrift.Types.NamedKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "fbthrift.NamedKind" (Prelude.Just 1))
+{-# LINE 1699 "glean/schema/thrift/fbthrift_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Fbthrift.Types.NamedKind
+     =
+     'Angle.TField "typedef_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "enum_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "struct_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "union_" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 1701 "glean/schema/thrift/fbthrift_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Fbthrift.Types.NamedKind
+         where
+  type AngleEnumTy Glean.Schema.Fbthrift.Types.NamedKind =
+       Glean.Schema.Fbthrift.Types.NamedKind
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Flow/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Flow/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Flow/Types.hs
@@ -0,0 +1,14048 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/flow_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/flow_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/flow_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Flow/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Flow.Types
+       (pREDICATE_VERSIONS, TypeImportDeclaration_id,
+        TypeImportDeclaration(TypeImportDeclaration,
+                              typeImportDeclaration_id, typeImportDeclaration_key),
+        TypeExport_id,
+        TypeExport(TypeExport, typeExport_id, typeExport_key),
+        TypeDeclarationReference_id,
+        TypeDeclarationReference(TypeDeclarationReference,
+                                 typeDeclarationReference_id, typeDeclarationReference_key),
+        TypeDeclarationInfo_id,
+        TypeDeclarationInfo(TypeDeclarationInfo, typeDeclarationInfo_id,
+                            typeDeclarationInfo_key),
+        TypeDeclaration_id,
+        TypeDeclaration(TypeDeclaration, typeDeclaration_id,
+                        typeDeclaration_key),
+        Type_id, Type(Type, type_id, type_key), StringToFileModule_id,
+        StringToFileModule(StringToFileModule, stringToFileModule_id,
+                           stringToFileModule_key),
+        SourceOfTypeExport_id,
+        SourceOfTypeExport(SourceOfTypeExport, sourceOfTypeExport_id,
+                           sourceOfTypeExport_key),
+        SourceOfExport_id,
+        SourceOfExport(SourceOfExport, sourceOfExport_id,
+                       sourceOfExport_key),
+        SearchTypeDeclarationByName_id,
+        SearchTypeDeclarationByName(SearchTypeDeclarationByName,
+                                    searchTypeDeclarationByName_id,
+                                    searchTypeDeclarationByName_key),
+        SearchTypeDeclarationByLowerCaseName_id,
+        SearchTypeDeclarationByLowerCaseName(SearchTypeDeclarationByLowerCaseName,
+                                             searchTypeDeclarationByLowerCaseName_id,
+                                             searchTypeDeclarationByLowerCaseName_key),
+        SearchTypeByModuleExport_id,
+        SearchTypeByModuleExport(SearchTypeByModuleExport,
+                                 searchTypeByModuleExport_id, searchTypeByModuleExport_key),
+        SearchModuleByLowerCaseName_id,
+        SearchModuleByLowerCaseName(SearchModuleByLowerCaseName,
+                                    searchModuleByLowerCaseName_id,
+                                    searchModuleByLowerCaseName_key),
+        SearchMemberDeclarationByName_id,
+        SearchMemberDeclarationByName(SearchMemberDeclarationByName,
+                                      searchMemberDeclarationByName_id,
+                                      searchMemberDeclarationByName_key),
+        SearchMemberDeclarationByLowerCaseName_id,
+        SearchMemberDeclarationByLowerCaseName(SearchMemberDeclarationByLowerCaseName,
+                                               searchMemberDeclarationByLowerCaseName_id,
+                                               searchMemberDeclarationByLowerCaseName_key),
+        SearchDeclarationByName_id,
+        SearchDeclarationByName(SearchDeclarationByName,
+                                searchDeclarationByName_id, searchDeclarationByName_key),
+        SearchDeclarationByLowerCaseName_id,
+        SearchDeclarationByLowerCaseName(SearchDeclarationByLowerCaseName,
+                                         searchDeclarationByLowerCaseName_id,
+                                         searchDeclarationByLowerCaseName_key),
+        SearchByNameModule_id,
+        SearchByNameModule(SearchByNameModule, searchByNameModule_id,
+                           searchByNameModule_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        SearchByModuleName_id,
+        SearchByModuleName(SearchByModuleName, searchByModuleName_id,
+                           searchByModuleName_key),
+        SearchByModule_id,
+        SearchByModule(SearchByModule, searchByModule_id,
+                       searchByModule_key),
+        SearchByFileModule_id,
+        SearchByFileModule(SearchByFileModule, searchByFileModule_id,
+                           searchByFileModule_key),
+        Range_id, Range(Range, range_id, range_key), Name_id,
+        Name(Name, name_id, name_key), ModuleTypeExport_id,
+        ModuleTypeExport(ModuleTypeExport, moduleTypeExport_id,
+                         moduleTypeExport_key),
+        ModuleNameLowerCase_id,
+        ModuleNameLowerCase(ModuleNameLowerCase, moduleNameLowerCase_id,
+                            moduleNameLowerCase_key),
+        ModuleLocationByFile_id,
+        ModuleLocationByFile(ModuleLocationByFile, moduleLocationByFile_id,
+                             moduleLocationByFile_key),
+        ModuleLocation_id,
+        ModuleLocation(ModuleLocation, moduleLocation_id,
+                       moduleLocation_key),
+        ModuleExport_id,
+        ModuleExport(ModuleExport, moduleExport_id, moduleExport_key),
+        ModuleDoc_id, ModuleDoc(ModuleDoc, moduleDoc_id, moduleDoc_key),
+        ModuleContains_id,
+        ModuleContains(ModuleContains, moduleContains_id,
+                       moduleContains_key),
+        ModuleComments_id,
+        ModuleComments(ModuleComments, moduleComments_id,
+                       moduleComments_key),
+        Module_id, Module(Module, module_id, module_key),
+        MemberDeclarationReference_id,
+        MemberDeclarationReference(MemberDeclarationReference,
+                                   memberDeclarationReference_id, memberDeclarationReference_key),
+        MemberDeclarationInfo_id,
+        MemberDeclarationInfo(MemberDeclarationInfo,
+                              memberDeclarationInfo_id, memberDeclarationInfo_key),
+        MemberDeclaration_id,
+        MemberDeclaration(MemberDeclaration, memberDeclaration_id,
+                          memberDeclaration_key),
+        LocalDeclarationReference_id,
+        LocalDeclarationReference(LocalDeclarationReference,
+                                  localDeclarationReference_id, localDeclarationReference_key),
+        ImportDeclaration_id,
+        ImportDeclaration(ImportDeclaration, importDeclaration_id,
+                          importDeclaration_key),
+        FlowXRefDeclInfo_id,
+        FlowXRefDeclInfo(FlowXRefDeclInfo, flowXRefDeclInfo_id,
+                         flowXRefDeclInfo_key),
+        FlowTypeImportXRef_id,
+        FlowTypeImportXRef(FlowTypeImportXRef, flowTypeImportXRef_id,
+                           flowTypeImportXRef_key),
+        FlowTypeExportLocation_id,
+        FlowTypeExportLocation(FlowTypeExportLocation,
+                               flowTypeExportLocation_id, flowTypeExportLocation_key),
+        FlowTypeEntityImportUses_id,
+        FlowTypeEntityImportUses(FlowTypeEntityImportUses,
+                                 flowTypeEntityImportUses_id, flowTypeEntityImportUses_key),
+        FlowSameModule_id,
+        FlowSameModule(FlowSameModule, flowSameModule_id,
+                       flowSameModule_key),
+        FlowModuleNamespaceXRef_id,
+        FlowModuleNamespaceXRef(FlowModuleNamespaceXRef,
+                                flowModuleNamespaceXRef_id, flowModuleNamespaceXRef_key),
+        FlowImportXRef_id,
+        FlowImportXRef(FlowImportXRef, flowImportXRef_id,
+                       flowImportXRef_key),
+        FlowExportLocation_id,
+        FlowExportLocation(FlowExportLocation, flowExportLocation_id,
+                           flowExportLocation_key),
+        FlowEntityUsesAll_id,
+        FlowEntityUsesAll(FlowEntityUsesAll, flowEntityUsesAll_id,
+                          flowEntityUsesAll_key),
+        FlowEntityImportUses_id,
+        FlowEntityImportUses(FlowEntityImportUses, flowEntityImportUses_id,
+                             flowEntityImportUses_key),
+        FlowCompatibleExport_id,
+        FlowCompatibleExport(FlowCompatibleExport, flowCompatibleExport_id,
+                             flowCompatibleExport_key),
+        FileXRef_id, FileXRef(FileXRef, fileXRef_id, fileXRef_key),
+        FileOfStringModule_id,
+        FileOfStringModule(FileOfStringModule, fileOfStringModule_id,
+                           fileOfStringModule_key),
+        FileDeclaration_id,
+        FileDeclaration(FileDeclaration, fileDeclaration_id,
+                        fileDeclaration_key),
+        Export_id, Export(Export, export_id, export_key), Documentation_id,
+        Documentation(Documentation, documentation_id, documentation_key),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        DeclarationSignature_id,
+        DeclarationSignature(DeclarationSignature, declarationSignature_id,
+                             declarationSignature_key),
+        DeclarationNameSpan_id,
+        DeclarationNameSpan(DeclarationNameSpan, declarationNameSpan_id,
+                            declarationNameSpan_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationInfo_id,
+        DeclarationInfo(DeclarationInfo, declarationInfo_id,
+                        declarationInfo_key),
+        Declaration_id,
+        Declaration(Declaration, declaration_id, declaration_key),
+        XRef(XRef_EMPTY, XRef_localRef, XRef_memberRef, XRef_typeRef),
+        TypeImportDeclaration_import_(TypeImportDeclaration_import__EMPTY,
+                                      TypeImportDeclaration_import__type,
+                                      TypeImportDeclaration_import__typeof_,
+                                      TypeImportDeclaration_import__moduleTypeof),
+        TypeImportDeclaration_key(TypeImportDeclaration_key,
+                                  typeImportDeclaration_key_typeDeclaration,
+                                  typeImportDeclaration_key_import_),
+        TypeExport_key(TypeExport_key_EMPTY, TypeExport_key_named,
+                       TypeExport_key_star),
+        TypeDeclarationReference_key(TypeDeclarationReference_key,
+                                     typeDeclarationReference_key_typeDeclaration,
+                                     typeDeclarationReference_key_loc),
+        TypeDeclarationInfo_key(TypeDeclarationInfo_key,
+                                typeDeclarationInfo_key_typeDeclaration,
+                                typeDeclarationInfo_key_type,
+                                typeDeclarationInfo_key_documentation,
+                                typeDeclarationInfo_key_span),
+        TypeDeclaration_key(TypeDeclaration_key, typeDeclaration_key_name,
+                            typeDeclaration_key_loc),
+        StringToFileModule_key(StringToFileModule_key,
+                               stringToFileModule_key_string_, stringToFileModule_key_file),
+        SourceOfTypeExport_source(SourceOfTypeExport_source_EMPTY,
+                                  SourceOfTypeExport_source_typeDeclaration,
+                                  SourceOfTypeExport_source_moduleTypeExport,
+                                  SourceOfTypeExport_source_moduleNamespace),
+        SourceOfTypeExport_key(SourceOfTypeExport_key,
+                               sourceOfTypeExport_key_moduleTypeExport,
+                               sourceOfTypeExport_key_source),
+        SourceOfExport_source(SourceOfExport_source_EMPTY,
+                              SourceOfExport_source_declaration,
+                              SourceOfExport_source_memberDeclaration,
+                              SourceOfExport_source_moduleExport,
+                              SourceOfExport_source_moduleNamespace),
+        SourceOfExport_key(SourceOfExport_key,
+                           sourceOfExport_key_moduleExport, sourceOfExport_key_source),
+        SomeDeclaration(SomeDeclaration_EMPTY, SomeDeclaration_localDecl,
+                        SomeDeclaration_memberDecl, SomeDeclaration_typeDecl),
+        SomeEntity(SomeEntity_EMPTY, SomeEntity_decl, SomeEntity_module_),
+        SearchTypeDeclarationByName_key(SearchTypeDeclarationByName_key,
+                                        searchTypeDeclarationByName_key_name,
+                                        searchTypeDeclarationByName_key_parent,
+                                        searchTypeDeclarationByName_key_decl),
+        SearchTypeDeclarationByLowerCaseName_key(SearchTypeDeclarationByLowerCaseName_key,
+                                                 searchTypeDeclarationByLowerCaseName_key_name_lowercase,
+                                                 searchTypeDeclarationByLowerCaseName_key_name),
+        SearchTypeByModuleExport_key(SearchTypeByModuleExport_key,
+                                     searchTypeByModuleExport_key_string_,
+                                     searchTypeByModuleExport_key_name,
+                                     searchTypeByModuleExport_key_decl),
+        SearchModuleByLowerCaseName_key(SearchModuleByLowerCaseName_key,
+                                        searchModuleByLowerCaseName_key_name_lowercase,
+                                        searchModuleByLowerCaseName_key_name),
+        SearchMemberDeclarationByName_key(SearchMemberDeclarationByName_key,
+                                          searchMemberDeclarationByName_key_name,
+                                          searchMemberDeclarationByName_key_parent,
+                                          searchMemberDeclarationByName_key_decl),
+        SearchMemberDeclarationByLowerCaseName_key(SearchMemberDeclarationByLowerCaseName_key,
+                                                   searchMemberDeclarationByLowerCaseName_key_name_lowercase,
+                                                   searchMemberDeclarationByLowerCaseName_key_name),
+        SearchDeclarationByName_key(SearchDeclarationByName_key,
+                                    searchDeclarationByName_key_name,
+                                    searchDeclarationByName_key_parent,
+                                    searchDeclarationByName_key_decl),
+        SearchDeclarationByLowerCaseName_key(SearchDeclarationByLowerCaseName_key,
+                                             searchDeclarationByLowerCaseName_key_name_lowercase,
+                                             searchDeclarationByLowerCaseName_key_name),
+        SearchByNameModule_key(SearchByNameModule_key,
+                               searchByNameModule_key_name, searchByNameModule_key_module),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_decl),
+        SearchByModuleName_key(SearchByModuleName_key,
+                               searchByModuleName_key_name, searchByModuleName_key_module),
+        SearchByModule_key(SearchByModule_key, searchByModule_key_string_,
+                           searchByModule_key_name, searchByModule_key_decl),
+        SearchByFileModule_key(SearchByFileModule_key,
+                               searchByFileModule_key_file, searchByFileModule_key_name,
+                               searchByFileModule_key_decl),
+        Range_key(Range_key, range_key_module, range_key_span),
+        ModuleTypeExport_key(ModuleTypeExport_key,
+                             moduleTypeExport_key_module, moduleTypeExport_key_typeExport),
+        ModuleNameLowerCase_key(ModuleNameLowerCase_key,
+                                moduleNameLowerCase_key_nameLowerCase,
+                                moduleNameLowerCase_key_name),
+        ModuleLocationByFile_key(ModuleLocationByFile_key,
+                                 moduleLocationByFile_key_file, moduleLocationByFile_key_module_,
+                                 moduleLocationByFile_key_span, moduleLocationByFile_key_name),
+        ModuleLocation_key(ModuleLocation_key, moduleLocation_key_module_,
+                           moduleLocation_key_file, moduleLocation_key_span,
+                           moduleLocation_key_name),
+        ModuleExport_key(ModuleExport_key, moduleExport_key_module,
+                         moduleExport_key_export_),
+        ModuleDoc_key(ModuleDoc_key, moduleDoc_key_documentation,
+                      moduleDoc_key_file),
+        ModuleContains_key(ModuleContains_key, moduleContains_key_module,
+                           moduleContains_key_member),
+        ModuleComments_key(ModuleComments_key, moduleComments_key_module,
+                           moduleComments_key_file, moduleComments_key_span),
+        Module_key(Module_key_EMPTY, Module_key_file, Module_key_builtin,
+                   Module_key_lib, Module_key_noSource, Module_key_string_),
+        MemberDeclarationReference_key(MemberDeclarationReference_key,
+                                       memberDeclarationReference_key_memberDeclaration,
+                                       memberDeclarationReference_key_loc),
+        MemberDeclarationInfo_key(MemberDeclarationInfo_key,
+                                  memberDeclarationInfo_key_memberDeclaration,
+                                  memberDeclarationInfo_key_type,
+                                  memberDeclarationInfo_key_documentation,
+                                  memberDeclarationInfo_key_span),
+        MemberDeclaration_key(MemberDeclaration_key,
+                              memberDeclaration_key_name, memberDeclaration_key_loc),
+        LocalDeclarationReference_key(LocalDeclarationReference_key,
+                                      localDeclarationReference_key_declaration,
+                                      localDeclarationReference_key_loc),
+        ImportDeclaration_import_(ImportDeclaration_import__EMPTY,
+                                  ImportDeclaration_import__moduleExport,
+                                  ImportDeclaration_import__moduleNamespace),
+        ImportDeclaration_key(ImportDeclaration_key,
+                              importDeclaration_key_declaration, importDeclaration_key_import_),
+        FlowXRefDeclInfo_key(FlowXRefDeclInfo_key,
+                             flowXRefDeclInfo_key_ref, flowXRefDeclInfo_key_srcLoc,
+                             flowXRefDeclInfo_key_name, flowXRefDeclInfo_key_targetLoc,
+                             flowXRefDeclInfo_key_entity),
+        FlowTypeImportXRef_key(FlowTypeImportXRef_key,
+                               flowTypeImportXRef_key_local, flowTypeImportXRef_key_entity,
+                               flowTypeImportXRef_key_targetFile,
+                               flowTypeImportXRef_key_targetSpan),
+        FlowTypeExportLocation_key(FlowTypeExportLocation_key,
+                                   flowTypeExportLocation_key_moduleTypeExport,
+                                   flowTypeExportLocation_key_entity,
+                                   flowTypeExportLocation_key_file,
+                                   flowTypeExportLocation_key_span),
+        FlowTypeEntityImportUses_key(FlowTypeEntityImportUses_key,
+                                     flowTypeEntityImportUses_key_target,
+                                     flowTypeEntityImportUses_key_local),
+        FlowSameModule_key(FlowSameModule_key, flowSameModule_key_left,
+                           flowSameModule_key_right),
+        FlowModuleNamespaceXRef_key(FlowModuleNamespaceXRef_key,
+                                    flowModuleNamespaceXRef_key_local,
+                                    flowModuleNamespaceXRef_key_entity,
+                                    flowModuleNamespaceXRef_key_file),
+        FlowImportXRef_key(FlowImportXRef_key, flowImportXRef_key_local,
+                           flowImportXRef_key_entity, flowImportXRef_key_targetFile,
+                           flowImportXRef_key_targetSpan),
+        FlowExportLocation_key(FlowExportLocation_key,
+                               flowExportLocation_key_module, flowExportLocation_key_export_,
+                               flowExportLocation_key_entity, flowExportLocation_key_file,
+                               flowExportLocation_key_span),
+        FlowEntityUsesAll_key(FlowEntityUsesAll_key,
+                              flowEntityUsesAll_key_target, flowEntityUsesAll_key_file,
+                              flowEntityUsesAll_key_span),
+        FlowEntityImportUses_key(FlowEntityImportUses_key,
+                                 flowEntityImportUses_key_target, flowEntityImportUses_key_local),
+        FlowCompatibleExport_key(FlowCompatibleExport_key,
+                                 flowCompatibleExport_key_left, flowCompatibleExport_key_right),
+        FileXRef_key(FileXRef_key, fileXRef_key_file, fileXRef_key_ref),
+        FileOfStringModule_key(FileOfStringModule_key,
+                               fileOfStringModule_key_file, fileOfStringModule_key_string_),
+        FileDeclaration_key(FileDeclaration_key, fileDeclaration_key_file,
+                            fileDeclaration_key_declaration),
+        Export_key(Export_key_EMPTY, Export_key_commonJS,
+                   Export_key_commonJSMember, Export_key_named, Export_key_default_,
+                   Export_key_star),
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_target, declarationUses_key_file,
+                            declarationUses_key_use),
+        DeclarationSignature_key(DeclarationSignature_key,
+                                 declarationSignature_key_decl, declarationSignature_key_signature),
+        DeclarationNameSpan_key(DeclarationNameSpan_key,
+                                declarationNameSpan_key_decl, declarationNameSpan_key_name,
+                                declarationNameSpan_key_span),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_decl, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationInfo_key(DeclarationInfo_key,
+                            declarationInfo_key_declaration, declarationInfo_key_type,
+                            declarationInfo_key_documentation, declarationInfo_key_span),
+        Declaration_key(Declaration_key, declaration_key_name,
+                        declaration_key_loc))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/flow_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 416 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Flow/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("SearchModuleByLowerCaseName", 3),
+       ("TypeDeclarationReference", 3), ("FlowTypeEntityImportUses", 3),
+       ("MemberDeclarationInfo", 3), ("TypeExport", 3), ("Export", 3),
+       ("FlowCompatibleExport", 3), ("DeclarationUses", 3),
+       ("SearchDeclarationByName", 3), ("FileXRef", 3),
+       ("TypeImportDeclaration", 3), ("SearchByNameModule", 3),
+       ("FlowXRefDeclInfo", 3), ("Range", 3), ("SearchByModule", 3),
+       ("SearchTypeDeclarationByLowerCaseName", 3),
+       ("DeclarationSignature", 3), ("SearchTypeByModuleExport", 3),
+       ("ModuleComments", 3), ("FlowExportLocation", 3),
+       ("FlowTypeExportLocation", 3), ("Type", 3),
+       ("SearchMemberDeclarationByLowerCaseName", 3),
+       ("ModuleLocationByFile", 3), ("SearchByFileModule", 3),
+       ("Documentation", 3), ("FlowSameModule", 3), ("ModuleContains", 3),
+       ("ImportDeclaration", 3), ("FlowModuleNamespaceXRef", 3),
+       ("FlowTypeImportXRef", 3), ("FlowImportXRef", 3),
+       ("SourceOfTypeExport", 3), ("TypeDeclarationInfo", 3),
+       ("DeclarationNameSpan", 3), ("DeclarationLocation", 3),
+       ("MemberDeclaration", 3), ("FlowEntityImportUses", 3),
+       ("SearchTypeDeclarationByName", 3), ("DeclarationInfo", 3),
+       ("SearchDeclarationByLowerCaseName", 3), ("ModuleTypeExport", 3),
+       ("Module", 3), ("ModuleNameLowerCase", 3), ("ModuleExport", 3),
+       ("Name", 3), ("FileOfStringModule", 3), ("SearchByModuleName", 3),
+       ("StringToFileModule", 3), ("ModuleDoc", 3),
+       ("FlowEntityUsesAll", 3), ("Declaration", 3),
+       ("ModuleLocation", 3), ("SearchMemberDeclarationByName", 3),
+       ("FileDeclaration", 3), ("MemberDeclarationReference", 3),
+       ("LocalDeclarationReference", 3), ("SearchByName", 3),
+       ("TypeDeclaration", 3), ("SourceOfExport", 3)]
+
+type TypeImportDeclaration_id = Glean.Id
+
+data TypeImportDeclaration = TypeImportDeclaration{typeImportDeclaration_id
+                                                   :: {-# UNPACK #-} !TypeImportDeclaration_id,
+                                                   typeImportDeclaration_key ::
+                                                   Prelude.Maybe TypeImportDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeImportDeclaration where
+  toJSON (TypeImportDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeImportDeclaration where
+  buildStruct _proxy (TypeImportDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TypeImportDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeImportDeclaration where
+  rnf (TypeImportDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeImportDeclaration where
+  def = TypeImportDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeImportDeclaration where
+  hashWithSalt __salt (TypeImportDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeExport_id = Glean.Id
+
+data TypeExport = TypeExport{typeExport_id ::
+                             {-# UNPACK #-} !TypeExport_id,
+                             typeExport_key :: Prelude.Maybe TypeExport_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeExport where
+  toJSON (TypeExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeExport where
+  buildStruct _proxy (TypeExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeExport where
+  rnf (TypeExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeExport where
+  def = TypeExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeExport where
+  hashWithSalt __salt (TypeExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeDeclarationReference_id = Glean.Id
+
+data TypeDeclarationReference = TypeDeclarationReference{typeDeclarationReference_id
+                                                         ::
+                                                         {-# UNPACK #-} !TypeDeclarationReference_id,
+                                                         typeDeclarationReference_key ::
+                                                         Prelude.Maybe TypeDeclarationReference_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclarationReference where
+  toJSON (TypeDeclarationReference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDeclarationReference where
+  buildStruct _proxy
+    (TypeDeclarationReference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TypeDeclarationReference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclarationReference where
+  rnf (TypeDeclarationReference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDeclarationReference where
+  def = TypeDeclarationReference Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDeclarationReference where
+  hashWithSalt __salt (TypeDeclarationReference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeDeclarationInfo_id = Glean.Id
+
+data TypeDeclarationInfo = TypeDeclarationInfo{typeDeclarationInfo_id
+                                               :: {-# UNPACK #-} !TypeDeclarationInfo_id,
+                                               typeDeclarationInfo_key ::
+                                               Prelude.Maybe TypeDeclarationInfo_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclarationInfo where
+  toJSON (TypeDeclarationInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDeclarationInfo where
+  buildStruct _proxy (TypeDeclarationInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeDeclarationInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclarationInfo where
+  rnf (TypeDeclarationInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDeclarationInfo where
+  def = TypeDeclarationInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDeclarationInfo where
+  hashWithSalt __salt (TypeDeclarationInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeDeclaration_id = Glean.Id
+
+data TypeDeclaration = TypeDeclaration{typeDeclaration_id ::
+                                       {-# UNPACK #-} !TypeDeclaration_id,
+                                       typeDeclaration_key :: Prelude.Maybe TypeDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclaration where
+  toJSON (TypeDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDeclaration where
+  buildStruct _proxy (TypeDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclaration where
+  rnf (TypeDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeDeclaration where
+  def = TypeDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeDeclaration where
+  hashWithSalt __salt (TypeDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StringToFileModule_id = Glean.Id
+
+data StringToFileModule = StringToFileModule{stringToFileModule_id
+                                             :: {-# UNPACK #-} !StringToFileModule_id,
+                                             stringToFileModule_key ::
+                                             Prelude.Maybe StringToFileModule_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringToFileModule where
+  toJSON (StringToFileModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StringToFileModule where
+  buildStruct _proxy (StringToFileModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StringToFileModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringToFileModule where
+  rnf (StringToFileModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StringToFileModule where
+  def = StringToFileModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable StringToFileModule where
+  hashWithSalt __salt (StringToFileModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SourceOfTypeExport_id = Glean.Id
+
+data SourceOfTypeExport = SourceOfTypeExport{sourceOfTypeExport_id
+                                             :: {-# UNPACK #-} !SourceOfTypeExport_id,
+                                             sourceOfTypeExport_key ::
+                                             Prelude.Maybe SourceOfTypeExport_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfTypeExport where
+  toJSON (SourceOfTypeExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceOfTypeExport where
+  buildStruct _proxy (SourceOfTypeExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SourceOfTypeExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceOfTypeExport where
+  rnf (SourceOfTypeExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SourceOfTypeExport where
+  def = SourceOfTypeExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable SourceOfTypeExport where
+  hashWithSalt __salt (SourceOfTypeExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SourceOfExport_id = Glean.Id
+
+data SourceOfExport = SourceOfExport{sourceOfExport_id ::
+                                     {-# UNPACK #-} !SourceOfExport_id,
+                                     sourceOfExport_key :: Prelude.Maybe SourceOfExport_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfExport where
+  toJSON (SourceOfExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceOfExport where
+  buildStruct _proxy (SourceOfExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SourceOfExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceOfExport where
+  rnf (SourceOfExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SourceOfExport where
+  def = SourceOfExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable SourceOfExport where
+  hashWithSalt __salt (SourceOfExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypeDeclarationByName_id = Glean.Id
+
+data SearchTypeDeclarationByName = SearchTypeDeclarationByName{searchTypeDeclarationByName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchTypeDeclarationByName_id,
+                                                               searchTypeDeclarationByName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchTypeDeclarationByName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeDeclarationByName where
+  toJSON (SearchTypeDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeDeclarationByName where
+  buildStruct _proxy
+    (SearchTypeDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeDeclarationByName where
+  rnf (SearchTypeDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeDeclarationByName where
+  def = SearchTypeDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeDeclarationByName where
+  hashWithSalt __salt (SearchTypeDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypeDeclarationByLowerCaseName_id = Glean.Id
+
+data SearchTypeDeclarationByLowerCaseName = SearchTypeDeclarationByLowerCaseName{searchTypeDeclarationByLowerCaseName_id
+                                                                                 ::
+                                                                                 {-# UNPACK #-} !SearchTypeDeclarationByLowerCaseName_id,
+                                                                                 searchTypeDeclarationByLowerCaseName_key
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   SearchTypeDeclarationByLowerCaseName_key}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeDeclarationByLowerCaseName where
+  toJSON
+    (SearchTypeDeclarationByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeDeclarationByLowerCaseName
+         where
+  buildStruct _proxy
+    (SearchTypeDeclarationByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeDeclarationByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeDeclarationByLowerCaseName where
+  rnf (SearchTypeDeclarationByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeDeclarationByLowerCaseName where
+  def
+    = SearchTypeDeclarationByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeDeclarationByLowerCaseName
+         where
+  hashWithSalt __salt (SearchTypeDeclarationByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypeByModuleExport_id = Glean.Id
+
+data SearchTypeByModuleExport = SearchTypeByModuleExport{searchTypeByModuleExport_id
+                                                         ::
+                                                         {-# UNPACK #-} !SearchTypeByModuleExport_id,
+                                                         searchTypeByModuleExport_key ::
+                                                         Prelude.Maybe SearchTypeByModuleExport_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeByModuleExport where
+  toJSON (SearchTypeByModuleExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeByModuleExport where
+  buildStruct _proxy
+    (SearchTypeByModuleExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeByModuleExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeByModuleExport where
+  rnf (SearchTypeByModuleExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeByModuleExport where
+  def = SearchTypeByModuleExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeByModuleExport where
+  hashWithSalt __salt (SearchTypeByModuleExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModuleByLowerCaseName_id = Glean.Id
+
+data SearchModuleByLowerCaseName = SearchModuleByLowerCaseName{searchModuleByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchModuleByLowerCaseName_id,
+                                                               searchModuleByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchModuleByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName where
+  toJSON (SearchModuleByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName where
+  rnf (SearchModuleByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName where
+  def = SearchModuleByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModuleByLowerCaseName where
+  hashWithSalt __salt (SearchModuleByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMemberDeclarationByName_id = Glean.Id
+
+data SearchMemberDeclarationByName = SearchMemberDeclarationByName{searchMemberDeclarationByName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchMemberDeclarationByName_id,
+                                                                   searchMemberDeclarationByName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchMemberDeclarationByName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMemberDeclarationByName where
+  toJSON (SearchMemberDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMemberDeclarationByName where
+  buildStruct _proxy
+    (SearchMemberDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchMemberDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMemberDeclarationByName where
+  rnf (SearchMemberDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMemberDeclarationByName where
+  def = SearchMemberDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchMemberDeclarationByName where
+  hashWithSalt __salt (SearchMemberDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMemberDeclarationByLowerCaseName_id = Glean.Id
+
+data SearchMemberDeclarationByLowerCaseName = SearchMemberDeclarationByLowerCaseName{searchMemberDeclarationByLowerCaseName_id
+                                                                                     ::
+                                                                                     {-# UNPACK #-} !SearchMemberDeclarationByLowerCaseName_id,
+                                                                                     searchMemberDeclarationByLowerCaseName_key
+                                                                                     ::
+                                                                                     Prelude.Maybe
+                                                                                       SearchMemberDeclarationByLowerCaseName_key}
+                                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMemberDeclarationByLowerCaseName where
+  toJSON
+    (SearchMemberDeclarationByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMemberDeclarationByLowerCaseName
+         where
+  buildStruct _proxy
+    (SearchMemberDeclarationByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchMemberDeclarationByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMemberDeclarationByLowerCaseName
+         where
+  rnf
+    (SearchMemberDeclarationByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMemberDeclarationByLowerCaseName
+         where
+  def
+    = SearchMemberDeclarationByLowerCaseName Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable SearchMemberDeclarationByLowerCaseName
+         where
+  hashWithSalt __salt
+    (SearchMemberDeclarationByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchDeclarationByName_id = Glean.Id
+
+data SearchDeclarationByName = SearchDeclarationByName{searchDeclarationByName_id
+                                                       ::
+                                                       {-# UNPACK #-} !SearchDeclarationByName_id,
+                                                       searchDeclarationByName_key ::
+                                                       Prelude.Maybe SearchDeclarationByName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDeclarationByName where
+  toJSON (SearchDeclarationByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDeclarationByName where
+  buildStruct _proxy
+    (SearchDeclarationByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchDeclarationByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDeclarationByName where
+  rnf (SearchDeclarationByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchDeclarationByName where
+  def = SearchDeclarationByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchDeclarationByName where
+  hashWithSalt __salt (SearchDeclarationByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchDeclarationByLowerCaseName_id = Glean.Id
+
+data SearchDeclarationByLowerCaseName = SearchDeclarationByLowerCaseName{searchDeclarationByLowerCaseName_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !SearchDeclarationByLowerCaseName_id,
+                                                                         searchDeclarationByLowerCaseName_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           SearchDeclarationByLowerCaseName_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDeclarationByLowerCaseName where
+  toJSON (SearchDeclarationByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDeclarationByLowerCaseName where
+  buildStruct _proxy
+    (SearchDeclarationByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchDeclarationByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDeclarationByLowerCaseName where
+  rnf (SearchDeclarationByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchDeclarationByLowerCaseName where
+  def = SearchDeclarationByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchDeclarationByLowerCaseName where
+  hashWithSalt __salt (SearchDeclarationByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByNameModule_id = Glean.Id
+
+data SearchByNameModule = SearchByNameModule{searchByNameModule_id
+                                             :: {-# UNPACK #-} !SearchByNameModule_id,
+                                             searchByNameModule_key ::
+                                             Prelude.Maybe SearchByNameModule_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameModule where
+  toJSON (SearchByNameModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameModule where
+  buildStruct _proxy (SearchByNameModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByNameModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameModule where
+  rnf (SearchByNameModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByNameModule where
+  def = SearchByNameModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByNameModule where
+  hashWithSalt __salt (SearchByNameModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByModuleName_id = Glean.Id
+
+data SearchByModuleName = SearchByModuleName{searchByModuleName_id
+                                             :: {-# UNPACK #-} !SearchByModuleName_id,
+                                             searchByModuleName_key ::
+                                             Prelude.Maybe SearchByModuleName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByModuleName where
+  toJSON (SearchByModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByModuleName where
+  buildStruct _proxy (SearchByModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByModuleName where
+  rnf (SearchByModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByModuleName where
+  def = SearchByModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByModuleName where
+  hashWithSalt __salt (SearchByModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByModule_id = Glean.Id
+
+data SearchByModule = SearchByModule{searchByModule_id ::
+                                     {-# UNPACK #-} !SearchByModule_id,
+                                     searchByModule_key :: Prelude.Maybe SearchByModule_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByModule where
+  toJSON (SearchByModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByModule where
+  buildStruct _proxy (SearchByModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByModule where
+  rnf (SearchByModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByModule where
+  def = SearchByModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByModule where
+  hashWithSalt __salt (SearchByModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByFileModule_id = Glean.Id
+
+data SearchByFileModule = SearchByFileModule{searchByFileModule_id
+                                             :: {-# UNPACK #-} !SearchByFileModule_id,
+                                             searchByFileModule_key ::
+                                             Prelude.Maybe SearchByFileModule_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFileModule where
+  toJSON (SearchByFileModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByFileModule where
+  buildStruct _proxy (SearchByFileModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByFileModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFileModule where
+  rnf (SearchByFileModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByFileModule where
+  def = SearchByFileModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByFileModule where
+  hashWithSalt __salt (SearchByFileModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Range_id = Glean.Id
+
+data Range = Range{range_id :: {-# UNPACK #-} !Range_id,
+                   range_key :: Prelude.Maybe Range_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range where
+  toJSON (Range __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Range where
+  buildStruct _proxy (Range __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Range __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Range where
+  rnf (Range __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Range where
+  def = Range Default.def Prelude.Nothing
+
+instance Hashable.Hashable Range where
+  hashWithSalt __salt (Range _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleTypeExport_id = Glean.Id
+
+data ModuleTypeExport = ModuleTypeExport{moduleTypeExport_id ::
+                                         {-# UNPACK #-} !ModuleTypeExport_id,
+                                         moduleTypeExport_key :: Prelude.Maybe ModuleTypeExport_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleTypeExport where
+  toJSON (ModuleTypeExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleTypeExport where
+  buildStruct _proxy (ModuleTypeExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleTypeExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleTypeExport where
+  rnf (ModuleTypeExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleTypeExport where
+  def = ModuleTypeExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleTypeExport where
+  hashWithSalt __salt (ModuleTypeExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleNameLowerCase_id = Glean.Id
+
+data ModuleNameLowerCase = ModuleNameLowerCase{moduleNameLowerCase_id
+                                               :: {-# UNPACK #-} !ModuleNameLowerCase_id,
+                                               moduleNameLowerCase_key ::
+                                               Prelude.Maybe ModuleNameLowerCase_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleNameLowerCase where
+  toJSON (ModuleNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleNameLowerCase where
+  buildStruct _proxy (ModuleNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleNameLowerCase where
+  rnf (ModuleNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleNameLowerCase where
+  def = ModuleNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleNameLowerCase where
+  hashWithSalt __salt (ModuleNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleLocationByFile_id = Glean.Id
+
+data ModuleLocationByFile = ModuleLocationByFile{moduleLocationByFile_id
+                                                 :: {-# UNPACK #-} !ModuleLocationByFile_id,
+                                                 moduleLocationByFile_key ::
+                                                 Prelude.Maybe ModuleLocationByFile_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleLocationByFile where
+  toJSON (ModuleLocationByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleLocationByFile where
+  buildStruct _proxy (ModuleLocationByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ModuleLocationByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleLocationByFile where
+  rnf (ModuleLocationByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleLocationByFile where
+  def = ModuleLocationByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleLocationByFile where
+  hashWithSalt __salt (ModuleLocationByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleLocation_id = Glean.Id
+
+data ModuleLocation = ModuleLocation{moduleLocation_id ::
+                                     {-# UNPACK #-} !ModuleLocation_id,
+                                     moduleLocation_key :: Prelude.Maybe ModuleLocation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleLocation where
+  toJSON (ModuleLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleLocation where
+  buildStruct _proxy (ModuleLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleLocation where
+  rnf (ModuleLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleLocation where
+  def = ModuleLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleLocation where
+  hashWithSalt __salt (ModuleLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleExport_id = Glean.Id
+
+data ModuleExport = ModuleExport{moduleExport_id ::
+                                 {-# UNPACK #-} !ModuleExport_id,
+                                 moduleExport_key :: Prelude.Maybe ModuleExport_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleExport where
+  toJSON (ModuleExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleExport where
+  buildStruct _proxy (ModuleExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleExport where
+  rnf (ModuleExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleExport where
+  def = ModuleExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleExport where
+  hashWithSalt __salt (ModuleExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleDoc_id = Glean.Id
+
+data ModuleDoc = ModuleDoc{moduleDoc_id ::
+                           {-# UNPACK #-} !ModuleDoc_id,
+                           moduleDoc_key :: Prelude.Maybe ModuleDoc_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDoc where
+  toJSON (ModuleDoc __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDoc where
+  buildStruct _proxy (ModuleDoc __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleDoc __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDoc where
+  rnf (ModuleDoc __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleDoc where
+  def = ModuleDoc Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleDoc where
+  hashWithSalt __salt (ModuleDoc _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleContains_id = Glean.Id
+
+data ModuleContains = ModuleContains{moduleContains_id ::
+                                     {-# UNPACK #-} !ModuleContains_id,
+                                     moduleContains_key :: Prelude.Maybe ModuleContains_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleContains where
+  toJSON (ModuleContains __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleContains where
+  buildStruct _proxy (ModuleContains __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleContains __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleContains where
+  rnf (ModuleContains __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleContains where
+  def = ModuleContains Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleContains where
+  hashWithSalt __salt (ModuleContains _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleComments_id = Glean.Id
+
+data ModuleComments = ModuleComments{moduleComments_id ::
+                                     {-# UNPACK #-} !ModuleComments_id,
+                                     moduleComments_key :: Prelude.Maybe ModuleComments_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleComments where
+  toJSON (ModuleComments __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleComments where
+  buildStruct _proxy (ModuleComments __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleComments __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleComments where
+  rnf (ModuleComments __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleComments where
+  def = ModuleComments Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleComments where
+  hashWithSalt __salt (ModuleComments _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Module_id = Glean.Id
+
+data Module = Module{module_id :: {-# UNPACK #-} !Module_id,
+                     module_key :: Prelude.Maybe Module_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module where
+  toJSON (Module __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Module where
+  buildStruct _proxy (Module __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Module __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Module where
+  rnf (Module __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Module where
+  def = Module Default.def Prelude.Nothing
+
+instance Hashable.Hashable Module where
+  hashWithSalt __salt (Module _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MemberDeclarationReference_id = Glean.Id
+
+data MemberDeclarationReference = MemberDeclarationReference{memberDeclarationReference_id
+                                                             ::
+                                                             {-# UNPACK #-} !MemberDeclarationReference_id,
+                                                             memberDeclarationReference_key ::
+                                                             Prelude.Maybe
+                                                               MemberDeclarationReference_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclarationReference where
+  toJSON (MemberDeclarationReference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberDeclarationReference where
+  buildStruct _proxy
+    (MemberDeclarationReference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MemberDeclarationReference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclarationReference where
+  rnf (MemberDeclarationReference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MemberDeclarationReference where
+  def = MemberDeclarationReference Default.def Prelude.Nothing
+
+instance Hashable.Hashable MemberDeclarationReference where
+  hashWithSalt __salt (MemberDeclarationReference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MemberDeclarationInfo_id = Glean.Id
+
+data MemberDeclarationInfo = MemberDeclarationInfo{memberDeclarationInfo_id
+                                                   :: {-# UNPACK #-} !MemberDeclarationInfo_id,
+                                                   memberDeclarationInfo_key ::
+                                                   Prelude.Maybe MemberDeclarationInfo_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclarationInfo where
+  toJSON (MemberDeclarationInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberDeclarationInfo where
+  buildStruct _proxy (MemberDeclarationInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MemberDeclarationInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclarationInfo where
+  rnf (MemberDeclarationInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MemberDeclarationInfo where
+  def = MemberDeclarationInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable MemberDeclarationInfo where
+  hashWithSalt __salt (MemberDeclarationInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MemberDeclaration_id = Glean.Id
+
+data MemberDeclaration = MemberDeclaration{memberDeclaration_id ::
+                                           {-# UNPACK #-} !MemberDeclaration_id,
+                                           memberDeclaration_key ::
+                                           Prelude.Maybe MemberDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclaration where
+  toJSON (MemberDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberDeclaration where
+  buildStruct _proxy (MemberDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MemberDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclaration where
+  rnf (MemberDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MemberDeclaration where
+  def = MemberDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MemberDeclaration where
+  hashWithSalt __salt (MemberDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocalDeclarationReference_id = Glean.Id
+
+data LocalDeclarationReference = LocalDeclarationReference{localDeclarationReference_id
+                                                           ::
+                                                           {-# UNPACK #-} !LocalDeclarationReference_id,
+                                                           localDeclarationReference_key ::
+                                                           Prelude.Maybe
+                                                             LocalDeclarationReference_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalDeclarationReference where
+  toJSON (LocalDeclarationReference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalDeclarationReference where
+  buildStruct _proxy
+    (LocalDeclarationReference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LocalDeclarationReference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalDeclarationReference where
+  rnf (LocalDeclarationReference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocalDeclarationReference where
+  def = LocalDeclarationReference Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocalDeclarationReference where
+  hashWithSalt __salt (LocalDeclarationReference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportDeclaration_id = Glean.Id
+
+data ImportDeclaration = ImportDeclaration{importDeclaration_id ::
+                                           {-# UNPACK #-} !ImportDeclaration_id,
+                                           importDeclaration_key ::
+                                           Prelude.Maybe ImportDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportDeclaration where
+  toJSON (ImportDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportDeclaration where
+  buildStruct _proxy (ImportDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportDeclaration where
+  rnf (ImportDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportDeclaration where
+  def = ImportDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportDeclaration where
+  hashWithSalt __salt (ImportDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowXRefDeclInfo_id = Glean.Id
+
+data FlowXRefDeclInfo = FlowXRefDeclInfo{flowXRefDeclInfo_id ::
+                                         {-# UNPACK #-} !FlowXRefDeclInfo_id,
+                                         flowXRefDeclInfo_key :: Prelude.Maybe FlowXRefDeclInfo_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowXRefDeclInfo where
+  toJSON (FlowXRefDeclInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowXRefDeclInfo where
+  buildStruct _proxy (FlowXRefDeclInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowXRefDeclInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowXRefDeclInfo where
+  rnf (FlowXRefDeclInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowXRefDeclInfo where
+  def = FlowXRefDeclInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowXRefDeclInfo where
+  hashWithSalt __salt (FlowXRefDeclInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowTypeImportXRef_id = Glean.Id
+
+data FlowTypeImportXRef = FlowTypeImportXRef{flowTypeImportXRef_id
+                                             :: {-# UNPACK #-} !FlowTypeImportXRef_id,
+                                             flowTypeImportXRef_key ::
+                                             Prelude.Maybe FlowTypeImportXRef_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeImportXRef where
+  toJSON (FlowTypeImportXRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeImportXRef where
+  buildStruct _proxy (FlowTypeImportXRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowTypeImportXRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeImportXRef where
+  rnf (FlowTypeImportXRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowTypeImportXRef where
+  def = FlowTypeImportXRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowTypeImportXRef where
+  hashWithSalt __salt (FlowTypeImportXRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowTypeExportLocation_id = Glean.Id
+
+data FlowTypeExportLocation = FlowTypeExportLocation{flowTypeExportLocation_id
+                                                     :: {-# UNPACK #-} !FlowTypeExportLocation_id,
+                                                     flowTypeExportLocation_key ::
+                                                     Prelude.Maybe FlowTypeExportLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeExportLocation where
+  toJSON (FlowTypeExportLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeExportLocation where
+  buildStruct _proxy
+    (FlowTypeExportLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowTypeExportLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeExportLocation where
+  rnf (FlowTypeExportLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowTypeExportLocation where
+  def = FlowTypeExportLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowTypeExportLocation where
+  hashWithSalt __salt (FlowTypeExportLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowTypeEntityImportUses_id = Glean.Id
+
+data FlowTypeEntityImportUses = FlowTypeEntityImportUses{flowTypeEntityImportUses_id
+                                                         ::
+                                                         {-# UNPACK #-} !FlowTypeEntityImportUses_id,
+                                                         flowTypeEntityImportUses_key ::
+                                                         Prelude.Maybe FlowTypeEntityImportUses_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeEntityImportUses where
+  toJSON (FlowTypeEntityImportUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeEntityImportUses where
+  buildStruct _proxy
+    (FlowTypeEntityImportUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowTypeEntityImportUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeEntityImportUses where
+  rnf (FlowTypeEntityImportUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowTypeEntityImportUses where
+  def = FlowTypeEntityImportUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowTypeEntityImportUses where
+  hashWithSalt __salt (FlowTypeEntityImportUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowSameModule_id = Glean.Id
+
+data FlowSameModule = FlowSameModule{flowSameModule_id ::
+                                     {-# UNPACK #-} !FlowSameModule_id,
+                                     flowSameModule_key :: Prelude.Maybe FlowSameModule_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSameModule where
+  toJSON (FlowSameModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowSameModule where
+  buildStruct _proxy (FlowSameModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowSameModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSameModule where
+  rnf (FlowSameModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowSameModule where
+  def = FlowSameModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowSameModule where
+  hashWithSalt __salt (FlowSameModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowModuleNamespaceXRef_id = Glean.Id
+
+data FlowModuleNamespaceXRef = FlowModuleNamespaceXRef{flowModuleNamespaceXRef_id
+                                                       ::
+                                                       {-# UNPACK #-} !FlowModuleNamespaceXRef_id,
+                                                       flowModuleNamespaceXRef_key ::
+                                                       Prelude.Maybe FlowModuleNamespaceXRef_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowModuleNamespaceXRef where
+  toJSON (FlowModuleNamespaceXRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowModuleNamespaceXRef where
+  buildStruct _proxy
+    (FlowModuleNamespaceXRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowModuleNamespaceXRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowModuleNamespaceXRef where
+  rnf (FlowModuleNamespaceXRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowModuleNamespaceXRef where
+  def = FlowModuleNamespaceXRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowModuleNamespaceXRef where
+  hashWithSalt __salt (FlowModuleNamespaceXRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowImportXRef_id = Glean.Id
+
+data FlowImportXRef = FlowImportXRef{flowImportXRef_id ::
+                                     {-# UNPACK #-} !FlowImportXRef_id,
+                                     flowImportXRef_key :: Prelude.Maybe FlowImportXRef_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowImportXRef where
+  toJSON (FlowImportXRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowImportXRef where
+  buildStruct _proxy (FlowImportXRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowImportXRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowImportXRef where
+  rnf (FlowImportXRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowImportXRef where
+  def = FlowImportXRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowImportXRef where
+  hashWithSalt __salt (FlowImportXRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowExportLocation_id = Glean.Id
+
+data FlowExportLocation = FlowExportLocation{flowExportLocation_id
+                                             :: {-# UNPACK #-} !FlowExportLocation_id,
+                                             flowExportLocation_key ::
+                                             Prelude.Maybe FlowExportLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowExportLocation where
+  toJSON (FlowExportLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowExportLocation where
+  buildStruct _proxy (FlowExportLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowExportLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowExportLocation where
+  rnf (FlowExportLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowExportLocation where
+  def = FlowExportLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowExportLocation where
+  hashWithSalt __salt (FlowExportLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityUsesAll_id = Glean.Id
+
+data FlowEntityUsesAll = FlowEntityUsesAll{flowEntityUsesAll_id ::
+                                           {-# UNPACK #-} !FlowEntityUsesAll_id,
+                                           flowEntityUsesAll_key ::
+                                           Prelude.Maybe FlowEntityUsesAll_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityUsesAll where
+  toJSON (FlowEntityUsesAll __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityUsesAll where
+  buildStruct _proxy (FlowEntityUsesAll __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowEntityUsesAll __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityUsesAll where
+  rnf (FlowEntityUsesAll __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityUsesAll where
+  def = FlowEntityUsesAll Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityUsesAll where
+  hashWithSalt __salt (FlowEntityUsesAll _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowEntityImportUses_id = Glean.Id
+
+data FlowEntityImportUses = FlowEntityImportUses{flowEntityImportUses_id
+                                                 :: {-# UNPACK #-} !FlowEntityImportUses_id,
+                                                 flowEntityImportUses_key ::
+                                                 Prelude.Maybe FlowEntityImportUses_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityImportUses where
+  toJSON (FlowEntityImportUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityImportUses where
+  buildStruct _proxy (FlowEntityImportUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowEntityImportUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityImportUses where
+  rnf (FlowEntityImportUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowEntityImportUses where
+  def = FlowEntityImportUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowEntityImportUses where
+  hashWithSalt __salt (FlowEntityImportUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowCompatibleExport_id = Glean.Id
+
+data FlowCompatibleExport = FlowCompatibleExport{flowCompatibleExport_id
+                                                 :: {-# UNPACK #-} !FlowCompatibleExport_id,
+                                                 flowCompatibleExport_key ::
+                                                 Prelude.Maybe FlowCompatibleExport_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowCompatibleExport where
+  toJSON (FlowCompatibleExport __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowCompatibleExport where
+  buildStruct _proxy (FlowCompatibleExport __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowCompatibleExport __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowCompatibleExport where
+  rnf (FlowCompatibleExport __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowCompatibleExport where
+  def = FlowCompatibleExport Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowCompatibleExport where
+  hashWithSalt __salt (FlowCompatibleExport _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRef_id = Glean.Id
+
+data FileXRef = FileXRef{fileXRef_id ::
+                         {-# UNPACK #-} !FileXRef_id,
+                         fileXRef_key :: Prelude.Maybe FileXRef_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRef where
+  toJSON (FileXRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRef where
+  buildStruct _proxy (FileXRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRef where
+  rnf (FileXRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRef where
+  def = FileXRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRef where
+  hashWithSalt __salt (FileXRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileOfStringModule_id = Glean.Id
+
+data FileOfStringModule = FileOfStringModule{fileOfStringModule_id
+                                             :: {-# UNPACK #-} !FileOfStringModule_id,
+                                             fileOfStringModule_key ::
+                                             Prelude.Maybe FileOfStringModule_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileOfStringModule where
+  toJSON (FileOfStringModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileOfStringModule where
+  buildStruct _proxy (FileOfStringModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileOfStringModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileOfStringModule where
+  rnf (FileOfStringModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileOfStringModule where
+  def = FileOfStringModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileOfStringModule where
+  hashWithSalt __salt (FileOfStringModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclaration_id = Glean.Id
+
+data FileDeclaration = FileDeclaration{fileDeclaration_id ::
+                                       {-# UNPACK #-} !FileDeclaration_id,
+                                       fileDeclaration_key :: Prelude.Maybe FileDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclaration where
+  toJSON (FileDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclaration where
+  buildStruct _proxy (FileDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclaration where
+  rnf (FileDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclaration where
+  def = FileDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclaration where
+  hashWithSalt __salt (FileDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Export_id = Glean.Id
+
+data Export = Export{export_id :: {-# UNPACK #-} !Export_id,
+                     export_key :: Prelude.Maybe Export_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Export where
+  toJSON (Export __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Export where
+  buildStruct _proxy (Export __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Export __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Export where
+  rnf (Export __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Export where
+  def = Export Default.def Prelude.Nothing
+
+instance Hashable.Hashable Export where
+  hashWithSalt __salt (Export _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Documentation_id = Glean.Id
+
+data Documentation = Documentation{documentation_id ::
+                                   {-# UNPACK #-} !Documentation_id,
+                                   documentation_key :: Prelude.Maybe Range}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Documentation where
+  toJSON (Documentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Documentation where
+  buildStruct _proxy (Documentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Documentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Documentation where
+  rnf (Documentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Documentation where
+  def = Documentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable Documentation where
+  hashWithSalt __salt (Documentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSignature_id = Glean.Id
+
+data DeclarationSignature = DeclarationSignature{declarationSignature_id
+                                                 :: {-# UNPACK #-} !DeclarationSignature_id,
+                                                 declarationSignature_key ::
+                                                 Prelude.Maybe DeclarationSignature_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSignature where
+  toJSON (DeclarationSignature __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSignature where
+  buildStruct _proxy (DeclarationSignature __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationSignature __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSignature where
+  rnf (DeclarationSignature __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSignature where
+  def = DeclarationSignature Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSignature where
+  hashWithSalt __salt (DeclarationSignature _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationNameSpan_id = Glean.Id
+
+data DeclarationNameSpan = DeclarationNameSpan{declarationNameSpan_id
+                                               :: {-# UNPACK #-} !DeclarationNameSpan_id,
+                                               declarationNameSpan_key ::
+                                               Prelude.Maybe DeclarationNameSpan_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan where
+  toJSON (DeclarationNameSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan where
+  buildStruct _proxy (DeclarationNameSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationNameSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan where
+  rnf (DeclarationNameSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan where
+  def = DeclarationNameSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationNameSpan where
+  hashWithSalt __salt (DeclarationNameSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationInfo_id = Glean.Id
+
+data DeclarationInfo = DeclarationInfo{declarationInfo_id ::
+                                       {-# UNPACK #-} !DeclarationInfo_id,
+                                       declarationInfo_key :: Prelude.Maybe DeclarationInfo_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationInfo where
+  toJSON (DeclarationInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationInfo where
+  buildStruct _proxy (DeclarationInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationInfo where
+  rnf (DeclarationInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationInfo where
+  def = DeclarationInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationInfo where
+  hashWithSalt __salt (DeclarationInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Declaration_id = Glean.Id
+
+data Declaration = Declaration{declaration_id ::
+                               {-# UNPACK #-} !Declaration_id,
+                               declaration_key :: Prelude.Maybe Declaration_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Declaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Declaration where
+  def = Declaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRef = XRef_localRef LocalDeclarationReference
+          | XRef_memberRef MemberDeclarationReference
+          | XRef_typeRef TypeDeclarationReference
+          | XRef_EMPTY
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef_localRef __localRef)
+    = Aeson.object ["localRef" .= __localRef]
+  toJSON (XRef_memberRef __memberRef)
+    = Aeson.object ["memberRef" .= __memberRef]
+  toJSON (XRef_typeRef __typeRef)
+    = Aeson.object ["typeRef" .= __typeRef]
+  toJSON XRef_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef_localRef __localRef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "localRef" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __localRef)]
+  buildStruct _proxy (XRef_memberRef __memberRef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "memberRef" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __memberRef)]
+  buildStruct _proxy (XRef_typeRef __typeRef)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeRef" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __typeRef)]
+  buildStruct _proxy XRef_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRef_localRef _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRef_memberRef _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRef_typeRef _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRef_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRef_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("localRef", 1), ("memberRef", 2), ("typeRef", 3)]
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef_localRef __localRef) = DeepSeq.rnf __localRef
+  rnf (XRef_memberRef __memberRef) = DeepSeq.rnf __memberRef
+  rnf (XRef_typeRef __typeRef) = DeepSeq.rnf __typeRef
+  rnf XRef_EMPTY = ()
+
+instance Default.Default XRef where
+  def = XRef_EMPTY
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef_localRef _localRef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _localRef)
+  hashWithSalt __salt (XRef_memberRef _memberRef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _memberRef)
+  hashWithSalt __salt (XRef_typeRef _typeRef)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _typeRef)
+  hashWithSalt __salt XRef_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypeImportDeclaration_import_ = TypeImportDeclaration_import__type ModuleTypeExport
+                                   | TypeImportDeclaration_import__typeof_ ModuleExport
+                                   | TypeImportDeclaration_import__moduleTypeof Module
+                                   | TypeImportDeclaration_import__EMPTY
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeImportDeclaration_import_ where
+  toJSON (TypeImportDeclaration_import__type __type)
+    = Aeson.object ["type" .= __type]
+  toJSON (TypeImportDeclaration_import__typeof_ __typeof_)
+    = Aeson.object ["typeof_" .= __typeof_]
+  toJSON (TypeImportDeclaration_import__moduleTypeof __moduleTypeof)
+    = Aeson.object ["moduleTypeof" .= __moduleTypeof]
+  toJSON TypeImportDeclaration_import__EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TypeImportDeclaration_import_ where
+  buildStruct _proxy (TypeImportDeclaration_import__type __type)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __type)]
+  buildStruct _proxy
+    (TypeImportDeclaration_import__typeof_ __typeof_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeof_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __typeof_)]
+  buildStruct _proxy
+    (TypeImportDeclaration_import__moduleTypeof __moduleTypeof)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleTypeof"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __moduleTypeof)]
+  buildStruct _proxy TypeImportDeclaration_import__EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeImportDeclaration_import__type
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeImportDeclaration_import__typeof_
+                                                                 _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeImportDeclaration_import__moduleTypeof
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               TypeImportDeclaration_import__EMPTY
+           Thrift.FieldEnd -> Prelude.return
+                                TypeImportDeclaration_import__EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("type", 1), ("typeof_", 2), ("moduleTypeof", 3)]
+
+instance DeepSeq.NFData TypeImportDeclaration_import_ where
+  rnf (TypeImportDeclaration_import__type __type)
+    = DeepSeq.rnf __type
+  rnf (TypeImportDeclaration_import__typeof_ __typeof_)
+    = DeepSeq.rnf __typeof_
+  rnf (TypeImportDeclaration_import__moduleTypeof __moduleTypeof)
+    = DeepSeq.rnf __moduleTypeof
+  rnf TypeImportDeclaration_import__EMPTY = ()
+
+instance Default.Default TypeImportDeclaration_import_ where
+  def = TypeImportDeclaration_import__EMPTY
+
+instance Hashable.Hashable TypeImportDeclaration_import_ where
+  hashWithSalt __salt (TypeImportDeclaration_import__type _type)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _type)
+  hashWithSalt __salt
+    (TypeImportDeclaration_import__typeof_ _typeof_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _typeof_)
+  hashWithSalt __salt
+    (TypeImportDeclaration_import__moduleTypeof _moduleTypeof)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _moduleTypeof)
+  hashWithSalt __salt TypeImportDeclaration_import__EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypeImportDeclaration_key = TypeImportDeclaration_key{typeImportDeclaration_key_typeDeclaration
+                                                           :: TypeDeclaration,
+                                                           typeImportDeclaration_key_import_ ::
+                                                           TypeImportDeclaration_import_}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeImportDeclaration_key where
+  toJSON
+    (TypeImportDeclaration_key __field__typeDeclaration
+       __field__import_)
+    = Aeson.object
+        ("typeDeclaration" .= __field__typeDeclaration :
+           "import_" .= __field__import_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeImportDeclaration_key where
+  buildStruct _proxy
+    (TypeImportDeclaration_key __field__typeDeclaration
+       __field__import_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "typeDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__typeDeclaration)
+           :
+           Thrift.genField _proxy "import_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__import_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__typeDeclaration <- ST.newSTRef Default.def
+            __field__import_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeDeclaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__import_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__typeDeclaration <- ST.readSTRef
+                                                                          __field__typeDeclaration
+                                             !__val__import_ <- ST.readSTRef __field__import_
+                                             Prelude.pure
+                                               (TypeImportDeclaration_key __val__typeDeclaration
+                                                  __val__import_)
+              _idMap = HashMap.fromList [("typeDeclaration", 1), ("import_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeImportDeclaration_key where
+  rnf
+    (TypeImportDeclaration_key __field__typeDeclaration
+       __field__import_)
+    = DeepSeq.rnf __field__typeDeclaration `Prelude.seq`
+        DeepSeq.rnf __field__import_ `Prelude.seq` ()
+
+instance Default.Default TypeImportDeclaration_key where
+  def = TypeImportDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable TypeImportDeclaration_key where
+  hashWithSalt __salt
+    (TypeImportDeclaration_key _typeDeclaration _import_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _typeDeclaration)
+        _import_
+
+data TypeExport_key = TypeExport_key_named Name
+                    | TypeExport_key_star Module
+                    | TypeExport_key_EMPTY
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeExport_key where
+  toJSON (TypeExport_key_named __named)
+    = Aeson.object ["named" .= __named]
+  toJSON (TypeExport_key_star __star)
+    = Aeson.object ["star" .= __star]
+  toJSON TypeExport_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TypeExport_key where
+  buildStruct _proxy (TypeExport_key_named __named)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "named" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __named)]
+  buildStruct _proxy (TypeExport_key_star __star)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "star" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __star)]
+  buildStruct _proxy TypeExport_key_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeExport_key_named _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeExport_key_star _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return TypeExport_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return TypeExport_key_EMPTY
+    where
+      _idMap = HashMap.fromList [("named", 1), ("star", 2)]
+
+instance DeepSeq.NFData TypeExport_key where
+  rnf (TypeExport_key_named __named) = DeepSeq.rnf __named
+  rnf (TypeExport_key_star __star) = DeepSeq.rnf __star
+  rnf TypeExport_key_EMPTY = ()
+
+instance Default.Default TypeExport_key where
+  def = TypeExport_key_EMPTY
+
+instance Hashable.Hashable TypeExport_key where
+  hashWithSalt __salt (TypeExport_key_named _named)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _named)
+  hashWithSalt __salt (TypeExport_key_star _star)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _star)
+  hashWithSalt __salt TypeExport_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypeDeclarationReference_key = TypeDeclarationReference_key{typeDeclarationReference_key_typeDeclaration
+                                                                 :: TypeDeclaration,
+                                                                 typeDeclarationReference_key_loc ::
+                                                                 Range}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclarationReference_key where
+  toJSON
+    (TypeDeclarationReference_key __field__typeDeclaration
+       __field__loc)
+    = Aeson.object
+        ("typeDeclaration" .= __field__typeDeclaration :
+           "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDeclarationReference_key where
+  buildStruct _proxy
+    (TypeDeclarationReference_key __field__typeDeclaration
+       __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "typeDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__typeDeclaration)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__typeDeclaration <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeDeclaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__typeDeclaration <- ST.readSTRef
+                                                                          __field__typeDeclaration
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (TypeDeclarationReference_key __val__typeDeclaration
+                                                  __val__loc)
+              _idMap = HashMap.fromList [("typeDeclaration", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclarationReference_key where
+  rnf
+    (TypeDeclarationReference_key __field__typeDeclaration
+       __field__loc)
+    = DeepSeq.rnf __field__typeDeclaration `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default TypeDeclarationReference_key where
+  def = TypeDeclarationReference_key Default.def Default.def
+
+instance Hashable.Hashable TypeDeclarationReference_key where
+  hashWithSalt __salt
+    (TypeDeclarationReference_key _typeDeclaration _loc)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _typeDeclaration)
+        _loc
+
+data TypeDeclarationInfo_key = TypeDeclarationInfo_key{typeDeclarationInfo_key_typeDeclaration
+                                                       :: TypeDeclaration,
+                                                       typeDeclarationInfo_key_type :: Type,
+                                                       typeDeclarationInfo_key_documentation ::
+                                                       Prelude.Maybe Documentation,
+                                                       typeDeclarationInfo_key_span ::
+                                                       Prelude.Maybe Range}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclarationInfo_key where
+  toJSON
+    (TypeDeclarationInfo_key __field__typeDeclaration __field__type
+       __field__documentation __field__span)
+    = Aeson.object
+        ("typeDeclaration" .= __field__typeDeclaration :
+           "type" .= __field__type :
+             Prelude.maybe Prelude.id ((:) . ("documentation" .=))
+               __field__documentation
+               (Prelude.maybe Prelude.id ((:) . ("span" .=)) __field__span
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct TypeDeclarationInfo_key where
+  buildStruct _proxy
+    (TypeDeclarationInfo_key __field__typeDeclaration __field__type
+       __field__documentation __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "typeDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__typeDeclaration)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             let (__cereal__documentation, __id__documentation)
+                   = case __field__documentation of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "documentation"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__documentation
+                 (case __field__span of
+                    Prelude.Just _val -> Thrift.genField _proxy "span"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           __id__documentation
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__typeDeclaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__documentation <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeDeclaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__documentation
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__typeDeclaration <- ST.readSTRef
+                                                                          __field__typeDeclaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__documentation <- ST.readSTRef
+                                                                        __field__documentation
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (TypeDeclarationInfo_key __val__typeDeclaration
+                                                  __val__type
+                                                  __val__documentation
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("typeDeclaration", 1), ("type", 2), ("documentation", 3),
+                     ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclarationInfo_key where
+  rnf
+    (TypeDeclarationInfo_key __field__typeDeclaration __field__type
+       __field__documentation __field__span)
+    = DeepSeq.rnf __field__typeDeclaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__documentation `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default TypeDeclarationInfo_key where
+  def
+    = TypeDeclarationInfo_key Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable TypeDeclarationInfo_key where
+  hashWithSalt __salt
+    (TypeDeclarationInfo_key _typeDeclaration _type _documentation
+       _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _typeDeclaration)
+              _type)
+           _documentation)
+        _span
+
+data TypeDeclaration_key = TypeDeclaration_key{typeDeclaration_key_name
+                                               :: Name,
+                                               typeDeclaration_key_loc :: Range}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeDeclaration_key where
+  toJSON (TypeDeclaration_key __field__name __field__loc)
+    = Aeson.object
+        ("name" .= __field__name : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeDeclaration_key where
+  buildStruct _proxy (TypeDeclaration_key __field__name __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (TypeDeclaration_key __val__name __val__loc)
+              _idMap = HashMap.fromList [("name", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeDeclaration_key where
+  rnf (TypeDeclaration_key __field__name __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default TypeDeclaration_key where
+  def = TypeDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable TypeDeclaration_key where
+  hashWithSalt __salt (TypeDeclaration_key _name _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc
+
+data StringToFileModule_key = StringToFileModule_key{stringToFileModule_key_string_
+                                                     :: Text.Text,
+                                                     stringToFileModule_key_file ::
+                                                     Glean.Schema.Src.File}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringToFileModule_key where
+  toJSON (StringToFileModule_key __field__string_ __field__file)
+    = Aeson.object
+        ("string_" .= __field__string_ :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct StringToFileModule_key where
+  buildStruct _proxy
+    (StringToFileModule_key __field__string_ __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__string_)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__string_ <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__string_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__string_ <- ST.readSTRef
+                                                                  __field__string_
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (StringToFileModule_key __val__string_ __val__file)
+              _idMap = HashMap.fromList [("string_", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringToFileModule_key where
+  rnf (StringToFileModule_key __field__string_ __field__file)
+    = DeepSeq.rnf __field__string_ `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default StringToFileModule_key where
+  def = StringToFileModule_key "" Default.def
+
+instance Hashable.Hashable StringToFileModule_key where
+  hashWithSalt __salt (StringToFileModule_key _string_ _file)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _string_)
+        _file
+
+data SourceOfTypeExport_source = SourceOfTypeExport_source_typeDeclaration TypeDeclaration
+                               | SourceOfTypeExport_source_moduleTypeExport ModuleTypeExport
+                               | SourceOfTypeExport_source_moduleNamespace Module
+                               | SourceOfTypeExport_source_EMPTY
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfTypeExport_source where
+  toJSON
+    (SourceOfTypeExport_source_typeDeclaration __typeDeclaration)
+    = Aeson.object ["typeDeclaration" .= __typeDeclaration]
+  toJSON
+    (SourceOfTypeExport_source_moduleTypeExport __moduleTypeExport)
+    = Aeson.object ["moduleTypeExport" .= __moduleTypeExport]
+  toJSON
+    (SourceOfTypeExport_source_moduleNamespace __moduleNamespace)
+    = Aeson.object ["moduleNamespace" .= __moduleNamespace]
+  toJSON SourceOfTypeExport_source_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SourceOfTypeExport_source where
+  buildStruct _proxy
+    (SourceOfTypeExport_source_typeDeclaration __typeDeclaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __typeDeclaration)]
+  buildStruct _proxy
+    (SourceOfTypeExport_source_moduleTypeExport __moduleTypeExport)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleTypeExport"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __moduleTypeExport)]
+  buildStruct _proxy
+    (SourceOfTypeExport_source_moduleNamespace __moduleNamespace)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleNamespace"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __moduleNamespace)]
+  buildStruct _proxy SourceOfTypeExport_source_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfTypeExport_source_typeDeclaration
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfTypeExport_source_moduleTypeExport
+                                                                 _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfTypeExport_source_moduleNamespace
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               SourceOfTypeExport_source_EMPTY
+           Thrift.FieldEnd -> Prelude.return SourceOfTypeExport_source_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("typeDeclaration", 1), ("moduleTypeExport", 2),
+             ("moduleNamespace", 3)]
+
+instance DeepSeq.NFData SourceOfTypeExport_source where
+  rnf (SourceOfTypeExport_source_typeDeclaration __typeDeclaration)
+    = DeepSeq.rnf __typeDeclaration
+  rnf (SourceOfTypeExport_source_moduleTypeExport __moduleTypeExport)
+    = DeepSeq.rnf __moduleTypeExport
+  rnf (SourceOfTypeExport_source_moduleNamespace __moduleNamespace)
+    = DeepSeq.rnf __moduleNamespace
+  rnf SourceOfTypeExport_source_EMPTY = ()
+
+instance Default.Default SourceOfTypeExport_source where
+  def = SourceOfTypeExport_source_EMPTY
+
+instance Hashable.Hashable SourceOfTypeExport_source where
+  hashWithSalt __salt
+    (SourceOfTypeExport_source_typeDeclaration _typeDeclaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _typeDeclaration)
+  hashWithSalt __salt
+    (SourceOfTypeExport_source_moduleTypeExport _moduleTypeExport)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _moduleTypeExport)
+  hashWithSalt __salt
+    (SourceOfTypeExport_source_moduleNamespace _moduleNamespace)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _moduleNamespace)
+  hashWithSalt __salt SourceOfTypeExport_source_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data SourceOfTypeExport_key = SourceOfTypeExport_key{sourceOfTypeExport_key_moduleTypeExport
+                                                     :: ModuleTypeExport,
+                                                     sourceOfTypeExport_key_source ::
+                                                     SourceOfTypeExport_source}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfTypeExport_key where
+  toJSON
+    (SourceOfTypeExport_key __field__moduleTypeExport __field__source)
+    = Aeson.object
+        ("moduleTypeExport" .= __field__moduleTypeExport :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceOfTypeExport_key where
+  buildStruct _proxy
+    (SourceOfTypeExport_key __field__moduleTypeExport __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "moduleTypeExport"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__moduleTypeExport)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__moduleTypeExport <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moduleTypeExport
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__moduleTypeExport <- ST.readSTRef
+                                                                           __field__moduleTypeExport
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (SourceOfTypeExport_key __val__moduleTypeExport
+                                                  __val__source)
+              _idMap = HashMap.fromList [("moduleTypeExport", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceOfTypeExport_key where
+  rnf
+    (SourceOfTypeExport_key __field__moduleTypeExport __field__source)
+    = DeepSeq.rnf __field__moduleTypeExport `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default SourceOfTypeExport_key where
+  def = SourceOfTypeExport_key Default.def Default.def
+
+instance Hashable.Hashable SourceOfTypeExport_key where
+  hashWithSalt __salt
+    (SourceOfTypeExport_key _moduleTypeExport _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _moduleTypeExport)
+        _source
+
+data SourceOfExport_source = SourceOfExport_source_declaration Declaration
+                           | SourceOfExport_source_memberDeclaration MemberDeclaration
+                           | SourceOfExport_source_moduleExport ModuleExport
+                           | SourceOfExport_source_moduleNamespace Module
+                           | SourceOfExport_source_EMPTY
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfExport_source where
+  toJSON (SourceOfExport_source_declaration __declaration)
+    = Aeson.object ["declaration" .= __declaration]
+  toJSON
+    (SourceOfExport_source_memberDeclaration __memberDeclaration)
+    = Aeson.object ["memberDeclaration" .= __memberDeclaration]
+  toJSON (SourceOfExport_source_moduleExport __moduleExport)
+    = Aeson.object ["moduleExport" .= __moduleExport]
+  toJSON (SourceOfExport_source_moduleNamespace __moduleNamespace)
+    = Aeson.object ["moduleNamespace" .= __moduleNamespace]
+  toJSON SourceOfExport_source_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SourceOfExport_source where
+  buildStruct _proxy
+    (SourceOfExport_source_declaration __declaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __declaration)]
+  buildStruct _proxy
+    (SourceOfExport_source_memberDeclaration __memberDeclaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "memberDeclaration"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __memberDeclaration)]
+  buildStruct _proxy
+    (SourceOfExport_source_moduleExport __moduleExport)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleExport"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __moduleExport)]
+  buildStruct _proxy
+    (SourceOfExport_source_moduleNamespace __moduleNamespace)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleNamespace"
+           (Thrift.getStructType _proxy)
+           4
+           0
+           (Thrift.buildStruct _proxy __moduleNamespace)]
+  buildStruct _proxy SourceOfExport_source_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfExport_source_declaration
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfExport_source_memberDeclaration
+                                                                 _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfExport_source_moduleExport
+                                                                 _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SourceOfExport_source_moduleNamespace
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               SourceOfExport_source_EMPTY
+           Thrift.FieldEnd -> Prelude.return SourceOfExport_source_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("declaration", 1), ("memberDeclaration", 2), ("moduleExport", 3),
+             ("moduleNamespace", 4)]
+
+instance DeepSeq.NFData SourceOfExport_source where
+  rnf (SourceOfExport_source_declaration __declaration)
+    = DeepSeq.rnf __declaration
+  rnf (SourceOfExport_source_memberDeclaration __memberDeclaration)
+    = DeepSeq.rnf __memberDeclaration
+  rnf (SourceOfExport_source_moduleExport __moduleExport)
+    = DeepSeq.rnf __moduleExport
+  rnf (SourceOfExport_source_moduleNamespace __moduleNamespace)
+    = DeepSeq.rnf __moduleNamespace
+  rnf SourceOfExport_source_EMPTY = ()
+
+instance Default.Default SourceOfExport_source where
+  def = SourceOfExport_source_EMPTY
+
+instance Hashable.Hashable SourceOfExport_source where
+  hashWithSalt __salt
+    (SourceOfExport_source_declaration _declaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _declaration)
+  hashWithSalt __salt
+    (SourceOfExport_source_memberDeclaration _memberDeclaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _memberDeclaration)
+  hashWithSalt __salt
+    (SourceOfExport_source_moduleExport _moduleExport)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _moduleExport)
+  hashWithSalt __salt
+    (SourceOfExport_source_moduleNamespace _moduleNamespace)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 4 _moduleNamespace)
+  hashWithSalt __salt SourceOfExport_source_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data SourceOfExport_key = SourceOfExport_key{sourceOfExport_key_moduleExport
+                                             :: ModuleExport,
+                                             sourceOfExport_key_source :: SourceOfExport_source}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceOfExport_key where
+  toJSON (SourceOfExport_key __field__moduleExport __field__source)
+    = Aeson.object
+        ("moduleExport" .= __field__moduleExport :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceOfExport_key where
+  buildStruct _proxy
+    (SourceOfExport_key __field__moduleExport __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "moduleExport"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__moduleExport)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__moduleExport <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moduleExport
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__moduleExport <- ST.readSTRef
+                                                                       __field__moduleExport
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (SourceOfExport_key __val__moduleExport
+                                                  __val__source)
+              _idMap = HashMap.fromList [("moduleExport", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceOfExport_key where
+  rnf (SourceOfExport_key __field__moduleExport __field__source)
+    = DeepSeq.rnf __field__moduleExport `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default SourceOfExport_key where
+  def = SourceOfExport_key Default.def Default.def
+
+instance Hashable.Hashable SourceOfExport_key where
+  hashWithSalt __salt (SourceOfExport_key _moduleExport _source)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _moduleExport)
+        _source
+
+data SomeDeclaration = SomeDeclaration_localDecl Declaration
+                     | SomeDeclaration_memberDecl MemberDeclaration
+                     | SomeDeclaration_typeDecl TypeDeclaration
+                     | SomeDeclaration_EMPTY
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SomeDeclaration where
+  toJSON (SomeDeclaration_localDecl __localDecl)
+    = Aeson.object ["localDecl" .= __localDecl]
+  toJSON (SomeDeclaration_memberDecl __memberDecl)
+    = Aeson.object ["memberDecl" .= __memberDecl]
+  toJSON (SomeDeclaration_typeDecl __typeDecl)
+    = Aeson.object ["typeDecl" .= __typeDecl]
+  toJSON SomeDeclaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SomeDeclaration where
+  buildStruct _proxy (SomeDeclaration_localDecl __localDecl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "localDecl" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __localDecl)]
+  buildStruct _proxy (SomeDeclaration_memberDecl __memberDecl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "memberDecl" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __memberDecl)]
+  buildStruct _proxy (SomeDeclaration_typeDecl __typeDecl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeDecl" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __typeDecl)]
+  buildStruct _proxy SomeDeclaration_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SomeDeclaration_localDecl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SomeDeclaration_memberDecl _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (SomeDeclaration_typeDecl _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SomeDeclaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return SomeDeclaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("localDecl", 1), ("memberDecl", 2), ("typeDecl", 3)]
+
+instance DeepSeq.NFData SomeDeclaration where
+  rnf (SomeDeclaration_localDecl __localDecl)
+    = DeepSeq.rnf __localDecl
+  rnf (SomeDeclaration_memberDecl __memberDecl)
+    = DeepSeq.rnf __memberDecl
+  rnf (SomeDeclaration_typeDecl __typeDecl) = DeepSeq.rnf __typeDecl
+  rnf SomeDeclaration_EMPTY = ()
+
+instance Default.Default SomeDeclaration where
+  def = SomeDeclaration_EMPTY
+
+instance Hashable.Hashable SomeDeclaration where
+  hashWithSalt __salt (SomeDeclaration_localDecl _localDecl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _localDecl)
+  hashWithSalt __salt (SomeDeclaration_memberDecl _memberDecl)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _memberDecl)
+  hashWithSalt __salt (SomeDeclaration_typeDecl _typeDecl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _typeDecl)
+  hashWithSalt __salt SomeDeclaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data SomeEntity = SomeEntity_decl SomeDeclaration
+                | SomeEntity_module_ Module
+                | SomeEntity_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SomeEntity where
+  toJSON (SomeEntity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON (SomeEntity_module_ __module_)
+    = Aeson.object ["module_" .= __module_]
+  toJSON SomeEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SomeEntity where
+  buildStruct _proxy (SomeEntity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy (SomeEntity_module_ __module_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __module_)]
+  buildStruct _proxy SomeEntity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SomeEntity_decl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SomeEntity_module_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SomeEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return SomeEntity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1), ("module_", 2)]
+
+instance DeepSeq.NFData SomeEntity where
+  rnf (SomeEntity_decl __decl) = DeepSeq.rnf __decl
+  rnf (SomeEntity_module_ __module_) = DeepSeq.rnf __module_
+  rnf SomeEntity_EMPTY = ()
+
+instance Default.Default SomeEntity where
+  def = SomeEntity_EMPTY
+
+instance Hashable.Hashable SomeEntity where
+  hashWithSalt __salt (SomeEntity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt (SomeEntity_module_ _module_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _module_)
+  hashWithSalt __salt SomeEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data SearchTypeDeclarationByName_key = SearchTypeDeclarationByName_key{searchTypeDeclarationByName_key_name
+                                                                       :: Text.Text,
+                                                                       searchTypeDeclarationByName_key_parent
+                                                                       :: Module,
+                                                                       searchTypeDeclarationByName_key_decl
+                                                                       :: TypeDeclaration}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeDeclarationByName_key where
+  toJSON
+    (SearchTypeDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeDeclarationByName_key where
+  buildStruct _proxy
+    (SearchTypeDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTypeDeclarationByName_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeDeclarationByName_key where
+  rnf
+    (SearchTypeDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTypeDeclarationByName_key where
+  def = SearchTypeDeclarationByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchTypeDeclarationByName_key where
+  hashWithSalt __salt
+    (SearchTypeDeclarationByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchTypeDeclarationByLowerCaseName_key = SearchTypeDeclarationByLowerCaseName_key{searchTypeDeclarationByLowerCaseName_key_name_lowercase
+                                                                                         ::
+                                                                                         Text.Text,
+                                                                                         searchTypeDeclarationByLowerCaseName_key_name
+                                                                                         ::
+                                                                                         Text.Text}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeDeclarationByLowerCaseName_key
+         where
+  toJSON
+    (SearchTypeDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           SearchTypeDeclarationByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchTypeDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchTypeDeclarationByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeDeclarationByLowerCaseName_key
+         where
+  rnf
+    (SearchTypeDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchTypeDeclarationByLowerCaseName_key
+         where
+  def = SearchTypeDeclarationByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchTypeDeclarationByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchTypeDeclarationByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchTypeByModuleExport_key = SearchTypeByModuleExport_key{searchTypeByModuleExport_key_string_
+                                                                 :: Text.Text,
+                                                                 searchTypeByModuleExport_key_name
+                                                                 :: Name,
+                                                                 searchTypeByModuleExport_key_decl
+                                                                 :: SomeDeclaration}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeByModuleExport_key where
+  toJSON
+    (SearchTypeByModuleExport_key __field__string_ __field__name
+       __field__decl)
+    = Aeson.object
+        ("string_" .= __field__string_ :
+           "name" .= __field__name : "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeByModuleExport_key where
+  buildStruct _proxy
+    (SearchTypeByModuleExport_key __field__string_ __field__name
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__string_)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__string_ <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__string_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__string_ <- ST.readSTRef
+                                                                  __field__string_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTypeByModuleExport_key __val__string_
+                                                  __val__name
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("string_", 1), ("name", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeByModuleExport_key where
+  rnf
+    (SearchTypeByModuleExport_key __field__string_ __field__name
+       __field__decl)
+    = DeepSeq.rnf __field__string_ `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTypeByModuleExport_key where
+  def = SearchTypeByModuleExport_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchTypeByModuleExport_key where
+  hashWithSalt __salt
+    (SearchTypeByModuleExport_key _string_ _name _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _string_)
+           _name)
+        _decl
+
+data SearchModuleByLowerCaseName_key = SearchModuleByLowerCaseName_key{searchModuleByLowerCaseName_key_name_lowercase
+                                                                       :: Text.Text,
+                                                                       searchModuleByLowerCaseName_key_name
+                                                                       :: Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName_key where
+  toJSON
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName_key where
+  rnf
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName_key where
+  def = SearchModuleByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchModuleByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchModuleByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchMemberDeclarationByName_key = SearchMemberDeclarationByName_key{searchMemberDeclarationByName_key_name
+                                                                           :: Text.Text,
+                                                                           searchMemberDeclarationByName_key_parent
+                                                                           :: Module,
+                                                                           searchMemberDeclarationByName_key_decl
+                                                                           :: MemberDeclaration}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMemberDeclarationByName_key where
+  toJSON
+    (SearchMemberDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMemberDeclarationByName_key
+         where
+  buildStruct _proxy
+    (SearchMemberDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchMemberDeclarationByName_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMemberDeclarationByName_key where
+  rnf
+    (SearchMemberDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchMemberDeclarationByName_key where
+  def = SearchMemberDeclarationByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchMemberDeclarationByName_key where
+  hashWithSalt __salt
+    (SearchMemberDeclarationByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchMemberDeclarationByLowerCaseName_key = SearchMemberDeclarationByLowerCaseName_key{searchMemberDeclarationByLowerCaseName_key_name_lowercase
+                                                                                             ::
+                                                                                             Text.Text,
+                                                                                             searchMemberDeclarationByLowerCaseName_key_name
+                                                                                             ::
+                                                                                             Text.Text}
+                                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMemberDeclarationByLowerCaseName_key
+         where
+  toJSON
+    (SearchMemberDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           SearchMemberDeclarationByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchMemberDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchMemberDeclarationByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMemberDeclarationByLowerCaseName_key
+         where
+  rnf
+    (SearchMemberDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchMemberDeclarationByLowerCaseName_key
+         where
+  def = SearchMemberDeclarationByLowerCaseName_key "" ""
+
+instance Hashable.Hashable
+           SearchMemberDeclarationByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchMemberDeclarationByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchDeclarationByName_key = SearchDeclarationByName_key{searchDeclarationByName_key_name
+                                                               :: Text.Text,
+                                                               searchDeclarationByName_key_parent ::
+                                                               Module,
+                                                               searchDeclarationByName_key_decl ::
+                                                               Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDeclarationByName_key where
+  toJSON
+    (SearchDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDeclarationByName_key where
+  buildStruct _proxy
+    (SearchDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchDeclarationByName_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDeclarationByName_key where
+  rnf
+    (SearchDeclarationByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchDeclarationByName_key where
+  def = SearchDeclarationByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchDeclarationByName_key where
+  hashWithSalt __salt
+    (SearchDeclarationByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchDeclarationByLowerCaseName_key = SearchDeclarationByLowerCaseName_key{searchDeclarationByLowerCaseName_key_name_lowercase
+                                                                                 :: Text.Text,
+                                                                                 searchDeclarationByLowerCaseName_key_name
+                                                                                 :: Text.Text}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDeclarationByLowerCaseName_key where
+  toJSON
+    (SearchDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDeclarationByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchDeclarationByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDeclarationByLowerCaseName_key where
+  rnf
+    (SearchDeclarationByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchDeclarationByLowerCaseName_key where
+  def = SearchDeclarationByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchDeclarationByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchDeclarationByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchByNameModule_key = SearchByNameModule_key{searchByNameModule_key_name
+                                                     :: Text.Text,
+                                                     searchByNameModule_key_module :: Module}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameModule_key where
+  toJSON (SearchByNameModule_key __field__name __field__module)
+    = Aeson.object
+        ("name" .= __field__name :
+           "module" .= __field__module : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameModule_key where
+  buildStruct _proxy
+    (SearchByNameModule_key __field__name __field__module)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__module)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__module <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__module <- ST.readSTRef __field__module
+                                             Prelude.pure
+                                               (SearchByNameModule_key __val__name __val__module)
+              _idMap = HashMap.fromList [("name", 1), ("module", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameModule_key where
+  rnf (SearchByNameModule_key __field__name __field__module)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__module `Prelude.seq` ()
+
+instance Default.Default SearchByNameModule_key where
+  def = SearchByNameModule_key "" Default.def
+
+instance Hashable.Hashable SearchByNameModule_key where
+  hashWithSalt __salt (SearchByNameModule_key _name _module)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _module
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Name,
+                                         searchByName_key_decl :: SomeDeclaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (SearchByName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data SearchByModuleName_key = SearchByModuleName_key{searchByModuleName_key_name
+                                                     :: Text.Text,
+                                                     searchByModuleName_key_module :: Module}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByModuleName_key where
+  toJSON (SearchByModuleName_key __field__name __field__module)
+    = Aeson.object
+        ("name" .= __field__name :
+           "module" .= __field__module : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByModuleName_key where
+  buildStruct _proxy
+    (SearchByModuleName_key __field__name __field__module)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__module)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__module <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__module <- ST.readSTRef __field__module
+                                             Prelude.pure
+                                               (SearchByModuleName_key __val__name __val__module)
+              _idMap = HashMap.fromList [("name", 1), ("module", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByModuleName_key where
+  rnf (SearchByModuleName_key __field__name __field__module)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__module `Prelude.seq` ()
+
+instance Default.Default SearchByModuleName_key where
+  def = SearchByModuleName_key "" Default.def
+
+instance Hashable.Hashable SearchByModuleName_key where
+  hashWithSalt __salt (SearchByModuleName_key _name _module)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _module
+
+data SearchByModule_key = SearchByModule_key{searchByModule_key_string_
+                                             :: Text.Text,
+                                             searchByModule_key_name :: Name,
+                                             searchByModule_key_decl :: SomeDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByModule_key where
+  toJSON
+    (SearchByModule_key __field__string_ __field__name __field__decl)
+    = Aeson.object
+        ("string_" .= __field__string_ :
+           "name" .= __field__name : "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByModule_key where
+  buildStruct _proxy
+    (SearchByModule_key __field__string_ __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__string_)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__string_ <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__string_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__string_ <- ST.readSTRef
+                                                                  __field__string_
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchByModule_key __val__string_ __val__name
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("string_", 1), ("name", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByModule_key where
+  rnf
+    (SearchByModule_key __field__string_ __field__name __field__decl)
+    = DeepSeq.rnf __field__string_ `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByModule_key where
+  def = SearchByModule_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchByModule_key where
+  hashWithSalt __salt (SearchByModule_key _string_ _name _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _string_)
+           _name)
+        _decl
+
+data SearchByFileModule_key = SearchByFileModule_key{searchByFileModule_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     searchByFileModule_key_name :: Name,
+                                                     searchByFileModule_key_decl :: SomeDeclaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFileModule_key where
+  toJSON
+    (SearchByFileModule_key __field__file __field__name __field__decl)
+    = Aeson.object
+        ("file" .= __field__file :
+           "name" .= __field__name : "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByFileModule_key where
+  buildStruct _proxy
+    (SearchByFileModule_key __field__file __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchByFileModule_key __val__file __val__name
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("file", 1), ("name", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFileModule_key where
+  rnf
+    (SearchByFileModule_key __field__file __field__name __field__decl)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByFileModule_key where
+  def = SearchByFileModule_key Default.def Default.def Default.def
+
+instance Hashable.Hashable SearchByFileModule_key where
+  hashWithSalt __salt (SearchByFileModule_key _file _name _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _name)
+        _decl
+
+data Range_key = Range_key{range_key_module :: Module,
+                           range_key_span :: Glean.Schema.Src.ByteSpan}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range_key where
+  toJSON (Range_key __field__module __field__span)
+    = Aeson.object
+        ("module" .= __field__module :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct Range_key where
+  buildStruct _proxy (Range_key __field__module __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (Range_key __val__module __val__span)
+              _idMap = HashMap.fromList [("module", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Range_key where
+  rnf (Range_key __field__module __field__span)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default Range_key where
+  def = Range_key Default.def Default.def
+
+instance Hashable.Hashable Range_key where
+  hashWithSalt __salt (Range_key _module _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _span
+
+data ModuleTypeExport_key = ModuleTypeExport_key{moduleTypeExport_key_module
+                                                 :: Module,
+                                                 moduleTypeExport_key_typeExport :: TypeExport}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleTypeExport_key where
+  toJSON (ModuleTypeExport_key __field__module __field__typeExport)
+    = Aeson.object
+        ("module" .= __field__module :
+           "typeExport" .= __field__typeExport : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleTypeExport_key where
+  buildStruct _proxy
+    (ModuleTypeExport_key __field__module __field__typeExport)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "typeExport" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__typeExport)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__typeExport <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeExport
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__typeExport <- ST.readSTRef __field__typeExport
+                                             Prelude.pure
+                                               (ModuleTypeExport_key __val__module
+                                                  __val__typeExport)
+              _idMap = HashMap.fromList [("module", 1), ("typeExport", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleTypeExport_key where
+  rnf (ModuleTypeExport_key __field__module __field__typeExport)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__typeExport `Prelude.seq` ()
+
+instance Default.Default ModuleTypeExport_key where
+  def = ModuleTypeExport_key Default.def Default.def
+
+instance Hashable.Hashable ModuleTypeExport_key where
+  hashWithSalt __salt (ModuleTypeExport_key _module _typeExport)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _typeExport
+
+data ModuleNameLowerCase_key = ModuleNameLowerCase_key{moduleNameLowerCase_key_nameLowerCase
+                                                       :: Text.Text,
+                                                       moduleNameLowerCase_key_name :: Module}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleNameLowerCase_key where
+  toJSON
+    (ModuleNameLowerCase_key __field__nameLowerCase __field__name)
+    = Aeson.object
+        ("nameLowerCase" .= __field__nameLowerCase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleNameLowerCase_key where
+  buildStruct _proxy
+    (ModuleNameLowerCase_key __field__nameLowerCase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowerCase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowerCase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowerCase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowerCase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowerCase <- ST.readSTRef
+                                                                        __field__nameLowerCase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ModuleNameLowerCase_key __val__nameLowerCase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("nameLowerCase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleNameLowerCase_key where
+  rnf (ModuleNameLowerCase_key __field__nameLowerCase __field__name)
+    = DeepSeq.rnf __field__nameLowerCase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ModuleNameLowerCase_key where
+  def = ModuleNameLowerCase_key "" Default.def
+
+instance Hashable.Hashable ModuleNameLowerCase_key where
+  hashWithSalt __salt (ModuleNameLowerCase_key _nameLowerCase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowerCase)
+        _name
+
+data ModuleLocationByFile_key = ModuleLocationByFile_key{moduleLocationByFile_key_file
+                                                         :: Glean.Schema.Src.File,
+                                                         moduleLocationByFile_key_module_ :: Module,
+                                                         moduleLocationByFile_key_span ::
+                                                         Glean.Schema.Src.ByteSpan,
+                                                         moduleLocationByFile_key_name :: Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleLocationByFile_key where
+  toJSON
+    (ModuleLocationByFile_key __field__file __field__module_
+       __field__span __field__name)
+    = Aeson.object
+        ("file" .= __field__file :
+           "module_" .= __field__module_ :
+             "span" .= __field__span : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleLocationByFile_key where
+  buildStruct _proxy
+    (ModuleLocationByFile_key __field__file __field__module_
+       __field__span __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "module_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__module_)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__name)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ModuleLocationByFile_key __val__file __val__module_
+                                                  __val__span
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("module_", 2), ("span", 3), ("name", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleLocationByFile_key where
+  rnf
+    (ModuleLocationByFile_key __field__file __field__module_
+       __field__span __field__name)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__module_ `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ModuleLocationByFile_key where
+  def
+    = ModuleLocationByFile_key Default.def Default.def Default.def ""
+
+instance Hashable.Hashable ModuleLocationByFile_key where
+  hashWithSalt __salt
+    (ModuleLocationByFile_key _file _module_ _span _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+              _module_)
+           _span)
+        _name
+
+data ModuleLocation_key = ModuleLocation_key{moduleLocation_key_module_
+                                             :: Module,
+                                             moduleLocation_key_file :: Glean.Schema.Src.File,
+                                             moduleLocation_key_span :: Glean.Schema.Src.ByteSpan,
+                                             moduleLocation_key_name :: Text.Text}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleLocation_key where
+  toJSON
+    (ModuleLocation_key __field__module_ __field__file __field__span
+       __field__name)
+    = Aeson.object
+        ("module_" .= __field__module_ :
+           "file" .= __field__file :
+             "span" .= __field__span : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleLocation_key where
+  buildStruct _proxy
+    (ModuleLocation_key __field__module_ __field__file __field__span
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module_)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__name)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module_ <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module_ <- ST.readSTRef
+                                                                  __field__module_
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (ModuleLocation_key __val__module_ __val__file
+                                                  __val__span
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("module_", 1), ("file", 2), ("span", 3), ("name", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleLocation_key where
+  rnf
+    (ModuleLocation_key __field__module_ __field__file __field__span
+       __field__name)
+    = DeepSeq.rnf __field__module_ `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ModuleLocation_key where
+  def = ModuleLocation_key Default.def Default.def Default.def ""
+
+instance Hashable.Hashable ModuleLocation_key where
+  hashWithSalt __salt (ModuleLocation_key _module_ _file _span _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module_)
+              _file)
+           _span)
+        _name
+
+data ModuleExport_key = ModuleExport_key{moduleExport_key_module ::
+                                         Module,
+                                         moduleExport_key_export_ :: Export}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleExport_key where
+  toJSON (ModuleExport_key __field__module __field__export_)
+    = Aeson.object
+        ("module" .= __field__module :
+           "export_" .= __field__export_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleExport_key where
+  buildStruct _proxy
+    (ModuleExport_key __field__module __field__export_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "export_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__export_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__export_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__export_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__export_ <- ST.readSTRef __field__export_
+                                             Prelude.pure
+                                               (ModuleExport_key __val__module __val__export_)
+              _idMap = HashMap.fromList [("module", 1), ("export_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleExport_key where
+  rnf (ModuleExport_key __field__module __field__export_)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__export_ `Prelude.seq` ()
+
+instance Default.Default ModuleExport_key where
+  def = ModuleExport_key Default.def Default.def
+
+instance Hashable.Hashable ModuleExport_key where
+  hashWithSalt __salt (ModuleExport_key _module _export_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _export_
+
+data ModuleDoc_key = ModuleDoc_key{moduleDoc_key_documentation ::
+                                   Documentation,
+                                   moduleDoc_key_file :: Glean.Schema.Src.File}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDoc_key where
+  toJSON (ModuleDoc_key __field__documentation __field__file)
+    = Aeson.object
+        ("documentation" .= __field__documentation :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDoc_key where
+  buildStruct _proxy
+    (ModuleDoc_key __field__documentation __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "documentation"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__documentation)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__documentation <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__documentation
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__documentation <- ST.readSTRef
+                                                                        __field__documentation
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (ModuleDoc_key __val__documentation __val__file)
+              _idMap = HashMap.fromList [("documentation", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDoc_key where
+  rnf (ModuleDoc_key __field__documentation __field__file)
+    = DeepSeq.rnf __field__documentation `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default ModuleDoc_key where
+  def = ModuleDoc_key Default.def Default.def
+
+instance Hashable.Hashable ModuleDoc_key where
+  hashWithSalt __salt (ModuleDoc_key _documentation _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _documentation)
+        _file
+
+data ModuleContains_key = ModuleContains_key{moduleContains_key_module
+                                             :: Module,
+                                             moduleContains_key_member :: SomeDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleContains_key where
+  toJSON (ModuleContains_key __field__module __field__member)
+    = Aeson.object
+        ("module" .= __field__module :
+           "member" .= __field__member : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleContains_key where
+  buildStruct _proxy
+    (ModuleContains_key __field__module __field__member)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "member" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__member)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__member <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__member
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__member <- ST.readSTRef __field__member
+                                             Prelude.pure
+                                               (ModuleContains_key __val__module __val__member)
+              _idMap = HashMap.fromList [("module", 1), ("member", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleContains_key where
+  rnf (ModuleContains_key __field__module __field__member)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__member `Prelude.seq` ()
+
+instance Default.Default ModuleContains_key where
+  def = ModuleContains_key Default.def Default.def
+
+instance Hashable.Hashable ModuleContains_key where
+  hashWithSalt __salt (ModuleContains_key _module _member)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _member
+
+data ModuleComments_key = ModuleComments_key{moduleComments_key_module
+                                             :: Module,
+                                             moduleComments_key_file :: Glean.Schema.Src.File,
+                                             moduleComments_key_span :: Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleComments_key where
+  toJSON
+    (ModuleComments_key __field__module __field__file __field__span)
+    = Aeson.object
+        ("module" .= __field__module :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleComments_key where
+  buildStruct _proxy
+    (ModuleComments_key __field__module __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ModuleComments_key __val__module __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("module", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleComments_key where
+  rnf
+    (ModuleComments_key __field__module __field__file __field__span)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ModuleComments_key where
+  def = ModuleComments_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ModuleComments_key where
+  hashWithSalt __salt (ModuleComments_key _module _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+           _file)
+        _span
+
+data Module_key = Module_key_file Glean.Schema.Src.File
+                | Module_key_builtin Glean.Schema.Builtin.Unit
+                | Module_key_lib Text.Text
+                | Module_key_noSource Glean.Schema.Builtin.Unit
+                | Module_key_string_ Text.Text
+                | Module_key_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module_key where
+  toJSON (Module_key_file __file) = Aeson.object ["file" .= __file]
+  toJSON (Module_key_builtin __builtin)
+    = Aeson.object ["builtin" .= __builtin]
+  toJSON (Module_key_lib __lib) = Aeson.object ["lib" .= __lib]
+  toJSON (Module_key_noSource __noSource)
+    = Aeson.object ["noSource" .= __noSource]
+  toJSON (Module_key_string_ __string_)
+    = Aeson.object ["string_" .= __string_]
+  toJSON Module_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Module_key where
+  buildStruct _proxy (Module_key_file __file)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __file)]
+  buildStruct _proxy (Module_key_builtin __builtin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "builtin" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __builtin)]
+  buildStruct _proxy (Module_key_lib __lib)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lib" (Thrift.getStringType _proxy) 3 0
+           (Thrift.genText _proxy __lib)]
+  buildStruct _proxy (Module_key_noSource __noSource)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "noSource" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __noSource)]
+  buildStruct _proxy (Module_key_string_ __string_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 5 0
+           (Thrift.genText _proxy __string_)]
+  buildStruct _proxy Module_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Module_key_file _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Module_key_builtin _val)
+                                                     3 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Module_key_lib _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Module_key_noSource _val)
+                                                     5 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Module_key_string_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Module_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Module_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("file", 1), ("builtin", 2), ("lib", 3), ("noSource", 4),
+             ("string_", 5)]
+
+instance DeepSeq.NFData Module_key where
+  rnf (Module_key_file __file) = DeepSeq.rnf __file
+  rnf (Module_key_builtin __builtin) = DeepSeq.rnf __builtin
+  rnf (Module_key_lib __lib) = DeepSeq.rnf __lib
+  rnf (Module_key_noSource __noSource) = DeepSeq.rnf __noSource
+  rnf (Module_key_string_ __string_) = DeepSeq.rnf __string_
+  rnf Module_key_EMPTY = ()
+
+instance Default.Default Module_key where
+  def = Module_key_EMPTY
+
+instance Hashable.Hashable Module_key where
+  hashWithSalt __salt (Module_key_file _file)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _file)
+  hashWithSalt __salt (Module_key_builtin _builtin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _builtin)
+  hashWithSalt __salt (Module_key_lib _lib)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _lib)
+  hashWithSalt __salt (Module_key_noSource _noSource)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _noSource)
+  hashWithSalt __salt (Module_key_string_ _string_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _string_)
+  hashWithSalt __salt Module_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data MemberDeclarationReference_key = MemberDeclarationReference_key{memberDeclarationReference_key_memberDeclaration
+                                                                     :: MemberDeclaration,
+                                                                     memberDeclarationReference_key_loc
+                                                                     :: Range}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclarationReference_key where
+  toJSON
+    (MemberDeclarationReference_key __field__memberDeclaration
+       __field__loc)
+    = Aeson.object
+        ("memberDeclaration" .= __field__memberDeclaration :
+           "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberDeclarationReference_key where
+  buildStruct _proxy
+    (MemberDeclarationReference_key __field__memberDeclaration
+       __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "memberDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__memberDeclaration)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__memberDeclaration <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__memberDeclaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__memberDeclaration <- ST.readSTRef
+                                                                            __field__memberDeclaration
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (MemberDeclarationReference_key
+                                                  __val__memberDeclaration
+                                                  __val__loc)
+              _idMap = HashMap.fromList [("memberDeclaration", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclarationReference_key where
+  rnf
+    (MemberDeclarationReference_key __field__memberDeclaration
+       __field__loc)
+    = DeepSeq.rnf __field__memberDeclaration `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default MemberDeclarationReference_key where
+  def = MemberDeclarationReference_key Default.def Default.def
+
+instance Hashable.Hashable MemberDeclarationReference_key where
+  hashWithSalt __salt
+    (MemberDeclarationReference_key _memberDeclaration _loc)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _memberDeclaration)
+        _loc
+
+data MemberDeclarationInfo_key = MemberDeclarationInfo_key{memberDeclarationInfo_key_memberDeclaration
+                                                           :: MemberDeclaration,
+                                                           memberDeclarationInfo_key_type :: Type,
+                                                           memberDeclarationInfo_key_documentation
+                                                           :: Prelude.Maybe Documentation,
+                                                           memberDeclarationInfo_key_span ::
+                                                           Prelude.Maybe Range}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclarationInfo_key where
+  toJSON
+    (MemberDeclarationInfo_key __field__memberDeclaration __field__type
+       __field__documentation __field__span)
+    = Aeson.object
+        ("memberDeclaration" .= __field__memberDeclaration :
+           "type" .= __field__type :
+             Prelude.maybe Prelude.id ((:) . ("documentation" .=))
+               __field__documentation
+               (Prelude.maybe Prelude.id ((:) . ("span" .=)) __field__span
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct MemberDeclarationInfo_key where
+  buildStruct _proxy
+    (MemberDeclarationInfo_key __field__memberDeclaration __field__type
+       __field__documentation __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "memberDeclaration"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__memberDeclaration)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             let (__cereal__documentation, __id__documentation)
+                   = case __field__documentation of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "documentation"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__documentation
+                 (case __field__span of
+                    Prelude.Just _val -> Thrift.genField _proxy "span"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           __id__documentation
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__memberDeclaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__documentation <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__memberDeclaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__documentation
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__memberDeclaration <- ST.readSTRef
+                                                                            __field__memberDeclaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__documentation <- ST.readSTRef
+                                                                        __field__documentation
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (MemberDeclarationInfo_key __val__memberDeclaration
+                                                  __val__type
+                                                  __val__documentation
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("memberDeclaration", 1), ("type", 2), ("documentation", 3),
+                     ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclarationInfo_key where
+  rnf
+    (MemberDeclarationInfo_key __field__memberDeclaration __field__type
+       __field__documentation __field__span)
+    = DeepSeq.rnf __field__memberDeclaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__documentation `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default MemberDeclarationInfo_key where
+  def
+    = MemberDeclarationInfo_key Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable MemberDeclarationInfo_key where
+  hashWithSalt __salt
+    (MemberDeclarationInfo_key _memberDeclaration _type _documentation
+       _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _memberDeclaration)
+              _type)
+           _documentation)
+        _span
+
+data MemberDeclaration_key = MemberDeclaration_key{memberDeclaration_key_name
+                                                   :: Name,
+                                                   memberDeclaration_key_loc :: Range}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberDeclaration_key where
+  toJSON (MemberDeclaration_key __field__name __field__loc)
+    = Aeson.object
+        ("name" .= __field__name : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberDeclaration_key where
+  buildStruct _proxy
+    (MemberDeclaration_key __field__name __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (MemberDeclaration_key __val__name __val__loc)
+              _idMap = HashMap.fromList [("name", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberDeclaration_key where
+  rnf (MemberDeclaration_key __field__name __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default MemberDeclaration_key where
+  def = MemberDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable MemberDeclaration_key where
+  hashWithSalt __salt (MemberDeclaration_key _name _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc
+
+data LocalDeclarationReference_key = LocalDeclarationReference_key{localDeclarationReference_key_declaration
+                                                                   :: Declaration,
+                                                                   localDeclarationReference_key_loc
+                                                                   :: Range}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalDeclarationReference_key where
+  toJSON
+    (LocalDeclarationReference_key __field__declaration __field__loc)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalDeclarationReference_key where
+  buildStruct _proxy
+    (LocalDeclarationReference_key __field__declaration __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (LocalDeclarationReference_key __val__declaration
+                                                  __val__loc)
+              _idMap = HashMap.fromList [("declaration", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalDeclarationReference_key where
+  rnf
+    (LocalDeclarationReference_key __field__declaration __field__loc)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default LocalDeclarationReference_key where
+  def = LocalDeclarationReference_key Default.def Default.def
+
+instance Hashable.Hashable LocalDeclarationReference_key where
+  hashWithSalt __salt
+    (LocalDeclarationReference_key _declaration _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _loc
+
+data ImportDeclaration_import_ = ImportDeclaration_import__moduleExport ModuleExport
+                               | ImportDeclaration_import__moduleNamespace Module
+                               | ImportDeclaration_import__EMPTY
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportDeclaration_import_ where
+  toJSON (ImportDeclaration_import__moduleExport __moduleExport)
+    = Aeson.object ["moduleExport" .= __moduleExport]
+  toJSON
+    (ImportDeclaration_import__moduleNamespace __moduleNamespace)
+    = Aeson.object ["moduleNamespace" .= __moduleNamespace]
+  toJSON ImportDeclaration_import__EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ImportDeclaration_import_ where
+  buildStruct _proxy
+    (ImportDeclaration_import__moduleExport __moduleExport)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleExport"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __moduleExport)]
+  buildStruct _proxy
+    (ImportDeclaration_import__moduleNamespace __moduleNamespace)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "moduleNamespace"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __moduleNamespace)]
+  buildStruct _proxy ImportDeclaration_import__EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ImportDeclaration_import__moduleExport
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ImportDeclaration_import__moduleNamespace
+                                                                 _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               ImportDeclaration_import__EMPTY
+           Thrift.FieldEnd -> Prelude.return ImportDeclaration_import__EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("moduleExport", 1), ("moduleNamespace", 2)]
+
+instance DeepSeq.NFData ImportDeclaration_import_ where
+  rnf (ImportDeclaration_import__moduleExport __moduleExport)
+    = DeepSeq.rnf __moduleExport
+  rnf (ImportDeclaration_import__moduleNamespace __moduleNamespace)
+    = DeepSeq.rnf __moduleNamespace
+  rnf ImportDeclaration_import__EMPTY = ()
+
+instance Default.Default ImportDeclaration_import_ where
+  def = ImportDeclaration_import__EMPTY
+
+instance Hashable.Hashable ImportDeclaration_import_ where
+  hashWithSalt __salt
+    (ImportDeclaration_import__moduleExport _moduleExport)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _moduleExport)
+  hashWithSalt __salt
+    (ImportDeclaration_import__moduleNamespace _moduleNamespace)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _moduleNamespace)
+  hashWithSalt __salt ImportDeclaration_import__EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ImportDeclaration_key = ImportDeclaration_key{importDeclaration_key_declaration
+                                                   :: Declaration,
+                                                   importDeclaration_key_import_ ::
+                                                   ImportDeclaration_import_}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportDeclaration_key where
+  toJSON
+    (ImportDeclaration_key __field__declaration __field__import_)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "import_" .= __field__import_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportDeclaration_key where
+  buildStruct _proxy
+    (ImportDeclaration_key __field__declaration __field__import_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "import_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__import_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__import_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__import_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__import_ <- ST.readSTRef __field__import_
+                                             Prelude.pure
+                                               (ImportDeclaration_key __val__declaration
+                                                  __val__import_)
+              _idMap = HashMap.fromList [("declaration", 1), ("import_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportDeclaration_key where
+  rnf (ImportDeclaration_key __field__declaration __field__import_)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__import_ `Prelude.seq` ()
+
+instance Default.Default ImportDeclaration_key where
+  def = ImportDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ImportDeclaration_key where
+  hashWithSalt __salt (ImportDeclaration_key _declaration _import_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _import_
+
+data FlowXRefDeclInfo_key = FlowXRefDeclInfo_key{flowXRefDeclInfo_key_ref
+                                                 :: XRef,
+                                                 flowXRefDeclInfo_key_srcLoc :: Range,
+                                                 flowXRefDeclInfo_key_name :: Name,
+                                                 flowXRefDeclInfo_key_targetLoc :: Range,
+                                                 flowXRefDeclInfo_key_entity :: SomeDeclaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowXRefDeclInfo_key where
+  toJSON
+    (FlowXRefDeclInfo_key __field__ref __field__srcLoc __field__name
+       __field__targetLoc __field__entity)
+    = Aeson.object
+        ("ref" .= __field__ref :
+           "srcLoc" .= __field__srcLoc :
+             "name" .= __field__name :
+               "targetLoc" .= __field__targetLoc :
+                 "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowXRefDeclInfo_key where
+  buildStruct _proxy
+    (FlowXRefDeclInfo_key __field__ref __field__srcLoc __field__name
+       __field__targetLoc __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ref)
+           :
+           Thrift.genField _proxy "srcLoc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__srcLoc)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               :
+               Thrift.genField _proxy "targetLoc" (Thrift.getStructType _proxy) 4
+                 3
+                 (Thrift.buildStruct _proxy __field__targetLoc)
+                 :
+                 Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__entity)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ref <- ST.newSTRef Default.def
+            __field__srcLoc <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__targetLoc <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ref
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__srcLoc
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetLoc
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ref <- ST.readSTRef __field__ref
+                                             !__val__srcLoc <- ST.readSTRef __field__srcLoc
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__targetLoc <- ST.readSTRef __field__targetLoc
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowXRefDeclInfo_key __val__ref __val__srcLoc
+                                                  __val__name
+                                                  __val__targetLoc
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("ref", 1), ("srcLoc", 2), ("name", 3), ("targetLoc", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowXRefDeclInfo_key where
+  rnf
+    (FlowXRefDeclInfo_key __field__ref __field__srcLoc __field__name
+       __field__targetLoc __field__entity)
+    = DeepSeq.rnf __field__ref `Prelude.seq`
+        DeepSeq.rnf __field__srcLoc `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__targetLoc `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowXRefDeclInfo_key where
+  def
+    = FlowXRefDeclInfo_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable FlowXRefDeclInfo_key where
+  hashWithSalt __salt
+    (FlowXRefDeclInfo_key _ref _srcLoc _name _targetLoc _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ref) _srcLoc)
+              _name)
+           _targetLoc)
+        _entity
+
+data FlowTypeImportXRef_key = FlowTypeImportXRef_key{flowTypeImportXRef_key_local
+                                                     :: TypeDeclaration,
+                                                     flowTypeImportXRef_key_entity :: SomeEntity,
+                                                     flowTypeImportXRef_key_targetFile ::
+                                                     Glean.Schema.Src.File,
+                                                     flowTypeImportXRef_key_targetSpan ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeImportXRef_key where
+  toJSON
+    (FlowTypeImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = Aeson.object
+        ("local" .= __field__local :
+           "entity" .= __field__entity :
+             "targetFile" .= __field__targetFile :
+               "targetSpan" .= __field__targetSpan : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeImportXRef_key where
+  buildStruct _proxy
+    (FlowTypeImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__local)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "targetFile" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__targetFile)
+               :
+               Thrift.genField _proxy "targetSpan" (Thrift.getStructType _proxy) 4
+                 3
+                 (Thrift.buildStruct _proxy __field__targetSpan)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__local <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__targetFile <- ST.newSTRef Default.def
+            __field__targetSpan <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__local
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetFile
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetSpan
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__local <- ST.readSTRef __field__local
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__targetFile <- ST.readSTRef __field__targetFile
+                                             !__val__targetSpan <- ST.readSTRef __field__targetSpan
+                                             Prelude.pure
+                                               (FlowTypeImportXRef_key __val__local __val__entity
+                                                  __val__targetFile
+                                                  __val__targetSpan)
+              _idMap
+                = HashMap.fromList
+                    [("local", 1), ("entity", 2), ("targetFile", 3), ("targetSpan", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeImportXRef_key where
+  rnf
+    (FlowTypeImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = DeepSeq.rnf __field__local `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__targetFile `Prelude.seq`
+            DeepSeq.rnf __field__targetSpan `Prelude.seq` ()
+
+instance Default.Default FlowTypeImportXRef_key where
+  def
+    = FlowTypeImportXRef_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowTypeImportXRef_key where
+  hashWithSalt __salt
+    (FlowTypeImportXRef_key _local _entity _targetFile _targetSpan)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _local)
+              _entity)
+           _targetFile)
+        _targetSpan
+
+data FlowTypeExportLocation_key = FlowTypeExportLocation_key{flowTypeExportLocation_key_moduleTypeExport
+                                                             :: ModuleTypeExport,
+                                                             flowTypeExportLocation_key_entity ::
+                                                             SomeEntity,
+                                                             flowTypeExportLocation_key_file ::
+                                                             Glean.Schema.Src.File,
+                                                             flowTypeExportLocation_key_span ::
+                                                             Glean.Schema.Src.ByteSpan}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeExportLocation_key where
+  toJSON
+    (FlowTypeExportLocation_key __field__moduleTypeExport
+       __field__entity __field__file __field__span)
+    = Aeson.object
+        ("moduleTypeExport" .= __field__moduleTypeExport :
+           "entity" .= __field__entity :
+             "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeExportLocation_key where
+  buildStruct _proxy
+    (FlowTypeExportLocation_key __field__moduleTypeExport
+       __field__entity __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "moduleTypeExport"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__moduleTypeExport)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__moduleTypeExport <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moduleTypeExport
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__moduleTypeExport <- ST.readSTRef
+                                                                           __field__moduleTypeExport
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowTypeExportLocation_key __val__moduleTypeExport
+                                                  __val__entity
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("moduleTypeExport", 1), ("entity", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeExportLocation_key where
+  rnf
+    (FlowTypeExportLocation_key __field__moduleTypeExport
+       __field__entity __field__file __field__span)
+    = DeepSeq.rnf __field__moduleTypeExport `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowTypeExportLocation_key where
+  def
+    = FlowTypeExportLocation_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowTypeExportLocation_key where
+  hashWithSalt __salt
+    (FlowTypeExportLocation_key _moduleTypeExport _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _moduleTypeExport)
+              _entity)
+           _file)
+        _span
+
+data FlowTypeEntityImportUses_key = FlowTypeEntityImportUses_key{flowTypeEntityImportUses_key_target
+                                                                 :: SomeEntity,
+                                                                 flowTypeEntityImportUses_key_local
+                                                                 :: TypeDeclaration}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowTypeEntityImportUses_key where
+  toJSON
+    (FlowTypeEntityImportUses_key __field__target __field__local)
+    = Aeson.object
+        ("target" .= __field__target :
+           "local" .= __field__local : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowTypeEntityImportUses_key where
+  buildStruct _proxy
+    (FlowTypeEntityImportUses_key __field__target __field__local)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__local)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__local <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__local
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__local <- ST.readSTRef __field__local
+                                             Prelude.pure
+                                               (FlowTypeEntityImportUses_key __val__target
+                                                  __val__local)
+              _idMap = HashMap.fromList [("target", 1), ("local", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowTypeEntityImportUses_key where
+  rnf (FlowTypeEntityImportUses_key __field__target __field__local)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__local `Prelude.seq` ()
+
+instance Default.Default FlowTypeEntityImportUses_key where
+  def = FlowTypeEntityImportUses_key Default.def Default.def
+
+instance Hashable.Hashable FlowTypeEntityImportUses_key where
+  hashWithSalt __salt (FlowTypeEntityImportUses_key _target _local)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _local
+
+data FlowSameModule_key = FlowSameModule_key{flowSameModule_key_left
+                                             :: Module,
+                                             flowSameModule_key_right :: Module}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSameModule_key where
+  toJSON (FlowSameModule_key __field__left __field__right)
+    = Aeson.object
+        ("left" .= __field__left :
+           "right" .= __field__right : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowSameModule_key where
+  buildStruct _proxy
+    (FlowSameModule_key __field__left __field__right)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "left" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__left)
+           :
+           Thrift.genField _proxy "right" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__right)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__left <- ST.newSTRef Default.def
+            __field__right <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__left
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__right
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__left <- ST.readSTRef __field__left
+                                             !__val__right <- ST.readSTRef __field__right
+                                             Prelude.pure
+                                               (FlowSameModule_key __val__left __val__right)
+              _idMap = HashMap.fromList [("left", 1), ("right", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSameModule_key where
+  rnf (FlowSameModule_key __field__left __field__right)
+    = DeepSeq.rnf __field__left `Prelude.seq`
+        DeepSeq.rnf __field__right `Prelude.seq` ()
+
+instance Default.Default FlowSameModule_key where
+  def = FlowSameModule_key Default.def Default.def
+
+instance Hashable.Hashable FlowSameModule_key where
+  hashWithSalt __salt (FlowSameModule_key _left _right)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _left) _right
+
+data FlowModuleNamespaceXRef_key = FlowModuleNamespaceXRef_key{flowModuleNamespaceXRef_key_local
+                                                               :: Declaration,
+                                                               flowModuleNamespaceXRef_key_entity ::
+                                                               SomeEntity,
+                                                               flowModuleNamespaceXRef_key_file ::
+                                                               Glean.Schema.Src.File}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowModuleNamespaceXRef_key where
+  toJSON
+    (FlowModuleNamespaceXRef_key __field__local __field__entity
+       __field__file)
+    = Aeson.object
+        ("local" .= __field__local :
+           "entity" .= __field__entity :
+             "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowModuleNamespaceXRef_key where
+  buildStruct _proxy
+    (FlowModuleNamespaceXRef_key __field__local __field__entity
+       __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__local)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__local <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__local
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__local <- ST.readSTRef __field__local
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (FlowModuleNamespaceXRef_key __val__local
+                                                  __val__entity
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList [("local", 1), ("entity", 2), ("file", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowModuleNamespaceXRef_key where
+  rnf
+    (FlowModuleNamespaceXRef_key __field__local __field__entity
+       __field__file)
+    = DeepSeq.rnf __field__local `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default FlowModuleNamespaceXRef_key where
+  def
+    = FlowModuleNamespaceXRef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FlowModuleNamespaceXRef_key where
+  hashWithSalt __salt
+    (FlowModuleNamespaceXRef_key _local _entity _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _local)
+           _entity)
+        _file
+
+data FlowImportXRef_key = FlowImportXRef_key{flowImportXRef_key_local
+                                             :: Declaration,
+                                             flowImportXRef_key_entity :: SomeEntity,
+                                             flowImportXRef_key_targetFile :: Glean.Schema.Src.File,
+                                             flowImportXRef_key_targetSpan ::
+                                             Glean.Schema.Src.ByteSpan}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowImportXRef_key where
+  toJSON
+    (FlowImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = Aeson.object
+        ("local" .= __field__local :
+           "entity" .= __field__entity :
+             "targetFile" .= __field__targetFile :
+               "targetSpan" .= __field__targetSpan : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowImportXRef_key where
+  buildStruct _proxy
+    (FlowImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__local)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             :
+             Thrift.genField _proxy "targetFile" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__targetFile)
+               :
+               Thrift.genField _proxy "targetSpan" (Thrift.getStructType _proxy) 4
+                 3
+                 (Thrift.buildStruct _proxy __field__targetSpan)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__local <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__targetFile <- ST.newSTRef Default.def
+            __field__targetSpan <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__local
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetFile
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__targetSpan
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__local <- ST.readSTRef __field__local
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__targetFile <- ST.readSTRef __field__targetFile
+                                             !__val__targetSpan <- ST.readSTRef __field__targetSpan
+                                             Prelude.pure
+                                               (FlowImportXRef_key __val__local __val__entity
+                                                  __val__targetFile
+                                                  __val__targetSpan)
+              _idMap
+                = HashMap.fromList
+                    [("local", 1), ("entity", 2), ("targetFile", 3), ("targetSpan", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowImportXRef_key where
+  rnf
+    (FlowImportXRef_key __field__local __field__entity
+       __field__targetFile __field__targetSpan)
+    = DeepSeq.rnf __field__local `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq`
+          DeepSeq.rnf __field__targetFile `Prelude.seq`
+            DeepSeq.rnf __field__targetSpan `Prelude.seq` ()
+
+instance Default.Default FlowImportXRef_key where
+  def
+    = FlowImportXRef_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FlowImportXRef_key where
+  hashWithSalt __salt
+    (FlowImportXRef_key _local _entity _targetFile _targetSpan)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _local)
+              _entity)
+           _targetFile)
+        _targetSpan
+
+data FlowExportLocation_key = FlowExportLocation_key{flowExportLocation_key_module
+                                                     :: Module,
+                                                     flowExportLocation_key_export_ :: Export,
+                                                     flowExportLocation_key_entity :: SomeEntity,
+                                                     flowExportLocation_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     flowExportLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowExportLocation_key where
+  toJSON
+    (FlowExportLocation_key __field__module __field__export_
+       __field__entity __field__file __field__span)
+    = Aeson.object
+        ("module" .= __field__module :
+           "export_" .= __field__export_ :
+             "entity" .= __field__entity :
+               "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowExportLocation_key where
+  buildStruct _proxy
+    (FlowExportLocation_key __field__module __field__export_
+       __field__entity __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "export_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__export_)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               :
+               Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__file)
+                 :
+                 Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__span)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__export_ <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__export_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__export_ <- ST.readSTRef __field__export_
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowExportLocation_key __val__module __val__export_
+                                                  __val__entity
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("module", 1), ("export_", 2), ("entity", 3), ("file", 4),
+                     ("span", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowExportLocation_key where
+  rnf
+    (FlowExportLocation_key __field__module __field__export_
+       __field__entity __field__file __field__span)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__export_ `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq`
+            DeepSeq.rnf __field__file `Prelude.seq`
+              DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowExportLocation_key where
+  def
+    = FlowExportLocation_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable FlowExportLocation_key where
+  hashWithSalt __salt
+    (FlowExportLocation_key _module _export_ _entity _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+                 _export_)
+              _entity)
+           _file)
+        _span
+
+data FlowEntityUsesAll_key = FlowEntityUsesAll_key{flowEntityUsesAll_key_target
+                                                   :: SomeEntity,
+                                                   flowEntityUsesAll_key_file ::
+                                                   Glean.Schema.Src.File,
+                                                   flowEntityUsesAll_key_span ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityUsesAll_key where
+  toJSON
+    (FlowEntityUsesAll_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityUsesAll_key where
+  buildStruct _proxy
+    (FlowEntityUsesAll_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FlowEntityUsesAll_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityUsesAll_key where
+  rnf
+    (FlowEntityUsesAll_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FlowEntityUsesAll_key where
+  def = FlowEntityUsesAll_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FlowEntityUsesAll_key where
+  hashWithSalt __salt (FlowEntityUsesAll_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data FlowEntityImportUses_key = FlowEntityImportUses_key{flowEntityImportUses_key_target
+                                                         :: SomeEntity,
+                                                         flowEntityImportUses_key_local ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowEntityImportUses_key where
+  toJSON (FlowEntityImportUses_key __field__target __field__local)
+    = Aeson.object
+        ("target" .= __field__target :
+           "local" .= __field__local : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowEntityImportUses_key where
+  buildStruct _proxy
+    (FlowEntityImportUses_key __field__target __field__local)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__local)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__local <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__local
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__local <- ST.readSTRef __field__local
+                                             Prelude.pure
+                                               (FlowEntityImportUses_key __val__target __val__local)
+              _idMap = HashMap.fromList [("target", 1), ("local", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowEntityImportUses_key where
+  rnf (FlowEntityImportUses_key __field__target __field__local)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__local `Prelude.seq` ()
+
+instance Default.Default FlowEntityImportUses_key where
+  def = FlowEntityImportUses_key Default.def Default.def
+
+instance Hashable.Hashable FlowEntityImportUses_key where
+  hashWithSalt __salt (FlowEntityImportUses_key _target _local)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _local
+
+data FlowCompatibleExport_key = FlowCompatibleExport_key{flowCompatibleExport_key_left
+                                                         :: Export,
+                                                         flowCompatibleExport_key_right :: Export}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowCompatibleExport_key where
+  toJSON (FlowCompatibleExport_key __field__left __field__right)
+    = Aeson.object
+        ("left" .= __field__left :
+           "right" .= __field__right : Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowCompatibleExport_key where
+  buildStruct _proxy
+    (FlowCompatibleExport_key __field__left __field__right)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "left" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__left)
+           :
+           Thrift.genField _proxy "right" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__right)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__left <- ST.newSTRef Default.def
+            __field__right <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__left
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__right
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__left <- ST.readSTRef __field__left
+                                             !__val__right <- ST.readSTRef __field__right
+                                             Prelude.pure
+                                               (FlowCompatibleExport_key __val__left __val__right)
+              _idMap = HashMap.fromList [("left", 1), ("right", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowCompatibleExport_key where
+  rnf (FlowCompatibleExport_key __field__left __field__right)
+    = DeepSeq.rnf __field__left `Prelude.seq`
+        DeepSeq.rnf __field__right `Prelude.seq` ()
+
+instance Default.Default FlowCompatibleExport_key where
+  def = FlowCompatibleExport_key Default.def Default.def
+
+instance Hashable.Hashable FlowCompatibleExport_key where
+  hashWithSalt __salt (FlowCompatibleExport_key _left _right)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _left) _right
+
+data FileXRef_key = FileXRef_key{fileXRef_key_file ::
+                                 Glean.Schema.Src.File,
+                                 fileXRef_key_ref :: XRef}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRef_key where
+  toJSON (FileXRef_key __field__file __field__ref)
+    = Aeson.object
+        ("file" .= __field__file : "ref" .= __field__ref : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRef_key where
+  buildStruct _proxy (FileXRef_key __field__file __field__ref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "ref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ref)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__ref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__ref <- ST.readSTRef __field__ref
+                                             Prelude.pure (FileXRef_key __val__file __val__ref)
+              _idMap = HashMap.fromList [("file", 1), ("ref", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRef_key where
+  rnf (FileXRef_key __field__file __field__ref)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__ref `Prelude.seq` ()
+
+instance Default.Default FileXRef_key where
+  def = FileXRef_key Default.def Default.def
+
+instance Hashable.Hashable FileXRef_key where
+  hashWithSalt __salt (FileXRef_key _file _ref)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _ref
+
+data FileOfStringModule_key = FileOfStringModule_key{fileOfStringModule_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     fileOfStringModule_key_string_ :: Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileOfStringModule_key where
+  toJSON (FileOfStringModule_key __field__file __field__string_)
+    = Aeson.object
+        ("file" .= __field__file :
+           "string_" .= __field__string_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileOfStringModule_key where
+  buildStruct _proxy
+    (FileOfStringModule_key __field__file __field__string_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__string_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__string_ <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__string_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__string_ <- ST.readSTRef __field__string_
+                                             Prelude.pure
+                                               (FileOfStringModule_key __val__file __val__string_)
+              _idMap = HashMap.fromList [("file", 1), ("string_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileOfStringModule_key where
+  rnf (FileOfStringModule_key __field__file __field__string_)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__string_ `Prelude.seq` ()
+
+instance Default.Default FileOfStringModule_key where
+  def = FileOfStringModule_key Default.def ""
+
+instance Hashable.Hashable FileOfStringModule_key where
+  hashWithSalt __salt (FileOfStringModule_key _file _string_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _string_
+
+data FileDeclaration_key = FileDeclaration_key{fileDeclaration_key_file
+                                               :: Glean.Schema.Src.File,
+                                               fileDeclaration_key_declaration :: SomeDeclaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclaration_key where
+  toJSON (FileDeclaration_key __field__file __field__declaration)
+    = Aeson.object
+        ("file" .= __field__file :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclaration_key where
+  buildStruct _proxy
+    (FileDeclaration_key __field__file __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (FileDeclaration_key __val__file __val__declaration)
+              _idMap = HashMap.fromList [("file", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclaration_key where
+  rnf (FileDeclaration_key __field__file __field__declaration)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default FileDeclaration_key where
+  def = FileDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable FileDeclaration_key where
+  hashWithSalt __salt (FileDeclaration_key _file _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _declaration
+
+data Export_key = Export_key_commonJS Glean.Schema.Builtin.Unit
+                | Export_key_commonJSMember Name
+                | Export_key_named Name
+                | Export_key_default_ Glean.Schema.Builtin.Unit
+                | Export_key_star Module
+                | Export_key_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Export_key where
+  toJSON (Export_key_commonJS __commonJS)
+    = Aeson.object ["commonJS" .= __commonJS]
+  toJSON (Export_key_commonJSMember __commonJSMember)
+    = Aeson.object ["commonJSMember" .= __commonJSMember]
+  toJSON (Export_key_named __named)
+    = Aeson.object ["named" .= __named]
+  toJSON (Export_key_default_ __default_)
+    = Aeson.object ["default_" .= __default_]
+  toJSON (Export_key_star __star) = Aeson.object ["star" .= __star]
+  toJSON Export_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Export_key where
+  buildStruct _proxy (Export_key_commonJS __commonJS)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "commonJS" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __commonJS)]
+  buildStruct _proxy (Export_key_commonJSMember __commonJSMember)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "commonJSMember"
+           (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __commonJSMember)]
+  buildStruct _proxy (Export_key_named __named)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "named" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __named)]
+  buildStruct _proxy (Export_key_default_ __default_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "default_" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __default_)]
+  buildStruct _proxy (Export_key_star __star)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "star" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __star)]
+  buildStruct _proxy Export_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Export_key_commonJS _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Export_key_commonJSMember _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Export_key_named _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Export_key_default_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Export_key_star _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Export_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Export_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("commonJS", 1), ("commonJSMember", 2), ("named", 3),
+             ("default_", 4), ("star", 5)]
+
+instance DeepSeq.NFData Export_key where
+  rnf (Export_key_commonJS __commonJS) = DeepSeq.rnf __commonJS
+  rnf (Export_key_commonJSMember __commonJSMember)
+    = DeepSeq.rnf __commonJSMember
+  rnf (Export_key_named __named) = DeepSeq.rnf __named
+  rnf (Export_key_default_ __default_) = DeepSeq.rnf __default_
+  rnf (Export_key_star __star) = DeepSeq.rnf __star
+  rnf Export_key_EMPTY = ()
+
+instance Default.Default Export_key where
+  def = Export_key_EMPTY
+
+instance Hashable.Hashable Export_key where
+  hashWithSalt __salt (Export_key_commonJS _commonJS)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _commonJS)
+  hashWithSalt __salt (Export_key_commonJSMember _commonJSMember)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _commonJSMember)
+  hashWithSalt __salt (Export_key_named _named)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _named)
+  hashWithSalt __salt (Export_key_default_ _default_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _default_)
+  hashWithSalt __salt (Export_key_star _star)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _star)
+  hashWithSalt __salt Export_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_target
+                                               :: SomeDeclaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_use :: Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__target __field__file __field__use)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "use" .= __field__use : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__target __field__file __field__use)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "use" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__use)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__use <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__use
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__use <- ST.readSTRef __field__use
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__target __val__file
+                                                  __val__use)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("use", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__target __field__file __field__use)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__use `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _target _file _use)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _use
+
+data DeclarationSignature_key = DeclarationSignature_key{declarationSignature_key_decl
+                                                         :: SomeDeclaration,
+                                                         declarationSignature_key_signature ::
+                                                         Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSignature_key where
+  toJSON (DeclarationSignature_key __field__decl __field__signature)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "signature" .= __field__signature : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSignature_key where
+  buildStruct _proxy
+    (DeclarationSignature_key __field__decl __field__signature)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getStringType _proxy) 2
+             1
+             (Thrift.genText _proxy __field__signature)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             Prelude.pure
+                                               (DeclarationSignature_key __val__decl
+                                                  __val__signature)
+              _idMap = HashMap.fromList [("decl", 1), ("signature", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSignature_key where
+  rnf (DeclarationSignature_key __field__decl __field__signature)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq` ()
+
+instance Default.Default DeclarationSignature_key where
+  def = DeclarationSignature_key Default.def ""
+
+instance Hashable.Hashable DeclarationSignature_key where
+  hashWithSalt __salt (DeclarationSignature_key _decl _signature)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _signature
+
+data DeclarationNameSpan_key = DeclarationNameSpan_key{declarationNameSpan_key_decl
+                                                       :: SomeDeclaration,
+                                                       declarationNameSpan_key_name :: Name,
+                                                       declarationNameSpan_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNameSpan_key where
+  toJSON
+    (DeclarationNameSpan_key __field__decl __field__name __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "name" .= __field__name : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNameSpan_key where
+  buildStruct _proxy
+    (DeclarationNameSpan_key __field__decl __field__name __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationNameSpan_key __val__decl __val__name
+                                                  __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("name", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNameSpan_key where
+  rnf
+    (DeclarationNameSpan_key __field__decl __field__name __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationNameSpan_key where
+  def = DeclarationNameSpan_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationNameSpan_key where
+  hashWithSalt __salt (DeclarationNameSpan_key _decl _name _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _name)
+        _span
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_decl
+                                                       :: SomeDeclaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__decl __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__decl __field__file __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt (DeclarationLocation_key _decl _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+        _span
+
+data DeclarationInfo_key = DeclarationInfo_key{declarationInfo_key_declaration
+                                               :: Declaration,
+                                               declarationInfo_key_type :: Type,
+                                               declarationInfo_key_documentation ::
+                                               Prelude.Maybe Documentation,
+                                               declarationInfo_key_span :: Prelude.Maybe Range}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationInfo_key where
+  toJSON
+    (DeclarationInfo_key __field__declaration __field__type
+       __field__documentation __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "type" .= __field__type :
+             Prelude.maybe Prelude.id ((:) . ("documentation" .=))
+               __field__documentation
+               (Prelude.maybe Prelude.id ((:) . ("span" .=)) __field__span
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationInfo_key where
+  buildStruct _proxy
+    (DeclarationInfo_key __field__declaration __field__type
+       __field__documentation __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             let (__cereal__documentation, __id__documentation)
+                   = case __field__documentation of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "documentation"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__documentation
+                 (case __field__span of
+                    Prelude.Just _val -> Thrift.genField _proxy "span"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           __id__documentation
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__documentation <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__documentation
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__documentation <- ST.readSTRef
+                                                                        __field__documentation
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationInfo_key __val__declaration __val__type
+                                                  __val__documentation
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("type", 2), ("documentation", 3),
+                     ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationInfo_key where
+  rnf
+    (DeclarationInfo_key __field__declaration __field__type
+       __field__documentation __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__documentation `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationInfo_key where
+  def
+    = DeclarationInfo_key Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable DeclarationInfo_key where
+  hashWithSalt __salt
+    (DeclarationInfo_key _declaration _type _documentation _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+              _type)
+           _documentation)
+        _span
+
+data Declaration_key = Declaration_key{declaration_key_name ::
+                                       Name,
+                                       declaration_key_loc :: Range}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration_key where
+  toJSON (Declaration_key __field__name __field__loc)
+    = Aeson.object
+        ("name" .= __field__name : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct Declaration_key where
+  buildStruct _proxy (Declaration_key __field__name __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure (Declaration_key __val__name __val__loc)
+              _idMap = HashMap.fromList [("name", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Declaration_key where
+  rnf (Declaration_key __field__name __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default Declaration_key where
+  def = Declaration_key Default.def Default.def
+
+instance Hashable.Hashable Declaration_key where
+  hashWithSalt __salt (Declaration_key _name _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc
+{-# LINE 18 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchModuleByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchModuleByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchModuleByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchModuleByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchModuleByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchModuleByLowerCaseName
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchModuleByLowerCaseName =
+       Glean.Schema.Flow.Types.SearchModuleByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchModuleByLowerCaseName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchModuleByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchModuleByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchModuleByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchModuleByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.TypeDeclarationReference_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeDeclarationReference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.TypeDeclarationReference_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeDeclarationReference_key"
+           (Prelude.Just 0))
+{-# LINE 53 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.TypeDeclarationReference_key
+     =
+     'Angle.TField "typeDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 55 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.TypeDeclarationReference
+         where
+  type KeyType Glean.Schema.Flow.Types.TypeDeclarationReference =
+       Glean.Schema.Flow.Types.TypeDeclarationReference_key
+  getName _proxy
+    = Glean.PredicateRef "flow.TypeDeclarationReference" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.typeDeclarationReference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.TypeDeclarationReference x k
+  getFactKey = Glean.Schema.Flow.Types.typeDeclarationReference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 64 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.TypeDeclarationReference
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 70 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowTypeEntityImportUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowTypeEntityImportUses_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowTypeEntityImportUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowTypeEntityImportUses_key"
+           (Prelude.Just 0))
+{-# LINE 79 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.FlowTypeEntityImportUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.Flow.Types.SomeEntity)
+       ('Angle.TField "local"
+          (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 81 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.FlowTypeEntityImportUses
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowTypeEntityImportUses =
+       Glean.Schema.Flow.Types.FlowTypeEntityImportUses_key
+  getName _proxy
+    = Glean.PredicateRef "flow.FlowTypeEntityImportUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowTypeEntityImportUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowTypeEntityImportUses x k
+  getFactKey = Glean.Schema.Flow.Types.flowTypeEntityImportUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 90 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowTypeEntityImportUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 96 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.MemberDeclarationInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.MemberDeclarationInfo_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.MemberDeclarationInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.MemberDeclarationInfo_key" (Prelude.Just 0))
+{-# LINE 109 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.MemberDeclarationInfo_key
+     =
+     'Angle.TField "memberDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclaration)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Flow.Types.Type)
+          ('Angle.TField "documentation"
+             (Prelude.Maybe Glean.Schema.Flow.Types.Documentation)
+             ('Angle.TField "span" (Prelude.Maybe Glean.Schema.Flow.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 111 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.MemberDeclarationInfo
+         where
+  type KeyType Glean.Schema.Flow.Types.MemberDeclarationInfo =
+       Glean.Schema.Flow.Types.MemberDeclarationInfo_key
+  getName _proxy = Glean.PredicateRef "flow.MemberDeclarationInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.memberDeclarationInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.MemberDeclarationInfo x k
+  getFactKey = Glean.Schema.Flow.Types.memberDeclarationInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 120 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.MemberDeclarationInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 126 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeExport_key where
+  buildRtsValue b Glean.Schema.Flow.Types.TypeExport_key_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Flow.Types.TypeExport_key_named x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.TypeExport_key_star x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.TypeExport_key_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.TypeExport_key_named,
+         Glean.mapD Glean.Schema.Flow.Types.TypeExport_key_star]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeExport_key" (Prelude.Just 0))
+{-# LINE 142 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Flow.Types.TypeExport_key =
+     'Angle.TField "named" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+       ('Angle.TField "star"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 144 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.TypeExport where
+  type KeyType Glean.Schema.Flow.Types.TypeExport =
+       Glean.Schema.Flow.Types.TypeExport_key
+  getName _proxy = Glean.PredicateRef "flow.TypeExport" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.typeExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.TypeExport x k
+  getFactKey = Glean.Schema.Flow.Types.typeExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 153 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeExport where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 159 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Export_key where
+  buildRtsValue b Glean.Schema.Flow.Types.Export_key_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Flow.Types.Export_key_commonJS x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.Export_key_commonJSMember x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Export_key_named x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Export_key_default_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Export_key_star x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.Export_key_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.Export_key_commonJS,
+         Glean.mapD Glean.Schema.Flow.Types.Export_key_commonJSMember,
+         Glean.mapD Glean.Schema.Flow.Types.Export_key_named,
+         Glean.mapD Glean.Schema.Flow.Types.Export_key_default_,
+         Glean.mapD Glean.Schema.Flow.Types.Export_key_star]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.Export_key" (Prelude.Just 0))
+{-# LINE 187 "glean/schema/thrift/flow_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Flow.Types.Export_key =
+     'Angle.TField "commonJS" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "commonJSMember"
+          (Glean.KeyType Glean.Schema.Flow.Types.Name)
+          ('Angle.TField "named" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+             ('Angle.TField "default_" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "star"
+                   (Glean.KeyType Glean.Schema.Flow.Types.Module)
+                   ('Angle.TNoFields)))))
+{-# LINE 189 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Export where
+  type KeyType Glean.Schema.Flow.Types.Export =
+       Glean.Schema.Flow.Types.Export_key
+  getName _proxy = Glean.PredicateRef "flow.Export" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.export_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Export x k
+  getFactKey = Glean.Schema.Flow.Types.export_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 198 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Export where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 204 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowCompatibleExport_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowCompatibleExport_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowCompatibleExport_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowCompatibleExport_key" (Prelude.Just 0))
+{-# LINE 213 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowCompatibleExport_key
+     =
+     'Angle.TField "left" (Glean.KeyType Glean.Schema.Flow.Types.Export)
+       ('Angle.TField "right"
+          (Glean.KeyType Glean.Schema.Flow.Types.Export)
+          ('Angle.TNoFields))
+{-# LINE 215 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.FlowCompatibleExport
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowCompatibleExport =
+       Glean.Schema.Flow.Types.FlowCompatibleExport_key
+  getName _proxy = Glean.PredicateRef "flow.FlowCompatibleExport" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowCompatibleExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowCompatibleExport x k
+  getFactKey = Glean.Schema.Flow.Types.flowCompatibleExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 224 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowCompatibleExport
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 230 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 241 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.DeclarationUses_key =
+     'Angle.TField "target" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "use" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 243 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.Flow.Types.DeclarationUses =
+       Glean.Schema.Flow.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "flow.DeclarationUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.Flow.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 252 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 258 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchDeclarationByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchDeclarationByName_key"
+           (Prelude.Just 0))
+{-# LINE 269 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 271 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchDeclarationByName
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchDeclarationByName =
+       Glean.Schema.Flow.Types.SearchDeclarationByName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchDeclarationByName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchDeclarationByName x k
+  getFactKey = Glean.Schema.Flow.Types.searchDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 280 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 286 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileXRef_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.FileXRef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FileXRef_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FileXRef_key" (Prelude.Just 0))
+{-# LINE 295 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FileXRef_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "ref" (Glean.Schema.Flow.Types.XRef)
+          ('Angle.TNoFields))
+{-# LINE 297 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FileXRef where
+  type KeyType Glean.Schema.Flow.Types.FileXRef =
+       Glean.Schema.Flow.Types.FileXRef_key
+  getName _proxy = Glean.PredicateRef "flow.FileXRef" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.fileXRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FileXRef x k
+  getFactKey = Glean.Schema.Flow.Types.fileXRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 306 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileXRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 312 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.TypeImportDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeImportDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.TypeImportDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeImportDeclaration_key" (Prelude.Just 0))
+{-# LINE 321 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.TypeImportDeclaration_key
+     =
+     'Angle.TField "typeDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+       ('Angle.TField "import_"
+          (Glean.Schema.Flow.Types.TypeImportDeclaration_import_)
+          ('Angle.TNoFields))
+{-# LINE 323 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.TypeImportDeclaration
+         where
+  type KeyType Glean.Schema.Flow.Types.TypeImportDeclaration =
+       Glean.Schema.Flow.Types.TypeImportDeclaration_key
+  getName _proxy = Glean.PredicateRef "flow.TypeImportDeclaration" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.typeImportDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.TypeImportDeclaration x k
+  getFactKey = Glean.Schema.Flow.Types.typeImportDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 332 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeImportDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 338 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByNameModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchByNameModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchByNameModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchByNameModule_key" (Prelude.Just 0))
+{-# LINE 347 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SearchByNameModule_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "module"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 349 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SearchByNameModule
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchByNameModule =
+       Glean.Schema.Flow.Types.SearchByNameModule_key
+  getName _proxy = Glean.PredicateRef "flow.SearchByNameModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchByNameModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchByNameModule x k
+  getFactKey = Glean.Schema.Flow.Types.searchByNameModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 358 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByNameModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 364 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowXRefDeclInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowXRefDeclInfo_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowXRefDeclInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowXRefDeclInfo_key" (Prelude.Just 0))
+{-# LINE 379 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowXRefDeclInfo_key =
+     'Angle.TField "ref" (Glean.Schema.Flow.Types.XRef)
+       ('Angle.TField "srcLoc"
+          (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+             ('Angle.TField "targetLoc"
+                (Glean.KeyType Glean.Schema.Flow.Types.Range)
+                ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeDeclaration)
+                   ('Angle.TNoFields)))))
+{-# LINE 381 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowXRefDeclInfo
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowXRefDeclInfo =
+       Glean.Schema.Flow.Types.FlowXRefDeclInfo_key
+  getName _proxy = Glean.PredicateRef "flow.FlowXRefDeclInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowXRefDeclInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowXRefDeclInfo x k
+  getFactKey = Glean.Schema.Flow.Types.flowXRefDeclInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 390 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowXRefDeclInfo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 396 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Range_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.Range_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.Range_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.Range_key" (Prelude.Just 0))
+{-# LINE 405 "glean/schema/thrift/flow_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Flow.Types.Range_key
+     =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 407 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Range where
+  type KeyType Glean.Schema.Flow.Types.Range =
+       Glean.Schema.Flow.Types.Range_key
+  getName _proxy = Glean.PredicateRef "flow.Range" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.range_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Range x k
+  getFactKey = Glean.Schema.Flow.Types.range_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 416 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Range where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 422 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchByModule_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchByModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchByModule_key" (Prelude.Just 0))
+{-# LINE 433 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SearchByModule_key =
+     'Angle.TField "string_" (Data.Text.Text)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+          ('Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 435 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SearchByModule
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchByModule =
+       Glean.Schema.Flow.Types.SearchByModule_key
+  getName _proxy = Glean.PredicateRef "flow.SearchByModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchByModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchByModule x k
+  getFactKey = Glean.Schema.Flow.Types.searchByModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 444 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByModule where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 450 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchTypeDeclarationByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 459 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 461 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName
+       = Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchTypeDeclarationByLowerCaseName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Flow.Types.searchTypeDeclarationByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchTypeDeclarationByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 471 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 477 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.DeclarationSignature_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.DeclarationSignature_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.DeclarationSignature_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.DeclarationSignature_key" (Prelude.Just 0))
+{-# LINE 486 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.DeclarationSignature_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "signature" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 488 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.DeclarationSignature
+         where
+  type KeyType Glean.Schema.Flow.Types.DeclarationSignature =
+       Glean.Schema.Flow.Types.DeclarationSignature_key
+  getName _proxy = Glean.PredicateRef "flow.DeclarationSignature" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.declarationSignature_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.DeclarationSignature x k
+  getFactKey = Glean.Schema.Flow.Types.declarationSignature_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 497 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationSignature
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 503 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeByModuleExport_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchTypeByModuleExport_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchTypeByModuleExport_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchTypeByModuleExport_key"
+           (Prelude.Just 0))
+{-# LINE 514 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchTypeByModuleExport_key
+     =
+     'Angle.TField "string_" (Data.Text.Text)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+          ('Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 516 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchTypeByModuleExport
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchTypeByModuleExport =
+       Glean.Schema.Flow.Types.SearchTypeByModuleExport_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchTypeByModuleExport" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchTypeByModuleExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchTypeByModuleExport x k
+  getFactKey = Glean.Schema.Flow.Types.searchTypeByModuleExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 525 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeByModuleExport
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 531 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleComments_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ModuleComments_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleComments_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleComments_key" (Prelude.Just 0))
+{-# LINE 542 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleComments_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 544 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleComments
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleComments =
+       Glean.Schema.Flow.Types.ModuleComments_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleComments" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleComments_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleComments x k
+  getFactKey = Glean.Schema.Flow.Types.moduleComments_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 553 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleComments where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 559 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowExportLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowExportLocation_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowExportLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowExportLocation_key" (Prelude.Just 0))
+{-# LINE 574 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowExportLocation_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "export_"
+          (Glean.KeyType Glean.Schema.Flow.Types.Export)
+          ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeEntity)
+             ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+                ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 576 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowExportLocation
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowExportLocation =
+       Glean.Schema.Flow.Types.FlowExportLocation_key
+  getName _proxy = Glean.PredicateRef "flow.FlowExportLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowExportLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowExportLocation x k
+  getFactKey = Glean.Schema.Flow.Types.flowExportLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 585 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowExportLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 591 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowTypeExportLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowTypeExportLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowTypeExportLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowTypeExportLocation_key"
+           (Prelude.Just 0))
+{-# LINE 604 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.FlowTypeExportLocation_key
+     =
+     'Angle.TField "moduleTypeExport"
+       (Glean.KeyType Glean.Schema.Flow.Types.ModuleTypeExport)
+       ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeEntity)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 606 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.FlowTypeExportLocation
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowTypeExportLocation =
+       Glean.Schema.Flow.Types.FlowTypeExportLocation_key
+  getName _proxy = Glean.PredicateRef "flow.FlowTypeExportLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowTypeExportLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowTypeExportLocation x k
+  getFactKey = Glean.Schema.Flow.Types.flowTypeExportLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 615 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowTypeExportLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 621 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Type where
+  type KeyType Glean.Schema.Flow.Types.Type = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "flow.Type" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Type x k
+  getFactKey = Glean.Schema.Flow.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 629 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 635 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName_key
+       x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchMemberDeclarationByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 644 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 646 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName
+       =
+       Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchMemberDeclarationByLowerCaseName"
+        3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Flow.Types.searchMemberDeclarationByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName x
+        k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchMemberDeclarationByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 656 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 662 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.ModuleLocationByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ModuleLocationByFile_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleLocationByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleLocationByFile_key" (Prelude.Just 0))
+{-# LINE 675 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleLocationByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "module_"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))))
+{-# LINE 677 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.ModuleLocationByFile
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleLocationByFile =
+       Glean.Schema.Flow.Types.ModuleLocationByFile_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleLocationByFile" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleLocationByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleLocationByFile x k
+  getFactKey = Glean.Schema.Flow.Types.moduleLocationByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 686 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleLocationByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 692 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByFileModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchByFileModule_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchByFileModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchByFileModule_key" (Prelude.Just 0))
+{-# LINE 703 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SearchByFileModule_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+          ('Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 705 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SearchByFileModule
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchByFileModule =
+       Glean.Schema.Flow.Types.SearchByFileModule_key
+  getName _proxy = Glean.PredicateRef "flow.SearchByFileModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchByFileModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchByFileModule x k
+  getFactKey = Glean.Schema.Flow.Types.searchByFileModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 714 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByFileModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 720 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Documentation
+         where
+  type KeyType Glean.Schema.Flow.Types.Documentation =
+       Glean.Schema.Flow.Types.Range
+  getName _proxy = Glean.PredicateRef "flow.Documentation" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.documentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Documentation x k
+  getFactKey = Glean.Schema.Flow.Types.documentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 729 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Documentation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 735 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowSameModule_key
+         where
+  buildRtsValue b (Glean.Schema.Flow.Types.FlowSameModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowSameModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowSameModule_key" (Prelude.Just 0))
+{-# LINE 744 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowSameModule_key =
+     'Angle.TField "left" (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "right"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 746 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowSameModule
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowSameModule =
+       Glean.Schema.Flow.Types.FlowSameModule_key
+  getName _proxy = Glean.PredicateRef "flow.FlowSameModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowSameModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowSameModule x k
+  getFactKey = Glean.Schema.Flow.Types.flowSameModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 755 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowSameModule where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 761 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleContains_key
+         where
+  buildRtsValue b (Glean.Schema.Flow.Types.ModuleContains_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleContains_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleContains_key" (Prelude.Just 0))
+{-# LINE 770 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleContains_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "member" (Glean.Schema.Flow.Types.SomeDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 772 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleContains
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleContains =
+       Glean.Schema.Flow.Types.ModuleContains_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleContains" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleContains_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleContains x k
+  getFactKey = Glean.Schema.Flow.Types.moduleContains_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 781 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleContains where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 787 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ImportDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ImportDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ImportDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ImportDeclaration_key" (Prelude.Just 0))
+{-# LINE 796 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ImportDeclaration_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "import_"
+          (Glean.Schema.Flow.Types.ImportDeclaration_import_)
+          ('Angle.TNoFields))
+{-# LINE 798 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ImportDeclaration
+         where
+  type KeyType Glean.Schema.Flow.Types.ImportDeclaration =
+       Glean.Schema.Flow.Types.ImportDeclaration_key
+  getName _proxy = Glean.PredicateRef "flow.ImportDeclaration" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.importDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ImportDeclaration x k
+  getFactKey = Glean.Schema.Flow.Types.importDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 807 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ImportDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 813 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowModuleNamespaceXRef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowModuleNamespaceXRef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowModuleNamespaceXRef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowModuleNamespaceXRef_key"
+           (Prelude.Just 0))
+{-# LINE 824 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.FlowModuleNamespaceXRef_key
+     =
+     'Angle.TField "local"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeEntity)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
+{-# LINE 826 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.FlowModuleNamespaceXRef
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowModuleNamespaceXRef =
+       Glean.Schema.Flow.Types.FlowModuleNamespaceXRef_key
+  getName _proxy
+    = Glean.PredicateRef "flow.FlowModuleNamespaceXRef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowModuleNamespaceXRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowModuleNamespaceXRef x k
+  getFactKey = Glean.Schema.Flow.Types.flowModuleNamespaceXRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 835 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowModuleNamespaceXRef
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 841 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowTypeImportXRef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowTypeImportXRef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowTypeImportXRef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowTypeImportXRef_key" (Prelude.Just 0))
+{-# LINE 854 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowTypeImportXRef_key =
+     'Angle.TField "local"
+       (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+       ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeEntity)
+          ('Angle.TField "targetFile"
+             (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "targetSpan" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 856 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowTypeImportXRef
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowTypeImportXRef =
+       Glean.Schema.Flow.Types.FlowTypeImportXRef_key
+  getName _proxy = Glean.PredicateRef "flow.FlowTypeImportXRef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowTypeImportXRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowTypeImportXRef x k
+  getFactKey = Glean.Schema.Flow.Types.flowTypeImportXRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 865 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowTypeImportXRef
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 871 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowImportXRef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowImportXRef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowImportXRef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowImportXRef_key" (Prelude.Just 0))
+{-# LINE 884 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowImportXRef_key =
+     'Angle.TField "local"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.Flow.Types.SomeEntity)
+          ('Angle.TField "targetFile"
+             (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "targetSpan" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 886 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowImportXRef
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowImportXRef =
+       Glean.Schema.Flow.Types.FlowImportXRef_key
+  getName _proxy = Glean.PredicateRef "flow.FlowImportXRef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowImportXRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowImportXRef x k
+  getFactKey = Glean.Schema.Flow.Types.flowImportXRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 895 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowImportXRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 901 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SourceOfTypeExport_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfTypeExport_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SourceOfTypeExport_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SourceOfTypeExport_key" (Prelude.Just 0))
+{-# LINE 910 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SourceOfTypeExport_key =
+     'Angle.TField "moduleTypeExport"
+       (Glean.KeyType Glean.Schema.Flow.Types.ModuleTypeExport)
+       ('Angle.TField "source"
+          (Glean.Schema.Flow.Types.SourceOfTypeExport_source)
+          ('Angle.TNoFields))
+{-# LINE 912 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SourceOfTypeExport
+         where
+  type KeyType Glean.Schema.Flow.Types.SourceOfTypeExport =
+       Glean.Schema.Flow.Types.SourceOfTypeExport_key
+  getName _proxy = Glean.PredicateRef "flow.SourceOfTypeExport" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.sourceOfTypeExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SourceOfTypeExport x k
+  getFactKey = Glean.Schema.Flow.Types.sourceOfTypeExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 921 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SourceOfTypeExport
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 927 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeDeclarationInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeDeclarationInfo_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.TypeDeclarationInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeDeclarationInfo_key" (Prelude.Just 0))
+{-# LINE 940 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.TypeDeclarationInfo_key
+     =
+     'Angle.TField "typeDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Flow.Types.Type)
+          ('Angle.TField "documentation"
+             (Prelude.Maybe Glean.Schema.Flow.Types.Documentation)
+             ('Angle.TField "span" (Prelude.Maybe Glean.Schema.Flow.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 942 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.TypeDeclarationInfo
+         where
+  type KeyType Glean.Schema.Flow.Types.TypeDeclarationInfo =
+       Glean.Schema.Flow.Types.TypeDeclarationInfo_key
+  getName _proxy = Glean.PredicateRef "flow.TypeDeclarationInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.typeDeclarationInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.TypeDeclarationInfo x k
+  getFactKey = Glean.Schema.Flow.Types.typeDeclarationInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 951 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeDeclarationInfo
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 957 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationNameSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.DeclarationNameSpan_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.DeclarationNameSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.DeclarationNameSpan_key" (Prelude.Just 0))
+{-# LINE 968 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.DeclarationNameSpan_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 970 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.DeclarationNameSpan
+         where
+  type KeyType Glean.Schema.Flow.Types.DeclarationNameSpan =
+       Glean.Schema.Flow.Types.DeclarationNameSpan_key
+  getName _proxy = Glean.PredicateRef "flow.DeclarationNameSpan" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.declarationNameSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.DeclarationNameSpan x k
+  getFactKey = Glean.Schema.Flow.Types.declarationNameSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 979 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationNameSpan
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 985 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.DeclarationLocation_key" (Prelude.Just 0))
+{-# LINE 996 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.DeclarationLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 998 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Flow.Types.DeclarationLocation =
+       Glean.Schema.Flow.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "flow.DeclarationLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Flow.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1007 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1013 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.MemberDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.MemberDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.MemberDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.MemberDeclaration_key" (Prelude.Just 0))
+{-# LINE 1022 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.MemberDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1024 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.MemberDeclaration
+         where
+  type KeyType Glean.Schema.Flow.Types.MemberDeclaration =
+       Glean.Schema.Flow.Types.MemberDeclaration_key
+  getName _proxy = Glean.PredicateRef "flow.MemberDeclaration" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.memberDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.MemberDeclaration x k
+  getFactKey = Glean.Schema.Flow.Types.memberDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1033 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.MemberDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1039 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.FlowEntityImportUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowEntityImportUses_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowEntityImportUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowEntityImportUses_key" (Prelude.Just 0))
+{-# LINE 1048 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowEntityImportUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.Flow.Types.SomeEntity)
+       ('Angle.TField "local"
+          (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1050 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.FlowEntityImportUses
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowEntityImportUses =
+       Glean.Schema.Flow.Types.FlowEntityImportUses_key
+  getName _proxy = Glean.PredicateRef "flow.FlowEntityImportUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowEntityImportUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowEntityImportUses x k
+  getFactKey = Glean.Schema.Flow.Types.flowEntityImportUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1059 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowEntityImportUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1065 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchTypeDeclarationByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchTypeDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchTypeDeclarationByName_key"
+           (Prelude.Just 0))
+{-# LINE 1076 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchTypeDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1078 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByName
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchTypeDeclarationByName =
+       Glean.Schema.Flow.Types.SearchTypeDeclarationByName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchTypeDeclarationByName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchTypeDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchTypeDeclarationByName x k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchTypeDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1087 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchTypeDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1093 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationInfo_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.DeclarationInfo_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.DeclarationInfo_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.DeclarationInfo_key" (Prelude.Just 0))
+{-# LINE 1106 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.DeclarationInfo_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Flow.Types.Type)
+          ('Angle.TField "documentation"
+             (Prelude.Maybe Glean.Schema.Flow.Types.Documentation)
+             ('Angle.TField "span" (Prelude.Maybe Glean.Schema.Flow.Types.Range)
+                ('Angle.TNoFields))))
+{-# LINE 1108 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.DeclarationInfo
+         where
+  type KeyType Glean.Schema.Flow.Types.DeclarationInfo =
+       Glean.Schema.Flow.Types.DeclarationInfo_key
+  getName _proxy = Glean.PredicateRef "flow.DeclarationInfo" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.declarationInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.DeclarationInfo x k
+  getFactKey = Glean.Schema.Flow.Types.declarationInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1117 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.DeclarationInfo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1123 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchDeclarationByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1132 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1134 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName
+       = Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchDeclarationByLowerCaseName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Flow.Types.searchDeclarationByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchDeclarationByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1144 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchDeclarationByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1150 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleTypeExport_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ModuleTypeExport_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleTypeExport_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleTypeExport_key" (Prelude.Just 0))
+{-# LINE 1159 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleTypeExport_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "typeExport"
+          (Glean.KeyType Glean.Schema.Flow.Types.TypeExport)
+          ('Angle.TNoFields))
+{-# LINE 1161 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleTypeExport
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleTypeExport =
+       Glean.Schema.Flow.Types.ModuleTypeExport_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleTypeExport" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleTypeExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleTypeExport x k
+  getFactKey = Glean.Schema.Flow.Types.moduleTypeExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1170 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleTypeExport where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1176 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Module_key where
+  buildRtsValue b Glean.Schema.Flow.Types.Module_key_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Flow.Types.Module_key_file x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Module_key_builtin x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Module_key_lib x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Module_key_noSource x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.Module_key_string_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.Module_key_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.Module_key_file,
+         Glean.mapD Glean.Schema.Flow.Types.Module_key_builtin,
+         Glean.mapD Glean.Schema.Flow.Types.Module_key_lib,
+         Glean.mapD Glean.Schema.Flow.Types.Module_key_noSource,
+         Glean.mapD Glean.Schema.Flow.Types.Module_key_string_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.Module_key" (Prelude.Just 0))
+{-# LINE 1204 "glean/schema/thrift/flow_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Flow.Types.Module_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "builtin" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "lib" (Data.Text.Text)
+             ('Angle.TField "noSource" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "string_" (Data.Text.Text) ('Angle.TNoFields)))))
+{-# LINE 1206 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Module where
+  type KeyType Glean.Schema.Flow.Types.Module =
+       Glean.Schema.Flow.Types.Module_key
+  getName _proxy = Glean.PredicateRef "flow.Module" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.module_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Module x k
+  getFactKey = Glean.Schema.Flow.Types.module_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1215 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Module where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1221 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ModuleNameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleNameLowerCase_key" (Prelude.Just 0))
+{-# LINE 1230 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleNameLowerCase_key
+     =
+     'Angle.TField "nameLowerCase" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 1232 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.ModuleNameLowerCase
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleNameLowerCase =
+       Glean.Schema.Flow.Types.ModuleNameLowerCase_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleNameLowerCase" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleNameLowerCase x k
+  getFactKey = Glean.Schema.Flow.Types.moduleNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1241 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1247 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleExport_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.ModuleExport_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleExport_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleExport_key" (Prelude.Just 0))
+{-# LINE 1256 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleExport_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "export_"
+          (Glean.KeyType Glean.Schema.Flow.Types.Export)
+          ('Angle.TNoFields))
+{-# LINE 1258 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleExport where
+  type KeyType Glean.Schema.Flow.Types.ModuleExport =
+       Glean.Schema.Flow.Types.ModuleExport_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleExport" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.moduleExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleExport x k
+  getFactKey = Glean.Schema.Flow.Types.moduleExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1267 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleExport where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1273 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Name where
+  type KeyType Glean.Schema.Flow.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "flow.Name" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Name x k
+  getFactKey = Glean.Schema.Flow.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1281 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1287 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileOfStringModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FileOfStringModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FileOfStringModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FileOfStringModule_key" (Prelude.Just 0))
+{-# LINE 1296 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FileOfStringModule_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "string_" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1298 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FileOfStringModule
+         where
+  type KeyType Glean.Schema.Flow.Types.FileOfStringModule =
+       Glean.Schema.Flow.Types.FileOfStringModule_key
+  getName _proxy = Glean.PredicateRef "flow.FileOfStringModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.fileOfStringModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FileOfStringModule x k
+  getFactKey = Glean.Schema.Flow.Types.fileOfStringModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1307 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileOfStringModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1313 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByModuleName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchByModuleName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchByModuleName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchByModuleName_key" (Prelude.Just 0))
+{-# LINE 1322 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SearchByModuleName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "module"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 1324 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SearchByModuleName
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchByModuleName =
+       Glean.Schema.Flow.Types.SearchByModuleName_key
+  getName _proxy = Glean.PredicateRef "flow.SearchByModuleName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.searchByModuleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchByModuleName x k
+  getFactKey = Glean.Schema.Flow.Types.searchByModuleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1333 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByModuleName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1339 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.StringToFileModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.StringToFileModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.StringToFileModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.StringToFileModule_key" (Prelude.Just 0))
+{-# LINE 1348 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.StringToFileModule_key =
+     'Angle.TField "string_" (Data.Text.Text)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 1350 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.StringToFileModule
+         where
+  type KeyType Glean.Schema.Flow.Types.StringToFileModule =
+       Glean.Schema.Flow.Types.StringToFileModule_key
+  getName _proxy = Glean.PredicateRef "flow.StringToFileModule" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.stringToFileModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.StringToFileModule x k
+  getFactKey = Glean.Schema.Flow.Types.stringToFileModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1359 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.StringToFileModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1365 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleDoc_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.ModuleDoc_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleDoc_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleDoc_key" (Prelude.Just 0))
+{-# LINE 1374 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleDoc_key =
+     'Angle.TField "documentation"
+       (Glean.KeyType Glean.Schema.Flow.Types.Documentation)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 1376 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleDoc where
+  type KeyType Glean.Schema.Flow.Types.ModuleDoc =
+       Glean.Schema.Flow.Types.ModuleDoc_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleDoc" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.moduleDoc_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleDoc x k
+  getFactKey = Glean.Schema.Flow.Types.moduleDoc_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1385 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleDoc where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1391 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowEntityUsesAll_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.FlowEntityUsesAll_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FlowEntityUsesAll_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FlowEntityUsesAll_key" (Prelude.Just 0))
+{-# LINE 1402 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FlowEntityUsesAll_key =
+     'Angle.TField "target" (Glean.Schema.Flow.Types.SomeEntity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1404 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FlowEntityUsesAll
+         where
+  type KeyType Glean.Schema.Flow.Types.FlowEntityUsesAll =
+       Glean.Schema.Flow.Types.FlowEntityUsesAll_key
+  getName _proxy = Glean.PredicateRef "flow.FlowEntityUsesAll" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.flowEntityUsesAll_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FlowEntityUsesAll x k
+  getFactKey = Glean.Schema.Flow.Types.flowEntityUsesAll_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1413 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FlowEntityUsesAll where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1419 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Declaration_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.Declaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.Declaration_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.Declaration_key" (Prelude.Just 0))
+{-# LINE 1428 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.Declaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1430 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.Declaration where
+  type KeyType Glean.Schema.Flow.Types.Declaration =
+       Glean.Schema.Flow.Types.Declaration_key
+  getName _proxy = Glean.PredicateRef "flow.Declaration" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.declaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.Declaration x k
+  getFactKey = Glean.Schema.Flow.Types.declaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1439 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.Declaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1445 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ModuleLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.ModuleLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ModuleLocation_key" (Prelude.Just 0))
+{-# LINE 1458 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.ModuleLocation_key =
+     'Angle.TField "module_"
+       (Glean.KeyType Glean.Schema.Flow.Types.Module)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))))
+{-# LINE 1460 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.ModuleLocation
+         where
+  type KeyType Glean.Schema.Flow.Types.ModuleLocation =
+       Glean.Schema.Flow.Types.ModuleLocation_key
+  getName _proxy = Glean.PredicateRef "flow.ModuleLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.moduleLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.ModuleLocation x k
+  getFactKey = Glean.Schema.Flow.Types.moduleLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1469 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.ModuleLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1475 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SearchMemberDeclarationByName_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchMemberDeclarationByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchMemberDeclarationByName_key"
+           (Prelude.Just 0))
+{-# LINE 1486 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.SearchMemberDeclarationByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1488 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByName
+         where
+  type KeyType Glean.Schema.Flow.Types.SearchMemberDeclarationByName
+       = Glean.Schema.Flow.Types.SearchMemberDeclarationByName_key
+  getName _proxy
+    = Glean.PredicateRef "flow.SearchMemberDeclarationByName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Flow.Types.searchMemberDeclarationByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchMemberDeclarationByName x k
+  getFactKey
+    = Glean.Schema.Flow.Types.searchMemberDeclarationByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1497 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SearchMemberDeclarationByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1503 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Flow.Types.FileDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.FileDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.FileDeclaration_key" (Prelude.Just 0))
+{-# LINE 1512 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.FileDeclaration_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Flow.Types.SomeDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1514 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.FileDeclaration
+         where
+  type KeyType Glean.Schema.Flow.Types.FileDeclaration =
+       Glean.Schema.Flow.Types.FileDeclaration_key
+  getName _proxy = Glean.PredicateRef "flow.FileDeclaration" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.fileDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.FileDeclaration x k
+  getFactKey = Glean.Schema.Flow.Types.fileDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1523 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.FileDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1529 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.MemberDeclarationReference_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.MemberDeclarationReference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.MemberDeclarationReference_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.MemberDeclarationReference_key"
+           (Prelude.Just 0))
+{-# LINE 1538 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.MemberDeclarationReference_key
+     =
+     'Angle.TField "memberDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclaration)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1540 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.MemberDeclarationReference
+         where
+  type KeyType Glean.Schema.Flow.Types.MemberDeclarationReference =
+       Glean.Schema.Flow.Types.MemberDeclarationReference_key
+  getName _proxy
+    = Glean.PredicateRef "flow.MemberDeclarationReference" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.memberDeclarationReference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.MemberDeclarationReference x k
+  getFactKey = Glean.Schema.Flow.Types.memberDeclarationReference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1549 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.MemberDeclarationReference
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1555 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.LocalDeclarationReference_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.LocalDeclarationReference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.LocalDeclarationReference_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.LocalDeclarationReference_key"
+           (Prelude.Just 0))
+{-# LINE 1564 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Flow.Types.LocalDeclarationReference_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1566 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Flow.Types.LocalDeclarationReference
+         where
+  type KeyType Glean.Schema.Flow.Types.LocalDeclarationReference =
+       Glean.Schema.Flow.Types.LocalDeclarationReference_key
+  getName _proxy
+    = Glean.PredicateRef "flow.LocalDeclarationReference" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.localDeclarationReference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.LocalDeclarationReference x k
+  getFactKey = Glean.Schema.Flow.Types.localDeclarationReference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1575 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.LocalDeclarationReference
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1581 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByName_key where
+  buildRtsValue b (Glean.Schema.Flow.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SearchByName_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SearchByName_key" (Prelude.Just 0))
+{-# LINE 1590 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SearchByName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+       ('Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1592 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SearchByName where
+  type KeyType Glean.Schema.Flow.Types.SearchByName =
+       Glean.Schema.Flow.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "flow.SearchByName" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Flow.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SearchByName x k
+  getFactKey = Glean.Schema.Flow.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1601 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1607 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Flow.Types.TypeDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.TypeDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeDeclaration_key" (Prelude.Just 0))
+{-# LINE 1616 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.TypeDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Flow.Types.Name)
+       ('Angle.TField "loc" (Glean.KeyType Glean.Schema.Flow.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 1618 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.TypeDeclaration
+         where
+  type KeyType Glean.Schema.Flow.Types.TypeDeclaration =
+       Glean.Schema.Flow.Types.TypeDeclaration_key
+  getName _proxy = Glean.PredicateRef "flow.TypeDeclaration" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.typeDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.TypeDeclaration x k
+  getFactKey = Glean.Schema.Flow.Types.typeDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1627 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.TypeDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1633 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SourceOfExport_key
+         where
+  buildRtsValue b (Glean.Schema.Flow.Types.SourceOfExport_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Flow.Types.SourceOfExport_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SourceOfExport_key" (Prelude.Just 0))
+{-# LINE 1642 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Flow.Types.SourceOfExport_key =
+     'Angle.TField "moduleExport"
+       (Glean.KeyType Glean.Schema.Flow.Types.ModuleExport)
+       ('Angle.TField "source"
+          (Glean.Schema.Flow.Types.SourceOfExport_source)
+          ('Angle.TNoFields))
+{-# LINE 1644 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Flow.Types.SourceOfExport
+         where
+  type KeyType Glean.Schema.Flow.Types.SourceOfExport =
+       Glean.Schema.Flow.Types.SourceOfExport_key
+  getName _proxy = Glean.PredicateRef "flow.SourceOfExport" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Flow.Types.sourceOfExport_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Flow.Types.SourceOfExport x k
+  getFactKey = Glean.Schema.Flow.Types.sourceOfExport_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1653 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SourceOfExport where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1659 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SomeEntity where
+  buildRtsValue b Glean.Schema.Flow.Types.SomeEntity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Flow.Types.SomeEntity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.SomeEntity_module_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.SomeEntity_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.SomeEntity_decl,
+         Glean.mapD Glean.Schema.Flow.Types.SomeEntity_module_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SomeEntity" (Prelude.Just 3))
+{-# LINE 1675 "glean/schema/thrift/flow_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Flow.Types.SomeEntity =
+     'Angle.TField "decl" (Glean.Schema.Flow.Types.SomeDeclaration)
+       ('Angle.TField "module_"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 1677 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.XRef where
+  buildRtsValue b Glean.Schema.Flow.Types.XRef_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Flow.Types.XRef_localRef x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.XRef_memberRef x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Flow.Types.XRef_typeRef x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Flow.Types.XRef_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.XRef_localRef,
+         Glean.mapD Glean.Schema.Flow.Types.XRef_memberRef,
+         Glean.mapD Glean.Schema.Flow.Types.XRef_typeRef]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "flow.XRef" (Prelude.Just 3))
+{-# LINE 1697 "glean/schema/thrift/flow_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Flow.Types.XRef =
+     'Angle.TField "localRef"
+       (Glean.KeyType Glean.Schema.Flow.Types.LocalDeclarationReference)
+       ('Angle.TField "memberRef"
+          (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclarationReference)
+          ('Angle.TField "typeRef"
+             (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclarationReference)
+             ('Angle.TNoFields)))
+{-# LINE 1699 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SomeDeclaration where
+  buildRtsValue b Glean.Schema.Flow.Types.SomeDeclaration_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SomeDeclaration_localDecl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SomeDeclaration_memberDecl x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SomeDeclaration_typeDecl x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.SomeDeclaration_EMPTY)
+        [Glean.mapD Glean.Schema.Flow.Types.SomeDeclaration_localDecl,
+         Glean.mapD Glean.Schema.Flow.Types.SomeDeclaration_memberDecl,
+         Glean.mapD Glean.Schema.Flow.Types.SomeDeclaration_typeDecl]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SomeDeclaration" (Prelude.Just 3))
+{-# LINE 1719 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Flow.Types.SomeDeclaration =
+     'Angle.TField "localDecl"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "memberDecl"
+          (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclaration)
+          ('Angle.TField "typeDecl"
+             (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1721 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.TypeImportDeclaration_import_
+         where
+  buildRtsValue b
+    Glean.Schema.Flow.Types.TypeImportDeclaration_import__EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeImportDeclaration_import__type x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeImportDeclaration_import__typeof_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.TypeImportDeclaration_import__moduleTypeof
+       x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Flow.Types.TypeImportDeclaration_import__EMPTY)
+        [Glean.mapD
+           Glean.Schema.Flow.Types.TypeImportDeclaration_import__type,
+         Glean.mapD
+           Glean.Schema.Flow.Types.TypeImportDeclaration_import__typeof_,
+         Glean.mapD
+           Glean.Schema.Flow.Types.TypeImportDeclaration_import__moduleTypeof]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.TypeImportDeclaration_import_"
+           (Prelude.Just 0))
+{-# LINE 1741 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields
+       Glean.Schema.Flow.Types.TypeImportDeclaration_import_
+     =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.Flow.Types.ModuleTypeExport)
+       ('Angle.TField "typeof_"
+          (Glean.KeyType Glean.Schema.Flow.Types.ModuleExport)
+          ('Angle.TField "moduleTypeof"
+             (Glean.KeyType Glean.Schema.Flow.Types.Module)
+             ('Angle.TNoFields)))
+{-# LINE 1743 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.ImportDeclaration_import_
+         where
+  buildRtsValue b
+    Glean.Schema.Flow.Types.ImportDeclaration_import__EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ImportDeclaration_import__moduleExport x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.ImportDeclaration_import__moduleNamespace
+       x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Flow.Types.ImportDeclaration_import__EMPTY)
+        [Glean.mapD
+           Glean.Schema.Flow.Types.ImportDeclaration_import__moduleExport,
+         Glean.mapD
+           Glean.Schema.Flow.Types.ImportDeclaration_import__moduleNamespace]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.ImportDeclaration_import_" (Prelude.Just 0))
+{-# LINE 1759 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Flow.Types.ImportDeclaration_import_ =
+     'Angle.TField "moduleExport"
+       (Glean.KeyType Glean.Schema.Flow.Types.ModuleExport)
+       ('Angle.TField "moduleNamespace"
+          (Glean.KeyType Glean.Schema.Flow.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 1761 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Flow.Types.SourceOfTypeExport_source
+         where
+  buildRtsValue b
+    Glean.Schema.Flow.Types.SourceOfTypeExport_source_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfTypeExport_source_typeDeclaration
+       x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfTypeExport_source_moduleTypeExport
+       x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfTypeExport_source_moduleNamespace
+       x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.Flow.Types.SourceOfTypeExport_source_EMPTY)
+        [Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfTypeExport_source_typeDeclaration,
+         Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfTypeExport_source_moduleTypeExport,
+         Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfTypeExport_source_moduleNamespace]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SourceOfTypeExport_source" (Prelude.Just 0))
+{-# LINE 1781 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Flow.Types.SourceOfTypeExport_source =
+     'Angle.TField "typeDeclaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.TypeDeclaration)
+       ('Angle.TField "moduleTypeExport"
+          (Glean.KeyType Glean.Schema.Flow.Types.ModuleTypeExport)
+          ('Angle.TField "moduleNamespace"
+             (Glean.KeyType Glean.Schema.Flow.Types.Module)
+             ('Angle.TNoFields)))
+{-# LINE 1783 "glean/schema/thrift/flow_include.hs" #-}
+instance Glean.Type Glean.Schema.Flow.Types.SourceOfExport_source
+         where
+  buildRtsValue b Glean.Schema.Flow.Types.SourceOfExport_source_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfExport_source_declaration x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfExport_source_memberDeclaration x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfExport_source_moduleExport x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Flow.Types.SourceOfExport_source_moduleNamespace x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Flow.Types.SourceOfExport_source_EMPTY)
+        [Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfExport_source_declaration,
+         Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfExport_source_memberDeclaration,
+         Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfExport_source_moduleExport,
+         Glean.mapD
+           Glean.Schema.Flow.Types.SourceOfExport_source_moduleNamespace]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "flow.SourceOfExport_source" (Prelude.Just 0))
+{-# LINE 1807 "glean/schema/thrift/flow_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Flow.Types.SourceOfExport_source =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Flow.Types.Declaration)
+       ('Angle.TField "memberDeclaration"
+          (Glean.KeyType Glean.Schema.Flow.Types.MemberDeclaration)
+          ('Angle.TField "moduleExport"
+             (Glean.KeyType Glean.Schema.Flow.Types.ModuleExport)
+             ('Angle.TField "moduleNamespace"
+                (Glean.KeyType Glean.Schema.Flow.Types.Module)
+                ('Angle.TNoFields))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Glass/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Glass/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Glass/Types.hs
@@ -0,0 +1,443 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/glass_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/glass_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/glass_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Glass/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Glass.Types
+       (pREDICATE_VERSIONS, FileInfo_id,
+        FileInfo(FileInfo, fileInfo_id, fileInfo_key),
+        FileMetadata(FileMetadata, fileMetadata_indexed,
+                     fileMetadata_offsets, fileMetadata_digest,
+                     fileMetadata_indexFailure),
+        FileInfo_key(FileInfo_key, fileInfo_key_file, fileInfo_key_info))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Digest.Types as Glean.Schema.Digest
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Schema.Digest.Types
+{-# LINE 16 "glean/schema/thrift/glass_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 80 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Glass/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("FileInfo", 1)]
+
+type FileInfo_id = Glean.Id
+
+data FileInfo = FileInfo{fileInfo_id ::
+                         {-# UNPACK #-} !FileInfo_id,
+                         fileInfo_key :: Prelude.Maybe FileInfo_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileInfo where
+  toJSON (FileInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileInfo where
+  buildStruct _proxy (FileInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileInfo where
+  rnf (FileInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileInfo where
+  def = FileInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileInfo where
+  hashWithSalt __salt (FileInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data FileMetadata = FileMetadata{fileMetadata_indexed ::
+                                 Prelude.Bool,
+                                 fileMetadata_offsets :: Prelude.Maybe Glean.Schema.Src.FileLines,
+                                 fileMetadata_digest :: Prelude.Maybe Glean.Schema.Digest.Digest,
+                                 fileMetadata_indexFailure ::
+                                 Prelude.Maybe Glean.Schema.Src.IndexFailure}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileMetadata where
+  toJSON
+    (FileMetadata __field__indexed __field__offsets __field__digest
+       __field__indexFailure)
+    = Aeson.object
+        ("indexed" .= __field__indexed :
+           Prelude.maybe Prelude.id ((:) . ("offsets" .=)) __field__offsets
+             (Prelude.maybe Prelude.id ((:) . ("digest" .=)) __field__digest
+                (Prelude.maybe Prelude.id ((:) . ("indexFailure" .=))
+                   __field__indexFailure
+                   Prelude.mempty)))
+
+instance Thrift.ThriftStruct FileMetadata where
+  buildStruct _proxy
+    (FileMetadata __field__indexed __field__offsets __field__digest
+       __field__indexFailure)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "indexed" 1 0 __field__indexed :
+           let (__cereal__offsets, __id__offsets)
+                 = case __field__offsets of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "offsets"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__offsets
+               (let (__cereal__digest, __id__digest)
+                      = case __field__digest of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "digest"
+                                                     (Thrift.getStructType _proxy)
+                                                     3
+                                                     __id__offsets
+                                                     (Thrift.buildStruct _proxy _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__offsets)
+                  in
+                  __cereal__digest
+                    (case __field__indexFailure of
+                       Prelude.Just _val -> Thrift.genField _proxy "indexFailure"
+                                              (Thrift.getStructType _proxy)
+                                              4
+                                              __id__digest
+                                              (Thrift.buildStruct _proxy _val)
+                                              : []
+                       Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__indexed <- ST.newSTRef Prelude.False
+            __field__offsets <- ST.newSTRef Prelude.Nothing
+            __field__digest <- ST.newSTRef Prelude.Nothing
+            __field__indexFailure <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__indexed
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__offsets
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__digest
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__indexFailure
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__indexed <- ST.readSTRef
+                                                                  __field__indexed
+                                             !__val__offsets <- ST.readSTRef __field__offsets
+                                             !__val__digest <- ST.readSTRef __field__digest
+                                             !__val__indexFailure <- ST.readSTRef
+                                                                       __field__indexFailure
+                                             Prelude.pure
+                                               (FileMetadata __val__indexed __val__offsets
+                                                  __val__digest
+                                                  __val__indexFailure)
+              _idMap
+                = HashMap.fromList
+                    [("indexed", 1), ("offsets", 2), ("digest", 3),
+                     ("indexFailure", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FileMetadata where
+  rnf
+    (FileMetadata __field__indexed __field__offsets __field__digest
+       __field__indexFailure)
+    = DeepSeq.rnf __field__indexed `Prelude.seq`
+        DeepSeq.rnf __field__offsets `Prelude.seq`
+          DeepSeq.rnf __field__digest `Prelude.seq`
+            DeepSeq.rnf __field__indexFailure `Prelude.seq` ()
+
+instance Default.Default FileMetadata where
+  def
+    = FileMetadata Prelude.False Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable FileMetadata where
+  hashWithSalt __salt
+    (FileMetadata _indexed _offsets _digest _indexFailure)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _indexed)
+              _offsets)
+           _digest)
+        _indexFailure
+
+data FileInfo_key = FileInfo_key{fileInfo_key_file ::
+                                 Glean.Schema.Src.File,
+                                 fileInfo_key_info :: FileMetadata}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileInfo_key where
+  toJSON (FileInfo_key __field__file __field__info)
+    = Aeson.object
+        ("file" .= __field__file :
+           "info" .= __field__info : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileInfo_key where
+  buildStruct _proxy (FileInfo_key __field__file __field__info)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "info" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__info)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__info <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__info
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__info <- ST.readSTRef __field__info
+                                             Prelude.pure (FileInfo_key __val__file __val__info)
+              _idMap = HashMap.fromList [("file", 1), ("info", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileInfo_key where
+  rnf (FileInfo_key __field__file __field__info)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__info `Prelude.seq` ()
+
+instance Default.Default FileInfo_key where
+  def = FileInfo_key Default.def Default.def
+
+instance Hashable.Hashable FileInfo_key where
+  hashWithSalt __salt (FileInfo_key _file _info)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _info
+{-# LINE 19 "glean/schema/thrift/glass_include.hs" #-}
+instance Glean.Type Glean.Schema.Glass.Types.FileInfo_key where
+  buildRtsValue b (Glean.Schema.Glass.Types.FileInfo_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Glass.Types.FileInfo_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glass.FileInfo_key" (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/glass_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Glass.Types.FileInfo_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "info" (Glean.Schema.Glass.Types.FileMetadata)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/glass_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Glass.Types.FileInfo where
+  type KeyType Glean.Schema.Glass.Types.FileInfo =
+       Glean.Schema.Glass.Types.FileInfo_key
+  getName _proxy = Glean.PredicateRef "glass.FileInfo" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Glass.Types.fileInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Glass.Types.FileInfo x k
+  getFactKey = Glean.Schema.Glass.Types.fileInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/glass_include.hs" #-}
+instance Glean.Type Glean.Schema.Glass.Types.FileInfo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/glass_include.hs" #-}
+instance Glean.Type Glean.Schema.Glass.Types.FileMetadata where
+  buildRtsValue b (Glean.Schema.Glass.Types.FileMetadata x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Glass.Types.FileMetadata <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glass.FileMetadata" (Prelude.Just 1))
+{-# LINE 58 "glean/schema/thrift/glass_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Glass.Types.FileMetadata =
+     'Angle.TField "indexed" (Prelude.Bool)
+       ('Angle.TField "offsets"
+          (Prelude.Maybe Glean.Schema.Src.Types.FileLines)
+          ('Angle.TField "digest"
+             (Prelude.Maybe Glean.Schema.Digest.Types.Digest)
+             ('Angle.TField "indexFailure"
+                (Prelude.Maybe Glean.Schema.Src.Types.IndexFailure)
+                ('Angle.TNoFields))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/GleanTest/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/GleanTest/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/GleanTest/Types.hs
@@ -0,0 +1,10199 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/glean_test_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/glean_test_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/glean_test_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/GleanTest/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.GleanTest.Types
+       (pREDICATE_VERSIONS, NothingTest_id,
+        NothingTest(NothingTest, nothingTest_id, nothingTest_key),
+        ViaStringPair_id,
+        ViaStringPair(ViaStringPair, viaStringPair_id, viaStringPair_key),
+        Unbound2_id, Unbound2(Unbound2, unbound2_id, unbound2_key),
+        Unbound_id, Unbound(Unbound, unbound_id, unbound_key),
+        TreeToTree_id,
+        TreeToTree(TreeToTree, treeToTree_id, treeToTree_key,
+                   treeToTree_value),
+        Tree_id, Tree(Tree, tree_id, tree_key), StringPairBox_id,
+        StringPairBox(StringPairBox, stringPairBox_id, stringPairBox_key),
+        StringPair_id,
+        StringPair(StringPair, stringPair_id, stringPair_key),
+        StoredRevStringPairWithRev_id,
+        StoredRevStringPairWithRev(StoredRevStringPairWithRev,
+                                   storedRevStringPairWithRev_id, storedRevStringPairWithRev_key),
+        StoredRevStringPairWithA_id,
+        StoredRevStringPairWithA(StoredRevStringPairWithA,
+                                 storedRevStringPairWithA_id, storedRevStringPairWithA_key),
+        StoredRevStringPairSum_id,
+        StoredRevStringPairSum(StoredRevStringPairSum,
+                               storedRevStringPairSum_id, storedRevStringPairSum_key),
+        StoredRevStringPair_id,
+        StoredRevStringPair(StoredRevStringPair, storedRevStringPair_id,
+                            storedRevStringPair_key),
+        StoredDualStringPair_id,
+        StoredDualStringPair(StoredDualStringPair, storedDualStringPair_id,
+                             storedDualStringPair_key),
+        SkipRevEdge_id,
+        SkipRevEdge(SkipRevEdge, skipRevEdge_id, skipRevEdge_key),
+        SameString_id,
+        SameString(SameString, sameString_id, sameString_key),
+        RevStringPairs_id,
+        RevStringPairs(RevStringPairs, revStringPairs_id,
+                       revStringPairs_key),
+        RevStringPairRec_id,
+        RevStringPairRec(RevStringPairRec, revStringPairRec_id,
+                         revStringPairRec_key),
+        RevStringPair_id,
+        RevStringPair(RevStringPair, revStringPair_id, revStringPair_key),
+        RevRevStringPair_id,
+        RevRevStringPair(RevRevStringPair, revRevStringPair_id,
+                         revRevStringPair_key),
+        RevEdge_id, RevEdge(RevEdge, revEdge_id, revEdge_key),
+        ReflStringPair_id,
+        ReflStringPair(ReflStringPair, reflStringPair_id,
+                       reflStringPair_key),
+        RefRef_id, RefRef(RefRef, refRef_id, refRef_key), Ref_id,
+        Ref(Ref, ref_id, ref_key), Qux_id, Qux(Qux, qux_id, qux_key),
+        Predicate_0_id,
+        Predicate_0(Predicate_0, predicate_0_id, predicate_0_key),
+        NodePair_id, NodePair(NodePair, nodePair_id, nodePair_key),
+        Node_id, Node(Node, node_id, node_key), Name_id,
+        Name(Name, name_id, name_key), MatchOneAlt_id,
+        MatchOneAlt(MatchOneAlt, matchOneAlt_id, matchOneAlt_key),
+        LeftOr2_id, LeftOr2(LeftOr2, leftOr2_id, leftOr2_key), LeftOr_id,
+        LeftOr(LeftOr, leftOr_id, leftOr_key), KeyValue_id,
+        KeyValue(KeyValue, keyValue_id, keyValue_key, keyValue_value),
+        IsThree_id, IsThree(IsThree, isThree_id, isThree_key), IsParent_id,
+        IsParent(IsParent, isParent_id, isParent_key), IsGlean_id,
+        IsGlean(IsGlean, isGlean_id, isGlean_key), FooToFoo_id,
+        FooToFoo(FooToFoo, fooToFoo_id, fooToFoo_key, fooToFoo_value),
+        Foo_id, Foo(Foo, foo_id, foo_key, foo_value), Expr_id,
+        Expr(Expr, expr_id, expr_key), EmptyStoredStringPair_id,
+        EmptyStoredStringPair(EmptyStoredStringPair,
+                              emptyStoredStringPair_id, emptyStoredStringPair_key),
+        EmptyPred_id, EmptyPred(EmptyPred, emptyPred_id, emptyPred_key),
+        EdgeWrapper_id,
+        EdgeWrapper(EdgeWrapper, edgeWrapper_id, edgeWrapper_key),
+        EdgeFromNotA_id,
+        EdgeFromNotA(EdgeFromNotA, edgeFromNotA_id, edgeFromNotA_key),
+        Edge_id, Edge(Edge, edge_id, edge_key), DualStringPair_id,
+        DualStringPair(DualStringPair, dualStringPair_id,
+                       dualStringPair_key),
+        DerivedKeyValue2_id,
+        DerivedKeyValue2(DerivedKeyValue2, derivedKeyValue2_id,
+                         derivedKeyValue2_key, derivedKeyValue2_value),
+        DerivedKeyValue_id,
+        DerivedKeyValue(DerivedKeyValue, derivedKeyValue_id,
+                        derivedKeyValue_key),
+        Bar_id, Bar(Bar, bar_id, bar_key, bar_value), Predicate_id,
+        Predicate(Predicate, predicate_id, predicate_key),
+        NothingTest_key(NothingTest_key, nothingTest_key_a,
+                        nothingTest_key_b),
+        WrappedStringPair(WrappedStringPair, wrappedStringPair_wrapped),
+        ViaStringPair_key(ViaStringPair_key, viaStringPair_key_fst,
+                          viaStringPair_key_snd),
+        Unbound2_key(Unbound2_key, unbound2_key_x, unbound2_key_y),
+        Unbound_key(Unbound_key, unbound_key_x, unbound_key_y),
+        TreeToTree_value,
+        Tree_key(Tree_key, tree_key_node, tree_key_left, tree_key_right),
+        Sum(Sum_EMPTY, Sum_mon, Sum_tue, Sum_wed),
+        StringPairBox_key(StringPairBox_key, stringPairBox_key_box),
+        StringPair_key(StringPair_key, stringPair_key_fst,
+                       stringPair_key_snd),
+        StoredRevStringPairWithRev_key(StoredRevStringPairWithRev_key,
+                                       storedRevStringPairWithRev_key_fst,
+                                       storedRevStringPairWithRev_key_snd),
+        StoredRevStringPairWithA_key(StoredRevStringPairWithA_key,
+                                     storedRevStringPairWithA_key_fst,
+                                     storedRevStringPairWithA_key_snd),
+        StoredRevStringPairSum_key(StoredRevStringPairSum_key,
+                                   storedRevStringPairSum_key_fst, storedRevStringPairSum_key_snd),
+        StoredRevStringPair_key(StoredRevStringPair_key,
+                                storedRevStringPair_key_fst, storedRevStringPair_key_snd),
+        StoredDualStringPair_key(StoredDualStringPair_key,
+                                 storedDualStringPair_key_fst, storedDualStringPair_key_snd),
+        SkipRevEdge_key(SkipRevEdge_key, skipRevEdge_key_child,
+                        skipRevEdge_key_grandparent),
+        SameString_key(SameString_key, sameString_key_x, sameString_key_y),
+        RevStringPairs_key(RevStringPairs_key, revStringPairs_key_x,
+                           revStringPairs_key_r),
+        RevStringPairRec_key(RevStringPairRec_key,
+                             revStringPairRec_key_fst, revStringPairRec_key_snd),
+        RevStringPair_key(RevStringPair_key, revStringPair_key_fst,
+                          revStringPair_key_snd),
+        RevRevStringPair_key(RevRevStringPair_key,
+                             revRevStringPair_key_fst, revRevStringPair_key_snd),
+        RevEdge_key(RevEdge_key, revEdge_key_child, revEdge_key_parent),
+        NodePair_key(NodePair_key, nodePair_key_fst, nodePair_key_snd),
+        Node_key(Node_key, node_key_label),
+        MatchOneAlt_key(MatchOneAlt_key, matchOneAlt_key_x,
+                        matchOneAlt_key_y),
+        LeftOr2_key(LeftOr2_key, leftOr2_key_x, leftOr2_key_y),
+        LeftOr_key(LeftOr_key, leftOr_key_x, leftOr_key_y),
+        KeyValue_key(KeyValue_key, keyValue_key_kstring,
+                     keyValue_key_knat),
+        KeyValue_value(KeyValue_value, keyValue_value_vnat,
+                       keyValue_value_vstring),
+        FooToFoo_value, Foo_value,
+        Expr_ap_(Expr_ap_, expr_ap__fun, expr_ap__arg),
+        Expr_lam_(Expr_lam_, expr_lam__var_, expr_lam__body),
+        Expr_key(Expr_key_EMPTY, Expr_key_var_, Expr_key_lit,
+                 Expr_key_prim, Expr_key_ap, Expr_key_lam),
+        Enum_(Enum__red, Enum__green, Enum__blue, Enum___UNKNOWN),
+        Rec(Rec, rec_alpha, rec_beta),
+        Entity(Entity_EMPTY, Entity_cxx, Entity_pp),
+        EmptyStoredStringPair_key(EmptyStoredStringPair_key,
+                                  emptyStoredStringPair_key_fst, emptyStoredStringPair_key_snd),
+        EdgeWrapper_key(EdgeWrapper_key, edgeWrapper_key_edge),
+        EdgeSum(EdgeSum_EMPTY, EdgeSum_fst, EdgeSum_snd),
+        Edge_key(Edge_key, edge_key_parent, edge_key_child),
+        DualStringPair_key(DualStringPair_key, dualStringPair_key_fst,
+                           dualStringPair_key_snd),
+        DerivedKeyValue2_key(DerivedKeyValue2_key,
+                             derivedKeyValue2_key_kstring, derivedKeyValue2_key_knat),
+        DerivedKeyValue2_value(DerivedKeyValue2_value,
+                               derivedKeyValue2_value_vnat, derivedKeyValue2_value_vstring),
+        DerivedKeyValue_key(DerivedKeyValue_key,
+                            derivedKeyValue_key_kstring, derivedKeyValue_key_knat,
+                            derivedKeyValue_key_vnat, derivedKeyValue_key_vstring),
+        Bar_value, ArrayString, ArrayNat, ArrayByte, ArrayBool,
+        KitchenSink_record_(KitchenSink_record_, kitchenSink_record__a,
+                            kitchenSink_record__b),
+        KitchenSink_sum_(KitchenSink_sum__EMPTY, KitchenSink_sum__c,
+                         KitchenSink_sum__d),
+        KitchenSink_enum_(KitchenSink_enum__e, KitchenSink_enum__f,
+                          KitchenSink_enum__g, KitchenSink_enum___UNKNOWN),
+        KitchenSink(KitchenSink, kitchenSink_byt, kitchenSink_nat,
+                    kitchenSink_bool_, kitchenSink_string_, kitchenSink_pred,
+                    kitchenSink_maybe_, kitchenSink_record_, kitchenSink_sum_,
+                    kitchenSink_enum_, kitchenSink_named_record_,
+                    kitchenSink_named_sum_, kitchenSink_named_enum_,
+                    kitchenSink_array_of_byte, kitchenSink_array_of_nat,
+                    kitchenSink_array_of_bool, kitchenSink_array_of_string,
+                    kitchenSink_array_of_pred, kitchenSink_array_of_named_record,
+                    kitchenSink_array_of_named_sum, kitchenSink_array_of_named_enum,
+                    kitchenSink_array2_of_byte, kitchenSink_array2_of_nat,
+                    kitchenSink_array2_of_bool, kitchenSink_array2_of_string,
+                    kitchenSink_set_of_nat, kitchenSink_set_of_string,
+                    kitchenSink_set_of_pred))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.Pp1.Types as Glean.Schema.Pp1
+import qualified Glean.Schema.Sys.Types as Glean.Schema.Sys
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 16 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Schema.Pp1.Types
+{-# LINE 17 "glean/schema/thrift/glean_test_include.hs" #-}
+import qualified Glean.Schema.Sys.Types
+{-# LINE 255 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/GleanTest/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("StoredRevStringPairSum", 6), ("MatchOneAlt", 6),
+       ("DerivedKeyValue", 6), ("ViaStringPair", 6), ("Predicate", 6),
+       ("EmptyPred", 6), ("Node", 6), ("EdgeWrapper", 6), ("Unbound", 6),
+       ("TreeToTree", 6), ("StoredRevStringPairWithA", 6),
+       ("RevRevStringPair", 6), ("Bar", 6), ("KeyValue", 6),
+       ("RevStringPairs", 6), ("LeftOr", 6), ("IsGlean", 6),
+       ("StoredDualStringPair", 6), ("SkipRevEdge", 6),
+       ("DualStringPair", 6), ("Foo", 6), ("Predicate_0", 0),
+       ("RevStringPair", 6), ("StringPairBox", 6), ("IsParent", 6),
+       ("IsThree", 6), ("FooToFoo", 6), ("RevStringPairRec", 6),
+       ("nothingTest", 6), ("RefRef", 6), ("Qux", 6),
+       ("StoredRevStringPair", 6), ("EmptyStoredStringPair", 6),
+       ("Ref", 6), ("StringPair", 6), ("DerivedKeyValue2", 6),
+       ("NodePair", 6), ("ReflStringPair", 6), ("LeftOr2", 6),
+       ("Expr", 6), ("EdgeFromNotA", 6), ("Unbound2", 6),
+       ("StoredRevStringPairWithRev", 6), ("RevEdge", 6), ("Edge", 6),
+       ("Name", 6), ("SameString", 6), ("Tree", 6)]
+
+type NothingTest_id = Glean.Id
+
+data NothingTest = NothingTest{nothingTest_id ::
+                               {-# UNPACK #-} !NothingTest_id,
+                               nothingTest_key :: Prelude.Maybe NothingTest_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NothingTest where
+  toJSON (NothingTest __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NothingTest where
+  buildStruct _proxy (NothingTest __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NothingTest __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NothingTest where
+  rnf (NothingTest __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NothingTest where
+  def = NothingTest Default.def Prelude.Nothing
+
+instance Hashable.Hashable NothingTest where
+  hashWithSalt __salt (NothingTest _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ViaStringPair_id = Glean.Id
+
+data ViaStringPair = ViaStringPair{viaStringPair_id ::
+                                   {-# UNPACK #-} !ViaStringPair_id,
+                                   viaStringPair_key :: Prelude.Maybe ViaStringPair_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ViaStringPair where
+  toJSON (ViaStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ViaStringPair where
+  buildStruct _proxy (ViaStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ViaStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ViaStringPair where
+  rnf (ViaStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ViaStringPair where
+  def = ViaStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable ViaStringPair where
+  hashWithSalt __salt (ViaStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Unbound2_id = Glean.Id
+
+data Unbound2 = Unbound2{unbound2_id ::
+                         {-# UNPACK #-} !Unbound2_id,
+                         unbound2_key :: Prelude.Maybe Unbound2_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Unbound2 where
+  toJSON (Unbound2 __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Unbound2 where
+  buildStruct _proxy (Unbound2 __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Unbound2 __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Unbound2 where
+  rnf (Unbound2 __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Unbound2 where
+  def = Unbound2 Default.def Prelude.Nothing
+
+instance Hashable.Hashable Unbound2 where
+  hashWithSalt __salt (Unbound2 _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Unbound_id = Glean.Id
+
+data Unbound = Unbound{unbound_id :: {-# UNPACK #-} !Unbound_id,
+                       unbound_key :: Prelude.Maybe Unbound_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Unbound where
+  toJSON (Unbound __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Unbound where
+  buildStruct _proxy (Unbound __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Unbound __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Unbound where
+  rnf (Unbound __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Unbound where
+  def = Unbound Default.def Prelude.Nothing
+
+instance Hashable.Hashable Unbound where
+  hashWithSalt __salt (Unbound _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TreeToTree_id = Glean.Id
+
+data TreeToTree = TreeToTree{treeToTree_id ::
+                             {-# UNPACK #-} !TreeToTree_id,
+                             treeToTree_key :: Prelude.Maybe Tree,
+                             treeToTree_value :: Prelude.Maybe TreeToTree_value}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TreeToTree where
+  toJSON (TreeToTree __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct TreeToTree where
+  buildStruct _proxy
+    (TreeToTree __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (TreeToTree __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TreeToTree where
+  rnf (TreeToTree __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default TreeToTree where
+  def = TreeToTree Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable TreeToTree where
+  hashWithSalt __salt (TreeToTree _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Tree_id = Glean.Id
+
+data Tree = Tree{tree_id :: {-# UNPACK #-} !Tree_id,
+                 tree_key :: Prelude.Maybe Tree_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Tree where
+  toJSON (Tree __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Tree where
+  buildStruct _proxy (Tree __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Tree __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Tree where
+  rnf (Tree __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Tree where
+  def = Tree Default.def Prelude.Nothing
+
+instance Hashable.Hashable Tree where
+  hashWithSalt __salt (Tree _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StringPairBox_id = Glean.Id
+
+data StringPairBox = StringPairBox{stringPairBox_id ::
+                                   {-# UNPACK #-} !StringPairBox_id,
+                                   stringPairBox_key :: Prelude.Maybe StringPairBox_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringPairBox where
+  toJSON (StringPairBox __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StringPairBox where
+  buildStruct _proxy (StringPairBox __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StringPairBox __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringPairBox where
+  rnf (StringPairBox __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StringPairBox where
+  def = StringPairBox Default.def Prelude.Nothing
+
+instance Hashable.Hashable StringPairBox where
+  hashWithSalt __salt (StringPairBox _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StringPair_id = Glean.Id
+
+data StringPair = StringPair{stringPair_id ::
+                             {-# UNPACK #-} !StringPair_id,
+                             stringPair_key :: Prelude.Maybe StringPair_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringPair where
+  toJSON (StringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StringPair where
+  buildStruct _proxy (StringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringPair where
+  rnf (StringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StringPair where
+  def = StringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable StringPair where
+  hashWithSalt __salt (StringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StoredRevStringPairWithRev_id = Glean.Id
+
+data StoredRevStringPairWithRev = StoredRevStringPairWithRev{storedRevStringPairWithRev_id
+                                                             ::
+                                                             {-# UNPACK #-} !StoredRevStringPairWithRev_id,
+                                                             storedRevStringPairWithRev_key ::
+                                                             Prelude.Maybe
+                                                               StoredRevStringPairWithRev_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairWithRev where
+  toJSON (StoredRevStringPairWithRev __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairWithRev where
+  buildStruct _proxy
+    (StoredRevStringPairWithRev __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (StoredRevStringPairWithRev __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairWithRev where
+  rnf (StoredRevStringPairWithRev __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairWithRev where
+  def = StoredRevStringPairWithRev Default.def Prelude.Nothing
+
+instance Hashable.Hashable StoredRevStringPairWithRev where
+  hashWithSalt __salt (StoredRevStringPairWithRev _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StoredRevStringPairWithA_id = Glean.Id
+
+data StoredRevStringPairWithA = StoredRevStringPairWithA{storedRevStringPairWithA_id
+                                                         ::
+                                                         {-# UNPACK #-} !StoredRevStringPairWithA_id,
+                                                         storedRevStringPairWithA_key ::
+                                                         Prelude.Maybe StoredRevStringPairWithA_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairWithA where
+  toJSON (StoredRevStringPairWithA __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairWithA where
+  buildStruct _proxy
+    (StoredRevStringPairWithA __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (StoredRevStringPairWithA __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairWithA where
+  rnf (StoredRevStringPairWithA __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairWithA where
+  def = StoredRevStringPairWithA Default.def Prelude.Nothing
+
+instance Hashable.Hashable StoredRevStringPairWithA where
+  hashWithSalt __salt (StoredRevStringPairWithA _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StoredRevStringPairSum_id = Glean.Id
+
+data StoredRevStringPairSum = StoredRevStringPairSum{storedRevStringPairSum_id
+                                                     :: {-# UNPACK #-} !StoredRevStringPairSum_id,
+                                                     storedRevStringPairSum_key ::
+                                                     Prelude.Maybe StoredRevStringPairSum_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairSum where
+  toJSON (StoredRevStringPairSum __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairSum where
+  buildStruct _proxy
+    (StoredRevStringPairSum __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (StoredRevStringPairSum __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairSum where
+  rnf (StoredRevStringPairSum __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairSum where
+  def = StoredRevStringPairSum Default.def Prelude.Nothing
+
+instance Hashable.Hashable StoredRevStringPairSum where
+  hashWithSalt __salt (StoredRevStringPairSum _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StoredRevStringPair_id = Glean.Id
+
+data StoredRevStringPair = StoredRevStringPair{storedRevStringPair_id
+                                               :: {-# UNPACK #-} !StoredRevStringPair_id,
+                                               storedRevStringPair_key ::
+                                               Prelude.Maybe StoredRevStringPair_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPair where
+  toJSON (StoredRevStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPair where
+  buildStruct _proxy (StoredRevStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StoredRevStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPair where
+  rnf (StoredRevStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPair where
+  def = StoredRevStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable StoredRevStringPair where
+  hashWithSalt __salt (StoredRevStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StoredDualStringPair_id = Glean.Id
+
+data StoredDualStringPair = StoredDualStringPair{storedDualStringPair_id
+                                                 :: {-# UNPACK #-} !StoredDualStringPair_id,
+                                                 storedDualStringPair_key ::
+                                                 Prelude.Maybe StoredDualStringPair_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredDualStringPair where
+  toJSON (StoredDualStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredDualStringPair where
+  buildStruct _proxy (StoredDualStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (StoredDualStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredDualStringPair where
+  rnf (StoredDualStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StoredDualStringPair where
+  def = StoredDualStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable StoredDualStringPair where
+  hashWithSalt __salt (StoredDualStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SkipRevEdge_id = Glean.Id
+
+data SkipRevEdge = SkipRevEdge{skipRevEdge_id ::
+                               {-# UNPACK #-} !SkipRevEdge_id,
+                               skipRevEdge_key :: Prelude.Maybe SkipRevEdge_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SkipRevEdge where
+  toJSON (SkipRevEdge __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SkipRevEdge where
+  buildStruct _proxy (SkipRevEdge __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SkipRevEdge __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SkipRevEdge where
+  rnf (SkipRevEdge __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SkipRevEdge where
+  def = SkipRevEdge Default.def Prelude.Nothing
+
+instance Hashable.Hashable SkipRevEdge where
+  hashWithSalt __salt (SkipRevEdge _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SameString_id = Glean.Id
+
+data SameString = SameString{sameString_id ::
+                             {-# UNPACK #-} !SameString_id,
+                             sameString_key :: Prelude.Maybe SameString_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SameString where
+  toJSON (SameString __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SameString where
+  buildStruct _proxy (SameString __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SameString __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SameString where
+  rnf (SameString __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SameString where
+  def = SameString Default.def Prelude.Nothing
+
+instance Hashable.Hashable SameString where
+  hashWithSalt __salt (SameString _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RevStringPairs_id = Glean.Id
+
+data RevStringPairs = RevStringPairs{revStringPairs_id ::
+                                     {-# UNPACK #-} !RevStringPairs_id,
+                                     revStringPairs_key :: Prelude.Maybe RevStringPairs_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPairs where
+  toJSON (RevStringPairs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPairs where
+  buildStruct _proxy (RevStringPairs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RevStringPairs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPairs where
+  rnf (RevStringPairs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RevStringPairs where
+  def = RevStringPairs Default.def Prelude.Nothing
+
+instance Hashable.Hashable RevStringPairs where
+  hashWithSalt __salt (RevStringPairs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RevStringPairRec_id = Glean.Id
+
+data RevStringPairRec = RevStringPairRec{revStringPairRec_id ::
+                                         {-# UNPACK #-} !RevStringPairRec_id,
+                                         revStringPairRec_key :: Prelude.Maybe RevStringPairRec_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPairRec where
+  toJSON (RevStringPairRec __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPairRec where
+  buildStruct _proxy (RevStringPairRec __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RevStringPairRec __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPairRec where
+  rnf (RevStringPairRec __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RevStringPairRec where
+  def = RevStringPairRec Default.def Prelude.Nothing
+
+instance Hashable.Hashable RevStringPairRec where
+  hashWithSalt __salt (RevStringPairRec _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RevStringPair_id = Glean.Id
+
+data RevStringPair = RevStringPair{revStringPair_id ::
+                                   {-# UNPACK #-} !RevStringPair_id,
+                                   revStringPair_key :: Prelude.Maybe RevStringPair_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPair where
+  toJSON (RevStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPair where
+  buildStruct _proxy (RevStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RevStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPair where
+  rnf (RevStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RevStringPair where
+  def = RevStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable RevStringPair where
+  hashWithSalt __salt (RevStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RevRevStringPair_id = Glean.Id
+
+data RevRevStringPair = RevRevStringPair{revRevStringPair_id ::
+                                         {-# UNPACK #-} !RevRevStringPair_id,
+                                         revRevStringPair_key :: Prelude.Maybe RevRevStringPair_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevRevStringPair where
+  toJSON (RevRevStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RevRevStringPair where
+  buildStruct _proxy (RevRevStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RevRevStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevRevStringPair where
+  rnf (RevRevStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RevRevStringPair where
+  def = RevRevStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable RevRevStringPair where
+  hashWithSalt __salt (RevRevStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RevEdge_id = Glean.Id
+
+data RevEdge = RevEdge{revEdge_id :: {-# UNPACK #-} !RevEdge_id,
+                       revEdge_key :: Prelude.Maybe RevEdge_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevEdge where
+  toJSON (RevEdge __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RevEdge where
+  buildStruct _proxy (RevEdge __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RevEdge __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevEdge where
+  rnf (RevEdge __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RevEdge where
+  def = RevEdge Default.def Prelude.Nothing
+
+instance Hashable.Hashable RevEdge where
+  hashWithSalt __salt (RevEdge _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ReflStringPair_id = Glean.Id
+
+data ReflStringPair = ReflStringPair{reflStringPair_id ::
+                                     {-# UNPACK #-} !ReflStringPair_id,
+                                     reflStringPair_key :: Prelude.Maybe Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReflStringPair where
+  toJSON (ReflStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ReflStringPair where
+  buildStruct _proxy (ReflStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ReflStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReflStringPair where
+  rnf (ReflStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ReflStringPair where
+  def = ReflStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable ReflStringPair where
+  hashWithSalt __salt (ReflStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RefRef_id = Glean.Id
+
+data RefRef = RefRef{refRef_id :: {-# UNPACK #-} !RefRef_id,
+                     refRef_key :: Prelude.Maybe Ref}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefRef where
+  toJSON (RefRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RefRef where
+  buildStruct _proxy (RefRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RefRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RefRef where
+  rnf (RefRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RefRef where
+  def = RefRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable RefRef where
+  hashWithSalt __salt (RefRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Ref_id = Glean.Id
+
+data Ref = Ref{ref_id :: {-# UNPACK #-} !Ref_id,
+               ref_key :: Prelude.Maybe Predicate}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Ref where
+  toJSON (Ref __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Ref where
+  buildStruct _proxy (Ref __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Ref __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Ref where
+  rnf (Ref __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Ref where
+  def = Ref Default.def Prelude.Nothing
+
+instance Hashable.Hashable Ref where
+  hashWithSalt __salt (Ref _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Qux_id = Glean.Id
+
+data Qux = Qux{qux_id :: {-# UNPACK #-} !Qux_id,
+               qux_key :: Prelude.Maybe Text.Text}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Qux where
+  toJSON (Qux __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Qux where
+  buildStruct _proxy (Qux __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Qux __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Qux where
+  rnf (Qux __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Qux where
+  def = Qux Default.def Prelude.Nothing
+
+instance Hashable.Hashable Qux where
+  hashWithSalt __salt (Qux _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Predicate_0_id = Glean.Id
+
+data Predicate_0 = Predicate_0{predicate_0_id ::
+                               {-# UNPACK #-} !Predicate_0_id,
+                               predicate_0_key :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Predicate_0 where
+  toJSON (Predicate_0 __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Predicate_0 where
+  buildStruct _proxy (Predicate_0 __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Predicate_0 __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Predicate_0 where
+  rnf (Predicate_0 __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Predicate_0 where
+  def = Predicate_0 Default.def Prelude.Nothing
+
+instance Hashable.Hashable Predicate_0 where
+  hashWithSalt __salt (Predicate_0 _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NodePair_id = Glean.Id
+
+data NodePair = NodePair{nodePair_id ::
+                         {-# UNPACK #-} !NodePair_id,
+                         nodePair_key :: Prelude.Maybe NodePair_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NodePair where
+  toJSON (NodePair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NodePair where
+  buildStruct _proxy (NodePair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NodePair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NodePair where
+  rnf (NodePair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NodePair where
+  def = NodePair Default.def Prelude.Nothing
+
+instance Hashable.Hashable NodePair where
+  hashWithSalt __salt (NodePair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Node_id = Glean.Id
+
+data Node = Node{node_id :: {-# UNPACK #-} !Node_id,
+                 node_key :: Prelude.Maybe Node_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Node where
+  toJSON (Node __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Node where
+  buildStruct _proxy (Node __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Node __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Node where
+  rnf (Node __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Node where
+  def = Node Default.def Prelude.Nothing
+
+instance Hashable.Hashable Node where
+  hashWithSalt __salt (Node _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MatchOneAlt_id = Glean.Id
+
+data MatchOneAlt = MatchOneAlt{matchOneAlt_id ::
+                               {-# UNPACK #-} !MatchOneAlt_id,
+                               matchOneAlt_key :: Prelude.Maybe MatchOneAlt_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MatchOneAlt where
+  toJSON (MatchOneAlt __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MatchOneAlt where
+  buildStruct _proxy (MatchOneAlt __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MatchOneAlt __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MatchOneAlt where
+  rnf (MatchOneAlt __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MatchOneAlt where
+  def = MatchOneAlt Default.def Prelude.Nothing
+
+instance Hashable.Hashable MatchOneAlt where
+  hashWithSalt __salt (MatchOneAlt _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LeftOr2_id = Glean.Id
+
+data LeftOr2 = LeftOr2{leftOr2_id :: {-# UNPACK #-} !LeftOr2_id,
+                       leftOr2_key :: Prelude.Maybe LeftOr2_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LeftOr2 where
+  toJSON (LeftOr2 __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LeftOr2 where
+  buildStruct _proxy (LeftOr2 __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LeftOr2 __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LeftOr2 where
+  rnf (LeftOr2 __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LeftOr2 where
+  def = LeftOr2 Default.def Prelude.Nothing
+
+instance Hashable.Hashable LeftOr2 where
+  hashWithSalt __salt (LeftOr2 _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LeftOr_id = Glean.Id
+
+data LeftOr = LeftOr{leftOr_id :: {-# UNPACK #-} !LeftOr_id,
+                     leftOr_key :: Prelude.Maybe LeftOr_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LeftOr where
+  toJSON (LeftOr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LeftOr where
+  buildStruct _proxy (LeftOr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LeftOr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LeftOr where
+  rnf (LeftOr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LeftOr where
+  def = LeftOr Default.def Prelude.Nothing
+
+instance Hashable.Hashable LeftOr where
+  hashWithSalt __salt (LeftOr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KeyValue_id = Glean.Id
+
+data KeyValue = KeyValue{keyValue_id ::
+                         {-# UNPACK #-} !KeyValue_id,
+                         keyValue_key :: Prelude.Maybe KeyValue_key,
+                         keyValue_value :: Prelude.Maybe KeyValue_value}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KeyValue where
+  toJSON (KeyValue __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct KeyValue where
+  buildStruct _proxy
+    (KeyValue __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (KeyValue __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData KeyValue where
+  rnf (KeyValue __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default KeyValue where
+  def = KeyValue Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable KeyValue where
+  hashWithSalt __salt (KeyValue _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type IsThree_id = Glean.Id
+
+data IsThree = IsThree{isThree_id :: {-# UNPACK #-} !IsThree_id,
+                       isThree_key :: Prelude.Maybe Glean.Nat}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsThree where
+  toJSON (IsThree __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=))
+             (Prelude.fmap Glean.unNat __field__key)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsThree where
+  buildStruct _proxy (IsThree __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getI64Type _proxy)
+                                    2
+                                    1
+                                    ((Thrift.genI64 _proxy . Glean.unNat) _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsThree __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsThree where
+  rnf (IsThree __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsThree where
+  def = IsThree Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsThree where
+  hashWithSalt __salt (IsThree _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsParent_id = Glean.Id
+
+data IsParent = IsParent{isParent_id ::
+                         {-# UNPACK #-} !IsParent_id,
+                         isParent_key :: Prelude.Maybe Node}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsParent where
+  toJSON (IsParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsParent where
+  buildStruct _proxy (IsParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsParent where
+  rnf (IsParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsParent where
+  def = IsParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsParent where
+  hashWithSalt __salt (IsParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsGlean_id = Glean.Id
+
+data IsGlean = IsGlean{isGlean_id :: {-# UNPACK #-} !IsGlean_id,
+                       isGlean_key :: Prelude.Maybe Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsGlean where
+  toJSON (IsGlean __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsGlean where
+  buildStruct _proxy (IsGlean __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsGlean __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsGlean where
+  rnf (IsGlean __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsGlean where
+  def = IsGlean Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsGlean where
+  hashWithSalt __salt (IsGlean _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FooToFoo_id = Glean.Id
+
+data FooToFoo = FooToFoo{fooToFoo_id ::
+                         {-# UNPACK #-} !FooToFoo_id,
+                         fooToFoo_key :: Prelude.Maybe Foo,
+                         fooToFoo_value :: Prelude.Maybe FooToFoo_value}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FooToFoo where
+  toJSON (FooToFoo __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct FooToFoo where
+  buildStruct _proxy
+    (FooToFoo __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (FooToFoo __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FooToFoo where
+  rnf (FooToFoo __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default FooToFoo where
+  def = FooToFoo Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable FooToFoo where
+  hashWithSalt __salt (FooToFoo _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Foo_id = Glean.Id
+
+data Foo = Foo{foo_id :: {-# UNPACK #-} !Foo_id,
+               foo_key :: Prelude.Maybe Text.Text,
+               foo_value :: Prelude.Maybe Foo_value}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Foo where
+  toJSON (Foo __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct Foo where
+  buildStruct _proxy (Foo __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genText _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Foo __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Foo where
+  rnf (Foo __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Foo where
+  def = Foo Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable Foo where
+  hashWithSalt __salt (Foo _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Expr_id = Glean.Id
+
+data Expr = Expr{expr_id :: {-# UNPACK #-} !Expr_id,
+                 expr_key :: Prelude.Maybe Expr_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Expr where
+  toJSON (Expr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Expr where
+  buildStruct _proxy (Expr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Expr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Expr where
+  rnf (Expr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Expr where
+  def = Expr Default.def Prelude.Nothing
+
+instance Hashable.Hashable Expr where
+  hashWithSalt __salt (Expr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EmptyStoredStringPair_id = Glean.Id
+
+data EmptyStoredStringPair = EmptyStoredStringPair{emptyStoredStringPair_id
+                                                   :: {-# UNPACK #-} !EmptyStoredStringPair_id,
+                                                   emptyStoredStringPair_key ::
+                                                   Prelude.Maybe EmptyStoredStringPair_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EmptyStoredStringPair where
+  toJSON (EmptyStoredStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EmptyStoredStringPair where
+  buildStruct _proxy (EmptyStoredStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (EmptyStoredStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EmptyStoredStringPair where
+  rnf (EmptyStoredStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EmptyStoredStringPair where
+  def = EmptyStoredStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable EmptyStoredStringPair where
+  hashWithSalt __salt (EmptyStoredStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EmptyPred_id = Glean.Id
+
+data EmptyPred = EmptyPred{emptyPred_id ::
+                           {-# UNPACK #-} !EmptyPred_id,
+                           emptyPred_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EmptyPred where
+  toJSON (EmptyPred __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EmptyPred where
+  buildStruct _proxy (EmptyPred __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EmptyPred __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EmptyPred where
+  rnf (EmptyPred __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EmptyPred where
+  def = EmptyPred Default.def Prelude.Nothing
+
+instance Hashable.Hashable EmptyPred where
+  hashWithSalt __salt (EmptyPred _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EdgeWrapper_id = Glean.Id
+
+data EdgeWrapper = EdgeWrapper{edgeWrapper_id ::
+                               {-# UNPACK #-} !EdgeWrapper_id,
+                               edgeWrapper_key :: Prelude.Maybe EdgeWrapper_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EdgeWrapper where
+  toJSON (EdgeWrapper __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EdgeWrapper where
+  buildStruct _proxy (EdgeWrapper __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EdgeWrapper __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EdgeWrapper where
+  rnf (EdgeWrapper __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EdgeWrapper where
+  def = EdgeWrapper Default.def Prelude.Nothing
+
+instance Hashable.Hashable EdgeWrapper where
+  hashWithSalt __salt (EdgeWrapper _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EdgeFromNotA_id = Glean.Id
+
+data EdgeFromNotA = EdgeFromNotA{edgeFromNotA_id ::
+                                 {-# UNPACK #-} !EdgeFromNotA_id,
+                                 edgeFromNotA_key :: Prelude.Maybe Edge}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EdgeFromNotA where
+  toJSON (EdgeFromNotA __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EdgeFromNotA where
+  buildStruct _proxy (EdgeFromNotA __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EdgeFromNotA __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EdgeFromNotA where
+  rnf (EdgeFromNotA __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EdgeFromNotA where
+  def = EdgeFromNotA Default.def Prelude.Nothing
+
+instance Hashable.Hashable EdgeFromNotA where
+  hashWithSalt __salt (EdgeFromNotA _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Edge_id = Glean.Id
+
+data Edge = Edge{edge_id :: {-# UNPACK #-} !Edge_id,
+                 edge_key :: Prelude.Maybe Edge_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Edge where
+  toJSON (Edge __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Edge where
+  buildStruct _proxy (Edge __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Edge __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Edge where
+  rnf (Edge __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Edge where
+  def = Edge Default.def Prelude.Nothing
+
+instance Hashable.Hashable Edge where
+  hashWithSalt __salt (Edge _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DualStringPair_id = Glean.Id
+
+data DualStringPair = DualStringPair{dualStringPair_id ::
+                                     {-# UNPACK #-} !DualStringPair_id,
+                                     dualStringPair_key :: Prelude.Maybe DualStringPair_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DualStringPair where
+  toJSON (DualStringPair __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DualStringPair where
+  buildStruct _proxy (DualStringPair __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DualStringPair __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DualStringPair where
+  rnf (DualStringPair __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DualStringPair where
+  def = DualStringPair Default.def Prelude.Nothing
+
+instance Hashable.Hashable DualStringPair where
+  hashWithSalt __salt (DualStringPair _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DerivedKeyValue2_id = Glean.Id
+
+data DerivedKeyValue2 = DerivedKeyValue2{derivedKeyValue2_id ::
+                                         {-# UNPACK #-} !DerivedKeyValue2_id,
+                                         derivedKeyValue2_key :: Prelude.Maybe DerivedKeyValue2_key,
+                                         derivedKeyValue2_value ::
+                                         Prelude.Maybe DerivedKeyValue2_value}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedKeyValue2 where
+  toJSON (DerivedKeyValue2 __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DerivedKeyValue2 where
+  buildStruct _proxy
+    (DerivedKeyValue2 __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DerivedKeyValue2 __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedKeyValue2 where
+  rnf (DerivedKeyValue2 __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DerivedKeyValue2 where
+  def = DerivedKeyValue2 Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DerivedKeyValue2 where
+  hashWithSalt __salt (DerivedKeyValue2 _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DerivedKeyValue_id = Glean.Id
+
+data DerivedKeyValue = DerivedKeyValue{derivedKeyValue_id ::
+                                       {-# UNPACK #-} !DerivedKeyValue_id,
+                                       derivedKeyValue_key :: Prelude.Maybe DerivedKeyValue_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedKeyValue where
+  toJSON (DerivedKeyValue __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedKeyValue where
+  buildStruct _proxy (DerivedKeyValue __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DerivedKeyValue __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedKeyValue where
+  rnf (DerivedKeyValue __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DerivedKeyValue where
+  def = DerivedKeyValue Default.def Prelude.Nothing
+
+instance Hashable.Hashable DerivedKeyValue where
+  hashWithSalt __salt (DerivedKeyValue _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Bar_id = Glean.Id
+
+data Bar = Bar{bar_id :: {-# UNPACK #-} !Bar_id,
+               bar_key :: Prelude.Maybe Text.Text,
+               bar_value :: Prelude.Maybe Bar_value}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Bar where
+  toJSON (Bar __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct Bar where
+  buildStruct _proxy (Bar __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genText _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Bar __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Bar where
+  rnf (Bar __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Bar where
+  def = Bar Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable Bar where
+  hashWithSalt __salt (Bar _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Predicate_id = Glean.Id
+
+data Predicate = Predicate{predicate_id ::
+                           {-# UNPACK #-} !Predicate_id,
+                           predicate_key :: Prelude.Maybe KitchenSink}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Predicate where
+  toJSON (Predicate __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Predicate where
+  buildStruct _proxy (Predicate __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Predicate __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Predicate where
+  rnf (Predicate __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Predicate where
+  def = Predicate Default.def Prelude.Nothing
+
+instance Hashable.Hashable Predicate where
+  hashWithSalt __salt (Predicate _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data NothingTest_key = NothingTest_key{nothingTest_key_a ::
+                                       Prelude.Maybe Text.Text,
+                                       nothingTest_key_b :: Glean.Nat}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NothingTest_key where
+  toJSON (NothingTest_key __field__a __field__b)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("a" .=)) __field__a
+           ("b" .= Glean.unNat __field__b : Prelude.mempty))
+
+instance Thrift.ThriftStruct NothingTest_key where
+  buildStruct _proxy (NothingTest_key __field__a __field__b)
+    = Thrift.genStruct _proxy
+        (let (__cereal__a, __id__a)
+               = case __field__a of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "a" (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              (Thrift.genText _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__a
+             (Thrift.genField _proxy "b" (Thrift.getI64Type _proxy) 2 __id__a
+                ((Thrift.genI64 _proxy . Glean.unNat) __field__b)
+                : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__a <- ST.newSTRef Prelude.Nothing
+            __field__b <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__a
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__b
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__a <- ST.readSTRef __field__a
+                                             !__val__b <- ST.readSTRef __field__b
+                                             Prelude.pure (NothingTest_key __val__a __val__b)
+              _idMap = HashMap.fromList [("a", 1), ("b", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NothingTest_key where
+  rnf (NothingTest_key __field__a __field__b)
+    = DeepSeq.rnf __field__a `Prelude.seq`
+        DeepSeq.rnf __field__b `Prelude.seq` ()
+
+instance Default.Default NothingTest_key where
+  def = NothingTest_key Prelude.Nothing (Glean.Nat Default.def)
+
+instance Hashable.Hashable NothingTest_key where
+  hashWithSalt __salt (NothingTest_key _a _b)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _a) _b
+
+newtype WrappedStringPair = WrappedStringPair{wrappedStringPair_wrapped
+                                              :: StringPair}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON WrappedStringPair where
+  toJSON (WrappedStringPair __field__wrapped)
+    = Aeson.object ("wrapped" .= __field__wrapped : Prelude.mempty)
+
+instance Thrift.ThriftStruct WrappedStringPair where
+  buildStruct _proxy (WrappedStringPair __field__wrapped)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "wrapped" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__wrapped)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__wrapped <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__wrapped
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__wrapped <- ST.readSTRef
+                                                                  __field__wrapped
+                                             Prelude.pure (WrappedStringPair __val__wrapped)
+              _idMap = HashMap.fromList [("wrapped", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData WrappedStringPair where
+  rnf (WrappedStringPair __field__wrapped)
+    = DeepSeq.rnf __field__wrapped `Prelude.seq` ()
+
+instance Default.Default WrappedStringPair where
+  def = WrappedStringPair Default.def
+
+instance Hashable.Hashable WrappedStringPair where
+  hashWithSalt __salt (WrappedStringPair _wrapped)
+    = Hashable.hashWithSalt __salt _wrapped
+
+data ViaStringPair_key = ViaStringPair_key{viaStringPair_key_fst ::
+                                           Text.Text,
+                                           viaStringPair_key_snd :: Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ViaStringPair_key where
+  toJSON (ViaStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct ViaStringPair_key where
+  buildStruct _proxy (ViaStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure (ViaStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ViaStringPair_key where
+  rnf (ViaStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default ViaStringPair_key where
+  def = ViaStringPair_key "" ""
+
+instance Hashable.Hashable ViaStringPair_key where
+  hashWithSalt __salt (ViaStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data Unbound2_key = Unbound2_key{unbound2_key_x :: Text.Text,
+                                 unbound2_key_y :: Text.Text}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Unbound2_key where
+  toJSON (Unbound2_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x : "y" .= __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct Unbound2_key where
+  buildStruct _proxy (Unbound2_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__y <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (Unbound2_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Unbound2_key where
+  rnf (Unbound2_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default Unbound2_key where
+  def = Unbound2_key "" ""
+
+instance Hashable.Hashable Unbound2_key where
+  hashWithSalt __salt (Unbound2_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+data Unbound_key = Unbound_key{unbound_key_x :: Text.Text,
+                               unbound_key_y :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Unbound_key where
+  toJSON (Unbound_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x : "y" .= __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct Unbound_key where
+  buildStruct _proxy (Unbound_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__y <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (Unbound_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Unbound_key where
+  rnf (Unbound_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default Unbound_key where
+  def = Unbound_key "" ""
+
+instance Hashable.Hashable Unbound_key where
+  hashWithSalt __salt (Unbound_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+type TreeToTree_value = Tree
+
+data Tree_key = Tree_key{tree_key_node :: Node,
+                         tree_key_left :: Prelude.Maybe Tree,
+                         tree_key_right :: Prelude.Maybe Tree}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Tree_key where
+  toJSON (Tree_key __field__node __field__left __field__right)
+    = Aeson.object
+        ("node" .= __field__node :
+           Prelude.maybe Prelude.id ((:) . ("left" .=)) __field__left
+             (Prelude.maybe Prelude.id ((:) . ("right" .=)) __field__right
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct Tree_key where
+  buildStruct _proxy
+    (Tree_key __field__node __field__left __field__right)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "node" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__node)
+           :
+           let (__cereal__left, __id__left)
+                 = case __field__left of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "left"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__left
+               (case __field__right of
+                  Prelude.Just _val -> Thrift.genField _proxy "right"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__left
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__node <- ST.newSTRef Default.def
+            __field__left <- ST.newSTRef Prelude.Nothing
+            __field__right <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__node
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__left
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__right
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__node <- ST.readSTRef __field__node
+                                             !__val__left <- ST.readSTRef __field__left
+                                             !__val__right <- ST.readSTRef __field__right
+                                             Prelude.pure
+                                               (Tree_key __val__node __val__left __val__right)
+              _idMap = HashMap.fromList [("node", 1), ("left", 2), ("right", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Tree_key where
+  rnf (Tree_key __field__node __field__left __field__right)
+    = DeepSeq.rnf __field__node `Prelude.seq`
+        DeepSeq.rnf __field__left `Prelude.seq`
+          DeepSeq.rnf __field__right `Prelude.seq` ()
+
+instance Default.Default Tree_key where
+  def = Tree_key Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable Tree_key where
+  hashWithSalt __salt (Tree_key _node _left _right)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _node) _left)
+        _right
+
+data Sum = Sum_mon Glean.Byte
+         | Sum_tue Glean.Nat
+         | Sum_wed Prelude.Bool
+         | Sum_EMPTY
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Sum where
+  toJSON (Sum_mon __mon) = Aeson.object ["mon" .= Glean.unByte __mon]
+  toJSON (Sum_tue __tue) = Aeson.object ["tue" .= Glean.unNat __tue]
+  toJSON (Sum_wed __wed) = Aeson.object ["wed" .= __wed]
+  toJSON Sum_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Sum where
+  buildStruct _proxy (Sum_mon __mon)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "mon" (Thrift.getByteType _proxy) 1 0
+           ((Thrift.genByte _proxy . Glean.unByte) __mon)]
+  buildStruct _proxy (Sum_tue __tue)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tue" (Thrift.getI64Type _proxy) 2 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __tue)]
+  buildStruct _proxy (Sum_wed __wed)
+    = Thrift.genStruct _proxy
+        [Thrift.genFieldBool _proxy "wed" 3 0 __wed]
+  buildStruct _proxy Sum_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getByteType _proxy ->
+                                                         do _val <- Prelude.fmap Glean.Byte
+                                                                      (Thrift.parseByte _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Sum_mon _val)
+                                                     2 | _type == Thrift.getI64Type _proxy ->
+                                                         do _val <- Prelude.fmap Glean.Nat
+                                                                      (Thrift.parseI64 _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Sum_tue _val)
+                                                     3 | _type == Thrift.getBoolType _proxy ->
+                                                         do _val <- Thrift.parseBoolF _proxy _bool
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Sum_wed _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Sum_EMPTY
+           Thrift.FieldEnd -> Prelude.return Sum_EMPTY
+    where
+      _idMap = HashMap.fromList [("mon", 1), ("tue", 2), ("wed", 3)]
+
+instance DeepSeq.NFData Sum where
+  rnf (Sum_mon __mon) = DeepSeq.rnf __mon
+  rnf (Sum_tue __tue) = DeepSeq.rnf __tue
+  rnf (Sum_wed __wed) = DeepSeq.rnf __wed
+  rnf Sum_EMPTY = ()
+
+instance Default.Default Sum where
+  def = Sum_EMPTY
+
+instance Hashable.Hashable Sum where
+  hashWithSalt __salt (Sum_mon _mon)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _mon)
+  hashWithSalt __salt (Sum_tue _tue)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _tue)
+  hashWithSalt __salt (Sum_wed _wed)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _wed)
+  hashWithSalt __salt Sum_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+newtype StringPairBox_key = StringPairBox_key{stringPairBox_key_box
+                                              :: StringPair}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringPairBox_key where
+  toJSON (StringPairBox_key __field__box)
+    = Aeson.object ("box" .= __field__box : Prelude.mempty)
+
+instance Thrift.ThriftStruct StringPairBox_key where
+  buildStruct _proxy (StringPairBox_key __field__box)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "box" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__box)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__box <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__box
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__box <- ST.readSTRef __field__box
+                                             Prelude.pure (StringPairBox_key __val__box)
+              _idMap = HashMap.fromList [("box", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData StringPairBox_key where
+  rnf (StringPairBox_key __field__box)
+    = DeepSeq.rnf __field__box `Prelude.seq` ()
+
+instance Default.Default StringPairBox_key where
+  def = StringPairBox_key Default.def
+
+instance Hashable.Hashable StringPairBox_key where
+  hashWithSalt __salt (StringPairBox_key _box)
+    = Hashable.hashWithSalt __salt _box
+
+data StringPair_key = StringPair_key{stringPair_key_fst ::
+                                     Text.Text,
+                                     stringPair_key_snd :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringPair_key where
+  toJSON (StringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StringPair_key where
+  buildStruct _proxy (StringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure (StringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringPair_key where
+  rnf (StringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StringPair_key where
+  def = StringPair_key "" ""
+
+instance Hashable.Hashable StringPair_key where
+  hashWithSalt __salt (StringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data StoredRevStringPairWithRev_key = StoredRevStringPairWithRev_key{storedRevStringPairWithRev_key_fst
+                                                                     :: Text.Text,
+                                                                     storedRevStringPairWithRev_key_snd
+                                                                     :: Text.Text}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairWithRev_key where
+  toJSON (StoredRevStringPairWithRev_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairWithRev_key where
+  buildStruct _proxy
+    (StoredRevStringPairWithRev_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (StoredRevStringPairWithRev_key __val__fst
+                                                  __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairWithRev_key where
+  rnf (StoredRevStringPairWithRev_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairWithRev_key where
+  def = StoredRevStringPairWithRev_key "" ""
+
+instance Hashable.Hashable StoredRevStringPairWithRev_key where
+  hashWithSalt __salt (StoredRevStringPairWithRev_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data StoredRevStringPairWithA_key = StoredRevStringPairWithA_key{storedRevStringPairWithA_key_fst
+                                                                 :: Text.Text,
+                                                                 storedRevStringPairWithA_key_snd ::
+                                                                 Text.Text}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairWithA_key where
+  toJSON (StoredRevStringPairWithA_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairWithA_key where
+  buildStruct _proxy
+    (StoredRevStringPairWithA_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (StoredRevStringPairWithA_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairWithA_key where
+  rnf (StoredRevStringPairWithA_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairWithA_key where
+  def = StoredRevStringPairWithA_key "" ""
+
+instance Hashable.Hashable StoredRevStringPairWithA_key where
+  hashWithSalt __salt (StoredRevStringPairWithA_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data StoredRevStringPairSum_key = StoredRevStringPairSum_key{storedRevStringPairSum_key_fst
+                                                             :: Text.Text,
+                                                             storedRevStringPairSum_key_snd ::
+                                                             Text.Text}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPairSum_key where
+  toJSON (StoredRevStringPairSum_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPairSum_key where
+  buildStruct _proxy
+    (StoredRevStringPairSum_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (StoredRevStringPairSum_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPairSum_key where
+  rnf (StoredRevStringPairSum_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPairSum_key where
+  def = StoredRevStringPairSum_key "" ""
+
+instance Hashable.Hashable StoredRevStringPairSum_key where
+  hashWithSalt __salt (StoredRevStringPairSum_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data StoredRevStringPair_key = StoredRevStringPair_key{storedRevStringPair_key_fst
+                                                       :: Text.Text,
+                                                       storedRevStringPair_key_snd :: Text.Text}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredRevStringPair_key where
+  toJSON (StoredRevStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredRevStringPair_key where
+  buildStruct _proxy
+    (StoredRevStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (StoredRevStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredRevStringPair_key where
+  rnf (StoredRevStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StoredRevStringPair_key where
+  def = StoredRevStringPair_key "" ""
+
+instance Hashable.Hashable StoredRevStringPair_key where
+  hashWithSalt __salt (StoredRevStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data StoredDualStringPair_key = StoredDualStringPair_key{storedDualStringPair_key_fst
+                                                         :: StringPair,
+                                                         storedDualStringPair_key_snd :: StringPair}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StoredDualStringPair_key where
+  toJSON (StoredDualStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct StoredDualStringPair_key where
+  buildStruct _proxy
+    (StoredDualStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef Default.def
+            __field__snd <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (StoredDualStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StoredDualStringPair_key where
+  rnf (StoredDualStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default StoredDualStringPair_key where
+  def = StoredDualStringPair_key Default.def Default.def
+
+instance Hashable.Hashable StoredDualStringPair_key where
+  hashWithSalt __salt (StoredDualStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data SkipRevEdge_key = SkipRevEdge_key{skipRevEdge_key_child ::
+                                       Node,
+                                       skipRevEdge_key_grandparent :: Node}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SkipRevEdge_key where
+  toJSON (SkipRevEdge_key __field__child __field__grandparent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "grandparent" .= __field__grandparent : Prelude.mempty)
+
+instance Thrift.ThriftStruct SkipRevEdge_key where
+  buildStruct _proxy
+    (SkipRevEdge_key __field__child __field__grandparent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "grandparent" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__grandparent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__grandparent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__grandparent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__grandparent <- ST.readSTRef
+                                                                      __field__grandparent
+                                             Prelude.pure
+                                               (SkipRevEdge_key __val__child __val__grandparent)
+              _idMap = HashMap.fromList [("child", 1), ("grandparent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SkipRevEdge_key where
+  rnf (SkipRevEdge_key __field__child __field__grandparent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__grandparent `Prelude.seq` ()
+
+instance Default.Default SkipRevEdge_key where
+  def = SkipRevEdge_key Default.def Default.def
+
+instance Hashable.Hashable SkipRevEdge_key where
+  hashWithSalt __salt (SkipRevEdge_key _child _grandparent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _grandparent
+
+data SameString_key = SameString_key{sameString_key_x :: Text.Text,
+                                     sameString_key_y :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SameString_key where
+  toJSON (SameString_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x : "y" .= __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct SameString_key where
+  buildStruct _proxy (SameString_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__y <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (SameString_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SameString_key where
+  rnf (SameString_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default SameString_key where
+  def = SameString_key "" ""
+
+instance Hashable.Hashable SameString_key where
+  hashWithSalt __salt (SameString_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+data RevStringPairs_key = RevStringPairs_key{revStringPairs_key_x
+                                             :: Text.Text,
+                                             revStringPairs_key_r :: RevStringPair}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPairs_key where
+  toJSON (RevStringPairs_key __field__x __field__r)
+    = Aeson.object
+        ("x" .= __field__x : "r" .= __field__r : Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPairs_key where
+  buildStruct _proxy (RevStringPairs_key __field__x __field__r)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "r" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__r)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__r <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__r
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__r <- ST.readSTRef __field__r
+                                             Prelude.pure (RevStringPairs_key __val__x __val__r)
+              _idMap = HashMap.fromList [("x", 1), ("r", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPairs_key where
+  rnf (RevStringPairs_key __field__x __field__r)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__r `Prelude.seq` ()
+
+instance Default.Default RevStringPairs_key where
+  def = RevStringPairs_key "" Default.def
+
+instance Hashable.Hashable RevStringPairs_key where
+  hashWithSalt __salt (RevStringPairs_key _x _r)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _r
+
+data RevStringPairRec_key = RevStringPairRec_key{revStringPairRec_key_fst
+                                                 :: Text.Text,
+                                                 revStringPairRec_key_snd :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPairRec_key where
+  toJSON (RevStringPairRec_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPairRec_key where
+  buildStruct _proxy (RevStringPairRec_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (RevStringPairRec_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPairRec_key where
+  rnf (RevStringPairRec_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default RevStringPairRec_key where
+  def = RevStringPairRec_key "" ""
+
+instance Hashable.Hashable RevStringPairRec_key where
+  hashWithSalt __salt (RevStringPairRec_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data RevStringPair_key = RevStringPair_key{revStringPair_key_fst ::
+                                           Text.Text,
+                                           revStringPair_key_snd :: Text.Text}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevStringPair_key where
+  toJSON (RevStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct RevStringPair_key where
+  buildStruct _proxy (RevStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure (RevStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevStringPair_key where
+  rnf (RevStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default RevStringPair_key where
+  def = RevStringPair_key "" ""
+
+instance Hashable.Hashable RevStringPair_key where
+  hashWithSalt __salt (RevStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data RevRevStringPair_key = RevRevStringPair_key{revRevStringPair_key_fst
+                                                 :: Text.Text,
+                                                 revRevStringPair_key_snd :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevRevStringPair_key where
+  toJSON (RevRevStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct RevRevStringPair_key where
+  buildStruct _proxy (RevRevStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (RevRevStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevRevStringPair_key where
+  rnf (RevRevStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default RevRevStringPair_key where
+  def = RevRevStringPair_key "" ""
+
+instance Hashable.Hashable RevRevStringPair_key where
+  hashWithSalt __salt (RevRevStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data RevEdge_key = RevEdge_key{revEdge_key_child :: Node,
+                               revEdge_key_parent :: Node}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RevEdge_key where
+  toJSON (RevEdge_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct RevEdge_key where
+  buildStruct _proxy (RevEdge_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure (RevEdge_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RevEdge_key where
+  rnf (RevEdge_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default RevEdge_key where
+  def = RevEdge_key Default.def Default.def
+
+instance Hashable.Hashable RevEdge_key where
+  hashWithSalt __salt (RevEdge_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data NodePair_key = NodePair_key{nodePair_key_fst :: Node,
+                                 nodePair_key_snd :: Node}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NodePair_key where
+  toJSON (NodePair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct NodePair_key where
+  buildStruct _proxy (NodePair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef Default.def
+            __field__snd <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure (NodePair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NodePair_key where
+  rnf (NodePair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default NodePair_key where
+  def = NodePair_key Default.def Default.def
+
+instance Hashable.Hashable NodePair_key where
+  hashWithSalt __salt (NodePair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+newtype Node_key = Node_key{node_key_label :: Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Node_key where
+  toJSON (Node_key __field__label)
+    = Aeson.object ("label" .= __field__label : Prelude.mempty)
+
+instance Thrift.ThriftStruct Node_key where
+  buildStruct _proxy (Node_key __field__label)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "label" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__label)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__label <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__label
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__label <- ST.readSTRef __field__label
+                                             Prelude.pure (Node_key __val__label)
+              _idMap = HashMap.fromList [("label", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Node_key where
+  rnf (Node_key __field__label)
+    = DeepSeq.rnf __field__label `Prelude.seq` ()
+
+instance Default.Default Node_key where
+  def = Node_key ""
+
+instance Hashable.Hashable Node_key where
+  hashWithSalt __salt (Node_key _label)
+    = Hashable.hashWithSalt __salt _label
+
+data MatchOneAlt_key = MatchOneAlt_key{matchOneAlt_key_x :: Sum,
+                                       matchOneAlt_key_y :: Glean.Nat}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MatchOneAlt_key where
+  toJSON (MatchOneAlt_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x :
+           "y" .= Glean.unNat __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct MatchOneAlt_key where
+  buildStruct _proxy (MatchOneAlt_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef Default.def
+            __field__y <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (MatchOneAlt_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MatchOneAlt_key where
+  rnf (MatchOneAlt_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default MatchOneAlt_key where
+  def = MatchOneAlt_key Default.def (Glean.Nat Default.def)
+
+instance Hashable.Hashable MatchOneAlt_key where
+  hashWithSalt __salt (MatchOneAlt_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+data LeftOr2_key = LeftOr2_key{leftOr2_key_x :: Text.Text,
+                               leftOr2_key_y :: Glean.Nat}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LeftOr2_key where
+  toJSON (LeftOr2_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x :
+           "y" .= Glean.unNat __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct LeftOr2_key where
+  buildStruct _proxy (LeftOr2_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__y <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (LeftOr2_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LeftOr2_key where
+  rnf (LeftOr2_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default LeftOr2_key where
+  def = LeftOr2_key "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable LeftOr2_key where
+  hashWithSalt __salt (LeftOr2_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+data LeftOr_key = LeftOr_key{leftOr_key_x :: Text.Text,
+                             leftOr_key_y :: Glean.Nat}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LeftOr_key where
+  toJSON (LeftOr_key __field__x __field__y)
+    = Aeson.object
+        ("x" .= __field__x :
+           "y" .= Glean.unNat __field__y : Prelude.mempty)
+
+instance Thrift.ThriftStruct LeftOr_key where
+  buildStruct _proxy (LeftOr_key __field__x __field__y)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "x" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__x)
+           :
+           Thrift.genField _proxy "y" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__y)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__x <- ST.newSTRef ""
+            __field__y <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__x
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__y
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__x <- ST.readSTRef __field__x
+                                             !__val__y <- ST.readSTRef __field__y
+                                             Prelude.pure (LeftOr_key __val__x __val__y)
+              _idMap = HashMap.fromList [("x", 1), ("y", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LeftOr_key where
+  rnf (LeftOr_key __field__x __field__y)
+    = DeepSeq.rnf __field__x `Prelude.seq`
+        DeepSeq.rnf __field__y `Prelude.seq` ()
+
+instance Default.Default LeftOr_key where
+  def = LeftOr_key "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable LeftOr_key where
+  hashWithSalt __salt (LeftOr_key _x _y)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _x) _y
+
+data KeyValue_key = KeyValue_key{keyValue_key_kstring :: Text.Text,
+                                 keyValue_key_knat :: Glean.Nat}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KeyValue_key where
+  toJSON (KeyValue_key __field__kstring __field__knat)
+    = Aeson.object
+        ("kstring" .= __field__kstring :
+           "knat" .= Glean.unNat __field__knat : Prelude.mempty)
+
+instance Thrift.ThriftStruct KeyValue_key where
+  buildStruct _proxy (KeyValue_key __field__kstring __field__knat)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kstring" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__kstring)
+           :
+           Thrift.genField _proxy "knat" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__knat)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kstring <- ST.newSTRef ""
+            __field__knat <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__kstring
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__knat
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kstring <- ST.readSTRef
+                                                                  __field__kstring
+                                             !__val__knat <- ST.readSTRef __field__knat
+                                             Prelude.pure (KeyValue_key __val__kstring __val__knat)
+              _idMap = HashMap.fromList [("kstring", 1), ("knat", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KeyValue_key where
+  rnf (KeyValue_key __field__kstring __field__knat)
+    = DeepSeq.rnf __field__kstring `Prelude.seq`
+        DeepSeq.rnf __field__knat `Prelude.seq` ()
+
+instance Default.Default KeyValue_key where
+  def = KeyValue_key "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable KeyValue_key where
+  hashWithSalt __salt (KeyValue_key _kstring _knat)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kstring)
+        _knat
+
+data KeyValue_value = KeyValue_value{keyValue_value_vnat ::
+                                     Glean.Nat,
+                                     keyValue_value_vstring :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KeyValue_value where
+  toJSON (KeyValue_value __field__vnat __field__vstring)
+    = Aeson.object
+        ("vnat" .= Glean.unNat __field__vnat :
+           "vstring" .= __field__vstring : Prelude.mempty)
+
+instance Thrift.ThriftStruct KeyValue_value where
+  buildStruct _proxy (KeyValue_value __field__vnat __field__vstring)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "vnat" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__vnat)
+           :
+           Thrift.genField _proxy "vstring" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__vstring)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__vnat <- ST.newSTRef (Glean.Nat Default.def)
+            __field__vstring <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__vnat
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__vstring
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__vnat <- ST.readSTRef __field__vnat
+                                             !__val__vstring <- ST.readSTRef __field__vstring
+                                             Prelude.pure
+                                               (KeyValue_value __val__vnat __val__vstring)
+              _idMap = HashMap.fromList [("vnat", 1), ("vstring", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KeyValue_value where
+  rnf (KeyValue_value __field__vnat __field__vstring)
+    = DeepSeq.rnf __field__vnat `Prelude.seq`
+        DeepSeq.rnf __field__vstring `Prelude.seq` ()
+
+instance Default.Default KeyValue_value where
+  def = KeyValue_value (Glean.Nat Default.def) ""
+
+instance Hashable.Hashable KeyValue_value where
+  hashWithSalt __salt (KeyValue_value _vnat _vstring)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _vnat)
+        _vstring
+
+type FooToFoo_value = Foo
+
+type Foo_value = Bar
+
+data Expr_ap_ = Expr_ap_{expr_ap__fun :: Expr,
+                         expr_ap__arg :: Expr}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Expr_ap_ where
+  toJSON (Expr_ap_ __field__fun __field__arg)
+    = Aeson.object
+        ("fun" .= __field__fun : "arg" .= __field__arg : Prelude.mempty)
+
+instance Thrift.ThriftStruct Expr_ap_ where
+  buildStruct _proxy (Expr_ap_ __field__fun __field__arg)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fun" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fun)
+           :
+           Thrift.genField _proxy "arg" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__arg)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fun <- ST.newSTRef Default.def
+            __field__arg <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fun
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__arg
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fun <- ST.readSTRef __field__fun
+                                             !__val__arg <- ST.readSTRef __field__arg
+                                             Prelude.pure (Expr_ap_ __val__fun __val__arg)
+              _idMap = HashMap.fromList [("fun", 1), ("arg", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Expr_ap_ where
+  rnf (Expr_ap_ __field__fun __field__arg)
+    = DeepSeq.rnf __field__fun `Prelude.seq`
+        DeepSeq.rnf __field__arg `Prelude.seq` ()
+
+instance Default.Default Expr_ap_ where
+  def = Expr_ap_ Default.def Default.def
+
+instance Hashable.Hashable Expr_ap_ where
+  hashWithSalt __salt (Expr_ap_ _fun _arg)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fun) _arg
+
+data Expr_lam_ = Expr_lam_{expr_lam__var_ :: Name,
+                           expr_lam__body :: Expr}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Expr_lam_ where
+  toJSON (Expr_lam_ __field__var_ __field__body)
+    = Aeson.object
+        ("var_" .= __field__var_ :
+           "body" .= __field__body : Prelude.mempty)
+
+instance Thrift.ThriftStruct Expr_lam_ where
+  buildStruct _proxy (Expr_lam_ __field__var_ __field__body)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "var_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__var_)
+           :
+           Thrift.genField _proxy "body" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__body)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__var_ <- ST.newSTRef Default.def
+            __field__body <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__var_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__body
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__var_ <- ST.readSTRef __field__var_
+                                             !__val__body <- ST.readSTRef __field__body
+                                             Prelude.pure (Expr_lam_ __val__var_ __val__body)
+              _idMap = HashMap.fromList [("var_", 1), ("body", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Expr_lam_ where
+  rnf (Expr_lam_ __field__var_ __field__body)
+    = DeepSeq.rnf __field__var_ `Prelude.seq`
+        DeepSeq.rnf __field__body `Prelude.seq` ()
+
+instance Default.Default Expr_lam_ where
+  def = Expr_lam_ Default.def Default.def
+
+instance Hashable.Hashable Expr_lam_ where
+  hashWithSalt __salt (Expr_lam_ _var_ _body)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _var_) _body
+
+data Expr_key = Expr_key_var_ Name
+              | Expr_key_lit Glean.Nat
+              | Expr_key_prim Name
+              | Expr_key_ap Expr_ap_
+              | Expr_key_lam Expr_lam_
+              | Expr_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Expr_key where
+  toJSON (Expr_key_var_ __var_) = Aeson.object ["var_" .= __var_]
+  toJSON (Expr_key_lit __lit)
+    = Aeson.object ["lit" .= Glean.unNat __lit]
+  toJSON (Expr_key_prim __prim) = Aeson.object ["prim" .= __prim]
+  toJSON (Expr_key_ap __ap) = Aeson.object ["ap" .= __ap]
+  toJSON (Expr_key_lam __lam) = Aeson.object ["lam" .= __lam]
+  toJSON Expr_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Expr_key where
+  buildStruct _proxy (Expr_key_var_ __var_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "var_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __var_)]
+  buildStruct _proxy (Expr_key_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getI64Type _proxy) 2 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __lit)]
+  buildStruct _proxy (Expr_key_prim __prim)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "prim" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __prim)]
+  buildStruct _proxy (Expr_key_ap __ap)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ap" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __ap)]
+  buildStruct _proxy (Expr_key_lam __lam)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lam" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __lam)]
+  buildStruct _proxy Expr_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Expr_key_var_ _val)
+                                                     2 | _type == Thrift.getI64Type _proxy ->
+                                                         do _val <- Prelude.fmap Glean.Nat
+                                                                      (Thrift.parseI64 _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Expr_key_lit _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Expr_key_prim _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Expr_key_ap _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Expr_key_lam _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Expr_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Expr_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("var_", 1), ("lit", 2), ("prim", 3), ("ap", 4), ("lam", 5)]
+
+instance DeepSeq.NFData Expr_key where
+  rnf (Expr_key_var_ __var_) = DeepSeq.rnf __var_
+  rnf (Expr_key_lit __lit) = DeepSeq.rnf __lit
+  rnf (Expr_key_prim __prim) = DeepSeq.rnf __prim
+  rnf (Expr_key_ap __ap) = DeepSeq.rnf __ap
+  rnf (Expr_key_lam __lam) = DeepSeq.rnf __lam
+  rnf Expr_key_EMPTY = ()
+
+instance Default.Default Expr_key where
+  def = Expr_key_EMPTY
+
+instance Hashable.Hashable Expr_key where
+  hashWithSalt __salt (Expr_key_var_ _var_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _var_)
+  hashWithSalt __salt (Expr_key_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _lit)
+  hashWithSalt __salt (Expr_key_prim _prim)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _prim)
+  hashWithSalt __salt (Expr_key_ap _ap)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _ap)
+  hashWithSalt __salt (Expr_key_lam _lam)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _lam)
+  hashWithSalt __salt Expr_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Enum_ = Enum__red
+           | Enum__green
+           | Enum__blue
+           | Enum___UNKNOWN Prelude.Int
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enum_ where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Enum_ where
+  rnf __Enum_ = Prelude.seq __Enum_ ()
+
+instance Default.Default Enum_ where
+  def = Enum__red
+
+instance Hashable.Hashable Enum_ where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Enum_ where
+  toThriftEnum 0 = Enum__red
+  toThriftEnum 1 = Enum__green
+  toThriftEnum 2 = Enum__blue
+  toThriftEnum val = Enum___UNKNOWN val
+  fromThriftEnum Enum__red = 0
+  fromThriftEnum Enum__green = 1
+  fromThriftEnum Enum__blue = 2
+  fromThriftEnum (Enum___UNKNOWN val) = val
+  allThriftEnumValues = [Enum__red, Enum__green, Enum__blue]
+  toThriftEnumEither 0 = Prelude.Right Enum__red
+  toThriftEnumEither 1 = Prelude.Right Enum__green
+  toThriftEnumEither 2 = Prelude.Right Enum__blue
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Enum_: " ++
+           Prelude.show val)
+
+data Rec = Rec{rec_alpha :: Enum_, rec_beta :: Sum}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Rec where
+  toJSON (Rec __field__alpha __field__beta)
+    = Aeson.object
+        ("alpha" .= __field__alpha :
+           "beta" .= __field__beta : Prelude.mempty)
+
+instance Thrift.ThriftStruct Rec where
+  buildStruct _proxy (Rec __field__alpha __field__beta)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "alpha" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__alpha)
+           :
+           Thrift.genField _proxy "beta" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__beta)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__alpha <- ST.newSTRef Default.def
+            __field__beta <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Enum_")
+                                                                        ST.writeSTRef __field__alpha
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__beta
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__alpha <- ST.readSTRef __field__alpha
+                                             !__val__beta <- ST.readSTRef __field__beta
+                                             Prelude.pure (Rec __val__alpha __val__beta)
+              _idMap = HashMap.fromList [("alpha", 1), ("beta", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Rec where
+  rnf (Rec __field__alpha __field__beta)
+    = DeepSeq.rnf __field__alpha `Prelude.seq`
+        DeepSeq.rnf __field__beta `Prelude.seq` ()
+
+instance Default.Default Rec where
+  def = Rec Default.def Default.def
+
+instance Hashable.Hashable Rec where
+  hashWithSalt __salt (Rec _alpha _beta)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _alpha) _beta
+
+data Entity = Entity_cxx Glean.Schema.CodeCxx.Entity
+            | Entity_pp Glean.Schema.Pp1.Define
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_cxx __cxx) = Aeson.object ["cxx" .= __cxx]
+  toJSON (Entity_pp __pp) = Aeson.object ["pp" .= __pp]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_cxx __cxx)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cxx" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __cxx)]
+  buildStruct _proxy (Entity_pp __pp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "pp" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __pp)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_cxx _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_pp _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap = HashMap.fromList [("cxx", 1), ("pp", 2)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_cxx __cxx) = DeepSeq.rnf __cxx
+  rnf (Entity_pp __pp) = DeepSeq.rnf __pp
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_cxx _cxx)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _cxx)
+  hashWithSalt __salt (Entity_pp _pp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _pp)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EmptyStoredStringPair_key = EmptyStoredStringPair_key{emptyStoredStringPair_key_fst
+                                                           :: Text.Text,
+                                                           emptyStoredStringPair_key_snd ::
+                                                           Text.Text}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EmptyStoredStringPair_key where
+  toJSON (EmptyStoredStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct EmptyStoredStringPair_key where
+  buildStruct _proxy
+    (EmptyStoredStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef ""
+            __field__snd <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure
+                                               (EmptyStoredStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EmptyStoredStringPair_key where
+  rnf (EmptyStoredStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default EmptyStoredStringPair_key where
+  def = EmptyStoredStringPair_key "" ""
+
+instance Hashable.Hashable EmptyStoredStringPair_key where
+  hashWithSalt __salt (EmptyStoredStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+newtype EdgeWrapper_key = EdgeWrapper_key{edgeWrapper_key_edge ::
+                                          Edge}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EdgeWrapper_key where
+  toJSON (EdgeWrapper_key __field__edge)
+    = Aeson.object ("edge" .= __field__edge : Prelude.mempty)
+
+instance Thrift.ThriftStruct EdgeWrapper_key where
+  buildStruct _proxy (EdgeWrapper_key __field__edge)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "edge" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__edge)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__edge <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__edge
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__edge <- ST.readSTRef __field__edge
+                                             Prelude.pure (EdgeWrapper_key __val__edge)
+              _idMap = HashMap.fromList [("edge", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData EdgeWrapper_key where
+  rnf (EdgeWrapper_key __field__edge)
+    = DeepSeq.rnf __field__edge `Prelude.seq` ()
+
+instance Default.Default EdgeWrapper_key where
+  def = EdgeWrapper_key Default.def
+
+instance Hashable.Hashable EdgeWrapper_key where
+  hashWithSalt __salt (EdgeWrapper_key _edge)
+    = Hashable.hashWithSalt __salt _edge
+
+data EdgeSum = EdgeSum_fst EdgeWrapper
+             | EdgeSum_snd EdgeWrapper
+             | EdgeSum_EMPTY
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EdgeSum where
+  toJSON (EdgeSum_fst __fst) = Aeson.object ["fst" .= __fst]
+  toJSON (EdgeSum_snd __snd) = Aeson.object ["snd" .= __snd]
+  toJSON EdgeSum_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct EdgeSum where
+  buildStruct _proxy (EdgeSum_fst __fst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __fst)]
+  buildStruct _proxy (EdgeSum_snd __snd)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "snd" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __snd)]
+  buildStruct _proxy EdgeSum_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (EdgeSum_fst _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (EdgeSum_snd _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return EdgeSum_EMPTY
+           Thrift.FieldEnd -> Prelude.return EdgeSum_EMPTY
+    where
+      _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+
+instance DeepSeq.NFData EdgeSum where
+  rnf (EdgeSum_fst __fst) = DeepSeq.rnf __fst
+  rnf (EdgeSum_snd __snd) = DeepSeq.rnf __snd
+  rnf EdgeSum_EMPTY = ()
+
+instance Default.Default EdgeSum where
+  def = EdgeSum_EMPTY
+
+instance Hashable.Hashable EdgeSum where
+  hashWithSalt __salt (EdgeSum_fst _fst)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _fst)
+  hashWithSalt __salt (EdgeSum_snd _snd)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _snd)
+  hashWithSalt __salt EdgeSum_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Edge_key = Edge_key{edge_key_parent :: Node,
+                         edge_key_child :: Node}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Edge_key where
+  toJSON (Edge_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct Edge_key where
+  buildStruct _proxy (Edge_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure (Edge_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Edge_key where
+  rnf (Edge_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default Edge_key where
+  def = Edge_key Default.def Default.def
+
+instance Hashable.Hashable Edge_key where
+  hashWithSalt __salt (Edge_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data DualStringPair_key = DualStringPair_key{dualStringPair_key_fst
+                                             :: StringPair,
+                                             dualStringPair_key_snd :: StringPair}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DualStringPair_key where
+  toJSON (DualStringPair_key __field__fst __field__snd)
+    = Aeson.object
+        ("fst" .= __field__fst : "snd" .= __field__snd : Prelude.mempty)
+
+instance Thrift.ThriftStruct DualStringPair_key where
+  buildStruct _proxy (DualStringPair_key __field__fst __field__snd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fst)
+           :
+           Thrift.genField _proxy "snd" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__snd)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fst <- ST.newSTRef Default.def
+            __field__snd <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fst
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__snd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fst <- ST.readSTRef __field__fst
+                                             !__val__snd <- ST.readSTRef __field__snd
+                                             Prelude.pure (DualStringPair_key __val__fst __val__snd)
+              _idMap = HashMap.fromList [("fst", 1), ("snd", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DualStringPair_key where
+  rnf (DualStringPair_key __field__fst __field__snd)
+    = DeepSeq.rnf __field__fst `Prelude.seq`
+        DeepSeq.rnf __field__snd `Prelude.seq` ()
+
+instance Default.Default DualStringPair_key where
+  def = DualStringPair_key Default.def Default.def
+
+instance Hashable.Hashable DualStringPair_key where
+  hashWithSalt __salt (DualStringPair_key _fst _snd)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fst) _snd
+
+data DerivedKeyValue2_key = DerivedKeyValue2_key{derivedKeyValue2_key_kstring
+                                                 :: Text.Text,
+                                                 derivedKeyValue2_key_knat :: Glean.Nat}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedKeyValue2_key where
+  toJSON (DerivedKeyValue2_key __field__kstring __field__knat)
+    = Aeson.object
+        ("kstring" .= __field__kstring :
+           "knat" .= Glean.unNat __field__knat : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedKeyValue2_key where
+  buildStruct _proxy
+    (DerivedKeyValue2_key __field__kstring __field__knat)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kstring" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__kstring)
+           :
+           Thrift.genField _proxy "knat" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__knat)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kstring <- ST.newSTRef ""
+            __field__knat <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__kstring
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__knat
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kstring <- ST.readSTRef
+                                                                  __field__kstring
+                                             !__val__knat <- ST.readSTRef __field__knat
+                                             Prelude.pure
+                                               (DerivedKeyValue2_key __val__kstring __val__knat)
+              _idMap = HashMap.fromList [("kstring", 1), ("knat", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedKeyValue2_key where
+  rnf (DerivedKeyValue2_key __field__kstring __field__knat)
+    = DeepSeq.rnf __field__kstring `Prelude.seq`
+        DeepSeq.rnf __field__knat `Prelude.seq` ()
+
+instance Default.Default DerivedKeyValue2_key where
+  def = DerivedKeyValue2_key "" (Glean.Nat Default.def)
+
+instance Hashable.Hashable DerivedKeyValue2_key where
+  hashWithSalt __salt (DerivedKeyValue2_key _kstring _knat)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kstring)
+        _knat
+
+data DerivedKeyValue2_value = DerivedKeyValue2_value{derivedKeyValue2_value_vnat
+                                                     :: Glean.Nat,
+                                                     derivedKeyValue2_value_vstring :: Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedKeyValue2_value where
+  toJSON (DerivedKeyValue2_value __field__vnat __field__vstring)
+    = Aeson.object
+        ("vnat" .= Glean.unNat __field__vnat :
+           "vstring" .= __field__vstring : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedKeyValue2_value where
+  buildStruct _proxy
+    (DerivedKeyValue2_value __field__vnat __field__vstring)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "vnat" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__vnat)
+           :
+           Thrift.genField _proxy "vstring" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__vstring)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__vnat <- ST.newSTRef (Glean.Nat Default.def)
+            __field__vstring <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__vnat
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__vstring
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__vnat <- ST.readSTRef __field__vnat
+                                             !__val__vstring <- ST.readSTRef __field__vstring
+                                             Prelude.pure
+                                               (DerivedKeyValue2_value __val__vnat __val__vstring)
+              _idMap = HashMap.fromList [("vnat", 1), ("vstring", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedKeyValue2_value where
+  rnf (DerivedKeyValue2_value __field__vnat __field__vstring)
+    = DeepSeq.rnf __field__vnat `Prelude.seq`
+        DeepSeq.rnf __field__vstring `Prelude.seq` ()
+
+instance Default.Default DerivedKeyValue2_value where
+  def = DerivedKeyValue2_value (Glean.Nat Default.def) ""
+
+instance Hashable.Hashable DerivedKeyValue2_value where
+  hashWithSalt __salt (DerivedKeyValue2_value _vnat _vstring)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _vnat)
+        _vstring
+
+data DerivedKeyValue_key = DerivedKeyValue_key{derivedKeyValue_key_kstring
+                                               :: Text.Text,
+                                               derivedKeyValue_key_knat :: Glean.Nat,
+                                               derivedKeyValue_key_vnat :: Glean.Nat,
+                                               derivedKeyValue_key_vstring :: Text.Text}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedKeyValue_key where
+  toJSON
+    (DerivedKeyValue_key __field__kstring __field__knat __field__vnat
+       __field__vstring)
+    = Aeson.object
+        ("kstring" .= __field__kstring :
+           "knat" .= Glean.unNat __field__knat :
+             "vnat" .= Glean.unNat __field__vnat :
+               "vstring" .= __field__vstring : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedKeyValue_key where
+  buildStruct _proxy
+    (DerivedKeyValue_key __field__kstring __field__knat __field__vnat
+       __field__vstring)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kstring" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__kstring)
+           :
+           Thrift.genField _proxy "knat" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__knat)
+             :
+             Thrift.genField _proxy "vnat" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__vnat)
+               :
+               Thrift.genField _proxy "vstring" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__vstring)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kstring <- ST.newSTRef ""
+            __field__knat <- ST.newSTRef (Glean.Nat Default.def)
+            __field__vnat <- ST.newSTRef (Glean.Nat Default.def)
+            __field__vstring <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__kstring
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__knat
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__vnat
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__vstring
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kstring <- ST.readSTRef
+                                                                  __field__kstring
+                                             !__val__knat <- ST.readSTRef __field__knat
+                                             !__val__vnat <- ST.readSTRef __field__vnat
+                                             !__val__vstring <- ST.readSTRef __field__vstring
+                                             Prelude.pure
+                                               (DerivedKeyValue_key __val__kstring __val__knat
+                                                  __val__vnat
+                                                  __val__vstring)
+              _idMap
+                = HashMap.fromList
+                    [("kstring", 1), ("knat", 2), ("vnat", 3), ("vstring", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedKeyValue_key where
+  rnf
+    (DerivedKeyValue_key __field__kstring __field__knat __field__vnat
+       __field__vstring)
+    = DeepSeq.rnf __field__kstring `Prelude.seq`
+        DeepSeq.rnf __field__knat `Prelude.seq`
+          DeepSeq.rnf __field__vnat `Prelude.seq`
+            DeepSeq.rnf __field__vstring `Prelude.seq` ()
+
+instance Default.Default DerivedKeyValue_key where
+  def
+    = DerivedKeyValue_key "" (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+        ""
+
+instance Hashable.Hashable DerivedKeyValue_key where
+  hashWithSalt __salt
+    (DerivedKeyValue_key _kstring _knat _vnat _vstring)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kstring)
+              _knat)
+           _vnat)
+        _vstring
+
+type Bar_value = Qux
+
+type ArrayString = [Text.Text]
+
+type ArrayNat = [Glean.Nat]
+
+type ArrayByte = ByteString.ByteString
+
+type ArrayBool = [Prelude.Bool]
+
+data KitchenSink_record_ = KitchenSink_record_{kitchenSink_record__a
+                                               :: Glean.Byte,
+                                               kitchenSink_record__b :: Glean.Nat}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KitchenSink_record_ where
+  toJSON (KitchenSink_record_ __field__a __field__b)
+    = Aeson.object
+        ("a" .= Glean.unByte __field__a :
+           "b" .= Glean.unNat __field__b : Prelude.mempty)
+
+instance Thrift.ThriftStruct KitchenSink_record_ where
+  buildStruct _proxy (KitchenSink_record_ __field__a __field__b)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "a" (Thrift.getByteType _proxy) 1 0
+           ((Thrift.genByte _proxy . Glean.unByte) __field__a)
+           :
+           Thrift.genField _proxy "b" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__b)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__a <- ST.newSTRef (Glean.Byte Default.def)
+            __field__b <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getByteType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Byte
+                                                                                      (Thrift.parseByte
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__a
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__b
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__a <- ST.readSTRef __field__a
+                                             !__val__b <- ST.readSTRef __field__b
+                                             Prelude.pure (KitchenSink_record_ __val__a __val__b)
+              _idMap = HashMap.fromList [("a", 1), ("b", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KitchenSink_record_ where
+  rnf (KitchenSink_record_ __field__a __field__b)
+    = DeepSeq.rnf __field__a `Prelude.seq`
+        DeepSeq.rnf __field__b `Prelude.seq` ()
+
+instance Default.Default KitchenSink_record_ where
+  def
+    = KitchenSink_record_ (Glean.Byte Default.def)
+        (Glean.Nat Default.def)
+
+instance Hashable.Hashable KitchenSink_record_ where
+  hashWithSalt __salt (KitchenSink_record_ _a _b)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _a) _b
+
+data KitchenSink_sum_ = KitchenSink_sum__c Predicate
+                      | KitchenSink_sum__d Glean.Schema.Sys.Blob
+                      | KitchenSink_sum__EMPTY
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KitchenSink_sum_ where
+  toJSON (KitchenSink_sum__c __c) = Aeson.object ["c" .= __c]
+  toJSON (KitchenSink_sum__d __d) = Aeson.object ["d" .= __d]
+  toJSON KitchenSink_sum__EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct KitchenSink_sum_ where
+  buildStruct _proxy (KitchenSink_sum__c __c)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "c" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __c)]
+  buildStruct _proxy (KitchenSink_sum__d __d)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "d" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __d)]
+  buildStruct _proxy KitchenSink_sum__EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (KitchenSink_sum__c _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (KitchenSink_sum__d _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return KitchenSink_sum__EMPTY
+           Thrift.FieldEnd -> Prelude.return KitchenSink_sum__EMPTY
+    where
+      _idMap = HashMap.fromList [("c", 1), ("d", 2)]
+
+instance DeepSeq.NFData KitchenSink_sum_ where
+  rnf (KitchenSink_sum__c __c) = DeepSeq.rnf __c
+  rnf (KitchenSink_sum__d __d) = DeepSeq.rnf __d
+  rnf KitchenSink_sum__EMPTY = ()
+
+instance Default.Default KitchenSink_sum_ where
+  def = KitchenSink_sum__EMPTY
+
+instance Hashable.Hashable KitchenSink_sum_ where
+  hashWithSalt __salt (KitchenSink_sum__c _c)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _c)
+  hashWithSalt __salt (KitchenSink_sum__d _d)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _d)
+  hashWithSalt __salt KitchenSink_sum__EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data KitchenSink_enum_ = KitchenSink_enum__e
+                       | KitchenSink_enum__f
+                       | KitchenSink_enum__g
+                       | KitchenSink_enum___UNKNOWN Prelude.Int
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KitchenSink_enum_ where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData KitchenSink_enum_ where
+  rnf __KitchenSink_enum_ = Prelude.seq __KitchenSink_enum_ ()
+
+instance Default.Default KitchenSink_enum_ where
+  def = KitchenSink_enum__e
+
+instance Hashable.Hashable KitchenSink_enum_ where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum KitchenSink_enum_ where
+  toThriftEnum 0 = KitchenSink_enum__e
+  toThriftEnum 1 = KitchenSink_enum__f
+  toThriftEnum 2 = KitchenSink_enum__g
+  toThriftEnum val = KitchenSink_enum___UNKNOWN val
+  fromThriftEnum KitchenSink_enum__e = 0
+  fromThriftEnum KitchenSink_enum__f = 1
+  fromThriftEnum KitchenSink_enum__g = 2
+  fromThriftEnum (KitchenSink_enum___UNKNOWN val) = val
+  allThriftEnumValues
+    = [KitchenSink_enum__e, KitchenSink_enum__f, KitchenSink_enum__g]
+  toThriftEnumEither 0 = Prelude.Right KitchenSink_enum__e
+  toThriftEnumEither 1 = Prelude.Right KitchenSink_enum__f
+  toThriftEnumEither 2 = Prelude.Right KitchenSink_enum__g
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum KitchenSink_enum_: "
+           ++ Prelude.show val)
+
+data KitchenSink = KitchenSink{kitchenSink_byt :: Glean.Byte,
+                               kitchenSink_nat :: Glean.Nat, kitchenSink_bool_ :: Prelude.Bool,
+                               kitchenSink_string_ :: Text.Text,
+                               kitchenSink_pred :: Glean.Schema.Sys.Blob,
+                               kitchenSink_maybe_ :: Prelude.Maybe Glean.Schema.Builtin.Unit,
+                               kitchenSink_record_ :: KitchenSink_record_,
+                               kitchenSink_sum_ :: KitchenSink_sum_,
+                               kitchenSink_enum_ :: KitchenSink_enum_,
+                               kitchenSink_named_record_ :: Rec, kitchenSink_named_sum_ :: Sum,
+                               kitchenSink_named_enum_ :: Enum_,
+                               kitchenSink_array_of_byte :: ByteString.ByteString,
+                               kitchenSink_array_of_nat :: [Glean.Nat],
+                               kitchenSink_array_of_bool :: [Prelude.Bool],
+                               kitchenSink_array_of_string :: [Text.Text],
+                               kitchenSink_array_of_pred :: [Predicate],
+                               kitchenSink_array_of_named_record :: [Rec],
+                               kitchenSink_array_of_named_sum :: [Sum],
+                               kitchenSink_array_of_named_enum :: [Enum_],
+                               kitchenSink_array2_of_byte :: [ArrayByte],
+                               kitchenSink_array2_of_nat :: [ArrayNat],
+                               kitchenSink_array2_of_bool :: [ArrayBool],
+                               kitchenSink_array2_of_string :: [ArrayString],
+                               kitchenSink_set_of_nat :: [Glean.Nat],
+                               kitchenSink_set_of_string :: [Text.Text],
+                               kitchenSink_set_of_pred :: [Predicate]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KitchenSink where
+  toJSON
+    (KitchenSink __field__byt __field__nat __field__bool_
+       __field__string_ __field__pred __field__maybe_ __field__record_
+       __field__sum_ __field__enum_ __field__named_record_
+       __field__named_sum_ __field__named_enum_ __field__array_of_byte
+       __field__array_of_nat __field__array_of_bool
+       __field__array_of_string __field__array_of_pred
+       __field__array_of_named_record __field__array_of_named_sum
+       __field__array_of_named_enum __field__array2_of_byte
+       __field__array2_of_nat __field__array2_of_bool
+       __field__array2_of_string __field__set_of_nat
+       __field__set_of_string __field__set_of_pred)
+    = Aeson.object
+        ("byt" .= Glean.unByte __field__byt :
+           "nat" .= Glean.unNat __field__nat :
+             "bool_" .= __field__bool_ :
+               "string_" .= __field__string_ :
+                 "pred" .= __field__pred :
+                   Prelude.maybe Prelude.id ((:) . ("maybe_" .=)) __field__maybe_
+                     ("record_" .= __field__record_ :
+                        "sum_" .= __field__sum_ :
+                          "enum_" .= __field__enum_ :
+                            "named_record_" .= __field__named_record_ :
+                              "named_sum_" .= __field__named_sum_ :
+                                "named_enum_" .= __field__named_enum_ :
+                                  "array_of_byte" .= Thrift.encodeBase64Text __field__array_of_byte
+                                    :
+                                    "array_of_nat" .= Prelude.map Glean.unNat __field__array_of_nat
+                                      :
+                                      "array_of_bool" .= __field__array_of_bool :
+                                        "array_of_string" .= __field__array_of_string :
+                                          "array_of_pred" .= __field__array_of_pred :
+                                            "array_of_named_record" .=
+                                              __field__array_of_named_record
+                                              :
+                                              "array_of_named_sum" .= __field__array_of_named_sum :
+                                                "array_of_named_enum" .=
+                                                  __field__array_of_named_enum
+                                                  :
+                                                  "array2_of_byte" .=
+                                                    Prelude.map Thrift.encodeBase64Text
+                                                      __field__array2_of_byte
+                                                    :
+                                                    "array2_of_nat" .=
+                                                      Prelude.map (Prelude.map Glean.unNat)
+                                                        __field__array2_of_nat
+                                                      :
+                                                      "array2_of_bool" .= __field__array2_of_bool :
+                                                        "array2_of_string" .=
+                                                          __field__array2_of_string
+                                                          :
+                                                          "set_of_nat" .=
+                                                            Prelude.map Glean.unNat
+                                                              __field__set_of_nat
+                                                            :
+                                                            "set_of_string" .=
+                                                              __field__set_of_string
+                                                              :
+                                                              "set_of_pred" .= __field__set_of_pred
+                                                                : Prelude.mempty))
+
+instance Thrift.ThriftStruct KitchenSink where
+  buildStruct _proxy
+    (KitchenSink __field__byt __field__nat __field__bool_
+       __field__string_ __field__pred __field__maybe_ __field__record_
+       __field__sum_ __field__enum_ __field__named_record_
+       __field__named_sum_ __field__named_enum_ __field__array_of_byte
+       __field__array_of_nat __field__array_of_bool
+       __field__array_of_string __field__array_of_pred
+       __field__array_of_named_record __field__array_of_named_sum
+       __field__array_of_named_enum __field__array2_of_byte
+       __field__array2_of_nat __field__array2_of_bool
+       __field__array2_of_string __field__set_of_nat
+       __field__set_of_string __field__set_of_pred)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "byt" (Thrift.getByteType _proxy) 1 0
+           ((Thrift.genByte _proxy . Glean.unByte) __field__byt)
+           :
+           Thrift.genField _proxy "nat" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__nat)
+             :
+             Thrift.genFieldBool _proxy "bool_" 3 2 __field__bool_ :
+               Thrift.genField _proxy "string_" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__string_)
+                 :
+                 Thrift.genField _proxy "pred" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__pred)
+                   :
+                   let (__cereal__maybe_, __id__maybe_)
+                         = case __field__maybe_ of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genField _proxy "maybe_"
+                                                        (Thrift.getStructType _proxy)
+                                                        6
+                                                        5
+                                                        (Thrift.buildStruct _proxy _val)),
+                                                   6)
+                             Prelude.Nothing -> (Prelude.id, 5)
+                     in
+                     __cereal__maybe_
+                       (Thrift.genField _proxy "record_" (Thrift.getStructType _proxy) 7
+                          __id__maybe_
+                          (Thrift.buildStruct _proxy __field__record_)
+                          :
+                          Thrift.genField _proxy "sum_" (Thrift.getStructType _proxy) 8 7
+                            (Thrift.buildStruct _proxy __field__sum_)
+                            :
+                            Thrift.genField _proxy "enum_" (Thrift.getI32Type _proxy) 9 8
+                              ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                  Thrift.fromThriftEnum)
+                                 __field__enum_)
+                              :
+                              Thrift.genField _proxy "named_record_"
+                                (Thrift.getStructType _proxy)
+                                10
+                                9
+                                (Thrift.buildStruct _proxy __field__named_record_)
+                                :
+                                Thrift.genField _proxy "named_sum_" (Thrift.getStructType _proxy)
+                                  11
+                                  10
+                                  (Thrift.buildStruct _proxy __field__named_sum_)
+                                  :
+                                  Thrift.genField _proxy "named_enum_" (Thrift.getI32Type _proxy) 12
+                                    11
+                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                        Thrift.fromThriftEnum)
+                                       __field__named_enum_)
+                                    :
+                                    Thrift.genField _proxy "array_of_byte"
+                                      (Thrift.getStringType _proxy)
+                                      13
+                                      12
+                                      (Thrift.genBytes _proxy __field__array_of_byte)
+                                      :
+                                      Thrift.genField _proxy "array_of_nat"
+                                        (Thrift.getListType _proxy)
+                                        14
+                                        13
+                                        (Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                                           (Thrift.genI64 _proxy . Glean.unNat)
+                                           __field__array_of_nat)
+                                        :
+                                        Thrift.genField _proxy "array_of_bool"
+                                          (Thrift.getListType _proxy)
+                                          15
+                                          14
+                                          (Thrift.genListPrim _proxy (Thrift.getBoolType _proxy)
+                                             (Thrift.genBoolPrim _proxy)
+                                             __field__array_of_bool)
+                                          :
+                                          Thrift.genField _proxy "array_of_string"
+                                            (Thrift.getListType _proxy)
+                                            16
+                                            15
+                                            (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                                               (Thrift.genText _proxy)
+                                               __field__array_of_string)
+                                            :
+                                            Thrift.genField _proxy "array_of_pred"
+                                              (Thrift.getListType _proxy)
+                                              17
+                                              16
+                                              (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                                 (Thrift.buildStruct _proxy)
+                                                 __field__array_of_pred)
+                                              :
+                                              Thrift.genField _proxy "array_of_named_record"
+                                                (Thrift.getListType _proxy)
+                                                18
+                                                17
+                                                (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                                   (Thrift.buildStruct _proxy)
+                                                   __field__array_of_named_record)
+                                                :
+                                                Thrift.genField _proxy "array_of_named_sum"
+                                                  (Thrift.getListType _proxy)
+                                                  19
+                                                  18
+                                                  (Thrift.genList _proxy
+                                                     (Thrift.getStructType _proxy)
+                                                     (Thrift.buildStruct _proxy)
+                                                     __field__array_of_named_sum)
+                                                  :
+                                                  Thrift.genField _proxy "array_of_named_enum"
+                                                    (Thrift.getListType _proxy)
+                                                    20
+                                                    19
+                                                    (Thrift.genList _proxy
+                                                       (Thrift.getI32Type _proxy)
+                                                       (Thrift.genI32 _proxy . Prelude.fromIntegral
+                                                          . Thrift.fromThriftEnum)
+                                                       __field__array_of_named_enum)
+                                                    :
+                                                    Thrift.genField _proxy "array2_of_byte"
+                                                      (Thrift.getListType _proxy)
+                                                      21
+                                                      20
+                                                      (Thrift.genList _proxy
+                                                         (Thrift.getStringType _proxy)
+                                                         (Thrift.genBytes _proxy)
+                                                         __field__array2_of_byte)
+                                                      :
+                                                      Thrift.genField _proxy "array2_of_nat"
+                                                        (Thrift.getListType _proxy)
+                                                        22
+                                                        21
+                                                        (Thrift.genList _proxy
+                                                           (Thrift.getListType _proxy)
+                                                           (Thrift.genList _proxy
+                                                              (Thrift.getI64Type _proxy)
+                                                              (Thrift.genI64 _proxy . Glean.unNat))
+                                                           __field__array2_of_nat)
+                                                        :
+                                                        Thrift.genField _proxy "array2_of_bool"
+                                                          (Thrift.getListType _proxy)
+                                                          23
+                                                          22
+                                                          (Thrift.genList _proxy
+                                                             (Thrift.getListType _proxy)
+                                                             (Thrift.genListPrim _proxy
+                                                                (Thrift.getBoolType _proxy)
+                                                                (Thrift.genBoolPrim _proxy))
+                                                             __field__array2_of_bool)
+                                                          :
+                                                          Thrift.genField _proxy "array2_of_string"
+                                                            (Thrift.getListType _proxy)
+                                                            24
+                                                            23
+                                                            (Thrift.genList _proxy
+                                                               (Thrift.getListType _proxy)
+                                                               (Thrift.genList _proxy
+                                                                  (Thrift.getStringType _proxy)
+                                                                  (Thrift.genText _proxy))
+                                                               __field__array2_of_string)
+                                                            :
+                                                            Thrift.genField _proxy "set_of_nat"
+                                                              (Thrift.getListType _proxy)
+                                                              25
+                                                              24
+                                                              (Thrift.genList _proxy
+                                                                 (Thrift.getI64Type _proxy)
+                                                                 (Thrift.genI64 _proxy .
+                                                                    Glean.unNat)
+                                                                 __field__set_of_nat)
+                                                              :
+                                                              Thrift.genField _proxy "set_of_string"
+                                                                (Thrift.getListType _proxy)
+                                                                26
+                                                                25
+                                                                (Thrift.genList _proxy
+                                                                   (Thrift.getStringType _proxy)
+                                                                   (Thrift.genText _proxy)
+                                                                   __field__set_of_string)
+                                                                :
+                                                                Thrift.genField _proxy "set_of_pred"
+                                                                  (Thrift.getListType _proxy)
+                                                                  27
+                                                                  26
+                                                                  (Thrift.genList _proxy
+                                                                     (Thrift.getStructType _proxy)
+                                                                     (Thrift.buildStruct _proxy)
+                                                                     __field__set_of_pred)
+                                                                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__byt <- ST.newSTRef (Glean.Byte Default.def)
+            __field__nat <- ST.newSTRef (Glean.Nat Default.def)
+            __field__bool_ <- ST.newSTRef Prelude.False
+            __field__string_ <- ST.newSTRef ""
+            __field__pred <- ST.newSTRef Default.def
+            __field__maybe_ <- ST.newSTRef Prelude.Nothing
+            __field__record_ <- ST.newSTRef Default.def
+            __field__sum_ <- ST.newSTRef Default.def
+            __field__enum_ <- ST.newSTRef Default.def
+            __field__named_record_ <- ST.newSTRef Default.def
+            __field__named_sum_ <- ST.newSTRef Default.def
+            __field__named_enum_ <- ST.newSTRef Default.def
+            __field__array_of_byte <- ST.newSTRef ""
+            __field__array_of_nat <- ST.newSTRef Default.def
+            __field__array_of_bool <- ST.newSTRef Default.def
+            __field__array_of_string <- ST.newSTRef Default.def
+            __field__array_of_pred <- ST.newSTRef Default.def
+            __field__array_of_named_record <- ST.newSTRef Default.def
+            __field__array_of_named_sum <- ST.newSTRef Default.def
+            __field__array_of_named_enum <- ST.newSTRef Default.def
+            __field__array2_of_byte <- ST.newSTRef Default.def
+            __field__array2_of_nat <- ST.newSTRef Default.def
+            __field__array2_of_bool <- ST.newSTRef Default.def
+            __field__array2_of_string <- ST.newSTRef Default.def
+            __field__set_of_nat <- ST.newSTRef Default.def
+            __field__set_of_string <- ST.newSTRef Default.def
+            __field__set_of_pred <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getByteType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Byte
+                                                                                      (Thrift.parseByte
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__byt
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__nat
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__bool_
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__string_
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__pred
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__maybe_
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__record_
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sum_
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "KitchenSink_enum_")
+                                                                        ST.writeSTRef __field__enum_
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__named_record_
+                                                                           _val
+                                                                 11 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__named_sum_
+                                                                           _val
+                                                                 12 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseEnum
+                                                                                       _proxy
+                                                                                       "Enum_")
+                                                                         ST.writeSTRef
+                                                                           __field__named_enum_
+                                                                           _val
+                                                                 13 | _type ==
+                                                                        Thrift.getStringType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBytes
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_byte
+                                                                           _val
+                                                                 14 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.fmap
+                                                                                            Glean.Nat
+                                                                                            (Thrift.parseI64
+                                                                                               _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_nat
+                                                                           _val
+                                                                 15 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseBool
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_bool
+                                                                           _val
+                                                                 16 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseText
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_string
+                                                                           _val
+                                                                 17 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_pred
+                                                                           _val
+                                                                 18 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_named_record
+                                                                           _val
+                                                                 19 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_named_sum
+                                                                           _val
+                                                                 20 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseEnum
+                                                                                            _proxy
+                                                                                            "Enum_"))
+                                                                         ST.writeSTRef
+                                                                           __field__array_of_named_enum
+                                                                           _val
+                                                                 21 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseBytes
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__array2_of_byte
+                                                                           _val
+                                                                 22 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.snd
+                                                                                            <$>
+                                                                                            Thrift.parseList
+                                                                                              _proxy
+                                                                                              (Prelude.fmap
+                                                                                                 Glean.Nat
+                                                                                                 (Thrift.parseI64
+                                                                                                    _proxy))))
+                                                                         ST.writeSTRef
+                                                                           __field__array2_of_nat
+                                                                           _val
+                                                                 23 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.snd
+                                                                                            <$>
+                                                                                            Thrift.parseList
+                                                                                              _proxy
+                                                                                              (Thrift.parseBool
+                                                                                                 _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__array2_of_bool
+                                                                           _val
+                                                                 24 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.snd
+                                                                                            <$>
+                                                                                            Thrift.parseList
+                                                                                              _proxy
+                                                                                              (Thrift.parseText
+                                                                                                 _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__array2_of_string
+                                                                           _val
+                                                                 25 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Prelude.fmap
+                                                                                            Glean.Nat
+                                                                                            (Thrift.parseI64
+                                                                                               _proxy)))
+                                                                         ST.writeSTRef
+                                                                           __field__set_of_nat
+                                                                           _val
+                                                                 26 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseText
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__set_of_string
+                                                                           _val
+                                                                 27 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__set_of_pred
+                                                                           _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__byt <- ST.readSTRef __field__byt
+                                             !__val__nat <- ST.readSTRef __field__nat
+                                             !__val__bool_ <- ST.readSTRef __field__bool_
+                                             !__val__string_ <- ST.readSTRef __field__string_
+                                             !__val__pred <- ST.readSTRef __field__pred
+                                             !__val__maybe_ <- ST.readSTRef __field__maybe_
+                                             !__val__record_ <- ST.readSTRef __field__record_
+                                             !__val__sum_ <- ST.readSTRef __field__sum_
+                                             !__val__enum_ <- ST.readSTRef __field__enum_
+                                             !__val__named_record_ <- ST.readSTRef
+                                                                        __field__named_record_
+                                             !__val__named_sum_ <- ST.readSTRef __field__named_sum_
+                                             !__val__named_enum_ <- ST.readSTRef
+                                                                      __field__named_enum_
+                                             !__val__array_of_byte <- ST.readSTRef
+                                                                        __field__array_of_byte
+                                             !__val__array_of_nat <- ST.readSTRef
+                                                                       __field__array_of_nat
+                                             !__val__array_of_bool <- ST.readSTRef
+                                                                        __field__array_of_bool
+                                             !__val__array_of_string <- ST.readSTRef
+                                                                          __field__array_of_string
+                                             !__val__array_of_pred <- ST.readSTRef
+                                                                        __field__array_of_pred
+                                             !__val__array_of_named_record <- ST.readSTRef
+                                                                                __field__array_of_named_record
+                                             !__val__array_of_named_sum <- ST.readSTRef
+                                                                             __field__array_of_named_sum
+                                             !__val__array_of_named_enum <- ST.readSTRef
+                                                                              __field__array_of_named_enum
+                                             !__val__array2_of_byte <- ST.readSTRef
+                                                                         __field__array2_of_byte
+                                             !__val__array2_of_nat <- ST.readSTRef
+                                                                        __field__array2_of_nat
+                                             !__val__array2_of_bool <- ST.readSTRef
+                                                                         __field__array2_of_bool
+                                             !__val__array2_of_string <- ST.readSTRef
+                                                                           __field__array2_of_string
+                                             !__val__set_of_nat <- ST.readSTRef __field__set_of_nat
+                                             !__val__set_of_string <- ST.readSTRef
+                                                                        __field__set_of_string
+                                             !__val__set_of_pred <- ST.readSTRef
+                                                                      __field__set_of_pred
+                                             Prelude.pure
+                                               (KitchenSink __val__byt __val__nat __val__bool_
+                                                  __val__string_
+                                                  __val__pred
+                                                  __val__maybe_
+                                                  __val__record_
+                                                  __val__sum_
+                                                  __val__enum_
+                                                  __val__named_record_
+                                                  __val__named_sum_
+                                                  __val__named_enum_
+                                                  __val__array_of_byte
+                                                  __val__array_of_nat
+                                                  __val__array_of_bool
+                                                  __val__array_of_string
+                                                  __val__array_of_pred
+                                                  __val__array_of_named_record
+                                                  __val__array_of_named_sum
+                                                  __val__array_of_named_enum
+                                                  __val__array2_of_byte
+                                                  __val__array2_of_nat
+                                                  __val__array2_of_bool
+                                                  __val__array2_of_string
+                                                  __val__set_of_nat
+                                                  __val__set_of_string
+                                                  __val__set_of_pred)
+              _idMap
+                = HashMap.fromList
+                    [("byt", 1), ("nat", 2), ("bool_", 3), ("string_", 4), ("pred", 5),
+                     ("maybe_", 6), ("record_", 7), ("sum_", 8), ("enum_", 9),
+                     ("named_record_", 10), ("named_sum_", 11), ("named_enum_", 12),
+                     ("array_of_byte", 13), ("array_of_nat", 14), ("array_of_bool", 15),
+                     ("array_of_string", 16), ("array_of_pred", 17),
+                     ("array_of_named_record", 18), ("array_of_named_sum", 19),
+                     ("array_of_named_enum", 20), ("array2_of_byte", 21),
+                     ("array2_of_nat", 22), ("array2_of_bool", 23),
+                     ("array2_of_string", 24), ("set_of_nat", 25),
+                     ("set_of_string", 26), ("set_of_pred", 27)]
+            _parse 0)
+
+instance DeepSeq.NFData KitchenSink where
+  rnf
+    (KitchenSink __field__byt __field__nat __field__bool_
+       __field__string_ __field__pred __field__maybe_ __field__record_
+       __field__sum_ __field__enum_ __field__named_record_
+       __field__named_sum_ __field__named_enum_ __field__array_of_byte
+       __field__array_of_nat __field__array_of_bool
+       __field__array_of_string __field__array_of_pred
+       __field__array_of_named_record __field__array_of_named_sum
+       __field__array_of_named_enum __field__array2_of_byte
+       __field__array2_of_nat __field__array2_of_bool
+       __field__array2_of_string __field__set_of_nat
+       __field__set_of_string __field__set_of_pred)
+    = DeepSeq.rnf __field__byt `Prelude.seq`
+        DeepSeq.rnf __field__nat `Prelude.seq`
+          DeepSeq.rnf __field__bool_ `Prelude.seq`
+            DeepSeq.rnf __field__string_ `Prelude.seq`
+              DeepSeq.rnf __field__pred `Prelude.seq`
+                DeepSeq.rnf __field__maybe_ `Prelude.seq`
+                  DeepSeq.rnf __field__record_ `Prelude.seq`
+                    DeepSeq.rnf __field__sum_ `Prelude.seq`
+                      DeepSeq.rnf __field__enum_ `Prelude.seq`
+                        DeepSeq.rnf __field__named_record_ `Prelude.seq`
+                          DeepSeq.rnf __field__named_sum_ `Prelude.seq`
+                            DeepSeq.rnf __field__named_enum_ `Prelude.seq`
+                              DeepSeq.rnf __field__array_of_byte `Prelude.seq`
+                                DeepSeq.rnf __field__array_of_nat `Prelude.seq`
+                                  DeepSeq.rnf __field__array_of_bool `Prelude.seq`
+                                    DeepSeq.rnf __field__array_of_string `Prelude.seq`
+                                      DeepSeq.rnf __field__array_of_pred `Prelude.seq`
+                                        DeepSeq.rnf __field__array_of_named_record `Prelude.seq`
+                                          DeepSeq.rnf __field__array_of_named_sum `Prelude.seq`
+                                            DeepSeq.rnf __field__array_of_named_enum `Prelude.seq`
+                                              DeepSeq.rnf __field__array2_of_byte `Prelude.seq`
+                                                DeepSeq.rnf __field__array2_of_nat `Prelude.seq`
+                                                  DeepSeq.rnf __field__array2_of_bool `Prelude.seq`
+                                                    DeepSeq.rnf __field__array2_of_string
+                                                      `Prelude.seq`
+                                                      DeepSeq.rnf __field__set_of_nat `Prelude.seq`
+                                                        DeepSeq.rnf __field__set_of_string
+                                                          `Prelude.seq`
+                                                          DeepSeq.rnf __field__set_of_pred
+                                                            `Prelude.seq` ()
+
+instance Default.Default KitchenSink where
+  def
+    = KitchenSink (Glean.Byte Default.def) (Glean.Nat Default.def)
+        Prelude.False
+        ""
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        ""
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable KitchenSink where
+  hashWithSalt __salt
+    (KitchenSink _byt _nat _bool_ _string_ _pred _maybe_ _record_ _sum_
+       _enum_ _named_record_ _named_sum_ _named_enum_ _array_of_byte
+       _array_of_nat _array_of_bool _array_of_string _array_of_pred
+       _array_of_named_record _array_of_named_sum _array_of_named_enum
+       _array2_of_byte _array2_of_nat _array2_of_bool _array2_of_string
+       _set_of_nat _set_of_string _set_of_pred)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt
+                                   (Hashable.hashWithSalt
+                                      (Hashable.hashWithSalt
+                                         (Hashable.hashWithSalt
+                                            (Hashable.hashWithSalt
+                                               (Hashable.hashWithSalt
+                                                  (Hashable.hashWithSalt
+                                                     (Hashable.hashWithSalt
+                                                        (Hashable.hashWithSalt
+                                                           (Hashable.hashWithSalt
+                                                              (Hashable.hashWithSalt
+                                                                 (Hashable.hashWithSalt
+                                                                    (Hashable.hashWithSalt
+                                                                       (Hashable.hashWithSalt
+                                                                          (Hashable.hashWithSalt
+                                                                             (Hashable.hashWithSalt
+                                                                                (Hashable.hashWithSalt
+                                                                                   (Hashable.hashWithSalt
+                                                                                      __salt
+                                                                                      _byt)
+                                                                                   _nat)
+                                                                                _bool_)
+                                                                             _string_)
+                                                                          _pred)
+                                                                       _maybe_)
+                                                                    _record_)
+                                                                 _sum_)
+                                                              _enum_)
+                                                           _named_record_)
+                                                        _named_sum_)
+                                                     _named_enum_)
+                                                  _array_of_byte)
+                                               _array_of_nat)
+                                            _array_of_bool)
+                                         _array_of_string)
+                                      _array_of_pred)
+                                   _array_of_named_record)
+                                _array_of_named_sum)
+                             _array_of_named_enum)
+                          _array2_of_byte)
+                       _array2_of_nat)
+                    _array2_of_bool)
+                 _array2_of_string)
+              _set_of_nat)
+           _set_of_string)
+        _set_of_pred
+{-# LINE 20 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairSum_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.StoredRevStringPairSum_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairSum_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StoredRevStringPairSum_key"
+           (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.StoredRevStringPairSum_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 31 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.StoredRevStringPairSum
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StoredRevStringPairSum =
+       Glean.Schema.GleanTest.Types.StoredRevStringPairSum_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.StoredRevStringPairSum" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.storedRevStringPairSum_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairSum x k
+  getFactKey
+    = Glean.Schema.GleanTest.Types.storedRevStringPairSum_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairSum
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.MatchOneAlt_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.MatchOneAlt_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.MatchOneAlt_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.MatchOneAlt_key" (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.MatchOneAlt_key =
+     'Angle.TField "x" (Glean.Schema.GleanTest.Types.Sum)
+       ('Angle.TField "y" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 57 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.MatchOneAlt
+         where
+  type KeyType Glean.Schema.GleanTest.Types.MatchOneAlt =
+       Glean.Schema.GleanTest.Types.MatchOneAlt_key
+  getName _proxy = Glean.PredicateRef "glean.test.MatchOneAlt" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.matchOneAlt_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.MatchOneAlt x k
+  getFactKey = Glean.Schema.GleanTest.Types.matchOneAlt_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 66 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.MatchOneAlt where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 72 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.DerivedKeyValue_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.DerivedKeyValue_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.DerivedKeyValue_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.DerivedKeyValue_key" (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.DerivedKeyValue_key
+     =
+     'Angle.TField "kstring" (Data.Text.Text)
+       ('Angle.TField "knat" (Glean.Nat)
+          ('Angle.TField "vnat" (Glean.Nat)
+             ('Angle.TField "vstring" (Data.Text.Text) ('Angle.TNoFields))))
+{-# LINE 87 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.DerivedKeyValue
+         where
+  type KeyType Glean.Schema.GleanTest.Types.DerivedKeyValue =
+       Glean.Schema.GleanTest.Types.DerivedKeyValue_key
+  getName _proxy = Glean.PredicateRef "glean.test.DerivedKeyValue" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.derivedKeyValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.DerivedKeyValue x k
+  getFactKey = Glean.Schema.GleanTest.Types.derivedKeyValue_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.DerivedKeyValue
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.ViaStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.ViaStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.ViaStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.ViaStringPair_key" (Prelude.Just 0))
+{-# LINE 111 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.ViaStringPair_key =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 113 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.ViaStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.ViaStringPair =
+       Glean.Schema.GleanTest.Types.ViaStringPair_key
+  getName _proxy = Glean.PredicateRef "glean.test.ViaStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.viaStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.ViaStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.viaStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 122 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.ViaStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 128 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Predicate
+         where
+  type KeyType Glean.Schema.GleanTest.Types.Predicate =
+       Glean.Schema.GleanTest.Types.KitchenSink
+  getName _proxy = Glean.PredicateRef "glean.test.Predicate" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.predicate_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Predicate x k
+  getFactKey = Glean.Schema.GleanTest.Types.predicate_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 137 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Predicate where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 143 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.EmptyPred
+         where
+  type KeyType Glean.Schema.GleanTest.Types.EmptyPred =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.EmptyPred" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.emptyPred_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.EmptyPred x k
+  getFactKey = Glean.Schema.GleanTest.Types.emptyPred_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.EmptyPred where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 157 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Node_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Node_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Node_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Node_key" (Prelude.Just 0))
+{-# LINE 164 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Node_key =
+     'Angle.TField "label" (Data.Text.Text) ('Angle.TNoFields)
+{-# LINE 166 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Node where
+  type KeyType Glean.Schema.GleanTest.Types.Node =
+       Glean.Schema.GleanTest.Types.Node_key
+  getName _proxy = Glean.PredicateRef "glean.test.Node" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.node_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Node x k
+  getFactKey = Glean.Schema.GleanTest.Types.node_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 175 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Node where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 181 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.EdgeWrapper_key
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.EdgeWrapper_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.EdgeWrapper_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.EdgeWrapper_key" (Prelude.Just 0))
+{-# LINE 188 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.EdgeWrapper_key =
+     'Angle.TField "edge"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Edge)
+       ('Angle.TNoFields)
+{-# LINE 190 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.EdgeWrapper
+         where
+  type KeyType Glean.Schema.GleanTest.Types.EdgeWrapper =
+       Glean.Schema.GleanTest.Types.EdgeWrapper_key
+  getName _proxy = Glean.PredicateRef "glean.test.EdgeWrapper" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.edgeWrapper_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.EdgeWrapper x k
+  getFactKey = Glean.Schema.GleanTest.Types.edgeWrapper_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 199 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.EdgeWrapper where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 205 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Unbound_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Unbound_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Unbound_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Unbound_key" (Prelude.Just 0))
+{-# LINE 214 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Unbound_key =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "y" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 216 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Unbound where
+  type KeyType Glean.Schema.GleanTest.Types.Unbound =
+       Glean.Schema.GleanTest.Types.Unbound_key
+  getName _proxy = Glean.PredicateRef "glean.test.Unbound" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.unbound_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Unbound x k
+  getFactKey = Glean.Schema.GleanTest.Types.unbound_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 225 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Unbound where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 231 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.TreeToTree
+         where
+  type KeyType Glean.Schema.GleanTest.Types.TreeToTree =
+       Glean.Schema.GleanTest.Types.Tree
+  type ValueType Glean.Schema.GleanTest.Types.TreeToTree =
+       Glean.Schema.GleanTest.Types.TreeToTree_value
+  getName _proxy = Glean.PredicateRef "glean.test.TreeToTree" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.treeToTree_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.TreeToTree x k v
+  getFactKey = Glean.Schema.GleanTest.Types.treeToTree_key
+  getFactValue = Glean.Schema.GleanTest.Types.treeToTree_value
+{-# LINE 242 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.TreeToTree where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 248 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithA_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.StoredRevStringPairWithA_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairWithA_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StoredRevStringPairWithA_key"
+           (Prelude.Just 0))
+{-# LINE 257 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.StoredRevStringPairWithA_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 259 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithA
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StoredRevStringPairWithA
+       = Glean.Schema.GleanTest.Types.StoredRevStringPairWithA_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.StoredRevStringPairWithA" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.GleanTest.Types.storedRevStringPairWithA_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairWithA x k
+  getFactKey
+    = Glean.Schema.GleanTest.Types.storedRevStringPairWithA_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 268 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithA
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 274 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.RevRevStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.RevRevStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.RevRevStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.RevRevStringPair_key"
+           (Prelude.Just 0))
+{-# LINE 283 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.RevRevStringPair_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 285 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.RevRevStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.RevRevStringPair =
+       Glean.Schema.GleanTest.Types.RevRevStringPair_key
+  getName _proxy = Glean.PredicateRef "glean.test.RevRevStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.revRevStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RevRevStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.revRevStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 294 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevRevStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 300 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Bar where
+  type KeyType Glean.Schema.GleanTest.Types.Bar = Data.Text.Text
+  type ValueType Glean.Schema.GleanTest.Types.Bar =
+       Glean.Schema.GleanTest.Types.Bar_value
+  getName _proxy = Glean.PredicateRef "glean.test.Bar" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.bar_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.Bar x k v
+  getFactKey = Glean.Schema.GleanTest.Types.bar_key
+  getFactValue = Glean.Schema.GleanTest.Types.bar_value
+{-# LINE 310 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Bar where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 316 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KeyValue_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.KeyValue_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.KeyValue_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KeyValue_key" (Prelude.Just 0))
+{-# LINE 325 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.KeyValue_key =
+     'Angle.TField "kstring" (Data.Text.Text)
+       ('Angle.TField "knat" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 327 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KeyValue_value
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.KeyValue_value x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.KeyValue_value <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KeyValue_value" (Prelude.Just 0))
+{-# LINE 336 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.KeyValue_value =
+     'Angle.TField "vnat" (Glean.Nat)
+       ('Angle.TField "vstring" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 338 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.KeyValue
+         where
+  type KeyType Glean.Schema.GleanTest.Types.KeyValue =
+       Glean.Schema.GleanTest.Types.KeyValue_key
+  type ValueType Glean.Schema.GleanTest.Types.KeyValue =
+       Glean.Schema.GleanTest.Types.KeyValue_value
+  getName _proxy = Glean.PredicateRef "glean.test.KeyValue" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.keyValue_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.KeyValue x k v
+  getFactKey = Glean.Schema.GleanTest.Types.keyValue_key
+  getFactValue = Glean.Schema.GleanTest.Types.keyValue_value
+{-# LINE 349 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KeyValue where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 355 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevStringPairs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.RevStringPairs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.RevStringPairs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.RevStringPairs_key" (Prelude.Just 0))
+{-# LINE 364 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.RevStringPairs_key
+     =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "r"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.RevStringPair)
+          ('Angle.TNoFields))
+{-# LINE 366 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.RevStringPairs
+         where
+  type KeyType Glean.Schema.GleanTest.Types.RevStringPairs =
+       Glean.Schema.GleanTest.Types.RevStringPairs_key
+  getName _proxy = Glean.PredicateRef "glean.test.RevStringPairs" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.revStringPairs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RevStringPairs x k
+  getFactKey = Glean.Schema.GleanTest.Types.revStringPairs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 375 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevStringPairs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 381 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.LeftOr_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.LeftOr_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.LeftOr_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.LeftOr_key" (Prelude.Just 0))
+{-# LINE 390 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.LeftOr_key =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "y" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 392 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.LeftOr where
+  type KeyType Glean.Schema.GleanTest.Types.LeftOr =
+       Glean.Schema.GleanTest.Types.LeftOr_key
+  getName _proxy = Glean.PredicateRef "glean.test.LeftOr" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.leftOr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.LeftOr x k
+  getFactKey = Glean.Schema.GleanTest.Types.leftOr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 401 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.LeftOr where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 407 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.IsGlean where
+  type KeyType Glean.Schema.GleanTest.Types.IsGlean = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.IsGlean" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.isGlean_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.IsGlean x k
+  getFactKey = Glean.Schema.GleanTest.Types.isGlean_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 415 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.IsGlean where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 421 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredDualStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.StoredDualStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StoredDualStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StoredDualStringPair_key"
+           (Prelude.Just 0))
+{-# LINE 430 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.StoredDualStringPair_key
+     =
+     'Angle.TField "fst"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+       ('Angle.TField "snd"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+          ('Angle.TNoFields))
+{-# LINE 432 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.StoredDualStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StoredDualStringPair =
+       Glean.Schema.GleanTest.Types.StoredDualStringPair_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.StoredDualStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.storedDualStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StoredDualStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.storedDualStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 441 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredDualStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 447 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.SkipRevEdge_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.SkipRevEdge_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.SkipRevEdge_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.SkipRevEdge_key" (Prelude.Just 0))
+{-# LINE 456 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.SkipRevEdge_key =
+     'Angle.TField "child"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+       ('Angle.TField "grandparent"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+          ('Angle.TNoFields))
+{-# LINE 458 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.SkipRevEdge
+         where
+  type KeyType Glean.Schema.GleanTest.Types.SkipRevEdge =
+       Glean.Schema.GleanTest.Types.SkipRevEdge_key
+  getName _proxy = Glean.PredicateRef "glean.test.SkipRevEdge" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.skipRevEdge_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.SkipRevEdge x k
+  getFactKey = Glean.Schema.GleanTest.Types.skipRevEdge_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 467 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.SkipRevEdge where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 473 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.DualStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.DualStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.DualStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.DualStringPair_key" (Prelude.Just 0))
+{-# LINE 482 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.DualStringPair_key
+     =
+     'Angle.TField "fst"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+       ('Angle.TField "snd"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+          ('Angle.TNoFields))
+{-# LINE 484 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.DualStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.DualStringPair =
+       Glean.Schema.GleanTest.Types.DualStringPair_key
+  getName _proxy = Glean.PredicateRef "glean.test.DualStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.dualStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.DualStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.dualStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 493 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.DualStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 499 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Foo where
+  type KeyType Glean.Schema.GleanTest.Types.Foo = Data.Text.Text
+  type ValueType Glean.Schema.GleanTest.Types.Foo =
+       Glean.Schema.GleanTest.Types.Foo_value
+  getName _proxy = Glean.PredicateRef "glean.test.Foo" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.foo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.Foo x k v
+  getFactKey = Glean.Schema.GleanTest.Types.foo_key
+  getFactValue = Glean.Schema.GleanTest.Types.foo_value
+{-# LINE 509 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Foo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 515 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Predicate_0
+         where
+  type KeyType Glean.Schema.GleanTest.Types.Predicate_0 =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.Predicate" 0
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.predicate_0_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Predicate_0 x k
+  getFactKey = Glean.Schema.GleanTest.Types.predicate_0_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 523 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Predicate_0 where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 529 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.RevStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.RevStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.RevStringPair_key" (Prelude.Just 0))
+{-# LINE 538 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.RevStringPair_key =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 540 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.RevStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.RevStringPair =
+       Glean.Schema.GleanTest.Types.RevStringPair_key
+  getName _proxy = Glean.PredicateRef "glean.test.RevStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.revStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RevStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.revStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 549 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 555 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.StringPairBox_key
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.StringPairBox_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StringPairBox_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StringPairBox_key" (Prelude.Just 0))
+{-# LINE 562 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.StringPairBox_key =
+     'Angle.TField "box"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+       ('Angle.TNoFields)
+{-# LINE 564 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.StringPairBox
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StringPairBox =
+       Glean.Schema.GleanTest.Types.StringPairBox_key
+  getName _proxy = Glean.PredicateRef "glean.test.StringPairBox" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.stringPairBox_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StringPairBox x k
+  getFactKey = Glean.Schema.GleanTest.Types.stringPairBox_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 573 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.StringPairBox
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 579 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.IsParent
+         where
+  type KeyType Glean.Schema.GleanTest.Types.IsParent =
+       Glean.Schema.GleanTest.Types.Node
+  getName _proxy = Glean.PredicateRef "glean.test.IsParent" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.isParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.IsParent x k
+  getFactKey = Glean.Schema.GleanTest.Types.isParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 588 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.IsParent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 594 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.IsThree where
+  type KeyType Glean.Schema.GleanTest.Types.IsThree = Glean.Nat
+  getName _proxy = Glean.PredicateRef "glean.test.IsThree" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.isThree_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.IsThree x k
+  getFactKey = Glean.Schema.GleanTest.Types.isThree_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 602 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.IsThree where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 608 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.FooToFoo
+         where
+  type KeyType Glean.Schema.GleanTest.Types.FooToFoo =
+       Glean.Schema.GleanTest.Types.Foo
+  type ValueType Glean.Schema.GleanTest.Types.FooToFoo =
+       Glean.Schema.GleanTest.Types.FooToFoo_value
+  getName _proxy = Glean.PredicateRef "glean.test.FooToFoo" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.fooToFoo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.FooToFoo x k v
+  getFactKey = Glean.Schema.GleanTest.Types.fooToFoo_key
+  getFactValue = Glean.Schema.GleanTest.Types.fooToFoo_value
+{-# LINE 619 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.FooToFoo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 625 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.RevStringPairRec_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.RevStringPairRec_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.RevStringPairRec_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.RevStringPairRec_key"
+           (Prelude.Just 0))
+{-# LINE 634 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.RevStringPairRec_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 636 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.RevStringPairRec
+         where
+  type KeyType Glean.Schema.GleanTest.Types.RevStringPairRec =
+       Glean.Schema.GleanTest.Types.RevStringPairRec_key
+  getName _proxy = Glean.PredicateRef "glean.test.RevStringPairRec" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.revStringPairRec_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RevStringPairRec x k
+  getFactKey = Glean.Schema.GleanTest.Types.revStringPairRec_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 645 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevStringPairRec
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 651 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.NothingTest_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.NothingTest_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.NothingTest_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.nothingTest_key" (Prelude.Just 0))
+{-# LINE 660 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.NothingTest_key =
+     'Angle.TField "a" (Prelude.Maybe Data.Text.Text)
+       ('Angle.TField "b" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 662 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.NothingTest
+         where
+  type KeyType Glean.Schema.GleanTest.Types.NothingTest =
+       Glean.Schema.GleanTest.Types.NothingTest_key
+  getName _proxy = Glean.PredicateRef "glean.test.nothingTest" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.nothingTest_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.NothingTest x k
+  getFactKey = Glean.Schema.GleanTest.Types.nothingTest_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 671 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.NothingTest where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 677 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.RefRef where
+  type KeyType Glean.Schema.GleanTest.Types.RefRef =
+       Glean.Schema.GleanTest.Types.Ref
+  getName _proxy = Glean.PredicateRef "glean.test.RefRef" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.refRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RefRef x k
+  getFactKey = Glean.Schema.GleanTest.Types.refRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 686 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RefRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 692 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Qux where
+  type KeyType Glean.Schema.GleanTest.Types.Qux = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.Qux" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.qux_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Qux x k
+  getFactKey = Glean.Schema.GleanTest.Types.qux_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 700 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Qux where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 706 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.StoredRevStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StoredRevStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StoredRevStringPair_key"
+           (Prelude.Just 0))
+{-# LINE 715 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.StoredRevStringPair_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 717 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.StoredRevStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StoredRevStringPair =
+       Glean.Schema.GleanTest.Types.StoredRevStringPair_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.StoredRevStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.storedRevStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StoredRevStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.storedRevStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 726 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 732 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.EmptyStoredStringPair_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.EmptyStoredStringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.EmptyStoredStringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.EmptyStoredStringPair_key"
+           (Prelude.Just 0))
+{-# LINE 741 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.EmptyStoredStringPair_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 743 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.EmptyStoredStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.EmptyStoredStringPair =
+       Glean.Schema.GleanTest.Types.EmptyStoredStringPair_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.EmptyStoredStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.emptyStoredStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.EmptyStoredStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.emptyStoredStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 752 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.EmptyStoredStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 758 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Ref where
+  type KeyType Glean.Schema.GleanTest.Types.Ref =
+       Glean.Schema.GleanTest.Types.Predicate
+  getName _proxy = Glean.PredicateRef "glean.test.Ref" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.ref_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Ref x k
+  getFactKey = Glean.Schema.GleanTest.Types.ref_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 767 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Ref where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 773 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.StringPair_key
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.StringPair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StringPair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StringPair_key" (Prelude.Just 0))
+{-# LINE 782 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.StringPair_key =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 784 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.StringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.StringPair =
+       Glean.Schema.GleanTest.Types.StringPair_key
+  getName _proxy = Glean.PredicateRef "glean.test.StringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.stringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.stringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 793 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.StringPair where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 799 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.DerivedKeyValue2_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.DerivedKeyValue2_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.DerivedKeyValue2_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.DerivedKeyValue2_key"
+           (Prelude.Just 0))
+{-# LINE 808 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.DerivedKeyValue2_key
+     =
+     'Angle.TField "kstring" (Data.Text.Text)
+       ('Angle.TField "knat" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 810 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.DerivedKeyValue2_value
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.DerivedKeyValue2_value x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.DerivedKeyValue2_value <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.DerivedKeyValue2_value"
+           (Prelude.Just 0))
+{-# LINE 819 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.DerivedKeyValue2_value
+     =
+     'Angle.TField "vnat" (Glean.Nat)
+       ('Angle.TField "vstring" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 821 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.DerivedKeyValue2
+         where
+  type KeyType Glean.Schema.GleanTest.Types.DerivedKeyValue2 =
+       Glean.Schema.GleanTest.Types.DerivedKeyValue2_key
+  type ValueType Glean.Schema.GleanTest.Types.DerivedKeyValue2 =
+       Glean.Schema.GleanTest.Types.DerivedKeyValue2_value
+  getName _proxy = Glean.PredicateRef "glean.test.DerivedKeyValue2" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.derivedKeyValue2_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.GleanTest.Types.DerivedKeyValue2 x k v
+  getFactKey = Glean.Schema.GleanTest.Types.derivedKeyValue2_key
+  getFactValue = Glean.Schema.GleanTest.Types.derivedKeyValue2_value
+{-# LINE 832 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.DerivedKeyValue2
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 838 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.NodePair_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.NodePair_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.NodePair_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.NodePair_key" (Prelude.Just 0))
+{-# LINE 847 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.NodePair_key =
+     'Angle.TField "fst"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+       ('Angle.TField "snd"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+          ('Angle.TNoFields))
+{-# LINE 849 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.NodePair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.NodePair =
+       Glean.Schema.GleanTest.Types.NodePair_key
+  getName _proxy = Glean.PredicateRef "glean.test.NodePair" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.nodePair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.NodePair x k
+  getFactKey = Glean.Schema.GleanTest.Types.nodePair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 858 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.NodePair where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 864 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.ReflStringPair
+         where
+  type KeyType Glean.Schema.GleanTest.Types.ReflStringPair =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.ReflStringPair" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.reflStringPair_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.ReflStringPair x k
+  getFactKey = Glean.Schema.GleanTest.Types.reflStringPair_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 872 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.ReflStringPair
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 878 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.LeftOr2_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.LeftOr2_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.LeftOr2_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.LeftOr2_key" (Prelude.Just 0))
+{-# LINE 887 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.LeftOr2_key =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "y" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 889 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.LeftOr2 where
+  type KeyType Glean.Schema.GleanTest.Types.LeftOr2 =
+       Glean.Schema.GleanTest.Types.LeftOr2_key
+  getName _proxy = Glean.PredicateRef "glean.test.LeftOr2" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.leftOr2_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.LeftOr2 x k
+  getFactKey = Glean.Schema.GleanTest.Types.leftOr2_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 898 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.LeftOr2 where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 904 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Expr_key where
+  buildRtsValue b Glean.Schema.GleanTest.Types.Expr_key_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_key_var_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_key_lit x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_key_prim x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_key_ap x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_key_lam x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.GleanTest.Types.Expr_key_EMPTY)
+        [Glean.mapD Glean.Schema.GleanTest.Types.Expr_key_var_,
+         Glean.mapD Glean.Schema.GleanTest.Types.Expr_key_lit,
+         Glean.mapD Glean.Schema.GleanTest.Types.Expr_key_prim,
+         Glean.mapD Glean.Schema.GleanTest.Types.Expr_key_ap,
+         Glean.mapD Glean.Schema.GleanTest.Types.Expr_key_lam]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Expr_key" (Prelude.Just 0))
+{-# LINE 932 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.GleanTest.Types.Expr_key
+     =
+     'Angle.TField "var_"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Name)
+       ('Angle.TField "lit" (Glean.Nat)
+          ('Angle.TField "prim"
+             (Glean.KeyType Glean.Schema.GleanTest.Types.Name)
+             ('Angle.TField "ap" (Glean.Schema.GleanTest.Types.Expr_ap_)
+                ('Angle.TField "lam" (Glean.Schema.GleanTest.Types.Expr_lam_)
+                   ('Angle.TNoFields)))))
+{-# LINE 934 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Expr where
+  type KeyType Glean.Schema.GleanTest.Types.Expr =
+       Glean.Schema.GleanTest.Types.Expr_key
+  getName _proxy = Glean.PredicateRef "glean.test.Expr" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.expr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Expr x k
+  getFactKey = Glean.Schema.GleanTest.Types.expr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 943 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Expr where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 949 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.EdgeFromNotA
+         where
+  type KeyType Glean.Schema.GleanTest.Types.EdgeFromNotA =
+       Glean.Schema.GleanTest.Types.Edge
+  getName _proxy = Glean.PredicateRef "glean.test.EdgeFromNotA" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.edgeFromNotA_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.EdgeFromNotA x k
+  getFactKey = Glean.Schema.GleanTest.Types.edgeFromNotA_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 958 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.EdgeFromNotA where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 964 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Unbound2_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Unbound2_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Unbound2_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Unbound2_key" (Prelude.Just 0))
+{-# LINE 973 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Unbound2_key =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "y" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 975 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Unbound2
+         where
+  type KeyType Glean.Schema.GleanTest.Types.Unbound2 =
+       Glean.Schema.GleanTest.Types.Unbound2_key
+  getName _proxy = Glean.PredicateRef "glean.test.Unbound2" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.unbound2_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Unbound2 x k
+  getFactKey = Glean.Schema.GleanTest.Types.unbound2_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 984 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Unbound2 where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 990 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev_key
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.StoredRevStringPairWithRev_key"
+           (Prelude.Just 0))
+{-# LINE 999 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev_key
+     =
+     'Angle.TField "fst" (Data.Text.Text)
+       ('Angle.TField "snd" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1001 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev
+         where
+  type KeyType
+         Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev
+       = Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev_key
+  getName _proxy
+    = Glean.PredicateRef "glean.test.StoredRevStringPairWithRev" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.GleanTest.Types.storedRevStringPairWithRev_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev x k
+  getFactKey
+    = Glean.Schema.GleanTest.Types.storedRevStringPairWithRev_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1011 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.StoredRevStringPairWithRev
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1017 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevEdge_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.RevEdge_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.RevEdge_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.RevEdge_key" (Prelude.Just 0))
+{-# LINE 1026 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.RevEdge_key =
+     'Angle.TField "child"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+          ('Angle.TNoFields))
+{-# LINE 1028 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.RevEdge where
+  type KeyType Glean.Schema.GleanTest.Types.RevEdge =
+       Glean.Schema.GleanTest.Types.RevEdge_key
+  getName _proxy = Glean.PredicateRef "glean.test.RevEdge" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.revEdge_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.RevEdge x k
+  getFactKey = Glean.Schema.GleanTest.Types.revEdge_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1037 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.RevEdge where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1043 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Edge_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Edge_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Edge_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Edge_key" (Prelude.Just 0))
+{-# LINE 1052 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Edge_key =
+     'Angle.TField "parent"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+       ('Angle.TField "child"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+          ('Angle.TNoFields))
+{-# LINE 1054 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Edge where
+  type KeyType Glean.Schema.GleanTest.Types.Edge =
+       Glean.Schema.GleanTest.Types.Edge_key
+  getName _proxy = Glean.PredicateRef "glean.test.Edge" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.edge_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Edge x k
+  getFactKey = Glean.Schema.GleanTest.Types.edge_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1063 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Edge where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1069 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Name where
+  type KeyType Glean.Schema.GleanTest.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "glean.test.Name" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Name x k
+  getFactKey = Glean.Schema.GleanTest.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1077 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1083 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.SameString_key
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.SameString_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.SameString_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.SameString_key" (Prelude.Just 0))
+{-# LINE 1092 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.SameString_key =
+     'Angle.TField "x" (Data.Text.Text)
+       ('Angle.TField "y" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1094 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.SameString
+         where
+  type KeyType Glean.Schema.GleanTest.Types.SameString =
+       Glean.Schema.GleanTest.Types.SameString_key
+  getName _proxy = Glean.PredicateRef "glean.test.SameString" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.GleanTest.Types.sameString_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.SameString x k
+  getFactKey = Glean.Schema.GleanTest.Types.sameString_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1103 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.SameString where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1109 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Tree_key where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Tree_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Tree_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Tree_key" (Prelude.Just 0))
+{-# LINE 1120 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Tree_key =
+     'Angle.TField "node"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Node)
+       ('Angle.TField "left"
+          (Prelude.Maybe Glean.Schema.GleanTest.Types.Tree)
+          ('Angle.TField "right"
+             (Prelude.Maybe Glean.Schema.GleanTest.Types.Tree)
+             ('Angle.TNoFields)))
+{-# LINE 1122 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Predicate Glean.Schema.GleanTest.Types.Tree where
+  type KeyType Glean.Schema.GleanTest.Types.Tree =
+       Glean.Schema.GleanTest.Types.Tree_key
+  getName _proxy = Glean.PredicateRef "glean.test.Tree" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.GleanTest.Types.tree_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.GleanTest.Types.Tree x k
+  getFactKey = Glean.Schema.GleanTest.Types.tree_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1131 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Tree where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1137 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Rec where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Rec x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Rec <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Rec" (Prelude.Just 6))
+{-# LINE 1146 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.GleanTest.Types.Rec =
+     'Angle.TField "alpha" (Glean.Schema.GleanTest.Types.Enum_)
+       ('Angle.TField "beta" (Glean.Schema.GleanTest.Types.Sum)
+          ('Angle.TNoFields))
+{-# LINE 1148 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.EdgeSum where
+  buildRtsValue b Glean.Schema.GleanTest.Types.EdgeSum_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.GleanTest.Types.EdgeSum_fst x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.EdgeSum_snd x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.GleanTest.Types.EdgeSum_EMPTY)
+        [Glean.mapD Glean.Schema.GleanTest.Types.EdgeSum_fst,
+         Glean.mapD Glean.Schema.GleanTest.Types.EdgeSum_snd]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.EdgeSum" (Prelude.Just 6))
+{-# LINE 1164 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.GleanTest.Types.EdgeSum
+     =
+     'Angle.TField "fst"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.EdgeWrapper)
+       ('Angle.TField "snd"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.EdgeWrapper)
+          ('Angle.TNoFields))
+{-# LINE 1166 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.WrappedStringPair
+         where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.WrappedStringPair x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.WrappedStringPair <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.WrappedStringPair" (Prelude.Just 6))
+{-# LINE 1173 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.WrappedStringPair =
+     'Angle.TField "wrapped"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.StringPair)
+       ('Angle.TNoFields)
+{-# LINE 1175 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KitchenSink where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.KitchenSink x1 x2 x3 x4 x5 x6 x7 x8
+       x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25
+       x26 x27)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+         Glean.buildRtsValue b x11
+         Glean.buildRtsValue b x12
+         Glean.buildRtsValue b x13
+         Glean.buildRtsValue b x14
+         Glean.buildRtsValue b x15
+         Glean.buildRtsValue b x16
+         Glean.buildRtsValue b x17
+         Glean.buildRtsValue b x18
+         Glean.buildRtsValue b x19
+         Glean.buildRtsValue b x20
+         Glean.buildRtsValue b x21
+         Glean.buildRtsValue b x22
+         Glean.buildRtsValue b x23
+         Glean.buildRtsValue b x24
+         Glean.buildRtsValue b x25
+         Glean.buildRtsValue b x26
+         Glean.buildRtsValue b x27
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.KitchenSink <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KitchenSink" (Prelude.Just 6))
+{-# LINE 1234 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.KitchenSink =
+     'Angle.TField "byt" (Glean.Byte)
+       ('Angle.TField "nat" (Glean.Nat)
+          ('Angle.TField "bool_" (Prelude.Bool)
+             ('Angle.TField "string_" (Data.Text.Text)
+                ('Angle.TField "pred" (Glean.KeyType Glean.Schema.Sys.Types.Blob)
+                   ('Angle.TField "maybe_"
+                      (Prelude.Maybe Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "record_"
+                         (Glean.Schema.GleanTest.Types.KitchenSink_record_)
+                         ('Angle.TField "sum_"
+                            (Glean.Schema.GleanTest.Types.KitchenSink_sum_)
+                            ('Angle.TField "enum_"
+                               (Glean.Schema.GleanTest.Types.KitchenSink_enum_)
+                               ('Angle.TField "named_record_" (Glean.Schema.GleanTest.Types.Rec)
+                                  ('Angle.TField "named_sum_" (Glean.Schema.GleanTest.Types.Sum)
+                                     ('Angle.TField "named_enum_"
+                                        (Glean.Schema.GleanTest.Types.Enum_)
+                                        ('Angle.TField "array_of_byte" (Data.ByteString.ByteString)
+                                           ('Angle.TField "array_of_nat" ([Glean.Nat])
+                                              ('Angle.TField "array_of_bool" ([Prelude.Bool])
+                                                 ('Angle.TField "array_of_string" ([Data.Text.Text])
+                                                    ('Angle.TField "array_of_pred"
+                                                       ([Glean.Schema.GleanTest.Types.Predicate])
+                                                       ('Angle.TField "array_of_named_record"
+                                                          ([Glean.Schema.GleanTest.Types.Rec])
+                                                          ('Angle.TField "array_of_named_sum"
+                                                             ([Glean.Schema.GleanTest.Types.Sum])
+                                                             ('Angle.TField "array_of_named_enum"
+                                                                ([Glean.Schema.GleanTest.Types.Enum_])
+                                                                ('Angle.TField "array2_of_byte"
+                                                                   ([Glean.Schema.GleanTest.Types.ArrayByte])
+                                                                   ('Angle.TField "array2_of_nat"
+                                                                      ([Glean.Schema.GleanTest.Types.ArrayNat])
+                                                                      ('Angle.TField
+                                                                         "array2_of_bool"
+                                                                         ([Glean.Schema.GleanTest.Types.ArrayBool])
+                                                                         ('Angle.TField
+                                                                            "array2_of_string"
+                                                                            ([Glean.Schema.GleanTest.Types.ArrayString])
+                                                                            ('Angle.TField
+                                                                               "set_of_nat"
+                                                                               ([Glean.Nat])
+                                                                               ('Angle.TField
+                                                                                  "set_of_string"
+                                                                                  ([Data.Text.Text])
+                                                                                  ('Angle.TField
+                                                                                     "set_of_pred"
+                                                                                     ([Glean.Schema.GleanTest.Types.Predicate])
+                                                                                     ('Angle.TNoFields)))))))))))))))))))))))))))
+{-# LINE 1236 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Sum where
+  buildRtsValue b Glean.Schema.GleanTest.Types.Sum_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Sum_mon x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Sum_tue x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Sum_wed x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.GleanTest.Types.Sum_EMPTY)
+        [Glean.mapD Glean.Schema.GleanTest.Types.Sum_mon,
+         Glean.mapD Glean.Schema.GleanTest.Types.Sum_tue,
+         Glean.mapD Glean.Schema.GleanTest.Types.Sum_wed]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Sum" (Prelude.Just 6))
+{-# LINE 1256 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.GleanTest.Types.Sum =
+     'Angle.TField "mon" (Glean.Byte)
+       ('Angle.TField "tue" (Glean.Nat)
+          ('Angle.TField "wed" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 1258 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Entity where
+  buildRtsValue b Glean.Schema.GleanTest.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Entity_cxx x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Entity_pp x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.GleanTest.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.GleanTest.Types.Entity_cxx,
+         Glean.mapD Glean.Schema.GleanTest.Types.Entity_pp]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Entity" (Prelude.Just 6))
+{-# LINE 1274 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.GleanTest.Types.Entity =
+     'Angle.TField "cxx" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "pp" (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+          ('Angle.TNoFields))
+{-# LINE 1276 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Enum_ where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Enum_" (Prelude.Just 6))
+{-# LINE 1281 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.GleanTest.Types.Enum_ =
+     'Angle.TField "red" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "green" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "blue" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 1283 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.GleanTest.Types.Enum_ where
+  type AngleEnumTy Glean.Schema.GleanTest.Types.Enum_ =
+       Glean.Schema.GleanTest.Types.Enum_
+  enumName v = Text.pack (Prelude.drop 6 (Prelude.show v))
+{-# LINE 1287 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Expr_ap_ where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_ap_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Expr_ap_ <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Expr_ap_" (Prelude.Just 0))
+{-# LINE 1296 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Expr_ap_ =
+     'Angle.TField "fun"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Expr)
+       ('Angle.TField "arg"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Expr)
+          ('Angle.TNoFields))
+{-# LINE 1298 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.Expr_lam_ where
+  buildRtsValue b (Glean.Schema.GleanTest.Types.Expr_lam_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.Expr_lam_ <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.Expr_lam_" (Prelude.Just 0))
+{-# LINE 1307 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.Expr_lam_ =
+     'Angle.TField "var_"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Name)
+       ('Angle.TField "body"
+          (Glean.KeyType Glean.Schema.GleanTest.Types.Expr)
+          ('Angle.TNoFields))
+{-# LINE 1309 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.GleanTest.Types.KitchenSink_record_
+         where
+  buildRtsValue b
+    (Glean.Schema.GleanTest.Types.KitchenSink_record_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.GleanTest.Types.KitchenSink_record_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KitchenSink_record_" (Prelude.Just 0))
+{-# LINE 1318 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.GleanTest.Types.KitchenSink_record_
+     =
+     'Angle.TField "a" (Glean.Byte)
+       ('Angle.TField "b" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 1320 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KitchenSink_sum_
+         where
+  buildRtsValue b Glean.Schema.GleanTest.Types.KitchenSink_sum__EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.GleanTest.Types.KitchenSink_sum__c x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.GleanTest.Types.KitchenSink_sum__d x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.GleanTest.Types.KitchenSink_sum__EMPTY)
+        [Glean.mapD Glean.Schema.GleanTest.Types.KitchenSink_sum__c,
+         Glean.mapD Glean.Schema.GleanTest.Types.KitchenSink_sum__d]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KitchenSink_sum_" (Prelude.Just 0))
+{-# LINE 1336 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.GleanTest.Types.KitchenSink_sum_ =
+     'Angle.TField "c"
+       (Glean.KeyType Glean.Schema.GleanTest.Types.Predicate)
+       ('Angle.TField "d" (Glean.KeyType Glean.Schema.Sys.Types.Blob)
+          ('Angle.TNoFields))
+{-# LINE 1338 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Glean.Type Glean.Schema.GleanTest.Types.KitchenSink_enum_
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "glean.test.KitchenSink_enum_" (Prelude.Just 0))
+{-# LINE 1343 "glean/schema/thrift/glean_test_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.GleanTest.Types.KitchenSink_enum_ =
+     'Angle.TField "e" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "f" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "g" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 1345 "glean/schema/thrift/glean_test_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.GleanTest.Types.KitchenSink_enum_
+         where
+  type AngleEnumTy Glean.Schema.GleanTest.Types.KitchenSink_enum_ =
+       Glean.Schema.GleanTest.Types.KitchenSink_enum_
+  enumName v = Text.pack (Prelude.drop 18 (Prelude.show v))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Graphql/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Graphql/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Graphql/Types.hs
@@ -0,0 +1,7016 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/graphql_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/graphql_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/graphql_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Graphql/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Graphql.Types
+       (pREDICATE_VERSIONS, VariableDef_id,
+        VariableDef(VariableDef, variableDef_id, variableDef_key),
+        Value_id, Value(Value, value_id, value_key), UnionTypeDef_id,
+        UnionTypeDef(UnionTypeDef, unionTypeDef_id, unionTypeDef_key),
+        ScalarTypeDef_id,
+        ScalarTypeDef(ScalarTypeDef, scalarTypeDef_id, scalarTypeDef_key),
+        Operation_id, Operation(Operation, operation_id, operation_key),
+        ObjectTypeDef_id,
+        ObjectTypeDef(ObjectTypeDef, objectTypeDef_id, objectTypeDef_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        InterfaceTypeDef_id,
+        InterfaceTypeDef(InterfaceTypeDef, interfaceTypeDef_id,
+                         interfaceTypeDef_key),
+        InputValueDef_id,
+        InputValueDef(InputValueDef, inputValueDef_id, inputValueDef_key),
+        InputObjectTypeDef_id,
+        InputObjectTypeDef(InputObjectTypeDef, inputObjectTypeDef_id,
+                           inputObjectTypeDef_key),
+        InlineFragment_id,
+        InlineFragment(InlineFragment, inlineFragment_id,
+                       inlineFragment_key),
+        FragmentSpread_id,
+        FragmentSpread(FragmentSpread, fragmentSpread_id,
+                       fragmentSpread_key),
+        Fragment_id, Fragment(Fragment, fragment_id, fragment_key),
+        FieldDef_id, FieldDef(FieldDef, fieldDef_id, fieldDef_key),
+        Field_id, Field(Field, field_id, field_key), EnumTypeDef_id,
+        EnumTypeDef(EnumTypeDef, enumTypeDef_id, enumTypeDef_key),
+        DirectiveDef_id,
+        DirectiveDef(DirectiveDef, directiveDef_id, directiveDef_key),
+        Directive_id, Directive(Directive, directive_id, directive_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationName_id,
+        DeclarationName(DeclarationName, declarationName_id,
+                        declarationName_key, declarationName_value),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        FileDeclarations_id,
+        FileDeclarations(FileDeclarations, fileDeclarations_id,
+                         fileDeclarations_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        DeclHasName_id,
+        DeclHasName(DeclHasName, declHasName_id, declHasName_key),
+        BelongToConfig_id,
+        BelongToConfig(BelongToConfig, belongToConfig_id,
+                       belongToConfig_key),
+        Argument_id, Argument(Argument, argument_id, argument_key),
+        VariableDef_key(VariableDef_key, variableDef_key_name,
+                        variableDef_key_type, variableDef_key_directives,
+                        variableDef_key_defaultValue),
+        UnionTypeDef_key(UnionTypeDef_key, unionTypeDef_key_name,
+                         unionTypeDef_key_types, unionTypeDef_key_directives),
+        SelectionSet(SelectionSet, selectionSet_fields,
+                     selectionSet_inlineFragments, selectionSet_fragmentSpreads),
+        ScalarTypeDef_key(ScalarTypeDef_key, scalarTypeDef_key_name,
+                          scalarTypeDef_key_directives),
+        OperationKind(OperationKind_QUERY, OperationKind_MUTATION,
+                      OperationKind_SUBSCRIPTION, OperationKind__UNKNOWN),
+        Operation_key(Operation_key, operation_key_name,
+                      operation_key_kind, operation_key_directives,
+                      operation_key_variableDefs, operation_key_selectionSet,
+                      operation_key_loc),
+        ObjectTypeDef_key(ObjectTypeDef_key, objectTypeDef_key_name,
+                          objectTypeDef_key_interfaces, objectTypeDef_key_fields,
+                          objectTypeDef_key_directives),
+        Name,
+        NameLowerCase_key(NameLowerCase_key, nameLowerCase_key_lowercase,
+                          nameLowerCase_key_name),
+        InterfaceTypeDef_key(InterfaceTypeDef_key,
+                             interfaceTypeDef_key_name, interfaceTypeDef_key_fields,
+                             interfaceTypeDef_key_directives),
+        InputValueDef_key(InputValueDef_key, inputValueDef_key_name,
+                          inputValueDef_key_type, inputValueDef_key_directives,
+                          inputValueDef_key_defaultValue),
+        InputObjectTypeDef_key(InputObjectTypeDef_key,
+                               inputObjectTypeDef_key_name, inputObjectTypeDef_key_fields,
+                               inputObjectTypeDef_key_directives),
+        InlineFragment_key(InlineFragment_key,
+                           inlineFragment_key_inferredTypeCondition,
+                           inlineFragment_key_directives, inlineFragment_key_selectionSet,
+                           inlineFragment_key_typeCondition),
+        FragmentSpread_key(FragmentSpread_key, fragmentSpread_key_name,
+                           fragmentSpread_key_loc, fragmentSpread_key_arguments,
+                           fragmentSpread_key_directives),
+        Fragment_key(Fragment_key, fragment_key_name,
+                     fragment_key_typeCondition, fragment_key_variableDefs,
+                     fragment_key_directives, fragment_key_selectionSet,
+                     fragment_key_loc),
+        FieldDef_key(FieldDef_key, fieldDef_key_name, fieldDef_key_type,
+                     fieldDef_key_argumentDefs, fieldDef_key_directives),
+        Field_key(Field_key, field_key_type, field_key_name,
+                  field_key_directives, field_key_selectionSet, field_key_arguments,
+                  field_key_alias, field_key_loc),
+        EnumTypeDef_key(EnumTypeDef_key, enumTypeDef_key_name,
+                        enumTypeDef_key_values, enumTypeDef_key_directives),
+        DirectiveDefLocation(DirectiveDefLocation_QUERY,
+                             DirectiveDefLocation_MUTATION, DirectiveDefLocation_SUBSCRIPTION,
+                             DirectiveDefLocation_FIELD,
+                             DirectiveDefLocation_FRAGMENT_DEFINITION,
+                             DirectiveDefLocation_FRAGMENT_SPREAD,
+                             DirectiveDefLocation_INLINE_FRAGMENT, DirectiveDefLocation_SCHEMA,
+                             DirectiveDefLocation_SCALAR, DirectiveDefLocation_OBJECT,
+                             DirectiveDefLocation_FIELD_DEFINITION,
+                             DirectiveDefLocation_ARGUMENT_DEFINITION,
+                             DirectiveDefLocation_INTERFACE, DirectiveDefLocation_UNION,
+                             DirectiveDefLocation_ENUM, DirectiveDefLocation_ENUM_VALUE,
+                             DirectiveDefLocation_INPUT_OBJECT,
+                             DirectiveDefLocation_INPUT_FIELD_DEFINITION,
+                             DirectiveDefLocation__UNKNOWN),
+        DirectiveDef_key(DirectiveDef_key, directiveDef_key_name,
+                         directiveDef_key_argumentDefs, directiveDef_key_locations),
+        Directive_key(Directive_key, directive_key_name,
+                      directive_key_arguments),
+        Declaration(Declaration_EMPTY, Declaration_operation_,
+                    Declaration_fragment_, Declaration_field_, Declaration_enum_,
+                    Declaration_directive_),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_declaration, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationName_value,
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_target, declarationUses_key_file,
+                            declarationUses_key_span),
+        FileDeclarations_key(FileDeclarations_key,
+                             fileDeclarations_key_file, fileDeclarations_key_span,
+                             fileDeclarations_key_declaration),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_decl),
+        XRef(XRef, xRef_decl, xRef_span),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xref),
+        DeclHasName_key(DeclHasName_key, declHasName_key_decl,
+                        declHasName_key_name),
+        BelongToConfig_key(BelongToConfig_key, belongToConfig_key_file,
+                           belongToConfig_key_buildConfig, belongToConfig_key_schema),
+        Argument_key(Argument_key, argument_key_name, argument_key_value))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/graphql_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 219 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Graphql/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("FieldDef", 3), ("SearchByName", 3), ("FileDeclarations", 3),
+       ("Value", 3), ("Directive", 3), ("Field", 3), ("NameLowerCase", 3),
+       ("Operation", 3), ("Argument", 3), ("InterfaceTypeDef", 3),
+       ("DeclHasName", 3), ("InputValueDef", 3), ("BelongToConfig", 3),
+       ("FileXRefs", 3), ("FragmentSpread", 3), ("UnionTypeDef", 3),
+       ("InputObjectTypeDef", 3), ("VariableDef", 3),
+       ("InlineFragment", 3), ("DeclarationUses", 3), ("EnumTypeDef", 3),
+       ("ObjectTypeDef", 3), ("Fragment", 3), ("ScalarTypeDef", 3),
+       ("DeclarationName", 3), ("DirectiveDef", 3),
+       ("DeclarationLocation", 3)]
+
+type VariableDef_id = Glean.Id
+
+data VariableDef = VariableDef{variableDef_id ::
+                               {-# UNPACK #-} !VariableDef_id,
+                               variableDef_key :: Prelude.Maybe VariableDef_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDef where
+  toJSON (VariableDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDef where
+  buildStruct _proxy (VariableDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDef where
+  rnf (VariableDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDef where
+  def = VariableDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDef where
+  hashWithSalt __salt (VariableDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Value_id = Glean.Id
+
+data Value = Value{value_id :: {-# UNPACK #-} !Value_id,
+                   value_key :: Prelude.Maybe Text.Text}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Value where
+  toJSON (Value __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Value where
+  buildStruct _proxy (Value __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Value __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Value where
+  rnf (Value __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Value where
+  def = Value Default.def Prelude.Nothing
+
+instance Hashable.Hashable Value where
+  hashWithSalt __salt (Value _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UnionTypeDef_id = Glean.Id
+
+data UnionTypeDef = UnionTypeDef{unionTypeDef_id ::
+                                 {-# UNPACK #-} !UnionTypeDef_id,
+                                 unionTypeDef_key :: Prelude.Maybe UnionTypeDef_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionTypeDef where
+  toJSON (UnionTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionTypeDef where
+  buildStruct _proxy (UnionTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnionTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionTypeDef where
+  rnf (UnionTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnionTypeDef where
+  def = UnionTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnionTypeDef where
+  hashWithSalt __salt (UnionTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ScalarTypeDef_id = Glean.Id
+
+data ScalarTypeDef = ScalarTypeDef{scalarTypeDef_id ::
+                                   {-# UNPACK #-} !ScalarTypeDef_id,
+                                   scalarTypeDef_key :: Prelude.Maybe ScalarTypeDef_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScalarTypeDef where
+  toJSON (ScalarTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ScalarTypeDef where
+  buildStruct _proxy (ScalarTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ScalarTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScalarTypeDef where
+  rnf (ScalarTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ScalarTypeDef where
+  def = ScalarTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable ScalarTypeDef where
+  hashWithSalt __salt (ScalarTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Operation_id = Glean.Id
+
+data Operation = Operation{operation_id ::
+                           {-# UNPACK #-} !Operation_id,
+                           operation_key :: Prelude.Maybe Operation_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Operation where
+  toJSON (Operation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Operation where
+  buildStruct _proxy (Operation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Operation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Operation where
+  rnf (Operation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Operation where
+  def = Operation Default.def Prelude.Nothing
+
+instance Hashable.Hashable Operation where
+  hashWithSalt __salt (Operation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjectTypeDef_id = Glean.Id
+
+data ObjectTypeDef = ObjectTypeDef{objectTypeDef_id ::
+                                   {-# UNPACK #-} !ObjectTypeDef_id,
+                                   objectTypeDef_key :: Prelude.Maybe ObjectTypeDef_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectTypeDef where
+  toJSON (ObjectTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectTypeDef where
+  buildStruct _proxy (ObjectTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjectTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectTypeDef where
+  rnf (ObjectTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjectTypeDef where
+  def = ObjectTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjectTypeDef where
+  hashWithSalt __salt (ObjectTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InterfaceTypeDef_id = Glean.Id
+
+data InterfaceTypeDef = InterfaceTypeDef{interfaceTypeDef_id ::
+                                         {-# UNPACK #-} !InterfaceTypeDef_id,
+                                         interfaceTypeDef_key :: Prelude.Maybe InterfaceTypeDef_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceTypeDef where
+  toJSON (InterfaceTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceTypeDef where
+  buildStruct _proxy (InterfaceTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InterfaceTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceTypeDef where
+  rnf (InterfaceTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InterfaceTypeDef where
+  def = InterfaceTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable InterfaceTypeDef where
+  hashWithSalt __salt (InterfaceTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InputValueDef_id = Glean.Id
+
+data InputValueDef = InputValueDef{inputValueDef_id ::
+                                   {-# UNPACK #-} !InputValueDef_id,
+                                   inputValueDef_key :: Prelude.Maybe InputValueDef_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InputValueDef where
+  toJSON (InputValueDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InputValueDef where
+  buildStruct _proxy (InputValueDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InputValueDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InputValueDef where
+  rnf (InputValueDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InputValueDef where
+  def = InputValueDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable InputValueDef where
+  hashWithSalt __salt (InputValueDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InputObjectTypeDef_id = Glean.Id
+
+data InputObjectTypeDef = InputObjectTypeDef{inputObjectTypeDef_id
+                                             :: {-# UNPACK #-} !InputObjectTypeDef_id,
+                                             inputObjectTypeDef_key ::
+                                             Prelude.Maybe InputObjectTypeDef_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InputObjectTypeDef where
+  toJSON (InputObjectTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InputObjectTypeDef where
+  buildStruct _proxy (InputObjectTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InputObjectTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InputObjectTypeDef where
+  rnf (InputObjectTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InputObjectTypeDef where
+  def = InputObjectTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable InputObjectTypeDef where
+  hashWithSalt __salt (InputObjectTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InlineFragment_id = Glean.Id
+
+data InlineFragment = InlineFragment{inlineFragment_id ::
+                                     {-# UNPACK #-} !InlineFragment_id,
+                                     inlineFragment_key :: Prelude.Maybe InlineFragment_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InlineFragment where
+  toJSON (InlineFragment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InlineFragment where
+  buildStruct _proxy (InlineFragment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InlineFragment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InlineFragment where
+  rnf (InlineFragment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InlineFragment where
+  def = InlineFragment Default.def Prelude.Nothing
+
+instance Hashable.Hashable InlineFragment where
+  hashWithSalt __salt (InlineFragment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FragmentSpread_id = Glean.Id
+
+data FragmentSpread = FragmentSpread{fragmentSpread_id ::
+                                     {-# UNPACK #-} !FragmentSpread_id,
+                                     fragmentSpread_key :: Prelude.Maybe FragmentSpread_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FragmentSpread where
+  toJSON (FragmentSpread __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FragmentSpread where
+  buildStruct _proxy (FragmentSpread __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FragmentSpread __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FragmentSpread where
+  rnf (FragmentSpread __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FragmentSpread where
+  def = FragmentSpread Default.def Prelude.Nothing
+
+instance Hashable.Hashable FragmentSpread where
+  hashWithSalt __salt (FragmentSpread _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Fragment_id = Glean.Id
+
+data Fragment = Fragment{fragment_id ::
+                         {-# UNPACK #-} !Fragment_id,
+                         fragment_key :: Prelude.Maybe Fragment_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Fragment where
+  toJSON (Fragment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Fragment where
+  buildStruct _proxy (Fragment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Fragment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Fragment where
+  rnf (Fragment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Fragment where
+  def = Fragment Default.def Prelude.Nothing
+
+instance Hashable.Hashable Fragment where
+  hashWithSalt __salt (Fragment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FieldDef_id = Glean.Id
+
+data FieldDef = FieldDef{fieldDef_id ::
+                         {-# UNPACK #-} !FieldDef_id,
+                         fieldDef_key :: Prelude.Maybe FieldDef_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDef where
+  toJSON (FieldDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDef where
+  buildStruct _proxy (FieldDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FieldDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDef where
+  rnf (FieldDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FieldDef where
+  def = FieldDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FieldDef where
+  hashWithSalt __salt (FieldDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Field_id = Glean.Id
+
+data Field = Field{field_id :: {-# UNPACK #-} !Field_id,
+                   field_key :: Prelude.Maybe Field_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field where
+  toJSON (Field __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Field where
+  buildStruct _proxy (Field __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Field __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Field where
+  rnf (Field __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Field where
+  def = Field Default.def Prelude.Nothing
+
+instance Hashable.Hashable Field where
+  hashWithSalt __salt (Field _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumTypeDef_id = Glean.Id
+
+data EnumTypeDef = EnumTypeDef{enumTypeDef_id ::
+                               {-# UNPACK #-} !EnumTypeDef_id,
+                               enumTypeDef_key :: Prelude.Maybe EnumTypeDef_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumTypeDef where
+  toJSON (EnumTypeDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumTypeDef where
+  buildStruct _proxy (EnumTypeDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumTypeDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumTypeDef where
+  rnf (EnumTypeDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumTypeDef where
+  def = EnumTypeDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumTypeDef where
+  hashWithSalt __salt (EnumTypeDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DirectiveDef_id = Glean.Id
+
+data DirectiveDef = DirectiveDef{directiveDef_id ::
+                                 {-# UNPACK #-} !DirectiveDef_id,
+                                 directiveDef_key :: Prelude.Maybe DirectiveDef_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectiveDef where
+  toJSON (DirectiveDef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DirectiveDef where
+  buildStruct _proxy (DirectiveDef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DirectiveDef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DirectiveDef where
+  rnf (DirectiveDef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DirectiveDef where
+  def = DirectiveDef Default.def Prelude.Nothing
+
+instance Hashable.Hashable DirectiveDef where
+  hashWithSalt __salt (DirectiveDef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Directive_id = Glean.Id
+
+data Directive = Directive{directive_id ::
+                           {-# UNPACK #-} !Directive_id,
+                           directive_key :: Prelude.Maybe Directive_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Directive where
+  toJSON (Directive __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Directive where
+  buildStruct _proxy (Directive __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Directive __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Directive where
+  rnf (Directive __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Directive where
+  def = Directive Default.def Prelude.Nothing
+
+instance Hashable.Hashable Directive where
+  hashWithSalt __salt (Directive _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationName_id = Glean.Id
+
+data DeclarationName = DeclarationName{declarationName_id ::
+                                       {-# UNPACK #-} !DeclarationName_id,
+                                       declarationName_key :: Prelude.Maybe Declaration,
+                                       declarationName_value :: Prelude.Maybe DeclarationName_value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName where
+  toJSON (DeclarationName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationName where
+  buildStruct _proxy
+    (DeclarationName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DeclarationName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName where
+  rnf (DeclarationName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DeclarationName where
+  def = DeclarationName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DeclarationName where
+  hashWithSalt __salt (DeclarationName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclarations_id = Glean.Id
+
+data FileDeclarations = FileDeclarations{fileDeclarations_id ::
+                                         {-# UNPACK #-} !FileDeclarations_id,
+                                         fileDeclarations_key :: Prelude.Maybe FileDeclarations_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations where
+  toJSON (FileDeclarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations where
+  buildStruct _proxy (FileDeclarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations where
+  rnf (FileDeclarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclarations where
+  def = FileDeclarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclarations where
+  hashWithSalt __salt (FileDeclarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclHasName_id = Glean.Id
+
+data DeclHasName = DeclHasName{declHasName_id ::
+                               {-# UNPACK #-} !DeclHasName_id,
+                               declHasName_key :: Prelude.Maybe DeclHasName_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclHasName where
+  toJSON (DeclHasName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclHasName where
+  buildStruct _proxy (DeclHasName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclHasName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclHasName where
+  rnf (DeclHasName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclHasName where
+  def = DeclHasName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclHasName where
+  hashWithSalt __salt (DeclHasName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BelongToConfig_id = Glean.Id
+
+data BelongToConfig = BelongToConfig{belongToConfig_id ::
+                                     {-# UNPACK #-} !BelongToConfig_id,
+                                     belongToConfig_key :: Prelude.Maybe BelongToConfig_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BelongToConfig where
+  toJSON (BelongToConfig __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BelongToConfig where
+  buildStruct _proxy (BelongToConfig __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BelongToConfig __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BelongToConfig where
+  rnf (BelongToConfig __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BelongToConfig where
+  def = BelongToConfig Default.def Prelude.Nothing
+
+instance Hashable.Hashable BelongToConfig where
+  hashWithSalt __salt (BelongToConfig _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Argument_id = Glean.Id
+
+data Argument = Argument{argument_id ::
+                         {-# UNPACK #-} !Argument_id,
+                         argument_key :: Prelude.Maybe Argument_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Argument where
+  toJSON (Argument __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Argument where
+  buildStruct _proxy (Argument __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Argument __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Argument where
+  rnf (Argument __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Argument where
+  def = Argument Default.def Prelude.Nothing
+
+instance Hashable.Hashable Argument where
+  hashWithSalt __salt (Argument _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data VariableDef_key = VariableDef_key{variableDef_key_name ::
+                                       Value,
+                                       variableDef_key_type :: Value,
+                                       variableDef_key_directives :: [Directive],
+                                       variableDef_key_defaultValue :: Prelude.Maybe Value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDef_key where
+  toJSON
+    (VariableDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "directives" .= __field__directives :
+               Prelude.maybe Prelude.id ((:) . ("defaultValue" .=))
+                 __field__defaultValue
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDef_key where
+  buildStruct _proxy
+    (VariableDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               :
+               case __field__defaultValue of
+                 Prelude.Just _val -> Thrift.genField _proxy "defaultValue"
+                                        (Thrift.getStructType _proxy)
+                                        4
+                                        3
+                                        (Thrift.buildStruct _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__defaultValue <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__defaultValue
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__defaultValue <- ST.readSTRef
+                                                                       __field__defaultValue
+                                             Prelude.pure
+                                               (VariableDef_key __val__name __val__type
+                                                  __val__directives
+                                                  __val__defaultValue)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("directives", 3), ("defaultValue", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDef_key where
+  rnf
+    (VariableDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq`
+            DeepSeq.rnf __field__defaultValue `Prelude.seq` ()
+
+instance Default.Default VariableDef_key where
+  def
+    = VariableDef_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable VariableDef_key where
+  hashWithSalt __salt
+    (VariableDef_key _name _type _directives _defaultValue)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+           _directives)
+        _defaultValue
+
+data UnionTypeDef_key = UnionTypeDef_key{unionTypeDef_key_name ::
+                                         Value,
+                                         unionTypeDef_key_types :: [Value],
+                                         unionTypeDef_key_directives :: [Directive]}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionTypeDef_key where
+  toJSON
+    (UnionTypeDef_key __field__name __field__types __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "types" .= __field__types :
+             "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionTypeDef_key where
+  buildStruct _proxy
+    (UnionTypeDef_key __field__name __field__types __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "types" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__types)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__types <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__types
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__types <- ST.readSTRef __field__types
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (UnionTypeDef_key __val__name __val__types
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList [("name", 1), ("types", 2), ("directives", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionTypeDef_key where
+  rnf
+    (UnionTypeDef_key __field__name __field__types __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__types `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default UnionTypeDef_key where
+  def = UnionTypeDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable UnionTypeDef_key where
+  hashWithSalt __salt (UnionTypeDef_key _name _types _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _types)
+        _directives
+
+data SelectionSet = SelectionSet{selectionSet_fields :: [Field],
+                                 selectionSet_inlineFragments :: [InlineFragment],
+                                 selectionSet_fragmentSpreads :: [FragmentSpread]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SelectionSet where
+  toJSON
+    (SelectionSet __field__fields __field__inlineFragments
+       __field__fragmentSpreads)
+    = Aeson.object
+        ("fields" .= __field__fields :
+           "inlineFragments" .= __field__inlineFragments :
+             "fragmentSpreads" .= __field__fragmentSpreads : Prelude.mempty)
+
+instance Thrift.ThriftStruct SelectionSet where
+  buildStruct _proxy
+    (SelectionSet __field__fields __field__inlineFragments
+       __field__fragmentSpreads)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__fields)
+           :
+           Thrift.genField _proxy "inlineFragments"
+             (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__inlineFragments)
+             :
+             Thrift.genField _proxy "fragmentSpreads"
+               (Thrift.getListType _proxy)
+               3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__fragmentSpreads)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fields <- ST.newSTRef Default.def
+            __field__inlineFragments <- ST.newSTRef Default.def
+            __field__fragmentSpreads <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__inlineFragments
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fragmentSpreads
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fields <- ST.readSTRef
+                                                                 __field__fields
+                                             !__val__inlineFragments <- ST.readSTRef
+                                                                          __field__inlineFragments
+                                             !__val__fragmentSpreads <- ST.readSTRef
+                                                                          __field__fragmentSpreads
+                                             Prelude.pure
+                                               (SelectionSet __val__fields __val__inlineFragments
+                                                  __val__fragmentSpreads)
+              _idMap
+                = HashMap.fromList
+                    [("fields", 1), ("inlineFragments", 2), ("fragmentSpreads", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SelectionSet where
+  rnf
+    (SelectionSet __field__fields __field__inlineFragments
+       __field__fragmentSpreads)
+    = DeepSeq.rnf __field__fields `Prelude.seq`
+        DeepSeq.rnf __field__inlineFragments `Prelude.seq`
+          DeepSeq.rnf __field__fragmentSpreads `Prelude.seq` ()
+
+instance Default.Default SelectionSet where
+  def = SelectionSet Default.def Default.def Default.def
+
+instance Hashable.Hashable SelectionSet where
+  hashWithSalt __salt
+    (SelectionSet _fields _inlineFragments _fragmentSpreads)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fields)
+           _inlineFragments)
+        _fragmentSpreads
+
+data ScalarTypeDef_key = ScalarTypeDef_key{scalarTypeDef_key_name
+                                           :: Value,
+                                           scalarTypeDef_key_directives :: [Directive]}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScalarTypeDef_key where
+  toJSON (ScalarTypeDef_key __field__name __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct ScalarTypeDef_key where
+  buildStruct _proxy
+    (ScalarTypeDef_key __field__name __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__directives)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (ScalarTypeDef_key __val__name __val__directives)
+              _idMap = HashMap.fromList [("name", 1), ("directives", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ScalarTypeDef_key where
+  rnf (ScalarTypeDef_key __field__name __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default ScalarTypeDef_key where
+  def = ScalarTypeDef_key Default.def Default.def
+
+instance Hashable.Hashable ScalarTypeDef_key where
+  hashWithSalt __salt (ScalarTypeDef_key _name _directives)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _directives
+
+data OperationKind = OperationKind_QUERY
+                   | OperationKind_MUTATION
+                   | OperationKind_SUBSCRIPTION
+                   | OperationKind__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OperationKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData OperationKind where
+  rnf __OperationKind = Prelude.seq __OperationKind ()
+
+instance Default.Default OperationKind where
+  def = OperationKind_QUERY
+
+instance Hashable.Hashable OperationKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum OperationKind where
+  toThriftEnum 0 = OperationKind_QUERY
+  toThriftEnum 1 = OperationKind_MUTATION
+  toThriftEnum 2 = OperationKind_SUBSCRIPTION
+  toThriftEnum val = OperationKind__UNKNOWN val
+  fromThriftEnum OperationKind_QUERY = 0
+  fromThriftEnum OperationKind_MUTATION = 1
+  fromThriftEnum OperationKind_SUBSCRIPTION = 2
+  fromThriftEnum (OperationKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [OperationKind_QUERY, OperationKind_MUTATION,
+       OperationKind_SUBSCRIPTION]
+  toThriftEnumEither 0 = Prelude.Right OperationKind_QUERY
+  toThriftEnumEither 1 = Prelude.Right OperationKind_MUTATION
+  toThriftEnumEither 2 = Prelude.Right OperationKind_SUBSCRIPTION
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum OperationKind: "
+           ++ Prelude.show val)
+
+data Operation_key = Operation_key{operation_key_name :: Value,
+                                   operation_key_kind :: OperationKind,
+                                   operation_key_directives :: [Directive],
+                                   operation_key_variableDefs :: [VariableDef],
+                                   operation_key_selectionSet :: SelectionSet,
+                                   operation_key_loc :: Glean.Schema.Src.FileLocation}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Operation_key where
+  toJSON
+    (Operation_key __field__name __field__kind __field__directives
+       __field__variableDefs __field__selectionSet __field__loc)
+    = Aeson.object
+        ("name" .= __field__name :
+           "kind" .= __field__kind :
+             "directives" .= __field__directives :
+               "variableDefs" .= __field__variableDefs :
+                 "selectionSet" .= __field__selectionSet :
+                   "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct Operation_key where
+  buildStruct _proxy
+    (Operation_key __field__name __field__kind __field__directives
+       __field__variableDefs __field__selectionSet __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               :
+               Thrift.genField _proxy "variableDefs" (Thrift.getListType _proxy) 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__variableDefs)
+                 :
+                 Thrift.genField _proxy "selectionSet" (Thrift.getStructType _proxy)
+                   5
+                   4
+                   (Thrift.buildStruct _proxy __field__selectionSet)
+                   :
+                   Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 6 5
+                     (Thrift.buildStruct _proxy __field__loc)
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__variableDefs <- ST.newSTRef Default.def
+            __field__selectionSet <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "OperationKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__variableDefs
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__selectionSet
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__variableDefs <- ST.readSTRef
+                                                                       __field__variableDefs
+                                             !__val__selectionSet <- ST.readSTRef
+                                                                       __field__selectionSet
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (Operation_key __val__name __val__kind
+                                                  __val__directives
+                                                  __val__variableDefs
+                                                  __val__selectionSet
+                                                  __val__loc)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("kind", 2), ("directives", 3), ("variableDefs", 4),
+                     ("selectionSet", 5), ("loc", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData Operation_key where
+  rnf
+    (Operation_key __field__name __field__kind __field__directives
+       __field__variableDefs __field__selectionSet __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq`
+            DeepSeq.rnf __field__variableDefs `Prelude.seq`
+              DeepSeq.rnf __field__selectionSet `Prelude.seq`
+                DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default Operation_key where
+  def
+    = Operation_key Default.def Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable Operation_key where
+  hashWithSalt __salt
+    (Operation_key _name _kind _directives _variableDefs _selectionSet
+       _loc)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind)
+                 _directives)
+              _variableDefs)
+           _selectionSet)
+        _loc
+
+data ObjectTypeDef_key = ObjectTypeDef_key{objectTypeDef_key_name
+                                           :: Value,
+                                           objectTypeDef_key_interfaces :: [Value],
+                                           objectTypeDef_key_fields :: [FieldDef],
+                                           objectTypeDef_key_directives :: [Directive]}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectTypeDef_key where
+  toJSON
+    (ObjectTypeDef_key __field__name __field__interfaces
+       __field__fields __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "interfaces" .= __field__interfaces :
+             "fields" .= __field__fields :
+               "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectTypeDef_key where
+  buildStruct _proxy
+    (ObjectTypeDef_key __field__name __field__interfaces
+       __field__fields __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "interfaces" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__interfaces)
+             :
+             Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__fields)
+               :
+               Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__directives)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__interfaces <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__interfaces
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__interfaces <- ST.readSTRef __field__interfaces
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (ObjectTypeDef_key __val__name __val__interfaces
+                                                  __val__fields
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("interfaces", 2), ("fields", 3), ("directives", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectTypeDef_key where
+  rnf
+    (ObjectTypeDef_key __field__name __field__interfaces
+       __field__fields __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__interfaces `Prelude.seq`
+          DeepSeq.rnf __field__fields `Prelude.seq`
+            DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default ObjectTypeDef_key where
+  def
+    = ObjectTypeDef_key Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable ObjectTypeDef_key where
+  hashWithSalt __salt
+    (ObjectTypeDef_key _name _interfaces _fields _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _interfaces)
+           _fields)
+        _directives
+
+type Name = Value
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_lowercase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__lowercase __field__name)
+    = Aeson.object
+        ("lowercase" .= __field__lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__lowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lowercase" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lowercase <- ST.readSTRef
+                                                                    __field__lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__lowercase __val__name)
+              _idMap = HashMap.fromList [("lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__lowercase __field__name)
+    = DeepSeq.rnf __field__lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _lowercase _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lowercase)
+        _name
+
+data InterfaceTypeDef_key = InterfaceTypeDef_key{interfaceTypeDef_key_name
+                                                 :: Value,
+                                                 interfaceTypeDef_key_fields :: [FieldDef],
+                                                 interfaceTypeDef_key_directives :: [Directive]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceTypeDef_key where
+  toJSON
+    (InterfaceTypeDef_key __field__name __field__fields
+       __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "fields" .= __field__fields :
+             "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceTypeDef_key where
+  buildStruct _proxy
+    (InterfaceTypeDef_key __field__name __field__fields
+       __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__fields)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (InterfaceTypeDef_key __val__name __val__fields
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList [("name", 1), ("fields", 2), ("directives", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceTypeDef_key where
+  rnf
+    (InterfaceTypeDef_key __field__name __field__fields
+       __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__fields `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default InterfaceTypeDef_key where
+  def = InterfaceTypeDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable InterfaceTypeDef_key where
+  hashWithSalt __salt
+    (InterfaceTypeDef_key _name _fields _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _fields)
+        _directives
+
+data InputValueDef_key = InputValueDef_key{inputValueDef_key_name
+                                           :: Value,
+                                           inputValueDef_key_type :: Value,
+                                           inputValueDef_key_directives :: [Directive],
+                                           inputValueDef_key_defaultValue :: Prelude.Maybe Value}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InputValueDef_key where
+  toJSON
+    (InputValueDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "directives" .= __field__directives :
+               Prelude.maybe Prelude.id ((:) . ("defaultValue" .=))
+                 __field__defaultValue
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct InputValueDef_key where
+  buildStruct _proxy
+    (InputValueDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               :
+               case __field__defaultValue of
+                 Prelude.Just _val -> Thrift.genField _proxy "defaultValue"
+                                        (Thrift.getStructType _proxy)
+                                        4
+                                        3
+                                        (Thrift.buildStruct _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__defaultValue <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__defaultValue
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__defaultValue <- ST.readSTRef
+                                                                       __field__defaultValue
+                                             Prelude.pure
+                                               (InputValueDef_key __val__name __val__type
+                                                  __val__directives
+                                                  __val__defaultValue)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("directives", 3), ("defaultValue", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData InputValueDef_key where
+  rnf
+    (InputValueDef_key __field__name __field__type __field__directives
+       __field__defaultValue)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq`
+            DeepSeq.rnf __field__defaultValue `Prelude.seq` ()
+
+instance Default.Default InputValueDef_key where
+  def
+    = InputValueDef_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable InputValueDef_key where
+  hashWithSalt __salt
+    (InputValueDef_key _name _type _directives _defaultValue)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+           _directives)
+        _defaultValue
+
+data InputObjectTypeDef_key = InputObjectTypeDef_key{inputObjectTypeDef_key_name
+                                                     :: Value,
+                                                     inputObjectTypeDef_key_fields ::
+                                                     [InputValueDef],
+                                                     inputObjectTypeDef_key_directives ::
+                                                     [Directive]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InputObjectTypeDef_key where
+  toJSON
+    (InputObjectTypeDef_key __field__name __field__fields
+       __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "fields" .= __field__fields :
+             "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct InputObjectTypeDef_key where
+  buildStruct _proxy
+    (InputObjectTypeDef_key __field__name __field__fields
+       __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__fields)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (InputObjectTypeDef_key __val__name __val__fields
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList [("name", 1), ("fields", 2), ("directives", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData InputObjectTypeDef_key where
+  rnf
+    (InputObjectTypeDef_key __field__name __field__fields
+       __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__fields `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default InputObjectTypeDef_key where
+  def = InputObjectTypeDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable InputObjectTypeDef_key where
+  hashWithSalt __salt
+    (InputObjectTypeDef_key _name _fields _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _fields)
+        _directives
+
+data InlineFragment_key = InlineFragment_key{inlineFragment_key_inferredTypeCondition
+                                             :: Value,
+                                             inlineFragment_key_directives :: [Directive],
+                                             inlineFragment_key_selectionSet :: SelectionSet,
+                                             inlineFragment_key_typeCondition ::
+                                             Prelude.Maybe Value}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InlineFragment_key where
+  toJSON
+    (InlineFragment_key __field__inferredTypeCondition
+       __field__directives __field__selectionSet __field__typeCondition)
+    = Aeson.object
+        ("inferredTypeCondition" .= __field__inferredTypeCondition :
+           "directives" .= __field__directives :
+             "selectionSet" .= __field__selectionSet :
+               Prelude.maybe Prelude.id ((:) . ("typeCondition" .=))
+                 __field__typeCondition
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct InlineFragment_key where
+  buildStruct _proxy
+    (InlineFragment_key __field__inferredTypeCondition
+       __field__directives __field__selectionSet __field__typeCondition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "inferredTypeCondition"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__inferredTypeCondition)
+           :
+           Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__directives)
+             :
+             Thrift.genField _proxy "selectionSet" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__selectionSet)
+               :
+               case __field__typeCondition of
+                 Prelude.Just _val -> Thrift.genField _proxy "typeCondition"
+                                        (Thrift.getStructType _proxy)
+                                        4
+                                        3
+                                        (Thrift.buildStruct _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__inferredTypeCondition <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__selectionSet <- ST.newSTRef Default.def
+            __field__typeCondition <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__inferredTypeCondition
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__selectionSet
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeCondition
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__inferredTypeCondition <- ST.readSTRef
+                                                                                __field__inferredTypeCondition
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__selectionSet <- ST.readSTRef
+                                                                       __field__selectionSet
+                                             !__val__typeCondition <- ST.readSTRef
+                                                                        __field__typeCondition
+                                             Prelude.pure
+                                               (InlineFragment_key __val__inferredTypeCondition
+                                                  __val__directives
+                                                  __val__selectionSet
+                                                  __val__typeCondition)
+              _idMap
+                = HashMap.fromList
+                    [("inferredTypeCondition", 1), ("directives", 2),
+                     ("selectionSet", 3), ("typeCondition", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData InlineFragment_key where
+  rnf
+    (InlineFragment_key __field__inferredTypeCondition
+       __field__directives __field__selectionSet __field__typeCondition)
+    = DeepSeq.rnf __field__inferredTypeCondition `Prelude.seq`
+        DeepSeq.rnf __field__directives `Prelude.seq`
+          DeepSeq.rnf __field__selectionSet `Prelude.seq`
+            DeepSeq.rnf __field__typeCondition `Prelude.seq` ()
+
+instance Default.Default InlineFragment_key where
+  def
+    = InlineFragment_key Default.def Default.def Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable InlineFragment_key where
+  hashWithSalt __salt
+    (InlineFragment_key _inferredTypeCondition _directives
+       _selectionSet _typeCondition)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt __salt _inferredTypeCondition)
+              _directives)
+           _selectionSet)
+        _typeCondition
+
+data FragmentSpread_key = FragmentSpread_key{fragmentSpread_key_name
+                                             :: Value,
+                                             fragmentSpread_key_loc ::
+                                             Glean.Schema.Src.FileLocation,
+                                             fragmentSpread_key_arguments :: [Argument],
+                                             fragmentSpread_key_directives :: [Directive]}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FragmentSpread_key where
+  toJSON
+    (FragmentSpread_key __field__name __field__loc __field__arguments
+       __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "loc" .= __field__loc :
+             "arguments" .= __field__arguments :
+               "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct FragmentSpread_key where
+  buildStruct _proxy
+    (FragmentSpread_key __field__name __field__loc __field__arguments
+       __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             :
+             Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__arguments)
+               :
+               Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__directives)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (FragmentSpread_key __val__name __val__loc
+                                                  __val__arguments
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("loc", 2), ("arguments", 3), ("directives", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FragmentSpread_key where
+  rnf
+    (FragmentSpread_key __field__name __field__loc __field__arguments
+       __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq`
+          DeepSeq.rnf __field__arguments `Prelude.seq`
+            DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default FragmentSpread_key where
+  def
+    = FragmentSpread_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FragmentSpread_key where
+  hashWithSalt __salt
+    (FragmentSpread_key _name _loc _arguments _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc)
+           _arguments)
+        _directives
+
+data Fragment_key = Fragment_key{fragment_key_name :: Value,
+                                 fragment_key_typeCondition :: Value,
+                                 fragment_key_variableDefs :: [VariableDef],
+                                 fragment_key_directives :: [Directive],
+                                 fragment_key_selectionSet :: SelectionSet,
+                                 fragment_key_loc :: Glean.Schema.Src.FileLocation}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Fragment_key where
+  toJSON
+    (Fragment_key __field__name __field__typeCondition
+       __field__variableDefs __field__directives __field__selectionSet
+       __field__loc)
+    = Aeson.object
+        ("name" .= __field__name :
+           "typeCondition" .= __field__typeCondition :
+             "variableDefs" .= __field__variableDefs :
+               "directives" .= __field__directives :
+                 "selectionSet" .= __field__selectionSet :
+                   "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct Fragment_key where
+  buildStruct _proxy
+    (Fragment_key __field__name __field__typeCondition
+       __field__variableDefs __field__directives __field__selectionSet
+       __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "typeCondition"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__typeCondition)
+             :
+             Thrift.genField _proxy "variableDefs" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__variableDefs)
+               :
+               Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__directives)
+                 :
+                 Thrift.genField _proxy "selectionSet" (Thrift.getStructType _proxy)
+                   5
+                   4
+                   (Thrift.buildStruct _proxy __field__selectionSet)
+                   :
+                   Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 6 5
+                     (Thrift.buildStruct _proxy __field__loc)
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__typeCondition <- ST.newSTRef Default.def
+            __field__variableDefs <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__selectionSet <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeCondition
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__variableDefs
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__selectionSet
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__typeCondition <- ST.readSTRef
+                                                                        __field__typeCondition
+                                             !__val__variableDefs <- ST.readSTRef
+                                                                       __field__variableDefs
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__selectionSet <- ST.readSTRef
+                                                                       __field__selectionSet
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (Fragment_key __val__name __val__typeCondition
+                                                  __val__variableDefs
+                                                  __val__directives
+                                                  __val__selectionSet
+                                                  __val__loc)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("typeCondition", 2), ("variableDefs", 3),
+                     ("directives", 4), ("selectionSet", 5), ("loc", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData Fragment_key where
+  rnf
+    (Fragment_key __field__name __field__typeCondition
+       __field__variableDefs __field__directives __field__selectionSet
+       __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__typeCondition `Prelude.seq`
+          DeepSeq.rnf __field__variableDefs `Prelude.seq`
+            DeepSeq.rnf __field__directives `Prelude.seq`
+              DeepSeq.rnf __field__selectionSet `Prelude.seq`
+                DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default Fragment_key where
+  def
+    = Fragment_key Default.def Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable Fragment_key where
+  hashWithSalt __salt
+    (Fragment_key _name _typeCondition _variableDefs _directives
+       _selectionSet _loc)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                    _typeCondition)
+                 _variableDefs)
+              _directives)
+           _selectionSet)
+        _loc
+
+data FieldDef_key = FieldDef_key{fieldDef_key_name :: Value,
+                                 fieldDef_key_type :: Value,
+                                 fieldDef_key_argumentDefs :: [InputValueDef],
+                                 fieldDef_key_directives :: [Directive]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDef_key where
+  toJSON
+    (FieldDef_key __field__name __field__type __field__argumentDefs
+       __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "argumentDefs" .= __field__argumentDefs :
+               "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDef_key where
+  buildStruct _proxy
+    (FieldDef_key __field__name __field__type __field__argumentDefs
+       __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "argumentDefs" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__argumentDefs)
+               :
+               Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__directives)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__argumentDefs <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__argumentDefs
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__argumentDefs <- ST.readSTRef
+                                                                       __field__argumentDefs
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (FieldDef_key __val__name __val__type
+                                                  __val__argumentDefs
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("argumentDefs", 3), ("directives", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDef_key where
+  rnf
+    (FieldDef_key __field__name __field__type __field__argumentDefs
+       __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__argumentDefs `Prelude.seq`
+            DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default FieldDef_key where
+  def = FieldDef_key Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable FieldDef_key where
+  hashWithSalt __salt
+    (FieldDef_key _name _type _argumentDefs _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+           _argumentDefs)
+        _directives
+
+data Field_key = Field_key{field_key_type :: Value,
+                           field_key_name :: Value, field_key_directives :: [Directive],
+                           field_key_selectionSet :: SelectionSet,
+                           field_key_arguments :: [Argument],
+                           field_key_alias :: Prelude.Maybe Value,
+                           field_key_loc :: Glean.Schema.Src.FileLocation}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field_key where
+  toJSON
+    (Field_key __field__type __field__name __field__directives
+       __field__selectionSet __field__arguments __field__alias
+       __field__loc)
+    = Aeson.object
+        ("type" .= __field__type :
+           "name" .= __field__name :
+             "directives" .= __field__directives :
+               "selectionSet" .= __field__selectionSet :
+                 "arguments" .= __field__arguments :
+                   Prelude.maybe Prelude.id ((:) . ("alias" .=)) __field__alias
+                     ("loc" .= __field__loc : Prelude.mempty))
+
+instance Thrift.ThriftStruct Field_key where
+  buildStruct _proxy
+    (Field_key __field__type __field__name __field__directives
+       __field__selectionSet __field__arguments __field__alias
+       __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               :
+               Thrift.genField _proxy "selectionSet" (Thrift.getStructType _proxy)
+                 4
+                 3
+                 (Thrift.buildStruct _proxy __field__selectionSet)
+                 :
+                 Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__arguments)
+                   :
+                   let (__cereal__alias, __id__alias)
+                         = case __field__alias of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genField _proxy "alias"
+                                                        (Thrift.getStructType _proxy)
+                                                        6
+                                                        5
+                                                        (Thrift.buildStruct _proxy _val)),
+                                                   6)
+                             Prelude.Nothing -> (Prelude.id, 5)
+                     in
+                     __cereal__alias
+                       (Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 7
+                          __id__alias
+                          (Thrift.buildStruct _proxy __field__loc)
+                          : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            __field__selectionSet <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            __field__alias <- ST.newSTRef Prelude.Nothing
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__selectionSet
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__alias
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             !__val__selectionSet <- ST.readSTRef
+                                                                       __field__selectionSet
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             !__val__alias <- ST.readSTRef __field__alias
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (Field_key __val__type __val__name __val__directives
+                                                  __val__selectionSet
+                                                  __val__arguments
+                                                  __val__alias
+                                                  __val__loc)
+              _idMap
+                = HashMap.fromList
+                    [("type", 1), ("name", 2), ("directives", 3), ("selectionSet", 4),
+                     ("arguments", 5), ("alias", 6), ("loc", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData Field_key where
+  rnf
+    (Field_key __field__type __field__name __field__directives
+       __field__selectionSet __field__arguments __field__alias
+       __field__loc)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq`
+            DeepSeq.rnf __field__selectionSet `Prelude.seq`
+              DeepSeq.rnf __field__arguments `Prelude.seq`
+                DeepSeq.rnf __field__alias `Prelude.seq`
+                  DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default Field_key where
+  def
+    = Field_key Default.def Default.def Default.def Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable Field_key where
+  hashWithSalt __salt
+    (Field_key _type _name _directives _selectionSet _arguments _alias
+       _loc)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _name)
+                    _directives)
+                 _selectionSet)
+              _arguments)
+           _alias)
+        _loc
+
+data EnumTypeDef_key = EnumTypeDef_key{enumTypeDef_key_name ::
+                                       Value,
+                                       enumTypeDef_key_values :: [Value],
+                                       enumTypeDef_key_directives :: [Directive]}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumTypeDef_key where
+  toJSON
+    (EnumTypeDef_key __field__name __field__values __field__directives)
+    = Aeson.object
+        ("name" .= __field__name :
+           "values" .= __field__values :
+             "directives" .= __field__directives : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumTypeDef_key where
+  buildStruct _proxy
+    (EnumTypeDef_key __field__name __field__values __field__directives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "values" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__values)
+             :
+             Thrift.genField _proxy "directives" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__directives)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__values <- ST.newSTRef Default.def
+            __field__directives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__values
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__directives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__values <- ST.readSTRef __field__values
+                                             !__val__directives <- ST.readSTRef __field__directives
+                                             Prelude.pure
+                                               (EnumTypeDef_key __val__name __val__values
+                                                  __val__directives)
+              _idMap
+                = HashMap.fromList [("name", 1), ("values", 2), ("directives", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumTypeDef_key where
+  rnf
+    (EnumTypeDef_key __field__name __field__values __field__directives)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__values `Prelude.seq`
+          DeepSeq.rnf __field__directives `Prelude.seq` ()
+
+instance Default.Default EnumTypeDef_key where
+  def = EnumTypeDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EnumTypeDef_key where
+  hashWithSalt __salt (EnumTypeDef_key _name _values _directives)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _values)
+        _directives
+
+data DirectiveDefLocation = DirectiveDefLocation_QUERY
+                          | DirectiveDefLocation_MUTATION
+                          | DirectiveDefLocation_SUBSCRIPTION
+                          | DirectiveDefLocation_FIELD
+                          | DirectiveDefLocation_FRAGMENT_DEFINITION
+                          | DirectiveDefLocation_FRAGMENT_SPREAD
+                          | DirectiveDefLocation_INLINE_FRAGMENT
+                          | DirectiveDefLocation_SCHEMA
+                          | DirectiveDefLocation_SCALAR
+                          | DirectiveDefLocation_OBJECT
+                          | DirectiveDefLocation_FIELD_DEFINITION
+                          | DirectiveDefLocation_ARGUMENT_DEFINITION
+                          | DirectiveDefLocation_INTERFACE
+                          | DirectiveDefLocation_UNION
+                          | DirectiveDefLocation_ENUM
+                          | DirectiveDefLocation_ENUM_VALUE
+                          | DirectiveDefLocation_INPUT_OBJECT
+                          | DirectiveDefLocation_INPUT_FIELD_DEFINITION
+                          | DirectiveDefLocation__UNKNOWN Prelude.Int
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectiveDefLocation where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData DirectiveDefLocation where
+  rnf __DirectiveDefLocation = Prelude.seq __DirectiveDefLocation ()
+
+instance Default.Default DirectiveDefLocation where
+  def = DirectiveDefLocation_QUERY
+
+instance Hashable.Hashable DirectiveDefLocation where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum DirectiveDefLocation where
+  toThriftEnum 0 = DirectiveDefLocation_QUERY
+  toThriftEnum 1 = DirectiveDefLocation_MUTATION
+  toThriftEnum 2 = DirectiveDefLocation_SUBSCRIPTION
+  toThriftEnum 3 = DirectiveDefLocation_FIELD
+  toThriftEnum 4 = DirectiveDefLocation_FRAGMENT_DEFINITION
+  toThriftEnum 5 = DirectiveDefLocation_FRAGMENT_SPREAD
+  toThriftEnum 6 = DirectiveDefLocation_INLINE_FRAGMENT
+  toThriftEnum 7 = DirectiveDefLocation_SCHEMA
+  toThriftEnum 8 = DirectiveDefLocation_SCALAR
+  toThriftEnum 9 = DirectiveDefLocation_OBJECT
+  toThriftEnum 10 = DirectiveDefLocation_FIELD_DEFINITION
+  toThriftEnum 11 = DirectiveDefLocation_ARGUMENT_DEFINITION
+  toThriftEnum 12 = DirectiveDefLocation_INTERFACE
+  toThriftEnum 13 = DirectiveDefLocation_UNION
+  toThriftEnum 14 = DirectiveDefLocation_ENUM
+  toThriftEnum 15 = DirectiveDefLocation_ENUM_VALUE
+  toThriftEnum 16 = DirectiveDefLocation_INPUT_OBJECT
+  toThriftEnum 17 = DirectiveDefLocation_INPUT_FIELD_DEFINITION
+  toThriftEnum val = DirectiveDefLocation__UNKNOWN val
+  fromThriftEnum DirectiveDefLocation_QUERY = 0
+  fromThriftEnum DirectiveDefLocation_MUTATION = 1
+  fromThriftEnum DirectiveDefLocation_SUBSCRIPTION = 2
+  fromThriftEnum DirectiveDefLocation_FIELD = 3
+  fromThriftEnum DirectiveDefLocation_FRAGMENT_DEFINITION = 4
+  fromThriftEnum DirectiveDefLocation_FRAGMENT_SPREAD = 5
+  fromThriftEnum DirectiveDefLocation_INLINE_FRAGMENT = 6
+  fromThriftEnum DirectiveDefLocation_SCHEMA = 7
+  fromThriftEnum DirectiveDefLocation_SCALAR = 8
+  fromThriftEnum DirectiveDefLocation_OBJECT = 9
+  fromThriftEnum DirectiveDefLocation_FIELD_DEFINITION = 10
+  fromThriftEnum DirectiveDefLocation_ARGUMENT_DEFINITION = 11
+  fromThriftEnum DirectiveDefLocation_INTERFACE = 12
+  fromThriftEnum DirectiveDefLocation_UNION = 13
+  fromThriftEnum DirectiveDefLocation_ENUM = 14
+  fromThriftEnum DirectiveDefLocation_ENUM_VALUE = 15
+  fromThriftEnum DirectiveDefLocation_INPUT_OBJECT = 16
+  fromThriftEnum DirectiveDefLocation_INPUT_FIELD_DEFINITION = 17
+  fromThriftEnum (DirectiveDefLocation__UNKNOWN val) = val
+  allThriftEnumValues
+    = [DirectiveDefLocation_QUERY, DirectiveDefLocation_MUTATION,
+       DirectiveDefLocation_SUBSCRIPTION, DirectiveDefLocation_FIELD,
+       DirectiveDefLocation_FRAGMENT_DEFINITION,
+       DirectiveDefLocation_FRAGMENT_SPREAD,
+       DirectiveDefLocation_INLINE_FRAGMENT, DirectiveDefLocation_SCHEMA,
+       DirectiveDefLocation_SCALAR, DirectiveDefLocation_OBJECT,
+       DirectiveDefLocation_FIELD_DEFINITION,
+       DirectiveDefLocation_ARGUMENT_DEFINITION,
+       DirectiveDefLocation_INTERFACE, DirectiveDefLocation_UNION,
+       DirectiveDefLocation_ENUM, DirectiveDefLocation_ENUM_VALUE,
+       DirectiveDefLocation_INPUT_OBJECT,
+       DirectiveDefLocation_INPUT_FIELD_DEFINITION]
+  toThriftEnumEither 0 = Prelude.Right DirectiveDefLocation_QUERY
+  toThriftEnumEither 1 = Prelude.Right DirectiveDefLocation_MUTATION
+  toThriftEnumEither 2
+    = Prelude.Right DirectiveDefLocation_SUBSCRIPTION
+  toThriftEnumEither 3 = Prelude.Right DirectiveDefLocation_FIELD
+  toThriftEnumEither 4
+    = Prelude.Right DirectiveDefLocation_FRAGMENT_DEFINITION
+  toThriftEnumEither 5
+    = Prelude.Right DirectiveDefLocation_FRAGMENT_SPREAD
+  toThriftEnumEither 6
+    = Prelude.Right DirectiveDefLocation_INLINE_FRAGMENT
+  toThriftEnumEither 7 = Prelude.Right DirectiveDefLocation_SCHEMA
+  toThriftEnumEither 8 = Prelude.Right DirectiveDefLocation_SCALAR
+  toThriftEnumEither 9 = Prelude.Right DirectiveDefLocation_OBJECT
+  toThriftEnumEither 10
+    = Prelude.Right DirectiveDefLocation_FIELD_DEFINITION
+  toThriftEnumEither 11
+    = Prelude.Right DirectiveDefLocation_ARGUMENT_DEFINITION
+  toThriftEnumEither 12
+    = Prelude.Right DirectiveDefLocation_INTERFACE
+  toThriftEnumEither 13 = Prelude.Right DirectiveDefLocation_UNION
+  toThriftEnumEither 14 = Prelude.Right DirectiveDefLocation_ENUM
+  toThriftEnumEither 15
+    = Prelude.Right DirectiveDefLocation_ENUM_VALUE
+  toThriftEnumEither 16
+    = Prelude.Right DirectiveDefLocation_INPUT_OBJECT
+  toThriftEnumEither 17
+    = Prelude.Right DirectiveDefLocation_INPUT_FIELD_DEFINITION
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum DirectiveDefLocation: "
+           ++ Prelude.show val)
+
+data DirectiveDef_key = DirectiveDef_key{directiveDef_key_name ::
+                                         Value,
+                                         directiveDef_key_argumentDefs :: [InputValueDef],
+                                         directiveDef_key_locations :: [DirectiveDefLocation]}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectiveDef_key where
+  toJSON
+    (DirectiveDef_key __field__name __field__argumentDefs
+       __field__locations)
+    = Aeson.object
+        ("name" .= __field__name :
+           "argumentDefs" .= __field__argumentDefs :
+             "locations" .= __field__locations : Prelude.mempty)
+
+instance Thrift.ThriftStruct DirectiveDef_key where
+  buildStruct _proxy
+    (DirectiveDef_key __field__name __field__argumentDefs
+       __field__locations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "argumentDefs" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__argumentDefs)
+             :
+             Thrift.genField _proxy "locations" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                  (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                  __field__locations)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__argumentDefs <- ST.newSTRef Default.def
+            __field__locations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__argumentDefs
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "DirectiveDefLocation"))
+                                                                        ST.writeSTRef
+                                                                          __field__locations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__argumentDefs <- ST.readSTRef
+                                                                       __field__argumentDefs
+                                             !__val__locations <- ST.readSTRef __field__locations
+                                             Prelude.pure
+                                               (DirectiveDef_key __val__name __val__argumentDefs
+                                                  __val__locations)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("argumentDefs", 2), ("locations", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DirectiveDef_key where
+  rnf
+    (DirectiveDef_key __field__name __field__argumentDefs
+       __field__locations)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__argumentDefs `Prelude.seq`
+          DeepSeq.rnf __field__locations `Prelude.seq` ()
+
+instance Default.Default DirectiveDef_key where
+  def = DirectiveDef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DirectiveDef_key where
+  hashWithSalt __salt
+    (DirectiveDef_key _name _argumentDefs _locations)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _argumentDefs)
+        _locations
+
+data Directive_key = Directive_key{directive_key_name :: Value,
+                                   directive_key_arguments :: [Argument]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Directive_key where
+  toJSON (Directive_key __field__name __field__arguments)
+    = Aeson.object
+        ("name" .= __field__name :
+           "arguments" .= __field__arguments : Prelude.mempty)
+
+instance Thrift.ThriftStruct Directive_key where
+  buildStruct _proxy (Directive_key __field__name __field__arguments)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "arguments" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__arguments)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__arguments <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__arguments
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__arguments <- ST.readSTRef __field__arguments
+                                             Prelude.pure
+                                               (Directive_key __val__name __val__arguments)
+              _idMap = HashMap.fromList [("name", 1), ("arguments", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Directive_key where
+  rnf (Directive_key __field__name __field__arguments)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__arguments `Prelude.seq` ()
+
+instance Default.Default Directive_key where
+  def = Directive_key Default.def Default.def
+
+instance Hashable.Hashable Directive_key where
+  hashWithSalt __salt (Directive_key _name _arguments)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _arguments
+
+data Declaration = Declaration_operation_ Operation
+                 | Declaration_fragment_ Fragment
+                 | Declaration_field_ FieldDef
+                 | Declaration_enum_ EnumTypeDef
+                 | Declaration_directive_ DirectiveDef
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_operation_ __operation_)
+    = Aeson.object ["operation_" .= __operation_]
+  toJSON (Declaration_fragment_ __fragment_)
+    = Aeson.object ["fragment_" .= __fragment_]
+  toJSON (Declaration_field_ __field_)
+    = Aeson.object ["field_" .= __field_]
+  toJSON (Declaration_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (Declaration_directive_ __directive_)
+    = Aeson.object ["directive_" .= __directive_]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_operation_ __operation_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "operation_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __operation_)]
+  buildStruct _proxy (Declaration_fragment_ __fragment_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fragment_" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __fragment_)]
+  buildStruct _proxy (Declaration_field_ __field_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __field_)]
+  buildStruct _proxy (Declaration_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (Declaration_directive_ __directive_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "directive_" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __directive_)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_operation_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_fragment_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_field_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_enum_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_directive_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("operation_", 1), ("fragment_", 2), ("field_", 3), ("enum_", 4),
+             ("directive_", 5)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_operation_ __operation_)
+    = DeepSeq.rnf __operation_
+  rnf (Declaration_fragment_ __fragment_) = DeepSeq.rnf __fragment_
+  rnf (Declaration_field_ __field_) = DeepSeq.rnf __field_
+  rnf (Declaration_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (Declaration_directive_ __directive_)
+    = DeepSeq.rnf __directive_
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_operation_ _operation_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _operation_)
+  hashWithSalt __salt (Declaration_fragment_ _fragment_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _fragment_)
+  hashWithSalt __salt (Declaration_field_ _field_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _field_)
+  hashWithSalt __salt (Declaration_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _enum_)
+  hashWithSalt __salt (Declaration_directive_ _directive_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _directive_)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_declaration
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+type DeclarationName_value = Value
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_target
+                                               :: Declaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_span ::
+                                               Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__target __field__file __field__span)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__target __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__target __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__target __field__file __field__span)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _target _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _span
+
+data FileDeclarations_key = FileDeclarations_key{fileDeclarations_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 fileDeclarations_key_span ::
+                                                 Glean.Schema.Src.ByteSpan,
+                                                 fileDeclarations_key_declaration :: Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations_key where
+  toJSON
+    (FileDeclarations_key __field__file __field__span
+       __field__declaration)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations_key where
+  buildStruct _proxy
+    (FileDeclarations_key __field__file __field__span
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__declaration)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (FileDeclarations_key __val__file __val__span
+                                                  __val__declaration)
+              _idMap
+                = HashMap.fromList [("file", 1), ("span", 2), ("declaration", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations_key where
+  rnf
+    (FileDeclarations_key __field__file __field__span
+       __field__declaration)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default FileDeclarations_key where
+  def = FileDeclarations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileDeclarations_key where
+  hashWithSalt __salt (FileDeclarations_key _file _span _declaration)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _declaration
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Name,
+                                         searchByName_key_decl :: Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (SearchByName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data XRef = XRef{xRef_decl :: Declaration,
+                 xRef_span :: Glean.Schema.Src.ByteSpan}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__decl __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__decl __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (XRef __val__decl __val__span)
+              _idMap = HashMap.fromList [("decl", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__decl __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _decl _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _span
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xref :: XRef}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xref)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             Prelude.pure (FileXRefs_key __val__file __val__xref)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xref)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xref)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref
+
+data DeclHasName_key = DeclHasName_key{declHasName_key_decl ::
+                                       Declaration,
+                                       declHasName_key_name :: Value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclHasName_key where
+  toJSON (DeclHasName_key __field__decl __field__name)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclHasName_key where
+  buildStruct _proxy (DeclHasName_key __field__decl __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (DeclHasName_key __val__decl __val__name)
+              _idMap = HashMap.fromList [("decl", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclHasName_key where
+  rnf (DeclHasName_key __field__decl __field__name)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default DeclHasName_key where
+  def = DeclHasName_key Default.def Default.def
+
+instance Hashable.Hashable DeclHasName_key where
+  hashWithSalt __salt (DeclHasName_key _decl _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _name
+
+data BelongToConfig_key = BelongToConfig_key{belongToConfig_key_file
+                                             :: Glean.Schema.Src.File,
+                                             belongToConfig_key_buildConfig :: Value,
+                                             belongToConfig_key_schema :: Prelude.Maybe Value}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BelongToConfig_key where
+  toJSON
+    (BelongToConfig_key __field__file __field__buildConfig
+       __field__schema)
+    = Aeson.object
+        ("file" .= __field__file :
+           "buildConfig" .= __field__buildConfig :
+             Prelude.maybe Prelude.id ((:) . ("schema" .=)) __field__schema
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct BelongToConfig_key where
+  buildStruct _proxy
+    (BelongToConfig_key __field__file __field__buildConfig
+       __field__schema)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "buildConfig" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__buildConfig)
+             :
+             case __field__schema of
+               Prelude.Just _val -> Thrift.genField _proxy "schema"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__buildConfig <- ST.newSTRef Default.def
+            __field__schema <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__buildConfig
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__schema
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__buildConfig <- ST.readSTRef
+                                                                      __field__buildConfig
+                                             !__val__schema <- ST.readSTRef __field__schema
+                                             Prelude.pure
+                                               (BelongToConfig_key __val__file __val__buildConfig
+                                                  __val__schema)
+              _idMap
+                = HashMap.fromList [("file", 1), ("buildConfig", 2), ("schema", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData BelongToConfig_key where
+  rnf
+    (BelongToConfig_key __field__file __field__buildConfig
+       __field__schema)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__buildConfig `Prelude.seq`
+          DeepSeq.rnf __field__schema `Prelude.seq` ()
+
+instance Default.Default BelongToConfig_key where
+  def = BelongToConfig_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable BelongToConfig_key where
+  hashWithSalt __salt (BelongToConfig_key _file _buildConfig _schema)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _buildConfig)
+        _schema
+
+data Argument_key = Argument_key{argument_key_name :: Value,
+                                 argument_key_value :: Value}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Argument_key where
+  toJSON (Argument_key __field__name __field__value)
+    = Aeson.object
+        ("name" .= __field__name :
+           "value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct Argument_key where
+  buildStruct _proxy (Argument_key __field__name __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Argument_key __val__name __val__value)
+              _idMap = HashMap.fromList [("name", 1), ("value", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Argument_key where
+  rnf (Argument_key __field__name __field__value)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Argument_key where
+  def = Argument_key Default.def Default.def
+
+instance Hashable.Hashable Argument_key where
+  hashWithSalt __salt (Argument_key _name _value)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _value
+{-# LINE 18 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FieldDef_key where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.FieldDef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.FieldDef_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.FieldDef_key" (Prelude.Just 0))
+{-# LINE 31 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.FieldDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "argumentDefs"
+             ([Glean.Schema.Graphql.Types.InputValueDef])
+             ('Angle.TField "directives"
+                ([Glean.Schema.Graphql.Types.Directive])
+                ('Angle.TNoFields))))
+{-# LINE 33 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.FieldDef where
+  type KeyType Glean.Schema.Graphql.Types.FieldDef =
+       Glean.Schema.Graphql.Types.FieldDef_key
+  getName _proxy = Glean.PredicateRef "graphql.FieldDef" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.fieldDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.FieldDef x k
+  getFactKey = Glean.Schema.Graphql.Types.fieldDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 42 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FieldDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 48 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.SearchByName_key
+         where
+  buildRtsValue b (Glean.Schema.Graphql.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.SearchByName_key" (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.SearchByName_key =
+     'Angle.TField "name" (Glean.Schema.Graphql.Types.Name)
+       ('Angle.TField "decl" (Glean.Schema.Graphql.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 59 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.SearchByName
+         where
+  type KeyType Glean.Schema.Graphql.Types.SearchByName =
+       Glean.Schema.Graphql.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "graphql.SearchByName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.SearchByName x k
+  getFactKey = Glean.Schema.Graphql.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 74 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FileDeclarations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.FileDeclarations_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.FileDeclarations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.FileDeclarations_key" (Prelude.Just 0))
+{-# LINE 85 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.FileDeclarations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "declaration"
+             (Glean.Schema.Graphql.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 87 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Graphql.Types.FileDeclarations
+         where
+  type KeyType Glean.Schema.Graphql.Types.FileDeclarations =
+       Glean.Schema.Graphql.Types.FileDeclarations_key
+  getName _proxy = Glean.PredicateRef "graphql.FileDeclarations" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.fileDeclarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.FileDeclarations x k
+  getFactKey = Glean.Schema.Graphql.Types.fileDeclarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 96 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FileDeclarations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 102 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Value where
+  type KeyType Glean.Schema.Graphql.Types.Value = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "graphql.Value" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.value_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Value x k
+  getFactKey = Glean.Schema.Graphql.Types.value_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 110 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Value where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 116 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Directive_key where
+  buildRtsValue b (Glean.Schema.Graphql.Types.Directive_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.Directive_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Directive_key" (Prelude.Just 0))
+{-# LINE 125 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.Directive_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "arguments" ([Glean.Schema.Graphql.Types.Argument])
+          ('Angle.TNoFields))
+{-# LINE 127 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Directive where
+  type KeyType Glean.Schema.Graphql.Types.Directive =
+       Glean.Schema.Graphql.Types.Directive_key
+  getName _proxy = Glean.PredicateRef "graphql.Directive" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.directive_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Directive x k
+  getFactKey = Glean.Schema.Graphql.Types.directive_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 136 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Directive where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 142 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Field_key where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Field_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.Field_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Field_key" (Prelude.Just 0))
+{-# LINE 161 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.Field_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TField "selectionSet"
+                (Glean.Schema.Graphql.Types.SelectionSet)
+                ('Angle.TField "arguments" ([Glean.Schema.Graphql.Types.Argument])
+                   ('Angle.TField "alias"
+                      (Prelude.Maybe Glean.Schema.Graphql.Types.Value)
+                      ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+                         ('Angle.TNoFields)))))))
+{-# LINE 163 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Field where
+  type KeyType Glean.Schema.Graphql.Types.Field =
+       Glean.Schema.Graphql.Types.Field_key
+  getName _proxy = Glean.PredicateRef "graphql.Field" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.field_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Field x k
+  getFactKey = Glean.Schema.Graphql.Types.field_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 172 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Field where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 178 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.NameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 187 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.NameLowerCase_key =
+     'Angle.TField "lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Glean.Schema.Graphql.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 189 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Graphql.Types.NameLowerCase =
+       Glean.Schema.Graphql.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "graphql.NameLowerCase" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Graphql.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 198 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 204 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Operation_key where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Operation_key x1 x2 x3 x4 x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.Operation_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Operation_key" (Prelude.Just 0))
+{-# LINE 221 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.Operation_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "kind" (Glean.Schema.Graphql.Types.OperationKind)
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TField "variableDefs"
+                ([Glean.Schema.Graphql.Types.VariableDef])
+                ('Angle.TField "selectionSet"
+                   (Glean.Schema.Graphql.Types.SelectionSet)
+                   ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+                      ('Angle.TNoFields))))))
+{-# LINE 223 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Operation where
+  type KeyType Glean.Schema.Graphql.Types.Operation =
+       Glean.Schema.Graphql.Types.Operation_key
+  getName _proxy = Glean.PredicateRef "graphql.Operation" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.operation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Operation x k
+  getFactKey = Glean.Schema.Graphql.Types.operation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 232 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Operation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 238 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Argument_key where
+  buildRtsValue b (Glean.Schema.Graphql.Types.Argument_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.Argument_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Argument_key" (Prelude.Just 0))
+{-# LINE 247 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.Argument_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "value"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TNoFields))
+{-# LINE 249 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Argument where
+  type KeyType Glean.Schema.Graphql.Types.Argument =
+       Glean.Schema.Graphql.Types.Argument_key
+  getName _proxy = Glean.PredicateRef "graphql.Argument" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.argument_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Argument x k
+  getFactKey = Glean.Schema.Graphql.Types.argument_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 258 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Argument where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 264 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InterfaceTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.InterfaceTypeDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.InterfaceTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.InterfaceTypeDef_key" (Prelude.Just 0))
+{-# LINE 275 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.InterfaceTypeDef_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "fields" ([Glean.Schema.Graphql.Types.FieldDef])
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TNoFields)))
+{-# LINE 277 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Graphql.Types.InterfaceTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.InterfaceTypeDef =
+       Glean.Schema.Graphql.Types.InterfaceTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.InterfaceTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.interfaceTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.InterfaceTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.interfaceTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 286 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InterfaceTypeDef
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 292 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclHasName_key
+         where
+  buildRtsValue b (Glean.Schema.Graphql.Types.DeclHasName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.DeclHasName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.DeclHasName_key" (Prelude.Just 0))
+{-# LINE 301 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.DeclHasName_key =
+     'Angle.TField "decl" (Glean.Schema.Graphql.Types.Declaration)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TNoFields))
+{-# LINE 303 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.DeclHasName
+         where
+  type KeyType Glean.Schema.Graphql.Types.DeclHasName =
+       Glean.Schema.Graphql.Types.DeclHasName_key
+  getName _proxy = Glean.PredicateRef "graphql.DeclHasName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.declHasName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.DeclHasName x k
+  getFactKey = Glean.Schema.Graphql.Types.declHasName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 312 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclHasName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 318 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InputValueDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.InputValueDef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.InputValueDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.InputValueDef_key" (Prelude.Just 0))
+{-# LINE 331 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.InputValueDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TField "defaultValue"
+                (Prelude.Maybe Glean.Schema.Graphql.Types.Value)
+                ('Angle.TNoFields))))
+{-# LINE 333 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.InputValueDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.InputValueDef =
+       Glean.Schema.Graphql.Types.InputValueDef_key
+  getName _proxy = Glean.PredicateRef "graphql.InputValueDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.inputValueDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.InputValueDef x k
+  getFactKey = Glean.Schema.Graphql.Types.inputValueDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 342 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InputValueDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 348 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.BelongToConfig_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.BelongToConfig_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.BelongToConfig_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.BelongToConfig_key" (Prelude.Just 0))
+{-# LINE 359 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.BelongToConfig_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "buildConfig"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "schema"
+             (Prelude.Maybe Glean.Schema.Graphql.Types.Value)
+             ('Angle.TNoFields)))
+{-# LINE 361 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.BelongToConfig
+         where
+  type KeyType Glean.Schema.Graphql.Types.BelongToConfig =
+       Glean.Schema.Graphql.Types.BelongToConfig_key
+  getName _proxy = Glean.PredicateRef "graphql.BelongToConfig" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.belongToConfig_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.BelongToConfig x k
+  getFactKey = Glean.Schema.Graphql.Types.belongToConfig_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 370 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.BelongToConfig where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 376 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Graphql.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.FileXRefs_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 385 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref" (Glean.Schema.Graphql.Types.XRef)
+          ('Angle.TNoFields))
+{-# LINE 387 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.FileXRefs where
+  type KeyType Glean.Schema.Graphql.Types.FileXRefs =
+       Glean.Schema.Graphql.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "graphql.FileXRefs" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Graphql.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 396 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 402 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FragmentSpread_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.FragmentSpread_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.FragmentSpread_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.FragmentSpread_key" (Prelude.Just 0))
+{-# LINE 415 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.FragmentSpread_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+          ('Angle.TField "arguments" ([Glean.Schema.Graphql.Types.Argument])
+             ('Angle.TField "directives"
+                ([Glean.Schema.Graphql.Types.Directive])
+                ('Angle.TNoFields))))
+{-# LINE 417 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.FragmentSpread
+         where
+  type KeyType Glean.Schema.Graphql.Types.FragmentSpread =
+       Glean.Schema.Graphql.Types.FragmentSpread_key
+  getName _proxy = Glean.PredicateRef "graphql.FragmentSpread" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.fragmentSpread_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.FragmentSpread x k
+  getFactKey = Glean.Schema.Graphql.Types.fragmentSpread_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 426 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.FragmentSpread where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 432 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.UnionTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.UnionTypeDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.UnionTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.UnionTypeDef_key" (Prelude.Just 0))
+{-# LINE 443 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.UnionTypeDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "types" ([Glean.Schema.Graphql.Types.Value])
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TNoFields)))
+{-# LINE 445 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.UnionTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.UnionTypeDef =
+       Glean.Schema.Graphql.Types.UnionTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.UnionTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.unionTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.UnionTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.unionTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 454 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.UnionTypeDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 460 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Graphql.Types.InputObjectTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.InputObjectTypeDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.InputObjectTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.InputObjectTypeDef_key" (Prelude.Just 0))
+{-# LINE 471 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Graphql.Types.InputObjectTypeDef_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "fields"
+          ([Glean.Schema.Graphql.Types.InputValueDef])
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TNoFields)))
+{-# LINE 473 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Graphql.Types.InputObjectTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.InputObjectTypeDef =
+       Glean.Schema.Graphql.Types.InputObjectTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.InputObjectTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.inputObjectTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.InputObjectTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.inputObjectTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 482 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InputObjectTypeDef
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 488 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.VariableDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.VariableDef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.VariableDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.VariableDef_key" (Prelude.Just 0))
+{-# LINE 501 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.VariableDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TField "defaultValue"
+                (Prelude.Maybe Glean.Schema.Graphql.Types.Value)
+                ('Angle.TNoFields))))
+{-# LINE 503 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.VariableDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.VariableDef =
+       Glean.Schema.Graphql.Types.VariableDef_key
+  getName _proxy = Glean.PredicateRef "graphql.VariableDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.variableDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.VariableDef x k
+  getFactKey = Glean.Schema.Graphql.Types.variableDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 512 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.VariableDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 518 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InlineFragment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.InlineFragment_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.InlineFragment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.InlineFragment_key" (Prelude.Just 0))
+{-# LINE 531 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.InlineFragment_key =
+     'Angle.TField "inferredTypeCondition"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "directives"
+          ([Glean.Schema.Graphql.Types.Directive])
+          ('Angle.TField "selectionSet"
+             (Glean.Schema.Graphql.Types.SelectionSet)
+             ('Angle.TField "typeCondition"
+                (Prelude.Maybe Glean.Schema.Graphql.Types.Value)
+                ('Angle.TNoFields))))
+{-# LINE 533 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.InlineFragment
+         where
+  type KeyType Glean.Schema.Graphql.Types.InlineFragment =
+       Glean.Schema.Graphql.Types.InlineFragment_key
+  getName _proxy = Glean.PredicateRef "graphql.InlineFragment" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.inlineFragment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.InlineFragment x k
+  getFactKey = Glean.Schema.Graphql.Types.inlineFragment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 542 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.InlineFragment where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 548 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 559 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.DeclarationUses_key =
+     'Angle.TField "target" (Glean.Schema.Graphql.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 561 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.Graphql.Types.DeclarationUses =
+       Glean.Schema.Graphql.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "graphql.DeclarationUses" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.Graphql.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 570 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclarationUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 576 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.EnumTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.EnumTypeDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.EnumTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.EnumTypeDef_key" (Prelude.Just 0))
+{-# LINE 587 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.EnumTypeDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "values" ([Glean.Schema.Graphql.Types.Value])
+          ('Angle.TField "directives"
+             ([Glean.Schema.Graphql.Types.Directive])
+             ('Angle.TNoFields)))
+{-# LINE 589 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.EnumTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.EnumTypeDef =
+       Glean.Schema.Graphql.Types.EnumTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.EnumTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.enumTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.EnumTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.enumTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 598 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.EnumTypeDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 604 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.ObjectTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.ObjectTypeDef_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.ObjectTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.ObjectTypeDef_key" (Prelude.Just 0))
+{-# LINE 617 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.ObjectTypeDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "interfaces" ([Glean.Schema.Graphql.Types.Value])
+          ('Angle.TField "fields" ([Glean.Schema.Graphql.Types.FieldDef])
+             ('Angle.TField "directives"
+                ([Glean.Schema.Graphql.Types.Directive])
+                ('Angle.TNoFields))))
+{-# LINE 619 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.ObjectTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.ObjectTypeDef =
+       Glean.Schema.Graphql.Types.ObjectTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.ObjectTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.objectTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.ObjectTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.objectTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 628 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.ObjectTypeDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 634 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Fragment_key where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Fragment_key x1 x2 x3 x4 x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.Fragment_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Fragment_key" (Prelude.Just 0))
+{-# LINE 651 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.Fragment_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "typeCondition"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+          ('Angle.TField "variableDefs"
+             ([Glean.Schema.Graphql.Types.VariableDef])
+             ('Angle.TField "directives"
+                ([Glean.Schema.Graphql.Types.Directive])
+                ('Angle.TField "selectionSet"
+                   (Glean.Schema.Graphql.Types.SelectionSet)
+                   ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+                      ('Angle.TNoFields))))))
+{-# LINE 653 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.Fragment where
+  type KeyType Glean.Schema.Graphql.Types.Fragment =
+       Glean.Schema.Graphql.Types.Fragment_key
+  getName _proxy = Glean.PredicateRef "graphql.Fragment" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Graphql.Types.fragment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.Fragment x k
+  getFactKey = Glean.Schema.Graphql.Types.fragment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 662 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Fragment where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 668 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.ScalarTypeDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.ScalarTypeDef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.ScalarTypeDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.ScalarTypeDef_key" (Prelude.Just 0))
+{-# LINE 677 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.ScalarTypeDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "directives"
+          ([Glean.Schema.Graphql.Types.Directive])
+          ('Angle.TNoFields))
+{-# LINE 679 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.ScalarTypeDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.ScalarTypeDef =
+       Glean.Schema.Graphql.Types.ScalarTypeDef_key
+  getName _proxy = Glean.PredicateRef "graphql.ScalarTypeDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.scalarTypeDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.ScalarTypeDef x k
+  getFactKey = Glean.Schema.Graphql.Types.scalarTypeDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 688 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.ScalarTypeDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 694 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.DeclarationName
+         where
+  type KeyType Glean.Schema.Graphql.Types.DeclarationName =
+       Glean.Schema.Graphql.Types.Declaration
+  type ValueType Glean.Schema.Graphql.Types.DeclarationName =
+       Glean.Schema.Graphql.Types.DeclarationName_value
+  getName _proxy = Glean.PredicateRef "graphql.DeclarationName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.declarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Graphql.Types.DeclarationName x k v
+  getFactKey = Glean.Schema.Graphql.Types.declarationName_key
+  getFactValue = Glean.Schema.Graphql.Types.declarationName_value
+{-# LINE 705 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclarationName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 711 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DirectiveDef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.DirectiveDef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.DirectiveDef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.DirectiveDef_key" (Prelude.Just 0))
+{-# LINE 722 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.DirectiveDef_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Value)
+       ('Angle.TField "argumentDefs"
+          ([Glean.Schema.Graphql.Types.InputValueDef])
+          ('Angle.TField "locations"
+             ([Glean.Schema.Graphql.Types.DirectiveDefLocation])
+             ('Angle.TNoFields)))
+{-# LINE 724 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Graphql.Types.DirectiveDef
+         where
+  type KeyType Glean.Schema.Graphql.Types.DirectiveDef =
+       Glean.Schema.Graphql.Types.DirectiveDef_key
+  getName _proxy = Glean.PredicateRef "graphql.DirectiveDef" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.directiveDef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.DirectiveDef x k
+  getFactKey = Glean.Schema.Graphql.Types.directiveDef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 733 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DirectiveDef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 739 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Graphql.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.DeclarationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 750 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Graphql.Types.DeclarationLocation_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.Graphql.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 752 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Graphql.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Graphql.Types.DeclarationLocation =
+       Glean.Schema.Graphql.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "graphql.DeclarationLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Graphql.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Graphql.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Graphql.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 761 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 767 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.OperationKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.OperationKind" (Prelude.Just 3))
+{-# LINE 772 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Graphql.Types.OperationKind =
+     'Angle.TField "QUERY" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "MUTATION" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "SUBSCRIPTION" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 774 "glean/schema/thrift/graphql_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Graphql.Types.OperationKind
+         where
+  type AngleEnumTy Glean.Schema.Graphql.Types.OperationKind =
+       Glean.Schema.Graphql.Types.OperationKind
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 778 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.DirectiveDefLocation
+         where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.DirectiveDefLocation" (Prelude.Just 3))
+{-# LINE 783 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Graphql.Types.DirectiveDefLocation =
+     'Angle.TField "QUERY" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "MUTATION" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "SUBSCRIPTION" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "FIELD" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "FRAGMENT_DEFINITION"
+                   (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "FRAGMENT_SPREAD" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "INLINE_FRAGMENT" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "SCHEMA" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "SCALAR" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "OBJECT" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "FIELD_DEFINITION"
+                                     (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "ARGUMENT_DEFINITION"
+                                        (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "INTERFACE" (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "UNION" (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "ENUM"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "ENUM_VALUE"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "INPUT_OBJECT"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "INPUT_FIELD_DEFINITION"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TNoFields))))))))))))))))))
+{-# LINE 785 "glean/schema/thrift/graphql_include.hs" #-}
+instance Angle.AngleEnum
+           Glean.Schema.Graphql.Types.DirectiveDefLocation
+         where
+  type AngleEnumTy Glean.Schema.Graphql.Types.DirectiveDefLocation =
+       Glean.Schema.Graphql.Types.DirectiveDefLocation
+  enumName v = Text.pack (Prelude.drop 21 (Prelude.show v))
+{-# LINE 789 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.SelectionSet where
+  buildRtsValue b (Glean.Schema.Graphql.Types.SelectionSet x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.SelectionSet <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.SelectionSet" (Prelude.Just 3))
+{-# LINE 800 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Graphql.Types.SelectionSet =
+     'Angle.TField "fields" ([Glean.Schema.Graphql.Types.Field])
+       ('Angle.TField "inlineFragments"
+          ([Glean.Schema.Graphql.Types.InlineFragment])
+          ('Angle.TField "fragmentSpreads"
+             ([Glean.Schema.Graphql.Types.FragmentSpread])
+             ('Angle.TNoFields)))
+{-# LINE 802 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.Declaration where
+  buildRtsValue b Glean.Schema.Graphql.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Declaration_operation_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Declaration_fragment_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Graphql.Types.Declaration_field_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Graphql.Types.Declaration_enum_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Graphql.Types.Declaration_directive_ x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Graphql.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Graphql.Types.Declaration_operation_,
+         Glean.mapD Glean.Schema.Graphql.Types.Declaration_fragment_,
+         Glean.mapD Glean.Schema.Graphql.Types.Declaration_field_,
+         Glean.mapD Glean.Schema.Graphql.Types.Declaration_enum_,
+         Glean.mapD Glean.Schema.Graphql.Types.Declaration_directive_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.Declaration" (Prelude.Just 3))
+{-# LINE 830 "glean/schema/thrift/graphql_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Graphql.Types.Declaration =
+     'Angle.TField "operation_"
+       (Glean.KeyType Glean.Schema.Graphql.Types.Operation)
+       ('Angle.TField "fragment_"
+          (Glean.KeyType Glean.Schema.Graphql.Types.Fragment)
+          ('Angle.TField "field_"
+             (Glean.KeyType Glean.Schema.Graphql.Types.FieldDef)
+             ('Angle.TField "enum_"
+                (Glean.KeyType Glean.Schema.Graphql.Types.EnumTypeDef)
+                ('Angle.TField "directive_"
+                   (Glean.KeyType Glean.Schema.Graphql.Types.DirectiveDef)
+                   ('Angle.TNoFields)))))
+{-# LINE 832 "glean/schema/thrift/graphql_include.hs" #-}
+instance Glean.Type Glean.Schema.Graphql.Types.XRef where
+  buildRtsValue b (Glean.Schema.Graphql.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Graphql.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "graphql.XRef" (Prelude.Just 3))
+{-# LINE 841 "glean/schema/thrift/graphql_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Graphql.Types.XRef =
+     'Angle.TField "decl" (Glean.Schema.Graphql.Types.Declaration)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Hack/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Hack/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Hack/Types.hs
@@ -0,0 +1,25253 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/hack_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/hack_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/hack_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Hack/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Hack.Types
+       (pREDICATE_VERSIONS, UserAttribute_id,
+        UserAttribute(UserAttribute, userAttribute_id, userAttribute_key),
+        TypedefDeclaration_id,
+        TypedefDeclaration(TypedefDeclaration, typedefDeclaration_id,
+                           typedefDeclaration_key),
+        TypeConstDefinition_id,
+        TypeConstDefinition(TypeConstDefinition, typeConstDefinition_id,
+                            typeConstDefinition_key),
+        Type_id, Type(Type, type_id, type_key), TraitDeclaration_id,
+        TraitDeclaration(TraitDeclaration, traitDeclaration_id,
+                         traitDeclaration_key),
+        StringLiteral_id,
+        StringLiteral(StringLiteral, stringLiteral_id, stringLiteral_key),
+        SearchTypedefByLowerCaseName_id,
+        SearchTypedefByLowerCaseName(SearchTypedefByLowerCaseName,
+                                     searchTypedefByLowerCaseName_id,
+                                     searchTypedefByLowerCaseName_key),
+        SearchTypeConstByLowerCaseName_id,
+        SearchTypeConstByLowerCaseName(SearchTypeConstByLowerCaseName,
+                                       searchTypeConstByLowerCaseName_id,
+                                       searchTypeConstByLowerCaseName_key),
+        SearchTraitByLowerCaseName_id,
+        SearchTraitByLowerCaseName(SearchTraitByLowerCaseName,
+                                   searchTraitByLowerCaseName_id, searchTraitByLowerCaseName_key),
+        SearchPropertyByLowerCaseName_id,
+        SearchPropertyByLowerCaseName(SearchPropertyByLowerCaseName,
+                                      searchPropertyByLowerCaseName_id,
+                                      searchPropertyByLowerCaseName_key),
+        SearchNamespaceByLowerCaseName_id,
+        SearchNamespaceByLowerCaseName(SearchNamespaceByLowerCaseName,
+                                       searchNamespaceByLowerCaseName_id,
+                                       searchNamespaceByLowerCaseName_key),
+        SearchModuleByLowerCaseName_id,
+        SearchModuleByLowerCaseName(SearchModuleByLowerCaseName,
+                                    searchModuleByLowerCaseName_id,
+                                    searchModuleByLowerCaseName_key),
+        SearchMethodByLowerCaseName_id,
+        SearchMethodByLowerCaseName(SearchMethodByLowerCaseName,
+                                    searchMethodByLowerCaseName_id,
+                                    searchMethodByLowerCaseName_key),
+        SearchInterfaceByLowerCaseName_id,
+        SearchInterfaceByLowerCaseName(SearchInterfaceByLowerCaseName,
+                                       searchInterfaceByLowerCaseName_id,
+                                       searchInterfaceByLowerCaseName_key),
+        SearchGlobalConstByLowerCaseName_id,
+        SearchGlobalConstByLowerCaseName(SearchGlobalConstByLowerCaseName,
+                                         searchGlobalConstByLowerCaseName_id,
+                                         searchGlobalConstByLowerCaseName_key),
+        SearchFunctionByLowerCaseName_id,
+        SearchFunctionByLowerCaseName(SearchFunctionByLowerCaseName,
+                                      searchFunctionByLowerCaseName_id,
+                                      searchFunctionByLowerCaseName_key),
+        SearchEnumeratorByLowerCaseName_id,
+        SearchEnumeratorByLowerCaseName(SearchEnumeratorByLowerCaseName,
+                                        searchEnumeratorByLowerCaseName_id,
+                                        searchEnumeratorByLowerCaseName_key),
+        SearchEnumByLowerCaseName_id,
+        SearchEnumByLowerCaseName(SearchEnumByLowerCaseName,
+                                  searchEnumByLowerCaseName_id, searchEnumByLowerCaseName_key),
+        SearchClassConstByLowerCaseName_id,
+        SearchClassConstByLowerCaseName(SearchClassConstByLowerCaseName,
+                                        searchClassConstByLowerCaseName_id,
+                                        searchClassConstByLowerCaseName_key),
+        SearchClassByLowerCaseName_id,
+        SearchClassByLowerCaseName(SearchClassByLowerCaseName,
+                                   searchClassByLowerCaseName_id, searchClassByLowerCaseName_key),
+        QName_id, QName(QName, qName_id, qName_key), PropertyDefinition_id,
+        PropertyDefinition(PropertyDefinition, propertyDefinition_id,
+                           propertyDefinition_key),
+        Signature_id, Signature(Signature, signature_id, signature_key),
+        NamespaceQName_id,
+        NamespaceQName(NamespaceQName, namespaceQName_id,
+                       namespaceQName_key),
+        NamespaceDeclaration_id,
+        NamespaceDeclaration(NamespaceDeclaration, namespaceDeclaration_id,
+                             namespaceDeclaration_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        Name_id, Name(Name, name_id, name_key), ModuleDefinition_id,
+        ModuleDefinition(ModuleDefinition, moduleDefinition_id,
+                         moduleDefinition_key),
+        ModuleDeclaration_id,
+        ModuleDeclaration(ModuleDeclaration, moduleDeclaration_id,
+                          moduleDeclaration_key),
+        MethodOverrides_id,
+        MethodOverrides(MethodOverrides, methodOverrides_id,
+                        methodOverrides_key),
+        MethodOverridden_id,
+        MethodOverridden(MethodOverridden, methodOverridden_id,
+                         methodOverridden_key),
+        MethodOccurrence_id,
+        MethodOccurrence(MethodOccurrence, methodOccurrence_id,
+                         methodOccurrence_key),
+        InterfaceDeclaration_id,
+        InterfaceDeclaration(InterfaceDeclaration, interfaceDeclaration_id,
+                             interfaceDeclaration_key),
+        IndexerInputsHash_id,
+        IndexerInputsHash(IndexerInputsHash, indexerInputsHash_id,
+                          indexerInputsHash_key, indexerInputsHash_value),
+        GlobalNamespaceAlias_id,
+        GlobalNamespaceAlias(GlobalNamespaceAlias, globalNamespaceAlias_id,
+                             globalNamespaceAlias_key),
+        GlobalConstDefinition_id,
+        GlobalConstDefinition(GlobalConstDefinition,
+                              globalConstDefinition_id, globalConstDefinition_key),
+        GlobalConstDeclaration_id,
+        GlobalConstDeclaration(GlobalConstDeclaration,
+                               globalConstDeclaration_id, globalConstDeclaration_key),
+        FunctionDeclaration_id,
+        FunctionDeclaration(FunctionDeclaration, functionDeclaration_id,
+                            functionDeclaration_key),
+        Hint_id, Hint(Hint, hint_id, hint_key), Enumerator_id,
+        Enumerator(Enumerator, enumerator_id, enumerator_key),
+        EnumDefinition_id,
+        EnumDefinition(EnumDefinition, enumDefinition_id,
+                       enumDefinition_key),
+        EnumDeclaration_id,
+        EnumDeclaration(EnumDeclaration, enumDeclaration_id,
+                        enumDeclaration_key),
+        Context__id, Context_(Context_, context__id, context__key),
+        ContainerDeclarationQName_id,
+        ContainerDeclarationQName(ContainerDeclarationQName,
+                                  containerDeclarationQName_id, containerDeclarationQName_key,
+                                  containerDeclarationQName_value),
+        ContainerParent_id,
+        ContainerParent(ContainerParent, containerParent_id,
+                        containerParent_key),
+        DeclarationComment_id,
+        DeclarationComment(DeclarationComment, declarationComment_id,
+                           declarationComment_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationName_id,
+        DeclarationName(DeclarationName, declarationName_id,
+                        declarationName_key, declarationName_value),
+        DeclarationNamespace_id,
+        DeclarationNamespace(DeclarationNamespace, declarationNamespace_id,
+                             declarationNamespace_key),
+        DeclarationSource_id,
+        DeclarationSource(DeclarationSource, declarationSource_id,
+                          declarationSource_key),
+        DeclarationSpan_id,
+        DeclarationSpan(DeclarationSpan, declarationSpan_id,
+                        declarationSpan_key),
+        DeclarationTarget_id,
+        DeclarationTarget(DeclarationTarget, declarationTarget_id,
+                          declarationTarget_key),
+        FileDeclarations_id,
+        FileDeclarations(FileDeclarations, fileDeclarations_id,
+                         fileDeclarations_key),
+        HackToThrift_id,
+        HackToThrift(HackToThrift, hackToThrift_id, hackToThrift_key),
+        MemberCluster_id,
+        MemberCluster(MemberCluster, memberCluster_id, memberCluster_key),
+        ModuleChild_id,
+        ModuleChild(ModuleChild, moduleChild_id, moduleChild_key),
+        ModuleParent_id,
+        ModuleParent(ModuleParent, moduleParent_id, moduleParent_key),
+        NamespaceMember_id,
+        NamespaceMember(NamespaceMember, namespaceMember_id,
+                        namespaceMember_key),
+        SearchClassByName_id,
+        SearchClassByName(SearchClassByName, searchClassByName_id,
+                          searchClassByName_key),
+        SearchClassConstByName_id,
+        SearchClassConstByName(SearchClassConstByName,
+                               searchClassConstByName_id, searchClassConstByName_key),
+        SearchEnumByName_id,
+        SearchEnumByName(SearchEnumByName, searchEnumByName_id,
+                         searchEnumByName_key),
+        SearchEnumeratorByName_id,
+        SearchEnumeratorByName(SearchEnumeratorByName,
+                               searchEnumeratorByName_id, searchEnumeratorByName_key),
+        SearchFunctionByName_id,
+        SearchFunctionByName(SearchFunctionByName, searchFunctionByName_id,
+                             searchFunctionByName_key),
+        SearchGlobalConstByName_id,
+        SearchGlobalConstByName(SearchGlobalConstByName,
+                                searchGlobalConstByName_id, searchGlobalConstByName_key),
+        SearchInterfaceByName_id,
+        SearchInterfaceByName(SearchInterfaceByName,
+                              searchInterfaceByName_id, searchInterfaceByName_key),
+        SearchMethodByName_id,
+        SearchMethodByName(SearchMethodByName, searchMethodByName_id,
+                           searchMethodByName_key),
+        SearchModuleByName_id,
+        SearchModuleByName(SearchModuleByName, searchModuleByName_id,
+                           searchModuleByName_key),
+        SearchNamespaceByName_id,
+        SearchNamespaceByName(SearchNamespaceByName,
+                              searchNamespaceByName_id, searchNamespaceByName_key),
+        SearchPropertyByName_id,
+        SearchPropertyByName(SearchPropertyByName, searchPropertyByName_id,
+                             searchPropertyByName_key),
+        SearchTraitByName_id,
+        SearchTraitByName(SearchTraitByName, searchTraitByName_id,
+                          searchTraitByName_key),
+        SearchTypeConstByName_id,
+        SearchTypeConstByName(SearchTypeConstByName,
+                              searchTypeConstByName_id, searchTypeConstByName_key),
+        SearchTypedefByName_id,
+        SearchTypedefByName(SearchTypedefByName, searchTypedefByName_id,
+                            searchTypedefByName_key),
+        ThriftToHack_id,
+        ThriftToHack(ThriftToHack, thriftToHack_id, thriftToHack_key),
+        TargetUses_id,
+        TargetUses(TargetUses, targetUses_id, targetUses_key),
+        TargetUsesAbs_id,
+        TargetUsesAbs(TargetUsesAbs, targetUsesAbs_id, targetUsesAbs_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        TypeInfo_id, TypeInfo(TypeInfo, typeInfo_id, typeInfo_key),
+        InheritedMembers_id,
+        InheritedMembers(InheritedMembers, inheritedMembers_id,
+                         inheritedMembers_key),
+        MethodDeclaration_id,
+        MethodDeclaration(MethodDeclaration, methodDeclaration_id,
+                          methodDeclaration_key),
+        PropertyDeclaration_id,
+        PropertyDeclaration(PropertyDeclaration, propertyDeclaration_id,
+                            propertyDeclaration_key),
+        TypeConstDeclaration_id,
+        TypeConstDeclaration(TypeConstDeclaration, typeConstDeclaration_id,
+                             typeConstDeclaration_key),
+        ContainerChild_id,
+        ContainerChild(ContainerChild, containerChild_id,
+                       containerChild_key),
+        FunctionDefinition_id,
+        FunctionDefinition(FunctionDefinition, functionDefinition_id,
+                           functionDefinition_key),
+        InterfaceDefinition_id,
+        InterfaceDefinition(InterfaceDefinition, interfaceDefinition_id,
+                            interfaceDefinition_key),
+        MethodDefinition_id,
+        MethodDefinition(MethodDefinition, methodDefinition_id,
+                         methodDefinition_key),
+        TraitDefinition_id,
+        TraitDefinition(TraitDefinition, traitDefinition_id,
+                        traitDefinition_key),
+        TypedefDefinition_id,
+        TypedefDefinition(TypedefDefinition, typedefDefinition_id,
+                          typedefDefinition_key),
+        ClassDefinition_id,
+        ClassDefinition(ClassDefinition, classDefinition_id,
+                        classDefinition_key),
+        ClassDeclaration_id,
+        ClassDeclaration(ClassDeclaration, classDeclaration_id,
+                         classDeclaration_key),
+        ClassConstDefinition_id,
+        ClassConstDefinition(ClassConstDefinition, classConstDefinition_id,
+                             classConstDefinition_key),
+        ClassConstDeclaration_id,
+        ClassConstDeclaration(ClassConstDeclaration,
+                              classConstDeclaration_id, classConstDeclaration_key),
+        AttributeToDefinition_id,
+        AttributeToDefinition(AttributeToDefinition,
+                              attributeToDefinition_id, attributeToDefinition_key),
+        AttributeToDeclaration_id,
+        AttributeToDeclaration(AttributeToDeclaration,
+                               attributeToDeclaration_id, attributeToDeclaration_key),
+        AttributeHasParameter_id,
+        AttributeHasParameter(AttributeHasParameter,
+                              attributeHasParameter_id, attributeHasParameter_key),
+        FileCall_id, FileCall(FileCall, fileCall_id, fileCall_key),
+        Visibility(Visibility_Private, Visibility_Protected,
+                   Visibility_Public, Visibility_Internal, Visibility__UNKNOWN),
+        Variance(Variance_Contravariant, Variance_Covariant,
+                 Variance_Invariant, Variance__UNKNOWN),
+        UserAttribute_key(UserAttribute_key, userAttribute_key_name,
+                          userAttribute_key_parameters, userAttribute_key_qname),
+        TypedefDeclaration_key(TypedefDeclaration_key,
+                               typedefDeclaration_key_name),
+        TypeConstKind(TypeConstKind_Abstract, TypeConstKind_Concrete,
+                      TypeConstKind_PartiallyAbstract, TypeConstKind__UNKNOWN),
+        TypeConstDefinition_key(TypeConstDefinition_key,
+                                typeConstDefinition_key_declaration, typeConstDefinition_key_type,
+                                typeConstDefinition_key_kind, typeConstDefinition_key_attributes,
+                                typeConstDefinition_key_typeInfo),
+        TraitDeclaration_key(TraitDeclaration_key,
+                             traitDeclaration_key_name),
+        SearchTypedefByLowerCaseName_key(SearchTypedefByLowerCaseName_key,
+                                         searchTypedefByLowerCaseName_key_name_lowercase,
+                                         searchTypedefByLowerCaseName_key_name),
+        SearchTypeConstByLowerCaseName_key(SearchTypeConstByLowerCaseName_key,
+                                           searchTypeConstByLowerCaseName_key_name_lowercase,
+                                           searchTypeConstByLowerCaseName_key_name),
+        SearchTraitByLowerCaseName_key(SearchTraitByLowerCaseName_key,
+                                       searchTraitByLowerCaseName_key_name_lowercase,
+                                       searchTraitByLowerCaseName_key_name),
+        SearchPropertyByLowerCaseName_key(SearchPropertyByLowerCaseName_key,
+                                          searchPropertyByLowerCaseName_key_name_lowercase,
+                                          searchPropertyByLowerCaseName_key_name),
+        SearchNamespaceByLowerCaseName_key(SearchNamespaceByLowerCaseName_key,
+                                           searchNamespaceByLowerCaseName_key_name_lowercase,
+                                           searchNamespaceByLowerCaseName_key_name),
+        SearchModuleByLowerCaseName_key(SearchModuleByLowerCaseName_key,
+                                        searchModuleByLowerCaseName_key_name_lowercase,
+                                        searchModuleByLowerCaseName_key_name),
+        SearchMethodByLowerCaseName_key(SearchMethodByLowerCaseName_key,
+                                        searchMethodByLowerCaseName_key_name_lowercase,
+                                        searchMethodByLowerCaseName_key_name),
+        SearchInterfaceByLowerCaseName_key(SearchInterfaceByLowerCaseName_key,
+                                           searchInterfaceByLowerCaseName_key_name_lowercase,
+                                           searchInterfaceByLowerCaseName_key_name),
+        SearchGlobalConstByLowerCaseName_key(SearchGlobalConstByLowerCaseName_key,
+                                             searchGlobalConstByLowerCaseName_key_name_lowercase,
+                                             searchGlobalConstByLowerCaseName_key_name),
+        SearchFunctionByLowerCaseName_key(SearchFunctionByLowerCaseName_key,
+                                          searchFunctionByLowerCaseName_key_name_lowercase,
+                                          searchFunctionByLowerCaseName_key_name),
+        SearchEnumeratorByLowerCaseName_key(SearchEnumeratorByLowerCaseName_key,
+                                            searchEnumeratorByLowerCaseName_key_name_lowercase,
+                                            searchEnumeratorByLowerCaseName_key_name),
+        SearchEnumByLowerCaseName_key(SearchEnumByLowerCaseName_key,
+                                      searchEnumByLowerCaseName_key_name_lowercase,
+                                      searchEnumByLowerCaseName_key_name),
+        SearchClassConstByLowerCaseName_key(SearchClassConstByLowerCaseName_key,
+                                            searchClassConstByLowerCaseName_key_name_lowercase,
+                                            searchClassConstByLowerCaseName_key_name),
+        SearchClassByLowerCaseName_key(SearchClassByLowerCaseName_key,
+                                       searchClassByLowerCaseName_key_name_lowercase,
+                                       searchClassByLowerCaseName_key_name),
+        ReifyKind(ReifyKind_Erased, ReifyKind_Reified,
+                  ReifyKind_SoftReified, ReifyKind__UNKNOWN),
+        ReadonlyKind(ReadonlyKind_Readonly, ReadonlyKind__UNKNOWN),
+        QName_key(QName_key, qName_key_name, qName_key_namespace_),
+        PropertyDefinition_key(PropertyDefinition_key,
+                               propertyDefinition_key_declaration, propertyDefinition_key_type,
+                               propertyDefinition_key_visibility, propertyDefinition_key_isFinal,
+                               propertyDefinition_key_isAbstract, propertyDefinition_key_isStatic,
+                               propertyDefinition_key_attributes,
+                               propertyDefinition_key_typeInfo),
+        Parameter(Parameter, parameter_name, parameter_type,
+                  parameter_isInout, parameter_isVariadic, parameter_defaultValue,
+                  parameter_attributes, parameter_typeInfo, parameter_readonly),
+        Signature_key(Signature_key, signature_key_returns,
+                      signature_key_parameters, signature_key_contexts,
+                      signature_key_returnsTypeInfo),
+        Occurrence(Occurrence_EMPTY, Occurrence_method),
+        NamespaceQName_key(NamespaceQName_key, namespaceQName_key_name,
+                           namespaceQName_key_parent),
+        NamespaceDeclaration_key(NamespaceDeclaration_key,
+                                 namespaceDeclaration_key_name),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowercase, nameLowerCase_key_name),
+        ModuleMembership(ModuleMembership, moduleMembership_declaration,
+                         moduleMembership_internal),
+        ModuleDefinition_key(ModuleDefinition_key,
+                             moduleDefinition_key_declaration, moduleDefinition_key_attributes),
+        ModuleDeclaration_key(ModuleDeclaration_key,
+                              moduleDeclaration_key_name),
+        MethodOverrides_key(MethodOverrides_key,
+                            methodOverrides_key_derived, methodOverrides_key_base,
+                            methodOverrides_key_annotation),
+        MethodOverridden_key(MethodOverridden_key,
+                             methodOverridden_key_base, methodOverridden_key_derived,
+                             methodOverridden_key_annotation),
+        MethodOccurrence_key(MethodOccurrence_key,
+                             methodOccurrence_key_name, methodOccurrence_key_className),
+        InterfaceDeclaration_key(InterfaceDeclaration_key,
+                                 interfaceDeclaration_key_name),
+        IndexerInputsHash_value,
+        GlobalNamespaceAlias_key(GlobalNamespaceAlias_key,
+                                 globalNamespaceAlias_key_from, globalNamespaceAlias_key_to),
+        GlobalConstDefinition_key(GlobalConstDefinition_key,
+                                  globalConstDefinition_key_declaration,
+                                  globalConstDefinition_key_type, globalConstDefinition_key_value,
+                                  globalConstDefinition_key_typeInfo),
+        GlobalConstDeclaration_key(GlobalConstDeclaration_key,
+                                   globalConstDeclaration_key_name),
+        FunctionDeclaration_key(FunctionDeclaration_key,
+                                functionDeclaration_key_name),
+        FieldClassConst(FieldClassConst, fieldClassConst_container,
+                        fieldClassConst_name),
+        ShapeKV_key(ShapeKV_key_EMPTY, ShapeKV_key_sf_regex_group,
+                    ShapeKV_key_sf_lit_string, ShapeKV_key_sf_class_const),
+        ShapeKV(ShapeKV, shapeKV_key, shapeKV_value, shapeKV_opt),
+        Hint_apply_(Hint_apply_, hint_apply__class_name,
+                    hint_apply__values),
+        Hint_tuple_(Hint_tuple_, hint_tuple__req, hint_tuple__opt,
+                    hint_tuple__variadic),
+        Hint_shape_(Hint_shape_, hint_shape__open_, hint_shape__map_),
+        Hint_vect_or_dict_(Hint_vect_or_dict_,
+                           hint_vect_or_dict__maybe_key, hint_vect_or_dict__value_),
+        Hint_key(Hint_key_EMPTY, Hint_key_apply, Hint_key_option,
+                 Hint_key_like, Hint_key_tuple, Hint_key_class_args, Hint_key_shape,
+                 Hint_key_soft, Hint_key_intersection, Hint_key_union_,
+                 Hint_key_vect_or_dict, Hint_key_prim, Hint_key_var_,
+                 Hint_key_fun_context, Hint_key_mixed, Hint_key_wildcard,
+                 Hint_key_nonnull, Hint_key_this_, Hint_key_dynamic,
+                 Hint_key_nothing, Hint_key_other),
+        Enumerator_key(Enumerator_key, enumerator_key_name,
+                       enumerator_key_enumeration),
+        EnumDefinition_key(EnumDefinition_key,
+                           enumDefinition_key_declaration, enumDefinition_key_enumBase,
+                           enumDefinition_key_enumBaseTypeInfo,
+                           enumDefinition_key_enumConstraint,
+                           enumDefinition_key_enumConstraintTypeInfo,
+                           enumDefinition_key_enumerators, enumDefinition_key_attributes,
+                           enumDefinition_key_includes, enumDefinition_key_isEnumClass,
+                           enumDefinition_key_module_),
+        EnumDeclaration_key(EnumDeclaration_key, enumDeclaration_key_name),
+        Definition(Definition_EMPTY, Definition_class_,
+                   Definition_classConst, Definition_enum_, Definition_function_,
+                   Definition_globalConst, Definition_interface_, Definition_trait,
+                   Definition_method, Definition_property_, Definition_typeConst,
+                   Definition_typedef_, Definition_module),
+        ContainerDeclaration(ContainerDeclaration_EMPTY,
+                             ContainerDeclaration_class_, ContainerDeclaration_enum_,
+                             ContainerDeclaration_interface_, ContainerDeclaration_trait),
+        ContainerDeclarationQName_value,
+        ContainerParent_key(ContainerParent_key,
+                            containerParent_key_container, containerParent_key_parent),
+        Declaration(Declaration_EMPTY, Declaration_classConst,
+                    Declaration_container, Declaration_enumerator,
+                    Declaration_function_, Declaration_globalConst,
+                    Declaration_namespace_, Declaration_method, Declaration_property_,
+                    Declaration_typeConst, Declaration_typedef_, Declaration_module),
+        DeclarationComment_key(DeclarationComment_key,
+                               declarationComment_key_declaration, declarationComment_key_file,
+                               declarationComment_key_span),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_declaration, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationName_value,
+        DeclarationNamespace_key(DeclarationNamespace_key,
+                                 declarationNamespace_key_decl,
+                                 declarationNamespace_key_namespace_),
+        DeclarationSource_key(DeclarationSource_key,
+                              declarationSource_key_target, declarationSource_key_source),
+        DeclarationSpan_key(DeclarationSpan_key,
+                            declarationSpan_key_declaration, declarationSpan_key_file,
+                            declarationSpan_key_span),
+        DeclarationTarget_key(DeclarationTarget_key,
+                              declarationTarget_key_source, declarationTarget_key_target),
+        FileDeclarations_key(FileDeclarations_key,
+                             fileDeclarations_key_file, fileDeclarations_key_declarations),
+        HackToThrift_key(HackToThrift_key, hackToThrift_key_from,
+                         hackToThrift_key_to),
+        MemberCluster_key(MemberCluster_key, memberCluster_key_members),
+        ModuleChild_key(ModuleChild_key, moduleChild_key_module,
+                        moduleChild_key_decl),
+        ModuleParent_key(ModuleParent_key, moduleParent_key_decl,
+                         moduleParent_key_module),
+        NamespaceMember_key(NamespaceMember_key,
+                            namespaceMember_key_namespace_, namespaceMember_key_decl),
+        SearchClassByName_key(SearchClassByName_key,
+                              searchClassByName_key_name, searchClassByName_key_parent,
+                              searchClassByName_key_decl),
+        SearchClassConstByName_key(SearchClassConstByName_key,
+                                   searchClassConstByName_key_name,
+                                   searchClassConstByName_key_parent,
+                                   searchClassConstByName_key_decl),
+        SearchEnumByName_key(SearchEnumByName_key,
+                             searchEnumByName_key_name, searchEnumByName_key_parent,
+                             searchEnumByName_key_decl),
+        SearchEnumeratorByName_key(SearchEnumeratorByName_key,
+                                   searchEnumeratorByName_key_name,
+                                   searchEnumeratorByName_key_parent,
+                                   searchEnumeratorByName_key_decl),
+        SearchFunctionByName_key(SearchFunctionByName_key,
+                                 searchFunctionByName_key_name, searchFunctionByName_key_parent,
+                                 searchFunctionByName_key_decl),
+        SearchGlobalConstByName_key(SearchGlobalConstByName_key,
+                                    searchGlobalConstByName_key_name,
+                                    searchGlobalConstByName_key_parent,
+                                    searchGlobalConstByName_key_decl),
+        SearchInterfaceByName_key(SearchInterfaceByName_key,
+                                  searchInterfaceByName_key_name, searchInterfaceByName_key_parent,
+                                  searchInterfaceByName_key_decl),
+        SearchMethodByName_key(SearchMethodByName_key,
+                               searchMethodByName_key_name, searchMethodByName_key_parent,
+                               searchMethodByName_key_decl),
+        SearchModuleByName_key(SearchModuleByName_key,
+                               searchModuleByName_key_name, searchModuleByName_key_decl),
+        SearchNamespaceByName_key(SearchNamespaceByName_key,
+                                  searchNamespaceByName_key_name, searchNamespaceByName_key_parent,
+                                  searchNamespaceByName_key_decl),
+        SearchPropertyByName_key(SearchPropertyByName_key,
+                                 searchPropertyByName_key_name, searchPropertyByName_key_parent,
+                                 searchPropertyByName_key_decl),
+        SearchTraitByName_key(SearchTraitByName_key,
+                              searchTraitByName_key_name, searchTraitByName_key_parent,
+                              searchTraitByName_key_decl),
+        SearchTypeConstByName_key(SearchTypeConstByName_key,
+                                  searchTypeConstByName_key_name, searchTypeConstByName_key_parent,
+                                  searchTypeConstByName_key_decl),
+        SearchTypedefByName_key(SearchTypedefByName_key,
+                                searchTypedefByName_key_name, searchTypedefByName_key_parent,
+                                searchTypedefByName_key_decl),
+        ThriftToHack_key(ThriftToHack_key, thriftToHack_key_to,
+                         thriftToHack_key_from),
+        XRefTarget(XRefTarget_EMPTY, XRefTarget_declaration,
+                   XRefTarget_occurrence),
+        TargetUses_key(TargetUses_key, targetUses_key_target,
+                       targetUses_key_file, targetUses_key_uses),
+        TargetUsesAbs_key(TargetUsesAbs_key, targetUsesAbs_key_target,
+                          targetUsesAbs_key_file, targetUsesAbs_key_uses),
+        XRef(XRef, xRef_target, xRef_ranges),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs),
+        TypeInfo_key(TypeInfo_key, typeInfo_key_displayType,
+                     typeInfo_key_xrefs, typeInfo_key_hint),
+        InheritedMembers_key(InheritedMembers_key,
+                             inheritedMembers_key_container,
+                             inheritedMembers_key_inheritedMembers),
+        MethodDeclaration_key(MethodDeclaration_key,
+                              methodDeclaration_key_name, methodDeclaration_key_container),
+        PropertyDeclaration_key(PropertyDeclaration_key,
+                                propertyDeclaration_key_name, propertyDeclaration_key_container),
+        TypeConstDeclaration_key(TypeConstDeclaration_key,
+                                 typeConstDeclaration_key_name, typeConstDeclaration_key_container),
+        ContainerChild_key(ContainerChild_key,
+                           containerChild_key_container, containerChild_key_child),
+        ConstraintKind(ConstraintKind_As, ConstraintKind_Equal,
+                       ConstraintKind_Super, ConstraintKind__UNKNOWN),
+        Constraint(Constraint, constraint_constraintKind, constraint_type,
+                   constraint_typeInfo),
+        TypeParameter(TypeParameter, typeParameter_name,
+                      typeParameter_variance, typeParameter_reifyKind,
+                      typeParameter_constraints, typeParameter_attributes),
+        FunctionDefinition_key(FunctionDefinition_key,
+                               functionDefinition_key_declaration,
+                               functionDefinition_key_signature, functionDefinition_key_isAsync,
+                               functionDefinition_key_attributes,
+                               functionDefinition_key_typeParams, functionDefinition_key_module_,
+                               functionDefinition_key_readonlyRet),
+        InterfaceDefinition_key(InterfaceDefinition_key,
+                                interfaceDefinition_key_declaration,
+                                interfaceDefinition_key_members, interfaceDefinition_key_extends_,
+                                interfaceDefinition_key_attributes,
+                                interfaceDefinition_key_typeParams,
+                                interfaceDefinition_key_requireExtends,
+                                interfaceDefinition_key_module_),
+        MethodDefinition_key(MethodDefinition_key,
+                             methodDefinition_key_declaration, methodDefinition_key_signature,
+                             methodDefinition_key_visibility, methodDefinition_key_isAbstract,
+                             methodDefinition_key_isAsync, methodDefinition_key_isFinal,
+                             methodDefinition_key_isStatic, methodDefinition_key_attributes,
+                             methodDefinition_key_typeParams,
+                             methodDefinition_key_isReadonlyThis,
+                             methodDefinition_key_readonlyRet),
+        TraitDefinition_key(TraitDefinition_key,
+                            traitDefinition_key_declaration, traitDefinition_key_members,
+                            traitDefinition_key_implements_, traitDefinition_key_uses,
+                            traitDefinition_key_attributes, traitDefinition_key_typeParams,
+                            traitDefinition_key_requireExtends,
+                            traitDefinition_key_requireImplements, traitDefinition_key_module_,
+                            traitDefinition_key_requireClass),
+        TypedefDefinition_key(TypedefDefinition_key,
+                              typedefDefinition_key_declaration,
+                              typedefDefinition_key_isTransparent,
+                              typedefDefinition_key_attributes, typedefDefinition_key_typeParams,
+                              typedefDefinition_key_module_),
+        ClassDefinition_key(ClassDefinition_key,
+                            classDefinition_key_declaration, classDefinition_key_isAbstract,
+                            classDefinition_key_isFinal, classDefinition_key_members,
+                            classDefinition_key_extends_, classDefinition_key_implements_,
+                            classDefinition_key_uses, classDefinition_key_attributes,
+                            classDefinition_key_typeParams, classDefinition_key_module_),
+        ClassDeclaration_key(ClassDeclaration_key,
+                             classDeclaration_key_name),
+        ClassConstDefinition_key(ClassConstDefinition_key,
+                                 classConstDefinition_key_declaration,
+                                 classConstDefinition_key_type, classConstDefinition_key_value,
+                                 classConstDefinition_key_typeInfo),
+        ClassConstDeclaration_key(ClassConstDeclaration_key,
+                                  classConstDeclaration_key_name,
+                                  classConstDeclaration_key_container),
+        AttributeToDefinition_key(AttributeToDefinition_key,
+                                  attributeToDefinition_key_attribute,
+                                  attributeToDefinition_key_definition),
+        AttributeToDeclaration_key(AttributeToDeclaration_key,
+                                   attributeToDeclaration_key_attribute,
+                                   attributeToDeclaration_key_declaration,
+                                   attributeToDeclaration_key_file),
+        AttributeHasParameter_key(AttributeHasParameter_key,
+                                  attributeHasParameter_key_name,
+                                  attributeHasParameter_key_parameter,
+                                  attributeHasParameter_key_attribute),
+        Argument(Argument_EMPTY, Argument_lit, Argument_xref),
+        CallArgument(CallArgument, callArgument_span,
+                     callArgument_argument),
+        FileCall_key(FileCall_key, fileCall_key_file,
+                     fileCall_key_callee_span, fileCall_key_call_args,
+                     fileCall_key_callee_xref, fileCall_key_dispatch_arg,
+                     fileCall_key_receiver_type, fileCall_key_callee_xrefs))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Fbthrift.Types
+       as Glean.Schema.Fbthrift
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Schema.Fbthrift.Types
+{-# LINE 16 "glean/schema/thrift/hack_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 669 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Hack/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("TargetUsesAbs", 6), ("ClassConstDeclaration", 6),
+       ("NamespaceQName", 6), ("TypedefDefinition", 6),
+       ("SearchClassConstByName", 6), ("InterfaceDefinition", 6),
+       ("SearchGlobalConstByLowerCaseName", 6),
+       ("FunctionDeclaration", 6), ("SearchTraitByLowerCaseName", 6),
+       ("EnumDefinition", 6), ("SearchEnumeratorByLowerCaseName", 6),
+       ("SearchMethodByName", 6), ("FileDeclarations", 6),
+       ("MethodDefinition", 6), ("InterfaceDeclaration", 6),
+       ("SearchEnumByName", 6), ("MethodOverrides", 6), ("Signature", 6),
+       ("TraitDefinition", 6), ("TargetUses", 6),
+       ("SearchClassByName", 6), ("SearchInterfaceByLowerCaseName", 6),
+       ("SearchFunctionByName", 6), ("ClassDefinition", 6),
+       ("NamespaceDeclaration", 6), ("Enumerator", 6),
+       ("SearchNamespaceByName", 6), ("NameLowerCase", 6),
+       ("StringLiteral", 6), ("GlobalNamespaceAlias", 6),
+       ("SearchInterfaceByName", 6), ("SearchClassByLowerCaseName", 6),
+       ("ContainerDeclarationQName", 6), ("UserAttribute", 6),
+       ("SearchPropertyByName", 6), ("DeclarationNamespace", 6),
+       ("ModuleDeclaration", 6), ("NamespaceMember", 6),
+       ("PropertyDefinition", 6), ("FunctionDefinition", 6),
+       ("SearchPropertyByLowerCaseName", 6),
+       ("GlobalConstDeclaration", 6), ("SearchGlobalConstByName", 6),
+       ("DeclarationSpan", 6), ("FileCall", 6), ("QName", 6),
+       ("HackToThrift", 6), ("TypedefDeclaration", 6),
+       ("ModuleParent", 6), ("ModuleChild", 6),
+       ("DeclarationLocation", 6), ("DeclarationSource", 6),
+       ("MethodOccurrence", 6), ("MemberCluster", 6),
+       ("SearchClassConstByLowerCaseName", 6), ("FileXRefs", 6),
+       ("TypeConstDeclaration", 6), ("DeclarationName", 6),
+       ("MethodOverridden", 6), ("DeclarationTarget", 6), ("Name", 6),
+       ("MethodDeclaration", 6), ("TraitDeclaration", 6),
+       ("SearchTypeConstByName", 6), ("ClassDeclaration", 6),
+       ("SearchTypedefByName", 6), ("IndexerInputsHash", 6),
+       ("SearchFunctionByLowerCaseName", 6),
+       ("SearchModuleByLowerCaseName", 6),
+       ("SearchNamespaceByLowerCaseName", 6),
+       ("SearchMethodByLowerCaseName", 6), ("ModuleDefinition", 6),
+       ("AttributeToDefinition", 6), ("Hint", 6), ("EnumDeclaration", 6),
+       ("ThriftToHack", 6), ("TypeInfo", 6), ("InheritedMembers", 6),
+       ("ContainerChild", 6), ("TypeConstDefinition", 6),
+       ("SearchEnumByLowerCaseName", 6), ("AttributeHasParameter", 6),
+       ("ContainerParent", 6), ("SearchTypeConstByLowerCaseName", 6),
+       ("SearchTraitByName", 6), ("DeclarationComment", 6),
+       ("AttributeToDeclaration", 6), ("SearchModuleByName", 6),
+       ("Type", 6), ("ClassConstDefinition", 6),
+       ("GlobalConstDefinition", 6), ("SearchEnumeratorByName", 6),
+       ("PropertyDeclaration", 6), ("SearchTypedefByLowerCaseName", 6),
+       ("Context_", 6)]
+
+type UserAttribute_id = Glean.Id
+
+data UserAttribute = UserAttribute{userAttribute_id ::
+                                   {-# UNPACK #-} !UserAttribute_id,
+                                   userAttribute_key :: Prelude.Maybe UserAttribute_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserAttribute where
+  toJSON (UserAttribute __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UserAttribute where
+  buildStruct _proxy (UserAttribute __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UserAttribute __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UserAttribute where
+  rnf (UserAttribute __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UserAttribute where
+  def = UserAttribute Default.def Prelude.Nothing
+
+instance Hashable.Hashable UserAttribute where
+  hashWithSalt __salt (UserAttribute _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypedefDeclaration_id = Glean.Id
+
+data TypedefDeclaration = TypedefDeclaration{typedefDeclaration_id
+                                             :: {-# UNPACK #-} !TypedefDeclaration_id,
+                                             typedefDeclaration_key ::
+                                             Prelude.Maybe TypedefDeclaration_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedefDeclaration where
+  toJSON (TypedefDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypedefDeclaration where
+  buildStruct _proxy (TypedefDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypedefDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypedefDeclaration where
+  rnf (TypedefDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypedefDeclaration where
+  def = TypedefDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypedefDeclaration where
+  hashWithSalt __salt (TypedefDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeConstDefinition_id = Glean.Id
+
+data TypeConstDefinition = TypeConstDefinition{typeConstDefinition_id
+                                               :: {-# UNPACK #-} !TypeConstDefinition_id,
+                                               typeConstDefinition_key ::
+                                               Prelude.Maybe TypeConstDefinition_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeConstDefinition where
+  toJSON (TypeConstDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeConstDefinition where
+  buildStruct _proxy (TypeConstDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeConstDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeConstDefinition where
+  rnf (TypeConstDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeConstDefinition where
+  def = TypeConstDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeConstDefinition where
+  hashWithSalt __salt (TypeConstDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TraitDeclaration_id = Glean.Id
+
+data TraitDeclaration = TraitDeclaration{traitDeclaration_id ::
+                                         {-# UNPACK #-} !TraitDeclaration_id,
+                                         traitDeclaration_key :: Prelude.Maybe TraitDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TraitDeclaration where
+  toJSON (TraitDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TraitDeclaration where
+  buildStruct _proxy (TraitDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TraitDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TraitDeclaration where
+  rnf (TraitDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TraitDeclaration where
+  def = TraitDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TraitDeclaration where
+  hashWithSalt __salt (TraitDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StringLiteral_id = Glean.Id
+
+data StringLiteral = StringLiteral{stringLiteral_id ::
+                                   {-# UNPACK #-} !StringLiteral_id,
+                                   stringLiteral_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringLiteral where
+  toJSON (StringLiteral __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StringLiteral where
+  buildStruct _proxy (StringLiteral __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StringLiteral __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringLiteral where
+  rnf (StringLiteral __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StringLiteral where
+  def = StringLiteral Default.def Prelude.Nothing
+
+instance Hashable.Hashable StringLiteral where
+  hashWithSalt __salt (StringLiteral _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypedefByLowerCaseName_id = Glean.Id
+
+data SearchTypedefByLowerCaseName = SearchTypedefByLowerCaseName{searchTypedefByLowerCaseName_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !SearchTypedefByLowerCaseName_id,
+                                                                 searchTypedefByLowerCaseName_key ::
+                                                                 Prelude.Maybe
+                                                                   SearchTypedefByLowerCaseName_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypedefByLowerCaseName where
+  toJSON (SearchTypedefByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypedefByLowerCaseName where
+  buildStruct _proxy
+    (SearchTypedefByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypedefByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypedefByLowerCaseName where
+  rnf (SearchTypedefByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypedefByLowerCaseName where
+  def = SearchTypedefByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypedefByLowerCaseName where
+  hashWithSalt __salt (SearchTypedefByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypeConstByLowerCaseName_id = Glean.Id
+
+data SearchTypeConstByLowerCaseName = SearchTypeConstByLowerCaseName{searchTypeConstByLowerCaseName_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !SearchTypeConstByLowerCaseName_id,
+                                                                     searchTypeConstByLowerCaseName_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       SearchTypeConstByLowerCaseName_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeConstByLowerCaseName where
+  toJSON (SearchTypeConstByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeConstByLowerCaseName where
+  buildStruct _proxy
+    (SearchTypeConstByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeConstByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeConstByLowerCaseName where
+  rnf (SearchTypeConstByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeConstByLowerCaseName where
+  def = SearchTypeConstByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeConstByLowerCaseName where
+  hashWithSalt __salt (SearchTypeConstByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTraitByLowerCaseName_id = Glean.Id
+
+data SearchTraitByLowerCaseName = SearchTraitByLowerCaseName{searchTraitByLowerCaseName_id
+                                                             ::
+                                                             {-# UNPACK #-} !SearchTraitByLowerCaseName_id,
+                                                             searchTraitByLowerCaseName_key ::
+                                                             Prelude.Maybe
+                                                               SearchTraitByLowerCaseName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTraitByLowerCaseName where
+  toJSON (SearchTraitByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTraitByLowerCaseName where
+  buildStruct _proxy
+    (SearchTraitByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTraitByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTraitByLowerCaseName where
+  rnf (SearchTraitByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTraitByLowerCaseName where
+  def = SearchTraitByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTraitByLowerCaseName where
+  hashWithSalt __salt (SearchTraitByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchPropertyByLowerCaseName_id = Glean.Id
+
+data SearchPropertyByLowerCaseName = SearchPropertyByLowerCaseName{searchPropertyByLowerCaseName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchPropertyByLowerCaseName_id,
+                                                                   searchPropertyByLowerCaseName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchPropertyByLowerCaseName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyByLowerCaseName where
+  toJSON (SearchPropertyByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchPropertyByLowerCaseName where
+  buildStruct _proxy
+    (SearchPropertyByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchPropertyByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyByLowerCaseName where
+  rnf (SearchPropertyByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchPropertyByLowerCaseName where
+  def = SearchPropertyByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchPropertyByLowerCaseName where
+  hashWithSalt __salt (SearchPropertyByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchNamespaceByLowerCaseName_id = Glean.Id
+
+data SearchNamespaceByLowerCaseName = SearchNamespaceByLowerCaseName{searchNamespaceByLowerCaseName_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !SearchNamespaceByLowerCaseName_id,
+                                                                     searchNamespaceByLowerCaseName_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       SearchNamespaceByLowerCaseName_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespaceByLowerCaseName where
+  toJSON (SearchNamespaceByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNamespaceByLowerCaseName where
+  buildStruct _proxy
+    (SearchNamespaceByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchNamespaceByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespaceByLowerCaseName where
+  rnf (SearchNamespaceByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchNamespaceByLowerCaseName where
+  def = SearchNamespaceByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchNamespaceByLowerCaseName where
+  hashWithSalt __salt (SearchNamespaceByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModuleByLowerCaseName_id = Glean.Id
+
+data SearchModuleByLowerCaseName = SearchModuleByLowerCaseName{searchModuleByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchModuleByLowerCaseName_id,
+                                                               searchModuleByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchModuleByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName where
+  toJSON (SearchModuleByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName where
+  rnf (SearchModuleByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName where
+  def = SearchModuleByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModuleByLowerCaseName where
+  hashWithSalt __salt (SearchModuleByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMethodByLowerCaseName_id = Glean.Id
+
+data SearchMethodByLowerCaseName = SearchMethodByLowerCaseName{searchMethodByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchMethodByLowerCaseName_id,
+                                                               searchMethodByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchMethodByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByLowerCaseName where
+  toJSON (SearchMethodByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByLowerCaseName where
+  buildStruct _proxy
+    (SearchMethodByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchMethodByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByLowerCaseName where
+  rnf (SearchMethodByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMethodByLowerCaseName where
+  def = SearchMethodByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchMethodByLowerCaseName where
+  hashWithSalt __salt (SearchMethodByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInterfaceByLowerCaseName_id = Glean.Id
+
+data SearchInterfaceByLowerCaseName = SearchInterfaceByLowerCaseName{searchInterfaceByLowerCaseName_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !SearchInterfaceByLowerCaseName_id,
+                                                                     searchInterfaceByLowerCaseName_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       SearchInterfaceByLowerCaseName_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInterfaceByLowerCaseName where
+  toJSON (SearchInterfaceByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInterfaceByLowerCaseName where
+  buildStruct _proxy
+    (SearchInterfaceByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInterfaceByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInterfaceByLowerCaseName where
+  rnf (SearchInterfaceByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInterfaceByLowerCaseName where
+  def = SearchInterfaceByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInterfaceByLowerCaseName where
+  hashWithSalt __salt (SearchInterfaceByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchGlobalConstByLowerCaseName_id = Glean.Id
+
+data SearchGlobalConstByLowerCaseName = SearchGlobalConstByLowerCaseName{searchGlobalConstByLowerCaseName_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !SearchGlobalConstByLowerCaseName_id,
+                                                                         searchGlobalConstByLowerCaseName_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           SearchGlobalConstByLowerCaseName_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstByLowerCaseName where
+  toJSON (SearchGlobalConstByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchGlobalConstByLowerCaseName where
+  buildStruct _proxy
+    (SearchGlobalConstByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchGlobalConstByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstByLowerCaseName where
+  rnf (SearchGlobalConstByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstByLowerCaseName where
+  def = SearchGlobalConstByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchGlobalConstByLowerCaseName where
+  hashWithSalt __salt (SearchGlobalConstByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFunctionByLowerCaseName_id = Glean.Id
+
+data SearchFunctionByLowerCaseName = SearchFunctionByLowerCaseName{searchFunctionByLowerCaseName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchFunctionByLowerCaseName_id,
+                                                                   searchFunctionByLowerCaseName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchFunctionByLowerCaseName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByLowerCaseName where
+  toJSON (SearchFunctionByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByLowerCaseName where
+  buildStruct _proxy
+    (SearchFunctionByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFunctionByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByLowerCaseName where
+  rnf (SearchFunctionByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByLowerCaseName where
+  def = SearchFunctionByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFunctionByLowerCaseName where
+  hashWithSalt __salt (SearchFunctionByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchEnumeratorByLowerCaseName_id = Glean.Id
+
+data SearchEnumeratorByLowerCaseName = SearchEnumeratorByLowerCaseName{searchEnumeratorByLowerCaseName_id
+                                                                       ::
+                                                                       {-# UNPACK #-} !SearchEnumeratorByLowerCaseName_id,
+                                                                       searchEnumeratorByLowerCaseName_key
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         SearchEnumeratorByLowerCaseName_key}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumeratorByLowerCaseName where
+  toJSON (SearchEnumeratorByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumeratorByLowerCaseName where
+  buildStruct _proxy
+    (SearchEnumeratorByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchEnumeratorByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumeratorByLowerCaseName where
+  rnf (SearchEnumeratorByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchEnumeratorByLowerCaseName where
+  def = SearchEnumeratorByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchEnumeratorByLowerCaseName where
+  hashWithSalt __salt (SearchEnumeratorByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchEnumByLowerCaseName_id = Glean.Id
+
+data SearchEnumByLowerCaseName = SearchEnumByLowerCaseName{searchEnumByLowerCaseName_id
+                                                           ::
+                                                           {-# UNPACK #-} !SearchEnumByLowerCaseName_id,
+                                                           searchEnumByLowerCaseName_key ::
+                                                           Prelude.Maybe
+                                                             SearchEnumByLowerCaseName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumByLowerCaseName where
+  toJSON (SearchEnumByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumByLowerCaseName where
+  buildStruct _proxy
+    (SearchEnumByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchEnumByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumByLowerCaseName where
+  rnf (SearchEnumByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchEnumByLowerCaseName where
+  def = SearchEnumByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchEnumByLowerCaseName where
+  hashWithSalt __salt (SearchEnumByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassConstByLowerCaseName_id = Glean.Id
+
+data SearchClassConstByLowerCaseName = SearchClassConstByLowerCaseName{searchClassConstByLowerCaseName_id
+                                                                       ::
+                                                                       {-# UNPACK #-} !SearchClassConstByLowerCaseName_id,
+                                                                       searchClassConstByLowerCaseName_key
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         SearchClassConstByLowerCaseName_key}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassConstByLowerCaseName where
+  toJSON (SearchClassConstByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassConstByLowerCaseName where
+  buildStruct _proxy
+    (SearchClassConstByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchClassConstByLowerCaseName __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassConstByLowerCaseName where
+  rnf (SearchClassConstByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassConstByLowerCaseName where
+  def = SearchClassConstByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassConstByLowerCaseName where
+  hashWithSalt __salt (SearchClassConstByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassByLowerCaseName_id = Glean.Id
+
+data SearchClassByLowerCaseName = SearchClassByLowerCaseName{searchClassByLowerCaseName_id
+                                                             ::
+                                                             {-# UNPACK #-} !SearchClassByLowerCaseName_id,
+                                                             searchClassByLowerCaseName_key ::
+                                                             Prelude.Maybe
+                                                               SearchClassByLowerCaseName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByLowerCaseName where
+  toJSON (SearchClassByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByLowerCaseName where
+  buildStruct _proxy
+    (SearchClassByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchClassByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByLowerCaseName where
+  rnf (SearchClassByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassByLowerCaseName where
+  def = SearchClassByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassByLowerCaseName where
+  hashWithSalt __salt (SearchClassByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QName_id = Glean.Id
+
+data QName = QName{qName_id :: {-# UNPACK #-} !QName_id,
+                   qName_key :: Prelude.Maybe QName_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName where
+  toJSON (QName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QName where
+  buildStruct _proxy (QName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName where
+  rnf (QName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QName where
+  def = QName Default.def Prelude.Nothing
+
+instance Hashable.Hashable QName where
+  hashWithSalt __salt (QName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PropertyDefinition_id = Glean.Id
+
+data PropertyDefinition = PropertyDefinition{propertyDefinition_id
+                                             :: {-# UNPACK #-} !PropertyDefinition_id,
+                                             propertyDefinition_key ::
+                                             Prelude.Maybe PropertyDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PropertyDefinition where
+  toJSON (PropertyDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PropertyDefinition where
+  buildStruct _proxy (PropertyDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PropertyDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PropertyDefinition where
+  rnf (PropertyDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PropertyDefinition where
+  def = PropertyDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable PropertyDefinition where
+  hashWithSalt __salt (PropertyDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Signature_id = Glean.Id
+
+data Signature = Signature{signature_id ::
+                           {-# UNPACK #-} !Signature_id,
+                           signature_key :: Prelude.Maybe Signature_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Signature where
+  toJSON (Signature __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Signature where
+  buildStruct _proxy (Signature __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Signature __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Signature where
+  rnf (Signature __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Signature where
+  def = Signature Default.def Prelude.Nothing
+
+instance Hashable.Hashable Signature where
+  hashWithSalt __salt (Signature _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceQName_id = Glean.Id
+
+data NamespaceQName = NamespaceQName{namespaceQName_id ::
+                                     {-# UNPACK #-} !NamespaceQName_id,
+                                     namespaceQName_key :: Prelude.Maybe NamespaceQName_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceQName where
+  toJSON (NamespaceQName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceQName where
+  buildStruct _proxy (NamespaceQName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceQName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceQName where
+  rnf (NamespaceQName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceQName where
+  def = NamespaceQName Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceQName where
+  hashWithSalt __salt (NamespaceQName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceDeclaration_id = Glean.Id
+
+data NamespaceDeclaration = NamespaceDeclaration{namespaceDeclaration_id
+                                                 :: {-# UNPACK #-} !NamespaceDeclaration_id,
+                                                 namespaceDeclaration_key ::
+                                                 Prelude.Maybe NamespaceDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclaration where
+  toJSON (NamespaceDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclaration where
+  buildStruct _proxy (NamespaceDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NamespaceDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclaration where
+  rnf (NamespaceDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclaration where
+  def = NamespaceDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceDeclaration where
+  hashWithSalt __salt (NamespaceDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleDefinition_id = Glean.Id
+
+data ModuleDefinition = ModuleDefinition{moduleDefinition_id ::
+                                         {-# UNPACK #-} !ModuleDefinition_id,
+                                         moduleDefinition_key :: Prelude.Maybe ModuleDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDefinition where
+  toJSON (ModuleDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDefinition where
+  buildStruct _proxy (ModuleDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDefinition where
+  rnf (ModuleDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleDefinition where
+  def = ModuleDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleDefinition where
+  hashWithSalt __salt (ModuleDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleDeclaration_id = Glean.Id
+
+data ModuleDeclaration = ModuleDeclaration{moduleDeclaration_id ::
+                                           {-# UNPACK #-} !ModuleDeclaration_id,
+                                           moduleDeclaration_key ::
+                                           Prelude.Maybe ModuleDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDeclaration where
+  toJSON (ModuleDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDeclaration where
+  buildStruct _proxy (ModuleDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDeclaration where
+  rnf (ModuleDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleDeclaration where
+  def = ModuleDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleDeclaration where
+  hashWithSalt __salt (ModuleDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverrides_id = Glean.Id
+
+data MethodOverrides = MethodOverrides{methodOverrides_id ::
+                                       {-# UNPACK #-} !MethodOverrides_id,
+                                       methodOverrides_key :: Prelude.Maybe MethodOverrides_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides where
+  toJSON (MethodOverrides __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides where
+  buildStruct _proxy (MethodOverrides __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverrides __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides where
+  rnf (MethodOverrides __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverrides where
+  def = MethodOverrides Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverrides where
+  hashWithSalt __salt (MethodOverrides _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverridden_id = Glean.Id
+
+data MethodOverridden = MethodOverridden{methodOverridden_id ::
+                                         {-# UNPACK #-} !MethodOverridden_id,
+                                         methodOverridden_key :: Prelude.Maybe MethodOverridden_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverridden where
+  toJSON (MethodOverridden __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverridden where
+  buildStruct _proxy (MethodOverridden __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverridden __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverridden where
+  rnf (MethodOverridden __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverridden where
+  def = MethodOverridden Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverridden where
+  hashWithSalt __salt (MethodOverridden _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOccurrence_id = Glean.Id
+
+data MethodOccurrence = MethodOccurrence{methodOccurrence_id ::
+                                         {-# UNPACK #-} !MethodOccurrence_id,
+                                         methodOccurrence_key :: Prelude.Maybe MethodOccurrence_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOccurrence where
+  toJSON (MethodOccurrence __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOccurrence where
+  buildStruct _proxy (MethodOccurrence __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOccurrence __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOccurrence where
+  rnf (MethodOccurrence __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOccurrence where
+  def = MethodOccurrence Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOccurrence where
+  hashWithSalt __salt (MethodOccurrence _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InterfaceDeclaration_id = Glean.Id
+
+data InterfaceDeclaration = InterfaceDeclaration{interfaceDeclaration_id
+                                                 :: {-# UNPACK #-} !InterfaceDeclaration_id,
+                                                 interfaceDeclaration_key ::
+                                                 Prelude.Maybe InterfaceDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDeclaration where
+  toJSON (InterfaceDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceDeclaration where
+  buildStruct _proxy (InterfaceDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (InterfaceDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDeclaration where
+  rnf (InterfaceDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InterfaceDeclaration where
+  def = InterfaceDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable InterfaceDeclaration where
+  hashWithSalt __salt (InterfaceDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IndexerInputsHash_id = Glean.Id
+
+data IndexerInputsHash = IndexerInputsHash{indexerInputsHash_id ::
+                                           {-# UNPACK #-} !IndexerInputsHash_id,
+                                           indexerInputsHash_key :: Prelude.Maybe Text.Text,
+                                           indexerInputsHash_value ::
+                                           Prelude.Maybe IndexerInputsHash_value}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexerInputsHash where
+  toJSON (IndexerInputsHash __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=))
+                (Prelude.fmap Thrift.encodeBase64Text __field__value)
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct IndexerInputsHash where
+  buildStruct _proxy
+    (IndexerInputsHash __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStringType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genText _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStringType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.genBytes _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (IndexerInputsHash __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexerInputsHash where
+  rnf (IndexerInputsHash __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default IndexerInputsHash where
+  def = IndexerInputsHash Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable IndexerInputsHash where
+  hashWithSalt __salt (IndexerInputsHash _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type GlobalNamespaceAlias_id = Glean.Id
+
+data GlobalNamespaceAlias = GlobalNamespaceAlias{globalNamespaceAlias_id
+                                                 :: {-# UNPACK #-} !GlobalNamespaceAlias_id,
+                                                 globalNamespaceAlias_key ::
+                                                 Prelude.Maybe GlobalNamespaceAlias_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalNamespaceAlias where
+  toJSON (GlobalNamespaceAlias __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalNamespaceAlias where
+  buildStruct _proxy (GlobalNamespaceAlias __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GlobalNamespaceAlias __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalNamespaceAlias where
+  rnf (GlobalNamespaceAlias __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GlobalNamespaceAlias where
+  def = GlobalNamespaceAlias Default.def Prelude.Nothing
+
+instance Hashable.Hashable GlobalNamespaceAlias where
+  hashWithSalt __salt (GlobalNamespaceAlias _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GlobalConstDefinition_id = Glean.Id
+
+data GlobalConstDefinition = GlobalConstDefinition{globalConstDefinition_id
+                                                   :: {-# UNPACK #-} !GlobalConstDefinition_id,
+                                                   globalConstDefinition_key ::
+                                                   Prelude.Maybe GlobalConstDefinition_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalConstDefinition where
+  toJSON (GlobalConstDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalConstDefinition where
+  buildStruct _proxy (GlobalConstDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GlobalConstDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalConstDefinition where
+  rnf (GlobalConstDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GlobalConstDefinition where
+  def = GlobalConstDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable GlobalConstDefinition where
+  hashWithSalt __salt (GlobalConstDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GlobalConstDeclaration_id = Glean.Id
+
+data GlobalConstDeclaration = GlobalConstDeclaration{globalConstDeclaration_id
+                                                     :: {-# UNPACK #-} !GlobalConstDeclaration_id,
+                                                     globalConstDeclaration_key ::
+                                                     Prelude.Maybe GlobalConstDeclaration_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalConstDeclaration where
+  toJSON (GlobalConstDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalConstDeclaration where
+  buildStruct _proxy
+    (GlobalConstDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GlobalConstDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalConstDeclaration where
+  rnf (GlobalConstDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GlobalConstDeclaration where
+  def = GlobalConstDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable GlobalConstDeclaration where
+  hashWithSalt __salt (GlobalConstDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclaration_id = Glean.Id
+
+data FunctionDeclaration = FunctionDeclaration{functionDeclaration_id
+                                               :: {-# UNPACK #-} !FunctionDeclaration_id,
+                                               functionDeclaration_key ::
+                                               Prelude.Maybe FunctionDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration where
+  toJSON (FunctionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration where
+  buildStruct _proxy (FunctionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration where
+  rnf (FunctionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration where
+  def = FunctionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclaration where
+  hashWithSalt __salt (FunctionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Hint_id = Glean.Id
+
+data Hint = Hint{hint_id :: {-# UNPACK #-} !Hint_id,
+                 hint_key :: Prelude.Maybe Hint_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint where
+  toJSON (Hint __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Hint where
+  buildStruct _proxy (Hint __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Hint __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Hint where
+  rnf (Hint __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Hint where
+  def = Hint Default.def Prelude.Nothing
+
+instance Hashable.Hashable Hint where
+  hashWithSalt __salt (Hint _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Enumerator_id = Glean.Id
+
+data Enumerator = Enumerator{enumerator_id ::
+                             {-# UNPACK #-} !Enumerator_id,
+                             enumerator_key :: Prelude.Maybe Enumerator_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enumerator where
+  toJSON (Enumerator __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Enumerator where
+  buildStruct _proxy (Enumerator __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Enumerator __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Enumerator where
+  rnf (Enumerator __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Enumerator where
+  def = Enumerator Default.def Prelude.Nothing
+
+instance Hashable.Hashable Enumerator where
+  hashWithSalt __salt (Enumerator _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDefinition_id = Glean.Id
+
+data EnumDefinition = EnumDefinition{enumDefinition_id ::
+                                     {-# UNPACK #-} !EnumDefinition_id,
+                                     enumDefinition_key :: Prelude.Maybe EnumDefinition_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDefinition where
+  toJSON (EnumDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDefinition where
+  buildStruct _proxy (EnumDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDefinition where
+  rnf (EnumDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDefinition where
+  def = EnumDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDefinition where
+  hashWithSalt __salt (EnumDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDeclaration_id = Glean.Id
+
+data EnumDeclaration = EnumDeclaration{enumDeclaration_id ::
+                                       {-# UNPACK #-} !EnumDeclaration_id,
+                                       enumDeclaration_key :: Prelude.Maybe EnumDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration where
+  toJSON (EnumDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclaration where
+  buildStruct _proxy (EnumDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration where
+  rnf (EnumDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration where
+  def = EnumDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDeclaration where
+  hashWithSalt __salt (EnumDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Context__id = Glean.Id
+
+data Context_ = Context_{context__id ::
+                         {-# UNPACK #-} !Context__id,
+                         context__key :: Prelude.Maybe Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Context_ where
+  toJSON (Context_ __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Context_ where
+  buildStruct _proxy (Context_ __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Context_ __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Context_ where
+  rnf (Context_ __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Context_ where
+  def = Context_ Default.def Prelude.Nothing
+
+instance Hashable.Hashable Context_ where
+  hashWithSalt __salt (Context_ _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainerDeclarationQName_id = Glean.Id
+
+data ContainerDeclarationQName = ContainerDeclarationQName{containerDeclarationQName_id
+                                                           ::
+                                                           {-# UNPACK #-} !ContainerDeclarationQName_id,
+                                                           containerDeclarationQName_key ::
+                                                           Prelude.Maybe ContainerDeclaration,
+                                                           containerDeclarationQName_value ::
+                                                           Prelude.Maybe
+                                                             ContainerDeclarationQName_value}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerDeclarationQName where
+  toJSON
+    (ContainerDeclarationQName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct ContainerDeclarationQName where
+  buildStruct _proxy
+    (ContainerDeclarationQName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (ContainerDeclarationQName __val__id __val__key
+                                                  __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainerDeclarationQName where
+  rnf
+    (ContainerDeclarationQName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default ContainerDeclarationQName where
+  def
+    = ContainerDeclarationQName Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable ContainerDeclarationQName where
+  hashWithSalt __salt (ContainerDeclarationQName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type ContainerParent_id = Glean.Id
+
+data ContainerParent = ContainerParent{containerParent_id ::
+                                       {-# UNPACK #-} !ContainerParent_id,
+                                       containerParent_key :: Prelude.Maybe ContainerParent_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerParent where
+  toJSON (ContainerParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainerParent where
+  buildStruct _proxy (ContainerParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainerParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainerParent where
+  rnf (ContainerParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainerParent where
+  def = ContainerParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainerParent where
+  hashWithSalt __salt (ContainerParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationComment_id = Glean.Id
+
+data DeclarationComment = DeclarationComment{declarationComment_id
+                                             :: {-# UNPACK #-} !DeclarationComment_id,
+                                             declarationComment_key ::
+                                             Prelude.Maybe DeclarationComment_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment where
+  toJSON (DeclarationComment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment where
+  buildStruct _proxy (DeclarationComment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationComment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment where
+  rnf (DeclarationComment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationComment where
+  def = DeclarationComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment where
+  hashWithSalt __salt (DeclarationComment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationName_id = Glean.Id
+
+data DeclarationName = DeclarationName{declarationName_id ::
+                                       {-# UNPACK #-} !DeclarationName_id,
+                                       declarationName_key :: Prelude.Maybe Declaration,
+                                       declarationName_value :: Prelude.Maybe DeclarationName_value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationName where
+  toJSON (DeclarationName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationName where
+  buildStruct _proxy
+    (DeclarationName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DeclarationName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationName where
+  rnf (DeclarationName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DeclarationName where
+  def = DeclarationName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DeclarationName where
+  hashWithSalt __salt (DeclarationName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DeclarationNamespace_id = Glean.Id
+
+data DeclarationNamespace = DeclarationNamespace{declarationNamespace_id
+                                                 :: {-# UNPACK #-} !DeclarationNamespace_id,
+                                                 declarationNamespace_key ::
+                                                 Prelude.Maybe DeclarationNamespace_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNamespace where
+  toJSON (DeclarationNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNamespace where
+  buildStruct _proxy (DeclarationNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNamespace where
+  rnf (DeclarationNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationNamespace where
+  def = DeclarationNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationNamespace where
+  hashWithSalt __salt (DeclarationNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSource_id = Glean.Id
+
+data DeclarationSource = DeclarationSource{declarationSource_id ::
+                                           {-# UNPACK #-} !DeclarationSource_id,
+                                           declarationSource_key ::
+                                           Prelude.Maybe DeclarationSource_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSource where
+  toJSON (DeclarationSource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSource where
+  buildStruct _proxy (DeclarationSource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationSource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSource where
+  rnf (DeclarationSource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSource where
+  def = DeclarationSource Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSource where
+  hashWithSalt __salt (DeclarationSource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSpan_id = Glean.Id
+
+data DeclarationSpan = DeclarationSpan{declarationSpan_id ::
+                                       {-# UNPACK #-} !DeclarationSpan_id,
+                                       declarationSpan_key :: Prelude.Maybe DeclarationSpan_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSpan where
+  toJSON (DeclarationSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSpan where
+  buildStruct _proxy (DeclarationSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSpan where
+  rnf (DeclarationSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSpan where
+  def = DeclarationSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSpan where
+  hashWithSalt __salt (DeclarationSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationTarget_id = Glean.Id
+
+data DeclarationTarget = DeclarationTarget{declarationTarget_id ::
+                                           {-# UNPACK #-} !DeclarationTarget_id,
+                                           declarationTarget_key ::
+                                           Prelude.Maybe DeclarationTarget_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationTarget where
+  toJSON (DeclarationTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationTarget where
+  buildStruct _proxy (DeclarationTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationTarget where
+  rnf (DeclarationTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationTarget where
+  def = DeclarationTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationTarget where
+  hashWithSalt __salt (DeclarationTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclarations_id = Glean.Id
+
+data FileDeclarations = FileDeclarations{fileDeclarations_id ::
+                                         {-# UNPACK #-} !FileDeclarations_id,
+                                         fileDeclarations_key :: Prelude.Maybe FileDeclarations_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations where
+  toJSON (FileDeclarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations where
+  buildStruct _proxy (FileDeclarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations where
+  rnf (FileDeclarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclarations where
+  def = FileDeclarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclarations where
+  hashWithSalt __salt (FileDeclarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackToThrift_id = Glean.Id
+
+data HackToThrift = HackToThrift{hackToThrift_id ::
+                                 {-# UNPACK #-} !HackToThrift_id,
+                                 hackToThrift_key :: Prelude.Maybe HackToThrift_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackToThrift where
+  toJSON (HackToThrift __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackToThrift where
+  buildStruct _proxy (HackToThrift __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackToThrift __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackToThrift where
+  rnf (HackToThrift __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackToThrift where
+  def = HackToThrift Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackToThrift where
+  hashWithSalt __salt (HackToThrift _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MemberCluster_id = Glean.Id
+
+data MemberCluster = MemberCluster{memberCluster_id ::
+                                   {-# UNPACK #-} !MemberCluster_id,
+                                   memberCluster_key :: Prelude.Maybe MemberCluster_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberCluster where
+  toJSON (MemberCluster __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberCluster where
+  buildStruct _proxy (MemberCluster __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MemberCluster __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberCluster where
+  rnf (MemberCluster __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MemberCluster where
+  def = MemberCluster Default.def Prelude.Nothing
+
+instance Hashable.Hashable MemberCluster where
+  hashWithSalt __salt (MemberCluster _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleChild_id = Glean.Id
+
+data ModuleChild = ModuleChild{moduleChild_id ::
+                               {-# UNPACK #-} !ModuleChild_id,
+                               moduleChild_key :: Prelude.Maybe ModuleChild_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleChild where
+  toJSON (ModuleChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleChild where
+  buildStruct _proxy (ModuleChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleChild where
+  rnf (ModuleChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleChild where
+  def = ModuleChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleChild where
+  hashWithSalt __salt (ModuleChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleParent_id = Glean.Id
+
+data ModuleParent = ModuleParent{moduleParent_id ::
+                                 {-# UNPACK #-} !ModuleParent_id,
+                                 moduleParent_key :: Prelude.Maybe ModuleParent_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleParent where
+  toJSON (ModuleParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleParent where
+  buildStruct _proxy (ModuleParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleParent where
+  rnf (ModuleParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleParent where
+  def = ModuleParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleParent where
+  hashWithSalt __salt (ModuleParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NamespaceMember_id = Glean.Id
+
+data NamespaceMember = NamespaceMember{namespaceMember_id ::
+                                       {-# UNPACK #-} !NamespaceMember_id,
+                                       namespaceMember_key :: Prelude.Maybe NamespaceMember_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceMember where
+  toJSON (NamespaceMember __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceMember where
+  buildStruct _proxy (NamespaceMember __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NamespaceMember __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceMember where
+  rnf (NamespaceMember __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NamespaceMember where
+  def = NamespaceMember Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceMember where
+  hashWithSalt __salt (NamespaceMember _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassByName_id = Glean.Id
+
+data SearchClassByName = SearchClassByName{searchClassByName_id ::
+                                           {-# UNPACK #-} !SearchClassByName_id,
+                                           searchClassByName_key ::
+                                           Prelude.Maybe SearchClassByName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByName where
+  toJSON (SearchClassByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByName where
+  buildStruct _proxy (SearchClassByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchClassByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByName where
+  rnf (SearchClassByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassByName where
+  def = SearchClassByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassByName where
+  hashWithSalt __salt (SearchClassByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassConstByName_id = Glean.Id
+
+data SearchClassConstByName = SearchClassConstByName{searchClassConstByName_id
+                                                     :: {-# UNPACK #-} !SearchClassConstByName_id,
+                                                     searchClassConstByName_key ::
+                                                     Prelude.Maybe SearchClassConstByName_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassConstByName where
+  toJSON (SearchClassConstByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassConstByName where
+  buildStruct _proxy
+    (SearchClassConstByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchClassConstByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassConstByName where
+  rnf (SearchClassConstByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassConstByName where
+  def = SearchClassConstByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassConstByName where
+  hashWithSalt __salt (SearchClassConstByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchEnumByName_id = Glean.Id
+
+data SearchEnumByName = SearchEnumByName{searchEnumByName_id ::
+                                         {-# UNPACK #-} !SearchEnumByName_id,
+                                         searchEnumByName_key :: Prelude.Maybe SearchEnumByName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumByName where
+  toJSON (SearchEnumByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumByName where
+  buildStruct _proxy (SearchEnumByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchEnumByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumByName where
+  rnf (SearchEnumByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchEnumByName where
+  def = SearchEnumByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchEnumByName where
+  hashWithSalt __salt (SearchEnumByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchEnumeratorByName_id = Glean.Id
+
+data SearchEnumeratorByName = SearchEnumeratorByName{searchEnumeratorByName_id
+                                                     :: {-# UNPACK #-} !SearchEnumeratorByName_id,
+                                                     searchEnumeratorByName_key ::
+                                                     Prelude.Maybe SearchEnumeratorByName_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumeratorByName where
+  toJSON (SearchEnumeratorByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumeratorByName where
+  buildStruct _proxy
+    (SearchEnumeratorByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchEnumeratorByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumeratorByName where
+  rnf (SearchEnumeratorByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchEnumeratorByName where
+  def = SearchEnumeratorByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchEnumeratorByName where
+  hashWithSalt __salt (SearchEnumeratorByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFunctionByName_id = Glean.Id
+
+data SearchFunctionByName = SearchFunctionByName{searchFunctionByName_id
+                                                 :: {-# UNPACK #-} !SearchFunctionByName_id,
+                                                 searchFunctionByName_key ::
+                                                 Prelude.Maybe SearchFunctionByName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByName where
+  toJSON (SearchFunctionByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByName where
+  buildStruct _proxy (SearchFunctionByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFunctionByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByName where
+  rnf (SearchFunctionByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByName where
+  def = SearchFunctionByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFunctionByName where
+  hashWithSalt __salt (SearchFunctionByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchGlobalConstByName_id = Glean.Id
+
+data SearchGlobalConstByName = SearchGlobalConstByName{searchGlobalConstByName_id
+                                                       ::
+                                                       {-# UNPACK #-} !SearchGlobalConstByName_id,
+                                                       searchGlobalConstByName_key ::
+                                                       Prelude.Maybe SearchGlobalConstByName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstByName where
+  toJSON (SearchGlobalConstByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchGlobalConstByName where
+  buildStruct _proxy
+    (SearchGlobalConstByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchGlobalConstByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstByName where
+  rnf (SearchGlobalConstByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstByName where
+  def = SearchGlobalConstByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchGlobalConstByName where
+  hashWithSalt __salt (SearchGlobalConstByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInterfaceByName_id = Glean.Id
+
+data SearchInterfaceByName = SearchInterfaceByName{searchInterfaceByName_id
+                                                   :: {-# UNPACK #-} !SearchInterfaceByName_id,
+                                                   searchInterfaceByName_key ::
+                                                   Prelude.Maybe SearchInterfaceByName_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInterfaceByName where
+  toJSON (SearchInterfaceByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInterfaceByName where
+  buildStruct _proxy (SearchInterfaceByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInterfaceByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInterfaceByName where
+  rnf (SearchInterfaceByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInterfaceByName where
+  def = SearchInterfaceByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInterfaceByName where
+  hashWithSalt __salt (SearchInterfaceByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMethodByName_id = Glean.Id
+
+data SearchMethodByName = SearchMethodByName{searchMethodByName_id
+                                             :: {-# UNPACK #-} !SearchMethodByName_id,
+                                             searchMethodByName_key ::
+                                             Prelude.Maybe SearchMethodByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByName where
+  toJSON (SearchMethodByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByName where
+  buildStruct _proxy (SearchMethodByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchMethodByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByName where
+  rnf (SearchMethodByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMethodByName where
+  def = SearchMethodByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchMethodByName where
+  hashWithSalt __salt (SearchMethodByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModuleByName_id = Glean.Id
+
+data SearchModuleByName = SearchModuleByName{searchModuleByName_id
+                                             :: {-# UNPACK #-} !SearchModuleByName_id,
+                                             searchModuleByName_key ::
+                                             Prelude.Maybe SearchModuleByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByName where
+  toJSON (SearchModuleByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByName where
+  buildStruct _proxy (SearchModuleByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchModuleByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByName where
+  rnf (SearchModuleByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModuleByName where
+  def = SearchModuleByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModuleByName where
+  hashWithSalt __salt (SearchModuleByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchNamespaceByName_id = Glean.Id
+
+data SearchNamespaceByName = SearchNamespaceByName{searchNamespaceByName_id
+                                                   :: {-# UNPACK #-} !SearchNamespaceByName_id,
+                                                   searchNamespaceByName_key ::
+                                                   Prelude.Maybe SearchNamespaceByName_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespaceByName where
+  toJSON (SearchNamespaceByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNamespaceByName where
+  buildStruct _proxy (SearchNamespaceByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchNamespaceByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespaceByName where
+  rnf (SearchNamespaceByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchNamespaceByName where
+  def = SearchNamespaceByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchNamespaceByName where
+  hashWithSalt __salt (SearchNamespaceByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchPropertyByName_id = Glean.Id
+
+data SearchPropertyByName = SearchPropertyByName{searchPropertyByName_id
+                                                 :: {-# UNPACK #-} !SearchPropertyByName_id,
+                                                 searchPropertyByName_key ::
+                                                 Prelude.Maybe SearchPropertyByName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyByName where
+  toJSON (SearchPropertyByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchPropertyByName where
+  buildStruct _proxy (SearchPropertyByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchPropertyByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyByName where
+  rnf (SearchPropertyByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchPropertyByName where
+  def = SearchPropertyByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchPropertyByName where
+  hashWithSalt __salt (SearchPropertyByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTraitByName_id = Glean.Id
+
+data SearchTraitByName = SearchTraitByName{searchTraitByName_id ::
+                                           {-# UNPACK #-} !SearchTraitByName_id,
+                                           searchTraitByName_key ::
+                                           Prelude.Maybe SearchTraitByName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTraitByName where
+  toJSON (SearchTraitByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTraitByName where
+  buildStruct _proxy (SearchTraitByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchTraitByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTraitByName where
+  rnf (SearchTraitByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTraitByName where
+  def = SearchTraitByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTraitByName where
+  hashWithSalt __salt (SearchTraitByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypeConstByName_id = Glean.Id
+
+data SearchTypeConstByName = SearchTypeConstByName{searchTypeConstByName_id
+                                                   :: {-# UNPACK #-} !SearchTypeConstByName_id,
+                                                   searchTypeConstByName_key ::
+                                                   Prelude.Maybe SearchTypeConstByName_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeConstByName where
+  toJSON (SearchTypeConstByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeConstByName where
+  buildStruct _proxy (SearchTypeConstByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeConstByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeConstByName where
+  rnf (SearchTypeConstByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeConstByName where
+  def = SearchTypeConstByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeConstByName where
+  hashWithSalt __salt (SearchTypeConstByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchTypedefByName_id = Glean.Id
+
+data SearchTypedefByName = SearchTypedefByName{searchTypedefByName_id
+                                               :: {-# UNPACK #-} !SearchTypedefByName_id,
+                                               searchTypedefByName_key ::
+                                               Prelude.Maybe SearchTypedefByName_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypedefByName where
+  toJSON (SearchTypedefByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypedefByName where
+  buildStruct _proxy (SearchTypedefByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchTypedefByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypedefByName where
+  rnf (SearchTypedefByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypedefByName where
+  def = SearchTypedefByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypedefByName where
+  hashWithSalt __salt (SearchTypedefByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ThriftToHack_id = Glean.Id
+
+data ThriftToHack = ThriftToHack{thriftToHack_id ::
+                                 {-# UNPACK #-} !ThriftToHack_id,
+                                 thriftToHack_key :: Prelude.Maybe ThriftToHack_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftToHack where
+  toJSON (ThriftToHack __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftToHack where
+  buildStruct _proxy (ThriftToHack __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ThriftToHack __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftToHack where
+  rnf (ThriftToHack __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ThriftToHack where
+  def = ThriftToHack Default.def Prelude.Nothing
+
+instance Hashable.Hashable ThriftToHack where
+  hashWithSalt __salt (ThriftToHack _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetUses_id = Glean.Id
+
+data TargetUses = TargetUses{targetUses_id ::
+                             {-# UNPACK #-} !TargetUses_id,
+                             targetUses_key :: Prelude.Maybe TargetUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses where
+  toJSON (TargetUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses where
+  buildStruct _proxy (TargetUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses where
+  rnf (TargetUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetUses where
+  def = TargetUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetUses where
+  hashWithSalt __salt (TargetUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TargetUsesAbs_id = Glean.Id
+
+data TargetUsesAbs = TargetUsesAbs{targetUsesAbs_id ::
+                                   {-# UNPACK #-} !TargetUsesAbs_id,
+                                   targetUsesAbs_key :: Prelude.Maybe TargetUsesAbs_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUsesAbs where
+  toJSON (TargetUsesAbs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUsesAbs where
+  buildStruct _proxy (TargetUsesAbs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TargetUsesAbs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUsesAbs where
+  rnf (TargetUsesAbs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TargetUsesAbs where
+  def = TargetUsesAbs Default.def Prelude.Nothing
+
+instance Hashable.Hashable TargetUsesAbs where
+  hashWithSalt __salt (TargetUsesAbs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeInfo_id = Glean.Id
+
+data TypeInfo = TypeInfo{typeInfo_id ::
+                         {-# UNPACK #-} !TypeInfo_id,
+                         typeInfo_key :: Prelude.Maybe TypeInfo_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeInfo where
+  toJSON (TypeInfo __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeInfo where
+  buildStruct _proxy (TypeInfo __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeInfo __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeInfo where
+  rnf (TypeInfo __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeInfo where
+  def = TypeInfo Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeInfo where
+  hashWithSalt __salt (TypeInfo _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InheritedMembers_id = Glean.Id
+
+data InheritedMembers = InheritedMembers{inheritedMembers_id ::
+                                         {-# UNPACK #-} !InheritedMembers_id,
+                                         inheritedMembers_key :: Prelude.Maybe InheritedMembers_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InheritedMembers where
+  toJSON (InheritedMembers __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InheritedMembers where
+  buildStruct _proxy (InheritedMembers __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InheritedMembers __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InheritedMembers where
+  rnf (InheritedMembers __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InheritedMembers where
+  def = InheritedMembers Default.def Prelude.Nothing
+
+instance Hashable.Hashable InheritedMembers where
+  hashWithSalt __salt (InheritedMembers _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodDeclaration_id = Glean.Id
+
+data MethodDeclaration = MethodDeclaration{methodDeclaration_id ::
+                                           {-# UNPACK #-} !MethodDeclaration_id,
+                                           methodDeclaration_key ::
+                                           Prelude.Maybe MethodDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration where
+  toJSON (MethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDeclaration where
+  buildStruct _proxy (MethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration where
+  rnf (MethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration where
+  def = MethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodDeclaration where
+  hashWithSalt __salt (MethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PropertyDeclaration_id = Glean.Id
+
+data PropertyDeclaration = PropertyDeclaration{propertyDeclaration_id
+                                               :: {-# UNPACK #-} !PropertyDeclaration_id,
+                                               propertyDeclaration_key ::
+                                               Prelude.Maybe PropertyDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PropertyDeclaration where
+  toJSON (PropertyDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PropertyDeclaration where
+  buildStruct _proxy (PropertyDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PropertyDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PropertyDeclaration where
+  rnf (PropertyDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PropertyDeclaration where
+  def = PropertyDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable PropertyDeclaration where
+  hashWithSalt __salt (PropertyDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeConstDeclaration_id = Glean.Id
+
+data TypeConstDeclaration = TypeConstDeclaration{typeConstDeclaration_id
+                                                 :: {-# UNPACK #-} !TypeConstDeclaration_id,
+                                                 typeConstDeclaration_key ::
+                                                 Prelude.Maybe TypeConstDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeConstDeclaration where
+  toJSON (TypeConstDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeConstDeclaration where
+  buildStruct _proxy (TypeConstDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (TypeConstDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeConstDeclaration where
+  rnf (TypeConstDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeConstDeclaration where
+  def = TypeConstDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeConstDeclaration where
+  hashWithSalt __salt (TypeConstDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainerChild_id = Glean.Id
+
+data ContainerChild = ContainerChild{containerChild_id ::
+                                     {-# UNPACK #-} !ContainerChild_id,
+                                     containerChild_key :: Prelude.Maybe ContainerChild_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerChild where
+  toJSON (ContainerChild __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainerChild where
+  buildStruct _proxy (ContainerChild __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainerChild __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainerChild where
+  rnf (ContainerChild __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainerChild where
+  def = ContainerChild Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainerChild where
+  hashWithSalt __salt (ContainerChild _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDefinition_id = Glean.Id
+
+data FunctionDefinition = FunctionDefinition{functionDefinition_id
+                                             :: {-# UNPACK #-} !FunctionDefinition_id,
+                                             functionDefinition_key ::
+                                             Prelude.Maybe FunctionDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition where
+  toJSON (FunctionDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDefinition where
+  buildStruct _proxy (FunctionDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition where
+  rnf (FunctionDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition where
+  def = FunctionDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDefinition where
+  hashWithSalt __salt (FunctionDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InterfaceDefinition_id = Glean.Id
+
+data InterfaceDefinition = InterfaceDefinition{interfaceDefinition_id
+                                               :: {-# UNPACK #-} !InterfaceDefinition_id,
+                                               interfaceDefinition_key ::
+                                               Prelude.Maybe InterfaceDefinition_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDefinition where
+  toJSON (InterfaceDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceDefinition where
+  buildStruct _proxy (InterfaceDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InterfaceDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDefinition where
+  rnf (InterfaceDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InterfaceDefinition where
+  def = InterfaceDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable InterfaceDefinition where
+  hashWithSalt __salt (InterfaceDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodDefinition_id = Glean.Id
+
+data MethodDefinition = MethodDefinition{methodDefinition_id ::
+                                         {-# UNPACK #-} !MethodDefinition_id,
+                                         methodDefinition_key :: Prelude.Maybe MethodDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDefinition where
+  toJSON (MethodDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDefinition where
+  buildStruct _proxy (MethodDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDefinition where
+  rnf (MethodDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodDefinition where
+  def = MethodDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodDefinition where
+  hashWithSalt __salt (MethodDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TraitDefinition_id = Glean.Id
+
+data TraitDefinition = TraitDefinition{traitDefinition_id ::
+                                       {-# UNPACK #-} !TraitDefinition_id,
+                                       traitDefinition_key :: Prelude.Maybe TraitDefinition_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TraitDefinition where
+  toJSON (TraitDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TraitDefinition where
+  buildStruct _proxy (TraitDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TraitDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TraitDefinition where
+  rnf (TraitDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TraitDefinition where
+  def = TraitDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable TraitDefinition where
+  hashWithSalt __salt (TraitDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypedefDefinition_id = Glean.Id
+
+data TypedefDefinition = TypedefDefinition{typedefDefinition_id ::
+                                           {-# UNPACK #-} !TypedefDefinition_id,
+                                           typedefDefinition_key ::
+                                           Prelude.Maybe TypedefDefinition_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedefDefinition where
+  toJSON (TypedefDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypedefDefinition where
+  buildStruct _proxy (TypedefDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypedefDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypedefDefinition where
+  rnf (TypedefDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypedefDefinition where
+  def = TypedefDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypedefDefinition where
+  hashWithSalt __salt (TypedefDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDefinition_id = Glean.Id
+
+data ClassDefinition = ClassDefinition{classDefinition_id ::
+                                       {-# UNPACK #-} !ClassDefinition_id,
+                                       classDefinition_key :: Prelude.Maybe ClassDefinition_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDefinition where
+  toJSON (ClassDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDefinition where
+  buildStruct _proxy (ClassDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDefinition where
+  rnf (ClassDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDefinition where
+  def = ClassDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDefinition where
+  hashWithSalt __salt (ClassDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDeclaration_id = Glean.Id
+
+data ClassDeclaration = ClassDeclaration{classDeclaration_id ::
+                                         {-# UNPACK #-} !ClassDeclaration_id,
+                                         classDeclaration_key :: Prelude.Maybe ClassDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration where
+  toJSON (ClassDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration where
+  buildStruct _proxy (ClassDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration where
+  rnf (ClassDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration where
+  def = ClassDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDeclaration where
+  hashWithSalt __salt (ClassDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassConstDefinition_id = Glean.Id
+
+data ClassConstDefinition = ClassConstDefinition{classConstDefinition_id
+                                                 :: {-# UNPACK #-} !ClassConstDefinition_id,
+                                                 classConstDefinition_key ::
+                                                 Prelude.Maybe ClassConstDefinition_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassConstDefinition where
+  toJSON (ClassConstDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassConstDefinition where
+  buildStruct _proxy (ClassConstDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ClassConstDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassConstDefinition where
+  rnf (ClassConstDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassConstDefinition where
+  def = ClassConstDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassConstDefinition where
+  hashWithSalt __salt (ClassConstDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassConstDeclaration_id = Glean.Id
+
+data ClassConstDeclaration = ClassConstDeclaration{classConstDeclaration_id
+                                                   :: {-# UNPACK #-} !ClassConstDeclaration_id,
+                                                   classConstDeclaration_key ::
+                                                   Prelude.Maybe ClassConstDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassConstDeclaration where
+  toJSON (ClassConstDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassConstDeclaration where
+  buildStruct _proxy (ClassConstDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ClassConstDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassConstDeclaration where
+  rnf (ClassConstDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassConstDeclaration where
+  def = ClassConstDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassConstDeclaration where
+  hashWithSalt __salt (ClassConstDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AttributeToDefinition_id = Glean.Id
+
+data AttributeToDefinition = AttributeToDefinition{attributeToDefinition_id
+                                                   :: {-# UNPACK #-} !AttributeToDefinition_id,
+                                                   attributeToDefinition_key ::
+                                                   Prelude.Maybe AttributeToDefinition_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeToDefinition where
+  toJSON (AttributeToDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeToDefinition where
+  buildStruct _proxy (AttributeToDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AttributeToDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeToDefinition where
+  rnf (AttributeToDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AttributeToDefinition where
+  def = AttributeToDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable AttributeToDefinition where
+  hashWithSalt __salt (AttributeToDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AttributeToDeclaration_id = Glean.Id
+
+data AttributeToDeclaration = AttributeToDeclaration{attributeToDeclaration_id
+                                                     :: {-# UNPACK #-} !AttributeToDeclaration_id,
+                                                     attributeToDeclaration_key ::
+                                                     Prelude.Maybe AttributeToDeclaration_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeToDeclaration where
+  toJSON (AttributeToDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeToDeclaration where
+  buildStruct _proxy
+    (AttributeToDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AttributeToDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeToDeclaration where
+  rnf (AttributeToDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AttributeToDeclaration where
+  def = AttributeToDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable AttributeToDeclaration where
+  hashWithSalt __salt (AttributeToDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AttributeHasParameter_id = Glean.Id
+
+data AttributeHasParameter = AttributeHasParameter{attributeHasParameter_id
+                                                   :: {-# UNPACK #-} !AttributeHasParameter_id,
+                                                   attributeHasParameter_key ::
+                                                   Prelude.Maybe AttributeHasParameter_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeHasParameter where
+  toJSON (AttributeHasParameter __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeHasParameter where
+  buildStruct _proxy (AttributeHasParameter __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AttributeHasParameter __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeHasParameter where
+  rnf (AttributeHasParameter __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AttributeHasParameter where
+  def = AttributeHasParameter Default.def Prelude.Nothing
+
+instance Hashable.Hashable AttributeHasParameter where
+  hashWithSalt __salt (AttributeHasParameter _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileCall_id = Glean.Id
+
+data FileCall = FileCall{fileCall_id ::
+                         {-# UNPACK #-} !FileCall_id,
+                         fileCall_key :: Prelude.Maybe FileCall_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall where
+  toJSON (FileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileCall where
+  buildStruct _proxy (FileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall where
+  rnf (FileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileCall where
+  def = FileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileCall where
+  hashWithSalt __salt (FileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Visibility = Visibility_Private
+                | Visibility_Protected
+                | Visibility_Public
+                | Visibility_Internal
+                | Visibility__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Visibility where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Visibility where
+  rnf __Visibility = Prelude.seq __Visibility ()
+
+instance Default.Default Visibility where
+  def = Visibility_Private
+
+instance Hashable.Hashable Visibility where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Visibility where
+  toThriftEnum 0 = Visibility_Private
+  toThriftEnum 1 = Visibility_Protected
+  toThriftEnum 2 = Visibility_Public
+  toThriftEnum 3 = Visibility_Internal
+  toThriftEnum val = Visibility__UNKNOWN val
+  fromThriftEnum Visibility_Private = 0
+  fromThriftEnum Visibility_Protected = 1
+  fromThriftEnum Visibility_Public = 2
+  fromThriftEnum Visibility_Internal = 3
+  fromThriftEnum (Visibility__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Visibility_Private, Visibility_Protected, Visibility_Public,
+       Visibility_Internal]
+  toThriftEnumEither 0 = Prelude.Right Visibility_Private
+  toThriftEnumEither 1 = Prelude.Right Visibility_Protected
+  toThriftEnumEither 2 = Prelude.Right Visibility_Public
+  toThriftEnumEither 3 = Prelude.Right Visibility_Internal
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Visibility: "
+           ++ Prelude.show val)
+
+data Variance = Variance_Contravariant
+              | Variance_Covariant
+              | Variance_Invariant
+              | Variance__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Variance where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Variance where
+  rnf __Variance = Prelude.seq __Variance ()
+
+instance Default.Default Variance where
+  def = Variance_Contravariant
+
+instance Hashable.Hashable Variance where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Variance where
+  toThriftEnum 0 = Variance_Contravariant
+  toThriftEnum 1 = Variance_Covariant
+  toThriftEnum 2 = Variance_Invariant
+  toThriftEnum val = Variance__UNKNOWN val
+  fromThriftEnum Variance_Contravariant = 0
+  fromThriftEnum Variance_Covariant = 1
+  fromThriftEnum Variance_Invariant = 2
+  fromThriftEnum (Variance__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Variance_Contravariant, Variance_Covariant, Variance_Invariant]
+  toThriftEnumEither 0 = Prelude.Right Variance_Contravariant
+  toThriftEnumEither 1 = Prelude.Right Variance_Covariant
+  toThriftEnumEither 2 = Prelude.Right Variance_Invariant
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Variance: "
+           ++ Prelude.show val)
+
+data UserAttribute_key = UserAttribute_key{userAttribute_key_name
+                                           :: Name,
+                                           userAttribute_key_parameters :: [Text.Text],
+                                           userAttribute_key_qname :: Prelude.Maybe QName}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UserAttribute_key where
+  toJSON
+    (UserAttribute_key __field__name __field__parameters
+       __field__qname)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parameters" .= __field__parameters :
+             Prelude.maybe Prelude.id ((:) . ("qname" .=)) __field__qname
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct UserAttribute_key where
+  buildStruct _proxy
+    (UserAttribute_key __field__name __field__parameters
+       __field__qname)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__parameters)
+             :
+             case __field__qname of
+               Prelude.Just _val -> Thrift.genField _proxy "qname"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__qname <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__qname <- ST.readSTRef __field__qname
+                                             Prelude.pure
+                                               (UserAttribute_key __val__name __val__parameters
+                                                  __val__qname)
+              _idMap
+                = HashMap.fromList [("name", 1), ("parameters", 2), ("qname", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData UserAttribute_key where
+  rnf
+    (UserAttribute_key __field__name __field__parameters
+       __field__qname)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq`
+          DeepSeq.rnf __field__qname `Prelude.seq` ()
+
+instance Default.Default UserAttribute_key where
+  def = UserAttribute_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable UserAttribute_key where
+  hashWithSalt __salt (UserAttribute_key _name _parameters _qname)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parameters)
+        _qname
+
+newtype TypedefDeclaration_key = TypedefDeclaration_key{typedefDeclaration_key_name
+                                                        :: QName}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedefDeclaration_key where
+  toJSON (TypedefDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypedefDeclaration_key where
+  buildStruct _proxy (TypedefDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (TypedefDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TypedefDeclaration_key where
+  rnf (TypedefDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TypedefDeclaration_key where
+  def = TypedefDeclaration_key Default.def
+
+instance Hashable.Hashable TypedefDeclaration_key where
+  hashWithSalt __salt (TypedefDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data TypeConstKind = TypeConstKind_Abstract
+                   | TypeConstKind_Concrete
+                   | TypeConstKind_PartiallyAbstract
+                   | TypeConstKind__UNKNOWN Prelude.Int
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeConstKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData TypeConstKind where
+  rnf __TypeConstKind = Prelude.seq __TypeConstKind ()
+
+instance Default.Default TypeConstKind where
+  def = TypeConstKind_Abstract
+
+instance Hashable.Hashable TypeConstKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum TypeConstKind where
+  toThriftEnum 0 = TypeConstKind_Abstract
+  toThriftEnum 1 = TypeConstKind_Concrete
+  toThriftEnum 2 = TypeConstKind_PartiallyAbstract
+  toThriftEnum val = TypeConstKind__UNKNOWN val
+  fromThriftEnum TypeConstKind_Abstract = 0
+  fromThriftEnum TypeConstKind_Concrete = 1
+  fromThriftEnum TypeConstKind_PartiallyAbstract = 2
+  fromThriftEnum (TypeConstKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [TypeConstKind_Abstract, TypeConstKind_Concrete,
+       TypeConstKind_PartiallyAbstract]
+  toThriftEnumEither 0 = Prelude.Right TypeConstKind_Abstract
+  toThriftEnumEither 1 = Prelude.Right TypeConstKind_Concrete
+  toThriftEnumEither 2
+    = Prelude.Right TypeConstKind_PartiallyAbstract
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum TypeConstKind: "
+           ++ Prelude.show val)
+
+data TypeConstDefinition_key = TypeConstDefinition_key{typeConstDefinition_key_declaration
+                                                       :: TypeConstDeclaration,
+                                                       typeConstDefinition_key_type ::
+                                                       Prelude.Maybe Type,
+                                                       typeConstDefinition_key_kind ::
+                                                       TypeConstKind,
+                                                       typeConstDefinition_key_attributes ::
+                                                       [UserAttribute],
+                                                       typeConstDefinition_key_typeInfo ::
+                                                       Prelude.Maybe TypeInfo}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeConstDefinition_key where
+  toJSON
+    (TypeConstDefinition_key __field__declaration __field__type
+       __field__kind __field__attributes __field__typeInfo)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+             ("kind" .= __field__kind :
+                "attributes" .= __field__attributes :
+                  Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+                    Prelude.mempty))
+
+instance Thrift.ThriftStruct TypeConstDefinition_key where
+  buildStruct _proxy
+    (TypeConstDefinition_key __field__declaration __field__type
+       __field__kind __field__attributes __field__typeInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__type, __id__type)
+                 = case __field__type of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "type"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__type
+               (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 3
+                  __id__type
+                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                      Thrift.fromThriftEnum)
+                     __field__kind)
+                  :
+                  Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 4 3
+                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                       (Thrift.buildStruct _proxy)
+                       __field__attributes)
+                    :
+                    case __field__typeInfo of
+                      Prelude.Just _val -> Thrift.genField _proxy "typeInfo"
+                                             (Thrift.getStructType _proxy)
+                                             5
+                                             4
+                                             (Thrift.buildStruct _proxy _val)
+                                             : []
+                      Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__kind <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "TypeConstKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             Prelude.pure
+                                               (TypeConstDefinition_key __val__declaration
+                                                  __val__type
+                                                  __val__kind
+                                                  __val__attributes
+                                                  __val__typeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("type", 2), ("kind", 3), ("attributes", 4),
+                     ("typeInfo", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeConstDefinition_key where
+  rnf
+    (TypeConstDefinition_key __field__declaration __field__type
+       __field__kind __field__attributes __field__typeInfo)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__kind `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq`
+              DeepSeq.rnf __field__typeInfo `Prelude.seq` ()
+
+instance Default.Default TypeConstDefinition_key where
+  def
+    = TypeConstDefinition_key Default.def Prelude.Nothing Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable TypeConstDefinition_key where
+  hashWithSalt __salt
+    (TypeConstDefinition_key _declaration _type _kind _attributes
+       _typeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                 _type)
+              _kind)
+           _attributes)
+        _typeInfo
+
+newtype TraitDeclaration_key = TraitDeclaration_key{traitDeclaration_key_name
+                                                    :: QName}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TraitDeclaration_key where
+  toJSON (TraitDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TraitDeclaration_key where
+  buildStruct _proxy (TraitDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (TraitDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TraitDeclaration_key where
+  rnf (TraitDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TraitDeclaration_key where
+  def = TraitDeclaration_key Default.def
+
+instance Hashable.Hashable TraitDeclaration_key where
+  hashWithSalt __salt (TraitDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data SearchTypedefByLowerCaseName_key = SearchTypedefByLowerCaseName_key{searchTypedefByLowerCaseName_key_name_lowercase
+                                                                         :: Text.Text,
+                                                                         searchTypedefByLowerCaseName_key_name
+                                                                         :: Text.Text}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypedefByLowerCaseName_key where
+  toJSON
+    (SearchTypedefByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypedefByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchTypedefByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchTypedefByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypedefByLowerCaseName_key where
+  rnf
+    (SearchTypedefByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchTypedefByLowerCaseName_key where
+  def = SearchTypedefByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchTypedefByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchTypedefByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchTypeConstByLowerCaseName_key = SearchTypeConstByLowerCaseName_key{searchTypeConstByLowerCaseName_key_name_lowercase
+                                                                             :: Text.Text,
+                                                                             searchTypeConstByLowerCaseName_key_name
+                                                                             :: Text.Text}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeConstByLowerCaseName_key where
+  toJSON
+    (SearchTypeConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeConstByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchTypeConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchTypeConstByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeConstByLowerCaseName_key where
+  rnf
+    (SearchTypeConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchTypeConstByLowerCaseName_key where
+  def = SearchTypeConstByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchTypeConstByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchTypeConstByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchTraitByLowerCaseName_key = SearchTraitByLowerCaseName_key{searchTraitByLowerCaseName_key_name_lowercase
+                                                                     :: Text.Text,
+                                                                     searchTraitByLowerCaseName_key_name
+                                                                     :: Text.Text}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTraitByLowerCaseName_key where
+  toJSON
+    (SearchTraitByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTraitByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchTraitByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchTraitByLowerCaseName_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTraitByLowerCaseName_key where
+  rnf
+    (SearchTraitByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchTraitByLowerCaseName_key where
+  def = SearchTraitByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchTraitByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchTraitByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchPropertyByLowerCaseName_key = SearchPropertyByLowerCaseName_key{searchPropertyByLowerCaseName_key_name_lowercase
+                                                                           :: Text.Text,
+                                                                           searchPropertyByLowerCaseName_key_name
+                                                                           :: Text.Text}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyByLowerCaseName_key where
+  toJSON
+    (SearchPropertyByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchPropertyByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchPropertyByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchPropertyByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyByLowerCaseName_key where
+  rnf
+    (SearchPropertyByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchPropertyByLowerCaseName_key where
+  def = SearchPropertyByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchPropertyByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchPropertyByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchNamespaceByLowerCaseName_key = SearchNamespaceByLowerCaseName_key{searchNamespaceByLowerCaseName_key_name_lowercase
+                                                                             :: Text.Text,
+                                                                             searchNamespaceByLowerCaseName_key_name
+                                                                             :: Text.Text}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespaceByLowerCaseName_key where
+  toJSON
+    (SearchNamespaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNamespaceByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchNamespaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchNamespaceByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespaceByLowerCaseName_key where
+  rnf
+    (SearchNamespaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchNamespaceByLowerCaseName_key where
+  def = SearchNamespaceByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchNamespaceByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchNamespaceByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchModuleByLowerCaseName_key = SearchModuleByLowerCaseName_key{searchModuleByLowerCaseName_key_name_lowercase
+                                                                       :: Text.Text,
+                                                                       searchModuleByLowerCaseName_key_name
+                                                                       :: Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName_key where
+  toJSON
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName_key where
+  rnf
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName_key where
+  def = SearchModuleByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchModuleByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchModuleByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchMethodByLowerCaseName_key = SearchMethodByLowerCaseName_key{searchMethodByLowerCaseName_key_name_lowercase
+                                                                       :: Text.Text,
+                                                                       searchMethodByLowerCaseName_key_name
+                                                                       :: Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByLowerCaseName_key where
+  toJSON
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchMethodByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByLowerCaseName_key where
+  rnf
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchMethodByLowerCaseName_key where
+  def = SearchMethodByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchMethodByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchMethodByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchInterfaceByLowerCaseName_key = SearchInterfaceByLowerCaseName_key{searchInterfaceByLowerCaseName_key_name_lowercase
+                                                                             :: Text.Text,
+                                                                             searchInterfaceByLowerCaseName_key_name
+                                                                             :: Text.Text}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInterfaceByLowerCaseName_key where
+  toJSON
+    (SearchInterfaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInterfaceByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchInterfaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchInterfaceByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInterfaceByLowerCaseName_key where
+  rnf
+    (SearchInterfaceByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchInterfaceByLowerCaseName_key where
+  def = SearchInterfaceByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchInterfaceByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchInterfaceByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchGlobalConstByLowerCaseName_key = SearchGlobalConstByLowerCaseName_key{searchGlobalConstByLowerCaseName_key_name_lowercase
+                                                                                 :: Text.Text,
+                                                                                 searchGlobalConstByLowerCaseName_key_name
+                                                                                 :: Text.Text}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstByLowerCaseName_key where
+  toJSON
+    (SearchGlobalConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchGlobalConstByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchGlobalConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchGlobalConstByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstByLowerCaseName_key where
+  rnf
+    (SearchGlobalConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstByLowerCaseName_key where
+  def = SearchGlobalConstByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchGlobalConstByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchGlobalConstByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchFunctionByLowerCaseName_key = SearchFunctionByLowerCaseName_key{searchFunctionByLowerCaseName_key_name_lowercase
+                                                                           :: Text.Text,
+                                                                           searchFunctionByLowerCaseName_key_name
+                                                                           :: Text.Text}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByLowerCaseName_key where
+  toJSON
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchFunctionByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByLowerCaseName_key where
+  rnf
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByLowerCaseName_key where
+  def = SearchFunctionByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchFunctionByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchFunctionByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchEnumeratorByLowerCaseName_key = SearchEnumeratorByLowerCaseName_key{searchEnumeratorByLowerCaseName_key_name_lowercase
+                                                                               :: Text.Text,
+                                                                               searchEnumeratorByLowerCaseName_key_name
+                                                                               :: Text.Text}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumeratorByLowerCaseName_key where
+  toJSON
+    (SearchEnumeratorByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumeratorByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchEnumeratorByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchEnumeratorByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumeratorByLowerCaseName_key where
+  rnf
+    (SearchEnumeratorByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchEnumeratorByLowerCaseName_key where
+  def = SearchEnumeratorByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchEnumeratorByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchEnumeratorByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchEnumByLowerCaseName_key = SearchEnumByLowerCaseName_key{searchEnumByLowerCaseName_key_name_lowercase
+                                                                   :: Text.Text,
+                                                                   searchEnumByLowerCaseName_key_name
+                                                                   :: Text.Text}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumByLowerCaseName_key where
+  toJSON
+    (SearchEnumByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchEnumByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchEnumByLowerCaseName_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumByLowerCaseName_key where
+  rnf
+    (SearchEnumByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchEnumByLowerCaseName_key where
+  def = SearchEnumByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchEnumByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchEnumByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchClassConstByLowerCaseName_key = SearchClassConstByLowerCaseName_key{searchClassConstByLowerCaseName_key_name_lowercase
+                                                                               :: Text.Text,
+                                                                               searchClassConstByLowerCaseName_key_name
+                                                                               :: Text.Text}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassConstByLowerCaseName_key where
+  toJSON
+    (SearchClassConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassConstByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchClassConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchClassConstByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassConstByLowerCaseName_key where
+  rnf
+    (SearchClassConstByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchClassConstByLowerCaseName_key where
+  def = SearchClassConstByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchClassConstByLowerCaseName_key
+         where
+  hashWithSalt __salt
+    (SearchClassConstByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchClassByLowerCaseName_key = SearchClassByLowerCaseName_key{searchClassByLowerCaseName_key_name_lowercase
+                                                                     :: Text.Text,
+                                                                     searchClassByLowerCaseName_key_name
+                                                                     :: Text.Text}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByLowerCaseName_key where
+  toJSON
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchClassByLowerCaseName_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByLowerCaseName_key where
+  rnf
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchClassByLowerCaseName_key where
+  def = SearchClassByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchClassByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchClassByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data ReifyKind = ReifyKind_Erased
+               | ReifyKind_Reified
+               | ReifyKind_SoftReified
+               | ReifyKind__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReifyKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData ReifyKind where
+  rnf __ReifyKind = Prelude.seq __ReifyKind ()
+
+instance Default.Default ReifyKind where
+  def = ReifyKind_Erased
+
+instance Hashable.Hashable ReifyKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum ReifyKind where
+  toThriftEnum 0 = ReifyKind_Erased
+  toThriftEnum 1 = ReifyKind_Reified
+  toThriftEnum 2 = ReifyKind_SoftReified
+  toThriftEnum val = ReifyKind__UNKNOWN val
+  fromThriftEnum ReifyKind_Erased = 0
+  fromThriftEnum ReifyKind_Reified = 1
+  fromThriftEnum ReifyKind_SoftReified = 2
+  fromThriftEnum (ReifyKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [ReifyKind_Erased, ReifyKind_Reified, ReifyKind_SoftReified]
+  toThriftEnumEither 0 = Prelude.Right ReifyKind_Erased
+  toThriftEnumEither 1 = Prelude.Right ReifyKind_Reified
+  toThriftEnumEither 2 = Prelude.Right ReifyKind_SoftReified
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum ReifyKind: "
+           ++ Prelude.show val)
+
+data ReadonlyKind = ReadonlyKind_Readonly
+                  | ReadonlyKind__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReadonlyKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData ReadonlyKind where
+  rnf __ReadonlyKind = Prelude.seq __ReadonlyKind ()
+
+instance Default.Default ReadonlyKind where
+  def = ReadonlyKind_Readonly
+
+instance Hashable.Hashable ReadonlyKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum ReadonlyKind where
+  toThriftEnum 0 = ReadonlyKind_Readonly
+  toThriftEnum val = ReadonlyKind__UNKNOWN val
+  fromThriftEnum ReadonlyKind_Readonly = 0
+  fromThriftEnum (ReadonlyKind__UNKNOWN val) = val
+  allThriftEnumValues = [ReadonlyKind_Readonly]
+  toThriftEnumEither 0 = Prelude.Right ReadonlyKind_Readonly
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum ReadonlyKind: "
+           ++ Prelude.show val)
+
+data QName_key = QName_key{qName_key_name :: Name,
+                           qName_key_namespace_ :: Prelude.Maybe NamespaceQName}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName_key where
+  toJSON (QName_key __field__name __field__namespace_)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QName_key where
+  buildStruct _proxy (QName_key __field__name __field__namespace_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__namespace_ of
+             Prelude.Just _val -> Thrift.genField _proxy "namespace_"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             Prelude.pure (QName_key __val__name __val__namespace_)
+              _idMap = HashMap.fromList [("name", 1), ("namespace_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName_key where
+  rnf (QName_key __field__name __field__namespace_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq` ()
+
+instance Default.Default QName_key where
+  def = QName_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable QName_key where
+  hashWithSalt __salt (QName_key _name _namespace_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _namespace_
+
+data PropertyDefinition_key = PropertyDefinition_key{propertyDefinition_key_declaration
+                                                     :: PropertyDeclaration,
+                                                     propertyDefinition_key_type ::
+                                                     Prelude.Maybe Type,
+                                                     propertyDefinition_key_visibility ::
+                                                     Visibility,
+                                                     propertyDefinition_key_isFinal :: Prelude.Bool,
+                                                     propertyDefinition_key_isAbstract ::
+                                                     Prelude.Bool,
+                                                     propertyDefinition_key_isStatic ::
+                                                     Prelude.Bool,
+                                                     propertyDefinition_key_attributes ::
+                                                     [UserAttribute],
+                                                     propertyDefinition_key_typeInfo ::
+                                                     Prelude.Maybe TypeInfo}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PropertyDefinition_key where
+  toJSON
+    (PropertyDefinition_key __field__declaration __field__type
+       __field__visibility __field__isFinal __field__isAbstract
+       __field__isStatic __field__attributes __field__typeInfo)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+             ("visibility" .= __field__visibility :
+                "isFinal" .= __field__isFinal :
+                  "isAbstract" .= __field__isAbstract :
+                    "isStatic" .= __field__isStatic :
+                      "attributes" .= __field__attributes :
+                        Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+                          Prelude.mempty))
+
+instance Thrift.ThriftStruct PropertyDefinition_key where
+  buildStruct _proxy
+    (PropertyDefinition_key __field__declaration __field__type
+       __field__visibility __field__isFinal __field__isAbstract
+       __field__isStatic __field__attributes __field__typeInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__type, __id__type)
+                 = case __field__type of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "type"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__type
+               (Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 3
+                  __id__type
+                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                      Thrift.fromThriftEnum)
+                     __field__visibility)
+                  :
+                  Thrift.genFieldBool _proxy "isFinal" 4 3 __field__isFinal :
+                    Thrift.genFieldBool _proxy "isAbstract" 5 4 __field__isAbstract :
+                      Thrift.genFieldBool _proxy "isStatic" 6 5 __field__isStatic :
+                        Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 7 6
+                          (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                             (Thrift.buildStruct _proxy)
+                             __field__attributes)
+                          :
+                          case __field__typeInfo of
+                            Prelude.Just _val -> Thrift.genField _proxy "typeInfo"
+                                                   (Thrift.getStructType _proxy)
+                                                   8
+                                                   7
+                                                   (Thrift.buildStruct _proxy _val)
+                                                   : []
+                            Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__visibility <- ST.newSTRef Default.def
+            __field__isFinal <- ST.newSTRef Prelude.False
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isFinal
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             !__val__isFinal <- ST.readSTRef __field__isFinal
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             Prelude.pure
+                                               (PropertyDefinition_key __val__declaration
+                                                  __val__type
+                                                  __val__visibility
+                                                  __val__isFinal
+                                                  __val__isAbstract
+                                                  __val__isStatic
+                                                  __val__attributes
+                                                  __val__typeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("type", 2), ("visibility", 3),
+                     ("isFinal", 4), ("isAbstract", 5), ("isStatic", 6),
+                     ("attributes", 7), ("typeInfo", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData PropertyDefinition_key where
+  rnf
+    (PropertyDefinition_key __field__declaration __field__type
+       __field__visibility __field__isFinal __field__isAbstract
+       __field__isStatic __field__attributes __field__typeInfo)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__visibility `Prelude.seq`
+            DeepSeq.rnf __field__isFinal `Prelude.seq`
+              DeepSeq.rnf __field__isAbstract `Prelude.seq`
+                DeepSeq.rnf __field__isStatic `Prelude.seq`
+                  DeepSeq.rnf __field__attributes `Prelude.seq`
+                    DeepSeq.rnf __field__typeInfo `Prelude.seq` ()
+
+instance Default.Default PropertyDefinition_key where
+  def
+    = PropertyDefinition_key Default.def Prelude.Nothing Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable PropertyDefinition_key where
+  hashWithSalt __salt
+    (PropertyDefinition_key _declaration _type _visibility _isFinal
+       _isAbstract _isStatic _attributes _typeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                          _type)
+                       _visibility)
+                    _isFinal)
+                 _isAbstract)
+              _isStatic)
+           _attributes)
+        _typeInfo
+
+data Parameter = Parameter{parameter_name :: Name,
+                           parameter_type :: Prelude.Maybe Type,
+                           parameter_isInout :: Prelude.Bool,
+                           parameter_isVariadic :: Prelude.Bool,
+                           parameter_defaultValue :: Prelude.Maybe Text.Text,
+                           parameter_attributes :: [UserAttribute],
+                           parameter_typeInfo :: Prelude.Maybe TypeInfo,
+                           parameter_readonly :: Prelude.Maybe ReadonlyKind}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Parameter where
+  toJSON
+    (Parameter __field__name __field__type __field__isInout
+       __field__isVariadic __field__defaultValue __field__attributes
+       __field__typeInfo __field__readonly)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+             ("isInout" .= __field__isInout :
+                "isVariadic" .= __field__isVariadic :
+                  Prelude.maybe Prelude.id ((:) . ("defaultValue" .=))
+                    __field__defaultValue
+                    ("attributes" .= __field__attributes :
+                       Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+                         (Prelude.maybe Prelude.id ((:) . ("readonly" .=)) __field__readonly
+                            Prelude.mempty))))
+
+instance Thrift.ThriftStruct Parameter where
+  buildStruct _proxy
+    (Parameter __field__name __field__type __field__isInout
+       __field__isVariadic __field__defaultValue __field__attributes
+       __field__typeInfo __field__readonly)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__type, __id__type)
+                 = case __field__type of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "type"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__type
+               (Thrift.genFieldBool _proxy "isInout" 3 __id__type __field__isInout
+                  :
+                  Thrift.genFieldBool _proxy "isVariadic" 4 3 __field__isVariadic :
+                    let (__cereal__defaultValue, __id__defaultValue)
+                          = case __field__defaultValue of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "defaultValue"
+                                                         (Thrift.getStringType _proxy)
+                                                         5
+                                                         4
+                                                         (Thrift.genText _proxy _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, 4)
+                      in
+                      __cereal__defaultValue
+                        (Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 6
+                           __id__defaultValue
+                           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                              (Thrift.buildStruct _proxy)
+                              __field__attributes)
+                           :
+                           let (__cereal__typeInfo, __id__typeInfo)
+                                 = case __field__typeInfo of
+                                     Prelude.Just _val -> ((:)
+                                                             (Thrift.genField _proxy "typeInfo"
+                                                                (Thrift.getStructType _proxy)
+                                                                7
+                                                                6
+                                                                (Thrift.buildStruct _proxy _val)),
+                                                           7)
+                                     Prelude.Nothing -> (Prelude.id, 6)
+                             in
+                             __cereal__typeInfo
+                               (case __field__readonly of
+                                  Prelude.Just _val -> Thrift.genField _proxy "readonly"
+                                                         (Thrift.getI32Type _proxy)
+                                                         8
+                                                         __id__typeInfo
+                                                         ((Thrift.genI32 _proxy .
+                                                             Prelude.fromIntegral
+                                                             . Thrift.fromThriftEnum)
+                                                            _val)
+                                                         : []
+                                  Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__isInout <- ST.newSTRef Prelude.False
+            __field__isVariadic <- ST.newSTRef Prelude.False
+            __field__defaultValue <- ST.newSTRef Prelude.Nothing
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            __field__readonly <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isInout
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isVariadic
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__defaultValue
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ReadonlyKind")
+                                                                        ST.writeSTRef
+                                                                          __field__readonly
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__isInout <- ST.readSTRef __field__isInout
+                                             !__val__isVariadic <- ST.readSTRef __field__isVariadic
+                                             !__val__defaultValue <- ST.readSTRef
+                                                                       __field__defaultValue
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             !__val__readonly <- ST.readSTRef __field__readonly
+                                             Prelude.pure
+                                               (Parameter __val__name __val__type __val__isInout
+                                                  __val__isVariadic
+                                                  __val__defaultValue
+                                                  __val__attributes
+                                                  __val__typeInfo
+                                                  __val__readonly)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("isInout", 3), ("isVariadic", 4),
+                     ("defaultValue", 5), ("attributes", 6), ("typeInfo", 7),
+                     ("readonly", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData Parameter where
+  rnf
+    (Parameter __field__name __field__type __field__isInout
+       __field__isVariadic __field__defaultValue __field__attributes
+       __field__typeInfo __field__readonly)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__isInout `Prelude.seq`
+            DeepSeq.rnf __field__isVariadic `Prelude.seq`
+              DeepSeq.rnf __field__defaultValue `Prelude.seq`
+                DeepSeq.rnf __field__attributes `Prelude.seq`
+                  DeepSeq.rnf __field__typeInfo `Prelude.seq`
+                    DeepSeq.rnf __field__readonly `Prelude.seq` ()
+
+instance Default.Default Parameter where
+  def
+    = Parameter Default.def Prelude.Nothing Prelude.False Prelude.False
+        Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable Parameter where
+  hashWithSalt __salt
+    (Parameter _name _type _isInout _isVariadic _defaultValue
+       _attributes _typeInfo _readonly)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+                       _isInout)
+                    _isVariadic)
+                 _defaultValue)
+              _attributes)
+           _typeInfo)
+        _readonly
+
+data Signature_key = Signature_key{signature_key_returns ::
+                                   Prelude.Maybe Type,
+                                   signature_key_parameters :: [Parameter],
+                                   signature_key_contexts :: Prelude.Maybe [Context_],
+                                   signature_key_returnsTypeInfo :: Prelude.Maybe TypeInfo}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Signature_key where
+  toJSON
+    (Signature_key __field__returns __field__parameters
+       __field__contexts __field__returnsTypeInfo)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("returns" .=)) __field__returns
+           ("parameters" .= __field__parameters :
+              Prelude.maybe Prelude.id ((:) . ("contexts" .=)) __field__contexts
+                (Prelude.maybe Prelude.id ((:) . ("returnsTypeInfo" .=))
+                   __field__returnsTypeInfo
+                   Prelude.mempty)))
+
+instance Thrift.ThriftStruct Signature_key where
+  buildStruct _proxy
+    (Signature_key __field__returns __field__parameters
+       __field__contexts __field__returnsTypeInfo)
+    = Thrift.genStruct _proxy
+        (let (__cereal__returns, __id__returns)
+               = case __field__returns of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "returns"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__returns
+             (Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2
+                __id__returns
+                (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                   (Thrift.buildStruct _proxy)
+                   __field__parameters)
+                :
+                let (__cereal__contexts, __id__contexts)
+                      = case __field__contexts of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "contexts"
+                                                     (Thrift.getListType _proxy)
+                                                     3
+                                                     2
+                                                     (Thrift.genList _proxy
+                                                        (Thrift.getStructType _proxy)
+                                                        (Thrift.buildStruct _proxy)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, 2)
+                  in
+                  __cereal__contexts
+                    (case __field__returnsTypeInfo of
+                       Prelude.Just _val -> Thrift.genField _proxy "returnsTypeInfo"
+                                              (Thrift.getStructType _proxy)
+                                              4
+                                              __id__contexts
+                                              (Thrift.buildStruct _proxy _val)
+                                              : []
+                       Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__returns <- ST.newSTRef Prelude.Nothing
+            __field__parameters <- ST.newSTRef Default.def
+            __field__contexts <- ST.newSTRef Prelude.Nothing
+            __field__returnsTypeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returns
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__contexts
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnsTypeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__returns <- ST.readSTRef
+                                                                  __field__returns
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__contexts <- ST.readSTRef __field__contexts
+                                             !__val__returnsTypeInfo <- ST.readSTRef
+                                                                          __field__returnsTypeInfo
+                                             Prelude.pure
+                                               (Signature_key __val__returns __val__parameters
+                                                  __val__contexts
+                                                  __val__returnsTypeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("returns", 1), ("parameters", 2), ("contexts", 3),
+                     ("returnsTypeInfo", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Signature_key where
+  rnf
+    (Signature_key __field__returns __field__parameters
+       __field__contexts __field__returnsTypeInfo)
+    = DeepSeq.rnf __field__returns `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq`
+          DeepSeq.rnf __field__contexts `Prelude.seq`
+            DeepSeq.rnf __field__returnsTypeInfo `Prelude.seq` ()
+
+instance Default.Default Signature_key where
+  def
+    = Signature_key Prelude.Nothing Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable Signature_key where
+  hashWithSalt __salt
+    (Signature_key _returns _parameters _contexts _returnsTypeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _returns)
+              _parameters)
+           _contexts)
+        _returnsTypeInfo
+
+data Occurrence = Occurrence_method MethodOccurrence
+                | Occurrence_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Occurrence where
+  toJSON (Occurrence_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON Occurrence_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Occurrence where
+  buildStruct _proxy (Occurrence_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy Occurrence_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Occurrence_method _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Occurrence_EMPTY
+           Thrift.FieldEnd -> Prelude.return Occurrence_EMPTY
+    where
+      _idMap = HashMap.fromList [("method", 1)]
+
+instance DeepSeq.NFData Occurrence where
+  rnf (Occurrence_method __method) = DeepSeq.rnf __method
+  rnf Occurrence_EMPTY = ()
+
+instance Default.Default Occurrence where
+  def = Occurrence_EMPTY
+
+instance Hashable.Hashable Occurrence where
+  hashWithSalt __salt (Occurrence_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _method)
+  hashWithSalt __salt Occurrence_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data NamespaceQName_key = NamespaceQName_key{namespaceQName_key_name
+                                             :: Name,
+                                             namespaceQName_key_parent ::
+                                             Prelude.Maybe NamespaceQName}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceQName_key where
+  toJSON (NamespaceQName_key __field__name __field__parent)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceQName_key where
+  buildStruct _proxy
+    (NamespaceQName_key __field__name __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__parent of
+             Prelude.Just _val -> Thrift.genField _proxy "parent"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (NamespaceQName_key __val__name __val__parent)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceQName_key where
+  rnf (NamespaceQName_key __field__name __field__parent)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default NamespaceQName_key where
+  def = NamespaceQName_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable NamespaceQName_key where
+  hashWithSalt __salt (NamespaceQName_key _name _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _parent
+
+newtype NamespaceDeclaration_key = NamespaceDeclaration_key{namespaceDeclaration_key_name
+                                                            :: NamespaceQName}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceDeclaration_key where
+  toJSON (NamespaceDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceDeclaration_key where
+  buildStruct _proxy (NamespaceDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (NamespaceDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceDeclaration_key where
+  rnf (NamespaceDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NamespaceDeclaration_key where
+  def = NamespaceDeclaration_key Default.def
+
+instance Hashable.Hashable NamespaceDeclaration_key where
+  hashWithSalt __salt (NamespaceDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowercase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowercase __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowercase __val__name)
+              _idMap = HashMap.fromList [("nameLowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowercase __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowercase)
+        _name
+
+data ModuleMembership = ModuleMembership{moduleMembership_declaration
+                                         :: ModuleDeclaration,
+                                         moduleMembership_internal :: Prelude.Bool}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleMembership where
+  toJSON (ModuleMembership __field__declaration __field__internal)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "internal" .= __field__internal : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleMembership where
+  buildStruct _proxy
+    (ModuleMembership __field__declaration __field__internal)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           : Thrift.genFieldBool _proxy "internal" 2 1 __field__internal : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__internal <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__internal
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__internal <- ST.readSTRef __field__internal
+                                             Prelude.pure
+                                               (ModuleMembership __val__declaration __val__internal)
+              _idMap = HashMap.fromList [("declaration", 1), ("internal", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleMembership where
+  rnf (ModuleMembership __field__declaration __field__internal)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__internal `Prelude.seq` ()
+
+instance Default.Default ModuleMembership where
+  def = ModuleMembership Default.def Prelude.False
+
+instance Hashable.Hashable ModuleMembership where
+  hashWithSalt __salt (ModuleMembership _declaration _internal)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _internal
+
+data ModuleDefinition_key = ModuleDefinition_key{moduleDefinition_key_declaration
+                                                 :: ModuleDeclaration,
+                                                 moduleDefinition_key_attributes :: [UserAttribute]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDefinition_key where
+  toJSON
+    (ModuleDefinition_key __field__declaration __field__attributes)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "attributes" .= __field__attributes : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDefinition_key where
+  buildStruct _proxy
+    (ModuleDefinition_key __field__declaration __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__attributes)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (ModuleDefinition_key __val__declaration
+                                                  __val__attributes)
+              _idMap = HashMap.fromList [("declaration", 1), ("attributes", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDefinition_key where
+  rnf (ModuleDefinition_key __field__declaration __field__attributes)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default ModuleDefinition_key where
+  def = ModuleDefinition_key Default.def Default.def
+
+instance Hashable.Hashable ModuleDefinition_key where
+  hashWithSalt __salt (ModuleDefinition_key _declaration _attributes)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _attributes
+
+newtype ModuleDeclaration_key = ModuleDeclaration_key{moduleDeclaration_key_name
+                                                      :: Name}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDeclaration_key where
+  toJSON (ModuleDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDeclaration_key where
+  buildStruct _proxy (ModuleDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (ModuleDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDeclaration_key where
+  rnf (ModuleDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ModuleDeclaration_key where
+  def = ModuleDeclaration_key Default.def
+
+instance Hashable.Hashable ModuleDeclaration_key where
+  hashWithSalt __salt (ModuleDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data MethodOverrides_key = MethodOverrides_key{methodOverrides_key_derived
+                                               :: MethodDeclaration,
+                                               methodOverrides_key_base :: MethodDeclaration,
+                                               methodOverrides_key_annotation ::
+                                               Prelude.Maybe Prelude.Bool}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides_key where
+  toJSON
+    (MethodOverrides_key __field__derived __field__base
+       __field__annotation)
+    = Aeson.object
+        ("derived" .= __field__derived :
+           "base" .= __field__base :
+             Prelude.maybe Prelude.id ((:) . ("annotation" .=))
+               __field__annotation
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides_key where
+  buildStruct _proxy
+    (MethodOverrides_key __field__derived __field__base
+       __field__annotation)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__derived)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             :
+             case __field__annotation of
+               Prelude.Just _val -> Thrift.genFieldBool _proxy "annotation" 3 2
+                                      _val
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__derived <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            __field__annotation <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__annotation
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__derived <- ST.readSTRef
+                                                                  __field__derived
+                                             !__val__base <- ST.readSTRef __field__base
+                                             !__val__annotation <- ST.readSTRef __field__annotation
+                                             Prelude.pure
+                                               (MethodOverrides_key __val__derived __val__base
+                                                  __val__annotation)
+              _idMap
+                = HashMap.fromList [("derived", 1), ("base", 2), ("annotation", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides_key where
+  rnf
+    (MethodOverrides_key __field__derived __field__base
+       __field__annotation)
+    = DeepSeq.rnf __field__derived `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq`
+          DeepSeq.rnf __field__annotation `Prelude.seq` ()
+
+instance Default.Default MethodOverrides_key where
+  def = MethodOverrides_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverrides_key where
+  hashWithSalt __salt
+    (MethodOverrides_key _derived _base _annotation)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _derived)
+           _base)
+        _annotation
+
+data MethodOverridden_key = MethodOverridden_key{methodOverridden_key_base
+                                                 :: MethodDeclaration,
+                                                 methodOverridden_key_derived :: MethodDeclaration,
+                                                 methodOverridden_key_annotation ::
+                                                 Prelude.Maybe Prelude.Bool}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverridden_key where
+  toJSON
+    (MethodOverridden_key __field__base __field__derived
+       __field__annotation)
+    = Aeson.object
+        ("base" .= __field__base :
+           "derived" .= __field__derived :
+             Prelude.maybe Prelude.id ((:) . ("annotation" .=))
+               __field__annotation
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverridden_key where
+  buildStruct _proxy
+    (MethodOverridden_key __field__base __field__derived
+       __field__annotation)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__derived)
+             :
+             case __field__annotation of
+               Prelude.Just _val -> Thrift.genFieldBool _proxy "annotation" 3 2
+                                      _val
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            __field__annotation <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__annotation
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             !__val__annotation <- ST.readSTRef __field__annotation
+                                             Prelude.pure
+                                               (MethodOverridden_key __val__base __val__derived
+                                                  __val__annotation)
+              _idMap
+                = HashMap.fromList [("base", 1), ("derived", 2), ("annotation", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverridden_key where
+  rnf
+    (MethodOverridden_key __field__base __field__derived
+       __field__annotation)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__derived `Prelude.seq`
+          DeepSeq.rnf __field__annotation `Prelude.seq` ()
+
+instance Default.Default MethodOverridden_key where
+  def = MethodOverridden_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverridden_key where
+  hashWithSalt __salt
+    (MethodOverridden_key _base _derived _annotation)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+           _derived)
+        _annotation
+
+data MethodOccurrence_key = MethodOccurrence_key{methodOccurrence_key_name
+                                                 :: Name,
+                                                 methodOccurrence_key_className ::
+                                                 Prelude.Maybe Name}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOccurrence_key where
+  toJSON (MethodOccurrence_key __field__name __field__className)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("className" .=))
+             __field__className
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOccurrence_key where
+  buildStruct _proxy
+    (MethodOccurrence_key __field__name __field__className)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__className of
+             Prelude.Just _val -> Thrift.genField _proxy "className"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__className <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__className
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__className <- ST.readSTRef __field__className
+                                             Prelude.pure
+                                               (MethodOccurrence_key __val__name __val__className)
+              _idMap = HashMap.fromList [("name", 1), ("className", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOccurrence_key where
+  rnf (MethodOccurrence_key __field__name __field__className)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__className `Prelude.seq` ()
+
+instance Default.Default MethodOccurrence_key where
+  def = MethodOccurrence_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOccurrence_key where
+  hashWithSalt __salt (MethodOccurrence_key _name _className)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _className
+
+newtype InterfaceDeclaration_key = InterfaceDeclaration_key{interfaceDeclaration_key_name
+                                                            :: QName}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDeclaration_key where
+  toJSON (InterfaceDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceDeclaration_key where
+  buildStruct _proxy (InterfaceDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (InterfaceDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDeclaration_key where
+  rnf (InterfaceDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default InterfaceDeclaration_key where
+  def = InterfaceDeclaration_key Default.def
+
+instance Hashable.Hashable InterfaceDeclaration_key where
+  hashWithSalt __salt (InterfaceDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+type IndexerInputsHash_value = ByteString.ByteString
+
+data GlobalNamespaceAlias_key = GlobalNamespaceAlias_key{globalNamespaceAlias_key_from
+                                                         :: Name,
+                                                         globalNamespaceAlias_key_to ::
+                                                         NamespaceQName}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalNamespaceAlias_key where
+  toJSON (GlobalNamespaceAlias_key __field__from __field__to)
+    = Aeson.object
+        ("from" .= __field__from : "to" .= __field__to : Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalNamespaceAlias_key where
+  buildStruct _proxy
+    (GlobalNamespaceAlias_key __field__from __field__to)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__from)
+           :
+           Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__to)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from <- ST.newSTRef Default.def
+            __field__to <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from <- ST.readSTRef __field__from
+                                             !__val__to <- ST.readSTRef __field__to
+                                             Prelude.pure
+                                               (GlobalNamespaceAlias_key __val__from __val__to)
+              _idMap = HashMap.fromList [("from", 1), ("to", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalNamespaceAlias_key where
+  rnf (GlobalNamespaceAlias_key __field__from __field__to)
+    = DeepSeq.rnf __field__from `Prelude.seq`
+        DeepSeq.rnf __field__to `Prelude.seq` ()
+
+instance Default.Default GlobalNamespaceAlias_key where
+  def = GlobalNamespaceAlias_key Default.def Default.def
+
+instance Hashable.Hashable GlobalNamespaceAlias_key where
+  hashWithSalt __salt (GlobalNamespaceAlias_key _from _to)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from) _to
+
+data GlobalConstDefinition_key = GlobalConstDefinition_key{globalConstDefinition_key_declaration
+                                                           :: GlobalConstDeclaration,
+                                                           globalConstDefinition_key_type ::
+                                                           Prelude.Maybe Type,
+                                                           globalConstDefinition_key_value ::
+                                                           Text.Text,
+                                                           globalConstDefinition_key_typeInfo ::
+                                                           Prelude.Maybe TypeInfo}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalConstDefinition_key where
+  toJSON
+    (GlobalConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+             ("value" .= __field__value :
+                Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+                  Prelude.mempty))
+
+instance Thrift.ThriftStruct GlobalConstDefinition_key where
+  buildStruct _proxy
+    (GlobalConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__type, __id__type)
+                 = case __field__type of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "type"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__type
+               (Thrift.genField _proxy "value" (Thrift.getStringType _proxy) 3
+                  __id__type
+                  (Thrift.genText _proxy __field__value)
+                  :
+                  case __field__typeInfo of
+                    Prelude.Just _val -> Thrift.genField _proxy "typeInfo"
+                                           (Thrift.getStructType _proxy)
+                                           4
+                                           3
+                                           (Thrift.buildStruct _proxy _val)
+                                           : []
+                    Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef ""
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             Prelude.pure
+                                               (GlobalConstDefinition_key __val__declaration
+                                                  __val__type
+                                                  __val__value
+                                                  __val__typeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("type", 2), ("value", 3), ("typeInfo", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalConstDefinition_key where
+  rnf
+    (GlobalConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq`
+            DeepSeq.rnf __field__typeInfo `Prelude.seq` ()
+
+instance Default.Default GlobalConstDefinition_key where
+  def
+    = GlobalConstDefinition_key Default.def Prelude.Nothing ""
+        Prelude.Nothing
+
+instance Hashable.Hashable GlobalConstDefinition_key where
+  hashWithSalt __salt
+    (GlobalConstDefinition_key _declaration _type _value _typeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+              _type)
+           _value)
+        _typeInfo
+
+newtype GlobalConstDeclaration_key = GlobalConstDeclaration_key{globalConstDeclaration_key_name
+                                                                :: QName}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GlobalConstDeclaration_key where
+  toJSON (GlobalConstDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct GlobalConstDeclaration_key where
+  buildStruct _proxy (GlobalConstDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (GlobalConstDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData GlobalConstDeclaration_key where
+  rnf (GlobalConstDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default GlobalConstDeclaration_key where
+  def = GlobalConstDeclaration_key Default.def
+
+instance Hashable.Hashable GlobalConstDeclaration_key where
+  hashWithSalt __salt (GlobalConstDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype FunctionDeclaration_key = FunctionDeclaration_key{functionDeclaration_key_name
+                                                          :: QName}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration_key where
+  toJSON (FunctionDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration_key where
+  buildStruct _proxy (FunctionDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (FunctionDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration_key where
+  rnf (FunctionDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration_key where
+  def = FunctionDeclaration_key Default.def
+
+instance Hashable.Hashable FunctionDeclaration_key where
+  hashWithSalt __salt (FunctionDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data FieldClassConst = FieldClassConst{fieldClassConst_container ::
+                                       QName,
+                                       fieldClassConst_name :: Name}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldClassConst where
+  toJSON (FieldClassConst __field__container __field__name)
+    = Aeson.object
+        ("container" .= __field__container :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldClassConst where
+  buildStruct _proxy
+    (FieldClassConst __field__container __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FieldClassConst __val__container __val__name)
+              _idMap = HashMap.fromList [("container", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldClassConst where
+  rnf (FieldClassConst __field__container __field__name)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FieldClassConst where
+  def = FieldClassConst Default.def Default.def
+
+instance Hashable.Hashable FieldClassConst where
+  hashWithSalt __salt (FieldClassConst _container _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _name
+
+data ShapeKV_key = ShapeKV_key_sf_regex_group Text.Text
+                 | ShapeKV_key_sf_lit_string Text.Text
+                 | ShapeKV_key_sf_class_const FieldClassConst
+                 | ShapeKV_key_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ShapeKV_key where
+  toJSON (ShapeKV_key_sf_regex_group __sf_regex_group)
+    = Aeson.object ["sf_regex_group" .= __sf_regex_group]
+  toJSON (ShapeKV_key_sf_lit_string __sf_lit_string)
+    = Aeson.object ["sf_lit_string" .= __sf_lit_string]
+  toJSON (ShapeKV_key_sf_class_const __sf_class_const)
+    = Aeson.object ["sf_class_const" .= __sf_class_const]
+  toJSON ShapeKV_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ShapeKV_key where
+  buildStruct _proxy (ShapeKV_key_sf_regex_group __sf_regex_group)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sf_regex_group"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __sf_regex_group)]
+  buildStruct _proxy (ShapeKV_key_sf_lit_string __sf_lit_string)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sf_lit_string"
+           (Thrift.getStringType _proxy)
+           2
+           0
+           (Thrift.genText _proxy __sf_lit_string)]
+  buildStruct _proxy (ShapeKV_key_sf_class_const __sf_class_const)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sf_class_const"
+           (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __sf_class_const)]
+  buildStruct _proxy ShapeKV_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShapeKV_key_sf_regex_group _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShapeKV_key_sf_lit_string _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ShapeKV_key_sf_class_const _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ShapeKV_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return ShapeKV_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("sf_regex_group", 1), ("sf_lit_string", 2),
+             ("sf_class_const", 3)]
+
+instance DeepSeq.NFData ShapeKV_key where
+  rnf (ShapeKV_key_sf_regex_group __sf_regex_group)
+    = DeepSeq.rnf __sf_regex_group
+  rnf (ShapeKV_key_sf_lit_string __sf_lit_string)
+    = DeepSeq.rnf __sf_lit_string
+  rnf (ShapeKV_key_sf_class_const __sf_class_const)
+    = DeepSeq.rnf __sf_class_const
+  rnf ShapeKV_key_EMPTY = ()
+
+instance Default.Default ShapeKV_key where
+  def = ShapeKV_key_EMPTY
+
+instance Hashable.Hashable ShapeKV_key where
+  hashWithSalt __salt (ShapeKV_key_sf_regex_group _sf_regex_group)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _sf_regex_group)
+  hashWithSalt __salt (ShapeKV_key_sf_lit_string _sf_lit_string)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _sf_lit_string)
+  hashWithSalt __salt (ShapeKV_key_sf_class_const _sf_class_const)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _sf_class_const)
+  hashWithSalt __salt ShapeKV_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ShapeKV = ShapeKV{shapeKV_key :: ShapeKV_key,
+                       shapeKV_value :: Hint, shapeKV_opt :: Prelude.Bool}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ShapeKV where
+  toJSON (ShapeKV __field__key __field__value __field__opt)
+    = Aeson.object
+        ("key" .= __field__key :
+           "value" .= __field__value : "opt" .= __field__opt : Prelude.mempty)
+
+instance Thrift.ThriftStruct ShapeKV where
+  buildStruct _proxy
+    (ShapeKV __field__key __field__value __field__opt)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "key" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__key)
+           :
+           Thrift.genField _proxy "value" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__value)
+             : Thrift.genFieldBool _proxy "opt" 3 2 __field__opt : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__key <- ST.newSTRef Default.def
+            __field__value <- ST.newSTRef Default.def
+            __field__opt <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__opt
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__opt <- ST.readSTRef __field__opt
+                                             Prelude.pure
+                                               (ShapeKV __val__key __val__value __val__opt)
+              _idMap = HashMap.fromList [("key", 1), ("value", 2), ("opt", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ShapeKV where
+  rnf (ShapeKV __field__key __field__value __field__opt)
+    = DeepSeq.rnf __field__key `Prelude.seq`
+        DeepSeq.rnf __field__value `Prelude.seq`
+          DeepSeq.rnf __field__opt `Prelude.seq` ()
+
+instance Default.Default ShapeKV where
+  def = ShapeKV Default.def Default.def Prelude.False
+
+instance Hashable.Hashable ShapeKV where
+  hashWithSalt __salt (ShapeKV _key _value _opt)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _key) _value)
+        _opt
+
+data Hint_apply_ = Hint_apply_{hint_apply__class_name :: QName,
+                               hint_apply__values :: [Hint]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint_apply_ where
+  toJSON (Hint_apply_ __field__class_name __field__values)
+    = Aeson.object
+        ("class_name" .= __field__class_name :
+           "values" .= __field__values : Prelude.mempty)
+
+instance Thrift.ThriftStruct Hint_apply_ where
+  buildStruct _proxy
+    (Hint_apply_ __field__class_name __field__values)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "class_name" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__class_name)
+           :
+           Thrift.genField _proxy "values" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__values)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__class_name <- ST.newSTRef Default.def
+            __field__values <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__class_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__values
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__class_name <- ST.readSTRef
+                                                                     __field__class_name
+                                             !__val__values <- ST.readSTRef __field__values
+                                             Prelude.pure
+                                               (Hint_apply_ __val__class_name __val__values)
+              _idMap = HashMap.fromList [("class_name", 1), ("values", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Hint_apply_ where
+  rnf (Hint_apply_ __field__class_name __field__values)
+    = DeepSeq.rnf __field__class_name `Prelude.seq`
+        DeepSeq.rnf __field__values `Prelude.seq` ()
+
+instance Default.Default Hint_apply_ where
+  def = Hint_apply_ Default.def Default.def
+
+instance Hashable.Hashable Hint_apply_ where
+  hashWithSalt __salt (Hint_apply_ _class_name _values)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _class_name)
+        _values
+
+data Hint_tuple_ = Hint_tuple_{hint_tuple__req :: [Hint],
+                               hint_tuple__opt :: [Hint],
+                               hint_tuple__variadic :: Prelude.Maybe Hint}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint_tuple_ where
+  toJSON (Hint_tuple_ __field__req __field__opt __field__variadic)
+    = Aeson.object
+        ("req" .= __field__req :
+           "opt" .= __field__opt :
+             Prelude.maybe Prelude.id ((:) . ("variadic" .=)) __field__variadic
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct Hint_tuple_ where
+  buildStruct _proxy
+    (Hint_tuple_ __field__req __field__opt __field__variadic)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "req" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__req)
+           :
+           Thrift.genField _proxy "opt" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__opt)
+             :
+             case __field__variadic of
+               Prelude.Just _val -> Thrift.genField _proxy "variadic"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__req <- ST.newSTRef Default.def
+            __field__opt <- ST.newSTRef Default.def
+            __field__variadic <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__req
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__opt
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__variadic
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__req <- ST.readSTRef __field__req
+                                             !__val__opt <- ST.readSTRef __field__opt
+                                             !__val__variadic <- ST.readSTRef __field__variadic
+                                             Prelude.pure
+                                               (Hint_tuple_ __val__req __val__opt __val__variadic)
+              _idMap = HashMap.fromList [("req", 1), ("opt", 2), ("variadic", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Hint_tuple_ where
+  rnf (Hint_tuple_ __field__req __field__opt __field__variadic)
+    = DeepSeq.rnf __field__req `Prelude.seq`
+        DeepSeq.rnf __field__opt `Prelude.seq`
+          DeepSeq.rnf __field__variadic `Prelude.seq` ()
+
+instance Default.Default Hint_tuple_ where
+  def = Hint_tuple_ Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable Hint_tuple_ where
+  hashWithSalt __salt (Hint_tuple_ _req _opt _variadic)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _req) _opt)
+        _variadic
+
+data Hint_shape_ = Hint_shape_{hint_shape__open_ :: Prelude.Bool,
+                               hint_shape__map_ :: [ShapeKV]}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint_shape_ where
+  toJSON (Hint_shape_ __field__open_ __field__map_)
+    = Aeson.object
+        ("open_" .= __field__open_ :
+           "map_" .= __field__map_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct Hint_shape_ where
+  buildStruct _proxy (Hint_shape_ __field__open_ __field__map_)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "open_" 1 0 __field__open_ :
+           Thrift.genField _proxy "map_" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__map_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__open_ <- ST.newSTRef Prelude.False
+            __field__map_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__open_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__map_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__open_ <- ST.readSTRef __field__open_
+                                             !__val__map_ <- ST.readSTRef __field__map_
+                                             Prelude.pure (Hint_shape_ __val__open_ __val__map_)
+              _idMap = HashMap.fromList [("open_", 1), ("map_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Hint_shape_ where
+  rnf (Hint_shape_ __field__open_ __field__map_)
+    = DeepSeq.rnf __field__open_ `Prelude.seq`
+        DeepSeq.rnf __field__map_ `Prelude.seq` ()
+
+instance Default.Default Hint_shape_ where
+  def = Hint_shape_ Prelude.False Default.def
+
+instance Hashable.Hashable Hint_shape_ where
+  hashWithSalt __salt (Hint_shape_ _open_ _map_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _open_) _map_
+
+data Hint_vect_or_dict_ = Hint_vect_or_dict_{hint_vect_or_dict__maybe_key
+                                             :: Prelude.Maybe Hint,
+                                             hint_vect_or_dict__value_ :: Hint}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint_vect_or_dict_ where
+  toJSON (Hint_vect_or_dict_ __field__maybe_key __field__value_)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("maybe_key" .=))
+           __field__maybe_key
+           ("value_" .= __field__value_ : Prelude.mempty))
+
+instance Thrift.ThriftStruct Hint_vect_or_dict_ where
+  buildStruct _proxy
+    (Hint_vect_or_dict_ __field__maybe_key __field__value_)
+    = Thrift.genStruct _proxy
+        (let (__cereal__maybe_key, __id__maybe_key)
+               = case __field__maybe_key of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "maybe_key"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__maybe_key
+             (Thrift.genField _proxy "value_" (Thrift.getStructType _proxy) 2
+                __id__maybe_key
+                (Thrift.buildStruct _proxy __field__value_)
+                : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__maybe_key <- ST.newSTRef Prelude.Nothing
+            __field__value_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__maybe_key
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__value_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__maybe_key <- ST.readSTRef
+                                                                    __field__maybe_key
+                                             !__val__value_ <- ST.readSTRef __field__value_
+                                             Prelude.pure
+                                               (Hint_vect_or_dict_ __val__maybe_key __val__value_)
+              _idMap = HashMap.fromList [("maybe_key", 1), ("value_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Hint_vect_or_dict_ where
+  rnf (Hint_vect_or_dict_ __field__maybe_key __field__value_)
+    = DeepSeq.rnf __field__maybe_key `Prelude.seq`
+        DeepSeq.rnf __field__value_ `Prelude.seq` ()
+
+instance Default.Default Hint_vect_or_dict_ where
+  def = Hint_vect_or_dict_ Prelude.Nothing Default.def
+
+instance Hashable.Hashable Hint_vect_or_dict_ where
+  hashWithSalt __salt (Hint_vect_or_dict_ _maybe_key _value_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _maybe_key)
+        _value_
+
+data Hint_key = Hint_key_apply Hint_apply_
+              | Hint_key_option Hint
+              | Hint_key_like Hint
+              | Hint_key_tuple Hint_tuple_
+              | Hint_key_class_args Hint
+              | Hint_key_shape Hint_shape_
+              | Hint_key_soft Hint
+              | Hint_key_intersection [Hint]
+              | Hint_key_union_ [Hint]
+              | Hint_key_vect_or_dict Hint_vect_or_dict_
+              | Hint_key_prim Type
+              | Hint_key_var_ Text.Text
+              | Hint_key_fun_context Text.Text
+              | Hint_key_mixed Glean.Schema.Builtin.Unit
+              | Hint_key_wildcard Glean.Schema.Builtin.Unit
+              | Hint_key_nonnull Glean.Schema.Builtin.Unit
+              | Hint_key_this_ Glean.Schema.Builtin.Unit
+              | Hint_key_dynamic Glean.Schema.Builtin.Unit
+              | Hint_key_nothing Glean.Schema.Builtin.Unit
+              | Hint_key_other Type
+              | Hint_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Hint_key where
+  toJSON (Hint_key_apply __apply) = Aeson.object ["apply" .= __apply]
+  toJSON (Hint_key_option __option)
+    = Aeson.object ["option" .= __option]
+  toJSON (Hint_key_like __like) = Aeson.object ["like" .= __like]
+  toJSON (Hint_key_tuple __tuple) = Aeson.object ["tuple" .= __tuple]
+  toJSON (Hint_key_class_args __class_args)
+    = Aeson.object ["class_args" .= __class_args]
+  toJSON (Hint_key_shape __shape) = Aeson.object ["shape" .= __shape]
+  toJSON (Hint_key_soft __soft) = Aeson.object ["soft" .= __soft]
+  toJSON (Hint_key_intersection __intersection)
+    = Aeson.object ["intersection" .= __intersection]
+  toJSON (Hint_key_union_ __union_)
+    = Aeson.object ["union_" .= __union_]
+  toJSON (Hint_key_vect_or_dict __vect_or_dict)
+    = Aeson.object ["vect_or_dict" .= __vect_or_dict]
+  toJSON (Hint_key_prim __prim) = Aeson.object ["prim" .= __prim]
+  toJSON (Hint_key_var_ __var_) = Aeson.object ["var_" .= __var_]
+  toJSON (Hint_key_fun_context __fun_context)
+    = Aeson.object ["fun_context" .= __fun_context]
+  toJSON (Hint_key_mixed __mixed) = Aeson.object ["mixed" .= __mixed]
+  toJSON (Hint_key_wildcard __wildcard)
+    = Aeson.object ["wildcard" .= __wildcard]
+  toJSON (Hint_key_nonnull __nonnull)
+    = Aeson.object ["nonnull" .= __nonnull]
+  toJSON (Hint_key_this_ __this_) = Aeson.object ["this_" .= __this_]
+  toJSON (Hint_key_dynamic __dynamic)
+    = Aeson.object ["dynamic" .= __dynamic]
+  toJSON (Hint_key_nothing __nothing)
+    = Aeson.object ["nothing" .= __nothing]
+  toJSON (Hint_key_other __other) = Aeson.object ["other" .= __other]
+  toJSON Hint_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Hint_key where
+  buildStruct _proxy (Hint_key_apply __apply)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "apply" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __apply)]
+  buildStruct _proxy (Hint_key_option __option)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "option" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __option)]
+  buildStruct _proxy (Hint_key_like __like)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "like" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __like)]
+  buildStruct _proxy (Hint_key_tuple __tuple)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tuple" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __tuple)]
+  buildStruct _proxy (Hint_key_class_args __class_args)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_args" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __class_args)]
+  buildStruct _proxy (Hint_key_shape __shape)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "shape" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __shape)]
+  buildStruct _proxy (Hint_key_soft __soft)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "soft" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __soft)]
+  buildStruct _proxy (Hint_key_intersection __intersection)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "intersection" (Thrift.getListType _proxy)
+           8
+           0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __intersection)]
+  buildStruct _proxy (Hint_key_union_ __union_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "union_" (Thrift.getListType _proxy) 9 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __union_)]
+  buildStruct _proxy (Hint_key_vect_or_dict __vect_or_dict)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "vect_or_dict"
+           (Thrift.getStructType _proxy)
+           10
+           0
+           (Thrift.buildStruct _proxy __vect_or_dict)]
+  buildStruct _proxy (Hint_key_prim __prim)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "prim" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __prim)]
+  buildStruct _proxy (Hint_key_var_ __var_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "var_" (Thrift.getStringType _proxy) 12 0
+           (Thrift.genText _proxy __var_)]
+  buildStruct _proxy (Hint_key_fun_context __fun_context)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fun_context" (Thrift.getStringType _proxy)
+           13
+           0
+           (Thrift.genText _proxy __fun_context)]
+  buildStruct _proxy (Hint_key_mixed __mixed)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "mixed" (Thrift.getStructType _proxy) 14 0
+           (Thrift.buildStruct _proxy __mixed)]
+  buildStruct _proxy (Hint_key_wildcard __wildcard)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "wildcard" (Thrift.getStructType _proxy) 15
+           0
+           (Thrift.buildStruct _proxy __wildcard)]
+  buildStruct _proxy (Hint_key_nonnull __nonnull)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "nonnull" (Thrift.getStructType _proxy) 16
+           0
+           (Thrift.buildStruct _proxy __nonnull)]
+  buildStruct _proxy (Hint_key_this_ __this_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "this_" (Thrift.getStructType _proxy) 17 0
+           (Thrift.buildStruct _proxy __this_)]
+  buildStruct _proxy (Hint_key_dynamic __dynamic)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "dynamic" (Thrift.getStructType _proxy) 18
+           0
+           (Thrift.buildStruct _proxy __dynamic)]
+  buildStruct _proxy (Hint_key_nothing __nothing)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "nothing" (Thrift.getStructType _proxy) 19
+           0
+           (Thrift.buildStruct _proxy __nothing)]
+  buildStruct _proxy (Hint_key_other __other)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "other" (Thrift.getStructType _proxy) 20 0
+           (Thrift.buildStruct _proxy __other)]
+  buildStruct _proxy Hint_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_apply _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_option _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_like _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_tuple _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Hint_key_class_args _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_shape _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_soft _val)
+                                                     8 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Hint_key_intersection _val)
+                                                     9 | _type == Thrift.getListType _proxy ->
+                                                         do _val <- Prelude.snd <$>
+                                                                      Thrift.parseList _proxy
+                                                                        (Thrift.parseStruct _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Hint_key_union_ _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Hint_key_vect_or_dict _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_prim _val)
+                                                     12 | _type == Thrift.getStringType _proxy ->
+                                                          do _val <- Thrift.parseText _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_var_ _val)
+                                                     13 | _type == Thrift.getStringType _proxy ->
+                                                          do _val <- Thrift.parseText _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Hint_key_fun_context _val)
+                                                     14 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_mixed _val)
+                                                     15 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_wildcard _val)
+                                                     16 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_nonnull _val)
+                                                     17 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_this_ _val)
+                                                     18 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_dynamic _val)
+                                                     19 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_nothing _val)
+                                                     20 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Hint_key_other _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Hint_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Hint_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("apply", 1), ("option", 2), ("like", 3), ("tuple", 4),
+             ("class_args", 5), ("shape", 6), ("soft", 7), ("intersection", 8),
+             ("union_", 9), ("vect_or_dict", 10), ("prim", 11), ("var_", 12),
+             ("fun_context", 13), ("mixed", 14), ("wildcard", 15),
+             ("nonnull", 16), ("this_", 17), ("dynamic", 18), ("nothing", 19),
+             ("other", 20)]
+
+instance DeepSeq.NFData Hint_key where
+  rnf (Hint_key_apply __apply) = DeepSeq.rnf __apply
+  rnf (Hint_key_option __option) = DeepSeq.rnf __option
+  rnf (Hint_key_like __like) = DeepSeq.rnf __like
+  rnf (Hint_key_tuple __tuple) = DeepSeq.rnf __tuple
+  rnf (Hint_key_class_args __class_args) = DeepSeq.rnf __class_args
+  rnf (Hint_key_shape __shape) = DeepSeq.rnf __shape
+  rnf (Hint_key_soft __soft) = DeepSeq.rnf __soft
+  rnf (Hint_key_intersection __intersection)
+    = DeepSeq.rnf __intersection
+  rnf (Hint_key_union_ __union_) = DeepSeq.rnf __union_
+  rnf (Hint_key_vect_or_dict __vect_or_dict)
+    = DeepSeq.rnf __vect_or_dict
+  rnf (Hint_key_prim __prim) = DeepSeq.rnf __prim
+  rnf (Hint_key_var_ __var_) = DeepSeq.rnf __var_
+  rnf (Hint_key_fun_context __fun_context)
+    = DeepSeq.rnf __fun_context
+  rnf (Hint_key_mixed __mixed) = DeepSeq.rnf __mixed
+  rnf (Hint_key_wildcard __wildcard) = DeepSeq.rnf __wildcard
+  rnf (Hint_key_nonnull __nonnull) = DeepSeq.rnf __nonnull
+  rnf (Hint_key_this_ __this_) = DeepSeq.rnf __this_
+  rnf (Hint_key_dynamic __dynamic) = DeepSeq.rnf __dynamic
+  rnf (Hint_key_nothing __nothing) = DeepSeq.rnf __nothing
+  rnf (Hint_key_other __other) = DeepSeq.rnf __other
+  rnf Hint_key_EMPTY = ()
+
+instance Default.Default Hint_key where
+  def = Hint_key_EMPTY
+
+instance Hashable.Hashable Hint_key where
+  hashWithSalt __salt (Hint_key_apply _apply)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _apply)
+  hashWithSalt __salt (Hint_key_option _option)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _option)
+  hashWithSalt __salt (Hint_key_like _like)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _like)
+  hashWithSalt __salt (Hint_key_tuple _tuple)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _tuple)
+  hashWithSalt __salt (Hint_key_class_args _class_args)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _class_args)
+  hashWithSalt __salt (Hint_key_shape _shape)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _shape)
+  hashWithSalt __salt (Hint_key_soft _soft)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _soft)
+  hashWithSalt __salt (Hint_key_intersection _intersection)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 8 _intersection)
+  hashWithSalt __salt (Hint_key_union_ _union_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _union_)
+  hashWithSalt __salt (Hint_key_vect_or_dict _vect_or_dict)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 10 _vect_or_dict)
+  hashWithSalt __salt (Hint_key_prim _prim)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _prim)
+  hashWithSalt __salt (Hint_key_var_ _var_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _var_)
+  hashWithSalt __salt (Hint_key_fun_context _fun_context)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 13 _fun_context)
+  hashWithSalt __salt (Hint_key_mixed _mixed)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 14 _mixed)
+  hashWithSalt __salt (Hint_key_wildcard _wildcard)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 15 _wildcard)
+  hashWithSalt __salt (Hint_key_nonnull _nonnull)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 16 _nonnull)
+  hashWithSalt __salt (Hint_key_this_ _this_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 17 _this_)
+  hashWithSalt __salt (Hint_key_dynamic _dynamic)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 18 _dynamic)
+  hashWithSalt __salt (Hint_key_nothing _nothing)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 19 _nothing)
+  hashWithSalt __salt (Hint_key_other _other)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 20 _other)
+  hashWithSalt __salt Hint_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Enumerator_key = Enumerator_key{enumerator_key_name :: Name,
+                                     enumerator_key_enumeration :: EnumDeclaration}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enumerator_key where
+  toJSON (Enumerator_key __field__name __field__enumeration)
+    = Aeson.object
+        ("name" .= __field__name :
+           "enumeration" .= __field__enumeration : Prelude.mempty)
+
+instance Thrift.ThriftStruct Enumerator_key where
+  buildStruct _proxy
+    (Enumerator_key __field__name __field__enumeration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "enumeration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__enumeration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__enumeration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumeration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__enumeration <- ST.readSTRef
+                                                                      __field__enumeration
+                                             Prelude.pure
+                                               (Enumerator_key __val__name __val__enumeration)
+              _idMap = HashMap.fromList [("name", 1), ("enumeration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Enumerator_key where
+  rnf (Enumerator_key __field__name __field__enumeration)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__enumeration `Prelude.seq` ()
+
+instance Default.Default Enumerator_key where
+  def = Enumerator_key Default.def Default.def
+
+instance Hashable.Hashable Enumerator_key where
+  hashWithSalt __salt (Enumerator_key _name _enumeration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _enumeration
+
+data EnumDefinition_key = EnumDefinition_key{enumDefinition_key_declaration
+                                             :: EnumDeclaration,
+                                             enumDefinition_key_enumBase :: Type,
+                                             enumDefinition_key_enumBaseTypeInfo ::
+                                             Prelude.Maybe TypeInfo,
+                                             enumDefinition_key_enumConstraint ::
+                                             Prelude.Maybe Type,
+                                             enumDefinition_key_enumConstraintTypeInfo ::
+                                             Prelude.Maybe TypeInfo,
+                                             enumDefinition_key_enumerators :: [Enumerator],
+                                             enumDefinition_key_attributes :: [UserAttribute],
+                                             enumDefinition_key_includes :: [EnumDeclaration],
+                                             enumDefinition_key_isEnumClass :: Prelude.Bool,
+                                             enumDefinition_key_module_ ::
+                                             Prelude.Maybe ModuleMembership}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDefinition_key where
+  toJSON
+    (EnumDefinition_key __field__declaration __field__enumBase
+       __field__enumBaseTypeInfo __field__enumConstraint
+       __field__enumConstraintTypeInfo __field__enumerators
+       __field__attributes __field__includes __field__isEnumClass
+       __field__module_)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "enumBase" .= __field__enumBase :
+             Prelude.maybe Prelude.id ((:) . ("enumBaseTypeInfo" .=))
+               __field__enumBaseTypeInfo
+               (Prelude.maybe Prelude.id ((:) . ("enumConstraint" .=))
+                  __field__enumConstraint
+                  (Prelude.maybe Prelude.id ((:) . ("enumConstraintTypeInfo" .=))
+                     __field__enumConstraintTypeInfo
+                     ("enumerators" .= __field__enumerators :
+                        "attributes" .= __field__attributes :
+                          "includes" .= __field__includes :
+                            "isEnumClass" .= __field__isEnumClass :
+                              Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                                Prelude.mempty))))
+
+instance Thrift.ThriftStruct EnumDefinition_key where
+  buildStruct _proxy
+    (EnumDefinition_key __field__declaration __field__enumBase
+       __field__enumBaseTypeInfo __field__enumConstraint
+       __field__enumConstraintTypeInfo __field__enumerators
+       __field__attributes __field__includes __field__isEnumClass
+       __field__module_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "enumBase" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__enumBase)
+             :
+             let (__cereal__enumBaseTypeInfo, __id__enumBaseTypeInfo)
+                   = case __field__enumBaseTypeInfo of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "enumBaseTypeInfo"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__enumBaseTypeInfo
+                 (let (__cereal__enumConstraint, __id__enumConstraint)
+                        = case __field__enumConstraint of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "enumConstraint"
+                                                       (Thrift.getStructType _proxy)
+                                                       4
+                                                       __id__enumBaseTypeInfo
+                                                       (Thrift.buildStruct _proxy _val)),
+                                                  4)
+                            Prelude.Nothing -> (Prelude.id, __id__enumBaseTypeInfo)
+                    in
+                    __cereal__enumConstraint
+                      (let (__cereal__enumConstraintTypeInfo,
+                            __id__enumConstraintTypeInfo)
+                             = case __field__enumConstraintTypeInfo of
+                                 Prelude.Just _val -> ((:)
+                                                         (Thrift.genField _proxy
+                                                            "enumConstraintTypeInfo"
+                                                            (Thrift.getStructType _proxy)
+                                                            5
+                                                            __id__enumConstraint
+                                                            (Thrift.buildStruct _proxy _val)),
+                                                       5)
+                                 Prelude.Nothing -> (Prelude.id, __id__enumConstraint)
+                         in
+                         __cereal__enumConstraintTypeInfo
+                           (Thrift.genField _proxy "enumerators" (Thrift.getListType _proxy) 6
+                              __id__enumConstraintTypeInfo
+                              (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                 (Thrift.buildStruct _proxy)
+                                 __field__enumerators)
+                              :
+                              Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 7 6
+                                (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                   (Thrift.buildStruct _proxy)
+                                   __field__attributes)
+                                :
+                                Thrift.genField _proxy "includes" (Thrift.getListType _proxy) 8 7
+                                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                     (Thrift.buildStruct _proxy)
+                                     __field__includes)
+                                  :
+                                  Thrift.genFieldBool _proxy "isEnumClass" 9 8 __field__isEnumClass
+                                    :
+                                    case __field__module_ of
+                                      Prelude.Just _val -> Thrift.genField _proxy "module_"
+                                                             (Thrift.getStructType _proxy)
+                                                             10
+                                                             9
+                                                             (Thrift.buildStruct _proxy _val)
+                                                             : []
+                                      Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__enumBase <- ST.newSTRef Default.def
+            __field__enumBaseTypeInfo <- ST.newSTRef Prelude.Nothing
+            __field__enumConstraint <- ST.newSTRef Prelude.Nothing
+            __field__enumConstraintTypeInfo <- ST.newSTRef Prelude.Nothing
+            __field__enumerators <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            __field__includes <- ST.newSTRef Default.def
+            __field__isEnumClass <- ST.newSTRef Prelude.False
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumBase
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumBaseTypeInfo
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumConstraint
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumConstraintTypeInfo
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__enumerators
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__includes
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isEnumClass
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__module_
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__enumBase <- ST.readSTRef __field__enumBase
+                                             !__val__enumBaseTypeInfo <- ST.readSTRef
+                                                                           __field__enumBaseTypeInfo
+                                             !__val__enumConstraint <- ST.readSTRef
+                                                                         __field__enumConstraint
+                                             !__val__enumConstraintTypeInfo <- ST.readSTRef
+                                                                                 __field__enumConstraintTypeInfo
+                                             !__val__enumerators <- ST.readSTRef
+                                                                      __field__enumerators
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__includes <- ST.readSTRef __field__includes
+                                             !__val__isEnumClass <- ST.readSTRef
+                                                                      __field__isEnumClass
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             Prelude.pure
+                                               (EnumDefinition_key __val__declaration
+                                                  __val__enumBase
+                                                  __val__enumBaseTypeInfo
+                                                  __val__enumConstraint
+                                                  __val__enumConstraintTypeInfo
+                                                  __val__enumerators
+                                                  __val__attributes
+                                                  __val__includes
+                                                  __val__isEnumClass
+                                                  __val__module_)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("enumBase", 2), ("enumBaseTypeInfo", 3),
+                     ("enumConstraint", 4), ("enumConstraintTypeInfo", 5),
+                     ("enumerators", 6), ("attributes", 7), ("includes", 8),
+                     ("isEnumClass", 9), ("module_", 10)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDefinition_key where
+  rnf
+    (EnumDefinition_key __field__declaration __field__enumBase
+       __field__enumBaseTypeInfo __field__enumConstraint
+       __field__enumConstraintTypeInfo __field__enumerators
+       __field__attributes __field__includes __field__isEnumClass
+       __field__module_)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__enumBase `Prelude.seq`
+          DeepSeq.rnf __field__enumBaseTypeInfo `Prelude.seq`
+            DeepSeq.rnf __field__enumConstraint `Prelude.seq`
+              DeepSeq.rnf __field__enumConstraintTypeInfo `Prelude.seq`
+                DeepSeq.rnf __field__enumerators `Prelude.seq`
+                  DeepSeq.rnf __field__attributes `Prelude.seq`
+                    DeepSeq.rnf __field__includes `Prelude.seq`
+                      DeepSeq.rnf __field__isEnumClass `Prelude.seq`
+                        DeepSeq.rnf __field__module_ `Prelude.seq` ()
+
+instance Default.Default EnumDefinition_key where
+  def
+    = EnumDefinition_key Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+        Prelude.False
+        Prelude.Nothing
+
+instance Hashable.Hashable EnumDefinition_key where
+  hashWithSalt __salt
+    (EnumDefinition_key _declaration _enumBase _enumBaseTypeInfo
+       _enumConstraint _enumConstraintTypeInfo _enumerators _attributes
+       _includes _isEnumClass _module_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                                _enumBase)
+                             _enumBaseTypeInfo)
+                          _enumConstraint)
+                       _enumConstraintTypeInfo)
+                    _enumerators)
+                 _attributes)
+              _includes)
+           _isEnumClass)
+        _module_
+
+newtype EnumDeclaration_key = EnumDeclaration_key{enumDeclaration_key_name
+                                                  :: QName}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration_key where
+  toJSON (EnumDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclaration_key where
+  buildStruct _proxy (EnumDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (EnumDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration_key where
+  rnf (EnumDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration_key where
+  def = EnumDeclaration_key Default.def
+
+instance Hashable.Hashable EnumDeclaration_key where
+  hashWithSalt __salt (EnumDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data Definition = Definition_class_ ClassDefinition
+                | Definition_classConst ClassConstDefinition
+                | Definition_enum_ EnumDefinition
+                | Definition_function_ FunctionDefinition
+                | Definition_globalConst GlobalConstDefinition
+                | Definition_interface_ InterfaceDefinition
+                | Definition_trait TraitDefinition
+                | Definition_method MethodDefinition
+                | Definition_property_ PropertyDefinition
+                | Definition_typeConst TypeConstDefinition
+                | Definition_typedef_ TypedefDefinition
+                | Definition_module ModuleDefinition
+                | Definition_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (Definition_classConst __classConst)
+    = Aeson.object ["classConst" .= __classConst]
+  toJSON (Definition_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (Definition_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (Definition_globalConst __globalConst)
+    = Aeson.object ["globalConst" .= __globalConst]
+  toJSON (Definition_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (Definition_trait __trait)
+    = Aeson.object ["trait" .= __trait]
+  toJSON (Definition_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Definition_property_ __property_)
+    = Aeson.object ["property_" .= __property_]
+  toJSON (Definition_typeConst __typeConst)
+    = Aeson.object ["typeConst" .= __typeConst]
+  toJSON (Definition_typedef_ __typedef_)
+    = Aeson.object ["typedef_" .= __typedef_]
+  toJSON (Definition_module __module)
+    = Aeson.object ["module" .= __module]
+  toJSON Definition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (Definition_classConst __classConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "classConst" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __classConst)]
+  buildStruct _proxy (Definition_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (Definition_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (Definition_globalConst __globalConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "globalConst" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __globalConst)]
+  buildStruct _proxy (Definition_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           6
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy (Definition_trait __trait)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "trait" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __trait)]
+  buildStruct _proxy (Definition_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Definition_property_ __property_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "property_" (Thrift.getStructType _proxy) 9
+           0
+           (Thrift.buildStruct _proxy __property_)]
+  buildStruct _proxy (Definition_typeConst __typeConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeConst" (Thrift.getStructType _proxy)
+           10
+           0
+           (Thrift.buildStruct _proxy __typeConst)]
+  buildStruct _proxy (Definition_typedef_ __typedef_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typedef_" (Thrift.getStructType _proxy) 11
+           0
+           (Thrift.buildStruct _proxy __typedef_)]
+  buildStruct _proxy (Definition_module __module)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 12 0
+           (Thrift.buildStruct _proxy __module)]
+  buildStruct _proxy Definition_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_class_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_classConst _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_enum_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_function_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_globalConst _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_interface_ _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_trait _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_method _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_property_ _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Definition_typeConst _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Definition_typedef_ _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Definition_module _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Definition_EMPTY
+           Thrift.FieldEnd -> Prelude.return Definition_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("class_", 1), ("classConst", 2), ("enum_", 3), ("function_", 4),
+             ("globalConst", 5), ("interface_", 6), ("trait", 7), ("method", 8),
+             ("property_", 9), ("typeConst", 10), ("typedef_", 11),
+             ("module", 12)]
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition_class_ __class_) = DeepSeq.rnf __class_
+  rnf (Definition_classConst __classConst) = DeepSeq.rnf __classConst
+  rnf (Definition_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (Definition_function_ __function_) = DeepSeq.rnf __function_
+  rnf (Definition_globalConst __globalConst)
+    = DeepSeq.rnf __globalConst
+  rnf (Definition_interface_ __interface_) = DeepSeq.rnf __interface_
+  rnf (Definition_trait __trait) = DeepSeq.rnf __trait
+  rnf (Definition_method __method) = DeepSeq.rnf __method
+  rnf (Definition_property_ __property_) = DeepSeq.rnf __property_
+  rnf (Definition_typeConst __typeConst) = DeepSeq.rnf __typeConst
+  rnf (Definition_typedef_ __typedef_) = DeepSeq.rnf __typedef_
+  rnf (Definition_module __module) = DeepSeq.rnf __module
+  rnf Definition_EMPTY = ()
+
+instance Default.Default Definition where
+  def = Definition_EMPTY
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _class_)
+  hashWithSalt __salt (Definition_classConst _classConst)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _classConst)
+  hashWithSalt __salt (Definition_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _enum_)
+  hashWithSalt __salt (Definition_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _function_)
+  hashWithSalt __salt (Definition_globalConst _globalConst)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _globalConst)
+  hashWithSalt __salt (Definition_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _interface_)
+  hashWithSalt __salt (Definition_trait _trait)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _trait)
+  hashWithSalt __salt (Definition_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _method)
+  hashWithSalt __salt (Definition_property_ _property_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _property_)
+  hashWithSalt __salt (Definition_typeConst _typeConst)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 10 _typeConst)
+  hashWithSalt __salt (Definition_typedef_ _typedef_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _typedef_)
+  hashWithSalt __salt (Definition_module _module)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _module)
+  hashWithSalt __salt Definition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ContainerDeclaration = ContainerDeclaration_class_ ClassDeclaration
+                          | ContainerDeclaration_enum_ EnumDeclaration
+                          | ContainerDeclaration_interface_ InterfaceDeclaration
+                          | ContainerDeclaration_trait TraitDeclaration
+                          | ContainerDeclaration_EMPTY
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerDeclaration where
+  toJSON (ContainerDeclaration_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (ContainerDeclaration_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON (ContainerDeclaration_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (ContainerDeclaration_trait __trait)
+    = Aeson.object ["trait" .= __trait]
+  toJSON ContainerDeclaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ContainerDeclaration where
+  buildStruct _proxy (ContainerDeclaration_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (ContainerDeclaration_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy (ContainerDeclaration_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy (ContainerDeclaration_trait __trait)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "trait" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __trait)]
+  buildStruct _proxy ContainerDeclaration_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ContainerDeclaration_class_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ContainerDeclaration_enum_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ContainerDeclaration_interface_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ContainerDeclaration_trait _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               ContainerDeclaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return ContainerDeclaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("class_", 1), ("enum_", 2), ("interface_", 3), ("trait", 4)]
+
+instance DeepSeq.NFData ContainerDeclaration where
+  rnf (ContainerDeclaration_class_ __class_) = DeepSeq.rnf __class_
+  rnf (ContainerDeclaration_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf (ContainerDeclaration_interface_ __interface_)
+    = DeepSeq.rnf __interface_
+  rnf (ContainerDeclaration_trait __trait) = DeepSeq.rnf __trait
+  rnf ContainerDeclaration_EMPTY = ()
+
+instance Default.Default ContainerDeclaration where
+  def = ContainerDeclaration_EMPTY
+
+instance Hashable.Hashable ContainerDeclaration where
+  hashWithSalt __salt (ContainerDeclaration_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _class_)
+  hashWithSalt __salt (ContainerDeclaration_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _enum_)
+  hashWithSalt __salt (ContainerDeclaration_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _interface_)
+  hashWithSalt __salt (ContainerDeclaration_trait _trait)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _trait)
+  hashWithSalt __salt ContainerDeclaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+type ContainerDeclarationQName_value = QName
+
+data ContainerParent_key = ContainerParent_key{containerParent_key_container
+                                               :: ContainerDeclaration,
+                                               containerParent_key_parent :: ContainerDeclaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerParent_key where
+  toJSON (ContainerParent_key __field__container __field__parent)
+    = Aeson.object
+        ("container" .= __field__container :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainerParent_key where
+  buildStruct _proxy
+    (ContainerParent_key __field__container __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ContainerParent_key __val__container __val__parent)
+              _idMap = HashMap.fromList [("container", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainerParent_key where
+  rnf (ContainerParent_key __field__container __field__parent)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ContainerParent_key where
+  def = ContainerParent_key Default.def Default.def
+
+instance Hashable.Hashable ContainerParent_key where
+  hashWithSalt __salt (ContainerParent_key _container _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _parent
+
+data Declaration = Declaration_classConst ClassConstDeclaration
+                 | Declaration_container ContainerDeclaration
+                 | Declaration_enumerator Enumerator
+                 | Declaration_function_ FunctionDeclaration
+                 | Declaration_globalConst GlobalConstDeclaration
+                 | Declaration_namespace_ NamespaceDeclaration
+                 | Declaration_method MethodDeclaration
+                 | Declaration_property_ PropertyDeclaration
+                 | Declaration_typeConst TypeConstDeclaration
+                 | Declaration_typedef_ TypedefDeclaration
+                 | Declaration_module ModuleDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_classConst __classConst)
+    = Aeson.object ["classConst" .= __classConst]
+  toJSON (Declaration_container __container)
+    = Aeson.object ["container" .= __container]
+  toJSON (Declaration_enumerator __enumerator)
+    = Aeson.object ["enumerator" .= __enumerator]
+  toJSON (Declaration_function_ __function_)
+    = Aeson.object ["function_" .= __function_]
+  toJSON (Declaration_globalConst __globalConst)
+    = Aeson.object ["globalConst" .= __globalConst]
+  toJSON (Declaration_namespace_ __namespace_)
+    = Aeson.object ["namespace_" .= __namespace_]
+  toJSON (Declaration_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Declaration_property_ __property_)
+    = Aeson.object ["property_" .= __property_]
+  toJSON (Declaration_typeConst __typeConst)
+    = Aeson.object ["typeConst" .= __typeConst]
+  toJSON (Declaration_typedef_ __typedef_)
+    = Aeson.object ["typedef_" .= __typedef_]
+  toJSON (Declaration_module __module)
+    = Aeson.object ["module" .= __module]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_classConst __classConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "classConst" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __classConst)]
+  buildStruct _proxy (Declaration_container __container)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __container)]
+  buildStruct _proxy (Declaration_enumerator __enumerator)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enumerator" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __enumerator)]
+  buildStruct _proxy (Declaration_function_ __function_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "function_" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __function_)]
+  buildStruct _proxy (Declaration_globalConst __globalConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "globalConst" (Thrift.getStructType _proxy)
+           5
+           0
+           (Thrift.buildStruct _proxy __globalConst)]
+  buildStruct _proxy (Declaration_namespace_ __namespace_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           6
+           0
+           (Thrift.buildStruct _proxy __namespace_)]
+  buildStruct _proxy (Declaration_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Declaration_property_ __property_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "property_" (Thrift.getStructType _proxy) 8
+           0
+           (Thrift.buildStruct _proxy __property_)]
+  buildStruct _proxy (Declaration_typeConst __typeConst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeConst" (Thrift.getStructType _proxy) 9
+           0
+           (Thrift.buildStruct _proxy __typeConst)]
+  buildStruct _proxy (Declaration_typedef_ __typedef_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typedef_" (Thrift.getStructType _proxy) 10
+           0
+           (Thrift.buildStruct _proxy __typedef_)]
+  buildStruct _proxy (Declaration_module __module)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __module)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_classConst _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_container _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_enumerator _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_function_ _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_globalConst _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_namespace_ _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_method _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_property_ _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_typeConst _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_typedef_ _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_module _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("classConst", 1), ("container", 2), ("enumerator", 3),
+             ("function_", 4), ("globalConst", 5), ("namespace_", 6),
+             ("method", 7), ("property_", 8), ("typeConst", 9),
+             ("typedef_", 10), ("module", 11)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_classConst __classConst)
+    = DeepSeq.rnf __classConst
+  rnf (Declaration_container __container) = DeepSeq.rnf __container
+  rnf (Declaration_enumerator __enumerator)
+    = DeepSeq.rnf __enumerator
+  rnf (Declaration_function_ __function_) = DeepSeq.rnf __function_
+  rnf (Declaration_globalConst __globalConst)
+    = DeepSeq.rnf __globalConst
+  rnf (Declaration_namespace_ __namespace_)
+    = DeepSeq.rnf __namespace_
+  rnf (Declaration_method __method) = DeepSeq.rnf __method
+  rnf (Declaration_property_ __property_) = DeepSeq.rnf __property_
+  rnf (Declaration_typeConst __typeConst) = DeepSeq.rnf __typeConst
+  rnf (Declaration_typedef_ __typedef_) = DeepSeq.rnf __typedef_
+  rnf (Declaration_module __module) = DeepSeq.rnf __module
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_classConst _classConst)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _classConst)
+  hashWithSalt __salt (Declaration_container _container)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _container)
+  hashWithSalt __salt (Declaration_enumerator _enumerator)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _enumerator)
+  hashWithSalt __salt (Declaration_function_ _function_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _function_)
+  hashWithSalt __salt (Declaration_globalConst _globalConst)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 5 _globalConst)
+  hashWithSalt __salt (Declaration_namespace_ _namespace_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _namespace_)
+  hashWithSalt __salt (Declaration_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _method)
+  hashWithSalt __salt (Declaration_property_ _property_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _property_)
+  hashWithSalt __salt (Declaration_typeConst _typeConst)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _typeConst)
+  hashWithSalt __salt (Declaration_typedef_ _typedef_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _typedef_)
+  hashWithSalt __salt (Declaration_module _module)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _module)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationComment_key = DeclarationComment_key{declarationComment_key_declaration
+                                                     :: Declaration,
+                                                     declarationComment_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     declarationComment_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment_key where
+  toJSON
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment_key where
+  buildStruct _proxy
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationComment_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment_key where
+  rnf
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationComment_key where
+  def = DeclarationComment_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationComment_key where
+  hashWithSalt __salt
+    (DeclarationComment_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_declaration
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+type DeclarationName_value = Name
+
+data DeclarationNamespace_key = DeclarationNamespace_key{declarationNamespace_key_decl
+                                                         :: Declaration,
+                                                         declarationNamespace_key_namespace_ ::
+                                                         NamespaceQName}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationNamespace_key where
+  toJSON (DeclarationNamespace_key __field__decl __field__namespace_)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "namespace_" .= __field__namespace_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationNamespace_key where
+  buildStruct _proxy
+    (DeclarationNamespace_key __field__decl __field__namespace_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__namespace_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             Prelude.pure
+                                               (DeclarationNamespace_key __val__decl
+                                                  __val__namespace_)
+              _idMap = HashMap.fromList [("decl", 1), ("namespace_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationNamespace_key where
+  rnf (DeclarationNamespace_key __field__decl __field__namespace_)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq` ()
+
+instance Default.Default DeclarationNamespace_key where
+  def = DeclarationNamespace_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationNamespace_key where
+  hashWithSalt __salt (DeclarationNamespace_key _decl _namespace_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _namespace_
+
+data DeclarationSource_key = DeclarationSource_key{declarationSource_key_target
+                                                   :: Declaration,
+                                                   declarationSource_key_source :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSource_key where
+  toJSON (DeclarationSource_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSource_key where
+  buildStruct _proxy
+    (DeclarationSource_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (DeclarationSource_key __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSource_key where
+  rnf (DeclarationSource_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default DeclarationSource_key where
+  def = DeclarationSource_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationSource_key where
+  hashWithSalt __salt (DeclarationSource_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data DeclarationSpan_key = DeclarationSpan_key{declarationSpan_key_declaration
+                                               :: Declaration,
+                                               declarationSpan_key_file :: Glean.Schema.Src.File,
+                                               declarationSpan_key_span ::
+                                               Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSpan_key where
+  toJSON
+    (DeclarationSpan_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSpan_key where
+  buildStruct _proxy
+    (DeclarationSpan_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationSpan_key __val__declaration __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSpan_key where
+  rnf
+    (DeclarationSpan_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationSpan_key where
+  def = DeclarationSpan_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationSpan_key where
+  hashWithSalt __salt (DeclarationSpan_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationTarget_key = DeclarationTarget_key{declarationTarget_key_source
+                                                   :: Declaration,
+                                                   declarationTarget_key_target :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationTarget_key where
+  toJSON (DeclarationTarget_key __field__source __field__target)
+    = Aeson.object
+        ("source" .= __field__source :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationTarget_key where
+  buildStruct _proxy
+    (DeclarationTarget_key __field__source __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__source)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__source <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__source <- ST.readSTRef
+                                                                 __field__source
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (DeclarationTarget_key __val__source __val__target)
+              _idMap = HashMap.fromList [("source", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationTarget_key where
+  rnf (DeclarationTarget_key __field__source __field__target)
+    = DeepSeq.rnf __field__source `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default DeclarationTarget_key where
+  def = DeclarationTarget_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationTarget_key where
+  hashWithSalt __salt (DeclarationTarget_key _source _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _source)
+        _target
+
+data FileDeclarations_key = FileDeclarations_key{fileDeclarations_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 fileDeclarations_key_declarations :: [Declaration]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations_key where
+  toJSON (FileDeclarations_key __field__file __field__declarations)
+    = Aeson.object
+        ("file" .= __field__file :
+           "declarations" .= __field__declarations : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations_key where
+  buildStruct _proxy
+    (FileDeclarations_key __field__file __field__declarations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "declarations" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__declarations)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__declarations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__declarations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__declarations <- ST.readSTRef
+                                                                       __field__declarations
+                                             Prelude.pure
+                                               (FileDeclarations_key __val__file
+                                                  __val__declarations)
+              _idMap = HashMap.fromList [("file", 1), ("declarations", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations_key where
+  rnf (FileDeclarations_key __field__file __field__declarations)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__declarations `Prelude.seq` ()
+
+instance Default.Default FileDeclarations_key where
+  def = FileDeclarations_key Default.def Default.def
+
+instance Hashable.Hashable FileDeclarations_key where
+  hashWithSalt __salt (FileDeclarations_key _file _declarations)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _declarations
+
+data HackToThrift_key = HackToThrift_key{hackToThrift_key_from ::
+                                         Declaration,
+                                         hackToThrift_key_to :: Glean.Schema.Fbthrift.Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackToThrift_key where
+  toJSON (HackToThrift_key __field__from __field__to)
+    = Aeson.object
+        ("from" .= __field__from : "to" .= __field__to : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackToThrift_key where
+  buildStruct _proxy (HackToThrift_key __field__from __field__to)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__from)
+           :
+           Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__to)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from <- ST.newSTRef Default.def
+            __field__to <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from <- ST.readSTRef __field__from
+                                             !__val__to <- ST.readSTRef __field__to
+                                             Prelude.pure (HackToThrift_key __val__from __val__to)
+              _idMap = HashMap.fromList [("from", 1), ("to", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackToThrift_key where
+  rnf (HackToThrift_key __field__from __field__to)
+    = DeepSeq.rnf __field__from `Prelude.seq`
+        DeepSeq.rnf __field__to `Prelude.seq` ()
+
+instance Default.Default HackToThrift_key where
+  def = HackToThrift_key Default.def Default.def
+
+instance Hashable.Hashable HackToThrift_key where
+  hashWithSalt __salt (HackToThrift_key _from _to)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from) _to
+
+newtype MemberCluster_key = MemberCluster_key{memberCluster_key_members
+                                              :: [Declaration]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MemberCluster_key where
+  toJSON (MemberCluster_key __field__members)
+    = Aeson.object ("members" .= __field__members : Prelude.mempty)
+
+instance Thrift.ThriftStruct MemberCluster_key where
+  buildStruct _proxy (MemberCluster_key __field__members)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "members" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__members)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__members <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__members <- ST.readSTRef
+                                                                  __field__members
+                                             Prelude.pure (MemberCluster_key __val__members)
+              _idMap = HashMap.fromList [("members", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData MemberCluster_key where
+  rnf (MemberCluster_key __field__members)
+    = DeepSeq.rnf __field__members `Prelude.seq` ()
+
+instance Default.Default MemberCluster_key where
+  def = MemberCluster_key Default.def
+
+instance Hashable.Hashable MemberCluster_key where
+  hashWithSalt __salt (MemberCluster_key _members)
+    = Hashable.hashWithSalt __salt _members
+
+data ModuleChild_key = ModuleChild_key{moduleChild_key_module ::
+                                       ModuleDeclaration,
+                                       moduleChild_key_decl :: Declaration}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleChild_key where
+  toJSON (ModuleChild_key __field__module __field__decl)
+    = Aeson.object
+        ("module" .= __field__module :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleChild_key where
+  buildStruct _proxy (ModuleChild_key __field__module __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (ModuleChild_key __val__module __val__decl)
+              _idMap = HashMap.fromList [("module", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleChild_key where
+  rnf (ModuleChild_key __field__module __field__decl)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default ModuleChild_key where
+  def = ModuleChild_key Default.def Default.def
+
+instance Hashable.Hashable ModuleChild_key where
+  hashWithSalt __salt (ModuleChild_key _module _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+        _decl
+
+data ModuleParent_key = ModuleParent_key{moduleParent_key_decl ::
+                                         Declaration,
+                                         moduleParent_key_module :: ModuleDeclaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleParent_key where
+  toJSON (ModuleParent_key __field__decl __field__module)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "module" .= __field__module : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleParent_key where
+  buildStruct _proxy (ModuleParent_key __field__decl __field__module)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__module)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__module <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__module <- ST.readSTRef __field__module
+                                             Prelude.pure
+                                               (ModuleParent_key __val__decl __val__module)
+              _idMap = HashMap.fromList [("decl", 1), ("module", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleParent_key where
+  rnf (ModuleParent_key __field__decl __field__module)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__module `Prelude.seq` ()
+
+instance Default.Default ModuleParent_key where
+  def = ModuleParent_key Default.def Default.def
+
+instance Hashable.Hashable ModuleParent_key where
+  hashWithSalt __salt (ModuleParent_key _decl _module)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _module
+
+data NamespaceMember_key = NamespaceMember_key{namespaceMember_key_namespace_
+                                               :: NamespaceQName,
+                                               namespaceMember_key_decl :: Declaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NamespaceMember_key where
+  toJSON (NamespaceMember_key __field__namespace_ __field__decl)
+    = Aeson.object
+        ("namespace_" .= __field__namespace_ :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct NamespaceMember_key where
+  buildStruct _proxy
+    (NamespaceMember_key __field__namespace_ __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "namespace_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__namespace_)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__namespace_ <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__namespace_ <- ST.readSTRef
+                                                                     __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (NamespaceMember_key __val__namespace_ __val__decl)
+              _idMap = HashMap.fromList [("namespace_", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NamespaceMember_key where
+  rnf (NamespaceMember_key __field__namespace_ __field__decl)
+    = DeepSeq.rnf __field__namespace_ `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default NamespaceMember_key where
+  def = NamespaceMember_key Default.def Default.def
+
+instance Hashable.Hashable NamespaceMember_key where
+  hashWithSalt __salt (NamespaceMember_key _namespace_ _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _namespace_)
+        _decl
+
+data SearchClassByName_key = SearchClassByName_key{searchClassByName_key_name
+                                                   :: Text.Text,
+                                                   searchClassByName_key_parent ::
+                                                   Prelude.Maybe NamespaceQName,
+                                                   searchClassByName_key_decl :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByName_key where
+  toJSON
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchClassByName_key where
+  buildStruct _proxy
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchClassByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByName_key where
+  rnf
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchClassByName_key where
+  def = SearchClassByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchClassByName_key where
+  hashWithSalt __salt (SearchClassByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchClassConstByName_key = SearchClassConstByName_key{searchClassConstByName_key_name
+                                                             :: Text.Text,
+                                                             searchClassConstByName_key_parent ::
+                                                             QName,
+                                                             searchClassConstByName_key_decl ::
+                                                             Declaration}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassConstByName_key where
+  toJSON
+    (SearchClassConstByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassConstByName_key where
+  buildStruct _proxy
+    (SearchClassConstByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchClassConstByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassConstByName_key where
+  rnf
+    (SearchClassConstByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchClassConstByName_key where
+  def = SearchClassConstByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchClassConstByName_key where
+  hashWithSalt __salt
+    (SearchClassConstByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchEnumByName_key = SearchEnumByName_key{searchEnumByName_key_name
+                                                 :: Text.Text,
+                                                 searchEnumByName_key_parent ::
+                                                 Prelude.Maybe NamespaceQName,
+                                                 searchEnumByName_key_decl :: Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumByName_key where
+  toJSON
+    (SearchEnumByName_key __field__name __field__parent __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchEnumByName_key where
+  buildStruct _proxy
+    (SearchEnumByName_key __field__name __field__parent __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchEnumByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumByName_key where
+  rnf
+    (SearchEnumByName_key __field__name __field__parent __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchEnumByName_key where
+  def = SearchEnumByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchEnumByName_key where
+  hashWithSalt __salt (SearchEnumByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchEnumeratorByName_key = SearchEnumeratorByName_key{searchEnumeratorByName_key_name
+                                                             :: Text.Text,
+                                                             searchEnumeratorByName_key_parent ::
+                                                             QName,
+                                                             searchEnumeratorByName_key_decl ::
+                                                             Declaration}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchEnumeratorByName_key where
+  toJSON
+    (SearchEnumeratorByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchEnumeratorByName_key where
+  buildStruct _proxy
+    (SearchEnumeratorByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchEnumeratorByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchEnumeratorByName_key where
+  rnf
+    (SearchEnumeratorByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchEnumeratorByName_key where
+  def = SearchEnumeratorByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchEnumeratorByName_key where
+  hashWithSalt __salt
+    (SearchEnumeratorByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchFunctionByName_key = SearchFunctionByName_key{searchFunctionByName_key_name
+                                                         :: Text.Text,
+                                                         searchFunctionByName_key_parent ::
+                                                         Prelude.Maybe NamespaceQName,
+                                                         searchFunctionByName_key_decl ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByName_key where
+  toJSON
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchFunctionByName_key where
+  buildStruct _proxy
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchFunctionByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByName_key where
+  rnf
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByName_key where
+  def = SearchFunctionByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchFunctionByName_key where
+  hashWithSalt __salt (SearchFunctionByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchGlobalConstByName_key = SearchGlobalConstByName_key{searchGlobalConstByName_key_name
+                                                               :: Text.Text,
+                                                               searchGlobalConstByName_key_parent ::
+                                                               Prelude.Maybe NamespaceQName,
+                                                               searchGlobalConstByName_key_decl ::
+                                                               Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstByName_key where
+  toJSON
+    (SearchGlobalConstByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchGlobalConstByName_key where
+  buildStruct _proxy
+    (SearchGlobalConstByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchGlobalConstByName_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstByName_key where
+  rnf
+    (SearchGlobalConstByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstByName_key where
+  def = SearchGlobalConstByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchGlobalConstByName_key where
+  hashWithSalt __salt
+    (SearchGlobalConstByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchInterfaceByName_key = SearchInterfaceByName_key{searchInterfaceByName_key_name
+                                                           :: Text.Text,
+                                                           searchInterfaceByName_key_parent ::
+                                                           Prelude.Maybe NamespaceQName,
+                                                           searchInterfaceByName_key_decl ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInterfaceByName_key where
+  toJSON
+    (SearchInterfaceByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInterfaceByName_key where
+  buildStruct _proxy
+    (SearchInterfaceByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInterfaceByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInterfaceByName_key where
+  rnf
+    (SearchInterfaceByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInterfaceByName_key where
+  def = SearchInterfaceByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchInterfaceByName_key where
+  hashWithSalt __salt (SearchInterfaceByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchMethodByName_key = SearchMethodByName_key{searchMethodByName_key_name
+                                                     :: Text.Text,
+                                                     searchMethodByName_key_parent :: QName,
+                                                     searchMethodByName_key_decl :: Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByName_key where
+  toJSON
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByName_key where
+  buildStruct _proxy
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchMethodByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByName_key where
+  rnf
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchMethodByName_key where
+  def = SearchMethodByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchMethodByName_key where
+  hashWithSalt __salt (SearchMethodByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchModuleByName_key = SearchModuleByName_key{searchModuleByName_key_name
+                                                     :: Text.Text,
+                                                     searchModuleByName_key_decl :: Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByName_key where
+  toJSON (SearchModuleByName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByName_key where
+  buildStruct _proxy
+    (SearchModuleByName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchModuleByName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByName_key where
+  rnf (SearchModuleByName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchModuleByName_key where
+  def = SearchModuleByName_key "" Default.def
+
+instance Hashable.Hashable SearchModuleByName_key where
+  hashWithSalt __salt (SearchModuleByName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data SearchNamespaceByName_key = SearchNamespaceByName_key{searchNamespaceByName_key_name
+                                                           :: Text.Text,
+                                                           searchNamespaceByName_key_parent ::
+                                                           Prelude.Maybe NamespaceQName,
+                                                           searchNamespaceByName_key_decl ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespaceByName_key where
+  toJSON
+    (SearchNamespaceByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchNamespaceByName_key where
+  buildStruct _proxy
+    (SearchNamespaceByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchNamespaceByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespaceByName_key where
+  rnf
+    (SearchNamespaceByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchNamespaceByName_key where
+  def = SearchNamespaceByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchNamespaceByName_key where
+  hashWithSalt __salt (SearchNamespaceByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchPropertyByName_key = SearchPropertyByName_key{searchPropertyByName_key_name
+                                                         :: Text.Text,
+                                                         searchPropertyByName_key_parent :: QName,
+                                                         searchPropertyByName_key_decl ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyByName_key where
+  toJSON
+    (SearchPropertyByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchPropertyByName_key where
+  buildStruct _proxy
+    (SearchPropertyByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchPropertyByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyByName_key where
+  rnf
+    (SearchPropertyByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchPropertyByName_key where
+  def = SearchPropertyByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchPropertyByName_key where
+  hashWithSalt __salt (SearchPropertyByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchTraitByName_key = SearchTraitByName_key{searchTraitByName_key_name
+                                                   :: Text.Text,
+                                                   searchTraitByName_key_parent ::
+                                                   Prelude.Maybe NamespaceQName,
+                                                   searchTraitByName_key_decl :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTraitByName_key where
+  toJSON
+    (SearchTraitByName_key __field__name __field__parent __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchTraitByName_key where
+  buildStruct _proxy
+    (SearchTraitByName_key __field__name __field__parent __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTraitByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTraitByName_key where
+  rnf
+    (SearchTraitByName_key __field__name __field__parent __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTraitByName_key where
+  def = SearchTraitByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchTraitByName_key where
+  hashWithSalt __salt (SearchTraitByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchTypeConstByName_key = SearchTypeConstByName_key{searchTypeConstByName_key_name
+                                                           :: Text.Text,
+                                                           searchTypeConstByName_key_parent ::
+                                                           QName,
+                                                           searchTypeConstByName_key_decl ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeConstByName_key where
+  toJSON
+    (SearchTypeConstByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeConstByName_key where
+  buildStruct _proxy
+    (SearchTypeConstByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTypeConstByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeConstByName_key where
+  rnf
+    (SearchTypeConstByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTypeConstByName_key where
+  def = SearchTypeConstByName_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchTypeConstByName_key where
+  hashWithSalt __salt (SearchTypeConstByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchTypedefByName_key = SearchTypedefByName_key{searchTypedefByName_key_name
+                                                       :: Text.Text,
+                                                       searchTypedefByName_key_parent ::
+                                                       Prelude.Maybe NamespaceQName,
+                                                       searchTypedefByName_key_decl :: Declaration}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypedefByName_key where
+  toJSON
+    (SearchTypedefByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchTypedefByName_key where
+  buildStruct _proxy
+    (SearchTypedefByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTypedefByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypedefByName_key where
+  rnf
+    (SearchTypedefByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTypedefByName_key where
+  def = SearchTypedefByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchTypedefByName_key where
+  hashWithSalt __salt (SearchTypedefByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data ThriftToHack_key = ThriftToHack_key{thriftToHack_key_to ::
+                                         Glean.Schema.Fbthrift.Declaration,
+                                         thriftToHack_key_from :: Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftToHack_key where
+  toJSON (ThriftToHack_key __field__to __field__from)
+    = Aeson.object
+        ("to" .= __field__to : "from" .= __field__from : Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftToHack_key where
+  buildStruct _proxy (ThriftToHack_key __field__to __field__from)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__to)
+           :
+           Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__from)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__to <- ST.newSTRef Default.def
+            __field__from <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__to <- ST.readSTRef __field__to
+                                             !__val__from <- ST.readSTRef __field__from
+                                             Prelude.pure (ThriftToHack_key __val__to __val__from)
+              _idMap = HashMap.fromList [("to", 1), ("from", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftToHack_key where
+  rnf (ThriftToHack_key __field__to __field__from)
+    = DeepSeq.rnf __field__to `Prelude.seq`
+        DeepSeq.rnf __field__from `Prelude.seq` ()
+
+instance Default.Default ThriftToHack_key where
+  def = ThriftToHack_key Default.def Default.def
+
+instance Hashable.Hashable ThriftToHack_key where
+  hashWithSalt __salt (ThriftToHack_key _to _from)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _to) _from
+
+data XRefTarget = XRefTarget_declaration Declaration
+                | XRefTarget_occurrence Occurrence
+                | XRefTarget_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTarget where
+  toJSON (XRefTarget_declaration __declaration)
+    = Aeson.object ["declaration" .= __declaration]
+  toJSON (XRefTarget_occurrence __occurrence)
+    = Aeson.object ["occurrence" .= __occurrence]
+  toJSON XRefTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefTarget where
+  buildStruct _proxy (XRefTarget_declaration __declaration)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __declaration)]
+  buildStruct _proxy (XRefTarget_occurrence __occurrence)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "occurrence" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __occurrence)]
+  buildStruct _proxy XRefTarget_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_declaration _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_occurrence _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefTarget_EMPTY
+    where
+      _idMap = HashMap.fromList [("declaration", 1), ("occurrence", 2)]
+
+instance DeepSeq.NFData XRefTarget where
+  rnf (XRefTarget_declaration __declaration)
+    = DeepSeq.rnf __declaration
+  rnf (XRefTarget_occurrence __occurrence) = DeepSeq.rnf __occurrence
+  rnf XRefTarget_EMPTY = ()
+
+instance Default.Default XRefTarget where
+  def = XRefTarget_EMPTY
+
+instance Hashable.Hashable XRefTarget where
+  hashWithSalt __salt (XRefTarget_declaration _declaration)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _declaration)
+  hashWithSalt __salt (XRefTarget_occurrence _occurrence)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _occurrence)
+  hashWithSalt __salt XRefTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TargetUses_key = TargetUses_key{targetUses_key_target ::
+                                     XRefTarget,
+                                     targetUses_key_file :: Glean.Schema.Src.File,
+                                     targetUses_key_uses :: [Glean.Schema.Src.RelByteSpan]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUses_key where
+  toJSON (TargetUses_key __field__target __field__file __field__uses)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "uses" .= __field__uses : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUses_key where
+  buildStruct _proxy
+    (TargetUses_key __field__target __field__file __field__uses)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__uses)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             Prelude.pure
+                                               (TargetUses_key __val__target __val__file
+                                                  __val__uses)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("uses", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUses_key where
+  rnf (TargetUses_key __field__target __field__file __field__uses)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__uses `Prelude.seq` ()
+
+instance Default.Default TargetUses_key where
+  def = TargetUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetUses_key where
+  hashWithSalt __salt (TargetUses_key _target _file _uses)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _uses
+
+data TargetUsesAbs_key = TargetUsesAbs_key{targetUsesAbs_key_target
+                                           :: XRefTarget,
+                                           targetUsesAbs_key_file :: Glean.Schema.Src.File,
+                                           targetUsesAbs_key_uses :: [Glean.Schema.Src.ByteSpan]}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TargetUsesAbs_key where
+  toJSON
+    (TargetUsesAbs_key __field__target __field__file __field__uses)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "uses" .= __field__uses : Prelude.mempty)
+
+instance Thrift.ThriftStruct TargetUsesAbs_key where
+  buildStruct _proxy
+    (TargetUsesAbs_key __field__target __field__file __field__uses)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__uses)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             Prelude.pure
+                                               (TargetUsesAbs_key __val__target __val__file
+                                                  __val__uses)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("uses", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TargetUsesAbs_key where
+  rnf (TargetUsesAbs_key __field__target __field__file __field__uses)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__uses `Prelude.seq` ()
+
+instance Default.Default TargetUsesAbs_key where
+  def = TargetUsesAbs_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TargetUsesAbs_key where
+  hashWithSalt __salt (TargetUsesAbs_key _target _file _uses)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _uses
+
+data XRef = XRef{xRef_target :: XRefTarget,
+                 xRef_ranges :: [Glean.Schema.Src.RelByteSpan]}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__target __field__ranges)
+    = Aeson.object
+        ("target" .= __field__target :
+           "ranges" .= __field__ranges : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__target __field__ranges)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "ranges" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__ranges)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__ranges <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__ranges
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__ranges <- ST.readSTRef __field__ranges
+                                             Prelude.pure (XRef __val__target __val__ranges)
+              _idMap = HashMap.fromList [("target", 1), ("ranges", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__target __field__ranges)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__ranges `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Default.def
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _target _ranges)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _ranges
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data TypeInfo_key = TypeInfo_key{typeInfo_key_displayType :: Type,
+                                 typeInfo_key_xrefs :: [XRef],
+                                 typeInfo_key_hint :: Prelude.Maybe Hint}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeInfo_key where
+  toJSON
+    (TypeInfo_key __field__displayType __field__xrefs __field__hint)
+    = Aeson.object
+        ("displayType" .= __field__displayType :
+           "xrefs" .= __field__xrefs :
+             Prelude.maybe Prelude.id ((:) . ("hint" .=)) __field__hint
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeInfo_key where
+  buildStruct _proxy
+    (TypeInfo_key __field__displayType __field__xrefs __field__hint)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "displayType" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__displayType)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             :
+             case __field__hint of
+               Prelude.Just _val -> Thrift.genField _proxy "hint"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__displayType <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            __field__hint <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__displayType
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hint
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__displayType <- ST.readSTRef
+                                                                      __field__displayType
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             !__val__hint <- ST.readSTRef __field__hint
+                                             Prelude.pure
+                                               (TypeInfo_key __val__displayType __val__xrefs
+                                                  __val__hint)
+              _idMap
+                = HashMap.fromList [("displayType", 1), ("xrefs", 2), ("hint", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeInfo_key where
+  rnf
+    (TypeInfo_key __field__displayType __field__xrefs __field__hint)
+    = DeepSeq.rnf __field__displayType `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq`
+          DeepSeq.rnf __field__hint `Prelude.seq` ()
+
+instance Default.Default TypeInfo_key where
+  def = TypeInfo_key Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeInfo_key where
+  hashWithSalt __salt (TypeInfo_key _displayType _xrefs _hint)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _displayType)
+           _xrefs)
+        _hint
+
+data InheritedMembers_key = InheritedMembers_key{inheritedMembers_key_container
+                                                 :: ContainerDeclaration,
+                                                 inheritedMembers_key_inheritedMembers ::
+                                                 [MemberCluster]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InheritedMembers_key where
+  toJSON
+    (InheritedMembers_key __field__container __field__inheritedMembers)
+    = Aeson.object
+        ("container" .= __field__container :
+           "inheritedMembers" .= __field__inheritedMembers : Prelude.mempty)
+
+instance Thrift.ThriftStruct InheritedMembers_key where
+  buildStruct _proxy
+    (InheritedMembers_key __field__container __field__inheritedMembers)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "inheritedMembers"
+             (Thrift.getListType _proxy)
+             2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__inheritedMembers)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__inheritedMembers <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__inheritedMembers
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__inheritedMembers <- ST.readSTRef
+                                                                           __field__inheritedMembers
+                                             Prelude.pure
+                                               (InheritedMembers_key __val__container
+                                                  __val__inheritedMembers)
+              _idMap
+                = HashMap.fromList [("container", 1), ("inheritedMembers", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InheritedMembers_key where
+  rnf
+    (InheritedMembers_key __field__container __field__inheritedMembers)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__inheritedMembers `Prelude.seq` ()
+
+instance Default.Default InheritedMembers_key where
+  def = InheritedMembers_key Default.def Default.def
+
+instance Hashable.Hashable InheritedMembers_key where
+  hashWithSalt __salt
+    (InheritedMembers_key _container _inheritedMembers)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _inheritedMembers
+
+data MethodDeclaration_key = MethodDeclaration_key{methodDeclaration_key_name
+                                                   :: Name,
+                                                   methodDeclaration_key_container ::
+                                                   ContainerDeclaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration_key where
+  toJSON (MethodDeclaration_key __field__name __field__container)
+    = Aeson.object
+        ("name" .= __field__name :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDeclaration_key where
+  buildStruct _proxy
+    (MethodDeclaration_key __field__name __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (MethodDeclaration_key __val__name __val__container)
+              _idMap = HashMap.fromList [("name", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration_key where
+  rnf (MethodDeclaration_key __field__name __field__container)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration_key where
+  def = MethodDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable MethodDeclaration_key where
+  hashWithSalt __salt (MethodDeclaration_key _name _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _container
+
+data PropertyDeclaration_key = PropertyDeclaration_key{propertyDeclaration_key_name
+                                                       :: Name,
+                                                       propertyDeclaration_key_container ::
+                                                       ContainerDeclaration}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PropertyDeclaration_key where
+  toJSON (PropertyDeclaration_key __field__name __field__container)
+    = Aeson.object
+        ("name" .= __field__name :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct PropertyDeclaration_key where
+  buildStruct _proxy
+    (PropertyDeclaration_key __field__name __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (PropertyDeclaration_key __val__name
+                                                  __val__container)
+              _idMap = HashMap.fromList [("name", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PropertyDeclaration_key where
+  rnf (PropertyDeclaration_key __field__name __field__container)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default PropertyDeclaration_key where
+  def = PropertyDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable PropertyDeclaration_key where
+  hashWithSalt __salt (PropertyDeclaration_key _name _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _container
+
+data TypeConstDeclaration_key = TypeConstDeclaration_key{typeConstDeclaration_key_name
+                                                         :: Name,
+                                                         typeConstDeclaration_key_container ::
+                                                         ContainerDeclaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeConstDeclaration_key where
+  toJSON (TypeConstDeclaration_key __field__name __field__container)
+    = Aeson.object
+        ("name" .= __field__name :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeConstDeclaration_key where
+  buildStruct _proxy
+    (TypeConstDeclaration_key __field__name __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (TypeConstDeclaration_key __val__name
+                                                  __val__container)
+              _idMap = HashMap.fromList [("name", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeConstDeclaration_key where
+  rnf (TypeConstDeclaration_key __field__name __field__container)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default TypeConstDeclaration_key where
+  def = TypeConstDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable TypeConstDeclaration_key where
+  hashWithSalt __salt (TypeConstDeclaration_key _name _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _container
+
+data ContainerChild_key = ContainerChild_key{containerChild_key_container
+                                             :: ContainerDeclaration,
+                                             containerChild_key_child :: ContainerDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainerChild_key where
+  toJSON (ContainerChild_key __field__container __field__child)
+    = Aeson.object
+        ("container" .= __field__container :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainerChild_key where
+  buildStruct _proxy
+    (ContainerChild_key __field__container __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ContainerChild_key __val__container __val__child)
+              _idMap = HashMap.fromList [("container", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainerChild_key where
+  rnf (ContainerChild_key __field__container __field__child)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ContainerChild_key where
+  def = ContainerChild_key Default.def Default.def
+
+instance Hashable.Hashable ContainerChild_key where
+  hashWithSalt __salt (ContainerChild_key _container _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _child
+
+data ConstraintKind = ConstraintKind_As
+                    | ConstraintKind_Equal
+                    | ConstraintKind_Super
+                    | ConstraintKind__UNKNOWN Prelude.Int
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstraintKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData ConstraintKind where
+  rnf __ConstraintKind = Prelude.seq __ConstraintKind ()
+
+instance Default.Default ConstraintKind where
+  def = ConstraintKind_As
+
+instance Hashable.Hashable ConstraintKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum ConstraintKind where
+  toThriftEnum 0 = ConstraintKind_As
+  toThriftEnum 1 = ConstraintKind_Equal
+  toThriftEnum 2 = ConstraintKind_Super
+  toThriftEnum val = ConstraintKind__UNKNOWN val
+  fromThriftEnum ConstraintKind_As = 0
+  fromThriftEnum ConstraintKind_Equal = 1
+  fromThriftEnum ConstraintKind_Super = 2
+  fromThriftEnum (ConstraintKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [ConstraintKind_As, ConstraintKind_Equal, ConstraintKind_Super]
+  toThriftEnumEither 0 = Prelude.Right ConstraintKind_As
+  toThriftEnumEither 1 = Prelude.Right ConstraintKind_Equal
+  toThriftEnumEither 2 = Prelude.Right ConstraintKind_Super
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum ConstraintKind: "
+           ++ Prelude.show val)
+
+data Constraint = Constraint{constraint_constraintKind ::
+                             ConstraintKind,
+                             constraint_type :: Type,
+                             constraint_typeInfo :: Prelude.Maybe TypeInfo}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Constraint where
+  toJSON
+    (Constraint __field__constraintKind __field__type
+       __field__typeInfo)
+    = Aeson.object
+        ("constraintKind" .= __field__constraintKind :
+           "type" .= __field__type :
+             Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct Constraint where
+  buildStruct _proxy
+    (Constraint __field__constraintKind __field__type
+       __field__typeInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "constraintKind" (Thrift.getI32Type _proxy)
+           1
+           0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__constraintKind)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             case __field__typeInfo of
+               Prelude.Just _val -> Thrift.genField _proxy "typeInfo"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__constraintKind <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ConstraintKind")
+                                                                        ST.writeSTRef
+                                                                          __field__constraintKind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__constraintKind <- ST.readSTRef
+                                                                         __field__constraintKind
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             Prelude.pure
+                                               (Constraint __val__constraintKind __val__type
+                                                  __val__typeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("constraintKind", 1), ("type", 2), ("typeInfo", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Constraint where
+  rnf
+    (Constraint __field__constraintKind __field__type
+       __field__typeInfo)
+    = DeepSeq.rnf __field__constraintKind `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__typeInfo `Prelude.seq` ()
+
+instance Default.Default Constraint where
+  def = Constraint Default.def Default.def Prelude.Nothing
+
+instance Hashable.Hashable Constraint where
+  hashWithSalt __salt (Constraint _constraintKind _type _typeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _constraintKind)
+           _type)
+        _typeInfo
+
+data TypeParameter = TypeParameter{typeParameter_name :: Name,
+                                   typeParameter_variance :: Variance,
+                                   typeParameter_reifyKind :: ReifyKind,
+                                   typeParameter_constraints :: [Constraint],
+                                   typeParameter_attributes :: [UserAttribute]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeParameter where
+  toJSON
+    (TypeParameter __field__name __field__variance __field__reifyKind
+       __field__constraints __field__attributes)
+    = Aeson.object
+        ("name" .= __field__name :
+           "variance" .= __field__variance :
+             "reifyKind" .= __field__reifyKind :
+               "constraints" .= __field__constraints :
+                 "attributes" .= __field__attributes : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeParameter where
+  buildStruct _proxy
+    (TypeParameter __field__name __field__variance __field__reifyKind
+       __field__constraints __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "variance" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__variance)
+             :
+             Thrift.genField _proxy "reifyKind" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__reifyKind)
+               :
+               Thrift.genField _proxy "constraints" (Thrift.getListType _proxy) 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__constraints)
+                 :
+                 Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__attributes)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__variance <- ST.newSTRef Default.def
+            __field__reifyKind <- ST.newSTRef Default.def
+            __field__constraints <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Variance")
+                                                                        ST.writeSTRef
+                                                                          __field__variance
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ReifyKind")
+                                                                        ST.writeSTRef
+                                                                          __field__reifyKind
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__constraints
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__variance <- ST.readSTRef __field__variance
+                                             !__val__reifyKind <- ST.readSTRef __field__reifyKind
+                                             !__val__constraints <- ST.readSTRef
+                                                                      __field__constraints
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             Prelude.pure
+                                               (TypeParameter __val__name __val__variance
+                                                  __val__reifyKind
+                                                  __val__constraints
+                                                  __val__attributes)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("variance", 2), ("reifyKind", 3),
+                     ("constraints", 4), ("attributes", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeParameter where
+  rnf
+    (TypeParameter __field__name __field__variance __field__reifyKind
+       __field__constraints __field__attributes)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__variance `Prelude.seq`
+          DeepSeq.rnf __field__reifyKind `Prelude.seq`
+            DeepSeq.rnf __field__constraints `Prelude.seq`
+              DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default TypeParameter where
+  def
+    = TypeParameter Default.def Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable TypeParameter where
+  hashWithSalt __salt
+    (TypeParameter _name _variance _reifyKind _constraints _attributes)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _variance)
+              _reifyKind)
+           _constraints)
+        _attributes
+
+data FunctionDefinition_key = FunctionDefinition_key{functionDefinition_key_declaration
+                                                     :: FunctionDeclaration,
+                                                     functionDefinition_key_signature :: Signature,
+                                                     functionDefinition_key_isAsync :: Prelude.Bool,
+                                                     functionDefinition_key_attributes ::
+                                                     [UserAttribute],
+                                                     functionDefinition_key_typeParams ::
+                                                     [TypeParameter],
+                                                     functionDefinition_key_module_ ::
+                                                     Prelude.Maybe ModuleMembership,
+                                                     functionDefinition_key_readonlyRet ::
+                                                     Prelude.Maybe ReadonlyKind}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition_key where
+  toJSON
+    (FunctionDefinition_key __field__declaration __field__signature
+       __field__isAsync __field__attributes __field__typeParams
+       __field__module_ __field__readonlyRet)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "signature" .= __field__signature :
+             "isAsync" .= __field__isAsync :
+               "attributes" .= __field__attributes :
+                 "typeParams" .= __field__typeParams :
+                   Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                     (Prelude.maybe Prelude.id ((:) . ("readonlyRet" .=))
+                        __field__readonlyRet
+                        Prelude.mempty))
+
+instance Thrift.ThriftStruct FunctionDefinition_key where
+  buildStruct _proxy
+    (FunctionDefinition_key __field__declaration __field__signature
+       __field__isAsync __field__attributes __field__typeParams
+       __field__module_ __field__readonlyRet)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__signature)
+             :
+             Thrift.genFieldBool _proxy "isAsync" 3 2 __field__isAsync :
+               Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__attributes)
+                 :
+                 Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__typeParams)
+                   :
+                   let (__cereal__module_, __id__module_)
+                         = case __field__module_ of
+                             Prelude.Just _val -> ((:)
+                                                     (Thrift.genField _proxy "module_"
+                                                        (Thrift.getStructType _proxy)
+                                                        6
+                                                        5
+                                                        (Thrift.buildStruct _proxy _val)),
+                                                   6)
+                             Prelude.Nothing -> (Prelude.id, 5)
+                     in
+                     __cereal__module_
+                       (case __field__readonlyRet of
+                          Prelude.Just _val -> Thrift.genField _proxy "readonlyRet"
+                                                 (Thrift.getI32Type _proxy)
+                                                 7
+                                                 __id__module_
+                                                 ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                     Thrift.fromThriftEnum)
+                                                    _val)
+                                                 : []
+                          Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__isAsync <- ST.newSTRef Prelude.False
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            __field__readonlyRet <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAsync
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ReadonlyKind")
+                                                                        ST.writeSTRef
+                                                                          __field__readonlyRet
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__isAsync <- ST.readSTRef __field__isAsync
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             !__val__readonlyRet <- ST.readSTRef
+                                                                      __field__readonlyRet
+                                             Prelude.pure
+                                               (FunctionDefinition_key __val__declaration
+                                                  __val__signature
+                                                  __val__isAsync
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__module_
+                                                  __val__readonlyRet)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("signature", 2), ("isAsync", 3),
+                     ("attributes", 4), ("typeParams", 5), ("module_", 6),
+                     ("readonlyRet", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition_key where
+  rnf
+    (FunctionDefinition_key __field__declaration __field__signature
+       __field__isAsync __field__attributes __field__typeParams
+       __field__module_ __field__readonlyRet)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq`
+          DeepSeq.rnf __field__isAsync `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq`
+              DeepSeq.rnf __field__typeParams `Prelude.seq`
+                DeepSeq.rnf __field__module_ `Prelude.seq`
+                  DeepSeq.rnf __field__readonlyRet `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition_key where
+  def
+    = FunctionDefinition_key Default.def Default.def Prelude.False
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable FunctionDefinition_key where
+  hashWithSalt __salt
+    (FunctionDefinition_key _declaration _signature _isAsync
+       _attributes _typeParams _module_ _readonlyRet)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                       _signature)
+                    _isAsync)
+                 _attributes)
+              _typeParams)
+           _module_)
+        _readonlyRet
+
+data InterfaceDefinition_key = InterfaceDefinition_key{interfaceDefinition_key_declaration
+                                                       :: InterfaceDeclaration,
+                                                       interfaceDefinition_key_members ::
+                                                       [Declaration],
+                                                       interfaceDefinition_key_extends_ ::
+                                                       [InterfaceDeclaration],
+                                                       interfaceDefinition_key_attributes ::
+                                                       [UserAttribute],
+                                                       interfaceDefinition_key_typeParams ::
+                                                       [TypeParameter],
+                                                       interfaceDefinition_key_requireExtends ::
+                                                       [ClassDeclaration],
+                                                       interfaceDefinition_key_module_ ::
+                                                       Prelude.Maybe ModuleMembership}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDefinition_key where
+  toJSON
+    (InterfaceDefinition_key __field__declaration __field__members
+       __field__extends_ __field__attributes __field__typeParams
+       __field__requireExtends __field__module_)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "members" .= __field__members :
+             "extends_" .= __field__extends_ :
+               "attributes" .= __field__attributes :
+                 "typeParams" .= __field__typeParams :
+                   "requireExtends" .= __field__requireExtends :
+                     Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                       Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceDefinition_key where
+  buildStruct _proxy
+    (InterfaceDefinition_key __field__declaration __field__members
+       __field__extends_ __field__attributes __field__typeParams
+       __field__requireExtends __field__module_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "members" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__members)
+             :
+             Thrift.genField _proxy "extends_" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__extends_)
+               :
+               Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__attributes)
+                 :
+                 Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__typeParams)
+                   :
+                   Thrift.genField _proxy "requireExtends" (Thrift.getListType _proxy)
+                     6
+                     5
+                     (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                        (Thrift.buildStruct _proxy)
+                        __field__requireExtends)
+                     :
+                     case __field__module_ of
+                       Prelude.Just _val -> Thrift.genField _proxy "module_"
+                                              (Thrift.getStructType _proxy)
+                                              7
+                                              6
+                                              (Thrift.buildStruct _proxy _val)
+                                              : []
+                       Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__members <- ST.newSTRef Default.def
+            __field__extends_ <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__requireExtends <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__extends_
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__requireExtends
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__members <- ST.readSTRef __field__members
+                                             !__val__extends_ <- ST.readSTRef __field__extends_
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__requireExtends <- ST.readSTRef
+                                                                         __field__requireExtends
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             Prelude.pure
+                                               (InterfaceDefinition_key __val__declaration
+                                                  __val__members
+                                                  __val__extends_
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__requireExtends
+                                                  __val__module_)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("members", 2), ("extends_", 3),
+                     ("attributes", 4), ("typeParams", 5), ("requireExtends", 6),
+                     ("module_", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDefinition_key where
+  rnf
+    (InterfaceDefinition_key __field__declaration __field__members
+       __field__extends_ __field__attributes __field__typeParams
+       __field__requireExtends __field__module_)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__members `Prelude.seq`
+          DeepSeq.rnf __field__extends_ `Prelude.seq`
+            DeepSeq.rnf __field__attributes `Prelude.seq`
+              DeepSeq.rnf __field__typeParams `Prelude.seq`
+                DeepSeq.rnf __field__requireExtends `Prelude.seq`
+                  DeepSeq.rnf __field__module_ `Prelude.seq` ()
+
+instance Default.Default InterfaceDefinition_key where
+  def
+    = InterfaceDefinition_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable InterfaceDefinition_key where
+  hashWithSalt __salt
+    (InterfaceDefinition_key _declaration _members _extends_
+       _attributes _typeParams _requireExtends _module_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                       _members)
+                    _extends_)
+                 _attributes)
+              _typeParams)
+           _requireExtends)
+        _module_
+
+data MethodDefinition_key = MethodDefinition_key{methodDefinition_key_declaration
+                                                 :: MethodDeclaration,
+                                                 methodDefinition_key_signature :: Signature,
+                                                 methodDefinition_key_visibility :: Visibility,
+                                                 methodDefinition_key_isAbstract :: Prelude.Bool,
+                                                 methodDefinition_key_isAsync :: Prelude.Bool,
+                                                 methodDefinition_key_isFinal :: Prelude.Bool,
+                                                 methodDefinition_key_isStatic :: Prelude.Bool,
+                                                 methodDefinition_key_attributes :: [UserAttribute],
+                                                 methodDefinition_key_typeParams :: [TypeParameter],
+                                                 methodDefinition_key_isReadonlyThis ::
+                                                 Prelude.Maybe Prelude.Bool,
+                                                 methodDefinition_key_readonlyRet ::
+                                                 Prelude.Maybe ReadonlyKind}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDefinition_key where
+  toJSON
+    (MethodDefinition_key __field__declaration __field__signature
+       __field__visibility __field__isAbstract __field__isAsync
+       __field__isFinal __field__isStatic __field__attributes
+       __field__typeParams __field__isReadonlyThis __field__readonlyRet)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "signature" .= __field__signature :
+             "visibility" .= __field__visibility :
+               "isAbstract" .= __field__isAbstract :
+                 "isAsync" .= __field__isAsync :
+                   "isFinal" .= __field__isFinal :
+                     "isStatic" .= __field__isStatic :
+                       "attributes" .= __field__attributes :
+                         "typeParams" .= __field__typeParams :
+                           Prelude.maybe Prelude.id ((:) . ("isReadonlyThis" .=))
+                             __field__isReadonlyThis
+                             (Prelude.maybe Prelude.id ((:) . ("readonlyRet" .=))
+                                __field__readonlyRet
+                                Prelude.mempty))
+
+instance Thrift.ThriftStruct MethodDefinition_key where
+  buildStruct _proxy
+    (MethodDefinition_key __field__declaration __field__signature
+       __field__visibility __field__isAbstract __field__isAsync
+       __field__isFinal __field__isStatic __field__attributes
+       __field__typeParams __field__isReadonlyThis __field__readonlyRet)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__signature)
+             :
+             Thrift.genField _proxy "visibility" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__visibility)
+               :
+               Thrift.genFieldBool _proxy "isAbstract" 4 3 __field__isAbstract :
+                 Thrift.genFieldBool _proxy "isAsync" 5 4 __field__isAsync :
+                   Thrift.genFieldBool _proxy "isFinal" 6 5 __field__isFinal :
+                     Thrift.genFieldBool _proxy "isStatic" 7 6 __field__isStatic :
+                       Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 8 7
+                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                            (Thrift.buildStruct _proxy)
+                            __field__attributes)
+                         :
+                         Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 9 8
+                           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                              (Thrift.buildStruct _proxy)
+                              __field__typeParams)
+                           :
+                           let (__cereal__isReadonlyThis, __id__isReadonlyThis)
+                                 = case __field__isReadonlyThis of
+                                     Prelude.Just _val -> ((:)
+                                                             (Thrift.genFieldBool _proxy
+                                                                "isReadonlyThis"
+                                                                10
+                                                                9
+                                                                _val),
+                                                           10)
+                                     Prelude.Nothing -> (Prelude.id, 9)
+                             in
+                             __cereal__isReadonlyThis
+                               (case __field__readonlyRet of
+                                  Prelude.Just _val -> Thrift.genField _proxy "readonlyRet"
+                                                         (Thrift.getI32Type _proxy)
+                                                         11
+                                                         __id__isReadonlyThis
+                                                         ((Thrift.genI32 _proxy .
+                                                             Prelude.fromIntegral
+                                                             . Thrift.fromThriftEnum)
+                                                            _val)
+                                                         : []
+                                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__visibility <- ST.newSTRef Default.def
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isAsync <- ST.newSTRef Prelude.False
+            __field__isFinal <- ST.newSTRef Prelude.False
+            __field__isStatic <- ST.newSTRef Prelude.False
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__isReadonlyThis <- ST.newSTRef Prelude.Nothing
+            __field__readonlyRet <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Visibility")
+                                                                        ST.writeSTRef
+                                                                          __field__visibility
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAsync
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isFinal
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isStatic
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getBoolType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseBoolF
+                                                                                       _proxy
+                                                                                       _bool)
+                                                                         ST.writeSTRef
+                                                                           __field__isReadonlyThis
+                                                                           (Prelude.Just _val)
+                                                                 11 | _type ==
+                                                                        Thrift.getI32Type _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseEnum
+                                                                                       _proxy
+                                                                                       "ReadonlyKind")
+                                                                         ST.writeSTRef
+                                                                           __field__readonlyRet
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__visibility <- ST.readSTRef __field__visibility
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             !__val__isAsync <- ST.readSTRef __field__isAsync
+                                             !__val__isFinal <- ST.readSTRef __field__isFinal
+                                             !__val__isStatic <- ST.readSTRef __field__isStatic
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__isReadonlyThis <- ST.readSTRef
+                                                                         __field__isReadonlyThis
+                                             !__val__readonlyRet <- ST.readSTRef
+                                                                      __field__readonlyRet
+                                             Prelude.pure
+                                               (MethodDefinition_key __val__declaration
+                                                  __val__signature
+                                                  __val__visibility
+                                                  __val__isAbstract
+                                                  __val__isAsync
+                                                  __val__isFinal
+                                                  __val__isStatic
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__isReadonlyThis
+                                                  __val__readonlyRet)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("signature", 2), ("visibility", 3),
+                     ("isAbstract", 4), ("isAsync", 5), ("isFinal", 6), ("isStatic", 7),
+                     ("attributes", 8), ("typeParams", 9), ("isReadonlyThis", 10),
+                     ("readonlyRet", 11)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDefinition_key where
+  rnf
+    (MethodDefinition_key __field__declaration __field__signature
+       __field__visibility __field__isAbstract __field__isAsync
+       __field__isFinal __field__isStatic __field__attributes
+       __field__typeParams __field__isReadonlyThis __field__readonlyRet)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq`
+          DeepSeq.rnf __field__visibility `Prelude.seq`
+            DeepSeq.rnf __field__isAbstract `Prelude.seq`
+              DeepSeq.rnf __field__isAsync `Prelude.seq`
+                DeepSeq.rnf __field__isFinal `Prelude.seq`
+                  DeepSeq.rnf __field__isStatic `Prelude.seq`
+                    DeepSeq.rnf __field__attributes `Prelude.seq`
+                      DeepSeq.rnf __field__typeParams `Prelude.seq`
+                        DeepSeq.rnf __field__isReadonlyThis `Prelude.seq`
+                          DeepSeq.rnf __field__readonlyRet `Prelude.seq` ()
+
+instance Default.Default MethodDefinition_key where
+  def
+    = MethodDefinition_key Default.def Default.def Default.def
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Prelude.False
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable MethodDefinition_key where
+  hashWithSalt __salt
+    (MethodDefinition_key _declaration _signature _visibility
+       _isAbstract _isAsync _isFinal _isStatic _attributes _typeParams
+       _isReadonlyThis _readonlyRet)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt
+                                (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                                   _signature)
+                                _visibility)
+                             _isAbstract)
+                          _isAsync)
+                       _isFinal)
+                    _isStatic)
+                 _attributes)
+              _typeParams)
+           _isReadonlyThis)
+        _readonlyRet
+
+data TraitDefinition_key = TraitDefinition_key{traitDefinition_key_declaration
+                                               :: TraitDeclaration,
+                                               traitDefinition_key_members :: [Declaration],
+                                               traitDefinition_key_implements_ ::
+                                               [InterfaceDeclaration],
+                                               traitDefinition_key_uses :: [TraitDeclaration],
+                                               traitDefinition_key_attributes :: [UserAttribute],
+                                               traitDefinition_key_typeParams :: [TypeParameter],
+                                               traitDefinition_key_requireExtends ::
+                                               [ClassDeclaration],
+                                               traitDefinition_key_requireImplements ::
+                                               [InterfaceDeclaration],
+                                               traitDefinition_key_module_ ::
+                                               Prelude.Maybe ModuleMembership,
+                                               traitDefinition_key_requireClass ::
+                                               Prelude.Maybe [ClassDeclaration]}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TraitDefinition_key where
+  toJSON
+    (TraitDefinition_key __field__declaration __field__members
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__requireExtends
+       __field__requireImplements __field__module_ __field__requireClass)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "members" .= __field__members :
+             "implements_" .= __field__implements_ :
+               "uses" .= __field__uses :
+                 "attributes" .= __field__attributes :
+                   "typeParams" .= __field__typeParams :
+                     "requireExtends" .= __field__requireExtends :
+                       "requireImplements" .= __field__requireImplements :
+                         Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                           (Prelude.maybe Prelude.id ((:) . ("requireClass" .=))
+                              __field__requireClass
+                              Prelude.mempty))
+
+instance Thrift.ThriftStruct TraitDefinition_key where
+  buildStruct _proxy
+    (TraitDefinition_key __field__declaration __field__members
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__requireExtends
+       __field__requireImplements __field__module_ __field__requireClass)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "members" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__members)
+             :
+             Thrift.genField _proxy "implements_" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__implements_)
+               :
+               Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__uses)
+                 :
+                 Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__attributes)
+                   :
+                   Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 6 5
+                     (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                        (Thrift.buildStruct _proxy)
+                        __field__typeParams)
+                     :
+                     Thrift.genField _proxy "requireExtends" (Thrift.getListType _proxy)
+                       7
+                       6
+                       (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                          (Thrift.buildStruct _proxy)
+                          __field__requireExtends)
+                       :
+                       Thrift.genField _proxy "requireImplements"
+                         (Thrift.getListType _proxy)
+                         8
+                         7
+                         (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                            (Thrift.buildStruct _proxy)
+                            __field__requireImplements)
+                         :
+                         let (__cereal__module_, __id__module_)
+                               = case __field__module_ of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "module_"
+                                                              (Thrift.getStructType _proxy)
+                                                              9
+                                                              8
+                                                              (Thrift.buildStruct _proxy _val)),
+                                                         9)
+                                   Prelude.Nothing -> (Prelude.id, 8)
+                           in
+                           __cereal__module_
+                             (case __field__requireClass of
+                                Prelude.Just _val -> Thrift.genField _proxy "requireClass"
+                                                       (Thrift.getListType _proxy)
+                                                       10
+                                                       __id__module_
+                                                       (Thrift.genList _proxy
+                                                          (Thrift.getStructType _proxy)
+                                                          (Thrift.buildStruct _proxy)
+                                                          _val)
+                                                       : []
+                                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__members <- ST.newSTRef Default.def
+            __field__implements_ <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__requireExtends <- ST.newSTRef Default.def
+            __field__requireImplements <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            __field__requireClass <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__implements_
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__requireExtends
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__requireImplements
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          (Prelude.Just _val)
+                                                                 10 | _type ==
+                                                                        Thrift.getListType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Prelude.snd <$>
+                                                                                       Thrift.parseList
+                                                                                         _proxy
+                                                                                         (Thrift.parseStruct
+                                                                                            _proxy))
+                                                                         ST.writeSTRef
+                                                                           __field__requireClass
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__members <- ST.readSTRef __field__members
+                                             !__val__implements_ <- ST.readSTRef
+                                                                      __field__implements_
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__requireExtends <- ST.readSTRef
+                                                                         __field__requireExtends
+                                             !__val__requireImplements <- ST.readSTRef
+                                                                            __field__requireImplements
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             !__val__requireClass <- ST.readSTRef
+                                                                       __field__requireClass
+                                             Prelude.pure
+                                               (TraitDefinition_key __val__declaration
+                                                  __val__members
+                                                  __val__implements_
+                                                  __val__uses
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__requireExtends
+                                                  __val__requireImplements
+                                                  __val__module_
+                                                  __val__requireClass)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("members", 2), ("implements_", 3),
+                     ("uses", 4), ("attributes", 5), ("typeParams", 6),
+                     ("requireExtends", 7), ("requireImplements", 8), ("module_", 9),
+                     ("requireClass", 10)]
+            _parse 0)
+
+instance DeepSeq.NFData TraitDefinition_key where
+  rnf
+    (TraitDefinition_key __field__declaration __field__members
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__requireExtends
+       __field__requireImplements __field__module_ __field__requireClass)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__members `Prelude.seq`
+          DeepSeq.rnf __field__implements_ `Prelude.seq`
+            DeepSeq.rnf __field__uses `Prelude.seq`
+              DeepSeq.rnf __field__attributes `Prelude.seq`
+                DeepSeq.rnf __field__typeParams `Prelude.seq`
+                  DeepSeq.rnf __field__requireExtends `Prelude.seq`
+                    DeepSeq.rnf __field__requireImplements `Prelude.seq`
+                      DeepSeq.rnf __field__module_ `Prelude.seq`
+                        DeepSeq.rnf __field__requireClass `Prelude.seq` ()
+
+instance Default.Default TraitDefinition_key where
+  def
+    = TraitDefinition_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable TraitDefinition_key where
+  hashWithSalt __salt
+    (TraitDefinition_key _declaration _members _implements_ _uses
+       _attributes _typeParams _requireExtends _requireImplements _module_
+       _requireClass)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                                _members)
+                             _implements_)
+                          _uses)
+                       _attributes)
+                    _typeParams)
+                 _requireExtends)
+              _requireImplements)
+           _module_)
+        _requireClass
+
+data TypedefDefinition_key = TypedefDefinition_key{typedefDefinition_key_declaration
+                                                   :: TypedefDeclaration,
+                                                   typedefDefinition_key_isTransparent ::
+                                                   Prelude.Bool,
+                                                   typedefDefinition_key_attributes ::
+                                                   [UserAttribute],
+                                                   typedefDefinition_key_typeParams ::
+                                                   [TypeParameter],
+                                                   typedefDefinition_key_module_ ::
+                                                   Prelude.Maybe ModuleMembership}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypedefDefinition_key where
+  toJSON
+    (TypedefDefinition_key __field__declaration __field__isTransparent
+       __field__attributes __field__typeParams __field__module_)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "isTransparent" .= __field__isTransparent :
+             "attributes" .= __field__attributes :
+               "typeParams" .= __field__typeParams :
+                 Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                   Prelude.mempty)
+
+instance Thrift.ThriftStruct TypedefDefinition_key where
+  buildStruct _proxy
+    (TypedefDefinition_key __field__declaration __field__isTransparent
+       __field__attributes __field__typeParams __field__module_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genFieldBool _proxy "isTransparent" 2 1
+             __field__isTransparent
+             :
+             Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__attributes)
+               :
+               Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__typeParams)
+                 :
+                 case __field__module_ of
+                   Prelude.Just _val -> Thrift.genField _proxy "module_"
+                                          (Thrift.getStructType _proxy)
+                                          5
+                                          4
+                                          (Thrift.buildStruct _proxy _val)
+                                          : []
+                   Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__isTransparent <- ST.newSTRef Prelude.False
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isTransparent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module_
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__isTransparent <- ST.readSTRef
+                                                                        __field__isTransparent
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             Prelude.pure
+                                               (TypedefDefinition_key __val__declaration
+                                                  __val__isTransparent
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__module_)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("isTransparent", 2), ("attributes", 3),
+                     ("typeParams", 4), ("module_", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData TypedefDefinition_key where
+  rnf
+    (TypedefDefinition_key __field__declaration __field__isTransparent
+       __field__attributes __field__typeParams __field__module_)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__isTransparent `Prelude.seq`
+          DeepSeq.rnf __field__attributes `Prelude.seq`
+            DeepSeq.rnf __field__typeParams `Prelude.seq`
+              DeepSeq.rnf __field__module_ `Prelude.seq` ()
+
+instance Default.Default TypedefDefinition_key where
+  def
+    = TypedefDefinition_key Default.def Prelude.False Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable TypedefDefinition_key where
+  hashWithSalt __salt
+    (TypedefDefinition_key _declaration _isTransparent _attributes
+       _typeParams _module_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                 _isTransparent)
+              _attributes)
+           _typeParams)
+        _module_
+
+data ClassDefinition_key = ClassDefinition_key{classDefinition_key_declaration
+                                               :: ClassDeclaration,
+                                               classDefinition_key_isAbstract :: Prelude.Bool,
+                                               classDefinition_key_isFinal :: Prelude.Bool,
+                                               classDefinition_key_members :: [Declaration],
+                                               classDefinition_key_extends_ ::
+                                               Prelude.Maybe ClassDeclaration,
+                                               classDefinition_key_implements_ ::
+                                               [InterfaceDeclaration],
+                                               classDefinition_key_uses :: [TraitDeclaration],
+                                               classDefinition_key_attributes :: [UserAttribute],
+                                               classDefinition_key_typeParams :: [TypeParameter],
+                                               classDefinition_key_module_ ::
+                                               Prelude.Maybe ModuleMembership}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDefinition_key where
+  toJSON
+    (ClassDefinition_key __field__declaration __field__isAbstract
+       __field__isFinal __field__members __field__extends_
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__module_)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "isAbstract" .= __field__isAbstract :
+             "isFinal" .= __field__isFinal :
+               "members" .= __field__members :
+                 Prelude.maybe Prelude.id ((:) . ("extends_" .=)) __field__extends_
+                   ("implements_" .= __field__implements_ :
+                      "uses" .= __field__uses :
+                        "attributes" .= __field__attributes :
+                          "typeParams" .= __field__typeParams :
+                            Prelude.maybe Prelude.id ((:) . ("module_" .=)) __field__module_
+                              Prelude.mempty))
+
+instance Thrift.ThriftStruct ClassDefinition_key where
+  buildStruct _proxy
+    (ClassDefinition_key __field__declaration __field__isAbstract
+       __field__isFinal __field__members __field__extends_
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__module_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genFieldBool _proxy "isAbstract" 2 1 __field__isAbstract :
+             Thrift.genFieldBool _proxy "isFinal" 3 2 __field__isFinal :
+               Thrift.genField _proxy "members" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__members)
+                 :
+                 let (__cereal__extends_, __id__extends_)
+                       = case __field__extends_ of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "extends_"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__extends_
+                     (Thrift.genField _proxy "implements_" (Thrift.getListType _proxy) 6
+                        __id__extends_
+                        (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                           (Thrift.buildStruct _proxy)
+                           __field__implements_)
+                        :
+                        Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 7 6
+                          (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                             (Thrift.buildStruct _proxy)
+                             __field__uses)
+                          :
+                          Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 8 7
+                            (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                               (Thrift.buildStruct _proxy)
+                               __field__attributes)
+                            :
+                            Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 9 8
+                              (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                 (Thrift.buildStruct _proxy)
+                                 __field__typeParams)
+                              :
+                              case __field__module_ of
+                                Prelude.Just _val -> Thrift.genField _proxy "module_"
+                                                       (Thrift.getStructType _proxy)
+                                                       10
+                                                       9
+                                                       (Thrift.buildStruct _proxy _val)
+                                                       : []
+                                Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__isAbstract <- ST.newSTRef Prelude.False
+            __field__isFinal <- ST.newSTRef Prelude.False
+            __field__members <- ST.newSTRef Default.def
+            __field__extends_ <- ST.newSTRef Prelude.Nothing
+            __field__implements_ <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            __field__attributes <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__module_ <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isAbstract
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isFinal
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__members
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__extends_
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__implements_
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 10 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__module_
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__isAbstract <- ST.readSTRef __field__isAbstract
+                                             !__val__isFinal <- ST.readSTRef __field__isFinal
+                                             !__val__members <- ST.readSTRef __field__members
+                                             !__val__extends_ <- ST.readSTRef __field__extends_
+                                             !__val__implements_ <- ST.readSTRef
+                                                                      __field__implements_
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             !__val__attributes <- ST.readSTRef __field__attributes
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__module_ <- ST.readSTRef __field__module_
+                                             Prelude.pure
+                                               (ClassDefinition_key __val__declaration
+                                                  __val__isAbstract
+                                                  __val__isFinal
+                                                  __val__members
+                                                  __val__extends_
+                                                  __val__implements_
+                                                  __val__uses
+                                                  __val__attributes
+                                                  __val__typeParams
+                                                  __val__module_)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("isAbstract", 2), ("isFinal", 3),
+                     ("members", 4), ("extends_", 5), ("implements_", 6), ("uses", 7),
+                     ("attributes", 8), ("typeParams", 9), ("module_", 10)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDefinition_key where
+  rnf
+    (ClassDefinition_key __field__declaration __field__isAbstract
+       __field__isFinal __field__members __field__extends_
+       __field__implements_ __field__uses __field__attributes
+       __field__typeParams __field__module_)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__isAbstract `Prelude.seq`
+          DeepSeq.rnf __field__isFinal `Prelude.seq`
+            DeepSeq.rnf __field__members `Prelude.seq`
+              DeepSeq.rnf __field__extends_ `Prelude.seq`
+                DeepSeq.rnf __field__implements_ `Prelude.seq`
+                  DeepSeq.rnf __field__uses `Prelude.seq`
+                    DeepSeq.rnf __field__attributes `Prelude.seq`
+                      DeepSeq.rnf __field__typeParams `Prelude.seq`
+                        DeepSeq.rnf __field__module_ `Prelude.seq` ()
+
+instance Default.Default ClassDefinition_key where
+  def
+    = ClassDefinition_key Default.def Prelude.False Prelude.False
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable ClassDefinition_key where
+  hashWithSalt __salt
+    (ClassDefinition_key _declaration _isAbstract _isFinal _members
+       _extends_ _implements_ _uses _attributes _typeParams _module_)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                                _isAbstract)
+                             _isFinal)
+                          _members)
+                       _extends_)
+                    _implements_)
+                 _uses)
+              _attributes)
+           _typeParams)
+        _module_
+
+newtype ClassDeclaration_key = ClassDeclaration_key{classDeclaration_key_name
+                                                    :: QName}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration_key where
+  toJSON (ClassDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration_key where
+  buildStruct _proxy (ClassDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (ClassDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration_key where
+  rnf (ClassDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration_key where
+  def = ClassDeclaration_key Default.def
+
+instance Hashable.Hashable ClassDeclaration_key where
+  hashWithSalt __salt (ClassDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data ClassConstDefinition_key = ClassConstDefinition_key{classConstDefinition_key_declaration
+                                                         :: ClassConstDeclaration,
+                                                         classConstDefinition_key_type ::
+                                                         Prelude.Maybe Type,
+                                                         classConstDefinition_key_value ::
+                                                         Prelude.Maybe Text.Text,
+                                                         classConstDefinition_key_typeInfo ::
+                                                         Prelude.Maybe TypeInfo}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassConstDefinition_key where
+  toJSON
+    (ClassConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("type" .=)) __field__type
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                (Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+                   Prelude.mempty)))
+
+instance Thrift.ThriftStruct ClassConstDefinition_key where
+  buildStruct _proxy
+    (ClassConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__type, __id__type)
+                 = case __field__type of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "type"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__type
+               (let (__cereal__value, __id__value)
+                      = case __field__value of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "value"
+                                                     (Thrift.getStringType _proxy)
+                                                     3
+                                                     __id__type
+                                                     (Thrift.genText _proxy _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__type)
+                  in
+                  __cereal__value
+                    (case __field__typeInfo of
+                       Prelude.Just _val -> Thrift.genField _proxy "typeInfo"
+                                              (Thrift.getStructType _proxy)
+                                              4
+                                              __id__value
+                                              (Thrift.buildStruct _proxy _val)
+                                              : []
+                       Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__value <- ST.readSTRef __field__value
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             Prelude.pure
+                                               (ClassConstDefinition_key __val__declaration
+                                                  __val__type
+                                                  __val__value
+                                                  __val__typeInfo)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("type", 2), ("value", 3), ("typeInfo", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassConstDefinition_key where
+  rnf
+    (ClassConstDefinition_key __field__declaration __field__type
+       __field__value __field__typeInfo)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq`
+            DeepSeq.rnf __field__typeInfo `Prelude.seq` ()
+
+instance Default.Default ClassConstDefinition_key where
+  def
+    = ClassConstDefinition_key Default.def Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable ClassConstDefinition_key where
+  hashWithSalt __salt
+    (ClassConstDefinition_key _declaration _type _value _typeInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+              _type)
+           _value)
+        _typeInfo
+
+data ClassConstDeclaration_key = ClassConstDeclaration_key{classConstDeclaration_key_name
+                                                           :: Name,
+                                                           classConstDeclaration_key_container ::
+                                                           ContainerDeclaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassConstDeclaration_key where
+  toJSON (ClassConstDeclaration_key __field__name __field__container)
+    = Aeson.object
+        ("name" .= __field__name :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassConstDeclaration_key where
+  buildStruct _proxy
+    (ClassConstDeclaration_key __field__name __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (ClassConstDeclaration_key __val__name
+                                                  __val__container)
+              _idMap = HashMap.fromList [("name", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassConstDeclaration_key where
+  rnf (ClassConstDeclaration_key __field__name __field__container)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default ClassConstDeclaration_key where
+  def = ClassConstDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ClassConstDeclaration_key where
+  hashWithSalt __salt (ClassConstDeclaration_key _name _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _container
+
+data AttributeToDefinition_key = AttributeToDefinition_key{attributeToDefinition_key_attribute
+                                                           :: UserAttribute,
+                                                           attributeToDefinition_key_definition ::
+                                                           Definition}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeToDefinition_key where
+  toJSON
+    (AttributeToDefinition_key __field__attribute __field__definition)
+    = Aeson.object
+        ("attribute" .= __field__attribute :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeToDefinition_key where
+  buildStruct _proxy
+    (AttributeToDefinition_key __field__attribute __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "attribute" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__attribute)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__attribute <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__attribute <- ST.readSTRef
+                                                                    __field__attribute
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (AttributeToDefinition_key __val__attribute
+                                                  __val__definition)
+              _idMap = HashMap.fromList [("attribute", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeToDefinition_key where
+  rnf
+    (AttributeToDefinition_key __field__attribute __field__definition)
+    = DeepSeq.rnf __field__attribute `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default AttributeToDefinition_key where
+  def = AttributeToDefinition_key Default.def Default.def
+
+instance Hashable.Hashable AttributeToDefinition_key where
+  hashWithSalt __salt
+    (AttributeToDefinition_key _attribute _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _attribute)
+        _definition
+
+data AttributeToDeclaration_key = AttributeToDeclaration_key{attributeToDeclaration_key_attribute
+                                                             :: UserAttribute,
+                                                             attributeToDeclaration_key_declaration
+                                                             :: Declaration,
+                                                             attributeToDeclaration_key_file ::
+                                                             Glean.Schema.Src.File}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeToDeclaration_key where
+  toJSON
+    (AttributeToDeclaration_key __field__attribute __field__declaration
+       __field__file)
+    = Aeson.object
+        ("attribute" .= __field__attribute :
+           "declaration" .= __field__declaration :
+             "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeToDeclaration_key where
+  buildStruct _proxy
+    (AttributeToDeclaration_key __field__attribute __field__declaration
+       __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "attribute" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__attribute)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__attribute <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__attribute <- ST.readSTRef
+                                                                    __field__attribute
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (AttributeToDeclaration_key __val__attribute
+                                                  __val__declaration
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList
+                    [("attribute", 1), ("declaration", 2), ("file", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeToDeclaration_key where
+  rnf
+    (AttributeToDeclaration_key __field__attribute __field__declaration
+       __field__file)
+    = DeepSeq.rnf __field__attribute `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default AttributeToDeclaration_key where
+  def
+    = AttributeToDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable AttributeToDeclaration_key where
+  hashWithSalt __salt
+    (AttributeToDeclaration_key _attribute _declaration _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _attribute)
+           _declaration)
+        _file
+
+data AttributeHasParameter_key = AttributeHasParameter_key{attributeHasParameter_key_name
+                                                           :: Name,
+                                                           attributeHasParameter_key_parameter ::
+                                                           Text.Text,
+                                                           attributeHasParameter_key_attribute ::
+                                                           UserAttribute}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AttributeHasParameter_key where
+  toJSON
+    (AttributeHasParameter_key __field__name __field__parameter
+       __field__attribute)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parameter" .= __field__parameter :
+             "attribute" .= __field__attribute : Prelude.mempty)
+
+instance Thrift.ThriftStruct AttributeHasParameter_key where
+  buildStruct _proxy
+    (AttributeHasParameter_key __field__name __field__parameter
+       __field__attribute)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parameter" (Thrift.getStringType _proxy) 2
+             1
+             (Thrift.genText _proxy __field__parameter)
+             :
+             Thrift.genField _proxy "attribute" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__attribute)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parameter <- ST.newSTRef ""
+            __field__attribute <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parameter
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__attribute
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parameter <- ST.readSTRef __field__parameter
+                                             !__val__attribute <- ST.readSTRef __field__attribute
+                                             Prelude.pure
+                                               (AttributeHasParameter_key __val__name
+                                                  __val__parameter
+                                                  __val__attribute)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("parameter", 2), ("attribute", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData AttributeHasParameter_key where
+  rnf
+    (AttributeHasParameter_key __field__name __field__parameter
+       __field__attribute)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parameter `Prelude.seq`
+          DeepSeq.rnf __field__attribute `Prelude.seq` ()
+
+instance Default.Default AttributeHasParameter_key where
+  def = AttributeHasParameter_key Default.def "" Default.def
+
+instance Hashable.Hashable AttributeHasParameter_key where
+  hashWithSalt __salt
+    (AttributeHasParameter_key _name _parameter _attribute)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parameter)
+        _attribute
+
+data Argument = Argument_lit StringLiteral
+              | Argument_xref XRefTarget
+              | Argument_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Argument where
+  toJSON (Argument_lit __lit) = Aeson.object ["lit" .= __lit]
+  toJSON (Argument_xref __xref) = Aeson.object ["xref" .= __xref]
+  toJSON Argument_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Argument where
+  buildStruct _proxy (Argument_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __lit)]
+  buildStruct _proxy (Argument_xref __xref)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __xref)]
+  buildStruct _proxy Argument_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Argument_lit _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Argument_xref _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Argument_EMPTY
+           Thrift.FieldEnd -> Prelude.return Argument_EMPTY
+    where
+      _idMap = HashMap.fromList [("lit", 1), ("xref", 2)]
+
+instance DeepSeq.NFData Argument where
+  rnf (Argument_lit __lit) = DeepSeq.rnf __lit
+  rnf (Argument_xref __xref) = DeepSeq.rnf __xref
+  rnf Argument_EMPTY = ()
+
+instance Default.Default Argument where
+  def = Argument_EMPTY
+
+instance Hashable.Hashable Argument where
+  hashWithSalt __salt (Argument_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _lit)
+  hashWithSalt __salt (Argument_xref _xref)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _xref)
+  hashWithSalt __salt Argument_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data CallArgument = CallArgument{callArgument_span ::
+                                 Glean.Schema.Src.RelByteSpan,
+                                 callArgument_argument :: Prelude.Maybe Argument}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallArgument where
+  toJSON (CallArgument __field__span __field__argument)
+    = Aeson.object
+        ("span" .= __field__span :
+           Prelude.maybe Prelude.id ((:) . ("argument" .=)) __field__argument
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CallArgument where
+  buildStruct _proxy (CallArgument __field__span __field__argument)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__span)
+           :
+           case __field__argument of
+             Prelude.Just _val -> Thrift.genField _proxy "argument"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__span <- ST.newSTRef Default.def
+            __field__argument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__argument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__span <- ST.readSTRef __field__span
+                                             !__val__argument <- ST.readSTRef __field__argument
+                                             Prelude.pure (CallArgument __val__span __val__argument)
+              _idMap = HashMap.fromList [("span", 1), ("argument", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CallArgument where
+  rnf (CallArgument __field__span __field__argument)
+    = DeepSeq.rnf __field__span `Prelude.seq`
+        DeepSeq.rnf __field__argument `Prelude.seq` ()
+
+instance Default.Default CallArgument where
+  def = CallArgument Default.def Prelude.Nothing
+
+instance Hashable.Hashable CallArgument where
+  hashWithSalt __salt (CallArgument _span _argument)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _span)
+        _argument
+
+data FileCall_key = FileCall_key{fileCall_key_file ::
+                                 Glean.Schema.Src.File,
+                                 fileCall_key_callee_span :: Glean.Schema.Src.ByteSpan,
+                                 fileCall_key_call_args :: [CallArgument],
+                                 fileCall_key_callee_xref :: Prelude.Maybe XRefTarget,
+                                 fileCall_key_dispatch_arg :: Prelude.Maybe CallArgument,
+                                 fileCall_key_receiver_type :: Prelude.Maybe Declaration,
+                                 fileCall_key_callee_xrefs :: [XRefTarget]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall_key where
+  toJSON
+    (FileCall_key __field__file __field__callee_span __field__call_args
+       __field__callee_xref __field__dispatch_arg __field__receiver_type
+       __field__callee_xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "callee_span" .= __field__callee_span :
+             "call_args" .= __field__call_args :
+               Prelude.maybe Prelude.id ((:) . ("callee_xref" .=))
+                 __field__callee_xref
+                 (Prelude.maybe Prelude.id ((:) . ("dispatch_arg" .=))
+                    __field__dispatch_arg
+                    (Prelude.maybe Prelude.id ((:) . ("receiver_type" .=))
+                       __field__receiver_type
+                       ("callee_xrefs" .= __field__callee_xrefs : Prelude.mempty))))
+
+instance Thrift.ThriftStruct FileCall_key where
+  buildStruct _proxy
+    (FileCall_key __field__file __field__callee_span __field__call_args
+       __field__callee_xref __field__dispatch_arg __field__receiver_type
+       __field__callee_xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "callee_span" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__callee_span)
+             :
+             Thrift.genField _proxy "call_args" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__call_args)
+               :
+               let (__cereal__callee_xref, __id__callee_xref)
+                     = case __field__callee_xref of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "callee_xref"
+                                                    (Thrift.getStructType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.buildStruct _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__callee_xref
+                   (let (__cereal__dispatch_arg, __id__dispatch_arg)
+                          = case __field__dispatch_arg of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "dispatch_arg"
+                                                         (Thrift.getStructType _proxy)
+                                                         5
+                                                         __id__callee_xref
+                                                         (Thrift.buildStruct _proxy _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, __id__callee_xref)
+                      in
+                      __cereal__dispatch_arg
+                        (let (__cereal__receiver_type, __id__receiver_type)
+                               = case __field__receiver_type of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "receiver_type"
+                                                              (Thrift.getStructType _proxy)
+                                                              6
+                                                              __id__dispatch_arg
+                                                              (Thrift.buildStruct _proxy _val)),
+                                                         6)
+                                   Prelude.Nothing -> (Prelude.id, __id__dispatch_arg)
+                           in
+                           __cereal__receiver_type
+                             (Thrift.genField _proxy "callee_xrefs" (Thrift.getListType _proxy)
+                                7
+                                __id__receiver_type
+                                (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                   (Thrift.buildStruct _proxy)
+                                   __field__callee_xrefs)
+                                : []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__callee_span <- ST.newSTRef Default.def
+            __field__call_args <- ST.newSTRef Default.def
+            __field__callee_xref <- ST.newSTRef Prelude.Nothing
+            __field__dispatch_arg <- ST.newSTRef Prelude.Nothing
+            __field__receiver_type <- ST.newSTRef Prelude.Nothing
+            __field__callee_xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__call_args
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_xref
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__dispatch_arg
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__receiver_type
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__callee_xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__callee_span <- ST.readSTRef
+                                                                      __field__callee_span
+                                             !__val__call_args <- ST.readSTRef __field__call_args
+                                             !__val__callee_xref <- ST.readSTRef
+                                                                      __field__callee_xref
+                                             !__val__dispatch_arg <- ST.readSTRef
+                                                                       __field__dispatch_arg
+                                             !__val__receiver_type <- ST.readSTRef
+                                                                        __field__receiver_type
+                                             !__val__callee_xrefs <- ST.readSTRef
+                                                                       __field__callee_xrefs
+                                             Prelude.pure
+                                               (FileCall_key __val__file __val__callee_span
+                                                  __val__call_args
+                                                  __val__callee_xref
+                                                  __val__dispatch_arg
+                                                  __val__receiver_type
+                                                  __val__callee_xrefs)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("callee_span", 2), ("call_args", 3),
+                     ("callee_xref", 4), ("dispatch_arg", 5), ("receiver_type", 6),
+                     ("callee_xrefs", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall_key where
+  rnf
+    (FileCall_key __field__file __field__callee_span __field__call_args
+       __field__callee_xref __field__dispatch_arg __field__receiver_type
+       __field__callee_xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__callee_span `Prelude.seq`
+          DeepSeq.rnf __field__call_args `Prelude.seq`
+            DeepSeq.rnf __field__callee_xref `Prelude.seq`
+              DeepSeq.rnf __field__dispatch_arg `Prelude.seq`
+                DeepSeq.rnf __field__receiver_type `Prelude.seq`
+                  DeepSeq.rnf __field__callee_xrefs `Prelude.seq` ()
+
+instance Default.Default FileCall_key where
+  def
+    = FileCall_key Default.def Default.def Default.def Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FileCall_key where
+  hashWithSalt __salt
+    (FileCall_key _file _callee_span _call_args _callee_xref
+       _dispatch_arg _receiver_type _callee_xrefs)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+                       _callee_span)
+                    _call_args)
+                 _callee_xref)
+              _dispatch_arg)
+           _receiver_type)
+        _callee_xrefs
+{-# LINE 19 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TargetUsesAbs_key where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TargetUsesAbs_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TargetUsesAbs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TargetUsesAbs_key" (Prelude.Just 0))
+{-# LINE 30 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TargetUsesAbs_key =
+     'Angle.TField "target" (Glean.Schema.Hack.Types.XRefTarget)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "uses" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 32 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TargetUsesAbs
+         where
+  type KeyType Glean.Schema.Hack.Types.TargetUsesAbs =
+       Glean.Schema.Hack.Types.TargetUsesAbs_key
+  getName _proxy = Glean.PredicateRef "hack.TargetUsesAbs" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.targetUsesAbs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TargetUsesAbs x k
+  getFactKey = Glean.Schema.Hack.Types.targetUsesAbs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TargetUsesAbs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.ClassConstDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ClassConstDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ClassConstDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ClassConstDeclaration_key" (Prelude.Just 0))
+{-# LINE 56 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.ClassConstDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "container"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 58 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.ClassConstDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.ClassConstDeclaration =
+       Glean.Schema.Hack.Types.ClassConstDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.ClassConstDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.classConstDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ClassConstDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.classConstDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassConstDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NamespaceQName_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.NamespaceQName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.NamespaceQName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.NamespaceQName_key" (Prelude.Just 0))
+{-# LINE 82 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.NamespaceQName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 84 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.NamespaceQName
+         where
+  type KeyType Glean.Schema.Hack.Types.NamespaceQName =
+       Glean.Schema.Hack.Types.NamespaceQName_key
+  getName _proxy = Glean.PredicateRef "hack.NamespaceQName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.namespaceQName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.NamespaceQName x k
+  getFactKey = Glean.Schema.Hack.Types.namespaceQName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 93 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NamespaceQName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 99 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypedefDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TypedefDefinition_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypedefDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypedefDefinition_key" (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypedefDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.TypedefDeclaration)
+       ('Angle.TField "isTransparent" (Prelude.Bool)
+          ('Angle.TField "attributes"
+             ([Glean.Schema.Hack.Types.UserAttribute])
+             ('Angle.TField "typeParams"
+                ([Glean.Schema.Hack.Types.TypeParameter])
+                ('Angle.TField "module_"
+                   (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                   ('Angle.TNoFields)))))
+{-# LINE 116 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TypedefDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.TypedefDefinition =
+       Glean.Schema.Hack.Types.TypedefDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.TypedefDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.typedefDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TypedefDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.typedefDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypedefDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchClassConstByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchClassConstByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchClassConstByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchClassConstByName_key"
+           (Prelude.Just 0))
+{-# LINE 142 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchClassConstByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Hack.Types.QName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 144 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchClassConstByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchClassConstByName =
+       Glean.Schema.Hack.Types.SearchClassConstByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchClassConstByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchClassConstByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchClassConstByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchClassConstByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 153 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchClassConstByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 159 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.InterfaceDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.InterfaceDefinition_key x1 x2 x3 x4 x5 x6
+       x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.InterfaceDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.InterfaceDefinition_key" (Prelude.Just 0))
+{-# LINE 178 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.InterfaceDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.InterfaceDeclaration)
+       ('Angle.TField "members" ([Glean.Schema.Hack.Types.Declaration])
+          ('Angle.TField "extends_"
+             ([Glean.Schema.Hack.Types.InterfaceDeclaration])
+             ('Angle.TField "attributes"
+                ([Glean.Schema.Hack.Types.UserAttribute])
+                ('Angle.TField "typeParams"
+                   ([Glean.Schema.Hack.Types.TypeParameter])
+                   ('Angle.TField "requireExtends"
+                      ([Glean.Schema.Hack.Types.ClassDeclaration])
+                      ('Angle.TField "module_"
+                         (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                         ('Angle.TNoFields)))))))
+{-# LINE 180 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.InterfaceDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.InterfaceDefinition =
+       Glean.Schema.Hack.Types.InterfaceDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.InterfaceDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.interfaceDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.InterfaceDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.interfaceDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 189 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.InterfaceDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 195 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchGlobalConstByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 204 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 206 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchGlobalConstByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchGlobalConstByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchGlobalConstByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 216 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchGlobalConstByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 222 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FunctionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.FunctionDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FunctionDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FunctionDeclaration_key" (Prelude.Just 0))
+{-# LINE 229 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FunctionDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 231 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.FunctionDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.FunctionDeclaration =
+       Glean.Schema.Hack.Types.FunctionDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.FunctionDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.functionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.FunctionDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.functionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 240 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FunctionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 246 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTraitByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTraitByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTraitByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTraitByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 255 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchTraitByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 257 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchTraitByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTraitByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchTraitByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchTraitByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchTraitByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTraitByLowerCaseName x k
+  getFactKey = Glean.Schema.Hack.Types.searchTraitByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 266 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTraitByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 272 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.EnumDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.EnumDefinition_key x1 x2 x3 x4 x5 x6 x7 x8
+       x9 x10)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.EnumDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.EnumDefinition_key" (Prelude.Just 0))
+{-# LINE 297 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.EnumDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.EnumDeclaration)
+       ('Angle.TField "enumBase"
+          (Glean.KeyType Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "enumBaseTypeInfo"
+             (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+             ('Angle.TField "enumConstraint"
+                (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+                ('Angle.TField "enumConstraintTypeInfo"
+                   (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                   ('Angle.TField "enumerators" ([Glean.Schema.Hack.Types.Enumerator])
+                      ('Angle.TField "attributes"
+                         ([Glean.Schema.Hack.Types.UserAttribute])
+                         ('Angle.TField "includes"
+                            ([Glean.Schema.Hack.Types.EnumDeclaration])
+                            ('Angle.TField "isEnumClass" (Prelude.Bool)
+                               ('Angle.TField "module_"
+                                  (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 299 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.EnumDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.EnumDefinition =
+       Glean.Schema.Hack.Types.EnumDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.EnumDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.enumDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.EnumDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.enumDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 308 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.EnumDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 314 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchEnumeratorByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 323 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 325 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchEnumeratorByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchEnumeratorByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchEnumeratorByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 334 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchEnumeratorByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 340 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchMethodByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchMethodByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchMethodByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchMethodByName_key" (Prelude.Just 0))
+{-# LINE 351 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchMethodByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Hack.Types.QName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 353 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.SearchMethodByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchMethodByName =
+       Glean.Schema.Hack.Types.SearchMethodByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchMethodByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchMethodByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchMethodByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchMethodByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 362 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchMethodByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 368 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileDeclarations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.FileDeclarations_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FileDeclarations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FileDeclarations_key" (Prelude.Just 0))
+{-# LINE 377 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FileDeclarations_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "declarations"
+          ([Glean.Schema.Hack.Types.Declaration])
+          ('Angle.TNoFields))
+{-# LINE 379 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.FileDeclarations
+         where
+  type KeyType Glean.Schema.Hack.Types.FileDeclarations =
+       Glean.Schema.Hack.Types.FileDeclarations_key
+  getName _proxy = Glean.PredicateRef "hack.FileDeclarations" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.fileDeclarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.FileDeclarations x k
+  getFactKey = Glean.Schema.Hack.Types.fileDeclarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 388 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileDeclarations where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 394 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.MethodDefinition_key x1 x2 x3 x4 x5 x6 x7
+       x8 x9 x10 x11)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+         Glean.buildRtsValue b x11
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MethodDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MethodDefinition_key" (Prelude.Just 0))
+{-# LINE 421 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MethodDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+       ('Angle.TField "signature"
+          (Glean.KeyType Glean.Schema.Hack.Types.Signature)
+          ('Angle.TField "visibility" (Glean.Schema.Hack.Types.Visibility)
+             ('Angle.TField "isAbstract" (Prelude.Bool)
+                ('Angle.TField "isAsync" (Prelude.Bool)
+                   ('Angle.TField "isFinal" (Prelude.Bool)
+                      ('Angle.TField "isStatic" (Prelude.Bool)
+                         ('Angle.TField "attributes"
+                            ([Glean.Schema.Hack.Types.UserAttribute])
+                            ('Angle.TField "typeParams"
+                               ([Glean.Schema.Hack.Types.TypeParameter])
+                               ('Angle.TField "isReadonlyThis" (Prelude.Maybe Prelude.Bool)
+                                  ('Angle.TField "readonlyRet"
+                                     (Prelude.Maybe Glean.Schema.Hack.Types.ReadonlyKind)
+                                     ('Angle.TNoFields)))))))))))
+{-# LINE 423 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MethodDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.MethodDefinition =
+       Glean.Schema.Hack.Types.MethodDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.MethodDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.methodDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MethodDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.methodDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 432 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 438 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.InterfaceDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.InterfaceDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.InterfaceDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.InterfaceDeclaration_key" (Prelude.Just 0))
+{-# LINE 445 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.InterfaceDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 447 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.InterfaceDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.InterfaceDeclaration =
+       Glean.Schema.Hack.Types.InterfaceDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.InterfaceDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.interfaceDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.InterfaceDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.interfaceDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 456 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.InterfaceDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 462 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchEnumByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchEnumByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchEnumByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchEnumByName_key" (Prelude.Just 0))
+{-# LINE 473 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchEnumByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 475 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.SearchEnumByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchEnumByName =
+       Glean.Schema.Hack.Types.SearchEnumByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchEnumByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchEnumByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchEnumByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchEnumByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 484 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchEnumByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 490 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOverrides_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.MethodOverrides_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MethodOverrides_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MethodOverrides_key" (Prelude.Just 0))
+{-# LINE 501 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MethodOverrides_key =
+     'Angle.TField "derived"
+       (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+       ('Angle.TField "base"
+          (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+          ('Angle.TField "annotation" (Prelude.Maybe Prelude.Bool)
+             ('Angle.TNoFields)))
+{-# LINE 503 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MethodOverrides
+         where
+  type KeyType Glean.Schema.Hack.Types.MethodOverrides =
+       Glean.Schema.Hack.Types.MethodOverrides_key
+  getName _proxy = Glean.PredicateRef "hack.MethodOverrides" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.methodOverrides_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MethodOverrides x k
+  getFactKey = Glean.Schema.Hack.Types.methodOverrides_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 512 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOverrides where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 518 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Signature_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.Signature_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Signature_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Signature_key" (Prelude.Just 0))
+{-# LINE 531 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Signature_key =
+     'Angle.TField "returns"
+       (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+       ('Angle.TField "parameters" ([Glean.Schema.Hack.Types.Parameter])
+          ('Angle.TField "contexts"
+             (Prelude.Maybe [Glean.Schema.Hack.Types.Context_])
+             ('Angle.TField "returnsTypeInfo"
+                (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                ('Angle.TNoFields))))
+{-# LINE 533 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Signature where
+  type KeyType Glean.Schema.Hack.Types.Signature =
+       Glean.Schema.Hack.Types.Signature_key
+  getName _proxy = Glean.PredicateRef "hack.Signature" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.signature_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Signature x k
+  getFactKey = Glean.Schema.Hack.Types.signature_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 542 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Signature where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 548 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TraitDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TraitDefinition_key x1 x2 x3 x4 x5 x6 x7
+       x8 x9 x10)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TraitDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TraitDefinition_key" (Prelude.Just 0))
+{-# LINE 573 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TraitDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.TraitDeclaration)
+       ('Angle.TField "members" ([Glean.Schema.Hack.Types.Declaration])
+          ('Angle.TField "implements_"
+             ([Glean.Schema.Hack.Types.InterfaceDeclaration])
+             ('Angle.TField "uses" ([Glean.Schema.Hack.Types.TraitDeclaration])
+                ('Angle.TField "attributes"
+                   ([Glean.Schema.Hack.Types.UserAttribute])
+                   ('Angle.TField "typeParams"
+                      ([Glean.Schema.Hack.Types.TypeParameter])
+                      ('Angle.TField "requireExtends"
+                         ([Glean.Schema.Hack.Types.ClassDeclaration])
+                         ('Angle.TField "requireImplements"
+                            ([Glean.Schema.Hack.Types.InterfaceDeclaration])
+                            ('Angle.TField "module_"
+                               (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                               ('Angle.TField "requireClass"
+                                  (Prelude.Maybe [Glean.Schema.Hack.Types.ClassDeclaration])
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 575 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TraitDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.TraitDefinition =
+       Glean.Schema.Hack.Types.TraitDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.TraitDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.traitDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TraitDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.traitDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 584 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TraitDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 590 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TargetUses_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.TargetUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TargetUses_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TargetUses_key" (Prelude.Just 0))
+{-# LINE 601 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TargetUses_key =
+     'Angle.TField "target" (Glean.Schema.Hack.Types.XRefTarget)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "uses" ([Glean.Schema.Src.Types.RelByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 603 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TargetUses where
+  type KeyType Glean.Schema.Hack.Types.TargetUses =
+       Glean.Schema.Hack.Types.TargetUses_key
+  getName _proxy = Glean.PredicateRef "hack.TargetUses" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.targetUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TargetUses x k
+  getFactKey = Glean.Schema.Hack.Types.targetUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 612 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TargetUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 618 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchClassByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchClassByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchClassByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchClassByName_key" (Prelude.Just 0))
+{-# LINE 629 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchClassByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 631 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.SearchClassByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchClassByName =
+       Glean.Schema.Hack.Types.SearchClassByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchClassByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchClassByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchClassByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchClassByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 640 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchClassByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 646 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchInterfaceByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 655 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 657 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchInterfaceByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchInterfaceByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchInterfaceByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 666 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchInterfaceByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 672 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchFunctionByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchFunctionByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchFunctionByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchFunctionByName_key" (Prelude.Just 0))
+{-# LINE 683 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchFunctionByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 685 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchFunctionByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchFunctionByName =
+       Glean.Schema.Hack.Types.SearchFunctionByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchFunctionByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchFunctionByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchFunctionByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchFunctionByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 694 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchFunctionByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 700 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ClassDefinition_key x1 x2 x3 x4 x5 x6 x7
+       x8 x9 x10)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ClassDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ClassDefinition_key" (Prelude.Just 0))
+{-# LINE 725 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ClassDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.ClassDeclaration)
+       ('Angle.TField "isAbstract" (Prelude.Bool)
+          ('Angle.TField "isFinal" (Prelude.Bool)
+             ('Angle.TField "members" ([Glean.Schema.Hack.Types.Declaration])
+                ('Angle.TField "extends_"
+                   (Prelude.Maybe Glean.Schema.Hack.Types.ClassDeclaration)
+                   ('Angle.TField "implements_"
+                      ([Glean.Schema.Hack.Types.InterfaceDeclaration])
+                      ('Angle.TField "uses" ([Glean.Schema.Hack.Types.TraitDeclaration])
+                         ('Angle.TField "attributes"
+                            ([Glean.Schema.Hack.Types.UserAttribute])
+                            ('Angle.TField "typeParams"
+                               ([Glean.Schema.Hack.Types.TypeParameter])
+                               ('Angle.TField "module_"
+                                  (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 727 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ClassDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.ClassDefinition =
+       Glean.Schema.Hack.Types.ClassDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.ClassDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.classDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ClassDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.classDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 736 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 742 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.NamespaceDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.NamespaceDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.NamespaceDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.NamespaceDeclaration_key" (Prelude.Just 0))
+{-# LINE 749 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.NamespaceDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Hack.Types.NamespaceQName)
+       ('Angle.TNoFields)
+{-# LINE 751 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.NamespaceDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.NamespaceDeclaration =
+       Glean.Schema.Hack.Types.NamespaceDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.NamespaceDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.namespaceDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.NamespaceDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.namespaceDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 760 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NamespaceDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 766 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Enumerator_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.Enumerator_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Enumerator_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Enumerator_key" (Prelude.Just 0))
+{-# LINE 775 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Enumerator_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "enumeration"
+          (Glean.KeyType Glean.Schema.Hack.Types.EnumDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 777 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Enumerator where
+  type KeyType Glean.Schema.Hack.Types.Enumerator =
+       Glean.Schema.Hack.Types.Enumerator_key
+  getName _proxy = Glean.PredicateRef "hack.Enumerator" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.enumerator_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Enumerator x k
+  getFactKey = Glean.Schema.Hack.Types.enumerator_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 786 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Enumerator where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 792 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchNamespaceByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchNamespaceByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchNamespaceByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchNamespaceByName_key" (Prelude.Just 0))
+{-# LINE 803 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchNamespaceByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 805 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchNamespaceByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchNamespaceByName =
+       Glean.Schema.Hack.Types.SearchNamespaceByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchNamespaceByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchNamespaceByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchNamespaceByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchNamespaceByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 814 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchNamespaceByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 820 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NameLowerCase_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 829 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.NameLowerCase_key =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 831 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Hack.Types.NameLowerCase =
+       Glean.Schema.Hack.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "hack.NameLowerCase" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Hack.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 840 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 846 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.StringLiteral
+         where
+  type KeyType Glean.Schema.Hack.Types.StringLiteral = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hack.StringLiteral" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.stringLiteral_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.StringLiteral x k
+  getFactKey = Glean.Schema.Hack.Types.stringLiteral_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 854 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.StringLiteral where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 860 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.GlobalNamespaceAlias_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.GlobalNamespaceAlias_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.GlobalNamespaceAlias_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.GlobalNamespaceAlias_key" (Prelude.Just 0))
+{-# LINE 869 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.GlobalNamespaceAlias_key
+     =
+     'Angle.TField "from" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "to"
+          (Glean.KeyType Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 871 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.GlobalNamespaceAlias
+         where
+  type KeyType Glean.Schema.Hack.Types.GlobalNamespaceAlias =
+       Glean.Schema.Hack.Types.GlobalNamespaceAlias_key
+  getName _proxy = Glean.PredicateRef "hack.GlobalNamespaceAlias" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.globalNamespaceAlias_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.GlobalNamespaceAlias x k
+  getFactKey = Glean.Schema.Hack.Types.globalNamespaceAlias_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 880 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.GlobalNamespaceAlias
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 886 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchInterfaceByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchInterfaceByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchInterfaceByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchInterfaceByName_key" (Prelude.Just 0))
+{-# LINE 897 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchInterfaceByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 899 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchInterfaceByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchInterfaceByName =
+       Glean.Schema.Hack.Types.SearchInterfaceByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchInterfaceByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchInterfaceByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchInterfaceByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchInterfaceByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 908 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchInterfaceByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 914 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchClassByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchClassByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchClassByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchClassByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 923 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchClassByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 925 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchClassByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchClassByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchClassByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchClassByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchClassByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchClassByLowerCaseName x k
+  getFactKey = Glean.Schema.Hack.Types.searchClassByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 934 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchClassByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 940 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.ContainerDeclarationQName
+         where
+  type KeyType Glean.Schema.Hack.Types.ContainerDeclarationQName =
+       Glean.Schema.Hack.Types.ContainerDeclaration
+  type ValueType Glean.Schema.Hack.Types.ContainerDeclarationQName =
+       Glean.Schema.Hack.Types.ContainerDeclarationQName_value
+  getName _proxy
+    = Glean.PredicateRef "hack.ContainerDeclarationQName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.containerDeclarationQName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Hack.Types.ContainerDeclarationQName x k v
+  getFactKey = Glean.Schema.Hack.Types.containerDeclarationQName_key
+  getFactValue
+    = Glean.Schema.Hack.Types.containerDeclarationQName_value
+{-# LINE 951 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.ContainerDeclarationQName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 957 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.UserAttribute_key where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.UserAttribute_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.UserAttribute_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.UserAttribute_key" (Prelude.Just 0))
+{-# LINE 968 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.UserAttribute_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "parameters" ([Data.Text.Text])
+          ('Angle.TField "qname"
+             (Prelude.Maybe Glean.Schema.Hack.Types.QName)
+             ('Angle.TNoFields)))
+{-# LINE 970 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.UserAttribute
+         where
+  type KeyType Glean.Schema.Hack.Types.UserAttribute =
+       Glean.Schema.Hack.Types.UserAttribute_key
+  getName _proxy = Glean.PredicateRef "hack.UserAttribute" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.userAttribute_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.UserAttribute x k
+  getFactKey = Glean.Schema.Hack.Types.userAttribute_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 979 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.UserAttribute where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 985 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchPropertyByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchPropertyByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchPropertyByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchPropertyByName_key" (Prelude.Just 0))
+{-# LINE 996 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchPropertyByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Hack.Types.QName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 998 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchPropertyByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchPropertyByName =
+       Glean.Schema.Hack.Types.SearchPropertyByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchPropertyByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchPropertyByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchPropertyByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchPropertyByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1007 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchPropertyByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1013 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.DeclarationNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationNamespace_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationNamespace_key" (Prelude.Just 0))
+{-# LINE 1022 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationNamespace_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "namespace_"
+          (Glean.KeyType Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 1024 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.DeclarationNamespace
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationNamespace =
+       Glean.Schema.Hack.Types.DeclarationNamespace_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationNamespace" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationNamespace x k
+  getFactKey = Glean.Schema.Hack.Types.declarationNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1033 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1039 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.ModuleDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ModuleDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ModuleDeclaration_key" (Prelude.Just 0))
+{-# LINE 1046 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ModuleDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 1048 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ModuleDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.ModuleDeclaration =
+       Glean.Schema.Hack.Types.ModuleDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.ModuleDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.moduleDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ModuleDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.moduleDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1057 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1063 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NamespaceMember_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.NamespaceMember_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.NamespaceMember_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.NamespaceMember_key" (Prelude.Just 0))
+{-# LINE 1072 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.NamespaceMember_key =
+     'Angle.TField "namespace_"
+       (Glean.KeyType Glean.Schema.Hack.Types.NamespaceQName)
+       ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1074 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.NamespaceMember
+         where
+  type KeyType Glean.Schema.Hack.Types.NamespaceMember =
+       Glean.Schema.Hack.Types.NamespaceMember_key
+  getName _proxy = Glean.PredicateRef "hack.NamespaceMember" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.namespaceMember_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.NamespaceMember x k
+  getFactKey = Glean.Schema.Hack.Types.namespaceMember_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1083 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.NamespaceMember where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1089 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.PropertyDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.PropertyDefinition_key x1 x2 x3 x4 x5 x6
+       x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.PropertyDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.PropertyDefinition_key" (Prelude.Just 0))
+{-# LINE 1110 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.PropertyDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.PropertyDeclaration)
+       ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "visibility" (Glean.Schema.Hack.Types.Visibility)
+             ('Angle.TField "isFinal" (Prelude.Bool)
+                ('Angle.TField "isAbstract" (Prelude.Bool)
+                   ('Angle.TField "isStatic" (Prelude.Bool)
+                      ('Angle.TField "attributes"
+                         ([Glean.Schema.Hack.Types.UserAttribute])
+                         ('Angle.TField "typeInfo"
+                            (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                            ('Angle.TNoFields))))))))
+{-# LINE 1112 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.PropertyDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.PropertyDefinition =
+       Glean.Schema.Hack.Types.PropertyDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.PropertyDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.propertyDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.PropertyDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.propertyDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1121 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.PropertyDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1127 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FunctionDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.FunctionDefinition_key x1 x2 x3 x4 x5 x6
+       x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FunctionDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FunctionDefinition_key" (Prelude.Just 0))
+{-# LINE 1146 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FunctionDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.FunctionDeclaration)
+       ('Angle.TField "signature"
+          (Glean.KeyType Glean.Schema.Hack.Types.Signature)
+          ('Angle.TField "isAsync" (Prelude.Bool)
+             ('Angle.TField "attributes"
+                ([Glean.Schema.Hack.Types.UserAttribute])
+                ('Angle.TField "typeParams"
+                   ([Glean.Schema.Hack.Types.TypeParameter])
+                   ('Angle.TField "module_"
+                      (Prelude.Maybe Glean.Schema.Hack.Types.ModuleMembership)
+                      ('Angle.TField "readonlyRet"
+                         (Prelude.Maybe Glean.Schema.Hack.Types.ReadonlyKind)
+                         ('Angle.TNoFields)))))))
+{-# LINE 1148 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.FunctionDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.FunctionDefinition =
+       Glean.Schema.Hack.Types.FunctionDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.FunctionDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.functionDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.FunctionDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.functionDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1157 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FunctionDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1163 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchPropertyByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1172 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1174 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchPropertyByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchPropertyByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchPropertyByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1183 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchPropertyByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1189 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.GlobalConstDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.GlobalConstDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.GlobalConstDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.GlobalConstDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1196 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.GlobalConstDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 1198 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.GlobalConstDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.GlobalConstDeclaration =
+       Glean.Schema.Hack.Types.GlobalConstDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.GlobalConstDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.globalConstDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.GlobalConstDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.globalConstDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1207 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.GlobalConstDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1213 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchGlobalConstByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchGlobalConstByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchGlobalConstByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchGlobalConstByName_key"
+           (Prelude.Just 0))
+{-# LINE 1224 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchGlobalConstByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 1226 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchGlobalConstByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchGlobalConstByName =
+       Glean.Schema.Hack.Types.SearchGlobalConstByName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchGlobalConstByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchGlobalConstByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchGlobalConstByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchGlobalConstByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1235 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchGlobalConstByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1241 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationSpan_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationSpan_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationSpan_key" (Prelude.Just 0))
+{-# LINE 1252 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationSpan_key =
+     'Angle.TField "declaration" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1254 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.DeclarationSpan
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationSpan =
+       Glean.Schema.Hack.Types.DeclarationSpan_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationSpan" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationSpan x k
+  getFactKey = Glean.Schema.Hack.Types.declarationSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1263 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationSpan where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1269 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileCall_key where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.FileCall_key x1 x2 x3 x4 x5 x6 x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FileCall_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FileCall_key" (Prelude.Just 0))
+{-# LINE 1288 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FileCall_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "callee_span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "call_args" ([Glean.Schema.Hack.Types.CallArgument])
+             ('Angle.TField "callee_xref"
+                (Prelude.Maybe Glean.Schema.Hack.Types.XRefTarget)
+                ('Angle.TField "dispatch_arg"
+                   (Prelude.Maybe Glean.Schema.Hack.Types.CallArgument)
+                   ('Angle.TField "receiver_type"
+                      (Prelude.Maybe Glean.Schema.Hack.Types.Declaration)
+                      ('Angle.TField "callee_xrefs"
+                         ([Glean.Schema.Hack.Types.XRefTarget])
+                         ('Angle.TNoFields)))))))
+{-# LINE 1290 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.FileCall where
+  type KeyType Glean.Schema.Hack.Types.FileCall =
+       Glean.Schema.Hack.Types.FileCall_key
+  getName _proxy = Glean.PredicateRef "hack.FileCall" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.fileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.FileCall x k
+  getFactKey = Glean.Schema.Hack.Types.fileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1299 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileCall where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1305 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.QName_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.QName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.QName_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.QName_key" (Prelude.Just 0))
+{-# LINE 1314 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hack.Types.QName_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 1316 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.QName where
+  type KeyType Glean.Schema.Hack.Types.QName =
+       Glean.Schema.Hack.Types.QName_key
+  getName _proxy = Glean.PredicateRef "hack.QName" 6
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.qName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.QName x k
+  getFactKey = Glean.Schema.Hack.Types.qName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1325 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.QName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1331 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.HackToThrift_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.HackToThrift_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.HackToThrift_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.HackToThrift_key" (Prelude.Just 0))
+{-# LINE 1340 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.HackToThrift_key =
+     'Angle.TField "from" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "to" (Glean.Schema.Fbthrift.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1342 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.HackToThrift where
+  type KeyType Glean.Schema.Hack.Types.HackToThrift =
+       Glean.Schema.Hack.Types.HackToThrift_key
+  getName _proxy = Glean.PredicateRef "hack.HackToThrift" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.hackToThrift_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.HackToThrift x k
+  getFactKey = Glean.Schema.Hack.Types.hackToThrift_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1351 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.HackToThrift where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1357 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypedefDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.TypedefDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypedefDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypedefDeclaration_key" (Prelude.Just 0))
+{-# LINE 1364 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypedefDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 1366 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TypedefDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.TypedefDeclaration =
+       Glean.Schema.Hack.Types.TypedefDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.TypedefDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.typedefDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TypedefDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.typedefDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1375 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypedefDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1381 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleParent_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.ModuleParent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ModuleParent_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ModuleParent_key" (Prelude.Just 0))
+{-# LINE 1390 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ModuleParent_key =
+     'Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "module"
+          (Glean.KeyType Glean.Schema.Hack.Types.ModuleDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1392 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ModuleParent where
+  type KeyType Glean.Schema.Hack.Types.ModuleParent =
+       Glean.Schema.Hack.Types.ModuleParent_key
+  getName _proxy = Glean.PredicateRef "hack.ModuleParent" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.moduleParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ModuleParent x k
+  getFactKey = Glean.Schema.Hack.Types.moduleParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1401 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleParent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1407 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleChild_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.ModuleChild_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ModuleChild_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ModuleChild_key" (Prelude.Just 0))
+{-# LINE 1416 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ModuleChild_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Hack.Types.ModuleDeclaration)
+       ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1418 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ModuleChild where
+  type KeyType Glean.Schema.Hack.Types.ModuleChild =
+       Glean.Schema.Hack.Types.ModuleChild_key
+  getName _proxy = Glean.PredicateRef "hack.ModuleChild" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.moduleChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ModuleChild x k
+  getFactKey = Glean.Schema.Hack.Types.moduleChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1427 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleChild where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1433 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationLocation_key" (Prelude.Just 0))
+{-# LINE 1444 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationLocation_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1446 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationLocation =
+       Glean.Schema.Hack.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationLocation" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Hack.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1455 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1461 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationSource_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationSource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationSource_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationSource_key" (Prelude.Just 0))
+{-# LINE 1470 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationSource_key =
+     'Angle.TField "target" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1472 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.DeclarationSource
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationSource =
+       Glean.Schema.Hack.Types.DeclarationSource_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationSource" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationSource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationSource x k
+  getFactKey = Glean.Schema.Hack.Types.declarationSource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1481 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationSource where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1487 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOccurrence_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.MethodOccurrence_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MethodOccurrence_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MethodOccurrence_key" (Prelude.Just 0))
+{-# LINE 1496 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MethodOccurrence_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "className"
+          (Prelude.Maybe Glean.Schema.Hack.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 1498 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MethodOccurrence
+         where
+  type KeyType Glean.Schema.Hack.Types.MethodOccurrence =
+       Glean.Schema.Hack.Types.MethodOccurrence_key
+  getName _proxy = Glean.PredicateRef "hack.MethodOccurrence" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.methodOccurrence_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MethodOccurrence x k
+  getFactKey = Glean.Schema.Hack.Types.methodOccurrence_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1507 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOccurrence where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1513 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MemberCluster_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.MemberCluster_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MemberCluster_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MemberCluster_key" (Prelude.Just 0))
+{-# LINE 1520 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MemberCluster_key =
+     'Angle.TField "members" ([Glean.Schema.Hack.Types.Declaration])
+       ('Angle.TNoFields)
+{-# LINE 1522 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MemberCluster
+         where
+  type KeyType Glean.Schema.Hack.Types.MemberCluster =
+       Glean.Schema.Hack.Types.MemberCluster_key
+  getName _proxy = Glean.PredicateRef "hack.MemberCluster" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.memberCluster_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MemberCluster x k
+  getFactKey = Glean.Schema.Hack.Types.memberCluster_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1531 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MemberCluster where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1537 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchClassConstByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1546 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1548 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchClassConstByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchClassConstByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchClassConstByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1557 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchClassConstByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1563 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FileXRefs_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 1572 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Hack.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 1574 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.FileXRefs where
+  type KeyType Glean.Schema.Hack.Types.FileXRefs =
+       Glean.Schema.Hack.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "hack.FileXRefs" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Hack.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1583 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1589 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.TypeConstDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TypeConstDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypeConstDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypeConstDeclaration_key" (Prelude.Just 0))
+{-# LINE 1598 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypeConstDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "container"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1600 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.TypeConstDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.TypeConstDeclaration =
+       Glean.Schema.Hack.Types.TypeConstDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.TypeConstDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.typeConstDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TypeConstDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.typeConstDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1609 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeConstDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1615 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.DeclarationName
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationName =
+       Glean.Schema.Hack.Types.Declaration
+  type ValueType Glean.Schema.Hack.Types.DeclarationName =
+       Glean.Schema.Hack.Types.DeclarationName_value
+  getName _proxy = Glean.PredicateRef "hack.DeclarationName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Hack.Types.DeclarationName x k v
+  getFactKey = Glean.Schema.Hack.Types.declarationName_key
+  getFactValue = Glean.Schema.Hack.Types.declarationName_value
+{-# LINE 1626 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1632 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOverridden_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.MethodOverridden_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MethodOverridden_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MethodOverridden_key" (Prelude.Just 0))
+{-# LINE 1643 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MethodOverridden_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+       ('Angle.TField "derived"
+          (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+          ('Angle.TField "annotation" (Prelude.Maybe Prelude.Bool)
+             ('Angle.TNoFields)))
+{-# LINE 1645 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MethodOverridden
+         where
+  type KeyType Glean.Schema.Hack.Types.MethodOverridden =
+       Glean.Schema.Hack.Types.MethodOverridden_key
+  getName _proxy = Glean.PredicateRef "hack.MethodOverridden" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.methodOverridden_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MethodOverridden x k
+  getFactKey = Glean.Schema.Hack.Types.methodOverridden_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1654 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodOverridden where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1660 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationTarget_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationTarget_key" (Prelude.Just 0))
+{-# LINE 1669 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationTarget_key =
+     'Angle.TField "source" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "target" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1671 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.DeclarationTarget
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationTarget =
+       Glean.Schema.Hack.Types.DeclarationTarget_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationTarget" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationTarget x k
+  getFactKey = Glean.Schema.Hack.Types.declarationTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1680 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1686 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Name where
+  type KeyType Glean.Schema.Hack.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hack.Name" 6
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Name x k
+  getFactKey = Glean.Schema.Hack.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1694 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1700 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.MethodDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.MethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.MethodDeclaration_key" (Prelude.Just 0))
+{-# LINE 1709 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.MethodDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "container"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1711 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.MethodDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.MethodDeclaration =
+       Glean.Schema.Hack.Types.MethodDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.MethodDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.methodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.MethodDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.methodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1720 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.MethodDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1726 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TraitDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.TraitDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TraitDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TraitDeclaration_key" (Prelude.Just 0))
+{-# LINE 1733 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TraitDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 1735 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TraitDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.TraitDeclaration =
+       Glean.Schema.Hack.Types.TraitDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.TraitDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.traitDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TraitDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.traitDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1744 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TraitDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1750 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTypeConstByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTypeConstByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTypeConstByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTypeConstByName_key" (Prelude.Just 0))
+{-# LINE 1761 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchTypeConstByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Hack.Types.QName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 1763 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchTypeConstByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTypeConstByName =
+       Glean.Schema.Hack.Types.SearchTypeConstByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchTypeConstByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchTypeConstByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTypeConstByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchTypeConstByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1772 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchTypeConstByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1778 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.ClassDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ClassDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ClassDeclaration_key" (Prelude.Just 0))
+{-# LINE 1785 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ClassDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 1787 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ClassDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.ClassDeclaration =
+       Glean.Schema.Hack.Types.ClassDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.ClassDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.classDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ClassDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.classDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1796 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1802 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchTypedefByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTypedefByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTypedefByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTypedefByName_key" (Prelude.Just 0))
+{-# LINE 1813 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchTypedefByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 1815 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchTypedefByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTypedefByName =
+       Glean.Schema.Hack.Types.SearchTypedefByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchTypedefByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchTypedefByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTypedefByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchTypedefByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1824 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchTypedefByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1830 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.IndexerInputsHash
+         where
+  type KeyType Glean.Schema.Hack.Types.IndexerInputsHash =
+       Data.Text.Text
+  type ValueType Glean.Schema.Hack.Types.IndexerInputsHash =
+       Glean.Schema.Hack.Types.IndexerInputsHash_value
+  getName _proxy = Glean.PredicateRef "hack.IndexerInputsHash" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.indexerInputsHash_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Hack.Types.IndexerInputsHash x k v
+  getFactKey = Glean.Schema.Hack.Types.indexerInputsHash_key
+  getFactValue = Glean.Schema.Hack.Types.indexerInputsHash_value
+{-# LINE 1840 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.IndexerInputsHash where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1846 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchFunctionByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1855 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1857 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchFunctionByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchFunctionByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchFunctionByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1866 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchFunctionByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1872 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchModuleByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchModuleByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchModuleByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchModuleByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1881 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchModuleByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1883 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchModuleByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchModuleByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchModuleByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchModuleByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchModuleByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchModuleByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchModuleByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1892 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchModuleByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1898 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchNamespaceByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1907 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1909 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchNamespaceByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchNamespaceByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchNamespaceByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1918 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchNamespaceByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1924 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchMethodByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchMethodByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchMethodByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchMethodByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1933 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchMethodByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1935 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchMethodByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchMethodByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchMethodByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchMethodByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchMethodByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchMethodByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchMethodByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1944 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchMethodByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1950 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ModuleDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ModuleDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ModuleDefinition_key" (Prelude.Just 0))
+{-# LINE 1959 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ModuleDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.ModuleDeclaration)
+       ('Angle.TField "attributes"
+          ([Glean.Schema.Hack.Types.UserAttribute])
+          ('Angle.TNoFields))
+{-# LINE 1961 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ModuleDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.ModuleDefinition =
+       Glean.Schema.Hack.Types.ModuleDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.ModuleDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.moduleDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ModuleDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.moduleDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1970 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1976 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.AttributeToDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.AttributeToDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.AttributeToDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.AttributeToDefinition_key" (Prelude.Just 0))
+{-# LINE 1985 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.AttributeToDefinition_key
+     =
+     'Angle.TField "attribute"
+       (Glean.KeyType Glean.Schema.Hack.Types.UserAttribute)
+       ('Angle.TField "definition" (Glean.Schema.Hack.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 1987 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.AttributeToDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.AttributeToDefinition =
+       Glean.Schema.Hack.Types.AttributeToDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.AttributeToDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.attributeToDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.AttributeToDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.attributeToDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1996 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.AttributeToDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2002 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint_key where
+  buildRtsValue b Glean.Schema.Hack.Types.Hint_key_EMPTY
+    = Glean.buildRtsSelector b 20
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_apply x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_option x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_like x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_tuple x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_class_args x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_shape x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_soft x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_intersection x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_union_ x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_vect_or_dict x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_prim x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_var_ x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_fun_context x)
+    = do Glean.buildRtsSelector b 12
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_mixed x)
+    = do Glean.buildRtsSelector b 13
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_wildcard x)
+    = do Glean.buildRtsSelector b 14
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_nonnull x)
+    = do Glean.buildRtsSelector b 15
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_this_ x)
+    = do Glean.buildRtsSelector b 16
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_dynamic x)
+    = do Glean.buildRtsSelector b 17
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_nothing x)
+    = do Glean.buildRtsSelector b 18
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_key_other x)
+    = do Glean.buildRtsSelector b 19
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hack.Types.Hint_key_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.Hint_key_apply,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_option,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_like,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_tuple,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_class_args,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_shape,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_soft,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_intersection,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_union_,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_vect_or_dict,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_prim,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_var_,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_fun_context,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_mixed,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_wildcard,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_nonnull,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_this_,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_dynamic,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_nothing,
+         Glean.mapD Glean.Schema.Hack.Types.Hint_key_other]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Hint_key" (Prelude.Just 0))
+{-# LINE 2090 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Hint_key =
+     'Angle.TField "apply" (Glean.Schema.Hack.Types.Hint_apply_)
+       ('Angle.TField "option"
+          (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+          ('Angle.TField "like" (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+             ('Angle.TField "tuple" (Glean.Schema.Hack.Types.Hint_tuple_)
+                ('Angle.TField "class_args"
+                   (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+                   ('Angle.TField "shape" (Glean.Schema.Hack.Types.Hint_shape_)
+                      ('Angle.TField "soft" (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+                         ('Angle.TField "intersection" ([Glean.Schema.Hack.Types.Hint])
+                            ('Angle.TField "union_" ([Glean.Schema.Hack.Types.Hint])
+                               ('Angle.TField "vect_or_dict"
+                                  (Glean.Schema.Hack.Types.Hint_vect_or_dict_)
+                                  ('Angle.TField "prim" (Glean.KeyType Glean.Schema.Hack.Types.Type)
+                                     ('Angle.TField "var_" (Data.Text.Text)
+                                        ('Angle.TField "fun_context" (Data.Text.Text)
+                                           ('Angle.TField "mixed" (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "wildcard"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "nonnull"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "this_"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "dynamic"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "nothing"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "other"
+                                                                (Glean.KeyType
+                                                                   Glean.Schema.Hack.Types.Type)
+                                                                ('Angle.TNoFields))))))))))))))))))))
+{-# LINE 2092 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Hint where
+  type KeyType Glean.Schema.Hack.Types.Hint =
+       Glean.Schema.Hack.Types.Hint_key
+  getName _proxy = Glean.PredicateRef "hack.Hint" 6
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.hint_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Hint x k
+  getFactKey = Glean.Schema.Hack.Types.hint_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2100 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2106 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.EnumDeclaration_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.EnumDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.EnumDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.EnumDeclaration_key" (Prelude.Just 0))
+{-# LINE 2113 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.EnumDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TNoFields)
+{-# LINE 2115 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.EnumDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.EnumDeclaration =
+       Glean.Schema.Hack.Types.EnumDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.EnumDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.enumDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.EnumDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.enumDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2124 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.EnumDeclaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2130 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ThriftToHack_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.ThriftToHack_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ThriftToHack_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ThriftToHack_key" (Prelude.Just 0))
+{-# LINE 2139 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ThriftToHack_key =
+     'Angle.TField "to" (Glean.Schema.Fbthrift.Types.Declaration)
+       ('Angle.TField "from" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 2141 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ThriftToHack where
+  type KeyType Glean.Schema.Hack.Types.ThriftToHack =
+       Glean.Schema.Hack.Types.ThriftToHack_key
+  getName _proxy = Glean.PredicateRef "hack.ThriftToHack" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.thriftToHack_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ThriftToHack x k
+  getFactKey = Glean.Schema.Hack.Types.thriftToHack_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2150 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ThriftToHack where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2156 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeInfo_key where
+  buildRtsValue b (Glean.Schema.Hack.Types.TypeInfo_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypeInfo_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypeInfo_key" (Prelude.Just 0))
+{-# LINE 2167 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypeInfo_key =
+     'Angle.TField "displayType"
+       (Glean.KeyType Glean.Schema.Hack.Types.Type)
+       ('Angle.TField "xrefs" ([Glean.Schema.Hack.Types.XRef])
+          ('Angle.TField "hint" (Prelude.Maybe Glean.Schema.Hack.Types.Hint)
+             ('Angle.TNoFields)))
+{-# LINE 2169 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.TypeInfo where
+  type KeyType Glean.Schema.Hack.Types.TypeInfo =
+       Glean.Schema.Hack.Types.TypeInfo_key
+  getName _proxy = Glean.PredicateRef "hack.TypeInfo" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.typeInfo_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TypeInfo x k
+  getFactKey = Glean.Schema.Hack.Types.typeInfo_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2178 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeInfo where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2184 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.InheritedMembers_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.InheritedMembers_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.InheritedMembers_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.InheritedMembers_key" (Prelude.Just 0))
+{-# LINE 2193 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.InheritedMembers_key =
+     'Angle.TField "container"
+       (Glean.Schema.Hack.Types.ContainerDeclaration)
+       ('Angle.TField "inheritedMembers"
+          ([Glean.Schema.Hack.Types.MemberCluster])
+          ('Angle.TNoFields))
+{-# LINE 2195 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.InheritedMembers
+         where
+  type KeyType Glean.Schema.Hack.Types.InheritedMembers =
+       Glean.Schema.Hack.Types.InheritedMembers_key
+  getName _proxy = Glean.PredicateRef "hack.InheritedMembers" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.inheritedMembers_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.InheritedMembers x k
+  getFactKey = Glean.Schema.Hack.Types.inheritedMembers_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2204 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.InheritedMembers where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2210 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ContainerChild_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.ContainerChild_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ContainerChild_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ContainerChild_key" (Prelude.Just 0))
+{-# LINE 2219 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ContainerChild_key =
+     'Angle.TField "container"
+       (Glean.Schema.Hack.Types.ContainerDeclaration)
+       ('Angle.TField "child"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2221 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ContainerChild
+         where
+  type KeyType Glean.Schema.Hack.Types.ContainerChild =
+       Glean.Schema.Hack.Types.ContainerChild_key
+  getName _proxy = Glean.PredicateRef "hack.ContainerChild" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.containerChild_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ContainerChild x k
+  getFactKey = Glean.Schema.Hack.Types.containerChild_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2230 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ContainerChild where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2236 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeConstDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TypeConstDefinition_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypeConstDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypeConstDefinition_key" (Prelude.Just 0))
+{-# LINE 2251 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypeConstDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.TypeConstDeclaration)
+       ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "kind" (Glean.Schema.Hack.Types.TypeConstKind)
+             ('Angle.TField "attributes"
+                ([Glean.Schema.Hack.Types.UserAttribute])
+                ('Angle.TField "typeInfo"
+                   (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                   ('Angle.TNoFields)))))
+{-# LINE 2253 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.TypeConstDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.TypeConstDefinition =
+       Glean.Schema.Hack.Types.TypeConstDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.TypeConstDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.typeConstDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.TypeConstDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.typeConstDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2262 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeConstDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2268 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchEnumByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchEnumByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchEnumByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchEnumByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 2277 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchEnumByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2279 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchEnumByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchEnumByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchEnumByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchEnumByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchEnumByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchEnumByLowerCaseName x k
+  getFactKey = Glean.Schema.Hack.Types.searchEnumByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2288 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchEnumByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2294 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.AttributeHasParameter_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.AttributeHasParameter_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.AttributeHasParameter_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.AttributeHasParameter_key" (Prelude.Just 0))
+{-# LINE 2305 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.AttributeHasParameter_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "parameter" (Data.Text.Text)
+          ('Angle.TField "attribute"
+             (Glean.KeyType Glean.Schema.Hack.Types.UserAttribute)
+             ('Angle.TNoFields)))
+{-# LINE 2307 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.AttributeHasParameter
+         where
+  type KeyType Glean.Schema.Hack.Types.AttributeHasParameter =
+       Glean.Schema.Hack.Types.AttributeHasParameter_key
+  getName _proxy = Glean.PredicateRef "hack.AttributeHasParameter" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.attributeHasParameter_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.AttributeHasParameter x k
+  getFactKey = Glean.Schema.Hack.Types.attributeHasParameter_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2316 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.AttributeHasParameter
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2322 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ContainerParent_key
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.ContainerParent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ContainerParent_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ContainerParent_key" (Prelude.Just 0))
+{-# LINE 2331 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ContainerParent_key =
+     'Angle.TField "container"
+       (Glean.Schema.Hack.Types.ContainerDeclaration)
+       ('Angle.TField "parent"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2333 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.ContainerParent
+         where
+  type KeyType Glean.Schema.Hack.Types.ContainerParent =
+       Glean.Schema.Hack.Types.ContainerParent_key
+  getName _proxy = Glean.PredicateRef "hack.ContainerParent" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.containerParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ContainerParent x k
+  getFactKey = Glean.Schema.Hack.Types.containerParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2342 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ContainerParent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2348 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTypeConstByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 2357 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2359 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName
+       = Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchTypeConstByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Hack.Types.searchTypeConstByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchTypeConstByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2368 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTypeConstByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2374 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchTraitByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTraitByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTraitByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTraitByName_key" (Prelude.Just 0))
+{-# LINE 2385 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchTraitByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 2387 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.SearchTraitByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTraitByName =
+       Glean.Schema.Hack.Types.SearchTraitByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchTraitByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchTraitByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTraitByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchTraitByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2396 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchTraitByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2402 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationComment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.DeclarationComment_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.DeclarationComment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.DeclarationComment_key" (Prelude.Just 0))
+{-# LINE 2413 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.DeclarationComment_key =
+     'Angle.TField "declaration" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 2415 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.DeclarationComment
+         where
+  type KeyType Glean.Schema.Hack.Types.DeclarationComment =
+       Glean.Schema.Hack.Types.DeclarationComment_key
+  getName _proxy = Glean.PredicateRef "hack.DeclarationComment" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.declarationComment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.DeclarationComment x k
+  getFactKey = Glean.Schema.Hack.Types.declarationComment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2424 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.DeclarationComment
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2430 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.AttributeToDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.AttributeToDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.AttributeToDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.AttributeToDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 2441 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.AttributeToDeclaration_key
+     =
+     'Angle.TField "attribute"
+       (Glean.KeyType Glean.Schema.Hack.Types.UserAttribute)
+       ('Angle.TField "declaration" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TNoFields)))
+{-# LINE 2443 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.AttributeToDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.AttributeToDeclaration =
+       Glean.Schema.Hack.Types.AttributeToDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.AttributeToDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.attributeToDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.AttributeToDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.attributeToDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2452 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.AttributeToDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2458 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchModuleByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchModuleByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchModuleByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchModuleByName_key" (Prelude.Just 0))
+{-# LINE 2467 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.SearchModuleByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 2469 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.SearchModuleByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchModuleByName =
+       Glean.Schema.Hack.Types.SearchModuleByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchModuleByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchModuleByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchModuleByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchModuleByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2478 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchModuleByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2484 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Type where
+  type KeyType Glean.Schema.Hack.Types.Type = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hack.Type" 6
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Type x k
+  getFactKey = Glean.Schema.Hack.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2492 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2498 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.ClassConstDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ClassConstDefinition_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ClassConstDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ClassConstDefinition_key" (Prelude.Just 0))
+{-# LINE 2511 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ClassConstDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.ClassConstDeclaration)
+       ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "value" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TField "typeInfo"
+                (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                ('Angle.TNoFields))))
+{-# LINE 2513 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.ClassConstDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.ClassConstDefinition =
+       Glean.Schema.Hack.Types.ClassConstDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.ClassConstDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.classConstDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.ClassConstDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.classConstDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2522 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ClassConstDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2528 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.GlobalConstDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.GlobalConstDefinition_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.GlobalConstDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.GlobalConstDefinition_key" (Prelude.Just 0))
+{-# LINE 2541 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.GlobalConstDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.GlobalConstDeclaration)
+       ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "value" (Data.Text.Text)
+             ('Angle.TField "typeInfo"
+                (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                ('Angle.TNoFields))))
+{-# LINE 2543 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.GlobalConstDefinition
+         where
+  type KeyType Glean.Schema.Hack.Types.GlobalConstDefinition =
+       Glean.Schema.Hack.Types.GlobalConstDefinition_key
+  getName _proxy = Glean.PredicateRef "hack.GlobalConstDefinition" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.globalConstDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.GlobalConstDefinition x k
+  getFactKey = Glean.Schema.Hack.Types.globalConstDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2552 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.GlobalConstDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2558 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchEnumeratorByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchEnumeratorByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchEnumeratorByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchEnumeratorByName_key"
+           (Prelude.Just 0))
+{-# LINE 2569 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchEnumeratorByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Hack.Types.QName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 2571 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchEnumeratorByName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchEnumeratorByName =
+       Glean.Schema.Hack.Types.SearchEnumeratorByName_key
+  getName _proxy = Glean.PredicateRef "hack.SearchEnumeratorByName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchEnumeratorByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchEnumeratorByName x k
+  getFactKey = Glean.Schema.Hack.Types.searchEnumeratorByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2580 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.SearchEnumeratorByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2586 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.PropertyDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.PropertyDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.PropertyDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.PropertyDeclaration_key" (Prelude.Just 0))
+{-# LINE 2595 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.PropertyDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "container"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 2597 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.PropertyDeclaration
+         where
+  type KeyType Glean.Schema.Hack.Types.PropertyDeclaration =
+       Glean.Schema.Hack.Types.PropertyDeclaration_key
+  getName _proxy = Glean.PredicateRef "hack.PropertyDeclaration" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.propertyDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.PropertyDeclaration x k
+  getFactKey = Glean.Schema.Hack.Types.propertyDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2606 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.PropertyDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2612 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.SearchTypedefByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 2621 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 2623 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName
+         where
+  type KeyType Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName =
+       Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "hack.SearchTypedefByLowerCaseName" 6
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hack.Types.searchTypedefByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Hack.Types.searchTypedefByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2632 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Hack.Types.SearchTypedefByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2638 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hack.Types.Context_ where
+  type KeyType Glean.Schema.Hack.Types.Context_ = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hack.Context_" 6
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hack.Types.context__id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hack.Types.Context_ x k
+  getFactKey = Glean.Schema.Hack.Types.context__key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 2646 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Context_ where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 2652 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ShapeKV where
+  buildRtsValue b (Glean.Schema.Hack.Types.ShapeKV x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ShapeKV <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ShapeKV" (Prelude.Just 6))
+{-# LINE 2663 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hack.Types.ShapeKV =
+     'Angle.TField "key" (Glean.Schema.Hack.Types.ShapeKV_key)
+       ('Angle.TField "value" (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+          ('Angle.TField "opt" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 2665 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Occurrence where
+  buildRtsValue b Glean.Schema.Hack.Types.Occurrence_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.Hack.Types.Occurrence_method x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.Occurrence_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.Occurrence_method]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Occurrence" (Prelude.Just 6))
+{-# LINE 2677 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Occurrence =
+     'Angle.TField "method"
+       (Glean.KeyType Glean.Schema.Hack.Types.MethodOccurrence)
+       ('Angle.TNoFields)
+{-# LINE 2679 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ConstraintKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ConstraintKind" (Prelude.Just 6))
+{-# LINE 2684 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Hack.Types.ConstraintKind =
+     'Angle.TField "As" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Equal" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Super" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2686 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.ConstraintKind
+         where
+  type AngleEnumTy Glean.Schema.Hack.Types.ConstraintKind =
+       Glean.Schema.Hack.Types.ConstraintKind
+  enumName v = Text.pack (Prelude.drop 15 (Prelude.show v))
+{-# LINE 2690 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeConstKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypeConstKind" (Prelude.Just 6))
+{-# LINE 2695 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.TypeConstKind
+     =
+     'Angle.TField "Abstract" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Concrete" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "PartiallyAbstract"
+             (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2697 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.TypeConstKind
+         where
+  type AngleEnumTy Glean.Schema.Hack.Types.TypeConstKind =
+       Glean.Schema.Hack.Types.TypeConstKind
+  enumName v = Text.pack (Prelude.drop 14 (Prelude.show v))
+{-# LINE 2701 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.FieldClassConst where
+  buildRtsValue b (Glean.Schema.Hack.Types.FieldClassConst x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.FieldClassConst <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.FieldClassConst" (Prelude.Just 6))
+{-# LINE 2710 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.FieldClassConst =
+     'Angle.TField "container"
+       (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 2712 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.CallArgument where
+  buildRtsValue b (Glean.Schema.Hack.Types.CallArgument x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.CallArgument <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.CallArgument" (Prelude.Just 6))
+{-# LINE 2721 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.CallArgument =
+     'Angle.TField "span" (Glean.Schema.Src.Types.RelByteSpan)
+       ('Angle.TField "argument"
+          (Prelude.Maybe Glean.Schema.Hack.Types.Argument)
+          ('Angle.TNoFields))
+{-# LINE 2723 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Constraint where
+  buildRtsValue b (Glean.Schema.Hack.Types.Constraint x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Constraint <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Constraint" (Prelude.Just 6))
+{-# LINE 2734 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hack.Types.Constraint
+     =
+     'Angle.TField "constraintKind"
+       (Glean.Schema.Hack.Types.ConstraintKind)
+       ('Angle.TField "type" (Glean.KeyType Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "typeInfo"
+             (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+             ('Angle.TNoFields)))
+{-# LINE 2736 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Definition where
+  buildRtsValue b Glean.Schema.Hack.Types.Definition_EMPTY
+    = Glean.buildRtsSelector b 12
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_class_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_classConst x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_enum_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_function_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_globalConst x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_interface_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_trait x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_method x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_property_ x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_typeConst x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_typedef_ x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Definition_module x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.Definition_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.Definition_class_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_classConst,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_enum_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_function_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_globalConst,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_interface_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_trait,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_method,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_property_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_typeConst,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_typedef_,
+         Glean.mapD Glean.Schema.Hack.Types.Definition_module]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Definition" (Prelude.Just 6))
+{-# LINE 2792 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Definition =
+     'Angle.TField "class_"
+       (Glean.KeyType Glean.Schema.Hack.Types.ClassDefinition)
+       ('Angle.TField "classConst"
+          (Glean.KeyType Glean.Schema.Hack.Types.ClassConstDefinition)
+          ('Angle.TField "enum_"
+             (Glean.KeyType Glean.Schema.Hack.Types.EnumDefinition)
+             ('Angle.TField "function_"
+                (Glean.KeyType Glean.Schema.Hack.Types.FunctionDefinition)
+                ('Angle.TField "globalConst"
+                   (Glean.KeyType Glean.Schema.Hack.Types.GlobalConstDefinition)
+                   ('Angle.TField "interface_"
+                      (Glean.KeyType Glean.Schema.Hack.Types.InterfaceDefinition)
+                      ('Angle.TField "trait"
+                         (Glean.KeyType Glean.Schema.Hack.Types.TraitDefinition)
+                         ('Angle.TField "method"
+                            (Glean.KeyType Glean.Schema.Hack.Types.MethodDefinition)
+                            ('Angle.TField "property_"
+                               (Glean.KeyType Glean.Schema.Hack.Types.PropertyDefinition)
+                               ('Angle.TField "typeConst"
+                                  (Glean.KeyType Glean.Schema.Hack.Types.TypeConstDefinition)
+                                  ('Angle.TField "typedef_"
+                                     (Glean.KeyType Glean.Schema.Hack.Types.TypedefDefinition)
+                                     ('Angle.TField "module"
+                                        (Glean.KeyType Glean.Schema.Hack.Types.ModuleDefinition)
+                                        ('Angle.TNoFields))))))))))))
+{-# LINE 2794 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ReifyKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ReifyKind" (Prelude.Just 6))
+{-# LINE 2799 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.ReifyKind =
+     'Angle.TField "Erased" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Reified" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "SoftReified" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2801 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.ReifyKind where
+  type AngleEnumTy Glean.Schema.Hack.Types.ReifyKind =
+       Glean.Schema.Hack.Types.ReifyKind
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
+{-# LINE 2805 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.XRef where
+  buildRtsValue b (Glean.Schema.Hack.Types.XRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.XRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hack.XRef" (Prelude.Just 6))
+{-# LINE 2814 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hack.Types.XRef =
+     'Angle.TField "target" (Glean.Schema.Hack.Types.XRefTarget)
+       ('Angle.TField "ranges" ([Glean.Schema.Src.Types.RelByteSpan])
+          ('Angle.TNoFields))
+{-# LINE 2816 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Parameter where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.Parameter x1 x2 x3 x4 x5 x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Parameter <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Parameter" (Prelude.Just 6))
+{-# LINE 2837 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hack.Types.Parameter
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "type" (Prelude.Maybe Glean.Schema.Hack.Types.Type)
+          ('Angle.TField "isInout" (Prelude.Bool)
+             ('Angle.TField "isVariadic" (Prelude.Bool)
+                ('Angle.TField "defaultValue" (Prelude.Maybe Data.Text.Text)
+                   ('Angle.TField "attributes"
+                      ([Glean.Schema.Hack.Types.UserAttribute])
+                      ('Angle.TField "typeInfo"
+                         (Prelude.Maybe Glean.Schema.Hack.Types.TypeInfo)
+                         ('Angle.TField "readonly"
+                            (Prelude.Maybe Glean.Schema.Hack.Types.ReadonlyKind)
+                            ('Angle.TNoFields))))))))
+{-# LINE 2839 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ModuleMembership where
+  buildRtsValue b (Glean.Schema.Hack.Types.ModuleMembership x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.ModuleMembership <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ModuleMembership" (Prelude.Just 6))
+{-# LINE 2848 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.ModuleMembership =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Hack.Types.ModuleDeclaration)
+       ('Angle.TField "internal" (Prelude.Bool) ('Angle.TNoFields))
+{-# LINE 2850 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ReadonlyKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ReadonlyKind" (Prelude.Just 6))
+{-# LINE 2855 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.ReadonlyKind
+     =
+     'Angle.TField "Readonly" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TNoFields)
+{-# LINE 2857 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.ReadonlyKind where
+  type AngleEnumTy Glean.Schema.Hack.Types.ReadonlyKind =
+       Glean.Schema.Hack.Types.ReadonlyKind
+  enumName v = Text.pack (Prelude.drop 13 (Prelude.show v))
+{-# LINE 2861 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.XRefTarget where
+  buildRtsValue b Glean.Schema.Hack.Types.XRefTarget_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Hack.Types.XRefTarget_declaration x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.XRefTarget_occurrence x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.XRefTarget_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.XRefTarget_declaration,
+         Glean.mapD Glean.Schema.Hack.Types.XRefTarget_occurrence]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.XRefTarget" (Prelude.Just 6))
+{-# LINE 2877 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.XRefTarget =
+     'Angle.TField "declaration" (Glean.Schema.Hack.Types.Declaration)
+       ('Angle.TField "occurrence" (Glean.Schema.Hack.Types.Occurrence)
+          ('Angle.TNoFields))
+{-# LINE 2879 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.TypeParameter where
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.TypeParameter x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.TypeParameter <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.TypeParameter" (Prelude.Just 6))
+{-# LINE 2894 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.TypeParameter =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "variance" (Glean.Schema.Hack.Types.Variance)
+          ('Angle.TField "reifyKind" (Glean.Schema.Hack.Types.ReifyKind)
+             ('Angle.TField "constraints" ([Glean.Schema.Hack.Types.Constraint])
+                ('Angle.TField "attributes"
+                   ([Glean.Schema.Hack.Types.UserAttribute])
+                   ('Angle.TNoFields)))))
+{-# LINE 2896 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ContainerDeclaration
+         where
+  buildRtsValue b Glean.Schema.Hack.Types.ContainerDeclaration_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ContainerDeclaration_class_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ContainerDeclaration_enum_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ContainerDeclaration_interface_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ContainerDeclaration_trait x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.ContainerDeclaration_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.ContainerDeclaration_class_,
+         Glean.mapD Glean.Schema.Hack.Types.ContainerDeclaration_enum_,
+         Glean.mapD Glean.Schema.Hack.Types.ContainerDeclaration_interface_,
+         Glean.mapD Glean.Schema.Hack.Types.ContainerDeclaration_trait]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ContainerDeclaration" (Prelude.Just 6))
+{-# LINE 2920 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Hack.Types.ContainerDeclaration =
+     'Angle.TField "class_"
+       (Glean.KeyType Glean.Schema.Hack.Types.ClassDeclaration)
+       ('Angle.TField "enum_"
+          (Glean.KeyType Glean.Schema.Hack.Types.EnumDeclaration)
+          ('Angle.TField "interface_"
+             (Glean.KeyType Glean.Schema.Hack.Types.InterfaceDeclaration)
+             ('Angle.TField "trait"
+                (Glean.KeyType Glean.Schema.Hack.Types.TraitDeclaration)
+                ('Angle.TNoFields))))
+{-# LINE 2922 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Argument where
+  buildRtsValue b Glean.Schema.Hack.Types.Argument_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Hack.Types.Argument_lit x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Argument_xref x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hack.Types.Argument_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.Argument_lit,
+         Glean.mapD Glean.Schema.Hack.Types.Argument_xref]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Argument" (Prelude.Just 6))
+{-# LINE 2938 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Argument =
+     'Angle.TField "lit"
+       (Glean.KeyType Glean.Schema.Hack.Types.StringLiteral)
+       ('Angle.TField "xref" (Glean.Schema.Hack.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 2940 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Variance where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Variance" (Prelude.Just 6))
+{-# LINE 2945 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Variance =
+     'Angle.TField "Contravariant" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Covariant" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Invariant" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 2947 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.Variance where
+  type AngleEnumTy Glean.Schema.Hack.Types.Variance =
+       Glean.Schema.Hack.Types.Variance
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 2951 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Visibility where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Visibility" (Prelude.Just 6))
+{-# LINE 2956 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Visibility =
+     'Angle.TField "Private" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Protected" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Public" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Internal" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 2958 "glean/schema/thrift/hack_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hack.Types.Visibility where
+  type AngleEnumTy Glean.Schema.Hack.Types.Visibility =
+       Glean.Schema.Hack.Types.Visibility
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 2962 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Declaration where
+  buildRtsValue b Glean.Schema.Hack.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 11
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_classConst x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_container x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_enumerator x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_function_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_globalConst x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_namespace_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_method x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_property_ x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_typeConst x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_typedef_ x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hack.Types.Declaration_module x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.Declaration_classConst,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_container,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_enumerator,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_function_,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_globalConst,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_namespace_,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_method,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_property_,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_typeConst,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_typedef_,
+         Glean.mapD Glean.Schema.Hack.Types.Declaration_module]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Declaration" (Prelude.Just 6))
+{-# LINE 3014 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.Declaration =
+     'Angle.TField "classConst"
+       (Glean.KeyType Glean.Schema.Hack.Types.ClassConstDeclaration)
+       ('Angle.TField "container"
+          (Glean.Schema.Hack.Types.ContainerDeclaration)
+          ('Angle.TField "enumerator"
+             (Glean.KeyType Glean.Schema.Hack.Types.Enumerator)
+             ('Angle.TField "function_"
+                (Glean.KeyType Glean.Schema.Hack.Types.FunctionDeclaration)
+                ('Angle.TField "globalConst"
+                   (Glean.KeyType Glean.Schema.Hack.Types.GlobalConstDeclaration)
+                   ('Angle.TField "namespace_"
+                      (Glean.KeyType Glean.Schema.Hack.Types.NamespaceDeclaration)
+                      ('Angle.TField "method"
+                         (Glean.KeyType Glean.Schema.Hack.Types.MethodDeclaration)
+                         ('Angle.TField "property_"
+                            (Glean.KeyType Glean.Schema.Hack.Types.PropertyDeclaration)
+                            ('Angle.TField "typeConst"
+                               (Glean.KeyType Glean.Schema.Hack.Types.TypeConstDeclaration)
+                               ('Angle.TField "typedef_"
+                                  (Glean.KeyType Glean.Schema.Hack.Types.TypedefDeclaration)
+                                  ('Angle.TField "module"
+                                     (Glean.KeyType Glean.Schema.Hack.Types.ModuleDeclaration)
+                                     ('Angle.TNoFields)))))))))))
+{-# LINE 3016 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint_apply_ where
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_apply_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Hint_apply_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Hint_apply_" (Prelude.Just 0))
+{-# LINE 3025 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Hint_apply_ =
+     'Angle.TField "class_name"
+       (Glean.KeyType Glean.Schema.Hack.Types.QName)
+       ('Angle.TField "values" ([Glean.Schema.Hack.Types.Hint])
+          ('Angle.TNoFields))
+{-# LINE 3027 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint_tuple_ where
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_tuple_ x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Hint_tuple_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Hint_tuple_" (Prelude.Just 0))
+{-# LINE 3038 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Hint_tuple_ =
+     'Angle.TField "req" ([Glean.Schema.Hack.Types.Hint])
+       ('Angle.TField "opt" ([Glean.Schema.Hack.Types.Hint])
+          ('Angle.TField "variadic"
+             (Prelude.Maybe Glean.Schema.Hack.Types.Hint)
+             ('Angle.TNoFields)))
+{-# LINE 3040 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint_shape_ where
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_shape_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Hint_shape_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Hint_shape_" (Prelude.Just 0))
+{-# LINE 3049 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Hint_shape_ =
+     'Angle.TField "open_" (Prelude.Bool)
+       ('Angle.TField "map_" ([Glean.Schema.Hack.Types.ShapeKV])
+          ('Angle.TNoFields))
+{-# LINE 3051 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.Hint_vect_or_dict_
+         where
+  buildRtsValue b (Glean.Schema.Hack.Types.Hint_vect_or_dict_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hack.Types.Hint_vect_or_dict_ <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.Hint_vect_or_dict_" (Prelude.Just 0))
+{-# LINE 3060 "glean/schema/thrift/hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hack.Types.Hint_vect_or_dict_ =
+     'Angle.TField "maybe_key"
+       (Prelude.Maybe Glean.Schema.Hack.Types.Hint)
+       ('Angle.TField "value_"
+          (Glean.KeyType Glean.Schema.Hack.Types.Hint)
+          ('Angle.TNoFields))
+{-# LINE 3062 "glean/schema/thrift/hack_include.hs" #-}
+instance Glean.Type Glean.Schema.Hack.Types.ShapeKV_key where
+  buildRtsValue b Glean.Schema.Hack.Types.ShapeKV_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ShapeKV_key_sf_regex_group x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ShapeKV_key_sf_lit_string x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hack.Types.ShapeKV_key_sf_class_const x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hack.Types.ShapeKV_key_EMPTY)
+        [Glean.mapD Glean.Schema.Hack.Types.ShapeKV_key_sf_regex_group,
+         Glean.mapD Glean.Schema.Hack.Types.ShapeKV_key_sf_lit_string,
+         Glean.mapD Glean.Schema.Hack.Types.ShapeKV_key_sf_class_const]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hack.ShapeKV_key" (Prelude.Just 0))
+{-# LINE 3082 "glean/schema/thrift/hack_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hack.Types.ShapeKV_key =
+     'Angle.TField "sf_regex_group" (Data.Text.Text)
+       ('Angle.TField "sf_lit_string" (Data.Text.Text)
+          ('Angle.TField "sf_class_const"
+             (Glean.Schema.Hack.Types.FieldClassConst)
+             ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Hs/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Hs/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Hs/Types.hs
@@ -0,0 +1,8066 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/hs_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/hs_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/hs_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Hs/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Hs.Types
+       (pREDICATE_VERSIONS, ValBind_id,
+        ValBind(ValBind, valBind_id, valBind_key), UnitName_id,
+        UnitName(UnitName, unitName_id, unitName_key), TypeSynDecl_id,
+        TypeSynDecl(TypeSynDecl, typeSynDecl_id, typeSynDecl_key),
+        TypeFamilyDecl_id,
+        TypeFamilyDecl(TypeFamilyDecl, typeFamilyDecl_id,
+                       typeFamilyDecl_key),
+        TyVarBind_id, TyVarBind(TyVarBind, tyVarBind_id, tyVarBind_key),
+        TyCon_id, TyCon(TyCon, tyCon_id, tyCon_key), SourceModule_id,
+        SourceModule(SourceModule, sourceModule_id, sourceModule_key),
+        SigDecl_id, SigDecl(SigDecl, sigDecl_id, sigDecl_key), XRef_id,
+        XRef(XRef, xRef_id, xRef_key), RecordFieldDecl_id,
+        RecordFieldDecl(RecordFieldDecl, recordFieldDecl_id,
+                        recordFieldDecl_key),
+        PatSynDecl_id,
+        PatSynDecl(PatSynDecl, patSynDecl_id, patSynDecl_key), PatBind_id,
+        PatBind(PatBind, patBind_id, patBind_key), OccNameLowerCase_id,
+        OccNameLowerCase(OccNameLowerCase, occNameLowerCase_id,
+                         occNameLowerCase_key),
+        OccName_id, OccName(OccName, occName_id, occName_key), Name_id,
+        Name(Name, name_id, name_key), ModuleSource_id,
+        ModuleSource(ModuleSource, moduleSource_id, moduleSource_key),
+        ModuleName_id,
+        ModuleName(ModuleName, moduleName_id, moduleName_key),
+        ModuleDeclarations_id,
+        ModuleDeclarations(ModuleDeclarations, moduleDeclarations_id,
+                           moduleDeclarations_key),
+        Module_id, Module(Module, module_id, module_key), MethDecl_id,
+        MethDecl(MethDecl, methDecl_id, methDecl_key), LitType_id,
+        LitType(LitType, litType_id, litType_key), InstanceBindToDecl_id,
+        InstanceBindToDecl(InstanceBindToDecl, instanceBindToDecl_id,
+                           instanceBindToDecl_key),
+        InstanceBind_id,
+        InstanceBind(InstanceBind, instanceBind_id, instanceBind_key),
+        InstDecl_id, InstDecl(InstDecl, instDecl_id, instDecl_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationOfName_id,
+        DeclarationOfName(DeclarationOfName, declarationOfName_id,
+                          declarationOfName_key),
+        DeclarationSpan_id,
+        DeclarationSpan(DeclarationSpan, declarationSpan_id,
+                        declarationSpan_key),
+        DataDecl_id, DataDecl(DataDecl, dataDecl_id, dataDecl_key),
+        ConstrDecl_id,
+        ConstrDecl(ConstrDecl, constrDecl_id, constrDecl_key),
+        ClassDecl_id, ClassDecl(ClassDecl, classDecl_id, classDecl_key),
+        Type_id, Type(Type, type_id, type_key),
+        ValBind_key(ValBind_key, valBind_key_name, valBind_key_ty,
+                    valBind_key_sig),
+        TypeSynDecl_key(TypeSynDecl_key, typeSynDecl_key_name),
+        TypeFamilyDecl_key(TypeFamilyDecl_key, typeFamilyDecl_key_name),
+        TypeArg(TypeArg, typeArg_visible, typeArg_ty),
+        TyVarBind_key(TyVarBind_key, tyVarBind_key_name), TyVar,
+        TupleSort(TupleSort_boxed, TupleSort_unboxed, TupleSort_constraint,
+                  TupleSort__UNKNOWN),
+        TyConSort_tuple_(TyConSort_tuple_, tyConSort_tuple__arity,
+                         tyConSort_tuple__sort),
+        TyConSort_sum_(TyConSort_sum_, tyConSort_sum__arity),
+        TyConSort(TyConSort_EMPTY, TyConSort_normal, TyConSort_tuple,
+                  TyConSort_sum, TyConSort_equality),
+        TyCon_key(TyCon_key, tyCon_key_name, tyCon_key_sort,
+                  tyCon_key_promoted),
+        Specificity(Specificity_inferred, Specificity_specified,
+                    Specificity__UNKNOWN),
+        SourceModule_key(SourceModule_key, sourceModule_key_file,
+                         sourceModule_key_mod),
+        SigDecl_key(SigDecl_key, sigDecl_key_name, sigDecl_key_loc),
+        RefTarget(RefTarget_EMPTY, RefTarget_name, RefTarget_modName),
+        RefKind(RefKind_importref, RefKind_exportref, RefKind_coderef,
+                RefKind_tydecl, RefKind_instbind, RefKind__UNKNOWN),
+        RefSpan(RefSpan, refSpan_kind, refSpan_span),
+        XRef_key(XRef_key, xRef_key_target, xRef_key_file, xRef_key_refs),
+        RecordFieldDecl_key(RecordFieldDecl_key, recordFieldDecl_key_name,
+                            recordFieldDecl_key_con),
+        PatSynDecl_key(PatSynDecl_key, patSynDecl_key_name),
+        PatBind_key(PatBind_key, patBind_key_name, patBind_key_ty),
+        OccNameLowerCase_key(OccNameLowerCase_key,
+                             occNameLowerCase_key_nameLowerCase, occNameLowerCase_key_occName),
+        Namespace(Namespace_var_, Namespace_datacon, Namespace_tyvar,
+                  Namespace_tycon, Namespace__UNKNOWN),
+        OccName_key(OccName_key, occName_key_name, occName_key_namespace_),
+        NameSort(NameSort_EMPTY, NameSort_external, NameSort_internal),
+        Name_key(Name_key, name_key_occ, name_key_mod, name_key_sort),
+        ModuleSource_key(ModuleSource_key, moduleSource_key_mod,
+                         moduleSource_key_file),
+        ModuleDeclarations_key(ModuleDeclarations_key,
+                               moduleDeclarations_key_module, moduleDeclarations_key_names,
+                               moduleDeclarations_key_exports),
+        Module_key(Module_key, module_key_name, module_key_unit),
+        MethDecl_key(MethDecl_key, methDecl_key_name, methDecl_key_class_),
+        LitType_key(LitType_key_EMPTY, LitType_key_num, LitType_key_str,
+                    LitType_key_chr),
+        InstanceBindToDecl_decl(InstanceBindToDecl_decl_EMPTY,
+                                InstanceBindToDecl_decl_inst, InstanceBindToDecl_decl_class_),
+        InstanceBindToDecl_key(InstanceBindToDecl_key,
+                               instanceBindToDecl_key_bind, instanceBindToDecl_key_decl),
+        InstanceBind_key(InstanceBind_key, instanceBind_key_name,
+                         instanceBind_key_loc),
+        InstDecl_key(InstDecl_key, instDecl_key_methods, instDecl_key_loc),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_name, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        Declaration(Declaration_EMPTY, Declaration_val,
+                    Declaration_typeFamily, Declaration_type_, Declaration_data,
+                    Declaration_con, Declaration_patSyn, Declaration_class_,
+                    Declaration_method, Declaration_instance, Declaration_patBind,
+                    Declaration_tyVarBind, Declaration_field, Declaration_sig),
+        DeclarationOfName_key(DeclarationOfName_key,
+                              declarationOfName_key_name, declarationOfName_key_decl),
+        DeclarationSpan_key(DeclarationSpan_key, declarationSpan_key_decl,
+                            declarationSpan_key_loc),
+        DataDecl_key(DataDecl_key, dataDecl_key_name,
+                     dataDecl_key_constrs),
+        ConstrDecl_key(ConstrDecl_key, constrDecl_key_name,
+                       constrDecl_key_data_, constrDecl_key_fields),
+        ClassDecl_key(ClassDecl_key, classDecl_key_name,
+                      classDecl_key_methods, classDecl_key_defaults),
+        ArgFlag(ArgFlag_EMPTY, ArgFlag_invisible, ArgFlag_requird),
+        Type_app_(Type_app_, type_app__fun, type_app__args_),
+        Type_tyconapp_(Type_tyconapp_, type_tyconapp__tycon,
+                       type_tyconapp__args_),
+        Type_forall_(Type_forall_, type_forall__name, type_forall__kind,
+                     type_forall__flag, type_forall__inner),
+        Type_fun_(Type_fun_, type_fun__mult, type_fun__arg, type_fun__res),
+        Type_qual_(Type_qual_, type_qual__pred, type_qual__res),
+        Type_key(Type_key_EMPTY, Type_key_tyvar, Type_key_app,
+                 Type_key_tyconapp, Type_key_forall, Type_key_fun, Type_key_qual,
+                 Type_key_lit, Type_key_cast, Type_key_coercion))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/hs_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 210 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Hs/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("TyCon", 3), ("InstanceBindToDecl", 3), ("Type", 3),
+       ("ModuleSource", 3), ("ModuleName", 3), ("TypeFamilyDecl", 3),
+       ("MethDecl", 3), ("TyVarBind", 3), ("InstanceBind", 3),
+       ("LitType", 3), ("ClassDecl", 3), ("ConstrDecl", 3), ("Name", 3),
+       ("OccName", 3), ("ModuleDeclarations", 3), ("SourceModule", 3),
+       ("DeclarationLocation", 3), ("TypeSynDecl", 3), ("SigDecl", 3),
+       ("DeclarationOfName", 3), ("DeclarationSpan", 3), ("InstDecl", 3),
+       ("XRef", 3), ("ValBind", 3), ("RecordFieldDecl", 3),
+       ("PatBind", 3), ("DataDecl", 3), ("UnitName", 3), ("FileXRefs", 3),
+       ("OccNameLowerCase", 3), ("Module", 3), ("PatSynDecl", 3)]
+
+type ValBind_id = Glean.Id
+
+data ValBind = ValBind{valBind_id :: {-# UNPACK #-} !ValBind_id,
+                       valBind_key :: Prelude.Maybe ValBind_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ValBind where
+  toJSON (ValBind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ValBind where
+  buildStruct _proxy (ValBind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ValBind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ValBind where
+  rnf (ValBind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ValBind where
+  def = ValBind Default.def Prelude.Nothing
+
+instance Hashable.Hashable ValBind where
+  hashWithSalt __salt (ValBind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type UnitName_id = Glean.Id
+
+data UnitName = UnitName{unitName_id ::
+                         {-# UNPACK #-} !UnitName_id,
+                         unitName_key :: Prelude.Maybe Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnitName where
+  toJSON (UnitName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct UnitName where
+  buildStruct _proxy (UnitName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (UnitName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData UnitName where
+  rnf (UnitName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default UnitName where
+  def = UnitName Default.def Prelude.Nothing
+
+instance Hashable.Hashable UnitName where
+  hashWithSalt __salt (UnitName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeSynDecl_id = Glean.Id
+
+data TypeSynDecl = TypeSynDecl{typeSynDecl_id ::
+                               {-# UNPACK #-} !TypeSynDecl_id,
+                               typeSynDecl_key :: Prelude.Maybe TypeSynDecl_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeSynDecl where
+  toJSON (TypeSynDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeSynDecl where
+  buildStruct _proxy (TypeSynDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeSynDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeSynDecl where
+  rnf (TypeSynDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeSynDecl where
+  def = TypeSynDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeSynDecl where
+  hashWithSalt __salt (TypeSynDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeFamilyDecl_id = Glean.Id
+
+data TypeFamilyDecl = TypeFamilyDecl{typeFamilyDecl_id ::
+                                     {-# UNPACK #-} !TypeFamilyDecl_id,
+                                     typeFamilyDecl_key :: Prelude.Maybe TypeFamilyDecl_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeFamilyDecl where
+  toJSON (TypeFamilyDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeFamilyDecl where
+  buildStruct _proxy (TypeFamilyDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeFamilyDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeFamilyDecl where
+  rnf (TypeFamilyDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeFamilyDecl where
+  def = TypeFamilyDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeFamilyDecl where
+  hashWithSalt __salt (TypeFamilyDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TyVarBind_id = Glean.Id
+
+data TyVarBind = TyVarBind{tyVarBind_id ::
+                           {-# UNPACK #-} !TyVarBind_id,
+                           tyVarBind_key :: Prelude.Maybe TyVarBind_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyVarBind where
+  toJSON (TyVarBind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TyVarBind where
+  buildStruct _proxy (TyVarBind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TyVarBind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TyVarBind where
+  rnf (TyVarBind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TyVarBind where
+  def = TyVarBind Default.def Prelude.Nothing
+
+instance Hashable.Hashable TyVarBind where
+  hashWithSalt __salt (TyVarBind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TyCon_id = Glean.Id
+
+data TyCon = TyCon{tyCon_id :: {-# UNPACK #-} !TyCon_id,
+                   tyCon_key :: Prelude.Maybe TyCon_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyCon where
+  toJSON (TyCon __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TyCon where
+  buildStruct _proxy (TyCon __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TyCon __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TyCon where
+  rnf (TyCon __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TyCon where
+  def = TyCon Default.def Prelude.Nothing
+
+instance Hashable.Hashable TyCon where
+  hashWithSalt __salt (TyCon _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SourceModule_id = Glean.Id
+
+data SourceModule = SourceModule{sourceModule_id ::
+                                 {-# UNPACK #-} !SourceModule_id,
+                                 sourceModule_key :: Prelude.Maybe SourceModule_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceModule where
+  toJSON (SourceModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceModule where
+  buildStruct _proxy (SourceModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SourceModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceModule where
+  rnf (SourceModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SourceModule where
+  def = SourceModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable SourceModule where
+  hashWithSalt __salt (SourceModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SigDecl_id = Glean.Id
+
+data SigDecl = SigDecl{sigDecl_id :: {-# UNPACK #-} !SigDecl_id,
+                       sigDecl_key :: Prelude.Maybe SigDecl_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SigDecl where
+  toJSON (SigDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SigDecl where
+  buildStruct _proxy (SigDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SigDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SigDecl where
+  rnf (SigDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SigDecl where
+  def = SigDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable SigDecl where
+  hashWithSalt __salt (SigDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRef_id = Glean.Id
+
+data XRef = XRef{xRef_id :: {-# UNPACK #-} !XRef_id,
+                 xRef_key :: Prelude.Maybe XRef_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RecordFieldDecl_id = Glean.Id
+
+data RecordFieldDecl = RecordFieldDecl{recordFieldDecl_id ::
+                                       {-# UNPACK #-} !RecordFieldDecl_id,
+                                       recordFieldDecl_key :: Prelude.Maybe RecordFieldDecl_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordFieldDecl where
+  toJSON (RecordFieldDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordFieldDecl where
+  buildStruct _proxy (RecordFieldDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RecordFieldDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordFieldDecl where
+  rnf (RecordFieldDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RecordFieldDecl where
+  def = RecordFieldDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable RecordFieldDecl where
+  hashWithSalt __salt (RecordFieldDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PatSynDecl_id = Glean.Id
+
+data PatSynDecl = PatSynDecl{patSynDecl_id ::
+                             {-# UNPACK #-} !PatSynDecl_id,
+                             patSynDecl_key :: Prelude.Maybe PatSynDecl_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PatSynDecl where
+  toJSON (PatSynDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PatSynDecl where
+  buildStruct _proxy (PatSynDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PatSynDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PatSynDecl where
+  rnf (PatSynDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PatSynDecl where
+  def = PatSynDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable PatSynDecl where
+  hashWithSalt __salt (PatSynDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PatBind_id = Glean.Id
+
+data PatBind = PatBind{patBind_id :: {-# UNPACK #-} !PatBind_id,
+                       patBind_key :: Prelude.Maybe PatBind_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PatBind where
+  toJSON (PatBind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PatBind where
+  buildStruct _proxy (PatBind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PatBind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PatBind where
+  rnf (PatBind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PatBind where
+  def = PatBind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PatBind where
+  hashWithSalt __salt (PatBind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type OccNameLowerCase_id = Glean.Id
+
+data OccNameLowerCase = OccNameLowerCase{occNameLowerCase_id ::
+                                         {-# UNPACK #-} !OccNameLowerCase_id,
+                                         occNameLowerCase_key :: Prelude.Maybe OccNameLowerCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OccNameLowerCase where
+  toJSON (OccNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct OccNameLowerCase where
+  buildStruct _proxy (OccNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (OccNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OccNameLowerCase where
+  rnf (OccNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default OccNameLowerCase where
+  def = OccNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable OccNameLowerCase where
+  hashWithSalt __salt (OccNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type OccName_id = Glean.Id
+
+data OccName = OccName{occName_id :: {-# UNPACK #-} !OccName_id,
+                       occName_key :: Prelude.Maybe OccName_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OccName where
+  toJSON (OccName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct OccName where
+  buildStruct _proxy (OccName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (OccName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OccName where
+  rnf (OccName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default OccName where
+  def = OccName Default.def Prelude.Nothing
+
+instance Hashable.Hashable OccName where
+  hashWithSalt __salt (OccName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Name_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleSource_id = Glean.Id
+
+data ModuleSource = ModuleSource{moduleSource_id ::
+                                 {-# UNPACK #-} !ModuleSource_id,
+                                 moduleSource_key :: Prelude.Maybe ModuleSource_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleSource where
+  toJSON (ModuleSource __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleSource where
+  buildStruct _proxy (ModuleSource __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleSource __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleSource where
+  rnf (ModuleSource __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleSource where
+  def = ModuleSource Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleSource where
+  hashWithSalt __salt (ModuleSource _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleName_id = Glean.Id
+
+data ModuleName = ModuleName{moduleName_id ::
+                             {-# UNPACK #-} !ModuleName_id,
+                             moduleName_key :: Prelude.Maybe Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleName where
+  toJSON (ModuleName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleName where
+  buildStruct _proxy (ModuleName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleName where
+  rnf (ModuleName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleName where
+  def = ModuleName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleName where
+  hashWithSalt __salt (ModuleName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleDeclarations_id = Glean.Id
+
+data ModuleDeclarations = ModuleDeclarations{moduleDeclarations_id
+                                             :: {-# UNPACK #-} !ModuleDeclarations_id,
+                                             moduleDeclarations_key ::
+                                             Prelude.Maybe ModuleDeclarations_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDeclarations where
+  toJSON (ModuleDeclarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDeclarations where
+  buildStruct _proxy (ModuleDeclarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleDeclarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDeclarations where
+  rnf (ModuleDeclarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleDeclarations where
+  def = ModuleDeclarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleDeclarations where
+  hashWithSalt __salt (ModuleDeclarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Module_id = Glean.Id
+
+data Module = Module{module_id :: {-# UNPACK #-} !Module_id,
+                     module_key :: Prelude.Maybe Module_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module where
+  toJSON (Module __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Module where
+  buildStruct _proxy (Module __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Module __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Module where
+  rnf (Module __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Module where
+  def = Module Default.def Prelude.Nothing
+
+instance Hashable.Hashable Module where
+  hashWithSalt __salt (Module _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethDecl_id = Glean.Id
+
+data MethDecl = MethDecl{methDecl_id ::
+                         {-# UNPACK #-} !MethDecl_id,
+                         methDecl_key :: Prelude.Maybe MethDecl_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethDecl where
+  toJSON (MethDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethDecl where
+  buildStruct _proxy (MethDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethDecl where
+  rnf (MethDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethDecl where
+  def = MethDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethDecl where
+  hashWithSalt __salt (MethDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LitType_id = Glean.Id
+
+data LitType = LitType{litType_id :: {-# UNPACK #-} !LitType_id,
+                       litType_key :: Prelude.Maybe LitType_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LitType where
+  toJSON (LitType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LitType where
+  buildStruct _proxy (LitType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LitType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LitType where
+  rnf (LitType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LitType where
+  def = LitType Default.def Prelude.Nothing
+
+instance Hashable.Hashable LitType where
+  hashWithSalt __salt (LitType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InstanceBindToDecl_id = Glean.Id
+
+data InstanceBindToDecl = InstanceBindToDecl{instanceBindToDecl_id
+                                             :: {-# UNPACK #-} !InstanceBindToDecl_id,
+                                             instanceBindToDecl_key ::
+                                             Prelude.Maybe InstanceBindToDecl_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstanceBindToDecl where
+  toJSON (InstanceBindToDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InstanceBindToDecl where
+  buildStruct _proxy (InstanceBindToDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InstanceBindToDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstanceBindToDecl where
+  rnf (InstanceBindToDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InstanceBindToDecl where
+  def = InstanceBindToDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable InstanceBindToDecl where
+  hashWithSalt __salt (InstanceBindToDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InstanceBind_id = Glean.Id
+
+data InstanceBind = InstanceBind{instanceBind_id ::
+                                 {-# UNPACK #-} !InstanceBind_id,
+                                 instanceBind_key :: Prelude.Maybe InstanceBind_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstanceBind where
+  toJSON (InstanceBind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InstanceBind where
+  buildStruct _proxy (InstanceBind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InstanceBind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstanceBind where
+  rnf (InstanceBind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InstanceBind where
+  def = InstanceBind Default.def Prelude.Nothing
+
+instance Hashable.Hashable InstanceBind where
+  hashWithSalt __salt (InstanceBind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InstDecl_id = Glean.Id
+
+data InstDecl = InstDecl{instDecl_id ::
+                         {-# UNPACK #-} !InstDecl_id,
+                         instDecl_key :: Prelude.Maybe InstDecl_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstDecl where
+  toJSON (InstDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InstDecl where
+  buildStruct _proxy (InstDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (InstDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstDecl where
+  rnf (InstDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InstDecl where
+  def = InstDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable InstDecl where
+  hashWithSalt __salt (InstDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationOfName_id = Glean.Id
+
+data DeclarationOfName = DeclarationOfName{declarationOfName_id ::
+                                           {-# UNPACK #-} !DeclarationOfName_id,
+                                           declarationOfName_key ::
+                                           Prelude.Maybe DeclarationOfName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationOfName where
+  toJSON (DeclarationOfName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationOfName where
+  buildStruct _proxy (DeclarationOfName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationOfName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationOfName where
+  rnf (DeclarationOfName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationOfName where
+  def = DeclarationOfName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationOfName where
+  hashWithSalt __salt (DeclarationOfName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationSpan_id = Glean.Id
+
+data DeclarationSpan = DeclarationSpan{declarationSpan_id ::
+                                       {-# UNPACK #-} !DeclarationSpan_id,
+                                       declarationSpan_key :: Prelude.Maybe DeclarationSpan_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSpan where
+  toJSON (DeclarationSpan __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSpan where
+  buildStruct _proxy (DeclarationSpan __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationSpan __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSpan where
+  rnf (DeclarationSpan __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationSpan where
+  def = DeclarationSpan Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationSpan where
+  hashWithSalt __salt (DeclarationSpan _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DataDecl_id = Glean.Id
+
+data DataDecl = DataDecl{dataDecl_id ::
+                         {-# UNPACK #-} !DataDecl_id,
+                         dataDecl_key :: Prelude.Maybe DataDecl_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DataDecl where
+  toJSON (DataDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DataDecl where
+  buildStruct _proxy (DataDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DataDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DataDecl where
+  rnf (DataDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DataDecl where
+  def = DataDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable DataDecl where
+  hashWithSalt __salt (DataDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConstrDecl_id = Glean.Id
+
+data ConstrDecl = ConstrDecl{constrDecl_id ::
+                             {-# UNPACK #-} !ConstrDecl_id,
+                             constrDecl_key :: Prelude.Maybe ConstrDecl_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstrDecl where
+  toJSON (ConstrDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstrDecl where
+  buildStruct _proxy (ConstrDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ConstrDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstrDecl where
+  rnf (ConstrDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConstrDecl where
+  def = ConstrDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConstrDecl where
+  hashWithSalt __salt (ConstrDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDecl_id = Glean.Id
+
+data ClassDecl = ClassDecl{classDecl_id ::
+                           {-# UNPACK #-} !ClassDecl_id,
+                           classDecl_key :: Prelude.Maybe ClassDecl_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDecl where
+  toJSON (ClassDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDecl where
+  buildStruct _proxy (ClassDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDecl where
+  rnf (ClassDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDecl where
+  def = ClassDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDecl where
+  hashWithSalt __salt (ClassDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Type_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data ValBind_key = ValBind_key{valBind_key_name :: Name,
+                               valBind_key_ty :: Prelude.Maybe Type,
+                               valBind_key_sig :: Prelude.Maybe SigDecl}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ValBind_key where
+  toJSON (ValBind_key __field__name __field__ty __field__sig)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("ty" .=)) __field__ty
+             (Prelude.maybe Prelude.id ((:) . ("sig" .=)) __field__sig
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct ValBind_key where
+  buildStruct _proxy
+    (ValBind_key __field__name __field__ty __field__sig)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__ty, __id__ty)
+                 = case __field__ty of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "ty"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__ty
+               (case __field__sig of
+                  Prelude.Just _val -> Thrift.genField _proxy "sig"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__ty
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__ty <- ST.newSTRef Prelude.Nothing
+            __field__sig <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ty
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sig
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__ty <- ST.readSTRef __field__ty
+                                             !__val__sig <- ST.readSTRef __field__sig
+                                             Prelude.pure
+                                               (ValBind_key __val__name __val__ty __val__sig)
+              _idMap = HashMap.fromList [("name", 1), ("ty", 2), ("sig", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ValBind_key where
+  rnf (ValBind_key __field__name __field__ty __field__sig)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__ty `Prelude.seq`
+          DeepSeq.rnf __field__sig `Prelude.seq` ()
+
+instance Default.Default ValBind_key where
+  def = ValBind_key Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ValBind_key where
+  hashWithSalt __salt (ValBind_key _name _ty _sig)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _ty)
+        _sig
+
+newtype TypeSynDecl_key = TypeSynDecl_key{typeSynDecl_key_name ::
+                                          Name}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeSynDecl_key where
+  toJSON (TypeSynDecl_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeSynDecl_key where
+  buildStruct _proxy (TypeSynDecl_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (TypeSynDecl_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeSynDecl_key where
+  rnf (TypeSynDecl_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TypeSynDecl_key where
+  def = TypeSynDecl_key Default.def
+
+instance Hashable.Hashable TypeSynDecl_key where
+  hashWithSalt __salt (TypeSynDecl_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype TypeFamilyDecl_key = TypeFamilyDecl_key{typeFamilyDecl_key_name
+                                                :: Name}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeFamilyDecl_key where
+  toJSON (TypeFamilyDecl_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeFamilyDecl_key where
+  buildStruct _proxy (TypeFamilyDecl_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (TypeFamilyDecl_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeFamilyDecl_key where
+  rnf (TypeFamilyDecl_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TypeFamilyDecl_key where
+  def = TypeFamilyDecl_key Default.def
+
+instance Hashable.Hashable TypeFamilyDecl_key where
+  hashWithSalt __salt (TypeFamilyDecl_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data TypeArg = TypeArg{typeArg_visible :: Prelude.Bool,
+                       typeArg_ty :: Type}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeArg where
+  toJSON (TypeArg __field__visible __field__ty)
+    = Aeson.object
+        ("visible" .= __field__visible :
+           "ty" .= __field__ty : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeArg where
+  buildStruct _proxy (TypeArg __field__visible __field__ty)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "visible" 1 0 __field__visible :
+           Thrift.genField _proxy "ty" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__ty)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__visible <- ST.newSTRef Prelude.False
+            __field__ty <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__visible
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ty
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__visible <- ST.readSTRef
+                                                                  __field__visible
+                                             !__val__ty <- ST.readSTRef __field__ty
+                                             Prelude.pure (TypeArg __val__visible __val__ty)
+              _idMap = HashMap.fromList [("visible", 1), ("ty", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeArg where
+  rnf (TypeArg __field__visible __field__ty)
+    = DeepSeq.rnf __field__visible `Prelude.seq`
+        DeepSeq.rnf __field__ty `Prelude.seq` ()
+
+instance Default.Default TypeArg where
+  def = TypeArg Prelude.False Default.def
+
+instance Hashable.Hashable TypeArg where
+  hashWithSalt __salt (TypeArg _visible _ty)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _visible) _ty
+
+newtype TyVarBind_key = TyVarBind_key{tyVarBind_key_name :: Name}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyVarBind_key where
+  toJSON (TyVarBind_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct TyVarBind_key where
+  buildStruct _proxy (TyVarBind_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (TyVarBind_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TyVarBind_key where
+  rnf (TyVarBind_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default TyVarBind_key where
+  def = TyVarBind_key Default.def
+
+instance Hashable.Hashable TyVarBind_key where
+  hashWithSalt __salt (TyVarBind_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+type TyVar = Text.Text
+
+data TupleSort = TupleSort_boxed
+               | TupleSort_unboxed
+               | TupleSort_constraint
+               | TupleSort__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TupleSort where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData TupleSort where
+  rnf __TupleSort = Prelude.seq __TupleSort ()
+
+instance Default.Default TupleSort where
+  def = TupleSort_boxed
+
+instance Hashable.Hashable TupleSort where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum TupleSort where
+  toThriftEnum 0 = TupleSort_boxed
+  toThriftEnum 1 = TupleSort_unboxed
+  toThriftEnum 2 = TupleSort_constraint
+  toThriftEnum val = TupleSort__UNKNOWN val
+  fromThriftEnum TupleSort_boxed = 0
+  fromThriftEnum TupleSort_unboxed = 1
+  fromThriftEnum TupleSort_constraint = 2
+  fromThriftEnum (TupleSort__UNKNOWN val) = val
+  allThriftEnumValues
+    = [TupleSort_boxed, TupleSort_unboxed, TupleSort_constraint]
+  toThriftEnumEither 0 = Prelude.Right TupleSort_boxed
+  toThriftEnumEither 1 = Prelude.Right TupleSort_unboxed
+  toThriftEnumEither 2 = Prelude.Right TupleSort_constraint
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum TupleSort: "
+           ++ Prelude.show val)
+
+data TyConSort_tuple_ = TyConSort_tuple_{tyConSort_tuple__arity ::
+                                         Glean.Nat,
+                                         tyConSort_tuple__sort :: TupleSort}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyConSort_tuple_ where
+  toJSON (TyConSort_tuple_ __field__arity __field__sort)
+    = Aeson.object
+        ("arity" .= Glean.unNat __field__arity :
+           "sort" .= __field__sort : Prelude.mempty)
+
+instance Thrift.ThriftStruct TyConSort_tuple_ where
+  buildStruct _proxy (TyConSort_tuple_ __field__arity __field__sort)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "arity" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__arity)
+           :
+           Thrift.genField _proxy "sort" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__sort)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__arity <- ST.newSTRef (Glean.Nat Default.def)
+            __field__sort <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__arity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "TupleSort")
+                                                                        ST.writeSTRef __field__sort
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__arity <- ST.readSTRef __field__arity
+                                             !__val__sort <- ST.readSTRef __field__sort
+                                             Prelude.pure
+                                               (TyConSort_tuple_ __val__arity __val__sort)
+              _idMap = HashMap.fromList [("arity", 1), ("sort", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TyConSort_tuple_ where
+  rnf (TyConSort_tuple_ __field__arity __field__sort)
+    = DeepSeq.rnf __field__arity `Prelude.seq`
+        DeepSeq.rnf __field__sort `Prelude.seq` ()
+
+instance Default.Default TyConSort_tuple_ where
+  def = TyConSort_tuple_ (Glean.Nat Default.def) Default.def
+
+instance Hashable.Hashable TyConSort_tuple_ where
+  hashWithSalt __salt (TyConSort_tuple_ _arity _sort)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _arity) _sort
+
+newtype TyConSort_sum_ = TyConSort_sum_{tyConSort_sum__arity ::
+                                        Glean.Nat}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyConSort_sum_ where
+  toJSON (TyConSort_sum_ __field__arity)
+    = Aeson.object
+        ("arity" .= Glean.unNat __field__arity : Prelude.mempty)
+
+instance Thrift.ThriftStruct TyConSort_sum_ where
+  buildStruct _proxy (TyConSort_sum_ __field__arity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "arity" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__arity)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__arity <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__arity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__arity <- ST.readSTRef __field__arity
+                                             Prelude.pure (TyConSort_sum_ __val__arity)
+              _idMap = HashMap.fromList [("arity", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TyConSort_sum_ where
+  rnf (TyConSort_sum_ __field__arity)
+    = DeepSeq.rnf __field__arity `Prelude.seq` ()
+
+instance Default.Default TyConSort_sum_ where
+  def = TyConSort_sum_ (Glean.Nat Default.def)
+
+instance Hashable.Hashable TyConSort_sum_ where
+  hashWithSalt __salt (TyConSort_sum_ _arity)
+    = Hashable.hashWithSalt __salt _arity
+
+data TyConSort = TyConSort_normal Glean.Schema.Builtin.Unit
+               | TyConSort_tuple TyConSort_tuple_
+               | TyConSort_sum TyConSort_sum_
+               | TyConSort_equality Glean.Schema.Builtin.Unit
+               | TyConSort_EMPTY
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyConSort where
+  toJSON (TyConSort_normal __normal)
+    = Aeson.object ["normal" .= __normal]
+  toJSON (TyConSort_tuple __tuple)
+    = Aeson.object ["tuple" .= __tuple]
+  toJSON (TyConSort_sum __sum) = Aeson.object ["sum" .= __sum]
+  toJSON (TyConSort_equality __equality)
+    = Aeson.object ["equality" .= __equality]
+  toJSON TyConSort_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TyConSort where
+  buildStruct _proxy (TyConSort_normal __normal)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "normal" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __normal)]
+  buildStruct _proxy (TyConSort_tuple __tuple)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tuple" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __tuple)]
+  buildStruct _proxy (TyConSort_sum __sum)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sum" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __sum)]
+  buildStruct _proxy (TyConSort_equality __equality)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "equality" (Thrift.getStructType _proxy) 4
+           0
+           (Thrift.buildStruct _proxy __equality)]
+  buildStruct _proxy TyConSort_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TyConSort_normal _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TyConSort_tuple _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TyConSort_sum _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TyConSort_equality _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return TyConSort_EMPTY
+           Thrift.FieldEnd -> Prelude.return TyConSort_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("normal", 1), ("tuple", 2), ("sum", 3), ("equality", 4)]
+
+instance DeepSeq.NFData TyConSort where
+  rnf (TyConSort_normal __normal) = DeepSeq.rnf __normal
+  rnf (TyConSort_tuple __tuple) = DeepSeq.rnf __tuple
+  rnf (TyConSort_sum __sum) = DeepSeq.rnf __sum
+  rnf (TyConSort_equality __equality) = DeepSeq.rnf __equality
+  rnf TyConSort_EMPTY = ()
+
+instance Default.Default TyConSort where
+  def = TyConSort_EMPTY
+
+instance Hashable.Hashable TyConSort where
+  hashWithSalt __salt (TyConSort_normal _normal)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _normal)
+  hashWithSalt __salt (TyConSort_tuple _tuple)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _tuple)
+  hashWithSalt __salt (TyConSort_sum _sum)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _sum)
+  hashWithSalt __salt (TyConSort_equality _equality)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _equality)
+  hashWithSalt __salt TyConSort_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TyCon_key = TyCon_key{tyCon_key_name :: Name,
+                           tyCon_key_sort :: TyConSort, tyCon_key_promoted :: Prelude.Bool}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TyCon_key where
+  toJSON (TyCon_key __field__name __field__sort __field__promoted)
+    = Aeson.object
+        ("name" .= __field__name :
+           "sort" .= __field__sort :
+             "promoted" .= __field__promoted : Prelude.mempty)
+
+instance Thrift.ThriftStruct TyCon_key where
+  buildStruct _proxy
+    (TyCon_key __field__name __field__sort __field__promoted)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "sort" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__sort)
+             : Thrift.genFieldBool _proxy "promoted" 3 2 __field__promoted : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__sort <- ST.newSTRef Default.def
+            __field__promoted <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sort
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__promoted
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__sort <- ST.readSTRef __field__sort
+                                             !__val__promoted <- ST.readSTRef __field__promoted
+                                             Prelude.pure
+                                               (TyCon_key __val__name __val__sort __val__promoted)
+              _idMap
+                = HashMap.fromList [("name", 1), ("sort", 2), ("promoted", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TyCon_key where
+  rnf (TyCon_key __field__name __field__sort __field__promoted)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__sort `Prelude.seq`
+          DeepSeq.rnf __field__promoted `Prelude.seq` ()
+
+instance Default.Default TyCon_key where
+  def = TyCon_key Default.def Default.def Prelude.False
+
+instance Hashable.Hashable TyCon_key where
+  hashWithSalt __salt (TyCon_key _name _sort _promoted)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _sort)
+        _promoted
+
+data Specificity = Specificity_inferred
+                 | Specificity_specified
+                 | Specificity__UNKNOWN Prelude.Int
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Specificity where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Specificity where
+  rnf __Specificity = Prelude.seq __Specificity ()
+
+instance Default.Default Specificity where
+  def = Specificity_inferred
+
+instance Hashable.Hashable Specificity where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Specificity where
+  toThriftEnum 0 = Specificity_inferred
+  toThriftEnum 1 = Specificity_specified
+  toThriftEnum val = Specificity__UNKNOWN val
+  fromThriftEnum Specificity_inferred = 0
+  fromThriftEnum Specificity_specified = 1
+  fromThriftEnum (Specificity__UNKNOWN val) = val
+  allThriftEnumValues = [Specificity_inferred, Specificity_specified]
+  toThriftEnumEither 0 = Prelude.Right Specificity_inferred
+  toThriftEnumEither 1 = Prelude.Right Specificity_specified
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Specificity: "
+           ++ Prelude.show val)
+
+data SourceModule_key = SourceModule_key{sourceModule_key_file ::
+                                         Glean.Schema.Src.File,
+                                         sourceModule_key_mod :: Module}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SourceModule_key where
+  toJSON (SourceModule_key __field__file __field__mod)
+    = Aeson.object
+        ("file" .= __field__file : "mod" .= __field__mod : Prelude.mempty)
+
+instance Thrift.ThriftStruct SourceModule_key where
+  buildStruct _proxy (SourceModule_key __field__file __field__mod)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "mod" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__mod)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__mod <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mod
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__mod <- ST.readSTRef __field__mod
+                                             Prelude.pure (SourceModule_key __val__file __val__mod)
+              _idMap = HashMap.fromList [("file", 1), ("mod", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SourceModule_key where
+  rnf (SourceModule_key __field__file __field__mod)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__mod `Prelude.seq` ()
+
+instance Default.Default SourceModule_key where
+  def = SourceModule_key Default.def Default.def
+
+instance Hashable.Hashable SourceModule_key where
+  hashWithSalt __salt (SourceModule_key _file _mod)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _mod
+
+data SigDecl_key = SigDecl_key{sigDecl_key_name :: Name,
+                               sigDecl_key_loc :: Glean.Schema.Src.FileLocation}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SigDecl_key where
+  toJSON (SigDecl_key __field__name __field__loc)
+    = Aeson.object
+        ("name" .= __field__name : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct SigDecl_key where
+  buildStruct _proxy (SigDecl_key __field__name __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure (SigDecl_key __val__name __val__loc)
+              _idMap = HashMap.fromList [("name", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SigDecl_key where
+  rnf (SigDecl_key __field__name __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default SigDecl_key where
+  def = SigDecl_key Default.def Default.def
+
+instance Hashable.Hashable SigDecl_key where
+  hashWithSalt __salt (SigDecl_key _name _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc
+
+data RefTarget = RefTarget_name Name
+               | RefTarget_modName ModuleName
+               | RefTarget_EMPTY
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefTarget where
+  toJSON (RefTarget_name __name) = Aeson.object ["name" .= __name]
+  toJSON (RefTarget_modName __modName)
+    = Aeson.object ["modName" .= __modName]
+  toJSON RefTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct RefTarget where
+  buildStruct _proxy (RefTarget_name __name)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __name)]
+  buildStruct _proxy (RefTarget_modName __modName)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "modName" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __modName)]
+  buildStruct _proxy RefTarget_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RefTarget_name _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (RefTarget_modName _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return RefTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return RefTarget_EMPTY
+    where
+      _idMap = HashMap.fromList [("name", 1), ("modName", 2)]
+
+instance DeepSeq.NFData RefTarget where
+  rnf (RefTarget_name __name) = DeepSeq.rnf __name
+  rnf (RefTarget_modName __modName) = DeepSeq.rnf __modName
+  rnf RefTarget_EMPTY = ()
+
+instance Default.Default RefTarget where
+  def = RefTarget_EMPTY
+
+instance Hashable.Hashable RefTarget where
+  hashWithSalt __salt (RefTarget_name _name)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _name)
+  hashWithSalt __salt (RefTarget_modName _modName)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _modName)
+  hashWithSalt __salt RefTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data RefKind = RefKind_importref
+             | RefKind_exportref
+             | RefKind_coderef
+             | RefKind_tydecl
+             | RefKind_instbind
+             | RefKind__UNKNOWN Prelude.Int
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RefKind where
+  rnf __RefKind = Prelude.seq __RefKind ()
+
+instance Default.Default RefKind where
+  def = RefKind_importref
+
+instance Hashable.Hashable RefKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RefKind where
+  toThriftEnum 0 = RefKind_importref
+  toThriftEnum 1 = RefKind_exportref
+  toThriftEnum 2 = RefKind_coderef
+  toThriftEnum 3 = RefKind_tydecl
+  toThriftEnum 4 = RefKind_instbind
+  toThriftEnum val = RefKind__UNKNOWN val
+  fromThriftEnum RefKind_importref = 0
+  fromThriftEnum RefKind_exportref = 1
+  fromThriftEnum RefKind_coderef = 2
+  fromThriftEnum RefKind_tydecl = 3
+  fromThriftEnum RefKind_instbind = 4
+  fromThriftEnum (RefKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RefKind_importref, RefKind_exportref, RefKind_coderef,
+       RefKind_tydecl, RefKind_instbind]
+  toThriftEnumEither 0 = Prelude.Right RefKind_importref
+  toThriftEnumEither 1 = Prelude.Right RefKind_exportref
+  toThriftEnumEither 2 = Prelude.Right RefKind_coderef
+  toThriftEnumEither 3 = Prelude.Right RefKind_tydecl
+  toThriftEnumEither 4 = Prelude.Right RefKind_instbind
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RefKind: " ++
+           Prelude.show val)
+
+data RefSpan = RefSpan{refSpan_kind :: RefKind,
+                       refSpan_span :: Glean.Schema.Src.ByteSpan}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefSpan where
+  toJSON (RefSpan __field__kind __field__span)
+    = Aeson.object
+        ("kind" .= __field__kind :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct RefSpan where
+  buildStruct _proxy (RefSpan __field__kind __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RefKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (RefSpan __val__kind __val__span)
+              _idMap = HashMap.fromList [("kind", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RefSpan where
+  rnf (RefSpan __field__kind __field__span)
+    = DeepSeq.rnf __field__kind `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default RefSpan where
+  def = RefSpan Default.def Default.def
+
+instance Hashable.Hashable RefSpan where
+  hashWithSalt __salt (RefSpan _kind _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kind) _span
+
+data XRef_key = XRef_key{xRef_key_target :: RefTarget,
+                         xRef_key_file :: Glean.Schema.Src.File, xRef_key_refs :: [RefSpan]}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef_key where
+  toJSON (XRef_key __field__target __field__file __field__refs)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "refs" .= __field__refs : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef_key where
+  buildStruct _proxy
+    (XRef_key __field__target __field__file __field__refs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "refs" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__refs)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__refs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__refs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__refs <- ST.readSTRef __field__refs
+                                             Prelude.pure
+                                               (XRef_key __val__target __val__file __val__refs)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("refs", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef_key where
+  rnf (XRef_key __field__target __field__file __field__refs)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__refs `Prelude.seq` ()
+
+instance Default.Default XRef_key where
+  def = XRef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable XRef_key where
+  hashWithSalt __salt (XRef_key _target _file _refs)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _refs
+
+data RecordFieldDecl_key = RecordFieldDecl_key{recordFieldDecl_key_name
+                                               :: Name,
+                                               recordFieldDecl_key_con :: Name}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RecordFieldDecl_key where
+  toJSON (RecordFieldDecl_key __field__name __field__con)
+    = Aeson.object
+        ("name" .= __field__name : "con" .= __field__con : Prelude.mempty)
+
+instance Thrift.ThriftStruct RecordFieldDecl_key where
+  buildStruct _proxy (RecordFieldDecl_key __field__name __field__con)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "con" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__con)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__con <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__con
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__con <- ST.readSTRef __field__con
+                                             Prelude.pure
+                                               (RecordFieldDecl_key __val__name __val__con)
+              _idMap = HashMap.fromList [("name", 1), ("con", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RecordFieldDecl_key where
+  rnf (RecordFieldDecl_key __field__name __field__con)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__con `Prelude.seq` ()
+
+instance Default.Default RecordFieldDecl_key where
+  def = RecordFieldDecl_key Default.def Default.def
+
+instance Hashable.Hashable RecordFieldDecl_key where
+  hashWithSalt __salt (RecordFieldDecl_key _name _con)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _con
+
+newtype PatSynDecl_key = PatSynDecl_key{patSynDecl_key_name ::
+                                        Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PatSynDecl_key where
+  toJSON (PatSynDecl_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct PatSynDecl_key where
+  buildStruct _proxy (PatSynDecl_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (PatSynDecl_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PatSynDecl_key where
+  rnf (PatSynDecl_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default PatSynDecl_key where
+  def = PatSynDecl_key Default.def
+
+instance Hashable.Hashable PatSynDecl_key where
+  hashWithSalt __salt (PatSynDecl_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data PatBind_key = PatBind_key{patBind_key_name :: Name,
+                               patBind_key_ty :: Prelude.Maybe Type}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PatBind_key where
+  toJSON (PatBind_key __field__name __field__ty)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("ty" .=)) __field__ty
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PatBind_key where
+  buildStruct _proxy (PatBind_key __field__name __field__ty)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__ty of
+             Prelude.Just _val -> Thrift.genField _proxy "ty"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__ty <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ty
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__ty <- ST.readSTRef __field__ty
+                                             Prelude.pure (PatBind_key __val__name __val__ty)
+              _idMap = HashMap.fromList [("name", 1), ("ty", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PatBind_key where
+  rnf (PatBind_key __field__name __field__ty)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__ty `Prelude.seq` ()
+
+instance Default.Default PatBind_key where
+  def = PatBind_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable PatBind_key where
+  hashWithSalt __salt (PatBind_key _name _ty)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _ty
+
+data OccNameLowerCase_key = OccNameLowerCase_key{occNameLowerCase_key_nameLowerCase
+                                                 :: Text.Text,
+                                                 occNameLowerCase_key_occName :: OccName}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OccNameLowerCase_key where
+  toJSON
+    (OccNameLowerCase_key __field__nameLowerCase __field__occName)
+    = Aeson.object
+        ("nameLowerCase" .= __field__nameLowerCase :
+           "occName" .= __field__occName : Prelude.mempty)
+
+instance Thrift.ThriftStruct OccNameLowerCase_key where
+  buildStruct _proxy
+    (OccNameLowerCase_key __field__nameLowerCase __field__occName)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowerCase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowerCase)
+           :
+           Thrift.genField _proxy "occName" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__occName)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowerCase <- ST.newSTRef ""
+            __field__occName <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowerCase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__occName
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowerCase <- ST.readSTRef
+                                                                        __field__nameLowerCase
+                                             !__val__occName <- ST.readSTRef __field__occName
+                                             Prelude.pure
+                                               (OccNameLowerCase_key __val__nameLowerCase
+                                                  __val__occName)
+              _idMap = HashMap.fromList [("nameLowerCase", 1), ("occName", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OccNameLowerCase_key where
+  rnf (OccNameLowerCase_key __field__nameLowerCase __field__occName)
+    = DeepSeq.rnf __field__nameLowerCase `Prelude.seq`
+        DeepSeq.rnf __field__occName `Prelude.seq` ()
+
+instance Default.Default OccNameLowerCase_key where
+  def = OccNameLowerCase_key "" Default.def
+
+instance Hashable.Hashable OccNameLowerCase_key where
+  hashWithSalt __salt (OccNameLowerCase_key _nameLowerCase _occName)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowerCase)
+        _occName
+
+data Namespace = Namespace_var_
+               | Namespace_datacon
+               | Namespace_tyvar
+               | Namespace_tycon
+               | Namespace__UNKNOWN Prelude.Int
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Namespace where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Namespace where
+  rnf __Namespace = Prelude.seq __Namespace ()
+
+instance Default.Default Namespace where
+  def = Namespace_var_
+
+instance Hashable.Hashable Namespace where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Namespace where
+  toThriftEnum 0 = Namespace_var_
+  toThriftEnum 1 = Namespace_datacon
+  toThriftEnum 2 = Namespace_tyvar
+  toThriftEnum 3 = Namespace_tycon
+  toThriftEnum val = Namespace__UNKNOWN val
+  fromThriftEnum Namespace_var_ = 0
+  fromThriftEnum Namespace_datacon = 1
+  fromThriftEnum Namespace_tyvar = 2
+  fromThriftEnum Namespace_tycon = 3
+  fromThriftEnum (Namespace__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Namespace_var_, Namespace_datacon, Namespace_tyvar,
+       Namespace_tycon]
+  toThriftEnumEither 0 = Prelude.Right Namespace_var_
+  toThriftEnumEither 1 = Prelude.Right Namespace_datacon
+  toThriftEnumEither 2 = Prelude.Right Namespace_tyvar
+  toThriftEnumEither 3 = Prelude.Right Namespace_tycon
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Namespace: "
+           ++ Prelude.show val)
+
+data OccName_key = OccName_key{occName_key_name :: Text.Text,
+                               occName_key_namespace_ :: Namespace}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON OccName_key where
+  toJSON (OccName_key __field__name __field__namespace_)
+    = Aeson.object
+        ("name" .= __field__name :
+           "namespace_" .= __field__namespace_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct OccName_key where
+  buildStruct _proxy (OccName_key __field__name __field__namespace_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "namespace_" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__namespace_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__namespace_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Namespace")
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             Prelude.pure
+                                               (OccName_key __val__name __val__namespace_)
+              _idMap = HashMap.fromList [("name", 1), ("namespace_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData OccName_key where
+  rnf (OccName_key __field__name __field__namespace_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq` ()
+
+instance Default.Default OccName_key where
+  def = OccName_key "" Default.def
+
+instance Hashable.Hashable OccName_key where
+  hashWithSalt __salt (OccName_key _name _namespace_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _namespace_
+
+data NameSort = NameSort_external Glean.Schema.Builtin.Unit
+              | NameSort_internal Glean.Schema.Src.ByteSpan
+              | NameSort_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameSort where
+  toJSON (NameSort_external __external)
+    = Aeson.object ["external" .= __external]
+  toJSON (NameSort_internal __internal)
+    = Aeson.object ["internal" .= __internal]
+  toJSON NameSort_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct NameSort where
+  buildStruct _proxy (NameSort_external __external)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "external" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __external)]
+  buildStruct _proxy (NameSort_internal __internal)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "internal" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __internal)]
+  buildStruct _proxy NameSort_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (NameSort_external _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (NameSort_internal _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return NameSort_EMPTY
+           Thrift.FieldEnd -> Prelude.return NameSort_EMPTY
+    where
+      _idMap = HashMap.fromList [("external", 1), ("internal", 2)]
+
+instance DeepSeq.NFData NameSort where
+  rnf (NameSort_external __external) = DeepSeq.rnf __external
+  rnf (NameSort_internal __internal) = DeepSeq.rnf __internal
+  rnf NameSort_EMPTY = ()
+
+instance Default.Default NameSort where
+  def = NameSort_EMPTY
+
+instance Hashable.Hashable NameSort where
+  hashWithSalt __salt (NameSort_external _external)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _external)
+  hashWithSalt __salt (NameSort_internal _internal)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _internal)
+  hashWithSalt __salt NameSort_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Name_key = Name_key{name_key_occ :: OccName,
+                         name_key_mod :: Module, name_key_sort :: NameSort}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name_key where
+  toJSON (Name_key __field__occ __field__mod __field__sort)
+    = Aeson.object
+        ("occ" .= __field__occ :
+           "mod" .= __field__mod : "sort" .= __field__sort : Prelude.mempty)
+
+instance Thrift.ThriftStruct Name_key where
+  buildStruct _proxy
+    (Name_key __field__occ __field__mod __field__sort)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "occ" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__occ)
+           :
+           Thrift.genField _proxy "mod" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__mod)
+             :
+             Thrift.genField _proxy "sort" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__sort)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__occ <- ST.newSTRef Default.def
+            __field__mod <- ST.newSTRef Default.def
+            __field__sort <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__occ
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mod
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sort
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__occ <- ST.readSTRef __field__occ
+                                             !__val__mod <- ST.readSTRef __field__mod
+                                             !__val__sort <- ST.readSTRef __field__sort
+                                             Prelude.pure
+                                               (Name_key __val__occ __val__mod __val__sort)
+              _idMap = HashMap.fromList [("occ", 1), ("mod", 2), ("sort", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Name_key where
+  rnf (Name_key __field__occ __field__mod __field__sort)
+    = DeepSeq.rnf __field__occ `Prelude.seq`
+        DeepSeq.rnf __field__mod `Prelude.seq`
+          DeepSeq.rnf __field__sort `Prelude.seq` ()
+
+instance Default.Default Name_key where
+  def = Name_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Name_key where
+  hashWithSalt __salt (Name_key _occ _mod _sort)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _occ) _mod)
+        _sort
+
+data ModuleSource_key = ModuleSource_key{moduleSource_key_mod ::
+                                         Module,
+                                         moduleSource_key_file :: Glean.Schema.Src.File}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleSource_key where
+  toJSON (ModuleSource_key __field__mod __field__file)
+    = Aeson.object
+        ("mod" .= __field__mod : "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleSource_key where
+  buildStruct _proxy (ModuleSource_key __field__mod __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "mod" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__mod)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__mod <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mod
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__mod <- ST.readSTRef __field__mod
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure (ModuleSource_key __val__mod __val__file)
+              _idMap = HashMap.fromList [("mod", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleSource_key where
+  rnf (ModuleSource_key __field__mod __field__file)
+    = DeepSeq.rnf __field__mod `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default ModuleSource_key where
+  def = ModuleSource_key Default.def Default.def
+
+instance Hashable.Hashable ModuleSource_key where
+  hashWithSalt __salt (ModuleSource_key _mod _file)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _mod) _file
+
+data ModuleDeclarations_key = ModuleDeclarations_key{moduleDeclarations_key_module
+                                                     :: Module,
+                                                     moduleDeclarations_key_names :: [Name],
+                                                     moduleDeclarations_key_exports :: [Name]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDeclarations_key where
+  toJSON
+    (ModuleDeclarations_key __field__module __field__names
+       __field__exports)
+    = Aeson.object
+        ("module" .= __field__module :
+           "names" .= __field__names :
+             "exports" .= __field__exports : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDeclarations_key where
+  buildStruct _proxy
+    (ModuleDeclarations_key __field__module __field__names
+       __field__exports)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "names" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__names)
+             :
+             Thrift.genField _proxy "exports" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__exports)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__names <- ST.newSTRef Default.def
+            __field__exports <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__names
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__exports
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__names <- ST.readSTRef __field__names
+                                             !__val__exports <- ST.readSTRef __field__exports
+                                             Prelude.pure
+                                               (ModuleDeclarations_key __val__module __val__names
+                                                  __val__exports)
+              _idMap
+                = HashMap.fromList [("module", 1), ("names", 2), ("exports", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDeclarations_key where
+  rnf
+    (ModuleDeclarations_key __field__module __field__names
+       __field__exports)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__names `Prelude.seq`
+          DeepSeq.rnf __field__exports `Prelude.seq` ()
+
+instance Default.Default ModuleDeclarations_key where
+  def = ModuleDeclarations_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ModuleDeclarations_key where
+  hashWithSalt __salt
+    (ModuleDeclarations_key _module _names _exports)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+           _names)
+        _exports
+
+data Module_key = Module_key{module_key_name :: ModuleName,
+                             module_key_unit :: UnitName}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module_key where
+  toJSON (Module_key __field__name __field__unit)
+    = Aeson.object
+        ("name" .= __field__name :
+           "unit" .= __field__unit : Prelude.mempty)
+
+instance Thrift.ThriftStruct Module_key where
+  buildStruct _proxy (Module_key __field__name __field__unit)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "unit" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__unit)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__unit <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__unit
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__unit <- ST.readSTRef __field__unit
+                                             Prelude.pure (Module_key __val__name __val__unit)
+              _idMap = HashMap.fromList [("name", 1), ("unit", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Module_key where
+  rnf (Module_key __field__name __field__unit)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__unit `Prelude.seq` ()
+
+instance Default.Default Module_key where
+  def = Module_key Default.def Default.def
+
+instance Hashable.Hashable Module_key where
+  hashWithSalt __salt (Module_key _name _unit)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _unit
+
+data MethDecl_key = MethDecl_key{methDecl_key_name :: Name,
+                                 methDecl_key_class_ :: Name}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethDecl_key where
+  toJSON (MethDecl_key __field__name __field__class_)
+    = Aeson.object
+        ("name" .= __field__name :
+           "class_" .= __field__class_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethDecl_key where
+  buildStruct _proxy (MethDecl_key __field__name __field__class_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__class_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__class_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__class_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__class_ <- ST.readSTRef __field__class_
+                                             Prelude.pure (MethDecl_key __val__name __val__class_)
+              _idMap = HashMap.fromList [("name", 1), ("class_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethDecl_key where
+  rnf (MethDecl_key __field__name __field__class_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__class_ `Prelude.seq` ()
+
+instance Default.Default MethDecl_key where
+  def = MethDecl_key Default.def Default.def
+
+instance Hashable.Hashable MethDecl_key where
+  hashWithSalt __salt (MethDecl_key _name _class_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _class_
+
+data LitType_key = LitType_key_num Glean.Nat
+                 | LitType_key_str Text.Text
+                 | LitType_key_chr Glean.Nat
+                 | LitType_key_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LitType_key where
+  toJSON (LitType_key_num __num)
+    = Aeson.object ["num" .= Glean.unNat __num]
+  toJSON (LitType_key_str __str) = Aeson.object ["str" .= __str]
+  toJSON (LitType_key_chr __chr)
+    = Aeson.object ["chr" .= Glean.unNat __chr]
+  toJSON LitType_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct LitType_key where
+  buildStruct _proxy (LitType_key_num __num)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "num" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __num)]
+  buildStruct _proxy (LitType_key_str __str)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "str" (Thrift.getStringType _proxy) 2 0
+           (Thrift.genText _proxy __str)]
+  buildStruct _proxy (LitType_key_chr __chr)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "chr" (Thrift.getI64Type _proxy) 3 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __chr)]
+  buildStruct _proxy LitType_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getI64Type _proxy ->
+                                                         do _val <- Prelude.fmap Glean.Nat
+                                                                      (Thrift.parseI64 _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (LitType_key_num _val)
+                                                     2 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (LitType_key_str _val)
+                                                     3 | _type == Thrift.getI64Type _proxy ->
+                                                         do _val <- Prelude.fmap Glean.Nat
+                                                                      (Thrift.parseI64 _proxy)
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (LitType_key_chr _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return LitType_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return LitType_key_EMPTY
+    where
+      _idMap = HashMap.fromList [("num", 1), ("str", 2), ("chr", 3)]
+
+instance DeepSeq.NFData LitType_key where
+  rnf (LitType_key_num __num) = DeepSeq.rnf __num
+  rnf (LitType_key_str __str) = DeepSeq.rnf __str
+  rnf (LitType_key_chr __chr) = DeepSeq.rnf __chr
+  rnf LitType_key_EMPTY = ()
+
+instance Default.Default LitType_key where
+  def = LitType_key_EMPTY
+
+instance Hashable.Hashable LitType_key where
+  hashWithSalt __salt (LitType_key_num _num)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _num)
+  hashWithSalt __salt (LitType_key_str _str)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _str)
+  hashWithSalt __salt (LitType_key_chr _chr)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _chr)
+  hashWithSalt __salt LitType_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data InstanceBindToDecl_decl = InstanceBindToDecl_decl_inst InstDecl
+                             | InstanceBindToDecl_decl_class_ ClassDecl
+                             | InstanceBindToDecl_decl_EMPTY
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstanceBindToDecl_decl where
+  toJSON (InstanceBindToDecl_decl_inst __inst)
+    = Aeson.object ["inst" .= __inst]
+  toJSON (InstanceBindToDecl_decl_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON InstanceBindToDecl_decl_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct InstanceBindToDecl_decl where
+  buildStruct _proxy (InstanceBindToDecl_decl_inst __inst)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "inst" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __inst)]
+  buildStruct _proxy (InstanceBindToDecl_decl_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy InstanceBindToDecl_decl_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (InstanceBindToDecl_decl_inst _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (InstanceBindToDecl_decl_class_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               InstanceBindToDecl_decl_EMPTY
+           Thrift.FieldEnd -> Prelude.return InstanceBindToDecl_decl_EMPTY
+    where
+      _idMap = HashMap.fromList [("inst", 1), ("class_", 2)]
+
+instance DeepSeq.NFData InstanceBindToDecl_decl where
+  rnf (InstanceBindToDecl_decl_inst __inst) = DeepSeq.rnf __inst
+  rnf (InstanceBindToDecl_decl_class_ __class_)
+    = DeepSeq.rnf __class_
+  rnf InstanceBindToDecl_decl_EMPTY = ()
+
+instance Default.Default InstanceBindToDecl_decl where
+  def = InstanceBindToDecl_decl_EMPTY
+
+instance Hashable.Hashable InstanceBindToDecl_decl where
+  hashWithSalt __salt (InstanceBindToDecl_decl_inst _inst)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _inst)
+  hashWithSalt __salt (InstanceBindToDecl_decl_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _class_)
+  hashWithSalt __salt InstanceBindToDecl_decl_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data InstanceBindToDecl_key = InstanceBindToDecl_key{instanceBindToDecl_key_bind
+                                                     :: InstanceBind,
+                                                     instanceBindToDecl_key_decl ::
+                                                     InstanceBindToDecl_decl}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstanceBindToDecl_key where
+  toJSON (InstanceBindToDecl_key __field__bind __field__decl)
+    = Aeson.object
+        ("bind" .= __field__bind :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct InstanceBindToDecl_key where
+  buildStruct _proxy
+    (InstanceBindToDecl_key __field__bind __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "bind" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__bind)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__bind <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__bind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__bind <- ST.readSTRef __field__bind
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (InstanceBindToDecl_key __val__bind __val__decl)
+              _idMap = HashMap.fromList [("bind", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstanceBindToDecl_key where
+  rnf (InstanceBindToDecl_key __field__bind __field__decl)
+    = DeepSeq.rnf __field__bind `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default InstanceBindToDecl_key where
+  def = InstanceBindToDecl_key Default.def Default.def
+
+instance Hashable.Hashable InstanceBindToDecl_key where
+  hashWithSalt __salt (InstanceBindToDecl_key _bind _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _bind) _decl
+
+data InstanceBind_key = InstanceBind_key{instanceBind_key_name ::
+                                         Name,
+                                         instanceBind_key_loc :: Glean.Schema.Src.FileLocation}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstanceBind_key where
+  toJSON (InstanceBind_key __field__name __field__loc)
+    = Aeson.object
+        ("name" .= __field__name : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct InstanceBind_key where
+  buildStruct _proxy (InstanceBind_key __field__name __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure (InstanceBind_key __val__name __val__loc)
+              _idMap = HashMap.fromList [("name", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstanceBind_key where
+  rnf (InstanceBind_key __field__name __field__loc)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default InstanceBind_key where
+  def = InstanceBind_key Default.def Default.def
+
+instance Hashable.Hashable InstanceBind_key where
+  hashWithSalt __salt (InstanceBind_key _name _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _loc
+
+data InstDecl_key = InstDecl_key{instDecl_key_methods ::
+                                 [InstanceBind],
+                                 instDecl_key_loc :: Glean.Schema.Src.FileLocation}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InstDecl_key where
+  toJSON (InstDecl_key __field__methods __field__loc)
+    = Aeson.object
+        ("methods" .= __field__methods :
+           "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct InstDecl_key where
+  buildStruct _proxy (InstDecl_key __field__methods __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "methods" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStructType _proxy)
+              (Thrift.buildStruct _proxy)
+              __field__methods)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__methods <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__methods
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__methods <- ST.readSTRef
+                                                                  __field__methods
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure (InstDecl_key __val__methods __val__loc)
+              _idMap = HashMap.fromList [("methods", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InstDecl_key where
+  rnf (InstDecl_key __field__methods __field__loc)
+    = DeepSeq.rnf __field__methods `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default InstDecl_key where
+  def = InstDecl_key Default.def Default.def
+
+instance Hashable.Hashable InstDecl_key where
+  hashWithSalt __salt (InstDecl_key _methods _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _methods)
+        _loc
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_name
+                                                       :: Name,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__name __field__file __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__name __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__name __val__file
+                                                  __val__span)
+              _idMap = HashMap.fromList [("name", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__name __field__file __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt (DeclarationLocation_key _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _file)
+        _span
+
+data Declaration = Declaration_val ValBind
+                 | Declaration_typeFamily TypeFamilyDecl
+                 | Declaration_type_ TypeSynDecl
+                 | Declaration_data DataDecl
+                 | Declaration_con ConstrDecl
+                 | Declaration_patSyn PatSynDecl
+                 | Declaration_class_ ClassDecl
+                 | Declaration_method MethDecl
+                 | Declaration_instance InstDecl
+                 | Declaration_patBind PatBind
+                 | Declaration_tyVarBind TyVarBind
+                 | Declaration_field RecordFieldDecl
+                 | Declaration_sig SigDecl
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_val __val) = Aeson.object ["val" .= __val]
+  toJSON (Declaration_typeFamily __typeFamily)
+    = Aeson.object ["typeFamily" .= __typeFamily]
+  toJSON (Declaration_type_ __type_)
+    = Aeson.object ["type_" .= __type_]
+  toJSON (Declaration_data __data) = Aeson.object ["data" .= __data]
+  toJSON (Declaration_con __con) = Aeson.object ["con" .= __con]
+  toJSON (Declaration_patSyn __patSyn)
+    = Aeson.object ["patSyn" .= __patSyn]
+  toJSON (Declaration_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (Declaration_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Declaration_instance __instance)
+    = Aeson.object ["instance" .= __instance]
+  toJSON (Declaration_patBind __patBind)
+    = Aeson.object ["patBind" .= __patBind]
+  toJSON (Declaration_tyVarBind __tyVarBind)
+    = Aeson.object ["tyVarBind" .= __tyVarBind]
+  toJSON (Declaration_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON (Declaration_sig __sig) = Aeson.object ["sig" .= __sig]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_val __val)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "val" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __val)]
+  buildStruct _proxy (Declaration_typeFamily __typeFamily)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typeFamily" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __typeFamily)]
+  buildStruct _proxy (Declaration_type_ __type_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "type_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __type_)]
+  buildStruct _proxy (Declaration_data __data)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "data" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __data)]
+  buildStruct _proxy (Declaration_con __con)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "con" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __con)]
+  buildStruct _proxy (Declaration_patSyn __patSyn)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "patSyn" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __patSyn)]
+  buildStruct _proxy (Declaration_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (Declaration_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Declaration_instance __instance)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "instance" (Thrift.getStructType _proxy) 9
+           0
+           (Thrift.buildStruct _proxy __instance)]
+  buildStruct _proxy (Declaration_patBind __patBind)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "patBind" (Thrift.getStructType _proxy) 10
+           0
+           (Thrift.buildStruct _proxy __patBind)]
+  buildStruct _proxy (Declaration_tyVarBind __tyVarBind)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tyVarBind" (Thrift.getStructType _proxy)
+           11
+           0
+           (Thrift.buildStruct _proxy __tyVarBind)]
+  buildStruct _proxy (Declaration_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 12 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy (Declaration_sig __sig)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "sig" (Thrift.getStructType _proxy) 13 0
+           (Thrift.buildStruct _proxy __sig)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_val _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_typeFamily _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_type_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_data _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_con _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_patSyn _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_class_ _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_method _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_instance _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_patBind _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               (Declaration_tyVarBind _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Declaration_field _val)
+                                                     13 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Declaration_sig _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("val", 1), ("typeFamily", 2), ("type_", 3), ("data", 4),
+             ("con", 5), ("patSyn", 6), ("class_", 7), ("method", 8),
+             ("instance", 9), ("patBind", 10), ("tyVarBind", 11), ("field", 12),
+             ("sig", 13)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_val __val) = DeepSeq.rnf __val
+  rnf (Declaration_typeFamily __typeFamily)
+    = DeepSeq.rnf __typeFamily
+  rnf (Declaration_type_ __type_) = DeepSeq.rnf __type_
+  rnf (Declaration_data __data) = DeepSeq.rnf __data
+  rnf (Declaration_con __con) = DeepSeq.rnf __con
+  rnf (Declaration_patSyn __patSyn) = DeepSeq.rnf __patSyn
+  rnf (Declaration_class_ __class_) = DeepSeq.rnf __class_
+  rnf (Declaration_method __method) = DeepSeq.rnf __method
+  rnf (Declaration_instance __instance) = DeepSeq.rnf __instance
+  rnf (Declaration_patBind __patBind) = DeepSeq.rnf __patBind
+  rnf (Declaration_tyVarBind __tyVarBind) = DeepSeq.rnf __tyVarBind
+  rnf (Declaration_field __field) = DeepSeq.rnf __field
+  rnf (Declaration_sig __sig) = DeepSeq.rnf __sig
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_val _val)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _val)
+  hashWithSalt __salt (Declaration_typeFamily _typeFamily)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _typeFamily)
+  hashWithSalt __salt (Declaration_type_ _type_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _type_)
+  hashWithSalt __salt (Declaration_data _data)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _data)
+  hashWithSalt __salt (Declaration_con _con)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _con)
+  hashWithSalt __salt (Declaration_patSyn _patSyn)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _patSyn)
+  hashWithSalt __salt (Declaration_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _class_)
+  hashWithSalt __salt (Declaration_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _method)
+  hashWithSalt __salt (Declaration_instance _instance)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _instance)
+  hashWithSalt __salt (Declaration_patBind _patBind)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _patBind)
+  hashWithSalt __salt (Declaration_tyVarBind _tyVarBind)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 11 _tyVarBind)
+  hashWithSalt __salt (Declaration_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 12 _field)
+  hashWithSalt __salt (Declaration_sig _sig)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 13 _sig)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationOfName_key = DeclarationOfName_key{declarationOfName_key_name
+                                                   :: Name,
+                                                   declarationOfName_key_decl :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationOfName_key where
+  toJSON (DeclarationOfName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationOfName_key where
+  buildStruct _proxy
+    (DeclarationOfName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DeclarationOfName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationOfName_key where
+  rnf (DeclarationOfName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DeclarationOfName_key where
+  def = DeclarationOfName_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationOfName_key where
+  hashWithSalt __salt (DeclarationOfName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data DeclarationSpan_key = DeclarationSpan_key{declarationSpan_key_decl
+                                               :: Declaration,
+                                               declarationSpan_key_loc ::
+                                               Glean.Schema.Src.FileLocation}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationSpan_key where
+  toJSON (DeclarationSpan_key __field__decl __field__loc)
+    = Aeson.object
+        ("decl" .= __field__decl : "loc" .= __field__loc : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationSpan_key where
+  buildStruct _proxy (DeclarationSpan_key __field__decl __field__loc)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__loc)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__loc <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             Prelude.pure
+                                               (DeclarationSpan_key __val__decl __val__loc)
+              _idMap = HashMap.fromList [("decl", 1), ("loc", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationSpan_key where
+  rnf (DeclarationSpan_key __field__decl __field__loc)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__loc `Prelude.seq` ()
+
+instance Default.Default DeclarationSpan_key where
+  def = DeclarationSpan_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationSpan_key where
+  hashWithSalt __salt (DeclarationSpan_key _decl _loc)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _loc
+
+data DataDecl_key = DataDecl_key{dataDecl_key_name :: Name,
+                                 dataDecl_key_constrs :: [ConstrDecl]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DataDecl_key where
+  toJSON (DataDecl_key __field__name __field__constrs)
+    = Aeson.object
+        ("name" .= __field__name :
+           "constrs" .= __field__constrs : Prelude.mempty)
+
+instance Thrift.ThriftStruct DataDecl_key where
+  buildStruct _proxy (DataDecl_key __field__name __field__constrs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "constrs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__constrs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__constrs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__constrs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__constrs <- ST.readSTRef __field__constrs
+                                             Prelude.pure (DataDecl_key __val__name __val__constrs)
+              _idMap = HashMap.fromList [("name", 1), ("constrs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DataDecl_key where
+  rnf (DataDecl_key __field__name __field__constrs)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__constrs `Prelude.seq` ()
+
+instance Default.Default DataDecl_key where
+  def = DataDecl_key Default.def Default.def
+
+instance Hashable.Hashable DataDecl_key where
+  hashWithSalt __salt (DataDecl_key _name _constrs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _constrs
+
+data ConstrDecl_key = ConstrDecl_key{constrDecl_key_name :: Name,
+                                     constrDecl_key_data_ :: Name,
+                                     constrDecl_key_fields :: [RecordFieldDecl]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstrDecl_key where
+  toJSON
+    (ConstrDecl_key __field__name __field__data_ __field__fields)
+    = Aeson.object
+        ("name" .= __field__name :
+           "data_" .= __field__data_ :
+             "fields" .= __field__fields : Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstrDecl_key where
+  buildStruct _proxy
+    (ConstrDecl_key __field__name __field__data_ __field__fields)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "data_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__data_)
+             :
+             Thrift.genField _proxy "fields" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__fields)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__data_ <- ST.newSTRef Default.def
+            __field__fields <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__data_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__fields
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__data_ <- ST.readSTRef __field__data_
+                                             !__val__fields <- ST.readSTRef __field__fields
+                                             Prelude.pure
+                                               (ConstrDecl_key __val__name __val__data_
+                                                  __val__fields)
+              _idMap
+                = HashMap.fromList [("name", 1), ("data_", 2), ("fields", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstrDecl_key where
+  rnf (ConstrDecl_key __field__name __field__data_ __field__fields)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__data_ `Prelude.seq`
+          DeepSeq.rnf __field__fields `Prelude.seq` ()
+
+instance Default.Default ConstrDecl_key where
+  def = ConstrDecl_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ConstrDecl_key where
+  hashWithSalt __salt (ConstrDecl_key _name _data_ _fields)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _data_)
+        _fields
+
+data ClassDecl_key = ClassDecl_key{classDecl_key_name :: Name,
+                                   classDecl_key_methods :: [MethDecl],
+                                   classDecl_key_defaults :: [InstanceBind]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDecl_key where
+  toJSON
+    (ClassDecl_key __field__name __field__methods __field__defaults)
+    = Aeson.object
+        ("name" .= __field__name :
+           "methods" .= __field__methods :
+             "defaults" .= __field__defaults : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDecl_key where
+  buildStruct _proxy
+    (ClassDecl_key __field__name __field__methods __field__defaults)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "methods" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__methods)
+             :
+             Thrift.genField _proxy "defaults" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__defaults)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__methods <- ST.newSTRef Default.def
+            __field__defaults <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__methods
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__defaults
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__methods <- ST.readSTRef __field__methods
+                                             !__val__defaults <- ST.readSTRef __field__defaults
+                                             Prelude.pure
+                                               (ClassDecl_key __val__name __val__methods
+                                                  __val__defaults)
+              _idMap
+                = HashMap.fromList [("name", 1), ("methods", 2), ("defaults", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDecl_key where
+  rnf
+    (ClassDecl_key __field__name __field__methods __field__defaults)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__methods `Prelude.seq`
+          DeepSeq.rnf __field__defaults `Prelude.seq` ()
+
+instance Default.Default ClassDecl_key where
+  def = ClassDecl_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ClassDecl_key where
+  hashWithSalt __salt (ClassDecl_key _name _methods _defaults)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _methods)
+        _defaults
+
+data ArgFlag = ArgFlag_invisible Specificity
+             | ArgFlag_requird Glean.Schema.Builtin.Unit
+             | ArgFlag_EMPTY
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArgFlag where
+  toJSON (ArgFlag_invisible __invisible)
+    = Aeson.object ["invisible" .= __invisible]
+  toJSON (ArgFlag_requird __requird)
+    = Aeson.object ["requird" .= __requird]
+  toJSON ArgFlag_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ArgFlag where
+  buildStruct _proxy (ArgFlag_invisible __invisible)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "invisible" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __invisible)]
+  buildStruct _proxy (ArgFlag_requird __requird)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "requird" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __requird)]
+  buildStruct _proxy ArgFlag_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getI32Type _proxy ->
+                                                         do _val <- Thrift.parseEnum _proxy
+                                                                      "Specificity"
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ArgFlag_invisible _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (ArgFlag_requird _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return ArgFlag_EMPTY
+           Thrift.FieldEnd -> Prelude.return ArgFlag_EMPTY
+    where
+      _idMap = HashMap.fromList [("invisible", 1), ("requird", 2)]
+
+instance DeepSeq.NFData ArgFlag where
+  rnf (ArgFlag_invisible __invisible) = DeepSeq.rnf __invisible
+  rnf (ArgFlag_requird __requird) = DeepSeq.rnf __requird
+  rnf ArgFlag_EMPTY = ()
+
+instance Default.Default ArgFlag where
+  def = ArgFlag_EMPTY
+
+instance Hashable.Hashable ArgFlag where
+  hashWithSalt __salt (ArgFlag_invisible _invisible)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _invisible)
+  hashWithSalt __salt (ArgFlag_requird _requird)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _requird)
+  hashWithSalt __salt ArgFlag_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Type_app_ = Type_app_{type_app__fun :: Type,
+                           type_app__args_ :: [TypeArg]}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_app_ where
+  toJSON (Type_app_ __field__fun __field__args_)
+    = Aeson.object
+        ("fun" .= __field__fun :
+           "args_" .= __field__args_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_app_ where
+  buildStruct _proxy (Type_app_ __field__fun __field__args_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fun" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__fun)
+           :
+           Thrift.genField _proxy "args_" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__args_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fun <- ST.newSTRef Default.def
+            __field__args_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__fun
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__args_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fun <- ST.readSTRef __field__fun
+                                             !__val__args_ <- ST.readSTRef __field__args_
+                                             Prelude.pure (Type_app_ __val__fun __val__args_)
+              _idMap = HashMap.fromList [("fun", 1), ("args_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_app_ where
+  rnf (Type_app_ __field__fun __field__args_)
+    = DeepSeq.rnf __field__fun `Prelude.seq`
+        DeepSeq.rnf __field__args_ `Prelude.seq` ()
+
+instance Default.Default Type_app_ where
+  def = Type_app_ Default.def Default.def
+
+instance Hashable.Hashable Type_app_ where
+  hashWithSalt __salt (Type_app_ _fun _args_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fun) _args_
+
+data Type_tyconapp_ = Type_tyconapp_{type_tyconapp__tycon :: TyCon,
+                                     type_tyconapp__args_ :: [TypeArg]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_tyconapp_ where
+  toJSON (Type_tyconapp_ __field__tycon __field__args_)
+    = Aeson.object
+        ("tycon" .= __field__tycon :
+           "args_" .= __field__args_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_tyconapp_ where
+  buildStruct _proxy (Type_tyconapp_ __field__tycon __field__args_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "tycon" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__tycon)
+           :
+           Thrift.genField _proxy "args_" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__args_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__tycon <- ST.newSTRef Default.def
+            __field__args_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__tycon
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__args_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__tycon <- ST.readSTRef __field__tycon
+                                             !__val__args_ <- ST.readSTRef __field__args_
+                                             Prelude.pure (Type_tyconapp_ __val__tycon __val__args_)
+              _idMap = HashMap.fromList [("tycon", 1), ("args_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_tyconapp_ where
+  rnf (Type_tyconapp_ __field__tycon __field__args_)
+    = DeepSeq.rnf __field__tycon `Prelude.seq`
+        DeepSeq.rnf __field__args_ `Prelude.seq` ()
+
+instance Default.Default Type_tyconapp_ where
+  def = Type_tyconapp_ Default.def Default.def
+
+instance Hashable.Hashable Type_tyconapp_ where
+  hashWithSalt __salt (Type_tyconapp_ _tycon _args_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _tycon)
+        _args_
+
+data Type_forall_ = Type_forall_{type_forall__name :: TyVar,
+                                 type_forall__kind :: Type, type_forall__flag :: ArgFlag,
+                                 type_forall__inner :: Type}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_forall_ where
+  toJSON
+    (Type_forall_ __field__name __field__kind __field__flag
+       __field__inner)
+    = Aeson.object
+        ("name" .= __field__name :
+           "kind" .= __field__kind :
+             "flag" .= __field__flag :
+               "inner" .= __field__inner : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_forall_ where
+  buildStruct _proxy
+    (Type_forall_ __field__name __field__kind __field__flag
+       __field__inner)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__kind)
+             :
+             Thrift.genField _proxy "flag" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__flag)
+               :
+               Thrift.genField _proxy "inner" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__inner)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kind <- ST.newSTRef Default.def
+            __field__flag <- ST.newSTRef Default.def
+            __field__inner <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__flag
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__inner
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__flag <- ST.readSTRef __field__flag
+                                             !__val__inner <- ST.readSTRef __field__inner
+                                             Prelude.pure
+                                               (Type_forall_ __val__name __val__kind __val__flag
+                                                  __val__inner)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("kind", 2), ("flag", 3), ("inner", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_forall_ where
+  rnf
+    (Type_forall_ __field__name __field__kind __field__flag
+       __field__inner)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__flag `Prelude.seq`
+            DeepSeq.rnf __field__inner `Prelude.seq` ()
+
+instance Default.Default Type_forall_ where
+  def = Type_forall_ "" Default.def Default.def Default.def
+
+instance Hashable.Hashable Type_forall_ where
+  hashWithSalt __salt (Type_forall_ _name _kind _flag _inner)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind)
+           _flag)
+        _inner
+
+data Type_fun_ = Type_fun_{type_fun__mult :: Type,
+                           type_fun__arg :: Type, type_fun__res :: Type}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_fun_ where
+  toJSON (Type_fun_ __field__mult __field__arg __field__res)
+    = Aeson.object
+        ("mult" .= __field__mult :
+           "arg" .= __field__arg : "res" .= __field__res : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_fun_ where
+  buildStruct _proxy
+    (Type_fun_ __field__mult __field__arg __field__res)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "mult" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__mult)
+           :
+           Thrift.genField _proxy "arg" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__arg)
+             :
+             Thrift.genField _proxy "res" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__res)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__mult <- ST.newSTRef Default.def
+            __field__arg <- ST.newSTRef Default.def
+            __field__res <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mult
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__arg
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__res
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__mult <- ST.readSTRef __field__mult
+                                             !__val__arg <- ST.readSTRef __field__arg
+                                             !__val__res <- ST.readSTRef __field__res
+                                             Prelude.pure
+                                               (Type_fun_ __val__mult __val__arg __val__res)
+              _idMap = HashMap.fromList [("mult", 1), ("arg", 2), ("res", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_fun_ where
+  rnf (Type_fun_ __field__mult __field__arg __field__res)
+    = DeepSeq.rnf __field__mult `Prelude.seq`
+        DeepSeq.rnf __field__arg `Prelude.seq`
+          DeepSeq.rnf __field__res `Prelude.seq` ()
+
+instance Default.Default Type_fun_ where
+  def = Type_fun_ Default.def Default.def Default.def
+
+instance Hashable.Hashable Type_fun_ where
+  hashWithSalt __salt (Type_fun_ _mult _arg _res)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _mult) _arg)
+        _res
+
+data Type_qual_ = Type_qual_{type_qual__pred :: Type,
+                             type_qual__res :: Type}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_qual_ where
+  toJSON (Type_qual_ __field__pred __field__res)
+    = Aeson.object
+        ("pred" .= __field__pred : "res" .= __field__res : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_qual_ where
+  buildStruct _proxy (Type_qual_ __field__pred __field__res)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "pred" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__pred)
+           :
+           Thrift.genField _proxy "res" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__res)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__pred <- ST.newSTRef Default.def
+            __field__res <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__pred
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__res
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__pred <- ST.readSTRef __field__pred
+                                             !__val__res <- ST.readSTRef __field__res
+                                             Prelude.pure (Type_qual_ __val__pred __val__res)
+              _idMap = HashMap.fromList [("pred", 1), ("res", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_qual_ where
+  rnf (Type_qual_ __field__pred __field__res)
+    = DeepSeq.rnf __field__pred `Prelude.seq`
+        DeepSeq.rnf __field__res `Prelude.seq` ()
+
+instance Default.Default Type_qual_ where
+  def = Type_qual_ Default.def Default.def
+
+instance Hashable.Hashable Type_qual_ where
+  hashWithSalt __salt (Type_qual_ _pred _res)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _pred) _res
+
+data Type_key = Type_key_tyvar TyVar
+              | Type_key_app Type_app_
+              | Type_key_tyconapp Type_tyconapp_
+              | Type_key_forall Type_forall_
+              | Type_key_fun Type_fun_
+              | Type_key_qual Type_qual_
+              | Type_key_lit LitType
+              | Type_key_cast Type
+              | Type_key_coercion Glean.Schema.Builtin.Unit
+              | Type_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_key where
+  toJSON (Type_key_tyvar __tyvar) = Aeson.object ["tyvar" .= __tyvar]
+  toJSON (Type_key_app __app) = Aeson.object ["app" .= __app]
+  toJSON (Type_key_tyconapp __tyconapp)
+    = Aeson.object ["tyconapp" .= __tyconapp]
+  toJSON (Type_key_forall __forall)
+    = Aeson.object ["forall" .= __forall]
+  toJSON (Type_key_fun __fun) = Aeson.object ["fun" .= __fun]
+  toJSON (Type_key_qual __qual) = Aeson.object ["qual" .= __qual]
+  toJSON (Type_key_lit __lit) = Aeson.object ["lit" .= __lit]
+  toJSON (Type_key_cast __cast) = Aeson.object ["cast" .= __cast]
+  toJSON (Type_key_coercion __coercion)
+    = Aeson.object ["coercion" .= __coercion]
+  toJSON Type_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Type_key where
+  buildStruct _proxy (Type_key_tyvar __tyvar)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tyvar" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __tyvar)]
+  buildStruct _proxy (Type_key_app __app)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "app" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __app)]
+  buildStruct _proxy (Type_key_tyconapp __tyconapp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "tyconapp" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __tyconapp)]
+  buildStruct _proxy (Type_key_forall __forall)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "forall" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __forall)]
+  buildStruct _proxy (Type_key_fun __fun)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fun" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __fun)]
+  buildStruct _proxy (Type_key_qual __qual)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "qual" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __qual)]
+  buildStruct _proxy (Type_key_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __lit)]
+  buildStruct _proxy (Type_key_cast __cast)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cast" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __cast)]
+  buildStruct _proxy (Type_key_coercion __coercion)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "coercion" (Thrift.getStructType _proxy) 9
+           0
+           (Thrift.buildStruct _proxy __coercion)]
+  buildStruct _proxy Type_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_tyvar _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_app _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_tyconapp _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_forall _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_fun _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_qual _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_lit _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_cast _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_coercion _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Type_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Type_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("tyvar", 1), ("app", 2), ("tyconapp", 3), ("forall", 4),
+             ("fun", 5), ("qual", 6), ("lit", 7), ("cast", 8), ("coercion", 9)]
+
+instance DeepSeq.NFData Type_key where
+  rnf (Type_key_tyvar __tyvar) = DeepSeq.rnf __tyvar
+  rnf (Type_key_app __app) = DeepSeq.rnf __app
+  rnf (Type_key_tyconapp __tyconapp) = DeepSeq.rnf __tyconapp
+  rnf (Type_key_forall __forall) = DeepSeq.rnf __forall
+  rnf (Type_key_fun __fun) = DeepSeq.rnf __fun
+  rnf (Type_key_qual __qual) = DeepSeq.rnf __qual
+  rnf (Type_key_lit __lit) = DeepSeq.rnf __lit
+  rnf (Type_key_cast __cast) = DeepSeq.rnf __cast
+  rnf (Type_key_coercion __coercion) = DeepSeq.rnf __coercion
+  rnf Type_key_EMPTY = ()
+
+instance Default.Default Type_key where
+  def = Type_key_EMPTY
+
+instance Hashable.Hashable Type_key where
+  hashWithSalt __salt (Type_key_tyvar _tyvar)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _tyvar)
+  hashWithSalt __salt (Type_key_app _app)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _app)
+  hashWithSalt __salt (Type_key_tyconapp _tyconapp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _tyconapp)
+  hashWithSalt __salt (Type_key_forall _forall)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _forall)
+  hashWithSalt __salt (Type_key_fun _fun)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _fun)
+  hashWithSalt __salt (Type_key_qual _qual)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _qual)
+  hashWithSalt __salt (Type_key_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _lit)
+  hashWithSalt __salt (Type_key_cast _cast)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _cast)
+  hashWithSalt __salt (Type_key_coercion _coercion)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _coercion)
+  hashWithSalt __salt Type_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+{-# LINE 18 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyCon_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.TyCon_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TyCon_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TyCon_key" (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.TyCon_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "sort" (Glean.Schema.Hs.Types.TyConSort)
+          ('Angle.TField "promoted" (Prelude.Bool) ('Angle.TNoFields)))
+{-# LINE 31 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.TyCon where
+  type KeyType Glean.Schema.Hs.Types.TyCon =
+       Glean.Schema.Hs.Types.TyCon_key
+  getName _proxy = Glean.PredicateRef "hs.TyCon" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.tyCon_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.TyCon x k
+  getFactKey = Glean.Schema.Hs.Types.tyCon_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyCon where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstanceBindToDecl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hs.Types.InstanceBindToDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.InstanceBindToDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.InstanceBindToDecl_key" (Prelude.Just 0))
+{-# LINE 54 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.InstanceBindToDecl_key =
+     'Angle.TField "bind"
+       (Glean.KeyType Glean.Schema.Hs.Types.InstanceBind)
+       ('Angle.TField "decl"
+          (Glean.Schema.Hs.Types.InstanceBindToDecl_decl)
+          ('Angle.TNoFields))
+{-# LINE 56 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.InstanceBindToDecl
+         where
+  type KeyType Glean.Schema.Hs.Types.InstanceBindToDecl =
+       Glean.Schema.Hs.Types.InstanceBindToDecl_key
+  getName _proxy = Glean.PredicateRef "hs.InstanceBindToDecl" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hs.Types.instanceBindToDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.InstanceBindToDecl x k
+  getFactKey = Glean.Schema.Hs.Types.instanceBindToDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 65 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstanceBindToDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 71 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_key where
+  buildRtsValue b Glean.Schema.Hs.Types.Type_key_EMPTY
+    = Glean.buildRtsSelector b 9
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_tyvar x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_app x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_tyconapp x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_forall x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_fun x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_qual x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_lit x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_cast x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_key_coercion x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.Type_key_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.Type_key_tyvar,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_app,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_tyconapp,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_forall,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_fun,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_qual,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_lit,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_cast,
+         Glean.mapD Glean.Schema.Hs.Types.Type_key_coercion]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.Type_key" (Prelude.Just 0))
+{-# LINE 115 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.Type_key =
+     'Angle.TField "tyvar" (Glean.Schema.Hs.Types.TyVar)
+       ('Angle.TField "app" (Glean.Schema.Hs.Types.Type_app_)
+          ('Angle.TField "tyconapp" (Glean.Schema.Hs.Types.Type_tyconapp_)
+             ('Angle.TField "forall" (Glean.Schema.Hs.Types.Type_forall_)
+                ('Angle.TField "fun" (Glean.Schema.Hs.Types.Type_fun_)
+                   ('Angle.TField "qual" (Glean.Schema.Hs.Types.Type_qual_)
+                      ('Angle.TField "lit" (Glean.KeyType Glean.Schema.Hs.Types.LitType)
+                         ('Angle.TField "cast" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+                            ('Angle.TField "coercion" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TNoFields)))))))))
+{-# LINE 117 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.Type where
+  type KeyType Glean.Schema.Hs.Types.Type =
+       Glean.Schema.Hs.Types.Type_key
+  getName _proxy = Glean.PredicateRef "hs.Type" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.Type x k
+  getFactKey = Glean.Schema.Hs.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ModuleSource_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.ModuleSource_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.ModuleSource_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.ModuleSource_key" (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.ModuleSource_key =
+     'Angle.TField "mod" (Glean.KeyType Glean.Schema.Hs.Types.Module)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ModuleSource where
+  type KeyType Glean.Schema.Hs.Types.ModuleSource =
+       Glean.Schema.Hs.Types.ModuleSource_key
+  getName _proxy = Glean.PredicateRef "hs.ModuleSource" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.moduleSource_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ModuleSource x k
+  getFactKey = Glean.Schema.Hs.Types.moduleSource_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ModuleSource where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 157 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ModuleName where
+  type KeyType Glean.Schema.Hs.Types.ModuleName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hs.ModuleName" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.moduleName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ModuleName x k
+  getFactKey = Glean.Schema.Hs.Types.moduleName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 165 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ModuleName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 171 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TypeFamilyDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.TypeFamilyDecl_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TypeFamilyDecl_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TypeFamilyDecl_key" (Prelude.Just 0))
+{-# LINE 178 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.TypeFamilyDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 180 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.TypeFamilyDecl where
+  type KeyType Glean.Schema.Hs.Types.TypeFamilyDecl =
+       Glean.Schema.Hs.Types.TypeFamilyDecl_key
+  getName _proxy = Glean.PredicateRef "hs.TypeFamilyDecl" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.typeFamilyDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.TypeFamilyDecl x k
+  getFactKey = Glean.Schema.Hs.Types.typeFamilyDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 189 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TypeFamilyDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 195 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.MethDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.MethDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.MethDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.MethDecl_key" (Prelude.Just 0))
+{-# LINE 204 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.MethDecl_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "class_" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 206 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.MethDecl where
+  type KeyType Glean.Schema.Hs.Types.MethDecl =
+       Glean.Schema.Hs.Types.MethDecl_key
+  getName _proxy = Glean.PredicateRef "hs.MethDecl" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.methDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.MethDecl x k
+  getFactKey = Glean.Schema.Hs.Types.methDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 215 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.MethDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 221 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyVarBind_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.TyVarBind_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TyVarBind_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TyVarBind_key" (Prelude.Just 0))
+{-# LINE 228 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.TyVarBind_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 230 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.TyVarBind where
+  type KeyType Glean.Schema.Hs.Types.TyVarBind =
+       Glean.Schema.Hs.Types.TyVarBind_key
+  getName _proxy = Glean.PredicateRef "hs.TyVarBind" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.tyVarBind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.TyVarBind x k
+  getFactKey = Glean.Schema.Hs.Types.tyVarBind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 239 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyVarBind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 245 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstanceBind_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.InstanceBind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.InstanceBind_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.InstanceBind_key" (Prelude.Just 0))
+{-# LINE 254 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.InstanceBind_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+          ('Angle.TNoFields))
+{-# LINE 256 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.InstanceBind where
+  type KeyType Glean.Schema.Hs.Types.InstanceBind =
+       Glean.Schema.Hs.Types.InstanceBind_key
+  getName _proxy = Glean.PredicateRef "hs.InstanceBind" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.instanceBind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.InstanceBind x k
+  getFactKey = Glean.Schema.Hs.Types.instanceBind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 265 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstanceBind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 271 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.LitType_key where
+  buildRtsValue b Glean.Schema.Hs.Types.LitType_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.Hs.Types.LitType_key_num x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.LitType_key_str x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.LitType_key_chr x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.LitType_key_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.LitType_key_num,
+         Glean.mapD Glean.Schema.Hs.Types.LitType_key_str,
+         Glean.mapD Glean.Schema.Hs.Types.LitType_key_chr]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.LitType_key" (Prelude.Just 0))
+{-# LINE 291 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.LitType_key =
+     'Angle.TField "num" (Glean.Nat)
+       ('Angle.TField "str" (Data.Text.Text)
+          ('Angle.TField "chr" (Glean.Nat) ('Angle.TNoFields)))
+{-# LINE 293 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.LitType where
+  type KeyType Glean.Schema.Hs.Types.LitType =
+       Glean.Schema.Hs.Types.LitType_key
+  getName _proxy = Glean.PredicateRef "hs.LitType" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.litType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.LitType x k
+  getFactKey = Glean.Schema.Hs.Types.litType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 302 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.LitType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 308 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ClassDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.ClassDecl_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.ClassDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.ClassDecl_key" (Prelude.Just 0))
+{-# LINE 319 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.ClassDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "methods" ([Glean.Schema.Hs.Types.MethDecl])
+          ('Angle.TField "defaults" ([Glean.Schema.Hs.Types.InstanceBind])
+             ('Angle.TNoFields)))
+{-# LINE 321 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ClassDecl where
+  type KeyType Glean.Schema.Hs.Types.ClassDecl =
+       Glean.Schema.Hs.Types.ClassDecl_key
+  getName _proxy = Glean.PredicateRef "hs.ClassDecl" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.classDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ClassDecl x k
+  getFactKey = Glean.Schema.Hs.Types.classDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 330 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ClassDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 336 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ConstrDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.ConstrDecl_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.ConstrDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.ConstrDecl_key" (Prelude.Just 0))
+{-# LINE 347 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.ConstrDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "data_" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+          ('Angle.TField "fields" ([Glean.Schema.Hs.Types.RecordFieldDecl])
+             ('Angle.TNoFields)))
+{-# LINE 349 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ConstrDecl where
+  type KeyType Glean.Schema.Hs.Types.ConstrDecl =
+       Glean.Schema.Hs.Types.ConstrDecl_key
+  getName _proxy = Glean.PredicateRef "hs.ConstrDecl" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.constrDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ConstrDecl x k
+  getFactKey = Glean.Schema.Hs.Types.constrDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 358 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ConstrDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 364 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Name_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.Name_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Name_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.Name_key" (Prelude.Just 0))
+{-# LINE 375 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Name_key =
+     'Angle.TField "occ" (Glean.KeyType Glean.Schema.Hs.Types.OccName)
+       ('Angle.TField "mod" (Glean.KeyType Glean.Schema.Hs.Types.Module)
+          ('Angle.TField "sort" (Glean.Schema.Hs.Types.NameSort)
+             ('Angle.TNoFields)))
+{-# LINE 377 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.Name where
+  type KeyType Glean.Schema.Hs.Types.Name =
+       Glean.Schema.Hs.Types.Name_key
+  getName _proxy = Glean.PredicateRef "hs.Name" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.Name x k
+  getFactKey = Glean.Schema.Hs.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 385 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 391 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.OccName_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.OccName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.OccName_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.OccName_key" (Prelude.Just 0))
+{-# LINE 400 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.OccName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "namespace_" (Glean.Schema.Hs.Types.Namespace)
+          ('Angle.TNoFields))
+{-# LINE 402 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.OccName where
+  type KeyType Glean.Schema.Hs.Types.OccName =
+       Glean.Schema.Hs.Types.OccName_key
+  getName _proxy = Glean.PredicateRef "hs.OccName" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.occName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.OccName x k
+  getFactKey = Glean.Schema.Hs.Types.occName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 411 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.OccName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 417 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ModuleDeclarations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hs.Types.ModuleDeclarations_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.ModuleDeclarations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.ModuleDeclarations_key" (Prelude.Just 0))
+{-# LINE 428 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.ModuleDeclarations_key =
+     'Angle.TField "module" (Glean.KeyType Glean.Schema.Hs.Types.Module)
+       ('Angle.TField "names" ([Glean.Schema.Hs.Types.Name])
+          ('Angle.TField "exports" ([Glean.Schema.Hs.Types.Name])
+             ('Angle.TNoFields)))
+{-# LINE 430 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ModuleDeclarations
+         where
+  type KeyType Glean.Schema.Hs.Types.ModuleDeclarations =
+       Glean.Schema.Hs.Types.ModuleDeclarations_key
+  getName _proxy = Glean.PredicateRef "hs.ModuleDeclarations" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hs.Types.moduleDeclarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ModuleDeclarations x k
+  getFactKey = Glean.Schema.Hs.Types.moduleDeclarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 439 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ModuleDeclarations where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 445 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.SourceModule_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.SourceModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.SourceModule_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.SourceModule_key" (Prelude.Just 0))
+{-# LINE 454 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.SourceModule_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "mod" (Glean.KeyType Glean.Schema.Hs.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 456 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.SourceModule where
+  type KeyType Glean.Schema.Hs.Types.SourceModule =
+       Glean.Schema.Hs.Types.SourceModule_key
+  getName _proxy = Glean.PredicateRef "hs.SourceModule" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.sourceModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.SourceModule x k
+  getFactKey = Glean.Schema.Hs.Types.sourceModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 465 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.SourceModule where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 471 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Hs.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.DeclarationLocation_key" (Prelude.Just 0))
+{-# LINE 482 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.DeclarationLocation_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 484 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Hs.Types.DeclarationLocation =
+       Glean.Schema.Hs.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "hs.DeclarationLocation" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hs.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Hs.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 493 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 499 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TypeSynDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.TypeSynDecl_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TypeSynDecl_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TypeSynDecl_key" (Prelude.Just 0))
+{-# LINE 506 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.TypeSynDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 508 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.TypeSynDecl where
+  type KeyType Glean.Schema.Hs.Types.TypeSynDecl =
+       Glean.Schema.Hs.Types.TypeSynDecl_key
+  getName _proxy = Glean.PredicateRef "hs.TypeSynDecl" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.typeSynDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.TypeSynDecl x k
+  getFactKey = Glean.Schema.Hs.Types.typeSynDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 517 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TypeSynDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 523 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.SigDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.SigDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.SigDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.SigDecl_key" (Prelude.Just 0))
+{-# LINE 532 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.SigDecl_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+          ('Angle.TNoFields))
+{-# LINE 534 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.SigDecl where
+  type KeyType Glean.Schema.Hs.Types.SigDecl =
+       Glean.Schema.Hs.Types.SigDecl_key
+  getName _proxy = Glean.PredicateRef "hs.SigDecl" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.sigDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.SigDecl x k
+  getFactKey = Glean.Schema.Hs.Types.sigDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 543 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.SigDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 549 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationOfName_key
+         where
+  buildRtsValue b (Glean.Schema.Hs.Types.DeclarationOfName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.DeclarationOfName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.DeclarationOfName_key" (Prelude.Just 0))
+{-# LINE 558 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.DeclarationOfName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "decl" (Glean.Schema.Hs.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 560 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.DeclarationOfName
+         where
+  type KeyType Glean.Schema.Hs.Types.DeclarationOfName =
+       Glean.Schema.Hs.Types.DeclarationOfName_key
+  getName _proxy = Glean.PredicateRef "hs.DeclarationOfName" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hs.Types.declarationOfName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.DeclarationOfName x k
+  getFactKey = Glean.Schema.Hs.Types.declarationOfName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 569 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationOfName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 575 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationSpan_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.DeclarationSpan_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.DeclarationSpan_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.DeclarationSpan_key" (Prelude.Just 0))
+{-# LINE 584 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.DeclarationSpan_key =
+     'Angle.TField "decl" (Glean.Schema.Hs.Types.Declaration)
+       ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+          ('Angle.TNoFields))
+{-# LINE 586 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.DeclarationSpan
+         where
+  type KeyType Glean.Schema.Hs.Types.DeclarationSpan =
+       Glean.Schema.Hs.Types.DeclarationSpan_key
+  getName _proxy = Glean.PredicateRef "hs.DeclarationSpan" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.declarationSpan_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.DeclarationSpan x k
+  getFactKey = Glean.Schema.Hs.Types.declarationSpan_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 595 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DeclarationSpan where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 601 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.InstDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.InstDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.InstDecl_key" (Prelude.Just 0))
+{-# LINE 610 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.InstDecl_key
+     =
+     'Angle.TField "methods" ([Glean.Schema.Hs.Types.InstanceBind])
+       ('Angle.TField "loc" (Glean.Schema.Src.Types.FileLocation)
+          ('Angle.TNoFields))
+{-# LINE 612 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.InstDecl where
+  type KeyType Glean.Schema.Hs.Types.InstDecl =
+       Glean.Schema.Hs.Types.InstDecl_key
+  getName _proxy = Glean.PredicateRef "hs.InstDecl" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.instDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.InstDecl x k
+  getFactKey = Glean.Schema.Hs.Types.instDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 621 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 627 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.XRef_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.XRef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.XRef_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.XRef_key" (Prelude.Just 0))
+{-# LINE 638 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.XRef_key =
+     'Angle.TField "target" (Glean.Schema.Hs.Types.RefTarget)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "refs" ([Glean.Schema.Hs.Types.RefSpan])
+             ('Angle.TNoFields)))
+{-# LINE 640 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.XRef where
+  type KeyType Glean.Schema.Hs.Types.XRef =
+       Glean.Schema.Hs.Types.XRef_key
+  getName _proxy = Glean.PredicateRef "hs.XRef" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.xRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.XRef x k
+  getFactKey = Glean.Schema.Hs.Types.xRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 648 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.XRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 654 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ValBind_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.ValBind_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.ValBind_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.ValBind_key" (Prelude.Just 0))
+{-# LINE 665 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.ValBind_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "ty" (Prelude.Maybe Glean.Schema.Hs.Types.Type)
+          ('Angle.TField "sig" (Prelude.Maybe Glean.Schema.Hs.Types.SigDecl)
+             ('Angle.TNoFields)))
+{-# LINE 667 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.ValBind where
+  type KeyType Glean.Schema.Hs.Types.ValBind =
+       Glean.Schema.Hs.Types.ValBind_key
+  getName _proxy = Glean.PredicateRef "hs.ValBind" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.valBind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.ValBind x k
+  getFactKey = Glean.Schema.Hs.Types.valBind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 676 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ValBind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 682 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.RecordFieldDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.RecordFieldDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.RecordFieldDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.RecordFieldDecl_key" (Prelude.Just 0))
+{-# LINE 691 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.RecordFieldDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "con" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 693 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.RecordFieldDecl
+         where
+  type KeyType Glean.Schema.Hs.Types.RecordFieldDecl =
+       Glean.Schema.Hs.Types.RecordFieldDecl_key
+  getName _proxy = Glean.PredicateRef "hs.RecordFieldDecl" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.recordFieldDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.RecordFieldDecl x k
+  getFactKey = Glean.Schema.Hs.Types.recordFieldDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 702 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.RecordFieldDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 708 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.PatBind_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.PatBind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.PatBind_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.PatBind_key" (Prelude.Just 0))
+{-# LINE 717 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.PatBind_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "ty" (Prelude.Maybe Glean.Schema.Hs.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 719 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.PatBind where
+  type KeyType Glean.Schema.Hs.Types.PatBind =
+       Glean.Schema.Hs.Types.PatBind_key
+  getName _proxy = Glean.PredicateRef "hs.PatBind" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.patBind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.PatBind x k
+  getFactKey = Glean.Schema.Hs.Types.patBind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 728 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.PatBind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 734 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DataDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.DataDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.DataDecl_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.DataDecl_key" (Prelude.Just 0))
+{-# LINE 743 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.DataDecl_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "constrs" ([Glean.Schema.Hs.Types.ConstrDecl])
+          ('Angle.TNoFields))
+{-# LINE 745 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.DataDecl where
+  type KeyType Glean.Schema.Hs.Types.DataDecl =
+       Glean.Schema.Hs.Types.DataDecl_key
+  getName _proxy = Glean.PredicateRef "hs.DataDecl" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.dataDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.DataDecl x k
+  getFactKey = Glean.Schema.Hs.Types.dataDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 754 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.DataDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 760 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.UnitName where
+  type KeyType Glean.Schema.Hs.Types.UnitName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "hs.UnitName" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.unitName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.UnitName x k
+  getFactKey = Glean.Schema.Hs.Types.unitName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 768 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.UnitName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 774 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.FileXRefs_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.FileXRefs_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 783 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Hs.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 785 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.FileXRefs where
+  type KeyType Glean.Schema.Hs.Types.FileXRefs =
+       Glean.Schema.Hs.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "hs.FileXRefs" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.FileXRefs x k
+  getFactKey = Glean.Schema.Hs.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 794 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 800 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.OccNameLowerCase_key
+         where
+  buildRtsValue b (Glean.Schema.Hs.Types.OccNameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.OccNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.OccNameLowerCase_key" (Prelude.Just 0))
+{-# LINE 809 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.OccNameLowerCase_key =
+     'Angle.TField "nameLowerCase" (Data.Text.Text)
+       ('Angle.TField "occName"
+          (Glean.KeyType Glean.Schema.Hs.Types.OccName)
+          ('Angle.TNoFields))
+{-# LINE 811 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.OccNameLowerCase
+         where
+  type KeyType Glean.Schema.Hs.Types.OccNameLowerCase =
+       Glean.Schema.Hs.Types.OccNameLowerCase_key
+  getName _proxy = Glean.PredicateRef "hs.OccNameLowerCase" 3
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Hs.Types.occNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.OccNameLowerCase x k
+  getFactKey = Glean.Schema.Hs.Types.occNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 820 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.OccNameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 826 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Module_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.Module_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Module_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Module_key" (Prelude.Just 0))
+{-# LINE 835 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Module_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Hs.Types.ModuleName)
+       ('Angle.TField "unit"
+          (Glean.KeyType Glean.Schema.Hs.Types.UnitName)
+          ('Angle.TNoFields))
+{-# LINE 837 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.Module where
+  type KeyType Glean.Schema.Hs.Types.Module =
+       Glean.Schema.Hs.Types.Module_key
+  getName _proxy = Glean.PredicateRef "hs.Module" 3
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.module_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.Module x k
+  getFactKey = Glean.Schema.Hs.Types.module_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 845 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Module where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 851 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.PatSynDecl_key where
+  buildRtsValue b (Glean.Schema.Hs.Types.PatSynDecl_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.PatSynDecl_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.PatSynDecl_key" (Prelude.Just 0))
+{-# LINE 858 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.PatSynDecl_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 860 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Hs.Types.PatSynDecl where
+  type KeyType Glean.Schema.Hs.Types.PatSynDecl =
+       Glean.Schema.Hs.Types.PatSynDecl_key
+  getName _proxy = Glean.PredicateRef "hs.PatSynDecl" 3
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Hs.Types.patSynDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Hs.Types.PatSynDecl x k
+  getFactKey = Glean.Schema.Hs.Types.patSynDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 869 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.PatSynDecl where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 875 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TupleSort where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TupleSort" (Prelude.Just 3))
+{-# LINE 880 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.TupleSort =
+     'Angle.TField "boxed" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "unboxed" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "constraint" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 882 "glean/schema/thrift/hs_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hs.Types.TupleSort where
+  type AngleEnumTy Glean.Schema.Hs.Types.TupleSort =
+       Glean.Schema.Hs.Types.TupleSort
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
+{-# LINE 886 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Specificity where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Specificity" (Prelude.Just 3))
+{-# LINE 891 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.Specificity =
+     'Angle.TField "inferred" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "specified" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 893 "glean/schema/thrift/hs_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hs.Types.Specificity where
+  type AngleEnumTy Glean.Schema.Hs.Types.Specificity =
+       Glean.Schema.Hs.Types.Specificity
+  enumName v = Text.pack (Prelude.drop 12 (Prelude.show v))
+{-# LINE 897 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.NameSort where
+  buildRtsValue b Glean.Schema.Hs.Types.NameSort_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Hs.Types.NameSort_external x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.NameSort_internal x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.NameSort_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.NameSort_external,
+         Glean.mapD Glean.Schema.Hs.Types.NameSort_internal]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.NameSort" (Prelude.Just 3))
+{-# LINE 913 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.NameSort =
+     'Angle.TField "external" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "internal" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 915 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.RefTarget where
+  buildRtsValue b Glean.Schema.Hs.Types.RefTarget_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Hs.Types.RefTarget_name x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.RefTarget_modName x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.RefTarget_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.RefTarget_name,
+         Glean.mapD Glean.Schema.Hs.Types.RefTarget_modName]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.RefTarget" (Prelude.Just 3))
+{-# LINE 931 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.RefTarget =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hs.Types.Name)
+       ('Angle.TField "modName"
+          (Glean.KeyType Glean.Schema.Hs.Types.ModuleName)
+          ('Angle.TNoFields))
+{-# LINE 933 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TypeArg where
+  buildRtsValue b (Glean.Schema.Hs.Types.TypeArg x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TypeArg <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.TypeArg" (Prelude.Just 3))
+{-# LINE 942 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.TypeArg =
+     'Angle.TField "visible" (Prelude.Bool)
+       ('Angle.TField "ty" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 944 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.RefKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.RefKind" (Prelude.Just 3))
+{-# LINE 949 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.RefKind =
+     'Angle.TField "importref" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "exportref" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "coderef" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "tydecl" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "instbind" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TNoFields)))))
+{-# LINE 951 "glean/schema/thrift/hs_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hs.Types.RefKind where
+  type AngleEnumTy Glean.Schema.Hs.Types.RefKind =
+       Glean.Schema.Hs.Types.RefKind
+  enumName v = Text.pack (Prelude.drop 8 (Prelude.show v))
+{-# LINE 955 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Declaration where
+  buildRtsValue b Glean.Schema.Hs.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 13
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_val x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_typeFamily x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_type_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_data x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_con x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_patSyn x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_class_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_method x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_instance x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_patBind x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_tyVarBind x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_field x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.Declaration_sig x)
+    = do Glean.buildRtsSelector b 12
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.Declaration_val,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_typeFamily,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_type_,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_data,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_con,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_patSyn,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_class_,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_method,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_instance,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_patBind,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_tyVarBind,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_field,
+         Glean.mapD Glean.Schema.Hs.Types.Declaration_sig]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Declaration" (Prelude.Just 3))
+{-# LINE 1015 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.Declaration =
+     'Angle.TField "val" (Glean.KeyType Glean.Schema.Hs.Types.ValBind)
+       ('Angle.TField "typeFamily"
+          (Glean.KeyType Glean.Schema.Hs.Types.TypeFamilyDecl)
+          ('Angle.TField "type_"
+             (Glean.KeyType Glean.Schema.Hs.Types.TypeSynDecl)
+             ('Angle.TField "data"
+                (Glean.KeyType Glean.Schema.Hs.Types.DataDecl)
+                ('Angle.TField "con"
+                   (Glean.KeyType Glean.Schema.Hs.Types.ConstrDecl)
+                   ('Angle.TField "patSyn"
+                      (Glean.KeyType Glean.Schema.Hs.Types.PatSynDecl)
+                      ('Angle.TField "class_"
+                         (Glean.KeyType Glean.Schema.Hs.Types.ClassDecl)
+                         ('Angle.TField "method"
+                            (Glean.KeyType Glean.Schema.Hs.Types.MethDecl)
+                            ('Angle.TField "instance"
+                               (Glean.KeyType Glean.Schema.Hs.Types.InstDecl)
+                               ('Angle.TField "patBind"
+                                  (Glean.KeyType Glean.Schema.Hs.Types.PatBind)
+                                  ('Angle.TField "tyVarBind"
+                                     (Glean.KeyType Glean.Schema.Hs.Types.TyVarBind)
+                                     ('Angle.TField "field"
+                                        (Glean.KeyType Glean.Schema.Hs.Types.RecordFieldDecl)
+                                        ('Angle.TField "sig"
+                                           (Glean.KeyType Glean.Schema.Hs.Types.SigDecl)
+                                           ('Angle.TNoFields)))))))))))))
+{-# LINE 1017 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.RefSpan where
+  buildRtsValue b (Glean.Schema.Hs.Types.RefSpan x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.RefSpan <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.RefSpan" (Prelude.Just 3))
+{-# LINE 1026 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.RefSpan =
+     'Angle.TField "kind" (Glean.Schema.Hs.Types.RefKind)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 1028 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyConSort where
+  buildRtsValue b Glean.Schema.Hs.Types.TyConSort_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_normal x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_tuple x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_sum x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_equality x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.TyConSort_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.TyConSort_normal,
+         Glean.mapD Glean.Schema.Hs.Types.TyConSort_tuple,
+         Glean.mapD Glean.Schema.Hs.Types.TyConSort_sum,
+         Glean.mapD Glean.Schema.Hs.Types.TyConSort_equality]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TyConSort" (Prelude.Just 3))
+{-# LINE 1052 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.TyConSort =
+     'Angle.TField "normal" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "tuple" (Glean.Schema.Hs.Types.TyConSort_tuple_)
+          ('Angle.TField "sum" (Glean.Schema.Hs.Types.TyConSort_sum_)
+             ('Angle.TField "equality" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 1054 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Namespace where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Namespace" (Prelude.Just 3))
+{-# LINE 1059 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.Namespace =
+     'Angle.TField "var_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "datacon" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "tyvar" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "tycon" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 1061 "glean/schema/thrift/hs_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Hs.Types.Namespace where
+  type AngleEnumTy Glean.Schema.Hs.Types.Namespace =
+       Glean.Schema.Hs.Types.Namespace
+  enumName v = Text.pack (Prelude.drop 10 (Prelude.show v))
+{-# LINE 1065 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.ArgFlag where
+  buildRtsValue b Glean.Schema.Hs.Types.ArgFlag_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Hs.Types.ArgFlag_invisible x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Hs.Types.ArgFlag_requird x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Hs.Types.ArgFlag_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.ArgFlag_invisible,
+         Glean.mapD Glean.Schema.Hs.Types.ArgFlag_requird]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "hs.ArgFlag" (Prelude.Just 3))
+{-# LINE 1081 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Hs.Types.ArgFlag =
+     'Angle.TField "invisible" (Glean.Schema.Hs.Types.Specificity)
+       ('Angle.TField "requird" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TNoFields))
+{-# LINE 1083 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.InstanceBindToDecl_decl
+         where
+  buildRtsValue b Glean.Schema.Hs.Types.InstanceBindToDecl_decl_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.Hs.Types.InstanceBindToDecl_decl_inst x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Hs.Types.InstanceBindToDecl_decl_class_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Hs.Types.InstanceBindToDecl_decl_EMPTY)
+        [Glean.mapD Glean.Schema.Hs.Types.InstanceBindToDecl_decl_inst,
+         Glean.mapD Glean.Schema.Hs.Types.InstanceBindToDecl_decl_class_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.InstanceBindToDecl_decl" (Prelude.Just 0))
+{-# LINE 1099 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Hs.Types.InstanceBindToDecl_decl =
+     'Angle.TField "inst" (Glean.KeyType Glean.Schema.Hs.Types.InstDecl)
+       ('Angle.TField "class_"
+          (Glean.KeyType Glean.Schema.Hs.Types.ClassDecl)
+          ('Angle.TNoFields))
+{-# LINE 1101 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_app_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_app_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Type_app_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Type_app_" (Prelude.Just 0))
+{-# LINE 1110 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Type_app_ =
+     'Angle.TField "fun" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+       ('Angle.TField "args_" ([Glean.Schema.Hs.Types.TypeArg])
+          ('Angle.TNoFields))
+{-# LINE 1112 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_tyconapp_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_tyconapp_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Type_tyconapp_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Type_tyconapp_" (Prelude.Just 0))
+{-# LINE 1121 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.Type_tyconapp_ =
+     'Angle.TField "tycon" (Glean.KeyType Glean.Schema.Hs.Types.TyCon)
+       ('Angle.TField "args_" ([Glean.Schema.Hs.Types.TypeArg])
+          ('Angle.TNoFields))
+{-# LINE 1123 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_forall_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_forall_ x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Type_forall_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Type_forall_" (Prelude.Just 0))
+{-# LINE 1136 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Type_forall_
+     =
+     'Angle.TField "name" (Glean.Schema.Hs.Types.TyVar)
+       ('Angle.TField "kind" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+          ('Angle.TField "flag" (Glean.Schema.Hs.Types.ArgFlag)
+             ('Angle.TField "inner" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+                ('Angle.TNoFields))))
+{-# LINE 1138 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_fun_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_fun_ x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Type_fun_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Type_fun_" (Prelude.Just 0))
+{-# LINE 1149 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Type_fun_ =
+     'Angle.TField "mult" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+       ('Angle.TField "arg" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+          ('Angle.TField "res" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+             ('Angle.TNoFields)))
+{-# LINE 1151 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.Type_qual_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.Type_qual_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.Type_qual_ <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.Type_qual_" (Prelude.Just 0))
+{-# LINE 1160 "glean/schema/thrift/hs_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Hs.Types.Type_qual_ =
+     'Angle.TField "pred" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+       ('Angle.TField "res" (Glean.KeyType Glean.Schema.Hs.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 1162 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyConSort_tuple_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_tuple_ x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TyConSort_tuple_ <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TyConSort_tuple_" (Prelude.Just 0))
+{-# LINE 1171 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.TyConSort_tuple_ =
+     'Angle.TField "arity" (Glean.Nat)
+       ('Angle.TField "sort" (Glean.Schema.Hs.Types.TupleSort)
+          ('Angle.TNoFields))
+{-# LINE 1173 "glean/schema/thrift/hs_include.hs" #-}
+instance Glean.Type Glean.Schema.Hs.Types.TyConSort_sum_ where
+  buildRtsValue b (Glean.Schema.Hs.Types.TyConSort_sum_ x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Hs.Types.TyConSort_sum_ <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "hs.TyConSort_sum_" (Prelude.Just 0))
+{-# LINE 1180 "glean/schema/thrift/hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Hs.Types.TyConSort_sum_ =
+     'Angle.TField "arity" (Glean.Nat) ('Angle.TNoFields)
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/JavaAlpha/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/JavaAlpha/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/JavaAlpha/Types.hs
@@ -0,0 +1,11644 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/java_alpha_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/java_alpha_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/java_alpha_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/JavaAlpha/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.JavaAlpha.Types
+       (pREDICATE_VERSIONS, XRefFile_id,
+        XRefFile(XRefFile, xRefFile_id, xRefFile_key), XRef_id,
+        XRef(XRef, xRef_id, xRef_key), TypeVar_id,
+        TypeVar(TypeVar, typeVar_id, typeVar_key), TypeParam_id,
+        TypeParam(TypeParam, typeParam_id, typeParam_key),
+        TypeOfTypeArgs_id,
+        TypeOfTypeArgs(TypeOfTypeArgs, typeOfTypeArgs_id,
+                       typeOfTypeArgs_key),
+        TypeArg_id, TypeArg(TypeArg, typeArg_id, typeArg_key),
+        PrimitiveType_id,
+        PrimitiveType(PrimitiveType, primitiveType_id, primitiveType_key),
+        PackageDeclaration_id,
+        PackageDeclaration(PackageDeclaration, packageDeclaration_id,
+                           packageDeclaration_key),
+        ObjectType_id,
+        ObjectType(ObjectType, objectType_id, objectType_key),
+        ParameterDeclaration_id,
+        ParameterDeclaration(ParameterDeclaration, parameterDeclaration_id,
+                             parameterDeclaration_key),
+        InterfaceInheritance_id,
+        InterfaceInheritance(InterfaceInheritance, interfaceInheritance_id,
+                             interfaceInheritance_key),
+        Inheritance_id,
+        Inheritance(Inheritance, inheritance_id, inheritance_key),
+        ImportDeclaration_id,
+        ImportDeclaration(ImportDeclaration, importDeclaration_id,
+                          importDeclaration_key),
+        FileXRefs_id, FileXRefs(FileXRefs, fileXRefs_id, fileXRefs_key),
+        ExecutableDefnLocation_id,
+        ExecutableDefnLocation(ExecutableDefnLocation,
+                               executableDefnLocation_id, executableDefnLocation_key),
+        LocalDeclaration_id,
+        LocalDeclaration(LocalDeclaration, localDeclaration_id,
+                         localDeclaration_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        EnumDeclaration_id,
+        EnumDeclaration(EnumDeclaration, enumDeclaration_id,
+                        enumDeclaration_key),
+        FieldDeclaration_id,
+        FieldDeclaration(FieldDeclaration, fieldDeclaration_id,
+                         fieldDeclaration_key),
+        InterfaceDeclaration_id,
+        InterfaceDeclaration(InterfaceDeclaration, interfaceDeclaration_id,
+                             interfaceDeclaration_key),
+        MethodDeclaration_id,
+        MethodDeclaration(MethodDeclaration, methodDeclaration_id,
+                          methodDeclaration_key),
+        DeclarationAnnotations_id,
+        DeclarationAnnotations(DeclarationAnnotations,
+                               declarationAnnotations_id, declarationAnnotations_key),
+        DeclarationComment_id,
+        DeclarationComment(DeclarationComment, declarationComment_id,
+                           declarationComment_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationType_id,
+        DeclarationType(DeclarationType, declarationType_id,
+                        declarationType_key),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        DeclarationXRefTarget_id,
+        DeclarationXRefTarget(DeclarationXRefTarget,
+                              declarationXRefTarget_id, declarationXRefTarget_key),
+        ExtendedByDeclaration_id,
+        ExtendedByDeclaration(ExtendedByDeclaration,
+                              extendedByDeclaration_id, extendedByDeclaration_key),
+        ExtendsDeclaration_id,
+        ExtendsDeclaration(ExtendsDeclaration, extendsDeclaration_id,
+                           extendsDeclaration_key),
+        FileDeclarations_id,
+        FileDeclarations(FileDeclarations, fileDeclarations_id,
+                         fileDeclarations_key),
+        ParentDeclaration_id,
+        ParentDeclaration(ParentDeclaration, parentDeclaration_id,
+                          parentDeclaration_key),
+        QNameToDefinition_id,
+        QNameToDefinition(QNameToDefinition, qNameToDefinition_id,
+                          qNameToDefinition_key),
+        XRefOfType_id,
+        XRefOfType(XRefOfType, xRefOfType_id, xRefOfType_key),
+        XRefTargetDeclaration_id,
+        XRefTargetDeclaration(XRefTargetDeclaration,
+                              xRefTargetDeclaration_id, xRefTargetDeclaration_key),
+        DeclOfExecutableDefn_id,
+        DeclOfExecutableDefn(DeclOfExecutableDefn, declOfExecutableDefn_id,
+                             declOfExecutableDefn_key),
+        DeclOfDefn_id,
+        DeclOfDefn(DeclOfDefn, declOfDefn_id, declOfDefn_key),
+        ContainsDeclaration_id,
+        ContainsDeclaration(ContainsDeclaration, containsDeclaration_id,
+                            containsDeclaration_key),
+        ConstructorDeclaration_id,
+        ConstructorDeclaration(ConstructorDeclaration,
+                               constructorDeclaration_id, constructorDeclaration_key),
+        ClassDeclaration_id,
+        ClassDeclaration(ClassDeclaration, classDeclaration_id,
+                         classDeclaration_key),
+        Type_id, Type(Type, type_id, type_key), ArrayType_id,
+        ArrayType(ArrayType, arrayType_id, arrayType_key), Annotation_id,
+        Annotation(Annotation, annotation_id, annotation_key),
+        AnnotatedClass_id,
+        AnnotatedClass(AnnotatedClass, annotatedClass_id,
+                       annotatedClass_key),
+        XRefTarget(XRefTarget_EMPTY, XRefTarget_definition_,
+                   XRefTarget_ctor_, XRefTarget_method_, XRefTarget_field_),
+        XRefFile_key(XRefFile_key, xRefFile_key_xref, xRefFile_key_file),
+        XRef_key(XRef_key, xRef_key_target, xRef_key_ranges),
+        Wildcard(Wildcard_EMPTY, Wildcard_extends_, Wildcard_super_,
+                 Wildcard_unbounded),
+        TypeVar_key(TypeVar_key, typeVar_key_type, typeVar_key_span),
+        TypeParam_key(TypeParam_key, typeParam_key_name,
+                      typeParam_key_extends_, typeParam_key_span),
+        TypeOfTypeArgs_key(TypeOfTypeArgs_key,
+                           typeOfTypeArgs_key_typeWithArgs, typeOfTypeArgs_key_type),
+        TypeArg_key(TypeArg_key_EMPTY, TypeArg_key_type,
+                    TypeArg_key_wildcard),
+        PrimitiveType_key(PrimitiveType_key, primitiveType_key_type),
+        PackageDeclaration_key(PackageDeclaration_key,
+                               packageDeclaration_key_name, packageDeclaration_key_annotation,
+                               packageDeclaration_key_path, packageDeclaration_key_location),
+        ObjectType_key(ObjectType_key, objectType_key_type,
+                       objectType_key_span),
+        Modifier(Modifier_abstract_, Modifier_default_, Modifier_final_,
+                 Modifier_native_, Modifier_private_, Modifier_protected_,
+                 Modifier_public_, Modifier_static_, Modifier_strictfp_,
+                 Modifier_synchronized_, Modifier_transient_, Modifier_volatile_,
+                 Modifier__UNKNOWN),
+        ParameterDeclaration_key(ParameterDeclaration_key,
+                                 parameterDeclaration_key_name, parameterDeclaration_key_type,
+                                 parameterDeclaration_key_annotations,
+                                 parameterDeclaration_key_modifier, parameterDeclaration_key_span),
+        InterfaceInheritance_key(InterfaceInheritance_key,
+                                 interfaceInheritance_key_interface_name,
+                                 interfaceInheritance_key_subclass),
+        Inheritance_key(Inheritance_key, inheritance_key_base,
+                        inheritance_key_subclass),
+        ImportDeclaration_key(ImportDeclaration_key,
+                              importDeclaration_key_name, importDeclaration_key_import_on_demand,
+                              importDeclaration_key_static_member, importDeclaration_key_path,
+                              importDeclaration_key_location),
+        FileXRefs_key(FileXRefs_key, fileXRefs_key_file,
+                      fileXRefs_key_xrefs),
+        ExecutableDefinition(ExecutableDefinition_EMPTY,
+                             ExecutableDefinition_constructor, ExecutableDefinition_method),
+        ExecutableDefnLocation_key(ExecutableDefnLocation_key,
+                                   executableDefnLocation_key_defn, executableDefnLocation_key_name,
+                                   executableDefnLocation_key_file,
+                                   executableDefnLocation_key_span),
+        LocalDeclaration_key(LocalDeclaration_key,
+                             localDeclaration_key_name, localDeclaration_key_type,
+                             localDeclaration_key_annotations, localDeclaration_key_modifier,
+                             localDeclaration_key_container, localDeclaration_key_span),
+        Definition(Definition_EMPTY, Definition_class_,
+                   Definition_interface_, Definition_enum_),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_defn, definitionLocation_key_name,
+                               definitionLocation_key_file, definitionLocation_key_span),
+        EnumDeclaration_key(EnumDeclaration_key, enumDeclaration_key_name,
+                            enumDeclaration_key_annotations, enumDeclaration_key_modifiers,
+                            enumDeclaration_key_implements_, enumDeclaration_key_container,
+                            enumDeclaration_key_span, enumDeclaration_key_file),
+        FieldDeclaration_key(FieldDeclaration_key,
+                             fieldDeclaration_key_name, fieldDeclaration_key_type,
+                             fieldDeclaration_key_annotations, fieldDeclaration_key_modifiers,
+                             fieldDeclaration_key_container, fieldDeclaration_key_span),
+        InterfaceDeclaration_key(InterfaceDeclaration_key,
+                                 interfaceDeclaration_key_name,
+                                 interfaceDeclaration_key_annotations,
+                                 interfaceDeclaration_key_modifiers,
+                                 interfaceDeclaration_key_extends_,
+                                 interfaceDeclaration_key_container,
+                                 interfaceDeclaration_key_typeParams, interfaceDeclaration_key_span,
+                                 interfaceDeclaration_key_file),
+        MethodDeclaration_key(MethodDeclaration_key,
+                              methodDeclaration_key_name, methodDeclaration_key_parameters,
+                              methodDeclaration_key_returnType,
+                              methodDeclaration_key_annotations, methodDeclaration_key_modifiers,
+                              methodDeclaration_key_typeParams, methodDeclaration_key_throws_,
+                              methodDeclaration_key_container, methodDeclaration_key_span),
+        Declaration(Declaration_EMPTY, Declaration_param,
+                    Declaration_local, Declaration_field, Declaration_ctor,
+                    Declaration_method, Declaration_interface_, Declaration_class_,
+                    Declaration_enum_),
+        DeclarationAnnotations_key(DeclarationAnnotations_key,
+                                   declarationAnnotations_key_decl,
+                                   declarationAnnotations_key_annotations),
+        DeclarationComment_key(DeclarationComment_key,
+                               declarationComment_key_declaration, declarationComment_key_file,
+                               declarationComment_key_span),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_decl, declarationLocation_key_name,
+                                declarationLocation_key_file, declarationLocation_key_span),
+        DeclarationType_key(DeclarationType_key, declarationType_key_decl,
+                            declarationType_key_type),
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_target, declarationUses_key_file,
+                            declarationUses_key_uses),
+        DeclarationXRefTarget_key(DeclarationXRefTarget_key,
+                                  declarationXRefTarget_key_decl, declarationXRefTarget_key_xref),
+        ExtendedByDeclaration_key(ExtendedByDeclaration_key,
+                                  extendedByDeclaration_key_parent,
+                                  extendedByDeclaration_key_child),
+        ExtendsDeclaration_key(ExtendsDeclaration_key,
+                               extendsDeclaration_key_child, extendsDeclaration_key_parent),
+        FileDeclarations_key(FileDeclarations_key,
+                             fileDeclarations_key_file, fileDeclarations_key_decl),
+        ParentDeclaration_key(ParentDeclaration_key,
+                              parentDeclaration_key_child, parentDeclaration_key_parent),
+        QNameToDefinition_key(QNameToDefinition_key,
+                              qNameToDefinition_key_name, qNameToDefinition_key_defn),
+        XRefOfType_key(XRefOfType_key, xRefOfType_key_type,
+                       xRefOfType_key_decl, xRefOfType_key_use),
+        XRefTargetDeclaration_key(XRefTargetDeclaration_key,
+                                  xRefTargetDeclaration_key_xref, xRefTargetDeclaration_key_decl),
+        DeclOfExecutableDefn_key(DeclOfExecutableDefn_key,
+                                 declOfExecutableDefn_key_defn, declOfExecutableDefn_key_decl),
+        DeclOfDefn_key(DeclOfDefn_key, declOfDefn_key_defn,
+                       declOfDefn_key_decl),
+        ContainsDeclaration_key(ContainsDeclaration_key,
+                                containsDeclaration_key_container, containsDeclaration_key_member),
+        ConstructorDeclaration_key(ConstructorDeclaration_key,
+                                   constructorDeclaration_key_name,
+                                   constructorDeclaration_key_parameters,
+                                   constructorDeclaration_key_annotations,
+                                   constructorDeclaration_key_modifiers,
+                                   constructorDeclaration_key_typeParams,
+                                   constructorDeclaration_key_throws_,
+                                   constructorDeclaration_key_container,
+                                   constructorDeclaration_key_span),
+        ClassDeclaration_key(ClassDeclaration_key,
+                             classDeclaration_key_name, classDeclaration_key_modifiers,
+                             classDeclaration_key_extends_, classDeclaration_key_implements_,
+                             classDeclaration_key_annotations, classDeclaration_key_container,
+                             classDeclaration_key_typeParams, classDeclaration_key_span,
+                             classDeclaration_key_file),
+        BaseType(BaseType_EMPTY, BaseType_object, BaseType_primitive,
+                 BaseType_variable, BaseType_array),
+        Type_key(Type_key, type_key_baseType, type_key_typeArgs,
+                 type_key_interopType, type_key_span),
+        ArrayType_key(ArrayType_key, arrayType_key_contents,
+                      arrayType_key_span),
+        Annotation_key(Annotation_key, annotation_key_name,
+                       annotation_key_constructor, annotation_key_constant,
+                       annotation_key_span),
+        AnnotatedClass_key(AnnotatedClass_key,
+                           annotatedClass_key_annotation, annotatedClass_key_class_))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.JavakotlinAlpha.Types
+       as Glean.Schema.JavakotlinAlpha
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Schema.JavakotlinAlpha.Types
+{-# LINE 16 "glean/schema/thrift/java_alpha_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 331 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/JavaAlpha/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("ClassDeclaration", 1), ("InterfaceInheritance", 1), ("Type", 1),
+       ("TypeParam", 1), ("DeclarationComment", 1),
+       ("MethodDeclaration", 1), ("XRefFile", 1), ("XRef", 1),
+       ("DeclOfExecutableDefn", 1), ("TypeArg", 1), ("Inheritance", 1),
+       ("TypeOfTypeArgs", 1), ("ParameterDeclaration", 1),
+       ("FileDeclarations", 1), ("ExtendedByDeclaration", 1),
+       ("FieldDeclaration", 1), ("FileXRefs", 1),
+       ("ImportDeclaration", 1), ("EnumDeclaration", 1),
+       ("DefinitionLocation", 1), ("ContainsDeclaration", 1),
+       ("ObjectType", 1), ("DeclarationAnnotations", 1),
+       ("DeclarationUses", 1), ("LocalDeclaration", 1),
+       ("PackageDeclaration", 1), ("ParentDeclaration", 1),
+       ("DeclarationLocation", 1), ("DeclarationXRefTarget", 1),
+       ("TypeVar", 1), ("XRefTargetDeclaration", 1),
+       ("InterfaceDeclaration", 1), ("QNameToDefinition", 1),
+       ("ArrayType", 1), ("ConstructorDeclaration", 1), ("Annotation", 1),
+       ("DeclOfDefn", 1), ("AnnotatedClass", 1), ("XRefOfType", 1),
+       ("DeclarationType", 1), ("ExtendsDeclaration", 1),
+       ("ExecutableDefnLocation", 1), ("PrimitiveType", 1)]
+
+type XRefFile_id = Glean.Id
+
+data XRefFile = XRefFile{xRefFile_id ::
+                         {-# UNPACK #-} !XRefFile_id,
+                         xRefFile_key :: Prelude.Maybe XRefFile_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefFile where
+  toJSON (XRefFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefFile where
+  buildStruct _proxy (XRefFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefFile where
+  rnf (XRefFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefFile where
+  def = XRefFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefFile where
+  hashWithSalt __salt (XRefFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRef_id = Glean.Id
+
+data XRef = XRef{xRef_id :: {-# UNPACK #-} !XRef_id,
+                 xRef_key :: Prelude.Maybe XRef_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef where
+  toJSON (XRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef where
+  buildStruct _proxy (XRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef where
+  rnf (XRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRef where
+  def = XRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRef where
+  hashWithSalt __salt (XRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeVar_id = Glean.Id
+
+data TypeVar = TypeVar{typeVar_id :: {-# UNPACK #-} !TypeVar_id,
+                       typeVar_key :: Prelude.Maybe TypeVar_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeVar where
+  toJSON (TypeVar __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeVar where
+  buildStruct _proxy (TypeVar __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeVar __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeVar where
+  rnf (TypeVar __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeVar where
+  def = TypeVar Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeVar where
+  hashWithSalt __salt (TypeVar _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeParam_id = Glean.Id
+
+data TypeParam = TypeParam{typeParam_id ::
+                           {-# UNPACK #-} !TypeParam_id,
+                           typeParam_key :: Prelude.Maybe TypeParam_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeParam where
+  toJSON (TypeParam __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeParam where
+  buildStruct _proxy (TypeParam __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeParam __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeParam where
+  rnf (TypeParam __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeParam where
+  def = TypeParam Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeParam where
+  hashWithSalt __salt (TypeParam _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeOfTypeArgs_id = Glean.Id
+
+data TypeOfTypeArgs = TypeOfTypeArgs{typeOfTypeArgs_id ::
+                                     {-# UNPACK #-} !TypeOfTypeArgs_id,
+                                     typeOfTypeArgs_key :: Prelude.Maybe TypeOfTypeArgs_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeOfTypeArgs where
+  toJSON (TypeOfTypeArgs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeOfTypeArgs where
+  buildStruct _proxy (TypeOfTypeArgs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeOfTypeArgs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeOfTypeArgs where
+  rnf (TypeOfTypeArgs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeOfTypeArgs where
+  def = TypeOfTypeArgs Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeOfTypeArgs where
+  hashWithSalt __salt (TypeOfTypeArgs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeArg_id = Glean.Id
+
+data TypeArg = TypeArg{typeArg_id :: {-# UNPACK #-} !TypeArg_id,
+                       typeArg_key :: Prelude.Maybe TypeArg_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeArg where
+  toJSON (TypeArg __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeArg where
+  buildStruct _proxy (TypeArg __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeArg __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeArg where
+  rnf (TypeArg __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeArg where
+  def = TypeArg Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeArg where
+  hashWithSalt __salt (TypeArg _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PrimitiveType_id = Glean.Id
+
+data PrimitiveType = PrimitiveType{primitiveType_id ::
+                                   {-# UNPACK #-} !PrimitiveType_id,
+                                   primitiveType_key :: Prelude.Maybe PrimitiveType_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PrimitiveType where
+  toJSON (PrimitiveType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PrimitiveType where
+  buildStruct _proxy (PrimitiveType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PrimitiveType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PrimitiveType where
+  rnf (PrimitiveType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PrimitiveType where
+  def = PrimitiveType Default.def Prelude.Nothing
+
+instance Hashable.Hashable PrimitiveType where
+  hashWithSalt __salt (PrimitiveType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PackageDeclaration_id = Glean.Id
+
+data PackageDeclaration = PackageDeclaration{packageDeclaration_id
+                                             :: {-# UNPACK #-} !PackageDeclaration_id,
+                                             packageDeclaration_key ::
+                                             Prelude.Maybe PackageDeclaration_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackageDeclaration where
+  toJSON (PackageDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PackageDeclaration where
+  buildStruct _proxy (PackageDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PackageDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PackageDeclaration where
+  rnf (PackageDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PackageDeclaration where
+  def = PackageDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable PackageDeclaration where
+  hashWithSalt __salt (PackageDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ObjectType_id = Glean.Id
+
+data ObjectType = ObjectType{objectType_id ::
+                             {-# UNPACK #-} !ObjectType_id,
+                             objectType_key :: Prelude.Maybe ObjectType_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectType where
+  toJSON (ObjectType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectType where
+  buildStruct _proxy (ObjectType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ObjectType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectType where
+  rnf (ObjectType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ObjectType where
+  def = ObjectType Default.def Prelude.Nothing
+
+instance Hashable.Hashable ObjectType where
+  hashWithSalt __salt (ObjectType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ParameterDeclaration_id = Glean.Id
+
+data ParameterDeclaration = ParameterDeclaration{parameterDeclaration_id
+                                                 :: {-# UNPACK #-} !ParameterDeclaration_id,
+                                                 parameterDeclaration_key ::
+                                                 Prelude.Maybe ParameterDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParameterDeclaration where
+  toJSON (ParameterDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ParameterDeclaration where
+  buildStruct _proxy (ParameterDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ParameterDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParameterDeclaration where
+  rnf (ParameterDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ParameterDeclaration where
+  def = ParameterDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ParameterDeclaration where
+  hashWithSalt __salt (ParameterDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InterfaceInheritance_id = Glean.Id
+
+data InterfaceInheritance = InterfaceInheritance{interfaceInheritance_id
+                                                 :: {-# UNPACK #-} !InterfaceInheritance_id,
+                                                 interfaceInheritance_key ::
+                                                 Prelude.Maybe InterfaceInheritance_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceInheritance where
+  toJSON (InterfaceInheritance __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceInheritance where
+  buildStruct _proxy (InterfaceInheritance __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (InterfaceInheritance __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceInheritance where
+  rnf (InterfaceInheritance __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InterfaceInheritance where
+  def = InterfaceInheritance Default.def Prelude.Nothing
+
+instance Hashable.Hashable InterfaceInheritance where
+  hashWithSalt __salt (InterfaceInheritance _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Inheritance_id = Glean.Id
+
+data Inheritance = Inheritance{inheritance_id ::
+                               {-# UNPACK #-} !Inheritance_id,
+                               inheritance_key :: Prelude.Maybe Inheritance_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Inheritance where
+  toJSON (Inheritance __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Inheritance where
+  buildStruct _proxy (Inheritance __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Inheritance __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Inheritance where
+  rnf (Inheritance __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Inheritance where
+  def = Inheritance Default.def Prelude.Nothing
+
+instance Hashable.Hashable Inheritance where
+  hashWithSalt __salt (Inheritance _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportDeclaration_id = Glean.Id
+
+data ImportDeclaration = ImportDeclaration{importDeclaration_id ::
+                                           {-# UNPACK #-} !ImportDeclaration_id,
+                                           importDeclaration_key ::
+                                           Prelude.Maybe ImportDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportDeclaration where
+  toJSON (ImportDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportDeclaration where
+  buildStruct _proxy (ImportDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportDeclaration where
+  rnf (ImportDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportDeclaration where
+  def = ImportDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportDeclaration where
+  hashWithSalt __salt (ImportDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXRefs_id = Glean.Id
+
+data FileXRefs = FileXRefs{fileXRefs_id ::
+                           {-# UNPACK #-} !FileXRefs_id,
+                           fileXRefs_key :: Prelude.Maybe FileXRefs_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs where
+  toJSON (FileXRefs __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs where
+  buildStruct _proxy (FileXRefs __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXRefs __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs where
+  rnf (FileXRefs __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXRefs where
+  def = FileXRefs Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXRefs where
+  hashWithSalt __salt (FileXRefs _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExecutableDefnLocation_id = Glean.Id
+
+data ExecutableDefnLocation = ExecutableDefnLocation{executableDefnLocation_id
+                                                     :: {-# UNPACK #-} !ExecutableDefnLocation_id,
+                                                     executableDefnLocation_key ::
+                                                     Prelude.Maybe ExecutableDefnLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExecutableDefnLocation where
+  toJSON (ExecutableDefnLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExecutableDefnLocation where
+  buildStruct _proxy
+    (ExecutableDefnLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ExecutableDefnLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExecutableDefnLocation where
+  rnf (ExecutableDefnLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExecutableDefnLocation where
+  def = ExecutableDefnLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExecutableDefnLocation where
+  hashWithSalt __salt (ExecutableDefnLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocalDeclaration_id = Glean.Id
+
+data LocalDeclaration = LocalDeclaration{localDeclaration_id ::
+                                         {-# UNPACK #-} !LocalDeclaration_id,
+                                         localDeclaration_key :: Prelude.Maybe LocalDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalDeclaration where
+  toJSON (LocalDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalDeclaration where
+  buildStruct _proxy (LocalDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocalDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalDeclaration where
+  rnf (LocalDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocalDeclaration where
+  def = LocalDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocalDeclaration where
+  hashWithSalt __salt (LocalDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EnumDeclaration_id = Glean.Id
+
+data EnumDeclaration = EnumDeclaration{enumDeclaration_id ::
+                                       {-# UNPACK #-} !EnumDeclaration_id,
+                                       enumDeclaration_key :: Prelude.Maybe EnumDeclaration_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration where
+  toJSON (EnumDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumDeclaration where
+  buildStruct _proxy (EnumDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EnumDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration where
+  rnf (EnumDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration where
+  def = EnumDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable EnumDeclaration where
+  hashWithSalt __salt (EnumDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FieldDeclaration_id = Glean.Id
+
+data FieldDeclaration = FieldDeclaration{fieldDeclaration_id ::
+                                         {-# UNPACK #-} !FieldDeclaration_id,
+                                         fieldDeclaration_key :: Prelude.Maybe FieldDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDeclaration where
+  toJSON (FieldDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDeclaration where
+  buildStruct _proxy (FieldDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FieldDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDeclaration where
+  rnf (FieldDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FieldDeclaration where
+  def = FieldDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FieldDeclaration where
+  hashWithSalt __salt (FieldDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type InterfaceDeclaration_id = Glean.Id
+
+data InterfaceDeclaration = InterfaceDeclaration{interfaceDeclaration_id
+                                                 :: {-# UNPACK #-} !InterfaceDeclaration_id,
+                                                 interfaceDeclaration_key ::
+                                                 Prelude.Maybe InterfaceDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDeclaration where
+  toJSON (InterfaceDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceDeclaration where
+  buildStruct _proxy (InterfaceDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (InterfaceDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDeclaration where
+  rnf (InterfaceDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default InterfaceDeclaration where
+  def = InterfaceDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable InterfaceDeclaration where
+  hashWithSalt __salt (InterfaceDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodDeclaration_id = Glean.Id
+
+data MethodDeclaration = MethodDeclaration{methodDeclaration_id ::
+                                           {-# UNPACK #-} !MethodDeclaration_id,
+                                           methodDeclaration_key ::
+                                           Prelude.Maybe MethodDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration where
+  toJSON (MethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDeclaration where
+  buildStruct _proxy (MethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration where
+  rnf (MethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration where
+  def = MethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodDeclaration where
+  hashWithSalt __salt (MethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationAnnotations_id = Glean.Id
+
+data DeclarationAnnotations = DeclarationAnnotations{declarationAnnotations_id
+                                                     :: {-# UNPACK #-} !DeclarationAnnotations_id,
+                                                     declarationAnnotations_key ::
+                                                     Prelude.Maybe DeclarationAnnotations_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationAnnotations where
+  toJSON (DeclarationAnnotations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationAnnotations where
+  buildStruct _proxy
+    (DeclarationAnnotations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationAnnotations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationAnnotations where
+  rnf (DeclarationAnnotations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationAnnotations where
+  def = DeclarationAnnotations Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationAnnotations where
+  hashWithSalt __salt (DeclarationAnnotations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationComment_id = Glean.Id
+
+data DeclarationComment = DeclarationComment{declarationComment_id
+                                             :: {-# UNPACK #-} !DeclarationComment_id,
+                                             declarationComment_key ::
+                                             Prelude.Maybe DeclarationComment_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment where
+  toJSON (DeclarationComment __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment where
+  buildStruct _proxy (DeclarationComment __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationComment __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment where
+  rnf (DeclarationComment __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationComment where
+  def = DeclarationComment Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationComment where
+  hashWithSalt __salt (DeclarationComment _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationType_id = Glean.Id
+
+data DeclarationType = DeclarationType{declarationType_id ::
+                                       {-# UNPACK #-} !DeclarationType_id,
+                                       declarationType_key :: Prelude.Maybe DeclarationType_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationType where
+  toJSON (DeclarationType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationType where
+  buildStruct _proxy (DeclarationType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationType where
+  rnf (DeclarationType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationType where
+  def = DeclarationType Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationType where
+  hashWithSalt __salt (DeclarationType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationXRefTarget_id = Glean.Id
+
+data DeclarationXRefTarget = DeclarationXRefTarget{declarationXRefTarget_id
+                                                   :: {-# UNPACK #-} !DeclarationXRefTarget_id,
+                                                   declarationXRefTarget_key ::
+                                                   Prelude.Maybe DeclarationXRefTarget_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationXRefTarget where
+  toJSON (DeclarationXRefTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationXRefTarget where
+  buildStruct _proxy (DeclarationXRefTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationXRefTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationXRefTarget where
+  rnf (DeclarationXRefTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationXRefTarget where
+  def = DeclarationXRefTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationXRefTarget where
+  hashWithSalt __salt (DeclarationXRefTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendedByDeclaration_id = Glean.Id
+
+data ExtendedByDeclaration = ExtendedByDeclaration{extendedByDeclaration_id
+                                                   :: {-# UNPACK #-} !ExtendedByDeclaration_id,
+                                                   extendedByDeclaration_key ::
+                                                   Prelude.Maybe ExtendedByDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendedByDeclaration where
+  toJSON (ExtendedByDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendedByDeclaration where
+  buildStruct _proxy (ExtendedByDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ExtendedByDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendedByDeclaration where
+  rnf (ExtendedByDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendedByDeclaration where
+  def = ExtendedByDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendedByDeclaration where
+  hashWithSalt __salt (ExtendedByDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendsDeclaration_id = Glean.Id
+
+data ExtendsDeclaration = ExtendsDeclaration{extendsDeclaration_id
+                                             :: {-# UNPACK #-} !ExtendsDeclaration_id,
+                                             extendsDeclaration_key ::
+                                             Prelude.Maybe ExtendsDeclaration_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsDeclaration where
+  toJSON (ExtendsDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsDeclaration where
+  buildStruct _proxy (ExtendsDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExtendsDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsDeclaration where
+  rnf (ExtendsDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendsDeclaration where
+  def = ExtendsDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendsDeclaration where
+  hashWithSalt __salt (ExtendsDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclarations_id = Glean.Id
+
+data FileDeclarations = FileDeclarations{fileDeclarations_id ::
+                                         {-# UNPACK #-} !FileDeclarations_id,
+                                         fileDeclarations_key :: Prelude.Maybe FileDeclarations_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations where
+  toJSON (FileDeclarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations where
+  buildStruct _proxy (FileDeclarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations where
+  rnf (FileDeclarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclarations where
+  def = FileDeclarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclarations where
+  hashWithSalt __salt (FileDeclarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ParentDeclaration_id = Glean.Id
+
+data ParentDeclaration = ParentDeclaration{parentDeclaration_id ::
+                                           {-# UNPACK #-} !ParentDeclaration_id,
+                                           parentDeclaration_key ::
+                                           Prelude.Maybe ParentDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParentDeclaration where
+  toJSON (ParentDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ParentDeclaration where
+  buildStruct _proxy (ParentDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ParentDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParentDeclaration where
+  rnf (ParentDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ParentDeclaration where
+  def = ParentDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ParentDeclaration where
+  hashWithSalt __salt (ParentDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QNameToDefinition_id = Glean.Id
+
+data QNameToDefinition = QNameToDefinition{qNameToDefinition_id ::
+                                           {-# UNPACK #-} !QNameToDefinition_id,
+                                           qNameToDefinition_key ::
+                                           Prelude.Maybe QNameToDefinition_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QNameToDefinition where
+  toJSON (QNameToDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QNameToDefinition where
+  buildStruct _proxy (QNameToDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QNameToDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QNameToDefinition where
+  rnf (QNameToDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QNameToDefinition where
+  def = QNameToDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable QNameToDefinition where
+  hashWithSalt __salt (QNameToDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefOfType_id = Glean.Id
+
+data XRefOfType = XRefOfType{xRefOfType_id ::
+                             {-# UNPACK #-} !XRefOfType_id,
+                             xRefOfType_key :: Prelude.Maybe XRefOfType_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefOfType where
+  toJSON (XRefOfType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefOfType where
+  buildStruct _proxy (XRefOfType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefOfType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefOfType where
+  rnf (XRefOfType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefOfType where
+  def = XRefOfType Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefOfType where
+  hashWithSalt __salt (XRefOfType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefTargetDeclaration_id = Glean.Id
+
+data XRefTargetDeclaration = XRefTargetDeclaration{xRefTargetDeclaration_id
+                                                   :: {-# UNPACK #-} !XRefTargetDeclaration_id,
+                                                   xRefTargetDeclaration_key ::
+                                                   Prelude.Maybe XRefTargetDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTargetDeclaration where
+  toJSON (XRefTargetDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTargetDeclaration where
+  buildStruct _proxy (XRefTargetDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (XRefTargetDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTargetDeclaration where
+  rnf (XRefTargetDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefTargetDeclaration where
+  def = XRefTargetDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefTargetDeclaration where
+  hashWithSalt __salt (XRefTargetDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclOfExecutableDefn_id = Glean.Id
+
+data DeclOfExecutableDefn = DeclOfExecutableDefn{declOfExecutableDefn_id
+                                                 :: {-# UNPACK #-} !DeclOfExecutableDefn_id,
+                                                 declOfExecutableDefn_key ::
+                                                 Prelude.Maybe DeclOfExecutableDefn_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclOfExecutableDefn where
+  toJSON (DeclOfExecutableDefn __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclOfExecutableDefn where
+  buildStruct _proxy (DeclOfExecutableDefn __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclOfExecutableDefn __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclOfExecutableDefn where
+  rnf (DeclOfExecutableDefn __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclOfExecutableDefn where
+  def = DeclOfExecutableDefn Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclOfExecutableDefn where
+  hashWithSalt __salt (DeclOfExecutableDefn _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclOfDefn_id = Glean.Id
+
+data DeclOfDefn = DeclOfDefn{declOfDefn_id ::
+                             {-# UNPACK #-} !DeclOfDefn_id,
+                             declOfDefn_key :: Prelude.Maybe DeclOfDefn_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclOfDefn where
+  toJSON (DeclOfDefn __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclOfDefn where
+  buildStruct _proxy (DeclOfDefn __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclOfDefn __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclOfDefn where
+  rnf (DeclOfDefn __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclOfDefn where
+  def = DeclOfDefn Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclOfDefn where
+  hashWithSalt __salt (DeclOfDefn _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainsDeclaration_id = Glean.Id
+
+data ContainsDeclaration = ContainsDeclaration{containsDeclaration_id
+                                               :: {-# UNPACK #-} !ContainsDeclaration_id,
+                                               containsDeclaration_key ::
+                                               Prelude.Maybe ContainsDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsDeclaration where
+  toJSON (ContainsDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsDeclaration where
+  buildStruct _proxy (ContainsDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainsDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsDeclaration where
+  rnf (ContainsDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainsDeclaration where
+  def = ContainsDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainsDeclaration where
+  hashWithSalt __salt (ContainsDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ConstructorDeclaration_id = Glean.Id
+
+data ConstructorDeclaration = ConstructorDeclaration{constructorDeclaration_id
+                                                     :: {-# UNPACK #-} !ConstructorDeclaration_id,
+                                                     constructorDeclaration_key ::
+                                                     Prelude.Maybe ConstructorDeclaration_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstructorDeclaration where
+  toJSON (ConstructorDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstructorDeclaration where
+  buildStruct _proxy
+    (ConstructorDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ConstructorDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstructorDeclaration where
+  rnf (ConstructorDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ConstructorDeclaration where
+  def = ConstructorDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ConstructorDeclaration where
+  hashWithSalt __salt (ConstructorDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDeclaration_id = Glean.Id
+
+data ClassDeclaration = ClassDeclaration{classDeclaration_id ::
+                                         {-# UNPACK #-} !ClassDeclaration_id,
+                                         classDeclaration_key :: Prelude.Maybe ClassDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration where
+  toJSON (ClassDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration where
+  buildStruct _proxy (ClassDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration where
+  rnf (ClassDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration where
+  def = ClassDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDeclaration where
+  hashWithSalt __salt (ClassDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Type_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ArrayType_id = Glean.Id
+
+data ArrayType = ArrayType{arrayType_id ::
+                           {-# UNPACK #-} !ArrayType_id,
+                           arrayType_key :: Prelude.Maybe ArrayType_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArrayType where
+  toJSON (ArrayType __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ArrayType where
+  buildStruct _proxy (ArrayType __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ArrayType __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArrayType where
+  rnf (ArrayType __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ArrayType where
+  def = ArrayType Default.def Prelude.Nothing
+
+instance Hashable.Hashable ArrayType where
+  hashWithSalt __salt (ArrayType _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Annotation_id = Glean.Id
+
+data Annotation = Annotation{annotation_id ::
+                             {-# UNPACK #-} !Annotation_id,
+                             annotation_key :: Prelude.Maybe Annotation_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotation where
+  toJSON (Annotation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Annotation where
+  buildStruct _proxy (Annotation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Annotation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Annotation where
+  rnf (Annotation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Annotation where
+  def = Annotation Default.def Prelude.Nothing
+
+instance Hashable.Hashable Annotation where
+  hashWithSalt __salt (Annotation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AnnotatedClass_id = Glean.Id
+
+data AnnotatedClass = AnnotatedClass{annotatedClass_id ::
+                                     {-# UNPACK #-} !AnnotatedClass_id,
+                                     annotatedClass_key :: Prelude.Maybe AnnotatedClass_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AnnotatedClass where
+  toJSON (AnnotatedClass __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AnnotatedClass where
+  buildStruct _proxy (AnnotatedClass __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AnnotatedClass __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AnnotatedClass where
+  rnf (AnnotatedClass __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AnnotatedClass where
+  def = AnnotatedClass Default.def Prelude.Nothing
+
+instance Hashable.Hashable AnnotatedClass where
+  hashWithSalt __salt (AnnotatedClass _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefTarget = XRefTarget_definition_ Glean.Schema.JavakotlinAlpha.QName
+                | XRefTarget_ctor_ Glean.Schema.JavakotlinAlpha.MethodName
+                | XRefTarget_method_ Glean.Schema.JavakotlinAlpha.MethodName
+                | XRefTarget_field_ Glean.Schema.JavakotlinAlpha.QName
+                | XRefTarget_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTarget where
+  toJSON (XRefTarget_definition_ __definition_)
+    = Aeson.object ["definition_" .= __definition_]
+  toJSON (XRefTarget_ctor_ __ctor_)
+    = Aeson.object ["ctor_" .= __ctor_]
+  toJSON (XRefTarget_method_ __method_)
+    = Aeson.object ["method_" .= __method_]
+  toJSON (XRefTarget_field_ __field_)
+    = Aeson.object ["field_" .= __field_]
+  toJSON XRefTarget_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct XRefTarget where
+  buildStruct _proxy (XRefTarget_definition_ __definition_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "definition_" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __definition_)]
+  buildStruct _proxy (XRefTarget_ctor_ __ctor_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ctor_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __ctor_)]
+  buildStruct _proxy (XRefTarget_method_ __method_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __method_)]
+  buildStruct _proxy (XRefTarget_field_ __field_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field_" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __field_)]
+  buildStruct _proxy XRefTarget_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (XRefTarget_definition_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_ctor_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_method_ _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (XRefTarget_field_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return XRefTarget_EMPTY
+           Thrift.FieldEnd -> Prelude.return XRefTarget_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("definition_", 1), ("ctor_", 2), ("method_", 3), ("field_", 4)]
+
+instance DeepSeq.NFData XRefTarget where
+  rnf (XRefTarget_definition_ __definition_)
+    = DeepSeq.rnf __definition_
+  rnf (XRefTarget_ctor_ __ctor_) = DeepSeq.rnf __ctor_
+  rnf (XRefTarget_method_ __method_) = DeepSeq.rnf __method_
+  rnf (XRefTarget_field_ __field_) = DeepSeq.rnf __field_
+  rnf XRefTarget_EMPTY = ()
+
+instance Default.Default XRefTarget where
+  def = XRefTarget_EMPTY
+
+instance Hashable.Hashable XRefTarget where
+  hashWithSalt __salt (XRefTarget_definition_ _definition_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _definition_)
+  hashWithSalt __salt (XRefTarget_ctor_ _ctor_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _ctor_)
+  hashWithSalt __salt (XRefTarget_method_ _method_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _method_)
+  hashWithSalt __salt (XRefTarget_field_ _field_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _field_)
+  hashWithSalt __salt XRefTarget_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data XRefFile_key = XRefFile_key{xRefFile_key_xref :: XRef,
+                                 xRefFile_key_file :: Glean.Schema.Src.File}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefFile_key where
+  toJSON (XRefFile_key __field__xref __field__file)
+    = Aeson.object
+        ("xref" .= __field__xref :
+           "file" .= __field__file : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefFile_key where
+  buildStruct _proxy (XRefFile_key __field__xref __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__xref)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xref <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure (XRefFile_key __val__xref __val__file)
+              _idMap = HashMap.fromList [("xref", 1), ("file", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefFile_key where
+  rnf (XRefFile_key __field__xref __field__file)
+    = DeepSeq.rnf __field__xref `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default XRefFile_key where
+  def = XRefFile_key Default.def Default.def
+
+instance Hashable.Hashable XRefFile_key where
+  hashWithSalt __salt (XRefFile_key _xref _file)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xref) _file
+
+data XRef_key = XRef_key{xRef_key_target :: XRefTarget,
+                         xRef_key_ranges :: [Glean.Schema.Src.ByteSpan]}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRef_key where
+  toJSON (XRef_key __field__target __field__ranges)
+    = Aeson.object
+        ("target" .= __field__target :
+           "ranges" .= __field__ranges : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRef_key where
+  buildStruct _proxy (XRef_key __field__target __field__ranges)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "ranges" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__ranges)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__ranges <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__ranges
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__ranges <- ST.readSTRef __field__ranges
+                                             Prelude.pure (XRef_key __val__target __val__ranges)
+              _idMap = HashMap.fromList [("target", 1), ("ranges", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRef_key where
+  rnf (XRef_key __field__target __field__ranges)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__ranges `Prelude.seq` ()
+
+instance Default.Default XRef_key where
+  def = XRef_key Default.def Default.def
+
+instance Hashable.Hashable XRef_key where
+  hashWithSalt __salt (XRef_key _target _ranges)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _ranges
+
+data Wildcard = Wildcard_extends_ Type
+              | Wildcard_super_ Type
+              | Wildcard_unbounded Prelude.Bool
+              | Wildcard_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Wildcard where
+  toJSON (Wildcard_extends_ __extends_)
+    = Aeson.object ["extends_" .= __extends_]
+  toJSON (Wildcard_super_ __super_)
+    = Aeson.object ["super_" .= __super_]
+  toJSON (Wildcard_unbounded __unbounded)
+    = Aeson.object ["unbounded" .= __unbounded]
+  toJSON Wildcard_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Wildcard where
+  buildStruct _proxy (Wildcard_extends_ __extends_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "extends_" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __extends_)]
+  buildStruct _proxy (Wildcard_super_ __super_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "super_" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __super_)]
+  buildStruct _proxy (Wildcard_unbounded __unbounded)
+    = Thrift.genStruct _proxy
+        [Thrift.genFieldBool _proxy "unbounded" 3 0 __unbounded]
+  buildStruct _proxy Wildcard_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Wildcard_extends_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Wildcard_super_ _val)
+                                                     3 | _type == Thrift.getBoolType _proxy ->
+                                                         do _val <- Thrift.parseBoolF _proxy _bool
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Wildcard_unbounded _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Wildcard_EMPTY
+           Thrift.FieldEnd -> Prelude.return Wildcard_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("extends_", 1), ("super_", 2), ("unbounded", 3)]
+
+instance DeepSeq.NFData Wildcard where
+  rnf (Wildcard_extends_ __extends_) = DeepSeq.rnf __extends_
+  rnf (Wildcard_super_ __super_) = DeepSeq.rnf __super_
+  rnf (Wildcard_unbounded __unbounded) = DeepSeq.rnf __unbounded
+  rnf Wildcard_EMPTY = ()
+
+instance Default.Default Wildcard where
+  def = Wildcard_EMPTY
+
+instance Hashable.Hashable Wildcard where
+  hashWithSalt __salt (Wildcard_extends_ _extends_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _extends_)
+  hashWithSalt __salt (Wildcard_super_ _super_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _super_)
+  hashWithSalt __salt (Wildcard_unbounded _unbounded)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _unbounded)
+  hashWithSalt __salt Wildcard_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data TypeVar_key = TypeVar_key{typeVar_key_type ::
+                               Glean.Schema.JavakotlinAlpha.Name,
+                               typeVar_key_span :: Glean.Schema.Src.ByteSpan}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeVar_key where
+  toJSON (TypeVar_key __field__type __field__span)
+    = Aeson.object
+        ("type" .= __field__type :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeVar_key where
+  buildStruct _proxy (TypeVar_key __field__type __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (TypeVar_key __val__type __val__span)
+              _idMap = HashMap.fromList [("type", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeVar_key where
+  rnf (TypeVar_key __field__type __field__span)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default TypeVar_key where
+  def = TypeVar_key Default.def Default.def
+
+instance Hashable.Hashable TypeVar_key where
+  hashWithSalt __salt (TypeVar_key _type _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _span
+
+data TypeParam_key = TypeParam_key{typeParam_key_name ::
+                                   Glean.Schema.JavakotlinAlpha.Name,
+                                   typeParam_key_extends_ :: [Type],
+                                   typeParam_key_span :: Glean.Schema.Src.ByteSpan}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeParam_key where
+  toJSON
+    (TypeParam_key __field__name __field__extends_ __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "extends_" .= __field__extends_ :
+             "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeParam_key where
+  buildStruct _proxy
+    (TypeParam_key __field__name __field__extends_ __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "extends_" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__extends_)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__extends_ <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__extends_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__extends_ <- ST.readSTRef __field__extends_
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (TypeParam_key __val__name __val__extends_
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("name", 1), ("extends_", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeParam_key where
+  rnf (TypeParam_key __field__name __field__extends_ __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__extends_ `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default TypeParam_key where
+  def = TypeParam_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TypeParam_key where
+  hashWithSalt __salt (TypeParam_key _name _extends_ _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _extends_)
+        _span
+
+data TypeOfTypeArgs_key = TypeOfTypeArgs_key{typeOfTypeArgs_key_typeWithArgs
+                                             :: Type,
+                                             typeOfTypeArgs_key_type :: Type}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeOfTypeArgs_key where
+  toJSON (TypeOfTypeArgs_key __field__typeWithArgs __field__type)
+    = Aeson.object
+        ("typeWithArgs" .= __field__typeWithArgs :
+           "type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeOfTypeArgs_key where
+  buildStruct _proxy
+    (TypeOfTypeArgs_key __field__typeWithArgs __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "typeWithArgs"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__typeWithArgs)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__typeWithArgs <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeWithArgs
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__typeWithArgs <- ST.readSTRef
+                                                                       __field__typeWithArgs
+                                             !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure
+                                               (TypeOfTypeArgs_key __val__typeWithArgs __val__type)
+              _idMap = HashMap.fromList [("typeWithArgs", 1), ("type", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeOfTypeArgs_key where
+  rnf (TypeOfTypeArgs_key __field__typeWithArgs __field__type)
+    = DeepSeq.rnf __field__typeWithArgs `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default TypeOfTypeArgs_key where
+  def = TypeOfTypeArgs_key Default.def Default.def
+
+instance Hashable.Hashable TypeOfTypeArgs_key where
+  hashWithSalt __salt (TypeOfTypeArgs_key _typeWithArgs _type)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _typeWithArgs)
+        _type
+
+data TypeArg_key = TypeArg_key_type Type
+                 | TypeArg_key_wildcard Wildcard
+                 | TypeArg_key_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeArg_key where
+  toJSON (TypeArg_key_type __type) = Aeson.object ["type" .= __type]
+  toJSON (TypeArg_key_wildcard __wildcard)
+    = Aeson.object ["wildcard" .= __wildcard]
+  toJSON TypeArg_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct TypeArg_key where
+  buildStruct _proxy (TypeArg_key_type __type)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __type)]
+  buildStruct _proxy (TypeArg_key_wildcard __wildcard)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "wildcard" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __wildcard)]
+  buildStruct _proxy TypeArg_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (TypeArg_key_type _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (TypeArg_key_wildcard _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return TypeArg_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return TypeArg_key_EMPTY
+    where
+      _idMap = HashMap.fromList [("type", 1), ("wildcard", 2)]
+
+instance DeepSeq.NFData TypeArg_key where
+  rnf (TypeArg_key_type __type) = DeepSeq.rnf __type
+  rnf (TypeArg_key_wildcard __wildcard) = DeepSeq.rnf __wildcard
+  rnf TypeArg_key_EMPTY = ()
+
+instance Default.Default TypeArg_key where
+  def = TypeArg_key_EMPTY
+
+instance Hashable.Hashable TypeArg_key where
+  hashWithSalt __salt (TypeArg_key_type _type)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _type)
+  hashWithSalt __salt (TypeArg_key_wildcard _wildcard)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _wildcard)
+  hashWithSalt __salt TypeArg_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+newtype PrimitiveType_key = PrimitiveType_key{primitiveType_key_type
+                                              :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PrimitiveType_key where
+  toJSON (PrimitiveType_key __field__type)
+    = Aeson.object ("type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct PrimitiveType_key where
+  buildStruct _proxy (PrimitiveType_key __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__type)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure (PrimitiveType_key __val__type)
+              _idMap = HashMap.fromList [("type", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PrimitiveType_key where
+  rnf (PrimitiveType_key __field__type)
+    = DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default PrimitiveType_key where
+  def = PrimitiveType_key ""
+
+instance Hashable.Hashable PrimitiveType_key where
+  hashWithSalt __salt (PrimitiveType_key _type)
+    = Hashable.hashWithSalt __salt _type
+
+data PackageDeclaration_key = PackageDeclaration_key{packageDeclaration_key_name
+                                                     :: Glean.Schema.JavakotlinAlpha.Name,
+                                                     packageDeclaration_key_annotation ::
+                                                     [Annotation],
+                                                     packageDeclaration_key_path ::
+                                                     Prelude.Maybe
+                                                       Glean.Schema.JavakotlinAlpha.Path,
+                                                     packageDeclaration_key_location ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackageDeclaration_key where
+  toJSON
+    (PackageDeclaration_key __field__name __field__annotation
+       __field__path __field__location)
+    = Aeson.object
+        ("name" .= __field__name :
+           "annotation" .= __field__annotation :
+             Prelude.maybe Prelude.id ((:) . ("path" .=)) __field__path
+               ("location" .= __field__location : Prelude.mempty))
+
+instance Thrift.ThriftStruct PackageDeclaration_key where
+  buildStruct _proxy
+    (PackageDeclaration_key __field__name __field__annotation
+       __field__path __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "annotation" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__annotation)
+             :
+             let (__cereal__path, __id__path)
+                   = case __field__path of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "path"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__path
+                 (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 4
+                    __id__path
+                    (Thrift.buildStruct _proxy __field__location)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__annotation <- ST.newSTRef Default.def
+            __field__path <- ST.newSTRef Prelude.Nothing
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotation
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__path
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__annotation <- ST.readSTRef __field__annotation
+                                             !__val__path <- ST.readSTRef __field__path
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (PackageDeclaration_key __val__name __val__annotation
+                                                  __val__path
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("annotation", 2), ("path", 3), ("location", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PackageDeclaration_key where
+  rnf
+    (PackageDeclaration_key __field__name __field__annotation
+       __field__path __field__location)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__annotation `Prelude.seq`
+          DeepSeq.rnf __field__path `Prelude.seq`
+            DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default PackageDeclaration_key where
+  def
+    = PackageDeclaration_key Default.def Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable PackageDeclaration_key where
+  hashWithSalt __salt
+    (PackageDeclaration_key _name _annotation _path _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _annotation)
+           _path)
+        _location
+
+data ObjectType_key = ObjectType_key{objectType_key_type ::
+                                     Glean.Schema.JavakotlinAlpha.QName,
+                                     objectType_key_span :: Glean.Schema.Src.ByteSpan}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ObjectType_key where
+  toJSON (ObjectType_key __field__type __field__span)
+    = Aeson.object
+        ("type" .= __field__type :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ObjectType_key where
+  buildStruct _proxy (ObjectType_key __field__type __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (ObjectType_key __val__type __val__span)
+              _idMap = HashMap.fromList [("type", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ObjectType_key where
+  rnf (ObjectType_key __field__type __field__span)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ObjectType_key where
+  def = ObjectType_key Default.def Default.def
+
+instance Hashable.Hashable ObjectType_key where
+  hashWithSalt __salt (ObjectType_key _type _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _span
+
+data Modifier = Modifier_abstract_
+              | Modifier_default_
+              | Modifier_final_
+              | Modifier_native_
+              | Modifier_private_
+              | Modifier_protected_
+              | Modifier_public_
+              | Modifier_static_
+              | Modifier_strictfp_
+              | Modifier_synchronized_
+              | Modifier_transient_
+              | Modifier_volatile_
+              | Modifier__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Modifier where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Modifier where
+  rnf __Modifier = Prelude.seq __Modifier ()
+
+instance Default.Default Modifier where
+  def = Modifier_abstract_
+
+instance Hashable.Hashable Modifier where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Modifier where
+  toThriftEnum 0 = Modifier_abstract_
+  toThriftEnum 1 = Modifier_default_
+  toThriftEnum 2 = Modifier_final_
+  toThriftEnum 3 = Modifier_native_
+  toThriftEnum 4 = Modifier_private_
+  toThriftEnum 5 = Modifier_protected_
+  toThriftEnum 6 = Modifier_public_
+  toThriftEnum 7 = Modifier_static_
+  toThriftEnum 8 = Modifier_strictfp_
+  toThriftEnum 9 = Modifier_synchronized_
+  toThriftEnum 10 = Modifier_transient_
+  toThriftEnum 11 = Modifier_volatile_
+  toThriftEnum val = Modifier__UNKNOWN val
+  fromThriftEnum Modifier_abstract_ = 0
+  fromThriftEnum Modifier_default_ = 1
+  fromThriftEnum Modifier_final_ = 2
+  fromThriftEnum Modifier_native_ = 3
+  fromThriftEnum Modifier_private_ = 4
+  fromThriftEnum Modifier_protected_ = 5
+  fromThriftEnum Modifier_public_ = 6
+  fromThriftEnum Modifier_static_ = 7
+  fromThriftEnum Modifier_strictfp_ = 8
+  fromThriftEnum Modifier_synchronized_ = 9
+  fromThriftEnum Modifier_transient_ = 10
+  fromThriftEnum Modifier_volatile_ = 11
+  fromThriftEnum (Modifier__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Modifier_abstract_, Modifier_default_, Modifier_final_,
+       Modifier_native_, Modifier_private_, Modifier_protected_,
+       Modifier_public_, Modifier_static_, Modifier_strictfp_,
+       Modifier_synchronized_, Modifier_transient_, Modifier_volatile_]
+  toThriftEnumEither 0 = Prelude.Right Modifier_abstract_
+  toThriftEnumEither 1 = Prelude.Right Modifier_default_
+  toThriftEnumEither 2 = Prelude.Right Modifier_final_
+  toThriftEnumEither 3 = Prelude.Right Modifier_native_
+  toThriftEnumEither 4 = Prelude.Right Modifier_private_
+  toThriftEnumEither 5 = Prelude.Right Modifier_protected_
+  toThriftEnumEither 6 = Prelude.Right Modifier_public_
+  toThriftEnumEither 7 = Prelude.Right Modifier_static_
+  toThriftEnumEither 8 = Prelude.Right Modifier_strictfp_
+  toThriftEnumEither 9 = Prelude.Right Modifier_synchronized_
+  toThriftEnumEither 10 = Prelude.Right Modifier_transient_
+  toThriftEnumEither 11 = Prelude.Right Modifier_volatile_
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Modifier: "
+           ++ Prelude.show val)
+
+data ParameterDeclaration_key = ParameterDeclaration_key{parameterDeclaration_key_name
+                                                         :: Glean.Schema.JavakotlinAlpha.QName,
+                                                         parameterDeclaration_key_type :: Type,
+                                                         parameterDeclaration_key_annotations ::
+                                                         [Annotation],
+                                                         parameterDeclaration_key_modifier ::
+                                                         [Modifier],
+                                                         parameterDeclaration_key_span ::
+                                                         Glean.Schema.Src.ByteSpan}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParameterDeclaration_key where
+  toJSON
+    (ParameterDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "annotations" .= __field__annotations :
+               "modifier" .= __field__modifier :
+                 "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ParameterDeclaration_key where
+  buildStruct _proxy
+    (ParameterDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__annotations)
+               :
+               Thrift.genField _proxy "modifier" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                    (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                       Thrift.fromThriftEnum)
+                    __field__modifier)
+                 :
+                 Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 5 4
+                   (Thrift.buildStruct _proxy __field__span)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifier <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifier
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifier <- ST.readSTRef __field__modifier
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ParameterDeclaration_key __val__name __val__type
+                                                  __val__annotations
+                                                  __val__modifier
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("annotations", 3), ("modifier", 4),
+                     ("span", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData ParameterDeclaration_key where
+  rnf
+    (ParameterDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__annotations `Prelude.seq`
+            DeepSeq.rnf __field__modifier `Prelude.seq`
+              DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ParameterDeclaration_key where
+  def
+    = ParameterDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable ParameterDeclaration_key where
+  hashWithSalt __salt
+    (ParameterDeclaration_key _name _type _annotations _modifier _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+              _annotations)
+           _modifier)
+        _span
+
+data InterfaceInheritance_key = InterfaceInheritance_key{interfaceInheritance_key_interface_name
+                                                         :: Type,
+                                                         interfaceInheritance_key_subclass ::
+                                                         ClassDeclaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceInheritance_key where
+  toJSON
+    (InterfaceInheritance_key __field__interface_name
+       __field__subclass)
+    = Aeson.object
+        ("interface_name" .= __field__interface_name :
+           "subclass" .= __field__subclass : Prelude.mempty)
+
+instance Thrift.ThriftStruct InterfaceInheritance_key where
+  buildStruct _proxy
+    (InterfaceInheritance_key __field__interface_name
+       __field__subclass)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "interface_name"
+           (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__interface_name)
+           :
+           Thrift.genField _proxy "subclass" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__subclass)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__interface_name <- ST.newSTRef Default.def
+            __field__subclass <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__interface_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__subclass
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__interface_name <- ST.readSTRef
+                                                                         __field__interface_name
+                                             !__val__subclass <- ST.readSTRef __field__subclass
+                                             Prelude.pure
+                                               (InterfaceInheritance_key __val__interface_name
+                                                  __val__subclass)
+              _idMap = HashMap.fromList [("interface_name", 1), ("subclass", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceInheritance_key where
+  rnf
+    (InterfaceInheritance_key __field__interface_name
+       __field__subclass)
+    = DeepSeq.rnf __field__interface_name `Prelude.seq`
+        DeepSeq.rnf __field__subclass `Prelude.seq` ()
+
+instance Default.Default InterfaceInheritance_key where
+  def = InterfaceInheritance_key Default.def Default.def
+
+instance Hashable.Hashable InterfaceInheritance_key where
+  hashWithSalt __salt
+    (InterfaceInheritance_key _interface_name _subclass)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _interface_name)
+        _subclass
+
+data Inheritance_key = Inheritance_key{inheritance_key_base ::
+                                       Type,
+                                       inheritance_key_subclass :: ClassDeclaration}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Inheritance_key where
+  toJSON (Inheritance_key __field__base __field__subclass)
+    = Aeson.object
+        ("base" .= __field__base :
+           "subclass" .= __field__subclass : Prelude.mempty)
+
+instance Thrift.ThriftStruct Inheritance_key where
+  buildStruct _proxy
+    (Inheritance_key __field__base __field__subclass)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "subclass" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__subclass)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__subclass <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__subclass
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__subclass <- ST.readSTRef __field__subclass
+                                             Prelude.pure
+                                               (Inheritance_key __val__base __val__subclass)
+              _idMap = HashMap.fromList [("base", 1), ("subclass", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Inheritance_key where
+  rnf (Inheritance_key __field__base __field__subclass)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__subclass `Prelude.seq` ()
+
+instance Default.Default Inheritance_key where
+  def = Inheritance_key Default.def Default.def
+
+instance Hashable.Hashable Inheritance_key where
+  hashWithSalt __salt (Inheritance_key _base _subclass)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _subclass
+
+data ImportDeclaration_key = ImportDeclaration_key{importDeclaration_key_name
+                                                   :: Glean.Schema.JavakotlinAlpha.Name,
+                                                   importDeclaration_key_import_on_demand ::
+                                                   Prelude.Bool,
+                                                   importDeclaration_key_static_member ::
+                                                   Prelude.Maybe Text.Text,
+                                                   importDeclaration_key_path ::
+                                                   Glean.Schema.JavakotlinAlpha.Path,
+                                                   importDeclaration_key_location ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportDeclaration_key where
+  toJSON
+    (ImportDeclaration_key __field__name __field__import_on_demand
+       __field__static_member __field__path __field__location)
+    = Aeson.object
+        ("name" .= __field__name :
+           "import_on_demand" .= __field__import_on_demand :
+             Prelude.maybe Prelude.id ((:) . ("static_member" .=))
+               __field__static_member
+               ("path" .= __field__path :
+                  "location" .= __field__location : Prelude.mempty))
+
+instance Thrift.ThriftStruct ImportDeclaration_key where
+  buildStruct _proxy
+    (ImportDeclaration_key __field__name __field__import_on_demand
+       __field__static_member __field__path __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genFieldBool _proxy "import_on_demand" 2 1
+             __field__import_on_demand
+             :
+             let (__cereal__static_member, __id__static_member)
+                   = case __field__static_member of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "static_member"
+                                                  (Thrift.getStringType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.genText _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__static_member
+                 (Thrift.genField _proxy "path" (Thrift.getStructType _proxy) 4
+                    __id__static_member
+                    (Thrift.buildStruct _proxy __field__path)
+                    :
+                    Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 5 4
+                      (Thrift.buildStruct _proxy __field__location)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__import_on_demand <- ST.newSTRef Prelude.False
+            __field__static_member <- ST.newSTRef Prelude.Nothing
+            __field__path <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__import_on_demand
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__static_member
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__path
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__import_on_demand <- ST.readSTRef
+                                                                           __field__import_on_demand
+                                             !__val__static_member <- ST.readSTRef
+                                                                        __field__static_member
+                                             !__val__path <- ST.readSTRef __field__path
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ImportDeclaration_key __val__name
+                                                  __val__import_on_demand
+                                                  __val__static_member
+                                                  __val__path
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("import_on_demand", 2), ("static_member", 3),
+                     ("path", 4), ("location", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportDeclaration_key where
+  rnf
+    (ImportDeclaration_key __field__name __field__import_on_demand
+       __field__static_member __field__path __field__location)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__import_on_demand `Prelude.seq`
+          DeepSeq.rnf __field__static_member `Prelude.seq`
+            DeepSeq.rnf __field__path `Prelude.seq`
+              DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ImportDeclaration_key where
+  def
+    = ImportDeclaration_key Default.def Prelude.False Prelude.Nothing
+        Default.def
+        Default.def
+
+instance Hashable.Hashable ImportDeclaration_key where
+  hashWithSalt __salt
+    (ImportDeclaration_key _name _import_on_demand _static_member _path
+       _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _import_on_demand)
+              _static_member)
+           _path)
+        _location
+
+data FileXRefs_key = FileXRefs_key{fileXRefs_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileXRefs_key_xrefs :: [XRef]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXRefs_key where
+  toJSON (FileXRefs_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXRefs_key where
+  buildStruct _proxy (FileXRefs_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (FileXRefs_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXRefs_key where
+  rnf (FileXRefs_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default FileXRefs_key where
+  def = FileXRefs_key Default.def Default.def
+
+instance Hashable.Hashable FileXRefs_key where
+  hashWithSalt __salt (FileXRefs_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+data ExecutableDefinition = ExecutableDefinition_constructor ConstructorDeclaration
+                          | ExecutableDefinition_method MethodDeclaration
+                          | ExecutableDefinition_EMPTY
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExecutableDefinition where
+  toJSON (ExecutableDefinition_constructor __constructor)
+    = Aeson.object ["constructor" .= __constructor]
+  toJSON (ExecutableDefinition_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON ExecutableDefinition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct ExecutableDefinition where
+  buildStruct _proxy (ExecutableDefinition_constructor __constructor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "constructor" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __constructor)]
+  buildStruct _proxy (ExecutableDefinition_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy ExecutableDefinition_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ExecutableDefinition_constructor
+                                                                 _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (ExecutableDefinition_method _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               ExecutableDefinition_EMPTY
+           Thrift.FieldEnd -> Prelude.return ExecutableDefinition_EMPTY
+    where
+      _idMap = HashMap.fromList [("constructor", 1), ("method", 2)]
+
+instance DeepSeq.NFData ExecutableDefinition where
+  rnf (ExecutableDefinition_constructor __constructor)
+    = DeepSeq.rnf __constructor
+  rnf (ExecutableDefinition_method __method) = DeepSeq.rnf __method
+  rnf ExecutableDefinition_EMPTY = ()
+
+instance Default.Default ExecutableDefinition where
+  def = ExecutableDefinition_EMPTY
+
+instance Hashable.Hashable ExecutableDefinition where
+  hashWithSalt __salt (ExecutableDefinition_constructor _constructor)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 1 _constructor)
+  hashWithSalt __salt (ExecutableDefinition_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _method)
+  hashWithSalt __salt ExecutableDefinition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data ExecutableDefnLocation_key = ExecutableDefnLocation_key{executableDefnLocation_key_defn
+                                                             :: ExecutableDefinition,
+                                                             executableDefnLocation_key_name ::
+                                                             Text.Text,
+                                                             executableDefnLocation_key_file ::
+                                                             Glean.Schema.Src.File,
+                                                             executableDefnLocation_key_span ::
+                                                             Glean.Schema.Src.ByteSpan}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExecutableDefnLocation_key where
+  toJSON
+    (ExecutableDefnLocation_key __field__defn __field__name
+       __field__file __field__span)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "name" .= __field__name :
+             "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExecutableDefnLocation_key where
+  buildStruct _proxy
+    (ExecutableDefnLocation_key __field__defn __field__name
+       __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ExecutableDefnLocation_key __val__defn __val__name
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("defn", 1), ("name", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData ExecutableDefnLocation_key where
+  rnf
+    (ExecutableDefnLocation_key __field__defn __field__name
+       __field__file __field__span)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ExecutableDefnLocation_key where
+  def
+    = ExecutableDefnLocation_key Default.def "" Default.def Default.def
+
+instance Hashable.Hashable ExecutableDefnLocation_key where
+  hashWithSalt __salt
+    (ExecutableDefnLocation_key _defn _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _name)
+           _file)
+        _span
+
+data LocalDeclaration_key = LocalDeclaration_key{localDeclaration_key_name
+                                                 :: Glean.Schema.JavakotlinAlpha.QName,
+                                                 localDeclaration_key_type :: Type,
+                                                 localDeclaration_key_annotations :: [Annotation],
+                                                 localDeclaration_key_modifier :: [Modifier],
+                                                 localDeclaration_key_container ::
+                                                 ExecutableDefinition,
+                                                 localDeclaration_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalDeclaration_key where
+  toJSON
+    (LocalDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__container
+       __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "annotations" .= __field__annotations :
+               "modifier" .= __field__modifier :
+                 "container" .= __field__container :
+                   "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalDeclaration_key where
+  buildStruct _proxy
+    (LocalDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__container
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__annotations)
+               :
+               Thrift.genField _proxy "modifier" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                    (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                       Thrift.fromThriftEnum)
+                    __field__modifier)
+                 :
+                 Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 5
+                   4
+                   (Thrift.buildStruct _proxy __field__container)
+                   :
+                   Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 6 5
+                     (Thrift.buildStruct _proxy __field__span)
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifier <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifier
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifier <- ST.readSTRef __field__modifier
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (LocalDeclaration_key __val__name __val__type
+                                                  __val__annotations
+                                                  __val__modifier
+                                                  __val__container
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("annotations", 3), ("modifier", 4),
+                     ("container", 5), ("span", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalDeclaration_key where
+  rnf
+    (LocalDeclaration_key __field__name __field__type
+       __field__annotations __field__modifier __field__container
+       __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__annotations `Prelude.seq`
+            DeepSeq.rnf __field__modifier `Prelude.seq`
+              DeepSeq.rnf __field__container `Prelude.seq`
+                DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default LocalDeclaration_key where
+  def
+    = LocalDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable LocalDeclaration_key where
+  hashWithSalt __salt
+    (LocalDeclaration_key _name _type _annotations _modifier _container
+       _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+                 _annotations)
+              _modifier)
+           _container)
+        _span
+
+data Definition = Definition_class_ ClassDeclaration
+                | Definition_interface_ InterfaceDeclaration
+                | Definition_enum_ EnumDeclaration
+                | Definition_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (Definition_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (Definition_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON Definition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (Definition_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           2
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy (Definition_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy Definition_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_class_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_interface_ _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_enum_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Definition_EMPTY
+           Thrift.FieldEnd -> Prelude.return Definition_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("class_", 1), ("interface_", 2), ("enum_", 3)]
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition_class_ __class_) = DeepSeq.rnf __class_
+  rnf (Definition_interface_ __interface_) = DeepSeq.rnf __interface_
+  rnf (Definition_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf Definition_EMPTY = ()
+
+instance Default.Default Definition where
+  def = Definition_EMPTY
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _class_)
+  hashWithSalt __salt (Definition_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 2 _interface_)
+  hashWithSalt __salt (Definition_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _enum_)
+  hashWithSalt __salt Definition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_defn
+                                                     :: Definition,
+                                                     definitionLocation_key_name :: Text.Text,
+                                                     definitionLocation_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     definitionLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON
+    (DefinitionLocation_key __field__defn __field__name __field__file
+       __field__span)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "name" .= __field__name :
+             "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__defn __field__name __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__defn __val__name
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("defn", 1), ("name", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf
+    (DefinitionLocation_key __field__defn __field__name __field__file
+       __field__span)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def "" Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt
+    (DefinitionLocation_key _defn _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _name)
+           _file)
+        _span
+
+data EnumDeclaration_key = EnumDeclaration_key{enumDeclaration_key_name
+                                               :: Glean.Schema.JavakotlinAlpha.QName,
+                                               enumDeclaration_key_annotations :: [Annotation],
+                                               enumDeclaration_key_modifiers :: [Modifier],
+                                               enumDeclaration_key_implements_ :: [Type],
+                                               enumDeclaration_key_container ::
+                                               Prelude.Maybe Definition,
+                                               enumDeclaration_key_span ::
+                                               Glean.Schema.Src.ByteSpan,
+                                               enumDeclaration_key_file :: Glean.Schema.Src.File}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumDeclaration_key where
+  toJSON
+    (EnumDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__implements_ __field__container
+       __field__span __field__file)
+    = Aeson.object
+        ("name" .= __field__name :
+           "annotations" .= __field__annotations :
+             "modifiers" .= __field__modifiers :
+               "implements_" .= __field__implements_ :
+                 Prelude.maybe Prelude.id ((:) . ("container" .=))
+                   __field__container
+                   ("span" .= __field__span :
+                      "file" .= __field__file : Prelude.mempty))
+
+instance Thrift.ThriftStruct EnumDeclaration_key where
+  buildStruct _proxy
+    (EnumDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__implements_ __field__container
+       __field__span __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__annotations)
+             :
+             Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                  (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                  __field__modifiers)
+               :
+               Thrift.genField _proxy "implements_" (Thrift.getListType _proxy) 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__implements_)
+                 :
+                 let (__cereal__container, __id__container)
+                       = case __field__container of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "container"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__container
+                     (Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 6
+                        __id__container
+                        (Thrift.buildStruct _proxy __field__span)
+                        :
+                        Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 7 6
+                          (Thrift.buildStruct _proxy __field__file)
+                          : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__implements_ <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__implements_
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__implements_ <- ST.readSTRef
+                                                                      __field__implements_
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (EnumDeclaration_key __val__name __val__annotations
+                                                  __val__modifiers
+                                                  __val__implements_
+                                                  __val__container
+                                                  __val__span
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("annotations", 2), ("modifiers", 3),
+                     ("implements_", 4), ("container", 5), ("span", 6), ("file", 7)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumDeclaration_key where
+  rnf
+    (EnumDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__implements_ __field__container
+       __field__span __field__file)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__annotations `Prelude.seq`
+          DeepSeq.rnf __field__modifiers `Prelude.seq`
+            DeepSeq.rnf __field__implements_ `Prelude.seq`
+              DeepSeq.rnf __field__container `Prelude.seq`
+                DeepSeq.rnf __field__span `Prelude.seq`
+                  DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default EnumDeclaration_key where
+  def
+    = EnumDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+
+instance Hashable.Hashable EnumDeclaration_key where
+  hashWithSalt __salt
+    (EnumDeclaration_key _name _annotations _modifiers _implements_
+       _container _span _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                       _annotations)
+                    _modifiers)
+                 _implements_)
+              _container)
+           _span)
+        _file
+
+data FieldDeclaration_key = FieldDeclaration_key{fieldDeclaration_key_name
+                                                 :: Glean.Schema.JavakotlinAlpha.QName,
+                                                 fieldDeclaration_key_type :: Type,
+                                                 fieldDeclaration_key_annotations :: [Annotation],
+                                                 fieldDeclaration_key_modifiers :: [Modifier],
+                                                 fieldDeclaration_key_container :: Definition,
+                                                 fieldDeclaration_key_span ::
+                                                 Glean.Schema.Src.ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldDeclaration_key where
+  toJSON
+    (FieldDeclaration_key __field__name __field__type
+       __field__annotations __field__modifiers __field__container
+       __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "annotations" .= __field__annotations :
+               "modifiers" .= __field__modifiers :
+                 "container" .= __field__container :
+                   "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldDeclaration_key where
+  buildStruct _proxy
+    (FieldDeclaration_key __field__name __field__type
+       __field__annotations __field__modifiers __field__container
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__annotations)
+               :
+               Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                    (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                       Thrift.fromThriftEnum)
+                    __field__modifiers)
+                 :
+                 Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 5
+                   4
+                   (Thrift.buildStruct _proxy __field__container)
+                   :
+                   Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 6 5
+                     (Thrift.buildStruct _proxy __field__span)
+                     : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (FieldDeclaration_key __val__name __val__type
+                                                  __val__annotations
+                                                  __val__modifiers
+                                                  __val__container
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("type", 2), ("annotations", 3), ("modifiers", 4),
+                     ("container", 5), ("span", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldDeclaration_key where
+  rnf
+    (FieldDeclaration_key __field__name __field__type
+       __field__annotations __field__modifiers __field__container
+       __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__annotations `Prelude.seq`
+            DeepSeq.rnf __field__modifiers `Prelude.seq`
+              DeepSeq.rnf __field__container `Prelude.seq`
+                DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FieldDeclaration_key where
+  def
+    = FieldDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable FieldDeclaration_key where
+  hashWithSalt __salt
+    (FieldDeclaration_key _name _type _annotations _modifiers
+       _container _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+                 _annotations)
+              _modifiers)
+           _container)
+        _span
+
+data InterfaceDeclaration_key = InterfaceDeclaration_key{interfaceDeclaration_key_name
+                                                         :: Glean.Schema.JavakotlinAlpha.QName,
+                                                         interfaceDeclaration_key_annotations ::
+                                                         [Annotation],
+                                                         interfaceDeclaration_key_modifiers ::
+                                                         [Modifier],
+                                                         interfaceDeclaration_key_extends_ ::
+                                                         [Type],
+                                                         interfaceDeclaration_key_container ::
+                                                         Prelude.Maybe Definition,
+                                                         interfaceDeclaration_key_typeParams ::
+                                                         [TypeParam],
+                                                         interfaceDeclaration_key_span ::
+                                                         Glean.Schema.Src.ByteSpan,
+                                                         interfaceDeclaration_key_file ::
+                                                         Glean.Schema.Src.File}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InterfaceDeclaration_key where
+  toJSON
+    (InterfaceDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__extends_ __field__container
+       __field__typeParams __field__span __field__file)
+    = Aeson.object
+        ("name" .= __field__name :
+           "annotations" .= __field__annotations :
+             "modifiers" .= __field__modifiers :
+               "extends_" .= __field__extends_ :
+                 Prelude.maybe Prelude.id ((:) . ("container" .=))
+                   __field__container
+                   ("typeParams" .= __field__typeParams :
+                      "span" .= __field__span :
+                        "file" .= __field__file : Prelude.mempty))
+
+instance Thrift.ThriftStruct InterfaceDeclaration_key where
+  buildStruct _proxy
+    (InterfaceDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__extends_ __field__container
+       __field__typeParams __field__span __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__annotations)
+             :
+             Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                  (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                     Thrift.fromThriftEnum)
+                  __field__modifiers)
+               :
+               Thrift.genField _proxy "extends_" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__extends_)
+                 :
+                 let (__cereal__container, __id__container)
+                       = case __field__container of
+                           Prelude.Just _val -> ((:)
+                                                   (Thrift.genField _proxy "container"
+                                                      (Thrift.getStructType _proxy)
+                                                      5
+                                                      4
+                                                      (Thrift.buildStruct _proxy _val)),
+                                                 5)
+                           Prelude.Nothing -> (Prelude.id, 4)
+                   in
+                   __cereal__container
+                     (Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 6
+                        __id__container
+                        (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                           (Thrift.buildStruct _proxy)
+                           __field__typeParams)
+                        :
+                        Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 7 6
+                          (Thrift.buildStruct _proxy __field__span)
+                          :
+                          Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 8 7
+                            (Thrift.buildStruct _proxy __field__file)
+                            : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__extends_ <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Prelude.Nothing
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__extends_
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__extends_ <- ST.readSTRef __field__extends_
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (InterfaceDeclaration_key __val__name
+                                                  __val__annotations
+                                                  __val__modifiers
+                                                  __val__extends_
+                                                  __val__container
+                                                  __val__typeParams
+                                                  __val__span
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("annotations", 2), ("modifiers", 3),
+                     ("extends_", 4), ("container", 5), ("typeParams", 6), ("span", 7),
+                     ("file", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData InterfaceDeclaration_key where
+  rnf
+    (InterfaceDeclaration_key __field__name __field__annotations
+       __field__modifiers __field__extends_ __field__container
+       __field__typeParams __field__span __field__file)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__annotations `Prelude.seq`
+          DeepSeq.rnf __field__modifiers `Prelude.seq`
+            DeepSeq.rnf __field__extends_ `Prelude.seq`
+              DeepSeq.rnf __field__container `Prelude.seq`
+                DeepSeq.rnf __field__typeParams `Prelude.seq`
+                  DeepSeq.rnf __field__span `Prelude.seq`
+                    DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default InterfaceDeclaration_key where
+  def
+    = InterfaceDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable InterfaceDeclaration_key where
+  hashWithSalt __salt
+    (InterfaceDeclaration_key _name _annotations _modifiers _extends_
+       _container _typeParams _span _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                          _annotations)
+                       _modifiers)
+                    _extends_)
+                 _container)
+              _typeParams)
+           _span)
+        _file
+
+data MethodDeclaration_key = MethodDeclaration_key{methodDeclaration_key_name
+                                                   :: Glean.Schema.JavakotlinAlpha.MethodName,
+                                                   methodDeclaration_key_parameters ::
+                                                   [ParameterDeclaration],
+                                                   methodDeclaration_key_returnType :: Type,
+                                                   methodDeclaration_key_annotations ::
+                                                   [Annotation],
+                                                   methodDeclaration_key_modifiers :: [Modifier],
+                                                   methodDeclaration_key_typeParams :: [TypeParam],
+                                                   methodDeclaration_key_throws_ :: [Type],
+                                                   methodDeclaration_key_container :: Definition,
+                                                   methodDeclaration_key_span ::
+                                                   Glean.Schema.Src.ByteSpan}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration_key where
+  toJSON
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__annotations __field__modifiers
+       __field__typeParams __field__throws_ __field__container
+       __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parameters" .= __field__parameters :
+             "returnType" .= __field__returnType :
+               "annotations" .= __field__annotations :
+                 "modifiers" .= __field__modifiers :
+                   "typeParams" .= __field__typeParams :
+                     "throws_" .= __field__throws_ :
+                       "container" .= __field__container :
+                         "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDeclaration_key where
+  buildStruct _proxy
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__annotations __field__modifiers
+       __field__typeParams __field__throws_ __field__container
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__parameters)
+             :
+             Thrift.genField _proxy "returnType" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__returnType)
+               :
+               Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 4
+                 3
+                 (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                    (Thrift.buildStruct _proxy)
+                    __field__annotations)
+                 :
+                 Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                      (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                         Thrift.fromThriftEnum)
+                      __field__modifiers)
+                   :
+                   Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 6 5
+                     (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                        (Thrift.buildStruct _proxy)
+                        __field__typeParams)
+                     :
+                     Thrift.genField _proxy "throws_" (Thrift.getListType _proxy) 7 6
+                       (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                          (Thrift.buildStruct _proxy)
+                          __field__throws_)
+                       :
+                       Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 8
+                         7
+                         (Thrift.buildStruct _proxy __field__container)
+                         :
+                         Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 9 8
+                           (Thrift.buildStruct _proxy __field__span)
+                           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__returnType <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__throws_ <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnType
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__throws_
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__returnType <- ST.readSTRef __field__returnType
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__throws_ <- ST.readSTRef __field__throws_
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (MethodDeclaration_key __val__name __val__parameters
+                                                  __val__returnType
+                                                  __val__annotations
+                                                  __val__modifiers
+                                                  __val__typeParams
+                                                  __val__throws_
+                                                  __val__container
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("parameters", 2), ("returnType", 3),
+                     ("annotations", 4), ("modifiers", 5), ("typeParams", 6),
+                     ("throws_", 7), ("container", 8), ("span", 9)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration_key where
+  rnf
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__annotations __field__modifiers
+       __field__typeParams __field__throws_ __field__container
+       __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq`
+          DeepSeq.rnf __field__returnType `Prelude.seq`
+            DeepSeq.rnf __field__annotations `Prelude.seq`
+              DeepSeq.rnf __field__modifiers `Prelude.seq`
+                DeepSeq.rnf __field__typeParams `Prelude.seq`
+                  DeepSeq.rnf __field__throws_ `Prelude.seq`
+                    DeepSeq.rnf __field__container `Prelude.seq`
+                      DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration_key where
+  def
+    = MethodDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable MethodDeclaration_key where
+  hashWithSalt __salt
+    (MethodDeclaration_key _name _parameters _returnType _annotations
+       _modifiers _typeParams _throws_ _container _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                             _parameters)
+                          _returnType)
+                       _annotations)
+                    _modifiers)
+                 _typeParams)
+              _throws_)
+           _container)
+        _span
+
+data Declaration = Declaration_param ParameterDeclaration
+                 | Declaration_local LocalDeclaration
+                 | Declaration_field FieldDeclaration
+                 | Declaration_ctor ConstructorDeclaration
+                 | Declaration_method MethodDeclaration
+                 | Declaration_interface_ InterfaceDeclaration
+                 | Declaration_class_ ClassDeclaration
+                 | Declaration_enum_ EnumDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_param __param)
+    = Aeson.object ["param" .= __param]
+  toJSON (Declaration_local __local)
+    = Aeson.object ["local" .= __local]
+  toJSON (Declaration_field __field)
+    = Aeson.object ["field" .= __field]
+  toJSON (Declaration_ctor __ctor) = Aeson.object ["ctor" .= __ctor]
+  toJSON (Declaration_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Declaration_interface_ __interface_)
+    = Aeson.object ["interface_" .= __interface_]
+  toJSON (Declaration_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (Declaration_enum_ __enum_)
+    = Aeson.object ["enum_" .= __enum_]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_param __param)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "param" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __param)]
+  buildStruct _proxy (Declaration_local __local)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "local" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __local)]
+  buildStruct _proxy (Declaration_field __field)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "field" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __field)]
+  buildStruct _proxy (Declaration_ctor __ctor)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ctor" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __ctor)]
+  buildStruct _proxy (Declaration_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Declaration_interface_ __interface_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "interface_" (Thrift.getStructType _proxy)
+           6
+           0
+           (Thrift.buildStruct _proxy __interface_)]
+  buildStruct _proxy (Declaration_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (Declaration_enum_ __enum_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "enum_" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __enum_)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_param _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_local _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_field _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_ctor _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_method _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_interface_ _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_class_ _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_enum_ _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("param", 1), ("local", 2), ("field", 3), ("ctor", 4),
+             ("method", 5), ("interface_", 6), ("class_", 7), ("enum_", 8)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_param __param) = DeepSeq.rnf __param
+  rnf (Declaration_local __local) = DeepSeq.rnf __local
+  rnf (Declaration_field __field) = DeepSeq.rnf __field
+  rnf (Declaration_ctor __ctor) = DeepSeq.rnf __ctor
+  rnf (Declaration_method __method) = DeepSeq.rnf __method
+  rnf (Declaration_interface_ __interface_)
+    = DeepSeq.rnf __interface_
+  rnf (Declaration_class_ __class_) = DeepSeq.rnf __class_
+  rnf (Declaration_enum_ __enum_) = DeepSeq.rnf __enum_
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_param _param)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _param)
+  hashWithSalt __salt (Declaration_local _local)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _local)
+  hashWithSalt __salt (Declaration_field _field)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _field)
+  hashWithSalt __salt (Declaration_ctor _ctor)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _ctor)
+  hashWithSalt __salt (Declaration_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _method)
+  hashWithSalt __salt (Declaration_interface_ _interface_)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 6 _interface_)
+  hashWithSalt __salt (Declaration_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _class_)
+  hashWithSalt __salt (Declaration_enum_ _enum_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _enum_)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationAnnotations_key = DeclarationAnnotations_key{declarationAnnotations_key_decl
+                                                             :: Declaration,
+                                                             declarationAnnotations_key_annotations
+                                                             :: [Annotation]}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationAnnotations_key where
+  toJSON
+    (DeclarationAnnotations_key __field__decl __field__annotations)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "annotations" .= __field__annotations : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationAnnotations_key where
+  buildStruct _proxy
+    (DeclarationAnnotations_key __field__decl __field__annotations)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__annotations)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             Prelude.pure
+                                               (DeclarationAnnotations_key __val__decl
+                                                  __val__annotations)
+              _idMap = HashMap.fromList [("decl", 1), ("annotations", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationAnnotations_key where
+  rnf (DeclarationAnnotations_key __field__decl __field__annotations)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__annotations `Prelude.seq` ()
+
+instance Default.Default DeclarationAnnotations_key where
+  def = DeclarationAnnotations_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationAnnotations_key where
+  hashWithSalt __salt (DeclarationAnnotations_key _decl _annotations)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _annotations
+
+data DeclarationComment_key = DeclarationComment_key{declarationComment_key_declaration
+                                                     :: Declaration,
+                                                     declarationComment_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     declarationComment_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationComment_key where
+  toJSON
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationComment_key where
+  buildStruct _proxy
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationComment_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationComment_key where
+  rnf
+    (DeclarationComment_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationComment_key where
+  def = DeclarationComment_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationComment_key where
+  hashWithSalt __salt
+    (DeclarationComment_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_decl
+                                                       :: Declaration,
+                                                       declarationLocation_key_name :: Text.Text,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__decl __field__name __field__file
+       __field__span)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "name" .= __field__name :
+             "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__decl __field__name __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__file)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__decl __val__name
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("decl", 1), ("name", 2), ("file", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__decl __field__name __field__file
+       __field__span)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__file `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def
+    = DeclarationLocation_key Default.def "" Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _decl _name _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _name)
+           _file)
+        _span
+
+data DeclarationType_key = DeclarationType_key{declarationType_key_decl
+                                               :: Declaration,
+                                               declarationType_key_type :: Type}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationType_key where
+  toJSON (DeclarationType_key __field__decl __field__type)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationType_key where
+  buildStruct _proxy
+    (DeclarationType_key __field__decl __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure
+                                               (DeclarationType_key __val__decl __val__type)
+              _idMap = HashMap.fromList [("decl", 1), ("type", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationType_key where
+  rnf (DeclarationType_key __field__decl __field__type)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default DeclarationType_key where
+  def = DeclarationType_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationType_key where
+  hashWithSalt __salt (DeclarationType_key _decl _type)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _type
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_target
+                                               :: Declaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_uses ::
+                                               [Glean.Schema.Src.ByteSpan]}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__target __field__file __field__uses)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file : "uses" .= __field__uses : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__target __field__file __field__uses)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "uses" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__uses)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__uses <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__uses
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__uses <- ST.readSTRef __field__uses
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__target __val__file
+                                                  __val__uses)
+              _idMap = HashMap.fromList [("target", 1), ("file", 2), ("uses", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__target __field__file __field__uses)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__uses `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _target _file _uses)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _uses
+
+data DeclarationXRefTarget_key = DeclarationXRefTarget_key{declarationXRefTarget_key_decl
+                                                           :: Declaration,
+                                                           declarationXRefTarget_key_xref ::
+                                                           XRefTarget}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationXRefTarget_key where
+  toJSON (DeclarationXRefTarget_key __field__decl __field__xref)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "xref" .= __field__xref : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationXRefTarget_key where
+  buildStruct _proxy
+    (DeclarationXRefTarget_key __field__decl __field__xref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             Prelude.pure
+                                               (DeclarationXRefTarget_key __val__decl __val__xref)
+              _idMap = HashMap.fromList [("decl", 1), ("xref", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationXRefTarget_key where
+  rnf (DeclarationXRefTarget_key __field__decl __field__xref)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq` ()
+
+instance Default.Default DeclarationXRefTarget_key where
+  def = DeclarationXRefTarget_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationXRefTarget_key where
+  hashWithSalt __salt (DeclarationXRefTarget_key _decl _xref)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _xref
+
+data ExtendedByDeclaration_key = ExtendedByDeclaration_key{extendedByDeclaration_key_parent
+                                                           :: Declaration,
+                                                           extendedByDeclaration_key_child ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendedByDeclaration_key where
+  toJSON (ExtendedByDeclaration_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendedByDeclaration_key where
+  buildStruct _proxy
+    (ExtendedByDeclaration_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ExtendedByDeclaration_key __val__parent
+                                                  __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendedByDeclaration_key where
+  rnf (ExtendedByDeclaration_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ExtendedByDeclaration_key where
+  def = ExtendedByDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ExtendedByDeclaration_key where
+  hashWithSalt __salt (ExtendedByDeclaration_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data ExtendsDeclaration_key = ExtendsDeclaration_key{extendsDeclaration_key_child
+                                                     :: Declaration,
+                                                     extendsDeclaration_key_parent :: Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsDeclaration_key where
+  toJSON (ExtendsDeclaration_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsDeclaration_key where
+  buildStruct _proxy
+    (ExtendsDeclaration_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ExtendsDeclaration_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsDeclaration_key where
+  rnf (ExtendsDeclaration_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ExtendsDeclaration_key where
+  def = ExtendsDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ExtendsDeclaration_key where
+  hashWithSalt __salt (ExtendsDeclaration_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data FileDeclarations_key = FileDeclarations_key{fileDeclarations_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 fileDeclarations_key_decl :: Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations_key where
+  toJSON (FileDeclarations_key __field__file __field__decl)
+    = Aeson.object
+        ("file" .= __field__file :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations_key where
+  buildStruct _proxy
+    (FileDeclarations_key __field__file __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (FileDeclarations_key __val__file __val__decl)
+              _idMap = HashMap.fromList [("file", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations_key where
+  rnf (FileDeclarations_key __field__file __field__decl)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default FileDeclarations_key where
+  def = FileDeclarations_key Default.def Default.def
+
+instance Hashable.Hashable FileDeclarations_key where
+  hashWithSalt __salt (FileDeclarations_key _file _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _decl
+
+data ParentDeclaration_key = ParentDeclaration_key{parentDeclaration_key_child
+                                                   :: Declaration,
+                                                   parentDeclaration_key_parent :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParentDeclaration_key where
+  toJSON (ParentDeclaration_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ParentDeclaration_key where
+  buildStruct _proxy
+    (ParentDeclaration_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ParentDeclaration_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParentDeclaration_key where
+  rnf (ParentDeclaration_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ParentDeclaration_key where
+  def = ParentDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ParentDeclaration_key where
+  hashWithSalt __salt (ParentDeclaration_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data QNameToDefinition_key = QNameToDefinition_key{qNameToDefinition_key_name
+                                                   :: Glean.Schema.JavakotlinAlpha.QName,
+                                                   qNameToDefinition_key_defn :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QNameToDefinition_key where
+  toJSON (QNameToDefinition_key __field__name __field__defn)
+    = Aeson.object
+        ("name" .= __field__name :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct QNameToDefinition_key where
+  buildStruct _proxy
+    (QNameToDefinition_key __field__name __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (QNameToDefinition_key __val__name __val__defn)
+              _idMap = HashMap.fromList [("name", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QNameToDefinition_key where
+  rnf (QNameToDefinition_key __field__name __field__defn)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default QNameToDefinition_key where
+  def = QNameToDefinition_key Default.def Default.def
+
+instance Hashable.Hashable QNameToDefinition_key where
+  hashWithSalt __salt (QNameToDefinition_key _name _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _defn
+
+data XRefOfType_key = XRefOfType_key{xRefOfType_key_type :: Type,
+                                     xRefOfType_key_decl :: Declaration,
+                                     xRefOfType_key_use :: Glean.Schema.Src.ByteSpan}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefOfType_key where
+  toJSON (XRefOfType_key __field__type __field__decl __field__use)
+    = Aeson.object
+        ("type" .= __field__type :
+           "decl" .= __field__decl : "use" .= __field__use : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefOfType_key where
+  buildStruct _proxy
+    (XRefOfType_key __field__type __field__decl __field__use)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             :
+             Thrift.genField _proxy "use" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__use)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            __field__use <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__use
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__use <- ST.readSTRef __field__use
+                                             Prelude.pure
+                                               (XRefOfType_key __val__type __val__decl __val__use)
+              _idMap = HashMap.fromList [("type", 1), ("decl", 2), ("use", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefOfType_key where
+  rnf (XRefOfType_key __field__type __field__decl __field__use)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq`
+          DeepSeq.rnf __field__use `Prelude.seq` ()
+
+instance Default.Default XRefOfType_key where
+  def = XRefOfType_key Default.def Default.def Default.def
+
+instance Hashable.Hashable XRefOfType_key where
+  hashWithSalt __salt (XRefOfType_key _type _decl _use)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type) _decl)
+        _use
+
+data XRefTargetDeclaration_key = XRefTargetDeclaration_key{xRefTargetDeclaration_key_xref
+                                                           :: XRefTarget,
+                                                           xRefTargetDeclaration_key_decl ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefTargetDeclaration_key where
+  toJSON (XRefTargetDeclaration_key __field__xref __field__decl)
+    = Aeson.object
+        ("xref" .= __field__xref :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefTargetDeclaration_key where
+  buildStruct _proxy
+    (XRefTargetDeclaration_key __field__xref __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__xref)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xref <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (XRefTargetDeclaration_key __val__xref __val__decl)
+              _idMap = HashMap.fromList [("xref", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefTargetDeclaration_key where
+  rnf (XRefTargetDeclaration_key __field__xref __field__decl)
+    = DeepSeq.rnf __field__xref `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default XRefTargetDeclaration_key where
+  def = XRefTargetDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable XRefTargetDeclaration_key where
+  hashWithSalt __salt (XRefTargetDeclaration_key _xref _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xref) _decl
+
+data DeclOfExecutableDefn_key = DeclOfExecutableDefn_key{declOfExecutableDefn_key_defn
+                                                         :: ExecutableDefinition,
+                                                         declOfExecutableDefn_key_decl ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclOfExecutableDefn_key where
+  toJSON (DeclOfExecutableDefn_key __field__defn __field__decl)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclOfExecutableDefn_key where
+  buildStruct _proxy
+    (DeclOfExecutableDefn_key __field__defn __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DeclOfExecutableDefn_key __val__defn __val__decl)
+              _idMap = HashMap.fromList [("defn", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclOfExecutableDefn_key where
+  rnf (DeclOfExecutableDefn_key __field__defn __field__decl)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DeclOfExecutableDefn_key where
+  def = DeclOfExecutableDefn_key Default.def Default.def
+
+instance Hashable.Hashable DeclOfExecutableDefn_key where
+  hashWithSalt __salt (DeclOfExecutableDefn_key _defn _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _decl
+
+data DeclOfDefn_key = DeclOfDefn_key{declOfDefn_key_defn ::
+                                     Definition,
+                                     declOfDefn_key_decl :: Declaration}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclOfDefn_key where
+  toJSON (DeclOfDefn_key __field__defn __field__decl)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclOfDefn_key where
+  buildStruct _proxy (DeclOfDefn_key __field__defn __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (DeclOfDefn_key __val__defn __val__decl)
+              _idMap = HashMap.fromList [("defn", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclOfDefn_key where
+  rnf (DeclOfDefn_key __field__defn __field__decl)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DeclOfDefn_key where
+  def = DeclOfDefn_key Default.def Default.def
+
+instance Hashable.Hashable DeclOfDefn_key where
+  hashWithSalt __salt (DeclOfDefn_key _defn _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _decl
+
+data ContainsDeclaration_key = ContainsDeclaration_key{containsDeclaration_key_container
+                                                       :: Declaration,
+                                                       containsDeclaration_key_member ::
+                                                       Declaration}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsDeclaration_key where
+  toJSON (ContainsDeclaration_key __field__container __field__member)
+    = Aeson.object
+        ("container" .= __field__container :
+           "member" .= __field__member : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsDeclaration_key where
+  buildStruct _proxy
+    (ContainsDeclaration_key __field__container __field__member)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "member" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__member)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__member <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__member
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__member <- ST.readSTRef __field__member
+                                             Prelude.pure
+                                               (ContainsDeclaration_key __val__container
+                                                  __val__member)
+              _idMap = HashMap.fromList [("container", 1), ("member", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsDeclaration_key where
+  rnf (ContainsDeclaration_key __field__container __field__member)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__member `Prelude.seq` ()
+
+instance Default.Default ContainsDeclaration_key where
+  def = ContainsDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ContainsDeclaration_key where
+  hashWithSalt __salt (ContainsDeclaration_key _container _member)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _member
+
+data ConstructorDeclaration_key = ConstructorDeclaration_key{constructorDeclaration_key_name
+                                                             ::
+                                                             Glean.Schema.JavakotlinAlpha.MethodName,
+                                                             constructorDeclaration_key_parameters
+                                                             :: [ParameterDeclaration],
+                                                             constructorDeclaration_key_annotations
+                                                             :: [Annotation],
+                                                             constructorDeclaration_key_modifiers ::
+                                                             [Modifier],
+                                                             constructorDeclaration_key_typeParams
+                                                             :: [TypeParam],
+                                                             constructorDeclaration_key_throws_ ::
+                                                             [Type],
+                                                             constructorDeclaration_key_container ::
+                                                             Definition,
+                                                             constructorDeclaration_key_span ::
+                                                             Glean.Schema.Src.ByteSpan}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ConstructorDeclaration_key where
+  toJSON
+    (ConstructorDeclaration_key __field__name __field__parameters
+       __field__annotations __field__modifiers __field__typeParams
+       __field__throws_ __field__container __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parameters" .= __field__parameters :
+             "annotations" .= __field__annotations :
+               "modifiers" .= __field__modifiers :
+                 "typeParams" .= __field__typeParams :
+                   "throws_" .= __field__throws_ :
+                     "container" .= __field__container :
+                       "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ConstructorDeclaration_key where
+  buildStruct _proxy
+    (ConstructorDeclaration_key __field__name __field__parameters
+       __field__annotations __field__modifiers __field__typeParams
+       __field__throws_ __field__container __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__parameters)
+             :
+             Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 3
+               2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__annotations)
+               :
+               Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 4 3
+                 (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                    (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                       Thrift.fromThriftEnum)
+                    __field__modifiers)
+                 :
+                 Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 5 4
+                   (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                      (Thrift.buildStruct _proxy)
+                      __field__typeParams)
+                   :
+                   Thrift.genField _proxy "throws_" (Thrift.getListType _proxy) 6 5
+                     (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                        (Thrift.buildStruct _proxy)
+                        __field__throws_)
+                     :
+                     Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 7
+                       6
+                       (Thrift.buildStruct _proxy __field__container)
+                       :
+                       Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 8 7
+                         (Thrift.buildStruct _proxy __field__span)
+                         : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__throws_ <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__throws_
+                                                                          _val
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__throws_ <- ST.readSTRef __field__throws_
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ConstructorDeclaration_key __val__name
+                                                  __val__parameters
+                                                  __val__annotations
+                                                  __val__modifiers
+                                                  __val__typeParams
+                                                  __val__throws_
+                                                  __val__container
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("parameters", 2), ("annotations", 3),
+                     ("modifiers", 4), ("typeParams", 5), ("throws_", 6),
+                     ("container", 7), ("span", 8)]
+            _parse 0)
+
+instance DeepSeq.NFData ConstructorDeclaration_key where
+  rnf
+    (ConstructorDeclaration_key __field__name __field__parameters
+       __field__annotations __field__modifiers __field__typeParams
+       __field__throws_ __field__container __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq`
+          DeepSeq.rnf __field__annotations `Prelude.seq`
+            DeepSeq.rnf __field__modifiers `Prelude.seq`
+              DeepSeq.rnf __field__typeParams `Prelude.seq`
+                DeepSeq.rnf __field__throws_ `Prelude.seq`
+                  DeepSeq.rnf __field__container `Prelude.seq`
+                    DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ConstructorDeclaration_key where
+  def
+    = ConstructorDeclaration_key Default.def Default.def Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable ConstructorDeclaration_key where
+  hashWithSalt __salt
+    (ConstructorDeclaration_key _name _parameters _annotations
+       _modifiers _typeParams _throws_ _container _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                          _parameters)
+                       _annotations)
+                    _modifiers)
+                 _typeParams)
+              _throws_)
+           _container)
+        _span
+
+data ClassDeclaration_key = ClassDeclaration_key{classDeclaration_key_name
+                                                 :: Glean.Schema.JavakotlinAlpha.QName,
+                                                 classDeclaration_key_modifiers :: [Modifier],
+                                                 classDeclaration_key_extends_ ::
+                                                 Prelude.Maybe Type,
+                                                 classDeclaration_key_implements_ :: [Type],
+                                                 classDeclaration_key_annotations :: [Annotation],
+                                                 classDeclaration_key_container ::
+                                                 Prelude.Maybe Definition,
+                                                 classDeclaration_key_typeParams :: [TypeParam],
+                                                 classDeclaration_key_span ::
+                                                 Glean.Schema.Src.ByteSpan,
+                                                 classDeclaration_key_file :: Glean.Schema.Src.File}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration_key where
+  toJSON
+    (ClassDeclaration_key __field__name __field__modifiers
+       __field__extends_ __field__implements_ __field__annotations
+       __field__container __field__typeParams __field__span __field__file)
+    = Aeson.object
+        ("name" .= __field__name :
+           "modifiers" .= __field__modifiers :
+             Prelude.maybe Prelude.id ((:) . ("extends_" .=)) __field__extends_
+               ("implements_" .= __field__implements_ :
+                  "annotations" .= __field__annotations :
+                    Prelude.maybe Prelude.id ((:) . ("container" .=))
+                      __field__container
+                      ("typeParams" .= __field__typeParams :
+                         "span" .= __field__span :
+                           "file" .= __field__file : Prelude.mempty)))
+
+instance Thrift.ThriftStruct ClassDeclaration_key where
+  buildStruct _proxy
+    (ClassDeclaration_key __field__name __field__modifiers
+       __field__extends_ __field__implements_ __field__annotations
+       __field__container __field__typeParams __field__span __field__file)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "modifiers" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getI32Type _proxy)
+                (Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                __field__modifiers)
+             :
+             let (__cereal__extends_, __id__extends_)
+                   = case __field__extends_ of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "extends_"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__extends_
+                 (Thrift.genField _proxy "implements_" (Thrift.getListType _proxy) 4
+                    __id__extends_
+                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                       (Thrift.buildStruct _proxy)
+                       __field__implements_)
+                    :
+                    Thrift.genField _proxy "annotations" (Thrift.getListType _proxy) 5
+                      4
+                      (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                         (Thrift.buildStruct _proxy)
+                         __field__annotations)
+                      :
+                      let (__cereal__container, __id__container)
+                            = case __field__container of
+                                Prelude.Just _val -> ((:)
+                                                        (Thrift.genField _proxy "container"
+                                                           (Thrift.getStructType _proxy)
+                                                           6
+                                                           5
+                                                           (Thrift.buildStruct _proxy _val)),
+                                                      6)
+                                Prelude.Nothing -> (Prelude.id, 5)
+                        in
+                        __cereal__container
+                          (Thrift.genField _proxy "typeParams" (Thrift.getListType _proxy) 7
+                             __id__container
+                             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                (Thrift.buildStruct _proxy)
+                                __field__typeParams)
+                             :
+                             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 8 7
+                               (Thrift.buildStruct _proxy __field__span)
+                               :
+                               Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 9 8
+                                 (Thrift.buildStruct _proxy __field__file)
+                                 : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__modifiers <- ST.newSTRef Default.def
+            __field__extends_ <- ST.newSTRef Prelude.Nothing
+            __field__implements_ <- ST.newSTRef Default.def
+            __field__annotations <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Prelude.Nothing
+            __field__typeParams <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseEnum
+                                                                                           _proxy
+                                                                                           "Modifier"))
+                                                                        ST.writeSTRef
+                                                                          __field__modifiers
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__extends_
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__implements_
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__annotations
+                                                                          _val
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeParams
+                                                                          _val
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 9 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__modifiers <- ST.readSTRef __field__modifiers
+                                             !__val__extends_ <- ST.readSTRef __field__extends_
+                                             !__val__implements_ <- ST.readSTRef
+                                                                      __field__implements_
+                                             !__val__annotations <- ST.readSTRef
+                                                                      __field__annotations
+                                             !__val__container <- ST.readSTRef __field__container
+                                             !__val__typeParams <- ST.readSTRef __field__typeParams
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__file <- ST.readSTRef __field__file
+                                             Prelude.pure
+                                               (ClassDeclaration_key __val__name __val__modifiers
+                                                  __val__extends_
+                                                  __val__implements_
+                                                  __val__annotations
+                                                  __val__container
+                                                  __val__typeParams
+                                                  __val__span
+                                                  __val__file)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("modifiers", 2), ("extends_", 3),
+                     ("implements_", 4), ("annotations", 5), ("container", 6),
+                     ("typeParams", 7), ("span", 8), ("file", 9)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration_key where
+  rnf
+    (ClassDeclaration_key __field__name __field__modifiers
+       __field__extends_ __field__implements_ __field__annotations
+       __field__container __field__typeParams __field__span __field__file)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__modifiers `Prelude.seq`
+          DeepSeq.rnf __field__extends_ `Prelude.seq`
+            DeepSeq.rnf __field__implements_ `Prelude.seq`
+              DeepSeq.rnf __field__annotations `Prelude.seq`
+                DeepSeq.rnf __field__container `Prelude.seq`
+                  DeepSeq.rnf __field__typeParams `Prelude.seq`
+                    DeepSeq.rnf __field__span `Prelude.seq`
+                      DeepSeq.rnf __field__file `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration_key where
+  def
+    = ClassDeclaration_key Default.def Default.def Prelude.Nothing
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable ClassDeclaration_key where
+  hashWithSalt __salt
+    (ClassDeclaration_key _name _modifiers _extends_ _implements_
+       _annotations _container _typeParams _span _file)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                             _modifiers)
+                          _extends_)
+                       _implements_)
+                    _annotations)
+                 _container)
+              _typeParams)
+           _span)
+        _file
+
+data BaseType = BaseType_object ObjectType
+              | BaseType_primitive PrimitiveType
+              | BaseType_variable TypeVar
+              | BaseType_array ArrayType
+              | BaseType_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BaseType where
+  toJSON (BaseType_object __object)
+    = Aeson.object ["object" .= __object]
+  toJSON (BaseType_primitive __primitive)
+    = Aeson.object ["primitive" .= __primitive]
+  toJSON (BaseType_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (BaseType_array __array) = Aeson.object ["array" .= __array]
+  toJSON BaseType_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct BaseType where
+  buildStruct _proxy (BaseType_object __object)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "object" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __object)]
+  buildStruct _proxy (BaseType_primitive __primitive)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "primitive" (Thrift.getStructType _proxy) 2
+           0
+           (Thrift.buildStruct _proxy __primitive)]
+  buildStruct _proxy (BaseType_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (BaseType_array __array)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "array" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __array)]
+  buildStruct _proxy BaseType_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (BaseType_object _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (BaseType_primitive _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (BaseType_variable _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (BaseType_array _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return BaseType_EMPTY
+           Thrift.FieldEnd -> Prelude.return BaseType_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("object", 1), ("primitive", 2), ("variable", 3), ("array", 4)]
+
+instance DeepSeq.NFData BaseType where
+  rnf (BaseType_object __object) = DeepSeq.rnf __object
+  rnf (BaseType_primitive __primitive) = DeepSeq.rnf __primitive
+  rnf (BaseType_variable __variable) = DeepSeq.rnf __variable
+  rnf (BaseType_array __array) = DeepSeq.rnf __array
+  rnf BaseType_EMPTY = ()
+
+instance Default.Default BaseType where
+  def = BaseType_EMPTY
+
+instance Hashable.Hashable BaseType where
+  hashWithSalt __salt (BaseType_object _object)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _object)
+  hashWithSalt __salt (BaseType_primitive _primitive)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _primitive)
+  hashWithSalt __salt (BaseType_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _variable)
+  hashWithSalt __salt (BaseType_array _array)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _array)
+  hashWithSalt __salt BaseType_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Type_key = Type_key{type_key_baseType :: BaseType,
+                         type_key_typeArgs :: [TypeArg],
+                         type_key_interopType :: Glean.Schema.JavakotlinAlpha.Type,
+                         type_key_span :: Glean.Schema.Src.ByteSpan}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_key where
+  toJSON
+    (Type_key __field__baseType __field__typeArgs __field__interopType
+       __field__span)
+    = Aeson.object
+        ("baseType" .= __field__baseType :
+           "typeArgs" .= __field__typeArgs :
+             "interopType" .= __field__interopType :
+               "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type_key where
+  buildStruct _proxy
+    (Type_key __field__baseType __field__typeArgs __field__interopType
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "baseType" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__baseType)
+           :
+           Thrift.genField _proxy "typeArgs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__typeArgs)
+             :
+             Thrift.genField _proxy "interopType" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__interopType)
+               :
+               Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__span)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__baseType <- ST.newSTRef Default.def
+            __field__typeArgs <- ST.newSTRef Default.def
+            __field__interopType <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__baseType
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeArgs
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__interopType
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__baseType <- ST.readSTRef
+                                                                   __field__baseType
+                                             !__val__typeArgs <- ST.readSTRef __field__typeArgs
+                                             !__val__interopType <- ST.readSTRef
+                                                                      __field__interopType
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (Type_key __val__baseType __val__typeArgs
+                                                  __val__interopType
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("baseType", 1), ("typeArgs", 2), ("interopType", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_key where
+  rnf
+    (Type_key __field__baseType __field__typeArgs __field__interopType
+       __field__span)
+    = DeepSeq.rnf __field__baseType `Prelude.seq`
+        DeepSeq.rnf __field__typeArgs `Prelude.seq`
+          DeepSeq.rnf __field__interopType `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default Type_key where
+  def = Type_key Default.def Default.def Default.def Default.def
+
+instance Hashable.Hashable Type_key where
+  hashWithSalt __salt
+    (Type_key _baseType _typeArgs _interopType _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _baseType)
+              _typeArgs)
+           _interopType)
+        _span
+
+data ArrayType_key = ArrayType_key{arrayType_key_contents :: Type,
+                                   arrayType_key_span :: Glean.Schema.Src.ByteSpan}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ArrayType_key where
+  toJSON (ArrayType_key __field__contents __field__span)
+    = Aeson.object
+        ("contents" .= __field__contents :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ArrayType_key where
+  buildStruct _proxy (ArrayType_key __field__contents __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "contents" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__contents)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__contents <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contents
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__contents <- ST.readSTRef
+                                                                   __field__contents
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ArrayType_key __val__contents __val__span)
+              _idMap = HashMap.fromList [("contents", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ArrayType_key where
+  rnf (ArrayType_key __field__contents __field__span)
+    = DeepSeq.rnf __field__contents `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ArrayType_key where
+  def = ArrayType_key Default.def Default.def
+
+instance Hashable.Hashable ArrayType_key where
+  hashWithSalt __salt (ArrayType_key _contents _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _contents)
+        _span
+
+data Annotation_key = Annotation_key{annotation_key_name ::
+                                     Glean.Schema.JavakotlinAlpha.QName,
+                                     annotation_key_constructor ::
+                                     Glean.Schema.JavakotlinAlpha.MethodName,
+                                     annotation_key_constant :: Prelude.Maybe Text.Text,
+                                     annotation_key_span :: Glean.Schema.Src.ByteSpan}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Annotation_key where
+  toJSON
+    (Annotation_key __field__name __field__constructor
+       __field__constant __field__span)
+    = Aeson.object
+        ("name" .= __field__name :
+           "constructor" .= __field__constructor :
+             Prelude.maybe Prelude.id ((:) . ("constant" .=)) __field__constant
+               ("span" .= __field__span : Prelude.mempty))
+
+instance Thrift.ThriftStruct Annotation_key where
+  buildStruct _proxy
+    (Annotation_key __field__name __field__constructor
+       __field__constant __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "constructor" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__constructor)
+             :
+             let (__cereal__constant, __id__constant)
+                   = case __field__constant of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "constant"
+                                                  (Thrift.getStringType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.genText _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__constant
+                 (Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 4
+                    __id__constant
+                    (Thrift.buildStruct _proxy __field__span)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__constructor <- ST.newSTRef Default.def
+            __field__constant <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__constructor
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__constant
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__constructor <- ST.readSTRef
+                                                                      __field__constructor
+                                             !__val__constant <- ST.readSTRef __field__constant
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (Annotation_key __val__name __val__constructor
+                                                  __val__constant
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("constructor", 2), ("constant", 3), ("span", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Annotation_key where
+  rnf
+    (Annotation_key __field__name __field__constructor
+       __field__constant __field__span)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__constructor `Prelude.seq`
+          DeepSeq.rnf __field__constant `Prelude.seq`
+            DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default Annotation_key where
+  def
+    = Annotation_key Default.def Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable Annotation_key where
+  hashWithSalt __salt
+    (Annotation_key _name _constructor _constant _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _constructor)
+           _constant)
+        _span
+
+data AnnotatedClass_key = AnnotatedClass_key{annotatedClass_key_annotation
+                                             :: Annotation,
+                                             annotatedClass_key_class_ :: ClassDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AnnotatedClass_key where
+  toJSON (AnnotatedClass_key __field__annotation __field__class_)
+    = Aeson.object
+        ("annotation" .= __field__annotation :
+           "class_" .= __field__class_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct AnnotatedClass_key where
+  buildStruct _proxy
+    (AnnotatedClass_key __field__annotation __field__class_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "annotation" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__annotation)
+           :
+           Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__class_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__annotation <- ST.newSTRef Default.def
+            __field__class_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__annotation
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__class_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__annotation <- ST.readSTRef
+                                                                     __field__annotation
+                                             !__val__class_ <- ST.readSTRef __field__class_
+                                             Prelude.pure
+                                               (AnnotatedClass_key __val__annotation __val__class_)
+              _idMap = HashMap.fromList [("annotation", 1), ("class_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AnnotatedClass_key where
+  rnf (AnnotatedClass_key __field__annotation __field__class_)
+    = DeepSeq.rnf __field__annotation `Prelude.seq`
+        DeepSeq.rnf __field__class_ `Prelude.seq` ()
+
+instance Default.Default AnnotatedClass_key where
+  def = AnnotatedClass_key Default.def Default.def
+
+instance Hashable.Hashable AnnotatedClass_key where
+  hashWithSalt __salt (AnnotatedClass_key _annotation _class_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _annotation)
+        _class_
+{-# LINE 19 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ClassDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ClassDeclaration_key x1 x2 x3 x4 x5
+       x6 x7 x8 x9)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ClassDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ClassDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 42 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ClassDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "modifiers"
+          ([Glean.Schema.JavaAlpha.Types.Modifier])
+          ('Angle.TField "extends_"
+             (Prelude.Maybe Glean.Schema.JavaAlpha.Types.Type)
+             ('Angle.TField "implements_" ([Glean.Schema.JavaAlpha.Types.Type])
+                ('Angle.TField "annotations"
+                   ([Glean.Schema.JavaAlpha.Types.Annotation])
+                   ('Angle.TField "container"
+                      (Prelude.Maybe Glean.Schema.JavaAlpha.Types.Definition)
+                      ('Angle.TField "typeParams"
+                         ([Glean.Schema.JavaAlpha.Types.TypeParam])
+                         ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                            ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+                               ('Angle.TNoFields)))))))))
+{-# LINE 44 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ClassDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration =
+       Glean.Schema.JavaAlpha.Types.ClassDeclaration_key
+  getName _proxy = Glean.PredicateRef "java.alpha.ClassDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.classDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ClassDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.classDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 53 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ClassDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 59 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.InterfaceInheritance_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.InterfaceInheritance_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.InterfaceInheritance_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.InterfaceInheritance_key"
+           (Prelude.Just 0))
+{-# LINE 68 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.InterfaceInheritance_key
+     =
+     'Angle.TField "interface_name"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "subclass"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 70 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.InterfaceInheritance
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.InterfaceInheritance =
+       Glean.Schema.JavaAlpha.Types.InterfaceInheritance_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.InterfaceInheritance" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.interfaceInheritance_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.InterfaceInheritance x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.interfaceInheritance_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 79 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.InterfaceInheritance
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 85 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Type_key where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Type_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.Type_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Type_key" (Prelude.Just 0))
+{-# LINE 98 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.Type_key =
+     'Angle.TField "baseType" (Glean.Schema.JavaAlpha.Types.BaseType)
+       ('Angle.TField "typeArgs" ([Glean.Schema.JavaAlpha.Types.TypeArg])
+          ('Angle.TField "interopType"
+             (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Type)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 100 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.Type where
+  type KeyType Glean.Schema.JavaAlpha.Types.Type =
+       Glean.Schema.JavaAlpha.Types.Type_key
+  getName _proxy = Glean.PredicateRef "java.alpha.Type" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.JavaAlpha.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.Type x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 109 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 115 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeParam_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.TypeParam_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.TypeParam_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.TypeParam_key" (Prelude.Just 0))
+{-# LINE 126 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.TypeParam_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "extends_" ([Glean.Schema.JavaAlpha.Types.Type])
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 128 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.TypeParam
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.TypeParam =
+       Glean.Schema.JavaAlpha.Types.TypeParam_key
+  getName _proxy = Glean.PredicateRef "java.alpha.TypeParam" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.typeParam_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.TypeParam x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.typeParam_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 137 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeParam where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 143 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationComment_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationComment_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationComment_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationComment_key"
+           (Prelude.Just 0))
+{-# LINE 154 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DeclarationComment_key
+     =
+     'Angle.TField "declaration"
+       (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 156 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationComment
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationComment =
+       Glean.Schema.JavaAlpha.Types.DeclarationComment_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DeclarationComment" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationComment_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationComment x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declarationComment_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 165 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DeclarationComment
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 171 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.MethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.MethodDeclaration_key x1 x2 x3 x4 x5
+       x6 x7 x8 x9)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.MethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.MethodDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 194 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.MethodDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+       ('Angle.TField "parameters"
+          ([Glean.Schema.JavaAlpha.Types.ParameterDeclaration])
+          ('Angle.TField "returnType"
+             (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+             ('Angle.TField "annotations"
+                ([Glean.Schema.JavaAlpha.Types.Annotation])
+                ('Angle.TField "modifiers"
+                   ([Glean.Schema.JavaAlpha.Types.Modifier])
+                   ('Angle.TField "typeParams"
+                      ([Glean.Schema.JavaAlpha.Types.TypeParam])
+                      ('Angle.TField "throws_" ([Glean.Schema.JavaAlpha.Types.Type])
+                         ('Angle.TField "container"
+                            (Glean.Schema.JavaAlpha.Types.Definition)
+                            ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                               ('Angle.TNoFields)))))))))
+{-# LINE 196 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.MethodDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.MethodDeclaration =
+       Glean.Schema.JavaAlpha.Types.MethodDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.MethodDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.methodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.MethodDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.methodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 205 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.MethodDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 211 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRefFile_key where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.XRefFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.XRefFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.XRefFile_key" (Prelude.Just 0))
+{-# LINE 220 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.XRefFile_key =
+     'Angle.TField "xref"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.XRef)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TNoFields))
+{-# LINE 222 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.XRefFile
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.XRefFile =
+       Glean.Schema.JavaAlpha.Types.XRefFile_key
+  getName _proxy = Glean.PredicateRef "java.alpha.XRefFile" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.JavaAlpha.Types.xRefFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.XRefFile x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.xRefFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 231 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRefFile where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 237 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRef_key where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.XRef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.XRef_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.XRef_key" (Prelude.Just 0))
+{-# LINE 246 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.XRef_key =
+     'Angle.TField "target" (Glean.Schema.JavaAlpha.Types.XRefTarget)
+       ('Angle.TField "ranges" ([Glean.Schema.Src.Types.ByteSpan])
+          ('Angle.TNoFields))
+{-# LINE 248 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.XRef where
+  type KeyType Glean.Schema.JavaAlpha.Types.XRef =
+       Glean.Schema.JavaAlpha.Types.XRef_key
+  getName _proxy = Glean.PredicateRef "java.alpha.XRef" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.JavaAlpha.Types.xRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.XRef x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.xRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 257 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 263 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclOfExecutableDefn_key"
+           (Prelude.Just 0))
+{-# LINE 272 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn_key
+     =
+     'Angle.TField "defn"
+       (Glean.Schema.JavaAlpha.Types.ExecutableDefinition)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 274 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn =
+       Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DeclOfExecutableDefn" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declOfExecutableDefn_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declOfExecutableDefn_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 283 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclOfExecutableDefn
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 289 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeArg_key where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.TypeArg_key_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.TypeArg_key_type x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.TypeArg_key_wildcard x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.TypeArg_key_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.TypeArg_key_type,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.TypeArg_key_wildcard]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.TypeArg_key" (Prelude.Just 0))
+{-# LINE 305 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavaAlpha.Types.TypeArg_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "wildcard" (Glean.Schema.JavaAlpha.Types.Wildcard)
+          ('Angle.TNoFields))
+{-# LINE 307 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.TypeArg where
+  type KeyType Glean.Schema.JavaAlpha.Types.TypeArg =
+       Glean.Schema.JavaAlpha.Types.TypeArg_key
+  getName _proxy = Glean.PredicateRef "java.alpha.TypeArg" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.JavaAlpha.Types.typeArg_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.TypeArg x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.typeArg_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 316 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeArg where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 322 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Inheritance_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.Inheritance_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.Inheritance_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Inheritance_key" (Prelude.Just 0))
+{-# LINE 331 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.Inheritance_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "subclass"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 333 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.Inheritance
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.Inheritance =
+       Glean.Schema.JavaAlpha.Types.Inheritance_key
+  getName _proxy = Glean.PredicateRef "java.alpha.Inheritance" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.inheritance_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.Inheritance x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.inheritance_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 342 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Inheritance where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 348 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.TypeOfTypeArgs_key" (Prelude.Just 0))
+{-# LINE 357 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs_key
+     =
+     'Angle.TField "typeWithArgs"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 359 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs =
+       Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs_key
+  getName _proxy = Glean.PredicateRef "java.alpha.TypeOfTypeArgs" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.typeOfTypeArgs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.typeOfTypeArgs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 368 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeOfTypeArgs
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 374 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ParameterDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ParameterDeclaration_key x1 x2 x3 x4
+       x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ParameterDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ParameterDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 389 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ParameterDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TField "annotations"
+             ([Glean.Schema.JavaAlpha.Types.Annotation])
+             ('Angle.TField "modifier" ([Glean.Schema.JavaAlpha.Types.Modifier])
+                ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 391 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ParameterDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ParameterDeclaration =
+       Glean.Schema.JavaAlpha.Types.ParameterDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ParameterDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.parameterDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ParameterDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.parameterDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 400 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ParameterDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 406 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.FileDeclarations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.FileDeclarations_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.FileDeclarations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.FileDeclarations_key"
+           (Prelude.Just 0))
+{-# LINE 415 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.FileDeclarations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 417 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.FileDeclarations
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.FileDeclarations =
+       Glean.Schema.JavaAlpha.Types.FileDeclarations_key
+  getName _proxy = Glean.PredicateRef "java.alpha.FileDeclarations" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.fileDeclarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.FileDeclarations x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.fileDeclarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 426 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.FileDeclarations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 432 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ExtendedByDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 441 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration_key
+     =
+     'Angle.TField "parent" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "child" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 443 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration =
+       Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ExtendedByDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.extendedByDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.extendedByDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 452 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExtendedByDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 458 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.FieldDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.FieldDeclaration_key x1 x2 x3 x4 x5
+       x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.FieldDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.FieldDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 475 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.FieldDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TField "annotations"
+             ([Glean.Schema.JavaAlpha.Types.Annotation])
+             ('Angle.TField "modifiers"
+                ([Glean.Schema.JavaAlpha.Types.Modifier])
+                ('Angle.TField "container"
+                   (Glean.Schema.JavaAlpha.Types.Definition)
+                   ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                      ('Angle.TNoFields))))))
+{-# LINE 477 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.FieldDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.FieldDeclaration =
+       Glean.Schema.JavaAlpha.Types.FieldDeclaration_key
+  getName _proxy = Glean.PredicateRef "java.alpha.FieldDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.fieldDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.FieldDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.fieldDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 486 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.FieldDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 492 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.FileXRefs_key
+         where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.FileXRefs_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.FileXRefs_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.FileXRefs_key" (Prelude.Just 0))
+{-# LINE 501 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.FileXRefs_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.JavaAlpha.Types.XRef])
+          ('Angle.TNoFields))
+{-# LINE 503 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.FileXRefs
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.FileXRefs =
+       Glean.Schema.JavaAlpha.Types.FileXRefs_key
+  getName _proxy = Glean.PredicateRef "java.alpha.FileXRefs" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.fileXRefs_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.FileXRefs x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.fileXRefs_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 512 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.FileXRefs where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 518 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ImportDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ImportDeclaration_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ImportDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ImportDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 533 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ImportDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "import_on_demand" (Prelude.Bool)
+          ('Angle.TField "static_member" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TField "path"
+                (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Path)
+                ('Angle.TField "location" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 535 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ImportDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ImportDeclaration =
+       Glean.Schema.JavaAlpha.Types.ImportDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ImportDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.importDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ImportDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.importDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 544 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ImportDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 550 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.EnumDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.EnumDeclaration_key x1 x2 x3 x4 x5 x6
+       x7)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.EnumDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.EnumDeclaration_key" (Prelude.Just 0))
+{-# LINE 569 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.EnumDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "annotations"
+          ([Glean.Schema.JavaAlpha.Types.Annotation])
+          ('Angle.TField "modifiers"
+             ([Glean.Schema.JavaAlpha.Types.Modifier])
+             ('Angle.TField "implements_" ([Glean.Schema.JavaAlpha.Types.Type])
+                ('Angle.TField "container"
+                   (Prelude.Maybe Glean.Schema.JavaAlpha.Types.Definition)
+                   ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                      ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+                         ('Angle.TNoFields)))))))
+{-# LINE 571 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.EnumDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.EnumDeclaration =
+       Glean.Schema.JavaAlpha.Types.EnumDeclaration_key
+  getName _proxy = Glean.PredicateRef "java.alpha.EnumDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.enumDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.EnumDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.enumDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 580 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.EnumDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 586 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DefinitionLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DefinitionLocation_key"
+           (Prelude.Just 0))
+{-# LINE 599 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DefinitionLocation_key
+     =
+     'Angle.TField "defn" (Glean.Schema.JavaAlpha.Types.Definition)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 601 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DefinitionLocation =
+       Glean.Schema.JavaAlpha.Types.DefinitionLocation_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DefinitionLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 610 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 616 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ContainsDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ContainsDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ContainsDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ContainsDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 625 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ContainsDeclaration_key
+     =
+     'Angle.TField "container"
+       (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "member" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 627 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ContainsDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ContainsDeclaration =
+       Glean.Schema.JavaAlpha.Types.ContainsDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ContainsDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.containsDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ContainsDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.containsDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 636 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ContainsDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 642 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ObjectType_key
+         where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.ObjectType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ObjectType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ObjectType_key" (Prelude.Just 0))
+{-# LINE 651 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.ObjectType_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 653 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.ObjectType
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ObjectType =
+       Glean.Schema.JavaAlpha.Types.ObjectType_key
+  getName _proxy = Glean.PredicateRef "java.alpha.ObjectType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.objectType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ObjectType x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.objectType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 662 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ObjectType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 668 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationAnnotations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationAnnotations_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationAnnotations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationAnnotations_key"
+           (Prelude.Just 0))
+{-# LINE 677 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DeclarationAnnotations_key
+     =
+     'Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "annotations"
+          ([Glean.Schema.JavaAlpha.Types.Annotation])
+          ('Angle.TNoFields))
+{-# LINE 679 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationAnnotations
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationAnnotations =
+       Glean.Schema.JavaAlpha.Types.DeclarationAnnotations_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DeclarationAnnotations" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationAnnotations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationAnnotations x k
+  getFactKey
+    = Glean.Schema.JavaAlpha.Types.declarationAnnotations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 688 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationAnnotations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 694 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 705 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.DeclarationUses_key
+     =
+     'Angle.TField "target" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "uses" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 707 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationUses =
+       Glean.Schema.JavaAlpha.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "java.alpha.DeclarationUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 716 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DeclarationUses
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 722 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.LocalDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.LocalDeclaration_key x1 x2 x3 x4 x5
+       x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.LocalDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.LocalDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 739 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.LocalDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TField "annotations"
+             ([Glean.Schema.JavaAlpha.Types.Annotation])
+             ('Angle.TField "modifier" ([Glean.Schema.JavaAlpha.Types.Modifier])
+                ('Angle.TField "container"
+                   (Glean.Schema.JavaAlpha.Types.ExecutableDefinition)
+                   ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                      ('Angle.TNoFields))))))
+{-# LINE 741 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.LocalDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.LocalDeclaration =
+       Glean.Schema.JavaAlpha.Types.LocalDeclaration_key
+  getName _proxy = Glean.PredicateRef "java.alpha.LocalDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.localDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.LocalDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.localDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 750 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.LocalDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 756 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.PackageDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.PackageDeclaration_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.PackageDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.PackageDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 769 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.PackageDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "annotation"
+          ([Glean.Schema.JavaAlpha.Types.Annotation])
+          ('Angle.TField "path"
+             (Prelude.Maybe Glean.Schema.JavakotlinAlpha.Types.Path)
+             ('Angle.TField "location" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 771 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.PackageDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.PackageDeclaration =
+       Glean.Schema.JavaAlpha.Types.PackageDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.PackageDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.packageDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.PackageDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.packageDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 780 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.PackageDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 786 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ParentDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ParentDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ParentDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ParentDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 795 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ParentDeclaration_key
+     =
+     'Angle.TField "child" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "parent" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 797 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ParentDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ParentDeclaration =
+       Glean.Schema.JavaAlpha.Types.ParentDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ParentDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.parentDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ParentDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.parentDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 806 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ParentDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 812 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 825 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DeclarationLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 827 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationLocation =
+       Glean.Schema.JavaAlpha.Types.DeclarationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DeclarationLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 836 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 842 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationXRefTarget_key"
+           (Prelude.Just 0))
+{-# LINE 851 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget_key
+     =
+     'Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "xref" (Glean.Schema.JavaAlpha.Types.XRefTarget)
+          ('Angle.TNoFields))
+{-# LINE 853 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget =
+       Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.DeclarationXRefTarget" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationXRefTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declarationXRefTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 862 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationXRefTarget
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 868 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeVar_key where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.TypeVar_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.TypeVar_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.TypeVar_key" (Prelude.Just 0))
+{-# LINE 877 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.TypeVar_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 879 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.TypeVar where
+  type KeyType Glean.Schema.JavaAlpha.Types.TypeVar =
+       Glean.Schema.JavaAlpha.Types.TypeVar_key
+  getName _proxy = Glean.PredicateRef "java.alpha.TypeVar" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.JavaAlpha.Types.typeVar_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.TypeVar x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.typeVar_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 888 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.TypeVar where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 894 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.XRefTargetDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 903 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration_key
+     =
+     'Angle.TField "xref" (Glean.Schema.JavaAlpha.Types.XRefTarget)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 905 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration =
+       Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.XRefTargetDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.xRefTargetDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.xRefTargetDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 914 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.XRefTargetDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 920 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.InterfaceDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.InterfaceDeclaration_key x1 x2 x3 x4
+       x5 x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.InterfaceDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.InterfaceDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 941 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.InterfaceDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "annotations"
+          ([Glean.Schema.JavaAlpha.Types.Annotation])
+          ('Angle.TField "modifiers"
+             ([Glean.Schema.JavaAlpha.Types.Modifier])
+             ('Angle.TField "extends_" ([Glean.Schema.JavaAlpha.Types.Type])
+                ('Angle.TField "container"
+                   (Prelude.Maybe Glean.Schema.JavaAlpha.Types.Definition)
+                   ('Angle.TField "typeParams"
+                      ([Glean.Schema.JavaAlpha.Types.TypeParam])
+                      ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                         ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+                            ('Angle.TNoFields))))))))
+{-# LINE 943 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.InterfaceDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.InterfaceDeclaration =
+       Glean.Schema.JavaAlpha.Types.InterfaceDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.InterfaceDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.interfaceDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.InterfaceDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.interfaceDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 952 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.InterfaceDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 958 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.QNameToDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.QNameToDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.QNameToDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.QNameToDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 967 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.QNameToDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "defn" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 969 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.QNameToDefinition
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.QNameToDefinition =
+       Glean.Schema.JavaAlpha.Types.QNameToDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.QNameToDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.qNameToDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.QNameToDefinition x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.qNameToDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 978 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.QNameToDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 984 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ArrayType_key
+         where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.ArrayType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ArrayType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ArrayType_key" (Prelude.Just 0))
+{-# LINE 993 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.ArrayType_key =
+     'Angle.TField "contents"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 995 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.ArrayType
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ArrayType =
+       Glean.Schema.JavaAlpha.Types.ArrayType_key
+  getName _proxy = Glean.PredicateRef "java.alpha.ArrayType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.arrayType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ArrayType x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.arrayType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1004 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ArrayType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1010 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ConstructorDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ConstructorDeclaration_key x1 x2 x3
+       x4 x5 x6 x7 x8)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ConstructorDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ConstructorDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1031 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ConstructorDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+       ('Angle.TField "parameters"
+          ([Glean.Schema.JavaAlpha.Types.ParameterDeclaration])
+          ('Angle.TField "annotations"
+             ([Glean.Schema.JavaAlpha.Types.Annotation])
+             ('Angle.TField "modifiers"
+                ([Glean.Schema.JavaAlpha.Types.Modifier])
+                ('Angle.TField "typeParams"
+                   ([Glean.Schema.JavaAlpha.Types.TypeParam])
+                   ('Angle.TField "throws_" ([Glean.Schema.JavaAlpha.Types.Type])
+                      ('Angle.TField "container"
+                         (Glean.Schema.JavaAlpha.Types.Definition)
+                         ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                            ('Angle.TNoFields))))))))
+{-# LINE 1033 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ConstructorDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ConstructorDeclaration =
+       Glean.Schema.JavaAlpha.Types.ConstructorDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ConstructorDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.constructorDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ConstructorDeclaration x k
+  getFactKey
+    = Glean.Schema.JavaAlpha.Types.constructorDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1042 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ConstructorDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1048 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Annotation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.Annotation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.Annotation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Annotation_key" (Prelude.Just 0))
+{-# LINE 1061 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.Annotation_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "constructor"
+          (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+          ('Angle.TField "constant" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 1063 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.Annotation
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.Annotation =
+       Glean.Schema.JavaAlpha.Types.Annotation_key
+  getName _proxy = Glean.PredicateRef "java.alpha.Annotation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.annotation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.Annotation x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.annotation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1072 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Annotation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1078 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DeclOfDefn_key
+         where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.DeclOfDefn_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclOfDefn_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclOfDefn_key" (Prelude.Just 0))
+{-# LINE 1087 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.DeclOfDefn_key =
+     'Angle.TField "defn" (Glean.Schema.JavaAlpha.Types.Definition)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1089 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.DeclOfDefn
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclOfDefn =
+       Glean.Schema.JavaAlpha.Types.DeclOfDefn_key
+  getName _proxy = Glean.PredicateRef "java.alpha.DeclOfDefn" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declOfDefn_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclOfDefn x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declOfDefn_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1098 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DeclOfDefn where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1104 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.AnnotatedClass_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.AnnotatedClass_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.AnnotatedClass_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.AnnotatedClass_key" (Prelude.Just 0))
+{-# LINE 1113 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.AnnotatedClass_key
+     =
+     'Angle.TField "annotation"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Annotation)
+       ('Angle.TField "class_"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1115 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.AnnotatedClass
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.AnnotatedClass =
+       Glean.Schema.JavaAlpha.Types.AnnotatedClass_key
+  getName _proxy = Glean.PredicateRef "java.alpha.AnnotatedClass" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.annotatedClass_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.AnnotatedClass x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.annotatedClass_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1124 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.AnnotatedClass
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1130 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRefOfType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.XRefOfType_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.XRefOfType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.XRefOfType_key" (Prelude.Just 0))
+{-# LINE 1141 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.XRefOfType_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TField "use" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1143 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.XRefOfType
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.XRefOfType =
+       Glean.Schema.JavaAlpha.Types.XRefOfType_key
+  getName _proxy = Glean.PredicateRef "java.alpha.XRefOfType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.xRefOfType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.XRefOfType x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.xRefOfType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1152 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRefOfType where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1158 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.DeclarationType_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.DeclarationType_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.DeclarationType_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.DeclarationType_key" (Prelude.Just 0))
+{-# LINE 1167 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.DeclarationType_key
+     =
+     'Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TNoFields))
+{-# LINE 1169 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.DeclarationType
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.DeclarationType =
+       Glean.Schema.JavaAlpha.Types.DeclarationType_key
+  getName _proxy = Glean.PredicateRef "java.alpha.DeclarationType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.declarationType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.DeclarationType x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.declarationType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1178 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.DeclarationType
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1184 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExtendsDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ExtendsDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ExtendsDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ExtendsDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1193 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ExtendsDeclaration_key
+     =
+     'Angle.TField "child" (Glean.Schema.JavaAlpha.Types.Declaration)
+       ('Angle.TField "parent" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1195 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ExtendsDeclaration
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ExtendsDeclaration =
+       Glean.Schema.JavaAlpha.Types.ExtendsDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ExtendsDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.extendsDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ExtendsDeclaration x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.extendsDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1204 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.ExtendsDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1210 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ExecutableDefnLocation_key"
+           (Prelude.Just 0))
+{-# LINE 1223 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation_key
+     =
+     'Angle.TField "defn"
+       (Glean.Schema.JavaAlpha.Types.ExecutableDefinition)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+             ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+                ('Angle.TNoFields))))
+{-# LINE 1225 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation =
+       Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation_key
+  getName _proxy
+    = Glean.PredicateRef "java.alpha.ExecutableDefnLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.executableDefnLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation x k
+  getFactKey
+    = Glean.Schema.JavaAlpha.Types.executableDefnLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1234 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExecutableDefnLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1240 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.PrimitiveType_key
+         where
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.PrimitiveType_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.JavaAlpha.Types.PrimitiveType_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.PrimitiveType_key" (Prelude.Just 0))
+{-# LINE 1247 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavaAlpha.Types.PrimitiveType_key =
+     'Angle.TField "type" (Data.Text.Text) ('Angle.TNoFields)
+{-# LINE 1249 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavaAlpha.Types.PrimitiveType
+         where
+  type KeyType Glean.Schema.JavaAlpha.Types.PrimitiveType =
+       Glean.Schema.JavaAlpha.Types.PrimitiveType_key
+  getName _proxy = Glean.PredicateRef "java.alpha.PrimitiveType" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavaAlpha.Types.primitiveType_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavaAlpha.Types.PrimitiveType x k
+  getFactKey = Glean.Schema.JavaAlpha.Types.primitiveType_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1258 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.PrimitiveType
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1264 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Definition where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.Definition_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Definition_class_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.Definition_interface_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Definition_enum_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.Definition_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.Definition_class_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Definition_interface_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Definition_enum_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Definition" (Prelude.Just 1))
+{-# LINE 1284 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavaAlpha.Types.Definition =
+     'Angle.TField "class_"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration)
+       ('Angle.TField "interface_"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.InterfaceDeclaration)
+          ('Angle.TField "enum_"
+             (Glean.KeyType Glean.Schema.JavaAlpha.Types.EnumDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1286 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.BaseType where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.BaseType_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.BaseType_object x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.BaseType_primitive x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.BaseType_variable x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.BaseType_array x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.BaseType_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.BaseType_object,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.BaseType_primitive,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.BaseType_variable,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.BaseType_array]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.BaseType" (Prelude.Just 1))
+{-# LINE 1310 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.JavaAlpha.Types.BaseType
+     =
+     'Angle.TField "object"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.ObjectType)
+       ('Angle.TField "primitive"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.PrimitiveType)
+          ('Angle.TField "variable"
+             (Glean.KeyType Glean.Schema.JavaAlpha.Types.TypeVar)
+             ('Angle.TField "array"
+                (Glean.KeyType Glean.Schema.JavaAlpha.Types.ArrayType)
+                ('Angle.TNoFields))))
+{-# LINE 1312 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.XRefTarget where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.XRefTarget_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.XRefTarget_definition_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.XRefTarget_ctor_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.XRefTarget_method_ x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.XRefTarget_field_ x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.XRefTarget_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.XRefTarget_definition_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.XRefTarget_ctor_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.XRefTarget_method_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.XRefTarget_field_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.XRefTarget" (Prelude.Just 1))
+{-# LINE 1336 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavaAlpha.Types.XRefTarget =
+     'Angle.TField "definition_"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "ctor_"
+          (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+          ('Angle.TField "method_"
+             (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+             ('Angle.TField "field_"
+                (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+                ('Angle.TNoFields))))
+{-# LINE 1338 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Declaration where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 8
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_param x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_local x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_field x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_ctor x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_method x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.Declaration_interface_ x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_class_ x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Declaration_enum_ x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_param,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_local,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_field,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_ctor,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_method,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_interface_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_class_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Declaration_enum_]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Declaration" (Prelude.Just 1))
+{-# LINE 1378 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavaAlpha.Types.Declaration =
+     'Angle.TField "param"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.ParameterDeclaration)
+       ('Angle.TField "local"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.LocalDeclaration)
+          ('Angle.TField "field"
+             (Glean.KeyType Glean.Schema.JavaAlpha.Types.FieldDeclaration)
+             ('Angle.TField "ctor"
+                (Glean.KeyType Glean.Schema.JavaAlpha.Types.ConstructorDeclaration)
+                ('Angle.TField "method"
+                   (Glean.KeyType Glean.Schema.JavaAlpha.Types.MethodDeclaration)
+                   ('Angle.TField "interface_"
+                      (Glean.KeyType Glean.Schema.JavaAlpha.Types.InterfaceDeclaration)
+                      ('Angle.TField "class_"
+                         (Glean.KeyType Glean.Schema.JavaAlpha.Types.ClassDeclaration)
+                         ('Angle.TField "enum_"
+                            (Glean.KeyType Glean.Schema.JavaAlpha.Types.EnumDeclaration)
+                            ('Angle.TNoFields))))))))
+{-# LINE 1380 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavaAlpha.Types.ExecutableDefinition
+         where
+  buildRtsValue b
+    Glean.Schema.JavaAlpha.Types.ExecutableDefinition_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ExecutableDefinition_constructor x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavaAlpha.Types.ExecutableDefinition_method x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure
+           Glean.Schema.JavaAlpha.Types.ExecutableDefinition_EMPTY)
+        [Glean.mapD
+           Glean.Schema.JavaAlpha.Types.ExecutableDefinition_constructor,
+         Glean.mapD
+           Glean.Schema.JavaAlpha.Types.ExecutableDefinition_method]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.ExecutableDefinition"
+           (Prelude.Just 1))
+{-# LINE 1396 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavaAlpha.Types.ExecutableDefinition =
+     'Angle.TField "constructor"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.ConstructorDeclaration)
+       ('Angle.TField "method"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.MethodDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1398 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Modifier where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Modifier" (Prelude.Just 1))
+{-# LINE 1403 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.JavaAlpha.Types.Modifier
+     =
+     'Angle.TField "abstract_" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "default_" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "final_" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "native_" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "private_" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "protected_" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "public_" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "static_" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "strictfp_" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "synchronized_" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "transient_" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "volatile_" (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TNoFields))))))))))))
+{-# LINE 1405 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.JavaAlpha.Types.Modifier
+         where
+  type AngleEnumTy Glean.Schema.JavaAlpha.Types.Modifier =
+       Glean.Schema.JavaAlpha.Types.Modifier
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 1409 "glean/schema/thrift/java_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavaAlpha.Types.Wildcard where
+  buildRtsValue b Glean.Schema.JavaAlpha.Types.Wildcard_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Wildcard_extends_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Wildcard_super_ x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.JavaAlpha.Types.Wildcard_unbounded x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavaAlpha.Types.Wildcard_EMPTY)
+        [Glean.mapD Glean.Schema.JavaAlpha.Types.Wildcard_extends_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Wildcard_super_,
+         Glean.mapD Glean.Schema.JavaAlpha.Types.Wildcard_unbounded]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "java.alpha.Wildcard" (Prelude.Just 1))
+{-# LINE 1429 "glean/schema/thrift/java_alpha_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.JavaAlpha.Types.Wildcard
+     =
+     'Angle.TField "extends_"
+       (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+       ('Angle.TField "super_"
+          (Glean.KeyType Glean.Schema.JavaAlpha.Types.Type)
+          ('Angle.TField "unbounded" (Prelude.Bool) ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/JavakotlinAlpha/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/JavakotlinAlpha/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/JavakotlinAlpha/Types.hs
@@ -0,0 +1,1182 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/JavakotlinAlpha/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.JavakotlinAlpha.Types
+       (pREDICATE_VERSIONS, Type_id, Type(Type, type_id, type_key),
+        QName_id, QName(QName, qName_id, qName_key), Path_id,
+        Path(Path, path_id, path_key), NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        Name_id, Name(Name, name_id, name_key), MethodName_id,
+        MethodName(MethodName, methodName_id, methodName_key),
+        Type_key(Type_key_EMPTY, Type_key_primitive, Type_key_object,
+                 Type_key_array),
+        QName_key(QName_key, qName_key_name, qName_key_context),
+        Path_key(Path_key, path_key_base, path_key_container),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowercase, nameLowerCase_key_name),
+        MethodName_key(MethodName_key, methodName_key_name,
+                       methodName_key_signature))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 85 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/JavakotlinAlpha/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("Name", 1), ("MethodName", 1), ("NameLowerCase", 1), ("Type", 1),
+       ("QName", 1), ("Path", 1)]
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Type_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QName_id = Glean.Id
+
+data QName = QName{qName_id :: {-# UNPACK #-} !QName_id,
+                   qName_key :: Prelude.Maybe QName_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName where
+  toJSON (QName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QName where
+  buildStruct _proxy (QName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName where
+  rnf (QName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QName where
+  def = QName Default.def Prelude.Nothing
+
+instance Hashable.Hashable QName where
+  hashWithSalt __salt (QName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Path_id = Glean.Id
+
+data Path = Path{path_id :: {-# UNPACK #-} !Path_id,
+                 path_key :: Prelude.Maybe Path_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Path where
+  toJSON (Path __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Path where
+  buildStruct _proxy (Path __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Path __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Path where
+  rnf (Path __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Path where
+  def = Path Default.def Prelude.Nothing
+
+instance Hashable.Hashable Path where
+  hashWithSalt __salt (Path _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodName_id = Glean.Id
+
+data MethodName = MethodName{methodName_id ::
+                             {-# UNPACK #-} !MethodName_id,
+                             methodName_key :: Prelude.Maybe MethodName_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodName where
+  toJSON (MethodName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodName where
+  buildStruct _proxy (MethodName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodName where
+  rnf (MethodName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodName where
+  def = MethodName Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodName where
+  hashWithSalt __salt (MethodName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Type_key = Type_key_primitive Text.Text
+              | Type_key_object Path
+              | Type_key_array Type
+              | Type_key_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_key where
+  toJSON (Type_key_primitive __primitive)
+    = Aeson.object ["primitive" .= __primitive]
+  toJSON (Type_key_object __object)
+    = Aeson.object ["object" .= __object]
+  toJSON (Type_key_array __array) = Aeson.object ["array" .= __array]
+  toJSON Type_key_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Type_key where
+  buildStruct _proxy (Type_key_primitive __primitive)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "primitive" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __primitive)]
+  buildStruct _proxy (Type_key_object __object)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "object" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __object)]
+  buildStruct _proxy (Type_key_array __array)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "array" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __array)]
+  buildStruct _proxy Type_key_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStringType _proxy ->
+                                                         do _val <- Thrift.parseText _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_primitive _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_object _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Type_key_array _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Type_key_EMPTY
+           Thrift.FieldEnd -> Prelude.return Type_key_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("primitive", 1), ("object", 2), ("array", 3)]
+
+instance DeepSeq.NFData Type_key where
+  rnf (Type_key_primitive __primitive) = DeepSeq.rnf __primitive
+  rnf (Type_key_object __object) = DeepSeq.rnf __object
+  rnf (Type_key_array __array) = DeepSeq.rnf __array
+  rnf Type_key_EMPTY = ()
+
+instance Default.Default Type_key where
+  def = Type_key_EMPTY
+
+instance Hashable.Hashable Type_key where
+  hashWithSalt __salt (Type_key_primitive _primitive)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _primitive)
+  hashWithSalt __salt (Type_key_object _object)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _object)
+  hashWithSalt __salt (Type_key_array _array)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _array)
+  hashWithSalt __salt Type_key_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data QName_key = QName_key{qName_key_name :: Name,
+                           qName_key_context :: Path}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QName_key where
+  toJSON (QName_key __field__name __field__context)
+    = Aeson.object
+        ("name" .= __field__name :
+           "context" .= __field__context : Prelude.mempty)
+
+instance Thrift.ThriftStruct QName_key where
+  buildStruct _proxy (QName_key __field__name __field__context)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "context" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__context)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__context <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__context
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__context <- ST.readSTRef __field__context
+                                             Prelude.pure (QName_key __val__name __val__context)
+              _idMap = HashMap.fromList [("name", 1), ("context", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QName_key where
+  rnf (QName_key __field__name __field__context)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__context `Prelude.seq` ()
+
+instance Default.Default QName_key where
+  def = QName_key Default.def Default.def
+
+instance Hashable.Hashable QName_key where
+  hashWithSalt __salt (QName_key _name _context)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _context
+
+data Path_key = Path_key{path_key_base :: Name,
+                         path_key_container :: Prelude.Maybe Path}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Path_key where
+  toJSON (Path_key __field__base __field__container)
+    = Aeson.object
+        ("base" .= __field__base :
+           Prelude.maybe Prelude.id ((:) . ("container" .=))
+             __field__container
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Path_key where
+  buildStruct _proxy (Path_key __field__base __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           case __field__container of
+             Prelude.Just _val -> Thrift.genField _proxy "container"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure (Path_key __val__base __val__container)
+              _idMap = HashMap.fromList [("base", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Path_key where
+  rnf (Path_key __field__base __field__container)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default Path_key where
+  def = Path_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable Path_key where
+  hashWithSalt __salt (Path_key _base _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _container
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowercase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowercase __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowercase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowercase __val__name)
+              _idMap = HashMap.fromList [("nameLowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowercase __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowercase)
+        _name
+
+data MethodName_key = MethodName_key{methodName_key_name :: QName,
+                                     methodName_key_signature :: [Type]}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodName_key where
+  toJSON (MethodName_key __field__name __field__signature)
+    = Aeson.object
+        ("name" .= __field__name :
+           "signature" .= __field__signature : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodName_key where
+  buildStruct _proxy
+    (MethodName_key __field__name __field__signature)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "signature" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__signature)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             Prelude.pure
+                                               (MethodName_key __val__name __val__signature)
+              _idMap = HashMap.fromList [("name", 1), ("signature", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodName_key where
+  rnf (MethodName_key __field__name __field__signature)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__signature `Prelude.seq` ()
+
+instance Default.Default MethodName_key where
+  def = MethodName_key Default.def Default.def
+
+instance Hashable.Hashable MethodName_key where
+  hashWithSalt __salt (MethodName_key _name _signature)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _signature
+{-# LINE 17 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavakotlinAlpha.Types.Name
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.Name =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "javakotlin.alpha.Name" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.Name x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 25 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 31 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavakotlinAlpha.Types.MethodName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.MethodName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavakotlinAlpha.Types.MethodName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "javakotlin.alpha.MethodName_key"
+           (Prelude.Just 0))
+{-# LINE 40 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavakotlinAlpha.Types.MethodName_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "signature"
+          ([Glean.Schema.JavakotlinAlpha.Types.Type])
+          ('Angle.TNoFields))
+{-# LINE 42 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavakotlinAlpha.Types.MethodName
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName =
+       Glean.Schema.JavakotlinAlpha.Types.MethodName_key
+  getName _proxy = Glean.PredicateRef "javakotlin.alpha.MethodName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.methodName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.MethodName x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.methodName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 51 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.MethodName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 57 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavakotlinAlpha.Types.NameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavakotlinAlpha.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "javakotlin.alpha.NameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 66 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.JavakotlinAlpha.Types.NameLowerCase_key
+     =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 68 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.JavakotlinAlpha.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.NameLowerCase =
+       Glean.Schema.JavakotlinAlpha.Types.NameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "javakotlin.alpha.NameLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 77 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.JavakotlinAlpha.Types.NameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 83 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.Type_key
+         where
+  buildRtsValue b Glean.Schema.JavakotlinAlpha.Types.Type_key_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.Type_key_primitive x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.Type_key_object x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.Type_key_array x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.JavakotlinAlpha.Types.Type_key_EMPTY)
+        [Glean.mapD Glean.Schema.JavakotlinAlpha.Types.Type_key_primitive,
+         Glean.mapD Glean.Schema.JavakotlinAlpha.Types.Type_key_object,
+         Glean.mapD Glean.Schema.JavakotlinAlpha.Types.Type_key_array]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "javakotlin.alpha.Type_key" (Prelude.Just 0))
+{-# LINE 103 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.JavakotlinAlpha.Types.Type_key =
+     'Angle.TField "primitive" (Data.Text.Text)
+       ('Angle.TField "object"
+          (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Path)
+          ('Angle.TField "array"
+             (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Type)
+             ('Angle.TNoFields)))
+{-# LINE 105 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavakotlinAlpha.Types.Type
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.Type =
+       Glean.Schema.JavakotlinAlpha.Types.Type_key
+  getName _proxy = Glean.PredicateRef "javakotlin.alpha.Type" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.Type x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 114 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 120 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.QName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.JavakotlinAlpha.Types.QName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavakotlinAlpha.Types.QName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "javakotlin.alpha.QName_key" (Prelude.Just 0))
+{-# LINE 129 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavakotlinAlpha.Types.QName_key =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "context"
+          (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Path)
+          ('Angle.TNoFields))
+{-# LINE 131 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavakotlinAlpha.Types.QName
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.QName =
+       Glean.Schema.JavakotlinAlpha.Types.QName_key
+  getName _proxy = Glean.PredicateRef "javakotlin.alpha.QName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.qName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.QName x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.qName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 140 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.QName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 146 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.Path_key
+         where
+  buildRtsValue b (Glean.Schema.JavakotlinAlpha.Types.Path_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.JavakotlinAlpha.Types.Path_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "javakotlin.alpha.Path_key" (Prelude.Just 0))
+{-# LINE 155 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.JavakotlinAlpha.Types.Path_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "container"
+          (Prelude.Maybe Glean.Schema.JavakotlinAlpha.Types.Path)
+          ('Angle.TNoFields))
+{-# LINE 157 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.JavakotlinAlpha.Types.Path
+         where
+  type KeyType Glean.Schema.JavakotlinAlpha.Types.Path =
+       Glean.Schema.JavakotlinAlpha.Types.Path_key
+  getName _proxy = Glean.PredicateRef "javakotlin.alpha.Path" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.JavakotlinAlpha.Types.path_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.JavakotlinAlpha.Types.Path x k
+  getFactKey = Glean.Schema.JavakotlinAlpha.Types.path_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 166 "glean/schema/thrift/javakotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.JavakotlinAlpha.Types.Path where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/KotlinAlpha/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/KotlinAlpha/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/KotlinAlpha/Types.hs
@@ -0,0 +1,3160 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/KotlinAlpha/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.KotlinAlpha.Types
+       (pREDICATE_VERSIONS, VariableParent_id,
+        VariableParent(VariableParent, variableParent_id,
+                       variableParent_key),
+        VariableDeclaration_id,
+        VariableDeclaration(VariableDeclaration, variableDeclaration_id,
+                            variableDeclaration_key),
+        TypeArg_id, TypeArg(TypeArg, typeArg_id, typeArg_key), Type_id,
+        Type(Type, type_id, type_key), DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationFileLocation_id,
+        DeclarationFileLocation(DeclarationFileLocation,
+                                declarationFileLocation_id, declarationFileLocation_key),
+        ExtendsDeclaration_id,
+        ExtendsDeclaration(ExtendsDeclaration, extendsDeclaration_id,
+                           extendsDeclaration_key),
+        FileDeclarations_id,
+        FileDeclarations(FileDeclarations, fileDeclarations_id,
+                         fileDeclarations_key),
+        MethodDeclaration_id,
+        MethodDeclaration(MethodDeclaration, methodDeclaration_id,
+                          methodDeclaration_key),
+        ParentDeclaration_id,
+        ParentDeclaration(ParentDeclaration, parentDeclaration_id,
+                          parentDeclaration_key),
+        ContainsDeclaration_id,
+        ContainsDeclaration(ContainsDeclaration, containsDeclaration_id,
+                            containsDeclaration_key),
+        ClassMember_id,
+        ClassMember(ClassMember, classMember_id, classMember_key),
+        ClassDeclaration_id,
+        ClassDeclaration(ClassDeclaration, classDeclaration_id,
+                         classDeclaration_key),
+        VariableParent_key(VariableParent_key, variableParent_key_child,
+                           variableParent_key_parent),
+        VariableDeclaration_key(VariableDeclaration_key,
+                                variableDeclaration_key_name, variableDeclaration_key_type,
+                                variableDeclaration_key_location),
+        TypeArg_key(TypeArg_key, typeArg_key_type),
+        Type_key(Type_key, type_key_type, type_key_location,
+                 type_key_typeArgs, type_key_isNullable),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_file, declarationLocation_key_span),
+        Declaration(Declaration_EMPTY, Declaration_class_,
+                    Declaration_method, Declaration_variable),
+        DeclarationFileLocation_key(DeclarationFileLocation_key,
+                                    declarationFileLocation_key_decl,
+                                    declarationFileLocation_key_file,
+                                    declarationFileLocation_key_span,
+                                    declarationFileLocation_key_name),
+        ExtendsDeclaration_key(ExtendsDeclaration_key,
+                               extendsDeclaration_key_child, extendsDeclaration_key_parent),
+        FileDeclarations_key(FileDeclarations_key,
+                             fileDeclarations_key_file, fileDeclarations_key_decl),
+        MethodDeclaration_key(MethodDeclaration_key,
+                              methodDeclaration_key_name, methodDeclaration_key_parameters,
+                              methodDeclaration_key_returnType, methodDeclaration_key_loc,
+                              methodDeclaration_key_location, methodDeclaration_key_container),
+        ParentDeclaration_key(ParentDeclaration_key,
+                              parentDeclaration_key_child, parentDeclaration_key_parent),
+        ContainsDeclaration_key(ContainsDeclaration_key,
+                                containsDeclaration_key_parent, containsDeclaration_key_child),
+        ClassMember_key(ClassMember_key, classMember_key_parent,
+                        classMember_key_child),
+        ClassDeclaration_key(ClassDeclaration_key,
+                             classDeclaration_key_name, classDeclaration_key_implements_,
+                             classDeclaration_key_location))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.JavakotlinAlpha.Types
+       as Glean.Schema.JavakotlinAlpha
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Schema.JavakotlinAlpha.Types
+{-# LINE 16 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 145 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/KotlinAlpha/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("ClassMember", 2), ("FileDeclarations", 2),
+       ("ExtendsDeclaration", 2), ("MethodDeclaration", 2),
+       ("TypeArg", 2), ("VariableDeclaration", 2), ("VariableParent", 2),
+       ("ParentDeclaration", 2), ("DeclarationFileLocation", 2),
+       ("Type", 2), ("ClassDeclaration", 2), ("ContainsDeclaration", 2),
+       ("DeclarationLocation", 2)]
+
+type VariableParent_id = Glean.Id
+
+data VariableParent = VariableParent{variableParent_id ::
+                                     {-# UNPACK #-} !VariableParent_id,
+                                     variableParent_key :: Prelude.Maybe VariableParent_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableParent where
+  toJSON (VariableParent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableParent where
+  buildStruct _proxy (VariableParent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableParent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableParent where
+  rnf (VariableParent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableParent where
+  def = VariableParent Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableParent where
+  hashWithSalt __salt (VariableParent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableDeclaration_id = Glean.Id
+
+data VariableDeclaration = VariableDeclaration{variableDeclaration_id
+                                               :: {-# UNPACK #-} !VariableDeclaration_id,
+                                               variableDeclaration_key ::
+                                               Prelude.Maybe VariableDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration where
+  toJSON (VariableDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration where
+  buildStruct _proxy (VariableDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration where
+  rnf (VariableDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration where
+  def = VariableDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDeclaration where
+  hashWithSalt __salt (VariableDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TypeArg_id = Glean.Id
+
+data TypeArg = TypeArg{typeArg_id :: {-# UNPACK #-} !TypeArg_id,
+                       typeArg_key :: Prelude.Maybe TypeArg_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeArg where
+  toJSON (TypeArg __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeArg where
+  buildStruct _proxy (TypeArg __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TypeArg __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeArg where
+  rnf (TypeArg __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TypeArg where
+  def = TypeArg Default.def Prelude.Nothing
+
+instance Hashable.Hashable TypeArg where
+  hashWithSalt __salt (TypeArg _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Type_key}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationFileLocation_id = Glean.Id
+
+data DeclarationFileLocation = DeclarationFileLocation{declarationFileLocation_id
+                                                       ::
+                                                       {-# UNPACK #-} !DeclarationFileLocation_id,
+                                                       declarationFileLocation_key ::
+                                                       Prelude.Maybe DeclarationFileLocation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationFileLocation where
+  toJSON (DeclarationFileLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationFileLocation where
+  buildStruct _proxy
+    (DeclarationFileLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationFileLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationFileLocation where
+  rnf (DeclarationFileLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationFileLocation where
+  def = DeclarationFileLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationFileLocation where
+  hashWithSalt __salt (DeclarationFileLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ExtendsDeclaration_id = Glean.Id
+
+data ExtendsDeclaration = ExtendsDeclaration{extendsDeclaration_id
+                                             :: {-# UNPACK #-} !ExtendsDeclaration_id,
+                                             extendsDeclaration_key ::
+                                             Prelude.Maybe ExtendsDeclaration_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsDeclaration where
+  toJSON (ExtendsDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsDeclaration where
+  buildStruct _proxy (ExtendsDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ExtendsDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsDeclaration where
+  rnf (ExtendsDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ExtendsDeclaration where
+  def = ExtendsDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ExtendsDeclaration where
+  hashWithSalt __salt (ExtendsDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDeclarations_id = Glean.Id
+
+data FileDeclarations = FileDeclarations{fileDeclarations_id ::
+                                         {-# UNPACK #-} !FileDeclarations_id,
+                                         fileDeclarations_key :: Prelude.Maybe FileDeclarations_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations where
+  toJSON (FileDeclarations __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations where
+  buildStruct _proxy (FileDeclarations __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileDeclarations __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations where
+  rnf (FileDeclarations __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileDeclarations where
+  def = FileDeclarations Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileDeclarations where
+  hashWithSalt __salt (FileDeclarations _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodDeclaration_id = Glean.Id
+
+data MethodDeclaration = MethodDeclaration{methodDeclaration_id ::
+                                           {-# UNPACK #-} !MethodDeclaration_id,
+                                           methodDeclaration_key ::
+                                           Prelude.Maybe MethodDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration where
+  toJSON (MethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodDeclaration where
+  buildStruct _proxy (MethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration where
+  rnf (MethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration where
+  def = MethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodDeclaration where
+  hashWithSalt __salt (MethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ParentDeclaration_id = Glean.Id
+
+data ParentDeclaration = ParentDeclaration{parentDeclaration_id ::
+                                           {-# UNPACK #-} !ParentDeclaration_id,
+                                           parentDeclaration_key ::
+                                           Prelude.Maybe ParentDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParentDeclaration where
+  toJSON (ParentDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ParentDeclaration where
+  buildStruct _proxy (ParentDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ParentDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParentDeclaration where
+  rnf (ParentDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ParentDeclaration where
+  def = ParentDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ParentDeclaration where
+  hashWithSalt __salt (ParentDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainsDeclaration_id = Glean.Id
+
+data ContainsDeclaration = ContainsDeclaration{containsDeclaration_id
+                                               :: {-# UNPACK #-} !ContainsDeclaration_id,
+                                               containsDeclaration_key ::
+                                               Prelude.Maybe ContainsDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsDeclaration where
+  toJSON (ContainsDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsDeclaration where
+  buildStruct _proxy (ContainsDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainsDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsDeclaration where
+  rnf (ContainsDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainsDeclaration where
+  def = ContainsDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainsDeclaration where
+  hashWithSalt __salt (ContainsDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassMember_id = Glean.Id
+
+data ClassMember = ClassMember{classMember_id ::
+                               {-# UNPACK #-} !ClassMember_id,
+                               classMember_key :: Prelude.Maybe ClassMember_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassMember where
+  toJSON (ClassMember __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassMember where
+  buildStruct _proxy (ClassMember __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassMember __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassMember where
+  rnf (ClassMember __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassMember where
+  def = ClassMember Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassMember where
+  hashWithSalt __salt (ClassMember _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDeclaration_id = Glean.Id
+
+data ClassDeclaration = ClassDeclaration{classDeclaration_id ::
+                                         {-# UNPACK #-} !ClassDeclaration_id,
+                                         classDeclaration_key :: Prelude.Maybe ClassDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration where
+  toJSON (ClassDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration where
+  buildStruct _proxy (ClassDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration where
+  rnf (ClassDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration where
+  def = ClassDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDeclaration where
+  hashWithSalt __salt (ClassDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data VariableParent_key = VariableParent_key{variableParent_key_child
+                                             :: VariableDeclaration,
+                                             variableParent_key_parent :: MethodDeclaration}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableParent_key where
+  toJSON (VariableParent_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableParent_key where
+  buildStruct _proxy
+    (VariableParent_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (VariableParent_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableParent_key where
+  rnf (VariableParent_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default VariableParent_key where
+  def = VariableParent_key Default.def Default.def
+
+instance Hashable.Hashable VariableParent_key where
+  hashWithSalt __salt (VariableParent_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data VariableDeclaration_key = VariableDeclaration_key{variableDeclaration_key_name
+                                                       :: Glean.Schema.JavakotlinAlpha.QName,
+                                                       variableDeclaration_key_type :: Type,
+                                                       variableDeclaration_key_location ::
+                                                       DeclarationLocation}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration_key where
+  toJSON
+    (VariableDeclaration_key __field__name __field__type
+       __field__location)
+    = Aeson.object
+        ("name" .= __field__name :
+           "type" .= __field__type :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration_key where
+  buildStruct _proxy
+    (VariableDeclaration_key __field__name __field__type
+       __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__type)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__type <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__type <- ST.readSTRef __field__type
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (VariableDeclaration_key __val__name __val__type
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList [("name", 1), ("type", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration_key where
+  rnf
+    (VariableDeclaration_key __field__name __field__type
+       __field__location)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__type `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration_key where
+  def = VariableDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable VariableDeclaration_key where
+  hashWithSalt __salt (VariableDeclaration_key _name _type _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _type)
+        _location
+
+newtype TypeArg_key = TypeArg_key{typeArg_key_type :: Type}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeArg_key where
+  toJSON (TypeArg_key __field__type)
+    = Aeson.object ("type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeArg_key where
+  buildStruct _proxy (TypeArg_key __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure (TypeArg_key __val__type)
+              _idMap = HashMap.fromList [("type", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeArg_key where
+  rnf (TypeArg_key __field__type)
+    = DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default TypeArg_key where
+  def = TypeArg_key Default.def
+
+instance Hashable.Hashable TypeArg_key where
+  hashWithSalt __salt (TypeArg_key _type)
+    = Hashable.hashWithSalt __salt _type
+
+data Type_key = Type_key{type_key_type ::
+                         Glean.Schema.JavakotlinAlpha.Type,
+                         type_key_location :: Prelude.Maybe DeclarationLocation,
+                         type_key_typeArgs :: [TypeArg],
+                         type_key_isNullable :: Prelude.Bool}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type_key where
+  toJSON
+    (Type_key __field__type __field__location __field__typeArgs
+       __field__isNullable)
+    = Aeson.object
+        ("type" .= __field__type :
+           Prelude.maybe Prelude.id ((:) . ("location" .=)) __field__location
+             ("typeArgs" .= __field__typeArgs :
+                "isNullable" .= __field__isNullable : Prelude.mempty))
+
+instance Thrift.ThriftStruct Type_key where
+  buildStruct _proxy
+    (Type_key __field__type __field__location __field__typeArgs
+       __field__isNullable)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__type)
+           :
+           let (__cereal__location, __id__location)
+                 = case __field__location of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "location"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__location
+               (Thrift.genField _proxy "typeArgs" (Thrift.getListType _proxy) 3
+                  __id__location
+                  (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                     (Thrift.buildStruct _proxy)
+                     __field__typeArgs)
+                  :
+                  Thrift.genFieldBool _proxy "isNullable" 4 3 __field__isNullable :
+                    []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Prelude.Nothing
+            __field__typeArgs <- ST.newSTRef Default.def
+            __field__isNullable <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__typeArgs
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__isNullable
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__typeArgs <- ST.readSTRef __field__typeArgs
+                                             !__val__isNullable <- ST.readSTRef __field__isNullable
+                                             Prelude.pure
+                                               (Type_key __val__type __val__location __val__typeArgs
+                                                  __val__isNullable)
+              _idMap
+                = HashMap.fromList
+                    [("type", 1), ("location", 2), ("typeArgs", 3), ("isNullable", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Type_key where
+  rnf
+    (Type_key __field__type __field__location __field__typeArgs
+       __field__isNullable)
+    = DeepSeq.rnf __field__type `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__typeArgs `Prelude.seq`
+            DeepSeq.rnf __field__isNullable `Prelude.seq` ()
+
+instance Default.Default Type_key where
+  def
+    = Type_key Default.def Prelude.Nothing Default.def Prelude.False
+
+instance Hashable.Hashable Type_key where
+  hashWithSalt __salt
+    (Type_key _type _location _typeArgs _isNullable)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _type)
+              _location)
+           _typeArgs)
+        _isNullable
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_file
+                                                       :: Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON (DeclarationLocation_key __field__file __field__span)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__file __val__span)
+              _idMap = HashMap.fromList [("file", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf (DeclarationLocation_key __field__file __field__span)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt (DeclarationLocation_key _file _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span
+
+data Declaration = Declaration_class_ ClassDeclaration
+                 | Declaration_method MethodDeclaration
+                 | Declaration_variable VariableDeclaration
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_class_ __class_)
+    = Aeson.object ["class_" .= __class_]
+  toJSON (Declaration_method __method)
+    = Aeson.object ["method" .= __method]
+  toJSON (Declaration_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_class_ __class_)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "class_" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __class_)]
+  buildStruct _proxy (Declaration_method __method)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __method)]
+  buildStruct _proxy (Declaration_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_class_ _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_method _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_variable _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList [("class_", 1), ("method", 2), ("variable", 3)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_class_ __class_) = DeepSeq.rnf __class_
+  rnf (Declaration_method __method) = DeepSeq.rnf __method
+  rnf (Declaration_variable __variable) = DeepSeq.rnf __variable
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_class_ _class_)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _class_)
+  hashWithSalt __salt (Declaration_method _method)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _method)
+  hashWithSalt __salt (Declaration_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _variable)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationFileLocation_key = DeclarationFileLocation_key{declarationFileLocation_key_decl
+                                                               :: Declaration,
+                                                               declarationFileLocation_key_file ::
+                                                               Glean.Schema.Src.File,
+                                                               declarationFileLocation_key_span ::
+                                                               Glean.Schema.Src.ByteSpan,
+                                                               declarationFileLocation_key_name ::
+                                                               Text.Text}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationFileLocation_key where
+  toJSON
+    (DeclarationFileLocation_key __field__decl __field__file
+       __field__span __field__name)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "file" .= __field__file :
+             "span" .= __field__span : "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationFileLocation_key where
+  buildStruct _proxy
+    (DeclarationFileLocation_key __field__decl __field__file
+       __field__span __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 4 3
+                 (Thrift.genText _proxy __field__name)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (DeclarationFileLocation_key __val__decl __val__file
+                                                  __val__span
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("decl", 1), ("file", 2), ("span", 3), ("name", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationFileLocation_key where
+  rnf
+    (DeclarationFileLocation_key __field__decl __field__file
+       __field__span __field__name)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default DeclarationFileLocation_key where
+  def
+    = DeclarationFileLocation_key Default.def Default.def Default.def
+        ""
+
+instance Hashable.Hashable DeclarationFileLocation_key where
+  hashWithSalt __salt
+    (DeclarationFileLocation_key _decl _file _span _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _file)
+           _span)
+        _name
+
+data ExtendsDeclaration_key = ExtendsDeclaration_key{extendsDeclaration_key_child
+                                                     :: Declaration,
+                                                     extendsDeclaration_key_parent :: Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExtendsDeclaration_key where
+  toJSON (ExtendsDeclaration_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ExtendsDeclaration_key where
+  buildStruct _proxy
+    (ExtendsDeclaration_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ExtendsDeclaration_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ExtendsDeclaration_key where
+  rnf (ExtendsDeclaration_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ExtendsDeclaration_key where
+  def = ExtendsDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ExtendsDeclaration_key where
+  hashWithSalt __salt (ExtendsDeclaration_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data FileDeclarations_key = FileDeclarations_key{fileDeclarations_key_file
+                                                 :: Glean.Schema.Src.File,
+                                                 fileDeclarations_key_decl :: Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDeclarations_key where
+  toJSON (FileDeclarations_key __field__file __field__decl)
+    = Aeson.object
+        ("file" .= __field__file :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileDeclarations_key where
+  buildStruct _proxy
+    (FileDeclarations_key __field__file __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (FileDeclarations_key __val__file __val__decl)
+              _idMap = HashMap.fromList [("file", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDeclarations_key where
+  rnf (FileDeclarations_key __field__file __field__decl)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default FileDeclarations_key where
+  def = FileDeclarations_key Default.def Default.def
+
+instance Hashable.Hashable FileDeclarations_key where
+  hashWithSalt __salt (FileDeclarations_key _file _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _decl
+
+data MethodDeclaration_key = MethodDeclaration_key{methodDeclaration_key_name
+                                                   :: Glean.Schema.JavakotlinAlpha.MethodName,
+                                                   methodDeclaration_key_parameters ::
+                                                   [VariableDeclaration],
+                                                   methodDeclaration_key_returnType ::
+                                                   Prelude.Maybe Type,
+                                                   methodDeclaration_key_loc ::
+                                                   Glean.Schema.Src.Loc,
+                                                   methodDeclaration_key_location ::
+                                                   Prelude.Maybe DeclarationLocation,
+                                                   methodDeclaration_key_container ::
+                                                   Prelude.Maybe Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodDeclaration_key where
+  toJSON
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__loc __field__location
+       __field__container)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parameters" .= __field__parameters :
+             Prelude.maybe Prelude.id ((:) . ("returnType" .=))
+               __field__returnType
+               ("loc" .= __field__loc :
+                  Prelude.maybe Prelude.id ((:) . ("location" .=)) __field__location
+                    (Prelude.maybe Prelude.id ((:) . ("container" .=))
+                       __field__container
+                       Prelude.mempty)))
+
+instance Thrift.ThriftStruct MethodDeclaration_key where
+  buildStruct _proxy
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__loc __field__location
+       __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parameters" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__parameters)
+             :
+             let (__cereal__returnType, __id__returnType)
+                   = case __field__returnType of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "returnType"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__returnType
+                 (Thrift.genField _proxy "loc" (Thrift.getStructType _proxy) 4
+                    __id__returnType
+                    (Thrift.buildStruct _proxy __field__loc)
+                    :
+                    let (__cereal__location, __id__location)
+                          = case __field__location of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "location"
+                                                         (Thrift.getStructType _proxy)
+                                                         5
+                                                         4
+                                                         (Thrift.buildStruct _proxy _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, 4)
+                      in
+                      __cereal__location
+                        (case __field__container of
+                           Prelude.Just _val -> Thrift.genField _proxy "container"
+                                                  (Thrift.getStructType _proxy)
+                                                  6
+                                                  __id__location
+                                                  (Thrift.buildStruct _proxy _val)
+                                                  : []
+                           Prelude.Nothing -> [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parameters <- ST.newSTRef Default.def
+            __field__returnType <- ST.newSTRef Prelude.Nothing
+            __field__loc <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Prelude.Nothing
+            __field__container <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__parameters
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnType
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__loc
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parameters <- ST.readSTRef __field__parameters
+                                             !__val__returnType <- ST.readSTRef __field__returnType
+                                             !__val__loc <- ST.readSTRef __field__loc
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (MethodDeclaration_key __val__name __val__parameters
+                                                  __val__returnType
+                                                  __val__loc
+                                                  __val__location
+                                                  __val__container)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("parameters", 2), ("returnType", 3), ("loc", 4),
+                     ("location", 5), ("container", 6)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodDeclaration_key where
+  rnf
+    (MethodDeclaration_key __field__name __field__parameters
+       __field__returnType __field__loc __field__location
+       __field__container)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parameters `Prelude.seq`
+          DeepSeq.rnf __field__returnType `Prelude.seq`
+            DeepSeq.rnf __field__loc `Prelude.seq`
+              DeepSeq.rnf __field__location `Prelude.seq`
+                DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default MethodDeclaration_key where
+  def
+    = MethodDeclaration_key Default.def Default.def Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable MethodDeclaration_key where
+  hashWithSalt __salt
+    (MethodDeclaration_key _name _parameters _returnType _loc _location
+       _container)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                    _parameters)
+                 _returnType)
+              _loc)
+           _location)
+        _container
+
+data ParentDeclaration_key = ParentDeclaration_key{parentDeclaration_key_child
+                                                   :: Declaration,
+                                                   parentDeclaration_key_parent :: Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ParentDeclaration_key where
+  toJSON (ParentDeclaration_key __field__child __field__parent)
+    = Aeson.object
+        ("child" .= __field__child :
+           "parent" .= __field__parent : Prelude.mempty)
+
+instance Thrift.ThriftStruct ParentDeclaration_key where
+  buildStruct _proxy
+    (ParentDeclaration_key __field__child __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__child)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__child <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__child <- ST.readSTRef __field__child
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (ParentDeclaration_key __val__child __val__parent)
+              _idMap = HashMap.fromList [("child", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ParentDeclaration_key where
+  rnf (ParentDeclaration_key __field__child __field__parent)
+    = DeepSeq.rnf __field__child `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default ParentDeclaration_key where
+  def = ParentDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ParentDeclaration_key where
+  hashWithSalt __salt (ParentDeclaration_key _child _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _child)
+        _parent
+
+data ContainsDeclaration_key = ContainsDeclaration_key{containsDeclaration_key_parent
+                                                       :: Declaration,
+                                                       containsDeclaration_key_child :: Declaration}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainsDeclaration_key where
+  toJSON (ContainsDeclaration_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainsDeclaration_key where
+  buildStruct _proxy
+    (ContainsDeclaration_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ContainsDeclaration_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainsDeclaration_key where
+  rnf (ContainsDeclaration_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ContainsDeclaration_key where
+  def = ContainsDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ContainsDeclaration_key where
+  hashWithSalt __salt (ContainsDeclaration_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data ClassMember_key = ClassMember_key{classMember_key_parent ::
+                                       ClassDeclaration,
+                                       classMember_key_child :: MethodDeclaration}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassMember_key where
+  toJSON (ClassMember_key __field__parent __field__child)
+    = Aeson.object
+        ("parent" .= __field__parent :
+           "child" .= __field__child : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassMember_key where
+  buildStruct _proxy (ClassMember_key __field__parent __field__child)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__parent)
+           :
+           Thrift.genField _proxy "child" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__child)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__parent <- ST.newSTRef Default.def
+            __field__child <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__child
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__parent <- ST.readSTRef
+                                                                 __field__parent
+                                             !__val__child <- ST.readSTRef __field__child
+                                             Prelude.pure
+                                               (ClassMember_key __val__parent __val__child)
+              _idMap = HashMap.fromList [("parent", 1), ("child", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassMember_key where
+  rnf (ClassMember_key __field__parent __field__child)
+    = DeepSeq.rnf __field__parent `Prelude.seq`
+        DeepSeq.rnf __field__child `Prelude.seq` ()
+
+instance Default.Default ClassMember_key where
+  def = ClassMember_key Default.def Default.def
+
+instance Hashable.Hashable ClassMember_key where
+  hashWithSalt __salt (ClassMember_key _parent _child)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _parent)
+        _child
+
+data ClassDeclaration_key = ClassDeclaration_key{classDeclaration_key_name
+                                                 :: Glean.Schema.JavakotlinAlpha.QName,
+                                                 classDeclaration_key_implements_ ::
+                                                 [Glean.Schema.JavakotlinAlpha.QName],
+                                                 classDeclaration_key_location ::
+                                                 DeclarationLocation}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration_key where
+  toJSON
+    (ClassDeclaration_key __field__name __field__implements_
+       __field__location)
+    = Aeson.object
+        ("name" .= __field__name :
+           "implements_" .= __field__implements_ :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration_key where
+  buildStruct _proxy
+    (ClassDeclaration_key __field__name __field__implements_
+       __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "implements_" (Thrift.getListType _proxy) 2
+             1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__implements_)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__implements_ <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__implements_
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__implements_ <- ST.readSTRef
+                                                                      __field__implements_
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (ClassDeclaration_key __val__name __val__implements_
+                                                  __val__location)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("implements_", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration_key where
+  rnf
+    (ClassDeclaration_key __field__name __field__implements_
+       __field__location)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__implements_ `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration_key where
+  def = ClassDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ClassDeclaration_key where
+  hashWithSalt __salt
+    (ClassDeclaration_key _name _implements_ _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _implements_)
+        _location
+{-# LINE 19 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.ClassMember_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.ClassMember_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.ClassMember_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.ClassMember_key" (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.KotlinAlpha.Types.ClassMember_key =
+     'Angle.TField "parent"
+       (Glean.KeyType Glean.Schema.KotlinAlpha.Types.ClassDeclaration)
+       ('Angle.TField "child"
+          (Glean.KeyType Glean.Schema.KotlinAlpha.Types.MethodDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.KotlinAlpha.Types.ClassMember
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.ClassMember =
+       Glean.Schema.KotlinAlpha.Types.ClassMember_key
+  getName _proxy = Glean.PredicateRef "kotlin.alpha.ClassMember" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.classMember_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.ClassMember x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.classMember_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.ClassMember
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.FileDeclarations_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.FileDeclarations_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.FileDeclarations_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.FileDeclarations_key"
+           (Prelude.Just 0))
+{-# LINE 54 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.FileDeclarations_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "decl" (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 56 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.FileDeclarations
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.FileDeclarations =
+       Glean.Schema.KotlinAlpha.Types.FileDeclarations_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.FileDeclarations" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.fileDeclarations_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.FileDeclarations x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.fileDeclarations_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 65 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.FileDeclarations
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 71 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.ExtendsDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 80 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration_key
+     =
+     'Angle.TField "child" (Glean.Schema.KotlinAlpha.Types.Declaration)
+       ('Angle.TField "parent"
+          (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 82 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration =
+       Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.ExtendsDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.extendsDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.extendsDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 91 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ExtendsDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 97 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.MethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.MethodDeclaration_key x1 x2 x3 x4
+       x5 x6)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.MethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.MethodDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.MethodDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+       ('Angle.TField "parameters"
+          ([Glean.Schema.KotlinAlpha.Types.VariableDeclaration])
+          ('Angle.TField "returnType"
+             (Prelude.Maybe Glean.Schema.KotlinAlpha.Types.Type)
+             ('Angle.TField "loc" (Glean.Schema.Src.Types.Loc)
+                ('Angle.TField "location"
+                   (Prelude.Maybe Glean.Schema.KotlinAlpha.Types.DeclarationLocation)
+                   ('Angle.TField "container"
+                      (Prelude.Maybe Glean.Schema.KotlinAlpha.Types.Declaration)
+                      ('Angle.TNoFields))))))
+{-# LINE 116 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.MethodDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.MethodDeclaration =
+       Glean.Schema.KotlinAlpha.Types.MethodDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.MethodDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.methodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.MethodDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.methodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.MethodDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.TypeArg_key
+         where
+  buildRtsValue b (Glean.Schema.KotlinAlpha.Types.TypeArg_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.TypeArg_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.TypeArg_key" (Prelude.Just 0))
+{-# LINE 138 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.KotlinAlpha.Types.TypeArg_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.KotlinAlpha.Types.Type)
+       ('Angle.TNoFields)
+{-# LINE 140 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.KotlinAlpha.Types.TypeArg
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.TypeArg =
+       Glean.Schema.KotlinAlpha.Types.TypeArg_key
+  getName _proxy = Glean.PredicateRef "kotlin.alpha.TypeArg" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.typeArg_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.TypeArg x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.typeArg_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 149 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.TypeArg where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 155 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.VariableDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.VariableDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.VariableDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.VariableDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 166 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.VariableDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "type"
+          (Glean.KeyType Glean.Schema.KotlinAlpha.Types.Type)
+          ('Angle.TField "location"
+             (Glean.KeyType Glean.Schema.KotlinAlpha.Types.DeclarationLocation)
+             ('Angle.TNoFields)))
+{-# LINE 168 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.VariableDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.VariableDeclaration =
+       Glean.Schema.KotlinAlpha.Types.VariableDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.VariableDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.variableDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.VariableDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.variableDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 177 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.VariableDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 183 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.VariableParent_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.VariableParent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.VariableParent_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.VariableParent_key"
+           (Prelude.Just 0))
+{-# LINE 192 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.VariableParent_key
+     =
+     'Angle.TField "child"
+       (Glean.KeyType Glean.Schema.KotlinAlpha.Types.VariableDeclaration)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.KotlinAlpha.Types.MethodDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 194 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.VariableParent
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.VariableParent =
+       Glean.Schema.KotlinAlpha.Types.VariableParent_key
+  getName _proxy = Glean.PredicateRef "kotlin.alpha.VariableParent" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.variableParent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.VariableParent x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.variableParent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 203 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.VariableParent
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 209 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ParentDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.ParentDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.ParentDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.ParentDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 218 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.ParentDeclaration_key
+     =
+     'Angle.TField "child" (Glean.Schema.KotlinAlpha.Types.Declaration)
+       ('Angle.TField "parent"
+          (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 220 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.ParentDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.ParentDeclaration =
+       Glean.Schema.KotlinAlpha.Types.ParentDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.ParentDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.parentDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.ParentDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.parentDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 229 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ParentDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 235 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.DeclarationFileLocation_key"
+           (Prelude.Just 0))
+{-# LINE 248 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation_key
+     =
+     'Angle.TField "decl" (Glean.Schema.KotlinAlpha.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))))
+{-# LINE 250 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation
+       = Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.DeclarationFileLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.KotlinAlpha.Types.declarationFileLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation x k
+  getFactKey
+    = Glean.Schema.KotlinAlpha.Types.declarationFileLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 259 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.DeclarationFileLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 265 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.Type_key where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.Type_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.Type_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.Type_key" (Prelude.Just 0))
+{-# LINE 278 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.KotlinAlpha.Types.Type_key =
+     'Angle.TField "type"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Type)
+       ('Angle.TField "location"
+          (Prelude.Maybe Glean.Schema.KotlinAlpha.Types.DeclarationLocation)
+          ('Angle.TField "typeArgs"
+             ([Glean.Schema.KotlinAlpha.Types.TypeArg])
+             ('Angle.TField "isNullable" (Prelude.Bool) ('Angle.TNoFields))))
+{-# LINE 280 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate Glean.Schema.KotlinAlpha.Types.Type where
+  type KeyType Glean.Schema.KotlinAlpha.Types.Type =
+       Glean.Schema.KotlinAlpha.Types.Type_key
+  getName _proxy = Glean.PredicateRef "kotlin.alpha.Type" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.KotlinAlpha.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.Type x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 289 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 295 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ClassDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.ClassDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.ClassDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.ClassDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 306 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.ClassDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "implements_"
+          ([Glean.Schema.JavakotlinAlpha.Types.QName])
+          ('Angle.TField "location"
+             (Glean.KeyType Glean.Schema.KotlinAlpha.Types.DeclarationLocation)
+             ('Angle.TNoFields)))
+{-# LINE 308 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.ClassDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.ClassDeclaration =
+       Glean.Schema.KotlinAlpha.Types.ClassDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.ClassDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.classDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.ClassDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.classDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 317 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.ClassDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 323 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ContainsDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.ContainsDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.ContainsDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.ContainsDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 332 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.ContainsDeclaration_key
+     =
+     'Angle.TField "parent" (Glean.Schema.KotlinAlpha.Types.Declaration)
+       ('Angle.TField "child" (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 334 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.ContainsDeclaration
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.ContainsDeclaration =
+       Glean.Schema.KotlinAlpha.Types.ContainsDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.ContainsDeclaration" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.containsDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.ContainsDeclaration x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.containsDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 343 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.ContainsDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 349 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.DeclarationLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.KotlinAlpha.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.DeclarationLocation_key"
+           (Prelude.Just 0))
+{-# LINE 358 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.KotlinAlpha.Types.DeclarationLocation_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 360 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.KotlinAlpha.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.KotlinAlpha.Types.DeclarationLocation =
+       Glean.Schema.KotlinAlpha.Types.DeclarationLocation_key
+  getName _proxy
+    = Glean.PredicateRef "kotlin.alpha.DeclarationLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.KotlinAlpha.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.KotlinAlpha.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.KotlinAlpha.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 369 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.KotlinAlpha.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 375 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+instance Glean.Type Glean.Schema.KotlinAlpha.Types.Declaration
+         where
+  buildRtsValue b Glean.Schema.KotlinAlpha.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.Declaration_class_ x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.Declaration_method x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.KotlinAlpha.Types.Declaration_variable x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.KotlinAlpha.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.KotlinAlpha.Types.Declaration_class_,
+         Glean.mapD Glean.Schema.KotlinAlpha.Types.Declaration_method,
+         Glean.mapD Glean.Schema.KotlinAlpha.Types.Declaration_variable]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "kotlin.alpha.Declaration" (Prelude.Just 2))
+{-# LINE 395 "glean/schema/thrift/kotlin_alpha_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.KotlinAlpha.Types.Declaration =
+     'Angle.TField "class_"
+       (Glean.KeyType Glean.Schema.KotlinAlpha.Types.ClassDeclaration)
+       ('Angle.TField "method"
+          (Glean.KeyType Glean.Schema.KotlinAlpha.Types.MethodDeclaration)
+          ('Angle.TField "variable"
+             (Glean.KeyType Glean.Schema.KotlinAlpha.Types.VariableDeclaration)
+             ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Lsif/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Lsif/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Lsif/Types.hs
@@ -0,0 +1,7708 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/lsif_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/lsif_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/lsif_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Lsif/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Lsif.Types
+       (pREDICATE_VERSIONS, Reference_id,
+        Reference(Reference, reference_id, reference_key), Range_id,
+        Range(Range, range_id, range_key), ProjectDocument_id,
+        ProjectDocument(ProjectDocument, projectDocument_id,
+                        projectDocument_key),
+        Project_id, Project(Project, project_id, project_key),
+        PackageInformation_id,
+        PackageInformation(PackageInformation, packageInformation_id,
+                           packageInformation_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        NameDefinition_id,
+        NameDefinition(NameDefinition, nameDefinition_id,
+                       nameDefinition_key),
+        Name_id, Name(Name, name_id, name_key), MonikerSymbolKind_id,
+        MonikerSymbolKind(MonikerSymbolKind, monikerSymbolKind_id,
+                          monikerSymbolKind_key),
+        MonikerScheme_id,
+        MonikerScheme(MonikerScheme, monikerScheme_id, monikerScheme_key),
+        MonikerId_id, MonikerId(MonikerId, monikerId_id, monikerId_key),
+        MonikerDefinition_id,
+        MonikerDefinition(MonikerDefinition, monikerDefinition_id,
+                          monikerDefinition_key),
+        Moniker_id, Moniker(Moniker, moniker_id, moniker_key), Metadata_id,
+        Metadata(Metadata, metadata_id, metadata_key), HoverText_id,
+        HoverText(HoverText, hoverText_id, hoverText_key), HoverContent_id,
+        HoverContent(HoverContent, hoverContent_id, hoverContent_key),
+        EntityDefinition_id,
+        EntityDefinition(EntityDefinition, entityDefinition_id,
+                         entityDefinition_key),
+        EntityKind_id,
+        EntityKind(EntityKind, entityKind_id, entityKind_key),
+        EntityLocation_id,
+        EntityLocation(EntityLocation, entityLocation_id,
+                       entityLocation_key),
+        EntityUses_id,
+        EntityUses(EntityUses, entityUses_id, entityUses_key),
+        FileEntityXRefLocation_id,
+        FileEntityXRefLocation(FileEntityXRefLocation,
+                               fileEntityXRefLocation_id, fileEntityXRefLocation_key),
+        ResolveLocation_id,
+        ResolveLocation(ResolveLocation, resolveLocation_id,
+                        resolveLocation_key),
+        SearchByExactLocation_id,
+        SearchByExactLocation(SearchByExactLocation,
+                              searchByExactLocation_id, searchByExactLocation_key),
+        SearchByExactLocationAndName_id,
+        SearchByExactLocationAndName(SearchByExactLocationAndName,
+                                     searchByExactLocationAndName_id,
+                                     searchByExactLocationAndName_key),
+        SearchByMoniker_id,
+        SearchByMoniker(SearchByMoniker, searchByMoniker_id,
+                        searchByMoniker_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        SearchNonLocalByLocation_id,
+        SearchNonLocalByLocation(SearchNonLocalByLocation,
+                                 searchNonLocalByLocation_id, searchNonLocalByLocation_key),
+        TagDefinition_id,
+        TagDefinition(TagDefinition, tagDefinition_id, tagDefinition_key),
+        Document_id, Document(Document, document_id, document_key),
+        DefinitionUse_id,
+        DefinitionUse(DefinitionUse, definitionUse_id, definitionUse_key),
+        DefinitionMoniker_id,
+        DefinitionMoniker(DefinitionMoniker, definitionMoniker_id,
+                          definitionMoniker_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        DefinitionKind_id,
+        DefinitionKind(DefinitionKind, definitionKind_id,
+                       definitionKind_key),
+        DefinitionHover_id,
+        DefinitionHover(DefinitionHover, definitionHover_id,
+                        definitionHover_key),
+        Definition_id,
+        Definition(Definition, definition_id, definition_key),
+        Declaration_id,
+        Declaration(Declaration, declaration_id, declaration_key),
+        SomeEntity(SomeEntity_EMPTY, SomeEntity_decl, SomeEntity_defn),
+        Reference_key(Reference_key, reference_key_file,
+                      reference_key_range, reference_key_target),
+        Range_key(Range_key, range_key_range, range_key_fullRange,
+                  range_key_text),
+        ProjectDocument_key(ProjectDocument_key, projectDocument_key_file,
+                            projectDocument_key_project),
+        Project_key(Project_key, project_key_kind),
+        PackageInformation_key(PackageInformation_key,
+                               packageInformation_key_name, packageInformation_key_manager,
+                               packageInformation_key_version),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowerCase, nameLowerCase_key_name),
+        NameDefinition_key(NameDefinition_key, nameDefinition_key_name,
+                           nameDefinition_key_defn),
+        MonikerSymbolKind_key(MonikerSymbolKind_key,
+                              monikerSymbolKind_key_moniker, monikerSymbolKind_key_kind),
+        MonikerKind(MonikerKind_Export, MonikerKind_Local,
+                    MonikerKind_Import, MonikerKind_Implementation,
+                    MonikerKind__UNKNOWN),
+        MonikerDefinition_key(MonikerDefinition_key,
+                              monikerDefinition_key_ident, monikerDefinition_key_moniker,
+                              monikerDefinition_key_defn),
+        Moniker_key(Moniker_key, moniker_key_kind, moniker_key_scheme,
+                    moniker_key_ident),
+        Metadata_key(Metadata_key, metadata_key_lsifVersion,
+                     metadata_key_positionEncoding, metadata_key_toolInfo),
+        Location(Location, location_name, location_file,
+                 location_location),
+        HoverContent_key(HoverContent_key, hoverContent_key_text,
+                         hoverContent_key_language),
+        Entity(Entity_EMPTY, Entity_erlang, Entity_fsharp, Entity_go,
+               Entity_haskell, Entity_java, Entity_kotlin, Entity_ocaml,
+               Entity_python, Entity_rust, Entity_scala, Entity_swift,
+               Entity_typescript),
+        EntityDefinition_key(EntityDefinition_key,
+                             entityDefinition_key_entity, entityDefinition_key_defn),
+        EntityKind_key(EntityKind_key, entityKind_key_entity,
+                       entityKind_key_kind),
+        EntityLocation_key(EntityLocation_key, entityLocation_key_entity,
+                           entityLocation_key_location),
+        EntityUses_key(EntityUses_key, entityUses_key_target,
+                       entityUses_key_file, entityUses_key_range),
+        FileEntityXRefLocation_key(FileEntityXRefLocation_key,
+                                   fileEntityXRefLocation_key_file,
+                                   fileEntityXRefLocation_key_source,
+                                   fileEntityXRefLocation_key_target,
+                                   fileEntityXRefLocation_key_entity),
+        ResolveLocation_key(ResolveLocation_key,
+                            resolveLocation_key_location, resolveLocation_key_entity),
+        SearchByExactLocation_key(SearchByExactLocation_key,
+                                  searchByExactLocation_key_file, searchByExactLocation_key_span,
+                                  searchByExactLocation_key_entity),
+        SearchByExactLocationAndName_key(SearchByExactLocationAndName_key,
+                                         searchByExactLocationAndName_key_file,
+                                         searchByExactLocationAndName_key_name,
+                                         searchByExactLocationAndName_key_span,
+                                         searchByExactLocationAndName_key_entity),
+        SearchByMoniker_key(SearchByMoniker_key, searchByMoniker_key_ident,
+                            searchByMoniker_key_entity),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_entity),
+        SearchNonLocalByLocation_key(SearchNonLocalByLocation_key,
+                                     searchNonLocalByLocation_key_file,
+                                     searchNonLocalByLocation_key_name,
+                                     searchNonLocalByLocation_key_entity),
+        TagDefinition_key(TagDefinition_key, tagDefinition_key_language,
+                          tagDefinition_key_defn, tagDefinition_key_entity),
+        Document_key(Document_key, document_key_file,
+                     document_key_language),
+        DefinitionUse_key(DefinitionUse_key, definitionUse_key_target,
+                          definitionUse_key_file, definitionUse_key_range),
+        DefinitionMoniker_key(DefinitionMoniker_key,
+                              definitionMoniker_key_defn, definitionMoniker_key_moniker),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_defn, definitionLocation_key_location),
+        DefinitionKind_key(DefinitionKind_key, definitionKind_key_defn,
+                           definitionKind_key_kind),
+        DefinitionHover_key(DefinitionHover_key, definitionHover_key_defn,
+                            definitionHover_key_hover),
+        Definition_key(Definition_key, definition_key_file,
+                       definition_key_range),
+        Declaration_key(Declaration_key, declaration_key_file,
+                        declaration_key_range))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.LsifTypes.Types
+       as Glean.Schema.LsifTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Schema.LsifTypes.Types
+{-# LINE 16 "glean/schema/thrift/lsif_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 244 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Lsif/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("SearchByExactLocationAndName", 2), ("SearchByExactLocation", 2),
+       ("NameDefinition", 2), ("MonikerId", 2),
+       ("SearchNonLocalByLocation", 2), ("NameLowerCase", 2),
+       ("ProjectDocument", 2), ("Metadata", 2), ("DefinitionHover", 2),
+       ("Reference", 2), ("Range", 2), ("DefinitionLocation", 2),
+       ("Name", 2), ("MonikerSymbolKind", 2), ("DefinitionKind", 2),
+       ("DefinitionUse", 2), ("DefinitionMoniker", 2),
+       ("SearchByMoniker", 2), ("SearchByName", 2),
+       ("EntityDefinition", 2), ("EntityKind", 2), ("TagDefinition", 2),
+       ("Project", 2), ("FileEntityXRefLocation", 2),
+       ("EntityLocation", 2), ("Moniker", 2), ("MonikerScheme", 2),
+       ("Document", 2), ("ResolveLocation", 2), ("PackageInformation", 2),
+       ("HoverText", 2), ("Definition", 2), ("HoverContent", 2),
+       ("EntityUses", 2), ("Declaration", 2), ("MonikerDefinition", 2)]
+
+type Reference_id = Glean.Id
+
+data Reference = Reference{reference_id ::
+                           {-# UNPACK #-} !Reference_id,
+                           reference_key :: Prelude.Maybe Reference_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Reference where
+  toJSON (Reference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Reference where
+  buildStruct _proxy (Reference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Reference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Reference where
+  rnf (Reference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Reference where
+  def = Reference Default.def Prelude.Nothing
+
+instance Hashable.Hashable Reference where
+  hashWithSalt __salt (Reference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Range_id = Glean.Id
+
+data Range = Range{range_id :: {-# UNPACK #-} !Range_id,
+                   range_key :: Prelude.Maybe Range_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range where
+  toJSON (Range __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Range where
+  buildStruct _proxy (Range __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Range __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Range where
+  rnf (Range __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Range where
+  def = Range Default.def Prelude.Nothing
+
+instance Hashable.Hashable Range where
+  hashWithSalt __salt (Range _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ProjectDocument_id = Glean.Id
+
+data ProjectDocument = ProjectDocument{projectDocument_id ::
+                                       {-# UNPACK #-} !ProjectDocument_id,
+                                       projectDocument_key :: Prelude.Maybe ProjectDocument_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectDocument where
+  toJSON (ProjectDocument __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectDocument where
+  buildStruct _proxy (ProjectDocument __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ProjectDocument __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectDocument where
+  rnf (ProjectDocument __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ProjectDocument where
+  def = ProjectDocument Default.def Prelude.Nothing
+
+instance Hashable.Hashable ProjectDocument where
+  hashWithSalt __salt (ProjectDocument _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Project_id = Glean.Id
+
+data Project = Project{project_id :: {-# UNPACK #-} !Project_id,
+                       project_key :: Prelude.Maybe Project_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Project where
+  toJSON (Project __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Project where
+  buildStruct _proxy (Project __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Project __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Project where
+  rnf (Project __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Project where
+  def = Project Default.def Prelude.Nothing
+
+instance Hashable.Hashable Project where
+  hashWithSalt __salt (Project _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PackageInformation_id = Glean.Id
+
+data PackageInformation = PackageInformation{packageInformation_id
+                                             :: {-# UNPACK #-} !PackageInformation_id,
+                                             packageInformation_key ::
+                                             Prelude.Maybe PackageInformation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackageInformation where
+  toJSON (PackageInformation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PackageInformation where
+  buildStruct _proxy (PackageInformation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PackageInformation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PackageInformation where
+  rnf (PackageInformation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PackageInformation where
+  def = PackageInformation Default.def Prelude.Nothing
+
+instance Hashable.Hashable PackageInformation where
+  hashWithSalt __salt (PackageInformation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameDefinition_id = Glean.Id
+
+data NameDefinition = NameDefinition{nameDefinition_id ::
+                                     {-# UNPACK #-} !NameDefinition_id,
+                                     nameDefinition_key :: Prelude.Maybe NameDefinition_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameDefinition where
+  toJSON (NameDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameDefinition where
+  buildStruct _proxy (NameDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameDefinition where
+  rnf (NameDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameDefinition where
+  def = NameDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameDefinition where
+  hashWithSalt __salt (NameDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MonikerSymbolKind_id = Glean.Id
+
+data MonikerSymbolKind = MonikerSymbolKind{monikerSymbolKind_id ::
+                                           {-# UNPACK #-} !MonikerSymbolKind_id,
+                                           monikerSymbolKind_key ::
+                                           Prelude.Maybe MonikerSymbolKind_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerSymbolKind where
+  toJSON (MonikerSymbolKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerSymbolKind where
+  buildStruct _proxy (MonikerSymbolKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MonikerSymbolKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerSymbolKind where
+  rnf (MonikerSymbolKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MonikerSymbolKind where
+  def = MonikerSymbolKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable MonikerSymbolKind where
+  hashWithSalt __salt (MonikerSymbolKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MonikerScheme_id = Glean.Id
+
+data MonikerScheme = MonikerScheme{monikerScheme_id ::
+                                   {-# UNPACK #-} !MonikerScheme_id,
+                                   monikerScheme_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerScheme where
+  toJSON (MonikerScheme __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerScheme where
+  buildStruct _proxy (MonikerScheme __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MonikerScheme __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerScheme where
+  rnf (MonikerScheme __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MonikerScheme where
+  def = MonikerScheme Default.def Prelude.Nothing
+
+instance Hashable.Hashable MonikerScheme where
+  hashWithSalt __salt (MonikerScheme _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MonikerId_id = Glean.Id
+
+data MonikerId = MonikerId{monikerId_id ::
+                           {-# UNPACK #-} !MonikerId_id,
+                           monikerId_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerId where
+  toJSON (MonikerId __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerId where
+  buildStruct _proxy (MonikerId __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MonikerId __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerId where
+  rnf (MonikerId __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MonikerId where
+  def = MonikerId Default.def Prelude.Nothing
+
+instance Hashable.Hashable MonikerId where
+  hashWithSalt __salt (MonikerId _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MonikerDefinition_id = Glean.Id
+
+data MonikerDefinition = MonikerDefinition{monikerDefinition_id ::
+                                           {-# UNPACK #-} !MonikerDefinition_id,
+                                           monikerDefinition_key ::
+                                           Prelude.Maybe MonikerDefinition_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerDefinition where
+  toJSON (MonikerDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerDefinition where
+  buildStruct _proxy (MonikerDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MonikerDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerDefinition where
+  rnf (MonikerDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MonikerDefinition where
+  def = MonikerDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable MonikerDefinition where
+  hashWithSalt __salt (MonikerDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Moniker_id = Glean.Id
+
+data Moniker = Moniker{moniker_id :: {-# UNPACK #-} !Moniker_id,
+                       moniker_key :: Prelude.Maybe Moniker_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Moniker where
+  toJSON (Moniker __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Moniker where
+  buildStruct _proxy (Moniker __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Moniker __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Moniker where
+  rnf (Moniker __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Moniker where
+  def = Moniker Default.def Prelude.Nothing
+
+instance Hashable.Hashable Moniker where
+  hashWithSalt __salt (Moniker _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Metadata_id = Glean.Id
+
+data Metadata = Metadata{metadata_id ::
+                         {-# UNPACK #-} !Metadata_id,
+                         metadata_key :: Prelude.Maybe Metadata_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Metadata where
+  toJSON (Metadata __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Metadata where
+  buildStruct _proxy (Metadata __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Metadata __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Metadata where
+  rnf (Metadata __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Metadata where
+  def = Metadata Default.def Prelude.Nothing
+
+instance Hashable.Hashable Metadata where
+  hashWithSalt __salt (Metadata _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HoverText_id = Glean.Id
+
+data HoverText = HoverText{hoverText_id ::
+                           {-# UNPACK #-} !HoverText_id,
+                           hoverText_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HoverText where
+  toJSON (HoverText __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HoverText where
+  buildStruct _proxy (HoverText __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HoverText __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HoverText where
+  rnf (HoverText __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HoverText where
+  def = HoverText Default.def Prelude.Nothing
+
+instance Hashable.Hashable HoverText where
+  hashWithSalt __salt (HoverText _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HoverContent_id = Glean.Id
+
+data HoverContent = HoverContent{hoverContent_id ::
+                                 {-# UNPACK #-} !HoverContent_id,
+                                 hoverContent_key :: Prelude.Maybe HoverContent_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HoverContent where
+  toJSON (HoverContent __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HoverContent where
+  buildStruct _proxy (HoverContent __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HoverContent __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HoverContent where
+  rnf (HoverContent __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HoverContent where
+  def = HoverContent Default.def Prelude.Nothing
+
+instance Hashable.Hashable HoverContent where
+  hashWithSalt __salt (HoverContent _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityDefinition_id = Glean.Id
+
+data EntityDefinition = EntityDefinition{entityDefinition_id ::
+                                         {-# UNPACK #-} !EntityDefinition_id,
+                                         entityDefinition_key :: Prelude.Maybe EntityDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityDefinition where
+  toJSON (EntityDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityDefinition where
+  buildStruct _proxy (EntityDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityDefinition where
+  rnf (EntityDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityDefinition where
+  def = EntityDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityDefinition where
+  hashWithSalt __salt (EntityDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityKind_id = Glean.Id
+
+data EntityKind = EntityKind{entityKind_id ::
+                             {-# UNPACK #-} !EntityKind_id,
+                             entityKind_key :: Prelude.Maybe EntityKind_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind where
+  toJSON (EntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind where
+  buildStruct _proxy (EntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind where
+  rnf (EntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityKind where
+  def = EntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityKind where
+  hashWithSalt __salt (EntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLocation_id = Glean.Id
+
+data EntityLocation = EntityLocation{entityLocation_id ::
+                                     {-# UNPACK #-} !EntityLocation_id,
+                                     entityLocation_key :: Prelude.Maybe EntityLocation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation where
+  toJSON (EntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation where
+  buildStruct _proxy (EntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation where
+  rnf (EntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLocation where
+  def = EntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLocation where
+  hashWithSalt __salt (EntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityUses_id = Glean.Id
+
+data EntityUses = EntityUses{entityUses_id ::
+                             {-# UNPACK #-} !EntityUses_id,
+                             entityUses_key :: Prelude.Maybe EntityUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses where
+  toJSON (EntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses where
+  buildStruct _proxy (EntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses where
+  rnf (EntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityUses where
+  def = EntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityUses where
+  hashWithSalt __salt (EntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefLocation_id = Glean.Id
+
+data FileEntityXRefLocation = FileEntityXRefLocation{fileEntityXRefLocation_id
+                                                     :: {-# UNPACK #-} !FileEntityXRefLocation_id,
+                                                     fileEntityXRefLocation_key ::
+                                                     Prelude.Maybe FileEntityXRefLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocation where
+  toJSON (FileEntityXRefLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocation where
+  buildStruct _proxy
+    (FileEntityXRefLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FileEntityXRefLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocation where
+  rnf (FileEntityXRefLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocation where
+  def = FileEntityXRefLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefLocation where
+  hashWithSalt __salt (FileEntityXRefLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ResolveLocation_id = Glean.Id
+
+data ResolveLocation = ResolveLocation{resolveLocation_id ::
+                                       {-# UNPACK #-} !ResolveLocation_id,
+                                       resolveLocation_key :: Prelude.Maybe ResolveLocation_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation where
+  toJSON (ResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation where
+  buildStruct _proxy (ResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation where
+  rnf (ResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ResolveLocation where
+  def = ResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ResolveLocation where
+  hashWithSalt __salt (ResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByExactLocation_id = Glean.Id
+
+data SearchByExactLocation = SearchByExactLocation{searchByExactLocation_id
+                                                   :: {-# UNPACK #-} !SearchByExactLocation_id,
+                                                   searchByExactLocation_key ::
+                                                   Prelude.Maybe SearchByExactLocation_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByExactLocation where
+  toJSON (SearchByExactLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByExactLocation where
+  buildStruct _proxy (SearchByExactLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByExactLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByExactLocation where
+  rnf (SearchByExactLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByExactLocation where
+  def = SearchByExactLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByExactLocation where
+  hashWithSalt __salt (SearchByExactLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByExactLocationAndName_id = Glean.Id
+
+data SearchByExactLocationAndName = SearchByExactLocationAndName{searchByExactLocationAndName_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !SearchByExactLocationAndName_id,
+                                                                 searchByExactLocationAndName_key ::
+                                                                 Prelude.Maybe
+                                                                   SearchByExactLocationAndName_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByExactLocationAndName where
+  toJSON (SearchByExactLocationAndName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByExactLocationAndName where
+  buildStruct _proxy
+    (SearchByExactLocationAndName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByExactLocationAndName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByExactLocationAndName where
+  rnf (SearchByExactLocationAndName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByExactLocationAndName where
+  def = SearchByExactLocationAndName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByExactLocationAndName where
+  hashWithSalt __salt (SearchByExactLocationAndName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByMoniker_id = Glean.Id
+
+data SearchByMoniker = SearchByMoniker{searchByMoniker_id ::
+                                       {-# UNPACK #-} !SearchByMoniker_id,
+                                       searchByMoniker_key :: Prelude.Maybe SearchByMoniker_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByMoniker where
+  toJSON (SearchByMoniker __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByMoniker where
+  buildStruct _proxy (SearchByMoniker __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByMoniker __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByMoniker where
+  rnf (SearchByMoniker __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByMoniker where
+  def = SearchByMoniker Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByMoniker where
+  hashWithSalt __salt (SearchByMoniker _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchNonLocalByLocation_id = Glean.Id
+
+data SearchNonLocalByLocation = SearchNonLocalByLocation{searchNonLocalByLocation_id
+                                                         ::
+                                                         {-# UNPACK #-} !SearchNonLocalByLocation_id,
+                                                         searchNonLocalByLocation_key ::
+                                                         Prelude.Maybe SearchNonLocalByLocation_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNonLocalByLocation where
+  toJSON (SearchNonLocalByLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNonLocalByLocation where
+  buildStruct _proxy
+    (SearchNonLocalByLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchNonLocalByLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNonLocalByLocation where
+  rnf (SearchNonLocalByLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchNonLocalByLocation where
+  def = SearchNonLocalByLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchNonLocalByLocation where
+  hashWithSalt __salt (SearchNonLocalByLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TagDefinition_id = Glean.Id
+
+data TagDefinition = TagDefinition{tagDefinition_id ::
+                                   {-# UNPACK #-} !TagDefinition_id,
+                                   tagDefinition_key :: Prelude.Maybe TagDefinition_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TagDefinition where
+  toJSON (TagDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TagDefinition where
+  buildStruct _proxy (TagDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TagDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TagDefinition where
+  rnf (TagDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TagDefinition where
+  def = TagDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable TagDefinition where
+  hashWithSalt __salt (TagDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Document_id = Glean.Id
+
+data Document = Document{document_id ::
+                         {-# UNPACK #-} !Document_id,
+                         document_key :: Prelude.Maybe Document_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Document where
+  toJSON (Document __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Document where
+  buildStruct _proxy (Document __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Document __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Document where
+  rnf (Document __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Document where
+  def = Document Default.def Prelude.Nothing
+
+instance Hashable.Hashable Document where
+  hashWithSalt __salt (Document _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionUse_id = Glean.Id
+
+data DefinitionUse = DefinitionUse{definitionUse_id ::
+                                   {-# UNPACK #-} !DefinitionUse_id,
+                                   definitionUse_key :: Prelude.Maybe DefinitionUse_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionUse where
+  toJSON (DefinitionUse __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionUse where
+  buildStruct _proxy (DefinitionUse __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionUse __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionUse where
+  rnf (DefinitionUse __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionUse where
+  def = DefinitionUse Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionUse where
+  hashWithSalt __salt (DefinitionUse _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionMoniker_id = Glean.Id
+
+data DefinitionMoniker = DefinitionMoniker{definitionMoniker_id ::
+                                           {-# UNPACK #-} !DefinitionMoniker_id,
+                                           definitionMoniker_key ::
+                                           Prelude.Maybe DefinitionMoniker_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionMoniker where
+  toJSON (DefinitionMoniker __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionMoniker where
+  buildStruct _proxy (DefinitionMoniker __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionMoniker __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionMoniker where
+  rnf (DefinitionMoniker __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionMoniker where
+  def = DefinitionMoniker Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionMoniker where
+  hashWithSalt __salt (DefinitionMoniker _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionKind_id = Glean.Id
+
+data DefinitionKind = DefinitionKind{definitionKind_id ::
+                                     {-# UNPACK #-} !DefinitionKind_id,
+                                     definitionKind_key :: Prelude.Maybe DefinitionKind_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionKind where
+  toJSON (DefinitionKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionKind where
+  buildStruct _proxy (DefinitionKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionKind where
+  rnf (DefinitionKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionKind where
+  def = DefinitionKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionKind where
+  hashWithSalt __salt (DefinitionKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionHover_id = Glean.Id
+
+data DefinitionHover = DefinitionHover{definitionHover_id ::
+                                       {-# UNPACK #-} !DefinitionHover_id,
+                                       definitionHover_key :: Prelude.Maybe DefinitionHover_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionHover where
+  toJSON (DefinitionHover __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionHover where
+  buildStruct _proxy (DefinitionHover __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionHover __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionHover where
+  rnf (DefinitionHover __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionHover where
+  def = DefinitionHover Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionHover where
+  hashWithSalt __salt (DefinitionHover _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Definition_id = Glean.Id
+
+data Definition = Definition{definition_id ::
+                             {-# UNPACK #-} !Definition_id,
+                             definition_key :: Prelude.Maybe Definition_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Definition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Definition where
+  def = Definition Default.def Prelude.Nothing
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Declaration_id = Glean.Id
+
+data Declaration = Declaration{declaration_id ::
+                               {-# UNPACK #-} !Declaration_id,
+                               declaration_key :: Prelude.Maybe Declaration_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Declaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Declaration where
+  def = Declaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SomeEntity = SomeEntity_decl Declaration
+                | SomeEntity_defn DefinitionMoniker
+                | SomeEntity_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SomeEntity where
+  toJSON (SomeEntity_decl __decl) = Aeson.object ["decl" .= __decl]
+  toJSON (SomeEntity_defn __defn) = Aeson.object ["defn" .= __defn]
+  toJSON SomeEntity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct SomeEntity where
+  buildStruct _proxy (SomeEntity_decl __decl)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __decl)]
+  buildStruct _proxy (SomeEntity_defn __defn)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __defn)]
+  buildStruct _proxy SomeEntity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SomeEntity_decl _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (SomeEntity_defn _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return SomeEntity_EMPTY
+           Thrift.FieldEnd -> Prelude.return SomeEntity_EMPTY
+    where
+      _idMap = HashMap.fromList [("decl", 1), ("defn", 2)]
+
+instance DeepSeq.NFData SomeEntity where
+  rnf (SomeEntity_decl __decl) = DeepSeq.rnf __decl
+  rnf (SomeEntity_defn __defn) = DeepSeq.rnf __defn
+  rnf SomeEntity_EMPTY = ()
+
+instance Default.Default SomeEntity where
+  def = SomeEntity_EMPTY
+
+instance Hashable.Hashable SomeEntity where
+  hashWithSalt __salt (SomeEntity_decl _decl)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _decl)
+  hashWithSalt __salt (SomeEntity_defn _defn)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _defn)
+  hashWithSalt __salt SomeEntity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data Reference_key = Reference_key{reference_key_file :: Document,
+                                   reference_key_range :: Range, reference_key_target :: Definition}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Reference_key where
+  toJSON (Reference_key __field__file __field__range __field__target)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range :
+             "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct Reference_key where
+  buildStruct _proxy
+    (Reference_key __field__file __field__range __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (Reference_key __val__file __val__range
+                                                  __val__target)
+              _idMap
+                = HashMap.fromList [("file", 1), ("range", 2), ("target", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Reference_key where
+  rnf (Reference_key __field__file __field__range __field__target)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default Reference_key where
+  def = Reference_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Reference_key where
+  hashWithSalt __salt (Reference_key _file _range _target)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range)
+        _target
+
+data Range_key = Range_key{range_key_range ::
+                           Glean.Schema.LsifTypes.RangeSpan,
+                           range_key_fullRange ::
+                           Prelude.Maybe Glean.Schema.LsifTypes.RangeSpan,
+                           range_key_text :: Name}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range_key where
+  toJSON (Range_key __field__range __field__fullRange __field__text)
+    = Aeson.object
+        ("range" .= __field__range :
+           Prelude.maybe Prelude.id ((:) . ("fullRange" .=))
+             __field__fullRange
+             ("text" .= __field__text : Prelude.mempty))
+
+instance Thrift.ThriftStruct Range_key where
+  buildStruct _proxy
+    (Range_key __field__range __field__fullRange __field__text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__range)
+           :
+           let (__cereal__fullRange, __id__fullRange)
+                 = case __field__fullRange of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "fullRange"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__fullRange
+               (Thrift.genField _proxy "text" (Thrift.getStructType _proxy) 3
+                  __id__fullRange
+                  (Thrift.buildStruct _proxy __field__text)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__range <- ST.newSTRef Default.def
+            __field__fullRange <- ST.newSTRef Prelude.Nothing
+            __field__text <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__fullRange
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__range <- ST.readSTRef __field__range
+                                             !__val__fullRange <- ST.readSTRef __field__fullRange
+                                             !__val__text <- ST.readSTRef __field__text
+                                             Prelude.pure
+                                               (Range_key __val__range __val__fullRange __val__text)
+              _idMap
+                = HashMap.fromList [("range", 1), ("fullRange", 2), ("text", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Range_key where
+  rnf (Range_key __field__range __field__fullRange __field__text)
+    = DeepSeq.rnf __field__range `Prelude.seq`
+        DeepSeq.rnf __field__fullRange `Prelude.seq`
+          DeepSeq.rnf __field__text `Prelude.seq` ()
+
+instance Default.Default Range_key where
+  def = Range_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable Range_key where
+  hashWithSalt __salt (Range_key _range _fullRange _text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _range)
+           _fullRange)
+        _text
+
+data ProjectDocument_key = ProjectDocument_key{projectDocument_key_file
+                                               :: Document,
+                                               projectDocument_key_project :: Project}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProjectDocument_key where
+  toJSON (ProjectDocument_key __field__file __field__project)
+    = Aeson.object
+        ("file" .= __field__file :
+           "project" .= __field__project : Prelude.mempty)
+
+instance Thrift.ThriftStruct ProjectDocument_key where
+  buildStruct _proxy
+    (ProjectDocument_key __field__file __field__project)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "project" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__project)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__project <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__project
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__project <- ST.readSTRef __field__project
+                                             Prelude.pure
+                                               (ProjectDocument_key __val__file __val__project)
+              _idMap = HashMap.fromList [("file", 1), ("project", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ProjectDocument_key where
+  rnf (ProjectDocument_key __field__file __field__project)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__project `Prelude.seq` ()
+
+instance Default.Default ProjectDocument_key where
+  def = ProjectDocument_key Default.def Default.def
+
+instance Hashable.Hashable ProjectDocument_key where
+  hashWithSalt __salt (ProjectDocument_key _file _project)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _project
+
+newtype Project_key = Project_key{project_key_kind ::
+                                  Glean.Schema.LsifTypes.LanguageId}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Project_key where
+  toJSON (Project_key __field__kind)
+    = Aeson.object ("kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct Project_key where
+  buildStruct _proxy (Project_key __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (Project_key __val__kind)
+              _idMap = HashMap.fromList [("kind", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Project_key where
+  rnf (Project_key __field__kind)
+    = DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default Project_key where
+  def = Project_key Default.def
+
+instance Hashable.Hashable Project_key where
+  hashWithSalt __salt (Project_key _kind)
+    = Hashable.hashWithSalt __salt _kind
+
+data PackageInformation_key = PackageInformation_key{packageInformation_key_name
+                                                     :: Text.Text,
+                                                     packageInformation_key_manager :: Text.Text,
+                                                     packageInformation_key_version :: Text.Text}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackageInformation_key where
+  toJSON
+    (PackageInformation_key __field__name __field__manager
+       __field__version)
+    = Aeson.object
+        ("name" .= __field__name :
+           "manager" .= __field__manager :
+             "version" .= __field__version : Prelude.mempty)
+
+instance Thrift.ThriftStruct PackageInformation_key where
+  buildStruct _proxy
+    (PackageInformation_key __field__name __field__manager
+       __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "manager" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__manager)
+             :
+             Thrift.genField _proxy "version" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__version)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__manager <- ST.newSTRef ""
+            __field__version <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__manager
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__manager <- ST.readSTRef __field__manager
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure
+                                               (PackageInformation_key __val__name __val__manager
+                                                  __val__version)
+              _idMap
+                = HashMap.fromList [("name", 1), ("manager", 2), ("version", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PackageInformation_key where
+  rnf
+    (PackageInformation_key __field__name __field__manager
+       __field__version)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__manager `Prelude.seq`
+          DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default PackageInformation_key where
+  def = PackageInformation_key "" "" ""
+
+instance Hashable.Hashable PackageInformation_key where
+  hashWithSalt __salt
+    (PackageInformation_key _name _manager _version)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _manager)
+        _version
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowerCase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowerCase __field__name)
+    = Aeson.object
+        ("nameLowerCase" .= __field__nameLowerCase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowerCase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowerCase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowerCase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowerCase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowerCase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowerCase <- ST.readSTRef
+                                                                        __field__nameLowerCase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowerCase __val__name)
+              _idMap = HashMap.fromList [("nameLowerCase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowerCase __field__name)
+    = DeepSeq.rnf __field__nameLowerCase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowerCase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowerCase)
+        _name
+
+data NameDefinition_key = NameDefinition_key{nameDefinition_key_name
+                                             :: Name,
+                                             nameDefinition_key_defn :: DefinitionMoniker}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameDefinition_key where
+  toJSON (NameDefinition_key __field__name __field__defn)
+    = Aeson.object
+        ("name" .= __field__name :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameDefinition_key where
+  buildStruct _proxy (NameDefinition_key __field__name __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (NameDefinition_key __val__name __val__defn)
+              _idMap = HashMap.fromList [("name", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameDefinition_key where
+  rnf (NameDefinition_key __field__name __field__defn)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default NameDefinition_key where
+  def = NameDefinition_key Default.def Default.def
+
+instance Hashable.Hashable NameDefinition_key where
+  hashWithSalt __salt (NameDefinition_key _name _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _defn
+
+data MonikerSymbolKind_key = MonikerSymbolKind_key{monikerSymbolKind_key_moniker
+                                                   :: Moniker,
+                                                   monikerSymbolKind_key_kind ::
+                                                   Glean.Schema.LsifTypes.SymbolKind}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerSymbolKind_key where
+  toJSON (MonikerSymbolKind_key __field__moniker __field__kind)
+    = Aeson.object
+        ("moniker" .= __field__moniker :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerSymbolKind_key where
+  buildStruct _proxy
+    (MonikerSymbolKind_key __field__moniker __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "moniker" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__moniker)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__moniker <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moniker
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__moniker <- ST.readSTRef
+                                                                  __field__moniker
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (MonikerSymbolKind_key __val__moniker __val__kind)
+              _idMap = HashMap.fromList [("moniker", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerSymbolKind_key where
+  rnf (MonikerSymbolKind_key __field__moniker __field__kind)
+    = DeepSeq.rnf __field__moniker `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default MonikerSymbolKind_key where
+  def = MonikerSymbolKind_key Default.def Default.def
+
+instance Hashable.Hashable MonikerSymbolKind_key where
+  hashWithSalt __salt (MonikerSymbolKind_key _moniker _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _moniker)
+        _kind
+
+data MonikerKind = MonikerKind_Export
+                 | MonikerKind_Local
+                 | MonikerKind_Import
+                 | MonikerKind_Implementation
+                 | MonikerKind__UNKNOWN Prelude.Int
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData MonikerKind where
+  rnf __MonikerKind = Prelude.seq __MonikerKind ()
+
+instance Default.Default MonikerKind where
+  def = MonikerKind_Export
+
+instance Hashable.Hashable MonikerKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum MonikerKind where
+  toThriftEnum 0 = MonikerKind_Export
+  toThriftEnum 1 = MonikerKind_Local
+  toThriftEnum 2 = MonikerKind_Import
+  toThriftEnum 3 = MonikerKind_Implementation
+  toThriftEnum val = MonikerKind__UNKNOWN val
+  fromThriftEnum MonikerKind_Export = 0
+  fromThriftEnum MonikerKind_Local = 1
+  fromThriftEnum MonikerKind_Import = 2
+  fromThriftEnum MonikerKind_Implementation = 3
+  fromThriftEnum (MonikerKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [MonikerKind_Export, MonikerKind_Local, MonikerKind_Import,
+       MonikerKind_Implementation]
+  toThriftEnumEither 0 = Prelude.Right MonikerKind_Export
+  toThriftEnumEither 1 = Prelude.Right MonikerKind_Local
+  toThriftEnumEither 2 = Prelude.Right MonikerKind_Import
+  toThriftEnumEither 3 = Prelude.Right MonikerKind_Implementation
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum MonikerKind: "
+           ++ Prelude.show val)
+
+data MonikerDefinition_key = MonikerDefinition_key{monikerDefinition_key_ident
+                                                   :: MonikerId,
+                                                   monikerDefinition_key_moniker :: Moniker,
+                                                   monikerDefinition_key_defn :: Definition}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MonikerDefinition_key where
+  toJSON
+    (MonikerDefinition_key __field__ident __field__moniker
+       __field__defn)
+    = Aeson.object
+        ("ident" .= __field__ident :
+           "moniker" .= __field__moniker :
+             "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct MonikerDefinition_key where
+  buildStruct _proxy
+    (MonikerDefinition_key __field__ident __field__moniker
+       __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ident" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ident)
+           :
+           Thrift.genField _proxy "moniker" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__moniker)
+             :
+             Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__defn)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ident <- ST.newSTRef Default.def
+            __field__moniker <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ident
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moniker
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ident <- ST.readSTRef __field__ident
+                                             !__val__moniker <- ST.readSTRef __field__moniker
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (MonikerDefinition_key __val__ident __val__moniker
+                                                  __val__defn)
+              _idMap
+                = HashMap.fromList [("ident", 1), ("moniker", 2), ("defn", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData MonikerDefinition_key where
+  rnf
+    (MonikerDefinition_key __field__ident __field__moniker
+       __field__defn)
+    = DeepSeq.rnf __field__ident `Prelude.seq`
+        DeepSeq.rnf __field__moniker `Prelude.seq`
+          DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default MonikerDefinition_key where
+  def = MonikerDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable MonikerDefinition_key where
+  hashWithSalt __salt (MonikerDefinition_key _ident _moniker _defn)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ident)
+           _moniker)
+        _defn
+
+data Moniker_key = Moniker_key{moniker_key_kind :: MonikerKind,
+                               moniker_key_scheme :: MonikerScheme,
+                               moniker_key_ident :: MonikerId}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Moniker_key where
+  toJSON (Moniker_key __field__kind __field__scheme __field__ident)
+    = Aeson.object
+        ("kind" .= __field__kind :
+           "scheme" .= __field__scheme :
+             "ident" .= __field__ident : Prelude.mempty)
+
+instance Thrift.ThriftStruct Moniker_key where
+  buildStruct _proxy
+    (Moniker_key __field__kind __field__scheme __field__ident)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__kind)
+           :
+           Thrift.genField _proxy "scheme" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scheme)
+             :
+             Thrift.genField _proxy "ident" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__ident)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__kind <- ST.newSTRef Default.def
+            __field__scheme <- ST.newSTRef Default.def
+            __field__ident <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "MonikerKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__scheme
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ident
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__scheme <- ST.readSTRef __field__scheme
+                                             !__val__ident <- ST.readSTRef __field__ident
+                                             Prelude.pure
+                                               (Moniker_key __val__kind __val__scheme __val__ident)
+              _idMap
+                = HashMap.fromList [("kind", 1), ("scheme", 2), ("ident", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Moniker_key where
+  rnf (Moniker_key __field__kind __field__scheme __field__ident)
+    = DeepSeq.rnf __field__kind `Prelude.seq`
+        DeepSeq.rnf __field__scheme `Prelude.seq`
+          DeepSeq.rnf __field__ident `Prelude.seq` ()
+
+instance Default.Default Moniker_key where
+  def = Moniker_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Moniker_key where
+  hashWithSalt __salt (Moniker_key _kind _scheme _ident)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _kind)
+           _scheme)
+        _ident
+
+data Metadata_key = Metadata_key{metadata_key_lsifVersion ::
+                                 Text.Text,
+                                 metadata_key_positionEncoding :: Text.Text,
+                                 metadata_key_toolInfo ::
+                                 Prelude.Maybe Glean.Schema.LsifTypes.ToolInfo}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Metadata_key where
+  toJSON
+    (Metadata_key __field__lsifVersion __field__positionEncoding
+       __field__toolInfo)
+    = Aeson.object
+        ("lsifVersion" .= __field__lsifVersion :
+           "positionEncoding" .= __field__positionEncoding :
+             Prelude.maybe Prelude.id ((:) . ("toolInfo" .=)) __field__toolInfo
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct Metadata_key where
+  buildStruct _proxy
+    (Metadata_key __field__lsifVersion __field__positionEncoding
+       __field__toolInfo)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lsifVersion" (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__lsifVersion)
+           :
+           Thrift.genField _proxy "positionEncoding"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__positionEncoding)
+             :
+             case __field__toolInfo of
+               Prelude.Just _val -> Thrift.genField _proxy "toolInfo"
+                                      (Thrift.getStructType _proxy)
+                                      3
+                                      2
+                                      (Thrift.buildStruct _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lsifVersion <- ST.newSTRef ""
+            __field__positionEncoding <- ST.newSTRef ""
+            __field__toolInfo <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__lsifVersion
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__positionEncoding
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__toolInfo
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lsifVersion <- ST.readSTRef
+                                                                      __field__lsifVersion
+                                             !__val__positionEncoding <- ST.readSTRef
+                                                                           __field__positionEncoding
+                                             !__val__toolInfo <- ST.readSTRef __field__toolInfo
+                                             Prelude.pure
+                                               (Metadata_key __val__lsifVersion
+                                                  __val__positionEncoding
+                                                  __val__toolInfo)
+              _idMap
+                = HashMap.fromList
+                    [("lsifVersion", 1), ("positionEncoding", 2), ("toolInfo", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Metadata_key where
+  rnf
+    (Metadata_key __field__lsifVersion __field__positionEncoding
+       __field__toolInfo)
+    = DeepSeq.rnf __field__lsifVersion `Prelude.seq`
+        DeepSeq.rnf __field__positionEncoding `Prelude.seq`
+          DeepSeq.rnf __field__toolInfo `Prelude.seq` ()
+
+instance Default.Default Metadata_key where
+  def = Metadata_key "" "" Prelude.Nothing
+
+instance Hashable.Hashable Metadata_key where
+  hashWithSalt __salt
+    (Metadata_key _lsifVersion _positionEncoding _toolInfo)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lsifVersion)
+           _positionEncoding)
+        _toolInfo
+
+data Location = Location{location_name :: Text.Text,
+                         location_file :: Glean.Schema.Src.File,
+                         location_location :: Glean.Schema.Src.Range}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Location where
+  toJSON (Location __field__name __field__file __field__location)
+    = Aeson.object
+        ("name" .= __field__name :
+           "file" .= __field__file :
+             "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct Location where
+  buildStruct _proxy
+    (Location __field__name __field__file __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__location)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__file <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (Location __val__name __val__file __val__location)
+              _idMap
+                = HashMap.fromList [("name", 1), ("file", 2), ("location", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Location where
+  rnf (Location __field__name __field__file __field__location)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default Location where
+  def = Location "" Default.def Default.def
+
+instance Hashable.Hashable Location where
+  hashWithSalt __salt (Location _name _file _location)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _file)
+        _location
+
+data HoverContent_key = HoverContent_key{hoverContent_key_text ::
+                                         HoverText,
+                                         hoverContent_key_language ::
+                                         Glean.Schema.LsifTypes.LanguageId}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HoverContent_key where
+  toJSON (HoverContent_key __field__text __field__language)
+    = Aeson.object
+        ("text" .= __field__text :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct HoverContent_key where
+  buildStruct _proxy
+    (HoverContent_key __field__text __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "text" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__text)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__text <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__text
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__text <- ST.readSTRef __field__text
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (HoverContent_key __val__text __val__language)
+              _idMap = HashMap.fromList [("text", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HoverContent_key where
+  rnf (HoverContent_key __field__text __field__language)
+    = DeepSeq.rnf __field__text `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default HoverContent_key where
+  def = HoverContent_key Default.def Default.def
+
+instance Hashable.Hashable HoverContent_key where
+  hashWithSalt __salt (HoverContent_key _text _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _text)
+        _language
+
+data Entity = Entity_erlang SomeEntity
+            | Entity_fsharp SomeEntity
+            | Entity_go SomeEntity
+            | Entity_haskell SomeEntity
+            | Entity_java SomeEntity
+            | Entity_kotlin SomeEntity
+            | Entity_ocaml SomeEntity
+            | Entity_python SomeEntity
+            | Entity_rust SomeEntity
+            | Entity_scala SomeEntity
+            | Entity_swift SomeEntity
+            | Entity_typescript SomeEntity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_erlang __erlang)
+    = Aeson.object ["erlang" .= __erlang]
+  toJSON (Entity_fsharp __fsharp)
+    = Aeson.object ["fsharp" .= __fsharp]
+  toJSON (Entity_go __go) = Aeson.object ["go" .= __go]
+  toJSON (Entity_haskell __haskell)
+    = Aeson.object ["haskell" .= __haskell]
+  toJSON (Entity_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Entity_kotlin __kotlin)
+    = Aeson.object ["kotlin" .= __kotlin]
+  toJSON (Entity_ocaml __ocaml) = Aeson.object ["ocaml" .= __ocaml]
+  toJSON (Entity_python __python)
+    = Aeson.object ["python" .= __python]
+  toJSON (Entity_rust __rust) = Aeson.object ["rust" .= __rust]
+  toJSON (Entity_scala __scala) = Aeson.object ["scala" .= __scala]
+  toJSON (Entity_swift __swift) = Aeson.object ["swift" .= __swift]
+  toJSON (Entity_typescript __typescript)
+    = Aeson.object ["typescript" .= __typescript]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_erlang __erlang)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "erlang" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __erlang)]
+  buildStruct _proxy (Entity_fsharp __fsharp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "fsharp" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __fsharp)]
+  buildStruct _proxy (Entity_go __go)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "go" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __go)]
+  buildStruct _proxy (Entity_haskell __haskell)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "haskell" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __haskell)]
+  buildStruct _proxy (Entity_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Entity_kotlin __kotlin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "kotlin" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __kotlin)]
+  buildStruct _proxy (Entity_ocaml __ocaml)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "ocaml" (Thrift.getStructType _proxy) 7 0
+           (Thrift.buildStruct _proxy __ocaml)]
+  buildStruct _proxy (Entity_python __python)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "python" (Thrift.getStructType _proxy) 8 0
+           (Thrift.buildStruct _proxy __python)]
+  buildStruct _proxy (Entity_rust __rust)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "rust" (Thrift.getStructType _proxy) 9 0
+           (Thrift.buildStruct _proxy __rust)]
+  buildStruct _proxy (Entity_scala __scala)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "scala" (Thrift.getStructType _proxy) 10 0
+           (Thrift.buildStruct _proxy __scala)]
+  buildStruct _proxy (Entity_swift __swift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "swift" (Thrift.getStructType _proxy) 11 0
+           (Thrift.buildStruct _proxy __swift)]
+  buildStruct _proxy (Entity_typescript __typescript)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typescript" (Thrift.getStructType _proxy)
+           12
+           0
+           (Thrift.buildStruct _proxy __typescript)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_erlang _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_fsharp _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_go _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_haskell _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_java _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_kotlin _val)
+                                                     7 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_ocaml _val)
+                                                     8 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_python _val)
+                                                     9 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_rust _val)
+                                                     10 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_scala _val)
+                                                     11 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_swift _val)
+                                                     12 | _type == Thrift.getStructType _proxy ->
+                                                          do _val <- Thrift.parseStruct _proxy
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return (Entity_typescript _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("erlang", 1), ("fsharp", 2), ("go", 3), ("haskell", 4),
+             ("java", 5), ("kotlin", 6), ("ocaml", 7), ("python", 8),
+             ("rust", 9), ("scala", 10), ("swift", 11), ("typescript", 12)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_erlang __erlang) = DeepSeq.rnf __erlang
+  rnf (Entity_fsharp __fsharp) = DeepSeq.rnf __fsharp
+  rnf (Entity_go __go) = DeepSeq.rnf __go
+  rnf (Entity_haskell __haskell) = DeepSeq.rnf __haskell
+  rnf (Entity_java __java) = DeepSeq.rnf __java
+  rnf (Entity_kotlin __kotlin) = DeepSeq.rnf __kotlin
+  rnf (Entity_ocaml __ocaml) = DeepSeq.rnf __ocaml
+  rnf (Entity_python __python) = DeepSeq.rnf __python
+  rnf (Entity_rust __rust) = DeepSeq.rnf __rust
+  rnf (Entity_scala __scala) = DeepSeq.rnf __scala
+  rnf (Entity_swift __swift) = DeepSeq.rnf __swift
+  rnf (Entity_typescript __typescript) = DeepSeq.rnf __typescript
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_erlang _erlang)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _erlang)
+  hashWithSalt __salt (Entity_fsharp _fsharp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _fsharp)
+  hashWithSalt __salt (Entity_go _go)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _go)
+  hashWithSalt __salt (Entity_haskell _haskell)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _haskell)
+  hashWithSalt __salt (Entity_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _java)
+  hashWithSalt __salt (Entity_kotlin _kotlin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _kotlin)
+  hashWithSalt __salt (Entity_ocaml _ocaml)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 7 _ocaml)
+  hashWithSalt __salt (Entity_python _python)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 8 _python)
+  hashWithSalt __salt (Entity_rust _rust)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 9 _rust)
+  hashWithSalt __salt (Entity_scala _scala)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 10 _scala)
+  hashWithSalt __salt (Entity_swift _swift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 11 _swift)
+  hashWithSalt __salt (Entity_typescript _typescript)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 12 _typescript)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EntityDefinition_key = EntityDefinition_key{entityDefinition_key_entity
+                                                 :: Entity,
+                                                 entityDefinition_key_defn :: DefinitionMoniker}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityDefinition_key where
+  toJSON (EntityDefinition_key __field__entity __field__defn)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityDefinition_key where
+  buildStruct _proxy
+    (EntityDefinition_key __field__entity __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (EntityDefinition_key __val__entity __val__defn)
+              _idMap = HashMap.fromList [("entity", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityDefinition_key where
+  rnf (EntityDefinition_key __field__entity __field__defn)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default EntityDefinition_key where
+  def = EntityDefinition_key Default.def Default.def
+
+instance Hashable.Hashable EntityDefinition_key where
+  hashWithSalt __salt (EntityDefinition_key _entity _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _defn
+
+data EntityKind_key = EntityKind_key{entityKind_key_entity ::
+                                     Entity,
+                                     entityKind_key_kind :: Glean.Schema.LsifTypes.SymbolKind}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind_key where
+  toJSON (EntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind_key where
+  buildStruct _proxy (EntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (EntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind_key where
+  rnf (EntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default EntityKind_key where
+  def = EntityKind_key Default.def Default.def
+
+instance Hashable.Hashable EntityKind_key where
+  hashWithSalt __salt (EntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data EntityLocation_key = EntityLocation_key{entityLocation_key_entity
+                                             :: Entity,
+                                             entityLocation_key_location :: Location}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation_key where
+  toJSON (EntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation_key where
+  buildStruct _proxy
+    (EntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (EntityLocation_key __val__entity __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation_key where
+  rnf (EntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default EntityLocation_key where
+  def = EntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable EntityLocation_key where
+  hashWithSalt __salt (EntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data EntityUses_key = EntityUses_key{entityUses_key_target ::
+                                     Entity,
+                                     entityUses_key_file :: Glean.Schema.Src.File,
+                                     entityUses_key_range :: Glean.Schema.Src.Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses_key where
+  toJSON
+    (EntityUses_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses_key where
+  buildStruct _proxy
+    (EntityUses_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (EntityUses_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses_key where
+  rnf (EntityUses_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default EntityUses_key where
+  def = EntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EntityUses_key where
+  hashWithSalt __salt (EntityUses_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data FileEntityXRefLocation_key = FileEntityXRefLocation_key{fileEntityXRefLocation_key_file
+                                                             :: Glean.Schema.Src.File,
+                                                             fileEntityXRefLocation_key_source ::
+                                                             Glean.Schema.Src.Range,
+                                                             fileEntityXRefLocation_key_target ::
+                                                             Location,
+                                                             fileEntityXRefLocation_key_entity ::
+                                                             Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocation_key where
+  toJSON
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "source" .= __field__source :
+             "target" .= __field__target :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocation_key where
+  buildStruct _proxy
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityXRefLocation_key __val__file __val__source
+                                                  __val__target
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("source", 2), ("target", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocation_key where
+  rnf
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocation_key where
+  def
+    = FileEntityXRefLocation_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FileEntityXRefLocation_key where
+  hashWithSalt __salt
+    (FileEntityXRefLocation_key _file _source _target _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+              _source)
+           _target)
+        _entity
+
+data ResolveLocation_key = ResolveLocation_key{resolveLocation_key_location
+                                               :: Location,
+                                               resolveLocation_key_entity :: Entity}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation_key where
+  toJSON (ResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation_key where
+  buildStruct _proxy
+    (ResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ResolveLocation_key __val__location __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation_key where
+  rnf (ResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ResolveLocation_key where
+  def = ResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable ResolveLocation_key where
+  hashWithSalt __salt (ResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data SearchByExactLocation_key = SearchByExactLocation_key{searchByExactLocation_key_file
+                                                           :: Glean.Schema.Src.File,
+                                                           searchByExactLocation_key_span ::
+                                                           Glean.Schema.LsifTypes.RangeSpan,
+                                                           searchByExactLocation_key_entity ::
+                                                           Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByExactLocation_key where
+  toJSON
+    (SearchByExactLocation_key __field__file __field__span
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByExactLocation_key where
+  buildStruct _proxy
+    (SearchByExactLocation_key __field__file __field__span
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByExactLocation_key __val__file __val__span
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("span", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByExactLocation_key where
+  rnf
+    (SearchByExactLocation_key __field__file __field__span
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByExactLocation_key where
+  def = SearchByExactLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable SearchByExactLocation_key where
+  hashWithSalt __salt (SearchByExactLocation_key _file _span _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _entity
+
+data SearchByExactLocationAndName_key = SearchByExactLocationAndName_key{searchByExactLocationAndName_key_file
+                                                                         :: Glean.Schema.Src.File,
+                                                                         searchByExactLocationAndName_key_name
+                                                                         :: Name,
+                                                                         searchByExactLocationAndName_key_span
+                                                                         ::
+                                                                         Glean.Schema.LsifTypes.RangeSpan,
+                                                                         searchByExactLocationAndName_key_entity
+                                                                         :: Entity}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByExactLocationAndName_key where
+  toJSON
+    (SearchByExactLocationAndName_key __field__file __field__name
+       __field__span __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "name" .= __field__name :
+             "span" .= __field__span :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByExactLocationAndName_key where
+  buildStruct _proxy
+    (SearchByExactLocationAndName_key __field__file __field__name
+       __field__span __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByExactLocationAndName_key __val__file
+                                                  __val__name
+                                                  __val__span
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("name", 2), ("span", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByExactLocationAndName_key where
+  rnf
+    (SearchByExactLocationAndName_key __field__file __field__name
+       __field__span __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByExactLocationAndName_key where
+  def
+    = SearchByExactLocationAndName_key Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable SearchByExactLocationAndName_key where
+  hashWithSalt __salt
+    (SearchByExactLocationAndName_key _file _name _span _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _name)
+           _span)
+        _entity
+
+data SearchByMoniker_key = SearchByMoniker_key{searchByMoniker_key_ident
+                                               :: MonikerId,
+                                               searchByMoniker_key_entity :: Entity}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByMoniker_key where
+  toJSON (SearchByMoniker_key __field__ident __field__entity)
+    = Aeson.object
+        ("ident" .= __field__ident :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByMoniker_key where
+  buildStruct _proxy
+    (SearchByMoniker_key __field__ident __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ident" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__ident)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ident <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__ident
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ident <- ST.readSTRef __field__ident
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByMoniker_key __val__ident __val__entity)
+              _idMap = HashMap.fromList [("ident", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByMoniker_key where
+  rnf (SearchByMoniker_key __field__ident __field__entity)
+    = DeepSeq.rnf __field__ident `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByMoniker_key where
+  def = SearchByMoniker_key Default.def Default.def
+
+instance Hashable.Hashable SearchByMoniker_key where
+  hashWithSalt __salt (SearchByMoniker_key _ident _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ident)
+        _entity
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Name,
+                                         searchByName_key_entity :: Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data SearchNonLocalByLocation_key = SearchNonLocalByLocation_key{searchNonLocalByLocation_key_file
+                                                                 :: Glean.Schema.Src.File,
+                                                                 searchNonLocalByLocation_key_name
+                                                                 :: Name,
+                                                                 searchNonLocalByLocation_key_entity
+                                                                 :: Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNonLocalByLocation_key where
+  toJSON
+    (SearchNonLocalByLocation_key __field__file __field__name
+       __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "name" .= __field__name :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNonLocalByLocation_key where
+  buildStruct _proxy
+    (SearchNonLocalByLocation_key __field__file __field__name
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchNonLocalByLocation_key __val__file __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("name", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNonLocalByLocation_key where
+  rnf
+    (SearchNonLocalByLocation_key __field__file __field__name
+       __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchNonLocalByLocation_key where
+  def
+    = SearchNonLocalByLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable SearchNonLocalByLocation_key where
+  hashWithSalt __salt
+    (SearchNonLocalByLocation_key _file _name _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _name)
+        _entity
+
+data TagDefinition_key = TagDefinition_key{tagDefinition_key_language
+                                           :: Glean.Schema.LsifTypes.LanguageId,
+                                           tagDefinition_key_defn :: DefinitionMoniker,
+                                           tagDefinition_key_entity :: Entity}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TagDefinition_key where
+  toJSON
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = Aeson.object
+        ("language" .= __field__language :
+           "defn" .= __field__defn :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct TagDefinition_key where
+  buildStruct _proxy
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__language)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__language <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__language <- ST.readSTRef
+                                                                   __field__language
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (TagDefinition_key __val__language __val__defn
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("language", 1), ("defn", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TagDefinition_key where
+  rnf
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = DeepSeq.rnf __field__language `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default TagDefinition_key where
+  def = TagDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TagDefinition_key where
+  hashWithSalt __salt (TagDefinition_key _language _defn _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _language)
+           _defn)
+        _entity
+
+data Document_key = Document_key{document_key_file ::
+                                 Glean.Schema.Src.File,
+                                 document_key_language :: Glean.Schema.LsifTypes.LanguageId}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Document_key where
+  toJSON (Document_key __field__file __field__language)
+    = Aeson.object
+        ("file" .= __field__file :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct Document_key where
+  buildStruct _proxy (Document_key __field__file __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure (Document_key __val__file __val__language)
+              _idMap = HashMap.fromList [("file", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Document_key where
+  rnf (Document_key __field__file __field__language)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default Document_key where
+  def = Document_key Default.def Default.def
+
+instance Hashable.Hashable Document_key where
+  hashWithSalt __salt (Document_key _file _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _language
+
+data DefinitionUse_key = DefinitionUse_key{definitionUse_key_target
+                                           :: Definition,
+                                           definitionUse_key_file :: Document,
+                                           definitionUse_key_range :: Range}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionUse_key where
+  toJSON
+    (DefinitionUse_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionUse_key where
+  buildStruct _proxy
+    (DefinitionUse_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (DefinitionUse_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionUse_key where
+  rnf
+    (DefinitionUse_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default DefinitionUse_key where
+  def = DefinitionUse_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DefinitionUse_key where
+  hashWithSalt __salt (DefinitionUse_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data DefinitionMoniker_key = DefinitionMoniker_key{definitionMoniker_key_defn
+                                                   :: Definition,
+                                                   definitionMoniker_key_moniker ::
+                                                   Prelude.Maybe Moniker}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionMoniker_key where
+  toJSON (DefinitionMoniker_key __field__defn __field__moniker)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           Prelude.maybe Prelude.id ((:) . ("moniker" .=)) __field__moniker
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionMoniker_key where
+  buildStruct _proxy
+    (DefinitionMoniker_key __field__defn __field__moniker)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           case __field__moniker of
+             Prelude.Just _val -> Thrift.genField _proxy "moniker"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__moniker <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__moniker
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__moniker <- ST.readSTRef __field__moniker
+                                             Prelude.pure
+                                               (DefinitionMoniker_key __val__defn __val__moniker)
+              _idMap = HashMap.fromList [("defn", 1), ("moniker", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionMoniker_key where
+  rnf (DefinitionMoniker_key __field__defn __field__moniker)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__moniker `Prelude.seq` ()
+
+instance Default.Default DefinitionMoniker_key where
+  def = DefinitionMoniker_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionMoniker_key where
+  hashWithSalt __salt (DefinitionMoniker_key _defn _moniker)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn)
+        _moniker
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_defn
+                                                     :: Definition,
+                                                     definitionLocation_key_location :: Location}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON (DefinitionLocation_key __field__defn __field__location)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__defn __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__defn __val__location)
+              _idMap = HashMap.fromList [("defn", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf (DefinitionLocation_key __field__defn __field__location)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt (DefinitionLocation_key _defn _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn)
+        _location
+
+data DefinitionKind_key = DefinitionKind_key{definitionKind_key_defn
+                                             :: Definition,
+                                             definitionKind_key_kind ::
+                                             Glean.Schema.LsifTypes.SymbolKind}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionKind_key where
+  toJSON (DefinitionKind_key __field__defn __field__kind)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionKind_key where
+  buildStruct _proxy (DefinitionKind_key __field__defn __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure
+                                               (DefinitionKind_key __val__defn __val__kind)
+              _idMap = HashMap.fromList [("defn", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionKind_key where
+  rnf (DefinitionKind_key __field__defn __field__kind)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default DefinitionKind_key where
+  def = DefinitionKind_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionKind_key where
+  hashWithSalt __salt (DefinitionKind_key _defn _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _kind
+
+data DefinitionHover_key = DefinitionHover_key{definitionHover_key_defn
+                                               :: Definition,
+                                               definitionHover_key_hover :: HoverContent}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionHover_key where
+  toJSON (DefinitionHover_key __field__defn __field__hover)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "hover" .= __field__hover : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionHover_key where
+  buildStruct _proxy
+    (DefinitionHover_key __field__defn __field__hover)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "hover" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__hover)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__hover <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__hover
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__hover <- ST.readSTRef __field__hover
+                                             Prelude.pure
+                                               (DefinitionHover_key __val__defn __val__hover)
+              _idMap = HashMap.fromList [("defn", 1), ("hover", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionHover_key where
+  rnf (DefinitionHover_key __field__defn __field__hover)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__hover `Prelude.seq` ()
+
+instance Default.Default DefinitionHover_key where
+  def = DefinitionHover_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionHover_key where
+  hashWithSalt __salt (DefinitionHover_key _defn _hover)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _hover
+
+data Definition_key = Definition_key{definition_key_file ::
+                                     Document,
+                                     definition_key_range :: Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition_key where
+  toJSON (Definition_key __field__file __field__range)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition_key where
+  buildStruct _proxy (Definition_key __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure (Definition_key __val__file __val__range)
+              _idMap = HashMap.fromList [("file", 1), ("range", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition_key where
+  rnf (Definition_key __field__file __field__range)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default Definition_key where
+  def = Definition_key Default.def Default.def
+
+instance Hashable.Hashable Definition_key where
+  hashWithSalt __salt (Definition_key _file _range)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range
+
+data Declaration_key = Declaration_key{declaration_key_file ::
+                                       Document,
+                                       declaration_key_range :: Range}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration_key where
+  toJSON (Declaration_key __field__file __field__range)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct Declaration_key where
+  buildStruct _proxy (Declaration_key __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure (Declaration_key __val__file __val__range)
+              _idMap = HashMap.fromList [("file", 1), ("range", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Declaration_key where
+  rnf (Declaration_key __field__file __field__range)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default Declaration_key where
+  def = Declaration_key Default.def Default.def
+
+instance Hashable.Hashable Declaration_key where
+  hashWithSalt __salt (Declaration_key _file _range)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range
+{-# LINE 19 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.SearchByExactLocationAndName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.SearchByExactLocationAndName_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.SearchByExactLocationAndName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SearchByExactLocationAndName_key"
+           (Prelude.Just 0))
+{-# LINE 32 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Lsif.Types.SearchByExactLocationAndName_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+          ('Angle.TField "span" (Glean.Schema.LsifTypes.Types.RangeSpan)
+             ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 34 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Lsif.Types.SearchByExactLocationAndName
+         where
+  type KeyType Glean.Schema.Lsif.Types.SearchByExactLocationAndName =
+       Glean.Schema.Lsif.Types.SearchByExactLocationAndName_key
+  getName _proxy
+    = Glean.PredicateRef "lsif.SearchByExactLocationAndName" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.searchByExactLocationAndName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.SearchByExactLocationAndName x k
+  getFactKey
+    = Glean.Schema.Lsif.Types.searchByExactLocationAndName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.SearchByExactLocationAndName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 49 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.SearchByExactLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.SearchByExactLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.SearchByExactLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SearchByExactLocation_key" (Prelude.Just 0))
+{-# LINE 60 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Lsif.Types.SearchByExactLocation_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 62 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Lsif.Types.SearchByExactLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.SearchByExactLocation =
+       Glean.Schema.Lsif.Types.SearchByExactLocation_key
+  getName _proxy = Glean.PredicateRef "lsif.SearchByExactLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.searchByExactLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.SearchByExactLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.searchByExactLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 71 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SearchByExactLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 77 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.NameDefinition_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.NameDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.NameDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.NameDefinition_key" (Prelude.Just 0))
+{-# LINE 86 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.NameDefinition_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Lsif.Types.DefinitionMoniker)
+          ('Angle.TNoFields))
+{-# LINE 88 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.NameDefinition
+         where
+  type KeyType Glean.Schema.Lsif.Types.NameDefinition =
+       Glean.Schema.Lsif.Types.NameDefinition_key
+  getName _proxy = Glean.PredicateRef "lsif.NameDefinition" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.nameDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.NameDefinition x k
+  getFactKey = Glean.Schema.Lsif.Types.nameDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.NameDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.MonikerId where
+  type KeyType Glean.Schema.Lsif.Types.MonikerId = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "lsif.MonikerId" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.monikerId_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.MonikerId x k
+  getFactKey = Glean.Schema.Lsif.Types.monikerId_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 111 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerId where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 117 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.SearchNonLocalByLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.SearchNonLocalByLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.SearchNonLocalByLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SearchNonLocalByLocation_key"
+           (Prelude.Just 0))
+{-# LINE 128 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Lsif.Types.SearchNonLocalByLocation_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+          ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 130 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Lsif.Types.SearchNonLocalByLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.SearchNonLocalByLocation =
+       Glean.Schema.Lsif.Types.SearchNonLocalByLocation_key
+  getName _proxy
+    = Glean.PredicateRef "lsif.SearchNonLocalByLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.searchNonLocalByLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.SearchNonLocalByLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.searchNonLocalByLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 139 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.SearchNonLocalByLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 145 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.NameLowerCase_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.NameLowerCase_key" (Prelude.Just 0))
+{-# LINE 154 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.NameLowerCase_key =
+     'Angle.TField "nameLowerCase" (Data.Text.Text)
+       ('Angle.TField "name" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 156 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.Lsif.Types.NameLowerCase =
+       Glean.Schema.Lsif.Types.NameLowerCase_key
+  getName _proxy = Glean.PredicateRef "lsif.NameLowerCase" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.Lsif.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 165 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.NameLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 171 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.ProjectDocument_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.ProjectDocument_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.ProjectDocument_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.ProjectDocument_key" (Prelude.Just 0))
+{-# LINE 180 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.ProjectDocument_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Document)
+       ('Angle.TField "project"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Project)
+          ('Angle.TNoFields))
+{-# LINE 182 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.ProjectDocument
+         where
+  type KeyType Glean.Schema.Lsif.Types.ProjectDocument =
+       Glean.Schema.Lsif.Types.ProjectDocument_key
+  getName _proxy = Glean.PredicateRef "lsif.ProjectDocument" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.projectDocument_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.ProjectDocument x k
+  getFactKey = Glean.Schema.Lsif.Types.projectDocument_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 191 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.ProjectDocument where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 197 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Metadata_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Metadata_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Metadata_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Metadata_key" (Prelude.Just 0))
+{-# LINE 208 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Metadata_key =
+     'Angle.TField "lsifVersion" (Data.Text.Text)
+       ('Angle.TField "positionEncoding" (Data.Text.Text)
+          ('Angle.TField "toolInfo"
+             (Prelude.Maybe Glean.Schema.LsifTypes.Types.ToolInfo)
+             ('Angle.TNoFields)))
+{-# LINE 210 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Metadata where
+  type KeyType Glean.Schema.Lsif.Types.Metadata =
+       Glean.Schema.Lsif.Types.Metadata_key
+  getName _proxy = Glean.PredicateRef "lsif.Metadata" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.metadata_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Metadata x k
+  getFactKey = Glean.Schema.Lsif.Types.metadata_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 219 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Metadata where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 225 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionHover_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.DefinitionHover_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.DefinitionHover_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.DefinitionHover_key" (Prelude.Just 0))
+{-# LINE 234 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.DefinitionHover_key =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+       ('Angle.TField "hover"
+          (Glean.KeyType Glean.Schema.Lsif.Types.HoverContent)
+          ('Angle.TNoFields))
+{-# LINE 236 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.DefinitionHover
+         where
+  type KeyType Glean.Schema.Lsif.Types.DefinitionHover =
+       Glean.Schema.Lsif.Types.DefinitionHover_key
+  getName _proxy = Glean.PredicateRef "lsif.DefinitionHover" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.definitionHover_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.DefinitionHover x k
+  getFactKey = Glean.Schema.Lsif.Types.definitionHover_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 245 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionHover where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 251 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Reference_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Reference_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Reference_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Reference_key" (Prelude.Just 0))
+{-# LINE 262 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Reference_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Document)
+       ('Angle.TField "range"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Range)
+          ('Angle.TField "target"
+             (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 264 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Reference where
+  type KeyType Glean.Schema.Lsif.Types.Reference =
+       Glean.Schema.Lsif.Types.Reference_key
+  getName _proxy = Glean.PredicateRef "lsif.Reference" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.reference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Reference x k
+  getFactKey = Glean.Schema.Lsif.Types.reference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 273 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Reference where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 279 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Range_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Range_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Range_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Range_key" (Prelude.Just 0))
+{-# LINE 290 "glean/schema/thrift/lsif_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Lsif.Types.Range_key
+     =
+     'Angle.TField "range" (Glean.Schema.LsifTypes.Types.RangeSpan)
+       ('Angle.TField "fullRange"
+          (Prelude.Maybe Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "text" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+             ('Angle.TNoFields)))
+{-# LINE 292 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Range where
+  type KeyType Glean.Schema.Lsif.Types.Range =
+       Glean.Schema.Lsif.Types.Range_key
+  getName _proxy = Glean.PredicateRef "lsif.Range" 2
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.range_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Range x k
+  getFactKey = Glean.Schema.Lsif.Types.range_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 301 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Range where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 307 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.DefinitionLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.DefinitionLocation_key" (Prelude.Just 0))
+{-# LINE 316 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.DefinitionLocation_key =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+       ('Angle.TField "location" (Glean.Schema.Lsif.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 318 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.DefinitionLocation =
+       Glean.Schema.Lsif.Types.DefinitionLocation_key
+  getName _proxy = Glean.PredicateRef "lsif.DefinitionLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 327 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 333 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Name where
+  type KeyType Glean.Schema.Lsif.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "lsif.Name" 2
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Name x k
+  getFactKey = Glean.Schema.Lsif.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 341 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 347 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerSymbolKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.MonikerSymbolKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.MonikerSymbolKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.MonikerSymbolKind_key" (Prelude.Just 0))
+{-# LINE 356 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.MonikerSymbolKind_key =
+     'Angle.TField "moniker"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Moniker)
+       ('Angle.TField "kind" (Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 358 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.MonikerSymbolKind
+         where
+  type KeyType Glean.Schema.Lsif.Types.MonikerSymbolKind =
+       Glean.Schema.Lsif.Types.MonikerSymbolKind_key
+  getName _proxy = Glean.PredicateRef "lsif.MonikerSymbolKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.monikerSymbolKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.MonikerSymbolKind x k
+  getFactKey = Glean.Schema.Lsif.Types.monikerSymbolKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 367 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerSymbolKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 373 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionKind_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.DefinitionKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.DefinitionKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.DefinitionKind_key" (Prelude.Just 0))
+{-# LINE 382 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.DefinitionKind_key =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+       ('Angle.TField "kind" (Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 384 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.DefinitionKind
+         where
+  type KeyType Glean.Schema.Lsif.Types.DefinitionKind =
+       Glean.Schema.Lsif.Types.DefinitionKind_key
+  getName _proxy = Glean.PredicateRef "lsif.DefinitionKind" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.definitionKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.DefinitionKind x k
+  getFactKey = Glean.Schema.Lsif.Types.definitionKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 393 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 399 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionUse_key where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.DefinitionUse_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.DefinitionUse_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.DefinitionUse_key" (Prelude.Just 0))
+{-# LINE 410 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.DefinitionUse_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+       ('Angle.TField "file"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Document)
+          ('Angle.TField "range"
+             (Glean.KeyType Glean.Schema.Lsif.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 412 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.DefinitionUse
+         where
+  type KeyType Glean.Schema.Lsif.Types.DefinitionUse =
+       Glean.Schema.Lsif.Types.DefinitionUse_key
+  getName _proxy = Glean.PredicateRef "lsif.DefinitionUse" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.definitionUse_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.DefinitionUse x k
+  getFactKey = Glean.Schema.Lsif.Types.definitionUse_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 421 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionUse where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 427 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionMoniker_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.DefinitionMoniker_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.DefinitionMoniker_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.DefinitionMoniker_key" (Prelude.Just 0))
+{-# LINE 436 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.DefinitionMoniker_key =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+       ('Angle.TField "moniker"
+          (Prelude.Maybe Glean.Schema.Lsif.Types.Moniker)
+          ('Angle.TNoFields))
+{-# LINE 438 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.DefinitionMoniker
+         where
+  type KeyType Glean.Schema.Lsif.Types.DefinitionMoniker =
+       Glean.Schema.Lsif.Types.DefinitionMoniker_key
+  getName _proxy = Glean.PredicateRef "lsif.DefinitionMoniker" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.definitionMoniker_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.DefinitionMoniker x k
+  getFactKey = Glean.Schema.Lsif.Types.definitionMoniker_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 447 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.DefinitionMoniker where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 453 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SearchByMoniker_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.SearchByMoniker_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.SearchByMoniker_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SearchByMoniker_key" (Prelude.Just 0))
+{-# LINE 462 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.SearchByMoniker_key =
+     'Angle.TField "ident"
+       (Glean.KeyType Glean.Schema.Lsif.Types.MonikerId)
+       ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 464 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.SearchByMoniker
+         where
+  type KeyType Glean.Schema.Lsif.Types.SearchByMoniker =
+       Glean.Schema.Lsif.Types.SearchByMoniker_key
+  getName _proxy = Glean.PredicateRef "lsif.SearchByMoniker" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.searchByMoniker_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.SearchByMoniker x k
+  getFactKey = Glean.Schema.Lsif.Types.searchByMoniker_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 473 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SearchByMoniker where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 479 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SearchByName_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.SearchByName_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SearchByName_key" (Prelude.Just 0))
+{-# LINE 488 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.SearchByName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Lsif.Types.Name)
+       ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 490 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.SearchByName where
+  type KeyType Glean.Schema.Lsif.Types.SearchByName =
+       Glean.Schema.Lsif.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "lsif.SearchByName" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.SearchByName x k
+  getFactKey = Glean.Schema.Lsif.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 499 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 505 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.EntityDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.EntityDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.EntityDefinition_key" (Prelude.Just 0))
+{-# LINE 514 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.EntityDefinition_key =
+     'Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Lsif.Types.DefinitionMoniker)
+          ('Angle.TNoFields))
+{-# LINE 516 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.EntityDefinition
+         where
+  type KeyType Glean.Schema.Lsif.Types.EntityDefinition =
+       Glean.Schema.Lsif.Types.EntityDefinition_key
+  getName _proxy = Glean.PredicateRef "lsif.EntityDefinition" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.entityDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.EntityDefinition x k
+  getFactKey = Glean.Schema.Lsif.Types.entityDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 525 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 531 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityKind_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.EntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.EntityKind_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.EntityKind_key" (Prelude.Just 0))
+{-# LINE 540 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.EntityKind_key =
+     'Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+       ('Angle.TField "kind" (Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 542 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.EntityKind where
+  type KeyType Glean.Schema.Lsif.Types.EntityKind =
+       Glean.Schema.Lsif.Types.EntityKind_key
+  getName _proxy = Glean.PredicateRef "lsif.EntityKind" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.entityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.EntityKind x k
+  getFactKey = Glean.Schema.Lsif.Types.entityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 551 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 557 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.TagDefinition_key where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.TagDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.TagDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.TagDefinition_key" (Prelude.Just 0))
+{-# LINE 568 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.TagDefinition_key =
+     'Angle.TField "language" (Glean.Schema.LsifTypes.Types.LanguageId)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Lsif.Types.DefinitionMoniker)
+          ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 570 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.TagDefinition
+         where
+  type KeyType Glean.Schema.Lsif.Types.TagDefinition =
+       Glean.Schema.Lsif.Types.TagDefinition_key
+  getName _proxy = Glean.PredicateRef "lsif.TagDefinition" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.tagDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.TagDefinition x k
+  getFactKey = Glean.Schema.Lsif.Types.tagDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 579 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.TagDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 585 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Project_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Project_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Project_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Project_key" (Prelude.Just 0))
+{-# LINE 592 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Project_key =
+     'Angle.TField "kind" (Glean.Schema.LsifTypes.Types.LanguageId)
+       ('Angle.TNoFields)
+{-# LINE 594 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Project where
+  type KeyType Glean.Schema.Lsif.Types.Project =
+       Glean.Schema.Lsif.Types.Project_key
+  getName _proxy = Glean.PredicateRef "lsif.Project" 2
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.project_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Project x k
+  getFactKey = Glean.Schema.Lsif.Types.project_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 603 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Project where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 609 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Lsif.Types.FileEntityXRefLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.FileEntityXRefLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.FileEntityXRefLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.FileEntityXRefLocation_key"
+           (Prelude.Just 0))
+{-# LINE 622 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Lsif.Types.FileEntityXRefLocation_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "target" (Glean.Schema.Lsif.Types.Location)
+             ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 624 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Lsif.Types.FileEntityXRefLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.FileEntityXRefLocation =
+       Glean.Schema.Lsif.Types.FileEntityXRefLocation_key
+  getName _proxy = Glean.PredicateRef "lsif.FileEntityXRefLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.fileEntityXRefLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.FileEntityXRefLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.fileEntityXRefLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 633 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.FileEntityXRefLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 639 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityLocation_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.EntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.EntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.EntityLocation_key" (Prelude.Just 0))
+{-# LINE 648 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.EntityLocation_key =
+     'Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+       ('Angle.TField "location" (Glean.Schema.Lsif.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 650 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.EntityLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.EntityLocation =
+       Glean.Schema.Lsif.Types.EntityLocation_key
+  getName _proxy = Glean.PredicateRef "lsif.EntityLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.entityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.EntityLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.entityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 659 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 665 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Moniker_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Moniker_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Moniker_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Moniker_key" (Prelude.Just 0))
+{-# LINE 676 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Moniker_key =
+     'Angle.TField "kind" (Glean.Schema.Lsif.Types.MonikerKind)
+       ('Angle.TField "scheme"
+          (Glean.KeyType Glean.Schema.Lsif.Types.MonikerScheme)
+          ('Angle.TField "ident"
+             (Glean.KeyType Glean.Schema.Lsif.Types.MonikerId)
+             ('Angle.TNoFields)))
+{-# LINE 678 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Moniker where
+  type KeyType Glean.Schema.Lsif.Types.Moniker =
+       Glean.Schema.Lsif.Types.Moniker_key
+  getName _proxy = Glean.PredicateRef "lsif.Moniker" 2
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.moniker_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Moniker x k
+  getFactKey = Glean.Schema.Lsif.Types.moniker_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 687 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Moniker where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 693 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.MonikerScheme
+         where
+  type KeyType Glean.Schema.Lsif.Types.MonikerScheme = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "lsif.MonikerScheme" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.monikerScheme_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.MonikerScheme x k
+  getFactKey = Glean.Schema.Lsif.Types.monikerScheme_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 701 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerScheme where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 707 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Document_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Document_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Document_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Document_key" (Prelude.Just 0))
+{-# LINE 716 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Document_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "language" (Glean.Schema.LsifTypes.Types.LanguageId)
+          ('Angle.TNoFields))
+{-# LINE 718 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Document where
+  type KeyType Glean.Schema.Lsif.Types.Document =
+       Glean.Schema.Lsif.Types.Document_key
+  getName _proxy = Glean.PredicateRef "lsif.Document" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.document_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Document x k
+  getFactKey = Glean.Schema.Lsif.Types.document_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 727 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Document where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 733 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.ResolveLocation_key
+         where
+  buildRtsValue b (Glean.Schema.Lsif.Types.ResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.ResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.ResolveLocation_key" (Prelude.Just 0))
+{-# LINE 742 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.ResolveLocation_key =
+     'Angle.TField "location" (Glean.Schema.Lsif.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.Lsif.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 744 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.ResolveLocation
+         where
+  type KeyType Glean.Schema.Lsif.Types.ResolveLocation =
+       Glean.Schema.Lsif.Types.ResolveLocation_key
+  getName _proxy = Glean.PredicateRef "lsif.ResolveLocation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.resolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.ResolveLocation x k
+  getFactKey = Glean.Schema.Lsif.Types.resolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 753 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.ResolveLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 759 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.PackageInformation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.PackageInformation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.PackageInformation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.PackageInformation_key" (Prelude.Just 0))
+{-# LINE 770 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.PackageInformation_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "manager" (Data.Text.Text)
+          ('Angle.TField "version" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 772 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.PackageInformation
+         where
+  type KeyType Glean.Schema.Lsif.Types.PackageInformation =
+       Glean.Schema.Lsif.Types.PackageInformation_key
+  getName _proxy = Glean.PredicateRef "lsif.PackageInformation" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.packageInformation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.PackageInformation x k
+  getFactKey = Glean.Schema.Lsif.Types.packageInformation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 781 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.PackageInformation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 787 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.HoverText where
+  type KeyType Glean.Schema.Lsif.Types.HoverText = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "lsif.HoverText" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.hoverText_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.HoverText x k
+  getFactKey = Glean.Schema.Lsif.Types.hoverText_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 795 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.HoverText where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 801 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Definition_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Definition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Definition_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Definition_key" (Prelude.Just 0))
+{-# LINE 810 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Definition_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Document)
+       ('Angle.TField "range"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 812 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Definition where
+  type KeyType Glean.Schema.Lsif.Types.Definition =
+       Glean.Schema.Lsif.Types.Definition_key
+  getName _proxy = Glean.PredicateRef "lsif.Definition" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.definition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Definition x k
+  getFactKey = Glean.Schema.Lsif.Types.definition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 821 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Definition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 827 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.HoverContent_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.HoverContent_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.HoverContent_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.HoverContent_key" (Prelude.Just 0))
+{-# LINE 836 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.HoverContent_key =
+     'Angle.TField "text"
+       (Glean.KeyType Glean.Schema.Lsif.Types.HoverText)
+       ('Angle.TField "language" (Glean.Schema.LsifTypes.Types.LanguageId)
+          ('Angle.TNoFields))
+{-# LINE 838 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.HoverContent where
+  type KeyType Glean.Schema.Lsif.Types.HoverContent =
+       Glean.Schema.Lsif.Types.HoverContent_key
+  getName _proxy = Glean.PredicateRef "lsif.HoverContent" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.hoverContent_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.HoverContent x k
+  getFactKey = Glean.Schema.Lsif.Types.hoverContent_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 847 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.HoverContent where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 853 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityUses_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.EntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.EntityUses_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.EntityUses_key" (Prelude.Just 0))
+{-# LINE 864 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.EntityUses_key =
+     'Angle.TField "target" (Glean.Schema.Lsif.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 866 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.EntityUses where
+  type KeyType Glean.Schema.Lsif.Types.EntityUses =
+       Glean.Schema.Lsif.Types.EntityUses_key
+  getName _proxy = Glean.PredicateRef "lsif.EntityUses" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.entityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.EntityUses x k
+  getFactKey = Glean.Schema.Lsif.Types.entityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 875 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.EntityUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 881 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Declaration_key where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Declaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Declaration_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Declaration_key" (Prelude.Just 0))
+{-# LINE 890 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.Declaration_key =
+     'Angle.TField "file"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Document)
+       ('Angle.TField "range"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 892 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.Declaration where
+  type KeyType Glean.Schema.Lsif.Types.Declaration =
+       Glean.Schema.Lsif.Types.Declaration_key
+  getName _proxy = Glean.PredicateRef "lsif.Declaration" 2
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Lsif.Types.declaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.Declaration x k
+  getFactKey = Glean.Schema.Lsif.Types.declaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 901 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Declaration where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 907 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Lsif.Types.MonikerDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.MonikerDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.MonikerDefinition_key" (Prelude.Just 0))
+{-# LINE 918 "glean/schema/thrift/lsif_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Lsif.Types.MonikerDefinition_key =
+     'Angle.TField "ident"
+       (Glean.KeyType Glean.Schema.Lsif.Types.MonikerId)
+       ('Angle.TField "moniker"
+          (Glean.KeyType Glean.Schema.Lsif.Types.Moniker)
+          ('Angle.TField "defn"
+             (Glean.KeyType Glean.Schema.Lsif.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 920 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Lsif.Types.MonikerDefinition
+         where
+  type KeyType Glean.Schema.Lsif.Types.MonikerDefinition =
+       Glean.Schema.Lsif.Types.MonikerDefinition_key
+  getName _proxy = Glean.PredicateRef "lsif.MonikerDefinition" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Lsif.Types.monikerDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Lsif.Types.MonikerDefinition x k
+  getFactKey = Glean.Schema.Lsif.Types.monikerDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 929 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 935 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Location where
+  buildRtsValue b (Glean.Schema.Lsif.Types.Location x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Lsif.Types.Location <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.Location" (Prelude.Just 2))
+{-# LINE 946 "glean/schema/thrift/lsif_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Lsif.Types.Location =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "location" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 948 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.Entity where
+  buildRtsValue b Glean.Schema.Lsif.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 12
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_erlang x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_fsharp x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_go x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_haskell x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_java x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_kotlin x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_ocaml x)
+    = do Glean.buildRtsSelector b 6
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_python x)
+    = do Glean.buildRtsSelector b 7
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_rust x)
+    = do Glean.buildRtsSelector b 8
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_scala x)
+    = do Glean.buildRtsSelector b 9
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_swift x)
+    = do Glean.buildRtsSelector b 10
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.Entity_typescript x)
+    = do Glean.buildRtsSelector b 11
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Lsif.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.Lsif.Types.Entity_erlang,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_fsharp,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_go,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_haskell,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_java,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_kotlin,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_ocaml,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_python,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_rust,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_scala,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_swift,
+         Glean.mapD Glean.Schema.Lsif.Types.Entity_typescript]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "lsif.Entity" (Prelude.Just 2))
+{-# LINE 1004 "glean/schema/thrift/lsif_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Lsif.Types.Entity =
+     'Angle.TField "erlang" (Glean.Schema.Lsif.Types.SomeEntity)
+       ('Angle.TField "fsharp" (Glean.Schema.Lsif.Types.SomeEntity)
+          ('Angle.TField "go" (Glean.Schema.Lsif.Types.SomeEntity)
+             ('Angle.TField "haskell" (Glean.Schema.Lsif.Types.SomeEntity)
+                ('Angle.TField "java" (Glean.Schema.Lsif.Types.SomeEntity)
+                   ('Angle.TField "kotlin" (Glean.Schema.Lsif.Types.SomeEntity)
+                      ('Angle.TField "ocaml" (Glean.Schema.Lsif.Types.SomeEntity)
+                         ('Angle.TField "python" (Glean.Schema.Lsif.Types.SomeEntity)
+                            ('Angle.TField "rust" (Glean.Schema.Lsif.Types.SomeEntity)
+                               ('Angle.TField "scala" (Glean.Schema.Lsif.Types.SomeEntity)
+                                  ('Angle.TField "swift" (Glean.Schema.Lsif.Types.SomeEntity)
+                                     ('Angle.TField "typescript"
+                                        (Glean.Schema.Lsif.Types.SomeEntity)
+                                        ('Angle.TNoFields))))))))))))
+{-# LINE 1006 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.MonikerKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.MonikerKind" (Prelude.Just 2))
+{-# LINE 1011 "glean/schema/thrift/lsif_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Lsif.Types.MonikerKind =
+     'Angle.TField "Export" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Local" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Import" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Implementation" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 1013 "glean/schema/thrift/lsif_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Lsif.Types.MonikerKind where
+  type AngleEnumTy Glean.Schema.Lsif.Types.MonikerKind =
+       Glean.Schema.Lsif.Types.MonikerKind
+  enumName v = Text.pack (Prelude.drop 12 (Prelude.show v))
+{-# LINE 1017 "glean/schema/thrift/lsif_include.hs" #-}
+instance Glean.Type Glean.Schema.Lsif.Types.SomeEntity where
+  buildRtsValue b Glean.Schema.Lsif.Types.SomeEntity_EMPTY
+    = Glean.buildRtsSelector b 2
+  buildRtsValue b (Glean.Schema.Lsif.Types.SomeEntity_decl x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Lsif.Types.SomeEntity_defn x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Lsif.Types.SomeEntity_EMPTY)
+        [Glean.mapD Glean.Schema.Lsif.Types.SomeEntity_decl,
+         Glean.mapD Glean.Schema.Lsif.Types.SomeEntity_defn]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.SomeEntity" (Prelude.Just 2))
+{-# LINE 1033 "glean/schema/thrift/lsif_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Lsif.Types.SomeEntity =
+     'Angle.TField "decl"
+       (Glean.KeyType Glean.Schema.Lsif.Types.Declaration)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Lsif.Types.DefinitionMoniker)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/LsifTypes/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/LsifTypes/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/LsifTypes/Types.hs
@@ -0,0 +1,1468 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/lsif_types_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/lsif_types_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/lsif_types_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/LsifTypes/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.LsifTypes.Types
+       (pREDICATE_VERSIONS, ToSrcRange_id,
+        ToSrcRange(ToSrcRange, toSrcRange_id, toSrcRange_key),
+        FromSrcRange_id,
+        FromSrcRange(FromSrcRange, fromSrcRange_id, fromSrcRange_key),
+        ToolInfo(ToolInfo, toolInfo_toolName, toolInfo_toolArgs,
+                 toolInfo_version),
+        SymbolKind(SymbolKind_File, SymbolKind_Module,
+                   SymbolKind_Namespace, SymbolKind_Package, SymbolKind_Class_,
+                   SymbolKind_Method, SymbolKind_Property, SymbolKind_Field,
+                   SymbolKind_Constructor, SymbolKind_Enum_, SymbolKind_Interface,
+                   SymbolKind_Function, SymbolKind_Variable, SymbolKind_Constant,
+                   SymbolKind_String, SymbolKind_Number, SymbolKind_Boolean,
+                   SymbolKind_Array, SymbolKind_Object_, SymbolKind_Key,
+                   SymbolKind_Null, SymbolKind_EnumMember, SymbolKind_Struct,
+                   SymbolKind_Event, SymbolKind_Operator, SymbolKind_TypeParameter,
+                   SymbolKind_Unknown, SymbolKind__UNKNOWN),
+        RangeSpan(RangeSpan, rangeSpan_lineBegin, rangeSpan_columnBegin,
+                  rangeSpan_lineEnd, rangeSpan_columnEnd),
+        ToSrcRange_key(ToSrcRange_key, toSrcRange_key_file,
+                       toSrcRange_key_lsif, toSrcRange_key_range),
+        LanguageId(LanguageId_ABAP, LanguageId_WindowsBat,
+                   LanguageId_BibTeX, LanguageId_Clojure, LanguageId_Coffeescript,
+                   LanguageId_C, LanguageId_Cpp, LanguageId_CSharp, LanguageId_CSS,
+                   LanguageId_Diff, LanguageId_Dart, LanguageId_Dockerfile,
+                   LanguageId_Elixir, LanguageId_Erlang, LanguageId_FSharp,
+                   LanguageId_Git, LanguageId_Go, LanguageId_Groovy,
+                   LanguageId_Handlebars, LanguageId_Haskell, LanguageId_HTML,
+                   LanguageId_Ini, LanguageId_Java, LanguageId_JavaScript,
+                   LanguageId_JavaScriptReact, LanguageId_JSON, LanguageId_LaTeX,
+                   LanguageId_Less, LanguageId_Lua, LanguageId_Makefile,
+                   LanguageId_Markdown, LanguageId_ObjectiveC,
+                   LanguageId_ObjectiveCpp, LanguageId_Perl, LanguageId_Perl6,
+                   LanguageId_PHP, LanguageId_Powershell, LanguageId_Pug,
+                   LanguageId_Python, LanguageId_R, LanguageId_Razor, LanguageId_Ruby,
+                   LanguageId_Rust, LanguageId_SCSS, LanguageId_Scala,
+                   LanguageId_ShaderLab, LanguageId_Shell, LanguageId_SQL,
+                   LanguageId_Swift, LanguageId_TypeScript,
+                   LanguageId_TypeScriptReact, LanguageId_TeX, LanguageId_VisualBasic,
+                   LanguageId_XML, LanguageId_XSL, LanguageId_YAML,
+                   LanguageId_UnknownLanguage, LanguageId_Kotlin, LanguageId_OCaml,
+                   LanguageId__UNKNOWN),
+        FromSrcRange_key(FromSrcRange_key, fromSrcRange_key_range,
+                         fromSrcRange_key_file, fromSrcRange_key_lsif))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/lsif_types_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 118 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/LsifTypes/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList [("ToSrcRange", 1), ("FromSrcRange", 1)]
+
+type ToSrcRange_id = Glean.Id
+
+data ToSrcRange = ToSrcRange{toSrcRange_id ::
+                             {-# UNPACK #-} !ToSrcRange_id,
+                             toSrcRange_key :: Prelude.Maybe ToSrcRange_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ToSrcRange where
+  toJSON (ToSrcRange __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ToSrcRange where
+  buildStruct _proxy (ToSrcRange __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ToSrcRange __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ToSrcRange where
+  rnf (ToSrcRange __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ToSrcRange where
+  def = ToSrcRange Default.def Prelude.Nothing
+
+instance Hashable.Hashable ToSrcRange where
+  hashWithSalt __salt (ToSrcRange _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FromSrcRange_id = Glean.Id
+
+data FromSrcRange = FromSrcRange{fromSrcRange_id ::
+                                 {-# UNPACK #-} !FromSrcRange_id,
+                                 fromSrcRange_key :: Prelude.Maybe FromSrcRange_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromSrcRange where
+  toJSON (FromSrcRange __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FromSrcRange where
+  buildStruct _proxy (FromSrcRange __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FromSrcRange __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FromSrcRange where
+  rnf (FromSrcRange __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FromSrcRange where
+  def = FromSrcRange Default.def Prelude.Nothing
+
+instance Hashable.Hashable FromSrcRange where
+  hashWithSalt __salt (FromSrcRange _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data ToolInfo = ToolInfo{toolInfo_toolName :: Text.Text,
+                         toolInfo_toolArgs :: [Text.Text],
+                         toolInfo_version :: Prelude.Maybe Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ToolInfo where
+  toJSON
+    (ToolInfo __field__toolName __field__toolArgs __field__version)
+    = Aeson.object
+        ("toolName" .= __field__toolName :
+           "toolArgs" .= __field__toolArgs :
+             Prelude.maybe Prelude.id ((:) . ("version" .=)) __field__version
+               Prelude.mempty)
+
+instance Thrift.ThriftStruct ToolInfo where
+  buildStruct _proxy
+    (ToolInfo __field__toolName __field__toolArgs __field__version)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "toolName" (Thrift.getStringType _proxy) 1
+           0
+           (Thrift.genText _proxy __field__toolName)
+           :
+           Thrift.genField _proxy "toolArgs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__toolArgs)
+             :
+             case __field__version of
+               Prelude.Just _val -> Thrift.genField _proxy "version"
+                                      (Thrift.getStringType _proxy)
+                                      3
+                                      2
+                                      (Thrift.genText _proxy _val)
+                                      : []
+               Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__toolName <- ST.newSTRef ""
+            __field__toolArgs <- ST.newSTRef Default.def
+            __field__version <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__toolName
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__toolArgs
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__toolName <- ST.readSTRef
+                                                                   __field__toolName
+                                             !__val__toolArgs <- ST.readSTRef __field__toolArgs
+                                             !__val__version <- ST.readSTRef __field__version
+                                             Prelude.pure
+                                               (ToolInfo __val__toolName __val__toolArgs
+                                                  __val__version)
+              _idMap
+                = HashMap.fromList
+                    [("toolName", 1), ("toolArgs", 2), ("version", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ToolInfo where
+  rnf (ToolInfo __field__toolName __field__toolArgs __field__version)
+    = DeepSeq.rnf __field__toolName `Prelude.seq`
+        DeepSeq.rnf __field__toolArgs `Prelude.seq`
+          DeepSeq.rnf __field__version `Prelude.seq` ()
+
+instance Default.Default ToolInfo where
+  def = ToolInfo "" Default.def Prelude.Nothing
+
+instance Hashable.Hashable ToolInfo where
+  hashWithSalt __salt (ToolInfo _toolName _toolArgs _version)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _toolName)
+           _toolArgs)
+        _version
+
+data SymbolKind = SymbolKind_File
+                | SymbolKind_Module
+                | SymbolKind_Namespace
+                | SymbolKind_Package
+                | SymbolKind_Class_
+                | SymbolKind_Method
+                | SymbolKind_Property
+                | SymbolKind_Field
+                | SymbolKind_Constructor
+                | SymbolKind_Enum_
+                | SymbolKind_Interface
+                | SymbolKind_Function
+                | SymbolKind_Variable
+                | SymbolKind_Constant
+                | SymbolKind_String
+                | SymbolKind_Number
+                | SymbolKind_Boolean
+                | SymbolKind_Array
+                | SymbolKind_Object_
+                | SymbolKind_Key
+                | SymbolKind_Null
+                | SymbolKind_EnumMember
+                | SymbolKind_Struct
+                | SymbolKind_Event
+                | SymbolKind_Operator
+                | SymbolKind_TypeParameter
+                | SymbolKind_Unknown
+                | SymbolKind__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolKind where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData SymbolKind where
+  rnf __SymbolKind = Prelude.seq __SymbolKind ()
+
+instance Default.Default SymbolKind where
+  def = SymbolKind_File
+
+instance Hashable.Hashable SymbolKind where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum SymbolKind where
+  toThriftEnum 0 = SymbolKind_File
+  toThriftEnum 1 = SymbolKind_Module
+  toThriftEnum 2 = SymbolKind_Namespace
+  toThriftEnum 3 = SymbolKind_Package
+  toThriftEnum 4 = SymbolKind_Class_
+  toThriftEnum 5 = SymbolKind_Method
+  toThriftEnum 6 = SymbolKind_Property
+  toThriftEnum 7 = SymbolKind_Field
+  toThriftEnum 8 = SymbolKind_Constructor
+  toThriftEnum 9 = SymbolKind_Enum_
+  toThriftEnum 10 = SymbolKind_Interface
+  toThriftEnum 11 = SymbolKind_Function
+  toThriftEnum 12 = SymbolKind_Variable
+  toThriftEnum 13 = SymbolKind_Constant
+  toThriftEnum 14 = SymbolKind_String
+  toThriftEnum 15 = SymbolKind_Number
+  toThriftEnum 16 = SymbolKind_Boolean
+  toThriftEnum 17 = SymbolKind_Array
+  toThriftEnum 18 = SymbolKind_Object_
+  toThriftEnum 19 = SymbolKind_Key
+  toThriftEnum 20 = SymbolKind_Null
+  toThriftEnum 21 = SymbolKind_EnumMember
+  toThriftEnum 22 = SymbolKind_Struct
+  toThriftEnum 23 = SymbolKind_Event
+  toThriftEnum 24 = SymbolKind_Operator
+  toThriftEnum 25 = SymbolKind_TypeParameter
+  toThriftEnum 26 = SymbolKind_Unknown
+  toThriftEnum val = SymbolKind__UNKNOWN val
+  fromThriftEnum SymbolKind_File = 0
+  fromThriftEnum SymbolKind_Module = 1
+  fromThriftEnum SymbolKind_Namespace = 2
+  fromThriftEnum SymbolKind_Package = 3
+  fromThriftEnum SymbolKind_Class_ = 4
+  fromThriftEnum SymbolKind_Method = 5
+  fromThriftEnum SymbolKind_Property = 6
+  fromThriftEnum SymbolKind_Field = 7
+  fromThriftEnum SymbolKind_Constructor = 8
+  fromThriftEnum SymbolKind_Enum_ = 9
+  fromThriftEnum SymbolKind_Interface = 10
+  fromThriftEnum SymbolKind_Function = 11
+  fromThriftEnum SymbolKind_Variable = 12
+  fromThriftEnum SymbolKind_Constant = 13
+  fromThriftEnum SymbolKind_String = 14
+  fromThriftEnum SymbolKind_Number = 15
+  fromThriftEnum SymbolKind_Boolean = 16
+  fromThriftEnum SymbolKind_Array = 17
+  fromThriftEnum SymbolKind_Object_ = 18
+  fromThriftEnum SymbolKind_Key = 19
+  fromThriftEnum SymbolKind_Null = 20
+  fromThriftEnum SymbolKind_EnumMember = 21
+  fromThriftEnum SymbolKind_Struct = 22
+  fromThriftEnum SymbolKind_Event = 23
+  fromThriftEnum SymbolKind_Operator = 24
+  fromThriftEnum SymbolKind_TypeParameter = 25
+  fromThriftEnum SymbolKind_Unknown = 26
+  fromThriftEnum (SymbolKind__UNKNOWN val) = val
+  allThriftEnumValues
+    = [SymbolKind_File, SymbolKind_Module, SymbolKind_Namespace,
+       SymbolKind_Package, SymbolKind_Class_, SymbolKind_Method,
+       SymbolKind_Property, SymbolKind_Field, SymbolKind_Constructor,
+       SymbolKind_Enum_, SymbolKind_Interface, SymbolKind_Function,
+       SymbolKind_Variable, SymbolKind_Constant, SymbolKind_String,
+       SymbolKind_Number, SymbolKind_Boolean, SymbolKind_Array,
+       SymbolKind_Object_, SymbolKind_Key, SymbolKind_Null,
+       SymbolKind_EnumMember, SymbolKind_Struct, SymbolKind_Event,
+       SymbolKind_Operator, SymbolKind_TypeParameter, SymbolKind_Unknown]
+  toThriftEnumEither 0 = Prelude.Right SymbolKind_File
+  toThriftEnumEither 1 = Prelude.Right SymbolKind_Module
+  toThriftEnumEither 2 = Prelude.Right SymbolKind_Namespace
+  toThriftEnumEither 3 = Prelude.Right SymbolKind_Package
+  toThriftEnumEither 4 = Prelude.Right SymbolKind_Class_
+  toThriftEnumEither 5 = Prelude.Right SymbolKind_Method
+  toThriftEnumEither 6 = Prelude.Right SymbolKind_Property
+  toThriftEnumEither 7 = Prelude.Right SymbolKind_Field
+  toThriftEnumEither 8 = Prelude.Right SymbolKind_Constructor
+  toThriftEnumEither 9 = Prelude.Right SymbolKind_Enum_
+  toThriftEnumEither 10 = Prelude.Right SymbolKind_Interface
+  toThriftEnumEither 11 = Prelude.Right SymbolKind_Function
+  toThriftEnumEither 12 = Prelude.Right SymbolKind_Variable
+  toThriftEnumEither 13 = Prelude.Right SymbolKind_Constant
+  toThriftEnumEither 14 = Prelude.Right SymbolKind_String
+  toThriftEnumEither 15 = Prelude.Right SymbolKind_Number
+  toThriftEnumEither 16 = Prelude.Right SymbolKind_Boolean
+  toThriftEnumEither 17 = Prelude.Right SymbolKind_Array
+  toThriftEnumEither 18 = Prelude.Right SymbolKind_Object_
+  toThriftEnumEither 19 = Prelude.Right SymbolKind_Key
+  toThriftEnumEither 20 = Prelude.Right SymbolKind_Null
+  toThriftEnumEither 21 = Prelude.Right SymbolKind_EnumMember
+  toThriftEnumEither 22 = Prelude.Right SymbolKind_Struct
+  toThriftEnumEither 23 = Prelude.Right SymbolKind_Event
+  toThriftEnumEither 24 = Prelude.Right SymbolKind_Operator
+  toThriftEnumEither 25 = Prelude.Right SymbolKind_TypeParameter
+  toThriftEnumEither 26 = Prelude.Right SymbolKind_Unknown
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum SymbolKind: "
+           ++ Prelude.show val)
+
+data RangeSpan = RangeSpan{rangeSpan_lineBegin :: Glean.Nat,
+                           rangeSpan_columnBegin :: Glean.Nat, rangeSpan_lineEnd :: Glean.Nat,
+                           rangeSpan_columnEnd :: Glean.Nat}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeSpan where
+  toJSON
+    (RangeSpan __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = Aeson.object
+        ("lineBegin" .= Glean.unNat __field__lineBegin :
+           "columnBegin" .= Glean.unNat __field__columnBegin :
+             "lineEnd" .= Glean.unNat __field__lineEnd :
+               "columnEnd" .= Glean.unNat __field__columnEnd : Prelude.mempty)
+
+instance Thrift.ThriftStruct RangeSpan where
+  buildStruct _proxy
+    (RangeSpan __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "lineBegin" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__lineBegin)
+           :
+           Thrift.genField _proxy "columnBegin" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__columnBegin)
+             :
+             Thrift.genField _proxy "lineEnd" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__lineEnd)
+               :
+               Thrift.genField _proxy "columnEnd" (Thrift.getI64Type _proxy) 4 3
+                 ((Thrift.genI64 _proxy . Glean.unNat) __field__columnEnd)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__lineBegin <- ST.newSTRef (Glean.Nat Default.def)
+            __field__columnBegin <- ST.newSTRef (Glean.Nat Default.def)
+            __field__lineEnd <- ST.newSTRef (Glean.Nat Default.def)
+            __field__columnEnd <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__lineBegin
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__columnBegin
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__lineEnd
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__columnEnd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__lineBegin <- ST.readSTRef
+                                                                    __field__lineBegin
+                                             !__val__columnBegin <- ST.readSTRef
+                                                                      __field__columnBegin
+                                             !__val__lineEnd <- ST.readSTRef __field__lineEnd
+                                             !__val__columnEnd <- ST.readSTRef __field__columnEnd
+                                             Prelude.pure
+                                               (RangeSpan __val__lineBegin __val__columnBegin
+                                                  __val__lineEnd
+                                                  __val__columnEnd)
+              _idMap
+                = HashMap.fromList
+                    [("lineBegin", 1), ("columnBegin", 2), ("lineEnd", 3),
+                     ("columnEnd", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData RangeSpan where
+  rnf
+    (RangeSpan __field__lineBegin __field__columnBegin __field__lineEnd
+       __field__columnEnd)
+    = DeepSeq.rnf __field__lineBegin `Prelude.seq`
+        DeepSeq.rnf __field__columnBegin `Prelude.seq`
+          DeepSeq.rnf __field__lineEnd `Prelude.seq`
+            DeepSeq.rnf __field__columnEnd `Prelude.seq` ()
+
+instance Default.Default RangeSpan where
+  def
+    = RangeSpan (Glean.Nat Default.def) (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+
+instance Hashable.Hashable RangeSpan where
+  hashWithSalt __salt
+    (RangeSpan _lineBegin _columnBegin _lineEnd _columnEnd)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _lineBegin)
+              _columnBegin)
+           _lineEnd)
+        _columnEnd
+
+data ToSrcRange_key = ToSrcRange_key{toSrcRange_key_file ::
+                                     Glean.Schema.Src.File,
+                                     toSrcRange_key_lsif :: RangeSpan,
+                                     toSrcRange_key_range :: Glean.Schema.Src.Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ToSrcRange_key where
+  toJSON (ToSrcRange_key __field__file __field__lsif __field__range)
+    = Aeson.object
+        ("file" .= __field__file :
+           "lsif" .= __field__lsif :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct ToSrcRange_key where
+  buildStruct _proxy
+    (ToSrcRange_key __field__file __field__lsif __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "lsif" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__lsif)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__lsif <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__lsif
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__lsif <- ST.readSTRef __field__lsif
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (ToSrcRange_key __val__file __val__lsif __val__range)
+              _idMap = HashMap.fromList [("file", 1), ("lsif", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ToSrcRange_key where
+  rnf (ToSrcRange_key __field__file __field__lsif __field__range)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__lsif `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default ToSrcRange_key where
+  def = ToSrcRange_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ToSrcRange_key where
+  hashWithSalt __salt (ToSrcRange_key _file _lsif _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _lsif)
+        _range
+
+data LanguageId = LanguageId_ABAP
+                | LanguageId_WindowsBat
+                | LanguageId_BibTeX
+                | LanguageId_Clojure
+                | LanguageId_Coffeescript
+                | LanguageId_C
+                | LanguageId_Cpp
+                | LanguageId_CSharp
+                | LanguageId_CSS
+                | LanguageId_Diff
+                | LanguageId_Dart
+                | LanguageId_Dockerfile
+                | LanguageId_Elixir
+                | LanguageId_Erlang
+                | LanguageId_FSharp
+                | LanguageId_Git
+                | LanguageId_Go
+                | LanguageId_Groovy
+                | LanguageId_Handlebars
+                | LanguageId_Haskell
+                | LanguageId_HTML
+                | LanguageId_Ini
+                | LanguageId_Java
+                | LanguageId_JavaScript
+                | LanguageId_JavaScriptReact
+                | LanguageId_JSON
+                | LanguageId_LaTeX
+                | LanguageId_Less
+                | LanguageId_Lua
+                | LanguageId_Makefile
+                | LanguageId_Markdown
+                | LanguageId_ObjectiveC
+                | LanguageId_ObjectiveCpp
+                | LanguageId_Perl
+                | LanguageId_Perl6
+                | LanguageId_PHP
+                | LanguageId_Powershell
+                | LanguageId_Pug
+                | LanguageId_Python
+                | LanguageId_R
+                | LanguageId_Razor
+                | LanguageId_Ruby
+                | LanguageId_Rust
+                | LanguageId_SCSS
+                | LanguageId_Scala
+                | LanguageId_ShaderLab
+                | LanguageId_Shell
+                | LanguageId_SQL
+                | LanguageId_Swift
+                | LanguageId_TypeScript
+                | LanguageId_TypeScriptReact
+                | LanguageId_TeX
+                | LanguageId_VisualBasic
+                | LanguageId_XML
+                | LanguageId_XSL
+                | LanguageId_YAML
+                | LanguageId_UnknownLanguage
+                | LanguageId_Kotlin
+                | LanguageId_OCaml
+                | LanguageId__UNKNOWN Prelude.Int
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LanguageId where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData LanguageId where
+  rnf __LanguageId = Prelude.seq __LanguageId ()
+
+instance Default.Default LanguageId where
+  def = LanguageId_ABAP
+
+instance Hashable.Hashable LanguageId where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum LanguageId where
+  toThriftEnum 0 = LanguageId_ABAP
+  toThriftEnum 1 = LanguageId_WindowsBat
+  toThriftEnum 2 = LanguageId_BibTeX
+  toThriftEnum 3 = LanguageId_Clojure
+  toThriftEnum 4 = LanguageId_Coffeescript
+  toThriftEnum 5 = LanguageId_C
+  toThriftEnum 6 = LanguageId_Cpp
+  toThriftEnum 7 = LanguageId_CSharp
+  toThriftEnum 8 = LanguageId_CSS
+  toThriftEnum 9 = LanguageId_Diff
+  toThriftEnum 10 = LanguageId_Dart
+  toThriftEnum 11 = LanguageId_Dockerfile
+  toThriftEnum 12 = LanguageId_Elixir
+  toThriftEnum 13 = LanguageId_Erlang
+  toThriftEnum 14 = LanguageId_FSharp
+  toThriftEnum 15 = LanguageId_Git
+  toThriftEnum 16 = LanguageId_Go
+  toThriftEnum 17 = LanguageId_Groovy
+  toThriftEnum 18 = LanguageId_Handlebars
+  toThriftEnum 19 = LanguageId_Haskell
+  toThriftEnum 20 = LanguageId_HTML
+  toThriftEnum 21 = LanguageId_Ini
+  toThriftEnum 22 = LanguageId_Java
+  toThriftEnum 23 = LanguageId_JavaScript
+  toThriftEnum 24 = LanguageId_JavaScriptReact
+  toThriftEnum 25 = LanguageId_JSON
+  toThriftEnum 26 = LanguageId_LaTeX
+  toThriftEnum 27 = LanguageId_Less
+  toThriftEnum 28 = LanguageId_Lua
+  toThriftEnum 29 = LanguageId_Makefile
+  toThriftEnum 30 = LanguageId_Markdown
+  toThriftEnum 31 = LanguageId_ObjectiveC
+  toThriftEnum 32 = LanguageId_ObjectiveCpp
+  toThriftEnum 33 = LanguageId_Perl
+  toThriftEnum 34 = LanguageId_Perl6
+  toThriftEnum 35 = LanguageId_PHP
+  toThriftEnum 36 = LanguageId_Powershell
+  toThriftEnum 37 = LanguageId_Pug
+  toThriftEnum 38 = LanguageId_Python
+  toThriftEnum 39 = LanguageId_R
+  toThriftEnum 40 = LanguageId_Razor
+  toThriftEnum 41 = LanguageId_Ruby
+  toThriftEnum 42 = LanguageId_Rust
+  toThriftEnum 43 = LanguageId_SCSS
+  toThriftEnum 44 = LanguageId_Scala
+  toThriftEnum 45 = LanguageId_ShaderLab
+  toThriftEnum 46 = LanguageId_Shell
+  toThriftEnum 47 = LanguageId_SQL
+  toThriftEnum 48 = LanguageId_Swift
+  toThriftEnum 49 = LanguageId_TypeScript
+  toThriftEnum 50 = LanguageId_TypeScriptReact
+  toThriftEnum 51 = LanguageId_TeX
+  toThriftEnum 52 = LanguageId_VisualBasic
+  toThriftEnum 53 = LanguageId_XML
+  toThriftEnum 54 = LanguageId_XSL
+  toThriftEnum 55 = LanguageId_YAML
+  toThriftEnum 56 = LanguageId_UnknownLanguage
+  toThriftEnum 57 = LanguageId_Kotlin
+  toThriftEnum 58 = LanguageId_OCaml
+  toThriftEnum val = LanguageId__UNKNOWN val
+  fromThriftEnum LanguageId_ABAP = 0
+  fromThriftEnum LanguageId_WindowsBat = 1
+  fromThriftEnum LanguageId_BibTeX = 2
+  fromThriftEnum LanguageId_Clojure = 3
+  fromThriftEnum LanguageId_Coffeescript = 4
+  fromThriftEnum LanguageId_C = 5
+  fromThriftEnum LanguageId_Cpp = 6
+  fromThriftEnum LanguageId_CSharp = 7
+  fromThriftEnum LanguageId_CSS = 8
+  fromThriftEnum LanguageId_Diff = 9
+  fromThriftEnum LanguageId_Dart = 10
+  fromThriftEnum LanguageId_Dockerfile = 11
+  fromThriftEnum LanguageId_Elixir = 12
+  fromThriftEnum LanguageId_Erlang = 13
+  fromThriftEnum LanguageId_FSharp = 14
+  fromThriftEnum LanguageId_Git = 15
+  fromThriftEnum LanguageId_Go = 16
+  fromThriftEnum LanguageId_Groovy = 17
+  fromThriftEnum LanguageId_Handlebars = 18
+  fromThriftEnum LanguageId_Haskell = 19
+  fromThriftEnum LanguageId_HTML = 20
+  fromThriftEnum LanguageId_Ini = 21
+  fromThriftEnum LanguageId_Java = 22
+  fromThriftEnum LanguageId_JavaScript = 23
+  fromThriftEnum LanguageId_JavaScriptReact = 24
+  fromThriftEnum LanguageId_JSON = 25
+  fromThriftEnum LanguageId_LaTeX = 26
+  fromThriftEnum LanguageId_Less = 27
+  fromThriftEnum LanguageId_Lua = 28
+  fromThriftEnum LanguageId_Makefile = 29
+  fromThriftEnum LanguageId_Markdown = 30
+  fromThriftEnum LanguageId_ObjectiveC = 31
+  fromThriftEnum LanguageId_ObjectiveCpp = 32
+  fromThriftEnum LanguageId_Perl = 33
+  fromThriftEnum LanguageId_Perl6 = 34
+  fromThriftEnum LanguageId_PHP = 35
+  fromThriftEnum LanguageId_Powershell = 36
+  fromThriftEnum LanguageId_Pug = 37
+  fromThriftEnum LanguageId_Python = 38
+  fromThriftEnum LanguageId_R = 39
+  fromThriftEnum LanguageId_Razor = 40
+  fromThriftEnum LanguageId_Ruby = 41
+  fromThriftEnum LanguageId_Rust = 42
+  fromThriftEnum LanguageId_SCSS = 43
+  fromThriftEnum LanguageId_Scala = 44
+  fromThriftEnum LanguageId_ShaderLab = 45
+  fromThriftEnum LanguageId_Shell = 46
+  fromThriftEnum LanguageId_SQL = 47
+  fromThriftEnum LanguageId_Swift = 48
+  fromThriftEnum LanguageId_TypeScript = 49
+  fromThriftEnum LanguageId_TypeScriptReact = 50
+  fromThriftEnum LanguageId_TeX = 51
+  fromThriftEnum LanguageId_VisualBasic = 52
+  fromThriftEnum LanguageId_XML = 53
+  fromThriftEnum LanguageId_XSL = 54
+  fromThriftEnum LanguageId_YAML = 55
+  fromThriftEnum LanguageId_UnknownLanguage = 56
+  fromThriftEnum LanguageId_Kotlin = 57
+  fromThriftEnum LanguageId_OCaml = 58
+  fromThriftEnum (LanguageId__UNKNOWN val) = val
+  allThriftEnumValues
+    = [LanguageId_ABAP, LanguageId_WindowsBat, LanguageId_BibTeX,
+       LanguageId_Clojure, LanguageId_Coffeescript, LanguageId_C,
+       LanguageId_Cpp, LanguageId_CSharp, LanguageId_CSS, LanguageId_Diff,
+       LanguageId_Dart, LanguageId_Dockerfile, LanguageId_Elixir,
+       LanguageId_Erlang, LanguageId_FSharp, LanguageId_Git,
+       LanguageId_Go, LanguageId_Groovy, LanguageId_Handlebars,
+       LanguageId_Haskell, LanguageId_HTML, LanguageId_Ini,
+       LanguageId_Java, LanguageId_JavaScript, LanguageId_JavaScriptReact,
+       LanguageId_JSON, LanguageId_LaTeX, LanguageId_Less, LanguageId_Lua,
+       LanguageId_Makefile, LanguageId_Markdown, LanguageId_ObjectiveC,
+       LanguageId_ObjectiveCpp, LanguageId_Perl, LanguageId_Perl6,
+       LanguageId_PHP, LanguageId_Powershell, LanguageId_Pug,
+       LanguageId_Python, LanguageId_R, LanguageId_Razor, LanguageId_Ruby,
+       LanguageId_Rust, LanguageId_SCSS, LanguageId_Scala,
+       LanguageId_ShaderLab, LanguageId_Shell, LanguageId_SQL,
+       LanguageId_Swift, LanguageId_TypeScript,
+       LanguageId_TypeScriptReact, LanguageId_TeX, LanguageId_VisualBasic,
+       LanguageId_XML, LanguageId_XSL, LanguageId_YAML,
+       LanguageId_UnknownLanguage, LanguageId_Kotlin, LanguageId_OCaml]
+  toThriftEnumEither 0 = Prelude.Right LanguageId_ABAP
+  toThriftEnumEither 1 = Prelude.Right LanguageId_WindowsBat
+  toThriftEnumEither 2 = Prelude.Right LanguageId_BibTeX
+  toThriftEnumEither 3 = Prelude.Right LanguageId_Clojure
+  toThriftEnumEither 4 = Prelude.Right LanguageId_Coffeescript
+  toThriftEnumEither 5 = Prelude.Right LanguageId_C
+  toThriftEnumEither 6 = Prelude.Right LanguageId_Cpp
+  toThriftEnumEither 7 = Prelude.Right LanguageId_CSharp
+  toThriftEnumEither 8 = Prelude.Right LanguageId_CSS
+  toThriftEnumEither 9 = Prelude.Right LanguageId_Diff
+  toThriftEnumEither 10 = Prelude.Right LanguageId_Dart
+  toThriftEnumEither 11 = Prelude.Right LanguageId_Dockerfile
+  toThriftEnumEither 12 = Prelude.Right LanguageId_Elixir
+  toThriftEnumEither 13 = Prelude.Right LanguageId_Erlang
+  toThriftEnumEither 14 = Prelude.Right LanguageId_FSharp
+  toThriftEnumEither 15 = Prelude.Right LanguageId_Git
+  toThriftEnumEither 16 = Prelude.Right LanguageId_Go
+  toThriftEnumEither 17 = Prelude.Right LanguageId_Groovy
+  toThriftEnumEither 18 = Prelude.Right LanguageId_Handlebars
+  toThriftEnumEither 19 = Prelude.Right LanguageId_Haskell
+  toThriftEnumEither 20 = Prelude.Right LanguageId_HTML
+  toThriftEnumEither 21 = Prelude.Right LanguageId_Ini
+  toThriftEnumEither 22 = Prelude.Right LanguageId_Java
+  toThriftEnumEither 23 = Prelude.Right LanguageId_JavaScript
+  toThriftEnumEither 24 = Prelude.Right LanguageId_JavaScriptReact
+  toThriftEnumEither 25 = Prelude.Right LanguageId_JSON
+  toThriftEnumEither 26 = Prelude.Right LanguageId_LaTeX
+  toThriftEnumEither 27 = Prelude.Right LanguageId_Less
+  toThriftEnumEither 28 = Prelude.Right LanguageId_Lua
+  toThriftEnumEither 29 = Prelude.Right LanguageId_Makefile
+  toThriftEnumEither 30 = Prelude.Right LanguageId_Markdown
+  toThriftEnumEither 31 = Prelude.Right LanguageId_ObjectiveC
+  toThriftEnumEither 32 = Prelude.Right LanguageId_ObjectiveCpp
+  toThriftEnumEither 33 = Prelude.Right LanguageId_Perl
+  toThriftEnumEither 34 = Prelude.Right LanguageId_Perl6
+  toThriftEnumEither 35 = Prelude.Right LanguageId_PHP
+  toThriftEnumEither 36 = Prelude.Right LanguageId_Powershell
+  toThriftEnumEither 37 = Prelude.Right LanguageId_Pug
+  toThriftEnumEither 38 = Prelude.Right LanguageId_Python
+  toThriftEnumEither 39 = Prelude.Right LanguageId_R
+  toThriftEnumEither 40 = Prelude.Right LanguageId_Razor
+  toThriftEnumEither 41 = Prelude.Right LanguageId_Ruby
+  toThriftEnumEither 42 = Prelude.Right LanguageId_Rust
+  toThriftEnumEither 43 = Prelude.Right LanguageId_SCSS
+  toThriftEnumEither 44 = Prelude.Right LanguageId_Scala
+  toThriftEnumEither 45 = Prelude.Right LanguageId_ShaderLab
+  toThriftEnumEither 46 = Prelude.Right LanguageId_Shell
+  toThriftEnumEither 47 = Prelude.Right LanguageId_SQL
+  toThriftEnumEither 48 = Prelude.Right LanguageId_Swift
+  toThriftEnumEither 49 = Prelude.Right LanguageId_TypeScript
+  toThriftEnumEither 50 = Prelude.Right LanguageId_TypeScriptReact
+  toThriftEnumEither 51 = Prelude.Right LanguageId_TeX
+  toThriftEnumEither 52 = Prelude.Right LanguageId_VisualBasic
+  toThriftEnumEither 53 = Prelude.Right LanguageId_XML
+  toThriftEnumEither 54 = Prelude.Right LanguageId_XSL
+  toThriftEnumEither 55 = Prelude.Right LanguageId_YAML
+  toThriftEnumEither 56 = Prelude.Right LanguageId_UnknownLanguage
+  toThriftEnumEither 57 = Prelude.Right LanguageId_Kotlin
+  toThriftEnumEither 58 = Prelude.Right LanguageId_OCaml
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum LanguageId: "
+           ++ Prelude.show val)
+
+data FromSrcRange_key = FromSrcRange_key{fromSrcRange_key_range ::
+                                         Glean.Schema.Src.Range,
+                                         fromSrcRange_key_file :: Glean.Schema.Src.File,
+                                         fromSrcRange_key_lsif :: RangeSpan}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FromSrcRange_key where
+  toJSON
+    (FromSrcRange_key __field__range __field__file __field__lsif)
+    = Aeson.object
+        ("range" .= __field__range :
+           "file" .= __field__file : "lsif" .= __field__lsif : Prelude.mempty)
+
+instance Thrift.ThriftStruct FromSrcRange_key where
+  buildStruct _proxy
+    (FromSrcRange_key __field__range __field__file __field__lsif)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__range)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "lsif" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__lsif)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__range <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__lsif <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__lsif
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__range <- ST.readSTRef __field__range
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__lsif <- ST.readSTRef __field__lsif
+                                             Prelude.pure
+                                               (FromSrcRange_key __val__range __val__file
+                                                  __val__lsif)
+              _idMap = HashMap.fromList [("range", 1), ("file", 2), ("lsif", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FromSrcRange_key where
+  rnf (FromSrcRange_key __field__range __field__file __field__lsif)
+    = DeepSeq.rnf __field__range `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__lsif `Prelude.seq` ()
+
+instance Default.Default FromSrcRange_key where
+  def = FromSrcRange_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FromSrcRange_key where
+  hashWithSalt __salt (FromSrcRange_key _range _file _lsif)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _range) _file)
+        _lsif
+{-# LINE 18 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.ToSrcRange_key
+         where
+  buildRtsValue b
+    (Glean.Schema.LsifTypes.Types.ToSrcRange_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.LsifTypes.Types.ToSrcRange_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.ToSrcRange_key" (Prelude.Just 0))
+{-# LINE 29 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.LsifTypes.Types.ToSrcRange_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "lsif" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 31 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Predicate Glean.Schema.LsifTypes.Types.ToSrcRange
+         where
+  type KeyType Glean.Schema.LsifTypes.Types.ToSrcRange =
+       Glean.Schema.LsifTypes.Types.ToSrcRange_key
+  getName _proxy = Glean.PredicateRef "lsif.types.ToSrcRange" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.LsifTypes.Types.toSrcRange_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.LsifTypes.Types.ToSrcRange x k
+  getFactKey = Glean.Schema.LsifTypes.Types.toSrcRange_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.ToSrcRange where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.FromSrcRange_key
+         where
+  buildRtsValue b
+    (Glean.Schema.LsifTypes.Types.FromSrcRange_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.LsifTypes.Types.FromSrcRange_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.FromSrcRange_key" (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.LsifTypes.Types.FromSrcRange_key =
+     'Angle.TField "range" (Glean.Schema.Src.Types.Range)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "lsif" (Glean.Schema.LsifTypes.Types.RangeSpan)
+             ('Angle.TNoFields)))
+{-# LINE 59 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Predicate Glean.Schema.LsifTypes.Types.FromSrcRange
+         where
+  type KeyType Glean.Schema.LsifTypes.Types.FromSrcRange =
+       Glean.Schema.LsifTypes.Types.FromSrcRange_key
+  getName _proxy = Glean.PredicateRef "lsif.types.FromSrcRange" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.LsifTypes.Types.fromSrcRange_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.LsifTypes.Types.FromSrcRange x k
+  getFactKey = Glean.Schema.LsifTypes.Types.fromSrcRange_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.FromSrcRange where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 74 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.RangeSpan where
+  buildRtsValue b
+    (Glean.Schema.LsifTypes.Types.RangeSpan x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.LsifTypes.Types.RangeSpan <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.RangeSpan" (Prelude.Just 1))
+{-# LINE 87 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.LsifTypes.Types.RangeSpan =
+     'Angle.TField "lineBegin" (Glean.Nat)
+       ('Angle.TField "columnBegin" (Glean.Nat)
+          ('Angle.TField "lineEnd" (Glean.Nat)
+             ('Angle.TField "columnEnd" (Glean.Nat) ('Angle.TNoFields))))
+{-# LINE 89 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.ToolInfo where
+  buildRtsValue b (Glean.Schema.LsifTypes.Types.ToolInfo x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.LsifTypes.Types.ToolInfo <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.ToolInfo" (Prelude.Just 1))
+{-# LINE 100 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.LsifTypes.Types.ToolInfo =
+     'Angle.TField "toolName" (Data.Text.Text)
+       ('Angle.TField "toolArgs" ([Data.Text.Text])
+          ('Angle.TField "version" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TNoFields)))
+{-# LINE 102 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.SymbolKind where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.SymbolKind" (Prelude.Just 1))
+{-# LINE 107 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.LsifTypes.Types.SymbolKind =
+     'Angle.TField "File" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "Module" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Namespace" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Package" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Class_" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "Method" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Property" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Field" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "Constructor" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Enum_" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "Interface" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "Function" (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "Variable" (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "Constant"
+                                              (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "String"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "Number"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "Boolean"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "Array"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "Object_"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "Key"
+                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                ('Angle.TField "Null"
+                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                   ('Angle.TField "EnumMember"
+                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                      ('Angle.TField "Struct"
+                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                         ('Angle.TField "Event"
+                                                                            (Glean.Schema.Builtin.Types.Unit)
+                                                                            ('Angle.TField
+                                                                               "Operator"
+                                                                               (Glean.Schema.Builtin.Types.Unit)
+                                                                               ('Angle.TField
+                                                                                  "TypeParameter"
+                                                                                  (Glean.Schema.Builtin.Types.Unit)
+                                                                                  ('Angle.TField
+                                                                                     "Unknown"
+                                                                                     (Glean.Schema.Builtin.Types.Unit)
+                                                                                     ('Angle.TNoFields)))))))))))))))))))))))))))
+{-# LINE 109 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.LsifTypes.Types.SymbolKind
+         where
+  type AngleEnumTy Glean.Schema.LsifTypes.Types.SymbolKind =
+       Glean.Schema.LsifTypes.Types.SymbolKind
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
+{-# LINE 113 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Glean.Type Glean.Schema.LsifTypes.Types.LanguageId where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "lsif.types.LanguageId" (Prelude.Just 1))
+{-# LINE 118 "glean/schema/thrift/lsif_types_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.LsifTypes.Types.LanguageId =
+     'Angle.TField "ABAP" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "WindowsBat" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "BibTeX" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Clojure" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Coffeescript" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "C" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "Cpp" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "CSharp" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "CSS" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Diff" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "Dart" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TField "Dockerfile" (Glean.Schema.Builtin.Types.Unit)
+                                        ('Angle.TField "Elixir" (Glean.Schema.Builtin.Types.Unit)
+                                           ('Angle.TField "Erlang" (Glean.Schema.Builtin.Types.Unit)
+                                              ('Angle.TField "FSharp"
+                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                 ('Angle.TField "Git"
+                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                    ('Angle.TField "Go"
+                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                       ('Angle.TField "Groovy"
+                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                          ('Angle.TField "Handlebars"
+                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                             ('Angle.TField "Haskell"
+                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                ('Angle.TField "HTML"
+                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                   ('Angle.TField "Ini"
+                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                      ('Angle.TField "Java"
+                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                         ('Angle.TField "JavaScript"
+                                                                            (Glean.Schema.Builtin.Types.Unit)
+                                                                            ('Angle.TField
+                                                                               "JavaScriptReact"
+                                                                               (Glean.Schema.Builtin.Types.Unit)
+                                                                               ('Angle.TField "JSON"
+                                                                                  (Glean.Schema.Builtin.Types.Unit)
+                                                                                  ('Angle.TField
+                                                                                     "LaTeX"
+                                                                                     (Glean.Schema.Builtin.Types.Unit)
+                                                                                     ('Angle.TField
+                                                                                        "Less"
+                                                                                        (Glean.Schema.Builtin.Types.Unit)
+                                                                                        ('Angle.TField
+                                                                                           "Lua"
+                                                                                           (Glean.Schema.Builtin.Types.Unit)
+                                                                                           ('Angle.TField
+                                                                                              "Makefile"
+                                                                                              (Glean.Schema.Builtin.Types.Unit)
+                                                                                              ('Angle.TField
+                                                                                                 "Markdown"
+                                                                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                                                                 ('Angle.TField
+                                                                                                    "ObjectiveC"
+                                                                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                                                                    ('Angle.TField
+                                                                                                       "ObjectiveCpp"
+                                                                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                                                                       ('Angle.TField
+                                                                                                          "Perl"
+                                                                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                                                                          ('Angle.TField
+                                                                                                             "Perl6"
+                                                                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                                                                             ('Angle.TField
+                                                                                                                "PHP"
+                                                                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                ('Angle.TField
+                                                                                                                   "Powershell"
+                                                                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                   ('Angle.TField
+                                                                                                                      "Pug"
+                                                                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                      ('Angle.TField
+                                                                                                                         "Python"
+                                                                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                         ('Angle.TField
+                                                                                                                            "R"
+                                                                                                                            (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                            ('Angle.TField
+                                                                                                                               "Razor"
+                                                                                                                               (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                               ('Angle.TField
+                                                                                                                                  "Ruby"
+                                                                                                                                  (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                  ('Angle.TField
+                                                                                                                                     "Rust"
+                                                                                                                                     (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                     ('Angle.TField
+                                                                                                                                        "SCSS"
+                                                                                                                                        (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                        ('Angle.TField
+                                                                                                                                           "Scala"
+                                                                                                                                           (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                           ('Angle.TField
+                                                                                                                                              "ShaderLab"
+                                                                                                                                              (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                              ('Angle.TField
+                                                                                                                                                 "Shell"
+                                                                                                                                                 (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                 ('Angle.TField
+                                                                                                                                                    "SQL"
+                                                                                                                                                    (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                    ('Angle.TField
+                                                                                                                                                       "Swift"
+                                                                                                                                                       (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                       ('Angle.TField
+                                                                                                                                                          "TypeScript"
+                                                                                                                                                          (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                          ('Angle.TField
+                                                                                                                                                             "TypeScriptReact"
+                                                                                                                                                             (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                             ('Angle.TField
+                                                                                                                                                                "TeX"
+                                                                                                                                                                (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                ('Angle.TField
+                                                                                                                                                                   "VisualBasic"
+                                                                                                                                                                   (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                   ('Angle.TField
+                                                                                                                                                                      "XML"
+                                                                                                                                                                      (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                      ('Angle.TField
+                                                                                                                                                                         "XSL"
+                                                                                                                                                                         (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                         ('Angle.TField
+                                                                                                                                                                            "YAML"
+                                                                                                                                                                            (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                            ('Angle.TField
+                                                                                                                                                                               "UnknownLanguage"
+                                                                                                                                                                               (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                               ('Angle.TField
+                                                                                                                                                                                  "Kotlin"
+                                                                                                                                                                                  (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                                  ('Angle.TField
+                                                                                                                                                                                     "OCaml"
+                                                                                                                                                                                     (Glean.Schema.Builtin.Types.Unit)
+                                                                                                                                                                                     ('Angle.TNoFields)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+{-# LINE 120 "glean/schema/thrift/lsif_types_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.LsifTypes.Types.LanguageId
+         where
+  type AngleEnumTy Glean.Schema.LsifTypes.Types.LanguageId =
+       Glean.Schema.LsifTypes.Types.LanguageId
+  enumName v = Text.pack (Prelude.drop 11 (Prelude.show v))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Pp1/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Pp1/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Pp1/Types.hs
@@ -0,0 +1,1409 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/pp1_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/pp1_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/pp1_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Pp1/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Pp1.Types
+       (pREDICATE_VERSIONS, Use_id, Use(Use, use_id, use_key), Undef_id,
+        Undef(Undef, undef_id, undef_key), Macro_id,
+        Macro(Macro, macro_id, macro_key), Include_id,
+        Include(Include, include_id, include_key), DefineUse_id,
+        DefineUse(DefineUse, defineUse_id, defineUse_key),
+        DefineLowerCase_id,
+        DefineLowerCase(DefineLowerCase, defineLowerCase_id,
+                        defineLowerCase_key),
+        Define_id, Define(Define, define_id, define_key),
+        Use_key(Use_key, use_key_macro, use_key_definition, use_key_expand,
+                use_key_source, use_key_nameSpan),
+        Undef_key(Undef_key, undef_key_macro, undef_key_source),
+        Include_key(Include_key, include_key_file, include_key_source,
+                    include_key_pathSpan),
+        DefineUse_key(DefineUse_key, defineUse_key_define,
+                      defineUse_key_use),
+        DefineLowerCase_key(DefineLowerCase_key,
+                            defineLowerCase_key_name_lowercase, defineLowerCase_key_decl),
+        Define_key(Define_key, define_key_macro, define_key_source))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/pp1_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 90 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Pp1/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("Macro", 1), ("DefineLowerCase", 1), ("DefineUse", 1),
+       ("Include", 1), ("Define", 1), ("Use", 1), ("Undef", 1)]
+
+type Use_id = Glean.Id
+
+data Use = Use{use_id :: {-# UNPACK #-} !Use_id,
+               use_key :: Prelude.Maybe Use_key}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Use where
+  toJSON (Use __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Use where
+  buildStruct _proxy (Use __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Use __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Use where
+  rnf (Use __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Use where
+  def = Use Default.def Prelude.Nothing
+
+instance Hashable.Hashable Use where
+  hashWithSalt __salt (Use _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Undef_id = Glean.Id
+
+data Undef = Undef{undef_id :: {-# UNPACK #-} !Undef_id,
+                   undef_key :: Prelude.Maybe Undef_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Undef where
+  toJSON (Undef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Undef where
+  buildStruct _proxy (Undef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Undef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Undef where
+  rnf (Undef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Undef where
+  def = Undef Default.def Prelude.Nothing
+
+instance Hashable.Hashable Undef where
+  hashWithSalt __salt (Undef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Macro_id = Glean.Id
+
+data Macro = Macro{macro_id :: {-# UNPACK #-} !Macro_id,
+                   macro_key :: Prelude.Maybe Text.Text}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Macro where
+  toJSON (Macro __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Macro where
+  buildStruct _proxy (Macro __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Macro __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Macro where
+  rnf (Macro __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Macro where
+  def = Macro Default.def Prelude.Nothing
+
+instance Hashable.Hashable Macro where
+  hashWithSalt __salt (Macro _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Include_id = Glean.Id
+
+data Include = Include{include_id :: {-# UNPACK #-} !Include_id,
+                       include_key :: Prelude.Maybe Include_key}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Include where
+  toJSON (Include __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Include where
+  buildStruct _proxy (Include __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Include __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Include where
+  rnf (Include __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Include where
+  def = Include Default.def Prelude.Nothing
+
+instance Hashable.Hashable Include where
+  hashWithSalt __salt (Include _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefineUse_id = Glean.Id
+
+data DefineUse = DefineUse{defineUse_id ::
+                           {-# UNPACK #-} !DefineUse_id,
+                           defineUse_key :: Prelude.Maybe DefineUse_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefineUse where
+  toJSON (DefineUse __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefineUse where
+  buildStruct _proxy (DefineUse __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefineUse __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefineUse where
+  rnf (DefineUse __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefineUse where
+  def = DefineUse Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefineUse where
+  hashWithSalt __salt (DefineUse _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefineLowerCase_id = Glean.Id
+
+data DefineLowerCase = DefineLowerCase{defineLowerCase_id ::
+                                       {-# UNPACK #-} !DefineLowerCase_id,
+                                       defineLowerCase_key :: Prelude.Maybe DefineLowerCase_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefineLowerCase where
+  toJSON (DefineLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefineLowerCase where
+  buildStruct _proxy (DefineLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefineLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefineLowerCase where
+  rnf (DefineLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefineLowerCase where
+  def = DefineLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefineLowerCase where
+  hashWithSalt __salt (DefineLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Define_id = Glean.Id
+
+data Define = Define{define_id :: {-# UNPACK #-} !Define_id,
+                     define_key :: Prelude.Maybe Define_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Define where
+  toJSON (Define __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Define where
+  buildStruct _proxy (Define __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Define __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Define where
+  rnf (Define __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Define where
+  def = Define Default.def Prelude.Nothing
+
+instance Hashable.Hashable Define where
+  hashWithSalt __salt (Define _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data Use_key = Use_key{use_key_macro :: Macro,
+                       use_key_definition :: Prelude.Maybe Glean.Schema.Src.Loc,
+                       use_key_expand :: Prelude.Bool,
+                       use_key_source :: Glean.Schema.Src.Range,
+                       use_key_nameSpan :: Glean.Schema.Src.ByteSpan}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Use_key where
+  toJSON
+    (Use_key __field__macro __field__definition __field__expand
+       __field__source __field__nameSpan)
+    = Aeson.object
+        ("macro" .= __field__macro :
+           Prelude.maybe Prelude.id ((:) . ("definition" .=))
+             __field__definition
+             ("expand" .= __field__expand :
+                "source" .= __field__source :
+                  "nameSpan" .= __field__nameSpan : Prelude.mempty))
+
+instance Thrift.ThriftStruct Use_key where
+  buildStruct _proxy
+    (Use_key __field__macro __field__definition __field__expand
+       __field__source __field__nameSpan)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__macro)
+           :
+           let (__cereal__definition, __id__definition)
+                 = case __field__definition of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "definition"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__definition
+               (Thrift.genFieldBool _proxy "expand" 3 __id__definition
+                  __field__expand
+                  :
+                  Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 4 3
+                    (Thrift.buildStruct _proxy __field__source)
+                    :
+                    Thrift.genField _proxy "nameSpan" (Thrift.getStructType _proxy) 5 4
+                      (Thrift.buildStruct _proxy __field__nameSpan)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__macro <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Prelude.Nothing
+            __field__expand <- ST.newSTRef Prelude.False
+            __field__source <- ST.newSTRef Default.def
+            __field__nameSpan <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__macro
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__expand
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameSpan
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__macro <- ST.readSTRef __field__macro
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             !__val__expand <- ST.readSTRef __field__expand
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__nameSpan <- ST.readSTRef __field__nameSpan
+                                             Prelude.pure
+                                               (Use_key __val__macro __val__definition __val__expand
+                                                  __val__source
+                                                  __val__nameSpan)
+              _idMap
+                = HashMap.fromList
+                    [("macro", 1), ("definition", 2), ("expand", 3), ("source", 4),
+                     ("nameSpan", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData Use_key where
+  rnf
+    (Use_key __field__macro __field__definition __field__expand
+       __field__source __field__nameSpan)
+    = DeepSeq.rnf __field__macro `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq`
+          DeepSeq.rnf __field__expand `Prelude.seq`
+            DeepSeq.rnf __field__source `Prelude.seq`
+              DeepSeq.rnf __field__nameSpan `Prelude.seq` ()
+
+instance Default.Default Use_key where
+  def
+    = Use_key Default.def Prelude.Nothing Prelude.False Default.def
+        Default.def
+
+instance Hashable.Hashable Use_key where
+  hashWithSalt __salt
+    (Use_key _macro _definition _expand _source _nameSpan)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _macro)
+                 _definition)
+              _expand)
+           _source)
+        _nameSpan
+
+data Undef_key = Undef_key{undef_key_macro :: Macro,
+                           undef_key_source :: Glean.Schema.Src.Range}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Undef_key where
+  toJSON (Undef_key __field__macro __field__source)
+    = Aeson.object
+        ("macro" .= __field__macro :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct Undef_key where
+  buildStruct _proxy (Undef_key __field__macro __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__macro)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__macro <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__macro
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__macro <- ST.readSTRef __field__macro
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (Undef_key __val__macro __val__source)
+              _idMap = HashMap.fromList [("macro", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Undef_key where
+  rnf (Undef_key __field__macro __field__source)
+    = DeepSeq.rnf __field__macro `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default Undef_key where
+  def = Undef_key Default.def Default.def
+
+instance Hashable.Hashable Undef_key where
+  hashWithSalt __salt (Undef_key _macro _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _macro)
+        _source
+
+data Include_key = Include_key{include_key_file ::
+                               Glean.Schema.Src.File,
+                               include_key_source :: Glean.Schema.Src.Range,
+                               include_key_pathSpan :: Glean.Schema.Src.ByteSpan}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Include_key where
+  toJSON
+    (Include_key __field__file __field__source __field__pathSpan)
+    = Aeson.object
+        ("file" .= __field__file :
+           "source" .= __field__source :
+             "pathSpan" .= __field__pathSpan : Prelude.mempty)
+
+instance Thrift.ThriftStruct Include_key where
+  buildStruct _proxy
+    (Include_key __field__file __field__source __field__pathSpan)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "pathSpan" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__pathSpan)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__pathSpan <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__pathSpan
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__pathSpan <- ST.readSTRef __field__pathSpan
+                                             Prelude.pure
+                                               (Include_key __val__file __val__source
+                                                  __val__pathSpan)
+              _idMap
+                = HashMap.fromList [("file", 1), ("source", 2), ("pathSpan", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Include_key where
+  rnf (Include_key __field__file __field__source __field__pathSpan)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__pathSpan `Prelude.seq` ()
+
+instance Default.Default Include_key where
+  def = Include_key Default.def Default.def Default.def
+
+instance Hashable.Hashable Include_key where
+  hashWithSalt __salt (Include_key _file _source _pathSpan)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _source)
+        _pathSpan
+
+data DefineUse_key = DefineUse_key{defineUse_key_define :: Define,
+                                   defineUse_key_use :: Use}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefineUse_key where
+  toJSON (DefineUse_key __field__define __field__use)
+    = Aeson.object
+        ("define" .= __field__define :
+           "use" .= __field__use : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefineUse_key where
+  buildStruct _proxy (DefineUse_key __field__define __field__use)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "define" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__define)
+           :
+           Thrift.genField _proxy "use" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__use)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__define <- ST.newSTRef Default.def
+            __field__use <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__define
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__use
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__define <- ST.readSTRef
+                                                                 __field__define
+                                             !__val__use <- ST.readSTRef __field__use
+                                             Prelude.pure (DefineUse_key __val__define __val__use)
+              _idMap = HashMap.fromList [("define", 1), ("use", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefineUse_key where
+  rnf (DefineUse_key __field__define __field__use)
+    = DeepSeq.rnf __field__define `Prelude.seq`
+        DeepSeq.rnf __field__use `Prelude.seq` ()
+
+instance Default.Default DefineUse_key where
+  def = DefineUse_key Default.def Default.def
+
+instance Hashable.Hashable DefineUse_key where
+  hashWithSalt __salt (DefineUse_key _define _use)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _define) _use
+
+data DefineLowerCase_key = DefineLowerCase_key{defineLowerCase_key_name_lowercase
+                                               :: Text.Text,
+                                               defineLowerCase_key_decl :: Define}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefineLowerCase_key where
+  toJSON (DefineLowerCase_key __field__name_lowercase __field__decl)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefineLowerCase_key where
+  buildStruct _proxy
+    (DefineLowerCase_key __field__name_lowercase __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (DefineLowerCase_key __val__name_lowercase
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefineLowerCase_key where
+  rnf (DefineLowerCase_key __field__name_lowercase __field__decl)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default DefineLowerCase_key where
+  def = DefineLowerCase_key "" Default.def
+
+instance Hashable.Hashable DefineLowerCase_key where
+  hashWithSalt __salt (DefineLowerCase_key _name_lowercase _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _decl
+
+data Define_key = Define_key{define_key_macro :: Macro,
+                             define_key_source :: Glean.Schema.Src.Range}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Define_key where
+  toJSON (Define_key __field__macro __field__source)
+    = Aeson.object
+        ("macro" .= __field__macro :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct Define_key where
+  buildStruct _proxy (Define_key __field__macro __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__macro)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__macro <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__macro
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__macro <- ST.readSTRef __field__macro
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (Define_key __val__macro __val__source)
+              _idMap = HashMap.fromList [("macro", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Define_key where
+  rnf (Define_key __field__macro __field__source)
+    = DeepSeq.rnf __field__macro `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default Define_key where
+  def = Define_key Default.def Default.def
+
+instance Hashable.Hashable Define_key where
+  hashWithSalt __salt (Define_key _macro _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _macro)
+        _source
+{-# LINE 18 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.Macro where
+  type KeyType Glean.Schema.Pp1.Types.Macro = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "pp1.Macro" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.macro_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.Macro x k
+  getFactKey = Glean.Schema.Pp1.Types.macro_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 26 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Macro where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 32 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.DefineLowerCase_key
+         where
+  buildRtsValue b (Glean.Schema.Pp1.Types.DefineLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.DefineLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "pp1.DefineLowerCase_key" (Prelude.Just 0))
+{-# LINE 41 "glean/schema/thrift/pp1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Pp1.Types.DefineLowerCase_key =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "decl" (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+          ('Angle.TNoFields))
+{-# LINE 43 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.DefineLowerCase
+         where
+  type KeyType Glean.Schema.Pp1.Types.DefineLowerCase =
+       Glean.Schema.Pp1.Types.DefineLowerCase_key
+  getName _proxy = Glean.PredicateRef "pp1.DefineLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Pp1.Types.defineLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.DefineLowerCase x k
+  getFactKey = Glean.Schema.Pp1.Types.defineLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 52 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.DefineLowerCase where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 58 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.DefineUse_key where
+  buildRtsValue b (Glean.Schema.Pp1.Types.DefineUse_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.DefineUse_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "pp1.DefineUse_key" (Prelude.Just 0))
+{-# LINE 67 "glean/schema/thrift/pp1_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Pp1.Types.DefineUse_key =
+     'Angle.TField "define"
+       (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+       ('Angle.TField "use" (Glean.KeyType Glean.Schema.Pp1.Types.Use)
+          ('Angle.TNoFields))
+{-# LINE 69 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.DefineUse where
+  type KeyType Glean.Schema.Pp1.Types.DefineUse =
+       Glean.Schema.Pp1.Types.DefineUse_key
+  getName _proxy = Glean.PredicateRef "pp1.DefineUse" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.defineUse_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.DefineUse x k
+  getFactKey = Glean.Schema.Pp1.Types.defineUse_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 78 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.DefineUse where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 84 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Include_key where
+  buildRtsValue b (Glean.Schema.Pp1.Types.Include_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.Include_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "pp1.Include_key" (Prelude.Just 0))
+{-# LINE 95 "glean/schema/thrift/pp1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Pp1.Types.Include_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "pathSpan" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 97 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.Include where
+  type KeyType Glean.Schema.Pp1.Types.Include =
+       Glean.Schema.Pp1.Types.Include_key
+  getName _proxy = Glean.PredicateRef "pp1.Include" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.include_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.Include x k
+  getFactKey = Glean.Schema.Pp1.Types.include_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 106 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Include where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 112 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Define_key where
+  buildRtsValue b (Glean.Schema.Pp1.Types.Define_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.Define_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "pp1.Define_key" (Prelude.Just 0))
+{-# LINE 121 "glean/schema/thrift/pp1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Pp1.Types.Define_key
+     =
+     'Angle.TField "macro" (Glean.KeyType Glean.Schema.Pp1.Types.Macro)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 123 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.Define where
+  type KeyType Glean.Schema.Pp1.Types.Define =
+       Glean.Schema.Pp1.Types.Define_key
+  getName _proxy = Glean.PredicateRef "pp1.Define" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.define_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.Define x k
+  getFactKey = Glean.Schema.Pp1.Types.define_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 132 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Define where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 138 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Use_key where
+  buildRtsValue b (Glean.Schema.Pp1.Types.Use_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.Use_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "pp1.Use_key" (Prelude.Just 0))
+{-# LINE 153 "glean/schema/thrift/pp1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Pp1.Types.Use_key =
+     'Angle.TField "macro" (Glean.KeyType Glean.Schema.Pp1.Types.Macro)
+       ('Angle.TField "definition"
+          (Prelude.Maybe Glean.Schema.Src.Types.Loc)
+          ('Angle.TField "expand" (Prelude.Bool)
+             ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+                ('Angle.TField "nameSpan" (Glean.Schema.Src.Types.ByteSpan)
+                   ('Angle.TNoFields)))))
+{-# LINE 155 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.Use where
+  type KeyType Glean.Schema.Pp1.Types.Use =
+       Glean.Schema.Pp1.Types.Use_key
+  getName _proxy = Glean.PredicateRef "pp1.Use" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.use_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.Use x k
+  getFactKey = Glean.Schema.Pp1.Types.use_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 163 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Use where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 169 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Undef_key where
+  buildRtsValue b (Glean.Schema.Pp1.Types.Undef_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Pp1.Types.Undef_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "pp1.Undef_key" (Prelude.Just 0))
+{-# LINE 178 "glean/schema/thrift/pp1_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Pp1.Types.Undef_key =
+     'Angle.TField "macro" (Glean.KeyType Glean.Schema.Pp1.Types.Macro)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 180 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Pp1.Types.Undef where
+  type KeyType Glean.Schema.Pp1.Types.Undef =
+       Glean.Schema.Pp1.Types.Undef_key
+  getName _proxy = Glean.PredicateRef "pp1.Undef" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Pp1.Types.undef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Pp1.Types.Undef x k
+  getFactKey = Glean.Schema.Pp1.Types.undef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 188 "glean/schema/thrift/pp1_include.hs" #-}
+instance Glean.Type Glean.Schema.Pp1.Types.Undef where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Python/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Python/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Python/Types.hs
@@ -0,0 +1,15219 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/python_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/python_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/python_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Python/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Python.Types
+       (pREDICATE_VERSIONS, XRefsViaNameByTarget_id,
+        XRefsViaNameByTarget(XRefsViaNameByTarget, xRefsViaNameByTarget_id,
+                             xRefsViaNameByTarget_key),
+        XRefsViaNameByFile_id,
+        XRefsViaNameByFile(XRefsViaNameByFile, xRefsViaNameByFile_id,
+                           xRefsViaNameByFile_key),
+        VariableDeclaration_id,
+        VariableDeclaration(VariableDeclaration, variableDeclaration_id,
+                            variableDeclaration_key),
+        VariableBySName_id,
+        VariableBySName(VariableBySName, variableBySName_id,
+                        variableBySName_key, variableBySName_value),
+        Type_id, Type(Type, type_id, type_key), StringLiteral_id,
+        StringLiteral(StringLiteral, stringLiteral_id, stringLiteral_key),
+        SearchVariableByName_id,
+        SearchVariableByName(SearchVariableByName, searchVariableByName_id,
+                             searchVariableByName_key),
+        SearchVariableByLowerCaseName_id,
+        SearchVariableByLowerCaseName(SearchVariableByLowerCaseName,
+                                      searchVariableByLowerCaseName_id,
+                                      searchVariableByLowerCaseName_key),
+        SearchModuleByName_id,
+        SearchModuleByName(SearchModuleByName, searchModuleByName_id,
+                           searchModuleByName_key),
+        SearchModuleByLowerCaseName_id,
+        SearchModuleByLowerCaseName(SearchModuleByLowerCaseName,
+                                    searchModuleByLowerCaseName_id,
+                                    searchModuleByLowerCaseName_key),
+        SearchMethodByName_id,
+        SearchMethodByName(SearchMethodByName, searchMethodByName_id,
+                           searchMethodByName_key),
+        SearchMethodByLowerCaseName_id,
+        SearchMethodByLowerCaseName(SearchMethodByLowerCaseName,
+                                    searchMethodByLowerCaseName_id,
+                                    searchMethodByLowerCaseName_key),
+        SearchFunctionByName_id,
+        SearchFunctionByName(SearchFunctionByName, searchFunctionByName_id,
+                             searchFunctionByName_key),
+        SearchFunctionByLowerCaseName_id,
+        SearchFunctionByLowerCaseName(SearchFunctionByLowerCaseName,
+                                      searchFunctionByLowerCaseName_id,
+                                      searchFunctionByLowerCaseName_key),
+        SearchFieldByName_id,
+        SearchFieldByName(SearchFieldByName, searchFieldByName_id,
+                          searchFieldByName_key),
+        SearchFieldByLowerCaseName_id,
+        SearchFieldByLowerCaseName(SearchFieldByLowerCaseName,
+                                   searchFieldByLowerCaseName_id, searchFieldByLowerCaseName_key),
+        SearchClassByName_id,
+        SearchClassByName(SearchClassByName, searchClassByName_id,
+                          searchClassByName_key),
+        SearchClassByLowerCaseName_id,
+        SearchClassByLowerCaseName(SearchClassByLowerCaseName,
+                                   searchClassByLowerCaseName_id, searchClassByLowerCaseName_key),
+        SNameToName_id,
+        SNameToName(SNameToName, sNameToName_id, sNameToName_key,
+                    sNameToName_value),
+        SName_id, SName(SName, sName_id, sName_key),
+        ResolveOriginalName_id,
+        ResolveOriginalName(ResolveOriginalName, resolveOriginalName_id,
+                            resolveOriginalName_key),
+        NameToSName_id,
+        NameToSName(NameToSName, nameToSName_id, nameToSName_key,
+                    nameToSName_value),
+        Name_id, Name(Name, name_id, name_key), ModuleDefinition_id,
+        ModuleDefinition(ModuleDefinition, moduleDefinition_id,
+                         moduleDefinition_key),
+        ModuleBySName_id,
+        ModuleBySName(ModuleBySName, moduleBySName_id, moduleBySName_key,
+                      moduleBySName_value),
+        Module_id, Module(Module, module_id, module_key),
+        MethodOverrides_id,
+        MethodOverrides(MethodOverrides, methodOverrides_id,
+                        methodOverrides_key),
+        MethodOverriden_id,
+        MethodOverriden(MethodOverriden, methodOverriden_id,
+                        methodOverriden_key),
+        MethodByLocalNameStr_id,
+        MethodByLocalNameStr(MethodByLocalNameStr, methodByLocalNameStr_id,
+                             methodByLocalNameStr_key),
+        ImportStatementByAsSName_id,
+        ImportStatementByAsSName(ImportStatementByAsSName,
+                                 importStatementByAsSName_id, importStatementByAsSName_key),
+        ImportStatementByAsName_id,
+        ImportStatementByAsName(ImportStatementByAsName,
+                                importStatementByAsName_id, importStatementByAsName_key),
+        ImportStatement_id,
+        ImportStatement(ImportStatement, importStatement_id,
+                        importStatement_key),
+        ImportStarsByFile_id,
+        ImportStarsByFile(ImportStarsByFile, importStarsByFile_id,
+                          importStarsByFile_key),
+        ImportStarStatement_id,
+        ImportStarStatement(ImportStarStatement, importStarStatement_id,
+                            importStarStatement_key),
+        ImportStarLocation_id,
+        ImportStarLocation(ImportStarLocation, importStarLocation_id,
+                           importStarLocation_key),
+        FunctionDeclaration_id,
+        FunctionDeclaration(FunctionDeclaration, functionDeclaration_id,
+                            functionDeclaration_key),
+        FunctionBySName_id,
+        FunctionBySName(FunctionBySName, functionBySName_id,
+                        functionBySName_key, functionBySName_value),
+        DerivedClassToBase_id,
+        DerivedClassToBase(DerivedClassToBase, derivedClassToBase_id,
+                           derivedClassToBase_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        DefinitionsByFile_id,
+        DefinitionsByFile(DefinitionsByFile, definitionsByFile_id,
+                          definitionsByFile_key),
+        IsTopLevelDefinition_id,
+        IsTopLevelDefinition(IsTopLevelDefinition, isTopLevelDefinition_id,
+                             isTopLevelDefinition_key),
+        FunctionDefinition_id,
+        FunctionDefinition(FunctionDefinition, functionDefinition_id,
+                           functionDefinition_key),
+        VariableDefinition_id,
+        VariableDefinition(VariableDefinition, variableDefinition_id,
+                           variableDefinition_key),
+        DeclarationDefinition_id,
+        DeclarationDefinition(DeclarationDefinition,
+                              declarationDefinition_id, declarationDefinition_key),
+        DeclarationDocstring_id,
+        DeclarationDocstring(DeclarationDocstring, declarationDocstring_id,
+                             declarationDocstring_key),
+        DeclarationLocation_id,
+        DeclarationLocation(DeclarationLocation, declarationLocation_id,
+                            declarationLocation_key),
+        DeclarationReference_id,
+        DeclarationReference(DeclarationReference, declarationReference_id,
+                             declarationReference_key),
+        DeclarationToName_id,
+        DeclarationToName(DeclarationToName, declarationToName_id,
+                          declarationToName_key, declarationToName_value),
+        DeclarationUses_id,
+        DeclarationUses(DeclarationUses, declarationUses_id,
+                        declarationUses_key),
+        DeclarationWithLocalName_id,
+        DeclarationWithLocalName(DeclarationWithLocalName,
+                                 declarationWithLocalName_id, declarationWithLocalName_key),
+        DeclarationWithName_id,
+        DeclarationWithName(DeclarationWithName, declarationWithName_id,
+                            declarationWithName_key),
+        DeclarationWithSName_id,
+        DeclarationWithSName(DeclarationWithSName, declarationWithSName_id,
+                             declarationWithSName_key),
+        DeclarationsByFile_id,
+        DeclarationsByFile(DeclarationsByFile, declarationsByFile_id,
+                           declarationsByFile_key),
+        DefinitionDeclaration_id,
+        DefinitionDeclaration(DefinitionDeclaration,
+                              definitionDeclaration_id, definitionDeclaration_key),
+        DirectXRefsByFile_id,
+        DirectXRefsByFile(DirectXRefsByFile, directXRefsByFile_id,
+                          directXRefsByFile_key),
+        IsAbstract_id,
+        IsAbstract(IsAbstract, isAbstract_id, isAbstract_key),
+        IsTopLevelDeclaration_id,
+        IsTopLevelDeclaration(IsTopLevelDeclaration,
+                              isTopLevelDeclaration_id, isTopLevelDeclaration_key),
+        NonImportDeclaration_id,
+        NonImportDeclaration(NonImportDeclaration, nonImportDeclaration_id,
+                             nonImportDeclaration_key),
+        SNameWithDeclaration_id,
+        SNameWithDeclaration(SNameWithDeclaration, sNameWithDeclaration_id,
+                             sNameWithDeclaration_key),
+        Contains_id, Contains(Contains, contains_id, contains_key),
+        ContainingTopLevelDeclaration_id,
+        ContainingTopLevelDeclaration(ContainingTopLevelDeclaration,
+                                      containingTopLevelDeclaration_id,
+                                      containingTopLevelDeclaration_key),
+        ContainedByTopLevelDeclaration_id,
+        ContainedByTopLevelDeclaration(ContainedByTopLevelDeclaration,
+                                       containedByTopLevelDeclaration_id,
+                                       containedByTopLevelDeclaration_key),
+        ContainedBy_id,
+        ContainedBy(ContainedBy, containedBy_id, containedBy_key),
+        ClassDefinition_id,
+        ClassDefinition(ClassDefinition, classDefinition_id,
+                        classDefinition_key),
+        ClassDeclaration_id,
+        ClassDeclaration(ClassDeclaration, classDeclaration_id,
+                         classDeclaration_key),
+        ClassBySName_id,
+        ClassBySName(ClassBySName, classBySName_id, classBySName_key,
+                     classBySName_value),
+        CalleeToCaller_id,
+        CalleeToCaller(CalleeToCaller, calleeToCaller_id,
+                       calleeToCaller_key),
+        BaseClassToDerived_id,
+        BaseClassToDerived(BaseClassToDerived, baseClassToDerived_id,
+                           baseClassToDerived_key),
+        FileCall_id, FileCall(FileCall, fileCall_id, fileCall_key),
+        XRefsViaNameByTarget_key(XRefsViaNameByTarget_key,
+                                 xRefsViaNameByTarget_key_target, xRefsViaNameByTarget_key_file,
+                                 xRefsViaNameByTarget_key_spans),
+        XRefViaName(XRefViaName, xRefViaName_target, xRefViaName_source),
+        XRefsViaNameByFile_key(XRefsViaNameByFile_key,
+                               xRefsViaNameByFile_key_file, xRefsViaNameByFile_key_xrefs),
+        VariableDeclaration_key(VariableDeclaration_key,
+                                variableDeclaration_key_name),
+        VariableBySName_value,
+        TypeInfo(TypeInfo, typeInfo_displayType, typeInfo_xrefs),
+        SearchVariableByName_key(SearchVariableByName_key,
+                                 searchVariableByName_key_name, searchVariableByName_key_parent,
+                                 searchVariableByName_key_decl),
+        SearchVariableByLowerCaseName_key(SearchVariableByLowerCaseName_key,
+                                          searchVariableByLowerCaseName_key_name_lowercase,
+                                          searchVariableByLowerCaseName_key_name),
+        SearchModuleByName_key(SearchModuleByName_key,
+                               searchModuleByName_key_name, searchModuleByName_key_parent,
+                               searchModuleByName_key_decl),
+        SearchModuleByLowerCaseName_key(SearchModuleByLowerCaseName_key,
+                                        searchModuleByLowerCaseName_key_name_lowercase,
+                                        searchModuleByLowerCaseName_key_name),
+        SearchMethodByName_key(SearchMethodByName_key,
+                               searchMethodByName_key_name, searchMethodByName_key_parent,
+                               searchMethodByName_key_decl),
+        SearchMethodByLowerCaseName_key(SearchMethodByLowerCaseName_key,
+                                        searchMethodByLowerCaseName_key_name_lowercase,
+                                        searchMethodByLowerCaseName_key_name),
+        SearchFunctionByName_key(SearchFunctionByName_key,
+                                 searchFunctionByName_key_name, searchFunctionByName_key_parent,
+                                 searchFunctionByName_key_decl),
+        SearchFunctionByLowerCaseName_key(SearchFunctionByLowerCaseName_key,
+                                          searchFunctionByLowerCaseName_key_name_lowercase,
+                                          searchFunctionByLowerCaseName_key_name),
+        SearchFieldByName_key(SearchFieldByName_key,
+                              searchFieldByName_key_name, searchFieldByName_key_parent,
+                              searchFieldByName_key_decl),
+        SearchFieldByLowerCaseName_key(SearchFieldByLowerCaseName_key,
+                                       searchFieldByLowerCaseName_key_name_lowercase,
+                                       searchFieldByLowerCaseName_key_name),
+        SearchClassByName_key(SearchClassByName_key,
+                              searchClassByName_key_name, searchClassByName_key_parent,
+                              searchClassByName_key_decl),
+        SearchClassByLowerCaseName_key(SearchClassByLowerCaseName_key,
+                                       searchClassByLowerCaseName_key_name_lowercase,
+                                       searchClassByLowerCaseName_key_name),
+        SNameToName_value,
+        SName_key(SName_key, sName_key_local_name, sName_key_parent),
+        ResolveOriginalName_key(ResolveOriginalName_key,
+                                resolveOriginalName_key_name,
+                                resolveOriginalName_key_original_name),
+        Parameter(Parameter, parameter_name, parameter_typeInfo,
+                  parameter_value),
+        NameToSName_value,
+        ModuleDefinition_key(ModuleDefinition_key,
+                             moduleDefinition_key_module),
+        ModuleBySName_value, Module_key(Module_key, module_key_name),
+        MethodOverrides_key(MethodOverrides_key,
+                            methodOverrides_key_derived, methodOverrides_key_base),
+        MethodOverriden_key(MethodOverriden_key, methodOverriden_key_base,
+                            methodOverriden_key_derived),
+        MethodByLocalNameStr_key(MethodByLocalNameStr_key,
+                                 methodByLocalNameStr_key_cls,
+                                 methodByLocalNameStr_key_method_local_name,
+                                 methodByLocalNameStr_key_method),
+        ImportStatementByAsSName_key(ImportStatementByAsSName_key,
+                                     importStatementByAsSName_key_sname,
+                                     importStatementByAsSName_key_import_),
+        ImportStatementByAsName_key(ImportStatementByAsName_key,
+                                    importStatementByAsName_key_name,
+                                    importStatementByAsName_key_import_),
+        ImportStatement_key(ImportStatement_key,
+                            importStatement_key_from_name, importStatement_key_as_name),
+        ImportStarsByFile_key(ImportStarsByFile_key,
+                              importStarsByFile_key_file, importStarsByFile_key_span,
+                              importStarsByFile_key_declaration),
+        ImportStarStatement_key(ImportStarStatement_key,
+                                importStarStatement_key_from_name,
+                                importStarStatement_key_into_module),
+        ImportStarLocation_key(ImportStarLocation_key,
+                               importStarLocation_key_import_star, importStarLocation_key_file,
+                               importStarLocation_key_span),
+        FunctionDeclaration_key(FunctionDeclaration_key,
+                                functionDeclaration_key_name),
+        FunctionBySName_value,
+        DerivedClassToBase_key(DerivedClassToBase_key,
+                               derivedClassToBase_key_derived, derivedClassToBase_key_base),
+        Definition(Definition_EMPTY, Definition_cls, Definition_func,
+                   Definition_variable, Definition_module),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_definition, definitionLocation_key_file,
+                               definitionLocation_key_span),
+        DefinitionsByFile_key(DefinitionsByFile_key,
+                              definitionsByFile_key_file, definitionsByFile_key_span,
+                              definitionsByFile_key_definition),
+        Decorator,
+        DeclarationContainer(DeclarationContainer_EMPTY,
+                             DeclarationContainer_module, DeclarationContainer_cls,
+                             DeclarationContainer_func),
+        FunctionDefinition_key(FunctionDefinition_key,
+                               functionDefinition_key_declaration,
+                               functionDefinition_key_is_async,
+                               functionDefinition_key_returnsInfo, functionDefinition_key_params,
+                               functionDefinition_key_posonly_params,
+                               functionDefinition_key_kwonly_params,
+                               functionDefinition_key_star_arg, functionDefinition_key_star_kwarg,
+                               functionDefinition_key_decorators,
+                               functionDefinition_key_container),
+        VariableDefinition_key(VariableDefinition_key,
+                               variableDefinition_key_declaration,
+                               variableDefinition_key_typeInfo, variableDefinition_key_container),
+        Declaration(Declaration_EMPTY, Declaration_cls, Declaration_func,
+                    Declaration_variable, Declaration_imp, Declaration_module),
+        DeclarationDefinition_key(DeclarationDefinition_key,
+                                  declarationDefinition_key_declaration,
+                                  declarationDefinition_key_definition),
+        DeclarationDocstring_key(DeclarationDocstring_key,
+                                 declarationDocstring_key_declaration,
+                                 declarationDocstring_key_location,
+                                 declarationDocstring_key_pretty_text),
+        DeclarationLocation_key(DeclarationLocation_key,
+                                declarationLocation_key_declaration, declarationLocation_key_file,
+                                declarationLocation_key_span),
+        DeclarationReference_key(DeclarationReference_key,
+                                 declarationReference_key_target, declarationReference_key_source),
+        DeclarationToName_value,
+        DeclarationUses_key(DeclarationUses_key,
+                            declarationUses_key_declaration, declarationUses_key_file,
+                            declarationUses_key_span),
+        DeclarationWithLocalName_key(DeclarationWithLocalName_key,
+                                     declarationWithLocalName_key_local_name,
+                                     declarationWithLocalName_key_declaration),
+        DeclarationWithName_key(DeclarationWithName_key,
+                                declarationWithName_key_name, declarationWithName_key_declaration),
+        DeclarationWithSName_key(DeclarationWithSName_key,
+                                 declarationWithSName_key_sname,
+                                 declarationWithSName_key_declaration),
+        DeclarationsByFile_key(DeclarationsByFile_key,
+                               declarationsByFile_key_file, declarationsByFile_key_span,
+                               declarationsByFile_key_declaration),
+        DefinitionDeclaration_key(DefinitionDeclaration_key,
+                                  definitionDeclaration_key_definition,
+                                  definitionDeclaration_key_declaration),
+        DirectXRef(DirectXRef, directXRef_target, directXRef_source),
+        DirectXRefsByFile_key(DirectXRefsByFile_key,
+                              directXRefsByFile_key_file, directXRefsByFile_key_xref),
+        SNameWithDeclaration_key(SNameWithDeclaration_key,
+                                 sNameWithDeclaration_key_declaration,
+                                 sNameWithDeclaration_key_sname),
+        Contains_key(Contains_key, contains_key_container,
+                     contains_key_containee),
+        ContainingTopLevelDeclaration_key(ContainingTopLevelDeclaration_key,
+                                          containingTopLevelDeclaration_key_declaration,
+                                          containingTopLevelDeclaration_key_container),
+        ContainedByTopLevelDeclaration_key(ContainedByTopLevelDeclaration_key,
+                                           containedByTopLevelDeclaration_key_container,
+                                           containedByTopLevelDeclaration_key_declaration),
+        ContainedBy_key(ContainedBy_key, containedBy_key_containee,
+                        containedBy_key_container),
+        ClassDefinition_key(ClassDefinition_key,
+                            classDefinition_key_declaration, classDefinition_key_bases,
+                            classDefinition_key_keywords, classDefinition_key_decorators,
+                            classDefinition_key_container),
+        ClassDeclaration_key(ClassDeclaration_key,
+                             classDeclaration_key_name, classDeclaration_key_bases),
+        ClassBySName_value,
+        CalleeToCaller_key(CalleeToCaller_key, calleeToCaller_key_callee,
+                           calleeToCaller_key_caller),
+        BaseClassToDerived_key(BaseClassToDerived_key,
+                               baseClassToDerived_key_base, baseClassToDerived_key_derived),
+        Argument(Argument_EMPTY, Argument_lit),
+        CallArgument(CallArgument, callArgument_label, callArgument_span,
+                     callArgument_argument),
+        FileCall_key(FileCall_key, fileCall_key_file,
+                     fileCall_key_callee_span, fileCall_key_call_args))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/python_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/python_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/python_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/python_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 445 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Python/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("NonImportDeclaration", 4), ("DeclarationDefinition", 4),
+       ("DeclarationWithSName", 4), ("DeclarationWithLocalName", 4),
+       ("DefinitionDeclaration", 4), ("ClassBySName", 4),
+       ("DeclarationUses", 4), ("CalleeToCaller", 4),
+       ("ClassDefinition", 4), ("Type", 4), ("DerivedClassToBase", 4),
+       ("IsAbstract", 4), ("SNameWithDeclaration", 4),
+       ("BaseClassToDerived", 4), ("DefinitionsByFile", 4), ("Module", 4),
+       ("DeclarationReference", 4), ("ModuleDefinition", 4),
+       ("ImportStatement", 4), ("SearchMethodByName", 4),
+       ("ContainedByTopLevelDeclaration", 4), ("ModuleBySName", 4),
+       ("XRefsViaNameByFile", 4), ("ClassDeclaration", 4),
+       ("IsTopLevelDefinition", 4), ("ImportStarStatement", 4),
+       ("MethodOverrides", 4), ("SearchClassByName", 4),
+       ("MethodByLocalNameStr", 4), ("VariableDeclaration", 4),
+       ("SearchFunctionByLowerCaseName", 4), ("VariableBySName", 4),
+       ("ImportStarsByFile", 4), ("FileCall", 4),
+       ("ImportStarLocation", 4), ("SNameToName", 4),
+       ("DeclarationToName", 4), ("SearchModuleByLowerCaseName", 4),
+       ("ImportStatementByAsSName", 4), ("Contains", 4),
+       ("IsTopLevelDeclaration", 4), ("FunctionDefinition", 4),
+       ("ContainedBy", 4), ("ResolveOriginalName", 4),
+       ("MethodOverriden", 4), ("DeclarationWithName", 4),
+       ("SearchVariableByLowerCaseName", 4), ("DeclarationDocstring", 4),
+       ("StringLiteral", 4), ("ImportStatementByAsName", 4),
+       ("SearchFunctionByName", 4), ("FunctionDeclaration", 4),
+       ("ContainingTopLevelDeclaration", 4),
+       ("SearchClassByLowerCaseName", 4), ("SName", 4),
+       ("DeclarationLocation", 4), ("SearchVariableByName", 4),
+       ("VariableDefinition", 4), ("SearchFieldByName", 4),
+       ("SearchFieldByLowerCaseName", 4), ("DirectXRefsByFile", 4),
+       ("DeclarationsByFile", 4), ("NameToSName", 4),
+       ("FunctionBySName", 4), ("XRefsViaNameByTarget", 4),
+       ("SearchModuleByName", 4), ("SearchMethodByLowerCaseName", 4),
+       ("Name", 4), ("DefinitionLocation", 4)]
+
+type XRefsViaNameByTarget_id = Glean.Id
+
+data XRefsViaNameByTarget = XRefsViaNameByTarget{xRefsViaNameByTarget_id
+                                                 :: {-# UNPACK #-} !XRefsViaNameByTarget_id,
+                                                 xRefsViaNameByTarget_key ::
+                                                 Prelude.Maybe XRefsViaNameByTarget_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaNameByTarget where
+  toJSON (XRefsViaNameByTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaNameByTarget where
+  buildStruct _proxy (XRefsViaNameByTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (XRefsViaNameByTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaNameByTarget where
+  rnf (XRefsViaNameByTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefsViaNameByTarget where
+  def = XRefsViaNameByTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefsViaNameByTarget where
+  hashWithSalt __salt (XRefsViaNameByTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type XRefsViaNameByFile_id = Glean.Id
+
+data XRefsViaNameByFile = XRefsViaNameByFile{xRefsViaNameByFile_id
+                                             :: {-# UNPACK #-} !XRefsViaNameByFile_id,
+                                             xRefsViaNameByFile_key ::
+                                             Prelude.Maybe XRefsViaNameByFile_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaNameByFile where
+  toJSON (XRefsViaNameByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaNameByFile where
+  buildStruct _proxy (XRefsViaNameByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (XRefsViaNameByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaNameByFile where
+  rnf (XRefsViaNameByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default XRefsViaNameByFile where
+  def = XRefsViaNameByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable XRefsViaNameByFile where
+  hashWithSalt __salt (XRefsViaNameByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableDeclaration_id = Glean.Id
+
+data VariableDeclaration = VariableDeclaration{variableDeclaration_id
+                                               :: {-# UNPACK #-} !VariableDeclaration_id,
+                                               variableDeclaration_key ::
+                                               Prelude.Maybe VariableDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration where
+  toJSON (VariableDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration where
+  buildStruct _proxy (VariableDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration where
+  rnf (VariableDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration where
+  def = VariableDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDeclaration where
+  hashWithSalt __salt (VariableDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableBySName_id = Glean.Id
+
+data VariableBySName = VariableBySName{variableBySName_id ::
+                                       {-# UNPACK #-} !VariableBySName_id,
+                                       variableBySName_key :: Prelude.Maybe SName,
+                                       variableBySName_value :: Prelude.Maybe VariableBySName_value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableBySName where
+  toJSON (VariableBySName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct VariableBySName where
+  buildStruct _proxy
+    (VariableBySName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (VariableBySName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableBySName where
+  rnf (VariableBySName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default VariableBySName where
+  def = VariableBySName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable VariableBySName where
+  hashWithSalt __salt (VariableBySName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Type_id = Glean.Id
+
+data Type = Type{type_id :: {-# UNPACK #-} !Type_id,
+                 type_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Type __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type Default.def Prelude.Nothing
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type StringLiteral_id = Glean.Id
+
+data StringLiteral = StringLiteral{stringLiteral_id ::
+                                   {-# UNPACK #-} !StringLiteral_id,
+                                   stringLiteral_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StringLiteral where
+  toJSON (StringLiteral __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct StringLiteral where
+  buildStruct _proxy (StringLiteral __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (StringLiteral __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData StringLiteral where
+  rnf (StringLiteral __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default StringLiteral where
+  def = StringLiteral Default.def Prelude.Nothing
+
+instance Hashable.Hashable StringLiteral where
+  hashWithSalt __salt (StringLiteral _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchVariableByName_id = Glean.Id
+
+data SearchVariableByName = SearchVariableByName{searchVariableByName_id
+                                                 :: {-# UNPACK #-} !SearchVariableByName_id,
+                                                 searchVariableByName_key ::
+                                                 Prelude.Maybe SearchVariableByName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchVariableByName where
+  toJSON (SearchVariableByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchVariableByName where
+  buildStruct _proxy (SearchVariableByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchVariableByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchVariableByName where
+  rnf (SearchVariableByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchVariableByName where
+  def = SearchVariableByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchVariableByName where
+  hashWithSalt __salt (SearchVariableByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchVariableByLowerCaseName_id = Glean.Id
+
+data SearchVariableByLowerCaseName = SearchVariableByLowerCaseName{searchVariableByLowerCaseName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchVariableByLowerCaseName_id,
+                                                                   searchVariableByLowerCaseName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchVariableByLowerCaseName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchVariableByLowerCaseName where
+  toJSON (SearchVariableByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchVariableByLowerCaseName where
+  buildStruct _proxy
+    (SearchVariableByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchVariableByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchVariableByLowerCaseName where
+  rnf (SearchVariableByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchVariableByLowerCaseName where
+  def = SearchVariableByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchVariableByLowerCaseName where
+  hashWithSalt __salt (SearchVariableByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModuleByName_id = Glean.Id
+
+data SearchModuleByName = SearchModuleByName{searchModuleByName_id
+                                             :: {-# UNPACK #-} !SearchModuleByName_id,
+                                             searchModuleByName_key ::
+                                             Prelude.Maybe SearchModuleByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByName where
+  toJSON (SearchModuleByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByName where
+  buildStruct _proxy (SearchModuleByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchModuleByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByName where
+  rnf (SearchModuleByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModuleByName where
+  def = SearchModuleByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModuleByName where
+  hashWithSalt __salt (SearchModuleByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModuleByLowerCaseName_id = Glean.Id
+
+data SearchModuleByLowerCaseName = SearchModuleByLowerCaseName{searchModuleByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchModuleByLowerCaseName_id,
+                                                               searchModuleByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchModuleByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName where
+  toJSON (SearchModuleByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName where
+  rnf (SearchModuleByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName where
+  def = SearchModuleByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModuleByLowerCaseName where
+  hashWithSalt __salt (SearchModuleByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMethodByName_id = Glean.Id
+
+data SearchMethodByName = SearchMethodByName{searchMethodByName_id
+                                             :: {-# UNPACK #-} !SearchMethodByName_id,
+                                             searchMethodByName_key ::
+                                             Prelude.Maybe SearchMethodByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByName where
+  toJSON (SearchMethodByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByName where
+  buildStruct _proxy (SearchMethodByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchMethodByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByName where
+  rnf (SearchMethodByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMethodByName where
+  def = SearchMethodByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchMethodByName where
+  hashWithSalt __salt (SearchMethodByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchMethodByLowerCaseName_id = Glean.Id
+
+data SearchMethodByLowerCaseName = SearchMethodByLowerCaseName{searchMethodByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchMethodByLowerCaseName_id,
+                                                               searchMethodByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 SearchMethodByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByLowerCaseName where
+  toJSON (SearchMethodByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByLowerCaseName where
+  buildStruct _proxy
+    (SearchMethodByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchMethodByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByLowerCaseName where
+  rnf (SearchMethodByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchMethodByLowerCaseName where
+  def = SearchMethodByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchMethodByLowerCaseName where
+  hashWithSalt __salt (SearchMethodByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFunctionByName_id = Glean.Id
+
+data SearchFunctionByName = SearchFunctionByName{searchFunctionByName_id
+                                                 :: {-# UNPACK #-} !SearchFunctionByName_id,
+                                                 searchFunctionByName_key ::
+                                                 Prelude.Maybe SearchFunctionByName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByName where
+  toJSON (SearchFunctionByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByName where
+  buildStruct _proxy (SearchFunctionByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFunctionByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByName where
+  rnf (SearchFunctionByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByName where
+  def = SearchFunctionByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFunctionByName where
+  hashWithSalt __salt (SearchFunctionByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFunctionByLowerCaseName_id = Glean.Id
+
+data SearchFunctionByLowerCaseName = SearchFunctionByLowerCaseName{searchFunctionByLowerCaseName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchFunctionByLowerCaseName_id,
+                                                                   searchFunctionByLowerCaseName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchFunctionByLowerCaseName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByLowerCaseName where
+  toJSON (SearchFunctionByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByLowerCaseName where
+  buildStruct _proxy
+    (SearchFunctionByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFunctionByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByLowerCaseName where
+  rnf (SearchFunctionByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByLowerCaseName where
+  def = SearchFunctionByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFunctionByLowerCaseName where
+  hashWithSalt __salt (SearchFunctionByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFieldByName_id = Glean.Id
+
+data SearchFieldByName = SearchFieldByName{searchFieldByName_id ::
+                                           {-# UNPACK #-} !SearchFieldByName_id,
+                                           searchFieldByName_key ::
+                                           Prelude.Maybe SearchFieldByName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFieldByName where
+  toJSON (SearchFieldByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFieldByName where
+  buildStruct _proxy (SearchFieldByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchFieldByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFieldByName where
+  rnf (SearchFieldByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFieldByName where
+  def = SearchFieldByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFieldByName where
+  hashWithSalt __salt (SearchFieldByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFieldByLowerCaseName_id = Glean.Id
+
+data SearchFieldByLowerCaseName = SearchFieldByLowerCaseName{searchFieldByLowerCaseName_id
+                                                             ::
+                                                             {-# UNPACK #-} !SearchFieldByLowerCaseName_id,
+                                                             searchFieldByLowerCaseName_key ::
+                                                             Prelude.Maybe
+                                                               SearchFieldByLowerCaseName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFieldByLowerCaseName where
+  toJSON (SearchFieldByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFieldByLowerCaseName where
+  buildStruct _proxy
+    (SearchFieldByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFieldByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFieldByLowerCaseName where
+  rnf (SearchFieldByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFieldByLowerCaseName where
+  def = SearchFieldByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFieldByLowerCaseName where
+  hashWithSalt __salt (SearchFieldByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassByName_id = Glean.Id
+
+data SearchClassByName = SearchClassByName{searchClassByName_id ::
+                                           {-# UNPACK #-} !SearchClassByName_id,
+                                           searchClassByName_key ::
+                                           Prelude.Maybe SearchClassByName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByName where
+  toJSON (SearchClassByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByName where
+  buildStruct _proxy (SearchClassByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchClassByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByName where
+  rnf (SearchClassByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassByName where
+  def = SearchClassByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassByName where
+  hashWithSalt __salt (SearchClassByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchClassByLowerCaseName_id = Glean.Id
+
+data SearchClassByLowerCaseName = SearchClassByLowerCaseName{searchClassByLowerCaseName_id
+                                                             ::
+                                                             {-# UNPACK #-} !SearchClassByLowerCaseName_id,
+                                                             searchClassByLowerCaseName_key ::
+                                                             Prelude.Maybe
+                                                               SearchClassByLowerCaseName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByLowerCaseName where
+  toJSON (SearchClassByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByLowerCaseName where
+  buildStruct _proxy
+    (SearchClassByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchClassByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByLowerCaseName where
+  rnf (SearchClassByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchClassByLowerCaseName where
+  def = SearchClassByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchClassByLowerCaseName where
+  hashWithSalt __salt (SearchClassByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SNameToName_id = Glean.Id
+
+data SNameToName = SNameToName{sNameToName_id ::
+                               {-# UNPACK #-} !SNameToName_id,
+                               sNameToName_key :: Prelude.Maybe SName,
+                               sNameToName_value :: Prelude.Maybe SNameToName_value}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SNameToName where
+  toJSON (SNameToName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct SNameToName where
+  buildStruct _proxy
+    (SNameToName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (SNameToName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SNameToName where
+  rnf (SNameToName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default SNameToName where
+  def = SNameToName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable SNameToName where
+  hashWithSalt __salt (SNameToName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type SName_id = Glean.Id
+
+data SName = SName{sName_id :: {-# UNPACK #-} !SName_id,
+                   sName_key :: Prelude.Maybe SName_key}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SName where
+  toJSON (SName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SName where
+  buildStruct _proxy (SName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SName where
+  rnf (SName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SName where
+  def = SName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SName where
+  hashWithSalt __salt (SName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ResolveOriginalName_id = Glean.Id
+
+data ResolveOriginalName = ResolveOriginalName{resolveOriginalName_id
+                                               :: {-# UNPACK #-} !ResolveOriginalName_id,
+                                               resolveOriginalName_key ::
+                                               Prelude.Maybe ResolveOriginalName_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveOriginalName where
+  toJSON (ResolveOriginalName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveOriginalName where
+  buildStruct _proxy (ResolveOriginalName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ResolveOriginalName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveOriginalName where
+  rnf (ResolveOriginalName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ResolveOriginalName where
+  def = ResolveOriginalName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ResolveOriginalName where
+  hashWithSalt __salt (ResolveOriginalName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameToSName_id = Glean.Id
+
+data NameToSName = NameToSName{nameToSName_id ::
+                               {-# UNPACK #-} !NameToSName_id,
+                               nameToSName_key :: Prelude.Maybe Name,
+                               nameToSName_value :: Prelude.Maybe NameToSName_value}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameToSName where
+  toJSON (NameToSName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct NameToSName where
+  buildStruct _proxy
+    (NameToSName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (NameToSName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData NameToSName where
+  rnf (NameToSName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default NameToSName where
+  def = NameToSName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable NameToSName where
+  hashWithSalt __salt (NameToSName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Name_id = Glean.Id
+
+data Name = Name{name_id :: {-# UNPACK #-} !Name_id,
+                 name_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Name __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name Default.def Prelude.Nothing
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleDefinition_id = Glean.Id
+
+data ModuleDefinition = ModuleDefinition{moduleDefinition_id ::
+                                         {-# UNPACK #-} !ModuleDefinition_id,
+                                         moduleDefinition_key :: Prelude.Maybe ModuleDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDefinition where
+  toJSON (ModuleDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDefinition where
+  buildStruct _proxy (ModuleDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ModuleDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDefinition where
+  rnf (ModuleDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ModuleDefinition where
+  def = ModuleDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ModuleDefinition where
+  hashWithSalt __salt (ModuleDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ModuleBySName_id = Glean.Id
+
+data ModuleBySName = ModuleBySName{moduleBySName_id ::
+                                   {-# UNPACK #-} !ModuleBySName_id,
+                                   moduleBySName_key :: Prelude.Maybe SName,
+                                   moduleBySName_value :: Prelude.Maybe ModuleBySName_value}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleBySName where
+  toJSON (ModuleBySName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct ModuleBySName where
+  buildStruct _proxy
+    (ModuleBySName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (ModuleBySName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleBySName where
+  rnf (ModuleBySName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default ModuleBySName where
+  def = ModuleBySName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ModuleBySName where
+  hashWithSalt __salt (ModuleBySName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type Module_id = Glean.Id
+
+data Module = Module{module_id :: {-# UNPACK #-} !Module_id,
+                     module_key :: Prelude.Maybe Module_key}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module where
+  toJSON (Module __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Module where
+  buildStruct _proxy (Module __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Module __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Module where
+  rnf (Module __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Module where
+  def = Module Default.def Prelude.Nothing
+
+instance Hashable.Hashable Module where
+  hashWithSalt __salt (Module _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverrides_id = Glean.Id
+
+data MethodOverrides = MethodOverrides{methodOverrides_id ::
+                                       {-# UNPACK #-} !MethodOverrides_id,
+                                       methodOverrides_key :: Prelude.Maybe MethodOverrides_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides where
+  toJSON (MethodOverrides __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides where
+  buildStruct _proxy (MethodOverrides __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverrides __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides where
+  rnf (MethodOverrides __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverrides where
+  def = MethodOverrides Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverrides where
+  hashWithSalt __salt (MethodOverrides _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodOverriden_id = Glean.Id
+
+data MethodOverriden = MethodOverriden{methodOverriden_id ::
+                                       {-# UNPACK #-} !MethodOverriden_id,
+                                       methodOverriden_key :: Prelude.Maybe MethodOverriden_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverriden where
+  toJSON (MethodOverriden __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverriden where
+  buildStruct _proxy (MethodOverriden __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (MethodOverriden __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverriden where
+  rnf (MethodOverriden __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodOverriden where
+  def = MethodOverriden Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodOverriden where
+  hashWithSalt __salt (MethodOverriden _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type MethodByLocalNameStr_id = Glean.Id
+
+data MethodByLocalNameStr = MethodByLocalNameStr{methodByLocalNameStr_id
+                                                 :: {-# UNPACK #-} !MethodByLocalNameStr_id,
+                                                 methodByLocalNameStr_key ::
+                                                 Prelude.Maybe MethodByLocalNameStr_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodByLocalNameStr where
+  toJSON (MethodByLocalNameStr __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodByLocalNameStr where
+  buildStruct _proxy (MethodByLocalNameStr __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (MethodByLocalNameStr __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodByLocalNameStr where
+  rnf (MethodByLocalNameStr __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default MethodByLocalNameStr where
+  def = MethodByLocalNameStr Default.def Prelude.Nothing
+
+instance Hashable.Hashable MethodByLocalNameStr where
+  hashWithSalt __salt (MethodByLocalNameStr _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStatementByAsSName_id = Glean.Id
+
+data ImportStatementByAsSName = ImportStatementByAsSName{importStatementByAsSName_id
+                                                         ::
+                                                         {-# UNPACK #-} !ImportStatementByAsSName_id,
+                                                         importStatementByAsSName_key ::
+                                                         Prelude.Maybe ImportStatementByAsSName_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatementByAsSName where
+  toJSON (ImportStatementByAsSName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatementByAsSName where
+  buildStruct _proxy
+    (ImportStatementByAsSName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ImportStatementByAsSName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatementByAsSName where
+  rnf (ImportStatementByAsSName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStatementByAsSName where
+  def = ImportStatementByAsSName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStatementByAsSName where
+  hashWithSalt __salt (ImportStatementByAsSName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStatementByAsName_id = Glean.Id
+
+data ImportStatementByAsName = ImportStatementByAsName{importStatementByAsName_id
+                                                       ::
+                                                       {-# UNPACK #-} !ImportStatementByAsName_id,
+                                                       importStatementByAsName_key ::
+                                                       Prelude.Maybe ImportStatementByAsName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatementByAsName where
+  toJSON (ImportStatementByAsName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatementByAsName where
+  buildStruct _proxy
+    (ImportStatementByAsName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ImportStatementByAsName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatementByAsName where
+  rnf (ImportStatementByAsName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStatementByAsName where
+  def = ImportStatementByAsName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStatementByAsName where
+  hashWithSalt __salt (ImportStatementByAsName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStatement_id = Glean.Id
+
+data ImportStatement = ImportStatement{importStatement_id ::
+                                       {-# UNPACK #-} !ImportStatement_id,
+                                       importStatement_key :: Prelude.Maybe ImportStatement_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatement where
+  toJSON (ImportStatement __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatement where
+  buildStruct _proxy (ImportStatement __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportStatement __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatement where
+  rnf (ImportStatement __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStatement where
+  def = ImportStatement Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStatement where
+  hashWithSalt __salt (ImportStatement _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStarsByFile_id = Glean.Id
+
+data ImportStarsByFile = ImportStarsByFile{importStarsByFile_id ::
+                                           {-# UNPACK #-} !ImportStarsByFile_id,
+                                           importStarsByFile_key ::
+                                           Prelude.Maybe ImportStarsByFile_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarsByFile where
+  toJSON (ImportStarsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarsByFile where
+  buildStruct _proxy (ImportStarsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportStarsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarsByFile where
+  rnf (ImportStarsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStarsByFile where
+  def = ImportStarsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStarsByFile where
+  hashWithSalt __salt (ImportStarsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStarStatement_id = Glean.Id
+
+data ImportStarStatement = ImportStarStatement{importStarStatement_id
+                                               :: {-# UNPACK #-} !ImportStarStatement_id,
+                                               importStarStatement_key ::
+                                               Prelude.Maybe ImportStarStatement_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarStatement where
+  toJSON (ImportStarStatement __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarStatement where
+  buildStruct _proxy (ImportStarStatement __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportStarStatement __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarStatement where
+  rnf (ImportStarStatement __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStarStatement where
+  def = ImportStarStatement Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStarStatement where
+  hashWithSalt __salt (ImportStarStatement _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ImportStarLocation_id = Glean.Id
+
+data ImportStarLocation = ImportStarLocation{importStarLocation_id
+                                             :: {-# UNPACK #-} !ImportStarLocation_id,
+                                             importStarLocation_key ::
+                                             Prelude.Maybe ImportStarLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarLocation where
+  toJSON (ImportStarLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarLocation where
+  buildStruct _proxy (ImportStarLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ImportStarLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarLocation where
+  rnf (ImportStarLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ImportStarLocation where
+  def = ImportStarLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ImportStarLocation where
+  hashWithSalt __salt (ImportStarLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDeclaration_id = Glean.Id
+
+data FunctionDeclaration = FunctionDeclaration{functionDeclaration_id
+                                               :: {-# UNPACK #-} !FunctionDeclaration_id,
+                                               functionDeclaration_key ::
+                                               Prelude.Maybe FunctionDeclaration_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration where
+  toJSON (FunctionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration where
+  buildStruct _proxy (FunctionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration where
+  rnf (FunctionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration where
+  def = FunctionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDeclaration where
+  hashWithSalt __salt (FunctionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionBySName_id = Glean.Id
+
+data FunctionBySName = FunctionBySName{functionBySName_id ::
+                                       {-# UNPACK #-} !FunctionBySName_id,
+                                       functionBySName_key :: Prelude.Maybe SName,
+                                       functionBySName_value :: Prelude.Maybe FunctionBySName_value}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionBySName where
+  toJSON (FunctionBySName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct FunctionBySName where
+  buildStruct _proxy
+    (FunctionBySName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (FunctionBySName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionBySName where
+  rnf (FunctionBySName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default FunctionBySName where
+  def = FunctionBySName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable FunctionBySName where
+  hashWithSalt __salt (FunctionBySName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DerivedClassToBase_id = Glean.Id
+
+data DerivedClassToBase = DerivedClassToBase{derivedClassToBase_id
+                                             :: {-# UNPACK #-} !DerivedClassToBase_id,
+                                             derivedClassToBase_key ::
+                                             Prelude.Maybe DerivedClassToBase_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedClassToBase where
+  toJSON (DerivedClassToBase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedClassToBase where
+  buildStruct _proxy (DerivedClassToBase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DerivedClassToBase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedClassToBase where
+  rnf (DerivedClassToBase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DerivedClassToBase where
+  def = DerivedClassToBase Default.def Prelude.Nothing
+
+instance Hashable.Hashable DerivedClassToBase where
+  hashWithSalt __salt (DerivedClassToBase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionsByFile_id = Glean.Id
+
+data DefinitionsByFile = DefinitionsByFile{definitionsByFile_id ::
+                                           {-# UNPACK #-} !DefinitionsByFile_id,
+                                           definitionsByFile_key ::
+                                           Prelude.Maybe DefinitionsByFile_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionsByFile where
+  toJSON (DefinitionsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionsByFile where
+  buildStruct _proxy (DefinitionsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionsByFile where
+  rnf (DefinitionsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionsByFile where
+  def = DefinitionsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionsByFile where
+  hashWithSalt __salt (DefinitionsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsTopLevelDefinition_id = Glean.Id
+
+data IsTopLevelDefinition = IsTopLevelDefinition{isTopLevelDefinition_id
+                                                 :: {-# UNPACK #-} !IsTopLevelDefinition_id,
+                                                 isTopLevelDefinition_key ::
+                                                 Prelude.Maybe Definition}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsTopLevelDefinition where
+  toJSON (IsTopLevelDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsTopLevelDefinition where
+  buildStruct _proxy (IsTopLevelDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (IsTopLevelDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsTopLevelDefinition where
+  rnf (IsTopLevelDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsTopLevelDefinition where
+  def = IsTopLevelDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsTopLevelDefinition where
+  hashWithSalt __salt (IsTopLevelDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FunctionDefinition_id = Glean.Id
+
+data FunctionDefinition = FunctionDefinition{functionDefinition_id
+                                             :: {-# UNPACK #-} !FunctionDefinition_id,
+                                             functionDefinition_key ::
+                                             Prelude.Maybe FunctionDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition where
+  toJSON (FunctionDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDefinition where
+  buildStruct _proxy (FunctionDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FunctionDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition where
+  rnf (FunctionDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition where
+  def = FunctionDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable FunctionDefinition where
+  hashWithSalt __salt (FunctionDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type VariableDefinition_id = Glean.Id
+
+data VariableDefinition = VariableDefinition{variableDefinition_id
+                                             :: {-# UNPACK #-} !VariableDefinition_id,
+                                             variableDefinition_key ::
+                                             Prelude.Maybe VariableDefinition_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDefinition where
+  toJSON (VariableDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDefinition where
+  buildStruct _proxy (VariableDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (VariableDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDefinition where
+  rnf (VariableDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default VariableDefinition where
+  def = VariableDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable VariableDefinition where
+  hashWithSalt __salt (VariableDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationDefinition_id = Glean.Id
+
+data DeclarationDefinition = DeclarationDefinition{declarationDefinition_id
+                                                   :: {-# UNPACK #-} !DeclarationDefinition_id,
+                                                   declarationDefinition_key ::
+                                                   Prelude.Maybe DeclarationDefinition_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationDefinition where
+  toJSON (DeclarationDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationDefinition where
+  buildStruct _proxy (DeclarationDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationDefinition where
+  rnf (DeclarationDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationDefinition where
+  def = DeclarationDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationDefinition where
+  hashWithSalt __salt (DeclarationDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationDocstring_id = Glean.Id
+
+data DeclarationDocstring = DeclarationDocstring{declarationDocstring_id
+                                                 :: {-# UNPACK #-} !DeclarationDocstring_id,
+                                                 declarationDocstring_key ::
+                                                 Prelude.Maybe DeclarationDocstring_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationDocstring where
+  toJSON (DeclarationDocstring __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationDocstring where
+  buildStruct _proxy (DeclarationDocstring __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationDocstring __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationDocstring where
+  rnf (DeclarationDocstring __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationDocstring where
+  def = DeclarationDocstring Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationDocstring where
+  hashWithSalt __salt (DeclarationDocstring _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationLocation_id = Glean.Id
+
+data DeclarationLocation = DeclarationLocation{declarationLocation_id
+                                               :: {-# UNPACK #-} !DeclarationLocation_id,
+                                               declarationLocation_key ::
+                                               Prelude.Maybe DeclarationLocation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation where
+  toJSON (DeclarationLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation where
+  buildStruct _proxy (DeclarationLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation where
+  rnf (DeclarationLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation where
+  def = DeclarationLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationLocation where
+  hashWithSalt __salt (DeclarationLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationReference_id = Glean.Id
+
+data DeclarationReference = DeclarationReference{declarationReference_id
+                                                 :: {-# UNPACK #-} !DeclarationReference_id,
+                                                 declarationReference_key ::
+                                                 Prelude.Maybe DeclarationReference_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationReference where
+  toJSON (DeclarationReference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationReference where
+  buildStruct _proxy (DeclarationReference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationReference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationReference where
+  rnf (DeclarationReference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationReference where
+  def = DeclarationReference Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationReference where
+  hashWithSalt __salt (DeclarationReference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationToName_id = Glean.Id
+
+data DeclarationToName = DeclarationToName{declarationToName_id ::
+                                           {-# UNPACK #-} !DeclarationToName_id,
+                                           declarationToName_key :: Prelude.Maybe Declaration,
+                                           declarationToName_value ::
+                                           Prelude.Maybe DeclarationToName_value}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationToName where
+  toJSON (DeclarationToName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct DeclarationToName where
+  buildStruct _proxy
+    (DeclarationToName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (DeclarationToName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationToName where
+  rnf (DeclarationToName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default DeclarationToName where
+  def = DeclarationToName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable DeclarationToName where
+  hashWithSalt __salt (DeclarationToName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type DeclarationUses_id = Glean.Id
+
+data DeclarationUses = DeclarationUses{declarationUses_id ::
+                                       {-# UNPACK #-} !DeclarationUses_id,
+                                       declarationUses_key :: Prelude.Maybe DeclarationUses_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses where
+  toJSON (DeclarationUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses where
+  buildStruct _proxy (DeclarationUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses where
+  rnf (DeclarationUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationUses where
+  def = DeclarationUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationUses where
+  hashWithSalt __salt (DeclarationUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationWithLocalName_id = Glean.Id
+
+data DeclarationWithLocalName = DeclarationWithLocalName{declarationWithLocalName_id
+                                                         ::
+                                                         {-# UNPACK #-} !DeclarationWithLocalName_id,
+                                                         declarationWithLocalName_key ::
+                                                         Prelude.Maybe DeclarationWithLocalName_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithLocalName where
+  toJSON (DeclarationWithLocalName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithLocalName where
+  buildStruct _proxy
+    (DeclarationWithLocalName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationWithLocalName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithLocalName where
+  rnf (DeclarationWithLocalName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationWithLocalName where
+  def = DeclarationWithLocalName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationWithLocalName where
+  hashWithSalt __salt (DeclarationWithLocalName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationWithName_id = Glean.Id
+
+data DeclarationWithName = DeclarationWithName{declarationWithName_id
+                                               :: {-# UNPACK #-} !DeclarationWithName_id,
+                                               declarationWithName_key ::
+                                               Prelude.Maybe DeclarationWithName_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithName where
+  toJSON (DeclarationWithName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithName where
+  buildStruct _proxy (DeclarationWithName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationWithName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithName where
+  rnf (DeclarationWithName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationWithName where
+  def = DeclarationWithName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationWithName where
+  hashWithSalt __salt (DeclarationWithName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationWithSName_id = Glean.Id
+
+data DeclarationWithSName = DeclarationWithSName{declarationWithSName_id
+                                                 :: {-# UNPACK #-} !DeclarationWithSName_id,
+                                                 declarationWithSName_key ::
+                                                 Prelude.Maybe DeclarationWithSName_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithSName where
+  toJSON (DeclarationWithSName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithSName where
+  buildStruct _proxy (DeclarationWithSName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DeclarationWithSName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithSName where
+  rnf (DeclarationWithSName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationWithSName where
+  def = DeclarationWithSName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationWithSName where
+  hashWithSalt __salt (DeclarationWithSName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclarationsByFile_id = Glean.Id
+
+data DeclarationsByFile = DeclarationsByFile{declarationsByFile_id
+                                             :: {-# UNPACK #-} !DeclarationsByFile_id,
+                                             declarationsByFile_key ::
+                                             Prelude.Maybe DeclarationsByFile_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationsByFile where
+  toJSON (DeclarationsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationsByFile where
+  buildStruct _proxy (DeclarationsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclarationsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationsByFile where
+  rnf (DeclarationsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclarationsByFile where
+  def = DeclarationsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclarationsByFile where
+  hashWithSalt __salt (DeclarationsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionDeclaration_id = Glean.Id
+
+data DefinitionDeclaration = DefinitionDeclaration{definitionDeclaration_id
+                                                   :: {-# UNPACK #-} !DefinitionDeclaration_id,
+                                                   definitionDeclaration_key ::
+                                                   Prelude.Maybe DefinitionDeclaration_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionDeclaration where
+  toJSON (DefinitionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionDeclaration where
+  buildStruct _proxy (DefinitionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DefinitionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionDeclaration where
+  rnf (DefinitionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionDeclaration where
+  def = DefinitionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionDeclaration where
+  hashWithSalt __salt (DefinitionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DirectXRefsByFile_id = Glean.Id
+
+data DirectXRefsByFile = DirectXRefsByFile{directXRefsByFile_id ::
+                                           {-# UNPACK #-} !DirectXRefsByFile_id,
+                                           directXRefsByFile_key ::
+                                           Prelude.Maybe DirectXRefsByFile_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectXRefsByFile where
+  toJSON (DirectXRefsByFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DirectXRefsByFile where
+  buildStruct _proxy (DirectXRefsByFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DirectXRefsByFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DirectXRefsByFile where
+  rnf (DirectXRefsByFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DirectXRefsByFile where
+  def = DirectXRefsByFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable DirectXRefsByFile where
+  hashWithSalt __salt (DirectXRefsByFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsAbstract_id = Glean.Id
+
+data IsAbstract = IsAbstract{isAbstract_id ::
+                             {-# UNPACK #-} !IsAbstract_id,
+                             isAbstract_key :: Prelude.Maybe Declaration}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsAbstract where
+  toJSON (IsAbstract __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsAbstract where
+  buildStruct _proxy (IsAbstract __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsAbstract __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsAbstract where
+  rnf (IsAbstract __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsAbstract where
+  def = IsAbstract Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsAbstract where
+  hashWithSalt __salt (IsAbstract _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsTopLevelDeclaration_id = Glean.Id
+
+data IsTopLevelDeclaration = IsTopLevelDeclaration{isTopLevelDeclaration_id
+                                                   :: {-# UNPACK #-} !IsTopLevelDeclaration_id,
+                                                   isTopLevelDeclaration_key ::
+                                                   Prelude.Maybe Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsTopLevelDeclaration where
+  toJSON (IsTopLevelDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsTopLevelDeclaration where
+  buildStruct _proxy (IsTopLevelDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (IsTopLevelDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsTopLevelDeclaration where
+  rnf (IsTopLevelDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsTopLevelDeclaration where
+  def = IsTopLevelDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsTopLevelDeclaration where
+  hashWithSalt __salt (IsTopLevelDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NonImportDeclaration_id = Glean.Id
+
+data NonImportDeclaration = NonImportDeclaration{nonImportDeclaration_id
+                                                 :: {-# UNPACK #-} !NonImportDeclaration_id,
+                                                 nonImportDeclaration_key ::
+                                                 Prelude.Maybe Declaration}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NonImportDeclaration where
+  toJSON (NonImportDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NonImportDeclaration where
+  buildStruct _proxy (NonImportDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (NonImportDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NonImportDeclaration where
+  rnf (NonImportDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NonImportDeclaration where
+  def = NonImportDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable NonImportDeclaration where
+  hashWithSalt __salt (NonImportDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SNameWithDeclaration_id = Glean.Id
+
+data SNameWithDeclaration = SNameWithDeclaration{sNameWithDeclaration_id
+                                                 :: {-# UNPACK #-} !SNameWithDeclaration_id,
+                                                 sNameWithDeclaration_key ::
+                                                 Prelude.Maybe SNameWithDeclaration_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SNameWithDeclaration where
+  toJSON (SNameWithDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SNameWithDeclaration where
+  buildStruct _proxy (SNameWithDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SNameWithDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SNameWithDeclaration where
+  rnf (SNameWithDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SNameWithDeclaration where
+  def = SNameWithDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable SNameWithDeclaration where
+  hashWithSalt __salt (SNameWithDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Contains_id = Glean.Id
+
+data Contains = Contains{contains_id ::
+                         {-# UNPACK #-} !Contains_id,
+                         contains_key :: Prelude.Maybe Contains_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Contains where
+  toJSON (Contains __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Contains where
+  buildStruct _proxy (Contains __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Contains __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Contains where
+  rnf (Contains __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Contains where
+  def = Contains Default.def Prelude.Nothing
+
+instance Hashable.Hashable Contains where
+  hashWithSalt __salt (Contains _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainingTopLevelDeclaration_id = Glean.Id
+
+data ContainingTopLevelDeclaration = ContainingTopLevelDeclaration{containingTopLevelDeclaration_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !ContainingTopLevelDeclaration_id,
+                                                                   containingTopLevelDeclaration_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     ContainingTopLevelDeclaration_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainingTopLevelDeclaration where
+  toJSON (ContainingTopLevelDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainingTopLevelDeclaration where
+  buildStruct _proxy
+    (ContainingTopLevelDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ContainingTopLevelDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainingTopLevelDeclaration where
+  rnf (ContainingTopLevelDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainingTopLevelDeclaration where
+  def = ContainingTopLevelDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainingTopLevelDeclaration where
+  hashWithSalt __salt (ContainingTopLevelDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainedByTopLevelDeclaration_id = Glean.Id
+
+data ContainedByTopLevelDeclaration = ContainedByTopLevelDeclaration{containedByTopLevelDeclaration_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !ContainedByTopLevelDeclaration_id,
+                                                                     containedByTopLevelDeclaration_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       ContainedByTopLevelDeclaration_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainedByTopLevelDeclaration where
+  toJSON (ContainedByTopLevelDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainedByTopLevelDeclaration where
+  buildStruct _proxy
+    (ContainedByTopLevelDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ContainedByTopLevelDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainedByTopLevelDeclaration where
+  rnf (ContainedByTopLevelDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainedByTopLevelDeclaration where
+  def = ContainedByTopLevelDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainedByTopLevelDeclaration where
+  hashWithSalt __salt (ContainedByTopLevelDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ContainedBy_id = Glean.Id
+
+data ContainedBy = ContainedBy{containedBy_id ::
+                               {-# UNPACK #-} !ContainedBy_id,
+                               containedBy_key :: Prelude.Maybe ContainedBy_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainedBy where
+  toJSON (ContainedBy __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainedBy where
+  buildStruct _proxy (ContainedBy __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ContainedBy __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainedBy where
+  rnf (ContainedBy __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ContainedBy where
+  def = ContainedBy Default.def Prelude.Nothing
+
+instance Hashable.Hashable ContainedBy where
+  hashWithSalt __salt (ContainedBy _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDefinition_id = Glean.Id
+
+data ClassDefinition = ClassDefinition{classDefinition_id ::
+                                       {-# UNPACK #-} !ClassDefinition_id,
+                                       classDefinition_key :: Prelude.Maybe ClassDefinition_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDefinition where
+  toJSON (ClassDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDefinition where
+  buildStruct _proxy (ClassDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDefinition where
+  rnf (ClassDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDefinition where
+  def = ClassDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDefinition where
+  hashWithSalt __salt (ClassDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassDeclaration_id = Glean.Id
+
+data ClassDeclaration = ClassDeclaration{classDeclaration_id ::
+                                         {-# UNPACK #-} !ClassDeclaration_id,
+                                         classDeclaration_key :: Prelude.Maybe ClassDeclaration_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration where
+  toJSON (ClassDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration where
+  buildStruct _proxy (ClassDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ClassDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration where
+  rnf (ClassDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration where
+  def = ClassDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDeclaration where
+  hashWithSalt __salt (ClassDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ClassBySName_id = Glean.Id
+
+data ClassBySName = ClassBySName{classBySName_id ::
+                                 {-# UNPACK #-} !ClassBySName_id,
+                                 classBySName_key :: Prelude.Maybe SName,
+                                 classBySName_value :: Prelude.Maybe ClassBySName_value}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassBySName where
+  toJSON (ClassBySName __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct ClassBySName where
+  buildStruct _proxy
+    (ClassBySName __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (ClassBySName __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassBySName where
+  rnf (ClassBySName __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default ClassBySName where
+  def = ClassBySName Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable ClassBySName where
+  hashWithSalt __salt (ClassBySName _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type CalleeToCaller_id = Glean.Id
+
+data CalleeToCaller = CalleeToCaller{calleeToCaller_id ::
+                                     {-# UNPACK #-} !CalleeToCaller_id,
+                                     calleeToCaller_key :: Prelude.Maybe CalleeToCaller_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CalleeToCaller where
+  toJSON (CalleeToCaller __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CalleeToCaller where
+  buildStruct _proxy (CalleeToCaller __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CalleeToCaller __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CalleeToCaller where
+  rnf (CalleeToCaller __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CalleeToCaller where
+  def = CalleeToCaller Default.def Prelude.Nothing
+
+instance Hashable.Hashable CalleeToCaller where
+  hashWithSalt __salt (CalleeToCaller _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BaseClassToDerived_id = Glean.Id
+
+data BaseClassToDerived = BaseClassToDerived{baseClassToDerived_id
+                                             :: {-# UNPACK #-} !BaseClassToDerived_id,
+                                             baseClassToDerived_key ::
+                                             Prelude.Maybe BaseClassToDerived_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BaseClassToDerived where
+  toJSON (BaseClassToDerived __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BaseClassToDerived where
+  buildStruct _proxy (BaseClassToDerived __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BaseClassToDerived __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BaseClassToDerived where
+  rnf (BaseClassToDerived __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BaseClassToDerived where
+  def = BaseClassToDerived Default.def Prelude.Nothing
+
+instance Hashable.Hashable BaseClassToDerived where
+  hashWithSalt __salt (BaseClassToDerived _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileCall_id = Glean.Id
+
+data FileCall = FileCall{fileCall_id ::
+                         {-# UNPACK #-} !FileCall_id,
+                         fileCall_key :: Prelude.Maybe FileCall_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall where
+  toJSON (FileCall __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileCall where
+  buildStruct _proxy (FileCall __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileCall __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall where
+  rnf (FileCall __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileCall where
+  def = FileCall Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileCall where
+  hashWithSalt __salt (FileCall _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data XRefsViaNameByTarget_key = XRefsViaNameByTarget_key{xRefsViaNameByTarget_key_target
+                                                         :: Name,
+                                                         xRefsViaNameByTarget_key_file ::
+                                                         Glean.Schema.Src.File,
+                                                         xRefsViaNameByTarget_key_spans ::
+                                                         [Glean.Schema.Src.ByteSpan]}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaNameByTarget_key where
+  toJSON
+    (XRefsViaNameByTarget_key __field__target __field__file
+       __field__spans)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "spans" .= __field__spans : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaNameByTarget_key where
+  buildStruct _proxy
+    (XRefsViaNameByTarget_key __field__target __field__file
+       __field__spans)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "spans" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__spans)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__spans <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__spans
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__spans <- ST.readSTRef __field__spans
+                                             Prelude.pure
+                                               (XRefsViaNameByTarget_key __val__target __val__file
+                                                  __val__spans)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("spans", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaNameByTarget_key where
+  rnf
+    (XRefsViaNameByTarget_key __field__target __field__file
+       __field__spans)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__spans `Prelude.seq` ()
+
+instance Default.Default XRefsViaNameByTarget_key where
+  def = XRefsViaNameByTarget_key Default.def Default.def Default.def
+
+instance Hashable.Hashable XRefsViaNameByTarget_key where
+  hashWithSalt __salt (XRefsViaNameByTarget_key _target _file _spans)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _spans
+
+data XRefViaName = XRefViaName{xRefViaName_target :: Name,
+                               xRefViaName_source :: Glean.Schema.Src.ByteSpan}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefViaName where
+  toJSON (XRefViaName __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefViaName where
+  buildStruct _proxy (XRefViaName __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (XRefViaName __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefViaName where
+  rnf (XRefViaName __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default XRefViaName where
+  def = XRefViaName Default.def Default.def
+
+instance Hashable.Hashable XRefViaName where
+  hashWithSalt __salt (XRefViaName _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data XRefsViaNameByFile_key = XRefsViaNameByFile_key{xRefsViaNameByFile_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     xRefsViaNameByFile_key_xrefs :: [XRefViaName]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON XRefsViaNameByFile_key where
+  toJSON (XRefsViaNameByFile_key __field__file __field__xrefs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct XRefsViaNameByFile_key where
+  buildStruct _proxy
+    (XRefsViaNameByFile_key __field__file __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure
+                                               (XRefsViaNameByFile_key __val__file __val__xrefs)
+              _idMap = HashMap.fromList [("file", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData XRefsViaNameByFile_key where
+  rnf (XRefsViaNameByFile_key __field__file __field__xrefs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default XRefsViaNameByFile_key where
+  def = XRefsViaNameByFile_key Default.def Default.def
+
+instance Hashable.Hashable XRefsViaNameByFile_key where
+  hashWithSalt __salt (XRefsViaNameByFile_key _file _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xrefs
+
+newtype VariableDeclaration_key = VariableDeclaration_key{variableDeclaration_key_name
+                                                          :: Name}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDeclaration_key where
+  toJSON (VariableDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct VariableDeclaration_key where
+  buildStruct _proxy (VariableDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (VariableDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDeclaration_key where
+  rnf (VariableDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default VariableDeclaration_key where
+  def = VariableDeclaration_key Default.def
+
+instance Hashable.Hashable VariableDeclaration_key where
+  hashWithSalt __salt (VariableDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+type VariableBySName_value = VariableDeclaration
+
+data TypeInfo = TypeInfo{typeInfo_displayType :: Type,
+                         typeInfo_xrefs :: [XRefViaName]}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TypeInfo where
+  toJSON (TypeInfo __field__displayType __field__xrefs)
+    = Aeson.object
+        ("displayType" .= __field__displayType :
+           "xrefs" .= __field__xrefs : Prelude.mempty)
+
+instance Thrift.ThriftStruct TypeInfo where
+  buildStruct _proxy (TypeInfo __field__displayType __field__xrefs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "displayType" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__displayType)
+           :
+           Thrift.genField _proxy "xrefs" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                (Thrift.buildStruct _proxy)
+                __field__xrefs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__displayType <- ST.newSTRef Default.def
+            __field__xrefs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__displayType
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__xrefs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__displayType <- ST.readSTRef
+                                                                      __field__displayType
+                                             !__val__xrefs <- ST.readSTRef __field__xrefs
+                                             Prelude.pure (TypeInfo __val__displayType __val__xrefs)
+              _idMap = HashMap.fromList [("displayType", 1), ("xrefs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TypeInfo where
+  rnf (TypeInfo __field__displayType __field__xrefs)
+    = DeepSeq.rnf __field__displayType `Prelude.seq`
+        DeepSeq.rnf __field__xrefs `Prelude.seq` ()
+
+instance Default.Default TypeInfo where
+  def = TypeInfo Default.def Default.def
+
+instance Hashable.Hashable TypeInfo where
+  hashWithSalt __salt (TypeInfo _displayType _xrefs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _displayType)
+        _xrefs
+
+data SearchVariableByName_key = SearchVariableByName_key{searchVariableByName_key_name
+                                                         :: Text.Text,
+                                                         searchVariableByName_key_parent ::
+                                                         Prelude.Maybe SName,
+                                                         searchVariableByName_key_decl ::
+                                                         VariableDeclaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchVariableByName_key where
+  toJSON
+    (SearchVariableByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchVariableByName_key where
+  buildStruct _proxy
+    (SearchVariableByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchVariableByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchVariableByName_key where
+  rnf
+    (SearchVariableByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchVariableByName_key where
+  def = SearchVariableByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchVariableByName_key where
+  hashWithSalt __salt (SearchVariableByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchVariableByLowerCaseName_key = SearchVariableByLowerCaseName_key{searchVariableByLowerCaseName_key_name_lowercase
+                                                                           :: Text.Text,
+                                                                           searchVariableByLowerCaseName_key_name
+                                                                           :: Text.Text}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchVariableByLowerCaseName_key where
+  toJSON
+    (SearchVariableByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchVariableByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchVariableByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchVariableByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchVariableByLowerCaseName_key where
+  rnf
+    (SearchVariableByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchVariableByLowerCaseName_key where
+  def = SearchVariableByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchVariableByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchVariableByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchModuleByName_key = SearchModuleByName_key{searchModuleByName_key_name
+                                                     :: Text.Text,
+                                                     searchModuleByName_key_parent ::
+                                                     Prelude.Maybe SName,
+                                                     searchModuleByName_key_decl :: Module}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByName_key where
+  toJSON
+    (SearchModuleByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchModuleByName_key where
+  buildStruct _proxy
+    (SearchModuleByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchModuleByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByName_key where
+  rnf
+    (SearchModuleByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchModuleByName_key where
+  def = SearchModuleByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchModuleByName_key where
+  hashWithSalt __salt (SearchModuleByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchModuleByLowerCaseName_key = SearchModuleByLowerCaseName_key{searchModuleByLowerCaseName_key_name_lowercase
+                                                                       :: Text.Text,
+                                                                       searchModuleByLowerCaseName_key_name
+                                                                       :: Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModuleByLowerCaseName_key where
+  toJSON
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModuleByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchModuleByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModuleByLowerCaseName_key where
+  rnf
+    (SearchModuleByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchModuleByLowerCaseName_key where
+  def = SearchModuleByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchModuleByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchModuleByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchMethodByName_key = SearchMethodByName_key{searchMethodByName_key_name
+                                                     :: Text.Text,
+                                                     searchMethodByName_key_parent ::
+                                                     Prelude.Maybe SName,
+                                                     searchMethodByName_key_decl ::
+                                                     FunctionDeclaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByName_key where
+  toJSON
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchMethodByName_key where
+  buildStruct _proxy
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchMethodByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByName_key where
+  rnf
+    (SearchMethodByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchMethodByName_key where
+  def = SearchMethodByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchMethodByName_key where
+  hashWithSalt __salt (SearchMethodByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchMethodByLowerCaseName_key = SearchMethodByLowerCaseName_key{searchMethodByLowerCaseName_key_name_lowercase
+                                                                       :: Text.Text,
+                                                                       searchMethodByLowerCaseName_key_name
+                                                                       :: Text.Text}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchMethodByLowerCaseName_key where
+  toJSON
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchMethodByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchMethodByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchMethodByLowerCaseName_key where
+  rnf
+    (SearchMethodByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchMethodByLowerCaseName_key where
+  def = SearchMethodByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchMethodByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchMethodByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchFunctionByName_key = SearchFunctionByName_key{searchFunctionByName_key_name
+                                                         :: Text.Text,
+                                                         searchFunctionByName_key_parent ::
+                                                         Prelude.Maybe SName,
+                                                         searchFunctionByName_key_decl ::
+                                                         FunctionDeclaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByName_key where
+  toJSON
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchFunctionByName_key where
+  buildStruct _proxy
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchFunctionByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByName_key where
+  rnf
+    (SearchFunctionByName_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByName_key where
+  def = SearchFunctionByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchFunctionByName_key where
+  hashWithSalt __salt (SearchFunctionByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchFunctionByLowerCaseName_key = SearchFunctionByLowerCaseName_key{searchFunctionByLowerCaseName_key_name_lowercase
+                                                                           :: Text.Text,
+                                                                           searchFunctionByLowerCaseName_key_name
+                                                                           :: Text.Text}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionByLowerCaseName_key where
+  toJSON
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionByLowerCaseName_key
+         where
+  buildStruct _proxy
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchFunctionByLowerCaseName_key
+                                                  __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionByLowerCaseName_key where
+  rnf
+    (SearchFunctionByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchFunctionByLowerCaseName_key where
+  def = SearchFunctionByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchFunctionByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchFunctionByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchFieldByName_key = SearchFieldByName_key{searchFieldByName_key_name
+                                                   :: Text.Text,
+                                                   searchFieldByName_key_parent ::
+                                                   Prelude.Maybe SName,
+                                                   searchFieldByName_key_decl ::
+                                                   VariableDeclaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFieldByName_key where
+  toJSON
+    (SearchFieldByName_key __field__name __field__parent __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchFieldByName_key where
+  buildStruct _proxy
+    (SearchFieldByName_key __field__name __field__parent __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchFieldByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFieldByName_key where
+  rnf
+    (SearchFieldByName_key __field__name __field__parent __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchFieldByName_key where
+  def = SearchFieldByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchFieldByName_key where
+  hashWithSalt __salt (SearchFieldByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchFieldByLowerCaseName_key = SearchFieldByLowerCaseName_key{searchFieldByLowerCaseName_key_name_lowercase
+                                                                     :: Text.Text,
+                                                                     searchFieldByLowerCaseName_key_name
+                                                                     :: Text.Text}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFieldByLowerCaseName_key where
+  toJSON
+    (SearchFieldByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFieldByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchFieldByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchFieldByLowerCaseName_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFieldByLowerCaseName_key where
+  rnf
+    (SearchFieldByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchFieldByLowerCaseName_key where
+  def = SearchFieldByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchFieldByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchFieldByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+data SearchClassByName_key = SearchClassByName_key{searchClassByName_key_name
+                                                   :: Text.Text,
+                                                   searchClassByName_key_parent ::
+                                                   Prelude.Maybe SName,
+                                                   searchClassByName_key_decl :: ClassDeclaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByName_key where
+  toJSON
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchClassByName_key where
+  buildStruct _proxy
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__parent, __id__parent)
+                 = case __field__parent of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "parent"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__parent
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__parent
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchClassByName_key __val__name __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByName_key where
+  rnf
+    (SearchClassByName_key __field__name __field__parent __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchClassByName_key where
+  def = SearchClassByName_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchClassByName_key where
+  hashWithSalt __salt (SearchClassByName_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data SearchClassByLowerCaseName_key = SearchClassByLowerCaseName_key{searchClassByLowerCaseName_key_name_lowercase
+                                                                     :: Text.Text,
+                                                                     searchClassByLowerCaseName_key_name
+                                                                     :: Text.Text}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchClassByLowerCaseName_key where
+  toJSON
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Aeson.object
+        ("name_lowercase" .= __field__name_lowercase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchClassByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name_lowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__name_lowercase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name_lowercase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__name_lowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name_lowercase <- ST.readSTRef
+                                                                         __field__name_lowercase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (SearchClassByLowerCaseName_key __val__name_lowercase
+                                                  __val__name)
+              _idMap = HashMap.fromList [("name_lowercase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchClassByLowerCaseName_key where
+  rnf
+    (SearchClassByLowerCaseName_key __field__name_lowercase
+       __field__name)
+    = DeepSeq.rnf __field__name_lowercase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SearchClassByLowerCaseName_key where
+  def = SearchClassByLowerCaseName_key "" ""
+
+instance Hashable.Hashable SearchClassByLowerCaseName_key where
+  hashWithSalt __salt
+    (SearchClassByLowerCaseName_key _name_lowercase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _name_lowercase)
+        _name
+
+type SNameToName_value = Name
+
+data SName_key = SName_key{sName_key_local_name :: Name,
+                           sName_key_parent :: Prelude.Maybe SName}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SName_key where
+  toJSON (SName_key __field__local_name __field__parent)
+    = Aeson.object
+        ("local_name" .= __field__local_name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SName_key where
+  buildStruct _proxy (SName_key __field__local_name __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "local_name" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__local_name)
+           :
+           case __field__parent of
+             Prelude.Just _val -> Thrift.genField _proxy "parent"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__local_name <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__local_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__local_name <- ST.readSTRef
+                                                                     __field__local_name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (SName_key __val__local_name __val__parent)
+              _idMap = HashMap.fromList [("local_name", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SName_key where
+  rnf (SName_key __field__local_name __field__parent)
+    = DeepSeq.rnf __field__local_name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default SName_key where
+  def = SName_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable SName_key where
+  hashWithSalt __salt (SName_key _local_name _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _local_name)
+        _parent
+
+data ResolveOriginalName_key = ResolveOriginalName_key{resolveOriginalName_key_name
+                                                       :: Name,
+                                                       resolveOriginalName_key_original_name ::
+                                                       Name}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveOriginalName_key where
+  toJSON
+    (ResolveOriginalName_key __field__name __field__original_name)
+    = Aeson.object
+        ("name" .= __field__name :
+           "original_name" .= __field__original_name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveOriginalName_key where
+  buildStruct _proxy
+    (ResolveOriginalName_key __field__name __field__original_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "original_name"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__original_name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__original_name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__original_name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__original_name <- ST.readSTRef
+                                                                        __field__original_name
+                                             Prelude.pure
+                                               (ResolveOriginalName_key __val__name
+                                                  __val__original_name)
+              _idMap = HashMap.fromList [("name", 1), ("original_name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveOriginalName_key where
+  rnf (ResolveOriginalName_key __field__name __field__original_name)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__original_name `Prelude.seq` ()
+
+instance Default.Default ResolveOriginalName_key where
+  def = ResolveOriginalName_key Default.def Default.def
+
+instance Hashable.Hashable ResolveOriginalName_key where
+  hashWithSalt __salt (ResolveOriginalName_key _name _original_name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _original_name
+
+data Parameter = Parameter{parameter_name :: Name,
+                           parameter_typeInfo :: Prelude.Maybe TypeInfo,
+                           parameter_value :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Parameter where
+  toJSON (Parameter __field__name __field__typeInfo __field__value)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct Parameter where
+  buildStruct _proxy
+    (Parameter __field__name __field__typeInfo __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__typeInfo, __id__typeInfo)
+                 = case __field__typeInfo of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "typeInfo"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__typeInfo
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStringType _proxy)
+                                         3
+                                         __id__typeInfo
+                                         (Thrift.genText _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (Parameter __val__name __val__typeInfo __val__value)
+              _idMap
+                = HashMap.fromList [("name", 1), ("typeInfo", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Parameter where
+  rnf (Parameter __field__name __field__typeInfo __field__value)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__typeInfo `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Parameter where
+  def = Parameter Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable Parameter where
+  hashWithSalt __salt (Parameter _name _typeInfo _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _typeInfo)
+        _value
+
+type NameToSName_value = SName
+
+newtype ModuleDefinition_key = ModuleDefinition_key{moduleDefinition_key_module
+                                                    :: Module}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleDefinition_key where
+  toJSON (ModuleDefinition_key __field__module)
+    = Aeson.object ("module" .= __field__module : Prelude.mempty)
+
+instance Thrift.ThriftStruct ModuleDefinition_key where
+  buildStruct _proxy (ModuleDefinition_key __field__module)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             Prelude.pure (ModuleDefinition_key __val__module)
+              _idMap = HashMap.fromList [("module", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ModuleDefinition_key where
+  rnf (ModuleDefinition_key __field__module)
+    = DeepSeq.rnf __field__module `Prelude.seq` ()
+
+instance Default.Default ModuleDefinition_key where
+  def = ModuleDefinition_key Default.def
+
+instance Hashable.Hashable ModuleDefinition_key where
+  hashWithSalt __salt (ModuleDefinition_key _module)
+    = Hashable.hashWithSalt __salt _module
+
+type ModuleBySName_value = Module
+
+newtype Module_key = Module_key{module_key_name :: Name}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Module_key where
+  toJSON (Module_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Module_key where
+  buildStruct _proxy (Module_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Module_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Module_key where
+  rnf (Module_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Module_key where
+  def = Module_key Default.def
+
+instance Hashable.Hashable Module_key where
+  hashWithSalt __salt (Module_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+data MethodOverrides_key = MethodOverrides_key{methodOverrides_key_derived
+                                               :: FunctionDeclaration,
+                                               methodOverrides_key_base :: FunctionDeclaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverrides_key where
+  toJSON (MethodOverrides_key __field__derived __field__base)
+    = Aeson.object
+        ("derived" .= __field__derived :
+           "base" .= __field__base : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverrides_key where
+  buildStruct _proxy
+    (MethodOverrides_key __field__derived __field__base)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__derived)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__derived <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__derived <- ST.readSTRef
+                                                                  __field__derived
+                                             !__val__base <- ST.readSTRef __field__base
+                                             Prelude.pure
+                                               (MethodOverrides_key __val__derived __val__base)
+              _idMap = HashMap.fromList [("derived", 1), ("base", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverrides_key where
+  rnf (MethodOverrides_key __field__derived __field__base)
+    = DeepSeq.rnf __field__derived `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq` ()
+
+instance Default.Default MethodOverrides_key where
+  def = MethodOverrides_key Default.def Default.def
+
+instance Hashable.Hashable MethodOverrides_key where
+  hashWithSalt __salt (MethodOverrides_key _derived _base)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _derived)
+        _base
+
+data MethodOverriden_key = MethodOverriden_key{methodOverriden_key_base
+                                               :: FunctionDeclaration,
+                                               methodOverriden_key_derived :: FunctionDeclaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodOverriden_key where
+  toJSON (MethodOverriden_key __field__base __field__derived)
+    = Aeson.object
+        ("base" .= __field__base :
+           "derived" .= __field__derived : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodOverriden_key where
+  buildStruct _proxy
+    (MethodOverriden_key __field__base __field__derived)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__derived)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             Prelude.pure
+                                               (MethodOverriden_key __val__base __val__derived)
+              _idMap = HashMap.fromList [("base", 1), ("derived", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodOverriden_key where
+  rnf (MethodOverriden_key __field__base __field__derived)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__derived `Prelude.seq` ()
+
+instance Default.Default MethodOverriden_key where
+  def = MethodOverriden_key Default.def Default.def
+
+instance Hashable.Hashable MethodOverriden_key where
+  hashWithSalt __salt (MethodOverriden_key _base _derived)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _derived
+
+data MethodByLocalNameStr_key = MethodByLocalNameStr_key{methodByLocalNameStr_key_cls
+                                                         :: ClassDeclaration,
+                                                         methodByLocalNameStr_key_method_local_name
+                                                         :: Text.Text,
+                                                         methodByLocalNameStr_key_method ::
+                                                         FunctionDeclaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MethodByLocalNameStr_key where
+  toJSON
+    (MethodByLocalNameStr_key __field__cls __field__method_local_name
+       __field__method)
+    = Aeson.object
+        ("cls" .= __field__cls :
+           "method_local_name" .= __field__method_local_name :
+             "method" .= __field__method : Prelude.mempty)
+
+instance Thrift.ThriftStruct MethodByLocalNameStr_key where
+  buildStruct _proxy
+    (MethodByLocalNameStr_key __field__cls __field__method_local_name
+       __field__method)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "cls" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__cls)
+           :
+           Thrift.genField _proxy "method_local_name"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__method_local_name)
+             :
+             Thrift.genField _proxy "method" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__method)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__cls <- ST.newSTRef Default.def
+            __field__method_local_name <- ST.newSTRef ""
+            __field__method <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__cls
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__method_local_name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__method
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__cls <- ST.readSTRef __field__cls
+                                             !__val__method_local_name <- ST.readSTRef
+                                                                            __field__method_local_name
+                                             !__val__method <- ST.readSTRef __field__method
+                                             Prelude.pure
+                                               (MethodByLocalNameStr_key __val__cls
+                                                  __val__method_local_name
+                                                  __val__method)
+              _idMap
+                = HashMap.fromList
+                    [("cls", 1), ("method_local_name", 2), ("method", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData MethodByLocalNameStr_key where
+  rnf
+    (MethodByLocalNameStr_key __field__cls __field__method_local_name
+       __field__method)
+    = DeepSeq.rnf __field__cls `Prelude.seq`
+        DeepSeq.rnf __field__method_local_name `Prelude.seq`
+          DeepSeq.rnf __field__method `Prelude.seq` ()
+
+instance Default.Default MethodByLocalNameStr_key where
+  def = MethodByLocalNameStr_key Default.def "" Default.def
+
+instance Hashable.Hashable MethodByLocalNameStr_key where
+  hashWithSalt __salt
+    (MethodByLocalNameStr_key _cls _method_local_name _method)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _cls)
+           _method_local_name)
+        _method
+
+data ImportStatementByAsSName_key = ImportStatementByAsSName_key{importStatementByAsSName_key_sname
+                                                                 :: SName,
+                                                                 importStatementByAsSName_key_import_
+                                                                 :: ImportStatement}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatementByAsSName_key where
+  toJSON
+    (ImportStatementByAsSName_key __field__sname __field__import_)
+    = Aeson.object
+        ("sname" .= __field__sname :
+           "import_" .= __field__import_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatementByAsSName_key where
+  buildStruct _proxy
+    (ImportStatementByAsSName_key __field__sname __field__import_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__sname)
+           :
+           Thrift.genField _proxy "import_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__import_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sname <- ST.newSTRef Default.def
+            __field__import_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__import_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sname <- ST.readSTRef __field__sname
+                                             !__val__import_ <- ST.readSTRef __field__import_
+                                             Prelude.pure
+                                               (ImportStatementByAsSName_key __val__sname
+                                                  __val__import_)
+              _idMap = HashMap.fromList [("sname", 1), ("import_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatementByAsSName_key where
+  rnf (ImportStatementByAsSName_key __field__sname __field__import_)
+    = DeepSeq.rnf __field__sname `Prelude.seq`
+        DeepSeq.rnf __field__import_ `Prelude.seq` ()
+
+instance Default.Default ImportStatementByAsSName_key where
+  def = ImportStatementByAsSName_key Default.def Default.def
+
+instance Hashable.Hashable ImportStatementByAsSName_key where
+  hashWithSalt __salt (ImportStatementByAsSName_key _sname _import_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sname)
+        _import_
+
+data ImportStatementByAsName_key = ImportStatementByAsName_key{importStatementByAsName_key_name
+                                                               :: Name,
+                                                               importStatementByAsName_key_import_
+                                                               :: ImportStatement}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatementByAsName_key where
+  toJSON (ImportStatementByAsName_key __field__name __field__import_)
+    = Aeson.object
+        ("name" .= __field__name :
+           "import_" .= __field__import_ : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatementByAsName_key where
+  buildStruct _proxy
+    (ImportStatementByAsName_key __field__name __field__import_)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "import_" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__import_)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__import_ <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__import_
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__import_ <- ST.readSTRef __field__import_
+                                             Prelude.pure
+                                               (ImportStatementByAsName_key __val__name
+                                                  __val__import_)
+              _idMap = HashMap.fromList [("name", 1), ("import_", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatementByAsName_key where
+  rnf (ImportStatementByAsName_key __field__name __field__import_)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__import_ `Prelude.seq` ()
+
+instance Default.Default ImportStatementByAsName_key where
+  def = ImportStatementByAsName_key Default.def Default.def
+
+instance Hashable.Hashable ImportStatementByAsName_key where
+  hashWithSalt __salt (ImportStatementByAsName_key _name _import_)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _import_
+
+data ImportStatement_key = ImportStatement_key{importStatement_key_from_name
+                                               :: Name,
+                                               importStatement_key_as_name :: Name}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStatement_key where
+  toJSON (ImportStatement_key __field__from_name __field__as_name)
+    = Aeson.object
+        ("from_name" .= __field__from_name :
+           "as_name" .= __field__as_name : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStatement_key where
+  buildStruct _proxy
+    (ImportStatement_key __field__from_name __field__as_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from_name" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__from_name)
+           :
+           Thrift.genField _proxy "as_name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__as_name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from_name <- ST.newSTRef Default.def
+            __field__as_name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__from_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__as_name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from_name <- ST.readSTRef
+                                                                    __field__from_name
+                                             !__val__as_name <- ST.readSTRef __field__as_name
+                                             Prelude.pure
+                                               (ImportStatement_key __val__from_name __val__as_name)
+              _idMap = HashMap.fromList [("from_name", 1), ("as_name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStatement_key where
+  rnf (ImportStatement_key __field__from_name __field__as_name)
+    = DeepSeq.rnf __field__from_name `Prelude.seq`
+        DeepSeq.rnf __field__as_name `Prelude.seq` ()
+
+instance Default.Default ImportStatement_key where
+  def = ImportStatement_key Default.def Default.def
+
+instance Hashable.Hashable ImportStatement_key where
+  hashWithSalt __salt (ImportStatement_key _from_name _as_name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from_name)
+        _as_name
+
+data ImportStarsByFile_key = ImportStarsByFile_key{importStarsByFile_key_file
+                                                   :: Glean.Schema.Src.File,
+                                                   importStarsByFile_key_span ::
+                                                   Glean.Schema.Src.ByteSpan,
+                                                   importStarsByFile_key_declaration ::
+                                                   ImportStarStatement}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarsByFile_key where
+  toJSON
+    (ImportStarsByFile_key __field__file __field__span
+       __field__declaration)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarsByFile_key where
+  buildStruct _proxy
+    (ImportStarsByFile_key __field__file __field__span
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__declaration)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (ImportStarsByFile_key __val__file __val__span
+                                                  __val__declaration)
+              _idMap
+                = HashMap.fromList [("file", 1), ("span", 2), ("declaration", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarsByFile_key where
+  rnf
+    (ImportStarsByFile_key __field__file __field__span
+       __field__declaration)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default ImportStarsByFile_key where
+  def = ImportStarsByFile_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ImportStarsByFile_key where
+  hashWithSalt __salt
+    (ImportStarsByFile_key _file _span _declaration)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _declaration
+
+data ImportStarStatement_key = ImportStarStatement_key{importStarStatement_key_from_name
+                                                       :: Name,
+                                                       importStarStatement_key_into_module ::
+                                                       Module}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarStatement_key where
+  toJSON
+    (ImportStarStatement_key __field__from_name __field__into_module)
+    = Aeson.object
+        ("from_name" .= __field__from_name :
+           "into_module" .= __field__into_module : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarStatement_key where
+  buildStruct _proxy
+    (ImportStarStatement_key __field__from_name __field__into_module)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from_name" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__from_name)
+           :
+           Thrift.genField _proxy "into_module" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__into_module)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from_name <- ST.newSTRef Default.def
+            __field__into_module <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__from_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__into_module
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from_name <- ST.readSTRef
+                                                                    __field__from_name
+                                             !__val__into_module <- ST.readSTRef
+                                                                      __field__into_module
+                                             Prelude.pure
+                                               (ImportStarStatement_key __val__from_name
+                                                  __val__into_module)
+              _idMap = HashMap.fromList [("from_name", 1), ("into_module", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarStatement_key where
+  rnf
+    (ImportStarStatement_key __field__from_name __field__into_module)
+    = DeepSeq.rnf __field__from_name `Prelude.seq`
+        DeepSeq.rnf __field__into_module `Prelude.seq` ()
+
+instance Default.Default ImportStarStatement_key where
+  def = ImportStarStatement_key Default.def Default.def
+
+instance Hashable.Hashable ImportStarStatement_key where
+  hashWithSalt __salt
+    (ImportStarStatement_key _from_name _into_module)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from_name)
+        _into_module
+
+data ImportStarLocation_key = ImportStarLocation_key{importStarLocation_key_import_star
+                                                     :: ImportStarStatement,
+                                                     importStarLocation_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     importStarLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ImportStarLocation_key where
+  toJSON
+    (ImportStarLocation_key __field__import_star __field__file
+       __field__span)
+    = Aeson.object
+        ("import_star" .= __field__import_star :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct ImportStarLocation_key where
+  buildStruct _proxy
+    (ImportStarLocation_key __field__import_star __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "import_star" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__import_star)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__import_star <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__import_star
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__import_star <- ST.readSTRef
+                                                                      __field__import_star
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (ImportStarLocation_key __val__import_star
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("import_star", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ImportStarLocation_key where
+  rnf
+    (ImportStarLocation_key __field__import_star __field__file
+       __field__span)
+    = DeepSeq.rnf __field__import_star `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default ImportStarLocation_key where
+  def = ImportStarLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ImportStarLocation_key where
+  hashWithSalt __salt
+    (ImportStarLocation_key _import_star _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _import_star)
+           _file)
+        _span
+
+newtype FunctionDeclaration_key = FunctionDeclaration_key{functionDeclaration_key_name
+                                                          :: Name}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDeclaration_key where
+  toJSON (FunctionDeclaration_key __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FunctionDeclaration_key where
+  buildStruct _proxy (FunctionDeclaration_key __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (FunctionDeclaration_key __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDeclaration_key where
+  rnf (FunctionDeclaration_key __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FunctionDeclaration_key where
+  def = FunctionDeclaration_key Default.def
+
+instance Hashable.Hashable FunctionDeclaration_key where
+  hashWithSalt __salt (FunctionDeclaration_key _name)
+    = Hashable.hashWithSalt __salt _name
+
+type FunctionBySName_value = FunctionDeclaration
+
+data DerivedClassToBase_key = DerivedClassToBase_key{derivedClassToBase_key_derived
+                                                     :: ClassDeclaration,
+                                                     derivedClassToBase_key_base ::
+                                                     ClassDeclaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DerivedClassToBase_key where
+  toJSON (DerivedClassToBase_key __field__derived __field__base)
+    = Aeson.object
+        ("derived" .= __field__derived :
+           "base" .= __field__base : Prelude.mempty)
+
+instance Thrift.ThriftStruct DerivedClassToBase_key where
+  buildStruct _proxy
+    (DerivedClassToBase_key __field__derived __field__base)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__derived)
+           :
+           Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__base)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__derived <- ST.newSTRef Default.def
+            __field__base <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__derived <- ST.readSTRef
+                                                                  __field__derived
+                                             !__val__base <- ST.readSTRef __field__base
+                                             Prelude.pure
+                                               (DerivedClassToBase_key __val__derived __val__base)
+              _idMap = HashMap.fromList [("derived", 1), ("base", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DerivedClassToBase_key where
+  rnf (DerivedClassToBase_key __field__derived __field__base)
+    = DeepSeq.rnf __field__derived `Prelude.seq`
+        DeepSeq.rnf __field__base `Prelude.seq` ()
+
+instance Default.Default DerivedClassToBase_key where
+  def = DerivedClassToBase_key Default.def Default.def
+
+instance Hashable.Hashable DerivedClassToBase_key where
+  hashWithSalt __salt (DerivedClassToBase_key _derived _base)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _derived)
+        _base
+
+data Definition = Definition_cls ClassDefinition
+                | Definition_func FunctionDefinition
+                | Definition_variable VariableDefinition
+                | Definition_module ModuleDefinition
+                | Definition_EMPTY
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition_cls __cls) = Aeson.object ["cls" .= __cls]
+  toJSON (Definition_func __func) = Aeson.object ["func" .= __func]
+  toJSON (Definition_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (Definition_module __module)
+    = Aeson.object ["module" .= __module]
+  toJSON Definition_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition_cls __cls)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cls" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __cls)]
+  buildStruct _proxy (Definition_func __func)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "func" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __func)]
+  buildStruct _proxy (Definition_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (Definition_module __module)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __module)]
+  buildStruct _proxy Definition_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_cls _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_func _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Definition_variable _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Definition_module _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Definition_EMPTY
+           Thrift.FieldEnd -> Prelude.return Definition_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("cls", 1), ("func", 2), ("variable", 3), ("module", 4)]
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition_cls __cls) = DeepSeq.rnf __cls
+  rnf (Definition_func __func) = DeepSeq.rnf __func
+  rnf (Definition_variable __variable) = DeepSeq.rnf __variable
+  rnf (Definition_module __module) = DeepSeq.rnf __module
+  rnf Definition_EMPTY = ()
+
+instance Default.Default Definition where
+  def = Definition_EMPTY
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition_cls _cls)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _cls)
+  hashWithSalt __salt (Definition_func _func)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _func)
+  hashWithSalt __salt (Definition_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _variable)
+  hashWithSalt __salt (Definition_module _module)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _module)
+  hashWithSalt __salt Definition_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_definition
+                                                     :: Definition,
+                                                     definitionLocation_key_file ::
+                                                     Glean.Schema.Src.File,
+                                                     definitionLocation_key_span ::
+                                                     Glean.Schema.Src.ByteSpan}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = Aeson.object
+        ("definition" .= __field__definition :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__definition)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__definition <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__definition <- ST.readSTRef
+                                                                     __field__definition
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__definition __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("definition", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf
+    (DefinitionLocation_key __field__definition __field__file
+       __field__span)
+    = DeepSeq.rnf __field__definition `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt
+    (DefinitionLocation_key _definition _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _definition)
+           _file)
+        _span
+
+data DefinitionsByFile_key = DefinitionsByFile_key{definitionsByFile_key_file
+                                                   :: Glean.Schema.Src.File,
+                                                   definitionsByFile_key_span ::
+                                                   Glean.Schema.Src.ByteSpan,
+                                                   definitionsByFile_key_definition :: Definition}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionsByFile_key where
+  toJSON
+    (DefinitionsByFile_key __field__file __field__span
+       __field__definition)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionsByFile_key where
+  buildStruct _proxy
+    (DefinitionsByFile_key __field__file __field__span
+       __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__definition)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (DefinitionsByFile_key __val__file __val__span
+                                                  __val__definition)
+              _idMap
+                = HashMap.fromList [("file", 1), ("span", 2), ("definition", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionsByFile_key where
+  rnf
+    (DefinitionsByFile_key __field__file __field__span
+       __field__definition)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default DefinitionsByFile_key where
+  def = DefinitionsByFile_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DefinitionsByFile_key where
+  hashWithSalt __salt (DefinitionsByFile_key _file _span _definition)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _definition
+
+type Decorator = Text.Text
+
+data DeclarationContainer = DeclarationContainer_module Module
+                          | DeclarationContainer_cls ClassDeclaration
+                          | DeclarationContainer_func FunctionDeclaration
+                          | DeclarationContainer_EMPTY
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationContainer where
+  toJSON (DeclarationContainer_module __module)
+    = Aeson.object ["module" .= __module]
+  toJSON (DeclarationContainer_cls __cls)
+    = Aeson.object ["cls" .= __cls]
+  toJSON (DeclarationContainer_func __func)
+    = Aeson.object ["func" .= __func]
+  toJSON DeclarationContainer_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct DeclarationContainer where
+  buildStruct _proxy (DeclarationContainer_module __module)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __module)]
+  buildStruct _proxy (DeclarationContainer_cls __cls)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cls" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __cls)]
+  buildStruct _proxy (DeclarationContainer_func __func)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "func" (Thrift.getStructType _proxy) 3 0
+           (Thrift.buildStruct _proxy __func)]
+  buildStruct _proxy DeclarationContainer_EMPTY
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DeclarationContainer_module _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DeclarationContainer_cls _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (DeclarationContainer_func _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return
+                                                               DeclarationContainer_EMPTY
+           Thrift.FieldEnd -> Prelude.return DeclarationContainer_EMPTY
+    where
+      _idMap = HashMap.fromList [("module", 1), ("cls", 2), ("func", 3)]
+
+instance DeepSeq.NFData DeclarationContainer where
+  rnf (DeclarationContainer_module __module) = DeepSeq.rnf __module
+  rnf (DeclarationContainer_cls __cls) = DeepSeq.rnf __cls
+  rnf (DeclarationContainer_func __func) = DeepSeq.rnf __func
+  rnf DeclarationContainer_EMPTY = ()
+
+instance Default.Default DeclarationContainer where
+  def = DeclarationContainer_EMPTY
+
+instance Hashable.Hashable DeclarationContainer where
+  hashWithSalt __salt (DeclarationContainer_module _module)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _module)
+  hashWithSalt __salt (DeclarationContainer_cls _cls)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _cls)
+  hashWithSalt __salt (DeclarationContainer_func _func)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _func)
+  hashWithSalt __salt DeclarationContainer_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data FunctionDefinition_key = FunctionDefinition_key{functionDefinition_key_declaration
+                                                     :: FunctionDeclaration,
+                                                     functionDefinition_key_is_async ::
+                                                     Prelude.Bool,
+                                                     functionDefinition_key_returnsInfo ::
+                                                     Prelude.Maybe TypeInfo,
+                                                     functionDefinition_key_params :: [Parameter],
+                                                     functionDefinition_key_posonly_params ::
+                                                     Prelude.Maybe [Parameter],
+                                                     functionDefinition_key_kwonly_params ::
+                                                     Prelude.Maybe [Parameter],
+                                                     functionDefinition_key_star_arg ::
+                                                     Prelude.Maybe Parameter,
+                                                     functionDefinition_key_star_kwarg ::
+                                                     Prelude.Maybe Parameter,
+                                                     functionDefinition_key_decorators ::
+                                                     Prelude.Maybe [Decorator],
+                                                     functionDefinition_key_container ::
+                                                     Prelude.Maybe DeclarationContainer}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionDefinition_key where
+  toJSON
+    (FunctionDefinition_key __field__declaration __field__is_async
+       __field__returnsInfo __field__params __field__posonly_params
+       __field__kwonly_params __field__star_arg __field__star_kwarg
+       __field__decorators __field__container)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "is_async" .= __field__is_async :
+             Prelude.maybe Prelude.id ((:) . ("returnsInfo" .=))
+               __field__returnsInfo
+               ("params" .= __field__params :
+                  Prelude.maybe Prelude.id ((:) . ("posonly_params" .=))
+                    __field__posonly_params
+                    (Prelude.maybe Prelude.id ((:) . ("kwonly_params" .=))
+                       __field__kwonly_params
+                       (Prelude.maybe Prelude.id ((:) . ("star_arg" .=)) __field__star_arg
+                          (Prelude.maybe Prelude.id ((:) . ("star_kwarg" .=))
+                             __field__star_kwarg
+                             (Prelude.maybe Prelude.id ((:) . ("decorators" .=))
+                                __field__decorators
+                                (Prelude.maybe Prelude.id ((:) . ("container" .=))
+                                   __field__container
+                                   Prelude.mempty)))))))
+
+instance Thrift.ThriftStruct FunctionDefinition_key where
+  buildStruct _proxy
+    (FunctionDefinition_key __field__declaration __field__is_async
+       __field__returnsInfo __field__params __field__posonly_params
+       __field__kwonly_params __field__star_arg __field__star_kwarg
+       __field__decorators __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genFieldBool _proxy "is_async" 2 1 __field__is_async :
+             let (__cereal__returnsInfo, __id__returnsInfo)
+                   = case __field__returnsInfo of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "returnsInfo"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__returnsInfo
+                 (Thrift.genField _proxy "params" (Thrift.getListType _proxy) 4
+                    __id__returnsInfo
+                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                       (Thrift.buildStruct _proxy)
+                       __field__params)
+                    :
+                    let (__cereal__posonly_params, __id__posonly_params)
+                          = case __field__posonly_params of
+                              Prelude.Just _val -> ((:)
+                                                      (Thrift.genField _proxy "posonly_params"
+                                                         (Thrift.getListType _proxy)
+                                                         5
+                                                         4
+                                                         (Thrift.genList _proxy
+                                                            (Thrift.getStructType _proxy)
+                                                            (Thrift.buildStruct _proxy)
+                                                            _val)),
+                                                    5)
+                              Prelude.Nothing -> (Prelude.id, 4)
+                      in
+                      __cereal__posonly_params
+                        (let (__cereal__kwonly_params, __id__kwonly_params)
+                               = case __field__kwonly_params of
+                                   Prelude.Just _val -> ((:)
+                                                           (Thrift.genField _proxy "kwonly_params"
+                                                              (Thrift.getListType _proxy)
+                                                              6
+                                                              __id__posonly_params
+                                                              (Thrift.genList _proxy
+                                                                 (Thrift.getStructType _proxy)
+                                                                 (Thrift.buildStruct _proxy)
+                                                                 _val)),
+                                                         6)
+                                   Prelude.Nothing -> (Prelude.id, __id__posonly_params)
+                           in
+                           __cereal__kwonly_params
+                             (let (__cereal__star_arg, __id__star_arg)
+                                    = case __field__star_arg of
+                                        Prelude.Just _val -> ((:)
+                                                                (Thrift.genField _proxy "star_arg"
+                                                                   (Thrift.getStructType _proxy)
+                                                                   7
+                                                                   __id__kwonly_params
+                                                                   (Thrift.buildStruct _proxy
+                                                                      _val)),
+                                                              7)
+                                        Prelude.Nothing -> (Prelude.id, __id__kwonly_params)
+                                in
+                                __cereal__star_arg
+                                  (let (__cereal__star_kwarg, __id__star_kwarg)
+                                         = case __field__star_kwarg of
+                                             Prelude.Just _val -> ((:)
+                                                                     (Thrift.genField _proxy
+                                                                        "star_kwarg"
+                                                                        (Thrift.getStructType
+                                                                           _proxy)
+                                                                        8
+                                                                        __id__star_arg
+                                                                        (Thrift.buildStruct _proxy
+                                                                           _val)),
+                                                                   8)
+                                             Prelude.Nothing -> (Prelude.id, __id__star_arg)
+                                     in
+                                     __cereal__star_kwarg
+                                       (let (__cereal__decorators, __id__decorators)
+                                              = case __field__decorators of
+                                                  Prelude.Just _val -> ((:)
+                                                                          (Thrift.genField _proxy
+                                                                             "decorators"
+                                                                             (Thrift.getListType
+                                                                                _proxy)
+                                                                             9
+                                                                             __id__star_kwarg
+                                                                             (Thrift.genList _proxy
+                                                                                (Thrift.getStringType
+                                                                                   _proxy)
+                                                                                (Thrift.genText
+                                                                                   _proxy)
+                                                                                _val)),
+                                                                        9)
+                                                  Prelude.Nothing -> (Prelude.id, __id__star_kwarg)
+                                          in
+                                          __cereal__decorators
+                                            (case __field__container of
+                                               Prelude.Just _val -> Thrift.genField _proxy
+                                                                      "container"
+                                                                      (Thrift.getStructType _proxy)
+                                                                      10
+                                                                      __id__decorators
+                                                                      (Thrift.buildStruct _proxy
+                                                                         _val)
+                                                                      : []
+                                               Prelude.Nothing -> [])))))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__is_async <- ST.newSTRef Prelude.False
+            __field__returnsInfo <- ST.newSTRef Prelude.Nothing
+            __field__params <- ST.newSTRef Default.def
+            __field__posonly_params <- ST.newSTRef Prelude.Nothing
+            __field__kwonly_params <- ST.newSTRef Prelude.Nothing
+            __field__star_arg <- ST.newSTRef Prelude.Nothing
+            __field__star_kwarg <- ST.newSTRef Prelude.Nothing
+            __field__decorators <- ST.newSTRef Prelude.Nothing
+            __field__container <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__is_async
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__returnsInfo
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__params
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__posonly_params
+                                                                          (Prelude.Just _val)
+                                                                 6 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__kwonly_params
+                                                                          (Prelude.Just _val)
+                                                                 7 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__star_arg
+                                                                          (Prelude.Just _val)
+                                                                 8 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__star_kwarg
+                                                                          (Prelude.Just _val)
+                                                                 9 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__decorators
+                                                                          (Prelude.Just _val)
+                                                                 10 | _type ==
+                                                                        Thrift.getStructType _proxy
+                                                                      ->
+                                                                      do !_val <- Trans.lift
+                                                                                    (Thrift.parseStruct
+                                                                                       _proxy)
+                                                                         ST.writeSTRef
+                                                                           __field__container
+                                                                           (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__is_async <- ST.readSTRef __field__is_async
+                                             !__val__returnsInfo <- ST.readSTRef
+                                                                      __field__returnsInfo
+                                             !__val__params <- ST.readSTRef __field__params
+                                             !__val__posonly_params <- ST.readSTRef
+                                                                         __field__posonly_params
+                                             !__val__kwonly_params <- ST.readSTRef
+                                                                        __field__kwonly_params
+                                             !__val__star_arg <- ST.readSTRef __field__star_arg
+                                             !__val__star_kwarg <- ST.readSTRef __field__star_kwarg
+                                             !__val__decorators <- ST.readSTRef __field__decorators
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (FunctionDefinition_key __val__declaration
+                                                  __val__is_async
+                                                  __val__returnsInfo
+                                                  __val__params
+                                                  __val__posonly_params
+                                                  __val__kwonly_params
+                                                  __val__star_arg
+                                                  __val__star_kwarg
+                                                  __val__decorators
+                                                  __val__container)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("is_async", 2), ("returnsInfo", 3),
+                     ("params", 4), ("posonly_params", 5), ("kwonly_params", 6),
+                     ("star_arg", 7), ("star_kwarg", 8), ("decorators", 9),
+                     ("container", 10)]
+            _parse 0)
+
+instance DeepSeq.NFData FunctionDefinition_key where
+  rnf
+    (FunctionDefinition_key __field__declaration __field__is_async
+       __field__returnsInfo __field__params __field__posonly_params
+       __field__kwonly_params __field__star_arg __field__star_kwarg
+       __field__decorators __field__container)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__is_async `Prelude.seq`
+          DeepSeq.rnf __field__returnsInfo `Prelude.seq`
+            DeepSeq.rnf __field__params `Prelude.seq`
+              DeepSeq.rnf __field__posonly_params `Prelude.seq`
+                DeepSeq.rnf __field__kwonly_params `Prelude.seq`
+                  DeepSeq.rnf __field__star_arg `Prelude.seq`
+                    DeepSeq.rnf __field__star_kwarg `Prelude.seq`
+                      DeepSeq.rnf __field__decorators `Prelude.seq`
+                        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default FunctionDefinition_key where
+  def
+    = FunctionDefinition_key Default.def Prelude.False Prelude.Nothing
+        Default.def
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable FunctionDefinition_key where
+  hashWithSalt __salt
+    (FunctionDefinition_key _declaration _is_async _returnsInfo _params
+       _posonly_params _kwonly_params _star_arg _star_kwarg _decorators
+       _container)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt
+                 (Hashable.hashWithSalt
+                    (Hashable.hashWithSalt
+                       (Hashable.hashWithSalt
+                          (Hashable.hashWithSalt
+                             (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                                _is_async)
+                             _returnsInfo)
+                          _params)
+                       _posonly_params)
+                    _kwonly_params)
+                 _star_arg)
+              _star_kwarg)
+           _decorators)
+        _container
+
+data VariableDefinition_key = VariableDefinition_key{variableDefinition_key_declaration
+                                                     :: VariableDeclaration,
+                                                     variableDefinition_key_typeInfo ::
+                                                     Prelude.Maybe TypeInfo,
+                                                     variableDefinition_key_container ::
+                                                     Prelude.Maybe DeclarationContainer}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON VariableDefinition_key where
+  toJSON
+    (VariableDefinition_key __field__declaration __field__typeInfo
+       __field__container)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("typeInfo" .=)) __field__typeInfo
+             (Prelude.maybe Prelude.id ((:) . ("container" .=))
+                __field__container
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct VariableDefinition_key where
+  buildStruct _proxy
+    (VariableDefinition_key __field__declaration __field__typeInfo
+       __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__typeInfo, __id__typeInfo)
+                 = case __field__typeInfo of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "typeInfo"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__typeInfo
+               (case __field__container of
+                  Prelude.Just _val -> Thrift.genField _proxy "container"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         __id__typeInfo
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__typeInfo <- ST.newSTRef Prelude.Nothing
+            __field__container <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__typeInfo
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__typeInfo <- ST.readSTRef __field__typeInfo
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (VariableDefinition_key __val__declaration
+                                                  __val__typeInfo
+                                                  __val__container)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("typeInfo", 2), ("container", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData VariableDefinition_key where
+  rnf
+    (VariableDefinition_key __field__declaration __field__typeInfo
+       __field__container)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__typeInfo `Prelude.seq`
+          DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default VariableDefinition_key where
+  def
+    = VariableDefinition_key Default.def Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable VariableDefinition_key where
+  hashWithSalt __salt
+    (VariableDefinition_key _declaration _typeInfo _container)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _typeInfo)
+        _container
+
+data Declaration = Declaration_cls ClassDeclaration
+                 | Declaration_func FunctionDeclaration
+                 | Declaration_variable VariableDeclaration
+                 | Declaration_imp ImportStatement
+                 | Declaration_module Module
+                 | Declaration_EMPTY
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Declaration where
+  toJSON (Declaration_cls __cls) = Aeson.object ["cls" .= __cls]
+  toJSON (Declaration_func __func) = Aeson.object ["func" .= __func]
+  toJSON (Declaration_variable __variable)
+    = Aeson.object ["variable" .= __variable]
+  toJSON (Declaration_imp __imp) = Aeson.object ["imp" .= __imp]
+  toJSON (Declaration_module __module)
+    = Aeson.object ["module" .= __module]
+  toJSON Declaration_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Declaration where
+  buildStruct _proxy (Declaration_cls __cls)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "cls" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __cls)]
+  buildStruct _proxy (Declaration_func __func)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "func" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __func)]
+  buildStruct _proxy (Declaration_variable __variable)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "variable" (Thrift.getStructType _proxy) 3
+           0
+           (Thrift.buildStruct _proxy __variable)]
+  buildStruct _proxy (Declaration_imp __imp)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "imp" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __imp)]
+  buildStruct _proxy (Declaration_module __module)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __module)]
+  buildStruct _proxy Declaration_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_cls _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_func _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return
+                                                              (Declaration_variable _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_imp _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Declaration_module _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Declaration_EMPTY
+           Thrift.FieldEnd -> Prelude.return Declaration_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("cls", 1), ("func", 2), ("variable", 3), ("imp", 4),
+             ("module", 5)]
+
+instance DeepSeq.NFData Declaration where
+  rnf (Declaration_cls __cls) = DeepSeq.rnf __cls
+  rnf (Declaration_func __func) = DeepSeq.rnf __func
+  rnf (Declaration_variable __variable) = DeepSeq.rnf __variable
+  rnf (Declaration_imp __imp) = DeepSeq.rnf __imp
+  rnf (Declaration_module __module) = DeepSeq.rnf __module
+  rnf Declaration_EMPTY = ()
+
+instance Default.Default Declaration where
+  def = Declaration_EMPTY
+
+instance Hashable.Hashable Declaration where
+  hashWithSalt __salt (Declaration_cls _cls)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _cls)
+  hashWithSalt __salt (Declaration_func _func)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _func)
+  hashWithSalt __salt (Declaration_variable _variable)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _variable)
+  hashWithSalt __salt (Declaration_imp _imp)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _imp)
+  hashWithSalt __salt (Declaration_module _module)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _module)
+  hashWithSalt __salt Declaration_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data DeclarationDefinition_key = DeclarationDefinition_key{declarationDefinition_key_declaration
+                                                           :: Declaration,
+                                                           declarationDefinition_key_definition ::
+                                                           Definition}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationDefinition_key where
+  toJSON
+    (DeclarationDefinition_key __field__declaration
+       __field__definition)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "definition" .= __field__definition : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationDefinition_key where
+  buildStruct _proxy
+    (DeclarationDefinition_key __field__declaration
+       __field__definition)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "definition" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__definition)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__definition <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__definition <- ST.readSTRef __field__definition
+                                             Prelude.pure
+                                               (DeclarationDefinition_key __val__declaration
+                                                  __val__definition)
+              _idMap = HashMap.fromList [("declaration", 1), ("definition", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationDefinition_key where
+  rnf
+    (DeclarationDefinition_key __field__declaration
+       __field__definition)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__definition `Prelude.seq` ()
+
+instance Default.Default DeclarationDefinition_key where
+  def = DeclarationDefinition_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationDefinition_key where
+  hashWithSalt __salt
+    (DeclarationDefinition_key _declaration _definition)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _definition
+
+data DeclarationDocstring_key = DeclarationDocstring_key{declarationDocstring_key_declaration
+                                                         :: Declaration,
+                                                         declarationDocstring_key_location ::
+                                                         Glean.Schema.Src.ByteSpan,
+                                                         declarationDocstring_key_pretty_text ::
+                                                         Text.Text}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationDocstring_key where
+  toJSON
+    (DeclarationDocstring_key __field__declaration __field__location
+       __field__pretty_text)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "location" .= __field__location :
+             "pretty_text" .= __field__pretty_text : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationDocstring_key where
+  buildStruct _proxy
+    (DeclarationDocstring_key __field__declaration __field__location
+       __field__pretty_text)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "pretty_text" (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__pretty_text)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__pretty_text <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__pretty_text
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__pretty_text <- ST.readSTRef
+                                                                      __field__pretty_text
+                                             Prelude.pure
+                                               (DeclarationDocstring_key __val__declaration
+                                                  __val__location
+                                                  __val__pretty_text)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("location", 2), ("pretty_text", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationDocstring_key where
+  rnf
+    (DeclarationDocstring_key __field__declaration __field__location
+       __field__pretty_text)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__pretty_text `Prelude.seq` ()
+
+instance Default.Default DeclarationDocstring_key where
+  def = DeclarationDocstring_key Default.def Default.def ""
+
+instance Hashable.Hashable DeclarationDocstring_key where
+  hashWithSalt __salt
+    (DeclarationDocstring_key _declaration _location _pretty_text)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _location)
+        _pretty_text
+
+data DeclarationLocation_key = DeclarationLocation_key{declarationLocation_key_declaration
+                                                       :: Declaration,
+                                                       declarationLocation_key_file ::
+                                                       Glean.Schema.Src.File,
+                                                       declarationLocation_key_span ::
+                                                       Glean.Schema.Src.ByteSpan}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationLocation_key where
+  toJSON
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationLocation_key where
+  buildStruct _proxy
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationLocation_key __val__declaration
+                                                  __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationLocation_key where
+  rnf
+    (DeclarationLocation_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationLocation_key where
+  def = DeclarationLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationLocation_key where
+  hashWithSalt __salt
+    (DeclarationLocation_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationReference_key = DeclarationReference_key{declarationReference_key_target
+                                                         :: Declaration,
+                                                         declarationReference_key_source ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationReference_key where
+  toJSON (DeclarationReference_key __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationReference_key where
+  buildStruct _proxy
+    (DeclarationReference_key __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure
+                                               (DeclarationReference_key __val__target
+                                                  __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationReference_key where
+  rnf (DeclarationReference_key __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default DeclarationReference_key where
+  def = DeclarationReference_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationReference_key where
+  hashWithSalt __salt (DeclarationReference_key _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+type DeclarationToName_value = Name
+
+data DeclarationUses_key = DeclarationUses_key{declarationUses_key_declaration
+                                               :: Declaration,
+                                               declarationUses_key_file :: Glean.Schema.Src.File,
+                                               declarationUses_key_span ::
+                                               Glean.Schema.Src.ByteSpan}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationUses_key where
+  toJSON
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "file" .= __field__file : "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationUses_key where
+  buildStruct _proxy
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__span)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure
+                                               (DeclarationUses_key __val__declaration __val__file
+                                                  __val__span)
+              _idMap
+                = HashMap.fromList [("declaration", 1), ("file", 2), ("span", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationUses_key where
+  rnf
+    (DeclarationUses_key __field__declaration __field__file
+       __field__span)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default DeclarationUses_key where
+  def = DeclarationUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationUses_key where
+  hashWithSalt __salt (DeclarationUses_key _declaration _file _span)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+           _file)
+        _span
+
+data DeclarationWithLocalName_key = DeclarationWithLocalName_key{declarationWithLocalName_key_local_name
+                                                                 :: Name,
+                                                                 declarationWithLocalName_key_declaration
+                                                                 :: Declaration}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithLocalName_key where
+  toJSON
+    (DeclarationWithLocalName_key __field__local_name
+       __field__declaration)
+    = Aeson.object
+        ("local_name" .= __field__local_name :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithLocalName_key where
+  buildStruct _proxy
+    (DeclarationWithLocalName_key __field__local_name
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "local_name" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__local_name)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__local_name <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__local_name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__local_name <- ST.readSTRef
+                                                                     __field__local_name
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationWithLocalName_key __val__local_name
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("local_name", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithLocalName_key where
+  rnf
+    (DeclarationWithLocalName_key __field__local_name
+       __field__declaration)
+    = DeepSeq.rnf __field__local_name `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationWithLocalName_key where
+  def = DeclarationWithLocalName_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationWithLocalName_key where
+  hashWithSalt __salt
+    (DeclarationWithLocalName_key _local_name _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _local_name)
+        _declaration
+
+data DeclarationWithName_key = DeclarationWithName_key{declarationWithName_key_name
+                                                       :: Name,
+                                                       declarationWithName_key_declaration ::
+                                                       Declaration}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithName_key where
+  toJSON (DeclarationWithName_key __field__name __field__declaration)
+    = Aeson.object
+        ("name" .= __field__name :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithName_key where
+  buildStruct _proxy
+    (DeclarationWithName_key __field__name __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationWithName_key __val__name
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("name", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithName_key where
+  rnf (DeclarationWithName_key __field__name __field__declaration)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationWithName_key where
+  def = DeclarationWithName_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationWithName_key where
+  hashWithSalt __salt (DeclarationWithName_key _name _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _declaration
+
+data DeclarationWithSName_key = DeclarationWithSName_key{declarationWithSName_key_sname
+                                                         :: SName,
+                                                         declarationWithSName_key_declaration ::
+                                                         Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationWithSName_key where
+  toJSON
+    (DeclarationWithSName_key __field__sname __field__declaration)
+    = Aeson.object
+        ("sname" .= __field__sname :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationWithSName_key where
+  buildStruct _proxy
+    (DeclarationWithSName_key __field__sname __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "sname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__sname)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__sname <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__sname <- ST.readSTRef __field__sname
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationWithSName_key __val__sname
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("sname", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationWithSName_key where
+  rnf (DeclarationWithSName_key __field__sname __field__declaration)
+    = DeepSeq.rnf __field__sname `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationWithSName_key where
+  def = DeclarationWithSName_key Default.def Default.def
+
+instance Hashable.Hashable DeclarationWithSName_key where
+  hashWithSalt __salt (DeclarationWithSName_key _sname _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _sname)
+        _declaration
+
+data DeclarationsByFile_key = DeclarationsByFile_key{declarationsByFile_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     declarationsByFile_key_span ::
+                                                     Glean.Schema.Src.ByteSpan,
+                                                     declarationsByFile_key_declaration ::
+                                                     Declaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclarationsByFile_key where
+  toJSON
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span :
+             "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclarationsByFile_key where
+  buildStruct _proxy
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             :
+             Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+               3
+               2
+               (Thrift.buildStruct _proxy __field__declaration)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DeclarationsByFile_key __val__file __val__span
+                                                  __val__declaration)
+              _idMap
+                = HashMap.fromList [("file", 1), ("span", 2), ("declaration", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclarationsByFile_key where
+  rnf
+    (DeclarationsByFile_key __field__file __field__span
+       __field__declaration)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DeclarationsByFile_key where
+  def = DeclarationsByFile_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DeclarationsByFile_key where
+  hashWithSalt __salt
+    (DeclarationsByFile_key _file _span _declaration)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span)
+        _declaration
+
+data DefinitionDeclaration_key = DefinitionDeclaration_key{definitionDeclaration_key_definition
+                                                           :: Definition,
+                                                           definitionDeclaration_key_declaration ::
+                                                           Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionDeclaration_key where
+  toJSON
+    (DefinitionDeclaration_key __field__definition
+       __field__declaration)
+    = Aeson.object
+        ("definition" .= __field__definition :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionDeclaration_key where
+  buildStruct _proxy
+    (DefinitionDeclaration_key __field__definition
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "definition" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__definition)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__definition <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__definition
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__definition <- ST.readSTRef
+                                                                     __field__definition
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (DefinitionDeclaration_key __val__definition
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("definition", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionDeclaration_key where
+  rnf
+    (DefinitionDeclaration_key __field__definition
+       __field__declaration)
+    = DeepSeq.rnf __field__definition `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default DefinitionDeclaration_key where
+  def = DefinitionDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionDeclaration_key where
+  hashWithSalt __salt
+    (DefinitionDeclaration_key _definition _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _definition)
+        _declaration
+
+data DirectXRef = DirectXRef{directXRef_target :: Declaration,
+                             directXRef_source :: Glean.Schema.Src.ByteSpan}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectXRef where
+  toJSON (DirectXRef __field__target __field__source)
+    = Aeson.object
+        ("target" .= __field__target :
+           "source" .= __field__source : Prelude.mempty)
+
+instance Thrift.ThriftStruct DirectXRef where
+  buildStruct _proxy (DirectXRef __field__target __field__source)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__source <- ST.readSTRef __field__source
+                                             Prelude.pure (DirectXRef __val__target __val__source)
+              _idMap = HashMap.fromList [("target", 1), ("source", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DirectXRef where
+  rnf (DirectXRef __field__target __field__source)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq` ()
+
+instance Default.Default DirectXRef where
+  def = DirectXRef Default.def Default.def
+
+instance Hashable.Hashable DirectXRef where
+  hashWithSalt __salt (DirectXRef _target _source)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _source
+
+data DirectXRefsByFile_key = DirectXRefsByFile_key{directXRefsByFile_key_file
+                                                   :: Glean.Schema.Src.File,
+                                                   directXRefsByFile_key_xref :: DirectXRef}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DirectXRefsByFile_key where
+  toJSON (DirectXRefsByFile_key __field__file __field__xref)
+    = Aeson.object
+        ("file" .= __field__file :
+           "xref" .= __field__xref : Prelude.mempty)
+
+instance Thrift.ThriftStruct DirectXRefsByFile_key where
+  buildStruct _proxy
+    (DirectXRefsByFile_key __field__file __field__xref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             Prelude.pure
+                                               (DirectXRefsByFile_key __val__file __val__xref)
+              _idMap = HashMap.fromList [("file", 1), ("xref", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DirectXRefsByFile_key where
+  rnf (DirectXRefsByFile_key __field__file __field__xref)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq` ()
+
+instance Default.Default DirectXRefsByFile_key where
+  def = DirectXRefsByFile_key Default.def Default.def
+
+instance Hashable.Hashable DirectXRefsByFile_key where
+  hashWithSalt __salt (DirectXRefsByFile_key _file _xref)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _xref
+
+data SNameWithDeclaration_key = SNameWithDeclaration_key{sNameWithDeclaration_key_declaration
+                                                         :: Declaration,
+                                                         sNameWithDeclaration_key_sname :: SName}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SNameWithDeclaration_key where
+  toJSON
+    (SNameWithDeclaration_key __field__declaration __field__sname)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "sname" .= __field__sname : Prelude.mempty)
+
+instance Thrift.ThriftStruct SNameWithDeclaration_key where
+  buildStruct _proxy
+    (SNameWithDeclaration_key __field__declaration __field__sname)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "sname" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__sname)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__sname <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__sname
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__sname <- ST.readSTRef __field__sname
+                                             Prelude.pure
+                                               (SNameWithDeclaration_key __val__declaration
+                                                  __val__sname)
+              _idMap = HashMap.fromList [("declaration", 1), ("sname", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SNameWithDeclaration_key where
+  rnf (SNameWithDeclaration_key __field__declaration __field__sname)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__sname `Prelude.seq` ()
+
+instance Default.Default SNameWithDeclaration_key where
+  def = SNameWithDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable SNameWithDeclaration_key where
+  hashWithSalt __salt (SNameWithDeclaration_key _declaration _sname)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _sname
+
+data Contains_key = Contains_key{contains_key_container ::
+                                 Declaration,
+                                 contains_key_containee :: Declaration}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Contains_key where
+  toJSON (Contains_key __field__container __field__containee)
+    = Aeson.object
+        ("container" .= __field__container :
+           "containee" .= __field__containee : Prelude.mempty)
+
+instance Thrift.ThriftStruct Contains_key where
+  buildStruct _proxy
+    (Contains_key __field__container __field__containee)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "containee" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__containee)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__containee <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containee
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__containee <- ST.readSTRef __field__containee
+                                             Prelude.pure
+                                               (Contains_key __val__container __val__containee)
+              _idMap = HashMap.fromList [("container", 1), ("containee", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Contains_key where
+  rnf (Contains_key __field__container __field__containee)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__containee `Prelude.seq` ()
+
+instance Default.Default Contains_key where
+  def = Contains_key Default.def Default.def
+
+instance Hashable.Hashable Contains_key where
+  hashWithSalt __salt (Contains_key _container _containee)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _containee
+
+data ContainingTopLevelDeclaration_key = ContainingTopLevelDeclaration_key{containingTopLevelDeclaration_key_declaration
+                                                                           :: Declaration,
+                                                                           containingTopLevelDeclaration_key_container
+                                                                           :: Declaration}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainingTopLevelDeclaration_key where
+  toJSON
+    (ContainingTopLevelDeclaration_key __field__declaration
+       __field__container)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainingTopLevelDeclaration_key
+         where
+  buildStruct _proxy
+    (ContainingTopLevelDeclaration_key __field__declaration
+       __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (ContainingTopLevelDeclaration_key __val__declaration
+                                                  __val__container)
+              _idMap = HashMap.fromList [("declaration", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainingTopLevelDeclaration_key where
+  rnf
+    (ContainingTopLevelDeclaration_key __field__declaration
+       __field__container)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default ContainingTopLevelDeclaration_key where
+  def = ContainingTopLevelDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ContainingTopLevelDeclaration_key where
+  hashWithSalt __salt
+    (ContainingTopLevelDeclaration_key _declaration _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+        _container
+
+data ContainedByTopLevelDeclaration_key = ContainedByTopLevelDeclaration_key{containedByTopLevelDeclaration_key_container
+                                                                             :: Declaration,
+                                                                             containedByTopLevelDeclaration_key_declaration
+                                                                             :: Declaration}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainedByTopLevelDeclaration_key where
+  toJSON
+    (ContainedByTopLevelDeclaration_key __field__container
+       __field__declaration)
+    = Aeson.object
+        ("container" .= __field__container :
+           "declaration" .= __field__declaration : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainedByTopLevelDeclaration_key
+         where
+  buildStruct _proxy
+    (ContainedByTopLevelDeclaration_key __field__container
+       __field__declaration)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__container)
+           :
+           Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__declaration)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__container <- ST.newSTRef Default.def
+            __field__declaration <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__container <- ST.readSTRef
+                                                                    __field__container
+                                             !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             Prelude.pure
+                                               (ContainedByTopLevelDeclaration_key __val__container
+                                                  __val__declaration)
+              _idMap = HashMap.fromList [("container", 1), ("declaration", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainedByTopLevelDeclaration_key where
+  rnf
+    (ContainedByTopLevelDeclaration_key __field__container
+       __field__declaration)
+    = DeepSeq.rnf __field__container `Prelude.seq`
+        DeepSeq.rnf __field__declaration `Prelude.seq` ()
+
+instance Default.Default ContainedByTopLevelDeclaration_key where
+  def = ContainedByTopLevelDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable ContainedByTopLevelDeclaration_key where
+  hashWithSalt __salt
+    (ContainedByTopLevelDeclaration_key _container _declaration)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _container)
+        _declaration
+
+data ContainedBy_key = ContainedBy_key{containedBy_key_containee ::
+                                       Declaration,
+                                       containedBy_key_container :: Declaration}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ContainedBy_key where
+  toJSON (ContainedBy_key __field__containee __field__container)
+    = Aeson.object
+        ("containee" .= __field__containee :
+           "container" .= __field__container : Prelude.mempty)
+
+instance Thrift.ThriftStruct ContainedBy_key where
+  buildStruct _proxy
+    (ContainedBy_key __field__containee __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "containee" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__containee)
+           :
+           Thrift.genField _proxy "container" (Thrift.getStructType _proxy) 2
+             1
+             (Thrift.buildStruct _proxy __field__container)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__containee <- ST.newSTRef Default.def
+            __field__container <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containee
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__containee <- ST.readSTRef
+                                                                    __field__containee
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (ContainedBy_key __val__containee __val__container)
+              _idMap = HashMap.fromList [("containee", 1), ("container", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ContainedBy_key where
+  rnf (ContainedBy_key __field__containee __field__container)
+    = DeepSeq.rnf __field__containee `Prelude.seq`
+        DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default ContainedBy_key where
+  def = ContainedBy_key Default.def Default.def
+
+instance Hashable.Hashable ContainedBy_key where
+  hashWithSalt __salt (ContainedBy_key _containee _container)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _containee)
+        _container
+
+data ClassDefinition_key = ClassDefinition_key{classDefinition_key_declaration
+                                               :: ClassDeclaration,
+                                               classDefinition_key_bases ::
+                                               Prelude.Maybe [ClassDeclaration],
+                                               classDefinition_key_keywords ::
+                                               Prelude.Maybe [Parameter],
+                                               classDefinition_key_decorators ::
+                                               Prelude.Maybe [Decorator],
+                                               classDefinition_key_container ::
+                                               Prelude.Maybe DeclarationContainer}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDefinition_key where
+  toJSON
+    (ClassDefinition_key __field__declaration __field__bases
+       __field__keywords __field__decorators __field__container)
+    = Aeson.object
+        ("declaration" .= __field__declaration :
+           Prelude.maybe Prelude.id ((:) . ("bases" .=)) __field__bases
+             (Prelude.maybe Prelude.id ((:) . ("keywords" .=)) __field__keywords
+                (Prelude.maybe Prelude.id ((:) . ("decorators" .=))
+                   __field__decorators
+                   (Prelude.maybe Prelude.id ((:) . ("container" .=))
+                      __field__container
+                      Prelude.mempty))))
+
+instance Thrift.ThriftStruct ClassDefinition_key where
+  buildStruct _proxy
+    (ClassDefinition_key __field__declaration __field__bases
+       __field__keywords __field__decorators __field__container)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "declaration" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__declaration)
+           :
+           let (__cereal__bases, __id__bases)
+                 = case __field__bases of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "bases"
+                                                (Thrift.getListType _proxy)
+                                                2
+                                                1
+                                                (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                                   (Thrift.buildStruct _proxy)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__bases
+               (let (__cereal__keywords, __id__keywords)
+                      = case __field__keywords of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "keywords"
+                                                     (Thrift.getListType _proxy)
+                                                     3
+                                                     __id__bases
+                                                     (Thrift.genList _proxy
+                                                        (Thrift.getStructType _proxy)
+                                                        (Thrift.buildStruct _proxy)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__bases)
+                  in
+                  __cereal__keywords
+                    (let (__cereal__decorators, __id__decorators)
+                           = case __field__decorators of
+                               Prelude.Just _val -> ((:)
+                                                       (Thrift.genField _proxy "decorators"
+                                                          (Thrift.getListType _proxy)
+                                                          4
+                                                          __id__keywords
+                                                          (Thrift.genList _proxy
+                                                             (Thrift.getStringType _proxy)
+                                                             (Thrift.genText _proxy)
+                                                             _val)),
+                                                     4)
+                               Prelude.Nothing -> (Prelude.id, __id__keywords)
+                       in
+                       __cereal__decorators
+                         (case __field__container of
+                            Prelude.Just _val -> Thrift.genField _proxy "container"
+                                                   (Thrift.getStructType _proxy)
+                                                   5
+                                                   __id__decorators
+                                                   (Thrift.buildStruct _proxy _val)
+                                                   : []
+                            Prelude.Nothing -> []))))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__declaration <- ST.newSTRef Default.def
+            __field__bases <- ST.newSTRef Prelude.Nothing
+            __field__keywords <- ST.newSTRef Prelude.Nothing
+            __field__decorators <- ST.newSTRef Prelude.Nothing
+            __field__container <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__declaration
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__bases
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__keywords
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__decorators
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__container
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__declaration <- ST.readSTRef
+                                                                      __field__declaration
+                                             !__val__bases <- ST.readSTRef __field__bases
+                                             !__val__keywords <- ST.readSTRef __field__keywords
+                                             !__val__decorators <- ST.readSTRef __field__decorators
+                                             !__val__container <- ST.readSTRef __field__container
+                                             Prelude.pure
+                                               (ClassDefinition_key __val__declaration __val__bases
+                                                  __val__keywords
+                                                  __val__decorators
+                                                  __val__container)
+              _idMap
+                = HashMap.fromList
+                    [("declaration", 1), ("bases", 2), ("keywords", 3),
+                     ("decorators", 4), ("container", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDefinition_key where
+  rnf
+    (ClassDefinition_key __field__declaration __field__bases
+       __field__keywords __field__decorators __field__container)
+    = DeepSeq.rnf __field__declaration `Prelude.seq`
+        DeepSeq.rnf __field__bases `Prelude.seq`
+          DeepSeq.rnf __field__keywords `Prelude.seq`
+            DeepSeq.rnf __field__decorators `Prelude.seq`
+              DeepSeq.rnf __field__container `Prelude.seq` ()
+
+instance Default.Default ClassDefinition_key where
+  def
+    = ClassDefinition_key Default.def Prelude.Nothing Prelude.Nothing
+        Prelude.Nothing
+        Prelude.Nothing
+
+instance Hashable.Hashable ClassDefinition_key where
+  hashWithSalt __salt
+    (ClassDefinition_key _declaration _bases _keywords _decorators
+       _container)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _declaration)
+                 _bases)
+              _keywords)
+           _decorators)
+        _container
+
+data ClassDeclaration_key = ClassDeclaration_key{classDeclaration_key_name
+                                                 :: Name,
+                                                 classDeclaration_key_bases :: Prelude.Maybe [Name]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ClassDeclaration_key where
+  toJSON (ClassDeclaration_key __field__name __field__bases)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("bases" .=)) __field__bases
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ClassDeclaration_key where
+  buildStruct _proxy
+    (ClassDeclaration_key __field__name __field__bases)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__bases of
+             Prelude.Just _val -> Thrift.genField _proxy "bases"
+                                    (Thrift.getListType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                                       (Thrift.buildStruct _proxy)
+                                       _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__bases <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__bases
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__bases <- ST.readSTRef __field__bases
+                                             Prelude.pure
+                                               (ClassDeclaration_key __val__name __val__bases)
+              _idMap = HashMap.fromList [("name", 1), ("bases", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ClassDeclaration_key where
+  rnf (ClassDeclaration_key __field__name __field__bases)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__bases `Prelude.seq` ()
+
+instance Default.Default ClassDeclaration_key where
+  def = ClassDeclaration_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable ClassDeclaration_key where
+  hashWithSalt __salt (ClassDeclaration_key _name _bases)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _bases
+
+type ClassBySName_value = ClassDeclaration
+
+data CalleeToCaller_key = CalleeToCaller_key{calleeToCaller_key_callee
+                                             :: Name,
+                                             calleeToCaller_key_caller :: Name}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CalleeToCaller_key where
+  toJSON (CalleeToCaller_key __field__callee __field__caller)
+    = Aeson.object
+        ("callee" .= __field__callee :
+           "caller" .= __field__caller : Prelude.mempty)
+
+instance Thrift.ThriftStruct CalleeToCaller_key where
+  buildStruct _proxy
+    (CalleeToCaller_key __field__callee __field__caller)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "callee" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__callee)
+           :
+           Thrift.genField _proxy "caller" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__caller)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__callee <- ST.newSTRef Default.def
+            __field__caller <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__caller
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__callee <- ST.readSTRef
+                                                                 __field__callee
+                                             !__val__caller <- ST.readSTRef __field__caller
+                                             Prelude.pure
+                                               (CalleeToCaller_key __val__callee __val__caller)
+              _idMap = HashMap.fromList [("callee", 1), ("caller", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CalleeToCaller_key where
+  rnf (CalleeToCaller_key __field__callee __field__caller)
+    = DeepSeq.rnf __field__callee `Prelude.seq`
+        DeepSeq.rnf __field__caller `Prelude.seq` ()
+
+instance Default.Default CalleeToCaller_key where
+  def = CalleeToCaller_key Default.def Default.def
+
+instance Hashable.Hashable CalleeToCaller_key where
+  hashWithSalt __salt (CalleeToCaller_key _callee _caller)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _callee)
+        _caller
+
+data BaseClassToDerived_key = BaseClassToDerived_key{baseClassToDerived_key_base
+                                                     :: ClassDeclaration,
+                                                     baseClassToDerived_key_derived ::
+                                                     ClassDeclaration}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BaseClassToDerived_key where
+  toJSON (BaseClassToDerived_key __field__base __field__derived)
+    = Aeson.object
+        ("base" .= __field__base :
+           "derived" .= __field__derived : Prelude.mempty)
+
+instance Thrift.ThriftStruct BaseClassToDerived_key where
+  buildStruct _proxy
+    (BaseClassToDerived_key __field__base __field__derived)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "base" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__base)
+           :
+           Thrift.genField _proxy "derived" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__derived)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__base <- ST.newSTRef Default.def
+            __field__derived <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__base
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__derived
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__base <- ST.readSTRef __field__base
+                                             !__val__derived <- ST.readSTRef __field__derived
+                                             Prelude.pure
+                                               (BaseClassToDerived_key __val__base __val__derived)
+              _idMap = HashMap.fromList [("base", 1), ("derived", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BaseClassToDerived_key where
+  rnf (BaseClassToDerived_key __field__base __field__derived)
+    = DeepSeq.rnf __field__base `Prelude.seq`
+        DeepSeq.rnf __field__derived `Prelude.seq` ()
+
+instance Default.Default BaseClassToDerived_key where
+  def = BaseClassToDerived_key Default.def Default.def
+
+instance Hashable.Hashable BaseClassToDerived_key where
+  hashWithSalt __salt (BaseClassToDerived_key _base _derived)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _base)
+        _derived
+
+data Argument = Argument_lit StringLiteral
+              | Argument_EMPTY
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Argument where
+  toJSON (Argument_lit __lit) = Aeson.object ["lit" .= __lit]
+  toJSON Argument_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Argument where
+  buildStruct _proxy (Argument_lit __lit)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "lit" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __lit)]
+  buildStruct _proxy Argument_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Argument_lit _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Argument_EMPTY
+           Thrift.FieldEnd -> Prelude.return Argument_EMPTY
+    where
+      _idMap = HashMap.fromList [("lit", 1)]
+
+instance DeepSeq.NFData Argument where
+  rnf (Argument_lit __lit) = DeepSeq.rnf __lit
+  rnf Argument_EMPTY = ()
+
+instance Default.Default Argument where
+  def = Argument_EMPTY
+
+instance Hashable.Hashable Argument where
+  hashWithSalt __salt (Argument_lit _lit)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _lit)
+  hashWithSalt __salt Argument_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data CallArgument = CallArgument{callArgument_label ::
+                                 Prelude.Maybe Name,
+                                 callArgument_span :: Glean.Schema.Src.ByteSpan,
+                                 callArgument_argument :: Prelude.Maybe Argument}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CallArgument where
+  toJSON
+    (CallArgument __field__label __field__span __field__argument)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("label" .=)) __field__label
+           ("span" .= __field__span :
+              Prelude.maybe Prelude.id ((:) . ("argument" .=)) __field__argument
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct CallArgument where
+  buildStruct _proxy
+    (CallArgument __field__label __field__span __field__argument)
+    = Thrift.genStruct _proxy
+        (let (__cereal__label, __id__label)
+               = case __field__label of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "label"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__label
+             (Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2
+                __id__label
+                (Thrift.buildStruct _proxy __field__span)
+                :
+                case __field__argument of
+                  Prelude.Just _val -> Thrift.genField _proxy "argument"
+                                         (Thrift.getStructType _proxy)
+                                         3
+                                         2
+                                         (Thrift.buildStruct _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__label <- ST.newSTRef Prelude.Nothing
+            __field__span <- ST.newSTRef Default.def
+            __field__argument <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__label
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__argument
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__label <- ST.readSTRef __field__label
+                                             !__val__span <- ST.readSTRef __field__span
+                                             !__val__argument <- ST.readSTRef __field__argument
+                                             Prelude.pure
+                                               (CallArgument __val__label __val__span
+                                                  __val__argument)
+              _idMap
+                = HashMap.fromList [("label", 1), ("span", 2), ("argument", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CallArgument where
+  rnf (CallArgument __field__label __field__span __field__argument)
+    = DeepSeq.rnf __field__label `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq`
+          DeepSeq.rnf __field__argument `Prelude.seq` ()
+
+instance Default.Default CallArgument where
+  def = CallArgument Prelude.Nothing Default.def Prelude.Nothing
+
+instance Hashable.Hashable CallArgument where
+  hashWithSalt __salt (CallArgument _label _span _argument)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _label) _span)
+        _argument
+
+data FileCall_key = FileCall_key{fileCall_key_file ::
+                                 Glean.Schema.Src.File,
+                                 fileCall_key_callee_span :: Glean.Schema.Src.ByteSpan,
+                                 fileCall_key_call_args :: [CallArgument]}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileCall_key where
+  toJSON
+    (FileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = Aeson.object
+        ("file" .= __field__file :
+           "callee_span" .= __field__callee_span :
+             "call_args" .= __field__call_args : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileCall_key where
+  buildStruct _proxy
+    (FileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "callee_span" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__callee_span)
+             :
+             Thrift.genField _proxy "call_args" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStructType _proxy)
+                  (Thrift.buildStruct _proxy)
+                  __field__call_args)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__callee_span <- ST.newSTRef Default.def
+            __field__call_args <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__callee_span
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseStruct
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__call_args
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__callee_span <- ST.readSTRef
+                                                                      __field__callee_span
+                                             !__val__call_args <- ST.readSTRef __field__call_args
+                                             Prelude.pure
+                                               (FileCall_key __val__file __val__callee_span
+                                                  __val__call_args)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("callee_span", 2), ("call_args", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileCall_key where
+  rnf
+    (FileCall_key __field__file __field__callee_span
+       __field__call_args)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__callee_span `Prelude.seq`
+          DeepSeq.rnf __field__call_args `Prelude.seq` ()
+
+instance Default.Default FileCall_key where
+  def = FileCall_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileCall_key where
+  hashWithSalt __salt (FileCall_key _file _callee_span _call_args)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _callee_span)
+        _call_args
+{-# LINE 18 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.NonImportDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.NonImportDeclaration =
+       Glean.Schema.Python.Types.Declaration
+  getName _proxy = Glean.PredicateRef "python.NonImportDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.nonImportDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.NonImportDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.nonImportDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 27 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.NonImportDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 33 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 42 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationDefinition_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "definition" (Glean.Schema.Python.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 44 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationDefinition =
+       Glean.Schema.Python.Types.DeclarationDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "python.DeclarationDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationDefinition x k
+  getFactKey = Glean.Schema.Python.Types.declarationDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 53 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 59 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationWithSName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationWithSName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationWithSName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationWithSName_key"
+           (Prelude.Just 0))
+{-# LINE 68 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationWithSName_key
+     =
+     'Angle.TField "sname"
+       (Glean.KeyType Glean.Schema.Python.Types.SName)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 70 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationWithSName
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationWithSName =
+       Glean.Schema.Python.Types.DeclarationWithSName_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationWithSName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationWithSName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationWithSName x k
+  getFactKey = Glean.Schema.Python.Types.declarationWithSName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 79 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationWithSName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 85 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationWithLocalName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationWithLocalName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationWithLocalName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationWithLocalName_key"
+           (Prelude.Just 0))
+{-# LINE 94 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationWithLocalName_key
+     =
+     'Angle.TField "local_name"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 96 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationWithLocalName
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationWithLocalName =
+       Glean.Schema.Python.Types.DeclarationWithLocalName_key
+  getName _proxy
+    = Glean.PredicateRef "python.DeclarationWithLocalName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationWithLocalName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationWithLocalName x k
+  getFactKey = Glean.Schema.Python.Types.declarationWithLocalName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 105 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationWithLocalName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 111 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DefinitionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DefinitionDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DefinitionDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DefinitionDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 120 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DefinitionDeclaration_key
+     =
+     'Angle.TField "definition" (Glean.Schema.Python.Types.Definition)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 122 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DefinitionDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.DefinitionDeclaration =
+       Glean.Schema.Python.Types.DefinitionDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "python.DefinitionDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.definitionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DefinitionDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.definitionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 131 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DefinitionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 137 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ClassBySName
+         where
+  type KeyType Glean.Schema.Python.Types.ClassBySName =
+       Glean.Schema.Python.Types.SName
+  type ValueType Glean.Schema.Python.Types.ClassBySName =
+       Glean.Schema.Python.Types.ClassBySName_value
+  getName _proxy = Glean.PredicateRef "python.ClassBySName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.classBySName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.ClassBySName x k v
+  getFactKey = Glean.Schema.Python.Types.classBySName_key
+  getFactValue = Glean.Schema.Python.Types.classBySName_value
+{-# LINE 148 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ClassBySName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 154 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationUses_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationUses_key" (Prelude.Just 0))
+{-# LINE 165 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DeclarationUses_key =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 167 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.DeclarationUses
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationUses =
+       Glean.Schema.Python.Types.DeclarationUses_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationUses" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationUses x k
+  getFactKey = Glean.Schema.Python.Types.declarationUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 176 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 182 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.CalleeToCaller_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.CalleeToCaller_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.CalleeToCaller_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.CalleeToCaller_key" (Prelude.Just 0))
+{-# LINE 191 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.CalleeToCaller_key =
+     'Angle.TField "callee"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "caller"
+          (Glean.KeyType Glean.Schema.Python.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 193 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.CalleeToCaller
+         where
+  type KeyType Glean.Schema.Python.Types.CalleeToCaller =
+       Glean.Schema.Python.Types.CalleeToCaller_key
+  getName _proxy = Glean.PredicateRef "python.CalleeToCaller" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.calleeToCaller_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.CalleeToCaller x k
+  getFactKey = Glean.Schema.Python.Types.calleeToCaller_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 202 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.CalleeToCaller where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 208 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ClassDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ClassDefinition_key x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ClassDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ClassDefinition_key" (Prelude.Just 0))
+{-# LINE 223 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ClassDefinition_key =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+       ('Angle.TField "bases"
+          (Prelude.Maybe [Glean.Schema.Python.Types.ClassDeclaration])
+          ('Angle.TField "keywords"
+             (Prelude.Maybe [Glean.Schema.Python.Types.Parameter])
+             ('Angle.TField "decorators"
+                (Prelude.Maybe [Glean.Schema.Python.Types.Decorator])
+                ('Angle.TField "container"
+                   (Prelude.Maybe Glean.Schema.Python.Types.DeclarationContainer)
+                   ('Angle.TNoFields)))))
+{-# LINE 225 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ClassDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.ClassDefinition =
+       Glean.Schema.Python.Types.ClassDefinition_key
+  getName _proxy = Glean.PredicateRef "python.ClassDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.classDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ClassDefinition x k
+  getFactKey = Glean.Schema.Python.Types.classDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 234 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ClassDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 240 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.Type where
+  type KeyType Glean.Schema.Python.Types.Type = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "python.Type" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.type_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.Type x k
+  getFactKey = Glean.Schema.Python.Types.type_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 248 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Type where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 254 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DerivedClassToBase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DerivedClassToBase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DerivedClassToBase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DerivedClassToBase_key" (Prelude.Just 0))
+{-# LINE 263 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DerivedClassToBase_key
+     =
+     'Angle.TField "derived"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+       ('Angle.TField "base"
+          (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 265 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DerivedClassToBase
+         where
+  type KeyType Glean.Schema.Python.Types.DerivedClassToBase =
+       Glean.Schema.Python.Types.DerivedClassToBase_key
+  getName _proxy = Glean.PredicateRef "python.DerivedClassToBase" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.derivedClassToBase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DerivedClassToBase x k
+  getFactKey = Glean.Schema.Python.Types.derivedClassToBase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 274 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DerivedClassToBase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 280 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.IsAbstract where
+  type KeyType Glean.Schema.Python.Types.IsAbstract =
+       Glean.Schema.Python.Types.Declaration
+  getName _proxy = Glean.PredicateRef "python.IsAbstract" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.isAbstract_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.IsAbstract x k
+  getFactKey = Glean.Schema.Python.Types.isAbstract_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 289 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.IsAbstract where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 295 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SNameWithDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SNameWithDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SNameWithDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SNameWithDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 304 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SNameWithDeclaration_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "sname"
+          (Glean.KeyType Glean.Schema.Python.Types.SName)
+          ('Angle.TNoFields))
+{-# LINE 306 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SNameWithDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.SNameWithDeclaration =
+       Glean.Schema.Python.Types.SNameWithDeclaration_key
+  getName _proxy = Glean.PredicateRef "python.SNameWithDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.sNameWithDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SNameWithDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.sNameWithDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 315 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SNameWithDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 321 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.BaseClassToDerived_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.BaseClassToDerived_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.BaseClassToDerived_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.BaseClassToDerived_key" (Prelude.Just 0))
+{-# LINE 330 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.BaseClassToDerived_key
+     =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+       ('Angle.TField "derived"
+          (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 332 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.BaseClassToDerived
+         where
+  type KeyType Glean.Schema.Python.Types.BaseClassToDerived =
+       Glean.Schema.Python.Types.BaseClassToDerived_key
+  getName _proxy = Glean.PredicateRef "python.BaseClassToDerived" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.baseClassToDerived_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.BaseClassToDerived x k
+  getFactKey = Glean.Schema.Python.Types.baseClassToDerived_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 341 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.BaseClassToDerived
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 347 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DefinitionsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DefinitionsByFile_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DefinitionsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DefinitionsByFile_key" (Prelude.Just 0))
+{-# LINE 358 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DefinitionsByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "definition" (Glean.Schema.Python.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 360 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DefinitionsByFile
+         where
+  type KeyType Glean.Schema.Python.Types.DefinitionsByFile =
+       Glean.Schema.Python.Types.DefinitionsByFile_key
+  getName _proxy = Glean.PredicateRef "python.DefinitionsByFile" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.definitionsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DefinitionsByFile x k
+  getFactKey = Glean.Schema.Python.Types.definitionsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 369 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DefinitionsByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 375 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Module_key where
+  buildRtsValue b (Glean.Schema.Python.Types.Module_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Python.Types.Module_key <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Module_key" (Prelude.Just 0))
+{-# LINE 382 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.Module_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 384 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.Module where
+  type KeyType Glean.Schema.Python.Types.Module =
+       Glean.Schema.Python.Types.Module_key
+  getName _proxy = Glean.PredicateRef "python.Module" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.module_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.Module x k
+  getFactKey = Glean.Schema.Python.Types.module_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 393 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Module where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 399 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationReference_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationReference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationReference_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationReference_key"
+           (Prelude.Just 0))
+{-# LINE 408 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationReference_key
+     =
+     'Angle.TField "target" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 410 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationReference
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationReference =
+       Glean.Schema.Python.Types.DeclarationReference_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationReference" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationReference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationReference x k
+  getFactKey = Glean.Schema.Python.Types.declarationReference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 419 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationReference
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 425 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ModuleDefinition_key
+         where
+  buildRtsValue b (Glean.Schema.Python.Types.ModuleDefinition_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ModuleDefinition_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ModuleDefinition_key" (Prelude.Just 0))
+{-# LINE 432 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ModuleDefinition_key =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Python.Types.Module)
+       ('Angle.TNoFields)
+{-# LINE 434 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ModuleDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.ModuleDefinition =
+       Glean.Schema.Python.Types.ModuleDefinition_key
+  getName _proxy = Glean.PredicateRef "python.ModuleDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.moduleDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ModuleDefinition x k
+  getFactKey = Glean.Schema.Python.Types.moduleDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 443 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ModuleDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 449 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStatement_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStatement_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStatement_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStatement_key" (Prelude.Just 0))
+{-# LINE 458 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ImportStatement_key =
+     'Angle.TField "from_name"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "as_name"
+          (Glean.KeyType Glean.Schema.Python.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 460 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ImportStatement
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStatement =
+       Glean.Schema.Python.Types.ImportStatement_key
+  getName _proxy = Glean.PredicateRef "python.ImportStatement" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStatement_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStatement x k
+  getFactKey = Glean.Schema.Python.Types.importStatement_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 469 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStatement where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 475 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchMethodByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchMethodByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchMethodByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchMethodByName_key" (Prelude.Just 0))
+{-# LINE 486 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.SearchMethodByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 488 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchMethodByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchMethodByName =
+       Glean.Schema.Python.Types.SearchMethodByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchMethodByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchMethodByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchMethodByName x k
+  getFactKey = Glean.Schema.Python.Types.searchMethodByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 497 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchMethodByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 503 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ContainedByTopLevelDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ContainedByTopLevelDeclaration_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ContainedByTopLevelDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ContainedByTopLevelDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 512 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ContainedByTopLevelDeclaration_key
+     =
+     'Angle.TField "container" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 514 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ContainedByTopLevelDeclaration
+         where
+  type KeyType
+         Glean.Schema.Python.Types.ContainedByTopLevelDeclaration
+       = Glean.Schema.Python.Types.ContainedByTopLevelDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "python.ContainedByTopLevelDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.containedByTopLevelDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ContainedByTopLevelDeclaration x k
+  getFactKey
+    = Glean.Schema.Python.Types.containedByTopLevelDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 524 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ContainedByTopLevelDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 530 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ModuleBySName
+         where
+  type KeyType Glean.Schema.Python.Types.ModuleBySName =
+       Glean.Schema.Python.Types.SName
+  type ValueType Glean.Schema.Python.Types.ModuleBySName =
+       Glean.Schema.Python.Types.ModuleBySName_value
+  getName _proxy = Glean.PredicateRef "python.ModuleBySName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.moduleBySName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.ModuleBySName x k v
+  getFactKey = Glean.Schema.Python.Types.moduleBySName_key
+  getFactValue = Glean.Schema.Python.Types.moduleBySName_value
+{-# LINE 541 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ModuleBySName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 547 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.XRefsViaNameByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.XRefsViaNameByFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.XRefsViaNameByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.XRefsViaNameByFile_key" (Prelude.Just 0))
+{-# LINE 556 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.XRefsViaNameByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xrefs" ([Glean.Schema.Python.Types.XRefViaName])
+          ('Angle.TNoFields))
+{-# LINE 558 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.XRefsViaNameByFile
+         where
+  type KeyType Glean.Schema.Python.Types.XRefsViaNameByFile =
+       Glean.Schema.Python.Types.XRefsViaNameByFile_key
+  getName _proxy = Glean.PredicateRef "python.XRefsViaNameByFile" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.xRefsViaNameByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.XRefsViaNameByFile x k
+  getFactKey = Glean.Schema.Python.Types.xRefsViaNameByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 567 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.XRefsViaNameByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 573 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ClassDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ClassDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ClassDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ClassDeclaration_key" (Prelude.Just 0))
+{-# LINE 582 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ClassDeclaration_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "bases"
+          (Prelude.Maybe [Glean.Schema.Python.Types.Name])
+          ('Angle.TNoFields))
+{-# LINE 584 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ClassDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.ClassDeclaration =
+       Glean.Schema.Python.Types.ClassDeclaration_key
+  getName _proxy = Glean.PredicateRef "python.ClassDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.classDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ClassDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.classDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 593 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ClassDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 599 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.IsTopLevelDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.IsTopLevelDefinition =
+       Glean.Schema.Python.Types.Definition
+  getName _proxy = Glean.PredicateRef "python.IsTopLevelDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.isTopLevelDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.IsTopLevelDefinition x k
+  getFactKey = Glean.Schema.Python.Types.isTopLevelDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 608 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.IsTopLevelDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 614 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStarStatement_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStarStatement_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStarStatement_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStarStatement_key" (Prelude.Just 0))
+{-# LINE 623 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ImportStarStatement_key
+     =
+     'Angle.TField "from_name"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "into_module"
+          (Glean.KeyType Glean.Schema.Python.Types.Module)
+          ('Angle.TNoFields))
+{-# LINE 625 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ImportStarStatement
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStarStatement =
+       Glean.Schema.Python.Types.ImportStarStatement_key
+  getName _proxy = Glean.PredicateRef "python.ImportStarStatement" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStarStatement_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStarStatement x k
+  getFactKey = Glean.Schema.Python.Types.importStarStatement_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 634 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStarStatement
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 640 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.MethodOverrides_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.MethodOverrides_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.MethodOverrides_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.MethodOverrides_key" (Prelude.Just 0))
+{-# LINE 649 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.MethodOverrides_key =
+     'Angle.TField "derived"
+       (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+       ('Angle.TField "base"
+          (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 651 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.MethodOverrides
+         where
+  type KeyType Glean.Schema.Python.Types.MethodOverrides =
+       Glean.Schema.Python.Types.MethodOverrides_key
+  getName _proxy = Glean.PredicateRef "python.MethodOverrides" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.methodOverrides_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.MethodOverrides x k
+  getFactKey = Glean.Schema.Python.Types.methodOverrides_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 660 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.MethodOverrides where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 666 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchClassByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchClassByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchClassByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchClassByName_key" (Prelude.Just 0))
+{-# LINE 677 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.SearchClassByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 679 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchClassByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchClassByName =
+       Glean.Schema.Python.Types.SearchClassByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchClassByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchClassByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchClassByName x k
+  getFactKey = Glean.Schema.Python.Types.searchClassByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 688 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchClassByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 694 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.MethodByLocalNameStr_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.MethodByLocalNameStr_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.MethodByLocalNameStr_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.MethodByLocalNameStr_key"
+           (Prelude.Just 0))
+{-# LINE 705 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.MethodByLocalNameStr_key
+     =
+     'Angle.TField "cls"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+       ('Angle.TField "method_local_name" (Data.Text.Text)
+          ('Angle.TField "method"
+             (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 707 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.MethodByLocalNameStr
+         where
+  type KeyType Glean.Schema.Python.Types.MethodByLocalNameStr =
+       Glean.Schema.Python.Types.MethodByLocalNameStr_key
+  getName _proxy = Glean.PredicateRef "python.MethodByLocalNameStr" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.methodByLocalNameStr_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.MethodByLocalNameStr x k
+  getFactKey = Glean.Schema.Python.Types.methodByLocalNameStr_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 716 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.MethodByLocalNameStr
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 722 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.VariableDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.VariableDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Python.Types.VariableDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.VariableDeclaration_key" (Prelude.Just 0))
+{-# LINE 729 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.VariableDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 731 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.VariableDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.VariableDeclaration =
+       Glean.Schema.Python.Types.VariableDeclaration_key
+  getName _proxy = Glean.PredicateRef "python.VariableDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.variableDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.VariableDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.variableDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 740 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.VariableDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 746 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchFunctionByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchFunctionByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchFunctionByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchFunctionByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 755 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchFunctionByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 757 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchFunctionByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Python.Types.SearchFunctionByLowerCaseName
+       = Glean.Schema.Python.Types.SearchFunctionByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchFunctionByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.searchFunctionByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchFunctionByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchFunctionByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 766 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchFunctionByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 772 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.VariableBySName
+         where
+  type KeyType Glean.Schema.Python.Types.VariableBySName =
+       Glean.Schema.Python.Types.SName
+  type ValueType Glean.Schema.Python.Types.VariableBySName =
+       Glean.Schema.Python.Types.VariableBySName_value
+  getName _proxy = Glean.PredicateRef "python.VariableBySName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.variableBySName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.VariableBySName x k v
+  getFactKey = Glean.Schema.Python.Types.variableBySName_key
+  getFactValue = Glean.Schema.Python.Types.variableBySName_value
+{-# LINE 783 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.VariableBySName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 789 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStarsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStarsByFile_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStarsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStarsByFile_key" (Prelude.Just 0))
+{-# LINE 800 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ImportStarsByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "declaration"
+             (Glean.KeyType Glean.Schema.Python.Types.ImportStarStatement)
+             ('Angle.TNoFields)))
+{-# LINE 802 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ImportStarsByFile
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStarsByFile =
+       Glean.Schema.Python.Types.ImportStarsByFile_key
+  getName _proxy = Glean.PredicateRef "python.ImportStarsByFile" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStarsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStarsByFile x k
+  getFactKey = Glean.Schema.Python.Types.importStarsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 811 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStarsByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 817 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.FileCall_key where
+  buildRtsValue b (Glean.Schema.Python.Types.FileCall_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.FileCall_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.FileCall_key" (Prelude.Just 0))
+{-# LINE 828 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.FileCall_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "callee_span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "call_args"
+             ([Glean.Schema.Python.Types.CallArgument])
+             ('Angle.TNoFields)))
+{-# LINE 830 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.FileCall where
+  type KeyType Glean.Schema.Python.Types.FileCall =
+       Glean.Schema.Python.Types.FileCall_key
+  getName _proxy = Glean.PredicateRef "python.FileCall" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.fileCall_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.FileCall x k
+  getFactKey = Glean.Schema.Python.Types.fileCall_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 839 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.FileCall where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 845 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStarLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStarLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStarLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStarLocation_key" (Prelude.Just 0))
+{-# LINE 856 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ImportStarLocation_key
+     =
+     'Angle.TField "import_star"
+       (Glean.KeyType Glean.Schema.Python.Types.ImportStarStatement)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 858 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ImportStarLocation
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStarLocation =
+       Glean.Schema.Python.Types.ImportStarLocation_key
+  getName _proxy = Glean.PredicateRef "python.ImportStarLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStarLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStarLocation x k
+  getFactKey = Glean.Schema.Python.Types.importStarLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 867 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ImportStarLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 873 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.SNameToName
+         where
+  type KeyType Glean.Schema.Python.Types.SNameToName =
+       Glean.Schema.Python.Types.SName
+  type ValueType Glean.Schema.Python.Types.SNameToName =
+       Glean.Schema.Python.Types.SNameToName_value
+  getName _proxy = Glean.PredicateRef "python.SNameToName" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.sNameToName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.SNameToName x k v
+  getFactKey = Glean.Schema.Python.Types.sNameToName_key
+  getFactValue = Glean.Schema.Python.Types.sNameToName_value
+{-# LINE 884 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SNameToName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 890 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationToName
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationToName =
+       Glean.Schema.Python.Types.Declaration
+  type ValueType Glean.Schema.Python.Types.DeclarationToName =
+       Glean.Schema.Python.Types.DeclarationToName_value
+  getName _proxy = Glean.PredicateRef "python.DeclarationToName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationToName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.DeclarationToName x k v
+  getFactKey = Glean.Schema.Python.Types.declarationToName_key
+  getFactValue = Glean.Schema.Python.Types.declarationToName_value
+{-# LINE 901 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationToName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 907 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchModuleByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchModuleByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchModuleByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchModuleByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 916 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchModuleByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 918 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchModuleByLowerCaseName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchModuleByLowerCaseName
+       = Glean.Schema.Python.Types.SearchModuleByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchModuleByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.searchModuleByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchModuleByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchModuleByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 927 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchModuleByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 933 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStatementByAsSName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStatementByAsSName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStatementByAsSName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStatementByAsSName_key"
+           (Prelude.Just 0))
+{-# LINE 942 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ImportStatementByAsSName_key
+     =
+     'Angle.TField "sname"
+       (Glean.KeyType Glean.Schema.Python.Types.SName)
+       ('Angle.TField "import_"
+          (Glean.KeyType Glean.Schema.Python.Types.ImportStatement)
+          ('Angle.TNoFields))
+{-# LINE 944 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ImportStatementByAsSName
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStatementByAsSName =
+       Glean.Schema.Python.Types.ImportStatementByAsSName_key
+  getName _proxy
+    = Glean.PredicateRef "python.ImportStatementByAsSName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStatementByAsSName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStatementByAsSName x k
+  getFactKey = Glean.Schema.Python.Types.importStatementByAsSName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 953 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStatementByAsSName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 959 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Contains_key where
+  buildRtsValue b (Glean.Schema.Python.Types.Contains_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.Contains_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Contains_key" (Prelude.Just 0))
+{-# LINE 968 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.Contains_key =
+     'Angle.TField "container" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "containee" (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 970 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.Contains where
+  type KeyType Glean.Schema.Python.Types.Contains =
+       Glean.Schema.Python.Types.Contains_key
+  getName _proxy = Glean.PredicateRef "python.Contains" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.contains_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.Contains x k
+  getFactKey = Glean.Schema.Python.Types.contains_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 979 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Contains where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 985 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.IsTopLevelDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.IsTopLevelDeclaration =
+       Glean.Schema.Python.Types.Declaration
+  getName _proxy
+    = Glean.PredicateRef "python.IsTopLevelDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.isTopLevelDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.IsTopLevelDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.isTopLevelDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 994 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.IsTopLevelDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1000 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.FunctionDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.FunctionDefinition_key x1 x2 x3 x4 x5 x6
+       x7 x8 x9 x10)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+         Glean.buildRtsValue b x6
+         Glean.buildRtsValue b x7
+         Glean.buildRtsValue b x8
+         Glean.buildRtsValue b x9
+         Glean.buildRtsValue b x10
+  decodeRtsValue
+    = Glean.Schema.Python.Types.FunctionDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.FunctionDefinition_key" (Prelude.Just 0))
+{-# LINE 1025 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.FunctionDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+       ('Angle.TField "is_async" (Prelude.Bool)
+          ('Angle.TField "returnsInfo"
+             (Prelude.Maybe Glean.Schema.Python.Types.TypeInfo)
+             ('Angle.TField "params" ([Glean.Schema.Python.Types.Parameter])
+                ('Angle.TField "posonly_params"
+                   (Prelude.Maybe [Glean.Schema.Python.Types.Parameter])
+                   ('Angle.TField "kwonly_params"
+                      (Prelude.Maybe [Glean.Schema.Python.Types.Parameter])
+                      ('Angle.TField "star_arg"
+                         (Prelude.Maybe Glean.Schema.Python.Types.Parameter)
+                         ('Angle.TField "star_kwarg"
+                            (Prelude.Maybe Glean.Schema.Python.Types.Parameter)
+                            ('Angle.TField "decorators"
+                               (Prelude.Maybe [Glean.Schema.Python.Types.Decorator])
+                               ('Angle.TField "container"
+                                  (Prelude.Maybe Glean.Schema.Python.Types.DeclarationContainer)
+                                  ('Angle.TNoFields))))))))))
+{-# LINE 1027 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.FunctionDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.FunctionDefinition =
+       Glean.Schema.Python.Types.FunctionDefinition_key
+  getName _proxy = Glean.PredicateRef "python.FunctionDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.functionDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.FunctionDefinition x k
+  getFactKey = Glean.Schema.Python.Types.functionDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1036 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.FunctionDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1042 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ContainedBy_key where
+  buildRtsValue b (Glean.Schema.Python.Types.ContainedBy_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ContainedBy_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ContainedBy_key" (Prelude.Just 0))
+{-# LINE 1051 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.ContainedBy_key =
+     'Angle.TField "containee" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "container" (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1053 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.ContainedBy
+         where
+  type KeyType Glean.Schema.Python.Types.ContainedBy =
+       Glean.Schema.Python.Types.ContainedBy_key
+  getName _proxy = Glean.PredicateRef "python.ContainedBy" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.containedBy_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ContainedBy x k
+  getFactKey = Glean.Schema.Python.Types.containedBy_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1062 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ContainedBy where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1068 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ResolveOriginalName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ResolveOriginalName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ResolveOriginalName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ResolveOriginalName_key" (Prelude.Just 0))
+{-# LINE 1077 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ResolveOriginalName_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "original_name"
+          (Glean.KeyType Glean.Schema.Python.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 1079 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ResolveOriginalName
+         where
+  type KeyType Glean.Schema.Python.Types.ResolveOriginalName =
+       Glean.Schema.Python.Types.ResolveOriginalName_key
+  getName _proxy = Glean.PredicateRef "python.ResolveOriginalName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.resolveOriginalName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ResolveOriginalName x k
+  getFactKey = Glean.Schema.Python.Types.resolveOriginalName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1088 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.ResolveOriginalName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1094 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.MethodOverriden_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.MethodOverriden_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.MethodOverriden_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.MethodOverriden_key" (Prelude.Just 0))
+{-# LINE 1103 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.MethodOverriden_key =
+     'Angle.TField "base"
+       (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+       ('Angle.TField "derived"
+          (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+          ('Angle.TNoFields))
+{-# LINE 1105 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.MethodOverriden
+         where
+  type KeyType Glean.Schema.Python.Types.MethodOverriden =
+       Glean.Schema.Python.Types.MethodOverriden_key
+  getName _proxy = Glean.PredicateRef "python.MethodOverriden" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.methodOverriden_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.MethodOverriden x k
+  getFactKey = Glean.Schema.Python.Types.methodOverriden_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1114 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.MethodOverriden where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1120 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationWithName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationWithName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationWithName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationWithName_key" (Prelude.Just 0))
+{-# LINE 1129 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationWithName_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "declaration"
+          (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1131 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationWithName
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationWithName =
+       Glean.Schema.Python.Types.DeclarationWithName_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationWithName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationWithName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationWithName x k
+  getFactKey = Glean.Schema.Python.Types.declarationWithName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1140 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationWithName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1146 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchVariableByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchVariableByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchVariableByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchVariableByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1155 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchVariableByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1157 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchVariableByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.Python.Types.SearchVariableByLowerCaseName
+       = Glean.Schema.Python.Types.SearchVariableByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchVariableByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.searchVariableByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchVariableByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchVariableByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1166 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchVariableByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1172 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationDocstring_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationDocstring_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationDocstring_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationDocstring_key"
+           (Prelude.Just 0))
+{-# LINE 1183 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationDocstring_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "location" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "pretty_text" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 1185 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationDocstring
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationDocstring =
+       Glean.Schema.Python.Types.DeclarationDocstring_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationDocstring" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationDocstring_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationDocstring x k
+  getFactKey = Glean.Schema.Python.Types.declarationDocstring_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1194 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationDocstring
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1200 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.StringLiteral
+         where
+  type KeyType Glean.Schema.Python.Types.StringLiteral =
+       Data.Text.Text
+  getName _proxy = Glean.PredicateRef "python.StringLiteral" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.stringLiteral_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.StringLiteral x k
+  getFactKey = Glean.Schema.Python.Types.stringLiteral_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1208 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.StringLiteral where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1214 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStatementByAsName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ImportStatementByAsName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ImportStatementByAsName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ImportStatementByAsName_key"
+           (Prelude.Just 0))
+{-# LINE 1223 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ImportStatementByAsName_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "import_"
+          (Glean.KeyType Glean.Schema.Python.Types.ImportStatement)
+          ('Angle.TNoFields))
+{-# LINE 1225 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ImportStatementByAsName
+         where
+  type KeyType Glean.Schema.Python.Types.ImportStatementByAsName =
+       Glean.Schema.Python.Types.ImportStatementByAsName_key
+  getName _proxy
+    = Glean.PredicateRef "python.ImportStatementByAsName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.importStatementByAsName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ImportStatementByAsName x k
+  getFactKey = Glean.Schema.Python.Types.importStatementByAsName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1234 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ImportStatementByAsName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1240 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchFunctionByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchFunctionByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchFunctionByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchFunctionByName_key"
+           (Prelude.Just 0))
+{-# LINE 1251 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchFunctionByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1253 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchFunctionByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchFunctionByName =
+       Glean.Schema.Python.Types.SearchFunctionByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchFunctionByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchFunctionByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchFunctionByName x k
+  getFactKey = Glean.Schema.Python.Types.searchFunctionByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1262 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchFunctionByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1268 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.FunctionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.FunctionDeclaration_key x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Python.Types.FunctionDeclaration_key <$>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.FunctionDeclaration_key" (Prelude.Just 0))
+{-# LINE 1275 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.FunctionDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TNoFields)
+{-# LINE 1277 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.FunctionDeclaration
+         where
+  type KeyType Glean.Schema.Python.Types.FunctionDeclaration =
+       Glean.Schema.Python.Types.FunctionDeclaration_key
+  getName _proxy = Glean.PredicateRef "python.FunctionDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.functionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.FunctionDeclaration x k
+  getFactKey = Glean.Schema.Python.Types.functionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1286 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.FunctionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1292 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ContainingTopLevelDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.ContainingTopLevelDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.ContainingTopLevelDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.ContainingTopLevelDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 1301 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.ContainingTopLevelDeclaration_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "container" (Glean.Schema.Python.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 1303 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.ContainingTopLevelDeclaration
+         where
+  type KeyType
+         Glean.Schema.Python.Types.ContainingTopLevelDeclaration
+       = Glean.Schema.Python.Types.ContainingTopLevelDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "python.ContainingTopLevelDeclaration" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.containingTopLevelDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.ContainingTopLevelDeclaration x k
+  getFactKey
+    = Glean.Schema.Python.Types.containingTopLevelDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1312 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.ContainingTopLevelDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1318 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchClassByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchClassByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchClassByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchClassByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1327 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchClassByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1329 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchClassByLowerCaseName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchClassByLowerCaseName =
+       Glean.Schema.Python.Types.SearchClassByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchClassByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchClassByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchClassByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchClassByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1338 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchClassByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1344 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SName_key where
+  buildRtsValue b (Glean.Schema.Python.Types.SName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SName_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SName_key" (Prelude.Just 0))
+{-# LINE 1353 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.SName_key =
+     'Angle.TField "local_name"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TNoFields))
+{-# LINE 1355 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.SName where
+  type KeyType Glean.Schema.Python.Types.SName =
+       Glean.Schema.Python.Types.SName_key
+  getName _proxy = Glean.PredicateRef "python.SName" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.sName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SName x k
+  getFactKey = Glean.Schema.Python.Types.sName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1364 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1370 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationLocation_key" (Prelude.Just 0))
+{-# LINE 1381 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.DeclarationLocation_key
+     =
+     'Angle.TField "declaration" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1383 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationLocation
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationLocation =
+       Glean.Schema.Python.Types.DeclarationLocation_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationLocation x k
+  getFactKey = Glean.Schema.Python.Types.declarationLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1392 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1398 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchVariableByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchVariableByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchVariableByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchVariableByName_key"
+           (Prelude.Just 0))
+{-# LINE 1409 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchVariableByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.VariableDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1411 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchVariableByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchVariableByName =
+       Glean.Schema.Python.Types.SearchVariableByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchVariableByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchVariableByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchVariableByName x k
+  getFactKey = Glean.Schema.Python.Types.searchVariableByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1420 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchVariableByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1426 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.VariableDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.VariableDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.VariableDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.VariableDefinition_key" (Prelude.Just 0))
+{-# LINE 1437 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.VariableDefinition_key
+     =
+     'Angle.TField "declaration"
+       (Glean.KeyType Glean.Schema.Python.Types.VariableDeclaration)
+       ('Angle.TField "typeInfo"
+          (Prelude.Maybe Glean.Schema.Python.Types.TypeInfo)
+          ('Angle.TField "container"
+             (Prelude.Maybe Glean.Schema.Python.Types.DeclarationContainer)
+             ('Angle.TNoFields)))
+{-# LINE 1439 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.VariableDefinition
+         where
+  type KeyType Glean.Schema.Python.Types.VariableDefinition =
+       Glean.Schema.Python.Types.VariableDefinition_key
+  getName _proxy = Glean.PredicateRef "python.VariableDefinition" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.variableDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.VariableDefinition x k
+  getFactKey = Glean.Schema.Python.Types.variableDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1448 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.VariableDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1454 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchFieldByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchFieldByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchFieldByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchFieldByName_key" (Prelude.Just 0))
+{-# LINE 1465 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.SearchFieldByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.VariableDeclaration)
+             ('Angle.TNoFields)))
+{-# LINE 1467 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchFieldByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchFieldByName =
+       Glean.Schema.Python.Types.SearchFieldByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchFieldByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchFieldByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchFieldByName x k
+  getFactKey = Glean.Schema.Python.Types.searchFieldByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1476 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchFieldByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1482 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchFieldByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchFieldByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchFieldByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchFieldByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1491 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchFieldByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1493 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchFieldByLowerCaseName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchFieldByLowerCaseName =
+       Glean.Schema.Python.Types.SearchFieldByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchFieldByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchFieldByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchFieldByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchFieldByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1502 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchFieldByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1508 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DirectXRefsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DirectXRefsByFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DirectXRefsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DirectXRefsByFile_key" (Prelude.Just 0))
+{-# LINE 1517 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DirectXRefsByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "xref" (Glean.Schema.Python.Types.DirectXRef)
+          ('Angle.TNoFields))
+{-# LINE 1519 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DirectXRefsByFile
+         where
+  type KeyType Glean.Schema.Python.Types.DirectXRefsByFile =
+       Glean.Schema.Python.Types.DirectXRefsByFile_key
+  getName _proxy = Glean.PredicateRef "python.DirectXRefsByFile" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.directXRefsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DirectXRefsByFile x k
+  getFactKey = Glean.Schema.Python.Types.directXRefsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1528 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DirectXRefsByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1534 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DeclarationsByFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationsByFile_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DeclarationsByFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationsByFile_key" (Prelude.Just 0))
+{-# LINE 1545 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DeclarationsByFile_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "declaration"
+             (Glean.Schema.Python.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 1547 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DeclarationsByFile
+         where
+  type KeyType Glean.Schema.Python.Types.DeclarationsByFile =
+       Glean.Schema.Python.Types.DeclarationsByFile_key
+  getName _proxy = Glean.PredicateRef "python.DeclarationsByFile" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.declarationsByFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DeclarationsByFile x k
+  getFactKey = Glean.Schema.Python.Types.declarationsByFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1556 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationsByFile
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1562 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.NameToSName
+         where
+  type KeyType Glean.Schema.Python.Types.NameToSName =
+       Glean.Schema.Python.Types.Name
+  type ValueType Glean.Schema.Python.Types.NameToSName =
+       Glean.Schema.Python.Types.NameToSName_value
+  getName _proxy = Glean.PredicateRef "python.NameToSName" 4
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.nameToSName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.NameToSName x k v
+  getFactKey = Glean.Schema.Python.Types.nameToSName_key
+  getFactValue = Glean.Schema.Python.Types.nameToSName_value
+{-# LINE 1573 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.NameToSName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1579 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.FunctionBySName
+         where
+  type KeyType Glean.Schema.Python.Types.FunctionBySName =
+       Glean.Schema.Python.Types.SName
+  type ValueType Glean.Schema.Python.Types.FunctionBySName =
+       Glean.Schema.Python.Types.FunctionBySName_value
+  getName _proxy = Glean.PredicateRef "python.FunctionBySName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.functionBySName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Python.Types.FunctionBySName x k v
+  getFactKey = Glean.Schema.Python.Types.functionBySName_key
+  getFactValue = Glean.Schema.Python.Types.functionBySName_value
+{-# LINE 1590 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.FunctionBySName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1596 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.XRefsViaNameByTarget_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.XRefsViaNameByTarget_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.XRefsViaNameByTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.XRefsViaNameByTarget_key"
+           (Prelude.Just 0))
+{-# LINE 1607 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.XRefsViaNameByTarget_key
+     =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "spans" ([Glean.Schema.Src.Types.ByteSpan])
+             ('Angle.TNoFields)))
+{-# LINE 1609 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.XRefsViaNameByTarget
+         where
+  type KeyType Glean.Schema.Python.Types.XRefsViaNameByTarget =
+       Glean.Schema.Python.Types.XRefsViaNameByTarget_key
+  getName _proxy = Glean.PredicateRef "python.XRefsViaNameByTarget" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.xRefsViaNameByTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.XRefsViaNameByTarget x k
+  getFactKey = Glean.Schema.Python.Types.xRefsViaNameByTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1618 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.XRefsViaNameByTarget
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1624 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchModuleByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchModuleByName_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchModuleByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchModuleByName_key" (Prelude.Just 0))
+{-# LINE 1635 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.SearchModuleByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "decl"
+             (Glean.KeyType Glean.Schema.Python.Types.Module)
+             ('Angle.TNoFields)))
+{-# LINE 1637 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchModuleByName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchModuleByName =
+       Glean.Schema.Python.Types.SearchModuleByName_key
+  getName _proxy = Glean.PredicateRef "python.SearchModuleByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.searchModuleByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchModuleByName x k
+  getFactKey = Glean.Schema.Python.Types.searchModuleByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1646 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.SearchModuleByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1652 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchMethodByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.SearchMethodByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.SearchMethodByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.SearchMethodByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1661 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Python.Types.SearchMethodByLowerCaseName_key
+     =
+     'Angle.TField "name_lowercase" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields))
+{-# LINE 1663 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.SearchMethodByLowerCaseName
+         where
+  type KeyType Glean.Schema.Python.Types.SearchMethodByLowerCaseName
+       = Glean.Schema.Python.Types.SearchMethodByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "python.SearchMethodByLowerCaseName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.Python.Types.searchMethodByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.SearchMethodByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.Python.Types.searchMethodByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1672 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.SearchMethodByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1678 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Python.Types.Name where
+  type KeyType Glean.Schema.Python.Types.Name = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "python.Name" 4
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Python.Types.name_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.Name x k
+  getFactKey = Glean.Schema.Python.Types.name_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1686 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Name where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1692 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Python.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DefinitionLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DefinitionLocation_key" (Prelude.Just 0))
+{-# LINE 1703 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DefinitionLocation_key
+     =
+     'Angle.TField "definition" (Glean.Schema.Python.Types.Definition)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+             ('Angle.TNoFields)))
+{-# LINE 1705 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Python.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.Python.Types.DefinitionLocation =
+       Glean.Schema.Python.Types.DefinitionLocation_key
+  getName _proxy = Glean.PredicateRef "python.DefinitionLocation" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Python.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Python.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.Python.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1714 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1720 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.XRefViaName where
+  buildRtsValue b (Glean.Schema.Python.Types.XRefViaName x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.XRefViaName <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.XRefViaName" (Prelude.Just 4))
+{-# LINE 1729 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.XRefViaName =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 1731 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Definition where
+  buildRtsValue b Glean.Schema.Python.Types.Definition_EMPTY
+    = Glean.buildRtsSelector b 4
+  buildRtsValue b (Glean.Schema.Python.Types.Definition_cls x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Definition_func x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Definition_variable x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Definition_module x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Python.Types.Definition_EMPTY)
+        [Glean.mapD Glean.Schema.Python.Types.Definition_cls,
+         Glean.mapD Glean.Schema.Python.Types.Definition_func,
+         Glean.mapD Glean.Schema.Python.Types.Definition_variable,
+         Glean.mapD Glean.Schema.Python.Types.Definition_module]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Definition" (Prelude.Just 4))
+{-# LINE 1755 "glean/schema/thrift/python_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Python.Types.Definition
+     =
+     'Angle.TField "cls"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDefinition)
+       ('Angle.TField "func"
+          (Glean.KeyType Glean.Schema.Python.Types.FunctionDefinition)
+          ('Angle.TField "variable"
+             (Glean.KeyType Glean.Schema.Python.Types.VariableDefinition)
+             ('Angle.TField "module"
+                (Glean.KeyType Glean.Schema.Python.Types.ModuleDefinition)
+                ('Angle.TNoFields))))
+{-# LINE 1757 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Parameter where
+  buildRtsValue b (Glean.Schema.Python.Types.Parameter x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.Parameter <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Parameter" (Prelude.Just 4))
+{-# LINE 1768 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.Parameter =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Python.Types.Name)
+       ('Angle.TField "typeInfo"
+          (Prelude.Maybe Glean.Schema.Python.Types.TypeInfo)
+          ('Angle.TField "value" (Prelude.Maybe Data.Text.Text)
+             ('Angle.TNoFields)))
+{-# LINE 1770 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.TypeInfo where
+  buildRtsValue b (Glean.Schema.Python.Types.TypeInfo x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.TypeInfo <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.TypeInfo" (Prelude.Just 4))
+{-# LINE 1779 "glean/schema/thrift/python_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Python.Types.TypeInfo
+     =
+     'Angle.TField "displayType"
+       (Glean.KeyType Glean.Schema.Python.Types.Type)
+       ('Angle.TField "xrefs" ([Glean.Schema.Python.Types.XRefViaName])
+          ('Angle.TNoFields))
+{-# LINE 1781 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Argument where
+  buildRtsValue b Glean.Schema.Python.Types.Argument_EMPTY
+    = Glean.buildRtsSelector b 1
+  buildRtsValue b (Glean.Schema.Python.Types.Argument_lit x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Python.Types.Argument_EMPTY)
+        [Glean.mapD Glean.Schema.Python.Types.Argument_lit]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Argument" (Prelude.Just 4))
+{-# LINE 1793 "glean/schema/thrift/python_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Python.Types.Argument =
+     'Angle.TField "lit"
+       (Glean.KeyType Glean.Schema.Python.Types.StringLiteral)
+       ('Angle.TNoFields)
+{-# LINE 1795 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DirectXRef where
+  buildRtsValue b (Glean.Schema.Python.Types.DirectXRef x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Python.Types.DirectXRef <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DirectXRef" (Prelude.Just 4))
+{-# LINE 1804 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.DirectXRef =
+     'Angle.TField "target" (Glean.Schema.Python.Types.Declaration)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 1806 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.Declaration where
+  buildRtsValue b Glean.Schema.Python.Types.Declaration_EMPTY
+    = Glean.buildRtsSelector b 5
+  buildRtsValue b (Glean.Schema.Python.Types.Declaration_cls x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Declaration_func x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Declaration_variable x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Declaration_imp x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Python.Types.Declaration_module x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Python.Types.Declaration_EMPTY)
+        [Glean.mapD Glean.Schema.Python.Types.Declaration_cls,
+         Glean.mapD Glean.Schema.Python.Types.Declaration_func,
+         Glean.mapD Glean.Schema.Python.Types.Declaration_variable,
+         Glean.mapD Glean.Schema.Python.Types.Declaration_imp,
+         Glean.mapD Glean.Schema.Python.Types.Declaration_module]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.Declaration" (Prelude.Just 4))
+{-# LINE 1834 "glean/schema/thrift/python_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Python.Types.Declaration
+     =
+     'Angle.TField "cls"
+       (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+       ('Angle.TField "func"
+          (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+          ('Angle.TField "variable"
+             (Glean.KeyType Glean.Schema.Python.Types.VariableDeclaration)
+             ('Angle.TField "imp"
+                (Glean.KeyType Glean.Schema.Python.Types.ImportStatement)
+                ('Angle.TField "module"
+                   (Glean.KeyType Glean.Schema.Python.Types.Module)
+                   ('Angle.TNoFields)))))
+{-# LINE 1836 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.CallArgument where
+  buildRtsValue b (Glean.Schema.Python.Types.CallArgument x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Python.Types.CallArgument <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.CallArgument" (Prelude.Just 4))
+{-# LINE 1847 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Python.Types.CallArgument =
+     'Angle.TField "label"
+       (Prelude.Maybe Glean.Schema.Python.Types.Name)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TField "argument"
+             (Prelude.Maybe Glean.Schema.Python.Types.Argument)
+             ('Angle.TNoFields)))
+{-# LINE 1849 "glean/schema/thrift/python_include.hs" #-}
+instance Glean.Type Glean.Schema.Python.Types.DeclarationContainer
+         where
+  buildRtsValue b
+    Glean.Schema.Python.Types.DeclarationContainer_EMPTY
+    = Glean.buildRtsSelector b 3
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationContainer_module x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationContainer_cls x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b
+    (Glean.Schema.Python.Types.DeclarationContainer_func x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD
+        (Prelude.pure Glean.Schema.Python.Types.DeclarationContainer_EMPTY)
+        [Glean.mapD Glean.Schema.Python.Types.DeclarationContainer_module,
+         Glean.mapD Glean.Schema.Python.Types.DeclarationContainer_cls,
+         Glean.mapD Glean.Schema.Python.Types.DeclarationContainer_func]
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "python.DeclarationContainer" (Prelude.Just 4))
+{-# LINE 1869 "glean/schema/thrift/python_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Python.Types.DeclarationContainer =
+     'Angle.TField "module"
+       (Glean.KeyType Glean.Schema.Python.Types.Module)
+       ('Angle.TField "cls"
+          (Glean.KeyType Glean.Schema.Python.Types.ClassDeclaration)
+          ('Angle.TField "func"
+             (Glean.KeyType Glean.Schema.Python.Types.FunctionDeclaration)
+             ('Angle.TNoFields)))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Scip/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Scip/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Scip/Types.hs
@@ -0,0 +1,6760 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/scip_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/scip_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/scip_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Scip/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Scip.Types
+       (pREDICATE_VERSIONS, SymbolName_id,
+        SymbolName(SymbolName, symbolName_id, symbolName_key),
+        SymbolKind_id,
+        SymbolKind(SymbolKind, symbolKind_id, symbolKind_key),
+        SymbolDocumentation_id,
+        SymbolDocumentation(SymbolDocumentation, symbolDocumentation_id,
+                            symbolDocumentation_key),
+        SymbolDisplayName_id,
+        SymbolDisplayName(SymbolDisplayName, symbolDisplayName_id,
+                          symbolDisplayName_key),
+        Symbol_id, Symbol(Symbol, symbol_id, symbol_key),
+        ReferenceTarget_id,
+        ReferenceTarget(ReferenceTarget, referenceTarget_id,
+                        referenceTarget_key),
+        ReferenceLocation_id,
+        ReferenceLocation(ReferenceLocation, referenceLocation_id,
+                          referenceLocation_key),
+        Reference_id, Reference(Reference, reference_id, reference_key),
+        Metadata_id, Metadata(Metadata, metadata_id, metadata_key),
+        LocalName_id, LocalName(LocalName, localName_id, localName_key),
+        IsImplemented_id,
+        IsImplemented(IsImplemented, isImplemented_id, isImplemented_key),
+        IsImplementation_id,
+        IsImplementation(IsImplementation, isImplementation_id,
+                         isImplementation_key),
+        FileXLangSymbolRef_id,
+        FileXLangSymbolRef(FileXLangSymbolRef, fileXLangSymbolRef_id,
+                           fileXLangSymbolRef_key),
+        FileRange_id, FileRange(FileRange, fileRange_id, fileRange_key),
+        FileLanguage_id,
+        FileLanguage(FileLanguage, fileLanguage_id, fileLanguage_key),
+        EntityDefinition_id,
+        EntityDefinition(EntityDefinition, entityDefinition_id,
+                         entityDefinition_key),
+        EntityKind_id,
+        EntityKind(EntityKind, entityKind_id, entityKind_key),
+        EntityLocation_id,
+        EntityLocation(EntityLocation, entityLocation_id,
+                       entityLocation_key),
+        EntityUses_id,
+        EntityUses(EntityUses, entityUses_id, entityUses_key),
+        FileEntityXRefLocation_id,
+        FileEntityXRefLocation(FileEntityXRefLocation,
+                               fileEntityXRefLocation_id, fileEntityXRefLocation_key),
+        ResolveLocation_id,
+        ResolveLocation(ResolveLocation, resolveLocation_id,
+                        resolveLocation_key),
+        SearchByNameKind_id,
+        SearchByNameKind(SearchByNameKind, searchByNameKind_id,
+                         searchByNameKind_key),
+        SearchBySymbol_id,
+        SearchBySymbol(SearchBySymbol, searchBySymbol_id,
+                       searchBySymbol_key),
+        TagDefinition_id,
+        TagDefinition(TagDefinition, tagDefinition_id, tagDefinition_key),
+        Documentation_id,
+        Documentation(Documentation, documentation_id, documentation_key),
+        DisplayNameSymbol_id,
+        DisplayNameSymbol(DisplayNameSymbol, displayNameSymbol_id,
+                          displayNameSymbol_key),
+        DisplayName_id,
+        DisplayName(DisplayName, displayName_id, displayName_key),
+        DefinitionUses_id,
+        DefinitionUses(DefinitionUses, definitionUses_id,
+                       definitionUses_key),
+        DefinitionName_id,
+        DefinitionName(DefinitionName, definitionName_id,
+                       definitionName_key),
+        DefinitionLocation_id,
+        DefinitionLocation(DefinitionLocation, definitionLocation_id,
+                           definitionLocation_key),
+        DefinitionDocumentation_id,
+        DefinitionDocumentation(DefinitionDocumentation,
+                                definitionDocumentation_id, definitionDocumentation_key),
+        Definition_id,
+        Definition(Definition, definition_id, definition_key),
+        TextEncoding(TextEncoding_UnspecifiedTextEncoding,
+                     TextEncoding_UTF8, TextEncoding_UTF16, TextEncoding__UNKNOWN),
+        SymbolName_key(SymbolName_key, symbolName_key_symbol,
+                       symbolName_key_name),
+        SymbolKind_key(SymbolKind_key, symbolKind_key_symbol,
+                       symbolKind_key_kind),
+        SymbolDocumentation_key(SymbolDocumentation_key,
+                                symbolDocumentation_key_symbol, symbolDocumentation_key_docs),
+        SymbolDisplayName_key(SymbolDisplayName_key,
+                              symbolDisplayName_key_symbol, symbolDisplayName_key_displayName),
+        SomeEntity(SomeEntity, someEntity_defn),
+        ReferenceTarget_key(ReferenceTarget_key, referenceTarget_key_xref,
+                            referenceTarget_key_target),
+        ReferenceLocation_key(ReferenceLocation_key,
+                              referenceLocation_key_file, referenceLocation_key_range,
+                              referenceLocation_key_xref),
+        Reference_key(Reference_key, reference_key_symbol,
+                      reference_key_location),
+        ProtocolVersion(ProtocolVersion_UnspecifiedProtocolVersion,
+                        ProtocolVersion__UNKNOWN),
+        Metadata_key(Metadata_key, metadata_key_version,
+                     metadata_key_toolInfo, metadata_key_projectRoot,
+                     metadata_key_textEncoding),
+        Location(Location, location_file, location_location,
+                 location_name),
+        IsImplemented_key(IsImplemented_key, isImplemented_key_implemented,
+                          isImplemented_key_symbol),
+        IsImplementation_key(IsImplementation_key,
+                             isImplementation_key_symbol, isImplementation_key_implemented),
+        FileXLangSymbolRef_key(FileXLangSymbolRef_key,
+                               fileXLangSymbolRef_key_file, fileXLangSymbolRef_key_range,
+                               fileXLangSymbolRef_key_target),
+        FileRange_key(FileRange_key, fileRange_key_file,
+                      fileRange_key_range),
+        FileLanguage_key(FileLanguage_key, fileLanguage_key_file,
+                         fileLanguage_key_language),
+        Entity(Entity_EMPTY, Entity_rust, Entity_go, Entity_typescript,
+               Entity_java, Entity_kotlin, Entity_swift),
+        EntityDefinition_key(EntityDefinition_key,
+                             entityDefinition_key_entity, entityDefinition_key_defn),
+        EntityKind_key(EntityKind_key, entityKind_key_entity,
+                       entityKind_key_kind),
+        EntityLocation_key(EntityLocation_key, entityLocation_key_entity,
+                           entityLocation_key_location),
+        EntityUses_key(EntityUses_key, entityUses_key_target,
+                       entityUses_key_file, entityUses_key_range),
+        FileEntityXRefLocation_key(FileEntityXRefLocation_key,
+                                   fileEntityXRefLocation_key_file,
+                                   fileEntityXRefLocation_key_source,
+                                   fileEntityXRefLocation_key_target,
+                                   fileEntityXRefLocation_key_entity),
+        ResolveLocation_key(ResolveLocation_key,
+                            resolveLocation_key_location, resolveLocation_key_entity),
+        SearchByNameKind_key(SearchByNameKind_key,
+                             searchByNameKind_key_name, searchByNameKind_key_kind,
+                             searchByNameKind_key_entity),
+        SearchBySymbol_key(SearchBySymbol_key, searchBySymbol_key_symbol,
+                           searchBySymbol_key_entity),
+        TagDefinition_key(TagDefinition_key, tagDefinition_key_language,
+                          tagDefinition_key_defn, tagDefinition_key_entity),
+        DisplayNameSymbol_key(DisplayNameSymbol_key,
+                              displayNameSymbol_key_displayName, displayNameSymbol_key_symbol),
+        DefinitionUses_key(DefinitionUses_key, definitionUses_key_target,
+                           definitionUses_key_xref),
+        DefinitionName_key(DefinitionName_key, definitionName_key_defn,
+                           definitionName_key_docs),
+        DefinitionLocation_key(DefinitionLocation_key,
+                               definitionLocation_key_file, definitionLocation_key_range,
+                               definitionLocation_key_defn),
+        DefinitionDocumentation_key(DefinitionDocumentation_key,
+                                    definitionDocumentation_key_defn,
+                                    definitionDocumentation_key_docs),
+        Definition_key(Definition_key, definition_key_symbol,
+                       definition_key_location))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.LsifTypes.Types
+       as Glean.Schema.LsifTypes
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Aeson ((.:), (.=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Schema.LsifTypes.Types
+{-# LINE 16 "glean/schema/thrift/scip_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 231 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Scip/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("EntityLocation", 1), ("ReferenceTarget", 1),
+       ("FileEntityXRefLocation", 1), ("IsImplementation", 1),
+       ("SymbolName", 1), ("DefinitionName", 1), ("SearchByNameKind", 1),
+       ("FileRange", 1), ("SymbolKind", 1), ("ResolveLocation", 1),
+       ("EntityUses", 1), ("DefinitionLocation", 1),
+       ("SearchBySymbol", 1), ("FileXLangSymbolRef", 1),
+       ("ReferenceLocation", 1), ("SymbolDocumentation", 1),
+       ("LocalName", 1), ("Reference", 1), ("DisplayName", 1),
+       ("Metadata", 1), ("Definition", 1), ("IsImplemented", 1),
+       ("DisplayNameSymbol", 1), ("FileLanguage", 1),
+       ("Documentation", 1), ("Symbol", 1),
+       ("DefinitionDocumentation", 1), ("SymbolDisplayName", 1),
+       ("TagDefinition", 1), ("EntityDefinition", 1),
+       ("DefinitionUses", 1), ("EntityKind", 1)]
+
+type SymbolName_id = Glean.Id
+
+data SymbolName = SymbolName{symbolName_id ::
+                             {-# UNPACK #-} !SymbolName_id,
+                             symbolName_key :: Prelude.Maybe SymbolName_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolName where
+  toJSON (SymbolName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolName where
+  buildStruct _proxy (SymbolName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolName where
+  rnf (SymbolName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolName where
+  def = SymbolName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolName where
+  hashWithSalt __salt (SymbolName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SymbolKind_id = Glean.Id
+
+data SymbolKind = SymbolKind{symbolKind_id ::
+                             {-# UNPACK #-} !SymbolKind_id,
+                             symbolKind_key :: Prelude.Maybe SymbolKind_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolKind where
+  toJSON (SymbolKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolKind where
+  buildStruct _proxy (SymbolKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolKind where
+  rnf (SymbolKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolKind where
+  def = SymbolKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolKind where
+  hashWithSalt __salt (SymbolKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SymbolDocumentation_id = Glean.Id
+
+data SymbolDocumentation = SymbolDocumentation{symbolDocumentation_id
+                                               :: {-# UNPACK #-} !SymbolDocumentation_id,
+                                               symbolDocumentation_key ::
+                                               Prelude.Maybe SymbolDocumentation_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolDocumentation where
+  toJSON (SymbolDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolDocumentation where
+  buildStruct _proxy (SymbolDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolDocumentation where
+  rnf (SymbolDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolDocumentation where
+  def = SymbolDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolDocumentation where
+  hashWithSalt __salt (SymbolDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SymbolDisplayName_id = Glean.Id
+
+data SymbolDisplayName = SymbolDisplayName{symbolDisplayName_id ::
+                                           {-# UNPACK #-} !SymbolDisplayName_id,
+                                           symbolDisplayName_key ::
+                                           Prelude.Maybe SymbolDisplayName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolDisplayName where
+  toJSON (SymbolDisplayName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolDisplayName where
+  buildStruct _proxy (SymbolDisplayName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SymbolDisplayName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolDisplayName where
+  rnf (SymbolDisplayName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SymbolDisplayName where
+  def = SymbolDisplayName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SymbolDisplayName where
+  hashWithSalt __salt (SymbolDisplayName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Symbol_id = Glean.Id
+
+data Symbol = Symbol{symbol_id :: {-# UNPACK #-} !Symbol_id,
+                     symbol_key :: Prelude.Maybe Text.Text}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Symbol where
+  toJSON (Symbol __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Symbol where
+  buildStruct _proxy (Symbol __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Symbol __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Symbol where
+  rnf (Symbol __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Symbol where
+  def = Symbol Default.def Prelude.Nothing
+
+instance Hashable.Hashable Symbol where
+  hashWithSalt __salt (Symbol _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ReferenceTarget_id = Glean.Id
+
+data ReferenceTarget = ReferenceTarget{referenceTarget_id ::
+                                       {-# UNPACK #-} !ReferenceTarget_id,
+                                       referenceTarget_key :: Prelude.Maybe ReferenceTarget_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferenceTarget where
+  toJSON (ReferenceTarget __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferenceTarget where
+  buildStruct _proxy (ReferenceTarget __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ReferenceTarget __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferenceTarget where
+  rnf (ReferenceTarget __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ReferenceTarget where
+  def = ReferenceTarget Default.def Prelude.Nothing
+
+instance Hashable.Hashable ReferenceTarget where
+  hashWithSalt __salt (ReferenceTarget _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ReferenceLocation_id = Glean.Id
+
+data ReferenceLocation = ReferenceLocation{referenceLocation_id ::
+                                           {-# UNPACK #-} !ReferenceLocation_id,
+                                           referenceLocation_key ::
+                                           Prelude.Maybe ReferenceLocation_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferenceLocation where
+  toJSON (ReferenceLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferenceLocation where
+  buildStruct _proxy (ReferenceLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ReferenceLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferenceLocation where
+  rnf (ReferenceLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ReferenceLocation where
+  def = ReferenceLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ReferenceLocation where
+  hashWithSalt __salt (ReferenceLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Reference_id = Glean.Id
+
+data Reference = Reference{reference_id ::
+                           {-# UNPACK #-} !Reference_id,
+                           reference_key :: Prelude.Maybe Reference_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Reference where
+  toJSON (Reference __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Reference where
+  buildStruct _proxy (Reference __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Reference __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Reference where
+  rnf (Reference __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Reference where
+  def = Reference Default.def Prelude.Nothing
+
+instance Hashable.Hashable Reference where
+  hashWithSalt __salt (Reference _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Metadata_id = Glean.Id
+
+data Metadata = Metadata{metadata_id ::
+                         {-# UNPACK #-} !Metadata_id,
+                         metadata_key :: Prelude.Maybe Metadata_key}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Metadata where
+  toJSON (Metadata __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Metadata where
+  buildStruct _proxy (Metadata __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Metadata __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Metadata where
+  rnf (Metadata __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Metadata where
+  def = Metadata Default.def Prelude.Nothing
+
+instance Hashable.Hashable Metadata where
+  hashWithSalt __salt (Metadata _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LocalName_id = Glean.Id
+
+data LocalName = LocalName{localName_id ::
+                           {-# UNPACK #-} !LocalName_id,
+                           localName_key :: Prelude.Maybe Text.Text}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LocalName where
+  toJSON (LocalName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LocalName where
+  buildStruct _proxy (LocalName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LocalName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LocalName where
+  rnf (LocalName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LocalName where
+  def = LocalName Default.def Prelude.Nothing
+
+instance Hashable.Hashable LocalName where
+  hashWithSalt __salt (LocalName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsImplemented_id = Glean.Id
+
+data IsImplemented = IsImplemented{isImplemented_id ::
+                                   {-# UNPACK #-} !IsImplemented_id,
+                                   isImplemented_key :: Prelude.Maybe IsImplemented_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsImplemented where
+  toJSON (IsImplemented __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsImplemented where
+  buildStruct _proxy (IsImplemented __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsImplemented __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsImplemented where
+  rnf (IsImplemented __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsImplemented where
+  def = IsImplemented Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsImplemented where
+  hashWithSalt __salt (IsImplemented _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IsImplementation_id = Glean.Id
+
+data IsImplementation = IsImplementation{isImplementation_id ::
+                                         {-# UNPACK #-} !IsImplementation_id,
+                                         isImplementation_key :: Prelude.Maybe IsImplementation_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsImplementation where
+  toJSON (IsImplementation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IsImplementation where
+  buildStruct _proxy (IsImplementation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IsImplementation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsImplementation where
+  rnf (IsImplementation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IsImplementation where
+  def = IsImplementation Default.def Prelude.Nothing
+
+instance Hashable.Hashable IsImplementation where
+  hashWithSalt __salt (IsImplementation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileXLangSymbolRef_id = Glean.Id
+
+data FileXLangSymbolRef = FileXLangSymbolRef{fileXLangSymbolRef_id
+                                             :: {-# UNPACK #-} !FileXLangSymbolRef_id,
+                                             fileXLangSymbolRef_key ::
+                                             Prelude.Maybe FileXLangSymbolRef_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXLangSymbolRef where
+  toJSON (FileXLangSymbolRef __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXLangSymbolRef where
+  buildStruct _proxy (FileXLangSymbolRef __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileXLangSymbolRef __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXLangSymbolRef where
+  rnf (FileXLangSymbolRef __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileXLangSymbolRef where
+  def = FileXLangSymbolRef Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileXLangSymbolRef where
+  hashWithSalt __salt (FileXLangSymbolRef _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileRange_id = Glean.Id
+
+data FileRange = FileRange{fileRange_id ::
+                           {-# UNPACK #-} !FileRange_id,
+                           fileRange_key :: Prelude.Maybe FileRange_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileRange where
+  toJSON (FileRange __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileRange where
+  buildStruct _proxy (FileRange __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileRange __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileRange where
+  rnf (FileRange __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileRange where
+  def = FileRange Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileRange where
+  hashWithSalt __salt (FileRange _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileLanguage_id = Glean.Id
+
+data FileLanguage = FileLanguage{fileLanguage_id ::
+                                 {-# UNPACK #-} !FileLanguage_id,
+                                 fileLanguage_key :: Prelude.Maybe FileLanguage_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLanguage where
+  toJSON (FileLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLanguage where
+  buildStruct _proxy (FileLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileLanguage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLanguage where
+  rnf (FileLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileLanguage where
+  def = FileLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileLanguage where
+  hashWithSalt __salt (FileLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityDefinition_id = Glean.Id
+
+data EntityDefinition = EntityDefinition{entityDefinition_id ::
+                                         {-# UNPACK #-} !EntityDefinition_id,
+                                         entityDefinition_key :: Prelude.Maybe EntityDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityDefinition where
+  toJSON (EntityDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityDefinition where
+  buildStruct _proxy (EntityDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityDefinition where
+  rnf (EntityDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityDefinition where
+  def = EntityDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityDefinition where
+  hashWithSalt __salt (EntityDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityKind_id = Glean.Id
+
+data EntityKind = EntityKind{entityKind_id ::
+                             {-# UNPACK #-} !EntityKind_id,
+                             entityKind_key :: Prelude.Maybe EntityKind_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind where
+  toJSON (EntityKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind where
+  buildStruct _proxy (EntityKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind where
+  rnf (EntityKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityKind where
+  def = EntityKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityKind where
+  hashWithSalt __salt (EntityKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityLocation_id = Glean.Id
+
+data EntityLocation = EntityLocation{entityLocation_id ::
+                                     {-# UNPACK #-} !EntityLocation_id,
+                                     entityLocation_key :: Prelude.Maybe EntityLocation_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation where
+  toJSON (EntityLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation where
+  buildStruct _proxy (EntityLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation where
+  rnf (EntityLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityLocation where
+  def = EntityLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityLocation where
+  hashWithSalt __salt (EntityLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type EntityUses_id = Glean.Id
+
+data EntityUses = EntityUses{entityUses_id ::
+                             {-# UNPACK #-} !EntityUses_id,
+                             entityUses_key :: Prelude.Maybe EntityUses_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses where
+  toJSON (EntityUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses where
+  buildStruct _proxy (EntityUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (EntityUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses where
+  rnf (EntityUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default EntityUses where
+  def = EntityUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable EntityUses where
+  hashWithSalt __salt (EntityUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileEntityXRefLocation_id = Glean.Id
+
+data FileEntityXRefLocation = FileEntityXRefLocation{fileEntityXRefLocation_id
+                                                     :: {-# UNPACK #-} !FileEntityXRefLocation_id,
+                                                     fileEntityXRefLocation_key ::
+                                                     Prelude.Maybe FileEntityXRefLocation_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocation where
+  toJSON (FileEntityXRefLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocation where
+  buildStruct _proxy
+    (FileEntityXRefLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FileEntityXRefLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocation where
+  rnf (FileEntityXRefLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocation where
+  def = FileEntityXRefLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileEntityXRefLocation where
+  hashWithSalt __salt (FileEntityXRefLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ResolveLocation_id = Glean.Id
+
+data ResolveLocation = ResolveLocation{resolveLocation_id ::
+                                       {-# UNPACK #-} !ResolveLocation_id,
+                                       resolveLocation_key :: Prelude.Maybe ResolveLocation_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation where
+  toJSON (ResolveLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation where
+  buildStruct _proxy (ResolveLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ResolveLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation where
+  rnf (ResolveLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ResolveLocation where
+  def = ResolveLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable ResolveLocation where
+  hashWithSalt __salt (ResolveLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByNameKind_id = Glean.Id
+
+data SearchByNameKind = SearchByNameKind{searchByNameKind_id ::
+                                         {-# UNPACK #-} !SearchByNameKind_id,
+                                         searchByNameKind_key :: Prelude.Maybe SearchByNameKind_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameKind where
+  toJSON (SearchByNameKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameKind where
+  buildStruct _proxy (SearchByNameKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByNameKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameKind where
+  rnf (SearchByNameKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByNameKind where
+  def = SearchByNameKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByNameKind where
+  hashWithSalt __salt (SearchByNameKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchBySymbol_id = Glean.Id
+
+data SearchBySymbol = SearchBySymbol{searchBySymbol_id ::
+                                     {-# UNPACK #-} !SearchBySymbol_id,
+                                     searchBySymbol_key :: Prelude.Maybe SearchBySymbol_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchBySymbol where
+  toJSON (SearchBySymbol __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchBySymbol where
+  buildStruct _proxy (SearchBySymbol __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchBySymbol __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchBySymbol where
+  rnf (SearchBySymbol __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchBySymbol where
+  def = SearchBySymbol Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchBySymbol where
+  hashWithSalt __salt (SearchBySymbol _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type TagDefinition_id = Glean.Id
+
+data TagDefinition = TagDefinition{tagDefinition_id ::
+                                   {-# UNPACK #-} !TagDefinition_id,
+                                   tagDefinition_key :: Prelude.Maybe TagDefinition_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TagDefinition where
+  toJSON (TagDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct TagDefinition where
+  buildStruct _proxy (TagDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (TagDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData TagDefinition where
+  rnf (TagDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default TagDefinition where
+  def = TagDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable TagDefinition where
+  hashWithSalt __salt (TagDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Documentation_id = Glean.Id
+
+data Documentation = Documentation{documentation_id ::
+                                   {-# UNPACK #-} !Documentation_id,
+                                   documentation_key :: Prelude.Maybe Text.Text}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Documentation where
+  toJSON (Documentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Documentation where
+  buildStruct _proxy (Documentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Documentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Documentation where
+  rnf (Documentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Documentation where
+  def = Documentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable Documentation where
+  hashWithSalt __salt (Documentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DisplayNameSymbol_id = Glean.Id
+
+data DisplayNameSymbol = DisplayNameSymbol{displayNameSymbol_id ::
+                                           {-# UNPACK #-} !DisplayNameSymbol_id,
+                                           displayNameSymbol_key ::
+                                           Prelude.Maybe DisplayNameSymbol_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DisplayNameSymbol where
+  toJSON (DisplayNameSymbol __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DisplayNameSymbol where
+  buildStruct _proxy (DisplayNameSymbol __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DisplayNameSymbol __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DisplayNameSymbol where
+  rnf (DisplayNameSymbol __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DisplayNameSymbol where
+  def = DisplayNameSymbol Default.def Prelude.Nothing
+
+instance Hashable.Hashable DisplayNameSymbol where
+  hashWithSalt __salt (DisplayNameSymbol _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DisplayName_id = Glean.Id
+
+data DisplayName = DisplayName{displayName_id ::
+                               {-# UNPACK #-} !DisplayName_id,
+                               displayName_key :: Prelude.Maybe Text.Text}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DisplayName where
+  toJSON (DisplayName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DisplayName where
+  buildStruct _proxy (DisplayName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DisplayName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DisplayName where
+  rnf (DisplayName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DisplayName where
+  def = DisplayName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DisplayName where
+  hashWithSalt __salt (DisplayName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionUses_id = Glean.Id
+
+data DefinitionUses = DefinitionUses{definitionUses_id ::
+                                     {-# UNPACK #-} !DefinitionUses_id,
+                                     definitionUses_key :: Prelude.Maybe DefinitionUses_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionUses where
+  toJSON (DefinitionUses __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionUses where
+  buildStruct _proxy (DefinitionUses __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionUses __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionUses where
+  rnf (DefinitionUses __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionUses where
+  def = DefinitionUses Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionUses where
+  hashWithSalt __salt (DefinitionUses _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionName_id = Glean.Id
+
+data DefinitionName = DefinitionName{definitionName_id ::
+                                     {-# UNPACK #-} !DefinitionName_id,
+                                     definitionName_key :: Prelude.Maybe DefinitionName_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionName where
+  toJSON (DefinitionName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionName where
+  buildStruct _proxy (DefinitionName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionName where
+  rnf (DefinitionName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionName where
+  def = DefinitionName Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionName where
+  hashWithSalt __salt (DefinitionName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionLocation_id = Glean.Id
+
+data DefinitionLocation = DefinitionLocation{definitionLocation_id
+                                             :: {-# UNPACK #-} !DefinitionLocation_id,
+                                             definitionLocation_key ::
+                                             Prelude.Maybe DefinitionLocation_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation where
+  toJSON (DefinitionLocation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation where
+  buildStruct _proxy (DefinitionLocation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionLocation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation where
+  rnf (DefinitionLocation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation where
+  def = DefinitionLocation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionLocation where
+  hashWithSalt __salt (DefinitionLocation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionDocumentation_id = Glean.Id
+
+data DefinitionDocumentation = DefinitionDocumentation{definitionDocumentation_id
+                                                       ::
+                                                       {-# UNPACK #-} !DefinitionDocumentation_id,
+                                                       definitionDocumentation_key ::
+                                                       Prelude.Maybe DefinitionDocumentation_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionDocumentation where
+  toJSON (DefinitionDocumentation __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionDocumentation where
+  buildStruct _proxy
+    (DefinitionDocumentation __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (DefinitionDocumentation __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionDocumentation where
+  rnf (DefinitionDocumentation __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionDocumentation where
+  def = DefinitionDocumentation Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionDocumentation where
+  hashWithSalt __salt (DefinitionDocumentation _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type Definition_id = Glean.Id
+
+data Definition = Definition{definition_id ::
+                             {-# UNPACK #-} !Definition_id,
+                             definition_key :: Prelude.Maybe Definition_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON (Definition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy (Definition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Definition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition where
+  rnf (Definition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Definition where
+  def = Definition Default.def Prelude.Nothing
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt (Definition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data TextEncoding = TextEncoding_UnspecifiedTextEncoding
+                  | TextEncoding_UTF8
+                  | TextEncoding_UTF16
+                  | TextEncoding__UNKNOWN Prelude.Int
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TextEncoding where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData TextEncoding where
+  rnf __TextEncoding = Prelude.seq __TextEncoding ()
+
+instance Default.Default TextEncoding where
+  def = TextEncoding_UnspecifiedTextEncoding
+
+instance Hashable.Hashable TextEncoding where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum TextEncoding where
+  toThriftEnum 0 = TextEncoding_UnspecifiedTextEncoding
+  toThriftEnum 1 = TextEncoding_UTF8
+  toThriftEnum 2 = TextEncoding_UTF16
+  toThriftEnum val = TextEncoding__UNKNOWN val
+  fromThriftEnum TextEncoding_UnspecifiedTextEncoding = 0
+  fromThriftEnum TextEncoding_UTF8 = 1
+  fromThriftEnum TextEncoding_UTF16 = 2
+  fromThriftEnum (TextEncoding__UNKNOWN val) = val
+  allThriftEnumValues
+    = [TextEncoding_UnspecifiedTextEncoding, TextEncoding_UTF8,
+       TextEncoding_UTF16]
+  toThriftEnumEither 0
+    = Prelude.Right TextEncoding_UnspecifiedTextEncoding
+  toThriftEnumEither 1 = Prelude.Right TextEncoding_UTF8
+  toThriftEnumEither 2 = Prelude.Right TextEncoding_UTF16
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum TextEncoding: "
+           ++ Prelude.show val)
+
+data SymbolName_key = SymbolName_key{symbolName_key_symbol ::
+                                     Symbol,
+                                     symbolName_key_name :: LocalName}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolName_key where
+  toJSON (SymbolName_key __field__symbol __field__name)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolName_key where
+  buildStruct _proxy (SymbolName_key __field__symbol __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (SymbolName_key __val__symbol __val__name)
+              _idMap = HashMap.fromList [("symbol", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolName_key where
+  rnf (SymbolName_key __field__symbol __field__name)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default SymbolName_key where
+  def = SymbolName_key Default.def Default.def
+
+instance Hashable.Hashable SymbolName_key where
+  hashWithSalt __salt (SymbolName_key _symbol _name)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _name
+
+data SymbolKind_key = SymbolKind_key{symbolKind_key_symbol ::
+                                     Symbol,
+                                     symbolKind_key_kind :: Glean.Schema.LsifTypes.SymbolKind}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolKind_key where
+  toJSON (SymbolKind_key __field__symbol __field__kind)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolKind_key where
+  buildStruct _proxy (SymbolKind_key __field__symbol __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (SymbolKind_key __val__symbol __val__kind)
+              _idMap = HashMap.fromList [("symbol", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolKind_key where
+  rnf (SymbolKind_key __field__symbol __field__kind)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default SymbolKind_key where
+  def = SymbolKind_key Default.def Default.def
+
+instance Hashable.Hashable SymbolKind_key where
+  hashWithSalt __salt (SymbolKind_key _symbol _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _kind
+
+data SymbolDocumentation_key = SymbolDocumentation_key{symbolDocumentation_key_symbol
+                                                       :: Symbol,
+                                                       symbolDocumentation_key_docs ::
+                                                       Documentation}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolDocumentation_key where
+  toJSON (SymbolDocumentation_key __field__symbol __field__docs)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "docs" .= __field__docs : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolDocumentation_key where
+  buildStruct _proxy
+    (SymbolDocumentation_key __field__symbol __field__docs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "docs" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__docs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__docs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__docs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__docs <- ST.readSTRef __field__docs
+                                             Prelude.pure
+                                               (SymbolDocumentation_key __val__symbol __val__docs)
+              _idMap = HashMap.fromList [("symbol", 1), ("docs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolDocumentation_key where
+  rnf (SymbolDocumentation_key __field__symbol __field__docs)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__docs `Prelude.seq` ()
+
+instance Default.Default SymbolDocumentation_key where
+  def = SymbolDocumentation_key Default.def Default.def
+
+instance Hashable.Hashable SymbolDocumentation_key where
+  hashWithSalt __salt (SymbolDocumentation_key _symbol _docs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _docs
+
+data SymbolDisplayName_key = SymbolDisplayName_key{symbolDisplayName_key_symbol
+                                                   :: Symbol,
+                                                   symbolDisplayName_key_displayName :: DisplayName}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SymbolDisplayName_key where
+  toJSON (SymbolDisplayName_key __field__symbol __field__displayName)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "displayName" .= __field__displayName : Prelude.mempty)
+
+instance Thrift.ThriftStruct SymbolDisplayName_key where
+  buildStruct _proxy
+    (SymbolDisplayName_key __field__symbol __field__displayName)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "displayName" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__displayName)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__displayName <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__displayName
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__displayName <- ST.readSTRef
+                                                                      __field__displayName
+                                             Prelude.pure
+                                               (SymbolDisplayName_key __val__symbol
+                                                  __val__displayName)
+              _idMap = HashMap.fromList [("symbol", 1), ("displayName", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SymbolDisplayName_key where
+  rnf (SymbolDisplayName_key __field__symbol __field__displayName)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__displayName `Prelude.seq` ()
+
+instance Default.Default SymbolDisplayName_key where
+  def = SymbolDisplayName_key Default.def Default.def
+
+instance Hashable.Hashable SymbolDisplayName_key where
+  hashWithSalt __salt (SymbolDisplayName_key _symbol _displayName)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _displayName
+
+newtype SomeEntity = SomeEntity{someEntity_defn :: Definition}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SomeEntity where
+  toJSON (SomeEntity __field__defn)
+    = Aeson.object ("defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct SomeEntity where
+  buildStruct _proxy (SomeEntity __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure (SomeEntity __val__defn)
+              _idMap = HashMap.fromList [("defn", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData SomeEntity where
+  rnf (SomeEntity __field__defn)
+    = DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default SomeEntity where
+  def = SomeEntity Default.def
+
+instance Hashable.Hashable SomeEntity where
+  hashWithSalt __salt (SomeEntity _defn)
+    = Hashable.hashWithSalt __salt _defn
+
+data ReferenceTarget_key = ReferenceTarget_key{referenceTarget_key_xref
+                                               :: Reference,
+                                               referenceTarget_key_target :: Definition}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferenceTarget_key where
+  toJSON (ReferenceTarget_key __field__xref __field__target)
+    = Aeson.object
+        ("xref" .= __field__xref :
+           "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferenceTarget_key where
+  buildStruct _proxy
+    (ReferenceTarget_key __field__xref __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__xref)
+           :
+           Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__target)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__xref <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__xref <- ST.readSTRef __field__xref
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (ReferenceTarget_key __val__xref __val__target)
+              _idMap = HashMap.fromList [("xref", 1), ("target", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferenceTarget_key where
+  rnf (ReferenceTarget_key __field__xref __field__target)
+    = DeepSeq.rnf __field__xref `Prelude.seq`
+        DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default ReferenceTarget_key where
+  def = ReferenceTarget_key Default.def Default.def
+
+instance Hashable.Hashable ReferenceTarget_key where
+  hashWithSalt __salt (ReferenceTarget_key _xref _target)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _xref)
+        _target
+
+data ReferenceLocation_key = ReferenceLocation_key{referenceLocation_key_file
+                                                   :: Glean.Schema.Src.File,
+                                                   referenceLocation_key_range ::
+                                                   Glean.Schema.LsifTypes.RangeSpan,
+                                                   referenceLocation_key_xref :: Reference}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReferenceLocation_key where
+  toJSON
+    (ReferenceLocation_key __field__file __field__range __field__xref)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range :
+             "xref" .= __field__xref : Prelude.mempty)
+
+instance Thrift.ThriftStruct ReferenceLocation_key where
+  buildStruct _proxy
+    (ReferenceLocation_key __field__file __field__range __field__xref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__xref)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             Prelude.pure
+                                               (ReferenceLocation_key __val__file __val__range
+                                                  __val__xref)
+              _idMap = HashMap.fromList [("file", 1), ("range", 2), ("xref", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData ReferenceLocation_key where
+  rnf
+    (ReferenceLocation_key __field__file __field__range __field__xref)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__xref `Prelude.seq` ()
+
+instance Default.Default ReferenceLocation_key where
+  def = ReferenceLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable ReferenceLocation_key where
+  hashWithSalt __salt (ReferenceLocation_key _file _range _xref)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range)
+        _xref
+
+data Reference_key = Reference_key{reference_key_symbol :: Symbol,
+                                   reference_key_location :: FileRange}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Reference_key where
+  toJSON (Reference_key __field__symbol __field__location)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct Reference_key where
+  buildStruct _proxy
+    (Reference_key __field__symbol __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (Reference_key __val__symbol __val__location)
+              _idMap = HashMap.fromList [("symbol", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Reference_key where
+  rnf (Reference_key __field__symbol __field__location)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default Reference_key where
+  def = Reference_key Default.def Default.def
+
+instance Hashable.Hashable Reference_key where
+  hashWithSalt __salt (Reference_key _symbol _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _location
+
+data ProtocolVersion = ProtocolVersion_UnspecifiedProtocolVersion
+                     | ProtocolVersion__UNKNOWN Prelude.Int
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProtocolVersion where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData ProtocolVersion where
+  rnf __ProtocolVersion = Prelude.seq __ProtocolVersion ()
+
+instance Default.Default ProtocolVersion where
+  def = ProtocolVersion_UnspecifiedProtocolVersion
+
+instance Hashable.Hashable ProtocolVersion where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum ProtocolVersion where
+  toThriftEnum 0 = ProtocolVersion_UnspecifiedProtocolVersion
+  toThriftEnum val = ProtocolVersion__UNKNOWN val
+  fromThriftEnum ProtocolVersion_UnspecifiedProtocolVersion = 0
+  fromThriftEnum (ProtocolVersion__UNKNOWN val) = val
+  allThriftEnumValues = [ProtocolVersion_UnspecifiedProtocolVersion]
+  toThriftEnumEither 0
+    = Prelude.Right ProtocolVersion_UnspecifiedProtocolVersion
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum ProtocolVersion: "
+           ++ Prelude.show val)
+
+data Metadata_key = Metadata_key{metadata_key_version ::
+                                 ProtocolVersion,
+                                 metadata_key_toolInfo ::
+                                 Prelude.Maybe Glean.Schema.LsifTypes.ToolInfo,
+                                 metadata_key_projectRoot :: Text.Text,
+                                 metadata_key_textEncoding :: TextEncoding}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Metadata_key where
+  toJSON
+    (Metadata_key __field__version __field__toolInfo
+       __field__projectRoot __field__textEncoding)
+    = Aeson.object
+        ("version" .= __field__version :
+           Prelude.maybe Prelude.id ((:) . ("toolInfo" .=)) __field__toolInfo
+             ("projectRoot" .= __field__projectRoot :
+                "textEncoding" .= __field__textEncoding : Prelude.mempty))
+
+instance Thrift.ThriftStruct Metadata_key where
+  buildStruct _proxy
+    (Metadata_key __field__version __field__toolInfo
+       __field__projectRoot __field__textEncoding)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "version" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__version)
+           :
+           let (__cereal__toolInfo, __id__toolInfo)
+                 = case __field__toolInfo of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "toolInfo"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__toolInfo
+               (Thrift.genField _proxy "projectRoot" (Thrift.getStringType _proxy)
+                  3
+                  __id__toolInfo
+                  (Thrift.genText _proxy __field__projectRoot)
+                  :
+                  Thrift.genField _proxy "textEncoding" (Thrift.getI32Type _proxy) 4
+                    3
+                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                        Thrift.fromThriftEnum)
+                       __field__textEncoding)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__version <- ST.newSTRef Default.def
+            __field__toolInfo <- ST.newSTRef Prelude.Nothing
+            __field__projectRoot <- ST.newSTRef ""
+            __field__textEncoding <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "ProtocolVersion")
+                                                                        ST.writeSTRef
+                                                                          __field__version
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__toolInfo
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__projectRoot
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "TextEncoding")
+                                                                        ST.writeSTRef
+                                                                          __field__textEncoding
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__version <- ST.readSTRef
+                                                                  __field__version
+                                             !__val__toolInfo <- ST.readSTRef __field__toolInfo
+                                             !__val__projectRoot <- ST.readSTRef
+                                                                      __field__projectRoot
+                                             !__val__textEncoding <- ST.readSTRef
+                                                                       __field__textEncoding
+                                             Prelude.pure
+                                               (Metadata_key __val__version __val__toolInfo
+                                                  __val__projectRoot
+                                                  __val__textEncoding)
+              _idMap
+                = HashMap.fromList
+                    [("version", 1), ("toolInfo", 2), ("projectRoot", 3),
+                     ("textEncoding", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData Metadata_key where
+  rnf
+    (Metadata_key __field__version __field__toolInfo
+       __field__projectRoot __field__textEncoding)
+    = DeepSeq.rnf __field__version `Prelude.seq`
+        DeepSeq.rnf __field__toolInfo `Prelude.seq`
+          DeepSeq.rnf __field__projectRoot `Prelude.seq`
+            DeepSeq.rnf __field__textEncoding `Prelude.seq` ()
+
+instance Default.Default Metadata_key where
+  def = Metadata_key Default.def Prelude.Nothing "" Default.def
+
+instance Hashable.Hashable Metadata_key where
+  hashWithSalt __salt
+    (Metadata_key _version _toolInfo _projectRoot _textEncoding)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _version)
+              _toolInfo)
+           _projectRoot)
+        _textEncoding
+
+data Location = Location{location_file :: Glean.Schema.Src.File,
+                         location_location :: Glean.Schema.Src.Range,
+                         location_name :: Text.Text}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Location where
+  toJSON (Location __field__file __field__location __field__name)
+    = Aeson.object
+        ("file" .= __field__file :
+           "location" .= __field__location :
+             "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Location where
+  buildStruct _proxy
+    (Location __field__file __field__location __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__location <- ST.readSTRef __field__location
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (Location __val__file __val__location __val__name)
+              _idMap
+                = HashMap.fromList [("file", 1), ("location", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Location where
+  rnf (Location __field__file __field__location __field__name)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Location where
+  def = Location Default.def Default.def ""
+
+instance Hashable.Hashable Location where
+  hashWithSalt __salt (Location _file _location _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _location)
+        _name
+
+data IsImplemented_key = IsImplemented_key{isImplemented_key_implemented
+                                           :: Symbol,
+                                           isImplemented_key_symbol :: Symbol}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsImplemented_key where
+  toJSON (IsImplemented_key __field__implemented __field__symbol)
+    = Aeson.object
+        ("implemented" .= __field__implemented :
+           "symbol" .= __field__symbol : Prelude.mempty)
+
+instance Thrift.ThriftStruct IsImplemented_key where
+  buildStruct _proxy
+    (IsImplemented_key __field__implemented __field__symbol)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "implemented" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__implemented)
+           :
+           Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__symbol)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__implemented <- ST.newSTRef Default.def
+            __field__symbol <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__implemented
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__implemented <- ST.readSTRef
+                                                                      __field__implemented
+                                             !__val__symbol <- ST.readSTRef __field__symbol
+                                             Prelude.pure
+                                               (IsImplemented_key __val__implemented __val__symbol)
+              _idMap = HashMap.fromList [("implemented", 1), ("symbol", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsImplemented_key where
+  rnf (IsImplemented_key __field__implemented __field__symbol)
+    = DeepSeq.rnf __field__implemented `Prelude.seq`
+        DeepSeq.rnf __field__symbol `Prelude.seq` ()
+
+instance Default.Default IsImplemented_key where
+  def = IsImplemented_key Default.def Default.def
+
+instance Hashable.Hashable IsImplemented_key where
+  hashWithSalt __salt (IsImplemented_key _implemented _symbol)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _implemented)
+        _symbol
+
+data IsImplementation_key = IsImplementation_key{isImplementation_key_symbol
+                                                 :: Symbol,
+                                                 isImplementation_key_implemented :: Symbol}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IsImplementation_key where
+  toJSON (IsImplementation_key __field__symbol __field__implemented)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "implemented" .= __field__implemented : Prelude.mempty)
+
+instance Thrift.ThriftStruct IsImplementation_key where
+  buildStruct _proxy
+    (IsImplementation_key __field__symbol __field__implemented)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "implemented" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__implemented)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__implemented <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__implemented
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__implemented <- ST.readSTRef
+                                                                      __field__implemented
+                                             Prelude.pure
+                                               (IsImplementation_key __val__symbol
+                                                  __val__implemented)
+              _idMap = HashMap.fromList [("symbol", 1), ("implemented", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IsImplementation_key where
+  rnf (IsImplementation_key __field__symbol __field__implemented)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__implemented `Prelude.seq` ()
+
+instance Default.Default IsImplementation_key where
+  def = IsImplementation_key Default.def Default.def
+
+instance Hashable.Hashable IsImplementation_key where
+  hashWithSalt __salt (IsImplementation_key _symbol _implemented)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _implemented
+
+data FileXLangSymbolRef_key = FileXLangSymbolRef_key{fileXLangSymbolRef_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     fileXLangSymbolRef_key_range ::
+                                                     Glean.Schema.LsifTypes.RangeSpan,
+                                                     fileXLangSymbolRef_key_target :: Symbol}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileXLangSymbolRef_key where
+  toJSON
+    (FileXLangSymbolRef_key __field__file __field__range
+       __field__target)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range :
+             "target" .= __field__target : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileXLangSymbolRef_key where
+  buildStruct _proxy
+    (FileXLangSymbolRef_key __field__file __field__range
+       __field__target)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__target <- ST.readSTRef __field__target
+                                             Prelude.pure
+                                               (FileXLangSymbolRef_key __val__file __val__range
+                                                  __val__target)
+              _idMap
+                = HashMap.fromList [("file", 1), ("range", 2), ("target", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileXLangSymbolRef_key where
+  rnf
+    (FileXLangSymbolRef_key __field__file __field__range
+       __field__target)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq` ()
+
+instance Default.Default FileXLangSymbolRef_key where
+  def = FileXLangSymbolRef_key Default.def Default.def Default.def
+
+instance Hashable.Hashable FileXLangSymbolRef_key where
+  hashWithSalt __salt (FileXLangSymbolRef_key _file _range _target)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range)
+        _target
+
+data FileRange_key = FileRange_key{fileRange_key_file ::
+                                   Glean.Schema.Src.File,
+                                   fileRange_key_range :: Glean.Schema.LsifTypes.RangeSpan}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileRange_key where
+  toJSON (FileRange_key __field__file __field__range)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileRange_key where
+  buildStruct _proxy (FileRange_key __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure (FileRange_key __val__file __val__range)
+              _idMap = HashMap.fromList [("file", 1), ("range", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileRange_key where
+  rnf (FileRange_key __field__file __field__range)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default FileRange_key where
+  def = FileRange_key Default.def Default.def
+
+instance Hashable.Hashable FileRange_key where
+  hashWithSalt __salt (FileRange_key _file _range)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range
+
+data FileLanguage_key = FileLanguage_key{fileLanguage_key_file ::
+                                         Glean.Schema.Src.File,
+                                         fileLanguage_key_language ::
+                                         Glean.Schema.LsifTypes.LanguageId}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLanguage_key where
+  toJSON (FileLanguage_key __field__file __field__language)
+    = Aeson.object
+        ("file" .= __field__file :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLanguage_key where
+  buildStruct _proxy
+    (FileLanguage_key __field__file __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (FileLanguage_key __val__file __val__language)
+              _idMap = HashMap.fromList [("file", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLanguage_key where
+  rnf (FileLanguage_key __field__file __field__language)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default FileLanguage_key where
+  def = FileLanguage_key Default.def Default.def
+
+instance Hashable.Hashable FileLanguage_key where
+  hashWithSalt __salt (FileLanguage_key _file _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _language
+
+data Entity = Entity_rust SomeEntity
+            | Entity_go SomeEntity
+            | Entity_typescript SomeEntity
+            | Entity_java SomeEntity
+            | Entity_kotlin SomeEntity
+            | Entity_swift SomeEntity
+            | Entity_EMPTY
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Entity where
+  toJSON (Entity_rust __rust) = Aeson.object ["rust" .= __rust]
+  toJSON (Entity_go __go) = Aeson.object ["go" .= __go]
+  toJSON (Entity_typescript __typescript)
+    = Aeson.object ["typescript" .= __typescript]
+  toJSON (Entity_java __java) = Aeson.object ["java" .= __java]
+  toJSON (Entity_kotlin __kotlin)
+    = Aeson.object ["kotlin" .= __kotlin]
+  toJSON (Entity_swift __swift) = Aeson.object ["swift" .= __swift]
+  toJSON Entity_EMPTY = Aeson.object []
+
+instance Thrift.ThriftStruct Entity where
+  buildStruct _proxy (Entity_rust __rust)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "rust" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __rust)]
+  buildStruct _proxy (Entity_go __go)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "go" (Thrift.getStructType _proxy) 2 0
+           (Thrift.buildStruct _proxy __go)]
+  buildStruct _proxy (Entity_typescript __typescript)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "typescript" (Thrift.getStructType _proxy)
+           3
+           0
+           (Thrift.buildStruct _proxy __typescript)]
+  buildStruct _proxy (Entity_java __java)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "java" (Thrift.getStructType _proxy) 4 0
+           (Thrift.buildStruct _proxy __java)]
+  buildStruct _proxy (Entity_kotlin __kotlin)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "kotlin" (Thrift.getStructType _proxy) 5 0
+           (Thrift.buildStruct _proxy __kotlin)]
+  buildStruct _proxy (Entity_swift __swift)
+    = Thrift.genStruct _proxy
+        [Thrift.genField _proxy "swift" (Thrift.getStructType _proxy) 6 0
+           (Thrift.buildStruct _proxy __swift)]
+  buildStruct _proxy Entity_EMPTY = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
+         case _fieldBegin of
+           Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                     1 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_rust _val)
+                                                     2 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_go _val)
+                                                     3 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_typescript _val)
+                                                     4 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_java _val)
+                                                     5 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_kotlin _val)
+                                                     6 | _type == Thrift.getStructType _proxy ->
+                                                         do _val <- Thrift.parseStruct _proxy
+                                                            Thrift.parseStop _proxy
+                                                            Prelude.return (Entity_swift _val)
+                                                     _ -> do Thrift.parseSkip _proxy _type
+                                                               Prelude.Nothing
+                                                             Thrift.parseStop _proxy
+                                                             Prelude.return Entity_EMPTY
+           Thrift.FieldEnd -> Prelude.return Entity_EMPTY
+    where
+      _idMap
+        = HashMap.fromList
+            [("rust", 1), ("go", 2), ("typescript", 3), ("java", 4),
+             ("kotlin", 5), ("swift", 6)]
+
+instance DeepSeq.NFData Entity where
+  rnf (Entity_rust __rust) = DeepSeq.rnf __rust
+  rnf (Entity_go __go) = DeepSeq.rnf __go
+  rnf (Entity_typescript __typescript) = DeepSeq.rnf __typescript
+  rnf (Entity_java __java) = DeepSeq.rnf __java
+  rnf (Entity_kotlin __kotlin) = DeepSeq.rnf __kotlin
+  rnf (Entity_swift __swift) = DeepSeq.rnf __swift
+  rnf Entity_EMPTY = ()
+
+instance Default.Default Entity where
+  def = Entity_EMPTY
+
+instance Hashable.Hashable Entity where
+  hashWithSalt __salt (Entity_rust _rust)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 1 _rust)
+  hashWithSalt __salt (Entity_go _go)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _go)
+  hashWithSalt __salt (Entity_typescript _typescript)
+    = Hashable.hashWithSalt __salt
+        (Hashable.hashWithSalt 3 _typescript)
+  hashWithSalt __salt (Entity_java _java)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 4 _java)
+  hashWithSalt __salt (Entity_kotlin _kotlin)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 5 _kotlin)
+  hashWithSalt __salt (Entity_swift _swift)
+    = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 6 _swift)
+  hashWithSalt __salt Entity_EMPTY
+    = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
+
+data EntityDefinition_key = EntityDefinition_key{entityDefinition_key_entity
+                                                 :: Entity,
+                                                 entityDefinition_key_defn :: Definition}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityDefinition_key where
+  toJSON (EntityDefinition_key __field__entity __field__defn)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityDefinition_key where
+  buildStruct _proxy
+    (EntityDefinition_key __field__entity __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (EntityDefinition_key __val__entity __val__defn)
+              _idMap = HashMap.fromList [("entity", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityDefinition_key where
+  rnf (EntityDefinition_key __field__entity __field__defn)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default EntityDefinition_key where
+  def = EntityDefinition_key Default.def Default.def
+
+instance Hashable.Hashable EntityDefinition_key where
+  hashWithSalt __salt (EntityDefinition_key _entity _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _defn
+
+data EntityKind_key = EntityKind_key{entityKind_key_entity ::
+                                     Entity,
+                                     entityKind_key_kind :: Glean.Schema.LsifTypes.SymbolKind}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityKind_key where
+  toJSON (EntityKind_key __field__entity __field__kind)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "kind" .= __field__kind : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityKind_key where
+  buildStruct _proxy (EntityKind_key __field__entity __field__kind)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "kind" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__kind)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__kind <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             Prelude.pure (EntityKind_key __val__entity __val__kind)
+              _idMap = HashMap.fromList [("entity", 1), ("kind", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityKind_key where
+  rnf (EntityKind_key __field__entity __field__kind)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq` ()
+
+instance Default.Default EntityKind_key where
+  def = EntityKind_key Default.def Default.def
+
+instance Hashable.Hashable EntityKind_key where
+  hashWithSalt __salt (EntityKind_key _entity _kind)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _kind
+
+data EntityLocation_key = EntityLocation_key{entityLocation_key_entity
+                                             :: Entity,
+                                             entityLocation_key_location :: Location}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityLocation_key where
+  toJSON (EntityLocation_key __field__entity __field__location)
+    = Aeson.object
+        ("entity" .= __field__entity :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityLocation_key where
+  buildStruct _proxy
+    (EntityLocation_key __field__entity __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__entity)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__entity <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__entity <- ST.readSTRef
+                                                                 __field__entity
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (EntityLocation_key __val__entity __val__location)
+              _idMap = HashMap.fromList [("entity", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityLocation_key where
+  rnf (EntityLocation_key __field__entity __field__location)
+    = DeepSeq.rnf __field__entity `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default EntityLocation_key where
+  def = EntityLocation_key Default.def Default.def
+
+instance Hashable.Hashable EntityLocation_key where
+  hashWithSalt __salt (EntityLocation_key _entity _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _entity)
+        _location
+
+data EntityUses_key = EntityUses_key{entityUses_key_target ::
+                                     Entity,
+                                     entityUses_key_file :: Glean.Schema.Src.File,
+                                     entityUses_key_range :: Glean.Schema.Src.Range}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EntityUses_key where
+  toJSON
+    (EntityUses_key __field__target __field__file __field__range)
+    = Aeson.object
+        ("target" .= __field__target :
+           "file" .= __field__file :
+             "range" .= __field__range : Prelude.mempty)
+
+instance Thrift.ThriftStruct EntityUses_key where
+  buildStruct _proxy
+    (EntityUses_key __field__target __field__file __field__range)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__file)
+             :
+             Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__range)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             Prelude.pure
+                                               (EntityUses_key __val__target __val__file
+                                                  __val__range)
+              _idMap
+                = HashMap.fromList [("target", 1), ("file", 2), ("range", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData EntityUses_key where
+  rnf (EntityUses_key __field__target __field__file __field__range)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__file `Prelude.seq`
+          DeepSeq.rnf __field__range `Prelude.seq` ()
+
+instance Default.Default EntityUses_key where
+  def = EntityUses_key Default.def Default.def Default.def
+
+instance Hashable.Hashable EntityUses_key where
+  hashWithSalt __salt (EntityUses_key _target _file _range)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+           _file)
+        _range
+
+data FileEntityXRefLocation_key = FileEntityXRefLocation_key{fileEntityXRefLocation_key_file
+                                                             :: Glean.Schema.Src.File,
+                                                             fileEntityXRefLocation_key_source ::
+                                                             Glean.Schema.Src.Range,
+                                                             fileEntityXRefLocation_key_target ::
+                                                             Location,
+                                                             fileEntityXRefLocation_key_entity ::
+                                                             Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileEntityXRefLocation_key where
+  toJSON
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "source" .= __field__source :
+             "target" .= __field__target :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileEntityXRefLocation_key where
+  buildStruct _proxy
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "source" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__source)
+             :
+             Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__target)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__source <- ST.newSTRef Default.def
+            __field__target <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__source
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__source <- ST.readSTRef __field__source
+                                             !__val__target <- ST.readSTRef __field__target
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FileEntityXRefLocation_key __val__file __val__source
+                                                  __val__target
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("source", 2), ("target", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FileEntityXRefLocation_key where
+  rnf
+    (FileEntityXRefLocation_key __field__file __field__source
+       __field__target __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__source `Prelude.seq`
+          DeepSeq.rnf __field__target `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FileEntityXRefLocation_key where
+  def
+    = FileEntityXRefLocation_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable FileEntityXRefLocation_key where
+  hashWithSalt __salt
+    (FileEntityXRefLocation_key _file _source _target _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+              _source)
+           _target)
+        _entity
+
+data ResolveLocation_key = ResolveLocation_key{resolveLocation_key_location
+                                               :: Location,
+                                               resolveLocation_key_entity :: Entity}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ResolveLocation_key where
+  toJSON (ResolveLocation_key __field__location __field__entity)
+    = Aeson.object
+        ("location" .= __field__location :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ResolveLocation_key where
+  buildStruct _proxy
+    (ResolveLocation_key __field__location __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__location)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__location <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__location <- ST.readSTRef
+                                                                   __field__location
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ResolveLocation_key __val__location __val__entity)
+              _idMap = HashMap.fromList [("location", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ResolveLocation_key where
+  rnf (ResolveLocation_key __field__location __field__entity)
+    = DeepSeq.rnf __field__location `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ResolveLocation_key where
+  def = ResolveLocation_key Default.def Default.def
+
+instance Hashable.Hashable ResolveLocation_key where
+  hashWithSalt __salt (ResolveLocation_key _location _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _location)
+        _entity
+
+data SearchByNameKind_key = SearchByNameKind_key{searchByNameKind_key_name
+                                                 :: Text.Text,
+                                                 searchByNameKind_key_kind ::
+                                                 Prelude.Maybe Glean.Schema.LsifTypes.SymbolKind,
+                                                 searchByNameKind_key_entity :: Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameKind_key where
+  toJSON
+    (SearchByNameKind_key __field__name __field__kind __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByNameKind_key where
+  buildStruct _proxy
+    (SearchByNameKind_key __field__name __field__kind __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kind, __id__kind)
+                 = case __field__kind of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kind"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kind
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kind
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByNameKind_key __val__name __val__kind
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("kind", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameKind_key where
+  rnf
+    (SearchByNameKind_key __field__name __field__kind __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByNameKind_key where
+  def = SearchByNameKind_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchByNameKind_key where
+  hashWithSalt __salt (SearchByNameKind_key _name _kind _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind)
+        _entity
+
+data SearchBySymbol_key = SearchBySymbol_key{searchBySymbol_key_symbol
+                                             :: Symbol,
+                                             searchBySymbol_key_entity :: Entity}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchBySymbol_key where
+  toJSON (SearchBySymbol_key __field__symbol __field__entity)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchBySymbol_key where
+  buildStruct _proxy
+    (SearchBySymbol_key __field__symbol __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchBySymbol_key __val__symbol __val__entity)
+              _idMap = HashMap.fromList [("symbol", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchBySymbol_key where
+  rnf (SearchBySymbol_key __field__symbol __field__entity)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchBySymbol_key where
+  def = SearchBySymbol_key Default.def Default.def
+
+instance Hashable.Hashable SearchBySymbol_key where
+  hashWithSalt __salt (SearchBySymbol_key _symbol _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _entity
+
+data TagDefinition_key = TagDefinition_key{tagDefinition_key_language
+                                           :: Glean.Schema.LsifTypes.LanguageId,
+                                           tagDefinition_key_defn :: Definition,
+                                           tagDefinition_key_entity :: Entity}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TagDefinition_key where
+  toJSON
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = Aeson.object
+        ("language" .= __field__language :
+           "defn" .= __field__defn :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct TagDefinition_key where
+  buildStruct _proxy
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__language)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__language <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "LanguageId")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__language <- ST.readSTRef
+                                                                   __field__language
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (TagDefinition_key __val__language __val__defn
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("language", 1), ("defn", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData TagDefinition_key where
+  rnf
+    (TagDefinition_key __field__language __field__defn __field__entity)
+    = DeepSeq.rnf __field__language `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default TagDefinition_key where
+  def = TagDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable TagDefinition_key where
+  hashWithSalt __salt (TagDefinition_key _language _defn _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _language)
+           _defn)
+        _entity
+
+data DisplayNameSymbol_key = DisplayNameSymbol_key{displayNameSymbol_key_displayName
+                                                   :: DisplayName,
+                                                   displayNameSymbol_key_symbol :: Symbol}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DisplayNameSymbol_key where
+  toJSON (DisplayNameSymbol_key __field__displayName __field__symbol)
+    = Aeson.object
+        ("displayName" .= __field__displayName :
+           "symbol" .= __field__symbol : Prelude.mempty)
+
+instance Thrift.ThriftStruct DisplayNameSymbol_key where
+  buildStruct _proxy
+    (DisplayNameSymbol_key __field__displayName __field__symbol)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "displayName" (Thrift.getStructType _proxy)
+           1
+           0
+           (Thrift.buildStruct _proxy __field__displayName)
+           :
+           Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__symbol)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__displayName <- ST.newSTRef Default.def
+            __field__symbol <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__displayName
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__displayName <- ST.readSTRef
+                                                                      __field__displayName
+                                             !__val__symbol <- ST.readSTRef __field__symbol
+                                             Prelude.pure
+                                               (DisplayNameSymbol_key __val__displayName
+                                                  __val__symbol)
+              _idMap = HashMap.fromList [("displayName", 1), ("symbol", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DisplayNameSymbol_key where
+  rnf (DisplayNameSymbol_key __field__displayName __field__symbol)
+    = DeepSeq.rnf __field__displayName `Prelude.seq`
+        DeepSeq.rnf __field__symbol `Prelude.seq` ()
+
+instance Default.Default DisplayNameSymbol_key where
+  def = DisplayNameSymbol_key Default.def Default.def
+
+instance Hashable.Hashable DisplayNameSymbol_key where
+  hashWithSalt __salt (DisplayNameSymbol_key _displayName _symbol)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _displayName)
+        _symbol
+
+data DefinitionUses_key = DefinitionUses_key{definitionUses_key_target
+                                             :: Definition,
+                                             definitionUses_key_xref :: Reference}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionUses_key where
+  toJSON (DefinitionUses_key __field__target __field__xref)
+    = Aeson.object
+        ("target" .= __field__target :
+           "xref" .= __field__xref : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionUses_key where
+  buildStruct _proxy
+    (DefinitionUses_key __field__target __field__xref)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "target" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__target)
+           :
+           Thrift.genField _proxy "xref" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__xref)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__target <- ST.newSTRef Default.def
+            __field__xref <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__target
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__xref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__target <- ST.readSTRef
+                                                                 __field__target
+                                             !__val__xref <- ST.readSTRef __field__xref
+                                             Prelude.pure
+                                               (DefinitionUses_key __val__target __val__xref)
+              _idMap = HashMap.fromList [("target", 1), ("xref", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionUses_key where
+  rnf (DefinitionUses_key __field__target __field__xref)
+    = DeepSeq.rnf __field__target `Prelude.seq`
+        DeepSeq.rnf __field__xref `Prelude.seq` ()
+
+instance Default.Default DefinitionUses_key where
+  def = DefinitionUses_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionUses_key where
+  hashWithSalt __salt (DefinitionUses_key _target _xref)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _target)
+        _xref
+
+data DefinitionName_key = DefinitionName_key{definitionName_key_defn
+                                             :: Definition,
+                                             definitionName_key_docs :: LocalName}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionName_key where
+  toJSON (DefinitionName_key __field__defn __field__docs)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "docs" .= __field__docs : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionName_key where
+  buildStruct _proxy (DefinitionName_key __field__defn __field__docs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "docs" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__docs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__docs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__docs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__docs <- ST.readSTRef __field__docs
+                                             Prelude.pure
+                                               (DefinitionName_key __val__defn __val__docs)
+              _idMap = HashMap.fromList [("defn", 1), ("docs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionName_key where
+  rnf (DefinitionName_key __field__defn __field__docs)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__docs `Prelude.seq` ()
+
+instance Default.Default DefinitionName_key where
+  def = DefinitionName_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionName_key where
+  hashWithSalt __salt (DefinitionName_key _defn _docs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _docs
+
+data DefinitionLocation_key = DefinitionLocation_key{definitionLocation_key_file
+                                                     :: Glean.Schema.Src.File,
+                                                     definitionLocation_key_range ::
+                                                     Glean.Schema.LsifTypes.RangeSpan,
+                                                     definitionLocation_key_defn :: Definition}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionLocation_key where
+  toJSON
+    (DefinitionLocation_key __field__file __field__range __field__defn)
+    = Aeson.object
+        ("file" .= __field__file :
+           "range" .= __field__range :
+             "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionLocation_key where
+  buildStruct _proxy
+    (DefinitionLocation_key __field__file __field__range __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "range" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__range)
+             :
+             Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__defn)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__range <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__range
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__range <- ST.readSTRef __field__range
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure
+                                               (DefinitionLocation_key __val__file __val__range
+                                                  __val__defn)
+              _idMap = HashMap.fromList [("file", 1), ("range", 2), ("defn", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionLocation_key where
+  rnf
+    (DefinitionLocation_key __field__file __field__range __field__defn)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__range `Prelude.seq`
+          DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default DefinitionLocation_key where
+  def = DefinitionLocation_key Default.def Default.def Default.def
+
+instance Hashable.Hashable DefinitionLocation_key where
+  hashWithSalt __salt (DefinitionLocation_key _file _range _defn)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _range)
+        _defn
+
+data DefinitionDocumentation_key = DefinitionDocumentation_key{definitionDocumentation_key_defn
+                                                               :: Definition,
+                                                               definitionDocumentation_key_docs ::
+                                                               Documentation}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionDocumentation_key where
+  toJSON (DefinitionDocumentation_key __field__defn __field__docs)
+    = Aeson.object
+        ("defn" .= __field__defn :
+           "docs" .= __field__docs : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionDocumentation_key where
+  buildStruct _proxy
+    (DefinitionDocumentation_key __field__defn __field__docs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__defn)
+           :
+           Thrift.genField _proxy "docs" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__docs)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__defn <- ST.newSTRef Default.def
+            __field__docs <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__docs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__defn <- ST.readSTRef __field__defn
+                                             !__val__docs <- ST.readSTRef __field__docs
+                                             Prelude.pure
+                                               (DefinitionDocumentation_key __val__defn __val__docs)
+              _idMap = HashMap.fromList [("defn", 1), ("docs", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionDocumentation_key where
+  rnf (DefinitionDocumentation_key __field__defn __field__docs)
+    = DeepSeq.rnf __field__defn `Prelude.seq`
+        DeepSeq.rnf __field__docs `Prelude.seq` ()
+
+instance Default.Default DefinitionDocumentation_key where
+  def = DefinitionDocumentation_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionDocumentation_key where
+  hashWithSalt __salt (DefinitionDocumentation_key _defn _docs)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _defn) _docs
+
+data Definition_key = Definition_key{definition_key_symbol ::
+                                     Symbol,
+                                     definition_key_location :: FileRange}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition_key where
+  toJSON (Definition_key __field__symbol __field__location)
+    = Aeson.object
+        ("symbol" .= __field__symbol :
+           "location" .= __field__location : Prelude.mempty)
+
+instance Thrift.ThriftStruct Definition_key where
+  buildStruct _proxy
+    (Definition_key __field__symbol __field__location)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "symbol" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__symbol)
+           :
+           Thrift.genField _proxy "location" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__location)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__symbol <- ST.newSTRef Default.def
+            __field__location <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__symbol
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__location
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__symbol <- ST.readSTRef
+                                                                 __field__symbol
+                                             !__val__location <- ST.readSTRef __field__location
+                                             Prelude.pure
+                                               (Definition_key __val__symbol __val__location)
+              _idMap = HashMap.fromList [("symbol", 1), ("location", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Definition_key where
+  rnf (Definition_key __field__symbol __field__location)
+    = DeepSeq.rnf __field__symbol `Prelude.seq`
+        DeepSeq.rnf __field__location `Prelude.seq` ()
+
+instance Default.Default Definition_key where
+  def = Definition_key Default.def Default.def
+
+instance Hashable.Hashable Definition_key where
+  hashWithSalt __salt (Definition_key _symbol _location)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _symbol)
+        _location
+{-# LINE 19 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityLocation_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.EntityLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.EntityLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.EntityLocation_key" (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.EntityLocation_key =
+     'Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+       ('Angle.TField "location" (Glean.Schema.Scip.Types.Location)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.EntityLocation
+         where
+  type KeyType Glean.Schema.Scip.Types.EntityLocation =
+       Glean.Schema.Scip.Types.EntityLocation_key
+  getName _proxy = Glean.PredicateRef "scip.EntityLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.entityLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.EntityLocation x k
+  getFactKey = Glean.Schema.Scip.Types.entityLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ReferenceTarget_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.ReferenceTarget_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.ReferenceTarget_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.ReferenceTarget_key" (Prelude.Just 0))
+{-# LINE 54 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.ReferenceTarget_key =
+     'Angle.TField "xref"
+       (Glean.KeyType Glean.Schema.Scip.Types.Reference)
+       ('Angle.TField "target"
+          (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 56 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.ReferenceTarget
+         where
+  type KeyType Glean.Schema.Scip.Types.ReferenceTarget =
+       Glean.Schema.Scip.Types.ReferenceTarget_key
+  getName _proxy = Glean.PredicateRef "scip.ReferenceTarget" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.referenceTarget_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.ReferenceTarget x k
+  getFactKey = Glean.Schema.Scip.Types.referenceTarget_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 65 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ReferenceTarget where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 71 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Scip.Types.FileEntityXRefLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.FileEntityXRefLocation_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.FileEntityXRefLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.FileEntityXRefLocation_key"
+           (Prelude.Just 0))
+{-# LINE 84 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Scip.Types.FileEntityXRefLocation_key
+     =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "source" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "target" (Glean.Schema.Scip.Types.Location)
+             ('Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 86 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Scip.Types.FileEntityXRefLocation
+         where
+  type KeyType Glean.Schema.Scip.Types.FileEntityXRefLocation =
+       Glean.Schema.Scip.Types.FileEntityXRefLocation_key
+  getName _proxy = Glean.PredicateRef "scip.FileEntityXRefLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.fileEntityXRefLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.FileEntityXRefLocation x k
+  getFactKey = Glean.Schema.Scip.Types.fileEntityXRefLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 95 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileEntityXRefLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 101 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.IsImplementation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.IsImplementation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.IsImplementation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.IsImplementation_key" (Prelude.Just 0))
+{-# LINE 110 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.IsImplementation_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "implemented"
+          (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+          ('Angle.TNoFields))
+{-# LINE 112 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.IsImplementation
+         where
+  type KeyType Glean.Schema.Scip.Types.IsImplementation =
+       Glean.Schema.Scip.Types.IsImplementation_key
+  getName _proxy = Glean.PredicateRef "scip.IsImplementation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.isImplementation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.IsImplementation x k
+  getFactKey = Glean.Schema.Scip.Types.isImplementation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 121 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.IsImplementation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 127 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolName_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.SymbolName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SymbolName_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SymbolName_key" (Prelude.Just 0))
+{-# LINE 136 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SymbolName_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Scip.Types.LocalName)
+          ('Angle.TNoFields))
+{-# LINE 138 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.SymbolName where
+  type KeyType Glean.Schema.Scip.Types.SymbolName =
+       Glean.Schema.Scip.Types.SymbolName_key
+  getName _proxy = Glean.PredicateRef "scip.SymbolName" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.symbolName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SymbolName x k
+  getFactKey = Glean.Schema.Scip.Types.symbolName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 147 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 153 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionName_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.DefinitionName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.DefinitionName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.DefinitionName_key" (Prelude.Just 0))
+{-# LINE 162 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.DefinitionName_key =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+       ('Angle.TField "docs"
+          (Glean.KeyType Glean.Schema.Scip.Types.LocalName)
+          ('Angle.TNoFields))
+{-# LINE 164 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.DefinitionName
+         where
+  type KeyType Glean.Schema.Scip.Types.DefinitionName =
+       Glean.Schema.Scip.Types.DefinitionName_key
+  getName _proxy = Glean.PredicateRef "scip.DefinitionName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.definitionName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DefinitionName x k
+  getFactKey = Glean.Schema.Scip.Types.definitionName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 173 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 179 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SearchByNameKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.SearchByNameKind_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SearchByNameKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SearchByNameKind_key" (Prelude.Just 0))
+{-# LINE 190 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SearchByNameKind_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kind"
+          (Prelude.Maybe Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 192 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.SearchByNameKind
+         where
+  type KeyType Glean.Schema.Scip.Types.SearchByNameKind =
+       Glean.Schema.Scip.Types.SearchByNameKind_key
+  getName _proxy = Glean.PredicateRef "scip.SearchByNameKind" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.searchByNameKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SearchByNameKind x k
+  getFactKey = Glean.Schema.Scip.Types.searchByNameKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 201 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SearchByNameKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 207 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileRange_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.FileRange_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.FileRange_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.FileRange_key" (Prelude.Just 0))
+{-# LINE 216 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.FileRange_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "range" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TNoFields))
+{-# LINE 218 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.FileRange where
+  type KeyType Glean.Schema.Scip.Types.FileRange =
+       Glean.Schema.Scip.Types.FileRange_key
+  getName _proxy = Glean.PredicateRef "scip.FileRange" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.fileRange_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.FileRange x k
+  getFactKey = Glean.Schema.Scip.Types.fileRange_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 227 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileRange where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 233 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolKind_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.SymbolKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SymbolKind_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SymbolKind_key" (Prelude.Just 0))
+{-# LINE 242 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SymbolKind_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "kind" (Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 244 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.SymbolKind where
+  type KeyType Glean.Schema.Scip.Types.SymbolKind =
+       Glean.Schema.Scip.Types.SymbolKind_key
+  getName _proxy = Glean.PredicateRef "scip.SymbolKind" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.symbolKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SymbolKind x k
+  getFactKey = Glean.Schema.Scip.Types.symbolKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 253 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 259 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ResolveLocation_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.ResolveLocation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.ResolveLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.ResolveLocation_key" (Prelude.Just 0))
+{-# LINE 268 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.ResolveLocation_key =
+     'Angle.TField "location" (Glean.Schema.Scip.Types.Location)
+       ('Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 270 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.ResolveLocation
+         where
+  type KeyType Glean.Schema.Scip.Types.ResolveLocation =
+       Glean.Schema.Scip.Types.ResolveLocation_key
+  getName _proxy = Glean.PredicateRef "scip.ResolveLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.resolveLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.ResolveLocation x k
+  getFactKey = Glean.Schema.Scip.Types.resolveLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 279 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ResolveLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 285 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityUses_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.EntityUses_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.EntityUses_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.EntityUses_key" (Prelude.Just 0))
+{-# LINE 296 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.EntityUses_key =
+     'Angle.TField "target" (Glean.Schema.Scip.Types.Entity)
+       ('Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+          ('Angle.TField "range" (Glean.Schema.Src.Types.Range)
+             ('Angle.TNoFields)))
+{-# LINE 298 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.EntityUses where
+  type KeyType Glean.Schema.Scip.Types.EntityUses =
+       Glean.Schema.Scip.Types.EntityUses_key
+  getName _proxy = Glean.PredicateRef "scip.EntityUses" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.entityUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.EntityUses x k
+  getFactKey = Glean.Schema.Scip.Types.entityUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 307 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 313 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.DefinitionLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.DefinitionLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.DefinitionLocation_key" (Prelude.Just 0))
+{-# LINE 324 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.DefinitionLocation_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "range" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "defn"
+             (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+             ('Angle.TNoFields)))
+{-# LINE 326 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.DefinitionLocation
+         where
+  type KeyType Glean.Schema.Scip.Types.DefinitionLocation =
+       Glean.Schema.Scip.Types.DefinitionLocation_key
+  getName _proxy = Glean.PredicateRef "scip.DefinitionLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.definitionLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DefinitionLocation x k
+  getFactKey = Glean.Schema.Scip.Types.definitionLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 335 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionLocation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 341 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SearchBySymbol_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.SearchBySymbol_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SearchBySymbol_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SearchBySymbol_key" (Prelude.Just 0))
+{-# LINE 350 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SearchBySymbol_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 352 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.SearchBySymbol
+         where
+  type KeyType Glean.Schema.Scip.Types.SearchBySymbol =
+       Glean.Schema.Scip.Types.SearchBySymbol_key
+  getName _proxy = Glean.PredicateRef "scip.SearchBySymbol" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.searchBySymbol_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SearchBySymbol x k
+  getFactKey = Glean.Schema.Scip.Types.searchBySymbol_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 361 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SearchBySymbol where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 367 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileXLangSymbolRef_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.FileXLangSymbolRef_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.FileXLangSymbolRef_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.FileXLangSymbolRef_key" (Prelude.Just 0))
+{-# LINE 378 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.FileXLangSymbolRef_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "range" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "target"
+             (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+             ('Angle.TNoFields)))
+{-# LINE 380 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.FileXLangSymbolRef
+         where
+  type KeyType Glean.Schema.Scip.Types.FileXLangSymbolRef =
+       Glean.Schema.Scip.Types.FileXLangSymbolRef_key
+  getName _proxy = Glean.PredicateRef "scip.FileXLangSymbolRef" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.fileXLangSymbolRef_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.FileXLangSymbolRef x k
+  getFactKey = Glean.Schema.Scip.Types.fileXLangSymbolRef_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 389 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileXLangSymbolRef
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 395 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ReferenceLocation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.ReferenceLocation_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.ReferenceLocation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.ReferenceLocation_key" (Prelude.Just 0))
+{-# LINE 406 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.ReferenceLocation_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "range" (Glean.Schema.LsifTypes.Types.RangeSpan)
+          ('Angle.TField "xref"
+             (Glean.KeyType Glean.Schema.Scip.Types.Reference)
+             ('Angle.TNoFields)))
+{-# LINE 408 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.ReferenceLocation
+         where
+  type KeyType Glean.Schema.Scip.Types.ReferenceLocation =
+       Glean.Schema.Scip.Types.ReferenceLocation_key
+  getName _proxy = Glean.PredicateRef "scip.ReferenceLocation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.referenceLocation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.ReferenceLocation x k
+  getFactKey = Glean.Schema.Scip.Types.referenceLocation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 417 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ReferenceLocation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 423 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.SymbolDocumentation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SymbolDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SymbolDocumentation_key" (Prelude.Just 0))
+{-# LINE 432 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SymbolDocumentation_key
+     =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "docs"
+          (Glean.KeyType Glean.Schema.Scip.Types.Documentation)
+          ('Angle.TNoFields))
+{-# LINE 434 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Scip.Types.SymbolDocumentation
+         where
+  type KeyType Glean.Schema.Scip.Types.SymbolDocumentation =
+       Glean.Schema.Scip.Types.SymbolDocumentation_key
+  getName _proxy = Glean.PredicateRef "scip.SymbolDocumentation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.symbolDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SymbolDocumentation x k
+  getFactKey = Glean.Schema.Scip.Types.symbolDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 443 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 449 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.LocalName where
+  type KeyType Glean.Schema.Scip.Types.LocalName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "scip.LocalName" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.localName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.LocalName x k
+  getFactKey = Glean.Schema.Scip.Types.localName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 457 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.LocalName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 463 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Reference_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.Reference_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.Reference_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.Reference_key" (Prelude.Just 0))
+{-# LINE 472 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.Reference_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "location"
+          (Glean.KeyType Glean.Schema.Scip.Types.FileRange)
+          ('Angle.TNoFields))
+{-# LINE 474 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.Reference where
+  type KeyType Glean.Schema.Scip.Types.Reference =
+       Glean.Schema.Scip.Types.Reference_key
+  getName _proxy = Glean.PredicateRef "scip.Reference" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.reference_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.Reference x k
+  getFactKey = Glean.Schema.Scip.Types.reference_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 483 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Reference where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 489 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.DisplayName where
+  type KeyType Glean.Schema.Scip.Types.DisplayName = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "scip.DisplayName" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.displayName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DisplayName x k
+  getFactKey = Glean.Schema.Scip.Types.displayName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 497 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DisplayName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 503 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Metadata_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.Metadata_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.Metadata_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.Metadata_key" (Prelude.Just 0))
+{-# LINE 516 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.Metadata_key =
+     'Angle.TField "version" (Glean.Schema.Scip.Types.ProtocolVersion)
+       ('Angle.TField "toolInfo"
+          (Prelude.Maybe Glean.Schema.LsifTypes.Types.ToolInfo)
+          ('Angle.TField "projectRoot" (Data.Text.Text)
+             ('Angle.TField "textEncoding"
+                (Glean.Schema.Scip.Types.TextEncoding)
+                ('Angle.TNoFields))))
+{-# LINE 518 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.Metadata where
+  type KeyType Glean.Schema.Scip.Types.Metadata =
+       Glean.Schema.Scip.Types.Metadata_key
+  getName _proxy = Glean.PredicateRef "scip.Metadata" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.metadata_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.Metadata x k
+  getFactKey = Glean.Schema.Scip.Types.metadata_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 527 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Metadata where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 533 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Definition_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.Definition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.Definition_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.Definition_key" (Prelude.Just 0))
+{-# LINE 542 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.Definition_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "location"
+          (Glean.KeyType Glean.Schema.Scip.Types.FileRange)
+          ('Angle.TNoFields))
+{-# LINE 544 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.Definition where
+  type KeyType Glean.Schema.Scip.Types.Definition =
+       Glean.Schema.Scip.Types.Definition_key
+  getName _proxy = Glean.PredicateRef "scip.Definition" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.definition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.Definition x k
+  getFactKey = Glean.Schema.Scip.Types.definition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 553 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Definition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 559 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.IsImplemented_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.IsImplemented_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.IsImplemented_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.IsImplemented_key" (Prelude.Just 0))
+{-# LINE 568 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.IsImplemented_key =
+     'Angle.TField "implemented"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "symbol"
+          (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+          ('Angle.TNoFields))
+{-# LINE 570 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.IsImplemented
+         where
+  type KeyType Glean.Schema.Scip.Types.IsImplemented =
+       Glean.Schema.Scip.Types.IsImplemented_key
+  getName _proxy = Glean.PredicateRef "scip.IsImplemented" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.isImplemented_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.IsImplemented x k
+  getFactKey = Glean.Schema.Scip.Types.isImplemented_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 579 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.IsImplemented where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 585 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DisplayNameSymbol_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.DisplayNameSymbol_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.DisplayNameSymbol_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.DisplayNameSymbol_key" (Prelude.Just 0))
+{-# LINE 594 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.DisplayNameSymbol_key =
+     'Angle.TField "displayName"
+       (Glean.KeyType Glean.Schema.Scip.Types.DisplayName)
+       ('Angle.TField "symbol"
+          (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+          ('Angle.TNoFields))
+{-# LINE 596 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.DisplayNameSymbol
+         where
+  type KeyType Glean.Schema.Scip.Types.DisplayNameSymbol =
+       Glean.Schema.Scip.Types.DisplayNameSymbol_key
+  getName _proxy = Glean.PredicateRef "scip.DisplayNameSymbol" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.displayNameSymbol_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DisplayNameSymbol x k
+  getFactKey = Glean.Schema.Scip.Types.displayNameSymbol_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 605 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DisplayNameSymbol where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 611 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileLanguage_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.FileLanguage_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.FileLanguage_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.FileLanguage_key" (Prelude.Just 0))
+{-# LINE 620 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.FileLanguage_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "language" (Glean.Schema.LsifTypes.Types.LanguageId)
+          ('Angle.TNoFields))
+{-# LINE 622 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.FileLanguage where
+  type KeyType Glean.Schema.Scip.Types.FileLanguage =
+       Glean.Schema.Scip.Types.FileLanguage_key
+  getName _proxy = Glean.PredicateRef "scip.FileLanguage" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.fileLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.FileLanguage x k
+  getFactKey = Glean.Schema.Scip.Types.fileLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 631 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.FileLanguage where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 637 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.Documentation
+         where
+  type KeyType Glean.Schema.Scip.Types.Documentation = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "scip.Documentation" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.documentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.Documentation x k
+  getFactKey = Glean.Schema.Scip.Types.documentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 645 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Documentation where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 651 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.Symbol where
+  type KeyType Glean.Schema.Scip.Types.Symbol = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "scip.Symbol" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.symbol_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.Symbol x k
+  getFactKey = Glean.Schema.Scip.Types.symbol_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 659 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Symbol where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 665 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.Scip.Types.DefinitionDocumentation_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.DefinitionDocumentation_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.DefinitionDocumentation_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.DefinitionDocumentation_key"
+           (Prelude.Just 0))
+{-# LINE 674 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.Scip.Types.DefinitionDocumentation_key
+     =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+       ('Angle.TField "docs"
+          (Glean.KeyType Glean.Schema.Scip.Types.Documentation)
+          ('Angle.TNoFields))
+{-# LINE 676 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.Scip.Types.DefinitionDocumentation
+         where
+  type KeyType Glean.Schema.Scip.Types.DefinitionDocumentation =
+       Glean.Schema.Scip.Types.DefinitionDocumentation_key
+  getName _proxy
+    = Glean.PredicateRef "scip.DefinitionDocumentation" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.definitionDocumentation_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DefinitionDocumentation x k
+  getFactKey = Glean.Schema.Scip.Types.definitionDocumentation_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 685 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionDocumentation
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 691 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolDisplayName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.SymbolDisplayName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SymbolDisplayName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SymbolDisplayName_key" (Prelude.Just 0))
+{-# LINE 700 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.SymbolDisplayName_key =
+     'Angle.TField "symbol"
+       (Glean.KeyType Glean.Schema.Scip.Types.Symbol)
+       ('Angle.TField "displayName"
+          (Glean.KeyType Glean.Schema.Scip.Types.DisplayName)
+          ('Angle.TNoFields))
+{-# LINE 702 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.SymbolDisplayName
+         where
+  type KeyType Glean.Schema.Scip.Types.SymbolDisplayName =
+       Glean.Schema.Scip.Types.SymbolDisplayName_key
+  getName _proxy = Glean.PredicateRef "scip.SymbolDisplayName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.symbolDisplayName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.SymbolDisplayName x k
+  getFactKey = Glean.Schema.Scip.Types.symbolDisplayName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 711 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SymbolDisplayName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 717 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.TagDefinition_key where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.TagDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.TagDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.TagDefinition_key" (Prelude.Just 0))
+{-# LINE 728 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.TagDefinition_key =
+     'Angle.TField "language" (Glean.Schema.LsifTypes.Types.LanguageId)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+          ('Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 730 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.TagDefinition
+         where
+  type KeyType Glean.Schema.Scip.Types.TagDefinition =
+       Glean.Schema.Scip.Types.TagDefinition_key
+  getName _proxy = Glean.PredicateRef "scip.TagDefinition" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.tagDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.TagDefinition x k
+  getFactKey = Glean.Schema.Scip.Types.tagDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 739 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.TagDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 745 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.Scip.Types.EntityDefinition_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.EntityDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.EntityDefinition_key" (Prelude.Just 0))
+{-# LINE 754 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.EntityDefinition_key =
+     'Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+       ('Angle.TField "defn"
+          (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 756 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.EntityDefinition
+         where
+  type KeyType Glean.Schema.Scip.Types.EntityDefinition =
+       Glean.Schema.Scip.Types.EntityDefinition_key
+  getName _proxy = Glean.PredicateRef "scip.EntityDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.entityDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.EntityDefinition x k
+  getFactKey = Glean.Schema.Scip.Types.entityDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 765 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityDefinition where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 771 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionUses_key
+         where
+  buildRtsValue b (Glean.Schema.Scip.Types.DefinitionUses_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.DefinitionUses_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.DefinitionUses_key" (Prelude.Just 0))
+{-# LINE 780 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.DefinitionUses_key =
+     'Angle.TField "target"
+       (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+       ('Angle.TField "xref"
+          (Glean.KeyType Glean.Schema.Scip.Types.Reference)
+          ('Angle.TNoFields))
+{-# LINE 782 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.DefinitionUses
+         where
+  type KeyType Glean.Schema.Scip.Types.DefinitionUses =
+       Glean.Schema.Scip.Types.DefinitionUses_key
+  getName _proxy = Glean.PredicateRef "scip.DefinitionUses" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Scip.Types.definitionUses_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.DefinitionUses x k
+  getFactKey = Glean.Schema.Scip.Types.definitionUses_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 791 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.DefinitionUses where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 797 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityKind_key where
+  buildRtsValue b (Glean.Schema.Scip.Types.EntityKind_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.EntityKind_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.EntityKind_key" (Prelude.Just 0))
+{-# LINE 806 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Scip.Types.EntityKind_key =
+     'Angle.TField "entity" (Glean.Schema.Scip.Types.Entity)
+       ('Angle.TField "kind" (Glean.Schema.LsifTypes.Types.SymbolKind)
+          ('Angle.TNoFields))
+{-# LINE 808 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Scip.Types.EntityKind where
+  type KeyType Glean.Schema.Scip.Types.EntityKind =
+       Glean.Schema.Scip.Types.EntityKind_key
+  getName _proxy = Glean.PredicateRef "scip.EntityKind" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Scip.Types.entityKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Scip.Types.EntityKind x k
+  getFactKey = Glean.Schema.Scip.Types.entityKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 817 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.EntityKind where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 823 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.SomeEntity where
+  buildRtsValue b (Glean.Schema.Scip.Types.SomeEntity x1)
+    = do Glean.buildRtsValue b x1
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.SomeEntity <$> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.SomeEntity" (Prelude.Just 1))
+{-# LINE 830 "glean/schema/thrift/scip_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Scip.Types.SomeEntity
+     =
+     'Angle.TField "defn"
+       (Glean.KeyType Glean.Schema.Scip.Types.Definition)
+       ('Angle.TNoFields)
+{-# LINE 832 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.ProtocolVersion where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.ProtocolVersion" (Prelude.Just 1))
+{-# LINE 837 "glean/schema/thrift/scip_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Scip.Types.ProtocolVersion =
+     'Angle.TField "UnspecifiedProtocolVersion"
+       (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TNoFields)
+{-# LINE 839 "glean/schema/thrift/scip_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Scip.Types.ProtocolVersion
+         where
+  type AngleEnumTy Glean.Schema.Scip.Types.ProtocolVersion =
+       Glean.Schema.Scip.Types.ProtocolVersion
+  enumName v = Text.pack (Prelude.drop 16 (Prelude.show v))
+{-# LINE 843 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.TextEncoding where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.TextEncoding" (Prelude.Just 1))
+{-# LINE 848 "glean/schema/thrift/scip_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Scip.Types.TextEncoding
+     =
+     'Angle.TField "UnspecifiedTextEncoding"
+       (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "UTF8" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "UTF16" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TNoFields)))
+{-# LINE 850 "glean/schema/thrift/scip_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Scip.Types.TextEncoding where
+  type AngleEnumTy Glean.Schema.Scip.Types.TextEncoding =
+       Glean.Schema.Scip.Types.TextEncoding
+  enumName v = Text.pack (Prelude.drop 13 (Prelude.show v))
+{-# LINE 854 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Location where
+  buildRtsValue b (Glean.Schema.Scip.Types.Location x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Scip.Types.Location <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "scip.Location" (Prelude.Just 1))
+{-# LINE 865 "glean/schema/thrift/scip_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Scip.Types.Location =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "location" (Glean.Schema.Src.Types.Range)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 867 "glean/schema/thrift/scip_include.hs" #-}
+instance Glean.Type Glean.Schema.Scip.Types.Entity where
+  buildRtsValue b Glean.Schema.Scip.Types.Entity_EMPTY
+    = Glean.buildRtsSelector b 6
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_rust x)
+    = do Glean.buildRtsSelector b 0
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_go x)
+    = do Glean.buildRtsSelector b 1
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_typescript x)
+    = do Glean.buildRtsSelector b 2
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_java x)
+    = do Glean.buildRtsSelector b 3
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_kotlin x)
+    = do Glean.buildRtsSelector b 4
+         Glean.buildRtsValue b x
+  buildRtsValue b (Glean.Schema.Scip.Types.Entity_swift x)
+    = do Glean.buildRtsSelector b 5
+         Glean.buildRtsValue b x
+  decodeRtsValue
+    = Glean.sumD (Prelude.pure Glean.Schema.Scip.Types.Entity_EMPTY)
+        [Glean.mapD Glean.Schema.Scip.Types.Entity_rust,
+         Glean.mapD Glean.Schema.Scip.Types.Entity_go,
+         Glean.mapD Glean.Schema.Scip.Types.Entity_typescript,
+         Glean.mapD Glean.Schema.Scip.Types.Entity_java,
+         Glean.mapD Glean.Schema.Scip.Types.Entity_kotlin,
+         Glean.mapD Glean.Schema.Scip.Types.Entity_swift]
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "scip.Entity" (Prelude.Just 1))
+{-# LINE 899 "glean/schema/thrift/scip_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Scip.Types.Entity =
+     'Angle.TField "rust" (Glean.Schema.Scip.Types.SomeEntity)
+       ('Angle.TField "go" (Glean.Schema.Scip.Types.SomeEntity)
+          ('Angle.TField "typescript" (Glean.Schema.Scip.Types.SomeEntity)
+             ('Angle.TField "java" (Glean.Schema.Scip.Types.SomeEntity)
+                ('Angle.TField "kotlin" (Glean.Schema.Scip.Types.SomeEntity)
+                   ('Angle.TField "swift" (Glean.Schema.Scip.Types.SomeEntity)
+                      ('Angle.TNoFields))))))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchAnglelang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchAnglelang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchAnglelang/Types.hs
@@ -0,0 +1,491 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_anglelang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_anglelang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_anglelang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchAnglelang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchAnglelang.Types
+       (pREDICATE_VERSIONS, SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        NameLowerCase_id,
+        NameLowerCase(NameLowerCase, nameLowerCase_id, nameLowerCase_key),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_entity),
+        NameLowerCase_key(NameLowerCase_key,
+                          nameLowerCase_key_nameLowerCase, nameLowerCase_key_name))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Anglelang.Types
+       as Glean.Schema.Anglelang
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeAnglelang.Types
+       as Glean.Schema.CodeAnglelang
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Schema.Anglelang.Types
+{-# LINE 15 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 16 "glean/schema/thrift/search_anglelang_include.hs" #-}
+import qualified Glean.Schema.CodeAnglelang.Types
+{-# LINE 84 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchAnglelang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList [("NameLowerCase", 1), ("SearchByName", 1)]
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type NameLowerCase_id = Glean.Id
+
+data NameLowerCase = NameLowerCase{nameLowerCase_id ::
+                                   {-# UNPACK #-} !NameLowerCase_id,
+                                   nameLowerCase_key :: Prelude.Maybe NameLowerCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase where
+  toJSON (NameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase where
+  buildStruct _proxy (NameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (NameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase where
+  rnf (NameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default NameLowerCase where
+  def = NameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable NameLowerCase where
+  hashWithSalt __salt (NameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Glean.Schema.Anglelang.Name,
+                                         searchByName_key_entity ::
+                                         Glean.Schema.CodeAnglelang.Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data NameLowerCase_key = NameLowerCase_key{nameLowerCase_key_nameLowerCase
+                                           :: Text.Text,
+                                           nameLowerCase_key_name :: Glean.Schema.Anglelang.Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NameLowerCase_key where
+  toJSON (NameLowerCase_key __field__nameLowerCase __field__name)
+    = Aeson.object
+        ("nameLowerCase" .= __field__nameLowerCase :
+           "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct NameLowerCase_key where
+  buildStruct _proxy
+    (NameLowerCase_key __field__nameLowerCase __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowerCase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowerCase)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__name)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowerCase <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowerCase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowerCase <- ST.readSTRef
+                                                                        __field__nameLowerCase
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (NameLowerCase_key __val__nameLowerCase __val__name)
+              _idMap = HashMap.fromList [("nameLowerCase", 1), ("name", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData NameLowerCase_key where
+  rnf (NameLowerCase_key __field__nameLowerCase __field__name)
+    = DeepSeq.rnf __field__nameLowerCase `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default NameLowerCase_key where
+  def = NameLowerCase_key "" Default.def
+
+instance Hashable.Hashable NameLowerCase_key where
+  hashWithSalt __salt (NameLowerCase_key _nameLowerCase _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt __salt _nameLowerCase)
+        _name
+{-# LINE 19 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchAnglelang.Types.NameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchAnglelang.Types.NameLowerCase_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchAnglelang.Types.NameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.anglelang.NameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/search_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchAnglelang.Types.NameLowerCase_key
+     =
+     'Angle.TField "nameLowerCase" (Data.Text.Text)
+       ('Angle.TField "name"
+          (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchAnglelang.Types.NameLowerCase
+         where
+  type KeyType Glean.Schema.SearchAnglelang.Types.NameLowerCase =
+       Glean.Schema.SearchAnglelang.Types.NameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.anglelang.NameLowerCase" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchAnglelang.Types.nameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchAnglelang.Types.NameLowerCase x k
+  getFactKey = Glean.Schema.SearchAnglelang.Types.nameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchAnglelang.Types.NameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchAnglelang.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchAnglelang.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchAnglelang.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.anglelang.SearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 54 "glean/schema/thrift/search_anglelang_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchAnglelang.Types.SearchByName_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Anglelang.Types.Name)
+       ('Angle.TField "entity" (Glean.Schema.CodeAnglelang.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 56 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchAnglelang.Types.SearchByName
+         where
+  type KeyType Glean.Schema.SearchAnglelang.Types.SearchByName =
+       Glean.Schema.SearchAnglelang.Types.SearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.anglelang.SearchByName" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchAnglelang.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchAnglelang.Types.SearchByName x k
+  getFactKey = Glean.Schema.SearchAnglelang.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 65 "glean/schema/thrift/search_anglelang_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchAnglelang.Types.SearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchBuck/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchBuck/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchBuck/Types.hs
@@ -0,0 +1,766 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_buck_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_buck_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_buck_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchBuck/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchBuck.Types
+       (pREDICATE_VERSIONS, SearchFile_id,
+        SearchFile(SearchFile, searchFile_id, searchFile_key),
+        SearchDefinition_id,
+        SearchDefinition(SearchDefinition, searchDefinition_id,
+                         searchDefinition_key),
+        SearchByFQN_id,
+        SearchByFQN(SearchByFQN, searchByFQN_id, searchByFQN_key),
+        SearchFile_key(SearchFile_key, searchFile_key_file,
+                       searchFile_key_entity),
+        SearchDefinition_key(SearchDefinition_key,
+                             searchDefinition_key_module, searchDefinition_key_name,
+                             searchDefinition_key_entity),
+        SearchByFQN_key(SearchByFQN_key, searchByFQN_key_subdir,
+                        searchByFQN_key_path, searchByFQN_key_name,
+                        searchByFQN_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeBuck.Types
+       as Glean.Schema.CodeBuck
+import qualified Glean.Schema.Src.Types as Glean.Schema.Src
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Schema.CodeBuck.Types
+{-# LINE 16 "glean/schema/thrift/search_buck_include.hs" #-}
+import qualified Glean.Schema.Src.Types
+{-# LINE 90 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchBuck/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("SearchFile", 1), ("SearchDefinition", 1), ("SearchByFQN", 1)]
+
+type SearchFile_id = Glean.Id
+
+data SearchFile = SearchFile{searchFile_id ::
+                             {-# UNPACK #-} !SearchFile_id,
+                             searchFile_key :: Prelude.Maybe SearchFile_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFile where
+  toJSON (SearchFile __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFile where
+  buildStruct _proxy (SearchFile __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchFile __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFile where
+  rnf (SearchFile __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFile where
+  def = SearchFile Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFile where
+  hashWithSalt __salt (SearchFile _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchDefinition_id = Glean.Id
+
+data SearchDefinition = SearchDefinition{searchDefinition_id ::
+                                         {-# UNPACK #-} !SearchDefinition_id,
+                                         searchDefinition_key :: Prelude.Maybe SearchDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDefinition where
+  toJSON (SearchDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDefinition where
+  buildStruct _proxy (SearchDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDefinition where
+  rnf (SearchDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchDefinition where
+  def = SearchDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchDefinition where
+  hashWithSalt __salt (SearchDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByFQN_id = Glean.Id
+
+data SearchByFQN = SearchByFQN{searchByFQN_id ::
+                               {-# UNPACK #-} !SearchByFQN_id,
+                               searchByFQN_key :: Prelude.Maybe SearchByFQN_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFQN where
+  toJSON (SearchByFQN __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByFQN where
+  buildStruct _proxy (SearchByFQN __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByFQN __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFQN where
+  rnf (SearchByFQN __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByFQN where
+  def = SearchByFQN Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByFQN where
+  hashWithSalt __salt (SearchByFQN _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchFile_key = SearchFile_key{searchFile_key_file ::
+                                     Glean.Schema.Src.File,
+                                     searchFile_key_entity :: Glean.Schema.CodeBuck.Entity}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFile_key where
+  toJSON (SearchFile_key __field__file __field__entity)
+    = Aeson.object
+        ("file" .= __field__file :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFile_key where
+  buildStruct _proxy (SearchFile_key __field__file __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure (SearchFile_key __val__file __val__entity)
+              _idMap = HashMap.fromList [("file", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFile_key where
+  rnf (SearchFile_key __field__file __field__entity)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchFile_key where
+  def = SearchFile_key Default.def Default.def
+
+instance Hashable.Hashable SearchFile_key where
+  hashWithSalt __salt (SearchFile_key _file _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _entity
+
+data SearchDefinition_key = SearchDefinition_key{searchDefinition_key_module
+                                                 :: Glean.Schema.Src.File,
+                                                 searchDefinition_key_name :: Text.Text,
+                                                 searchDefinition_key_entity ::
+                                                 Glean.Schema.CodeBuck.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchDefinition_key where
+  toJSON
+    (SearchDefinition_key __field__module __field__name
+       __field__entity)
+    = Aeson.object
+        ("module" .= __field__module :
+           "name" .= __field__name :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchDefinition_key where
+  buildStruct _proxy
+    (SearchDefinition_key __field__module __field__name
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__module)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef Default.def
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchDefinition_key __val__module __val__name
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("module", 1), ("name", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchDefinition_key where
+  rnf
+    (SearchDefinition_key __field__module __field__name
+       __field__entity)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchDefinition_key where
+  def = SearchDefinition_key Default.def "" Default.def
+
+instance Hashable.Hashable SearchDefinition_key where
+  hashWithSalt __salt (SearchDefinition_key _module _name _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+           _name)
+        _entity
+
+data SearchByFQN_key = SearchByFQN_key{searchByFQN_key_subdir ::
+                                       Prelude.Maybe Text.Text,
+                                       searchByFQN_key_path :: Text.Text,
+                                       searchByFQN_key_name :: Text.Text,
+                                       searchByFQN_key_entity :: Glean.Schema.CodeBuck.Entity}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFQN_key where
+  toJSON
+    (SearchByFQN_key __field__subdir __field__path __field__name
+       __field__entity)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("subdir" .=)) __field__subdir
+           ("path" .= __field__path :
+              "name" .= __field__name :
+                "entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByFQN_key where
+  buildStruct _proxy
+    (SearchByFQN_key __field__subdir __field__path __field__name
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (let (__cereal__subdir, __id__subdir)
+               = case __field__subdir of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "subdir"
+                                              (Thrift.getStringType _proxy)
+                                              1
+                                              0
+                                              (Thrift.genText _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__subdir
+             (Thrift.genField _proxy "path" (Thrift.getStringType _proxy) 2
+                __id__subdir
+                (Thrift.genText _proxy __field__path)
+                :
+                Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3 2
+                  (Thrift.genText _proxy __field__name)
+                  :
+                  Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__subdir <- ST.newSTRef Prelude.Nothing
+            __field__path <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__subdir
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__path
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__subdir <- ST.readSTRef
+                                                                 __field__subdir
+                                             !__val__path <- ST.readSTRef __field__path
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByFQN_key __val__subdir __val__path
+                                                  __val__name
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("subdir", 1), ("path", 2), ("name", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFQN_key where
+  rnf
+    (SearchByFQN_key __field__subdir __field__path __field__name
+       __field__entity)
+    = DeepSeq.rnf __field__subdir `Prelude.seq`
+        DeepSeq.rnf __field__path `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByFQN_key where
+  def = SearchByFQN_key Prelude.Nothing "" "" Default.def
+
+instance Hashable.Hashable SearchByFQN_key where
+  hashWithSalt __salt (SearchByFQN_key _subdir _path _name _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _subdir)
+              _path)
+           _name)
+        _entity
+{-# LINE 19 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchBuck.Types.SearchFile_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchBuck.Types.SearchFile_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchBuck.Types.SearchFile_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.buck.SearchFile_key" (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/search_buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchBuck.Types.SearchFile_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchBuck.Types.SearchFile
+         where
+  type KeyType Glean.Schema.SearchBuck.Types.SearchFile =
+       Glean.Schema.SearchBuck.Types.SearchFile_key
+  getName _proxy = Glean.PredicateRef "search.buck.SearchFile" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchBuck.Types.searchFile_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchBuck.Types.SearchFile x k
+  getFactKey = Glean.Schema.SearchBuck.Types.searchFile_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchBuck.Types.SearchFile where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchBuck.Types.SearchDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchBuck.Types.SearchDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchBuck.Types.SearchDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.buck.SearchDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 56 "glean/schema/thrift/search_buck_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchBuck.Types.SearchDefinition_key
+     =
+     'Angle.TField "module" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 58 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchBuck.Types.SearchDefinition
+         where
+  type KeyType Glean.Schema.SearchBuck.Types.SearchDefinition =
+       Glean.Schema.SearchBuck.Types.SearchDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "search.buck.SearchDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchBuck.Types.searchDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchBuck.Types.SearchDefinition x k
+  getFactKey = Glean.Schema.SearchBuck.Types.searchDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 67 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchBuck.Types.SearchDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 73 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchBuck.Types.SearchByFQN_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchBuck.Types.SearchByFQN_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchBuck.Types.SearchByFQN_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.buck.SearchByFQN_key" (Prelude.Just 0))
+{-# LINE 86 "glean/schema/thrift/search_buck_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchBuck.Types.SearchByFQN_key =
+     'Angle.TField "subdir" (Prelude.Maybe Data.Text.Text)
+       ('Angle.TField "path" (Data.Text.Text)
+          ('Angle.TField "name" (Data.Text.Text)
+             ('Angle.TField "entity" (Glean.Schema.CodeBuck.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 88 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchBuck.Types.SearchByFQN
+         where
+  type KeyType Glean.Schema.SearchBuck.Types.SearchByFQN =
+       Glean.Schema.SearchBuck.Types.SearchByFQN_key
+  getName _proxy = Glean.PredicateRef "search.buck.SearchByFQN" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchBuck.Types.searchByFQN_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchBuck.Types.SearchByFQN x k
+  getFactKey = Glean.Schema.SearchBuck.Types.searchByFQN_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/search_buck_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchBuck.Types.SearchByFQN where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCode/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCode/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCode/Types.hs
@@ -0,0 +1,16938 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_code_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_code_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_code_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCode/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchCode.Types
+       (pREDICATE_VERSIONS, ThriftSearchByName_id,
+        ThriftSearchByName(ThriftSearchByName, thriftSearchByName_id,
+                           thriftSearchByName_key),
+        ThriftSearchByLowerCaseName_id,
+        ThriftSearchByLowerCaseName(ThriftSearchByLowerCaseName,
+                                    thriftSearchByLowerCaseName_id,
+                                    thriftSearchByLowerCaseName_key),
+        SearchByScopeAndKind_id,
+        SearchByScopeAndKind(SearchByScopeAndKind, searchByScopeAndKind_id,
+                             searchByScopeAndKind_key),
+        SearchByScope_id,
+        SearchByScope(SearchByScope, searchByScope_id, searchByScope_key),
+        SearchByNameKindAndLanguage_id,
+        SearchByNameKindAndLanguage(SearchByNameKindAndLanguage,
+                                    searchByNameKindAndLanguage_id,
+                                    searchByNameKindAndLanguage_key),
+        SearchByNameAndLanguage_id,
+        SearchByNameAndLanguage(SearchByNameAndLanguage,
+                                searchByNameAndLanguage_id, searchByNameAndLanguage_key),
+        SearchByLowerCaseScopeAndKind_id,
+        SearchByLowerCaseScopeAndKind(SearchByLowerCaseScopeAndKind,
+                                      searchByLowerCaseScopeAndKind_id,
+                                      searchByLowerCaseScopeAndKind_key),
+        SearchByLowerCaseScope_id,
+        SearchByLowerCaseScope(SearchByLowerCaseScope,
+                               searchByLowerCaseScope_id, searchByLowerCaseScope_key),
+        SearchByLowerCaseNameKindAndLanguage_id,
+        SearchByLowerCaseNameKindAndLanguage(SearchByLowerCaseNameKindAndLanguage,
+                                             searchByLowerCaseNameKindAndLanguage_id,
+                                             searchByLowerCaseNameKindAndLanguage_key),
+        SearchByLowerCaseNameAndLanguage_id,
+        SearchByLowerCaseNameAndLanguage(SearchByLowerCaseNameAndLanguage,
+                                         searchByLowerCaseNameAndLanguage_id,
+                                         searchByLowerCaseNameAndLanguage_key),
+        RustSearchByNameAndKind_id,
+        RustSearchByNameAndKind(RustSearchByNameAndKind,
+                                rustSearchByNameAndKind_id, rustSearchByNameAndKind_key),
+        PythonSearchByScopeAndKind_id,
+        PythonSearchByScopeAndKind(PythonSearchByScopeAndKind,
+                                   pythonSearchByScopeAndKind_id, pythonSearchByScopeAndKind_key),
+        PythonSearchByNameKindAndScopeFact_id,
+        PythonSearchByNameKindAndScopeFact(PythonSearchByNameKindAndScopeFact,
+                                           pythonSearchByNameKindAndScopeFact_id,
+                                           pythonSearchByNameKindAndScopeFact_key),
+        PythonSearchByLowerCaseScopeAndKind_id,
+        PythonSearchByLowerCaseScopeAndKind(PythonSearchByLowerCaseScopeAndKind,
+                                            pythonSearchByLowerCaseScopeAndKind_id,
+                                            pythonSearchByLowerCaseScopeAndKind_key),
+        PythonSearchByLowerCaseNameKindAndScopeFact_id,
+        PythonSearchByLowerCaseNameKindAndScopeFact(PythonSearchByLowerCaseNameKindAndScopeFact,
+                                                    pythonSearchByLowerCaseNameKindAndScopeFact_id,
+                                                    pythonSearchByLowerCaseNameKindAndScopeFact_key),
+        PythonNameLowerCase_id,
+        PythonNameLowerCase(PythonNameLowerCase, pythonNameLowerCase_id,
+                            pythonNameLowerCase_key),
+        PpSearchByNameKind_id,
+        PpSearchByNameKind(PpSearchByNameKind, ppSearchByNameKind_id,
+                           ppSearchByNameKind_key),
+        PpSearchByLowerCaseNameKind_id,
+        PpSearchByLowerCaseNameKind(PpSearchByLowerCaseNameKind,
+                                    ppSearchByLowerCaseNameKind_id,
+                                    ppSearchByLowerCaseNameKind_key),
+        LsifSearchByName_id,
+        LsifSearchByName(LsifSearchByName, lsifSearchByName_id,
+                         lsifSearchByName_key),
+        LsifSearchByLowerCaseName_id,
+        LsifSearchByLowerCaseName(LsifSearchByLowerCaseName,
+                                  lsifSearchByLowerCaseName_id, lsifSearchByLowerCaseName_key),
+        KotlinSearchByScopeWithName_id,
+        KotlinSearchByScopeWithName(KotlinSearchByScopeWithName,
+                                    kotlinSearchByScopeWithName_id,
+                                    kotlinSearchByScopeWithName_key),
+        KotlinSearchByScope_id,
+        KotlinSearchByScope(KotlinSearchByScope, kotlinSearchByScope_id,
+                            kotlinSearchByScope_key),
+        KotlinSearchByNameWithFact_id,
+        KotlinSearchByNameWithFact(KotlinSearchByNameWithFact,
+                                   kotlinSearchByNameWithFact_id, kotlinSearchByNameWithFact_key),
+        KotlinSearchByName_id,
+        KotlinSearchByName(KotlinSearchByName, kotlinSearchByName_id,
+                           kotlinSearchByName_key),
+        KotlinSearchByLowerCaseScope_id,
+        KotlinSearchByLowerCaseScope(KotlinSearchByLowerCaseScope,
+                                     kotlinSearchByLowerCaseScope_id,
+                                     kotlinSearchByLowerCaseScope_key),
+        KotlinSearchByLowerCaseName_id,
+        KotlinSearchByLowerCaseName(KotlinSearchByLowerCaseName,
+                                    kotlinSearchByLowerCaseName_id,
+                                    kotlinSearchByLowerCaseName_key),
+        JavaSearchByScopeWithName_id,
+        JavaSearchByScopeWithName(JavaSearchByScopeWithName,
+                                  javaSearchByScopeWithName_id, javaSearchByScopeWithName_key),
+        JavaSearchByScope_id,
+        JavaSearchByScope(JavaSearchByScope, javaSearchByScope_id,
+                          javaSearchByScope_key),
+        JavaSearchByNameWithFact_id,
+        JavaSearchByNameWithFact(JavaSearchByNameWithFact,
+                                 javaSearchByNameWithFact_id, javaSearchByNameWithFact_key),
+        JavaSearchByName_id,
+        JavaSearchByName(JavaSearchByName, javaSearchByName_id,
+                         javaSearchByName_key),
+        JavaSearchByLowerCaseScope_id,
+        JavaSearchByLowerCaseScope(JavaSearchByLowerCaseScope,
+                                   javaSearchByLowerCaseScope_id, javaSearchByLowerCaseScope_key),
+        JavaSearchByLowerCaseName_id,
+        JavaSearchByLowerCaseName(JavaSearchByLowerCaseName,
+                                  javaSearchByLowerCaseName_id, javaSearchByLowerCaseName_key),
+        HsSearchByName_id,
+        HsSearchByName(HsSearchByName, hsSearchByName_id,
+                       hsSearchByName_key),
+        HsSearchByLowerCaseName_id,
+        HsSearchByLowerCaseName(HsSearchByLowerCaseName,
+                                hsSearchByLowerCaseName_id, hsSearchByLowerCaseName_key),
+        HackSearchByScopeWithNameKinds_id,
+        HackSearchByScopeWithNameKinds(HackSearchByScopeWithNameKinds,
+                                       hackSearchByScopeWithNameKinds_id,
+                                       hackSearchByScopeWithNameKinds_key),
+        HackSearchByScopeAndKind_id,
+        HackSearchByScopeAndKind(HackSearchByScopeAndKind,
+                                 hackSearchByScopeAndKind_id, hackSearchByScopeAndKind_key),
+        HackSearchByNameKindWithQName_id,
+        HackSearchByNameKindWithQName(HackSearchByNameKindWithQName,
+                                      hackSearchByNameKindWithQName_id,
+                                      hackSearchByNameKindWithQName_key),
+        HackSearchByNameKindWithNamespace_id,
+        HackSearchByNameKindWithNamespace(HackSearchByNameKindWithNamespace,
+                                          hackSearchByNameKindWithNamespace_id,
+                                          hackSearchByNameKindWithNamespace_key),
+        HackSearchByNameAndKind_id,
+        HackSearchByNameAndKind(HackSearchByNameAndKind,
+                                hackSearchByNameAndKind_id, hackSearchByNameAndKind_key),
+        HackSearchByLowerCaseScopeAndKind_id,
+        HackSearchByLowerCaseScopeAndKind(HackSearchByLowerCaseScopeAndKind,
+                                          hackSearchByLowerCaseScopeAndKind_id,
+                                          hackSearchByLowerCaseScopeAndKind_key),
+        HackSearchByLowerCaseNameAndKind_id,
+        HackSearchByLowerCaseNameAndKind(HackSearchByLowerCaseNameAndKind,
+                                         hackSearchByLowerCaseNameAndKind_id,
+                                         hackSearchByLowerCaseNameAndKind_key),
+        HackNameLowerCase_id,
+        HackNameLowerCase(HackNameLowerCase, hackNameLowerCase_id,
+                          hackNameLowerCase_key),
+        GraphQLSearchByName_id,
+        GraphQLSearchByName(GraphQLSearchByName, graphQLSearchByName_id,
+                            graphQLSearchByName_key),
+        GraphQLSearchByLowerCaseName_id,
+        GraphQLSearchByLowerCaseName(GraphQLSearchByLowerCaseName,
+                                     graphQLSearchByLowerCaseName_id,
+                                     graphQLSearchByLowerCaseName_key),
+        FlowSearchByScopeAndKind_id,
+        FlowSearchByScopeAndKind(FlowSearchByScopeAndKind,
+                                 flowSearchByScopeAndKind_id, flowSearchByScopeAndKind_key),
+        FlowSearchByNameKindAndScopeFact_id,
+        FlowSearchByNameKindAndScopeFact(FlowSearchByNameKindAndScopeFact,
+                                         flowSearchByNameKindAndScopeFact_id,
+                                         flowSearchByNameKindAndScopeFact_key),
+        FlowSearchByLowerCaseScopeAndKind_id,
+        FlowSearchByLowerCaseScopeAndKind(FlowSearchByLowerCaseScopeAndKind,
+                                          flowSearchByLowerCaseScopeAndKind_id,
+                                          flowSearchByLowerCaseScopeAndKind_key),
+        FlowSearchByLowerCaseNameKindAndScopeFact_id,
+        FlowSearchByLowerCaseNameKindAndScopeFact(FlowSearchByLowerCaseNameKindAndScopeFact,
+                                                  flowSearchByLowerCaseNameKindAndScopeFact_id,
+                                                  flowSearchByLowerCaseNameKindAndScopeFact_key),
+        FlowNameLowerCase_id,
+        FlowNameLowerCase(FlowNameLowerCase, flowNameLowerCase_id,
+                          flowNameLowerCase_key),
+        FbthriftSearchByNameFact_id,
+        FbthriftSearchByNameFact(FbthriftSearchByNameFact,
+                                 fbthriftSearchByNameFact_id, fbthriftSearchByNameFact_key),
+        ErlangSearchByName_id,
+        ErlangSearchByName(ErlangSearchByName, erlangSearchByName_id,
+                           erlangSearchByName_key),
+        ErlangSearchByLowerCaseName_id,
+        ErlangSearchByLowerCaseName(ErlangSearchByLowerCaseName,
+                                    erlangSearchByLowerCaseName_id,
+                                    erlangSearchByLowerCaseName_key),
+        CxxSearchByScopeAndKind_id,
+        CxxSearchByScopeAndKind(CxxSearchByScopeAndKind,
+                                cxxSearchByScopeAndKind_id, cxxSearchByScopeAndKind_key),
+        CxxSearchByNameKindAndScopeFact_id,
+        CxxSearchByNameKindAndScopeFact(CxxSearchByNameKindAndScopeFact,
+                                        cxxSearchByNameKindAndScopeFact_id,
+                                        cxxSearchByNameKindAndScopeFact_key),
+        CxxSearchByLowerCaseScopeAndKind_id,
+        CxxSearchByLowerCaseScopeAndKind(CxxSearchByLowerCaseScopeAndKind,
+                                         cxxSearchByLowerCaseScopeAndKind_id,
+                                         cxxSearchByLowerCaseScopeAndKind_key),
+        CxxSearchByLowerCaseNameKindAndScopeFact_id,
+        CxxSearchByLowerCaseNameKindAndScopeFact(CxxSearchByLowerCaseNameKindAndScopeFact,
+                                                 cxxSearchByLowerCaseNameKindAndScopeFact_id,
+                                                 cxxSearchByLowerCaseNameKindAndScopeFact_key),
+        CxxPreferDefinitions_id,
+        CxxPreferDefinitions(CxxPreferDefinitions, cxxPreferDefinitions_id,
+                             cxxPreferDefinitions_key),
+        CxxNameLowerCase_id,
+        CxxNameLowerCase(CxxNameLowerCase, cxxNameLowerCase_id,
+                         cxxNameLowerCase_key),
+        CSharpSearchByName_id,
+        CSharpSearchByName(CSharpSearchByName, cSharpSearchByName_id,
+                           cSharpSearchByName_key),
+        CSharpSearchByLowerCaseName_id,
+        CSharpSearchByLowerCaseName(CSharpSearchByLowerCaseName,
+                                    cSharpSearchByLowerCaseName_id,
+                                    cSharpSearchByLowerCaseName_key),
+        BuckSearchByName_id,
+        BuckSearchByName(BuckSearchByName, buckSearchByName_id,
+                         buckSearchByName_key),
+        BuckSearchByLowerCaseName_id,
+        BuckSearchByLowerCaseName(BuckSearchByLowerCaseName,
+                                  buckSearchByLowerCaseName_id, buckSearchByLowerCaseName_key),
+        BuckSearchByLocalNameFact_id,
+        BuckSearchByLocalNameFact(BuckSearchByLocalNameFact,
+                                  buckSearchByLocalNameFact_id, buckSearchByLocalNameFact_key),
+        AngleSearchByName_id,
+        AngleSearchByName(AngleSearchByName, angleSearchByName_id,
+                          angleSearchByName_key),
+        AngleSearchByLowerCaseName_id,
+        AngleSearchByLowerCaseName(AngleSearchByLowerCaseName,
+                                   angleSearchByLowerCaseName_id, angleSearchByLowerCaseName_key),
+        ThriftSearchByName_key(ThriftSearchByName_key,
+                               thriftSearchByName_key_name, thriftSearchByName_key_entity),
+        ThriftSearchByLowerCaseName_key(ThriftSearchByLowerCaseName_key,
+                                        thriftSearchByLowerCaseName_key_name,
+                                        thriftSearchByLowerCaseName_key_entity),
+        SearchByScopeAndKind_key(SearchByScopeAndKind_key,
+                                 searchByScopeAndKind_key_name, searchByScopeAndKind_key_scope,
+                                 searchByScopeAndKind_key_language, searchByScopeAndKind_key_kinds,
+                                 searchByScopeAndKind_key_entity),
+        SearchByScope_key(SearchByScope_key, searchByScope_key_name,
+                          searchByScope_key_scope, searchByScope_key_language,
+                          searchByScope_key_entity),
+        SearchByNameKindAndLanguage_key(SearchByNameKindAndLanguage_key,
+                                        searchByNameKindAndLanguage_key_name,
+                                        searchByNameKindAndLanguage_key_language,
+                                        searchByNameKindAndLanguage_key_kinds,
+                                        searchByNameKindAndLanguage_key_entity),
+        SearchByNameAndLanguage_key(SearchByNameAndLanguage_key,
+                                    searchByNameAndLanguage_key_name,
+                                    searchByNameAndLanguage_key_language,
+                                    searchByNameAndLanguage_key_entity),
+        SearchByLowerCaseScopeAndKind_key(SearchByLowerCaseScopeAndKind_key,
+                                          searchByLowerCaseScopeAndKind_key_name,
+                                          searchByLowerCaseScopeAndKind_key_scope,
+                                          searchByLowerCaseScopeAndKind_key_language,
+                                          searchByLowerCaseScopeAndKind_key_kinds,
+                                          searchByLowerCaseScopeAndKind_key_entity),
+        SearchByLowerCaseScope_key(SearchByLowerCaseScope_key,
+                                   searchByLowerCaseScope_key_name,
+                                   searchByLowerCaseScope_key_scope,
+                                   searchByLowerCaseScope_key_language,
+                                   searchByLowerCaseScope_key_entity),
+        SearchByLowerCaseNameKindAndLanguage_key(SearchByLowerCaseNameKindAndLanguage_key,
+                                                 searchByLowerCaseNameKindAndLanguage_key_name,
+                                                 searchByLowerCaseNameKindAndLanguage_key_language,
+                                                 searchByLowerCaseNameKindAndLanguage_key_kinds,
+                                                 searchByLowerCaseNameKindAndLanguage_key_entity),
+        SearchByLowerCaseNameAndLanguage_key(SearchByLowerCaseNameAndLanguage_key,
+                                             searchByLowerCaseNameAndLanguage_key_name,
+                                             searchByLowerCaseNameAndLanguage_key_language,
+                                             searchByLowerCaseNameAndLanguage_key_entity),
+        RustSearchByNameAndKind_key(RustSearchByNameAndKind_key,
+                                    rustSearchByNameAndKind_key_name,
+                                    rustSearchByNameAndKind_key_kind,
+                                    rustSearchByNameAndKind_key_entity),
+        PythonSearchByScopeAndKind_key(PythonSearchByScopeAndKind_key,
+                                       pythonSearchByScopeAndKind_key_name,
+                                       pythonSearchByScopeAndKind_key_scope,
+                                       pythonSearchByScopeAndKind_key_kinds,
+                                       pythonSearchByScopeAndKind_key_entity),
+        PythonSearchByNameKindAndScopeFact_key(PythonSearchByNameKindAndScopeFact_key,
+                                               pythonSearchByNameKindAndScopeFact_key_name,
+                                               pythonSearchByNameKindAndScopeFact_key_scope,
+                                               pythonSearchByNameKindAndScopeFact_key_kinds,
+                                               pythonSearchByNameKindAndScopeFact_key_entity),
+        PythonSearchByLowerCaseScopeAndKind_key(PythonSearchByLowerCaseScopeAndKind_key,
+                                                pythonSearchByLowerCaseScopeAndKind_key_name,
+                                                pythonSearchByLowerCaseScopeAndKind_key_scope,
+                                                pythonSearchByLowerCaseScopeAndKind_key_kinds,
+                                                pythonSearchByLowerCaseScopeAndKind_key_entity),
+        PythonSearchByLowerCaseNameKindAndScopeFact_key(PythonSearchByLowerCaseNameKindAndScopeFact_key,
+                                                        pythonSearchByLowerCaseNameKindAndScopeFact_key_name,
+                                                        pythonSearchByLowerCaseNameKindAndScopeFact_key_scope,
+                                                        pythonSearchByLowerCaseNameKindAndScopeFact_key_kinds,
+                                                        pythonSearchByLowerCaseNameKindAndScopeFact_key_entity),
+        PythonNameLowerCase_key(PythonNameLowerCase_key,
+                                pythonNameLowerCase_key_nameLowercase,
+                                pythonNameLowerCase_key_kinds, pythonNameLowerCase_key_name),
+        PpSearchByNameKind_key(PpSearchByNameKind_key,
+                               ppSearchByNameKind_key_name, ppSearchByNameKind_key_kinds,
+                               ppSearchByNameKind_key_entity),
+        PpSearchByLowerCaseNameKind_key(PpSearchByLowerCaseNameKind_key,
+                                        ppSearchByLowerCaseNameKind_key_name,
+                                        ppSearchByLowerCaseNameKind_key_kinds,
+                                        ppSearchByLowerCaseNameKind_key_entity),
+        LsifSearchByName_key(LsifSearchByName_key,
+                             lsifSearchByName_key_name, lsifSearchByName_key_entity),
+        LsifSearchByLowerCaseName_key(LsifSearchByLowerCaseName_key,
+                                      lsifSearchByLowerCaseName_key_name,
+                                      lsifSearchByLowerCaseName_key_entity),
+        KotlinSearchByScopeWithName_key(KotlinSearchByScopeWithName_key,
+                                        kotlinSearchByScopeWithName_key_name,
+                                        kotlinSearchByScopeWithName_key_insensitive,
+                                        kotlinSearchByScopeWithName_key_scope,
+                                        kotlinSearchByScopeWithName_key_entity),
+        KotlinSearchByScope_key(KotlinSearchByScope_key,
+                                kotlinSearchByScope_key_name, kotlinSearchByScope_key_scope,
+                                kotlinSearchByScope_key_entity),
+        KotlinSearchByNameWithFact_key(KotlinSearchByNameWithFact_key,
+                                       kotlinSearchByNameWithFact_key_name,
+                                       kotlinSearchByNameWithFact_key_entity),
+        KotlinSearchByName_key(KotlinSearchByName_key,
+                               kotlinSearchByName_key_name, kotlinSearchByName_key_entity),
+        KotlinSearchByLowerCaseScope_key(KotlinSearchByLowerCaseScope_key,
+                                         kotlinSearchByLowerCaseScope_key_name,
+                                         kotlinSearchByLowerCaseScope_key_scope,
+                                         kotlinSearchByLowerCaseScope_key_entity),
+        KotlinSearchByLowerCaseName_key(KotlinSearchByLowerCaseName_key,
+                                        kotlinSearchByLowerCaseName_key_name,
+                                        kotlinSearchByLowerCaseName_key_entity),
+        JavaSearchByScopeWithName_key(JavaSearchByScopeWithName_key,
+                                      javaSearchByScopeWithName_key_name,
+                                      javaSearchByScopeWithName_key_insensitive,
+                                      javaSearchByScopeWithName_key_scope,
+                                      javaSearchByScopeWithName_key_entity),
+        JavaSearchByScope_key(JavaSearchByScope_key,
+                              javaSearchByScope_key_name, javaSearchByScope_key_scope,
+                              javaSearchByScope_key_entity),
+        JavaSearchByNameWithFact_key(JavaSearchByNameWithFact_key,
+                                     javaSearchByNameWithFact_key_name,
+                                     javaSearchByNameWithFact_key_entity),
+        JavaSearchByName_key(JavaSearchByName_key,
+                             javaSearchByName_key_name, javaSearchByName_key_entity),
+        JavaSearchByLowerCaseScope_key(JavaSearchByLowerCaseScope_key,
+                                       javaSearchByLowerCaseScope_key_name,
+                                       javaSearchByLowerCaseScope_key_scope,
+                                       javaSearchByLowerCaseScope_key_entity),
+        JavaSearchByLowerCaseName_key(JavaSearchByLowerCaseName_key,
+                                      javaSearchByLowerCaseName_key_name,
+                                      javaSearchByLowerCaseName_key_entity),
+        HsSearchByName_key(HsSearchByName_key, hsSearchByName_key_name,
+                           hsSearchByName_key_entity),
+        HsSearchByLowerCaseName_key(HsSearchByLowerCaseName_key,
+                                    hsSearchByLowerCaseName_key_name,
+                                    hsSearchByLowerCaseName_key_entity),
+        HackSearchByScopeWithNameKinds_key(HackSearchByScopeWithNameKinds_key,
+                                           hackSearchByScopeWithNameKinds_key_name,
+                                           hackSearchByScopeWithNameKinds_key_insensitive,
+                                           hackSearchByScopeWithNameKinds_key_scope,
+                                           hackSearchByScopeWithNameKinds_key_kinds,
+                                           hackSearchByScopeWithNameKinds_key_entity),
+        HackSearchByScopeAndKind_key(HackSearchByScopeAndKind_key,
+                                     hackSearchByScopeAndKind_key_name,
+                                     hackSearchByScopeAndKind_key_scope,
+                                     hackSearchByScopeAndKind_key_kinds,
+                                     hackSearchByScopeAndKind_key_entity),
+        HackSearchByNameKindWithQName_key(HackSearchByNameKindWithQName_key,
+                                          hackSearchByNameKindWithQName_key_name,
+                                          hackSearchByNameKindWithQName_key_scope,
+                                          hackSearchByNameKindWithQName_key_scopeNamespace,
+                                          hackSearchByNameKindWithQName_key_kinds,
+                                          hackSearchByNameKindWithQName_key_entity),
+        HackSearchByNameKindWithNamespace_key(HackSearchByNameKindWithNamespace_key,
+                                              hackSearchByNameKindWithNamespace_key_name,
+                                              hackSearchByNameKindWithNamespace_key_scope,
+                                              hackSearchByNameKindWithNamespace_key_kinds,
+                                              hackSearchByNameKindWithNamespace_key_entity),
+        HackSearchByNameAndKind_key(HackSearchByNameAndKind_key,
+                                    hackSearchByNameAndKind_key_name,
+                                    hackSearchByNameAndKind_key_kinds,
+                                    hackSearchByNameAndKind_key_entity),
+        HackSearchByLowerCaseScopeAndKind_key(HackSearchByLowerCaseScopeAndKind_key,
+                                              hackSearchByLowerCaseScopeAndKind_key_name,
+                                              hackSearchByLowerCaseScopeAndKind_key_scope,
+                                              hackSearchByLowerCaseScopeAndKind_key_kinds,
+                                              hackSearchByLowerCaseScopeAndKind_key_entity),
+        HackSearchByLowerCaseNameAndKind_key(HackSearchByLowerCaseNameAndKind_key,
+                                             hackSearchByLowerCaseNameAndKind_key_name,
+                                             hackSearchByLowerCaseNameAndKind_key_kinds,
+                                             hackSearchByLowerCaseNameAndKind_key_entity),
+        HackNameLowerCase_key(HackNameLowerCase_key,
+                              hackNameLowerCase_key_nameLowercase, hackNameLowerCase_key_kinds,
+                              hackNameLowerCase_key_name),
+        GraphQLSearchByName_key(GraphQLSearchByName_key,
+                                graphQLSearchByName_key_name, graphQLSearchByName_key_entity),
+        GraphQLSearchByLowerCaseName_key(GraphQLSearchByLowerCaseName_key,
+                                         graphQLSearchByLowerCaseName_key_name,
+                                         graphQLSearchByLowerCaseName_key_entity),
+        FlowSearchByScopeAndKind_key(FlowSearchByScopeAndKind_key,
+                                     flowSearchByScopeAndKind_key_name,
+                                     flowSearchByScopeAndKind_key_scope,
+                                     flowSearchByScopeAndKind_key_kinds,
+                                     flowSearchByScopeAndKind_key_entity),
+        FlowSearchByNameKindAndScopeFact_key(FlowSearchByNameKindAndScopeFact_key,
+                                             flowSearchByNameKindAndScopeFact_key_name,
+                                             flowSearchByNameKindAndScopeFact_key_scope,
+                                             flowSearchByNameKindAndScopeFact_key_kinds,
+                                             flowSearchByNameKindAndScopeFact_key_entity),
+        FlowSearchByLowerCaseScopeAndKind_key(FlowSearchByLowerCaseScopeAndKind_key,
+                                              flowSearchByLowerCaseScopeAndKind_key_name,
+                                              flowSearchByLowerCaseScopeAndKind_key_scope,
+                                              flowSearchByLowerCaseScopeAndKind_key_kinds,
+                                              flowSearchByLowerCaseScopeAndKind_key_entity),
+        FlowSearchByLowerCaseNameKindAndScopeFact_key(FlowSearchByLowerCaseNameKindAndScopeFact_key,
+                                                      flowSearchByLowerCaseNameKindAndScopeFact_key_name,
+                                                      flowSearchByLowerCaseNameKindAndScopeFact_key_scope,
+                                                      flowSearchByLowerCaseNameKindAndScopeFact_key_kinds,
+                                                      flowSearchByLowerCaseNameKindAndScopeFact_key_entity),
+        FlowNameLowerCase_key(FlowNameLowerCase_key,
+                              flowNameLowerCase_key_nameLowercase, flowNameLowerCase_key_kinds,
+                              flowNameLowerCase_key_name),
+        FbthriftSearchByNameFact_key(FbthriftSearchByNameFact_key,
+                                     fbthriftSearchByNameFact_key_name,
+                                     fbthriftSearchByNameFact_key_entity),
+        ErlangSearchByName_key(ErlangSearchByName_key,
+                               erlangSearchByName_key_name, erlangSearchByName_key_entity),
+        ErlangSearchByLowerCaseName_key(ErlangSearchByLowerCaseName_key,
+                                        erlangSearchByLowerCaseName_key_name,
+                                        erlangSearchByLowerCaseName_key_entity),
+        CxxSearchByScopeAndKind_key(CxxSearchByScopeAndKind_key,
+                                    cxxSearchByScopeAndKind_key_name,
+                                    cxxSearchByScopeAndKind_key_scope,
+                                    cxxSearchByScopeAndKind_key_kinds,
+                                    cxxSearchByScopeAndKind_key_entity),
+        CxxSearchByNameKindAndScopeFact_key(CxxSearchByNameKindAndScopeFact_key,
+                                            cxxSearchByNameKindAndScopeFact_key_name,
+                                            cxxSearchByNameKindAndScopeFact_key_scope,
+                                            cxxSearchByNameKindAndScopeFact_key_kinds,
+                                            cxxSearchByNameKindAndScopeFact_key_entity),
+        CxxSearchByLowerCaseScopeAndKind_key(CxxSearchByLowerCaseScopeAndKind_key,
+                                             cxxSearchByLowerCaseScopeAndKind_key_name,
+                                             cxxSearchByLowerCaseScopeAndKind_key_scope,
+                                             cxxSearchByLowerCaseScopeAndKind_key_kinds,
+                                             cxxSearchByLowerCaseScopeAndKind_key_entity),
+        CxxSearchByLowerCaseNameKindAndScopeFact_key(CxxSearchByLowerCaseNameKindAndScopeFact_key,
+                                                     cxxSearchByLowerCaseNameKindAndScopeFact_key_name,
+                                                     cxxSearchByLowerCaseNameKindAndScopeFact_key_scope,
+                                                     cxxSearchByLowerCaseNameKindAndScopeFact_key_kinds,
+                                                     cxxSearchByLowerCaseNameKindAndScopeFact_key_entity),
+        CxxPreferDefinitions_key(CxxPreferDefinitions_key,
+                                 cxxPreferDefinitions_key_from, cxxPreferDefinitions_key_to),
+        CxxNameLowerCase_key(CxxNameLowerCase_key,
+                             cxxNameLowerCase_key_nameLowercase, cxxNameLowerCase_key_kinds,
+                             cxxNameLowerCase_key_name),
+        CSharpSearchByName_key(CSharpSearchByName_key,
+                               cSharpSearchByName_key_name, cSharpSearchByName_key_entity),
+        CSharpSearchByLowerCaseName_key(CSharpSearchByLowerCaseName_key,
+                                        cSharpSearchByLowerCaseName_key_name,
+                                        cSharpSearchByLowerCaseName_key_entity),
+        BuckSearchByName_key(BuckSearchByName_key,
+                             buckSearchByName_key_name, buckSearchByName_key_entity),
+        BuckSearchByLowerCaseName_key(BuckSearchByLowerCaseName_key,
+                                      buckSearchByLowerCaseName_key_name,
+                                      buckSearchByLowerCaseName_key_entity),
+        BuckSearchByLocalNameFact_key(BuckSearchByLocalNameFact_key,
+                                      buckSearchByLocalNameFact_key_name,
+                                      buckSearchByLocalNameFact_key_entity),
+        AngleSearchByName_key(AngleSearchByName_key,
+                              angleSearchByName_key_name, angleSearchByName_key_entity),
+        AngleSearchByLowerCaseName_key(AngleSearchByLowerCaseName_key,
+                                       angleSearchByLowerCaseName_key_name,
+                                       angleSearchByLowerCaseName_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Buck.Types as Glean.Schema.Buck
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Code.Types as Glean.Schema.Code
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.CodemarkupTypes.Types
+       as Glean.Schema.CodemarkupTypes
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Schema.Fbthrift.Types
+       as Glean.Schema.Fbthrift
+import qualified Glean.Schema.Flow.Types as Glean.Schema.Flow
+import qualified Glean.Schema.Hack.Types as Glean.Schema.Hack
+import qualified Glean.Schema.JavakotlinAlpha.Types
+       as Glean.Schema.JavakotlinAlpha
+import qualified Glean.Schema.Python.Types as Glean.Schema.Python
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Buck.Types
+{-# LINE 15 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 16 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Code.Types
+{-# LINE 17 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 18 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.CodemarkupTypes.Types
+{-# LINE 19 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 20 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Fbthrift.Types
+{-# LINE 21 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Flow.Types
+{-# LINE 22 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Hack.Types
+{-# LINE 23 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.JavakotlinAlpha.Types
+{-# LINE 24 "glean/schema/thrift/search_code_include.hs" #-}
+import qualified Glean.Schema.Python.Types
+{-# LINE 563 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCode/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("BuckSearchByName", 16), ("BuckSearchByLowerCaseName", 16),
+       ("HackSearchByNameKindWithNamespace", 16),
+       ("CxxNameLowerCase", 16), ("JavaSearchByScope", 16),
+       ("KotlinSearchByNameWithFact", 16),
+       ("KotlinSearchByLowerCaseName", 16),
+       ("PythonSearchByLowerCaseScopeAndKind", 16),
+       ("KotlinSearchByScopeWithName", 16),
+       ("BuckSearchByLocalNameFact", 16),
+       ("SearchByLowerCaseScopeAndKind", 16),
+       ("HackSearchByNameKindWithQName", 16),
+       ("FlowSearchByLowerCaseScopeAndKind", 16),
+       ("PythonSearchByScopeAndKind", 16),
+       ("HsSearchByLowerCaseName", 16), ("CxxPreferDefinitions", 16),
+       ("KotlinSearchByScope", 16), ("AngleSearchByName", 16),
+       ("SearchByScope", 16), ("CxxSearchByScopeAndKind", 16),
+       ("CSharpSearchByLowerCaseName", 16), ("LsifSearchByName", 16),
+       ("HackNameLowerCase", 16), ("FlowSearchByScopeAndKind", 16),
+       ("CSharpSearchByName", 16), ("ThriftSearchByName", 16),
+       ("JavaSearchByScopeWithName", 16),
+       ("CxxSearchByLowerCaseNameKindAndScopeFact", 16),
+       ("HackSearchByNameAndKind", 16), ("FbthriftSearchByNameFact", 16),
+       ("ErlangSearchByName", 16), ("SearchByNameKindAndLanguage", 16),
+       ("HackSearchByScopeAndKind", 16),
+       ("CxxSearchByLowerCaseScopeAndKind", 16),
+       ("PpSearchByLowerCaseNameKind", 16),
+       ("SearchByLowerCaseNameAndLanguage", 16),
+       ("KotlinSearchByName", 16), ("AngleSearchByLowerCaseName", 16),
+       ("KotlinSearchByLowerCaseScope", 16),
+       ("JavaSearchByLowerCaseName", 16),
+       ("LsifSearchByLowerCaseName", 16), ("SearchByScopeAndKind", 16),
+       ("SearchByLowerCaseNameKindAndLanguage", 16),
+       ("FlowNameLowerCase", 16), ("HackSearchByScopeWithNameKinds", 16),
+       ("HsSearchByName", 16), ("HackSearchByLowerCaseScopeAndKind", 16),
+       ("SearchByNameAndLanguage", 16),
+       ("FlowSearchByNameKindAndScopeFact", 16),
+       ("PythonSearchByLowerCaseNameKindAndScopeFact", 16),
+       ("CxxSearchByNameKindAndScopeFact", 16),
+       ("FlowSearchByLowerCaseNameKindAndScopeFact", 16),
+       ("RustSearchByNameAndKind", 16), ("PythonNameLowerCase", 16),
+       ("JavaSearchByNameWithFact", 16),
+       ("JavaSearchByLowerCaseScope", 16), ("SearchByLowerCaseScope", 16),
+       ("HackSearchByLowerCaseNameAndKind", 16),
+       ("PpSearchByNameKind", 16), ("JavaSearchByName", 16),
+       ("ThriftSearchByLowerCaseName", 16),
+       ("GraphQLSearchByLowerCaseName", 16),
+       ("ErlangSearchByLowerCaseName", 16),
+       ("PythonSearchByNameKindAndScopeFact", 16),
+       ("GraphQLSearchByName", 16)]
+
+type ThriftSearchByName_id = Glean.Id
+
+data ThriftSearchByName = ThriftSearchByName{thriftSearchByName_id
+                                             :: {-# UNPACK #-} !ThriftSearchByName_id,
+                                             thriftSearchByName_key ::
+                                             Prelude.Maybe ThriftSearchByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftSearchByName where
+  toJSON (ThriftSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftSearchByName where
+  buildStruct _proxy (ThriftSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ThriftSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftSearchByName where
+  rnf (ThriftSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ThriftSearchByName where
+  def = ThriftSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ThriftSearchByName where
+  hashWithSalt __salt (ThriftSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ThriftSearchByLowerCaseName_id = Glean.Id
+
+data ThriftSearchByLowerCaseName = ThriftSearchByLowerCaseName{thriftSearchByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !ThriftSearchByLowerCaseName_id,
+                                                               thriftSearchByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 ThriftSearchByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftSearchByLowerCaseName where
+  toJSON (ThriftSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftSearchByLowerCaseName where
+  buildStruct _proxy
+    (ThriftSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ThriftSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftSearchByLowerCaseName where
+  rnf (ThriftSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ThriftSearchByLowerCaseName where
+  def = ThriftSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ThriftSearchByLowerCaseName where
+  hashWithSalt __salt (ThriftSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByScopeAndKind_id = Glean.Id
+
+data SearchByScopeAndKind = SearchByScopeAndKind{searchByScopeAndKind_id
+                                                 :: {-# UNPACK #-} !SearchByScopeAndKind_id,
+                                                 searchByScopeAndKind_key ::
+                                                 Prelude.Maybe SearchByScopeAndKind_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScopeAndKind where
+  toJSON (SearchByScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByScopeAndKind where
+  buildStruct _proxy (SearchByScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScopeAndKind where
+  rnf (SearchByScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByScopeAndKind where
+  def = SearchByScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByScopeAndKind where
+  hashWithSalt __salt (SearchByScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByScope_id = Glean.Id
+
+data SearchByScope = SearchByScope{searchByScope_id ::
+                                   {-# UNPACK #-} !SearchByScope_id,
+                                   searchByScope_key :: Prelude.Maybe SearchByScope_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScope where
+  toJSON (SearchByScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByScope where
+  buildStruct _proxy (SearchByScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScope where
+  rnf (SearchByScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByScope where
+  def = SearchByScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByScope where
+  hashWithSalt __salt (SearchByScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByNameKindAndLanguage_id = Glean.Id
+
+data SearchByNameKindAndLanguage = SearchByNameKindAndLanguage{searchByNameKindAndLanguage_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchByNameKindAndLanguage_id,
+                                                               searchByNameKindAndLanguage_key ::
+                                                               Prelude.Maybe
+                                                                 SearchByNameKindAndLanguage_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameKindAndLanguage where
+  toJSON (SearchByNameKindAndLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameKindAndLanguage where
+  buildStruct _proxy
+    (SearchByNameKindAndLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByNameKindAndLanguage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameKindAndLanguage where
+  rnf (SearchByNameKindAndLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByNameKindAndLanguage where
+  def = SearchByNameKindAndLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByNameKindAndLanguage where
+  hashWithSalt __salt (SearchByNameKindAndLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByNameAndLanguage_id = Glean.Id
+
+data SearchByNameAndLanguage = SearchByNameAndLanguage{searchByNameAndLanguage_id
+                                                       ::
+                                                       {-# UNPACK #-} !SearchByNameAndLanguage_id,
+                                                       searchByNameAndLanguage_key ::
+                                                       Prelude.Maybe SearchByNameAndLanguage_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameAndLanguage where
+  toJSON (SearchByNameAndLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameAndLanguage where
+  buildStruct _proxy
+    (SearchByNameAndLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByNameAndLanguage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameAndLanguage where
+  rnf (SearchByNameAndLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByNameAndLanguage where
+  def = SearchByNameAndLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByNameAndLanguage where
+  hashWithSalt __salt (SearchByNameAndLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLowerCaseScopeAndKind_id = Glean.Id
+
+data SearchByLowerCaseScopeAndKind = SearchByLowerCaseScopeAndKind{searchByLowerCaseScopeAndKind_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !SearchByLowerCaseScopeAndKind_id,
+                                                                   searchByLowerCaseScopeAndKind_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     SearchByLowerCaseScopeAndKind_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseScopeAndKind where
+  toJSON (SearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseScopeAndKind where
+  buildStruct _proxy
+    (SearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByLowerCaseScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseScopeAndKind where
+  rnf (SearchByLowerCaseScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseScopeAndKind where
+  def = SearchByLowerCaseScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLowerCaseScopeAndKind where
+  hashWithSalt __salt (SearchByLowerCaseScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLowerCaseScope_id = Glean.Id
+
+data SearchByLowerCaseScope = SearchByLowerCaseScope{searchByLowerCaseScope_id
+                                                     :: {-# UNPACK #-} !SearchByLowerCaseScope_id,
+                                                     searchByLowerCaseScope_key ::
+                                                     Prelude.Maybe SearchByLowerCaseScope_key}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseScope where
+  toJSON (SearchByLowerCaseScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseScope where
+  buildStruct _proxy
+    (SearchByLowerCaseScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByLowerCaseScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseScope where
+  rnf (SearchByLowerCaseScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseScope where
+  def = SearchByLowerCaseScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLowerCaseScope where
+  hashWithSalt __salt (SearchByLowerCaseScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLowerCaseNameKindAndLanguage_id = Glean.Id
+
+data SearchByLowerCaseNameKindAndLanguage = SearchByLowerCaseNameKindAndLanguage{searchByLowerCaseNameKindAndLanguage_id
+                                                                                 ::
+                                                                                 {-# UNPACK #-} !SearchByLowerCaseNameKindAndLanguage_id,
+                                                                                 searchByLowerCaseNameKindAndLanguage_key
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   SearchByLowerCaseNameKindAndLanguage_key}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseNameKindAndLanguage where
+  toJSON
+    (SearchByLowerCaseNameKindAndLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseNameKindAndLanguage
+         where
+  buildStruct _proxy
+    (SearchByLowerCaseNameKindAndLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByLowerCaseNameKindAndLanguage __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseNameKindAndLanguage where
+  rnf (SearchByLowerCaseNameKindAndLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseNameKindAndLanguage where
+  def
+    = SearchByLowerCaseNameKindAndLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLowerCaseNameKindAndLanguage
+         where
+  hashWithSalt __salt (SearchByLowerCaseNameKindAndLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLowerCaseNameAndLanguage_id = Glean.Id
+
+data SearchByLowerCaseNameAndLanguage = SearchByLowerCaseNameAndLanguage{searchByLowerCaseNameAndLanguage_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !SearchByLowerCaseNameAndLanguage_id,
+                                                                         searchByLowerCaseNameAndLanguage_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           SearchByLowerCaseNameAndLanguage_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseNameAndLanguage where
+  toJSON (SearchByLowerCaseNameAndLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseNameAndLanguage where
+  buildStruct _proxy
+    (SearchByLowerCaseNameAndLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByLowerCaseNameAndLanguage __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseNameAndLanguage where
+  rnf (SearchByLowerCaseNameAndLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseNameAndLanguage where
+  def = SearchByLowerCaseNameAndLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLowerCaseNameAndLanguage where
+  hashWithSalt __salt (SearchByLowerCaseNameAndLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type RustSearchByNameAndKind_id = Glean.Id
+
+data RustSearchByNameAndKind = RustSearchByNameAndKind{rustSearchByNameAndKind_id
+                                                       ::
+                                                       {-# UNPACK #-} !RustSearchByNameAndKind_id,
+                                                       rustSearchByNameAndKind_key ::
+                                                       Prelude.Maybe RustSearchByNameAndKind_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RustSearchByNameAndKind where
+  toJSON (RustSearchByNameAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RustSearchByNameAndKind where
+  buildStruct _proxy
+    (RustSearchByNameAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (RustSearchByNameAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RustSearchByNameAndKind where
+  rnf (RustSearchByNameAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RustSearchByNameAndKind where
+  def = RustSearchByNameAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable RustSearchByNameAndKind where
+  hashWithSalt __salt (RustSearchByNameAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonSearchByScopeAndKind_id = Glean.Id
+
+data PythonSearchByScopeAndKind = PythonSearchByScopeAndKind{pythonSearchByScopeAndKind_id
+                                                             ::
+                                                             {-# UNPACK #-} !PythonSearchByScopeAndKind_id,
+                                                             pythonSearchByScopeAndKind_key ::
+                                                             Prelude.Maybe
+                                                               PythonSearchByScopeAndKind_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByScopeAndKind where
+  toJSON (PythonSearchByScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonSearchByScopeAndKind where
+  buildStruct _proxy
+    (PythonSearchByScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonSearchByScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByScopeAndKind where
+  rnf (PythonSearchByScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonSearchByScopeAndKind where
+  def = PythonSearchByScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonSearchByScopeAndKind where
+  hashWithSalt __salt (PythonSearchByScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonSearchByNameKindAndScopeFact_id = Glean.Id
+
+data PythonSearchByNameKindAndScopeFact = PythonSearchByNameKindAndScopeFact{pythonSearchByNameKindAndScopeFact_id
+                                                                             ::
+                                                                             {-# UNPACK #-} !PythonSearchByNameKindAndScopeFact_id,
+                                                                             pythonSearchByNameKindAndScopeFact_key
+                                                                             ::
+                                                                             Prelude.Maybe
+                                                                               PythonSearchByNameKindAndScopeFact_key}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByNameKindAndScopeFact where
+  toJSON
+    (PythonSearchByNameKindAndScopeFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonSearchByNameKindAndScopeFact
+         where
+  buildStruct _proxy
+    (PythonSearchByNameKindAndScopeFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonSearchByNameKindAndScopeFact __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByNameKindAndScopeFact where
+  rnf (PythonSearchByNameKindAndScopeFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonSearchByNameKindAndScopeFact where
+  def
+    = PythonSearchByNameKindAndScopeFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonSearchByNameKindAndScopeFact where
+  hashWithSalt __salt (PythonSearchByNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonSearchByLowerCaseScopeAndKind_id = Glean.Id
+
+data PythonSearchByLowerCaseScopeAndKind = PythonSearchByLowerCaseScopeAndKind{pythonSearchByLowerCaseScopeAndKind_id
+                                                                               ::
+                                                                               {-# UNPACK #-} !PythonSearchByLowerCaseScopeAndKind_id,
+                                                                               pythonSearchByLowerCaseScopeAndKind_key
+                                                                               ::
+                                                                               Prelude.Maybe
+                                                                                 PythonSearchByLowerCaseScopeAndKind_key}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByLowerCaseScopeAndKind where
+  toJSON
+    (PythonSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonSearchByLowerCaseScopeAndKind
+         where
+  buildStruct _proxy
+    (PythonSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonSearchByLowerCaseScopeAndKind __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByLowerCaseScopeAndKind where
+  rnf (PythonSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonSearchByLowerCaseScopeAndKind where
+  def
+    = PythonSearchByLowerCaseScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonSearchByLowerCaseScopeAndKind
+         where
+  hashWithSalt __salt (PythonSearchByLowerCaseScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonSearchByLowerCaseNameKindAndScopeFact_id = Glean.Id
+
+data PythonSearchByLowerCaseNameKindAndScopeFact = PythonSearchByLowerCaseNameKindAndScopeFact{pythonSearchByLowerCaseNameKindAndScopeFact_id
+                                                                                               ::
+                                                                                               {-# UNPACK #-} !PythonSearchByLowerCaseNameKindAndScopeFact_id,
+                                                                                               pythonSearchByLowerCaseNameKindAndScopeFact_key
+                                                                                               ::
+                                                                                               Prelude.Maybe
+                                                                                                 PythonSearchByLowerCaseNameKindAndScopeFact_key}
+                                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  toJSON
+    (PythonSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildStruct _proxy
+    (PythonSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PythonSearchByLowerCaseNameKindAndScopeFact
+                                                  __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  rnf
+    (PythonSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default
+           PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  def
+    = PythonSearchByLowerCaseNameKindAndScopeFact Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable
+           PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  hashWithSalt __salt
+    (PythonSearchByLowerCaseNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PythonNameLowerCase_id = Glean.Id
+
+data PythonNameLowerCase = PythonNameLowerCase{pythonNameLowerCase_id
+                                               :: {-# UNPACK #-} !PythonNameLowerCase_id,
+                                               pythonNameLowerCase_key ::
+                                               Prelude.Maybe PythonNameLowerCase_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonNameLowerCase where
+  toJSON (PythonNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PythonNameLowerCase where
+  buildStruct _proxy (PythonNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PythonNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonNameLowerCase where
+  rnf (PythonNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PythonNameLowerCase where
+  def = PythonNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable PythonNameLowerCase where
+  hashWithSalt __salt (PythonNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpSearchByNameKind_id = Glean.Id
+
+data PpSearchByNameKind = PpSearchByNameKind{ppSearchByNameKind_id
+                                             :: {-# UNPACK #-} !PpSearchByNameKind_id,
+                                             ppSearchByNameKind_key ::
+                                             Prelude.Maybe PpSearchByNameKind_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpSearchByNameKind where
+  toJSON (PpSearchByNameKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpSearchByNameKind where
+  buildStruct _proxy (PpSearchByNameKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (PpSearchByNameKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpSearchByNameKind where
+  rnf (PpSearchByNameKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpSearchByNameKind where
+  def = PpSearchByNameKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpSearchByNameKind where
+  hashWithSalt __salt (PpSearchByNameKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type PpSearchByLowerCaseNameKind_id = Glean.Id
+
+data PpSearchByLowerCaseNameKind = PpSearchByLowerCaseNameKind{ppSearchByLowerCaseNameKind_id
+                                                               ::
+                                                               {-# UNPACK #-} !PpSearchByLowerCaseNameKind_id,
+                                                               ppSearchByLowerCaseNameKind_key ::
+                                                               Prelude.Maybe
+                                                                 PpSearchByLowerCaseNameKind_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpSearchByLowerCaseNameKind where
+  toJSON (PpSearchByLowerCaseNameKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PpSearchByLowerCaseNameKind where
+  buildStruct _proxy
+    (PpSearchByLowerCaseNameKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (PpSearchByLowerCaseNameKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PpSearchByLowerCaseNameKind where
+  rnf (PpSearchByLowerCaseNameKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default PpSearchByLowerCaseNameKind where
+  def = PpSearchByLowerCaseNameKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable PpSearchByLowerCaseNameKind where
+  hashWithSalt __salt (PpSearchByLowerCaseNameKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifSearchByName_id = Glean.Id
+
+data LsifSearchByName = LsifSearchByName{lsifSearchByName_id ::
+                                         {-# UNPACK #-} !LsifSearchByName_id,
+                                         lsifSearchByName_key :: Prelude.Maybe LsifSearchByName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifSearchByName where
+  toJSON (LsifSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifSearchByName where
+  buildStruct _proxy (LsifSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LsifSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifSearchByName where
+  rnf (LsifSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifSearchByName where
+  def = LsifSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifSearchByName where
+  hashWithSalt __salt (LsifSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LsifSearchByLowerCaseName_id = Glean.Id
+
+data LsifSearchByLowerCaseName = LsifSearchByLowerCaseName{lsifSearchByLowerCaseName_id
+                                                           ::
+                                                           {-# UNPACK #-} !LsifSearchByLowerCaseName_id,
+                                                           lsifSearchByLowerCaseName_key ::
+                                                           Prelude.Maybe
+                                                             LsifSearchByLowerCaseName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifSearchByLowerCaseName where
+  toJSON (LsifSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifSearchByLowerCaseName where
+  buildStruct _proxy
+    (LsifSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LsifSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifSearchByLowerCaseName where
+  rnf (LsifSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LsifSearchByLowerCaseName where
+  def = LsifSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable LsifSearchByLowerCaseName where
+  hashWithSalt __salt (LsifSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByScopeWithName_id = Glean.Id
+
+data KotlinSearchByScopeWithName = KotlinSearchByScopeWithName{kotlinSearchByScopeWithName_id
+                                                               ::
+                                                               {-# UNPACK #-} !KotlinSearchByScopeWithName_id,
+                                                               kotlinSearchByScopeWithName_key ::
+                                                               Prelude.Maybe
+                                                                 KotlinSearchByScopeWithName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByScopeWithName where
+  toJSON (KotlinSearchByScopeWithName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByScopeWithName where
+  buildStruct _proxy
+    (KotlinSearchByScopeWithName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (KotlinSearchByScopeWithName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByScopeWithName where
+  rnf (KotlinSearchByScopeWithName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByScopeWithName where
+  def = KotlinSearchByScopeWithName Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByScopeWithName where
+  hashWithSalt __salt (KotlinSearchByScopeWithName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByScope_id = Glean.Id
+
+data KotlinSearchByScope = KotlinSearchByScope{kotlinSearchByScope_id
+                                               :: {-# UNPACK #-} !KotlinSearchByScope_id,
+                                               kotlinSearchByScope_key ::
+                                               Prelude.Maybe KotlinSearchByScope_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByScope where
+  toJSON (KotlinSearchByScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByScope where
+  buildStruct _proxy (KotlinSearchByScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (KotlinSearchByScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByScope where
+  rnf (KotlinSearchByScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByScope where
+  def = KotlinSearchByScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByScope where
+  hashWithSalt __salt (KotlinSearchByScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByNameWithFact_id = Glean.Id
+
+data KotlinSearchByNameWithFact = KotlinSearchByNameWithFact{kotlinSearchByNameWithFact_id
+                                                             ::
+                                                             {-# UNPACK #-} !KotlinSearchByNameWithFact_id,
+                                                             kotlinSearchByNameWithFact_key ::
+                                                             Prelude.Maybe
+                                                               KotlinSearchByNameWithFact_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByNameWithFact where
+  toJSON (KotlinSearchByNameWithFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByNameWithFact where
+  buildStruct _proxy
+    (KotlinSearchByNameWithFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (KotlinSearchByNameWithFact __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByNameWithFact where
+  rnf (KotlinSearchByNameWithFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByNameWithFact where
+  def = KotlinSearchByNameWithFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByNameWithFact where
+  hashWithSalt __salt (KotlinSearchByNameWithFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByName_id = Glean.Id
+
+data KotlinSearchByName = KotlinSearchByName{kotlinSearchByName_id
+                                             :: {-# UNPACK #-} !KotlinSearchByName_id,
+                                             kotlinSearchByName_key ::
+                                             Prelude.Maybe KotlinSearchByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByName where
+  toJSON (KotlinSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByName where
+  buildStruct _proxy (KotlinSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (KotlinSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByName where
+  rnf (KotlinSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByName where
+  def = KotlinSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByName where
+  hashWithSalt __salt (KotlinSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByLowerCaseScope_id = Glean.Id
+
+data KotlinSearchByLowerCaseScope = KotlinSearchByLowerCaseScope{kotlinSearchByLowerCaseScope_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !KotlinSearchByLowerCaseScope_id,
+                                                                 kotlinSearchByLowerCaseScope_key ::
+                                                                 Prelude.Maybe
+                                                                   KotlinSearchByLowerCaseScope_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByLowerCaseScope where
+  toJSON (KotlinSearchByLowerCaseScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByLowerCaseScope where
+  buildStruct _proxy
+    (KotlinSearchByLowerCaseScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (KotlinSearchByLowerCaseScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByLowerCaseScope where
+  rnf (KotlinSearchByLowerCaseScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByLowerCaseScope where
+  def = KotlinSearchByLowerCaseScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByLowerCaseScope where
+  hashWithSalt __salt (KotlinSearchByLowerCaseScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type KotlinSearchByLowerCaseName_id = Glean.Id
+
+data KotlinSearchByLowerCaseName = KotlinSearchByLowerCaseName{kotlinSearchByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !KotlinSearchByLowerCaseName_id,
+                                                               kotlinSearchByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 KotlinSearchByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByLowerCaseName where
+  toJSON (KotlinSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByLowerCaseName where
+  buildStruct _proxy
+    (KotlinSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (KotlinSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByLowerCaseName where
+  rnf (KotlinSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByLowerCaseName where
+  def = KotlinSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable KotlinSearchByLowerCaseName where
+  hashWithSalt __salt (KotlinSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByScopeWithName_id = Glean.Id
+
+data JavaSearchByScopeWithName = JavaSearchByScopeWithName{javaSearchByScopeWithName_id
+                                                           ::
+                                                           {-# UNPACK #-} !JavaSearchByScopeWithName_id,
+                                                           javaSearchByScopeWithName_key ::
+                                                           Prelude.Maybe
+                                                             JavaSearchByScopeWithName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByScopeWithName where
+  toJSON (JavaSearchByScopeWithName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByScopeWithName where
+  buildStruct _proxy
+    (JavaSearchByScopeWithName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (JavaSearchByScopeWithName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByScopeWithName where
+  rnf (JavaSearchByScopeWithName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByScopeWithName where
+  def = JavaSearchByScopeWithName Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByScopeWithName where
+  hashWithSalt __salt (JavaSearchByScopeWithName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByScope_id = Glean.Id
+
+data JavaSearchByScope = JavaSearchByScope{javaSearchByScope_id ::
+                                           {-# UNPACK #-} !JavaSearchByScope_id,
+                                           javaSearchByScope_key ::
+                                           Prelude.Maybe JavaSearchByScope_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByScope where
+  toJSON (JavaSearchByScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByScope where
+  buildStruct _proxy (JavaSearchByScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (JavaSearchByScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByScope where
+  rnf (JavaSearchByScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByScope where
+  def = JavaSearchByScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByScope where
+  hashWithSalt __salt (JavaSearchByScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByNameWithFact_id = Glean.Id
+
+data JavaSearchByNameWithFact = JavaSearchByNameWithFact{javaSearchByNameWithFact_id
+                                                         ::
+                                                         {-# UNPACK #-} !JavaSearchByNameWithFact_id,
+                                                         javaSearchByNameWithFact_key ::
+                                                         Prelude.Maybe JavaSearchByNameWithFact_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByNameWithFact where
+  toJSON (JavaSearchByNameWithFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByNameWithFact where
+  buildStruct _proxy
+    (JavaSearchByNameWithFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (JavaSearchByNameWithFact __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByNameWithFact where
+  rnf (JavaSearchByNameWithFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByNameWithFact where
+  def = JavaSearchByNameWithFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByNameWithFact where
+  hashWithSalt __salt (JavaSearchByNameWithFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByName_id = Glean.Id
+
+data JavaSearchByName = JavaSearchByName{javaSearchByName_id ::
+                                         {-# UNPACK #-} !JavaSearchByName_id,
+                                         javaSearchByName_key :: Prelude.Maybe JavaSearchByName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByName where
+  toJSON (JavaSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByName where
+  buildStruct _proxy (JavaSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (JavaSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByName where
+  rnf (JavaSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByName where
+  def = JavaSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByName where
+  hashWithSalt __salt (JavaSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByLowerCaseScope_id = Glean.Id
+
+data JavaSearchByLowerCaseScope = JavaSearchByLowerCaseScope{javaSearchByLowerCaseScope_id
+                                                             ::
+                                                             {-# UNPACK #-} !JavaSearchByLowerCaseScope_id,
+                                                             javaSearchByLowerCaseScope_key ::
+                                                             Prelude.Maybe
+                                                               JavaSearchByLowerCaseScope_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByLowerCaseScope where
+  toJSON (JavaSearchByLowerCaseScope __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByLowerCaseScope where
+  buildStruct _proxy
+    (JavaSearchByLowerCaseScope __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (JavaSearchByLowerCaseScope __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByLowerCaseScope where
+  rnf (JavaSearchByLowerCaseScope __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByLowerCaseScope where
+  def = JavaSearchByLowerCaseScope Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByLowerCaseScope where
+  hashWithSalt __salt (JavaSearchByLowerCaseScope _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type JavaSearchByLowerCaseName_id = Glean.Id
+
+data JavaSearchByLowerCaseName = JavaSearchByLowerCaseName{javaSearchByLowerCaseName_id
+                                                           ::
+                                                           {-# UNPACK #-} !JavaSearchByLowerCaseName_id,
+                                                           javaSearchByLowerCaseName_key ::
+                                                           Prelude.Maybe
+                                                             JavaSearchByLowerCaseName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByLowerCaseName where
+  toJSON (JavaSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByLowerCaseName where
+  buildStruct _proxy
+    (JavaSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (JavaSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByLowerCaseName where
+  rnf (JavaSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default JavaSearchByLowerCaseName where
+  def = JavaSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable JavaSearchByLowerCaseName where
+  hashWithSalt __salt (JavaSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HsSearchByName_id = Glean.Id
+
+data HsSearchByName = HsSearchByName{hsSearchByName_id ::
+                                     {-# UNPACK #-} !HsSearchByName_id,
+                                     hsSearchByName_key :: Prelude.Maybe HsSearchByName_key}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HsSearchByName where
+  toJSON (HsSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HsSearchByName where
+  buildStruct _proxy (HsSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HsSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HsSearchByName where
+  rnf (HsSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HsSearchByName where
+  def = HsSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable HsSearchByName where
+  hashWithSalt __salt (HsSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HsSearchByLowerCaseName_id = Glean.Id
+
+data HsSearchByLowerCaseName = HsSearchByLowerCaseName{hsSearchByLowerCaseName_id
+                                                       ::
+                                                       {-# UNPACK #-} !HsSearchByLowerCaseName_id,
+                                                       hsSearchByLowerCaseName_key ::
+                                                       Prelude.Maybe HsSearchByLowerCaseName_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HsSearchByLowerCaseName where
+  toJSON (HsSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HsSearchByLowerCaseName where
+  buildStruct _proxy
+    (HsSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HsSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HsSearchByLowerCaseName where
+  rnf (HsSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HsSearchByLowerCaseName where
+  def = HsSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable HsSearchByLowerCaseName where
+  hashWithSalt __salt (HsSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByScopeWithNameKinds_id = Glean.Id
+
+data HackSearchByScopeWithNameKinds = HackSearchByScopeWithNameKinds{hackSearchByScopeWithNameKinds_id
+                                                                     ::
+                                                                     {-# UNPACK #-} !HackSearchByScopeWithNameKinds_id,
+                                                                     hackSearchByScopeWithNameKinds_key
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       HackSearchByScopeWithNameKinds_key}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByScopeWithNameKinds where
+  toJSON (HackSearchByScopeWithNameKinds __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByScopeWithNameKinds where
+  buildStruct _proxy
+    (HackSearchByScopeWithNameKinds __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByScopeWithNameKinds __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByScopeWithNameKinds where
+  rnf (HackSearchByScopeWithNameKinds __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByScopeWithNameKinds where
+  def = HackSearchByScopeWithNameKinds Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByScopeWithNameKinds where
+  hashWithSalt __salt (HackSearchByScopeWithNameKinds _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByScopeAndKind_id = Glean.Id
+
+data HackSearchByScopeAndKind = HackSearchByScopeAndKind{hackSearchByScopeAndKind_id
+                                                         ::
+                                                         {-# UNPACK #-} !HackSearchByScopeAndKind_id,
+                                                         hackSearchByScopeAndKind_key ::
+                                                         Prelude.Maybe HackSearchByScopeAndKind_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByScopeAndKind where
+  toJSON (HackSearchByScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByScopeAndKind where
+  buildStruct _proxy
+    (HackSearchByScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByScopeAndKind where
+  rnf (HackSearchByScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByScopeAndKind where
+  def = HackSearchByScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByScopeAndKind where
+  hashWithSalt __salt (HackSearchByScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByNameKindWithQName_id = Glean.Id
+
+data HackSearchByNameKindWithQName = HackSearchByNameKindWithQName{hackSearchByNameKindWithQName_id
+                                                                   ::
+                                                                   {-# UNPACK #-} !HackSearchByNameKindWithQName_id,
+                                                                   hackSearchByNameKindWithQName_key
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     HackSearchByNameKindWithQName_key}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameKindWithQName where
+  toJSON (HackSearchByNameKindWithQName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByNameKindWithQName where
+  buildStruct _proxy
+    (HackSearchByNameKindWithQName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByNameKindWithQName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameKindWithQName where
+  rnf (HackSearchByNameKindWithQName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameKindWithQName where
+  def = HackSearchByNameKindWithQName Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByNameKindWithQName where
+  hashWithSalt __salt (HackSearchByNameKindWithQName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByNameKindWithNamespace_id = Glean.Id
+
+data HackSearchByNameKindWithNamespace = HackSearchByNameKindWithNamespace{hackSearchByNameKindWithNamespace_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !HackSearchByNameKindWithNamespace_id,
+                                                                           hackSearchByNameKindWithNamespace_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             HackSearchByNameKindWithNamespace_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameKindWithNamespace where
+  toJSON (HackSearchByNameKindWithNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByNameKindWithNamespace
+         where
+  buildStruct _proxy
+    (HackSearchByNameKindWithNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByNameKindWithNamespace __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameKindWithNamespace where
+  rnf (HackSearchByNameKindWithNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameKindWithNamespace where
+  def = HackSearchByNameKindWithNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByNameKindWithNamespace where
+  hashWithSalt __salt (HackSearchByNameKindWithNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByNameAndKind_id = Glean.Id
+
+data HackSearchByNameAndKind = HackSearchByNameAndKind{hackSearchByNameAndKind_id
+                                                       ::
+                                                       {-# UNPACK #-} !HackSearchByNameAndKind_id,
+                                                       hackSearchByNameAndKind_key ::
+                                                       Prelude.Maybe HackSearchByNameAndKind_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameAndKind where
+  toJSON (HackSearchByNameAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByNameAndKind where
+  buildStruct _proxy
+    (HackSearchByNameAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByNameAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameAndKind where
+  rnf (HackSearchByNameAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameAndKind where
+  def = HackSearchByNameAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByNameAndKind where
+  hashWithSalt __salt (HackSearchByNameAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByLowerCaseScopeAndKind_id = Glean.Id
+
+data HackSearchByLowerCaseScopeAndKind = HackSearchByLowerCaseScopeAndKind{hackSearchByLowerCaseScopeAndKind_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !HackSearchByLowerCaseScopeAndKind_id,
+                                                                           hackSearchByLowerCaseScopeAndKind_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             HackSearchByLowerCaseScopeAndKind_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByLowerCaseScopeAndKind where
+  toJSON (HackSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByLowerCaseScopeAndKind
+         where
+  buildStruct _proxy
+    (HackSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByLowerCaseScopeAndKind __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByLowerCaseScopeAndKind where
+  rnf (HackSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByLowerCaseScopeAndKind where
+  def = HackSearchByLowerCaseScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByLowerCaseScopeAndKind where
+  hashWithSalt __salt (HackSearchByLowerCaseScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackSearchByLowerCaseNameAndKind_id = Glean.Id
+
+data HackSearchByLowerCaseNameAndKind = HackSearchByLowerCaseNameAndKind{hackSearchByLowerCaseNameAndKind_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !HackSearchByLowerCaseNameAndKind_id,
+                                                                         hackSearchByLowerCaseNameAndKind_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           HackSearchByLowerCaseNameAndKind_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByLowerCaseNameAndKind where
+  toJSON (HackSearchByLowerCaseNameAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackSearchByLowerCaseNameAndKind where
+  buildStruct _proxy
+    (HackSearchByLowerCaseNameAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackSearchByLowerCaseNameAndKind __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByLowerCaseNameAndKind where
+  rnf (HackSearchByLowerCaseNameAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackSearchByLowerCaseNameAndKind where
+  def = HackSearchByLowerCaseNameAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackSearchByLowerCaseNameAndKind where
+  hashWithSalt __salt (HackSearchByLowerCaseNameAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackNameLowerCase_id = Glean.Id
+
+data HackNameLowerCase = HackNameLowerCase{hackNameLowerCase_id ::
+                                           {-# UNPACK #-} !HackNameLowerCase_id,
+                                           hackNameLowerCase_key ::
+                                           Prelude.Maybe HackNameLowerCase_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackNameLowerCase where
+  toJSON (HackNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackNameLowerCase where
+  buildStruct _proxy (HackNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackNameLowerCase where
+  rnf (HackNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackNameLowerCase where
+  def = HackNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackNameLowerCase where
+  hashWithSalt __salt (HackNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLSearchByName_id = Glean.Id
+
+data GraphQLSearchByName = GraphQLSearchByName{graphQLSearchByName_id
+                                               :: {-# UNPACK #-} !GraphQLSearchByName_id,
+                                               graphQLSearchByName_key ::
+                                               Prelude.Maybe GraphQLSearchByName_key}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLSearchByName where
+  toJSON (GraphQLSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLSearchByName where
+  buildStruct _proxy (GraphQLSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (GraphQLSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLSearchByName where
+  rnf (GraphQLSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLSearchByName where
+  def = GraphQLSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLSearchByName where
+  hashWithSalt __salt (GraphQLSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type GraphQLSearchByLowerCaseName_id = Glean.Id
+
+data GraphQLSearchByLowerCaseName = GraphQLSearchByLowerCaseName{graphQLSearchByLowerCaseName_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !GraphQLSearchByLowerCaseName_id,
+                                                                 graphQLSearchByLowerCaseName_key ::
+                                                                 Prelude.Maybe
+                                                                   GraphQLSearchByLowerCaseName_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLSearchByLowerCaseName where
+  toJSON (GraphQLSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLSearchByLowerCaseName where
+  buildStruct _proxy
+    (GraphQLSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (GraphQLSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLSearchByLowerCaseName where
+  rnf (GraphQLSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default GraphQLSearchByLowerCaseName where
+  def = GraphQLSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable GraphQLSearchByLowerCaseName where
+  hashWithSalt __salt (GraphQLSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowSearchByScopeAndKind_id = Glean.Id
+
+data FlowSearchByScopeAndKind = FlowSearchByScopeAndKind{flowSearchByScopeAndKind_id
+                                                         ::
+                                                         {-# UNPACK #-} !FlowSearchByScopeAndKind_id,
+                                                         flowSearchByScopeAndKind_key ::
+                                                         Prelude.Maybe FlowSearchByScopeAndKind_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByScopeAndKind where
+  toJSON (FlowSearchByScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowSearchByScopeAndKind where
+  buildStruct _proxy
+    (FlowSearchByScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowSearchByScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByScopeAndKind where
+  rnf (FlowSearchByScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowSearchByScopeAndKind where
+  def = FlowSearchByScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowSearchByScopeAndKind where
+  hashWithSalt __salt (FlowSearchByScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowSearchByNameKindAndScopeFact_id = Glean.Id
+
+data FlowSearchByNameKindAndScopeFact = FlowSearchByNameKindAndScopeFact{flowSearchByNameKindAndScopeFact_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !FlowSearchByNameKindAndScopeFact_id,
+                                                                         flowSearchByNameKindAndScopeFact_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           FlowSearchByNameKindAndScopeFact_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByNameKindAndScopeFact where
+  toJSON (FlowSearchByNameKindAndScopeFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowSearchByNameKindAndScopeFact where
+  buildStruct _proxy
+    (FlowSearchByNameKindAndScopeFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowSearchByNameKindAndScopeFact __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByNameKindAndScopeFact where
+  rnf (FlowSearchByNameKindAndScopeFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowSearchByNameKindAndScopeFact where
+  def = FlowSearchByNameKindAndScopeFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowSearchByNameKindAndScopeFact where
+  hashWithSalt __salt (FlowSearchByNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowSearchByLowerCaseScopeAndKind_id = Glean.Id
+
+data FlowSearchByLowerCaseScopeAndKind = FlowSearchByLowerCaseScopeAndKind{flowSearchByLowerCaseScopeAndKind_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !FlowSearchByLowerCaseScopeAndKind_id,
+                                                                           flowSearchByLowerCaseScopeAndKind_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             FlowSearchByLowerCaseScopeAndKind_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByLowerCaseScopeAndKind where
+  toJSON (FlowSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowSearchByLowerCaseScopeAndKind
+         where
+  buildStruct _proxy
+    (FlowSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowSearchByLowerCaseScopeAndKind __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByLowerCaseScopeAndKind where
+  rnf (FlowSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowSearchByLowerCaseScopeAndKind where
+  def = FlowSearchByLowerCaseScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowSearchByLowerCaseScopeAndKind where
+  hashWithSalt __salt (FlowSearchByLowerCaseScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowSearchByLowerCaseNameKindAndScopeFact_id = Glean.Id
+
+data FlowSearchByLowerCaseNameKindAndScopeFact = FlowSearchByLowerCaseNameKindAndScopeFact{flowSearchByLowerCaseNameKindAndScopeFact_id
+                                                                                           ::
+                                                                                           {-# UNPACK #-} !FlowSearchByLowerCaseNameKindAndScopeFact_id,
+                                                                                           flowSearchByLowerCaseNameKindAndScopeFact_key
+                                                                                           ::
+                                                                                           Prelude.Maybe
+                                                                                             FlowSearchByLowerCaseNameKindAndScopeFact_key}
+                                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  toJSON
+    (FlowSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildStruct _proxy
+    (FlowSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FlowSearchByLowerCaseNameKindAndScopeFact __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  rnf
+    (FlowSearchByLowerCaseNameKindAndScopeFact __field__id
+       __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  def
+    = FlowSearchByLowerCaseNameKindAndScopeFact Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable
+           FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  hashWithSalt __salt
+    (FlowSearchByLowerCaseNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FlowNameLowerCase_id = Glean.Id
+
+data FlowNameLowerCase = FlowNameLowerCase{flowNameLowerCase_id ::
+                                           {-# UNPACK #-} !FlowNameLowerCase_id,
+                                           flowNameLowerCase_key ::
+                                           Prelude.Maybe FlowNameLowerCase_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowNameLowerCase where
+  toJSON (FlowNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FlowNameLowerCase where
+  buildStruct _proxy (FlowNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FlowNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowNameLowerCase where
+  rnf (FlowNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FlowNameLowerCase where
+  def = FlowNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable FlowNameLowerCase where
+  hashWithSalt __salt (FlowNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FbthriftSearchByNameFact_id = Glean.Id
+
+data FbthriftSearchByNameFact = FbthriftSearchByNameFact{fbthriftSearchByNameFact_id
+                                                         ::
+                                                         {-# UNPACK #-} !FbthriftSearchByNameFact_id,
+                                                         fbthriftSearchByNameFact_key ::
+                                                         Prelude.Maybe FbthriftSearchByNameFact_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FbthriftSearchByNameFact where
+  toJSON (FbthriftSearchByNameFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FbthriftSearchByNameFact where
+  buildStruct _proxy
+    (FbthriftSearchByNameFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (FbthriftSearchByNameFact __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FbthriftSearchByNameFact where
+  rnf (FbthriftSearchByNameFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FbthriftSearchByNameFact where
+  def = FbthriftSearchByNameFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable FbthriftSearchByNameFact where
+  hashWithSalt __salt (FbthriftSearchByNameFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangSearchByName_id = Glean.Id
+
+data ErlangSearchByName = ErlangSearchByName{erlangSearchByName_id
+                                             :: {-# UNPACK #-} !ErlangSearchByName_id,
+                                             erlangSearchByName_key ::
+                                             Prelude.Maybe ErlangSearchByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangSearchByName where
+  toJSON (ErlangSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangSearchByName where
+  buildStruct _proxy (ErlangSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ErlangSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangSearchByName where
+  rnf (ErlangSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangSearchByName where
+  def = ErlangSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangSearchByName where
+  hashWithSalt __salt (ErlangSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ErlangSearchByLowerCaseName_id = Glean.Id
+
+data ErlangSearchByLowerCaseName = ErlangSearchByLowerCaseName{erlangSearchByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !ErlangSearchByLowerCaseName_id,
+                                                               erlangSearchByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 ErlangSearchByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangSearchByLowerCaseName where
+  toJSON (ErlangSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangSearchByLowerCaseName where
+  buildStruct _proxy
+    (ErlangSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (ErlangSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangSearchByLowerCaseName where
+  rnf (ErlangSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ErlangSearchByLowerCaseName where
+  def = ErlangSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable ErlangSearchByLowerCaseName where
+  hashWithSalt __salt (ErlangSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxSearchByScopeAndKind_id = Glean.Id
+
+data CxxSearchByScopeAndKind = CxxSearchByScopeAndKind{cxxSearchByScopeAndKind_id
+                                                       ::
+                                                       {-# UNPACK #-} !CxxSearchByScopeAndKind_id,
+                                                       cxxSearchByScopeAndKind_key ::
+                                                       Prelude.Maybe CxxSearchByScopeAndKind_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByScopeAndKind where
+  toJSON (CxxSearchByScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxSearchByScopeAndKind where
+  buildStruct _proxy
+    (CxxSearchByScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxSearchByScopeAndKind __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByScopeAndKind where
+  rnf (CxxSearchByScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxSearchByScopeAndKind where
+  def = CxxSearchByScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxSearchByScopeAndKind where
+  hashWithSalt __salt (CxxSearchByScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxSearchByNameKindAndScopeFact_id = Glean.Id
+
+data CxxSearchByNameKindAndScopeFact = CxxSearchByNameKindAndScopeFact{cxxSearchByNameKindAndScopeFact_id
+                                                                       ::
+                                                                       {-# UNPACK #-} !CxxSearchByNameKindAndScopeFact_id,
+                                                                       cxxSearchByNameKindAndScopeFact_key
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         CxxSearchByNameKindAndScopeFact_key}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByNameKindAndScopeFact where
+  toJSON (CxxSearchByNameKindAndScopeFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxSearchByNameKindAndScopeFact where
+  buildStruct _proxy
+    (CxxSearchByNameKindAndScopeFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxSearchByNameKindAndScopeFact __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByNameKindAndScopeFact where
+  rnf (CxxSearchByNameKindAndScopeFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxSearchByNameKindAndScopeFact where
+  def = CxxSearchByNameKindAndScopeFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxSearchByNameKindAndScopeFact where
+  hashWithSalt __salt (CxxSearchByNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxSearchByLowerCaseScopeAndKind_id = Glean.Id
+
+data CxxSearchByLowerCaseScopeAndKind = CxxSearchByLowerCaseScopeAndKind{cxxSearchByLowerCaseScopeAndKind_id
+                                                                         ::
+                                                                         {-# UNPACK #-} !CxxSearchByLowerCaseScopeAndKind_id,
+                                                                         cxxSearchByLowerCaseScopeAndKind_key
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           CxxSearchByLowerCaseScopeAndKind_key}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByLowerCaseScopeAndKind where
+  toJSON (CxxSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxSearchByLowerCaseScopeAndKind where
+  buildStruct _proxy
+    (CxxSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxSearchByLowerCaseScopeAndKind __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByLowerCaseScopeAndKind where
+  rnf (CxxSearchByLowerCaseScopeAndKind __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxSearchByLowerCaseScopeAndKind where
+  def = CxxSearchByLowerCaseScopeAndKind Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxSearchByLowerCaseScopeAndKind where
+  hashWithSalt __salt (CxxSearchByLowerCaseScopeAndKind _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxSearchByLowerCaseNameKindAndScopeFact_id = Glean.Id
+
+data CxxSearchByLowerCaseNameKindAndScopeFact = CxxSearchByLowerCaseNameKindAndScopeFact{cxxSearchByLowerCaseNameKindAndScopeFact_id
+                                                                                         ::
+                                                                                         {-# UNPACK #-} !CxxSearchByLowerCaseNameKindAndScopeFact_id,
+                                                                                         cxxSearchByLowerCaseNameKindAndScopeFact_key
+                                                                                         ::
+                                                                                         Prelude.Maybe
+                                                                                           CxxSearchByLowerCaseNameKindAndScopeFact_key}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  toJSON
+    (CxxSearchByLowerCaseNameKindAndScopeFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildStruct _proxy
+    (CxxSearchByLowerCaseNameKindAndScopeFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxSearchByLowerCaseNameKindAndScopeFact __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  rnf
+    (CxxSearchByLowerCaseNameKindAndScopeFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  def
+    = CxxSearchByLowerCaseNameKindAndScopeFact Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  hashWithSalt __salt
+    (CxxSearchByLowerCaseNameKindAndScopeFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxPreferDefinitions_id = Glean.Id
+
+data CxxPreferDefinitions = CxxPreferDefinitions{cxxPreferDefinitions_id
+                                                 :: {-# UNPACK #-} !CxxPreferDefinitions_id,
+                                                 cxxPreferDefinitions_key ::
+                                                 Prelude.Maybe CxxPreferDefinitions_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxPreferDefinitions where
+  toJSON (CxxPreferDefinitions __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxPreferDefinitions where
+  buildStruct _proxy (CxxPreferDefinitions __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CxxPreferDefinitions __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxPreferDefinitions where
+  rnf (CxxPreferDefinitions __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxPreferDefinitions where
+  def = CxxPreferDefinitions Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxPreferDefinitions where
+  hashWithSalt __salt (CxxPreferDefinitions _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxNameLowerCase_id = Glean.Id
+
+data CxxNameLowerCase = CxxNameLowerCase{cxxNameLowerCase_id ::
+                                         {-# UNPACK #-} !CxxNameLowerCase_id,
+                                         cxxNameLowerCase_key :: Prelude.Maybe CxxNameLowerCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNameLowerCase where
+  toJSON (CxxNameLowerCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxNameLowerCase where
+  buildStruct _proxy (CxxNameLowerCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxNameLowerCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNameLowerCase where
+  rnf (CxxNameLowerCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxNameLowerCase where
+  def = CxxNameLowerCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxNameLowerCase where
+  hashWithSalt __salt (CxxNameLowerCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpSearchByName_id = Glean.Id
+
+data CSharpSearchByName = CSharpSearchByName{cSharpSearchByName_id
+                                             :: {-# UNPACK #-} !CSharpSearchByName_id,
+                                             cSharpSearchByName_key ::
+                                             Prelude.Maybe CSharpSearchByName_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpSearchByName where
+  toJSON (CSharpSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpSearchByName where
+  buildStruct _proxy (CSharpSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CSharpSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpSearchByName where
+  rnf (CSharpSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpSearchByName where
+  def = CSharpSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpSearchByName where
+  hashWithSalt __salt (CSharpSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CSharpSearchByLowerCaseName_id = Glean.Id
+
+data CSharpSearchByLowerCaseName = CSharpSearchByLowerCaseName{cSharpSearchByLowerCaseName_id
+                                                               ::
+                                                               {-# UNPACK #-} !CSharpSearchByLowerCaseName_id,
+                                                               cSharpSearchByLowerCaseName_key ::
+                                                               Prelude.Maybe
+                                                                 CSharpSearchByLowerCaseName_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpSearchByLowerCaseName where
+  toJSON (CSharpSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpSearchByLowerCaseName where
+  buildStruct _proxy
+    (CSharpSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (CSharpSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpSearchByLowerCaseName where
+  rnf (CSharpSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CSharpSearchByLowerCaseName where
+  def = CSharpSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable CSharpSearchByLowerCaseName where
+  hashWithSalt __salt (CSharpSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckSearchByName_id = Glean.Id
+
+data BuckSearchByName = BuckSearchByName{buckSearchByName_id ::
+                                         {-# UNPACK #-} !BuckSearchByName_id,
+                                         buckSearchByName_key :: Prelude.Maybe BuckSearchByName_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByName where
+  toJSON (BuckSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByName where
+  buildStruct _proxy (BuckSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (BuckSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByName where
+  rnf (BuckSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckSearchByName where
+  def = BuckSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckSearchByName where
+  hashWithSalt __salt (BuckSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckSearchByLowerCaseName_id = Glean.Id
+
+data BuckSearchByLowerCaseName = BuckSearchByLowerCaseName{buckSearchByLowerCaseName_id
+                                                           ::
+                                                           {-# UNPACK #-} !BuckSearchByLowerCaseName_id,
+                                                           buckSearchByLowerCaseName_key ::
+                                                           Prelude.Maybe
+                                                             BuckSearchByLowerCaseName_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByLowerCaseName where
+  toJSON (BuckSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByLowerCaseName where
+  buildStruct _proxy
+    (BuckSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (BuckSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByLowerCaseName where
+  rnf (BuckSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckSearchByLowerCaseName where
+  def = BuckSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckSearchByLowerCaseName where
+  hashWithSalt __salt (BuckSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type BuckSearchByLocalNameFact_id = Glean.Id
+
+data BuckSearchByLocalNameFact = BuckSearchByLocalNameFact{buckSearchByLocalNameFact_id
+                                                           ::
+                                                           {-# UNPACK #-} !BuckSearchByLocalNameFact_id,
+                                                           buckSearchByLocalNameFact_key ::
+                                                           Prelude.Maybe
+                                                             BuckSearchByLocalNameFact_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByLocalNameFact where
+  toJSON (BuckSearchByLocalNameFact __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByLocalNameFact where
+  buildStruct _proxy
+    (BuckSearchByLocalNameFact __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (BuckSearchByLocalNameFact __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByLocalNameFact where
+  rnf (BuckSearchByLocalNameFact __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default BuckSearchByLocalNameFact where
+  def = BuckSearchByLocalNameFact Default.def Prelude.Nothing
+
+instance Hashable.Hashable BuckSearchByLocalNameFact where
+  hashWithSalt __salt (BuckSearchByLocalNameFact _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AngleSearchByName_id = Glean.Id
+
+data AngleSearchByName = AngleSearchByName{angleSearchByName_id ::
+                                           {-# UNPACK #-} !AngleSearchByName_id,
+                                           angleSearchByName_key ::
+                                           Prelude.Maybe AngleSearchByName_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleSearchByName where
+  toJSON (AngleSearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleSearchByName where
+  buildStruct _proxy (AngleSearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (AngleSearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleSearchByName where
+  rnf (AngleSearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleSearchByName where
+  def = AngleSearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleSearchByName where
+  hashWithSalt __salt (AngleSearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type AngleSearchByLowerCaseName_id = Glean.Id
+
+data AngleSearchByLowerCaseName = AngleSearchByLowerCaseName{angleSearchByLowerCaseName_id
+                                                             ::
+                                                             {-# UNPACK #-} !AngleSearchByLowerCaseName_id,
+                                                             angleSearchByLowerCaseName_key ::
+                                                             Prelude.Maybe
+                                                               AngleSearchByLowerCaseName_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleSearchByLowerCaseName where
+  toJSON (AngleSearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleSearchByLowerCaseName where
+  buildStruct _proxy
+    (AngleSearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (AngleSearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleSearchByLowerCaseName where
+  rnf (AngleSearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default AngleSearchByLowerCaseName where
+  def = AngleSearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable AngleSearchByLowerCaseName where
+  hashWithSalt __salt (AngleSearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data ThriftSearchByName_key = ThriftSearchByName_key{thriftSearchByName_key_name
+                                                     :: Text.Text,
+                                                     thriftSearchByName_key_entity ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftSearchByName_key where
+  toJSON (ThriftSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftSearchByName_key where
+  buildStruct _proxy
+    (ThriftSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ThriftSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftSearchByName_key where
+  rnf (ThriftSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ThriftSearchByName_key where
+  def = ThriftSearchByName_key "" Default.def
+
+instance Hashable.Hashable ThriftSearchByName_key where
+  hashWithSalt __salt (ThriftSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data ThriftSearchByLowerCaseName_key = ThriftSearchByLowerCaseName_key{thriftSearchByLowerCaseName_key_name
+                                                                       :: Text.Text,
+                                                                       thriftSearchByLowerCaseName_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThriftSearchByLowerCaseName_key where
+  toJSON
+    (ThriftSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ThriftSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (ThriftSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ThriftSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ThriftSearchByLowerCaseName_key where
+  rnf (ThriftSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ThriftSearchByLowerCaseName_key where
+  def = ThriftSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable ThriftSearchByLowerCaseName_key where
+  hashWithSalt __salt (ThriftSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data SearchByScopeAndKind_key = SearchByScopeAndKind_key{searchByScopeAndKind_key_name
+                                                         :: Text.Text,
+                                                         searchByScopeAndKind_key_scope ::
+                                                         [Text.Text],
+                                                         searchByScopeAndKind_key_language ::
+                                                         Glean.Schema.Code.Language,
+                                                         searchByScopeAndKind_key_kinds ::
+                                                         Prelude.Maybe
+                                                           Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                         searchByScopeAndKind_key_entity ::
+                                                         Glean.Schema.Code.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScopeAndKind_key where
+  toJSON
+    (SearchByScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "language" .= __field__language :
+               Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                 ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByScopeAndKind_key where
+  buildStruct _proxy
+    (SearchByScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__language)
+               :
+               let (__cereal__kinds, __id__kinds)
+                     = case __field__kinds of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kinds"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kinds
+                   (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5
+                      __id__kinds
+                      (Thrift.buildStruct _proxy __field__entity)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByScopeAndKind_key __val__name __val__scope
+                                                  __val__language
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("language", 3), ("kinds", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScopeAndKind_key where
+  rnf
+    (SearchByScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__kinds `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByScopeAndKind_key where
+  def
+    = SearchByScopeAndKind_key "" Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByScopeAndKind_key where
+  hashWithSalt __salt
+    (SearchByScopeAndKind_key _name _scope _language _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+              _language)
+           _kinds)
+        _entity
+
+data SearchByScope_key = SearchByScope_key{searchByScope_key_name
+                                           :: Text.Text,
+                                           searchByScope_key_scope :: [Text.Text],
+                                           searchByScope_key_language :: Glean.Schema.Code.Language,
+                                           searchByScope_key_entity :: Glean.Schema.Code.Entity}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByScope_key where
+  toJSON
+    (SearchByScope_key __field__name __field__scope __field__language
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "language" .= __field__language :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByScope_key where
+  buildStruct _proxy
+    (SearchByScope_key __field__name __field__scope __field__language
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__language)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByScope_key __val__name __val__scope
+                                                  __val__language
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("language", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByScope_key where
+  rnf
+    (SearchByScope_key __field__name __field__scope __field__language
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByScope_key where
+  def = SearchByScope_key "" Default.def Default.def Default.def
+
+instance Hashable.Hashable SearchByScope_key where
+  hashWithSalt __salt
+    (SearchByScope_key _name _scope _language _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _language)
+        _entity
+
+data SearchByNameKindAndLanguage_key = SearchByNameKindAndLanguage_key{searchByNameKindAndLanguage_key_name
+                                                                       :: Text.Text,
+                                                                       searchByNameKindAndLanguage_key_language
+                                                                       ::
+                                                                       Glean.Schema.Code.Language,
+                                                                       searchByNameKindAndLanguage_key_kinds
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                       searchByNameKindAndLanguage_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameKindAndLanguage_key where
+  toJSON
+    (SearchByNameKindAndLanguage_key __field__name __field__language
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "language" .= __field__language :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByNameKindAndLanguage_key where
+  buildStruct _proxy
+    (SearchByNameKindAndLanguage_key __field__name __field__language
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__language <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByNameKindAndLanguage_key __val__name
+                                                  __val__language
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("language", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameKindAndLanguage_key where
+  rnf
+    (SearchByNameKindAndLanguage_key __field__name __field__language
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByNameKindAndLanguage_key where
+  def
+    = SearchByNameKindAndLanguage_key "" Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByNameKindAndLanguage_key where
+  hashWithSalt __salt
+    (SearchByNameKindAndLanguage_key _name _language _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _language)
+           _kinds)
+        _entity
+
+data SearchByNameAndLanguage_key = SearchByNameAndLanguage_key{searchByNameAndLanguage_key_name
+                                                               :: Text.Text,
+                                                               searchByNameAndLanguage_key_language
+                                                               :: Glean.Schema.Code.Language,
+                                                               searchByNameAndLanguage_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByNameAndLanguage_key where
+  toJSON
+    (SearchByNameAndLanguage_key __field__name __field__language
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "language" .= __field__language :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByNameAndLanguage_key where
+  buildStruct _proxy
+    (SearchByNameAndLanguage_key __field__name __field__language
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__language <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByNameAndLanguage_key __val__name
+                                                  __val__language
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("language", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByNameAndLanguage_key where
+  rnf
+    (SearchByNameAndLanguage_key __field__name __field__language
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByNameAndLanguage_key where
+  def = SearchByNameAndLanguage_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchByNameAndLanguage_key where
+  hashWithSalt __salt
+    (SearchByNameAndLanguage_key _name _language _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _language)
+        _entity
+
+data SearchByLowerCaseScopeAndKind_key = SearchByLowerCaseScopeAndKind_key{searchByLowerCaseScopeAndKind_key_name
+                                                                           :: Text.Text,
+                                                                           searchByLowerCaseScopeAndKind_key_scope
+                                                                           :: [Text.Text],
+                                                                           searchByLowerCaseScopeAndKind_key_language
+                                                                           ::
+                                                                           Glean.Schema.Code.Language,
+                                                                           searchByLowerCaseScopeAndKind_key_kinds
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                           searchByLowerCaseScopeAndKind_key_entity
+                                                                           ::
+                                                                           Glean.Schema.Code.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseScopeAndKind_key where
+  toJSON
+    (SearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "language" .= __field__language :
+               Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                 ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchByLowerCaseScopeAndKind_key
+         where
+  buildStruct _proxy
+    (SearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__language)
+               :
+               let (__cereal__kinds, __id__kinds)
+                     = case __field__kinds of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kinds"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kinds
+                   (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5
+                      __id__kinds
+                      (Thrift.buildStruct _proxy __field__entity)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByLowerCaseScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__language
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("language", 3), ("kinds", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseScopeAndKind_key where
+  rnf
+    (SearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__language __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__kinds `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseScopeAndKind_key where
+  def
+    = SearchByLowerCaseScopeAndKind_key "" Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByLowerCaseScopeAndKind_key where
+  hashWithSalt __salt
+    (SearchByLowerCaseScopeAndKind_key _name _scope _language _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+              _language)
+           _kinds)
+        _entity
+
+data SearchByLowerCaseScope_key = SearchByLowerCaseScope_key{searchByLowerCaseScope_key_name
+                                                             :: Text.Text,
+                                                             searchByLowerCaseScope_key_scope ::
+                                                             [Text.Text],
+                                                             searchByLowerCaseScope_key_language ::
+                                                             Glean.Schema.Code.Language,
+                                                             searchByLowerCaseScope_key_entity ::
+                                                             Glean.Schema.Code.Entity}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseScope_key where
+  toJSON
+    (SearchByLowerCaseScope_key __field__name __field__scope
+       __field__language __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "language" .= __field__language :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseScope_key where
+  buildStruct _proxy
+    (SearchByLowerCaseScope_key __field__name __field__scope
+       __field__language __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 3 2
+               ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                   Thrift.fromThriftEnum)
+                  __field__language)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByLowerCaseScope_key __val__name __val__scope
+                                                  __val__language
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("language", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseScope_key where
+  rnf
+    (SearchByLowerCaseScope_key __field__name __field__scope
+       __field__language __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__language `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseScope_key where
+  def
+    = SearchByLowerCaseScope_key "" Default.def Default.def Default.def
+
+instance Hashable.Hashable SearchByLowerCaseScope_key where
+  hashWithSalt __salt
+    (SearchByLowerCaseScope_key _name _scope _language _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _language)
+        _entity
+
+data SearchByLowerCaseNameKindAndLanguage_key = SearchByLowerCaseNameKindAndLanguage_key{searchByLowerCaseNameKindAndLanguage_key_name
+                                                                                         ::
+                                                                                         Text.Text,
+                                                                                         searchByLowerCaseNameKindAndLanguage_key_language
+                                                                                         ::
+                                                                                         Glean.Schema.Code.Language,
+                                                                                         searchByLowerCaseNameKindAndLanguage_key_kinds
+                                                                                         ::
+                                                                                         Prelude.Maybe
+                                                                                           Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                         searchByLowerCaseNameKindAndLanguage_key_entity
+                                                                                         ::
+                                                                                         Glean.Schema.Code.Entity}
+                                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseNameKindAndLanguage_key
+         where
+  toJSON
+    (SearchByLowerCaseNameKindAndLanguage_key __field__name
+       __field__language __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "language" .= __field__language :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct
+           SearchByLowerCaseNameKindAndLanguage_key
+         where
+  buildStruct _proxy
+    (SearchByLowerCaseNameKindAndLanguage_key __field__name
+       __field__language __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__language <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByLowerCaseNameKindAndLanguage_key __val__name
+                                                  __val__language
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("language", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseNameKindAndLanguage_key
+         where
+  rnf
+    (SearchByLowerCaseNameKindAndLanguage_key __field__name
+       __field__language __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseNameKindAndLanguage_key
+         where
+  def
+    = SearchByLowerCaseNameKindAndLanguage_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchByLowerCaseNameKindAndLanguage_key
+         where
+  hashWithSalt __salt
+    (SearchByLowerCaseNameKindAndLanguage_key _name _language _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _language)
+           _kinds)
+        _entity
+
+data SearchByLowerCaseNameAndLanguage_key = SearchByLowerCaseNameAndLanguage_key{searchByLowerCaseNameAndLanguage_key_name
+                                                                                 :: Text.Text,
+                                                                                 searchByLowerCaseNameAndLanguage_key_language
+                                                                                 ::
+                                                                                 Glean.Schema.Code.Language,
+                                                                                 searchByLowerCaseNameAndLanguage_key_entity
+                                                                                 ::
+                                                                                 Glean.Schema.Code.Entity}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseNameAndLanguage_key where
+  toJSON
+    (SearchByLowerCaseNameAndLanguage_key __field__name
+       __field__language __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "language" .= __field__language :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseNameAndLanguage_key
+         where
+  buildStruct _proxy
+    (SearchByLowerCaseNameAndLanguage_key __field__name
+       __field__language __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__language <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__language <- ST.readSTRef __field__language
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByLowerCaseNameAndLanguage_key __val__name
+                                                  __val__language
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("language", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseNameAndLanguage_key where
+  rnf
+    (SearchByLowerCaseNameAndLanguage_key __field__name
+       __field__language __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseNameAndLanguage_key where
+  def
+    = SearchByLowerCaseNameAndLanguage_key "" Default.def Default.def
+
+instance Hashable.Hashable SearchByLowerCaseNameAndLanguage_key
+         where
+  hashWithSalt __salt
+    (SearchByLowerCaseNameAndLanguage_key _name _language _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _language)
+        _entity
+
+data RustSearchByNameAndKind_key = RustSearchByNameAndKind_key{rustSearchByNameAndKind_key_name
+                                                               :: Text.Text,
+                                                               rustSearchByNameAndKind_key_kind ::
+                                                               Prelude.Maybe
+                                                                 Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                               rustSearchByNameAndKind_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RustSearchByNameAndKind_key where
+  toJSON
+    (RustSearchByNameAndKind_key __field__name __field__kind
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kind" .=)) __field__kind
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct RustSearchByNameAndKind_key where
+  buildStruct _proxy
+    (RustSearchByNameAndKind_key __field__name __field__kind
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kind, __id__kind)
+                 = case __field__kind of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kind"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kind
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kind
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kind <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kind
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kind <- ST.readSTRef __field__kind
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (RustSearchByNameAndKind_key __val__name __val__kind
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("kind", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData RustSearchByNameAndKind_key where
+  rnf
+    (RustSearchByNameAndKind_key __field__name __field__kind
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kind `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default RustSearchByNameAndKind_key where
+  def = RustSearchByNameAndKind_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable RustSearchByNameAndKind_key where
+  hashWithSalt __salt
+    (RustSearchByNameAndKind_key _name _kind _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kind)
+        _entity
+
+data PythonSearchByScopeAndKind_key = PythonSearchByScopeAndKind_key{pythonSearchByScopeAndKind_key_name
+                                                                     :: Text.Text,
+                                                                     pythonSearchByScopeAndKind_key_scope
+                                                                     :: [Text.Text],
+                                                                     pythonSearchByScopeAndKind_key_kinds
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                     pythonSearchByScopeAndKind_key_entity
+                                                                     :: Glean.Schema.Code.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByScopeAndKind_key where
+  toJSON
+    (PythonSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct PythonSearchByScopeAndKind_key where
+  buildStruct _proxy
+    (PythonSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonSearchByScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByScopeAndKind_key where
+  rnf
+    (PythonSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PythonSearchByScopeAndKind_key where
+  def
+    = PythonSearchByScopeAndKind_key "" Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable PythonSearchByScopeAndKind_key where
+  hashWithSalt __salt
+    (PythonSearchByScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data PythonSearchByNameKindAndScopeFact_key = PythonSearchByNameKindAndScopeFact_key{pythonSearchByNameKindAndScopeFact_key_name
+                                                                                     :: Text.Text,
+                                                                                     pythonSearchByNameKindAndScopeFact_key_scope
+                                                                                     ::
+                                                                                     Prelude.Maybe
+                                                                                       Glean.Schema.Python.SName,
+                                                                                     pythonSearchByNameKindAndScopeFact_key_kinds
+                                                                                     ::
+                                                                                     Prelude.Maybe
+                                                                                       Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                     pythonSearchByNameKindAndScopeFact_key_entity
+                                                                                     ::
+                                                                                     Glean.Schema.Code.Entity}
+                                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByNameKindAndScopeFact_key where
+  toJSON
+    (PythonSearchByNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("scope" .=)) __field__scope
+             (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct PythonSearchByNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (PythonSearchByNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__scope, __id__scope)
+                 = case __field__scope of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "scope"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__scope
+               (let (__cereal__kinds, __id__kinds)
+                      = case __field__kinds of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "kinds"
+                                                     (Thrift.getI32Type _proxy)
+                                                     3
+                                                     __id__scope
+                                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                         Thrift.fromThriftEnum)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__scope)
+                  in
+                  __cereal__kinds
+                    (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                       __id__kinds
+                       (Thrift.buildStruct _proxy __field__entity)
+                       : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonSearchByNameKindAndScopeFact_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByNameKindAndScopeFact_key
+         where
+  rnf
+    (PythonSearchByNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PythonSearchByNameKindAndScopeFact_key
+         where
+  def
+    = PythonSearchByNameKindAndScopeFact_key "" Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable PythonSearchByNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (PythonSearchByNameKindAndScopeFact_key _name _scope _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data PythonSearchByLowerCaseScopeAndKind_key = PythonSearchByLowerCaseScopeAndKind_key{pythonSearchByLowerCaseScopeAndKind_key_name
+                                                                                       :: Text.Text,
+                                                                                       pythonSearchByLowerCaseScopeAndKind_key_scope
+                                                                                       ::
+                                                                                       [Text.Text],
+                                                                                       pythonSearchByLowerCaseScopeAndKind_key_kinds
+                                                                                       ::
+                                                                                       Prelude.Maybe
+                                                                                         Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                       pythonSearchByLowerCaseScopeAndKind_key_entity
+                                                                                       ::
+                                                                                       Glean.Schema.Code.Entity}
+                                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonSearchByLowerCaseScopeAndKind_key where
+  toJSON
+    (PythonSearchByLowerCaseScopeAndKind_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct
+           PythonSearchByLowerCaseScopeAndKind_key
+         where
+  buildStruct _proxy
+    (PythonSearchByLowerCaseScopeAndKind_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonSearchByLowerCaseScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonSearchByLowerCaseScopeAndKind_key
+         where
+  rnf
+    (PythonSearchByLowerCaseScopeAndKind_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PythonSearchByLowerCaseScopeAndKind_key
+         where
+  def
+    = PythonSearchByLowerCaseScopeAndKind_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable PythonSearchByLowerCaseScopeAndKind_key
+         where
+  hashWithSalt __salt
+    (PythonSearchByLowerCaseScopeAndKind_key _name _scope _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data PythonSearchByLowerCaseNameKindAndScopeFact_key = PythonSearchByLowerCaseNameKindAndScopeFact_key{pythonSearchByLowerCaseNameKindAndScopeFact_key_name
+                                                                                                       ::
+                                                                                                       Text.Text,
+                                                                                                       pythonSearchByLowerCaseNameKindAndScopeFact_key_scope
+                                                                                                       ::
+                                                                                                       Prelude.Maybe
+                                                                                                         Glean.Schema.Python.SName,
+                                                                                                       pythonSearchByLowerCaseNameKindAndScopeFact_key_kinds
+                                                                                                       ::
+                                                                                                       Prelude.Maybe
+                                                                                                         Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                                       pythonSearchByLowerCaseNameKindAndScopeFact_key_entity
+                                                                                                       ::
+                                                                                                       Glean.Schema.Code.Entity}
+                                                       deriving (Prelude.Eq, Prelude.Show,
+                                                                 Prelude.Ord)
+
+instance Aeson.ToJSON
+           PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  toJSON
+    (PythonSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("scope" .=)) __field__scope
+             (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct
+           PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (PythonSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__scope, __id__scope)
+                 = case __field__scope of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "scope"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__scope
+               (let (__cereal__kinds, __id__kinds)
+                      = case __field__kinds of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "kinds"
+                                                     (Thrift.getI32Type _proxy)
+                                                     3
+                                                     __id__scope
+                                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                         Thrift.fromThriftEnum)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__scope)
+                  in
+                  __cereal__kinds
+                    (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                       __id__kinds
+                       (Thrift.buildStruct _proxy __field__entity)
+                       : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PythonSearchByLowerCaseNameKindAndScopeFact_key
+                                                  __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  rnf
+    (PythonSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default
+           PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  def
+    = PythonSearchByLowerCaseNameKindAndScopeFact_key ""
+        Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable
+           PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (PythonSearchByLowerCaseNameKindAndScopeFact_key _name _scope
+       _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data PythonNameLowerCase_key = PythonNameLowerCase_key{pythonNameLowerCase_key_nameLowercase
+                                                       :: Text.Text,
+                                                       pythonNameLowerCase_key_kinds ::
+                                                       Prelude.Maybe
+                                                         Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                       pythonNameLowerCase_key_name :: Text.Text}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PythonNameLowerCase_key where
+  toJSON
+    (PythonNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct PythonNameLowerCase_key where
+  buildStruct _proxy
+    (PythonNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3
+                  __id__kinds
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (PythonNameLowerCase_key __val__nameLowercase
+                                                  __val__kinds
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("nameLowercase", 1), ("kinds", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PythonNameLowerCase_key where
+  rnf
+    (PythonNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default PythonNameLowerCase_key where
+  def = PythonNameLowerCase_key "" Prelude.Nothing ""
+
+instance Hashable.Hashable PythonNameLowerCase_key where
+  hashWithSalt __salt
+    (PythonNameLowerCase_key _nameLowercase _kinds _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _nameLowercase)
+           _kinds)
+        _name
+
+data PpSearchByNameKind_key = PpSearchByNameKind_key{ppSearchByNameKind_key_name
+                                                     :: Text.Text,
+                                                     ppSearchByNameKind_key_kinds ::
+                                                     Prelude.Maybe
+                                                       Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                     ppSearchByNameKind_key_entity ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpSearchByNameKind_key where
+  toJSON
+    (PpSearchByNameKind_key __field__name __field__kinds
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct PpSearchByNameKind_key where
+  buildStruct _proxy
+    (PpSearchByNameKind_key __field__name __field__kinds
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kinds
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpSearchByNameKind_key __val__name __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("kinds", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpSearchByNameKind_key where
+  rnf
+    (PpSearchByNameKind_key __field__name __field__kinds
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpSearchByNameKind_key where
+  def = PpSearchByNameKind_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable PpSearchByNameKind_key where
+  hashWithSalt __salt (PpSearchByNameKind_key _name _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kinds)
+        _entity
+
+data PpSearchByLowerCaseNameKind_key = PpSearchByLowerCaseNameKind_key{ppSearchByLowerCaseNameKind_key_name
+                                                                       :: Text.Text,
+                                                                       ppSearchByLowerCaseNameKind_key_kinds
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                       ppSearchByLowerCaseNameKind_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PpSearchByLowerCaseNameKind_key where
+  toJSON
+    (PpSearchByLowerCaseNameKind_key __field__name __field__kinds
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct PpSearchByLowerCaseNameKind_key where
+  buildStruct _proxy
+    (PpSearchByLowerCaseNameKind_key __field__name __field__kinds
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kinds
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (PpSearchByLowerCaseNameKind_key __val__name
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("kinds", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData PpSearchByLowerCaseNameKind_key where
+  rnf
+    (PpSearchByLowerCaseNameKind_key __field__name __field__kinds
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default PpSearchByLowerCaseNameKind_key where
+  def
+    = PpSearchByLowerCaseNameKind_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable PpSearchByLowerCaseNameKind_key where
+  hashWithSalt __salt
+    (PpSearchByLowerCaseNameKind_key _name _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kinds)
+        _entity
+
+data LsifSearchByName_key = LsifSearchByName_key{lsifSearchByName_key_name
+                                                 :: Text.Text,
+                                                 lsifSearchByName_key_entity ::
+                                                 Glean.Schema.Code.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifSearchByName_key where
+  toJSON (LsifSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifSearchByName_key where
+  buildStruct _proxy
+    (LsifSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LsifSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifSearchByName_key where
+  rnf (LsifSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LsifSearchByName_key where
+  def = LsifSearchByName_key "" Default.def
+
+instance Hashable.Hashable LsifSearchByName_key where
+  hashWithSalt __salt (LsifSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data LsifSearchByLowerCaseName_key = LsifSearchByLowerCaseName_key{lsifSearchByLowerCaseName_key_name
+                                                                   :: Text.Text,
+                                                                   lsifSearchByLowerCaseName_key_entity
+                                                                   :: Glean.Schema.Code.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LsifSearchByLowerCaseName_key where
+  toJSON
+    (LsifSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LsifSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (LsifSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LsifSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LsifSearchByLowerCaseName_key where
+  rnf (LsifSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LsifSearchByLowerCaseName_key where
+  def = LsifSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable LsifSearchByLowerCaseName_key where
+  hashWithSalt __salt (LsifSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data KotlinSearchByScopeWithName_key = KotlinSearchByScopeWithName_key{kotlinSearchByScopeWithName_key_name
+                                                                       ::
+                                                                       Glean.Schema.JavakotlinAlpha.Name,
+                                                                       kotlinSearchByScopeWithName_key_insensitive
+                                                                       :: Prelude.Bool,
+                                                                       kotlinSearchByScopeWithName_key_scope
+                                                                       :: [Text.Text],
+                                                                       kotlinSearchByScopeWithName_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByScopeWithName_key where
+  toJSON
+    (KotlinSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByScopeWithName_key where
+  buildStruct _proxy
+    (KotlinSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__scope)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByScopeWithName_key __val__name
+                                                  __val__insensitive
+                                                  __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("insensitive", 2), ("scope", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByScopeWithName_key where
+  rnf
+    (KotlinSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByScopeWithName_key where
+  def
+    = KotlinSearchByScopeWithName_key Default.def Prelude.False
+        Default.def
+        Default.def
+
+instance Hashable.Hashable KotlinSearchByScopeWithName_key where
+  hashWithSalt __salt
+    (KotlinSearchByScopeWithName_key _name _insensitive _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _insensitive)
+           _scope)
+        _entity
+
+data KotlinSearchByScope_key = KotlinSearchByScope_key{kotlinSearchByScope_key_name
+                                                       :: Text.Text,
+                                                       kotlinSearchByScope_key_scope :: [Text.Text],
+                                                       kotlinSearchByScope_key_entity ::
+                                                       Glean.Schema.Code.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByScope_key where
+  toJSON
+    (KotlinSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByScope_key where
+  buildStruct _proxy
+    (KotlinSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByScope_key __val__name __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByScope_key where
+  rnf
+    (KotlinSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByScope_key where
+  def = KotlinSearchByScope_key "" Default.def Default.def
+
+instance Hashable.Hashable KotlinSearchByScope_key where
+  hashWithSalt __salt (KotlinSearchByScope_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data KotlinSearchByNameWithFact_key = KotlinSearchByNameWithFact_key{kotlinSearchByNameWithFact_key_name
+                                                                     ::
+                                                                     Glean.Schema.JavakotlinAlpha.QName,
+                                                                     kotlinSearchByNameWithFact_key_entity
+                                                                     :: Glean.Schema.Code.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByNameWithFact_key where
+  toJSON
+    (KotlinSearchByNameWithFact_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByNameWithFact_key where
+  buildStruct _proxy
+    (KotlinSearchByNameWithFact_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByNameWithFact_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByNameWithFact_key where
+  rnf (KotlinSearchByNameWithFact_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByNameWithFact_key where
+  def = KotlinSearchByNameWithFact_key Default.def Default.def
+
+instance Hashable.Hashable KotlinSearchByNameWithFact_key where
+  hashWithSalt __salt (KotlinSearchByNameWithFact_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data KotlinSearchByName_key = KotlinSearchByName_key{kotlinSearchByName_key_name
+                                                     :: Text.Text,
+                                                     kotlinSearchByName_key_entity ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByName_key where
+  toJSON (KotlinSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByName_key where
+  buildStruct _proxy
+    (KotlinSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByName_key where
+  rnf (KotlinSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByName_key where
+  def = KotlinSearchByName_key "" Default.def
+
+instance Hashable.Hashable KotlinSearchByName_key where
+  hashWithSalt __salt (KotlinSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data KotlinSearchByLowerCaseScope_key = KotlinSearchByLowerCaseScope_key{kotlinSearchByLowerCaseScope_key_name
+                                                                         :: Text.Text,
+                                                                         kotlinSearchByLowerCaseScope_key_scope
+                                                                         :: [Text.Text],
+                                                                         kotlinSearchByLowerCaseScope_key_entity
+                                                                         ::
+                                                                         Glean.Schema.Code.Entity}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByLowerCaseScope_key where
+  toJSON
+    (KotlinSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByLowerCaseScope_key where
+  buildStruct _proxy
+    (KotlinSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByLowerCaseScope_key __val__name
+                                                  __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByLowerCaseScope_key where
+  rnf
+    (KotlinSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByLowerCaseScope_key where
+  def = KotlinSearchByLowerCaseScope_key "" Default.def Default.def
+
+instance Hashable.Hashable KotlinSearchByLowerCaseScope_key where
+  hashWithSalt __salt
+    (KotlinSearchByLowerCaseScope_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data KotlinSearchByLowerCaseName_key = KotlinSearchByLowerCaseName_key{kotlinSearchByLowerCaseName_key_name
+                                                                       :: Text.Text,
+                                                                       kotlinSearchByLowerCaseName_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON KotlinSearchByLowerCaseName_key where
+  toJSON
+    (KotlinSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct KotlinSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (KotlinSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (KotlinSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData KotlinSearchByLowerCaseName_key where
+  rnf (KotlinSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default KotlinSearchByLowerCaseName_key where
+  def = KotlinSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable KotlinSearchByLowerCaseName_key where
+  hashWithSalt __salt (KotlinSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data JavaSearchByScopeWithName_key = JavaSearchByScopeWithName_key{javaSearchByScopeWithName_key_name
+                                                                   ::
+                                                                   Glean.Schema.JavakotlinAlpha.Name,
+                                                                   javaSearchByScopeWithName_key_insensitive
+                                                                   :: Prelude.Bool,
+                                                                   javaSearchByScopeWithName_key_scope
+                                                                   :: [Text.Text],
+                                                                   javaSearchByScopeWithName_key_entity
+                                                                   :: Glean.Schema.Code.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByScopeWithName_key where
+  toJSON
+    (JavaSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByScopeWithName_key where
+  buildStruct _proxy
+    (JavaSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__scope)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByScopeWithName_key __val__name
+                                                  __val__insensitive
+                                                  __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("insensitive", 2), ("scope", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByScopeWithName_key where
+  rnf
+    (JavaSearchByScopeWithName_key __field__name __field__insensitive
+       __field__scope __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByScopeWithName_key where
+  def
+    = JavaSearchByScopeWithName_key Default.def Prelude.False
+        Default.def
+        Default.def
+
+instance Hashable.Hashable JavaSearchByScopeWithName_key where
+  hashWithSalt __salt
+    (JavaSearchByScopeWithName_key _name _insensitive _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _insensitive)
+           _scope)
+        _entity
+
+data JavaSearchByScope_key = JavaSearchByScope_key{javaSearchByScope_key_name
+                                                   :: Text.Text,
+                                                   javaSearchByScope_key_scope :: [Text.Text],
+                                                   javaSearchByScope_key_entity ::
+                                                   Glean.Schema.Code.Entity}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByScope_key where
+  toJSON
+    (JavaSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByScope_key where
+  buildStruct _proxy
+    (JavaSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByScope_key __val__name __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByScope_key where
+  rnf
+    (JavaSearchByScope_key __field__name __field__scope
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByScope_key where
+  def = JavaSearchByScope_key "" Default.def Default.def
+
+instance Hashable.Hashable JavaSearchByScope_key where
+  hashWithSalt __salt (JavaSearchByScope_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data JavaSearchByNameWithFact_key = JavaSearchByNameWithFact_key{javaSearchByNameWithFact_key_name
+                                                                 ::
+                                                                 Glean.Schema.JavakotlinAlpha.QName,
+                                                                 javaSearchByNameWithFact_key_entity
+                                                                 :: Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByNameWithFact_key where
+  toJSON (JavaSearchByNameWithFact_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByNameWithFact_key where
+  buildStruct _proxy
+    (JavaSearchByNameWithFact_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByNameWithFact_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByNameWithFact_key where
+  rnf (JavaSearchByNameWithFact_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByNameWithFact_key where
+  def = JavaSearchByNameWithFact_key Default.def Default.def
+
+instance Hashable.Hashable JavaSearchByNameWithFact_key where
+  hashWithSalt __salt (JavaSearchByNameWithFact_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data JavaSearchByName_key = JavaSearchByName_key{javaSearchByName_key_name
+                                                 :: Text.Text,
+                                                 javaSearchByName_key_entity ::
+                                                 Glean.Schema.Code.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByName_key where
+  toJSON (JavaSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByName_key where
+  buildStruct _proxy
+    (JavaSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByName_key where
+  rnf (JavaSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByName_key where
+  def = JavaSearchByName_key "" Default.def
+
+instance Hashable.Hashable JavaSearchByName_key where
+  hashWithSalt __salt (JavaSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data JavaSearchByLowerCaseScope_key = JavaSearchByLowerCaseScope_key{javaSearchByLowerCaseScope_key_name
+                                                                     :: Text.Text,
+                                                                     javaSearchByLowerCaseScope_key_scope
+                                                                     :: [Text.Text],
+                                                                     javaSearchByLowerCaseScope_key_entity
+                                                                     :: Glean.Schema.Code.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByLowerCaseScope_key where
+  toJSON
+    (JavaSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByLowerCaseScope_key where
+  buildStruct _proxy
+    (JavaSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByLowerCaseScope_key __val__name
+                                                  __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByLowerCaseScope_key where
+  rnf
+    (JavaSearchByLowerCaseScope_key __field__name __field__scope
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByLowerCaseScope_key where
+  def = JavaSearchByLowerCaseScope_key "" Default.def Default.def
+
+instance Hashable.Hashable JavaSearchByLowerCaseScope_key where
+  hashWithSalt __salt
+    (JavaSearchByLowerCaseScope_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data JavaSearchByLowerCaseName_key = JavaSearchByLowerCaseName_key{javaSearchByLowerCaseName_key_name
+                                                                   :: Text.Text,
+                                                                   javaSearchByLowerCaseName_key_entity
+                                                                   :: Glean.Schema.Code.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON JavaSearchByLowerCaseName_key where
+  toJSON
+    (JavaSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct JavaSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (JavaSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (JavaSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData JavaSearchByLowerCaseName_key where
+  rnf (JavaSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default JavaSearchByLowerCaseName_key where
+  def = JavaSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable JavaSearchByLowerCaseName_key where
+  hashWithSalt __salt (JavaSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data HsSearchByName_key = HsSearchByName_key{hsSearchByName_key_name
+                                             :: Text.Text,
+                                             hsSearchByName_key_entity :: Glean.Schema.Code.Entity}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HsSearchByName_key where
+  toJSON (HsSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HsSearchByName_key where
+  buildStruct _proxy
+    (HsSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HsSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HsSearchByName_key where
+  rnf (HsSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HsSearchByName_key where
+  def = HsSearchByName_key "" Default.def
+
+instance Hashable.Hashable HsSearchByName_key where
+  hashWithSalt __salt (HsSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data HsSearchByLowerCaseName_key = HsSearchByLowerCaseName_key{hsSearchByLowerCaseName_key_name
+                                                               :: Text.Text,
+                                                               hsSearchByLowerCaseName_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HsSearchByLowerCaseName_key where
+  toJSON (HsSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct HsSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (HsSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HsSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HsSearchByLowerCaseName_key where
+  rnf (HsSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HsSearchByLowerCaseName_key where
+  def = HsSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable HsSearchByLowerCaseName_key where
+  hashWithSalt __salt (HsSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data HackSearchByScopeWithNameKinds_key = HackSearchByScopeWithNameKinds_key{hackSearchByScopeWithNameKinds_key_name
+                                                                             :: Text.Text,
+                                                                             hackSearchByScopeWithNameKinds_key_insensitive
+                                                                             :: Prelude.Bool,
+                                                                             hackSearchByScopeWithNameKinds_key_scope
+                                                                             :: [Text.Text],
+                                                                             hackSearchByScopeWithNameKinds_key_kinds
+                                                                             ::
+                                                                             Prelude.Maybe
+                                                                               Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                             hackSearchByScopeWithNameKinds_key_entity
+                                                                             ::
+                                                                             Glean.Schema.Code.Entity}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByScopeWithNameKinds_key where
+  toJSON
+    (HackSearchByScopeWithNameKinds_key __field__name
+       __field__insensitive __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope :
+               Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                 ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackSearchByScopeWithNameKinds_key
+         where
+  buildStruct _proxy
+    (HackSearchByScopeWithNameKinds_key __field__name
+       __field__insensitive __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 3 2
+               (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                  (Thrift.genText _proxy)
+                  __field__scope)
+               :
+               let (__cereal__kinds, __id__kinds)
+                     = case __field__kinds of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "kinds"
+                                                    (Thrift.getI32Type _proxy)
+                                                    4
+                                                    3
+                                                    ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                        Thrift.fromThriftEnum)
+                                                       _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__kinds
+                   (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5
+                      __id__kinds
+                      (Thrift.buildStruct _proxy __field__entity)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByScopeWithNameKinds_key __val__name
+                                                  __val__insensitive
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("insensitive", 2), ("scope", 3), ("kinds", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByScopeWithNameKinds_key where
+  rnf
+    (HackSearchByScopeWithNameKinds_key __field__name
+       __field__insensitive __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq`
+            DeepSeq.rnf __field__kinds `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByScopeWithNameKinds_key where
+  def
+    = HackSearchByScopeWithNameKinds_key "" Prelude.False Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByScopeWithNameKinds_key where
+  hashWithSalt __salt
+    (HackSearchByScopeWithNameKinds_key _name _insensitive _scope
+       _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _insensitive)
+              _scope)
+           _kinds)
+        _entity
+
+data HackSearchByScopeAndKind_key = HackSearchByScopeAndKind_key{hackSearchByScopeAndKind_key_name
+                                                                 :: Text.Text,
+                                                                 hackSearchByScopeAndKind_key_scope
+                                                                 :: [Text.Text],
+                                                                 hackSearchByScopeAndKind_key_kinds
+                                                                 ::
+                                                                 Prelude.Maybe
+                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                 hackSearchByScopeAndKind_key_entity
+                                                                 :: Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByScopeAndKind_key where
+  toJSON
+    (HackSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackSearchByScopeAndKind_key where
+  buildStruct _proxy
+    (HackSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByScopeAndKind_key where
+  rnf
+    (HackSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByScopeAndKind_key where
+  def
+    = HackSearchByScopeAndKind_key "" Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByScopeAndKind_key where
+  hashWithSalt __salt
+    (HackSearchByScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data HackSearchByNameKindWithQName_key = HackSearchByNameKindWithQName_key{hackSearchByNameKindWithQName_key_name
+                                                                           :: Text.Text,
+                                                                           hackSearchByNameKindWithQName_key_scope
+                                                                           ::
+                                                                           Glean.Schema.Hack.Name,
+                                                                           hackSearchByNameKindWithQName_key_scopeNamespace
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             Glean.Schema.Hack.NamespaceQName,
+                                                                           hackSearchByNameKindWithQName_key_kinds
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                           hackSearchByNameKindWithQName_key_entity
+                                                                           ::
+                                                                           Glean.Schema.Code.Entity}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameKindWithQName_key where
+  toJSON
+    (HackSearchByNameKindWithQName_key __field__name __field__scope
+       __field__scopeNamespace __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("scopeNamespace" .=))
+               __field__scopeNamespace
+               (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                  ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct HackSearchByNameKindWithQName_key
+         where
+  buildStruct _proxy
+    (HackSearchByNameKindWithQName_key __field__name __field__scope
+       __field__scopeNamespace __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             let (__cereal__scopeNamespace, __id__scopeNamespace)
+                   = case __field__scopeNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "scopeNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__scopeNamespace
+                 (let (__cereal__kinds, __id__kinds)
+                        = case __field__kinds of
+                            Prelude.Just _val -> ((:)
+                                                    (Thrift.genField _proxy "kinds"
+                                                       (Thrift.getI32Type _proxy)
+                                                       4
+                                                       __id__scopeNamespace
+                                                       ((Thrift.genI32 _proxy . Prelude.fromIntegral
+                                                           . Thrift.fromThriftEnum)
+                                                          _val)),
+                                                  4)
+                            Prelude.Nothing -> (Prelude.id, __id__scopeNamespace)
+                    in
+                    __cereal__kinds
+                      (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5
+                         __id__kinds
+                         (Thrift.buildStruct _proxy __field__entity)
+                         : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__scopeNamespace <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__scopeNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__scopeNamespace <- ST.readSTRef
+                                                                         __field__scopeNamespace
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByNameKindWithQName_key __val__name
+                                                  __val__scope
+                                                  __val__scopeNamespace
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("scopeNamespace", 3), ("kinds", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameKindWithQName_key where
+  rnf
+    (HackSearchByNameKindWithQName_key __field__name __field__scope
+       __field__scopeNamespace __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__scopeNamespace `Prelude.seq`
+            DeepSeq.rnf __field__kinds `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameKindWithQName_key where
+  def
+    = HackSearchByNameKindWithQName_key "" Default.def Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByNameKindWithQName_key where
+  hashWithSalt __salt
+    (HackSearchByNameKindWithQName_key _name _scope _scopeNamespace
+       _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+              _scopeNamespace)
+           _kinds)
+        _entity
+
+data HackSearchByNameKindWithNamespace_key = HackSearchByNameKindWithNamespace_key{hackSearchByNameKindWithNamespace_key_name
+                                                                                   :: Text.Text,
+                                                                                   hackSearchByNameKindWithNamespace_key_scope
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     Glean.Schema.Hack.NamespaceQName,
+                                                                                   hackSearchByNameKindWithNamespace_key_kinds
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                   hackSearchByNameKindWithNamespace_key_entity
+                                                                                   ::
+                                                                                   Glean.Schema.Code.Entity}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameKindWithNamespace_key where
+  toJSON
+    (HackSearchByNameKindWithNamespace_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("scope" .=)) __field__scope
+             (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct HackSearchByNameKindWithNamespace_key
+         where
+  buildStruct _proxy
+    (HackSearchByNameKindWithNamespace_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__scope, __id__scope)
+                 = case __field__scope of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "scope"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__scope
+               (let (__cereal__kinds, __id__kinds)
+                      = case __field__kinds of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "kinds"
+                                                     (Thrift.getI32Type _proxy)
+                                                     3
+                                                     __id__scope
+                                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                         Thrift.fromThriftEnum)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__scope)
+                  in
+                  __cereal__kinds
+                    (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                       __id__kinds
+                       (Thrift.buildStruct _proxy __field__entity)
+                       : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByNameKindWithNamespace_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameKindWithNamespace_key where
+  rnf
+    (HackSearchByNameKindWithNamespace_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameKindWithNamespace_key
+         where
+  def
+    = HackSearchByNameKindWithNamespace_key "" Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByNameKindWithNamespace_key
+         where
+  hashWithSalt __salt
+    (HackSearchByNameKindWithNamespace_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data HackSearchByNameAndKind_key = HackSearchByNameAndKind_key{hackSearchByNameAndKind_key_name
+                                                               :: Text.Text,
+                                                               hackSearchByNameAndKind_key_kinds ::
+                                                               Prelude.Maybe
+                                                                 Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                               hackSearchByNameAndKind_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByNameAndKind_key where
+  toJSON
+    (HackSearchByNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackSearchByNameAndKind_key where
+  buildStruct _proxy
+    (HackSearchByNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kinds
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByNameAndKind_key __val__name __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("kinds", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByNameAndKind_key where
+  rnf
+    (HackSearchByNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByNameAndKind_key where
+  def = HackSearchByNameAndKind_key "" Prelude.Nothing Default.def
+
+instance Hashable.Hashable HackSearchByNameAndKind_key where
+  hashWithSalt __salt
+    (HackSearchByNameAndKind_key _name _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kinds)
+        _entity
+
+data HackSearchByLowerCaseScopeAndKind_key = HackSearchByLowerCaseScopeAndKind_key{hackSearchByLowerCaseScopeAndKind_key_name
+                                                                                   :: Text.Text,
+                                                                                   hackSearchByLowerCaseScopeAndKind_key_scope
+                                                                                   :: [Text.Text],
+                                                                                   hackSearchByLowerCaseScopeAndKind_key_kinds
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                   hackSearchByLowerCaseScopeAndKind_key_entity
+                                                                                   ::
+                                                                                   Glean.Schema.Code.Entity}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByLowerCaseScopeAndKind_key where
+  toJSON
+    (HackSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackSearchByLowerCaseScopeAndKind_key
+         where
+  buildStruct _proxy
+    (HackSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByLowerCaseScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByLowerCaseScopeAndKind_key where
+  rnf
+    (HackSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByLowerCaseScopeAndKind_key
+         where
+  def
+    = HackSearchByLowerCaseScopeAndKind_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByLowerCaseScopeAndKind_key
+         where
+  hashWithSalt __salt
+    (HackSearchByLowerCaseScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data HackSearchByLowerCaseNameAndKind_key = HackSearchByLowerCaseNameAndKind_key{hackSearchByLowerCaseNameAndKind_key_name
+                                                                                 :: Text.Text,
+                                                                                 hackSearchByLowerCaseNameAndKind_key_kinds
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                 hackSearchByLowerCaseNameAndKind_key_entity
+                                                                                 ::
+                                                                                 Glean.Schema.Code.Entity}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackSearchByLowerCaseNameAndKind_key where
+  toJSON
+    (HackSearchByLowerCaseNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackSearchByLowerCaseNameAndKind_key
+         where
+  buildStruct _proxy
+    (HackSearchByLowerCaseNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                  __id__kinds
+                  (Thrift.buildStruct _proxy __field__entity)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (HackSearchByLowerCaseNameAndKind_key __val__name
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("kinds", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackSearchByLowerCaseNameAndKind_key where
+  rnf
+    (HackSearchByLowerCaseNameAndKind_key __field__name __field__kinds
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default HackSearchByLowerCaseNameAndKind_key where
+  def
+    = HackSearchByLowerCaseNameAndKind_key "" Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable HackSearchByLowerCaseNameAndKind_key
+         where
+  hashWithSalt __salt
+    (HackSearchByLowerCaseNameAndKind_key _name _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _kinds)
+        _entity
+
+data HackNameLowerCase_key = HackNameLowerCase_key{hackNameLowerCase_key_nameLowercase
+                                                   :: Text.Text,
+                                                   hackNameLowerCase_key_kinds ::
+                                                   Prelude.Maybe
+                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                   hackNameLowerCase_key_name :: Text.Text}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackNameLowerCase_key where
+  toJSON
+    (HackNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct HackNameLowerCase_key where
+  buildStruct _proxy
+    (HackNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3
+                  __id__kinds
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (HackNameLowerCase_key __val__nameLowercase
+                                                  __val__kinds
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("nameLowercase", 1), ("kinds", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackNameLowerCase_key where
+  rnf
+    (HackNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default HackNameLowerCase_key where
+  def = HackNameLowerCase_key "" Prelude.Nothing ""
+
+instance Hashable.Hashable HackNameLowerCase_key where
+  hashWithSalt __salt
+    (HackNameLowerCase_key _nameLowercase _kinds _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _nameLowercase)
+           _kinds)
+        _name
+
+data GraphQLSearchByName_key = GraphQLSearchByName_key{graphQLSearchByName_key_name
+                                                       :: Text.Text,
+                                                       graphQLSearchByName_key_entity ::
+                                                       Glean.Schema.Code.Entity}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLSearchByName_key where
+  toJSON (GraphQLSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLSearchByName_key where
+  buildStruct _proxy
+    (GraphQLSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GraphQLSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLSearchByName_key where
+  rnf (GraphQLSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GraphQLSearchByName_key where
+  def = GraphQLSearchByName_key "" Default.def
+
+instance Hashable.Hashable GraphQLSearchByName_key where
+  hashWithSalt __salt (GraphQLSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data GraphQLSearchByLowerCaseName_key = GraphQLSearchByLowerCaseName_key{graphQLSearchByLowerCaseName_key_name
+                                                                         :: Text.Text,
+                                                                         graphQLSearchByLowerCaseName_key_entity
+                                                                         ::
+                                                                         Glean.Schema.Code.Entity}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GraphQLSearchByLowerCaseName_key where
+  toJSON
+    (GraphQLSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct GraphQLSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (GraphQLSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (GraphQLSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData GraphQLSearchByLowerCaseName_key where
+  rnf
+    (GraphQLSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default GraphQLSearchByLowerCaseName_key where
+  def = GraphQLSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable GraphQLSearchByLowerCaseName_key where
+  hashWithSalt __salt
+    (GraphQLSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data FlowSearchByScopeAndKind_key = FlowSearchByScopeAndKind_key{flowSearchByScopeAndKind_key_name
+                                                                 :: Text.Text,
+                                                                 flowSearchByScopeAndKind_key_scope
+                                                                 :: [Text.Text],
+                                                                 flowSearchByScopeAndKind_key_kinds
+                                                                 ::
+                                                                 Prelude.Maybe
+                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                 flowSearchByScopeAndKind_key_entity
+                                                                 :: Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByScopeAndKind_key where
+  toJSON
+    (FlowSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct FlowSearchByScopeAndKind_key where
+  buildStruct _proxy
+    (FlowSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowSearchByScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByScopeAndKind_key where
+  rnf
+    (FlowSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowSearchByScopeAndKind_key where
+  def
+    = FlowSearchByScopeAndKind_key "" Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FlowSearchByScopeAndKind_key where
+  hashWithSalt __salt
+    (FlowSearchByScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data FlowSearchByNameKindAndScopeFact_key = FlowSearchByNameKindAndScopeFact_key{flowSearchByNameKindAndScopeFact_key_name
+                                                                                 :: Text.Text,
+                                                                                 flowSearchByNameKindAndScopeFact_key_scope
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   Glean.Schema.Flow.Module,
+                                                                                 flowSearchByNameKindAndScopeFact_key_kinds
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                 flowSearchByNameKindAndScopeFact_key_entity
+                                                                                 ::
+                                                                                 Glean.Schema.Code.Entity}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByNameKindAndScopeFact_key where
+  toJSON
+    (FlowSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("scope" .=)) __field__scope
+             (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct FlowSearchByNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (FlowSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__scope, __id__scope)
+                 = case __field__scope of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "scope"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__scope
+               (let (__cereal__kinds, __id__kinds)
+                      = case __field__kinds of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "kinds"
+                                                     (Thrift.getI32Type _proxy)
+                                                     3
+                                                     __id__scope
+                                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                         Thrift.fromThriftEnum)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__scope)
+                  in
+                  __cereal__kinds
+                    (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                       __id__kinds
+                       (Thrift.buildStruct _proxy __field__entity)
+                       : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowSearchByNameKindAndScopeFact_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByNameKindAndScopeFact_key where
+  rnf
+    (FlowSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowSearchByNameKindAndScopeFact_key where
+  def
+    = FlowSearchByNameKindAndScopeFact_key "" Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FlowSearchByNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (FlowSearchByNameKindAndScopeFact_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data FlowSearchByLowerCaseScopeAndKind_key = FlowSearchByLowerCaseScopeAndKind_key{flowSearchByLowerCaseScopeAndKind_key_name
+                                                                                   :: Text.Text,
+                                                                                   flowSearchByLowerCaseScopeAndKind_key_scope
+                                                                                   :: [Text.Text],
+                                                                                   flowSearchByLowerCaseScopeAndKind_key_kinds
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                   flowSearchByLowerCaseScopeAndKind_key_entity
+                                                                                   ::
+                                                                                   Glean.Schema.Code.Entity}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByLowerCaseScopeAndKind_key where
+  toJSON
+    (FlowSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct FlowSearchByLowerCaseScopeAndKind_key
+         where
+  buildStruct _proxy
+    (FlowSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowSearchByLowerCaseScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowSearchByLowerCaseScopeAndKind_key where
+  rnf
+    (FlowSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FlowSearchByLowerCaseScopeAndKind_key
+         where
+  def
+    = FlowSearchByLowerCaseScopeAndKind_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable FlowSearchByLowerCaseScopeAndKind_key
+         where
+  hashWithSalt __salt
+    (FlowSearchByLowerCaseScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data FlowSearchByLowerCaseNameKindAndScopeFact_key = FlowSearchByLowerCaseNameKindAndScopeFact_key{flowSearchByLowerCaseNameKindAndScopeFact_key_name
+                                                                                                   ::
+                                                                                                   Text.Text,
+                                                                                                   flowSearchByLowerCaseNameKindAndScopeFact_key_scope
+                                                                                                   ::
+                                                                                                   Prelude.Maybe
+                                                                                                     Glean.Schema.Flow.Module,
+                                                                                                   flowSearchByLowerCaseNameKindAndScopeFact_key_kinds
+                                                                                                   ::
+                                                                                                   Prelude.Maybe
+                                                                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                                   flowSearchByLowerCaseNameKindAndScopeFact_key_entity
+                                                                                                   ::
+                                                                                                   Glean.Schema.Code.Entity}
+                                                     deriving (Prelude.Eq, Prelude.Show,
+                                                               Prelude.Ord)
+
+instance Aeson.ToJSON FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  toJSON
+    (FlowSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("scope" .=)) __field__scope
+             (Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+                ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct
+           FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (FlowSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           let (__cereal__scope, __id__scope)
+                 = case __field__scope of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "scope"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__scope
+               (let (__cereal__kinds, __id__kinds)
+                      = case __field__kinds of
+                          Prelude.Just _val -> ((:)
+                                                  (Thrift.genField _proxy "kinds"
+                                                     (Thrift.getI32Type _proxy)
+                                                     3
+                                                     __id__scope
+                                                     ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                         Thrift.fromThriftEnum)
+                                                        _val)),
+                                                3)
+                          Prelude.Nothing -> (Prelude.id, __id__scope)
+                  in
+                  __cereal__kinds
+                    (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                       __id__kinds
+                       (Thrift.buildStruct _proxy __field__entity)
+                       : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Prelude.Nothing
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FlowSearchByLowerCaseNameKindAndScopeFact_key
+                                                  __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  rnf
+    (FlowSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default
+           FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  def
+    = FlowSearchByLowerCaseNameKindAndScopeFact_key "" Prelude.Nothing
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable
+           FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (FlowSearchByLowerCaseNameKindAndScopeFact_key _name _scope _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data FlowNameLowerCase_key = FlowNameLowerCase_key{flowNameLowerCase_key_nameLowercase
+                                                   :: Text.Text,
+                                                   flowNameLowerCase_key_kinds ::
+                                                   Prelude.Maybe
+                                                     Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                   flowNameLowerCase_key_name :: Text.Text}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FlowNameLowerCase_key where
+  toJSON
+    (FlowNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct FlowNameLowerCase_key where
+  buildStruct _proxy
+    (FlowNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3
+                  __id__kinds
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (FlowNameLowerCase_key __val__nameLowercase
+                                                  __val__kinds
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("nameLowercase", 1), ("kinds", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FlowNameLowerCase_key where
+  rnf
+    (FlowNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FlowNameLowerCase_key where
+  def = FlowNameLowerCase_key "" Prelude.Nothing ""
+
+instance Hashable.Hashable FlowNameLowerCase_key where
+  hashWithSalt __salt
+    (FlowNameLowerCase_key _nameLowercase _kinds _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _nameLowercase)
+           _kinds)
+        _name
+
+data FbthriftSearchByNameFact_key = FbthriftSearchByNameFact_key{fbthriftSearchByNameFact_key_name
+                                                                 ::
+                                                                 Glean.Schema.Fbthrift.Identifier,
+                                                                 fbthriftSearchByNameFact_key_entity
+                                                                 :: Glean.Schema.Code.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FbthriftSearchByNameFact_key where
+  toJSON (FbthriftSearchByNameFact_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct FbthriftSearchByNameFact_key where
+  buildStruct _proxy
+    (FbthriftSearchByNameFact_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (FbthriftSearchByNameFact_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FbthriftSearchByNameFact_key where
+  rnf (FbthriftSearchByNameFact_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default FbthriftSearchByNameFact_key where
+  def = FbthriftSearchByNameFact_key Default.def Default.def
+
+instance Hashable.Hashable FbthriftSearchByNameFact_key where
+  hashWithSalt __salt (FbthriftSearchByNameFact_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data ErlangSearchByName_key = ErlangSearchByName_key{erlangSearchByName_key_name
+                                                     :: Text.Text,
+                                                     erlangSearchByName_key_entity ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangSearchByName_key where
+  toJSON (ErlangSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangSearchByName_key where
+  buildStruct _proxy
+    (ErlangSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ErlangSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangSearchByName_key where
+  rnf (ErlangSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ErlangSearchByName_key where
+  def = ErlangSearchByName_key "" Default.def
+
+instance Hashable.Hashable ErlangSearchByName_key where
+  hashWithSalt __salt (ErlangSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data ErlangSearchByLowerCaseName_key = ErlangSearchByLowerCaseName_key{erlangSearchByLowerCaseName_key_name
+                                                                       :: Text.Text,
+                                                                       erlangSearchByLowerCaseName_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ErlangSearchByLowerCaseName_key where
+  toJSON
+    (ErlangSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct ErlangSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (ErlangSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (ErlangSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ErlangSearchByLowerCaseName_key where
+  rnf (ErlangSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default ErlangSearchByLowerCaseName_key where
+  def = ErlangSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable ErlangSearchByLowerCaseName_key where
+  hashWithSalt __salt (ErlangSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data CxxSearchByScopeAndKind_key = CxxSearchByScopeAndKind_key{cxxSearchByScopeAndKind_key_name
+                                                               :: Text.Text,
+                                                               cxxSearchByScopeAndKind_key_scope ::
+                                                               [Text.Text],
+                                                               cxxSearchByScopeAndKind_key_kinds ::
+                                                               Prelude.Maybe
+                                                                 Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                               cxxSearchByScopeAndKind_key_entity ::
+                                                               Glean.Schema.Code.Entity}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByScopeAndKind_key where
+  toJSON
+    (CxxSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct CxxSearchByScopeAndKind_key where
+  buildStruct _proxy
+    (CxxSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxSearchByScopeAndKind_key __val__name __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByScopeAndKind_key where
+  rnf
+    (CxxSearchByScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxSearchByScopeAndKind_key where
+  def
+    = CxxSearchByScopeAndKind_key "" Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable CxxSearchByScopeAndKind_key where
+  hashWithSalt __salt
+    (CxxSearchByScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data CxxSearchByNameKindAndScopeFact_key = CxxSearchByNameKindAndScopeFact_key{cxxSearchByNameKindAndScopeFact_key_name
+                                                                               :: Text.Text,
+                                                                               cxxSearchByNameKindAndScopeFact_key_scope
+                                                                               ::
+                                                                               Glean.Schema.Cxx1.Scope,
+                                                                               cxxSearchByNameKindAndScopeFact_key_kinds
+                                                                               ::
+                                                                               Prelude.Maybe
+                                                                                 Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                               cxxSearchByNameKindAndScopeFact_key_entity
+                                                                               ::
+                                                                               Glean.Schema.Code.Entity}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByNameKindAndScopeFact_key where
+  toJSON
+    (CxxSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct CxxSearchByNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (CxxSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxSearchByNameKindAndScopeFact_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByNameKindAndScopeFact_key where
+  rnf
+    (CxxSearchByNameKindAndScopeFact_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxSearchByNameKindAndScopeFact_key where
+  def
+    = CxxSearchByNameKindAndScopeFact_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable CxxSearchByNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (CxxSearchByNameKindAndScopeFact_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data CxxSearchByLowerCaseScopeAndKind_key = CxxSearchByLowerCaseScopeAndKind_key{cxxSearchByLowerCaseScopeAndKind_key_name
+                                                                                 :: Text.Text,
+                                                                                 cxxSearchByLowerCaseScopeAndKind_key_scope
+                                                                                 :: [Text.Text],
+                                                                                 cxxSearchByLowerCaseScopeAndKind_key_kinds
+                                                                                 ::
+                                                                                 Prelude.Maybe
+                                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                 cxxSearchByLowerCaseScopeAndKind_key_entity
+                                                                                 ::
+                                                                                 Glean.Schema.Code.Entity}
+                                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByLowerCaseScopeAndKind_key where
+  toJSON
+    (CxxSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct CxxSearchByLowerCaseScopeAndKind_key
+         where
+  buildStruct _proxy
+    (CxxSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getStringType _proxy)
+                (Thrift.genText _proxy)
+                __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxSearchByLowerCaseScopeAndKind_key __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxSearchByLowerCaseScopeAndKind_key where
+  rnf
+    (CxxSearchByLowerCaseScopeAndKind_key __field__name __field__scope
+       __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CxxSearchByLowerCaseScopeAndKind_key where
+  def
+    = CxxSearchByLowerCaseScopeAndKind_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable CxxSearchByLowerCaseScopeAndKind_key
+         where
+  hashWithSalt __salt
+    (CxxSearchByLowerCaseScopeAndKind_key _name _scope _kinds _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data CxxSearchByLowerCaseNameKindAndScopeFact_key = CxxSearchByLowerCaseNameKindAndScopeFact_key{cxxSearchByLowerCaseNameKindAndScopeFact_key_name
+                                                                                                 ::
+                                                                                                 Text.Text,
+                                                                                                 cxxSearchByLowerCaseNameKindAndScopeFact_key_scope
+                                                                                                 ::
+                                                                                                 Glean.Schema.Cxx1.Scope,
+                                                                                                 cxxSearchByLowerCaseNameKindAndScopeFact_key_kinds
+                                                                                                 ::
+                                                                                                 Prelude.Maybe
+                                                                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                                                                 cxxSearchByLowerCaseNameKindAndScopeFact_key_entity
+                                                                                                 ::
+                                                                                                 Glean.Schema.Code.Entity}
+                                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  toJSON
+    (CxxSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+               ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct
+           CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildStruct _proxy
+    (CxxSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             let (__cereal__kinds, __id__kinds)
+                   = case __field__kinds of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "kinds"
+                                                  (Thrift.getI32Type _proxy)
+                                                  3
+                                                  2
+                                                  ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                      Thrift.fromThriftEnum)
+                                                     _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__kinds
+                 (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4
+                    __id__kinds
+                    (Thrift.buildStruct _proxy __field__entity)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__scope <- ST.newSTRef Default.def
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CxxSearchByLowerCaseNameKindAndScopeFact_key
+                                                  __val__name
+                                                  __val__scope
+                                                  __val__kinds
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("kinds", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  rnf
+    (CxxSearchByLowerCaseNameKindAndScopeFact_key __field__name
+       __field__scope __field__kinds __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__kinds `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default
+           CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  def
+    = CxxSearchByLowerCaseNameKindAndScopeFact_key "" Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable
+           CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  hashWithSalt __salt
+    (CxxSearchByLowerCaseNameKindAndScopeFact_key _name _scope _kinds
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _kinds)
+        _entity
+
+data CxxPreferDefinitions_key = CxxPreferDefinitions_key{cxxPreferDefinitions_key_from
+                                                         :: Glean.Schema.CodeCxx.Entity,
+                                                         cxxPreferDefinitions_key_to ::
+                                                         Glean.Schema.CodeCxx.Entity}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxPreferDefinitions_key where
+  toJSON (CxxPreferDefinitions_key __field__from __field__to)
+    = Aeson.object
+        ("from" .= __field__from : "to" .= __field__to : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxPreferDefinitions_key where
+  buildStruct _proxy
+    (CxxPreferDefinitions_key __field__from __field__to)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "from" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__from)
+           :
+           Thrift.genField _proxy "to" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__to)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__from <- ST.newSTRef Default.def
+            __field__to <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__from
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__to
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__from <- ST.readSTRef __field__from
+                                             !__val__to <- ST.readSTRef __field__to
+                                             Prelude.pure
+                                               (CxxPreferDefinitions_key __val__from __val__to)
+              _idMap = HashMap.fromList [("from", 1), ("to", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxPreferDefinitions_key where
+  rnf (CxxPreferDefinitions_key __field__from __field__to)
+    = DeepSeq.rnf __field__from `Prelude.seq`
+        DeepSeq.rnf __field__to `Prelude.seq` ()
+
+instance Default.Default CxxPreferDefinitions_key where
+  def = CxxPreferDefinitions_key Default.def Default.def
+
+instance Hashable.Hashable CxxPreferDefinitions_key where
+  hashWithSalt __salt (CxxPreferDefinitions_key _from _to)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _from) _to
+
+data CxxNameLowerCase_key = CxxNameLowerCase_key{cxxNameLowerCase_key_nameLowercase
+                                                 :: Text.Text,
+                                                 cxxNameLowerCase_key_kinds ::
+                                                 Prelude.Maybe
+                                                   Glean.Schema.CodemarkupTypes.SymbolKind,
+                                                 cxxNameLowerCase_key_name :: Text.Text}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNameLowerCase_key where
+  toJSON
+    (CxxNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Aeson.object
+        ("nameLowercase" .= __field__nameLowercase :
+           Prelude.maybe Prelude.id ((:) . ("kinds" .=)) __field__kinds
+             ("name" .= __field__name : Prelude.mempty))
+
+instance Thrift.ThriftStruct CxxNameLowerCase_key where
+  buildStruct _proxy
+    (CxxNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "nameLowercase"
+           (Thrift.getStringType _proxy)
+           1
+           0
+           (Thrift.genText _proxy __field__nameLowercase)
+           :
+           let (__cereal__kinds, __id__kinds)
+                 = case __field__kinds of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "kinds"
+                                                (Thrift.getI32Type _proxy)
+                                                2
+                                                1
+                                                ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                                                    Thrift.fromThriftEnum)
+                                                   _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__kinds
+               (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 3
+                  __id__kinds
+                  (Thrift.genText _proxy __field__name)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__nameLowercase <- ST.newSTRef ""
+            __field__kinds <- ST.newSTRef Prelude.Nothing
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__nameLowercase
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "SymbolKind")
+                                                                        ST.writeSTRef __field__kinds
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__nameLowercase <- ST.readSTRef
+                                                                        __field__nameLowercase
+                                             !__val__kinds <- ST.readSTRef __field__kinds
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (CxxNameLowerCase_key __val__nameLowercase
+                                                  __val__kinds
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("nameLowercase", 1), ("kinds", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNameLowerCase_key where
+  rnf
+    (CxxNameLowerCase_key __field__nameLowercase __field__kinds
+       __field__name)
+    = DeepSeq.rnf __field__nameLowercase `Prelude.seq`
+        DeepSeq.rnf __field__kinds `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default CxxNameLowerCase_key where
+  def = CxxNameLowerCase_key "" Prelude.Nothing ""
+
+instance Hashable.Hashable CxxNameLowerCase_key where
+  hashWithSalt __salt
+    (CxxNameLowerCase_key _nameLowercase _kinds _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt __salt _nameLowercase)
+           _kinds)
+        _name
+
+data CSharpSearchByName_key = CSharpSearchByName_key{cSharpSearchByName_key_name
+                                                     :: Text.Text,
+                                                     cSharpSearchByName_key_entity ::
+                                                     Glean.Schema.Code.Entity}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpSearchByName_key where
+  toJSON (CSharpSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpSearchByName_key where
+  buildStruct _proxy
+    (CSharpSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CSharpSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpSearchByName_key where
+  rnf (CSharpSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CSharpSearchByName_key where
+  def = CSharpSearchByName_key "" Default.def
+
+instance Hashable.Hashable CSharpSearchByName_key where
+  hashWithSalt __salt (CSharpSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data CSharpSearchByLowerCaseName_key = CSharpSearchByLowerCaseName_key{cSharpSearchByLowerCaseName_key_name
+                                                                       :: Text.Text,
+                                                                       cSharpSearchByLowerCaseName_key_entity
+                                                                       :: Glean.Schema.Code.Entity}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CSharpSearchByLowerCaseName_key where
+  toJSON
+    (CSharpSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct CSharpSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (CSharpSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (CSharpSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CSharpSearchByLowerCaseName_key where
+  rnf (CSharpSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default CSharpSearchByLowerCaseName_key where
+  def = CSharpSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable CSharpSearchByLowerCaseName_key where
+  hashWithSalt __salt (CSharpSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data BuckSearchByName_key = BuckSearchByName_key{buckSearchByName_key_name
+                                                 :: Text.Text,
+                                                 buckSearchByName_key_entity ::
+                                                 Glean.Schema.Code.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByName_key where
+  toJSON (BuckSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByName_key where
+  buildStruct _proxy
+    (BuckSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (BuckSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByName_key where
+  rnf (BuckSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default BuckSearchByName_key where
+  def = BuckSearchByName_key "" Default.def
+
+instance Hashable.Hashable BuckSearchByName_key where
+  hashWithSalt __salt (BuckSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data BuckSearchByLowerCaseName_key = BuckSearchByLowerCaseName_key{buckSearchByLowerCaseName_key_name
+                                                                   :: Text.Text,
+                                                                   buckSearchByLowerCaseName_key_entity
+                                                                   :: Glean.Schema.Code.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByLowerCaseName_key where
+  toJSON
+    (BuckSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (BuckSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (BuckSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByLowerCaseName_key where
+  rnf (BuckSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default BuckSearchByLowerCaseName_key where
+  def = BuckSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable BuckSearchByLowerCaseName_key where
+  hashWithSalt __salt (BuckSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data BuckSearchByLocalNameFact_key = BuckSearchByLocalNameFact_key{buckSearchByLocalNameFact_key_name
+                                                                   :: Glean.Schema.Buck.LocalName,
+                                                                   buckSearchByLocalNameFact_key_entity
+                                                                   :: Glean.Schema.Code.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BuckSearchByLocalNameFact_key where
+  toJSON
+    (BuckSearchByLocalNameFact_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct BuckSearchByLocalNameFact_key where
+  buildStruct _proxy
+    (BuckSearchByLocalNameFact_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (BuckSearchByLocalNameFact_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData BuckSearchByLocalNameFact_key where
+  rnf (BuckSearchByLocalNameFact_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default BuckSearchByLocalNameFact_key where
+  def = BuckSearchByLocalNameFact_key Default.def Default.def
+
+instance Hashable.Hashable BuckSearchByLocalNameFact_key where
+  hashWithSalt __salt (BuckSearchByLocalNameFact_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data AngleSearchByName_key = AngleSearchByName_key{angleSearchByName_key_name
+                                                   :: Text.Text,
+                                                   angleSearchByName_key_entity ::
+                                                   Glean.Schema.Code.Entity}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleSearchByName_key where
+  toJSON (AngleSearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleSearchByName_key where
+  buildStruct _proxy
+    (AngleSearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (AngleSearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleSearchByName_key where
+  rnf (AngleSearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default AngleSearchByName_key where
+  def = AngleSearchByName_key "" Default.def
+
+instance Hashable.Hashable AngleSearchByName_key where
+  hashWithSalt __salt (AngleSearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data AngleSearchByLowerCaseName_key = AngleSearchByLowerCaseName_key{angleSearchByLowerCaseName_key_name
+                                                                     :: Text.Text,
+                                                                     angleSearchByLowerCaseName_key_entity
+                                                                     :: Glean.Schema.Code.Entity}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AngleSearchByLowerCaseName_key where
+  toJSON
+    (AngleSearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct AngleSearchByLowerCaseName_key where
+  buildStruct _proxy
+    (AngleSearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (AngleSearchByLowerCaseName_key __val__name
+                                                  __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData AngleSearchByLowerCaseName_key where
+  rnf (AngleSearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default AngleSearchByLowerCaseName_key where
+  def = AngleSearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable AngleSearchByLowerCaseName_key where
+  hashWithSalt __salt (AngleSearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+{-# LINE 27 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.BuckSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.BuckSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.BuckSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.BuckSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 36 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.BuckSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 38 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.BuckSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.BuckSearchByName =
+       Glean.Schema.SearchCode.Types.BuckSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.BuckSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.buckSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.BuckSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.buckSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 47 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.BuckSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 53 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.BuckSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 62 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 64 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.BuckSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.buckSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.buckSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 74 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.BuckSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 80 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.HackSearchByNameKindWithNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 93 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 95 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace
+       =
+       Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.HackSearchByNameKindWithNamespace"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByNameKindWithNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByNameKindWithNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 105 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 111 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxNameLowerCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CxxNameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 122 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxNameLowerCase_key
+     =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 124 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxNameLowerCase
+         where
+  type KeyType Glean.Schema.SearchCode.Types.CxxNameLowerCase =
+       Glean.Schema.SearchCode.Types.CxxNameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CxxNameLowerCase" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.cxxNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxNameLowerCase x k
+  getFactKey = Glean.Schema.SearchCode.Types.cxxNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 133 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.CxxNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 139 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByScope_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByScope_key"
+           (Prelude.Just 0))
+{-# LINE 150 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 152 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByScope
+         where
+  type KeyType Glean.Schema.SearchCode.Types.JavaSearchByScope =
+       Glean.Schema.SearchCode.Types.JavaSearchByScope_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.javaSearchByScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByScope x k
+  getFactKey = Glean.Schema.SearchCode.Types.javaSearchByScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 161 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.JavaSearchByScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 167 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByNameWithFact_key"
+           (Prelude.Just 0))
+{-# LINE 176 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 178 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact
+       = Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByNameWithFact" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.kotlinSearchByNameWithFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.kotlinSearchByNameWithFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 188 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByNameWithFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 194 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 203 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 205 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.kotlinSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.kotlinSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 215 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 221 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.PythonSearchByLowerCaseScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 234 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 236 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind
+       =
+       Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.PythonSearchByLowerCaseScopeAndKind"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.pythonSearchByLowerCaseScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.pythonSearchByLowerCaseScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 246 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 252 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName_key x1
+       x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByScopeWithName_key"
+           (Prelude.Just 0))
+{-# LINE 265 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope" ([Data.Text.Text])
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 267 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName
+       = Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByScopeWithName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.kotlinSearchByScopeWithName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.kotlinSearchByScopeWithName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 277 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByScopeWithName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 283 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.BuckSearchByLocalNameFact_key"
+           (Prelude.Just 0))
+{-# LINE 292 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Buck.Types.LocalName)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 294 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact
+       = Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.BuckSearchByLocalNameFact" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.buckSearchByLocalNameFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.buckSearchByLocalNameFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 304 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.BuckSearchByLocalNameFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 310 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind_key x1
+       x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByLowerCaseScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 325 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+             ('Angle.TField "kinds"
+                (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                   ('Angle.TNoFields)))))
+{-# LINE 327 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind
+       = Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByLowerCaseScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.searchByLowerCaseScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByLowerCaseScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 337 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 343 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName_key x1
+       x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackSearchByNameKindWithQName_key"
+           (Prelude.Just 0))
+{-# LINE 358 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "scopeNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "kinds"
+                (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                   ('Angle.TNoFields)))))
+{-# LINE 360 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName
+       = Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackSearchByNameKindWithQName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByNameKindWithQName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByNameKindWithQName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 370 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameKindWithQName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 376 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.FlowSearchByLowerCaseScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 389 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 391 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind
+       =
+       Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.FlowSearchByLowerCaseScopeAndKind"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.flowSearchByLowerCaseScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.flowSearchByLowerCaseScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 401 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 407 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.PythonSearchByScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 420 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 422 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind
+       = Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.PythonSearchByScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.pythonSearchByScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.pythonSearchByScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 432 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 438 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HsSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 447 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 449 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HsSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hsSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hsSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 458 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HsSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 464 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxPreferDefinitions_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxPreferDefinitions_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxPreferDefinitions_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CxxPreferDefinitions_key"
+           (Prelude.Just 0))
+{-# LINE 473 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxPreferDefinitions_key
+     =
+     'Angle.TField "from" (Glean.Schema.CodeCxx.Types.Entity)
+       ('Angle.TField "to" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 475 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxPreferDefinitions
+         where
+  type KeyType Glean.Schema.SearchCode.Types.CxxPreferDefinitions =
+       Glean.Schema.SearchCode.Types.CxxPreferDefinitions_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CxxPreferDefinitions" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.cxxPreferDefinitions_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxPreferDefinitions x k
+  getFactKey = Glean.Schema.SearchCode.Types.cxxPreferDefinitions_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 484 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxPreferDefinitions
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 490 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByScope_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByScope_key"
+           (Prelude.Just 0))
+{-# LINE 501 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 503 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByScope
+         where
+  type KeyType Glean.Schema.SearchCode.Types.KotlinSearchByScope =
+       Glean.Schema.SearchCode.Types.KotlinSearchByScope_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.kotlinSearchByScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByScope x k
+  getFactKey = Glean.Schema.SearchCode.Types.kotlinSearchByScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 512 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 518 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.AngleSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.AngleSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.AngleSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.AngleSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 527 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.AngleSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 529 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.AngleSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.AngleSearchByName =
+       Glean.Schema.SearchCode.Types.AngleSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.AngleSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.angleSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.AngleSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.angleSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 538 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.AngleSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 544 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.SearchByScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByScope_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByScope_key" (Prelude.Just 0))
+{-# LINE 557 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchCode.Types.SearchByScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 559 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByScope
+         where
+  type KeyType Glean.Schema.SearchCode.Types.SearchByScope =
+       Glean.Schema.SearchCode.Types.SearchByScope_key
+  getName _proxy = Glean.PredicateRef "search.code.SearchByScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.searchByScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByScope x k
+  getFactKey = Glean.Schema.SearchCode.Types.searchByScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 568 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.SearchByScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 574 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CxxSearchByScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 587 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 589 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind
+       = Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CxxSearchByScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.cxxSearchByScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.cxxSearchByScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 598 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 604 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CSharpSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 613 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 615 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CSharpSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.cSharpSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.cSharpSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 625 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CSharpSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 631 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.LsifSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.LsifSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.LsifSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.LsifSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 640 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.LsifSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 642 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.LsifSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.LsifSearchByName =
+       Glean.Schema.SearchCode.Types.LsifSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.LsifSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.lsifSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.LsifSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.lsifSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 651 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.LsifSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 657 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackNameLowerCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackNameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 668 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackNameLowerCase_key
+     =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 670 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackNameLowerCase
+         where
+  type KeyType Glean.Schema.SearchCode.Types.HackNameLowerCase =
+       Glean.Schema.SearchCode.Types.HackNameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackNameLowerCase" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.hackNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackNameLowerCase x k
+  getFactKey = Glean.Schema.SearchCode.Types.hackNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 679 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.HackNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 685 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.FlowSearchByScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 698 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 700 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind
+       = Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.FlowSearchByScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.flowSearchByScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.flowSearchByScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 710 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 716 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CSharpSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CSharpSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CSharpSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CSharpSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 725 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CSharpSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 727 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CSharpSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.CSharpSearchByName =
+       Glean.Schema.SearchCode.Types.CSharpSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CSharpSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.cSharpSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CSharpSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.cSharpSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 736 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CSharpSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 742 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ThriftSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.ThriftSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.ThriftSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.ThriftSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 751 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.ThriftSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 753 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.ThriftSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.ThriftSearchByName =
+       Glean.Schema.SearchCode.Types.ThriftSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.ThriftSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.thriftSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.ThriftSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.thriftSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 762 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ThriftSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 768 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByScopeWithName_key"
+           (Prelude.Just 0))
+{-# LINE 781 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.Name)
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope" ([Data.Text.Text])
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 783 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName
+       = Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByScopeWithName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.javaSearchByScopeWithName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.javaSearchByScopeWithName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 793 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByScopeWithName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 799 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.CxxSearchByLowerCaseNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 812 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 814 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact
+       =
+       Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.CxxSearchByLowerCaseNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.cxxSearchByLowerCaseNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.cxxSearchByLowerCaseNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 824 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 830 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByNameAndKind_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByNameAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackSearchByNameAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 841 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByNameAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 843 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByNameAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.HackSearchByNameAndKind
+       = Glean.Schema.SearchCode.Types.HackSearchByNameAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackSearchByNameAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByNameAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByNameAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByNameAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 852 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByNameAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 858 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.FbthriftSearchByNameFact_key"
+           (Prelude.Just 0))
+{-# LINE 867 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Fbthrift.Types.Identifier)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 869 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact
+         where
+  type KeyType Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact
+       = Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.FbthriftSearchByNameFact" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.fbthriftSearchByNameFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.fbthriftSearchByNameFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 879 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FbthriftSearchByNameFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 885 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ErlangSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.ErlangSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.ErlangSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.ErlangSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 894 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.ErlangSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 896 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.ErlangSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.ErlangSearchByName =
+       Glean.Schema.SearchCode.Types.ErlangSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.ErlangSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.erlangSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.ErlangSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.erlangSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 905 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ErlangSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 911 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage_key x1
+       x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByNameKindAndLanguage_key"
+           (Prelude.Just 0))
+{-# LINE 924 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 926 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage
+       = Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByNameKindAndLanguage" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.searchByNameKindAndLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByNameKindAndLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 936 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByNameKindAndLanguage
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 942 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackSearchByScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 955 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 957 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind
+       = Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackSearchByScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 967 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 973 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CxxSearchByLowerCaseScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 986 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 988 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind
+       =
+       Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CxxSearchByLowerCaseScopeAndKind"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.cxxSearchByLowerCaseScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.cxxSearchByLowerCaseScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 998 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByLowerCaseScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1004 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.PpSearchByLowerCaseNameKind_key"
+           (Prelude.Just 0))
+{-# LINE 1015 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1017 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind
+       = Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.PpSearchByLowerCaseNameKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.ppSearchByLowerCaseNameKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.ppSearchByLowerCaseNameKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1027 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PpSearchByLowerCaseNameKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1033 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByLowerCaseNameAndLanguage_key"
+           (Prelude.Just 0))
+{-# LINE 1044 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1046 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage
+       =
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByLowerCaseNameAndLanguage"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.searchByLowerCaseNameAndLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByLowerCaseNameAndLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1056 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameAndLanguage
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1062 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 1071 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1073 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.KotlinSearchByName =
+       Glean.Schema.SearchCode.Types.KotlinSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.kotlinSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.kotlinSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1082 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1088 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.AngleSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1097 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1099 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.AngleSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.angleSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.angleSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1109 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.AngleSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1115 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.KotlinSearchByLowerCaseScope_key"
+           (Prelude.Just 0))
+{-# LINE 1126 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1128 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope
+       = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.KotlinSearchByLowerCaseScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.kotlinSearchByLowerCaseScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.kotlinSearchByLowerCaseScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1138 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.KotlinSearchByLowerCaseScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1144 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1153 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1155 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.javaSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.javaSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1165 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1171 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.LsifSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1180 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1182 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.LsifSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.lsifSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.lsifSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1192 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.LsifSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1198 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByScopeAndKind_key x1 x2 x3 x4
+       x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByScopeAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 1213 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+             ('Angle.TField "kinds"
+                (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                   ('Angle.TNoFields)))))
+{-# LINE 1215 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByScopeAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.SearchByScopeAndKind =
+       Glean.Schema.SearchCode.Types.SearchByScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByScopeAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.searchByScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByScopeAndKind x k
+  getFactKey = Glean.Schema.SearchCode.Types.searchByScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1224 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1230 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.SearchByLowerCaseNameKindAndLanguage_key"
+           (Prelude.Just 0))
+{-# LINE 1243 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1245 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage
+       =
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.SearchByLowerCaseNameKindAndLanguage"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.searchByLowerCaseNameKindAndLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByLowerCaseNameKindAndLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1255 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseNameKindAndLanguage
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1261 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FlowNameLowerCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FlowNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.FlowNameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 1272 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FlowNameLowerCase_key
+     =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 1274 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FlowNameLowerCase
+         where
+  type KeyType Glean.Schema.SearchCode.Types.FlowNameLowerCase =
+       Glean.Schema.SearchCode.Types.FlowNameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.FlowNameLowerCase" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.flowNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FlowNameLowerCase x k
+  getFactKey = Glean.Schema.SearchCode.Types.flowNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1283 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.FlowNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1289 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds_key
+       x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackSearchByScopeWithNameKinds_key"
+           (Prelude.Just 0))
+{-# LINE 1304 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope" ([Data.Text.Text])
+             ('Angle.TField "kinds"
+                (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+                ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                   ('Angle.TNoFields)))))
+{-# LINE 1306 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds
+       = Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackSearchByScopeWithNameKinds"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByScopeWithNameKinds_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByScopeWithNameKinds_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1316 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByScopeWithNameKinds
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1322 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HsSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HsSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HsSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HsSearchByName_key" (Prelude.Just 0))
+{-# LINE 1331 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchCode.Types.HsSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1333 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HsSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.HsSearchByName =
+       Glean.Schema.SearchCode.Types.HsSearchByName_key
+  getName _proxy = Glean.PredicateRef "search.code.HsSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.hsSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HsSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.hsSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1342 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.HsSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1348 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.HackSearchByLowerCaseScopeAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 1361 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1363 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind
+       =
+       Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.HackSearchByLowerCaseScopeAndKind"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByLowerCaseScopeAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByLowerCaseScopeAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1373 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseScopeAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1379 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByNameAndLanguage_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByNameAndLanguage_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByNameAndLanguage_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByNameAndLanguage_key"
+           (Prelude.Just 0))
+{-# LINE 1390 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByNameAndLanguage_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1392 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByNameAndLanguage
+         where
+  type KeyType Glean.Schema.SearchCode.Types.SearchByNameAndLanguage
+       = Glean.Schema.SearchCode.Types.SearchByNameAndLanguage_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByNameAndLanguage" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.searchByNameAndLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByNameAndLanguage x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByNameAndLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1401 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByNameAndLanguage
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1407 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.FlowSearchByNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 1420 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope"
+          (Prelude.Maybe Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1422 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact
+       =
+       Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.FlowSearchByNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.flowSearchByNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.flowSearchByNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1432 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1438 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.PythonSearchByLowerCaseNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 1451 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1453 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact
+       =
+       Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.PythonSearchByLowerCaseNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.pythonSearchByLowerCaseNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.pythonSearchByLowerCaseNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1463 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1469 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.CxxSearchByNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 1482 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1484 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact
+       = Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.CxxSearchByNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.cxxSearchByNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.cxxSearchByNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1494 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.CxxSearchByNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1500 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.FlowSearchByLowerCaseNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 1513 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope"
+          (Prelude.Maybe Glean.Schema.Flow.Types.Module)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1515 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact
+       =
+       Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.FlowSearchByLowerCaseNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.flowSearchByLowerCaseNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.flowSearchByLowerCaseNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1525 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.FlowSearchByLowerCaseNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1531 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.RustSearchByNameAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.RustSearchByNameAndKind_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.RustSearchByNameAndKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.RustSearchByNameAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 1542 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.RustSearchByNameAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kind"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1544 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.RustSearchByNameAndKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.RustSearchByNameAndKind
+       = Glean.Schema.SearchCode.Types.RustSearchByNameAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.RustSearchByNameAndKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.rustSearchByNameAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.RustSearchByNameAndKind x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.rustSearchByNameAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1553 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.RustSearchByNameAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1559 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonNameLowerCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PythonNameLowerCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PythonNameLowerCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.PythonNameLowerCase_key"
+           (Prelude.Just 0))
+{-# LINE 1570 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PythonNameLowerCase_key
+     =
+     'Angle.TField "nameLowercase" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "name" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 1572 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PythonNameLowerCase
+         where
+  type KeyType Glean.Schema.SearchCode.Types.PythonNameLowerCase =
+       Glean.Schema.SearchCode.Types.PythonNameLowerCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.PythonNameLowerCase" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.pythonNameLowerCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PythonNameLowerCase x k
+  getFactKey = Glean.Schema.SearchCode.Types.pythonNameLowerCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1581 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonNameLowerCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1587 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByNameWithFact_key"
+           (Prelude.Just 0))
+{-# LINE 1596 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1598 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact
+         where
+  type KeyType Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact
+       = Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByNameWithFact" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.javaSearchByNameWithFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.javaSearchByNameWithFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1608 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByNameWithFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1614 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByLowerCaseScope_key"
+           (Prelude.Just 0))
+{-# LINE 1625 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1627 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope
+       = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByLowerCaseScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.javaSearchByLowerCaseScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.javaSearchByLowerCaseScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1637 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByLowerCaseScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1643 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScope_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.SearchByLowerCaseScope_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseScope_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.SearchByLowerCaseScope_key"
+           (Prelude.Just 0))
+{-# LINE 1656 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseScope_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope" ([Data.Text.Text])
+          ('Angle.TField "language" (Glean.Schema.Code.Types.Language)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1658 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScope
+         where
+  type KeyType Glean.Schema.SearchCode.Types.SearchByLowerCaseScope =
+       Glean.Schema.SearchCode.Types.SearchByLowerCaseScope_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.SearchByLowerCaseScope" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.searchByLowerCaseScope_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.SearchByLowerCaseScope x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.searchByLowerCaseScope_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1667 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.SearchByLowerCaseScope
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1673 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind_key
+       x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.HackSearchByLowerCaseNameAndKind_key"
+           (Prelude.Just 0))
+{-# LINE 1684 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1686 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind
+       =
+       Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.HackSearchByLowerCaseNameAndKind"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.hackSearchByLowerCaseNameAndKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.hackSearchByLowerCaseNameAndKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1696 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.HackSearchByLowerCaseNameAndKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1702 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PpSearchByNameKind_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PpSearchByNameKind_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PpSearchByNameKind_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.PpSearchByNameKind_key"
+           (Prelude.Just 0))
+{-# LINE 1713 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PpSearchByNameKind_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "kinds"
+          (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+          ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 1715 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PpSearchByNameKind
+         where
+  type KeyType Glean.Schema.SearchCode.Types.PpSearchByNameKind =
+       Glean.Schema.SearchCode.Types.PpSearchByNameKind_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.PpSearchByNameKind" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.ppSearchByNameKind_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PpSearchByNameKind x k
+  getFactKey = Glean.Schema.SearchCode.Types.ppSearchByNameKind_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1724 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PpSearchByNameKind
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1730 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.JavaSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.JavaSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.JavaSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.JavaSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 1739 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.JavaSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1741 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.JavaSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.JavaSearchByName =
+       Glean.Schema.SearchCode.Types.JavaSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.JavaSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.javaSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.JavaSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.javaSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1750 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCode.Types.JavaSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1756 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.ThriftSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1765 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1767 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.ThriftSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.thriftSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.thriftSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1777 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ThriftSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1783 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.GraphQLSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1792 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1794 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.GraphQLSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.graphQLSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.graphQLSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1804 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.GraphQLSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1810 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.ErlangSearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 1819 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1821 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName
+       = Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.ErlangSearchByLowerCaseName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.erlangSearchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName x k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.erlangSearchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1831 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.ErlangSearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1837 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.code.PythonSearchByNameKindAndScopeFact_key"
+           (Prelude.Just 0))
+{-# LINE 1850 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "scope"
+          (Prelude.Maybe Glean.Schema.Python.Types.SName)
+          ('Angle.TField "kinds"
+             (Prelude.Maybe Glean.Schema.CodemarkupTypes.Types.SymbolKind)
+             ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 1852 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact
+         where
+  type KeyType
+         Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact
+       =
+       Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.code.PythonSearchByNameKindAndScopeFact"
+        16
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchCode.Types.pythonSearchByNameKindAndScopeFact_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact
+        x
+        k
+  getFactKey
+    = Glean.Schema.SearchCode.Types.pythonSearchByNameKindAndScopeFact_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1862 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.PythonSearchByNameKindAndScopeFact
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 1868 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.GraphQLSearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCode.Types.GraphQLSearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCode.Types.GraphQLSearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.code.GraphQLSearchByName_key"
+           (Prelude.Just 0))
+{-# LINE 1877 "glean/schema/thrift/search_code_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCode.Types.GraphQLSearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.Code.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 1879 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCode.Types.GraphQLSearchByName
+         where
+  type KeyType Glean.Schema.SearchCode.Types.GraphQLSearchByName =
+       Glean.Schema.SearchCode.Types.GraphQLSearchByName_key
+  getName _proxy
+    = Glean.PredicateRef "search.code.GraphQLSearchByName" 16
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCode.Types.graphQLSearchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCode.Types.GraphQLSearchByName x k
+  getFactKey = Glean.Schema.SearchCode.Types.graphQLSearchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 1888 "glean/schema/thrift/search_code_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCode.Types.GraphQLSearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCxx/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCxx/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCxx/Types.hs
@@ -0,0 +1,1454 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_cxx_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_cxx_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_cxx_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCxx/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchCxx.Types
+       (pREDICATE_VERSIONS, QueryToScopeCase_id,
+        QueryToScopeCase(QueryToScopeCase, queryToScopeCase_id,
+                         queryToScopeCase_key),
+        QueryToQNameCase_id,
+        QueryToQNameCase(QueryToQNameCase, queryToQNameCase_id,
+                         queryToQNameCase_key),
+        QueryToNSQNameCase_id,
+        QueryToNSQNameCase(QueryToNSQNameCase, queryToNSQNameCase_id,
+                           queryToNSQNameCase_key),
+        DeclIsDefn_id,
+        DeclIsDefn(DeclIsDefn, declIsDefn_id, declIsDefn_key),
+        CxxRecordCase_id,
+        CxxRecordCase(CxxRecordCase, cxxRecordCase_id, cxxRecordCase_key),
+        CxxNamespaceCase_id,
+        CxxNamespaceCase(CxxNamespaceCase, cxxNamespaceCase_id,
+                         cxxNamespaceCase_key),
+        QueryToScopeCase_key(QueryToScopeCase_key,
+                             queryToScopeCase_key_query, queryToScopeCase_key_insensitive,
+                             queryToScopeCase_key_scope),
+        QueryToQNameCase_key(QueryToQNameCase_key,
+                             queryToQNameCase_key_query, queryToQNameCase_key_insensitive,
+                             queryToQNameCase_key_scope),
+        QueryToNSQNameCase_key(QueryToNSQNameCase_key,
+                               queryToNSQNameCase_key_query, queryToNSQNameCase_key_insensitive,
+                               queryToNSQNameCase_key_scope),
+        DeclIsDefn_key(DeclIsDefn_key, declIsDefn_key_decl,
+                       declIsDefn_key_defn),
+        CxxRecordCase_key(CxxRecordCase_key, cxxRecordCase_key_insensitive,
+                          cxxRecordCase_key_namestr, cxxRecordCase_key_name),
+        CxxNamespaceCase_key(CxxNamespaceCase_key,
+                             cxxNamespaceCase_key_insensitive, cxxNamespaceCase_key_namestr,
+                             cxxNamespaceCase_key_name))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 16 "glean/schema/thrift/search_cxx_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 106 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchCxx/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("QueryToNSQNameCase", 5), ("QueryToQNameCase", 5),
+       ("CxxRecordCase", 5), ("QueryToScopeCase", 5), ("DeclIsDefn", 5),
+       ("CxxNamespaceCase", 5)]
+
+type QueryToScopeCase_id = Glean.Id
+
+data QueryToScopeCase = QueryToScopeCase{queryToScopeCase_id ::
+                                         {-# UNPACK #-} !QueryToScopeCase_id,
+                                         queryToScopeCase_key :: Prelude.Maybe QueryToScopeCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToScopeCase where
+  toJSON (QueryToScopeCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToScopeCase where
+  buildStruct _proxy (QueryToScopeCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QueryToScopeCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToScopeCase where
+  rnf (QueryToScopeCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QueryToScopeCase where
+  def = QueryToScopeCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable QueryToScopeCase where
+  hashWithSalt __salt (QueryToScopeCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QueryToQNameCase_id = Glean.Id
+
+data QueryToQNameCase = QueryToQNameCase{queryToQNameCase_id ::
+                                         {-# UNPACK #-} !QueryToQNameCase_id,
+                                         queryToQNameCase_key :: Prelude.Maybe QueryToQNameCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToQNameCase where
+  toJSON (QueryToQNameCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToQNameCase where
+  buildStruct _proxy (QueryToQNameCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QueryToQNameCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToQNameCase where
+  rnf (QueryToQNameCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QueryToQNameCase where
+  def = QueryToQNameCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable QueryToQNameCase where
+  hashWithSalt __salt (QueryToQNameCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QueryToNSQNameCase_id = Glean.Id
+
+data QueryToNSQNameCase = QueryToNSQNameCase{queryToNSQNameCase_id
+                                             :: {-# UNPACK #-} !QueryToNSQNameCase_id,
+                                             queryToNSQNameCase_key ::
+                                             Prelude.Maybe QueryToNSQNameCase_key}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToNSQNameCase where
+  toJSON (QueryToNSQNameCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToNSQNameCase where
+  buildStruct _proxy (QueryToNSQNameCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QueryToNSQNameCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToNSQNameCase where
+  rnf (QueryToNSQNameCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QueryToNSQNameCase where
+  def = QueryToNSQNameCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable QueryToNSQNameCase where
+  hashWithSalt __salt (QueryToNSQNameCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DeclIsDefn_id = Glean.Id
+
+data DeclIsDefn = DeclIsDefn{declIsDefn_id ::
+                             {-# UNPACK #-} !DeclIsDefn_id,
+                             declIsDefn_key :: Prelude.Maybe DeclIsDefn_key}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclIsDefn where
+  toJSON (DeclIsDefn __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclIsDefn where
+  buildStruct _proxy (DeclIsDefn __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DeclIsDefn __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclIsDefn where
+  rnf (DeclIsDefn __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DeclIsDefn where
+  def = DeclIsDefn Default.def Prelude.Nothing
+
+instance Hashable.Hashable DeclIsDefn where
+  hashWithSalt __salt (DeclIsDefn _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxRecordCase_id = Glean.Id
+
+data CxxRecordCase = CxxRecordCase{cxxRecordCase_id ::
+                                   {-# UNPACK #-} !CxxRecordCase_id,
+                                   cxxRecordCase_key :: Prelude.Maybe CxxRecordCase_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxRecordCase where
+  toJSON (CxxRecordCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxRecordCase where
+  buildStruct _proxy (CxxRecordCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxRecordCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxRecordCase where
+  rnf (CxxRecordCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxRecordCase where
+  def = CxxRecordCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxRecordCase where
+  hashWithSalt __salt (CxxRecordCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type CxxNamespaceCase_id = Glean.Id
+
+data CxxNamespaceCase = CxxNamespaceCase{cxxNamespaceCase_id ::
+                                         {-# UNPACK #-} !CxxNamespaceCase_id,
+                                         cxxNamespaceCase_key :: Prelude.Maybe CxxNamespaceCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNamespaceCase where
+  toJSON (CxxNamespaceCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxNamespaceCase where
+  buildStruct _proxy (CxxNamespaceCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (CxxNamespaceCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNamespaceCase where
+  rnf (CxxNamespaceCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default CxxNamespaceCase where
+  def = CxxNamespaceCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable CxxNamespaceCase where
+  hashWithSalt __salt (CxxNamespaceCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data QueryToScopeCase_key = QueryToScopeCase_key{queryToScopeCase_key_query
+                                                 :: [Text.Text],
+                                                 queryToScopeCase_key_insensitive :: Prelude.Bool,
+                                                 queryToScopeCase_key_scope ::
+                                                 Glean.Schema.Cxx1.Scope}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToScopeCase_key where
+  toJSON
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scope)
+    = Aeson.object
+        ("query" .= __field__query :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToScopeCase_key where
+  buildStruct _proxy
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "query" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__query)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__scope)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__query <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__query <- ST.readSTRef __field__query
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure
+                                               (QueryToScopeCase_key __val__query __val__insensitive
+                                                  __val__scope)
+              _idMap
+                = HashMap.fromList [("query", 1), ("insensitive", 2), ("scope", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToScopeCase_key where
+  rnf
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scope)
+    = DeepSeq.rnf __field__query `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default QueryToScopeCase_key where
+  def = QueryToScopeCase_key Default.def Prelude.False Default.def
+
+instance Hashable.Hashable QueryToScopeCase_key where
+  hashWithSalt __salt
+    (QueryToScopeCase_key _query _insensitive _scope)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _query)
+           _insensitive)
+        _scope
+
+data QueryToQNameCase_key = QueryToQNameCase_key{queryToQNameCase_key_query
+                                                 :: [Text.Text],
+                                                 queryToQNameCase_key_insensitive :: Prelude.Bool,
+                                                 queryToQNameCase_key_scope ::
+                                                 Glean.Schema.Cxx1.QName}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToQNameCase_key where
+  toJSON
+    (QueryToQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = Aeson.object
+        ("query" .= __field__query :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToQNameCase_key where
+  buildStruct _proxy
+    (QueryToQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "query" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__query)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__scope)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__query <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__query <- ST.readSTRef __field__query
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure
+                                               (QueryToQNameCase_key __val__query __val__insensitive
+                                                  __val__scope)
+              _idMap
+                = HashMap.fromList [("query", 1), ("insensitive", 2), ("scope", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToQNameCase_key where
+  rnf
+    (QueryToQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = DeepSeq.rnf __field__query `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default QueryToQNameCase_key where
+  def = QueryToQNameCase_key Default.def Prelude.False Default.def
+
+instance Hashable.Hashable QueryToQNameCase_key where
+  hashWithSalt __salt
+    (QueryToQNameCase_key _query _insensitive _scope)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _query)
+           _insensitive)
+        _scope
+
+data QueryToNSQNameCase_key = QueryToNSQNameCase_key{queryToNSQNameCase_key_query
+                                                     :: [Text.Text],
+                                                     queryToNSQNameCase_key_insensitive ::
+                                                     Prelude.Bool,
+                                                     queryToNSQNameCase_key_scope ::
+                                                     Glean.Schema.Cxx1.NamespaceQName}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToNSQNameCase_key where
+  toJSON
+    (QueryToNSQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = Aeson.object
+        ("query" .= __field__query :
+           "insensitive" .= __field__insensitive :
+             "scope" .= __field__scope : Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToNSQNameCase_key where
+  buildStruct _proxy
+    (QueryToNSQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "query" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__query)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__scope)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__query <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scope <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__query <- ST.readSTRef __field__query
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             Prelude.pure
+                                               (QueryToNSQNameCase_key __val__query
+                                                  __val__insensitive
+                                                  __val__scope)
+              _idMap
+                = HashMap.fromList [("query", 1), ("insensitive", 2), ("scope", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToNSQNameCase_key where
+  rnf
+    (QueryToNSQNameCase_key __field__query __field__insensitive
+       __field__scope)
+    = DeepSeq.rnf __field__query `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq` ()
+
+instance Default.Default QueryToNSQNameCase_key where
+  def = QueryToNSQNameCase_key Default.def Prelude.False Default.def
+
+instance Hashable.Hashable QueryToNSQNameCase_key where
+  hashWithSalt __salt
+    (QueryToNSQNameCase_key _query _insensitive _scope)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _query)
+           _insensitive)
+        _scope
+
+data DeclIsDefn_key = DeclIsDefn_key{declIsDefn_key_decl ::
+                                     Glean.Schema.Cxx1.Declaration,
+                                     declIsDefn_key_defn :: Glean.Schema.CodeCxx.Definition}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeclIsDefn_key where
+  toJSON (DeclIsDefn_key __field__decl __field__defn)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "defn" .= __field__defn : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeclIsDefn_key where
+  buildStruct _proxy (DeclIsDefn_key __field__decl __field__defn)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "defn" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__defn)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__defn <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__defn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__defn <- ST.readSTRef __field__defn
+                                             Prelude.pure (DeclIsDefn_key __val__decl __val__defn)
+              _idMap = HashMap.fromList [("decl", 1), ("defn", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DeclIsDefn_key where
+  rnf (DeclIsDefn_key __field__decl __field__defn)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__defn `Prelude.seq` ()
+
+instance Default.Default DeclIsDefn_key where
+  def = DeclIsDefn_key Default.def Default.def
+
+instance Hashable.Hashable DeclIsDefn_key where
+  hashWithSalt __salt (DeclIsDefn_key _decl _defn)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl) _defn
+
+data CxxRecordCase_key = CxxRecordCase_key{cxxRecordCase_key_insensitive
+                                           :: Prelude.Bool,
+                                           cxxRecordCase_key_namestr :: Text.Text,
+                                           cxxRecordCase_key_name :: Glean.Schema.Cxx1.Name}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxRecordCase_key where
+  toJSON
+    (CxxRecordCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Aeson.object
+        ("insensitive" .= __field__insensitive :
+           "namestr" .= __field__namestr :
+             "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxRecordCase_key where
+  buildStruct _proxy
+    (CxxRecordCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "insensitive" 1 0 __field__insensitive
+           :
+           Thrift.genField _proxy "namestr" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__namestr)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__namestr <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namestr
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__namestr <- ST.readSTRef __field__namestr
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (CxxRecordCase_key __val__insensitive __val__namestr
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("insensitive", 1), ("namestr", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxRecordCase_key where
+  rnf
+    (CxxRecordCase_key __field__insensitive __field__namestr
+       __field__name)
+    = DeepSeq.rnf __field__insensitive `Prelude.seq`
+        DeepSeq.rnf __field__namestr `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default CxxRecordCase_key where
+  def = CxxRecordCase_key Prelude.False "" Default.def
+
+instance Hashable.Hashable CxxRecordCase_key where
+  hashWithSalt __salt (CxxRecordCase_key _insensitive _namestr _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _insensitive)
+           _namestr)
+        _name
+
+data CxxNamespaceCase_key = CxxNamespaceCase_key{cxxNamespaceCase_key_insensitive
+                                                 :: Prelude.Bool,
+                                                 cxxNamespaceCase_key_namestr :: Text.Text,
+                                                 cxxNamespaceCase_key_name ::
+                                                 Glean.Schema.Cxx1.Name}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON CxxNamespaceCase_key where
+  toJSON
+    (CxxNamespaceCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Aeson.object
+        ("insensitive" .= __field__insensitive :
+           "namestr" .= __field__namestr :
+             "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct CxxNamespaceCase_key where
+  buildStruct _proxy
+    (CxxNamespaceCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "insensitive" 1 0 __field__insensitive
+           :
+           Thrift.genField _proxy "namestr" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__namestr)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__namestr <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namestr
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__namestr <- ST.readSTRef __field__namestr
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (CxxNamespaceCase_key __val__insensitive
+                                                  __val__namestr
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("insensitive", 1), ("namestr", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData CxxNamespaceCase_key where
+  rnf
+    (CxxNamespaceCase_key __field__insensitive __field__namestr
+       __field__name)
+    = DeepSeq.rnf __field__insensitive `Prelude.seq`
+        DeepSeq.rnf __field__namestr `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default CxxNamespaceCase_key where
+  def = CxxNamespaceCase_key Prelude.False "" Default.def
+
+instance Hashable.Hashable CxxNamespaceCase_key where
+  hashWithSalt __salt
+    (CxxNamespaceCase_key _insensitive _namestr _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _insensitive)
+           _namestr)
+        _name
+{-# LINE 19 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCxx.Types.QueryToNSQNameCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCxx.Types.QueryToNSQNameCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.QueryToNSQNameCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.QueryToNSQNameCase_key"
+           (Prelude.Just 0))
+{-# LINE 30 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCxx.Types.QueryToNSQNameCase_key
+     =
+     'Angle.TField "query" ([Data.Text.Text])
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.NamespaceQName)
+             ('Angle.TNoFields)))
+{-# LINE 32 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCxx.Types.QueryToNSQNameCase
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.QueryToNSQNameCase =
+       Glean.Schema.SearchCxx.Types.QueryToNSQNameCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.cxx.QueryToNSQNameCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.queryToNSQNameCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.QueryToNSQNameCase x k
+  getFactKey = Glean.Schema.SearchCxx.Types.queryToNSQNameCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 41 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.QueryToNSQNameCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCxx.Types.QueryToQNameCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCxx.Types.QueryToQNameCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.QueryToQNameCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.QueryToQNameCase_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCxx.Types.QueryToQNameCase_key
+     =
+     'Angle.TField "query" ([Data.Text.Text])
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.QName)
+             ('Angle.TNoFields)))
+{-# LINE 60 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCxx.Types.QueryToQNameCase
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.QueryToQNameCase =
+       Glean.Schema.SearchCxx.Types.QueryToQNameCase_key
+  getName _proxy = Glean.PredicateRef "search.cxx.QueryToQNameCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.queryToQNameCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.QueryToQNameCase x k
+  getFactKey = Glean.Schema.SearchCxx.Types.queryToQNameCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 69 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.QueryToQNameCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 75 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.CxxRecordCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCxx.Types.CxxRecordCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.CxxRecordCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.CxxRecordCase_key" (Prelude.Just 0))
+{-# LINE 86 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchCxx.Types.CxxRecordCase_key =
+     'Angle.TField "insensitive" (Prelude.Bool)
+       ('Angle.TField "namestr" (Data.Text.Text)
+          ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+             ('Angle.TNoFields)))
+{-# LINE 88 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchCxx.Types.CxxRecordCase
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.CxxRecordCase =
+       Glean.Schema.SearchCxx.Types.CxxRecordCase_key
+  getName _proxy = Glean.PredicateRef "search.cxx.CxxRecordCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.cxxRecordCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.CxxRecordCase x k
+  getFactKey = Glean.Schema.SearchCxx.Types.cxxRecordCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.CxxRecordCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCxx.Types.QueryToScopeCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCxx.Types.QueryToScopeCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.QueryToScopeCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.QueryToScopeCase_key"
+           (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCxx.Types.QueryToScopeCase_key
+     =
+     'Angle.TField "query" ([Data.Text.Text])
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+             ('Angle.TNoFields)))
+{-# LINE 116 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCxx.Types.QueryToScopeCase
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.QueryToScopeCase =
+       Glean.Schema.SearchCxx.Types.QueryToScopeCase_key
+  getName _proxy = Glean.PredicateRef "search.cxx.QueryToScopeCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.queryToScopeCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.QueryToScopeCase x k
+  getFactKey = Glean.Schema.SearchCxx.Types.queryToScopeCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.QueryToScopeCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.DeclIsDefn_key
+         where
+  buildRtsValue b (Glean.Schema.SearchCxx.Types.DeclIsDefn_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.DeclIsDefn_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.DeclIsDefn_key" (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchCxx.Types.DeclIsDefn_key =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "defn" (Glean.Schema.CodeCxx.Types.Definition)
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchCxx.Types.DeclIsDefn
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.DeclIsDefn =
+       Glean.Schema.SearchCxx.Types.DeclIsDefn_key
+  getName _proxy = Glean.PredicateRef "search.cxx.DeclIsDefn" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.declIsDefn_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.DeclIsDefn x k
+  getFactKey = Glean.Schema.SearchCxx.Types.declIsDefn_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.DeclIsDefn where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 157 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchCxx.Types.CxxNamespaceCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchCxx.Types.CxxNamespaceCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchCxx.Types.CxxNamespaceCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.cxx.CxxNamespaceCase_key"
+           (Prelude.Just 0))
+{-# LINE 168 "glean/schema/thrift/search_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchCxx.Types.CxxNamespaceCase_key
+     =
+     'Angle.TField "insensitive" (Prelude.Bool)
+       ('Angle.TField "namestr" (Data.Text.Text)
+          ('Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+             ('Angle.TNoFields)))
+{-# LINE 170 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchCxx.Types.CxxNamespaceCase
+         where
+  type KeyType Glean.Schema.SearchCxx.Types.CxxNamespaceCase =
+       Glean.Schema.SearchCxx.Types.CxxNamespaceCase_key
+  getName _proxy = Glean.PredicateRef "search.cxx.CxxNamespaceCase" 5
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchCxx.Types.cxxNamespaceCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchCxx.Types.CxxNamespaceCase x k
+  getFactKey = Glean.Schema.SearchCxx.Types.cxxNamespaceCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 179 "glean/schema/thrift/search_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchCxx.Types.CxxNamespaceCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchErlang/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchErlang/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchErlang/Types.hs
@@ -0,0 +1,527 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_erlang_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_erlang_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_erlang_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchErlang/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchErlang.Types
+       (pREDICATE_VERSIONS, SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        SearchByFQN_id,
+        SearchByFQN(SearchByFQN, searchByFQN_id, searchByFQN_key),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_entity),
+        SearchByFQN_key(SearchByFQN_key, searchByFQN_key_module,
+                        searchByFQN_key_name, searchByFQN_key_arity,
+                        searchByFQN_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeErlang.Types
+       as Glean.Schema.CodeErlang
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_erlang_include.hs" #-}
+import qualified Glean.Schema.CodeErlang.Types
+{-# LINE 81 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchErlang/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList [("SearchByName", 4), ("SearchByFQN", 4)]
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByFQN_id = Glean.Id
+
+data SearchByFQN = SearchByFQN{searchByFQN_id ::
+                               {-# UNPACK #-} !SearchByFQN_id,
+                               searchByFQN_key :: Prelude.Maybe SearchByFQN_key}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFQN where
+  toJSON (SearchByFQN __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByFQN where
+  buildStruct _proxy (SearchByFQN __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByFQN __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFQN where
+  rnf (SearchByFQN __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByFQN where
+  def = SearchByFQN Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByFQN where
+  hashWithSalt __salt (SearchByFQN _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Text.Text,
+                                         searchByName_key_entity :: Glean.Schema.CodeErlang.Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key "" Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data SearchByFQN_key = SearchByFQN_key{searchByFQN_key_module ::
+                                       Text.Text,
+                                       searchByFQN_key_name :: Text.Text,
+                                       searchByFQN_key_arity :: Glean.Nat,
+                                       searchByFQN_key_entity :: Glean.Schema.CodeErlang.Entity}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByFQN_key where
+  toJSON
+    (SearchByFQN_key __field__module __field__name __field__arity
+       __field__entity)
+    = Aeson.object
+        ("module" .= __field__module :
+           "name" .= __field__name :
+             "arity" .= Glean.unNat __field__arity :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByFQN_key where
+  buildStruct _proxy
+    (SearchByFQN_key __field__module __field__name __field__arity
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "module" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__module)
+           :
+           Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__name)
+             :
+             Thrift.genField _proxy "arity" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__arity)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__module <- ST.newSTRef ""
+            __field__name <- ST.newSTRef ""
+            __field__arity <- ST.newSTRef (Glean.Nat Default.def)
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__module
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__arity
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__module <- ST.readSTRef
+                                                                 __field__module
+                                             !__val__name <- ST.readSTRef __field__name
+                                             !__val__arity <- ST.readSTRef __field__arity
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByFQN_key __val__module __val__name
+                                                  __val__arity
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("module", 1), ("name", 2), ("arity", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByFQN_key where
+  rnf
+    (SearchByFQN_key __field__module __field__name __field__arity
+       __field__entity)
+    = DeepSeq.rnf __field__module `Prelude.seq`
+        DeepSeq.rnf __field__name `Prelude.seq`
+          DeepSeq.rnf __field__arity `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByFQN_key where
+  def = SearchByFQN_key "" "" (Glean.Nat Default.def) Default.def
+
+instance Hashable.Hashable SearchByFQN_key where
+  hashWithSalt __salt (SearchByFQN_key _module _name _arity _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _module)
+              _name)
+           _arity)
+        _entity
+{-# LINE 18 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchErlang.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchErlang.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchErlang.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.erlang.SearchByName_key" (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/search_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchErlang.Types.SearchByName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchErlang.Types.SearchByName
+         where
+  type KeyType Glean.Schema.SearchErlang.Types.SearchByName =
+       Glean.Schema.SearchErlang.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "search.erlang.SearchByName" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchErlang.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchErlang.Types.SearchByName x k
+  getFactKey = Glean.Schema.SearchErlang.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchErlang.Types.SearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchErlang.Types.SearchByFQN_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchErlang.Types.SearchByFQN_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchErlang.Types.SearchByFQN_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.erlang.SearchByFQN_key" (Prelude.Just 0))
+{-# LINE 57 "glean/schema/thrift/search_erlang_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchErlang.Types.SearchByFQN_key
+     =
+     'Angle.TField "module" (Data.Text.Text)
+       ('Angle.TField "name" (Data.Text.Text)
+          ('Angle.TField "arity" (Glean.Nat)
+             ('Angle.TField "entity" (Glean.Schema.CodeErlang.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 59 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchErlang.Types.SearchByFQN
+         where
+  type KeyType Glean.Schema.SearchErlang.Types.SearchByFQN =
+       Glean.Schema.SearchErlang.Types.SearchByFQN_key
+  getName _proxy = Glean.PredicateRef "search.erlang.SearchByFQN" 4
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchErlang.Types.searchByFQN_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchErlang.Types.SearchByFQN x k
+  getFactKey = Glean.Schema.SearchErlang.Types.searchByFQN_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 68 "glean/schema/thrift/search_erlang_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchErlang.Types.SearchByFQN
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHack/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHack/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHack/Types.hs
@@ -0,0 +1,4487 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_hack_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_hack_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_hack_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHack/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchHack.Types
+       (pREDICATE_VERSIONS, SearchTypeInNamespace_id,
+        SearchTypeInNamespace(SearchTypeInNamespace,
+                              searchTypeInNamespace_id, searchTypeInNamespace_key),
+        SearchPropertyInContainer_id,
+        SearchPropertyInContainer(SearchPropertyInContainer,
+                                  searchPropertyInContainer_id, searchPropertyInContainer_key),
+        SearchNamespacedDecl_id,
+        SearchNamespacedDecl(SearchNamespacedDecl, searchNamespacedDecl_id,
+                             searchNamespacedDecl_key),
+        SearchNamespace_id,
+        SearchNamespace(SearchNamespace, searchNamespace_id,
+                        searchNamespace_key),
+        SearchModule_id,
+        SearchModule(SearchModule, searchModule_id, searchModule_key),
+        SearchInNamespace_id,
+        SearchInNamespace(SearchInNamespace, searchInNamespace_id,
+                          searchInNamespace_key),
+        SearchInEnum_id,
+        SearchInEnum(SearchInEnum, searchInEnum_id, searchInEnum_key),
+        SearchInContainerOrEnumNoProperty_id,
+        SearchInContainerOrEnumNoProperty(SearchInContainerOrEnumNoProperty,
+                                          searchInContainerOrEnumNoProperty_id,
+                                          searchInContainerOrEnumNoProperty_key),
+        SearchInContainerOrEnum_id,
+        SearchInContainerOrEnum(SearchInContainerOrEnum,
+                                searchInContainerOrEnum_id, searchInContainerOrEnum_key),
+        SearchInContainerNoProperty_id,
+        SearchInContainerNoProperty(SearchInContainerNoProperty,
+                                    searchInContainerNoProperty_id,
+                                    searchInContainerNoProperty_key),
+        SearchInContainer_id,
+        SearchInContainer(SearchInContainer, searchInContainer_id,
+                          searchInContainer_key),
+        SearchGlobalConstInNamespace_id,
+        SearchGlobalConstInNamespace(SearchGlobalConstInNamespace,
+                                     searchGlobalConstInNamespace_id,
+                                     searchGlobalConstInNamespace_key),
+        SearchFunctionInNamespace_id,
+        SearchFunctionInNamespace(SearchFunctionInNamespace,
+                                  searchFunctionInNamespace_id, searchFunctionInNamespace_key),
+        SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        QueryToScopeCase_id,
+        QueryToScopeCase(QueryToScopeCase, queryToScopeCase_id,
+                         queryToScopeCase_key),
+        HackNameCase_id,
+        HackNameCase(HackNameCase, hackNameCase_id, hackNameCase_key),
+        HackInAutoImportedNamespace_id,
+        HackInAutoImportedNamespace(HackInAutoImportedNamespace,
+                                    hackInAutoImportedNamespace_id,
+                                    hackInAutoImportedNamespace_key),
+        SearchTypeInNamespace_key(SearchTypeInNamespace_key,
+                                  searchTypeInNamespace_key_name,
+                                  searchTypeInNamespace_key_namespace_,
+                                  searchTypeInNamespace_key_decl),
+        SearchPropertyInContainer_key(SearchPropertyInContainer_key,
+                                      searchPropertyInContainer_key_name,
+                                      searchPropertyInContainer_key_containerName,
+                                      searchPropertyInContainer_key_containerNamespace,
+                                      searchPropertyInContainer_key_decl),
+        SearchNamespacedDecl_key(SearchNamespacedDecl_key,
+                                 searchNamespacedDecl_key_name, searchNamespacedDecl_key_namespace_,
+                                 searchNamespacedDecl_key_decl),
+        SearchNamespace_key(SearchNamespace_key, searchNamespace_key_name,
+                            searchNamespace_key_namespace_, searchNamespace_key_decl),
+        SearchModule_key(SearchModule_key, searchModule_key_name,
+                         searchModule_key_decl),
+        SearchInNamespace_key(SearchInNamespace_key,
+                              searchInNamespace_key_name, searchInNamespace_key_namespace_,
+                              searchInNamespace_key_decl),
+        SearchInEnum_key(SearchInEnum_key, searchInEnum_key_name,
+                         searchInEnum_key_enumName, searchInEnum_key_enumNamespace,
+                         searchInEnum_key_decl),
+        SearchInContainerOrEnumNoProperty_key(SearchInContainerOrEnumNoProperty_key,
+                                              searchInContainerOrEnumNoProperty_key_name,
+                                              searchInContainerOrEnumNoProperty_key_contextName,
+                                              searchInContainerOrEnumNoProperty_key_contextNamespace,
+                                              searchInContainerOrEnumNoProperty_key_decl),
+        SearchInContainerOrEnum_key(SearchInContainerOrEnum_key,
+                                    searchInContainerOrEnum_key_name,
+                                    searchInContainerOrEnum_key_contextName,
+                                    searchInContainerOrEnum_key_contextNamespace,
+                                    searchInContainerOrEnum_key_decl),
+        SearchInContainerNoProperty_key(SearchInContainerNoProperty_key,
+                                        searchInContainerNoProperty_key_name,
+                                        searchInContainerNoProperty_key_containerName,
+                                        searchInContainerNoProperty_key_containerNamespace,
+                                        searchInContainerNoProperty_key_decl),
+        SearchInContainer_key(SearchInContainer_key,
+                              searchInContainer_key_name, searchInContainer_key_containerName,
+                              searchInContainer_key_containerNamespace,
+                              searchInContainer_key_decl),
+        SearchGlobalConstInNamespace_key(SearchGlobalConstInNamespace_key,
+                                         searchGlobalConstInNamespace_key_name,
+                                         searchGlobalConstInNamespace_key_namespace_,
+                                         searchGlobalConstInNamespace_key_decl),
+        SearchFunctionInNamespace_key(SearchFunctionInNamespace_key,
+                                      searchFunctionInNamespace_key_name,
+                                      searchFunctionInNamespace_key_namespace_,
+                                      searchFunctionInNamespace_key_decl),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_decl),
+        QueryToScopeCase_key(QueryToScopeCase_key,
+                             queryToScopeCase_key_query, queryToScopeCase_key_insensitive,
+                             queryToScopeCase_key_scopeName,
+                             queryToScopeCase_key_scopeNamespace),
+        HackNameCase_key(HackNameCase_key, hackNameCase_key_insensitive,
+                         hackNameCase_key_namestr, hackNameCase_key_name),
+        HackInAutoImportedNamespace_key(HackInAutoImportedNamespace_key,
+                                        hackInAutoImportedNamespace_key_name,
+                                        hackInAutoImportedNamespace_key_parent))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Hack.Types as Glean.Schema.Hack
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_hack_include.hs" #-}
+import qualified Glean.Schema.Hack.Types
+{-# LINE 182 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHack/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("HackInAutoImportedNamespace", 7), ("SearchInContainer", 7),
+       ("SearchNamespacedDecl", 7), ("SearchNamespace", 7),
+       ("HackNameCase", 7), ("SearchInContainerOrEnum", 7),
+       ("SearchTypeInNamespace", 7), ("SearchInEnum", 7),
+       ("QueryToScopeCase", 7), ("SearchPropertyInContainer", 7),
+       ("SearchModule", 7), ("SearchInNamespace", 7), ("SearchByName", 7),
+       ("SearchGlobalConstInNamespace", 7),
+       ("SearchInContainerOrEnumNoProperty", 7),
+       ("SearchInContainerNoProperty", 7),
+       ("SearchFunctionInNamespace", 7)]
+
+type SearchTypeInNamespace_id = Glean.Id
+
+data SearchTypeInNamespace = SearchTypeInNamespace{searchTypeInNamespace_id
+                                                   :: {-# UNPACK #-} !SearchTypeInNamespace_id,
+                                                   searchTypeInNamespace_key ::
+                                                   Prelude.Maybe SearchTypeInNamespace_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeInNamespace where
+  toJSON (SearchTypeInNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchTypeInNamespace where
+  buildStruct _proxy (SearchTypeInNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchTypeInNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeInNamespace where
+  rnf (SearchTypeInNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchTypeInNamespace where
+  def = SearchTypeInNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchTypeInNamespace where
+  hashWithSalt __salt (SearchTypeInNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchPropertyInContainer_id = Glean.Id
+
+data SearchPropertyInContainer = SearchPropertyInContainer{searchPropertyInContainer_id
+                                                           ::
+                                                           {-# UNPACK #-} !SearchPropertyInContainer_id,
+                                                           searchPropertyInContainer_key ::
+                                                           Prelude.Maybe
+                                                             SearchPropertyInContainer_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyInContainer where
+  toJSON (SearchPropertyInContainer __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchPropertyInContainer where
+  buildStruct _proxy
+    (SearchPropertyInContainer __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchPropertyInContainer __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyInContainer where
+  rnf (SearchPropertyInContainer __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchPropertyInContainer where
+  def = SearchPropertyInContainer Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchPropertyInContainer where
+  hashWithSalt __salt (SearchPropertyInContainer _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchNamespacedDecl_id = Glean.Id
+
+data SearchNamespacedDecl = SearchNamespacedDecl{searchNamespacedDecl_id
+                                                 :: {-# UNPACK #-} !SearchNamespacedDecl_id,
+                                                 searchNamespacedDecl_key ::
+                                                 Prelude.Maybe SearchNamespacedDecl_key}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespacedDecl where
+  toJSON (SearchNamespacedDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNamespacedDecl where
+  buildStruct _proxy (SearchNamespacedDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchNamespacedDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespacedDecl where
+  rnf (SearchNamespacedDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchNamespacedDecl where
+  def = SearchNamespacedDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchNamespacedDecl where
+  hashWithSalt __salt (SearchNamespacedDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchNamespace_id = Glean.Id
+
+data SearchNamespace = SearchNamespace{searchNamespace_id ::
+                                       {-# UNPACK #-} !SearchNamespace_id,
+                                       searchNamespace_key :: Prelude.Maybe SearchNamespace_key}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespace where
+  toJSON (SearchNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchNamespace where
+  buildStruct _proxy (SearchNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespace where
+  rnf (SearchNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchNamespace where
+  def = SearchNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchNamespace where
+  hashWithSalt __salt (SearchNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchModule_id = Glean.Id
+
+data SearchModule = SearchModule{searchModule_id ::
+                                 {-# UNPACK #-} !SearchModule_id,
+                                 searchModule_key :: Prelude.Maybe SearchModule_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModule where
+  toJSON (SearchModule __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModule where
+  buildStruct _proxy (SearchModule __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchModule __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModule where
+  rnf (SearchModule __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchModule where
+  def = SearchModule Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchModule where
+  hashWithSalt __salt (SearchModule _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInNamespace_id = Glean.Id
+
+data SearchInNamespace = SearchInNamespace{searchInNamespace_id ::
+                                           {-# UNPACK #-} !SearchInNamespace_id,
+                                           searchInNamespace_key ::
+                                           Prelude.Maybe SearchInNamespace_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInNamespace where
+  toJSON (SearchInNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInNamespace where
+  buildStruct _proxy (SearchInNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchInNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInNamespace where
+  rnf (SearchInNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInNamespace where
+  def = SearchInNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInNamespace where
+  hashWithSalt __salt (SearchInNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInEnum_id = Glean.Id
+
+data SearchInEnum = SearchInEnum{searchInEnum_id ::
+                                 {-# UNPACK #-} !SearchInEnum_id,
+                                 searchInEnum_key :: Prelude.Maybe SearchInEnum_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInEnum where
+  toJSON (SearchInEnum __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInEnum where
+  buildStruct _proxy (SearchInEnum __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchInEnum __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInEnum where
+  rnf (SearchInEnum __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInEnum where
+  def = SearchInEnum Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInEnum where
+  hashWithSalt __salt (SearchInEnum _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInContainerOrEnumNoProperty_id = Glean.Id
+
+data SearchInContainerOrEnumNoProperty = SearchInContainerOrEnumNoProperty{searchInContainerOrEnumNoProperty_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !SearchInContainerOrEnumNoProperty_id,
+                                                                           searchInContainerOrEnumNoProperty_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             SearchInContainerOrEnumNoProperty_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerOrEnumNoProperty where
+  toJSON (SearchInContainerOrEnumNoProperty __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInContainerOrEnumNoProperty
+         where
+  buildStruct _proxy
+    (SearchInContainerOrEnumNoProperty __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInContainerOrEnumNoProperty __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerOrEnumNoProperty where
+  rnf (SearchInContainerOrEnumNoProperty __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInContainerOrEnumNoProperty where
+  def = SearchInContainerOrEnumNoProperty Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInContainerOrEnumNoProperty where
+  hashWithSalt __salt (SearchInContainerOrEnumNoProperty _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInContainerOrEnum_id = Glean.Id
+
+data SearchInContainerOrEnum = SearchInContainerOrEnum{searchInContainerOrEnum_id
+                                                       ::
+                                                       {-# UNPACK #-} !SearchInContainerOrEnum_id,
+                                                       searchInContainerOrEnum_key ::
+                                                       Prelude.Maybe SearchInContainerOrEnum_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerOrEnum where
+  toJSON (SearchInContainerOrEnum __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInContainerOrEnum where
+  buildStruct _proxy
+    (SearchInContainerOrEnum __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInContainerOrEnum __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerOrEnum where
+  rnf (SearchInContainerOrEnum __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInContainerOrEnum where
+  def = SearchInContainerOrEnum Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInContainerOrEnum where
+  hashWithSalt __salt (SearchInContainerOrEnum _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInContainerNoProperty_id = Glean.Id
+
+data SearchInContainerNoProperty = SearchInContainerNoProperty{searchInContainerNoProperty_id
+                                                               ::
+                                                               {-# UNPACK #-} !SearchInContainerNoProperty_id,
+                                                               searchInContainerNoProperty_key ::
+                                                               Prelude.Maybe
+                                                                 SearchInContainerNoProperty_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerNoProperty where
+  toJSON (SearchInContainerNoProperty __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInContainerNoProperty where
+  buildStruct _proxy
+    (SearchInContainerNoProperty __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchInContainerNoProperty __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerNoProperty where
+  rnf (SearchInContainerNoProperty __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInContainerNoProperty where
+  def = SearchInContainerNoProperty Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInContainerNoProperty where
+  hashWithSalt __salt (SearchInContainerNoProperty _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchInContainer_id = Glean.Id
+
+data SearchInContainer = SearchInContainer{searchInContainer_id ::
+                                           {-# UNPACK #-} !SearchInContainer_id,
+                                           searchInContainer_key ::
+                                           Prelude.Maybe SearchInContainer_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainer where
+  toJSON (SearchInContainer __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchInContainer where
+  buildStruct _proxy (SearchInContainer __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchInContainer __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainer where
+  rnf (SearchInContainer __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchInContainer where
+  def = SearchInContainer Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchInContainer where
+  hashWithSalt __salt (SearchInContainer _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchGlobalConstInNamespace_id = Glean.Id
+
+data SearchGlobalConstInNamespace = SearchGlobalConstInNamespace{searchGlobalConstInNamespace_id
+                                                                 ::
+                                                                 {-# UNPACK #-} !SearchGlobalConstInNamespace_id,
+                                                                 searchGlobalConstInNamespace_key ::
+                                                                 Prelude.Maybe
+                                                                   SearchGlobalConstInNamespace_key}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstInNamespace where
+  toJSON (SearchGlobalConstInNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchGlobalConstInNamespace where
+  buildStruct _proxy
+    (SearchGlobalConstInNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchGlobalConstInNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstInNamespace where
+  rnf (SearchGlobalConstInNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstInNamespace where
+  def = SearchGlobalConstInNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchGlobalConstInNamespace where
+  hashWithSalt __salt (SearchGlobalConstInNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchFunctionInNamespace_id = Glean.Id
+
+data SearchFunctionInNamespace = SearchFunctionInNamespace{searchFunctionInNamespace_id
+                                                           ::
+                                                           {-# UNPACK #-} !SearchFunctionInNamespace_id,
+                                                           searchFunctionInNamespace_key ::
+                                                           Prelude.Maybe
+                                                             SearchFunctionInNamespace_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionInNamespace where
+  toJSON (SearchFunctionInNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchFunctionInNamespace where
+  buildStruct _proxy
+    (SearchFunctionInNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchFunctionInNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionInNamespace where
+  rnf (SearchFunctionInNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchFunctionInNamespace where
+  def = SearchFunctionInNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchFunctionInNamespace where
+  hashWithSalt __salt (SearchFunctionInNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type QueryToScopeCase_id = Glean.Id
+
+data QueryToScopeCase = QueryToScopeCase{queryToScopeCase_id ::
+                                         {-# UNPACK #-} !QueryToScopeCase_id,
+                                         queryToScopeCase_key :: Prelude.Maybe QueryToScopeCase_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToScopeCase where
+  toJSON (QueryToScopeCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToScopeCase where
+  buildStruct _proxy (QueryToScopeCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (QueryToScopeCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToScopeCase where
+  rnf (QueryToScopeCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default QueryToScopeCase where
+  def = QueryToScopeCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable QueryToScopeCase where
+  hashWithSalt __salt (QueryToScopeCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackNameCase_id = Glean.Id
+
+data HackNameCase = HackNameCase{hackNameCase_id ::
+                                 {-# UNPACK #-} !HackNameCase_id,
+                                 hackNameCase_key :: Prelude.Maybe HackNameCase_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackNameCase where
+  toJSON (HackNameCase __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackNameCase where
+  buildStruct _proxy (HackNameCase __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (HackNameCase __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackNameCase where
+  rnf (HackNameCase __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackNameCase where
+  def = HackNameCase Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackNameCase where
+  hashWithSalt __salt (HackNameCase _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type HackInAutoImportedNamespace_id = Glean.Id
+
+data HackInAutoImportedNamespace = HackInAutoImportedNamespace{hackInAutoImportedNamespace_id
+                                                               ::
+                                                               {-# UNPACK #-} !HackInAutoImportedNamespace_id,
+                                                               hackInAutoImportedNamespace_key ::
+                                                               Prelude.Maybe
+                                                                 HackInAutoImportedNamespace_key}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackInAutoImportedNamespace where
+  toJSON (HackInAutoImportedNamespace __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackInAutoImportedNamespace where
+  buildStruct _proxy
+    (HackInAutoImportedNamespace __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (HackInAutoImportedNamespace __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackInAutoImportedNamespace where
+  rnf (HackInAutoImportedNamespace __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default HackInAutoImportedNamespace where
+  def = HackInAutoImportedNamespace Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackInAutoImportedNamespace where
+  hashWithSalt __salt (HackInAutoImportedNamespace _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchTypeInNamespace_key = SearchTypeInNamespace_key{searchTypeInNamespace_key_name
+                                                           :: Glean.Schema.Hack.Name,
+                                                           searchTypeInNamespace_key_namespace_ ::
+                                                           Prelude.Maybe
+                                                             Glean.Schema.Hack.NamespaceQName,
+                                                           searchTypeInNamespace_key_decl ::
+                                                           Glean.Schema.Hack.Declaration}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchTypeInNamespace_key where
+  toJSON
+    (SearchTypeInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchTypeInNamespace_key where
+  buildStruct _proxy
+    (SearchTypeInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchTypeInNamespace_key __val__name
+                                                  __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchTypeInNamespace_key where
+  rnf
+    (SearchTypeInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchTypeInNamespace_key where
+  def
+    = SearchTypeInNamespace_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchTypeInNamespace_key where
+  hashWithSalt __salt
+    (SearchTypeInNamespace_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchPropertyInContainer_key = SearchPropertyInContainer_key{searchPropertyInContainer_key_name
+                                                                   :: Glean.Schema.Hack.Name,
+                                                                   searchPropertyInContainer_key_containerName
+                                                                   :: Glean.Schema.Hack.Name,
+                                                                   searchPropertyInContainer_key_containerNamespace
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Hack.NamespaceQName,
+                                                                   searchPropertyInContainer_key_decl
+                                                                   :: Glean.Schema.Hack.Declaration}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchPropertyInContainer_key where
+  toJSON
+    (SearchPropertyInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containerName" .= __field__containerName :
+             Prelude.maybe Prelude.id ((:) . ("containerNamespace" .=))
+               __field__containerNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchPropertyInContainer_key where
+  buildStruct _proxy
+    (SearchPropertyInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containerName"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containerName)
+             :
+             let (__cereal__containerNamespace, __id__containerNamespace)
+                   = case __field__containerNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "containerNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__containerNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__containerNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containerName <- ST.newSTRef Default.def
+            __field__containerNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containerName <- ST.readSTRef
+                                                                        __field__containerName
+                                             !__val__containerNamespace <- ST.readSTRef
+                                                                             __field__containerNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchPropertyInContainer_key __val__name
+                                                  __val__containerName
+                                                  __val__containerNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("containerName", 2), ("containerNamespace", 3),
+                     ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchPropertyInContainer_key where
+  rnf
+    (SearchPropertyInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containerName `Prelude.seq`
+          DeepSeq.rnf __field__containerNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchPropertyInContainer_key where
+  def
+    = SearchPropertyInContainer_key Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchPropertyInContainer_key where
+  hashWithSalt __salt
+    (SearchPropertyInContainer_key _name _containerName
+       _containerNamespace _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _containerName)
+           _containerNamespace)
+        _decl
+
+data SearchNamespacedDecl_key = SearchNamespacedDecl_key{searchNamespacedDecl_key_name
+                                                         :: Glean.Schema.Hack.Name,
+                                                         searchNamespacedDecl_key_namespace_ ::
+                                                         Prelude.Maybe
+                                                           Glean.Schema.Hack.NamespaceQName,
+                                                         searchNamespacedDecl_key_decl ::
+                                                         Glean.Schema.Hack.Declaration}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespacedDecl_key where
+  toJSON
+    (SearchNamespacedDecl_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchNamespacedDecl_key where
+  buildStruct _proxy
+    (SearchNamespacedDecl_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchNamespacedDecl_key __val__name
+                                                  __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespacedDecl_key where
+  rnf
+    (SearchNamespacedDecl_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchNamespacedDecl_key where
+  def
+    = SearchNamespacedDecl_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchNamespacedDecl_key where
+  hashWithSalt __salt
+    (SearchNamespacedDecl_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchNamespace_key = SearchNamespace_key{searchNamespace_key_name
+                                               :: Glean.Schema.Hack.Name,
+                                               searchNamespace_key_namespace_ ::
+                                               Prelude.Maybe Glean.Schema.Hack.NamespaceQName,
+                                               searchNamespace_key_decl ::
+                                               Glean.Schema.Hack.Declaration}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchNamespace_key where
+  toJSON
+    (SearchNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchNamespace_key where
+  buildStruct _proxy
+    (SearchNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchNamespace_key __val__name __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchNamespace_key where
+  rnf
+    (SearchNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchNamespace_key where
+  def = SearchNamespace_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchNamespace_key where
+  hashWithSalt __salt (SearchNamespace_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchModule_key = SearchModule_key{searchModule_key_name ::
+                                         Glean.Schema.Hack.Name,
+                                         searchModule_key_decl :: Glean.Schema.Hack.Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchModule_key where
+  toJSON (SearchModule_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchModule_key where
+  buildStruct _proxy (SearchModule_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (SearchModule_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchModule_key where
+  rnf (SearchModule_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchModule_key where
+  def = SearchModule_key Default.def Default.def
+
+instance Hashable.Hashable SearchModule_key where
+  hashWithSalt __salt (SearchModule_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data SearchInNamespace_key = SearchInNamespace_key{searchInNamespace_key_name
+                                                   :: Glean.Schema.Hack.Name,
+                                                   searchInNamespace_key_namespace_ ::
+                                                   Prelude.Maybe Glean.Schema.Hack.NamespaceQName,
+                                                   searchInNamespace_key_decl ::
+                                                   Glean.Schema.Hack.Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInNamespace_key where
+  toJSON
+    (SearchInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInNamespace_key where
+  buildStruct _proxy
+    (SearchInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInNamespace_key __val__name __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInNamespace_key where
+  rnf
+    (SearchInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInNamespace_key where
+  def = SearchInNamespace_key Default.def Prelude.Nothing Default.def
+
+instance Hashable.Hashable SearchInNamespace_key where
+  hashWithSalt __salt (SearchInNamespace_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchInEnum_key = SearchInEnum_key{searchInEnum_key_name ::
+                                         Glean.Schema.Hack.Name,
+                                         searchInEnum_key_enumName :: Glean.Schema.Hack.Name,
+                                         searchInEnum_key_enumNamespace ::
+                                         Prelude.Maybe Glean.Schema.Hack.NamespaceQName,
+                                         searchInEnum_key_decl :: Glean.Schema.Hack.Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInEnum_key where
+  toJSON
+    (SearchInEnum_key __field__name __field__enumName
+       __field__enumNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "enumName" .= __field__enumName :
+             Prelude.maybe Prelude.id ((:) . ("enumNamespace" .=))
+               __field__enumNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInEnum_key where
+  buildStruct _proxy
+    (SearchInEnum_key __field__name __field__enumName
+       __field__enumNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "enumName" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__enumName)
+             :
+             let (__cereal__enumNamespace, __id__enumNamespace)
+                   = case __field__enumNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "enumNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__enumNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__enumNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__enumName <- ST.newSTRef Default.def
+            __field__enumNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__enumNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__enumName <- ST.readSTRef __field__enumName
+                                             !__val__enumNamespace <- ST.readSTRef
+                                                                        __field__enumNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInEnum_key __val__name __val__enumName
+                                                  __val__enumNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("enumName", 2), ("enumNamespace", 3), ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInEnum_key where
+  rnf
+    (SearchInEnum_key __field__name __field__enumName
+       __field__enumNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__enumName `Prelude.seq`
+          DeepSeq.rnf __field__enumNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInEnum_key where
+  def
+    = SearchInEnum_key Default.def Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchInEnum_key where
+  hashWithSalt __salt
+    (SearchInEnum_key _name _enumName _enumNamespace _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _enumName)
+           _enumNamespace)
+        _decl
+
+data SearchInContainerOrEnumNoProperty_key = SearchInContainerOrEnumNoProperty_key{searchInContainerOrEnumNoProperty_key_name
+                                                                                   ::
+                                                                                   Glean.Schema.Hack.Name,
+                                                                                   searchInContainerOrEnumNoProperty_key_contextName
+                                                                                   ::
+                                                                                   Glean.Schema.Hack.Name,
+                                                                                   searchInContainerOrEnumNoProperty_key_contextNamespace
+                                                                                   ::
+                                                                                   Prelude.Maybe
+                                                                                     Glean.Schema.Hack.NamespaceQName,
+                                                                                   searchInContainerOrEnumNoProperty_key_decl
+                                                                                   ::
+                                                                                   Glean.Schema.Hack.Declaration}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerOrEnumNoProperty_key where
+  toJSON
+    (SearchInContainerOrEnumNoProperty_key __field__name
+       __field__contextName __field__contextNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "contextName" .= __field__contextName :
+             Prelude.maybe Prelude.id ((:) . ("contextNamespace" .=))
+               __field__contextNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInContainerOrEnumNoProperty_key
+         where
+  buildStruct _proxy
+    (SearchInContainerOrEnumNoProperty_key __field__name
+       __field__contextName __field__contextNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "contextName" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__contextName)
+             :
+             let (__cereal__contextNamespace, __id__contextNamespace)
+                   = case __field__contextNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "contextNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__contextNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__contextNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__contextName <- ST.newSTRef Default.def
+            __field__contextNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contextName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contextNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__contextName <- ST.readSTRef
+                                                                      __field__contextName
+                                             !__val__contextNamespace <- ST.readSTRef
+                                                                           __field__contextNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInContainerOrEnumNoProperty_key __val__name
+                                                  __val__contextName
+                                                  __val__contextNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("contextName", 2), ("contextNamespace", 3),
+                     ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerOrEnumNoProperty_key where
+  rnf
+    (SearchInContainerOrEnumNoProperty_key __field__name
+       __field__contextName __field__contextNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__contextName `Prelude.seq`
+          DeepSeq.rnf __field__contextNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInContainerOrEnumNoProperty_key
+         where
+  def
+    = SearchInContainerOrEnumNoProperty_key Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchInContainerOrEnumNoProperty_key
+         where
+  hashWithSalt __salt
+    (SearchInContainerOrEnumNoProperty_key _name _contextName
+       _contextNamespace _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _contextName)
+           _contextNamespace)
+        _decl
+
+data SearchInContainerOrEnum_key = SearchInContainerOrEnum_key{searchInContainerOrEnum_key_name
+                                                               :: Glean.Schema.Hack.Name,
+                                                               searchInContainerOrEnum_key_contextName
+                                                               :: Glean.Schema.Hack.Name,
+                                                               searchInContainerOrEnum_key_contextNamespace
+                                                               ::
+                                                               Prelude.Maybe
+                                                                 Glean.Schema.Hack.NamespaceQName,
+                                                               searchInContainerOrEnum_key_decl ::
+                                                               Glean.Schema.Hack.Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerOrEnum_key where
+  toJSON
+    (SearchInContainerOrEnum_key __field__name __field__contextName
+       __field__contextNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "contextName" .= __field__contextName :
+             Prelude.maybe Prelude.id ((:) . ("contextNamespace" .=))
+               __field__contextNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInContainerOrEnum_key where
+  buildStruct _proxy
+    (SearchInContainerOrEnum_key __field__name __field__contextName
+       __field__contextNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "contextName" (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__contextName)
+             :
+             let (__cereal__contextNamespace, __id__contextNamespace)
+                   = case __field__contextNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "contextNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__contextNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__contextNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__contextName <- ST.newSTRef Default.def
+            __field__contextNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contextName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contextNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__contextName <- ST.readSTRef
+                                                                      __field__contextName
+                                             !__val__contextNamespace <- ST.readSTRef
+                                                                           __field__contextNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInContainerOrEnum_key __val__name
+                                                  __val__contextName
+                                                  __val__contextNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("contextName", 2), ("contextNamespace", 3),
+                     ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerOrEnum_key where
+  rnf
+    (SearchInContainerOrEnum_key __field__name __field__contextName
+       __field__contextNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__contextName `Prelude.seq`
+          DeepSeq.rnf __field__contextNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInContainerOrEnum_key where
+  def
+    = SearchInContainerOrEnum_key Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchInContainerOrEnum_key where
+  hashWithSalt __salt
+    (SearchInContainerOrEnum_key _name _contextName _contextNamespace
+       _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _contextName)
+           _contextNamespace)
+        _decl
+
+data SearchInContainerNoProperty_key = SearchInContainerNoProperty_key{searchInContainerNoProperty_key_name
+                                                                       :: Glean.Schema.Hack.Name,
+                                                                       searchInContainerNoProperty_key_containerName
+                                                                       :: Glean.Schema.Hack.Name,
+                                                                       searchInContainerNoProperty_key_containerNamespace
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         Glean.Schema.Hack.NamespaceQName,
+                                                                       searchInContainerNoProperty_key_decl
+                                                                       ::
+                                                                       Glean.Schema.Hack.Declaration}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainerNoProperty_key where
+  toJSON
+    (SearchInContainerNoProperty_key __field__name
+       __field__containerName __field__containerNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containerName" .= __field__containerName :
+             Prelude.maybe Prelude.id ((:) . ("containerNamespace" .=))
+               __field__containerNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInContainerNoProperty_key where
+  buildStruct _proxy
+    (SearchInContainerNoProperty_key __field__name
+       __field__containerName __field__containerNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containerName"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containerName)
+             :
+             let (__cereal__containerNamespace, __id__containerNamespace)
+                   = case __field__containerNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "containerNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__containerNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__containerNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containerName <- ST.newSTRef Default.def
+            __field__containerNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containerName <- ST.readSTRef
+                                                                        __field__containerName
+                                             !__val__containerNamespace <- ST.readSTRef
+                                                                             __field__containerNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInContainerNoProperty_key __val__name
+                                                  __val__containerName
+                                                  __val__containerNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("containerName", 2), ("containerNamespace", 3),
+                     ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainerNoProperty_key where
+  rnf
+    (SearchInContainerNoProperty_key __field__name
+       __field__containerName __field__containerNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containerName `Prelude.seq`
+          DeepSeq.rnf __field__containerNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInContainerNoProperty_key where
+  def
+    = SearchInContainerNoProperty_key Default.def Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchInContainerNoProperty_key where
+  hashWithSalt __salt
+    (SearchInContainerNoProperty_key _name _containerName
+       _containerNamespace _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _containerName)
+           _containerNamespace)
+        _decl
+
+data SearchInContainer_key = SearchInContainer_key{searchInContainer_key_name
+                                                   :: Glean.Schema.Hack.Name,
+                                                   searchInContainer_key_containerName ::
+                                                   Glean.Schema.Hack.Name,
+                                                   searchInContainer_key_containerNamespace ::
+                                                   Prelude.Maybe Glean.Schema.Hack.NamespaceQName,
+                                                   searchInContainer_key_decl ::
+                                                   Glean.Schema.Hack.Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchInContainer_key where
+  toJSON
+    (SearchInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "containerName" .= __field__containerName :
+             Prelude.maybe Prelude.id ((:) . ("containerNamespace" .=))
+               __field__containerNamespace
+               ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchInContainer_key where
+  buildStruct _proxy
+    (SearchInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "containerName"
+             (Thrift.getStructType _proxy)
+             2
+             1
+             (Thrift.buildStruct _proxy __field__containerName)
+             :
+             let (__cereal__containerNamespace, __id__containerNamespace)
+                   = case __field__containerNamespace of
+                       Prelude.Just _val -> ((:)
+                                               (Thrift.genField _proxy "containerNamespace"
+                                                  (Thrift.getStructType _proxy)
+                                                  3
+                                                  2
+                                                  (Thrift.buildStruct _proxy _val)),
+                                             3)
+                       Prelude.Nothing -> (Prelude.id, 2)
+               in
+               __cereal__containerNamespace
+                 (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4
+                    __id__containerNamespace
+                    (Thrift.buildStruct _proxy __field__decl)
+                    : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__containerName <- ST.newSTRef Default.def
+            __field__containerNamespace <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__containerNamespace
+                                                                          (Prelude.Just _val)
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__containerName <- ST.readSTRef
+                                                                        __field__containerName
+                                             !__val__containerNamespace <- ST.readSTRef
+                                                                             __field__containerNamespace
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchInContainer_key __val__name
+                                                  __val__containerName
+                                                  __val__containerNamespace
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("containerName", 2), ("containerNamespace", 3),
+                     ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchInContainer_key where
+  rnf
+    (SearchInContainer_key __field__name __field__containerName
+       __field__containerNamespace __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__containerName `Prelude.seq`
+          DeepSeq.rnf __field__containerNamespace `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchInContainer_key where
+  def
+    = SearchInContainer_key Default.def Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchInContainer_key where
+  hashWithSalt __salt
+    (SearchInContainer_key _name _containerName _containerNamespace
+       _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _containerName)
+           _containerNamespace)
+        _decl
+
+data SearchGlobalConstInNamespace_key = SearchGlobalConstInNamespace_key{searchGlobalConstInNamespace_key_name
+                                                                         :: Glean.Schema.Hack.Name,
+                                                                         searchGlobalConstInNamespace_key_namespace_
+                                                                         ::
+                                                                         Prelude.Maybe
+                                                                           Glean.Schema.Hack.NamespaceQName,
+                                                                         searchGlobalConstInNamespace_key_decl
+                                                                         ::
+                                                                         Glean.Schema.Hack.Declaration}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchGlobalConstInNamespace_key where
+  toJSON
+    (SearchGlobalConstInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchGlobalConstInNamespace_key where
+  buildStruct _proxy
+    (SearchGlobalConstInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchGlobalConstInNamespace_key __val__name
+                                                  __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchGlobalConstInNamespace_key where
+  rnf
+    (SearchGlobalConstInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchGlobalConstInNamespace_key where
+  def
+    = SearchGlobalConstInNamespace_key Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchGlobalConstInNamespace_key where
+  hashWithSalt __salt
+    (SearchGlobalConstInNamespace_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchFunctionInNamespace_key = SearchFunctionInNamespace_key{searchFunctionInNamespace_key_name
+                                                                   :: Glean.Schema.Hack.Name,
+                                                                   searchFunctionInNamespace_key_namespace_
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Hack.NamespaceQName,
+                                                                   searchFunctionInNamespace_key_decl
+                                                                   :: Glean.Schema.Hack.Declaration}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchFunctionInNamespace_key where
+  toJSON
+    (SearchFunctionInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("namespace_" .=))
+             __field__namespace_
+             ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct SearchFunctionInNamespace_key where
+  buildStruct _proxy
+    (SearchFunctionInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           let (__cereal__namespace_, __id__namespace_)
+                 = case __field__namespace_ of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "namespace_"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__namespace_
+               (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                  __id__namespace_
+                  (Thrift.buildStruct _proxy __field__decl)
+                  : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__namespace_ <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namespace_
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__namespace_ <- ST.readSTRef __field__namespace_
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (SearchFunctionInNamespace_key __val__name
+                                                  __val__namespace_
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList [("name", 1), ("namespace_", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchFunctionInNamespace_key where
+  rnf
+    (SearchFunctionInNamespace_key __field__name __field__namespace_
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__namespace_ `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchFunctionInNamespace_key where
+  def
+    = SearchFunctionInNamespace_key Default.def Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable SearchFunctionInNamespace_key where
+  hashWithSalt __salt
+    (SearchFunctionInNamespace_key _name _namespace_ _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _namespace_)
+        _decl
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Glean.Schema.Hack.Name,
+                                         searchByName_key_decl :: Glean.Schema.Hack.Declaration}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure (SearchByName_key __val__name __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _decl
+
+data QueryToScopeCase_key = QueryToScopeCase_key{queryToScopeCase_key_query
+                                                 :: [Text.Text],
+                                                 queryToScopeCase_key_insensitive :: Prelude.Bool,
+                                                 queryToScopeCase_key_scopeName ::
+                                                 Glean.Schema.Hack.Name,
+                                                 queryToScopeCase_key_scopeNamespace ::
+                                                 Prelude.Maybe Glean.Schema.Hack.NamespaceQName}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON QueryToScopeCase_key where
+  toJSON
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scopeName __field__scopeNamespace)
+    = Aeson.object
+        ("query" .= __field__query :
+           "insensitive" .= __field__insensitive :
+             "scopeName" .= __field__scopeName :
+               Prelude.maybe Prelude.id ((:) . ("scopeNamespace" .=))
+                 __field__scopeNamespace
+                 Prelude.mempty)
+
+instance Thrift.ThriftStruct QueryToScopeCase_key where
+  buildStruct _proxy
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scopeName __field__scopeNamespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "query" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__query)
+           :
+           Thrift.genFieldBool _proxy "insensitive" 2 1 __field__insensitive :
+             Thrift.genField _proxy "scopeName" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__scopeName)
+               :
+               case __field__scopeNamespace of
+                 Prelude.Just _val -> Thrift.genField _proxy "scopeNamespace"
+                                        (Thrift.getStructType _proxy)
+                                        4
+                                        3
+                                        (Thrift.buildStruct _proxy _val)
+                                        : []
+                 Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__query <- ST.newSTRef Default.def
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__scopeName <- ST.newSTRef Default.def
+            __field__scopeNamespace <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__query
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__scopeName
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__scopeNamespace
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__query <- ST.readSTRef __field__query
+                                             !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__scopeName <- ST.readSTRef __field__scopeName
+                                             !__val__scopeNamespace <- ST.readSTRef
+                                                                         __field__scopeNamespace
+                                             Prelude.pure
+                                               (QueryToScopeCase_key __val__query __val__insensitive
+                                                  __val__scopeName
+                                                  __val__scopeNamespace)
+              _idMap
+                = HashMap.fromList
+                    [("query", 1), ("insensitive", 2), ("scopeName", 3),
+                     ("scopeNamespace", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData QueryToScopeCase_key where
+  rnf
+    (QueryToScopeCase_key __field__query __field__insensitive
+       __field__scopeName __field__scopeNamespace)
+    = DeepSeq.rnf __field__query `Prelude.seq`
+        DeepSeq.rnf __field__insensitive `Prelude.seq`
+          DeepSeq.rnf __field__scopeName `Prelude.seq`
+            DeepSeq.rnf __field__scopeNamespace `Prelude.seq` ()
+
+instance Default.Default QueryToScopeCase_key where
+  def
+    = QueryToScopeCase_key Default.def Prelude.False Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable QueryToScopeCase_key where
+  hashWithSalt __salt
+    (QueryToScopeCase_key _query _insensitive _scopeName
+       _scopeNamespace)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _query)
+              _insensitive)
+           _scopeName)
+        _scopeNamespace
+
+data HackNameCase_key = HackNameCase_key{hackNameCase_key_insensitive
+                                         :: Prelude.Bool,
+                                         hackNameCase_key_namestr :: Text.Text,
+                                         hackNameCase_key_name :: Glean.Schema.Hack.Name}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackNameCase_key where
+  toJSON
+    (HackNameCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Aeson.object
+        ("insensitive" .= __field__insensitive :
+           "namestr" .= __field__namestr :
+             "name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct HackNameCase_key where
+  buildStruct _proxy
+    (HackNameCase_key __field__insensitive __field__namestr
+       __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "insensitive" 1 0 __field__insensitive
+           :
+           Thrift.genField _proxy "namestr" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__namestr)
+             :
+             Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__name)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__insensitive <- ST.newSTRef Prelude.False
+            __field__namestr <- ST.newSTRef ""
+            __field__name <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__insensitive
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__namestr
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__insensitive <- ST.readSTRef
+                                                                      __field__insensitive
+                                             !__val__namestr <- ST.readSTRef __field__namestr
+                                             !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure
+                                               (HackNameCase_key __val__insensitive __val__namestr
+                                                  __val__name)
+              _idMap
+                = HashMap.fromList
+                    [("insensitive", 1), ("namestr", 2), ("name", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData HackNameCase_key where
+  rnf
+    (HackNameCase_key __field__insensitive __field__namestr
+       __field__name)
+    = DeepSeq.rnf __field__insensitive `Prelude.seq`
+        DeepSeq.rnf __field__namestr `Prelude.seq`
+          DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default HackNameCase_key where
+  def = HackNameCase_key Prelude.False "" Default.def
+
+instance Hashable.Hashable HackNameCase_key where
+  hashWithSalt __salt (HackNameCase_key _insensitive _namestr _name)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _insensitive)
+           _namestr)
+        _name
+
+data HackInAutoImportedNamespace_key = HackInAutoImportedNamespace_key{hackInAutoImportedNamespace_key_name
+                                                                       :: Glean.Schema.Hack.Name,
+                                                                       hackInAutoImportedNamespace_key_parent
+                                                                       ::
+                                                                       Prelude.Maybe
+                                                                         Glean.Schema.Hack.NamespaceQName}
+                                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON HackInAutoImportedNamespace_key where
+  toJSON
+    (HackInAutoImportedNamespace_key __field__name __field__parent)
+    = Aeson.object
+        ("name" .= __field__name :
+           Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct HackInAutoImportedNamespace_key where
+  buildStruct _proxy
+    (HackInAutoImportedNamespace_key __field__name __field__parent)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           case __field__parent of
+             Prelude.Just _val -> Thrift.genField _proxy "parent"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             Prelude.pure
+                                               (HackInAutoImportedNamespace_key __val__name
+                                                  __val__parent)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData HackInAutoImportedNamespace_key where
+  rnf (HackInAutoImportedNamespace_key __field__name __field__parent)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq` ()
+
+instance Default.Default HackInAutoImportedNamespace_key where
+  def = HackInAutoImportedNamespace_key Default.def Prelude.Nothing
+
+instance Hashable.Hashable HackInAutoImportedNamespace_key where
+  hashWithSalt __salt (HackInAutoImportedNamespace_key _name _parent)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _parent
+{-# LINE 18 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.HackInAutoImportedNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace
+       = Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.HackInAutoImportedNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.hackInAutoImportedNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.hackInAutoImportedNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 39 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.HackInAutoImportedNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 45 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainer_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInContainer_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInContainer_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchInContainer_key"
+           (Prelude.Just 0))
+{-# LINE 58 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchInContainer_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "containerName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "containerNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 60 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchInContainer
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchInContainer =
+       Glean.Schema.SearchHack.Types.SearchInContainer_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchInContainer" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchInContainer_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInContainer x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchInContainer_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 69 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchInContainer
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 75 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchNamespacedDecl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchNamespacedDecl_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchNamespacedDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchNamespacedDecl_key"
+           (Prelude.Just 0))
+{-# LINE 86 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchNamespacedDecl_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 88 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchNamespacedDecl
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchNamespacedDecl =
+       Glean.Schema.SearchHack.Types.SearchNamespacedDecl_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchNamespacedDecl" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchNamespacedDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchNamespacedDecl x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchNamespacedDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 97 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchNamespacedDecl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 103 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchNamespace_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 116 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchNamespace
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchNamespace =
+       Glean.Schema.SearchHack.Types.SearchNamespace_key
+  getName _proxy = Glean.PredicateRef "search.hack.SearchNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchNamespace x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.HackNameCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.HackNameCase_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.HackNameCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.HackNameCase_key" (Prelude.Just 0))
+{-# LINE 142 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchHack.Types.HackNameCase_key =
+     'Angle.TField "insensitive" (Prelude.Bool)
+       ('Angle.TField "namestr" (Data.Text.Text)
+          ('Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+             ('Angle.TNoFields)))
+{-# LINE 144 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchHack.Types.HackNameCase
+         where
+  type KeyType Glean.Schema.SearchHack.Types.HackNameCase =
+       Glean.Schema.SearchHack.Types.HackNameCase_key
+  getName _proxy = Glean.PredicateRef "search.hack.HackNameCase" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.hackNameCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.HackNameCase x k
+  getFactKey = Glean.Schema.SearchHack.Types.hackNameCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 153 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.HackNameCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 159 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnum_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInContainerOrEnum_key x1 x2 x3
+       x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInContainerOrEnum_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchInContainerOrEnum_key"
+           (Prelude.Just 0))
+{-# LINE 172 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchInContainerOrEnum_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "contextName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "contextNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 174 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnum
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchInContainerOrEnum
+       = Glean.Schema.SearchHack.Types.SearchInContainerOrEnum_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchInContainerOrEnum" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchInContainerOrEnum_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInContainerOrEnum x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchInContainerOrEnum_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 183 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnum
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 189 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchTypeInNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchTypeInNamespace_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchTypeInNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchTypeInNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 200 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchTypeInNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 202 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchTypeInNamespace
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchTypeInNamespace =
+       Glean.Schema.SearchHack.Types.SearchTypeInNamespace_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchTypeInNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchTypeInNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchTypeInNamespace x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchTypeInNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 211 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchTypeInNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 217 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchInEnum_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInEnum_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInEnum_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchInEnum_key" (Prelude.Just 0))
+{-# LINE 230 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchHack.Types.SearchInEnum_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "enumName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "enumNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 232 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchHack.Types.SearchInEnum
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchInEnum =
+       Glean.Schema.SearchHack.Types.SearchInEnum_key
+  getName _proxy = Glean.PredicateRef "search.hack.SearchInEnum" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchInEnum_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInEnum x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchInEnum_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 241 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchInEnum
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 247 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.QueryToScopeCase_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.QueryToScopeCase_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.QueryToScopeCase_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.QueryToScopeCase_key"
+           (Prelude.Just 0))
+{-# LINE 260 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.QueryToScopeCase_key
+     =
+     'Angle.TField "query" ([Data.Text.Text])
+       ('Angle.TField "insensitive" (Prelude.Bool)
+          ('Angle.TField "scopeName"
+             (Glean.KeyType Glean.Schema.Hack.Types.Name)
+             ('Angle.TField "scopeNamespace"
+                (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+                ('Angle.TNoFields))))
+{-# LINE 262 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.QueryToScopeCase
+         where
+  type KeyType Glean.Schema.SearchHack.Types.QueryToScopeCase =
+       Glean.Schema.SearchHack.Types.QueryToScopeCase_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.QueryToScopeCase" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.queryToScopeCase_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.QueryToScopeCase x k
+  getFactKey = Glean.Schema.SearchHack.Types.queryToScopeCase_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 271 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.QueryToScopeCase
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 277 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchPropertyInContainer_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchPropertyInContainer_key x1 x2
+       x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchPropertyInContainer_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchPropertyInContainer_key"
+           (Prelude.Just 0))
+{-# LINE 290 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchPropertyInContainer_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "containerName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "containerNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 292 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchPropertyInContainer
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.SearchPropertyInContainer
+       = Glean.Schema.SearchHack.Types.SearchPropertyInContainer_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchPropertyInContainer" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchPropertyInContainer_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchPropertyInContainer x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchPropertyInContainer_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 302 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchPropertyInContainer
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 308 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchModule_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchModule_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchModule_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchModule_key" (Prelude.Just 0))
+{-# LINE 317 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchHack.Types.SearchModule_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 319 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchHack.Types.SearchModule
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchModule =
+       Glean.Schema.SearchHack.Types.SearchModule_key
+  getName _proxy = Glean.PredicateRef "search.hack.SearchModule" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchModule_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchModule x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchModule_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 328 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchModule
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 334 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInNamespace_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchInNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 345 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchInNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 347 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchInNamespace
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchInNamespace =
+       Glean.Schema.SearchHack.Types.SearchInNamespace_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchInNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchInNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInNamespace x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchInNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 356 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchInNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 362 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchByName_key" (Prelude.Just 0))
+{-# LINE 371 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchHack.Types.SearchByName_key =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 373 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchHack.Types.SearchByName
+         where
+  type KeyType Glean.Schema.SearchHack.Types.SearchByName =
+       Glean.Schema.SearchHack.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "search.hack.SearchByName" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHack.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchByName x k
+  getFactKey = Glean.Schema.SearchHack.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 382 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHack.Types.SearchByName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 388 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchGlobalConstInNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 399 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 401 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace
+       = Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchGlobalConstInNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchGlobalConstInNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchGlobalConstInNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 411 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchGlobalConstInNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 417 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "search.hack.SearchInContainerOrEnumNoProperty_key"
+           (Prelude.Just 0))
+{-# LINE 430 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "contextName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "contextNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 432 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty
+       =
+       Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty_key
+  getName _proxy
+    = Glean.PredicateRef
+        "search.hack.SearchInContainerOrEnumNoProperty"
+        7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchInContainerOrEnumNoProperty_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty x
+        k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchInContainerOrEnumNoProperty_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 442 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerOrEnumNoProperty
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 448 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerNoProperty_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchInContainerNoProperty_key x1
+       x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchInContainerNoProperty_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchInContainerNoProperty_key"
+           (Prelude.Just 0))
+{-# LINE 461 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchInContainerNoProperty_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "containerName"
+          (Glean.KeyType Glean.Schema.Hack.Types.Name)
+          ('Angle.TField "containerNamespace"
+             (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+             ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 463 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchInContainerNoProperty
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.SearchInContainerNoProperty
+       = Glean.Schema.SearchHack.Types.SearchInContainerNoProperty_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchInContainerNoProperty" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchInContainerNoProperty_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchInContainerNoProperty x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchInContainerNoProperty_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 473 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchInContainerNoProperty
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 479 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchFunctionInNamespace_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHack.Types.SearchFunctionInNamespace_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SearchHack.Types.SearchFunctionInNamespace_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hack.SearchFunctionInNamespace_key"
+           (Prelude.Just 0))
+{-# LINE 490 "glean/schema/thrift/search_hack_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHack.Types.SearchFunctionInNamespace_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Hack.Types.Name)
+       ('Angle.TField "namespace_"
+          (Prelude.Maybe Glean.Schema.Hack.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Hack.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 492 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHack.Types.SearchFunctionInNamespace
+         where
+  type KeyType
+         Glean.Schema.SearchHack.Types.SearchFunctionInNamespace
+       = Glean.Schema.SearchHack.Types.SearchFunctionInNamespace_key
+  getName _proxy
+    = Glean.PredicateRef "search.hack.SearchFunctionInNamespace" 7
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SearchHack.Types.searchFunctionInNamespace_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHack.Types.SearchFunctionInNamespace x k
+  getFactKey
+    = Glean.Schema.SearchHack.Types.searchFunctionInNamespace_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 502 "glean/schema/thrift/search_hack_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHack.Types.SearchFunctionInNamespace
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHs/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHs/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHs/Types.hs
@@ -0,0 +1,475 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_hs_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_hs_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_hs_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHs/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchHs.Types
+       (pREDICATE_VERSIONS, SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        SearchByLowerCaseName_id,
+        SearchByLowerCaseName(SearchByLowerCaseName,
+                              searchByLowerCaseName_id, searchByLowerCaseName_key),
+        SearchByName_key(SearchByName_key, searchByName_key_name,
+                         searchByName_key_entity),
+        SearchByLowerCaseName_key(SearchByLowerCaseName_key,
+                                  searchByLowerCaseName_key_name, searchByLowerCaseName_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeHs.Types as Glean.Schema.CodeHs
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_hs_include.hs" #-}
+import qualified Glean.Schema.CodeHs.Types
+{-# LINE 80 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchHs/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList [("SearchByName", 9), ("SearchByLowerCaseName", 9)]
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type SearchByLowerCaseName_id = Glean.Id
+
+data SearchByLowerCaseName = SearchByLowerCaseName{searchByLowerCaseName_id
+                                                   :: {-# UNPACK #-} !SearchByLowerCaseName_id,
+                                                   searchByLowerCaseName_key ::
+                                                   Prelude.Maybe SearchByLowerCaseName_key}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseName where
+  toJSON (SearchByLowerCaseName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseName where
+  buildStruct _proxy (SearchByLowerCaseName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (SearchByLowerCaseName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseName where
+  rnf (SearchByLowerCaseName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseName where
+  def = SearchByLowerCaseName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByLowerCaseName where
+  hashWithSalt __salt (SearchByLowerCaseName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchByName_key = SearchByName_key{searchByName_key_name ::
+                                         Text.Text,
+                                         searchByName_key_entity :: Glean.Schema.CodeHs.Entity}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy (SearchByName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key "" Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+
+data SearchByLowerCaseName_key = SearchByLowerCaseName_key{searchByLowerCaseName_key_name
+                                                           :: Text.Text,
+                                                           searchByLowerCaseName_key_entity ::
+                                                           Glean.Schema.CodeHs.Entity}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByLowerCaseName_key where
+  toJSON (SearchByLowerCaseName_key __field__name __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByLowerCaseName_key where
+  buildStruct _proxy
+    (SearchByLowerCaseName_key __field__name __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByLowerCaseName_key __val__name __val__entity)
+              _idMap = HashMap.fromList [("name", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByLowerCaseName_key where
+  rnf (SearchByLowerCaseName_key __field__name __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByLowerCaseName_key where
+  def = SearchByLowerCaseName_key "" Default.def
+
+instance Hashable.Hashable SearchByLowerCaseName_key where
+  hashWithSalt __salt (SearchByLowerCaseName_key _name _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _entity
+{-# LINE 18 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHs.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHs.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchHs.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hs.SearchByName_key" (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/search_hs_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchHs.Types.SearchByName_key =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.CodeHs.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchHs.Types.SearchByName
+         where
+  type KeyType Glean.Schema.SearchHs.Types.SearchByName =
+       Glean.Schema.SearchHs.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "search.hs.SearchByName" 9
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHs.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHs.Types.SearchByName x k
+  getFactKey = Glean.Schema.SearchHs.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchHs.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 44 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHs.Types.SearchByLowerCaseName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchHs.Types.SearchByLowerCaseName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchHs.Types.SearchByLowerCaseName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.hs.SearchByLowerCaseName_key"
+           (Prelude.Just 0))
+{-# LINE 53 "glean/schema/thrift/search_hs_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SearchHs.Types.SearchByLowerCaseName_key
+     =
+     'Angle.TField "name" (Data.Text.Text)
+       ('Angle.TField "entity" (Glean.Schema.CodeHs.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 55 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SearchHs.Types.SearchByLowerCaseName
+         where
+  type KeyType Glean.Schema.SearchHs.Types.SearchByLowerCaseName =
+       Glean.Schema.SearchHs.Types.SearchByLowerCaseName_key
+  getName _proxy
+    = Glean.PredicateRef "search.hs.SearchByLowerCaseName" 9
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchHs.Types.searchByLowerCaseName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchHs.Types.SearchByLowerCaseName x k
+  getFactKey = Glean.Schema.SearchHs.Types.searchByLowerCaseName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 64 "glean/schema/thrift/search_hs_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SearchHs.Types.SearchByLowerCaseName
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SearchPp/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchPp/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SearchPp/Types.hs
@@ -0,0 +1,269 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/search_pp_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/search_pp_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/search_pp_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchPp/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SearchPp.Types
+       (pREDICATE_VERSIONS, SearchByName_id,
+        SearchByName(SearchByName, searchByName_id, searchByName_key),
+        SearchByName_key(SearchByName_key, searchByName_key_macro,
+                         searchByName_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.Pp1.Types as Glean.Schema.Pp1
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/search_pp_include.hs" #-}
+import qualified Glean.Schema.Pp1.Types
+{-# LINE 75 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SearchPp/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("SearchByName", 2)]
+
+type SearchByName_id = Glean.Id
+
+data SearchByName = SearchByName{searchByName_id ::
+                                 {-# UNPACK #-} !SearchByName_id,
+                                 searchByName_key :: Prelude.Maybe SearchByName_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName where
+  toJSON (SearchByName __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName where
+  buildStruct _proxy (SearchByName __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (SearchByName __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName where
+  rnf (SearchByName __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default SearchByName where
+  def = SearchByName Default.def Prelude.Nothing
+
+instance Hashable.Hashable SearchByName where
+  hashWithSalt __salt (SearchByName _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data SearchByName_key = SearchByName_key{searchByName_key_macro ::
+                                         Glean.Schema.Pp1.Macro,
+                                         searchByName_key_entity :: Glean.Schema.Pp1.Define}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SearchByName_key where
+  toJSON (SearchByName_key __field__macro __field__entity)
+    = Aeson.object
+        ("macro" .= __field__macro :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct SearchByName_key where
+  buildStruct _proxy
+    (SearchByName_key __field__macro __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "macro" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__macro)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__macro <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__macro
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__macro <- ST.readSTRef __field__macro
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (SearchByName_key __val__macro __val__entity)
+              _idMap = HashMap.fromList [("macro", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData SearchByName_key where
+  rnf (SearchByName_key __field__macro __field__entity)
+    = DeepSeq.rnf __field__macro `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default SearchByName_key where
+  def = SearchByName_key Default.def Default.def
+
+instance Hashable.Hashable SearchByName_key where
+  hashWithSalt __salt (SearchByName_key _macro _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _macro)
+        _entity
+{-# LINE 18 "glean/schema/thrift/search_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchPp.Types.SearchByName_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SearchPp.Types.SearchByName_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SearchPp.Types.SearchByName_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "search.pp.SearchByName_key" (Prelude.Just 0))
+{-# LINE 27 "glean/schema/thrift/search_pp_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.SearchPp.Types.SearchByName_key =
+     'Angle.TField "macro" (Glean.KeyType Glean.Schema.Pp1.Types.Macro)
+       ('Angle.TField "entity"
+          (Glean.KeyType Glean.Schema.Pp1.Types.Define)
+          ('Angle.TNoFields))
+{-# LINE 29 "glean/schema/thrift/search_pp_include.hs" #-}
+instance Glean.Predicate Glean.Schema.SearchPp.Types.SearchByName
+         where
+  type KeyType Glean.Schema.SearchPp.Types.SearchByName =
+       Glean.Schema.SearchPp.Types.SearchByName_key
+  getName _proxy = Glean.PredicateRef "search.pp.SearchByName" 2
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SearchPp.Types.searchByName_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SearchPp.Types.SearchByName x k
+  getFactKey = Glean.Schema.SearchPp.Types.searchByName_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 38 "glean/schema/thrift/search_pp_include.hs" #-}
+instance Glean.Type Glean.Schema.SearchPp.Types.SearchByName where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Src/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Src/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Src/Types.hs
@@ -0,0 +1,2294 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/src_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/src_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/src_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Src/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Src.Types
+       (pREDICATE_VERSIONS, RangeContains_id,
+        RangeContains(RangeContains, rangeContains_id, rangeContains_key),
+        IndexFailure_id,
+        IndexFailure(IndexFailure, indexFailure_id, indexFailure_key),
+        FileLines_id, FileLines(FileLines, fileLines_id, fileLines_key),
+        FileLanguage_id,
+        FileLanguage(FileLanguage, fileLanguage_id, fileLanguage_key),
+        FileDigest_id,
+        FileDigest(FileDigest, fileDigest_id, fileDigest_key,
+                   fileDigest_value),
+        File_id, File(File, file_id, file_key), ByteSpanContains_id,
+        ByteSpanContains(ByteSpanContains, byteSpanContains_id,
+                         byteSpanContains_key),
+        RelByteSpan(RelByteSpan, relByteSpan_offset, relByteSpan_length),
+        Range(Range, range_file, range_lineBegin, range_columnBegin,
+              range_lineEnd, range_columnEnd),
+        RangeContains_key(RangeContains_key, rangeContains_key_fileLines,
+                          rangeContains_key_contains),
+        PackedByteSpansGroup(PackedByteSpansGroup,
+                             packedByteSpansGroup_length, packedByteSpansGroup_offsets),
+        PackedByteSpans, Loc(Loc, loc_file, loc_line, loc_column),
+        Language(Language_Buck, Language_C, Language_Cpp, Language_Hack,
+                 Language_Haskell, Language_ObjC, Language_ObjCpp, Language_Python,
+                 Language_Thrift, Language_Java, Language_GraphQL,
+                 Language__UNKNOWN),
+        IndexFailureReason(IndexFailureReason_CompileError,
+                           IndexFailureReason_BuildSystemError,
+                           IndexFailureReason_Unclassified, IndexFailureReason_DiscoveryError,
+                           IndexFailureReason__UNKNOWN),
+        IndexFailure_key(IndexFailure_key, indexFailure_key_file,
+                         indexFailure_key_reason, indexFailure_key_details),
+        FileLines_key(FileLines_key, fileLines_key_file,
+                      fileLines_key_lengths, fileLines_key_endsInNewline,
+                      fileLines_key_hasUnicodeOrTabs),
+        FileLanguage_key(FileLanguage_key, fileLanguage_key_file,
+                         fileLanguage_key_language),
+        FileDigest_value,
+        ByteSpan(ByteSpan, byteSpan_start, byteSpan_length),
+        ByteSpanContains_key(ByteSpanContains_key,
+                             byteSpanContains_key_byteSpan, byteSpanContains_key_contains),
+        FileLocation(FileLocation, fileLocation_file, fileLocation_span),
+        ByteRange(ByteRange, byteRange_begin, byteRange_end))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/src_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/src_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/src_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/src_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/src_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/src_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/src_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/src_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 114 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Src/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("File", 1), ("FileDigest", 1), ("FileLines", 1),
+       ("IndexFailure", 1), ("RangeContains", 1), ("ByteSpanContains", 1),
+       ("FileLanguage", 1)]
+
+type RangeContains_id = Glean.Id
+
+data RangeContains = RangeContains{rangeContains_id ::
+                                   {-# UNPACK #-} !RangeContains_id,
+                                   rangeContains_key :: Prelude.Maybe RangeContains_key}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeContains where
+  toJSON (RangeContains __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct RangeContains where
+  buildStruct _proxy (RangeContains __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (RangeContains __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RangeContains where
+  rnf (RangeContains __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default RangeContains where
+  def = RangeContains Default.def Prelude.Nothing
+
+instance Hashable.Hashable RangeContains where
+  hashWithSalt __salt (RangeContains _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type IndexFailure_id = Glean.Id
+
+data IndexFailure = IndexFailure{indexFailure_id ::
+                                 {-# UNPACK #-} !IndexFailure_id,
+                                 indexFailure_key :: Prelude.Maybe IndexFailure_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailure where
+  toJSON (IndexFailure __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexFailure where
+  buildStruct _proxy (IndexFailure __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (IndexFailure __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexFailure where
+  rnf (IndexFailure __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default IndexFailure where
+  def = IndexFailure Default.def Prelude.Nothing
+
+instance Hashable.Hashable IndexFailure where
+  hashWithSalt __salt (IndexFailure _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileLines_id = Glean.Id
+
+data FileLines = FileLines{fileLines_id ::
+                           {-# UNPACK #-} !FileLines_id,
+                           fileLines_key :: Prelude.Maybe FileLines_key}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLines where
+  toJSON (FileLines __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLines where
+  buildStruct _proxy (FileLines __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileLines __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLines where
+  rnf (FileLines __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileLines where
+  def = FileLines Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileLines where
+  hashWithSalt __salt (FileLines _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileLanguage_id = Glean.Id
+
+data FileLanguage = FileLanguage{fileLanguage_id ::
+                                 {-# UNPACK #-} !FileLanguage_id,
+                                 fileLanguage_key :: Prelude.Maybe FileLanguage_key}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLanguage where
+  toJSON (FileLanguage __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLanguage where
+  buildStruct _proxy (FileLanguage __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (FileLanguage __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLanguage where
+  rnf (FileLanguage __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default FileLanguage where
+  def = FileLanguage Default.def Prelude.Nothing
+
+instance Hashable.Hashable FileLanguage where
+  hashWithSalt __salt (FileLanguage _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type FileDigest_id = Glean.Id
+
+data FileDigest = FileDigest{fileDigest_id ::
+                             {-# UNPACK #-} !FileDigest_id,
+                             fileDigest_key :: Prelude.Maybe File,
+                             fileDigest_value :: Prelude.Maybe FileDigest_value}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileDigest where
+  toJSON (FileDigest __field__id __field__key __field__value)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             (Prelude.maybe Prelude.id ((:) . ("value" .=)) __field__value
+                Prelude.mempty))
+
+instance Thrift.ThriftStruct FileDigest where
+  buildStruct _proxy
+    (FileDigest __field__id __field__key __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           let (__cereal__key, __id__key)
+                 = case __field__key of
+                     Prelude.Just _val -> ((:)
+                                             (Thrift.genField _proxy "key"
+                                                (Thrift.getStructType _proxy)
+                                                2
+                                                1
+                                                (Thrift.buildStruct _proxy _val)),
+                                           2)
+                     Prelude.Nothing -> (Prelude.id, 1)
+             in
+             __cereal__key
+               (case __field__value of
+                  Prelude.Just _val -> Thrift.genField _proxy "value"
+                                         (Thrift.getStringType _proxy)
+                                         3
+                                         __id__key
+                                         (Thrift.genText _proxy _val)
+                                         : []
+                  Prelude.Nothing -> []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            __field__value <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure
+                                               (FileDigest __val__id __val__key __val__value)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2), ("value", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData FileDigest where
+  rnf (FileDigest __field__id __field__key __field__value)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq`
+          DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default FileDigest where
+  def = FileDigest Default.def Prelude.Nothing Prelude.Nothing
+
+instance Hashable.Hashable FileDigest where
+  hashWithSalt __salt (FileDigest _id _key _value)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key)
+        _value
+
+type File_id = Glean.Id
+
+data File = File{file_id :: {-# UNPACK #-} !File_id,
+                 file_key :: Prelude.Maybe Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON File where
+  toJSON (File __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct File where
+  buildStruct _proxy (File __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genText _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (File __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData File where
+  rnf (File __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default File where
+  def = File Default.def Prelude.Nothing
+
+instance Hashable.Hashable File where
+  hashWithSalt __salt (File _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type ByteSpanContains_id = Glean.Id
+
+data ByteSpanContains = ByteSpanContains{byteSpanContains_id ::
+                                         {-# UNPACK #-} !ByteSpanContains_id,
+                                         byteSpanContains_key :: Prelude.Maybe ByteSpanContains_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ByteSpanContains where
+  toJSON (ByteSpanContains __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ByteSpanContains where
+  buildStruct _proxy (ByteSpanContains __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (ByteSpanContains __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ByteSpanContains where
+  rnf (ByteSpanContains __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default ByteSpanContains where
+  def = ByteSpanContains Default.def Prelude.Nothing
+
+instance Hashable.Hashable ByteSpanContains where
+  hashWithSalt __salt (ByteSpanContains _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data RelByteSpan = RelByteSpan{relByteSpan_offset :: Glean.Nat,
+                               relByteSpan_length :: Glean.Nat}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RelByteSpan where
+  toJSON (RelByteSpan __field__offset __field__length)
+    = Aeson.object
+        ("offset" .= Glean.unNat __field__offset :
+           "length" .= Glean.unNat __field__length : Prelude.mempty)
+
+instance Thrift.ThriftStruct RelByteSpan where
+  buildStruct _proxy (RelByteSpan __field__offset __field__length)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "offset" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__offset)
+           :
+           Thrift.genField _proxy "length" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__length)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__offset <- ST.newSTRef (Glean.Nat Default.def)
+            __field__length <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__offset
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__length
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__offset <- ST.readSTRef
+                                                                 __field__offset
+                                             !__val__length <- ST.readSTRef __field__length
+                                             Prelude.pure (RelByteSpan __val__offset __val__length)
+              _idMap = HashMap.fromList [("offset", 1), ("length", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RelByteSpan where
+  rnf (RelByteSpan __field__offset __field__length)
+    = DeepSeq.rnf __field__offset `Prelude.seq`
+        DeepSeq.rnf __field__length `Prelude.seq` ()
+
+instance Default.Default RelByteSpan where
+  def = RelByteSpan (Glean.Nat Default.def) (Glean.Nat Default.def)
+
+instance Hashable.Hashable RelByteSpan where
+  hashWithSalt __salt (RelByteSpan _offset _length)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _offset)
+        _length
+
+data Range = Range{range_file :: File,
+                   range_lineBegin :: Glean.Nat, range_columnBegin :: Glean.Nat,
+                   range_lineEnd :: Glean.Nat, range_columnEnd :: Glean.Nat}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Range where
+  toJSON
+    (Range __field__file __field__lineBegin __field__columnBegin
+       __field__lineEnd __field__columnEnd)
+    = Aeson.object
+        ("file" .= __field__file :
+           "lineBegin" .= Glean.unNat __field__lineBegin :
+             "columnBegin" .= Glean.unNat __field__columnBegin :
+               "lineEnd" .= Glean.unNat __field__lineEnd :
+                 "columnEnd" .= Glean.unNat __field__columnEnd : Prelude.mempty)
+
+instance Thrift.ThriftStruct Range where
+  buildStruct _proxy
+    (Range __field__file __field__lineBegin __field__columnBegin
+       __field__lineEnd __field__columnEnd)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "lineBegin" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__lineBegin)
+             :
+             Thrift.genField _proxy "columnBegin" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__columnBegin)
+               :
+               Thrift.genField _proxy "lineEnd" (Thrift.getI64Type _proxy) 4 3
+                 ((Thrift.genI64 _proxy . Glean.unNat) __field__lineEnd)
+                 :
+                 Thrift.genField _proxy "columnEnd" (Thrift.getI64Type _proxy) 5 4
+                   ((Thrift.genI64 _proxy . Glean.unNat) __field__columnEnd)
+                   : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__lineBegin <- ST.newSTRef (Glean.Nat Default.def)
+            __field__columnBegin <- ST.newSTRef (Glean.Nat Default.def)
+            __field__lineEnd <- ST.newSTRef (Glean.Nat Default.def)
+            __field__columnEnd <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__lineBegin
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__columnBegin
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__lineEnd
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__columnEnd
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__lineBegin <- ST.readSTRef __field__lineBegin
+                                             !__val__columnBegin <- ST.readSTRef
+                                                                      __field__columnBegin
+                                             !__val__lineEnd <- ST.readSTRef __field__lineEnd
+                                             !__val__columnEnd <- ST.readSTRef __field__columnEnd
+                                             Prelude.pure
+                                               (Range __val__file __val__lineBegin
+                                                  __val__columnBegin
+                                                  __val__lineEnd
+                                                  __val__columnEnd)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("lineBegin", 2), ("columnBegin", 3), ("lineEnd", 4),
+                     ("columnEnd", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData Range where
+  rnf
+    (Range __field__file __field__lineBegin __field__columnBegin
+       __field__lineEnd __field__columnEnd)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__lineBegin `Prelude.seq`
+          DeepSeq.rnf __field__columnBegin `Prelude.seq`
+            DeepSeq.rnf __field__lineEnd `Prelude.seq`
+              DeepSeq.rnf __field__columnEnd `Prelude.seq` ()
+
+instance Default.Default Range where
+  def
+    = Range Default.def (Glean.Nat Default.def) (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+        (Glean.Nat Default.def)
+
+instance Hashable.Hashable Range where
+  hashWithSalt __salt
+    (Range _file _lineBegin _columnBegin _lineEnd _columnEnd)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+                 _lineBegin)
+              _columnBegin)
+           _lineEnd)
+        _columnEnd
+
+data RangeContains_key = RangeContains_key{rangeContains_key_fileLines
+                                           :: Range,
+                                           rangeContains_key_contains :: Range}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RangeContains_key where
+  toJSON (RangeContains_key __field__fileLines __field__contains)
+    = Aeson.object
+        ("fileLines" .= __field__fileLines :
+           "contains" .= __field__contains : Prelude.mempty)
+
+instance Thrift.ThriftStruct RangeContains_key where
+  buildStruct _proxy
+    (RangeContains_key __field__fileLines __field__contains)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "fileLines" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__fileLines)
+           :
+           Thrift.genField _proxy "contains" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__contains)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__fileLines <- ST.newSTRef Default.def
+            __field__contains <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__fileLines
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contains
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__fileLines <- ST.readSTRef
+                                                                    __field__fileLines
+                                             !__val__contains <- ST.readSTRef __field__contains
+                                             Prelude.pure
+                                               (RangeContains_key __val__fileLines __val__contains)
+              _idMap = HashMap.fromList [("fileLines", 1), ("contains", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData RangeContains_key where
+  rnf (RangeContains_key __field__fileLines __field__contains)
+    = DeepSeq.rnf __field__fileLines `Prelude.seq`
+        DeepSeq.rnf __field__contains `Prelude.seq` ()
+
+instance Default.Default RangeContains_key where
+  def = RangeContains_key Default.def Default.def
+
+instance Hashable.Hashable RangeContains_key where
+  hashWithSalt __salt (RangeContains_key _fileLines _contains)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _fileLines)
+        _contains
+
+data PackedByteSpansGroup = PackedByteSpansGroup{packedByteSpansGroup_length
+                                                 :: Glean.Nat,
+                                                 packedByteSpansGroup_offsets :: [Glean.Nat]}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackedByteSpansGroup where
+  toJSON (PackedByteSpansGroup __field__length __field__offsets)
+    = Aeson.object
+        ("length" .= Glean.unNat __field__length :
+           "offsets" .= Prelude.map Glean.unNat __field__offsets :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct PackedByteSpansGroup where
+  buildStruct _proxy
+    (PackedByteSpansGroup __field__length __field__offsets)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "length" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__length)
+           :
+           Thrift.genField _proxy "offsets" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                (Thrift.genI64 _proxy . Glean.unNat)
+                __field__offsets)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__length <- ST.newSTRef (Glean.Nat Default.def)
+            __field__offsets <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__length
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           Glean.Nat
+                                                                                           (Thrift.parseI64
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__offsets
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__length <- ST.readSTRef
+                                                                 __field__length
+                                             !__val__offsets <- ST.readSTRef __field__offsets
+                                             Prelude.pure
+                                               (PackedByteSpansGroup __val__length __val__offsets)
+              _idMap = HashMap.fromList [("length", 1), ("offsets", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData PackedByteSpansGroup where
+  rnf (PackedByteSpansGroup __field__length __field__offsets)
+    = DeepSeq.rnf __field__length `Prelude.seq`
+        DeepSeq.rnf __field__offsets `Prelude.seq` ()
+
+instance Default.Default PackedByteSpansGroup where
+  def = PackedByteSpansGroup (Glean.Nat Default.def) Default.def
+
+instance Hashable.Hashable PackedByteSpansGroup where
+  hashWithSalt __salt (PackedByteSpansGroup _length _offsets)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _length)
+        _offsets
+
+type PackedByteSpans = [PackedByteSpansGroup]
+
+data Loc = Loc{loc_file :: File, loc_line :: Glean.Nat,
+               loc_column :: Glean.Nat}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Loc where
+  toJSON (Loc __field__file __field__line __field__column)
+    = Aeson.object
+        ("file" .= __field__file :
+           "line" .= Glean.unNat __field__line :
+             "column" .= Glean.unNat __field__column : Prelude.mempty)
+
+instance Thrift.ThriftStruct Loc where
+  buildStruct _proxy
+    (Loc __field__file __field__line __field__column)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "line" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__line)
+             :
+             Thrift.genField _proxy "column" (Thrift.getI64Type _proxy) 3 2
+               ((Thrift.genI64 _proxy . Glean.unNat) __field__column)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__line <- ST.newSTRef (Glean.Nat Default.def)
+            __field__column <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__line
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__column
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__line <- ST.readSTRef __field__line
+                                             !__val__column <- ST.readSTRef __field__column
+                                             Prelude.pure
+                                               (Loc __val__file __val__line __val__column)
+              _idMap = HashMap.fromList [("file", 1), ("line", 2), ("column", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Loc where
+  rnf (Loc __field__file __field__line __field__column)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__line `Prelude.seq`
+          DeepSeq.rnf __field__column `Prelude.seq` ()
+
+instance Default.Default Loc where
+  def
+    = Loc Default.def (Glean.Nat Default.def) (Glean.Nat Default.def)
+
+instance Hashable.Hashable Loc where
+  hashWithSalt __salt (Loc _file _line _column)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _line)
+        _column
+
+data Language = Language_Buck
+              | Language_C
+              | Language_Cpp
+              | Language_Hack
+              | Language_Haskell
+              | Language_ObjC
+              | Language_ObjCpp
+              | Language_Python
+              | Language_Thrift
+              | Language_Java
+              | Language_GraphQL
+              | Language__UNKNOWN Prelude.Int
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Language where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData Language where
+  rnf __Language = Prelude.seq __Language ()
+
+instance Default.Default Language where
+  def = Language_Buck
+
+instance Hashable.Hashable Language where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum Language where
+  toThriftEnum 0 = Language_Buck
+  toThriftEnum 1 = Language_C
+  toThriftEnum 2 = Language_Cpp
+  toThriftEnum 3 = Language_Hack
+  toThriftEnum 4 = Language_Haskell
+  toThriftEnum 5 = Language_ObjC
+  toThriftEnum 6 = Language_ObjCpp
+  toThriftEnum 7 = Language_Python
+  toThriftEnum 8 = Language_Thrift
+  toThriftEnum 9 = Language_Java
+  toThriftEnum 10 = Language_GraphQL
+  toThriftEnum val = Language__UNKNOWN val
+  fromThriftEnum Language_Buck = 0
+  fromThriftEnum Language_C = 1
+  fromThriftEnum Language_Cpp = 2
+  fromThriftEnum Language_Hack = 3
+  fromThriftEnum Language_Haskell = 4
+  fromThriftEnum Language_ObjC = 5
+  fromThriftEnum Language_ObjCpp = 6
+  fromThriftEnum Language_Python = 7
+  fromThriftEnum Language_Thrift = 8
+  fromThriftEnum Language_Java = 9
+  fromThriftEnum Language_GraphQL = 10
+  fromThriftEnum (Language__UNKNOWN val) = val
+  allThriftEnumValues
+    = [Language_Buck, Language_C, Language_Cpp, Language_Hack,
+       Language_Haskell, Language_ObjC, Language_ObjCpp, Language_Python,
+       Language_Thrift, Language_Java, Language_GraphQL]
+  toThriftEnumEither 0 = Prelude.Right Language_Buck
+  toThriftEnumEither 1 = Prelude.Right Language_C
+  toThriftEnumEither 2 = Prelude.Right Language_Cpp
+  toThriftEnumEither 3 = Prelude.Right Language_Hack
+  toThriftEnumEither 4 = Prelude.Right Language_Haskell
+  toThriftEnumEither 5 = Prelude.Right Language_ObjC
+  toThriftEnumEither 6 = Prelude.Right Language_ObjCpp
+  toThriftEnumEither 7 = Prelude.Right Language_Python
+  toThriftEnumEither 8 = Prelude.Right Language_Thrift
+  toThriftEnumEither 9 = Prelude.Right Language_Java
+  toThriftEnumEither 10 = Prelude.Right Language_GraphQL
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum Language: "
+           ++ Prelude.show val)
+
+data IndexFailureReason = IndexFailureReason_CompileError
+                        | IndexFailureReason_BuildSystemError
+                        | IndexFailureReason_Unclassified
+                        | IndexFailureReason_DiscoveryError
+                        | IndexFailureReason__UNKNOWN Prelude.Int
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailureReason where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData IndexFailureReason where
+  rnf __IndexFailureReason = Prelude.seq __IndexFailureReason ()
+
+instance Default.Default IndexFailureReason where
+  def = IndexFailureReason_CompileError
+
+instance Hashable.Hashable IndexFailureReason where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum IndexFailureReason where
+  toThriftEnum 0 = IndexFailureReason_CompileError
+  toThriftEnum 1 = IndexFailureReason_BuildSystemError
+  toThriftEnum 2 = IndexFailureReason_Unclassified
+  toThriftEnum 3 = IndexFailureReason_DiscoveryError
+  toThriftEnum val = IndexFailureReason__UNKNOWN val
+  fromThriftEnum IndexFailureReason_CompileError = 0
+  fromThriftEnum IndexFailureReason_BuildSystemError = 1
+  fromThriftEnum IndexFailureReason_Unclassified = 2
+  fromThriftEnum IndexFailureReason_DiscoveryError = 3
+  fromThriftEnum (IndexFailureReason__UNKNOWN val) = val
+  allThriftEnumValues
+    = [IndexFailureReason_CompileError,
+       IndexFailureReason_BuildSystemError,
+       IndexFailureReason_Unclassified, IndexFailureReason_DiscoveryError]
+  toThriftEnumEither 0
+    = Prelude.Right IndexFailureReason_CompileError
+  toThriftEnumEither 1
+    = Prelude.Right IndexFailureReason_BuildSystemError
+  toThriftEnumEither 2
+    = Prelude.Right IndexFailureReason_Unclassified
+  toThriftEnumEither 3
+    = Prelude.Right IndexFailureReason_DiscoveryError
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum IndexFailureReason: "
+           ++ Prelude.show val)
+
+data IndexFailure_key = IndexFailure_key{indexFailure_key_file ::
+                                         File,
+                                         indexFailure_key_reason :: IndexFailureReason,
+                                         indexFailure_key_details :: Text.Text}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON IndexFailure_key where
+  toJSON
+    (IndexFailure_key __field__file __field__reason __field__details)
+    = Aeson.object
+        ("file" .= __field__file :
+           "reason" .= __field__reason :
+             "details" .= __field__details : Prelude.mempty)
+
+instance Thrift.ThriftStruct IndexFailure_key where
+  buildStruct _proxy
+    (IndexFailure_key __field__file __field__reason __field__details)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "reason" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__reason)
+             :
+             Thrift.genField _proxy "details" (Thrift.getStringType _proxy) 3 2
+               (Thrift.genText _proxy __field__details)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__reason <- ST.newSTRef Default.def
+            __field__details <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "IndexFailureReason")
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__details
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             !__val__details <- ST.readSTRef __field__details
+                                             Prelude.pure
+                                               (IndexFailure_key __val__file __val__reason
+                                                  __val__details)
+              _idMap
+                = HashMap.fromList [("file", 1), ("reason", 2), ("details", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData IndexFailure_key where
+  rnf
+    (IndexFailure_key __field__file __field__reason __field__details)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__reason `Prelude.seq`
+          DeepSeq.rnf __field__details `Prelude.seq` ()
+
+instance Default.Default IndexFailure_key where
+  def = IndexFailure_key Default.def Default.def ""
+
+instance Hashable.Hashable IndexFailure_key where
+  hashWithSalt __salt (IndexFailure_key _file _reason _details)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+           _reason)
+        _details
+
+data FileLines_key = FileLines_key{fileLines_key_file :: File,
+                                   fileLines_key_lengths :: [Glean.Nat],
+                                   fileLines_key_endsInNewline :: Prelude.Bool,
+                                   fileLines_key_hasUnicodeOrTabs :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLines_key where
+  toJSON
+    (FileLines_key __field__file __field__lengths
+       __field__endsInNewline __field__hasUnicodeOrTabs)
+    = Aeson.object
+        ("file" .= __field__file :
+           "lengths" .= Prelude.map Glean.unNat __field__lengths :
+             "endsInNewline" .= __field__endsInNewline :
+               "hasUnicodeOrTabs" .= __field__hasUnicodeOrTabs : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLines_key where
+  buildStruct _proxy
+    (FileLines_key __field__file __field__lengths
+       __field__endsInNewline __field__hasUnicodeOrTabs)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "lengths" (Thrift.getListType _proxy) 2 1
+             (Thrift.genList _proxy (Thrift.getI64Type _proxy)
+                (Thrift.genI64 _proxy . Glean.unNat)
+                __field__lengths)
+             :
+             Thrift.genFieldBool _proxy "endsInNewline" 3 2
+               __field__endsInNewline
+               :
+               Thrift.genFieldBool _proxy "hasUnicodeOrTabs" 4 3
+                 __field__hasUnicodeOrTabs
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__lengths <- ST.newSTRef Default.def
+            __field__endsInNewline <- ST.newSTRef Prelude.False
+            __field__hasUnicodeOrTabs <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Prelude.fmap
+                                                                                           Glean.Nat
+                                                                                           (Thrift.parseI64
+                                                                                              _proxy)))
+                                                                        ST.writeSTRef
+                                                                          __field__lengths
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__endsInNewline
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__hasUnicodeOrTabs
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__lengths <- ST.readSTRef __field__lengths
+                                             !__val__endsInNewline <- ST.readSTRef
+                                                                        __field__endsInNewline
+                                             !__val__hasUnicodeOrTabs <- ST.readSTRef
+                                                                           __field__hasUnicodeOrTabs
+                                             Prelude.pure
+                                               (FileLines_key __val__file __val__lengths
+                                                  __val__endsInNewline
+                                                  __val__hasUnicodeOrTabs)
+              _idMap
+                = HashMap.fromList
+                    [("file", 1), ("lengths", 2), ("endsInNewline", 3),
+                     ("hasUnicodeOrTabs", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLines_key where
+  rnf
+    (FileLines_key __field__file __field__lengths
+       __field__endsInNewline __field__hasUnicodeOrTabs)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__lengths `Prelude.seq`
+          DeepSeq.rnf __field__endsInNewline `Prelude.seq`
+            DeepSeq.rnf __field__hasUnicodeOrTabs `Prelude.seq` ()
+
+instance Default.Default FileLines_key where
+  def
+    = FileLines_key Default.def Default.def Prelude.False Prelude.False
+
+instance Hashable.Hashable FileLines_key where
+  hashWithSalt __salt
+    (FileLines_key _file _lengths _endsInNewline _hasUnicodeOrTabs)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+              _lengths)
+           _endsInNewline)
+        _hasUnicodeOrTabs
+
+data FileLanguage_key = FileLanguage_key{fileLanguage_key_file ::
+                                         File,
+                                         fileLanguage_key_language :: Language}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLanguage_key where
+  toJSON (FileLanguage_key __field__file __field__language)
+    = Aeson.object
+        ("file" .= __field__file :
+           "language" .= __field__language : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLanguage_key where
+  buildStruct _proxy
+    (FileLanguage_key __field__file __field__language)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "language" (Thrift.getI32Type _proxy) 2 1
+             ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+                 Thrift.fromThriftEnum)
+                __field__language)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__language <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "Language")
+                                                                        ST.writeSTRef
+                                                                          __field__language
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__language <- ST.readSTRef __field__language
+                                             Prelude.pure
+                                               (FileLanguage_key __val__file __val__language)
+              _idMap = HashMap.fromList [("file", 1), ("language", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLanguage_key where
+  rnf (FileLanguage_key __field__file __field__language)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__language `Prelude.seq` ()
+
+instance Default.Default FileLanguage_key where
+  def = FileLanguage_key Default.def Default.def
+
+instance Hashable.Hashable FileLanguage_key where
+  hashWithSalt __salt (FileLanguage_key _file _language)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file)
+        _language
+
+type FileDigest_value = Text.Text
+
+data ByteSpan = ByteSpan{byteSpan_start :: Glean.Nat,
+                         byteSpan_length :: Glean.Nat}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ByteSpan where
+  toJSON (ByteSpan __field__start __field__length)
+    = Aeson.object
+        ("start" .= Glean.unNat __field__start :
+           "length" .= Glean.unNat __field__length : Prelude.mempty)
+
+instance Thrift.ThriftStruct ByteSpan where
+  buildStruct _proxy (ByteSpan __field__start __field__length)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "start" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__start)
+           :
+           Thrift.genField _proxy "length" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__length)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__start <- ST.newSTRef (Glean.Nat Default.def)
+            __field__length <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__start
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__length
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__start <- ST.readSTRef __field__start
+                                             !__val__length <- ST.readSTRef __field__length
+                                             Prelude.pure (ByteSpan __val__start __val__length)
+              _idMap = HashMap.fromList [("start", 1), ("length", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ByteSpan where
+  rnf (ByteSpan __field__start __field__length)
+    = DeepSeq.rnf __field__start `Prelude.seq`
+        DeepSeq.rnf __field__length `Prelude.seq` ()
+
+instance Default.Default ByteSpan where
+  def = ByteSpan (Glean.Nat Default.def) (Glean.Nat Default.def)
+
+instance Hashable.Hashable ByteSpan where
+  hashWithSalt __salt (ByteSpan _start _length)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _start)
+        _length
+
+data ByteSpanContains_key = ByteSpanContains_key{byteSpanContains_key_byteSpan
+                                                 :: ByteSpan,
+                                                 byteSpanContains_key_contains :: ByteSpan}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ByteSpanContains_key where
+  toJSON (ByteSpanContains_key __field__byteSpan __field__contains)
+    = Aeson.object
+        ("byteSpan" .= __field__byteSpan :
+           "contains" .= __field__contains : Prelude.mempty)
+
+instance Thrift.ThriftStruct ByteSpanContains_key where
+  buildStruct _proxy
+    (ByteSpanContains_key __field__byteSpan __field__contains)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "byteSpan" (Thrift.getStructType _proxy) 1
+           0
+           (Thrift.buildStruct _proxy __field__byteSpan)
+           :
+           Thrift.genField _proxy "contains" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__contains)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__byteSpan <- ST.newSTRef Default.def
+            __field__contains <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__byteSpan
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__contains
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__byteSpan <- ST.readSTRef
+                                                                   __field__byteSpan
+                                             !__val__contains <- ST.readSTRef __field__contains
+                                             Prelude.pure
+                                               (ByteSpanContains_key __val__byteSpan
+                                                  __val__contains)
+              _idMap = HashMap.fromList [("byteSpan", 1), ("contains", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ByteSpanContains_key where
+  rnf (ByteSpanContains_key __field__byteSpan __field__contains)
+    = DeepSeq.rnf __field__byteSpan `Prelude.seq`
+        DeepSeq.rnf __field__contains `Prelude.seq` ()
+
+instance Default.Default ByteSpanContains_key where
+  def = ByteSpanContains_key Default.def Default.def
+
+instance Hashable.Hashable ByteSpanContains_key where
+  hashWithSalt __salt (ByteSpanContains_key _byteSpan _contains)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _byteSpan)
+        _contains
+
+data FileLocation = FileLocation{fileLocation_file :: File,
+                                 fileLocation_span :: ByteSpan}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FileLocation where
+  toJSON (FileLocation __field__file __field__span)
+    = Aeson.object
+        ("file" .= __field__file :
+           "span" .= __field__span : Prelude.mempty)
+
+instance Thrift.ThriftStruct FileLocation where
+  buildStruct _proxy (FileLocation __field__file __field__span)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "file" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__file)
+           :
+           Thrift.genField _proxy "span" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__span)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__file <- ST.newSTRef Default.def
+            __field__span <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__file
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__span
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__file <- ST.readSTRef __field__file
+                                             !__val__span <- ST.readSTRef __field__span
+                                             Prelude.pure (FileLocation __val__file __val__span)
+              _idMap = HashMap.fromList [("file", 1), ("span", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FileLocation where
+  rnf (FileLocation __field__file __field__span)
+    = DeepSeq.rnf __field__file `Prelude.seq`
+        DeepSeq.rnf __field__span `Prelude.seq` ()
+
+instance Default.Default FileLocation where
+  def = FileLocation Default.def Default.def
+
+instance Hashable.Hashable FileLocation where
+  hashWithSalt __salt (FileLocation _file _span)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _file) _span
+
+data ByteRange = ByteRange{byteRange_begin :: Glean.Nat,
+                           byteRange_end :: Glean.Nat}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ByteRange where
+  toJSON (ByteRange __field__begin __field__end)
+    = Aeson.object
+        ("begin" .= Glean.unNat __field__begin :
+           "end" .= Glean.unNat __field__end : Prelude.mempty)
+
+instance Thrift.ThriftStruct ByteRange where
+  buildStruct _proxy (ByteRange __field__begin __field__end)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "begin" (Thrift.getI64Type _proxy) 1 0
+           ((Thrift.genI64 _proxy . Glean.unNat) __field__begin)
+           :
+           Thrift.genField _proxy "end" (Thrift.getI64Type _proxy) 2 1
+             ((Thrift.genI64 _proxy . Glean.unNat) __field__end)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__begin <- ST.newSTRef (Glean.Nat Default.def)
+            __field__end <- ST.newSTRef (Glean.Nat Default.def)
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__begin
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.fmap
+                                                                                      Glean.Nat
+                                                                                      (Thrift.parseI64
+                                                                                         _proxy))
+                                                                        ST.writeSTRef __field__end
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__begin <- ST.readSTRef __field__begin
+                                             !__val__end <- ST.readSTRef __field__end
+                                             Prelude.pure (ByteRange __val__begin __val__end)
+              _idMap = HashMap.fromList [("begin", 1), ("end", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ByteRange where
+  rnf (ByteRange __field__begin __field__end)
+    = DeepSeq.rnf __field__begin `Prelude.seq`
+        DeepSeq.rnf __field__end `Prelude.seq` ()
+
+instance Default.Default ByteRange where
+  def = ByteRange (Glean.Nat Default.def) (Glean.Nat Default.def)
+
+instance Hashable.Hashable ByteRange where
+  hashWithSalt __salt (ByteRange _begin _end)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _begin) _end
+{-# LINE 17 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.File where
+  type KeyType Glean.Schema.Src.Types.File = Data.Text.Text
+  getName _proxy = Glean.PredicateRef "src.File" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.file_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.File x k
+  getFactKey = Glean.Schema.Src.Types.file_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 25 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.File where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 31 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.FileDigest where
+  type KeyType Glean.Schema.Src.Types.FileDigest =
+       Glean.Schema.Src.Types.File
+  type ValueType Glean.Schema.Src.Types.FileDigest =
+       Glean.Schema.Src.Types.FileDigest_value
+  getName _proxy = Glean.PredicateRef "src.FileDigest" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.fileDigest_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k v
+    = Glean.Schema.Src.Types.FileDigest x k v
+  getFactKey = Glean.Schema.Src.Types.fileDigest_key
+  getFactValue = Glean.Schema.Src.Types.fileDigest_value
+{-# LINE 41 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileDigest where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 47 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileLines_key where
+  buildRtsValue b (Glean.Schema.Src.Types.FileLines_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.Src.Types.FileLines_key <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.FileLines_key" (Prelude.Just 0))
+{-# LINE 60 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.FileLines_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "lengths" ([Glean.Nat])
+          ('Angle.TField "endsInNewline" (Prelude.Bool)
+             ('Angle.TField "hasUnicodeOrTabs" (Prelude.Bool)
+                ('Angle.TNoFields))))
+{-# LINE 62 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.FileLines where
+  type KeyType Glean.Schema.Src.Types.FileLines =
+       Glean.Schema.Src.Types.FileLines_key
+  getName _proxy = Glean.PredicateRef "src.FileLines" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.fileLines_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.FileLines x k
+  getFactKey = Glean.Schema.Src.Types.fileLines_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 71 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileLines where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 77 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.IndexFailure_key where
+  buildRtsValue b (Glean.Schema.Src.Types.IndexFailure_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Src.Types.IndexFailure_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.IndexFailure_key" (Prelude.Just 0))
+{-# LINE 88 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.IndexFailure_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "reason" (Glean.Schema.Src.Types.IndexFailureReason)
+          ('Angle.TField "details" (Data.Text.Text) ('Angle.TNoFields)))
+{-# LINE 90 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.IndexFailure where
+  type KeyType Glean.Schema.Src.Types.IndexFailure =
+       Glean.Schema.Src.Types.IndexFailure_key
+  getName _proxy = Glean.PredicateRef "src.IndexFailure" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.indexFailure_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.IndexFailure x k
+  getFactKey = Glean.Schema.Src.Types.indexFailure_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 99 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.IndexFailure where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 105 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.RangeContains_key where
+  buildRtsValue b (Glean.Schema.Src.Types.RangeContains_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.RangeContains_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.RangeContains_key" (Prelude.Just 0))
+{-# LINE 114 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.RangeContains_key =
+     'Angle.TField "fileLines" (Glean.Schema.Src.Types.Range)
+       ('Angle.TField "contains" (Glean.Schema.Src.Types.Range)
+          ('Angle.TNoFields))
+{-# LINE 116 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.RangeContains where
+  type KeyType Glean.Schema.Src.Types.RangeContains =
+       Glean.Schema.Src.Types.RangeContains_key
+  getName _proxy = Glean.PredicateRef "src.RangeContains" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.rangeContains_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.RangeContains x k
+  getFactKey = Glean.Schema.Src.Types.rangeContains_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 125 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.RangeContains where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 131 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.ByteSpanContains_key
+         where
+  buildRtsValue b (Glean.Schema.Src.Types.ByteSpanContains_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.ByteSpanContains_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.ByteSpanContains_key" (Prelude.Just 0))
+{-# LINE 140 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.ByteSpanContains_key =
+     'Angle.TField "byteSpan" (Glean.Schema.Src.Types.ByteSpan)
+       ('Angle.TField "contains" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
+{-# LINE 142 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.ByteSpanContains
+         where
+  type KeyType Glean.Schema.Src.Types.ByteSpanContains =
+       Glean.Schema.Src.Types.ByteSpanContains_key
+  getName _proxy = Glean.PredicateRef "src.ByteSpanContains" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.Src.Types.byteSpanContains_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.ByteSpanContains x k
+  getFactKey = Glean.Schema.Src.Types.byteSpanContains_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 151 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.ByteSpanContains where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 157 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileLanguage_key where
+  buildRtsValue b (Glean.Schema.Src.Types.FileLanguage_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.FileLanguage_key <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.FileLanguage_key" (Prelude.Just 0))
+{-# LINE 166 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.FileLanguage_key =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "language" (Glean.Schema.Src.Types.Language)
+          ('Angle.TNoFields))
+{-# LINE 168 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Src.Types.FileLanguage where
+  type KeyType Glean.Schema.Src.Types.FileLanguage =
+       Glean.Schema.Src.Types.FileLanguage_key
+  getName _proxy = Glean.PredicateRef "src.FileLanguage" 1
+  getId
+    = Glean.IdOf . Glean.Fid . Glean.Schema.Src.Types.fileLanguage_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Src.Types.FileLanguage x k
+  getFactKey = Glean.Schema.Src.Types.fileLanguage_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 177 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileLanguage where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 183 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.IndexFailureReason where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.IndexFailureReason" (Prelude.Just 1))
+{-# LINE 188 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.SumFields Glean.Schema.Src.Types.IndexFailureReason =
+     'Angle.TField "CompileError" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "BuildSystemError" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Unclassified" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "DiscoveryError" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TNoFields))))
+{-# LINE 190 "glean/schema/thrift/src_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Src.Types.IndexFailureReason
+         where
+  type AngleEnumTy Glean.Schema.Src.Types.IndexFailureReason =
+       Glean.Schema.Src.Types.IndexFailureReason
+  enumName v = Text.pack (Prelude.drop 19 (Prelude.show v))
+{-# LINE 194 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.Range where
+  buildRtsValue b (Glean.Schema.Src.Types.Range x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.Src.Types.Range <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "src.Range" (Prelude.Just 1))
+{-# LINE 209 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Src.Types.Range =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "lineBegin" (Glean.Nat)
+          ('Angle.TField "columnBegin" (Glean.Nat)
+             ('Angle.TField "lineEnd" (Glean.Nat)
+                ('Angle.TField "columnEnd" (Glean.Nat) ('Angle.TNoFields)))))
+{-# LINE 211 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.Language where
+  buildRtsValue = Glean.thriftEnum_buildRtsValue
+  decodeRtsValue = Glean.thriftEnumD
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.Language" (Prelude.Just 1))
+{-# LINE 216 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.SumFields Glean.Schema.Src.Types.Language =
+     'Angle.TField "Buck" (Glean.Schema.Builtin.Types.Unit)
+       ('Angle.TField "C" (Glean.Schema.Builtin.Types.Unit)
+          ('Angle.TField "Cpp" (Glean.Schema.Builtin.Types.Unit)
+             ('Angle.TField "Hack" (Glean.Schema.Builtin.Types.Unit)
+                ('Angle.TField "Haskell" (Glean.Schema.Builtin.Types.Unit)
+                   ('Angle.TField "ObjC" (Glean.Schema.Builtin.Types.Unit)
+                      ('Angle.TField "ObjCpp" (Glean.Schema.Builtin.Types.Unit)
+                         ('Angle.TField "Python" (Glean.Schema.Builtin.Types.Unit)
+                            ('Angle.TField "Thrift" (Glean.Schema.Builtin.Types.Unit)
+                               ('Angle.TField "Java" (Glean.Schema.Builtin.Types.Unit)
+                                  ('Angle.TField "GraphQL" (Glean.Schema.Builtin.Types.Unit)
+                                     ('Angle.TNoFields)))))))))))
+{-# LINE 218 "glean/schema/thrift/src_include.hs" #-}
+instance Angle.AngleEnum Glean.Schema.Src.Types.Language where
+  type AngleEnumTy Glean.Schema.Src.Types.Language =
+       Glean.Schema.Src.Types.Language
+  enumName v = Text.pack (Prelude.drop 9 (Prelude.show v))
+{-# LINE 222 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.RelByteSpan where
+  buildRtsValue b (Glean.Schema.Src.Types.RelByteSpan x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.RelByteSpan <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.RelByteSpan" (Prelude.Just 1))
+{-# LINE 231 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Src.Types.RelByteSpan
+     =
+     'Angle.TField "offset" (Glean.Nat)
+       ('Angle.TField "length" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 233 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.ByteRange where
+  buildRtsValue b (Glean.Schema.Src.Types.ByteRange x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.ByteRange <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.ByteRange" (Prelude.Just 1))
+{-# LINE 242 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Src.Types.ByteRange =
+     'Angle.TField "begin" (Glean.Nat)
+       ('Angle.TField "end" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 244 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.ByteSpan where
+  buildRtsValue b (Glean.Schema.Src.Types.ByteSpan x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.ByteSpan <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.ByteSpan" (Prelude.Just 1))
+{-# LINE 253 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Src.Types.ByteSpan =
+     'Angle.TField "start" (Glean.Nat)
+       ('Angle.TField "length" (Glean.Nat) ('Angle.TNoFields))
+{-# LINE 255 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.PackedByteSpansGroup
+         where
+  buildRtsValue b (Glean.Schema.Src.Types.PackedByteSpansGroup x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.PackedByteSpansGroup <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.PackedByteSpansGroup" (Prelude.Just 1))
+{-# LINE 264 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.PackedByteSpansGroup =
+     'Angle.TField "length" (Glean.Nat)
+       ('Angle.TField "offsets" ([Glean.Nat]) ('Angle.TNoFields))
+{-# LINE 266 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.Loc where
+  buildRtsValue b (Glean.Schema.Src.Types.Loc x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.Src.Types.Loc <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy () (Angle.SourceRef "src.Loc" (Prelude.Just 1))
+{-# LINE 277 "glean/schema/thrift/src_include.hs" #-}
+type instance Angle.RecordFields Glean.Schema.Src.Types.Loc =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "line" (Glean.Nat)
+          ('Angle.TField "column" (Glean.Nat) ('Angle.TNoFields)))
+{-# LINE 279 "glean/schema/thrift/src_include.hs" #-}
+instance Glean.Type Glean.Schema.Src.Types.FileLocation where
+  buildRtsValue b (Glean.Schema.Src.Types.FileLocation x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.Src.Types.FileLocation <$> Glean.decodeRtsValue <*>
+        Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "src.FileLocation" (Prelude.Just 1))
+{-# LINE 288 "glean/schema/thrift/src_include.hs" #-}
+type instance
+     Angle.RecordFields Glean.Schema.Src.Types.FileLocation =
+     'Angle.TField "file" (Glean.KeyType Glean.Schema.Src.Types.File)
+       ('Angle.TField "span" (Glean.Schema.Src.Types.ByteSpan)
+          ('Angle.TNoFields))
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidCxx/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidCxx/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidCxx/Types.hs
@@ -0,0 +1,3377 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidCxx/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SymbolidCxx.Types
+       (pREDICATE_VERSIONS, LookupNamespaceDefinition_id,
+        LookupNamespaceDefinition(LookupNamespaceDefinition,
+                                  lookupNamespaceDefinition_id, lookupNamespaceDefinition_key),
+        LookupNamespaceDeclaration_id,
+        LookupNamespaceDeclaration(LookupNamespaceDeclaration,
+                                   lookupNamespaceDeclaration_id, lookupNamespaceDeclaration_key),
+        LookupFunctionSignatureQualifierDefinition_id,
+        LookupFunctionSignatureQualifierDefinition(LookupFunctionSignatureQualifierDefinition,
+                                                   lookupFunctionSignatureQualifierDefinition_id,
+                                                   lookupFunctionSignatureQualifierDefinition_key),
+        LookupFunctionSignatureQualifierDeclaration_id,
+        LookupFunctionSignatureQualifierDeclaration(LookupFunctionSignatureQualifierDeclaration,
+                                                    lookupFunctionSignatureQualifierDeclaration_id,
+                                                    lookupFunctionSignatureQualifierDeclaration_key),
+        LookupFunctionSignatureDefinition_id,
+        LookupFunctionSignatureDefinition(LookupFunctionSignatureDefinition,
+                                          lookupFunctionSignatureDefinition_id,
+                                          lookupFunctionSignatureDefinition_key),
+        LookupFunctionSignatureDeclaration_id,
+        LookupFunctionSignatureDeclaration(LookupFunctionSignatureDeclaration,
+                                           lookupFunctionSignatureDeclaration_id,
+                                           lookupFunctionSignatureDeclaration_key),
+        LookupFunctionDefinition_id,
+        LookupFunctionDefinition(LookupFunctionDefinition,
+                                 lookupFunctionDefinition_id, lookupFunctionDefinition_key),
+        LookupFunctionDeclaration_id,
+        LookupFunctionDeclaration(LookupFunctionDeclaration,
+                                  lookupFunctionDeclaration_id, lookupFunctionDeclaration_key),
+        LookupEnumerator_id,
+        LookupEnumerator(LookupEnumerator, lookupEnumerator_id,
+                         lookupEnumerator_key),
+        LookupDefinition_id,
+        LookupDefinition(LookupDefinition, lookupDefinition_id,
+                         lookupDefinition_key),
+        LookupDeclaration_id,
+        LookupDeclaration(LookupDeclaration, lookupDeclaration_id,
+                          lookupDeclaration_key),
+        DefinitionOfDecl_id,
+        DefinitionOfDecl(DefinitionOfDecl, definitionOfDecl_id,
+                         definitionOfDecl_key),
+        LookupNamespaceDefinition_key(LookupNamespaceDefinition_key,
+                                      lookupNamespaceDefinition_key_name,
+                                      lookupNamespaceDefinition_key_parent,
+                                      lookupNamespaceDefinition_key_entity),
+        LookupNamespaceDeclaration_key(LookupNamespaceDeclaration_key,
+                                       lookupNamespaceDeclaration_key_name,
+                                       lookupNamespaceDeclaration_key_parent,
+                                       lookupNamespaceDeclaration_key_decl),
+        LookupFunctionSignatureQualifierDefinition_key(LookupFunctionSignatureQualifierDefinition_key,
+                                                       lookupFunctionSignatureQualifierDefinition_key_name,
+                                                       lookupFunctionSignatureQualifierDefinition_key_scope,
+                                                       lookupFunctionSignatureQualifierDefinition_key_signature,
+                                                       lookupFunctionSignatureQualifierDefinition_key_qualifiers,
+                                                       lookupFunctionSignatureQualifierDefinition_key_entity),
+        LookupFunctionSignatureQualifierDeclaration_key(LookupFunctionSignatureQualifierDeclaration_key,
+                                                        lookupFunctionSignatureQualifierDeclaration_key_name,
+                                                        lookupFunctionSignatureQualifierDeclaration_key_scope,
+                                                        lookupFunctionSignatureQualifierDeclaration_key_signature,
+                                                        lookupFunctionSignatureQualifierDeclaration_key_qualifiers,
+                                                        lookupFunctionSignatureQualifierDeclaration_key_decl),
+        LookupFunctionSignatureDefinition_key(LookupFunctionSignatureDefinition_key,
+                                              lookupFunctionSignatureDefinition_key_name,
+                                              lookupFunctionSignatureDefinition_key_scope,
+                                              lookupFunctionSignatureDefinition_key_signature,
+                                              lookupFunctionSignatureDefinition_key_entity),
+        LookupFunctionSignatureDeclaration_key(LookupFunctionSignatureDeclaration_key,
+                                               lookupFunctionSignatureDeclaration_key_name,
+                                               lookupFunctionSignatureDeclaration_key_scope,
+                                               lookupFunctionSignatureDeclaration_key_signature,
+                                               lookupFunctionSignatureDeclaration_key_decl),
+        LookupFunctionDefinition_key(LookupFunctionDefinition_key,
+                                     lookupFunctionDefinition_key_name,
+                                     lookupFunctionDefinition_key_scope,
+                                     lookupFunctionDefinition_key_entity),
+        LookupFunctionDeclaration_key(LookupFunctionDeclaration_key,
+                                      lookupFunctionDeclaration_key_name,
+                                      lookupFunctionDeclaration_key_scope,
+                                      lookupFunctionDeclaration_key_decl),
+        LookupEnumerator_key(LookupEnumerator_key,
+                             lookupEnumerator_key_name, lookupEnumerator_key_parent,
+                             lookupEnumerator_key_scope, lookupEnumerator_key_decl),
+        LookupDefinition_key(LookupDefinition_key,
+                             lookupDefinition_key_name, lookupDefinition_key_scope,
+                             lookupDefinition_key_entity),
+        LookupDeclaration_key(LookupDeclaration_key,
+                              lookupDeclaration_key_name, lookupDeclaration_key_scope,
+                              lookupDeclaration_key_decl),
+        DefinitionOfDecl_key(DefinitionOfDecl_key,
+                             definitionOfDecl_key_decl, definitionOfDecl_key_entity))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.CodeCxx.Types as Glean.Schema.CodeCxx
+import qualified Glean.Schema.Cxx1.Types as Glean.Schema.Cxx1
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Schema.CodeCxx.Types
+{-# LINE 16 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+import qualified Glean.Schema.Cxx1.Types
+{-# LINE 163 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidCxx/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("LookupEnumerator", 1),
+       ("LookupFunctionSignatureDeclaration", 1), ("LookupDefinition", 1),
+       ("LookupFunctionDefinition", 1),
+       ("LookupFunctionSignatureDefinition", 1),
+       ("LookupNamespaceDefinition", 1),
+       ("LookupNamespaceDeclaration", 1), ("LookupDeclaration", 1),
+       ("LookupFunctionSignatureQualifierDefinition", 1),
+       ("LookupFunctionSignatureQualifierDeclaration", 1),
+       ("DefinitionOfDecl", 1), ("LookupFunctionDeclaration", 1)]
+
+type LookupNamespaceDefinition_id = Glean.Id
+
+data LookupNamespaceDefinition = LookupNamespaceDefinition{lookupNamespaceDefinition_id
+                                                           ::
+                                                           {-# UNPACK #-} !LookupNamespaceDefinition_id,
+                                                           lookupNamespaceDefinition_key ::
+                                                           Prelude.Maybe
+                                                             LookupNamespaceDefinition_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupNamespaceDefinition where
+  toJSON (LookupNamespaceDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupNamespaceDefinition where
+  buildStruct _proxy
+    (LookupNamespaceDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupNamespaceDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupNamespaceDefinition where
+  rnf (LookupNamespaceDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupNamespaceDefinition where
+  def = LookupNamespaceDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupNamespaceDefinition where
+  hashWithSalt __salt (LookupNamespaceDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupNamespaceDeclaration_id = Glean.Id
+
+data LookupNamespaceDeclaration = LookupNamespaceDeclaration{lookupNamespaceDeclaration_id
+                                                             ::
+                                                             {-# UNPACK #-} !LookupNamespaceDeclaration_id,
+                                                             lookupNamespaceDeclaration_key ::
+                                                             Prelude.Maybe
+                                                               LookupNamespaceDeclaration_key}
+                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupNamespaceDeclaration where
+  toJSON (LookupNamespaceDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupNamespaceDeclaration where
+  buildStruct _proxy
+    (LookupNamespaceDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupNamespaceDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupNamespaceDeclaration where
+  rnf (LookupNamespaceDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupNamespaceDeclaration where
+  def = LookupNamespaceDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupNamespaceDeclaration where
+  hashWithSalt __salt (LookupNamespaceDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionSignatureQualifierDefinition_id = Glean.Id
+
+data LookupFunctionSignatureQualifierDefinition = LookupFunctionSignatureQualifierDefinition{lookupFunctionSignatureQualifierDefinition_id
+                                                                                             ::
+                                                                                             {-# UNPACK #-} !LookupFunctionSignatureQualifierDefinition_id,
+                                                                                             lookupFunctionSignatureQualifierDefinition_key
+                                                                                             ::
+                                                                                             Prelude.Maybe
+                                                                                               LookupFunctionSignatureQualifierDefinition_key}
+                                                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureQualifierDefinition
+         where
+  toJSON
+    (LookupFunctionSignatureQualifierDefinition __field__id
+       __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           LookupFunctionSignatureQualifierDefinition
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureQualifierDefinition __field__id
+       __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionSignatureQualifierDefinition __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureQualifierDefinition
+         where
+  rnf
+    (LookupFunctionSignatureQualifierDefinition __field__id
+       __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupFunctionSignatureQualifierDefinition
+         where
+  def
+    = LookupFunctionSignatureQualifierDefinition Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable
+           LookupFunctionSignatureQualifierDefinition
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureQualifierDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionSignatureQualifierDeclaration_id = Glean.Id
+
+data LookupFunctionSignatureQualifierDeclaration = LookupFunctionSignatureQualifierDeclaration{lookupFunctionSignatureQualifierDeclaration_id
+                                                                                               ::
+                                                                                               {-# UNPACK #-} !LookupFunctionSignatureQualifierDeclaration_id,
+                                                                                               lookupFunctionSignatureQualifierDeclaration_key
+                                                                                               ::
+                                                                                               Prelude.Maybe
+                                                                                                 LookupFunctionSignatureQualifierDeclaration_key}
+                                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureQualifierDeclaration
+         where
+  toJSON
+    (LookupFunctionSignatureQualifierDeclaration __field__id
+       __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct
+           LookupFunctionSignatureQualifierDeclaration
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureQualifierDeclaration __field__id
+       __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionSignatureQualifierDeclaration
+                                                  __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureQualifierDeclaration
+         where
+  rnf
+    (LookupFunctionSignatureQualifierDeclaration __field__id
+       __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default
+           LookupFunctionSignatureQualifierDeclaration
+         where
+  def
+    = LookupFunctionSignatureQualifierDeclaration Default.def
+        Prelude.Nothing
+
+instance Hashable.Hashable
+           LookupFunctionSignatureQualifierDeclaration
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureQualifierDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionSignatureDefinition_id = Glean.Id
+
+data LookupFunctionSignatureDefinition = LookupFunctionSignatureDefinition{lookupFunctionSignatureDefinition_id
+                                                                           ::
+                                                                           {-# UNPACK #-} !LookupFunctionSignatureDefinition_id,
+                                                                           lookupFunctionSignatureDefinition_key
+                                                                           ::
+                                                                           Prelude.Maybe
+                                                                             LookupFunctionSignatureDefinition_key}
+                                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureDefinition where
+  toJSON (LookupFunctionSignatureDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionSignatureDefinition
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionSignatureDefinition __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureDefinition where
+  rnf (LookupFunctionSignatureDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupFunctionSignatureDefinition where
+  def = LookupFunctionSignatureDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupFunctionSignatureDefinition where
+  hashWithSalt __salt (LookupFunctionSignatureDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionSignatureDeclaration_id = Glean.Id
+
+data LookupFunctionSignatureDeclaration = LookupFunctionSignatureDeclaration{lookupFunctionSignatureDeclaration_id
+                                                                             ::
+                                                                             {-# UNPACK #-} !LookupFunctionSignatureDeclaration_id,
+                                                                             lookupFunctionSignatureDeclaration_key
+                                                                             ::
+                                                                             Prelude.Maybe
+                                                                               LookupFunctionSignatureDeclaration_key}
+                                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureDeclaration where
+  toJSON
+    (LookupFunctionSignatureDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionSignatureDeclaration
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionSignatureDeclaration __val__id
+                                                  __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureDeclaration where
+  rnf (LookupFunctionSignatureDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupFunctionSignatureDeclaration where
+  def
+    = LookupFunctionSignatureDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupFunctionSignatureDeclaration where
+  hashWithSalt __salt (LookupFunctionSignatureDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionDefinition_id = Glean.Id
+
+data LookupFunctionDefinition = LookupFunctionDefinition{lookupFunctionDefinition_id
+                                                         ::
+                                                         {-# UNPACK #-} !LookupFunctionDefinition_id,
+                                                         lookupFunctionDefinition_key ::
+                                                         Prelude.Maybe LookupFunctionDefinition_key}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionDefinition where
+  toJSON (LookupFunctionDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionDefinition where
+  buildStruct _proxy
+    (LookupFunctionDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionDefinition where
+  rnf (LookupFunctionDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupFunctionDefinition where
+  def = LookupFunctionDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupFunctionDefinition where
+  hashWithSalt __salt (LookupFunctionDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupFunctionDeclaration_id = Glean.Id
+
+data LookupFunctionDeclaration = LookupFunctionDeclaration{lookupFunctionDeclaration_id
+                                                           ::
+                                                           {-# UNPACK #-} !LookupFunctionDeclaration_id,
+                                                           lookupFunctionDeclaration_key ::
+                                                           Prelude.Maybe
+                                                             LookupFunctionDeclaration_key}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionDeclaration where
+  toJSON (LookupFunctionDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionDeclaration where
+  buildStruct _proxy
+    (LookupFunctionDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupFunctionDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionDeclaration where
+  rnf (LookupFunctionDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupFunctionDeclaration where
+  def = LookupFunctionDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupFunctionDeclaration where
+  hashWithSalt __salt (LookupFunctionDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupEnumerator_id = Glean.Id
+
+data LookupEnumerator = LookupEnumerator{lookupEnumerator_id ::
+                                         {-# UNPACK #-} !LookupEnumerator_id,
+                                         lookupEnumerator_key :: Prelude.Maybe LookupEnumerator_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupEnumerator where
+  toJSON (LookupEnumerator __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupEnumerator where
+  buildStruct _proxy (LookupEnumerator __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LookupEnumerator __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupEnumerator where
+  rnf (LookupEnumerator __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupEnumerator where
+  def = LookupEnumerator Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupEnumerator where
+  hashWithSalt __salt (LookupEnumerator _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupDefinition_id = Glean.Id
+
+data LookupDefinition = LookupDefinition{lookupDefinition_id ::
+                                         {-# UNPACK #-} !LookupDefinition_id,
+                                         lookupDefinition_key :: Prelude.Maybe LookupDefinition_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDefinition where
+  toJSON (LookupDefinition __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDefinition where
+  buildStruct _proxy (LookupDefinition __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LookupDefinition __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDefinition where
+  rnf (LookupDefinition __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupDefinition where
+  def = LookupDefinition Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupDefinition where
+  hashWithSalt __salt (LookupDefinition _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupDeclaration_id = Glean.Id
+
+data LookupDeclaration = LookupDeclaration{lookupDeclaration_id ::
+                                           {-# UNPACK #-} !LookupDeclaration_id,
+                                           lookupDeclaration_key ::
+                                           Prelude.Maybe LookupDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration where
+  toJSON (LookupDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration where
+  buildStruct _proxy (LookupDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LookupDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration where
+  rnf (LookupDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration where
+  def = LookupDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupDeclaration where
+  hashWithSalt __salt (LookupDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type DefinitionOfDecl_id = Glean.Id
+
+data DefinitionOfDecl = DefinitionOfDecl{definitionOfDecl_id ::
+                                         {-# UNPACK #-} !DefinitionOfDecl_id,
+                                         definitionOfDecl_key :: Prelude.Maybe DefinitionOfDecl_key}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionOfDecl where
+  toJSON (DefinitionOfDecl __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionOfDecl where
+  buildStruct _proxy (DefinitionOfDecl __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (DefinitionOfDecl __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionOfDecl where
+  rnf (DefinitionOfDecl __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default DefinitionOfDecl where
+  def = DefinitionOfDecl Default.def Prelude.Nothing
+
+instance Hashable.Hashable DefinitionOfDecl where
+  hashWithSalt __salt (DefinitionOfDecl _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data LookupNamespaceDefinition_key = LookupNamespaceDefinition_key{lookupNamespaceDefinition_key_name
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Cxx1.Name,
+                                                                   lookupNamespaceDefinition_key_parent
+                                                                   ::
+                                                                   Prelude.Maybe
+                                                                     Glean.Schema.Cxx1.NamespaceQName,
+                                                                   lookupNamespaceDefinition_key_entity
+                                                                   :: Glean.Schema.CodeCxx.Entity}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupNamespaceDefinition_key where
+  toJSON
+    (LookupNamespaceDefinition_key __field__name __field__parent
+       __field__entity)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("name" .=)) __field__name
+           (Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+              ("entity" .= __field__entity : Prelude.mempty)))
+
+instance Thrift.ThriftStruct LookupNamespaceDefinition_key where
+  buildStruct _proxy
+    (LookupNamespaceDefinition_key __field__name __field__parent
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (let (__cereal__name, __id__name)
+               = case __field__name of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "name"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__name
+             (let (__cereal__parent, __id__parent)
+                    = case __field__parent of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genField _proxy "parent"
+                                                   (Thrift.getStructType _proxy)
+                                                   2
+                                                   __id__name
+                                                   (Thrift.buildStruct _proxy _val)),
+                                              2)
+                        Prelude.Nothing -> (Prelude.id, __id__name)
+                in
+                __cereal__parent
+                  (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3
+                     __id__parent
+                     (Thrift.buildStruct _proxy __field__entity)
+                     : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Prelude.Nothing
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LookupNamespaceDefinition_key __val__name
+                                                  __val__parent
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("parent", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupNamespaceDefinition_key where
+  rnf
+    (LookupNamespaceDefinition_key __field__name __field__parent
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LookupNamespaceDefinition_key where
+  def
+    = LookupNamespaceDefinition_key Prelude.Nothing Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable LookupNamespaceDefinition_key where
+  hashWithSalt __salt
+    (LookupNamespaceDefinition_key _name _parent _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _entity
+
+data LookupNamespaceDeclaration_key = LookupNamespaceDeclaration_key{lookupNamespaceDeclaration_key_name
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       Glean.Schema.Cxx1.Name,
+                                                                     lookupNamespaceDeclaration_key_parent
+                                                                     ::
+                                                                     Prelude.Maybe
+                                                                       Glean.Schema.Cxx1.NamespaceQName,
+                                                                     lookupNamespaceDeclaration_key_decl
+                                                                     ::
+                                                                     Glean.Schema.Cxx1.Declaration}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupNamespaceDeclaration_key where
+  toJSON
+    (LookupNamespaceDeclaration_key __field__name __field__parent
+       __field__decl)
+    = Aeson.object
+        (Prelude.maybe Prelude.id ((:) . ("name" .=)) __field__name
+           (Prelude.maybe Prelude.id ((:) . ("parent" .=)) __field__parent
+              ("decl" .= __field__decl : Prelude.mempty)))
+
+instance Thrift.ThriftStruct LookupNamespaceDeclaration_key where
+  buildStruct _proxy
+    (LookupNamespaceDeclaration_key __field__name __field__parent
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (let (__cereal__name, __id__name)
+               = case __field__name of
+                   Prelude.Just _val -> ((:)
+                                           (Thrift.genField _proxy "name"
+                                              (Thrift.getStructType _proxy)
+                                              1
+                                              0
+                                              (Thrift.buildStruct _proxy _val)),
+                                         1)
+                   Prelude.Nothing -> (Prelude.id, 0)
+           in
+           __cereal__name
+             (let (__cereal__parent, __id__parent)
+                    = case __field__parent of
+                        Prelude.Just _val -> ((:)
+                                                (Thrift.genField _proxy "parent"
+                                                   (Thrift.getStructType _proxy)
+                                                   2
+                                                   __id__name
+                                                   (Thrift.buildStruct _proxy _val)),
+                                              2)
+                        Prelude.Nothing -> (Prelude.id, __id__name)
+                in
+                __cereal__parent
+                  (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3
+                     __id__parent
+                     (Thrift.buildStruct _proxy __field__decl)
+                     : [])))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Prelude.Nothing
+            __field__parent <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          (Prelude.Just _val)
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          (Prelude.Just _val)
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupNamespaceDeclaration_key __val__name
+                                                  __val__parent
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("parent", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupNamespaceDeclaration_key where
+  rnf
+    (LookupNamespaceDeclaration_key __field__name __field__parent
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupNamespaceDeclaration_key where
+  def
+    = LookupNamespaceDeclaration_key Prelude.Nothing Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable LookupNamespaceDeclaration_key where
+  hashWithSalt __salt
+    (LookupNamespaceDeclaration_key _name _parent _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _parent)
+        _decl
+
+data LookupFunctionSignatureQualifierDefinition_key = LookupFunctionSignatureQualifierDefinition_key{lookupFunctionSignatureQualifierDefinition_key_name
+                                                                                                     ::
+                                                                                                     Glean.Schema.Cxx1.FunctionName,
+                                                                                                     lookupFunctionSignatureQualifierDefinition_key_scope
+                                                                                                     ::
+                                                                                                     Glean.Schema.Cxx1.Scope,
+                                                                                                     lookupFunctionSignatureQualifierDefinition_key_signature
+                                                                                                     ::
+                                                                                                     Glean.Schema.Cxx1.Signature,
+                                                                                                     lookupFunctionSignatureQualifierDefinition_key_qualifiers
+                                                                                                     ::
+                                                                                                     Prelude.Maybe
+                                                                                                       Glean.Schema.Cxx1.MethodSignature,
+                                                                                                     lookupFunctionSignatureQualifierDefinition_key_entity
+                                                                                                     ::
+                                                                                                     Glean.Schema.CodeCxx.Entity}
+                                                      deriving (Prelude.Eq, Prelude.Show,
+                                                                Prelude.Ord)
+
+instance Aeson.ToJSON
+           LookupFunctionSignatureQualifierDefinition_key
+         where
+  toJSON
+    (LookupFunctionSignatureQualifierDefinition_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "signature" .= __field__signature :
+               Prelude.maybe Prelude.id ((:) . ("qualifiers" .=))
+                 __field__qualifiers
+                 ("entity" .= __field__entity : Prelude.mempty))
+
+instance Thrift.ThriftStruct
+           LookupFunctionSignatureQualifierDefinition_key
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureQualifierDefinition_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__signature)
+               :
+               let (__cereal__qualifiers, __id__qualifiers)
+                     = case __field__qualifiers of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "qualifiers"
+                                                    (Thrift.getStructType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.buildStruct _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__qualifiers
+                   (Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 5
+                      __id__qualifiers
+                      (Thrift.buildStruct _proxy __field__entity)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__qualifiers <- ST.newSTRef Prelude.Nothing
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__qualifiers
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__qualifiers <- ST.readSTRef __field__qualifiers
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LookupFunctionSignatureQualifierDefinition_key
+                                                  __val__name
+                                                  __val__scope
+                                                  __val__signature
+                                                  __val__qualifiers
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("signature", 3), ("qualifiers", 4),
+                     ("entity", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           LookupFunctionSignatureQualifierDefinition_key
+         where
+  rnf
+    (LookupFunctionSignatureQualifierDefinition_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__signature `Prelude.seq`
+            DeepSeq.rnf __field__qualifiers `Prelude.seq`
+              DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default
+           LookupFunctionSignatureQualifierDefinition_key
+         where
+  def
+    = LookupFunctionSignatureQualifierDefinition_key Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable
+           LookupFunctionSignatureQualifierDefinition_key
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureQualifierDefinition_key _name _scope
+       _signature _qualifiers _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+              _signature)
+           _qualifiers)
+        _entity
+
+data LookupFunctionSignatureQualifierDeclaration_key = LookupFunctionSignatureQualifierDeclaration_key{lookupFunctionSignatureQualifierDeclaration_key_name
+                                                                                                       ::
+                                                                                                       Glean.Schema.Cxx1.FunctionName,
+                                                                                                       lookupFunctionSignatureQualifierDeclaration_key_scope
+                                                                                                       ::
+                                                                                                       Glean.Schema.Cxx1.Scope,
+                                                                                                       lookupFunctionSignatureQualifierDeclaration_key_signature
+                                                                                                       ::
+                                                                                                       Glean.Schema.Cxx1.Signature,
+                                                                                                       lookupFunctionSignatureQualifierDeclaration_key_qualifiers
+                                                                                                       ::
+                                                                                                       Prelude.Maybe
+                                                                                                         Glean.Schema.Cxx1.MethodSignature,
+                                                                                                       lookupFunctionSignatureQualifierDeclaration_key_decl
+                                                                                                       ::
+                                                                                                       Glean.Schema.Cxx1.Declaration}
+                                                       deriving (Prelude.Eq, Prelude.Show,
+                                                                 Prelude.Ord)
+
+instance Aeson.ToJSON
+           LookupFunctionSignatureQualifierDeclaration_key
+         where
+  toJSON
+    (LookupFunctionSignatureQualifierDeclaration_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "signature" .= __field__signature :
+               Prelude.maybe Prelude.id ((:) . ("qualifiers" .=))
+                 __field__qualifiers
+                 ("decl" .= __field__decl : Prelude.mempty))
+
+instance Thrift.ThriftStruct
+           LookupFunctionSignatureQualifierDeclaration_key
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureQualifierDeclaration_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__signature)
+               :
+               let (__cereal__qualifiers, __id__qualifiers)
+                     = case __field__qualifiers of
+                         Prelude.Just _val -> ((:)
+                                                 (Thrift.genField _proxy "qualifiers"
+                                                    (Thrift.getStructType _proxy)
+                                                    4
+                                                    3
+                                                    (Thrift.buildStruct _proxy _val)),
+                                               4)
+                         Prelude.Nothing -> (Prelude.id, 3)
+                 in
+                 __cereal__qualifiers
+                   (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 5
+                      __id__qualifiers
+                      (Thrift.buildStruct _proxy __field__decl)
+                      : []))
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__qualifiers <- ST.newSTRef Prelude.Nothing
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__qualifiers
+                                                                          (Prelude.Just _val)
+                                                                 5 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__qualifiers <- ST.readSTRef __field__qualifiers
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupFunctionSignatureQualifierDeclaration_key
+                                                  __val__name
+                                                  __val__scope
+                                                  __val__signature
+                                                  __val__qualifiers
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("signature", 3), ("qualifiers", 4),
+                     ("decl", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData
+           LookupFunctionSignatureQualifierDeclaration_key
+         where
+  rnf
+    (LookupFunctionSignatureQualifierDeclaration_key __field__name
+       __field__scope __field__signature __field__qualifiers
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__signature `Prelude.seq`
+            DeepSeq.rnf __field__qualifiers `Prelude.seq`
+              DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default
+           LookupFunctionSignatureQualifierDeclaration_key
+         where
+  def
+    = LookupFunctionSignatureQualifierDeclaration_key Default.def
+        Default.def
+        Default.def
+        Prelude.Nothing
+        Default.def
+
+instance Hashable.Hashable
+           LookupFunctionSignatureQualifierDeclaration_key
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureQualifierDeclaration_key _name _scope
+       _signature _qualifiers _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+              _signature)
+           _qualifiers)
+        _decl
+
+data LookupFunctionSignatureDefinition_key = LookupFunctionSignatureDefinition_key{lookupFunctionSignatureDefinition_key_name
+                                                                                   ::
+                                                                                   Glean.Schema.Cxx1.FunctionName,
+                                                                                   lookupFunctionSignatureDefinition_key_scope
+                                                                                   ::
+                                                                                   Glean.Schema.Cxx1.Scope,
+                                                                                   lookupFunctionSignatureDefinition_key_signature
+                                                                                   ::
+                                                                                   Glean.Schema.Cxx1.Signature,
+                                                                                   lookupFunctionSignatureDefinition_key_entity
+                                                                                   ::
+                                                                                   Glean.Schema.CodeCxx.Entity}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureDefinition_key where
+  toJSON
+    (LookupFunctionSignatureDefinition_key __field__name __field__scope
+       __field__signature __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "signature" .= __field__signature :
+               "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionSignatureDefinition_key
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureDefinition_key __field__name __field__scope
+       __field__signature __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__signature)
+               :
+               Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__entity)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LookupFunctionSignatureDefinition_key __val__name
+                                                  __val__scope
+                                                  __val__signature
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("signature", 3), ("entity", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureDefinition_key where
+  rnf
+    (LookupFunctionSignatureDefinition_key __field__name __field__scope
+       __field__signature __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__signature `Prelude.seq`
+            DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LookupFunctionSignatureDefinition_key
+         where
+  def
+    = LookupFunctionSignatureDefinition_key Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable LookupFunctionSignatureDefinition_key
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureDefinition_key _name _scope _signature
+       _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _signature)
+        _entity
+
+data LookupFunctionSignatureDeclaration_key = LookupFunctionSignatureDeclaration_key{lookupFunctionSignatureDeclaration_key_name
+                                                                                     ::
+                                                                                     Glean.Schema.Cxx1.FunctionName,
+                                                                                     lookupFunctionSignatureDeclaration_key_scope
+                                                                                     ::
+                                                                                     Glean.Schema.Cxx1.Scope,
+                                                                                     lookupFunctionSignatureDeclaration_key_signature
+                                                                                     ::
+                                                                                     Glean.Schema.Cxx1.Signature,
+                                                                                     lookupFunctionSignatureDeclaration_key_decl
+                                                                                     ::
+                                                                                     Glean.Schema.Cxx1.Declaration}
+                                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionSignatureDeclaration_key where
+  toJSON
+    (LookupFunctionSignatureDeclaration_key __field__name
+       __field__scope __field__signature __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "signature" .= __field__signature :
+               "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionSignatureDeclaration_key
+         where
+  buildStruct _proxy
+    (LookupFunctionSignatureDeclaration_key __field__name
+       __field__scope __field__signature __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "signature" (Thrift.getStructType _proxy) 3
+               2
+               (Thrift.buildStruct _proxy __field__signature)
+               :
+               Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__decl)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__signature <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__signature
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__signature <- ST.readSTRef __field__signature
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupFunctionSignatureDeclaration_key __val__name
+                                                  __val__scope
+                                                  __val__signature
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("scope", 2), ("signature", 3), ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionSignatureDeclaration_key
+         where
+  rnf
+    (LookupFunctionSignatureDeclaration_key __field__name
+       __field__scope __field__signature __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__signature `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupFunctionSignatureDeclaration_key
+         where
+  def
+    = LookupFunctionSignatureDeclaration_key Default.def Default.def
+        Default.def
+        Default.def
+
+instance Hashable.Hashable LookupFunctionSignatureDeclaration_key
+         where
+  hashWithSalt __salt
+    (LookupFunctionSignatureDeclaration_key _name _scope _signature
+       _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+           _signature)
+        _decl
+
+data LookupFunctionDefinition_key = LookupFunctionDefinition_key{lookupFunctionDefinition_key_name
+                                                                 :: Glean.Schema.Cxx1.FunctionName,
+                                                                 lookupFunctionDefinition_key_scope
+                                                                 :: Glean.Schema.Cxx1.Scope,
+                                                                 lookupFunctionDefinition_key_entity
+                                                                 :: Glean.Schema.CodeCxx.Entity}
+                                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionDefinition_key where
+  toJSON
+    (LookupFunctionDefinition_key __field__name __field__scope
+       __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionDefinition_key where
+  buildStruct _proxy
+    (LookupFunctionDefinition_key __field__name __field__scope
+       __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LookupFunctionDefinition_key __val__name
+                                                  __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionDefinition_key where
+  rnf
+    (LookupFunctionDefinition_key __field__name __field__scope
+       __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LookupFunctionDefinition_key where
+  def
+    = LookupFunctionDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable LookupFunctionDefinition_key where
+  hashWithSalt __salt
+    (LookupFunctionDefinition_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data LookupFunctionDeclaration_key = LookupFunctionDeclaration_key{lookupFunctionDeclaration_key_name
+                                                                   ::
+                                                                   Glean.Schema.Cxx1.FunctionName,
+                                                                   lookupFunctionDeclaration_key_scope
+                                                                   :: Glean.Schema.Cxx1.Scope,
+                                                                   lookupFunctionDeclaration_key_decl
+                                                                   :: Glean.Schema.Cxx1.Declaration}
+                                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupFunctionDeclaration_key where
+  toJSON
+    (LookupFunctionDeclaration_key __field__name __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupFunctionDeclaration_key where
+  buildStruct _proxy
+    (LookupFunctionDeclaration_key __field__name __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupFunctionDeclaration_key __val__name
+                                                  __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupFunctionDeclaration_key where
+  rnf
+    (LookupFunctionDeclaration_key __field__name __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupFunctionDeclaration_key where
+  def
+    = LookupFunctionDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable LookupFunctionDeclaration_key where
+  hashWithSalt __salt
+    (LookupFunctionDeclaration_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data LookupEnumerator_key = LookupEnumerator_key{lookupEnumerator_key_name
+                                                 :: Glean.Schema.Cxx1.Name,
+                                                 lookupEnumerator_key_parent ::
+                                                 Glean.Schema.Cxx1.Name,
+                                                 lookupEnumerator_key_scope ::
+                                                 Glean.Schema.Cxx1.Scope,
+                                                 lookupEnumerator_key_decl ::
+                                                 Glean.Schema.Cxx1.Enumerator}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupEnumerator_key where
+  toJSON
+    (LookupEnumerator_key __field__name __field__parent __field__scope
+       __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "parent" .= __field__parent :
+             "scope" .= __field__scope :
+               "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupEnumerator_key where
+  buildStruct _proxy
+    (LookupEnumerator_key __field__name __field__parent __field__scope
+       __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "parent" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__parent)
+             :
+             Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__scope)
+               :
+               Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 4 3
+                 (Thrift.buildStruct _proxy __field__decl)
+                 : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__parent <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__parent
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__parent <- ST.readSTRef __field__parent
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupEnumerator_key __val__name __val__parent
+                                                  __val__scope
+                                                  __val__decl)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("parent", 2), ("scope", 3), ("decl", 4)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupEnumerator_key where
+  rnf
+    (LookupEnumerator_key __field__name __field__parent __field__scope
+       __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__parent `Prelude.seq`
+          DeepSeq.rnf __field__scope `Prelude.seq`
+            DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupEnumerator_key where
+  def
+    = LookupEnumerator_key Default.def Default.def Default.def
+        Default.def
+
+instance Hashable.Hashable LookupEnumerator_key where
+  hashWithSalt __salt
+    (LookupEnumerator_key _name _parent _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+              _parent)
+           _scope)
+        _decl
+
+data LookupDefinition_key = LookupDefinition_key{lookupDefinition_key_name
+                                                 :: Glean.Schema.Cxx1.Name,
+                                                 lookupDefinition_key_scope ::
+                                                 Glean.Schema.Cxx1.Scope,
+                                                 lookupDefinition_key_entity ::
+                                                 Glean.Schema.CodeCxx.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDefinition_key where
+  toJSON
+    (LookupDefinition_key __field__name __field__scope __field__entity)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDefinition_key where
+  buildStruct _proxy
+    (LookupDefinition_key __field__name __field__scope __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__entity)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (LookupDefinition_key __val__name __val__scope
+                                                  __val__entity)
+              _idMap
+                = HashMap.fromList [("name", 1), ("scope", 2), ("entity", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDefinition_key where
+  rnf
+    (LookupDefinition_key __field__name __field__scope __field__entity)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default LookupDefinition_key where
+  def = LookupDefinition_key Default.def Default.def Default.def
+
+instance Hashable.Hashable LookupDefinition_key where
+  hashWithSalt __salt (LookupDefinition_key _name _scope _entity)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _entity
+
+data LookupDeclaration_key = LookupDeclaration_key{lookupDeclaration_key_name
+                                                   :: Glean.Schema.Cxx1.Name,
+                                                   lookupDeclaration_key_scope ::
+                                                   Glean.Schema.Cxx1.Scope,
+                                                   lookupDeclaration_key_decl ::
+                                                   Glean.Schema.Cxx1.Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration_key where
+  toJSON
+    (LookupDeclaration_key __field__name __field__scope __field__decl)
+    = Aeson.object
+        ("name" .= __field__name :
+           "scope" .= __field__scope :
+             "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration_key where
+  buildStruct _proxy
+    (LookupDeclaration_key __field__name __field__scope __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__name)
+           :
+           Thrift.genField _proxy "scope" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__scope)
+             :
+             Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 3 2
+               (Thrift.buildStruct _proxy __field__decl)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef Default.def
+            __field__scope <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__scope
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__scope <- ST.readSTRef __field__scope
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupDeclaration_key __val__name __val__scope
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("name", 1), ("scope", 2), ("decl", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration_key where
+  rnf
+    (LookupDeclaration_key __field__name __field__scope __field__decl)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__scope `Prelude.seq`
+          DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration_key where
+  def = LookupDeclaration_key Default.def Default.def Default.def
+
+instance Hashable.Hashable LookupDeclaration_key where
+  hashWithSalt __salt (LookupDeclaration_key _name _scope _decl)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name) _scope)
+        _decl
+
+data DefinitionOfDecl_key = DefinitionOfDecl_key{definitionOfDecl_key_decl
+                                                 :: Glean.Schema.Cxx1.Declaration,
+                                                 definitionOfDecl_key_entity ::
+                                                 Glean.Schema.CodeCxx.Entity}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DefinitionOfDecl_key where
+  toJSON (DefinitionOfDecl_key __field__decl __field__entity)
+    = Aeson.object
+        ("decl" .= __field__decl :
+           "entity" .= __field__entity : Prelude.mempty)
+
+instance Thrift.ThriftStruct DefinitionOfDecl_key where
+  buildStruct _proxy
+    (DefinitionOfDecl_key __field__decl __field__entity)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__decl)
+           :
+           Thrift.genField _proxy "entity" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__entity)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__decl <- ST.newSTRef Default.def
+            __field__entity <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__entity
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__decl <- ST.readSTRef __field__decl
+                                             !__val__entity <- ST.readSTRef __field__entity
+                                             Prelude.pure
+                                               (DefinitionOfDecl_key __val__decl __val__entity)
+              _idMap = HashMap.fromList [("decl", 1), ("entity", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData DefinitionOfDecl_key where
+  rnf (DefinitionOfDecl_key __field__decl __field__entity)
+    = DeepSeq.rnf __field__decl `Prelude.seq`
+        DeepSeq.rnf __field__entity `Prelude.seq` ()
+
+instance Default.Default DefinitionOfDecl_key where
+  def = DefinitionOfDecl_key Default.def Default.def
+
+instance Hashable.Hashable DefinitionOfDecl_key where
+  hashWithSalt __salt (DefinitionOfDecl_key _decl _entity)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _decl)
+        _entity
+{-# LINE 19 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupEnumerator_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupEnumerator_key x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupEnumerator_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupEnumerator_key"
+           (Prelude.Just 0))
+{-# LINE 32 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupEnumerator_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "parent"
+          (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+          ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+             ('Angle.TField "decl"
+                (Glean.KeyType Glean.Schema.Cxx1.Types.Enumerator)
+                ('Angle.TNoFields))))
+{-# LINE 34 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupEnumerator
+         where
+  type KeyType Glean.Schema.SymbolidCxx.Types.LookupEnumerator =
+       Glean.Schema.SymbolidCxx.Types.LookupEnumerator_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupEnumerator" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidCxx.Types.lookupEnumerator_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupEnumerator x k
+  getFactKey = Glean.Schema.SymbolidCxx.Types.lookupEnumerator_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 43 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SymbolidCxx.Types.LookupEnumerator
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 49 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "symbolid.cxx.LookupFunctionSignatureDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 62 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "signature"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+             ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+                ('Angle.TNoFields))))
+{-# LINE 64 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration
+       =
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef
+        "symbolid.cxx.LookupFunctionSignatureDeclaration"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration
+        x
+        k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 74 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 80 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupDefinition_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 91 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupDefinition_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 93 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupDefinition
+         where
+  type KeyType Glean.Schema.SymbolidCxx.Types.LookupDefinition =
+       Glean.Schema.SymbolidCxx.Types.LookupDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidCxx.Types.lookupDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupDefinition x k
+  getFactKey = Glean.Schema.SymbolidCxx.Types.lookupDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 102 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SymbolidCxx.Types.LookupDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 108 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupFunctionDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 119 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 121 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition
+       = Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupFunctionDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition x k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 131 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 137 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition_key
+       x1 x2 x3 x4)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "symbolid.cxx.LookupFunctionSignatureDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 150 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "signature"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+             ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+                ('Angle.TNoFields))))
+{-# LINE 152 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition
+       =
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition_key
+  getName _proxy
+    = Glean.PredicateRef
+        "symbolid.cxx.LookupFunctionSignatureDefinition"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition
+        x
+        k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 162 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 168 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupNamespaceDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 179 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition_key
+     =
+     'Angle.TField "name" (Prelude.Maybe Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Cxx1.Types.NamespaceQName)
+          ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+             ('Angle.TNoFields)))
+{-# LINE 181 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition
+       = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupNamespaceDefinition" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupNamespaceDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition x k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupNamespaceDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 191 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 197 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration_key x1
+       x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupNamespaceDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 208 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration_key
+     =
+     'Angle.TField "name" (Prelude.Maybe Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "parent"
+          (Prelude.Maybe Glean.Schema.Cxx1.Types.NamespaceQName)
+          ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 210 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration
+       = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupNamespaceDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupNamespaceDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration x k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupNamespaceDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 220 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupNamespaceDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 226 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupDeclaration_key x1 x2 x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 237 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupDeclaration_key
+     =
+     'Angle.TField "name" (Glean.KeyType Glean.Schema.Cxx1.Types.Name)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 239 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupDeclaration
+         where
+  type KeyType Glean.Schema.SymbolidCxx.Types.LookupDeclaration =
+       Glean.Schema.SymbolidCxx.Types.LookupDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidCxx.Types.lookupDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupDeclaration x k
+  getFactKey = Glean.Schema.SymbolidCxx.Types.lookupDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 248 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 254 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition_key
+       x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "symbolid.cxx.LookupFunctionSignatureQualifierDefinition_key"
+           (Prelude.Just 0))
+{-# LINE 269 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "signature"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+             ('Angle.TField "qualifiers"
+                (Prelude.Maybe Glean.Schema.Cxx1.Types.MethodSignature)
+                ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+                   ('Angle.TNoFields)))))
+{-# LINE 271 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition
+       =
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition_key
+  getName _proxy
+    = Glean.PredicateRef
+        "symbolid.cxx.LookupFunctionSignatureQualifierDefinition"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureQualifierDefinition_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition
+        x
+        k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureQualifierDefinition_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 281 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDefinition
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 287 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration_key
+       x1 x2 x3 x4 x5)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+         Glean.buildRtsValue b x4
+         Glean.buildRtsValue b x5
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration_key
+        <$> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef
+           "symbolid.cxx.LookupFunctionSignatureQualifierDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 302 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "signature"
+             (Glean.KeyType Glean.Schema.Cxx1.Types.Signature)
+             ('Angle.TField "qualifiers"
+                (Prelude.Maybe Glean.Schema.Cxx1.Types.MethodSignature)
+                ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+                   ('Angle.TNoFields)))))
+{-# LINE 304 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration
+       =
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef
+        "symbolid.cxx.LookupFunctionSignatureQualifierDeclaration"
+        1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureQualifierDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration
+        x
+        k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionSignatureQualifierDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 314 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionSignatureQualifierDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 320 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.DefinitionOfDecl_key"
+           (Prelude.Just 0))
+{-# LINE 329 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl_key
+     =
+     'Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+       ('Angle.TField "entity" (Glean.Schema.CodeCxx.Types.Entity)
+          ('Angle.TNoFields))
+{-# LINE 331 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl
+         where
+  type KeyType Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl =
+       Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.DefinitionOfDecl" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidCxx.Types.definitionOfDecl_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl x k
+  getFactKey = Glean.Schema.SymbolidCxx.Types.definitionOfDecl_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 340 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type Glean.Schema.SymbolidCxx.Types.DefinitionOfDecl
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 346 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration_key x1 x2
+       x3)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+         Glean.buildRtsValue b x3
+  decodeRtsValue
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.cxx.LookupFunctionDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 357 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration_key
+     =
+     'Angle.TField "name"
+       (Glean.KeyType Glean.Schema.Cxx1.Types.FunctionName)
+       ('Angle.TField "scope" (Glean.Schema.Cxx1.Types.Scope)
+          ('Angle.TField "decl" (Glean.Schema.Cxx1.Types.Declaration)
+             ('Angle.TNoFields)))
+{-# LINE 359 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration
+       = Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.cxx.LookupFunctionDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidCxx.Types.lookupFunctionDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration x k
+  getFactKey
+    = Glean.Schema.SymbolidCxx.Types.lookupFunctionDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 369 "glean/schema/thrift/symbolid_cxx_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidCxx.Types.LookupFunctionDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidJava/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidJava/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidJava/Types.hs
@@ -0,0 +1,499 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/symbolid_java_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/symbolid_java_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/symbolid_java_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidJava/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SymbolidJava.Types
+       (pREDICATE_VERSIONS, LookupMethodDeclaration_id,
+        LookupMethodDeclaration(LookupMethodDeclaration,
+                                lookupMethodDeclaration_id, lookupMethodDeclaration_key),
+        LookupDeclaration_id,
+        LookupDeclaration(LookupDeclaration, lookupDeclaration_id,
+                          lookupDeclaration_key),
+        LookupMethodDeclaration_key(LookupMethodDeclaration_key,
+                                    lookupMethodDeclaration_key_mname,
+                                    lookupMethodDeclaration_key_decl),
+        LookupDeclaration_key(LookupDeclaration_key,
+                              lookupDeclaration_key_qname, lookupDeclaration_key_decl))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.JavaAlpha.Types
+       as Glean.Schema.JavaAlpha
+import qualified Glean.Schema.JavakotlinAlpha.Types
+       as Glean.Schema.JavakotlinAlpha
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Schema.JavaAlpha.Types
+{-# LINE 16 "glean/schema/thrift/symbolid_java_include.hs" #-}
+import qualified Glean.Schema.JavakotlinAlpha.Types
+{-# LINE 87 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidJava/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("LookupMethodDeclaration", 1), ("LookupDeclaration", 1)]
+
+type LookupMethodDeclaration_id = Glean.Id
+
+data LookupMethodDeclaration = LookupMethodDeclaration{lookupMethodDeclaration_id
+                                                       ::
+                                                       {-# UNPACK #-} !LookupMethodDeclaration_id,
+                                                       lookupMethodDeclaration_key ::
+                                                       Prelude.Maybe LookupMethodDeclaration_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupMethodDeclaration where
+  toJSON (LookupMethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupMethodDeclaration where
+  buildStruct _proxy
+    (LookupMethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupMethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupMethodDeclaration where
+  rnf (LookupMethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupMethodDeclaration where
+  def = LookupMethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupMethodDeclaration where
+  hashWithSalt __salt (LookupMethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupDeclaration_id = Glean.Id
+
+data LookupDeclaration = LookupDeclaration{lookupDeclaration_id ::
+                                           {-# UNPACK #-} !LookupDeclaration_id,
+                                           lookupDeclaration_key ::
+                                           Prelude.Maybe LookupDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration where
+  toJSON (LookupDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration where
+  buildStruct _proxy (LookupDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LookupDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration where
+  rnf (LookupDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration where
+  def = LookupDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupDeclaration where
+  hashWithSalt __salt (LookupDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data LookupMethodDeclaration_key = LookupMethodDeclaration_key{lookupMethodDeclaration_key_mname
+                                                               ::
+                                                               Glean.Schema.JavakotlinAlpha.MethodName,
+                                                               lookupMethodDeclaration_key_decl ::
+                                                               Glean.Schema.JavaAlpha.Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupMethodDeclaration_key where
+  toJSON (LookupMethodDeclaration_key __field__mname __field__decl)
+    = Aeson.object
+        ("mname" .= __field__mname :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupMethodDeclaration_key where
+  buildStruct _proxy
+    (LookupMethodDeclaration_key __field__mname __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "mname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__mname)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__mname <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__mname <- ST.readSTRef __field__mname
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupMethodDeclaration_key __val__mname
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("mname", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupMethodDeclaration_key where
+  rnf (LookupMethodDeclaration_key __field__mname __field__decl)
+    = DeepSeq.rnf __field__mname `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupMethodDeclaration_key where
+  def = LookupMethodDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable LookupMethodDeclaration_key where
+  hashWithSalt __salt (LookupMethodDeclaration_key _mname _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _mname) _decl
+
+data LookupDeclaration_key = LookupDeclaration_key{lookupDeclaration_key_qname
+                                                   :: Glean.Schema.JavakotlinAlpha.QName,
+                                                   lookupDeclaration_key_decl ::
+                                                   Glean.Schema.JavaAlpha.Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration_key where
+  toJSON (LookupDeclaration_key __field__qname __field__decl)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration_key where
+  buildStruct _proxy
+    (LookupDeclaration_key __field__qname __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupDeclaration_key __val__qname __val__decl)
+              _idMap = HashMap.fromList [("qname", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration_key where
+  rnf (LookupDeclaration_key __field__qname __field__decl)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration_key where
+  def = LookupDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable LookupDeclaration_key where
+  hashWithSalt __salt (LookupDeclaration_key _qname _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _decl
+{-# LINE 19 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.java.LookupMethodDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/symbolid_java_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration_key
+     =
+     'Angle.TField "mname"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration
+       = Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.java.LookupMethodDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidJava.Types.lookupMethodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration x k
+  getFactKey
+    = Glean.Schema.SymbolidJava.Types.lookupMethodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidJava.Types.LookupMethodDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidJava.Types.LookupDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidJava.Types.LookupDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SymbolidJava.Types.LookupDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.java.LookupDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/symbolid_java_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidJava.Types.LookupDeclaration_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "decl" (Glean.Schema.JavaAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 57 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidJava.Types.LookupDeclaration
+         where
+  type KeyType Glean.Schema.SymbolidJava.Types.LookupDeclaration =
+       Glean.Schema.SymbolidJava.Types.LookupDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.java.LookupDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidJava.Types.lookupDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidJava.Types.LookupDeclaration x k
+  getFactKey = Glean.Schema.SymbolidJava.Types.lookupDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 66 "glean/schema/thrift/symbolid_java_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidJava.Types.LookupDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidKotlin/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidKotlin/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidKotlin/Types.hs
@@ -0,0 +1,501 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidKotlin/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.SymbolidKotlin.Types
+       (pREDICATE_VERSIONS, LookupMethodDeclaration_id,
+        LookupMethodDeclaration(LookupMethodDeclaration,
+                                lookupMethodDeclaration_id, lookupMethodDeclaration_key),
+        LookupDeclaration_id,
+        LookupDeclaration(LookupDeclaration, lookupDeclaration_id,
+                          lookupDeclaration_key),
+        LookupMethodDeclaration_key(LookupMethodDeclaration_key,
+                                    lookupMethodDeclaration_key_mname,
+                                    lookupMethodDeclaration_key_decl),
+        LookupDeclaration_key(LookupDeclaration_key,
+                              lookupDeclaration_key_qname, lookupDeclaration_key_decl))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Schema.JavakotlinAlpha.Types
+       as Glean.Schema.JavakotlinAlpha
+import qualified Glean.Schema.KotlinAlpha.Types
+       as Glean.Schema.KotlinAlpha
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 15 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Schema.JavakotlinAlpha.Types
+{-# LINE 16 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+import qualified Glean.Schema.KotlinAlpha.Types
+{-# LINE 87 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/SymbolidKotlin/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS
+  = Map.fromList
+      [("LookupMethodDeclaration", 1), ("LookupDeclaration", 1)]
+
+type LookupMethodDeclaration_id = Glean.Id
+
+data LookupMethodDeclaration = LookupMethodDeclaration{lookupMethodDeclaration_id
+                                                       ::
+                                                       {-# UNPACK #-} !LookupMethodDeclaration_id,
+                                                       lookupMethodDeclaration_key ::
+                                                       Prelude.Maybe LookupMethodDeclaration_key}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupMethodDeclaration where
+  toJSON (LookupMethodDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupMethodDeclaration where
+  buildStruct _proxy
+    (LookupMethodDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure
+                                               (LookupMethodDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupMethodDeclaration where
+  rnf (LookupMethodDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupMethodDeclaration where
+  def = LookupMethodDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupMethodDeclaration where
+  hashWithSalt __salt (LookupMethodDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+type LookupDeclaration_id = Glean.Id
+
+data LookupDeclaration = LookupDeclaration{lookupDeclaration_id ::
+                                           {-# UNPACK #-} !LookupDeclaration_id,
+                                           lookupDeclaration_key ::
+                                           Prelude.Maybe LookupDeclaration_key}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration where
+  toJSON (LookupDeclaration __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=)) __field__key
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration where
+  buildStruct _proxy (LookupDeclaration __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStructType _proxy)
+                                    2
+                                    1
+                                    (Thrift.buildStruct _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (LookupDeclaration __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration where
+  rnf (LookupDeclaration __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration where
+  def = LookupDeclaration Default.def Prelude.Nothing
+
+instance Hashable.Hashable LookupDeclaration where
+  hashWithSalt __salt (LookupDeclaration _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+
+data LookupMethodDeclaration_key = LookupMethodDeclaration_key{lookupMethodDeclaration_key_mname
+                                                               ::
+                                                               Glean.Schema.JavakotlinAlpha.MethodName,
+                                                               lookupMethodDeclaration_key_decl ::
+                                                               Glean.Schema.KotlinAlpha.Declaration}
+                                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupMethodDeclaration_key where
+  toJSON (LookupMethodDeclaration_key __field__mname __field__decl)
+    = Aeson.object
+        ("mname" .= __field__mname :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupMethodDeclaration_key where
+  buildStruct _proxy
+    (LookupMethodDeclaration_key __field__mname __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "mname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__mname)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__mname <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__mname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__mname <- ST.readSTRef __field__mname
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupMethodDeclaration_key __val__mname
+                                                  __val__decl)
+              _idMap = HashMap.fromList [("mname", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupMethodDeclaration_key where
+  rnf (LookupMethodDeclaration_key __field__mname __field__decl)
+    = DeepSeq.rnf __field__mname `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupMethodDeclaration_key where
+  def = LookupMethodDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable LookupMethodDeclaration_key where
+  hashWithSalt __salt (LookupMethodDeclaration_key _mname _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _mname) _decl
+
+data LookupDeclaration_key = LookupDeclaration_key{lookupDeclaration_key_qname
+                                                   :: Glean.Schema.JavakotlinAlpha.QName,
+                                                   lookupDeclaration_key_decl ::
+                                                   Glean.Schema.KotlinAlpha.Declaration}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON LookupDeclaration_key where
+  toJSON (LookupDeclaration_key __field__qname __field__decl)
+    = Aeson.object
+        ("qname" .= __field__qname :
+           "decl" .= __field__decl : Prelude.mempty)
+
+instance Thrift.ThriftStruct LookupDeclaration_key where
+  buildStruct _proxy
+    (LookupDeclaration_key __field__qname __field__decl)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "qname" (Thrift.getStructType _proxy) 1 0
+           (Thrift.buildStruct _proxy __field__qname)
+           :
+           Thrift.genField _proxy "decl" (Thrift.getStructType _proxy) 2 1
+             (Thrift.buildStruct _proxy __field__decl)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__qname <- ST.newSTRef Default.def
+            __field__decl <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__qname
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStructType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseStruct
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__decl
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__qname <- ST.readSTRef __field__qname
+                                             !__val__decl <- ST.readSTRef __field__decl
+                                             Prelude.pure
+                                               (LookupDeclaration_key __val__qname __val__decl)
+              _idMap = HashMap.fromList [("qname", 1), ("decl", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData LookupDeclaration_key where
+  rnf (LookupDeclaration_key __field__qname __field__decl)
+    = DeepSeq.rnf __field__qname `Prelude.seq`
+        DeepSeq.rnf __field__decl `Prelude.seq` ()
+
+instance Default.Default LookupDeclaration_key where
+  def = LookupDeclaration_key Default.def Default.def
+
+instance Hashable.Hashable LookupDeclaration_key where
+  hashWithSalt __salt (LookupDeclaration_key _qname _decl)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _qname) _decl
+{-# LINE 19 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration_key x1
+       x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.kotlin.LookupMethodDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 28 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration_key
+     =
+     'Angle.TField "mname"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.MethodName)
+       ('Angle.TField "decl" (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 30 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration
+         where
+  type KeyType
+         Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration
+       = Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.kotlin.LookupMethodDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid .
+          Glean.Schema.SymbolidKotlin.Types.lookupMethodDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration x k
+  getFactKey
+    = Glean.Schema.SymbolidKotlin.Types.lookupMethodDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 40 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidKotlin.Types.LookupMethodDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
+{-# LINE 46 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidKotlin.Types.LookupDeclaration_key
+         where
+  buildRtsValue b
+    (Glean.Schema.SymbolidKotlin.Types.LookupDeclaration_key x1 x2)
+    = do Glean.buildRtsValue b x1
+         Glean.buildRtsValue b x2
+  decodeRtsValue
+    = Glean.Schema.SymbolidKotlin.Types.LookupDeclaration_key <$>
+        Glean.decodeRtsValue
+        <*> Glean.decodeRtsValue
+  sourceType _
+    = Angle.NamedTy ()
+        (Angle.SourceRef "symbolid.kotlin.LookupDeclaration_key"
+           (Prelude.Just 0))
+{-# LINE 55 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+type instance
+     Angle.RecordFields
+       Glean.Schema.SymbolidKotlin.Types.LookupDeclaration_key
+     =
+     'Angle.TField "qname"
+       (Glean.KeyType Glean.Schema.JavakotlinAlpha.Types.QName)
+       ('Angle.TField "decl" (Glean.Schema.KotlinAlpha.Types.Declaration)
+          ('Angle.TNoFields))
+{-# LINE 57 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Predicate
+           Glean.Schema.SymbolidKotlin.Types.LookupDeclaration
+         where
+  type KeyType Glean.Schema.SymbolidKotlin.Types.LookupDeclaration =
+       Glean.Schema.SymbolidKotlin.Types.LookupDeclaration_key
+  getName _proxy
+    = Glean.PredicateRef "symbolid.kotlin.LookupDeclaration" 1
+  getId
+    = Glean.IdOf .
+        Glean.Fid . Glean.Schema.SymbolidKotlin.Types.lookupDeclaration_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.SymbolidKotlin.Types.LookupDeclaration x k
+  getFactKey
+    = Glean.Schema.SymbolidKotlin.Types.lookupDeclaration_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 66 "glean/schema/thrift/symbolid_kotlin_include.hs" #-}
+instance Glean.Type
+           Glean.Schema.SymbolidKotlin.Types.LookupDeclaration
+         where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/schema/thrift/gen-hs2/Glean/Schema/Sys/Types.hs b/glean/schema/thrift/gen-hs2/Glean/Schema/Sys/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/schema/thrift/gen-hs2/Glean/Schema/Sys/Types.hs
@@ -0,0 +1,165 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LINE 2 "glean/schema/thrift/sys_include.hs" #-}
+{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, DataKinds #-}
+{-# LINE 3 "glean/schema/thrift/sys_include.hs" #-}
+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
+{-# LINE 4 "glean/schema/thrift/sys_include.hs" #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LINE 14 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Sys/Types.hs" #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Glean.Schema.Sys.Types
+       (pREDICATE_VERSIONS, Blob_id, Blob(Blob, blob_id, blob_key)) where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as ByteString
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified Glean.Schema.Builtin.Types as Glean.Schema.Builtin
+import qualified Glean.Types as Glean
+import qualified Prelude as Prelude
+import qualified Rust.Types as Rust
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+{-# LINE 5 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Data.ByteString
+{-# LINE 6 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Data.Default
+{-# LINE 7 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Data.Text
+{-# LINE 9 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Glean.Types as Glean
+{-# LINE 10 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Glean.Typed as Glean
+{-# LINE 11 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Glean.Query.Angle as Angle
+{-# LINE 12 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Glean.Angle.Types as Angle
+{-# LINE 14 "glean/schema/thrift/sys_include.hs" #-}
+import qualified Glean.Schema.Builtin.Types
+{-# LINE 69 ".build/def/codegen/thrift-schema-hs/glean/schema/thrift/gen-hs2/Glean/Schema/Sys/Types.hs" #-}
+
+pREDICATE_VERSIONS :: Map.Map Text.Text Int.Int64
+pREDICATE_VERSIONS = Map.fromList [("Blob", 1)]
+
+type Blob_id = Glean.Id
+
+data Blob = Blob{blob_id :: {-# UNPACK #-} !Blob_id,
+                 blob_key :: Prelude.Maybe ByteString.ByteString}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Blob where
+  toJSON (Blob __field__id __field__key)
+    = Aeson.object
+        ("id" .= __field__id :
+           Prelude.maybe Prelude.id ((:) . ("key" .=))
+             (Prelude.fmap Thrift.encodeBase64Text __field__key)
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct Blob where
+  buildStruct _proxy (Blob __field__id __field__key)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "id" (Thrift.getI64Type _proxy) 1 0
+           (Thrift.genI64 _proxy __field__id)
+           :
+           case __field__key of
+             Prelude.Just _val -> Thrift.genField _proxy "key"
+                                    (Thrift.getStringType _proxy)
+                                    2
+                                    1
+                                    (Thrift.genBytes _proxy _val)
+                                    : []
+             Prelude.Nothing -> [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__id <- ST.newSTRef Default.def
+            __field__key <- ST.newSTRef Prelude.Nothing
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI64Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseI64
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__id
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBytes
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__key
+                                                                          (Prelude.Just _val)
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__id <- ST.readSTRef __field__id
+                                             !__val__key <- ST.readSTRef __field__key
+                                             Prelude.pure (Blob __val__id __val__key)
+              _idMap = HashMap.fromList [("id", 1), ("key", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Blob where
+  rnf (Blob __field__id __field__key)
+    = DeepSeq.rnf __field__id `Prelude.seq`
+        DeepSeq.rnf __field__key `Prelude.seq` ()
+
+instance Default.Default Blob where
+  def = Blob Default.def Prelude.Nothing
+
+instance Hashable.Hashable Blob where
+  hashWithSalt __salt (Blob _id _key)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _id) _key
+{-# LINE 17 "glean/schema/thrift/sys_include.hs" #-}
+instance Glean.Predicate Glean.Schema.Sys.Types.Blob where
+  type KeyType Glean.Schema.Sys.Types.Blob =
+       Data.ByteString.ByteString
+  getName _proxy = Glean.PredicateRef "sys.Blob" 1
+  getId = Glean.IdOf . Glean.Fid . Glean.Schema.Sys.Types.blob_id
+  mkFact (Glean.IdOf (Glean.Fid x)) k _
+    = Glean.Schema.Sys.Types.Blob x k
+  getFactKey = Glean.Schema.Sys.Types.blob_key
+  getFactValue _ = Prelude.Just ()
+{-# LINE 25 "glean/schema/thrift/sys_include.hs" #-}
+instance Glean.Type Glean.Schema.Sys.Types.Blob where
+  buildRtsValue b = Glean.buildRtsValue b . Glean.getId
+  decodeRtsValue = Glean.decodeRef
+  decodeAsFact = Glean.decodeFact
+  sourceType = Glean.predicateSourceType
diff --git a/glean/server/Glean/Handler.hs b/glean/server/Glean/Handler.hs
new file mode 100644
--- /dev/null
+++ b/glean/server/Glean/Handler.hs
@@ -0,0 +1,95 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+module Glean.Handler
+  ( State(..)
+  , handler
+  ) where
+
+import Data.Maybe
+
+import Facebook.Fb303
+
+import Glean as Backend
+import Glean.GleanService.Service as Service
+import Glean.Backend.Local
+import Glean.Backend.Logging
+import qualified Glean.Types as Thrift
+
+data State = State
+  { fb303State :: Fb303State
+  , stEnv :: Env
+  }
+
+handler :: State -> GleanServiceCommand a -> IO a
+handler State{..} req =
+  let backend = LoggingBackend stEnv in -- log (most) requests
+  case req of
+    Service.GetSchemaInfo repo req ->
+      Backend.getSchemaInfo backend (Just repo) req
+
+    Service.GetSchemaInfoForSchema req ->
+      Backend.getSchemaInfo backend Nothing req
+
+    Service.ValidateSchema req -> Backend.validateSchema backend req
+
+    Service.SendBatch cbatch -> Backend.enqueueBatch backend cbatch
+
+    Service.EnqueueBatch repo batch waitPolicy
+      -> Backend.enqueueBatchDescriptor backend repo batch waitPolicy
+
+    Service.FinishBatch handle -> Backend.pollBatch backend handle
+
+    Service.SendJsonBatch repo batch ->
+      Backend.enqueueJsonBatch backend repo batch
+
+    Service.KickOff rq -> Backend.kickOffDatabase backend rq
+
+    Service.Finish repo -> Backend.finishDatabase backend repo
+
+    Service.Finalize repo -> Backend.finalizeDatabase backend repo
+
+    Service.UpdateProperties repo set unset ->
+      Backend.updateProperties backend repo set unset
+
+    Service.QueryFact repo id ->
+      fromMaybe (Thrift.Fact 0 mempty mempty) <$>
+        Backend.queryFact backend repo id
+
+    Service.FactIdRange repo -> Backend.factIdRange backend repo
+
+    Service.UserQueryFacts repo req ->
+      Backend.userQueryFacts backend repo req
+
+    Service.UserQuery repo query ->
+      Backend.userQuery backend repo query
+
+    Service.UserQueryBatch repo queries -> do
+      Backend.userQueryBatch backend repo queries
+
+    Service.CompletePredicates repo preds ->
+      Backend.completePredicates_ backend repo preds
+
+    Service.DeriveStored repo pred ->
+      Backend.deriveStored backend (const mempty) repo pred
+
+    Service.PredicateStats repo Thrift.PredicateStatsOpts{..} ->
+      Backend.predicateStats backend repo $
+        if predicateStatsOpts_excludeBase then ExcludeBase else IncludeBase
+
+    Service.ListDatabases l ->
+      Backend.listDatabases backend l
+
+    Service.GetDatabase repo -> Backend.getDatabase backend repo
+
+    Service.DeleteDatabase repo -> Backend.deleteDatabase backend repo
+
+    Service.Restore loc -> Backend.restoreDatabase backend loc
+
+    SuperFacebookService c -> fb303Handler fb303State c
diff --git a/glean/server/Glean/Server.hs b/glean/server/Glean/Server.hs
new file mode 100644
--- /dev/null
+++ b/glean/server/Glean/Server.hs
@@ -0,0 +1,201 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Server (main) where
+
+import Control.Concurrent.Async (race)
+import Control.Monad
+import Data.IORef
+import Data.Maybe
+import Data.Time
+import qualified Options.Applicative as O
+import System.Time.Extra (Seconds)
+
+import Facebook.Fb303
+import Facebook.Service
+import Fb303Core.Types
+#ifdef FBTHRIFT
+import qualified Thrift.Server.CppServer as ThriftServer
+#else
+import qualified Thrift.Server.HTTP as ThriftServer
+#endif
+import Util.EventBase
+import Util.Log
+import Util.STM
+
+#if GLEAN_FACEBOOK
+import Data.Typeable (cast)
+import Network.HTTP.Client
+
+import JustKnobs (evalKnob)
+import Logger.IO
+import Glean.Facebook.Logger.Server
+import Glean.Facebook.Logger.Database
+import Glean.BatchLocation.FacebookBatchLocation
+import qualified Glean.Database.Backup.Manifold as Manifold
+import qualified Glean.Database.Backup.XDBCatalog as XDB
+import Glean.Server.Available ( withAvailableDBFilterViaSR )
+import Glean.Server.Tracing
+import Manifold.Client
+import Glean.Util.Some
+#endif
+
+import Glean.Database.Config (Config(..))
+import Glean.Database.Env
+import Glean.Database.Types
+import qualified Glean.Handler as GleanHandler
+import Glean.Impl.ConfigProvider (ConfigAPI)
+import qualified Glean.Index as Index
+import Glean.Index.GleanIndexingService.Service
+import Glean.Server.Config as Config
+import Glean.Server.Sharding (
+  shardManagerConfig,
+  withShardsUpdater,
+  waitForTerminateSignalsAndGracefulShutdown)
+import Glean.Util.ConfigProvider
+
+main :: IO ()
+main =
+  withConfigOptions (O.info options O.fullDesc) $ \(cfg0, cfgOpts) ->
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider cfgOpts $ \(configAPI :: ConfigAPI) ->
+#if GLEAN_FACEBOOK
+  withLogger configAPI $ \logger ->
+  withTracing $ \tracer ->
+  withAvailableDBFilterViaSR evb $ \filterAvailableDBs ->
+#endif
+  let dbCfg = (cfgDBConfig cfg0){
+        cfgShardManager = shardManagerConfig (cfgPort cfg)
+#if GLEAN_FACEBOOK
+        , cfgServerLogger = Some (GleanServerFacebookLogger logger)
+        , cfgDatabaseLogger = Some (GleanDatabaseFacebookLogger logger)
+        , cfgBatchLocationParser = Some (FacebookBatchLocationParser)
+        , cfgFilterAvailableDBs = filterAvailableDBs
+        , cfgTracer = tracer
+#endif
+      }
+
+#if GLEAN_FACEBOOK
+      cfg = cfg0{cfgDBConfig = XDB.withXdbCatalog "manifold" $
+                  Manifold.withManifoldBackups evb dbCfg}
+#else
+      cfg = cfg0{cfgDBConfig = dbCfg}
+#endif
+  in
+  withDatabases evb (cfgDBConfig cfg) configAPI $ \databases -> do
+  terminating <- newTVarIO False
+  withShardsUpdater evb cfg databases (1 :: Seconds) (readTVar terminating) $ do
+
+  fb303 <- newFb303 "gleandriver"
+
+  logInfo "Starting server"
+  portVar <- newTVarIO Nothing
+
+  let
+    setAlive server = do
+      let port = ThriftServer.serverPort server
+      atomically $ writeTVar portVar (Just port)
+      forM_ (cfgWritePort cfg) $ \path -> writeFile path (show port)
+      logInfo $ "server alive on port " ++ show port
+      writeIORef (fb303_status fb303) Fb303_status_ALIVE
+
+    -- If the janitor is enabled, wait until it has run once to
+    -- completion before we advertise the server as alive.  Otherwise
+    -- clients may contact this server and see no available DBs.
+    waitForAlive server = do
+      (_, l) <- atomically $ do
+        l <- readTVar $ envDatabaseJanitor databases
+        maybe retry return l
+
+      case l of
+        JanitorRunFailure JanitorFetchBackupsFailure{} -> do
+          logError "Aborting: failed to list remote DBs at startup"
+          return False
+        JanitorTimeout -> do
+          logError "Aborting: Janitor timeout at startup"
+          return False
+        JanitorStuck -> do
+          logError "Aborting: Janitor stuck at startup"
+          return False
+        JanitorRunSuccess ->
+          setAlive server >> return True
+        JanitorRunFailure OtherJanitorException{} ->
+          setAlive server >> return True
+        JanitorDisabled ->
+          setAlive server >> return True
+
+    monitorJanitor t0 = do
+      (t1, result) <- atomically $ do
+        l <- readTVar (envDatabaseJanitor databases)
+        case l of
+          Nothing -> retry
+          Just (t1, r)
+            | t1 == t0 -> retry  -- block until the next janitor run
+            | otherwise -> return (t1, r)
+      case result of
+        JanitorStuck -> do
+          logError "Aborting: Janitor stuck"
+#ifdef GLEAN_FACEBOOK
+        JanitorRunFailure (JanitorFetchBackupsFailure fetchError) -> do
+          let dbServerBelievedDead = if
+                | Just NoHostsError
+                  <- cast fetchError -> True
+                | Just (HttpExceptionRequest _req ConnectionFailure{})
+                  <- cast fetchError -> True
+                | Just (HttpExceptionRequest _req ConnectionTimeout{})
+                  <- cast fetchError -> True
+                | otherwise -> False
+          knob <-
+            evalKnob "code_indexing/glean:server_automated_restarts"
+          if knob == Right True && not dbServerBelievedDead
+              then logError "Aborting: failed to list remote DBs too many times"
+              else monitorJanitor t1
+#endif
+        _ -> monitorJanitor t1
+
+    waitForTerminate = void $
+      (getCurrentTime >>= monitorJanitor)
+       `race`
+      waitForTerminateSignalsAndGracefulShutdown
+                        databases
+                        terminating
+                        (cfgGracefulShutdownTimeout cfg)
+
+    waitToStart server = do
+      success <- waitForAlive server
+      when success waitForTerminate
+    opts = ThriftServer.defaultOptions {
+      ThriftServer.desiredPort = cfgPort cfg }
+
+    getPort =
+      fromMaybe (error "server hasn't started yet") <$> readTVarIO portVar
+
+  let state = GleanHandler.State fb303 databases
+
+  if cfgEnableIndexing cfg
+    then
+      withBackgroundFacebookServiceDeferredAlive
+        (GleanHandler.fb303State state)
+        (handlerIndexing state getPort)
+        opts
+        waitToStart
+    else
+      withBackgroundFacebookServiceDeferredAlive
+        (GleanHandler.fb303State state)
+        (GleanHandler.handler state)
+        opts
+        waitToStart
+
+handlerIndexing
+  :: GleanHandler.State
+  -> IO Int -- ^ get the port the server is running on
+  -> GleanIndexingServiceCommand a
+  -> IO a
+handlerIndexing state getPort req = case req of
+  Index r -> Index.index getPort (GleanHandler.stEnv state) r
+  SuperGleanService r -> GleanHandler.handler state r
diff --git a/glean/server/Glean/Server/Config.hs b/glean/server/Glean/Server/Config.hs
new file mode 100644
--- /dev/null
+++ b/glean/server/Glean/Server/Config.hs
@@ -0,0 +1,49 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Server.Config (
+  Config(..), options
+) where
+
+import qualified Glean.Backend.Local as DBConfig
+
+import Control.Applicative
+import qualified Options.Applicative as O
+import System.Time.Extra (Seconds)
+
+data Config = Config
+  { cfgPort :: Maybe Int
+  , cfgDBConfig :: DBConfig.Config
+  , cfgPublishShards :: Bool
+  , cfgEnableIndexing :: Bool
+  , cfgGracefulShutdownTimeout :: Seconds
+  , cfgWritePort :: Maybe FilePath
+  , cfgHandler :: String -- ^ deprecated, ignored.
+  }
+
+options :: O.Parser Config
+options = Config
+  <$> O.optional (O.option O.auto (O.long "port" <> O.short 'p'))
+  <*> DBConfig.options
+  <*> ( O.switch (O.long "publish-shards" <>
+                  O.help "publish db hashes via SMC shards")
+        -- obsolete spelling still used in TW scripts
+        <|> O.switch (O.long "set-shards" <> O.hidden)
+  )
+  <*> O.switch (O.long "enable-indexing")
+  <*> O.option O.auto
+        (O.long "graceful-shutdown-wait-seconds" <>
+          O.value 0 <>
+          O.showDefault <>
+          O.help ("How long to wait for incomplete DBs before shutting down."
+                  <> " A value of 0 disables the graceful shutdown"))
+  <*> O.optional (O.strOption
+      (O.long "write-port"
+        <> O.metavar "FILE"
+        <> O.help "write port number to file once server is alive"))
+  <*> pure "glean"
diff --git a/glean/server/Glean/Server/Sharding.hs b/glean/server/Glean/Server/Sharding.hs
new file mode 100644
--- /dev/null
+++ b/glean/server/Glean/Server/Sharding.hs
@@ -0,0 +1,251 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Server.Sharding (
+  shardManagerConfig,
+  withShardsUpdater,
+  waitForTerminateSignalsAndGracefulShutdown,
+  -- for testing
+  dbUpdateNotifierThread) where
+
+import Control.Concurrent (
+  modifyMVar_,
+  newMVar,
+  MVar,
+  newEmptyMVar,
+  tryPutMVar,
+  takeMVar)
+import Control.Concurrent.Async ( withAsync )
+import Control.Exception
+import Control.Monad ( when, void, unless )
+import Data.HashSet (HashSet, toList)
+import qualified Data.HashSet as HashSet
+import Data.List (sort)
+#if GLEAN_FACEBOOK
+import Data.Maybe
+#endif
+import qualified Data.Set as Set
+import GHC.Conc (unsafeIOToSTM)
+import Glean.Backend.Types (dbShard)
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter as Catalog
+import Glean.Database.Types ( Env(..) )
+#if GLEAN_FACEBOOK
+import Glean.Impl.ShardManager
+#endif
+import Glean.Server.Config (Config, cfgPort, cfgPublishShards)
+import Glean.Server.PublishShards ( ShardKey, getShardKey, updateShards )
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Types ( Repo )
+import Glean.Util.Observed (Observed)
+import qualified Glean.Util.Observed as Observed
+import Glean.Util.Periodic ( doPeriodically )
+import Glean.Util.ShardManager
+import Glean.Util.ThriftService (DbShard)
+import Util.Time ( seconds )
+import System.Exit (die)
+import System.Posix.Signals (installHandler, sigTERM, Handler (Catch), sigINT)
+import System.Time.Extra ( showDuration, sleep, Seconds )
+import Util.Control.Exception ( swallow )
+import Util.EventBase ( EventBaseDataplane )
+import Util.Log ( vlog, logInfo )
+import Util.STM
+  (retry, atomically, writeTVar, STM, TVar, readTVar, registerDelay)
+
+
+type PortNumber = Int
+
+shardManagerConfig ::
+  -- | Application port
+  Maybe PortNumber ->
+  Catalog.Catalog ->
+  Observed ServerConfig.Config ->
+  (SomeShardManager -> IO b) ->
+  IO b
+shardManagerConfig _mbPort _catalog smCfgServerConfig callback = do
+  config <- Observed.get smCfgServerConfig
+  case ServerConfig.config_sharding config of
+    ServerConfig.ShardingPolicy_no_shards {} ->
+      callback $ SomeShardManager noSharding
+    ServerConfig.ShardingPolicy_static_assignment {} ->
+      callback $
+        SomeShardManager $
+          shardByRepo $ do
+            config <- Observed.get smCfgServerConfig
+            case ServerConfig.config_sharding config of
+              ServerConfig.ShardingPolicy_static_assignment assignment ->
+                return $
+                  Just $
+                    Set.toList $
+                      ServerConfig.staticShardsPolicy_shards assignment
+              _ ->
+                return Nothing
+#if GLEAN_FACEBOOK
+    ServerConfig.ShardingPolicy_shard_manager policy -> do
+      let smCliArgs = ShardManagerClientArgs
+            { serviceName = ServerConfig.shardManagerPolicy_service_name policy
+            , applicationPortNumber = fromMaybe 0 _mbPort
+            , numberOfShards = fromIntegral $
+                ServerConfig.shardManagerPolicy_nshards policy
+            , defaultDomainName =
+              ServerConfig.shardManagerPolicy_default_domain_id policy
+            }
+      withShardManager smCliArgs $ \sm -> callback $ SomeShardManager sm
+    ServerConfig.ShardingPolicy_shard_manager_most_recent policy -> do
+      let ServerConfig.ShardManagerMostRecentPolicy{
+            ServerConfig.shardManagerMostRecentPolicy_shard_manager_policy =
+              ServerConfig.ShardManagerPolicy{..},
+            .. } = policy
+          smCliArgs = ShardManagerClientArgs
+            { serviceName = shardManagerPolicy_service_name
+            , applicationPortNumber = fromMaybe 0 _mbPort
+            , numberOfShards = fromIntegral shardManagerPolicy_nshards
+            , defaultDomainName = shardManagerPolicy_default_domain_id
+            }
+          getMostRecent =
+            Set.fromList . map itemRepo <$> Catalog.listMostRecent _catalog
+
+      withShardManagerForMostRecent
+        smCliArgs
+        shardManagerMostRecentPolicy_most_recent_domain_id
+        getMostRecent $ \sm -> callback $ SomeShardManager sm
+#endif
+    other ->
+      error $ "Unsupported sharding policy: " <> show other
+
+databasesUpdatedCallback
+  :: EventBaseDataplane
+  -> ShardKey
+  -> MVar (Maybe [DbShard])
+  -> HashSet Repo
+  -> IO ()
+databasesUpdatedCallback evb shardKey currentShards dbs = swallow $ do
+  modifyMVar_ currentShards $ \prevShards -> do
+    let newShards = sort $ map dbShard $ HashSet.toList dbs
+
+    if Just newShards == prevShards then do
+      logInfo $ "no change in shards: " <> show newShards
+      return prevShards
+    else do
+      updateShards evb shardKey newShards
+      return (Just newShards)
+
+-- The 'dbUpdateNotifierThread' will sit in a loop waiting for changes
+-- to the local databases (using STM retry to detect changes).  When
+-- changes are detected, it waits 1s so that multiple changes are
+-- processed in a single batch, and then invokes the callback.
+--
+-- The doPeriodically on the outside is just a fallback in case something
+-- goes wrong; it ensures that the exception is caught and logged, and we
+-- don't immediately retry in a loop.
+--
+dbUpdateNotifierThread
+  :: Env
+  -> Seconds
+  -> STM Bool  -- ^ is the server gracefullly shutting down?
+  -> (HashSet Repo -> IO ())
+  -> IO ()
+dbUpdateNotifierThread env delay terminating callback =
+  doPeriodically (seconds 30) $ do
+    initial <- updated
+    go initial
+    where
+    go prev = do
+      atomically $ do
+        termSignal <- terminating
+        dbs <- fetchCurrentShardList env termSignal
+        when (dbs == prev) retry
+
+      vlog 1 $ "DB update detected, waiting " <> showDuration delay
+      sleep delay -- wait 1s so we can batch updates
+      current <- updated
+      go current
+
+    updated = do
+      termSignal <- atomically terminating
+      dbs <- atomically $ fetchCurrentShardList env termSignal
+      vlog 1 "DB update notification"
+      callback dbs
+      return dbs
+
+withShardsUpdater
+  :: EventBaseDataplane
+  -> Config
+  -> Env
+  -> Seconds
+  -> STM Bool  -- ^ is the server gracefullly shutting down?
+  -> IO a
+  -> IO a
+withShardsUpdater evb cfg env delay terminating action
+  | cfgPublishShards cfg = do
+    port <- case cfgPort cfg of
+      Just port -> return port
+      Nothing -> die "--publish-shards requires --port"
+    currentShards <- newMVar Nothing
+    key <- getShardKey evb port
+    withAsync
+      (dbUpdateNotifierThread env delay terminating
+        $ databasesUpdatedCallback evb key currentShards)
+      $ const action
+  | otherwise = action
+
+
+waitForTerminateSignalsAndGracefulShutdown
+  :: Env
+  -> TVar Bool -- ^ broadcast channel for initiating the timeout
+  -> Seconds -- ^ amount of time to wait before forcing a shutdown
+  -> IO ()
+waitForTerminateSignalsAndGracefulShutdown env terminating timeout = do
+  -- To wait in Haskell-land while the server is taking requests,
+  -- use an mvar that gets filled when the right signals are read
+  mvar <- newEmptyMVar
+  let sigHandler = void $ tryPutMVar mvar ()
+  withSignalHandler sigTERM sigHandler $ \_ ->
+    withSignalHandler sigINT sigHandler $ \_ -> do
+      -- Haskell will wait here until being instructed to stop
+      takeMVar mvar
+      logInfo "SIGTERM/SIGINT received"
+
+      -- stop publishing complete shards
+      atomically $ writeTVar terminating True
+
+      -- start the timeout (if any)
+      timeoutElapsedSTM <- if timeout > 0
+        then readTVar <$> registerDelay (floor $ timeout * 1000000)
+        else return $ pure True
+
+      -- block until we do not advertise any shards anymore or run out of time
+      atomically $ do
+        dbs <- list
+        timeoutElapsed <- timeoutElapsedSTM
+
+        -- terminate when either the list is empty or we exceed the timeout
+        unless (null dbs || timeoutElapsed) $ do
+          unsafeIOToSTM $ logInfo $
+            "Waiting for incomplete dbs: " <> show (toList dbs)
+          retry
+
+      logInfo "Shutting down"
+
+  where
+    withSignalHandler sig h = bracket
+      (installHandler sig (Catch h) Nothing)
+      (\old -> installHandler sig old Nothing)
+
+    list = fetchCurrentShardList env True
+
+
+fetchCurrentShardList :: Env -> Bool -> STM (HashSet Repo)
+fetchCurrentShardList Env{..} terminating =
+    let filter = if terminating
+                  then incompleteQueryableF
+                  else queryableF
+    in
+    HashSet.fromList . map Catalog.itemRepo
+      <$> Catalog.list envCatalog [Catalog.Local] filter
diff --git a/glean/shell/Glean/Shell.hs b/glean/shell/Glean/Shell.hs
new file mode 100644
--- /dev/null
+++ b/glean/shell/Glean/Shell.hs
@@ -0,0 +1,1459 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+module Glean.Shell
+  ( ShellCommand
+  ) where
+
+import Control.Concurrent
+import Control.Exception hiding (evaluate)
+import Control.Monad.Extra
+import qualified Control.Monad.Catch as C
+import Control.Monad.IO.Class (liftIO, MonadIO)
+import Control.Monad.Trans.Class (lift)
+import qualified Control.Monad.Trans.State.Strict as State
+import qualified Data.ByteString.UTF8 as UTF8
+import Data.Char
+import Data.Default
+import Data.Foldable
+import qualified Data.HashMap.Strict as HashMap
+import Data.Int
+import Data.IORef
+import Data.List
+import Data.List.Split
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Ord
+import qualified Data.Set as Set
+import Text.Printf
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter as Pretty hiding ((<>), pageWidth)
+import Compat.Prettyprinter.Util as Pretty hiding (words)
+import qualified Prettyprinter.Render.Terminal as Pretty
+import Data.Time.Clock
+import Data.Time.Clock.POSIX
+import qualified Options.Applicative as O
+import Options.Applicative hiding (help)
+import qualified System.Console.Haskeline as Haskeline
+import System.Environment (lookupEnv)
+import System.FilePath ((</>), takeBaseName)
+import System.IO
+import System.IO.Temp
+import System.Process (callCommand)
+import System.Mem.Weak
+import System.Posix.Signals
+import System.Exit
+import qualified Text.JSON as JSON
+import Text.Parsec (runParser)
+
+#if MIN_VERSION_haskeline(0,8,0)
+import qualified Control.Monad.Catch as HEx (handle, bracket)
+#else
+import qualified System.Console.Haskeline as HEx (handle, bracket)
+#endif
+
+import Util.JSON.Pretty ()
+import Util.List
+import Util.OptParse
+import Util.String
+import Util.Text
+import Util.TimeSec
+
+import qualified Glean
+import qualified Glean.BuildInfo as BuildInfo
+import Glean.Angle.Types as SchemaTypes hiding (describe)
+import Glean.Display
+import Glean.Remote (clientInfo, thriftBackendClientConfig)
+import Glean.Database.Ownership
+import Glean.Database.Open
+import Glean.Database.Schema ( newDbSchema, readWriteContent )
+import Glean.Database.Schema.Types ( SchemaSelector(..) )
+import Glean.Database.Schema.ComputeIds (
+  emptyHashedSchema, HashedSchema(..), RefTargetId )
+import Glean.Database.Config (parseSchemaDir, SchemaIndex(..),
+  ProcessedSchema(..), SchemaLocation(..), schemaLocation)
+import qualified Glean.Database.Config as DB (Config(..))
+import Glean.Database.Storage (describe)
+import Glean.Database.Types (Env(..))
+import Glean.Indexer
+import Glean.Indexer.List
+import Glean.LocalOrRemote as Glean hiding (options, withBackend)
+import Glean.RTS.Types (Pid(..), Fid(..))
+import Glean.RTS.Foreign.Query (interruptRunningQueries)
+import Glean.Schema.Types
+import Glean.Schema.Util
+import Glean.Shell.Index
+import Glean.Shell.Terminal
+import Glean.Shell.Types
+import Glean.Shell.Error (Ann, BadQuery(..), prettyBadQuery)
+import qualified Glean.Types as Thrift
+import Glean.Util.ConfigProvider
+#if GLEAN_FACEBOOK
+import Glean.Util.CxxXRef
+#endif
+import Glean.Util.Service
+import Glean.Util.ShellPrint
+import Glean.Util.Some
+import qualified Glean.Util.ThriftSource as ThriftSource
+
+import GleanCLI.Types
+
+data Config = Config
+  { cfgDatabase :: Maybe String
+  , cfgQuery :: [String]
+  , cfgLimit :: Int64
+  , cfgWidth :: Maybe Int
+  , cfgPager :: Bool
+  }
+
+options :: Parser Config
+options = commandParser "shell" (progDesc "Start the Glean shell") parser
+  where
+    parser = do
+      cfgDatabase <- optional $ strOption
+        (  long "db"
+        <> metavar "NAME"
+        <> O.help "database to use (default: use latest complete DB)" )
+      cfgLimit <- option auto
+        (  long "limit"
+        <> metavar "N"
+        <> value 100
+        <> O.help "Set max number of results to fetch"
+        )
+      cfgQuery <- many $ strArgument
+        (  metavar "QUERY"
+        <> O.help
+          ( "Perform one or more queries or commands"
+          <> " (default: enter the REPL)")
+        )
+      cfgWidth <- optional $ option auto
+        (  long "width"
+        <> metavar "N"
+        <> O.help "Output line width (0: unbounded, default: adaptive)"
+        )
+      cfgPager <- switch
+        (  long "pager"
+        <> O.help "Use a pager for displaying long output"
+        )
+      return Config{..}
+
+output :: Doc Ann -> Eval ()
+output doc = do
+  ShellState{..} <- getState
+  out <- liftIO $ readMVar outputHandle
+  liftIO
+    $ Pretty.renderIO out
+    $ layoutPretty
+        LayoutOptions{ layoutPageWidth = fromMaybe Unbounded pageWidth }
+    $ (if isTTY then id else Pretty.unAnnotate)
+    $ doc <> hardline
+
+outputShellPrint :: ShellPrint a => a -> Eval ()
+outputShellPrint x = do
+  ShellState{..} <- getState
+  out <- liftIO $ readMVar outputHandle
+  now <- liftIO $ utcTimeToPOSIXSeconds <$> getCurrentTime
+  let
+    t0 = Time (round now)
+    format = if isTTY then TTY else PlainText
+    opts = PrintOpts
+      { poFormat = format
+      , poNow = t0
+      , poWidth = pageWidth
+      }
+  liftIO $ do
+    shellPrint out opts x
+    hPutStrLn out ""
+
+newtype Repl a = Repl
+  { unRepl :: Haskeline.InputT Eval a
+  }
+  deriving (Functor, Applicative, Monad, MonadIO
+#if MIN_VERSION_haskeline(0,8,0)
+    , C.MonadThrow, C.MonadCatch, C.MonadMask
+#else
+    , Haskeline.MonadException
+#endif
+  )
+repoString :: Thrift.Repo -> String
+repoString repo = concat
+  [Text.unpack (Thrift.repo_name repo)
+  ,"/"
+  ,Text.unpack (Thrift.repo_hash repo)
+  ]
+
+lookupPid :: Pid -> Eval (Maybe PredicateRef)
+lookupPid (Pid pid) = do
+  m <- schemaInfo <$> getState
+  case m of
+    Nothing -> return Nothing
+    Just Thrift.SchemaInfo{..} ->
+      return $ Map.lookup pid schemaInfo_predicateIds
+
+withRepo :: (Thrift.Repo -> Eval a) -> Eval a
+withRepo f = do
+  r <- getRepo
+  case r of
+    Just repo -> f repo
+    Nothing -> liftIO $ throwIO $ ErrorCall "no database selected"
+
+useSchema :: String -> Eval ()
+useSchema "" = do
+  ShellState{..} <- getState
+  maybeCurrentId <- getSchemaId
+  forM_ maybeCurrentId $ \currentId ->
+    output $ "Using Schema ID: " <> pretty (Thrift.unSchemaId currentId)
+  forM_ schemaInfo $ \Thrift.SchemaInfo{..} -> do
+    output $ vcat $ map (nest 4 . vcat)
+      [ [ "Current schema ID(s):",
+          showSchemaIds schemaInfo_schemaIds ]
+      , [ "Schema ID(s) stored in the DB:",
+          showSchemaIds schemaInfo_dbSchemaIds ]
+      , [ "Other available schema ID(s):",
+          vcat (map showSchemaIds schemaInfo_otherSchemaIds) ]
+      ]
+  where
+  showSchemaIds m = vcat
+    [ pretty schemaId <+> parens ("all." <> pretty ver)
+    | (schemaId, ver) <- Map.toList m
+    ]
+useSchema str = do
+  state <- getState
+  sel <- case str of
+    "current" -> return (Thrift.SelectSchema_current def)
+    "stored" -> return (Thrift.SelectSchema_stored def)
+    id | Just Thrift.SchemaInfo{..} <- schemaInfo state,
+         Text.pack id `Map.member` schemaInfo_schemaIds ||
+         Text.pack id `Map.member` schemaInfo_dbSchemaIds ||
+         any (Text.pack id `Map.member`) schemaInfo_otherSchemaIds ->
+           return (Thrift.SelectSchema_schema_id
+             (Thrift.SchemaId (Text.pack id)))
+       | otherwise -> liftIO $ throwIO $ ErrorCall $ "unknown schema: " <> id
+  Eval $ State.modify $ \s -> s { useSchemaId = sel }
+  -- Fetch the new schema
+  mapM_ setRepo =<< getRepo
+
+getSchemaCmd :: String -> Eval ()
+getSchemaCmd str = do
+  maybeProc <- schemas <$> getState
+
+  ProcessedSchema{..} <- case maybeProc of
+    Nothing -> liftIO $ throwIO $ ErrorCall
+      "no schema loaded. Use :db to load a DB."
+    Just proc  -> return proc
+
+  nameEnv <- getNameEnv
+  let
+    HashedSchema{..} = procSchemaHashed
+
+    opts = defaultDisplayOpts { predicateStyle = PredicateWithoutHash }
+
+    found refs = output $ vcat $ punctuate line $ map pp refs
+      where
+      pp ref = case ref of
+        RefPred p -> case HashMap.lookup p hashedPreds of
+          Nothing -> mempty
+          Just def -> display opts def
+        RefType p -> case HashMap.lookup p hashedTypes of
+          Nothing -> mempty
+          Just def -> display opts def
+
+  env <- case nameEnv of
+    Nothing -> liftIO $ throwIO $ ErrorCall "can't find schema"
+    Just env -> return env
+
+  let name = Text.pack (strip str)
+  case resolveRef env (parseRef name) of
+    ResolvesTo one -> found [one]
+    Ambiguous many -> found many
+    OutOfScope ->  -- doesn't match exactly; match it as a prefix
+      found $ Set.toList $ Set.unions $ HashMap.elems $
+        HashMap.filterWithKey prefixMatch env
+      where
+      prefixMatch k _ = name `Text.isPrefixOf` showRef k
+
+displayStatistics :: String -> Eval ()
+displayStatistics arg =
+  withRepo $ \repo ->
+  withBackend $ \backend -> do
+  let containsRemove element list = return (filter (/=element) list,
+                                            isJust (find (==element) list))
+  let args = words arg
+  (args, sortBySize) <- containsRemove "-s" args
+  (args, topmost) <- containsRemove "--topmost" args
+  predicate <- case args of
+    [] -> return ""
+    [predicate] -> return predicate
+    _ -> liftIO $ throwIO $
+      ErrorCall "syntax: :statistics [--topmost] [-s] [<predicate>]"
+  let
+  xs <- liftIO $ Glean.predicateStats backend repo (
+      if topmost then Glean.ExcludeBase else Glean.IncludeBase)
+  preds <- forM (Map.toList xs) $ \(id,stats) -> do
+    ref <- maybe (Left id) Right <$> lookupPid (Pid id)
+    return (ref,stats)
+  let
+    filterPred :: Either Thrift.Id PredicateRef -> Bool
+    filterPred ref =
+      null predicate ||
+          case ref of
+            Right pref -> predicate `isPrefixOf` show (pretty pref)
+            Left _ -> False
+  let showTotal = null predicate
+  let format = StatsFormatOpts { showTotal, sortBySize }
+  outputShellPrint $ (filterPred, preds) `withFormatOpts` format
+
+getDatabases
+  :: Bool -- ^ Include DBs that can be restored from backups
+  -> String -- ^ Only display dbs with a repo name containing this string
+  -> Eval [Thrift.Database]
+getDatabases all filterStr = do
+  state <- getState
+  r <- withBackend $ \be ->
+    liftIO $ Glean.listDatabases be
+      def { Thrift.listDatabases_includeBackups = all
+          , Thrift.listDatabases_client_info = Just (client_info state)
+          }
+  let
+    -- argument can be NAME or NAME/HASH
+    repoFilter str db =
+      str `isInfixOf` repoString repo ||
+      Text.pack str `Text.isInfixOf` Thrift.repo_name repo
+      where repo = Thrift.database_repo db
+    xs = Thrift.listDatabasesResult_databases r
+    match = strip filterStr
+    dbs = if null match then xs else filter (repoFilter match) xs
+  return dbs
+
+displayDatabases:: Bool -> Bool -> String -> Eval ()
+displayDatabases all verbose filterStr = do
+  dbs <- getDatabases all filterStr
+  forM_ (sortOn Thrift.database_created_since_epoch dbs) $ \db ->
+    outputShellPrint $ db
+      `withFormatOpts` if verbose then DbDescribe else DbSummarise
+
+dbCmd :: String -> Eval ()
+dbCmd "" = do
+  r <- getRepo
+  case r of
+    Nothing -> output "no database selected"
+    Just repo -> displayDatabases False True (repoString repo)
+dbCmd str
+  | Just repo <- Glean.parseRepo str = setRepo repo
+  | otherwise = do
+      let repoName = Text.pack str
+      result <- C.try $ withBackend $ \be ->
+        liftIO $ Glean.getLatestRepo be repoName
+      case result of
+        Left e
+          | Just Glean.NoDatabase{} <- fromException e -> do
+            output $ pretty $ "no " <> repoName <> " database available"
+          | Just SomeAsyncException{} <- fromException e -> liftIO $ throwIO e
+          | otherwise -> do
+            output $ pretty $ "couldn't find database: " <>
+              Text.pack (show e)
+        Right repo -> do
+          output $ pretty $ "using database " ++ repoString repo
+          setRepo repo
+
+restoreDatabase :: String -> Eval ()
+restoreDatabase loc = withBackend $ \be ->
+  liftIO $ Glean.restoreDatabase be $ Text.pack loc
+
+deleteDatabase :: String -> Eval ()
+deleteDatabase db
+  | Just repo <- Glean.parseRepo db = withBackend $ \be ->
+    void $ liftIO $ Glean.deleteDatabase be repo
+  | otherwise
+  = liftIO $ throwIO $ ErrorCall "syntax:  :!delete <name>/<hash>"
+
+
+initialize :: Config -> Eval ()
+initialize cfg = mapM_ dbCmd (cfgDatabase cfg)
+
+hello :: Eval ()
+hello = output msg
+  where
+    msg
+      | "dev" `Text.isPrefixOf` BuildInfo.buildMode =
+        "Glean Shell (dev build)"
+      | otherwise =
+        "Glean Shell, built on " <> pretty BuildInfo.buildTimeISO8601 <>
+        ", from rev " <> pretty BuildInfo.buildRevision
+
+help :: Eval ()
+help = do
+  hello
+  output $ "" <> line <> helptext
+
+helptext :: Doc ann
+helptext = vcat
+  [ "Commands:"
+  , indent 2 $ vcat
+      [ fillBreak (command_width + 2) (":" <> pretty command)
+          <+> align (reflow text)
+        | (command,text) <- commands ]
+  , ""
+  , helpAngle ]
+  where
+    command_width = maximum $ map (Text.length . fst) commands
+
+    commands :: [(Text.Text,Text.Text)]
+    commands =
+      [ ("database [<db>]",
+            "Use database <db>")
+      , ("index <lang> <dir>",
+            "Index source files in <dir> and create a database.")
+      , ("list [<db>]",
+            "List available databases which match <db>")
+      , ("list-all [<db>]",
+            "List available databases and restorable backups which match "
+            <> "<db>")
+      , ("debug off|[-]ir|[-]bytecode|all",
+            "Enable/disable query debugging options")
+      , ("describe [<db>]",
+            "Like :list, but show more details")
+      , ("describe-all [<db>]",
+            "Like :list-all, but show more details")
+      , ("schema [predicate|type]",
+            "Show schema for the given predicate or type")
+      , ("edit",
+            "Edit a query in an external editor. "
+            <> "Set the EDITOR environment variable to choose an editor")
+      , ("limit <n>",
+            "Set limit on the number of query results")
+      , ("load [<file> | <db>/<hash> <file> ...]",
+            "Create a DB from file(s) of JSON facts")
+      , ("create [<db>/<hash>]",
+            "Create an empty DB")
+      , ("timeout off|<n>",
+            "Set the query time budget")
+      , ("expand off|on|<predicate>...",
+            "Recursively expand nested facts in the response")
+      , ("pager off|on",
+            "Enable/disable result paging")
+      , ("count <query>",
+            "Show only a count of query results, not the results themselves")
+      , ("more",
+            "Fetch more results from the previous query")
+      , ("profile [off|summary|full]",
+            "Show query profiling information")
+      , ("reload",
+            "Reload the schema (when using --schema)")
+      , ("statistics [--topmost] [-s] [<predicate>]",
+            "Show statistics for the database."
+            <> " Use --topmost to only show statisticsfor the top database"
+            <> " and -s to sort by decreasing size")
+      , ("use-schema [current|stored|<schema-id>]",
+            "Select which schema to use. Without an argument lists the"
+            <> " available schemas")
+      , ("quit",
+            "Exit the shell")
+      ]
+
+helpAngle :: Doc ann
+helpAngle = vcat
+  [ "Queries:"
+  , "  {1234}                    Look up a fact by its Id"
+  , "  <predicate> <pat>         Query a predicate for facts matching <pat>"
+  , ""
+  , "Pattern syntax:"
+  , "  1234                     :: byte or nat"
+  , "  \"abc\"                    :: string"
+  , "  \"abc\"..                  :: string prefix match"
+  , "  true|false               :: bool"
+  , "  [ val1, val2]            :: [T]"
+  , "  [ val1, val2, ..]        :: [T] prefix"
+  , "  { field = val, ... }     :: record(fields), omitted fields are wild"
+  , "  { field = val }          :: sum(fields)"
+  , ""
+  , "Please consult the documentation for the full query syntax."
+  , ""
+  , "Examples:"
+  , "  {1234}                                   fetch a fact by its Id"
+  , "  pp1.Define _                             all the pp1.Define facts"
+  , "  pp1.Define { macro = \"NULL\" }            every #define of NULL"
+  ]
+
+withTTY :: Eval a -> Eval (Maybe a)
+withTTY action = do
+  state <- getState
+  if not (isTTY state) then Just <$> action else do
+    let !preset_width = pageWidth state
+        !outh = outputHandle state
+    page_width <- case preset_width of
+      Just w -> return w
+      Nothing -> do
+        width <- fromMaybe 80 <$> liftIO getTerminalWidth
+        return $ AvailablePerLine width 1
+    let without_pager f = Just <$> f outh
+    r <- liftIO $ (if pager state then withPager else without_pager) $
+      \handle_var -> State.runStateT (unEval action) state
+        { pageWidth = Just page_width
+        , outputHandle = handle_var
+        }
+    forM_ r $ \(_, new_state) -> Eval $ State.put $ new_state
+      { pageWidth = preset_width
+      , outputHandle = outh
+      }
+    return $ fst <$> r
+
+evaluate :: String -> Eval Bool
+evaluate s =
+  case runParser parse () "<input>" s of
+    Left err -> do
+      output $ "*** Syntax error:" <+> pretty (show err)
+      return False
+    Right stmt -> doAngleStmt stmt
+
+doAngleStmt :: Statement AngleQuery -> Eval Bool
+doAngleStmt (Command name arg) = doCmd name arg
+doAngleStmt (FactRef fid) = userFact fid >> return False
+doAngleStmt (Pattern query) = do
+  q <- fromAngleQuery query
+  pager_on <- pager <$> getState
+  runUserQuery q { sqContinue = pager_on }
+  return False
+
+fromAngleQuery :: AngleQuery -> Eval SchemaQuery
+fromAngleQuery (AngleQuery deprecatedRec stored pat) = do
+  exp <- expandResults <$> getState
+  when deprecatedRec deprecatedExpansionWarning
+  return SchemaQuery
+    { sqPredicate = ""
+    , sqRecursive = exp
+    , sqStored = stored
+    , sqQuery = pat'
+    , sqCont = Nothing
+    , sqTransform = trans
+    , sqSyntax = Thrift.QuerySyntax_ANGLE
+    , sqOmitResults = False
+    , sqContinue = False }
+  where
+    -- magic transformation when we query for "xrefs". This is to make
+    -- debugging of xref issues easier by presenting xref data in an
+    -- easier-to-comprehend format.
+    (pat', trans)
+#if GLEAN_FACEBOOK
+      | Just rest <- stripPrefix "xrefs " pat
+      = ("cxx1.FileXRefs " <> rest, Just transformXRefs)
+#endif
+      | otherwise = (pat, Nothing)
+
+deprecatedExpansionWarning :: Eval ()
+deprecatedExpansionWarning = output $ vcat
+  [ "WARNING: Deprecated syntax. '!' at the start of a line to "
+    <> "recursively expand facts is deprecated."
+  , "Fact expansion is now enabled by default."
+  , "Use ':expand off' to disable it."
+  ]
+
+data Cmd = Cmd
+  { cmdName :: String
+  , cmdCompletion :: Haskeline.CompletionFunc Eval
+  , cmdImpl :: String -> IORef Bool -> Eval ()
+  }
+
+commands :: [Cmd]
+commands =
+  [ Cmd "quit" Haskeline.noCompletion $ const $
+      \stop -> liftIO $ writeIORef stop True
+  , Cmd "statistics" (completeWords availablePredicates) $
+      \str _ -> displayStatistics str
+  , Cmd "edit" Haskeline.noCompletion $ \_ _ -> editCmd
+  , Cmd "limit" Haskeline.noCompletion $ \str _ -> limitCmd str
+  , Cmd "describe" completeDatabaseName $ const . displayDatabases False True
+  , Cmd "describe-all" completeDatabaseName $ const . displayDatabases True True
+  , Cmd "index" indexCompletion $ \str _ -> indexCmd str
+  , Cmd "list" completeDatabaseName $ const . displayDatabases False False
+  , Cmd "list-all" completeDatabaseName $ const . displayDatabases True False
+  , Cmd "dump" Haskeline.noCompletion $ \str _ -> dumpCmd str
+  , Cmd "load" Haskeline.completeFilename $ \str _ -> loadCmd str
+  , Cmd "create" Haskeline.noCompletion $ \str _ -> createCmd str
+  , Cmd "more" Haskeline.noCompletion $ const $ const moreCmd
+  , Cmd "database" completeDatabases $ const . dbCmd
+  , Cmd "db" completeDatabaseName $ const . dbCmd
+  , Cmd "debug" (completeWords (pure
+      ["off", "ir", "-ir", "bytecode", "-bytecode", "all"])) $
+        \str _ -> debugCmd str
+  , Cmd "reload" Haskeline.noCompletion $ const $ const reloadCmd
+  , Cmd "schema" (completeWords availablePredicatesAndTypes) $
+      \str _ -> getSchemaCmd str
+  , Cmd "use-schema" completeUseSchema $ \str _ -> useSchema str
+  , Cmd "profile" (completeWords (pure ["off","summary","full"])) $
+      \str _ -> statsCmd str
+  , Cmd "timeout" Haskeline.noCompletion $ \str _ -> timeoutCmd str
+  , Cmd "expand" (completeWords (pure ["on", "off"])) $ \str _ -> expandCmd str
+  , Cmd "pager" (completeWords (pure ["on", "off"])) $ \str _ -> pagerCmd str
+  , Cmd "count" (completeWords availablePredicates) $ \str _ -> countCmd str
+  , Cmd "!restore" Haskeline.noCompletion $ const . restoreDatabase
+  , Cmd "!delete" completeDatabases $ const . deleteDatabase
+  , Cmd "!owner" Haskeline.noCompletion $ \str _ -> ownerCmd str
+  , Cmd "help" Haskeline.noCompletion $ \_ _ -> help
+  , Cmd "?" Haskeline.noCompletion $ \_ _ -> help
+  ]
+
+doCmd :: String -> String -> Eval Bool
+doCmd name arg0 = do
+  stop <- liftIO $ newIORef False
+  let arg = strip arg0
+  case filter ((== name) . cmdName) commands of
+    [Cmd{..}] -> cmdImpl arg stop
+    _otherwise -> case filter (isPrefixOf name . cmdName) commands of
+      [Cmd{..}]
+        | "!" `isPrefixOf` cmdName -> output
+            "*** This is an unsafe command, it can't be abbreviated"
+        | otherwise -> cmdImpl arg stop
+      [] -> output "*** Unknown command. Type :help for help."
+      _ -> output "*** Ambiguous command. Type :help for help."
+  liftIO $ readIORef stop
+
+ownerCmd :: String -> Eval ()
+ownerCmd str
+  | Right fid <- textToInt (Text.pack str) = do
+    withBackend $ \backend ->
+      case backendKind backend of
+        BackendEnv env -> withRepo $ \repo -> do
+          maybeExpr <- liftIO $ factOwnership env repo (Fid (fromIntegral fid))
+          case maybeExpr of
+            Nothing -> output "*** no ownership information"
+            Just expr -> output (prettyOwner expr)
+        _other -> liftIO $ throwIO $ ErrorCall
+          "!owner only works with --db-root"
+  | otherwise = liftIO $ throwIO $ ErrorCall "syntax:  :!owner <fact>"
+  where
+  prettyOwner (Unit x) = pretty (Text.decodeUtf8 x)
+  prettyOwner (OrOwners [one]) = prettyOwner one
+  prettyOwner (OrOwners many) = sep $ intersperse "||" (map prettyOwner1 many)
+  prettyOwner (AndOwners [one]) = prettyOwner one
+  prettyOwner (AndOwners many) = sep $ intersperse "&&" (map prettyOwner1 many)
+
+  prettyOwner1 (Unit x) = prettyOwner (Unit x)
+  prettyOwner1 (OrOwners [one]) = prettyOwner1 one
+  prettyOwner1 (AndOwners [one]) = prettyOwner1 one
+  prettyOwner1 owner = parens (prettyOwner owner)
+
+moreCmd :: Eval ()
+moreCmd = do
+  last_query <- lastSchemaQuery <$> getState
+  case last_query of
+    Just q -> runUserQuery q
+    Nothing -> liftIO $ throwIO $ ErrorCall "no last query"
+
+reloadCmd :: Eval ()
+reloadCmd = do
+  state <- getState
+  case updateSchema state of
+    Nothing -> output ":reload requires the shell to be started with --schema"
+    Just io ->
+      io `C.catch` \(ErrorCall err) ->
+        output (pretty err)
+  case repo state of
+    Nothing -> return ()
+    Just repo -> do
+      Thrift.GetDatabaseResult{..} <- withBackend $ \be ->
+        liftIO $ Glean.getDatabase be repo
+      case Thrift.database_status getDatabaseResult_database of
+        Thrift.DatabaseStatus_Complete -> return ()
+        _otherwise -> output $ vcat
+          [ "WARNING: the current database is writable, so its schema will not"
+          , "be updated. To use the new schema, complete the current database"
+          , "and restart the shell, or create a new database and load it." ]
+
+loadCmd :: String -> Eval ()
+loadCmd str
+  | (db : files@(_ : _)) <- args
+  , Just repo <- Glean.parseRepo db
+  = do load repo files; setRepo repo
+
+  -- Just a file: derive the repo from the filename and pick an unused hash
+  | [file] <- args = do
+    let name = Text.pack (takeBaseName file)
+    hash <- pickHash name
+    let repo = Thrift.Repo name hash
+    load repo [file]
+    setRepo repo
+
+  -- no files: behave like :new
+  | [] <- args = createCmd str
+
+  | otherwise
+  = liftIO $ throwIO $ ErrorCall
+      "syntax:  :load (<file> | <db>/<hash> <file> ...)"
+  where
+    args = Data.List.words str
+
+createCmd :: String -> Eval ()
+createCmd str
+  | [db] <- args
+  , Just repo <- Glean.parseRepo db = do
+    create repo
+    setRepo repo
+
+  | [] <- args = do
+    let name = "tmp"
+    hash <- pickHash name
+    let repo = Thrift.Repo name hash
+    create repo
+    setRepo repo
+
+  | otherwise =
+     liftIO $ throwIO $ ErrorCall "syntax:  :create [<db>/<hash>]"
+  where
+    args = Data.List.words str
+
+dumpCmd :: String -> Eval ()
+dumpCmd str =
+  withBackend $ \backend ->
+  withRepo $ \repo ->
+  liftIO $ Glean.dumpJsonToFile backend repo str
+
+editCmd :: Eval ()
+editCmd = do
+  file <- query_file <$> getState
+  meditor <- liftIO getEditor
+  case meditor of
+    Nothing -> liftIO $ do
+      putStrLn "EDITOR not set."
+      putStrLn "Set the EDITOR environment variable choose an editor."
+    Just editor -> do
+      query <- liftIO $ do
+        callCommand $ unwords [editor, file]
+        readFile file
+      void $ evaluate query
+
+getEditor :: IO (Maybe String)
+getEditor = asum <$> sequence
+  [ lookupEnv "EDITOR"
+  , lookupEnv "VISUAL"
+  ]
+
+limitCmd :: String -> Eval ()
+limitCmd "" = do
+  l <- limit <$> getState
+  output $ "current limit: " <> pretty l
+limitCmd str
+  | Right n <- textToInt (Text.pack str) =
+    Eval $ State.modify $ \s -> s { limit = fromIntegral n }
+  | otherwise = liftIO $ throwIO $ ErrorCall "syntax: :limit <number>"
+
+timeoutCmd :: String -> Eval ()
+timeoutCmd "" = do
+  t <- timeout <$> getState
+  output $ "current query time limit:" <+>
+    maybe "not set" (\ms -> pretty ms <> "ms") t
+timeoutCmd "off" =
+  Eval $ State.modify $ \s -> s { timeout = Nothing }
+timeoutCmd str
+  | Right n <- textToInt (Text.pack str) =
+    Eval $ State.modify $ \s -> s { timeout = Just (fromIntegral n) }
+  | otherwise = liftIO $ throwIO $ ErrorCall "syntax: :timeout off|<number>"
+
+countCmd :: String -> Eval ()
+countCmd str = do
+  case runParser parse () "<input>" str of
+    Left err -> do
+      output $ "*** Syntax error:" <+> pretty (show err)
+      return ()
+    Right query -> do
+      q <- fromAngleQuery query
+      runUserQuery q { sqOmitResults = True, sqContinue = True }
+
+statsCmd :: String -> Eval ()
+statsCmd "" = do
+  s <- stats <$> getState
+  output $ "current profile setting: " <>
+    case s of
+      NoStats -> "off"
+      SummaryStats -> "summary"
+      FullStats -> "full"
+statsCmd str = do
+  new <-  case str of
+    "off" -> return NoStats
+    "summary" -> return SummaryStats
+    "full" -> return FullStats
+    _ -> liftIO $ throwIO $ ErrorCall "syntax: :stats off|summary|full"
+  Eval $ State.modify $ \s -> s { stats = new }
+
+
+debugCmd :: String -> Eval ()
+debugCmd str = case words (strip str) of
+  [] -> do
+    d <- debug <$> getState
+    output $ "query debugging is currently: " <>
+      let opts =
+            [ "ir" | Thrift.queryDebugOptions_ir d ] ++
+            [ "bytecode" | Thrift.queryDebugOptions_bytecode d ]
+      in
+      if null opts then "off" else hcat (punctuate "," opts)
+  ["all"] -> do
+    Eval $ State.modify $ \s -> s
+      { debug = Thrift.QueryDebugOptions
+        { queryDebugOptions_ir = True
+        , queryDebugOptions_bytecode = True
+        , queryDebugOptions_pred_has_facts = False
+        }
+      }
+  [word] | Just onoff <- irFlag word -> Eval $ State.modify $ \s -> s
+    { debug = (debug s) { Thrift.queryDebugOptions_ir = onoff } }
+  [word] | Just onoff <- bytecodeFlag word -> Eval $ State.modify $ \s -> s
+    { debug = (debug s) { Thrift.queryDebugOptions_bytecode = onoff } }
+  ["off"] -> Eval $ State.modify $ \s -> s { debug = def }
+  _ -> liftIO $ throwIO $ ErrorCall "syntax: :debug off|[-]ir|[-]bytecode|all"
+  where
+  irFlag "ir" = Just True
+  irFlag "-ir" = Just False
+  irFlag _ = Nothing
+
+  bytecodeFlag "bytecode" = Just True
+  bytecodeFlag "-bytecode" = Just False
+  bytecodeFlag _ = Nothing
+
+
+expandCmd :: String -> Eval ()
+expandCmd str = case str of
+  "" -> do
+    expand <- expandResults <$> getState
+    output $ case expand of
+      ExpandRecursive -> "result expansion is on"
+      ExpandPredicates ps -> "expanding " <> hsep (map (pretty . showRef) ps)
+  "off" -> Eval $ State.modify $ \s -> s { expandResults = ExpandPredicates [] }
+  "on" -> Eval $ State.modify $ \s -> s { expandResults = ExpandRecursive }
+  other -> Eval $ State.modify $ \s -> s { expandResults = ExpandPredicates $
+    map (parseRef . Text.pack) (words other) }
+
+pagerCmd :: String -> Eval ()
+pagerCmd str = case str of
+  "" -> do
+    pagerOn <- pager <$> getState
+    output $ "result paging is " <> if pagerOn then "on" else "off"
+  "off" -> Eval $ State.modify $ \s -> s { pager = False }
+  "on" -> Eval $ State.modify $ \s -> s { pager = True }
+  _ -> liftIO $ throwIO $ ErrorCall "syntax: :pager [off|on]"
+
+getExpandResults :: Eval (Bool, [Thrift.SourcePredicate])
+getExpandResults =  expandResultsOpts . expandResults <$> getState
+
+expandResultsOpts :: ExpandResults -> (Bool, [Thrift.SourcePredicate])
+expandResultsOpts exp = case exp of
+  ExpandRecursive -> (True, [])
+  ExpandPredicates refs -> (False, ps)
+    where
+    ps = [ Thrift.SourcePredicate name ver | SourceRef name ver <- refs ]
+
+userFact :: Glean.Fid -> Eval ()
+userFact fid = do
+  (rec, expandPreds) <- getExpandResults
+  Thrift.UserQueryResults{..} <- withRepo $ \repo -> withBackend $ \be ->
+    liftIO $ Glean.userQueryFacts be repo $
+      def { Thrift.userQueryFacts_facts =
+              [def { Thrift.factQuery_id = fromFid fid }]
+          , Thrift.userQueryFacts_options = Just def
+            { Thrift.userQueryOptions_no_base64_binary = True
+            , Thrift.userQueryOptions_expand_results = True
+            , Thrift.userQueryOptions_recursive = rec
+            , Thrift.userQueryOptions_expand_predicates = expandPreds }
+          }
+  Thrift.Fact{..} <- withRepo $ \repo -> withBackend $ \be -> do
+    r <- liftIO $ Glean.queryFact be repo (fromFid fid)
+    case r of
+      Nothing -> liftIO $ throwIO $ ErrorCall "cannot fetch fact"
+      Just f -> return f
+  pref <- lookupPid (Pid fact_type) >>= \case
+    Nothing -> liftIO $ throwIO $ ErrorCall "unknown predicate type"
+    Just p -> return p
+  case userQueryResults_stats of
+    Nothing -> return ()
+    Just Thrift.UserQueryStats{..} -> output $ pretty
+      ( printf "%d facts, %.2fms, %ld bytes"
+          userQueryStats_num_facts
+          (realToFrac userQueryStats_elapsed_ns / 1000000 :: Double)
+          userQueryStats_allocated_bytes
+        :: String )
+  case JSON.decode (UTF8.toString (head userQueryResults_facts)) of
+    JSON.Error err -> output $ pretty err
+    JSON.Ok (value :: JSON.JSValue) ->
+      output $ pretty pref <> line <> pretty value
+
+asBadQuery :: String -> Thrift.BadQuery -> BadQuery
+asBadQuery query (Thrift.BadQuery err) = BadQuery (Text.pack query) err
+
+-- | Run a query, calling an accumulator function with each page of
+-- results.  The accumulator function returns a Bool to indicate
+-- whether to continue querying the next page or not.
+withQueryPages
+  :: forall s .
+     Thrift.UserQuery
+  -> s
+  -> (s -> Thrift.UserQueryResults -> Eval (s, Bool))
+  -> Eval s
+withQueryPages query s f = do
+  (s', results, continue) <- withRepo $ \repo -> withBackend $ \be -> do
+    results <- liftIO $ Glean.userQuery be repo query
+    (s', continue) <- f s results
+    return (s', results, continue)
+  case Thrift.userQueryResults_continuation results of
+    Just cont | continue ->
+      withQueryPages query {
+        Thrift.userQuery_options =
+          Just (fromMaybe def (Thrift.userQuery_options query)) {
+            Thrift.userQueryOptions_continuation = Just cont }} s' f
+    _otherwise -> return s'
+
+mkUserQuery :: SchemaQuery -> Eval Thrift.UserQuery
+mkUserQuery
+  SchemaQuery
+    { sqPredicate = str
+    , sqRecursive = exp
+    , sqStored = stored
+    , sqQuery = rest
+    , sqCont = cont
+    , sqSyntax = syntax
+    , sqOmitResults = omitResults } = do
+  let SourceRef pred maybeVer = parseRef (Text.pack str)
+      (recursive, expandPreds) = expandResultsOpts exp
+  schema_id <- getSchemaId
+  ShellState{..} <- getState
+  return def {
+      Thrift.userQuery_predicate = pred
+    , Thrift.userQuery_predicate_version = maybeVer
+    , Thrift.userQuery_query = UTF8.fromString rest
+    , Thrift.userQuery_options = Just def
+        { Thrift.userQueryOptions_no_base64_binary = True
+        , Thrift.userQueryOptions_expand_results = True
+        , Thrift.userQueryOptions_recursive = recursive
+        , Thrift.userQueryOptions_max_results = Just limit
+        , Thrift.userQueryOptions_max_time_ms = timeout
+        , Thrift.userQueryOptions_continuation = cont
+        , Thrift.userQueryOptions_syntax = syntax
+        , Thrift.userQueryOptions_store_derived_facts = stored
+        , Thrift.userQueryOptions_collect_facts_searched =
+            stats == FullStats
+        , Thrift.userQueryOptions_debug = debug
+        , Thrift.userQueryOptions_omit_results = omitResults
+        , Thrift.userQueryOptions_expand_predicates = expandPreds
+        }
+     -- When running locally with --enable-logging, logs are emitted
+     -- before the ThriftBackend has a chance to incude client_info in the
+     -- request.  This makes sure client_info will appear in the logs
+    , Thrift.userQuery_client_info = Just client_info
+    , Thrift.userQuery_schema_id = schema_id
+    }
+
+runUserQuery :: SchemaQuery -> Eval ()
+runUserQuery sQuery = do
+  state@ShellState{..} <- getState
+  query <- mkUserQuery sQuery
+
+  C.handle (C.throwM . asBadQuery (sqQuery sQuery)) $ do
+
+  (finalStats, finalResults) <-
+    withQueryPages query (Nothing,def) $
+    \(prevStats,_) results@Thrift.UserQueryResults{..} -> do
+
+    when (not (null userQueryResults_diagnostics)) $ output $ vcat $
+      [ "*** " <> pretty diag | diag <- userQueryResults_diagnostics ]
+      ++
+      [ "" ]
+
+    when (not (null userQueryResults_facts)) $ output $ vcat $
+      [ case JSON.decode (UTF8.toString fact) of
+            JSON.Error err -> pretty err
+            JSON.Ok (value :: JSON.JSValue) -> case sqTransform sQuery of
+              Nothing -> pretty value
+              Just t -> case t value of
+                JSON.Error err -> pretty err
+                JSON.Ok transformed -> pretty transformed
+        | fact <- userQueryResults_facts
+      ]
+
+    let
+      stats
+        | Just s <- userQueryResults_stats = s
+        | otherwise = def { Thrift.userQueryStats_result_count =
+            fromIntegral (length userQueryResults_facts) }
+
+      timeout = Thrift.userQueryStats_result_count stats < fromIntegral limit
+
+    return
+      ((prevStats <> Just stats, results), sqContinue sQuery && not timeout)
+
+  statsSummary state finalStats finalResults
+  Eval $ State.modify $ \s -> s {
+    lastSchemaQuery = Just sQuery {
+      sqCont = Thrift.userQueryResults_continuation finalResults }}
+
+  where
+  statsSummary ShellState{..} finalStats finalResults = output $ vcat $
+     [ "" ]
+     ++
+     [ case finalStats of
+         Nothing -> mempty
+         Just Thrift.UserQueryStats{..} ->
+           pretty
+             ( printf "%d results, %d facts, %.2fms, %ld bytes"
+               userQueryStats_result_count
+               userQueryStats_num_facts
+               (realToFrac userQueryStats_elapsed_ns / 1000000 :: Double)
+               userQueryStats_allocated_bytes
+             :: String ) <>
+           maybe mempty (\n -> "," <+> pretty n <+> "compiled bytes")
+             userQueryStats_bytecode_size
+     | stats == SummaryStats || stats == FullStats
+     ]
+     ++
+     [ vcat $ "Facts searched:" :
+         [ pretty (printf "%40s : %d%s" (show (pretty ref)) count
+             (if ref `elem` scans then " (full scan)" else "" :: String)
+               :: String)
+         | (pid, count) <- sortOn (Down . snd) $ Map.toList m
+         , Just info <- [schemaInfo]
+         , Just ref <- [Map.lookup pid (Thrift.schemaInfo_predicateIds info)] ]
+     | stats == FullStats
+     , Just stats <- [finalStats]
+     , Just m <- [Thrift.userQueryStats_facts_searched stats]
+     , let scans = Thrift.userQueryStats_full_scans stats
+     ]
+     ++
+     [ vcat $ if Thrift.userQueryStats_result_count stats < fromIntegral limit
+         then
+             [ case timeout of
+                 Nothing -> "timeout (server-side time limit)"
+                 Just ms ->
+                   "timeout (currently " <> pretty ms <> "ms), " <>
+                   "use :timeout <ms> to change it"
+            , "Use :more to continue the query." ]
+         else
+           [ "results truncated (current limit " <> pretty limit <> ", " <>
+             "use :limit <n> to change it)"
+           , "Use :more to see more results"
+           ]
+     | isJust (Thrift.userQueryResults_continuation finalResults)
+     , Just stats <- [finalStats]
+     ]
+
+-- | A line from the user (or entry on the command line) may end in a backslash
+-- and be a 'Cont' continued line, otherwise it is a 'Whole' line, see 'endBS'
+data OneLine = Whole String | Cont String
+
+-- | The REPL input may be complete line , or a message to 'Stop'
+data GotLines = Stop | Go String
+
+-- | The 'whole' is a list of command that do not end in a backslash (such
+-- lines have been combined with spaces).  The 'cont' should be an empty
+-- list, but if there are trailing lines with backslashes then they are
+-- collected into 'cont' for clear error reporting.
+data ManyLines = ManyLines { whole :: [String], cont :: [String]}
+
+-- | Check if line should continue onto the next line
+-- Detect (odd number of) ending backslashes (REPL and command line).
+-- If found then remove last backslash and return 'Cont' otherwise
+-- if the line ends in ';' or '|' return 'Cont' otherwise
+-- return input unchanged as 'Whole'
+shouldCont :: String -> OneLine
+shouldCont s =
+  if cont then Cont s' else Whole s
+  where
+    bs = odd . length . takeWhile ('\\' ==) $ revS
+    revS = reverse s
+    cont = bs || semi || vert
+    semi = ";" `isPrefixOf` revS
+    vert = "|" `isPrefixOf` revS
+    s' = if bs then init s else s
+
+-- | Parse sequence of lines (from command line) for ending backslashes.
+-- This converts zero or more partial Cont lines that end in a Whole line into
+-- one element in the 'whole' list in 'ManyLines'.  If there are trailing
+-- 'Cont' lines that do not end in a 'Whole' line then return these (as a
+-- syntax error) as the 'cont' list of 'ManyLines'
+manyWhole :: [String] -> ManyLines
+manyWhole = foldl' go (ManyLines [] []) where
+  go ml x = case shouldCont x of
+    Whole s -> let fullLine = unwords (cont ml ++ [s]) -- pending cont plus s
+                   newWhole = whole ml ++ [fullLine] -- append complete line
+               in ml{whole = newWhole, cont = []} -- no pending cont lines now
+    Cont c -> ml{cont = cont ml ++ [c]} -- collect a pending cont line
+
+-- | Any line ending in an odd number of backslashes means we will
+-- continue accepting input on the next line.  Returned string will
+-- have multiple input lines separated by spaces, not newlines.
+getInputLines :: Repl GotLines
+getInputLines = Repl $ getLines prompt1 []
+  where
+    promptWith suffix = do
+      r <- lift getState
+      return $ maybe "" (Text.unpack . Thrift.repo_name) (repo r) ++ suffix
+
+    prompt1 = promptWith "> "
+    prompt2 = promptWith "| "
+
+    getLines prompt prior = do
+      maybeLine <-
+        HEx.handle (\(e::IOError) -> do
+          liftIO $ hPrint stderr e
+          return Nothing) $
+          Haskeline.getInputLine =<< prompt
+      case maybeLine of
+        Nothing -> return Stop  -- stop on IOError, ^D or EOF
+        Just sIn -> case shouldCont sIn of
+          Whole s -> return (Go (intercalate "\n" (reverse (s:prior))))
+          Cont c -> getLines prompt2 (c:prior)
+
+repl :: Repl ()
+repl = replMask $ \restore ->
+  let
+    loop = do
+      eitherStop <- replTry $ restore $ do
+        gotLines <- getInputLines
+        case gotLines of
+          Stop -> return True  -- stop on ^D or EOF
+          Go s
+            | all isSpace s -> return False -- ignore blank input
+            | otherwise -> fmap (fromMaybe False) $
+                Repl $ lift $ withTTY $ evaluate s
+      stop <- case eitherStop of
+        Right stop -> return stop
+        Left e
+          | Just UserInterrupt{} <- fromException e -> do
+            liftIO $ putStrLn "Interrupted"
+            return False
+          | Just SomeAsyncException{} <- fromException e -> liftIO $ throwIO e
+          | Just (err :: BadQuery) <- fromException e -> do
+            Repl $ lift $ output $ prettyBadQuery err
+            return False
+          | otherwise -> do
+            liftIO $ putStrLn $ "*** Exception: " <> show e
+            return False
+      when (not stop) loop
+  in
+  loop
+
+#if MIN_VERSION_haskeline(0,8,0)
+
+replTry :: Exception e => Repl a -> Repl (Either e a)
+replTry = C.try
+
+replMask :: ((Repl a -> Repl a) -> Repl b) -> Repl b
+replMask = C.mask
+
+#else
+
+replTry :: Exception e => Repl a -> Repl (Either e a)
+replTry r = Haskeline.controlIO $ \(Haskeline.RunIO run) -> do
+  result <- try (run r)
+  case result of
+    Left e -> return (return (Left e))
+    Right r -> return (Right <$> r)
+
+replMask :: ((Repl a -> Repl a) -> Repl b) -> Repl b
+replMask f = Haskeline.controlIO $ \(Haskeline.RunIO run) -> do
+  mask $ \restore ->
+    run (f (\repl -> Haskeline.controlIO $ \(Haskeline.RunIO run') ->
+                restore (run' repl)))
+#endif
+
+-- | Temporarily install standard signal handlers for catching ^C, which just
+-- throw an exception in the current thread.
+withSignalHandlers :: Repl a -> Repl a
+withSignalHandlers act = do
+  main_thread <- liftIO myThreadId
+  wtid <- liftIO (mkWeakThreadId main_thread)
+
+  let
+    interrupt = do
+      r <- deRefWeak wtid
+      case r of
+        Nothing -> return ()
+        Just t  -> do
+          interruptRunningQueries
+          throwTo t UserInterrupt
+
+    installHandlers = liftIO $ do
+      let installHandler' a b = installHandler a b Nothing
+      hdlQUIT <- installHandler' sigQUIT  (Catch interrupt)
+      hdlINT  <- installHandler' sigINT   (Catch interrupt)
+      return (hdlQUIT,hdlINT)
+
+    uninstallHandlers (hdlQUIT,hdlINT) = liftIO $ do
+      _ <- installHandler sigQUIT  hdlQUIT Nothing
+      _ <- installHandler sigINT   hdlINT  Nothing
+      return ()
+
+  HEx.bracket installHandlers uninstallHandlers (const act)
+
+completeDatabases :: Haskeline.CompletionFunc Eval
+completeDatabases =
+  completeWords $ do
+    dbs <- getDatabases False ""
+    return (map (repoString . Thrift.database_repo) dbs)
+
+completeDatabaseName :: Haskeline.CompletionFunc Eval
+completeDatabaseName =
+  completeWords $ do
+    dbs <- getDatabases False ""
+    return $
+      uniq (map (Text.unpack . Thrift.repo_name . Thrift.database_repo) dbs) ++
+      map (repoString . Thrift.database_repo) dbs
+
+completeWords :: Eval [String] -> Haskeline.CompletionFunc Eval
+completeWords words =
+  Haskeline.completeWord Nothing " \t" $ \str ->
+    fromVocabulary str <$> words
+
+completeUseSchema :: Haskeline.CompletionFunc Eval
+completeUseSchema =
+  completeWords ((["current", "stored"] <>) <$> availableSchemaIds)
+
+fromVocabulary :: String -> [String] -> [Haskeline.Completion]
+fromVocabulary str words =
+  map Haskeline.simpleCompletion $ filter (str `isPrefixOf`) words
+
+availableSchemaIds :: Eval [String]
+availableSchemaIds = do
+  m <- schemaInfo <$> getState
+  case m of
+    Nothing -> return []
+    Just Thrift.SchemaInfo{..} ->
+      return $ map Text.unpack $ uniq $
+        Map.keys schemaInfo_schemaIds <>
+        Map.keys schemaInfo_dbSchemaIds <>
+        concatMap Map.keys schemaInfo_otherSchemaIds
+
+getSchemaId :: Eval (Maybe Thrift.SchemaId)
+getSchemaId = do
+  ShellState{..} <- getState
+  return $ do
+    ProcessedSchema{..} <- schemas
+    case useSchemaId of
+      Thrift.SelectSchema_schema_id id -> Just id
+      _ -> Just $ hashedSchemaId procSchemaHashed
+
+getNameEnv :: Eval (Maybe (NameEnv RefTargetId))
+getNameEnv = do
+  ShellState{..} <- getState
+  case schemas of
+    Nothing -> return Nothing
+    Just ProcessedSchema{..} ->
+      return $ Just $ hashedSchemaEnv procSchemaHashed
+
+availablePredicates :: Eval [String]
+availablePredicates = maybe [] preds <$> getNameEnv
+  where
+    isPred RefPred{} = True
+    isPred _ = False
+
+    preds env =
+        [ Text.unpack (showRef ref)
+        | (ref, set) <- HashMap.toList env
+        , any isPred (Set.toList set) ]
+
+indexCompletion :: Haskeline.CompletionFunc Eval
+indexCompletion line@(left,_) =
+  case splitWhen isSpace (reverse left) of
+    [_cmd, _lang] -> ($ line) $ Haskeline.completeWord Nothing " \t" $ \str ->
+      let words = [ indexerShortName ix | SomeIndexer ix <- indexers ] in
+      return (fromVocabulary str words)
+    (_cmd : _lang : rest)
+      | not (null rest) -> Haskeline.completeFilename line
+    _otherwise -> Haskeline.noCompletion line
+
+availablePredicatesAndTypes :: Eval [String]
+availablePredicatesAndTypes = do
+  env <- getNameEnv
+  let names env = [ Text.unpack (showRef ref) | ref <- HashMap.keys env ]
+  return $ maybe [] names env
+
+commandSpecificCompletion :: String -> Haskeline.CompletionFunc Eval
+commandSpecificCompletion cmd =
+  case [ cmdCompletion | Cmd{..} <- commands, cmd `isPrefixOf` cmdName ] of
+    (comp:_) -> comp
+    _ -> Haskeline.noCompletion
+
+completeFirstWord :: Haskeline.CompletionFunc Eval
+completeFirstWord = completeWords $ (++) <$> availablePredicates <*> pure cmds
+  where cmds = map ((":"++) . cmdName) commands
+
+-- Based on GHCi's completion
+completion :: Haskeline.CompletionFunc Eval
+completion line@(left,_) =
+  case firstWord of
+    -- if the first word is a command, choose completion based on it:
+    ':':cmd | not (null rest) -> commandSpecificCompletion cmd line
+    -- otherwise, we only know how to complete the first word (for now):
+    _ | not (null rest) -> Haskeline.noCompletion line
+    _otherwise -> completeFirstWord line
+  where
+  (firstWord,rest) = break isSpace $ dropWhile isSpace $ reverse left
+
+reportService :: LocalOrRemote backend => backend -> Eval ()
+reportService backend = case backendKind backend of
+  BackendEnv Env{..} -> do
+    output $  "Using local DBs from " <> pretty (describe envStorage)
+  BackendThrift thrift -> do
+    case Glean.clientConfig_serv (thriftBackendClientConfig thrift) of
+      Tier tier -> output $ "Using service " <> pretty tier
+      HostPort host port ->
+        output $ "Using service at " <> pretty host <> ":" <> pretty port
+      _ -> error "shouldn't happen"
+
+evalMain :: Config -> Maybe String -> Eval ()
+evalMain cfg maybeErr = do
+  case cfgQuery cfg of
+    [] -> do
+      hello
+      reportService . backend =<< getState
+      output "type :help for help."
+      initialize cfg
+      case maybeErr of
+        Nothing -> return ()
+        Just err -> do
+          output $ vcat [
+            "schema failed to load:", "",
+            pretty err,
+            "", "use :reload to try again"
+            ]
+      home <- liftIO $ lookupEnv "HOME"
+
+      let settings = Haskeline.setComplete completion Haskeline.defaultSettings
+              { Haskeline.historyFile = fmap (</> ".glean.shell.history") home }
+      Haskeline.runInputT settings $ unRepl $ withSignalHandlers repl
+    qs@(_:_) -> do
+      let ManyLines{whole, cont} = manyWhole qs
+      if not (null cont) then liftIO $ do
+        putStrLn "Error: Final command(s) end in continuation backslash: "
+        when (not (null whole)) $ putStrLn "whole lines:" >> mapM_ print whole
+        putStrLn "incomplete cont line(s):" >> mapM_ print cont
+      else do
+        initialize cfg
+        forM_ whole $ \ q -> do
+          liftIO $ putStr "> " >> putStrLn q;
+          void (evaluate q) `C.catch` \e -> do
+            output $ prettyBadQuery e
+            liftIO exitFailure
+
+parseAndTypecheckSchema :: Maybe Env -> FilePath -> IO SchemaIndex
+parseAndTypecheckSchema env dir = do
+  parsed <- parseSchemaDir dir
+  -- typecheck the schema now, so that we find out about
+  -- errors before we try updating the schema for DBs.
+  void $ liftIO $ newDbSchema (fmap envDbSchemaCache env) parsed
+    LatestSchema readWriteContent (maybe def envDebug env)
+  return parsed
+
+setupLocalSchema
+  :: ConfigProvider cfg
+  => cfg
+  -> Glean.Service
+  -> IO (Glean.Service, Maybe (Eval ()), Maybe String)
+setupLocalSchema cfgAPI service = do
+  case service of
+    Remote{} -> return (service, Nothing, Nothing)
+    Local dbConfig logging -> do
+      server_config <- ThriftSource.load cfgAPI (DB.cfgServerConfig dbConfig)
+      loc <- schemaLocation dbConfig server_config
+      case loc of
+        SchemaLocation_dir dir -> do
+          r <- try $ parseAndTypecheckSchema Nothing (Text.unpack dir)
+          (schema, maybeErr) <- case r of
+            Right schema -> return (schema, Nothing)
+            Left (ErrorCall err) -> do
+              let proc = ProcessedSchema
+                    (SourceSchemas (AngleVersion 0) [] [])
+                    (ResolvedSchemas Nothing [])
+                    emptyHashedSchema
+              return (SchemaIndex proc [], Just err)
+          (schemaTS, update) <- ThriftSource.mutable schema
+          let
+            updateSchema :: Eval ()
+            updateSchema = do
+              be <- backend <$> getState
+              case backendKind be of
+                BackendThrift{} -> return ()
+                BackendEnv env -> do
+                  new <- liftIO $
+                    parseAndTypecheckSchema (Just env) (Text.unpack dir)
+                  liftIO $ update (const new)
+                  let current = schemaIndexCurrent new
+
+                  -- Update all the schemas for open DBs. This would
+                  -- normally be done in the background by the schema
+                  -- updater thread, but we're doing it manually and
+                  -- disabling the auto-update so that we can
+                  -- synchronously check for errors and update our local
+                  -- view of the schema in the monad.
+                  liftIO $ schemaUpdated env Nothing
+                  state <- getState
+                  whenJust (repo state) $ \r -> do
+                    info <- liftIO $
+                      Glean.getSchemaInfo env (Just r)
+                        def { Thrift.getSchemaInfo_select = useSchemaId state }
+
+                    Eval $ State.modify $ \s ->
+                      s { schemaInfo = Just info, schemas = Just current }
+
+                  let
+                    numSchemas = length (srcSchemas (procSchemaSource current))
+                    numPredicates = HashMap.size (hashedPreds
+                      (procSchemaHashed current))
+                  output $ "reloading schema [" <>
+                    pretty numSchemas <> " schemas, " <>
+                    pretty numPredicates <> " predicates]"
+          return
+            ( Local dbConfig {
+                DB.cfgSchemaHook = const (schemaTS, False) } logging
+            , Just updateSchema
+            , maybeErr
+            )
+
+        _other -> return (service, Nothing, Nothing)
+
+type ShellCommand = Config
+
+instance Plugin ShellCommand where
+  parseCommand = options
+
+  argTransform _ args
+    | "-v" `elem` args = args
+    | otherwise = "--minloglevel=2" : args
+
+  withService evb cfgAPI service cfg = do
+    (service', updateSchema, maybeErr) <- setupLocalSchema cfgAPI service
+    Glean.withBackendWithDefaultOptions evb cfgAPI
+      service' Nothing $ \backend -> do
+    withSystemTempFile "scratch-query.angle" $ \q handle -> do
+      hClose handle
+      client_info <- clientInfo
+      tty <- hIsTerminalDevice stdout
+      outh <- newMVar stdout
+      let state = ShellState
+            { backend = Some backend
+            , repo = Nothing
+            , schemas = Nothing
+            , schemaInfo = def
+            , useSchemaId = Thrift.SelectSchema_current def
+            , limit = cfgLimit cfg
+            , timeout = Just 10000      -- Sensible default for fresh shell.
+            , stats = SummaryStats
+            , lastSchemaQuery = Nothing
+            , updateSchema = updateSchema
+            , isTTY = tty
+            , pageWidth =
+                (\n -> if n == 0 then Unbounded else AvailablePerLine n 1)
+                <$> cfgWidth cfg
+            , expandResults = ExpandRecursive
+            , outputHandle = outh
+            , pager = cfgPager cfg
+            , debug = def
+            , client_info = client_info
+            , query_file = q
+            }
+      flip State.evalStateT state $ unEval $
+        evalMain cfg maybeErr
diff --git a/glean/shell/Glean/Shell/Error.hs b/glean/shell/Glean/Shell/Error.hs
new file mode 100644
--- /dev/null
+++ b/glean/shell/Glean/Shell/Error.hs
@@ -0,0 +1,145 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Format Angle errors to dispay in the terminal
+module Glean.Shell.Error
+  ( Ann
+  , BadQuery(..)
+  , prettyBadQuery
+  ) where
+
+import Control.Exception
+import Control.Applicative ((<|>))
+import Text.Read (readMaybe)
+import Data.Maybe (isJust)
+import Data.Text (Text)
+import Compat.Prettyprinter as Pretty hiding ((<>), pageWidth)
+
+import qualified Data.Text as Text
+import qualified Prettyprinter.Render.Terminal as Pretty
+import qualified Text.Parsec as Parsec
+
+import Glean.Angle.Types
+
+type Ann = Pretty.AnsiStyle
+
+data BadQuery = BadQuery { angleSource :: Text, angleError :: Text }
+  deriving Show
+
+instance Exception BadQuery
+
+prettyBadQuery :: BadQuery -> Doc Ann
+prettyBadQuery (BadQuery source rawErr) =
+    case parseSrcSpan rawErr of
+      Nothing -> pretty rawErr
+      Just (span, err) -> prettyErrorAt span source err
+
+parseSrcSpan :: Text -> Maybe (SrcSpan, Text)
+parseSrcSpan  e =
+  let (s, description) = Text.drop 1 <$> Text.breakOn "\n" e
+
+      number = do
+        n <- Parsec.many Parsec.digit
+        maybe (fail "no parse") return $ readMaybe n
+
+      srcLoc = SrcLoc
+        <$> (Parsec.string "line " *> number)
+        <*> (Parsec.string ", column " *> number)
+
+      srcSpan = do
+        start <- srcLoc
+        end <- (Parsec.string " - " *> srcLoc) <|> return start
+        return $ SrcSpan start end
+  in
+  case Parsec.runParser srcSpan () "<input>" s of
+    Left _ -> Nothing
+    Right span -> Just (span, description)
+
+-- | Number of lines to show before and after the target
+-- source span to give more context to the error.
+newtype Context = Context { unContext :: Int }
+
+prettyErrorAt :: SrcSpan -> Text -> Text -> Doc Ann
+prettyErrorAt span source err = vcat
+  [ pretty err
+  , prettySource
+  ]
+  where
+    prettySource = vcat
+      [ numberCol ctx span Nothing
+      , relevantLines
+      , numberCol ctx span Nothing <>
+        if isSingleLine
+          then underline span
+          else mempty
+      ]
+    -- number of lines before and after the error to show
+    ctx = Context $ if isSingleLine then 0 else 1
+    isSingleLine    = sline span == eline span
+    firstLineToShow = sline span - unContext ctx
+    lastLineToShow  = eline span + unContext ctx
+    shouldShow line = firstLineToShow <= line && line <= lastLineToShow
+    relevantLines = vcat
+      [ prettyLine ctx span n line
+      | (n, line) <- zip [1..] (Text.lines source)
+      , shouldShow n
+      ]
+
+prettyLine :: Context -> SrcSpan -> Int -> Text -> Doc Ann
+prettyLine ctx span n line =
+  numberCol ctx span (Just n)
+  <> pretty before
+  <> red (pretty within)
+  <> pretty after
+  where
+    before
+      | n == sline span = Text.take (scol span - 1) line
+      | n < sline span = line
+      | otherwise = mempty
+    after
+      | n == eline span = Text.drop (ecol span - 1) line
+      | n > eline span = line
+      | otherwise = mempty
+    within
+      = Text.dropEnd (Text.length after)
+      $ Text.drop (Text.length before) line
+
+-- | only to be used for single line SrcSpan
+underline :: SrcSpan -> Doc Ann
+underline span = pretty spaces <> red (pretty zigzag)
+  where
+    spaces = Text.replicate (scol span - 1) " "
+    zigzag = Text.replicate (max 1 $ ecol span - scol span) "^"
+
+numberCol :: Context -> SrcSpan -> Maybe Int -> Doc Ann
+numberCol (Context ctx) span mline =
+  pretty spaces <> pretty number <> divider <> indicator
+  where
+    hasContext = ctx > 0
+    isSourceLine = isJust mline
+    isProblemLine = case mline of
+      Nothing -> False
+      Just n -> sline span <= n && n <= eline span
+
+    maxNumber = show (eline span)
+    divider = if isSourceLine then " |" else "  "
+    number = maybe "" show mline
+    spaces = Text.replicate (length maxNumber - length number) " "
+    indicator =
+      if hasContext && isProblemLine
+         then red "> "
+         else "  " -- no context. No need to point out which lines have errors.
+
+red :: Doc Ann -> Doc Ann
+red = Pretty.annotate (Pretty.color Pretty.Red)
+
+sline, eline, scol, ecol :: SrcSpan -> Int
+sline (SrcSpan (SrcLoc l _) _) = l
+eline (SrcSpan _ (SrcLoc l _)) = l
+scol (SrcSpan (SrcLoc _ c) _) = c
+ecol (SrcSpan _ (SrcLoc _ c)) = c
diff --git a/glean/shell/Glean/Shell/Index.hs b/glean/shell/Glean/Shell/Index.hs
new file mode 100644
--- /dev/null
+++ b/glean/shell/Glean/Shell/Index.hs
@@ -0,0 +1,110 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Shell.Index
+  ( indexCmd
+  , pickHash
+  , load
+  , create
+  ) where
+
+import Options.Applicative as OptParse
+import Control.Exception
+import Control.Monad
+import Control.Monad.Catch
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Control
+import Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.ByteString as B
+import Data.Default
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Foreign.CPP.Dynamic
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+import TextShow
+
+import qualified Glean
+import Glean.Shell.Types
+import Glean.Util.Some
+import Glean.Write
+
+import Glean.Indexer
+import Glean.Indexer.List
+
+indexCmd :: String -> Eval ()
+indexCmd str = do
+  let parser = (,)
+        <$> cmdLineParser
+        <*> (strArgument (metavar "ROOT"))
+
+      result = execParserPure defaultPrefs (info parser fullDesc)
+        (words str {- TODO: quoting -})
+
+  (runIndexer, root) <- case result of
+    OptParse.Success a -> return a
+    OptParse.Failure f -> throwM $ ErrorCall $ fst $ renderFailure f ":index"
+    OptParse.CompletionInvoked{} -> throwM $ ErrorCall "CompletionInvoked"
+
+  projectRoot <- liftIO $ getCurrentDirectory
+  withSystemTempDirectory' "glean-shell" $ \tmp -> do
+    let name = Text.pack (takeBaseName (dropTrailingPathSeparator root))
+    hash <- pickHash name
+    let repo = Glean.Repo name hash
+    withBackend $ \backend -> do
+      let exists = throwIO (ErrorCall (show repo <> ": already exists"))
+      liftIO $ Glean.fillDatabase backend repo Nothing exists $
+        runIndexer (Some backend) repo
+          IndexerParams {
+            indexerRoot = root,
+            indexerProjectRoot = projectRoot,
+            indexerOutput = tmp,
+            indexerGroup = ""
+          }
+    setRepo repo
+
+withSystemTempDirectory' :: String -> (FilePath -> Eval a) -> Eval a
+withSystemTempDirectory' str action = Eval $ do
+  a <- liftWith $ \run -> withSystemTempDirectory str (run . unEval . action)
+  restoreT $ return a
+
+pickHash :: Text -> Eval Text
+pickHash name = withBackend $ \be -> do
+  r <- liftIO $ Glean.listDatabases be def
+  let
+    hashes =
+      [ repo_hash
+      | Glean.Database{..} <- Glean.listDatabasesResult_databases r
+      , let Glean.Repo{..} = database_repo
+      , repo_name == name
+      ]
+  return $ head $ filter (`notElem` hashes) $ map showt [0::Int ..]
+
+-- | Load a set of JSON files as a DB
+load :: Glean.Repo -> [FilePath] -> Eval ()
+load repo files = withBackend $ \be ->  liftIO $ do
+  let onExisting  = throwIO $ ErrorCall "database already exists"
+  -- load all files first
+  parsedFiles <- forM files $ \file -> do
+      r <- Foreign.CPP.Dynamic.parseJSON =<< B.readFile file
+      val <- either (throwIO  . ErrorCall . Text.unpack) return r
+      case Aeson.parse parseJsonFactBatches val of
+        Error str -> throwIO $ ErrorCall str
+        Aeson.Success x -> return x
+  -- then, send them to the server
+  Glean.fillDatabase be repo Nothing onExisting $
+    forM_ parsedFiles $ \(batches, schema_id) -> do
+      let opts = schemaIdToOpts schema_id
+      Glean.sendJsonBatch be repo batches opts
+
+create :: Glean.Repo -> Eval ()
+create repo = withBackend $ \be ->  liftIO $ do
+  exists <- Glean.create be repo Nothing
+  when exists $ throwIO $ ErrorCall "database already exists"
diff --git a/glean/shell/Glean/Shell/Terminal.hs b/glean/shell/Glean/Shell/Terminal.hs
new file mode 100644
--- /dev/null
+++ b/glean/shell/Glean/Shell/Terminal.hs
@@ -0,0 +1,70 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
+module Glean.Shell.Terminal
+  ( withPager
+  ) where
+
+import Control.Concurrent.Async
+import Control.Concurrent.MVar
+import Control.Exception
+import Control.Monad
+import System.IO
+#if __GLASGOW_HASKELL__ >= 810
+import System.IO.Error
+#endif
+import System.Process
+
+-- | Spawn a pager (currently hard-coded as `less` with some flags) and pass its
+-- stdin handle to the action. The pager is spawned in parallel to the action
+-- so the handle is wrapped in an 'MVar' which can be waited on. If the pager
+-- fails for any reason, the 'MVar' will be set to the current stdout. The
+-- action will be aborted if the pager exits before it is finished (allowing the
+-- user to stop the action by quitting the pager).
+withPager :: (MVar Handle -> IO a) -> IO (Maybe a)
+withPager action = mask $ \restore -> do
+  handle_var <- newEmptyMVar
+  withAsyncWithUnmask (act handle_var) $ \async_action ->
+    withAsyncWithUnmask (pager handle_var) $ \async_pager ->
+      restore $ do
+        r <- waitEitherCatch async_action async_pager
+        case r of
+          Left (Left exc)
+#if __GLASGOW_HASKELL__ >= 810
+            | Just e <- fromException exc, isResourceVanishedError e ->
+              -- action got a "Broken pipe" error because the user
+              -- quit the pager; ignore it
+              return Nothing
+#endif
+            | otherwise -> throwIO exc
+          Left (Right x) -> do
+            void $ wait async_pager
+            return $ Just x
+          Right (Left _) -> Just <$> wait async_action
+          Right (Right _) -> return Nothing
+  where
+    act handle_var restore =
+      restore (action handle_var)
+      `finally` do
+        h <- readMVar handle_var
+        when (h /= stdout) $ hClose h
+
+    pager handle_var restore =
+      restore (withCreateProcess
+        (proc "less" ["-eFRX"]){ std_in = CreatePipe, std_err = CreatePipe }
+        (\(Just inh) _ (Just errh) ph ->
+          do
+            putMVar handle_var inh
+            withAsync (consume errh) $ const $ void $ waitForProcess ph
+          `finally` hClose errh))
+      `onException` tryPutMVar handle_var stdout
+
+    consume h = do
+      s <- hGetContents h
+      void $ evaluate s
diff --git a/glean/shell/Glean/Shell/Types.hs b/glean/shell/Glean/Shell/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/shell/Glean/Shell/Types.hs
@@ -0,0 +1,194 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE DeriveTraversable #-}
+module Glean.Shell.Types (
+  Parse(..), Statement(..), JSONQuery(..), AngleQuery(..),
+  SchemaQuery(..),
+  Stats(..),
+  ShellState(..),
+  Eval(..),
+  ExpandResults(..),
+  withBackend,
+  getState,
+  getRepo,
+  setRepo,
+) where
+
+import Control.Concurrent
+import Control.Exception
+import Data.Default
+import Data.Bifunctor
+import Data.Functor (($>))
+import qualified Control.Monad.Catch as C
+import Control.Monad.IO.Class (MonadIO, liftIO)
+import qualified Control.Monad.Trans.State.Strict as State
+import Data.Int
+import Data.List
+import qualified Data.Map as Map
+import Data.Maybe
+import Compat.Prettyprinter as Pretty
+#if !MIN_VERSION_haskeline(0,8,0)
+import qualified System.Console.Haskeline as Haskeline
+#endif
+import System.IO
+import qualified Text.JSON as JSON
+import qualified Text.Parsec as P
+import qualified Text.Parsec.Language as P
+import qualified Text.Parsec.Token as P
+
+import Glean
+import qualified Glean.Types as Thrift
+import Glean.LocalOrRemote (LocalOrRemote)
+import Glean.Database.Config (ProcessedSchema(..), processSchema)
+import Glean.Util.Some
+
+data Statement pat
+  = Command String String
+  | Pattern pat
+  | FactRef Fid
+
+data ExpandResults
+  = ExpandRecursive
+  | ExpandPredicates [SourceRef]
+
+type Parser = P.Parsec String ()
+
+class Parse a where
+  parse :: Parser a
+
+instance Parse Fid where
+  parse = Fid . fromInteger <$> P.braces lexer (P.natural lexer)
+
+instance Parse pat => Parse (Statement pat) where
+  parse = P.choice [command, P.try factref, ptrn]
+    where
+      command = split <$> (P.char ':' *> P.getInput <* P.setInput "")
+      ptrn = Pattern <$>  parse
+      factref = FactRef <$> parse
+      split s
+        | (cmd,' ':arg) <- break (==' ') s = Command cmd arg
+        | otherwise = Command s ""
+
+data AngleQuery = AngleQuery
+  { angleQueryDeprecatedRec :: Bool
+  , angleQueryStored :: Bool
+  , angleQuery :: String
+  }
+
+instance Parse AngleQuery where
+  parse = AngleQuery
+    <$> P.option False (P.char '!' $> True)
+    <*> P.option False (P.char '*' $> True)
+    <*> P.many P.anyChar
+
+data JSONQuery = JSONQuery
+  { jsonQueryPred :: String
+  , jsonQueryDeprecatedRec :: Bool
+  , jsonQueryStored :: Bool
+  , jsonQuery :: String
+  }
+
+instance Parse JSONQuery where
+  parse = JSONQuery
+    <$> P.identifier lexer
+    <*> P.option False (P.char '!' $> True)
+    <*> P.option False (P.char '*' $> True)
+    <*> P.many P.anyChar
+
+lexer :: P.TokenParser st
+lexer = P.makeTokenParser P.emptyDef
+  { P.identLetter = P.alphaNum P.<|> P.oneOf "_." }
+
+
+data SchemaQuery = SchemaQuery
+  { sqPredicate :: String
+  , sqRecursive :: ExpandResults
+  , sqStored :: Bool
+  , sqQuery :: String
+  , sqCont :: Maybe Thrift.UserQueryCont
+  , sqTransform :: Maybe (JSON.JSValue -> JSON.Result JSON.JSValue)
+  , sqSyntax :: Thrift.QuerySyntax
+  , sqOmitResults :: Bool
+  , sqContinue :: Bool
+  }
+
+data Stats = NoStats | SummaryStats | FullStats
+  deriving Eq
+
+data ShellState = ShellState
+  { backend :: Some LocalOrRemote
+  , repo :: Maybe Repo
+  , schemas :: Maybe ProcessedSchema
+  , schemaInfo :: Maybe Thrift.SchemaInfo
+  , useSchemaId :: Thrift.SelectSchema
+  , limit :: Int64
+  , timeout :: Maybe Int64
+  , stats :: Stats
+  , lastSchemaQuery :: Maybe SchemaQuery
+  , updateSchema :: Maybe (Eval ())
+  , isTTY :: Bool
+  , pageWidth :: Maybe PageWidth
+  , expandResults :: ExpandResults
+  , pager :: Bool
+  , outputHandle :: MVar System.IO.Handle
+  , debug :: Thrift.QueryDebugOptions
+  , client_info :: Thrift.UserQueryClientInfo
+  , query_file :: FilePath
+  }
+
+newtype Eval a = Eval
+  { unEval :: State.StateT ShellState IO a
+  }
+  deriving
+    ( Functor
+    , Applicative
+    , Monad
+#if !MIN_VERSION_haskeline(0,8,0)
+    , Haskeline.MonadException
+#endif
+    , MonadIO
+    , C.MonadCatch
+    , C.MonadMask
+    , C.MonadThrow )
+
+withBackend :: (forall b . LocalOrRemote b => b -> Eval a) -> Eval a
+withBackend f = do
+  state <- getState
+  case backend state of
+    Some b -> f b
+
+getState :: Eval ShellState
+getState = Eval State.get
+
+getRepo :: Eval (Maybe Repo)
+getRepo = repo <$> getState
+
+setRepo :: Repo -> Eval ()
+setRepo r = do
+  sel <- useSchemaId <$> getState
+  withBackend $ \backend -> do
+    info@SchemaInfo{..} <- liftIO $
+      getSchemaInfo backend (Just r) def { getSchemaInfo_select = sel }
+    let sids = map (first Thrift.SchemaId) $ Map.toList $ case sel of
+          Thrift.SelectSchema_current{} -> schemaInfo_schemaIds
+          Thrift.SelectSchema_stored{} -> schemaInfo_dbSchemaIds
+          Thrift.SelectSchema_schema_id id
+            | Map.member (unSchemaId id) schemaInfo_schemaIds ->
+              schemaInfo_schemaIds
+            | Map.member (unSchemaId id) schemaInfo_dbSchemaIds ->
+              schemaInfo_dbSchemaIds
+            | Just ids <- find (unSchemaId id `Map.member`)
+              schemaInfo_otherSchemaIds -> ids
+          _otherwise -> Map.empty
+    Eval $ State.modify $ \s -> s
+      { repo = Just r
+      , schemaInfo = Just info }
+    proc <- either (liftIO . throwIO . ErrorCall) return $
+      processSchema (listToMaybe sids) schemaInfo_schema
+    Eval $ State.modify $ \s -> s { schemas = Just proc }
diff --git a/glean/test/lib/Glean/Database/Catalog/Test.hs b/glean/test/lib/Glean/Database/Catalog/Test.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/lib/Glean/Database/Catalog/Test.hs
@@ -0,0 +1,90 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module Glean.Database.Catalog.Test
+  ( MockStore(..)
+  , memStore
+  , withMemCatalog
+  , checkConsistency
+  ) where
+
+import Control.Exception hiding (assert)
+import Control.Monad
+import Data.Default
+import Data.HashMap.Strict (HashMap)
+import Data.List ((\\))
+import Data.Proxy
+import qualified Data.Text as Text
+import Test.HUnit
+
+import Util.STM
+
+import Glean.Database.Catalog (Catalog)
+import qualified Glean.Database.Catalog as Catalog
+import qualified Glean.Database.Catalog.Local.Memory as Catalog
+import Glean.Database.Catalog.Filter
+import qualified Glean.Database.Catalog.Store as Store
+import Glean.Database.Meta (Meta)
+import Glean.Test.HUnit
+import Glean.Test.Mock
+import Glean.Types (Repo(..), UnknownDatabase(..))
+
+data MockStore = MockStore
+  { storeList :: Mock (IO (HashMap Repo Meta))
+  , storeCreate :: Mock (Repo -> Meta -> IO Bool)
+  , storeDelete :: Mock (Repo -> IO Bool)
+  , storePut :: Mock (Repo -> Meta -> IO Bool)
+  , storeGet :: Mock (Repo -> IO (Maybe Meta))
+  }
+
+instance Store.Store MockStore where
+  list = call . storeList
+  create = call . storeCreate
+  delete = call . storeDelete
+  put = call . storePut
+  get = call . storeGet
+
+memStore :: IO MockStore
+memStore = do
+  cat <- Catalog.memoryCatalog
+  storeList <- implement "Store.list" $ Store.list cat
+  storeCreate <- implement "Store.create" $ Store.create cat
+  storeDelete <- implement "Store.delete" $ Store.delete cat
+  storePut <- implement "Store.put" $ Store.put cat
+  storeGet <- implement "Store.get" $ Store.get cat
+  return MockStore{..}
+
+withMemCatalog :: (MockStore -> Catalog -> IO a) -> IO a
+withMemCatalog f = do
+  store <- memStore
+  bracket (Catalog.open store) Catalog.close $ f store
+
+
+checkConsistency :: Catalog -> IO ()
+checkConsistency cat = do
+  xs <- map itemRepo <$> atomically (Catalog.list cat [Local] everythingF)
+  mapM_ live xs
+  mapM_ not_live
+    $ take 4
+    $ map (Repo "test" . Text.pack . show) [1::Int ..] \\ xs
+  where
+    live repo = do
+      assert $ Catalog.exists cat [Local] repo
+      assert $ void $ Catalog.readMeta cat repo
+      assert $ Catalog.writeMeta cat repo def
+      assert $ void $ Catalog.modifyMeta cat repo return
+
+    not_live repo = do
+      assert $ not <$> Catalog.exists cat [Local] repo
+      assertThrowsType "" (Proxy @UnknownDatabase)
+        $ atomically $ Catalog.readMeta cat repo
+      assertThrowsType "" (Proxy @UnknownDatabase)
+        $ atomically $ Catalog.writeMeta cat repo def
+      assertThrowsType "" (Proxy @UnknownDatabase)
+        $ atomically $ Catalog.modifyMeta cat repo return
diff --git a/glean/test/lib/Glean/Database/Test.hs b/glean/test/lib/Glean/Database/Test.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/lib/Glean/Database/Test.hs
@@ -0,0 +1,164 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Database.Test
+  ( Setting
+  , setRoot
+  , setSchemaLocation
+  , setSchemaIndex
+  , setSchemaPath
+  , setSchemaId
+  , disableStrictSchemaId
+  , setMemoryStorage
+  , setDBVersion
+  , setCompactOnCompletion
+  , setMaxSetSize
+  , enableTcDebug
+  , enableQueryDebug
+  , withTestEnv
+  , kickOffTestDB
+  , waitUntilComplete
+  , completeTestDB
+  , withEmptyTestDB
+  , writeFactsIntoDB
+  ) where
+
+import Util.STM
+import Data.Default
+import Data.Functor
+import Data.Int
+import Data.List (foldl')
+import qualified Data.Text as Text
+
+import Util.EventBase
+
+import Glean.Backend.Local ( {- instance Backend Env -} )
+import Glean.Backend.Types
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Config
+import Glean.Database.Env
+import Glean.Database.Write.Batch
+import Glean.Database.Types
+import qualified Glean.Internal.Types as Thrift
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Typed
+import qualified Glean.Types as Thrift
+import Glean.Util.ConfigProvider
+import qualified Glean.Util.ThriftSource as ThriftSource
+
+type Setting = Config -> Config
+
+setRoot :: FilePath -> Setting
+setRoot path cfg = cfg{ cfgDataStore = fileDataStore path }
+
+setSchemaLocation :: SchemaLocation -> Setting
+setSchemaLocation loc cfg = cfg{ cfgSchemaLocation = Just loc }
+
+setSchemaPath :: FilePath -> Setting
+setSchemaPath = setSchemaLocation . SchemaLocation_file . Text.pack
+
+setSchemaIndex :: FilePath -> Setting
+setSchemaIndex = setSchemaLocation . SchemaLocation_index . Text.pack
+
+-- | Set the schema that will be used for queries, otherwise defaults
+-- to the highest all.N in the latest schema.
+setSchemaId :: Thrift.SchemaId -> Setting
+setSchemaId id cfg = cfg { cfgSchemaId = Just id }
+
+disableStrictSchemaId :: Setting
+disableStrictSchemaId cfg = cfg {
+  cfgServerConfig = cfgServerConfig cfg <&> \scfg -> scfg
+    { ServerConfig.config_strict_query_schema_id = False }
+  }
+
+setMemoryStorage :: Setting
+setMemoryStorage cfg = cfg{ cfgDataStore = memoryDataStore }
+
+setDBVersion :: ServerConfig.DBVersion -> Setting
+setDBVersion ver cfg = cfg
+  { cfgServerConfig = cfgServerConfig cfg <&> \scfg -> scfg
+      { ServerConfig.config_db_create_version = Just ver } }
+
+setCompactOnCompletion :: Setting
+setCompactOnCompletion cfg = cfg
+  { cfgServerConfig = cfgServerConfig cfg <&> \scfg -> scfg
+      { ServerConfig.config_compact_on_completion = True } }
+
+setMaxSetSize :: Int64 -> Setting
+setMaxSetSize i cfg = cfg
+  { cfgServerConfig = cfgServerConfig cfg <&> \scfg -> scfg
+      { ServerConfig.config_max_set_size_bytes = Just i } }
+
+enableTcDebug :: Setting
+enableTcDebug cfg = cfg
+  { cfgDebug = (cfgDebug cfg) { tcDebug = True } }
+
+enableQueryDebug :: Setting
+enableQueryDebug cfg = cfg
+  { cfgDebug = (cfgDebug cfg) { queryDebug = True } }
+
+withTestEnv
+  :: [Setting]
+  -> (Env -> IO a)
+  -> IO a
+withTestEnv settings action =
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider defaultConfigOptions $
+      \(cfgAPI :: NullConfigProvider) -> do
+    let
+      dbConfig = foldl' (\acc f -> f acc)
+        def
+          { cfgDataStore = tmpDataStore
+          , cfgSchemaLocation = Just schemaLocationFiles
+          , cfgServerConfig = ThriftSource.value def
+              { ServerConfig.config_db_rocksdb_cache_mb = 0 }
+          }
+        settings
+
+    withDatabases evb dbConfig cfgAPI action
+
+kickOffTestDB
+  :: Env -> Thrift.Repo -> (Thrift.KickOff -> Thrift.KickOff) -> IO ()
+kickOffTestDB env repo update = do
+  void $ kickOffDatabase env $ update def
+    { Thrift.kickOff_repo = repo
+    }
+
+writeFactsIntoDB
+  :: Env
+  -> Thrift.Repo
+  -> [SchemaPredicates]
+  -> (forall m. NewFact m => m ())
+  -> IO ()
+writeFactsIntoDB env repo allPredicates facts = do
+  !predicates <- loadPredicates env repo allPredicates
+  batch <- buildBatch predicates Nothing facts
+  void $ syncWriteDatabase env repo batch
+
+waitUntilComplete :: Env -> Thrift.Repo -> IO ()
+waitUntilComplete Env{..} repo = atomically $ do
+  meta <- Catalog.readMeta envCatalog repo
+  case Thrift.metaCompleteness meta of
+    Thrift.Complete{} -> return ()
+    Thrift.Broken{} -> errorWithoutStackTrace "database failed unexpectedly"
+    _ -> retry
+
+completeTestDB :: Env -> Thrift.Repo -> IO ()
+completeTestDB env repo = do
+  void $ finishDatabase env repo
+  waitUntilComplete env repo
+
+withEmptyTestDB
+  :: [Setting]
+  -> (Env -> Thrift.Repo -> IO a) -- ^ action
+  -> IO a
+withEmptyTestDB settings action = withTestEnv settings $ \env -> do
+  kickOffTestDB env repo id
+  action env repo
+  where
+    repo = Thrift.Repo "dbtest-repo" "f00baa"
diff --git a/glean/test/lib/TestBatch.hs b/glean/test/lib/TestBatch.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/lib/TestBatch.hs
@@ -0,0 +1,57 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE AllowAmbiguousTypes, TypeApplications #-}
+module TestBatch (testBatch) where
+
+import Data.Default
+import qualified Data.Text as Text
+
+import Glean.Backend.Types (Backend)
+import qualified Glean.Backend.Types as Backend
+import qualified Glean.Schema.Cxx1 as Cxx
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.Src as Src
+import qualified Glean.Schema.Src.Types as Src
+import Glean.Typed
+import Glean.Types as Thrift
+
+testBatch :: Backend e => Int -> e -> Repo -> IO Thrift.Batch
+testBatch max backend repo = do
+  predicates <- Backend.loadPredicates backend repo
+    [ Cxx.allPredicates
+    , Src.allPredicates
+    ]
+  buildBatch predicates Nothing $ do
+    files <- mapM (makeFact @Src.File)
+      [ mconcat
+          $ Text.pack (show $ n `div` 100)
+          : replicate (n `mod` 10) "abcdefh"
+          ++ [Text.pack (show $ n `mod` 100)]
+        | n <- [1..max] ]
+
+    names <- mapM (makeFact @Cxx.Name)
+      [ "x" <> Text.pack (show n) | n <- [1..max] ]
+
+    mapM_ (makeFact @Cxx.FunctionName . Cxx.FunctionName_key_name) names
+
+    mapM_ (makeFact @Cxx.FileXRefMap)
+      [ def
+          { Cxx.fileXRefMap_key_file = file
+          , Cxx.fileXRefMap_key_froms = replicate 20 def
+              { Cxx.from_spans =
+                  [ def
+                    { Src.packedByteSpansGroup_offsets = replicate 10 $ toNat 2
+                    , Src.packedByteSpansGroup_length = toNat 10
+                    }
+                  ]
+              , Cxx.from_expansions = []
+              , Cxx.from_spellings = []
+              }
+          }
+        | file <- take (max `div` 20) files ]
diff --git a/glean/test/lib/TestDB.hs b/glean/test/lib/TestDB.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/lib/TestDB.hs
@@ -0,0 +1,132 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module TestDB (
+  WithDB,
+  withTestDB, withWritableTestDB, withStackedTestDB,
+  dbTestCase, dbTestCaseWritable, dbTestCaseSettings, createTestDB,
+  withDbTests,
+) where
+
+import Data.Default
+import Data.Either
+import Foreign.Marshal.Utils
+import Test.HUnit
+
+import Util.IO
+
+import Glean.Database.Storage (DBVersion(..), currentVersion, writableVersions)
+import Glean.Database.Test
+import Glean.Database.Types
+import Glean.Backend.Types as Backend
+import Glean.Typed
+import Glean.Schema.Resolve
+import qualified Glean.Types as Thrift
+
+import qualified Glean.Schema.Cxx1 as Cxx
+import qualified Glean.Schema.GleanTest as Glean.Test
+import qualified Glean.Schema.Sys as Sys
+
+import TestData
+
+-- | An action that runs on a test DB
+type WithDB a = Env -> Thrift.Repo -> IO a
+
+afterComplete :: WithDB a -> WithDB a
+afterComplete action env repo = do
+  completeTestDB env repo
+  action env repo
+
+withTestDB :: [Setting] -> WithDB a -> IO a
+withTestDB settings = withWritableTestDB settings . afterComplete
+
+createTestDB :: WithDB ()
+createTestDB env repo = do
+  kickOffTestDB env repo id
+  writeTestDB env repo testFacts
+
+withWritableTestDB :: [Setting] -> WithDB a -> IO a
+withWritableTestDB settings action = withEmptyTestDB settings $ \env repo -> do
+  writeTestDB env repo testFacts
+  action env repo
+
+withStackedTestDB :: [Setting] -> WithDB a -> IO a
+withStackedTestDB settings action = withTestEnv settings $ \env -> do
+  kickOffTestDB env repo1 id
+  writeTestDB env repo1 testFacts1
+  completeTestDB env repo1
+  kickOffTestDB env repo2 $ \x -> x
+    { Thrift.kickOff_dependencies = Just $ stacked repo1 }
+  writeTestDB env repo2 testFacts2
+  action env repo2
+  where
+    stacked (Thrift.Repo name hash) =
+      Thrift.Dependencies_stacked $ Thrift.Stacked name hash Nothing
+    repo1 = Thrift.Repo "dbtest-repo" "1"
+    repo2 = Thrift.Repo "dbtest-repo" "2"
+
+newtype RunTest = RunTest (forall a . WithDB a -> IO a)
+
+toTestCases :: [(String, RunTest)] -> WithDB () -> Test
+toTestCases testCases action = TestList
+  [ TestLabel label $ TestCase $ with action
+    | (label, RunTest with) <- testCases
+  ]
+
+dbFlavours :: [Setting] -> [(String, RunTest)]
+dbFlavours testCaseSettings =
+  [ (label1 ++ label2, run)
+    | (label2, settings) <-
+        [ ("memory", [setMemoryStorage])
+        , ("rocksdb", [])
+        ]
+        ++
+        [ ("rocksdb-" ++ show (unDBVersion v), [setDBVersion v])
+          | v <- writableVersions, v /= currentVersion ]
+    , let allSettings = settings <> testCaseSettings
+    , (label1, run) <-
+        [ ("", RunTest (withWritableTestDB allSettings))
+        , ("stacked/", RunTest (withStackedTestDB allSettings)) ]
+  ]
+
+-- | Run a test on several flavour of test DB. For a test suite
+-- with multiple tests, use 'withDbTests' instead.
+dbTestCase :: WithDB () -> Test
+dbTestCase = toTestCases (dbFlavours []) . afterComplete
+
+-- | Like dbTestCase, but the test DBs are shared between multiple
+-- tests, rather than being created afresh for each test. Useful
+-- for speeding up test suites that have many individual tests.
+withDbTests :: ((WithDB () -> Test) -> IO a) -> IO a
+withDbTests fn =
+  withMany lazify (dbFlavours []) $ fn . toTestCases
+  where
+  lazify :: (String, RunTest) -> ((String, RunTest) -> IO a) -> IO a
+  lazify (label, RunTest run) fn =
+    withLazy (run . afterComplete . curry) $ \get ->
+      fn (label, RunTest (\with -> do (env, repo) <- get; with env repo))
+
+dbTestCaseWritable :: WithDB () -> Test
+dbTestCaseWritable = toTestCases (dbFlavours [])
+
+dbTestCaseSettings :: [Setting] -> WithDB () -> Test
+dbTestCaseSettings settings action =
+  toTestCases (dbFlavours settings) (afterComplete action)
+
+writeTestDB :: Env -> Thrift.Repo -> (forall m. NewFact m => m ()) -> IO ()
+writeTestDB env repo facts = do
+  backend_schema <- parseAndResolveSchema . Thrift.schemaInfo_schema <$>
+    Backend.getSchemaInfo env (Just repo) def
+  assertBool "schema1" (isRight backend_schema)
+
+  let allPredicates =
+        [ Cxx.allPredicates
+        , Glean.Test.allPredicates
+        , Sys.allPredicates
+        ]
+  writeFactsIntoDB env repo allPredicates facts
diff --git a/glean/test/lib/TestData.hs b/glean/test/lib/TestData.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/lib/TestData.hs
@@ -0,0 +1,199 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module TestData
+  ( kitchenSink1
+  , testFacts
+  , testFacts1
+  , testFacts2
+  ) where
+
+import Data.Default
+
+import Glean.Typed
+import Glean.Types
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import qualified Glean.Schema.Sys.Types as Sys
+
+rec :: Glean.Test.Rec
+rec = def
+    { Glean.Test.rec_beta = Glean.Test.Sum_wed True }
+
+kitchenSink1 :: Glean.Test.KitchenSink
+kitchenSink1 = def
+  { Glean.Test.kitchenSink_byt = Byte 33
+  , Glean.Test.kitchenSink_nat = Nat 42
+  , Glean.Test.kitchenSink_array_of_byte = "xyz\0\0xff"
+  , Glean.Test.kitchenSink_array_of_nat = map toNat [1,2]
+  , Glean.Test.kitchenSink_array_of_string = ["abba", "baba"]
+  , Glean.Test.kitchenSink_record_ = Glean.Test.KitchenSink_record_
+    { Glean.Test.kitchenSink_record__a = Byte 34
+    , Glean.Test.kitchenSink_record__b = Nat 35 }
+  , Glean.Test.kitchenSink_named_record_ = rec
+  , Glean.Test.kitchenSink_named_sum_ = Glean.Test.Sum_tue (Nat 37)
+  , Glean.Test.kitchenSink_named_enum_ = Glean.Test.Enum__blue
+  , Glean.Test.kitchenSink_maybe_ = Just def
+  , Glean.Test.kitchenSink_bool_ = True
+  , Glean.Test.kitchenSink_string_ = "Hello\0world!\0"
+  , Glean.Test.kitchenSink_set_of_nat =
+      [toNat 65535, toNat 1, toNat 2 ]
+  , Glean.Test.kitchenSink_set_of_string = ["apa", "bepa"]
+  }
+
+mkTestFacts :: NewFact m => (m () -> m ()) -> (m () -> m ()) -> m ()
+mkTestFacts first second = do
+  sysBlobFact <- makeFact @Sys.Blob "hello"
+  sysBlobFact2 <- makeFact @Sys.Blob "bye"
+
+  cxxNameFact <- makeFact @Cxx.Name "foo"
+  makeFact_ @Cxx.FunctionName $ Cxx.FunctionName_key_name cxxNameFact
+
+  let mk_names xs = do
+        names <- mapM (makeFact @Cxx.Name) xs
+        mapM_
+          (makeFact_ @Cxx.FunctionName . Cxx.FunctionName_key_name)
+          names
+  first $ mk_names
+    [ "abba"
+    , "anonymous"
+    , "azimuth"
+    , "blubber"
+    , "book"
+    ]
+  second $ mk_names
+    [ "abcd"
+    , "allin"
+    , "anywhere"
+    , "barbie"
+    , "blob"
+    ]
+
+  let
+    kitchenSink2Term0 = kitchenSink1
+      { Glean.Test.kitchenSink_pred = sysBlobFact
+      , Glean.Test.kitchenSink_sum_ =
+          Glean.Test.KitchenSink_sum__d sysBlobFact
+      }
+
+    -- also make a small variant of kitchenSink2Term0
+    kitchenSink2Term0b = kitchenSink2Term0
+      { Glean.Test.kitchenSink_nat = toNat 43
+      , Glean.Test.kitchenSink_string_ = "acca"
+      , Glean.Test.kitchenSink_array_of_nat = map toNat [3,4,5]
+      , Glean.Test.kitchenSink_named_sum_ = Glean.Test.Sum_wed True
+      , Glean.Test.kitchenSink_maybe_ = Nothing
+      }
+
+  kitchenSink2Fact0 <- makeFact @Glean.Test.Predicate kitchenSink2Term0
+  kitchenSink2Fact0b <- makeFact @Glean.Test.Predicate kitchenSink2Term0b
+
+  let
+    -- refers to kitchenSink2Fact0 through the sum_ field, the
+    -- array_of_pred field and the set_of_pred field.
+    kitchenSink2Term1 = def
+      { Glean.Test.kitchenSink_pred = sysBlobFact2
+      , Glean.Test.kitchenSink_sum_ =
+          Glean.Test.KitchenSink_sum__c kitchenSink2Fact0
+      , Glean.Test.kitchenSink_array_of_pred = [ kitchenSink2Fact0 ]
+      , Glean.Test.kitchenSink_string_ = "clobber"
+      , Glean.Test.kitchenSink_array_of_nat = map toNat [6]
+      , Glean.Test.kitchenSink_named_sum_ = Glean.Test.Sum_wed True
+      , Glean.Test.kitchenSink_named_record_ = rec
+      , Glean.Test.kitchenSink_maybe_ = Nothing
+      , Glean.Test.kitchenSink_set_of_pred = [kitchenSink2Fact0]
+      }
+
+    kitchenSink2Term1b = kitchenSink2Term1
+      { Glean.Test.kitchenSink_sum_ =
+          Glean.Test.KitchenSink_sum__c kitchenSink2Fact0b
+      , Glean.Test.kitchenSink_array_of_pred = [ kitchenSink2Fact0b ]
+      , Glean.Test.kitchenSink_string_ = "flubber"
+      , Glean.Test.kitchenSink_array_of_nat = []
+      }
+
+    mk_refs term = do
+      p <- makeFact @Glean.Test.Predicate term
+      r <- makeFact @Glean.Test.Ref p
+      makeFact_ @Glean.Test.RefRef r
+
+  first $ mk_refs kitchenSink2Term1
+  second $ mk_refs kitchenSink2Term1b
+
+  first $ makeFactV_ @Glean.Test.KeyValue
+    (def
+      { Glean.Test.keyValue_key_kstring = "hello"
+      , Glean.Test.keyValue_key_knat = toNat 42 })
+    (def
+      { Glean.Test.keyValue_value_vnat = toNat 24
+      , Glean.Test.keyValue_value_vstring = "world" })
+
+  first $ makeFactV_ @Glean.Test.KeyValue
+    (def
+      { Glean.Test.keyValue_key_kstring = "foo"
+      , Glean.Test.keyValue_key_knat = toNat 3 })
+    (def
+      { Glean.Test.keyValue_value_vnat = toNat 4
+      , Glean.Test.keyValue_value_vstring = "bar" })
+
+  second $ makeFactV_ @Glean.Test.KeyValue
+    (def
+      { Glean.Test.keyValue_key_kstring = "foo"
+      , Glean.Test.keyValue_key_knat = toNat 5 })
+    (def
+      { Glean.Test.keyValue_value_vnat = toNat 5
+      , Glean.Test.keyValue_value_vstring = "foo" })
+
+  second $ makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "a" "b"
+  second $ makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "b" "a"
+  second $ makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "c" "d"
+  second $ makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "e" "e"
+  second $
+    makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "xx" "xx"
+  second $ makeFact_ @Glean.Test.StringPair $ Glean.Test.StringPair_key "xy" "xz"
+
+  a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+  b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+  c <- makeFact @Glean.Test.Node (Glean.Test.Node_key "c")
+  d <- makeFact @Glean.Test.Node (Glean.Test.Node_key "d")
+  e <- makeFact @Glean.Test.Node (Glean.Test.Node_key "e")
+  f <- makeFact @Glean.Test.Node (Glean.Test.Node_key "f")
+  g <- makeFact @Glean.Test.Node (Glean.Test.Node_key "g")
+
+  first $ makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a b)
+  second $ makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a c)
+  second $ makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b d)
+  second $ makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key c d)
+
+  d_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key d Nothing Nothing)
+  c_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key c (Just d_) Nothing)
+  b_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key b Nothing (Just d_))
+  a_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key a (Just b_) (Just c_))
+  g_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key g Nothing Nothing)
+  f_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key f Nothing (Just g_))
+  e_ <- makeFact @Glean.Test.Tree (Glean.Test.Tree_key e (Just f_) Nothing)
+
+  first $ makeFactV_ @Glean.Test.TreeToTree a_ e_
+
+  qux1 <- makeFact @Glean.Test.Qux "qux1"
+  bar1 <- makeFactV @Glean.Test.Bar "bar1" qux1
+  foo1 <- makeFactV @Glean.Test.Foo "foo1" bar1
+  qux2 <- makeFact @Glean.Test.Qux "qux2"
+  bar2 <- makeFactV @Glean.Test.Bar "bar2" qux2
+  foo2 <- makeFactV @Glean.Test.Foo "foo2" bar2
+  first $ makeFactV_ @Glean.Test.FooToFoo foo1 foo2
+
+testFacts :: NewFact m => m ()
+testFacts = mkTestFacts id id
+
+testFacts1 :: NewFact m => m ()
+testFacts1 = mkTestFacts id (const $ return ())
+
+testFacts2 :: NewFact m => m ()
+testFacts2 = mkTestFacts (const $ return ()) id
diff --git a/glean/test/regression/Glean/Regression/Config.hs b/glean/test/regression/Glean/Regression/Config.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Config.hs
@@ -0,0 +1,29 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Config
+  ( TestConfig(..)
+  ) where
+
+import Glean.Types
+
+-- | Test configuration
+data TestConfig = TestConfig
+  { testRepo :: Repo
+  , testOutput :: FilePath
+      -- ^ directory in which to store *all* output and temporary files
+  , testRoot :: FilePath
+      -- ^ directory with source files to index
+  , testProjectRoot :: FilePath
+      -- ^ top-level directory (fbsource/fbcode)
+  , testGroup :: String
+      -- ^ test group. Groups are used to run the whole set of tests
+      -- multiple ways, e.g. for different platforms.
+  , testSchema :: Maybe FilePath
+      -- ^ Directory containing the schema files
+  } deriving (Show)
diff --git a/glean/test/regression/Glean/Regression/Driver/External.hs b/glean/test/regression/Glean/Regression/Driver/External.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Driver/External.hs
@@ -0,0 +1,38 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Run a snapshot test with an external indexer
+
+module Glean.Regression.Driver.External (main) where
+
+import System.Environment
+
+import Util.Log
+
+import Glean.Indexer
+import Glean.Indexer.List (cmdLineParser)
+
+import Glean.Regression.Snapshot (testMain)
+import Glean.Regression.Snapshot.Driver
+
+snapshotDriver :: Driver RunIndexer
+snapshotDriver = driverFromIndexer
+  Indexer {
+    indexerShortName = "multiple",
+    indexerDescription = "Choose an indexer to run",
+    indexerOptParser = cmdLineParser,
+    indexerRun = id
+  }
+
+main :: IO ()
+main = do
+  args <- getArgs
+  logInfo $ "args: " <> show args
+    -- useful for debugging issues in surrounding scripts that pass
+    -- arguments in.
+  testMain snapshotDriver
diff --git a/glean/test/regression/Glean/Regression/Indexer.hs b/glean/test/regression/Glean/Regression/Indexer.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Indexer.hs
@@ -0,0 +1,46 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Indexer
+  ( withTestBackend
+  , runIndexerForTest
+  ) where
+
+import Data.Maybe
+import qualified Data.Text as Text
+import System.FilePath
+
+import Glean.Database.Config
+import Glean.LocalOrRemote
+import Glean.Database.Test
+import Glean.Indexer
+import Glean.Regression.Config
+import Glean.Util.Some
+
+-- | Set up a Backend for test runs
+withTestBackend
+  :: TestConfig
+  -> (Some LocalOrRemote -> IO a)
+  -> IO a
+withTestBackend test action =
+  withTestEnv settings (action . Some)
+  where
+  settings = [ setRoot $ testOutput test </> "db" ] <>
+    map (setSchemaLocation . SchemaLocation_dir . Text.pack)
+      (maybeToList (testSchema test))
+
+runIndexerForTest :: Some LocalOrRemote -> RunIndexer -> TestConfig -> IO ()
+runIndexerForTest backend indexer test =
+  indexer backend (testRepo test) params
+  where
+  params = IndexerParams {
+    indexerRoot = testRoot test,
+    indexerProjectRoot = testProjectRoot test,
+    indexerOutput = testOutput test,
+    indexerGroup = testGroup test
+    }
diff --git a/glean/test/regression/Glean/Regression/Snapshot.hs b/glean/test/regression/Glean/Regression/Snapshot.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot.hs
@@ -0,0 +1,285 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+-- | Make a snapshot regression test out of a 'Driver'.
+--
+-- A snapshot regression test runs queries specified in @.query@ files
+-- against some indexed sample source code and compares the output
+-- against the snapshot saved in the correspond @.out@ file.
+
+module Glean.Regression.Snapshot
+  ( testMain
+  ) where
+
+import Control.Exception
+import Control.Monad
+import qualified Data.ByteString as BS
+import qualified Data.Map.Strict as Map
+import Data.List
+import Data.Maybe
+import qualified Data.Text as Text
+import System.Directory
+import System.Exit
+import System.FilePath
+import System.IO.Temp
+import System.Process
+import qualified Test.HUnit as HUnit
+
+import TestRunner
+import Util.JSON.Pretty ()
+import Util.Log
+
+import Glean (Backend)
+import Glean.Indexer
+import Glean.Init (withUnitTestOptions)
+import Glean.Regression.Config
+import Glean.Regression.Indexer
+import Glean.Regression.Snapshot.Driver
+import Glean.Regression.Snapshot.Options
+import Glean.Regression.Snapshot.Query
+import Glean.Regression.Snapshot.Result
+import Glean.Regression.Snapshot.Transform
+import Glean.Types
+
+-- | From 'testRoot' this locates all subdirectories below the root
+-- that contain at least one ".out" file.
+discoverTests :: FilePath -> IO [FilePath]
+discoverTests root = go ""
+  where
+  go dir = do
+    xs <- listDirectory (root </> dir)
+    dirs <- filterM (doesDirectoryExist . ((root </> dir) </>)) xs
+    subdirTests <- concat <$> mapM (go . (dir </>)) dirs
+    return $
+      if any (".out" `isSuffixOf`) xs
+        then dir : subdirTests
+        else subdirTests
+
+-- | Run one test and its *.query files, return (*.out, *.perf) 'FilePath'.
+runTest
+  :: Driver opts
+  -> opts
+  -> FilePath    -- ^ test root, canonicalized
+  -> TestConfig
+  -> IO [FilePath]
+runTest driver@Driver{..} driverOpts root testIn =
+  withTestBackend testIn $ \backend -> do
+    let index = indexerRun driverIndexer
+    driverCreateDatabase driverOpts backend index testIn
+    runQueries backend driver root testIn
+
+-- | Run the queries
+runQueries
+  :: Backend b
+  => b
+  -> Driver opts
+  -> FilePath  -- ^ test root, canonicalized
+  -> TestConfig
+  -> IO [FilePath]
+runQueries backend Driver{..} root test  = do
+  queries <- get_queries root mempty (testRoot test)
+  when (null queries) $
+    throwIO $ ErrorCall $ "no .query files found; root=" <> show root
+  fmap concat $ forM (Map.elems queries) $ \query -> do
+    (result, perf) <- runQuery
+      backend
+      (testRepo test)
+      (defaultTransforms <> driverTransforms)
+      query
+    let base = testOutput test </> dropExtension (takeFileName query)
+        out = base <.> "out"
+        perfOut = base <.> "perf"
+    writeFile out result
+    mapM_ (writeFile perfOut) perf
+    return $ if isJust perf then [out,perfOut] else [out]
+  where
+  get_queries root qs path = do
+    files <- listDirectory path
+    let qs' = Map.union qs $ Map.fromList
+          [ (file, path </> file)
+          | file <- files, ".query" `isExtensionOf` file ]
+    if equalFilePath path root
+      then return qs'
+      else get_queries root qs' $ takeDirectory path
+
+-- | Outputs to compare/regenerate.
+--
+-- When (re)generating the golden outputs, we designate one group (the first
+-- in the Driver's list) as the base group and generate the base golden output
+-- from it. For any other group, if the output differs from the base one we
+-- generate a group-specific output file (`xxx.<group>.out`). During testing
+-- we prefer those group-specific outputs to the base ones.
+data Outputs = Outputs
+  { outGenerated :: FilePath
+      -- ^ generated output
+  , outGoldenBase :: FilePath
+      -- ^ base golden output
+  , outGoldenGroup :: FilePath
+      -- ^ golden output for this group (can be same as base)
+  }
+
+-- | Run one test and check the *.out files against the golden *.out files.
+executeTest
+  :: Config
+  -> Driver opts
+  -> opts
+  -> String  -- ^ group which produces the base golden output ('outGoldenBase')
+  -> String  -- ^ current group
+  -> (Outputs -> IO Result)  -- ^ compare or overwrite golden outputs
+  -> FilePath
+  -> IO Result
+executeTest cfg driver driverOpts base_group group diff subdir =
+  with_outdir $ \outdir -> do
+  let test = TestConfig
+        { testRepo =
+            let hash = map (\c -> if c == '/' then '_' else c) subdir
+            in Repo "test" (if null hash then "0" else Text.pack hash)
+        , testOutput =
+            outdir </> (if null group then id else (group </>)) subdir
+        , testRoot = cfgRoot cfg </> subdir
+        , testProjectRoot = cfgProjectRoot cfg
+        , testGroup = group
+        , testSchema = cfgSchema cfg
+        }
+  createDirectoryIfMissing True $ testOutput test
+  outputs <- runTest driver driverOpts (cfgRoot cfg) test
+  compareOutputs test diff base_group group outputs
+  where
+    with_outdir f = case cfgOutput cfg of
+      Just dir -> f dir
+      Nothing -> withSystemTempDirectory "glean-regression" f
+
+compareOutputs
+  :: TestConfig
+  -> (Outputs -> IO Result)  -- ^ compare or overwrite golden outputs
+  -> String
+  -> String
+  -> [FilePath]
+  -> IO Result
+compareOutputs test diff base_group group outputs = do
+  fmap mconcat $ forM outputs $ \output -> do
+    let base = testRoot test </> takeFileName output
+        specific
+          | group == base_group = base
+          | otherwise = outputFileForGroup base group
+    diff Outputs
+      { outGenerated = output
+      , outGoldenBase = base
+      , outGoldenGroup = specific
+      }
+
+outputFileForGroup :: FilePath -> String -> FilePath
+outputFileForGroup base group = addExtension (stem <.> group) ext
+  where (stem,ext) = splitExtension base
+
+-- | Regenerate golden outputs. Do nothing if 'outGoldenBase' exists and is the
+-- same as 'outGenerated'. Otherwise, copy 'outGenerated' to 'outGoldenGroup'
+-- (which might be the same as 'outGoldenBase').
+regenerate :: Outputs -> IO Result
+regenerate Outputs{..} = do
+  base <- do
+    ex <- doesFileExist outGoldenBase
+    if ex
+      then Just <$> BS.readFile outGoldenBase
+      else return Nothing
+  generated <- BS.readFile outGenerated
+  -- this will either overwrite base or generate a group-specific output
+  when (base /= Just generated) $ BS.writeFile outGoldenGroup generated
+  return (Success [outGoldenGroup])
+
+-- | Compare the generated output with the appropriate golden output via `diff`.
+-- This uses 'outGoldenGroup' if it exists and 'outGoldenBase' otherwise.
+diff :: Outputs -> IO Result
+diff Outputs{..} = do
+  spec <- doesFileExist outGoldenGroup
+  (e, sout, serr) <- readProcessWithExitCode
+    "diff"
+    [outGenerated, if spec then outGoldenGroup else outGoldenBase]
+    ""
+  return $ case e of
+    ExitSuccess -> Success []
+    ExitFailure n -> failure
+      $ takeFileName outGenerated ++
+        if n == 1
+          then ": unexpected result\n" ++ sout
+          else ": fatal error\n" ++ serr
+
+-- | Convert a 'Driver' into a regression test over --root parameter.
+--
+--  Normal mode: find all /testRoot/*/*/ directories and run all tests.
+--
+-- With --replace : find all /testRoot/*/*/ directories and update all golden
+-- *.out files.
+testMain :: Driver opts -> IO ()
+testMain driver = do
+  let parse = indexerOptParser (driverIndexer driver)
+  withUnitTestOptions (optionsWith parse) $ \act (mk_cfg, indexerOpts) -> do
+    cfg <- mk_cfg
+    testAll act cfg driver indexerOpts
+
+
+testAll :: TestAction -> Config -> Driver opts -> opts -> IO ()
+testAll act cfg driver opts = do
+  tests' <- if null $ cfgTests cfg
+    then discoverTests $ cfgRoot cfg
+    else return $ cfgTests cfg
+
+  when (null tests') $
+    die $ "No .out files found under " <> cfgRoot cfg
+
+  let tests = filter (`notElem` cfgOmitTests cfg) tests'
+
+  let groups
+        | null fromDriver = [""]
+        | otherwise = fromDriver
+        where fromDriver = driverGroups driver opts
+
+  case cfgReplace cfg of
+    Just root ->
+      let cfg' = cfg { cfgRoot = root }
+      in
+      testRunnerAction act $
+        HUnit.TestList $ flip map tests $ \subdir ->
+          HUnit.TestLabel subdir $ HUnit.TestCase $ do
+            -- With --replace, we have to run all groups serially,
+            -- because if we run them in parallel then it would be
+            -- non-deterministic whether we overwrite the output file
+            -- for the base group or a specific group.  Also we
+            -- wouldn't know which files we can remove in
+            -- removeNonRegenerated below.
+            result <- mconcat $ flip map groups $ \g ->
+              executeTest cfg' driver opts (head groups) g regenerate subdir
+            removeNonRegenerated root subdir result
+            toHUnit result
+
+    Nothing ->
+      testRunnerAction act $
+        HUnit.TestList $ flip map groups $ \g ->
+          (if null g then id else HUnit.TestLabel g) $
+            HUnit.TestList $ flip map tests $ \subdir ->
+              HUnit.TestLabel subdir $ HUnit.TestCase $
+                executeTest cfg driver opts (head groups) g diff subdir
+                  >>= toHUnit
+
+  where
+      -- clean-up .out or .perf files which weren't regenerated
+      -- for instance, if a .query file was removed.
+      removeNonRegenerated _ _ Failure{} = return ()
+      removeNonRegenerated root test (Success regenerated) = do
+          let path = root </> test
+          allFiles <- listDirectory path
+          let allOutFiles = filter
+                (\x -> takeExtension x == ".out" || takeExtension x == ".perf")
+                ((path </>) <$> allFiles)
+          let toDelete = filter (`notElem` regenerated) allOutFiles
+          when (not (null toDelete)) $
+            logInfo $ "Removing output files that were not regenerated: " <>
+              intercalate "," toDelete
+          mapM_ removePathForcibly toDelete
diff --git a/glean/test/regression/Glean/Regression/Snapshot/Driver.hs b/glean/test/regression/Glean/Regression/Snapshot/Driver.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot/Driver.hs
@@ -0,0 +1,71 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Snapshot.Driver
+  ( Driver(..)
+  , driverFromIndexer
+  , externalDriver
+  , defaultCreateDatabase
+  ) where
+
+import System.Exit
+
+import Glean
+import Glean.LocalOrRemote
+import Glean.Indexer
+import Glean.Indexer.External
+import Glean.Regression.Config
+import Glean.Regression.Indexer
+import Glean.Regression.Snapshot.Transform
+import Glean.Util.Some
+
+-- | A test driver describes how to run a set of tests. It is passed to
+-- 'Glean.Regression.Snapshot.testMain' to make a complete test executable.
+data Driver opts = Driver
+  { driverIndexer :: Indexer opts
+      -- ^ test data generator, for a given test group
+  , driverGroups :: opts -> [Group]
+      -- ^ groups - Test will be executed once for each group, with
+      -- 'testGroup' set appropriately. If empty, test will be
+      -- executed once with 'testGroup' set to "".
+  , driverTransforms :: Transforms
+      -- ^ Additional query result transformers.
+  , driverCreateDatabase :: CreateDatabase opts
+      -- ^ How to create a DB for this driver
+  }
+
+type CreateDatabase opts
+  = opts
+  -> Some LocalOrRemote
+  -> (opts -> RunIndexer)
+  -> TestConfig
+  -> IO ()
+
+type Group = String
+
+defaultCreateDatabase :: CreateDatabase opts
+defaultCreateDatabase opts backend indexer test = do
+  let repo = testRepo test
+  fillDatabase backend repo Nothing (die "repo already exists") $
+    runIndexerForTest backend (indexer opts) test
+
+driverFromIndexer :: Indexer opts -> Driver opts
+driverFromIndexer indexer = Driver
+  { driverIndexer = indexer
+  , driverGroups = const []
+  , driverTransforms = mempty
+  , driverCreateDatabase = defaultCreateDatabase
+  }
+
+-- | A 'Driver' using an external 'Indexer'. See
+-- "Glean.Indexer.External".
+--
+-- This driver doesn't support multiple groups; that could be added if
+-- necessary.
+externalDriver :: Driver Ext
+externalDriver = driverFromIndexer externalIndexer
diff --git a/glean/test/regression/Glean/Regression/Snapshot/Options.hs b/glean/test/regression/Glean/Regression/Snapshot/Options.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot/Options.hs
@@ -0,0 +1,150 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE CPP #-}
+module Glean.Regression.Snapshot.Options
+  ( Config(..)
+  , options
+  , optionsWith
+  ) where
+
+import qualified Options.Applicative as O
+import System.Directory
+import System.FilePath
+
+#if !defined(OSS)
+import Control.Monad (unless)
+import System.Process (readProcess)
+import Data.List (isPrefixOf, isSuffixOf)
+#endif
+
+data Config = Config
+  { cfgProjectRoot :: FilePath
+    -- ^ path to root of source tree
+  , cfgRoot :: FilePath
+    -- ^ parent path of all sources, *.query, golden *.out
+  , cfgOutput :: Maybe FilePath
+    -- ^ parent path of *.query results
+  , cfgReplace :: Maybe FilePath
+    -- ^ when True overwrite golden *.out with query result
+  , cfgSchema :: Maybe FilePath
+    -- ^ Schema directory
+  , cfgTests :: [String]
+    -- ^ specific directories of tests we want to run (ignoring other
+    --   directories)
+  , cfgOmitTests :: [String]
+    -- ^ specific directories of tests we don't want to run
+  } deriving Show
+
+options :: O.ParserInfo (IO Config)
+options = fst <$> optionsWith (pure ())
+
+optionsWith :: O.Parser a -> O.ParserInfo (IO Config,a)
+optionsWith other = O.info (O.helper <*> ((,) <$> parser <*> other)) O.fullDesc
+  where
+    parser = do
+      cfgProjectRoot <- O.strOption
+        $ O.long "project-root" <> O.metavar "PATH" <> O.value ""
+      cfgRoot <- O.strOption $ O.long "root" <> O.metavar "PATH"
+      cfgOutput <- O.optional $ O.strOption $
+        O.short 'o' <> O.long "output" <> O.metavar "PATH"
+      cfgReplace <- O.optional $ O.strOption $
+        O.long "replace" <> O.metavar "PATH" <>
+        O.help "Generate (overwrite) golden *.out files instead of testing"
+      replaceAll <- O.switch $
+        O.long "replace-all" <>
+        O.help "Generate (overwrite) all golden *.out files instead of testing"
+      cfgSchema <- O.optional $ O.strOption $
+        O.long "schema" <>
+        O.help "Directory containing schema source files"
+      cfgTests <- O.many $ O.strOption $
+        O.long "only" <> O.metavar "DIR" <>
+        O.help "Run tests from DIR only"
+      cfgOmitTests <- O.many $ O.strOption $
+        O.long "omit" <> O.metavar "DIR" <>
+        O.help "Do not run tests from DIR"
+      return $ resolve replaceAll Config{..}
+
+    resolve replaceAll cfg@Config{..} = do
+      projectRoot <- if null cfgProjectRoot
+        then getCurrentDirectory
+        else makeAbsolute cfgProjectRoot
+      -- We do `equalFilePath root` in the code that searches for test cases,
+      -- which requires `canonicalizePath` for correctness
+      root <- canonicalizePath cfgRoot
+      replace <-
+        if replaceAll
+        then do
+#if OSS
+          src <- pure (cfgProjectRoot </> root)
+#else
+          src <- sourcePath root
+#endif
+          putStrLn src
+          return (Just src)
+        else mapM makeAbsolute cfgReplace
+      return $ cfg {
+        cfgProjectRoot = projectRoot,
+        cfgRoot = root,
+        cfgReplace = replace
+      }
+
+#if !defined(OSS)
+-- | Simple heuristics to get the path of the source files
+-- from the buck-out path. Will take a path like
+--
+--   /data/users/unixname/fbsource/buck-out/v2/gen/fbcode/e1b1d0a81b509819/glean/facebook/tools/diff-sketch/test/__hack-sources__/hack-sources/hack
+--
+--  and transform it into
+--
+--   /data/users/unixname/fbsource/fbcode/glean/facebook/tools/diff-sketch/test/hack
+--
+sourcePath :: FilePath -> IO FilePath
+sourcePath path = do
+  root <- head . lines <$> readProcess "buck" ["root"] ""
+  let
+    sourcePath = root </> path'
+
+    path' = joinPath
+      $ removeBuckFileGroup
+      $ dropWhile (/= "glean") -- drop hash
+      $ go (splitDirectories root) (splitDirectories path)
+  exists <- doesDirectoryExist sourcePath
+  putStrLn $ unlines
+    [ "sourcePath: "
+    , sourcePath
+    , path
+    ]
+  unless exists $
+    error $ unlines
+     [ "Unable to find tests path."
+     , "Expected to find it in: " <> sourcePath
+     , "Specify it with --replace PATH"
+     ]
+  return sourcePath
+  where
+    -- A buck file_group target will add two directories with the name
+    -- of the target to the path. The first one will be surrounded by
+    -- double underscores. i.e. ../__dir__/dir/..
+    removeBuckFileGroup p = xs ++ drop 2 ys
+      where
+        (xs, ys) = break isBuckFileGroupDir p
+
+        isBuckFileGroupDir = isSurroundedBy "__"
+        isSurroundedBy term str =
+          term `isPrefixOf` str &&
+          term `isSuffixOf` str
+
+    go [] ys = ys
+    go _  [] = error "test path is not a subdirectory of root"
+    go (x:xs) (y:ys) =
+      if x == y
+      then go xs ys
+      else go (x:xs) ys
+#endif
diff --git a/glean/test/regression/Glean/Regression/Snapshot/Query.hs b/glean/test/regression/Glean/Regression/Snapshot/Query.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot/Query.hs
@@ -0,0 +1,155 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Snapshot.Query (runQuery) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.IO.Class (liftIO)
+import qualified Data.Aeson as Aeson
+import qualified Data.ByteString.UTF8 as UTF8
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.Maybe
+import qualified Data.Map as Map
+import Data.Ord
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import Compat.Prettyprinter (pretty)
+import qualified Data.Yaml as Yaml
+import System.Exit
+import qualified Text.JSON as JSON
+import qualified Data.Vector as Vector
+
+import Util.JSON.Pretty ()
+
+import qualified Glean
+import qualified Glean.Types as Thrift
+import Glean.Regression.Snapshot.Transform
+
+newtype TQ = TQ { fromTQ :: [(Text, Aeson.Value)] }
+
+instance Aeson.FromJSON TQ where
+  parseJSON = Aeson.withArray "transform" $ go [] . Vector.toList
+    where
+      go ts [] = return $ TQ $ reverse ts
+      go ts (Aeson.String s : v : xs) = go ((s,v) : ts) xs
+      go _ _ = fail "invalid transform"
+
+data Query = Query
+  { queryText :: UTF8.ByteString
+  , queryRecursive :: Bool
+  , queryPerf :: Bool
+    -- ^ Also gather performance results, compare against test.perf
+  , queryMaxResults :: Maybe Int
+  , queryTransforms :: TQ
+  , queryDerive :: Bool
+  }
+
+instance Aeson.FromJSON Query where
+  parseJSON = Aeson.withObject "query" $ \v -> do
+    queryText <- Text.encodeUtf8 <$> v Aeson..: "query"
+    queryRecursive <- v Aeson..:! "recursive" Aeson..!= True
+    queryPerf <- v Aeson..:! "perf" Aeson..!= False
+    queryMaxResults <- v Aeson..:! "max_results"
+    queryTransforms <- v Aeson..:! "transform" Aeson..!= TQ []
+    queryDerive <- v Aeson..:! "derive" Aeson..!= False
+    return Query{..}
+
+runQuery
+  :: Glean.Backend e => e
+  -> Thrift.Repo
+  -> Transforms
+  -> FilePath
+  -> IO (
+    String, -- The results as transformed, pretty-printed JSON
+    Maybe String -- Query performance stats, also pretty-printed JSON
+  )
+runQuery backend repo xforms qfile =
+  handle (\(Glean.BadQuery b) -> throwIO $ Glean.BadQuery ("in " <> Text.pack qfile <> ": " <> b)) $ do
+  r <- Yaml.decodeFileEither qfile
+  case r of
+    Left err -> die
+      $ qfile ++ ": invalid query - " ++ Yaml.prettyPrintParseException err
+    Right Query{..} -> do
+      transform <-
+        fmap (foldl' (.) id) $ mapM getTransform $ fromTQ queryTransforms
+      let mkQuery k cont = def
+            { Thrift.userQuery_query = queryText
+            , Thrift.userQuery_options = Just def
+                { Thrift.userQueryOptions_no_base64_binary = True
+                , Thrift.userQueryOptions_syntax = Thrift.QuerySyntax_ANGLE
+                , Thrift.userQueryOptions_expand_results = True
+                , Thrift.userQueryOptions_recursive = queryRecursive
+                , Thrift.userQueryOptions_max_results = fromIntegral <$> k
+                , Thrift.userQueryOptions_continuation = cont
+                , Thrift.userQueryOptions_collect_facts_searched = queryPerf
+                , Thrift.userQueryOptions_store_derived_facts = queryDerive
+                }
+            }
+
+          collect acc perf k cont = do
+            res <- liftIO $ Glean.userQuery backend repo $ mkQuery k cont
+            let facts = Thrift.userQueryResults_facts res
+                remaining = subtract (length facts) <$> k
+                perf' = perf <> Thrift.userQueryResults_stats res
+            if isJust cont && maybe True (>0) remaining
+              then collect (facts ++ acc) perf' remaining cont
+              else return (facts ++ acc, perf')
+
+      (facts, perf) <- collect [] Nothing queryMaxResults Nothing
+
+      let generatedTag = '@':"generated"
+
+      perfString <- if queryPerf
+        then do
+          Thrift.SchemaInfo{..} <- Glean.getSchemaInfo backend (Just repo)
+            def { Thrift.getSchemaInfo_omit_source = True }
+          return $ Just $ show $ pretty $ JSON.JSObject $ JSON.toJSObject
+            [ (generatedTag, JSON.JSNull)
+            , ("facts_searched", JSON.JSObject $ JSON.toJSObject $
+              sortBy (comparing fst)
+                [ (show (pretty pred), JSON.JSRational False (fromIntegral n))
+                | Just facts <- [Thrift.userQueryStats_facts_searched =<< perf]
+                , (pid,n) <- Map.toList facts
+                , Just pred <- [Map.lookup pid schemaInfo_predicateIds]
+                ])
+            , ("full_scans", JSON.JSArray $ sort $
+                [ JSON.JSString $ JSON.toJSString $ show (pretty pred)
+                | Just scans <- [Thrift.userQueryStats_full_scans <$> perf]
+                , pred <- scans
+                ])
+            ]
+        else
+          return Nothing
+
+      resultString <- fmap
+        (show
+          . pretty
+          . JSON.JSArray
+          . (JSON.JSString (JSON.toJSString generatedTag) :)
+          . transform
+          . map nukeIds)
+        $ forM facts $ \fact -> case JSON.decode (UTF8.toString fact) of
+          JSON.Error err -> die $ "invalid fact in response: " ++ err
+          JSON.Ok (value :: JSON.JSValue) -> return value
+
+      return (resultString, perfString)
+
+  where
+    getTransform (name, arg)
+      | Just (Transform f) <- HashMap.lookup name xforms =
+          case Aeson.fromJSON arg of
+            Aeson.Success x -> return $ f x
+            Aeson.Error msg ->
+              die $
+                "invalid argument to transform '" ++ Text.unpack name ++ "': "
+                ++ msg
+      | otherwise = die $ "unknown transform '" ++ Text.unpack name ++ "'"
diff --git a/glean/test/regression/Glean/Regression/Snapshot/Result.hs b/glean/test/regression/Glean/Regression/Snapshot/Result.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot/Result.hs
@@ -0,0 +1,34 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Snapshot.Result
+  ( Result(..), failure, toHUnit
+  ) where
+
+import qualified Test.HUnit as HUnit
+
+data Result
+  = Success [FilePath]
+  | Failure ([String] -> [String])
+
+instance Semigroup Result where
+  Success paths1 <> Success paths2 = Success (paths1 ++ paths2)
+  Success _ <> x = x
+  x <> Success _ = x
+  Failure f <> Failure g = Failure $ f . g
+
+failure :: String -> Result
+failure s = Failure (s:)
+
+instance Monoid Result where
+  mempty = Success []
+
+-- | Use a 'Result' in a 'Test'
+toHUnit :: Result -> HUnit.Assertion
+toHUnit Success{} = return ()
+toHUnit (Failure msg) = HUnit.assertFailure $ unlines $ msg []
diff --git a/glean/test/regression/Glean/Regression/Snapshot/Transform.hs b/glean/test/regression/Glean/Regression/Snapshot/Transform.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Snapshot/Transform.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Regression.Snapshot.Transform
+  ( Transform(..)
+  , Transforms
+  , defaultTransforms
+  , nukeIds
+  ) where
+
+import qualified Data.Aeson as Aeson
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Text.JSON as JSON
+
+data Transform = forall a. Aeson.FromJSON a => Transform
+  (a -> [JSON.JSValue] -> [JSON.JSValue])
+
+type Transforms = HashMap Text Transform
+
+defaultTransforms :: Transforms
+defaultTransforms = HashMap.fromList
+  [ ("sort", Transform sortFactsBy)
+  , ("gensort", Transform sortFacts)
+  , ("extract", Transform extract)
+  , ("normord", Transform normOrd)
+  ]
+
+extract :: [Text] -> [JSON.JSValue] -> [JSON.JSValue]
+extract path = map (`select` path)
+
+sortFacts :: () -> [JSON.JSValue] -> [JSON.JSValue]
+sortFacts _ = sort
+
+sortFactsBy :: [[Text]] -> [JSON.JSValue] -> [JSON.JSValue]
+sortFactsBy [] = id
+sortFactsBy paths = sortOn (\x -> map (select x) paths)
+
+-- | input JSValue is an object, take the key name from the head of
+-- the list, and recursively select to follow the path.
+select :: JSON.JSValue -> [Text] -> JSON.JSValue
+select = foldl' $ \v sel ->
+  case v of
+    JSON.JSObject o
+      | JSON.Ok field <- JSON.valFromObj (Text.unpack sel) o -> field
+      | otherwise -> error $ Text.unpack $ "missing field '" <> sel <> "'"
+    _ -> error $ Text.unpack
+      $ "can't select '" <> sel <> "' from a non-object"
+
+normOrd :: () -> [JSON.JSValue] -> [JSON.JSValue]
+normOrd _ = sort . map norm
+  where
+    norm j = case j of
+      JSON.JSNull -> j
+      JSON.JSBool{} -> j
+      JSON.JSRational{} -> j
+      JSON.JSString{} -> j
+      JSON.JSArray v -> JSON.JSArray $ sort $ map norm v
+      JSON.JSObject o -> JSON.JSObject $ JSON.toJSObject $
+        sort $ map (fmap norm) $ JSON.fromJSObject o
+
+nukeIds :: JSON.JSValue -> JSON.JSValue
+nukeIds (JSON.JSArray xs) = JSON.JSArray $ map nukeIds xs
+nukeIds (JSON.JSObject xs) = JSON.JSObject $ JSON.toJSObject
+  [(s, nukeIds v) | (s,v) <- JSON.fromJSObject xs, keep s v]
+  where
+    keep "id" JSON.JSRational{} =
+      any ((`notElem` ["id","key","value"]) . fst)
+      $ JSON.fromJSObject xs
+    keep _ _ = True
+nukeIds x = x
diff --git a/glean/test/regression/Glean/Regression/Test.hs b/glean/test/regression/Glean/Regression/Test.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/regression/Glean/Regression/Test.hs
@@ -0,0 +1,169 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+
+-- | Library for running an indexer and running unit tests on the
+-- resulting Repo.
+module Glean.Regression.Test
+  ( -- * your test code
+    TestIndex
+    -- * make your main
+  , mainTestIndex
+  , mainTestIndexExternal
+  , mainTestIndexGeneric
+  , mainTestIndexXlang
+  ) where
+
+import Foreign.Marshal.Utils
+import qualified Data.Text as Text
+import Options.Applicative
+import System.FilePath
+import System.IO.Temp
+import Test.HUnit
+import TestRunner
+import Util.IO
+
+import Glean
+import Glean.LocalOrRemote
+import Glean.Indexer
+import Glean.Init (withUnitTestOptions)
+import Glean.Regression.Config
+import Glean.Regression.Indexer
+import Glean.Regression.Snapshot.Driver
+import Glean.Regression.Snapshot.Options
+import Glean.Util.Some (Some(..))
+
+type TestIndex = IO (Some LocalOrRemote, Repo) -> Test
+
+withOutputDir :: String -> Maybe FilePath -> (FilePath -> IO a) -> IO a
+withOutputDir _dir (Just output) act = act output
+withOutputDir dir Nothing act = withSystemTempDirectory dir act
+
+-- | Run a test with an arbitrary indexer
+mainTestIndex
+  :: String -- ^ just a string to identify this test
+  -> Indexer opts
+  -> TestIndex
+  -> IO ()
+mainTestIndex dir indexer testIndex =
+  mainTestIndexGeneric
+    (driverFromIndexer indexer)
+    (pure ())
+    dir
+    (\_ _ _ _ -> testIndex)
+
+-- | Run a test with an external indexer
+mainTestIndexExternal
+  :: String -- ^ just a string to identify this test
+  -> TestIndex
+  -> IO ()
+mainTestIndexExternal dir testIndex =
+  mainTestIndexGeneric externalDriver (pure ()) dir (\_ _ _ _ -> testIndex)
+
+createTestConfig :: Text.Text -> String -> String -> Config -> TestConfig
+createTestConfig repo group outDir cfg =
+   TestConfig
+      { testRepo = Repo repo (Text.pack group)
+      , testOutput = if null group
+          then outDir
+          else outDir </> group
+      , testRoot = cfgRoot cfg
+      , testProjectRoot = cfgProjectRoot cfg
+      , testGroup = group
+      , testSchema = cfgSchema cfg
+      }
+
+-- | Run a test with an arbitrary indexer
+mainTestIndexGeneric
+  :: Driver driverOpts
+  -> Parser extraOpts -- ^ parser for extra options to recognise
+  -> String -- ^ just a string to identify this test
+  -> (extraOpts -> driverOpts -> Config -> TestConfig -> TestIndex)
+  -> IO ()
+mainTestIndexGeneric driver extraOptParser dir testIndex = do
+  let
+    indexer = driverIndexer driver
+    parse = (,) <$> indexerOptParser indexer <*> extraOptParser
+  withUnitTestOptions (optionsWith parse) $
+          \ action (mkcfg, (driverOpts, extraOpts)) -> do
+    -- TODO: we're using the options for snapshot tests which have a
+    -- couple of flags that don't make sense here: --replace for
+    -- example.
+    cfg <- mkcfg
+    let
+      theGroups = driverGroups driver driverOpts
+      (platforms, mkLabel) = if null theGroups
+          then (["testhash"], const dir)
+          else (theGroups, \group -> dir <> " : " <> group)
+    withOutputDir dir (cfgOutput cfg) $ \ outDir -> do
+      let
+        withPlatformTest :: String -> (Test -> IO a) -> IO a
+        withPlatformTest platform fn = do
+          let testConfig = createTestConfig "test" platform outDir cfg
+              withSetup :: ((Some LocalOrRemote, Repo) -> IO a) -> IO a
+              withSetup f =
+                withTestBackend testConfig $ \backend -> do
+                  driverCreateDatabase driver driverOpts backend
+                    (indexerRun indexer) testConfig
+                  f (backend, testRepo testConfig)
+
+          withLazy withSetup $ \get ->
+            fn $ TestLabel (mkLabel platform) $
+              testIndex extraOpts driverOpts cfg testConfig get
+
+      withMany withPlatformTest platforms $ \tests ->
+        testRunnerAction action (TestList tests)
+
+-- | Run a test which runs two indexers, the one in the driver
+--   plus an extra one
+mainTestIndexXlang
+  :: (Driver driverOpts, Text.Text) -- ^ Driver and name of db to be created
+  -> (Indexer opts, Text.Text) -- ^ Indexer and name of db to be created
+  -> String -- ^ just a string to identify this test
+  -> TestIndex
+  -> IO ()
+mainTestIndexXlang
+  (driver, repoName) (indexer', repoName') dir testIndex = do
+  let
+    indexer = driverIndexer driver
+    parse = (,) <$> indexerOptParser indexer <*> indexerOptParser indexer'
+  withUnitTestOptions (optionsWith parse) $
+          \ action (mkcfg, (driverOpts, driverOpts')) -> do
+    -- TODO: we're using the options for snapshot tests which have a
+    -- couple of flags that don't make sense here: --replace for
+    -- example.
+    cfg <- mkcfg
+    let
+      -- We ignore groups of second driver
+      theGroups = driverGroups driver driverOpts
+      (platforms, mkLabel) = if null theGroups
+          then (["testhash"], const dir)
+          else (theGroups, \group -> dir <> " : " <> group)
+    withOutputDir dir (cfgOutput cfg) $ \ outDir -> do
+      let
+        withPlatformTest :: String -> (Test -> IO a) -> IO a
+        withPlatformTest platform fn = do
+          let testConfig = createTestConfig repoName platform outDir cfg
+              testConfig' = testConfig {
+                testRepo = Repo repoName' (Text.pack platform)
+              }
+              withSetup :: ((Some LocalOrRemote, Repo) -> IO a) -> IO a
+              withSetup f =
+                withTestBackend testConfig $ \backend -> do
+                  driverCreateDatabase driver driverOpts backend
+                    (indexerRun indexer) testConfig
+                  defaultCreateDatabase driverOpts' backend
+                    (indexerRun indexer') testConfig'
+                  f (backend, testRepo testConfig')
+
+          withLazy withSetup $ \get ->
+            fn $ TestLabel (mkLabel platform) $ testIndex get
+
+      withMany withPlatformTest platforms $ \tests ->
+        testRunnerAction action (TestList tests)
diff --git a/glean/test/tests/Angle/AngleTest.hs b/glean/test/tests/Angle/AngleTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/AngleTest.hs
@@ -0,0 +1,1055 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.AngleTest (main) where
+
+import Control.Exception
+import Data.Default
+import Data.List
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Word (Word8)
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.Builtin.Types as Builtin
+import qualified Glean.Schema.Sys.Types as Sys
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Typed hiding (end)
+import Glean.Types
+
+import TestData
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "angle" $ angleTest dbTestCase id
+  , TestLabel "angle/page" $ angleTest dbTestCase (limit 1)
+  , TestLabel "angleDot" $ angleDotTest dbTestCase
+  , TestLabel "angleNegation" $ angleNegationTest dbTestCase id
+  , TestLabel "angleNegation/page" $ angleNegationTest dbTestCase (limit 1)
+  , TestLabel "angleIfThenElse" $ angleIfThenElse dbTestCase id
+  , TestLabel "angleIfThenElse/page" $ angleIfThenElse dbTestCase (limit 1)
+  , TestLabel "angleTypeTest" $ angleTypeTest dbTestCase
+  ]
+
+ignorePredK :: Glean.Test.KitchenSink -> Glean.Test.KitchenSink
+ignorePredK k = k {
+  Glean.Test.kitchenSink_pred = def,
+  Glean.Test.kitchenSink_sum_ = def }
+
+angleTest :: (WithDB () -> Test) -> (forall a . Query a -> Query a) -> Test
+angleTest dbTestCase modify = dbTestCase $ \env repo -> do
+  -- match zero results
+  results <- runQuery_ env repo $ modify $ angle @Sys.Blob
+    [s|
+      sys.Blob "nomatch"
+    |]
+  print results
+  assertEqual "no results" results []
+
+  -- match all results (one)
+  results <- runQuery_ env repo $ modify $ angle @Sys.Blob
+    [s|
+      sys.Blob "hello"
+    |]
+  print results
+  sysBlobId <-
+    case results of
+      [Sys.Blob{..}] -> return blob_id
+      _ -> assertFailure "angle - sys.Blob"
+
+  -- query that matches everything
+  results <- runQuery_ env repo $ modify $ angle @Sys.Blob
+    [s|
+      sys.Blob _
+    |]
+  print results
+  assertBool "angle - sys.Blob match all" $ length results == 2
+
+  -- match one result of many
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+       glean.test.Predicate { named_sum_ = { tue = 37 } }
+    |]
+  print results
+  case results of
+    [Glean.Test.Predicate{Glean.Test.predicate_key = Just k}] ->
+      assertEqual "angle - glean.test.Predicate 1"
+        (ignorePredK kitchenSink1) (ignorePredK k)
+    _ -> assertBool "angle - glean.test.Predicate 1" False
+
+  -- match all results (two)
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+       glean.test.Predicate _
+    |]
+  print results
+  assertEqual "angle - glean.test.Predicate 2" 4 (length results)
+
+  -- match one nested pattern
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      Blob = sys.Blob "hello";
+      glean.test.Predicate { pred = Blob }
+    |]
+  print results
+  assertBool "angle - glean.test.Predicate nested pattern" $
+    let correct Glean.Test.Predicate { predicate_key = Just key }
+          = Sys.blob_id (Glean.Test.kitchenSink_pred key) == sysBlobId
+        correct _ = False
+    in not (null results) && all correct results
+
+  -- match a maybe that's missing
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { maybe_ = nothing }
+    |]
+  print results
+  assertEqual "angle - maybe = nothing" 3 (length results)
+
+  -- match a maybe that's present
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { maybe_ = { just = _ } }
+    |]
+  print results
+  assertEqual "angle - maybe = just" 1 (length results)
+
+  -- match multiple alternatives of a sum type.
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      Blob = sys.Blob "hello";
+      T1 = glean.test.Predicate { sum_ = { d = Blob } };
+      T1 | glean.test.Predicate { sum_ = { c = T1 } }
+    |]
+  print results
+  assertBool "angle - sum - multiple alts" $
+    case results of
+      [_one, _two, _three, _four] -> True
+      _ -> False
+
+  -- sum type: one branch matches nothing
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      ( Blob = sys.Blob "hello";
+        glean.test.Predicate { sum_ = { d = Blob } } ) |
+      ( X = glean.test.Predicate { sum_ = d } |
+             ( Y = glean.test.Predicate { nat = 99 };
+               glean.test.Predicate { sum_ = { c = Y } } );
+        glean.test.Predicate { sum_ = { c = X } }
+      )
+    |]
+  print results
+  assertBool "angle - sum - one branch matches nothing" $
+    case results of
+      [_one, _two, _three, _four] -> True
+      _ -> False
+
+  -- match mutliple alternatives of a sum type, with a refutable pattern
+  -- in one alternative.
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { sum_ = d } |
+      ( X = glean.test.Predicate { nat = 42 };
+        glean.test.Predicate { sum_ = { c = X } } )
+    |]
+  assertBool "angle - sum - multiple alts (refutable)" $
+    case results of
+      [_one, _two, _three] -> True
+      _ -> False
+
+  -- match an array
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { array_of_nat = [1,2] }
+    |]
+  assertEqual "angle - array - exact" 1 (length results)
+
+  -- match against a string
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { string_ = "Hello\u0000world!\u0000" }
+    |]
+  print results
+  assertEqual "angle - string" 1 (length results)
+
+  -- escaped characters (matches nothing, just testing parsing)
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { string_ = "!\\\"#$&'()*+,\n" }
+    |]
+  print results
+  assertBool "angle - string - escaped characters" $
+    null results
+
+  -- nested sum types (matches nothing, just testing parsing/typechecking)
+  results <- runQuery_ env repo $ modify $ angle @Cxx.TargetUses
+    [s|
+      N = cxx1.Name "initFacebook";
+      F = cxx1.FunctionName { name = N };
+      Q = cxx1.FunctionQName { name = F };
+      D = cxx1.FunctionDeclaration { name = Q };
+      cxx1.TargetUses { target = { declaration = { function_ = D }}, file = _ }
+    |]
+  assertBool "angle - nested sums" $ null results
+
+  -- support for patterns on the LHS of a statement
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.StringPair
+    [s|
+      P where P = glean.test.StringPair X; {_, "x"..} = X
+    |]
+  print results
+  assertEqual "angle - lhs patterns" 2 (length results)
+
+  -- key/value query
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.KeyValue
+    [s|
+      glean.test.KeyValue _ -> {24,_}
+    |]
+  print results
+  assertEqual "angle - key/value 1" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.KeyValue
+    [s|
+      glean.test.KeyValue { kstring = "hello" } -> { vstring = "world" }
+    |]
+  print results
+  assertEqual "angle - key/value 2" 1 (length results)
+
+  -- test matching a variable in the value
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.KeyValue
+    [s|
+      glean.test.KeyValue {"foo",X} -> {X,_}
+    |]
+  print results
+  assertEqual "angle - key/value 3" 1 (length results)
+
+  -- lhs pattern with a named record type & enum
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      P where
+      P = glean.test.Predicate { named_record_ = R, nat = 42 };
+      glean.test.Rec { alpha = red } = R
+    |]
+  print results
+  assertEqual "angle - typed pat" 1 (length results)
+
+  -- lhs pattern that doesn't match
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      P where
+      P = glean.test.Predicate { named_record_ = R };
+      glean.test.Rec { alpha = green } = R
+    |]
+  print results
+  assertEqual "angle - typed pat 2" 0 (length results)
+
+
+  -- unbound variable which can be resolved by adding a generator
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StringPairBox
+    [s|
+      glean.test.StringPairBox _
+    |]
+  print results
+  assertEqual "angle - resolvable unbound" 6 $
+    (length . nub . map Glean.Test.stringPairBox_key) results
+
+  -- another instance of an unbound variable: wildcard as a query
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StringPair
+      [s| _ : glean.test.StringPair |]
+  print results
+  assertEqual "angle - resolvable unbound 2" 6 $
+    (length . nub . map Glean.Test.stringPair_key) results
+
+  -- we should be able to resolve wildcards by adding a fact generator
+  -- (query has no results, but we're testing that it doesn't fail with
+  -- an unbound variable)
+  results <- runQuery_ env repo $ modify $
+    angleData @Glean.Test.EdgeSum
+    [s|
+      X where ( { fst = _ } | { snd = _ } ) = X : glean.test.EdgeSum
+    |]
+  assertEqual "angle - resolvable wildcard" 0 (length results)
+
+  -- matching bools
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { bool_ = true } |
+      glean.test.Predicate { bool_ = false }
+    |]
+  assertEqual "angle - bool" 4 (length results)
+
+  -- matching enums
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { enum_ = e }
+    |]
+  assertEqual "angle - enum" 4 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { enum_ = f }
+    |]
+  assertEqual "angle - enum 2" 0 (length results)
+
+  r <- runQuery_ env repo $ modify $ angleData @Byte
+    [s| ( 1 | 240 ) : byte |]
+    -- The Byte type uses signed Int8, because that's what Thrift uses.
+    -- But Angle bytes are unsigned. It turns out that `fromIntegral` does
+    -- the right thing here and doesn't touch the bit patterns.
+  assertEqual "angle - bytes" (sort [Byte 1, Byte (fromIntegral (240 :: Word8))]) (sort r)
+
+  -- test fact lookups
+  results <- runQuery_ env repo $ modify $ angle @Cxx.Name
+    [s|
+      N where
+      cxx1.FunctionName { name = N };  # for each FunctionName { name = N }
+      N = cxx1.Name "an"..         # lookup N and pattern match against "an"..
+    |]
+  print results
+  assertEqual "angle - lookup" 2 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.KeyValue
+    [s|
+      X where
+      X = glean.test.KeyValue _;
+      # lookup X and match its value
+      X = glean.test.KeyValue _ -> { vstring = "bar" }
+    |]
+  print results
+  assertEqual "angle - lookup 2" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      X where
+      glean.test.Predicate { sum_ = { c = X } };
+      X = glean.test.Predicate _
+    |]
+  print results
+  assertEqual "angle - lookup 3" 2 (length results)
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Node
+    [s|
+      N where
+      E = glean.test.Edge _;
+      E = glean.test.Edge { parent = N } # this is a lookup
+    |]
+  print r
+  assertBool "angle - lookup 4" (length r `elem` [3,4])
+    -- paging prevents de-duping and gives more results
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      P where
+      glean.test.RefRef R;
+      R = glean.test.Ref P
+    |]
+  print r
+  assertEqual "angle - lookup 5" 2 (length r)
+
+  -- Test literal fact Ids ($<predicate> <id>,2)
+  names <- runQuery_ env repo $ allFacts @Cxx.Name
+  let factId x = Text.pack (show (fromFid (idOf (getId x))))
+
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+      "$cxx1.Name " <> factId (head names)
+  assertEqual "angle - single fact id" 1 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+      "$" <> factId (head names) <> ": cxx1.Name"
+  assertEqual "angle - single fact id" 1 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+    "[" <>
+      Text.intercalate "," [ "$" <> factId x <> " : cxx1.Name" | x <- names ] <>
+    "] [..]"
+  assertEqual "angle - array of fact ids" (length names) (length r)
+
+  -- Literal fact ID with the wrong type
+  r <- try $ runQuery_ env repo $ modify $ angle @Cxx.FunctionName $
+      "$cxx1.FunctionName " <> factId (head names)
+  print r
+  assertBool "angle - fact id with wrong type" $
+    case r of
+      Left (SomeException x) -> "fact has the wrong type" `isInfixOf` show x
+        -- it's actually a GleanFFIError when running locally,
+        -- and probably a Thrift ApplicationError when running
+        -- remotely. It should really be a BadQuery though.
+      _ -> False
+
+  -- Test literal untyped fact Ids ($<id>)
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+    "[" <>
+      -- we have to help the typechecker by using a typed fact Id for
+      -- the first array element.
+      "$cxx1.Name " <> factId (head names) <> "," <>
+      Text.intercalate "," [ "$" <> factId x | x <- tail names ] <>
+    "] [..]"
+  assertEqual "angle - array of fact ids 2" (length names) (length r)
+
+  -- Test embedded or-patterns
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+    [s| cxx1.Name ("ab".. | "bl"..) |]
+  print r
+  assertEqual "angle - or-pattern 1" 4 (length r)
+
+  -- Test or-pattern on a statement lhs
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+    [s|
+      N where
+        N = cxx1.Name ("a"..X);
+        ("b".. | "n"..) = X
+    |]
+  print r
+  assertEqual "angle - or-pattern 2" 4 (length r)
+
+  -- Test or-pattern in a query head
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name $
+    [s|
+      N where
+        Y = ("a"..X | "b"..X where cxx1.Name ("a"..X));
+        N = cxx1.Name Y
+    |]
+  print r
+  assertEqual "angle - or-pattern 3" 6 (length r)
+
+  -- Test prim.toLower
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      prim.toLower "ABCabc123" |
+      # @lint-ignore-every TXT5
+      prim.toLower "\u0000\u0001ЖႠΓ"
+    |]
+  print r
+  assertEqual "angle - toLower" [ "abcabc123", "\0\1жⴀγ" ] r
+
+  -- Test prim.relToAbsByteSpans
+  r <- runQuery_ env repo $ modify $ angleData @[(Nat, Nat)]
+    [s|
+      prim.relToAbsByteSpans [] |
+      prim.relToAbsByteSpans [{1, 2}] |
+      prim.relToAbsByteSpans [{1, 2}, {4, 2}]
+    |]
+  print r
+  assertEqual "angle - relToAbsByteSpans"
+    [ [],
+      [(Nat 1, Nat 2)],
+      [(Nat 1, Nat 2), (Nat 5, Nat 2)]] r
+
+  -- Test prim.unpackByteSpans
+  r <- runQuery_ env repo $ modify $ angleData @[(Nat, Nat)]
+    [s|
+      prim.unpackByteSpans [] |
+      prim.unpackByteSpans [{2, [1]}] |
+      prim.unpackByteSpans [{2, [1, 4]}] |
+      prim.unpackByteSpans [{3, [1, 4]}, {2, [1]}, {3, [2, 4, 3]}]
+    |]
+  print r
+  assertEqual "angle - unpackByteSpans"
+    [ [],
+      [(Nat 1, Nat 2)],
+      [(Nat 1, Nat 2), (Nat 5, Nat 2)],
+      [(Nat 1, Nat 3), (Nat 5, Nat 3),
+       (Nat 6, Nat 2),
+       (Nat 8, Nat 3), (Nat 12, Nat 3), (Nat 15, Nat 3)] ] r
+
+  -- Test prim.reverse
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+        glean.test.Predicate {
+            string_ = X
+        } where
+        X = prim.reverse (prim.reverse X)
+    |]
+  print results
+  assertEqual "angle - string reverse" 4 (length results)
+
+  -- Test numeric comparison primitives
+  r <- runQuery_ env repo $ angleData @() "prim.gtNat 2 1"
+  print r
+  assertEqual "angle - gtNat 2 1" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "1 > 1"
+  print r
+  assertEqual "angle - 1 > 1" 0 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "prim.geNat 1 1"
+  print r
+  assertEqual "angle - geNat 1 1" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "1 >= 2"
+  print r
+  assertEqual "angle - 1 >= 2" 0 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "prim.ltNat 2 1"
+  print r
+  assertEqual "angle - prim.ltNat 2 1" 0 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "1 < 2"
+  print r
+  assertEqual "angle - 1 < 2" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "prim.leNat 1 2"
+  print r
+  assertEqual "angle - prim.leNat 1 2" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "2 <= 1"
+  print r
+  assertEqual "angle - 2 <= 1" 0 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "prim.neNat 1 2"
+  print r
+  assertEqual "angle - prim.neNat 1 2" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "1 !== 1"
+  print r
+  assertEqual "angle - 1 !== 1" 0 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    [s|
+      P where
+        P = glean.test.Predicate { nat = N };
+        N !== 2
+    |]
+  print r
+  assertEqual "angle - N !== 2 in predicate" 4 (length r)
+
+  r <- runQuery_ env repo $ angleData @() "\"a\" != \"b\""
+  print r
+  assertEqual "angle - inequality - \"a\" != \"b\"" 1 (length r)
+
+  r <- runQuery_ env repo $ modify $
+    angleData @(Glean.Test.KitchenSink, Glean.Test.KitchenSink)
+    [s|
+      { A, B } where
+        glean.test.Predicate A;
+        glean.test.Predicate B;
+        A != B;
+    |]
+  print r
+  all <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+    "glean.test.Predicate _;"
+  let uniques = length all
+      uniquePairs = uniques * (uniques - 1)
+  assertEqual "angle - inequality - type != type" uniquePairs (length r)
+
+  r <- runQuery_ env repo $ angleData @Nat "prim.addNat 23 31"
+  print r
+  assertEqual "angle - prim.addNat 23 31" [54] (map unNat r)
+
+  r <- runQuery_ env repo $ angleData @Builtin.Unit "1 + 2 + 3 < 4 + 5"
+  print r
+  assertEqual "angle - 1 + 2 + 3 < 4 + 5" 1 (length r)
+
+  -- Test rename
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      X = "a" | (X where cxx1.Name X)
+    |]
+  print r
+  assertEqual "angle - rename" 12 (length r)
+
+  -- Test for paging with repeated facts. This exposed a bug at one point.
+  r <- runQuery_ env repo $ modify $ angle @Cxx.Name
+    [s|
+      X where
+        X = cxx1.Name _;
+        glean.test.StringPair _
+    |]
+  assertEqual "angle - page repeated" (length (nub r)) 11
+
+  -- Testing or-statements
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      N where cxx1.Name N | src.File N
+    |]
+  assertEqual "angle - or-statements" 11 (length r)
+
+  -- Fix for a bug in fact traversal
+  r <- runQuery_ env repo $ modify $ recursive $ angleData @(Nat, Maybe Nat)
+    [s|
+      { 4, { just = 3 } } : { x : nat, y : maybe nat }
+    |]
+  assertEqual "angle - traverse bug" 1 (length r)
+
+  -- test for bugs in the handling of {} in the code generator
+  r <- runQuery_ env repo $ modify $ recursive $ angleData @()
+    [s|
+       X where (X = {}:{}) | (X = {}:{}); (X = {}:{}) | (X = {}:{})
+    |]
+  assertBool "angle - empty tuples" $
+    let l = length r in l >= 1 && l <= 4
+
+  r <- runQuery_ env repo $ modify $ angleData @[(Nat, Nat)]
+      "prim.zip X X where glean.test.Predicate { nat = 42, array_of_nat = X }"
+  print r
+  assertEqual "zipping - zipping an array with itself"
+    [[(Nat 1, Nat 1), (Nat 2, Nat 2)]] r
+
+  r <- runQuery_ env repo $ modify $ angleData @[Nat]
+      "prim.concat X X where glean.test.Predicate { nat = 42, array_of_nat = X }"
+  assertEqual "concat - concatenating an array with itself"
+    [[Nat 1, Nat 2, Nat 1, Nat 2]] r
+
+
+angleDotTest :: (WithDB () -> Test) -> Test
+angleDotTest dbTestCase = dbTestCase $ \env repo -> do
+
+  -- record selection
+  r <- runQuery_ env repo $ angleData @Text
+    "X.string_ where glean.test.Predicate X; X.nat = 42"
+  assertEqual "dot record" ["Hello\0world!\0"] r
+
+  -- select from a predicate type
+  r <- runQuery_ env repo $ angleData @Text
+    "(glean.test.Predicate _).string_"
+  assertEqual "deref predicate" (length r) 4
+
+  -- chain of selections: record, predicate, sum type, record
+  r <- runQuery_ env repo $ angleData @Text
+    "X.sum_.c?.string_ where glean.test.Predicate X"
+  assertEqual "dot record.sum.record" ["Hello\0world!\0", "acca"] r
+
+  -- maybe
+  r <- runQuery_ env repo $ angleData @Text
+    "X.string_ where (X : glean.test.Predicate).maybe_.just?"
+  assertEqual "dot maybe" ["Hello\0world!\0"] r
+
+  -- error: field not found
+  r <- try $ runQuery env repo $ angleData @Text
+    "X.notfound where glean.test.Predicate X"
+  assertBool "field not found" $
+    case r of
+      Left (BadQuery x) -> "does not contain the field" `Text.isInfixOf` x
+      _ -> False
+
+  -- error: using .nat? to select from a record
+  r <- try $ runQuery env repo $ angleData @Text
+    "X.nat? where glean.test.Predicate X"
+  assertBool "not a union" $
+    case r of
+      Left (BadQuery x) ->
+        "expression is a record, use '.nat' not '.nat?'" `Text.isInfixOf` x
+      _ -> False
+
+  -- error: using . to select from a union
+  r <- try $ runQuery env repo $ angleData @Text
+    "X.sum_.c where glean.test.Predicate X"
+  assertBool "not a record" $
+    case r of
+      Left (BadQuery x) ->
+        "expression is a union type, use '.c?' not '.c'"
+          `Text.isInfixOf` x
+      _ -> False
+
+  -- error: type error
+  r <- try $ runQuery env repo $ angleData @Text
+    "X.string_ where glean.test.Predicate X; X.nat = \"x\""
+  print r
+  assertBool "not a record" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  -- infer the lhs of the dot
+  r <- runQuery env repo $ angle @Glean.Test.Predicate
+    "X where X.sum_.c?.nat = 42; X : glean.test.Predicate"
+  assertEqual "infer lhs" 1 (length r)
+
+  -- ensure that we catch wrong usage of .field?
+  r <- try $ runQuery env repo $ angleData @Text
+    "X where X.sum_.c.nat = 42; X : glean.test.Predicate"
+  print r
+  assertBool "infer lhs error 1" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery env repo $ angleData @Text
+    "X where X.sum_.c?.nat? = 42; X : glean.test.Predicate"
+  print r
+  assertBool "infer lhs error 2" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  r <- runQuery_ env repo $ angleData @Nat
+    "X.*.sum_.c?.*.nat where X : glean.test.Predicate"
+  print r
+  assertEqual "deref 1" 2 (length r)
+
+  r <- runQuery_ env repo $ angleData @Text
+    "X.* where X = glean.test.IsGlean _"
+  print r
+  assertEqual "deref 2" 1 (length r)
+
+  r <- try $ runQuery_ env repo $ angleData @Text "3.*"
+  print r
+  assertBool "deref error 1" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+
+-- if statements
+angleIfThenElse
+  :: (WithDB () -> Test)
+  -> (forall a . Query a -> Query a)
+  -> Test
+angleIfThenElse dbTestCase modify = dbTestCase $ \env repo -> do
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if never : {} then 1 else 2"
+  print r
+  assertEqual
+    "if statement - returns the else branch when matching fails"
+    [Nat 2] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if (A = (0 | 1 | 2); A > 0) then A else 2"
+  print r
+  assertEqual
+    "if statement - returns the 'then' branch if any matching succeeds"
+    [Nat 1, Nat 2] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if (0 where 0 = 0) then 1 else 2"
+  print r
+  assertEqual
+    "if statement - works when condition has return type"
+    [Nat 1] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if (0 = 0) then 1 else 2"
+  print r
+  assertEqual
+    "if statement - works when condition is subquery without return type"
+    [Nat 1] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if (0 = 0) then 1 else if (0 = 0) then 2 else 3"
+  print r
+  assertEqual
+    "if statement - works when nested if's condition is subquery without return type"
+    [Nat 1] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if glean.test.IsGlean _ then 1 else 2"
+  print r
+  assertEqual
+    "if statement - works when condition is not subquery"
+    [Nat 1] r
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    "if (A = 1) then A else 2"
+  print r
+  assertEqual
+    "if statement - variables bound in condition are available in 'then' branch"
+    [Nat 1] r
+
+  r <- try $ runQuery_ env repo $ angleData @Nat
+    "if (A = 1) then A else A+1"
+  print r
+  assertBool
+    "if statement - variables bound in condition are not available in 'else' branch" $
+    case r of
+      Left (BadQuery x) -> "not bound anywhere: A" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angleData @Nat
+    [s|
+      A+1 where if (A = 1) then A else 2;
+    |]
+  print r
+  assertBool
+    "if statement - variables bound in condition are not available outside of if statement" $
+    case r of
+      Left (BadQuery x) -> "not bound anywhere: A" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angleData @Nat
+    [s|
+      A+1 where if 1 then (A = 1) else 2;
+    |]
+  print r
+  assertBool
+    "if statement - variables in 'then' branch only are not available outside" $
+    case r of
+      Left (BadQuery x) -> "not bound anywhere: A" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angleData @Nat
+    [s|
+      A+1 where if never : {} then 1 else (A = 1) ;
+    |]
+  print r
+  assertBool
+    "if statement - variables in 'else' branch only are not available outside" $
+    case r of
+      Left (BadQuery x) -> "not bound anywhere: A" `Text.isInfixOf` x
+      _ -> False
+
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+      "A where if 1 then (A = 1) else (A = 1)"
+  print r
+  assertEqual
+    "if statement - variables bound in both branches are available outside."
+    [Nat 1] r
+
+  r <- runQuery_ env repo $ modify $ angleData @(Nat, Nat)
+      "B = if (A = 1) then 2 else (A = 2); { A, B }"
+  print r
+  assertEqual
+    "if statement - variables bound in condition and 'else' are available outside."
+    [(Nat 1, Nat 2)] r
+
+  -- should be able to rearrange this one so that the variables are
+  -- bound in order
+  r <- runQuery_ env repo $ modify $ angleData @(Nat, Nat)
+      "(X = (Y:nat|2); Y = (7|8); {X,Y}) | {1,2}"
+  assertEqual "reordering disjunctions" 5 (length r)
+
+
+angleNegationTest
+  :: (WithDB () -> Test)
+  -> (forall a . Query a -> Query a)
+  -> Test
+angleNegationTest dbTestCase modify = dbTestCase $ \env repo -> do
+  -- Negation
+
+  -- negating a term fails
+  r <- runQuery_ env repo $ modify $ angleData @() "!1"
+  print r
+  assertEqual "negation - term 1" 0 (length r)
+
+  -- negating the negation of a term succeeds
+  r <- runQuery_ env repo $ modify $ angleData @() "!(!1)"
+  print r
+  assertEqual "negation - term 2" 1 (length r)
+
+  -- negating a false statement succeeds
+  r <- runQuery_ env repo $ modify $ angleData @() "!(1 = 2)"
+  print r
+  assertEqual "negation - term 3" 1 (length r)
+
+  -- a negated subquery has type unit
+  r <- runQuery_ env repo $ modify $ angleData @() "A = !(1 = 2); A"
+  print r
+  assertEqual "negation - term 3" 1 (length r)
+
+  -- negated queries do not bind variables to the parent scope
+  r <- try $ runQuery_ env repo $ modify $ angleData @()
+    [s|
+      A+1 where !(A = 0);
+    |]
+  print r
+  assertBool "negation - scope" $
+    case r of
+      Left (SomeException x) ->
+        "One or more variables were not bound anywhere" `isInfixOf` show x
+      _ -> False
+
+  -- negated queries do constrain the type of variables in the parent scope
+  r <- try $ runQuery_ env repo $ modify $ angleData @Nat
+    [s|
+       A where
+        !(A = glean.test.IsGlean "not-glean");
+        A = 2;
+    |]
+  print r
+  assertBool "negation - scope 2" $
+    case r of
+      Left (SomeException x) -> "type error" `isInfixOf` show x
+      _ -> False
+
+  -- variables bound before are available
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+       A where
+        A = "not-glean";
+        !(glean.test.IsGlean A);
+    |]
+  print r
+  assertEqual "negation - scope 3" 1 (length r)
+
+  -- variables can be local to the negated subquery
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+       A where
+        A = "glean";
+        !(!(glean.test.IsGlean B; V = [B]; A = V[..]));
+    |]
+  print r
+  assertEqual "negation - scope 4" 1 (length r)
+
+  -- variables local to earlier non-overlapping scopes with
+  -- the same name as negation variables do not interfere.
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      !(A = 1; A = 2); (A = "A") | "B"
+    |]
+  print r
+  assertEqual "negation - scope 5" 2 (length r)
+
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      !(A = 1; (A > 2 | A < 0));
+      "A"
+    |]
+  print r
+  assertEqual "negation - scope 6" 1 (length r)
+
+  -- Test that we can automatically quantify an unbound variable
+  -- used in a negation.
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Node
+    -- nodes that are not parents
+    [s|
+        N where !(glean.test.Edge { parent = N });
+    |]
+  print r
+  assertEqual "negation - scope 7" 4 (length r)
+
+  -- a negated query's head is replaced with {}
+  r <- runQuery_ env repo $ modify $ angleData @Nat
+    [s|
+        {} = !(A where A = 1; A = 2;);
+        1
+    |]
+  print r
+  assertEqual "negation -  3" 1 (length r)
+
+-- type checking
+angleTypeTest :: (WithDB () -> Test) -> Test
+angleTypeTest dbTestCase = dbTestCase $ \env repo -> do
+    -- Test for correct handling of maybe, bool, and enums in the type checker
+  r <- runQuery_ env repo $ recursive $ angleData @Nat
+    [s|
+      true = true;
+      true : bool = true;
+      true = true : bool;
+      true : bool = true : bool;
+      nothing = nothing : maybe nat;
+      nothing : maybe nat = nothing : maybe nat;
+      { just = 3 } : maybe nat = { just = 3 } : maybe nat;
+      { just = 3 } = { just = 3 } : maybe nat;
+      { just = 3 } = { just = 3 };
+      mon = mon : glean.test.Sum;
+      mon : glean.test.Sum = mon : glean.test.Sum;
+      3
+    |]
+  assertEqual "angle - eqType maybe" 1 (length r)
+
+  -- Test that records are not compared structurally
+  r <- try $ runQuery_ env repo $ angleData @Nat
+    [s| A : { a : nat, b : nat } = { c = 1, d = 1 } : { c : nat, d : nat };
+        { N, _ } = A;
+        N
+    |]
+  print r
+  assertBool
+    "eqType - field versions matter when comparing record types" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  -- X = Y and Y = X should typecheck in the same way
+  r <- runQuery_ env repo $ angleData @(Nat,Text)
+    [s|
+      {X,Y} where X = 1; "a" = Y
+    |]
+  assertEqual "angle - statement L/R" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @Nat
+    [s|
+      Y where X = { nat = Y }; glean.test.Predicate X
+    |]
+  assertEqual "angle - inference 1" 3 (length r)
+
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      Y where
+        X = { sum_ = { c = { string_ = Y }}};
+        X = { nat = 0 };
+        glean.test.Predicate X
+    |]
+  print r
+  assertEqual "angle - inference 2" 2 (length r)
+
+  r <- runQuery_ env repo $ angleData @Nat
+    [s|
+        X.nat where
+        X : glean.test.Predicate;
+        X.sum_.c?.string_ = "acca"
+    |]
+  print r
+  assertEqual "angle - inference 3" 1 (length r)
+
+  r <- runQuery_ env repo $ angle @Glean.Test.Tree
+    [s|
+      Z where
+        X : glean.test.Tree;
+        Y = X.left.just?;
+        Z = Y.right.just?;
+        Z.node = { label = "d" }
+    |]
+  print r
+  assertEqual "angle - inference 4" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      X.a.b.label where
+        X = { a = Y };
+        Y = { b = { label = "a" }};
+        X : { a: { b: glean.test.Node }}
+    |]
+  print r
+  assertEqual "angle - inference 5" 1 (length r)
+
+  -- order of statements shouldn't matter
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      X.a.b.label where
+        Y = { b = { label = "a" }};
+        X = { a = Y };
+        X : { a: { b: glean.test.Node }}
+    |]
+  print r
+  assertEqual "angle - inference 6" 1 (length r)
+
+  -- default unbound hasTy
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      "ok" where {} = {}
+    |]
+  print r
+  assertEqual "angle - inference 7" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      "ok" where {a=2} = Y; Y.a?=2
+    |]
+  print r
+  assertEqual "angle - inference 8" 1 (length r)
+
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      P.string_ where P : glean.test.Predicate; P.enum_ = e
+    |]
+  print r
+  assertEqual "angle - inference 9" 4 (length r)
diff --git a/glean/test/tests/Angle/ArrayTest.hs b/glean/test/tests/Angle/ArrayTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/ArrayTest.hs
@@ -0,0 +1,190 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.ArrayTest (main) where
+
+import Data.List
+import Data.Text (Text)
+import Data.Word
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Types
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "array" $ angleArray dbTestCase id
+  , TestLabel "array/page" $ angleArray dbTestCase (limit 1)
+  ]
+
+angleArray :: (WithDB () -> Test) -> (forall a . Query a -> Query a) -> Test
+angleArray dbTestCase modify = TestList
+  [ TestLabel "generators" $ angleArrayGenerator dbTestCase modify
+  , TestLabel "prefix" $ angleArrayPrefix dbTestCase modify
+  ]
+
+angleArrayGenerator
+  :: (WithDB () -> Test)
+  -> (forall a . Query a -> Query a) -> Test
+angleArrayGenerator dbTestCase modify = TestList
+  [ TestLabel "array of pred" $
+    dbTestCase $ \env repo -> do
+    -- fetch all elements of an array
+    results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+      [s|
+        glean.test.Predicate { array_of_pred = Arr };
+        Arr [..]
+      |]
+    print results
+    assertEqual "angle - array generator 1" 2 (length results)
+
+  , TestLabel "array of nat" $
+    dbTestCase $ \env repo -> do
+
+    -- match on elements of an array
+    results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+      [s|
+        P where
+        P = glean.test.Predicate { array_of_nat = Arr };
+        3 = Arr [..]  # any P with a 3 in array_of_nat
+     |]
+    print results
+    assertEqual "angle - array generator 2" 1 (length results)
+
+  , TestLabel "array of pred with match" $
+    dbTestCase $ \env repo -> do
+      -- test that a generator on the left gets compiled correctly
+    results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+      [s|
+        P where
+        P = glean.test.Predicate { array_of_pred = Arr };
+        { nat = 42 } = Arr [..]  # any P with a nat = 4
+      |]
+    print results
+    assertEqual "angle - array generator 3" 1 (length results)
+
+  , TestLabel "array of records" $
+    dbTestCase $ \env repo -> do
+    results <- runQuery_ env repo $ modify $
+      angleData @(Text, Nat)
+     [s|
+        [ { "a",1 }, { "b",2 } ] [..]
+      |]
+    print results
+    assertEqual "angle - array generator 4"
+      [ ("a", Nat 1), ("b", Nat 2) ] results
+  , TestLabel "array of bytes" $
+    dbTestCase $ \env repo -> do
+    results <- runQuery_ env repo $ modify $
+      angleData @Byte
+      [s| [1 : byte, 255][..] |]
+    print results
+    assertEqual "angle - array generator 5"
+      (sort [Byte 1, Byte (fromIntegral (255 :: Word8))]) (sort results)
+  ]
+
+angleArrayPrefix
+  :: (WithDB () -> Test)
+  -> (forall a . Query a -> Query a) -> Test
+angleArrayPrefix dbTestCase modify = TestList
+  [ TestLabel "nat" $ TestList
+    [ TestLabel "nested" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_nat = [3,4, ..] }
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_nat = [3, ..] }
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+    , TestLabel "flat" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_nat = A };
+            [3, ..] = A
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_nat = A };
+            [3,4, ..] = A
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+    ]
+  , TestLabel "pred" $ TestList
+    [ TestLabel "nested" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_pred = [glean.test.Predicate _, ..] }
+          |]
+        assertEqual "angle - array prefix" 2 (length results)
+    , TestLabel "flat" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_pred = A };
+            [_, ..] = A
+          |]
+        assertEqual "angle - array prefix" 2 (length results)
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_pred = A };
+            [glean.test.Predicate _, ..] = A
+          |]
+        assertEqual "angle - array prefix" 2 (length results)
+    ]
+  , TestLabel "string" $ TestList
+    [ TestLabel "nested" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_string = ["abba","baba", ..] }
+          |]
+        assertEqual "angle - array prefix" 2 (length results)
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_string = ["abba", ..] }
+          |]
+        assertEqual "angle - array prefix" 2 (length results)
+    ]
+  , TestLabel "nat and string" $ TestList
+    [ TestLabel "nested" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate
+          [s|
+            P where
+            P = glean.test.Predicate { array_of_nat = [3, ..], array_of_string = ["abba", ..] }
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+    ]
+
+  -- regression test for a bug in MatchArrayPrefix handling
+  , TestLabel "buildTerm" $ dbTestCase $ \env repo -> do
+        results <- runQuery_ env repo $ modify $ angleData @[Text]
+          [s|
+            X where X = ["a","b"]; X = ["a",..]
+          |]
+        assertEqual "angle - array prefix" 1 (length results)
+  ]
diff --git a/glean/test/tests/Angle/DataTest.hs b/glean/test/tests/Angle/DataTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/DataTest.hs
@@ -0,0 +1,40 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.DataTest (main) where
+
+import Data.List
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+import Data.Text ( Text )
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import Glean.Types
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "angleData" $ angleDataTest dbTestCase id
+  , TestLabel "angleData/page" $ angleDataTest dbTestCase (limit 1)
+  ]
+
+angleDataTest :: (WithDB () -> Test) -> (forall a . Query a -> Query a) -> Test
+angleDataTest dbTestCase modify = dbTestCase $ \env repo -> do
+  results <- runQuery_ env repo $ modify $ angleData
+    [s| { 3, false } : { x : nat, y : bool } |]
+  assertEqual "angleData 1" [(Nat 3, False)] results
+
+  results :: [Text] <- runQuery_ env repo $ modify $ angleData
+    [s| X where Y = cxx1.Name "ab"..; Y = cxx1.Name X |]
+  assertEqual "angleData 2" ["abba", "abcd"] (sort results)
diff --git a/glean/test/tests/Angle/DerivedTest.hs b/glean/test/tests/Angle/DerivedTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/DerivedTest.hs
@@ -0,0 +1,374 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.DerivedTest (main) where
+
+import Data.List
+import Data.Text (Text)
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Typed hiding (end)
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "derived" $ derivedTest id
+  , TestLabel "derived/page" $ derivedTest (limit 1)
+  ]
+
+-- | Tests for derived predicates using Angle syntax. See
+-- JSONQueryTest.jsonDerivedTest for the Thrift-query-type versions of
+-- these tests.
+derivedTest :: (forall a . Query a -> Query a) -> Test
+derivedTest modify = dbTestCase $ \env repo -> do
+  -- Several tests with the trivial derived predicate: IsThree ::= 3
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      glean.test.IsThree _
+    |]
+  print results
+  assertEqual "derived - IsThree 1" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      Y where Y = glean.test.IsThree X; X = 4
+    |]
+  print results
+  assertEqual "derived - IsThree 2" 0 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      glean.test.IsThree 3
+    |]
+  print results
+  assertEqual "derived - IsThree 3" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      glean.test.IsThree 4
+    |]
+  print results
+  assertEqual "derived - IsThree 4" 0 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      X = 3; glean.test.IsThree X
+    |]
+  print results
+  assertEqual "derived - IsThree 5" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsThree
+    [s|
+      X = 4; glean.test.IsThree X
+    |]
+  print results
+  assertEqual "derived - IsThree 6" 0 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.IsGlean
+    [s|
+      glean.test.IsGlean "gl"..
+    |]
+  print results
+  assertEqual "derived - IsGlean 1" 1 (length results)
+
+  -- Tests with RevStringPair
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+      glean.test.RevStringPair _
+    |]
+  print results
+  assertBool "derived 1" $ length results == 6
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+      glean.test.RevStringPair {"a",_}
+    |]
+  print results
+  assertBool "derived 2" $ length results == 1
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+      glean.test.RevStringPair {_,"a"}
+    |]
+  print results
+  assertBool "derived 3" $ case results of
+    [one] | Just key <- getFactKey one ->
+      "a" == Glean.Test.revStringPair_key_snd key
+    _otherwise -> False
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+      glean.test.RevStringPair {X,X}
+    |]
+  print results
+  assertBool "derived 4" $ length results == 2
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevRevStringPair
+    [s|
+      glean.test.RevRevStringPair _
+    |]
+  print results
+  assertBool "derived 5" $ length results == 6
+
+  -- The Ids of derived fact better be distinct, even when we page the results
+  assertBool "derived 5: distinct Ids" $ length (nub (map getId results)) == 6
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevRevStringPair
+    [s|
+      glean.test.RevRevStringPair {"a",_}
+    |]
+  print results
+  assertBool "derived 6" $ case results of
+    [one] | Just key <- getFactKey one ->
+      "a" == Glean.Test.revRevStringPair_key_fst key
+    _otherwise -> False
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.ReflStringPair
+    [s|
+      glean.test.ReflStringPair "x"..
+    |]
+  print results
+  assertBool "derived 7" $ length results == 1
+
+  -- check that we can recursively expand the results of a derived query
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.DualStringPair
+    [s|
+      glean.test.DualStringPair _
+    |]
+  print results
+  assertBool "derived 8" $ (==4) $ length
+    [ fst
+    | Just key <- map getFactKey results
+    , Just fst <- [getFactKey $ Glean.Test.dualStringPair_key_fst key] ]
+
+  -- a pattern on the LHS of a statement that arises due to
+  -- substitution of a derived predicate
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.DualStringPair
+    [s|
+      P = glean.test.StringPair _; glean.test.DualStringPair {P,_}
+    |]
+  print results
+  assertBool "derived 10" $ (==4) $ length results
+
+  -- More complicated matching
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.RevStringPair
+    [s|
+      glean.test.StringPair X;
+      glean.test.RevStringPair X
+      # generates all RevStringPairs and matches each one against X
+    |]
+  print results
+  assertEqual "derived match filter" 4 (length results)
+
+  -- deriving a key-only predicate from a key-value predicate
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue
+    [s|
+      glean.test.DerivedKeyValue _
+    |]
+  print results
+  assertEqual "angle - derived key/value 1" 3 (length results)
+
+  -- match on the key
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue
+    [s|
+      glean.test.DerivedKeyValue { kstring = "foo" }
+    |]
+  print results
+  assertEqual "angle - derived key/value 2" 2 (length results)
+
+  -- match on the value
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue
+    [s|
+      glean.test.DerivedKeyValue { vnat = 5 }
+    |]
+  print results
+  assertEqual "angle - derived key/value 3" 1 (length results)
+
+  -- deriving a key-value predicate from a key-only predicate which is
+  -- derived from a key-value predicate
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue2
+    [s|
+      glean.test.DerivedKeyValue2 _
+    |]
+  print results
+  assertEqual "angle - derived key/value 4" 3 (length results)
+
+  -- match on the key
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue2
+    [s|
+      glean.test.DerivedKeyValue2 { kstring = "foo" } -> _
+    |]
+  print results
+  assertEqual "angle - derived key/value 5" 2 (length results)
+
+  -- match on the value
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DerivedKeyValue2
+    [s|
+      glean.test.DerivedKeyValue2 _ -> { vnat = 5 }
+    |]
+  print results
+  assertEqual "angle - derived key/value 6" 1 (length results)
+
+  -- a derived predicate defined as a record, not a tuple
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPairRec
+    [s|
+      glean.test.RevStringPairRec {_, "a"}
+    |]
+  print results
+  assertBool "angle - derived with record" $ length results == 1
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPairRec
+    [s|
+      glean.test.RevStringPairRec { snd = "a" }
+    |]
+  print results
+  assertBool "angle - derived with record 2" $ length results == 1
+
+  -- tests that require inserting derived facts into the temporary environment
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+      X where X = glean.test.RevStringPair _
+    |]
+  print results
+  assertEqual "angle - tmp environment" 6 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPair
+    [s|
+       P where
+       P = glean.test.RevStringPair {A,"a"};
+       glean.test.RevStringPair {_,A}
+    |]
+  print results
+  assertEqual "angle - tmp environment 2" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.RevStringPairs
+    [s|
+      glean.test.RevStringPairs { x = "a" }
+    |]
+  print results
+  assertEqual "angle - tmp environment 3" 1 (length results)
+
+  -- non-bindable or-pattern in the key of a derived predicate. This
+  -- is a tricky case to handle: the query engine will have to expand
+  -- and substitute the derived predicate twice.
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.RevStringPairs
+    [s|
+      glean.test.RevStringPairs { x = "a".. | "b".. }
+    |]
+  print results
+  assertEqual "angle - derived + or pattern" 2 (length results)
+
+  results <- runQuery_ env repo $ modify $ recursive $
+    angleData @[Text]
+    [s|
+      [X1, X2] where glean.test.RevStringPair{X1, X2};
+    |]
+  print results
+  assertEqual "angle - derived returning array" 6 (length results)
+
+  -- sum type in the derived predicate head
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.MatchOneAlt
+    [s|
+      glean.test.MatchOneAlt { { tue = 3 }, _ }
+    |]
+  print results
+  assertEqual "angle - MatchOneAlt 1" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.MatchOneAlt
+    [s|
+      glean.test.MatchOneAlt { { mon = 3 }, _ }
+    |]
+  print results
+  assertEqual "angle - MatchOneAlt 2" 0 (length results)
+
+  -- Test for a bug
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.LeftOr $
+    [s|
+      glean.test.LeftOr { x = "c".. }
+    |]
+  print r
+  assertEqual "angle - LeftOr" 1 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.LeftOr2 $
+    [s|
+      glean.test.LeftOr2 { x = "c".. }
+    |]
+  print r
+  assertEqual "angle - LeftOr2" 1 (length r)
+
+  -- Test for another bug
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.RevStringPairs
+    [s|
+      glean.test.RevStringPairs { X, {_, X} }
+    |]
+  print results
+  assertEqual "angle - RevStringPairs " 6 (length results)
+
+  -- flipping statements
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Unbound2
+    [s|
+      glean.test.Unbound2 { _, "e" }
+    |]
+  print r
+  assertEqual "angle - flip statement 1" 1 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Unbound2
+    [s|
+      glean.test.Unbound2 { "e", _ }
+    |]
+  print r
+  assertEqual "angle - flip statement 2" 1 (length r)
+
+  -- test for repeated variables in the derived predicate
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.SameString
+    [s|
+      glean.test.SameString { "a", "b" }
+    |]
+  print r
+  assertEqual "angle - repeated vars 1" 0 (length r)
+
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.SameString
+    [s|
+      glean.test.SameString { "a", "a" }
+    |]
+  print r
+  assertEqual "angle - repeated vars 2" 1 (length r)
+
+  -- unification
+  r <- runQuery_ env repo $ modify $ angle @Glean.Test.Unbound2
+    [s|
+      glean.test.Unbound2 _
+    |]
+  print r
+  assertEqual "angle - unification" 2 (length r)
+
+  -- or-statements and derived predicates
+  r <- runQuery_ env repo $ modify $ angleData @Text
+    [s|
+      N where
+        glean.test.RevStringPair { N, _ } |
+        glean.test.RevRevStringPair { N, _ }
+    |]
+  assertEqual "angle - or-statements derived" 8 (length (nub r))
diff --git a/glean/test/tests/Angle/ErrorTest.hs b/glean/test/tests/Angle/ErrorTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/ErrorTest.hs
@@ -0,0 +1,209 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.ErrorTest (main) where
+
+import Control.Exception
+import qualified Data.Text as Text
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Types
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "error" angleErrorTests
+  ]
+
+-- No need to re-run the error tests with paging, so we separate them out.
+angleErrorTests  :: Test
+angleErrorTests = dbTestCase $ \env repo -> do
+  -- sum type: error to give multiple alternatives
+  results <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { sum_ = { d = _, c = _ } }
+    |]
+  print results
+  assertBool "angle - sum - too many alts" $
+    case results of
+      Left (BadQuery s) -> "union type" `Text.isInfixOf` s
+      _ -> False
+
+  -- check that we get an error if there's a version mismatch between
+  -- query and call site.
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate_0
+    [s|
+      glean.test.Predicate { }
+    |]
+  assertBool "angle - type error" $
+    case r of
+      Left BadQuery{} -> True
+      _ -> False
+
+  -- type error when using a type annotation on the lhs
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate_0
+    [s|
+      P where
+      P = glean.test.Predicate { array_of_pred = X };
+      glean.test.KitchenSink { nat = 42 } = X
+    |]
+  print r
+  assertBool "angle - type error 2" $
+    case r of
+      Left (BadQuery s) -> "type error" `Text.isInfixOf` s
+      _ -> False
+
+  -- using the wrong predicate name is an error in a nested query
+  r <- try $ runQuery_ env repo $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = sys.Blob "an".. }
+    |]
+  print r
+  assertBool "angle - nested 3" $
+    case r of
+      Left (BadQuery x) -> "expected type: cxx1.Name" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      N = cxx1.Name "abc";
+      N[..]
+    |]
+  print r
+  assertBool "angle - array generator type error" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      unknown.predicate "abc"
+    |]
+  print r
+  assertBool "angle - unknown predicate " $
+    case r of
+      Left (BadQuery x) -> "not in scope" `Text.isInfixOf` x
+      _ -> False
+
+  -- general type error
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      cxx1.Name 3
+    |]
+  print r
+  assertBool "angle - type error" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  -- types of generators in sequence don't match
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      (cxx1.Name "abc") | (cxx1.Type "def")
+    |]
+  print r
+  assertBool "angle - mismatched generator types" $
+    case r of
+      Left (BadQuery x) ->
+        "type error" `Text.isInfixOf` x
+      _ -> False
+
+  -- types of array elements don't match
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      [A,B] where A = cxx1.Name "abc"; B = cxx1.Type "def"
+    |]
+  print r
+  assertBool "angle - mismatched array elements" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angle @Cxx.Name
+    [s|
+      _ = prim.length (_ : [string]); cxx1.Name "xyz"
+    |]
+  print r
+  assertBool "angle - wildcard in expr" $
+    case r of
+      Left (BadQuery x) -> "unbound variable" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      x = 1; glean.test.Predicate { nat = x }
+    |]
+  print r
+  assertBool "angle - lowercase variable" $
+    case r of
+      Left (BadQuery x) -> "type error"
+        `Text.isInfixOf` x
+      _ -> False
+
+  -- source location of error
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      A where
+        A = glean.test.Node _;
+        B = glean.test.Edge _;
+        A = B;
+    |]
+  print r
+  assertBool "angle - variable location" $
+    case r of
+      Left (BadQuery x) -> "line 5, column 9" `Text.isInfixOf` x
+      _ -> False
+
+  r <- try $ runQuery_ env repo $ angleData @Nat "1 + never"
+  print r
+  assertBool
+    "angle never - cannot be used in an expression" $
+    case r of
+      Left (BadQuery x) ->
+        "cannot use 'never' in an expression" `Text.isInfixOf` x
+      _ -> False
+
+  r <- runQuery_ env repo $ angleData @Nat "A = [1,2][..]; never = A; A"
+  print r
+  assertEqual
+    "angle - never does not match any result"
+    r []
+
+  r <- runQuery_ env repo $ angleData @Glean.Test.Predicate
+    "A = never : glean.test.Predicate; A"
+  print r
+  assertEqual
+    "angle - works for FactGenerators"
+    r []
+
+  -- a negated term has type unit
+  r <- try $ runQuery_ env repo $ angleData @Nat "!1 = 2; 3"
+  print r
+  assertBool "angle - negation type" $
+    case r of
+      Left (BadQuery x) -> "type error" `Text.isInfixOf` x
+      _ -> False
+
+  -- unbound variables in a negated statement are errors
+  r <- try $ runQuery_ env repo $ angleData @Nat "!(A + A)"
+  print r
+  assertBool "angle - negation unbound" $
+    case r of
+      Left (BadQuery x) ->
+        "unbound variable: A" `Text.isInfixOf` x
+      _ -> False
diff --git a/glean/test/tests/Angle/MiscTest.hs b/glean/test/tests/Angle/MiscTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/MiscTest.hs
@@ -0,0 +1,482 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.MiscTest (main) where
+
+import Control.Exception
+import Data.Default
+import Data.Int
+import Data.List
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Backend.Types as Backend
+import Glean.Init
+import Glean.Query.Angle as Angle
+import Glean.Query.Thrift as Thrift
+import Glean.Query.Thrift.Internal
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Typed hiding (end)
+import Glean.Types
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "justKeys" $ justKeys dbTestCase id
+  , TestLabel "justKeys/page" $ justKeys dbTestCase (limit 1)
+  , TestLabel "reorder" $ reorderTest dbTestCase
+  , TestLabel "scoping" $ scopingTest dbTestCase
+  , TestLabel "queryOptions" $ angleQueryOptions dbTestCase
+  , TestLabel "limitBytes" $ limitTest dbTestCase
+  , TestLabel "fullScans" fullScansTest
+  , TestLabel "newold" $ newOldTest id
+  , TestLabel "justCheck" $ justCheckTest dbTestCase
+  , TestLabel "warnDiag" $ warnDiagTest dbTestCase
+  ]
+
+newOldTest :: (forall a . Query a -> Query a) -> Test
+newOldTest modify = TestCase $ withStackedTestDB [] $ \env repo -> do
+  results <- runQuery_ env repo $ modify $ keys $ Angle.query $
+    new $ predicate @Cxx.Name wild
+  assertEqual "angle - new facts"
+    [ "abcd", "allin", "anywhere", "barbie", "blob" ]
+    results
+
+  results <- runQuery_ env repo $ modify $ keys $ Angle.query $
+    old $ predicate @Cxx.Name wild
+  assertEqual "angle - old facts"
+    [ "abba", "anonymous", "azimuth", "blubber", "book", "foo" ]
+    results
+
+warnDiagTest :: (WithDB () -> Test) -> Test
+warnDiagTest dbTestCase = dbTestCase $ \env repo -> do
+  let (Query q1) = dbgPredHasFacts $ Angle.query $
+        predicate @Glean.Test.EmptyPred wild
+      (Query q2) = Angle.query $ predicate @Cxx.Name wild
+
+  r <- userQuery env repo q1
+  assertEqual "predicate has no facts" 1 $ length $ getWarns r
+  r <- userQuery env repo q2
+  assertEqual "predicate has facts" 0 $ length $ getWarns r
+
+  where getWarns r = filter (\d -> "Warning" `isPrefixOf` Text.unpack d)
+             $ userQueryResults_diagnostics r
+
+scopingTest :: (WithDB () -> Test) -> Test
+scopingTest dbTestCase = dbTestCase $ \env repo -> do
+  r <- try $ runQuery_ env repo $ angle @Glean.Test.Predicate
+    [s|
+      cxx1.Name X
+    |]
+  print r
+  assertBool "angle - unbound var" $
+    case r of
+      Left (BadQuery x) -> "mentioned only once: X" `Text.isInfixOf` x
+      _ -> False
+
+  -- bind a variable in multiple branches
+  r <- runQuery_ env repo $ angleData @(Text, Nat)
+    [s|
+      {N,X} where X = (1 where N = "abc") | (2 where N = "def")
+    |]
+  print r
+  assertEqual "angle - scoping" 2 (length r)
+
+  -- must bind the variable in *all* branches
+  r <- try $ runQuery_ env repo $ angleData @(Text, Nat)
+    [s|
+      {N,X} where X = (1 where N = "abc") | 2
+    |]
+  print r
+  assertBool "angle - scoping 2" $ case r of
+    Left e@BadQuery{} -> "cannot resolve" `isInfixOf` show e
+    _ -> False
+
+  -- it's OK to not bind the variable in every branch of | if it is
+  -- bound outside
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      N where N = (X : string) | "abc"; X = "a"
+    |]
+  print r
+  assertEqual "angle - scoping 3" 2 (length r)
+
+  -- local variables can have different types in disjoint branches of |
+  r <- runQuery_ env repo $ angleData @(Nat, Text)
+    [s|
+      ({X,Y} where X = 3; Y = "a") | ({Y,X} where Y = 3; X = "a")
+    |]
+  print r
+  assertEqual "angle - scoping 4" 1 (length r)
+
+  -- but this is an error if the variable(s) are visible outside |
+  r <- try $ runQuery_ env repo $ angleData @(Text, Nat)
+    [s|
+      {X,Y} where
+        {X,Y} = ({X,Y} where X = 3; Y = "a") |
+                ({Y,X} where Y = 3; X = "a")
+    |]
+  print r
+  assertBool "angle - scoping 5" $ case r of
+    Left e@BadQuery{} -> "type error" `isInfixOf` show e
+    _ -> False
+
+  r <- runQuery_ env repo $ Angle.query $
+      predicate @Glean.Test.NothingTest wild
+  print (r :: [Glean.Test.NothingTest])
+  assertEqual "angle - nothingTest" 1 (length r)
+
+justKeys :: (WithDB () -> Test) -> (forall a . Query a -> Query a) -> Test
+justKeys dbTestCase modify = dbTestCase $ \env repo -> do
+  results <- runQuery_ env repo $ modify $ keys $ allFacts @Cxx.Name
+  assertEqual "angle - justKeys" 11 (length results)
+  assertBool "angle - justKeys" $ "abba" `elem` results
+
+queryStats
+  :: forall q backend . (Backend backend)
+  => backend
+  -> Repo
+  -> Query q
+  -> IO ([q], Maybe UserQueryStats)
+
+queryStats be repo (Query query) = do
+  let
+    opts = fromMaybe def (userQuery_options query)
+    query' = query
+      { userQuery_encodings = [UserQueryEncoding_bin def]
+      , userQuery_options = Just
+        opts { userQueryOptions_collect_facts_searched = True }
+      }
+  UserQueryResults{..} <- userQuery be repo query'
+  results <- decodeResults userQueryResults_results decodeAsFact
+  return (results, userQueryResults_stats)
+
+
+factsSearched
+  :: PredicateRef
+  -> Map PredicateRef Int64
+  -> Maybe UserQueryStats
+  -> Maybe Int
+factsSearched ref lookupPid maybeStats = do
+  pid <- Map.lookup ref lookupPid
+  stats <- maybeStats
+  searched <- userQueryStats_facts_searched stats
+  count <- Map.lookup pid searched
+  return (fromIntegral count)
+
+{-
+  Test reordering of nested matches using a simple DAG:
+
+      "a"
+      / \
+    "b" "c"
+      \ /
+      "d"
+-}
+reorderTest :: (WithDB () -> Test) -> Test
+reorderTest dbTestCase = dbTestCase $ \env repo -> do
+  si <- getSchemaInfo env (Just repo) def { getSchemaInfo_omit_source = True }
+  let lookupPid = Map.fromList
+        [ (ref,pid) | (pid,ref) <- Map.toList (schemaInfo_predicateIds si) ]
+
+  -- Inner match is not in a prefix position: do it last
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      "result" where
+        glean.test.Tree {
+          { label = "b" },
+          _,
+          { just = { { label = "d" }, _, _ } }
+        }
+    |]
+  print stats
+  assertEqual "reorder nested 1" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- Inner match is in a prefix position but irrefutable: do it last
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      X where glean.test.Tree { { label = "b" }, { just = { X, _, _ } }, _ }
+    |]
+  assertEqual "reorder nested 2" Nothing $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- Inner match is in a prefix position and refutable: do it first
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      "result" where
+        glean.test.Tree {
+          { label = "b" },
+          { just = { { label = "d" }, _, _ } },
+          _
+        }
+    |]
+  print stats
+  assertEqual "reorder nested 3" Nothing $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- inner match is in a prefix position (conditional on L being
+  -- bound, which it is), and refutable, so do it first.
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      "d" where
+         L = glean.test.Tree { { label = "d" }, _, _ };
+         glean.test.Tree {
+           { label = "b" },
+           { just = L },
+           { just = { { label = "d" }, _, _ } } }
+    |]
+  assertEqual "reorder nested 4" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- point match in a non-prefix position: do it first
+  (_, stats) <- queryStats env repo $ angle @Glean.Test.Predicate
+    [s|
+      glean.test.Predicate { sum_ = { d = "hello" } }
+    |]
+  assertEqual "reorder nested 5" (Just 1) $
+    factsSearched (PredicateRef "sys.Blob" 1) lookupPid stats
+
+  -- nested (almost) irrefutable inner match: do it last
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      X where
+        glean.test.Tree {
+          { label = "a" },
+          _,
+          { just = { _, { just = { X, _, _ } }, _ }}
+        }
+    |]
+  assertEqual "reorder nested 6" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- Nested matches on the rhs of a lookup should become lookups
+  (_, stats) <- queryStats env repo $ angle @Glean.Test.Tree
+    [s|
+      L where
+        L = glean.test.Tree { { label = "a" }, { just = M }, _ };
+        M = glean.test.Tree { { label = "c" }, { just = { { label = "d" }, _, _ }}, _}
+          # L is bound, so even though the nested match { { label = "d" }, _, _ }
+          # is in a prefix position and would normally be done first,
+          # in this case we want to do it afterwards because it's a lookup
+          # and a lookup is always cheaper than a search.
+    |]
+  assertEqual "reorder nested 7" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- Ordering where the nested query is in a prefix position of its
+  -- parent and not a point query.
+  (_, stats) <- queryStats env repo $ angle @Glean.Test.Edge
+    [s|
+      X where
+        X = glean.test.Edge { parent = { label = "b".. }}
+          # We want the inner query to be done first, on the grounds that
+          # then the outer query becomes a prefix match.
+    |]
+  assertEqual "reorder nested 8" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Edge" 6) lookupPid stats
+
+  -- negations are moved after the binding of the variables it mentions.
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+       A where
+        !(glean.test.IsGlean A);
+        A = "not-glean";
+    |]
+  print r
+  assertEqual "negation - reorder 1" 1 (length r)
+
+  -- negations are moved after the binding of the variables it mentions
+  -- even when the variable comes from a disjunction.
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+       A where
+        !(glean.test.IsGlean A);
+        glean.test.IsGlean ("g".. A) | glean.test.IsGlean ("gl".. A);
+    |]
+  print r
+  assertEqual "negation - reorder 2" 2 (length r)
+
+  -- negations are moved after the binding of the variables it mentions
+  -- even when the variable comes from an if statement
+  r <- runQuery_ env repo $ angleData @Text
+    [s|
+      A where
+        !(glean.test.IsGlean A);
+        if 1 then
+          glean.test.IsGlean ("g".. A)
+        else
+          glean.test.IsGlean ("g".. A)
+    |]
+  print r
+  assertEqual "negation - reorder 3" 1 (length r)
+
+  -- The negation is moved after the binding of all the variables it mentions.
+  r <- runQuery_ env repo $ angleData @Nat
+    -- only if the negation is moved after the last statement will tere be two
+    -- results
+    [s|
+      A where
+        !(A = B : nat);
+        TWO = [ { 1, 1 }, { 2, 2} ];
+        ONE = [ { 1, 1 } ];
+        { _, A} | { B, _} = ONE[..];
+        { _, A} = TWO[..];
+        { B, _} = TWO[..];
+    |]
+  print r
+  assertEqual "negation - reorder 4" 2 (length r)
+
+  -- A negation which is an O(1) filter gets moved up.
+  (_,stats) <- queryStats env repo $ angleData @Text
+    [s|
+      N where
+        V = [1];
+        A = V[..];
+        B = V[..];
+        cxx1.Name N;
+        !(A = B);
+    |]
+  print r
+  assertEqual "negation - reorder 5" Nothing $
+    factsSearched (PredicateRef "cxx1.Name" 5) lookupPid stats
+
+  -- test for a bad case in reordering where the nested matches under
+  -- `left` were being lifted out before the outer match.
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      L where
+        glean.test.Tree {
+          node = { label = "a" },
+          left = { just = { node = { label = L } } }
+        }
+    |]
+  assertEqual "reorder nested 9" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  -- Test for a bug in reordering where we were erroneously hoising
+  -- statements that couldn't resolve, because we ignored wildcards
+  (_, stats) <- queryStats env repo $ angleData @Glean.Test.Tree
+    [s|
+      X where
+        A = glean.test.Node { label = "a" };
+        (glean.test.Tree X; { node = A } = X) |
+        glean.test.Tree X
+    |]
+  assertEqual "reorder nested 10" (Just 14) $
+    factsSearched (PredicateRef "glean.test.Tree" 6) lookupPid stats
+
+  results <- runQuery_ env repo $ angleData @(Nat,Nat)
+    [s|
+      { A, B } where
+        (A = 1) | (B = 2);
+        A = 1 | 2;
+        B = 2 | 3
+    |]
+  assertEqual "reorder unbound choice" 3 (length results)
+
+angleQueryOptions :: (WithDB () -> Test) -> Test
+angleQueryOptions dbTestCase = dbTestCase $ \env repo -> do
+  let omitResults :: Bool -> Query q -> Query q
+      omitResults omit (Query query) = Query q
+        where
+          opts = fromMaybe def (userQuery_options query)
+          q = query
+            { userQuery_options = Just opts
+              { userQueryOptions_omit_results = omit }
+            }
+
+      counts (_, Nothing) = error "No query stats"
+      counts (results, Just UserQueryStats{..}) =
+        ( length results
+        , userQueryStats_result_count
+        )
+
+  r <- queryStats env repo $ omitResults True $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = "ab"..  }
+    |]
+  assertEqual "queryOptions - omitting results" (counts r) (0, 2)
+
+  r <- queryStats env repo $ omitResults False $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = "ab"..  }
+    |]
+  assertEqual "queryOptions - not omitting results" (counts r) (2, 2)
+
+
+limitTest :: (WithDB () -> Test) -> Test
+limitTest dbTestCase = dbTestCase $ \env repo -> do
+  (results, truncated) <- runQuery env repo $ limitBytes 30 $ recursive $
+    Angle.query $ predicate @Glean.Test.Edge wild
+  -- each Edge will be
+  --   about 12 bytes for the Edge (8 byte Id + 2 refs @ 2 bytes each)
+  --   about 11 bytes for each Node (8 byte Id + 3 byte string)
+  --   = 33 bytes
+  -- so a limit of 30 bytes should ensure that we're counting the size
+  -- of the nested facts too.
+  assertBool "limitBytes" (length results == 1 && truncated)
+
+  (results, truncated) <- runQuery env repo $ limitBytes 40 $ recursive $
+    Angle.query $ predicate @Glean.Test.Edge wild
+  assertBool "limitBytes" (length results == 2 && truncated)
+
+justCheckTest :: (WithDB () -> Test) -> Test
+justCheckTest dbTestCase = dbTestCase $ \env repo -> do
+  results <- runQuery_ env repo $ justCheck $ Angle.query $
+    predicate @Cxx.Name wild
+  assertEqual "just check" 0 (length results)
+
+  results <- try $ runQuery_ env repo $ justCheck $ angleData @Text
+    [s|
+      Cxx1.Name X
+    |]
+  assertBool "just check - bad query" $
+    case results of
+      Left (BadQuery _) -> True
+      _ -> False
+
+
+fullScansTest :: Test
+fullScansTest = TestList $
+  [ TestLabel "no full scans" $ TestCase $ withTestDB [] $ \env repo -> do
+      (_, Just stats) <- queryStats env repo $ angleData @Glean.Test.Node
+        [s| glean.test.Node { label = "A".. } |]
+      assertEqual "full scans" [] (userQueryStats_full_scans stats)
+  , TestLabel "one full scan" $ TestCase $ withTestDB [] $ \env repo -> do
+      (_, Just stats) <- queryStats env repo $ angleData @Glean.Test.Edge
+        [s| N = glean.test.Node _;
+            glean.test.Edge { N, _ };
+        |]
+      assertEqual "full scans"
+        [PredicateRef "glean.test.Node" 6 ]
+        (userQueryStats_full_scans stats)
+  , TestLabel "multiple full scans" $ TestCase $ withTestDB [] $ \env repo -> do
+      (_, Just stats) <- queryStats env repo $ angleData @Glean.Test.Edge
+        [s| E where
+            A = glean.test.Node _;
+            B = glean.test.Node _;
+            E = glean.test.Edge { A, B }
+        |]
+      assertEqual "full scans"
+        [ PredicateRef "glean.test.Node" 6
+        , PredicateRef "glean.test.Node" 6
+        ]
+        (userQueryStats_full_scans stats)
+  ]
diff --git a/glean/test/tests/Angle/NestedTest.hs b/glean/test/tests/Angle/NestedTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/NestedTest.hs
@@ -0,0 +1,105 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.NestedTest (main) where
+
+import Test.HUnit
+import TestRunner
+import Util.String.Quasi
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "nested" $ angleNested dbTestCase id
+  , TestLabel "nested/page" $ angleNested dbTestCase (limit 1)
+  ]
+
+-- nested patterns
+angleNested :: (WithDB () -> Test) -> (forall a . Query a -> Query a) -> Test
+angleNested dbTestCase modify = dbTestCase $ \env repo -> do
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.Predicate $
+    [s|
+      glean.test.Predicate { pred = "hello" }
+    |]
+  assertEqual "angle - nested 0" 2 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = cxx1.Name "an".. }
+    |]
+  print results
+  assertEqual "angle - nested 1" 2 (length results)
+
+  -- the predicate name is optional, since the type tells us what it is:
+  results <- runQuery_ env repo $ modify $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = "an".. }
+    |]
+  print results
+  assertEqual "angle - nested 2" 2 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.DualStringPair
+    [s|
+      glean.test.DualStringPair {{"a",_},_}
+    |]
+  print results
+  assertEqual "angle - nested 4" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.RevStringPairs
+    [s|
+      glean.test.RevStringPairs { x = "a", r = {_,"a"} }
+    |]
+  -- this test is on slightly shaky ground, because it generates
+  -- derived RevStringPair facts in two places (nested in the query,
+  -- and again in the body of RevStringPairs), which get de-duped by
+  -- the fact Environment in the query. But paging the query breaks
+  -- de-duping because we use a new Environment each time we restart
+  -- the query, so we can get a different number of results when
+  -- executing this query paged vs. unpaged. To see this, remove
+  -- the x = "a" part of the pattern above. (TODO)
+  print results
+  assertEqual "angle - nested 5" 1 (length results)
+
+  -- or-patterns
+  results <- runQuery_ env repo $ modify $ angle @Glean.Test.StringPair
+    [s|
+      glean.test.StringPair {"a" | "b", _}
+    |]
+  print results
+  assertEqual "angle - nested 6" 2 (length results)
+
+  -- nested generator in an expression
+  r <- runQuery_ env repo $ angle @Cxx.Name
+    [s|
+      (cxx1.Name "foo" where _ = "")
+    |]
+  print r
+  assertEqual "angle - nested predicate pattern in expression" 1 (length r)
+
+  -- nested generator with a type signature
+  results <- runQuery_ env repo $ modify $ angle @Cxx.FunctionName
+    [s|
+      cxx1.FunctionName { name = "an".. : cxx1.Name }
+    |]
+  print results
+  assertEqual "angle - nested type sig" 2 (length results)
+
+  -- we can force a variable to match the key, not the fact ID
+  results <- runQuery_ env repo $ modify $ angle @Cxx.Name
+    [s|
+      cxx1.FunctionName { name = X : string };
+      cxx1.Name X
+    |]
+  print results
+  assertEqual "angle - nested type sig 2" 11 (length results)
diff --git a/glean/test/tests/Angle/OptTest.hs b/glean/test/tests/Angle/OptTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/OptTest.hs
@@ -0,0 +1,209 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.OptTest (main) where
+
+import Data.Default
+import Data.Int
+import Data.Map (Map)
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text)
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Backend.Types as Backend
+import Glean.Init
+import Glean.Query.Angle as Angle
+import Glean.Query.Thrift as Thrift
+import Glean.Query.Thrift.Internal
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Typed hiding (end)
+import Glean.Types
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "opt" optTest
+  ]
+
+queryStats
+  :: forall q backend . (Backend backend)
+  => backend
+  -> Repo
+  -> Query q
+  -> IO ([q], Maybe UserQueryStats)
+
+queryStats be repo (Query query) = do
+  let
+    opts = fromMaybe def (userQuery_options query)
+    query' = query
+      { userQuery_encodings = [UserQueryEncoding_bin def]
+      , userQuery_options = Just
+        opts { userQueryOptions_collect_facts_searched = True }
+      }
+  UserQueryResults{..} <- userQuery be repo query'
+  results <- decodeResults userQueryResults_results decodeAsFact
+  return (results, userQueryResults_stats)
+
+
+factsSearched
+  :: PredicateRef
+  -> Map PredicateRef Int64
+  -> Maybe UserQueryStats
+  -> Maybe Int
+factsSearched ref lookupPid maybeStats = do
+  pid <- Map.lookup ref lookupPid
+  stats <- maybeStats
+  searched <- userQueryStats_facts_searched stats
+  count <- Map.lookup pid searched
+  return (fromIntegral count)
+
+optTest :: Test
+optTest = dbTestCase $ \env repo -> do
+  si <- getSchemaInfo env (Just repo) def { getSchemaInfo_omit_source = True }
+  let lookupPid = Map.fromList
+        [ (ref,pid) | (pid,ref) <- Map.toList (schemaInfo_predicateIds si) ]
+
+  -- Test unification: this query should be as efficient as simply
+  --    cxx1.Name "an"..
+  (_, stats) <- queryStats env repo $ angle @Cxx.Name
+    [s|
+      N where
+        {Y,_} = W : {a : string, b : nat};
+        N = cxx1.Name X;
+        X = Y;
+        W = {"an".., 3}
+    |]
+  assertEqual "opt 1" (Just 2) $
+    factsSearched (PredicateRef "cxx1.Name" 5) lookupPid stats
+
+  -- test that unification can optimise A = B | C, unifying A/B and A/C
+  (_, stats) <- queryStats env repo $ angle @Cxx.Name
+    [s|
+      N where
+        {"an".., N} =
+          {X:string, cxx1.Name X} |
+          {"def", cxx1.Name "def"}
+    |]
+  assertEqual "opt 2" (Just 2) $
+    factsSearched (PredicateRef "cxx1.Name" 5) lookupPid stats
+
+  -- test for recursive substitution
+  r <- runQuery_ env repo $ angleData @Nat $
+    [s|
+      X where X = Y : nat; Y = X; X = 3
+    |]
+  assertEqual "opt 3" [Nat 3] r
+
+  -- test for optimised ordering of nested fact patterns
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      S where
+        glean.test.Predicate {
+          string_ = "clobber",
+          sum_ = { c = { string_ = S }}
+        }
+    |]
+  assertEqual "opt 4" (Just 4) $
+    factsSearched (PredicateRef "glean.test.Predicate" 6) lookupPid stats
+
+  -- test for optimising away unmatchable alternative without
+  -- removing matchable ones
+  r <- runQuery_ env repo $ angleData @Nat
+    [s|
+      1 = (2|1); 1
+    |]
+  assertEqual "opt 5" 1 (length r)
+
+  -- Test for optimising away unmatchable alternatives.
+  (_, stats) <- queryStats env repo $ angleData @Text
+    [s|
+      B where
+      { "a", B } =
+          # this should be optimised away:
+        ( { A, B } where glean.test.StringPair { A, B }; A = "b") |
+          # leaving this only:
+        ( { A, B } where glean.test.StringPair { A, B }; A = "a")
+     |]
+  -- we can tell the first alternative was optimised away by counting
+  -- the number of facts searched for glean.test.StringPair.
+  assertEqual "optimise or 1" (Just 1) $
+    factsSearched (PredicateRef "glean.test.StringPair" 6) lookupPid stats
+
+  -- Test that unification works properly with literal fact IDs
+  result : _ <- runQuery_ env repo (allFacts :: Query Glean.Test.StringPair)
+  let fid = factId (getId result)
+  results <- runQuery_ env repo $ Angle.query $ fid `where_` [ fid .= fid ]
+  assertEqual "unify fact Id" 1 (length results)
+
+  -- Test that trivially false negations fail the entire query
+  (_, stats) <- queryStats env repo $ angle @Glean.Test.StringPair
+    [s|
+      A where
+        A = glean.test.StringPair _;
+        !(1 = 1);
+    |]
+  assertEqual "opt - negation" Nothing $
+    factsSearched (PredicateRef "glean.test.StringPair" 6) lookupPid stats
+
+  -- Test for unification inside negation
+  (_, stats) <- queryStats env repo $ angleData @Nat
+    [s|
+      A where
+        !(!(glean.test.Node { label = X }; X = "g"..));
+        A = 1;
+    |]
+  assertEqual "opt - negation 2" (Just 1) $
+    factsSearched (PredicateRef "glean.test.Node" 6) lookupPid stats
+
+  -- a false condition in an if pattern gets optimised away.
+  (_, stats) <- queryStats env repo $ angleData @Nat
+    [s|
+      if (1 = 2; glean.test.StringPair _)
+        then 1
+        else 1
+     |]
+  assertEqual "optimise if condition" Nothing $
+    factsSearched (PredicateRef "glean.test.StringPair" 6) lookupPid stats
+
+  -- we should recognise that the `cxx1.Name _` statement only checks
+  -- whether there is any cxx1.Name fact in the db and stop after finding
+  -- the first result.
+  (_, stats) <- queryStats env repo $ angle @Glean.Test.Predicate
+    [s| cxx1.Name _;
+        glean.test.Predicate _
+    |]
+  assertEqual "optimise existence check" (Just 1) $
+    factsSearched (PredicateRef "cxx1.Name" 5) lookupPid stats
+
+  -- check that we unify multiple fact generators
+  (_, stats) <- queryStats env repo $ angleData @(Text, Text)
+    [s| {A, B} where
+        X = glean.test.StringPair { _, "b" };
+        X = glean.test.StringPair { "a", _ };
+        X = glean.test.StringPair { A, B };
+    |]
+  assertEqual "optimise multiple generators" (Just 1) $
+    factsSearched (PredicateRef "glean.test.StringPair" 6) lookupPid stats
+
+  -- Check that the optimiser doesn't get too excited and eliminate generators
+  -- that don't bind any variables. These can still fail if they don't match
+  -- any facts.
+  results <- runQuery_ env repo $ angleData @Nat
+    [s|
+      1 where glean.test.StringPair { "none", _ }
+    |]
+  assertEqual "check that we don't eliminate empty fact generators"
+    0 (length results)
diff --git a/glean/test/tests/Angle/RecExpansionTest.hs b/glean/test/tests/Angle/RecExpansionTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/RecExpansionTest.hs
@@ -0,0 +1,125 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.RecExpansionTest (main) where
+
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $ TestList
+  [ TestLabel "recExpansion" $ angleRecExpansion dbTestCase id
+  , TestLabel "recExpansion/page" $ angleRecExpansion dbTestCase (limit 1)
+  ]
+
+angleRecExpansion
+  :: (WithDB () -> Test)
+  -> (forall a . Query a -> Query a)
+  -> Test
+angleRecExpansion dbTestCase modify = dbTestCase $ \env repo -> do
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.TreeToTree
+    [s|
+      glean.test.TreeToTree { node = { label = "a" } }
+    |]
+  assertBool "recursive expand key" $ case results of
+    [ Glean.Test.TreeToTree
+      { treeToTree_key =
+          Just Glean.Test.Tree
+            { tree_key =
+              Just Glean.Test.Tree_key
+                { tree_key_node = Glean.Test.Node {
+                    node_key = Just (Glean.Test.Node_key "a")
+                  }
+                , tree_key_left =
+                    Just Glean.Test.Tree
+                      { tree_key =
+                          Just Glean.Test.Tree_key
+                            { tree_key_node = Glean.Test.Node {
+                                node_key = Just (Glean.Test.Node_key "b")
+                              }
+                            , tree_key_right =
+                                Just Glean.Test.Tree
+                                  { tree_key =
+                                      Just Glean.Test.Tree_key
+                                        { tree_key_node = Glean.Test.Node {
+                                            node_key = Just (Glean.Test.Node_key "d")
+                                        }}
+                                  }
+                            }
+                      }
+                }
+            }
+      , treeToTree_value =
+          Just Glean.Test.Tree
+            { tree_key =
+              Just Glean.Test.Tree_key
+                { tree_key_node = Glean.Test.Node {
+                    node_key = Just (Glean.Test.Node_key "e")
+                  }
+                , tree_key_left =
+                    Just Glean.Test.Tree
+                      { tree_key =
+                          Just Glean.Test.Tree_key
+                            { tree_key_node = Glean.Test.Node {
+                                node_key = Just (Glean.Test.Node_key "f")
+                            }
+                            , tree_key_right =
+                                Just Glean.Test.Tree
+                                  { tree_key =
+                                      Just Glean.Test.Tree_key
+                                        { tree_key_node = Glean.Test.Node {
+                                            node_key = Just (Glean.Test.Node_key "g")
+                                        }}
+                                  }
+                            }
+                      }
+                }
+            }
+      }] -> True
+    _ -> False
+
+  results <- runQuery_ env repo $ modify $ recursive $
+    angle @Glean.Test.FooToFoo
+    [s|
+      glean.test.FooToFoo "foo1"
+    |]
+  assertBool "recursive expand value" $ case results of
+    [ Glean.Test.FooToFoo
+        { fooToFoo_key =
+            Just Glean.Test.Foo
+              { foo_key = Just "foo1"
+              , foo_value =
+                  Just Glean.Test.Bar
+                    { bar_key = Just "bar1"
+                    , bar_value =
+                      Just Glean.Test.Qux  { qux_key = Just "qux1"}
+                    }
+              }
+        , fooToFoo_value =
+            Just Glean.Test.Foo
+              { foo_key = Just "foo2"
+              , foo_value =
+                  Just Glean.Test.Bar
+                    { bar_key = Just  "bar2"
+                    , bar_value =
+                      Just Glean.Test.Qux  { qux_key = Just "qux2"}
+                    }
+              }
+        }] -> True
+    _ -> False
diff --git a/glean/test/tests/Angle/SetTest.hs b/glean/test/tests/Angle/SetTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/SetTest.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+module Angle.SetTest (main) where
+
+import Control.Exception hiding (assert)
+import Control.Monad.Trans.Except
+import Control.Monad.Except
+import Data.Default
+import Data.List
+import Data.Text (Text, unpack)
+import Data.Word
+
+import Glean.Angle.Parser
+import Glean.Angle.Types hiding (Nat, Type)
+import Glean.Init
+import Glean.Query.Typecheck
+import Glean.Query.Flatten
+import Glean.Query.Thrift as Thrift
+import Glean.Schema.Resolve
+import Glean.Database.Schema.Types
+import Glean.Database.Test
+import Glean.Database.Types
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Typed.Binary
+import Glean.Types
+
+import qualified Data.HashMap.Strict as HashMap
+import Data.Set
+
+import Test.HUnit
+import TestRunner
+import Util.String.Quasi
+import Util.FFI
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ withDbTests $ \dbTestCase -> testRunner $
+  TestList
+    [ TestLabel "set parse" setParseTest
+    , TestLabel "set semantics" $ setSemanticsTest dbTestCase
+    , TestLabel "set limit" setLimitTest
+    ]
+
+-- First version to support sets
+v :: AngleVersion
+v = AngleVersion 9
+
+setParseTest :: Test
+setParseTest = TestList
+    [ TestLabel "schema parses" $ TestCase $
+        case parseSchemaWithVersion v
+            [s|
+            schema foo {
+            type Foo = set (maybe nat)
+            }
+            |]
+        of
+            Left err ->
+              assertFailure $ "Parsing schema failed with error:\n" <> err
+            Right _ -> return ()
+    , TestLabel "query parses" $ TestCase $
+        case parseQueryWithVersion  v
+            [s| all (all (all Y))
+            |]
+        of
+            Left err ->
+              assertFailure $ "Parsing query failed with error:\n" <> err
+            Right _ -> return ()
+    , TestLabel "query type checks" $ TestCase $
+        case parseQueryWithVersion v
+            [s| 1 = elements(all(1)) ; 1
+            |]
+        of
+            Left err ->
+                assertFailure $ "Parsing query failed with error:\n" <> err
+            Right parsed -> do
+              r <- runExceptT $ do
+                let scope = addTmpPredicate HashMap.empty
+                resolved <- liftEither $ runExcept $
+                  runResolve v scope (resolveQuery parsed)
+                typecheck undefined (defaultTcOpts def v) undefined resolved
+              case r of
+                Left err ->
+                    assertFailure $
+                      "Resolving and typechecking query failed with error:\n"
+                      <> unpack err
+                Right _ -> return ()
+    , TestLabel "query flattens" $ TestCase $
+        case parseQueryWithVersion v
+            [s| 1 = elements(all(1)) ; 1
+            |]
+        of
+            Left err ->
+                assertFailure $ "Parsing query failed with error:\n" <> err
+            Right parsed -> do
+              r <- runExceptT $ do
+                let scope = addTmpPredicate HashMap.empty
+                resolved <- liftEither $ runExcept $
+                  runResolve v scope (resolveQuery parsed)
+                (typechecked, _) <-
+                  typecheck undefined (defaultTcOpts def v) undefined resolved
+                liftEither $ runExcept $
+                  flatten DisableRecursion undefined v  False typechecked
+              case r of
+                Left err ->
+                    assertFailure $
+                      "Resolving, typechecking and "
+                      <> "flatting query failed with error:\n"
+                      <> unpack err
+                Right _ -> return ()
+    ]
+
+setSemanticsTest :: ((Env -> Repo -> IO ()) -> Test) -> Test
+setSemanticsTest dbTestCase = TestList
+  [ TestLabel "all of two strings" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @(Set Text) [s| all ("foo"|"bar") |]
+      assertEqual "two results in a set" r [fromList ["foo", "bar"]]
+  , TestLabel "all of two nats" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Nat [s| elements (all (1|2)) |]
+      assertEqual "two separate results" r [Nat 1, Nat 2]
+  , TestLabel "all of big number" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Nat [s| elements (all 65535) |]
+      assertEqual "big nat" r [Nat 65535]
+  , TestLabel "all of bytes" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Byte
+        [s| elements (all (1 : byte | 240)) |]
+      assertEqual "big byte" [Byte 1, Byte (fromIntegral (240 :: Word8))] r
+  , TestLabel "size of a set" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Nat [s| prim.size (all (1|2|3))|]
+      assertEqual "size" r [Nat 3]
+  , TestLabel "sets in predicates" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Glean.Test.Predicate
+        [s| glean.test.Predicate { set_of_string = all ("bepa" | "apa") } |]
+      assertEqual "angle - set matching" 2 (length r)
+  , TestLabel "element syntax for set" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Nat [s| (all (1|2))[..] |]
+      assertEqual "results" [Nat 1, Nat 2] (sort r)
+  , TestLabel "element syntax for set 2" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @Nat [s| (all (1|2))[..] : nat |]
+      assertEqual "results" [Nat 1, Nat 2] (sort r)
+  , TestLabel "multiple set results" $ dbTestCase $ \env repo -> do
+      r <- runQuery_ env repo $ angleData @(Set Nat) [s| all X where X= (1|2) |]
+      assertEqual "results" 2 (length r)
+  , TestLabel "predicate in all" $ dbTestCase $ \env repo -> do
+      [set] <- runQuery_ env repo $ angleData @(Set Glean.Test.Predicate)
+        [s| all (glean.test.Predicate _) |]
+      assertEqual "angle - set matching" 4 (size set)
+  ]
+
+setLimitTest :: Test
+setLimitTest = TestList
+  [ TestLabel  "Fail when exceeding limit for nat set" $
+      testQuery @(Set Nat) [s| all (1|2) |]
+        "Set size limit exceeded for nat set. Max size: 8. Size: 9"
+  , TestLabel "Fail when exceeding limit for byte set" $
+      testQuery @(Set Byte)
+        [s| all ( 1 : byte | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ) |]
+        "Set size limit exceeded for nat set. Max size: 8. Size: 9"
+  , TestLabel "Fail when exceeding limit for string set" $
+      testQuery @(Set Text) [s| all ("foo"|"bar") |]
+        "Set size limit exceeded for standard set. Max size: 8. Size: 10"
+  ]
+
+testQuery :: forall ty . (Show ty, Type ty) => Text -> String -> Test
+testQuery query errMsg =
+  dbTestCaseSettings [setMaxSetSize 8] $ \env repo -> do
+    r <- try (runQuery_ env repo $ angleData query)
+          :: IO (Either FFIError [ty])
+    case r of
+      Left ffiExc -> do
+        let runtimeMsg =
+              Prelude.take (Prelude.length errMsg) (ffiErrorMessage ffiExc)
+        assertEqual "Exception" errMsg runtimeMsg
+      Right v -> do
+        print v
+        assert False
diff --git a/glean/test/tests/Angle/StoredTest.hs b/glean/test/tests/Angle/StoredTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Angle/StoredTest.hs
@@ -0,0 +1,100 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module Angle.StoredTest (main) where
+
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "stored" $ angleStored id
+  , TestLabel "stored/page" $ angleStored (limit 1)
+  ]
+
+-- Test storing derived facts
+angleStored :: (forall a . Query a -> Query a) -> Test
+angleStored modify = dbTestCaseWritable $ \env repo -> do
+  -- initially zero facts
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "angle - stored 0" 0 (length results)
+
+  -- still zero facts since StoredRevStringPair is not derived yet
+  results <- runQuery_ env repo $ modify $ store $
+    angle @Glean.Test.StoredRevStringPairWithA $
+    [s|
+      glean.test.StoredRevStringPairWithA _
+    |]
+  assertEqual "angle - stored 1" 0 (length results)
+
+  -- no facts derived due to the above
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "angle - stored 2" 0 (length results)
+
+  -- compute and store, returns 6 facts
+  results <- runQuery_ env repo $ modify $ store $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "angle - stored 3" 6 (length results)
+
+  -- now there should be 6 facts stored in the DB
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "angle - stored 4" 6 (length results)
+
+  -- StoredRevStringPair is now derived
+  results <- runQuery_ env repo $ modify $ store $
+    angle @Glean.Test.StoredRevStringPairWithA $
+    [s|
+      glean.test.StoredRevStringPairWithA _
+    |]
+  assertEqual "angle - stored 5" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.StoredRevStringPairWithA $
+    [s|
+      glean.test.StoredRevStringPairWithA _
+    |]
+  assertEqual "angle - stored 6" 1 (length results)
+
+  results <- runQuery_ env repo $ modify $ store $
+    angle @Glean.Test.EdgeFromNotA $
+    [s|
+      glean.test.EdgeFromNotA _
+    |]
+  assertEqual "angle - stored 7" 2 (length results)
+
+  results <- runQuery_ env repo $ modify $
+    angle @Glean.Test.EdgeFromNotA $
+    [s|
+      glean.test.EdgeFromNotA _
+    |]
+  assertEqual "angle - stored 7" 2 (length results)
diff --git a/glean/test/tests/ApiTest.hs b/glean/test/tests/ApiTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/ApiTest.hs
@@ -0,0 +1,183 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module ApiTest (main) where
+
+import Control.Exception
+import Data.ByteString (ByteString)
+import Data.Text (Text)
+import Glean.Query.Angle
+import Glean.Query.Thrift
+import Glean.Init
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Types
+import Test.HUnit
+import TestRunner
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "angle DSL" angleDSL
+  ]
+
+angleDSL :: Test
+angleDSL = dbTestCase $ \env repo -> do
+  results <- runQuery env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $
+        field @"string_" "acca" $
+        field @"nat" (nat 42) $
+        field @"array_of_nat" (array [nat 3, nat 4, nat 5]) $
+        field @"bool_" false
+      end
+  assertEqual "angle - DSL 0" 1 (length results)
+
+  results <- runQuery env repo $ query $
+    var $ \p -> p `where_`
+      [ wild .= predicate @Glean.Test.Predicate (
+          rec $
+            field @"sum_" (
+              alt @"c" (asPredicate p))
+          end)
+      , p .= predicate @Glean.Test.Predicate (
+          rec $
+            field @"string_" "abba"
+          end)
+      ]
+  assertEqual "angle - DSL 1" 1 (length results)
+
+  results <- runQuery env repo $ query $
+    predicate @Glean.Test.Tree $
+      rec $
+        field @"left" (just wild) $
+        field @"right" nothing
+      end
+  assertEqual "angle - DSL 2" 1 (length results)
+
+  results <- runQuery_ env repo $ query $
+    vars $ \x y ->
+      tuple (x,y) `where_` [
+        x .= nat 1,
+        y .= nat 2
+      ]
+  assertEqual "angle - DSL 3" [(Nat 1, Nat 2)] results
+
+  results <- runQuery_ env repo $ query $
+    vars $ \x ->
+      x `where_` [
+        x .= elementsOf (array [nat 1, nat 2, nat 3 ]),
+        not_ [x .= (nat 1 .| nat 3)]
+      ]
+  assertEqual "angle - DSL 4" [Nat 2] results
+
+  -- This is just a compile test, inference should not fail with an
+  -- ambiguous type error.
+  _results <- runQuery_ env repo $ query $
+    vars $ \(x :: Angle Text) ->
+      x `where_` [
+        wild .= predicate @Glean.Test.Node (rec $ field @"label" x end)
+      ]
+
+  results <- runQuery_ env repo $ query $
+    var $ \p -> p `where_` [p .= sig (never @Glean.Test.Predicate)]
+  assertEqual "angle - DSL 4" 0 (length results)
+
+  results <- runQuery_ env repo $ query  @((), Bool, Text) $
+    var $ \p -> p `where_`
+      [ wild .= sig (wild @Glean.Test.Predicate)
+      , wild .= sig unit
+      , wild .= sig true
+      , wild .= sig (string "a")
+      , wild .= sig (nat 1)
+      , wild .= sig @Glean.Test.Sum (alt @"wed" true)
+      , wild .= sig (array [nat 1, nat 2])
+      , wild .= sig (nothing :: Angle (Maybe Glean.Test.Predicate))
+      , wild .= sig (tuple (unit, true))
+      , p .= sig (tuple (unit, true, string "a"))
+      ]
+  assertEqual "angle - DSL type signatures" 1 (length results)
+
+  -- test for a bug in which RecordFields and SumFields gave the wrong
+  -- type for a predicate nested inside an array or maybe type.
+  results <- runQuery_ env repo $ query @[Glean.Test.Predicate] $
+    var $ \p -> p `where_` [
+      wild .= predicate @Glean.Test.Predicate (
+        rec $ field @"array_of_pred" p end)
+    ]
+  assertEqual "angle - DSL 5" 2 (length (concat results))
+
+  -- test for type inference with the DSL. If we don't tell the compiler
+  -- what type we're expecting for the variable `p` it will assume
+  -- the type of the field (Sys.Blob) rather than the key type (ByteString)
+  -- and we'll get a deserialization error.
+  r <- try $ runQuery_ env repo $
+    query @(ByteString,ByteString) $
+      var $ \p -> tuple (p,p) `where_` [
+        wild .= predicate @Glean.Test.Predicate (
+          rec $
+           field @"pred" p
+          end)
+      ]
+  print r
+  assertBool "angle - DSL 6" $ case r of
+    Left BadQuery{} -> True
+    _ -> False
+
+  -- Test signatures around `elementsOf`. T192115813
+  r <- runQuery_ env repo $
+    query @Nat $
+      sig (elementsOf (array [nat 1, nat 2]))
+  print r
+  assertEqual "angle - sig elementsOf" r [Nat 1, Nat 2]
+
+  -- Test "expanding"
+  r <- runQuery_ env repo $
+    keys $
+    expanding @Glean.Test.Node $
+    query @Glean.Test.Tree $
+      predicate @Glean.Test.Tree (
+        rec $
+          field @"node" (rec $
+            field @"label" "a"
+          end)
+        end)
+  print r
+  assertBool "angle - expanding" $ case r of
+    [Glean.Test.Tree_key
+      { tree_key_node = Glean.Test.Node
+        { node_key = Just{} }
+      , tree_key_left = Just Glean.Test.Tree { tree_key = Nothing }
+      , tree_key_right = Just Glean.Test.Tree { tree_key = Nothing }
+      }] -> True
+    _ -> False
+
+  r <- runQuery_ env repo $
+        query $ var $ \x -> zipp x x `where_` [
+          stmt $
+            predicate @Glean.Test.Predicate (
+                rec $
+                  field @"nat" (nat 42) $
+                  field @"array_of_nat" x
+                end)
+        ]
+  print r
+  assertEqual "angle - DSL zip" [[(Nat 1, Nat 1),(Nat 2, Nat 2)]] r
+
+  r <- runQuery_ env repo $
+        query $ var $ \x -> conc x x `where_` [
+          stmt $
+            predicate @Glean.Test.Predicate (
+                rec $
+                  field @"nat" (nat 42) $
+                  field @"array_of_nat" x
+                end
+            )
+        ]
+  print r
+  assertEqual "concat" [[Nat 1, Nat 2, Nat 1, Nat 2]] r
diff --git a/glean/test/tests/BackupTest.hs b/glean/test/tests/BackupTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/BackupTest.hs
@@ -0,0 +1,313 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
+module BackupTest (main) where
+
+import Util.STM
+import Control.Monad
+import Data.Default
+import qualified Data.HashSet as HashSet
+import Data.Int (Int64)
+import Data.List
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Time.Clock
+import System.IO.Temp
+import Test.HUnit
+
+import TestRunner
+import Util.EventBase
+
+import Glean.Backend.Local ()
+import Glean.Backend.Types
+import Glean.Database.Backup (Event(..))
+import qualified Glean.Database.Backup.Backend as Backup
+import qualified Glean.Database.Backup.Mock as Backup.Mock
+import Glean.Database.Catalog as Catalog
+import Glean.Database.Config
+import Glean.Database.Env
+import Glean.Database.Janitor
+import Glean.Database.Meta
+import Glean.Database.Types
+import Glean.Database.Finish (finalizeWait)
+import Glean.Init
+import Glean.ServerConfig.Types as ServerTypes
+import Glean.Types as Thrift
+import Glean.Util.ConfigProvider
+import Glean.Util.ThriftSource as ThriftSource
+import Glean.Util.Trace
+import Glean.Util.IO (withTempFileContents)
+import Glean.Internal.Types (Completeness(Complete))
+import qualified Glean.Database.Storage as Storage
+
+withTest
+  :: (EventBaseDataplane -> NullConfigProvider -> FilePath -> IO ())
+  -> IO ()
+withTest action =
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider defaultConfigOptions $ \cfgAPI ->
+  withSystemTempDirectory "glean-dbtest-backup" $ \backupdir ->
+    action evb cfgAPI backupdir
+
+data TestEnv = forall site. Backup.Site site => TestEnv
+  { testEnv :: Env
+  , testBackup :: site
+  , testUpdConfig :: (ServerTypes.Config -> ServerTypes.Config) -> IO ()
+  , testEvents :: TQueue Event
+  }
+
+data TestDbSpec
+  = TestDbSpec
+    { testDbRepo :: Repo
+    , testDbAge :: Int
+    , testDbDeps :: Maybe Dependencies
+    }
+  | CloudTestDbSpec
+    { testDbRepo :: Repo
+    , testDbAge :: Int
+    , testDbSize :: Int64
+    , testDbDeps :: Maybe Dependencies
+    }
+
+goodDb :: Text -> Text -> TestDbSpec
+goodDb name hash = TestDbSpec (Repo name hash) 0 Nothing
+
+goodDbAge :: Text -> Text -> Int -> TestDbSpec
+goodDbAge name hash age = TestDbSpec (Repo name hash) age Nothing
+
+goodDbAgeDeps :: Text -> Text -> Int -> Dependencies -> TestDbSpec
+goodDbAgeDeps name hash age deps =
+  TestDbSpec (Repo name hash) age (Just deps)
+
+withTestEnv
+  :: [TestDbSpec]
+  -> (ServerTypes.Config -> ServerTypes.Config)
+  -> (TestEnv -> IO ())
+  -> EventBaseDataplane
+  -> NullConfigProvider
+  -> FilePath
+  -> IO ()
+withTestEnv dbs init_server_cfg action evb cfgAPI backupdir = do
+  (server_cfg, update_server_cfg) <- ThriftSource.mutable $ init_server_cfg def
+    { config_backup = def
+      { databaseBackupPolicy_allowed = mempty
+      , databaseBackupPolicy_location = "mock:" <> Text.pack backupdir
+      }
+    , config_restore = def
+      { databaseRestorePolicy_enabled = False
+      }
+    , config_janitor_period = Nothing -- no auto janitor, we'll run it manually
+    , config_db_rocksdb_cache_mb = 0
+    }
+  (l, events) <- recorder
+  let config = def
+        { cfgDataStore = tmpDataStore
+        , cfgSchemaLocation = Just schemaLocationFiles
+        , cfgServerConfig = server_cfg
+        , cfgReadOnly = False
+        , cfgMockWrites = False
+        , cfgListener = l
+        }
+
+  withDatabases evb config cfgAPI $ \env -> do
+    now <- getCurrentTime
+    let testEnv = TestEnv
+          { testEnv = env
+          , testBackup = Backup.Mock.mockSite backupdir
+          , testUpdConfig = update_server_cfg
+          , testEvents = events
+          }
+    mapM_ (makeDB testEnv now) dbs
+    action testEnv
+
+expectBackups :: [Repo] -> Expect Event
+expectBackups repos = parallel
+  [ opt (want Waiting) <> wants [ BackupStarted repo, BackupFinished repo ]
+  | repo <- repos ]
+
+expectRestore :: [Repo] -> Expect Event
+expectRestore repos = parallel
+  [ opt (want Waiting) <> wants [ RestoreStarted repo, RestoreFinished repo ]
+  | repo <- repos ]
+
+expectFinalize :: [Repo] -> Expect Event
+expectFinalize repos = parallel
+  [ opt (want Waiting) <> wants [ FinalizeStarted repo, FinalizeFinished repo ]
+  | repo <- repos ]
+
+created :: Integral a => a -> UTCTime -> UTCTime
+created t = addUTCTime (negate (fromIntegral t))
+
+makeDB :: TestEnv -> UTCTime -> TestDbSpec -> IO ()
+makeDB TestEnv{testEnv = env} now (TestDbSpec repo age deps) = do
+  KickOffResponse False <- kickOffDatabase env def
+    { kickOff_repo = repo
+    , kickOff_dependencies = deps
+    }
+  void $ atomically $ Catalog.modifyMeta (envCatalog env) repo $ \meta ->
+    return meta { metaCreated = utcTimeToPosixEpochTime (created age now) }
+  void $ finishDatabase env repo
+  finalizeWait env repo
+
+makeDB TestEnv{testBackup} now CloudTestDbSpec{..} =
+  withTempFileContents ("" :: String) $ \path ->
+  void $ Backup.backup testBackup testDbRepo props Nothing path
+  where
+    dbtime = utcTimeToPosixEpochTime (created testDbAge now)
+    props = Meta
+        { metaVersion = Storage.currentVersion
+        , metaCreated = dbtime
+        , metaRepoHashTime = Nothing
+        , metaCompleteness =
+          Complete $ DatabaseComplete dbtime (Just testDbSize)
+        , metaBackup = Nothing
+        , metaProperties = mempty
+        , metaDependencies = testDbDeps
+        , metaCompletePredicates = mempty
+        , metaAxiomComplete = False
+        }
+
+basicBackupTest :: Test
+basicBackupTest = TestCase $ withTest $ withTestEnv
+  repos
+  id
+  $ \TestEnv{..} -> do
+    expect testEvents $ mconcat
+      [ expectFinalize [repo | TestDbSpec repo _ _ <- repos] ]
+    testUpdConfig $ \scfg -> scfg
+      { config_backup = (config_backup scfg)
+          { databaseBackupPolicy_allowed = HashSet.fromList ["test"] } }
+    expect testEvents $ mconcat
+      [ expectBackups [repo | TestDbSpec repo _ _ <- repos]
+      , want Waiting ]
+
+    backups <- Backup.enumerate testBackup
+    assertEqual "repos"
+      (sort [repo | TestDbSpec repo _ _ <- repos])
+      (sort [repo | (repo, _) <- backups])
+  where
+    repos :: [TestDbSpec]
+    repos =
+      [ goodDb "test" "1"
+      , goodDb "test" "2"
+      , goodDb "test" "3" ]
+
+allowedTest :: Test
+allowedTest = TestCase $ withTest $ withTestEnv
+  repos
+  id
+  $ \TestEnv{..} -> do
+    expect testEvents $ mconcat
+      [ expectFinalize [repo | TestDbSpec repo _ _ <- repos] ]
+    testUpdConfig $ \scfg -> scfg
+      { config_backup = (config_backup scfg)
+          { databaseBackupPolicy_allowed = HashSet.fromList ["bar"] }}
+    expect testEvents $ mconcat
+      [ expectBackups [repo | TestDbSpec repo _ _ <- repos,
+          repo_name repo == "bar"]
+      , want Waiting ]
+  where
+    repos :: [TestDbSpec]
+    repos =
+      [ goodDb "foo" "1"
+      , goodDb "bar" "2"
+      , goodDb "foo" "3"
+      , goodDb "baz" "4"
+      , goodDb "bar" "5" ]
+
+restoreOrderTest :: Test
+restoreOrderTest = TestCase $ withTest $ withTestEnv
+  repos
+  id
+  $ \TestEnv{..} -> do
+    expect testEvents $ mconcat
+      [ expectFinalize [repo | TestDbSpec repo _ _ <- repos] ]
+    testUpdConfig $ \scfg -> scfg
+      { config_backup = (config_backup scfg)
+          { databaseBackupPolicy_allowed =
+              HashSet.fromList ["bar","foo","baz"] }}
+    expect testEvents $ mconcat
+      [ expectBackups [repo | TestDbSpec repo _ _ <- repos ]
+      , want Waiting ]
+
+    -- delete all the repos and run the janitor to start restoring
+    forM_ repos $ \(TestDbSpec repo _ _) -> deleteDatabase testEnv repo
+    testUpdConfig $ \scfg -> scfg
+      { config_restore = def { databaseRestorePolicy_enabled = True } }
+    runDatabaseJanitor testEnv
+
+    -- restoring picks the newest DB of each repo to restore, and then
+    -- picks the first of those ordered by staleness, and then most
+    -- recent.
+
+    -- local: []
+    -- newest restorable for each repo:
+    --    Repo "foo" "3", True, 1
+    --    Repo "bar" "5", True, 0
+    -- all are equally stale, so we pick the newest, bar/5
+    expect testEvents $ expectRestore [ Repo "bar" "5" ]
+
+    -- local: [bar/5]
+    -- newest restorable for each repo:
+    --    Repo "foo" "3", True, 1
+    --    Repo "baz" "4", True, 3
+    --    Repo "bar" "2", True, 1
+    -- foo, baz are stale, foo/3 is the newest
+    expect testEvents $ expectRestore [ Repo "foo" "3" ]
+
+    -- local: [bar/5, foo/3]
+    -- newest restorable for each repo:
+    --    Repo "foo" "1", True, 2
+    --    Repo "baz" "4", True, 3
+    --    Repo "bar" "2", True, 1
+    -- baz is stale
+    expect testEvents $ expectRestore [ Repo "baz" "4" ]
+
+    -- local: [bar/5, foo/3, baz/4]
+    -- newest restorable for each repo:
+    --    Repo "foo" "1", True, 2
+    --    Repo "bar" "2", True, 1
+    -- none stale, bar/2 is the newest, but it depends on foo/1, so
+    -- we should restore that first.
+    expect testEvents $ expectRestore [ Repo "foo" "1" ]
+    expect testEvents $ expectRestore [ Repo "bar" "2" ]
+  where
+    repos :: [TestDbSpec]
+    repos =
+      [ goodDbAge "foo" "1" 2
+      , goodDbAge "foo" "3" 1
+      , goodDbAgeDeps "bar" "2" 1 $
+          Dependencies_stacked (Stacked "foo" "1" Nothing)
+      , goodDbAge "bar" "5" 0
+      , goodDbAge "baz" "4" 3
+      ]
+
+restoreNoDiskSpaceTest :: Test
+restoreNoDiskSpaceTest =
+  TestCase $ withTest $ withTestEnv repos id $ \TestEnv{..} -> do
+    testUpdConfig $ \scfg -> scfg
+      { config_restore = def { databaseRestorePolicy_enabled = True }
+      }
+    runDatabaseJanitor testEnv
+    expect testEvents $
+       opt (want Waiting) <> wants [ RestoreStarted repo, RestoreFailed repo ]
+
+  where
+    repo = Repo "foo" "1"
+    repos = [ CloudTestDbSpec repo 1 (10*tb) Nothing]
+    tb :: Int64
+    tb = 1000000000000
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "basicBackup" basicBackupTest
+  , TestLabel "allowedTest" allowedTest
+  , TestLabel "restoreOrderTest" restoreOrderTest
+  , TestLabel "restoreNoDiskSpace" restoreNoDiskSpaceTest
+  ]
diff --git a/glean/test/tests/CatalogTest.hs b/glean/test/tests/CatalogTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/CatalogTest.hs
@@ -0,0 +1,282 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module CatalogTest (main) where
+
+import Control.Concurrent.MVar
+import Util.STM
+import Control.Exception hiding (assert)
+import Control.Monad
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import Data.List
+import Data.Proxy
+import qualified Data.Text as Text
+import GHC.Stack (HasCallStack)
+import Test.HUnit
+import Test.QuickCheck
+import Test.QuickCheck.IO ()
+
+import TestRunner
+import Util.Testing
+
+import Glean.Database.Catalog (Catalog)
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter
+import qualified Glean.Database.Catalog.Store as Store
+import Glean.Database.Catalog.Test
+import Glean.Init
+import Glean.Test.HUnit
+import Glean.Repo.Text
+import Glean.Test.Mock
+import Glean.Internal.Types
+import Glean.Types hiding (Exception)
+
+repos :: [Repo]
+repos = [Repo "foo" (Text.pack $ show n) | n <- [1 .. 12 :: Int]]
+
+data CreateDelete = Create | Delete
+  deriving(Eq,Ord,Enum,Bounded,Read,Show)
+
+instance Arbitrary CreateDelete where
+  arbitrary = elements [Create,Delete]
+
+newtype ARepo = ARepo Repo
+  deriving(Eq)
+
+instance Show ARepo where
+  show (ARepo repo) = showRepo repo
+
+instance Arbitrary ARepo where
+  arbitrary = ARepo <$> elements repos
+
+data CreateDeleteAction = CreateDeleteAction
+  { cdaWhat :: CreateDelete
+  , cdaRepo :: Repo
+  , cdaExists :: Bool
+  , cdaAfter :: HashSet Repo
+  }
+
+populate :: [(CreateDelete, ARepo)] -> [CreateDeleteAction]
+populate = snd . mapAccumL mk mempty
+  where
+    mk before (what, ARepo repo) =
+      let after = (if what == Create then HashSet.insert else HashSet.delete)
+            repo
+            before
+      in
+      ( after
+      , CreateDeleteAction
+          { cdaWhat = what
+          , cdaRepo = repo
+          , cdaExists = repo `HashSet.member` before
+          , cdaAfter = after
+          } )
+
+createDeleteTest :: Test
+createDeleteTest = TestCase $ assertProperty "" $ test . populate
+  where
+    test trace = withMemCatalog $ \_ cat ->
+      forM_ trace $ \CreateDeleteAction{..} -> do
+        exec cdaWhat cdaExists cat cdaRepo
+        xs <- atomically $ Catalog.list cat [Local] everythingF
+        assertEqual "" cdaAfter $ HashSet.fromList (map itemRepo xs)
+        checkConsistency cat
+
+    exec Create False = createNew
+    exec Create True = createExisting
+    exec Delete False = deleteUnknown
+    exec Delete True = deleteExisting
+
+data TestError = TestError
+  deriving(Eq, Show)
+
+instance Exception TestError
+
+createFailureTest :: Test
+createFailureTest = TestCase $ withMemCatalog $ \store cat -> do
+  prepare (storeCreate store) [ doBefore $ throwIO TestError ]
+  called <- newTVarIO False
+  assertThrows "" TestError $
+    Catalog.create cat repo1 def $ writeTVar called True
+  assert $ not <$> readTVarIO called
+  assert $ not <$> Catalog.exists cat [Local] repo1
+  checkConsistency cat
+  where
+    repo1 = head repos
+
+nextMeta :: Meta -> Meta
+nextMeta !meta = meta
+  { metaProperties = HashMap.insert
+      "counter"
+      (Text.pack $ show $ metaCounter meta + 1)
+      (metaProperties meta)
+  }
+
+metaCounter :: Meta -> Int
+metaCounter =
+  maybe 0 (read . Text.unpack) . HashMap.lookup "counter" . metaProperties
+
+writeMetaTest :: Test
+writeMetaTest = TestCase $ withMemCatalog $ \store cat -> do
+  Catalog.create cat repo1 def $ return ()
+
+  let writes = [5,1,64,1024]
+
+  val <- newTVarIO 0
+  max <- newTVarIO 0
+
+  augment (storePut store) $ \impl repo meta -> do
+    let n = metaCounter meta
+    m <- readTVarIO max
+    assert $ n <= m
+    b <- impl repo meta
+    atomically $ writeTVar val n
+    return b
+
+  forM_ writes $ \n -> when (n /= 0) $ do
+    k <- atomically $ metaCounter <$> Catalog.readMeta cat repo1
+    atomically $ writeTVar max $ k+n
+    replicateM_ n $ void $ atomically $
+        metaCounter <$> Catalog.modifyMeta cat repo1 (return . nextMeta)
+    atomically $ do
+      m <- readTVar val
+      when (m /= k+n) retry
+  where
+    repo1 = head repos
+
+stackedDbsTest :: Test
+stackedDbsTest = TestCase $ withMemCatalog $ \_ cat -> do
+  Catalog.create cat repoA metaA $ return ()
+  Catalog.create cat repoC metaC $ return ()
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertThrows "" TestError $ status cat repoB
+  assertEqual "" DatabaseStatus_Missing =<< status cat repoC
+
+  Catalog.create cat repoB metaB $ return ()
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoB
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoC
+
+  Catalog.delete cat repoB
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertThrows "" TestError $ status cat repoB
+  assertEqual "" DatabaseStatus_Missing =<< status cat repoC
+
+  atomically $ Catalog.startRestoring cat repoB metaB
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertEqual "" DatabaseStatus_Restoring =<< status cat repoB
+  assertEqual "" DatabaseStatus_Restoring =<< status cat repoC
+
+  Catalog.finishRestoring cat repoB
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoB
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoC
+
+  Catalog.delete cat repoC
+  Catalog.create cat repoC metaCWrongGuid $ return ()
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoB
+  assertEqual "" DatabaseStatus_Missing =<< status cat repoC
+
+  Catalog.delete cat repoC
+  Catalog.create cat repoC metaC $ return ()
+
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoA
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoB
+  assertEqual "" DatabaseStatus_Complete =<< status cat repoC
+
+  where
+    -- Dependencies: C -> B -> A
+    repoA = Repo "base" "repoA"
+    repoB = Repo "stacked" "repoB"
+    repoC = Repo "stacked2" "repoC"
+    guidA = "aaaaaa"
+    guidB = "bbbbbb"
+    guidC = "cccccc"
+    guidWrong = "xxxxxx"
+    stacked (Repo name hash) guid =
+      Dependencies_stacked $ Stacked name hash (Just guid)
+    metaA = meta
+      { metaProperties=HashMap.fromList [("glean.guid", guidA)] }
+    metaB = meta
+      { metaDependencies=Just $ stacked repoA guidA
+      , metaProperties=HashMap.fromList [("glean.guid", guidB)]}
+    metaC = meta
+      { metaDependencies=Just $ stacked repoB guidB
+      , metaProperties=HashMap.fromList [("glean.guid", guidC)]}
+    metaCWrongGuid = meta
+      { metaDependencies=Just $ stacked repoB guidWrong
+      , metaProperties=HashMap.fromList [("glean.guid", guidC)]}
+    meta = def
+      { metaCompleteness=Complete $ DatabaseComplete (PosixEpochTime 0) Nothing}
+
+    status cat repo = do
+      result <- atomically $ Catalog.getLocalDatabase cat repo
+      case result of
+        Just GetDatabaseResult{getDatabaseResult_database=db} ->
+          return (database_status db)
+        Nothing -> throwIO TestError
+
+writeWhileCommitting :: Test
+writeWhileCommitting = TestCase $ withMemCatalog $ \store cat -> do
+  Catalog.create cat repo1 def $ return ()
+
+  start1 <- newEmptyMVar
+  finish1 <- newEmptyMVar
+  finish2 <- newEmptyMVar
+  prepare (storePut store)
+    [ doBefore (putMVar start1 ()) . doFinally (takeMVar finish1)
+    , doFinally (putMVar finish2 ()) ]
+  void $ atomically $ Catalog.modifyMeta cat repo1 (return . nextMeta)
+  takeMVar start1
+  void $ atomically $ Catalog.modifyMeta cat repo1 (return . nextMeta)
+  putMVar finish1 ()
+  takeMVar finish2
+  Just m <- Store.get store repo1
+  assertEqual "" 2 $ metaCounter m
+  where
+    repo1 = head repos
+
+createNew :: HasCallStack => Catalog -> Repo -> IO ()
+createNew cat repo = do
+  called <- newTVarIO False
+  Catalog.create cat repo def $ writeTVar called True
+  assert $ readTVarIO called
+
+createExisting :: HasCallStack => Catalog -> Repo -> IO ()
+createExisting cat repo = do
+  called <- newTVarIO False
+  assertThrows "" (Catalog.EntryAlreadyExists repo)
+    $ Catalog.create cat repo def $ writeTVar called True
+  assert $ not <$> readTVarIO called
+
+deleteExisting :: HasCallStack => Catalog -> Repo -> IO ()
+deleteExisting cat repo = Catalog.delete cat repo
+
+deleteUnknown :: HasCallStack => Catalog -> Repo -> IO ()
+deleteUnknown cat repo = assertThrowsType "" (Proxy @UnknownDatabase)
+  $ Catalog.delete cat repo
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "createDelete" createDeleteTest
+  , TestLabel "createFailureTest" createFailureTest
+  , TestLabel "writeMeta" writeMetaTest
+  , TestLabel "stackedDbsTest" stackedDbsTest
+  , TestLabel "writeWhileCommitting" writeWhileCommitting
+  ]
diff --git a/glean/test/tests/ContinuationTest.hs b/glean/test/tests/ContinuationTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/ContinuationTest.hs
@@ -0,0 +1,50 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module ContinuationTest (main) where
+
+import Data.Proxy
+import Test.HUnit
+
+import TestRunner
+
+import Glean.Init
+import Glean.Query.Thrift
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Types
+
+import Glean.Test.HUnit
+import TestDB
+
+-- | Tests for derived predicates using Angle syntax.
+continuationCheckTest :: (UserQueryCont -> UserQueryCont) -> Test
+continuationCheckTest f = dbTestCase $ \env repo -> do
+  -- Several tests with the trivial derived predicate: IsThree ::= 3
+  (io, Just cont) <-
+    runQueryPage env repo Nothing $ limit 1 $ allFacts @Cxx.Name
+  r <- io
+  assertEqual "first result" (length r) 1
+
+  -- check that the continuation works
+  (io, _) <-
+    runQueryPage env repo (Just cont) $ limit 1 $ allFacts @Cxx.Name
+  r <- io
+  assertEqual "second result" (length r) 1
+
+  -- check that fiddling with the continuation makes it not work
+  assertThrowsType "bad cont" (Proxy :: Proxy BadQuery)
+      $ runQueryPage env repo (Just $ f cont) $ allFacts @Cxx.Name
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "version" $ continuationCheckTest $ \c -> c
+      { userQueryCont_version = 0 }
+  , TestLabel "bytes" $ continuationCheckTest $ \c -> c
+      { userQueryCont_continuation = "helloworld" }
+  ]
diff --git a/glean/test/tests/CppCatchTest.hs b/glean/test/tests/CppCatchTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/CppCatchTest.hs
@@ -0,0 +1,58 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module CppCatchTest (main) where
+
+import Control.Exception
+import qualified Data.Text as Text
+import Test.HUnit
+
+import Glean.Init
+import Glean.Query.Thrift as Thrift
+import qualified Glean.Schema.Cxx1.Types as Cxx
+import Glean.Typed hiding (end)
+import Util.Text ( textShow )
+
+import TestRunner
+import TestDB
+
+catchTest :: Test
+catchTest = dbTestCase $ \env repo -> do
+
+  -- Pick some fact ids of type Cxx.Name
+  names <- runQuery_ env repo $ allFacts @Cxx.Name
+  let factId x = Text.pack (show (fromFid (idOf (getId x))))
+
+  --
+  -- Now query for it but assert the wrong type
+  -- This should raise an exception if all is working properly
+  --
+  r <- try $ runQuery_ env repo $ angle @Cxx.Type $
+      "$cxx1.Type " <> factId (head names)
+
+  -- on mis-compiled hosts this is expected to SIGABRT, instead of
+  -- catching the C++ exception
+  case r of
+    Left (e :: SomeException) -> assertBool
+       "Correctly caught exception" ("Stack trace" `Text.isInfixOf` textShow e)
+    Right _ -> assertFailure "catchTest did not throw"
+
+
+{-
+Correct trace looks like:
+
+Stack trace:
+  facebook::glean::rts::raiseError(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
+  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > facebook::glean::rts::error<>(folly::Range<char const*>)
+  facebook::glean::rts::Subroutine::execute(unsigned long const*) const
+-}
+
+main :: IO ()
+main = withUnitTest $ testRunner $
+  TestLabel "catch from C++" catchTest
diff --git a/glean/test/tests/DatabaseJanitorTest.hs b/glean/test/tests/DatabaseJanitorTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/DatabaseJanitorTest.hs
@@ -0,0 +1,975 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module DatabaseJanitorTest
+  ( main
+  , dbConfig
+  , serverConfig
+  , makeFakeDB
+  , withTest
+  ) where
+
+import Control.Concurrent (threadDelay)
+import Util.STM
+import Control.Exception
+import Control.Monad
+import Data.Aeson
+import qualified Data.ByteString.Char8 as BS
+import qualified Data.ByteString.Lazy as LB
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.HashSet as HashSet
+import Data.Int (Int64)
+import Data.IORef
+import Data.List
+import qualified Data.Map as Map
+import Data.Maybe
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Time.Clock
+import GHC.Stack (HasCallStack)
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+import System.Time.Extra (sleep)
+import System.Timeout
+import Test.HUnit
+
+import ServiceData.GlobalStats (getCounters)
+import TestRunner
+import Util.EventBase
+import Util.TimeSec
+
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Config
+import Glean.Database.Data
+import Glean.Database.Delete
+import Glean.Database.Env
+import Glean.Database.Janitor
+import Glean.Database.Meta
+import Glean.Database.Repo
+import qualified Glean.Database.Storage as Storage
+import qualified Glean.Database.Storage.RocksDB as RocksDB
+import Glean.Database.Close
+import Glean.Database.List
+import Glean.Database.Open (isDatabaseClosed, withOpenDatabase)
+import Glean.Database.Types
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.Init
+import Glean.RTS.Types (lowestFid)
+import Glean.ServerConfig.Types as ServerTypes
+import Glean.Internal.Types
+import Glean.Types as Thrift
+import Glean.Util.ConfigProvider
+import Glean.Util.ShardManager
+import Glean.Util.ThriftSource as ThriftSource
+import Util.Time (seconds)
+import Glean.Database.Backup.Backend
+import Glean.Database.Backup.Mock
+
+
+withTest
+  :: (FilePath -> DbSchema -> IO ())
+  -> (FilePath -> DbSchema -> IO ())
+  -> (EventBaseDataplane -> NullConfigProvider -> FilePath -> FilePath
+       -> IO ())
+  -> IO ()
+withTest setup setupBackup action =
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider defaultConfigOptions $ \cfgAPI ->
+  withSystemTempDirectory "glean-dbtest" $ \dbdir -> do
+  withSystemTempDirectory "glean-dbtest-backup" $ \backupdir -> do
+    schema <- parseSchemaDir schemaSourceDir
+    schema <- newDbSchema Nothing schema LatestSchema readWriteContent def
+    setup dbdir schema
+    setupBackup backupdir schema
+    action evb cfgAPI dbdir backupdir
+
+broken :: UTCTime -> Completeness
+broken _ = Broken (DatabaseBroken "index" "TESTING")
+
+complete :: Int64 -> UTCTime -> Completeness
+complete size =
+  Complete . (`DatabaseComplete` Just size) . utcTimeToPosixEpochTime
+
+repo0001 :: Repo
+repo0001 = Repo "test" "0001"
+
+setupBasicDBs :: FilePath -> DbSchema -> IO ()
+setupBasicDBs dbdir schema = do
+  now <- getCurrentTime
+  let age t = addUTCTime (negate (fromIntegral (timeSpanInSeconds t))) now
+  -- populate a dir with various DBs
+  makeFakeDB schema dbdir repo0001 (age (days 0)) (complete 1)
+    (props [("bool","yes")])
+  makeFakeDB schema dbdir (Repo "test" "0002") (age (days 2)) broken id
+  makeFakeDB schema dbdir (Repo "test" "0003") (age (days 3)) (complete 3) $
+    stacked (Stacked "test" "0004" Nothing)
+  makeFakeDB schema dbdir (Repo "test" "0004") (age (days 0)) (complete 4) $
+    sourceTime (age (days 4)) .  -- source 4 days ago, created 0 days ago
+    stacked (Stacked "test" "0005" Nothing)
+  makeFakeDB schema dbdir (Repo "test" "0005") (age (days 5)) (complete 5) $
+    stacked (Stacked "test2" "0006" Nothing) . props [("bool","no")]
+  makeFakeDB schema dbdir (Repo "test2" "0006") (age (days 6)) (complete 6) id
+  makeFakeDB schema dbdir (Repo "test3" "0007") (age (days 0)) (complete 1)
+    (props [("exclude_me","true")])
+
+
+setupBasicCloudDBs :: FilePath -> DbSchema -> IO ()
+setupBasicCloudDBs backupDir schema = do
+  now <- getCurrentTime
+  let age t = addUTCTime (negate (fromIntegral (timeSpanInSeconds t))) now
+  makeFakeCloudDB schema backupDir (Repo "test" "0008")
+    (age(days 8)) (complete 8) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0009")
+    (age(days 7)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0010")
+    (age(days 6)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0011")
+    (age(days 5)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0012")
+    (age(days 4)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0013")
+    (age(days 3)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test2" "0014")
+    (age(days 2)) (complete 9) id
+  makeFakeCloudDB schema backupDir (Repo "test" "0015")
+    (age(days 7)) (complete 7) (stacked (Stacked "test2" "0013" Nothing))
+
+setupBasicCloudDBsWithMissingDependencyOne :: FilePath -> DbSchema -> IO ()
+setupBasicCloudDBsWithMissingDependencyOne backupDir schema = do
+  setupBasicCloudDBs backupDir schema
+  dbtime <- getCurrentTime
+  makeFakeCloudDB schema backupDir (Repo "test" "0016") dbtime
+    (complete 8) (stacked (Stacked "missing" "0001" Nothing))
+
+withFakeDBs
+  :: (EventBaseDataplane -> NullConfigProvider -> FilePath -> FilePath
+       -> IO ())
+  -> IO ()
+withFakeDBs action = withTest setupBasicDBs (\_ _ -> pure ()) action
+
+withFakeCloudDBs
+  :: (EventBaseDataplane -> NullConfigProvider -> FilePath -> FilePath
+       -> IO ())
+  -> IO ()
+withFakeCloudDBs = withTest (\_ _ -> pure ()) setupBasicCloudDBs
+
+stacked :: Stacked -> Meta -> Meta
+stacked st meta = meta { metaDependencies = Just (Thrift.Dependencies_stacked st) }
+
+props :: [(Text, Text)] -> Meta -> Meta
+props list meta = meta { metaProperties = HashMap.fromList list }
+
+sourceTime :: UTCTime -> Meta -> Meta
+sourceTime t meta = meta { metaRepoHashTime = Just (utcTimeToPosixEpochTime t) }
+
+makeFakeDB
+  :: DbSchema
+  -> FilePath
+  -> Repo
+  -> UTCTime
+  -> (UTCTime -> Completeness)
+  -> (Meta -> Meta)
+  -> IO ()
+makeFakeDB schema root repo dbtime completeness opts = do
+  let
+    meta = opts $ Meta
+      { metaVersion = Storage.currentVersion
+      , metaCreated = utcTimeToPosixEpochTime dbtime
+      , metaRepoHashTime = Nothing
+      , metaCompleteness = completeness dbtime
+      , metaBackup = Nothing
+      , metaProperties = HashMap.empty
+      , metaDependencies = Nothing
+      , metaCompletePredicates = mempty
+      , metaAxiomComplete = False
+      }
+  let repoPath = databasePath root repo
+  createDirectoryIfMissing True repoPath
+  storage <- RocksDB.newStorage root def
+  bracket
+    (Storage.open
+      storage
+      repo
+      (Storage.Create lowestFid Nothing Storage.UseDefaultSchema)
+      Storage.currentVersion)
+    Storage.close
+    (\hdl -> storeSchema hdl $ toStoredSchema schema)
+  LB.writeFile (repoPath </> "meta") (encode meta)
+
+makeFakeCloudDB
+  :: DbSchema
+  -> FilePath
+  -> Repo
+  -> UTCTime
+  -> (UTCTime -> Completeness)
+  -> (Meta -> Meta)
+  -> IO ()
+makeFakeCloudDB schema backupDir repo dbtime completeness opts = do
+  let repoPath = databasePath backupDir repo
+  createDirectoryIfMissing True repoPath
+  storage <- RocksDB.newStorage backupDir def
+  bracket
+    (Storage.open
+      storage
+      repo
+      (Storage.Create lowestFid Nothing Storage.UseDefaultSchema)
+      Storage.currentVersion)
+    Storage.close
+    (\hdl -> do
+      storeSchema hdl $ toStoredSchema schema
+      tmpDir <- getCanonicalTemporaryDirectory
+      withTempDirectory tmpDir "scratch" $ \scratch ->
+        Storage.backup hdl scratch $ \file _data ->
+          void $ backup (mockSite backupDir) repo props Nothing file
+    )
+  where
+    props = opts $ Meta
+        { metaVersion = Storage.currentVersion
+        , metaCreated = utcTimeToPosixEpochTime dbtime
+        , metaRepoHashTime = Nothing
+        , metaCompleteness = completeness dbtime
+        , metaBackup = Nothing
+        , metaProperties = HashMap.empty
+        , metaDependencies = Nothing
+        , metaCompletePredicates = mempty
+        , metaAxiomComplete = False
+        }
+
+dbConfig :: FilePath -> ServerTypes.Config -> Glean.Database.Config.Config
+dbConfig dbdir serverConfig = def
+  { cfgDataStore = fileDataStore dbdir
+  , cfgSchemaLocation = Just schemaLocationFiles
+  , cfgServerConfig = ThriftSource.value serverConfig
+  , cfgReadOnly = False
+      -- If we set cfgReadOnly=True, then backing up a DB will fail
+      -- because backup first opens the DB, and opening a DB tries to
+      -- load the schema from the DB.  If we use read/write mode, then
+      -- opening will commit the schema instead of failing.
+  , cfgMockWrites = False
+  , cfgListener = mempty
+  }
+
+serverConfig :: FilePath -> ServerTypes.Config
+serverConfig backupdir = def
+  { config_backup = def
+    { databaseBackupPolicy_allowed = mempty
+    , databaseBackupPolicy_location = "mock:" <> Text.pack backupdir
+    }
+  , config_restore = def
+    { databaseRestorePolicy_enabled = False
+    }
+  , config_janitor_period = Nothing -- no auto janitor, we'll run it manually
+  , config_db_rocksdb_cache_mb = 0
+  }
+
+listDBs :: Env -> IO [Thrift.Database]
+listDBs env = filter hereDBs <$> listAllDBs env
+  where
+    hereDBs Database{..} = database_status /= DatabaseStatus_Available
+
+listHereDBs :: Env -> IO [Database]
+listHereDBs = listDBs
+
+listAllDBs :: Env -> IO [Database]
+listAllDBs env = listDatabasesResult_databases <$> listDatabases env def
+
+waitDel :: Env -> IO ()
+waitDel env = atomically $ do
+  done <- HashMap.null <$> readTVar (envDeleting env)
+  when (not done) retry
+
+deleteOldDBsTest :: Test
+deleteOldDBsTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_delete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 1 }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  dbs <- listDBs env
+  assertEqual "before"
+    [ "0001", "0002", "0003", "0004", "0005", "0006", "0007"]
+    (sort (map (repo_hash . database_repo) dbs))
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  assertEqual "after"
+    [ "0001", "0004", "0005", "0006","0007"]
+      -- we don't delete 0004 because even though its source is old,
+      -- it was created recently. 0004 depends on 0005, and 0005
+      -- depends on 0006
+    (sort (map (repo_hash . database_repo) dbs))
+
+  dbdirs1 <- listDirectory (dbdir </> "test")
+  dbdirs2 <- listDirectory (dbdir </> "test2")
+  assertEqual "directories deleted"
+    [ "0001", "0004", "0005", "0006" ]
+    (dbdirs1 ++ dbdirs2)
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  assertEqual "after-repeat"
+    [ "0001", "0004", "0005", "0006","0007" ]
+    (sort (map (repo_hash . database_repo) dbs))
+
+deleteIncompleteDBsTest :: Test
+deleteIncompleteDBsTest = TestCase $
+  withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_delete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 10
+            , retention_delete_incomplete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 1 }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  dbs <- listDBs env
+  assertEqual "before"
+    [ "0001", "0002", "0003", "0004", "0005", "0006","0007"]
+    (sort (map (repo_hash . database_repo) dbs))
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  print (map database_repo dbs)
+  assertEqual "after"
+    [ "0001", "0003", "0004", "0005", "0006", "0007"]
+    (sort (map (repo_hash . database_repo) dbs))
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  assertEqual "after-repeat"
+    [ "0001", "0003", "0004", "0005", "0006","0007"]
+    (sort $ map (repo_hash . database_repo) dbs)
+
+
+retainAtMostTest :: Test
+retainAtMostTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_retain_at_most = Just 2 }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  let repos = map database_repo dbs
+  assertEqual "after"
+    [ "0001", "0002", "0006", "0007"]
+    (sort $ map repo_hash repos)
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  assertEqual "after-repeat"
+    [ "0001", "0002", "0006", "0007"]
+    (sort $ map (repo_hash . database_repo) dbs)
+
+
+retainAtLeastTest :: Test
+retainAtLeastTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_delete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 1
+            , retention_retain_at_least = Just 2 }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  let repos = map database_repo dbs
+  assertEqual "after"
+    [ "0001", "0003", "0004", "0005", "0006", "0007"]
+    (sort $ map repo_hash repos)
+    -- should drop 0002, because its metaIndexing=Failed
+    -- should retain 0003 even though it is older than delete_if_older,
+    -- due to retain_at_least.
+
+  runDatabaseJanitor env
+  waitDel env
+  dbs <- listDBs env
+  let repos = map database_repo dbs
+  assertEqual "after-repeat"
+    [ "0001", "0003", "0004", "0005", "0006","0007"]
+    (sort $ map repo_hash repos)
+
+excludedPropsTest :: Test
+excludedPropsTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_excluded_properties =
+                HashMap.fromList [("exclude_me","true")]
+            }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+  runDatabaseJanitor env
+  dbs <- listDBs env
+  let repos = map database_repo dbs
+  assertEqual "after"
+    [ "0001", "0002", "0003", "0004", "0005", "0006"]
+    (sort $ map repo_hash repos)
+
+requiredPropsTest :: Test
+requiredPropsTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_required_properties =
+                HashMap.fromList [("bool","yes")]
+            }
+          }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+  runDatabaseJanitor env
+  dbs <- listDBs env
+  let repos = map database_repo dbs
+  assertEqual "after" [ "0001" ] (map repo_hash repos)
+
+multiRetentionTest :: Test
+multiRetentionTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_by_repo =
+            Map.fromList
+              [ ("test",
+                [ def
+                  { retention_required_properties =
+                      HashMap.fromList [("bool","yes")]
+                  , retention_retain_at_least = Just 1
+                  }
+                , def
+                  { retention_required_properties =
+                      HashMap.fromList [("bool","no")]
+                  , retention_retain_at_least = Just 1
+                  , retention_keep_open = True
+                  }
+                ])
+              ]
+            }
+          }
+  withDatabases evb cfg cfgAPI $ \env -> do
+  runDatabaseJanitor env
+  dbs <- listDBs env
+  let repos = sort $ map (repo_hash . database_repo) dbs
+  assertEqual "after" [ "0001", "0005", "0006", "0007" ] repos
+
+  -- 0005 should be open due to keep_open=True in the retention policy
+  closed <- atomically $ isDatabaseClosed env (Repo "test" "0005")
+  assertBool "open" (not closed)
+
+-- | If we want to restore only one type of DB with a retention
+-- policy, check that we don't restore additional instances of that DB
+-- that are dependencies of other (non-restored) DBs.
+retentionRestoreDepsTest :: Test
+retentionRestoreDepsTest = TestCase $
+  withFakeCloudDBs $ \evb cfgAPI dbdir backupdir -> do
+    let cfg = dbConfig dbdir $ (serverConfig backupdir)
+          { config_retention = def
+            { databaseRetentionPolicy_default_retention = def
+              { retention_retain_at_most = Just 1
+              }
+            },
+            config_restore = def
+            { databaseRestorePolicy_enabled = False
+            , databaseRestorePolicy_override = Set.fromList ["test2"]
+            }
+          }
+    withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    dbs <- listDBs env
+    let repos = map database_repo dbs
+    assertEqual "after" [ "0014" ] (map repo_hash repos)
+
+backupRestoreTest :: Test
+backupRestoreTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_backup = (config_backup (serverConfig backupdir))
+          { databaseBackupPolicy_allowed =
+              HashSet.fromList ["test", "test2", "test3"] }
+        }
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    atomically $ do
+      dbs <- Catalog.getLocalDatabases $ envCatalog env
+      let should_wait Thrift.GetDatabaseResult
+              {getDatabaseResult_database = Thrift.Database{..}} =
+            database_status == DatabaseStatus_Complete
+            && isNothing database_location
+      when (any should_wait dbs) retry
+
+  backups <- listDirectory backupdir
+  let withProps filename = [filename, filename ++ ".props"]
+  let expected = concatMap withProps
+        [ "test.0001", "test.0003", "test.0004", "test.0005" , "test2.0006", "test3.0007"]
+  assertEqual "after"
+    expected
+    (sort backups)
+  -- should not backup failed db test.0002
+
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_restore = (config_restore (serverConfig backupdir))
+          { databaseRestorePolicy_enabled = True }
+        , config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_delete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 1
+            , retention_retain_at_least = Just 2 }
+          }
+        }
+
+  -- remove all the DBs, so we have to restore them:
+  removeDirectoryRecursive dbdir
+  createDirectoryIfMissing True (dbdir </> "test")
+  createDirectoryIfMissing True (dbdir </> "test2")
+  createDirectoryIfMissing True (dbdir </> "test3")
+  withDatabases evb cfg cfgAPI $ \env -> do
+  runDatabaseJanitor env  -- this should kick off the restore
+
+  let waitForRestore = do
+        dbs <- listDBs env
+        let
+          available =
+            [ db | db <- dbs
+            , database_status db == Thrift.DatabaseStatus_Complete ]
+        when (length dbs < 2 || length available < 2) waitForRestore
+
+  r <- timeout (60*1000000) $ waitForRestore
+  assertBool "timeout" $ isJust r
+
+  -- we should have restored both 0001 and 0003, even though 0003 is
+  -- older than delete_if_older, because retain_at_least = 2
+  dbs <- listDBs env
+  let
+    repos = map database_repo dbs
+    db1 = Repo "test" "0001"
+    db3 = Repo "test" "0003"
+
+
+  assertEqual "after"
+    [ "0001", "0003", "0004", "0005", "0006", "0007" ]
+    (sort $ map repo_hash repos)
+
+  areClosed <- atomically
+    $ liftM2 (&&) (isDatabaseClosed env db1) (isDatabaseClosed env db3)
+  assertBool "dbs available but closed after restore" areClosed
+
+
+openNewestTest :: Test
+openNewestTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ serverConfig backupdir
+
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  let
+    newestDb = Repo "test" "0001"
+    oldestDb = Repo "test" "0005"
+
+  newestClosed <- atomically $ isDatabaseClosed env newestDb
+  oldestClosed <- atomically $ isDatabaseClosed env oldestDb
+
+  assertBool "newest closed before" newestClosed
+  assertBool "oldest closed before" oldestClosed
+
+  runDatabaseJanitor env
+
+  newestOpen <- atomically $ not <$> isDatabaseClosed env newestDb
+  oldestStillClosed <- atomically $ isDatabaseClosed env oldestDb
+
+  assertBool "newest open after" newestOpen
+  assertBool "oldest closed after" oldestStillClosed
+
+  -- delete repo001, repo002 is the newest but is broken, so we
+  -- should open repo003.
+  deleteDatabase env newestDb
+  runDatabaseJanitor env
+
+  let nextBroken = Repo "test" "0002"
+  let nextNotBroken = Repo "test" "0003"
+  dontOpenBroken <- atomically $ isDatabaseClosed env nextBroken
+  openNotBroken <- atomically $ not <$> isDatabaseClosed env nextNotBroken
+
+  assertBool "don't open broken" dontOpenBroken
+  assertBool "open not broken" openNotBroken
+
+closeIdleDBsTest :: Test
+closeIdleDBsTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ serverConfig backupdir
+
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+  let
+    normalDb = Repo "test" "0001"
+    blackListedDb = Repo "test" "0003"
+
+  withOpenDatabase env normalDb (\_ -> return ())
+  withOpenDatabase env blackListedDb (\_ -> return ())
+
+  normalDbOpen <- atomically $ not <$> isDatabaseClosed env normalDb
+  blackListedDbOpen <- atomically $ not <$> isDatabaseClosed env blackListedDb
+
+  assertBool "regular DB open before" normalDbOpen
+  assertBool "blacklisted DB open before" blackListedDbOpen
+
+  -- Close all available DBs unless blacklisted
+  closeIdleDatabases env (seconds 0) [blackListedDb]
+
+  normalDbClosed <- atomically $ isDatabaseClosed env normalDb
+  blackListedDbStillOpen <- atomically
+    $ not <$> isDatabaseClosed env blackListedDb
+
+  assertBool "regular DB closed after" normalDbClosed
+  assertBool "blacklisted DB open after" blackListedDbStillOpen
+
+shardingTest :: Test
+shardingTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  myShards <- newIORef ["0001"] -- initial shard assignment
+  let cfg = (dbConfig dbdir (serverConfig backupdir))
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager $
+          shardByRepoHash (Just <$> readIORef myShards)}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listHereDBs env
+    assertEqual "initial shard assignment"
+      ["0001"]
+      (sort $ map (repo_hash . database_repo) dbs)
+
+    -- update the shard assignment and verify
+    writeIORef myShards ["nil"]
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listHereDBs env
+    assertEqual "shard assignment: removed 0003"
+      []
+      (sort $ map (repo_hash . database_repo) dbs)
+
+shardingStacksTest :: Test
+shardingStacksTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  myShards <- newIORef ["0006"] -- initial shard assignment
+  let cfg = (dbConfig dbdir (serverConfig backupdir))
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager $
+          shardByBaseOfStackRepoHash (Just <$> readIORef myShards)}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listHereDBs env
+    assertEqual "all dbs in the stack belong to the shard"
+      ["0003", "0004", "0005", "0006"]
+      (sort $ map (repo_hash . database_repo) dbs)
+
+shardingFallbackTest :: Test
+shardingFallbackTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = (dbConfig dbdir (serverConfig backupdir))
+        {cfgShardManager = \_ _ k ->
+          k $ SomeShardManager $ shardByRepoHash (pure Nothing)}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listHereDBs env
+    assertEqual "falls back to no sharding"
+      ["0001", "0002", "0003", "0004", "0005", "0006", "0007"]
+      (sort $ map (repo_hash . database_repo) dbs)
+
+shardingByRepoNameTest :: Test
+shardingByRepoNameTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = (dbConfig dbdir (serverConfig backupdir))
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager $
+          shardByRepo (pure $ Just ["test2"])}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listHereDBs env
+    assertEqual "only test2 dbs belong to the shard"
+      ["0003", "0004", "0005", "0006"]
+      (sort $ map (repo_hash . database_repo) dbs)
+
+
+elsewhereTest :: Test
+elsewhereTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let myShards = pure $ Just ["0001", "0003"]
+  let cfg = (dbConfig dbdir (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            { retention_delete_if_older =
+                Just $ fromIntegral $ timeSpanInSeconds $ days 10
+            , retention_retain_at_least = Just 10 }
+          }
+        })
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager $ shardByRepoHash myShards}
+  withDatabases evb cfg cfgAPI $ \env -> do
+
+    dbs <- listHereDBs env
+    assertEqual "before"
+      [ "0001", "0002", "0003", "0004", "0005", "0006", "0007"]
+      (sort (map (repo_hash . database_repo) dbs))
+
+    runDatabaseJanitor env
+    waitDel env
+    dbs <- listAllDBs env
+
+    assertEqual "after: dbs available with the retention policy"
+      [ "0001", "0002", "0003", "0004", "0005", "0006", "0007"]
+      (sort $ map (repo_hash . database_repo) dbs)
+
+makeFilterDBsWithInvariant :: ([Repo] -> IO [Repo]) -> IO ([Repo] -> IO [Repo])
+makeFilterDBsWithInvariant pred = do
+  seenAvailabeDBsRef <- newIORef mempty
+  return $ \dbs -> do
+    available <- pred dbs
+    let availableSet = HashSet.fromList available
+    beenAvailableBefore <- readIORef seenAvailabeDBsRef
+    assertEqual "called cfgFilterAvailableDBs twice on the same DB"
+      mempty (HashSet.intersection availableSet beenAvailableBefore)
+    writeIORef seenAvailabeDBsRef (availableSet <> beenAvailableBefore)
+    return available
+
+elsewhereNotYetAvailableTest :: Test
+elsewhereNotYetAvailableTest =
+  TestCase $ withFakeCloudDBs $ \evb cfgAPI dbdir backupdir -> do
+    let myShards = pure $ Just []
+    filterDBs <- makeFilterDBsWithInvariant $
+      return . filter ((`elem` ["0008","0009"]) . repo_hash)
+    let cfg = (dbConfig dbdir (serverConfig backupdir)
+          { config_retention = def
+            { databaseRetentionPolicy_default_retention = def
+              { retention_delete_if_older =
+                  Just $ fromIntegral $ timeSpanInSeconds $ days 10
+              , retention_retain_at_least = Just 2
+              , retention_retain_at_most = Just 4
+              }
+            },
+            config_restore = def {
+              databaseRestorePolicy_enabled = True
+            }
+          })
+          {cfgShardManager = \_ _ k ->
+              k $ SomeShardManager $ shardByRepoHash myShards
+          ,cfgFilterAvailableDBs = filterDBs
+          }
+    withDatabases evb cfg cfgAPI $ \env -> do
+      runDatabaseJanitor env
+      dbs <- listAllDBs env
+
+      assertEqual
+        "at least 2 dbs actually available + at most 4 more not yet available"
+        ["0008", "0009", "0011", "0012", "0013", "0014", "0015"]
+        (sort $ map (repo_hash . database_repo) dbs)
+
+shardUnexpireTest :: Test
+shardUnexpireTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  myShards <- newIORef ["nil"] -- initial incomplete shard assignment
+  let cfg = (dbConfig dbdir (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            {retention_expire_delay = Just 30}
+          }
+        })
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager $
+          shardByRepoHash (Just <$> readIORef myShards)}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    dbs <- listDBs env
+
+    expiring <- atomically $
+      mapM (Catalog.readExpiring (envCatalog env) . database_repo) dbs
+    assertBool "All expiring" (all isJust expiring)
+
+    -- update the shard assignment and verify
+    writeIORef myShards [repo_hash repo0001]
+    runDatabaseJanitor env
+
+    expiring <- atomically $ Catalog.readExpiring (envCatalog env) repo0001
+    assertBool "0001 not expiring now" (isNothing expiring)
+
+expireTest :: Test
+expireTest = TestCase $ withFakeDBs $ \evb cfgAPI dbdir backupdir -> do
+  let emptyShardAssignment = shardByRepoHash $ pure $ Just ["nil"]
+  let cfg = (dbConfig dbdir (serverConfig backupdir)
+        { config_retention = def
+          { databaseRetentionPolicy_default_retention = def
+            {retention_expire_delay = Just 1}
+          }
+        , config_janitor_period = Nothing
+        })
+        {cfgShardManager = \_ _ k -> k $ SomeShardManager emptyShardAssignment}
+  withDatabases evb cfg cfgAPI $ \env -> do
+    runDatabaseJanitor env
+    dbs <- listDBs env
+
+    expiring <- atomically $
+      mapM (Catalog.readExpiring (envCatalog env) . database_repo) dbs
+    assertBool "All expiring" (all isJust expiring)
+
+    -- run the Janitor before the expire delay to exercise all code paths
+    runDatabaseJanitor env
+    sleep 1
+    -- run the Janitor twice after the expire delay to exercise all code paths
+    runDatabaseJanitor env
+    runDatabaseJanitor env
+    -- check that the DBs were really deleted
+    res <- timeout 10000000 -- 10s
+                   (waitDel env)
+    waitingDeletion <- readTVarIO (envDeleting env)
+    assertBool ("timeout: " <> show (HashMap.keys waitingDeletion)) (isJust res)
+    assertEqual "envDeleting" [] (HashMap.keys waitingDeletion)
+    localDBs <- listHereDBs env
+    assertEqual "All deleted" [] (map database_repo localDBs)
+
+ageCountersTestEx
+  :: HasCallStack
+  => SomeShardManager
+  -> (Env -> [BS.ByteString] -> IO ())
+  -> IO ()
+ageCountersTestEx shardManager k =
+  withTest setupBasicDBs setupBasicCloudDBs $ \evb cfgAPI dbdir backupdir -> do
+    let cfg = (dbConfig dbdir (serverConfig backupdir)
+          { config_restore = def {
+              databaseRestorePolicy_enabled = True
+            }, config_retention = def
+          }) {cfgShardManager = \_ _ k -> k shardManager}
+    withDatabases evb cfg cfgAPI $ \env -> do
+      runDatabaseJanitor env
+      waitDel env
+      sideEffects <- runDatabaseJanitorPureish env
+      let countersToPublish =
+            [ c
+            | PublishCounter c _ <- sideEffects
+            , ".age" `BS.isSuffixOf` c || ".span" `BS.isSuffixOf` c
+            ]
+      k env $ sort countersToPublish
+
+ageCountersCompleteTest :: Test
+ageCountersCompleteTest = TestCase $ ageCountersTestEx
+  (SomeShardManager $ shardByRepoHash (pure $ Just ["0001"]))
+  $ \_ -> assertEqual
+    "Should publish age counters for all newest DBs restored locally"
+    ["glean.db.test.age", "glean.db.test.span"]
+
+ageCountersOnlyNewestTest :: Test
+ageCountersOnlyNewestTest = TestCase $ ageCountersTestEx
+  (SomeShardManager $ shardByRepoHash (pure $ Just []))
+  $ \_ -> assertEqual
+      "Should not publish age for newest DBs not restored locally"
+      []
+
+ageCountersClearTest:: Test
+ageCountersClearTest = TestCase $ do
+  shardAssignmentRef <- newIORef ["0001"]
+  ageCountersTestEx
+    (SomeShardManager $ shardByRepoHash (Just <$> readIORef shardAssignmentRef))
+    $ \env _ -> do
+    writeIORef shardAssignmentRef []
+    -- Run the Janitor to pick up the new assignment and delete unassigned DBs
+    runDatabaseJanitor env
+    waitDel env
+    -- Run the Janitor again after DBs are deleted to clear the counters
+    runDatabaseJanitor env
+    counters <- getCounters
+    assertBool "glean.db.test.age cleared"
+      $ not (HashMap.member "glean.db.test.age" counters)
+
+stuckTest :: Test
+stuckTest = TestCase $ withFakeCloudDBs $ \evb cfgAPI dbdir backupdir -> do
+  let cfg = dbConfig dbdir $ (serverConfig backupdir)
+        { config_janitor_period = Just 0
+        , config_restore = def {
+              databaseRestorePolicy_enabled = True
+            }
+        , config_retention = def {
+            databaseRetentionPolicy_default_retention = def {
+            retention_retain_at_least = Just 2
+          }
+         }
+        }
+      cfg' = cfg {
+         cfgFilterAvailableDBs  = \_ -> do
+           uninterruptibleMask_ $ threadDelay maxBound
+           return []
+      }
+  withDatabases evb cfg' cfgAPI $ \env -> do
+    (_, janitorResult) <- atomically $ do
+      res <- readTVar $ envDatabaseJanitor env
+      maybe retry return res
+    assertBool (show janitorResult) $ case janitorResult of
+      JanitorStuck -> True
+      _ -> False
+
+retentionCheckMissingDepsTest :: Test
+retentionCheckMissingDepsTest = TestCase $
+  withTest (\_ _ -> pure ()) setupBasicCloudDBsWithMissingDependencyOne
+     $ \evb cfgAPI dbdir backupdir -> do
+    let cfg = dbConfig dbdir $ (serverConfig backupdir)
+          { config_retention = def
+            { databaseRetentionPolicy_default_retention = def
+              { retention_retain_at_least = Just 1,
+                retention_retain_at_most = Just 1
+              }
+            },
+            config_restore = def
+            { databaseRestorePolicy_enabled = True
+            }
+          }
+
+    withDatabases evb cfg cfgAPI $ \env -> do
+      runDatabaseJanitor env
+      dbs <- listDBs env
+      let repos = map database_repo dbs
+      --- 0014 is the newest test2 db
+      --- 0016 is the newest test db, but it's missing dependency
+      --- so restoring next available test db 0015 and it's dependency 0013
+      assertEqual "after" [ "0013", "0014","0015"] (map repo_hash repos)
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "deleteOldDBs" deleteOldDBsTest
+  , TestLabel "deleteIncompleteDBs" deleteIncompleteDBsTest
+  , TestLabel "retainAtMost" retainAtMostTest
+  , TestLabel "retainAtLeast" retainAtLeastTest
+  , TestLabel "backupRestore" backupRestoreTest
+  , TestLabel "openNewestDB" openNewestTest
+  , TestLabel "closeIdleDBs" closeIdleDBsTest
+  , TestLabel "expireDelay" expireTest
+  , TestLabel "sharding" shardingTest
+  , TestLabel "shardingStacks" shardingStacksTest
+  , TestLabel "shardingFallback" shardingFallbackTest
+  , TestLabel "shardingByRepoName" shardingByRepoNameTest
+  , TestLabel "shardingExpiring" shardUnexpireTest
+  , TestLabel "availableElsewhere" elsewhereTest
+  , TestLabel "notAvailableElsewhere" elsewhereNotYetAvailableTest
+  , TestLabel "ageCountersForAllNewestDBs" ageCountersCompleteTest
+  , TestLabel "ageCountersForOnlyNewestDBs" ageCountersOnlyNewestTest
+  , TestLabel "ageCountersClear" ageCountersClearTest
+  , TestLabel "stuck" stuckTest
+  , TestLabel "requiredPropsTest" requiredPropsTest
+  , TestLabel "retentionRestoreDepsTest" retentionRestoreDepsTest
+  , TestLabel "multiRetentionTest" multiRetentionTest
+  , TestLabel "retentionCheckMissingDepsTest" retentionCheckMissingDepsTest
+  , TestLabel "excludedPropsTest" excludedPropsTest
+  ]
diff --git a/glean/test/tests/DbDeriveTest.hs b/glean/test/tests/DbDeriveTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/DbDeriveTest.hs
@@ -0,0 +1,618 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TypeApplications #-}
+module DbDeriveTest (main) where
+
+import Control.Exception
+import Data.Default
+import qualified Data.Map.Strict as Map
+import Test.HUnit
+import Util.String.Quasi
+import Data.Proxy
+import qualified Data.Text as Text
+import Control.Concurrent
+import Control.Monad
+import Control.Concurrent.Async
+import qualified Data.HashMap.Strict as HashMap
+import Util.STM
+import System.IO.Temp (withSystemTempDirectory)
+import System.FilePath
+
+import TestRunner
+
+import Glean.Angle.Types
+import Glean.Backend.Types hiding (deriveStored)
+import qualified Glean.Backend.Types as Backend
+import Glean.Init
+import Glean.Database.Open
+import Glean.Database.Schema.Types
+import Glean.Database.Test
+import Glean.Database.Types
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Internal.Types
+import Glean.Typed
+import Glean.Types as Thrift
+import Glean.Test.HUnit
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Query.Thrift
+import Glean.Write.JSON (syncWriteJsonBatch)
+
+import TestDB
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "deriveStored" $ testDerivation $ deriveSerial $ const mempty
+  , TestLabel "deriveParallel" deriveParallelTest
+  , TestLabel "deriveStoredLogging" testDeriveStoredLogging
+  , TestLabel "deriveIncremental" deriveIncrementalTest
+  ]
+
+testDerivation :: RunDerive -> Test
+testDerivation derive = TestList
+  [ TestLabel "deriveTest" $ deriveTest derive
+  , TestLabel "completenessTest" $ completenessTest derive
+  , TestLabel "deriveDeleteDeriveTest" $ deriveDeleteDeriveTest derive
+  ]
+
+type RunDerive = forall p. Predicate p => Env -> Repo -> Proxy p -> IO Int
+
+-- Test that deleting a DB and re-creating it works
+deriveDeleteDeriveTest :: RunDerive -> Test
+deriveDeleteDeriveTest runDerive = TestLabel "deriveDeleteDerive" $
+  TestCase $ withTestEnv [] $ \env -> do
+    let repo = Thrift.Repo "dbtest-repo" "1"
+    createTestDB env repo
+    deriveTestCases runDerive env repo
+    void $ deleteDatabase env repo
+    createTestDB env repo
+    deriveTestCases runDerive env repo
+
+-- Test deriving stored facts
+deriveTest :: RunDerive -> Test
+deriveTest runDerive = dbTestCaseWritable (deriveTestCases runDerive)
+
+deriveParallelTest :: Test
+deriveParallelTest = TestLabel "deriveParallelTest" $
+  TestCase $ withWritableTestDB [] $ \env repo -> do
+    derivedCount <-
+      deriveParallel (const mempty) env repo
+        (Proxy @Glean.Test.StoredDualStringPair)
+        (ParallelDerivation
+          { parallelDerivation_outer_predicate = "glean.test.StringPair"
+          , parallelDerivation_inner_query =
+              "glean.test.StoredDualStringPair { fst = X }"
+          , parallelDerivation_min_batch_size = Just 1
+          })
+    assertEqual "deriveParallelTest" 4 derivedCount
+
+deriveTestCases :: RunDerive -> Env -> Repo -> IO ()
+deriveTestCases runDerive env repo = do
+  let derive :: forall p. Predicate p => Proxy p -> IO Int
+      derive = runDerive env repo
+  -- initially zero facts
+  results <- runQuery_ env repo $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "deriveTest - pre-derive" 0 (length results)
+
+  -- compute and store. Should derive 6 facts
+  derivedCount <- derive (Proxy @Glean.Test.StoredRevStringPair)
+  assertEqual "deriveTest - derivation" 6 derivedCount
+
+  -- now there should be 6 facts stored in the DB
+  results <- runQuery_ env repo $
+    angle @Glean.Test.StoredRevStringPair $
+    [s|
+      glean.test.StoredRevStringPair _
+    |]
+  assertEqual "deriveTest - post-derive" 6 (length results)
+
+  -- should not confuse predicates from different repos
+  let pred = Proxy @Glean.Test.StoredRevStringPairWithA
+      PredicateRef{..} = getName pred
+      sref = SourceRef predicateRef_name (Just predicateRef_version)
+  pid <- withOpenDatabase env repo $ \opendb ->
+    either (throwIO . ErrorCall . Text.unpack) return $
+      lookupPredicateSourceRef sref LatestSchema (odbSchema opendb)
+  addDummyDerivationForPredicate (predicateId pid) env
+  derivedCount <- derive pred
+  assertEqual "deriveTest - repo check" 1 derivedCount
+
+addDummyDerivationForPredicate :: PredicateId -> Env -> IO ()
+addDummyDerivationForPredicate pred env =
+  let repo = Thrift.Repo "name" "hash"
+  in
+  atomically
+    $ modifyTVar' (envDerivations env)
+    $ HashMap.insert (repo, pred) Derivation
+      { derivationStart = undefined
+      , derivationFinished = undefined
+      , derivationStats = error "wrong repo!"
+      , derivationPendingWrites = undefined
+      , derivationError = undefined
+      , derivationHandle = "dummy-handle"
+      }
+
+-- Test completeness constraint enforcement
+completenessTest :: RunDerive -> Test
+completenessTest runDerive = dbTestCaseWritable $ \env repo -> do
+  let derive :: forall p. Predicate p => Proxy p -> IO Int
+      derive = runDerive env repo
+  -- deriving a stored predicate depending on a non-derived one succeeds
+  derivedCount <-
+    derive (Proxy @Glean.Test.StoredRevStringPairWithRev)
+  assertEqual "completenessTest - derived depending on non-derived"
+    6 derivedCount
+
+  -- deriving a non-derived predicate fails
+  assertThrows "completenessTest - non-derived" Thrift.NotAStoredPredicate $
+    void $ derive (Proxy @Glean.Test.StringPair)
+
+  -- deriving a derived but not stored predicate fails
+  assertThrows "completenessTest - non-stored" Thrift.NotAStoredPredicate $
+    void $ derive (Proxy @Glean.Test.RevStringPair)
+
+  -- deriving a stored predicate that depends on incomplete predicates fails
+  assertThrows "completenessTest - incomplete dep"
+    (Thrift.IncompleteDependencies
+      [ getName $ Proxy @Glean.Test.StoredRevStringPair
+      , getName $ Proxy @Glean.Test.StoredRevStringPairWithA
+      ])
+    $ void $ derive (Proxy @Glean.Test.StoredRevStringPairSum)
+
+  -- parallel derivation works
+  let run = derive (Proxy @Glean.Test.StoredRevStringPair)
+  (derivedCount1, derivedCount2) <- concurrently run run
+  assertEqual "deriveTest - parallel"
+    (6, 6)
+    (derivedCount1, derivedCount2)
+
+  -- should derive 6 facts now that the dependency is complete
+  derivedCount <- derive (Proxy @Glean.Test.StoredRevStringPairWithA)
+  assertEqual "deriveTest - subsequent derivation" 1 derivedCount
+
+  -- deriving a complete predicate is a no-op
+  derivedCount <- derive (Proxy @Glean.Test.StoredRevStringPair)
+  assertEqual "deriveTest -  complete" 6 derivedCount
+
+  -- deriving a predicate with no facts records it as complete
+  let prox = Proxy @Glean.Test.EmptyStoredStringPair
+      pred = getName prox
+  derivedCount <- derive prox
+  complete <- atomically $
+    metaCompletePredicates <$> Catalog.readMeta (envCatalog env) repo
+  assertEqual "deriveTest -  empty"
+    (0, True)
+    (derivedCount, pred `elem` complete)
+
+testDeriveStoredLogging :: Test
+testDeriveStoredLogging = dbTestCaseWritable $ \env repo -> do
+  tvar <- newTVarIO (0 :: Int)
+  let log _ = atomically $ modifyTVar' tvar (+ 1)
+
+  -- The result is logged once and only once.
+  replicateM_ 10 $
+    deriveSerial log env repo $ Proxy @Glean.Test.StoredRevStringPairWithRev
+  logCalls <- readTVarIO tvar
+  assertEqual "deriveStoredLogging - logs once" 1 logCalls
+
+
+deriveIncrementalTest :: Test
+deriveIncrementalTest = TestLabel "incremental" $ TestList
+  [ TestLabel "statement" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node : nat
+        predicate IsNode : nat stored X where Node X
+      }|]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 4}|]
+          ]
+      ]
+      (PredicateRef "all.IsNode" 1)
+      $ \stats -> do
+        assertEqual "results" 1 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 1 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+  , TestLabel "sequence" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node : nat
+        predicate NodeXNode : { a: Node, b: Node } stored
+          { A, B } where
+            A = Node _;
+            B = Node _;
+      }|]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 4}|]
+          ]
+      ]
+      (PredicateRef "all.NodeXNode" 1)
+      $ \stats -> do
+        -- (new x old) + (old x new) + (new x new)
+        assertEqual "results" 7 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 11 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+  , TestLabel "disjunction" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node1 : nat
+        predicate Node2 : nat
+        predicate NodeCombinations : { a: nat, b: nat } stored
+          { A, B } where
+            (Node1 A; Node2 B) |
+            (Node1 B; Node2 A)
+      }|]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+
+      , mkBatch (PredicateRef "all.Node2" 1)
+          [ [s|{"key": 4}|]
+          , [s|{"key": 5}|]
+          , [s|{"key": 6}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 7}|]
+          ]
+      ]
+      (PredicateRef "all.NodeCombinations" 1)
+      $ \stats -> do
+        -- (new x old) + (old x new)
+        assertEqual "results" 6 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 8 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+  , TestLabel "disjunction followed by sequence" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node1 : nat
+        predicate Node2 : nat
+        predicate Node1and2XNode2 : { a: nat, b: nat } stored
+          { A, B } where
+            (Node1 A | Node2 A);
+            Node2 B
+      }|]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+
+      , mkBatch (PredicateRef "all.Node2" 1)
+          [ [s|{"key": 4}|]
+          , [s|{"key": 5}|]
+          , [s|{"key": 6}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 7}|]
+          ]
+      ]
+      (PredicateRef "all.Node1and2XNode2" 1)
+      $ \stats -> do
+        -- (new x old)
+        assertEqual "results" 3 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 4 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+
+  , TestLabel "disjunction followed by sequence(2)"  $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node1 : nat
+        predicate Node2 : nat
+        predicate Node1and2XNode2 : { a: nat, b: nat } stored
+          { A, B } where
+            (Node1 A | Node2 A);
+            Node2 B
+      }|]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node1" 1)
+          [ [s|{"key": 7}|]
+          ]
+      , mkBatch (PredicateRef "all.Node2" 1)
+          [ [s|{"key": 4}|]
+          , [s|{"key": 5}|]
+          , [s|{"key": 6}|]
+          ]
+      ]
+      (PredicateRef "all.Node1and2XNode2" 1)
+      $ \stats -> do
+        -- (new x old)
+        assertEqual "results" 21 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 28 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+
+  , TestLabel "disjunction of expression and FactGenerator" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node : nat
+        predicate Node2 : { a: nat, b: nat } stored
+          { A, B } where
+            Node A;
+            B = (X where Node X) | [11,12,13,14,15][..];
+      }|]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 1}|]
+          , [s|{"key": 2}|]
+          , [s|{"key": 3}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": 4}|]
+          ]
+      ]
+      (PredicateRef "all.Node2" 1)
+      $ \stats -> do
+        -- crucially we don't want to have the 3*5 case of matching
+        -- Node<base> + the array element generator.
+        assertEqual "results" 12 -- 1*5 + 1*3 + 3*1 + 1*1
+          (userQueryStats_result_count stats)
+        assertEqual "facts searched" 11 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+
+  , TestLabel "continuations" $ TestCase $
+    derivationStats
+      def { derivePredicateOptions_max_results_per_query = Just 1 }
+      [s|schema all.1 {
+        predicate Node : string
+        predicate Node2 : string stored A where Node A
+      }|]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": "D"}|]
+          , [s|{"key": "E"}|]
+          , [s|{"key": "F"}|]
+          , [s|{"key": "G"}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Node" 1)
+          [ [s|{"key": "A"}|]
+          , [s|{"key": "B"}|]
+          , [s|{"key": "C"}|]
+          ]
+      ]
+      (PredicateRef "all.Node2" 1)
+      $ \stats -> do
+        -- the fact iterators should be serialised correctly such that
+        -- after the query is resumed it will still not pick-up the
+        -- lexicographically greater facts of the base db.
+        assertEqual "incremental" 3 (userQueryStats_result_count stats)
+  , TestLabel "empty derivation" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate Node : string
+        predicate Node2 : string stored A where Node A
+      }|]
+      [ mkBatch (PredicateRef "all.Node" 1) [] ]
+      [ mkBatch (PredicateRef "all.Node" 1) [] ]
+      (PredicateRef "all.Node2" 1)
+      $ \stats -> do
+        -- should not throw an error
+        assertEqual "incremental" 0 (userQueryStats_result_count stats)
+
+  , TestLabel "optimise - sequence of prefix seeks" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate P : { a: nat, b: nat }
+        predicate Q : { a: nat, b: nat }
+        predicate R : { a: nat, b: nat } stored
+          { A, B } where
+            P { K, A };
+            Q { K, B };
+      }|]
+      [ mkBatch (PredicateRef "all.P" 1)
+          [ [s|{"key": { "a": 1, "b": 1}}|]
+          , [s|{"key": { "a": 2, "b": 2}}|]
+          , [s|{"key": { "a": 3, "b": 3}}|]
+          , [s|{"key": { "a": 4, "b": 4}}|]
+          ]
+      , mkBatch (PredicateRef "all.Q" 1)
+          [ [s|{"key": { "a": 1, "b": 1}}|]
+          , [s|{"key": { "a": 2, "b": 2}}|]
+          , [s|{"key": { "a": 3, "b": 3}}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Q" 1)
+          [ [s|{"key": { "a": 4, "b": 4}}|]
+          ]
+      ]
+      (PredicateRef "all.R" 1)
+      $ \stats -> do
+        assertEqual "results" 1 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 5 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+
+  , TestLabel "optimise - disjunction with prefix seeks" $ TestCase $
+    derivationStats def
+      [s|schema all.1 {
+        predicate P : { a: nat, b: nat }
+        predicate Q : { a: nat, b: nat }
+        predicate R : { a: nat, b: nat }
+        predicate S : { a: nat, b: nat } stored
+          { A, B } where
+            P { K, A };
+            (Q { K, B } | R { K, B });
+      }|]
+      [ mkBatch (PredicateRef "all.P" 1)
+          [ [s|{"key": { "a": 1, "b": 1}}|]
+          , [s|{"key": { "a": 2, "b": 2}}|]
+          , [s|{"key": { "a": 3, "b": 3}}|]
+          , [s|{"key": { "a": 4, "b": 4}}|]
+          ]
+      , mkBatch (PredicateRef "all.Q" 1)
+          [ [s|{"key": { "a": 1, "b": 1}}|]
+          ]
+      , mkBatch (PredicateRef "all.R" 1)
+          [ [s|{"key": { "a": 2, "b": 2}}|]
+          ]
+      ]
+      [ mkBatch (PredicateRef "all.Q" 1)
+          [ [s|{"key": { "a": 3, "b": 3}}|]
+          ]
+      , mkBatch (PredicateRef "all.R" 1)
+          [ [s|{"key": { "a": 4, "b": 4}}|]
+          , [s|{"key": { "a": 5, "b": 5}}|]
+          , [s|{"key": { "a": 6, "b": 6}}|]
+          , [s|{"key": { "a": 7, "b": 7}}|]
+          , [s|{"key": { "a": 8, "b": 8}}|]
+          , [s|{"key": { "a": 9, "b": 9}}|]
+          ]
+      ]
+      (PredicateRef "all.S" 1)
+      $ \stats -> do
+        assertEqual "results" 2 (userQueryStats_result_count stats)
+        assertEqual "facts searched" 6 $ maybe 0 (sum . Map.elems)
+          (userQueryStats_facts_searched stats)
+    ]
+  where
+    mkBatch ref facts =
+      JsonFactBatch
+        { jsonFactBatch_predicate = ref
+        , jsonFactBatch_facts = facts
+        , jsonFactBatch_unit = Nothing
+        }
+
+    derivationStats
+      :: Thrift.DerivePredicateOptions
+      -> String
+      -> [JsonFactBatch]
+      -> [JsonFactBatch]
+      -> PredicateRef
+      -> (UserQueryStats -> IO a)
+      -> IO a
+    derivationStats opts schema baseFacts topFacts pref action =
+      withSchemaFile latestAngleVersion schema $ \root file -> do
+      let settings =
+            [ setRoot root
+            , setSchemaPath file
+            ]
+
+          opts' = opts { derivePredicateOptions_collect_facts_searched = True }
+
+      withTestEnv settings $ \env -> do
+        let base = Repo "base" "0"
+        kickOffTestDB env base id
+        void $ syncWriteJsonBatch env base baseFacts Nothing
+        void $ completePredicates env base (CompletePredicates_axiom def)
+        _ <- deriveStored' env base opts' pref
+        completeTestDB env base
+
+        stacked <- stackedDB env base (Repo "base-stacked" "0")
+        void $ syncWriteJsonBatch env stacked topFacts Nothing
+
+        stats <- deriveStored' env stacked opts' pref
+        action stats
+
+    stacked (Repo name hash) = Dependencies_stacked $ Stacked name hash Nothing
+    stackedDB :: Env -> Repo -> Repo -> IO Repo
+    stackedDB env base top = do
+      kickOffTestDB env top $ \kickOff ->
+        kickOff { kickOff_dependencies = Just $ stacked base }
+      return top
+
+    -- get derivation stats
+    deriveStored'
+      :: Env
+      -> Repo
+      -> Thrift.DerivePredicateOptions
+      -> PredicateRef
+      -> IO UserQueryStats
+    deriveStored' env repo opts pref = loop
+      where
+        loop = do
+          let query = derivePredicateQuery opts pref Nothing
+          res <- Backend.deriveStored env (const mempty) repo query
+          case res of
+            DerivationStatus_complete complete ->
+              return $ derivationComplete_stats complete
+            DerivationStatus_ongoing _ -> do
+              threadDelay (ceiling @Double 1e6)
+              loop
+
+    withSchemaFile :: AngleVersion -> String -> (FilePath -> FilePath -> IO a) -> IO a
+    withSchemaFile (AngleVersion version) str action = do
+      withSystemTempDirectory "glean-dbtest" $ \root -> do
+        let newSchemaFile = root </> "schema"
+        appendFile newSchemaFile $ "version: " <> show version
+        appendFile newSchemaFile str
+        action root newSchemaFile
+
+deriveSerial
+  :: forall p. Predicate p
+  => LogDerivationResult
+  -> Env
+  -> Repo
+  -> Proxy p
+  -> IO Int
+deriveSerial log env repo proxy = deriveStored log env repo proxy Nothing
+
+deriveParallel
+  :: forall p. Predicate p
+  => LogDerivationResult
+  -> Env
+  -> Repo
+  -> Proxy p
+  -> ParallelDerivation
+  -> IO Int
+deriveParallel log env repo proxy par =
+  deriveStored log env repo proxy (Just par)
+
+deriveStored
+  :: forall p. Predicate p
+  => LogDerivationResult
+  -> Env
+  -> Repo
+  -> Proxy p
+  -> Maybe ParallelDerivation
+  -> IO Int
+deriveStored log env repo proxy par = do
+  () <- loop
+  length <$> runQuery_ env repo (allFacts @p)
+  where
+    pred = getName proxy
+    loop = do
+      res <- Backend.deriveStored env log repo
+        $ derivePredicateQuery def pred par
+      case res of
+        DerivationStatus_ongoing _ -> threadDelay (ceiling @Double 1e6) >> loop
+        DerivationStatus_complete _ -> return ()
+
+derivePredicateQuery
+  :: Thrift.DerivePredicateOptions
+  -> PredicateRef
+  -> Maybe Thrift.ParallelDerivation
+  -> Thrift.DerivePredicateQuery
+derivePredicateQuery opts (PredicateRef name version) par = def
+  { derivePredicateQuery_predicate = name
+  , derivePredicateQuery_predicate_version = Just version
+  , derivePredicateQuery_parallel = par
+  , derivePredicateQuery_options = Just opts
+  }
diff --git a/glean/test/tests/DbPropertiesTest.hs b/glean/test/tests/DbPropertiesTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/DbPropertiesTest.hs
@@ -0,0 +1,62 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module DbPropertiesTest (main) where
+
+import Control.Monad
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Test.HUnit
+
+import TestRunner
+
+import Glean.Backend.Types
+import Glean.Init
+import Glean.Database.Test
+import Glean.Types
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "propertiesTest" propertiesTest
+  ]
+
+propertiesTest :: Test
+propertiesTest = TestCase $ withTestEnv [] $ \env -> do
+  let repo = Repo "dbtest-repo" "f00baa"
+      props = HashMap.fromList [("key","value")]
+  void $ kickOffDatabase env def
+    { kickOff_repo = repo
+    , kickOff_properties = props
+    }
+
+  let getDatabase = do
+        ListDatabasesResult{..} <- listDatabases env def
+        case listDatabasesResult_databases of
+          [db] -> return db
+          [] -> assertFailure "no database found"
+          _ -> assertFailure "found more databases than expected"
+
+  Database{..} <- getDatabase
+  assertBool "includes kickOff properties" $
+    all (`elem` HashMap.toList database_properties) (HashMap.toList props)
+
+  void $ updateProperties env repo (HashMap.fromList [("key", "newValue")]) []
+  Database{..} <- getDatabase
+  assertBool "can overwrite values" $
+    HashMap.lookup "key" database_properties == Just "newValue"
+
+  void $ updateProperties env repo
+    (HashMap.fromList [("newKey", "newValue")]) ["key"]
+  Database{..} <- getDatabase
+  assertBool "can remove keys" $
+    HashMap.lookup "newKey" database_properties == Just "newValue" &&
+    not (HashMap.member "key" database_properties)
+
+  Database{..} <- getDatabase
+  assertBool "sets glean.schema_id by default" $
+    all (`elem` HashMap.keys database_properties) ["glean.schema_id"]
diff --git a/glean/test/tests/IncrementalTest.hs b/glean/test/tests/IncrementalTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/IncrementalTest.hs
@@ -0,0 +1,803 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module IncrementalTest (main) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import Data.Default
+import Data.List
+import Test.HUnit
+import System.Info
+import System.Exit
+
+import TestRunner
+
+import Glean.Backend.Types (completePredicates)
+import Glean.Init
+import Glean.Database.Close
+import Glean.Database.Types
+import Glean.Database.Ownership
+import Glean.Database.Test
+import Glean.Derive
+import Glean.Schema.Util (parseRef)
+import qualified Glean.Schema.GleanTest as Glean.Test
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import Glean.Query.Angle
+import Glean.Query.Thrift
+import Glean.Typed hiding (end)
+import Glean.Types
+
+
+{-
+     a
+    / \
+   b   c
+    \ /
+     d
+
+owners:
+  nodes:
+   A: a, b, c
+   B: b, d
+   C: c, d
+   D: d
+  edges:
+   A: ab, ac
+   B: bd
+   C: cd
+-}
+mkGraph :: Env -> Repo -> IO ()
+mkGraph env repo =
+  writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+    d <- withUnit "D" $
+      makeFact @Glean.Test.Node (Glean.Test.Node_key "d")
+    c <- withUnit "C" $ do
+      c <- makeFact @Glean.Test.Node (Glean.Test.Node_key "c")
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key c d)
+      return c
+    b <- withUnit "B" $ do
+      b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b d)
+      return b
+    withUnit "A" $ do
+      a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a b)
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a c)
+
+incrementalDB :: Env -> Repo -> Repo -> [ByteString] -> IO Repo
+incrementalDB env base inc prune = do
+  kickOffTestDB env inc $ \kickOff ->
+    kickOff { kickOff_dependencies = Just $
+      Dependencies_pruned def {
+        pruned_base = base,
+        pruned_units = prune,
+        pruned_exclude = True
+      } }
+  return inc
+
+incrementalTest :: Test
+incrementalTest = TestCase $
+
+  -- build a DB with some units and a non-trivial fact graph
+  withTestEnv [] $ \env -> do
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    mkGraph env base
+    completeTestDB env base
+
+    -- check the owners of Node "d"
+    results <- runQuery_ env base $ query $
+      predicate @Glean.Test.Node (rec $ field @"label" (string "d") end)
+    case results of
+      [Glean.Test.Node id _] -> do
+        ownerExpr <- factOwnership env base (Fid id)
+        print ownerExpr
+        assertBool "owners" $
+          case ownerExpr of
+            Just (OrOwners [Unit x, Unit y, Unit z]) ->
+              sort [x,y,z] == ["B","C","D"]
+            _otherwise -> False
+      _ -> assertFailure "query failed"
+
+    -- ------------------------------------------------------------------
+    -- exclude unit A
+
+    inc <- incrementalDB env base (Repo "base-inc" "0") ["A"]
+    completeTestDB env inc
+
+    -- node "a" does not exist
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node (rec $ field @"label" (string "a") end)
+    assertEqual "inc 0" [] results
+
+    -- edge from "b" (and node "b") exists
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Edge
+        (rec $ field @"parent" (rec $ field @"label" (string "b") end) end)
+    assertEqual "inc 1" 1 (length results)
+
+    -- ------------------------------------------------------------------
+    -- exclude unit D
+
+    inc <- incrementalDB env base (Repo "base-inc" "1") ["D"]
+    completeTestDB env inc
+
+    -- edges from "b"/"c" to "d" (and therefore node "d") still exist
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Edge
+        (rec $ field @"child" (rec $ field @"label" (string "d") end) end)
+    assertEqual "inc 2" 2 (length results)
+
+    -- ------------------------------------------------------------------
+    -- exclude all units
+
+    inc <- incrementalDB env base (Repo "base-inc" "2") ["A","B","C","D"]
+    completeTestDB env inc
+
+    -- no nodes exist
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node wild
+    assertEqual "inc 3" [] results
+
+    -- ------------------------------------------------------------------
+    -- exclude A and B, add some new facts
+
+    inc <- incrementalDB env base (Repo "base-inc" "3") ["A","B"]
+
+    -- the new graph will be
+    --              B
+    --              |
+    --              A
+    --             /
+    --            C
+    --            |
+    --            D
+
+    writeFactsIntoDB env inc [ Glean.Test.allPredicates ] $ do
+      c <- withUnit "C" $ do
+        makeFact @Glean.Test.Node (Glean.Test.Node_key "c")
+      a <- withUnit "A" $ do
+        a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a c)
+        return a
+      withUnit "B" $ do
+        b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b a)
+    completeTestDB env inc
+
+    let
+      edgesFrom s = fmap sort $ runQuery_ env inc $ query $
+        var $ \n ->
+          n `where_` [
+            wild .= predicate @Glean.Test.Edge (rec $
+              field @"parent" (rec $ field @"label" (string s) end) $
+              field @"child" (rec $ field @"label" n end)
+            end)
+          ]
+
+    -- check the edges
+    r <- edgesFrom "c"
+    assertEqual "inc 4" ["d"] r
+
+    r <- edgesFrom "a"
+    assertEqual "inc 5" ["c"] r
+
+    r <- edgesFrom "b"
+    assertEqual "inc 6" ["a"] r
+
+stackedIncrementalTest :: Test
+stackedIncrementalTest = TestCase $
+  withTestEnv [] $ \env -> do
+    let
+      deriveAndFinish :: Env -> Repo -> IO ()
+      deriveAndFinish env repo = do
+        void $ completePredicates env repo (CompletePredicates_axiom def)
+        derivePredicate env repo Nothing Nothing
+          (parseRef "glean.test.RevEdge") Nothing
+        derivePredicate env repo Nothing Nothing
+          (parseRef "glean.test.IsParent") Nothing
+        derivePredicate env repo Nothing Nothing
+          (parseRef "glean.test.SkipRevEdge") Nothing
+        completeTestDB env repo
+
+      nodesAre test db ns = do
+        results <- runQuery_ env db $ query $ predicate @Glean.Test.Node wild
+        print results
+        assertEqual test ns
+          (sort [ x | Glean.Test.Node _ (Just (
+                        Glean.Test.Node_key x)) <- results ])
+      edgesAre test db es = do
+        edges <- runQuery_ env db $ recursive $ query $
+          predicate @Glean.Test.Edge wild
+        assertEqual test es
+          (sort [ (x,y) | Glean.Test.Edge _ (Just (
+                    Glean.Test.Edge_key
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key x)))
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key y)))))
+            <- edges ])
+      parentsAre test db ns = do
+        results <- runQuery_ env db $ recursive $ query $ predicate @Glean.Test.IsParent wild
+        print results
+        assertEqual test ns
+          (sort [ x | Glean.Test.IsParent _ (Just (
+                        Glean.Test.Node _ (Just (Glean.Test.Node_key x)))) <- results ])
+
+      revEdgesAre test db es = do
+        edges <- runQuery_ env db $ recursive $ query $
+          predicate @Glean.Test.RevEdge wild
+        assertEqual test es
+          (sort [ (x,y) | Glean.Test.RevEdge _ (Just (
+                    Glean.Test.RevEdge_key
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key x)))
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key y)))))
+            <- edges ])
+
+      skipRevEdgesAre test db es = do
+        edges <- runQuery_ env db $ recursive $ query $
+          predicate @Glean.Test.SkipRevEdge wild
+        assertEqual test es
+          (sort [ (x,y) | Glean.Test.SkipRevEdge _ (Just (
+                    Glean.Test.SkipRevEdge_key
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key x)))
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key y)))))
+            <- edges ])
+
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    mkGraph env base
+    deriveAndFinish env base
+    closeDatabase env base  -- test closing and re-opening the base DB
+
+    {-
+    base:
+         a
+        / \
+       b   c
+        \ /
+         d
+    -}
+
+    inc <- incrementalDB env base (Repo "base-inc" "1") ["A","B"]
+    writeFactsIntoDB env inc [ Glean.Test.allPredicates ] $ do
+      d <- withUnit "D" $ do
+        makeFact @Glean.Test.Node (Glean.Test.Node_key "d")
+      a <- withUnit "A" $ do
+        a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a d)
+        return a
+      withUnit "B" $ do
+        b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b a)
+    deriveAndFinish env inc
+    closeDatabase env base  -- test closing and re-opening the incremental DB
+
+    {-
+    inc:
+         b
+         |
+         a   c
+          \ /
+           d
+    -}
+
+    -- nodes are a,b,c,d
+    nodesAre "stacked inc 0n" inc ["a", "b", "c", "d"]
+    parentsAre "stacked inc 0p" inc ["a", "b", "c"]
+    edgesAre "stacked inc 0e" inc [("a","d"),("b","a"),("c","d")]
+    revEdgesAre "stacked inc 0r" inc [("a","b"),("d","a"),("d","c")]
+    skipRevEdgesAre "stacked inc 0s" inc [("d","b")]
+
+    -- exclude C, and add a new unit E
+    inc2 <- incrementalDB env inc (Repo "base-inc" "2") ["C"]
+    writeFactsIntoDB env inc2 [ Glean.Test.allPredicates ] $ do
+      withUnit "E" $ do
+        a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        e <- makeFact @Glean.Test.Node (Glean.Test.Node_key "e")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key e a)
+    deriveAndFinish env inc2
+
+    {-
+    inc2:
+         b e
+         |/
+         a
+          \
+           d
+    -}
+
+    nodesAre "stacked inc 2n" inc2 ["a", "b", "d", "e"]
+    edgesAre "stacked inc 2e" inc2 [("a","d"),("b","a"),("e","a")]
+    parentsAre "stacked inc 2p" inc2 ["a", "b", "e"]
+    revEdgesAre "stacked inc 2r" inc2 [("a","b"),("a","e"),("d","a")]
+    skipRevEdgesAre "stacked inc 2s" inc2 [("d","b"),("d","e")]
+
+    -- now exclude E
+    inc3 <- incrementalDB env inc2 (Repo "base-inc" "3") ["E"]
+    deriveAndFinish env inc3
+
+    {-
+    inc3:
+         b
+         |
+         a
+          \
+           d
+    -}
+
+    nodesAre "stacked inc 3n" inc3 ["a", "b", "d"]
+    edgesAre "stacked inc 3e" inc3 [("a","d"),("b","a")]
+    parentsAre "stacked inc 3p" inc3 ["a", "b"]
+    revEdgesAre "stacked inc 3r" inc3 [("a","b"),("d","a")]
+    skipRevEdgesAre "stacked inc 3s" inc3 [("d","b")]
+
+    -- The new edge E-A should induce retention of A, even if we exclude unit A
+    inc4 <- incrementalDB env inc2 (Repo "base-inc" "4") ["A","B","D"]
+    deriveAndFinish env inc4
+
+    {-
+    inc4:
+           e
+          /
+         a
+    -}
+
+    nodesAre "stacked inc 4n" inc4 ["a", "e"]
+    edgesAre "stacked inc 4e" inc4 [("e","a")]
+    parentsAre "stacked inc 4p" inc4 ["e"]
+    revEdgesAre "stacked inc 4r" inc4 [("a","e")]
+    skipRevEdgesAre "stacked inc 4s" inc4 []
+
+    inc5 <- incrementalDB env inc (Repo "base-inc" "5") ["C"]
+    writeFactsIntoDB env inc5 [ Glean.Test.allPredicates ] $ do
+      b <- withUnit "B" $ makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+      withUnit "E" $ do
+        e <- makeFact @Glean.Test.Node (Glean.Test.Node_key "e")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b e)
+    deriveAndFinish env inc5
+
+    {-
+    inc5:
+         b---e
+         |
+         a
+          \
+           d
+    -}
+
+    nodesAre "stacked inc 5n" inc5 ["a", "b", "d", "e"]
+    edgesAre "stacked inc 5e" inc5 [("a","d"),("b","a"),("b","e")]
+    parentsAre "stacked inc 5p" inc5 ["a", "b"]
+    revEdgesAre "stacked inc 5r" inc5 [("a","b"),("d","a"),("e","b")]
+    skipRevEdgesAre "stacked inc 5s" inc5 [("d","b")]
+
+    -- Check ownership of the `IsParent (Node "b")` fact in base-inc/5
+    -- It should be B|E, because it was derived from B in the base DB
+    -- and from E in the increment.
+    results <- runQuery_ env inc5 $ recursive $ query $
+      predicate @Glean.Test.IsParent $
+        predicate @Glean.Test.Node $ rec $ field @"label" "b" end
+    case results of
+      [Glean.Test.IsParent id _] -> do
+        ownerExpr <- factOwnership env inc5 (Fid id)
+        assertBool "IsParent owner" $ case ownerExpr of
+          Just (OrOwners [OrOwners [Unit b],OrOwners [Unit e]]) ->
+            sort [b,e] == ["B","E"]
+          _ -> False
+      _ -> assertFailure "query failed"
+
+    inc6 <- incrementalDB env inc5 (Repo "base-inc" "6") ["B"]
+      -- excludes the edge b->a but node b remains because it is
+      -- mentioned by the edge e->b
+
+    {-
+    inc6:
+         b---e
+
+         a
+          \
+           d
+    -}
+
+    nodesAre "stacked inc 6n" inc6 ["a", "b", "d", "e"]
+    edgesAre "stacked inc 6e" inc6 [("a","d"),("b","e")]
+    parentsAre "stacked inc 6p" inc6 ["a", "b"]
+    revEdgesAre "stacked inc 6r" inc6 [("d","a"),("e","b")]
+    skipRevEdgesAre "stacked inc 6s" inc6 []
+
+    -- Check ownership of the `IsParent (Node "b")` fact in the new DB
+    results <- runQuery_ env inc6 $ recursive $ query $
+      predicate @Glean.Test.IsParent $
+        predicate @Glean.Test.Node $ rec $ field @"label" "b" end
+    case results of
+      [Glean.Test.IsParent id _] -> do
+        ownerExpr <- factOwnership env inc6 (Fid id)
+        assertBool "IsParent owner" $ case ownerExpr of
+          Just (OrOwners [OrOwners [Unit b],OrOwners [Unit e]]) ->
+            sort [b,e] == ["B","E"]
+          _ -> False
+      _ -> assertFailure "query failed"
+
+
+stackedIncrementalTest2 :: Test
+stackedIncrementalTest2 = TestCase $
+  withTestEnv [] $ \env -> do
+    let
+      deriveAndFinish :: Env -> Repo -> IO ()
+      deriveAndFinish env repo = do
+        void $ completePredicates env repo (CompletePredicates_axiom def)
+        derivePredicate env repo Nothing Nothing
+          (parseRef "glean.test.NodePair") Nothing
+        completeTestDB env repo
+
+      nodesAre test db ns = do
+        results <- runQuery_ env db $ query $ predicate @Glean.Test.Node wild
+        print results
+        assertEqual test ns
+          (sort [ x | Glean.Test.Node _ (Just (
+                        Glean.Test.Node_key x)) <- results ])
+      pairsAre test db es = do
+        edges <- runQuery_ env db $ recursive $ query $
+          predicate @Glean.Test.NodePair wild
+        assertEqual test es
+          (sort [ (x,y) | Glean.Test.NodePair _ (Just (
+                    Glean.Test.NodePair_key
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key x)))
+                      (Glean.Test.Node _ (Just (Glean.Test.Node_key y)))))
+            <- edges ])
+
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    writeFactsIntoDB env base [ Glean.Test.allPredicates ] $ do
+      withUnit "X" $ do
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "a")
+      withUnit "Y" $ do
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "c")
+    deriveAndFinish env base
+
+    {-
+    base:
+         a{X}<--->b{Y}
+    -}
+
+    inc <- incrementalDB env base (Repo "base-inc" "1") ["Y"]
+    writeFactsIntoDB env inc [ Glean.Test.allPredicates ] $ do
+      a <- withUnit "X" $
+        makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+      withUnit "Z" $ do
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "c")
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "d")
+      withUnit "E" $
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a a)
+    closeDatabase env inc -- we should be able to close and re-open here
+    deriveAndFinish env inc
+
+    {-
+    inc:
+
+    c{Z}-----d{Z}
+       \    /
+        \  /
+         a{X} <--- Edge{Z}
+    -}
+    nodesAre "0n" inc ["a","c","d"]
+    pairsAre "0p" inc [
+      ("a","c"),("a","d"),("c","a"),("c","d"),("d","a"),("d","c") ]
+
+    -- check the owner of node "a"
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node $ rec $ field @"label" "a" end
+    case results of
+      [Glean.Test.Node id _] -> do
+        ownerExpr <- factOwnership env inc (Fid id)
+        print ownerExpr
+        assertBool "owners" $
+          case ownerExpr of
+            -- {X} is the original owner, {{X},X,E} is the propagated
+            -- ownership from the stacked DB.
+            Just (OrOwners [OrOwners [Unit "X"], Unit x, Unit e]) ->
+              sort [x,e] == ["E", "X"]
+            _otherwise -> False
+      _ -> assertFailure "query failed"
+
+    inc2 <- incrementalDB env inc (Repo "base-inc" "2") ["X"]
+    deriveAndFinish env inc2
+    -- exclude X, but node "a" should be kept alive by Edge{Z}
+    -- and hence the pairs should all still be alive
+    {-
+    inc2:
+
+    c{Z}-----d{Z}
+       \    /
+        \  /
+         a{X} <--- Edge{Z}
+    -}
+    nodesAre "1n" inc2 ["a","c","d"]
+    pairsAre "1p" inc2 [
+      ("a","c"),("a","d"),("c","a"),("c","d"),("d","a"),("d","c") ]
+
+    -- excluding "E" should make "a" and its derived pairs go away
+    inc3 <- incrementalDB env inc2 (Repo "base-inc" "3") ["E"]
+    deriveAndFinish env inc3
+    {-
+    inc3:
+
+    c{Z}-----d{Z}
+    -}
+    nodesAre "1n" inc3 ["c","d"]
+    pairsAre "1p" inc3 [("c","d"),("d","c")]
+
+-- tickled a bug in the storage of ownership information
+dupSetTest :: Test
+dupSetTest = TestCase $
+  withTestEnv [] $ \env -> do
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    writeFactsIntoDB env base [ Glean.Test.allPredicates ] $ do
+      withUnit "A" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "a")
+      withUnit "B" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "b")
+    writeFactsIntoDB env base [ Glean.Test.allPredicates ] $ do
+      withUnit "A" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "aa")
+      withUnit "B" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "bb")
+    completeTestDB env base
+
+    inc <- incrementalDB env base (Repo "base-inc" "0") ["B"]
+
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node wild
+    assertEqual "dupSetTest" 2 (length results)
+
+orphanTest :: Test
+orphanTest = TestCase $
+  withTestEnv [] $ \env -> do
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    writeFactsIntoDB env base [ Glean.Test.allPredicates ] $ do
+      d <- withUnit "D" $
+        makeFact @Glean.Test.Node (Glean.Test.Node_key "d")
+      c <- withUnit "C" $ do
+        c <- makeFact @Glean.Test.Node (Glean.Test.Node_key "c")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key c d)
+        return c
+      b <- withUnit "B" $ do
+        b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+        makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key b d)
+        return b
+      -- these facts are orphans:
+      a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a b)
+      makeFact_ @Glean.Test.Edge (Glean.Test.Edge_key a c)
+    completeTestDB env base
+
+    -- exclude all of B, C, D
+    inc <- incrementalDB env base (Repo "base-inc" "0") ["B","C","D"]
+
+    -- no nodes should exist
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node wild
+    assertEqual "orphan 0" [] results
+
+    -- no edges should exist
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Edge
+        (rec $ field @"parent" (rec $ field @"label" (string "a") end) end)
+    assertEqual "orphan 1" [] results
+
+    -- exclude just B
+    inc <- incrementalDB env base (Repo "base-inc" "1") ["B"]
+
+    -- 2 nodes now
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Node wild
+    assertEqual "orphan 2" 2 (length results)
+
+    -- one edge
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.Edge
+        (rec $ field @"child" (rec $ field @"label" (string "d") end) end)
+    assertEqual "orphan 3" 1 (length results)
+
+externalDerivationTest :: Test
+externalDerivationTest = TestList
+  [ TestLabel "add fact with dependencies" $ TestCase $
+    withDB $ \env repo -> do
+      writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+        a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+        p <- makeFact @Glean.Test.StringPair (Glean.Test.StringPair_key "a" "b")
+        derivedFrom [idOf (getId a), idOf (getId b)] [p]
+
+      void $ completePredicates env repo $ CompletePredicates_derived $
+        CompleteDerivedPredicate $
+        PredicateRef "glean.test.StringPair" 6
+
+      owners <- ownersOf env repo $ query $
+        predicate @Glean.Test.StringPair wild
+
+      assertEqual "owners"
+        (show [Just $ AndOwners
+          [ OrOwners [Unit "B"]
+          , OrOwners [Unit "A"]
+          ] ])
+        (show owners)
+
+  , TestLabel "multiple predicates in the same batch" $ TestCase $
+    withDB $ \env repo -> do
+      writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+        a <- makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        p <- makeFact @Glean.Test.StringPair (Glean.Test.StringPair_key "a" "a")
+        derivedFrom [idOf (getId a)] [p]
+
+        b <- makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+        n <- makeFact @Glean.Test.Name "b"
+        derivedFrom [idOf (getId b)] [n]
+
+      void $ completePredicates env repo $ CompletePredicates_derived $
+        CompleteDerivedPredicate $
+        PredicateRef "glean.test.StringPair" 6
+
+      void $ completePredicates env repo $ CompletePredicates_derived $
+        CompleteDerivedPredicate $
+        PredicateRef "glean.test.Name" 6
+
+      owners <- ownersOf env repo $ query $
+        predicate @Glean.Test.StringPair wild
+      assertEqual "StringPair owners"
+        (show [Just $ OrOwners [Unit "A"]])
+        (show owners)
+
+      owners <- ownersOf env repo $ query $
+        predicate @Glean.Test.Name wild
+      assertEqual "Name owners"
+        (show [Just $ OrOwners [Unit "B"]])
+        (show owners)
+  ]
+  where
+  ownersOf env repo q = do
+    results <- runQuery_ env repo q
+    let fids = map (idOf . getId) results
+    traverse (factOwnership env repo) fids
+
+  withDB act =
+    withTestEnv [setCompactOnCompletion] $ \env -> do
+      let repo = Repo "base" "0"
+      kickOffTestDB env repo id
+      writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+        void $ withUnit "A" $
+          makeFact @Glean.Test.Node (Glean.Test.Node_key "a")
+        void $ withUnit "B" $
+          makeFact @Glean.Test.Node (Glean.Test.Node_key "b")
+      void $ completePredicates env repo $ CompletePredicates_axiom def
+      act env repo
+
+deriveTest :: Test
+deriveTest = TestCase $
+  withTestEnv [setCompactOnCompletion] $ \env -> do
+    let base = Repo "base" "0"
+    kickOffTestDB env base id
+    mkGraph env base
+    void $ completePredicates env base (CompletePredicates_axiom def)
+
+    derivePredicate env base Nothing Nothing
+      (parseRef "glean.test.RevEdge") Nothing
+    derivePredicate env base Nothing Nothing
+      (parseRef "glean.test.SkipRevEdge") Nothing
+
+    completeTestDB env base
+
+    -- check the owners of SkipRevEdge d->a
+    results <- runQuery_ env base $ query $
+      predicate @Glean.Test.SkipRevEdge $
+        rec $ field @"child" (
+          rec $ field @"label" (string "d") end
+        ) end
+    case results of
+      [Glean.Test.SkipRevEdge id _] -> do
+        ownerExpr <- factOwnership env base (Fid id)
+        print ownerExpr
+        assertBool "owners" $
+          case ownerExpr of
+            Just (OrOwners [
+                AndOwners [OrOwners [Unit a],OrOwners [Unit b]],
+                AndOwners [OrOwners [Unit c],OrOwners [Unit d]]
+              ]) ->
+              sort [a,b,c,d] == ["A", "A", "B", "C"]
+            _otherwise -> False
+      _ -> assertFailure "query failed"
+
+    -- should have two RevEdges, d->b and d->c
+    results <- runQuery_ env base $ query $
+      predicate @Glean.Test.RevEdge
+        (rec $ field @"child" (rec $ field @"label" (string "d") end) end)
+    assertEqual "derived 1" 2 (length results)
+
+    -- We have one SkipRevEdge fact, d->a
+    results <- runQuery_ env base $ query $
+      predicate @Glean.Test.SkipRevEdge wild
+    assertEqual "derived 2" 1 (length results)
+
+    inc <- incrementalDB env base (Repo "base-inc" "1") ["B"]
+
+    -- should have pruned the RevEdge from d->b
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.RevEdge
+        (rec $ field @"child" (rec $ field @"label" (string "d") end) end)
+    assertEqual "derived 3" 1 (length results)
+
+    -- The SkipRevEdge fact d->a should be visible if
+    --    (A && B) || (A && C)
+
+    -- visible if we hide B
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.SkipRevEdge wild
+    assertEqual "derived 4" 1 (length results)
+
+    -- invisible if we hide A
+    inc <- incrementalDB env base (Repo "base-inc" "2") ["A"]
+
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.SkipRevEdge wild
+    assertEqual "derived 5" 0 (length results)
+
+    -- visible if we hide D
+    inc <- incrementalDB env base (Repo "base-inc" "3") ["D"]
+
+    results <- runQuery_ env inc $ query $
+      predicate @Glean.Test.SkipRevEdge wild
+    assertEqual "derived 6" 1 (length results)
+
+restartIndexing :: Test
+restartIndexing = TestCase $
+  withTestEnv [] $ \env -> do
+    let repo = Repo "base" "0"
+    kickOffTestDB env repo id
+    writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+      withUnit "A" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "a")
+    closeDatabase env repo
+    -- After closing and re-opening, add more facts to the "A" unit.
+    -- This tests loadOwnershipUnitCounters()
+    writeFactsIntoDB env repo [ Glean.Test.allPredicates ] $ do
+      withUnit "A" $
+        makeFact_ @Glean.Test.Node (Glean.Test.Node_key "b")
+    completeTestDB env repo
+
+    results <- runQuery_ env repo $ recursive $ query $
+      predicate @Glean.Test.Node $ rec $ field @"label" "a" end
+    case results of
+      [Glean.Test.Node id _] -> do
+        ownerExpr <- factOwnership env repo (Fid id)
+        assertBool "Node owner" $ case ownerExpr of
+          Just (OrOwners [Unit "A"]) -> True
+          _ -> False
+      _ -> assertFailure "query failed"
+
+main :: IO ()
+main = do
+  if System.Info.arch == "x86_64"
+    then main_
+    else do
+      putStrLn "Incremental Glean not supported on non-x86_64 (see ownership.{h/cpp})"
+      exitWith (ExitFailure 1)
+
+main_ :: IO ()
+main_ = withUnitTest $ testRunner $ TestList
+  [ TestLabel "incrementalTest" incrementalTest
+  , TestLabel "dupSetTest" dupSetTest
+  , TestLabel "orphanTest" orphanTest
+  , TestLabel "deriveTest" deriveTest
+  , TestLabel "externalDerivationTest" externalDerivationTest
+  , TestLabel "stackedIncrementalTest" stackedIncrementalTest
+  , TestLabel "stackedIncrementalTest2" stackedIncrementalTest2
+  , TestLabel "restartIndexing" restartIndexing
+  ]
diff --git a/glean/test/tests/InventoryTest.hs b/glean/test/tests/InventoryTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/InventoryTest.hs
@@ -0,0 +1,106 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module InventoryTest
+  ( main
+  ) where
+
+import Control.Monad (forM)
+import Data.Default
+import qualified Data.HashMap.Strict as HM
+import Data.HashMap.Strict (HashMap)
+import qualified Data.Map as Map
+import Test.HUnit
+
+import TestRunner
+import Util.IO (listDirectoryRecursive)
+
+import Glean.Database.Config
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.Init
+import Glean.Internal.Types (storedSchema_predicateIds)
+import Glean.RTS.Foreign.Inventory (Inventory)
+import qualified Glean.RTS.Foreign.Inventory as Inventory
+
+serializeTest :: Inventory -> IO ()
+serializeTest inventory = assertBool "roundtrip" $
+  Inventory.deserialize (Inventory.serialize inventory) == inventory
+
+mkSchema
+  :: (forall k v . HashMap k v -> [(k,v)])
+  -> SchemaIndex
+  -> IO DbSchema
+mkSchema toList schemaIndex =
+  newDbSchemaForTesting toList Nothing schemaIndex LatestSchema
+    readWriteContent def
+
+main :: IO ()
+main = withUnitTest $ do
+  schema <- parseSchemaDir schemaSourceDir
+
+  testRunner $ TestList
+    [ TestLabel "serialize" $ TestCase $ do
+        inventory <- schemaInventory <$> mkSchema HM.toList schema
+        serializeTest inventory
+    , TestLabel "serializeDeleted" $ TestCase $ do
+        dbSchema <- mkSchema HM.toList schema
+        let -- inventory serialization/deserialization should work if there
+            -- are gaps in the Pid range.
+            stored = toStoredSchema dbSchema
+            pids = storedSchema_predicateIds stored
+            newStored = stored {
+              storedSchema_predicateIds = Map.mapKeys (*2) pids
+              }
+        newDbSchema <- fromStoredSchema Nothing newStored readWriteContent def
+        serializeTest (schemaInventory newDbSchema)
+    , TestLabel "determinism" $ TestList
+      [ TestLabel "permuted schema files" $
+        deterministicOnFilesTest schemaSourceDir
+      , TestLabel "permuted HashMaps" $
+        deterministicOnHashMaps schemaSourceDir
+      ]
+    ]
+
+deterministicOnFilesTest :: FilePath -> Test
+deterministicOnFilesTest schemaSourceDir = TestCase $ do
+  files <- listDirectoryRecursive schemaSourceDir
+  permutedFiles <- mapM catSchemaFiles (permuteList files)
+  schemas <-
+    mapM
+      (either error (mkSchema HM.toList) . processOneSchema Nothing)
+      permutedFiles
+  testDeterminism schemas
+
+deterministicOnHashMaps :: FilePath -> Test
+deterministicOnHashMaps schemaSourceDir = TestCase $ do
+  files <- catSchemaFiles =<< listDirectoryRecursive schemaSourceDir
+  schemas1 <-
+    either error (mkSchema HM.toList . (`SchemaIndex` [])) $
+      processSchemaForTesting HM.toList Nothing files
+  schemas2 <-
+    either error (mkSchema (reverse . HM.toList) . (`SchemaIndex` [])) $
+      processSchemaForTesting (reverse . HM.toList) Nothing files
+  testDeterminism [schemas1, schemas2]
+
+--------------------------------------------------------------------------------
+
+testDeterminism :: [DbSchema] -> IO ()
+testDeterminism permutations = do
+  assertBool "Test input is empty or a singleton" (length permutations > 1)
+  inventories <- forM permutations $ \s -> do
+    let i = schemaInventory s
+    let !serial = Inventory.serialize i
+    return (serial, s)
+  let unique = Map.fromList inventories
+      assertMsg = "Inventory is not deterministic: " <> show (length unique)
+
+  assertBool assertMsg (length unique == 1)
+
+permuteList :: [a] -> [[a]]
+permuteList list = [list, reverse list]
diff --git a/glean/test/tests/JSONWriteTest.hs b/glean/test/tests/JSONWriteTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/JSONWriteTest.hs
@@ -0,0 +1,332 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications, QuasiQuotes #-}
+module JSONWriteTest (main) where
+
+import Control.Monad
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as BC
+import Data.Default
+import Data.List (isInfixOf)
+import Data.Proxy
+import Test.HUnit
+
+import TestRunner
+import Thrift.Protocol.JSON
+import Util.String.Quasi
+import Util.Control.Exception (tryAll)
+
+import Glean (factIdRange)
+import Glean.Init
+import Glean.Database.Test
+import Glean.Write.JSON (syncWriteJsonBatch)
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+import qualified Glean.Schema.Sys.Types as Sys
+import Glean.Query.Angle
+import Glean.Query.Thrift
+import Glean.Typed hiding (end)
+import Glean.Types
+
+import TestData
+
+mkBatch :: PredicateRef -> [ByteString] -> JsonFactBatch
+mkBatch ref facts =
+  JsonFactBatch
+    { jsonFactBatch_predicate = ref
+    , jsonFactBatch_facts = facts
+    , jsonFactBatch_unit = Nothing
+    }
+
+writeJsonBatchTest :: Test
+writeJsonBatchTest = TestCase $ withEmptyTestDB [] $ \env repo -> do
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob))
+        [ "{ \"id\": 1025, \"key\": \"hello\"}"
+        , "{ \"id\": 1026, \"key\": \"bye\"}"
+        ]
+      ]
+    options = Just SendJsonBatchOptions
+      { sendJsonBatchOptions_no_base64_binary = True
+      , sendJsonBatchOptions_schema_id = Nothing
+      }
+
+    options' = Just SendJsonBatchOptions
+      { sendJsonBatchOptions_no_base64_binary = False
+      , sendJsonBatchOptions_schema_id = Nothing
+      }
+
+  _ <- syncWriteJsonBatch env repo batches options
+
+  results <- runQuery_ env repo $ query $
+    predicate @Sys.Blob (byteArray "hello")
+  case results of
+    [Sys.Blob{}] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - sys.Blob"
+
+  -- Write another fact into the DB
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob))
+        [ "{ \"id\": 1025, \"key\": \"test\"}" -- overlaps with previous
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Sys.Blob (byteArray "test")
+  test_blob_id <- case results of
+    [Sys.Blob{..}] -> return blob_id
+    _ -> do _ <- assertFailure "syncWriteJsonBatch - sys.Blob 2"; return 0
+
+  -- Test a predicate ref to an earlier fact
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [ "{ \"id\": 1025, \"key\": { \"sum_\" : { \"d\": " <>
+          BC.pack (show test_blob_id) <> "}, \"pred\" : " <>
+          BC.pack (show test_blob_id) <> "}}"
+            -- most of the fields are defaulted
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate wild
+  test_predicate_id <- case results of
+    [Glean.Test.Predicate{..}] -> return predicate_id
+    _ -> do
+      _ <- assertFailure "syncWriteJsonBatch - glean.test.Predicate";
+      return 0
+
+  -- insert the same fact again, ensure we still have just one
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate wild
+  assertBool "syncWriteJsonBatch - glean.test.Predicate 2" $ case results of
+    [Glean.Test.Predicate{..}] -> predicate_id == test_predicate_id
+    _ -> False
+
+  -- Test a predicate ref to a fact in the same batch
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob))
+        [ "{ \"id\": 1025, \"key\": \"test2\"}"
+        ]
+      , mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [ "{ \"id\": 1026, \"key\": { \"sum_\" : { \"d\": 1025" <>
+          "}, \"pred\" : 1025}}"
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "test2") end
+  test_pred <- case results of
+    [fact@Glean.Test.Predicate{}] -> return fact
+    _ -> do
+      _ <- assertFailure "syncWriteJsonBatch - glean.test.Predicate 3"
+      return def
+
+  -- test a more interesting value:
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [ serializeJSON $ Glean.Test.Predicate 1027 $
+            let blob = Sys.Blob 1028 (Just "blobby") in
+            Just $ kitchenSink1 {
+              Glean.Test.kitchenSink_pred = blob,
+              Glean.Test.kitchenSink_sum_ = Glean.Test.KitchenSink_sum__d blob }
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options'
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "blobby") end
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - glean.test.Predicate.1"
+
+  -- nested facts can have duplicate Ids, provided we don't refer to them
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        -- Construct a value using "def", which will set all the IDs to 0.
+        -- Note that we *must* define the nested facts, otherwise they
+        -- will default to a reference to fact 0, which will be an error.
+        [ serializeJSON $ def
+            { Glean.Test.predicate_key = Just $ def
+                { Glean.Test.kitchenSink_pred =
+                    def { Sys.blob_key = Just "abc" }
+                , Glean.Test.kitchenSink_sum_ =
+                  Glean.Test.KitchenSink_sum__d $
+                    def { Sys.blob_key = Just "def" }
+                , Glean.Test.kitchenSink_named_record_ =
+                    def { Glean.Test.rec_beta = Glean.Test.Sum_wed True }
+                , Glean.Test.kitchenSink_named_sum_ =
+                    Glean.Test.Sum_wed True
+                , Glean.Test.kitchenSink_maybe_ = Nothing
+                }
+            }
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options'
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "abc") end
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - glean.test.Predicate.1"
+
+  -- Round-trip test: serialize the fact and insert it again
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [ serializeJSON test_pred
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "test2") end
+  void $ case results of
+    [fact@Glean.Test.Predicate{}] -> return fact
+    _ -> do
+      _ <- assertFailure "syncWriteJsonBatch - glean.test.Predicate 4"
+      return def
+
+  -- Test for ids very far apart
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob))
+        [ "{ \"id\": 1024, \"key\": \"test4\"}"
+        , "{ \"id\": 4611686018427387903, \"key\": \"test5\"}"
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Sys.Blob (byteArray "test5")
+  print results
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - sparse ids"
+
+  -- Test for missing ids
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob))
+        [ "{\"key\": " <> BC.pack (show s) <> "}"
+        | s <- sequence ["ab","bc","cd"]
+        ]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Sys.Blob (byteArray "bcd")
+  print results
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - missing ids"
+
+  -- Test for mixture of named + anon facts
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Sys.Blob)) $
+        [ "{\"key\": " <> BC.pack (show s) <> "}"
+        | s <- sequence ["ab","bc","cd"]
+        ] ++
+        [[s| {"id": 10000, "key": "abba"} |]]
+      , mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [[s|
+          { "key": { "sum_" : { "d": 10000 }, "pred" : 10000}}
+        |]]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "abba") end
+  print results
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - mixture of named + anon"
+
+  -- Test for nested facts
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [[s|
+        { "key":
+          { "sum_": { "d": { "id": 10000, "key": "abba" }}
+          , "pred": 10000
+          }
+        }
+        |]]  --  id 10000 is defined and used in the same fact
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "abba") end
+  print results
+  case results of
+    [_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - nested facts"
+
+  -- Named facts that refer to anon facts
+  let
+    batches =
+      [ mkBatch (getName (Proxy @Glean.Test.Predicate))
+        [[s|
+        { "id": 3
+        , "key":
+          { "sum_": { "d": { "key": "abba" }}
+          , "pred": { "key": "baab" }
+          }
+        }
+        |]
+        ,[s|
+        { "id": 4
+        , "key":
+          { "sum_": { "c": 3 }
+          , "pred": { "key": "baab" }
+          }
+        }
+        |]]
+      ]
+  _ <- syncWriteJsonBatch env repo batches options
+  results <- runQuery_ env repo $ query $
+    predicate @Glean.Test.Predicate $
+      rec $ field @"pred" (byteArray "baab") end
+  print results
+  case results of
+    [_,_] -> return ()
+    _ -> assertFailure "syncWriteJsonBatch - named fact that refers to anon facts"
+
+  -- same key with different values
+  withEmptyTestDB [] $ \env repo -> do
+    let
+      batches =
+        [ mkBatch (getName (Proxy @Glean.Test.KeyValue))
+          [[s| { "key":   { "kstring": "A", "knat" : 1 },
+                 "value": { "vstring": "A", "vnat" : 1 } }
+          |]]
+        , mkBatch (getName (Proxy @Glean.Test.KeyValue))
+          [[s| { "key":   { "kstring": "A", "knat" : 1 },
+                 "value": { "vstring": "B", "vnat" : 2 } }
+          |]]
+        ]
+      label = "syncWriteJsonBatch - same key with different values"
+    FactIdRange _ finish <- factIdRange env repo
+    r <- tryAll $ syncWriteJsonBatch env repo batches options
+    print r
+    case r of
+      Right _ -> assertFailure label
+      Left err -> assertBool label $
+        ("invalid fact redefinition of $" <> show finish) `isInfixOf` show err
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "writeJsonBatchTest" writeJsonBatchTest
+  ]
diff --git a/glean/test/tests/LifecycleTest.hs b/glean/test/tests/LifecycleTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/LifecycleTest.hs
@@ -0,0 +1,294 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE TypeApplications #-}
+module LifecycleTest (main) where
+
+import Control.Concurrent.Async
+import Control.Concurrent.MVar
+import Util.STM
+import Control.Exception hiding (assert)
+import Control.Monad
+import Data.Default
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import Data.Proxy
+import GHC.Stack (HasCallStack)
+import Test.HUnit
+import Test.QuickCheck.IO ()
+
+import TestRunner
+
+import Glean (fillDatabase, enqueueJsonBatch)
+import qualified Glean.Database.Catalog as Catalog
+import Glean.Database.Catalog.Filter
+import Glean.Database.Catalog.Test
+import Glean.Database.Config
+import Glean.Database.Close
+import Glean.Database.Create
+import Glean.Database.Open
+import Glean.Database.Delete
+import Glean.Database.Storage.Memory (newStorage)
+import Glean.Database.Test
+import Glean.Database.Types
+import Glean.Init
+import Glean.Internal.Types
+import Glean.Test.HUnit
+import Glean.Test.Mock
+import Glean.Types hiding (Exception)
+
+data TEnv = TEnv
+  { tEnv :: Env
+  , tStore :: MockStore
+  }
+
+withTEnv :: (TEnv -> IO a) -> IO a
+withTEnv f = do
+  catalog <- memStore
+  storage <- newStorage
+  withTestEnv
+    [\cfg -> cfg
+        { cfgDataStore = DataStore
+            { withDataStore = \_ f -> f catalog storage
+            , dataStoreTag = "test"
+            }
+        }]
+    $ \env -> do
+      x <- f $ TEnv env catalog
+      checkActive env False
+      return x
+
+data TestError = TestError
+  deriving(Eq,Show)
+
+instance Exception TestError
+
+data InconsistentDBError = InconsistentDBError Repo String
+  deriving(Show)
+
+instance Exception InconsistentDBError
+
+mkDB :: HasCallStack => Env -> Repo -> IO ()
+mkDB env repo =
+  fillDatabase env repo Nothing
+    (fail "database already exists") (return ())
+
+checkActive :: HasCallStack => Env -> Bool -> IO ()
+checkActive Env{..} allow_deleting = do
+  checkConsistency envCatalog
+  atomically $ do
+    active <- readTVar envActive
+    forM_ (HashMap.toList active) $ \(repo, DB{..}) -> do
+      ex <- Catalog.exists envCatalog [Local] repo
+      when (not ex) $ throwSTM $ InconsistentDBError repo
+        "in envActive but not in Catalog"
+      users <- readTVar dbUsers
+      when (users == 0) $ do
+        state <- readTVar dbState
+        case state of
+          Open{} -> return ()
+          Closed -> do
+            meta <- Catalog.readMeta envCatalog repo
+            case metaCompleteness meta of
+              Incomplete{} -> return ()
+              _ -> throwSTM $ InconsistentDBError repo
+                "in envActive but not active"
+          Opening -> throwSTM $ InconsistentDBError repo "no users but Opening"
+          Closing -> throwSTM $ InconsistentDBError repo "no users but Closing"
+    deleting <- readTVar envDeleting
+    if allow_deleting
+      then case HashMap.keys $ HashMap.intersection active deleting of
+        [] -> return ()
+        repo : _ -> throwSTM $ InconsistentDBError repo
+          "in envActive and envDeleting"
+      else case HashMap.keys deleting of
+        [] -> return ()
+        repo : _ -> throwSTM $ InconsistentDBError repo
+          "in envDeleting"
+
+kickOff :: HasCallStack => Env -> Repo -> IO Bool
+kickOff env repo = do
+  KickOffResponse ex <- kickOffDatabase env def
+    { kickOff_repo = repo
+    }
+  return ex
+
+repo1 :: Repo
+repo1 = Repo "foo" "1"
+
+repo2 :: Repo
+repo2 = Repo "foo" "2"
+
+hasActiveDatabase :: Env -> Repo -> IO Bool
+hasActiveDatabase Env{..} repo = HashMap.member repo <$> readTVarIO envActive
+
+kickOffTwice :: Test
+kickOffTwice = TestCase $ withTEnv $ \TEnv{..} -> do
+  assert $ not <$> kickOff tEnv repo1
+  assert $ hasActiveDatabase tEnv repo1
+  assert $ kickOff tEnv repo1
+  assert $ hasActiveDatabase tEnv repo1
+
+kickOffFail :: Test
+kickOffFail = TestCase $ withTEnv $ \TEnv{..} -> do
+  prepare (storeCreate tStore) [ doBefore $ throwIO TestError ]
+  assertThrows "" TestError $ kickOff tEnv repo1
+  assert $ fmap not $ hasActiveDatabase tEnv repo1
+
+kickOffRace :: Test
+kickOffRace = TestCase $ withTEnv $ \TEnv{..} -> do
+  v1 <- newEmptyMVar
+  v2 <- newEmptyMVar
+  prepare (storeCreate tStore) [ doBefore $ do putMVar v1 () ; takeMVar v2 ]
+  withAsync (kickOff tEnv repo1) $ \k -> do
+    takeMVar v1
+    assert $ kickOff tEnv repo1
+    assert $ fmap not $ hasActiveDatabase tEnv repo1
+    putMVar v2 ()
+    assert $ not <$> wait k
+  assert $ hasActiveDatabase tEnv repo1
+
+kickOffConcurrently :: Test
+kickOffConcurrently = TestCase $ withTEnv $ \TEnv{..} -> do
+  v1 <- newEmptyMVar
+  v2 <- newEmptyMVar
+  prepare (storeCreate tStore) [ doBefore $ do putMVar v1 () ; takeMVar v2 ]
+  withAsync (kickOff tEnv repo1) $ \k -> do
+    takeMVar v1
+    assert $ not <$> kickOff tEnv repo2
+    assert $ fmap not $ hasActiveDatabase tEnv repo1
+    assert $ hasActiveDatabase tEnv repo2
+    putMVar v2 ()
+    assert $ not <$> wait k
+  assert $ hasActiveDatabase tEnv repo1
+
+closeIdle :: Test
+closeIdle = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  withOpenDatabase tEnv repo1 $ \_ -> return ()
+  assert $ not <$> isDatabaseClosed tEnv repo1
+  -- make sure we release the use count correctly
+  assertThrows "" TestError $
+    withOpenDatabase tEnv repo1 (\_ -> throwIO TestError)
+
+  closeIdleDatabase tEnv repo1 0
+  assert $ isDatabaseClosed tEnv repo1
+
+closeUsed :: Test
+closeUsed = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  withOpenDatabase tEnv repo1 $ \_ -> return ()
+  assert $ not <$> isDatabaseClosed tEnv repo1
+
+  withOpenDatabase tEnv repo1 $ \_ -> closeIdleDatabase tEnv repo1 0
+  assert $ not <$> isDatabaseClosed tEnv repo1
+
+deleteOpen :: Test
+deleteOpen = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  withOpenDatabase tEnv repo1 $ \_ -> return ()
+  assert $ not <$> isDatabaseClosed tEnv repo1
+
+  deleteDatabase tEnv repo1
+  atomically $ do
+    ex <- Catalog.exists (envCatalog tEnv) [Local] repo1
+    when ex retry
+  assertThrowsType "" (Proxy @UnknownDatabase) $
+    withOpenDatabase tEnv repo1 $ \_ -> return ()
+
+deleteWhileUsing :: Test
+deleteWhileUsing = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  del <- withOpenDatabase tEnv repo1 $ \_ -> do
+    del <- asyncDeleteDatabase tEnv repo1
+    atomically $ do
+      deleting <- readTVar (envDeleting tEnv)
+      when (not $ repo1 `HashMap.member` deleting) retry
+    checkActive tEnv True
+    return del
+  wait del
+
+kickOffWhileDeleting :: Test
+kickOffWhileDeleting = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  withOpenDatabase tEnv repo1 $ \_ -> return ()
+  assert $ not <$> isDatabaseClosed tEnv repo1
+
+  v1 <- newEmptyMVar
+  v2 <- newEmptyMVar
+
+  prepare (storeDelete tStore) [ doBefore $ do putMVar v1 () ; takeMVar v2 ]
+  concurrently_ (deleteDatabase tEnv repo1) $ do
+    takeMVar v1
+    True <- kickOff tEnv repo1
+    putMVar v2 ()
+
+useWhileDeleting :: Test
+useWhileDeleting = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  withOpenDatabase tEnv repo1 $ \_ -> return ()
+  assert $ not <$> isDatabaseClosed tEnv repo1
+
+  v1 <- newEmptyMVar
+  v2 <- newEmptyMVar
+
+  prepare (storeDelete tStore) [ doBefore $ do putMVar v1 () ; takeMVar v2 ]
+  concurrently_ (deleteDatabase tEnv repo1) $ do
+    takeMVar v1
+    assertThrowsType "" (Proxy @UnknownDatabase) $
+      withOpenDatabase tEnv repo1 $ \_ -> return ()
+    putMVar v2 ()
+
+writeAfterFinished :: Test
+writeAfterFinished = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  r <- try $ enqueueJsonBatch tEnv repo1 (def { sendJsonBatch_batches = [] })
+  assertBool "writeAfterFinished" $ case r of
+    Left err -> "read-only" `isInfixOf` show (err :: SomeException)
+    _ -> False
+
+stacked :: Repo -> Dependencies
+stacked (Repo name hash) = Dependencies_stacked $
+  Stacked name hash Nothing
+
+kickOffStacked :: Test
+kickOffStacked = TestCase $ withTEnv $ \TEnv{..} -> do
+  mkDB tEnv repo1
+  waitUntilComplete tEnv repo1
+  KickOffResponse ex <- kickOffDatabase tEnv def
+    { kickOff_repo = repo2
+    , kickOff_dependencies = Just $ stacked repo1
+    }
+  assert $ not ex
+  withOpenDatabase tEnv repo2 $ \_ -> return ()
+
+kickOffStackedIncomplete :: Test
+kickOffStackedIncomplete = TestCase $ withTEnv $ \TEnv{..} -> do
+  assert $ not <$> kickOff tEnv repo1
+  assertThrowsType "" (Proxy :: Proxy InvalidDependency)
+    $ kickOffDatabase tEnv def
+      { kickOff_repo = repo2
+      , kickOff_dependencies = Just $ stacked repo1
+      }
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "kickOffTwice" kickOffTwice
+  , TestLabel "kickOffFail" kickOffFail
+  , TestLabel "kickOffRace" kickOffRace
+  , TestLabel "kickOffConcurrently" kickOffConcurrently
+  , TestLabel "closeIdle" closeIdle
+  , TestLabel "closeUsed" closeUsed
+  , TestLabel "deleteOpen" deleteOpen
+  , TestLabel "deleteWhileUsing" deleteWhileUsing
+  , TestLabel "kickOffWhileDeleting" kickOffWhileDeleting
+  , TestLabel "useWhileDeleting" useWhileDeleting
+  , TestLabel "writeAfterFinished" writeAfterFinished
+  , TestLabel "kickOffStacked" kickOffStacked
+  , TestLabel "kickOffStackedIncomplete" kickOffStackedIncomplete
+  ]
diff --git a/glean/test/tests/LookupTest.hs b/glean/test/tests/LookupTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/LookupTest.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module LookupTest (main) where
+
+import Foreign
+import Foreign.C.String (CString)
+import Test.HUnit
+
+import TestRunner
+import Util.FFI
+
+import Glean.Database.Open (readDatabase)
+import Glean.Init
+import Glean.RTS.Foreign.Lookup
+
+import TestDB
+
+checkLookupInvariants :: CanLookup a => a -> IO ()
+checkLookupInvariants x = withLookup x $ invoke . glean_check_lookup_invariants
+
+foreign import ccall safe glean_check_lookup_invariants
+  :: Ptr Lookup -> IO CString
+
+invariantsTest :: Test
+invariantsTest = dbTestCase $ \env repo ->
+    readDatabase env repo $ \_ -> checkLookupInvariants
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "invariants" invariantsTest
+  ]
diff --git a/glean/test/tests/ParserTest.hs b/glean/test/tests/ParserTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/ParserTest.hs
@@ -0,0 +1,336 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+module ParserTest
+  ( main
+  ) where
+
+import Data.ByteString.Lazy.Char8 ()
+import Data.Either
+import Data.List
+import Test.HUnit
+
+import TestRunner
+import Compat.Prettyprinter.Render.Text
+import Util.String.Quasi
+
+import Glean.Angle.Parser
+import Glean.Angle.Types
+import Glean.Display
+import Glean.Init
+import Glean.Schema.Resolve
+
+queryParser :: Test
+queryParser = TestCase $ do
+  let r = parseQuery "cxx1.Name \"foo\""
+  either print (putDoc . displayDefault) r
+  assertBool "simple query" $ case r of
+    Right (SourceQuery Nothing [
+      SourceStatement (Wildcard _) (App _ _pred [String _ _str])] _) -> True
+    _ -> False
+
+  -- lexer error
+  let r = parseQuery "\""
+  either print (putDoc . displayDefault) r
+  assertBool "lexical error" $ case r of
+    Left s -> "lexical error" `isPrefixOf` s
+    _ -> False
+
+  -- parse error
+  let r = parseQuery "}"
+  either print (putDoc . displayDefault) r
+  assertBool "parse error" $ case r of
+    Left s -> "line 1, column 1\nparse error at: }" `isPrefixOf` s
+    _ -> False
+
+  let r = parseQuery "A\n    where"
+  either print (putDoc . displayDefault) r
+  assertBool "parse error 2" $ case r of
+    Left s -> "line 2, column 10\nparse error at: end of string" `isPrefixOf` s
+    _ -> False
+
+
+schemaParser :: Test
+schemaParser = TestCase $ do
+  -- schema parse errors, with #FILE
+  let r = parseAndResolveSchema [s|
+#FILE parsertest.angle
+    parse error
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema parser 1" $ case r of
+    Left s -> "line 1, column 5\nparsertest.angle:" `isInfixOf` s
+    _ -> False
+
+  -- empty enum is not allowed
+  let r = parseSchema [s|
+    schema a.1 {
+      type X = enum {}
+    }
+  |]
+  assertBool "schema parser 2" $ case r of
+    Left s -> "parse error at: }" `isInfixOf` s
+    _ -> False
+
+  -- test all the constructs
+  let r = parseAndResolveSchema [s|
+    schema a.1 {}
+    schema b.1 {}
+    schema a.2 : a.1 {
+      import b.1
+      type Y =
+        {
+          x1  : byte,
+          x2  : nat,
+          x3  : string,
+          x4  : bool,
+          x5  : [X],
+          x6  : {},  # empty record
+          x7  : { a : X },  # singleton record
+          x8  : { a : X, },  # trailing comma in a record
+          x9  : { a : X, b : Y },
+          # field names can be keywords:
+          x10 : { nat : nat },
+          x11 : { a : X | },  # singleton sum type
+          x12 : { a : X | b : Y },
+          x13 : { a : X | b : Y | }, # trailing |
+          x14 : { nothing | just : string },
+          x15 : enum { a },
+          x16 : enum { a | b },
+          x17 : maybe X,
+          x18 : maybe (maybe {}),  # parens
+        }
+      predicate X : Y
+
+      # predicate names can also be keywords
+      predicate type : { nat | bool_ }
+    }
+  #last line can be a comment|]
+  either print (putDoc . displayDefault . fst) r
+  putStr "\n"
+  assertBool "schema parser 1" $ case r of
+    Right _ -> True
+    _ -> False
+
+
+schemaResolver :: Test
+schemaResolver = TestCase $ do
+  -- schemas must have versions
+  let r = parseAndResolveSchema [s|
+    schema test {}
+  |]
+  assertBool "schema resolver 1" $ case r of
+    Left s -> "missing version" `isInfixOf` s
+    _ -> False
+
+  -- cycles aren't allowed
+  let r = parseAndResolveSchema [s|
+    schema test.1 : test.1 {}
+  |]
+  assertBool "schema resolver 2" $ case r of
+    Left s -> "cycle" `isInfixOf` s
+    _ -> False
+
+  -- a bigger cycle
+  let r = parseAndResolveSchema [s|
+    schema test.1 { import test.2 }
+    schema test.2 : test.1 {}
+  |]
+  assertBool "schema resolver 3" $ case r of
+    Left s -> "cycle" `isInfixOf` s
+    _ -> False
+
+  -- schemas parent must exist
+  let r = parseAndResolveSchema [s|
+    schema test.2 : test.1 {}
+  |]
+  assertBool "schema resolver 4" $ case r of
+    Left s -> "unknown schema: test.1" `isInfixOf` s
+    _ -> False
+
+  -- schema import must exist
+  let r = parseAndResolveSchema [s|
+    schema test.2 { import test.1 }
+  |]
+  assertBool "schema resolver 5" $ case r of
+    Left s -> "unknown schema: test.1" `isInfixOf` s
+    _ -> False
+
+  -- schema import does not re-export
+  let r = parseAndResolveSchema [s|
+    schema test.1 { type X = nat }
+    schema test.2 { import test.1 }
+    schema test.3 {
+      import test.2
+      type Y = test.X
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 6" $ case r of
+    Left s -> "not in scope: test.X" `isInfixOf` s
+    _ -> False
+
+  -- 1. unversioned predicates get the schema version
+  -- 2. we can use an explicit version if we want
+  let r = parseAndResolveSchema [s|
+    schema test.3 {
+      predicate X : string
+      predicate Y.2 : X.3
+    }
+    schema foo.1 {
+      import test.3
+      predicate Z : { a: test.Y.2, b: test.X.3 }
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 7" $ isRight r
+
+  -- imported names are not in scope unqualified
+  let r = parseAndResolveSchema [s|
+    schema test.1 { type X = nat }
+    schema test.2 {
+      import test.1
+      type Y = X
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 8" $ case r of
+    Left s -> "not in scope: X" `isInfixOf` s
+    _ -> False
+
+  -- ambiguity
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema a.2 { type X = string }
+    schema test.1 {
+      import a.1
+      import a.2
+      type Y = a.X
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 9" $ case r of
+    Left s -> "a.X is ambiguous" `isInfixOf` s
+    _ -> False
+
+  -- ambiguity from multiple inheritance
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema b.1 { type X = string }
+    schema test.1 : a.1, b.1 {
+      type Y = X
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 10" $ case r of
+    Left s -> "inherited schemas give multiple definitions for: X" `isInfixOf` s
+    _ -> False
+
+  -- resolve ambiguity by specifying a version
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema a.2 { type X = string }
+    schema test.1 {
+      import a.1
+      import a.2
+      type Y = a.X.2
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 11" $ isRight r
+
+  -- no ambiguity when we inherit
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema a.2 : a.1 { type X = string }
+    schema test.1 {
+      import a.2
+      type Y = a.X  # picks the latest version of a.X
+    }
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 12" $ isRight r
+
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema a.2 : a.1 { type X = string }
+    schema a.3 : a.2 {
+      type Y = X
+    }
+    # should be legal to inherit from both a.2 and a.3, because X
+    # refers to the same thing.
+    schema test.1 : a.2, a.3 {}
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 12a" $ isRight r
+
+  let r = parseAndResolveSchema [s|
+    schema a.1 { type X = nat }
+    schema a.2 : a.1 { type X = string }
+    schema a.3 : a.2 {
+      type Y = X
+    }
+    # but illegal to inherit from a.1 and a.3, because X refers to
+    # different things.
+    schema test.1 : a.1, a.3 {}
+  |]
+  either print (putDoc . displayDefault . fst) r
+  assertBool "schema resolver 12b" $ case r of
+    Left s -> "inherited schemas give multiple definitions for: X" `isInfixOf` s
+    _ -> False
+
+  -- duplicate definitions
+  let r = parseAndResolveSchema [s|
+    schema test.1 {
+       predicate X : nat
+       predicate X.1 : string
+    }
+  |]
+  assertBool "schema resolver 13" $ case r of
+    Left s -> "multiple definitions for: test.X.1" `isInfixOf` s
+    _ -> False
+
+  -- type and predicate with the same name
+  let r = parseAndResolveSchema [s|
+    schema test.1 {
+       predicate X : nat
+       type X = nat
+    }
+  |]
+  assertBool "schema resolver 14" $ case r of
+    Left s -> "multiple definitions for: test.X.1" `isInfixOf` s
+    _ -> False
+
+  -- duplicate field names
+  let r = parseAndResolveSchema [s|
+    schema test.1 {
+       predicate X : { a: nat, a: string }
+    }
+  |]
+  assertBool "schema resolver 15" $ case r of
+    Left s -> "duplicate field: a" `isInfixOf` s
+    _ -> False
+
+  -- reserved words are not allowed
+  let r = parseAndResolveSchema [s|
+    schema a.1 {
+      predicate class : string
+    }
+  |]
+  assertBool "schema resolver 16" $ case r of
+    Left s -> "class is a reserved word" `isInfixOf` s
+    _ -> False
+
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "query" queryParser
+  , TestLabel "schema" schemaParser
+  , TestLabel "resolve" schemaResolver
+  ]
diff --git a/glean/test/tests/PublishShardsTest.hs b/glean/test/tests/PublishShardsTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/PublishShardsTest.hs
@@ -0,0 +1,107 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module PublishShardsTest (main) where
+
+import Control.Concurrent.Async
+import Util.STM
+import Data.Foldable (toList)
+import Data.Time
+import DatabaseJanitorTest (
+  dbConfig,
+  makeFakeDB,
+  serverConfig,
+  withTest,
+ )
+import Glean.Database.Env
+import Glean.Database.Schema.Types (
+  DbSchema,
+ )
+import Glean.Init (withUnitTest)
+import Glean.Internal.Types
+import Glean.Server.Sharding
+import Glean.Types (Repo (Repo), DatabaseComplete (DatabaseComplete))
+import Test.HUnit
+import TestRunner
+import Glean.Database.Meta (utcTimeToPosixEpochTime)
+
+main :: IO ()
+main =
+  withUnitTest $
+    testRunner $
+      TestList
+        [ TestLabel "publish incomplete DBs" publishIncompleteDBs
+        , TestLabel "publish complete DBs" publishCompleteDBs
+        , TestLabel "stop publishing after timeout" stopPublishingCompletedDBs
+        ]
+
+runTest :: Bool -> (IO [Repo] -> IO ()) -> IO ()
+runTest term test = do
+  published <- newTVarIO mempty
+  let callback = atomically . writeTVar published
+  terminating <- newTVarIO term
+  withTest setupFakeDBs setupCloudDBs $ \evb cfgAPI dbdir backupdir ->
+    withDatabases evb (dbConfig dbdir $ serverConfig backupdir) cfgAPI $ \env ->
+      withAsync (
+          dbUpdateNotifierThread
+          env
+          0.0000001
+          (readTVar terminating)
+          callback
+        ) $ \_ ->
+            test $
+              atomically $ do
+                repos <- readTVar published
+                if null repos
+                  then retry
+                  else return $ toList repos
+
+setupCloudDBs :: FilePath -> DbSchema -> IO ()
+setupCloudDBs _ _ = return ()
+
+setupFakeDBs :: FilePath -> DbSchema -> IO ()
+setupFakeDBs dbdir schema = do
+  now <- getCurrentTime
+  -- populate a dir with various DBs
+  makeFakeDB schema dbdir incompleteRepo now incomplete id
+  makeFakeDB schema dbdir completeRepo now complete id
+
+incomplete :: p -> Completeness
+incomplete _ = Incomplete DatabaseIncomplete
+
+complete :: UTCTime -> Completeness
+complete = Complete . (`DatabaseComplete` Nothing) . utcTimeToPosixEpochTime
+
+incompleteRepo :: Repo
+incompleteRepo = Repo "test" "incomplete"
+
+completeRepo :: Repo
+completeRepo = Repo "test" "complete"
+
+publishIncompleteDBs :: Test
+publishIncompleteDBs = TestCase $
+  runTest False $ \readShards -> do
+    repos <- readShards
+    assertBool "Incomplete DBs are published" (incompleteRepo `elem` repos)
+
+publishCompleteDBs :: Test
+publishCompleteDBs = TestCase $
+  runTest False $ \readShards -> do
+    repos <- readShards
+    assertBool "Complete DBs are published" (completeRepo `elem` repos)
+
+stopPublishingCompletedDBs :: Test
+stopPublishingCompletedDBs = TestCase $
+  runTest True $ \readShards -> do
+    repos <- readShards
+    assertBool
+      "Still publishing incomplete DBs after timeout"
+      (incompleteRepo `elem` repos)
+    assertBool
+      "Stopped publishing completed DBs after timeout"
+      (completeRepo `notElem` repos)
diff --git a/glean/test/tests/RTSJSONTest.hs b/glean/test/tests/RTSJSONTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/RTSJSONTest.hs
@@ -0,0 +1,95 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module RTSJSONTest (main) where
+
+import Control.Monad.ST
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Char8 as Char8
+import Data.Int (Int64)
+import Data.Text (Text)
+import Data.Text.Arbitrary ()
+import qualified Data.Text.Encoding as Text
+import Test.HUnit hiding (assert)
+import Test.QuickCheck
+import Test.QuickCheck.Monadic
+
+import TestRunner
+import qualified Util.Buffer as Buffer
+import Util.Testing
+
+import Glean.Init (withUnitTest)
+import qualified Glean.RTS as RTS
+import qualified Glean.RTS.Foreign.JSON as RTS
+
+prop_number :: Int64 -> Property
+prop_number n =
+  runST (Buffer.fillByteString 21 $ Buffer.alloc 21 $ RTS.encodeNumber n)
+  ===
+  Char8.pack (show n)
+
+prop_number_roundtrip :: Int64 -> Property
+prop_number_roundtrip n = monadicIO $ do
+  let !enc = runST $
+        Buffer.fillByteString 21 $ Buffer.alloc 21 $ RTS.encodeNumber n
+  m <- run $ RTS.withParsed enc $ \val -> case val of
+    RTS.Int m -> return m
+    _ -> fail "not a number"
+  assert (m == n)
+
+prop_string_roundtrip :: Text -> Property
+prop_string_roundtrip t = monadicIO $ do
+  enc <- run $ RTS.unsafeWithByteStringRef utf8 $ \ref -> stToIO $ do
+    n <- RTS.getStringEscapedSize ref
+    Buffer.fillByteString n $ do
+      Buffer.ascii '\"'
+      Buffer.alloc n $ \p -> do
+        RTS.escapeString ref p n
+        return n
+      Buffer.ascii '\"'
+  s <- run $ RTS.withParsed enc $ \val -> case val of
+    RTS.String ref -> RTS.derefByteString ref
+    _ -> fail "not a string"
+  assert (s == utf8)
+  where
+    utf8 = Text.encodeUtf8 t
+
+prop_mangled_string_roundtrip :: Text -> Property
+prop_mangled_string_roundtrip t = monadicIO $ do
+  enc <- run $ RTS.unsafeWithMangledStringRef (mangle utf8)
+    $ \ref -> stToIO $ do
+      n <- RTS.getMangledStringEscapedSize ref
+      Buffer.fillByteString n $ do
+        Buffer.ascii '\"'
+        Buffer.alloc n $ \p -> do
+          RTS.escapeMangledString ref p n
+          return n
+        Buffer.ascii '\"'
+  s <- run $ RTS.withParsed enc $ \val -> case val of
+    RTS.String ref -> RTS.derefByteString ref
+    _ -> fail "not a string"
+  assert (s == utf8)
+  where
+    utf8 = Text.encodeUtf8 t
+
+    mangle s =
+      BS.pack (concatMap (\c -> if c == 0 then [0,1] else [c]) $ BS.unpack s)
+      <>
+      BS.pack [0,0]
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "number" $ TestCase $ assertProperty "mismatch"
+      prop_number
+  , TestLabel "number_roundtrip" $ TestCase $ assertProperty "mismatch"
+      prop_number_roundtrip
+  , TestLabel "string_roundtrip" $ TestCase $ assertProperty "mismatch"
+      prop_string_roundtrip
+  , TestLabel "mangled_string_roundtrip" $ TestCase $ assertProperty "mismatch"
+      prop_mangled_string_roundtrip
+  ]
diff --git a/glean/test/tests/RTSTest.hs b/glean/test/tests/RTSTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/RTSTest.hs
@@ -0,0 +1,159 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+module RTSTest where
+
+import qualified Data.ByteString as BS
+import Data.List
+import qualified Data.Text as Text
+import Data.Text.Arbitrary ()
+import qualified Data.Text.Encoding as Text
+import Test.HUnit
+import Test.QuickCheck
+import Test.QuickCheck.Monadic as QuickCheck
+
+import TestRunner
+import Util.Testing
+
+import qualified Glean.Angle.Types as T
+import Glean.Init
+import Glean.RTS
+import Glean.RTS.Foreign.Typecheck as Bytecode
+import Glean.RTS.Typecheck
+import Glean.RTS.Types
+import Glean.RTS.Term
+import Glean.Angle.Hash
+
+instance Arbitrary Fid where
+  arbitrary = Fid <$> choose (1024,0x1FFFFFFFFFFF)
+
+instance Arbitrary Pid where
+  arbitrary = Pid <$> choose (1024,0x1FFFFFFFFFFF)
+
+instance Arbitrary PidRef where
+  arbitrary = do
+    pid <- arbitrary
+    return $ PidRef pid $
+      T.PredicateId (T.PredicateRef ("P" <> Text.pack (show pid)) 0) hash0
+
+instance Arbitrary Type where
+  arbitrary = oneof
+    [ pure T.ByteTy
+    , pure T.NatTy
+    , pure T.StringTy
+    , T.ArrayTy <$> arbitrary
+    , T.SetTy <$> arbitrary
+    , T.RecordTy . fields <$> children 0
+    , T.SumTy . fields <$> children 1
+    , T.PredicateTy () <$> arbitrary
+    , T.MaybeTy <$> arbitrary
+    , sized $ \n -> do
+        k <- choose (0, max 0 n)
+        return $ T.EnumeratedTy ["E" <> Text.pack (show i) | i <- [0 .. k]]
+    , pure T.BooleanTy
+    ]
+    where
+      children i = sized $ \n -> do
+        k <- choose (i, max i n)
+        vectorOf k $ resize (n `div` k) arbitrary
+
+      fields tys =
+        [ T.FieldDef (Text.pack $ 'x' : show (i :: Int)) ty
+          | (i,ty) <- zip [0..] tys ]
+  shrink (T.ArrayTy ty) = ty : [T.ArrayTy sty | sty <- shrink ty]
+  shrink (T.SetTy ty) = ty : [T.SetTy sty | sty <- shrink ty]
+  shrink (T.RecordTy fields) = [ ty | T.FieldDef _ ty <- fields ] ++
+    (T.RecordTy <$> shrinkList shrinkField fields)
+  shrink (T.SumTy fields) = (T.SumTy <$>
+    filter (not . null) (shrinkList shrinkField fields)) ++
+    [ ty | T.FieldDef _ ty <- fields ]
+  shrink (T.EnumeratedTy enums) = T.EnumeratedTy <$>
+    filter (not . null) (shrinkList (const []) enums)
+  shrink (T.MaybeTy ty) = ty : (T.MaybeTy <$> shrink ty)
+  shrink _ = []
+
+shrinkField
+  :: Arbitrary (T.Type_ st pref tref)
+  => T.FieldDef_ st pref tref -> [T.FieldDef_ st pref tref]
+shrinkField (T.FieldDef name ty) = T.FieldDef name <$> shrink ty
+
+valueFor :: Type -> Gen Value
+valueFor T.ByteTy = Byte <$> arbitrary
+valueFor T.NatTy = Nat <$> arbitrary
+valueFor T.StringTy = String . Text.encodeUtf8 <$> arbitrary
+valueFor (T.ArrayTy ty)
+  | T.ByteTy <- derefType ty = ByteArray . BS.pack <$> arbitrary
+  | otherwise = fmap Array $ sized $ \n -> do
+      k <- choose (0,n)
+      vectorOf k $ resize (n `div` k) $ valueFor ty
+valueFor (T.RecordTy fields) =
+  Tuple <$> mapM (valueFor . T.fieldDefType) fields
+valueFor (T.SumTy fields) = do
+  (i, field) <- elements $ zip [0..] fields
+  Alt i <$> valueFor (T.fieldDefType field)
+valueFor (T.SetTy ty) = fmap Array $ sized $ \n -> do
+      k <- choose (0,n)
+      nub . sort <$> vectorOf k (resize (n `div` k) $ valueFor ty)
+valueFor T.PredicateTy{} = Ref <$> arbitrary
+valueFor (T.NamedTy _ (ExpandedType _ ty )) = valueFor ty
+valueFor (T.MaybeTy ty) = do
+  b <- arbitrary
+  if b then Alt 1 <$> valueFor ty else return $ Alt 0 $ Tuple []
+valueFor (T.EnumeratedTy names) = do
+  i <- choose (0, fromIntegral (length names - 1))
+  return $ Alt i $ Tuple []
+valueFor T.BooleanTy = do
+  i <- choose (0,1)
+  return $ Alt i $ Tuple []
+valueFor T.TyVar{} = error "valueFor: TyVar"
+valueFor T.HasTy{} = error "valueFor: HasTy"
+valueFor T.HasKey{} = error "valueFor: HasKey"
+valueFor T.ElementsOf{} = error "valueFor: ElementsOf"
+
+shrinkValue :: Value -> [Value]
+shrinkValue (Byte b) = Byte <$>
+  [ b `div` 2 | b >= 2] ++
+  [ (b `div` 2) + 1 | b >= 4 ]++
+  [ b - 1 | b >= 1 ]
+shrinkValue (Nat n) = Nat <$>
+  [ n `div` 2 | n >= 2] ++
+  [ (n `div` 2) + 1 | n >= 4 ] ++
+  [ n - 1 | n >= 1 ]
+shrinkValue (Alt n e) = Alt n <$> shrinkValue e
+shrinkValue (Tuple es) = Tuple <$> shrinkList shrinkValue es
+shrinkValue (Array es) = Array <$> shrinkList shrinkValue es
+shrinkValue _ = []
+
+prop_roundtripValue :: Type -> Value -> Property
+prop_roundtripValue ty val = val === toValue (repType ty) (fromValue val)
+
+prop_typecheckValue :: Type -> Value -> Property
+prop_typecheckValue ty val = monadicIO $ do
+  tc <- run $ checkType ty
+  QuickCheck.assert $
+    val == toValue (repType ty) (Bytecode.invokeTypechecker tc (fromValue val))
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "value roundtrip" $ TestCase $ assertProperty "mismatch" $
+      forAll arbitrary $ \ty ->
+      forAll (valueFor ty) $ \val -> prop_roundtripValue ty val
+
+  , TestLabel "value typecheck" $ TestCase $
+    assertPropertyWithArgs "mismatch" stdArgs{ maxSuccess = 1000 } $
+      forAllShrink arbitrary shrink $ \ty ->
+      collect ty $
+      forAllShrink (valueFor ty) shrinkValue $ \val ->
+      prop_typecheckValue ty val
+
+    -- test strings more thoroughly as they are quite complicated
+  , TestLabel "string typecheck" $ TestCase $ assertProperty "mismatch" $
+      forAll (valueFor T.StringTy) $ \val ->
+        prop_typecheckValue T.StringTy val
+  ]
diff --git a/glean/test/tests/Schema/Basic.hs b/glean/test/tests/Schema/Basic.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Schema/Basic.hs
@@ -0,0 +1,1120 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+module Schema.Basic (main) where
+
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import Data.Default
+import Data.Either
+import qualified Data.HashMap.Strict as HashMap
+import Data.List
+import qualified Data.Map as Map
+import Data.Maybe
+import Data.Text (Text, pack)
+import qualified Data.Text as Text
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+import Test.HUnit
+
+import System.Timeout
+import TestRunner
+import Util.Control.Exception (tryAll)
+import Util.EventBase
+import Util.String.Quasi
+import Thrift.Util (saveJSON)
+
+import Glean.Angle.Types (latestAngleVersion)
+import Glean.Backend.Types
+import Glean.Database.Config
+import Glean.Database.Env
+import Glean.Database.Schema (validateNewSchemaInstance)
+import Glean.Database.Test
+import Glean.Derive
+import Glean.Display
+import Glean.Impl.ConfigProvider ()
+import Glean.Impl.TestConfigProvider
+import Glean.Init
+import qualified Glean.Internal.Types as Internal
+import qualified Glean.ServerConfig.Types as ServerConfig
+import Glean.Schema.Util
+import Glean.Types as Thrift
+import Glean.Util.ConfigProvider
+import qualified Glean.Util.ThriftSource as ThriftSource
+import Glean.Write.JSON
+
+import TestDB
+import Schema.Lib
+
+-- Test that we can extend the schema with a derived predicate after
+-- the DB has been created, and make a query using the new predicate.
+
+mergeSchemaTest :: Test
+mergeSchemaTest = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    -- create the DB with the default schema
+    repo <- withTestDB [setRoot root] $ \_ -> return
+
+    -- create an extended schema
+    let newSchemaFile = root </> "schema"
+    SchemaIndex{..} <- parseSchemaDir schemaSourceDir
+    writeFile newSchemaFile $ show $ displayDefault $
+      procSchemaSource schemaIndexCurrent
+    appendFile newSchemaFile
+      [s|
+        schema mergetest.1 {
+          import glean.test.6
+          # pick out the nat field from a glean.test.Predicate
+          predicate JustNat : { predicate : glean.test.Predicate, nat : nat }
+            {P,N} where P = glean.test.Predicate { nat = N }
+        }
+
+        schema all.99999: mergetest.1 {}
+      |]
+
+    -- query the existing DB using the extended schema
+    withTestEnv [setRoot root, setSchemaPath newSchemaFile] $ \env -> do
+      r <- try $ angleQuery env repo "mergetest.JustNat _"
+      print (r :: Either BadQuery UserQueryResults)
+      assertBool "merge" $ case r of
+        Right UserQueryResults{..} -> length userQueryResults_facts == 4
+        _ -> False
+
+
+-- This test is superseded by the tests in Schema/Multi.hs, we should retire
+-- it when support for use_schema_id = false is removed.
+schemaUnversioned :: Test
+schemaUnversioned = TestCase $ do
+  let
+    schema =
+      [s|
+          schema test.1 {
+            predicate P : { a : nat }
+          }
+
+          schema test.2 {
+            predicate P : { a : nat, b : nat }
+          }
+
+          schema all.1 : test.1 {}
+          schema all.2 : test.2 {}
+      |]
+
+  let fill env repo =
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "test.P" 1)
+              [ [s|{ "key" : { "a": 1 } }|] ]
+          , mkBatch (PredicateRef "test.P" 2)
+              [ [s|{ "key" : { "a": 1, "b": 1 } }|]
+              , [s|{ "key" : { "a": 2, "b": 2 } }|]
+              ]
+          ]
+          Nothing
+
+  withSchemaFile latestAngleVersion schema $ \root file -> do
+    let
+      create repo propList =
+        withTestEnv [setRoot root, setSchemaPath file] $ \env -> do
+          kickOffTestDB env repo id
+          let props = HashMap.fromList propList
+          void $ updateProperties env repo props []
+          fill env repo
+          completeTestDB env repo
+          return repo
+
+    repo1 <- create (Thrift.Repo "schematest-repo" "1") []
+
+    withTestEnv [setRoot root, setSchemaPath file] $ \env -> do
+      -- Test that an unversioned query "test.P _" resolves to test.P.2,
+      -- because the all.2 schema inherits from test.2 and we pick
+      -- all.2 by default
+      r <- try $ angleQuery env repo1 "test.P _"
+      print (r :: Either BadQuery UserQueryResults)
+      assertBool "unversioned 1" $ case r of
+        Right UserQueryResults{..} -> length userQueryResults_facts == 2
+        _ -> False
+
+
+schemaTypeError :: Test
+schemaTypeError = TestCase $ do
+  let
+    schema =
+      [s|
+        schema error.1 {
+          predicate Test : { a : string, b : nat }
+            {A,B} where {A,B} = {42, "xyz"}
+        }
+
+        schema all.1 : error.1 {}
+      |]
+
+  withSchema latestAngleVersion schema $ \r ->
+    assertBool "schemaTypeError" $
+      case r of
+        Left e | Just (ErrorCall err) <- fromException e ->
+          "type error" `isInfixOf` err
+        _ -> False
+
+
+schemaStoredError :: Test
+schemaStoredError = TestCase $ do
+  let
+    schema =
+      [s|
+        schema error.1 {
+          predicate P : { a : string, b : nat }
+            {"xyz", 42}
+
+          predicate Q : P # should be an error to refer to P here
+            stored P _
+        }
+
+        schema all.1 : error.1 {}
+      |]
+
+  withSchema latestAngleVersion schema $ \r -> do
+    print r
+    assertBool "schemaStoredError" $
+      case r of
+        Left e | Just (ErrorCall err) <- fromException e ->
+          "stored predicate" `isInfixOf` err
+        _ -> False
+
+-- The validation run at gen-schema time.
+schemaGenValidation :: Test
+schemaGenValidation = TestList
+  [ TestLabel "recursive derivation" $ TestCase $
+      hasCycles
+        [s|
+          schema test.1 {
+            predicate P : nat
+              X where P X;
+          }
+
+          schema all.1 : test.1 {}
+        |]
+
+  , TestLabel "co-recursive derivation" $ TestCase $ do
+      hasCycles
+        [s|
+          schema test.1 {
+            predicate P : nat
+              X where Q X;
+
+            predicate Q : nat
+              X where P X;
+          }
+
+          schema all.1 : test.1 {}
+        |]
+  ]
+  where
+    hasCycles schema = do
+      r <- tryAll $ validate schema
+      print r
+      case r of
+        Left err@SomeException{} ->
+          assertBool "validation failure" $
+          "found cycles in predicate derivations" `isInfixOf` show err
+        _ -> assertFailure "did not fail validation"
+
+    validate schema =
+      withSystemTempDirectory "glean-dbtest" $ \root -> do
+      let schemaPath = root </> "schema"
+          indexPath = root </> "index"
+          index = Internal.SchemaIndex curr older
+            where
+            older = []
+            curr = Internal.SchemaInstance
+                { schemaInstance_versions = Map.fromList [ ("v1", 1) ]
+                , schemaInstance_file = pack schemaPath
+                }
+      saveJSON indexPath index
+      appendFile schemaPath schema
+      schemaIndex <- parseSchemaIndex indexPath
+      validateNewSchemaInstance schemaIndex
+
+schemaReservedWord :: Test
+schemaReservedWord = TestCase $ do
+  let
+    schema =
+      [s|
+        schema error.1 {
+          type R = { class : string }
+        }
+
+        schema all.1 : error.1 {}
+      |]
+
+  withSchema latestAngleVersion schema $ \r ->
+    assertBool "schemaReservedWord" $
+      case r of
+        Left e -> "class is a reserved word" `isInfixOf` show e
+        _ -> False
+
+schemaUpperCaseField :: Test
+schemaUpperCaseField = TestCase $ do
+  let
+    schema =
+      [s|
+        schema error.1 {
+          type T = { Field : nat }
+        }
+
+        schema all.1 : error.1 {}
+      |]
+
+  withSchema latestAngleVersion schema $ \r ->
+    assertBool "schemaUpperCaseField" $
+      case r of
+        Left e -> "field names must begin with a lowercase" `isInfixOf` show e
+        _ -> False
+
+schemaTypeShadowing :: Test
+schemaTypeShadowing = TestCase $ do
+  withSchemaAndFacts []
+    [s|
+      schema x.1 {
+        type Q = string
+        predicate P : Q
+      }
+      schema x.2 {
+        type Q = nat
+        predicate P: Q
+      }
+      schema all.1 : x.1, x.2 {}
+    |]
+    [ mkBatch (PredicateRef "x.P" 2)
+        [ [s|{ "key": 1 }|]
+        , [s|{ "key": 2 }|]
+        ]
+    ]
+    $ \env repo _ -> do
+      let
+        runQuery env repo q = userQuery env repo $ def
+          { userQuery_query = q
+          , userQuery_options = Just def
+            { userQueryOptions_syntax = QuerySyntax_ANGLE }
+          }
+
+      response <- try $ runQuery env repo [s| x.P (x.Q _) |]
+      print (response :: Either BadQuery UserQueryResults)
+      -- This used to silently default to the latest version, but now
+      -- we give an ambiguity error.  It's your responsibility to make
+      -- sure there are no overlapping names exposed by the "all"
+      -- schema.
+      case response of
+        Left err | "ambiguous" `isInfixOf` show err ->
+          assertBool "ambiguous identifier" True
+        _ -> assertFailure (show response)
+
+fakeSchemaKey :: Text
+fakeSchemaKey = "glean/schema"
+
+changeSchemaTest :: Test
+changeSchemaTest = TestCase $ do
+    let
+      schema_v0 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema all.1 : test.1 {}
+        |]
+
+      schema_v1 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema test.2 : test.1 {
+            predicate P : { a : string, b : nat, c : {} }
+          }
+          schema all.1 : test.1, test.2 {}
+        |]
+
+    let repo = Thrift.Repo "schematest" "123"
+
+    withEventBaseDataplane $ \evb -> do
+      withConfigProvider defaultConfigOptions $ \confApi -> do
+        setTestConfig confApi fakeSchemaKey schema_v0
+
+        let
+          dbConfig = def
+            { cfgDataStore = tmpDataStore
+            , cfgSchemaLocation = Just (SchemaLocation_config fakeSchemaKey)
+            , cfgServerConfig = ThriftSource.value def
+                { ServerConfig.config_db_rocksdb_cache_mb = 0 }
+            }
+
+        withDatabases evb dbConfig (realConfigAPI confApi) $ \env -> do
+          kickOffTestDB env repo id
+          completeTestDB env repo
+
+          info <- getSchemaInfo env (Just repo)
+            def { getSchemaInfo_omit_source = True }
+          assertBool "changeSchemaTest 1" $
+            PredicateRef "test.P" 1 `elem`
+              Map.elems (schemaInfo_predicateIds info)
+          assertBool "changeSchemaTest 1" $
+            PredicateRef "test.P" 2 `notElem`
+              Map.elems (schemaInfo_predicateIds info)
+
+          -- Now update the schema
+          setTestConfig confApi fakeSchemaKey schema_v1
+          -- wait for the schema to be updated for our repo
+          let
+            loop = do
+              info <- getSchemaInfo env (Just repo)
+                def { getSchemaInfo_omit_source = True }
+              when (PredicateRef "test.P" 2 `notElem`
+                  Map.elems (schemaInfo_predicateIds info)) $
+                do putStrLn "waiting..."; threadDelay 1000000; loop
+          r <- timeout 20000000 loop
+          assertBool "changeSchemaTest 2" $ isJust r
+
+
+-- | Trying to write to a predicate that was not in the schema when
+-- the DB was created should fail.
+writeEphemeralPredicate :: Test
+writeEphemeralPredicate = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema all.1 : test.1 {}
+        |]
+
+      schema_v1_file = root </> "schema1"
+      schema_v1 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema test.2 : test.1 {
+            predicate P : { a : string, b : nat, c : {} }
+          }
+
+          schema all.1 : test.1, test.2 {}
+        |]
+
+    writeFile schema_v0_file schema_v0
+    writeFile schema_v1_file schema_v1
+
+    -- create the DB with the default schema
+    repo <- withEmptyTestDB [setRoot root, setSchemaPath schema_v0_file] $
+      \_env repo -> return repo
+
+    -- try to write a fact from the new schema
+    withTestEnv [setRoot root, setSchemaPath schema_v1_file] $ \env -> do
+      -- this should work
+      void $ syncWriteJsonBatch env repo
+        [ mkBatch (PredicateRef "test.P" 1)
+            [ "{ \"key\" : {} }" ]
+        ]
+        Nothing
+
+      -- this should fail
+      r <- try $ syncWriteJsonBatch env repo
+        [ mkBatch (PredicateRef "test.P" 2)
+            [ "{ \"key\" : {} }" ]
+        ]
+        Nothing
+      print r
+      assertBool "writeEphemeralPredicate" $ case r of
+        Left e@Exception{} -> "not in scope" `isInfixOf` show e
+        _ -> False
+
+
+backwardCompatDeriving :: Test
+backwardCompatDeriving = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema all.1 : test.1 {}
+        |]
+
+      schema_v1_file = root </> "schema1"
+      schema_v1 =
+        [s|
+          version: 11
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema test.2 : test.1 {
+            predicate P : { a : string, b : nat, c : {} }
+
+            derive test.P.1 default
+              { A, B } where P.2 { A, B, _ }
+          }
+          schema all.1 : test.1 , test.2 {}
+        |]
+
+    writeFile schema_v0_file schema_v0
+    writeFile schema_v1_file schema_v1
+
+    -- create a DB with schema v0, create a fact of P.1
+    repo0 <- withEmptyTestDB [setRoot root, setSchemaPath schema_v0_file] $
+      \env repo -> do
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "test.P" 1)
+              [ "{ \"key\" : {} }" ]
+          ]
+          Nothing
+        completeTestDB env repo
+        return repo
+
+    -- open the DB with schema_v1, we should still be able to query
+    -- for P.1 and get one fact
+    withTestEnv [setRoot root, setSchemaPath schema_v1_file] $ \env -> do
+       r <- try $ angleQuery env repo0 "test.P.1 _"
+       print (r :: Either BadQuery UserQueryResults)
+       assertBool "backcompat 1" $ case r of
+         Right UserQueryResults{..} -> length userQueryResults_facts == 1
+         _ -> False
+
+       void $ deleteDatabase env repo0
+
+    -- create a new DB with schema_v1, create a fact of P.2
+    repo1 <- withEmptyTestDB [setRoot root, setSchemaPath schema_v1_file] $
+      \env repo -> do
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "test.P" 2)
+              [ "{ \"key\" : {} }" ]
+          ]
+          Nothing
+        completeTestDB env repo
+        return repo
+
+    -- open the DB with schema_v1, we should be able to query for P.1 and P.2
+    withTestEnv [setRoot root, setSchemaPath schema_v1_file] $ \env -> do
+       r <- try $ angleQuery env repo1 "test.P.1 _"
+       print (r :: Either BadQuery UserQueryResults)
+       assertBool "backcompat 2" $ case r of
+         Right UserQueryResults{..} -> length userQueryResults_facts == 1
+         _ -> False
+
+       r <- try $ angleQuery env repo1 "test.P.2 _"
+       print (r :: Either BadQuery UserQueryResults)
+       assertBool "backcompat 3" $ case r of
+         Right UserQueryResults{..} -> length userQueryResults_facts == 1
+         _ -> False
+
+deriveDefault :: Test
+deriveDefault = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          version: 11
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+            predicate Q : { p : P }
+          }
+          schema test.2 : test.1 {
+            predicate P : { a : string, b : nat, c : {} }
+
+            derive test.P.1 default
+              { A, B } where P.2 { A, B, _ }
+
+            derive test.P.2 default
+              { A, B, {} } where test.P.1 { A, B }
+          }
+
+          schema all.1 : test.1, test.2 {}
+        |]
+
+    writeFile schema_v0_file schema_v0
+
+    let
+      -- we should be able to query for both P.1 and P.2
+      checkQuery repo ss = do
+        let settings = setRoot root : setSchemaPath schema_v0_file : ss
+        withTestEnv settings $ \env -> do
+           r <- try $ angleQuery env repo "test.P.1 _"
+           print (r :: Either BadQuery UserQueryResults)
+           assertBool "backcompat 1" $ case r of
+             Right UserQueryResults{..} -> length userQueryResults_facts == 1
+             _ -> False
+
+           r <- try $ angleQuery env repo "test.P.2 _"
+           print (r :: Either BadQuery UserQueryResults)
+           assertBool "backcompat 2" $ case r of
+             Right UserQueryResults{..} -> length userQueryResults_facts == 1
+             _ -> False
+    let
+      mkP version env repo =
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "test.P" version)
+              [ "{ \"key\" : {} }" ]
+          ]
+          Nothing
+
+      mkRepo hash facts =
+        withTestEnv [setRoot root, setSchemaPath schema_v0_file] $ \env -> do
+          let repo = Repo "test" hash
+          kickOffTestDB env repo id
+          facts env repo
+          completeTestDB env repo
+          return repo
+
+    -- create a DB with a fact of P.1
+    repo0 <- mkRepo "1" (mkP 1)
+    checkQuery repo0 []
+
+    -- create a DB with a fact of P.2
+    repo1 <- mkRepo "2" (mkP 2)
+    checkQuery repo1 []
+
+schemaNegation :: [Test]
+schemaNegation =
+  [ TestLabel "negation - derived" $ TestCase $ do
+    -- a derived predicate can use negation
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate Base : string
+          predicate Derived : string
+            A where Base A; !(A = "x"..);
+        }
+        schema all.1 : test.1 {}
+      |]
+      $ \r ->
+      assertBool "schemaNegation - derived" $
+        case r of
+          Left _ -> False
+          Right _ -> True
+
+  , TestLabel "negation - stored" $ TestCase $ do
+    -- a stored predicate cannot use negation
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate Base : string
+          predicate Stored : string
+            stored A where Base A; !(A = "x"..);
+        }
+        schema all.1 : test.1 {}
+      |]
+      $ \r ->
+      assertBool "schemaNegation - stored" $
+        case r of
+          Left e -> "use of negation is not allowed in a stored predicate"
+            `isInfixOf` show e
+          _ -> False
+
+  , TestLabel "negation - stored if statements" $ TestCase $ do
+    -- a stored predicate cannot use if statements
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate Base : string
+          predicate Stored : string
+            stored A where A = if (Base B) then B else "x"
+        }
+        schema all.1 : test.1 {}
+      |]
+      $ \r ->
+      assertBool "schemaNegation - stored" $
+        case r of
+          Left e -> "use of if-statements is not allowed in a stored predicate"
+            `isInfixOf` show e
+          _ -> False
+
+  , TestLabel "negation - stored dependency" $ TestCase $ do
+    -- a stored predicate cannot depend on a derived
+    -- predicate that uses negation
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate Base : string
+          predicate Derived : string
+            A where Base A; !(A = "x"..);
+          predicate Stored : string
+            stored A where Derived A
+        }
+        schema all.1 : test.1 {}
+      |]
+      $ \r ->
+      assertBool "schemaNegation - stored dependency" $
+        case r of
+          Left e -> "negation is not allowed in a stored predicate"
+            `isInfixOf` show e
+          _ -> False
+
+  , TestLabel "negation - stored dependency cross-schema" $ TestCase $ do
+    -- use of negation is detected across schemas
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate Base : string
+          predicate Derived : string
+            A where Base A; !(A = "x"..);
+        }
+        schema test.2 : test.1 {
+          predicate Stored : string
+            stored A where Derived A
+        }
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "schemaNegation - stored dependency cross-schema" $
+        case r of
+          Left e -> "negation is not allowed in a stored predicate"
+            `isInfixOf` show e
+          _ -> False
+  ]
+
+thinSchemaTest :: Test
+thinSchemaTest = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema test.1 {
+            predicate P : { a : string, b : nat }
+
+            # tickle a bug in which we used the wrong type environment
+            # when checking predicates in the stored schema
+            type T = string
+            predicate Q : T stored "abc"
+          }
+
+          schema x.1 {
+            predicate P : nat
+          }
+
+          schema all.1 : test.1, x.1 {}
+        |]
+
+      schema_v1_file = root </> "schema1"
+      schema_v1 =
+        [s|
+          # delete schema test.1
+          # to test that it is still stored in the DB
+
+          schema x.1 {
+            predicate P : string  # changed from nat to string
+          }
+
+          # This will be a type error if the old x.1 is still present
+          schema x.2 : x.1 {
+            predicate Q : string
+              S where P S
+          }
+
+          schema all.1 : x.1, x.2 {}
+        |]
+
+    writeFile schema_v0_file schema_v0
+    writeFile schema_v1_file schema_v1
+
+    -- create a DB with schema v0, create a fact of test.P.1
+    repo0 <- withEmptyTestDB [setRoot root, setSchemaPath schema_v0_file]
+      $ \env repo -> do
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "test.P" 1)
+              [ "{ \"key\" : {} }" ]
+          ]
+          Nothing
+        completeTestDB env repo
+        return repo
+
+    -- open the DB with schema_v1, we should not be able to see
+    -- test.P.1 any more when we query using the default schema
+    -- version.
+    withTestEnv [setRoot root, setSchemaPath schema_v1_file] $ \env -> do
+       r <- try $ angleQuery env repo0 "test.P.1 _"
+       print (r :: Either BadQuery UserQueryResults)
+       assertBool "thin 1" $ case r of
+         Left BadQuery{} -> True
+         _ -> False
+
+stackedSchemaTest :: Test
+stackedSchemaTest = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema x.1 {
+            predicate P : string
+          }
+
+          schema y.1 {
+            predicate Q : string
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+    writeFile schema_v0_file schema_v0
+
+    -- Test a stacked DB:
+    --    base: 1 fact of x.P
+    --    stacked: 1 fact of y.Q
+    -- make sure that we can query x.P on the stacked DB.
+    --
+    -- This tickled a bug in the schema handling at one point, where
+    -- we were over-eagerly removing schemas from the base DB and then
+    -- assigning the wrong Pid to the predicates in the stacked DB.
+
+    withEmptyTestDB [setRoot root, setSchemaPath schema_v0_file]
+      $ \env repo -> do
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "x.P" 1)
+              [ "{ \"key\" : \"a\" }" ]
+          ]
+          Nothing
+        completeTestDB env repo
+
+        let stacked = Repo "stacked" "0"
+        kickOffTestDB env stacked $ \x -> x
+          { Thrift.kickOff_dependencies =
+             Just $ stackedDeps repo }
+        void $ syncWriteJsonBatch env stacked
+          [ mkBatch (PredicateRef "y.Q" 1)
+              [ "{ \"key\" : \"b\" }" ]
+          ]
+          Nothing
+        completeTestDB env stacked
+
+        r <- try $ angleQuery env stacked "x.P _"
+        print (r :: Either BadQuery UserQueryResults)
+        assertEqual "stacked 1" 1 $ case r of
+          Right UserQueryResults{..} -> length userQueryResults_facts
+          _ -> error "bad query"
+
+        r <- try $ angleQuery env stacked "y.Q _"
+        print (r :: Either BadQuery UserQueryResults)
+        assertEqual "stacked 2" 1 $ case r of
+          Right UserQueryResults{..} -> length userQueryResults_facts
+          _ -> error "bad query"
+
+
+-- | Test that we can extend the schema when creating a stacked DB
+stackedSchemaUpdateTest :: Test
+stackedSchemaUpdateTest = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema x.1 {
+            predicate P : { a : string }
+          }
+
+          schema y.1 {
+            predicate Q : string
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+    writeFile schema_v0_file schema_v0
+
+    -- v1 changes y.Q in an incompatible way, and adds y.R
+    let
+      schema_v1_file = root </> "schema1"
+      schema_v1 =
+        [s|
+          schema x.1 {
+            predicate P : { a : string }
+          }
+
+          schema y.1 {
+            predicate Q : { a : string }
+
+            predicate R : string
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+    writeFile schema_v1_file schema_v1
+
+    let
+      schema_index_file_1 = root </> "schema_index_1"
+      schema_index_1 = Internal.SchemaIndex
+        { schemaIndex_current = Internal.SchemaInstance
+          { schemaInstance_versions = Map.fromList [ ("v1", 1) ]
+          , schemaInstance_file = "schema1"
+          }
+        , schemaIndex_older = []
+        }
+    saveJSON schema_index_file_1 schema_index_1
+
+    -- v2 modifies x.P in a backwards compatible way, and removes y.R
+    let
+      schema_v2_file = root </> "schema2"
+      schema_v2 =
+        [s|
+          schema x.1 {
+            predicate P : { a : string, b : nat }
+          }
+
+          schema y.1 {
+            predicate Q : { a : string }
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+    writeFile schema_v2_file schema_v2
+
+    -- v3 modifies x.P and y.Q
+    let
+      schema_v3_file = root </> "schema3"
+      schema_v3 =
+        [s|
+          schema x.1 {
+            predicate P : { a : string }
+          }
+
+          schema y.1 {
+            predicate Q : { a : string, b : nat }
+
+            predicate D : string
+              stored S where Q { a = S }
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+    writeFile schema_v3_file schema_v3
+
+    let dbRoot = root </> "db"
+    createDirectory dbRoot
+
+    let
+      mkRepo schema hash upd facts =
+        withTestEnv [
+            setRoot dbRoot,
+            setSchemaPath schema ] $ \env -> do
+          let repo = Repo "test" hash
+          kickOffTestDB env repo upd
+          facts env repo
+          completeTestDB env repo
+          return repo
+
+      mkRepoIndex schema hash upd facts =
+        withTestEnv [
+            setRoot dbRoot,
+            setSchemaIndex schema ] $ \env -> do
+          let repo = Repo "test" hash
+          kickOffTestDB env repo upd
+          facts env repo
+          completeTestDB env repo
+          return repo
+
+      testQuery name repo schema query result =
+        withTestEnv [
+            setRoot dbRoot,
+            setSchemaPath schema ] $ \env -> do
+          r <- try $ angleQuery env repo query
+          case result of
+            Just n -> case r :: Either BadQuery UserQueryResults of
+              Right UserQueryResults{..} ->
+                assertEqual name n (length userQueryResults_facts)
+              _ -> assertFailure (name <> ": " <> show r)
+            Nothing -> assertBool name $ case r of
+              Left{} -> True
+              _ -> False
+
+    repo0 <- mkRepo schema_v0_file "0" id $ \env repo ->
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "x.P" 1)
+              [ [s| { "key" : { "a" : "x" } } |] ]
+          ] Nothing
+
+    -- switch to schema v1, make a stacked DB, we shouldn't be able to
+    -- make a y.R fact
+    let set x = x { Thrift.kickOff_dependencies =
+           Just $ stackedDeps repo0 }
+    r <- try $ mkRepo schema_v1_file "1" set $ \env repo ->
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "y.R" 1)
+              [ [s| { "key" : { "a" : "x" } } |] ]
+          ] Nothing
+    print r
+    assertBool "stacked schema 0" $
+      case r of
+        Left (e :: Thrift.Exception) -> "not in scope: y.R" `isInfixOf` show e
+        _ -> False
+
+    let set x = x {
+           Thrift.kickOff_dependencies = Just $ stackedDeps repo0,
+           Thrift.kickOff_properties = HashMap.insert "glean.schema_id" "v1"
+             (kickOff_properties x) }
+    r <- try $ mkRepoIndex schema_index_file_1 "1a" set $ \env repo ->
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "y.R" 1)
+              [ [s| { "key" : "x" } |] ]
+          ] Nothing
+    print (r :: Either Thrift.Exception Repo)
+    -- This should be allowed; the new schema is compatible with the
+    -- base DB schema for the populated predicates. We don't have to
+    -- use --update-schema-for-stacked because we explicitly requested
+    -- the schema with glean.schema_id.
+    assertBool "stacked schema 0a" $ isRight r
+
+    -- switch to schema v1, make a stacked DB with update_schema_for_stacked
+    -- works even though y.Q changed, because there are no facts of y.Q
+    let set x = x {
+          Thrift.kickOff_dependencies =
+            Just $ stackedDeps repo0,
+          Thrift.kickOff_update_schema_for_stacked = True }
+    repo1 <- mkRepo schema_v1_file "2" set $ \env repo ->
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "y.R" 1)
+              [ [s| { "key" : "abc" } |] ]
+          ] Nothing
+
+    testQuery "stacked schema 1" repo1 schema_v1_file "x.P _" (Just 1)
+    testQuery "stacked schema 2" repo1 schema_v1_file "y.Q _" (Just 0)
+    testQuery "stacked schema 3" repo1 schema_v1_file "y.R _" (Just 1)
+
+    -- when the current schema is incompatible with the schema in the
+    -- base DB, creating the stacked DB with update_schema_for_stacked
+    -- should fail.
+    let set x = x {
+          Thrift.kickOff_dependencies =
+            Just $ stackedDeps repo0,
+          Thrift.kickOff_update_schema_for_stacked = True }
+    r <- try $ mkRepo schema_v2_file "3" set $ \env repo ->
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "y.R" 1)
+              [ [s| { "key" : "abc" } |] ]
+          ] Nothing
+    assertBool "stacked schema 4" $
+      case r of
+        Left (e :: Thrift.Exception) -> "incompatible" `isInfixOf` show e
+        _ -> False
+
+    -- switch to schema v3, make a stacked DB with update_schema_for_stacked
+    let set x = x {
+          Thrift.kickOff_dependencies =
+            Just $ stackedDeps repo0,
+          Thrift.kickOff_update_schema_for_stacked = True }
+    repo4 <- mkRepo schema_v3_file "4" set $ \env repo -> do
+        void $ syncWriteJsonBatch env repo
+          [ mkBatch (PredicateRef "y.Q" 1)
+              [ [s| { "key" : {} } |] ]
+          ] Nothing
+        derivePredicate env repo Nothing Nothing (parseRef "y.D") Nothing
+
+    testQuery "stacked schema 5" repo4 schema_v3_file "x.P _" (Just 1)
+    testQuery "stacked schema 6" repo4 schema_v3_file "y.Q _" (Just 1)
+    testQuery "stacked schema 7" repo4 schema_v3_file "y.D _" (Just 1)
+
+stackedDeps :: Thrift.Repo -> Thrift.Dependencies
+stackedDeps (Thrift.Repo name hash) =
+  Thrift.Dependencies_stacked $ Thrift.Stacked name hash Nothing
+
+schemaUnversionedImports :: Test
+schemaUnversionedImports = TestCase $ do
+  let
+    schema =
+      [s|
+        schema a.1 {}
+        schema b.1 {}
+        schema c.1 {}
+        schema d.1 : a { import b }
+        schema d evolves c
+
+        schema all.1 : a, b, c, d {}
+      |]
+
+  withSchema latestAngleVersion schema $ \r ->
+    assertBool "schemaUnversionedImports 1" $
+      case r of
+        Right{} -> True
+        _ -> False
+
+  let
+    schema =
+      [s|
+        schema a.1 {}
+        schema a.2 {}
+        schema b.1 : a {}
+
+        schema all.1 : a.1, a.2, b.1 {}
+      |]
+
+  let expectAmbiguous r =
+        case r of
+          Left e | Just (ThriftSource.ThriftSourceException err)
+              <- fromException e ->
+            "ambiguous schema" `Text.isInfixOf` err
+          _ -> False
+
+  withSchema latestAngleVersion schema $
+    assertBool "schemaUnversionedImports 2" . expectAmbiguous
+
+  let
+    schema =
+      [s|
+        schema a.1 {}
+        schema a.2 {}
+        schema b.1 { import a }
+
+        schema all.1 : a.1, a.2, b.1 {}
+      |]
+
+  withSchema latestAngleVersion schema $
+    assertBool "schemaUnversionedImports 3" . expectAmbiguous
+
+  let
+    schema =
+      [s|
+        schema a.1 {}
+        schema a.2 {}
+        schema b.1 {}
+        schema b evolves a
+
+        schema all.1 : a.1, a.2, b {}
+      |]
+
+  withSchema latestAngleVersion schema $
+    assertBool "schemaUnversionedImports 4" . expectAmbiguous
+
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList $
+  [ TestLabel "mergeSchemaTest" mergeSchemaTest
+  , TestLabel "schemaTypeError" schemaTypeError
+  , TestLabel "schemaStoredError" schemaStoredError
+  , TestLabel "schemaGenValidation" schemaGenValidation
+  , TestLabel "schemaReservedWord" schemaReservedWord
+  , TestLabel "schemaUpperCaseField" schemaUpperCaseField
+  , TestLabel "schemaTypeShadowing" schemaTypeShadowing
+  , TestLabel "changeSchema" changeSchemaTest
+  , TestLabel "writeEphemeralPredicate" writeEphemeralPredicate
+  , TestLabel "backwardCompatDeriving" backwardCompatDeriving
+  , TestLabel "deriveDefault" deriveDefault
+  , TestLabel "thinSchema" thinSchemaTest
+  , TestLabel "schemaUnversioned" schemaUnversioned
+  , TestLabel "stackedSchemaTest" stackedSchemaTest
+  , TestLabel "stackedSchemaUpdateTest" stackedSchemaUpdateTest
+  , TestLabel "schemaUnversionedImports" schemaUnversionedImports
+  ] ++ schemaNegation
diff --git a/glean/test/tests/Schema/Evolves.hs b/glean/test/tests/Schema/Evolves.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Schema/Evolves.hs
@@ -0,0 +1,1773 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
+module Schema.Evolves (main) where
+
+import Control.Exception
+import Data.Default (def)
+import Data.Maybe (fromMaybe)
+import Data.List
+import qualified Data.Map as Map
+import Data.Text (Text, pack, unpack)
+import Data.Text.Encoding (encodeUtf8)
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Angle.Types (latestAngleVersion, Type_(..))
+import Glean.Database.Schema.Types
+import Glean.Init
+import Glean (userQuery, userQueryFacts)
+import qualified Glean.RTS.Term as RTS
+import qualified Glean.RTS.Types as RTS
+import Glean.Schema.Util
+import Glean.Types as Thrift
+
+import Schema.Lib
+
+schemaEvolves :: Test
+schemaEvolves = TestList
+  [ TestLabel "cycles are errors" $ TestCase $ do
+    -- no cycles created by evolves
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {}
+        schema test.2 {}
+        schema test.2 evolves test.1
+        schema test.1 evolves test.2
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "throws cycle error" $
+        case r of
+          Left err -> "cycle" `isInfixOf` show err
+          Right _ -> False
+
+  , TestLabel "many may not evolve one" $ TestCase $ do
+    -- multiple schemas cannot evolve the same schema
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {}
+        schema test.2 {}
+        schema test.3 {}
+        schema test.2 evolves test.1
+        schema test.3 evolves test.1
+        schema all.1 : test.1, test.2, test.3 {}
+      |]
+      $ \r ->
+      assertBool "throws multiple schemas evolve error" $
+        case r of
+          Left err -> "multiple schemas evolve test.1" `isInfixOf` show err
+          Right _ -> False
+
+  , TestLabel "one may evolve many" $ TestCase $ do
+    -- one schema can evolve multiple other schemas
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {}
+        schema test.2 {}
+        schema test.3 {}
+        schema test.3 evolves test.1
+        schema test.3 evolves test.2
+        schema all.1 : test.1, test.2, test.3 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can add optional field" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat }
+        }
+        schema test.2 {
+          predicate P : { a : nat, b: maybe string }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can add defaultable field" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat }
+        }
+        schema test.2 {
+          predicate P : { a : nat, b: { c : string, d : bool } }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "cannot remove required field" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate R : string
+          predicate P : { a : nat, b: R }
+        }
+        schema test.2 {
+          predicate R : string
+          predicate P : { a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "throws error stating missing field" $
+        case r of
+          Left err ->
+            ("cannot evolve predicate test.P.1 " <>
+              "into test.P.2: missing required field: b")
+            `isInfixOf` show err
+          Right _ -> False
+
+  , TestLabel "can remove optional field" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat, b: maybe string }
+        }
+        schema test.2 {
+          predicate P : { a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can remove defaultable field" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat, b: { c: string, d: bool } }
+        }
+        schema test.2 {
+          predicate P : { a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can change order of fields" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat, b: string }
+        }
+        schema test.2 {
+          predicate P : { b: string, a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+   , TestLabel "can add predicate" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat }
+        }
+        schema test.2 {
+          predicate P : { a : nat }
+          predicate Q : { a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can remove a predicate" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat, b: string }
+        }
+        schema test.2 {}
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can add option" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : enum { a | b }
+        }
+        schema test.2 {
+          predicate P : enum { a | b | c }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating the schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can add alternative" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : { a : nat | }
+        }
+        schema test.2 {
+          predicate P : { a : nat | b : string | }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating the schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can remove option" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : enum { a | b | c }
+        }
+        schema test.2 {
+          predicate P : enum { a | b }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+
+  , TestLabel "can change order of options" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          predicate P : enum { a | b }
+        }
+        schema test.2 {
+          predicate P : enum { b | a }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "types are transparent" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema test.1 {
+          type T = { a : nat }
+          predicate P : T
+        }
+        schema test.2 {
+          predicate P : { a : nat }
+        }
+        schema test.2 evolves test.1
+        schema all.1 : test.1, test.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can evolve field types" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema x.1 {
+          predicate P: { a : nat }
+        }
+
+        schema y.1 {
+          import x.1
+          predicate Q: { a : x.P }
+        }
+
+        schema x.2 {
+          predicate P: { a : nat, b : maybe nat }
+        }
+
+        schema y.2 {
+          import x.2
+          predicate Q: { a : x.P }
+        }
+
+        schema x.2 evolves x.1
+        schema y.2 evolves y.1
+        schema all.1 : x.1, x.2, y.1, y.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "can evolve field types transitively" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema x.1 {
+          predicate P: { a : nat }
+        }
+
+        schema x.2 {
+          predicate P: { a : nat, b : maybe nat }
+        }
+
+        schema x.3 {
+          predicate P: { a : nat, b : maybe nat, c : maybe nat }
+        }
+
+        schema y.1 {
+          import x.1
+          predicate Q: { a : x.P }
+        }
+
+        schema y.2 {
+          import x.3
+          predicate Q: { a : x.P }
+        }
+
+        schema x.2 evolves x.1
+        schema x.3 evolves x.2
+        schema y.2 evolves y.1
+        schema all.1 : x.1, x.2, x.3, y.1, y.2 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "handles type imports" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema base.1 {
+          predicate P : nat
+          type T = { a : P }
+        }
+
+        schema x.2  {
+          import base.1
+          predicate Q : { x: base.T }
+        }
+
+        schema x.3 : x.2 {
+          import base.1
+          predicate Q : { x: base.T, y: maybe base.T }
+        }
+
+        schema x.3 evolves x.2
+        schema all.1 : base.1, x.2, x.3 {}
+      |]
+      $ \r ->
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+
+  , TestLabel "re-exported predicates" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+        }
+
+        schema x.2 : x.1  {
+        }
+        schema x.2 evolves x.1
+
+        schema x.3 {
+          predicate P : { a: nat }
+        }
+        schema x.3 evolves x.2
+        schema all.1 : x.1, x.2, x.3 {}
+      |]
+      $ \r ->
+      -- should try to make x.P.3 evolve x.P.1
+      assertBool "throws error stating missing field" $
+        case r of
+          Left err ->
+            ("cannot evolve predicate x.P.1 into x.P.3: " <>
+              "in field 'a', type changed")
+            `isInfixOf` show err
+          Right _ -> False
+
+  , TestLabel "re-exported predicates reverse" $ TestCase $ do
+    withSchema latestAngleVersion
+      [s|
+        schema x.1 {
+          predicate Q : nat
+          predicate P : { ref : Q }
+        }
+
+        schema x.2 {
+          predicate Q : nat
+          predicate P : { ref : Q }
+        }
+
+        schema x.3 : x.2 {
+          predicate P : { ref : Q }
+        }
+        schema x.3 evolves x.1
+        schema all.1 : x.1, x.2, x.3 {}
+      |]
+      $ \r ->
+      -- x.Q.2 should evolve x.Q.1
+      assertBool "succeeds creating schema" $
+        case r of
+          Right _ -> True
+          Left _ -> False
+  ]
+
+schemaEvolvesTransformations :: Test
+schemaEvolvesTransformations =
+  let nothing = RTS.Alt 0 unit
+      unit = RTS.Tuple []
+  in
+  TestList
+  [ TestLabel "backcompat - remove optional field" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : nat }
+        }
+        schema x.2 {
+          predicate P: { a : nat, b: maybe string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 2, "b": "val" } }|] ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "backcompat - fill optional field's default value" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : nat, b: maybe string }
+        }
+        schema x.2 {
+          predicate P: { a : nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 2 } }|] ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "forwardcompat - maps new optional field to default value" $
+    TestCase $
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+        }
+        schema x.2 {
+          predicate P : { a : string, b : maybe string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": "A" } }|]
+          ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content" [RTS.Tuple [RTS.String "A", nothing]] facts
+
+  , TestLabel "forwardcompat - matches new field against default value" $
+    TestCase $
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+        }
+        schema x.2 {
+          predicate P : { a : string, b : maybe string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": "A" } }|]
+          , [s|{ "key": { "a": "B" } }|]
+          ]
+      ]
+      -- should match { "A", nothing}, but not { "B", { just = "A" }}
+      [s| x.P.2 { "A", nothing } |
+          x.P.2 { "B", { just = "A" } }
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content" [RTS.Tuple [RTS.String "A", nothing]] facts
+
+  , TestLabel "forwardcompat - binds new field's default value" $
+    TestCase $
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+        }
+        schema x.2 {
+          predicate P : { a : string, b : maybe string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": "A" } }|]
+          ]
+      ]
+      [s| X where x.P.2 { _, X } |]
+      $ \_ response _ -> do
+        facts <- decodeResultsAsTy (MaybeTy StringTy) response
+        assertEqual "result content" [nothing] facts
+
+  , TestLabel "backcompat - change field order" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : string, b: nat }
+        }
+        schema x.2 {
+          predicate P: { b: nat, a : string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": "one1", "b": 16 } }|]
+          , [s|{ "key": { "a": "one2", "b": 32 } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "forwardcompat - change field order" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : string, b: nat }
+        }
+        schema x.2 {
+          predicate P: { b: nat, a : string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "b": 16, "a": "one1" } }|]
+          , [s|{ "key": { "b": 32, "a": "one2" } }|]
+          ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "backcompat - change alternative order" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : string | b: nat }
+        }
+        schema x.2 {
+          predicate P: { b: nat | a : string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": "A" } }|]
+          , [s|{ "key": { "b": 1 } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "forwardcompat - change alternative order" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : string | b: nat }
+        }
+        schema x.2 {
+          predicate P: { b: nat | a : string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": "A" } }|]
+          , [s|{ "key": { "b": 1 } }|]
+          ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "backcompat - maps new sum alternatives to unknown values" $
+    TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { b : string | }
+        }
+        schema x.2 {
+          predicate P : { a : nat | b : string | c : bool | }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1 } }|]
+          , [s|{ "key": { "b": "A" } }|]
+          , [s|{ "key": { "c": true } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        -- the unknown alternative has an index one greater than
+        -- the last alternative index of x.P.1.
+        let unknown = RTS.Alt 1 unit
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count"
+          [unknown, RTS.Alt 0 (RTS.String "A"), unknown] facts
+
+  , TestLabel "backcompat - maps new enum alternatives to unknown values" $
+    TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { b | }
+        }
+        schema x.2 {
+          predicate P : { a | b | c }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": {} } }|]
+          , [s|{ "key": { "b": {} } }|]
+          , [s|{ "key": { "c": {} } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        -- the unknown alternative has an index one greater than
+        -- the last alternative index of x.P.1.
+        let unknown = RTS.Alt 1 unit
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count"
+          [unknown, RTS.Alt 0 (RTS.Tuple []), unknown] facts
+
+  , TestLabel "transform nested facts" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { a : Q }
+          predicate Q: { x: string }
+        }
+        schema x.2 {
+          predicate P: { a: Q, b: maybe string }
+          predicate Q: { x: string, y: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.Q" 2)
+          [ [s|{ "id": 1, "key": { "x": "A", "y": 1 } }|]
+          , [s|{ "id": 2, "key": { "x": "B", "y": 2 } }|]
+          ]
+      , mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1, "b": "A" } }|]
+          , [s|{ "key": { "a": 2, "b": "B" } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+        nested <- decodeNestedAs (SourceRef "x.Q" (Just 1)) byRef response
+        assertEqual "nested count" 2 (length nested)
+
+  , TestLabel "transform nested facts in userQueryFacts" $ TestCase $ do
+    withSchemaAndFacts []
+      [s|
+        schema x.1 {
+          predicate P: { a : Q }
+          predicate Q: { x: string }
+        }
+        schema x.2 {
+          predicate P: { a: Q, b: maybe string }
+          predicate Q: { x: string, y: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.Q" 2)
+          [ [s|{ "id": 1, "key": { "x": "A", "y": 1 } }|]
+          , [s|{ "id": 2, "key": { "x": "B", "y": 2 } }|]
+          ]
+      , mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1, "b": "A" } }|]
+          , [s|{ "key": { "a": 2, "b": "B" } }|]
+          ]
+      ]
+      $ \env repo schema -> do
+        -- get all P.2 facts
+        response <- userQuery env repo $ def
+          { userQuery_query = "x.P.2 _"
+          , userQuery_options = Just def
+            { userQueryOptions_syntax = QuerySyntax_ANGLE }
+          , userQuery_encodings = [ UserQueryEncoding_bin def ]
+          }
+        fids <- factIds response
+
+        -- ask for P.2 facts by Id as P.1
+        response <- try $ userQueryFacts env repo $ def
+          { userQueryFacts_facts =
+              [ def
+                  { factQuery_id = fromIntegral fid
+                  , factQuery_predicate_version = Just 1
+                  , factQuery_recursive = True
+                  }
+              | fid <- fids ]
+          , userQueryFacts_encodings = [ UserQueryEncoding_bin def ]
+          }
+
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) schema response
+        assertEqual "result count" 2 (length facts)
+        nested <- decodeNestedAs (SourceRef "x.Q" (Just 1)) schema response
+        assertEqual "nested count" 2 (length nested)
+
+  , TestLabel "transform nested record" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a: string }
+          predicate P : { x: T, y: T  }
+        }
+        schema x.2 {
+          type T = { a: string, b: maybe nat }
+          predicate P : { x: T, y: T  }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": { "a": "A" }, "y": { "a": "B" }}}|]
+          , [s|{ "key": { "x": { "a": "B" }, "y": { "a": "A" }}}|]
+          ]
+      ]
+      [s| x.P.2 { X, Y };
+          x.P.2 { Y, X }
+      |]
+      -- should add the 'maybe nat` field when binding X and Y, and then remove
+      -- it again when matching X and Y against db values.
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result"
+          [ RTS.Tuple
+              [ RTS.Tuple [RTS.String "A", RTS.Alt 0 (RTS.Tuple [])]
+              , RTS.Tuple [RTS.String "B", RTS.Alt 0 (RTS.Tuple [])]
+              ]
+          , RTS.Tuple
+              [ RTS.Tuple [RTS.String "B", RTS.Alt 0 (RTS.Tuple [])]
+              , RTS.Tuple [RTS.String "A", RTS.Alt 0 (RTS.Tuple [])]
+              ]
+          ] facts
+
+  , TestLabel "transform deep nested record" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x: nat, y: nat  }
+        }
+
+        schema x.2 {
+          predicate P : { x: nat  }
+        }
+        schema x.2 evolves x.1
+
+        schema y.1 {
+          import x.2
+          predicate P : x.P
+            X where X = x.P _
+        }
+
+        schema z.1 {
+          import y.1
+          predicate P : y.P
+            X where X = y.P _
+        }
+
+        schema all.1 : x.1, x.2, z.1, y.1 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": 1, "y": 2 }}|]
+          ]
+      ]
+      [s| z.P _ |]
+      -- should add the 'maybe nat` field when binding X and Y, and then remove
+      -- it again when matching X and Y against db values.
+      $ \schema response _ -> do
+        _ <- decodeResultsAs (SourceRef "z.P" (Just 1)) schema response
+        nested <- decodeNestedAs (SourceRef "x.P" (Just 2)) schema response
+        assertEqual "nested" 1 (length nested)
+
+  , TestLabel "uses transformed record for prefix search" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: {x: nat, y: { a: string, b: enum { One | Two | Three }}}
+        }
+        schema x.2 {
+          predicate P: {y: {  b: enum { Two | One }, a: string, }, x: nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": 1, "y": { "a": "A", "b": 0 }}}|]
+          , [s|{ "key": { "x": 1, "y": { "a": "A", "b": 1 }}}|]
+          , [s|{ "key": { "x": 1, "y": { "a": "A", "b": 2 }}}|]
+          ]
+      ]
+      [s| x.P.2 { { One, "A"}, 1 }
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result" 1 (length facts)
+        let searched =
+              sum $ Map.elems $ fromMaybe mempty $
+              userQueryStats_facts_searched $ fromMaybe def $
+              userQueryResults_stats $ either (error "request failure") id
+              response
+        assertEqual "facts searched" 1 searched
+
+  , TestLabel "change within type" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: T
+          type T = { a: string | b : TT }
+          type TT = { x: nat | y: string }
+        }
+        schema x.2 {
+          predicate P: T
+          type T = { b: TT | a: string }
+          type TT = { y: string | x: nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": "A" } }|]
+          , [s|{ "key": { "b": { "x" : 1 } } }|]
+          , [s|{ "key": { "b": { "y" : "B" } } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 3 (length facts)
+
+  , TestLabel "no mapping when schema has facts" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : nat }
+        }
+        schema x.2 {
+          predicate P : { a : nat, b: maybe string }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": 1 } }|]
+          ]
+      , mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1, "b": "A" } }|]
+          , [s|{ "key": { "a": 2, "b": "B" } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "non-evolved derived predicate with imports" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : nat }
+        }
+        schema x.2 {
+          predicate P : { a : nat, b: maybe string }
+        }
+        schema x.2 evolves x.1
+        schema y.1 {
+          import x.1
+          predicate Q : { x : x.P }
+            { x = V } where V = x.P _
+        }
+        schema all.1 : x.1, x.2, y.1 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1, "b": "A" } }|]
+          ]
+      ]
+      [s| y.Q.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "y.Q" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+        nested <- decodeNestedAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "nested count" 1 (length nested)
+
+  , TestLabel "non-evolved derived predicate with inheritance" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : nat }
+        }
+        schema x.2 {
+          predicate P : { a : nat, b: maybe string }
+        }
+        schema x.2 evolves x.1
+
+        schema y.1 : x.1 {
+          predicate Q : { x : x.P }
+            { x = V } where V = x.P _
+        }
+        schema all.1 : x.1, x.2, y.1 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": 1, "b": "A" } }|]
+          ]
+      ]
+      [s| y.Q.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "y.Q" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+        nested <- decodeNestedAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "nested count" 1 (length nested)
+
+  , TestLabel "dependency without facts" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 { predicate P : { a : nat } }
+        schema x.2 { predicate P : { b : string } }
+        schema x.2 evolves x.1
+
+        schema y.1 {
+          import x.1
+          predicate Q : [x.P.1]
+        }
+
+        schema y.2 {
+          import x.2
+          predicate Q : [x.P.2]
+        }
+        schema y.2 evolves y.1
+        schema all.1 : x.1, x.2, y.1, y.2 {}
+      |]
+      [ mkBatch (PredicateRef "y.Q" 1)
+          [ [s|{ "key": [] }|]
+          ]
+      ]
+      [s| y.Q.2 _ |]
+      -- there are no facts of x.1 or x.2 so there will be no evolution
+      -- of the x schema. Nonetheless we should be able to evolve y.1
+      -- into y.2 even though there is no evolution for one of its option.
+      -- This is only the case because there are no facts for the option
+      -- or its evolved counterpart.
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "y.Q" (Just 2)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "query matching order" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema base.1 {
+          predicate N : nat
+          predicate S : string
+        }
+        schema x.1 : base.1 {
+          predicate P : { a : N, b : S }
+        }
+        schema x.2 : base.1 {
+          predicate P : { b: S, a : N }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : base.1, x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "base.N" 1)
+          [ [s|{ "id": 1, "key": 1 }|]
+          ]
+      , mkBatch (PredicateRef "base.S" 1)
+          [ [s|{ "id": 2, "key": "A" }|]
+          , [s|{ "id": 3, "key": "B" }|]
+          ]
+      , mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "b": 2, "a": 1 } }|]
+          , [s|{ "key": { "b": 3, "a": 1 } }|]
+          ]
+      ]
+      -- even though x.P.2 first field is base.S, X should be
+      -- bound to the first field of x.P.1 which is base.N.
+      [s| X where { X, _ } = x.P.1 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "base.N" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "query variable" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : nat
+          predicate Q : { a: P, b : string }
+        }
+        schema x.2 {
+          predicate P : nat
+          predicate Q : { b: string, a: P }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "id": 1, "key": 1 }|]
+          , [s|{ "id": 2, "key": 2 }|]
+          ]
+      , mkBatch (PredicateRef "x.Q" 2)
+          [ [s|{ "key": { "b": "A", "a": 1 } }|]
+          , [s|{ "key": { "b": "A", "a": 2 } }|]
+          ]
+      ]
+      [s| Y where
+            X = x.P.1 _;
+            Y = x.Q.1 { X, _ };
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.Q" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+        nested <- decodeNestedAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "nested count" 2 (length nested)
+
+  , TestLabel "whole key assigned to variable - remove fields" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+        }
+        schema x.2 {
+          predicate P : { a: string, b: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "a": "A", "b": 1  }}|]
+          , [s|{ "key": { "a": "B", "b": 2  }}|]
+          ]
+      ]
+      [s| X where
+            X = x.P.1 Y;
+            { a = "A" } = Y;
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result" [RTS.Tuple [RTS.String "A"]] facts
+
+  , TestLabel "whole key assigned to variable - fill defaults" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { a : string }
+          predicate Q : { a: string, b: maybe nat }
+        }
+        schema x.2 {
+          predicate P : { a: string, b: maybe nat }
+          predicate Q : { a: string, b: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "a": "A" }}|]
+          , [s|{ "key": { "a": "B" }}|]
+          ]
+      , mkBatch (PredicateRef "x.Q" 1)
+          [ [s|{ "key": { "a": "A" }}|]
+          , [s|{ "key": { "a": "A", "b": 1  }}|]
+          , [s|{ "key": { "a": "B", "b": 2  }}|]
+          ]
+      ]
+      [s| x.P.2 X;
+          x.Q.2 X
+      |]
+      -- should bind 'nothing' as the default value of the second field of
+      -- x.P.2, causing values from x.Q.2 with a second value of 'just' to
+      -- not match.
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.Q" (Just 2)) byRef response
+        assertEqual "result"
+          [RTS.Tuple [RTS.String "A", RTS.Alt 0 (RTS.Tuple [])]]
+          facts
+
+  , TestLabel "predicate derivation" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : nat
+          predicate Q : string
+          predicate R : nat A where P A
+        }
+        schema x.2 {
+          predicate P : nat
+          predicate Q : string
+          predicate R : string A where Q A
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": 1 }|]
+          ]
+      , mkBatch (PredicateRef "x.Q" 2)
+          [ [s|{ "key": "A" }|]
+          , [s|{ "key": "B" }|]
+          ]
+      ]
+      [s| x.R.1 _ |]
+      -- Derived predicates should not be substituted for their newest
+      -- version but the query they flatten-out into should be evolved.
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.R" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "predicate value" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+          predicate Q : nat -> P
+        }
+        schema x.2 {
+          predicate P : { y : string, x : nat }
+          predicate Q : nat -> P
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "id": 1, "key": { "y": "A", "x": 1 } }|]
+          ]
+
+      , mkBatch (PredicateRef "x.Q" 2)
+          [ [s|{ "key": 1, "value" : 1 }|]
+          ]
+      ]
+      [s| P where x.Q.1 _ -> P |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "derived predicate value" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+          predicate Q : nat -> P
+            X -> Y where Y = P { X, _ }
+        }
+        schema x.2 {
+          predicate P : { y : string, x : nat }
+          predicate Q : nat -> P
+            X -> Y where Y = P { _, X }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "y": "A", "x": 1 } }|]
+          , [s|{ "key": { "y": "B", "x": 2 } }|]
+          ]
+      ]
+      [s| P where x.Q.1 _ -> P |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "subquery in primcall" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+        }
+        schema x.2 {
+          predicate P : { y : string, x : nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "y": "A", "x": 1 } }|]
+          , [s|{ "key": { "y": "B", "x": 2 } }|]
+          ]
+      ]
+      [s| x.P.1 { X, _ } where
+            X = (Y where x.P.1 { Y, _ }) + (Z where x.P.1 { Z, _ })
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "array elements" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+        }
+        schema x.2 {
+          predicate P : { y : string, x : nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "y": "A", "x": 1 } }|]
+          , [s|{ "key": { "y": "B", "x": 2 } }|]
+          ]
+      ]
+      -- check that not only the type of elements inside the array
+      -- changed but also that the pattern matched against the array
+      -- is changed.
+      [s| x.P.1 { N, _ } where
+            A = [ x.P.1 { 1, _ }, x.P.1 { 2, _ } ];
+            { N, _ } = A[..]
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "named type inside alts" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a: string, b: nat }
+          predicate P : { x : maybe T }
+        }
+        schema x.2 {
+          type T = { b: nat, a: string }
+          predicate P : { x : maybe T }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "x": { "a": "A", "b": 1 } } }|]
+          , [s|{ "key": { "x": { "a": "B", "b": 2 } } }|]
+          ]
+      ]
+      [s| x.P.1 { x = { just = { a = _ } } }|]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 2 (length facts)
+
+  , TestLabel "negation" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x : nat, y : string }
+        }
+        schema x.2 {
+          predicate P : { y : string, x : nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "key": { "y": "A", "x": 1 } }|]
+          , [s|{ "key": { "y": "B", "x": 2 } }|]
+          ]
+      ]
+      [s| X where
+            X = x.P.1 _;
+            !(X = x.P.1 { 1, _ })
+      |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "multiple evolved, same pred" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate N : nat
+        }
+        schema x.2 {
+          predicate N : nat
+        }
+        schema x.2 evolves x.1
+
+        schema y.1 {
+          import x.1
+          import x.2
+
+          predicate Q : { x: x.N.1, y: x.N.2 }
+        }
+        schema all.1 : x.1, x.2, y.1 {}
+      |]
+      [ mkBatch (PredicateRef "x.N" 2)
+          [ [s|{ "key": 1 }|]
+          ]
+      ]
+      [s| y.Q.1 _ |]
+      $ \_ response _ ->
+        case response of
+          Right _ -> assertFailure "expected request to fail"
+          Left badQuery ->
+            assertBool "errors with multple versions of evolved predicate"
+            ("multiple versions of evolved predicates"
+              `isInfixOf` show badQuery)
+
+  , TestLabel "explicit fact id" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x: nat }
+        }
+        schema x.2 {
+          predicate P : { x: nat, y: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "id": 1, "key": { "x": 1, "y": 2 } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \byRef (Right results) runQuery -> do
+        fids <- factIds results
+        let factId = head fids
+
+        response <- runQuery $ "$" <> pack (show factId) <> " : x.P.1"
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 1)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "correct return type" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P : { x: nat }
+        }
+        schema x.2 {
+          predicate P : { x: nat, y: maybe nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "id": 1, "key": { "x": 1, "y": 2 } }|]
+          ]
+      ]
+      [s| x.P.1 _ |]
+      $ \_ (Right results) _ -> do
+        let Just ty = userQueryResults_type results
+        assertEqual "result type" "x.P.1" ty
+
+  , TestLabel "re-exported predicates" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate Q : nat
+        }
+
+        schema x.2 : x.1 {
+          predicate P : { ref : Q.1 }
+        }
+
+        schema x.3 {
+          predicate Q : nat
+          predicate P : { ref : Q }
+        }
+
+        schema x.3 evolves x.2
+        schema all.1 : x.1, x.2, x.3 {}
+      |]
+      [ mkBatch (PredicateRef "x.Q" 1)
+          [ [s|{ "id": 1, "key": 1 }|]
+          ]
+      , mkBatch (PredicateRef "x.P" 2)
+          [ [s|{ "id": 1, "key": { "ref": 1 } }|]
+          ]
+      ]
+      -- should make x.Q.1, which is re-exported by x.3, evolve x.Q.3
+      [s| x.P.3 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 3)) byRef response
+        assertEqual "result count" 1 (length facts)
+
+  , TestLabel "transform within array" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a : nat }
+          predicate P: { x : [T] }
+        }
+        schema x.2 {
+          type T = { a : nat, b : maybe nat }
+          predicate P: { x : [T] }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": [{ "a": 1 }, { "a": 2 }] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Tuple [RTS.Nat 1, nothing]
+              , RTS.Tuple [RTS.Nat 2, nothing]
+              ] ] ]
+          facts
+  , TestLabel "transform predicate within set" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a : nat }
+          predicate P: { x : set T }
+        }
+        schema x.2 {
+          type T = { a : nat, b : maybe nat }
+          predicate P: { x : set T }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+        [ [s|{ "key": { "x": [{ "a": 1 }, { "a": 2 }] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Tuple [RTS.Nat 1, nothing]
+              , RTS.Tuple [RTS.Nat 2, nothing]
+              ] ] ]
+          facts
+  , TestLabel "evolve array to set of nat" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { x : [nat] }
+        }
+        schema x.2 {
+          predicate P: { x : set nat }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+        [ [s|{ "key": { "x": [ 1 , 1, 2 ] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Nat 1
+              , RTS.Nat 2
+              ] ] ]
+          facts
+  , TestLabel "evolve set to array of nat" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { x : set nat }
+        }
+        schema x.2 {
+          predicate P: { x : [nat] }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+        [ [s|{ "key": { "x": [ 1 , 1, 2 ] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Nat 1
+              , RTS.Nat 2
+              ] ] ]
+          facts
+  , TestLabel "evolve set to array of byte" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { x : set byte }
+        }
+        schema x.2 {
+          predicate P: { x : [byte] }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+        [ [s|{ "key": { "x": [ 1 , 1, 2 ] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.ByteArray "\SOH\STX" ] ]
+          facts
+  , TestLabel "evolve array to set of byte" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          predicate P: { x : [byte] }
+        }
+        schema x.2 {
+          predicate P: { x : set byte }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+        [ [s|{ "key": { "x": [ 1 , 1, 2 ] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array [RTS.Byte 1, RTS.Byte 2] ] ]
+          facts
+  , TestLabel "evolve array to set of pred" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a : nat }
+          predicate P: { x : [T] }
+        }
+        schema x.2 {
+          type T = { a : nat, b : maybe nat }
+          predicate P: { x : set T }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": [{ "a": 1 }, { "a": 2 }] } }|] ]
+
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Tuple [RTS.Nat 1, nothing]
+              , RTS.Tuple [RTS.Nat 2, nothing]
+              ] ] ]
+          facts
+  , TestLabel "evolve set to array of pred" $ TestCase $ do
+    withSchemaAndFactsQ
+      [s|
+        schema x.1 {
+          type T = { a : nat }
+          predicate P: { x : set T }
+        }
+        schema x.2 {
+          type T = { a : nat, b : maybe nat }
+          predicate P: { x : [T] }
+        }
+        schema x.2 evolves x.1
+        schema all.1 : x.1, x.2 {}
+      |]
+      [ mkBatch (PredicateRef "x.P" 1)
+          [ [s|{ "key": { "x": [{ "a": 1 }, { "a": 2 }] } }|] ]
+      ]
+      [s| x.P.2 _ |]
+      $ \byRef response _ -> do
+        facts <- decodeResultsAs (SourceRef "x.P" (Just 2)) byRef response
+        assertEqual "result content"
+          [ RTS.Tuple
+            [ RTS.Array
+              [ RTS.Tuple [RTS.Nat 1, nothing]
+              , RTS.Tuple [RTS.Nat 2, nothing]
+              ] ] ]
+          facts
+  ]
+  where
+    -- run a userQuery using the given schemas and facts
+    withSchemaAndFactsQ
+      :: String                  -- ^ schema
+      -> [JsonFactBatch]         -- ^ db contents
+      -> Text                    -- ^ initial query
+      -> ( DbSchema
+        -> Either BadQuery UserQueryResults                -- query response
+        -> (Text -> IO (Either BadQuery UserQueryResults)) -- run more queries
+        -> IO a )
+      -> IO a
+    withSchemaAndFactsQ schema facts query act =
+      withSchemaAndFacts [] schema facts $ \env repo dbSchema -> do
+      let run q = do
+            response <- try $ runQuery env repo (encodeUtf8 q)
+            print (response :: Either BadQuery UserQueryResults)
+            return response
+      res <- run query
+      act dbSchema res run
+      where
+        runQuery env repo q = userQuery env repo $ def
+          { userQuery_query = q
+          , userQuery_options = Just def
+            { userQueryOptions_syntax = QuerySyntax_ANGLE
+            , userQueryOptions_recursive = True
+            , userQueryOptions_collect_facts_searched = True
+            , userQueryOptions_debug = def
+              { queryDebugOptions_bytecode = False
+              , queryDebugOptions_ir = False
+              }
+            }
+          , userQuery_encodings = [ UserQueryEncoding_bin def ]
+          }
+
+    factIds :: UserQueryResults -> IO [Id]
+    factIds results =
+      case userQueryResults_results results of
+        UserQueryEncodedResults_bin bin ->
+          return $ Map.keys $ userQueryResultsBin_facts bin
+        _ ->
+          assertFailure "wrong encoding"
+
+    decodeResultsAs
+      :: SourceRef
+      -> DbSchema
+      -> Either BadQuery UserQueryResults
+      -> IO [RTS.Value]
+    decodeResultsAs ref schema eresults = do
+      res <- decodeResults
+        (keyType ref schema) userQueryResultsBin_facts eresults
+      either assertFailure return res
+
+    -- filter nested predicates by SourceRef before decoding
+    decodeNestedAs ref schema eresults = do
+      let hasPid (RTS.Pid pid) fact = fromIntegral pid == Thrift.fact_type fact
+          factsOfType pid = Map.filterWithKey (const $ hasPid pid)
+      pid <- either (assertFailure . unpack) (return . predicatePid) $
+        lookupPredicateSourceRef ref LatestSchema schema
+      putStrLn $ "Filtering for " <> show (showRef ref) <> " with Pid " <> show pid
+      either assertFailure return =<< decodeResults
+        (keyType ref schema)
+        (factsOfType pid . userQueryResultsBin_nestedFacts)
+        eresults
+
+
+    decodeResultsAsTy ty eresults =  do
+      res <- decodeResults ty userQueryResultsBin_facts eresults
+      either assertFailure return res
+
+    keyType
+      :: SourceRef
+      -> DbSchema
+      -> RTS.Type
+    keyType ref dbSchema =
+      case lookupPredicateSourceRef ref LatestSchema dbSchema of
+        Left err -> error $ "can't find predicate: " <>
+          unpack (showRef ref) <> ": " <> unpack err
+        Right details -> predicateKeyType details
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList $
+  [ TestLabel "schemaEvolves" schemaEvolves
+  , TestLabel "schemaEvolvesTransformations" schemaEvolvesTransformations
+  ]
diff --git a/glean/test/tests/Schema/Lib.hs b/glean/test/tests/Schema/Lib.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Schema/Lib.hs
@@ -0,0 +1,173 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Schema.Lib
+  ( withSchemaAndFacts
+  , withSchema
+  , withSchemaFile
+  , angleQuery
+  , mkBatch
+  , mkAngleQuery
+  , decodeResults
+  ) where
+
+import Control.Monad.IO.Class (liftIO)
+import Control.Monad.Trans.Except
+import Data.ByteString (ByteString)
+import Data.Map (Map)
+import Control.Exception
+import Control.Monad
+import Data.Default
+import qualified Data.Map as Map
+import Data.Text (pack)
+import Data.Text.Encoding (encodeUtf8)
+import System.FilePath
+import System.IO.Temp
+
+import Util.Control.Exception
+
+import Glean.Angle.Types (latestAngleVersion, AngleVersion(..))
+import Glean.Backend.Types
+import Glean.Database.Open
+import Glean.Database.Config
+import Glean.Database.Test
+import Glean.Database.Types
+import Glean.Database.Schema.Types
+import Glean.Database.Schema
+import Glean.Types as Thrift
+import Glean.Write.JSON
+
+import qualified Glean.RTS as RTS
+import qualified Glean.RTS.Term as RTS
+import qualified Glean.RTS.Types as RTS
+
+angleQuery :: Env -> Repo -> ByteString -> IO UserQueryResults
+angleQuery env repo q = userQuery env repo $ mkAngleQuery q
+
+mkBatch :: PredicateRef -> [ByteString] -> JsonFactBatch
+mkBatch ref facts =
+  JsonFactBatch
+    { jsonFactBatch_predicate = ref
+    , jsonFactBatch_facts = facts
+    , jsonFactBatch_unit = Nothing
+    }
+
+mkAngleQuery :: ByteString -> UserQuery
+mkAngleQuery q = def
+  { userQuery_query = q
+  , userQuery_options = Just def
+    { userQueryOptions_syntax = QuerySyntax_ANGLE
+    }
+  }
+
+decodeResults
+  :: RTS.Type
+  -> (UserQueryResultsBin -> Map Id Fact) -- facts/nested
+  -> Either BadQuery UserQueryResults
+  -> IO (Either String [RTS.Value])
+decodeResults ty getFacts eitherRes = runExceptT $ do
+  results <- case eitherRes of
+    Left err -> fail $ "BadQuery: " <> show err
+    Right r -> return r
+  bin <- binResults results
+  let keys = fmap fact_key $ Map.elems $ getFacts bin
+  mapM (decodeAs ty) keys
+  where
+    binResults :: UserQueryResults -> ExceptT String IO UserQueryResultsBin
+    binResults UserQueryResults{..} =
+      case userQueryResults_results of
+        UserQueryEncodedResults_bin b -> return b
+        _ -> fail "wrong encoding"
+
+    decodeAs :: RTS.Type -> ByteString -> ExceptT String IO RTS.Value
+    decodeAs ty bs = do
+      res <- liftIO $ try $ do
+        print bs
+        evaluate $ RTS.toValue (withUnknown $ RTS.repType ty) bs
+      case res of
+        Left e -> fail $ "unable to decode : " <> showException e
+        Right val -> return val
+      where
+        showException (RTS.DecodingException e) = e
+        -- we want to decode binary values that contain the unknown alternative
+        withUnknown rep = case rep of
+          RTS.ByteRep -> rep
+          RTS.NatRep -> rep
+          RTS.ArrayRep elty -> RTS.ArrayRep $ withUnknown elty
+          RTS.TupleRep tys -> RTS.TupleRep $ fmap withUnknown tys
+          RTS.SumRep tys ->
+            let unknown = RTS.TupleRep [] in
+            RTS.SumRep $ fmap withUnknown tys ++ [unknown]
+          RTS.SetRep tys -> RTS.SetRep $ withUnknown tys
+          RTS.StringRep -> rep
+          RTS.PredicateRep _ -> rep
+
+-- | Used to test schema transformations
+-- Runs the callback on a read-only version of a db with the
+-- given schema and facts.
+withSchemaAndFacts
+  :: [Setting]
+  -> String                  -- ^ schema
+  -> [JsonFactBatch]         -- ^ db contents
+  -> ( Env -> Repo -> DbSchema -> IO a)
+  -> IO a
+withSchemaAndFacts customSettings schema facts act =
+  withSchemaFile latestAngleVersion schema $ \root file -> do
+  let settings =
+        [ setRoot root
+        , setSchemaPath file
+        ] ++ customSettings
+
+  -- create db and write facts
+  repo <- withEmptyTestDB settings $ \env repo -> do
+      void $ syncWriteJsonBatch env repo facts Nothing
+      completeTestDB env repo
+      return repo
+
+  -- get PredicateDetails
+  dbSchema <- do
+    schema <- either error return
+      $ processOneSchema Nothing $ encodeUtf8 $ pack schema
+    newDbSchema Nothing schema LatestSchema readWriteContent def
+
+  -- open db for querying
+  -- We need to open the db again because schema evolutions are
+  -- only triggered when the db is read-only
+  withTestEnv settings $ \env ->
+    act env repo dbSchema
+
+withSchemaFile
+  :: AngleVersion
+  -> String
+  -> (FilePath -> FilePath -> IO a)
+  -> IO a
+withSchemaFile (AngleVersion version) str action = do
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let newSchemaFile = root </> "schema"
+    appendFile newSchemaFile $ "version: " <> show version
+    appendFile newSchemaFile str
+    action root newSchemaFile
+
+withSchema
+  :: AngleVersion
+  -> String
+  -> (Either SomeException () -> IO a)
+  -> IO a
+withSchema version str action =
+  withSchemaFile version str $ \root file -> do
+    let settings =
+          [ setRoot root
+          , setSchemaPath file
+          ]
+    r <- tryAll $
+      withEmptyTestDB settings $ \env repo ->
+      withOpenDatabase env repo $ \_ ->
+        return ()
+
+    print (r :: Either SomeException ())
+    action r
diff --git a/glean/test/tests/Schema/Multi.hs b/glean/test/tests/Schema/Multi.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/Schema/Multi.hs
@@ -0,0 +1,636 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+module Schema.Multi (main) where
+
+import Control.Exception
+import Control.Monad
+import Data.Either
+import Data.Default (def)
+import Data.List (isInfixOf)
+import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Text as Text
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+import Test.HUnit
+
+import TestRunner
+import Thrift.Util
+import Util.String.Quasi
+
+import Glean.Angle.Types (Type_(..), FieldDef_(..))
+import Glean.Backend.Types (userQueryFacts, userQuery)
+import Glean.Database.Config
+import Glean.Database.Schema
+import Glean.Database.Test
+import Glean.Init
+import qualified Glean.RTS.Term as RTS
+import Glean.Types as Thrift
+import qualified Glean.Internal.Types as Internal
+import Glean.Write.SendBatch
+import Glean.Write.JSON
+
+
+import Schema.Lib
+import Glean.ServerConfig.Types (config_strict_query_schema_id)
+
+multiSchemaTest :: Test
+multiSchemaTest = TestCase $
+  withSystemTempDirectory "glean-dbtest" $ \root -> do
+    let
+      schema_v0_file = root </> "schema0"
+      schema_v0 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+          }
+
+          schema y.1 {
+            import x.1
+            predicate Q : { p : x.P }
+          }
+
+          schema z.1 {
+            predicate R : string
+          }
+
+          schema derived.1 {
+            import x.1
+            predicate D : { a : string }
+              { a = A } where x.P { a = A }
+
+            type T = string
+            predicate S : T
+              stored X where x.P { a = X }
+          }
+
+          schema evolved.1 {
+            predicate P : enum { A | }
+            predicate Q : { ref : P }
+          }
+
+          schema evolved.2 {
+            predicate P : enum { A | B }
+            predicate Q : { ref : P }
+          }
+
+          schema evolved.2 evolves evolved.1
+
+          schema evolved.3 {
+            predicate P : enum { A | B | C }
+            predicate Q : { ref : P }
+          }
+
+          schema all.1 : x.1, y.1, z.1, derived.1, evolved.1, evolved.2, evolved.3 {}
+        |]
+
+      schema_v1_file = root </> "schema1"
+      schema_v1 =
+        [s|
+          schema x.1 {
+            # P has a new field
+            predicate P : { a: string, b: nat }
+          }
+
+          schema y.1 {
+            import x.1
+            predicate Q : { p : x.P }
+          }
+
+          # z.1 has been deleted
+
+          schema derived.1 {
+            import x.1
+            predicate D : { a : string }
+              { a = A } where x.P { a = A, b = 3 }
+              # now matches on the new field
+
+            # check that we can change the definition of a stored predicate,
+            # deleting a type synonym and using a different definition.
+            predicate S : string
+              stored X where x.P { a = X }
+          }
+
+          schema evolved.1 {
+            # evolved.P.2 should be able to evolve both the new and old
+            # versions of evolved.P.1
+            predicate P : enum { A | B }
+            predicate Q : { ref : P }
+          }
+
+          schema evolved.2 {
+            predicate P : enum { A | B }
+            predicate Q : { ref : P }
+          }
+
+          schema evolved.2 evolves evolved.1
+
+          schema evolved.3 {
+            predicate P : enum { A | B | C }
+            predicate Q : { ref : P }
+          }
+
+          # added evolution
+          schema evolved.3 evolves evolved.2
+
+          schema all.1 : x.1, y.1, derived.1, evolved.1, evolved.2, evolved.3 {}
+        |]
+
+      schema_index_file_0 = root </> "schema_index_0"
+      schema_index_0 = Internal.SchemaIndex
+        { schemaIndex_current = Internal.SchemaInstance
+          { schemaInstance_versions = Map.fromList [ ("v0", 0) ]
+          , schemaInstance_file = "schema0"
+          }
+        , schemaIndex_older = []
+        }
+
+      schema_index_file_1 = root </> "schema_index_1"
+      schema_index_1 = Internal.SchemaIndex
+        { schemaIndex_current = Internal.SchemaInstance
+          { schemaInstance_versions = Map.fromList [ ("v1", 1) ]
+          , schemaInstance_file = "schema1"
+          }
+        , schemaIndex_older = [
+            Internal.SchemaInstance
+              { schemaInstance_versions = Map.fromList [ ("v0", 1) ]
+              , schemaInstance_file = "schema0"
+              }
+        ]
+        }
+
+    writeFile schema_v0_file schema_v0
+    writeFile schema_v1_file schema_v1
+    saveJSON schema_index_file_0 schema_index_0
+    saveJSON schema_index_file_1 schema_index_1
+
+    let dbRoot = root </> "db"
+    createDirectory dbRoot
+
+    let
+      mkRepo schema hash upd facts =
+        withTestEnv [
+            setRoot dbRoot,
+            setSchemaIndex schema ] $ \env -> do
+          let repo = Repo "test" hash
+          kickOffTestDB env repo upd
+          facts env repo
+          completeTestDB env repo
+          return repo
+
+      testEnv schema schema_id set act =
+        withTestEnv (
+          [ setRoot dbRoot,
+            setSchemaIndex schema,
+            maybe id (setSchemaId . SchemaId) schema_id ] ++ set)
+          act
+
+      testQuery name repo schema schema_id query result =
+        testQuerySet name [] repo schema schema_id query result
+
+      testQuerySet name set repo schema schema_id query result =
+        testEnv schema schema_id set $ \env -> do
+          r <- try $ angleQuery env repo query
+          case result of
+            Just n -> case r :: Either BadQuery UserQueryResults of
+              Right UserQueryResults{..} ->
+                assertEqual name n (length userQueryResults_facts)
+              _ -> assertFailure (name <> ": " <> show r)
+            Nothing -> assertBool name $ case r of
+              Left{} -> True
+              _ -> False
+
+      testQueryFacts name repo schema schema_id query ty results =
+        testQueryFactsSet name [] repo schema schema_id query ty results
+
+      testQueryFactsSet name set repo schema schema_id query ty results =
+        testEnv schema schema_id set $ \env -> do
+          -- get fids
+          fids <- do
+            UserQueryResults{..} <- userQuery env repo def
+              { userQuery_query = query
+              , userQuery_options = Just def
+                { userQueryOptions_syntax = QuerySyntax_ANGLE
+                }
+              , userQuery_encodings = [ UserQueryEncoding_bin def ]
+              }
+            UserQueryEncodedResults_bin b <- return userQueryResults_results
+            return $ Map.keys (userQueryResultsBin_facts b)
+
+          -- ask for facts
+          r <- try $ userQueryFacts env repo def
+            { userQueryFacts_facts =
+                [ def { factQuery_id = fromIntegral fid } | fid <- fids ]
+            , userQueryFacts_encodings = [ UserQueryEncoding_bin def ]
+            }
+
+          -- check that the result is as expected
+          decoded <- decodeResults ty userQueryResultsBin_facts r
+          case decoded of
+            Left err -> assertFailure err
+            Right values -> assertEqual name values results
+
+      v0_facts =
+        [ mkBatch (PredicateRef "z.R" 1)
+            [ [s| { "key" : "abc" } |] ]
+        , mkBatch (PredicateRef "x.P" 1)
+            [ [s| { "key" : { "a" : "xyz" } } |] ]
+        , mkBatch (PredicateRef "y.Q" 1)
+            [ [s| { "key" : { "p" : { "key" : { "a" : "xyz" } }}} |] ]
+        , mkBatch (PredicateRef "evolved.P" 1)
+            [ [s| { "key" : 0 } |] ]
+        ]
+
+      v1_facts =
+        [ mkBatch (PredicateRef "x.P" 1)
+            [ [s| { "key" : { "a" : "xyz", "b": 3 } } |] ]
+        , mkBatch (PredicateRef "y.Q" 1)
+            [ [s| { "key" : { "p" : { "key" : { "a" : "xyz", "b" : 3 } }}} |] ]
+        , mkBatch (PredicateRef "evolved.P" 2)
+            [ [s| { "key" : 0 } |] ]
+        , mkBatch (PredicateRef "evolved.P" 1)
+            [ [s| { "key" : 0 } |] ]
+        ]
+
+    -- create a DB using v0
+    repo0 <- mkRepo schema_index_file_0 "0" id $ \env repo -> do
+      void $ syncWriteJsonBatch env repo v0_facts Nothing
+
+    -- create a DB using v1
+    repo1 <- mkRepo schema_index_file_1 "1" id $ \env repo -> do
+      void $ syncWriteJsonBatch env repo v1_facts Nothing
+
+    -- create a DB using v0 by setting glean.schema_id
+    let set kickOff = kickOff {
+          kickOff_properties = HashMap.insert "glean.schema_id" "v0"
+            (kickOff_properties kickOff) }
+    repo2 <- mkRepo schema_index_file_1 "2" set $ \env repo -> do
+      void $ syncWriteJsonBatch env repo v0_facts Nothing
+
+    -- query repo0 with index 1, explicitly ask for schema v0
+    testQuery "multi 0a" repo0 schema_index_file_1 (Just "v0")
+      "z.R _" (Just 1)
+    testQuery "multi 0b" repo0 schema_index_file_1 (Just "v0")
+      "x.P _" (Just 1)
+    testQuery "multi 0c" repo0 schema_index_file_1 (Just "v0")
+      "derived.D _" (Just 1)
+    -- only takes into account evolutions in the schema used plus
+    -- the schema stored in the db. Given none of the two have
+    -- evolutions for evolved.3, this should return no results.
+    testQuery "multi 0d" repo0 schema_index_file_1 (Just "v0")
+      "evolved.P.3 _" (Just 0)
+
+    -- query repo0 with index 1, explicitly ask for schema v1
+    testQuery "multi 2a" repo0 schema_index_file_1 (Just "v1") "z.R _" Nothing
+      -- we can't see z.R now
+    testQuery "multi 2b" repo0 schema_index_file_1 (Just "v1") "x.P _" (Just 1)
+      -- we can see x.P, but we'll get the new version
+    testQuery "multi 2c" repo0 schema_index_file_1 (Just "v1")
+      "y.Q { p = { b = 0 }}" (Just 1)
+      -- this should give us 1 fact, because we're matching on b's default
+    testQuery "multi 2d" repo0 schema_index_file_1 (Just "v1")
+      "derived.D _" (Just 0)
+    -- the evolution in v1 should be taken into account.
+    testQuery "multi 2e" repo0 schema_index_file_1 (Just "v1")
+      "evolved.P.3 _" (Just 1)
+
+    -- query repo1 with index 1, explicitly ask for schema v0
+    testQuery "multi 3a" repo1 schema_index_file_1 (Just "v0") "x.P _" (Just 1)
+    testQuery "multi 3b" repo1 schema_index_file_1 (Just "v0") "y.Q _" (Just 1)
+    testQuery "multi 3c" repo1 schema_index_file_1 (Just "v0")
+      "y.Q { p = { b = 0 }}" Nothing
+    testQuery "multi 3d" repo1 schema_index_file_1 (Just "v0")
+      "derived.D _" (Just 1)
+      -- this should be a type error, P doesn't have the b field
+    -- check that the results gets transformed according to the schema_id.
+    testQueryFacts "multi 3d" repo1 schema_index_file_1 (Just "v0") "x.P _"
+      (RecordTy [FieldDef "a" StringTy])
+      [RTS.Tuple [RTS.String "xyz"]]
+    -- the evolution in v1 should be taken into account.
+    testQuery "multi 3e" repo1 schema_index_file_1 (Just "v0")
+      "evolved.P.3 _" (Just 1)
+
+    -- query repo1 with index 1, don't ask for v0
+    testQuery "multi 4a" repo1 schema_index_file_1 Nothing "x.P _" (Just 1)
+    testQuery "multi 4b" repo1 schema_index_file_1 Nothing "y.Q _" (Just 1)
+    testQuery "multi 4c" repo1 schema_index_file_1 Nothing
+      "y.Q { p = { b = 3 }}" (Just 1)
+    testQuery "multi 4d" repo1 schema_index_file_1 Nothing
+      "derived.D _" (Just 1)
+    testQueryFacts "multi 4e" repo1 schema_index_file_1 Nothing "x.P _"
+      (RecordTy [FieldDef "a" StringTy, FieldDef "b" NatTy ])
+      [RTS.Tuple [RTS.String "xyz", RTS.Nat 3]]
+
+    -- query repo1 with index 1, explicitly ask for schema v1
+    testQuery "multi 5a" repo1 schema_index_file_1 (Just "v1") "x.P _" (Just 1)
+    testQuery "multi 5b" repo1 schema_index_file_1 (Just "v1") "y.Q _" (Just 1)
+    testQuery "multi 5c" repo1 schema_index_file_1 (Just "v1")
+      "y.Q { p = { b = 3 }}" (Just 1)
+    testQuery "multi 5d" repo1 schema_index_file_1 (Just "v1")
+      "derived.D _" (Just 1)
+    testQueryFacts "multi 4e" repo1 schema_index_file_1 (Just "v1") "x.P _"
+      (RecordTy [FieldDef "a" StringTy, FieldDef "b" NatTy ])
+      [RTS.Tuple [RTS.String "xyz", RTS.Nat 3]]
+
+    -- if we downgraded the schema, so the repo has a later version
+    -- than the global schema, these queries should still work
+    testQuery "multi 6a" repo1 schema_index_file_0 Nothing "x.P _" (Just 1)
+    testQuery "multi 6b" repo1 schema_index_file_0 Nothing "y.Q _" (Just 1)
+    testQuery "multi 6c" repo1 schema_index_file_0 Nothing
+      "y.Q { p = { b = 3 }}" Nothing
+    testQuery "multi 6d" repo1 schema_index_file_0 Nothing
+      "derived.D _" (Just 1)
+
+    -- asking for a schema that doesn't exist, we will default to the
+    -- latest global schema if config_strict_query_schema_id = False
+    testQuerySet "multi 7a" [disableStrictSchemaId] repo1 schema_index_file_0
+      (Just "na") "x.P _" (Just 1)
+    testQuerySet "multi 7b" [disableStrictSchemaId] repo1 schema_index_file_0
+      (Just "na") "y.Q _" (Just 1)
+    testQuerySet "multi 7c" [disableStrictSchemaId] repo1 schema_index_file_0
+      (Just "na") "y.Q { p = { b = 3 }}" Nothing
+    testQuerySet "multi 7d" [disableStrictSchemaId] repo1 schema_index_file_0
+      (Just "na") "derived.D _" (Just 1)
+
+    -- with config_strict_query_schema_id = True, should fail
+    when (config_strict_query_schema_id def) $
+      testEnv schema_index_file_0 (Just "na") [] $ \env -> do
+        r <- try $ angleQuery env repo1 "some query"
+        assertBool "multi 7e" $ case r of
+          Left UnknownSchemaId{} -> True
+          _ -> False
+
+    -- Test that glean.schema_id works. repo2 should be using schema v0
+    testQuery "multi 8a" repo2 schema_index_file_1 (Just "v0")
+      "z.R _" (Just 1)
+    testQuery "multi 8b" repo2 schema_index_file_1 (Just "v0")
+      "x.P _" (Just 1)
+    testQuery "multi 8c" repo2 schema_index_file_1 (Just "v0")
+      "derived.D _" (Just 1)
+
+    -- create a stacked DB on top of v0
+    let
+      stacked (Thrift.Repo name hash) =
+        Thrift.Dependencies_stacked $ Thrift.Stacked name hash Nothing
+      set kickOff = kickOff {
+          kickOff_dependencies = Just (stacked repo0) }
+    repo3 <- mkRepo schema_index_file_1 "3" set $ \env repo -> do
+      void $ syncWriteJsonBatch env repo v0_facts Nothing
+
+    testQuery "multi 9a" repo3 schema_index_file_1 Nothing "x.P _" (Just 1)
+
+validateSchemaChanges :: Test
+validateSchemaChanges =
+    let
+      schema_v0 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+            predicate Q : { a: string | b: nat }
+            predicate R : { a : string } A where P { a = A }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v1 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string, b : { c: nat, d: bool } }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v2 =
+        [s|
+          schema x.1 {
+            predicate R : string
+            predicate P : { a: string, b : R }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v3 =
+        [s|
+          schema x.1 {
+            predicate Q : { a: string | b: nat | c: [nat] }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v4 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v5 =
+        [s|
+          schema x.1 {
+            type T = string
+            predicate P : { a: T }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v6 =
+        [s|
+          schema x.1 {
+            predicate P : { a: bool }
+            predicate Q : { a: string | b: nat }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v7 =
+        [s|
+          schema x.1 {
+            predicate P : { a: bool }
+          }
+
+          schema y.1 {
+            import x.1
+            predicate Q : { a: x.P }
+          }
+
+          schema all.1 : x.1, y.1 {}
+        |]
+
+      schema_v8 =
+        [s|
+          schema x.1 {
+            predicate P : { a: bool }
+          }
+
+          schema x.2 {
+            predicate P : { a: bool, b: bool }
+          }
+
+          schema x.2 evolves x.1
+
+          schema y.1 {
+            import x.2
+            predicate Q : { a: x.P }
+          }
+
+          schema all.1 : x.1, x.2, y.1 {}
+        |]
+
+      schema_v9 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+            predicate Q : { a: string | b: nat }
+            predicate R : { a : nat } A where Q { b = A }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v10 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+            predicate Q : { a: string | b: nat }
+            predicate R : { a : nat } stored A where Q { b = A }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      validate
+        :: String
+        -> String
+        -> String
+        -> (Either SomeException () -> Bool)
+        -> Test
+      validate lbl a b p = TestLabel lbl $ TestCase $ do
+        withSystemTempDirectory "glean-dbtest" $ \root -> do
+          let fileA = "schemaA"
+              fileB = "schemaB"
+          writeFile (root </> fileA) a
+          writeFile (root </> fileB) b
+          withIndex root fileA fileB $ \index_file -> do
+            schema <- parseSchemaIndex index_file
+            r <- try $ validateNewSchemaInstance schema
+            print r
+            assertBool "validate" $ p (r :: Either SomeException ())
+
+      validateOK lbl a b = TestList
+        [ validate (lbl <> " (forwards)") a b isRight
+        , validate (lbl <> " (backwards)") b a isRight
+        ]
+      validateFAIL lbl a b = TestList
+        [ validate (lbl <> " (forwards)") a b isLeft
+        , validate (lbl <> " (backwards)") b a isLeft
+        ]
+    in
+    TestList
+      [ validateOK "adding a defaultable field" schema_v0 schema_v1
+      , validateFAIL "adding a non-defaultable field" schema_v0 schema_v2
+      , validateOK "adding an alternative" schema_v0 schema_v3
+      , validateOK "adding a predicate" schema_v0 schema_v4
+      , validateOK "adding a type synonym" schema_v0 schema_v5
+      , validateFAIL "changing the type of a field of a stored predicate"
+          schema_v0 schema_v6
+      , validateOK "changing the type of a field of a derived predicate"
+          schema_v0 schema_v9
+      , validateOK "stored and derived predicates don't conflict between versions"
+          schema_v0 schema_v10
+      -- this tests only going from schema_v7 to schema_v8 because the
+      -- evolves relationship doesn't exist the other way around.
+      , validate "change evolved field" schema_v8 schema_v7 isRight
+      ]
+
+withIndex :: FilePath -> String -> String -> (FilePath -> IO b) -> IO b
+withIndex root a b f = do
+  saveJSON schema_index_file schema_index
+  f schema_index_file
+  where
+  schema_index_file = root </> "schema_index_" <> a <> b
+  schema_index = Internal.SchemaIndex
+    { schemaIndex_current = Internal.SchemaInstance
+      { schemaInstance_versions = Map.fromList [ ("v1", 1) ]
+      , schemaInstance_file = Text.pack a
+      }
+    , schemaIndex_older = [
+        Internal.SchemaInstance
+          { schemaInstance_versions = Map.fromList [ ("v0", 1) ]
+          , schemaInstance_file = Text.pack b
+          }
+    ]
+    }
+
+schemaMismatch :: Test
+schemaMismatch = TestCase $
+    let
+      schema_v0 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+
+      schema_v1 =
+        [s|
+          schema x.1 {
+            predicate P : { a: string, b : nat }
+          }
+
+          schema all.1 : x.1 {}
+        |]
+    in
+    withSystemTempDirectory "glean-dbtest" $ \root -> do
+
+      let dbRoot = root </> "db"
+      createDirectory dbRoot
+
+      let file0 = "schema0"
+          file1 = "schema1"
+      writeFile (root </> file0) schema_v0
+      writeFile (root </> file1) schema_v1
+
+      withIndex root file0 file1 $ \index_file -> do
+        withTestEnv [
+          setRoot dbRoot,
+          setSchemaIndex index_file ] $ \env -> do
+        let repo = Repo "test" "0"
+        kickOffTestDB env repo id
+        let
+          facts =
+            [ mkBatch (PredicateRef "x.P" 1)
+                [ [s| { "key" : { "a" : "abc" }} |] ]
+            ]
+        -- don't use syncWriteJsonBatch, it doesn't check the schema ID
+        r <- try $ sendJsonBatch env repo facts (Just def {
+          sendJsonBatchOptions_schema_id = Just (SchemaId "v0") })
+        assertBool "schema mismatch" $ case r of
+          Left (e :: SomeException) ->
+            "does not match schema ID" `isInfixOf` show e
+          _ -> False
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [
+    TestLabel "multiSchemaTest" multiSchemaTest,
+    TestLabel "validateSchemaChanges" validateSchemaChanges,
+    TestLabel "schemaMismatch" schemaMismatch
+  ]
diff --git a/glean/test/tests/TestShard.hs b/glean/test/tests/TestShard.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/TestShard.hs
@@ -0,0 +1,24 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module TestShard (main) where
+
+import Test.HUnit
+
+import TestRunner
+
+import Glean.Backend.Types
+import Glean.Types
+
+main :: IO ()
+main = testRunner $ TestList
+  [ TestLabel "testShard" $ TestCase $
+      assertEqual "shard"
+        (dbShard (Repo "test" "1234"))
+        "6825422262439797754"
+  ]
diff --git a/glean/test/tests/TimeoutTest.hs b/glean/test/tests/TimeoutTest.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/tests/TimeoutTest.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE QuasiQuotes #-}
+module TimeoutTest (main) where
+
+import Test.HUnit
+
+import TestRunner
+import Util.String.Quasi
+
+import Glean.Init
+import Glean.Query.Thrift
+import qualified Glean.Schema.GleanTest.Types as Glean.Test
+
+import BenchDB
+
+timeoutTest :: Test
+timeoutTest = TestCase $ withBenchDB 10000 $ \env repo -> do
+  -- The test spends most of its time building the DB (withBenchDB above),
+  -- so to keep things reasonable in debug mode we limit the number of
+  -- facts to 10K and set the time limit to 1ms which is as low as we
+  -- can go. This query hits the time budget ~25 times on my devserver
+  -- (smarlow 2020-04-14).
+  r <- runQuery_ env repo $ limitTime 1 $ angle
+    [s| glean.test.Predicate { string_ = "x1" } |]
+  assertEqual "angle - timeout Test" 1 (length (r :: [Glean.Test.Predicate]))
+
+main :: IO ()
+main = withUnitTest $ testRunner $ TestList
+  [ TestLabel "timeout" timeoutTest
+  ]
diff --git a/glean/test/unit/Glean/Test/HUnit.hs b/glean/test/unit/Glean/Test/HUnit.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/unit/Glean/Test/HUnit.hs
@@ -0,0 +1,42 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# OPTIONS_GHC -Wno-orphans #-}
+module Glean.Test.HUnit
+  ( assertThrows
+  , assertThrowsType
+  ) where
+
+import Util.STM
+import Control.Exception hiding(assert)
+import Data.Proxy
+import GHC.Stack (HasCallStack)
+import Test.HUnit
+
+instance Assertable t => Assertable (STM t) where
+  assert = assert . atomically
+
+assertThrows
+  :: (HasCallStack, Eq e, Exception e) => String -> e -> IO a -> Assertion
+assertThrows s e action = do
+  r <- try action
+  case r of
+    Left exc -> assertEqual s exc e
+    Right _ -> assertFailure s
+
+assertThrowsType
+  :: forall e a. (HasCallStack, Exception e)
+  => String
+  -> Proxy e
+  -> IO a
+  -> Assertion
+assertThrowsType s _ action = do
+  r <- try action
+  case r of
+    Left (_ :: e) -> return ()
+    Right _ -> assertFailure s
diff --git a/glean/test/unit/Glean/Test/Mock.hs b/glean/test/unit/Glean/Test/Mock.hs
new file mode 100644
--- /dev/null
+++ b/glean/test/unit/Glean/Test/Mock.hs
@@ -0,0 +1,98 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Test.Mock
+  ( IOBased(..)
+  , Mock
+  , mock
+  , implement
+  , call
+  , augment
+  , reimplement
+  , prepare
+  , doBefore
+  , doFinally
+  , unexpectedCall
+  ) where
+
+import Control.Exception (finally)
+import Control.Monad (join)
+import Data.IORef
+
+-- | Things of type a1 -> ... -> an -> IO b
+class IOBased a where
+  -- | Constant action
+  constIO :: (forall b. IO b) -> a
+
+  -- | Transform the `IO` action
+  mapIO :: (forall b. IO b -> IO b) -> a -> a
+
+  -- | Push an outer `IO` into the `IO` action
+  joinIO :: IO a -> a
+
+instance IOBased (IO a) where
+  constIO io = io
+  mapIO f = f
+  joinIO = join
+
+instance IOBased b => IOBased (a -> b) where
+  constIO io _ = constIO io
+  mapIO f g x = mapIO f (g x)
+  joinIO io x = joinIO $ ($ x) <$> io
+
+-- | Execute an `IO` before the action
+doBefore :: IOBased a => IO () -> a -> a
+doBefore p = mapIO (p >>)
+
+-- | Execute an `IO` after the action
+doFinally :: IOBased a => IO () -> a -> a
+doFinally p = mapIO (`finally` p)
+
+infixr 5 :>
+data Stream a = a :> Stream a
+
+instance Functor Stream where
+  fmap f (x :> xs) = f x :> fmap f xs
+
+instance Applicative Stream where
+  pure x = let xs = x :> xs in xs
+  (f :> fs) <*> (x :> xs) = f x :> (fs <*> xs)
+
+prepend :: [a] -> Stream a -> Stream a
+prepend xs s = foldr (:>) s xs
+
+-- | A mocked action.
+newtype Mock a = Mock (IORef (Stream a))
+
+-- | Produce an "unexpected call" error
+unexpectedCall :: IOBased a => String -> a
+unexpectedCall name = constIO $ fail $ "unexpected call to '" ++ name ++ "'"
+
+-- | Mock an `IOBased` action. All calls will produce "unexpected call" errors.
+mock :: IOBased a => String -> IO (Mock a)
+mock name = implement name $ unexpectedCall name
+
+-- | Produce a 'Mock' based on an implementation of the operation. The name is
+-- currently ignored but will be useful later.
+implement :: String -> a -> IO (Mock a)
+implement _name x = Mock <$> newIORef (pure x)
+
+-- | Call a mocked 'IOBased' action.
+call :: IOBased a => Mock a -> a
+call (Mock ref) = joinIO $ atomicModifyIORef ref $ \(x :> xs) -> (xs, x)
+
+augment :: Mock a -> (a -> a) -> IO ()
+augment (Mock ref) f = atomicModifyIORef ref $ \xs -> (f <$> xs, ())
+
+reimplement :: Mock a -> a -> IO ()
+reimplement m = augment m . const
+
+-- | Transform the next calls to the 'Mock'.
+prepare :: Mock a -> [a -> a] -> IO ()
+prepare (Mock ref) fs = atomicModifyIORef ref $ \xs ->
+  (prepend fs (pure id) <*> xs, ())
diff --git a/glean/tools/disassemble/Disassemble.hs b/glean/tools/disassemble/Disassemble.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/disassemble/Disassemble.hs
@@ -0,0 +1,90 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module Disassemble(main) where
+
+import Control.Monad
+import Data.Default
+import Data.List (sortOn)
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import Options.Applicative
+import System.Exit (die)
+
+import Util.OptParse
+
+import Glean.Database.Config (
+  schemaLocationOption, schemaLocationToSource, SchemaLocation)
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.Impl.ConfigProvider
+import Glean.RTS.Bytecode.Disassemble (disassemble)
+import Glean.Types (PredicateRef(..))
+import Glean.Schema.Util (parseRef)
+import Glean.Util.ConfigProvider
+import qualified Glean.Util.ThriftSource as ThriftSource
+import Glean.Bytecode.SysCalls (typecheckSysCalls)
+
+data Config = Config
+  { cfgSchemaLocation :: SchemaLocation
+  , cfgCommand :: Command
+  }
+
+newtype Command
+  = PTC [Text]
+
+options :: ParserInfo Config
+options = info (parser <**> helper)
+  (fullDesc <> progDesc "Disassemble bytecode")
+  where
+    parser :: Parser Config
+    parser = do
+      cfgSchemaLocation <- schemaLocationOption
+      cfgCommand <- typecheckerCmd
+      return Config{..}
+
+    typecheckerCmd =
+      commandParser "ptc" (progDesc "Disassemble predicate typecheckers")
+        $ fmap (PTC . map Text.pack)
+        $ many
+        $ strArgument
+          (  metavar "PREDICATE"
+          <> help "Predicate reference"
+          )
+
+main :: IO ()
+main =
+  withConfigOptions options $ \(Config{..}, cfg) ->
+  withConfigProvider cfg $ \(cfgAPI :: ConfigAPI) -> do
+
+  schemas <- ThriftSource.load cfgAPI (schemaLocationToSource cfgSchemaLocation)
+  db_schema <- newDbSchema Nothing schemas LatestSchema readWriteContent def
+
+  case cfgCommand of
+    PTC args -> predicateTypecheckers db_schema args
+
+predicateTypecheckers :: DbSchema -> [Text] -> IO ()
+predicateTypecheckers schema args = do
+  preds <- case args of
+    [] -> return $ schemaPredicates schema
+    refs -> forM refs $ \ref -> do
+      let sourceRef = parseRef ref
+      either (die . Text.unpack) return
+        $ lookupPredicateSourceRef sourceRef LatestSchema schema
+  forM_ (sortOn predicateRef preds) $ \d@PredicateDetails{..} -> do
+    let PredicateRef{..} = predicateRef d
+    mapM_ Text.putStrLn $ disassemble
+      ("ptc_"
+        <> predicateRef_name
+        <> "."
+        <> Text.pack (show $ predicateRef_version))
+      typecheckSysCalls
+      predicateTypecheck
+    putStrLn ""
diff --git a/glean/tools/gleancli/GleanCLI.hs b/glean/tools/gleancli/GleanCLI.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI.hs
@@ -0,0 +1,676 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, ApplicativeDo, TypeApplications, AllowAmbiguousTypes #-}
+
+module GleanCLI (main) where
+
+import Control.Exception
+import Control.Monad
+import qualified Data.Bifunctor
+import qualified Data.ByteString as B
+import Data.Char (isSpace)
+import Data.Default
+import Data.Either
+import Data.Foldable
+import qualified Data.HashMap.Strict as HashMap
+import Data.List.Split
+import qualified Data.Map.Strict as Map
+import Data.Proxy
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Options.Applicative
+import Options.Applicative.Help (vcat)
+import System.IO
+import System.FilePath.Glob as Glob
+
+import Util.EventBase
+import Util.IO
+import Util.OptParse
+import Util.Timing (timeIt, showTime, showAllocs)
+import System.Exit (exitWith, ExitCode(..))
+
+import qualified Glean
+import Glean.Init
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Database.Config (cfgServerConfig)
+import qualified Glean.Database.Config as GleanDB
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import qualified Glean.Database.Finish as Database
+import qualified Glean.RTS.Foreign.Inventory as Inventory
+import qualified Glean.ServerConfig.Types as Server
+import Glean.Types as Thrift hiding (ValidateSchema)
+import qualified Glean.Types as Thrift
+import Glean.Impl.ConfigProvider
+import Glean.Util.ConfigProvider
+import Glean.Util.ShellPrint
+import Glean.Shell
+
+import GleanCLI.Backup
+import GleanCLI.Common
+import GleanCLI.Complete
+import GleanCLI.Derive
+import GleanCLI.Index
+import GleanCLI.Merge
+import GleanCLI.Restore
+import GleanCLI.Query
+import GleanCLI.Types
+import GleanCLI.Utils
+import GleanCLI.Write
+
+#if GLEAN_FACEBOOK
+import GleanCLI.Facebook
+import qualified Glean.Database.Backup.Manifold as Manifold
+import qualified Glean.Database.Backup.XDBCatalog as XDB
+#endif
+
+data Config = Config
+  { cfgService :: Glean.Service
+  , cfgCommand :: PluginCommand
+  }
+
+data PluginType where
+  PluginType :: forall c . Plugin c => Proxy c -> PluginType
+
+plugin :: forall c . Plugin c => PluginType
+plugin = PluginType (Proxy @c)
+
+data PluginCommand where
+  PluginCommand :: forall c . Plugin c => c -> PluginCommand
+
+plugins :: [PluginType]
+plugins =
+  [ plugin @WriteCommand
+  , plugin @FinishCommand
+  , plugin @UnfinishCommand
+  , plugin @ListCommand
+  , plugin @LatestDbCommand
+  , plugin @StatusCommand
+  , plugin @DumpCommand
+  , plugin @DeleteCommand
+  , plugin @DeriveCommand
+  , plugin @QueryCommand
+  , plugin @BackupCommand
+  , plugin @RestoreCommand
+  , plugin @ValidateCommand
+  , plugin @ValidateSchemaCommand
+  , plugin @StatsCommand
+  , plugin @PropertiesCommand
+  , plugin @SetPropertyCommand
+  , plugin @WriteSerializedInventoryCommand
+  , plugin @ShellCommand
+  , plugin @CompleteCommand
+  , plugin @IndexCommand
+  , plugin @ScriptCommand
+  , plugin @MergeCommand
+#if GLEAN_FACEBOOK
+  , plugin @FacebookPlugin
+#endif
+  ]
+
+options :: ParserInfo (Config, ConfigOptions ConfigAPI)
+options = info (((,) <$> parser <*> configOptions) <**> helper <**> helpAll)
+  (fullDesc <> progDesc "Create, manipulate and query Glean databases")
+  where
+#if MIN_VERSION_optparse_applicative(0,16,0)
+    parseError = ShowHelpText Nothing
+#else
+    parseError = ShowHelpText
+#endif
+
+    helpAll :: Parser (a -> a)
+    helpAll = abortOption parseError $ mconcat
+      [ long "help-all"
+      , help "Show all possible options."
+      , hidden
+      ]
+
+    parser :: Parser Config
+    parser = do
+      cfgService <- Glean.options
+      cfgCommand <- asum
+        [ PluginCommand <$> parseCommand @c
+        | PluginType (Proxy :: Proxy c) <- plugins
+        ]
+      return Config{..}
+
+
+main :: IO ()
+main =
+  let
+    spec =
+      setTransformGflags tr $
+      setPrefs subparserInline $
+      setFromFilePrefix '@' $
+      parserInfo options
+
+    tr (opts, _) = case cfgCommand opts of
+      PluginCommand c -> argTransform c
+  in
+  withOptionsGen spec $ \(Config{..}, cfgOpts) ->
+  withEventBaseDataplane $ \evb ->
+  withConfigProvider cfgOpts $ \cfgAPI ->
+  case cfgCommand of
+    PluginCommand c ->
+      withService evb cfgAPI
+        (liftServerConfig (serverConfigTransform c) $
+          withRemoteBackups evb cfgService)
+        c
+
+withRemoteBackups :: EventBaseDataplane -> Glean.Service -> Glean.Service
+withRemoteBackups _evb = liftConfig
+#if GLEAN_FACEBOOK
+  (XDB.withXdbCatalog "manifold" . Manifold.withManifoldBackups _evb)
+#else
+  id
+#endif
+
+liftConfig
+  :: (GleanDB.Config -> GleanDB.Config)
+  -> Glean.Service -> Glean.Service
+liftConfig f (Glean.Local cfg log) = Glean.Local (f cfg) log
+liftConfig _ other@Glean.Remote{} = other
+
+liftServerConfig
+  :: (Server.Config -> Server.Config)
+  -> Glean.Service -> Glean.Service
+liftServerConfig f =
+  liftConfig $ \cfg -> cfg{cfgServerConfig = f <$> cfgServerConfig cfg}
+
+-- -----------------------------------------------------------------------------
+-- Commands
+
+-- A few small commands that don't deserve their own modules.
+
+data ScriptCommand
+  = Script
+      { scriptInput :: String
+      , scriptTime :: Maybe String
+      , scriptVerbose :: Bool
+      }
+
+instance Plugin ScriptCommand where
+  parseCommand =
+    commandParser "script"
+      (progDesc "Execute multiple commands"
+      <> footerDoc (Just $ vcat
+          [ "Example: glean --db-memory script <<EOF"
+          , "create --db foo/1"
+          , "write --db foo/1 --finish /some/batch"
+          , "query --db foo/1 \"src.File _\""
+          , "EOF"
+          ]))
+      $ do
+          scriptVerbose <- switch (
+            short 'v' <>
+            long "verbose" <>
+            help "Print executed commands"
+            )
+          scriptTime <- optional $ strOption (
+            short 't' <>
+            long "time" <>
+            metavar "FILE" <>
+            help "Print duration of individual commands (- means stdout)"
+            )
+          scriptInput <- strArgument (
+            metavar "FILE" <>
+            help ("File containing commands to execute (- means read from "
+            <> "stdin). Commands are specified just like they would be on the "
+            <> "command line. Commands can span multiple lines. A non-indented "
+            <> "line starts a new command which spans all subsequent indented "
+            <> "lines. Multiple words can be grouped into one argument by "
+            <> " quoting (\"...\"). Lines which start with # are ignored.")
+            )
+          return Script{..}
+
+  runCommand evb cfg backend Script{..} = do
+    args <- split [] [] <$> case scriptInput of
+      "-" -> getContents
+      file -> readFile file
+    cmds <- forM args $ handleParseResult . execParserPure
+      (prefs subparserInline)
+      (info
+        (asum
+        [ PluginCommand <$> parseCommand @c
+        | PluginType (Proxy :: Proxy c) <- plugins
+        ])
+        mempty)
+    let withTimeFile f = case scriptTime of
+          Nothing -> f $ const $ return ()
+          Just "-" -> f $ \s -> putStrLn s >> hFlush stdout
+          Just path -> withFile path WriteMode $ f . hPutStrLn
+    withTimeFile $ \time ->
+      forM_ (zip3 [1..] (map head args) cmds) $
+        \(i, name, PluginCommand cmd) -> do
+          when scriptVerbose $
+            putStrLn $ "Step " <> show (i::Int) <> ": " <> name
+          (t,b,_) <- timeIt $ runCommand evb cfg backend cmd
+          time $ unwords [show (i::Int), name, showTime t, showAllocs b]
+    where
+      split ws cs "" = filter (not . null) $ reverse $ reverse ws : cs
+      split ws cs ('#':s) = split ws cs $ dropWhile (/= '\n') s
+      split ws cs ('\n':x:s)
+        | isSpace x = split ws cs s
+        | otherwise = split [] (reverse ws : cs) (x:s)
+      split ws cs ('\\':x:s)
+        | isSpace x = split ws cs s
+      split ws cs (x:s)
+        | isSpace x = split ws cs s
+      split ws cs s = case word "" s of (w,t) -> split (w:ws) cs t
+
+      word w "" = (reverse w, "")
+      word w ('"':s) = string w s
+      word w ('\\':c:s)
+        | isSpace c = (reverse w, '\\':c:s)
+        | otherwise = word (c:w) s
+      word w (c:s)
+        | isSpace c = (reverse w, c:s)
+        | otherwise = word (c:w) s
+
+      string w "" = (reverse w, "")
+      string w ('"':s) = word w s
+      string w ('\\':c:s) = string (c:w) s
+      string w (c:s) = string (c:w) s
+
+data UnfinishCommand
+  = Unfinish
+      { repo :: Repo
+      , handle :: Text
+      }
+
+instance Plugin UnfinishCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "unfinish"
+      (progDesc $ "Unfinish a local database "<>
+        "(turn it from complete to incomplete state)")
+      $ do
+      repo <- dbOpts
+      handle <- handleOpt
+      return Unfinish{..}
+
+  runCommand _ _ backend Unfinish{..} = do
+    case Glean.backendKind backend of
+      Glean.BackendEnv env -> do
+        Database.unfinishDatabase env repo
+      _ -> die 5 "It is NOT possible to unfinish a remote database"
+
+data ListCommand
+  = List
+      { listDbNames :: [String]
+      , listFormat :: Maybe ShellPrintFormat
+      , listVerbosity :: DbVerbosity
+      , listIncludeBackups :: Bool
+      }
+
+instance Plugin ListCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "list"
+      (progDesc "List databases")
+      $ do
+      listDbNames <- many $ strArgument (
+        metavar "GLOB" <>
+        help ("specifies which DBs to list. Globs may be used, " <>
+          "for example mydb-* would match mydb-cxx and mydb-py")
+        )
+      listFormat <- shellFormatOpt
+      listVerbosity <- flag DbSummarise DbDescribe (
+        short 'v' <>
+        long "verbose" <>
+        help "include more details in tty/plain formats"
+        )
+      listIncludeBackups <- switch (
+        long "include-backups" <>
+        help "also list DBs in backup storage")
+      return List{..}
+
+  runCommand _ _ backend List{..} = do
+    r <- Glean.listDatabases backend def {
+      listDatabases_includeBackups = listIncludeBackups }
+    let
+      repoFilter db str =
+        Glob.match glob dbid ||
+        Glob.match glob dbname ||
+        Glob.match glob (dbname <> "/")
+        where
+          glob = Glob.compileWith Glob.compPosix str
+          repo = Thrift.database_repo db
+          dbname = Text.unpack (Thrift.repo_name repo)
+          dbid = Glean.showRepo repo
+
+      dbs = filter f (Thrift.listDatabasesResult_databases r)
+      f db = null listDbNames || any (repoFilter db) listDbNames
+    putShellPrintLn listFormat $ dbs `withFormatOpts` listVerbosity
+
+newtype LatestDbCommand
+  = LatestDb { dbName :: String }
+
+instance Plugin LatestDbCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "db-latest"
+      (progDesc "Return latest DBNAME instance available")
+      $ do
+      dbName <- strArgument (metavar "DBNAME")
+      return LatestDb{..}
+
+  runCommand _ _ backend LatestDb{..} = do
+    repoHash <- Thrift.repo_hash
+      <$> Glean.getLatestRepo backend (Text.pack dbName)
+    putStrLn $ Text.unpack repoHash
+
+data StatusCommand
+  = Status
+      { statusRepo :: Repo
+      , statusFormat :: Maybe ShellPrintFormat
+      , statusSetExitCode :: Bool
+      }
+
+instance Plugin StatusCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "status"
+      (progDesc "Get the status of a db")
+      $ do
+      statusRepo <- dbOpts
+      statusFormat <- shellFormatOpt
+      statusSetExitCode <- switch
+        (  short 'e'
+        <> help "Set an error status code if the db is not complete"
+        )
+      return Status{..}
+
+  runCommand _ _ backend Status{..} = do
+    db <-
+      Thrift.getDatabaseResult_database <$>
+        Glean.getDatabase backend statusRepo
+    putShellPrintLn statusFormat $ db `withFormatOpts` DbSummarise
+    when statusSetExitCode $ case exitCode db of
+      ExitFailure code -> exitWith $ ExitFailure code
+      _ -> return ()
+    where
+    exitCode db = case Thrift.database_status db of
+      Thrift.DatabaseStatus_Complete -> ExitSuccess
+      Thrift.DatabaseStatus_Available -> ExitFailure 107
+      Thrift.DatabaseStatus_Incomplete -> ExitFailure 101
+      Thrift.DatabaseStatus_Restoring -> ExitFailure 102
+      Thrift.DatabaseStatus_Broken -> ExitFailure 103
+      Thrift.DatabaseStatus_Restorable -> ExitFailure 104
+      Thrift.DatabaseStatus_Finalizing -> ExitFailure 105
+      Thrift.DatabaseStatus_Missing -> ExitFailure 106
+
+data PropertiesCommand
+  = Properties
+      { propertiesRepo :: Repo
+      , propertiesFormat :: Maybe ShellPrintFormat
+      }
+
+instance Plugin PropertiesCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "properties"
+      (progDesc "Get the properties of a db")
+      $ do
+      propertiesRepo <- dbOpts
+      propertiesFormat <- shellFormatOpt
+      return Properties{..}
+
+  runCommand _ _ backend Properties{..} = do
+    db <-
+      Thrift.getDatabaseResult_database <$>
+        Glean.getDatabase backend propertiesRepo
+    putShellPrintLn propertiesFormat $ Thrift.database_properties db
+
+data DumpCommand
+  = Dump
+      { dumpRepo :: Repo
+      , dumpFile :: FilePath
+      }
+
+instance Plugin DumpCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "dump"
+      (progDesc "Dump the contents of the specified database into a file")
+      $ do
+      dumpRepo <- dbOpts
+      dumpFile <- strArgument
+        (  metavar "FILE"
+        <> help "Destination file path"
+        )
+      return Dump{..}
+
+  runCommand _ _ backend Dump{..} =
+    Glean.dumpJsonToFile backend dumpRepo dumpFile
+
+newtype DeleteCommand
+  = Delete
+      { deleteRepo :: Repo
+      }
+
+instance Plugin DeleteCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "delete" (progDesc "Delete a database") $ do
+      Delete <$> dbOpts
+
+  runCommand _ _ backend Delete{..} =
+    void $ Glean.deleteDatabase backend deleteRepo
+
+
+data ValidateCommand
+  = Validate
+      { validateRepo :: Repo
+      , validate :: Glean.Validate
+      }
+
+instance Plugin ValidateCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "validate" (progDesc "Validate a local database") $ do
+      repo <- dbOpts
+      no_typecheck <- switch
+        (  long "no-typecheck"
+        <> help "don't typecheck facts"
+        )
+      no_keys <- switch
+        (  long "no-keys"
+        <> help "don't verify key uniqueness"
+        )
+      limit <- optional $ option auto
+        (  long "limit"
+        <> metavar "N"
+        <> help "only validate the first N facts"
+        )
+      return Validate
+        { validateRepo = repo
+        , validate = def
+            { Glean.validateTypecheck = not no_typecheck
+            , Glean.validateKeys = not no_keys
+            , Glean.validateLimit = limit
+            }
+        }
+
+  runCommand _ _ backend Validate{..} = case Glean.backendKind backend of
+    Glean.BackendEnv env -> Glean.validate env validateRepo validate
+    _ -> die 2 "Can't validate a remote database"
+
+newtype ValidateSchemaCommand
+  = ValidateSchema
+      { file :: FilePath
+      }
+
+instance Plugin ValidateSchemaCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "validate-schema" (progDesc "Validate a schema") $ do
+      file <- strArgument
+        ( metavar "FILE"
+        <> help "Name of schema file"
+        )
+      return (ValidateSchema file)
+
+  runCommand _ _ backend ValidateSchema{..} = do
+    str <- B.readFile file
+    Glean.validateSchema backend (Thrift.ValidateSchema str)
+      `catch` \e@Thrift.Exception{} -> do
+        hPrint stderr e
+        exitWith (ExitFailure 55)
+
+data StatsCommand
+  = Stats
+      { statsRepo :: Repo
+      , perPredicate :: Bool
+      , excludeBase :: Bool
+      , statsPredicates :: [Text]
+      , statsFormat :: Maybe ShellPrintFormat
+      , statsSetExitCode :: Bool
+      }
+
+instance Plugin StatsCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "stats" (progDesc "Get fact counts and sizes") $ do
+      statsRepo <- dbOpts
+      perPredicate <- switch ( long "per-predicate" )
+      excludeBase <- switch ( long "exclude-base" )
+      statsPredicates <- many $ strArgument (metavar "PREDICATE")
+      statsFormat <- shellFormatOpt
+      statsSetExitCode <- switch
+        (  short 'e'
+        <> help
+           "Set an error status code if there are no facts for the predicate(s)"
+        )
+      return Stats{..}
+
+  runCommand _ _ backend Stats{..} = do
+    xs <- Map.toList <$>
+      Glean.predicateStats backend statsRepo
+        (if excludeBase then Glean.ExcludeBase else Glean.IncludeBase)
+    schemaInfo <- Glean.getSchemaInfo backend (Just statsRepo)
+      def { getSchemaInfo_omit_source = True }
+    let
+      matchRefsArgs = Glean.parseRef <$> statsPredicates
+      preds = map (Data.Bifunctor.first (lookupPid schemaInfo)) xs
+      filterPred :: Either Thrift.Id PredicateRef -> Bool
+      filterPred ref =
+        (perPredicate && null matchRefsArgs) -- argument given and
+        || any (refMatches ref) matchRefsArgs -- reference matches argument
+      refMatches (Right lhs) rhs = predicateMatches lhs rhs
+      refMatches (Left _) _ = False
+      statsFormatOpts = StatsFormatOpts {
+        showTotal = True,
+        sortBySize = False }
+      refIsPresent ref =
+        any ((`refMatches` ref) . fst) preds
+      matchRefsArgsNotPresent =
+        filter (not . refIsPresent) matchRefsArgs
+    putShellPrintLn statsFormat $
+      (filterPred, preds) `withFormatOpts` statsFormatOpts
+    when (not $ null matchRefsArgsNotPresent) $ do
+      forM_ matchRefsArgsNotPresent $ \ref -> do
+        hPutStrLn stderr $ Text.unpack $
+          "No facts found for: " <> Glean.showRef ref
+      when statsSetExitCode $
+        exitWith $ ExitFailure 100
+    where
+      lookupPid SchemaInfo{..} pid =
+        maybe (Left pid) Right $
+          Map.lookup pid schemaInfo_predicateIds
+      predicateMatches PredicateRef{..} Glean.SourceRef{..} =
+          predicateRef_name == sourceRefName &&
+          maybe True (== predicateRef_version) sourceRefVersion
+
+data SetPropertyCommand
+  = SetProperty
+      { setPropRepo :: Repo
+      , properties :: [Either Text (Text,Text)]
+          -- Left: remove, Right: update/add
+      }
+
+instance Plugin SetPropertyCommand where
+  parseCommand =
+    commandParser "set-property" (progDesc "") $ do
+      setPropRepo <- dbOpts
+      properties <- many $ argument readOption (metavar "NAME=VALUE or -NAME")
+      return SetProperty{..}
+    where
+    readOption = maybeReader $ \s ->
+      case s of
+        '-':name -> Just (Left (Text.pack name))
+        _ | [name, value] <- splitOn "=" s ->
+            Just (Right (Text.pack name, Text.pack value))
+          | otherwise -> Nothing
+
+  runCommand _ _ backend SetProperty{..} =
+    void $ Glean.updateProperties backend setPropRepo
+      (HashMap.fromList (rights properties)) (lefts properties)
+
+
+data WriteSerializedInventoryCommand
+  = WriteSerializedInventory
+      { writeSerializedInventoryFrom :: InventoryFrom
+      , outputFile :: FilePath
+      }
+
+data InventoryFrom
+  = FromDB Repo
+  | FromSchemaId SchemaId
+  | FromLatestSchema
+
+instance Plugin WriteSerializedInventoryCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "write-serialized-inventory" (progDesc desc) $ do
+      let schemaId = SchemaId <$> textOption (
+            long "schema-id" <>
+            metavar "SCHEMA" <>
+            help "schema ID to create the inventory for")
+      writeSerializedInventoryFrom <-
+        (FromDB <$> dbOpts) <|>
+        (FromSchemaId <$> schemaId) <|>
+        pure FromLatestSchema
+      outputFile <- strArgument (metavar "OUTPUT_FILE")
+      return WriteSerializedInventory{..}
+    where
+      desc = "Generate a schema inventory for a schema id (use --schema-id)" ++
+             " or a DB"
+
+  withService evb cfgAPI svc WriteSerializedInventory{..} = do
+    let
+      inventoryFromSchema selector = do
+        let cfg = case svc of
+              Glean.Local cfg _ -> cfg
+              Glean.Remote{} -> def
+        index <- GleanDB.loadSchemaIndex cfg cfgAPI
+        dbSchema <- newDbSchema Nothing index selector
+          readWriteContent def
+        return $ Inventory.serialize $ schemaInventory dbSchema
+
+    inventory <- case writeSerializedInventoryFrom of
+      FromDB repo ->
+        Glean.withBackendWithDefaultOptions evb cfgAPI svc Nothing $ \backend ->
+          Glean.serializeInventory backend repo
+      FromSchemaId schemaId -> inventoryFromSchema (SpecificSchemaId schemaId)
+      FromLatestSchema -> inventoryFromSchema LatestSchema
+
+    withFile outputFile WriteMode $ \hdl -> do
+      B.hPutStr hdl inventory
diff --git a/glean/tools/gleancli/GleanCLI/Backup.hs b/glean/tools/gleancli/GleanCLI/Backup.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Backup.hs
@@ -0,0 +1,56 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Backup (BackupCommand) where
+
+import Control.Monad (unless)
+import Data.Text (Text)
+import Options.Applicative
+import System.Exit hiding (die)
+
+import Util.IO
+import Util.OptParse
+
+import Glean (Repo(..))
+import qualified Glean
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Database.Backup (backupDatabase)
+
+import GleanCLI.Types
+import GleanCLI.Utils
+
+data BackupCommand
+  = Backup
+      { repo :: Repo
+      , locator :: Locator
+      }
+
+type Locator = Text
+
+instance Plugin BackupCommand where
+  parseCommand =
+    commandParser "backup" (progDesc "Backup a database") $
+      Backup <$> repo <*> locator
+    where
+      repo = argument (maybeReader Glean.parseRepo)
+        (  metavar "NAME/HASH"
+        <> help "DB to backup"
+        )
+      locator = strArgument
+        (  metavar "SITE:PREFIX"
+        <> help "where to backup to"
+        )
+
+  runCommand _ _ backend Backup{..} = case Glean.backendKind backend of
+    Glean.BackendEnv env -> do
+      ok <- backupDatabase env repo locator
+      unless ok $ exitWith (ExitFailure 1)
+    _ -> die 2 "Can't backup a remote database"
+
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
diff --git a/glean/tools/gleancli/GleanCLI/Common.hs b/glean/tools/gleancli/GleanCLI/Common.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Common.hs
@@ -0,0 +1,123 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Common
+  ( PageOptions(..)
+  , pageOpts
+  , maxConcurrencyOpt
+  , dbOpts
+  , dbSlash
+  , dbNameOpt
+  , dbInstanceOpt
+  , handleOpt
+  , FileFormat(..)
+  , fileFormatOpt
+  ) where
+
+import Data.Text (Text)
+import Options.Applicative
+
+import Util.OptParse
+
+import Glean
+import Glean.BuildInfo
+
+maxConcurrencyOpt :: Parser Int
+maxConcurrencyOpt = option auto
+  (  long "maxConcurrency"
+  <> short 'j'
+  <> metavar "NUMBER"
+  <> showDefault
+  <> value 20
+  )
+
+data PageOptions = PageOptions
+  { pageBytes :: Int
+  , pageFacts :: Maybe Int
+  }
+
+pageOpts :: Parser PageOptions
+pageOpts = do
+  pageBytes <- option auto
+    ( long "page-bytes"
+    <> value 1000000
+    <> metavar "BYTES"
+    <> help "maximum number of bytes per page"
+    )
+  pageFacts <- optional $ option auto
+    ( long "page-facts"
+    <> metavar "FACTS"
+    <> help "maximum number of facts per page"
+    )
+  return PageOptions{..}
+
+dbOpts :: Parser Repo
+dbOpts = dbSlash <|> dbNameInstance
+
+dbSlash :: Parser Repo
+dbSlash = do
+  option (maybeReader Glean.parseRepo)
+    (  long "db"
+    <> metavar "NAME/INSTANCE"
+    <> help "identifies the database"
+    )
+  <|> option (maybeReader Glean.parseRepo)
+    (internal <> long "repo")
+
+dbNameInstance :: Parser Repo
+dbNameInstance = Repo <$> dbNameOpt <*> dbInstanceOpt
+
+dbNameOpt :: Parser Text
+dbNameOpt = textOption
+    (  long "db-name"
+    <> metavar "NAME"
+    <> help "name of the database"
+    )
+    <|> textOption (internal <> long "repo-name")
+
+dbInstanceOpt :: Parser Text
+dbInstanceOpt = textOption
+    (  long "db-instance"
+    <> metavar "INSTANCE"
+    <> help "instance of the database"
+    ) <|>
+    textOption (internal <> long "repo-hash") -- backwards compat
+
+handleOpt :: Parser Text
+handleOpt = textOption
+  (  long "handle"
+  <> metavar "HANDLE"
+  <> value (buildRule <> "@" <> buildRevision)
+  )
+
+data FileFormat
+  = JsonFormat
+  | BinaryFormat
+  deriving (Eq)
+
+instance Show FileFormat where
+  show ff = case ff of
+    JsonFormat -> "json"
+    BinaryFormat -> "binary"
+
+fileFormatOpt :: FileFormat -> Parser FileFormat
+fileFormatOpt defaultFormat = option (eitherReader parseFileFormat)
+  (  long "file-format"
+  <> value defaultFormat
+  <> showDefault
+  <> metavar "(json|binary)"
+  <> help ("Format of the files with facts (see FILE for more details). "
+  <> "json also accepts zstd compressed json")
+  )
+  where
+    parseFileFormat :: String -> Either String FileFormat
+    parseFileFormat "json" = Right JsonFormat
+    parseFileFormat "binary" = Right BinaryFormat
+    parseFileFormat s = Left $ "unknown format: " <> s
+      <> ", supported values: (json|binary)"
diff --git a/glean/tools/gleancli/GleanCLI/Complete.hs b/glean/tools/gleancli/GleanCLI/Complete.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Complete.hs
@@ -0,0 +1,49 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Complete (CompleteCommand) where
+
+import Control.Monad
+import Data.Default (def)
+import Options.Applicative
+
+import Util.IO
+import Util.OptParse
+
+import GleanCLI.Common
+import GleanCLI.Types
+
+import Glean
+import qualified Glean.Types as Thrift
+
+data CompleteCommand
+  = Complete
+      { completeRepo :: Repo
+      , completePredicates :: [SourceRef]
+      }
+
+instance Plugin CompleteCommand where
+  parseCommand =
+    commandParser "complete"
+      (progDesc "Notify server that some predicates are complete.") $ do
+      completeRepo <- dbOpts
+      completePredicates <-
+        many $ parseRef <$> strArgument
+        (  metavar "PREDICATE"
+        <> help ("If predicate is not specified, then all non-derived "
+        <> "predicates will be marked as complete")
+        )
+      return Complete{..}
+
+  runCommand _ _ backend Complete{..} = do
+    when (not (null completePredicates)) $
+      die 1 "completing individual predicates is not supported yet"
+
+    void $ Glean.completePredicates backend completeRepo $
+      Thrift.CompletePredicates_axiom def
diff --git a/glean/tools/gleancli/GleanCLI/Derive.hs b/glean/tools/gleancli/GleanCLI/Derive.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Derive.hs
@@ -0,0 +1,138 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE RecursiveDo #-}
+module GleanCLI.Derive (DeriveCommand) where
+
+import Control.Concurrent
+import Control.Concurrent.Async (async, wait)
+import Control.Exception (bracket_, throwIO)
+import Control.Monad (forM, unless)
+import Data.Foldable (for_)
+import Data.Graph (graphFromEdges, vertices)
+import qualified Data.Map as Map
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Options.Applicative
+
+import Util.Log.Text
+import Util.OptParse
+import Util.Text
+
+import Glean
+import Glean.Derive (derivePredicate)
+import Glean.Types
+
+import GleanCLI.Types
+import GleanCLI.Common
+import Text.Printf
+
+data DeriveCommand
+  = Derive
+      { deriveRepo :: Repo
+      , predicates :: [(Text, Maybe ParallelDerivation)]
+      , derivePageOptions :: PageOptions
+      , deriveMaxConcurrency :: Int
+      }
+
+instance Plugin DeriveCommand where
+  parseCommand =
+    commandParser "derive" (progDesc desc) $ do
+      deriveRepo <- dbOpts
+      deriveMaxConcurrency <- maxConcurrencyOpt
+      derivePageOptions <- pageOpts
+      predicates <- many (serial <|> parallel)
+      return Derive{..}
+    where
+    desc = "Concurrently derive and store predicates"
+    parallel = option parseParallel
+      ( long "parallel"
+      <> metavar "PREDICATE,OUTER[,SIZE],QUERY"
+      <> help "Derive a predicate in parallel"
+      )
+
+    parseParallel = maybeReader $ \s ->
+      case Text.splitOn "," (Text.pack s) of
+        pred : outer : size : rest | Right n <- textToInt size -> Just
+          (pred,
+             Just ParallelDerivation
+               { parallelDerivation_outer_predicate = outer
+               , parallelDerivation_inner_query = Text.intercalate "," rest
+               , parallelDerivation_min_batch_size = Just (fromIntegral n) })
+        pred : outer : rest -> Just
+          (pred,
+             Just ParallelDerivation
+               { parallelDerivation_outer_predicate = outer
+               , parallelDerivation_inner_query = Text.intercalate "," rest
+               , parallelDerivation_min_batch_size = Nothing })
+        _ -> Nothing
+
+    serial = (,Nothing) <$> strArgument
+      ( metavar "PREDICATE"
+      <> help "predicates to derive"
+      )
+
+  runCommand _ _ backend Derive{..}
+    | [(pred, parallel)] <- predicates
+    = deriveOne pred parallel
+    | otherwise
+    = mdo
+      -- get the schema from the db
+      SchemaInfo{..} <- Glean.getSchemaInfo backend (Just deriveRepo) $
+        GetSchemaInfo (SelectSchema_stored Empty) False
+      -- get the typechecked predicates from the schema
+      let (graph, getNode, _) = graphFromEdges edges
+          edges = [ (p, p, pp)
+                  | (p, pp) <- Map.toList schemaInfo_derivationDependencies
+                  ]
+          predicateName pid =
+            predicateRef_name (schemaInfo_predicateIds Map.! pid)
+          derivations =
+            [ (predicateName pred, predicateName <$> deps)
+            | (_, pred, deps) <- getNode <$> vertices graph
+            ]
+
+      concurrencyAvailable <- newQSem deriveMaxConcurrency
+
+      -- set up the parallel evaluation graph
+      let
+        waitFor predicate = mapM_ wait (ivars Map.!? predicate)
+        -- mapping predicates to evaluation asyncs
+        ivars = Map.fromList $ zip (fst <$> derivations) asyncs
+
+      -- sanity check: all the requested derivations must be in the graph
+      for_ predicates $ \(pred,_) ->
+        unless (pred `elem` map fst derivations) $ do
+          throwIO $ userError $ printf
+            ("abort: %s is not in the schema or is not derived. This is not" ++
+              " supported, try deriving one predicate at a time instead.\n")
+            pred
+
+      asyncs <- forM derivations $ \(pred, deps) -> async $ do
+        -- wait for my dependencies
+        mapM_ waitFor deps
+
+        -- if I am one of the requested predicates, derive me
+        for_ (lookup pred predicates) $ \parallel -> do
+          bracket_
+            (waitQSem concurrencyAvailable)
+            (signalQSem concurrencyAvailable) $ do
+              logInfo $ "Kicking off: " <> pred
+              deriveOne pred parallel
+              logInfo $ "Done: " <> pred
+
+      -- evaluate the nodes corresponding to the requested predicates
+      mapM_ waitFor (fst <$> predicates)
+    where
+      deriveOne pred parallel =
+        derivePredicate backend deriveRepo
+          (Just $ fromIntegral $ pageBytes derivePageOptions)
+          (fromIntegral <$> pageFacts derivePageOptions)
+          (parseRef pred)
+          parallel
diff --git a/glean/tools/gleancli/GleanCLI/Finish.hs b/glean/tools/gleancli/GleanCLI/Finish.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Finish.hs
@@ -0,0 +1,54 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Finish (FinishCommand, finished) where
+
+import Control.Monad
+import Options.Applicative
+
+import Util.IO
+import Util.OptParse
+
+import GleanCLI.Common
+import GleanCLI.Types
+
+import Glean
+import Glean.LocalOrRemote
+
+data FinishCommand
+  = Finish
+      { finishRepo :: Repo
+      , allowZeroFacts :: Bool
+      }
+
+instance Plugin FinishCommand where
+  parseCommand =
+    commandParser "finish"
+      (progDesc "Notify server that a database is complete") $ do
+      finishRepo <- dbOpts
+      allowZeroFacts <- switch
+        (  long "allow-zero-facts"
+        <> help "Allow creating a db without any facts"
+        )
+      return Finish{..}
+
+  runCommand _ _ backend Finish{..} = do
+    when (not allowZeroFacts) $ do
+      stats <- Glean.predicateStats backend finishRepo Glean.ExcludeBase
+      when (null stats) $
+        die 6
+          "finish: Database has no facts. Use --allow-zero-facts to allow this"
+    finished backend finishRepo
+
+finished
+  :: LocalOrRemote b
+  => b
+  -> Repo
+  -> IO ()
+finished backend repo = Glean.finish backend repo
diff --git a/glean/tools/gleancli/GleanCLI/Index.hs b/glean/tools/gleancli/GleanCLI/Index.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Index.hs
@@ -0,0 +1,52 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Index (IndexCommand) where
+
+import Options.Applicative
+import System.Directory
+import System.IO.Temp
+
+import Util.IO
+import Util.OptParse
+
+import Glean
+import Glean.Indexer
+import Glean.Indexer.List
+import Glean.Util.Some
+
+import GleanCLI.Common
+import GleanCLI.Types
+
+data IndexCommand
+  = Index
+      { indexCmdRepo :: Repo
+      , indexCmdRoot :: FilePath
+      , indexCmdRun :: RunIndexer
+      }
+
+instance Plugin IndexCommand where
+  parseCommand =
+    commandParser "index" (progDesc "Index some source code") $ do
+      indexCmdRepo <- dbOpts
+      indexCmdRun <- cmdLineParser
+      indexCmdRoot <- strArgument (metavar "ROOT")
+      return Index{..}
+
+  runCommand _evb _cfg backend Index{..} = do
+    projectRoot <- getCurrentDirectory
+    withSystemTempDirectory "glean-index" $ \tmpdir -> do
+    fillDatabase backend indexCmdRepo Nothing (die 1 "DB already exists") $
+      indexCmdRun (Some backend) indexCmdRepo
+        IndexerParams {
+          indexerRoot = indexCmdRoot,
+          indexerProjectRoot = projectRoot,
+          indexerOutput = tmpdir,
+          indexerGroup = ""
+        }
diff --git a/glean/tools/gleancli/GleanCLI/Merge.hs b/glean/tools/gleancli/GleanCLI/Merge.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Merge.hs
@@ -0,0 +1,246 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Merge (MergeCommand) where
+
+import Control.Exception
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Lazy.Char8 as L
+import qualified Data.Aeson as Aeson
+import Data.Default
+import Data.IORef
+import Options.Applicative
+import System.Directory
+import System.Directory.Extra (listFiles)
+import System.FilePath
+import System.IO
+import System.Process
+import Control.Concurrent.Stream
+import Util.OptParse
+import Util.Log ( logInfo )
+import Thrift.Protocol.Compact
+
+import qualified Glean.Database.Config as GleanDB
+import Glean.Database.Schema
+import Glean.Database.Schema.Types
+import Glean.LocalOrRemote (loadDbSchema)
+import qualified Glean.LocalOrRemote as Glean
+import Glean.Types
+import Glean.RTS.Types
+import Glean.RTS.Foreign.FactSet (FactSet)
+import qualified Glean.RTS.Foreign.FactSet as FactSet
+import Glean.RTS.Foreign.Define (DefineFlags(..), defineBatch)
+import qualified Glean.RTS.Foreign.Inventory as Inventory
+import Glean.RTS.Foreign.Ownership
+
+import GleanCLI.Types
+import GleanCLI.Common (dbOpts, fileFormatOpt, FileFormat (..))
+import Glean.Write (fileToBatches, schemaIdToOpts)
+import Glean.Write.JSON (buildJsonBatch)
+
+
+data MergeCommand = MergeCommand
+  { mergeFiles :: [FilePath]
+  , mergeFileSize :: Int
+  , mergeOutDir :: FilePath
+  , fileFormat :: FileFormat
+  , inventorySource :: Maybe (Either Repo FilePath)
+  }
+
+inventoryOpt :: Parser FilePath
+inventoryOpt = strOption $
+    long "inventory" <>
+    metavar "FILE" <>
+    help ("Inventory created with --write-serialized-inventory and which "
+      <> "was used to create binary format files of facts")
+
+data SchemaData
+  = HaveSchema DbSchema
+  | HaveInventory Inventory.Inventory
+  | HaveNothing
+
+instance Plugin MergeCommand where
+  parseCommand = commandParser "merge" (progDesc "Merge fact files") $ do
+    mergeFiles <- many $ strArgument (
+      metavar "PATH" <>
+      help ("File or directory of facts, either in json or binary format. "
+       <> "For json format specify the database"))
+    mergeFileSize <- option auto $
+      long "max-file-size" <>
+      metavar "BYTES" <>
+      help "Create output files with (approximately) this size in bytes" <>
+      showDefault <>
+      value (256 * 1024 * 1024)
+    mergeOutDir <- strOption $
+      long "output" <>
+      metavar "DIR" <>
+      help "Destination directory for the merged fact files"
+    inventorySource <- optional $ Left <$> dbOpts <|> Right <$> inventoryOpt
+    fileFormat <- fileFormatOpt BinaryFormat
+    return MergeCommand{..}
+
+  withService evb cfgAPI svc MergeCommand{..} = do
+    -- * --file-format=binary requires an inventory, from either --db or
+    --   --inventory.
+    -- * --file-format=json requires a dbSchema, from either --db or
+    --   schema_id in the JSON file. It's pointless to use --inventory with
+    --   --file-format=json, because the inventory isn't used.
+    schemaData <- case inventorySource of
+      Just (Left repo) -> do
+        dbSchema <- Glean.withBackendWithDefaultOptions
+          evb cfgAPI svc Nothing $ \backend -> do
+            loadDbSchema backend repo
+        logInfo("db's schema ID is: "  <> show (schemaId dbSchema))
+        return (HaveSchema dbSchema)
+      Just (Right mergeInventory) -> do
+        case fileFormat of
+          JsonFormat -> do
+            hPutStrLn stderr $
+              "Warning: --inventory is ignored with --file-format=json"
+            return HaveNothing
+          _ -> do
+          inventory <- Inventory.deserialize <$> B.readFile mergeInventory
+          return (HaveInventory inventory)
+      Nothing ->
+        return HaveNothing
+    createDirectoryIfMissing True mergeOutDir
+    hSetBuffering stderr LineBuffering
+    outputs <- newIORef []
+    expandedMergeFiles <- mapM expandFile mergeFiles
+    stream 1
+      (merge fileFormat schemaData (concat expandedMergeFiles))
+      (writeToFile outputs)
+      -- stream overlaps writing with reading
+    files <- readIORef outputs
+    L.putStrLn (Aeson.encode (Aeson.toJSON files))
+    where
+      expandFile :: FilePath -> IO [FilePath]
+      expandFile file = do
+        isDirectory <- doesDirectoryExist file
+        if isDirectory
+          then listFiles file
+          else return [file]
+      factSetSize :: FactSet -> IO Int
+      factSetSize f = do
+        c <- FactSet.factCount f
+        m <- FactSet.factMemory f
+          -- FactSet has an overhead of 40 bytes per fact.  serialized
+          -- batch has an overhead of ~4 bytes per fact, using
+          -- varints so it is slightly larger for larger facts, but
+          -- this seems like a good enough approximation.
+        return (m - (c * 36))
+
+      -- if a merge will contain only a single file, we avoid
+      -- deserialising and reserialising it, just copy-on-write the
+      -- whole file.
+      writeToFile
+        :: IORef [FilePath]
+        -> (Int, Either FilePath (FactSet, [FactOwnership]))
+        -> IO ()
+      writeToFile ref (n, factSet) = do
+        let out = mergeOutDir </> show n <.> "bin"
+        modifyIORef' ref (out:)
+        case factSet of
+          Left file -> do
+            size <- getFileSize file
+            hPutStrLn stderr $ "Copying " <> file <> " (" <> show size <>
+              ") to " <> out
+            callProcess "cp" ["--reflink=auto", file, out]
+          Right (factSet, ownership) -> do
+            batch0 <- FactSet.serialize factSet
+            let batch = serializeCompact $
+                  batch0 { batch_owned =
+                    ownershipUnits (unionOwnership ownership) }
+            logInfo $ "Writing " <> out <>
+              " (" <> show (B.length batch) <> " bytes)"
+            B.writeFile out batch
+
+      merge fileFormat schemaData files write =
+        loop 0 0 Nothing schemaData files
+        where
+        read
+          :: FilePath
+          -> Int
+          -> FactSet
+          -> SchemaData
+          -> IO (FactOwnership, SchemaData)
+        read file size factSet schemaData = do
+          logInfo $ "Reading " <> file <> " (" <> show size <> " bytes)"
+
+          let
+            define batch inventory newSchemaData = do
+              subst <- defineBatch factSet inventory batch
+                DefineFlags {
+                  trustRefs = True,
+                  ignoreRedef = True }
+              own <- substOwnership subst $ FactOwnership (batch_owned batch)
+              return (own, newSchemaData)
+
+          case fileFormat of
+            JsonFormat -> do
+              (batches, schema_id_file) <- fileToBatches file
+              dbSchema <- case schemaData of
+                HaveSchema dbSchema
+                  | Just schema_id <- schema_id_file,
+                    schema_id /= schemaId dbSchema ->
+                    throwIO $ ErrorCall $
+                      "Schema ID mismatch:\ndb: "
+                      <> show (schemaId dbSchema) <> "\nvs\nFile: "
+                      <> file <> " has " <> show schema_id
+                  | otherwise -> return dbSchema
+                _otherwise -> do
+                  -- the first time (only), we load the schema we'll
+                  -- be using to parse the JSON files.
+                  schema_id <- case schema_id_file of
+                    Nothing -> throwIO $ ErrorCall $
+                      file <> ": missing schema_id"
+                    Just id -> return id
+                  let cfg = case svc of
+                        Glean.Local cfg _ -> cfg
+                        Glean.Remote{} -> def
+                  index <- GleanDB.loadSchemaIndex cfg cfgAPI
+                  newDbSchema Nothing index (SpecificSchemaId schema_id)
+                    readWriteContent def
+              batch <- buildJsonBatch dbSchema
+                (schemaIdToOpts $ Just (schemaId dbSchema)) batches
+              define batch (schemaInventory dbSchema) (HaveSchema dbSchema)
+
+            BinaryFormat -> do
+              inventory <- case schemaData of
+                HaveSchema dbSchema -> return (schemaInventory dbSchema)
+                HaveInventory inventory -> return inventory
+                HaveNothing -> throwIO $ ErrorCall $
+                  "--file-format=binary requires either --inventory, " <>
+                  "--db, or --db-name and --db-instance"
+              bytes <- B.readFile file
+              case deserializeCompact bytes of
+                Left err -> throwIO $ ErrorCall $
+                  "failed to deserialize " <> file <> ": " <> err
+                Right batch ->
+                  define batch inventory (HaveInventory inventory)
+
+        loop !_ _ Nothing _ [] = return ()
+        loop !n _ (Just set) _ [] = write (n, Right set)
+        loop !n currentSize acc schema (f : files) = do
+          size <- fromIntegral <$> getFileSize f
+          if size > mergeFileSize && fileFormat == BinaryFormat
+            -- just copy huge binary files
+            then do
+              write (n, Left f)
+              loop (n+1) currentSize acc schema files
+            else do
+              (factSet, ownership) <- case acc of
+                Nothing -> (,[]) <$> FactSet.new lowestFid
+                Just facts -> return facts
+              (owners, schema) <- read f size factSet schema
+              newSize <- factSetSize factSet
+              let facts = (factSet, owners : ownership)
+              (n, acc) <- if newSize > mergeFileSize
+                then do write (n, Right facts); return (n+1, Nothing)
+                else return (n, Just facts)
+              loop n newSize acc schema files
diff --git a/glean/tools/gleancli/GleanCLI/Query.hs b/glean/tools/gleancli/GleanCLI/Query.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Query.hs
@@ -0,0 +1,188 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Query (QueryCommand) where
+
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Char8 as B8
+import Data.Default
+import Data.Int (Int64)
+import Data.Text (Text)
+import Data.Maybe (isJust, isNothing)
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Data.Text.IO as Text
+import Options.Applicative
+import System.IO
+
+import Thrift.Protocol.JSON (serializeJSON)
+import Util.IO
+import Util.OptParse
+
+import Glean
+import Glean.Types as Thrift
+
+import GleanCLI.Common
+import GleanCLI.Types
+import Control.Monad (when)
+
+data QueryCommand
+  = Query
+      { repoSpec :: Either Text Repo
+      , query :: String
+      , recurse :: Bool
+      , queryPageOptions :: PageOptions
+      , limitFacts :: Maybe Int
+      , output :: Maybe FilePath
+      , statsOutput :: Maybe FilePath
+      , timeout :: Maybe Int64
+      , omitResults :: Bool
+      , debugOutput :: Maybe FilePath
+      , debugBytecode :: Bool
+      , debugIr :: Bool
+      , profileOutput :: Bool
+      }
+
+instance Plugin QueryCommand where
+  parseCommand =
+    commandParser "query" (progDesc "Execute an Angle query") $ do
+      repoSpec <- Left <$> dbNameOpt <|> Right <$> dbSlash
+      queryPageOptions <- pageOpts
+      recursive <- switch $ long "recursive" <> hidden
+        <> help "fetch nested facts (slower)"
+      expand <- switch $ long "expand"
+        <> help "recursively expand nested facts (slower)"
+      limitFacts <- optional $ option auto
+        ( long "limit"
+        <> metavar "FACTS"
+        <> help "maximum number of facts to query (default: no limit)"
+        )
+      output <- optional $ strOption
+        ( long "output"
+        <> short 'o'
+        <> metavar "FILE"
+        <> help "output the facts to a file"
+        )
+      statsOutput <- optional $ strOption
+        ( long "stats"
+        <> metavar "FILE"
+        <> help "output stats to a file ('-' for stdout)"
+        )
+      profileOutput <- switch $ long "profile"
+        <> help (
+          "get full profiling information; " <>
+          "use with --stats to include facts_searched")
+      timeout <- optional $ option auto
+        ( long "timeout"
+        <> metavar "MILLISECONDS"
+        <> help "Override the default query timeout"
+        )
+      omitResults <- switch $ long "omit-results"
+        <> help (
+          "don't print results; " <>
+          "use with --stats to get a count of results")
+      debugOutput <- optional $ strOption
+        ( long "debug"
+        <> metavar "FILE"
+        <> help "output debug info to a file ('-' for stdout)"
+        )
+      debugBytecode <- switch $ long "debug-bytecode"
+        <> help "dump the generated bytecode"
+      debugIr <- switch $ long "debug-ir"
+        <> help "dump the generated IR"
+      query <- strArgument
+        ( metavar "QUERY"
+        <> help "query to execute ('@file' to read from file, '-' for stdin)"
+        )
+      return $
+        let recurse = recursive || expand in
+        Query{..}
+
+  runCommand _ _ backend Query{..} = do
+    when (isNothing statsOutput && profileOutput) $
+      die 3 "Invalid options: --profile needs to be used together with --stats"
+    query_bytes <- case query of
+      "-" -> B.hGetContents stdin
+      '@':path -> B.readFile path
+      _ -> return $ Text.encodeUtf8 $ Text.pack query
+
+    repo <- case repoSpec of
+      Left name -> Glean.getLatestRepo backend name
+      Right repo -> return repo
+
+    let with_output f = case output of
+          Just path -> withFile path WriteMode f
+          Nothing -> f stdout
+
+        with_stats_output f = case statsOutput of
+          Just path ->
+            (if path == "-" then ($ stdout) else withFile path WriteMode) $
+            \out -> f $ B8.hPutStrLn out . maybe "{}" serializeJSON
+          Nothing -> f $ const $ return ()
+
+        with_debug_output f
+          | debugBytecode || debugIr = case debugOutput of
+              Just path
+                | path /= "-" -> withFile path WriteMode display
+              _ -> display stdout
+          | otherwise = f $ const $ return ()
+          where
+            display out = f $ Text.hPutStrLn out . Text.unlines
+
+    with_output $ \h_out ->
+      with_stats_output $ \print_stats ->
+      with_debug_output $ \print_debug -> do
+    let subtract_limit Nothing _ = Just Nothing
+        subtract_limit (Just m) n
+          | m > n = Just $ Just (m-n)
+          | otherwise = Nothing
+
+        loop prev_stats cont limit = do
+          UserQueryResults{..} <- Glean.userQuery backend repo def
+            { userQuery_query = query_bytes
+            , userQuery_encodings = [UserQueryEncoding_json
+                def{ userQueryEncodingJSON_expand_results = recurse }]
+            , userQuery_options = Just def
+                { userQueryOptions_max_results =
+                    case (limit, fromIntegral <$> pageFacts queryPageOptions) of
+                      (Just m, Just n) -> Just $ m `min` n
+                      (x,y) -> x <|> y
+                , userQueryOptions_max_bytes =
+                    Just $ fromIntegral $ pageBytes queryPageOptions
+                , userQueryOptions_max_time_ms = timeout
+                , userQueryOptions_continuation = cont
+                , userQueryOptions_syntax = QuerySyntax_ANGLE
+                , userQueryOptions_recursive = recurse
+                , userQueryOptions_omit_results = omitResults
+                , userQueryOptions_collect_facts_searched =
+                    isJust statsOutput && profileOutput
+                , userQueryOptions_debug = case cont of
+                    Nothing -> QueryDebugOptions
+                      { queryDebugOptions_bytecode = debugBytecode
+                      , queryDebugOptions_ir = debugIr
+                      , queryDebugOptions_pred_has_facts = False
+                      }
+                    Just _ -> def
+                }
+            }
+          let stats = prev_stats <> userQueryResults_stats
+          n <- case userQueryResults_results of
+            UserQueryEncodedResults_json UserQueryResultsJSON{..} -> do
+              mapM_ (B8.hPutStrLn h_out) userQueryResultsJSON_facts
+              return $ length userQueryResultsJSON_facts
+            _ -> die 1 "error: unexpected results encoding"
+          print_debug userQueryResults_diagnostics
+          case userQueryResults_continuation of
+            Just new_cont
+              | Just new_limit <- subtract_limit limit $ fromIntegral n ->
+                  loop stats (Just new_cont) new_limit
+            _ ->  do
+              print_stats stats
+              return ()
+    loop Nothing Nothing $ fromIntegral <$> limitFacts
diff --git a/glean/tools/gleancli/GleanCLI/Restore.hs b/glean/tools/gleancli/GleanCLI/Restore.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Restore.hs
@@ -0,0 +1,298 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+{-# OPTIONS_GHC -Wno-incomplete-patterns -Wno-deprecations #-}
+module GleanCLI.Restore (RestoreCommand) where
+
+import Control.Exception.Safe (catch)
+import Control.Monad (forM_, forM)
+import Control.Monad.Extra (firstJustM)
+import Control.Concurrent
+import Data.Either
+import Data.List (sortOn)
+import Data.Text (Text)
+import Data.Maybe
+import qualified Data.Text as Text
+import Data.Time
+import Data.Time.Clock.POSIX
+import Options.Applicative
+
+import Util.IO
+import Util.OptParse
+import Util.Log (logInfo)
+import Util.STM (atomically)
+
+import Glean
+  ( Repo(..)
+  , Database(..)
+  , DatabaseStatus(..)
+  )
+import qualified Glean
+import qualified Glean.Database.Backup.Locator as Backup
+import Glean.LocalOrRemote (BackendKind(..), backendKind)
+import Glean.Database.Backup.Backend (Site(inspect))
+import Glean.Database.Meta (metaToThriftDatabase)
+
+import GleanCLI.Common
+import GleanCLI.Types
+import GleanCLI.Utils
+import Glean.Database.Exception
+import Glean.Database.Repo (inRepo)
+import Glean.Database.Open (depParent)
+
+data WhatToRestore
+  = RestoreLocator Text
+  | RestoreDb Repo
+  | RestoreDbOnDay Text Day
+  | RestoreDbLatest Text
+
+data RestoreDbSpec
+  = InstanceOpt Text
+  | DateOpt Day
+  | LatestOpt
+
+data RestoreCommand
+  = Restore
+      { what :: WhatToRestore
+      , ignoreDependencies :: Bool
+      }
+
+type Locator = Text
+
+instance Plugin RestoreCommand where
+  serverConfigTransform _ = disableJanitor . disableAutoBackups
+
+  parseCommand =
+    commandParser "restore" (progDesc "Restore a database") $
+      Restore <$> what <*> deps
+    where
+      locator = strArgument
+        (  metavar "LOCATOR"
+        <> help "DB location, see :list-all in glean shell."
+        )
+      deps = switch
+        (  long "ignore-dependencies"
+        <> help "Don't download database dependencies when specifying a DB name.")
+      what =
+        (RestoreLocator <$> locator) <|>
+        (RestoreDb <$> dbSlash) <|> do
+          repoName <- dbNameOpt
+          spec <- InstanceOpt <$> dbInstanceOpt <|> DateOpt <$> dayOpt
+            <|> latestOpt
+          return $ case spec of
+            InstanceOpt hash -> RestoreDb (Repo repoName hash)
+            DateOpt day -> RestoreDbOnDay repoName day
+            LatestOpt  -> RestoreDbLatest repoName
+
+      parseDay = return .
+        parseTimeOrError False defaultTimeLocale (iso8601DateFormat Nothing)
+
+      dayOpt = option (eitherReader parseDay)
+        (  long "date"
+        <> metavar "YYYY-MM-DD"
+        <> help "find a DB for this date (UTC)")
+
+      latestOpt = flag' LatestOpt
+        (long "latest"
+        <> help "find latest instance")
+
+  runCommand _ _ backend Restore{..} = do
+    targets <- locatorsToRestore
+    restore targets
+    wait (fst <$> targets)
+    where
+      locatorsToRestore = case what of
+        -- ignores dependencies
+        RestoreLocator locator -> return [(locator, Nothing)]
+        RestoreDb repo
+          | BackendEnv env <- backendKind backend -> do
+            logInfo $ inRepo repo "Searching"
+            sites <- atomically $ Backup.getAllSites env
+            db <- getDatabaseFromSite sites repo
+            if ignoreDependencies then withLocator [db] [repo] else do
+            allDbs <- getDependenciesOneByOne sites db
+            withLocator allDbs (map database_repo allDbs)
+          | otherwise -> do
+            databases <- listWithBackups
+            let deps = if ignoreDependencies
+                  then []
+                  else dependencies databases repo
+            withLocator databases $ repo : deps
+        RestoreDbOnDay repoName day -> do
+          databases <- listWithBackups
+          let
+            matchingDay = listToMaybe
+                [ database_repo
+                | db@Database{..} <- sortOn dbTime databases
+                , repo_name database_repo == repoName
+                , day == utctDay (posixSecondsToUTCTime $ fromIntegral $
+                    Glean.unPosixEpochTime (dbTime db))
+                ]
+          case matchingDay of
+            Just repo -> do
+              let deps = if ignoreDependencies
+                    then []
+                    else dependencies databases repo
+              withLocator databases $ repo : deps
+            Nothing -> die 1 $ unwords
+              ["Cannot find backup locator for", Text.unpack repoName, "on"
+              , formatTime defaultTimeLocale (iso8601DateFormat Nothing) day ]
+        RestoreDbLatest repoName -> do
+          databases <- listWithBackups
+          let latestRepo = listToMaybe $ reverse
+                [ database_repo
+                | Database{..} <- sortOn dbTime databases
+                , repo_name database_repo == repoName
+                ]
+          case latestRepo of
+            Just repo -> do
+              let deps = if ignoreDependencies
+                    then []
+                    else dependencies databases repo
+              withLocator databases $ repo : deps
+            Nothing -> die 1 $ "Cannot find repo for " <> Text.unpack repoName
+
+      getDependenciesOneByOne sites db = do
+        case database_dependencies db of
+          Nothing -> return [db]
+          Just dep -> do
+            dep_db <- getDatabaseFromSite sites (depParent dep)
+            (db:) <$> getDependenciesOneByOne sites dep_db
+
+      getDatabaseFromSite sites repo = do
+        result <- flip firstJustM sites $ \(_prefix, site) ->
+                    restorable repo <$> inspect site repo
+        maybe (dieHere repo) return result
+
+      restorable repo meta
+        = Just $
+          metaToThriftDatabase Glean.DatabaseStatus_Restorable Nothing repo meta
+
+      dieHere repo = die 1 $ "Cannot find " <> show repo
+
+      dbTime Database{..} =
+              fromMaybe database_created_since_epoch
+                database_repo_hash_time
+
+      withLocator :: [Database] -> [Repo] -> IO [(Locator, Maybe Repo)]
+      withLocator databases repos = forM repos $ \repo -> do
+        locator <- repoLocator databases repo
+        return (locator, Just repo)
+
+      listWithBackups =
+        Glean.listDatabasesResult_databases <$>
+          Glean.listDatabases backend Glean.ListDatabases
+            { listDatabases_includeBackups = True
+            , listDatabases_client_info = Nothing
+            }
+
+      restore targets = do
+        forM_ targets $ \(locator, mrepo) -> do
+          logInfo $ unwords $
+            [ "Restoring" ] ++
+            [ Glean.showRepo repo | Just repo <- [mrepo]] ++
+            [ "from", Text.unpack locator]
+          Glean.restoreDatabase backend locator
+              `catch` \DBAlreadyExists -> return ()
+
+      wait locators = do
+        let noRetries =
+              case backendKind backend of
+                -- If we're calling a remote backend, it might not have
+                -- started the restoring yet. So we'll wait a bit to give
+                -- some time to start the restoring.
+                BackendThrift _ -> 5
+                _ -> 0
+        dbs <- waitForRestoreToStart noRetries
+        waitForRestoreToFinish dbs
+        where
+          waitForRestoreToStart (retries::Int) = do
+            let
+              isAvailable =  (DatabaseStatus_Available ==) . database_status
+              retry err =
+                if
+                  | retries > 0
+                    -> do
+                        threadDelay 1000000
+                        waitForRestoreToStart (retries-1)
+                  | retries == 0
+                    -> die 1 err
+            localDatabases <- listLocalDBs
+            (nonExistingLocs, dbs) <- partitionEithers <$>
+              traverse (locatorDb localDatabases) locators
+            if
+              | locator : _ <- nonExistingLocs ->
+                retry $ unwords
+                        ["error: did not find database locator"
+                        ,Text.unpack locator]
+              | db : _ <- filter isAvailable dbs ->
+                retry $ unwords
+                        ["error: timed out restoring"
+                        ,show db]
+              | otherwise -> return dbs
+
+          waitForRestoreToFinish dbs = do
+            let isRestoring = (DatabaseStatus_Restoring ==) . database_status
+            if any isRestoring dbs
+              then do threadDelay 1000000
+                      localDatabases <- listLocalDBs
+                      edbs <- traverse (locatorDb localDatabases) locators
+                      waitForRestoreToFinish (rights edbs)
+              else forM_ dbs $ \db -> case database_status db of
+                DatabaseStatus_Complete -> return ()
+                DatabaseStatus_Missing -> putStrLn $ unwords
+                  [ "Some of"
+                  , Glean.showRepo (database_repo db)
+                  , "dependencies are missing."
+                  , "You may want to restore those as well"
+                  ] -- TODO: List missing dependencies
+                status ->
+                  die 1 $ "error: unexpected database status: " <> show status
+
+          listLocalDBs = Glean.listDatabasesResult_databases <$>
+            Glean.listDatabases backend Glean.ListDatabases
+              { listDatabases_includeBackups = False
+              , listDatabases_client_info = Nothing
+              }
+
+          locatorDb databases locator =
+            case
+              [ db
+              | db <- databases
+              , database_location db == Just locator ]
+            of
+              [db] -> return (Right db)
+              [] -> return (Left locator)
+              _ -> die 1 $ unwords
+                ["error: server has multiple DBs with the locator"
+                , Text.unpack locator]
+
+repoLocator :: [Database] -> Repo -> IO Locator
+repoLocator databases repo =
+  case [ locator
+        | Database{..} <- databases
+        , database_repo == repo
+        , Just locator <- [database_location] ]
+  of
+    (locator:_) -> return locator
+    [] -> die 1 $ "Cannot find backup locator for " <> Glean.showRepo repo
+
+dependencies :: [Database] -> Repo -> [Repo]
+dependencies databases repo = repoDeps repo
+  where
+    repoDeps base =
+      case repoDirectDep base of
+        Nothing -> []
+        Just repo -> repo : repoDeps repo
+    repoDirectDep repo = listToMaybe
+        [ depParent dep
+        | Database{..} <- databases
+        , database_repo == repo
+        , Just dep <- [database_dependencies]
+        ]
diff --git a/glean/tools/gleancli/GleanCLI/Write.hs b/glean/tools/gleancli/GleanCLI/Write.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/GleanCLI/Write.hs
@@ -0,0 +1,376 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ApplicativeDo #-}
+module GleanCLI.Write (WriteCommand, FinishCommand) where
+
+import Control.Monad
+import qualified Data.ByteString as B
+import Data.Default
+import Data.Proxy
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import qualified Data.Text.Encoding as Encode
+import Options.Applicative
+
+import Control.Concurrent.Stream (stream)
+import Thrift.Protocol.Compact (Compact)
+import Thrift.Protocol
+import Util.Control.Exception
+import Util.IO
+import Util.OptParse
+import Util.STM
+
+import Glean
+import Glean.LocalOrRemote (loadDbSchema)
+import qualified Glean.LocalOrRemote as LocalOrRemote
+import Glean.Database.Schema
+import Glean.Database.Write.Batch (syncWriteDatabase)
+import Glean.Types as Thrift
+import Util.Time
+import Glean.Write
+import Glean.Write.JSON ( buildJsonBatch, syncWriteJsonBatch )
+
+import GleanCLI.Common
+import GleanCLI.Finish
+import GleanCLI.Types
+import Data.Time.Clock (UTCTime)
+import Glean.Database.Meta (utcTimeToPosixEpochTime)
+import Data.ByteString (ByteString)
+import Glean.Util.ThriftService (queueTimeout)
+
+data WriteCommand
+  = Write
+      { writeRepo :: Repo
+      , writeRepoTime :: Maybe UTCTime
+      , create :: Bool
+      , dependencies :: Maybe (IO Thrift.Dependencies)
+      , finish :: Bool
+      , properties :: [(Text,Text)]
+      , writeMaxConcurrency :: Int
+      , useLocalCache :: Bool
+      , sendQueueSettings :: Glean.SendAndRebaseQueueSettings
+      , writeFileFormat :: FileFormat
+      , updateSchemaForStacked :: Bool
+      , factsSource :: FactsSource
+      }
+
+data FactsSource = Locations [Text] | Files [FilePath]
+
+factsSourceOpts :: Parser FactsSource
+factsSourceOpts = Files <$> fileArg <|> Locations <$> locationOpt
+
+fileArg :: Parser [FilePath]
+fileArg = many $ strArgument
+  (  metavar "FILE..."
+  <> help ("File(s) of facts to add to the DB. "
+  <> "You can specify the format of the file with --file-format. ")
+  )
+
+locationOpt :: Parser [Text]
+locationOpt = many $ strOption
+  (  long "location"
+  <> metavar "LOCATION"
+  <> help "Location(s) of facts to be downloaded and written to the db"
+  )
+
+repoTimeOpt :: Parser UTCTime
+repoTimeOpt = option readTime
+  (  long "repo-hash-time"
+  <> metavar "yyyy-mm-ddThh:mm:ssZ"
+  <> help "Timestamp of the source data to be indexed."
+  )
+  where
+    readTime :: ReadM UTCTime
+    readTime = eitherReader $ \str ->
+      case readUTC $ Text.pack str of
+        Just value -> Right value
+        Nothing ->
+          Left "expecting UTC time e.g. 2021-01-01T12:30:00Z"
+
+dbPropertiesOpt :: Parser [(Text, Text)]
+dbPropertiesOpt = many $ option readProperty
+  (  long "property"
+  <> metavar "NAME=VALUE"
+  <> help "Set DB's properties when creating a DB."
+  )
+  where
+    readProperty :: ReadM (Text,Text)
+    readProperty = eitherReader $ \str ->
+      case break (=='=') str of
+        (name, '=':value) -> Right (Text.pack name, Text.pack value)
+        _other -> Left "--property: expecting NAME=VALUE"
+
+finishOpt :: Parser Bool
+finishOpt = switch
+  (  long "finish"
+  <> help ("Mark the DB as complete. When a DB is complete, "
+  <> "it is not possible to add any more facts to it.")
+  )
+
+stackedOpt :: Parser Repo
+stackedOpt = option (maybeReader Glean.parseRepo)
+  (  long "stacked"
+  <> metavar "DB"
+  <> help ("Created DB will be stacked on top of this DB. "
+  <> "For more details about its schema, see --update-schema-for-stacked.")
+  )
+
+useLocalSwitchOpt :: Parser Bool
+useLocalSwitchOpt = switch
+  (  long "use-local-cache"
+  <> help ("Use a local cache to avoid resending duplicate facts. May improve "
+  <> "write performance.")
+  )
+
+incrementalOpt :: Parser Repo
+incrementalOpt = option (maybeReader Glean.parseRepo)
+  (  long "incremental"
+  <> metavar "DB"
+  <> help "Create an incremental DB on top of this DB."
+  )
+
+splitUnits :: Text -> [ByteString]
+splitUnits = map Encode.encodeUtf8 . Text.splitOn ","
+
+extractLines :: FilePath -> IO [ByteString]
+extractLines file = map Encode.encodeUtf8 . Text.lines <$> Text.readFile file
+
+includeOptString :: Parser (IO [ByteString])
+includeOptString = return . splitUnits <$> strOption
+  (  long "include"
+  <> metavar "unit,unit,.."
+  <> help "For incremental DBs only. Include these units."
+  )
+
+includeOptFile :: Parser (IO [ByteString])
+includeOptFile = extractLines <$> strOption
+  (  long "include-file"
+  <> metavar "FILE"
+  <> help ("For incremental DBs only. Include units in FILE "
+  <> "(one per line).")
+  )
+
+includeOpt :: Parser (IO [ByteString])
+includeOpt = includeOptFile <|> includeOptString
+
+excludeOptString :: Parser (IO [ByteString])
+excludeOptString =  return . splitUnits <$> strOption
+  (  long "exclude"
+  <> metavar "unit,unit,.."
+  <> help "For incremental DBs only. Exclude these units."
+  )
+
+excludeOptFile :: Parser (IO [ByteString])
+excludeOptFile =  extractLines <$> strOption
+  (  long "exclude-file"
+  <> metavar "FILE"
+  <> help ("For incremental DBs only. Exclude units in FILE "
+  <> "(one per line).")
+  )
+
+excludeOpt :: Parser (IO [ByteString])
+excludeOpt = excludeOptFile <|> excludeOptString
+
+updateSchemaForStackedOpt :: Parser Bool
+updateSchemaForStackedOpt = switch
+  (  long "update-schema-for-stacked"
+  <> help (
+    "When creating a stacked DB, use the current schema instead " <>
+    "of the schema from the base DB.")
+  )
+
+instance Plugin WriteCommand where
+  parseCommand = createCmd <|> writeCmd
+    where
+    createCmd =
+      commandParser "create" (progDesc (
+          "Create a new standalone|stacked|incremental DB. "
+          <> "Please carefully read help above to understand how various "
+          <> "options are related to each other.")) $ do
+        writeRepo <- dbOpts
+        writeRepoTime <- optional repoTimeOpt
+        finish <- finishOpt
+        dependencies <- optional (stackedOptions <|> updateOptions)
+        properties <- dbPropertiesOpt
+        writeMaxConcurrency <- maxConcurrencyOpt
+        useLocalCache <- useLocalSwitchOpt
+        sendQueueSettings <- Glean.sendAndRebaseQueueOptions
+        writeFileFormat <- fileFormatOpt JsonFormat
+        updateSchemaForStacked <- updateSchemaForStackedOpt
+        factsSource <- factsSourceOpts
+        return Write
+          { create=True
+          , ..
+          }
+
+    writeCmd =
+      commandParser "write" (progDesc (
+          "Write facts to an existing DB. "
+          <> "Please carefully read help above to understand how various "
+          <> "options are related to each other.")) $ do
+        writeRepo <- dbOpts
+        finish <- finishOpt
+        writeMaxConcurrency <- maxConcurrencyOpt
+        useLocalCache <- useLocalSwitchOpt
+        sendQueueSettings <- Glean.sendAndRebaseQueueOptions
+        writeFileFormat <- fileFormatOpt JsonFormat
+        factsSource <- factsSourceOpts
+        return Write
+          { create=False, writeRepoTime=Nothing
+          , properties=[], dependencies=Nothing
+          , updateSchemaForStacked = False
+          , ..
+          }
+
+    stackedOptions :: Parser (IO Dependencies)
+    stackedOptions = f <$> stackedOpt
+      where
+        f Repo{..} =
+          return $ Thrift.Dependencies_stacked $
+            Thrift.Stacked repo_name repo_hash Nothing
+
+    updateOptions :: Parser (IO Dependencies)
+    updateOptions = do
+      repo <- incrementalOpt
+      let
+        include = (,False) <$> includeOpt
+        exclude = (,True) <$> excludeOpt
+      ~(units, exclude) <- include <|> exclude
+      return $ fmap (prune repo exclude) units
+      where
+        prune :: Repo -> Bool -> [ByteString] -> Dependencies
+        prune repo exclude units = Thrift.Dependencies_pruned $
+          Thrift.Pruned repo units exclude Nothing
+
+  runCommand _ _ backend Write{..} =
+    tryBracket
+       (when create $ do
+            putStrLn $ "Creating DB " <> showRepo writeRepo
+            deps <- maybe (return Nothing) (fmap Just) dependencies
+            Thrift.KickOffResponse alreadyExists <-
+              Glean.kickOffDatabase backend def
+                { kickOff_repo = writeRepo
+                , kickOff_properties = HashMap.fromList properties
+                , kickOff_dependencies = deps
+                , kickOff_repo_hash_time =
+                    utcTimeToPosixEpochTime <$> writeRepoTime
+                , kickOff_update_schema_for_stacked = updateSchemaForStacked
+                }
+            when alreadyExists $ die 3 "DB create failure: already exists"
+       )
+       (\_ result -> case resultToFailure result of
+          Just err -> die 3 $ "DB create failure: " ++ err
+          Nothing -> when finish $ finished backend writeRepo)
+       (\_ ->
+          write Write{..})
+    where
+    write Write{..} = do
+      case factsSource of
+        Files writeFiles -> writeBatches writeFiles Write{..}
+        Locations locations -> writeBatchDescriptors locations Write{..}
+    writeBatches writeFiles Write{useLocalCache = True, ..} = do
+      dbSchema <- loadDbSchema backend writeRepo
+      logMessages <- newTQueueIO
+      let inventory = schemaInventory dbSchema
+          queueSettings = sendQueueSettings
+            { sendAndRebaseQueueAllowRemoteReferences =
+                case writeFileFormat of
+                  -- we expect binary batches to be self-contained.
+                  BinaryFormat -> False
+                  JsonFormat -> True
+            }
+      Glean.withSendAndRebaseQueue backend writeRepo inventory queueSettings $
+        \queue ->
+          stream writeMaxConcurrency (forM_ writeFiles) $ \file -> do
+            batch <- case writeFileFormat of
+              BinaryFormat -> do
+                r <- B.readFile file
+                case deserializeGen (Proxy :: Proxy Compact) r of
+                  Left parseError -> die 3 $ "Parse error: " <> parseError
+                  Right result -> return result
+              JsonFormat -> do
+                (batches, schema_id) <- fileToBatches file
+                buildJsonBatch dbSchema (schemaIdToOpts schema_id) batches
+            _ <- Glean.writeSendAndRebaseQueue queue batch $
+              \_ -> writeTQueue logMessages $ "Wrote " <> file
+            atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+            return ()
+      atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+
+    writeBatches writeFiles Write{useLocalCache = False, ..}
+      | LocalOrRemote.BackendEnv env <- LocalOrRemote.backendKind backend = do
+        logMessages <- newTQueueIO
+        case writeFileFormat of
+          BinaryFormat ->
+            stream writeMaxConcurrency (forM_ writeFiles) $ \file -> do
+              r <- B.readFile file
+              case deserializeGen (Proxy :: Proxy Compact) r of
+                Left parseError -> die 3 $ "Parse error: " <> parseError
+                Right batch -> do
+                  void $ syncWriteDatabase env writeRepo batch
+                  atomically $ writeTQueue logMessages $ "Wrote " <> file
+                  atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+          JsonFormat ->
+            stream writeMaxConcurrency (forM_ writeFiles) $ \file -> do
+              (batches, schema_id) <- fileToBatches file
+              syncWriteJsonBatch
+                env writeRepo batches (schemaIdToOpts schema_id)
+              atomically $ writeTQueue logMessages $ "Wrote " <> file
+              atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+
+    writeBatches writeFiles Write{useLocalCache = False, ..} = do
+      logMessages <- newTQueueIO
+      let settings = sendAndRebaseQueueSendQueueSettings sendQueueSettings
+      Glean.withSendQueue backend writeRepo settings $ \queue ->
+        stream writeMaxConcurrency (forM_ writeFiles) $ \file -> do
+          case writeFileFormat of
+            BinaryFormat -> do
+              r <- B.readFile file
+              case deserializeGen (Proxy :: Proxy Compact) r of
+                Left parseError -> die 3 $ "Parse error: " <> parseError
+                Right batch ->
+                  atomically $ Glean.writeSendQueue queue batch $ \_ ->
+                    writeTQueue logMessages $ "Wrote " <> file
+            JsonFormat -> do
+              (batches, _) <- fileToBatches file
+              atomically $ Glean.writeSendQueueJson queue batches $ \_ ->
+                writeTQueue logMessages $ "Wrote " <> file
+          atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+          return ()
+      atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+    writeBatchDescriptors locations Write{..} = do
+      logMessages <- newTQueueIO
+      let settings = sendAndRebaseQueueSendQueueSettings sendQueueSettings
+      Glean.withSendQueue backend writeRepo settings $ \queue ->
+        stream writeMaxConcurrency (forM_ locations) $ \location -> do
+          let batchDescriptor = Thrift.BatchDescriptor {
+            Thrift.batchDescriptor_location = location,
+            Thrift.batchDescriptor_format = batchFormat writeFileFormat}
+          atomically
+            $ Glean.writeSendQueueDescriptor queue batchDescriptor $ \_ ->
+              writeTQueue logMessages $ "Wrote " <> Text.unpack location
+          atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+          return ()
+      atomically (flushTQueue logMessages) >>= mapM_ putStrLn
+
+    batchFormat writeFileFormat = case writeFileFormat of
+      BinaryFormat -> Thrift.BatchFormat_Binary
+      JsonFormat -> Thrift.BatchFormat_JSON
+    resultToFailure Right{} = Nothing
+    resultToFailure (Left err) = Just (show err)
+
+  withService evb cfgAPI svc c =
+    -- Ensure the queue timeout is short to avoid OOMing the server
+    LocalOrRemote.withBackend evb cfgAPI svc Nothing settings $ \backend ->
+      runCommand evb cfgAPI backend c
+    where
+      settings (clientConf, serviceOpts) =
+        (clientConf, serviceOpts{queueTimeout = Just 0.1})
diff --git a/glean/tools/gleancli/plugin/GleanCLI/Types.hs b/glean/tools/gleancli/plugin/GleanCLI/Types.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/plugin/GleanCLI/Types.hs
@@ -0,0 +1,75 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module GleanCLI.Types
+  ( Plugin(..)
+  ) where
+
+import Control.Exception
+import Options.Applicative
+
+import Util.EventBase
+import Glean.Database.Env (withDatabases)
+import Glean.LocalOrRemote as Glean
+    ( Service(..), LocalOrRemote, withBackendWithDefaultOptions )
+import Glean.Impl.ConfigProvider
+import qualified Glean.ServerConfig.Types as Server
+import Glean.Util.ConfigProvider
+
+#if GLEAN_FACEBOOK
+import Glean.Database.Config
+import Glean.Facebook.Logger.Database
+import Glean.Util.Some
+import Logger.IO (withLogger)
+#endif
+
+class Plugin c where
+  parseCommand :: Parser c
+
+  -- | Allows for transforming the command-line args that get passed
+  -- to Gflags. This can be used to add --minloglevel=N for example.
+  argTransform :: c -> [String] -> [String]
+  argTransform _ = id
+
+  -- | Allows transforming the server config to e.g. disable the janitor.
+  --   Only relevant when using a local DB root and setting a server config
+  serverConfigTransform :: c -> (Server.Config -> Server.Config)
+  serverConfigTransform _ = id
+
+  runCommand
+    :: (Glean.LocalOrRemote backend, ConfigProvider cfg)
+    => EventBaseDataplane
+    -> cfg
+    -> backend
+    -> c
+    -> IO ()
+  runCommand _ _ _ _ =
+    throwIO $ ErrorCall "runCommand implementation missing"
+
+  -- | override this instead of runCommand if you need to do your own
+  -- withBackend stuff.
+  withService
+    :: EventBaseDataplane
+    -> ConfigAPI
+    -> Glean.Service
+    -> c
+    -> IO ()
+  withService evb cfgAPI svc c = case svc of
+    Glean.Remote{} ->
+      Glean.withBackendWithDefaultOptions evb cfgAPI svc Nothing $ \b ->
+        runCommand evb cfgAPI b c
+    Glean.Local cfg _ ->
+#if GLEAN_FACEBOOK
+      withLogger cfgAPI $ \logger -> do
+        cfg <- pure cfg{cfgDatabaseLogger =
+                          Some (GleanDatabaseFacebookLogger logger)
+                      }
+#endif
+        withDatabases evb cfg cfgAPI $ \env ->
+          runCommand evb cfgAPI env c
diff --git a/glean/tools/gleancli/plugin/GleanCLI/Utils.hs b/glean/tools/gleancli/plugin/GleanCLI/Utils.hs
new file mode 100644
--- /dev/null
+++ b/glean/tools/gleancli/plugin/GleanCLI/Utils.hs
@@ -0,0 +1,24 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module GleanCLI.Utils
+  ( disableJanitor
+  , disableAutoBackups
+  ) where
+
+import Glean.ServerConfig.Types
+
+disableJanitor :: Config -> Config
+disableJanitor config = config{ config_janitor_period = Nothing }
+
+disableAutoBackups :: Config -> Config
+disableAutoBackups config = config{
+  config_backup = (config_backup config){
+    databaseBackupPolicy_allowed = mempty
+  }
+}
diff --git a/glean/util/Glean/Impl/ConfigProvider.hs b/glean/util/Glean/Impl/ConfigProvider.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Impl/ConfigProvider.hs
@@ -0,0 +1,134 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | An implementation of ConfigProvider that uses files on the local
+-- filesystem, watching for changes using INotify.
+
+{-# LANGUAGE ApplicativeDo #-}
+module Glean.Impl.ConfigProvider (
+    LocalConfigOptions(..),
+    LocalSubscription,
+    ConfigAPI(..),
+  ) where
+
+import Control.Concurrent
+import Control.Exception
+import qualified Data.ByteString as ByteString
+import qualified Data.ByteString.Char8 as BC
+import Data.ByteString (ByteString)
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Options.Applicative
+import System.Directory
+import System.FilePath
+import System.IO.Error
+import System.INotify
+
+import Util.Control.Exception
+
+import Glean.Util.ConfigProvider
+
+data ConfigAPI = ConfigAPI
+  { opts :: LocalConfigOptions
+  , inotify :: INotify
+  , subscriptions ::
+      MVar (HashMap ConfigPath (WatchDescriptor, [ByteString -> IO ()]))
+  }
+
+newtype LocalConfigOptions = LocalConfigOptions
+  { configDir :: Maybe FilePath
+      -- ^ directory where the configs are found. If Nothing, we'll
+      -- use $HOME/.config/glean.
+  }
+
+type instance ConfigOptions ConfigAPI = LocalConfigOptions
+
+data LocalSubscription a = LocalSubscription
+
+newtype ConfigProviderException = ConfigProviderException Text
+  deriving (Show)
+
+instance Exception ConfigProviderException
+
+instance ConfigProvider ConfigAPI where
+  configOptions = do
+    configDir <- optional $ strOption
+      (  long "config-dir"
+      <> metavar "DIR"
+      <> help ("directory where the config files can be found " <>
+        "(default: $HOME/.config/glean)")
+      )
+    return LocalConfigOptions{..}
+
+  defaultConfigOptions = LocalConfigOptions { configDir = Nothing }
+
+  withConfigProvider opts f =
+    withINotify $ \inotify -> do
+      subs <- newMVar HashMap.empty
+      f (ConfigAPI opts inotify subs)
+
+  type Subscription ConfigAPI = LocalSubscription
+
+  subscribe cfg@ConfigAPI{..} path updated deserializer = do
+    a <- get cfg path deserializer
+    updated a
+    dir <- getDir opts
+    modifyMVar_ subscriptions $ \hm -> do
+      let
+        changed contents =
+          deserialize path deserializer contents >>= updated
+      case HashMap.lookup path hm of
+        Just (watch, others) ->
+          return $ HashMap.insert path (watch, changed:others) hm
+        Nothing -> do
+          let file = BC.pack $ dir </> Text.unpack path
+          watch <- addWatch inotify [Modify,MoveIn,Create] file $ \_events -> do
+            callbacks <- withMVar subscriptions $ \hm -> do
+              case HashMap.lookup path hm of
+                Nothing -> return []
+                Just (_, callbacks) -> return callbacks
+            contents <- ByteString.readFile (dir </> Text.unpack path)
+            mapM_ ($ contents) callbacks
+              `catchAll` \_ -> return ()
+          return $ HashMap.insert path (watch, [changed]) hm
+    return LocalSubscription
+
+  cancel _ _ = return () -- unimplemented for now
+
+  get ConfigAPI{..} path deserializer = do
+    dir <- getDir opts
+    contents <- ByteString.readFile (dir </> Text.unpack path)
+      `catch` \e ->
+        if isDoesNotExistError e
+          then throwIO $ ConfigProviderException $
+            "no config for " <> path <> " at " <>
+              Text.pack (dir </> Text.unpack path)
+          else
+            throwIO e
+    deserialize path deserializer contents
+
+  isConfigFailure _ e
+    | Just ConfigProviderException{} <- fromException e = True
+    | otherwise = False
+
+deserialize :: ConfigPath -> Deserializer a -> ByteString -> IO a
+deserialize path deserializer contents =
+  case deserializer contents of
+    Left err -> throwIO $ ConfigProviderException $
+      "deserialization failed for: " <> path <>
+      ": " <> Text.pack err
+    Right a -> return a
+
+-- | default to $HOME/.config/glean if --config-dir is not set
+getDir :: LocalConfigOptions -> IO FilePath
+getDir opts =
+  case configDir opts of
+    Nothing -> getXdgDirectory XdgConfig "glean"
+    Just dir -> return dir
diff --git a/glean/util/Glean/Impl/TestConfigProvider.hs b/glean/util/Glean/Impl/TestConfigProvider.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Impl/TestConfigProvider.hs
@@ -0,0 +1,56 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | A ConfigProvider for testing. It uses a temporary directory on the
+-- filesystem, and supports setting configs programmatically.
+
+module Glean.Impl.TestConfigProvider (
+    TestConfigAPI,
+    realConfigAPI,
+  ) where
+
+import qualified Data.ByteString as ByteString
+import Data.Maybe
+import qualified Data.Text as Text
+import System.Directory
+import System.FilePath
+import System.IO.Temp
+
+import Glean.Util.ConfigProvider
+import Glean.Impl.ConfigProvider
+
+newtype TestConfigAPI = TestConfigAPI ConfigAPI
+
+data TestConfigOptions = TestConfigOptions
+
+type instance ConfigOptions TestConfigAPI = TestConfigOptions
+
+instance ConfigProvider TestConfigAPI where
+
+  configOptions = pure TestConfigOptions
+  defaultConfigOptions = TestConfigOptions
+
+  withConfigProvider TestConfigOptions f =
+    withSystemTempDirectory "glean-config" $ \dir ->
+      withConfigProvider (LocalConfigOptions (Just dir)) $ \cfg ->
+        f (TestConfigAPI cfg)
+
+  type Subscription TestConfigAPI = LocalSubscription
+  subscribe (TestConfigAPI cfg) = subscribe cfg
+  cancel (TestConfigAPI cfg) = cancel cfg
+  get (TestConfigAPI cfg) = get cfg
+  isConfigFailure (TestConfigAPI cfg) = isConfigFailure cfg
+
+realConfigAPI :: TestConfigAPI -> ConfigAPI
+realConfigAPI (TestConfigAPI cfg) = cfg
+
+instance TestConfigProvider TestConfigAPI where
+  setTestConfig (TestConfigAPI ConfigAPI{..}) path contents = do
+    let file = fromMaybe "" (configDir opts) </> Text.unpack path
+    createDirectoryIfMissing True (takeDirectory file)
+    ByteString.writeFile file contents
diff --git a/glean/util/Glean/Impl/ThriftService.hs b/glean/util/Glean/Impl/ThriftService.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Impl/ThriftService.hs
@@ -0,0 +1,111 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP, StandaloneDeriving #-}
+module Glean.Impl.ThriftService
+  ( ThriftService
+  ) where
+
+import Data.Maybe
+import qualified Data.Text.Encoding as Text
+
+import Glean.Util.Service
+import Glean.Util.ThriftService
+
+#ifdef FBTHRIFT
+
+import qualified Data.ByteString.UTF8 as UTF8
+import Network.Socket
+
+import Thrift.Protocol.Id
+import Thrift.Channel.HeaderChannel
+
+-- | A basic 'ThriftService' supporting connections to a specific host/port
+newtype ThriftService p = ThriftService
+  { headerConfig :: HeaderConfig p
+  }
+
+deriving instance Show (ThriftService p)
+
+instance IsThriftService ThriftService where
+  mkThriftService (HostPort h p) ThriftServiceOptions{..} = ThriftService
+    { headerConfig = headerConfig
+    }
+    where
+    timeout = round (fromMaybe 30 processingTimeout * 1000)
+    headerConfig = HeaderConfig
+      { headerHost = Text.encodeUtf8 h
+      , headerPort = fromIntegral p
+      , headerProtocolId = compactProtocolId
+      , headerConnTimeout = timeout
+      , headerSendTimeout = timeout
+      , headerRecvTimeout = timeout
+      }
+  mkThriftService _ _ = error "basic-thriftservice does not support Tier"
+
+  thriftServiceWithDbShard t _ = t  -- shards are irrelevant if we have host/port
+
+  runThrift evb ThriftService{..} action = do
+    addrs <- getAddrInfo
+      (Just defaultHints)
+      (Just (UTF8.toString (headerHost headerConfig)))
+      Nothing
+    headerConfig' <- case addrs of
+       [] -> return headerConfig
+       (addr : _) -> do
+         (mHost, _) <- getNameInfo [NI_NUMERICHOST] True False
+           (addrAddress addr)
+         case mHost of
+           Nothing -> return headerConfig
+           Just host -> return
+             headerConfig { headerHost = UTF8.fromString host }
+    withHeaderChannel evb headerConfig' action
+
+  getSelection _evb ThriftService{..} _ =
+    return
+      [ (Text.decodeUtf8 (headerHost headerConfig), headerPort headerConfig)
+      ]
+
+#else /* !FBTHRIFT */
+
+import Thrift.Channel.HTTP
+import Thrift.Protocol.Id
+
+-- | A basic 'ThriftService' supporting connections to a specific host/port
+newtype ThriftService p = ThriftService
+  { httpConfig :: HTTPConfig p
+  }
+
+deriving instance Show (ThriftService p)
+
+instance IsThriftService ThriftService where
+  mkThriftService (HostPort h p) ThriftServiceOptions{..} = ThriftService
+    { httpConfig = httpConfig
+    }
+    where
+    httpConfig = HTTPConfig
+      { httpHost = Text.encodeUtf8 h
+      , httpPort = fromIntegral p
+      , httpProtocolId = compactProtocolId
+      , httpResponseTimeout =
+          Just $ round (fromMaybe 30 processingTimeout * 1000000)
+      }
+  mkThriftService _ _ = error "basic-thriftservice does not support Tier"
+
+  thriftServiceWithDbShard t _ = t
+    -- shards are irrelevant if we have host/port
+
+  runThrift _evb ThriftService{..} action =
+    withHTTPChannel httpConfig action
+
+  getSelection _evb ThriftService{..} _ =
+    return
+      [ (Text.decodeUtf8 (httpHost httpConfig), httpPort httpConfig)
+      ]
+
+#endif
diff --git a/glean/util/Glean/Util/Bisect.hs b/glean/util/Glean/Util/Bisect.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Bisect.hs
@@ -0,0 +1,85 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Bisect (
+  Bisect(..), BisectM, execBisectM, execBisectRefM, bisect
+) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Except (ExceptT, runExceptT, throwE)
+import Control.Monad.Trans.Reader
+import Control.Monad.Trans.Class (lift)
+import Data.IORef
+
+data Bisect a b err = Bisect
+  { bisectProcess :: [a] -> IO (Either err b)
+  , bisectFailed :: err -> a -> IO ()
+    -- ^ called if the bisect successfully identified a failing item,
+    -- regardless of whether we continued or aborted afterwards.
+  , bisectSplitting :: Int -> Int -> [a] -> IO ()
+  }
+
+newtype BisectM err a = BisectM (ExceptT err (ReaderT (IORef Int) IO) a)
+  deriving(Functor, Applicative, Alternative, Monad, MonadPlus, MonadIO)
+
+-- | Run a bisect operation
+execBisectM
+  :: Int
+     -- ^ Number of failures that we will bisect down the failing item
+     -- and continue.
+  -> BisectM err a
+     -- ^ e.g. a call to 'bisect'
+  -> IO (Either err a)
+execBisectM allowed (BisectM action) = do
+  ref <- newIORef allowed
+  runReaderT (runExceptT action) ref
+
+-- | Run a bisect operation
+execBisectRefM
+  :: IORef Int
+     -- ^ Number of failures that we will bisect down the failing item
+     -- and continue.
+  -> BisectM err a
+     -- ^ e.g. a call to 'bisect'
+  -> IO (Either err a)
+execBisectRefM ref (BisectM action) = runReaderT (runExceptT action) ref
+
+bisect
+  :: Bisect a b err
+  -> [a]
+  -> BisectM (err,[a]) [(b, [a])]
+     -- ^ On abort, returns the last error and the list of items
+bisect !bis xs = BisectM $ attempt 0 (length xs) xs
+  where
+    attempt k n xs = do
+      r <- liftIO $ bisectProcess bis xs
+      case r of
+        Right x -> return [(x, xs)]
+        Left err -> do
+          r <- lift ask
+          case xs of
+            [x] -> do
+              liftIO $ bisectFailed bis err x
+              e <- liftIO $ atomicModifyIORef' r (\x -> (max 0 (x-1), x))
+              when (e == 0) $ throwE (err,xs)
+              return []
+            _otherwise -> do
+              e <- liftIO $ readIORef r
+              if e > 0
+                then split k n xs
+                else throwE (err,xs)
+
+    split _ _ [] = return []
+    split k n xs = do
+      liftIO $ bisectSplitting bis k n xs
+      (++) <$> attempt k m ys <*> attempt (k+m) (n-m) zs
+      where
+        m = n `div` 2
+        (ys,zs) = splitAt m xs
diff --git a/glean/util/Glean/Util/ConfigProvider.hs b/glean/util/Glean/Util/ConfigProvider.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/ConfigProvider.hs
@@ -0,0 +1,110 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE AllowAmbiguousTypes, TypeFamilyDependencies #-}
+{-# OPTIONS_GHC -Wno-star-is-type #-}
+module Glean.Util.ConfigProvider
+  ( ConfigProvider(..)
+  , ConfigOptions
+  , Deserializer
+  , ConfigPath
+  , TestConfigProvider(..)
+  , withConfigOptions
+
+  -- * The empty config provider that always fails
+  , NullConfigProvider
+  , NullConfigProviderOptions
+  ) where
+
+import Control.Exception
+import Data.ByteString (ByteString)
+import Data.Text (Text)
+import Data.Typeable
+import Options.Applicative (Parser, ParserInfo(..))
+
+import Glean.Init
+
+type Deserializer a = ByteString -> Either String a
+
+type ConfigPath = Text
+
+type family ConfigOptions cfg = opts | opts -> cfg
+
+-- | An interface for a provider of configuration values that might
+-- change over time.
+class ConfigProvider cfg where
+
+  -- | Allow the user to set the config options
+  configOptions :: Parser (ConfigOptions cfg)
+
+  -- | A default set of options
+  defaultConfigOptions :: ConfigOptions cfg
+
+  -- | Create a ConfigProvider
+  withConfigProvider :: ConfigOptions cfg -> (cfg -> IO a) -> IO a
+
+  type Subscription cfg :: * -> *
+
+  -- | subscribe to a configuration value. The callback should be
+  -- invoked whenever the underlying value changes.
+  subscribe
+    :: Typeable a
+    => cfg
+    -> ConfigPath
+    -> (a -> IO ())
+    -> Deserializer a
+    -> IO (Subscription cfg a)
+
+  -- | Stop subscribing to a config
+  cancel :: cfg -> Subscription cfg a -> IO ()
+
+  -- | Fetch a configuration value and deserialize it.
+  get :: Typeable a => cfg -> ConfigPath -> Deserializer a -> IO a
+
+  -- | Identifies exceptions thrown by 'get' or 'subscribe'
+  isConfigFailure :: cfg -> SomeException -> Bool
+
+
+-- | A ConfigProvider in which we can programmatically set values, for testing.
+class ConfigProvider cfg => TestConfigProvider cfg where
+  setTestConfig :: cfg -> ConfigPath -> ByteString -> IO ()
+
+-- | Variant of 'withOptions' that adds in the ConfigProvider options
+withConfigOptions
+  :: ConfigProvider cfg
+  => ParserInfo a
+  -> ((a, ConfigOptions cfg) -> IO b)
+  -> IO b
+withConfigOptions parserInfo fn =
+  Glean.Init.withOptions
+    parserInfo {
+      infoParser = (,) <$> infoParser parserInfo <*> configOptions
+    }
+    fn
+
+-- -----------------------------------------------------------------------------
+-- The empty config provider that always fails.
+--
+-- We use this for unit tests to ensure that we're not accidentally
+-- pulling in configs from the environment.
+
+data NullConfigProvider = NullConfigProvider
+data NullConfigProviderOptions = NullConfigProviderOptions
+data NullConfigSubscription a
+
+type instance ConfigOptions NullConfigProvider = NullConfigProviderOptions
+
+instance ConfigProvider NullConfigProvider where
+  configOptions = pure NullConfigProviderOptions
+  defaultConfigOptions = NullConfigProviderOptions
+  withConfigProvider _ f = f NullConfigProvider
+  type Subscription NullConfigProvider = NullConfigSubscription
+  subscribe _ _ _ _ = throwIO $ ErrorCall "NullConfigProvider: subscribe"
+  cancel _ _ = return ()
+  get _ _ _ = throwIO $ ErrorCall "NullConfigProvider: get"
+  isConfigFailure _ _ = True
diff --git a/glean/util/Glean/Util/Disk.hs b/glean/util/Glean/Util/Disk.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Disk.hs
@@ -0,0 +1,37 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Disk
+  ( getDiskSize
+  , getUsedDiskSpace
+  , getFreeDiskSpace
+  ) where
+import System.Process
+import Text.Printf
+
+-- | Return the size in bytes for the given volume
+--   Throws an IOException if the path doesn't exist
+getDiskSize :: FilePath -> IO Int
+getDiskSize = getDfOutput "size"
+
+-- | Return the used bytes for the given volume
+--   Throws an IOException if the path doesn't exist
+getUsedDiskSpace :: FilePath -> IO Int
+getUsedDiskSpace = getDfOutput "used"
+
+-- | Return the free bytes in the given volume
+--   Throws an IOException if the path doesn't exist
+getFreeDiskSpace :: FilePath -> IO Int
+getFreeDiskSpace = getDfOutput "avail"
+
+-- | Throws an IOException if the path doesn't exist
+getDfOutput :: String -> FilePath -> IO Int
+getDfOutput outp path =
+  read . (!! 1) . words <$> readCreateProcess cmd ""
+  where
+    cmd = shell (printf "df --output=%s -B1 '%s'" outp path)
diff --git a/glean/util/Glean/Util/IO.hs b/glean/util/Glean/Util/IO.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/IO.hs
@@ -0,0 +1,102 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.IO (
+  HandleIO(..),
+  readFileContents, writeFileContents, withTempFileContents,
+  backupFileOnError,
+) where
+
+import Util.Control.Exception
+import Util.Log
+
+import Control.Monad.Extra
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as LBS
+import Data.Maybe
+import qualified Data.Text as Text
+import qualified Data.Text.IO as Text
+import qualified Data.Text.Lazy as LText
+import qualified Data.Text.Lazy.IO as LText
+import System.Directory
+import System.FilePath
+import System.IO
+import qualified System.IO.Temp as Temp
+
+-- Things that can be read from and written to a file handle
+class HandleIO a where
+  getHandleContents :: Handle -> IO a
+  writeHandle :: Handle -> a -> IO ()
+
+instance HandleIO String where
+  getHandleContents = hGetContents
+  writeHandle = hPutStr
+
+instance HandleIO BS.ByteString where
+  getHandleContents = BS.hGetContents
+  writeHandle = BS.hPutStr
+
+instance HandleIO LBS.ByteString where
+  getHandleContents = LBS.hGetContents
+  writeHandle = LBS.hPutStr
+
+instance HandleIO Text.Text where
+  getHandleContents = Text.hGetContents
+  writeHandle = Text.hPutStr
+
+instance HandleIO LText.Text where
+  getHandleContents = LText.hGetContents
+  writeHandle = LText.hPutStr
+
+-- Read the contents of the entire file
+readFileContents :: HandleIO a => FilePath -> IO a
+readFileContents file = getHandleContents =<< openFile file ReadMode
+
+withContents
+    :: HandleIO a => a -> (FilePath -> IO b) -> FilePath -> Handle -> IO b
+withContents s f path handle = do
+  writeHandle handle s
+  hClose handle
+  f path
+
+-- Execute the action with a temp file containing some data
+withTempFileContents :: HandleIO a => a -> (FilePath -> IO b) -> IO b
+withTempFileContents s f =
+  Temp.withSystemTempFile "glean" $ withContents s f
+
+withTempFileContentsIn
+    :: HandleIO a => FilePath -> a -> (FilePath -> IO b) -> IO b
+withTempFileContentsIn dir s f =
+  Temp.withTempFile dir ".glean" $ withContents s f
+
+-- Atomically create or replace the file with the given contents
+writeFileContents :: HandleIO a => FilePath -> a -> IO ()
+writeFileContents file s =
+  withTempFileContentsIn (takeDirectory file) s $ \tmp -> renameFile tmp file
+
+-- | This is a combinator to use with withTempFileContents, to
+-- keep a copy of the temp file when there has been an error.  These
+-- backups are in the @glean-backup-file-on-error@ subdirectory.
+backupFileOnError
+  :: Maybe FilePath
+  -- ^ Folder to place backup, defaults to a subfolder in the same folder
+  -> (FilePath -> IO b)
+  -> (FilePath -> IO b)
+backupFileOnError dir action filepath = do
+  whenJust dir $ createDirectoryIfMissing False
+  action filepath `onSomeException` backup filepath
+  where
+    backup filepath _exc = do
+      let subdir =
+            fromMaybe
+              (takeDirectory filepath </> "glean-backup-file-on-error")
+              dir
+          dest = subdir </> takeFileName filepath
+      logError $ "Making backup of temp file: " <> dest
+      createDirectoryIfMissing True subdir
+      copyFile filepath dest
diff --git a/glean/util/Glean/Util/Metric.hs b/glean/util/Glean/Util/Metric.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Metric.hs
@@ -0,0 +1,94 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Metric (
+  Tick(..), Point(..), beginTick, endTick, endTicks,
+  showLatency, showThroughput,
+  tickLatencyNanoSecs, tickMillis,
+  showMemory, showCount, pad
+) where
+
+import Data.List (find)
+import Data.Word
+import System.Clock
+
+data Tick = Tick
+  { tickValue :: !Word64
+  , tickDuration :: !TimeSpec
+  }
+
+instance Semigroup Tick where
+  Tick v1 d1 <> Tick v2 d2 = Tick (v1+v2) (d1+d2)
+
+instance Monoid Tick where
+  mempty = Tick 0 0
+
+showLatency :: Tick -> String
+showLatency = pad 5 . f where
+  f (Tick 0 _) = "-"
+  f tick = display $ tickLatencyNanoSecs tick
+  display n
+    | n <= 2000 = show n ++ "ns"
+    | n <= 2000000 = show (n `div` 1000) ++ "us"
+    | n <= 2000000000 = show (n `div` 1000000) ++ "ms"
+    | otherwise = show (n `div` 1000000000) ++ "s"
+
+tickLatencyNanoSecs :: Tick -> Integer
+tickLatencyNanoSecs (Tick value time) =
+  toNanoSecs time `div` fromIntegral value
+
+showScaled :: [(Word64, String)] -> Word64 -> String
+showScaled scale value
+  | Just (k,sfx) <- find ((value >=) . fst) scale =
+      let n = (value * 10) `div` k
+      in
+      concat [show $ n `div` 10, ".", show $ n `mod` 10, sfx]
+  | otherwise = show value
+
+showThroughput :: Tick -> String
+showThroughput = pad 9 . f where
+  f tick
+    | ms == 0 = "-"
+    | otherwise = showScaled deciscale rate ++ "B/s"
+   where
+      ms = tickMillis tick
+      rate = (tickValue tick * 1000) `div` ms
+
+deciscale :: [(Word64, String)]
+deciscale = [(1000*1000*1000, "G"), (1000*1000, "M"), (1000, "K")]
+
+tickMillis :: Tick -> Word64
+tickMillis (Tick _ time) =
+  fromIntegral $ sec time * 1000 + nsec time `div` 1000000
+
+data Point = Point
+  { pointValue :: !Word64
+  , pointStart :: !TimeSpec
+  }
+
+beginTick :: Word64 -> IO Point
+beginTick value = Point value <$> getTime Monotonic
+
+endTick :: Point -> IO Tick
+endTick (Point value start) = do
+  now <- getTime Monotonic
+  return $ Tick value (now - start)
+
+endTicks :: [Point] -> IO [Tick]
+endTicks ticks = do
+  now <- getTime Monotonic
+  return [Tick value (now - start) | Point value start <- ticks]
+
+showMemory :: Word64 -> String
+showMemory n = showScaled deciscale n ++ "B"
+
+showCount :: Word64 -> String
+showCount n = showScaled deciscale n
+
+pad :: Int -> String -> String
+pad n s = replicate (n - length s) ' ' <> s
diff --git a/glean/util/Glean/Util/Mutex.hs b/glean/util/Glean/Util/Mutex.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Mutex.hs
@@ -0,0 +1,39 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Mutex (
+  Mutex, newMutex, withMutex, withMutexSafe, withMutex_,
+  tryWithMutex, tryWithMutexSafe,
+) where
+
+import Control.Concurrent.MVar
+import Control.Exception (bracket)
+
+newtype Mutex a = Mutex (MVar a)
+
+newMutex :: a -> IO (Mutex a)
+newMutex x = Mutex <$> newMVar x
+
+withMutex :: Mutex a -> (a -> IO b) -> IO b
+withMutex (Mutex v) = withMVar v
+
+withMutexSafe :: Mutex (f a) -> (forall s . f s -> IO b) -> IO b
+withMutexSafe (Mutex v) = withMVar v
+
+withMutex_ :: Mutex a -> IO b -> IO b
+withMutex_ m = withMutex m . const
+
+tryWithMutex :: Mutex a -> (a -> IO b) -> IO (Maybe b)
+tryWithMutex (Mutex v) f =
+  bracket
+    (tryTakeMVar v)
+    (maybe (return ()) $ putMVar v)
+    (traverse f)
+
+tryWithMutexSafe :: Mutex (f a) -> (forall s . f s -> IO b) -> IO (Maybe b)
+tryWithMutexSafe = tryWithMutex
diff --git a/glean/util/Glean/Util/Observed.hs b/glean/util/Glean/Util/Observed.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Observed.hs
@@ -0,0 +1,75 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | A value that may change over time, and that we can observe efficiently.
+module Glean.Util.Observed
+  ( ObserveMonad(..)
+  , Observed
+  , changingValue
+  , fixedValue
+  , doOnUpdate
+  ) where
+
+import Control.Monad
+import Data.IORef
+
+import Util.STM
+
+-- | A value that may change over time, and that we can observe efficiently.
+data Observed a = Observed
+  { observedGet :: STM a
+  , observedUpdated :: Maybe (IORef (IO ()))
+    -- invoked when the value is updated
+  }
+
+-- | Create an 'Observed' that tracks an underlying value.
+--
+-- The caller should invoke the returned 'IO' action when the
+-- underlying value changes.
+changingValue
+  :: a
+  -> IO (Observed a, (a -> a) -> IO ())
+changingValue initial = do
+  tvar <- newTVarIO initial
+  updateActionRef <- newIORef (return ())
+  let
+    onUpdate fn = do
+      atomically (modifyTVar tvar fn)
+      join $ readIORef updateActionRef
+  return (Observed (readTVar tvar) (Just updateActionRef), onUpdate)
+
+fixedValue :: a -> Observed a
+fixedValue a = Observed (return a) Nothing
+
+instance Functor Observed where
+  fmap f (Observed stm upd) = Observed (fmap f stm) upd
+
+
+-- | Run the given IO action whenever the value in the Observed is
+-- updated. Guarantees (or lack thereof):
+--
+-- * When the action runs, the Observed has already been updated and
+--   'get' will return the new value.
+-- * Multiple instances of the action may run concurrently
+--
+doOnUpdate :: Observed a -> IO () -> IO ()
+doOnUpdate Observed{..} action =
+  forM_ observedUpdated $ \ref ->
+    atomicModifyIORef' ref $ \io -> (io >> action, ())
+
+-- | Monads which can 'get' the current value of an 'Observed'
+class ObserveMonad m where
+  -- | Obtain the current value of an 'Observed'. This is efficient
+  -- enough to be called every time you need the value.
+  get :: Observed a -> m a
+
+instance ObserveMonad STM where
+  get (Observed f _) = f
+
+instance ObserveMonad IO where
+  get = atomically . get
diff --git a/glean/util/Glean/Util/Periodic.hs b/glean/util/Glean/Util/Periodic.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Periodic.hs
@@ -0,0 +1,53 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Periodic (
+    doPeriodically,
+    doPeriodicallySynchronised
+  ) where
+
+import Control.Exception
+import Control.Monad
+
+import Util.Control.Exception
+import Util.Log
+import Util.Time
+
+-- | Run an action every t seconds.  If the action throws an
+-- exception, log and swallow it, and then wait t seconds before
+-- retrying.
+doPeriodically :: DiffTimePoints -> IO () -> IO ()
+doPeriodically period action = mask $ \restore ->
+  forever $ handler restore period $ do
+    t0 <- getTimePoint
+    action
+    t <- getElapsedTime t0
+    delay (addDiffTimePoints period (negate t))
+
+-- | Run an action every t seconds from epoch.  If the action throws an
+-- exception, log and swallow it, and then wait t seconds before
+-- retrying.
+doPeriodicallySynchronised :: DiffTimePoints -> IO () -> IO ()
+doPeriodicallySynchronised period action = mask $ \restore ->
+  forever $ handler restore period $ do
+    now <- getEpochTime
+    let
+      nanosSinceEpoch = fromIntegral $ toEpochNanos now
+      nanosSinceLastTick = nanosSinceEpoch `rem` toDiffNanos period
+      durationSinceLastTick = nanoseconds $ fromIntegral nanosSinceLastTick
+      durationToNextTick =
+        addDiffTimePoints period (negate durationSinceLastTick)
+    delay durationToNextTick
+    action
+
+handler :: (t -> IO ()) -> DiffTimePoints -> t -> IO ()
+handler restore period action = do
+  r <- tryAll (restore action)
+  case r of
+    Left e -> do logError (show e); delay period; return ()
+    Right () -> return ()
diff --git a/glean/util/Glean/Util/Process.hs b/glean/util/Glean/Util/Process.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Process.hs
@@ -0,0 +1,79 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Util.Process (withCreateProcessGroup)
+where
+
+import Control.Concurrent
+import Control.Exception
+import Control.Monad
+import System.IO (Handle)
+import System.Posix.IO
+import System.Posix.Signals (signalProcessGroup, sigKILL, sigTERM)
+import System.Process
+
+import Util.Control.Exception
+
+-- | Just like 'withCreateProcess' except that it always creates a new process
+-- group and terminates all processes in that group on exit - first politely
+-- (SIGTERM) and after a while rudely (SIGKILL). As this happens asynchronously,
+-- we can expect all processes in the new group to be dead soon after
+-- withCreateProcessGroup returns.
+--
+withCreateProcessGroup
+  :: CreateProcess
+  -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a)
+  -> IO a
+withCreateProcessGroup c action =
+  mask $ \restore ->
+  withCreateProcess c{create_group=True} $ \m_in m_out m_err ph -> bracket
+    (do
+      r <- getPid ph
+      case r of
+        Just pid ->
+          do
+            -- Keeping an open handle to any file in /proc/[pid]/ns/ prevents
+            -- the pid from being reused. Assuming nothing calls waitProcess
+            -- before this point (which it shouldn't), this should ensure that
+            -- the pid still refers to the same (potentially dead) process in
+            -- the close action.
+            fd <- openFd
+              ("/proc/" ++ show pid ++ "/ns/pid")
+              ReadOnly
+#if !MIN_VERSION_unix(2,8,0)
+              Nothing
+#endif
+              defaultFileFlags
+            return $ Just (pid,fd)
+          `catchAll` const (return Nothing)
+        Nothing -> return Nothing)
+    (\r -> case r of
+        Just (pid,fd) -> void $ forkIO $
+          restore (do
+          -- This is a fire-and-forget action. First, withCreateProcess will
+          -- SIGTERM the actual process. We give things some time to settle and
+          -- then SIGTERM the entire group and then, after some more time, we
+          -- SIGKILL the entire group.
+          --
+          -- This is somewhat buck specific: we don't SIGTERM the entire group
+          -- immediately because buck likes to spawn things that dump a stack
+          -- trace if they receive SIGTERM but they seem to go away once buck
+          -- itself is dead. So the hope is that they will be gone by the time
+          -- we signal the group.
+          --
+          -- Unfortunately, there is no easy way to figure out if all processes
+          -- in a group are dead so we just signal the group unconditionally but
+          -- really hope that there are no processes left when we do so.
+            threadDelay 2000000
+            void $ tryAll $ signalProcessGroup sigTERM pid
+            threadDelay 2000000
+            void $ tryAll $ signalProcessGroup sigKILL pid)
+          `finally` void (tryAll $ closeFd fd)
+        Nothing -> return ())
+    $ const $ restore (action m_in m_out m_err ph)
diff --git a/glean/util/Glean/Util/RetryChannelException.hs b/glean/util/Glean/Util/RetryChannelException.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/RetryChannelException.hs
@@ -0,0 +1,72 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{- |
+  Provides a configurable wrapper for retrying Thrift requests that may fail
+  with ChannelException.
+-}
+module Glean.Util.RetryChannelException
+  ( RetryPolicy(..)
+  , defaultRetryPolicy
+  , retryChannelExceptions
+  ) where
+
+import Control.Exception
+import Text.Printf
+import System.Random
+import System.Time.Extra
+import Util.Log
+
+import Thrift.Channel
+
+data RetryPolicy = RetryPolicy
+  { maxRetries :: Int
+  , minRetryDelay :: Seconds
+  , maxRetryDelay :: Seconds
+  , retryJitter :: Double -- ^ fraction of delay
+  , onError :: ChannelException -> Int -> Int -> Maybe Double -> IO ()
+  }
+
+defaultRetryPolicy :: RetryPolicy
+defaultRetryPolicy = RetryPolicy
+  { maxRetries = 5
+  , minRetryDelay = 1
+  , maxRetryDelay = 30
+  , retryJitter = 0.2  -- 20%
+  , onError = logRetry
+  }
+
+logRetry :: ChannelException -> Int -> Int -> Maybe Double -> IO ()
+logRetry ex n maxRetries maybeDelay = do
+  let msg = printf "failed (%s) (try %d/%d)" (show ex) n (maxRetries+1)
+  logWarning $ msg <> case maybeDelay of
+    Nothing -> ""
+    Just delay -> printf ", retry after %.2fs" delay
+
+retryChannelExceptions :: RetryPolicy -> IO a -> IO a
+retryChannelExceptions r@RetryPolicy{..} act = go 1
+  where
+  go n = do -- attempt number n
+    e <- try act
+    case e of
+      Right x -> return x
+      Left ex@ChannelException{}
+        | n > maxRetries -> do
+          onError ex n maxRetries Nothing
+          throwIO ex
+        | otherwise -> do
+          delay <- retryDuration r n
+          onError ex n maxRetries (Just delay)
+          sleep delay
+          go (n+1)
+
+retryDuration :: RetryPolicy -> Int -> IO Double
+retryDuration RetryPolicy{..} n = do
+  randomJitter <- randomRIO (-retryJitter, retryJitter)
+  let dur = exp randomJitter * minRetryDelay * 2^(n-1)
+  return $! max minRetryDelay $ min maxRetryDelay dur
diff --git a/glean/util/Glean/Util/RetryRecvTimeout.hs b/glean/util/Glean/Util/RetryRecvTimeout.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/RetryRecvTimeout.hs
@@ -0,0 +1,28 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.RetryRecvTimeout
+  ( retryRecvTimeout
+  , retryServerQueueTimeout
+  ) where
+
+import Data.Text (Text)
+
+retryRecvTimeout
+  :: (Text -> IO ())
+  -> Word
+  -> IO x
+  -> IO x
+retryRecvTimeout _onRetry _retries act = act
+
+retryServerQueueTimeout
+  :: (Text -> IO ())
+  -> Word
+  -> IO x
+  -> IO x
+retryServerQueueTimeout _onRetry _retries act = act
diff --git a/glean/util/Glean/Util/Service.hs b/glean/util/Glean/Util/Service.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Service.hs
@@ -0,0 +1,54 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE PatternSynonyms #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Glean.Util.Service
+  ( -- * Service specification
+    Service(Tier, HostPort)
+  , serviceToString, serviceTier
+    -- ** Aliases
+  , HostName, PortNumber
+  ) where
+
+import qualified Glean.Service.Types as Service
+import Glean.Service.Types hiding (HostPort)
+
+import Data.Int
+import Data.String (IsString(..))
+import Data.Text (Text)
+import qualified Data.Text as Text
+
+type HostName = Text
+type PortNumber = Int
+
+-- The Thrift-generated types are a bit ugly, so let's make synonyms
+pattern Tier :: Text -> Service
+pattern Tier x = Service_tier x
+
+pattern HostPort :: Text -> Int32 -> Service
+pattern HostPort h p = Service_hostPort (Service.HostPort h p)
+
+-- could move this to be attached to the Thrift file to avoid the orphan
+instance IsString Service where
+  fromString s
+    | (rev_port, ':':rev_host) <- break (==':') $ reverse s
+    , [(port,"")] <- reads $ reverse rev_port =
+      HostPort (Text.pack (reverse rev_host)) port
+    | otherwise = Tier (Text.pack s)
+
+serviceToString :: Service -> String
+serviceToString (HostPort h p) = Text.unpack h ++ ":" ++ show p
+serviceToString (Tier s) = Text.unpack s
+serviceToString _ = error "serviceToString" -- pattern synonyms :(
+
+serviceTier :: Service -> Text
+serviceTier HostPort{} = ""
+serviceTier (Tier s) = s
+serviceTier _ = error "serviceToString" -- pattern synonyms :(
diff --git a/glean/util/Glean/Util/ShardManager.hs b/glean/util/Glean/Util/ShardManager.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/ShardManager.hs
@@ -0,0 +1,95 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.ShardManager
+  ( ShardManager(..)
+  , SomeShardManager(..)
+  , BaseOfStack(..)
+  , noSharding
+  , shardByRepo
+  , shardByBaseOfStackRepoHash
+  , shardByRepoHash
+  ) where
+
+import Data.Int (Int64)
+import Data.Map (Map)
+import Data.Text (Text)
+import qualified Glean.Types as Glean
+
+-- | The base db of a stack (or a single db)
+newtype BaseOfStack = BaseOfStack Glean.Repo
+
+-- | An abstraction for sharding Glean DBs across multiple servers
+data ShardManager shard = ShardManager
+  {
+    -- | Returns the list of shards for the current server.
+    --   Nothing means fall back to no sharding.
+    getAssignedShards :: IO (Maybe [shard])
+    -- | Computes a mapping from DB stacks to shard identifiers.
+    --   Takes as input the base of the stack.
+    --   For non stacked dbs, this is just the db itself.
+    --   See note [DB to Shard]
+  , computeShardMapping :: IO (BaseOfStack -> Glean.Repo -> shard)
+  , countersForShardSizes :: Map shard Int64 -> [(Text, Int)]
+  }
+
+data NoSharding = NoSharding
+  deriving (Eq, Ord, Show)
+
+-- | A sharding strategy with a single shard and trivial shard assignment
+noSharding :: ShardManager NoSharding
+noSharding = ShardManager
+  (pure (Just [NoSharding]))
+  (pure $ const $ const NoSharding)
+  (const mempty)
+
+-- | An existential wrapper around a 'ShardManager'
+data SomeShardManager where
+  SomeShardManager
+    :: (Ord shard, Show shard) => ShardManager shard -> SomeShardManager
+
+{- Note: [DB to Shard]
+
+  'dbToShard' only wants the base of the stack. Why?
+
+   We want the following invariant:
+
+     > Every db in a stack maps to the same shard.
+
+  This is for efficiency reasons, as the Glean server needs to download all
+  the dependencies of a DB in order to be able to serve it.
+
+  A simple way to enforce this invariant is to use the base of the stack for
+  computing the shard id for all the dbs in the stack.
+-}
+
+-- | Shard by repo name using the provided dynamic shard assignment.
+--   If the shard assignment is 'Nothing', fall back to no sharding
+shardByRepo :: IO (Maybe [Text]) -> ShardManager Text
+shardByRepo getAssignedShards =
+  ShardManager {
+    getAssignedShards = getAssignedShards,
+    computeShardMapping = pure $ \(BaseOfStack db) _ -> Glean.repo_name db,
+    countersForShardSizes = const []
+  }
+
+-- | A shard manager that uses repo hashes as shards,
+-- and a dynamic shard assignment
+shardByRepoHash :: IO (Maybe [Text]) -> ShardManager Text
+shardByRepoHash refShardAssignment = ShardManager
+  refShardAssignment
+  (pure (\_ Glean.Repo{..} -> repo_hash))
+  (pure [])
+
+-- | A shard manager that uses base of stack repo hashes as shards,
+-- and a dynamic shard assignment
+shardByBaseOfStackRepoHash :: IO (Maybe [Text]) -> ShardManager Text
+shardByBaseOfStackRepoHash refShardAssignment = ShardManager
+  refShardAssignment
+  (pure (\(BaseOfStack Glean.Repo{..}) _ -> repo_hash))
+  (pure [])
diff --git a/glean/util/Glean/Util/Some.hs b/glean/util/Glean/Util/Some.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Some.hs
@@ -0,0 +1,13 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE ConstraintKinds #-}
+module Glean.Util.Some (Some(..)) where
+
+data Some c where
+  Some :: c a => a -> Some c
diff --git a/glean/util/Glean/Util/ThriftService.hs b/glean/util/Glean/Util/ThriftService.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/ThriftService.hs
@@ -0,0 +1,51 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.ThriftService
+  ( ThriftServiceOptions(..)
+  , IsThriftService(..)
+  , thriftService
+  , DbShard
+  , runThriftInefficiently
+  ) where
+
+import Data.Default
+import Data.Text (Text)
+
+import Thrift.Api
+import Util.EventBase (EventBaseDataplane, withEventBaseDataplane)
+
+import Glean.Util.Service
+
+
+-- | Options for creating a Thrift service
+data ThriftServiceOptions = ThriftServiceOptions
+  { processingTimeout :: Maybe Double   -- in seconds
+  , queueTimeout :: Maybe Double  -- in seconds
+  } deriving Show
+
+instance Default ThriftServiceOptions where
+  def = ThriftServiceOptions def def
+
+-- | Used by the Glean client to request a node containing a specific db
+type DbShard = Text -- should be a number, I think
+
+-- | A Thrift service that can be called
+class IsThriftService t where
+  mkThriftService :: Service -> ThriftServiceOptions -> t s
+  -- | Request a node with a specific Db
+  thriftServiceWithDbShard :: t s -> Maybe DbShard -> t s
+  runThrift :: EventBaseDataplane -> t s -> Thrift s a -> IO a
+  getSelection :: EventBaseDataplane -> t s -> Int -> IO [(HostName,PortNumber)]
+
+thriftService :: IsThriftService t => Service -> t s
+thriftService svc = mkThriftService svc def
+
+runThriftInefficiently :: IsThriftService t => t s -> Thrift s a -> IO a
+runThriftInefficiently ts action =
+  withEventBaseDataplane $ \evb -> runThrift evb ts action
diff --git a/glean/util/Glean/Util/ThriftSource.hs b/glean/util/Glean/Util/ThriftSource.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/ThriftSource.hs
@@ -0,0 +1,262 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.ThriftSource (
+  ThriftSource,
+  ThriftSourceException(..),
+
+  -- * Creation
+  config,
+  configDefault,
+  file,
+  value,
+  once,
+  mutable,
+  parse,
+
+  -- ** With a custom deserializer
+  Deserializer,
+  configWithDeserializer,
+  configWithDeserializerDefault,
+  fileWithDeserializer,
+  parseWithDeserializer,
+  genericConfig,
+
+  -- * Reading
+  withValue,
+  load,
+  loadDefault
+) where
+
+import Control.Exception
+import qualified Data.ByteString as BS
+import Data.Default
+import Data.Text (Text)
+import qualified Data.Text as Text
+import Data.Typeable (Typeable)
+
+import Thrift.Protocol (ThriftSerializable)
+import Thrift.Protocol.JSON (deserializeJSON)
+
+import Glean.Util.ConfigProvider as Config
+import Glean.Util.Observed as Observed
+
+-- | A source of values that may change over time.
+data ThriftSource a = ThriftSource
+  { thriftSourceWith
+      :: forall cfg b . (ConfigProvider cfg)
+      => cfg
+      -> (Observed a -> IO b)
+      -> IO b
+  , thriftSourceLoad :: forall cfg . (ConfigProvider cfg) => cfg -> IO a
+  , thriftSourceShow :: String
+  }
+
+-- | Load a configuration value from a source. The value isn't cached - use
+-- 'withValue' and 'Observed.get' for that.
+load
+  :: (ConfigProvider cfg, Typeable a)
+  => cfg
+  -> ThriftSource a
+  -> IO a
+load cfg t = thriftSourceLoad t cfg
+
+-- | Subscribe to a 'ThriftSource' - 'get' will produce the current value.
+--
+-- If actions are added to the 'Observed' via 'doOnUpdate', no further
+-- instances of the actions will be initiated after 'withValue'
+-- returns.
+--
+withValue
+  :: (ConfigProvider cfg, Typeable a)
+  => cfg
+  -> ThriftSource a
+  -> (Observed a -> IO b)
+  -> IO b
+withValue cfg t = thriftSourceWith t cfg
+
+instance Show (ThriftSource a) where
+  show = thriftSourceShow
+
+instance Functor ThriftSource where
+  fmap f ThriftSource{..} = ThriftSource
+    { thriftSourceWith = \cfg g -> thriftSourceWith cfg (\ob -> g (fmap f ob))
+    , thriftSourceLoad = \cfg -> fmap f $ thriftSourceLoad cfg
+    , .. }
+
+instance Default a => Default (ThriftSource a) where
+  def = value def
+
+newtype ThriftSourceException = ThriftSourceException Text
+  deriving(Show)
+
+instance Exception ThriftSourceException
+
+-- | A 'ThriftSource' whose value is obtained by looking up the given
+-- key using the 'ConfigProvider'.
+config
+  :: Typeable a
+  => ThriftSerializable a
+  => Text
+  -> ThriftSource a
+config path = configWithDeserializer path deserializeJSON
+
+-- | As 'config', except that 'Data.Default.def' is used if the config
+-- is missing.
+configDefault
+  :: (Typeable a, Default a)
+  => ThriftSerializable a
+  => Text
+  -> ThriftSource a
+configDefault path = configWithDeserializerDefault path deserializeJSON
+
+-- | A 'ThriftSource' whose value is obtained by looking up the given
+-- key using the 'ConfigProvider', and converting it using the given
+-- 'Deserializer'
+configWithDeserializer
+  :: Typeable a
+  => Text
+  -> Deserializer a
+  -> ThriftSource a
+configWithDeserializer path d = genericConfig path d (const return) Nothing
+
+-- | As 'configWithDeserializer' except that 'Data.Default.def' is
+-- used if the config is missing.
+configWithDeserializerDefault
+  :: (Typeable a, Default a)
+  => Text
+  -> Deserializer a
+  -> ThriftSource a
+configWithDeserializerDefault path d =
+  genericConfig path d (const return) (Just def)
+
+genericConfig
+  :: (Typeable c)
+  => Text
+  -> Deserializer c
+  -> (forall cfg. ConfigProvider cfg => cfg -> c -> IO a)
+  -> Maybe a
+  -> ThriftSource a
+genericConfig key deserializer mkValue maybDefault = ThriftSource
+  { thriftSourceWith = \cfg ->
+      configWithValue cfg key deserializer mkValue maybDefault
+  , thriftSourceLoad = \cfg ->
+      configLoad cfg key deserializer mkValue maybDefault
+  , thriftSourceShow = "ThriftSource Fixed"
+  }
+
+file :: ThriftSerializable a => FilePath -> ThriftSource a
+file path = fileWithDeserializer path deserializeJSON
+
+fileWithDeserializer :: FilePath -> Deserializer a -> ThriftSource a
+fileWithDeserializer path deserializer = once $ do
+  b <- BS.readFile path
+  case deserializer b of
+    Left err -> throwIO $ ThriftSourceException $ Text.pack $
+      "invalid Thrift value in file '" ++ path ++ "': " ++ err
+    Right a -> return a
+
+value :: a -> ThriftSource a
+value = once . return
+
+once :: IO a -> ThriftSource a
+once io = ThriftSource
+  { thriftSourceWith = \_ f -> do x <- io; f (fixedValue x)
+  , thriftSourceLoad = \_ -> io
+  , thriftSourceShow = "ThriftSource Fixed"
+  }
+
+changes :: Observed a -> ThriftSource a
+changes ob = ThriftSource
+  { thriftSourceWith = \_ f -> f ob
+  , thriftSourceLoad = \_ -> Observed.get ob
+  , thriftSourceShow = "ThriftSource Changes"
+  }
+
+mutable :: a -> IO (ThriftSource a, (a -> a) -> IO ())
+mutable x = do
+  (ob, onUpdate) <- changingValue x
+  return (changes ob, onUpdate)
+
+-- | Parser for  \"config:PATH\" and \"file:PATH\" providers
+parse
+  :: (Typeable a, ThriftSerializable a)
+  => String
+  -> Either String (ThriftSource a)
+parse s = parseWithDeserializer s deserializeJSON
+
+-- | Parser for  \"config:PATH\" and \"file:PATH\" providers with a
+-- custom deserializer.
+parseWithDeserializer
+  :: Typeable a
+  => String
+  -> Deserializer a
+  -> Either String (ThriftSource a)
+parseWithDeserializer s des = case break (==':') s of
+  ("config",':':path) ->
+    Right $ configWithDeserializer (Text.pack path) des
+  ("file",':':path) -> Right $ fileWithDeserializer path des
+  (p,':':_) -> Left $ "unsupported Thrift provider '" ++ p ++ "'"
+  _ -> Left $ "invalid Thrift source '" ++ s ++ "'"
+
+-- | Subscribe to a 'ThriftSource' - 'get' will produce the current value.
+--
+-- If actions are added to the 'Observed' via 'doOnUpdate', no further
+-- instances of the actions will be initiated after 'withValue'
+-- returns.
+--
+configWithValue
+  :: (ConfigProvider cfg, Typeable c)
+  => cfg
+  -> Text
+  -> Deserializer c
+  -> (forall cfg. ConfigProvider cfg => cfg -> c -> IO a)
+  -> Maybe a
+  -> (Observed a -> IO b)
+  -> IO b
+
+configWithValue cfgapi path deserialize mkValue maybeDefault action =
+  do
+    (ob, onUpdate) <- changingValue
+      (error "ThriftSource.withValue: internal error")
+    let
+      callback new = do a <- mkValue cfgapi new; onUpdate (const a)
+      acquire =
+        (Just <$> subscribe cfgapi path callback deserialize)
+          `catch` \e -> if
+            | isConfigFailure cfgapi e, Just val <- maybeDefault -> do
+              onUpdate (const val)
+              return Nothing
+            | otherwise -> throwIO e
+    bracket acquire (mapM (cancel cfgapi)) $ const $ action ob
+
+configLoad
+  :: (ConfigProvider cfg, Typeable c)
+  => cfg
+  -> Text
+  -> Deserializer c
+  -> (forall cfg. ConfigProvider cfg => cfg -> c -> IO a)
+  -> Maybe a
+  -> IO a
+configLoad cfgapi path deserialize mkValue maybeDefault =
+  (do c <- Config.get cfgapi path deserialize; mkValue cfgapi c)
+    `catch` \e -> if
+      | isConfigFailure cfgapi e, Just val <- maybeDefault ->
+        return val
+      | otherwise -> throwIO e
+
+-- | Like 'load', but if the value cannot be retrieved then fall back
+-- to using the default value given by the 'Default' instance.
+loadDefault
+  :: (ConfigProvider cfg, Default a, Typeable a)
+  => cfg
+  -> ThriftSource a
+  -> IO a
+loadDefault cfgAPI ts =
+  load cfgAPI ts `catch` \e ->
+    if isConfigFailure cfgAPI e then return def else throwIO e
diff --git a/glean/util/Glean/Util/Throttle.hs b/glean/util/Glean/Util/Throttle.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Throttle.hs
@@ -0,0 +1,29 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Throttle (
+  Execute, atMostEvery
+) where
+
+import Control.Monad
+import Data.IORef
+import System.Clock
+
+type Execute = IO () -> IO ()
+
+atMostEvery :: TimeSpec -> IO Execute
+atMostEvery tm = do
+  now <- getTime Monotonic
+  ref <- newIORef now
+  return $ \action -> do
+    now <- getTime Monotonic
+    go <- atomicModifyIORef' ref $ \next ->
+      if now >= next
+        then (now + tm, True)
+        else (next, False)
+    when go action
diff --git a/glean/util/Glean/Util/Trace.hs b/glean/util/Glean/Util/Trace.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Trace.hs
@@ -0,0 +1,144 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.Trace
+  ( Listener
+  , listener
+  , recorder
+  , notify
+
+  , Expect
+  , expect
+  , reject
+  , accept
+  , want
+  , wants
+  , (>|<)
+  , opt
+  , alt
+  , (|||)
+  , parallel
+  )
+where
+
+import Control.Monad
+import Data.HashMap.Lazy (HashMap)
+import qualified Data.HashMap.Lazy as HashMap
+import Data.Hashable (Hashable)
+import Data.Typeable
+
+import Util.STM
+
+-- | A 'Listener' can be notified of 'Typeable' events. Listeners can be
+-- combined via the 'Semigroup'/'Monoid' interface.
+newtype Listener = Listener (forall a. Typeable a => a -> STM ())
+
+instance Semigroup Listener where
+  Listener f <> Listener g = Listener $ \x -> f x >> g x
+
+instance Monoid Listener where
+  mempty = Listener $ const $ return ()
+
+-- | Create a 'Listener' for a particular type.
+listener :: Typeable a => (a -> STM ()) -> Listener
+listener f = Listener $ mapM_ f . cast
+
+-- | Create a 'Listener' which writes all events to a queue.
+recorder :: Typeable a => IO (Listener, TQueue a)
+recorder = do
+  events <- newTQueueIO
+  return (listener $ writeTQueue events, events)
+
+-- | Notify a listener about an event, ignoring all exceptions.
+notify :: Typeable a => Listener -> a -> STM ()
+notify (Listener f) = f
+
+
+-- | 'Expect' encapsulates expectations about which events should happen in
+-- what order. We can expect a particular event via 'want', sequentially
+-- compose expectations via 'Semigroup'/'Monoid', encode alternatives via
+-- '>|<' and interleave expectations via '|||'. Once an 'Expect' is constructed,
+-- it can be applied to the contents of a 'TQueue' via 'expect'.
+data Expect a = Expect
+  (HashMap a (Expect a))  -- what to do with each event
+  Bool                    -- is this 'Expect' optional
+  deriving(Show)
+
+instance (Eq a, Hashable a) => Semigroup (Expect a) where
+  Expect xs a <> q@(Expect _ b) =
+    alt $ Expect (fmap (<> q) xs) (a && b) : [q | a]
+
+instance (Eq a, Hashable a) => Monoid (Expect a) where
+  mempty = Expect mempty True
+
+-- | An 'Expect' that always fails.
+reject :: (Eq a, Hashable a) => Expect a
+reject = Expect mempty False
+
+-- | An 'Expect' that always succeeds.
+accept :: (Eq a, Hashable a) => Expect a
+accept = mempty
+
+-- | Expect a specific event.
+want :: (Eq a, Hashable a) => a -> Expect a
+want x = Expect (HashMap.singleton x accept) False
+
+-- | Expect a sequence of events.
+wants :: (Eq a, Hashable a) => [a] -> Expect a
+wants = foldr (\x p -> Expect (HashMap.singleton x p) False) accept
+
+infixl 3 >|<
+
+-- | Alternative
+(>|<) :: (Eq a, Hashable a) => Expect a -> Expect a -> Expect a
+Expect xs a >|< Expect ys b = Expect (HashMap.unionWith (>|<) xs ys) (a || b)
+
+-- | Optional
+opt :: (Eq a, Hashable a) => Expect a -> Expect a
+opt p = p >|< accept
+
+-- | Multiple alternatives
+alt :: (Eq a, Hashable a) => [Expect a] -> Expect a
+alt = foldr (>|<) reject
+
+infixl 2 |||
+
+-- | Parallel composition - the two expectations can be arbitrarily interleaved
+-- (both ordering within each 'Expect' is preserved).
+(|||) :: (Eq a, Hashable a) => Expect a -> Expect a -> Expect a
+p@(Expect xs a) ||| q@(Expect ys b) = alt $
+  [ Expect
+      (HashMap.unionWith
+        (>|<)
+        (fmap (||| Expect ys False) xs)
+        (fmap (Expect xs False |||) ys))
+      (a && b) ]
+  ++ [p | b]
+  ++ [q | a]
+
+-- | Interleave multiple 'Expect's.
+parallel :: (Eq a, Hashable a) => [Expect a] -> Expect a
+parallel = foldr (|||) accept
+
+-- | Consume elements of the 'TQueue' until we hit an 'accept', failing on
+-- unexpected elements. This will always consume the smallest possible number
+-- of events.
+expect :: (Eq a, Hashable a, Show a) => TQueue a -> Expect a -> IO ()
+expect queue (Expect xs b)
+  | HashMap.null xs = if b then return () else fail "reject"
+  | otherwise = join $ atomically $ do
+      x <- readTQueue queue
+      case HashMap.lookup x xs of
+        Just p -> return $ expect queue p
+        Nothing
+          | b -> do
+              unGetTQueue queue x
+              return $ return ()
+          | otherwise -> return $ fail $ concat
+              [ "unexpected ", show x
+              , "; expected one of ", show (HashMap.keys xs) ]
diff --git a/glean/util/Glean/Util/TransitiveClosure.hs b/glean/util/Glean/Util/TransitiveClosure.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/TransitiveClosure.hs
@@ -0,0 +1,28 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+module Glean.Util.TransitiveClosure (
+    transitiveClosureBy
+  ) where
+
+import Data.Foldable as Foldable
+import Data.Hashable
+import qualified Data.HashMap.Strict as HashMap
+
+transitiveClosureBy
+  :: (Eq k, Hashable k, Foldable f)
+  => (a -> k) -> (a -> f a) -> [a] -> [a]
+transitiveClosureBy k fn xs = HashMap.elems $ go xs HashMap.empty
+  where
+    go [] r = r
+    go (n:ns) r
+      | k n `HashMap.member` r = go ns r
+      | otherwise =
+        go
+          (Foldable.toList (fn n) ++ ns)
+          (HashMap.insert (k n) n r)
diff --git a/glean/util/Glean/Util/ValueBuffer.hs b/glean/util/Glean/Util/ValueBuffer.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/ValueBuffer.hs
@@ -0,0 +1,95 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+-- | Simple 'Storable'-based append buffers in 'IO' and 'ST'.
+--
+-- The main properties are amortised constant 'push' and constant GC cost.
+module Glean.Util.ValueBuffer
+  ( Buffer, IOBuffer
+  , new
+  , push
+  , appends
+  , get
+  , unsafeFreeze
+  )
+where
+
+import Control.Monad
+import Control.Monad.Primitive
+import Data.Primitive.MutVar
+import Data.Vector.Generic (Vector, Mutable)
+import qualified Data.Vector.Generic as V
+import qualified Data.Vector.Generic.Mutable as MV
+
+data Impl v s a = Impl
+  { _implData :: !(Mutable v s a)
+  , _implLen :: {-# UNPACK #-} !Int
+  }
+
+-- | Append buffer type.
+newtype Buffer v s a = Buffer { _fromBuffer :: MutVar s (Impl v s a) }
+
+-- | 'Buffer' specialised to 'IO'.
+type IOBuffer v = Buffer v RealWorld
+
+-- | Create a new buffer with the given initial capacity.
+new :: (PrimMonad m, Vector v a) => Int -> m (Buffer v (PrimState m) a)
+{-# INLINABLE new #-}
+new cap = do
+  v <- MV.new $ max cap 1
+  Buffer <$> newMutVar (Impl v 0)
+
+-- | Push an element to the buffer, growing it if necessary.
+push :: (PrimMonad m, Vector v a) => Buffer v (PrimState m) a -> a -> m ()
+{-# INLINABLE push #-}
+push (Buffer ref) x = do
+  Impl v i <- readMutVar ref
+  w <- if i < MV.length v
+    then return v
+    else MV.unsafeGrow v (MV.length v)
+  MV.unsafeWrite w i x
+  writeMutVar ref $! Impl w (i+1)
+
+-- | Append multiple batches to the buffer.
+--
+-- NOTE: The list will be evaluated strictly.
+appends
+  :: (PrimMonad m, Vector v a) => Buffer v (PrimState m) a -> [v a] -> m ()
+{-# INLINABLE appends #-}
+appends _ [] = return ()
+appends (Buffer ref) xs = do
+  Impl v i <- readMutVar ref
+  let !n = sum $ map V.length xs
+  !w <- if i+n <= MV.length v
+    then return v
+    else MV.grow v $ max (i + n - MV.length v) (MV.length v)
+  let app !i x = do
+        let k = V.length x
+        V.copy (MV.slice i k w) x
+        return (i+k)
+  i' <- foldM app i xs
+  writeMutVar ref $ Impl w i'
+
+-- | Return the underlying vector.
+--
+-- NOTE: Subsequent changes to the buffer might mutate the vector and vice
+-- versa.
+get
+  :: (PrimMonad m, Vector v a)
+  => Buffer v (PrimState m) a
+  -> m (Mutable v (PrimState m) a)
+{-# INLINABLE get #-}
+get (Buffer ref) = do
+  Impl v i <- readMutVar ref
+  return $ MV.unsafeSlice 0 i v
+
+-- | Freeze the buffer and return all writen elements as a vector.
+unsafeFreeze
+  :: (PrimMonad m, Vector v a) => Buffer v (PrimState m) a -> m (v a)
+{-# INLINABLE unsafeFreeze #-}
+unsafeFreeze = V.unsafeFreeze <=< get
diff --git a/glean/util/Glean/Util/Vector.hs b/glean/util/Glean/Util/Vector.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Vector.hs
@@ -0,0 +1,22 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+{-# LANGUAGE CPP #-}
+module Glean.Util.Vector (
+    unsafeCoerceVector
+  ) where
+
+import Data.Vector.Storable
+#if !MIN_VERSION_vector(0,13,0)
+import Data.Coerce
+#endif
+
+#if !MIN_VERSION_vector(0,13,0)
+unsafeCoerceVector :: Coercible a b => Vector a -> Vector b
+unsafeCoerceVector = coerce
+#endif
diff --git a/glean/util/Glean/Util/Warden.hs b/glean/util/Glean/Util/Warden.hs
new file mode 100644
--- /dev/null
+++ b/glean/util/Glean/Util/Warden.hs
@@ -0,0 +1,104 @@
+{-
+  Copyright (c) Meta Platforms, Inc. and affiliates.
+  All rights reserved.
+
+  This source code is licensed under the BSD-style license found in the
+  LICENSE file in the root directory of this source tree.
+-}
+
+
+module Glean.Util.Warden
+  ( Warden
+  , withWarden
+  , create
+  , shutdown
+  , spawn
+  , spawn_
+  , spawnMask
+  , spawnDaemon
+  , adopt
+  ) where
+
+import Control.Concurrent (forkIO)
+import Control.Concurrent.Async (Async)
+import qualified Control.Concurrent.Async as Async
+import Control.Concurrent.MVar
+import Control.Exception
+import Control.Monad
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet
+import System.IO (fixIO)
+
+import Util.Log
+
+-- | A 'Warden' is an owner of 'Async's which cancels them on 'shutdown'.
+--
+-- 'Nothing' in the MVar means the 'Warden' has been shut down.
+newtype Warden = Warden (MVar (Maybe (HashSet (Async ()))))
+
+-- | Run the action with a new 'Warden', shutting it down when the action
+-- exits.
+withWarden :: (Warden -> IO a) -> IO a
+withWarden = bracket create shutdown
+
+-- | Create a new 'Warden'.
+create :: IO Warden
+create = Warden <$> newMVar (Just mempty)
+
+-- | Shutdown a 'Warden', cancelling all owned threads. Subsequent calls to
+-- 'spawn' and 'shutdown' will be no-ops.
+shutdown :: Warden -> IO ()
+shutdown (Warden v) = do
+  r <- swapMVar v Nothing
+  mapM_ (Async.mapConcurrently_ Async.cancel) r
+
+forget :: Warden -> Async a -> IO ()
+forget (Warden v) async = modifyMVar_ v $ \x -> case x of
+  Just xs -> return $! Just $! HashSet.delete (void async) xs
+  Nothing -> return Nothing
+
+-- | Spawn a thread with masked exceptions and pass an unmask function to the
+-- action.
+spawnMask :: Warden -> ((forall b. IO b -> IO b) -> IO a) -> IO (Async a)
+spawnMask (Warden v) action = modifyMVar v $ \r -> case r of
+  Just asyncs -> do
+    -- Create a new thread which removes itself from the 'HashSet' when it
+    -- exits.
+    this <- fixIO $ \this -> mask_ $ Async.asyncWithUnmask $ \unmask ->
+      action unmask `finally` forget (Warden v) this
+    return (Just $ HashSet.insert (void this) asyncs, this)
+  Nothing -> (,) Nothing <$> Async.async (throwIO Async.AsyncCancelled)
+
+-- | Spawn a new thread owned by the 'Warden'.
+spawn :: Warden -> IO a -> IO (Async a)
+spawn warden action = spawnMask warden $ \unmask -> unmask action
+
+-- | Spawn a new thread owned by the 'Warden'.
+spawn_ :: Warden -> IO () -> IO ()
+spawn_ w = void . spawn w
+
+-- | Run the given IO action repeatedly in a separate thread, catching
+-- and logging any exceptions (Sync or Async) that it throws. Ends
+-- at 'Warden' shutdown.
+spawnDaemon :: Warden -> String -> IO () -> IO ()
+spawnDaemon w name io =
+  void $ spawnMask w $ \restore ->
+    forever $
+      handle (\ex -> case ex of
+        _ | Just Async.AsyncCancelled{} <- fromException ex -> throwIO ex
+          | otherwise -> logError (name <> ": " <> show ex)) $
+        restore io
+
+-- | Adopt an existing thread which will be cancelled when 'Warden' shut down.
+-- If the 'Warden' has already been shut down, the thread will be cancelled
+-- immediately.
+adopt :: Warden -> Async a -> IO ()
+adopt (Warden v) async = modifyMVar_ v $ \r -> case r of
+  Just asyncs -> do
+    void $ forkIO $ do
+      void $ Async.waitCatch async
+      forget (Warden v) async
+    return $ Just $ HashSet.insert (void async) asyncs
+  Nothing -> do
+    Async.cancel async
+    return Nothing
diff --git a/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Cpp/Cpp/Types.hs b/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Cpp/Cpp/Types.hs
new file mode 100644
--- /dev/null
+++ b/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Cpp/Cpp/Types.hs
@@ -0,0 +1,1266 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Facebook.Thrift.Annotation.Cpp.Cpp.Types
+       (Name(Name, name_value), Type(Type, type_name, type_template),
+        Ref(Ref, ref_type),
+        RefType(RefType_Unique, RefType_Shared, RefType_SharedMutable,
+                RefType__UNKNOWN),
+        Lazy(Lazy, lazy_ref), DisableLazyChecksum(DisableLazyChecksum),
+        Adapter(Adapter, adapter_name, adapter_adaptedType,
+                adapter_underlyingName, adapter_extraNamespace, adapter_moveOnly),
+        PackIsset(PackIsset, packIsset_atomic),
+        MinimizePadding(MinimizePadding),
+        ScopedEnumAsUnionType(ScopedEnumAsUnionType),
+        FieldInterceptor(FieldInterceptor, fieldInterceptor_name,
+                         fieldInterceptor_noinline),
+        UseOpEncode(UseOpEncode),
+        EnumUnderlyingType(EnumUnderlyingType_I8, EnumUnderlyingType_U8,
+                           EnumUnderlyingType_I16, EnumUnderlyingType_U16,
+                           EnumUnderlyingType_U32, EnumUnderlyingType__UNKNOWN),
+        EnumType(EnumType, enumType_type), Frozen2Exclude(Frozen2Exclude),
+        Frozen2RequiresCompleteContainerParams(Frozen2RequiresCompleteContainerParams),
+        ProcessInEbThreadUnsafe(ProcessInEbThreadUnsafe),
+        RuntimeAnnotation(RuntimeAnnotation),
+        UseCursorSerialization(UseCursorSerialization),
+        GenerateDeprecatedHeaderClientMethods(GenerateDeprecatedHeaderClientMethods),
+        AllowLegacyNonOptionalRef(AllowLegacyNonOptionalRef),
+        DeprecatedTerseWrite(DeprecatedTerseWrite),
+        AllowLegacyDeprecatedTerseWritesRef(AllowLegacyDeprecatedTerseWritesRef),
+        EnableCustomTypeOrdering(EnableCustomTypeOrdering),
+        GenerateServiceMethodDecorator(GenerateServiceMethodDecorator))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       as Facebook.Thrift.Annotation.Thrift.Thrift
+import qualified GHC.Magic as GHC
+import qualified Prelude as Prelude
+import qualified Scope.Types as Scope
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+newtype Name = Name{name_value :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__value)
+    = Aeson.object ("value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "value" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__value)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__value <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Name __val__value)
+              _idMap = HashMap.fromList [("value", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__value)
+    = DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name ""
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _value)
+    = Hashable.hashWithSalt __salt _value
+
+data Type = Type{type_name :: Text.Text,
+                 type_template :: Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__name __field__template)
+    = Aeson.object
+        ("name" .= __field__name :
+           "template" .= __field__template : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__name __field__template)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "template" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__template)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__template <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__template
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__template <- ST.readSTRef __field__template
+                                             Prelude.pure (Type __val__name __val__template)
+              _idMap = HashMap.fromList [("name", 1), ("template", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__name __field__template)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__template `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type "" ""
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _name _template)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _template
+
+newtype Ref = Ref{ref_type :: RefType}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Ref where
+  toJSON (Ref __field__type)
+    = Aeson.object ("type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct Ref where
+  buildStruct _proxy (Ref __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__type)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RefType")
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure (Ref __val__type)
+              _idMap = HashMap.fromList [("type", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Ref where
+  rnf (Ref __field__type)
+    = DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default Ref where
+  def = Ref Default.def
+
+instance Hashable.Hashable Ref where
+  hashWithSalt __salt (Ref _type)
+    = Hashable.hashWithSalt __salt _type
+
+data RefType = RefType_Unique
+             | RefType_Shared
+             | RefType_SharedMutable
+             | RefType__UNKNOWN Prelude.Int
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RefType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RefType where
+  rnf __RefType = Prelude.seq __RefType ()
+
+instance Default.Default RefType where
+  def = RefType_Unique
+
+instance Hashable.Hashable RefType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RefType where
+  toThriftEnum 0 = RefType_Unique
+  toThriftEnum 1 = RefType_Shared
+  toThriftEnum 2 = RefType_SharedMutable
+  toThriftEnum val = RefType__UNKNOWN val
+  fromThriftEnum RefType_Unique = 0
+  fromThriftEnum RefType_Shared = 1
+  fromThriftEnum RefType_SharedMutable = 2
+  fromThriftEnum (RefType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RefType_Unique, RefType_Shared, RefType_SharedMutable]
+  toThriftEnumEither 0 = Prelude.Right RefType_Unique
+  toThriftEnumEither 1 = Prelude.Right RefType_Shared
+  toThriftEnumEither 2 = Prelude.Right RefType_SharedMutable
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RefType: " ++
+           Prelude.show val)
+
+newtype Lazy = Lazy{lazy_ref :: Prelude.Bool}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Lazy where
+  toJSON (Lazy __field__ref)
+    = Aeson.object ("ref" .= __field__ref : Prelude.mempty)
+
+instance Thrift.ThriftStruct Lazy where
+  buildStruct _proxy (Lazy __field__ref)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "ref" 1 0 __field__ref : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ref <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef __field__ref
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ref <- ST.readSTRef __field__ref
+                                             Prelude.pure (Lazy __val__ref)
+              _idMap = HashMap.fromList [("ref", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Lazy where
+  rnf (Lazy __field__ref) = DeepSeq.rnf __field__ref `Prelude.seq` ()
+
+instance Default.Default Lazy where
+  def = Lazy Prelude.False
+
+instance Hashable.Hashable Lazy where
+  hashWithSalt __salt (Lazy _ref) = Hashable.hashWithSalt __salt _ref
+
+data DisableLazyChecksum = DisableLazyChecksum{}
+                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DisableLazyChecksum where
+  toJSON DisableLazyChecksum = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DisableLazyChecksum where
+  buildStruct _proxy DisableLazyChecksum = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DisableLazyChecksum)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DisableLazyChecksum where
+  rnf DisableLazyChecksum = ()
+
+instance Default.Default DisableLazyChecksum where
+  def = DisableLazyChecksum
+
+instance Hashable.Hashable DisableLazyChecksum where
+  hashWithSalt __salt DisableLazyChecksum = __salt
+
+data Adapter = Adapter{adapter_name :: Text.Text,
+                       adapter_adaptedType :: Text.Text,
+                       adapter_underlyingName :: Text.Text,
+                       adapter_extraNamespace :: Text.Text,
+                       adapter_moveOnly :: Prelude.Bool}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Adapter where
+  toJSON
+    (Adapter __field__name __field__adaptedType __field__underlyingName
+       __field__extraNamespace __field__moveOnly)
+    = Aeson.object
+        ("name" .= __field__name :
+           "adaptedType" .= __field__adaptedType :
+             "underlyingName" .= __field__underlyingName :
+               "extraNamespace" .= __field__extraNamespace :
+                 "moveOnly" .= __field__moveOnly : Prelude.mempty)
+
+instance Thrift.ThriftStruct Adapter where
+  buildStruct _proxy
+    (Adapter __field__name __field__adaptedType __field__underlyingName
+       __field__extraNamespace __field__moveOnly)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "adaptedType" (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__adaptedType)
+             :
+             Thrift.genField _proxy "underlyingName"
+               (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__underlyingName)
+               :
+               Thrift.genField _proxy "extraNamespace"
+                 (Thrift.getStringType _proxy)
+                 4
+                 3
+                 (Thrift.genText _proxy __field__extraNamespace)
+                 : Thrift.genFieldBool _proxy "moveOnly" 5 4 __field__moveOnly : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__adaptedType <- ST.newSTRef ""
+            __field__underlyingName <- ST.newSTRef ""
+            __field__extraNamespace <- ST.newSTRef ""
+            __field__moveOnly <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__adaptedType
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__underlyingName
+                                                                          _val
+                                                                 4 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__extraNamespace
+                                                                          _val
+                                                                 5 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__moveOnly
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__adaptedType <- ST.readSTRef
+                                                                      __field__adaptedType
+                                             !__val__underlyingName <- ST.readSTRef
+                                                                         __field__underlyingName
+                                             !__val__extraNamespace <- ST.readSTRef
+                                                                         __field__extraNamespace
+                                             !__val__moveOnly <- ST.readSTRef __field__moveOnly
+                                             Prelude.pure
+                                               (Adapter __val__name __val__adaptedType
+                                                  __val__underlyingName
+                                                  __val__extraNamespace
+                                                  __val__moveOnly)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("adaptedType", 2), ("underlyingName", 3),
+                     ("extraNamespace", 4), ("moveOnly", 5)]
+            _parse 0)
+
+instance DeepSeq.NFData Adapter where
+  rnf
+    (Adapter __field__name __field__adaptedType __field__underlyingName
+       __field__extraNamespace __field__moveOnly)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__adaptedType `Prelude.seq`
+          DeepSeq.rnf __field__underlyingName `Prelude.seq`
+            DeepSeq.rnf __field__extraNamespace `Prelude.seq`
+              DeepSeq.rnf __field__moveOnly `Prelude.seq` ()
+
+instance Default.Default Adapter where
+  def = Adapter "" "" "" "" Prelude.False
+
+instance Hashable.Hashable Adapter where
+  hashWithSalt __salt
+    (Adapter _name _adaptedType _underlyingName _extraNamespace
+       _moveOnly)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt
+           (Hashable.hashWithSalt
+              (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+                 _adaptedType)
+              _underlyingName)
+           _extraNamespace)
+        _moveOnly
+
+newtype PackIsset = PackIsset{packIsset_atomic :: Prelude.Bool}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON PackIsset where
+  toJSON (PackIsset __field__atomic)
+    = Aeson.object ("atomic" .= __field__atomic : Prelude.mempty)
+
+instance Thrift.ThriftStruct PackIsset where
+  buildStruct _proxy (PackIsset __field__atomic)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "atomic" 1 0 __field__atomic : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__atomic <- ST.newSTRef Prelude.True
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__atomic
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__atomic <- ST.readSTRef
+                                                                 __field__atomic
+                                             Prelude.pure (PackIsset __val__atomic)
+              _idMap = HashMap.fromList [("atomic", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData PackIsset where
+  rnf (PackIsset __field__atomic)
+    = DeepSeq.rnf __field__atomic `Prelude.seq` ()
+
+instance Default.Default PackIsset where
+  def = PackIsset Prelude.True
+
+instance Hashable.Hashable PackIsset where
+  hashWithSalt __salt (PackIsset _atomic)
+    = Hashable.hashWithSalt __salt _atomic
+
+data MinimizePadding = MinimizePadding{}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON MinimizePadding where
+  toJSON MinimizePadding = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct MinimizePadding where
+  buildStruct _proxy MinimizePadding = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (MinimizePadding)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData MinimizePadding where
+  rnf MinimizePadding = ()
+
+instance Default.Default MinimizePadding where
+  def = MinimizePadding
+
+instance Hashable.Hashable MinimizePadding where
+  hashWithSalt __salt MinimizePadding = __salt
+
+data ScopedEnumAsUnionType = ScopedEnumAsUnionType{}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ScopedEnumAsUnionType where
+  toJSON ScopedEnumAsUnionType = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct ScopedEnumAsUnionType where
+  buildStruct _proxy ScopedEnumAsUnionType
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (ScopedEnumAsUnionType)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData ScopedEnumAsUnionType where
+  rnf ScopedEnumAsUnionType = ()
+
+instance Default.Default ScopedEnumAsUnionType where
+  def = ScopedEnumAsUnionType
+
+instance Hashable.Hashable ScopedEnumAsUnionType where
+  hashWithSalt __salt ScopedEnumAsUnionType = __salt
+
+data FieldInterceptor = FieldInterceptor{fieldInterceptor_name ::
+                                         Text.Text,
+                                         fieldInterceptor_noinline :: Prelude.Bool}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldInterceptor where
+  toJSON (FieldInterceptor __field__name __field__noinline)
+    = Aeson.object
+        ("name" .= __field__name :
+           "noinline" .= __field__noinline : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldInterceptor where
+  buildStruct _proxy
+    (FieldInterceptor __field__name __field__noinline)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : Thrift.genFieldBool _proxy "noinline" 2 1 __field__noinline : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__noinline <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__noinline
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__noinline <- ST.readSTRef __field__noinline
+                                             Prelude.pure
+                                               (FieldInterceptor __val__name __val__noinline)
+              _idMap = HashMap.fromList [("name", 1), ("noinline", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldInterceptor where
+  rnf (FieldInterceptor __field__name __field__noinline)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__noinline `Prelude.seq` ()
+
+instance Default.Default FieldInterceptor where
+  def = FieldInterceptor "" Prelude.False
+
+instance Hashable.Hashable FieldInterceptor where
+  hashWithSalt __salt (FieldInterceptor _name _noinline)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _noinline
+
+data UseOpEncode = UseOpEncode{}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UseOpEncode where
+  toJSON UseOpEncode = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UseOpEncode where
+  buildStruct _proxy UseOpEncode = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UseOpEncode)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UseOpEncode where
+  rnf UseOpEncode = ()
+
+instance Default.Default UseOpEncode where
+  def = UseOpEncode
+
+instance Hashable.Hashable UseOpEncode where
+  hashWithSalt __salt UseOpEncode = __salt
+
+data EnumUnderlyingType = EnumUnderlyingType_I8
+                        | EnumUnderlyingType_U8
+                        | EnumUnderlyingType_I16
+                        | EnumUnderlyingType_U16
+                        | EnumUnderlyingType_U32
+                        | EnumUnderlyingType__UNKNOWN Prelude.Int
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumUnderlyingType where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData EnumUnderlyingType where
+  rnf __EnumUnderlyingType = Prelude.seq __EnumUnderlyingType ()
+
+instance Default.Default EnumUnderlyingType where
+  def = EnumUnderlyingType_I8
+
+instance Hashable.Hashable EnumUnderlyingType where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum EnumUnderlyingType where
+  toThriftEnum 0 = EnumUnderlyingType_I8
+  toThriftEnum 1 = EnumUnderlyingType_U8
+  toThriftEnum 2 = EnumUnderlyingType_I16
+  toThriftEnum 3 = EnumUnderlyingType_U16
+  toThriftEnum 4 = EnumUnderlyingType_U32
+  toThriftEnum val = EnumUnderlyingType__UNKNOWN val
+  fromThriftEnum EnumUnderlyingType_I8 = 0
+  fromThriftEnum EnumUnderlyingType_U8 = 1
+  fromThriftEnum EnumUnderlyingType_I16 = 2
+  fromThriftEnum EnumUnderlyingType_U16 = 3
+  fromThriftEnum EnumUnderlyingType_U32 = 4
+  fromThriftEnum (EnumUnderlyingType__UNKNOWN val) = val
+  allThriftEnumValues
+    = [EnumUnderlyingType_I8, EnumUnderlyingType_U8,
+       EnumUnderlyingType_I16, EnumUnderlyingType_U16,
+       EnumUnderlyingType_U32]
+  toThriftEnumEither 0 = Prelude.Right EnumUnderlyingType_I8
+  toThriftEnumEither 1 = Prelude.Right EnumUnderlyingType_U8
+  toThriftEnumEither 2 = Prelude.Right EnumUnderlyingType_I16
+  toThriftEnumEither 3 = Prelude.Right EnumUnderlyingType_U16
+  toThriftEnumEither 4 = Prelude.Right EnumUnderlyingType_U32
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum EnumUnderlyingType: "
+           ++ Prelude.show val)
+
+newtype EnumType = EnumType{enumType_type :: EnumUnderlyingType}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumType where
+  toJSON (EnumType __field__type)
+    = Aeson.object ("type" .= __field__type : Prelude.mempty)
+
+instance Thrift.ThriftStruct EnumType where
+  buildStruct _proxy (EnumType __field__type)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "type" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__type)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__type <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "EnumUnderlyingType")
+                                                                        ST.writeSTRef __field__type
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__type <- ST.readSTRef __field__type
+                                             Prelude.pure (EnumType __val__type)
+              _idMap = HashMap.fromList [("type", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData EnumType where
+  rnf (EnumType __field__type)
+    = DeepSeq.rnf __field__type `Prelude.seq` ()
+
+instance Default.Default EnumType where
+  def = EnumType Default.def
+
+instance Hashable.Hashable EnumType where
+  hashWithSalt __salt (EnumType _type)
+    = Hashable.hashWithSalt __salt _type
+
+data Frozen2Exclude = Frozen2Exclude{}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Frozen2Exclude where
+  toJSON Frozen2Exclude = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Frozen2Exclude where
+  buildStruct _proxy Frozen2Exclude = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Frozen2Exclude)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Frozen2Exclude where
+  rnf Frozen2Exclude = ()
+
+instance Default.Default Frozen2Exclude where
+  def = Frozen2Exclude
+
+instance Hashable.Hashable Frozen2Exclude where
+  hashWithSalt __salt Frozen2Exclude = __salt
+
+data Frozen2RequiresCompleteContainerParams = Frozen2RequiresCompleteContainerParams{}
+                                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Frozen2RequiresCompleteContainerParams where
+  toJSON Frozen2RequiresCompleteContainerParams
+    = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Frozen2RequiresCompleteContainerParams
+         where
+  buildStruct _proxy Frozen2RequiresCompleteContainerParams
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure
+                                               (Frozen2RequiresCompleteContainerParams)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Frozen2RequiresCompleteContainerParams
+         where
+  rnf Frozen2RequiresCompleteContainerParams = ()
+
+instance Default.Default Frozen2RequiresCompleteContainerParams
+         where
+  def = Frozen2RequiresCompleteContainerParams
+
+instance Hashable.Hashable Frozen2RequiresCompleteContainerParams
+         where
+  hashWithSalt __salt Frozen2RequiresCompleteContainerParams = __salt
+
+data ProcessInEbThreadUnsafe = ProcessInEbThreadUnsafe{}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ProcessInEbThreadUnsafe where
+  toJSON ProcessInEbThreadUnsafe = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct ProcessInEbThreadUnsafe where
+  buildStruct _proxy ProcessInEbThreadUnsafe
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (ProcessInEbThreadUnsafe)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData ProcessInEbThreadUnsafe where
+  rnf ProcessInEbThreadUnsafe = ()
+
+instance Default.Default ProcessInEbThreadUnsafe where
+  def = ProcessInEbThreadUnsafe
+
+instance Hashable.Hashable ProcessInEbThreadUnsafe where
+  hashWithSalt __salt ProcessInEbThreadUnsafe = __salt
+
+data RuntimeAnnotation = RuntimeAnnotation{}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RuntimeAnnotation where
+  toJSON RuntimeAnnotation = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct RuntimeAnnotation where
+  buildStruct _proxy RuntimeAnnotation = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (RuntimeAnnotation)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData RuntimeAnnotation where
+  rnf RuntimeAnnotation = ()
+
+instance Default.Default RuntimeAnnotation where
+  def = RuntimeAnnotation
+
+instance Hashable.Hashable RuntimeAnnotation where
+  hashWithSalt __salt RuntimeAnnotation = __salt
+
+data UseCursorSerialization = UseCursorSerialization{}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UseCursorSerialization where
+  toJSON UseCursorSerialization = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct UseCursorSerialization where
+  buildStruct _proxy UseCursorSerialization
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (UseCursorSerialization)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData UseCursorSerialization where
+  rnf UseCursorSerialization = ()
+
+instance Default.Default UseCursorSerialization where
+  def = UseCursorSerialization
+
+instance Hashable.Hashable UseCursorSerialization where
+  hashWithSalt __salt UseCursorSerialization = __salt
+
+data GenerateDeprecatedHeaderClientMethods = GenerateDeprecatedHeaderClientMethods{}
+                                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenerateDeprecatedHeaderClientMethods where
+  toJSON GenerateDeprecatedHeaderClientMethods
+    = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct GenerateDeprecatedHeaderClientMethods
+         where
+  buildStruct _proxy GenerateDeprecatedHeaderClientMethods
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure
+                                               (GenerateDeprecatedHeaderClientMethods)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData GenerateDeprecatedHeaderClientMethods where
+  rnf GenerateDeprecatedHeaderClientMethods = ()
+
+instance Default.Default GenerateDeprecatedHeaderClientMethods
+         where
+  def = GenerateDeprecatedHeaderClientMethods
+
+instance Hashable.Hashable GenerateDeprecatedHeaderClientMethods
+         where
+  hashWithSalt __salt GenerateDeprecatedHeaderClientMethods = __salt
+
+data AllowLegacyNonOptionalRef = AllowLegacyNonOptionalRef{}
+                                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AllowLegacyNonOptionalRef where
+  toJSON AllowLegacyNonOptionalRef = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct AllowLegacyNonOptionalRef where
+  buildStruct _proxy AllowLegacyNonOptionalRef
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (AllowLegacyNonOptionalRef)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData AllowLegacyNonOptionalRef where
+  rnf AllowLegacyNonOptionalRef = ()
+
+instance Default.Default AllowLegacyNonOptionalRef where
+  def = AllowLegacyNonOptionalRef
+
+instance Hashable.Hashable AllowLegacyNonOptionalRef where
+  hashWithSalt __salt AllowLegacyNonOptionalRef = __salt
+
+data DeprecatedTerseWrite = DeprecatedTerseWrite{}
+                            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeprecatedTerseWrite where
+  toJSON DeprecatedTerseWrite = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DeprecatedTerseWrite where
+  buildStruct _proxy DeprecatedTerseWrite
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DeprecatedTerseWrite)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DeprecatedTerseWrite where
+  rnf DeprecatedTerseWrite = ()
+
+instance Default.Default DeprecatedTerseWrite where
+  def = DeprecatedTerseWrite
+
+instance Hashable.Hashable DeprecatedTerseWrite where
+  hashWithSalt __salt DeprecatedTerseWrite = __salt
+
+data AllowLegacyDeprecatedTerseWritesRef = AllowLegacyDeprecatedTerseWritesRef{}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AllowLegacyDeprecatedTerseWritesRef where
+  toJSON AllowLegacyDeprecatedTerseWritesRef
+    = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct AllowLegacyDeprecatedTerseWritesRef
+         where
+  buildStruct _proxy AllowLegacyDeprecatedTerseWritesRef
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure
+                                               (AllowLegacyDeprecatedTerseWritesRef)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData AllowLegacyDeprecatedTerseWritesRef where
+  rnf AllowLegacyDeprecatedTerseWritesRef = ()
+
+instance Default.Default AllowLegacyDeprecatedTerseWritesRef where
+  def = AllowLegacyDeprecatedTerseWritesRef
+
+instance Hashable.Hashable AllowLegacyDeprecatedTerseWritesRef
+         where
+  hashWithSalt __salt AllowLegacyDeprecatedTerseWritesRef = __salt
+
+data EnableCustomTypeOrdering = EnableCustomTypeOrdering{}
+                                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnableCustomTypeOrdering where
+  toJSON EnableCustomTypeOrdering = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct EnableCustomTypeOrdering where
+  buildStruct _proxy EnableCustomTypeOrdering
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (EnableCustomTypeOrdering)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData EnableCustomTypeOrdering where
+  rnf EnableCustomTypeOrdering = ()
+
+instance Default.Default EnableCustomTypeOrdering where
+  def = EnableCustomTypeOrdering
+
+instance Hashable.Hashable EnableCustomTypeOrdering where
+  hashWithSalt __salt EnableCustomTypeOrdering = __salt
+
+data GenerateServiceMethodDecorator = GenerateServiceMethodDecorator{}
+                                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenerateServiceMethodDecorator where
+  toJSON GenerateServiceMethodDecorator = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct GenerateServiceMethodDecorator where
+  buildStruct _proxy GenerateServiceMethodDecorator
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (GenerateServiceMethodDecorator)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData GenerateServiceMethodDecorator where
+  rnf GenerateServiceMethodDecorator = ()
+
+instance Default.Default GenerateServiceMethodDecorator where
+  def = GenerateServiceMethodDecorator
+
+instance Hashable.Hashable GenerateServiceMethodDecorator where
+  hashWithSalt __salt GenerateServiceMethodDecorator = __salt
diff --git a/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Thrift/Thrift/Types.hs b/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Thrift/Thrift/Types.hs
new file mode 100644
--- /dev/null
+++ b/thrift/annotation/gen-hs2/Facebook/Thrift/Annotation/Thrift/Thrift/Types.hs
@@ -0,0 +1,854 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Facebook.Thrift.Annotation.Thrift.Thrift.Types
+       (Experimental(Experimental),
+        ReserveIds(ReserveIds, reserveIds_ids, reserveIds_id_ranges),
+        RequiresBackwardCompatibility(RequiresBackwardCompatibility,
+                                      requiresBackwardCompatibility_field_name),
+        TerseWrite(TerseWrite), Box(Box), Mixin(Mixin),
+        SerializeInFieldIdOrder(SerializeInFieldIdOrder),
+        BitmaskEnum(BitmaskEnum), ExceptionMessage(ExceptionMessage),
+        InternBox(InternBox), Serial(Serial), Uri(Uri, uri_value),
+        Priority(Priority, priority_level),
+        RpcPriority(RpcPriority_HIGH_IMPORTANT, RpcPriority_HIGH,
+                    RpcPriority_IMPORTANT, RpcPriority_NORMAL, RpcPriority_BEST_EFFORT,
+                    RpcPriority__UNKNOWN),
+        DeprecatedUnvalidatedAnnotations(DeprecatedUnvalidatedAnnotations,
+                                         deprecatedUnvalidatedAnnotations_items),
+        AllowReservedIdentifier(AllowReservedIdentifier),
+        AllowReservedFilename(AllowReservedFilename),
+        RuntimeAnnotation(RuntimeAnnotation))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Exception as Exception
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.Function as Function
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.Int as Int
+import qualified Data.List as List
+import qualified Data.Map.Strict as Map
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified GHC.Magic as GHC
+import qualified Prelude as Prelude
+import qualified Scope.Types as Scope
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (++), (>), (==))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+data Experimental = Experimental{}
+                    deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Experimental where
+  toJSON Experimental = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Experimental where
+  buildStruct _proxy Experimental = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Experimental)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Experimental where
+  rnf Experimental = ()
+
+instance Default.Default Experimental where
+  def = Experimental
+
+instance Hashable.Hashable Experimental where
+  hashWithSalt __salt Experimental = __salt
+
+data ReserveIds = ReserveIds{reserveIds_ids :: [Int.Int32],
+                             reserveIds_id_ranges :: Map.Map Int.Int32 Int.Int32}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ReserveIds where
+  toJSON (ReserveIds __field__ids __field__id_ranges)
+    = Aeson.object
+        ("ids" .= __field__ids :
+           "id_ranges" .= Map.mapKeys Thrift.keyToStr __field__id_ranges :
+             Prelude.mempty)
+
+instance Thrift.ThriftStruct ReserveIds where
+  buildStruct _proxy (ReserveIds __field__ids __field__id_ranges)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "ids" (Thrift.getListType _proxy) 1 0
+           (Thrift.genListPrim _proxy (Thrift.getI32Type _proxy)
+              (Thrift.genI32Prim _proxy)
+              __field__ids)
+           :
+           Thrift.genField _proxy "id_ranges" (Thrift.getMapType _proxy) 2 1
+             ((Thrift.genMapPrim _proxy (Thrift.getI32Type _proxy)
+                 (Thrift.getI32Type _proxy)
+                 Prelude.False
+                 (Thrift.genI32Prim _proxy)
+                 (Thrift.genI32Prim _proxy)
+                 . Map.toList)
+                __field__id_ranges)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__ids <- ST.newSTRef Default.def
+            __field__id_ranges <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy))
+                                                                        ST.writeSTRef __field__ids
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        (Thrift.parseI32
+                                                                                           _proxy)
+                                                                                        Prelude.False)
+                                                                        ST.writeSTRef
+                                                                          __field__id_ranges
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__ids <- ST.readSTRef __field__ids
+                                             !__val__id_ranges <- ST.readSTRef __field__id_ranges
+                                             Prelude.pure (ReserveIds __val__ids __val__id_ranges)
+              _idMap = HashMap.fromList [("ids", 1), ("id_ranges", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData ReserveIds where
+  rnf (ReserveIds __field__ids __field__id_ranges)
+    = DeepSeq.rnf __field__ids `Prelude.seq`
+        DeepSeq.rnf __field__id_ranges `Prelude.seq` ()
+
+instance Default.Default ReserveIds where
+  def = ReserveIds Default.def Default.def
+
+instance Hashable.Hashable ReserveIds where
+  hashWithSalt __salt (ReserveIds _ids _id_ranges)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _ids)
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _id_ranges)
+
+newtype RequiresBackwardCompatibility = RequiresBackwardCompatibility{requiresBackwardCompatibility_field_name
+                                                                      :: Prelude.Bool}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RequiresBackwardCompatibility where
+  toJSON (RequiresBackwardCompatibility __field__field_name)
+    = Aeson.object
+        ("field_name" .= __field__field_name : Prelude.mempty)
+
+instance Thrift.ThriftStruct RequiresBackwardCompatibility where
+  buildStruct _proxy
+    (RequiresBackwardCompatibility __field__field_name)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "field_name" 1 0 __field__field_name :
+           [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__field_name <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__field_name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__field_name <- ST.readSTRef
+                                                                     __field__field_name
+                                             Prelude.pure
+                                               (RequiresBackwardCompatibility __val__field_name)
+              _idMap = HashMap.fromList [("field_name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData RequiresBackwardCompatibility where
+  rnf (RequiresBackwardCompatibility __field__field_name)
+    = DeepSeq.rnf __field__field_name `Prelude.seq` ()
+
+instance Default.Default RequiresBackwardCompatibility where
+  def = RequiresBackwardCompatibility Prelude.False
+
+instance Hashable.Hashable RequiresBackwardCompatibility where
+  hashWithSalt __salt (RequiresBackwardCompatibility _field_name)
+    = Hashable.hashWithSalt __salt _field_name
+
+data TerseWrite = TerseWrite{}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON TerseWrite where
+  toJSON TerseWrite = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct TerseWrite where
+  buildStruct _proxy TerseWrite = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (TerseWrite)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData TerseWrite where
+  rnf TerseWrite = ()
+
+instance Default.Default TerseWrite where
+  def = TerseWrite
+
+instance Hashable.Hashable TerseWrite where
+  hashWithSalt __salt TerseWrite = __salt
+
+data Box = Box{}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Box where
+  toJSON Box = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Box where
+  buildStruct _proxy Box = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Box)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Box where
+  rnf Box = ()
+
+instance Default.Default Box where
+  def = Box
+
+instance Hashable.Hashable Box where
+  hashWithSalt __salt Box = __salt
+
+data Mixin = Mixin{}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Mixin where
+  toJSON Mixin = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Mixin where
+  buildStruct _proxy Mixin = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Mixin)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Mixin where
+  rnf Mixin = ()
+
+instance Default.Default Mixin where
+  def = Mixin
+
+instance Hashable.Hashable Mixin where
+  hashWithSalt __salt Mixin = __salt
+
+data SerializeInFieldIdOrder = SerializeInFieldIdOrder{}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SerializeInFieldIdOrder where
+  toJSON SerializeInFieldIdOrder = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct SerializeInFieldIdOrder where
+  buildStruct _proxy SerializeInFieldIdOrder
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (SerializeInFieldIdOrder)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData SerializeInFieldIdOrder where
+  rnf SerializeInFieldIdOrder = ()
+
+instance Default.Default SerializeInFieldIdOrder where
+  def = SerializeInFieldIdOrder
+
+instance Hashable.Hashable SerializeInFieldIdOrder where
+  hashWithSalt __salt SerializeInFieldIdOrder = __salt
+
+data BitmaskEnum = BitmaskEnum{}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON BitmaskEnum where
+  toJSON BitmaskEnum = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct BitmaskEnum where
+  buildStruct _proxy BitmaskEnum = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (BitmaskEnum)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData BitmaskEnum where
+  rnf BitmaskEnum = ()
+
+instance Default.Default BitmaskEnum where
+  def = BitmaskEnum
+
+instance Hashable.Hashable BitmaskEnum where
+  hashWithSalt __salt BitmaskEnum = __salt
+
+data ExceptionMessage = ExceptionMessage{}
+                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ExceptionMessage where
+  toJSON ExceptionMessage = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct ExceptionMessage where
+  buildStruct _proxy ExceptionMessage = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (ExceptionMessage)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData ExceptionMessage where
+  rnf ExceptionMessage = ()
+
+instance Default.Default ExceptionMessage where
+  def = ExceptionMessage
+
+instance Hashable.Hashable ExceptionMessage where
+  hashWithSalt __salt ExceptionMessage = __salt
+
+data InternBox = InternBox{}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON InternBox where
+  toJSON InternBox = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct InternBox where
+  buildStruct _proxy InternBox = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (InternBox)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData InternBox where
+  rnf InternBox = ()
+
+instance Default.Default InternBox where
+  def = InternBox
+
+instance Hashable.Hashable InternBox where
+  hashWithSalt __salt InternBox = __salt
+
+data Serial = Serial{}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Serial where
+  toJSON Serial = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Serial where
+  buildStruct _proxy Serial = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Serial)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Serial where
+  rnf Serial = ()
+
+instance Default.Default Serial where
+  def = Serial
+
+instance Hashable.Hashable Serial where
+  hashWithSalt __salt Serial = __salt
+
+newtype Uri = Uri{uri_value :: Text.Text}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Uri where
+  toJSON (Uri __field__value)
+    = Aeson.object ("value" .= __field__value : Prelude.mempty)
+
+instance Thrift.ThriftStruct Uri where
+  buildStruct _proxy (Uri __field__value)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "value" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__value)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__value <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__value
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__value <- ST.readSTRef __field__value
+                                             Prelude.pure (Uri __val__value)
+              _idMap = HashMap.fromList [("value", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Uri where
+  rnf (Uri __field__value)
+    = DeepSeq.rnf __field__value `Prelude.seq` ()
+
+instance Default.Default Uri where
+  def = Uri ""
+
+instance Hashable.Hashable Uri where
+  hashWithSalt __salt (Uri _value)
+    = Hashable.hashWithSalt __salt _value
+
+newtype Priority = Priority{priority_level :: RpcPriority}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Priority where
+  toJSON (Priority __field__level)
+    = Aeson.object ("level" .= __field__level : Prelude.mempty)
+
+instance Thrift.ThriftStruct Priority where
+  buildStruct _proxy (Priority __field__level)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "level" (Thrift.getI32Type _proxy) 1 0
+           ((Thrift.genI32 _proxy . Prelude.fromIntegral .
+               Thrift.fromThriftEnum)
+              __field__level)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__level <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getI32Type _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseEnum
+                                                                                      _proxy
+                                                                                      "RpcPriority")
+                                                                        ST.writeSTRef __field__level
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__level <- ST.readSTRef __field__level
+                                             Prelude.pure (Priority __val__level)
+              _idMap = HashMap.fromList [("level", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Priority where
+  rnf (Priority __field__level)
+    = DeepSeq.rnf __field__level `Prelude.seq` ()
+
+instance Default.Default Priority where
+  def = Priority Default.def
+
+instance Hashable.Hashable Priority where
+  hashWithSalt __salt (Priority _level)
+    = Hashable.hashWithSalt __salt _level
+
+data RpcPriority = RpcPriority_HIGH_IMPORTANT
+                 | RpcPriority_HIGH
+                 | RpcPriority_IMPORTANT
+                 | RpcPriority_NORMAL
+                 | RpcPriority_BEST_EFFORT
+                 | RpcPriority__UNKNOWN Prelude.Int
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RpcPriority where
+  toJSON = Aeson.toJSON . Thrift.fromThriftEnum
+
+instance DeepSeq.NFData RpcPriority where
+  rnf __RpcPriority = Prelude.seq __RpcPriority ()
+
+instance Default.Default RpcPriority where
+  def = RpcPriority_HIGH_IMPORTANT
+
+instance Hashable.Hashable RpcPriority where
+  hashWithSalt _salt _val
+    = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
+
+instance Thrift.ThriftEnum RpcPriority where
+  toThriftEnum 0 = RpcPriority_HIGH_IMPORTANT
+  toThriftEnum 1 = RpcPriority_HIGH
+  toThriftEnum 2 = RpcPriority_IMPORTANT
+  toThriftEnum 3 = RpcPriority_NORMAL
+  toThriftEnum 4 = RpcPriority_BEST_EFFORT
+  toThriftEnum val = RpcPriority__UNKNOWN val
+  fromThriftEnum RpcPriority_HIGH_IMPORTANT = 0
+  fromThriftEnum RpcPriority_HIGH = 1
+  fromThriftEnum RpcPriority_IMPORTANT = 2
+  fromThriftEnum RpcPriority_NORMAL = 3
+  fromThriftEnum RpcPriority_BEST_EFFORT = 4
+  fromThriftEnum (RpcPriority__UNKNOWN val) = val
+  allThriftEnumValues
+    = [RpcPriority_HIGH_IMPORTANT, RpcPriority_HIGH,
+       RpcPriority_IMPORTANT, RpcPriority_NORMAL, RpcPriority_BEST_EFFORT]
+  toThriftEnumEither 0 = Prelude.Right RpcPriority_HIGH_IMPORTANT
+  toThriftEnumEither 1 = Prelude.Right RpcPriority_HIGH
+  toThriftEnumEither 2 = Prelude.Right RpcPriority_IMPORTANT
+  toThriftEnumEither 3 = Prelude.Right RpcPriority_NORMAL
+  toThriftEnumEither 4 = Prelude.Right RpcPriority_BEST_EFFORT
+  toThriftEnumEither val
+    = Prelude.Left
+        ("toThriftEnumEither: not a valid identifier for enum RpcPriority: "
+           ++ Prelude.show val)
+
+newtype DeprecatedUnvalidatedAnnotations = DeprecatedUnvalidatedAnnotations{deprecatedUnvalidatedAnnotations_items
+                                                                            ::
+                                                                            Map.Map Text.Text
+                                                                              Text.Text}
+                                           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DeprecatedUnvalidatedAnnotations where
+  toJSON (DeprecatedUnvalidatedAnnotations __field__items)
+    = Aeson.object ("items" .= __field__items : Prelude.mempty)
+
+instance Thrift.ThriftStruct DeprecatedUnvalidatedAnnotations where
+  buildStruct _proxy
+    (DeprecatedUnvalidatedAnnotations __field__items)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "items" (Thrift.getMapType _proxy) 1 0
+           ((Thrift.genMap _proxy (Thrift.getStringType _proxy)
+               (Thrift.getStringType _proxy)
+               Prelude.True
+               (Thrift.genText _proxy)
+               (Thrift.genText _proxy)
+               . Map.toList)
+              __field__items)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__items <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getMapType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Map.fromList <$>
+                                                                                      Thrift.parseMap
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        (Thrift.parseText
+                                                                                           _proxy)
+                                                                                        Prelude.True)
+                                                                        ST.writeSTRef __field__items
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__items <- ST.readSTRef __field__items
+                                             Prelude.pure
+                                               (DeprecatedUnvalidatedAnnotations __val__items)
+              _idMap = HashMap.fromList [("items", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData DeprecatedUnvalidatedAnnotations where
+  rnf (DeprecatedUnvalidatedAnnotations __field__items)
+    = DeepSeq.rnf __field__items `Prelude.seq` ()
+
+instance Default.Default DeprecatedUnvalidatedAnnotations where
+  def = DeprecatedUnvalidatedAnnotations Default.def
+
+instance Hashable.Hashable DeprecatedUnvalidatedAnnotations where
+  hashWithSalt __salt (DeprecatedUnvalidatedAnnotations _items)
+    = Hashable.hashWithSalt __salt
+        ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _items)
+
+data AllowReservedIdentifier = AllowReservedIdentifier{}
+                               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AllowReservedIdentifier where
+  toJSON AllowReservedIdentifier = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct AllowReservedIdentifier where
+  buildStruct _proxy AllowReservedIdentifier
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (AllowReservedIdentifier)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData AllowReservedIdentifier where
+  rnf AllowReservedIdentifier = ()
+
+instance Default.Default AllowReservedIdentifier where
+  def = AllowReservedIdentifier
+
+instance Hashable.Hashable AllowReservedIdentifier where
+  hashWithSalt __salt AllowReservedIdentifier = __salt
+
+data AllowReservedFilename = AllowReservedFilename{}
+                             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON AllowReservedFilename where
+  toJSON AllowReservedFilename = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct AllowReservedFilename where
+  buildStruct _proxy AllowReservedFilename
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (AllowReservedFilename)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData AllowReservedFilename where
+  rnf AllowReservedFilename = ()
+
+instance Default.Default AllowReservedFilename where
+  def = AllowReservedFilename
+
+instance Hashable.Hashable AllowReservedFilename where
+  hashWithSalt __salt AllowReservedFilename = __salt
+
+data RuntimeAnnotation = RuntimeAnnotation{}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RuntimeAnnotation where
+  toJSON RuntimeAnnotation = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct RuntimeAnnotation where
+  buildStruct _proxy RuntimeAnnotation = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (RuntimeAnnotation)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData RuntimeAnnotation where
+  rnf RuntimeAnnotation = ()
+
+instance Default.Default RuntimeAnnotation where
+  def = RuntimeAnnotation
+
+instance Hashable.Hashable RuntimeAnnotation where
+  hashWithSalt __salt RuntimeAnnotation = __salt
diff --git a/thrift/annotation/gen-hs2/Hack/Types.hs b/thrift/annotation/gen-hs2/Hack/Types.hs
new file mode 100644
--- /dev/null
+++ b/thrift/annotation/gen-hs2/Hack/Types.hs
@@ -0,0 +1,669 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Hack.Types
+       (FieldWrapper(FieldWrapper, fieldWrapper_name),
+        Wrapper(Wrapper, wrapper_name, wrapper_underlyingName,
+                wrapper_extraNamespace),
+        Adapter(Adapter, adapter_name),
+        SkipCodegen(SkipCodegen, skipCodegen_reason),
+        Name(Name, name_name, name_reason),
+        UnionEnumAttributes(UnionEnumAttributes,
+                            unionEnumAttributes_attributes),
+        StructTrait(StructTrait, structTrait_name),
+        Attributes(Attributes, attributes_attributes),
+        StructAsTrait(StructAsTrait), ModuleInternal(ModuleInternal),
+        GenerateClientMethodsWithHeaders(GenerateClientMethodsWithHeaders))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Prelude as Prelude
+import qualified Scope.Types as Scope
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+newtype FieldWrapper = FieldWrapper{fieldWrapper_name :: Text.Text}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FieldWrapper where
+  toJSON (FieldWrapper __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct FieldWrapper where
+  buildStruct _proxy (FieldWrapper __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (FieldWrapper __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData FieldWrapper where
+  rnf (FieldWrapper __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default FieldWrapper where
+  def = FieldWrapper ""
+
+instance Hashable.Hashable FieldWrapper where
+  hashWithSalt __salt (FieldWrapper _name)
+    = Hashable.hashWithSalt __salt _name
+
+data Wrapper = Wrapper{wrapper_name :: Text.Text,
+                       wrapper_underlyingName :: Text.Text,
+                       wrapper_extraNamespace :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Wrapper where
+  toJSON
+    (Wrapper __field__name __field__underlyingName
+       __field__extraNamespace)
+    = Aeson.object
+        ("name" .= __field__name :
+           "underlyingName" .= __field__underlyingName :
+             "extraNamespace" .= __field__extraNamespace : Prelude.mempty)
+
+instance Thrift.ThriftStruct Wrapper where
+  buildStruct _proxy
+    (Wrapper __field__name __field__underlyingName
+       __field__extraNamespace)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "underlyingName"
+             (Thrift.getStringType _proxy)
+             2
+             1
+             (Thrift.genText _proxy __field__underlyingName)
+             :
+             Thrift.genField _proxy "extraNamespace"
+               (Thrift.getStringType _proxy)
+               3
+               2
+               (Thrift.genText _proxy __field__extraNamespace)
+               : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__underlyingName <- ST.newSTRef ""
+            __field__extraNamespace <- ST.newSTRef "thrift_adapted_types"
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__underlyingName
+                                                                          _val
+                                                                 3 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__extraNamespace
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__underlyingName <- ST.readSTRef
+                                                                         __field__underlyingName
+                                             !__val__extraNamespace <- ST.readSTRef
+                                                                         __field__extraNamespace
+                                             Prelude.pure
+                                               (Wrapper __val__name __val__underlyingName
+                                                  __val__extraNamespace)
+              _idMap
+                = HashMap.fromList
+                    [("name", 1), ("underlyingName", 2), ("extraNamespace", 3)]
+            _parse 0)
+
+instance DeepSeq.NFData Wrapper where
+  rnf
+    (Wrapper __field__name __field__underlyingName
+       __field__extraNamespace)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__underlyingName `Prelude.seq`
+          DeepSeq.rnf __field__extraNamespace `Prelude.seq` ()
+
+instance Default.Default Wrapper where
+  def = Wrapper "" "" "thrift_adapted_types"
+
+instance Hashable.Hashable Wrapper where
+  hashWithSalt __salt (Wrapper _name _underlyingName _extraNamespace)
+    = Hashable.hashWithSalt
+        (Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+           _underlyingName)
+        _extraNamespace
+
+newtype Adapter = Adapter{adapter_name :: Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Adapter where
+  toJSON (Adapter __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Adapter where
+  buildStruct _proxy (Adapter __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Adapter __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Adapter where
+  rnf (Adapter __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Adapter where
+  def = Adapter ""
+
+instance Hashable.Hashable Adapter where
+  hashWithSalt __salt (Adapter _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype SkipCodegen = SkipCodegen{skipCodegen_reason :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON SkipCodegen where
+  toJSON (SkipCodegen __field__reason)
+    = Aeson.object ("reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct SkipCodegen where
+  buildStruct _proxy (SkipCodegen __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "reason" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__reason)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__reason <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__reason <- ST.readSTRef
+                                                                 __field__reason
+                                             Prelude.pure (SkipCodegen __val__reason)
+              _idMap = HashMap.fromList [("reason", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData SkipCodegen where
+  rnf (SkipCodegen __field__reason)
+    = DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default SkipCodegen where
+  def = SkipCodegen ""
+
+instance Hashable.Hashable SkipCodegen where
+  hashWithSalt __salt (SkipCodegen _reason)
+    = Hashable.hashWithSalt __salt _reason
+
+data Name = Name{name_name :: Text.Text, name_reason :: Text.Text}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__name __field__reason)
+    = Aeson.object
+        ("name" .= __field__name :
+           "reason" .= __field__reason : Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__name __field__reason)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           :
+           Thrift.genField _proxy "reason" (Thrift.getStringType _proxy) 2 1
+             (Thrift.genText _proxy __field__reason)
+             : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            __field__reason <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 2 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef
+                                                                          __field__reason
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             !__val__reason <- ST.readSTRef __field__reason
+                                             Prelude.pure (Name __val__name __val__reason)
+              _idMap = HashMap.fromList [("name", 1), ("reason", 2)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__name __field__reason)
+    = DeepSeq.rnf __field__name `Prelude.seq`
+        DeepSeq.rnf __field__reason `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name "" ""
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _name _reason)
+    = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _name)
+        _reason
+
+newtype UnionEnumAttributes = UnionEnumAttributes{unionEnumAttributes_attributes
+                                                  :: [Text.Text]}
+                              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON UnionEnumAttributes where
+  toJSON (UnionEnumAttributes __field__attributes)
+    = Aeson.object
+        ("attributes" .= __field__attributes : Prelude.mempty)
+
+instance Thrift.ThriftStruct UnionEnumAttributes where
+  buildStruct _proxy (UnionEnumAttributes __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__attributes)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__attributes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__attributes <- ST.readSTRef
+                                                                     __field__attributes
+                                             Prelude.pure (UnionEnumAttributes __val__attributes)
+              _idMap = HashMap.fromList [("attributes", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData UnionEnumAttributes where
+  rnf (UnionEnumAttributes __field__attributes)
+    = DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default UnionEnumAttributes where
+  def = UnionEnumAttributes Default.def
+
+instance Hashable.Hashable UnionEnumAttributes where
+  hashWithSalt __salt (UnionEnumAttributes _attributes)
+    = Hashable.hashWithSalt __salt _attributes
+
+newtype StructTrait = StructTrait{structTrait_name :: Text.Text}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructTrait where
+  toJSON (StructTrait __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct StructTrait where
+  buildStruct _proxy (StructTrait __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (StructTrait __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData StructTrait where
+  rnf (StructTrait __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default StructTrait where
+  def = StructTrait ""
+
+instance Hashable.Hashable StructTrait where
+  hashWithSalt __salt (StructTrait _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype Attributes = Attributes{attributes_attributes ::
+                                [Text.Text]}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Attributes where
+  toJSON (Attributes __field__attributes)
+    = Aeson.object
+        ("attributes" .= __field__attributes : Prelude.mempty)
+
+instance Thrift.ThriftStruct Attributes where
+  buildStruct _proxy (Attributes __field__attributes)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "attributes" (Thrift.getListType _proxy) 1
+           0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__attributes)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__attributes <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__attributes
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__attributes <- ST.readSTRef
+                                                                     __field__attributes
+                                             Prelude.pure (Attributes __val__attributes)
+              _idMap = HashMap.fromList [("attributes", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Attributes where
+  rnf (Attributes __field__attributes)
+    = DeepSeq.rnf __field__attributes `Prelude.seq` ()
+
+instance Default.Default Attributes where
+  def = Attributes Default.def
+
+instance Hashable.Hashable Attributes where
+  hashWithSalt __salt (Attributes _attributes)
+    = Hashable.hashWithSalt __salt _attributes
+
+data StructAsTrait = StructAsTrait{}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON StructAsTrait where
+  toJSON StructAsTrait = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct StructAsTrait where
+  buildStruct _proxy StructAsTrait = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (StructAsTrait)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData StructAsTrait where
+  rnf StructAsTrait = ()
+
+instance Default.Default StructAsTrait where
+  def = StructAsTrait
+
+instance Hashable.Hashable StructAsTrait where
+  hashWithSalt __salt StructAsTrait = __salt
+
+data ModuleInternal = ModuleInternal{}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ModuleInternal where
+  toJSON ModuleInternal = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct ModuleInternal where
+  buildStruct _proxy ModuleInternal = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (ModuleInternal)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData ModuleInternal where
+  rnf ModuleInternal = ()
+
+instance Default.Default ModuleInternal where
+  def = ModuleInternal
+
+instance Hashable.Hashable ModuleInternal where
+  hashWithSalt __salt ModuleInternal = __salt
+
+data GenerateClientMethodsWithHeaders = GenerateClientMethodsWithHeaders{}
+                                        deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON GenerateClientMethodsWithHeaders where
+  toJSON GenerateClientMethodsWithHeaders
+    = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct GenerateClientMethodsWithHeaders where
+  buildStruct _proxy GenerateClientMethodsWithHeaders
+    = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure
+                                               (GenerateClientMethodsWithHeaders)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData GenerateClientMethodsWithHeaders where
+  rnf GenerateClientMethodsWithHeaders = ()
+
+instance Default.Default GenerateClientMethodsWithHeaders where
+  def = GenerateClientMethodsWithHeaders
+
+instance Hashable.Hashable GenerateClientMethodsWithHeaders where
+  hashWithSalt __salt GenerateClientMethodsWithHeaders = __salt
diff --git a/thrift/annotation/gen-hs2/Rust/Types.hs b/thrift/annotation/gen-hs2/Rust/Types.hs
new file mode 100644
--- /dev/null
+++ b/thrift/annotation/gen-hs2/Rust/Types.hs
@@ -0,0 +1,667 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Rust.Types
+       (Name(Name, name_name), Copy(Copy), RequestContext(RequestContext),
+        Arc(Arc), Box(Box), Exhaustive(Exhaustive), Ord(Ord),
+        NewType(NewType), Type(Type, type_name),
+        Serde(Serde, serde_enabled), Mod(Mod, mod_name),
+        Adapter(Adapter, adapter_name), Derive(Derive, derive_derives),
+        ServiceExn(ServiceExn, serviceExn_anyhow_to_application_exn))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified Data.Text as Text
+import qualified Data.Text.Encoding as Text
+import qualified Prelude as Prelude
+import qualified Scope.Types as Scope
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+newtype Name = Name{name_name :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Name where
+  toJSON (Name __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Name where
+  buildStruct _proxy (Name __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Name __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Name where
+  rnf (Name __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Name where
+  def = Name ""
+
+instance Hashable.Hashable Name where
+  hashWithSalt __salt (Name _name)
+    = Hashable.hashWithSalt __salt _name
+
+data Copy = Copy{}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Copy where
+  toJSON Copy = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Copy where
+  buildStruct _proxy Copy = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Copy)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Copy where
+  rnf Copy = ()
+
+instance Default.Default Copy where
+  def = Copy
+
+instance Hashable.Hashable Copy where
+  hashWithSalt __salt Copy = __salt
+
+data RequestContext = RequestContext{}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RequestContext where
+  toJSON RequestContext = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct RequestContext where
+  buildStruct _proxy RequestContext = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (RequestContext)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData RequestContext where
+  rnf RequestContext = ()
+
+instance Default.Default RequestContext where
+  def = RequestContext
+
+instance Hashable.Hashable RequestContext where
+  hashWithSalt __salt RequestContext = __salt
+
+data Arc = Arc{}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Arc where
+  toJSON Arc = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Arc where
+  buildStruct _proxy Arc = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Arc)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Arc where
+  rnf Arc = ()
+
+instance Default.Default Arc where
+  def = Arc
+
+instance Hashable.Hashable Arc where
+  hashWithSalt __salt Arc = __salt
+
+data Box = Box{}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Box where
+  toJSON Box = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Box where
+  buildStruct _proxy Box = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Box)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Box where
+  rnf Box = ()
+
+instance Default.Default Box where
+  def = Box
+
+instance Hashable.Hashable Box where
+  hashWithSalt __salt Box = __salt
+
+data Exhaustive = Exhaustive{}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Exhaustive where
+  toJSON Exhaustive = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Exhaustive where
+  buildStruct _proxy Exhaustive = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Exhaustive)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Exhaustive where
+  rnf Exhaustive = ()
+
+instance Default.Default Exhaustive where
+  def = Exhaustive
+
+instance Hashable.Hashable Exhaustive where
+  hashWithSalt __salt Exhaustive = __salt
+
+data Ord = Ord{}
+           deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Ord where
+  toJSON Ord = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Ord where
+  buildStruct _proxy Ord = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Ord)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Ord where
+  rnf Ord = ()
+
+instance Default.Default Ord where
+  def = Ord
+
+instance Hashable.Hashable Ord where
+  hashWithSalt __salt Ord = __salt
+
+data NewType = NewType{}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON NewType where
+  toJSON NewType = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct NewType where
+  buildStruct _proxy NewType = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (NewType)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData NewType where
+  rnf NewType = ()
+
+instance Default.Default NewType where
+  def = NewType
+
+instance Hashable.Hashable NewType where
+  hashWithSalt __salt NewType = __salt
+
+newtype Type = Type{type_name :: Text.Text}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Type where
+  toJSON (Type __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Type where
+  buildStruct _proxy (Type __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Type __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Type where
+  rnf (Type __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Type where
+  def = Type ""
+
+instance Hashable.Hashable Type where
+  hashWithSalt __salt (Type _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype Serde = Serde{serde_enabled :: Prelude.Bool}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Serde where
+  toJSON (Serde __field__enabled)
+    = Aeson.object ("enabled" .= __field__enabled : Prelude.mempty)
+
+instance Thrift.ThriftStruct Serde where
+  buildStruct _proxy (Serde __field__enabled)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "enabled" 1 0 __field__enabled : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__enabled <- ST.newSTRef Prelude.True
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__enabled
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__enabled <- ST.readSTRef
+                                                                  __field__enabled
+                                             Prelude.pure (Serde __val__enabled)
+              _idMap = HashMap.fromList [("enabled", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Serde where
+  rnf (Serde __field__enabled)
+    = DeepSeq.rnf __field__enabled `Prelude.seq` ()
+
+instance Default.Default Serde where
+  def = Serde Prelude.True
+
+instance Hashable.Hashable Serde where
+  hashWithSalt __salt (Serde _enabled)
+    = Hashable.hashWithSalt __salt _enabled
+
+newtype Mod = Mod{mod_name :: Text.Text}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Mod where
+  toJSON (Mod __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Mod where
+  buildStruct _proxy (Mod __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Mod __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Mod where
+  rnf (Mod __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Mod where
+  def = Mod ""
+
+instance Hashable.Hashable Mod where
+  hashWithSalt __salt (Mod _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype Adapter = Adapter{adapter_name :: Text.Text}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Adapter where
+  toJSON (Adapter __field__name)
+    = Aeson.object ("name" .= __field__name : Prelude.mempty)
+
+instance Thrift.ThriftStruct Adapter where
+  buildStruct _proxy (Adapter __field__name)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "name" (Thrift.getStringType _proxy) 1 0
+           (Thrift.genText _proxy __field__name)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__name <- ST.newSTRef ""
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getStringType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseText
+                                                                                      _proxy)
+                                                                        ST.writeSTRef __field__name
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__name <- ST.readSTRef __field__name
+                                             Prelude.pure (Adapter __val__name)
+              _idMap = HashMap.fromList [("name", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Adapter where
+  rnf (Adapter __field__name)
+    = DeepSeq.rnf __field__name `Prelude.seq` ()
+
+instance Default.Default Adapter where
+  def = Adapter ""
+
+instance Hashable.Hashable Adapter where
+  hashWithSalt __salt (Adapter _name)
+    = Hashable.hashWithSalt __salt _name
+
+newtype Derive = Derive{derive_derives :: [Text.Text]}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Derive where
+  toJSON (Derive __field__derives)
+    = Aeson.object ("derives" .= __field__derives : Prelude.mempty)
+
+instance Thrift.ThriftStruct Derive where
+  buildStruct _proxy (Derive __field__derives)
+    = Thrift.genStruct _proxy
+        (Thrift.genField _proxy "derives" (Thrift.getListType _proxy) 1 0
+           (Thrift.genList _proxy (Thrift.getStringType _proxy)
+              (Thrift.genText _proxy)
+              __field__derives)
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__derives <- ST.newSTRef Default.def
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getListType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Prelude.snd <$>
+                                                                                      Thrift.parseList
+                                                                                        _proxy
+                                                                                        (Thrift.parseText
+                                                                                           _proxy))
+                                                                        ST.writeSTRef
+                                                                          __field__derives
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__derives <- ST.readSTRef
+                                                                  __field__derives
+                                             Prelude.pure (Derive __val__derives)
+              _idMap = HashMap.fromList [("derives", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData Derive where
+  rnf (Derive __field__derives)
+    = DeepSeq.rnf __field__derives `Prelude.seq` ()
+
+instance Default.Default Derive where
+  def = Derive Default.def
+
+instance Hashable.Hashable Derive where
+  hashWithSalt __salt (Derive _derives)
+    = Hashable.hashWithSalt __salt _derives
+
+newtype ServiceExn = ServiceExn{serviceExn_anyhow_to_application_exn
+                                :: Prelude.Bool}
+                     deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ServiceExn where
+  toJSON (ServiceExn __field__anyhow_to_application_exn)
+    = Aeson.object
+        ("anyhow_to_application_exn" .= __field__anyhow_to_application_exn
+           : Prelude.mempty)
+
+instance Thrift.ThriftStruct ServiceExn where
+  buildStruct _proxy (ServiceExn __field__anyhow_to_application_exn)
+    = Thrift.genStruct _proxy
+        (Thrift.genFieldBool _proxy "anyhow_to_application_exn" 1 0
+           __field__anyhow_to_application_exn
+           : [])
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            __field__anyhow_to_application_exn <- ST.newSTRef Prelude.False
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 1 | _type ==
+                                                                       Thrift.getBoolType _proxy
+                                                                     ->
+                                                                     do !_val <- Trans.lift
+                                                                                   (Thrift.parseBoolF
+                                                                                      _proxy
+                                                                                      _bool)
+                                                                        ST.writeSTRef
+                                                                          __field__anyhow_to_application_exn
+                                                                          _val
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do !__val__anyhow_to_application_exn <- ST.readSTRef
+                                                                                    __field__anyhow_to_application_exn
+                                             Prelude.pure
+                                               (ServiceExn __val__anyhow_to_application_exn)
+              _idMap = HashMap.fromList [("anyhow_to_application_exn", 1)]
+            _parse 0)
+
+instance DeepSeq.NFData ServiceExn where
+  rnf (ServiceExn __field__anyhow_to_application_exn)
+    = DeepSeq.rnf __field__anyhow_to_application_exn `Prelude.seq` ()
+
+instance Default.Default ServiceExn where
+  def = ServiceExn Prelude.False
+
+instance Hashable.Hashable ServiceExn where
+  hashWithSalt __salt (ServiceExn _anyhow_to_application_exn)
+    = Hashable.hashWithSalt __salt _anyhow_to_application_exn
diff --git a/thrift/annotation/gen-hs2/Scope/Types.hs b/thrift/annotation/gen-hs2/Scope/Types.hs
new file mode 100644
--- /dev/null
+++ b/thrift/annotation/gen-hs2/Scope/Types.hs
@@ -0,0 +1,742 @@
+-----------------------------------------------------------------
+-- Autogenerated by Thrift
+--
+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+--  @generated
+-----------------------------------------------------------------
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports#-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
+{-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+module Scope.Types
+       (Transitive(Transitive), Program(Program), Struct(Struct),
+        Union(Union), Exception(Exception),
+        ThrownException(ThrownException), Field(Field), Typedef(Typedef),
+        Service(Service), Interaction(Interaction), Function(Function),
+        FunctionParameter(FunctionParameter), EnumValue(EnumValue),
+        Const(Const), Enum(Enum), Structured(Structured),
+        Interface(Interface), RootDefinition(RootDefinition),
+        Definition(Definition), DisableSchemaConst(DisableSchemaConst))
+       where
+import qualified Control.DeepSeq as DeepSeq
+import qualified Control.Monad as Monad
+import qualified Control.Monad.ST.Trans as ST
+import qualified Control.Monad.Trans.Class as Trans
+import qualified Data.Aeson as Aeson
+import qualified Data.Aeson.Types as Aeson
+import qualified Data.Default as Default
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.Hashable as Hashable
+import qualified Data.List as List
+import qualified Data.Ord as Ord
+import qualified Prelude as Prelude
+import qualified Thrift.Binary.Parser as Parser
+import qualified Thrift.CodegenTypesOnly as Thrift
+import Control.Applicative ((<|>), (*>), (<*))
+import Data.Aeson ((.:), (.:?), (.=), (.!=))
+import Data.Monoid ((<>))
+import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
+
+data Transitive = Transitive{}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Transitive where
+  toJSON Transitive = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Transitive where
+  buildStruct _proxy Transitive = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Transitive)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Transitive where
+  rnf Transitive = ()
+
+instance Default.Default Transitive where
+  def = Transitive
+
+instance Hashable.Hashable Transitive where
+  hashWithSalt __salt Transitive = __salt
+
+data Program = Program{}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Program where
+  toJSON Program = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Program where
+  buildStruct _proxy Program = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Program)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Program where
+  rnf Program = ()
+
+instance Default.Default Program where
+  def = Program
+
+instance Hashable.Hashable Program where
+  hashWithSalt __salt Program = __salt
+
+data Struct = Struct{}
+              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Struct where
+  toJSON Struct = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Struct where
+  buildStruct _proxy Struct = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Struct)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Struct where
+  rnf Struct = ()
+
+instance Default.Default Struct where
+  def = Struct
+
+instance Hashable.Hashable Struct where
+  hashWithSalt __salt Struct = __salt
+
+data Union = Union{}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Union where
+  toJSON Union = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Union where
+  buildStruct _proxy Union = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Union)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Union where
+  rnf Union = ()
+
+instance Default.Default Union where
+  def = Union
+
+instance Hashable.Hashable Union where
+  hashWithSalt __salt Union = __salt
+
+data Exception = Exception{}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Exception where
+  toJSON Exception = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Exception where
+  buildStruct _proxy Exception = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Exception)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Exception where
+  rnf Exception = ()
+
+instance Default.Default Exception where
+  def = Exception
+
+instance Hashable.Hashable Exception where
+  hashWithSalt __salt Exception = __salt
+
+data ThrownException = ThrownException{}
+                       deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON ThrownException where
+  toJSON ThrownException = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct ThrownException where
+  buildStruct _proxy ThrownException = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (ThrownException)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData ThrownException where
+  rnf ThrownException = ()
+
+instance Default.Default ThrownException where
+  def = ThrownException
+
+instance Hashable.Hashable ThrownException where
+  hashWithSalt __salt ThrownException = __salt
+
+data Field = Field{}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Field where
+  toJSON Field = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Field where
+  buildStruct _proxy Field = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Field)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Field where
+  rnf Field = ()
+
+instance Default.Default Field where
+  def = Field
+
+instance Hashable.Hashable Field where
+  hashWithSalt __salt Field = __salt
+
+data Typedef = Typedef{}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Typedef where
+  toJSON Typedef = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Typedef where
+  buildStruct _proxy Typedef = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Typedef)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Typedef where
+  rnf Typedef = ()
+
+instance Default.Default Typedef where
+  def = Typedef
+
+instance Hashable.Hashable Typedef where
+  hashWithSalt __salt Typedef = __salt
+
+data Service = Service{}
+               deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Service where
+  toJSON Service = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Service where
+  buildStruct _proxy Service = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Service)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Service where
+  rnf Service = ()
+
+instance Default.Default Service where
+  def = Service
+
+instance Hashable.Hashable Service where
+  hashWithSalt __salt Service = __salt
+
+data Interaction = Interaction{}
+                   deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Interaction where
+  toJSON Interaction = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Interaction where
+  buildStruct _proxy Interaction = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Interaction)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Interaction where
+  rnf Interaction = ()
+
+instance Default.Default Interaction where
+  def = Interaction
+
+instance Hashable.Hashable Interaction where
+  hashWithSalt __salt Interaction = __salt
+
+data Function = Function{}
+                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Function where
+  toJSON Function = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Function where
+  buildStruct _proxy Function = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Function)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Function where
+  rnf Function = ()
+
+instance Default.Default Function where
+  def = Function
+
+instance Hashable.Hashable Function where
+  hashWithSalt __salt Function = __salt
+
+data FunctionParameter = FunctionParameter{}
+                         deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON FunctionParameter where
+  toJSON FunctionParameter = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct FunctionParameter where
+  buildStruct _proxy FunctionParameter = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (FunctionParameter)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData FunctionParameter where
+  rnf FunctionParameter = ()
+
+instance Default.Default FunctionParameter where
+  def = FunctionParameter
+
+instance Hashable.Hashable FunctionParameter where
+  hashWithSalt __salt FunctionParameter = __salt
+
+data EnumValue = EnumValue{}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON EnumValue where
+  toJSON EnumValue = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct EnumValue where
+  buildStruct _proxy EnumValue = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (EnumValue)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData EnumValue where
+  rnf EnumValue = ()
+
+instance Default.Default EnumValue where
+  def = EnumValue
+
+instance Hashable.Hashable EnumValue where
+  hashWithSalt __salt EnumValue = __salt
+
+data Const = Const{}
+             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Const where
+  toJSON Const = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Const where
+  buildStruct _proxy Const = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Const)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Const where
+  rnf Const = ()
+
+instance Default.Default Const where
+  def = Const
+
+instance Hashable.Hashable Const where
+  hashWithSalt __salt Const = __salt
+
+data Enum = Enum{}
+            deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Enum where
+  toJSON Enum = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Enum where
+  buildStruct _proxy Enum = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Enum)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Enum where
+  rnf Enum = ()
+
+instance Default.Default Enum where
+  def = Enum
+
+instance Hashable.Hashable Enum where
+  hashWithSalt __salt Enum = __salt
+
+data Structured = Structured{}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Structured where
+  toJSON Structured = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Structured where
+  buildStruct _proxy Structured = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Structured)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Structured where
+  rnf Structured = ()
+
+instance Default.Default Structured where
+  def = Structured
+
+instance Hashable.Hashable Structured where
+  hashWithSalt __salt Structured = __salt
+
+data Interface = Interface{}
+                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Interface where
+  toJSON Interface = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Interface where
+  buildStruct _proxy Interface = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Interface)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Interface where
+  rnf Interface = ()
+
+instance Default.Default Interface where
+  def = Interface
+
+instance Hashable.Hashable Interface where
+  hashWithSalt __salt Interface = __salt
+
+data RootDefinition = RootDefinition{}
+                      deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON RootDefinition where
+  toJSON RootDefinition = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct RootDefinition where
+  buildStruct _proxy RootDefinition = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (RootDefinition)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData RootDefinition where
+  rnf RootDefinition = ()
+
+instance Default.Default RootDefinition where
+  def = RootDefinition
+
+instance Hashable.Hashable RootDefinition where
+  hashWithSalt __salt RootDefinition = __salt
+
+data Definition = Definition{}
+                  deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON Definition where
+  toJSON Definition = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct Definition where
+  buildStruct _proxy Definition = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (Definition)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData Definition where
+  rnf Definition = ()
+
+instance Default.Default Definition where
+  def = Definition
+
+instance Hashable.Hashable Definition where
+  hashWithSalt __salt Definition = __salt
+
+data DisableSchemaConst = DisableSchemaConst{}
+                          deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
+
+instance Aeson.ToJSON DisableSchemaConst where
+  toJSON DisableSchemaConst = Aeson.object Prelude.mempty
+
+instance Thrift.ThriftStruct DisableSchemaConst where
+  buildStruct _proxy DisableSchemaConst = Thrift.genStruct _proxy []
+  parseStruct _proxy
+    = ST.runSTT
+        (do Prelude.return ()
+            let
+              _parse _lastId
+                = do _fieldBegin <- Trans.lift
+                                      (Thrift.parseFieldBegin _proxy _lastId _idMap)
+                     case _fieldBegin of
+                       Thrift.FieldBegin _type _id _bool -> do case _id of
+                                                                 _ -> Trans.lift
+                                                                        (Thrift.parseSkip _proxy
+                                                                           _type
+                                                                           (Prelude.Just _bool))
+                                                               _parse _id
+                       Thrift.FieldEnd -> do Prelude.pure (DisableSchemaConst)
+              _idMap = HashMap.fromList []
+            _parse 0)
+
+instance DeepSeq.NFData DisableSchemaConst where
+  rnf DisableSchemaConst = ()
+
+instance Default.Default DisableSchemaConst where
+  def = DisableSchemaConst
+
+instance Hashable.Hashable DisableSchemaConst where
+  hashWithSalt __salt DisableSchemaConst = __salt
